clone

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

fix: hold names up on the sphere, and hold the map in the middle

Dami committed abd7012
Z now means the same thing on both panes: the globe raises name cards
over the pins nearest what the camera faces, within a budget --
a planet of two thousand names at once is noise -- rebuilt as the view
settles and dropped on release. The cards were being built all along
and drawn nowhere: a sprite's anchor lives in the unit square, and an
anchor pushed past it took the card with it.

The chart loses its top-anchor bias: the camera is constrained to the
map's own window rather than the world square it is cut from, so a
sheet shorter than the square centers in the pane instead of hugging
the square's empty top. A variant swap rebuilds the constraint around
the new layer's window while keeping the reader's place, which is what
split sheets needed anyway. And the backquote now flips panes from
inside the geohash field the way space works the subgrid from it -- no
hash will ever spell either character.
commit
abd701294c01e0cfdecfa9aed4123593cbfed018
parent
700f3d11f42490c0e0960facf3a60a990620ba2e
author
Dami <dami.etoile@gmail.com>
6 files changed, +370 -251
Massets/app.js488+++++++++++++++---------------
Mfrontend/src/engine.js12+-
Mfrontend/src/events.js7+
Mfrontend/src/globe.js100++++++-
Mfrontend/src/navigation.js11+-
Mfrontend/src/pins.js3+
M assets/app.js +244 -244
@@ -1,18 +1,18 @@
1-(()=>{var kse=Object.create;var G4=Object.defineProperty;var Gse=Object.getOwnPropertyDescriptor;var zse=Object.getOwnPropertyNames;var Vse=Object.getPrototypeOf,qse=Object.prototype.hasOwnProperty;var Hse=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},Wse=(i,e)=>{for(var t in e)G4(i,t,{get:e[t],enumerable:!0})},jse=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of zse(e))!qse.call(i,r)&&r!==t&&G4(i,r,{get:()=>e[r],enumerable:!(n=Gse(e,r))||n.enumerable});return i};var Xse=(i,e,t)=>(t=i!=null?kse(Vse(i)):{},jse(e||!i||!i.__esModule?G4(t,"default",{value:i,enumerable:!0}):t,i));var I$=Hse((pv,E6)=>{(function(i,e){typeof pv=="object"&&typeof E6=="object"?E6.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof pv=="object"?pv.FrameTicker=e():i.FrameTicker=e()})(pv,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 $9=i=>new Promise(e=>setTimeout(e,i)),ss=i=>document.querySelector(i);async function $se(){for(let i=0;i<300&&!(window.__atlasDebug&&!ss("#map-loading")?.checkVisibility?.());i+=1)await $9(100)}async function Yse(){let i="";for(let e=0;e<100;e+=1){await $9(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 pd(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function Zse(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function Kse(i){ss("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function D0(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function z4(i,e){let t=ss(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function V4(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 Qse(){let i=[],e=async p=>{await Yse(),i.push({name:p,snapshot:JSON.parse(window.render_game_to_text())})};await $se(),localStorage.clear();let t=ss("#game-select"),n=t.options[0].value;D0(t,n),await e("initial"),z4("#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")),z4("#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 p=ss("#solo-chip");p&&!p.hidden&&p.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")),pd("g"),await e("grid-open"),z4("#grid-input","m"),await e("grid-descended"),pd(" "),await e("subgrid-hidden"),pd(" "),pd("Escape"),await e("grid-ascended"),pd("Escape"),await e("grid-closed"),pd("z"),await e("labels-on"),Zse("z"),await e("labels-off"),pd("b",{metaKey:!0}),await e("sidebar-collapsed"),pd("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"),Kse("Escape"),await e("viewport-escape");let u=ss("#variant-select");u.options.length>1&&(D0(u,u.options[1].value),await e("variant-second"),D0(u,u.options[0].value),await e("variant-first"));let f=ss("#map-select");return f.options.length>1&&(D0(f,f.options[1].value),await e("map-second"),D0(f,f.options[0].value),await e("map-first")),t.options.length>1&&(D0(t,t.options[1].value),await e("game-second"),D0(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var q4=!1;async function Y9(){if(!q4){q4=!0,V4("parity tour running\u2026");try{let i=await Qse(),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}`);V4(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){V4(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{q4=!1}}}window.__atlasTour=Y9;window.addEventListener("keydown",i=>{i.key==="F9"&&Y9()});var nn=i=>document.querySelector(i),we={game:nn("#game-select"),map:nn("#map-select"),variant:nn("#variant-select"),variantField:nn("#variant-field"),legend:nn("#legend"),search:nn("#pin-search"),searchResults:nn("#dock-results"),dock:nn("#dock"),dockCount:nn("#dock-count"),dockFlag:nn("#dock-flag"),dockFold:nn("#dock-fold"),dockRailName:nn("#dock-rail-name"),visibleCount:nn("#visible-count"),viewport:nn("#map"),globe:nn("#globe"),globeToggle:nn("#globe-toggle"),layers:nn("#layers"),zoneToggle:nn("#zone-toggle"),zoneCount:nn("#zone-count"),zoneIndex:nn("#zone-index"),zoneList:nn("#zone-list"),loading:nn("#map-loading"),labelsHint:nn("#labels-hint"),gridHint:nn("#grid-hint"),soloChip:nn("#solo-chip"),overview:nn("#overview"),overviewShelf:nn("#overview-shelf"),overviewDock:nn("#overview-dock"),overviewCanvas:nn("#overview-canvas"),overviewViewport:nn("#overview-viewport"),gridNavigator:nn("#grid-navigator"),gridInput:nn("#grid-input"),gridBack:nn("#grid-back"),subgridToggle:nn("#subgrid-toggle"),detail:nn("#pin-detail"),detailTitle:nn("#detail-title"),detailCategory:nn("#detail-category"),detailDescription:nn("#detail-description"),detailID:nn("#detail-id"),detailCoordinates:nn("#detail-coordinates"),detailCell:nn("#detail-cell"),detailCellField:nn("#detail-cell-field"),detailSource:nn("#detail-source"),detailSourceField:nn("#detail-source-field"),detailLinks:nn("#detail-links"),detailDot:nn("#detail-dot"),sidebar:nn("#sidebar"),mobileLegend:nn("#mobile-legend"),fatal:nn("#fatal-error"),fatalMessage:nn("#fatal-message"),emptyState:nn("#empty-state"),emptyPath:nn("#empty-path"),emptyOpen:nn("#empty-open"),addBundles:nn("#add-bundles")};function F0(i,e,t,n){i.replaceChildren(),e.forEach((r,s)=>{let o=document.createElement("option");o.value=n?String(r[n]):r.slug||String(s),o.textContent=r[t],i.append(o)})}var U={catalog:null,game:null,map:null,variant:null,engine:null,projection:null,layers:null,sources:null,hiddenCategories:new Set,collapsedSections:new Set,pins:[],pinByID:new Map,selectedPin:null,hoveredPin:null,labelsHeld:!1,gridEnabled:!1,globeActive:!1,subgridVisible:!0,gridPrefix:"",zonesVisible:!0,zoneRecords:new Map,highlightedZones:new Set,focusedZoneID:null,search:"",fitZoom:0,zoneTitleCount:0,eligibleLocations:0,tileRun:0,tileStats:{requested:0,loaded:0,errors:0,peakPending:0},overviewRun:0,overviewKey:"",overviewPointer:null,overviewDocked:!1,dockFolded:!0,dockDismissed:!1,renderedShard:0,mapRun:0,textByMap:new Map,restore:null,settling:!1,styleCache:new Map,markerIcons:new Map};var rg=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],Hl="0123456789bcdefghjkmnpqrstuvwxyz";var H4="atlas.session";var Z9={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"};var gs={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function W4(i){let e=Cr();for(let t=0,n=i.length;t<n;++t)U0(e,i[t]);return e}function Jse(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 cl(n,r,s,o,t)}function sg(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 ow(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function Ad(i,e,t){let n,r;return e<i[0]?n=i[0]-e:i[2]<e?n=e-i[2]:n=0,t<i[1]?r=i[1]-t:i[3]<t?r=t-i[3]:r=0,n*n+r*r}function wc(i,e){return px(i,e[0],e[1])}function mu(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function px(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function sw(i,e){let t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1],l=gs.UNKNOWN;return o<t?l=l|gs.LEFT:o>r&&(l=l|gs.RIGHT),a<n?l=l|gs.BELOW:a>s&&(l=l|gs.ABOVE),l===gs.UNKNOWN&&(l=gs.INTERSECTING),l}function Cr(){return[1/0,1/0,-1/0,-1/0]}function cl(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 O0(i){return cl(1/0,1/0,-1/0,-1/0,i)}function aw(i,e){let t=i[0],n=i[1];return cl(t,n,t,n,e)}function og(i,e,t,n,r){let s=O0(r);return j4(s,i,e,t,n)}function B0(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function lw(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 U0(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 j4(i,e,t,n,r){for(;t<n;t+=r)eoe(i,e[t],e[t+1]);return i}function eoe(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 cw(i,e){let t;return t=e(ag(i)),t||(t=e(lg(i)),t)||(t=e(cg(i)),t)||(t=e(Wl(i)),t)?t:!1}function Ax(i){let e=0;return _u(i)||(e=jn(i)*_r(i)),e}function ag(i){return[i[0],i[1]]}function lg(i){return[i[2],i[1]]}function Ua(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function K9(i,e){let t;if(e==="bottom-left")t=ag(i);else if(e==="bottom-right")t=lg(i);else if(e==="top-left")t=Wl(i);else if(e==="top-right")t=cg(i);else throw new Error("Invalid corner");return t}function mx(i,e,t,n,r){let[s,o,a,l,c,u,f,p]=X4(i,e,t,n);return cl(Math.min(s,a,c,f),Math.min(o,l,u,p),Math.max(s,a,c,f),Math.max(o,l,u,p),r)}function X4(i,e,t,n){let r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(t),a=Math.sin(t),l=r*o,c=r*a,u=s*o,f=s*a,p=i[0],x=i[1];return[p-l+f,x-c-u,p-l-f,x-c+u,p+l-f,x+c+u,p+l+f,x+c-u,p-l+f,x-c-u]}function _r(i){return i[3]-i[1]}function gu(i,e,t){let n=t||Cr();return xr(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]):O0(n),n}function $4(i,e){if(!xr(i,e))return[i.slice()];if(mu(e,i))return[];let[t,n,r,s]=i,o=Math.max(t,e[0]),a=Math.max(n,e[1]),l=Math.min(r,e[2]),c=Math.min(s,e[3]),u=[];return o>t&&u.push([t,n,o,s]),l<r&&u.push([l,n,r,s]),a>n&&u.push([o,n,l,a]),c<s&&u.push([o,c,l,s]),u}function Wl(i){return[i[0],i[3]]}function cg(i){return[i[2],i[3]]}function jn(i){return i[2]-i[0]}function xr(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function _u(i){return i[2]<i[0]||i[3]<i[1]}function Q9(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function J9(i,e,t){let n=!1,r=sw(i,e),s=sw(i,t);if(r===gs.INTERSECTING||s===gs.INTERSECTING)n=!0;else{let o=i[0],a=i[1],l=i[2],c=i[3],u=e[0],f=e[1],p=t[0],x=t[1],v=(x-f)/(p-u),w,S;s&gs.ABOVE&&!(r&gs.ABOVE)&&(w=p-(x-c)/v,n=w>=o&&w<=l),!n&&s&gs.RIGHT&&!(r&gs.RIGHT)&&(S=x-(p-l)*v,n=S>=a&&S<=c),!n&&s&gs.BELOW&&!(r&gs.BELOW)&&(w=p-(x-a)/v,n=w>=o&&w<=l),!n&&s&gs.LEFT&&!(r&gs.LEFT)&&(S=x-(p-o)*v,n=S>=a&&S<=c)}return n}function eG(i,e,t,n){if(_u(i))return O0(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 Jse(s,o,t)}function Y4(i,e){let t=e.getExtent(),n=Ua(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=jn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function uw(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]]];Y4(i,e);let r=jn(n);if(jn(i)>r&&!t)return[[n[0],i[1],n[2],i[3]]];if(i[0]<n[0])return[[i[0]+r,i[1],n[2],i[3]],[n[0],i[1],i[2],i[3]]];if(i[2]>n[2])return[[i[0],i[1],n[2],i[3]],[n[0],i[1],i[2]-r,i[3]]]}return[i]}function tG(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(...$4(t[o],e[n]));t=s}return t}var nG={info:1,warn:2,error:3,none:4},toe=nG.info;function hw(...i){toe>nG.warn||console.warn(...i)}function xi(i,e,t){return Math.min(Math.max(i,e),t)}function iG(i,e,t,n,r,s){let o=r-t,a=s-n;if(o!==0||a!==0){let l=((i-t)*o+(e-n)*a)/(o*o+a*a);l>1?(t=r,n=s):l>0&&(t+=o*l,n+=a*l)}return Sc(i,e,t,n)}function Sc(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function rG(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 fw(i){return i*180/Math.PI}function Tc(i){return i*Math.PI/180}function xu(i,e){let t=i%e;return t*e<0?t+e:t}function No(i,e,t){return i+t*(e-i)}function k0(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function gx(i,e){return Math.floor(k0(i,e))}function _x(i,e){return Math.ceil(k0(i,e))}function dw(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function sG(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function G0(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 ug(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 oG(i,e){return i[0]*=e,i[1]*=e,i}function pw(i,e){if(e.canWrapX()){let t=jn(e.getExtent()),n=aG(i,e,t);n&&(i[0]-=n*t)}return i}function aG(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||jn(n),r=Math.floor((i[0]-n[0])/t)),r}function lG(i,e,t){let n=Math.sqrt((e[0]-i[0])*(e[0]-i[0])+(e[1]-i[1])*(e[1]-i[1])),r=[(e[0]-i[0])/n,(e[1]-i[1])/n],s=[-r[1],r[0]],o=Math.sqrt((t[0]-i[0])*(t[0]-i[0])+(t[1]-i[1])*(t[1]-i[1])),a=[(t[0]-i[0])/o,(t[1]-i[1])/o],l=n===0||o===0?0:Math.acos(xi(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:Math.PI*2-l}var Zh={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var Z4=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_||Zh[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_}},md=Z4;var xx=6378137,hg=Math.PI*xx,noe=[-hg,-hg,hg,hg],ioe=[-180,-85,180,85],Aw=xx*Math.log(Math.tan(Math.PI/2)),gd=class extends md{constructor(e){super({code:e,units:"m",extent:noe,global:!0,worldExtent:ioe,getPointResolution:function(t,n){return t/Math.cosh(n[1]/xx)}})}},K4=[new gd("EPSG:3857"),new gd("EPSG:102100"),new gd("EPSG:102113"),new gd("EPSG:900913"),new gd("http://www.opengis.net/def/crs/EPSG/0/3857"),new gd("http://www.opengis.net/gml/srs/epsg.xml#3857")];function cG(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]=hg*i[s]/180;let o=xx*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>Aw?o=Aw:o<-Aw&&(o=-Aw),e[s+1]=o}return e}function uG(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]/hg,e[s+1]=360*Math.atan(Math.exp(i[s+1]/xx))/Math.PI-90;return e}var roe=6378137,hG=[-180,-90,180,90],soe=Math.PI*roe/180,Kh=class extends md{constructor(e,t){super({code:e,units:"degrees",extent:hG,axisOrientation:t,global:!0,metersPerUnit:soe,worldExtent:hG})}},Q4=[new Kh("CRS:84"),new Kh("EPSG:4326","neu"),new Kh("urn:ogc:def:crs:OGC:1.3:CRS84"),new Kh("urn:ogc:def:crs:OGC:2:84"),new Kh("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Kh("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Kh("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var J4={};function fG(i){return J4[i]||J4[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function dG(i,e){J4[i]=e}function yu(i){for(let e in i)delete i[e]}function Ec(i){let e;for(e in i)return!1;return!e}var fg={};function dg(i,e,t){let n=i.getCode(),r=e.getCode();n in fg||(fg[n]={}),fg[n][r]=t}function mw(i,e){return i in fg&&e in fg[i]?fg[i][e]:null}var gw=.9996,jl=.00669438,xw=jl*jl,yw=xw*jl,z0=jl/(1-jl),pG=Math.sqrt(1-jl),pg=(1-pG)/(1+pG),_G=pg*pg,eP=_G*pg,tP=eP*pg,xG=tP*pg,yG=1-jl/4-3*xw/64-5*yw/256,ooe=3*jl/8+3*xw/32+45*yw/1024,aoe=15*xw/256+45*yw/1024,loe=35*yw/3072,coe=3/2*pg-27/32*eP+269/512*xG,uoe=21/16*_G-55/32*tP,hoe=151/96*eP-417/128*xG,foe=1097/512*tP,_w=6378137;function doe(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/gw/(_w*yG),a=o+coe*Math.sin(2*o)+uoe*Math.sin(4*o)+hoe*Math.sin(6*o)+foe*Math.sin(8*o),l=Math.sin(a),c=l*l,u=Math.cos(a),f=l/u,p=f*f,x=p*p,v=1-jl*c,w=Math.sqrt(1-jl*c),S=_w/w,T=(1-jl)/v,P=z0*u**2,R=P*P,C=n/(S*gw),L=C*C,D=L*C,F=D*C,N=F*C,B=N*C,z=a-f/T*(L/2-F/24*(5+3*p+10*P-4*R-9*z0))+B/720*(61+90*p+298*P+45*x-252*z0-3*R),V=(C-D/6*(1+2*p+P)+N/120*(5-2*P+28*p-3*R+8*z0+24*x))/u;return V=dw(V+Tc(vG(t.number)),-Math.PI,Math.PI),[fw(V),fw(z)]}var AG=-80,mG=84,poe=-180,Aoe=180;function moe(i,e,t){i=dw(i,poe,Aoe),e<AG?e=AG:e>mG&&(e=mG);let n=Tc(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=Tc(i),u=vG(t.number),f=Tc(u),p=_w/Math.sqrt(1-jl*r**2),x=z0*s**2,v=s*dw(c-f,-Math.PI,Math.PI),w=v*v,S=w*v,T=S*v,P=T*v,R=P*v,C=_w*(yG*n-ooe*Math.sin(2*n)+aoe*Math.sin(4*n)-loe*Math.sin(6*n)),L=gw*p*(v+S/6*(1-a+x)+P/120*(5-18*a+l+72*x-58*z0))+5e5,D=gw*(C+p*o*(w/2+T/24*(5-a+9*x+4*x**2)+R/720*(61-58*a+l+600*x-330*z0)));return t.north||(D+=1e7),[L,D]}function vG(i){return(i-1)*6-180+3}var goe=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function bG(i){let e=0;for(let r of goe){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 gG(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 wG(i){return bG(i)?new md({code:i,units:"m"}):null}function SG(i){let e=bG(i.getCode());return e?{forward:gG(moe,e),inverse:gG(doe,e)}:null}var _oe=63710088e-1;function nP(i,e,t){t=t||_oe;let n=Tc(i[1]),r=Tc(e[1]),s=(r-n)/2,o=Tc(e[0]-i[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*t*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}var xoe=[SG],yoe=[wG];var rP=!0;function EG(i){rP=!(i===void 0?!0:i)}function oP(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 sP(i){dG(i.getCode(),i),dg(i,i,oP)}function voe(i){i.forEach(sP)}function _s(i){if(typeof i!="string")return i;let e=fG(i);if(e)return e;for(let t of yoe){let n=t(i);if(n)return n}return null}function aP(i,e,t,n){i=_s(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/Zh[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=V0(i,_s("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=nP(c.slice(0,2),c.slice(2,4)),f=nP(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?Zh[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function TG(i){voe(i),i.forEach(function(e){i.forEach(function(t){e!==t&&dg(e,t,oP)})})}function boe(i,e,t,n){i.forEach(function(r){e.forEach(function(s){dg(r,s,t),dg(s,r,n)})})}function vw(i,e){return i?typeof i=="string"?_s(i):i:_s(e)}function MG(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 Ag(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||V0(i,e)===oP)&&t}function V0(i,e){let t=i.getCode(),n=e.getCode(),r=mw(t,n);if(r)return r;let s=null,o=null;for(let l of xoe)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=iP(s.inverse,o.forward);else{let l=mw(t,a);l&&(r=iP(l,o.forward))}else{let l=mw(a,n);l&&(r=iP(s.inverse,l))}return r&&(sP(i),sP(e),dg(i,e,r)),r}function iP(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function q0(i,e){let t=_s(i),n=_s(e);return V0(t,n)}function mg(i,e,t){let n=q0(e,t);if(!n){let r=_s(e).getCode(),s=_s(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function CG(i,e,t,n){let r=q0(e,t);return eG(i,r,void 0,n)}var Mc=null;function H0(){return Mc}function yx(i,e){return Mc?mg(i,e,Mc):i}function Cc(i,e){return Mc?mg(i,Mc,e):(rP&&!G0(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(rP=!1,hw("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function _d(i,e){return Mc?CG(i,e,Mc):i}function Rc(i,e){return Mc?CG(i,Mc,e):i}function RG(i,e){if(!Mc)return i;let t=_s(e).getMetersPerUnit(),n=Mc.getMetersPerUnit();return t&&n?i*t/n:i}function woe(){TG(K4),TG(Q4),boe(Q4,K4,cG,uG)}woe();function lP(i){return i[0]>0&&i[1]>0}function PG(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 Wr(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var bw=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 W0(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new bw(i,e,t,n)}var ww=bw;function IG(i,e,t){let n,r;t=t||ka;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 ka(i,e){return i>e?1:i<e?-1:0}function NG(i,e){return i<e?1:i>e?-1:0}function gg(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 LG(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Pc(i,e){let t=Array.isArray(e)?e:[e],n=t.length;for(let r=0;r<n;r++)i[i.length]=t[r]}function Lo(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 DG(i,e,t){let n=e||ka;return i.every(function(r,s){if(s===0)return!0;let o=n(i[s-1],r);return!(o>0||t&&o===0)})}function Vn(i,e){if(!i)throw new Error(e)}function FG(i,e,t,n,r){return!cw(r,function(o){return!xd(i,e,t,n,o[0],o[1])})}function xd(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 vx(i,e,t,n,r,s){if(t.length===0||!xd(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(xd(i,t[o-1],t[o],n,r,s))return!1;return!0}function OG(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(vx(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function BG(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 Sw(i,e,t,n,r,s){return s=s??j4(Cr(),i,e,t,n),xr(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:BG(i,e,t,n,function(o,a){return J9(r,o,a)}):!1}function cP(i,e,t,n,r){return!!(Sw(i,e,t,n,r)||xd(i,e,t,n,r[0],r[1])||xd(i,e,t,n,r[0],r[3])||xd(i,e,t,n,r[2],r[1])||xd(i,e,t,n,r[2],r[3]))}function uP(i,e,t,n,r){if(!cP(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(FG(i,t[s-1],t[s],n,r)&&!Sw(i,t[s-1],t[s],n,r))return!1;return!0}function UG(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(uP(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function Yn(){throw new Error("Unimplemented abstract method.")}var Soe=0;function Ln(i){return i.ol_uid||(i.ol_uid=String(++Soe))}function _g(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function Toe(i,e,t){return i+"/"+e+"/"+t}function xg(i,e,t,n,r){return`${Ln(i)},${e},${Toe(t,n,r)}`}function kG(i){return Eoe(i[0],i[1],i[2])}function Eoe(i,e,t){return(e<<i)+t}function GG(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 yg=[0,0,0],yd=5,hP=class{constructor(e){let t=e.minZoom,n=e.resolutions;t===void 0&&n&&(t=n.findIndex(o=>o!==void 0)),this.minZoom=t!==void 0?t:0,this.resolutions_=n,Vn(DG(this.resolutions_,(o,a)=>a-o,!0),"`resolutions` must be sorted in descending order");let r;if(!e.origins){for(let o=0,a=this.resolutions_.length-1;o<a;++o)if(!r)r=this.resolutions_[o]/this.resolutions_[o+1];else if(this.resolutions_[o]/this.resolutions_[o+1]!==r){r=void 0;break}}this.zoomFactor_=r,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,Vn(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let s=e.extent;s!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Wl(s)),Vn(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,Vn(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:256,Vn(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=s!==void 0?s:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.tileRanges!==void 0?this.fullTileRanges_=e.tileRanges:e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((o,a)=>{let l=new ww(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=W0(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 W0(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 W0(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 W0(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,p=Math.floor(l*(o+1))-1;return W0(c,f,u,p,n)}let a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,yg);let r=yg[1],s=yg[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,yg);let o=yg[1],a=yg[2];return W0(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=Wr(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=Wr(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 cl(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=Wr(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=_x(u,yd)-1,f=_x(f,yd)-1):(u=gx(u,yd),f=gx(f,yd)),_g(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=Wr(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=_x(c,yd)-1,u=_x(u,yd)-1):(c=gx(c,yd),u=gx(u,yd)),_g(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=gg(this.resolutions_,e,t||0);return xi(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return cP(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}},bx=hP;function Tw(i){let e=i.getDefaultTileGrid();return e||(e=Coe(i),i.setDefaultTileGrid(e)),e}function VG(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=Ew(t);if(!wc(s,r)){let o=jn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function Moe(i,e,t,n){n=n!==void 0?n:"top-left";let r=HG(i,e,t);return new bx({extent:i,origin:K9(i,n),resolutions:r,tileSize:t})}function qG(i){let e=i||{},t=e.extent||_s("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:HG(t,e.maxZoom,e.tileSize,e.maxResolution)};return new bx(n)}function HG(i,e,t,n){e=e!==void 0?e:42,t=Wr(t!==void 0?t:256);let r=_r(i),s=jn(i);n=n>0?n:Math.max(s/t[0],r/t[1]);let o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=n/Math.pow(2,l);return a}function Coe(i,e,t,n){let r=Ew(i);return Moe(r,e,t,n)}function Ew(i){i=_s(i);let e=i.getExtent();if(!e){let t=180*Zh.degrees/i.getMetersPerUnit();e=cl(-t,-t,t,t)}return e}var Mn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function kn(i,e,t,n,r){if(r){let o=t;t=function(a){return i.removeEventListener(e,t),o.call(n??this,a)}}else n&&n!==i&&(t=t.bind(n));let s={target:i,type:e,listener:t};return i.addEventListener(e,t),s}function vg(i,e,t,n){return kn(i,e,t,n,!0)}function ii(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),yu(i))}var Jt={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};var fP=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},vd=fP;function Qh(){return!0}function Jh(){return!1}function ef(){}function Mw(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!Lo(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function WG(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 dP=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Ys=dP;var pP=class extends vd{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 Ys(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,ef);delete o[n]}return l}disposeInternal(){this.listeners_&&yu(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]=ef,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},bd=pP;var j0=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",Roe=j0.includes("safari")&&!j0.includes("chrom"),KIe=Roe&&(j0.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(j0)),jG=j0.includes("webkit")&&!j0.includes("edge"),AP=j0.includes("macintosh"),XG=typeof devicePixelRatio<"u"?devicePixelRatio:1,Fs=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,mP=typeof Image<"u"&&Image.prototype.decode;var Cw=(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 $G(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[vg(n,Jt.LOAD,function(){o=!0,s||e()})];return n.src&&mP?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(vg(n,Jt.ERROR,t)),function(){r=!1,a.forEach(ii)}}function Poe(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 YG(i,e){return e&&(i.src=e),i.src&&mP?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):Poe(i)}var rn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function gP(i){return Math.pow(i,3)}function Xl(i){return 1-gP(1-i)}function ZG(i){return 3*i*i-2*i*i*i}function KG(i){return i}var _P=class extends bd{constructor(e,t,n){super(),n=n||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(Jt.CHANGE)}release(){this.setState(rn.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==rn.EMPTY){if(this.state!==rn.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){Yn()}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:gP(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()}},bg=_P;function Ti(i,e,t,n){let r;return t&&t.length?r=t.shift():Fs?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 xP;function wx(){return xP||(xP=Ti(1,1)),xP}function X0(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function yP(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function QG(i){for(;i.lastChild;)i.lastChild.remove()}function JG(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 Rw(){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 ul(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}var vP=class extends bg{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_,Fs?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(e){this.image_=e,this.state=rn.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=rn.ERROR,this.unlistenImage_(),this.image_=Ioe(),this.changed()}handleImageLoad_(){if(Fs)this.state=rn.LOADED;else{let e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=rn.LOADED:this.state=rn.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==rn.ERROR&&(this.state=rn.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==rn.IDLE&&(this.state=rn.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=$G(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 Ioe(){let i=Ti(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var Pw=vP;var bP,$0=[];function ez(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 wP(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function Noe(){if(bP===void 0){let i=Ti(6,6,$0);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",ez(i,4,5,4,0),ez(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;bP=wP(e,0)||wP(e,4)||wP(e,8),X0(i),$0.push(i.canvas)}return bP}function tz(i,e,t,n){let r=mg(t,e,i),s=aP(e,n,t),o=e.getMetersPerUnit();o!==void 0&&(s*=o);let a=i.getMetersPerUnit();a!==void 0&&(s/=a);let l=i.getExtent();if(!l||wc(l,r)){let c=aP(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function nz(i,e,t,n){let r=Ua(t),s=tz(i,e,r,n);return(!isFinite(s)||s<=0)&&cw(t,function(o){return s=tz(i,e,o,n),isFinite(s)&&s>0}),s}function iz(i,e,t,n,r,s,o,a,l,c,u,f,p,x){let v=Ti(Math.round(t*i),Math.round(t*e),$0);if(f||(v.imageSmoothingEnabled=!1),l.length===0)return v.canvas;v.scale(t,t);function w(L){return Math.round(L*t)/t}v.globalCompositeOperation="lighter";let S=Cr();l.forEach(function(L,D,F){lw(S,L.extent)});let T,P=t/n,R=(f?1:1+Math.pow(2,-24))/P;if(!p||l.length!==1||c!==0){if(T=Ti(Math.round(jn(S)*P),Math.round(_r(S)*P),$0),f||(T.imageSmoothingEnabled=!1),r&&x){let L=(r[0]-S[0])*P,D=-(r[3]-S[3])*P,F=jn(r)*P,N=_r(r)*P;T.rect(L,D,F,N),T.clip()}l.forEach(function(L,D,F){if(L.image.width>0&&L.image.height>0){if(L.clipExtent){T.save();let H=(L.clipExtent[0]-S[0])*P,Z=-(L.clipExtent[3]-S[3])*P,J=jn(L.clipExtent)*P,j=_r(L.clipExtent)*P;T.rect(f?H:Math.round(H),f?Z:Math.round(Z),f?J:Math.round(H+J)-Math.round(H),f?j:Math.round(Z+j)-Math.round(Z)),T.clip()}let N=(L.extent[0]-S[0])*P,B=-(L.extent[3]-S[3])*P,z=jn(L.extent)*P,V=_r(L.extent)*P;T.drawImage(L.image,c,c,L.image.width-2*c,L.image.height-2*c,f?N:Math.round(N),f?B:Math.round(B),f?z:Math.round(N+z)-Math.round(N),f?V:Math.round(B+V)-Math.round(B)),L.clipExtent&&T.restore()}})}let C=Wl(o);return a.getTriangles().forEach(function(L,D,F){let N=L.source,B=L.target,z=N[0][0],V=N[0][1],H=N[1][0],Z=N[1][1],J=N[2][0],j=N[2][1],K=w((B[0][0]-C[0])/s),ee=w(-(B[0][1]-C[1])/s),ae=w((B[1][0]-C[0])/s),ce=w(-(B[1][1]-C[1])/s),de=w((B[2][0]-C[0])/s),ve=w(-(B[2][1]-C[1])/s),Ie=z,Qe=V;z=0,V=0,H-=Ie,Z-=Qe,J-=Ie,j-=Qe;let Ue=[[H,Z,0,0,ae-K],[J,j,0,0,de-K],[0,0,H,Z,ce-ee],[0,0,J,j,ve-ee]],mt=rG(Ue);if(!mt)return;if(v.save(),v.beginPath(),Noe()||!f){v.moveTo(ae,ce);let ze=4,$e=K-ae,Et=ee-ce;for(let Tt=0;Tt<ze;Tt++)v.lineTo(ae+w((Tt+1)*$e/ze),ce+w(Tt*Et/(ze-1))),Tt!=ze-1&&v.lineTo(ae+w((Tt+1)*$e/ze),ce+w((Tt+1)*Et/(ze-1)));v.lineTo(de,ve)}else v.moveTo(ae,ce),v.lineTo(K,ee),v.lineTo(de,ve);v.clip(),v.transform(mt[0],mt[2],mt[1],mt[3],K,ee),v.translate(S[0]-Ie,S[3]-Qe);let Me;if(T)Me=T.canvas,v.scale(R,-R);else{let ze=l[0],$e=ze.extent;Me=ze.image,v.scale(jn($e)/Me.width,-_r($e)/Me.height)}v.drawImage(Me,0,0),v.restore()}),T&&(X0(T),$0.push(T.canvas)),u&&(v.save(),v.globalCompositeOperation="source-over",v.strokeStyle="black",v.lineWidth=1,a.getTriangles().forEach(function(L,D,F){let N=L.target,B=(N[0][0]-C[0])/s,z=-(N[0][1]-C[1])/s,V=(N[1][0]-C[0])/s,H=-(N[1][1]-C[1])/s,Z=(N[2][0]-C[0])/s,J=-(N[2][1]-C[1])/s;v.beginPath(),v.moveTo(V,H),v.lineTo(B,z),v.lineTo(Z,J),v.closePath(),v.stroke()}),v.restore()),v.canvas}var Loe=[1,0,0,1,0,0],M5e=new Array(6);function Zs(){return Loe.slice(0)}function rz(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 Rr(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 uo(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 Nw(i,e){let t=Doe(e);Vn(t!==0,"Transformation matrix cannot be inverted");let n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return i[0]=o/t,i[1]=-r/t,i[2]=-s/t,i[3]=n/t,i[4]=(s*l-o*a)/t,i[5]=-(n*l-r*a)/t,i}function Doe(i){return i[0]*i[3]-i[1]*i[2]}var Foe=[1e5,1e5,1e5,1e5,2,2];function sz(i){return"matrix("+i.join(", ")+")"}function Iw(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function oz(i,e){let t=Iw(i),n=Iw(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*Foe[r])!==0)return!1;return!0}var Ooe=10,az=.25,SP=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?MG(R=>Rr(a,mg(R,this.targetProj_,this.sourceProj_))):q0(this.targetProj_,this.sourceProj_);this.transformInv_=function(R){let C=R[0]+"/"+R[1];return l[C]||(l[C]=c(R)),l[C]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&jn(r)>=jn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?jn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?jn(this.targetProj_.getExtent()):null;let u=Wl(n),f=cg(n),p=lg(n),x=ag(n),v=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(p),T=this.transformInv_(x),P=Ooe+(o?Math.max(0,Math.ceil(Math.log2(Ax(n)/(o*o*256*256)))):0);if(this.addQuad_(u,f,p,x,v,w,S,T,P),this.wrapsXInSource_){let R=1/0;this.triangles_.forEach(function(C,L,D){R=Math.min(R,C.source[0][0],C.source[1][0],C.source[2][0])}),this.triangles_.forEach(C=>{if(Math.max(C.source[0][0],C.source[1][0],C.source[2][0])-R>this.sourceWorldWidth_/2){let L=[[C.source[0][0],C.source[0][1]],[C.source[1][0],C.source[1][1]],[C.source[2][0],C.source[2][1]]];L[0][0]-R>this.sourceWorldWidth_/2&&(L[0][0]-=this.sourceWorldWidth_),L[1][0]-R>this.sourceWorldWidth_/2&&(L[1][0]-=this.sourceWorldWidth_),L[2][0]-R>this.sourceWorldWidth_/2&&(L[2][0]-=this.sourceWorldWidth_);let D=Math.min(L[0][0],L[1][0],L[2][0]);Math.max(L[0][0],L[1][0],L[2][0])-D<this.sourceWorldWidth_/2&&(C.source=L)}})}l={}}addTriangle_(e,t,n,r,s,o){this.triangles_.push({source:[r,s,o],target:[e,t,n]})}addQuad_(e,t,n,r,s,o,a,l,c){let u=W4([s,o,a,l]),f=this.sourceWorldWidth_?jn(u)/this.sourceWorldWidth_:null,p=this.sourceWorldWidth_,x=this.sourceProj_.canWrapX()&&f>.5&&f<1,v=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let S=W4([e,t,n,r]);v=jn(S)/this.targetWorldWidth_>az||v}!x&&this.sourceProj_.isGlobal()&&f&&(v=f>az||v)}if(!v&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!xr(u,this.maxSourceExtent_))return;let w=0;if(!v&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(c>0)v=!0;else if(w=(!isFinite(s[0])||!isFinite(s[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),w!=1&&w!=2&&w!=4&&w!=8)return}if(c>0){if(!v){let S=[(e[0]+n[0])/2,(e[1]+n[1])/2],T=this.transformInv_(S),P;x?P=(xu(s[0],p)+xu(a[0],p))/2-xu(T[0],p):P=(s[0]+a[0])/2-T[0];let R=(s[1]+a[1])/2-T[1];v=P*P+R*R>this.errorThresholdSquared_}if(v){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){let S=[(t[0]+n[0])/2,(t[1]+n[1])/2],T=this.transformInv_(S),P=[(r[0]+e[0])/2,(r[1]+e[1])/2],R=this.transformInv_(P);this.addQuad_(e,t,S,P,s,o,T,R,c-1),this.addQuad_(P,S,n,r,R,T,a,l,c-1)}else{let S=[(e[0]+t[0])/2,(e[1]+t[1])/2],T=this.transformInv_(S),P=[(n[0]+r[0])/2,(n[1]+r[1])/2],R=this.transformInv_(P);this.addQuad_(e,S,P,r,s,T,R,l,c-1),this.addQuad_(S,t,n,P,T,o,a,R,c-1)}return}}if(x){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(w&11)==0&&this.addTriangle_(e,n,r,s,a,l),(w&14)==0&&this.addTriangle_(e,n,t,s,a,o),w&&((w&13)==0&&this.addTriangle_(t,r,e,o,l,s),(w&7)==0&&this.addTriangle_(t,r,n,o,l,a))}calculateSourceExtent(){let e=Cr();return this.triangles_.forEach(function(t,n,r){let s=t.source;U0(e,s[0]),U0(e,s[1]),U0(e,s[2])}),e}getTriangles(){return this.triangles_}},lz=SP;var TP=class extends bg{constructor(e,t,n,r,s,o,a,l,c,u,f,p){super(s,rn.IDLE,p),this.renderEdges_=f!==void 0?f:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;let x=r.getTileCoordExtent(this.wrappedTileCoord_),v=this.targetTileGrid_.getExtent(),w=this.sourceTileGrid_.getExtent(),S=v?gu(x,v):x;if(Ax(S)===0){this.state=rn.EMPTY;return}let T=e.getExtent();T&&(w?w=gu(w,T):w=T);let P=r.getResolution(this.wrappedTileCoord_[0]),R=nz(e,n,S,P);if(!isFinite(R)||R<=0){this.state=rn.EMPTY;return}let C=u!==void 0?u:.5;if(this.triangulation_=new lz(e,n,S,w,R*C,P),this.triangulation_.getTriangles().length===0){this.state=rn.EMPTY;return}this.sourceZ_=t.getZForResolution(R);let L=this.triangulation_.calculateSourceExtent();if(w&&(e.canWrapX()?(L[1]=xi(L[1],w[1],w[3]),L[3]=xi(L[3],w[1],w[3])):L=gu(L,w)),!Ax(L))this.state=rn.EMPTY;else{let D=0,F=0;e.canWrapX()&&(D=jn(T),F=Math.floor((L[0]-T[0])/D)),uw(L.slice(),e,!0).forEach(B=>{let z=t.getTileRangeForExtentAndZ(B,this.sourceZ_);for(let V=z.minX;V<=z.maxX;V++)for(let H=z.minY;H<=z.maxY;H++){let Z=F*D;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,V,H,a),offset:Z})}++F}),this.sourceTiles_.length===0&&(this.state=rn.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==rn.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;let s=this.clipExtent_?.slice();s&&(s[0]+=t.offset,s[2]+=t.offset),e.push({extent:r,clipExtent:s,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=rn.ERROR;else{let t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n=="number"?n:n[0],s=typeof n=="number"?n:n[1],o=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=iz(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=rn.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==rn.IDLE){this.state=rn.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{let n=t.getState();if(n==rn.IDLE||n==rn.LOADING){e++;let r=kn(t,Jt.CHANGE,s=>{let o=t.getState();(o==rn.LOADED||o==rn.ERROR||o==rn.EMPTY)&&(ii(r),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},n,r){t.getState()==rn.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(ii),this.sourcesListenerKeys_=null}release(){this.canvas_&&(X0(this.canvas_.getContext("2d")),$0.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},Lw=TP;var Boe=/\{z\}/g,Uoe=/\{x\}/g,koe=/\{y\}/g,Goe=/\{-y\}/g;function cz(i,e,t,n,r){return i.replace(Boe,e.toString()).replace(Uoe,t.toString()).replace(koe,n.toString()).replace(Goe,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 uz(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 zoe(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 cz(i,o,t[1],t[2],s)})}function hz(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=zoe(i[r],e);return Voe(n)}function Voe(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=kG(e),s=xu(r,i.length);return i[s](e,t,n)})}var Ic={PROPERTYCHANGE:"propertychange"};var wg=class extends bd{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Jt.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=kn(this,e[s],t);return r}return kn(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){let r=e.length;n=new Array(r);for(let s=0;s<r;++s)n[s]=vg(this,e[s],t)}else n=vg(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)qoe(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)}};wg.prototype.on;wg.prototype.once;wg.prototype.un;function qoe(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)ii(i[e]);else ii(i)}var Dw=wg;var Fw=class extends Ys{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},EP=class extends Dw{constructor(e){super(),this.on,this.once,this.un,Ln(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new Fw(n,e,t)),n=Ic.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new Fw(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){let r=this.values_||(this.values_={});if(n)r[e]=t;else{let s=r[e];r[e]=t,s!==t&&this.notify(e,s)}}setProperties(e,t){for(let n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||(this.values_={}),e.values_)}unset(e,t){if(this.values_&&e in this.values_){let n=this.values_[e];delete this.values_[e],Ec(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},xs=EP;var MP=class extends xs{constructor(e){super(),this.projection=_s(e.projection),this.attributions_=fz(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_=fz(e),this.changed()}setState(e){this.state_=e,this.changed()}};function fz(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var Ow=MP;var CP=class extends Ow{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&&Wr(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Ln(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){let t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,s,o){return Yn()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:Tw(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=Wr(r.getTileSize(e),this.tmpSize);return s==1?o:PG(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=VG(r,e,n)),GG(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},Bw=class extends Ys{constructor(e,t){super(e),this.tile=t}},dz=CP;var Uw={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var RP=class i extends dz{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===i.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){let t=e.target,n=Ln(t),r=t.getState(),s;r==rn.LOADING?(this.tileLoadingKeys_[n]=!0,s=Uw.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==rn.ERROR?Uw.TILELOADERROR:r==rn.LOADED?Uw.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new Bw(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=uz(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`2-`);this.generateTileUrlFunction_?this.setTileUrlFunction(hz(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},pz=RP;var PP=class extends pz{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Hoe,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:Pw,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!Ag(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||Ag(t,e)))return this.tileGrid;let n=Ln(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=Tw(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,s,o){let a=[e,t,n],l=this.getTileCoordForTileUrlFunction(a,s),c=l?this.tileUrlFunction(l,r,s):void 0,u=new this.tileClass(a,c!==void 0?rn.IDLE:rn.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(Jt.CHANGE,this.handleTileChange.bind(this)),u}getTile(e,t,n,r,s,o){let a=this.getProjection();if(!a||!s||Ag(a,s))return this.getTileInternal(e,t,n,r,a||s);let l=[e,t,n],c=this.getKey(),u=this.getTileGridForProjection(a),f=this.getTileGridForProjection(s),p=this.getTileCoordForTileUrlFunction(l,s),x=new Lw(a,u,s,f,l,p,this.getTilePixelRatio(r),this.getGutter(),(v,w,S,T)=>this.getTileInternal(v,w,S,T,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return x.key=c,x}getTileInternal(e,t,n,r,s,o){let a=this.getKey(),l=xg(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=_s(e);if(n){let r=Ln(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}};function Hoe(i,e){if(Fs){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 Az=PP;var IP=class extends Az{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:qG({extent:Ew(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_}},mz=IP;function Nc(){if(!U.map||!U.variant||U.settling)return;let i=U.engine?.getView();try{let e=gz();e.last=U.game.slug,e.games[U.game.slug]={game:U.game.slug,map:U.map.slug,variant:U.map.variants.indexOf(U.variant),center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},localStorage.setItem(H4,JSON.stringify(e))}catch{}}function gz(){try{let i=JSON.parse(localStorage.getItem(H4)||"null");if(i&&i.games)return i}catch{}return{last:"",games:{}}}function Sg(i){let e=gz(),t=i||e.last,n=t&&e.games[t];return n&&n.game&&n.map?n:null}function Tg(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{game:i,map:e}}function _z(){if(!U.game||!U.map)return;let i=`#${U.game.slug}/${U.map.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var NP=class i extends xs{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}clone(){let e=new i,t=this.geometryName_;e.setGeometryName(t);let n=this.getPropertiesInternal();if(n){let s=this.getGeometry();for(let o in n)o===t&&s?e.set(o,s.clone()):e.set(o,n[o],!0)}let r=this.getStyle();return r&&e.setStyle(r),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(ii(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=kn(e,Jt.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?Woe(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 Woe(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(Vn(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}var wd=NP;function Ga(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 kw(i,e,t,n,r,s,o){o=o||[];let a=Math.cos(r),l=Math.sin(r),c=s[0],u=s[1],f=0;for(let p=e;p<t;p+=n){let x=i[p]-c,v=i[p+1]-u;o[f++]=c+x*a-v*l,o[f++]=u+x*l+v*a;for(let w=p+2;w<p+n;++w)o[f++]=i[w]}return o&&o.length!=f&&(o.length=f),o}function xz(i,e,t,n,r,s,o,a){a=a||[];let l=o[0],c=o[1],u=0;for(let f=e;f<t;f+=n){let p=i[f]-l,x=i[f+1]-c;a[u++]=l+r*p,a[u++]=c+s*x;for(let v=f+2;v<f+n;++v)a[u++]=i[v]}return a&&a.length!=u&&(a.length=u),a}function yz(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 vz=Zs(),joe=[NaN,NaN],LP=class extends xs{constructor(){super(),this.extent_=Cr(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Mw((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 Yn()}closestPointXY(e,t,n,r){return Yn()}containsXY(e,t){return this.closestPointXY(e,t,joe,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 Yn()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&O0(t),this.extentRevision_=this.getRevision()}return Q9(this.extent_,e)}rotate(e,t){Yn()}scale(e,t,n){Yn()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return Yn()}getType(){return Yn()}applyTransform(e){Yn()}intersectsExtent(e){return Yn()}translate(e,t){Yn()}transform(e,t){let n=_s(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){let l=n.getExtent(),c=n.getWorldExtent(),u=_r(c)/_r(l);uo(vz,c[0],c[3],u,-u,0,0,0);let f=Ga(s,0,s.length,a,vz,o),p=q0(n,t);return p?p(f,f,a):f}:q0(n,t);return this.applyTransform(r),this}},bz=LP;var DP=class extends bz{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return og(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return Yn()}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=wz(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){Yn()}setLayout(e,t,n){let r;if(e)r=wz(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=Xoe(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();kw(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=Ua(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();xz(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();yz(n,0,n.length,r,e,t,n),this.changed()}}};function Xoe(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function wz(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function Sz(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return Ga(n,0,n.length,r,e,t)}var vu=DP;function Tz(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function Sx(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 FP(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=Sx(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function Ez(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=FP(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 OP=class i extends vu{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){let s=this.flatCoordinates,o=Sc(e,t,s[0],s[1]);if(o<r){let a=this.stride;for(let l=0;l<a;++l)n[l]=s[l];return n.length=a,o}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return aw(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return px(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Tz(this.flatCoordinates,0,e,this.stride),this.changed()}},tf=OP;function BP(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 UP(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=BP(i,e,a,n),e=a}return r}function Mz(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=UP(i,e,a,n),e=a[a.length-1]}return r}function Cz(i,e,t,n,r,s,o){let a=i[e],l=i[e+1],c=i[t]-a,u=i[t+1]-l,f;if(c===0&&u===0)f=e;else{let p=((r-a)*c+(s-l)*u)/(c*c+u*u);if(p>1)f=t;else if(p>0){for(let x=0;x<n;++x)o[x]=No(i[e+x],i[t+x],p);o.length=n;return}else f=e}for(let p=0;p<n;++p)o[p]=i[f+p];o.length=n}function kP(i,e,t,n,r){let s=i[e],o=i[e+1];for(e+=n;e<t;e+=n){let a=i[e],l=i[e+1],c=Sc(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function GP(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=kP(i,e,a,n,r),e=a}return r}function Rz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=GP(i,e,a,n,r),e=a[a.length-1]}return r}function zP(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,p;if(r===0){if(p=Sc(o,a,i[e],i[e+1]),p<c){for(f=0;f<n;++f)l[f]=i[e+f];return l.length=n,p}return c}u=u||[NaN,NaN];let x=e+n;for(;x<t;)if(Cz(i,x-n,x,n,o,a,u),p=Sc(o,a,u[0],u[1]),p<c){for(c=p,f=0;f<n;++f)l[f]=u[f];l.length=n,x+=n}else x+=n*Math.max((Math.sqrt(p)-Math.sqrt(c))/r|0,1);if(s&&(Cz(i,t-n,e,n,o,a,u),p=Sc(o,a,u[0],u[1]),p<c)){for(c=p,f=0;f<n;++f)l[f]=u[f];l.length=n}return c}function VP(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,p=t.length;f<p;++f){let x=t[f];c=zP(i,e,x,n,r,s,o,a,l,c,u),e=x}return c}function Pz(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,p=t.length;f<p;++f){let x=t[f];c=VP(i,e,x,n,r,s,o,a,l,c,u),e=x[x.length-1]}return c}function bu(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 Eg(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++]=bu(i,e,l,n,r[s]),e=l}return r.length=s,r}function Tx(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?[]:Eg(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}function Ex(i,e,t,n,r,s,o){let a=(t-e)/n;if(a<3){for(;e<t;e+=n)s[o++]=i[e],s[o++]=i[e+1];return o}let l=new Array(a);l[0]=1,l[a-1]=1;let c=[e,t-n],u=0;for(;c.length>0;){let f=c.pop(),p=c.pop(),x=0,v=i[p],w=i[p+1],S=i[f],T=i[f+1];for(let P=p+n;P<f;P+=n){let R=i[P],C=i[P+1],L=iG(R,C,v,w,S,T);L>x&&(u=P,x=L)}x>r&&(l[(u-e)/n]=1,p+n<u&&c.push(p,u),u+n<f&&c.push(u,f))}for(let f=0;f<a;++f)l[f]&&(s[o++]=i[e+f*n],s[o++]=i[e+f*n+1]);return o}function Iz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Ex(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Sd(i,e){return e*Math.round(i/e)}function $oe(i,e,t,n,r,s,o){if(e==t)return o;let a=Sd(i[e],r),l=Sd(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=Sd(i[e],r),u=Sd(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=Sd(i[e],r),p=Sd(i[e+1],r);if(e+=n,f==c&&p==u)continue;let x=c-a,v=u-l,w=f-a,S=p-l;if(x*S==v*w&&(x<0&&w<x||x==w||x>0&&w>x)&&(v<0&&S<v||v==S||v>0&&S>v)){c=f,u=p;continue}s[o++]=c,s[o++]=u,a=c,l=u,c=f,u=p}return s[o++]=c,s[o++]=u,o}function Mx(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=$oe(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Nz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=Mx(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var qP=class i extends vu{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<Ad(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(kP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),zP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return BP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return bu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=Ex(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return Sw(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Sx(this.flatCoordinates,0,e,this.stride),this.changed()}},HP=qP;function Cx(i,e,t,n,r,s,o){let a,l,c,u,f,p,x,v=r[s+1],w=[];for(let P=0,R=t.length;P<R;++P){let C=t[P];for(u=i[C-n],p=i[C-n+1],a=e;a<C;a+=n)f=i[a],x=i[a+1],(v<=p&&x<=v||p<=v&&v<=x)&&(c=(v-p)/(x-p)*(f-u)+u,w.push(c)),u=f,p=x}let S=NaN,T=-1/0;for(w.sort(ka),u=w[0],a=1,l=w.length;a<l;++a){f=w[a];let P=Math.abs(f-u);P>T&&(c=(u+f)/2,vx(i,e,t,n,c,v)&&(S=c,T=P)),u=f}return isNaN(S)&&(S=r[s]),o?(o.push(S,v,T),o):[S,v,T]}function Gw(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=Cx(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function Lz(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 WP(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 jP(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=WP(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 Dz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!jP(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function zw(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=WP(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&Lz(i,e,a,n),e=a}return e}function XP(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=zw(i,e,t[s],n,r);return e}function Fz(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=WP(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 Vw=class i extends vu{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?Pc(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<Ad(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(GP(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),VP(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return vx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return UP(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),zw(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Eg(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=Ua(this.getExtent());this.flatInteriorPoint_=Cx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new tf(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new HP(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 HP(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;jP(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=zw(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Mx(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return uP(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=FP(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},wu=Vw;function $P(i){if(_u(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 Vw(s,"XY",[s.length])}function Oz(){let i=U.variant?.surface;return i?[i.x,-(i.y+i.height),i.x+i.width,-i.y]:Eu()}function Bz(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),Uz(),U.gridEnabled?(we.gridInput.focus(),we.gridInput.select()):we.viewport.focus({preventScroll:!0}),!0):i.key===" "&&U.gridEnabled&&i.target!==we.subgridToggle?(i.preventDefault(),Rx(!U.subgridVisible),!0):i.key==="Escape"&&U.gridEnabled?(i.preventDefault(),ZP(),!0):!1}function Uz(i=!U.gridEnabled){U.gridEnabled=i,i&&Rx(!0),qw(),Su(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()}function Rx(i){U.subgridVisible=i,U.layers.grid.changed(),U.layers.gridContext.changed(),we.subgridToggle.setAttribute("aria-pressed",String(i)),we.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),kz(),document.dispatchEvent(new Event("atlas:grid"))}function kz(){if(!U.gridEnabled){we.gridHint.textContent="G \xB7 grid off";return}we.gridHint.textContent=`G-${U.gridPrefix||"root"}`+(U.subgridVisible?"":" no subgrid")}function Y0(i){let e=Td(),t=[...i.toLocaleLowerCase()].filter(r=>Hl.includes(r)).slice(0,e).join(""),n=t!==U.gridPrefix;U.gridPrefix=t,U.gridEnabled||(U.gridEnabled=!0),qw(),Su(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed(),n&&(Lc(),U.engine.getView().fit(Mg(),{size:U.engine.getSize(),padding:[52,52,52,52],maxZoom:Tu(U.variant),duration:180}))}function ZP(){if(U.gridEnabled){if(!U.gridPrefix){Uz(!1);return}Y0(U.gridPrefix.slice(0,-1))}}function qw(){if(U.sources){if(U.sources.grid.clear(),U.sources.gridContext.clear(),we.gridNavigator.hidden=!U.gridEnabled,kz(),U.gridEnabled&&U.variant){let i=Td();we.gridInput.maxLength=i,we.gridInput.value=U.gridPrefix,we.gridBack.title=U.gridPrefix?"Back one geohash level":"Close geohash grid";for(let e of Hw())Zoe(e.hash,e.extent,e.role,e.contextDistance)}document.dispatchEvent(new Event("atlas:grid"))}}function Hw(){let i=[];for(let e=0;e<U.gridPrefix.length;e++){let t=U.gridPrefix.slice(0,e),n=U.gridPrefix.slice(0,e+1);for(let r of Hl){let s=t+r;s!==n&&i.push({hash:s,extent:YP(s),role:"neighbor",contextDistance:U.gridPrefix.length-e})}}if(U.gridPrefix.length>=Td())return i.push({hash:U.gridPrefix,extent:Mg(),role:"leaf",contextDistance:0}),i;U.gridPrefix&&i.push({hash:U.gridPrefix,extent:Mg(),role:"scope",contextDistance:0});for(let e of Hl){let t=U.gridPrefix+e;i.push({hash:t,extent:YP(t),role:"child",contextDistance:0})}return i}function Zoe(i,e,t,n=0){let[r,s,o,a]=e,l=U.pins.filter(f=>{if(f.filteredHidden)return!1;let[p,x]=f.coordinate;return p>=r&&p<=o&&x>=s&&x<=a}).length,c=new wd({geometry:new wu([[[r,s],[r,a],[o,a],[o,s],[r,s]]]),gridCell:{hash:i,extent:e,role:t,count:l,contextDistance:n},priority:t==="neighbor"?-n*100+Hl.indexOf(i[i.length-1]):Hl.indexOf(i[i.length-1])});(t==="neighbor"?U.sources.gridContext:U.sources.grid).addFeature(c)}function Mg(){return YP(U.gridPrefix)}function YP(i){let e=[...Oz()],t=!0;for(let n of i){let r=Hl.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 Td(){return 3}function Ww(i,e=Td()){let t=[...Oz()],[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+=Hl[l]}return o}function Ed(i){if(!U.gridEnabled||!U.gridPrefix)return!1;let e=Mg(),[t,n]=i.coordinate;return t>=e[0]&&t<=e[2]&&n>=e[1]&&n<=e[3]}function Z0(){return Z9[U.map?.iconOutset==="dark"?"dark":"light"]}function Koe(i){let e=U.map?.iconOutset==="dark",t=Joe(i);return(e?t>.3:t<.88)?i:Qoe(i,e?.74:.42)}function Qoe(i,e){let t=String(i).replace("#","");if(t.length!==6)return i;let[n,r,s]=[0,2,4].map(R=>parseInt(t.slice(R,R+2),16)/255),o=Math.max(n,r,s),a=Math.min(n,r,s),l=(o+a)/2,c=0,u=o-a,f=u===0?0:u/(1-Math.abs(2*l-1));u!==0&&(o===n?c=(r-s)/u%6:o===r?c=(s-n)/u+2:c=(n-r)/u+4,c*=60,c<0&&(c+=360));let p=(1-Math.abs(2*e-1))*f,x=p*(1-Math.abs(c/60%2-1)),v=e-p/2,[w,S,T]=c<60?[p,x,0]:c<120?[x,p,0]:c<180?[0,p,x]:c<240?[0,x,p]:c<300?[x,0,p]:[p,0,x],P=R=>Math.round((R+v)*255).toString(16).padStart(2,"0");return`#${P(w)}${P(S)}${P(T)}`}function Joe(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 jw(i){let e=Math.abs(Number(i)||0);return rg[(Math.imul(e,2654435761)>>>0)%rg.length]}function nf(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 Cg(i,e){i.style.setProperty("--pin-color",K0(e))}function K0(i){return Koe(i.color||jw(i.id))}function Rg(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("${KP(e.iconAsset)}")`),i.classList.add("has-source-icon")}function KP(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${U.game.base}/icons/${e}`}function Dc(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function Gz(i){return Math.imul(Number(i)||0,2654435761)>>>0}function zz(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`3-4-`).trim()}function Fc(i){return new Intl.NumberFormat().format(i)}function Os(i,e,t){return Math.min(t,Math.max(e,i))}function Xw(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var eae=100;function Md(){if(!we.searchResults)return;let i=U.pins.filter(n=>!n.filteredHidden).sort((n,r)=>n.location.title.localeCompare(r.location.title)),e=i.slice(0,eae),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),Cg(r,n.category);let s=document.createElement("span");s.className="result-dot",Rg(s,n.category,Dc(n.category.title));let o=document.createElement("span"),a=document.createElement("strong");a.textContent=n.location.title;let l=document.createElement("small");l.textContent=`${n.category.title} \xB7 ${n.group.title}`,o.append(a,l),r.append(s,o),t.append(r)}if(i.length>e.length){let n=document.createElement("p");n.className="dock-note",n.textContent=`First ${e.length} of ${Fc(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}we.searchResults.replaceChildren(t),nae(i.length),tae()}var Vz=28;function tae(){let i=U.selectedPin?.location.title||"",e=i.length>Vz?`${i.slice(0,Vz-1).trimEnd()}\u2026`:i;we.dockRailName.textContent=e?` \xB7 ${e}`:"",we.dockRailName.hidden=!e}function nae(i){we.dockCount.textContent=`${Fc(i)} ${i===1?"location":"locations"}`,U.search?(we.dockFlag.textContent=`\u201C${U.search}\u201D`,we.dockFlag.hidden=!1):U.hiddenCategories.size>0?(we.dockFlag.textContent="filtered",we.dockFlag.hidden=!1):we.dockFlag.hidden=!0}function $w(){!U.dockFolded||U.dockDismissed||Yw(!1)}function QP(i){U.dockDismissed=i,Yw(i)}function Yw(i,e=!0){U.dockFolded=i,we.dock.classList.toggle("is-folded",i),we.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";we.dockFold.setAttribute("aria-label",t),we.dockFold.setAttribute("title",t),e&&Nc()}function JP(i){U.hiddenCategories.delete(i.category.id),Ix(),$l(),Cd(),Px(i,!0)}function Px(i,e=!1){U.selectedPin=i,document.dispatchEvent(new Event("atlas:selection")),Su(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed(),we.detailTitle.textContent=i.location.title,we.detailCategory.textContent=`${i.group.title} / ${i.category.title}`,we.detailDescription.textContent="",we.detailLinks.hidden=!0,rae(i),we.detailID.textContent=String(i.location.id),we.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=Ww(i.coordinate);we.detailCell.textContent=t,we.detailCellField.hidden=!t;let n=iae(i);if(we.detailSource.textContent=n,we.detailSourceField.hidden=!n,Cg(we.detailDot,i.category),Rg(we.detailDot,i.category,Dc(i.category.title)),we.detail.hidden=!1,$w(),Md(),e){let r=U.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(Tu(U.variant),Math.max(r.getZoom()||0,4)),duration:220})}}function iae(i){let e=U.map?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(U.pinSourceIndex?.map!==U.map){let n=new Map;for(let r of e){for(let s of r.adopted||[])n.set(s.d,r.source);for(let s of r.matched||[]){let o=`confirmed by ${r.source}`;n.set(s.w,t?`${t} \xB7 ${o}`:o)}}U.pinSourceIndex={map:U.map,byID:n}}for(let n of e)if(!n.origin&&i.group.title===n.source)return n.source;return U.pinSourceIndex.byID.get(i.location.id)||t}async function rae(i){let e=await qz();if(U.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],we.detailDescription.textContent=zz(t.d)||"No description is included in the archive.",sae(i)}function sae(i){let e=(i.location.links||[]).filter(n=>U.pinByID.has(n.locationId));if(we.detailLinks.hidden=e.length===0,!e.length){we.detailLinks.replaceChildren();return}let t=document.createDocumentFragment();for(let n of e){let r=document.createElement("button");r.type="button",r.className="detail-link",r.dataset.location=String(n.locationId),r.textContent=n.title,t.append(r)}we.detailLinks.replaceChildren(t)}function Lc(){let i=U.selectedPin!==null;U.selectedPin=null,document.dispatchEvent(new Event("atlas:selection")),U.sources&&(Su(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed()),we.detail.hidden=!0,i&&Md()}function Mu(i){let e=i.attrs?.["atlas.render.as"];return e||(i.displayType==="text"?"text":"pin")}function Hz(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function rf(i){let e=i?.attrs||{};if(e["atlas.geometry.projection"]!=="equirect")return null;let t=(e["atlas.geometry.equirect.px"]||"").split(",").map(Number),n=(e["atlas.geometry.equirect.deg"]||"").split(",").map(Number);if(t.length!==4||n.length!==4||t.some(Number.isNaN)||n.some(Number.isNaN))return null;let[r,s,o,a]=t,[l,c,u,f]=n;return!o||!a||c===f||l===u?null:{toLatLng(p,x){return[c-(x-s)/a*(c-f),l+(p-r)/o*(u-l)]},toWorld(p,x){return[r+(x-l)/(u-l)*o,s+(c-p)/(c-f)*a]}}}var Kw=[NaN,NaN,NaN,0],eI;function oae(){return eI||(eI=Ti(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),eI}var aae=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,lae=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,cae=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,uae=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Zw(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Lx(i){throw new Error('failed to parse "'+i+'" as color')}function Wz(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(lae)||i.match(aae)||i.match(cae);if(s){let o=s[4],a=100/255;return[xi(Zw(s[1],a)+.5|0,0,255),xi(Zw(s[2],a)+.5|0,0,255),xi(Zw(s[3],a)+.5|0,0,255),o!==void 0?xi(Zw(o,100),0,1):1]}Lx(i)}if(i.startsWith("#")){if(uae.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}Lx(i)}let e=oae();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&&Lx(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Wz(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]=k0(r[3]/255,3),r}function jz(i){return typeof i=="string"?i:Fx(i)}var hae=1024,Nx={},tI=0;function Xz(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function nI(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function iI(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function rI(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function sI(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function oI(i){let e=rI(i[0]),t=rI(i[1]),n=rI(i[2]),r=sI(e*.222488403+t*.716873169+n*.06060791),s=500*(sI(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-sI(e*.016863605+t*.117638439+n*.865350722)),a=Math.atan2(o,s)*(180/Math.PI);return[116*r-16,Math.sqrt(s*s+o*o),a<0?a+360:a,i[3]]}function $z(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=iI(e),s=iI(e+t/500*Math.cos(n)),o=iI(e-t/200*Math.sin(n)),a=nI(s*3.021973625-r*1.617392459-o*.404875592),l=nI(s*-.943766287+r*1.916279586+o*.027607165),c=nI(s*.069407491-r*.22898585+o*1.159737864);return[xi(a+.5|0,0,255),xi(l+.5|0,0,255),xi(c+.5|0,0,255),i[3]]}function Dx(i){if(i==="none")return Kw;if(Nx.hasOwnProperty(i))return Nx[i];if(tI>=hae){let t=0;for(let n in Nx)(t++&3)===0&&(delete Nx[n],--tI)}let e=Wz(i);e.length!==4&&Lx(i);for(let t of e)isNaN(t)&&Lx(i);return Nx[i]=e,++tI,e}function Yl(i){return Array.isArray(i)?i:Dx(i)}function Fx(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 lI=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=aI(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=aI(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=aI(e,t),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===Mn.IDLE&&n.load(),n.getImageState()===Mn.LOADING?n.ready().then(()=>{this.patternCache_[s]=wx().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=wx().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function aI(i,e){let t=e?Yl(e):"null";return i+":"+t}var Do=new lI;var Ox=null,Qw=class extends bd{constructor(e,t,n,r,s){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=r===void 0?Mn.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Mn.LOADED){Ox||(Ox=Ti(1,1,void 0,{willReadFrequently:!0})),Ox.drawImage(this.image_,0,0);try{Ox.getImageData(0,0,1,1),this.tainted_=!1}catch{Ox=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(Jt.CHANGE)}handleImageError_(){this.imageState_=Mn.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Mn.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],n=Ti(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Mn.IDLE){this.image_||this.initializeImage_(),this.imageState_=Mn.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&YG(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Mn.LOADED)return;let t=this.image_,n=Ti(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=jz(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===Mn.LOADED||this.imageState_===Mn.ERROR)e();else{let t=()=>{(this.imageState_===Mn.LOADED||this.imageState_===Mn.ERROR)&&(this.removeEventListener(Jt.CHANGE,t),e())};this.addEventListener(Jt.CHANGE,t)}})),this.ready_}};function Rd(i,e,t,n,r,s){let o=e===void 0?void 0:Do.get(e,r);return o||(o=new Qw(i,i&&"src"in i?i.src||void 0:e,t,n,r),Do.set(e,r,o,s)),s&&o&&!Do.getPattern(e,r)&&Do.set(e,r,o,s),o}var Yz=Qw;function za(i){return i?Array.isArray(i)?Fx(i):typeof i=="object"&&"src"in i?fae(i):i:null}function fae(i){if(!i.offset||!i.size)return Do.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=Do.getPattern(e,i.color);if(t)return t;let n=Do.get(i.src,null);if(n.getImageState()!==Mn.LOADED)return null;let r=Ti(i.size[0],i.size[1]);return r.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),Rd(r.canvas,e,void 0,Mn.LOADED,i.color,!0),Do.getPattern(e,i.color)}var Bx="ol-hidden";var Pd="ol-unselectable";var Pg="ol-control",cI="ol-collapsed",dae=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"),Zz=["style","variant","weight","size","lineHeight","family"],Jw={normal:400,bold:700},eS=function(i){let e=i.match(dae);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=Zz.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[Zz[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in Jw&&(t.weight=Jw[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var tS="10px sans-serif",Bs="#000",Cu="round",Va=[],qa=0,Ru="round",sf=10,Qz=0,Fo="#000",Id="center",J0="middle",of=[0,0,0,0],af=1,Q0=new xs,Ux=null,Kz,uI={},pae=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Aae(i,e,t){return`${i} ${e} 16px "${t}"`}var Jz=(function(){let e,t;async function n(s){await t.ready;let o=eS(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let p=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),x=Jw[f.weight]||f.weight;p===a&&f.style===o.style&&x==l&&c.push(f)}),c.length===0?!1:(await Promise.all(c.map(f=>f.load().then(()=>!0,()=>!1)))).some(f=>f)}async function r(){await t.ready;let s=!0,o=Q0.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)?(yu(uI),Q0.set(c,100)):(u+=10,Q0.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=Fs?self.fonts:document.fonts);let o=eS(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(pae.has(c))continue;let u=Aae(o.style,o.weight,c);Q0.get(u)===void 0&&(Q0.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),mae=(function(){let i;return function(e){let t=uI[e];if(t==null){if(Fs){let n=eS(e),r=eV(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);uI[e]=t}return t}})();function eV(i,e){return Ux||(Ux=Ti(1,1)),i!=Kz&&(Ux.font=i,Kz=Ux.font),Ux.measureText(e)}function tV(i,e){return eV(i,e).width}function hI(i,e,t){if(e in t)return t[e];let n=e.split(`5-`).reduce((r,s)=>Math.max(r,tV(i,s)),0);return t[e]=n,n}function nV(i,e){let t=[],n=[],r=[],s=0,o=0,a=0,l=0;for(let c=0,u=e.length;c<=u;c+=2){let f=e[c];if(f===`6-`||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let p=e[c+1]||i.font,x=tV(p,f);t.push(x),o+=x;let v=mae(p);n.push(v),l=Math.max(l,v)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function iV(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]),gae(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 gae(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 fI=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=Wr(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 Yn()}getImage(e){return Yn()}getHitDetectionImage(){return Yn()}getPixelRatio(e){return 1}getImageState(){return Yn()}getImageSize(){return Yn()}getOrigin(){return Yn()}getSize(){return Yn()}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_=Wr(e)}listenImageChange(e){Yn()}load(){Yn()}unlistenImageChange(e){Yn()}ready(){return Promise.resolve()}},nS=fI;var dI=class i extends nS{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Mn.LOADING:Mn.LOADED,this.imageState_===Mn.LOADING&&this.ready().then(()=>this.imageState_=Mn.LOADED),this.render()}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(","),r=Do.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Ti(o,o);this.draw_(s,a,e),r=a.canvas;let l=new Yz(r,void 0,null,Mn.LOADED,null);Do.set(n,null,l),createImageBitmap(r).then(c=>{l.setImage(c)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let r=this.radius,s=this.radius2_===void 0?r:this.radius2_;if(r<s){let D=r;r=s,s=D}let o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),c=Math.sqrt(s*s-l*l),u=r-c,f=Math.sqrt(l*l+u*u),p=f/l;if(e==="miter"&&p<=n)return p*t;let x=t/2/p,v=t/2*(u/f),S=Math.sqrt((r+x)*(r+x)+v*v)-r;if(this.radius2_===void 0||e==="bevel")return S*2;let T=r*Math.sin(a),P=Math.sqrt(r*r-T*T),R=s-P,L=Math.sqrt(T*T+R*R)/T;if(L<=n){let D=L*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=Cu,t=Ru,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=za(this.stroke_.getColor()??Fo),a=this.stroke_.getWidth()??af,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Ru,e=this.stroke_.getLineCap()??Cu,n=this.stroke_.getMiterLimit()??sf);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=Bs),t.fillStyle=za(r),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),r=0;typeof n=="string"&&(n=Yl(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Ti(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{let r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);let s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){let l=s+a*o,c=a%2===0?n:r;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=Bs,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()}},iS=dI;var pI=class i extends iS{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}},rS=pI;var AI=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=Rd(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===Mn.IDLE&&t.load(),t.getImageState()===Mn.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Ln(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Yl(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},jr=AI;function rV(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 mI=class i extends nS{constructor(e){e=e||{};let t=e.opacity!==void 0?e.opacity:1,n=e.rotation!==void 0?e.rotation:0,r=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:n,scale:r,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;let o=e.img!==void 0?e.img:null,a=e.src;Vn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Ln(o)),Vn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Vn(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=Mn.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?Mn.LOADED:Mn.IDLE:l=Mn.LOADING:l=Mn.LOADED),this.color_=e.color!==void 0?Yl(e.color):null,this.iconImage_=Rd(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let c,u;if(e.size)[c,u]=e.size;else{let f=this.getImage(1);if(f.width&&f.height)c=f.width,u=f.height;else if(f instanceof HTMLImageElement){this.initialOptions_=e;let p=()=>{if(this.unlistenImageChange(p),!this.initialOptions_)return;let x=this.iconImage_.getSize();this.setScale(rV(x[0],x[1],e.width,e.height))};this.listenImageChange(p);return}}c!==void 0&&this.setScale(rV(c,u,e.width,e.height))}}clone(){let e,t,n;return this.initialOptions_?(t=this.initialOptions_.width,n=this.initialOptions_.height):(e=this.getScale(),e=Array.isArray(e)?e.slice():e),new i({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:e,width:t,height:n,size:this.size_!==null?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let r=this.getSize();if(this.anchorXUnits_=="fraction"||this.anchorYUnits_=="fraction"){if(!r)return null;e=this.anchor_.slice(),this.anchorXUnits_=="fraction"&&(e[0]*=r[0]),this.anchorYUnits_=="fraction"&&(e[1]*=r[1])}if(this.anchorOrigin_!="top-left"){if(!r)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_=="top-right"||this.anchorOrigin_=="bottom-right")&&(e[0]=-e[0]+r[0]),(this.anchorOrigin_=="bottom-left"||this.anchorOrigin_=="bottom-right")&&(e[1]=-e[1]+r[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){let t=e?Yl(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((o,a)=>o===t[a]))return;this.color_=t;let n=this.getSrc(),r=n!==void 0?null:this.getHitDetectionImage(),s=n!==void 0?Mn.IDLE:this.iconImage_.getImageState();this.iconImage_=Rd(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_=Rd(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Mn.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==Mn.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==Mn.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(Jt.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(Jt.CHANGE,e)}ready(){return this.iconImage_.ready()}},eA=mI;var gI=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}},Ks=gI;var sS=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=sV,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_=sV,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function oV(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(Vn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var _I=null;function xI(i,e){if(!_I){let t=new jr({color:"rgba(255,255,255,0.4)"}),n=new Ks({color:"#3399CC",width:1.25});_I=[new sS({image:new rS({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return _I}function sV(i){return i.getGeometry()}var Us=sS;var _ae="#333",yI=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_=Wr(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 jr({color:_ae}),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 jr?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_=Wr(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}},lf=yI;function Zl(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function cV(i){let e=i.get("pin");return!e||Kl(e)||e.insideHighlightedZone||Ig(e)?null:vI(e,!1)}function uV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Kl(e)||Ig(e)?null:vI(e,!1)}function hV(i){let e=i.get("pin");return!e||Kl(e)||!U.labelsHeld?null:mV(e)}function fV(i){let e=i.get("pin");if(!e||Kl(e)||e.insideHighlightedZone||Ig(e)||zx())return null;if(U.labelsHeld)return kx(e,!1);let t=U.fitZoom+Math.log2(SV(e.category));return(U.engine.getView().getZoom()||0)<t?null:kx(e,!1)}function dV(i){let e=i.get("pin");return!e||Kl(e)||e.insideHighlightedZone||Ig(e)||!zx()?null:kx(e,!1)}function pV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Kl(e)||Ig(e)?null:kx(e,!1)}function AV(i){let e=i.get("pin");if(!e||Kl(e))return null;if(Mu(e.category)==="text")return kx(e,e===U.selectedPin);let t=vI(e,e===U.selectedPin);return e===U.hoveredPin||e===U.selectedPin?[t,mV(e)]:t}function vI(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let n=K0(i.category),r=e?2e7:i.priority,s=U.markerIcons.get(Gx(i.category)),o;return s?o=new Us({image:new eA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new Us({text:new lf({text:Dc(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new jr({color:n}),stroke:new Ks({color:Z0(),width:e?4:3})}),zIndex:r}),U.styleCache.set(t,o),o}function mV(i){let e=`marker-label:${i.location.id}`;if(U.styleCache.has(e))return U.styleCache.get(e);let t=new Us({text:new lf({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new jr({color:"#f2ece0"}),stroke:new Ks({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new jr({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 gV(i){if(!i.iconAsset)return;let e=Gx(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=K0(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=Z0(),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")),xae(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.priority.changed()},t.onerror=()=>U.markerIcons.set(e,!1),t.src=KP(i.iconAsset)}function xae(){for(let i of U.styleCache.keys())i.startsWith("marker:")&&U.styleCache.delete(i)}function Gx(i){return`${i.iconAsset||""}:${K0(i)}:${U.map?.iconOutset||"light"}`}function kx(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let r=[new Us({text:new lf({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new jr({color:e?"#7fd0ea":"#f2ece0"}),stroke:new Ks({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new jr({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new Ks({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 bI(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="leaf",r=t.role==="scope",s=t.role==="neighbor",o=n||r?15:s?10:11,l=`${n||r?900:s?750:800} ${o}px ui-monospace, SFMono-Regular, Menlo, monospace`,c=s?[2,4,2,4]:[3,5,3,5],u=yae(t,l,o,c,e);if(t.role==="child"&&(!u||!U.subgridVisible))return null;let f=r&&U.subgridVisible,p=`grid:${t.hash}:${t.role}:${t.contextDistance}:${u?1:0}:${f?1:0}`;if(U.styleCache.has(p))return U.styleCache.get(p);let x=rg[Math.max(0,Hl.indexOf(t.hash[t.hash.length-1]))%rg.length],v=new Us({fill:r?void 0:new jr({color:s?`rgba(5, 8, 16, ${Math.min(.52,.3+t.contextDistance*.06)})`:nf(x,n?.14:.055)}),stroke:new Ks({color:n||r?"#ffffff":nf(x,s?.44:.82),width:n?2.5:r?f?1.8:2.5:s?1:1.4}),text:u&&!f?new lf({text:t.hash,font:l,fill:new jr({color:n||r?"#ffffff":s?nf(x,.72):x}),stroke:new Ks({color:"rgba(0,0,0,0.96)",width:4}),backgroundFill:new jr({color:s?"rgba(8,11,18,0.88)":"rgba(12,15,22,0.76)"}),padding:c,overflow:!0}):void 0,zIndex:n||r?100:i.get("priority")});return U.styleCache.set(p,v),v}function yae(i,e,t,n,r){if(!r)return!0;let s=vae(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 aV=document.createElement("canvas").getContext("2d"),lV=new Map;function vae(i,e){let t=`${e}|${i}`,n=lV.get(t);return n===void 0&&(aV.font=e,n=aV.measureText(i).width,lV.set(t,n)),n}var bae=new Us({fill:new jr({color:"rgba(5, 8, 16, 0.62)"})});function _V(){return U.zonesVisible?bae:null}function xV(i){if(!U.zonesVisible)return null;let e=i.get("zone"),t=i.get("child"),n=U.highlightedZones.has(e.id),r=wV(e.id),s=`zone:${e.id}:${t?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color");if(r){let c=new Us({stroke:new Ks({color:nf(o,t?.34:.44),width:t?1:1.3,lineDash:t?[3,4]:[7,5]}),zIndex:t?101:100});return U.styleCache.set(s,c),c}let a=new Us({fill:new jr({color:nf(o,t?.035:.07)}),stroke:new Ks({color:nf(o,t?.5:.72),width:t?1.2:1.8,lineDash:t?[3,4]:[7,5]})});if(!n)return U.styleCache.set(s,a),a;let l=[new Us({stroke:new Ks({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Us({fill:new jr({color:nf(o,.22)}),stroke:new Ks({color:o,width:2.6}),zIndex:9001})];return U.styleCache.set(s,l),l}function yV(i){if(!U.zonesVisible||zx())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:bV(i)}function vV(i){return!U.zonesVisible||!zx()?null:bV(i)}function bV(i){let e=i.get("child"),t=i.get("zone"),n=U.highlightedZones.has(t.id),r=wV(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 Us({text:new lf({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new jr({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new Ks({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 jr({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new Ks({color:n?"#ffffff":nf(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 wV(i){if(!U.highlightedZones.size||U.highlightedZones.has(i))return!1;for(let e of U.highlightedZones)if(wae(i,e))return!1;return!0}function wae(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}var wI=class i extends vu{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Pc(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){if(r<Ad(this.getExtent(),e,t))return r;let s=this.flatCoordinates,o=this.stride;for(let a=0,l=s.length;a<l;a+=o){let c=Sc(e,t,s[a],s[a+1]);if(c<r){r=c;for(let u=0;u<o;++u)n[u]=s[a+u];n.length=o}}return r}getCoordinates(){return bu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new tf(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 tf(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(px(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Sx(this.flatCoordinates,0,e,this.stride),this.changed()}},TV=wI;function oS(i,e,t,n){let r=[],s=Cr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=og(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 SI=class i extends vu{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){let r=e,s=[],o=[];for(let a=0,l=r.length;a<l;++a){let c=r[a],u=s.length,f=c.getEnds();for(let p=0,x=f.length;p<x;++p)f[p]+=u;Pc(s,c.getFlatCoordinates()),o.push(f)}t=r.length===0?this.getLayout():r[0].getLayout(),e=s,n=o}t!==void 0&&n?(this.setFlatCoordinates(t,e),this.endss_=n):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{let n=this.flatCoordinates.length;Pc(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let r=0,s=t.length;r<s;++r)t[r]+=n}this.endss_.push(t),this.changed()}clone(){let e=this.endss_.length,t=new Array(e);for(let r=0;r<e;++r)t[r]=this.endss_[r].slice();let n=new i(this.flatCoordinates.slice(),this.layout,t);return n.applyProperties(this),n}closestPointXY(e,t,n,r){return r<Ad(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Rz(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Pz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return OG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return Mz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),XP(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Tx(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=oS(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Gw(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new TV(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;Dz(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=XP(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Nz(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 wu(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){let e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o].slice(),c=l[l.length-1];if(s!==0)for(let f=0,p=l.length;f<p;++f)l[f]-=s;let u=new wu(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return UG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=Ez(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()}},EV=SI;function TI(){let i=(U.map.zones||[]).filter(CI);U.renderedShard=U.variant?.shard||0,U.sources.zones.clear(),U.sources.zoneTitles.clear(),U.zoneRecords.clear(),U.highlightedZones.clear(),U.focusedZoneID=null,U.zoneTitleCount=0,aS(!0),we.zoneIndex.hidden=i.length===0,we.zoneCount.textContent=Fc(i.length);for(let e of i){let t=Cr(),n=[],r=!1;for(let l of e.features||[]){let c=Eae(l);c&&(r=!0,n.push(c),lw(t,c.getExtent()),U.sources.zones.addFeature(new wd({geometry:c,zone:e,color:jw(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=jw(e.id),o=e.center?Ng(e.center.lat,e.center.lng):Ua(t),a=Math.max(t[2]-t[0],t[3]-t[1]);U.sources.zoneTitles.addFeature(new wd({geometry:new tf(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,CV(),Sae()}function CV(){if(U.sources.zoneScrim.clear(),!U.highlightedZones.size)return;let[i,e,t,n]=U.projection.getExtent(),r=[MV([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of U.highlightedZones)for(let o of U.zoneRecords.get(s)?.geometries||[]){let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(MV(c.getCoordinates(),u>0))})}U.sources.zoneScrim.addFeature(new wd({geometry:new wu(r)}))}function MV(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 Sae(){let i=document.createDocumentFragment();for(let{zone:e,depth:t}of Tae()){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)}we.zoneList.replaceChildren(i),we.zoneIndex.hidden=U.zoneRecords.size===0}function Tae(){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 aS(i){U.zonesVisible=i,we.zoneToggle.checked=i,U.layers.zoneScrim.setVisible(i),U.layers.zones.setVisible(i),U.layers.zoneTitles.setVisible(i),U.layers.zoneTitleDetail.setVisible(i)}function RV(i){let e=U.zoneRecords.get(i);e&&(U.focusedZoneID=i,IV(),Lc(),U.engine.getView().fit(e.extent,{size:U.engine.getSize(),padding:[54,54,54,54],maxZoom:Tu(U.variant),duration:220}),we.sidebar.classList.remove("is-open"),we.mobileLegend.setAttribute("aria-expanded","false"))}function PV(i){U.zoneRecords.has(i)&&(U.highlightedZones.has(i)?U.highlightedZones.delete(i):(U.highlightedZones.add(i),aS(!0)),U.hoveredPin=null,EI(),MI(),IV(),CV(),U.layers.zones.changed(),U.layers.zoneTitles.changed(),U.layers.zoneTitleDetail.changed())}function IV(){we.zoneIndex.classList.toggle("has-highlights",U.highlightedZones.size>0);for(let i of we.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 Eae(i){if(!i?.coordinates)return null;let e=([t,n])=>Ng(n,t);return i.type==="Polygon"?new wu(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new EV(i.coordinates.map(t=>t.map(n=>n.map(e)))):null}function Ng(i,e){let t=Mae(),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 Mae(){let i=U.game.tileGrid,e=U.map?.grid;return e?{...i,...e}:i}function NV(){U.sources.pins.clear(),U.sources.text.clear(),U.sources.priority.clear(),U.pins=[],U.pinByID.clear();for(let i of U.map.groups)for(let e of i.categories){Mu(e)!=="text"&&gV(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:Ng(t.lat,t.lng),filteredHidden:!1,priority:Iae(e,t),feature:null};n.feature=new wd({geometry:new tf(n.coordinate),pin:n,priority:n.priority}),U.pins.push(n),U.pinByID.set(t.id,n),Mu(e)==="text"?U.sources.text.addFeature(n.feature):U.sources.pins.addFeature(n.feature)}}$l()}function $l(){for(let i of U.pins){let e=U.hiddenCategories.has(i.category.id),t=U.search&&!i.location.title.toLocaleLowerCase().includes(U.search);i.filteredHidden=!!(e||t)}EI(),MI(),U.selectedPin?.filteredHidden&&Lc(),Md(),document.dispatchEvent(new Event("atlas:filters"))}function EI(){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=>Cae(n,e.coordinate)))}function Cae(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 MI(){U.eligibleLocations=U.pins.filter(i=>!Kl(i)).length,Su(),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(),tA()}function Su(){U.sources.priority.clear();for(let i of U.pins){if(Kl(i))continue;let e=!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search);(i===U.selectedPin||i===U.hoveredPin||e||Ed(i))&&U.sources.priority.addFeature(i.feature)}}function Lg(i){U.hoveredPin!==i&&(U.hoveredPin=i,U.sources&&(Su(),U.layers.pins.changed(),U.layers.priority.changed()))}function lS(i){U.labelsHeld!==i&&(U.labelsHeld=i,we.labelsHint.textContent=i?"Z \xB7 labels shown":"Z \xB7 hold for labels",U.layers.pinLabels.changed(),U.layers.text.changed())}function Ig(i){return i===U.selectedPin||i===U.hoveredPin||Ed(i)||!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search)}function Kl(i){return i.filteredHidden||Rae(i)||Pae(i)||!CI(i.location)}function CI(i){let e=U.variant?.shard;return!e||!i.shard||i.shard===e}function Rae(i){return!U.highlightedZones.size||i.insideHighlightedZone||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function Pae(i){return!U.gridEnabled||!U.gridPrefix||Ed(i)||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function Iae(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+Gz(e.id)%1e3}function SV(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function zx(){return(U.engine?.getView().getZoom()||0)>=(U.variant?.maxZoom||0)-.05}function LV(i){let e=[],t=[];for(let n of i){let r=[];for(let s of n.categories)(Mu(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 DV(){let i=document.createDocumentFragment();for(let e of U.map.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.categories.reduce((s,o)=>s+o.locations.length,0);t.append(Nae(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.categories)r.append(Lae(s));t.append(r),i.append(t)}we.legend.replaceChildren(i),cS(),Cd()}function Nae(i,e,t){let n=document.createElement("div");n.className="layer-header";let r=document.createElement("button");r.type="button",r.className="layer-title",r.dataset.section=i;let s=document.createElement("span");s.className="layer-chevron",s.setAttribute("aria-hidden","true"),s.innerHTML='<svg viewBox="0 0 24 24"><path d="m9 6 6 6-6 6"/></svg>';let o=document.createElement("span");o.textContent=e;let a=document.createElement("span");a.className="layer-count",a.textContent=Fc(t),r.append(s,o,a);let l=FV(`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 FV(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 Lae(i){let e=Mu(i)==="text",t=document.createElement("label");t.className="category-row",Cg(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",Rg(r,i,Dc(i.title)),r.title=i.icon||i.title);let s=document.createElement("span");s.className="category-name",s.textContent=i.title;let o=document.createElement("span");o.className="category-count",o.textContent=Fc(i.locations.length);let a=FV(`Show only ${i.title}`);return a.dataset.onlyCategory=String(i.id),t.append(n,r,s,a,o),t}function RI(i){if(U.collapsedSections.clear(),i)for(let e of we.layers.querySelectorAll("[data-section]"))U.collapsedSections.add(e.dataset.section);cS()}function cS(){for(let i of we.layers.querySelectorAll("[data-section]")){let e=U.collapsedSections.has(i.dataset.section);i.setAttribute("aria-expanded",String(!e)),i.closest(".layer-section").classList.toggle("is-collapsed",e)}Nc()}function Vx(i){if(U.hiddenCategories.clear(),!i)for(let e of U.map.groups)for(let t of e.categories)U.hiddenCategories.add(t.id);Ix(),$l(),Md(),Cd()}function Ix(){for(let i of document.querySelectorAll("[data-category]"))i.checked=!U.hiddenCategories.has(Number(i.dataset.category))}function OV(i){let e=U.map.sections.find(n=>n.key===i);if(!e)return;let t=e.categories.some(n=>!U.hiddenCategories.has(n.id));for(let n of e.categories)t?U.hiddenCategories.add(n.id):U.hiddenCategories.delete(n.id);Ix(),$l(),Cd()}function BV(i){if(U.map){if(Dae(i)){Vx(!0);return}U.hiddenCategories.clear();for(let e of U.map.sections){let t=i.section===e.key;for(let n of e.categories)!t&&i.category!==n.id&&U.hiddenCategories.add(n.id)}Ix(),$l(),Md(),Cd()}}function Dae(i){for(let e of U.map.sections)for(let t of e.categories)if((i.section===e.key||i.category===t.id)===U.hiddenCategories.has(t.id))return!1;return!0}function Fae(){let i=we.soloChip;if(!U.map){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of U.map.sections){let a=0;for(let l of o.categories)U.hiddenCategories.has(l.id)||(a++,t++,e=l);a>0&&(r++,n=a===o.categories.length?o:null)}let s="";t===1&&e?s=e.title:r===1&&n&&(s=n.title),i.hidden=!s,i.textContent=s?`only: ${s}`:"",i.title=s?`Showing only ${s} \u2014 click to show everything`:""}function Cd(){if(U.map){for(let i of U.map.sections){let e=we.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.categories.some(t=>!U.hiddenCategories.has(t.id)))}Fae(),Nc()}}async function UV(i){let[e,t]=await Promise.all([fetch(`${U.game.base}/maps/${i.slug}.json`),fetch(`${U.game.base}/maps/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`map ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.groups.flatMap(o=>o.categories);return Oae(r,s),{...i,grid:n.grid,variants:n.variants,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:LV(n.groups)}}function Oae(i,e){let t=new DataView(i);if(String.fromCharCode(...new Uint8Array(i,0,8))!=="ATLASLOC")throw new Error("location payload is not in the expected form");let r=t.getUint16(8,!0);if(r!==2)throw new Error(`location payload is version ${r}, and this reads 2`);let s=t.getUint32(10,!0),o=16,a=new Int32Array(i,o,s),l=new Float32Array(i,o+=s*4,s),c=new Float32Array(i,o+=s*4,s),u=new Int32Array(i,o+=s*4,s),f=new Int32Array(i,o+=s*4,s),p=new Uint32Array(i,o+=s*4,s+1),x=new Uint16Array(i,o+=(s+1)*4,s),v=new Uint8Array(i,o+s*2),w=new TextDecoder;for(let S of e)S.locations=[];for(let S=0;S<s;S++)e[x[S]].locations.push({id:a[S],title:w.decode(v.subarray(p[S],p[S+1])),lat:l[S],lng:c[S],regionId:u[S]||void 0,shard:f[S]||void 0})}async function qz(){let i=`${U.game.base}/${U.map.slug}`;return U.textByMap.has(i)||U.textByMap.set(i,fetch(`${U.game.base}/maps/${U.map.slug}.text`).then(e=>e.json()).catch(()=>({}))),U.textByMap.get(i)}var uS=null;function nA(){return uS||(uS=Bae().finally(()=>{uS=null})),uS}async function Bae(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=U.game;if(U.catalog=await i.json(),F0(we.game,U.catalog.games,"title"),PI(),!U.catalog.games.length)return;let t=e&&U.catalog.games.find(n=>n.slug===e.slug);if(!t){let n=Tg();await cf(n.game||Sg()?.game||U.catalog.games[0].slug,n.game?n.map:void 0);return}if(t.stamp!==e.stamp){for(let r of U.textByMap.keys())r.startsWith(e.base+"/")&&U.textByMap.delete(r);let n=U.engine?.getView();U.restore={game:t.slug,map:U.map?.slug,variant:U.map?U.map.variants.indexOf(U.variant):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},await cf(t.slug,U.map?.slug);return}U.game=t,we.game.value=t.slug}function PI(){let i=!U.catalog?.games?.length;we.emptyState.hidden=!i,U.catalog?.bundlesDir&&(we.emptyPath.textContent=U.catalog.bundlesDir)}async function II(){for(let i of[we.emptyOpen,we.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await nA();let t=e.imported?.[0];t&&U.catalog.games.some(n=>n.slug===t)&&await cf(t)}finally{for(let i of[we.emptyOpen,we.addBundles])i.disabled=!1}}var Qs={ADD:"add",REMOVE:"remove"};var kV={LENGTH:"length"},Dg=class extends Ys{constructor(e,t,n){super(e),this.element=t,this.index=n}},NI=class extends xs{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(kV.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 Dg(Qs.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Dg(Qs.REMOVE,t,e)),t}setAt(e,t){let n=this.getLength();if(e>=n){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);let r=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Dg(Qs.REMOVE,r,e)),this.dispatchEvent(new Dg(Qs.ADD,t,e))}updateLength_(){this.set(kV.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")}},ho=NI;var LI=class extends Ys{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Nd=LI;var DI=class extends Nd{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()}},Pu=DI;var ir={SINGLECLICK:"singleclick",CLICK:Jt.CLICK,DBLCLICK:Jt.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var qx={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var FI=class extends bd{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=kn(n,qx.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=kn(n,qx.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_,Cw?{passive:!1}:!1)}emulateClick_(e){let t=new Pu(ir.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Pu(ir.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new Pu(ir.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==ir.POINTERUP||t.type==ir.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==ir.POINTERDOWN||t.type==ir.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new Pu(ir.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(ii),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new Pu(ir.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(kn(n,ir.POINTERMOVE,this.handlePointerMove_,this),kn(n,ir.POINTERUP,this.handlePointerUp_,this),kn(this.element_,ir.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(kn(this.element_.getRootNode(),ir.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new Pu(ir.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 Pu(ir.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(ii(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(ii(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(ii),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},GV=FI;var Iu={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var fo={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var Hx=1/0,OI=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,yu(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){Vn(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=Hx?(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==Hx?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},zV=OI;var BI=class extends zV{constructor(e,t){super(n=>e.apply(null,n),n=>n[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(Jt.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===rn.LOADED||n===rn.ERROR||n===rn.EMPTY){n!==rn.ERROR&&t.removeEventListener(Jt.CHANGE,this.boundHandleTileChange_);let r=t.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){let r=this.dequeue()[0],s=r.getKey();r.getState()===rn.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}},VV=BI;function qV(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return Hx;if(!i.wantedTiles[t][e.getKey()])return Hx;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 ks={ANIMATING:0,INTERACTING:1};var Ql={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function UI(i,e,t){return(function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;let l=e?0:s[0]*r,c=e?0:s[1]*r,u=a?a[0]:0,f=a?a[1]:0,p=i[0]+l/2+u,x=i[2]-l/2+u,v=i[1]+c/2+f,w=i[3]-c/2+f;p>x&&(p=(x+p)/2,x=p),v>w&&(v=(w+v)/2,w=v);let S=xi(n[0],p,x),T=xi(n[1],v,w);if(o&&t&&r){let P=30*r;S+=-P*Math.log(1+Math.max(0,p-n[0])/P)+P*Math.log(1+Math.max(0,n[0]-x)/P),T+=-P*Math.log(1+Math.max(0,v-n[1])/P)+P*Math.log(1+Math.max(0,n[1]-w)/P)}return[S,T]})}function HV(i){return i}function kI(i,e,t,n){let r=jn(e)/t[0],s=_r(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function GI(i,e,t){let n=Math.min(i,e),r=50;return n*=Math.log(1+r*Math.max(0,i/e-1))/r+1,t&&(n=Math.max(n,t),n/=Math.log(1+r*Math.max(0,t/i-1))/r+1),xi(n,t/2,e*2)}function WV(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?kI(l,t,o,n):l;if(a)return e?GI(r,u,c):xi(r,c,u);let f=Math.min(u,r),p=Math.floor(gg(i,f,s));return i[p]>u&&p<i.length-1?i[p+1]:i[p]}})}function jV(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?kI(e,r,l,s):e;if(c)return n?GI(o,u,t):xi(o,t,u);let f=1e-9,p=Math.ceil(Math.log(e/u)/Math.log(i)-f),x=-a*(.5-f)+.5,v=Math.min(u,o),w=Math.floor(Math.log(e/v)/Math.log(i)+x),S=Math.max(p,w),T=e/Math.pow(i,S);return xi(T,t,u)}})}function zI(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?kI(i,n,a,r):i;return!t||!l?xi(s,e,c):GI(s,c,e)}})}function Fg(i){if(i!==void 0)return 0}function VI(i){if(i!==void 0)return i}function XV(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 $V(i){let e=i===void 0?Tc(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var qI=0,WI=class extends xs{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=vw(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&&EG(),e.center&&(e.center=Cc(e.center,this.projection_)),e.extent&&(e.extent=Rc(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Ql)delete t[a];this.setProperties(t,!0);let n=kae(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=Uae(e),s=n.constraint,o=Gae(e);this.constraints_={center:r,resolution:s,rotation:o},this.setRotation(e.rotation!==void 0?e.rotation:0),this.setCenterInternal(e.center!==void 0?e.center:null),e.resolution!==void 0?this.setResolution(e.resolution):e.zoom!==void 0&&this.setZoom(e.zoom)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let n=this.getCenterInternal();if(n){let r=e||[0,0,0,0];t=t||[0,0,0,0];let s=this.getResolution(),o=s/2*(r[3]-t[3]+t[1]-r[1]),a=s/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+o,n[1]-a])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution!==void 0?t.resolution=this.getResolution():t.zoom=this.getZoom(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=new Array(arguments.length);for(let n=0;n<t.length;++n){let r=arguments[n];r.center&&(r=Object.assign({},r),r.center=Cc(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=Cc(r.anchor,this.getProjection())),t[n]=r}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]=="function"&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){let u=arguments[r];u.center&&this.setCenterInternal(u.center),u.zoom!==void 0?this.setZoom(u.zoom):u.resolution&&this.setResolution(u.resolution),u.rotation!==void 0&&this.setRotation(u.rotation)}if(r===t){n&&hS(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||ZG,callback:n};if(u.center&&(f.sourceCenter=o,f.targetCenter=u.center.slice(),o=f.targetCenter),u.zoom!==void 0?(f.sourceResolution=a,f.targetResolution=this.getResolutionForZoom(u.zoom),a=f.targetResolution):u.resolution&&(f.sourceResolution=a,f.targetResolution=u.resolution,a=f.targetResolution),u.rotation!==void 0){f.sourceRotation=l;let p=xu(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+p,l=f.targetRotation}zae(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(ks.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[ks.ANIMATING]>0}getInteracting(){return this.hints_[ks.INTERACTING]>0}cancelAnimations(){this.setHint(ks.ANIMATING,-this.hints_[ks.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&hS(r[0].callback,!1),!e)for(let s=0,o=r.length;s<o;++s){let a=r[s];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let e=Date.now(),t=!1;for(let n=this.animations_.length-1;n>=0;--n){let r=this.animations_[n],s=!0;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l.complete)continue;let c=e-l.start,u=l.duration>0?c/l.duration:1;u>=1?(l.complete=!0,u=1):s=!1;let f=l.easing(u);if(l.sourceCenter){let p=l.sourceCenter[0],x=l.sourceCenter[1],v=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=p+f*(v-p),T=x+f*(w-x);this.targetCenter_=[S,T]}if(l.sourceResolution&&l.targetResolution){let p=f===1?l.targetResolution:l.sourceResolution+f*(l.targetResolution-l.sourceResolution);if(l.anchor){let x=this.getViewportSize_(this.getRotation()),v=this.constraints_.resolution(p,0,x,!0);this.targetCenter_=this.calculateCenterZoom(v,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=p,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let p=f===1?xu(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+f*(l.targetRotation-l.sourceRotation);if(l.anchor){let x=this.constraints_.rotation(p,!0);this.targetCenter_=this.calculateCenterRotate(x,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=p}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(ks.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&hS(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]],ug(n,e-this.getRotation()),sG(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&&yx(e,this.getProjection())}getCenterInternal(){return this.get(Ql.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){let t=this.calculateExtentInternal(e);return _d(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();Vn(t,"The view center is not defined");let n=this.getResolution();Vn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return Vn(r!==void 0,"The view rotation is not defined"),mx(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Ql.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Rc(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=jn(e)/t[0],r=_r(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e=e||2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(s){return t/Math.pow(e,s*r)})}getRotation(){return this.get(Ql.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,s=Math.log(n/r)/t;return(function(o){return Math.log(n/o)/t/s})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),s=this.padding_;if(s){let o=this.getViewportSizeMinusPadding_();r=HI(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=gg(this.resolutions_,e,1);t=s,n=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=n/this.resolutions_[s+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=xi(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,xi(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(Vn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){Vn(!_u(e),"Cannot fit empty extent provided as `geometry`");let r=Rc(e,this.getProjection());n=$P(r)}else if(e.getType()==="Circle"){let r=Rc(e.getExtent(),this.getProjection());n=$P(r),n.rotate(this.getRotation(),Ua(r))}else{let r=H0();r?n=e.clone().transform(r,this.getProjection()):n=e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),s=e.getFlatCoordinates(),o=e.getStride(),a=1/0,l=1/0,c=-1/0,u=-1/0;for(let f=0,p=s.length;f<p;f+=o){let x=s[f]*n-s[f+1]*r,v=s[f]*r+s[f+1]*n;a=Math.min(a,x),l=Math.min(l,v),c=Math.max(c,x),u=Math.max(u,v)}return[a,l,c,u]}fitInternal(e,t){t=t||{};let n=t.size;n||(n=this.getViewportSizeMinusPadding_());let r=t.padding!==void 0?t.padding:[0,0,0,0],s=t.nearest!==void 0?t.nearest:!1,o;t.minResolution!==void 0?o=t.minResolution:t.maxZoom!==void 0?o=this.getResolutionForZoom(t.maxZoom):o=0;let a=this.rotatedExtentForGeometry(e),l=this.getResolutionForExtentInternal(a,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);let c=this.getRotation(),u=Math.sin(c),f=Math.cos(c),p=Ua(a);p[0]+=(r[1]-r[3])/2*l,p[1]+=(r[0]-r[2])/2*l;let x=p[0]*f-p[1]*u,v=p[1]*f+p[0]*u,w=this.getConstrainedCenter([x,v],l),S=t.callback?t.callback:ef;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),hS(S,!0))}centerOn(e,t,n){this.centerOnInternal(Cc(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(HI(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=HI(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=yx(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t=t&&Cc(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),s=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(s,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(Math.pow(this.zoomFactor_,-e),t)}adjustRotation(e,t){t&&(t=Cc(t,this.getProjection())),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&Cc(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),s=this.getViewportSize_(r),o=this.constraints_.resolution(this.targetResolution_,0,s,n),a=this.constraints_.center(this.targetCenter_,o,s,n,this.calculateCenterShift(this.targetCenter_,o,r,s));this.get(Ql.ROTATION)!==r&&this.set(Ql.ROTATION,r),this.get(Ql.RESOLUTION)!==o&&(this.set(Ql.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Ql.CENTER)||!G0(this.get(Ql.CENTER),a))&&this.set(Ql.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e!==void 0?e:200;let r=t||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}n=n||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!G0(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Xl,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ks.INTERACTING,1)}endInteraction(e,t,n){n=n&&Cc(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(ks.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 hS(i,e){setTimeout(function(){i(e)},0)}function Uae(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return UI(i.extent,i.constrainOnlyCenter,t)}let e=vw(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,UI(t,!1,!1)}return HV}function kae(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:qI,a=i.maxZoom!==void 0?i.maxZoom:28,l=i.zoomFactor!==void 0?i.zoomFactor:2,c=i.multiWorld!==void 0?i.multiWorld:!1,u=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,f=i.showFullExtent!==void 0?i.showFullExtent:!1,p=vw(i.projection,"EPSG:3857"),x=p.getExtent(),v=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&p.isGlobal()&&(v=!1,w=x),i.resolutions!==void 0){let S=i.resolutions;t=S[o],n=S[a]!==void 0?S[a]:S[S.length-1],i.constrainResolution?e=WV(S,u,!v&&w,f):e=zI(t,n,u,!v&&w,f)}else{let T=(x?Math.max(jn(x),_r(x)):360*Zh.degrees/p.getMetersPerUnit())/256/Math.pow(2,qI),P=T/Math.pow(2,28-qI);t=i.maxResolution,t!==void 0?o=0:t=T/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=t/Math.pow(l,a):n=T/Math.pow(l,a):n=P),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=jV(l,t,n,u,!v&&w,f):e=zI(t,n,u,!v&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function Gae(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?$V():t===!1?VI:typeof t=="number"?XV(t):VI}return Fg}function zae(i){return!(i.sourceCenter&&i.targetCenter&&!G0(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function HI(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=WI;var jI=class extends xs{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let t=0,n=this.listenerKeys.length;t<n;++t)ii(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=e,e){let t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==ef&&this.listenerKeys.push(kn(e,Iu.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},Og=jI;var XI=class extends Og{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className!==void 0?e.className:"ol-attribution",n=e.tipLabel!==void 0?e.tipLabel:"Attributions",r=e.expandClassName!==void 0?e.expandClassName:t+"-expand",s=e.collapseLabel!==void 0?e.collapseLabel:"\u203A",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;let a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):this.label_=a;let l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(Jt.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+Pd+" "+Pg+(this.collapsed_&&this.collapsible_?" "+cI:"")+(this.collapsible_?"":" ol-uncollapsible"),u=this.element;u.className=c,u.appendChild(this.toggleButton_),u.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){let t=this.getMap().getAllLayers(),n=new Set(t.flatMap(r=>r.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(r=>n.add(r)):n.add(this.attributions_)),!this.overrideCollapsible_){let r=!t.some(s=>s.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(r)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1);return}let t=await Promise.all(this.collectSourceAttributions_(e).map(r=>WG(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Lo(t,this.renderedAttributions_)){QG(this.ulElement_);for(let r=0,s=t.length;r<s;++r){let o=document.createElement("li");o.innerHTML=t[r],this.ulElement_.appendChild(o)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(cI),this.collapsed_?yP(this.collapseLabel_,this.label_):yP(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)}},YV=XI;var $I=class extends Og{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});let t=e.className!==void 0?e.className:"ol-rotate",n=e.label!==void 0?e.label:"\u21E7",r=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let s=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(Jt.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+Pd+" "+Pg,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(Bx)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){let t=this.getMap().getView();if(!t)return;let n=t.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:Xl}):t.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let r="rotate("+n+"rad)";if(this.autoHide_){let s=this.element.classList.contains(Bx);!s&&n===0?this.element.classList.add(Bx):s&&n!==0&&this.element.classList.remove(Bx)}this.label_.style.transform=r}this.rotation_=n}},ZV=$I;var YI=class extends Og{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});let t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,r=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",s=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"\u2013",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",c=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild(typeof o=="string"?document.createTextNode(o):o),u.addEventListener(Jt.CLICK,this.handleClick_.bind(this,n),!1);let f=document.createElement("button");f.className=s,f.setAttribute("type","button"),f.title=c,f.appendChild(typeof a=="string"?document.createTextNode(a):a),f.addEventListener(Jt.CLICK,this.handleClick_.bind(this,-n),!1);let p=t+" "+Pd+" "+Pg,x=this.element;x.className=p,x.appendChild(u),x.appendChild(f),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let n=this.getMap().getView();if(!n)return;let r=n.getZoom();if(r!==void 0){let s=n.getConstrainedZoom(r+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:s,duration:this.duration_,easing:Xl})):n.setZoom(s)}}},KV=YI;function fS(i){i=i||{};let e=new ho;return(i.zoom===void 0||i.zoom)&&e.push(new KV(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new ZV(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new YV(i.attributionOptions)),e}var ZI=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_}},QV=ZI;var KI={ACTIVE:"active"};var QI=class extends xs{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(KI.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(KI.ACTIVE,e)}setMap(e){this.map_=e}};function JV(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:KG,center:i.getConstrainedCenter(r)})}}function Bg(i,e,t,n){let r=i.getZoom();if(r===void 0)return;let s=i.getConstrainedZoom(r+e),o=i.getResolutionForZoom(s);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:o,anchor:t,duration:n!==void 0?n:250,easing:Xl})}var Nu=QI;var JI=class extends Nu{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==ir.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();Bg(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},eq=JI;function Wx(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 tq=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Vae=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)},dS=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?Vae(i):!0},nq=Qh;var pS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(jG&&AP&&e.ctrlKey)};var AS=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var iq=function(i){let e=i.originalEvent;return AP?e.metaKey:e.ctrlKey},rq=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},mS=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},gS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var sq=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var e5=class extends Nu{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==ir.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==ir.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==ir.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==ir.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 Ug(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 Lu=e5;var t5=class extends Lu{constructor(e){super({stopDown:Jh}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:Wx(AS,sq);this.condition_=e.onFocusOnly?Wx(dS,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(Ug(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();oG(s,a.getResolution()),ug(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){let t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:Xl})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){let n=e.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},oq=t5;var n5=class extends Lu{constructor(e){e=e||{},super({stopDown:Jh}),this.condition_=e.condition?e.condition:tq,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!gS(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===Fg)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 gS(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return gS(e)&&pS(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},aq=n5;var i5=class extends vd{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 wu([r])}getGeometry(){return this.geometry_}},lq=i5;var kg={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},iA=class extends Ys{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},r5=class extends Lu{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new lq(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??pS,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 iA(kg.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 iA(t?kg.BOXEND:kg.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 iA(kg.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new iA(kg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new iA(kg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},cq=r5;var s5=class extends cq{constructor(e){e=e||{};let t=e.condition?e.condition:rq;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){let n=this.getMap().getView(),r=this.getGeometry();if(this.out_){let s=n.rotatedExtentForGeometry(r),o=n.getResolutionForExtentInternal(s),a=n.getResolution()/o;r=r.clone(),r.scale(a*a)}n.fitInternal(r,{duration:this.duration_,easing:Xl})}},uq=s5;var Ld={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var o5=class extends Nu{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return AS(t)&&mS(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==Jt.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Ld.DOWN||r==Ld.LEFT||r==Ld.RIGHT||r==Ld.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Ld.DOWN?c=-a:r==Ld.LEFT?l=-a:r==Ld.RIGHT?l=a:c=a;let u=[l,c];ug(u,o.getRotation()),JV(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},hq=o5;var a5=class extends Nu{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!iq(t)&&mS(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==Jt.KEYDOWN||e.type==Jt.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==="+"||r==="-")){let s=e.map,o=r==="+"?this.delta_:-this.delta_,a=s.getView();Bg(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},fq=a5;var qae=40,Hae=300,Wae=3,l5=class extends Nu{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:nq;this.condition_=e.onFocusOnly?Wx(dS,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(e){if(this.ctrlKeyListenerKeys_.forEach(ii),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(kn(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),kn(t,"keyup",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==Jt.WHEEL)return!0;let n=e.map,r=e.originalEvent;r.preventDefault();let s=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let o=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=qae;break;case WheelEvent.DOM_DELTA_PAGE:o*=Hae;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*Wae),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;let c=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),c),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-xi(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),Bg(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)}},dq=l5;var c5=class extends Lu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Jh),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!==Fg&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Ug(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}},pq=c5;var u5=class extends Lu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Jh),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(Ug(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}},Aq=u5;function _S(i){i=i||{};let e=new ho,t=new QV(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new aq),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new eq({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new oq({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new pq),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new Aq({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new hq),e.push(new fq({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new dq({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new uq({duration:i.zoomDuration})),e}var Ei={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var h5=class extends xs{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Ei.OPACITY]=e.opacity!==void 0?e.opacity:1,Vn(typeof t[Ei.OPACITY]=="number","Layer opacity must be a number"),t[Ei.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ei.Z_INDEX]=e.zIndex,t[Ei.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ei.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ei.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ei.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=xi(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return Yn()}getLayerStatesArray(e){return Yn()}getExtent(){return this.get(Ei.EXTENT)}getMaxResolution(){return this.get(Ei.MAX_RESOLUTION)}getMinResolution(){return this.get(Ei.MIN_RESOLUTION)}getMinZoom(){return this.get(Ei.MIN_ZOOM)}getMaxZoom(){return this.get(Ei.MAX_ZOOM)}getOpacity(){return this.get(Ei.OPACITY)}getSourceState(){return Yn()}getVisible(){return this.get(Ei.VISIBLE)}getZIndex(){return this.get(Ei.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ei.EXTENT,e)}setMaxResolution(e){this.set(Ei.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ei.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ei.MAX_ZOOM,e)}setMinZoom(e){this.set(Ei.MIN_ZOOM,e)}setOpacity(e){Vn(typeof e=="number","Layer opacity must be a number"),this.set(Ei.OPACITY,e)}setVisible(e){this.set(Ei.VISIBLE,e)}setZIndex(e){this.set(Ei.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},xS=h5;var Dd={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Oc=class extends Ys{constructor(e,t){super(e),this.layer=t}},f5={LAYERS:"layers"},d5=class i extends xS{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(f5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new ho(n.slice(),{unique:!0}):Vn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new ho(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(ii),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(kn(e,Qs.ADD,this.handleLayersAdd_,this),kn(e,Qs.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(ii);yu(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 Oc(Dd.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[kn(e,Ic.PROPERTYCHANGE,this.handleLayerChange_,this),kn(e,Jt.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(kn(e,Dd.ADDLAYER,this.handleLayerGroupAdd_,this),kn(e,Dd.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ln(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Oc(Dd.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Oc(Dd.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Oc(Dd.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Ln(t);this.listenerKeys_[n].forEach(ii),delete this.listenerKeys_[n],this.dispatchEvent(new Oc(Dd.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(f5.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 Oc(Dd.REMOVELAYER,n[r]))}this.set(f5.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=gu(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},jx=d5;var po={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var p5=class extends xS{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Ei.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Ei.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(ii(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=kn(e,Jt.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),e instanceof 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 Xx(r,t.viewState)&&(!s||xr(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(Ei.MAP,e)}getMapInternal(){return this.get(Ei.MAP)}setMap(e){this.mapPrecomposeKey_&&(ii(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(ii(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=kn(e,po.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=kn(this,Jt.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);Vn(!t.some(r=>r.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(Ei.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function Xx(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 rA=p5;function yS(i,e,t=0,n=i.length-1,r=jae){for(;n>t;){if(n-t>600){let l=n-t+1,c=e-t+1,u=Math.log(l),f=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),x=Math.max(t,Math.floor(e-c*f/l+p)),v=Math.min(n,Math.floor(e+(l-c)*f/l+p));yS(i,e,x,v,r)}let s=i[e],o=t,a=n;for($x(i,t,e),r(i[n],s)>0&&$x(i,t,n);o<a;){for($x(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?$x(i,t,a):(a++,$x(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function $x(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function jae(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(!bS(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;bS(e,l)&&(t.leaf?n.push(a):m5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!bS(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(bS(e,o)){if(t.leaf||m5(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=zg([]),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=Xae(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&m5(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=zg(e.slice(t,n+1)),Gg(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=zg([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));mq(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);mq(e,u,f,l,this.compareMinY);for(let p=u;p<=f;p+=l){let x=Math.min(p+l-1,f);a.children.push(this._build(e,p,x,r-1))}}return Gg(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=A5(c),f=Zae(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),Zx(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=zg(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Gg(n,this.toBBox),Gg(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=zg([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Gg(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=Yx(e,0,a,this.toBBox),c=Yx(e,a,n,this.toBBox),u=Kae(l,c),f=A5(l)+A5(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:$ae,s=e.leaf?this.compareMinY:Yae,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=Yx(e,0,t,s),a=Yx(e,n-t,n,s),l=vS(o)+vS(a);for(let c=t;c<n-t;c++){let u=e.children[c];Zx(o,e.leaf?s(u):u),l+=vS(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];Zx(a,e.leaf?s(u):u),l+=vS(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)Zx(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():Gg(e[t],this.toBBox)}};function Xae(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 Gg(i,e){Yx(i,0,i.children.length,e,i)}function Yx(i,e,t,n,r){r||(r=zg(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];Zx(r,i.leaf?n(o):o)}return r}function Zx(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 $ae(i,e){return i.minX-e.minX}function Yae(i,e){return i.minY-e.minY}function A5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function vS(i){return i.maxX-i.minX+(i.maxY-i.minY)}function Zae(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 Kae(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 m5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function bS(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function zg(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function mq(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;yS(i,o,e,t,r),s.push(e,o,o,t)}}var aA=0,SS=0,Oo=1<<aA++,ri=1<<aA++,Bo=1<<aA++,oa=1<<aA++,hf=1<<aA++,oA=1<<aA++,TS=Math.pow(2,aA)-1,_5={[Oo]:"boolean",[ri]:"number",[Bo]:"string",[oa]:"color",[hf]:"number[]",[oA]:"size"},Qae=Object.keys(_5).map(Number).sort(ka);function Jae(i){return i in _5}function uf(i){let e=[];for(let t of Qae)Kx(i,t)&&e.push(_5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function Kx(i,e){return(i&e)===e}function wS(i,e){return!!(i&e)}function Fd(i,e){return i===e}var Pr=class{constructor(e,t){if(!Jae(e))throw new Error(`literal expressions must have a specific type, got ${uf(e)}`);this.type=e,this.value=t}},ES=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function MS(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function Xr(i,e,t){switch(typeof i){case"boolean":{if(Fd(e,Bo))return new Pr(Bo,i?"true":"false");if(!Kx(e,Oo))throw new Error(`got a boolean, but expected ${uf(e)}`);return new Pr(Oo,i)}case"number":{if(Fd(e,oA))return new Pr(oA,Wr(i));if(Fd(e,Oo))return new Pr(Oo,!!i);if(Fd(e,Bo))return new Pr(Bo,i.toString());if(!Kx(e,ri))throw new Error(`got a number, but expected ${uf(e)}`);return new Pr(ri,i)}case"string":{if(Fd(e,oa))return new Pr(oa,Dx(i));if(Fd(e,Oo))return new Pr(Oo,!!i);if(!Kx(e,Bo))throw new Error(`got a string, but expected ${uf(e)}`);return new Pr(Bo,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 hle(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Fd(e,oA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new Pr(oA,i)}if(Fd(e,oa)){if(i.length===3)return new Pr(oa,[...i,1]);if(i.length===4)return new Pr(oa,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!Kx(e,hf))throw new Error(`got an array of numbers, but expected ${uf(e)}`);return new Pr(hf,i)}var Je={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},ele={[Je.Get]:Fn(Zn(1,1/0),gq),[Je.Var]:tle(),[Je.Has]:Fn(Zn(1,1/0),gq),[Je.Id]:Fn(nle,Vg),[Je.Concat]:Fn(Zn(2,1/0),Gi(Bo)),[Je.GeometryType]:Fn(ile,Vg),[Je.LineMetric]:Fn(rle,Vg),[Je.Resolution]:Fn(g5,Vg),[Je.Zoom]:Fn(g5,Vg),[Je.Time]:Fn(g5,Vg),[Je.Any]:Fn(Zn(2,1/0),Gi(Oo)),[Je.All]:Fn(Zn(2,1/0),Gi(Oo)),[Je.Not]:Fn(Zn(1,1),Gi(Oo)),[Je.Equal]:Fn(Zn(2,2),xq()),[Je.NotEqual]:Fn(Zn(2,2),xq()),[Je.GreaterThan]:Fn(Zn(2,2),Gi(ri)),[Je.GreaterThanOrEqualTo]:Fn(Zn(2,2),Gi(ri)),[Je.LessThan]:Fn(Zn(2,2),Gi(ri)),[Je.LessThanOrEqualTo]:Fn(Zn(2,2),Gi(ri)),[Je.Multiply]:Fn(Zn(2,1/0),_q),[Je.Coalesce]:Fn(Zn(2,1/0),_q),[Je.Divide]:Fn(Zn(2,2),Gi(ri)),[Je.Add]:Fn(Zn(2,1/0),Gi(ri)),[Je.Subtract]:Fn(Zn(2,2),Gi(ri)),[Je.Clamp]:Fn(Zn(3,3),Gi(ri)),[Je.Mod]:Fn(Zn(2,2),Gi(ri)),[Je.Pow]:Fn(Zn(2,2),Gi(ri)),[Je.Abs]:Fn(Zn(1,1),Gi(ri)),[Je.Floor]:Fn(Zn(1,1),Gi(ri)),[Je.Ceil]:Fn(Zn(1,1),Gi(ri)),[Je.Round]:Fn(Zn(1,1),Gi(ri)),[Je.Sin]:Fn(Zn(1,1),Gi(ri)),[Je.Cos]:Fn(Zn(1,1),Gi(ri)),[Je.Atan]:Fn(Zn(1,2),Gi(ri)),[Je.Sqrt]:Fn(Zn(1,1),Gi(ri)),[Je.Match]:Fn(Zn(4,1/0),yq,ole),[Je.Between]:Fn(Zn(3,3),Gi(ri)),[Je.Interpolate]:Fn(Zn(6,1/0),yq,ale),[Je.Case]:Fn(Zn(3,1/0),sle,lle),[Je.In]:Fn(Zn(2,2),cle),[Je.Number]:Fn(Zn(1,1/0),Gi(TS)),[Je.String]:Fn(Zn(1,1/0),Gi(TS)),[Je.Array]:Fn(Zn(1,1/0),Gi(ri)),[Je.Color]:Fn(Zn(1,4),Gi(ri)),[Je.Band]:Fn(Zn(1,3),Gi(ri)),[Je.Palette]:Fn(Zn(2,2),ule),[Je.ToString]:Fn(Zn(1,1),Gi(Oo|ri|Bo|oa))};function gq(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 Pr(ri,o);break}case"string":{r[s]=new Pr(Bo,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 tle(){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=Xr(s,TS,t);if(!(o instanceof Pr))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&wS(r,oa)&&!wS(r,Bo)?a=oa:Array.isArray(s)&&s.length===2&&wS(r,oA)&&!wS(r,hf)&&(a=oA),r&=a,r===SS)throw new Error(`the type expected from the var operator (${uf(e)}) did not have any overlap with the type of the corresponding style variables (${uf(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===SS)throw new Error(`a new type expected from the var operator (${uf(e)}) did not have any overlap with the previous type expected for it (${uf(o)}), variable name: ${n}`)}return t.variables.set(n,r),new ES(r,"var",new Pr(Bo,n))}}function nle(i,e,t){t.featureId=!0}function ile(i,e,t){t.geometryType=!0}function rle(i,e,t){t.mCoordinate=!0}function g5(i,e,t){t.mapState=!0}function Vg(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Zn(i,e){return function(t,n,r){let s=t[0],o=t.length-1;if(i===e){if(o!==i){let a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${s}, got ${o}`)}}else if(o<i||o>e){let a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function _q(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=Xr(i[s+1],e,t);r[s]=o}return r}function Gi(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=Xr(e[o+1],i,n);s[o]=a}return s}}function xq(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=TS;for(let a=0;a<r;++a){let l=Xr(i[a+1],o,t);o&=l.type}if(o===SS)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=Xr(i[a+1],o,t);s[a]=l}return s}}function sle(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 yq(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 ole(i,e,t){let n=i.length-1,r=Xr(i[i.length-1],e,t),s=Bo|ri|Oo,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=Xr(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===SS)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=Xr(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=Xr(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[Xr(i[1],s,t),...o,r]}function ale(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 Pr(ri,r),o;try{o=Xr(i[2],ri,t)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}let a=new Array(i.length-3);for(let l=0;l<a.length;l+=2){try{let c=Xr(i[l+3],ri,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=Xr(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 lle(i,e,t){let n=Xr(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=Xr(i[s+1],Oo,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=Xr(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 cle(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=Bo:r=ri;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=Xr(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[Xr(i[1],r,t),...s]}function ule(i,e,t){let n;try{n=Xr(i[1],ri,t)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}let r=i[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");let s=new Array(r.length);for(let o=0;o<s.length;o++){let a;try{a=Xr(r[o],oa,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof Pr))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Fn(...i){return function(e,t,n){let r=e[0],s;for(let o=0;o<i.length;o++){let a=i[o](e,t,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new ES(t,r,...s)}}function hle(i,e,t){let n=i[0],r=ele[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function CS(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 CS(i.getGeometries()[0]);default:return""}}function x5(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Uc(i,e,t){let n=Xr(i,e,t);return Bc(n,t)}function Bc(i,e){if(i instanceof Pr){if(i.type===oa&&typeof i.value=="string"){let n=Dx(i.value);return function(){return n}}return function(){return i.value}}let t=i.operator;switch(t){case Je.Number:case Je.String:case Je.Coalesce:return fle(i,e);case Je.Get:case Je.Var:case Je.Has:return dle(i,e);case Je.Id:return n=>n.featureId;case Je.GeometryType:return n=>n.geometryType;case Je.Concat:{let n=i.args.map(r=>Bc(r,e));return r=>"".concat(...n.map(s=>s(r).toString()))}case Je.Resolution:return n=>n.resolution;case Je.Any:case Je.All:case Je.Between:case Je.In:case Je.Not:return Ale(i,e);case Je.Equal:case Je.NotEqual:case Je.LessThan:case Je.LessThanOrEqualTo:case Je.GreaterThan:case Je.GreaterThanOrEqualTo:return ple(i,e);case Je.Multiply:case Je.Divide:case Je.Add:case Je.Subtract:case Je.Clamp:case Je.Mod:case Je.Pow:case Je.Abs:case Je.Floor:case Je.Ceil:case Je.Round:case Je.Sin:case Je.Cos:case Je.Atan:case Je.Sqrt:return mle(i,e);case Je.Case:return gle(i,e);case Je.Match:return _le(i,e);case Je.Interpolate:return xle(i,e);case Je.ToString:return yle(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function fle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Bc(i.args[s],e);switch(t){case Je.Coalesce:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case Je.Number:case Je.String:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function dle(i,e){let n=i.args[0].value;switch(i.operator){case Je.Get:return r=>{let s=i.args,o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;o=o[u]}return o};case Je.Var:return r=>r.variables[n];case Je.Has:return r=>{let s=i.args;if(!(n in r.properties))return!1;let o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;if(!o||!Object.hasOwn(o,u))return!1;o=o[u]}return!0};default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function ple(i,e){let t=i.operator,n=Bc(i.args[0],e),r=Bc(i.args[1],e);switch(t){case Je.Equal:return s=>n(s)===r(s);case Je.NotEqual:return s=>n(s)!==r(s);case Je.LessThan:return s=>n(s)<r(s);case Je.LessThanOrEqualTo:return s=>n(s)<=r(s);case Je.GreaterThan:return s=>n(s)>r(s);case Je.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function Ale(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Bc(i.args[s],e);switch(t){case Je.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case Je.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case Je.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case Je.In:return s=>{let o=r[0](s);for(let a=1;a<n;++a)if(o===r[a](s))return!0;return!1};case Je.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function mle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Bc(i.args[s],e);switch(t){case Je.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case Je.Divide:return s=>r[0](s)/r[1](s);case Je.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case Je.Subtract:return s=>r[0](s)-r[1](s);case Je.Clamp:return s=>{let o=r[0](s),a=r[1](s);if(o<a)return a;let l=r[2](s);return o>l?l:o};case Je.Mod:return s=>r[0](s)%r[1](s);case Je.Pow:return s=>Math.pow(r[0](s),r[1](s));case Je.Abs:return s=>Math.abs(r[0](s));case Je.Floor:return s=>Math.floor(r[0](s));case Je.Ceil:return s=>Math.ceil(r[0](s));case Je.Round:return s=>Math.round(r[0](s));case Je.Sin:return s=>Math.sin(r[0](s));case Je.Cos:return s=>Math.cos(r[0](s));case Je.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case Je.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function gle(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Bc(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 _le(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Bc(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 xle(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Bc(i.args[r],e);return r=>{let s=n[0](r),o=n[1](r),a,l;for(let c=2;c<t;c+=2){let u=n[c](r),f=n[c+1](r),p=Array.isArray(f);if(p&&(f=Xz(f)),u>=o)return c===2?f:p?vle(s,o,a,l,u,f):Qx(s,o,a,l,u,f);a=u,l=f}return l}}function yle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Bc(i.args[s],e);if(t===Je.ToString)return s=>{let o=r[0](s);return i.args[0].type===oa?Fx(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function Qx(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 vle(i,e,t,n,r,s){if(r-t===0)return n;let a=oI(n),l=oI(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[Qx(i,e,t,a[0],r,l[0]),Qx(i,e,t,a[1],r,l[1]),a[2]+Qx(i,e,t,0,r,c),Qx(i,e,t,n[3],r,s[3])];return $z(u)}function ble(i){return!0}function wle(i,e){e=e??MS();let t=Sle(i,e),n=x5();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=CS(r.getGeometry())),t(n)}}function vq(i,e){e=e??MS();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=y5(i[o],e);let r=x5(),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=CS(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 Tq(i,e){if(e=e??MS(),!Array.isArray(i))return vq([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 wle(s,e)}return vq(i,e)}function Sle(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?Uc(s.filter,Oo,e):ble,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=y5(s.style[c],e)}else a=[y5(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 y5(i,e){let t=Jx(i,"",e),n=ey(i,"",e),r=Tle(i,e),s=Ele(i,e),o=Ao(i,"z-index",e);if(!t&&!n&&!r&&!s&&!Ec(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new Us;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 Jx(i,e,t){let n;if(e+"fill-pattern-src"in i)n=Ple(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=PS(i,e+"fill-color",t)}if(!n)return null;let r=new jr;return function(s){let o=n(s);return o===Kw?null:(r.setColor(o),r)}}function ey(i,e,t){let n=Ao(i,e+"stroke-width",t),r=PS(i,e+"stroke-color",t);if(!n&&!r)return null;let s=ff(i,e+"stroke-line-cap",t),o=ff(i,e+"stroke-line-join",t),a=Eq(i,e+"stroke-line-dash",t),l=Ao(i,e+"stroke-line-dash-offset",t),c=Ao(i,e+"stroke-miter-limit",t),u=Ao(i,e+"stroke-offset",t),f=new Ks;return function(p){if(r){let x=r(p);if(x===Kw)return null;f.setColor(x)}if(n&&f.setWidth(n(p)),s){let x=s(p);if(x!=="butt"&&x!=="round"&&x!=="square")throw new Error("Expected butt, round, or square line cap");f.setLineCap(x)}if(o){let x=o(p);if(x!=="bevel"&&x!=="round"&&x!=="miter")throw new Error("Expected bevel, round, or miter line join");f.setLineJoin(x)}return a&&f.setLineDash(a(p)),l&&f.setLineDashOffset(l(p)),c&&f.setMiterLimit(c(p)),u&&f.setOffset(u(p)),f}}function Tle(i,e){let t="text-",n=ff(i,t+"value",e);if(!n)return null;let r=Jx(i,t,e),s=Jx(i,t+"background-",e),o=ey(i,t,e),a=ey(i,t+"background-",e),l=ff(i,t+"font",e),c=Ao(i,t+"max-angle",e),u=Ao(i,t+"offset-x",e),f=Ao(i,t+"offset-y",e),p=qg(i,t+"overflow",e),x=ff(i,t+"placement",e),v=Ao(i,t+"repeat",e),w=IS(i,t+"scale",e),S=qg(i,t+"rotate-with-view",e),T=Ao(i,t+"rotation",e),P=ff(i,t+"align",e),R=ff(i,t+"justify",e),C=ff(i,t+"baseline",e),L=qg(i,t+"keep-upright",e),D=Eq(i,t+"padding",e),F=NS(i,t+"declutter-mode"),N=new lf({declutterMode:F});return function(B){if(N.setText(n(B)),r&&N.setFill(r(B)),s&&N.setBackgroundFill(s(B)),o&&N.setStroke(o(B)),a&&N.setBackgroundStroke(a(B)),l&&N.setFont(l(B)),c&&N.setMaxAngle(c(B)),u&&N.setOffsetX(u(B)),f&&N.setOffsetY(f(B)),p&&N.setOverflow(p(B)),x){let z=x(B);if(z!=="point"&&z!=="line")throw new Error("Expected point or line for text-placement");N.setPlacement(z)}if(v&&N.setRepeat(v(B)),w&&N.setScale(w(B)),S&&N.setRotateWithView(S(B)),T&&N.setRotation(T(B)),P){let z=P(B);if(z!=="left"&&z!=="center"&&z!=="right"&&z!=="end"&&z!=="start")throw new Error("Expected left, right, center, start, or end for text-align");N.setTextAlign(z)}if(R){let z=R(B);if(z!=="left"&&z!=="right"&&z!=="center")throw new Error("Expected left, right, or center for text-justify");N.setJustify(z)}if(C){let z=C(B);if(z!=="bottom"&&z!=="top"&&z!=="middle"&&z!=="alphabetic"&&z!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");N.setTextBaseline(z)}return D&&N.setPadding(D(B)),L&&N.setKeepUpright(L(B)),N}}function Ele(i,e){return"icon-src"in i?Mle(i,e):"shape-points"in i?Cle(i,e):"circle-radius"in i?Rle(i,e):null}function Mle(i,e){let t="icon-",n=t+"src",r=Mq(i[n],n),s=RS(i,t+"anchor",e),o=IS(i,t+"scale",e),a=Ao(i,t+"opacity",e),l=RS(i,t+"displacement",e),c=Ao(i,t+"rotation",e),u=qg(i,t+"rotate-with-view",e),f=wq(i,t+"anchor-origin"),p=Sq(i,t+"anchor-x-units"),x=Sq(i,t+"anchor-y-units"),v=df(i,t+"color"),w,S=null;v!==void 0&&(Array.isArray(v)&&v.length>0&&typeof v[0]=="string"?S=PS(i,t+"color",e):w=Cq(v,t+"color"));let T=Nle(i,t+"cross-origin"),P=Lle(i,t+"offset"),R=wq(i,t+"offset-origin"),C=v5(i,t+"width"),L=v5(i,t+"height"),D=Ile(i,t+"size"),F=NS(i,t+"declutter-mode"),N={src:r,anchorOrigin:f,anchorXUnits:p,anchorYUnits:x,crossOrigin:T,offset:P,offsetOrigin:R,height:L,width:C,size:D,declutterMode:F},B=null;return function(z){if(B)S&&B.setColor(S(z));else{let V=S?S(z):w;B=new eA(V!==void 0?Object.assign({},N,{color:V}):Object.assign({},N))}return a&&B.setOpacity(a(z)),l&&B.setDisplacement(l(z)),c&&B.setRotation(c(z)),u&&B.setRotateWithView(u(z)),o&&B.setScale(o(z)),s&&B.setAnchor(s(z)),B}}function Cle(i,e){let t="shape-",n=t+"points",r=t+"radius",s=b5(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=Ao(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=Ao(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=Jx(i,t,e),p=ey(i,t,e),x=IS(i,t+"scale",e),v=RS(i,t+"displacement",e),w=Ao(i,t+"rotation",e),S=qg(i,t+"rotate-with-view",e),T=v5(i,t+"angle"),P=NS(i,t+"declutter-mode"),R=new iS({points:s,radius:a,radius2:u,angle:T,declutterMode:P});return function(C){return o&&R.setRadius(o(C)),c&&R.setRadius2(c(C)),f&&R.setFill(f(C)),p&&R.setStroke(p(C)),v&&R.setDisplacement(v(C)),w&&R.setRotation(w(C)),S&&R.setRotateWithView(S(C)),x&&R.setScale(x(C)),R}}function Rle(i,e){let t="circle-",n=Jx(i,t,e),r=ey(i,t,e),s=Ao(i,t+"radius",e),o=IS(i,t+"scale",e),a=RS(i,t+"displacement",e),l=Ao(i,t+"rotation",e),c=qg(i,t+"rotate-with-view",e),u=NS(i,t+"declutter-mode"),f=new rS({radius:5,declutterMode:u});return function(p){return s&&f.setRadius(s(p)),n&&f.setFill(n(p)),r&&f.setStroke(r(p)),a&&f.setDisplacement(a(p)),l&&f.setRotation(l(p)),c&&f.setRotateWithView(c(p)),o&&f.setScale(o(p)),f}}function df(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function Ao(i,e,t){let n=df(i,e);if(n===void 0)return;let r=Uc(n,ri,t);return function(s){return b5(r(s),e)}}function ff(i,e,t){let n=df(i,e);if(n===void 0)return null;let r=Uc(n,Bo,t);return function(s){return Mq(r(s),e)}}function Ple(i,e,t){let n=ff(i,e+"pattern-src",t),r=bq(i,e+"pattern-offset",t),s=bq(i,e+"pattern-size",t),o=PS(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function qg(i,e,t){let n=df(i,e);if(n===void 0)return null;let r=Uc(n,Oo,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function PS(i,e,t){let n=df(i,e);if(n===void 0)return null;let r=Uc(n,oa,t);return function(s){return Cq(r(s),e)}}function Eq(i,e,t){let n=df(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=Uc(o,ri,t);return function(c){return b5(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=Uc(n,hf,t);return function(s){return ty(r(s),e)}}function RS(i,e,t){let n=df(i,e);if(n===void 0)return null;let r=Uc(n,hf,t);return function(s){let o=ty(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function bq(i,e,t){let n=df(i,e);if(n===void 0)return null;let r=Uc(n,hf,t);return function(s){return Rq(r(s),e)}}function IS(i,e,t){let n=df(i,e);if(n===void 0)return null;let r=Uc(n,hf|ri,t);return function(s){return Dle(r(s),e)}}function v5(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 Ile(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return Wr(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 Nle(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 wq(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 Sq(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 Lle(i,e){let t=i[e];if(t!==void 0)return ty(t,e)}function NS(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 ty(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 Mq(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function b5(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function Cq(i,e){if(typeof i=="string")return i;let t=ty(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 Rq(i,e){let t=ty(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function Dle(i,e){return typeof i=="number"?i:Rq(i,e)}var Pq={RENDER_ORDER:"renderOrder"},w5=class extends rA{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(Pq.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(Pq.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?xI:e;let t=Fle(e);this.styleFunction_=e===null?void 0:oV(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function Fle(i){if(i===void 0)return xI;if(!i)return null;if(typeof i=="function"||i instanceof Us)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof Us){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof Us))throw new Error("Expected a list of style instances");n[r]=s}return n}return Tq(i)}var LS=w5;var S5=class extends Ys{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},DS=S5;var T5=class extends vd{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){Yn()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;uo(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Nw(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let c,u=t.viewState;function f(C,L,D,F){return s.call(o,L,C?D:null,F)}let p=u.projection,x=pw(e.slice(),p),v=[[0,0]];if(p.canWrapX()&&r){let C=p.getExtent(),L=jn(C);v.push([-L,0],[L,0])}let w=t.layerStatesArray,S=w.length,T=[],P=[];for(let C=0;C<v.length;C++)for(let L=S-1;L>=0;--L){let D=w[L],F=D.layer;if(F.hasRenderer()&&Xx(D,u)&&a.call(l,F)){let N=F.getRenderer(),B=F.getSource();if(N&&B){let z=B.getWrapX()?x:e,V=f.bind(null,D.managed);P[0]=z[0]+v[C][0],P[1]=z[1]+v[C][1],c=N.forEachFeatureAtCoordinate(P,t,n,V,T)}if(c)return c}}if(T.length===0)return;let R=1/T.length;return T.forEach((C,L)=>C.distanceSq+=L*R),T.sort((C,L)=>C.distanceSq-L.distanceSq),T.some(C=>c=C.callback(C.feature,C.layer,C.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,Qh,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){Yn()}scheduleExpireIconCache(e){Do.canExpireCache()&&e.postRenderFunctions.push(Ole)}};function Ole(i,e){Do.expire()}var Iq=T5;var E5=class extends Iq{constructor(e){super(e),this.fontChangeListenerKey_=kn(Q0,Ic.PROPERTYCHANGE,e.redrawText,e),this.element_=Fs?Rw():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Pd+" 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 DS(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){ii(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(po.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof LS&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;ul(o)&&(a=o.getContext("2d"),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,o.width,o.height));let l=[],c=a?o:null;for(let u=0,f=t.length;u<f;++u){let p=t[u];e.layerIndex=u;let x=p.layer,v=x.getSourceState();if(!Xx(p,r)||v!="ready"&&v!="undefined"){x.unrender();continue}let w=x.render(e,c);w&&(w!==c&&(this.children_.push(w),c=w),l.push(p))}this.declutter(e,l),JG(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,p=u.style.backgroundColor;if(p&&(!ul(f)||f.width>0)&&(a.fillStyle=p,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!ul(f)||f.width===0)continue;a.save();let x=u.style.opacity||f.style.opacity;a.globalAlpha=x===""?1:Number(x);let v=f.style.transform;if(v)a.transform(...Iw(v));else{let w=parseFloat(f.style.width)/f.width,S=parseFloat(f.style.height)/f.height;a.transform(w,0,0,S,0,0)}a.drawImage(f,0,0),a.restore()}this.dispatchRenderEvent(po.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))}}},Nq=E5;function Lq(i){if(i instanceof rA){i.setMapInternal(null);return}i instanceof jx&&i.getLayers().forEach(Lq)}function Dq(i,e){if(i instanceof rA){i.setMapInternal(e);return}if(i instanceof jx){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)Dq(t[n],e)}}var M5=class extends xs{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=Ble(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:XG,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Zs(),this.pixelToCoordinateTransform_=Zs(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Fs||(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,Fs||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(Fs?new ho:fS()),this.interactions=t.interactions||(Fs?new ho:_S({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new VV(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(Qs.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(Qs.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(Qs.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(Qs.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(Qs.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(Qs.REMOVE,r=>{let s=r.element.getId();s!==void 0&&delete this.overlayIdIndex_[s.toString()],r.element.setMap(null)}),this.controls.forEach(r=>{r.setMap(this)}),this.interactions.forEach(r=>{r.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){Dq(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:Qh,a=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,s,a,t,null,o,null)}getFeaturesAtPixel(e,t){let n=[];return this.forEachFeatureAtPixel(e,function(r){n.push(r)},t),n}getAllLayers(){let e=[];function t(n){n.forEach(function(r){r instanceof jx?t(r.getLayers()):e.push(r)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;let n=this.getCoordinateFromPixelInternal(e);t=t!==void 0?t:{};let r=t.layerFilter!==void 0?t.layerFilter:Qh,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 yx(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Rr(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 ho){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){let e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){let r=e[t];if(!r.visible)continue;let s=r.layer.getRenderer();if(s&&!s.ready)return!0;let o=r.layer.getSource();if(o&&o.loading)return!0}return!1}getPixelFromCoordinate(e){let t=Cc(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Rr(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 qV(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new Pu(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===qx.POINTERDOWN||n===Jt.WHEEL||n===Jt.KEYDOWN){let r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=t.target,a=s instanceof ShadowRoot?s.host===o?s.host.ownerDocument:s:s===r?r.documentElement:s;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){let r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){let o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let r=this.maxTilesLoading_,s=r,o=e?e.viewHints:void 0,a=o?o[ks.ANIMATING]||o[ks.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(po.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(po.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Nd(Iu.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Nd(Iu.LOADSTART,this,e))));let n=this.postRenderFunctions_;if(e)for(let r=0,s=n.length;r<s;++r)n[r](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let n=0,r=this.targetChangeHandlerKeys_.length;n<r;++n)ii(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!ul(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(ul(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Nq(this)),!ul(t)){this.mapBrowserEventHandler_=new GV(this,this.moveTolerance_);for(let r in ir)this.mapBrowserEventHandler_.addEventListener(ir[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_,Cw?{passive:!1}:!1);let n;if(this.keyboardEventTarget_)n=this.keyboardEventTarget_;else{let r=t.getRootNode();n=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[kn(n,Jt.KEYDOWN,this.handleBrowserEvent,this),kn(n,Jt.KEYPRESS,this.handleBrowserEvent,this)],!ul(t)){let r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(ii(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(ii(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=kn(e,Ic.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=kn(e,Jt.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(ii),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Oc("addlayer",e)),this.layerGroupPropertyListenerKeys_=[kn(e,Ic.PROPERTYCHANGE,this.render,this),kn(e,Jt.CHANGE,this.render,this),kn(e,"addlayer",this.handleLayerAdd_,this),kn(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;let e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){let r=e[t].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){Lq(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&&lP(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:mx(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:Ln(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=mx(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_||!_u(this.previousExtent_)&&!B0(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Nd(Iu.MOVESTART,this,r)),this.previousExtent_=O0(this.previousExtent_)),this.previousExtent_&&!s.viewHints[ks.ANIMATING]&&!s.viewHints[ks.INTERACTING]&&!B0(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Nd(Iu.MOVEEND,this,s)),ow(s.extent,this.previousExtent_))),this.dispatchEvent(new Nd(Iu.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Iu.LOADSTART)||this.hasListener(Iu.LOADEND)||this.hasListener(po.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 Oc("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(ul(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)],!lP(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&hw("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!Lo(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function Ble(i){let e=null;i.keyboardEventTarget!==void 0&&(e=typeof i.keyboardEventTarget=="string"?document.getElementById(i.keyboardEventTarget):i.keyboardEventTarget);let t={},n=i.layers&&typeof i.layers.getLayers=="function"?i.layers:new jx({layers:i.layers});t[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 ho(i.controls.slice()):(Vn(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=i.controls));let s;i.interactions!==void 0&&(Array.isArray(i.interactions)?s=new ho(i.interactions.slice()):(Vn(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new ho(i.overlays.slice()):(Vn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new ho,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var Fq=M5;function FS(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var Ule=new Error("disposed");var kle=[256,256],C5=class extends bg{constructor(e){let t=rn.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;let e=FS(this.data_);return e?[e.width,e.height]:kle}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==rn.IDLE&&this.state!==rn.ERROR)return;this.state=rn.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=rn.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=rn.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(Ule),this.controller_=null),super.disposeInternal()}},R5=C5;var P5=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 vd&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return Vn(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){let t=this.entries_[e];return Vn(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){Vn(!(e in this.entries_),"Tried to set a value for a key that is used already");let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}},I5=P5;var N5=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(wx(),{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}},OS=N5;var Gle=5,L5=class extends Dw{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=Gle,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 Yn()}getData(e){return null}prepareFrame(e){return Yn()}renderFrame(e,t){return Yn()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Mn.LOADED||t.getState()===Mn.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Mn.LOADED&&t!=Mn.ERROR&&e.addEventListener(Jt.CHANGE,this.boundHandleImageChange_),t==Mn.IDLE&&(e.load(),t=e.getState()),t==Mn.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},Oq=L5;var F5=[],Hg=null;function zle(){Hg=Ti(1,1,void 0,{willReadFrequently:!0})}var D5=class extends Oq{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Zs(),this.pixelTransform=Zs(),this.inversePixelTransform=Zs(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){Hg||zle(),Hg.clearRect(0,0,1,1);let r;try{Hg.drawImage(e,t,n,1,1,0,0,1,1),r=Hg.getImageData(0,0,1,1).data}catch{return Hg=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(ul(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&&Lo(Yl(e.style.backgroundColor),Yl(n)))){let c=e.firstElementChild;ul(c)&&(l=c.getContext("2d"))}if(l&&oz(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=Fs?Rw():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Ti();let u=l.canvas;a.appendChild(u),c=u.style,c.position="absolute",c.left="0",c.transformOrigin="top left",this.container=a,this.context=l}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=Wl(n),s=cg(n),o=lg(n),a=ag(n);Rr(t.coordinateToPixelTransform,r),Rr(t.coordinateToPixelTransform,s),Rr(t.coordinateToPixelTransform,o),Rr(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;Rr(l,r),Rr(l,s),Rr(l,o),Rr(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,s=e.viewState.rotation,o=e.pixelRatio,a=Math.round(jn(n)/r*o),l=Math.round(_r(n)/r*o);uo(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),Nw(this.inversePixelTransform,this.pixelTransform);let c=sz(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 DS(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(po.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(po.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new OS),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(po.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(po.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){let l=s/2,c=o/2,u=r/t,f=-u,p=-e[0]+a,x=-e[1];return uo(this.tempTransform,l,c,u,f,-n,p,x)}disposeInternal(){delete this.frameState,super.disposeInternal()}},BS=D5;function O5(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 Vle(i,e,t){let n=i[t];return n?n.delete(e):!1}function Bq(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=gu(e,Rc(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=gu(e,r))}return e}var B5=class extends BS{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=Cr(),this.tempTileRange_=new ww(0,0,0,0),this.tempTileCoord_=_g(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new I5(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new I5(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=xg(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||Ag(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=Rr(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!wc(s,r))return null;let o=t.viewState,a=n.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(t.pixelRatio);for(let u=l.getZForResolution(o.resolution);u>=l.getMinZoom();--u){let f=l.getTileCoordForCoordAndZ(r,u),p=this.getTile(u,f[1],f[2],t);if(!p||p.getState()!==rn.LOADED)continue;let x=l.getOrigin(u),v=Wr(l.getTileSize(u)),w=l.getResolution(u),S;if(p instanceof Pw||p instanceof Lw)S=p.getImage();else if(p instanceof R5){if(S=FS(p.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-x[0])/w-f[1]*v[0])),P=Math.floor(c*((x[1]-r[1])/w-f[2]*v[1])),R=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+R,P+R)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;let t=this.getLayer().getSource();if(!t)return!1;let n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,s){let o=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),u=Ln(l);u in e.wantedTiles||(e.wantedTiles[u]={});let f=e.wantedTiles[u],p=a.getMapInternal(),x=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),p?p.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),v=o.rotation,w=v?X4(o.center,o.resolution,v,e.size):void 0;for(let S=n;S>=x;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),P=c.getResolution(S);for(let R=T.minX;R<=T.maxX;++R)for(let C=T.minY;C<=T.maxY;++C){if(v&&!c.tileCoordIntersectsViewport([S,R,C],w))continue;let L=this.getTile(S,R,C,e);if(!L||!O5(r,L,S))continue;let F=L.getKey();if(f[F]=!0,L.getState()===rn.IDLE&&!e.tileQueue.isKeyQueued(F)){let N=_g(S,R,C,this.tempTileCoord_);e.tileQueue.enqueue([L,u,c.getTileCoordCenter(N),P])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],s=e[1],o=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){let c=xg(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){let u=n.peek(c);if(u.getState()===rn.LOADED)return u.endTransition(Ln(this)),O5(t,u,r),!0}}return!1}findAltTiles_(e,t,n,r){let s=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!s)return!1;let o=!0,a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let u=s.minX;u<=s.maxX;++u)for(let f=s.minY;f<=s.maxY;++f){let p=xg(l,c,n,u,f),x=!1;if(a.containsKey(p)){let v=a.peek(p);v.getState()===rn.LOADED&&(O5(r,v,n),x=!0)}x||(o=!1)}return o}renderFrame(e,t){this.renderComplete=!0;let n=e.layerStatesArray[e.layerIndex],r=e.viewState,s=r.projection,o=r.resolution,a=r.center,l=e.pixelRatio,c=this.getLayer(),u=c.getSource(),f=u.getTileGridForProjection(s),p=f.getZForResolution(o,u.zDirection),x=f.getResolution(p);this.updateStaleKeys(u.getKey());let v=e.extent,w=u.getTilePixelRatio(l);this.prepareContainer(e,t);let S=this.context.canvas.width,T=this.context.canvas.height;this.layerExtent=n.extent?Rc(n.extent,s):null,this.layerExtent&&(v=gu(v,this.layerExtent));let P=x*S/2/w,R=x*T/2/w,C=[a[0]-P,a[1]-R,a[0]+P,a[1]+R],L={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let K=f.getZForResolution(r.nextResolution,u.zDirection),ee=Bq(e,e.nextExtent);this.enqueueTiles(e,ee,K,L,D)}let F=Bq(e,v);if(this.enqueueTiles(e,F,p,L,0),D>0&&setTimeout(()=>{this.enqueueTiles(e,F,p-1,L,D-1)},0),!(p in L))return this.container;let N=Ln(this),B=e.time;for(let K of L[p]){let ee=K.getState();if(ee===rn.EMPTY)continue;let ae=K.tileCoord;if(ee===rn.LOADED&&K.getAlpha(N,B)===1){K.endTransition(N);continue}if(ee!==rn.ERROR&&(this.renderComplete=!1),this.findStaleTile_(ae,L)){Vle(L,K,p),e.animate=!0;continue}if(this.findAltTiles_(f,ae,p+1,L))continue;let ve=f.getMinZoom();for(let Ie=p-1;Ie>=ve&&!this.findAltTiles_(f,ae,Ie,L);--Ie);}let z=x/o*l/w,V=this.getRenderContext(e);uo(this.tempTransform,S/2,T/2,z,z,0,-S/2,-T/2),this.layerExtent&&this.clipUnrotated(V,e,this.layerExtent),u.getInterpolate()||(V.imageSmoothingEnabled=!1),this.preRender(V,e);let H=Object.keys(L).map(Number);H.sort(ka);let Z=[],J=[],j=[];for(let K=H.length-1;K>=0;--K){let ee=H[K],ae=u.getTilePixelSize(ee,l,s),de=f.getResolution(ee)/x,ve=ae[0]*de*z,Ie=ae[1]*de*z,Qe=f.getTileCoordForCoordAndZ(Wl(C),ee),Ue=f.getTileCoordExtent(Qe),mt=Rr(this.tempTransform,[w*(Ue[0]-C[0])/x,w*(C[3]-Ue[3])/x]),Me=w*u.getGutterForProjection(s);for(let ze of L[ee]){if(ze.getState()!==rn.LOADED)continue;let $e=ze.tileCoord,Et=Qe[1]-$e[1],Tt=Math.round(mt[0]-(Et-1)*ve),Ct=Qe[2]-$e[2],un=Math.round(mt[1]-(Ct-1)*Ie),Gt=Math.round(mt[0]-Et*ve),Xe=Math.round(mt[1]-Ct*Ie),st=Tt-Gt,tt=un-Xe,vt=ee===p;if(vt&&ze.inTransition(N)){j.push({tile:ze,x:Gt,y:Xe,w:st,h:tt,gutter:Me}),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze);continue}let yt=[Gt,Xe,Gt+st,Xe+tt],ln=[];for(let Qt=0,xn=Z.length;Qt<xn;++Qt)ee<J[Qt]&&xr(yt,Z[Qt])&&ln.push(Z[Qt]);let Kt;ln.length>0&&(Kt=tG(yt,ln)),Z.push(yt),J.push(ee),this.drawTile(ze,e,Gt,Xe,st,tt,Me,vt,Kt),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze)}}for(let K=0,ee=j.length;K<ee;++K){let{tile:ae,x:ce,y:de,w:ve,h:Ie,gutter:Qe}=j[K];this.drawTile(ae,e,ce,de,ve,Ie,Qe,!0,void 0)}if(this.renderedResolution=x,this.extentChanged=!this.renderedExtent_||!B0(this.renderedExtent_,C),this.renderedExtent_=C,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&V.restore(),V.imageSmoothingEnabled=!0,this.renderComplete){let K=(ee,ae)=>{let ce=Ln(u),de=ae.wantedTiles[ce],ve=de?Object.keys(de).length:0;this.updateCacheSize(ve),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push(K)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,s,o,a,l,c){let u;if(e instanceof R5){if(u=FS(e.getData()),!u)throw new Error("Rendering array data is not yet supported")}else u=this.getTileImage(e);if(!u)return;let f=this.getRenderContext(t),p=Ln(this),x=t.layerStatesArray[t.layerIndex],v=x.opacity*(l?e.getAlpha(p,t.time):1),w=v!==f.globalAlpha;w&&(f.save(),f.globalAlpha=v);let S=u.width-2*a,T=u.height-2*a;if(c){let P=S/s,R=T/o;for(let C=0,L=c.length;C<L;++C){let D=c[C],F=D[0],N=D[1],B=D[2]-D[0],z=D[3]-D[1];f.drawImage(u,a+(F-n)*P,a+(N-r)*R,B*P,z*R,F,N,B,z)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),v!==x.opacity?t.animate=!0:l&&e.endTransition(p)}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=Ln(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},Uq=B5;var ny={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var U5=class extends rA{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(ny.PRELOAD)}setPreload(e){this.set(ny.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(ny.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(ny.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},kq=U5;var k5=class extends kq{constructor(e){super(e)}createRenderer(){return new Uq(this,{cacheSize:this.getCacheSize()})}},G5=k5;var z5=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){}},US=z5;var iy={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},ry=[iy.FILL],Du=[iy.STROKE],pf=[iy.BEGIN_PATH],V5=[iy.CLOSE_PATH],An=iy;var q5=class extends US{constructor(e,t,n,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){let t=this.pixelRatio;return t==1?e:e.map(function(n){return n*t})}appendFlatPointCoordinates(e,t){let n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,s=this.coordinates,o=s.length;for(let a=0,l=e.length;a<l;a+=t)r[0]=e[a],r[1]=e[a+1],wc(n,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(e,t,n,r,s,o){let a=this.coordinates,l=a.length,c=this.getBufferedMaxExtent();o&&(t+=r);let u=e[t],f=e[t+1],p=this.tmpCoordinate_,x=!0,v,w,S;for(v=t+r;v<n;v+=r)p[0]=e[v],p[1]=e[v+1],S=sw(c,p),S!==w?(x&&(a[l++]=u,a[l++]=f,x=!1),a[l++]=p[0],a[l++]=p[1]):S===gs.INTERSECTING?(a[l++]=p[0],a[l++]=p[1],x=!1):x=!0,u=p[0],f=p[1],w=S;return(s&&x||v===t+r)&&(a[l++]=u,a[l++]=f),l}drawCustomCoordinates_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o){let l=n[o],c=this.appendFlatLineCoordinates(e,t,l,r,!1,!1);s.push(c),t=l}return t}drawCustom(e,t,n,r,s){this.beginGeometry(e,t,s);let o=e.getType(),a=e.getStride(),l=this.coordinates.length,c,u,f,p,x;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),p=[];let v=e.getEndss();x=0;for(let w=0,S=v.length;w<S;++w){let T=[];x=this.drawCustomCoordinates_(c,x,v[w],a,T),p.push(T)}this.instructions.push([An.CUSTOM,l,p,e,n,Tx,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,p,e,r||n,Tx,s]);break;case"Polygon":case"MultiLineString":f=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),x=this.drawCustomCoordinates_(c,0,e.getEnds(),a,f),this.instructions.push([An.CUSTOM,l,f,e,n,Eg,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,f,e,r||n,Eg,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([An.CUSTOM,l,u,e,n,bu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,bu,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([An.CUSTOM,l,u,e,n,bu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,bu,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),u=this.coordinates.length,this.instructions.push([An.CUSTOM,l,u,e,n,void 0,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,void 0,s]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[An.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[An.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,s,o=-1;for(t=0;t<n;++t)r=e[t],s=r[0],s==An.END_GEOMETRY?o=t:s==An.BEGIN_GEOMETRY&&(r[2]=t,LG(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=za(n||Bs)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=za(n||Fo);let r=e.getLineCap();t.lineCap=r!==void 0?r:Cu;let s=e.getLineDash();t.lineDash=s?s.slice():Va;let o=e.getLineDashOffset();t.lineDashOffset=o||qa;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:Ru;let l=e.getWidth();t.lineWidth=l!==void 0?l:af;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:sf;let u=e.getOffset();t.strokeOffset=u??Qz,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[An.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[An.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(n!==void 0&&typeof n!="string"||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,c=e.miterLimit,u=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||s!=e.currentLineDash&&!Lo(e.currentLineDash,s)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=c||e.currentStrokeOffset!=u)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=s,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=c,e.currentStrokeOffset=u)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[An.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=ow(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;sg(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Fu=q5;var H5=class extends Fu{constructor(e,t,n,r){super(e,t,n,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,n){if(!this.image_||this.maxExtent&&!wc(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=e.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([An.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([An.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=[];for(let l=0,c=r.length;l<c;l+=e.getStride())(!this.maxExtent||wc(this.maxExtent,r.slice(l,l+2)))&&s.push(r[l],r[l+1]);let o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,2);this.instructions.push([An.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([An.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){let n=e.getAnchor(),r=e.getSize(),s=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},Gq=H5;var W5=class extends Fu{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r,s){let o=this.coordinates.length,a=this.appendFlatLineCoordinates(e,t,n,r,!1,!1);return this.instructions.push([An.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([An.MOVE_TO_LINE_TO,o,a,s]),n}drawLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Fo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Va,qa],pf);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Du),this.endGeometry(t)}drawMultiLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Fo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Va,qa],pf);let l=e.getEnds(),c=e.getFlatCoordinates(),u=e.getStride(),f=0;for(let p=0,x=l.length;p<x;++p)f=this.drawFlatCoordinates_(c,f,l[p],u,a);this.hitDetectionInstructions.push(Du),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Du),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Du),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(pf)}},zq=W5;var j5=class extends Fu{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(pf),this.hitDetectionInstructions.push(pf);for(let u=0;u<c;++u){let f=n[u],p=this.coordinates.length,x=this.appendFlatLineCoordinates(e,t,f,r,!0,!l);this.instructions.push([An.MOVE_TO_LINE_TO,p,x,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([An.MOVE_TO_LINE_TO,p,x,s,!0]),l&&(this.instructions.push(V5),this.hitDetectionInstructions.push(V5)),t=f}return a&&(this.instructions.push(ry),this.hitDetectionInstructions.push(ry)),l&&(this.instructions.push(Du),this.hitDetectionInstructions.push(Du)),t}drawCircle(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_FILL_STYLE,Bs]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Fo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Va,qa]);let l=e.getFlatCoordinates(),c=e.getStride(),u=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let f=[An.CIRCLE,u,a];this.instructions.push(pf,f),this.hitDetectionInstructions.push(pf,f),r.fillStyle!==void 0&&(this.instructions.push(ry),this.hitDetectionInstructions.push(ry)),r.strokeStyle!==void 0&&(this.instructions.push(Du),this.hitDetectionInstructions.push(Du)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_FILL_STYLE,Bs]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Fo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Va,qa]);let l=e.getEnds(),c=e.getOrientedFlatCoordinates(),u=e.getStride();this.drawFlatCoordinatess_(c,0,l,u,a),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_FILL_STYLE,Bs]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Fo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Va,qa]);let l=e.getEndss(),c=e.getOrientedFlatCoordinates(),u=e.getStride(),f=0;for(let p=0,x=l.length;p<x;++p)f=this.drawFlatCoordinatess_(c,f,l[p],u,a);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(e!==0){let t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=Sd(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}},X5=j5;var $5=0,Y5=1;function qle(i,e,t,n,r,s,o,a){let l=o-r,c=a-s,u=0,f=1;if(l===0){if(r<i||r>t)return!1}else{let p=(i-r)/l,x=(t-r)/l;if(p>x){let v=p;p=x,x=v}if(p>u&&(u=p),x<f&&(f=x),u>f)return!1}if(c===0){if(s<e||s>n)return!1}else{let p=(e-s)/c,x=(n-s)/c;if(p>x){let v=p;p=x,x=v}if(p>u&&(u=p),x<f&&(f=x),u>f)return!1}return $5=u,Y5=f,!0}function Vq(i,e,t,n){let r=n[0],s=n[1],o=n[2],a=n[3],l=[],c=[],u=!1,f,p,x=0;for(let v=0,w=e.length;v<w;++v){let S=e[v],T=i[x],P=i[x+1],R=!1;for(let C=x+t;C<S;C+=t){let L=i[C],D=i[C+1];if(qle(r,s,o,a,T,P,L,D)){let F=L-T,N=D-P,B=T+$5*F,z=P+$5*N,V=T+Y5*F,H=P+Y5*N;u&&R&&B===f&&z===p?l.push(V,H):(u&&c.push(l.length),l.push(B,z,V,H),u=!0),f=V,p=H,R=!0}T=L,P=D}x=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function qq(i,e,t,n,r){let s=[],o=t,a=0,l=e.slice(t,2);for(;a<i&&o+r<n;){let[c,u]=l.slice(-2),f=e[o+r],p=e[o+r+1],x=Math.sqrt((f-c)*(f-c)+(p-u)*(p-u));if(a+=x,a>=i){let v=(i-a+x)/x,w=No(c,f,v),S=No(u,p,v);l.push(w,S),s.push(l),l=[w,S],a==i&&(o+=r),a=0}else if(a<i)l.push(e[o+r],e[o+r+1]),o+=r;else{let v=x-a,w=No(c,f,v/x),S=No(u,p,v/x);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function Hq(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,p,x,v,w,S,T,P,R;for(f=t;f<n;f+=r){let C=e[f],L=e[f+1];v!==void 0&&(P=C-v,R=L-w,x=Math.sqrt(P*P+R*R),S!==void 0&&(l+=p,u=Math.acos((S*P+T*R)/(p*x)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),p=x,S=P,T=R),v=C,w=L}return l+=x,l>a?[c,f]:[s,o]}var sy={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Z5=class extends Fu{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[Bs]={fillStyle:Bs},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;let a=this.coordinates,l=a.length,c=e.getType(),u=null,f=e.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){let p=e.getExtent();if(!xr(this.maxExtent,p))return;let x;if(u=e.getFlatCoordinates(),c=="LineString")x=[u.length];else if(c=="MultiLineString")x=e.getEnds();else if(c=="Polygon")x=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){let T=e.getEndss();x=[];for(let P=0,R=T.length;P<R;++P)x.push(T[P][0])}if((c=="LineString"||c=="MultiLineString")&&!mu(this.getBufferedMaxExtent(),p)){let T=Vq(u,x,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,x=T.ends,f=2,x.length===0)return}this.beginGeometry(e,t,n);let v=o.repeat,w=v?void 0:o.textAlign,S=0;for(let T=0,P=x.length;T<P;++T){let R;v?R=qq(v*this.resolution,u,S,x[T],f):R=[u.slice(S,x[T])];for(let C=0,L=R.length;C<L;++C){let D=R[C],F=0,N=D.length;if(w==null){let z=Hq(o.maxAngle,D,0,D.length,2);F=z[0],N=z[1]}for(let z=F;z<N;z+=f)a.push(D[z],D[z+1]);let B=a.length;S=x[T],this.drawChars_(l,B),l=B}}this.endGeometry(t)}else{let p=o.overflow?null:[];switch(c){case"Point":case"MultiPoint":u=e.getFlatCoordinates();break;case"LineString":u=e.getFlatMidpoint();break;case"Circle":u=e.getCenter();break;case"MultiLineString":u=e.getFlatMidpoints(),f=2;break;case"Polygon":u=e.getFlatInteriorPoint(),o.overflow||p.push(u[2]/this.resolution),f=3;break;case"MultiPolygon":let C=e.getFlatInteriorPoints();u=[];for(let L=0,D=C.length;L<D;L+=3)o.overflow||p.push(C[L+2]/this.resolution),u.push(C[L],C[L+1]);if(u.length===0)return;f=2;break;default:}let x=this.appendFlatPointCoordinates(u,f);if(x===l)return;if(p&&(x-l)/2!==u.length/f){let C=l/2;p=p.filter((L,D)=>{let F=a[(C+D)*2]===u[D*f]&&a[(C+D)*2+1]===u[D*f+1];return F||--C,F})}this.saveTextStates_();let v=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,w=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(e,t,n);let S=o.padding;if(S!=of&&(o.scale[0]<0||o.scale[1]<0)){let C=o.padding[0],L=o.padding[1],D=o.padding[2],F=o.padding[3];o.scale[0]<0&&(L=-L,F=-F),o.scale[1]<0&&(C=-C,D=-D),S=[C,L,D,F]}let T=this.pixelRatio;this.instructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,S==of?of:S.map(function(C){return C*T}),v,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]);let P=1/T,R=v?v.slice(0):null;R&&(R[1]=Bs),this.hitDetectionInstructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[P,P],NaN,this.declutterMode_,this.declutterImageWithText_,S,R,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Bs:this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||Id,justify:t.justify,textBaseline:t.textBaseline||J0,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=sy[r.textBaseline],u=this.textOffsetX_*l,f=this.textOffsetY_*l,p=this.text_,x=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([An.DRAW_CHARS,e,t,c,r.overflow,a,r.maxAngle,l,f,s,x*l,p,o,1,this.declutterMode_,this.textKeepUpright_,u]),this.hitDetectionInstructions.push([An.DRAW_CHARS,e,t,c,r.overflow,a&&Bs,r.maxAngle,l,f,s,x*l,p,o,1/l,this.declutterMode_,this.textKeepUpright_,u])}setTextStyle(e,t){let n,r,s;if(!e)this.text_="";else{let o=e.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=za(o.getColor()||Bs)):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);let w=a.getLineDash(),S=a.getLineDashOffset(),T=a.getWidth(),P=a.getMiterLimit();s.lineCap=a.getLineCap()||Cu,s.lineDash=w?w.slice():Va,s.lineDashOffset=S===void 0?qa:S,s.lineJoin=a.getLineJoin()||Ru,s.lineWidth=T===void 0?af:T,s.miterLimit=P===void 0?sf:P,s.strokeStyle=za(a.getColor()||Fo)}n=this.textState_;let l=e.getFont()||tS;Jz(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()||J0,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||of,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),p=e.getRotateWithView(),x=e.getKeepUpright(),v=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=u===void 0?0:u,this.textOffsetY_=f===void 0?0:f,this.textRotateWithView_=p===void 0?!1:p,this.textKeepUpright_=x===void 0?!0:x,this.textRotation_=v===void 0?0:v,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Ln(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+Ln(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},Wq=Z5;var Hle={Circle:X5,Default:Fu,Image:Gq,LineString:zq,Polygon:X5,Text:Wq},K5=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=Hle[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},jq=K5;function Xq(i,e,t,n){let r=i[e],s=i[e+1],o=0;for(let a=e+n;a<t;a+=n){let l=i[a],c=i[a+1];o+=Math.sqrt((l-r)*(l-r)+(c-s)*(c-s)),r=l,s=c}return o}function kS(i,e,t,n,r,s,o,a){o=o??[],a=a??n;let l=i[e+n],c=i[e+n+1],u=i[t-2*n],f=i[t-2*n+1],p,x,v,w,S,T,P,R,C=0;for(let L=e;L<t;L+=n){v=p,w=x,S=void 0,T=void 0,L+n<t&&(S=i[L+n],T=i[L+n+1]),s&&L===e&&(v=u,w=f),s&&L===t-n&&(S=l,T=c),p=i[L],x=i[L+1],[P,R]=Wle(p,x,v,w,S,T,r),o[C++]=P,o[C++]=R;for(let D=2;D<a;D++)o[C++]=i[L+D]}return o.length!=C&&(o.length=C),o}function Wle(i,e,t,n,r,s,o){let a,l;t!==void 0&&n!==void 0?(a=i-t,l=e-n):r!==void 0&&s!==void 0?(a=r-i,l=s-e):(a=1,l=0);let c=Math.hypot(a,l),u=a/c,f=l/c;if(a=-f,l=u,t===void 0||n===void 0)return[i+a*o,e+l*o];if(r===void 0||s===void 0)return[i+a*o,e+l*o];let p=lG([i,e],[t,n],[r,s]);if(Math.cos(p)>.998)return[i+u*o,e+f*o];let x=Math.cos(p/2),v=Math.sin(p/2),w=v*a+x*l,S=-x*a+v*l,T=w*(1/v),P=S*(1/v);return[i+T*o,e+P*o]}function GS(i,e,t=!1){for(let n=0,r=i.length-2;n<r;n+=e){let s=t&&n===0?i.length-3*e:i.length-2*e;for(let o=s;o>n+e;o-=e){let a=i[n],l=i[n+1],c=i[n+e],u=i[n+e+1],f=i[o],p=i[o+1],x=i[o+e],v=i[o+e+1],w=(v-p)*(c-a)-(x-f)*(u-l);if(w===0)continue;let S=((x-f)*(l-p)-(v-p)*(a-f))/w,T=((c-a)*(l-p)-(u-l)*(a-f))/w;if(S>0&&S<1&&T>0&&T<1){let P=a+S*(c-a),R=l+S*(u-l);i[n+e]=P,i[n+e+1]=R,i.splice(n+2*e,o-n-e);break}}}return i}var Q5;function jle(){return Q5||(Q5=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Q5}function $q(i,e,t,n,r,s,o,a,l,c,u,f,p=!0){let x=i[e],v=i[e+1],w=0,S=0,T=0,P=0;function R(){w=x,S=v,e+=n,x=i[e],v=i[e+1],P+=T,T=Math.sqrt((x-w)*(x-w)+(v-S)*(v-S))}do R();while(e<t-n&&P+T<s);let C=T===0?0:(s-P)/T,L=No(w,x,C),D=No(S,v,C),F=e-n,N=P,B=s+a*l(c,r,u);for(;e<t-n&&P+T<B;)R();C=T===0?0:(B-P)/T;let z=No(w,x,C),V=No(S,v,C),H=!1;if(p)if(f){let ae=[L,D,z,V];kw(ae,0,4,2,f,ae,ae),H=ae[0]>ae[2]}else H=L>z;let Z=Math.PI,J=[],j=F+n===e;e=F,T=0,P=N,x=i[e],v=i[e+1];let K;if(j){R(),K=Math.atan2(v-S,x-w),H&&(K+=K>0?-Z:Z);let ae=(z+L)/2,ce=(V+D)/2;return J[0]=[ae,ce,(B-s)/2,K,r],J}r=r.replace(/\n/g," ");let ee=Array.from(jle().segment(r),ae=>ae.segment);for(let ae=0,ce=ee.length;ae<ce;){R();let de=Math.atan2(v-S,x-w);if(H&&(de+=de>0?-Z:Z),K!==void 0){let Me=de-K;if(Me+=Me>Z?-2*Z:Me<-Z?2*Z:0,Math.abs(Me)>o)return null}K=de;let ve=ae,Ie=0;for(;ae<ce;++ae){let Me=H?ce-ae-1:ae,ze=a*l(c,ee[Me],u);if(e+n<t&&P+T<s+Ie+ze/2)break;Ie+=ze}if(ae===ve)continue;let Qe=(H?ee.slice(ce-ae,ce-ve):ee.slice(ve,ae)).join("");C=T===0?0:(s+Ie/2-P)/T;let Ue=No(w,x,C),mt=No(S,v,C);J.push([Ue,mt,Ie/2,de,Qe]),s+=Ie}return J}var Wg=Cr(),Od=[],Af=[],mf=[],Bd=[];function Yq(i){return i[3].declutterBox}var Zq=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function J5(i,e){return e==="start"?e=Zq.test(i)?"right":"left":e==="end"&&(e=Zq.test(i)?"left":"right"),sy[e]}function Xle(i,e,t){return t>0&&i.push(`7-`,""),i.push(e,""),i}function $le(i,e,t){return t%2===0&&(i+=e),i}var eN=class{constructor(e,t,n,r,s){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=Zs(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new OS: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?sy[l.justify]:J5(Array.isArray(e)?e[0]:e,l.textAlign||Id),p=r&&o.lineWidth?o.lineWidth:0,x=Array.isArray(e)?e:String(e).split(`8-`).reduce(Xle,[]),{width:v,height:w,widths:S,heights:T,lineWidths:P}=nV(l,x),R=v+p,C=[],L=(R+2)*u[0],D=(w+p)*u[1],F={width:L<0?Math.floor(L):Math.ceil(L),height:D<0?Math.floor(D):Math.ceil(D),contextInstructions:C};(u[0]!=1||u[1]!=1)&&C.push("scale",u),r&&(C.push("strokeStyle",o.strokeStyle),C.push("lineWidth",p),C.push("lineCap",o.lineCap),C.push("lineJoin",o.lineJoin),C.push("miterLimit",o.miterLimit),C.push("setLineDash",[o.lineDash]),C.push("lineDashOffset",o.lineDashOffset)),n&&C.push("fillStyle",a.fillStyle),C.push("textBaseline","middle"),C.push("textAlign","center");let N=.5-f,B=f*R+N*p,z=[],V=[],H=0,Z=0,J=0,j=0,K;for(let ee=0,ae=x.length;ee<ae;ee+=2){let ce=x[ee];if(ce===`9-`){Z+=H,H=0,B=f*R+N*p,++j;continue}let de=x[ee+1]||l.font;de!==K&&(r&&z.push("font",de),n&&V.push("font",de),K=de),H=Math.max(H,T[J]);let ve=[ce,B+N*S[J]+f*(S[J]-P[j]),.5*(p+H)+Z];B+=S[J],r&&z.push("strokeText",ve),n&&V.push("fillText",ve),++J}return Array.prototype.push.apply(C,z),Array.prototype.push.apply(C,V),this.labels_[s]=F,F}replayTextBackground_(e,t,n,r,s,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,s),e.lineTo.apply(e,t),o&&(this.alignAndScaleFill_=o[2],e.fillStyle=o[1],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,r,s,o,a,l,c,u,f,p,x,v,w,S){a*=p[0],l*=p[1];let T=n-a,P=r-l,R=s+c>e?e-c:s,C=o+u>t?t-u:o,L=v[3]+R*p[0]+v[1],D=v[0]+C*p[1]+v[2],F=T-v[3],N=P-v[0];(w||f!==0)&&(Od[0]=F,Bd[0]=F,Od[1]=N,Af[1]=N,Af[0]=F+L,mf[0]=Af[0],mf[1]=N+D,Bd[1]=mf[1]);let B;return f!==0?(B=uo(Zs(),n,r,1,1,f,-n,-r),Rr(B,Od),Rr(B,Af),Rr(B,mf),Rr(B,Bd),cl(Math.min(Od[0],Af[0],mf[0],Bd[0]),Math.min(Od[1],Af[1],mf[1],Bd[1]),Math.max(Od[0],Af[0],mf[0],Bd[0]),Math.max(Od[1],Af[1],mf[1],Bd[1]),Wg)):cl(Math.min(F,F+L),Math.min(N,N+D),Math.max(F,F+L),Math.max(N,N+D),Wg),x&&(T=Math.round(T),P=Math.round(P)),{drawImageX:T,drawImageY:P,drawImageW:R,drawImageH:C,originX:c,originY:u,declutterBox:{minX:Wg[0],minY:Wg[1],maxX:Wg[2],maxY:Wg[3],value:S},canvasTransform:B,scale:p}}replayImageOrLabel_(e,t,n,r,s,o,a){let l=!!(o||a),c=r.declutterBox,u=a?a[2]*r.scale[0]/2:0;return c.minX-u<=t[0]&&c.maxX+u>=0&&c.minY-u<=t[1]&&c.maxY+u>=0&&(l&&this.replayTextBackground_(e,Od,Af,mf,Bd,o,a),iV(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=Rr(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=J5(Array.isArray(e)?e[0]:e,s.textAlign||Id),u=sy[s.textBaseline||J0],f=a&&a.lineWidth?a.lineWidth:0,p=o.width/l-2*s.scale[0],x=c*p+2*(.5-c)*f,v=u*o.height/l+2*(.5-u)*f;return{label:o,anchorX:x,anchorY:v}}execute_(e,t,n,r,s,o,a,l){let c=this.zIndexContext_,u;this.pixelCoordinates_&&Lo(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=Ga(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),rz(this.renderedTransform_,n));let f=0,p=r.length,x=0,v,w=[],S,T,P,R,C,L,D,F,N,B,z,V,H,Z=0,J=0,j=this.coordinateCache_,K=this.viewRotation_,ee=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,ae={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:K},ce=this.instructions!=r||this.overlaps?0:200,de,ve,Ie,Qe;for(;f<p;){let Ue=r[f];switch(Ue[0]){case An.BEGIN_GEOMETRY:de=Ue[1],Qe=Ue[3],de.getGeometry()?a!==void 0&&!xr(a,Qe.getExtent())?f=Ue[2]+1:++f:f=Ue[2],c&&(c.zIndex=Ue[4]);break;case An.BEGIN_PATH:Z>ce&&(this.fill_(e),Z=0),J>ce&&(e.stroke(),J=0),!Z&&!J&&(e.beginPath(),C=NaN,L=NaN),++f;break;case An.CIRCLE:x=Ue[1],P=Ue[2]??0;let Me=u[x],ze=u[x+1],$e=u[x+2]-P,Et=u[x+3]-P,Tt=$e-Me,Ct=Et-ze,un=Math.sqrt(Tt*Tt+Ct*Ct);e.moveTo(Me+un,ze),e.arc(Me,ze,un,0,2*Math.PI,!0),++f;break;case An.CLOSE_PATH:e.closePath(),++f;break;case An.CUSTOM:x=Ue[1],v=Ue[2];let Gt=Ue[3],Xe=Ue[4],st=Ue[5];ae.geometry=Gt,ae.feature=de,f in j||(j[f]=[]);let tt=j[f];st?st(u,x,v,2,tt):(tt[0]=u[x],tt[1]=u[x+1],tt.length=2),c&&(c.zIndex=Ue[6]),Xe(tt,ae),++f;break;case An.DRAW_IMAGE:x=Ue[1],v=Ue[2],N=Ue[3],S=Ue[4],T=Ue[5];let vt=Ue[6],yt=Ue[7],ln=Ue[8],Kt=Ue[9],Qt=Ue[10],xn=Ue[11],ge=Ue[12],di=Ue[13];R=Ue[14]||"declutter";let Bn=Ue[15];if(!N&&Ue.length>=20){B=Ue[19],z=Ue[20],V=Ue[21],H=Ue[22];let Nn=this.drawLabelWithPointPlacement_(B,z,V,H);N=Nn.label,Ue[3]=N;let zr=Ue[23];S=(Nn.anchorX-zr)*this.pixelRatio,Ue[4]=S;let gr=Ue[24];T=(Nn.anchorY-gr)*this.pixelRatio,Ue[5]=T,vt=N.height,Ue[6]=vt,di=N.width,Ue[13]=di}let le;Ue.length>25&&(le=Ue[25]);let X,Te,Pe;Ue.length>17?(X=Ue[16],Te=Ue[17],Pe=Ue[18]):(X=of,Te=null,Pe=null),Qt&&ee?xn+=K:!Qt&&!ee&&(xn-=K);let Ve=0;for(;x<v;x+=2){if(le&&le[Ve++]<di/this.pixelRatio)continue;let Nn=this.calculateImageOrLabelDimensions_(N.width,N.height,u[x],u[x+1],di,vt,S,T,ln,Kt,xn,ge,s,X,!!Te||!!Pe,de),zr=[e,t,N,Nn,yt,Te,Pe];if(l){let gr,rl,na;if(Bn){let or=v-x;if(!Bn[or]){Bn[or]={args:zr,declutterMode:R};continue}let Is=Bn[or];gr=Is.args,rl=Is.declutterMode,delete Bn[or],na=Yq(gr)}let sl,Na;if(gr&&(rl!=="declutter"||!l.collides(na))&&(sl=!0),(R!=="declutter"||!l.collides(Nn.declutterBox))&&(Na=!0),rl==="declutter"&&R==="declutter"){let or=sl&&Na;sl=or,Na=or}sl&&(rl!=="none"&&l.insert(na),this.replayImageOrLabel_.apply(this,gr)),Na&&(R!=="none"&&l.insert(Nn.declutterBox),this.replayImageOrLabel_.apply(this,zr))}else this.replayImageOrLabel_.apply(this,zr)}++f;break;case An.DRAW_CHARS:let gt=Ue[1],St=Ue[2],qe=Ue[3],Ke=Ue[4];H=Ue[5];let Rt=Ue[6],en=Ue[7],Pt=Ue[8];V=Ue[9];let Mt=Ue[10];B=Ue[11],Array.isArray(B)&&(B=B.reduce($le,"")),z=Ue[12];let cn=[Ue[13],Ue[13]];R=Ue[14]||"declutter";let yn=Ue[15],Pn=Ue[16],xe=this.textStates[z],bt=xe.font,Ye=[xe.scale[0]*en,xe.scale[1]*en],wt;bt in this.widths_?wt=this.widths_[bt]:(wt={},this.widths_[bt]=wt);let Dt=Xq(u,gt,St,2),ct=Math.abs(Ye[0])*hI(bt,B,wt);if(Ke||ct<=Dt){let Nn=this.textStates[z].textAlign,zr=(Dt-ct)*J5(B,Nn),gr=$q(u,gt,St,2,B,zr,Rt,Math.abs(Ye[0]),hI,bt,wt,ee?0:this.viewRotation_,yn);e:if(gr){let rl=[],na,sl,Na,or,Is;if(V)for(na=0,sl=gr.length;na<sl;++na){Is=gr[na],Na=Is[4],or=this.createLabel(Na,z,"",V),S=Is[2]+(Ye[0]<0?-Mt:Mt)-Pn,T=qe*or.height+(.5-qe)*2*Mt*Ye[1]/Ye[0]-Pt;let ol=this.calculateImageOrLabelDimensions_(or.width,or.height,Is[0],Is[1],or.width,or.height,S,T,0,0,Is[3],cn,!1,of,!1,de);if(l&&R==="declutter"&&l.collides(ol.declutterBox))break e;rl.push([e,t,or,ol,1,null,null])}if(H)for(na=0,sl=gr.length;na<sl;++na){Is=gr[na],Na=Is[4],or=this.createLabel(Na,z,H,""),S=Is[2]-Pn,T=qe*or.height-Pt;let ol=this.calculateImageOrLabelDimensions_(or.width,or.height,Is[0],Is[1],or.width,or.height,S,T,0,0,Is[3],cn,!1,of,!1,de);if(l&&R==="declutter"&&l.collides(ol.declutterBox))break e;rl.push([e,t,or,ol,1,null,null])}l&&R!=="none"&&l.load(rl.map(Yq));for(let ol=0,du=rl.length;ol<du;++ol)this.replayImageOrLabel_.apply(this,rl[ol])}}++f;break;case An.END_GEOMETRY:if(o!==void 0){de=Ue[1];let Nn=o(de,Qe,R);if(Nn)return Nn}++f;break;case An.FILL:ce?Z++:this.fill_(e),++f;break;case An.MOVE_TO_LINE_TO:x=Ue[1],v=Ue[2],P=Ue[3];let Ce,jt,Hi;if(P){let zr=(Ue[4]??!1)||Math.abs(u[x]-u[v-2])<1e-6&&Math.abs(u[x+1]-u[v-1])<1e-6;kS(u,x,v,2,P,zr,w),GS(w,2,zr),Ce=w,jt=0,Hi=Ce.length}else Ce=u,jt=x,Hi=v;ve=Ce[jt],Ie=Ce[jt+1],e.moveTo(ve,Ie),C=ve+.5|0,L=Ie+.5|0;for(let Nn=jt+2;Nn<Hi;Nn+=2)ve=Ce[Nn],Ie=Ce[Nn+1],D=ve+.5|0,F=Ie+.5|0,(Nn==Hi-2||D!==C||F!==L)&&(e.lineTo(ve,Ie),C=D,L=F);++f;break;case An.SET_FILL_STYLE:this.alignAndScaleFill_=Ue[2],Z?(this.fill_(e),Z=0,J&&(e.stroke(),J=0)):J&&Ue[1]&&(e.stroke(),J=0),e.fillStyle=Ue[1],++f;break;case An.SET_STROKE_STYLE:Z&&Ue[1]&&(this.fill_(e),Z=0),J&&(e.stroke(),J=0),this.setStrokeStyle_(e,Ue),++f;break;case An.STROKE:ce?J++:e.stroke(),++f;break;default:++f;break}}Z&&this.fill_(e),J&&e.stroke()}execute(e,t,n,r,s,o){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,n,r,s){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,s)}},Kq=eN;var Ud=["Polygon","Circle","LineString","Image","Text","Default"],iN=["Image","Text"],Qq=Ud.filter(i=>!iN.includes(i)),Jq=!1,eH=!1;function Yle(){let i=0,e=n=>{let r=Ti(1,1,null,{willReadFrequently:n}),s=0,o=performance.now();for(;performance.now()-o<50;++s)r.fillStyle=`rgba(255,0,${s%256},1)`,r.fillRect(0,0,1,1),r.getImageData(0,0,1,1);return i=s>i?s:i,s};Jq={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],eH=!0}var nN=class{constructor(e,t,n,r,s,o,a){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Zs(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,a)}clip(e,t){let n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(let n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);let s=e[n];for(let o in s){let a=s[o];r[o]=new Kq(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){eH===!1&&Yle(),r=Math.round(r);let a=r*2+1,l=uo(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Ti(a,a,null,{willReadFrequently:Jq}));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=Cr(),U0(f,e),sg(f,t*(this.renderBuffer_+r),f));let p=Zle(r),x;function v(L,D,F){let N=u.getImageData(0,0,a,a).data;for(let B=0,z=p.length;B<z;B++)if(N[p[B]]>0){if(!o||F==="none"||x!=="Image"&&x!=="Text"||o.includes(L)){let V=(p[B]-3)/4,H=r-V%a,Z=r-(V/a|0),J=s(L,D,H*H+Z*Z);if(J)return J}u.clearRect(0,0,a,a);break}}let w=Object.keys(this.executorsByZIndex_).map(Number);w.sort(ka);let S,T,P,R,C;for(S=w.length-1;S>=0;--S){let L=w[S].toString();for(P=this.executorsByZIndex_[L],T=Ud.length-1;T>=0;--T)if(x=Ud[T],R=P[x],R!==void 0&&(C=R.executeHitDetection(u,l,n,v,f),C))return C}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let n=t[0],r=t[1],s=t[2],o=t[3],a=[n,r,n,o,s,o,s,r];return Ga(a,0,8,2,e,a),a}isEmpty(){return Ec(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?NG:ka),o=o||Ud;let c=Ud.length;for(let u=0,f=l.length;u<f;++u){let p=l[u].toString(),x=this.executorsByZIndex_[p];for(let v=0,w=o.length;v<w;++v){let S=o[v],T=x[S];if(T!==void 0){let P=a===null?void 0:T.getZIndexContext(),R=P?P.getContext():e,C=this.maxExtent_&&S!=="Image"&&S!=="Text";if(C&&(R.save(),this.clip(R,n)),!P||S==="Text"||S==="Image"?T.execute(R,t,n,r,s,a):P.pushFunction(L=>T.execute(L,t,n,r,s,a)),C&&R.restore(),P){P.offset();let L=l[u]*c+Ud.indexOf(S);this.deferredZIndexContexts_[L]||(this.deferredZIndexContexts_[L]=[]),this.deferredZIndexContexts_[L].push(P)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(ka);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}},tN={};function Zle(i){if(tN[i]!==void 0)return tN[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 tN[i]=r,r}var tH=nN;var rN=class extends US{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?k0(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=Zs()}drawImages_(e,t,n,r){if(!this.image_)return;let s=Ga(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let u=0,f=s.length;u<f;u+=2){let p=s[u]-this.imageAnchorX_,x=s[u+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let v=p+this.imageAnchorX_,w=x+this.imageAnchorY_;uo(a,v,w,1,1,c,-v,-w),o.save(),o.transform.apply(o,a),o.translate(v,w),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,p,x,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(e,t,n,r){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let s=Ga(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=Ga(e,t,n,r,this.transform_,this.pixelCoordinates_);if(Math.abs(o)>0){let u=l.length,f=s||Math.abs(l[0]-l[u-2])<1e-6&&Math.abs(l[1]-l[u-1])<1e-6;l=kS(l,0,u,2,o,f,l),GS(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_)),!!xr(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=Sz(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_)),!!xr(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(xr(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_)),!!xr(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_)),!!xr(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),Lo(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:Id;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:za(n||Bs)}}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||Va,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:Cu,lineDash:this.pixelRatio_===1?u:u.map(p=>p*this.pixelRatio_),lineDashOffset:(o||qa)*this.pixelRatio_,lineJoin:a!==void 0?a:Ru,lineWidth:(l!==void 0?l:af)*this.pixelRatio_,miterLimit:c!==void 0?c:sf,strokeStyle:za(n||Fo),strokeOffset:(f??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),s=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/n,o[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_="";else{let t=e.getFill();if(!t)this.textFillState_=null;else{let x=t.getColor();this.textFillState_={fillStyle:za(x||Bs)}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let x=n.getColor(),v=n.getLineCap(),w=n.getLineDash(),S=n.getLineDashOffset(),T=n.getLineJoin(),P=n.getWidth(),R=n.getMiterLimit();this.textStrokeState_={lineCap:v!==void 0?v:Cu,lineDash:w||Va,lineDashOffset:S||qa,lineJoin:T!==void 0?T:Ru,lineWidth:P!==void 0?P:af,miterLimit:R!==void 0?R:sf,strokeStyle:za(x||Fo)}}let r=e.getFont(),s=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),c=e.getScaleArray(),u=e.getText(),f=e.getTextAlign(),p=e.getTextBaseline();this.textState_={font:r!==void 0?r:tS,textAlign:f!==void 0?f:Id,textBaseline:p!==void 0?p:J0},this.text_=u!==void 0?Array.isArray(u)?u.reduce((x,v,w)=>x+=w%2?" ":v,""):u:"",this.textOffsetX_=s!==void 0?this.pixelRatio_*s:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}},nH=rN;var kc=.5;function iH(i,e,t,n,r,s,o,a,l){let c=l?_d(r,l):r,u=i[0]*kc,f=i[1]*kc,p=Ti(u,f);p.imageSmoothingEnabled=!1;let x=p.canvas,v=new nH(p,kc,r,null,o,a,l?V0(H0(),l):null),w=t.length,S=Math.floor((256*256*256-1)/w),T={};for(let R=1;R<=w;++R){let C=t[R-1],L=C.getStyleFunction()||n;if(!L)continue;let D=L(C,s);if(!D)continue;Array.isArray(D)||(D=[D]);let N=(R*S).toString(16).padStart(7,"#00000");for(let B=0,z=D.length;B<z;++B){let V=D[B],H=V.getGeometryFunction()(C);if(!H||!xr(c,H.getExtent()))continue;let Z=V.clone(),J=Z.getFill();J&&J.setColor(N);let j=Z.getStroke();j&&(j.setColor(N),j.setLineDash(null)),Z.setText(void 0);let K=V.getImage();if(K){let de=K.getImageSize();if(!de)continue;let ve=Ti(de[0],de[1],void 0,{alpha:!1}),Ie=ve.canvas;ve.fillStyle=N,ve.fillRect(0,0,Ie.width,Ie.height),Z.setImage(new eA({img:Ie,anchor:K.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:K.getOrigin(),opacity:1,size:K.getSize(),scale:K.getScale(),rotation:K.getRotation(),rotateWithView:K.getRotateWithView()}))}let ee=Z.getZIndex()||0,ae=T[ee];ae||(ae={},T[ee]=ae,ae.Polygon=[],ae.Circle=[],ae.LineString=[],ae.Point=[]);let ce=H.getType();if(ce==="GeometryCollection"){let de=H.getGeometriesArrayRecursive();for(let ve=0,Ie=de.length;ve<Ie;++ve){let Qe=de[ve];ae[Qe.getType().replace("Multi","")].push(Qe,Z)}}else ae[ce.replace("Multi","")].push(H,Z)}}let P=Object.keys(T).map(Number).sort(ka);for(let R=0,C=P.length;R<C;++R){let L=T[P[R]];for(let D in L){let F=L[D];for(let N=0,B=F.length;N<B;N+=2){v.setStyle(F[N+1]);for(let z=0,V=e.length;z<V;++z)v.setTransform(e[z]),v.drawGeometry(F[N])}}}return p.getImageData(0,0,x.width,x.height)}function rH(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*kc),s=Math.floor(Math.round(i[1])*kc),o=(xi(r,0,t.width-1)+xi(s,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],u=t.data[o+2]+256*(l+256*a),f=Math.floor((256*256*256-1)/e.length);u&&u%f===0&&n.push(e[u/f-1])}return n}var Kle=.5,sH={Point:rce,LineString:tce,Polygon:oce,MultiPoint:sce,MultiLineString:nce,MultiPolygon:ice,GeometryCollection:ece,Circle:Qle};function oH(i,e){return parseInt(Ln(i),10)-parseInt(Ln(e),10)}function sN(i,e){let t=oN(i,e);return t*t}function oN(i,e){return Kle*i/e}function Qle(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 aN(i,e,t,n,r,s,o,a){let l=[],c=t.getImage();if(c){let p=!0,x=c.getImageState();x==Mn.LOADED||x==Mn.ERROR?p=!1:x==Mn.IDLE&&c.load(),p&&l.push(c.ready())}let u=t.getFill();u&&u.loading()&&l.push(u.ready());let f=l.length>0;return f&&Promise.all(l).then(()=>r(null)),Jle(i,e,t,n,s,o,a),f}function Jle(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())aH(i,l,t,e,o);else{let u=sH[l.getType()];u(i,l,t,e,o,s)}}function aH(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)aH(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function ece(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=sH[o[a].getType()];c(i,o[a],t,n,r,s)}}function tce(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 nce(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 ice(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 rce(i,e,t,n,r,s){let o=t.getImage(),a=t.getText(),l=a&&a.getText(),c=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=Mn.LOADED)return;let u=i.getBuilder(t.getZIndex(),"Image");u.setImageStyle(o,c),u.drawPoint(e,n,r)}if(l){let u=i.getBuilder(t.getZIndex(),"Text");u.setTextStyle(a,c),u.drawText(e,n,r)}}function sce(i,e,t,n,r,s){let o=t.getImage(),a=o&&o.getOpacity()!==0,l=t.getText(),c=l&&l.getText(),u=s&&a&&c?{}:void 0;if(a){if(o.getImageState()!=Mn.LOADED)return;let f=i.getBuilder(t.getZIndex(),"Image");f.setImageStyle(o,u),f.drawMultiPoint(e,n,r)}if(c){let f=i.getBuilder(t.getZIndex(),"Text");f.setTextStyle(l,u),f.drawText(e,n,r)}}function oce(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 lN=class extends BS{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_=Cr(),this.wrappedRenderedExtent_=Cr(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,n){let r=t.extent,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,c=s.rotation,u=l.getExtent(),f=this.getLayer().getSource(),p=this.getLayer().getDeclutter(),x=t.pixelRatio,v=t.viewHints,w=!(v[ks.ANIMATING]||v[ks.INTERACTING]),S=this.context,T=Math.round(jn(r)/a*x),P=Math.round(_r(r)/a*x),R=f.getWrapX()&&l.canWrapX(),C=R?jn(u):null,L=R?Math.ceil((r[2]-u[2])/C)+(this.extendX_?2:1):1,D=R?Math.floor((r[0]-u[0])/C)-(this.extendX_?1:0):0;do{let F=this.getRenderTransform(o,a,0,x,T,P,D*C);t.declutter&&(F=F.slice(0)),e.execute(S,[S.canvas.width,S.canvas.height],F,c,w,n===void 0?Ud:n?iN:Qq,n?p&&t.declutter[p]:void 0)}while(++D<L)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Ti(this.context.canvas.width,this.context.canvas.height,F5))}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,X0(this.context),F5.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(po.PRERENDER)||this.getLayer().hasListener(po.POSTRENDER)))return this.container;this.setDrawContext_(),this.preRender(s,e);let l=r.projection;this.clipExtent_=null;let c=!1;if(a&&n.extent&&this.clipping){let u=Rc(n.extent,l);a=xr(u,e.extent),a&&!mu(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]*kc,p=n[1]*kc;u.push(this.getRenderTransform(r,s,o,kc,f,p,0).slice());let x=c.getSource(),v=a.getExtent();if(x.getWrapX()&&a.canWrapX()&&!mu(v,l)){let S=l[0],T=jn(v),P=0,R;for(;S<v[0];)--P,R=T*P,u.push(this.getRenderTransform(r,s,o,kc,f,p,R).slice()),S+=T;for(P=0,S=l[2];S>v[2];)++P,R=T*P,u.push(this.getRenderTransform(r,s,o,kc,f,p,R).slice()),S-=T}let w=H0();this.hitDetectionImageData_=iH(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,sN(s,this.renderedPixelRatio_),w?a:null)}t(rH(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,s){if(!this.replayGroup_)return;let o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),c={},u=function(p,x,v){let w=Ln(p),S=c[w];if(S){if(S!==!0&&v<S.distanceSq){if(v===0)return c[w]=!0,s.splice(s.lastIndexOf(S),1),r(p,l,x);S.geometry=x,S.distanceSq=v}}else{if(v===0)return c[w]=!0,r(p,l,x);s.push(c[w]={feature:p,layer:l,geometry:x,distanceSq:v,callback:r})}},f=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,a,n,u,f?t.declutter?.[f]?.all().map(p=>p.value):null)}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),n=t.getSource();if(!n)return!1;let r=e.viewHints[ks.ANIMATING],s=e.viewHints[ks.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let l=e.extent,c=e.viewState,u=c.projection,f=c.resolution,p=e.pixelRatio,x=t.getRevision(),v=t.getRenderBuffer(),w=t.getRenderOrder();w===void 0&&(w=oH);let S=c.center.slice(),T=sg(l,v*f),P=T.slice(),R=[T.slice()],C=u.getExtent(),L=n.getWrapX()&&u.canWrapX();if(this.extendX_=!1,L){let K=n.getExtent();K&&!_u(K)&&(this.extendX_=K[0]<C[0]||K[2]>C[2])}if(L&&(!mu(C,e.extent)||this.extendX_)){let K=jn(C),ee=Math.max(jn(T)/2,K),ae=C[0],ce=C[2];this.extendX_&&(ae-=K,ce+=K),T[0]=ae-ee,T[2]=ce+ee,pw(S,u);let de=Y4(R[0],u);de[0]<C[0]&&de[2]<C[2]?R.push([de[0]+K,de[1],de[2]+K,de[3]]):de[0]>C[0]&&de[2]>C[2]&&R.push([de[0]-K,de[1],de[2]-K,de[3]])}if(this.ready&&this.renderedResolution_==f&&this.renderedPixelRatio_===p&&this.renderedRevision_==x&&this.renderedRenderOrder_==w&&this.renderedFrameDeclutter_===!!e.declutter&&mu(this.wrappedRenderedExtent_,T))return Lo(this.renderedExtent_,P)||(this.hitDetectionImageData_=null,this.renderedExtent_=P),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new jq(oN(f,p),T,f,p),F=H0(),N;if(F){for(let K=0,ee=R.length;K<ee;++K){let ae=R[K],ce=_d(ae,u);n.loadFeatures(ce,RG(f,u),F)}N=V0(F,u)}else for(let K=0,ee=R.length;K<ee;++K)n.loadFeatures(R[K],f,u);let B=sN(f,p),z=!0,V=(K,ee)=>{let ae,ce=K.getStyleFunction()||t.getStyleFunction();if(ce&&(ae=ce(K,f)),ae){let de=this.renderFeature(K,B,ae,D,N,this.getLayer().getDeclutter(),ee);z=z&&!de}},H=_d(T,u),Z=n.getFeaturesInExtent(H);w&&Z.sort(w);for(let K=0,ee=Z.length;K<ee;++K)V(Z[K],K);this.renderedFeatures_=Z,this.ready=z;let J=D.finish(),j=new tH(T,f,p,n.getOverlaps(),J,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=f,this.renderedRevision_=x,this.renderedRenderOrder_=w,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=P,this.wrappedRenderedExtent_=T,this.renderedCenter_=S,this.renderedProjection_=u,this.renderedPixelRatio_=p,this.replayGroup_=j,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,r,s,o,a){if(!n)return!1;let l=!1;if(Array.isArray(n))for(let c=0,u=n.length;c<u;++c)l=aN(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=aN(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},lH=lN;var cN=class extends LS{constructor(e){super(e)}createRenderer(){return new lH(this)}},cH=cN;var ace=!1;function lce(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=ace,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 uN(i,e){return function(t,n,r,s,o){lce(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function uH(i,e){return[[-1/0,-1/0,1/0,1/0]]}function hN(i,e,t,n,r,s,o){let a,l,c=(t-e)/n;if(c===1)a=e;else if(c===2)a=e,l=r;else if(c!==0){let u=i[e],f=i[e+1],p=0,x=[0];for(let S=e+n;S<t;S+=n){let T=i[S],P=i[S+1];p+=Math.sqrt((T-u)*(T-u)+(P-f)*(P-f)),x.push(p),u=T,f=P}let v=r*p,w=IG(x,v);w<0?(l=(v-x[-w-2])/(x[-w-1]-x[-w-2]),a=e+(-w-2)*n):a=e+w*n}o=o>1?o:2,s=s||new Array(o);for(let u=0;u<o;++u)s[u]=a===void 0?NaN:l===void 0?i[a+u]:No(i[a+u],i[a+n+u],l);return s}var hH=Zs(),oy=class i{constructor(e,t,n,r,s,o){this.styleFunction,this.extent_,this.id_=o,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=s,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||(this.extent_=this.type_==="Point"?aw(this.flatCoordinates_):og(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=Ua(this.getExtent());this.flatInteriorPoints_=Cx(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=Fz(this.flatCoordinates_,this.ends_),t=oS(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=Gw(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=hN(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=hN(e,t,o,this.stride_,.5);Pc(this.flatMidpoints_,a),t=o}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=_s(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=_r(n)/_r(t);uo(hH,n[0],n[3],r,-r,0,0,0),Ga(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,hH,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=Mw((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=Ex(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=Iz(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=Mx(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}};oy.prototype.getFlatCoordinates=oy.prototype.getOrientedFlatCoordinates;var lA=oy;var fN=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_[Ln(t)]=n}load(e,t){let n=new Array(t.length);for(let r=0,s=t.length;r<s;r++){let o=e[r],a=t[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};n[r]=l,this.items_[Ln(a)]=l}this.rbush_.load(n)}remove(e){let t=Ln(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Ln(t)],r=[n.minX,n.minY,n.maxX,n.maxY];B0(r,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(r){return r.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let r=0,s=e.length;r<s;r++)if(n=t(e[r]),n)return n;return n}isEmpty(){return Ec(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return cl(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]}},dN=fN;var fl={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Ou=class extends Ys{constructor(e,t,n){super(e),this.feature=t,this.features=n}},pN=class extends Ow{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_=ef,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(Vn(this.format_,"`format` must be set when `url` is set"),this.loader_=uN(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:uH;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new dN:null,this.loadedExtentsRtree_=new dN,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 ho(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Ln(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let n=e.getGeometry();if(n){let r=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new Ou(fl.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof lA||(this.featureChangeKeys_[e]=[kn(t,Jt.CHANGE,this.handleFeatureChange_,this),kn(t,Ic.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){let r=String(t.getId());if(!(r in this.idIndex_))this.idIndex_[r]=t;else if(t instanceof lA){let s=this.idIndex_[r];s instanceof lA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(Vn(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],n=[],r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s],l=Ln(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Ln(a);this.setupChangeEvents_(l,a);let c=a.getGeometry();if(c){let u=c.getExtent();t.push(u),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener(fl.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Ou(fl.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(fl.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(fl.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(Qs.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(Qs.REMOVE,n=>{t||(t=!0,this.removeFeature(n.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(let n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(ii);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(n=>{this.removeFeatureInternal(n)});for(let n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new Ou(fl.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 lA||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 lA||r.intersectsExtent(e)){let s=t(n);if(s)return s}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),Ec(this.nullGeometryFeatures_)||Pc(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(n){t.push(n)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let r=uw(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||Qh,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof lA?0:u.closestPointXY(n,r,o,a),a<f){s=c;let p=Math.sqrt(a);l[0]=n-p,l[1]=r-p,l[2]=n+p,l[3]=r+p}}}),s}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){let t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){let t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,n=Ln(t),r=t.getGeometry();if(!r)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{let o=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}let s=t.getId();if(s!==void 0){let o=s.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new Ou(fl.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();if(t!==void 0){let n=this.idIndex_[String(t)];return Array.isArray(n)?n.includes(e):n===e}return Ln(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Ec(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,n){let r=this.loadedExtentsRtree_,s=this.strategy_(e,t,n);for(let o=0,a=s.length;o<a;++o){let l=s[o];if(!r.forEachInExtent(l,function(u){return mu(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Ou(fl.FEATURESLOADSTART));let u=v=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Ou(fl.FEATURESLOADEND,void 0,v))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Ou(fl.FEATURESLOADERROR))},p=!1,x=this.loader_.call(this,l,t,n,v=>p||u(v),()=>p||f());x instanceof Promise?(p=!0,x.then(v=>{this.addFeatures(v),u(v)}).catch(f)):this.loader_.length<4&&(this.loading=!1),r.insert(l,{extent:l.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=[];t.forEachInExtent(e,function(r){n.push(r)}),n.forEach(r=>{t.remove(r);let s=$4(r.extent,e);for(let o of s)t.insert(o,{extent:o})})}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=Ln(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(ii),delete this.featureChangeKeys_[t];let r=e.getId();if(r!==void 0){let s=r.toString(),o=this.idIndex_[s];o===e?delete this.idIndex_[s]:Array.isArray(o)&&(o.splice(o.indexOf(e),1),o.length===1&&(this.idIndex_[s]=o[0]))}return delete this.uidIndex_[t],this.hasListener(fl.REMOVEFEATURE)&&this.dispatchEvent(new Ou(fl.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(let t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){Vn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(uN(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},gf=pN;var ga={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},rp={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},jT=0,e2=1,XT=2;var nL=0,sp=1,$T=2,tc=3,go=0,ui=1,rr=2,Yr=0,os=1,qu=2,Hu=3,Wu=4,Of=5,t2=6,Gs=100,n2=101,i2=102,YT=103,ZT=104,Wc=200,r2=201,s2=202,o2=203,jd=204,Xd=205,a2=206,l2=207,c2=208,u2=209,h2=210,eW=211,tW=212,nW=213,iW=214,dA=0,pA=1,AA=2,ku=3,mA=4,gA=5,_A=6,xA=7,FA=0,KT=1,QT=2,zs=0,f2=1,d2=2,p2=3,A2=4,iL=5,m2=6,g2=7;var _2=300,yl=301,nc=302,op=303,ap=304,ju=306,Mf=1e3,Go=1001,Cf=1002,yi=1003,x2=1004;var ic=1005;var bi=1006,lp=1007;var xo=1008,rL=1008,zi=1009,Xu=1010,$u=1011,ja=1012,Dr=1013,pi=1014,Zi=1015,Di=1016,OA=1017,BA=1018,Vo=1020,UA=35902,kA=35899,R_=1021,Bf=1022,vr=1023,vs=1026,eo=1027,Uf=1028,Yu=1029,Ts=1030,Zu=1031,y2=1032,cp=1033,Ku=33776,Qu=33777,Ju=33778,eh=33779,GA=35840,zA=35841,VA=35842,qA=35843,up=36196,hp=37492,fp=37496,dp=37488,pp=37489,th=37490,Ap=37491,mp=37808,gp=37809,_p=37810,xp=37811,yp=37812,vp=37813,bp=37814,wp=37815,Sp=37816,Tp=37817,Ep=37818,Mp=37819,Cp=37820,Rp=37821,Pp=36492,Ip=36494,Np=36495,Lp=36283,Dp=36284,nh=36285,Fp=36286;var yy=2300,yT=2301,_T=2302,qN=2303,HN=2400,WN=2401,jN=2402;var sL=0,oL=1,JT=2,rW=3200;var vl=0,e3=1,qo="",yr="srgb",$d="srgb-linear",Yd="linear",Bt="srgb",v2="",t3="rg",aL="ga",lL=0,wf=7680,cL=7681,uL=7682,hL=7683,fL=34055,dL=34056,pL=5386,AL=512,mL=513,gL=514,_L=515,xL=516,yL=517,vL=518,vy=519,b2=512,P_=513,w2=514,ih=515,HA=516,S2=517,jc=518,T2=519,Zd=35044,WA=35048;var bL="300 es",mo=2e3,Ha=2001,rc={COMPUTE:"compute",RENDER:"render"};var kf={TEXTURE_COMPARE:"depthTextureCompare"};function cce(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function I_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function f_(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function n3(){let i=f_("canvas");return i.style.display="block",i}var fH={},d_=null;function yA(...i){let e="THREE."+i.shift();d_?d_("log",e,...i):console.log(e,...i)}function sW(i){let e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function je(...i){i=sW(i);let e="THREE."+i.shift();if(d_)d_("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function Ge(...i){i=sW(i);let e="THREE."+i.shift();if(d_)d_("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function Kn(...i){let e=i.join(" ");e in fH||(fH[e]=!0,je(...i))}function wL(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function oW(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 E2={[dA]:pA,[AA]:_A,[mA]:xA,[ku]:gA,[pA]:dA,[_A]:AA,[xA]:mA,[gA]:ku},zo=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}}},Uo=["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"],dH=1234567,my=Math.PI/180,Rf=180/Math.PI;function Uu(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Uo[i&255]+Uo[i>>8&255]+Uo[i>>16&255]+Uo[i>>24&255]+"-"+Uo[e&255]+Uo[e>>8&255]+"-"+Uo[e>>16&15|64]+Uo[e>>24&255]+"-"+Uo[t&63|128]+Uo[t>>8&255]+"-"+Uo[t>>16&255]+Uo[t>>24&255]+Uo[n&255]+Uo[n>>8&255]+Uo[n>>16&255]+Uo[n>>24&255]).toLowerCase()}function In(i,e,t){return Math.max(e,Math.min(t,i))}function SL(i,e){return(i%e+e)%e}function uce(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function hce(i,e,t){return i!==e?(t-i)/(e-i):0}function gy(i,e,t){return(1-t)*i+t*e}function fce(i,e,t,n){return gy(i,e,1-Math.exp(-t*n))}function dce(i,e=1){return e-Math.abs(SL(i,e*2)-e)}function pce(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Ace(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function mce(i,e){return i+Math.floor(Math.random()*(e-i+1))}function gce(i,e){return i+Math.random()*(e-i)}function _ce(i){return i*(.5-Math.random())}function xce(i){i!==void 0&&(dH=i);let e=dH+=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 yce(i){return i*my}function vce(i){return i*Rf}function bce(i){return(i&i-1)===0&&i!==0}function wce(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Sce(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Tce(i,e,t,n,r){let s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),f=s((e-n)/2),p=o((e-n)/2),x=s((n-e)/2),v=o((n-e)/2);switch(r){case"XYX":i.set(a*u,l*f,l*p,a*c);break;case"YZY":i.set(l*p,a*u,l*f,a*c);break;case"ZXZ":i.set(l*f,l*p,a*u,a*c);break;case"XZX":i.set(a*u,l*v,l*x,a*c);break;case"YXY":i.set(l*x,a*u,l*v,a*c);break;case"ZYZ":i.set(l*v,l*x,a*u,a*c);break;default:je("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function ca(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Wn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var Xc={DEG2RAD:my,RAD2DEG:Rf,generateUUID:Uu,clamp:In,euclideanModulo:SL,mapLinear:uce,inverseLerp:hce,lerp:gy,damp:fce,pingpong:dce,smoothstep:pce,smootherstep:Ace,randInt:mce,randFloat:gce,randFloatSpread:_ce,seededRandom:xce,degToRad:yce,radToDeg:vce,isPowerOfTwo:bce,ceilPowerOfTwo:wce,floorPowerOfTwo:Sce,setQuaternionFromProperEuler:Tce,normalize:Wn,denormalize:ca},RL=class RL{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(In(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};RL.prototype.isVector2=!0;var Oe=RL,bs=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,o,a){let l=n[r+0],c=n[r+1],u=n[r+2],f=n[r+3],p=s[o+0],x=s[o+1],v=s[o+2],w=s[o+3];if(f!==w||l!==p||c!==x||u!==v){let S=l*p+c*x+u*v+f*w;S<0&&(p=-p,x=-x,v=-v,w=-w,S=-S);let T=1-a;if(S<.9995){let P=Math.acos(S),R=Math.sin(P);T=Math.sin(T*P)/R,a=Math.sin(a*P)/R,l=l*T+p*a,c=c*T+x*a,u=u*T+v*a,f=f*T+w*a}else{l=l*T+p*a,c=c*T+x*a,u=u*T+v*a,f=f*T+w*a;let P=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=P,c*=P,u*=P,f*=P}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,r,s,o){let a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],f=s[o],p=s[o+1],x=s[o+2],v=s[o+3];return e[t]=a*v+u*f+l*x-c*p,e[t+1]=l*v+u*p+c*f-a*x,e[t+2]=c*v+u*x+a*p-l*f,e[t+3]=u*v-a*f-l*p-c*x,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),f=a(s/2),p=l(n/2),x=l(r/2),v=l(s/2);switch(o){case"XYZ":this._x=p*u*f+c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f-p*x*v;break;case"YXZ":this._x=p*u*f+c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f+p*x*v;break;case"ZXY":this._x=p*u*f-c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f-p*x*v;break;case"ZYX":this._x=p*u*f-c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f+p*x*v;break;case"YZX":this._x=p*u*f+c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f-p*x*v;break;case"XZY":this._x=p*u*f-c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f+p*x*v;break;default:je("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],p=n+a+f;if(p>0){let x=.5/Math.sqrt(p+1);this._w=.25/x,this._x=(u-l)*x,this._y=(s-c)*x,this._z=(o-r)*x}else if(n>a&&n>f){let x=2*Math.sqrt(1+n-a-f);this._w=(u-l)/x,this._x=.25*x,this._y=(r+o)/x,this._z=(s+c)/x}else if(a>f){let x=2*Math.sqrt(1+a-n-f);this._w=(s-c)/x,this._x=(r+o)/x,this._y=.25*x,this._z=(l+u)/x}else{let x=2*Math.sqrt(1+f-n-a);this._w=(o-r)/x,this._x=(s+c)/x,this._y=(l+u)/x,this._z=.25*x}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(In(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){let c=Math.acos(a),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},PL=class PL{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(pH.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(pH.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),f=2*(s*n-o*t);return this.x=t+l*c+o*f-a*u,this.y=n+l*u+a*c-s*f,this.z=r+l*f+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this.z=In(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this.z=In(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return AN.copy(this).projectOnVector(e),this.sub(AN)}reflect(e){return this.sub(AN.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(In(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};PL.prototype.isVector3=!0;var ie=PL,AN=new ie,pH=new bs,IL=class IL{constructor(e,t,n,r,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c)}set(e,t,n,r,s,o,a,l,c){let u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],f=n[7],p=n[2],x=n[5],v=n[8],w=r[0],S=r[3],T=r[6],P=r[1],R=r[4],C=r[7],L=r[2],D=r[5],F=r[8];return s[0]=o*w+a*P+l*L,s[3]=o*S+a*R+l*D,s[6]=o*T+a*C+l*F,s[1]=c*w+u*P+f*L,s[4]=c*S+u*R+f*D,s[7]=c*T+u*C+f*F,s[2]=p*w+x*P+v*L,s[5]=p*S+x*R+v*D,s[8]=p*T+x*C+v*F,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,p=a*l-u*s,x=c*s-o*l,v=t*f+n*p+r*x;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);let w=1/v;return e[0]=f*w,e[1]=(r*c-u*n)*w,e[2]=(a*n-r*o)*w,e[3]=p*w,e[4]=(u*t-r*l)*w,e[5]=(r*s-a*t)*w,e[6]=x*w,e[7]=(n*l-c*t)*w,e[8]=(o*t-n*s)*w,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,o,a){let l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return Kn("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(mN.makeScale(e,t)),this}rotate(e){return Kn("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(mN.makeRotation(-e)),this}translate(e,t){return Kn("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(mN.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)}};IL.prototype.isMatrix3=!0;var Sn=IL,mN=new Sn,AH=new Sn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),mH=new Sn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Ece(){let i={enabled:!0,workingColorSpace:$d,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Bt&&(r.r=Ef(r.r),r.g=Ef(r.g),r.b=Ef(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Bt&&(r.r=h_(r.r),r.g=h_(r.g),r.b=h_(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===qo?Yd: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 Kn("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Kn("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({[$d]:{primaries:e,whitePoint:n,transfer:Yd,toXYZ:AH,fromXYZ:mH,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:yr},outputColorSpaceConfig:{drawingBufferColorSpace:yr}},[yr]:{primaries:e,whitePoint:n,transfer:Bt,toXYZ:AH,fromXYZ:mH,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:yr}}}),i}var sn=Ece();function Ef(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function h_(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var jg,vT=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{jg===void 0&&(jg=f_("canvas")),jg.width=e.width,jg.height=e.height;let r=jg.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=jg}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=f_("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]=Ef(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(Ef(t[n]/255)*255):t[n]=Ef(t[n]);return{data:t,width:e.width,height:e.height}}else return je("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},Mce=0,p_=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Mce++}),this.uuid=Uu(),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(gN(r[o].image)):s.push(gN(r[o]))}else s=gN(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function gN(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?vT.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(je("Texture: Unable to serialize Texture."),{})}var Cce=0,_N=new ie,ws=class i extends zo{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=Go,r=Go,s=bi,o=xo,a=vr,l=zi,c=i.DEFAULT_ANISOTROPY,u=qo){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Cce++}),this.uuid=Uu(),this.name="",this.source=new p_(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Oe(0,0),this.repeat=new Oe(1,1),this.center=new Oe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Sn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(_N).x}get height(){return this.source.getSize(_N).y}get depth(){return this.source.getSize(_N).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){je(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){je(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==_2)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Mf:e.x=e.x-Math.floor(e.x);break;case Go:e.x=e.x<0?0:1;break;case Cf: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 Mf:e.y=e.y-Math.floor(e.y);break;case Go:e.y=e.y<0?0:1;break;case Cf: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++}};ws.DEFAULT_IMAGE=null;ws.DEFAULT_MAPPING=_2;ws.DEFAULT_ANISOTROPY=1;var NL=class NL{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s,l=e.elements,c=l[0],u=l[4],f=l[8],p=l[1],x=l[5],v=l[9],w=l[2],S=l[6],T=l[10];if(Math.abs(u-p)<.01&&Math.abs(f-w)<.01&&Math.abs(v-S)<.01){if(Math.abs(u+p)<.1&&Math.abs(f+w)<.1&&Math.abs(v+S)<.1&&Math.abs(c+x+T-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let R=(c+1)/2,C=(x+1)/2,L=(T+1)/2,D=(u+p)/4,F=(f+w)/4,N=(v+S)/4;return R>C&&R>L?R<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(R),r=D/n,s=F/n):C>L?C<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(C),n=D/r,s=N/r):L<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(L),n=F/s,r=N/s),this.set(n,r,s,t),this}let P=Math.sqrt((S-v)*(S-v)+(f-w)*(f-w)+(p-u)*(p-u));return Math.abs(P)<.001&&(P=1),this.x=(S-v)/P,this.y=(f-w)/P,this.z=(p-u)/P,this.w=Math.acos((c+x+T-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this.z=In(this.z,e.z,t.z),this.w=In(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this.z=In(this.z,e,t),this.w=In(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};NL.prototype.isVector4=!0;var gn=NL,ua=class extends zo{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:bi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new gn(0,0,e,t),this.scissorTest=!1,this.viewport=new gn(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},s=new ws(r),o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:bi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let r=Object.assign({},e.textures[t].image);this.textures[t].source=new p_(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"})}},ha=class extends ua{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},vA=class extends ws{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=yi,this.minFilter=yi,this.wrapR=Go,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var bT=class extends ws{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=yi,this.minFilter=yi,this.wrapR=Go,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var WT=class WT{constructor(e,t,n,r,s,o,a,l,c,u,f,p,x,v,w,S){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c,u,f,p,x,v,w,S)}set(e,t,n,r,s,o,a,l,c,u,f,p,x,v,w,S){let T=this.elements;return T[0]=e,T[4]=t,T[8]=n,T[12]=r,T[1]=s,T[5]=o,T[9]=a,T[13]=l,T[2]=c,T[6]=u,T[10]=f,T[14]=p,T[3]=x,T[7]=v,T[11]=w,T[15]=S,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new WT().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/Xg.setFromMatrixColumn(e,0).length(),s=1/Xg.setFromMatrixColumn(e,1).length(),o=1/Xg.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){let p=o*u,x=o*f,v=a*u,w=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=x+v*c,t[5]=p-w*c,t[9]=-a*l,t[2]=w-p*c,t[6]=v+x*c,t[10]=o*l}else if(e.order==="YXZ"){let p=l*u,x=l*f,v=c*u,w=c*f;t[0]=p+w*a,t[4]=v*a-x,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=x*a-v,t[6]=w+p*a,t[10]=o*l}else if(e.order==="ZXY"){let p=l*u,x=l*f,v=c*u,w=c*f;t[0]=p-w*a,t[4]=-o*f,t[8]=v+x*a,t[1]=x+v*a,t[5]=o*u,t[9]=w-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){let p=o*u,x=o*f,v=a*u,w=a*f;t[0]=l*u,t[4]=v*c-x,t[8]=p*c+w,t[1]=l*f,t[5]=w*c+p,t[9]=x*c-v,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let p=o*l,x=o*c,v=a*l,w=a*c;t[0]=l*u,t[4]=w-p*f,t[8]=v*f+x,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=x*f+v,t[10]=p-w*f}else if(e.order==="XZY"){let p=o*l,x=o*c,v=a*l,w=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=p*f+w,t[5]=o*u,t[9]=x*f-v,t[2]=v*f-x,t[6]=a*u,t[10]=w*f+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Rce,e,Pce)}lookAt(e,t,n){let r=this.elements;return dl.subVectors(e,t),dl.lengthSq()===0&&(dl.z=1),dl.normalize(),kd.crossVectors(n,dl),kd.lengthSq()===0&&(Math.abs(n.z)===1?dl.x+=1e-4:dl.z+=1e-4,dl.normalize(),kd.crossVectors(n,dl)),kd.normalize(),zS.crossVectors(dl,kd),r[0]=kd.x,r[4]=zS.x,r[8]=dl.x,r[1]=kd.y,r[5]=zS.y,r[9]=dl.y,r[2]=kd.z,r[6]=zS.z,r[10]=dl.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],p=n[9],x=n[13],v=n[2],w=n[6],S=n[10],T=n[14],P=n[3],R=n[7],C=n[11],L=n[15],D=r[0],F=r[4],N=r[8],B=r[12],z=r[1],V=r[5],H=r[9],Z=r[13],J=r[2],j=r[6],K=r[10],ee=r[14],ae=r[3],ce=r[7],de=r[11],ve=r[15];return s[0]=o*D+a*z+l*J+c*ae,s[4]=o*F+a*V+l*j+c*ce,s[8]=o*N+a*H+l*K+c*de,s[12]=o*B+a*Z+l*ee+c*ve,s[1]=u*D+f*z+p*J+x*ae,s[5]=u*F+f*V+p*j+x*ce,s[9]=u*N+f*H+p*K+x*de,s[13]=u*B+f*Z+p*ee+x*ve,s[2]=v*D+w*z+S*J+T*ae,s[6]=v*F+w*V+S*j+T*ce,s[10]=v*N+w*H+S*K+T*de,s[14]=v*B+w*Z+S*ee+T*ve,s[3]=P*D+R*z+C*J+L*ae,s[7]=P*F+R*V+C*j+L*ce,s[11]=P*N+R*H+C*K+L*de,s[15]=P*B+R*Z+C*ee+L*ve,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],p=e[10],x=e[14],v=e[3],w=e[7],S=e[11],T=e[15],P=l*x-c*p,R=a*x-c*f,C=a*p-l*f,L=o*x-c*u,D=o*p-l*u,F=o*f-a*u;return t*(w*P-S*R+T*C)-n*(v*P-S*L+T*D)+r*(v*R-w*L+T*F)-s*(v*C-w*D+S*F)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],u=e[10];return t*(o*u-a*c)-n*(s*u-a*l)+r*(s*c-o*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],p=e[10],x=e[11],v=e[12],w=e[13],S=e[14],T=e[15],P=t*a-n*o,R=t*l-r*o,C=t*c-s*o,L=n*l-r*a,D=n*c-s*a,F=r*c-s*l,N=u*w-f*v,B=u*S-p*v,z=u*T-x*v,V=f*S-p*w,H=f*T-x*w,Z=p*T-x*S,J=P*Z-R*H+C*V+L*z-D*B+F*N;if(J===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let j=1/J;return e[0]=(a*Z-l*H+c*V)*j,e[1]=(r*H-n*Z-s*V)*j,e[2]=(w*F-S*D+T*L)*j,e[3]=(p*D-f*F-x*L)*j,e[4]=(l*z-o*Z-c*B)*j,e[5]=(t*Z-r*z+s*B)*j,e[6]=(S*C-v*F-T*R)*j,e[7]=(u*F-p*C+x*R)*j,e[8]=(o*H-a*z+c*N)*j,e[9]=(n*z-t*H-s*N)*j,e[10]=(v*D-w*C+T*P)*j,e[11]=(f*C-u*D-x*P)*j,e[12]=(a*B-o*V-l*N)*j,e[13]=(t*V-n*B+r*N)*j,e[14]=(w*R-v*L-S*P)*j,e[15]=(u*L-f*R+p*P)*j,this}scale(e){let t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+n,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,p=s*c,x=s*u,v=s*f,w=o*u,S=o*f,T=a*f,P=l*c,R=l*u,C=l*f,L=n.x,D=n.y,F=n.z;return r[0]=(1-(w+T))*L,r[1]=(x+C)*L,r[2]=(v-R)*L,r[3]=0,r[4]=(x-C)*D,r[5]=(1-(p+T))*D,r[6]=(S+P)*D,r[7]=0,r[8]=(v+R)*F,r[9]=(S-P)*F,r[10]=(1-(p+w))*F,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let o=Xg.set(r[0],r[1],r[2]).length(),a=Xg.set(r[4],r[5],r[6]).length(),l=Xg.set(r[8],r[9],r[10]).length();s<0&&(o=-o),Gc.copy(this);let c=1/o,u=1/a,f=1/l;return Gc.elements[0]*=c,Gc.elements[1]*=c,Gc.elements[2]*=c,Gc.elements[4]*=u,Gc.elements[5]*=u,Gc.elements[6]*=u,Gc.elements[8]*=f,Gc.elements[9]*=f,Gc.elements[10]*=f,t.setFromRotationMatrix(Gc),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=mo,l=!1){let c=this.elements,u=2*s/(t-e),f=2*s/(n-r),p=(t+e)/(t-e),x=(n+r)/(n-r),v,w;if(l)v=s/(o-s),w=o*s/(o-s);else if(a===mo)v=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===Ha)v=-o/(o-s),w=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=p,c[12]=0,c[1]=0,c[5]=f,c[9]=x,c[13]=0,c[2]=0,c[6]=0,c[10]=v,c[14]=w,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=mo,l=!1){let c=this.elements,u=2/(t-e),f=2/(n-r),p=-(t+e)/(t-e),x=-(n+r)/(n-r),v,w;if(l)v=1/(o-s),w=o/(o-s);else if(a===mo)v=-2/(o-s),w=-(o+s)/(o-s);else if(a===Ha)v=-1/(o-s),w=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=0,c[12]=p,c[1]=0,c[5]=f,c[9]=0,c[13]=x,c[2]=0,c[6]=0,c[10]=v,c[14]=w,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};WT.prototype.isMatrix4=!0;var on=WT,Xg=new ie,Gc=new on,Rce=new ie(0,0,0),Pce=new ie(1,1,1),kd=new ie,zS=new ie,dl=new ie,gH=new on,_H=new bs,fa=class i{constructor(e=0,t=0,n=0,r=i.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],p=r[6],x=r[10];switch(t){case"XYZ":this._y=Math.asin(In(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,x),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-In(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,x),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(In(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,x),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-In(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,x),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(In(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,x));break;case"XZY":this._z=Math.asin(-In(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,x),this._y=0);break;default:je("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return gH.makeRotationFromQuaternion(e),this.setFromRotationMatrix(gH,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return _H.setFromEuler(this),this.setFromQuaternion(_H,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}};fa.DEFAULT_ORDER="XYZ";var A_=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}},Ice=0,xH=new ie,$g=new bs,_f=new on,VS=new ie,ay=new ie,Nce=new ie,Lce=new bs,yH=new ie(1,0,0),vH=new ie(0,1,0),bH=new ie(0,0,1),wH={type:"added"},Dce={type:"removed"},Yg={type:"childadded",child:null},xN={type:"childremoved",child:null},Yi=class i extends zo{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ice++}),this.uuid=Uu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new ie,t=new fa,n=new bs,r=new ie(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new on},normalMatrix:{value:new Sn}}),this.matrix=new on,this.matrixWorld=new on,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new A_,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 $g.setFromAxisAngle(e,t),this.quaternion.multiply($g),this}rotateOnWorldAxis(e,t){return $g.setFromAxisAngle(e,t),this.quaternion.premultiply($g),this}rotateX(e){return this.rotateOnAxis(yH,e)}rotateY(e){return this.rotateOnAxis(vH,e)}rotateZ(e){return this.rotateOnAxis(bH,e)}translateOnAxis(e,t){return xH.copy(e).applyQuaternion(this.quaternion),this.position.add(xH.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(yH,e)}translateY(e){return this.translateOnAxis(vH,e)}translateZ(e){return this.translateOnAxis(bH,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(_f.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?VS.copy(e):VS.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),ay.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?_f.lookAt(ay,VS,this.up):_f.lookAt(VS,ay,this.up),this.quaternion.setFromRotationMatrix(_f),r&&(_f.extractRotation(r.matrixWorld),$g.setFromRotationMatrix(_f),this.quaternion.premultiply($g.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Ge("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(wH),Yg.child=e,this.dispatchEvent(Yg),Yg.child=null):Ge("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Dce),xN.child=e,this.dispatchEvent(xN),xN.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),_f.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),_f.multiply(e.parent.matrixWorld)),e.applyMatrix4(_f),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(wH),Yg.child=e,this.dispatchEvent(Yg),Yg.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(ay,e,Nce),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ay,Lce,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let s=this.children;for(let o=0,a=s.length;o<a;o++)s[o].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(a=>({...a})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){let f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){let a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),f=o(e.shapes),p=o(e.skeletons),x=o(e.animations),v=o(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),p.length>0&&(n.skeletons=p),x.length>0&&(n.animations=x),v.length>0&&(n.nodes=v)}return n.object=r,n;function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let r=e.children[n];this.add(r.clone())}return this}};Yi.DEFAULT_UP=new ie(0,1,0);Yi.DEFAULT_MATRIX_AUTO_UPDATE=!0;Yi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Lr=class extends Yi{constructor(){super(),this.isGroup=!0,this.type="Group"}},Fce={type:"move"},Kd=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Lr,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 Lr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ie,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ie),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Lr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ie,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ie,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(let w of e.hand.values()){let S=t.getJointPose(w,n),T=this._getHandJoint(c,w);S!==null&&(T.matrix.fromArray(S.transform.matrix),T.matrix.decompose(T.position,T.rotation,T.scale),T.matrixWorldNeedsUpdate=!0,T.jointRadius=S.radius),T.visible=S!==null}let u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=u.position.distanceTo(f.position),x=.02,v=.005;c.inputState.pinching&&p>x+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=x-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Fce)))}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 Lr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},aW={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},Gd={h:0,s:0,l:0},qS={h:0,s:0,l:0};function yN(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}var Ut=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=yr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,sn.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=sn.workingColorSpace){return this.r=e,this.g=t,this.b=n,sn.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=sn.workingColorSpace){if(e=SL(e,1),t=In(t,0,1),n=In(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=yN(o,s,e+1/3),this.g=yN(o,s,e),this.b=yN(o,s,e-1/3)}return sn.colorSpaceToWorking(this,r),this}setStyle(e,t=yr){function n(s){s!==void 0&&parseFloat(s)<1&&je("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:je("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);je("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=yr){let n=aW[e.toLowerCase()];return n!==void 0?this.setHex(n,t):je("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Ef(e.r),this.g=Ef(e.g),this.b=Ef(e.b),this}copyLinearToSRGB(e){return this.r=h_(e.r),this.g=h_(e.g),this.b=h_(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=yr){return sn.workingToColorSpace(ko.copy(this),e),Math.round(In(ko.r*255,0,255))*65536+Math.round(In(ko.g*255,0,255))*256+Math.round(In(ko.b*255,0,255))}getHexString(e=yr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=sn.workingColorSpace){sn.workingToColorSpace(ko.copy(this),t);let n=ko.r,r=ko.g,s=ko.b,o=Math.max(n,r,s),a=Math.min(n,r,s),l,c,u=(a+o)/2;if(a===o)l=0,c=0;else{let f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case n:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-n)/f+2;break;case s:l=(n-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=sn.workingColorSpace){return sn.workingToColorSpace(ko.copy(this),t),e.r=ko.r,e.g=ko.g,e.b=ko.b,e}getStyle(e=yr){sn.workingToColorSpace(ko.copy(this),e);let t=ko.r,n=ko.g,r=ko.b;return e!==yr?`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(Gd),this.setHSL(Gd.h+e,Gd.s+t,Gd.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(Gd),e.getHSL(qS);let n=gy(Gd.h,qS.h,t),r=gy(Gd.s,qS.s,t),s=gy(Gd.l,qS.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}},ko=new Ut;Ut.NAMES=aW;var Qd=class extends Yi{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 fa,this.environmentIntensity=1,this.environmentRotation=new fa,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}},zc=new ie,xf=new ie,vN=new ie,yf=new ie,Zg=new ie,Kg=new ie,SH=new ie,bN=new ie,wN=new ie,SN=new ie,TN=new gn,EN=new gn,MN=new gn,Sf=class i{constructor(e=new ie,t=new ie,n=new ie){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),zc.subVectors(e,t),r.cross(zc);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){zc.subVectors(r,t),xf.subVectors(n,t),vN.subVectors(e,t);let o=zc.dot(zc),a=zc.dot(xf),l=zc.dot(vN),c=xf.dot(xf),u=xf.dot(vN),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;let p=1/f,x=(c*l-a*u)*p,v=(o*u-a*l)*p;return s.set(1-x-v,v,x)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,yf)===null?!1:yf.x>=0&&yf.y>=0&&yf.x+yf.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,yf)===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,yf.x),l.addScaledVector(o,yf.y),l.addScaledVector(a,yf.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return TN.setScalar(0),EN.setScalar(0),MN.setScalar(0),TN.fromBufferAttribute(e,t),EN.fromBufferAttribute(e,n),MN.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(TN,s.x),o.addScaledVector(EN,s.y),o.addScaledVector(MN,s.z),o}static isFrontFacing(e,t,n,r){return zc.subVectors(n,t),xf.subVectors(e,t),zc.cross(xf).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 zc.subVectors(this.c,this.b),xf.subVectors(this.a,this.b),zc.cross(xf).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;Zg.subVectors(r,n),Kg.subVectors(s,n),bN.subVectors(e,n);let l=Zg.dot(bN),c=Kg.dot(bN);if(l<=0&&c<=0)return t.copy(n);wN.subVectors(e,r);let u=Zg.dot(wN),f=Kg.dot(wN);if(u>=0&&f<=u)return t.copy(r);let p=l*f-u*c;if(p<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(Zg,o);SN.subVectors(e,s);let x=Zg.dot(SN),v=Kg.dot(SN);if(v>=0&&x<=v)return t.copy(s);let w=x*c-l*v;if(w<=0&&c>=0&&v<=0)return a=c/(c-v),t.copy(n).addScaledVector(Kg,a);let S=u*v-x*f;if(S<=0&&f-u>=0&&x-v>=0)return SH.subVectors(s,r),a=(f-u)/(f-u+(x-v)),t.copy(r).addScaledVector(SH,a);let T=1/(S+w+p);return o=w*T,a=p*T,t.copy(n).addScaledVector(Zg,o).addScaledVector(Kg,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},da=class{constructor(e=new ie(1/0,1/0,1/0),t=new ie(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Vc.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Vc.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=Vc.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,Vc):Vc.fromBufferAttribute(s,o),Vc.applyMatrix4(e.matrixWorld),this.expandByPoint(Vc);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),HS.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),HS.copy(n.boundingBox)),HS.applyMatrix4(e.matrixWorld),this.union(HS)}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,Vc),Vc.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(ly),WS.subVectors(this.max,ly),Qg.subVectors(e.a,ly),Jg.subVectors(e.b,ly),e_.subVectors(e.c,ly),zd.subVectors(Jg,Qg),Vd.subVectors(e_,Jg),cA.subVectors(Qg,e_);let t=[0,-zd.z,zd.y,0,-Vd.z,Vd.y,0,-cA.z,cA.y,zd.z,0,-zd.x,Vd.z,0,-Vd.x,cA.z,0,-cA.x,-zd.y,zd.x,0,-Vd.y,Vd.x,0,-cA.y,cA.x,0];return!CN(t,Qg,Jg,e_,WS)||(t=[1,0,0,0,1,0,0,0,1],!CN(t,Qg,Jg,e_,WS))?!1:(jS.crossVectors(zd,Vd),t=[jS.x,jS.y,jS.z],CN(t,Qg,Jg,e_,WS))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Vc).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Vc).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:(vf[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),vf[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),vf[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),vf[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),vf[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),vf[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),vf[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),vf[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(vf),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}},vf=[new ie,new ie,new ie,new ie,new ie,new ie,new ie,new ie],Vc=new ie,HS=new da,Qg=new ie,Jg=new ie,e_=new ie,zd=new ie,Vd=new ie,cA=new ie,ly=new ie,WS=new ie,jS=new ie,uA=new ie;function CN(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){uA.fromArray(i,s);let a=r.x*Math.abs(uA.x)+r.y*Math.abs(uA.y)+r.z*Math.abs(uA.z),l=e.dot(uA),c=t.dot(uA),u=n.dot(uA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var Tf=Oce();function Oce(){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 pl(i){Math.abs(i)>65504&&je("DataUtils.toHalfFloat(): Value out of range."),i=In(i,-65504,65504),Tf.floatView[0]=i;let e=Tf.uint32View[0],t=e>>23&511;return Tf.baseTable[t]+((e&8388607)>>Tf.shiftTable[t])}function XS(i){let e=i>>10;return Tf.uint32View[0]=Tf.mantissaTable[Tf.offsetTable[e]+(i&1023)]+Tf.exponentTable[e],Tf.floatView[0]}var ys=new ie,$S=new Oe,Bce=0,Li=class extends zo{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:Bce++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Zd,this.updateRanges=[],this.gpuType=Zi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)$S.fromBufferAttribute(this,t),$S.applyMatrix3(e),this.setXY(t,$S.x,$S.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)ys.fromBufferAttribute(this,t),ys.applyMatrix3(e),this.setXYZ(t,ys.x,ys.y,ys.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)ys.fromBufferAttribute(this,t),ys.applyMatrix4(e),this.setXYZ(t,ys.x,ys.y,ys.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)ys.fromBufferAttribute(this,t),ys.applyNormalMatrix(e),this.setXYZ(t,ys.x,ys.y,ys.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)ys.fromBufferAttribute(this,t),ys.transformDirection(e),this.setXYZ(t,ys.x,ys.y,ys.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=ca(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Wn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ca(t,this.array)),t}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ca(t,this.array)),t}setY(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=ca(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=ca(t,this.array)),t}setW(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Zd&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var bA=class extends Li{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var wA=class extends Li{constructor(e,t,n){super(new Uint32Array(e),t,n)}},m_=class extends Li{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=XS(this.array[e*this.itemSize]);return this.normalized&&(t=ca(t,this.array)),t}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize]=pl(t),this}getY(e){let t=XS(this.array[e*this.itemSize+1]);return this.normalized&&(t=ca(t,this.array)),t}setY(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+1]=pl(t),this}getZ(e){let t=XS(this.array[e*this.itemSize+2]);return this.normalized&&(t=ca(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+2]=pl(t),this}getW(e){let t=XS(this.array[e*this.itemSize+3]);return this.normalized&&(t=ca(t,this.array)),t}setW(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+3]=pl(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array)),this.array[e+0]=pl(t),this.array[e+1]=pl(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array)),this.array[e+0]=pl(t),this.array[e+1]=pl(n),this.array[e+2]=pl(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(s,this.array)),this.array[e+0]=pl(t),this.array[e+1]=pl(n),this.array[e+2]=pl(r),this.array[e+3]=pl(s),this}},Rn=class extends Li{constructor(e,t,n){super(new Float32Array(e),t,n)}},Uce=new da,cy=new ie,RN=new ie,Wa=class{constructor(e=new ie,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):Uce.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;cy.subVectors(e,this.center);let t=cy.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(cy,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):(RN.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(cy.copy(e.center).add(RN)),this.expandByPoint(cy.copy(e.center).sub(RN))),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}},kce=0,Jl=new on,PN=new Yi,t_=new ie,Al=new da,uy=new da,Js=new ie,qn=class i extends zo{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:kce++}),this.uuid=Uu(),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(cce(e)?wA: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 Sn().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return Jl.makeRotationFromQuaternion(e),this.applyMatrix4(Jl),this}rotateX(e){return Jl.makeRotationX(e),this.applyMatrix4(Jl),this}rotateY(e){return Jl.makeRotationY(e),this.applyMatrix4(Jl),this}rotateZ(e){return Jl.makeRotationZ(e),this.applyMatrix4(Jl),this}translate(e,t,n){return Jl.makeTranslation(e,t,n),this.applyMatrix4(Jl),this}scale(e,t,n){return Jl.makeScale(e,t,n),this.applyMatrix4(Jl),this}lookAt(e){return PN.lookAt(e),PN.updateMatrix(),this.applyMatrix4(PN.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(t_).negate(),this.translate(t_.x,t_.y,t_.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let r=0,s=e.length;r<s;r++){let o=e[r];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Rn(n,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&je("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new da);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ie(-1/0,-1/0,-1/0),new ie(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){let s=t[n];Al.setFromBufferAttribute(s),this.morphTargetsRelative?(Js.addVectors(this.boundingBox.min,Al.min),this.boundingBox.expandByPoint(Js),Js.addVectors(this.boundingBox.max,Al.max),this.boundingBox.expandByPoint(Js)):(this.boundingBox.expandByPoint(Al.min),this.boundingBox.expandByPoint(Al.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ge('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Wa);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new ie,1/0);return}if(e){let n=this.boundingSphere.center;if(Al.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];uy.setFromBufferAttribute(a),this.morphTargetsRelative?(Js.addVectors(Al.min,uy.min),Al.expandByPoint(Js),Js.addVectors(Al.max,uy.max),Al.expandByPoint(Js)):(Al.expandByPoint(uy.min),Al.expandByPoint(uy.max))}Al.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)Js.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Js));if(t)for(let s=0,o=t.length;s<o;s++){let a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)Js.fromBufferAttribute(a,c),l&&(t_.fromBufferAttribute(e,c),Js.add(t_)),r=Math.max(r,n.distanceToSquared(Js))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Ge('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Ge("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,r=t.normal,s=t.uv,o=this.getAttribute("tangent");(o===void 0||o.count!==n.count)&&(o=new Li(new Float32Array(4*n.count),4),this.setAttribute("tangent",o));let a=[],l=[];for(let N=0;N<n.count;N++)a[N]=new ie,l[N]=new ie;let c=new ie,u=new ie,f=new ie,p=new Oe,x=new Oe,v=new Oe,w=new ie,S=new ie;function T(N,B,z){c.fromBufferAttribute(n,N),u.fromBufferAttribute(n,B),f.fromBufferAttribute(n,z),p.fromBufferAttribute(s,N),x.fromBufferAttribute(s,B),v.fromBufferAttribute(s,z),u.sub(c),f.sub(c),x.sub(p),v.sub(p);let V=1/(x.x*v.y-v.x*x.y);isFinite(V)&&(w.copy(u).multiplyScalar(v.y).addScaledVector(f,-x.y).multiplyScalar(V),S.copy(f).multiplyScalar(x.x).addScaledVector(u,-v.x).multiplyScalar(V),a[N].add(w),a[B].add(w),a[z].add(w),l[N].add(S),l[B].add(S),l[z].add(S))}let P=this.groups;P.length===0&&(P=[{start:0,count:e.count}]);for(let N=0,B=P.length;N<B;++N){let z=P[N],V=z.start,H=z.count;for(let Z=V,J=V+H;Z<J;Z+=3)T(e.getX(Z+0),e.getX(Z+1),e.getX(Z+2))}let R=new ie,C=new ie,L=new ie,D=new ie;function F(N){L.fromBufferAttribute(r,N),D.copy(L);let B=a[N];R.copy(B),R.sub(L.multiplyScalar(L.dot(B))).normalize(),C.crossVectors(D,B);let V=C.dot(l[N])<0?-1:1;o.setXYZW(N,R.x,R.y,R.z,V)}for(let N=0,B=P.length;N<B;++N){let z=P[N],V=z.start,H=z.count;for(let Z=V,J=V+H;Z<J;Z+=3)F(e.getX(Z+0)),F(e.getX(Z+1)),F(e.getX(Z+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new Li(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let p=0,x=n.count;p<x;p++)n.setXYZ(p,0,0,0);let r=new ie,s=new ie,o=new ie,a=new ie,l=new ie,c=new ie,u=new ie,f=new ie;if(e)for(let p=0,x=e.count;p<x;p+=3){let v=e.getX(p+0),w=e.getX(p+1),S=e.getX(p+2);r.fromBufferAttribute(t,v),s.fromBufferAttribute(t,w),o.fromBufferAttribute(t,S),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),a.fromBufferAttribute(n,v),l.fromBufferAttribute(n,w),c.fromBufferAttribute(n,S),a.add(u),l.add(u),c.add(u),n.setXYZ(v,a.x,a.y,a.z),n.setXYZ(w,l.x,l.y,l.z),n.setXYZ(S,c.x,c.y,c.z)}else for(let p=0,x=t.count;p<x;p+=3)r.fromBufferAttribute(t,p+0),s.fromBufferAttribute(t,p+1),o.fromBufferAttribute(t,p+2),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),n.setXYZ(p+0,u.x,u.y,u.z),n.setXYZ(p+1,u.x,u.y,u.z),n.setXYZ(p+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Js.fromBufferAttribute(e,t),Js.normalize(),e.setXYZ(t,Js.x,Js.y,Js.z)}toNonIndexed(){function e(a,l){let c=a.array,u=a.itemSize,f=a.normalized,p=new c.constructor(l.length*u),x=0,v=0;for(let w=0,S=l.length;w<S;w++){a.isInterleavedBufferAttribute?x=l[w]*a.data.stride+a.offset:x=l[w]*u;for(let T=0;T<u;T++)p[v++]=c[x++]}return new Li(p,u,f)}if(this.index===null)return je("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new i,n=this.index.array,r=this.attributes;for(let a in r){let l=r[a],c=e(l,n);t.setAttribute(a,c)}let s=this.morphAttributes;for(let a in s){let l=[],c=s[a];for(let u=0,f=c.length;u<f;u++){let p=c[u],x=e(p,n);l.push(x)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,l=o.length;a<l;a++){let c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let f=0,p=c.length;f<p;f++){let x=c[f];u.push(x.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let c in r){let u=r[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],f=s[c];for(let p=0,x=f.length;p<x;p++)u.push(f[p].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let c=0,u=o.length;c<u;c++){let f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},Pf=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Zd,this.updateRanges=[],this.version=0,this.uuid=Uu()}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=Uu()),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=Uu()),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}}},aa=new ie,_o=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++)aa.fromBufferAttribute(this,t),aa.applyMatrix4(e),this.setXYZ(t,aa.x,aa.y,aa.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)aa.fromBufferAttribute(this,t),aa.applyNormalMatrix(e),this.setXYZ(t,aa.x,aa.y,aa.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)aa.fromBufferAttribute(this,t),aa.transformDirection(e),this.setXYZ(t,aa.x,aa.y,aa.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=ca(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Wn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=ca(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=ca(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=ca(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=ca(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){yA("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 Li(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){yA("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}}},Gce=0,Ss=class extends zo{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Gce++}),this.uuid=Uu(),this.name="",this.type="Material",this.blending=os,this.side=go,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=jd,this.blendDst=Xd,this.blendEquation=Gs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ut(0,0,0),this.blendAlpha=0,this.depthFunc=ku,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=vy,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=wf,this.stencilZFail=wf,this.stencilZPass=wf,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){je(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){je(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==os&&(n.blending=this.blending),this.side!==go&&(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!==jd&&(n.blendSrc=this.blendSrc),this.blendDst!==Xd&&(n.blendDst=this.blendDst),this.blendEquation!==Gs&&(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!==ku&&(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!==vy&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==wf&&(n.stencilFail=this.stencilFail),this.stencilZFail!==wf&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==wf&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Ut().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Oe().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Oe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},If=class extends Ss{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ut(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},n_,hy=new ie,i_=new ie,r_=new ie,s_=new Oe,fy=new Oe,lW=new on,YS=new ie,dy=new ie,ZS=new ie,TH=new Oe,IN=new Oe,EH=new Oe,g_=class extends Yi{constructor(e=new If){if(super(),this.isSprite=!0,this.type="Sprite",n_===void 0){n_=new qn;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Pf(t,5);n_.setIndex([0,1,2,0,2,3]),n_.setAttribute("position",new _o(n,3,0,!1)),n_.setAttribute("uv",new _o(n,2,3,!1))}this.geometry=n_,this.material=e,this.center=new Oe(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Ge('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),i_.setFromMatrixScale(this.matrixWorld),lW.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),r_.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&i_.multiplyScalar(-r_.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;KS(YS.set(-.5,-.5,0),r_,o,i_,r,s),KS(dy.set(.5,-.5,0),r_,o,i_,r,s),KS(ZS.set(.5,.5,0),r_,o,i_,r,s),TH.set(0,0),IN.set(1,0),EH.set(1,1);let a=e.ray.intersectTriangle(YS,dy,ZS,!1,hy);if(a===null&&(KS(dy.set(-.5,.5,0),r_,o,i_,r,s),IN.set(0,1),a=e.ray.intersectTriangle(YS,ZS,dy,!1,hy),a===null))return;let l=e.ray.origin.distanceTo(hy);l<e.near||l>e.far||t.push({distance:l,point:hy.clone(),uv:Sf.getInterpolation(hy,YS,dy,ZS,TH,IN,EH,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 KS(i,e,t,n,r,s){s_.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(fy.x=s*s_.x-r*s_.y,fy.y=r*s_.x+s*s_.y):fy.copy(s_),i.copy(e),i.x+=fy.x,i.y+=fy.y,i.applyMatrix4(lW)}var bf=new ie,NN=new ie,QS=new ie,qd=new ie,LN=new ie,JS=new ie,DN=new ie,Nf=class{constructor(e=new ie,t=new ie(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,bf)),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=bf.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(bf.copy(this.origin).addScaledVector(this.direction,t),bf.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){NN.copy(e).add(t).multiplyScalar(.5),QS.copy(t).sub(e).normalize(),qd.copy(this.origin).sub(NN);let s=e.distanceTo(t)*.5,o=-this.direction.dot(QS),a=qd.dot(this.direction),l=-qd.dot(QS),c=qd.lengthSq(),u=Math.abs(1-o*o),f,p,x,v;if(u>0)if(f=o*l-a,p=o*a-l,v=s*u,f>=0)if(p>=-v)if(p<=v){let w=1/u;f*=w,p*=w,x=f*(f+o*p+2*a)+p*(o*f+p+2*l)+c}else p=s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;else p<=-v?(f=Math.max(0,-(-o*s+a)),p=f>0?-s:Math.min(Math.max(-s,-l),s),x=-f*f+p*(p+2*l)+c):p<=v?(f=0,p=Math.min(Math.max(-s,-l),s),x=p*(p+2*l)+c):(f=Math.max(0,-(o*s+a)),p=f>0?s:Math.min(Math.max(-s,-l),s),x=-f*f+p*(p+2*l)+c);else p=o>0?-s:s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(NN).addScaledVector(QS,p),x}intersectSphere(e,t){bf.subVectors(e.center,this.origin);let n=bf.dot(this.direction),r=bf.dot(bf)-n*n,s=e.radius*e.radius;if(r>s)return null;let o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,o,a,l,c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,p=this.origin;return c>=0?(n=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(n=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),u>=0?(s=(e.min.y-p.y)*u,o=(e.max.y-p.y)*u):(s=(e.max.y-p.y)*u,o=(e.min.y-p.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),f>=0?(a=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(a=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),n>l||a>r)||((a>n||n!==n)&&(n=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,bf)!==null}intersectTriangle(e,t,n,r,s){LN.subVectors(t,e),JS.subVectors(n,e),DN.crossVectors(LN,JS);let o=this.direction.dot(DN),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;qd.subVectors(this.origin,e);let l=a*this.direction.dot(JS.crossVectors(qd,JS));if(l<0)return null;let c=a*this.direction.dot(LN.cross(qd));if(c<0||l+c>o)return null;let u=-a*qd.dot(DN);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)}},as=class extends Ss{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new fa,this.combine=FA,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}},MH=new on,hA=new Nf,eT=new Wa,CH=new ie,tT=new ie,nT=new ie,iT=new ie,FN=new ie,rT=new ie,RH=new ie,sT=new ie,Gn=class extends Yi{constructor(e=new qn,t=new as){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){rT.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(FN.fromBufferAttribute(f,e),o?rT.addScaledVector(FN,u):rT.addScaledVector(FN.sub(t),u))}t.add(rT)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),eT.copy(n.boundingSphere),eT.applyMatrix4(s),hA.copy(e.ray).recast(e.near),!(eT.containsPoint(hA.origin)===!1&&(hA.intersectSphere(eT,CH)===null||hA.origin.distanceToSquared(CH)>(e.far-e.near)**2))&&(MH.copy(s).invert(),hA.copy(e.ray).applyMatrix4(MH),!(n.boundingBox!==null&&hA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,hA)))}_computeIntersections(e,t,n){let r,s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,p=s.groups,x=s.drawRange;if(a!==null)if(Array.isArray(o))for(let v=0,w=p.length;v<w;v++){let S=p[v],T=o[S.materialIndex],P=Math.max(S.start,x.start),R=Math.min(a.count,Math.min(S.start+S.count,x.start+x.count));for(let C=P,L=R;C<L;C+=3){let D=a.getX(C),F=a.getX(C+1),N=a.getX(C+2);r=oT(this,T,e,n,c,u,f,D,F,N),r&&(r.faceIndex=Math.floor(C/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let v=Math.max(0,x.start),w=Math.min(a.count,x.start+x.count);for(let S=v,T=w;S<T;S+=3){let P=a.getX(S),R=a.getX(S+1),C=a.getX(S+2);r=oT(this,o,e,n,c,u,f,P,R,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let v=0,w=p.length;v<w;v++){let S=p[v],T=o[S.materialIndex],P=Math.max(S.start,x.start),R=Math.min(l.count,Math.min(S.start+S.count,x.start+x.count));for(let C=P,L=R;C<L;C+=3){let D=C,F=C+1,N=C+2;r=oT(this,T,e,n,c,u,f,D,F,N),r&&(r.faceIndex=Math.floor(C/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let v=Math.max(0,x.start),w=Math.min(l.count,x.start+x.count);for(let S=v,T=w;S<T;S+=3){let P=S,R=S+1,C=S+2;r=oT(this,o,e,n,c,u,f,P,R,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function zce(i,e,t,n,r,s,o,a){let l;if(e.side===ui?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===go,a),l===null)return null;sT.copy(a),sT.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(sT);return c<t.near||c>t.far?null:{distance:c,point:sT.clone(),object:i}}function oT(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,tT),i.getVertexPosition(l,nT),i.getVertexPosition(c,iT);let u=zce(i,e,t,n,tT,nT,iT,RH);if(u){let f=new ie;Sf.getBarycoord(RH,tT,nT,iT,f),r&&(u.uv=Sf.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=Sf.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=Sf.getInterpolatedAttribute(o,a,l,c,f,new ie),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let p={a,b:l,c,normal:new ie,materialIndex:0};Sf.getNormal(tT,nT,iT,p.normal),u.face=p,u.barycoord=f}return u}var SA=class extends ws{constructor(e=null,t=1,n=1,r,s,o,a,l,c=yi,u=yi,f,p){super(null,o,a,l,c,u,r,s,f,p),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var ml=class extends Li{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 ON=new ie,Vce=new ie,qce=new Sn,la=class{constructor(e=new ie(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=ON.subVectors(n,t).cross(Vce.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(ON),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||qce.getNormalMatrix(e),r=this.coplanarPoint(ON).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)}},fA=new Wa,Hce=new Oe(.5,.5),aT=new ie,ec=class{constructor(e=new la,t=new la,n=new la,r=new la,s=new la,o=new la){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=mo,n=!1){let r=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],u=s[4],f=s[5],p=s[6],x=s[7],v=s[8],w=s[9],S=s[10],T=s[11],P=s[12],R=s[13],C=s[14],L=s[15];if(r[0].setComponents(c-o,x-u,T-v,L-P).normalize(),r[1].setComponents(c+o,x+u,T+v,L+P).normalize(),r[2].setComponents(c+a,x+f,T+w,L+R).normalize(),r[3].setComponents(c-a,x-f,T-w,L-R).normalize(),n)r[4].setComponents(l,p,S,C).normalize(),r[5].setComponents(c-l,x-p,T-S,L-C).normalize();else if(r[4].setComponents(c-l,x-p,T-S,L-C).normalize(),t===mo)r[5].setComponents(c+l,x+p,T+S,L+C).normalize();else if(t===Ha)r[5].setComponents(l,p,S,C).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),fA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),fA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(fA)}intersectsSprite(e){fA.center.set(0,0,0);let t=Hce.distanceTo(e.center);return fA.radius=.7071067811865476+t,fA.applyMatrix4(e.matrixWorld),this.intersectsSphere(fA)}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(aT.x=r.normal.x>0?e.max.x:e.min.x,aT.y=r.normal.y>0?e.max.y:e.min.y,aT.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(aT)<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)}},PH=new on,by=class i{constructor(){this.coordinateSystem=mo,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];PH.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new ec),n[r].setFromProjectionMatrix(PH,s.coordinateSystem,s.reversedDepth)}return this._count=t.length,this}intersectsObject(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsObject(e))return!0;return!1}intersectsSprite(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSprite(e))return!0;return!1}intersectsSphere(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSphere(e))return!0;return!1}intersectsBox(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsBox(e))return!0;return!1}containsPoint(e){let t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;let t=this._frustums,n=e._frustums;for(let r=0;r<e._count;r++)t[r]===void 0&&(t[r]=new ec),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var gl=class extends Ss{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ut(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},wT=new ie,ST=new ie,IH=new on,py=new Nf,lT=new Wa,BN=new ie,NH=new ie,Lf=class extends Yi{constructor(e=new qn,t=new gl){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++)wT.fromBufferAttribute(t,r-1),ST.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=wT.distanceTo(ST);e.setAttribute("lineDistance",new Rn(n,1))}else je("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),lT.copy(n.boundingSphere),lT.applyMatrix4(r),lT.radius+=s,e.ray.intersectsSphere(lT)===!1)return;IH.copy(r).invert(),py.copy(e.ray).applyMatrix4(IH);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=n.index,p=n.attributes.position;if(u!==null){let x=Math.max(0,o.start),v=Math.min(u.count,o.start+o.count);for(let w=x,S=v-1;w<S;w+=c){let T=u.getX(w),P=u.getX(w+1),R=cT(this,e,py,l,T,P,w);R&&t.push(R)}if(this.isLineLoop){let w=u.getX(v-1),S=u.getX(x),T=cT(this,e,py,l,w,S,v-1);T&&t.push(T)}}else{let x=Math.max(0,o.start),v=Math.min(p.count,o.start+o.count);for(let w=x,S=v-1;w<S;w+=c){let T=cT(this,e,py,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=cT(this,e,py,l,v-1,x,v-1);w&&t.push(w)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function cT(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(wT.fromBufferAttribute(a,r),ST.fromBufferAttribute(a,s),t.distanceSqToSegment(wT,ST,BN,NH)>n)return;BN.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(BN);if(!(c<e.near||c>e.far))return{distance:c,point:NH.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var LH=new ie,DH=new ie,__=class extends Lf{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)LH.fromBufferAttribute(t,r),DH.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+LH.distanceTo(DH);e.setAttribute("lineDistance",new Rn(n,1))}else je("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},wy=class extends Lf{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}},Jd=class extends Ss{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ut(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},FH=new on,XN=new Nf,uT=new Wa,hT=new ie,Sy=class extends Yi{constructor(e=new qn,t=new Jd){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(),uT.copy(n.boundingSphere),uT.applyMatrix4(r),uT.radius+=s,e.ray.intersectsSphere(uT)===!1)return;FH.copy(r).invert(),XN.copy(e.ray).applyMatrix4(FH);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=n.index,f=n.attributes.position;if(c!==null){let p=Math.max(0,o.start),x=Math.min(c.count,o.start+o.count);for(let v=p,w=x;v<w;v++){let S=c.getX(v);hT.fromBufferAttribute(f,S),OH(hT,S,l,r,e,t,this)}}else{let p=Math.max(0,o.start),x=Math.min(f.count,o.start+o.count);for(let v=p,w=x;v<w;v++)hT.fromBufferAttribute(f,v),OH(hT,v,l,r,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function OH(i,e,t,n,r,s,o){let a=XN.distanceSqToPoint(i);if(a<t){let l=new ie;XN.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 TA=class extends ws{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=yi,this.minFilter=yi,this.generateMipmaps=!1,this.needsUpdate=!0}};var Gu=class extends ws{constructor(e=[],t=yl,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 ls=class extends ws{constructor(e,t,n=pi,r,s,o,a=yi,l=yi,c,u=vs,f=1){if(u!==vs&&u!==eo)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let p={width:e,height:t,depth:f};super(p,r,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new p_(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}},x_=class extends ls{constructor(e,t=pi,n=yl,r,s,o=yi,a=yi,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}},Ty=class extends ws{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},qc=class i extends qn{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};let a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=[],c=[],u=[],f=[],p=0,x=0;v("z","y","x",-1,-1,n,t,e,o,s,0),v("z","y","x",1,-1,n,t,-e,o,s,1),v("x","z","y",1,1,e,n,t,r,o,2),v("x","z","y",1,-1,e,n,-t,r,o,3),v("x","y","z",1,-1,e,t,n,r,s,4),v("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Rn(c,3)),this.setAttribute("normal",new Rn(u,3)),this.setAttribute("uv",new Rn(f,2));function v(w,S,T,P,R,C,L,D,F,N,B){let z=C/F,V=L/N,H=C/2,Z=L/2,J=D/2,j=F+1,K=N+1,ee=0,ae=0,ce=new ie;for(let de=0;de<K;de++){let ve=de*V-Z;for(let Ie=0;Ie<j;Ie++){let Qe=Ie*z-H;ce[w]=Qe*P,ce[S]=ve*R,ce[T]=J,c.push(ce.x,ce.y,ce.z),ce[w]=0,ce[S]=0,ce[T]=D>0?1:-1,u.push(ce.x,ce.y,ce.z),f.push(Ie/F),f.push(1-de/N),ee+=1}}for(let de=0;de<N;de++)for(let ve=0;ve<F;ve++){let Ie=p+ve+j*de,Qe=p+ve+j*(de+1),Ue=p+(ve+1)+j*(de+1),mt=p+(ve+1)+j*de;l.push(Ie,Qe,mt),l.push(Qe,Ue,mt),ae+=6}a.addGroup(x,ae,B),x+=ae,p+=ee}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var y_=class i extends qn{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let s=[],o=[],a=[],l=[],c=new ie,u=new Oe;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,p=3;f<=t;f++,p+=3){let x=n+f/t*r;c.x=e*Math.cos(x),c.y=e*Math.sin(x),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[p]/e+1)/2,u.y=(o[p+1]/e+1)/2,l.push(u.x,u.y)}for(let f=1;f<=t;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new Rn(o,3)),this.setAttribute("normal",new Rn(a,3)),this.setAttribute("uv",new Rn(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.segments,e.thetaStart,e.thetaLength)}},EA=class i extends qn{constructor(e=1,t=1,n=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;r=Math.floor(r),s=Math.floor(s);let u=[],f=[],p=[],x=[],v=0,w=[],S=n/2,T=0;P(),o===!1&&(e>0&&R(!0),t>0&&R(!1)),this.setIndex(u),this.setAttribute("position",new Rn(f,3)),this.setAttribute("normal",new Rn(p,3)),this.setAttribute("uv",new Rn(x,2));function P(){let C=new ie,L=new ie,D=0,F=(t-e)/n;for(let N=0;N<=s;N++){let B=[],z=N/s,V=z*(t-e)+e;for(let H=0;H<=r;H++){let Z=H/r,J=Z*l+a,j=Math.sin(J),K=Math.cos(J);L.x=V*j,L.y=-z*n+S,L.z=V*K,f.push(L.x,L.y,L.z),C.set(j,F,K).normalize(),p.push(C.x,C.y,C.z),x.push(Z,1-z),B.push(v++)}w.push(B)}for(let N=0;N<r;N++)for(let B=0;B<s;B++){let z=w[B][N],V=w[B+1][N],H=w[B+1][N+1],Z=w[B][N+1];(e>0||B!==0)&&(u.push(z,V,Z),D+=3),(t>0||B!==s-1)&&(u.push(V,H,Z),D+=3)}c.addGroup(T,D,0),T+=D}function R(C){let L=v,D=new Oe,F=new ie,N=0,B=C===!0?e:t,z=C===!0?1:-1;for(let H=1;H<=r;H++)f.push(0,S*z,0),p.push(0,z,0),x.push(.5,.5),v++;let V=v;for(let H=0;H<=r;H++){let J=H/r*l+a,j=Math.cos(J),K=Math.sin(J);F.x=B*K,F.y=S*z,F.z=B*j,f.push(F.x,F.y,F.z),p.push(0,z,0),D.x=j*.5+.5,D.y=K*.5*z+.5,x.push(D.x,D.y),v++}for(let H=0;H<r;H++){let Z=L+H,J=V+H;C===!0?u.push(J,J+1,Z):u.push(J+1,J,Z),N+=3}c.addGroup(T,N,C===!0?1:2),T+=N}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};var pa=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){je("Curve: .getPoint() not implemented.")}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,s=n.length,o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=n[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===o)return r/(s-1);let u=n[r],p=n[r+1]-u,x=(o-u)/p;return(r+x)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);let o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Oe:new ie);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new ie,r=[],s=[],o=[],a=new ie,l=new on;for(let x=0;x<=e;x++){let v=x/e;r[x]=this.getTangentAt(v,new ie)}s[0]=new ie,o[0]=new ie;let c=Number.MAX_VALUE,u=Math.abs(r[0].x),f=Math.abs(r[0].y),p=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),f<=c&&(c=f,n.set(0,1,0)),p<=c&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let x=1;x<=e;x++){if(s[x]=s[x-1].clone(),o[x]=o[x-1].clone(),a.crossVectors(r[x-1],r[x]),a.length()>Number.EPSILON){a.normalize();let v=Math.acos(In(r[x-1].dot(r[x]),-1,1));s[x].applyMatrix4(l.makeRotationAxis(a,v))}o[x].crossVectors(r[x],s[x])}if(t===!0){let x=Math.acos(In(s[0].dot(s[e]),-1,1));x/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(x=-x);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(r[v],x*v)),o[v].crossVectors(r[v],s[v])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},v_=class extends pa{constructor(e=0,t=0,n=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Oe){let n=t,r=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);let a=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),f=Math.sin(this.aRotation),p=l-this.aX,x=c-this.aY;l=p*u-x*f+this.aX,c=p*f+x*u+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},TT=class extends v_{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function TL(){let i=0,e=0,t=0,n=0;function r(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,f){let p=(o-s)/c-(a-s)/(c+u)+(a-o)/u,x=(a-o)/u-(l-o)/(u+f)+(l-a)/f;p*=u,x*=u,r(o,a,p,x)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+n*a}}}var BH=new ie,UH=new ie,UN=new TL,kN=new TL,GN=new TL,ET=class extends pa{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new ie){let n=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=r[(a-1)%s]:(UH.subVectors(r[0],r[1]).add(r[0]),c=UH);let f=r[a%s],p=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(BH.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=BH),this.curveType==="centripetal"||this.curveType==="chordal"){let x=this.curveType==="chordal"?.5:.25,v=Math.pow(c.distanceToSquared(f),x),w=Math.pow(f.distanceToSquared(p),x),S=Math.pow(p.distanceToSquared(u),x);w<1e-4&&(w=1),v<1e-4&&(v=w),S<1e-4&&(S=w),UN.initNonuniformCatmullRom(c.x,f.x,p.x,u.x,v,w,S),kN.initNonuniformCatmullRom(c.y,f.y,p.y,u.y,v,w,S),GN.initNonuniformCatmullRom(c.z,f.z,p.z,u.z,v,w,S)}else this.curveType==="catmullrom"&&(UN.initCatmullRom(c.x,f.x,p.x,u.x,this.tension),kN.initCatmullRom(c.y,f.y,p.y,u.y,this.tension),GN.initCatmullRom(c.z,f.z,p.z,u.z,this.tension));return n.set(UN.calc(l),kN.calc(l),GN.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new ie().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function kH(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 Wce(i,e){let t=1-i;return t*t*e}function jce(i,e){return 2*(1-i)*i*e}function Xce(i,e){return i*i*e}function _y(i,e,t,n){return Wce(i,e)+jce(i,t)+Xce(i,n)}function $ce(i,e){let t=1-i;return t*t*t*e}function Yce(i,e){let t=1-i;return 3*t*t*i*e}function Zce(i,e){return 3*(1-i)*i*i*e}function Kce(i,e){return i*i*i*e}function xy(i,e,t,n,r){return $ce(i,e)+Yce(i,t)+Zce(i,n)+Kce(i,r)}var Ey=class extends pa{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(xy(e,r.x,s.x,o.x,a.x),xy(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}},b_=class extends pa{constructor(e=new ie,t=new ie,n=new ie,r=new ie){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new ie){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(xy(e,r.x,s.x,o.x,a.x),xy(e,r.y,s.y,o.y,a.y),xy(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}},My=class extends pa{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}},MT=class extends pa{constructor(e=new ie,t=new ie){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new ie){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ie){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Cy=class extends pa{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(_y(e,r.x,s.x,o.x),_y(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}},Ry=class extends pa{constructor(e=new ie,t=new ie,n=new ie){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ie){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(_y(e,r.x,s.x,o.x),_y(e,r.y,s.y,o.y),_y(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}},Py=class extends pa{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(kH(a,l.x,c.x,u.x,f.x),kH(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}},CT=Object.freeze({__proto__:null,ArcCurve:TT,CatmullRomCurve3:ET,CubicBezierCurve:Ey,CubicBezierCurve3:b_,EllipseCurve:v_,LineCurve:My,LineCurve3:MT,QuadraticBezierCurve:Cy,QuadraticBezierCurve3:Ry,SplineCurve:Py}),RT=class extends pa{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 CT[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 CT[r.type]().fromJSON(r))}return this}},MA=class extends RT{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 My(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 Cy(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 Ey(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 Py(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 v_(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}},Iy=class extends MA{constructor(e){super(e),this.uuid=Uu(),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 MA().fromJSON(r))}return this}};function Qce(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=cW(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=iue(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let p=t;p<r;p+=t){let x=i[p],v=i[p+1];x<a&&(a=x),v<l&&(l=v),x>u&&(u=x),v>f&&(f=v)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return Ny(s,o,t,a,l,c,0),o}function cW(i,e,t,n,r){let s;if(r===pue(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=GH(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=GH(o/n|0,i[o],i[o+1],s);return s&&w_(s,s.next)&&(Dy(s),s=s.next),s}function CA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(w_(t,t.next)||Nr(t.prev,t,t.next)===0)){if(Dy(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Ny(i,e,t,n,r,s,o){if(!i)return;!o&&s&&lue(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?eue(i,n,r,s):Jce(i)){e.push(l.i,i.i,c.i),Dy(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=tue(CA(i),e),Ny(i,e,t,n,r,s,2)):o===2&&nue(i,e,t,n,r,s):Ny(CA(i),e,t,n,r,s,1);break}}}function Jce(i){let e=i.prev,t=i,n=i.next;if(Nr(e,t,n)>=0)return!1;let r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),p=Math.max(r,s,o),x=Math.max(a,l,c),v=n.next;for(;v!==e;){if(v.x>=u&&v.x<=p&&v.y>=f&&v.y<=x&&Ay(r,a,s,l,o,c,v.x,v.y)&&Nr(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function eue(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Nr(r,s,o)>=0)return!1;let a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,p=o.y,x=Math.min(a,l,c),v=Math.min(u,f,p),w=Math.max(a,l,c),S=Math.max(u,f,p),T=$N(x,v,e,t,n),P=$N(w,S,e,t,n),R=i.prevZ,C=i.nextZ;for(;R&&R.z>=T&&C&&C.z<=P;){if(R.x>=x&&R.x<=w&&R.y>=v&&R.y<=S&&R!==r&&R!==o&&Ay(a,u,l,f,c,p,R.x,R.y)&&Nr(R.prev,R,R.next)>=0||(R=R.prevZ,C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==r&&C!==o&&Ay(a,u,l,f,c,p,C.x,C.y)&&Nr(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;R&&R.z>=T;){if(R.x>=x&&R.x<=w&&R.y>=v&&R.y<=S&&R!==r&&R!==o&&Ay(a,u,l,f,c,p,R.x,R.y)&&Nr(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;C&&C.z<=P;){if(C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==r&&C!==o&&Ay(a,u,l,f,c,p,C.x,C.y)&&Nr(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function tue(i,e){let t=i;do{let n=t.prev,r=t.next.next;!w_(n,r)&&hW(n,t,t.next,r)&&Ly(n,r)&&Ly(r,n)&&(e.push(n.i,t.i,r.i),Dy(t),Dy(t.next),t=i=r),t=t.next}while(t!==i);return CA(t)}function nue(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&hue(o,a)){let l=fW(o,a);o=CA(o,o.next),l=CA(l,l.next),Ny(o,e,t,n,r,s,0),Ny(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function iue(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=cW(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(uue(c))}r.sort(rue);for(let s=0;s<r.length;s++)t=sue(r[s],t);return t}function rue(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 sue(i,e){let t=oue(i,e);if(!t)return e;let n=fW(t,i);return CA(n,n.next),CA(t,t.next)}function oue(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(w_(i,t))return t;do{if(w_(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&&uW(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);Ly(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&aue(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function aue(i,e){return Nr(i.prev,i,e.prev)<0&&Nr(e.next,i,i.next)<0}function lue(i,e,t,n){let r=i;do r.z===0&&(r.z=$N(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,cue(r)}function cue(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 $N(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 uue(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 uW(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 Ay(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&uW(i,e,t,n,r,s,o,a)}function hue(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!fue(i,e)&&(Ly(i,e)&&Ly(e,i)&&due(i,e)&&(Nr(i.prev,i,e.prev)||Nr(i,e.prev,e))||w_(i,e)&&Nr(i.prev,i,i.next)>0&&Nr(e.prev,e,e.next)>0)}function Nr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function w_(i,e){return i.x===e.x&&i.y===e.y}function hW(i,e,t,n){let r=dT(Nr(i,e,t)),s=dT(Nr(i,e,n)),o=dT(Nr(t,n,i)),a=dT(Nr(t,n,e));return!!(r!==s&&o!==a||r===0&&fT(i,t,e)||s===0&&fT(i,n,e)||o===0&&fT(t,i,n)||a===0&&fT(t,e,n))}function fT(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 dT(i){return i>0?1:i<0?-1:0}function fue(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&&hW(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Ly(i,e){return Nr(i.prev,i,i.next)<0?Nr(i,e,i.next)>=0&&Nr(i,i.prev,e)>=0:Nr(i,e,i.prev)<0||Nr(i,i.next,e)<0}function due(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 fW(i,e){let t=YN(i.i,i.x,i.y),n=YN(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 GH(i,e,t,n){let r=YN(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 Dy(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 YN(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function pue(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 ZN=class{static triangulate(e,t,n=2){return Qce(e,t,n)}},Wd=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=[];zH(e),VH(n,e);let o=e.length;t.forEach(zH);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,VH(n,t[l]);let a=ZN.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function zH(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function VH(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var Fy=class i extends qn{constructor(e=new Iy([new Oe(.5,.5),new Oe(-.5,.5),new Oe(-.5,-.5),new Oe(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new Rn(r,3)),this.setAttribute("uv",new Rn(s,2)),this.computeVertexNormals();function o(a){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1,p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,x=t.bevelThickness!==void 0?t.bevelThickness:.2,v=t.bevelSize!==void 0?t.bevelSize:x-.1,w=t.bevelOffset!==void 0?t.bevelOffset:0,S=t.bevelSegments!==void 0?t.bevelSegments:3,T=t.extrudePath,P=t.UVGenerator!==void 0?t.UVGenerator:Aue,R,C=!1,L,D,F,N;if(T){R=T.getSpacedPoints(u),C=!0,p=!1;let Xe=T.isCatmullRomCurve3?T.closed:!1;L=T.computeFrenetFrames(u,Xe),D=new ie,F=new ie,N=new ie}p||(S=0,x=0,v=0,w=0);let B=a.extractPoints(c),z=B.shape,V=B.holes;if(!Wd.isClockWise(z)){z=z.reverse();for(let Xe=0,st=V.length;Xe<st;Xe++){let tt=V[Xe];Wd.isClockWise(tt)&&(V[Xe]=tt.reverse())}}function Z(Xe){let tt=10000000000000001e-36,vt=Xe[0];for(let yt=1;yt<=Xe.length;yt++){let ln=yt%Xe.length,Kt=Xe[ln],Qt=Kt.x-vt.x,xn=Kt.y-vt.y,ge=Qt*Qt+xn*xn,di=Math.max(Math.abs(Kt.x),Math.abs(Kt.y),Math.abs(vt.x),Math.abs(vt.y)),Bn=tt*di*di;if(ge<=Bn){Xe.splice(ln,1),yt--;continue}vt=Kt}}Z(z),V.forEach(Z);let J=V.length,j=z;for(let Xe=0;Xe<J;Xe++){let st=V[Xe];z=z.concat(st)}function K(Xe,st,tt){return st||Ge("ExtrudeGeometry: vec does not exist"),Xe.clone().addScaledVector(st,tt)}let ee=z.length;function ae(Xe,st,tt){let vt,yt,ln,Kt=Xe.x-st.x,Qt=Xe.y-st.y,xn=tt.x-Xe.x,ge=tt.y-Xe.y,di=Kt*Kt+Qt*Qt,Bn=Kt*ge-Qt*xn;if(Math.abs(Bn)>Number.EPSILON){let le=Math.sqrt(di),X=Math.sqrt(xn*xn+ge*ge),Te=st.x-Qt/le,Pe=st.y+Kt/le,Ve=tt.x-ge/X,gt=tt.y+xn/X,St=((Ve-Te)*ge-(gt-Pe)*xn)/(Kt*ge-Qt*xn);vt=Te+Kt*St-Xe.x,yt=Pe+Qt*St-Xe.y;let qe=vt*vt+yt*yt;if(qe<=2)return new Oe(vt,yt);ln=Math.sqrt(qe/2)}else{let le=!1;Kt>Number.EPSILON?xn>Number.EPSILON&&(le=!0):Kt<-Number.EPSILON?xn<-Number.EPSILON&&(le=!0):Math.sign(Qt)===Math.sign(ge)&&(le=!0),le?(vt=-Qt,yt=Kt,ln=Math.sqrt(di)):(vt=Kt,yt=Qt,ln=Math.sqrt(di/2))}return new Oe(vt/ln,yt/ln)}let ce=[];for(let Xe=0,st=j.length,tt=st-1,vt=Xe+1;Xe<st;Xe++,tt++,vt++)tt===st&&(tt=0),vt===st&&(vt=0),ce[Xe]=ae(j[Xe],j[tt],j[vt]);let de=[],ve,Ie=ce.concat();for(let Xe=0,st=J;Xe<st;Xe++){let tt=V[Xe];ve=[];for(let vt=0,yt=tt.length,ln=yt-1,Kt=vt+1;vt<yt;vt++,ln++,Kt++)ln===yt&&(ln=0),Kt===yt&&(Kt=0),ve[vt]=ae(tt[vt],tt[ln],tt[Kt]);de.push(ve),Ie=Ie.concat(ve)}let Qe;if(S===0)Qe=Wd.triangulateShape(j,V);else{let Xe=[],st=[];for(let tt=0;tt<S;tt++){let vt=tt/S,yt=x*Math.cos(vt*Math.PI/2),ln=v*Math.sin(vt*Math.PI/2)+w;for(let Kt=0,Qt=j.length;Kt<Qt;Kt++){let xn=K(j[Kt],ce[Kt],ln);Et(xn.x,xn.y,-yt),vt===0&&Xe.push(xn)}for(let Kt=0,Qt=J;Kt<Qt;Kt++){let xn=V[Kt];ve=de[Kt];let ge=[];for(let di=0,Bn=xn.length;di<Bn;di++){let le=K(xn[di],ve[di],ln);Et(le.x,le.y,-yt),vt===0&&ge.push(le)}vt===0&&st.push(ge)}}Qe=Wd.triangulateShape(Xe,st)}let Ue=Qe.length,mt=v+w;for(let Xe=0;Xe<ee;Xe++){let st=p?K(z[Xe],Ie[Xe],mt):z[Xe];C?(F.copy(L.normals[0]).multiplyScalar(st.x),D.copy(L.binormals[0]).multiplyScalar(st.y),N.copy(R[0]).add(F).add(D),Et(N.x,N.y,N.z)):Et(st.x,st.y,0)}for(let Xe=1;Xe<=u;Xe++)for(let st=0;st<ee;st++){let tt=p?K(z[st],Ie[st],mt):z[st];C?(F.copy(L.normals[Xe]).multiplyScalar(tt.x),D.copy(L.binormals[Xe]).multiplyScalar(tt.y),N.copy(R[Xe]).add(F).add(D),Et(N.x,N.y,N.z)):Et(tt.x,tt.y,f/u*Xe)}for(let Xe=S-1;Xe>=0;Xe--){let st=Xe/S,tt=x*Math.cos(st*Math.PI/2),vt=v*Math.sin(st*Math.PI/2)+w;for(let yt=0,ln=j.length;yt<ln;yt++){let Kt=K(j[yt],ce[yt],vt);Et(Kt.x,Kt.y,f+tt)}for(let yt=0,ln=V.length;yt<ln;yt++){let Kt=V[yt];ve=de[yt];for(let Qt=0,xn=Kt.length;Qt<xn;Qt++){let ge=K(Kt[Qt],ve[Qt],vt);C?Et(ge.x,ge.y+R[u-1].y,R[u-1].x+tt):Et(ge.x,ge.y,f+tt)}}}Me(),ze();function Me(){let Xe=r.length/3;if(p){let st=0,tt=ee*st;for(let vt=0;vt<Ue;vt++){let yt=Qe[vt];Tt(yt[2]+tt,yt[1]+tt,yt[0]+tt)}st=u+S*2,tt=ee*st;for(let vt=0;vt<Ue;vt++){let yt=Qe[vt];Tt(yt[0]+tt,yt[1]+tt,yt[2]+tt)}}else{for(let st=0;st<Ue;st++){let tt=Qe[st];Tt(tt[2],tt[1],tt[0])}for(let st=0;st<Ue;st++){let tt=Qe[st];Tt(tt[0]+ee*u,tt[1]+ee*u,tt[2]+ee*u)}}n.addGroup(Xe,r.length/3-Xe,0)}function ze(){let Xe=r.length/3,st=0;$e(j,st),st+=j.length;for(let tt=0,vt=V.length;tt<vt;tt++){let yt=V[tt];$e(yt,st),st+=yt.length}n.addGroup(Xe,r.length/3-Xe,1)}function $e(Xe,st){let tt=Xe.length;for(;--tt>=0;){let vt=tt,yt=tt-1;yt<0&&(yt=Xe.length-1);for(let ln=0,Kt=u+S*2;ln<Kt;ln++){let Qt=ee*ln,xn=ee*(ln+1),ge=st+vt+Qt,di=st+yt+Qt,Bn=st+yt+xn,le=st+vt+xn;Ct(ge,di,Bn,le)}}}function Et(Xe,st,tt){l.push(Xe),l.push(st),l.push(tt)}function Tt(Xe,st,tt){un(Xe),un(st),un(tt);let vt=r.length/3,yt=P.generateTopUV(n,r,vt-3,vt-2,vt-1);Gt(yt[0]),Gt(yt[1]),Gt(yt[2])}function Ct(Xe,st,tt,vt){un(Xe),un(st),un(vt),un(st),un(tt),un(vt);let yt=r.length/3,ln=P.generateSideWallUV(n,r,yt-6,yt-3,yt-2,yt-1);Gt(ln[0]),Gt(ln[1]),Gt(ln[3]),Gt(ln[1]),Gt(ln[2]),Gt(ln[3])}function un(Xe){r.push(l[Xe*3+0]),r.push(l[Xe*3+1]),r.push(l[Xe*3+2])}function Gt(Xe){s.push(Xe.x),s.push(Xe.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return mue(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 CT[r.type]().fromJSON(r)),new i(n,e.options)}},Aue={generateTopUV:function(i,e,t,n,r){let s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[r*3],u=e[r*3+1];return[new Oe(s,o),new Oe(a,l),new Oe(c,u)]},generateSideWallUV:function(i,e,t,n,r,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],f=e[n*3+2],p=e[r*3],x=e[r*3+1],v=e[r*3+2],w=e[s*3],S=e[s*3+1],T=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Oe(o,1-l),new Oe(c,1-f),new Oe(p,1-v),new Oe(w,1-T)]:[new Oe(a,1-l),new Oe(u,1-f),new Oe(x,1-v),new Oe(S,1-T)]}};function mue(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 RA=class i extends qn{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let s=e/2,o=t/2,a=Math.floor(n),l=Math.floor(r),c=a+1,u=l+1,f=e/a,p=t/l,x=[],v=[],w=[],S=[];for(let T=0;T<u;T++){let P=T*p-o;for(let R=0;R<c;R++){let C=R*f-s;v.push(C,-P,0),w.push(0,0,1),S.push(R/a),S.push(1-T/l)}}for(let T=0;T<l;T++)for(let P=0;P<a;P++){let R=P+c*T,C=P+c*(T+1),L=P+1+c*(T+1),D=P+1+c*T;x.push(R,C,D),x.push(C,L,D)}this.setIndex(x),this.setAttribute("position",new Rn(v,3)),this.setAttribute("normal",new Rn(w,3)),this.setAttribute("uv",new Rn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.widthSegments,e.heightSegments)}};var Aa=class i extends qn{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let l=Math.min(o+a,Math.PI),c=0,u=[],f=new ie,p=new ie,x=[],v=[],w=[],S=[];for(let T=0;T<=n;T++){let P=[],R=T/n,C=o+R*a,L=e*Math.cos(C),D=Math.sqrt(e*e-L*L),F=0;T===0&&o===0?F=.5/t:T===n&&l===Math.PI&&(F=-.5/t);for(let N=0;N<=t;N++){let B=N/t,z=r+B*s;f.x=-D*Math.cos(z),f.y=L,f.z=D*Math.sin(z),v.push(f.x,f.y,f.z),p.copy(f).normalize(),w.push(p.x,p.y,p.z),S.push(B+F,1-R),P.push(c++)}u.push(P)}for(let T=0;T<n;T++)for(let P=0;P<t;P++){let R=u[T][P+1],C=u[T][P],L=u[T+1][P],D=u[T+1][P+1];(T!==0||o>0)&&x.push(R,C,D),(T!==n-1||l<Math.PI)&&x.push(C,L,D)}this.setIndex(x),this.setAttribute("position",new Rn(v,3)),this.setAttribute("normal",new Rn(w,3)),this.setAttribute("uv",new Rn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var Oy=class i extends qn{constructor(e=new Ry(new ie(-1,-1,0),new ie(-1,1,0),new ie(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};let o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;let a=new ie,l=new ie,c=new Oe,u=new ie,f=[],p=[],x=[],v=[];w(),this.setIndex(v),this.setAttribute("position",new Rn(f,3)),this.setAttribute("normal",new Rn(p,3)),this.setAttribute("uv",new Rn(x,2));function w(){for(let R=0;R<t;R++)S(R);S(s===!1?t:0),P(),T()}function S(R){u=e.getPointAt(R/t,u);let C=o.normals[R],L=o.binormals[R];for(let D=0;D<=r;D++){let F=D/r*Math.PI*2,N=Math.sin(F),B=-Math.cos(F);l.x=B*C.x+N*L.x,l.y=B*C.y+N*L.y,l.z=B*C.z+N*L.z,l.normalize(),p.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,f.push(a.x,a.y,a.z)}}function T(){for(let R=1;R<=t;R++)for(let C=1;C<=r;C++){let L=(r+1)*(R-1)+(C-1),D=(r+1)*R+(C-1),F=(r+1)*R+C,N=(r+1)*(R-1)+C;v.push(L,D,N),v.push(D,F,N)}}function P(){for(let R=0;R<=t;R++)for(let C=0;C<=r;C++)c.x=R/t,c.y=C/r,x.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new i(new CT[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},By=class extends qn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new ie,s=new ie;if(e.index!==null){let o=e.attributes.position,a=e.index,l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){let f=l[c],p=f.start,x=f.count;for(let v=p,w=p+x;v<w;v+=3)for(let S=0;S<3;S++){let T=a.getX(v+S),P=a.getX(v+(S+1)%3);r.fromBufferAttribute(o,T),s.fromBufferAttribute(o,P),qH(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),qH(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Rn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function qH(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 Uy=class extends Ss{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ut(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};function jA(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(HH(r))r.isRenderTargetTexture?(je("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(HH(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 Ho(i){let e={};for(let t=0;t<i.length;t++){let n=jA(i[t]);for(let r in n)e[r]=n[r]}return e}function HH(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function gue(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function EL(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:sn.workingColorSpace}var XA={clone:jA,merge:Ho},_ue=`void main() {1+(()=>{var zse=Object.create;var X4=Object.defineProperty;var Vse=Object.getOwnPropertyDescriptor;var qse=Object.getOwnPropertyNames;var Hse=Object.getPrototypeOf,Wse=Object.prototype.hasOwnProperty;var jse=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},Xse=(i,e)=>{for(var t in e)X4(i,t,{get:e[t],enumerable:!0})},$se=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of qse(e))!Wse.call(i,r)&&r!==t&&X4(i,r,{get:()=>e[r],enumerable:!(n=Vse(e,r))||n.enumerable});return i};var Yse=(i,e,t)=>(t=i!=null?zse(Hse(i)):{},$se(e||!i||!i.__esModule?X4(t,"default",{value:i,enumerable:!0}):t,i));var L$=jse((mv,L6)=>{(function(i,e){typeof mv=="object"&&typeof L6=="object"?L6.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof mv=="object"?mv.FrameTicker=e():i.FrameTicker=e()})(mv,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 Z9=i=>new Promise(e=>setTimeout(e,i)),ss=i=>document.querySelector(i);async function Zse(){for(let i=0;i<300&&!(window.__atlasDebug&&!ss("#map-loading")?.checkVisibility?.());i+=1)await Z9(100)}async function Kse(){let i="";for(let e=0;e<100;e+=1){await Z9(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 Ad(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function Qse(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function Jse(i){ss("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function F0(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function $4(i,e){let t=ss(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function Y4(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 eoe(){let i=[],e=async p=>{await Kse(),i.push({name:p,snapshot:JSON.parse(window.render_game_to_text())})};await Zse(),localStorage.clear();let t=ss("#game-select"),n=t.options[0].value;F0(t,n),await e("initial"),$4("#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")),$4("#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 p=ss("#solo-chip");p&&!p.hidden&&p.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")),Ad("g"),await e("grid-open"),$4("#grid-input","m"),await e("grid-descended"),Ad(" "),await e("subgrid-hidden"),Ad(" "),Ad("Escape"),await e("grid-ascended"),Ad("Escape"),await e("grid-closed"),Ad("z"),await e("labels-on"),Qse("z"),await e("labels-off"),Ad("b",{metaKey:!0}),await e("sidebar-collapsed"),Ad("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"),Jse("Escape"),await e("viewport-escape");let u=ss("#variant-select");u.options.length>1&&(F0(u,u.options[1].value),await e("variant-second"),F0(u,u.options[0].value),await e("variant-first"));let f=ss("#map-select");return f.options.length>1&&(F0(f,f.options[1].value),await e("map-second"),F0(f,f.options[0].value),await e("map-first")),t.options.length>1&&(F0(t,t.options[1].value),await e("game-second"),F0(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var Z4=!1;async function K9(){if(!Z4){Z4=!0,Y4("parity tour running\u2026");try{let i=await eoe(),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}`);Y4(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){Y4(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{Z4=!1}}}window.__atlasTour=K9;window.addEventListener("keydown",i=>{i.key==="F9"&&K9()});var nn=i=>document.querySelector(i),we={game:nn("#game-select"),map:nn("#map-select"),variant:nn("#variant-select"),variantField:nn("#variant-field"),legend:nn("#legend"),search:nn("#pin-search"),searchResults:nn("#dock-results"),dock:nn("#dock"),dockCount:nn("#dock-count"),dockFlag:nn("#dock-flag"),dockFold:nn("#dock-fold"),dockRailName:nn("#dock-rail-name"),visibleCount:nn("#visible-count"),viewport:nn("#map"),globe:nn("#globe"),globeToggle:nn("#globe-toggle"),layers:nn("#layers"),zoneToggle:nn("#zone-toggle"),zoneCount:nn("#zone-count"),zoneIndex:nn("#zone-index"),zoneList:nn("#zone-list"),loading:nn("#map-loading"),labelsHint:nn("#labels-hint"),gridHint:nn("#grid-hint"),soloChip:nn("#solo-chip"),overview:nn("#overview"),overviewShelf:nn("#overview-shelf"),overviewDock:nn("#overview-dock"),overviewCanvas:nn("#overview-canvas"),overviewViewport:nn("#overview-viewport"),gridNavigator:nn("#grid-navigator"),gridInput:nn("#grid-input"),gridBack:nn("#grid-back"),subgridToggle:nn("#subgrid-toggle"),detail:nn("#pin-detail"),detailTitle:nn("#detail-title"),detailCategory:nn("#detail-category"),detailDescription:nn("#detail-description"),detailID:nn("#detail-id"),detailCoordinates:nn("#detail-coordinates"),detailCell:nn("#detail-cell"),detailCellField:nn("#detail-cell-field"),detailSource:nn("#detail-source"),detailSourceField:nn("#detail-source-field"),detailLinks:nn("#detail-links"),detailDot:nn("#detail-dot"),sidebar:nn("#sidebar"),mobileLegend:nn("#mobile-legend"),fatal:nn("#fatal-error"),fatalMessage:nn("#fatal-message"),emptyState:nn("#empty-state"),emptyPath:nn("#empty-path"),emptyOpen:nn("#empty-open"),addBundles:nn("#add-bundles")};function O0(i,e,t,n){i.replaceChildren(),e.forEach((r,s)=>{let o=document.createElement("option");o.value=n?String(r[n]):r.slug||String(s),o.textContent=r[t],i.append(o)})}var U={catalog:null,game:null,map:null,variant:null,engine:null,projection:null,layers:null,sources:null,hiddenCategories:new Set,collapsedSections:new Set,pins:[],pinByID:new Map,selectedPin:null,hoveredPin:null,labelsHeld:!1,gridEnabled:!1,globeActive:!1,subgridVisible:!0,gridPrefix:"",zonesVisible:!0,zoneRecords:new Map,highlightedZones:new Set,focusedZoneID:null,search:"",fitZoom:0,zoneTitleCount:0,eligibleLocations:0,tileRun:0,tileStats:{requested:0,loaded:0,errors:0,peakPending:0},overviewRun:0,overviewKey:"",overviewPointer:null,overviewDocked:!1,dockFolded:!0,dockDismissed:!1,renderedShard:0,mapRun:0,textByMap:new Map,restore:null,settling:!1,styleCache:new Map,markerIcons:new Map};var og=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],Hl="0123456789bcdefghjkmnpqrstuvwxyz";var K4="atlas.session";var Q9={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"};var _s={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Q4(i){let e=Rr();for(let t=0,n=i.length;t<n;++t)k0(e,i[t]);return e}function toe(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 hl(n,r,s,o,t)}function ag(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 lw(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function md(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 Sc(i,e){return mx(i,e[0],e[1])}function _u(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function mx(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function aw(i,e){let t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1],l=_s.UNKNOWN;return o<t?l=l|_s.LEFT:o>r&&(l=l|_s.RIGHT),a<n?l=l|_s.BELOW:a>s&&(l=l|_s.ABOVE),l===_s.UNKNOWN&&(l=_s.INTERSECTING),l}function Rr(){return[1/0,1/0,-1/0,-1/0]}function hl(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 B0(i){return hl(1/0,1/0,-1/0,-1/0,i)}function cw(i,e){let t=i[0],n=i[1];return hl(t,n,t,n,e)}function lg(i,e,t,n,r){let s=B0(r);return J4(s,i,e,t,n)}function U0(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function uw(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 k0(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 J4(i,e,t,n,r){for(;t<n;t+=r)noe(i,e[t],e[t+1]);return i}function noe(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 hw(i,e){let t;return t=e(cg(i)),t||(t=e(ug(i)),t)||(t=e(hg(i)),t)||(t=e(Wl(i)),t)?t:!1}function gx(i){let e=0;return yu(i)||(e=jn(i)*_r(i)),e}function cg(i){return[i[0],i[1]]}function ug(i){return[i[2],i[1]]}function Ua(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function J9(i,e){let t;if(e==="bottom-left")t=cg(i);else if(e==="bottom-right")t=ug(i);else if(e==="top-left")t=Wl(i);else if(e==="top-right")t=hg(i);else throw new Error("Invalid corner");return t}function _x(i,e,t,n,r){let[s,o,a,l,c,u,f,p]=eP(i,e,t,n);return hl(Math.min(s,a,c,f),Math.min(o,l,u,p),Math.max(s,a,c,f),Math.max(o,l,u,p),r)}function eP(i,e,t,n){let r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(t),a=Math.sin(t),l=r*o,c=r*a,u=s*o,f=s*a,p=i[0],x=i[1];return[p-l+f,x-c-u,p-l-f,x-c+u,p+l-f,x+c+u,p+l+f,x+c-u,p-l+f,x-c-u]}function _r(i){return i[3]-i[1]}function xu(i,e,t){let n=t||Rr();return xr(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]):B0(n),n}function tP(i,e){if(!xr(i,e))return[i.slice()];if(_u(e,i))return[];let[t,n,r,s]=i,o=Math.max(t,e[0]),a=Math.max(n,e[1]),l=Math.min(r,e[2]),c=Math.min(s,e[3]),u=[];return o>t&&u.push([t,n,o,s]),l<r&&u.push([l,n,r,s]),a>n&&u.push([o,n,l,a]),c<s&&u.push([o,c,l,s]),u}function Wl(i){return[i[0],i[3]]}function hg(i){return[i[2],i[3]]}function jn(i){return i[2]-i[0]}function xr(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function yu(i){return i[2]<i[0]||i[3]<i[1]}function eG(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function tG(i,e,t){let n=!1,r=aw(i,e),s=aw(i,t);if(r===_s.INTERSECTING||s===_s.INTERSECTING)n=!0;else{let o=i[0],a=i[1],l=i[2],c=i[3],u=e[0],f=e[1],p=t[0],x=t[1],v=(x-f)/(p-u),w,S;s&_s.ABOVE&&!(r&_s.ABOVE)&&(w=p-(x-c)/v,n=w>=o&&w<=l),!n&&s&_s.RIGHT&&!(r&_s.RIGHT)&&(S=x-(p-l)*v,n=S>=a&&S<=c),!n&&s&_s.BELOW&&!(r&_s.BELOW)&&(w=p-(x-a)/v,n=w>=o&&w<=l),!n&&s&_s.LEFT&&!(r&_s.LEFT)&&(S=x-(p-o)*v,n=S>=a&&S<=c)}return n}function nG(i,e,t,n){if(yu(i))return B0(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 toe(s,o,t)}function nP(i,e){let t=e.getExtent(),n=Ua(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=jn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function fw(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]]];nP(i,e);let r=jn(n);if(jn(i)>r&&!t)return[[n[0],i[1],n[2],i[3]]];if(i[0]<n[0])return[[i[0]+r,i[1],n[2],i[3]],[n[0],i[1],i[2],i[3]]];if(i[2]>n[2])return[[i[0],i[1],n[2],i[3]],[n[0],i[1],i[2]-r,i[3]]]}return[i]}function iG(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(...tP(t[o],e[n]));t=s}return t}var rG={info:1,warn:2,error:3,none:4},ioe=rG.info;function dw(...i){ioe>rG.warn||console.warn(...i)}function xi(i,e,t){return Math.min(Math.max(i,e),t)}function sG(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 Tc(i,e,t,n)}function Tc(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function oG(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 pw(i){return i*180/Math.PI}function Ec(i){return i*Math.PI/180}function vu(i,e){let t=i%e;return t*e<0?t+e:t}function No(i,e,t){return i+t*(e-i)}function G0(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function xx(i,e){return Math.floor(G0(i,e))}function yx(i,e){return Math.ceil(G0(i,e))}function Aw(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function aG(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function z0(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 fg(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 lG(i,e){return i[0]*=e,i[1]*=e,i}function mw(i,e){if(e.canWrapX()){let t=jn(e.getExtent()),n=cG(i,e,t);n&&(i[0]-=n*t)}return i}function cG(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||jn(n),r=Math.floor((i[0]-n[0])/t)),r}function uG(i,e,t){let n=Math.sqrt((e[0]-i[0])*(e[0]-i[0])+(e[1]-i[1])*(e[1]-i[1])),r=[(e[0]-i[0])/n,(e[1]-i[1])/n],s=[-r[1],r[0]],o=Math.sqrt((t[0]-i[0])*(t[0]-i[0])+(t[1]-i[1])*(t[1]-i[1])),a=[(t[0]-i[0])/o,(t[1]-i[1])/o],l=n===0||o===0?0:Math.acos(xi(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:Math.PI*2-l}var Qh={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var iP=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_||Qh[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_}},gd=iP;var vx=6378137,dg=Math.PI*vx,roe=[-dg,-dg,dg,dg],soe=[-180,-85,180,85],gw=vx*Math.log(Math.tan(Math.PI/2)),_d=class extends gd{constructor(e){super({code:e,units:"m",extent:roe,global:!0,worldExtent:soe,getPointResolution:function(t,n){return t/Math.cosh(n[1]/vx)}})}},rP=[new _d("EPSG:3857"),new _d("EPSG:102100"),new _d("EPSG:102113"),new _d("EPSG:900913"),new _d("http://www.opengis.net/def/crs/EPSG/0/3857"),new _d("http://www.opengis.net/gml/srs/epsg.xml#3857")];function hG(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]=dg*i[s]/180;let o=vx*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>gw?o=gw:o<-gw&&(o=-gw),e[s+1]=o}return e}function fG(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]/dg,e[s+1]=360*Math.atan(Math.exp(i[s+1]/vx))/Math.PI-90;return e}var ooe=6378137,dG=[-180,-90,180,90],aoe=Math.PI*ooe/180,Jh=class extends gd{constructor(e,t){super({code:e,units:"degrees",extent:dG,axisOrientation:t,global:!0,metersPerUnit:aoe,worldExtent:dG})}},sP=[new Jh("CRS:84"),new Jh("EPSG:4326","neu"),new Jh("urn:ogc:def:crs:OGC:1.3:CRS84"),new Jh("urn:ogc:def:crs:OGC:2:84"),new Jh("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Jh("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Jh("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var oP={};function pG(i){return oP[i]||oP[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function AG(i,e){oP[i]=e}function bu(i){for(let e in i)delete i[e]}function Mc(i){let e;for(e in i)return!1;return!e}var pg={};function Ag(i,e,t){let n=i.getCode(),r=e.getCode();n in pg||(pg[n]={}),pg[n][r]=t}function _w(i,e){return i in pg&&e in pg[i]?pg[i][e]:null}var xw=.9996,jl=.00669438,vw=jl*jl,bw=vw*jl,V0=jl/(1-jl),mG=Math.sqrt(1-jl),mg=(1-mG)/(1+mG),yG=mg*mg,aP=yG*mg,lP=aP*mg,vG=lP*mg,bG=1-jl/4-3*vw/64-5*bw/256,loe=3*jl/8+3*vw/32+45*bw/1024,coe=15*vw/256+45*bw/1024,uoe=35*bw/3072,hoe=3/2*mg-27/32*aP+269/512*vG,foe=21/16*yG-55/32*lP,doe=151/96*aP-417/128*vG,poe=1097/512*lP,yw=6378137;function Aoe(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/xw/(yw*bG),a=o+hoe*Math.sin(2*o)+foe*Math.sin(4*o)+doe*Math.sin(6*o)+poe*Math.sin(8*o),l=Math.sin(a),c=l*l,u=Math.cos(a),f=l/u,p=f*f,x=p*p,v=1-jl*c,w=Math.sqrt(1-jl*c),S=yw/w,T=(1-jl)/v,P=V0*u**2,R=P*P,C=n/(S*xw),L=C*C,D=L*C,F=D*C,N=F*C,B=N*C,z=a-f/T*(L/2-F/24*(5+3*p+10*P-4*R-9*V0))+B/720*(61+90*p+298*P+45*x-252*V0-3*R),V=(C-D/6*(1+2*p+P)+N/120*(5-2*P+28*p-3*R+8*V0+24*x))/u;return V=Aw(V+Ec(wG(t.number)),-Math.PI,Math.PI),[pw(V),pw(z)]}var gG=-80,_G=84,moe=-180,goe=180;function _oe(i,e,t){i=Aw(i,moe,goe),e<gG?e=gG:e>_G&&(e=_G);let n=Ec(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=Ec(i),u=wG(t.number),f=Ec(u),p=yw/Math.sqrt(1-jl*r**2),x=V0*s**2,v=s*Aw(c-f,-Math.PI,Math.PI),w=v*v,S=w*v,T=S*v,P=T*v,R=P*v,C=yw*(bG*n-loe*Math.sin(2*n)+coe*Math.sin(4*n)-uoe*Math.sin(6*n)),L=xw*p*(v+S/6*(1-a+x)+P/120*(5-18*a+l+72*x-58*V0))+5e5,D=xw*(C+p*o*(w/2+T/24*(5-a+9*x+4*x**2)+R/720*(61-58*a+l+600*x-330*V0)));return t.north||(D+=1e7),[L,D]}function wG(i){return(i-1)*6-180+3}var xoe=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function SG(i){let e=0;for(let r of xoe){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 xG(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 TG(i){return SG(i)?new gd({code:i,units:"m"}):null}function EG(i){let e=SG(i.getCode());return e?{forward:xG(_oe,e),inverse:xG(Aoe,e)}:null}var yoe=63710088e-1;function cP(i,e,t){t=t||yoe;let n=Ec(i[1]),r=Ec(e[1]),s=(r-n)/2,o=Ec(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 voe=[EG],boe=[TG];var hP=!0;function CG(i){hP=!(i===void 0?!0:i)}function dP(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 fP(i){AG(i.getCode(),i),Ag(i,i,dP)}function woe(i){i.forEach(fP)}function xs(i){if(typeof i!="string")return i;let e=pG(i);if(e)return e;for(let t of boe){let n=t(i);if(n)return n}return null}function pP(i,e,t,n){i=xs(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/Qh[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=q0(i,xs("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=cP(c.slice(0,2),c.slice(2,4)),f=cP(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?Qh[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function MG(i){woe(i),i.forEach(function(e){i.forEach(function(t){e!==t&&Ag(e,t,dP)})})}function Soe(i,e,t,n){i.forEach(function(r){e.forEach(function(s){Ag(r,s,t),Ag(s,r,n)})})}function ww(i,e){return i?typeof i=="string"?xs(i):i:xs(e)}function RG(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 gg(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||q0(i,e)===dP)&&t}function q0(i,e){let t=i.getCode(),n=e.getCode(),r=_w(t,n);if(r)return r;let s=null,o=null;for(let l of voe)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=uP(s.inverse,o.forward);else{let l=_w(t,a);l&&(r=uP(l,o.forward))}else{let l=_w(a,n);l&&(r=uP(s.inverse,l))}return r&&(fP(i),fP(e),Ag(i,e,r)),r}function uP(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function H0(i,e){let t=xs(i),n=xs(e);return q0(t,n)}function _g(i,e,t){let n=H0(e,t);if(!n){let r=xs(e).getCode(),s=xs(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function PG(i,e,t,n){let r=H0(e,t);return nG(i,r,void 0,n)}var Cc=null;function W0(){return Cc}function bx(i,e){return Cc?_g(i,e,Cc):i}function Rc(i,e){return Cc?_g(i,Cc,e):(hP&&!z0(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(hP=!1,dw("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function xd(i,e){return Cc?PG(i,e,Cc):i}function Pc(i,e){return Cc?PG(i,Cc,e):i}function IG(i,e){if(!Cc)return i;let t=xs(e).getMetersPerUnit(),n=Cc.getMetersPerUnit();return t&&n?i*t/n:i}function Toe(){MG(rP),MG(sP),Soe(sP,rP,hG,fG)}Toe();function AP(i){return i[0]>0&&i[1]>0}function NG(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 Wr(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var Sw=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 j0(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new Sw(i,e,t,n)}var Tw=Sw;function LG(i,e,t){let n,r;t=t||ka;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 ka(i,e){return i>e?1:i<e?-1:0}function DG(i,e){return i<e?1:i>e?-1:0}function xg(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 FG(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Ic(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 Lo(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 OG(i,e,t){let n=e||ka;return i.every(function(r,s){if(s===0)return!0;let o=n(i[s-1],r);return!(o>0||t&&o===0)})}function Vn(i,e){if(!i)throw new Error(e)}function BG(i,e,t,n,r){return!hw(r,function(o){return!yd(i,e,t,n,o[0],o[1])})}function yd(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 wx(i,e,t,n,r,s){if(t.length===0||!yd(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(yd(i,t[o-1],t[o],n,r,s))return!1;return!0}function UG(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(wx(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function kG(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 Ew(i,e,t,n,r,s){return s=s??J4(Rr(),i,e,t,n),xr(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:kG(i,e,t,n,function(o,a){return tG(r,o,a)}):!1}function mP(i,e,t,n,r){return!!(Ew(i,e,t,n,r)||yd(i,e,t,n,r[0],r[1])||yd(i,e,t,n,r[0],r[3])||yd(i,e,t,n,r[2],r[1])||yd(i,e,t,n,r[2],r[3]))}function gP(i,e,t,n,r){if(!mP(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(BG(i,t[s-1],t[s],n,r)&&!Ew(i,t[s-1],t[s],n,r))return!1;return!0}function GG(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(gP(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function Yn(){throw new Error("Unimplemented abstract method.")}var Eoe=0;function Ln(i){return i.ol_uid||(i.ol_uid=String(++Eoe))}function yg(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function Moe(i,e,t){return i+"/"+e+"/"+t}function vg(i,e,t,n,r){return`${Ln(i)},${e},${Moe(t,n,r)}`}function zG(i){return Coe(i[0],i[1],i[2])}function Coe(i,e,t){return(e<<i)+t}function VG(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 bg=[0,0,0],vd=5,_P=class{constructor(e){let t=e.minZoom,n=e.resolutions;t===void 0&&n&&(t=n.findIndex(o=>o!==void 0)),this.minZoom=t!==void 0?t:0,this.resolutions_=n,Vn(OG(this.resolutions_,(o,a)=>a-o,!0),"`resolutions` must be sorted in descending order");let r;if(!e.origins){for(let o=0,a=this.resolutions_.length-1;o<a;++o)if(!r)r=this.resolutions_[o]/this.resolutions_[o+1];else if(this.resolutions_[o]/this.resolutions_[o+1]!==r){r=void 0;break}}this.zoomFactor_=r,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,Vn(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let s=e.extent;s!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=Wl(s)),Vn(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,Vn(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:256,Vn(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=s!==void 0?s:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.tileRanges!==void 0?this.fullTileRanges_=e.tileRanges:e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((o,a)=>{let l=new Tw(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=j0(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 j0(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 j0(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 j0(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,p=Math.floor(l*(o+1))-1;return j0(c,f,u,p,n)}let a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,bg);let r=bg[1],s=bg[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,bg);let o=bg[1],a=bg[2];return j0(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=Wr(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=Wr(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 hl(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=Wr(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=yx(u,vd)-1,f=yx(f,vd)-1):(u=xx(u,vd),f=xx(f,vd)),yg(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=Wr(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=yx(c,vd)-1,u=yx(u,vd)-1):(c=xx(c,vd),u=xx(u,vd)),yg(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=xg(this.resolutions_,e,t||0);return xi(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return mP(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}},Sx=_P;function Mw(i){let e=i.getDefaultTileGrid();return e||(e=Poe(i),i.setDefaultTileGrid(e)),e}function HG(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=Cw(t);if(!Sc(s,r)){let o=jn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function Roe(i,e,t,n){n=n!==void 0?n:"top-left";let r=jG(i,e,t);return new Sx({extent:i,origin:J9(i,n),resolutions:r,tileSize:t})}function WG(i){let e=i||{},t=e.extent||xs("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:jG(t,e.maxZoom,e.tileSize,e.maxResolution)};return new Sx(n)}function jG(i,e,t,n){e=e!==void 0?e:42,t=Wr(t!==void 0?t:256);let r=_r(i),s=jn(i);n=n>0?n:Math.max(s/t[0],r/t[1]);let o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=n/Math.pow(2,l);return a}function Poe(i,e,t,n){let r=Cw(i);return Roe(r,e,t,n)}function Cw(i){i=xs(i);let e=i.getExtent();if(!e){let t=180*Qh.degrees/i.getMetersPerUnit();e=hl(-t,-t,t,t)}return e}var Mn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function kn(i,e,t,n,r){if(r){let o=t;t=function(a){return i.removeEventListener(e,t),o.call(n??this,a)}}else n&&n!==i&&(t=t.bind(n));let s={target:i,type:e,listener:t};return i.addEventListener(e,t),s}function wg(i,e,t,n){return kn(i,e,t,n,!0)}function ri(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),bu(i))}var Jt={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};var xP=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},bd=xP;function ef(){return!0}function tf(){return!1}function nf(){}function Rw(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!Lo(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function XG(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 yP=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Ys=yP;var vP=class extends bd{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 Ys(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,nf);delete o[n]}return l}disposeInternal(){this.listeners_&&bu(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]=nf,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},wd=vP;var X0=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",Ioe=X0.includes("safari")&&!X0.includes("chrom"),n5e=Ioe&&(X0.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(X0)),$G=X0.includes("webkit")&&!X0.includes("edge"),bP=X0.includes("macintosh"),YG=typeof devicePixelRatio<"u"?devicePixelRatio:1,Os=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,wP=typeof Image<"u"&&Image.prototype.decode;var Pw=(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 ZG(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[wg(n,Jt.LOAD,function(){o=!0,s||e()})];return n.src&&wP?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(wg(n,Jt.ERROR,t)),function(){r=!1,a.forEach(ri)}}function Noe(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 KG(i,e){return e&&(i.src=e),i.src&&wP?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):Noe(i)}var rn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function SP(i){return Math.pow(i,3)}function Xl(i){return 1-SP(1-i)}function QG(i){return 3*i*i-2*i*i*i}function JG(i){return i}var TP=class extends wd{constructor(e,t,n){super(),n=n||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(Jt.CHANGE)}release(){this.setState(rn.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==rn.EMPTY){if(this.state!==rn.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){Yn()}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:SP(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()}},Sg=TP;function Ti(i,e,t,n){let r;return t&&t.length?r=t.shift():Os?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 EP;function Tx(){return EP||(EP=Ti(1,1)),EP}function $0(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function MP(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function ez(i){for(;i.lastChild;)i.lastChild.remove()}function tz(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 Iw(){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 fl(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}var CP=class extends Sg{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_,Os?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=s}getImage(){return this.image_}setImage(e){this.image_=e,this.state=rn.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=rn.ERROR,this.unlistenImage_(),this.image_=Loe(),this.changed()}handleImageLoad_(){if(Os)this.state=rn.LOADED;else{let e=this.image_;e.naturalWidth&&e.naturalHeight?this.state=rn.LOADED:this.state=rn.EMPTY}this.unlistenImage_(),this.changed()}load(){this.state==rn.ERROR&&(this.state=rn.IDLE,this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==rn.IDLE&&(this.state=rn.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=ZG(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 Loe(){let i=Ti(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var Nw=CP;var RP,Y0=[];function nz(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 PP(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function Doe(){if(RP===void 0){let i=Ti(6,6,Y0);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",nz(i,4,5,4,0),nz(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;RP=PP(e,0)||PP(e,4)||PP(e,8),$0(i),Y0.push(i.canvas)}return RP}function iz(i,e,t,n){let r=_g(t,e,i),s=pP(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||Sc(l,r)){let c=pP(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function rz(i,e,t,n){let r=Ua(t),s=iz(i,e,r,n);return(!isFinite(s)||s<=0)&&hw(t,function(o){return s=iz(i,e,o,n),isFinite(s)&&s>0}),s}function sz(i,e,t,n,r,s,o,a,l,c,u,f,p,x){let v=Ti(Math.round(t*i),Math.round(t*e),Y0);if(f||(v.imageSmoothingEnabled=!1),l.length===0)return v.canvas;v.scale(t,t);function w(L){return Math.round(L*t)/t}v.globalCompositeOperation="lighter";let S=Rr();l.forEach(function(L,D,F){uw(S,L.extent)});let T,P=t/n,R=(f?1:1+Math.pow(2,-24))/P;if(!p||l.length!==1||c!==0){if(T=Ti(Math.round(jn(S)*P),Math.round(_r(S)*P),Y0),f||(T.imageSmoothingEnabled=!1),r&&x){let L=(r[0]-S[0])*P,D=-(r[3]-S[3])*P,F=jn(r)*P,N=_r(r)*P;T.rect(L,D,F,N),T.clip()}l.forEach(function(L,D,F){if(L.image.width>0&&L.image.height>0){if(L.clipExtent){T.save();let H=(L.clipExtent[0]-S[0])*P,Z=-(L.clipExtent[3]-S[3])*P,J=jn(L.clipExtent)*P,j=_r(L.clipExtent)*P;T.rect(f?H:Math.round(H),f?Z:Math.round(Z),f?J:Math.round(H+J)-Math.round(H),f?j:Math.round(Z+j)-Math.round(Z)),T.clip()}let N=(L.extent[0]-S[0])*P,B=-(L.extent[3]-S[3])*P,z=jn(L.extent)*P,V=_r(L.extent)*P;T.drawImage(L.image,c,c,L.image.width-2*c,L.image.height-2*c,f?N:Math.round(N),f?B:Math.round(B),f?z:Math.round(N+z)-Math.round(N),f?V:Math.round(B+V)-Math.round(B)),L.clipExtent&&T.restore()}})}let C=Wl(o);return a.getTriangles().forEach(function(L,D,F){let N=L.source,B=L.target,z=N[0][0],V=N[0][1],H=N[1][0],Z=N[1][1],J=N[2][0],j=N[2][1],K=w((B[0][0]-C[0])/s),ee=w(-(B[0][1]-C[1])/s),ae=w((B[1][0]-C[0])/s),ce=w(-(B[1][1]-C[1])/s),de=w((B[2][0]-C[0])/s),ve=w(-(B[2][1]-C[1])/s),Ie=z,Qe=V;z=0,V=0,H-=Ie,Z-=Qe,J-=Ie,j-=Qe;let Ue=[[H,Z,0,0,ae-K],[J,j,0,0,de-K],[0,0,H,Z,ce-ee],[0,0,J,j,ve-ee]],mt=oG(Ue);if(!mt)return;if(v.save(),v.beginPath(),Doe()||!f){v.moveTo(ae,ce);let ze=4,$e=K-ae,Et=ee-ce;for(let Tt=0;Tt<ze;Tt++)v.lineTo(ae+w((Tt+1)*$e/ze),ce+w(Tt*Et/(ze-1))),Tt!=ze-1&&v.lineTo(ae+w((Tt+1)*$e/ze),ce+w((Tt+1)*Et/(ze-1)));v.lineTo(de,ve)}else v.moveTo(ae,ce),v.lineTo(K,ee),v.lineTo(de,ve);v.clip(),v.transform(mt[0],mt[2],mt[1],mt[3],K,ee),v.translate(S[0]-Ie,S[3]-Qe);let Me;if(T)Me=T.canvas,v.scale(R,-R);else{let ze=l[0],$e=ze.extent;Me=ze.image,v.scale(jn($e)/Me.width,-_r($e)/Me.height)}v.drawImage(Me,0,0),v.restore()}),T&&($0(T),Y0.push(T.canvas)),u&&(v.save(),v.globalCompositeOperation="source-over",v.strokeStyle="black",v.lineWidth=1,a.getTriangles().forEach(function(L,D,F){let N=L.target,B=(N[0][0]-C[0])/s,z=-(N[0][1]-C[1])/s,V=(N[1][0]-C[0])/s,H=-(N[1][1]-C[1])/s,Z=(N[2][0]-C[0])/s,J=-(N[2][1]-C[1])/s;v.beginPath(),v.moveTo(V,H),v.lineTo(B,z),v.lineTo(Z,J),v.closePath(),v.stroke()}),v.restore()),v.canvas}var Foe=[1,0,0,1,0,0],N5e=new Array(6);function Zs(){return Foe.slice(0)}function oz(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 Pr(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 uo(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 Dw(i,e){let t=Ooe(e);Vn(t!==0,"Transformation matrix cannot be inverted");let n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return i[0]=o/t,i[1]=-r/t,i[2]=-s/t,i[3]=n/t,i[4]=(s*l-o*a)/t,i[5]=-(n*l-r*a)/t,i}function Ooe(i){return i[0]*i[3]-i[1]*i[2]}var Boe=[1e5,1e5,1e5,1e5,2,2];function az(i){return"matrix("+i.join(", ")+")"}function Lw(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function lz(i,e){let t=Lw(i),n=Lw(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*Boe[r])!==0)return!1;return!0}var Uoe=10,cz=.25,IP=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?RG(R=>Pr(a,_g(R,this.targetProj_,this.sourceProj_))):H0(this.targetProj_,this.sourceProj_);this.transformInv_=function(R){let C=R[0]+"/"+R[1];return l[C]||(l[C]=c(R)),l[C]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&jn(r)>=jn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?jn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?jn(this.targetProj_.getExtent()):null;let u=Wl(n),f=hg(n),p=ug(n),x=cg(n),v=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(p),T=this.transformInv_(x),P=Uoe+(o?Math.max(0,Math.ceil(Math.log2(gx(n)/(o*o*256*256)))):0);if(this.addQuad_(u,f,p,x,v,w,S,T,P),this.wrapsXInSource_){let R=1/0;this.triangles_.forEach(function(C,L,D){R=Math.min(R,C.source[0][0],C.source[1][0],C.source[2][0])}),this.triangles_.forEach(C=>{if(Math.max(C.source[0][0],C.source[1][0],C.source[2][0])-R>this.sourceWorldWidth_/2){let L=[[C.source[0][0],C.source[0][1]],[C.source[1][0],C.source[1][1]],[C.source[2][0],C.source[2][1]]];L[0][0]-R>this.sourceWorldWidth_/2&&(L[0][0]-=this.sourceWorldWidth_),L[1][0]-R>this.sourceWorldWidth_/2&&(L[1][0]-=this.sourceWorldWidth_),L[2][0]-R>this.sourceWorldWidth_/2&&(L[2][0]-=this.sourceWorldWidth_);let D=Math.min(L[0][0],L[1][0],L[2][0]);Math.max(L[0][0],L[1][0],L[2][0])-D<this.sourceWorldWidth_/2&&(C.source=L)}})}l={}}addTriangle_(e,t,n,r,s,o){this.triangles_.push({source:[r,s,o],target:[e,t,n]})}addQuad_(e,t,n,r,s,o,a,l,c){let u=Q4([s,o,a,l]),f=this.sourceWorldWidth_?jn(u)/this.sourceWorldWidth_:null,p=this.sourceWorldWidth_,x=this.sourceProj_.canWrapX()&&f>.5&&f<1,v=!1;if(c>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){let S=Q4([e,t,n,r]);v=jn(S)/this.targetWorldWidth_>cz||v}!x&&this.sourceProj_.isGlobal()&&f&&(v=f>cz||v)}if(!v&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!xr(u,this.maxSourceExtent_))return;let w=0;if(!v&&(!isFinite(s[0])||!isFinite(s[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])||!isFinite(l[0])||!isFinite(l[1]))){if(c>0)v=!0;else if(w=(!isFinite(s[0])||!isFinite(s[1])?8:0)+(!isFinite(o[0])||!isFinite(o[1])?4:0)+(!isFinite(a[0])||!isFinite(a[1])?2:0)+(!isFinite(l[0])||!isFinite(l[1])?1:0),w!=1&&w!=2&&w!=4&&w!=8)return}if(c>0){if(!v){let S=[(e[0]+n[0])/2,(e[1]+n[1])/2],T=this.transformInv_(S),P;x?P=(vu(s[0],p)+vu(a[0],p))/2-vu(T[0],p):P=(s[0]+a[0])/2-T[0];let R=(s[1]+a[1])/2-T[1];v=P*P+R*R>this.errorThresholdSquared_}if(v){if(Math.abs(e[0]-n[0])<=Math.abs(e[1]-n[1])){let S=[(t[0]+n[0])/2,(t[1]+n[1])/2],T=this.transformInv_(S),P=[(r[0]+e[0])/2,(r[1]+e[1])/2],R=this.transformInv_(P);this.addQuad_(e,t,S,P,s,o,T,R,c-1),this.addQuad_(P,S,n,r,R,T,a,l,c-1)}else{let S=[(e[0]+t[0])/2,(e[1]+t[1])/2],T=this.transformInv_(S),P=[(n[0]+r[0])/2,(n[1]+r[1])/2],R=this.transformInv_(P);this.addQuad_(e,S,P,r,s,T,R,l,c-1),this.addQuad_(S,t,n,P,T,o,a,R,c-1)}return}}if(x){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}(w&11)==0&&this.addTriangle_(e,n,r,s,a,l),(w&14)==0&&this.addTriangle_(e,n,t,s,a,o),w&&((w&13)==0&&this.addTriangle_(t,r,e,o,l,s),(w&7)==0&&this.addTriangle_(t,r,n,o,l,a))}calculateSourceExtent(){let e=Rr();return this.triangles_.forEach(function(t,n,r){let s=t.source;k0(e,s[0]),k0(e,s[1]),k0(e,s[2])}),e}getTriangles(){return this.triangles_}},uz=IP;var NP=class extends Sg{constructor(e,t,n,r,s,o,a,l,c,u,f,p){super(s,rn.IDLE,p),this.renderEdges_=f!==void 0?f:!1,this.pixelRatio_=a,this.gutter_=l,this.canvas_=null,this.sourceTileGrid_=t,this.targetTileGrid_=r,this.wrappedTileCoord_=o||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=e.canWrapX()?e.getExtent():void 0;let x=r.getTileCoordExtent(this.wrappedTileCoord_),v=this.targetTileGrid_.getExtent(),w=this.sourceTileGrid_.getExtent(),S=v?xu(x,v):x;if(gx(S)===0){this.state=rn.EMPTY;return}let T=e.getExtent();T&&(w?w=xu(w,T):w=T);let P=r.getResolution(this.wrappedTileCoord_[0]),R=rz(e,n,S,P);if(!isFinite(R)||R<=0){this.state=rn.EMPTY;return}let C=u!==void 0?u:.5;if(this.triangulation_=new uz(e,n,S,w,R*C,P),this.triangulation_.getTriangles().length===0){this.state=rn.EMPTY;return}this.sourceZ_=t.getZForResolution(R);let L=this.triangulation_.calculateSourceExtent();if(w&&(e.canWrapX()?(L[1]=xi(L[1],w[1],w[3]),L[3]=xi(L[3],w[1],w[3])):L=xu(L,w)),!gx(L))this.state=rn.EMPTY;else{let D=0,F=0;e.canWrapX()&&(D=jn(T),F=Math.floor((L[0]-T[0])/D)),fw(L.slice(),e,!0).forEach(B=>{let z=t.getTileRangeForExtentAndZ(B,this.sourceZ_);for(let V=z.minX;V<=z.maxX;V++)for(let H=z.minY;H<=z.maxY;H++){let Z=F*D;this.sourceTiles_.push({getTile:()=>c(this.sourceZ_,V,H,a),offset:Z})}++F}),this.sourceTiles_.length===0&&(this.state=rn.EMPTY)}}getImage(){return this.canvas_}reproject_(){let e=[];if(this.sourceTiles_.forEach(t=>{let n=t.tile;if(n&&n.getState()==rn.LOADED){let r=this.sourceTileGrid_.getTileCoordExtent(n.tileCoord);r[0]+=t.offset,r[2]+=t.offset;let s=this.clipExtent_?.slice();s&&(s[0]+=t.offset,s[2]+=t.offset),e.push({extent:r,clipExtent:s,image:n.getImage()})}}),this.sourceTiles_.length=0,e.length===0)this.state=rn.ERROR;else{let t=this.wrappedTileCoord_[0],n=this.targetTileGrid_.getTileSize(t),r=typeof n=="number"?n:n[0],s=typeof n=="number"?n:n[1],o=this.targetTileGrid_.getResolution(t),a=this.sourceTileGrid_.getResolution(this.sourceZ_),l=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=sz(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=rn.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==rn.IDLE){this.state=rn.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{let n=t.getState();if(n==rn.IDLE||n==rn.LOADING){e++;let r=kn(t,Jt.CHANGE,s=>{let o=t.getState();(o==rn.LOADED||o==rn.ERROR||o==rn.EMPTY)&&(ri(r),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},n,r){t.getState()==rn.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(ri),this.sourcesListenerKeys_=null}release(){this.canvas_&&($0(this.canvas_.getContext("2d")),Y0.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},Fw=NP;var koe=/\{z\}/g,Goe=/\{x\}/g,zoe=/\{y\}/g,Voe=/\{-y\}/g;function hz(i,e,t,n,r){return i.replace(koe,e.toString()).replace(Goe,t.toString()).replace(zoe,n.toString()).replace(Voe,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 fz(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 qoe(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 hz(i,o,t[1],t[2],s)})}function dz(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=qoe(i[r],e);return Hoe(n)}function Hoe(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=zG(e),s=vu(r,i.length);return i[s](e,t,n)})}var Nc={PROPERTYCHANGE:"propertychange"};var Tg=class extends wd{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Jt.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=kn(this,e[s],t);return r}return kn(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){let r=e.length;n=new Array(r);for(let s=0;s<r;++s)n[s]=wg(this,e[s],t)}else n=wg(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)Woe(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)}};Tg.prototype.on;Tg.prototype.once;Tg.prototype.un;function Woe(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)ri(i[e]);else ri(i)}var Ow=Tg;var Bw=class extends Ys{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},LP=class extends Ow{constructor(e){super(),this.on,this.once,this.un,Ln(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new Bw(n,e,t)),n=Nc.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new Bw(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],Mc(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},ys=LP;var DP=class extends ys{constructor(e){super(),this.projection=xs(e.projection),this.attributions_=pz(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_=pz(e),this.changed()}setState(e){this.state_=e,this.changed()}};function pz(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var Uw=DP;var FP=class extends Uw{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&&Wr(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Ln(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){let t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,s,o){return Yn()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:Mw(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=Wr(r.getTileSize(e),this.tmpSize);return s==1?o:NG(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=HG(r,e,n)),VG(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},kw=class extends Ys{constructor(e,t){super(e),this.tile=t}},Az=FP;var Gw={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var OP=class i extends Az{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===i.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){let t=e.target,n=Ln(t),r=t.getState(),s;r==rn.LOADING?(this.tileLoadingKeys_[n]=!0,s=Gw.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==rn.ERROR?Gw.TILELOADERROR:r==rn.LOADED?Gw.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new kw(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=fz(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`2+`);this.generateTileUrlFunction_?this.setTileUrlFunction(dz(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},mz=OP;var BP=class extends mz{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:joe,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:Nw,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!gg(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||gg(t,e)))return this.tileGrid;let n=Ln(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=Mw(e)),this.tileGridForProjection[n]}createTile_(e,t,n,r,s,o){let a=[e,t,n],l=this.getTileCoordForTileUrlFunction(a,s),c=l?this.tileUrlFunction(l,r,s):void 0,u=new this.tileClass(a,c!==void 0?rn.IDLE:rn.EMPTY,c!==void 0?c:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return u.key=o,u.addEventListener(Jt.CHANGE,this.handleTileChange.bind(this)),u}getTile(e,t,n,r,s,o){let a=this.getProjection();if(!a||!s||gg(a,s))return this.getTileInternal(e,t,n,r,a||s);let l=[e,t,n],c=this.getKey(),u=this.getTileGridForProjection(a),f=this.getTileGridForProjection(s),p=this.getTileCoordForTileUrlFunction(l,s),x=new Fw(a,u,s,f,l,p,this.getTilePixelRatio(r),this.getGutter(),(v,w,S,T)=>this.getTileInternal(v,w,S,T,a,o),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return x.key=c,x}getTileInternal(e,t,n,r,s,o){let a=this.getKey(),l=vg(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=xs(e);if(n){let r=Ln(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}};function joe(i,e){if(Os){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 gz=BP;var UP=class extends gz{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:WG({extent:Cw(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_}},_z=UP;function Lc(){if(!U.map||!U.variant||U.settling)return;let i=U.engine?.getView();try{let e=xz();e.last=U.game.slug,e.games[U.game.slug]={game:U.game.slug,map:U.map.slug,variant:U.map.variants.indexOf(U.variant),center:i?.getCenter(),zoom:i?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},localStorage.setItem(K4,JSON.stringify(e))}catch{}}function xz(){try{let i=JSON.parse(localStorage.getItem(K4)||"null");if(i&&i.games)return i}catch{}return{last:"",games:{}}}function Eg(i){let e=xz(),t=i||e.last,n=t&&e.games[t];return n&&n.game&&n.map?n:null}function Mg(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{game:i,map:e}}function yz(){if(!U.game||!U.map)return;let i=`#${U.game.slug}/${U.map.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var kP=class i extends ys{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}clone(){let e=new i,t=this.geometryName_;e.setGeometryName(t);let n=this.getPropertiesInternal();if(n){let s=this.getGeometry();for(let o in n)o===t&&s?e.set(o,s.clone()):e.set(o,n[o],!0)}let r=this.getStyle();return r&&e.setStyle(r),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(ri(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=kn(e,Jt.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?Xoe(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 Xoe(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(Vn(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}var Sd=kP;function Ga(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 zw(i,e,t,n,r,s,o){o=o||[];let a=Math.cos(r),l=Math.sin(r),c=s[0],u=s[1],f=0;for(let p=e;p<t;p+=n){let x=i[p]-c,v=i[p+1]-u;o[f++]=c+x*a-v*l,o[f++]=u+x*l+v*a;for(let w=p+2;w<p+n;++w)o[f++]=i[w]}return o&&o.length!=f&&(o.length=f),o}function vz(i,e,t,n,r,s,o,a){a=a||[];let l=o[0],c=o[1],u=0;for(let f=e;f<t;f+=n){let p=i[f]-l,x=i[f+1]-c;a[u++]=l+r*p,a[u++]=c+s*x;for(let v=f+2;v<f+n;++v)a[u++]=i[v]}return a&&a.length!=u&&(a.length=u),a}function bz(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 wz=Zs(),$oe=[NaN,NaN],GP=class extends ys{constructor(){super(),this.extent_=Rr(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Rw((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 Yn()}closestPointXY(e,t,n,r){return Yn()}containsXY(e,t){return this.closestPointXY(e,t,$oe,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 Yn()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&B0(t),this.extentRevision_=this.getRevision()}return eG(this.extent_,e)}rotate(e,t){Yn()}scale(e,t,n){Yn()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return Yn()}getType(){return Yn()}applyTransform(e){Yn()}intersectsExtent(e){return Yn()}translate(e,t){Yn()}transform(e,t){let n=xs(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){let l=n.getExtent(),c=n.getWorldExtent(),u=_r(c)/_r(l);uo(wz,c[0],c[3],u,-u,0,0,0);let f=Ga(s,0,s.length,a,wz,o),p=H0(n,t);return p?p(f,f,a):f}:H0(n,t);return this.applyTransform(r),this}},Sz=GP;var zP=class extends Sz{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return lg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return Yn()}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=Tz(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){Yn()}setLayout(e,t,n){let r;if(e)r=Tz(e);else{for(let s=0;s<n;++s){if(t.length===0){this.layout="XY",this.stride=2;return}t=t[0]}r=t.length,e=Yoe(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();zw(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=Ua(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();vz(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();bz(n,0,n.length,r,e,t,n),this.changed()}}};function Yoe(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function Tz(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function Ez(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return Ga(n,0,n.length,r,e,t)}var wu=zP;function Mz(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function Ex(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 VP(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=Ex(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function Cz(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=VP(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 qP=class i extends wu{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=Tc(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 cw(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return mx(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Mz(this.flatCoordinates,0,e,this.stride),this.changed()}},rf=qP;function HP(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 WP(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=HP(i,e,a,n),e=a}return r}function Rz(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=WP(i,e,a,n),e=a[a.length-1]}return r}function Pz(i,e,t,n,r,s,o){let a=i[e],l=i[e+1],c=i[t]-a,u=i[t+1]-l,f;if(c===0&&u===0)f=e;else{let p=((r-a)*c+(s-l)*u)/(c*c+u*u);if(p>1)f=t;else if(p>0){for(let x=0;x<n;++x)o[x]=No(i[e+x],i[t+x],p);o.length=n;return}else f=e}for(let p=0;p<n;++p)o[p]=i[f+p];o.length=n}function jP(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=Tc(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function XP(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=jP(i,e,a,n,r),e=a}return r}function Iz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=XP(i,e,a,n,r),e=a[a.length-1]}return r}function $P(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,p;if(r===0){if(p=Tc(o,a,i[e],i[e+1]),p<c){for(f=0;f<n;++f)l[f]=i[e+f];return l.length=n,p}return c}u=u||[NaN,NaN];let x=e+n;for(;x<t;)if(Pz(i,x-n,x,n,o,a,u),p=Tc(o,a,u[0],u[1]),p<c){for(c=p,f=0;f<n;++f)l[f]=u[f];l.length=n,x+=n}else x+=n*Math.max((Math.sqrt(p)-Math.sqrt(c))/r|0,1);if(s&&(Pz(i,t-n,e,n,o,a,u),p=Tc(o,a,u[0],u[1]),p<c)){for(c=p,f=0;f<n;++f)l[f]=u[f];l.length=n}return c}function YP(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,p=t.length;f<p;++f){let x=t[f];c=$P(i,e,x,n,r,s,o,a,l,c,u),e=x}return c}function Nz(i,e,t,n,r,s,o,a,l,c,u){u=u||[NaN,NaN];for(let f=0,p=t.length;f<p;++f){let x=t[f];c=YP(i,e,x,n,r,s,o,a,l,c,u),e=x[x.length-1]}return c}function Su(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 Cg(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++]=Su(i,e,l,n,r[s]),e=l}return r.length=s,r}function Mx(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?[]:Cg(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}function Cx(i,e,t,n,r,s,o){let a=(t-e)/n;if(a<3){for(;e<t;e+=n)s[o++]=i[e],s[o++]=i[e+1];return o}let l=new Array(a);l[0]=1,l[a-1]=1;let c=[e,t-n],u=0;for(;c.length>0;){let f=c.pop(),p=c.pop(),x=0,v=i[p],w=i[p+1],S=i[f],T=i[f+1];for(let P=p+n;P<f;P+=n){let R=i[P],C=i[P+1],L=sG(R,C,v,w,S,T);L>x&&(u=P,x=L)}x>r&&(l[(u-e)/n]=1,p+n<u&&c.push(p,u),u+n<f&&c.push(u,f))}for(let f=0;f<a;++f)l[f]&&(s[o++]=i[e+f*n],s[o++]=i[e+f*n+1]);return o}function Lz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Cx(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Td(i,e){return e*Math.round(i/e)}function Zoe(i,e,t,n,r,s,o){if(e==t)return o;let a=Td(i[e],r),l=Td(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=Td(i[e],r),u=Td(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=Td(i[e],r),p=Td(i[e+1],r);if(e+=n,f==c&&p==u)continue;let x=c-a,v=u-l,w=f-a,S=p-l;if(x*S==v*w&&(x<0&&w<x||x==w||x>0&&w>x)&&(v<0&&S<v||v==S||v>0&&S>v)){c=f,u=p;continue}s[o++]=c,s[o++]=u,a=c,l=u,c=f,u=p}return s[o++]=c,s[o++]=u,o}function Rx(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Zoe(i,e,u,n,r,s,o),a.push(o),e=u}return o}function Dz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=Rx(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var ZP=class i extends wu{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<md(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(jP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),$P(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return HP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return Su(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=Cx(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return Ew(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ex(this.flatCoordinates,0,e,this.stride),this.changed()}},KP=ZP;function Px(i,e,t,n,r,s,o){let a,l,c,u,f,p,x,v=r[s+1],w=[];for(let P=0,R=t.length;P<R;++P){let C=t[P];for(u=i[C-n],p=i[C-n+1],a=e;a<C;a+=n)f=i[a],x=i[a+1],(v<=p&&x<=v||p<=v&&v<=x)&&(c=(v-p)/(x-p)*(f-u)+u,w.push(c)),u=f,p=x}let S=NaN,T=-1/0;for(w.sort(ka),u=w[0],a=1,l=w.length;a<l;++a){f=w[a];let P=Math.abs(f-u);P>T&&(c=(u+f)/2,wx(i,e,t,n,c,v)&&(S=c,T=P)),u=f}return isNaN(S)&&(S=r[s]),o?(o.push(S,v,T),o):[S,v,T]}function Vw(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=Px(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function Fz(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 QP(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 JP(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=QP(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 Oz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!JP(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function qw(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=QP(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&Fz(i,e,a,n),e=a}return e}function eI(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=qw(i,e,t[s],n,r);return e}function Bz(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=QP(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 Hw=class i extends wu{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?Ic(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<md(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(XP(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),YP(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return wx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return WP(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),qw(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,Cg(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=Ua(this.getExtent());this.flatInteriorPoint_=Px(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new rf(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new KP(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 KP(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;JP(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=qw(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Rx(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return gP(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=VP(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},Tu=Hw;function tI(i){if(yu(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 Hw(s,"XY",[s.length])}function Uz(){let i=U.variant?.surface;return i?[i.x,-(i.y+i.height),i.x+i.width,-i.y]:$l()}function kz(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),Gz(),U.gridEnabled?(we.gridInput.focus(),we.gridInput.select()):we.viewport.focus({preventScroll:!0}),!0):i.key===" "&&U.gridEnabled&&i.target!==we.subgridToggle?(i.preventDefault(),Ix(!U.subgridVisible),!0):i.key==="Escape"&&U.gridEnabled?(i.preventDefault(),iI(),!0):!1}function Gz(i=!U.gridEnabled){U.gridEnabled=i,i&&Ix(!0),Ww(),Eu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()}function Ix(i){U.subgridVisible=i,U.layers.grid.changed(),U.layers.gridContext.changed(),we.subgridToggle.setAttribute("aria-pressed",String(i)),we.subgridToggle.setAttribute("aria-label",i?"Hide the subgrid":"Show the subgrid"),zz(),document.dispatchEvent(new Event("atlas:grid"))}function zz(){if(!U.gridEnabled){we.gridHint.textContent="G \xB7 grid off";return}we.gridHint.textContent=`G-${U.gridPrefix||"root"}`+(U.subgridVisible?"":" no subgrid")}function Z0(i){let e=Ed(),t=[...i.toLocaleLowerCase()].filter(r=>Hl.includes(r)).slice(0,e).join(""),n=t!==U.gridPrefix;U.gridPrefix=t,U.gridEnabled||(U.gridEnabled=!0),Ww(),Eu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed(),n&&(Dc(),U.engine.getView().fit(Rg(),{size:U.engine.getSize(),padding:[52,52,52,52],maxZoom:Mu(U.variant),duration:180}))}function iI(){if(U.gridEnabled){if(!U.gridPrefix){Gz(!1);return}Z0(U.gridPrefix.slice(0,-1))}}function Ww(){if(U.sources){if(U.sources.grid.clear(),U.sources.gridContext.clear(),we.gridNavigator.hidden=!U.gridEnabled,zz(),U.gridEnabled&&U.variant){let i=Ed();we.gridInput.maxLength=i,we.gridInput.value=U.gridPrefix,we.gridBack.title=U.gridPrefix?"Back one geohash level":"Close geohash grid";for(let e of jw())Qoe(e.hash,e.extent,e.role,e.contextDistance)}document.dispatchEvent(new Event("atlas:grid"))}}function jw(){let i=[];for(let e=0;e<U.gridPrefix.length;e++){let t=U.gridPrefix.slice(0,e),n=U.gridPrefix.slice(0,e+1);for(let r of Hl){let s=t+r;s!==n&&i.push({hash:s,extent:nI(s),role:"neighbor",contextDistance:U.gridPrefix.length-e})}}if(U.gridPrefix.length>=Ed())return i.push({hash:U.gridPrefix,extent:Rg(),role:"leaf",contextDistance:0}),i;U.gridPrefix&&i.push({hash:U.gridPrefix,extent:Rg(),role:"scope",contextDistance:0});for(let e of Hl){let t=U.gridPrefix+e;i.push({hash:t,extent:nI(t),role:"child",contextDistance:0})}return i}function Qoe(i,e,t,n=0){let[r,s,o,a]=e,l=U.pins.filter(f=>{if(f.filteredHidden)return!1;let[p,x]=f.coordinate;return p>=r&&p<=o&&x>=s&&x<=a}).length,c=new Sd({geometry:new Tu([[[r,s],[r,a],[o,a],[o,s],[r,s]]]),gridCell:{hash:i,extent:e,role:t,count:l,contextDistance:n},priority:t==="neighbor"?-n*100+Hl.indexOf(i[i.length-1]):Hl.indexOf(i[i.length-1])});(t==="neighbor"?U.sources.gridContext:U.sources.grid).addFeature(c)}function Rg(){return nI(U.gridPrefix)}function nI(i){let e=[...Uz()],t=!0;for(let n of i){let r=Hl.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 Ed(){return 3}function Xw(i,e=Ed()){let t=[...Uz()],[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+=Hl[l]}return o}function Md(i){if(!U.gridEnabled||!U.gridPrefix)return!1;let e=Rg(),[t,n]=i.coordinate;return t>=e[0]&&t<=e[2]&&n>=e[1]&&n<=e[3]}function K0(){return Q9[U.map?.iconOutset==="dark"?"dark":"light"]}function Joe(i){let e=U.map?.iconOutset==="dark",t=tae(i);return(e?t>.3:t<.88)?i:eae(i,e?.74:.42)}function eae(i,e){let t=String(i).replace("#","");if(t.length!==6)return i;let[n,r,s]=[0,2,4].map(R=>parseInt(t.slice(R,R+2),16)/255),o=Math.max(n,r,s),a=Math.min(n,r,s),l=(o+a)/2,c=0,u=o-a,f=u===0?0:u/(1-Math.abs(2*l-1));u!==0&&(o===n?c=(r-s)/u%6:o===r?c=(s-n)/u+2:c=(n-r)/u+4,c*=60,c<0&&(c+=360));let p=(1-Math.abs(2*e-1))*f,x=p*(1-Math.abs(c/60%2-1)),v=e-p/2,[w,S,T]=c<60?[p,x,0]:c<120?[x,p,0]:c<180?[0,p,x]:c<240?[0,x,p]:c<300?[x,0,p]:[p,0,x],P=R=>Math.round((R+v)*255).toString(16).padStart(2,"0");return`#${P(w)}${P(S)}${P(T)}`}function tae(i){let e=String(i).replace("#","");if(e.length!==6)return .5;let t=n=>parseInt(e.slice(n,n+2),16)/255;return .2126*t(0)+.7152*t(2)+.0722*t(4)}function $w(i){let e=Math.abs(Number(i)||0);return og[(Math.imul(e,2654435761)>>>0)%og.length]}function sf(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 Pg(i,e){i.style.setProperty("--pin-color",Q0(e))}function Q0(i){return Joe(i.color||$w(i.id))}function Ig(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("${rI(e.iconAsset)}")`),i.classList.add("has-source-icon")}function rI(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${U.game.base}/icons/${e}`}function Fc(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function Vz(i){return Math.imul(Number(i)||0,2654435761)>>>0}function qz(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`3+4+`).trim()}function Oc(i){return new Intl.NumberFormat().format(i)}function vs(i,e,t){return Math.min(t,Math.max(e,i))}function Yw(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var nae=100;function Cd(){if(!we.searchResults)return;let i=U.pins.filter(n=>!n.filteredHidden).sort((n,r)=>n.location.title.localeCompare(r.location.title)),e=i.slice(0,nae),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),Pg(r,n.category);let s=document.createElement("span");s.className="result-dot",Ig(s,n.category,Fc(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 ${Oc(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}we.searchResults.replaceChildren(t),rae(i.length),iae()}var Hz=28;function iae(){let i=U.selectedPin?.location.title||"",e=i.length>Hz?`${i.slice(0,Hz-1).trimEnd()}\u2026`:i;we.dockRailName.textContent=e?` \xB7 ${e}`:"",we.dockRailName.hidden=!e}function rae(i){we.dockCount.textContent=`${Oc(i)} ${i===1?"location":"locations"}`,U.search?(we.dockFlag.textContent=`\u201C${U.search}\u201D`,we.dockFlag.hidden=!1):U.hiddenCategories.size>0?(we.dockFlag.textContent="filtered",we.dockFlag.hidden=!1):we.dockFlag.hidden=!0}function Zw(){!U.dockFolded||U.dockDismissed||Kw(!1)}function sI(i){U.dockDismissed=i,Kw(i)}function Kw(i,e=!0){U.dockFolded=i,we.dock.classList.toggle("is-folded",i),we.dockFold.setAttribute("aria-expanded",String(!i));let t=i?"Bring the panel back (\u2318\u2325B)":"Put the panel away (\u2318\u2325B)";we.dockFold.setAttribute("aria-label",t),we.dockFold.setAttribute("title",t),e&&Lc()}function oI(i){U.hiddenCategories.delete(i.category.id),Lx(),Yl(),Rd(),Nx(i,!0)}function Nx(i,e=!1){U.selectedPin=i,document.dispatchEvent(new Event("atlas:selection")),Eu(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed(),we.detailTitle.textContent=i.location.title,we.detailCategory.textContent=`${i.group.title} / ${i.category.title}`,we.detailDescription.textContent="",we.detailLinks.hidden=!0,oae(i),we.detailID.textContent=String(i.location.id),we.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=Xw(i.coordinate);we.detailCell.textContent=t,we.detailCellField.hidden=!t;let n=sae(i);if(we.detailSource.textContent=n,we.detailSourceField.hidden=!n,Pg(we.detailDot,i.category),Ig(we.detailDot,i.category,Fc(i.category.title)),we.detail.hidden=!1,Zw(),Cd(),e){let r=U.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(Mu(U.variant),Math.max(r.getZoom()||0,4)),duration:220})}}function sae(i){let e=U.map?.merged;if(!e?.length)return"";let t=e.find(n=>n.origin)?.source||"";if(U.pinSourceIndex?.map!==U.map){let n=new Map;for(let r of e){for(let s of r.adopted||[])n.set(s.d,r.source);for(let s of r.matched||[]){let o=`confirmed by ${r.source}`;n.set(s.w,t?`${t} \xB7 ${o}`:o)}}U.pinSourceIndex={map:U.map,byID:n}}for(let n of e)if(!n.origin&&i.group.title===n.source)return n.source;return U.pinSourceIndex.byID.get(i.location.id)||t}async function oae(i){let e=await Wz();if(U.selectedPin!==i)return;let t=e[String(i.location.id)]||{};i.location.description=t.d||"",i.location.links=t.l||[],we.detailDescription.textContent=qz(t.d)||"No description is included in the archive.",aae(i)}function aae(i){let e=(i.location.links||[]).filter(n=>U.pinByID.has(n.locationId));if(we.detailLinks.hidden=e.length===0,!e.length){we.detailLinks.replaceChildren();return}let t=document.createDocumentFragment();for(let n of e){let r=document.createElement("button");r.type="button",r.className="detail-link",r.dataset.location=String(n.locationId),r.textContent=n.title,t.append(r)}we.detailLinks.replaceChildren(t)}function Dc(){let i=U.selectedPin!==null;U.selectedPin=null,document.dispatchEvent(new Event("atlas:selection")),U.sources&&(Eu(),U.layers.pins.changed(),U.layers.pinLabels.changed(),U.layers.text.changed(),U.layers.textDetail.changed(),U.layers.priority.changed()),we.detail.hidden=!0,i&&Cd()}function Cu(i){let e=i.attrs?.["atlas.render.as"];return e||(i.displayType==="text"?"text":"pin")}function jz(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function of(i){let e=i?.attrs||{};if(e["atlas.geometry.projection"]!=="equirect")return null;let t=(e["atlas.geometry.equirect.px"]||"").split(",").map(Number),n=(e["atlas.geometry.equirect.deg"]||"").split(",").map(Number);if(t.length!==4||n.length!==4||t.some(Number.isNaN)||n.some(Number.isNaN))return null;let[r,s,o,a]=t,[l,c,u,f]=n;return!o||!a||c===f||l===u?null:{toLatLng(p,x){return[c-(x-s)/a*(c-f),l+(p-r)/o*(u-l)]},toWorld(p,x){return[r+(x-l)/(u-l)*o,s+(c-p)/(c-f)*a]}}}var Jw=[NaN,NaN,NaN,0],aI;function lae(){return aI||(aI=Ti(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),aI}var cae=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,uae=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,hae=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,fae=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Qw(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Fx(i){throw new Error('failed to parse "'+i+'" as color')}function Xz(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(uae)||i.match(cae)||i.match(hae);if(s){let o=s[4],a=100/255;return[xi(Qw(s[1],a)+.5|0,0,255),xi(Qw(s[2],a)+.5|0,0,255),xi(Qw(s[3],a)+.5|0,0,255),o!==void 0?xi(Qw(o,100),0,1):1]}Fx(i)}if(i.startsWith("#")){if(fae.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}Fx(i)}let e=lae();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&&Fx(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Xz(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]=G0(r[3]/255,3),r}function $z(i){return typeof i=="string"?i:Bx(i)}var dae=1024,Dx={},lI=0;function Yz(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function cI(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function uI(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function hI(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function fI(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function dI(i){let e=hI(i[0]),t=hI(i[1]),n=hI(i[2]),r=fI(e*.222488403+t*.716873169+n*.06060791),s=500*(fI(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-fI(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 Zz(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=uI(e),s=uI(e+t/500*Math.cos(n)),o=uI(e-t/200*Math.sin(n)),a=cI(s*3.021973625-r*1.617392459-o*.404875592),l=cI(s*-.943766287+r*1.916279586+o*.027607165),c=cI(s*.069407491-r*.22898585+o*1.159737864);return[xi(a+.5|0,0,255),xi(l+.5|0,0,255),xi(c+.5|0,0,255),i[3]]}function Ox(i){if(i==="none")return Jw;if(Dx.hasOwnProperty(i))return Dx[i];if(lI>=dae){let t=0;for(let n in Dx)(t++&3)===0&&(delete Dx[n],--lI)}let e=Xz(i);e.length!==4&&Fx(i);for(let t of e)isNaN(t)&&Fx(i);return Dx[i]=e,++lI,e}function Zl(i){return Array.isArray(i)?i:Ox(i)}function Bx(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 AI=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=pI(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=pI(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=pI(e,t),o=s in this.cache_;this.cache_[s]=n,r&&(n.getImageState()===Mn.IDLE&&n.load(),n.getImageState()===Mn.LOADING?n.ready().then(()=>{this.patternCache_[s]=Tx().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=Tx().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function pI(i,e){let t=e?Zl(e):"null";return i+":"+t}var Do=new AI;var Ux=null,eS=class extends wd{constructor(e,t,n,r,s){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=r===void 0?Mn.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Mn.LOADED){Ux||(Ux=Ti(1,1,void 0,{willReadFrequently:!0})),Ux.drawImage(this.image_,0,0);try{Ux.getImageData(0,0,1,1),this.tainted_=!1}catch{Ux=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(Jt.CHANGE)}handleImageError_(){this.imageState_=Mn.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Mn.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],n=Ti(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Mn.IDLE){this.image_||this.initializeImage_(),this.imageState_=Mn.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&KG(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Mn.LOADED)return;let t=this.image_,n=Ti(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=$z(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===Mn.LOADED||this.imageState_===Mn.ERROR)e();else{let t=()=>{(this.imageState_===Mn.LOADED||this.imageState_===Mn.ERROR)&&(this.removeEventListener(Jt.CHANGE,t),e())};this.addEventListener(Jt.CHANGE,t)}})),this.ready_}};function Pd(i,e,t,n,r,s){let o=e===void 0?void 0:Do.get(e,r);return o||(o=new eS(i,i&&"src"in i?i.src||void 0:e,t,n,r),Do.set(e,r,o,s)),s&&o&&!Do.getPattern(e,r)&&Do.set(e,r,o,s),o}var Kz=eS;function za(i){return i?Array.isArray(i)?Bx(i):typeof i=="object"&&"src"in i?pae(i):i:null}function pae(i){if(!i.offset||!i.size)return Do.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=Do.getPattern(e,i.color);if(t)return t;let n=Do.get(i.src,null);if(n.getImageState()!==Mn.LOADED)return null;let r=Ti(i.size[0],i.size[1]);return r.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),Pd(r.canvas,e,void 0,Mn.LOADED,i.color,!0),Do.getPattern(e,i.color)}var kx="ol-hidden";var Id="ol-unselectable";var Ng="ol-control",mI="ol-collapsed",Aae=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"),Qz=["style","variant","weight","size","lineHeight","family"],tS={normal:400,bold:700},nS=function(i){let e=i.match(Aae);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=Qz.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[Qz[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in tS&&(t.weight=tS[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var iS="10px sans-serif",Bs="#000",Ru="round",Va=[],qa=0,Pu="round",af=10,eV=0,Fo="#000",Nd="center",eA="middle",lf=[0,0,0,0],cf=1,J0=new ys,Gx=null,Jz,gI={},mae=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function gae(i,e,t){return`${i} ${e} 16px "${t}"`}var tV=(function(){let e,t;async function n(s){await t.ready;let o=nS(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let p=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),x=tS[f.weight]||f.weight;p===a&&f.style===o.style&&x==l&&c.push(f)}),c.length===0?!1:(await Promise.all(c.map(f=>f.load().then(()=>!0,()=>!1)))).some(f=>f)}async function r(){await t.ready;let s=!0,o=J0.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){let c=a[l],u=o[c];u<100&&(await n(c)?(bu(gI),J0.set(c,100)):(u+=10,J0.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=Os?self.fonts:document.fonts);let o=nS(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(mae.has(c))continue;let u=gae(o.style,o.weight,c);J0.get(u)===void 0&&(J0.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),_ae=(function(){let i;return function(e){let t=gI[e];if(t==null){if(Os){let n=nS(e),r=nV(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);gI[e]=t}return t}})();function nV(i,e){return Gx||(Gx=Ti(1,1)),i!=Jz&&(Gx.font=i,Jz=Gx.font),Gx.measureText(e)}function iV(i,e){return nV(i,e).width}function _I(i,e,t){if(e in t)return t[e];let n=e.split(`5+`).reduce((r,s)=>Math.max(r,iV(i,s)),0);return t[e]=n,n}function rV(i,e){let t=[],n=[],r=[],s=0,o=0,a=0,l=0;for(let c=0,u=e.length;c<=u;c+=2){let f=e[c];if(f===`6+`||c===u){s=Math.max(s,o),r.push(o),o=0,a+=l,l=0;continue}let p=e[c+1]||i.font,x=iV(p,f);t.push(x),o+=x;let v=_ae(p);n.push(v),l=Math.max(l,v)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function sV(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]),xae(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 xae(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 xI=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=Wr(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 Yn()}getImage(e){return Yn()}getHitDetectionImage(){return Yn()}getPixelRatio(e){return 1}getImageState(){return Yn()}getImageSize(){return Yn()}getOrigin(){return Yn()}getSize(){return Yn()}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_=Wr(e)}listenImageChange(e){Yn()}load(){Yn()}unlistenImageChange(e){Yn()}ready(){return Promise.resolve()}},rS=xI;var yI=class i extends rS{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0?e.rotateWithView:!1,rotation:e.rotation!==void 0?e.rotation:0,scale:e.scale!==void 0?e.scale:1,displacement:e.displacement!==void 0?e.displacement:[0,0],declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill!==void 0?e.fill:null,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle!==void 0?e.angle:0,this.stroke_=e.stroke!==void 0?e.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Mn.LOADING:Mn.LOADED,this.imageState_===Mn.LOADING&&this.ready().then(()=>this.imageState_=Mn.LOADED),this.render()}clone(){let e=this.getScale(),t=new i({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return t.setOpacity(this.getOpacity()),t}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(","),r=Do.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Ti(o,o);this.draw_(s,a,e),r=a.canvas;let l=new Kz(r,void 0,null,Mn.LOADED,null);Do.set(n,null,l),createImageBitmap(r).then(c=>{l.setImage(c)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!=="bevel"&&e!=="miter")return t;let r=this.radius,s=this.radius2_===void 0?r:this.radius2_;if(r<s){let D=r;r=s,s=D}let o=this.radius2_===void 0?this.points_:this.points_*2,a=2*Math.PI/o,l=s*Math.sin(a),c=Math.sqrt(s*s-l*l),u=r-c,f=Math.sqrt(l*l+u*u),p=f/l;if(e==="miter"&&p<=n)return p*t;let x=t/2/p,v=t/2*(u/f),S=Math.sqrt((r+x)*(r+x)+v*v)-r;if(this.radius2_===void 0||e==="bevel")return S*2;let T=r*Math.sin(a),P=Math.sqrt(r*r-T*T),R=s-P,L=Math.sqrt(T*T+R*R)/T;if(L<=n){let D=L*t/2-s-r;return 2*Math.max(S,D)}return S*2}createRenderOptions(){let e=Ru,t=Pu,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=za(this.stroke_.getColor()??Fo),a=this.stroke_.getWidth()??cf,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Pu,e=this.stroke_.getLineCap()??Ru,n=this.stroke_.getMiterLimit()??af);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=Bs),t.fillStyle=za(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=Zl(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Ti(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{let r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);let s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){let l=s+a*o,c=a%2===0?n:r;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=Bs,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()}},sS=yI;var vI=class i extends sS{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}},oS=vI;var bI=class i{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){let t=Pd(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===Mn.IDLE&&t.load(),t.getImageState()===Mn.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Ln(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Zl(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},jr=bI;function oV(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 wI=class i extends rS{constructor(e){e=e||{};let t=e.opacity!==void 0?e.opacity:1,n=e.rotation!==void 0?e.rotation:0,r=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:n,scale:r,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;let o=e.img!==void 0?e.img:null,a=e.src;Vn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Ln(o)),Vn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Vn(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=Mn.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?Mn.LOADED:Mn.IDLE:l=Mn.LOADING:l=Mn.LOADED),this.color_=e.color!==void 0?Zl(e.color):null,this.iconImage_=Pd(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let c,u;if(e.size)[c,u]=e.size;else{let f=this.getImage(1);if(f.width&&f.height)c=f.width,u=f.height;else if(f instanceof HTMLImageElement){this.initialOptions_=e;let p=()=>{if(this.unlistenImageChange(p),!this.initialOptions_)return;let x=this.iconImage_.getSize();this.setScale(oV(x[0],x[1],e.width,e.height))};this.listenImageChange(p);return}}c!==void 0&&this.setScale(oV(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?Zl(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((o,a)=>o===t[a]))return;this.color_=t;let n=this.getSrc(),r=n!==void 0?null:this.getHitDetectionImage(),s=n!==void 0?Mn.IDLE:this.iconImage_.getImageState();this.iconImage_=Pd(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=Pd(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Mn.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==Mn.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==Mn.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(Jt.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(Jt.CHANGE,e)}ready(){return this.iconImage_.ready()}},tA=wI;var SI=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}},Ks=SI;var aS=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=aV,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_=aV,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function lV(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(Vn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var TI=null;function EI(i,e){if(!TI){let t=new jr({color:"rgba(255,255,255,0.4)"}),n=new Ks({color:"#3399CC",width:1.25});TI=[new aS({image:new oS({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return TI}function aV(i){return i.getGeometry()}var Us=aS;var yae="#333",MI=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_=Wr(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 jr({color:yae}),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 jr?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_=Wr(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}},uf=MI;function Kl(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function hV(i){let e=i.get("pin");return!e||Ql(e)||e.insideHighlightedZone||Lg(e)?null:CI(e,!1)}function fV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Ql(e)||Lg(e)?null:CI(e,!1)}function dV(i){let e=i.get("pin");return!e||Ql(e)||!U.labelsHeld?null:_V(e)}function pV(i){let e=i.get("pin");if(!e||Ql(e)||e.insideHighlightedZone||Lg(e)||qx())return null;if(U.labelsHeld)return zx(e,!1);let t=U.fitZoom+Math.log2(EV(e.category));return(U.engine.getView().getZoom()||0)<t?null:zx(e,!1)}function AV(i){let e=i.get("pin");return!e||Ql(e)||e.insideHighlightedZone||Lg(e)||!qx()?null:zx(e,!1)}function mV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Ql(e)||Lg(e)?null:zx(e,!1)}function gV(i){let e=i.get("pin");if(!e||Ql(e))return null;if(Cu(e.category)==="text")return zx(e,e===U.selectedPin);let t=CI(e,e===U.selectedPin);return e===U.hoveredPin||e===U.selectedPin?[t,_V(e)]:t}function CI(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let n=Q0(i.category),r=e?2e7:i.priority,s=U.markerIcons.get(Vx(i.category)),o;return s?o=new Us({image:new tA({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new Us({text:new uf({text:Fc(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new jr({color:n}),stroke:new Ks({color:K0(),width:e?4:3})}),zIndex:r}),U.styleCache.set(t,o),o}function _V(i){let e=`marker-label:${i.location.id}`;if(U.styleCache.has(e))return U.styleCache.get(e);let t=new Us({text:new uf({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new jr({color:"#f2ece0"}),stroke:new Ks({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new jr({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 xV(i){if(!i.iconAsset)return;let e=Vx(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=Q0(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=K0(),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")),vae(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.priority.changed()},t.onerror=()=>U.markerIcons.set(e,!1),t.src=rI(i.iconAsset)}function vae(){for(let i of U.styleCache.keys())i.startsWith("marker:")&&U.styleCache.delete(i)}function Vx(i){return`${i.iconAsset||""}:${Q0(i)}:${U.map?.iconOutset||"light"}`}function zx(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let r=[new Us({text:new uf({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new jr({color:e?"#7fd0ea":"#f2ece0"}),stroke:new Ks({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new jr({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new Ks({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 RI(i,e){let t=i.get("gridCell");if(!t)return null;let n=t.role==="leaf",r=t.role==="scope",s=t.role==="neighbor",o=n||r?15:s?10:11,l=`${n||r?900:s?750:800} ${o}px ui-monospace, SFMono-Regular, Menlo, monospace`,c=s?[2,4,2,4]:[3,5,3,5],u=bae(t,l,o,c,e);if(t.role==="child"&&(!u||!U.subgridVisible))return null;let f=r&&U.subgridVisible,p=`grid:${t.hash}:${t.role}:${t.contextDistance}:${u?1:0}:${f?1:0}`;if(U.styleCache.has(p))return U.styleCache.get(p);let x=og[Math.max(0,Hl.indexOf(t.hash[t.hash.length-1]))%og.length],v=new Us({fill:r?void 0:new jr({color:s?`rgba(5, 8, 16, ${Math.min(.52,.3+t.contextDistance*.06)})`:sf(x,n?.14:.055)}),stroke:new Ks({color:n||r?"#ffffff":sf(x,s?.44:.82),width:n?2.5:r?f?1.8:2.5:s?1:1.4}),text:u&&!f?new uf({text:t.hash,font:l,fill:new jr({color:n||r?"#ffffff":s?sf(x,.72):x}),stroke:new Ks({color:"rgba(0,0,0,0.96)",width:4}),backgroundFill:new jr({color:s?"rgba(8,11,18,0.88)":"rgba(12,15,22,0.76)"}),padding:c,overflow:!0}):void 0,zIndex:n||r?100:i.get("priority")});return U.styleCache.set(p,v),v}function bae(i,e,t,n,r){if(!r)return!0;let s=wae(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 cV=document.createElement("canvas").getContext("2d"),uV=new Map;function wae(i,e){let t=`${e}|${i}`,n=uV.get(t);return n===void 0&&(cV.font=e,n=cV.measureText(i).width,uV.set(t,n)),n}var Sae=new Us({fill:new jr({color:"rgba(5, 8, 16, 0.62)"})});function yV(){return U.zonesVisible?Sae:null}function vV(i){if(!U.zonesVisible)return null;let e=i.get("zone"),t=i.get("child"),n=U.highlightedZones.has(e.id),r=TV(e.id),s=`zone:${e.id}:${t?1:0}:${n?1:r?2:0}`;if(U.styleCache.has(s))return U.styleCache.get(s);let o=i.get("color");if(r){let c=new Us({stroke:new Ks({color:sf(o,t?.34:.44),width:t?1:1.3,lineDash:t?[3,4]:[7,5]}),zIndex:t?101:100});return U.styleCache.set(s,c),c}let a=new Us({fill:new jr({color:sf(o,t?.035:.07)}),stroke:new Ks({color:sf(o,t?.5:.72),width:t?1.2:1.8,lineDash:t?[3,4]:[7,5]})});if(!n)return U.styleCache.set(s,a),a;let l=[new Us({stroke:new Ks({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Us({fill:new jr({color:sf(o,.22)}),stroke:new Ks({color:o,width:2.6}),zIndex:9001})];return U.styleCache.set(s,l),l}function bV(i){if(!U.zonesVisible||qx())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:SV(i)}function wV(i){return!U.zonesVisible||!qx()?null:SV(i)}function SV(i){let e=i.get("child"),t=i.get("zone"),n=U.highlightedZones.has(t.id),r=TV(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 Us({text:new uf({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new jr({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new Ks({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 jr({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new Ks({color:n?"#ffffff":sf(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 TV(i){if(!U.highlightedZones.size||U.highlightedZones.has(i))return!1;for(let e of U.highlightedZones)if(Tae(i,e))return!1;return!0}function Tae(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}var PI=class i extends wu{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Ic(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<md(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=Tc(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 Su(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new rf(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 rf(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(mx(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ex(this.flatCoordinates,0,e,this.stride),this.changed()}},MV=PI;function lS(i,e,t,n){let r=[],s=Rr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=lg(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 II=class i extends wu{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){let r=e,s=[],o=[];for(let a=0,l=r.length;a<l;++a){let c=r[a],u=s.length,f=c.getEnds();for(let p=0,x=f.length;p<x;++p)f[p]+=u;Ic(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;Ic(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<md(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Iz(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Nz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return UG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return Rz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),eI(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,Mx(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=lS(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Vw(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new MV(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;Oz(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=eI(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Dz(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 Tu(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){let e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o].slice(),c=l[l.length-1];if(s!==0)for(let f=0,p=l.length;f<p;++f)l[f]-=s;let u=new Tu(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return GG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=Cz(this.flatCoordinates,0,e,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{let r=n[n.length-1];this.flatCoordinates.length=r.length===0?0:r[r.length-1]}this.changed()}},CV=II;function NI(){let i=(U.map.zones||[]).filter(FI);U.renderedShard=U.variant?.shard||0,U.sources.zones.clear(),U.sources.zoneTitles.clear(),U.zoneRecords.clear(),U.highlightedZones.clear(),U.focusedZoneID=null,U.zoneTitleCount=0,cS(!0),we.zoneIndex.hidden=i.length===0,we.zoneCount.textContent=Oc(i.length);for(let e of i){let t=Rr(),n=[],r=!1;for(let l of e.features||[]){let c=Cae(l);c&&(r=!0,n.push(c),uw(t,c.getExtent()),U.sources.zones.addFeature(new Sd({geometry:c,zone:e,color:$w(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=$w(e.id),o=e.center?Dg(e.center.lat,e.center.lng):Ua(t),a=Math.max(t[2]-t[0],t[3]-t[1]);U.sources.zoneTitles.addFeature(new Sd({geometry:new rf(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,PV(),Eae()}function PV(){if(U.sources.zoneScrim.clear(),!U.highlightedZones.size)return;let[i,e,t,n]=U.projection.getExtent(),r=[RV([[i,e],[t,e],[t,n],[i,n],[i,e]],!0)];for(let s of U.highlightedZones)for(let o of U.zoneRecords.get(s)?.geometries||[]){let a=o.getType()==="MultiPolygon"?o.getPolygons():[o];for(let l of a)l.getLinearRings().forEach((c,u)=>{r.push(RV(c.getCoordinates(),u>0))})}U.sources.zoneScrim.addFeature(new Sd({geometry:new Tu(r)}))}function RV(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 Eae(){let i=document.createDocumentFragment();for(let{zone:e,depth:t}of Mae()){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)}we.zoneList.replaceChildren(i),we.zoneIndex.hidden=U.zoneRecords.size===0}function Mae(){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 cS(i){U.zonesVisible=i,we.zoneToggle.checked=i,U.layers.zoneScrim.setVisible(i),U.layers.zones.setVisible(i),U.layers.zoneTitles.setVisible(i),U.layers.zoneTitleDetail.setVisible(i)}function IV(i){let e=U.zoneRecords.get(i);e&&(U.focusedZoneID=i,LV(),Dc(),U.engine.getView().fit(e.extent,{size:U.engine.getSize(),padding:[54,54,54,54],maxZoom:Mu(U.variant),duration:220}),we.sidebar.classList.remove("is-open"),we.mobileLegend.setAttribute("aria-expanded","false"))}function NV(i){U.zoneRecords.has(i)&&(U.highlightedZones.has(i)?U.highlightedZones.delete(i):(U.highlightedZones.add(i),cS(!0)),U.hoveredPin=null,LI(),DI(),LV(),PV(),U.layers.zones.changed(),U.layers.zoneTitles.changed(),U.layers.zoneTitleDetail.changed())}function LV(){we.zoneIndex.classList.toggle("has-highlights",U.highlightedZones.size>0);for(let i of we.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 Cae(i){if(!i?.coordinates)return null;let e=([t,n])=>Dg(n,t);return i.type==="Polygon"?new Tu(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new CV(i.coordinates.map(t=>t.map(n=>n.map(e)))):null}function Dg(i,e){let t=Rae(),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 Rae(){let i=U.game.tileGrid,e=U.map?.grid;return e?{...i,...e}:i}function DV(){U.sources.pins.clear(),U.sources.text.clear(),U.sources.priority.clear(),U.pins=[],U.pinByID.clear();for(let i of U.map.groups)for(let e of i.categories){Cu(e)!=="text"&&xV(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:Dg(t.lat,t.lng),filteredHidden:!1,priority:Lae(e,t),feature:null};n.feature=new Sd({geometry:new rf(n.coordinate),pin:n,priority:n.priority}),U.pins.push(n),U.pinByID.set(t.id,n),Cu(e)==="text"?U.sources.text.addFeature(n.feature):U.sources.pins.addFeature(n.feature)}}Yl()}function Yl(){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)}LI(),DI(),U.selectedPin?.filteredHidden&&Dc(),Cd(),document.dispatchEvent(new Event("atlas:filters"))}function LI(){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=>Pae(n,e.coordinate)))}function Pae(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 DI(){U.eligibleLocations=U.pins.filter(i=>!Ql(i)).length,Eu(),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(),nA()}function Eu(){U.sources.priority.clear();for(let i of U.pins){if(Ql(i))continue;let e=!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search);(i===U.selectedPin||i===U.hoveredPin||e||Md(i))&&U.sources.priority.addFeature(i.feature)}}function Fg(i){U.hoveredPin!==i&&(U.hoveredPin=i,U.sources&&(Eu(),U.layers.pins.changed(),U.layers.priority.changed()))}function uS(i){U.labelsHeld!==i&&(U.labelsHeld=i,we.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 Lg(i){return i===U.selectedPin||i===U.hoveredPin||Md(i)||!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search)}function Ql(i){return i.filteredHidden||Iae(i)||Nae(i)||!FI(i.location)}function FI(i){let e=U.variant?.shard;return!e||!i.shard||i.shard===e}function Iae(i){return!U.highlightedZones.size||i.insideHighlightedZone||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function Nae(i){return!U.gridEnabled||!U.gridPrefix||Md(i)||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function Lae(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+Vz(e.id)%1e3}function EV(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function qx(){return(U.engine?.getView().getZoom()||0)>=(U.variant?.maxZoom||0)-.05}function FV(i){let e=[],t=[];for(let n of i){let r=[];for(let s of n.categories)(Cu(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 OV(){let i=document.createDocumentFragment();for(let e of U.map.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.categories.reduce((s,o)=>s+o.locations.length,0);t.append(Dae(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.categories)r.append(Fae(s));t.append(r),i.append(t)}we.legend.replaceChildren(i),hS(),Rd()}function Dae(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=Oc(t),r.append(s,o,a);let l=BV(`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 BV(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 Fae(i){let e=Cu(i)==="text",t=document.createElement("label");t.className="category-row",Pg(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",Ig(r,i,Fc(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=Oc(i.locations.length);let a=BV(`Show only ${i.title}`);return a.dataset.onlyCategory=String(i.id),t.append(n,r,s,a,o),t}function OI(i){if(U.collapsedSections.clear(),i)for(let e of we.layers.querySelectorAll("[data-section]"))U.collapsedSections.add(e.dataset.section);hS()}function hS(){for(let i of we.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)}Lc()}function Hx(i){if(U.hiddenCategories.clear(),!i)for(let e of U.map.groups)for(let t of e.categories)U.hiddenCategories.add(t.id);Lx(),Yl(),Cd(),Rd()}function Lx(){for(let i of document.querySelectorAll("[data-category]"))i.checked=!U.hiddenCategories.has(Number(i.dataset.category))}function UV(i){let e=U.map.sections.find(n=>n.key===i);if(!e)return;let t=e.categories.some(n=>!U.hiddenCategories.has(n.id));for(let n of e.categories)t?U.hiddenCategories.add(n.id):U.hiddenCategories.delete(n.id);Lx(),Yl(),Rd()}function kV(i){if(U.map){if(Oae(i)){Hx(!0);return}U.hiddenCategories.clear();for(let e of U.map.sections){let t=i.section===e.key;for(let n of e.categories)!t&&i.category!==n.id&&U.hiddenCategories.add(n.id)}Lx(),Yl(),Cd(),Rd()}}function Oae(i){for(let e of U.map.sections)for(let t of e.categories)if((i.section===e.key||i.category===t.id)===U.hiddenCategories.has(t.id))return!1;return!0}function Bae(){let i=we.soloChip;if(!U.map){i.hidden=!0;return}let e=null,t=0,n=null,r=0;for(let o of U.map.sections){let a=0;for(let l of o.categories)U.hiddenCategories.has(l.id)||(a++,t++,e=l);a>0&&(r++,n=a===o.categories.length?o:null)}let s="";t===1&&e?s=e.title:r===1&&n&&(s=n.title),i.hidden=!s,i.textContent=s?`only: ${s}`:"",i.title=s?`Showing only ${s} \u2014 click to show everything`:""}function Rd(){if(U.map){for(let i of U.map.sections){let e=we.legend.querySelector(`input[data-section-toggle="${i.key}"]`);e&&(e.checked=i.categories.some(t=>!U.hiddenCategories.has(t.id)))}Bae(),Lc()}}async function GV(i){let[e,t]=await Promise.all([fetch(`${U.game.base}/maps/${i.slug}.json`),fetch(`${U.game.base}/maps/${i.slug}.bin`)]);if(!e.ok||!t.ok)throw new Error(`map ${i.slug} is not served under this catalog any more`);let[n,r]=await Promise.all([e.json(),t.arrayBuffer()]),s=n.groups.flatMap(o=>o.categories);return Uae(r,s),{...i,grid:n.grid,variants:n.variants,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:FV(n.groups)}}function Uae(i,e){let t=new DataView(i);if(String.fromCharCode(...new Uint8Array(i,0,8))!=="ATLASLOC")throw new Error("location payload is not in the expected form");let r=t.getUint16(8,!0);if(r!==2)throw new Error(`location payload is version ${r}, and this reads 2`);let s=t.getUint32(10,!0),o=16,a=new Int32Array(i,o,s),l=new Float32Array(i,o+=s*4,s),c=new Float32Array(i,o+=s*4,s),u=new Int32Array(i,o+=s*4,s),f=new Int32Array(i,o+=s*4,s),p=new Uint32Array(i,o+=s*4,s+1),x=new Uint16Array(i,o+=(s+1)*4,s),v=new Uint8Array(i,o+s*2),w=new TextDecoder;for(let S of e)S.locations=[];for(let S=0;S<s;S++)e[x[S]].locations.push({id:a[S],title:w.decode(v.subarray(p[S],p[S+1])),lat:l[S],lng:c[S],regionId:u[S]||void 0,shard:f[S]||void 0})}async function Wz(){let i=`${U.game.base}/${U.map.slug}`;return U.textByMap.has(i)||U.textByMap.set(i,fetch(`${U.game.base}/maps/${U.map.slug}.text`).then(e=>e.json()).catch(()=>({}))),U.textByMap.get(i)}var fS=null;function iA(){return fS||(fS=kae().finally(()=>{fS=null})),fS}async function kae(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=U.game;if(U.catalog=await i.json(),O0(we.game,U.catalog.games,"title"),BI(),!U.catalog.games.length)return;let t=e&&U.catalog.games.find(n=>n.slug===e.slug);if(!t){let n=Mg();await hf(n.game||Eg()?.game||U.catalog.games[0].slug,n.game?n.map:void 0);return}if(t.stamp!==e.stamp){for(let r of U.textByMap.keys())r.startsWith(e.base+"/")&&U.textByMap.delete(r);let n=U.engine?.getView();U.restore={game:t.slug,map:U.map?.slug,variant:U.map?U.map.variants.indexOf(U.variant):0,center:n?.getCenter(),zoom:n?.getZoom(),hidden:[...U.hiddenCategories],collapsed:[...U.collapsedSections],overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed},await hf(t.slug,U.map?.slug);return}U.game=t,we.game.value=t.slug}function BI(){let i=!U.catalog?.games?.length;we.emptyState.hidden=!i,U.catalog?.bundlesDir&&(we.emptyPath.textContent=U.catalog.bundlesDir)}async function UI(){for(let i of[we.emptyOpen,we.addBundles])i.disabled=!0;try{let e=await(await fetch("/data/bundles/import",{method:"POST"})).json().catch(()=>({}));await iA();let t=e.imported?.[0];t&&U.catalog.games.some(n=>n.slug===t)&&await hf(t)}finally{for(let i of[we.emptyOpen,we.addBundles])i.disabled=!1}}var Qs={ADD:"add",REMOVE:"remove"};var zV={LENGTH:"length"},Og=class extends Ys{constructor(e,t,n){super(e),this.element=t,this.index=n}},kI=class extends ys{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(zV.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 Og(Qs.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Og(Qs.REMOVE,t,e)),t}setAt(e,t){let n=this.getLength();if(e>=n){this.insertAt(e,t);return}if(e<0)throw new Error("Index out of bounds: "+e);this.unique_&&this.assertUnique_(t,e);let r=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Og(Qs.REMOVE,r,e)),this.dispatchEvent(new Og(Qs.ADD,t,e))}updateLength_(){this.set(zV.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")}},ho=kI;var GI=class extends Ys{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Ld=GI;var zI=class extends Ld{constructor(e,t,n,r,s,o){super(e,t,s),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},Iu=zI;var ir={SINGLECLICK:"singleclick",CLICK:Jt.CLICK,DBLCLICK:Jt.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var Wx={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var VI=class extends wd{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=kn(n,Wx.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=kn(n,Wx.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_,Pw?{passive:!1}:!1)}emulateClick_(e){let t=new Iu(ir.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Iu(ir.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new Iu(ir.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==ir.POINTERUP||t.type==ir.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==ir.POINTERDOWN||t.type==ir.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new Iu(ir.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(ri),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new Iu(ir.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(kn(n,ir.POINTERMOVE,this.handlePointerMove_,this),kn(n,ir.POINTERUP,this.handlePointerUp_,this),kn(this.element_,ir.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(kn(this.element_.getRootNode(),ir.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new Iu(ir.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 Iu(ir.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(ri(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(ri(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(ri),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},VV=VI;var Nu={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var fo={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var jx=1/0,qI=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,bu(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){Vn(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=jx?(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==jx?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},qV=qI;var HI=class extends qV{constructor(e,t){super(n=>e.apply(null,n),n=>n[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(Jt.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===rn.LOADED||n===rn.ERROR||n===rn.EMPTY){n!==rn.ERROR&&t.removeEventListener(Jt.CHANGE,this.boundHandleTileChange_);let r=t.getKey();r in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[r],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){let r=this.dequeue()[0],s=r.getKey();r.getState()===rn.IDLE&&!(s in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[s]=!0,++this.tilesLoading_,++n,r.load())}}},HV=HI;function WV(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return jx;if(!i.wantedTiles[t][e.getKey()])return jx;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 ks={ANIMATING:0,INTERACTING:1};var Jl={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function WI(i,e,t){return(function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;let l=e?0:s[0]*r,c=e?0:s[1]*r,u=a?a[0]:0,f=a?a[1]:0,p=i[0]+l/2+u,x=i[2]-l/2+u,v=i[1]+c/2+f,w=i[3]-c/2+f;p>x&&(p=(x+p)/2,x=p),v>w&&(v=(w+v)/2,w=v);let S=xi(n[0],p,x),T=xi(n[1],v,w);if(o&&t&&r){let P=30*r;S+=-P*Math.log(1+Math.max(0,p-n[0])/P)+P*Math.log(1+Math.max(0,n[0]-x)/P),T+=-P*Math.log(1+Math.max(0,v-n[1])/P)+P*Math.log(1+Math.max(0,n[1]-w)/P)}return[S,T]})}function jV(i){return i}function jI(i,e,t,n){let r=jn(e)/t[0],s=_r(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function XI(i,e,t){let n=Math.min(i,e),r=50;return n*=Math.log(1+r*Math.max(0,i/e-1))/r+1,t&&(n=Math.max(n,t),n/=Math.log(1+r*Math.max(0,t/i-1))/r+1),xi(n,t/2,e*2)}function XV(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?jI(l,t,o,n):l;if(a)return e?XI(r,u,c):xi(r,c,u);let f=Math.min(u,r),p=Math.floor(xg(i,f,s));return i[p]>u&&p<i.length-1?i[p+1]:i[p]}})}function $V(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?jI(e,r,l,s):e;if(c)return n?XI(o,u,t):xi(o,t,u);let f=1e-9,p=Math.ceil(Math.log(e/u)/Math.log(i)-f),x=-a*(.5-f)+.5,v=Math.min(u,o),w=Math.floor(Math.log(e/v)/Math.log(i)+x),S=Math.max(p,w),T=e/Math.pow(i,S);return xi(T,t,u)}})}function $I(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?jI(i,n,a,r):i;return!t||!l?xi(s,e,c):XI(s,c,e)}})}function Bg(i){if(i!==void 0)return 0}function YI(i){if(i!==void 0)return i}function YV(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 ZV(i){let e=i===void 0?Ec(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var ZI=0,QI=class extends ys{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=ww(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&&CG(),e.center&&(e.center=Rc(e.center,this.projection_)),e.extent&&(e.extent=Pc(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Jl)delete t[a];this.setProperties(t,!0);let n=zae(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=Gae(e),s=n.constraint,o=Vae(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=Rc(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=Rc(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&&dS(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||QG,callback:n};if(u.center&&(f.sourceCenter=o,f.targetCenter=u.center.slice(),o=f.targetCenter),u.zoom!==void 0?(f.sourceResolution=a,f.targetResolution=this.getResolutionForZoom(u.zoom),a=f.targetResolution):u.resolution&&(f.sourceResolution=a,f.targetResolution=u.resolution,a=f.targetResolution),u.rotation!==void 0){f.sourceRotation=l;let p=vu(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+p,l=f.targetRotation}qae(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(ks.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[ks.ANIMATING]>0}getInteracting(){return this.hints_[ks.INTERACTING]>0}cancelAnimations(){this.setHint(ks.ANIMATING,-this.hints_[ks.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&dS(r[0].callback,!1),!e)for(let s=0,o=r.length;s<o;++s){let a=r[s];if(!a.complete){e=a.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let e=Date.now(),t=!1;for(let n=this.animations_.length-1;n>=0;--n){let r=this.animations_[n],s=!0;for(let o=0,a=r.length;o<a;++o){let l=r[o];if(l.complete)continue;let c=e-l.start,u=l.duration>0?c/l.duration:1;u>=1?(l.complete=!0,u=1):s=!1;let f=l.easing(u);if(l.sourceCenter){let p=l.sourceCenter[0],x=l.sourceCenter[1],v=l.targetCenter[0],w=l.targetCenter[1];this.nextCenter_=l.targetCenter;let S=p+f*(v-p),T=x+f*(w-x);this.targetCenter_=[S,T]}if(l.sourceResolution&&l.targetResolution){let p=f===1?l.targetResolution:l.sourceResolution+f*(l.targetResolution-l.sourceResolution);if(l.anchor){let x=this.getViewportSize_(this.getRotation()),v=this.constraints_.resolution(p,0,x,!0);this.targetCenter_=this.calculateCenterZoom(v,l.anchor)}this.nextResolution_=l.targetResolution,this.targetResolution_=p,this.applyTargetState_(!0)}if(l.sourceRotation!==void 0&&l.targetRotation!==void 0){let p=f===1?vu(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+f*(l.targetRotation-l.sourceRotation);if(l.anchor){let x=this.constraints_.rotation(p,!0);this.targetCenter_=this.calculateCenterRotate(x,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=p}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(ks.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&dS(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]],fg(n,e-this.getRotation()),aG(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&&bx(e,this.getProjection())}getCenterInternal(){return this.get(Jl.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 xd(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();Vn(t,"The view center is not defined");let n=this.getResolution();Vn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return Vn(r!==void 0,"The view rotation is not defined"),_x(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(Jl.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Pc(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=jn(e)/t[0],r=_r(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(Jl.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=KI(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=xg(this.resolutions_,e,1);t=s,n=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=n/this.resolutions_[s+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=xi(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,xi(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(Vn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){Vn(!yu(e),"Cannot fit empty extent provided as `geometry`");let r=Pc(e,this.getProjection());n=tI(r)}else if(e.getType()==="Circle"){let r=Pc(e.getExtent(),this.getProjection());n=tI(r),n.rotate(this.getRotation(),Ua(r))}else{let r=W0();r?n=e.clone().transform(r,this.getProjection()):n=e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),s=e.getFlatCoordinates(),o=e.getStride(),a=1/0,l=1/0,c=-1/0,u=-1/0;for(let f=0,p=s.length;f<p;f+=o){let x=s[f]*n-s[f+1]*r,v=s[f]*r+s[f+1]*n;a=Math.min(a,x),l=Math.min(l,v),c=Math.max(c,x),u=Math.max(u,v)}return[a,l,c,u]}fitInternal(e,t){t=t||{};let n=t.size;n||(n=this.getViewportSizeMinusPadding_());let r=t.padding!==void 0?t.padding:[0,0,0,0],s=t.nearest!==void 0?t.nearest:!1,o;t.minResolution!==void 0?o=t.minResolution:t.maxZoom!==void 0?o=this.getResolutionForZoom(t.maxZoom):o=0;let a=this.rotatedExtentForGeometry(e),l=this.getResolutionForExtentInternal(a,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);l=isNaN(l)?o:Math.max(l,o),l=this.getConstrainedResolution(l,s?0:1);let c=this.getRotation(),u=Math.sin(c),f=Math.cos(c),p=Ua(a);p[0]+=(r[1]-r[3])/2*l,p[1]+=(r[0]-r[2])/2*l;let x=p[0]*f-p[1]*u,v=p[1]*f+p[0]*u,w=this.getConstrainedCenter([x,v],l),S=t.callback?t.callback:nf;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),dS(S,!0))}centerOn(e,t,n){this.centerOnInternal(Rc(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(KI(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=KI(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=bx(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&&Rc(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=Rc(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&&Rc(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(Jl.ROTATION)!==r&&this.set(Jl.ROTATION,r),this.get(Jl.RESOLUTION)!==o&&(this.set(Jl.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Jl.CENTER)||!z0(this.get(Jl.CENTER),a))&&this.set(Jl.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()||!z0(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Xl,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ks.INTERACTING,1)}endInteraction(e,t,n){n=n&&Rc(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(ks.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 dS(i,e){setTimeout(function(){i(e)},0)}function Gae(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return WI(i.extent,i.constrainOnlyCenter,t)}let e=ww(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,WI(t,!1,!1)}return jV}function zae(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:ZI,a=i.maxZoom!==void 0?i.maxZoom:28,l=i.zoomFactor!==void 0?i.zoomFactor:2,c=i.multiWorld!==void 0?i.multiWorld:!1,u=i.smoothResolutionConstraint!==void 0?i.smoothResolutionConstraint:!0,f=i.showFullExtent!==void 0?i.showFullExtent:!1,p=ww(i.projection,"EPSG:3857"),x=p.getExtent(),v=i.constrainOnlyCenter,w=i.extent;if(!c&&!w&&p.isGlobal()&&(v=!1,w=x),i.resolutions!==void 0){let S=i.resolutions;t=S[o],n=S[a]!==void 0?S[a]:S[S.length-1],i.constrainResolution?e=XV(S,u,!v&&w,f):e=$I(t,n,u,!v&&w,f)}else{let T=(x?Math.max(jn(x),_r(x)):360*Qh.degrees/p.getMetersPerUnit())/256/Math.pow(2,ZI),P=T/Math.pow(2,28-ZI);t=i.maxResolution,t!==void 0?o=0:t=T/Math.pow(l,o),n=i.minResolution,n===void 0&&(i.maxZoom!==void 0?i.maxResolution!==void 0?n=t/Math.pow(l,a):n=T/Math.pow(l,a):n=P),a=o+Math.floor(Math.log(t/n)/Math.log(l)),n=t/Math.pow(l,a-o),i.constrainResolution?e=$V(l,t,n,u,!v&&w,f):e=$I(t,n,u,!v&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function Vae(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?ZV():t===!1?YI:typeof t=="number"?YV(t):YI}return Bg}function qae(i){return!(i.sourceCenter&&i.targetCenter&&!z0(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function KI(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 dl=QI;var JI=class extends ys{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents="auto"),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let t=0,n=this.listenerKeys.length;t<n;++t)ri(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.map_=e,e){let t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==nf&&this.listenerKeys.push(kn(e,Nu.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},Ug=JI;var e5=class extends Ug{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className!==void 0?e.className:"ol-attribution",n=e.tipLabel!==void 0?e.tipLabel:"Attributions",r=e.expandClassName!==void 0?e.expandClassName:t+"-expand",s=e.collapseLabel!==void 0?e.collapseLabel:"\u203A",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;let a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):this.label_=a;let l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(Jt.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+Id+" "+Ng+(this.collapsed_&&this.collapsible_?" "+mI:"")+(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=>XG(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Lo(t,this.renderedAttributions_)){ez(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(mI),this.collapsed_?MP(this.collapseLabel_,this.label_):MP(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)}},KV=e5;var t5=class extends Ug{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});let t=e.className!==void 0?e.className:"ol-rotate",n=e.label!==void 0?e.label:"\u21E7",r=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let s=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(Jt.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+Id+" "+Ng,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(kx)}handleClick_(e){e.preventDefault(),this.callResetNorth_!==void 0?this.callResetNorth_():this.resetNorth_()}resetNorth_(){let t=this.getMap().getView();if(!t)return;let n=t.getRotation();n!==void 0&&(this.duration_>0&&n%(2*Math.PI)!==0?t.animate({rotation:0,duration:this.duration_,easing:Xl}):t.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let r="rotate("+n+"rad)";if(this.autoHide_){let s=this.element.classList.contains(kx);!s&&n===0?this.element.classList.add(kx):s&&n!==0&&this.element.classList.remove(kx)}this.label_.style.transform=r}this.rotation_=n}},QV=t5;var n5=class extends Ug{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});let t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,r=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",s=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"\u2013",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",c=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild(typeof o=="string"?document.createTextNode(o):o),u.addEventListener(Jt.CLICK,this.handleClick_.bind(this,n),!1);let f=document.createElement("button");f.className=s,f.setAttribute("type","button"),f.title=c,f.appendChild(typeof a=="string"?document.createTextNode(a):a),f.addEventListener(Jt.CLICK,this.handleClick_.bind(this,-n),!1);let p=t+" "+Id+" "+Ng,x=this.element;x.className=p,x.appendChild(u),x.appendChild(f),this.duration_=e.duration!==void 0?e.duration:250}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let n=this.getMap().getView();if(!n)return;let r=n.getZoom();if(r!==void 0){let s=n.getConstrainedZoom(r+e);this.duration_>0?(n.getAnimating()&&n.cancelAnimations(),n.animate({zoom:s,duration:this.duration_,easing:Xl})):n.setZoom(s)}}},JV=n5;function pS(i){i=i||{};let e=new ho;return(i.zoom===void 0||i.zoom)&&e.push(new JV(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new QV(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new KV(i.attributionOptions)),e}var i5=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_}},eq=i5;var r5={ACTIVE:"active"};var s5=class extends ys{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(r5.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(r5.ACTIVE,e)}setMap(e){this.map_=e}};function tq(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:JG,center:i.getConstrainedCenter(r)})}}function kg(i,e,t,n){let r=i.getZoom();if(r===void 0)return;let s=i.getConstrainedZoom(r+e),o=i.getResolutionForZoom(s);i.getAnimating()&&i.cancelAnimations(),i.animate({resolution:o,anchor:t,duration:n!==void 0?n:250,easing:Xl})}var Lu=s5;var o5=class extends Lu{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==ir.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();kg(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},nq=o5;function Xx(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 iq=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Hae=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)},AS=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?Hae(i):!0},rq=ef;var mS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!($G&&bP&&e.ctrlKey)};var gS=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var sq=function(i){let e=i.originalEvent;return bP?e.metaKey:e.ctrlKey},oq=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},_S=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},xS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var aq=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var a5=class extends Lu{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==ir.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==ir.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==ir.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==ir.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 Gg(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 Du=a5;var l5=class extends Du{constructor(e){super({stopDown:tf}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:Xx(gS,aq);this.condition_=e.onFocusOnly?Xx(AS,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(Gg(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();lG(s,a.getResolution()),fg(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){let t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:Xl})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){let n=e.map.getView();return this.lastCentroid=null,n.getAnimating()&&n.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},lq=l5;var c5=class extends Du{constructor(e){e=e||{},super({stopDown:tf}),this.condition_=e.condition?e.condition:iq,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!xS(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===Bg)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 xS(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return xS(e)&&mS(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},cq=c5;var u5=class extends bd{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 Tu([r])}getGeometry(){return this.geometry_}},uq=u5;var zg={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},rA=class extends Ys{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},h5=class extends Du{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new uq(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??mS,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 rA(zg.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 rA(t?zg.BOXEND:zg.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 rA(zg.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new rA(zg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new rA(zg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},hq=h5;var f5=class extends hq{constructor(e){e=e||{};let t=e.condition?e.condition:oq;super({condition:t,className:e.className||"ol-dragzoom",minArea:e.minArea}),this.duration_=e.duration!==void 0?e.duration:200,this.out_=e.out!==void 0?e.out:!1}onBoxEnd(e){let n=this.getMap().getView(),r=this.getGeometry();if(this.out_){let s=n.rotatedExtentForGeometry(r),o=n.getResolutionForExtentInternal(s),a=n.getResolution()/o;r=r.clone(),r.scale(a*a)}n.fitInternal(r,{duration:this.duration_,easing:Xl})}},fq=f5;var Dd={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var d5=class extends Lu{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return gS(t)&&_S(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==Jt.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Dd.DOWN||r==Dd.LEFT||r==Dd.RIGHT||r==Dd.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Dd.DOWN?c=-a:r==Dd.LEFT?l=-a:r==Dd.RIGHT?l=a:c=a;let u=[l,c];fg(u,o.getRotation()),tq(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},dq=d5;var p5=class extends Lu{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!sq(t)&&_S(t)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:100}handleEvent(e){let t=!1;if(e.type==Jt.KEYDOWN||e.type==Jt.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==="+"||r==="-")){let s=e.map,o=r==="+"?this.delta_:-this.delta_,a=s.getView();kg(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},pq=p5;var Wae=40,jae=300,Xae=3,A5=class extends Lu{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:rq;this.condition_=e.onFocusOnly?Xx(AS,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(e){if(this.ctrlKeyListenerKeys_.forEach(ri),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(kn(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),kn(t,"keyup",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==Jt.WHEEL)return!0;let n=e.map,r=e.originalEvent;r.preventDefault();let s=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let o=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=Wae;break;case WheelEvent.DOM_DELTA_PAGE:o*=jae;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*Xae),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;let c=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),c),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-xi(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),kg(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)}},Aq=A5;var m5=class extends Du{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=tf),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!==Bg&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Gg(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}},mq=m5;var g5=class extends Du{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=tf),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(Gg(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}},gq=g5;function yS(i){i=i||{};let e=new ho,t=new eq(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new cq),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new nq({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new lq({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new mq),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new gq({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new dq),e.push(new pq({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new Aq({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new fq({duration:i.zoomDuration})),e}var Ei={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var _5=class extends ys{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Ei.OPACITY]=e.opacity!==void 0?e.opacity:1,Vn(typeof t[Ei.OPACITY]=="number","Layer opacity must be a number"),t[Ei.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ei.Z_INDEX]=e.zIndex,t[Ei.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ei.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ei.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ei.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=xi(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return Yn()}getLayerStatesArray(e){return Yn()}getExtent(){return this.get(Ei.EXTENT)}getMaxResolution(){return this.get(Ei.MAX_RESOLUTION)}getMinResolution(){return this.get(Ei.MIN_RESOLUTION)}getMinZoom(){return this.get(Ei.MIN_ZOOM)}getMaxZoom(){return this.get(Ei.MAX_ZOOM)}getOpacity(){return this.get(Ei.OPACITY)}getSourceState(){return Yn()}getVisible(){return this.get(Ei.VISIBLE)}getZIndex(){return this.get(Ei.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ei.EXTENT,e)}setMaxResolution(e){this.set(Ei.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ei.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ei.MAX_ZOOM,e)}setMinZoom(e){this.set(Ei.MIN_ZOOM,e)}setOpacity(e){Vn(typeof e=="number","Layer opacity must be a number"),this.set(Ei.OPACITY,e)}setVisible(e){this.set(Ei.VISIBLE,e)}setZIndex(e){this.set(Ei.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},vS=_5;var Fd={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Bc=class extends Ys{constructor(e,t){super(e),this.layer=t}},x5={LAYERS:"layers"},y5=class i extends vS{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(x5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new ho(n.slice(),{unique:!0}):Vn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new ho(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(ri),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(kn(e,Qs.ADD,this.handleLayersAdd_,this),kn(e,Qs.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(ri);bu(this.listenerKeys_);let t=e.getArray();for(let n=0,r=t.length;n<r;n++){let s=t[n];this.registerLayerListeners_(s),this.dispatchEvent(new Bc(Fd.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[kn(e,Nc.PROPERTYCHANGE,this.handleLayerChange_,this),kn(e,Jt.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(kn(e,Fd.ADDLAYER,this.handleLayerGroupAdd_,this),kn(e,Fd.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ln(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Bc(Fd.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Bc(Fd.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Bc(Fd.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Ln(t);this.listenerKeys_[n].forEach(ri),delete this.listenerKeys_[n],this.dispatchEvent(new Bc(Fd.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(x5.LAYERS)}setLayers(e){let t=this.getLayers();if(t){let n=t.getArray();for(let r=0,s=n.length;r<s;++r)this.dispatchEvent(new Bc(Fd.REMOVELAYER,n[r]))}this.set(x5.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=xu(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},$x=y5;var po={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var v5=class extends vS{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Ei.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Ei.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(ri(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=kn(e,Jt.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),e instanceof dl?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 Yx(r,t.viewState)&&(!s||xr(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof dl?e.getViewStateAndExtent():e,r=t(n);return Array.isArray(r)||(r=[r]),r}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Ei.MAP,e)}getMapInternal(){return this.get(Ei.MAP)}setMap(e){this.mapPrecomposeKey_&&(ri(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(ri(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=kn(e,po.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=kn(this,Jt.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);Vn(!t.some(r=>r.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(Ei.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function Yx(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 sA=v5;function bS(i,e,t=0,n=i.length-1,r=$ae){for(;n>t;){if(n-t>600){let l=n-t+1,c=e-t+1,u=Math.log(l),f=.5*Math.exp(2*u/3),p=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1),x=Math.max(t,Math.floor(e-c*f/l+p)),v=Math.min(n,Math.floor(e+(l-c)*f/l+p));bS(i,e,x,v,r)}let s=i[e],o=t,a=n;for(Zx(i,t,e),r(i[n],s)>0&&Zx(i,t,n);o<a;){for(Zx(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?Zx(i,t,a):(a++,Zx(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function Zx(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function $ae(i,e){return i<e?-1:i>e?1:0}var oA=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(!SS(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;SS(e,l)&&(t.leaf?n.push(a):w5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!SS(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(SS(e,o)){if(t.leaf||w5(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=qg([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),s=[],o=[],a,l,c;for(;n||s.length;){if(n||(n=s.pop(),l=s[s.length-1],a=o.pop(),c=!0),n.leaf){let u=Yae(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&w5(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=qg(e.slice(t,n+1)),Vg(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=qg([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));_q(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);_q(e,u,f,l,this.compareMinY);for(let p=u;p<=f;p+=l){let x=Math.min(p+l-1,f);a.children.push(this._build(e,p,x,r-1))}}return Vg(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=b5(c),f=Qae(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),Qx(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=qg(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Vg(n,this.toBBox),Vg(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=qg([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Vg(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=Kx(e,0,a,this.toBBox),c=Kx(e,a,n,this.toBBox),u=Jae(l,c),f=b5(l)+b5(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:Zae,s=e.leaf?this.compareMinY:Kae,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=Kx(e,0,t,s),a=Kx(e,n-t,n,s),l=wS(o)+wS(a);for(let c=t;c<n-t;c++){let u=e.children[c];Qx(o,e.leaf?s(u):u),l+=wS(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];Qx(a,e.leaf?s(u):u),l+=wS(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)Qx(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():Vg(e[t],this.toBBox)}};function Yae(i,e,t){if(!t)return e.indexOf(i);for(let n=0;n<e.length;n++)if(t(i,e[n]))return n;return-1}function Vg(i,e){Kx(i,0,i.children.length,e,i)}function Kx(i,e,t,n,r){r||(r=qg(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];Qx(r,i.leaf?n(o):o)}return r}function Qx(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 Zae(i,e){return i.minX-e.minX}function Kae(i,e){return i.minY-e.minY}function b5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function wS(i){return i.maxX-i.minX+(i.maxY-i.minY)}function Qae(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 Jae(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 w5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function SS(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function qg(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function _q(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;bS(i,o,e,t,r),s.push(e,o,o,t)}}var lA=0,ES=0,Oo=1<<lA++,si=1<<lA++,Bo=1<<lA++,oa=1<<lA++,df=1<<lA++,aA=1<<lA++,MS=Math.pow(2,lA)-1,T5={[Oo]:"boolean",[si]:"number",[Bo]:"string",[oa]:"color",[df]:"number[]",[aA]:"size"},ele=Object.keys(T5).map(Number).sort(ka);function tle(i){return i in T5}function ff(i){let e=[];for(let t of ele)Jx(i,t)&&e.push(T5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function Jx(i,e){return(i&e)===e}function TS(i,e){return!!(i&e)}function Od(i,e){return i===e}var Ir=class{constructor(e,t){if(!tle(e))throw new Error(`literal expressions must have a specific type, got ${ff(e)}`);this.type=e,this.value=t}},CS=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function RS(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function Xr(i,e,t){switch(typeof i){case"boolean":{if(Od(e,Bo))return new Ir(Bo,i?"true":"false");if(!Jx(e,Oo))throw new Error(`got a boolean, but expected ${ff(e)}`);return new Ir(Oo,i)}case"number":{if(Od(e,aA))return new Ir(aA,Wr(i));if(Od(e,Oo))return new Ir(Oo,!!i);if(Od(e,Bo))return new Ir(Bo,i.toString());if(!Jx(e,si))throw new Error(`got a number, but expected ${ff(e)}`);return new Ir(si,i)}case"string":{if(Od(e,oa))return new Ir(oa,Ox(i));if(Od(e,Oo))return new Ir(Oo,!!i);if(!Jx(e,Bo))throw new Error(`got a string, but expected ${ff(e)}`);return new Ir(Bo,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 dle(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Od(e,aA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new Ir(aA,i)}if(Od(e,oa)){if(i.length===3)return new Ir(oa,[...i,1]);if(i.length===4)return new Ir(oa,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!Jx(e,df))throw new Error(`got an array of numbers, but expected ${ff(e)}`);return new Ir(df,i)}var Je={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},nle={[Je.Get]:Fn(Zn(1,1/0),xq),[Je.Var]:ile(),[Je.Has]:Fn(Zn(1,1/0),xq),[Je.Id]:Fn(rle,Hg),[Je.Concat]:Fn(Zn(2,1/0),Gi(Bo)),[Je.GeometryType]:Fn(sle,Hg),[Je.LineMetric]:Fn(ole,Hg),[Je.Resolution]:Fn(S5,Hg),[Je.Zoom]:Fn(S5,Hg),[Je.Time]:Fn(S5,Hg),[Je.Any]:Fn(Zn(2,1/0),Gi(Oo)),[Je.All]:Fn(Zn(2,1/0),Gi(Oo)),[Je.Not]:Fn(Zn(1,1),Gi(Oo)),[Je.Equal]:Fn(Zn(2,2),vq()),[Je.NotEqual]:Fn(Zn(2,2),vq()),[Je.GreaterThan]:Fn(Zn(2,2),Gi(si)),[Je.GreaterThanOrEqualTo]:Fn(Zn(2,2),Gi(si)),[Je.LessThan]:Fn(Zn(2,2),Gi(si)),[Je.LessThanOrEqualTo]:Fn(Zn(2,2),Gi(si)),[Je.Multiply]:Fn(Zn(2,1/0),yq),[Je.Coalesce]:Fn(Zn(2,1/0),yq),[Je.Divide]:Fn(Zn(2,2),Gi(si)),[Je.Add]:Fn(Zn(2,1/0),Gi(si)),[Je.Subtract]:Fn(Zn(2,2),Gi(si)),[Je.Clamp]:Fn(Zn(3,3),Gi(si)),[Je.Mod]:Fn(Zn(2,2),Gi(si)),[Je.Pow]:Fn(Zn(2,2),Gi(si)),[Je.Abs]:Fn(Zn(1,1),Gi(si)),[Je.Floor]:Fn(Zn(1,1),Gi(si)),[Je.Ceil]:Fn(Zn(1,1),Gi(si)),[Je.Round]:Fn(Zn(1,1),Gi(si)),[Je.Sin]:Fn(Zn(1,1),Gi(si)),[Je.Cos]:Fn(Zn(1,1),Gi(si)),[Je.Atan]:Fn(Zn(1,2),Gi(si)),[Je.Sqrt]:Fn(Zn(1,1),Gi(si)),[Je.Match]:Fn(Zn(4,1/0),bq,lle),[Je.Between]:Fn(Zn(3,3),Gi(si)),[Je.Interpolate]:Fn(Zn(6,1/0),bq,cle),[Je.Case]:Fn(Zn(3,1/0),ale,ule),[Je.In]:Fn(Zn(2,2),hle),[Je.Number]:Fn(Zn(1,1/0),Gi(MS)),[Je.String]:Fn(Zn(1,1/0),Gi(MS)),[Je.Array]:Fn(Zn(1,1/0),Gi(si)),[Je.Color]:Fn(Zn(1,4),Gi(si)),[Je.Band]:Fn(Zn(1,3),Gi(si)),[Je.Palette]:Fn(Zn(2,2),fle),[Je.ToString]:Fn(Zn(1,1),Gi(Oo|si|Bo|oa))};function xq(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 Ir(si,o);break}case"string":{r[s]=new Ir(Bo,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 ile(){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=Xr(s,MS,t);if(!(o instanceof Ir))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&TS(r,oa)&&!TS(r,Bo)?a=oa:Array.isArray(s)&&s.length===2&&TS(r,aA)&&!TS(r,df)&&(a=aA),r&=a,r===ES)throw new Error(`the type expected from the var operator (${ff(e)}) did not have any overlap with the type of the corresponding style variables (${ff(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===ES)throw new Error(`a new type expected from the var operator (${ff(e)}) did not have any overlap with the previous type expected for it (${ff(o)}), variable name: ${n}`)}return t.variables.set(n,r),new CS(r,"var",new Ir(Bo,n))}}function rle(i,e,t){t.featureId=!0}function sle(i,e,t){t.geometryType=!0}function ole(i,e,t){t.mCoordinate=!0}function S5(i,e,t){t.mapState=!0}function Hg(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Zn(i,e){return function(t,n,r){let s=t[0],o=t.length-1;if(i===e){if(o!==i){let a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${s}, got ${o}`)}}else if(o<i||o>e){let a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function yq(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=Xr(i[s+1],e,t);r[s]=o}return r}function Gi(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=Xr(e[o+1],i,n);s[o]=a}return s}}function vq(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=MS;for(let a=0;a<r;++a){let l=Xr(i[a+1],o,t);o&=l.type}if(o===ES)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=Xr(i[a+1],o,t);s[a]=l}return s}}function ale(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 bq(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 lle(i,e,t){let n=i.length-1,r=Xr(i[i.length-1],e,t),s=Bo|si|Oo,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=Xr(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===ES)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=Xr(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=Xr(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[Xr(i[1],s,t),...o,r]}function cle(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 Ir(si,r),o;try{o=Xr(i[2],si,t)}catch(l){throw new Error(`failed to parse argument 1 in interpolate expression: ${l.message}`)}let a=new Array(i.length-3);for(let l=0;l<a.length;l+=2){try{let c=Xr(i[l+3],si,t);a[l]=c}catch(c){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${c.message}`)}try{let c=Xr(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 ule(i,e,t){let n=Xr(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=Xr(i[s+1],Oo,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=Xr(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 hle(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=Bo:r=si;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=Xr(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[Xr(i[1],r,t),...s]}function fle(i,e,t){let n;try{n=Xr(i[1],si,t)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${o.message}`)}let r=i[2];if(!Array.isArray(r))throw new Error("the second argument of palette must be an array");let s=new Array(r.length);for(let o=0;o<s.length;o++){let a;try{a=Xr(r[o],oa,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof Ir))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Fn(...i){return function(e,t,n){let r=e[0],s;for(let o=0;o<i.length;o++){let a=i[o](e,t,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new CS(t,r,...s)}}function dle(i,e,t){let n=i[0],r=nle[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function PS(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 PS(i.getGeometries()[0]);default:return""}}function E5(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function kc(i,e,t){let n=Xr(i,e,t);return Uc(n,t)}function Uc(i,e){if(i instanceof Ir){if(i.type===oa&&typeof i.value=="string"){let n=Ox(i.value);return function(){return n}}return function(){return i.value}}let t=i.operator;switch(t){case Je.Number:case Je.String:case Je.Coalesce:return ple(i,e);case Je.Get:case Je.Var:case Je.Has:return Ale(i,e);case Je.Id:return n=>n.featureId;case Je.GeometryType:return n=>n.geometryType;case Je.Concat:{let n=i.args.map(r=>Uc(r,e));return r=>"".concat(...n.map(s=>s(r).toString()))}case Je.Resolution:return n=>n.resolution;case Je.Any:case Je.All:case Je.Between:case Je.In:case Je.Not:return gle(i,e);case Je.Equal:case Je.NotEqual:case Je.LessThan:case Je.LessThanOrEqualTo:case Je.GreaterThan:case Je.GreaterThanOrEqualTo:return mle(i,e);case Je.Multiply:case Je.Divide:case Je.Add:case Je.Subtract:case Je.Clamp:case Je.Mod:case Je.Pow:case Je.Abs:case Je.Floor:case Je.Ceil:case Je.Round:case Je.Sin:case Je.Cos:case Je.Atan:case Je.Sqrt:return _le(i,e);case Je.Case:return xle(i,e);case Je.Match:return yle(i,e);case Je.Interpolate:return vle(i,e);case Je.ToString:return ble(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function ple(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(i.args[s],e);switch(t){case Je.Coalesce:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case Je.Number:case Je.String:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function Ale(i,e){let n=i.args[0].value;switch(i.operator){case Je.Get:return r=>{let s=i.args,o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;o=o[u]}return o};case Je.Var:return r=>r.variables[n];case Je.Has:return r=>{let s=i.args;if(!(n in r.properties))return!1;let o=r.properties[n];for(let a=1,l=s.length;a<l;++a){let u=s[a].value;if(!o||!Object.hasOwn(o,u))return!1;o=o[u]}return!0};default:throw new Error(`Unsupported accessor operator ${i.operator}`)}}function mle(i,e){let t=i.operator,n=Uc(i.args[0],e),r=Uc(i.args[1],e);switch(t){case Je.Equal:return s=>n(s)===r(s);case Je.NotEqual:return s=>n(s)!==r(s);case Je.LessThan:return s=>n(s)<r(s);case Je.LessThanOrEqualTo:return s=>n(s)<=r(s);case Je.GreaterThan:return s=>n(s)>r(s);case Je.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function gle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(i.args[s],e);switch(t){case Je.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case Je.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case Je.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case Je.In:return s=>{let o=r[0](s);for(let a=1;a<n;++a)if(o===r[a](s))return!0;return!1};case Je.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function _le(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(i.args[s],e);switch(t){case Je.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case Je.Divide:return s=>r[0](s)/r[1](s);case Je.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case Je.Subtract:return s=>r[0](s)-r[1](s);case Je.Clamp:return s=>{let o=r[0](s),a=r[1](s);if(o<a)return a;let l=r[2](s);return o>l?l:o};case Je.Mod:return s=>r[0](s)%r[1](s);case Je.Pow:return s=>Math.pow(r[0](s),r[1](s));case Je.Abs:return s=>Math.abs(r[0](s));case Je.Floor:return s=>Math.floor(r[0](s));case Je.Ceil:return s=>Math.ceil(r[0](s));case Je.Round:return s=>Math.round(r[0](s));case Je.Sin:return s=>Math.sin(r[0](s));case Je.Cos:return s=>Math.cos(r[0](s));case Je.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case Je.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function xle(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Uc(i.args[r],e);return r=>{for(let s=0;s<t-1;s+=2)if(n[s](r))return n[s+1](r);return n[t-1](r)}}function yle(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Uc(i.args[r],e);return r=>{let s=n[0](r);for(let o=1;o<t-1;o+=2)if(s===n[o](r))return n[o+1](r);return n[t-1](r)}}function vle(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Uc(i.args[r],e);return r=>{let s=n[0](r),o=n[1](r),a,l;for(let c=2;c<t;c+=2){let u=n[c](r),f=n[c+1](r),p=Array.isArray(f);if(p&&(f=Yz(f)),u>=o)return c===2?f:p?wle(s,o,a,l,u,f):ey(s,o,a,l,u,f);a=u,l=f}return l}}function ble(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Uc(i.args[s],e);if(t===Je.ToString)return s=>{let o=r[0](s);return i.args[0].type===oa?Bx(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function ey(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 wle(i,e,t,n,r,s){if(r-t===0)return n;let a=dI(n),l=dI(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[ey(i,e,t,a[0],r,l[0]),ey(i,e,t,a[1],r,l[1]),a[2]+ey(i,e,t,0,r,c),ey(i,e,t,n[3],r,s[3])];return Zz(u)}function Sle(i){return!0}function Tle(i,e){e=e??RS();let t=Ele(i,e),n=E5();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=PS(r.getGeometry())),t(n)}}function wq(i,e){e=e??RS();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=M5(i[o],e);let r=E5(),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=PS(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 Mq(i,e){if(e=e??RS(),!Array.isArray(i))return wq([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 Tle(s,e)}return wq(i,e)}function Ele(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r],o="filter"in s?kc(s.filter,Oo,e):Sle,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=M5(s.style[c],e)}else a=[M5(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 M5(i,e){let t=ty(i,"",e),n=ny(i,"",e),r=Mle(i,e),s=Cle(i,e),o=Ao(i,"z-index",e);if(!t&&!n&&!r&&!s&&!Mc(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new Us;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 ty(i,e,t){let n;if(e+"fill-pattern-src"in i)n=Nle(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=NS(i,e+"fill-color",t)}if(!n)return null;let r=new jr;return function(s){let o=n(s);return o===Jw?null:(r.setColor(o),r)}}function ny(i,e,t){let n=Ao(i,e+"stroke-width",t),r=NS(i,e+"stroke-color",t);if(!n&&!r)return null;let s=pf(i,e+"stroke-line-cap",t),o=pf(i,e+"stroke-line-join",t),a=Cq(i,e+"stroke-line-dash",t),l=Ao(i,e+"stroke-line-dash-offset",t),c=Ao(i,e+"stroke-miter-limit",t),u=Ao(i,e+"stroke-offset",t),f=new Ks;return function(p){if(r){let x=r(p);if(x===Jw)return null;f.setColor(x)}if(n&&f.setWidth(n(p)),s){let x=s(p);if(x!=="butt"&&x!=="round"&&x!=="square")throw new Error("Expected butt, round, or square line cap");f.setLineCap(x)}if(o){let x=o(p);if(x!=="bevel"&&x!=="round"&&x!=="miter")throw new Error("Expected bevel, round, or miter line join");f.setLineJoin(x)}return a&&f.setLineDash(a(p)),l&&f.setLineDashOffset(l(p)),c&&f.setMiterLimit(c(p)),u&&f.setOffset(u(p)),f}}function Mle(i,e){let t="text-",n=pf(i,t+"value",e);if(!n)return null;let r=ty(i,t,e),s=ty(i,t+"background-",e),o=ny(i,t,e),a=ny(i,t+"background-",e),l=pf(i,t+"font",e),c=Ao(i,t+"max-angle",e),u=Ao(i,t+"offset-x",e),f=Ao(i,t+"offset-y",e),p=Wg(i,t+"overflow",e),x=pf(i,t+"placement",e),v=Ao(i,t+"repeat",e),w=LS(i,t+"scale",e),S=Wg(i,t+"rotate-with-view",e),T=Ao(i,t+"rotation",e),P=pf(i,t+"align",e),R=pf(i,t+"justify",e),C=pf(i,t+"baseline",e),L=Wg(i,t+"keep-upright",e),D=Cq(i,t+"padding",e),F=DS(i,t+"declutter-mode"),N=new uf({declutterMode:F});return function(B){if(N.setText(n(B)),r&&N.setFill(r(B)),s&&N.setBackgroundFill(s(B)),o&&N.setStroke(o(B)),a&&N.setBackgroundStroke(a(B)),l&&N.setFont(l(B)),c&&N.setMaxAngle(c(B)),u&&N.setOffsetX(u(B)),f&&N.setOffsetY(f(B)),p&&N.setOverflow(p(B)),x){let z=x(B);if(z!=="point"&&z!=="line")throw new Error("Expected point or line for text-placement");N.setPlacement(z)}if(v&&N.setRepeat(v(B)),w&&N.setScale(w(B)),S&&N.setRotateWithView(S(B)),T&&N.setRotation(T(B)),P){let z=P(B);if(z!=="left"&&z!=="center"&&z!=="right"&&z!=="end"&&z!=="start")throw new Error("Expected left, right, center, start, or end for text-align");N.setTextAlign(z)}if(R){let z=R(B);if(z!=="left"&&z!=="right"&&z!=="center")throw new Error("Expected left, right, or center for text-justify");N.setJustify(z)}if(C){let z=C(B);if(z!=="bottom"&&z!=="top"&&z!=="middle"&&z!=="alphabetic"&&z!=="hanging")throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");N.setTextBaseline(z)}return D&&N.setPadding(D(B)),L&&N.setKeepUpright(L(B)),N}}function Cle(i,e){return"icon-src"in i?Rle(i,e):"shape-points"in i?Ple(i,e):"circle-radius"in i?Ile(i,e):null}function Rle(i,e){let t="icon-",n=t+"src",r=Rq(i[n],n),s=IS(i,t+"anchor",e),o=LS(i,t+"scale",e),a=Ao(i,t+"opacity",e),l=IS(i,t+"displacement",e),c=Ao(i,t+"rotation",e),u=Wg(i,t+"rotate-with-view",e),f=Tq(i,t+"anchor-origin"),p=Eq(i,t+"anchor-x-units"),x=Eq(i,t+"anchor-y-units"),v=Af(i,t+"color"),w,S=null;v!==void 0&&(Array.isArray(v)&&v.length>0&&typeof v[0]=="string"?S=NS(i,t+"color",e):w=Pq(v,t+"color"));let T=Dle(i,t+"cross-origin"),P=Fle(i,t+"offset"),R=Tq(i,t+"offset-origin"),C=C5(i,t+"width"),L=C5(i,t+"height"),D=Lle(i,t+"size"),F=DS(i,t+"declutter-mode"),N={src:r,anchorOrigin:f,anchorXUnits:p,anchorYUnits:x,crossOrigin:T,offset:P,offsetOrigin:R,height:L,width:C,size:D,declutterMode:F},B=null;return function(z){if(B)S&&B.setColor(S(z));else{let V=S?S(z):w;B=new tA(V!==void 0?Object.assign({},N,{color:V}):Object.assign({},N))}return a&&B.setOpacity(a(z)),l&&B.setDisplacement(l(z)),c&&B.setRotation(c(z)),u&&B.setRotateWithView(u(z)),o&&B.setScale(o(z)),s&&B.setAnchor(s(z)),B}}function Ple(i,e){let t="shape-",n=t+"points",r=t+"radius",s=R5(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=Ao(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=Ao(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=ty(i,t,e),p=ny(i,t,e),x=LS(i,t+"scale",e),v=IS(i,t+"displacement",e),w=Ao(i,t+"rotation",e),S=Wg(i,t+"rotate-with-view",e),T=C5(i,t+"angle"),P=DS(i,t+"declutter-mode"),R=new sS({points:s,radius:a,radius2:u,angle:T,declutterMode:P});return function(C){return o&&R.setRadius(o(C)),c&&R.setRadius2(c(C)),f&&R.setFill(f(C)),p&&R.setStroke(p(C)),v&&R.setDisplacement(v(C)),w&&R.setRotation(w(C)),S&&R.setRotateWithView(S(C)),x&&R.setScale(x(C)),R}}function Ile(i,e){let t="circle-",n=ty(i,t,e),r=ny(i,t,e),s=Ao(i,t+"radius",e),o=LS(i,t+"scale",e),a=IS(i,t+"displacement",e),l=Ao(i,t+"rotation",e),c=Wg(i,t+"rotate-with-view",e),u=DS(i,t+"declutter-mode"),f=new oS({radius:5,declutterMode:u});return function(p){return s&&f.setRadius(s(p)),n&&f.setFill(n(p)),r&&f.setStroke(r(p)),a&&f.setDisplacement(a(p)),l&&f.setRotation(l(p)),c&&f.setRotateWithView(c(p)),o&&f.setScale(o(p)),f}}function Af(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function Ao(i,e,t){let n=Af(i,e);if(n===void 0)return;let r=kc(n,si,t);return function(s){return R5(r(s),e)}}function pf(i,e,t){let n=Af(i,e);if(n===void 0)return null;let r=kc(n,Bo,t);return function(s){return Rq(r(s),e)}}function Nle(i,e,t){let n=pf(i,e+"pattern-src",t),r=Sq(i,e+"pattern-offset",t),s=Sq(i,e+"pattern-size",t),o=NS(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function Wg(i,e,t){let n=Af(i,e);if(n===void 0)return null;let r=kc(n,Oo,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function NS(i,e,t){let n=Af(i,e);if(n===void 0)return null;let r=kc(n,oa,t);return function(s){return Pq(r(s),e)}}function Cq(i,e,t){let n=Af(i,e);if(n===void 0)return null;if(Array.isArray(n)&&(n.length===0||typeof n[0]!="string")){let s=n.map((o,a)=>{if(typeof o=="number")return()=>o;let l=kc(o,si,t);return function(c){return R5(l(c),`${e}[${a}]`)}});return function(o){let a=new Array(s.length);for(let l=0;l<s.length;++l)a[l]=s[l](o);return a}}let r=kc(n,df,t);return function(s){return iy(r(s),e)}}function IS(i,e,t){let n=Af(i,e);if(n===void 0)return null;let r=kc(n,df,t);return function(s){let o=iy(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function Sq(i,e,t){let n=Af(i,e);if(n===void 0)return null;let r=kc(n,df,t);return function(s){return Iq(r(s),e)}}function LS(i,e,t){let n=Af(i,e);if(n===void 0)return null;let r=kc(n,df|si,t);return function(s){return Ole(r(s),e)}}function C5(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 Lle(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return Wr(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 Dle(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 Tq(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 Eq(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 Fle(i,e){let t=i[e];if(t!==void 0)return iy(t,e)}function DS(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 iy(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 Rq(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function R5(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function Pq(i,e){if(typeof i=="string")return i;let t=iy(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 Iq(i,e){let t=iy(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function Ole(i,e){return typeof i=="number"?i:Iq(i,e)}var Nq={RENDER_ORDER:"renderOrder"},P5=class extends sA{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(Nq.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 oA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(Nq.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?EI:e;let t=Ble(e);this.styleFunction_=e===null?void 0:lV(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function Ble(i){if(i===void 0)return EI;if(!i)return null;if(typeof i=="function"||i instanceof Us)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof Us){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof Us))throw new Error("Expected a list of style instances");n[r]=s}return n}return Mq(i)}var FS=P5;var I5=class extends Ys{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},OS=I5;var N5=class extends bd{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){Yn()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;uo(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Dw(r,n)}forEachFeatureAtCoordinate(e,t,n,r,s,o,a,l){let c,u=t.viewState;function f(C,L,D,F){return s.call(o,L,C?D:null,F)}let p=u.projection,x=mw(e.slice(),p),v=[[0,0]];if(p.canWrapX()&&r){let C=p.getExtent(),L=jn(C);v.push([-L,0],[L,0])}let w=t.layerStatesArray,S=w.length,T=[],P=[];for(let C=0;C<v.length;C++)for(let L=S-1;L>=0;--L){let D=w[L],F=D.layer;if(F.hasRenderer()&&Yx(D,u)&&a.call(l,F)){let N=F.getRenderer(),B=F.getSource();if(N&&B){let z=B.getWrapX()?x:e,V=f.bind(null,D.managed);P[0]=z[0]+v[C][0],P[1]=z[1]+v[C][1],c=N.forEachFeatureAtCoordinate(P,t,n,V,T)}if(c)return c}}if(T.length===0)return;let R=1/T.length;return T.forEach((C,L)=>C.distanceSq+=L*R),T.sort((C,L)=>C.distanceSq-L.distanceSq),T.some(C=>c=C.callback(C.feature,C.layer,C.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,s,o){return this.forEachFeatureAtCoordinate(e,t,n,r,ef,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){Yn()}scheduleExpireIconCache(e){Do.canExpireCache()&&e.postRenderFunctions.push(Ule)}};function Ule(i,e){Do.expire()}var Lq=N5;var L5=class extends Lq{constructor(e){super(e),this.fontChangeListenerKey_=kn(J0,Nc.PROPERTYCHANGE,e.redrawText,e),this.element_=Os?Iw():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Id+" ol-layers";let n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new OS(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){ri(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(po.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof FS&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;fl(o)&&(a=o.getContext("2d"),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,o.width,o.height));let l=[],c=a?o:null;for(let u=0,f=t.length;u<f;++u){let p=t[u];e.layerIndex=u;let x=p.layer,v=x.getSourceState();if(!Yx(p,r)||v!="ready"&&v!="undefined"){x.unrender();continue}let w=x.render(e,c);w&&(w!==c&&(this.children_.push(w),c=w),l.push(p))}this.declutter(e,l),tz(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,p=u.style.backgroundColor;if(p&&(!fl(f)||f.width>0)&&(a.fillStyle=p,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!fl(f)||f.width===0)continue;a.save();let x=u.style.opacity||f.style.opacity;a.globalAlpha=x===""?1:Number(x);let v=f.style.transform;if(v)a.transform(...Lw(v));else{let w=parseFloat(f.style.width)/f.width,S=parseFloat(f.style.height)/f.height;a.transform(w,0,0,S,0,0)}a.drawImage(f,0,0),a.restore()}this.dispatchRenderEvent(po.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))}}},Dq=L5;function Fq(i){if(i instanceof sA){i.setMapInternal(null);return}i instanceof $x&&i.getLayers().forEach(Fq)}function Oq(i,e){if(i instanceof sA){i.setMapInternal(e);return}if(i instanceof $x){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)Oq(t[n],e)}}var D5=class extends ys{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=kle(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:YG,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Zs(),this.pixelToCoordinateTransform_=Zs(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Os||(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,Os||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(Os?new ho:pS()),this.interactions=t.interactions||(Os?new ho:yS({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new HV(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 dl)&&e.view.then(function(r){n.setView(new dl(r))}),this.controls.addEventListener(Qs.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(Qs.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(Qs.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(Qs.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(Qs.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(Qs.REMOVE,r=>{let s=r.element.getId();s!==void 0&&delete this.overlayIdIndex_[s.toString()],r.element.setMap(null)}),this.controls.forEach(r=>{r.setMap(this)}),this.interactions.forEach(r=>{r.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){Oq(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:ef,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 $x?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:ef,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 bx(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Pr(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 ho){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=Rc(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Pr(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 WV(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new Iu(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===Wx.POINTERDOWN||n===Jt.WHEEL||n===Jt.KEYDOWN){let r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=t.target,a=s instanceof ShadowRoot?s.host===o?s.host.ownerDocument:s:s===r?r.documentElement:s;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){let r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){let o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let r=this.maxTilesLoading_,s=r,o=e?e.viewHints:void 0,a=o?o[ks.ANIMATING]||o[ks.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(po.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(po.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Ld(Nu.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Ld(Nu.LOADSTART,this,e))));let n=this.postRenderFunctions_;if(e)for(let r=0,s=n.length;r<s;++r)n[r](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let n=0,r=this.targetChangeHandlerKeys_.length;n<r;++n)ri(this.targetChangeHandlerKeys_[n]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!fl(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(fl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Dq(this)),!fl(t)){this.mapBrowserEventHandler_=new VV(this,this.moveTolerance_);for(let r in ir)this.mapBrowserEventHandler_.addEventListener(ir[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_,Pw?{passive:!1}:!1);let n;if(this.keyboardEventTarget_)n=this.keyboardEventTarget_;else{let r=t.getRootNode();n=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[kn(n,Jt.KEYDOWN,this.handleBrowserEvent,this),kn(n,Jt.KEYPRESS,this.handleBrowserEvent,this)],!fl(t)){let r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(ri(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(ri(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=kn(e,Nc.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=kn(e,Jt.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(ri),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Bc("addlayer",e)),this.layerGroupPropertyListenerKeys_=[kn(e,Nc.PROPERTYCHANGE,this.render,this),kn(e,Jt.CHANGE,this.render,this),kn(e,"addlayer",this.handleLayerAdd_,this),kn(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;let e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){let r=e[t].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){Fq(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&&AP(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:_x(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:Ln(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=_x(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_||!yu(this.previousExtent_)&&!U0(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Ld(Nu.MOVESTART,this,r)),this.previousExtent_=B0(this.previousExtent_)),this.previousExtent_&&!s.viewHints[ks.ANIMATING]&&!s.viewHints[ks.INTERACTING]&&!U0(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Ld(Nu.MOVEEND,this,s)),lw(s.extent,this.previousExtent_))),this.dispatchEvent(new Ld(Nu.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Nu.LOADSTART)||this.hasListener(Nu.LOADEND)||this.hasListener(po.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new Bc("removelayer",t)),this.set(fo.LAYERGROUP,e)}setSize(e){this.set(fo.SIZE,e)}setTarget(e){this.set(fo.TARGET,e)}setView(e){if(!e||e instanceof dl){this.set(fo.VIEW,e);return}this.set(fo.VIEW,new dl);let t=this;e.then(function(n){t.setView(new dl(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(fl(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)],!AP(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&dw("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!Lo(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function kle(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 $x({layers:i.layers});t[fo.LAYERGROUP]=n,t[fo.TARGET]=i.target,t[fo.VIEW]=i.view instanceof dl?i.view:new dl;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new ho(i.controls.slice()):(Vn(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=i.controls));let s;i.interactions!==void 0&&(Array.isArray(i.interactions)?s=new ho(i.interactions.slice()):(Vn(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new ho(i.overlays.slice()):(Vn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new ho,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var Bq=D5;function BS(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var Gle=new Error("disposed");var zle=[256,256],F5=class extends Sg{constructor(e){let t=rn.IDLE;super(e.tileCoord,t,{transition:e.transition,interpolate:e.interpolate}),this.loader_=e.loader,this.data_=null,this.error_=null,this.size_=e.size||null,this.controller_=e.controller||null}getSize(){if(this.size_)return this.size_;let e=BS(this.data_);return e?[e.width,e.height]:zle}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==rn.IDLE&&this.state!==rn.ERROR)return;this.state=rn.LOADING,this.changed();let e=this;this.loader_().then(function(t){e.data_=t,e.state=rn.LOADED,e.changed()}).catch(function(t){e.error_=t,e.state=rn.ERROR,e.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(Gle),this.controller_=null),super.disposeInternal()}},O5=F5;var B5=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 bd&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return Vn(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){let t=this.entries_[e];return Vn(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){Vn(!(e in this.entries_),"Tried to set a value for a key that is used already");let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}},U5=B5;var k5=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Tx(),{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}},US=k5;var Vle=5,G5=class extends Ow{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=Vle,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 Yn()}getData(e){return null}prepareFrame(e){return Yn()}renderFrame(e,t){return Yn()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Mn.LOADED||t.getState()===Mn.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Mn.LOADED&&t!=Mn.ERROR&&e.addEventListener(Jt.CHANGE,this.boundHandleImageChange_),t==Mn.IDLE&&(e.load(),t=e.getState()),t==Mn.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},Uq=G5;var V5=[],jg=null;function qle(){jg=Ti(1,1,void 0,{willReadFrequently:!0})}var z5=class extends Uq{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Zs(),this.pixelTransform=Zs(),this.inversePixelTransform=Zs(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){jg||qle(),jg.clearRect(0,0,1,1);let r;try{jg.drawImage(e,t,n,1,1,0,0,1,1),r=jg.getImageData(0,0,1,1).data}catch{return jg=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(fl(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&&Lo(Zl(e.style.backgroundColor),Zl(n)))){let c=e.firstElementChild;fl(c)&&(l=c.getContext("2d"))}if(l&&lz(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=Os?Iw():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Ti();let u=l.canvas;a.appendChild(u),c=u.style,c.position="absolute",c.left="0",c.transformOrigin="top left",this.container=a,this.context=l}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=Wl(n),s=hg(n),o=ug(n),a=cg(n);Pr(t.coordinateToPixelTransform,r),Pr(t.coordinateToPixelTransform,s),Pr(t.coordinateToPixelTransform,o),Pr(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;Pr(l,r),Pr(l,s),Pr(l,o),Pr(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,s=e.viewState.rotation,o=e.pixelRatio,a=Math.round(jn(n)/r*o),l=Math.round(_r(n)/r*o);uo(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),Dw(this.inversePixelTransform,this.pixelTransform);let c=az(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 OS(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(po.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(po.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new US),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(po.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(po.POSTRENDER,this.context,e))}getRenderTransform(e,t,n,r,s,o,a){let l=s/2,c=o/2,u=r/t,f=-u,p=-e[0]+a,x=-e[1];return uo(this.tempTransform,l,c,u,f,-n,p,x)}disposeInternal(){delete this.frameState,super.disposeInternal()}},kS=z5;function q5(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 Hle(i,e,t){let n=i[t];return n?n.delete(e):!1}function kq(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=xu(e,Pc(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=xu(e,r))}return e}var H5=class extends kS{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=Rr(),this.tempTileRange_=new Tw(0,0,0,0),this.tempTileCoord_=yg(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new U5(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new U5(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=vg(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||gg(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=Pr(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!Sc(s,r))return null;let o=t.viewState,a=n.getRenderSource(),l=a.getTileGridForProjection(o.projection),c=a.getTilePixelRatio(t.pixelRatio);for(let u=l.getZForResolution(o.resolution);u>=l.getMinZoom();--u){let f=l.getTileCoordForCoordAndZ(r,u),p=this.getTile(u,f[1],f[2],t);if(!p||p.getState()!==rn.LOADED)continue;let x=l.getOrigin(u),v=Wr(l.getTileSize(u)),w=l.getResolution(u),S;if(p instanceof Nw||p instanceof Fw)S=p.getImage();else if(p instanceof O5){if(S=BS(p.getData()),!S)continue}else continue;let T=Math.floor(c*((r[0]-x[0])/w-f[1]*v[0])),P=Math.floor(c*((x[1]-r[1])/w-f[2]*v[1])),R=Math.round(c*a.getGutterForProjection(o.projection));return this.getImageData(S,T+R,P+R)}return null}prepareFrame(e){this.renderedProjection?e.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=e.viewState.projection):this.renderedProjection=e.viewState.projection;let t=this.getLayer().getSource();if(!t)return!1;let n=t.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==n&&(this.renderedSourceRevision_=n,this.renderedSourceKey_===t.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=n,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(e,t,n,r,s){let o=e.viewState,a=this.getLayer(),l=a.getRenderSource(),c=l.getTileGridForProjection(o.projection),u=Ln(l);u in e.wantedTiles||(e.wantedTiles[u]={});let f=e.wantedTiles[u],p=a.getMapInternal(),x=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),p?p.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),v=o.rotation,w=v?eP(o.center,o.resolution,v,e.size):void 0;for(let S=n;S>=x;--S){let T=c.getTileRangeForExtentAndZ(t,S,this.tempTileRange_),P=c.getResolution(S);for(let R=T.minX;R<=T.maxX;++R)for(let C=T.minY;C<=T.maxY;++C){if(v&&!c.tileCoordIntersectsViewport([S,R,C],w))continue;let L=this.getTile(S,R,C,e);if(!L||!q5(r,L,S))continue;let F=L.getKey();if(f[F]=!0,L.getState()===rn.IDLE&&!e.tileQueue.isKeyQueued(F)){let N=yg(S,R,C,this.tempTileCoord_);e.tileQueue.enqueue([L,u,c.getTileCoordCenter(N),P])}}}}findStaleTile_(e,t){let n=this.tileCache_,r=e[0],s=e[1],o=e[2],a=this.getStaleKeys();for(let l=0;l<a.length;++l){let c=vg(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){let u=n.peek(c);if(u.getState()===rn.LOADED)return u.endTransition(Ln(this)),q5(t,u,r),!0}}return!1}findAltTiles_(e,t,n,r){let s=e.getTileRangeForTileCoordAndZ(t,n,this.tempTileRange_);if(!s)return!1;let o=!0,a=this.tileCache_,l=this.getLayer().getRenderSource(),c=l.getKey();for(let u=s.minX;u<=s.maxX;++u)for(let f=s.minY;f<=s.maxY;++f){let p=vg(l,c,n,u,f),x=!1;if(a.containsKey(p)){let v=a.peek(p);v.getState()===rn.LOADED&&(q5(r,v,n),x=!0)}x||(o=!1)}return o}renderFrame(e,t){this.renderComplete=!0;let n=e.layerStatesArray[e.layerIndex],r=e.viewState,s=r.projection,o=r.resolution,a=r.center,l=e.pixelRatio,c=this.getLayer(),u=c.getSource(),f=u.getTileGridForProjection(s),p=f.getZForResolution(o,u.zDirection),x=f.getResolution(p);this.updateStaleKeys(u.getKey());let v=e.extent,w=u.getTilePixelRatio(l);this.prepareContainer(e,t);let S=this.context.canvas.width,T=this.context.canvas.height;this.layerExtent=n.extent?Pc(n.extent,s):null,this.layerExtent&&(v=xu(v,this.layerExtent));let P=x*S/2/w,R=x*T/2/w,C=[a[0]-P,a[1]-R,a[0]+P,a[1]+R],L={};this.renderedTiles.length=0;let D=c.getPreload();if(e.nextExtent&&this.enqueueTilesForNextExtent()){let K=f.getZForResolution(r.nextResolution,u.zDirection),ee=kq(e,e.nextExtent);this.enqueueTiles(e,ee,K,L,D)}let F=kq(e,v);if(this.enqueueTiles(e,F,p,L,0),D>0&&setTimeout(()=>{this.enqueueTiles(e,F,p-1,L,D-1)},0),!(p in L))return this.container;let N=Ln(this),B=e.time;for(let K of L[p]){let ee=K.getState();if(ee===rn.EMPTY)continue;let ae=K.tileCoord;if(ee===rn.LOADED&&K.getAlpha(N,B)===1){K.endTransition(N);continue}if(ee!==rn.ERROR&&(this.renderComplete=!1),this.findStaleTile_(ae,L)){Hle(L,K,p),e.animate=!0;continue}if(this.findAltTiles_(f,ae,p+1,L))continue;let ve=f.getMinZoom();for(let Ie=p-1;Ie>=ve&&!this.findAltTiles_(f,ae,Ie,L);--Ie);}let z=x/o*l/w,V=this.getRenderContext(e);uo(this.tempTransform,S/2,T/2,z,z,0,-S/2,-T/2),this.layerExtent&&this.clipUnrotated(V,e,this.layerExtent),u.getInterpolate()||(V.imageSmoothingEnabled=!1),this.preRender(V,e);let H=Object.keys(L).map(Number);H.sort(ka);let Z=[],J=[],j=[];for(let K=H.length-1;K>=0;--K){let ee=H[K],ae=u.getTilePixelSize(ee,l,s),de=f.getResolution(ee)/x,ve=ae[0]*de*z,Ie=ae[1]*de*z,Qe=f.getTileCoordForCoordAndZ(Wl(C),ee),Ue=f.getTileCoordExtent(Qe),mt=Pr(this.tempTransform,[w*(Ue[0]-C[0])/x,w*(C[3]-Ue[3])/x]),Me=w*u.getGutterForProjection(s);for(let ze of L[ee]){if(ze.getState()!==rn.LOADED)continue;let $e=ze.tileCoord,Et=Qe[1]-$e[1],Tt=Math.round(mt[0]-(Et-1)*ve),Ct=Qe[2]-$e[2],un=Math.round(mt[1]-(Ct-1)*Ie),Gt=Math.round(mt[0]-Et*ve),Xe=Math.round(mt[1]-Ct*Ie),st=Tt-Gt,tt=un-Xe,vt=ee===p;if(vt&&ze.inTransition(N)){j.push({tile:ze,x:Gt,y:Xe,w:st,h:tt,gutter:Me}),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze);continue}let yt=[Gt,Xe,Gt+st,Xe+tt],ln=[];for(let Qt=0,xn=Z.length;Qt<xn;++Qt)ee<J[Qt]&&xr(yt,Z[Qt])&&ln.push(Z[Qt]);let Kt;ln.length>0&&(Kt=iG(yt,ln)),Z.push(yt),J.push(ee),this.drawTile(ze,e,Gt,Xe,st,tt,Me,vt,Kt),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze)}}for(let K=0,ee=j.length;K<ee;++K){let{tile:ae,x:ce,y:de,w:ve,h:Ie,gutter:Qe}=j[K];this.drawTile(ae,e,ce,de,ve,Ie,Qe,!0,void 0)}if(this.renderedResolution=x,this.extentChanged=!this.renderedExtent_||!U0(this.renderedExtent_,C),this.renderedExtent_=C,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&V.restore(),V.imageSmoothingEnabled=!0,this.renderComplete){let K=(ee,ae)=>{let ce=Ln(u),de=ae.wantedTiles[ce],ve=de?Object.keys(de).length:0;this.updateCacheSize(ve),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push(K)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,s,o,a,l,c){let u;if(e instanceof O5){if(u=BS(e.getData()),!u)throw new Error("Rendering array data is not yet supported")}else u=this.getTileImage(e);if(!u)return;let f=this.getRenderContext(t),p=Ln(this),x=t.layerStatesArray[t.layerIndex],v=x.opacity*(l?e.getAlpha(p,t.time):1),w=v!==f.globalAlpha;w&&(f.save(),f.globalAlpha=v);let S=u.width-2*a,T=u.height-2*a;if(c){let P=S/s,R=T/o;for(let C=0,L=c.length;C<L;++C){let D=c[C],F=D[0],N=D[1],B=D[2]-D[0],z=D[3]-D[1];f.drawImage(u,a+(F-n)*P,a+(N-r)*R,B*P,z*R,F,N,B,z)}}else f.drawImage(u,a,a,S,T,n,r,s,o);w&&f.restore(),v!==x.opacity?t.animate=!0:l&&e.endTransition(p)}getImage(){let e=this.context;return e?e.canvas:null}getTileImage(e){return e.getImage()}updateUsedTiles(e,t,n){let r=Ln(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},Gq=H5;var ry={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var W5=class extends sA{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(ry.PRELOAD)}setPreload(e){this.set(ry.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(ry.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(ry.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},zq=W5;var j5=class extends zq{constructor(e){super(e)}createRenderer(){return new Gq(this,{cacheSize:this.getCacheSize()})}},X5=j5;var $5=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){}},GS=$5;var sy={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},oy=[sy.FILL],Fu=[sy.STROKE],mf=[sy.BEGIN_PATH],Y5=[sy.CLOSE_PATH],An=sy;var Z5=class extends GS{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],Sc(n,r)&&(s[o++]=r[0],s[o++]=r[1]);return o}appendFlatLineCoordinates(e,t,n,r,s,o){let a=this.coordinates,l=a.length,c=this.getBufferedMaxExtent();o&&(t+=r);let u=e[t],f=e[t+1],p=this.tmpCoordinate_,x=!0,v,w,S;for(v=t+r;v<n;v+=r)p[0]=e[v],p[1]=e[v+1],S=aw(c,p),S!==w?(x&&(a[l++]=u,a[l++]=f,x=!1),a[l++]=p[0],a[l++]=p[1]):S===_s.INTERSECTING?(a[l++]=p[0],a[l++]=p[1],x=!1):x=!0,u=p[0],f=p[1],w=S;return(s&&x||v===t+r)&&(a[l++]=u,a[l++]=f),l}drawCustomCoordinates_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o){let l=n[o],c=this.appendFlatLineCoordinates(e,t,l,r,!1,!1);s.push(c),t=l}return t}drawCustom(e,t,n,r,s){this.beginGeometry(e,t,s);let o=e.getType(),a=e.getStride(),l=this.coordinates.length,c,u,f,p,x;switch(o){case"MultiPolygon":c=e.getOrientedFlatCoordinates(),p=[];let v=e.getEndss();x=0;for(let w=0,S=v.length;w<S;++w){let T=[];x=this.drawCustomCoordinates_(c,x,v[w],a,T),p.push(T)}this.instructions.push([An.CUSTOM,l,p,e,n,Mx,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,p,e,r||n,Mx,s]);break;case"Polygon":case"MultiLineString":f=[],c=o=="Polygon"?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),x=this.drawCustomCoordinates_(c,0,e.getEnds(),a,f),this.instructions.push([An.CUSTOM,l,f,e,n,Cg,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,f,e,r||n,Cg,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([An.CUSTOM,l,u,e,n,Su,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,Su,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([An.CUSTOM,l,u,e,n,Su,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,Su,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),u=this.coordinates.length,this.instructions.push([An.CUSTOM,l,u,e,n,void 0,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,void 0,s]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[An.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[An.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,s,o=-1;for(t=0;t<n;++t)r=e[t],s=r[0],s==An.END_GEOMETRY?o=t:s==An.BEGIN_GEOMETRY&&(r[2]=t,FG(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=za(n||Bs)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=za(n||Fo);let r=e.getLineCap();t.lineCap=r!==void 0?r:Ru;let s=e.getLineDash();t.lineDash=s?s.slice():Va;let o=e.getLineDashOffset();t.lineDashOffset=o||qa;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:Pu;let l=e.getWidth();t.lineWidth=l!==void 0?l:cf;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:af;let u=e.getOffset();t.strokeOffset=u??eV,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[An.SET_FILL_STYLE,t];return typeof t!="string"&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[An.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(n!==void 0&&typeof n!="string"||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,s=e.lineDash,o=e.lineDashOffset,a=e.lineJoin,l=e.lineWidth,c=e.miterLimit,u=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||s!=e.currentLineDash&&!Lo(e.currentLineDash,s)||e.currentLineDashOffset!=o||e.currentLineJoin!=a||e.currentLineWidth!=l||e.currentMiterLimit!=c||e.currentStrokeOffset!=u)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=s,e.currentLineDashOffset=o,e.currentLineJoin=a,e.currentLineWidth=l,e.currentMiterLimit=c,e.currentStrokeOffset=u)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[An.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=lw(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;ag(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Ou=Z5;var K5=class extends Ou{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&&!Sc(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=e.getStride(),o=this.coordinates.length,a=this.appendFlatPointCoordinates(r,s);this.instructions.push([An.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([An.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),s=[];for(let l=0,c=r.length;l<c;l+=e.getStride())(!this.maxExtent||Sc(this.maxExtent,r.slice(l,l+2)))&&s.push(r[l],r[l+1]);let o=this.coordinates.length,a=this.appendFlatPointCoordinates(s,2);this.instructions.push([An.DRAW_IMAGE,o,a,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([An.DRAW_IMAGE,o,a,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){let n=e.getAnchor(),r=e.getSize(),s=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=s[0],this.originY_=s[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},Vq=K5;var Q5=class extends Ou{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r,s){let o=this.coordinates.length,a=this.appendFlatLineCoordinates(e,t,n,r,!1,!1);return this.instructions.push([An.MOVE_TO_LINE_TO,o,a,s*this.pixelRatio]),this.hitDetectionInstructions.push([An.MOVE_TO_LINE_TO,o,a,s]),n}drawLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Fo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Va,qa],mf);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Fu),this.endGeometry(t)}drawMultiLineString(e,t,n){let r=this.state,s=r.strokeStyle,o=r.lineWidth,a=r.strokeOffset;if(s===void 0||o===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Fo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Va,qa],mf);let l=e.getEnds(),c=e.getFlatCoordinates(),u=e.getStride(),f=0;for(let p=0,x=l.length;p<x;++p)f=this.drawFlatCoordinates_(c,f,l[p],u,a);this.hitDetectionInstructions.push(Fu),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Fu),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Fu),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(mf)}},qq=Q5;var J5=class extends Ou{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(mf),this.hitDetectionInstructions.push(mf);for(let u=0;u<c;++u){let f=n[u],p=this.coordinates.length,x=this.appendFlatLineCoordinates(e,t,f,r,!0,!l);this.instructions.push([An.MOVE_TO_LINE_TO,p,x,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([An.MOVE_TO_LINE_TO,p,x,s,!0]),l&&(this.instructions.push(Y5),this.hitDetectionInstructions.push(Y5)),t=f}return a&&(this.instructions.push(oy),this.hitDetectionInstructions.push(oy)),l&&(this.instructions.push(Fu),this.hitDetectionInstructions.push(Fu)),t}drawCircle(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_FILL_STYLE,Bs]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Fo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Va,qa]);let l=e.getFlatCoordinates(),c=e.getStride(),u=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let f=[An.CIRCLE,u,a];this.instructions.push(mf,f),this.hitDetectionInstructions.push(mf,f),r.fillStyle!==void 0&&(this.instructions.push(oy),this.hitDetectionInstructions.push(oy)),r.strokeStyle!==void 0&&(this.instructions.push(Fu),this.hitDetectionInstructions.push(Fu)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_FILL_STYLE,Bs]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Fo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Va,qa]);let l=e.getEnds(),c=e.getOrientedFlatCoordinates(),u=e.getStride();this.drawFlatCoordinatess_(c,0,l,u,a),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state,s=r.fillStyle,o=r.strokeStyle,a=r.strokeOffset;if(s===void 0&&o===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_FILL_STYLE,Bs]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Fo,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Va,qa]);let l=e.getEndss(),c=e.getOrientedFlatCoordinates(),u=e.getStride(),f=0;for(let p=0,x=l.length;p<x;++p)f=this.drawFlatCoordinatess_(c,f,l[p],u,a);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(e!==0){let t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=Td(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}},eN=J5;var tN=0,nN=1;function Wle(i,e,t,n,r,s,o,a){let l=o-r,c=a-s,u=0,f=1;if(l===0){if(r<i||r>t)return!1}else{let p=(i-r)/l,x=(t-r)/l;if(p>x){let v=p;p=x,x=v}if(p>u&&(u=p),x<f&&(f=x),u>f)return!1}if(c===0){if(s<e||s>n)return!1}else{let p=(e-s)/c,x=(n-s)/c;if(p>x){let v=p;p=x,x=v}if(p>u&&(u=p),x<f&&(f=x),u>f)return!1}return tN=u,nN=f,!0}function Hq(i,e,t,n){let r=n[0],s=n[1],o=n[2],a=n[3],l=[],c=[],u=!1,f,p,x=0;for(let v=0,w=e.length;v<w;++v){let S=e[v],T=i[x],P=i[x+1],R=!1;for(let C=x+t;C<S;C+=t){let L=i[C],D=i[C+1];if(Wle(r,s,o,a,T,P,L,D)){let F=L-T,N=D-P,B=T+tN*F,z=P+tN*N,V=T+nN*F,H=P+nN*N;u&&R&&B===f&&z===p?l.push(V,H):(u&&c.push(l.length),l.push(B,z,V,H),u=!0),f=V,p=H,R=!0}T=L,P=D}x=S}return u&&c.push(l.length),{flatCoordinates:l,ends:c}}function Wq(i,e,t,n,r){let s=[],o=t,a=0,l=e.slice(t,2);for(;a<i&&o+r<n;){let[c,u]=l.slice(-2),f=e[o+r],p=e[o+r+1],x=Math.sqrt((f-c)*(f-c)+(p-u)*(p-u));if(a+=x,a>=i){let v=(i-a+x)/x,w=No(c,f,v),S=No(u,p,v);l.push(w,S),s.push(l),l=[w,S],a==i&&(o+=r),a=0}else if(a<i)l.push(e[o+r],e[o+r+1]),o+=r;else{let v=x-a,w=No(c,f,v/x),S=No(u,p,v/x);l.push(w,S),s.push(l),l=[w,S],a=0,o+=r}}return a>0&&s.push(l),s}function jq(i,e,t,n,r){let s=t,o=t,a=0,l=0,c=t,u,f,p,x,v,w,S,T,P,R;for(f=t;f<n;f+=r){let C=e[f],L=e[f+1];v!==void 0&&(P=C-v,R=L-w,x=Math.sqrt(P*P+R*R),S!==void 0&&(l+=p,u=Math.acos((S*P+T*R)/(p*x)),u>i&&(l>a&&(a=l,s=c,o=f),l=0,c=f-r)),p=x,S=P,T=R),v=C,w=L}return l+=x,l>a?[c,f]:[s,o]}var ay={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},iN=class extends Ou{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[Bs]={fillStyle:Bs},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;let a=this.coordinates,l=a.length,c=e.getType(),u=null,f=e.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){let p=e.getExtent();if(!xr(this.maxExtent,p))return;let x;if(u=e.getFlatCoordinates(),c=="LineString")x=[u.length];else if(c=="MultiLineString")x=e.getEnds();else if(c=="Polygon")x=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){let T=e.getEndss();x=[];for(let P=0,R=T.length;P<R;++P)x.push(T[P][0])}if((c=="LineString"||c=="MultiLineString")&&!_u(this.getBufferedMaxExtent(),p)){let T=Hq(u,x,f,this.getBufferedMaxExtent());if(u=T.flatCoordinates,x=T.ends,f=2,x.length===0)return}this.beginGeometry(e,t,n);let v=o.repeat,w=v?void 0:o.textAlign,S=0;for(let T=0,P=x.length;T<P;++T){let R;v?R=Wq(v*this.resolution,u,S,x[T],f):R=[u.slice(S,x[T])];for(let C=0,L=R.length;C<L;++C){let D=R[C],F=0,N=D.length;if(w==null){let z=jq(o.maxAngle,D,0,D.length,2);F=z[0],N=z[1]}for(let z=F;z<N;z+=f)a.push(D[z],D[z+1]);let B=a.length;S=x[T],this.drawChars_(l,B),l=B}}this.endGeometry(t)}else{let p=o.overflow?null:[];switch(c){case"Point":case"MultiPoint":u=e.getFlatCoordinates();break;case"LineString":u=e.getFlatMidpoint();break;case"Circle":u=e.getCenter();break;case"MultiLineString":u=e.getFlatMidpoints(),f=2;break;case"Polygon":u=e.getFlatInteriorPoint(),o.overflow||p.push(u[2]/this.resolution),f=3;break;case"MultiPolygon":let C=e.getFlatInteriorPoints();u=[];for(let L=0,D=C.length;L<D;L+=3)o.overflow||p.push(C[L+2]/this.resolution),u.push(C[L],C[L+1]);if(u.length===0)return;f=2;break;default:}let x=this.appendFlatPointCoordinates(u,f);if(x===l)return;if(p&&(x-l)/2!==u.length/f){let C=l/2;p=p.filter((L,D)=>{let F=a[(C+D)*2]===u[D*f]&&a[(C+D)*2+1]===u[D*f+1];return F||--C,F})}this.saveTextStates_();let v=o.backgroundFill?this.createFill(this.fillStyleToState(o.backgroundFill)):null,w=o.backgroundStroke?this.createStroke(this.strokeStyleToState(o.backgroundStroke)):null;this.beginGeometry(e,t,n);let S=o.padding;if(S!=lf&&(o.scale[0]<0||o.scale[1]<0)){let C=o.padding[0],L=o.padding[1],D=o.padding[2],F=o.padding[3];o.scale[0]<0&&(L=-L,F=-F),o.scale[1]<0&&(C=-C,D=-D),S=[C,L,D,F]}let T=this.pixelRatio;this.instructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,S==lf?lf:S.map(function(C){return C*T}),v,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]);let P=1/T,R=v?v.slice(0):null;R&&(R[1]=Bs),this.hitDetectionInstructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[P,P],NaN,this.declutterMode_,this.declutterImageWithText_,S,R,w,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Bs:this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||Nd,justify:t.justify,textBaseline:t.textBaseline||eA,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=ay[r.textBaseline],u=this.textOffsetX_*l,f=this.textOffsetY_*l,p=this.text_,x=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([An.DRAW_CHARS,e,t,c,r.overflow,a,r.maxAngle,l,f,s,x*l,p,o,1,this.declutterMode_,this.textKeepUpright_,u]),this.hitDetectionInstructions.push([An.DRAW_CHARS,e,t,c,r.overflow,a&&Bs,r.maxAngle,l,f,s,x*l,p,o,1/l,this.declutterMode_,this.textKeepUpright_,u])}setTextStyle(e,t){let n,r,s;if(!e)this.text_="";else{let o=e.getFill();o?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=za(o.getColor()||Bs)):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)s=null,this.textStrokeState_=s;else{s=this.textStrokeState_,s||(s={},this.textStrokeState_=s);let w=a.getLineDash(),S=a.getLineDashOffset(),T=a.getWidth(),P=a.getMiterLimit();s.lineCap=a.getLineCap()||Ru,s.lineDash=w?w.slice():Va,s.lineDashOffset=S===void 0?qa:S,s.lineJoin=a.getLineJoin()||Pu,s.lineWidth=T===void 0?cf:T,s.miterLimit=P===void 0?af:P,s.strokeStyle=za(a.getColor()||Fo)}n=this.textState_;let l=e.getFont()||iS;tV(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()||eA,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||lf,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),p=e.getRotateWithView(),x=e.getKeepUpright(),v=e.getRotation();this.text_=e.getText()||"",this.textOffsetX_=u===void 0?0:u,this.textOffsetY_=f===void 0?0:f,this.textRotateWithView_=p===void 0?!1:p,this.textKeepUpright_=x===void 0?!0:x,this.textRotation_=v===void 0?0:v,this.strokeKey_=s?(typeof s.strokeStyle=="string"?s.strokeStyle:Ln(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+Ln(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},Xq=iN;var jle={Circle:eN,Default:Ou,Image:Vq,LineString:qq,Polygon:eN,Text:Xq},rN=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=jle[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},$q=rN;function Yq(i,e,t,n){let r=i[e],s=i[e+1],o=0;for(let a=e+n;a<t;a+=n){let l=i[a],c=i[a+1];o+=Math.sqrt((l-r)*(l-r)+(c-s)*(c-s)),r=l,s=c}return o}function zS(i,e,t,n,r,s,o,a){o=o??[],a=a??n;let l=i[e+n],c=i[e+n+1],u=i[t-2*n],f=i[t-2*n+1],p,x,v,w,S,T,P,R,C=0;for(let L=e;L<t;L+=n){v=p,w=x,S=void 0,T=void 0,L+n<t&&(S=i[L+n],T=i[L+n+1]),s&&L===e&&(v=u,w=f),s&&L===t-n&&(S=l,T=c),p=i[L],x=i[L+1],[P,R]=Xle(p,x,v,w,S,T,r),o[C++]=P,o[C++]=R;for(let D=2;D<a;D++)o[C++]=i[L+D]}return o.length!=C&&(o.length=C),o}function Xle(i,e,t,n,r,s,o){let a,l;t!==void 0&&n!==void 0?(a=i-t,l=e-n):r!==void 0&&s!==void 0?(a=r-i,l=s-e):(a=1,l=0);let c=Math.hypot(a,l),u=a/c,f=l/c;if(a=-f,l=u,t===void 0||n===void 0)return[i+a*o,e+l*o];if(r===void 0||s===void 0)return[i+a*o,e+l*o];let p=uG([i,e],[t,n],[r,s]);if(Math.cos(p)>.998)return[i+u*o,e+f*o];let x=Math.cos(p/2),v=Math.sin(p/2),w=v*a+x*l,S=-x*a+v*l,T=w*(1/v),P=S*(1/v);return[i+T*o,e+P*o]}function VS(i,e,t=!1){for(let n=0,r=i.length-2;n<r;n+=e){let s=t&&n===0?i.length-3*e:i.length-2*e;for(let o=s;o>n+e;o-=e){let a=i[n],l=i[n+1],c=i[n+e],u=i[n+e+1],f=i[o],p=i[o+1],x=i[o+e],v=i[o+e+1],w=(v-p)*(c-a)-(x-f)*(u-l);if(w===0)continue;let S=((x-f)*(l-p)-(v-p)*(a-f))/w,T=((c-a)*(l-p)-(u-l)*(a-f))/w;if(S>0&&S<1&&T>0&&T<1){let P=a+S*(c-a),R=l+S*(u-l);i[n+e]=P,i[n+e+1]=R,i.splice(n+2*e,o-n-e);break}}}return i}var sN;function $le(){return sN||(sN=new Intl.Segmenter(void 0,{granularity:"grapheme"})),sN}function Zq(i,e,t,n,r,s,o,a,l,c,u,f,p=!0){let x=i[e],v=i[e+1],w=0,S=0,T=0,P=0;function R(){w=x,S=v,e+=n,x=i[e],v=i[e+1],P+=T,T=Math.sqrt((x-w)*(x-w)+(v-S)*(v-S))}do R();while(e<t-n&&P+T<s);let C=T===0?0:(s-P)/T,L=No(w,x,C),D=No(S,v,C),F=e-n,N=P,B=s+a*l(c,r,u);for(;e<t-n&&P+T<B;)R();C=T===0?0:(B-P)/T;let z=No(w,x,C),V=No(S,v,C),H=!1;if(p)if(f){let ae=[L,D,z,V];zw(ae,0,4,2,f,ae,ae),H=ae[0]>ae[2]}else H=L>z;let Z=Math.PI,J=[],j=F+n===e;e=F,T=0,P=N,x=i[e],v=i[e+1];let K;if(j){R(),K=Math.atan2(v-S,x-w),H&&(K+=K>0?-Z:Z);let ae=(z+L)/2,ce=(V+D)/2;return J[0]=[ae,ce,(B-s)/2,K,r],J}r=r.replace(/\n/g," ");let ee=Array.from($le().segment(r),ae=>ae.segment);for(let ae=0,ce=ee.length;ae<ce;){R();let de=Math.atan2(v-S,x-w);if(H&&(de+=de>0?-Z:Z),K!==void 0){let Me=de-K;if(Me+=Me>Z?-2*Z:Me<-Z?2*Z:0,Math.abs(Me)>o)return null}K=de;let ve=ae,Ie=0;for(;ae<ce;++ae){let Me=H?ce-ae-1:ae,ze=a*l(c,ee[Me],u);if(e+n<t&&P+T<s+Ie+ze/2)break;Ie+=ze}if(ae===ve)continue;let Qe=(H?ee.slice(ce-ae,ce-ve):ee.slice(ve,ae)).join("");C=T===0?0:(s+Ie/2-P)/T;let Ue=No(w,x,C),mt=No(S,v,C);J.push([Ue,mt,Ie/2,de,Qe]),s+=Ie}return J}var Xg=Rr(),Bd=[],gf=[],_f=[],Ud=[];function Kq(i){return i[3].declutterBox}var Qq=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function oN(i,e){return e==="start"?e=Qq.test(i)?"right":"left":e==="end"&&(e=Qq.test(i)?"left":"right"),ay[e]}function Yle(i,e,t){return t>0&&i.push(`7+`,""),i.push(e,""),i}function Zle(i,e,t){return t%2===0&&(i+=e),i}var aN=class{constructor(e,t,n,r,s){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=Zs(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=s?new US: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?ay[l.justify]:oN(Array.isArray(e)?e[0]:e,l.textAlign||Nd),p=r&&o.lineWidth?o.lineWidth:0,x=Array.isArray(e)?e:String(e).split(`8+`).reduce(Yle,[]),{width:v,height:w,widths:S,heights:T,lineWidths:P}=rV(l,x),R=v+p,C=[],L=(R+2)*u[0],D=(w+p)*u[1],F={width:L<0?Math.floor(L):Math.ceil(L),height:D<0?Math.floor(D):Math.ceil(D),contextInstructions:C};(u[0]!=1||u[1]!=1)&&C.push("scale",u),r&&(C.push("strokeStyle",o.strokeStyle),C.push("lineWidth",p),C.push("lineCap",o.lineCap),C.push("lineJoin",o.lineJoin),C.push("miterLimit",o.miterLimit),C.push("setLineDash",[o.lineDash]),C.push("lineDashOffset",o.lineDashOffset)),n&&C.push("fillStyle",a.fillStyle),C.push("textBaseline","middle"),C.push("textAlign","center");let N=.5-f,B=f*R+N*p,z=[],V=[],H=0,Z=0,J=0,j=0,K;for(let ee=0,ae=x.length;ee<ae;ee+=2){let ce=x[ee];if(ce===`9+`){Z+=H,H=0,B=f*R+N*p,++j;continue}let de=x[ee+1]||l.font;de!==K&&(r&&z.push("font",de),n&&V.push("font",de),K=de),H=Math.max(H,T[J]);let ve=[ce,B+N*S[J]+f*(S[J]-P[j]),.5*(p+H)+Z];B+=S[J],r&&z.push("strokeText",ve),n&&V.push("fillText",ve),++J}return Array.prototype.push.apply(C,z),Array.prototype.push.apply(C,V),this.labels_[s]=F,F}replayTextBackground_(e,t,n,r,s,o,a){e.beginPath(),e.moveTo.apply(e,t),e.lineTo.apply(e,n),e.lineTo.apply(e,r),e.lineTo.apply(e,s),e.lineTo.apply(e,t),o&&(this.alignAndScaleFill_=o[2],e.fillStyle=o[1],this.fill_(e)),a&&(this.setStrokeStyle_(e,a),e.stroke())}calculateImageOrLabelDimensions_(e,t,n,r,s,o,a,l,c,u,f,p,x,v,w,S){a*=p[0],l*=p[1];let T=n-a,P=r-l,R=s+c>e?e-c:s,C=o+u>t?t-u:o,L=v[3]+R*p[0]+v[1],D=v[0]+C*p[1]+v[2],F=T-v[3],N=P-v[0];(w||f!==0)&&(Bd[0]=F,Ud[0]=F,Bd[1]=N,gf[1]=N,gf[0]=F+L,_f[0]=gf[0],_f[1]=N+D,Ud[1]=_f[1]);let B;return f!==0?(B=uo(Zs(),n,r,1,1,f,-n,-r),Pr(B,Bd),Pr(B,gf),Pr(B,_f),Pr(B,Ud),hl(Math.min(Bd[0],gf[0],_f[0],Ud[0]),Math.min(Bd[1],gf[1],_f[1],Ud[1]),Math.max(Bd[0],gf[0],_f[0],Ud[0]),Math.max(Bd[1],gf[1],_f[1],Ud[1]),Xg)):hl(Math.min(F,F+L),Math.min(N,N+D),Math.max(F,F+L),Math.max(N,N+D),Xg),x&&(T=Math.round(T),P=Math.round(P)),{drawImageX:T,drawImageY:P,drawImageW:R,drawImageH:C,originX:c,originY:u,declutterBox:{minX:Xg[0],minY:Xg[1],maxX:Xg[2],maxY:Xg[3],value:S},canvasTransform:B,scale:p}}replayImageOrLabel_(e,t,n,r,s,o,a){let l=!!(o||a),c=r.declutterBox,u=a?a[2]*r.scale[0]/2:0;return c.minX-u<=t[0]&&c.maxX+u>=0&&c.minY-u<=t[1]&&c.maxY+u>=0&&(l&&this.replayTextBackground_(e,Bd,gf,_f,Ud,o,a),sV(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=Pr(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=oN(Array.isArray(e)?e[0]:e,s.textAlign||Nd),u=ay[s.textBaseline||eA],f=a&&a.lineWidth?a.lineWidth:0,p=o.width/l-2*s.scale[0],x=c*p+2*(.5-c)*f,v=u*o.height/l+2*(.5-u)*f;return{label:o,anchorX:x,anchorY:v}}execute_(e,t,n,r,s,o,a,l){let c=this.zIndexContext_,u;this.pixelCoordinates_&&Lo(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=Ga(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),oz(this.renderedTransform_,n));let f=0,p=r.length,x=0,v,w=[],S,T,P,R,C,L,D,F,N,B,z,V,H,Z=0,J=0,j=this.coordinateCache_,K=this.viewRotation_,ee=Math.round(Math.atan2(-n[1],n[0])*1e12)/1e12,ae={context:e,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:K},ce=this.instructions!=r||this.overlaps?0:200,de,ve,Ie,Qe;for(;f<p;){let Ue=r[f];switch(Ue[0]){case An.BEGIN_GEOMETRY:de=Ue[1],Qe=Ue[3],de.getGeometry()?a!==void 0&&!xr(a,Qe.getExtent())?f=Ue[2]+1:++f:f=Ue[2],c&&(c.zIndex=Ue[4]);break;case An.BEGIN_PATH:Z>ce&&(this.fill_(e),Z=0),J>ce&&(e.stroke(),J=0),!Z&&!J&&(e.beginPath(),C=NaN,L=NaN),++f;break;case An.CIRCLE:x=Ue[1],P=Ue[2]??0;let Me=u[x],ze=u[x+1],$e=u[x+2]-P,Et=u[x+3]-P,Tt=$e-Me,Ct=Et-ze,un=Math.sqrt(Tt*Tt+Ct*Ct);e.moveTo(Me+un,ze),e.arc(Me,ze,un,0,2*Math.PI,!0),++f;break;case An.CLOSE_PATH:e.closePath(),++f;break;case An.CUSTOM:x=Ue[1],v=Ue[2];let Gt=Ue[3],Xe=Ue[4],st=Ue[5];ae.geometry=Gt,ae.feature=de,f in j||(j[f]=[]);let tt=j[f];st?st(u,x,v,2,tt):(tt[0]=u[x],tt[1]=u[x+1],tt.length=2),c&&(c.zIndex=Ue[6]),Xe(tt,ae),++f;break;case An.DRAW_IMAGE:x=Ue[1],v=Ue[2],N=Ue[3],S=Ue[4],T=Ue[5];let vt=Ue[6],yt=Ue[7],ln=Ue[8],Kt=Ue[9],Qt=Ue[10],xn=Ue[11],ge=Ue[12],pi=Ue[13];R=Ue[14]||"declutter";let Bn=Ue[15];if(!N&&Ue.length>=20){B=Ue[19],z=Ue[20],V=Ue[21],H=Ue[22];let Nn=this.drawLabelWithPointPlacement_(B,z,V,H);N=Nn.label,Ue[3]=N;let zr=Ue[23];S=(Nn.anchorX-zr)*this.pixelRatio,Ue[4]=S;let gr=Ue[24];T=(Nn.anchorY-gr)*this.pixelRatio,Ue[5]=T,vt=N.height,Ue[6]=vt,pi=N.width,Ue[13]=pi}let le;Ue.length>25&&(le=Ue[25]);let X,Te,Pe;Ue.length>17?(X=Ue[16],Te=Ue[17],Pe=Ue[18]):(X=lf,Te=null,Pe=null),Qt&&ee?xn+=K:!Qt&&!ee&&(xn-=K);let Ve=0;for(;x<v;x+=2){if(le&&le[Ve++]<pi/this.pixelRatio)continue;let Nn=this.calculateImageOrLabelDimensions_(N.width,N.height,u[x],u[x+1],pi,vt,S,T,ln,Kt,xn,ge,s,X,!!Te||!!Pe,de),zr=[e,t,N,Nn,yt,Te,Pe];if(l){let gr,ol,na;if(Bn){let or=v-x;if(!Bn[or]){Bn[or]={args:zr,declutterMode:R};continue}let Ns=Bn[or];gr=Ns.args,ol=Ns.declutterMode,delete Bn[or],na=Kq(gr)}let al,Na;if(gr&&(ol!=="declutter"||!l.collides(na))&&(al=!0),(R!=="declutter"||!l.collides(Nn.declutterBox))&&(Na=!0),ol==="declutter"&&R==="declutter"){let or=al&&Na;al=or,Na=or}al&&(ol!=="none"&&l.insert(na),this.replayImageOrLabel_.apply(this,gr)),Na&&(R!=="none"&&l.insert(Nn.declutterBox),this.replayImageOrLabel_.apply(this,zr))}else this.replayImageOrLabel_.apply(this,zr)}++f;break;case An.DRAW_CHARS:let gt=Ue[1],St=Ue[2],qe=Ue[3],Ke=Ue[4];H=Ue[5];let Rt=Ue[6],en=Ue[7],Pt=Ue[8];V=Ue[9];let Mt=Ue[10];B=Ue[11],Array.isArray(B)&&(B=B.reduce(Zle,"")),z=Ue[12];let cn=[Ue[13],Ue[13]];R=Ue[14]||"declutter";let yn=Ue[15],Pn=Ue[16],xe=this.textStates[z],bt=xe.font,Ye=[xe.scale[0]*en,xe.scale[1]*en],wt;bt in this.widths_?wt=this.widths_[bt]:(wt={},this.widths_[bt]=wt);let Dt=Yq(u,gt,St,2),ct=Math.abs(Ye[0])*_I(bt,B,wt);if(Ke||ct<=Dt){let Nn=this.textStates[z].textAlign,zr=(Dt-ct)*oN(B,Nn),gr=Zq(u,gt,St,2,B,zr,Rt,Math.abs(Ye[0]),_I,bt,wt,ee?0:this.viewRotation_,yn);e:if(gr){let ol=[],na,al,Na,or,Ns;if(V)for(na=0,al=gr.length;na<al;++na){Ns=gr[na],Na=Ns[4],or=this.createLabel(Na,z,"",V),S=Ns[2]+(Ye[0]<0?-Mt:Mt)-Pn,T=qe*or.height+(.5-qe)*2*Mt*Ye[1]/Ye[0]-Pt;let ll=this.calculateImageOrLabelDimensions_(or.width,or.height,Ns[0],Ns[1],or.width,or.height,S,T,0,0,Ns[3],cn,!1,lf,!1,de);if(l&&R==="declutter"&&l.collides(ll.declutterBox))break e;ol.push([e,t,or,ll,1,null,null])}if(H)for(na=0,al=gr.length;na<al;++na){Ns=gr[na],Na=Ns[4],or=this.createLabel(Na,z,H,""),S=Ns[2]-Pn,T=qe*or.height-Pt;let ll=this.calculateImageOrLabelDimensions_(or.width,or.height,Ns[0],Ns[1],or.width,or.height,S,T,0,0,Ns[3],cn,!1,lf,!1,de);if(l&&R==="declutter"&&l.collides(ll.declutterBox))break e;ol.push([e,t,or,ll,1,null,null])}l&&R!=="none"&&l.load(ol.map(Kq));for(let ll=0,Au=ol.length;ll<Au;++ll)this.replayImageOrLabel_.apply(this,ol[ll])}}++f;break;case An.END_GEOMETRY:if(o!==void 0){de=Ue[1];let Nn=o(de,Qe,R);if(Nn)return Nn}++f;break;case An.FILL:ce?Z++:this.fill_(e),++f;break;case An.MOVE_TO_LINE_TO:x=Ue[1],v=Ue[2],P=Ue[3];let Ce,jt,Hi;if(P){let zr=(Ue[4]??!1)||Math.abs(u[x]-u[v-2])<1e-6&&Math.abs(u[x+1]-u[v-1])<1e-6;zS(u,x,v,2,P,zr,w),VS(w,2,zr),Ce=w,jt=0,Hi=Ce.length}else Ce=u,jt=x,Hi=v;ve=Ce[jt],Ie=Ce[jt+1],e.moveTo(ve,Ie),C=ve+.5|0,L=Ie+.5|0;for(let Nn=jt+2;Nn<Hi;Nn+=2)ve=Ce[Nn],Ie=Ce[Nn+1],D=ve+.5|0,F=Ie+.5|0,(Nn==Hi-2||D!==C||F!==L)&&(e.lineTo(ve,Ie),C=D,L=F);++f;break;case An.SET_FILL_STYLE:this.alignAndScaleFill_=Ue[2],Z?(this.fill_(e),Z=0,J&&(e.stroke(),J=0)):J&&Ue[1]&&(e.stroke(),J=0),e.fillStyle=Ue[1],++f;break;case An.SET_STROKE_STYLE:Z&&Ue[1]&&(this.fill_(e),Z=0),J&&(e.stroke(),J=0),this.setStrokeStyle_(e,Ue),++f;break;case An.STROKE:ce?J++:e.stroke(),++f;break;default:++f;break}}Z&&this.fill_(e),J&&e.stroke()}execute(e,t,n,r,s,o){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,n,r,s){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,s)}},Jq=aN;var kd=["Polygon","Circle","LineString","Image","Text","Default"],uN=["Image","Text"],eH=kd.filter(i=>!uN.includes(i)),tH=!1,nH=!1;function Kle(){let i=0,e=n=>{let r=Ti(1,1,null,{willReadFrequently:n}),s=0,o=performance.now();for(;performance.now()-o<50;++s)r.fillStyle=`rgba(255,0,${s%256},1)`,r.fillRect(0,0,1,1),r.getImageData(0,0,1,1);return i=s>i?s:i,s};tH={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],nH=!0}var cN=class{constructor(e,t,n,r,s,o,a){this.maxExtent_=e,this.overlaps_=r,this.pixelRatio_=n,this.resolution_=t,this.renderBuffer_=o,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=Zs(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(s,a)}clip(e,t){let n=this.getClipCoords(t);e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(n[2],n[3]),e.lineTo(n[4],n[5]),e.lineTo(n[6],n[7]),e.clip()}createExecutors_(e,t){for(let n in e){let r=this.executorsByZIndex_[n];r===void 0&&(r={},this.executorsByZIndex_[n]=r);let s=e[n];for(let o in s){let a=s[o];r[o]=new Jq(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){nH===!1&&Kle(),r=Math.round(r);let a=r*2+1,l=uo(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Ti(a,a,null,{willReadFrequently:tH}));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=Rr(),k0(f,e),ag(f,t*(this.renderBuffer_+r),f));let p=Qle(r),x;function v(L,D,F){let N=u.getImageData(0,0,a,a).data;for(let B=0,z=p.length;B<z;B++)if(N[p[B]]>0){if(!o||F==="none"||x!=="Image"&&x!=="Text"||o.includes(L)){let V=(p[B]-3)/4,H=r-V%a,Z=r-(V/a|0),J=s(L,D,H*H+Z*Z);if(J)return J}u.clearRect(0,0,a,a);break}}let w=Object.keys(this.executorsByZIndex_).map(Number);w.sort(ka);let S,T,P,R,C;for(S=w.length-1;S>=0;--S){let L=w[S].toString();for(P=this.executorsByZIndex_[L],T=kd.length-1;T>=0;--T)if(x=kd[T],R=P[x],R!==void 0&&(C=R.executeHitDetection(u,l,n,v,f),C))return C}}getClipCoords(e){let t=this.maxExtent_;if(!t)return null;let n=t[0],r=t[1],s=t[2],o=t[3],a=[n,r,n,o,s,o,s,r];return Ga(a,0,8,2,e,a),a}isEmpty(){return Mc(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?DG:ka),o=o||kd;let c=kd.length;for(let u=0,f=l.length;u<f;++u){let p=l[u].toString(),x=this.executorsByZIndex_[p];for(let v=0,w=o.length;v<w;++v){let S=o[v],T=x[S];if(T!==void 0){let P=a===null?void 0:T.getZIndexContext(),R=P?P.getContext():e,C=this.maxExtent_&&S!=="Image"&&S!=="Text";if(C&&(R.save(),this.clip(R,n)),!P||S==="Text"||S==="Image"?T.execute(R,t,n,r,s,a):P.pushFunction(L=>T.execute(L,t,n,r,s,a)),C&&R.restore(),P){P.offset();let L=l[u]*c+kd.indexOf(S);this.deferredZIndexContexts_[L]||(this.deferredZIndexContexts_[L]=[]),this.deferredZIndexContexts_[L].push(P)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(ka);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}},lN={};function Qle(i){if(lN[i]!==void 0)return lN[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 lN[i]=r,r}var iH=cN;var hN=class extends GS{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?G0(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=Zs()}drawImages_(e,t,n,r){if(!this.image_)return;let s=Ga(e,t,n,r,this.transform_,this.pixelCoordinates_),o=this.context_,a=this.tmpLocalTransform_,l=o.globalAlpha;this.imageOpacity_!=1&&(o.globalAlpha=l*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let u=0,f=s.length;u<f;u+=2){let p=s[u]-this.imageAnchorX_,x=s[u+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let v=p+this.imageAnchorX_,w=x+this.imageAnchorY_;uo(a,v,w,1,1,c,-v,-w),o.save(),o.transform.apply(o,a),o.translate(v,w),o.scale(this.imageScale_[0],this.imageScale_[1]),o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),o.restore()}else o.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,p,x,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(o.globalAlpha=l)}drawText_(e,t,n,r){if(!this.textState_||this.text_==="")return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let s=Ga(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=Ga(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=zS(l,0,u,2,o,f,l),VS(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_)),!!xr(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=Ez(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_)),!!xr(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(xr(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_)),!!xr(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_)),!!xr(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),Lo(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){let t=this.context_,n=this.contextTextState_,r=e.textAlign?e.textAlign:Nd;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=r&&(n.textAlign=r,t.textAlign=r),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{let n=e.getColor();this.fillState_={fillStyle:za(n||Bs)}}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||Va,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:Ru,lineDash:this.pixelRatio_===1?u:u.map(p=>p*this.pixelRatio_),lineDashOffset:(o||qa)*this.pixelRatio_,lineJoin:a!==void 0?a:Pu,lineWidth:(l!==void 0?l:cf)*this.pixelRatio_,miterLimit:c!==void 0?c:af,strokeStyle:za(n||Fo),strokeOffset:(f??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),s=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=s[0],this.imageOriginY_=s[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let o=e.getScaleArray();this.imageScale_=[o[0]*this.pixelRatio_/n,o[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_="";else{let t=e.getFill();if(!t)this.textFillState_=null;else{let x=t.getColor();this.textFillState_={fillStyle:za(x||Bs)}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let x=n.getColor(),v=n.getLineCap(),w=n.getLineDash(),S=n.getLineDashOffset(),T=n.getLineJoin(),P=n.getWidth(),R=n.getMiterLimit();this.textStrokeState_={lineCap:v!==void 0?v:Ru,lineDash:w||Va,lineDashOffset:S||qa,lineJoin:T!==void 0?T:Pu,lineWidth:P!==void 0?P:cf,miterLimit:R!==void 0?R:af,strokeStyle:za(x||Fo)}}let r=e.getFont(),s=e.getOffsetX(),o=e.getOffsetY(),a=e.getRotateWithView(),l=e.getRotation(),c=e.getScaleArray(),u=e.getText(),f=e.getTextAlign(),p=e.getTextBaseline();this.textState_={font:r!==void 0?r:iS,textAlign:f!==void 0?f:Nd,textBaseline:p!==void 0?p:eA},this.text_=u!==void 0?Array.isArray(u)?u.reduce((x,v,w)=>x+=w%2?" ":v,""):u:"",this.textOffsetX_=s!==void 0?this.pixelRatio_*s:0,this.textOffsetY_=o!==void 0?this.pixelRatio_*o:0,this.textRotateWithView_=a!==void 0?a:!1,this.textRotation_=l!==void 0?l:0,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}},rH=hN;var Gc=.5;function sH(i,e,t,n,r,s,o,a,l){let c=l?xd(r,l):r,u=i[0]*Gc,f=i[1]*Gc,p=Ti(u,f);p.imageSmoothingEnabled=!1;let x=p.canvas,v=new rH(p,Gc,r,null,o,a,l?q0(W0(),l):null),w=t.length,S=Math.floor((256*256*256-1)/w),T={};for(let R=1;R<=w;++R){let C=t[R-1],L=C.getStyleFunction()||n;if(!L)continue;let D=L(C,s);if(!D)continue;Array.isArray(D)||(D=[D]);let N=(R*S).toString(16).padStart(7,"#00000");for(let B=0,z=D.length;B<z;++B){let V=D[B],H=V.getGeometryFunction()(C);if(!H||!xr(c,H.getExtent()))continue;let Z=V.clone(),J=Z.getFill();J&&J.setColor(N);let j=Z.getStroke();j&&(j.setColor(N),j.setLineDash(null)),Z.setText(void 0);let K=V.getImage();if(K){let de=K.getImageSize();if(!de)continue;let ve=Ti(de[0],de[1],void 0,{alpha:!1}),Ie=ve.canvas;ve.fillStyle=N,ve.fillRect(0,0,Ie.width,Ie.height),Z.setImage(new tA({img:Ie,anchor:K.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:K.getOrigin(),opacity:1,size:K.getSize(),scale:K.getScale(),rotation:K.getRotation(),rotateWithView:K.getRotateWithView()}))}let ee=Z.getZIndex()||0,ae=T[ee];ae||(ae={},T[ee]=ae,ae.Polygon=[],ae.Circle=[],ae.LineString=[],ae.Point=[]);let ce=H.getType();if(ce==="GeometryCollection"){let de=H.getGeometriesArrayRecursive();for(let ve=0,Ie=de.length;ve<Ie;++ve){let Qe=de[ve];ae[Qe.getType().replace("Multi","")].push(Qe,Z)}}else ae[ce.replace("Multi","")].push(H,Z)}}let P=Object.keys(T).map(Number).sort(ka);for(let R=0,C=P.length;R<C;++R){let L=T[P[R]];for(let D in L){let F=L[D];for(let N=0,B=F.length;N<B;N+=2){v.setStyle(F[N+1]);for(let z=0,V=e.length;z<V;++z)v.setTransform(e[z]),v.drawGeometry(F[N])}}}return p.getImageData(0,0,x.width,x.height)}function oH(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Gc),s=Math.floor(Math.round(i[1])*Gc),o=(xi(r,0,t.width-1)+xi(s,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],u=t.data[o+2]+256*(l+256*a),f=Math.floor((256*256*256-1)/e.length);u&&u%f===0&&n.push(e[u/f-1])}return n}var Jle=.5,aH={Point:oce,LineString:ice,Polygon:lce,MultiPoint:ace,MultiLineString:rce,MultiPolygon:sce,GeometryCollection:nce,Circle:ece};function lH(i,e){return parseInt(Ln(i),10)-parseInt(Ln(e),10)}function fN(i,e){let t=dN(i,e);return t*t}function dN(i,e){return Jle*i/e}function ece(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 pN(i,e,t,n,r,s,o,a){let l=[],c=t.getImage();if(c){let p=!0,x=c.getImageState();x==Mn.LOADED||x==Mn.ERROR?p=!1:x==Mn.IDLE&&c.load(),p&&l.push(c.ready())}let u=t.getFill();u&&u.loading()&&l.push(u.ready());let f=l.length>0;return f&&Promise.all(l).then(()=>r(null)),tce(i,e,t,n,s,o,a),f}function tce(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())cH(i,l,t,e,o);else{let u=aH[l.getType()];u(i,l,t,e,o,s)}}function cH(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)cH(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function nce(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=aH[o[a].getType()];c(i,o[a],t,n,r,s)}}function ice(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 rce(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 sce(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 oce(i,e,t,n,r,s){let o=t.getImage(),a=t.getText(),l=a&&a.getText(),c=s&&o&&l?{}:void 0;if(o){if(o.getImageState()!=Mn.LOADED)return;let u=i.getBuilder(t.getZIndex(),"Image");u.setImageStyle(o,c),u.drawPoint(e,n,r)}if(l){let u=i.getBuilder(t.getZIndex(),"Text");u.setTextStyle(a,c),u.drawText(e,n,r)}}function ace(i,e,t,n,r,s){let o=t.getImage(),a=o&&o.getOpacity()!==0,l=t.getText(),c=l&&l.getText(),u=s&&a&&c?{}:void 0;if(a){if(o.getImageState()!=Mn.LOADED)return;let f=i.getBuilder(t.getZIndex(),"Image");f.setImageStyle(o,u),f.drawMultiPoint(e,n,r)}if(c){let f=i.getBuilder(t.getZIndex(),"Text");f.setTextStyle(l,u),f.drawText(e,n,r)}}function lce(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 AN=class extends kS{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_=Rr(),this.wrappedRenderedExtent_=Rr(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,n){let r=t.extent,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,c=s.rotation,u=l.getExtent(),f=this.getLayer().getSource(),p=this.getLayer().getDeclutter(),x=t.pixelRatio,v=t.viewHints,w=!(v[ks.ANIMATING]||v[ks.INTERACTING]),S=this.context,T=Math.round(jn(r)/a*x),P=Math.round(_r(r)/a*x),R=f.getWrapX()&&l.canWrapX(),C=R?jn(u):null,L=R?Math.ceil((r[2]-u[2])/C)+(this.extendX_?2:1):1,D=R?Math.floor((r[0]-u[0])/C)-(this.extendX_?1:0):0;do{let F=this.getRenderTransform(o,a,0,x,T,P,D*C);t.declutter&&(F=F.slice(0)),e.execute(S,[S.canvas.width,S.canvas.height],F,c,w,n===void 0?kd:n?uN:eH,n?p&&t.declutter[p]:void 0)}while(++D<L)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Ti(this.context.canvas.width,this.context.canvas.height,V5))}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,$0(this.context),V5.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(po.PRERENDER)||this.getLayer().hasListener(po.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=Pc(n.extent,l);a=xr(u,e.extent),a&&!_u(u,e.extent)&&(e.declutter?this.clipExtent_=u:(this.clipUnrotated(s,e,u),c=!0))}return a&&this.renderWorlds(o,e,this.getLayer().getDeclutter()?!1:void 0),c&&s.restore(),this.postRender(s,e),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let n=this.frameState.size.slice(),r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),u=[],f=n[0]*Gc,p=n[1]*Gc;u.push(this.getRenderTransform(r,s,o,Gc,f,p,0).slice());let x=c.getSource(),v=a.getExtent();if(x.getWrapX()&&a.canWrapX()&&!_u(v,l)){let S=l[0],T=jn(v),P=0,R;for(;S<v[0];)--P,R=T*P,u.push(this.getRenderTransform(r,s,o,Gc,f,p,R).slice()),S+=T;for(P=0,S=l[2];S>v[2];)++P,R=T*P,u.push(this.getRenderTransform(r,s,o,Gc,f,p,R).slice()),S-=T}let w=W0();this.hitDetectionImageData_=sH(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,fN(s,this.renderedPixelRatio_),w?a:null)}t(oH(e,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(e,t,n,r,s){if(!this.replayGroup_)return;let o=t.viewState.resolution,a=t.viewState.rotation,l=this.getLayer(),c={},u=function(p,x,v){let w=Ln(p),S=c[w];if(S){if(S!==!0&&v<S.distanceSq){if(v===0)return c[w]=!0,s.splice(s.lastIndexOf(S),1),r(p,l,x);S.geometry=x,S.distanceSq=v}}else{if(v===0)return c[w]=!0,r(p,l,x);s.push(c[w]={feature:p,layer:l,geometry:x,distanceSq:v,callback:r})}},f=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(e,o,a,n,u,f?t.declutter?.[f]?.all().map(p=>p.value):null)}handleFontsChanged(){let e=this.getLayer();e.getVisible()&&this.replayGroup_&&e.changed()}handleStyleImageChange_(e){this.renderIfReadyAndVisible()}prepareFrame(e){let t=this.getLayer(),n=t.getSource();if(!n)return!1;let r=e.viewHints[ks.ANIMATING],s=e.viewHints[ks.INTERACTING],o=t.getUpdateWhileAnimating(),a=t.getUpdateWhileInteracting();if(this.ready&&!o&&r||!a&&s)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;let l=e.extent,c=e.viewState,u=c.projection,f=c.resolution,p=e.pixelRatio,x=t.getRevision(),v=t.getRenderBuffer(),w=t.getRenderOrder();w===void 0&&(w=lH);let S=c.center.slice(),T=ag(l,v*f),P=T.slice(),R=[T.slice()],C=u.getExtent(),L=n.getWrapX()&&u.canWrapX();if(this.extendX_=!1,L){let K=n.getExtent();K&&!yu(K)&&(this.extendX_=K[0]<C[0]||K[2]>C[2])}if(L&&(!_u(C,e.extent)||this.extendX_)){let K=jn(C),ee=Math.max(jn(T)/2,K),ae=C[0],ce=C[2];this.extendX_&&(ae-=K,ce+=K),T[0]=ae-ee,T[2]=ce+ee,mw(S,u);let de=nP(R[0],u);de[0]<C[0]&&de[2]<C[2]?R.push([de[0]+K,de[1],de[2]+K,de[3]]):de[0]>C[0]&&de[2]>C[2]&&R.push([de[0]-K,de[1],de[2]-K,de[3]])}if(this.ready&&this.renderedResolution_==f&&this.renderedPixelRatio_===p&&this.renderedRevision_==x&&this.renderedRenderOrder_==w&&this.renderedFrameDeclutter_===!!e.declutter&&_u(this.wrappedRenderedExtent_,T))return Lo(this.renderedExtent_,P)||(this.hitDetectionImageData_=null,this.renderedExtent_=P),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new $q(dN(f,p),T,f,p),F=W0(),N;if(F){for(let K=0,ee=R.length;K<ee;++K){let ae=R[K],ce=xd(ae,u);n.loadFeatures(ce,IG(f,u),F)}N=q0(F,u)}else for(let K=0,ee=R.length;K<ee;++K)n.loadFeatures(R[K],f,u);let B=fN(f,p),z=!0,V=(K,ee)=>{let ae,ce=K.getStyleFunction()||t.getStyleFunction();if(ce&&(ae=ce(K,f)),ae){let de=this.renderFeature(K,B,ae,D,N,this.getLayer().getDeclutter(),ee);z=z&&!de}},H=xd(T,u),Z=n.getFeaturesInExtent(H);w&&Z.sort(w);for(let K=0,ee=Z.length;K<ee;++K)V(Z[K],K);this.renderedFeatures_=Z,this.ready=z;let J=D.finish(),j=new iH(T,f,p,n.getOverlaps(),J,t.getRenderBuffer(),!!e.declutter);return this.renderedResolution_=f,this.renderedRevision_=x,this.renderedRenderOrder_=w,this.renderedFrameDeclutter_=!!e.declutter,this.renderedExtent_=P,this.wrappedRenderedExtent_=T,this.renderedCenter_=S,this.renderedProjection_=u,this.renderedPixelRatio_=p,this.replayGroup_=j,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(e,t,n,r,s,o,a){if(!n)return!1;let l=!1;if(Array.isArray(n))for(let c=0,u=n.length;c<u;++c)l=pN(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=pN(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},uH=AN;var mN=class extends FS{constructor(e){super(e)}createRenderer(){return new uH(this)}},hH=mN;var cce=!1;function uce(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=cce,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 gN(i,e){return function(t,n,r,s,o){uce(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function fH(i,e){return[[-1/0,-1/0,1/0,1/0]]}function _N(i,e,t,n,r,s,o){let a,l,c=(t-e)/n;if(c===1)a=e;else if(c===2)a=e,l=r;else if(c!==0){let u=i[e],f=i[e+1],p=0,x=[0];for(let S=e+n;S<t;S+=n){let T=i[S],P=i[S+1];p+=Math.sqrt((T-u)*(T-u)+(P-f)*(P-f)),x.push(p),u=T,f=P}let v=r*p,w=LG(x,v);w<0?(l=(v-x[-w-2])/(x[-w-1]-x[-w-2]),a=e+(-w-2)*n):a=e+w*n}o=o>1?o:2,s=s||new Array(o);for(let u=0;u<o;++u)s[u]=a===void 0?NaN:l===void 0?i[a+u]:No(i[a+u],i[a+n+u],l);return s}var dH=Zs(),ly=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"?cw(this.flatCoordinates_):lg(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=Ua(this.getExtent());this.flatInteriorPoints_=Px(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=Bz(this.flatCoordinates_,this.ends_),t=lS(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=Vw(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=_N(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=_N(e,t,o,this.stride_,.5);Ic(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=xs(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=_r(n)/_r(t);uo(dH,n[0],n[3],r,-r,0,0,0),Ga(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,dH,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=Rw((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=Cx(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=Lz(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=Rx(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}};ly.prototype.getFlatCoordinates=ly.prototype.getOrientedFlatCoordinates;var cA=ly;var xN=class{constructor(e){this.rbush_=new oA(e),this.items_={}}insert(e,t){let n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[Ln(t)]=n}load(e,t){let n=new Array(t.length);for(let r=0,s=t.length;r<s;r++){let o=e[r],a=t[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};n[r]=l,this.items_[Ln(a)]=l}this.rbush_.load(n)}remove(e){let t=Ln(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Ln(t)],r=[n.minX,n.minY,n.maxX,n.maxY];U0(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 Mc(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return hl(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]}},yN=xN;var pl={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Bu=class extends Ys{constructor(e,t,n){super(e),this.feature=t,this.features=n}},vN=class extends Uw{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_=nf,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(Vn(this.format_,"`format` must be set when `url` is set"),this.loader_=gN(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:fH;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new yN:null,this.loadedExtentsRtree_=new yN,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 ho(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Ln(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let n=e.getGeometry();if(n){let r=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new Bu(pl.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof cA||(this.featureChangeKeys_[e]=[kn(t,Jt.CHANGE,this.handleFeatureChange_,this),kn(t,Nc.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 cA){let s=this.idIndex_[r];s instanceof cA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(Vn(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],n=[],r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s],l=Ln(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Ln(a);this.setupChangeEvents_(l,a);let c=a.getGeometry();if(c){let u=c.getExtent();t.push(u),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener(pl.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Bu(pl.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(pl.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(pl.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(Qs.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(Qs.REMOVE,n=>{t||(t=!0,this.removeFeature(n.element),t=!1)}),this.featuresCollection_=e}clear(e){if(e){for(let n in this.featureChangeKeys_)this.featureChangeKeys_[n].forEach(ri);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(n=>{this.removeFeatureInternal(n)});for(let n in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[n])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new Bu(pl.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 cA||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 cA||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(),Mc(this.nullGeometryFeatures_)||Ic(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=fw(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||ef,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof cA?0:u.closestPointXY(n,r,o,a),a<f){s=c;let p=Math.sqrt(a);l[0]=n-p,l[1]=r-p,l[2]=n+p,l[3]=r+p}}}),s}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){let t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){let t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,n=Ln(t),r=t.getGeometry();if(!r)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{let o=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}let s=t.getId();if(s!==void 0){let o=s.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new Bu(pl.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();if(t!==void 0){let n=this.idIndex_[String(t)];return Array.isArray(n)?n.includes(e):n===e}return Ln(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&Mc(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 _u(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Bu(pl.FEATURESLOADSTART));let u=v=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Bu(pl.FEATURESLOADEND,void 0,v))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Bu(pl.FEATURESLOADERROR))},p=!1,x=this.loader_.call(this,l,t,n,v=>p||u(v),()=>p||f());x instanceof Promise?(p=!0,x.then(v=>{this.addFeatures(v),u(v)}).catch(f)):this.loader_.length<4&&(this.loading=!1),r.insert(l,{extent:l.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=[];t.forEachInExtent(e,function(r){n.push(r)}),n.forEach(r=>{t.remove(r);let s=tP(r.extent,e);for(let o of s)t.insert(o,{extent:o})})}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=Ln(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(ri),delete this.featureChangeKeys_[t];let r=e.getId();if(r!==void 0){let s=r.toString(),o=this.idIndex_[s];o===e?delete this.idIndex_[s]:Array.isArray(o)&&(o.splice(o.indexOf(e),1),o.length===1&&(this.idIndex_[s]=o[0]))}return delete this.uidIndex_[t],this.hasListener(pl.REMOVEFEATURE)&&this.dispatchEvent(new Bu(pl.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(let t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){Vn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(gN(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},xf=vN;var ga={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},sp={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},$T=0,n2=1,YT=2;var cL=0,op=1,ZT=2,nc=3,go=0,hi=1,rr=2,Yr=0,os=1,Wu=2,ju=3,Xu=4,Bf=5,i2=6,Gs=100,r2=101,s2=102,KT=103,QT=104,jc=200,o2=201,a2=202,l2=203,Xd=204,$d=205,c2=206,u2=207,h2=208,f2=209,d2=210,nW=211,iW=212,rW=213,sW=214,pA=0,AA=1,mA=2,Gu=3,gA=4,_A=5,xA=6,yA=7,BA=0,JT=1,e3=2,zs=0,p2=1,A2=2,m2=3,g2=4,uL=5,_2=6,x2=7;var y2=300,vl=301,ic=302,ap=303,lp=304,$u=306,Rf=1e3,Go=1001,Pf=1002,yi=1003,v2=1004;var rc=1005;var bi=1006,cp=1007;var xo=1008,hL=1008,zi=1009,Yu=1010,Zu=1011,Xa=1012,Dr=1013,Ai=1014,Zi=1015,Di=1016,UA=1017,kA=1018,Vo=1020,GA=35902,zA=35899,P_=1021,Uf=1022,br=1023,ws=1026,eo=1027,kf=1028,Ku=1029,Ms=1030,Qu=1031,b2=1032,up=1033,Ju=33776,eh=33777,th=33778,nh=33779,VA=35840,qA=35841,HA=35842,WA=35843,hp=36196,fp=37492,dp=37496,pp=37488,Ap=37489,ih=37490,mp=37491,gp=37808,_p=37809,xp=37810,yp=37811,vp=37812,bp=37813,wp=37814,Sp=37815,Tp=37816,Ep=37817,Mp=37818,Cp=37819,Rp=37820,Pp=37821,Ip=36492,Np=36494,Lp=36495,Dp=36283,Fp=36284,rh=36285,Op=36286;var by=2300,bT=2301,yT=2302,ZN=2303,KN=2400,QN=2401,JN=2402;var fL=0,dL=1,t3=2,oW=3200;var bl=0,n3=1,qo="",yr="srgb",Yd="srgb-linear",Zd="linear",Bt="srgb",w2="",i3="rg",pL="ga",AL=0,Tf=7680,mL=7681,gL=7682,_L=7683,xL=34055,yL=34056,vL=5386,bL=512,wL=513,SL=514,TL=515,EL=516,ML=517,CL=518,wy=519,S2=512,I_=513,T2=514,sh=515,jA=516,E2=517,Xc=518,M2=519,Kd=35044,XA=35048;var RL="300 es",mo=2e3,Ha=2001,sc={COMPUTE:"compute",RENDER:"render"};var Gf={TEXTURE_COMPARE:"depthTextureCompare"};function hce(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function N_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function p_(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function r3(){let i=p_("canvas");return i.style.display="block",i}var pH={},A_=null;function vA(...i){let e="THREE."+i.shift();A_?A_("log",e,...i):console.log(e,...i)}function aW(i){let e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function je(...i){i=aW(i);let e="THREE."+i.shift();if(A_)A_("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function Ge(...i){i=aW(i);let e="THREE."+i.shift();if(A_)A_("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function Kn(...i){let e=i.join(" ");e in pH||(pH[e]=!0,je(...i))}function PL(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function lW(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 C2={[pA]:AA,[mA]:xA,[gA]:yA,[Gu]:_A,[AA]:pA,[xA]:mA,[yA]:gA,[_A]:Gu},zo=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}}},Uo=["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"],AH=1234567,_y=Math.PI/180,If=180/Math.PI;function ku(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Uo[i&255]+Uo[i>>8&255]+Uo[i>>16&255]+Uo[i>>24&255]+"-"+Uo[e&255]+Uo[e>>8&255]+"-"+Uo[e>>16&15|64]+Uo[e>>24&255]+"-"+Uo[t&63|128]+Uo[t>>8&255]+"-"+Uo[t>>16&255]+Uo[t>>24&255]+Uo[n&255]+Uo[n>>8&255]+Uo[n>>16&255]+Uo[n>>24&255]).toLowerCase()}function In(i,e,t){return Math.max(e,Math.min(t,i))}function IL(i,e){return(i%e+e)%e}function fce(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function dce(i,e,t){return i!==e?(t-i)/(e-i):0}function xy(i,e,t){return(1-t)*i+t*e}function pce(i,e,t,n){return xy(i,e,1-Math.exp(-t*n))}function Ace(i,e=1){return e-Math.abs(IL(i,e*2)-e)}function mce(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function gce(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function _ce(i,e){return i+Math.floor(Math.random()*(e-i+1))}function xce(i,e){return i+Math.random()*(e-i)}function yce(i){return i*(.5-Math.random())}function vce(i){i!==void 0&&(AH=i);let e=AH+=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 bce(i){return i*_y}function wce(i){return i*If}function Sce(i){return(i&i-1)===0&&i!==0}function Tce(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function Ece(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function Mce(i,e,t,n,r){let s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),f=s((e-n)/2),p=o((e-n)/2),x=s((n-e)/2),v=o((n-e)/2);switch(r){case"XYX":i.set(a*u,l*f,l*p,a*c);break;case"YZY":i.set(l*p,a*u,l*f,a*c);break;case"ZXZ":i.set(l*f,l*p,a*u,a*c);break;case"XZX":i.set(a*u,l*v,l*x,a*c);break;case"YXY":i.set(l*x,a*u,l*v,a*c);break;case"ZYZ":i.set(l*v,l*x,a*u,a*c);break;default:je("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function ca(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function Wn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var $c={DEG2RAD:_y,RAD2DEG:If,generateUUID:ku,clamp:In,euclideanModulo:IL,mapLinear:fce,inverseLerp:dce,lerp:xy,damp:pce,pingpong:Ace,smoothstep:mce,smootherstep:gce,randInt:_ce,randFloat:xce,randFloatSpread:yce,seededRandom:vce,degToRad:bce,radToDeg:wce,isPowerOfTwo:Sce,ceilPowerOfTwo:Tce,floorPowerOfTwo:Ece,setQuaternionFromProperEuler:Mce,normalize:Wn,denormalize:ca},OL=class OL{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(In(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};OL.prototype.isVector2=!0;var Oe=OL,Ss=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,s,o,a){let l=n[r+0],c=n[r+1],u=n[r+2],f=n[r+3],p=s[o+0],x=s[o+1],v=s[o+2],w=s[o+3];if(f!==w||l!==p||c!==x||u!==v){let S=l*p+c*x+u*v+f*w;S<0&&(p=-p,x=-x,v=-v,w=-w,S=-S);let T=1-a;if(S<.9995){let P=Math.acos(S),R=Math.sin(P);T=Math.sin(T*P)/R,a=Math.sin(a*P)/R,l=l*T+p*a,c=c*T+x*a,u=u*T+v*a,f=f*T+w*a}else{l=l*T+p*a,c=c*T+x*a,u=u*T+v*a,f=f*T+w*a;let P=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=P,c*=P,u*=P,f*=P}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,r,s,o){let a=n[r],l=n[r+1],c=n[r+2],u=n[r+3],f=s[o],p=s[o+1],x=s[o+2],v=s[o+3];return e[t]=a*v+u*f+l*x-c*p,e[t+1]=l*v+u*p+c*f-a*x,e[t+2]=c*v+u*x+a*p-l*f,e[t+3]=u*v-a*f-l*p-c*x,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(r/2),f=a(s/2),p=l(n/2),x=l(r/2),v=l(s/2);switch(o){case"XYZ":this._x=p*u*f+c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f-p*x*v;break;case"YXZ":this._x=p*u*f+c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f+p*x*v;break;case"ZXY":this._x=p*u*f-c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f-p*x*v;break;case"ZYX":this._x=p*u*f-c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f+p*x*v;break;case"YZX":this._x=p*u*f+c*x*v,this._y=c*x*f+p*u*v,this._z=c*u*v-p*x*f,this._w=c*u*f-p*x*v;break;case"XZY":this._x=p*u*f-c*x*v,this._y=c*x*f-p*u*v,this._z=c*u*v+p*x*f,this._w=c*u*f+p*x*v;break;default:je("Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],p=n+a+f;if(p>0){let x=.5/Math.sqrt(p+1);this._w=.25/x,this._x=(u-l)*x,this._y=(s-c)*x,this._z=(o-r)*x}else if(n>a&&n>f){let x=2*Math.sqrt(1+n-a-f);this._w=(u-l)/x,this._x=.25*x,this._y=(r+o)/x,this._z=(s+c)/x}else if(a>f){let x=2*Math.sqrt(1+a-n-f);this._w=(s-c)/x,this._x=(r+o)/x,this._y=.25*x,this._z=(l+u)/x}else{let x=2*Math.sqrt(1+f-n-a);this._w=(o-r)/x,this._x=(s+c)/x,this._y=(l+u)/x,this._z=.25*x}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(In(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){let c=Math.acos(a),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},BL=class BL{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(mH.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(mH.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),f=2*(s*n-o*t);return this.x=t+l*c+o*f-a*u,this.y=n+l*u+a*c-s*f,this.z=r+l*f+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this.z=In(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this.z=In(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return bN.copy(this).projectOnVector(e),this.sub(bN)}reflect(e){return this.sub(bN.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(In(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};BL.prototype.isVector3=!0;var ie=BL,bN=new ie,mH=new Ss,UL=class UL{constructor(e,t,n,r,s,o,a,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c)}set(e,t,n,r,s,o,a,l,c){let u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],f=n[7],p=n[2],x=n[5],v=n[8],w=r[0],S=r[3],T=r[6],P=r[1],R=r[4],C=r[7],L=r[2],D=r[5],F=r[8];return s[0]=o*w+a*P+l*L,s[3]=o*S+a*R+l*D,s[6]=o*T+a*C+l*F,s[1]=c*w+u*P+f*L,s[4]=c*S+u*R+f*D,s[7]=c*T+u*C+f*F,s[2]=p*w+x*P+v*L,s[5]=p*S+x*R+v*D,s[8]=p*T+x*C+v*F,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+r*s*c-r*o*l}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,p=a*l-u*s,x=c*s-o*l,v=t*f+n*p+r*x;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);let w=1/v;return e[0]=f*w,e[1]=(r*c-u*n)*w,e[2]=(a*n-r*o)*w,e[3]=p*w,e[4]=(u*t-r*l)*w,e[5]=(r*s-a*t)*w,e[6]=x*w,e[7]=(n*l-c*t)*w,e[8]=(o*t-n*s)*w,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,s,o,a){let l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return Kn("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(wN.makeScale(e,t)),this}rotate(e){return Kn("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(wN.makeRotation(-e)),this}translate(e,t){return Kn("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(wN.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)}};UL.prototype.isMatrix3=!0;var Sn=UL,wN=new Sn,gH=new Sn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),_H=new Sn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Cce(){let i={enabled:!0,workingColorSpace:Yd,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Bt&&(r.r=Cf(r.r),r.g=Cf(r.g),r.b=Cf(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Bt&&(r.r=d_(r.r),r.g=d_(r.g),r.b=d_(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===qo?Zd:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Kn("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Kn("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Yd]:{primaries:e,whitePoint:n,transfer:Zd,toXYZ:gH,fromXYZ:_H,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:yr},outputColorSpaceConfig:{drawingBufferColorSpace:yr}},[yr]:{primaries:e,whitePoint:n,transfer:Bt,toXYZ:gH,fromXYZ:_H,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:yr}}}),i}var sn=Cce();function Cf(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function d_(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var $g,wT=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{$g===void 0&&($g=p_("canvas")),$g.width=e.width,$g.height=e.height;let r=$g.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=$g}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=p_("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]=Cf(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(Cf(t[n]/255)*255):t[n]=Cf(t[n]);return{data:t,width:e.width,height:e.height}}else return je("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},Rce=0,m_=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Rce++}),this.uuid=ku(),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(SN(r[o].image)):s.push(SN(r[o]))}else s=SN(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function SN(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?wT.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(je("Texture: Unable to serialize Texture."),{})}var Pce=0,TN=new ie,Ts=class i extends zo{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=Go,r=Go,s=bi,o=xo,a=br,l=zi,c=i.DEFAULT_ANISOTROPY,u=qo){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Pce++}),this.uuid=ku(),this.name="",this.source=new m_(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Oe(0,0),this.repeat=new Oe(1,1),this.center=new Oe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Sn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(TN).x}get height(){return this.source.getSize(TN).y}get depth(){return this.source.getSize(TN).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){je(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){je(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==y2)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Rf:e.x=e.x-Math.floor(e.x);break;case Go:e.x=e.x<0?0:1;break;case Pf: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 Rf:e.y=e.y-Math.floor(e.y);break;case Go:e.y=e.y<0?0:1;break;case Pf: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++}};Ts.DEFAULT_IMAGE=null;Ts.DEFAULT_MAPPING=y2;Ts.DEFAULT_ANISOTROPY=1;var kL=class kL{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*r+o[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,s,l=e.elements,c=l[0],u=l[4],f=l[8],p=l[1],x=l[5],v=l[9],w=l[2],S=l[6],T=l[10];if(Math.abs(u-p)<.01&&Math.abs(f-w)<.01&&Math.abs(v-S)<.01){if(Math.abs(u+p)<.1&&Math.abs(f+w)<.1&&Math.abs(v+S)<.1&&Math.abs(c+x+T-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let R=(c+1)/2,C=(x+1)/2,L=(T+1)/2,D=(u+p)/4,F=(f+w)/4,N=(v+S)/4;return R>C&&R>L?R<.01?(n=0,r=.707106781,s=.707106781):(n=Math.sqrt(R),r=D/n,s=F/n):C>L?C<.01?(n=.707106781,r=0,s=.707106781):(r=Math.sqrt(C),n=D/r,s=N/r):L<.01?(n=.707106781,r=.707106781,s=0):(s=Math.sqrt(L),n=F/s,r=N/s),this.set(n,r,s,t),this}let P=Math.sqrt((S-v)*(S-v)+(f-w)*(f-w)+(p-u)*(p-u));return Math.abs(P)<.001&&(P=1),this.x=(S-v)/P,this.y=(f-w)/P,this.z=(p-u)/P,this.w=Math.acos((c+x+T-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=In(this.x,e.x,t.x),this.y=In(this.y,e.y,t.y),this.z=In(this.z,e.z,t.z),this.w=In(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=In(this.x,e,t),this.y=In(this.y,e,t),this.z=In(this.z,e,t),this.w=In(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(In(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};kL.prototype.isVector4=!0;var gn=kL,ua=class extends zo{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:bi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new gn(0,0,e,t),this.scissorTest=!1,this.viewport=new gn(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},s=new Ts(r),o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:bi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let r=Object.assign({},e.textures[t].image);this.textures[t].source=new m_(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"})}},ha=class extends ua{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},bA=class extends Ts{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=yi,this.minFilter=yi,this.wrapR=Go,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var ST=class extends Ts{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=yi,this.minFilter=yi,this.wrapR=Go,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var XT=class XT{constructor(e,t,n,r,s,o,a,l,c,u,f,p,x,v,w,S){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,r,s,o,a,l,c,u,f,p,x,v,w,S)}set(e,t,n,r,s,o,a,l,c,u,f,p,x,v,w,S){let T=this.elements;return T[0]=e,T[4]=t,T[8]=n,T[12]=r,T[1]=s,T[5]=o,T[9]=a,T[13]=l,T[2]=c,T[6]=u,T[10]=f,T[14]=p,T[3]=x,T[7]=v,T[11]=w,T[15]=S,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new XT().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/Yg.setFromMatrixColumn(e,0).length(),s=1/Yg.setFromMatrixColumn(e,1).length(),o=1/Yg.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){let p=o*u,x=o*f,v=a*u,w=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=x+v*c,t[5]=p-w*c,t[9]=-a*l,t[2]=w-p*c,t[6]=v+x*c,t[10]=o*l}else if(e.order==="YXZ"){let p=l*u,x=l*f,v=c*u,w=c*f;t[0]=p+w*a,t[4]=v*a-x,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=x*a-v,t[6]=w+p*a,t[10]=o*l}else if(e.order==="ZXY"){let p=l*u,x=l*f,v=c*u,w=c*f;t[0]=p-w*a,t[4]=-o*f,t[8]=v+x*a,t[1]=x+v*a,t[5]=o*u,t[9]=w-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){let p=o*u,x=o*f,v=a*u,w=a*f;t[0]=l*u,t[4]=v*c-x,t[8]=p*c+w,t[1]=l*f,t[5]=w*c+p,t[9]=x*c-v,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){let p=o*l,x=o*c,v=a*l,w=a*c;t[0]=l*u,t[4]=w-p*f,t[8]=v*f+x,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=x*f+v,t[10]=p-w*f}else if(e.order==="XZY"){let p=o*l,x=o*c,v=a*l,w=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=p*f+w,t[5]=o*u,t[9]=x*f-v,t[2]=v*f-x,t[6]=a*u,t[10]=w*f+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Ice,e,Nce)}lookAt(e,t,n){let r=this.elements;return Al.subVectors(e,t),Al.lengthSq()===0&&(Al.z=1),Al.normalize(),Gd.crossVectors(n,Al),Gd.lengthSq()===0&&(Math.abs(n.z)===1?Al.x+=1e-4:Al.z+=1e-4,Al.normalize(),Gd.crossVectors(n,Al)),Gd.normalize(),qS.crossVectors(Al,Gd),r[0]=Gd.x,r[4]=qS.x,r[8]=Al.x,r[1]=Gd.y,r[5]=qS.y,r[9]=Al.y,r[2]=Gd.z,r[6]=qS.z,r[10]=Al.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],p=n[9],x=n[13],v=n[2],w=n[6],S=n[10],T=n[14],P=n[3],R=n[7],C=n[11],L=n[15],D=r[0],F=r[4],N=r[8],B=r[12],z=r[1],V=r[5],H=r[9],Z=r[13],J=r[2],j=r[6],K=r[10],ee=r[14],ae=r[3],ce=r[7],de=r[11],ve=r[15];return s[0]=o*D+a*z+l*J+c*ae,s[4]=o*F+a*V+l*j+c*ce,s[8]=o*N+a*H+l*K+c*de,s[12]=o*B+a*Z+l*ee+c*ve,s[1]=u*D+f*z+p*J+x*ae,s[5]=u*F+f*V+p*j+x*ce,s[9]=u*N+f*H+p*K+x*de,s[13]=u*B+f*Z+p*ee+x*ve,s[2]=v*D+w*z+S*J+T*ae,s[6]=v*F+w*V+S*j+T*ce,s[10]=v*N+w*H+S*K+T*de,s[14]=v*B+w*Z+S*ee+T*ve,s[3]=P*D+R*z+C*J+L*ae,s[7]=P*F+R*V+C*j+L*ce,s[11]=P*N+R*H+C*K+L*de,s[15]=P*B+R*Z+C*ee+L*ve,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],p=e[10],x=e[14],v=e[3],w=e[7],S=e[11],T=e[15],P=l*x-c*p,R=a*x-c*f,C=a*p-l*f,L=o*x-c*u,D=o*p-l*u,F=o*f-a*u;return t*(w*P-S*R+T*C)-n*(v*P-S*L+T*D)+r*(v*R-w*L+T*F)-s*(v*C-w*D+S*F)}determinantAffine(){let e=this.elements,t=e[0],n=e[4],r=e[8],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],u=e[10];return t*(o*u-a*c)-n*(s*u-a*l)+r*(s*c-o*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],p=e[10],x=e[11],v=e[12],w=e[13],S=e[14],T=e[15],P=t*a-n*o,R=t*l-r*o,C=t*c-s*o,L=n*l-r*a,D=n*c-s*a,F=r*c-s*l,N=u*w-f*v,B=u*S-p*v,z=u*T-x*v,V=f*S-p*w,H=f*T-x*w,Z=p*T-x*S,J=P*Z-R*H+C*V+L*z-D*B+F*N;if(J===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let j=1/J;return e[0]=(a*Z-l*H+c*V)*j,e[1]=(r*H-n*Z-s*V)*j,e[2]=(w*F-S*D+T*L)*j,e[3]=(p*D-f*F-x*L)*j,e[4]=(l*z-o*Z-c*B)*j,e[5]=(t*Z-r*z+s*B)*j,e[6]=(S*C-v*F-T*R)*j,e[7]=(u*F-p*C+x*R)*j,e[8]=(o*H-a*z+c*N)*j,e[9]=(n*z-t*H-s*N)*j,e[10]=(v*D-w*C+T*P)*j,e[11]=(f*C-u*D-x*P)*j,e[12]=(a*B-o*V-l*N)*j,e[13]=(t*V-n*B+r*N)*j,e[14]=(w*R-v*L-S*P)*j,e[15]=(u*L-f*R+p*P)*j,this}scale(e){let t=this.elements,n=e.x,r=e.y,s=e.z;return t[0]*=n,t[4]*=r,t[8]*=s,t[1]*=n,t[5]*=r,t[9]*=s,t[2]*=n,t[6]*=r,t[10]*=s,t[3]*=n,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+n,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,s,o){return this.set(1,n,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,p=s*c,x=s*u,v=s*f,w=o*u,S=o*f,T=a*f,P=l*c,R=l*u,C=l*f,L=n.x,D=n.y,F=n.z;return r[0]=(1-(w+T))*L,r[1]=(x+C)*L,r[2]=(v-R)*L,r[3]=0,r[4]=(x-C)*D,r[5]=(1-(p+T))*D,r[6]=(S+P)*D,r[7]=0,r[8]=(v+R)*F,r[9]=(S-P)*F,r[10]=(1-(p+w))*F,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];let s=this.determinantAffine();if(s===0)return n.set(1,1,1),t.identity(),this;let o=Yg.set(r[0],r[1],r[2]).length(),a=Yg.set(r[4],r[5],r[6]).length(),l=Yg.set(r[8],r[9],r[10]).length();s<0&&(o=-o),zc.copy(this);let c=1/o,u=1/a,f=1/l;return zc.elements[0]*=c,zc.elements[1]*=c,zc.elements[2]*=c,zc.elements[4]*=u,zc.elements[5]*=u,zc.elements[6]*=u,zc.elements[8]*=f,zc.elements[9]*=f,zc.elements[10]*=f,t.setFromRotationMatrix(zc),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=mo,l=!1){let c=this.elements,u=2*s/(t-e),f=2*s/(n-r),p=(t+e)/(t-e),x=(n+r)/(n-r),v,w;if(l)v=s/(o-s),w=o*s/(o-s);else if(a===mo)v=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===Ha)v=-o/(o-s),w=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=p,c[12]=0,c[1]=0,c[5]=f,c[9]=x,c[13]=0,c[2]=0,c[6]=0,c[10]=v,c[14]=w,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,r,s,o,a=mo,l=!1){let c=this.elements,u=2/(t-e),f=2/(n-r),p=-(t+e)/(t-e),x=-(n+r)/(n-r),v,w;if(l)v=1/(o-s),w=o/(o-s);else if(a===mo)v=-2/(o-s),w=-(o+s)/(o-s);else if(a===Ha)v=-1/(o-s),w=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=u,c[4]=0,c[8]=0,c[12]=p,c[1]=0,c[5]=f,c[9]=0,c[13]=x,c[2]=0,c[6]=0,c[10]=v,c[14]=w,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}};XT.prototype.isMatrix4=!0;var on=XT,Yg=new ie,zc=new on,Ice=new ie(0,0,0),Nce=new ie(1,1,1),Gd=new ie,qS=new ie,Al=new ie,xH=new on,yH=new Ss,fa=class i{constructor(e=0,t=0,n=0,r=i.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],p=r[6],x=r[10];switch(t){case"XYZ":this._y=Math.asin(In(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,x),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-In(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,x),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(In(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,x),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-In(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,x),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(In(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,x));break;case"XZY":this._z=Math.asin(-In(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,x),this._y=0);break;default:je("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return xH.makeRotationFromQuaternion(e),this.setFromRotationMatrix(xH,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return yH.setFromEuler(this),this.setFromQuaternion(yH,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}};fa.DEFAULT_ORDER="XYZ";var g_=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}},Lce=0,vH=new ie,Zg=new Ss,yf=new on,HS=new ie,cy=new ie,Dce=new ie,Fce=new Ss,bH=new ie(1,0,0),wH=new ie(0,1,0),SH=new ie(0,0,1),TH={type:"added"},Oce={type:"removed"},Kg={type:"childadded",child:null},EN={type:"childremoved",child:null},Yi=class i extends zo{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Lce++}),this.uuid=ku(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new ie,t=new fa,n=new Ss,r=new ie(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new on},normalMatrix:{value:new Sn}}),this.matrix=new on,this.matrixWorld=new on,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new g_,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 Zg.setFromAxisAngle(e,t),this.quaternion.multiply(Zg),this}rotateOnWorldAxis(e,t){return Zg.setFromAxisAngle(e,t),this.quaternion.premultiply(Zg),this}rotateX(e){return this.rotateOnAxis(bH,e)}rotateY(e){return this.rotateOnAxis(wH,e)}rotateZ(e){return this.rotateOnAxis(SH,e)}translateOnAxis(e,t){return vH.copy(e).applyQuaternion(this.quaternion),this.position.add(vH.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(bH,e)}translateY(e){return this.translateOnAxis(wH,e)}translateZ(e){return this.translateOnAxis(SH,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(yf.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?HS.copy(e):HS.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),cy.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?yf.lookAt(cy,HS,this.up):yf.lookAt(HS,cy,this.up),this.quaternion.setFromRotationMatrix(yf),r&&(yf.extractRotation(r.matrixWorld),Zg.setFromRotationMatrix(yf),this.quaternion.premultiply(Zg.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Ge("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(TH),Kg.child=e,this.dispatchEvent(Kg),Kg.child=null):Ge("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Oce),EN.child=e,this.dispatchEvent(EN),EN.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),yf.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),yf.multiply(e.parent.matrixWorld)),e.applyMatrix4(yf),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(TH),Kg.child=e,this.dispatchEvent(Kg),Kg.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(cy,e,Dce),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(cy,Fce,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*r,s[13]+=n-s[1]*t-s[5]*n-s[9]*r,s[14]+=r-s[2]*t-s[6]*n-s[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){let r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){let s=this.children;for(let o=0,a=s.length;o<a;o++)s[o].updateWorldMatrix(!1,!0,n)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(a=>({...a})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){let f=l[c];s(e.shapes,f)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){let a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),f=o(e.shapes),p=o(e.skeletons),x=o(e.animations),v=o(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),p.length>0&&(n.skeletons=p),x.length>0&&(n.animations=x),v.length>0&&(n.nodes=v)}return n.object=r,n;function o(a){let l=[];for(let c in a){let u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let r=e.children[n];this.add(r.clone())}return this}};Yi.DEFAULT_UP=new ie(0,1,0);Yi.DEFAULT_MATRIX_AUTO_UPDATE=!0;Yi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var vr=class extends Yi{constructor(){super(),this.isGroup=!0,this.type="Group"}},Bce={type:"move"},Qd=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new vr,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 vr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ie,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ie),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new vr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ie,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ie,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(let w of e.hand.values()){let S=t.getJointPose(w,n),T=this._getHandJoint(c,w);S!==null&&(T.matrix.fromArray(S.transform.matrix),T.matrix.decompose(T.position,T.rotation,T.scale),T.matrixWorldNeedsUpdate=!0,T.jointRadius=S.radius),T.visible=S!==null}let u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=u.position.distanceTo(f.position),x=.02,v=.005;c.inputState.pinching&&p>x+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=x-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));a!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Bce)))}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 vr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},cW={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},zd={h:0,s:0,l:0},WS={h:0,s:0,l:0};function MN(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}var Ut=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=yr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,sn.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=sn.workingColorSpace){return this.r=e,this.g=t,this.b=n,sn.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=sn.workingColorSpace){if(e=IL(e,1),t=In(t,0,1),n=In(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=MN(o,s,e+1/3),this.g=MN(o,s,e),this.b=MN(o,s,e-1/3)}return sn.colorSpaceToWorking(this,r),this}setStyle(e,t=yr){function n(s){s!==void 0&&parseFloat(s)<1&&je("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:je("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);je("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=yr){let n=cW[e.toLowerCase()];return n!==void 0?this.setHex(n,t):je("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Cf(e.r),this.g=Cf(e.g),this.b=Cf(e.b),this}copyLinearToSRGB(e){return this.r=d_(e.r),this.g=d_(e.g),this.b=d_(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=yr){return sn.workingToColorSpace(ko.copy(this),e),Math.round(In(ko.r*255,0,255))*65536+Math.round(In(ko.g*255,0,255))*256+Math.round(In(ko.b*255,0,255))}getHexString(e=yr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=sn.workingColorSpace){sn.workingToColorSpace(ko.copy(this),t);let n=ko.r,r=ko.g,s=ko.b,o=Math.max(n,r,s),a=Math.min(n,r,s),l,c,u=(a+o)/2;if(a===o)l=0,c=0;else{let f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case n:l=(r-s)/f+(r<s?6:0);break;case r:l=(s-n)/f+2;break;case s:l=(n-r)/f+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=sn.workingColorSpace){return sn.workingToColorSpace(ko.copy(this),t),e.r=ko.r,e.g=ko.g,e.b=ko.b,e}getStyle(e=yr){sn.workingToColorSpace(ko.copy(this),e);let t=ko.r,n=ko.g,r=ko.b;return e!==yr?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(zd),this.setHSL(zd.h+e,zd.s+t,zd.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(zd),e.getHSL(WS);let n=xy(zd.h,WS.h,t),r=xy(zd.s,WS.s,t),s=xy(zd.l,WS.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}},ko=new Ut;Ut.NAMES=cW;var Jd=class extends Yi{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 fa,this.environmentIntensity=1,this.environmentRotation=new fa,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},Vc=new ie,vf=new ie,CN=new ie,bf=new ie,Qg=new ie,Jg=new ie,EH=new ie,RN=new ie,PN=new ie,IN=new ie,NN=new gn,LN=new gn,DN=new gn,Ef=class i{constructor(e=new ie,t=new ie,n=new ie){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Vc.subVectors(e,t),r.cross(Vc);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Vc.subVectors(r,t),vf.subVectors(n,t),CN.subVectors(e,t);let o=Vc.dot(Vc),a=Vc.dot(vf),l=Vc.dot(CN),c=vf.dot(vf),u=vf.dot(CN),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;let p=1/f,x=(c*l-a*u)*p,v=(o*u-a*l)*p;return s.set(1-x-v,v,x)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,bf)===null?!1:bf.x>=0&&bf.y>=0&&bf.x+bf.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,bf)===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,bf.x),l.addScaledVector(o,bf.y),l.addScaledVector(a,bf.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return NN.setScalar(0),LN.setScalar(0),DN.setScalar(0),NN.fromBufferAttribute(e,t),LN.fromBufferAttribute(e,n),DN.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(NN,s.x),o.addScaledVector(LN,s.y),o.addScaledVector(DN,s.z),o}static isFrontFacing(e,t,n,r){return Vc.subVectors(n,t),vf.subVectors(e,t),Vc.cross(vf).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Vc.subVectors(this.c,this.b),vf.subVectors(this.a,this.b),Vc.cross(vf).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;Qg.subVectors(r,n),Jg.subVectors(s,n),RN.subVectors(e,n);let l=Qg.dot(RN),c=Jg.dot(RN);if(l<=0&&c<=0)return t.copy(n);PN.subVectors(e,r);let u=Qg.dot(PN),f=Jg.dot(PN);if(u>=0&&f<=u)return t.copy(r);let p=l*f-u*c;if(p<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(Qg,o);IN.subVectors(e,s);let x=Qg.dot(IN),v=Jg.dot(IN);if(v>=0&&x<=v)return t.copy(s);let w=x*c-l*v;if(w<=0&&c>=0&&v<=0)return a=c/(c-v),t.copy(n).addScaledVector(Jg,a);let S=u*v-x*f;if(S<=0&&f-u>=0&&x-v>=0)return EH.subVectors(s,r),a=(f-u)/(f-u+(x-v)),t.copy(r).addScaledVector(EH,a);let T=1/(S+w+p);return o=w*T,a=p*T,t.copy(n).addScaledVector(Qg,o).addScaledVector(Jg,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},da=class{constructor(e=new ie(1/0,1/0,1/0),t=new ie(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(qc.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(qc.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=qc.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,qc):qc.fromBufferAttribute(s,o),qc.applyMatrix4(e.matrixWorld),this.expandByPoint(qc);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),jS.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),jS.copy(n.boundingBox)),jS.applyMatrix4(e.matrixWorld),this.union(jS)}let r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,qc),qc.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(uy),XS.subVectors(this.max,uy),e_.subVectors(e.a,uy),t_.subVectors(e.b,uy),n_.subVectors(e.c,uy),Vd.subVectors(t_,e_),qd.subVectors(n_,t_),uA.subVectors(e_,n_);let t=[0,-Vd.z,Vd.y,0,-qd.z,qd.y,0,-uA.z,uA.y,Vd.z,0,-Vd.x,qd.z,0,-qd.x,uA.z,0,-uA.x,-Vd.y,Vd.x,0,-qd.y,qd.x,0,-uA.y,uA.x,0];return!FN(t,e_,t_,n_,XS)||(t=[1,0,0,0,1,0,0,0,1],!FN(t,e_,t_,n_,XS))?!1:($S.crossVectors(Vd,qd),t=[$S.x,$S.y,$S.z],FN(t,e_,t_,n_,XS))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qc).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(qc).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(wf[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),wf[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),wf[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),wf[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),wf[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),wf[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),wf[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),wf[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(wf),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}},wf=[new ie,new ie,new ie,new ie,new ie,new ie,new ie,new ie],qc=new ie,jS=new da,e_=new ie,t_=new ie,n_=new ie,Vd=new ie,qd=new ie,uA=new ie,uy=new ie,XS=new ie,$S=new ie,hA=new ie;function FN(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){hA.fromArray(i,s);let a=r.x*Math.abs(hA.x)+r.y*Math.abs(hA.y)+r.z*Math.abs(hA.z),l=e.dot(hA),c=t.dot(hA),u=n.dot(hA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var Mf=Uce();function Uce(){let i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){let c=l-127;c<-27?(n[l]=0,n[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,r[l]=24,r[l|256]=24):(n[l]=31744,n[l|256]=64512,r[l]=13,r[l|256]=13)}let s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function ml(i){Math.abs(i)>65504&&je("DataUtils.toHalfFloat(): Value out of range."),i=In(i,-65504,65504),Mf.floatView[0]=i;let e=Mf.uint32View[0],t=e>>23&511;return Mf.baseTable[t]+((e&8388607)>>Mf.shiftTable[t])}function YS(i){let e=i>>10;return Mf.uint32View[0]=Mf.mantissaTable[Mf.offsetTable[e]+(i&1023)]+Mf.exponentTable[e],Mf.floatView[0]}var bs=new ie,ZS=new Oe,kce=0,Li=class extends zo{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:kce++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Kd,this.updateRanges=[],this.gpuType=Zi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)ZS.fromBufferAttribute(this,t),ZS.applyMatrix3(e),this.setXY(t,ZS.x,ZS.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)bs.fromBufferAttribute(this,t),bs.applyMatrix3(e),this.setXYZ(t,bs.x,bs.y,bs.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)bs.fromBufferAttribute(this,t),bs.applyMatrix4(e),this.setXYZ(t,bs.x,bs.y,bs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)bs.fromBufferAttribute(this,t),bs.applyNormalMatrix(e),this.setXYZ(t,bs.x,bs.y,bs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)bs.fromBufferAttribute(this,t),bs.transformDirection(e),this.setXYZ(t,bs.x,bs.y,bs.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=ca(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Wn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ca(t,this.array)),t}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ca(t,this.array)),t}setY(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=ca(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=ca(t,this.array)),t}setW(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Kd&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var wA=class extends Li{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var SA=class extends Li{constructor(e,t,n){super(new Uint32Array(e),t,n)}},__=class extends Li{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=YS(this.array[e*this.itemSize]);return this.normalized&&(t=ca(t,this.array)),t}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize]=ml(t),this}getY(e){let t=YS(this.array[e*this.itemSize+1]);return this.normalized&&(t=ca(t,this.array)),t}setY(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+1]=ml(t),this}getZ(e){let t=YS(this.array[e*this.itemSize+2]);return this.normalized&&(t=ca(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+2]=ml(t),this}getW(e){let t=YS(this.array[e*this.itemSize+3]);return this.normalized&&(t=ca(t,this.array)),t}setW(e,t){return this.normalized&&(t=Wn(t,this.array)),this.array[e*this.itemSize+3]=ml(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array)),this.array[e+0]=ml(t),this.array[e+1]=ml(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array)),this.array[e+0]=ml(t),this.array[e+1]=ml(n),this.array[e+2]=ml(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(s,this.array)),this.array[e+0]=ml(t),this.array[e+1]=ml(n),this.array[e+2]=ml(r),this.array[e+3]=ml(s),this}},Rn=class extends Li{constructor(e,t,n){super(new Float32Array(e),t,n)}},Gce=new da,hy=new ie,ON=new ie,Wa=class{constructor(e=new ie,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):Gce.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;hy.subVectors(e,this.center);let t=hy.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(hy,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):(ON.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(hy.copy(e.center).add(ON)),this.expandByPoint(hy.copy(e.center).sub(ON))),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}},zce=0,ec=new on,BN=new Yi,i_=new ie,gl=new da,fy=new da,Js=new ie,qn=class i extends zo{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:zce++}),this.uuid=ku(),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(hce(e)?SA:wA)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new Sn().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return ec.makeRotationFromQuaternion(e),this.applyMatrix4(ec),this}rotateX(e){return ec.makeRotationX(e),this.applyMatrix4(ec),this}rotateY(e){return ec.makeRotationY(e),this.applyMatrix4(ec),this}rotateZ(e){return ec.makeRotationZ(e),this.applyMatrix4(ec),this}translate(e,t,n){return ec.makeTranslation(e,t,n),this.applyMatrix4(ec),this}scale(e,t,n){return ec.makeScale(e,t,n),this.applyMatrix4(ec),this}lookAt(e){return BN.lookAt(e),BN.updateMatrix(),this.applyMatrix4(BN.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(i_).negate(),this.translate(i_.x,i_.y,i_.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let r=0,s=e.length;r<s;r++){let o=e[r];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new Rn(n,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&je("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new da);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ie(-1/0,-1/0,-1/0),new ie(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){let s=t[n];gl.setFromBufferAttribute(s),this.morphTargetsRelative?(Js.addVectors(this.boundingBox.min,gl.min),this.boundingBox.expandByPoint(Js),Js.addVectors(this.boundingBox.max,gl.max),this.boundingBox.expandByPoint(Js)):(this.boundingBox.expandByPoint(gl.min),this.boundingBox.expandByPoint(gl.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ge('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Wa);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new ie,1/0);return}if(e){let n=this.boundingSphere.center;if(gl.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];fy.setFromBufferAttribute(a),this.morphTargetsRelative?(Js.addVectors(gl.min,fy.min),gl.expandByPoint(Js),Js.addVectors(gl.max,fy.max),gl.expandByPoint(Js)):(gl.expandByPoint(fy.min),gl.expandByPoint(fy.max))}gl.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)Js.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Js));if(t)for(let s=0,o=t.length;s<o;s++){let a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)Js.fromBufferAttribute(a,c),l&&(i_.fromBufferAttribute(e,c),Js.add(i_)),r=Math.max(r,n.distanceToSquared(Js))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Ge('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Ge("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,r=t.normal,s=t.uv,o=this.getAttribute("tangent");(o===void 0||o.count!==n.count)&&(o=new Li(new Float32Array(4*n.count),4),this.setAttribute("tangent",o));let a=[],l=[];for(let N=0;N<n.count;N++)a[N]=new ie,l[N]=new ie;let c=new ie,u=new ie,f=new ie,p=new Oe,x=new Oe,v=new Oe,w=new ie,S=new ie;function T(N,B,z){c.fromBufferAttribute(n,N),u.fromBufferAttribute(n,B),f.fromBufferAttribute(n,z),p.fromBufferAttribute(s,N),x.fromBufferAttribute(s,B),v.fromBufferAttribute(s,z),u.sub(c),f.sub(c),x.sub(p),v.sub(p);let V=1/(x.x*v.y-v.x*x.y);isFinite(V)&&(w.copy(u).multiplyScalar(v.y).addScaledVector(f,-x.y).multiplyScalar(V),S.copy(f).multiplyScalar(x.x).addScaledVector(u,-v.x).multiplyScalar(V),a[N].add(w),a[B].add(w),a[z].add(w),l[N].add(S),l[B].add(S),l[z].add(S))}let P=this.groups;P.length===0&&(P=[{start:0,count:e.count}]);for(let N=0,B=P.length;N<B;++N){let z=P[N],V=z.start,H=z.count;for(let Z=V,J=V+H;Z<J;Z+=3)T(e.getX(Z+0),e.getX(Z+1),e.getX(Z+2))}let R=new ie,C=new ie,L=new ie,D=new ie;function F(N){L.fromBufferAttribute(r,N),D.copy(L);let B=a[N];R.copy(B),R.sub(L.multiplyScalar(L.dot(B))).normalize(),C.crossVectors(D,B);let V=C.dot(l[N])<0?-1:1;o.setXYZW(N,R.x,R.y,R.z,V)}for(let N=0,B=P.length;N<B;++N){let z=P[N],V=z.start,H=z.count;for(let Z=V,J=V+H;Z<J;Z+=3)F(e.getX(Z+0)),F(e.getX(Z+1)),F(e.getX(Z+2))}this._transformed=!0}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new Li(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let p=0,x=n.count;p<x;p++)n.setXYZ(p,0,0,0);let r=new ie,s=new ie,o=new ie,a=new ie,l=new ie,c=new ie,u=new ie,f=new ie;if(e)for(let p=0,x=e.count;p<x;p+=3){let v=e.getX(p+0),w=e.getX(p+1),S=e.getX(p+2);r.fromBufferAttribute(t,v),s.fromBufferAttribute(t,w),o.fromBufferAttribute(t,S),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),a.fromBufferAttribute(n,v),l.fromBufferAttribute(n,w),c.fromBufferAttribute(n,S),a.add(u),l.add(u),c.add(u),n.setXYZ(v,a.x,a.y,a.z),n.setXYZ(w,l.x,l.y,l.z),n.setXYZ(S,c.x,c.y,c.z)}else for(let p=0,x=t.count;p<x;p+=3)r.fromBufferAttribute(t,p+0),s.fromBufferAttribute(t,p+1),o.fromBufferAttribute(t,p+2),u.subVectors(o,s),f.subVectors(r,s),u.cross(f),n.setXYZ(p+0,u.x,u.y,u.z),n.setXYZ(p+1,u.x,u.y,u.z),n.setXYZ(p+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Js.fromBufferAttribute(e,t),Js.normalize(),e.setXYZ(t,Js.x,Js.y,Js.z)}toNonIndexed(){function e(a,l){let c=a.array,u=a.itemSize,f=a.normalized,p=new c.constructor(l.length*u),x=0,v=0;for(let w=0,S=l.length;w<S;w++){a.isInterleavedBufferAttribute?x=l[w]*a.data.stride+a.offset:x=l[w]*u;for(let T=0;T<u;T++)p[v++]=c[x++]}return new Li(p,u,f)}if(this.index===null)return je("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new i,n=this.index.array,r=this.attributes;for(let a in r){let l=r[a],c=e(l,n);t.setAttribute(a,c)}let s=this.morphAttributes;for(let a in s){let l=[],c=s[a];for(let u=0,f=c.length;u<f;u++){let p=c[u],x=e(p,n);l.push(x)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,l=o.length;a<l;a++){let c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let f=0,p=c.length;f<p;f++){let x=c[f];u.push(x.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let c in r){let u=r[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],f=s[c];for(let p=0,x=f.length;p<x;p++)u.push(f[p].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let c=0,u=o.length;c<u;c++){let f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},Nf=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Kd,this.updateRanges=[],this.version=0,this.uuid=ku()}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=ku()),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=ku()),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}}},aa=new ie,_o=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++)aa.fromBufferAttribute(this,t),aa.applyMatrix4(e),this.setXYZ(t,aa.x,aa.y,aa.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)aa.fromBufferAttribute(this,t),aa.applyNormalMatrix(e),this.setXYZ(t,aa.x,aa.y,aa.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)aa.fromBufferAttribute(this,t),aa.transformDirection(e),this.setXYZ(t,aa.x,aa.y,aa.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=ca(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Wn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Wn(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=ca(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=ca(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=ca(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=ca(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Wn(t,this.array),n=Wn(n,this.array),r=Wn(r,this.array),s=Wn(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){vA("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 Li(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){vA("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}}},Vce=0,Es=class extends zo{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Vce++}),this.uuid=ku(),this.name="",this.type="Material",this.blending=os,this.side=go,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Xd,this.blendDst=$d,this.blendEquation=Gs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ut(0,0,0),this.blendAlpha=0,this.depthFunc=Gu,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=wy,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Tf,this.stencilZFail=Tf,this.stencilZPass=Tf,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){je(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){je(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==os&&(n.blending=this.blending),this.side!==go&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Xd&&(n.blendSrc=this.blendSrc),this.blendDst!==$d&&(n.blendDst=this.blendDst),this.blendEquation!==Gs&&(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!==Gu&&(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!==wy&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Tf&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Tf&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Tf&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Ut().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Oe().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Oe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},zu=class extends Es{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ut(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},r_,dy=new ie,s_=new ie,o_=new ie,a_=new Oe,py=new Oe,uW=new on,KS=new ie,Ay=new ie,QS=new ie,MH=new Oe,UN=new Oe,CH=new Oe,TA=class extends Yi{constructor(e=new zu){if(super(),this.isSprite=!0,this.type="Sprite",r_===void 0){r_=new qn;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Nf(t,5);r_.setIndex([0,1,2,0,2,3]),r_.setAttribute("position",new _o(n,3,0,!1)),r_.setAttribute("uv",new _o(n,2,3,!1))}this.geometry=r_,this.material=e,this.center=new Oe(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Ge('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),s_.setFromMatrixScale(this.matrixWorld),uW.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),o_.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&s_.multiplyScalar(-o_.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;JS(KS.set(-.5,-.5,0),o_,o,s_,r,s),JS(Ay.set(.5,-.5,0),o_,o,s_,r,s),JS(QS.set(.5,.5,0),o_,o,s_,r,s),MH.set(0,0),UN.set(1,0),CH.set(1,1);let a=e.ray.intersectTriangle(KS,Ay,QS,!1,dy);if(a===null&&(JS(Ay.set(-.5,.5,0),o_,o,s_,r,s),UN.set(0,1),a=e.ray.intersectTriangle(KS,QS,Ay,!1,dy),a===null))return;let l=e.ray.origin.distanceTo(dy);l<e.near||l>e.far||t.push({distance:l,point:dy.clone(),uv:Ef.getInterpolation(dy,KS,Ay,QS,MH,UN,CH,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 JS(i,e,t,n,r,s){a_.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(py.x=s*a_.x-r*a_.y,py.y=r*a_.x+s*a_.y):py.copy(a_),i.copy(e),i.x+=py.x,i.y+=py.y,i.applyMatrix4(uW)}var Sf=new ie,kN=new ie,eT=new ie,Hd=new ie,GN=new ie,tT=new ie,zN=new ie,Lf=class{constructor(e=new ie,t=new ie(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Sf)),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=Sf.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Sf.copy(this.origin).addScaledVector(this.direction,t),Sf.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){kN.copy(e).add(t).multiplyScalar(.5),eT.copy(t).sub(e).normalize(),Hd.copy(this.origin).sub(kN);let s=e.distanceTo(t)*.5,o=-this.direction.dot(eT),a=Hd.dot(this.direction),l=-Hd.dot(eT),c=Hd.lengthSq(),u=Math.abs(1-o*o),f,p,x,v;if(u>0)if(f=o*l-a,p=o*a-l,v=s*u,f>=0)if(p>=-v)if(p<=v){let w=1/u;f*=w,p*=w,x=f*(f+o*p+2*a)+p*(o*f+p+2*l)+c}else p=s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;else p<=-v?(f=Math.max(0,-(-o*s+a)),p=f>0?-s:Math.min(Math.max(-s,-l),s),x=-f*f+p*(p+2*l)+c):p<=v?(f=0,p=Math.min(Math.max(-s,-l),s),x=p*(p+2*l)+c):(f=Math.max(0,-(o*s+a)),p=f>0?s:Math.min(Math.max(-s,-l),s),x=-f*f+p*(p+2*l)+c);else p=o>0?-s:s,f=Math.max(0,-(o*p+a)),x=-f*f+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(kN).addScaledVector(eT,p),x}intersectSphere(e,t){Sf.subVectors(e.center,this.origin);let n=Sf.dot(this.direction),r=Sf.dot(Sf)-n*n,s=e.radius*e.radius;if(r>s)return null;let o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,o,a,l,c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,p=this.origin;return c>=0?(n=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(n=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),u>=0?(s=(e.min.y-p.y)*u,o=(e.max.y-p.y)*u):(s=(e.max.y-p.y)*u,o=(e.min.y-p.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),f>=0?(a=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(a=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),n>l||a>r)||((a>n||n!==n)&&(n=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Sf)!==null}intersectTriangle(e,t,n,r,s){GN.subVectors(t,e),tT.subVectors(n,e),zN.crossVectors(GN,tT);let o=this.direction.dot(zN),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Hd.subVectors(this.origin,e);let l=a*this.direction.dot(tT.crossVectors(Hd,tT));if(l<0)return null;let c=a*this.direction.dot(GN.cross(Hd));if(c<0||l+c>o)return null;let u=-a*Hd.dot(zN);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)}},as=class extends Es{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new fa,this.combine=BA,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}},RH=new on,fA=new Lf,nT=new Wa,PH=new ie,iT=new ie,rT=new ie,sT=new ie,VN=new ie,oT=new ie,IH=new ie,aT=new ie,Gn=class extends Yi{constructor(e=new qn,t=new as){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){oT.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(VN.fromBufferAttribute(f,e),o?oT.addScaledVector(VN,u):oT.addScaledVector(VN.sub(t),u))}t.add(oT)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),nT.copy(n.boundingSphere),nT.applyMatrix4(s),fA.copy(e.ray).recast(e.near),!(nT.containsPoint(fA.origin)===!1&&(fA.intersectSphere(nT,PH)===null||fA.origin.distanceToSquared(PH)>(e.far-e.near)**2))&&(RH.copy(s).invert(),fA.copy(e.ray).applyMatrix4(RH),!(n.boundingBox!==null&&fA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,fA)))}_computeIntersections(e,t,n){let r,s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,p=s.groups,x=s.drawRange;if(a!==null)if(Array.isArray(o))for(let v=0,w=p.length;v<w;v++){let S=p[v],T=o[S.materialIndex],P=Math.max(S.start,x.start),R=Math.min(a.count,Math.min(S.start+S.count,x.start+x.count));for(let C=P,L=R;C<L;C+=3){let D=a.getX(C),F=a.getX(C+1),N=a.getX(C+2);r=lT(this,T,e,n,c,u,f,D,F,N),r&&(r.faceIndex=Math.floor(C/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let v=Math.max(0,x.start),w=Math.min(a.count,x.start+x.count);for(let S=v,T=w;S<T;S+=3){let P=a.getX(S),R=a.getX(S+1),C=a.getX(S+2);r=lT(this,o,e,n,c,u,f,P,R,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let v=0,w=p.length;v<w;v++){let S=p[v],T=o[S.materialIndex],P=Math.max(S.start,x.start),R=Math.min(l.count,Math.min(S.start+S.count,x.start+x.count));for(let C=P,L=R;C<L;C+=3){let D=C,F=C+1,N=C+2;r=lT(this,T,e,n,c,u,f,D,F,N),r&&(r.faceIndex=Math.floor(C/3),r.face.materialIndex=S.materialIndex,t.push(r))}}else{let v=Math.max(0,x.start),w=Math.min(l.count,x.start+x.count);for(let S=v,T=w;S<T;S+=3){let P=S,R=S+1,C=S+2;r=lT(this,o,e,n,c,u,f,P,R,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function qce(i,e,t,n,r,s,o,a){let l;if(e.side===hi?l=n.intersectTriangle(o,s,r,!0,a):l=n.intersectTriangle(r,s,o,e.side===go,a),l===null)return null;aT.copy(a),aT.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(aT);return c<t.near||c>t.far?null:{distance:c,point:aT.clone(),object:i}}function lT(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,iT),i.getVertexPosition(l,rT),i.getVertexPosition(c,sT);let u=qce(i,e,t,n,iT,rT,sT,IH);if(u){let f=new ie;Ef.getBarycoord(IH,iT,rT,sT,f),r&&(u.uv=Ef.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=Ef.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=Ef.getInterpolatedAttribute(o,a,l,c,f,new ie),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let p={a,b:l,c,normal:new ie,materialIndex:0};Ef.getNormal(iT,rT,sT,p.normal),u.face=p,u.barycoord=f}return u}var EA=class extends Ts{constructor(e=null,t=1,n=1,r,s,o,a,l,c=yi,u=yi,f,p){super(null,o,a,l,c,u,r,s,f,p),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var _l=class extends Li{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 qN=new ie,Hce=new ie,Wce=new Sn,la=class{constructor(e=new ie(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){let r=qN.subVectors(n,t).cross(Hce.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(qN),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||Wce.getNormalMatrix(e),r=this.coplanarPoint(qN).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)}},dA=new Wa,jce=new Oe(.5,.5),cT=new ie,tc=class{constructor(e=new la,t=new la,n=new la,r=new la,s=new la,o=new la){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=mo,n=!1){let r=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],u=s[4],f=s[5],p=s[6],x=s[7],v=s[8],w=s[9],S=s[10],T=s[11],P=s[12],R=s[13],C=s[14],L=s[15];if(r[0].setComponents(c-o,x-u,T-v,L-P).normalize(),r[1].setComponents(c+o,x+u,T+v,L+P).normalize(),r[2].setComponents(c+a,x+f,T+w,L+R).normalize(),r[3].setComponents(c-a,x-f,T-w,L-R).normalize(),n)r[4].setComponents(l,p,S,C).normalize(),r[5].setComponents(c-l,x-p,T-S,L-C).normalize();else if(r[4].setComponents(c-l,x-p,T-S,L-C).normalize(),t===mo)r[5].setComponents(c+l,x+p,T+S,L+C).normalize();else if(t===Ha)r[5].setComponents(l,p,S,C).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),dA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),dA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(dA)}intersectsSprite(e){dA.center.set(0,0,0);let t=jce.distanceTo(e.center);return dA.radius=.7071067811865476+t,dA.applyMatrix4(e.matrixWorld),this.intersectsSphere(dA)}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(cT.x=r.normal.x>0?e.max.x:e.min.x,cT.y=r.normal.y>0?e.max.y:e.min.y,cT.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(cT)<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)}},NH=new on,Sy=class i{constructor(){this.coordinateSystem=mo,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];NH.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new tc),n[r].setFromProjectionMatrix(NH,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 tc),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var xl=class extends Es{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ut(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},TT=new ie,ET=new ie,LH=new on,my=new Lf,uT=new Wa,HN=new ie,DH=new ie,Df=class extends Yi{constructor(e=new qn,t=new xl){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++)TT.fromBufferAttribute(t,r-1),ET.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=TT.distanceTo(ET);e.setAttribute("lineDistance",new Rn(n,1))}else je("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),uT.copy(n.boundingSphere),uT.applyMatrix4(r),uT.radius+=s,e.ray.intersectsSphere(uT)===!1)return;LH.copy(r).invert(),my.copy(e.ray).applyMatrix4(LH);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,u=n.index,p=n.attributes.position;if(u!==null){let x=Math.max(0,o.start),v=Math.min(u.count,o.start+o.count);for(let w=x,S=v-1;w<S;w+=c){let T=u.getX(w),P=u.getX(w+1),R=hT(this,e,my,l,T,P,w);R&&t.push(R)}if(this.isLineLoop){let w=u.getX(v-1),S=u.getX(x),T=hT(this,e,my,l,w,S,v-1);T&&t.push(T)}}else{let x=Math.max(0,o.start),v=Math.min(p.count,o.start+o.count);for(let w=x,S=v-1;w<S;w+=c){let T=hT(this,e,my,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=hT(this,e,my,l,v-1,x,v-1);w&&t.push(w)}}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function hT(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(TT.fromBufferAttribute(a,r),ET.fromBufferAttribute(a,s),t.distanceSqToSegment(TT,ET,HN,DH)>n)return;HN.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(HN);if(!(c<e.near||c>e.far))return{distance:c,point:DH.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var FH=new ie,OH=new ie,x_=class extends Df{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)FH.fromBufferAttribute(t,r),OH.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+FH.distanceTo(OH);e.setAttribute("lineDistance",new Rn(n,1))}else je("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},Ty=class extends Df{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}},ep=class extends Es{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ut(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},BH=new on,eL=new Lf,fT=new Wa,dT=new ie,Ey=class extends Yi{constructor(e=new qn,t=new ep){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(),fT.copy(n.boundingSphere),fT.applyMatrix4(r),fT.radius+=s,e.ray.intersectsSphere(fT)===!1)return;BH.copy(r).invert(),eL.copy(e.ray).applyMatrix4(BH);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=n.index,f=n.attributes.position;if(c!==null){let p=Math.max(0,o.start),x=Math.min(c.count,o.start+o.count);for(let v=p,w=x;v<w;v++){let S=c.getX(v);dT.fromBufferAttribute(f,S),UH(dT,S,l,r,e,t,this)}}else{let p=Math.max(0,o.start),x=Math.min(f.count,o.start+o.count);for(let v=p,w=x;v<w;v++)dT.fromBufferAttribute(f,v),UH(dT,v,l,r,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function UH(i,e,t,n,r,s,o){let a=eL.distanceSqToPoint(i);if(a<t){let l=new ie;eL.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 MA=class extends Ts{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=yi,this.minFilter=yi,this.generateMipmaps=!1,this.needsUpdate=!0}};var Vu=class extends Ts{constructor(e=[],t=vl,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 ls=class extends Ts{constructor(e,t,n=Ai,r,s,o,a=yi,l=yi,c,u=ws,f=1){if(u!==ws&&u!==eo)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let p={width:e,height:t,depth:f};super(p,r,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new m_(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}},y_=class extends ls{constructor(e,t=Ai,n=vl,r,s,o=yi,a=yi,l,c=ws){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}},My=class extends Ts{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Hc=class i extends qn{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};let a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=[],c=[],u=[],f=[],p=0,x=0;v("z","y","x",-1,-1,n,t,e,o,s,0),v("z","y","x",1,-1,n,t,-e,o,s,1),v("x","z","y",1,1,e,n,t,r,o,2),v("x","z","y",1,-1,e,n,-t,r,o,3),v("x","y","z",1,-1,e,t,n,r,s,4),v("x","y","z",-1,-1,e,t,-n,r,s,5),this.setIndex(l),this.setAttribute("position",new Rn(c,3)),this.setAttribute("normal",new Rn(u,3)),this.setAttribute("uv",new Rn(f,2));function v(w,S,T,P,R,C,L,D,F,N,B){let z=C/F,V=L/N,H=C/2,Z=L/2,J=D/2,j=F+1,K=N+1,ee=0,ae=0,ce=new ie;for(let de=0;de<K;de++){let ve=de*V-Z;for(let Ie=0;Ie<j;Ie++){let Qe=Ie*z-H;ce[w]=Qe*P,ce[S]=ve*R,ce[T]=J,c.push(ce.x,ce.y,ce.z),ce[w]=0,ce[S]=0,ce[T]=D>0?1:-1,u.push(ce.x,ce.y,ce.z),f.push(Ie/F),f.push(1-de/N),ee+=1}}for(let de=0;de<N;de++)for(let ve=0;ve<F;ve++){let Ie=p+ve+j*de,Qe=p+ve+j*(de+1),Ue=p+(ve+1)+j*(de+1),mt=p+(ve+1)+j*de;l.push(Ie,Qe,mt),l.push(Qe,Ue,mt),ae+=6}a.addGroup(x,ae,B),x+=ae,p+=ee}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};var v_=class i extends qn{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let s=[],o=[],a=[],l=[],c=new ie,u=new Oe;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,p=3;f<=t;f++,p+=3){let x=n+f/t*r;c.x=e*Math.cos(x),c.y=e*Math.sin(x),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[p]/e+1)/2,u.y=(o[p+1]/e+1)/2,l.push(u.x,u.y)}for(let f=1;f<=t;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new Rn(o,3)),this.setAttribute("normal",new Rn(a,3)),this.setAttribute("uv",new Rn(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.segments,e.thetaStart,e.thetaLength)}},CA=class i extends qn{constructor(e=1,t=1,n=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;r=Math.floor(r),s=Math.floor(s);let u=[],f=[],p=[],x=[],v=0,w=[],S=n/2,T=0;P(),o===!1&&(e>0&&R(!0),t>0&&R(!1)),this.setIndex(u),this.setAttribute("position",new Rn(f,3)),this.setAttribute("normal",new Rn(p,3)),this.setAttribute("uv",new Rn(x,2));function P(){let C=new ie,L=new ie,D=0,F=(t-e)/n;for(let N=0;N<=s;N++){let B=[],z=N/s,V=z*(t-e)+e;for(let H=0;H<=r;H++){let Z=H/r,J=Z*l+a,j=Math.sin(J),K=Math.cos(J);L.x=V*j,L.y=-z*n+S,L.z=V*K,f.push(L.x,L.y,L.z),C.set(j,F,K).normalize(),p.push(C.x,C.y,C.z),x.push(Z,1-z),B.push(v++)}w.push(B)}for(let N=0;N<r;N++)for(let B=0;B<s;B++){let z=w[B][N],V=w[B+1][N],H=w[B+1][N+1],Z=w[B][N+1];(e>0||B!==0)&&(u.push(z,V,Z),D+=3),(t>0||B!==s-1)&&(u.push(V,H,Z),D+=3)}c.addGroup(T,D,0),T+=D}function R(C){let L=v,D=new Oe,F=new ie,N=0,B=C===!0?e:t,z=C===!0?1:-1;for(let H=1;H<=r;H++)f.push(0,S*z,0),p.push(0,z,0),x.push(.5,.5),v++;let V=v;for(let H=0;H<=r;H++){let J=H/r*l+a,j=Math.cos(J),K=Math.sin(J);F.x=B*K,F.y=S*z,F.z=B*j,f.push(F.x,F.y,F.z),p.push(0,z,0),D.x=j*.5+.5,D.y=K*.5*z+.5,x.push(D.x,D.y),v++}for(let H=0;H<r;H++){let Z=L+H,J=V+H;C===!0?u.push(J,J+1,Z):u.push(J+1,J,Z),N+=3}c.addGroup(T,N,C===!0?1:2),T+=N}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}};var pa=class{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){je("Curve: .getPoint() not implemented.")}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(r),t.push(s),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,s=n.length,o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=n[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,n[r]===o)return r/(s-1);let u=n[r],p=n[r+1]-u,x=(o-u)/p;return(r+x)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);let o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Oe:new ie);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new ie,r=[],s=[],o=[],a=new ie,l=new on;for(let x=0;x<=e;x++){let v=x/e;r[x]=this.getTangentAt(v,new ie)}s[0]=new ie,o[0]=new ie;let c=Number.MAX_VALUE,u=Math.abs(r[0].x),f=Math.abs(r[0].y),p=Math.abs(r[0].z);u<=c&&(c=u,n.set(1,0,0)),f<=c&&(c=f,n.set(0,1,0)),p<=c&&n.set(0,0,1),a.crossVectors(r[0],n).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let x=1;x<=e;x++){if(s[x]=s[x-1].clone(),o[x]=o[x-1].clone(),a.crossVectors(r[x-1],r[x]),a.length()>Number.EPSILON){a.normalize();let v=Math.acos(In(r[x-1].dot(r[x]),-1,1));s[x].applyMatrix4(l.makeRotationAxis(a,v))}o[x].crossVectors(r[x],s[x])}if(t===!0){let x=Math.acos(In(s[0].dot(s[e]),-1,1));x/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(x=-x);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(r[v],x*v)),o[v].crossVectors(r[v],s[v])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},b_=class extends pa{constructor(e=0,t=0,n=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Oe){let n=t,r=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);let a=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),f=Math.sin(this.aRotation),p=l-this.aX,x=c-this.aY;l=p*u-x*f+this.aX,c=p*f+x*u+this.aY}return n.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},MT=class extends b_{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function NL(){let i=0,e=0,t=0,n=0;function r(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,n=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,f){let p=(o-s)/c-(a-s)/(c+u)+(a-o)/u,x=(a-o)/u-(l-o)/(u+f)+(l-a)/f;p*=u,x*=u,r(o,a,p,x)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+n*a}}}var kH=new ie,GH=new ie,WN=new NL,jN=new NL,XN=new NL,CT=class extends pa{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new ie){let n=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=r[(a-1)%s]:(GH.subVectors(r[0],r[1]).add(r[0]),c=GH);let f=r[a%s],p=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(kH.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=kH),this.curveType==="centripetal"||this.curveType==="chordal"){let x=this.curveType==="chordal"?.5:.25,v=Math.pow(c.distanceToSquared(f),x),w=Math.pow(f.distanceToSquared(p),x),S=Math.pow(p.distanceToSquared(u),x);w<1e-4&&(w=1),v<1e-4&&(v=w),S<1e-4&&(S=w),WN.initNonuniformCatmullRom(c.x,f.x,p.x,u.x,v,w,S),jN.initNonuniformCatmullRom(c.y,f.y,p.y,u.y,v,w,S),XN.initNonuniformCatmullRom(c.z,f.z,p.z,u.z,v,w,S)}else this.curveType==="catmullrom"&&(WN.initCatmullRom(c.x,f.x,p.x,u.x,this.tension),jN.initCatmullRom(c.y,f.y,p.y,u.y,this.tension),XN.initCatmullRom(c.z,f.z,p.z,u.z,this.tension));return n.set(WN.calc(l),jN.calc(l),XN.calc(l)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let r=e.points[t];this.points.push(new ie().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function zH(i,e,t,n,r){let s=(n-e)*.5,o=(r-t)*.5,a=i*i,l=i*a;return(2*t-2*n+s+o)*l+(-3*t+3*n-2*s-o)*a+s*i+t}function Xce(i,e){let t=1-i;return t*t*e}function $ce(i,e){return 2*(1-i)*i*e}function Yce(i,e){return i*i*e}function yy(i,e,t,n){return Xce(i,e)+$ce(i,t)+Yce(i,n)}function Zce(i,e){let t=1-i;return t*t*t*e}function Kce(i,e){let t=1-i;return 3*t*t*i*e}function Qce(i,e){return 3*(1-i)*i*i*e}function Jce(i,e){return i*i*i*e}function vy(i,e,t,n,r){return Zce(i,e)+Kce(i,t)+Qce(i,n)+Jce(i,r)}var Cy=class extends pa{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(vy(e,r.x,s.x,o.x,a.x),vy(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}},w_=class extends pa{constructor(e=new ie,t=new ie,n=new ie,r=new ie){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new ie){let n=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return n.set(vy(e,r.x,s.x,o.x,a.x),vy(e,r.y,s.y,o.y,a.y),vy(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}},Ry=class extends pa{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}},RT=class extends pa{constructor(e=new ie,t=new ie){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new ie){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ie){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Py=class extends pa{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(yy(e,r.x,s.x,o.x),yy(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}},Iy=class extends pa{constructor(e=new ie,t=new ie,n=new ie){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ie){let n=t,r=this.v0,s=this.v1,o=this.v2;return n.set(yy(e,r.x,s.x,o.x),yy(e,r.y,s.y,o.y),yy(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}},Ny=class extends pa{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(zH(a,l.x,c.x,u.x,f.x),zH(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}},PT=Object.freeze({__proto__:null,ArcCurve:MT,CatmullRomCurve3:CT,CubicBezierCurve:Cy,CubicBezierCurve3:w_,EllipseCurve:b_,LineCurve:Ry,LineCurve3:RT,QuadraticBezierCurve:Py,QuadraticBezierCurve3:Iy,SplineCurve:Ny}),IT=class extends pa{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 PT[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 PT[r.type]().fromJSON(r))}return this}},RA=class extends IT{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 Ry(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 Py(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 Cy(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 Ny(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 b_(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}},Ly=class extends RA{constructor(e){super(e),this.uuid=ku(),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 RA().fromJSON(r))}return this}};function eue(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=hW(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=sue(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let p=t;p<r;p+=t){let x=i[p],v=i[p+1];x<a&&(a=x),v<l&&(l=v),x>u&&(u=x),v>f&&(f=v)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return Dy(s,o,t,a,l,c,0),o}function hW(i,e,t,n,r){let s;if(r===mue(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=VH(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=VH(o/n|0,i[o],i[o+1],s);return s&&S_(s,s.next)&&(Oy(s),s=s.next),s}function PA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(S_(t,t.next)||Lr(t.prev,t,t.next)===0)){if(Oy(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Dy(i,e,t,n,r,s,o){if(!i)return;!o&&s&&uue(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?nue(i,n,r,s):tue(i)){e.push(l.i,i.i,c.i),Oy(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=iue(PA(i),e),Dy(i,e,t,n,r,s,2)):o===2&&rue(i,e,t,n,r,s):Dy(PA(i),e,t,n,r,s,1);break}}}function tue(i){let e=i.prev,t=i,n=i.next;if(Lr(e,t,n)>=0)return!1;let r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),p=Math.max(r,s,o),x=Math.max(a,l,c),v=n.next;for(;v!==e;){if(v.x>=u&&v.x<=p&&v.y>=f&&v.y<=x&&gy(r,a,s,l,o,c,v.x,v.y)&&Lr(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function nue(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Lr(r,s,o)>=0)return!1;let a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,p=o.y,x=Math.min(a,l,c),v=Math.min(u,f,p),w=Math.max(a,l,c),S=Math.max(u,f,p),T=tL(x,v,e,t,n),P=tL(w,S,e,t,n),R=i.prevZ,C=i.nextZ;for(;R&&R.z>=T&&C&&C.z<=P;){if(R.x>=x&&R.x<=w&&R.y>=v&&R.y<=S&&R!==r&&R!==o&&gy(a,u,l,f,c,p,R.x,R.y)&&Lr(R.prev,R,R.next)>=0||(R=R.prevZ,C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==r&&C!==o&&gy(a,u,l,f,c,p,C.x,C.y)&&Lr(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;R&&R.z>=T;){if(R.x>=x&&R.x<=w&&R.y>=v&&R.y<=S&&R!==r&&R!==o&&gy(a,u,l,f,c,p,R.x,R.y)&&Lr(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;C&&C.z<=P;){if(C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==r&&C!==o&&gy(a,u,l,f,c,p,C.x,C.y)&&Lr(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function iue(i,e){let t=i;do{let n=t.prev,r=t.next.next;!S_(n,r)&&dW(n,t,t.next,r)&&Fy(n,r)&&Fy(r,n)&&(e.push(n.i,t.i,r.i),Oy(t),Oy(t.next),t=i=r),t=t.next}while(t!==i);return PA(t)}function rue(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&due(o,a)){let l=pW(o,a);o=PA(o,o.next),l=PA(l,l.next),Dy(o,e,t,n,r,s,0),Dy(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function sue(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=hW(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(fue(c))}r.sort(oue);for(let s=0;s<r.length;s++)t=aue(r[s],t);return t}function oue(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 aue(i,e){let t=lue(i,e);if(!t)return e;let n=pW(t,i);return PA(n,n.next),PA(t,t.next)}function lue(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(S_(i,t))return t;do{if(S_(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&&fW(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);Fy(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&cue(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function cue(i,e){return Lr(i.prev,i,e.prev)<0&&Lr(e.next,i,i.next)<0}function uue(i,e,t,n){let r=i;do r.z===0&&(r.z=tL(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,hue(r)}function hue(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 tL(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 fue(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 fW(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 gy(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&fW(i,e,t,n,r,s,o,a)}function due(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!pue(i,e)&&(Fy(i,e)&&Fy(e,i)&&Aue(i,e)&&(Lr(i.prev,i,e.prev)||Lr(i,e.prev,e))||S_(i,e)&&Lr(i.prev,i,i.next)>0&&Lr(e.prev,e,e.next)>0)}function Lr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function S_(i,e){return i.x===e.x&&i.y===e.y}function dW(i,e,t,n){let r=AT(Lr(i,e,t)),s=AT(Lr(i,e,n)),o=AT(Lr(t,n,i)),a=AT(Lr(t,n,e));return!!(r!==s&&o!==a||r===0&&pT(i,t,e)||s===0&&pT(i,n,e)||o===0&&pT(t,i,n)||a===0&&pT(t,e,n))}function pT(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function AT(i){return i>0?1:i<0?-1:0}function pue(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&dW(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Fy(i,e){return Lr(i.prev,i,i.next)<0?Lr(i,e,i.next)>=0&&Lr(i,i.prev,e)>=0:Lr(i,e,i.prev)<0||Lr(i,i.next,e)<0}function Aue(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 pW(i,e){let t=nL(i.i,i.x,i.y),n=nL(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 VH(i,e,t,n){let r=nL(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 Oy(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 nL(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function mue(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 iL=class{static triangulate(e,t,n=2){return eue(e,t,n)}},jd=class i{static area(e){let t=e.length,n=0;for(let r=t-1,s=0;s<t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return i.area(e)<0}static triangulateShape(e,t){let n=[],r=[],s=[];qH(e),HH(n,e);let o=e.length;t.forEach(qH);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,HH(n,t[l]);let a=iL.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function qH(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function HH(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var By=class i extends qn{constructor(e=new Ly([new Oe(.5,.5),new Oe(-.5,.5),new Oe(-.5,-.5),new Oe(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new Rn(r,3)),this.setAttribute("uv",new Rn(s,2)),this.computeVertexNormals();function o(a){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1,p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,x=t.bevelThickness!==void 0?t.bevelThickness:.2,v=t.bevelSize!==void 0?t.bevelSize:x-.1,w=t.bevelOffset!==void 0?t.bevelOffset:0,S=t.bevelSegments!==void 0?t.bevelSegments:3,T=t.extrudePath,P=t.UVGenerator!==void 0?t.UVGenerator:gue,R,C=!1,L,D,F,N;if(T){R=T.getSpacedPoints(u),C=!0,p=!1;let Xe=T.isCatmullRomCurve3?T.closed:!1;L=T.computeFrenetFrames(u,Xe),D=new ie,F=new ie,N=new ie}p||(S=0,x=0,v=0,w=0);let B=a.extractPoints(c),z=B.shape,V=B.holes;if(!jd.isClockWise(z)){z=z.reverse();for(let Xe=0,st=V.length;Xe<st;Xe++){let tt=V[Xe];jd.isClockWise(tt)&&(V[Xe]=tt.reverse())}}function Z(Xe){let tt=10000000000000001e-36,vt=Xe[0];for(let yt=1;yt<=Xe.length;yt++){let ln=yt%Xe.length,Kt=Xe[ln],Qt=Kt.x-vt.x,xn=Kt.y-vt.y,ge=Qt*Qt+xn*xn,pi=Math.max(Math.abs(Kt.x),Math.abs(Kt.y),Math.abs(vt.x),Math.abs(vt.y)),Bn=tt*pi*pi;if(ge<=Bn){Xe.splice(ln,1),yt--;continue}vt=Kt}}Z(z),V.forEach(Z);let J=V.length,j=z;for(let Xe=0;Xe<J;Xe++){let st=V[Xe];z=z.concat(st)}function K(Xe,st,tt){return st||Ge("ExtrudeGeometry: vec does not exist"),Xe.clone().addScaledVector(st,tt)}let ee=z.length;function ae(Xe,st,tt){let vt,yt,ln,Kt=Xe.x-st.x,Qt=Xe.y-st.y,xn=tt.x-Xe.x,ge=tt.y-Xe.y,pi=Kt*Kt+Qt*Qt,Bn=Kt*ge-Qt*xn;if(Math.abs(Bn)>Number.EPSILON){let le=Math.sqrt(pi),X=Math.sqrt(xn*xn+ge*ge),Te=st.x-Qt/le,Pe=st.y+Kt/le,Ve=tt.x-ge/X,gt=tt.y+xn/X,St=((Ve-Te)*ge-(gt-Pe)*xn)/(Kt*ge-Qt*xn);vt=Te+Kt*St-Xe.x,yt=Pe+Qt*St-Xe.y;let qe=vt*vt+yt*yt;if(qe<=2)return new Oe(vt,yt);ln=Math.sqrt(qe/2)}else{let le=!1;Kt>Number.EPSILON?xn>Number.EPSILON&&(le=!0):Kt<-Number.EPSILON?xn<-Number.EPSILON&&(le=!0):Math.sign(Qt)===Math.sign(ge)&&(le=!0),le?(vt=-Qt,yt=Kt,ln=Math.sqrt(pi)):(vt=Kt,yt=Qt,ln=Math.sqrt(pi/2))}return new Oe(vt/ln,yt/ln)}let ce=[];for(let Xe=0,st=j.length,tt=st-1,vt=Xe+1;Xe<st;Xe++,tt++,vt++)tt===st&&(tt=0),vt===st&&(vt=0),ce[Xe]=ae(j[Xe],j[tt],j[vt]);let de=[],ve,Ie=ce.concat();for(let Xe=0,st=J;Xe<st;Xe++){let tt=V[Xe];ve=[];for(let vt=0,yt=tt.length,ln=yt-1,Kt=vt+1;vt<yt;vt++,ln++,Kt++)ln===yt&&(ln=0),Kt===yt&&(Kt=0),ve[vt]=ae(tt[vt],tt[ln],tt[Kt]);de.push(ve),Ie=Ie.concat(ve)}let Qe;if(S===0)Qe=jd.triangulateShape(j,V);else{let Xe=[],st=[];for(let tt=0;tt<S;tt++){let vt=tt/S,yt=x*Math.cos(vt*Math.PI/2),ln=v*Math.sin(vt*Math.PI/2)+w;for(let Kt=0,Qt=j.length;Kt<Qt;Kt++){let xn=K(j[Kt],ce[Kt],ln);Et(xn.x,xn.y,-yt),vt===0&&Xe.push(xn)}for(let Kt=0,Qt=J;Kt<Qt;Kt++){let xn=V[Kt];ve=de[Kt];let ge=[];for(let pi=0,Bn=xn.length;pi<Bn;pi++){let le=K(xn[pi],ve[pi],ln);Et(le.x,le.y,-yt),vt===0&&ge.push(le)}vt===0&&st.push(ge)}}Qe=jd.triangulateShape(Xe,st)}let Ue=Qe.length,mt=v+w;for(let Xe=0;Xe<ee;Xe++){let st=p?K(z[Xe],Ie[Xe],mt):z[Xe];C?(F.copy(L.normals[0]).multiplyScalar(st.x),D.copy(L.binormals[0]).multiplyScalar(st.y),N.copy(R[0]).add(F).add(D),Et(N.x,N.y,N.z)):Et(st.x,st.y,0)}for(let Xe=1;Xe<=u;Xe++)for(let st=0;st<ee;st++){let tt=p?K(z[st],Ie[st],mt):z[st];C?(F.copy(L.normals[Xe]).multiplyScalar(tt.x),D.copy(L.binormals[Xe]).multiplyScalar(tt.y),N.copy(R[Xe]).add(F).add(D),Et(N.x,N.y,N.z)):Et(tt.x,tt.y,f/u*Xe)}for(let Xe=S-1;Xe>=0;Xe--){let st=Xe/S,tt=x*Math.cos(st*Math.PI/2),vt=v*Math.sin(st*Math.PI/2)+w;for(let yt=0,ln=j.length;yt<ln;yt++){let Kt=K(j[yt],ce[yt],vt);Et(Kt.x,Kt.y,f+tt)}for(let yt=0,ln=V.length;yt<ln;yt++){let Kt=V[yt];ve=de[yt];for(let Qt=0,xn=Kt.length;Qt<xn;Qt++){let ge=K(Kt[Qt],ve[Qt],vt);C?Et(ge.x,ge.y+R[u-1].y,R[u-1].x+tt):Et(ge.x,ge.y,f+tt)}}}Me(),ze();function Me(){let Xe=r.length/3;if(p){let st=0,tt=ee*st;for(let vt=0;vt<Ue;vt++){let yt=Qe[vt];Tt(yt[2]+tt,yt[1]+tt,yt[0]+tt)}st=u+S*2,tt=ee*st;for(let vt=0;vt<Ue;vt++){let yt=Qe[vt];Tt(yt[0]+tt,yt[1]+tt,yt[2]+tt)}}else{for(let st=0;st<Ue;st++){let tt=Qe[st];Tt(tt[2],tt[1],tt[0])}for(let st=0;st<Ue;st++){let tt=Qe[st];Tt(tt[0]+ee*u,tt[1]+ee*u,tt[2]+ee*u)}}n.addGroup(Xe,r.length/3-Xe,0)}function ze(){let Xe=r.length/3,st=0;$e(j,st),st+=j.length;for(let tt=0,vt=V.length;tt<vt;tt++){let yt=V[tt];$e(yt,st),st+=yt.length}n.addGroup(Xe,r.length/3-Xe,1)}function $e(Xe,st){let tt=Xe.length;for(;--tt>=0;){let vt=tt,yt=tt-1;yt<0&&(yt=Xe.length-1);for(let ln=0,Kt=u+S*2;ln<Kt;ln++){let Qt=ee*ln,xn=ee*(ln+1),ge=st+vt+Qt,pi=st+yt+Qt,Bn=st+yt+xn,le=st+vt+xn;Ct(ge,pi,Bn,le)}}}function Et(Xe,st,tt){l.push(Xe),l.push(st),l.push(tt)}function Tt(Xe,st,tt){un(Xe),un(st),un(tt);let vt=r.length/3,yt=P.generateTopUV(n,r,vt-3,vt-2,vt-1);Gt(yt[0]),Gt(yt[1]),Gt(yt[2])}function Ct(Xe,st,tt,vt){un(Xe),un(st),un(vt),un(st),un(tt),un(vt);let yt=r.length/3,ln=P.generateSideWallUV(n,r,yt-6,yt-3,yt-2,yt-1);Gt(ln[0]),Gt(ln[1]),Gt(ln[3]),Gt(ln[1]),Gt(ln[2]),Gt(ln[3])}function un(Xe){r.push(l[Xe*3+0]),r.push(l[Xe*3+1]),r.push(l[Xe*3+2])}function Gt(Xe){s.push(Xe.x),s.push(Xe.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return _ue(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 PT[r.type]().fromJSON(r)),new i(n,e.options)}},gue={generateTopUV:function(i,e,t,n,r){let s=e[t*3],o=e[t*3+1],a=e[n*3],l=e[n*3+1],c=e[r*3],u=e[r*3+1];return[new Oe(s,o),new Oe(a,l),new Oe(c,u)]},generateSideWallUV:function(i,e,t,n,r,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[n*3],u=e[n*3+1],f=e[n*3+2],p=e[r*3],x=e[r*3+1],v=e[r*3+2],w=e[s*3],S=e[s*3+1],T=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Oe(o,1-l),new Oe(c,1-f),new Oe(p,1-v),new Oe(w,1-T)]:[new Oe(a,1-l),new Oe(u,1-f),new Oe(x,1-v),new Oe(S,1-T)]}};function _ue(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 IA=class i extends qn{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let s=e/2,o=t/2,a=Math.floor(n),l=Math.floor(r),c=a+1,u=l+1,f=e/a,p=t/l,x=[],v=[],w=[],S=[];for(let T=0;T<u;T++){let P=T*p-o;for(let R=0;R<c;R++){let C=R*f-s;v.push(C,-P,0),w.push(0,0,1),S.push(R/a),S.push(1-T/l)}}for(let T=0;T<l;T++)for(let P=0;P<a;P++){let R=P+c*T,C=P+c*(T+1),L=P+1+c*(T+1),D=P+1+c*T;x.push(R,C,D),x.push(C,L,D)}this.setIndex(x),this.setAttribute("position",new Rn(v,3)),this.setAttribute("normal",new Rn(w,3)),this.setAttribute("uv",new Rn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.widthSegments,e.heightSegments)}};var Aa=class i extends qn{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let l=Math.min(o+a,Math.PI),c=0,u=[],f=new ie,p=new ie,x=[],v=[],w=[],S=[];for(let T=0;T<=n;T++){let P=[],R=T/n,C=o+R*a,L=e*Math.cos(C),D=Math.sqrt(e*e-L*L),F=0;T===0&&o===0?F=.5/t:T===n&&l===Math.PI&&(F=-.5/t);for(let N=0;N<=t;N++){let B=N/t,z=r+B*s;f.x=-D*Math.cos(z),f.y=L,f.z=D*Math.sin(z),v.push(f.x,f.y,f.z),p.copy(f).normalize(),w.push(p.x,p.y,p.z),S.push(B+F,1-R),P.push(c++)}u.push(P)}for(let T=0;T<n;T++)for(let P=0;P<t;P++){let R=u[T][P+1],C=u[T][P],L=u[T+1][P],D=u[T+1][P+1];(T!==0||o>0)&&x.push(R,C,D),(T!==n-1||l<Math.PI)&&x.push(C,L,D)}this.setIndex(x),this.setAttribute("position",new Rn(v,3)),this.setAttribute("normal",new Rn(w,3)),this.setAttribute("uv",new Rn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var Uy=class i extends qn{constructor(e=new Iy(new ie(-1,-1,0),new ie(-1,1,0),new ie(1,1,0)),t=64,n=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:s};let o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;let a=new ie,l=new ie,c=new Oe,u=new ie,f=[],p=[],x=[],v=[];w(),this.setIndex(v),this.setAttribute("position",new Rn(f,3)),this.setAttribute("normal",new Rn(p,3)),this.setAttribute("uv",new Rn(x,2));function w(){for(let R=0;R<t;R++)S(R);S(s===!1?t:0),P(),T()}function S(R){u=e.getPointAt(R/t,u);let C=o.normals[R],L=o.binormals[R];for(let D=0;D<=r;D++){let F=D/r*Math.PI*2,N=Math.sin(F),B=-Math.cos(F);l.x=B*C.x+N*L.x,l.y=B*C.y+N*L.y,l.z=B*C.z+N*L.z,l.normalize(),p.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,f.push(a.x,a.y,a.z)}}function T(){for(let R=1;R<=t;R++)for(let C=1;C<=r;C++){let L=(r+1)*(R-1)+(C-1),D=(r+1)*R+(C-1),F=(r+1)*R+C,N=(r+1)*(R-1)+C;v.push(L,D,N),v.push(D,F,N)}}function P(){for(let R=0;R<=t;R++)for(let C=0;C<=r;C++)c.x=R/t,c.y=C/r,x.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new i(new PT[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},ky=class extends qn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new ie,s=new ie;if(e.index!==null){let o=e.attributes.position,a=e.index,l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){let f=l[c],p=f.start,x=f.count;for(let v=p,w=p+x;v<w;v+=3)for(let S=0;S<3;S++){let T=a.getX(v+S),P=a.getX(v+(S+1)%3);r.fromBufferAttribute(o,T),s.fromBufferAttribute(o,P),WH(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),WH(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Rn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function WH(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 Gy=class extends Es{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ut(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};function $A(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(jH(r))r.isRenderTargetTexture?(je("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(jH(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 Ho(i){let e={};for(let t=0;t<i.length;t++){let n=$A(i[t]);for(let r in n)e[r]=n[r]}return e}function jH(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function xue(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function LL(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:sn.workingColorSpace}var YA={clone:$A,merge:Ho},yue=`void main() {1010 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );11-}`,xue=`void main() {11+}`,vue=`void main() {1212 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );13-}`,$r=class extends Ss{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=_ue,this.fragmentShader=xue,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=jA(e.uniforms),this.uniformsGroups=gue(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let r in this.uniforms){let o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new Ut().setHex(r.value);break;case"v2":this.uniforms[n].value=new Oe().fromArray(r.value);break;case"v3":this.uniforms[n].value=new ie().fromArray(r.value);break;case"v4":this.uniforms[n].value=new gn().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Sn().fromArray(r.value);break;case"m4":this.uniforms[n].value=new on().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},PT=class extends $r{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},S_=class extends Ss{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ut(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=vl,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 fa,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}},ky=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 In(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ut(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ut(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ut(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},PA=class extends Ss{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ut(16777215),this.specular=new Ut(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=vl,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 fa,this.combine=FA,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}},Gy=class extends Ss{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ut(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=vl,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}},zy=class extends Ss{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=vl,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}},ma=class extends Ss{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=vl,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 fa,this.combine=FA,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}},IT=class extends Ss{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=rW,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}},NT=class extends Ss{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}},Vy=class extends Ss{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ut(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=vl,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}},qy=class extends gl{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 pT(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var ep=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_(){}},LT=class extends ep{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:HN,endingEnd:HN}}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 WN:s=e,a=2*t-n;break;case jN: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 WN:o=e,l=2*n-t;break;case jN:o=1,l=n+r[1]-r[0];break;default:o=e-1,l=t}let c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,f=this._offsetNext,p=this._weightPrev,x=this._weightNext,v=(n-t)/(r-t),w=v*v,S=w*v,T=-p*S+2*p*w-p*v,P=(1+p)*S+(-1.5-2*p)*w+(-.5+p)*v+1,R=(-1-x)*S+(1.5+x)*w+.5*v,C=x*S-x*w;for(let L=0;L!==a;++L)s[L]=T*o[u+L]+P*o[c+L]+R*o[l+L]+C*o[f+L];return s}},DT=class extends ep{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(r-t),f=1-u;for(let p=0;p!==a;++p)s[p]=o[c+p]*f+o[l+p]*u;return s}},FT=class extends ep{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},OT=class extends ep{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 v=(n-t)/(r-t),w=1-v;for(let S=0;S!==a;++S)s[S]=o[c+S]*w+o[l+S]*v;return s}let p=a*2,x=e-1;for(let v=0;v!==a;++v){let w=o[c+v],S=o[l+v],T=x*p+v*2,P=f[T],R=f[T+1],C=e*p+v*2,L=u[C],D=u[C+1],F=(n-t)/(r-t),N,B,z,V,H;for(let Z=0;Z<8;Z++){N=F*F,B=N*F,z=1-F,V=z*z,H=V*z;let j=H*t+3*V*F*P+3*z*N*L+B*r-n;if(Math.abs(j)<1e-10)break;let K=3*V*(P-t)+6*z*F*(L-P)+3*N*(r-L);if(Math.abs(K)<1e-10)break;F=F-j/K,F=Math.max(0,Math.min(1,F))}s[v]=H*w+3*V*F*R+3*z*N*D+B*S}return s}},_l=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=pT(t,this.TimeBufferType),this.values=pT(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:pT(e.times,Array),values:pT(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new FT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new DT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new LT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new OT(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 yy:t=this.InterpolantFactoryMethodDiscrete;break;case yT:t=this.InterpolantFactoryMethodLinear;break;case _T:t=this.InterpolantFactoryMethodSmooth;break;case qN:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return je("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return yy;case this.InterpolantFactoryMethodLinear:return yT;case this.InterpolantFactoryMethodSmooth:return _T;case this.InterpolantFactoryMethodBezier:return qN}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,s=0,o=r-1;for(;s!==r&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(Ge("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,s=n.length;s===0&&(Ge("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){Ge("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){Ge("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&I_(r))for(let a=0,l=r.length;a!==l;++a){let c=r[a];if(isNaN(c)){Ge("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===_T,s=e.length-1,o=1;for(let a=1;a<s;++a){let l=!1,c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{let f=a*n,p=f-n,x=f+n;for(let v=0;v!==n;++v){let w=t[f+v];if(w!==t[p+v]||w!==t[x+v]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let f=a*n,p=o*n;for(let x=0;x!==n;++x)t[p+x]=t[f+x]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};_l.prototype.ValueTypeName="";_l.prototype.TimeBufferType=Float32Array;_l.prototype.ValueBufferType=Float32Array;_l.prototype.DefaultInterpolation=yT;var tp=class extends _l{constructor(e,t,n){super(e,t,n)}};tp.prototype.ValueTypeName="bool";tp.prototype.ValueBufferType=Array;tp.prototype.DefaultInterpolation=yy;tp.prototype.InterpolantFactoryMethodLinear=void 0;tp.prototype.InterpolantFactoryMethodSmooth=void 0;var BT=class extends _l{constructor(e,t,n,r){super(e,t,n,r)}};BT.prototype.ValueTypeName="color";var UT=class extends _l{constructor(e,t,n,r){super(e,t,n,r)}};UT.prototype.ValueTypeName="number";var kT=class extends ep{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)bs.slerpFlat(s,0,o,c-a,o,c,l);return s}},Hy=class extends _l{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new kT(this.times,this.values,this.getValueSize(),e)}};Hy.prototype.ValueTypeName="quaternion";Hy.prototype.InterpolantFactoryMethodSmooth=void 0;var np=class extends _l{constructor(e,t,n){super(e,t,n)}};np.prototype.ValueTypeName="string";np.prototype.ValueBufferType=Array;np.prototype.DefaultInterpolation=yy;np.prototype.InterpolantFactoryMethodLinear=void 0;np.prototype.InterpolantFactoryMethodSmooth=void 0;var GT=class extends _l{constructor(e,t,n,r){super(e,t,n,r)}};GT.prototype.ValueTypeName="vector";var xT={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(WH(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!WH(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function WH(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var zT=class{constructor(e,t,n){let r=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return u=u.normalize("NFC"),l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,f){return c.push(u,f),this},this.removeHandler=function(u){let f=c.indexOf(u);return f!==-1&&c.splice(f,2),this},this.getHandler=function(u){for(let f=0,p=c.length;f<p;f+=2){let x=c[f],v=c[f+1];if(x.global&&(x.lastIndex=0),x.test(u))return v}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},dW=new zT,ip=class{constructor(e){this.manager=e!==void 0?e:dW,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}};ip.DEFAULT_MATERIAL_NAME="__DEFAULT";var o_=new WeakMap,VT=class extends ip{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=xT.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=o_.get(o);f===void 0&&(f=[],o_.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=f_("img");function l(){u(),t&&t(this);let f=o_.get(this)||[];for(let p=0;p<f.length;p++){let x=f[p];x.onLoad&&x.onLoad(this)}o_.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),xT.remove(`image:${e}`);let p=o_.get(this)||[];for(let x=0;x<p.length;x++){let v=p[x];v.onError&&v.onError(f)}o_.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),xT.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var xl=class extends ip{constructor(e){super(e)}load(e,t,n,r){let s=new ws,o=new VT(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}},zu=class extends Yi{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ut(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},Wy=class extends zu{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Yi.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ut(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},zN=new on,jH=new ie,XH=new ie,jy=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=zi,this.map=null,this.mapPass=null,this.matrix=new on,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ec,this._frameExtents=new Oe(1,1),this._viewportCount=1,this._viewports=[new gn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;jH.setFromMatrixPosition(e.matrixWorld),t.position.copy(jH),XH.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(XH),t.updateMatrixWorld(),zN.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(zN,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===Ha||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(zN)}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}},AT=new ie,mT=new bs,Bu=new ie,Df=class extends Yi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new on,this.projectionMatrix=new on,this.projectionMatrixInverse=new on,this.coordinateSystem=mo,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(AT,mT,Bu),Bu.x===1&&Bu.y===1&&Bu.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(AT,mT,Bu.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(AT,mT,Bu),Bu.x===1&&Bu.y===1&&Bu.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(AT,mT,Bu.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Hd=new ie,$H=new Oe,YH=new Oe,Ir=class extends Df{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=Rf*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(my*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Rf*2*Math.atan(Math.tan(my*.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){Hd.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Hd.x,Hd.y).multiplyScalar(-e/Hd.z),Hd.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Hd.x,Hd.y).multiplyScalar(-e/Hd.z)}getViewSize(e,t){return this.getViewBounds(e,$H,YH),t.subVectors(YH,$H)}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(my*.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}},KN=class extends jy{constructor(){super(new Ir(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Rf*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}},IA=class extends zu{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(Yi.DEFAULT_UP),this.updateMatrix(),this.target=new Yi,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new KN}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}},QN=class extends jy{constructor(){super(new Ir(90,1,.5,500)),this.isPointLightShadow=!0}},Xy=class extends zu{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 QN}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}},Hc=class extends Df{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,s=n-e,o=n+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},JN=class extends jy{constructor(){super(new Hc(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},NA=class extends zu{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Yi.DEFAULT_UP),this.updateMatrix(),this.target=new Yi,this.shadow=new JN}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},LA=class extends zu{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},$y=class extends zu{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}},qT=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new ie)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){let n=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-r*r)}},Yy=class extends zu{constructor(e=new qT,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 Zy=class extends qn{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 a_=-90,l_=1,T_=class extends Yi{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Ir(a_,l_,e,t);r.layers=this.layers,this.add(r);let s=new Ir(a_,l_,e,t);s.layers=this.layers,this.add(s);let o=new Ir(a_,l_,e,t);o.layers=this.layers,this.add(o);let a=new Ir(a_,l_,e,t);a.layers=this.layers,this.add(a);let l=new Ir(a_,l_,e,t);l.layers=this.layers,this.add(l);let c=new Ir(a_,l_,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===mo)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===Ha)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[s,o,a,l,c,u]=this.children,f=e.getRenderTarget(),p=e.getActiveCubeFace(),x=e.getActiveMipmapLevel(),v=e.xr.enabled;e.xr.enabled=!1;let w=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let S=!1;e.isWebGLRenderer===!0?S=e.state.buffers.depth.getReversed():S=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,2,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,3,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=w,e.setRenderTarget(n,5,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(f,p,x),e.xr.enabled=v,n.texture.needsPMREMUpdate=!0}},E_=class extends Ir{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},DA=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=yue.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 yue(){this._document.hidden===!1&&this.reset()}var ML="\\[\\]\\.:\\/",vue=new RegExp("["+ML+"]","g"),CL="[^"+ML+"]",bue="[^"+ML.replace("\\.","")+"]",wue=/((?:WC+[\/:])*)/.source.replace("WC",CL),Sue=/(WCOD+)?/.source.replace("WCOD",bue),Tue=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",CL),Eue=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",CL),Mue=new RegExp("^"+wue+Sue+Tue+Eue+"$"),Cue=["material","materials","bones","map"],eL=class{constructor(e,t,n){let r=n||ur.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()}},ur=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(vue,"")}static parseTrackName(e){let t=Mue.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);Cue.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=i.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){je("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Ge("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Ge("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Ge("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Ge("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){Ge("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let o=e[r];if(o===void 0){let c=t.nodeName;Ge("PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){Ge("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Ge("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};ur.Composite=eL;ur.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};ur.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};ur.prototype.GetterByBindingType=[ur.prototype._getValue_direct,ur.prototype._getValue_array,ur.prototype._getValue_arrayElement,ur.prototype._getValue_toArray];ur.prototype.SetterByBindingTypeAndVersioning=[[ur.prototype._setValue_direct,ur.prototype._setValue_direct_setNeedsUpdate,ur.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[ur.prototype._setValue_array,ur.prototype._setValue_array_setNeedsUpdate,ur.prototype._setValue_array_setMatrixWorldNeedsUpdate],[ur.prototype._setValue_arrayElement,ur.prototype._setValue_arrayElement_setNeedsUpdate,ur.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[ur.prototype._setValue_fromArray,ur.prototype._setValue_fromArray_setNeedsUpdate,ur.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var $ze=new Float32Array(1);var Vu=class extends Pf{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 ZH=new on,Ky=class{constructor(e,t,n=0,r=1/0){this.ray=new Nf(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new A_,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Ge("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return ZH.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(ZH),this}intersectObject(e,t=!0,n=[]){return tL(e,this,n,t),n.sort(KH),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)tL(e[r],this,n,t);return n.sort(KH),n}};function KH(i,e){return i.distance-e.distance}function tL(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++)tL(s[o],e,t,!0)}}var M_=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=In(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(In(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var LL=class LL{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}};LL.prototype.isMatrix2=!0;var C_=LL,QH=new Oe,HT=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=QH.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,QH).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)}},JH=new ie,gT=new ie,c_=new ie,u_=new ie,VN=new ie,Rue=new ie,Pue=new ie,Qy=class{constructor(e=new ie,t=new ie){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){JH.subVectors(e,this.start),gT.subVectors(this.end,this.start);let n=gT.dot(gT);if(n===0)return 0;let s=gT.dot(JH)/n;return t&&(s=In(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=Rue,n=Pue){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;c_.subVectors(c,a),u_.subVectors(u,l),VN.subVectors(a,l);let f=c_.dot(c_),p=u_.dot(u_),x=u_.dot(VN);if(f<=r&&p<=r)return t.copy(a),n.copy(l),t.sub(n),t.dot(t);if(f<=r)s=0,o=x/p,o=In(o,0,1);else{let v=c_.dot(VN);if(p<=r)o=0,s=In(-v/f,0,1);else{let w=c_.dot(u_),S=f*p-w*w;S!==0?s=In((w*x-v*p)/S,0,1):s=0,o=(w*s+x)/p,o<0?(o=0,s=In(-v/f,0,1)):o>1&&(o=1,s=In((w-v)/f,0,1))}}return t.copy(a).addScaledVector(c_,s),n.copy(l).addScaledVector(u_,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 Jy=class{constructor(){this.type="ShapePath",this.color=new Ut,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new MA,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,o){return this.currentPath.bezierCurveTo(e,t,n,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(l,c){let u=!1,f=c.length;for(let p=0,x=f-1;p<f;x=p++){let v=c[p],w=c[x];v.y>l.y!=w.y>l.y&&l.x<(w.x-v.x)*(l.y-v.y)/(w.y-v.y)+v.x&&(u=!u)}return u}function t(l,c){let u=c.getCenter(new Oe);if(e(u,l))return u;let f=u.y,p=[],x=l.length;for(let v=0;v<x;v++){let w=l[v],S=l[(v+1)%x];if(w.y>f!=S.y>f){let T=w.x+(f-w.y)*(S.x-w.x)/(S.y-w.y);p.push(T)}}return p.length>1&&(p.sort((v,w)=>v-w),u.x=(p[0]+p[1])/2),u}let n=this.userData.style&&this.userData.style.fillRule||"nonzero";n!=="nonzero"&&n!=="evenodd"&&(je('Fill-rule "'+n+'" is not supported, falling back to "nonzero".'),n="nonzero");let r=n==="nonzero"?(l=>l!==0):(l=>(l&1)!==0),s=[];for(let l of this.subPaths){let c=l.getPoints();if(c.length<3)continue;let u=Wd.area(c);if(u===0)continue;let f=new HT;for(let p=0;p<c.length;p++)f.expandByPoint(c[p]);s.push({subPath:l,points:c,boundingBox:f,interiorPoint:t(c,f),absArea:Math.abs(u),winding:u<0?-1:1,container:null,exclude:!1,role:null})}s.sort((l,c)=>c.absArea-l.absArea);for(let l=0;l<s.length;l++){let c=s[l],u=0;for(let f=l-1;f>=0;f--){let p=s[f];if(p.boundingBox.containsBox(c.boundingBox)&&e(c.interiorPoint,p.points)){c.container=p.exclude?p.container:p,u=p.winding,c.winding+=u;break}}r(c.winding)===r(u)&&(c.exclude=!0)}for(let l of s)l.exclude||(l.role=l.container===null||l.container.role==="hole"?"outer":"hole");let o=[],a=new Map;for(let l of s){if(l.exclude||l.role!=="outer")continue;let c=new Iy;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 MA;u.curves=l.subPath.curves,c.holes.push(u)}return o}},Ff=class extends zo{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){je("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function M2(i,e,t,n){let r=Iue(n);switch(t){case R_:return i*e;case Uf:return i*e/r.components*r.byteLength;case Yu:return i*e/r.components*r.byteLength;case Ts:return i*e*2/r.components*r.byteLength;case Zu:return i*e*2/r.components*r.byteLength;case Bf:return i*e*3/r.components*r.byteLength;case vr:return i*e*4/r.components*r.byteLength;case cp:return i*e*4/r.components*r.byteLength;case Ku:case Qu:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Ju:case eh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case zA:case qA:return Math.max(i,16)*Math.max(e,8)/4;case GA:case VA:return Math.max(i,8)*Math.max(e,8)/2;case up:case hp:case dp:case pp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case fp:case th:case Ap:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case mp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case gp:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case _p:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case xp:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case yp:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case vp:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case bp:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case wp:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Sp:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case Tp:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case Ep:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case Mp:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case Cp:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case Rp:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Pp:case Ip:case Np:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Lp:case Dp:return Math.ceil(i/4)*Math.ceil(e/4)*8;case nh:case Fp:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Iue(i){switch(i){case zi:case Xu:return{byteLength:1,components:1};case ja:case $u:case Di:return{byteLength:2,components:1};case OA:case BA:return{byteLength:2,components:4};case pi:case Dr:case Zi:return{byteLength:4,components:1};case UA:case kA:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}}));typeof window<"u"&&(window.__THREE__?je("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");function BW(){let i=null,e=!1,t=null,n=null;function r(s,o){t(s,o),n=i.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){i=s}}}function Due(i){let e=new WeakMap;function t(a,l){let c=a.array,u=a.usage,f=c.byteLength,p=i.createBuffer();i.bindBuffer(l,p),i.bufferData(l,c,u),a.onUploadCallback();let x;if(c instanceof Float32Array)x=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)x=i.HALF_FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?x=i.HALF_FLOAT:x=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)x=i.SHORT;else if(c instanceof Uint32Array)x=i.UNSIGNED_INT;else if(c instanceof Int32Array)x=i.INT;else if(c instanceof Int8Array)x=i.BYTE;else if(c instanceof Uint8Array)x=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)x=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:p,type:x,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function n(a,l,c){let u=l.array,f=l.updateRanges;if(i.bindBuffer(c,a),f.length===0)i.bufferSubData(c,0,u);else{f.sort((x,v)=>x.start-v.start);let p=0;for(let x=1;x<f.length;x++){let v=f[p],w=f[x];w.start<=v.start+v.count+1?v.count=Math.max(v.count,w.start+w.count-v.start):(++p,f[p]=w)}f.length=p+1;for(let x=0,v=f.length;x<v;x++){let w=f[x];i.bufferSubData(c,w.start*u.BYTES_PER_ELEMENT,u,w.start,w.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);let l=e.get(a);l&&(i.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){let u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}var Fue=`#ifdef USE_ALPHAHASH13+}`,$r=class extends Es{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=yue,this.fragmentShader=vue,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=$A(e.uniforms),this.uniformsGroups=xue(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let r in this.uniforms){let o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(let n in e.uniforms){let r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new Ut().setHex(r.value);break;case"v2":this.uniforms[n].value=new Oe().fromArray(r.value);break;case"v3":this.uniforms[n].value=new ie().fromArray(r.value);break;case"v4":this.uniforms[n].value=new gn().fromArray(r.value);break;case"m3":this.uniforms[n].value=new Sn().fromArray(r.value);break;case"m4":this.uniforms[n].value=new on().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(let n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}},NT=class extends $r{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},T_=class extends Es{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ut(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bl,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 fa,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}},zy=class extends T_{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 In(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ut(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ut(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ut(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},NA=class extends Es{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ut(16777215),this.specular=new Ut(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bl,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 fa,this.combine=BA,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}},Vy=class extends Es{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ut(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bl,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}},qy=class extends Es{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bl,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}},ma=class extends Es{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bl,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 fa,this.combine=BA,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}},LT=class extends Es{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=oW,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}},DT=class extends Es{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}},Hy=class extends Es{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ut(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=bl,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}},Wy=class extends xl{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 mT(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var tp=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_(){}},FT=class extends tp{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:KN,endingEnd:KN}}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 QN:s=e,a=2*t-n;break;case JN: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 QN:o=e,l=2*n-t;break;case JN:o=1,l=n+r[1]-r[0];break;default:o=e-1,l=t}let c=(n-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-n),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,f=this._offsetNext,p=this._weightPrev,x=this._weightNext,v=(n-t)/(r-t),w=v*v,S=w*v,T=-p*S+2*p*w-p*v,P=(1+p)*S+(-1.5-2*p)*w+(-.5+p)*v+1,R=(-1-x)*S+(1.5+x)*w+.5*v,C=x*S-x*w;for(let L=0;L!==a;++L)s[L]=T*o[u+L]+P*o[c+L]+R*o[l+L]+C*o[f+L];return s}},OT=class extends tp{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(r-t),f=1-u;for(let p=0;p!==a;++p)s[p]=o[c+p]*f+o[l+p]*u;return s}},BT=class extends tp{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},UT=class extends tp{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 v=(n-t)/(r-t),w=1-v;for(let S=0;S!==a;++S)s[S]=o[c+S]*w+o[l+S]*v;return s}let p=a*2,x=e-1;for(let v=0;v!==a;++v){let w=o[c+v],S=o[l+v],T=x*p+v*2,P=f[T],R=f[T+1],C=e*p+v*2,L=u[C],D=u[C+1],F=(n-t)/(r-t),N,B,z,V,H;for(let Z=0;Z<8;Z++){N=F*F,B=N*F,z=1-F,V=z*z,H=V*z;let j=H*t+3*V*F*P+3*z*N*L+B*r-n;if(Math.abs(j)<1e-10)break;let K=3*V*(P-t)+6*z*F*(L-P)+3*N*(r-L);if(Math.abs(K)<1e-10)break;F=F-j/K,F=Math.max(0,Math.min(1,F))}s[v]=H*w+3*V*F*R+3*z*N*D+B*S}return s}},yl=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=mT(t,this.TimeBufferType),this.values=mT(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:mT(e.times,Array),values:mT(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new BT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new OT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new FT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new UT(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 by:t=this.InterpolantFactoryMethodDiscrete;break;case bT:t=this.InterpolantFactoryMethodLinear;break;case yT:t=this.InterpolantFactoryMethodSmooth;break;case ZN:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return je("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return by;case this.InterpolantFactoryMethodLinear:return bT;case this.InterpolantFactoryMethodSmooth:return yT;case this.InterpolantFactoryMethodBezier:return ZN}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,s=0,o=r-1;for(;s!==r&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(Ge("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,s=n.length;s===0&&(Ge("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){Ge("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){Ge("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&N_(r))for(let a=0,l=r.length;a!==l;++a){let c=r[a];if(isNaN(c)){Ge("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===yT,s=e.length-1,o=1;for(let a=1;a<s;++a){let l=!1,c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{let f=a*n,p=f-n,x=f+n;for(let v=0;v!==n;++v){let w=t[f+v];if(w!==t[p+v]||w!==t[x+v]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let f=a*n,p=o*n;for(let x=0;x!==n;++x)t[p+x]=t[f+x]}++o}}if(s>0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};yl.prototype.ValueTypeName="";yl.prototype.TimeBufferType=Float32Array;yl.prototype.ValueBufferType=Float32Array;yl.prototype.DefaultInterpolation=bT;var np=class extends yl{constructor(e,t,n){super(e,t,n)}};np.prototype.ValueTypeName="bool";np.prototype.ValueBufferType=Array;np.prototype.DefaultInterpolation=by;np.prototype.InterpolantFactoryMethodLinear=void 0;np.prototype.InterpolantFactoryMethodSmooth=void 0;var kT=class extends yl{constructor(e,t,n,r){super(e,t,n,r)}};kT.prototype.ValueTypeName="color";var GT=class extends yl{constructor(e,t,n,r){super(e,t,n,r)}};GT.prototype.ValueTypeName="number";var zT=class extends tp{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)Ss.slerpFlat(s,0,o,c-a,o,c,l);return s}},jy=class extends yl{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new zT(this.times,this.values,this.getValueSize(),e)}};jy.prototype.ValueTypeName="quaternion";jy.prototype.InterpolantFactoryMethodSmooth=void 0;var ip=class extends yl{constructor(e,t,n){super(e,t,n)}};ip.prototype.ValueTypeName="string";ip.prototype.ValueBufferType=Array;ip.prototype.DefaultInterpolation=by;ip.prototype.InterpolantFactoryMethodLinear=void 0;ip.prototype.InterpolantFactoryMethodSmooth=void 0;var VT=class extends yl{constructor(e,t,n,r){super(e,t,n,r)}};VT.prototype.ValueTypeName="vector";var vT={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(XH(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!XH(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function XH(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var qT=class{constructor(e,t,n){let r=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return u=u.normalize("NFC"),l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,f){return c.push(u,f),this},this.removeHandler=function(u){let f=c.indexOf(u);return f!==-1&&c.splice(f,2),this},this.getHandler=function(u){for(let f=0,p=c.length;f<p;f+=2){let x=c[f],v=c[f+1];if(x.global&&(x.lastIndex=0),x.test(u))return v}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},AW=new qT,rp=class{constructor(e){this.manager=e!==void 0?e:AW,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}};rp.DEFAULT_MATERIAL_NAME="__DEFAULT";var l_=new WeakMap,HT=class extends rp{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=vT.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=l_.get(o);f===void 0&&(f=[],l_.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=p_("img");function l(){u(),t&&t(this);let f=l_.get(this)||[];for(let p=0;p<f.length;p++){let x=f[p];x.onLoad&&x.onLoad(this)}l_.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),vT.remove(`image:${e}`);let p=l_.get(this)||[];for(let x=0;x<p.length;x++){let v=p[x];v.onError&&v.onError(f)}l_.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),vT.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var ja=class extends rp{constructor(e){super(e)}load(e,t,n,r){let s=new Ts,o=new HT(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}},qu=class extends Yi{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ut(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},Xy=class extends qu{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Yi.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ut(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},$N=new on,$H=new ie,YH=new ie,$y=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=zi,this.map=null,this.mapPass=null,this.matrix=new on,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new tc,this._frameExtents=new Oe(1,1),this._viewportCount=1,this._viewports=[new gn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;$H.setFromMatrixPosition(e.matrixWorld),t.position.copy($H),YH.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(YH),t.updateMatrixWorld(),$N.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix($N,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===Ha||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($N)}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}},gT=new ie,_T=new Ss,Uu=new ie,Ff=class extends Yi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new on,this.projectionMatrix=new on,this.projectionMatrixInverse=new on,this.coordinateSystem=mo,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(gT,_T,Uu),Uu.x===1&&Uu.y===1&&Uu.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(gT,_T,Uu.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(gT,_T,Uu),Uu.x===1&&Uu.y===1&&Uu.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(gT,_T,Uu.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Wd=new ie,ZH=new Oe,KH=new Oe,Nr=class extends Ff{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=If*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(_y*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return If*2*Math.atan(Math.tan(_y*.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){Wd.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Wd.x,Wd.y).multiplyScalar(-e/Wd.z),Wd.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Wd.x,Wd.y).multiplyScalar(-e/Wd.z)}getViewSize(e,t){return this.getViewBounds(e,ZH,KH),t.subVectors(KH,ZH)}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(_y*.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}},rL=class extends $y{constructor(){super(new Nr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=If*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}},LA=class extends qu{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(Yi.DEFAULT_UP),this.updateMatrix(),this.target=new Yi,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new rL}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}},sL=class extends $y{constructor(){super(new Nr(90,1,.5,500)),this.isPointLightShadow=!0}},Yy=class extends qu{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 sL}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}},Wc=class extends Ff{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}},oL=class extends $y{constructor(){super(new Wc(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},DA=class extends qu{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Yi.DEFAULT_UP),this.updateMatrix(),this.target=new Yi,this.shadow=new oL}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}},FA=class extends qu{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},Zy=class extends qu{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}},WT=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new ie)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*n),t.addScaledVector(o[4],1.092548*(n*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(n*s)),t.addScaledVector(o[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){let n=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*n),t.addScaledVector(o[4],2*.429043*n*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*n*s),t.addScaledVector(o[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){let n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){let n=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-r*r)}},Ky=class extends qu{constructor(e=new WT,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 Qy=class extends qn{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 c_=-90,u_=1,E_=class extends Yi{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Nr(c_,u_,e,t);r.layers=this.layers,this.add(r);let s=new Nr(c_,u_,e,t);s.layers=this.layers,this.add(s);let o=new Nr(c_,u_,e,t);o.layers=this.layers,this.add(o);let a=new Nr(c_,u_,e,t);a.layers=this.layers,this.add(a);let l=new Nr(c_,u_,e,t);l.layers=this.layers,this.add(l);let c=new Nr(c_,u_,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===mo)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===Ha)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[s,o,a,l,c,u]=this.children,f=e.getRenderTarget(),p=e.getActiveCubeFace(),x=e.getActiveMipmapLevel(),v=e.xr.enabled;e.xr.enabled=!1;let w=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let S=!1;e.isWebGLRenderer===!0?S=e.state.buffers.depth.getReversed():S=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,2,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,3,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),n.texture.generateMipmaps=w,e.setRenderTarget(n,5,r),S&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(f,p,x),e.xr.enabled=v,n.texture.needsPMREMUpdate=!0}},M_=class extends Nr{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},OA=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=bue.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 bue(){this._document.hidden===!1&&this.reset()}var DL="\\[\\]\\.:\\/",wue=new RegExp("["+DL+"]","g"),FL="[^"+DL+"]",Sue="[^"+DL.replace("\\.","")+"]",Tue=/((?:WC+[\/:])*)/.source.replace("WC",FL),Eue=/(WCOD+)?/.source.replace("WCOD",Sue),Mue=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",FL),Cue=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",FL),Rue=new RegExp("^"+Tue+Eue+Mue+Cue+"$"),Pue=["material","materials","bones","map"],aL=class{constructor(e,t,n){let r=n||ur.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()}},ur=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(wue,"")}static parseTrackName(e){let t=Rue.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);Pue.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=i.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){je("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Ge("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Ge("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Ge("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Ge("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){Ge("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let o=e[r];if(o===void 0){let c=t.nodeName;Ge("PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){Ge("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Ge("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};ur.Composite=aL;ur.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};ur.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};ur.prototype.GetterByBindingType=[ur.prototype._getValue_direct,ur.prototype._getValue_array,ur.prototype._getValue_arrayElement,ur.prototype._getValue_toArray];ur.prototype.SetterByBindingTypeAndVersioning=[[ur.prototype._setValue_direct,ur.prototype._setValue_direct_setNeedsUpdate,ur.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[ur.prototype._setValue_array,ur.prototype._setValue_array_setNeedsUpdate,ur.prototype._setValue_array_setMatrixWorldNeedsUpdate],[ur.prototype._setValue_arrayElement,ur.prototype._setValue_arrayElement_setNeedsUpdate,ur.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[ur.prototype._setValue_fromArray,ur.prototype._setValue_fromArray_setNeedsUpdate,ur.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Jze=new Float32Array(1);var Hu=class extends Nf{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 QH=new on,Jy=class{constructor(e,t,n=0,r=1/0){this.ray=new Lf(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new g_,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Ge("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return QH.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(QH),this}intersectObject(e,t=!0,n=[]){return lL(e,this,n,t),n.sort(JH),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)lL(e[r],this,n,t);return n.sort(JH),n}};function JH(i,e){return i.distance-e.distance}function lL(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++)lL(s[o],e,t,!0)}}var C_=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=In(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(In(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var GL=class GL{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}};GL.prototype.isMatrix2=!0;var R_=GL,eW=new Oe,jT=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=eW.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,eW).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)}},tW=new ie,xT=new ie,h_=new ie,f_=new ie,YN=new ie,Iue=new ie,Nue=new ie,e2=class{constructor(e=new ie,t=new ie){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){tW.subVectors(e,this.start),xT.subVectors(this.end,this.start);let n=xT.dot(xT);if(n===0)return 0;let s=xT.dot(tW)/n;return t&&(s=In(s,0,1)),s}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=Iue,n=Nue){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;h_.subVectors(c,a),f_.subVectors(u,l),YN.subVectors(a,l);let f=h_.dot(h_),p=f_.dot(f_),x=f_.dot(YN);if(f<=r&&p<=r)return t.copy(a),n.copy(l),t.sub(n),t.dot(t);if(f<=r)s=0,o=x/p,o=In(o,0,1);else{let v=h_.dot(YN);if(p<=r)o=0,s=In(-v/f,0,1);else{let w=h_.dot(f_),S=f*p-w*w;S!==0?s=In((w*x-v*p)/S,0,1):s=0,o=(w*s+x)/p,o<0?(o=0,s=In(-v/f,0,1)):o>1&&(o=1,s=In((w-v)/f,0,1))}}return t.copy(a).addScaledVector(h_,s),n.copy(l).addScaledVector(f_,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 t2=class{constructor(){this.type="ShapePath",this.color=new Ut,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new RA,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,s,o){return this.currentPath.bezierCurveTo(e,t,n,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(l,c){let u=!1,f=c.length;for(let p=0,x=f-1;p<f;x=p++){let v=c[p],w=c[x];v.y>l.y!=w.y>l.y&&l.x<(w.x-v.x)*(l.y-v.y)/(w.y-v.y)+v.x&&(u=!u)}return u}function t(l,c){let u=c.getCenter(new Oe);if(e(u,l))return u;let f=u.y,p=[],x=l.length;for(let v=0;v<x;v++){let w=l[v],S=l[(v+1)%x];if(w.y>f!=S.y>f){let T=w.x+(f-w.y)*(S.x-w.x)/(S.y-w.y);p.push(T)}}return p.length>1&&(p.sort((v,w)=>v-w),u.x=(p[0]+p[1])/2),u}let n=this.userData.style&&this.userData.style.fillRule||"nonzero";n!=="nonzero"&&n!=="evenodd"&&(je('Fill-rule "'+n+'" is not supported, falling back to "nonzero".'),n="nonzero");let r=n==="nonzero"?(l=>l!==0):(l=>(l&1)!==0),s=[];for(let l of this.subPaths){let c=l.getPoints();if(c.length<3)continue;let u=jd.area(c);if(u===0)continue;let f=new jT;for(let p=0;p<c.length;p++)f.expandByPoint(c[p]);s.push({subPath:l,points:c,boundingBox:f,interiorPoint:t(c,f),absArea:Math.abs(u),winding:u<0?-1:1,container:null,exclude:!1,role:null})}s.sort((l,c)=>c.absArea-l.absArea);for(let l=0;l<s.length;l++){let c=s[l],u=0;for(let f=l-1;f>=0;f--){let p=s[f];if(p.boundingBox.containsBox(c.boundingBox)&&e(c.interiorPoint,p.points)){c.container=p.exclude?p.container:p,u=p.winding,c.winding+=u;break}}r(c.winding)===r(u)&&(c.exclude=!0)}for(let l of s)l.exclude||(l.role=l.container===null||l.container.role==="hole"?"outer":"hole");let o=[],a=new Map;for(let l of s){if(l.exclude||l.role!=="outer")continue;let c=new Ly;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 RA;u.curves=l.subPath.curves,c.holes.push(u)}return o}},Of=class extends zo{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){je("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}};function R2(i,e,t,n){let r=Lue(n);switch(t){case P_:return i*e;case kf:return i*e/r.components*r.byteLength;case Ku:return i*e/r.components*r.byteLength;case Ms:return i*e*2/r.components*r.byteLength;case Qu:return i*e*2/r.components*r.byteLength;case Uf:return i*e*3/r.components*r.byteLength;case br:return i*e*4/r.components*r.byteLength;case up:return i*e*4/r.components*r.byteLength;case Ju:case eh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case th:case nh:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case qA:case WA:return Math.max(i,16)*Math.max(e,8)/4;case VA:case HA:return Math.max(i,8)*Math.max(e,8)/2;case hp:case fp:case pp:case Ap:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case dp:case ih:case mp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case gp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case _p:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case xp:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case yp:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case vp:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case bp:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case wp:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case Sp:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Tp:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case Ep:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case Mp:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case Cp:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case Rp:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case Pp:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Ip:case Np:case Lp:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Dp:case Fp:return Math.ceil(i/4)*Math.ceil(e/4)*8;case rh:case Op:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Lue(i){switch(i){case zi:case Yu:return{byteLength:1,components:1};case Xa:case Zu:case Di:return{byteLength:2,components:1};case UA:case kA:return{byteLength:2,components:4};case Ai:case Dr:case Zi:return{byteLength:4,components:1};case GA:case zA:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"185"}}));typeof window<"u"&&(window.__THREE__?je("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="185");function kW(){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 Oue(i){let e=new WeakMap;function t(a,l){let c=a.array,u=a.usage,f=c.byteLength,p=i.createBuffer();i.bindBuffer(l,p),i.bufferData(l,c,u),a.onUploadCallback();let x;if(c instanceof Float32Array)x=i.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)x=i.HALF_FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?x=i.HALF_FLOAT:x=i.UNSIGNED_SHORT;else if(c instanceof Int16Array)x=i.SHORT;else if(c instanceof Uint32Array)x=i.UNSIGNED_INT;else if(c instanceof Int32Array)x=i.INT;else if(c instanceof Int8Array)x=i.BYTE;else if(c instanceof Uint8Array)x=i.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)x=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:p,type:x,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function n(a,l,c){let u=l.array,f=l.updateRanges;if(i.bindBuffer(c,a),f.length===0)i.bufferSubData(c,0,u);else{f.sort((x,v)=>x.start-v.start);let p=0;for(let x=1;x<f.length;x++){let v=f[p],w=f[x];w.start<=v.start+v.count+1?v.count=Math.max(v.count,w.start+w.count-v.start):(++p,f[p]=w)}f.length=p+1;for(let x=0,v=f.length;x<v;x++){let w=f[x];i.bufferSubData(c,w.start*u.BYTES_PER_ELEMENT,u,w.start,w.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);let l=e.get(a);l&&(i.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){let u=e.get(a);(!u||u.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}let c=e.get(a);if(c===void 0)e.set(a,t(a,l));else if(c.version<a.version){if(c.size!==a.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(c.buffer,a,l),c.version=a.version}}return{get:r,remove:s,update:o}}var Bue=`#ifdef USE_ALPHAHASH1414 if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;15-#endif`,Oue=`#ifdef USE_ALPHAHASH15+#endif`,Uue=`#ifdef USE_ALPHAHASH1616 const float ALPHA_HASH_SCALE = 0.05;1717 float hash2D( vec2 value ) {1818 return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
@@ -47,20 +47,20 @@
4747 : cases.z;4848 return clamp( threshold , 1.0e-6, 1.0 );4949 }50-#endif`,Bue=`#ifdef USE_ALPHAMAP50+#endif`,kue=`#ifdef USE_ALPHAMAP5151 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;52-#endif`,Uue=`#ifdef USE_ALPHAMAP52+#endif`,Gue=`#ifdef USE_ALPHAMAP5353 uniform sampler2D alphaMap;54-#endif`,kue=`#ifdef USE_ALPHATEST54+#endif`,zue=`#ifdef USE_ALPHATEST5555 #ifdef ALPHA_TO_COVERAGE5656 diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );5757 if ( diffuseColor.a == 0.0 ) discard;5858 #else5959 if ( diffuseColor.a < alphaTest ) discard;6060 #endif61-#endif`,Gue=`#ifdef USE_ALPHATEST61+#endif`,Vue=`#ifdef USE_ALPHATEST6262 uniform float alphaTest;63-#endif`,zue=`#ifdef USE_AOMAP63+#endif`,que=`#ifdef USE_AOMAP6464 float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;6565 reflectedLight.indirectDiffuse *= ambientOcclusion;6666 #if defined( USE_CLEARCOAT )
@@ -73,10 +73,10 @@
7373 float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );7474 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );7575 #endif76-#endif`,Vue=`#ifdef USE_AOMAP76+#endif`,Hue=`#ifdef USE_AOMAP7777 uniform sampler2D aoMap;7878 uniform float aoMapIntensity;79-#endif`,que=`#ifdef USE_BATCHING79+#endif`,Wue=`#ifdef USE_BATCHING8080 #if ! defined( GL_ANGLE_multi_draw )8181 #define gl_DrawID _gl_DrawID8282 uniform int _gl_DrawID;
@@ -110,15 +110,15 @@
110110 int y = j / size;111111 return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );112112 }113-#endif`,Hue=`#ifdef USE_BATCHING113+#endif`,jue=`#ifdef USE_BATCHING114114 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );115-#endif`,Wue=`vec3 transformed = vec3( position );115+#endif`,Xue=`vec3 transformed = vec3( position );116116 #ifdef USE_ALPHAHASH117117 vPosition = vec3( position );118-#endif`,jue=`vec3 objectNormal = vec3( normal );118+#endif`,$ue=`vec3 objectNormal = vec3( normal );119119 #ifdef USE_TANGENT120120 vec3 objectTangent = vec3( tangent.xyz );121-#endif`,Xue=`float G_BlinnPhong_Implicit( ) {121+#endif`,Yue=`float G_BlinnPhong_Implicit( ) {122122 return 0.25;123123 }124124 float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -132,7 +132,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
132132 float G = G_BlinnPhong_Implicit( );133133 float D = D_BlinnPhong( shininess, dotNH );134134 return F * ( G * D );135-} // validated`,$ue=`#ifdef USE_IRIDESCENCE135+} // validated`,Zue=`#ifdef USE_IRIDESCENCE136136 const mat3 XYZ_TO_REC709 = mat3(137137 3.2404542, -0.9692660, 0.0556434,138138 -1.5371385, 1.8760108, -0.2040259,
@@ -195,7 +195,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
195195 }196196 return max( I, vec3( 0.0 ) );197197 }198-#endif`,Yue=`#ifdef USE_BUMPMAP198+#endif`,Kue=`#ifdef USE_BUMPMAP199199 uniform sampler2D bumpMap;200200 uniform float bumpScale;201201 vec2 dHdxy_fwd() {
@@ -216,7 +216,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
216216 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );217217 return normalize( abs( fDet ) * surf_norm - vGrad );218218 }219-#endif`,Zue=`#if NUM_CLIPPING_PLANES > 0219+#endif`,Que=`#if NUM_CLIPPING_PLANES > 0220220 vec4 plane;221221 #ifdef ALPHA_TO_COVERAGE222222 float distanceToPlane, distanceGradient;
@@ -262,20 +262,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
262262 if ( clipped ) discard;263263 #endif264264 #endif265-#endif`,Kue=`#if NUM_CLIPPING_PLANES > 0265+#endif`,Jue=`#if NUM_CLIPPING_PLANES > 0266266 varying vec3 vClipPosition;267267 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];268-#endif`,Que=`#if NUM_CLIPPING_PLANES > 0268+#endif`,ehe=`#if NUM_CLIPPING_PLANES > 0269269 varying vec3 vClipPosition;270-#endif`,Jue=`#if NUM_CLIPPING_PLANES > 0270+#endif`,the=`#if NUM_CLIPPING_PLANES > 0271271 vClipPosition = - mvPosition.xyz;272-#endif`,ehe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )272+#endif`,nhe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )273273 diffuseColor *= vColor;274-#endif`,the=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )274+#endif`,ihe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )275275 varying vec4 vColor;276-#endif`,nhe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )276+#endif`,rhe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )277277 varying vec4 vColor;278-#endif`,ihe=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )278+#endif`,she=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )279279 vColor = vec4( 1.0 );280280 #endif281281 #ifdef USE_COLOR_ALPHA
@@ -288,7 +288,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
288288 #endif289289 #ifdef USE_BATCHING_COLOR290290 vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );291-#endif`,rhe=`#define PI 3.141592653589793291+#endif`,ohe=`#define PI 3.141592653589793292292 #define PI2 6.283185307179586293293 #define PI_HALF 1.5707963267948966294294 #define RECIPROCAL_PI 0.3183098861837907
@@ -359,7 +359,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
359359 float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {360360 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );361361 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );362-} // validated`,she=`#ifdef ENVMAP_TYPE_CUBE_UV362+} // validated`,ahe=`#ifdef ENVMAP_TYPE_CUBE_UV363363 #define cubeUV_minMipLevel 4.0364364 #define cubeUV_minTileSize 16.0365365 float getFace( vec3 direction ) {
@@ -452,7 +452,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
452452 return vec4( mix( color0, color1, mipF ), 1.0 );453453 }454454 }455-#endif`,ohe=`vec3 transformedNormal = objectNormal;455+#endif`,lhe=`vec3 transformedNormal = objectNormal;456456 #ifdef USE_TANGENT457457 vec3 transformedTangent = objectTangent;458458 #endif
@@ -478,21 +478,21 @@ transformedNormal = normalMatrix * transformedNormal;
478478 #endif479479 #ifdef USE_TANGENT480480 transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;481-#endif`,ahe=`#ifdef USE_DISPLACEMENTMAP481+#endif`,che=`#ifdef USE_DISPLACEMENTMAP482482 uniform sampler2D displacementMap;483483 uniform float displacementScale;484484 uniform float displacementBias;485-#endif`,lhe=`#ifdef USE_DISPLACEMENTMAP485+#endif`,uhe=`#ifdef USE_DISPLACEMENTMAP486486 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );487-#endif`,che=`#ifdef USE_EMISSIVEMAP487+#endif`,hhe=`#ifdef USE_EMISSIVEMAP488488 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );489489 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE490490 emissiveColor = sRGBTransferEOTF( emissiveColor );491491 #endif492492 totalEmissiveRadiance *= emissiveColor.rgb;493-#endif`,uhe=`#ifdef USE_EMISSIVEMAP493+#endif`,fhe=`#ifdef USE_EMISSIVEMAP494494 uniform sampler2D emissiveMap;495-#endif`,hhe="gl_FragColor = linearToOutputTexel( gl_FragColor );",fhe=`vec4 LinearTransferOETF( in vec4 value ) {495+#endif`,dhe="gl_FragColor = linearToOutputTexel( gl_FragColor );",phe=`vec4 LinearTransferOETF( in vec4 value ) {496496 return value;497497 }498498 vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -500,7 +500,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
500500 }501501 vec4 sRGBTransferOETF( in vec4 value ) {502502 return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );503-}`,dhe=`#ifdef USE_ENVMAP503+}`,Ahe=`#ifdef USE_ENVMAP504504 #ifdef ENV_WORLDPOS505505 vec3 cameraToFrag;506506 if ( isOrthographic ) {
@@ -527,7 +527,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
527527 outgoingLight += envColor.xyz * specularStrength * reflectivity;528528 #endif529529 #endif530-#endif`,phe=`#ifdef USE_ENVMAP530+#endif`,mhe=`#ifdef USE_ENVMAP531531 uniform float envMapIntensity;532532 uniform mat3 envMapRotation;533533 #ifdef ENVMAP_TYPE_CUBE
@@ -535,7 +535,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
535535 #else536536 uniform sampler2D envMap;537537 #endif538-#endif`,Ahe=`#ifdef USE_ENVMAP538+#endif`,ghe=`#ifdef USE_ENVMAP539539 uniform float reflectivity;540540 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )541541 #define ENV_WORLDPOS
@@ -546,7 +546,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
546546 #else547547 varying vec3 vReflect;548548 #endif549-#endif`,mhe=`#ifdef USE_ENVMAP549+#endif`,_he=`#ifdef USE_ENVMAP550550 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )551551 #define ENV_WORLDPOS552552 #endif
@@ -557,7 +557,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
557557 varying vec3 vReflect;558558 uniform float refractionRatio;559559 #endif560-#endif`,ghe=`#ifdef USE_ENVMAP560+#endif`,xhe=`#ifdef USE_ENVMAP561561 #ifdef ENV_WORLDPOS562562 vWorldPosition = worldPosition.xyz;563563 #else
@@ -574,18 +574,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
574574 vReflect = refract( cameraToVertex, worldNormal, refractionRatio );575575 #endif576576 #endif577-#endif`,_he=`#ifdef USE_FOG577+#endif`,yhe=`#ifdef USE_FOG578578 vFogDepth = - mvPosition.z;579-#endif`,xhe=`#ifdef USE_FOG579+#endif`,vhe=`#ifdef USE_FOG580580 varying float vFogDepth;581-#endif`,yhe=`#ifdef USE_FOG581+#endif`,bhe=`#ifdef USE_FOG582582 #ifdef FOG_EXP2583583 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );584584 #else585585 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );586586 #endif587587 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );588-#endif`,vhe=`#ifdef USE_FOG588+#endif`,whe=`#ifdef USE_FOG589589 uniform vec3 fogColor;590590 varying float vFogDepth;591591 #ifdef FOG_EXP2
@@ -594,7 +594,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
594594 uniform float fogNear;595595 uniform float fogFar;596596 #endif597-#endif`,bhe=`#ifdef USE_GRADIENTMAP597+#endif`,She=`#ifdef USE_GRADIENTMAP598598 uniform sampler2D gradientMap;599599 #endif600600 vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -606,12 +606,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
606606 vec2 fw = fwidth( coord ) * 0.5;607607 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );608608 #endif609-}`,whe=`#ifdef USE_LIGHTMAP609+}`,The=`#ifdef USE_LIGHTMAP610610 uniform sampler2D lightMap;611611 uniform float lightMapIntensity;612-#endif`,She=`LambertMaterial material;612+#endif`,Ehe=`LambertMaterial material;613613 material.diffuseColor = diffuseColor.rgb;614-material.specularStrength = specularStrength;`,The=`varying vec3 vViewPosition;614+material.specularStrength = specularStrength;`,Mhe=`varying vec3 vViewPosition;615615 struct LambertMaterial {616616 vec3 diffuseColor;617617 float specularStrength;
@@ -625,7 +625,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
625625 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );626626 }627627 #define RE_Direct RE_Direct_Lambert628-#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Ehe=`uniform bool receiveShadow;628+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Che=`uniform bool receiveShadow;629629 uniform vec3 ambientLightColor;630630 #if defined( USE_LIGHT_PROBES )631631 uniform vec3 lightProbe[ 9 ];
@@ -742,7 +742,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
742742 return irradiance;743743 }744744 #endif745-#include <lightprobes_pars_fragment>`,Mhe=`#ifdef USE_ENVMAP745+#include <lightprobes_pars_fragment>`,Rhe=`#ifdef USE_ENVMAP746746 vec3 getIBLIrradiance( const in vec3 normal ) {747747 #ifdef ENVMAP_TYPE_CUBE_UV748748 vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
@@ -775,8 +775,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
775775 #endif776776 }777777 #endif778-#endif`,Che=`ToonMaterial material;779-material.diffuseColor = diffuseColor.rgb;`,Rhe=`varying vec3 vViewPosition;778+#endif`,Phe=`ToonMaterial material;779+material.diffuseColor = diffuseColor.rgb;`,Ihe=`varying vec3 vViewPosition;780780 struct ToonMaterial {781781 vec3 diffuseColor;782782 };
@@ -788,11 +788,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
788788 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );789789 }790790 #define RE_Direct RE_Direct_Toon791-#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Phe=`BlinnPhongMaterial material;791+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Nhe=`BlinnPhongMaterial material;792792 material.diffuseColor = diffuseColor.rgb;793793 material.specularColor = specular;794794 material.specularShininess = shininess;795-material.specularStrength = specularStrength;`,Ihe=`varying vec3 vViewPosition;795+material.specularStrength = specularStrength;`,Lhe=`varying vec3 vViewPosition;796796 struct BlinnPhongMaterial {797797 vec3 diffuseColor;798798 vec3 specularColor;
@@ -809,7 +809,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
809809 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );810810 }811811 #define RE_Direct RE_Direct_BlinnPhong812-#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Nhe=`PhysicalMaterial material;812+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Dhe=`PhysicalMaterial material;813813 material.diffuseColor = diffuseColor.rgb;814814 material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );815815 material.metalness = metalnessFactor;
@@ -899,7 +899,7 @@ material.roughness = min( material.roughness, 1.0 );
899899 material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );900900 material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;901901 material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;902-#endif`,Lhe=`uniform sampler2D dfgLUT;902+#endif`,Fhe=`uniform sampler2D dfgLUT;903903 struct PhysicalMaterial {904904 vec3 diffuseColor;905905 vec3 diffuseContribution;
@@ -1259,7 +1259,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
12591259 #define RE_IndirectSpecular RE_IndirectSpecular_Physical12601260 float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {12611261 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );1262-}`,Dhe=`1262+}`,Ohe=`12631263 vec3 geometryPosition = - vViewPosition;12641264 vec3 geometryNormal = normal;12651265 vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -1381,7 +1381,7 @@ IncidentLight directLight;
13811381 #if defined( RE_IndirectSpecular )13821382 vec3 radiance = vec3( 0.0 );13831383 vec3 clearcoatRadiance = vec3( 0.0 );1384-#endif`,Fhe=`#if defined( RE_IndirectDiffuse )1384+#endif`,Bhe=`#if defined( RE_IndirectDiffuse )13851385 #ifdef USE_LIGHTMAP13861386 vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );13871387 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
@@ -1402,7 +1402,7 @@ IncidentLight directLight;
14021402 #ifdef USE_CLEARCOAT14031403 clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );14041404 #endif1405-#endif`,Ohe=`#if defined( RE_IndirectDiffuse )1405+#endif`,Uhe=`#if defined( RE_IndirectDiffuse )14061406 #if defined( LAMBERT ) || defined( PHONG )14071407 irradiance += iblIrradiance;14081408 #endif
@@ -1410,7 +1410,7 @@ IncidentLight directLight;
14101410 #endif14111411 #if defined( RE_IndirectSpecular )14121412 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );1413-#endif`,Bhe=`#ifdef USE_LIGHT_PROBES_GRID1413+#endif`,khe=`#ifdef USE_LIGHT_PROBES_GRID14141414 uniform highp sampler3D probesSH;14151415 uniform vec3 probesMin;14161416 uniform vec3 probesMax;
@@ -1455,27 +1455,27 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
14551455 result += c8 * 0.429043 * ( x * x - y * y );14561456 return max( result, vec3( 0.0 ) );14571457 }1458-#endif`,Uhe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1458+#endif`,Ghe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )14591459 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;1460-#endif`,khe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1460+#endif`,zhe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )14611461 uniform float logDepthBufFC;14621462 varying float vFragDepth;14631463 varying float vIsPerspective;1464-#endif`,Ghe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1464+#endif`,Vhe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER14651465 varying float vFragDepth;14661466 varying float vIsPerspective;1467-#endif`,zhe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1467+#endif`,qhe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER14681468 vFragDepth = 1.0 + gl_Position.w;14691469 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );1470-#endif`,Vhe=`#ifdef USE_MAP1470+#endif`,Hhe=`#ifdef USE_MAP14711471 vec4 sampledDiffuseColor = texture2D( map, vMapUv );14721472 #ifdef DECODE_VIDEO_TEXTURE14731473 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );14741474 #endif14751475 diffuseColor *= sampledDiffuseColor;1476-#endif`,qhe=`#ifdef USE_MAP1476+#endif`,Whe=`#ifdef USE_MAP14771477 uniform sampler2D map;1478-#endif`,Hhe=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )1478+#endif`,jhe=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )14791479 #if defined( USE_POINTS_UV )14801480 vec2 uv = vUv;14811481 #else
@@ -1487,7 +1487,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
14871487 #endif14881488 #ifdef USE_ALPHAMAP14891489 diffuseColor.a *= texture2D( alphaMap, uv ).g;1490-#endif`,Whe=`#if defined( USE_POINTS_UV )1490+#endif`,Xhe=`#if defined( USE_POINTS_UV )14911491 varying vec2 vUv;14921492 #else14931493 #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1499,19 +1499,19 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
14991499 #endif15001500 #ifdef USE_ALPHAMAP15011501 uniform sampler2D alphaMap;1502-#endif`,jhe=`float metalnessFactor = metalness;1502+#endif`,$he=`float metalnessFactor = metalness;15031503 #ifdef USE_METALNESSMAP15041504 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );15051505 metalnessFactor *= texelMetalness.b;1506-#endif`,Xhe=`#ifdef USE_METALNESSMAP1506+#endif`,Yhe=`#ifdef USE_METALNESSMAP15071507 uniform sampler2D metalnessMap;1508-#endif`,$he=`#ifdef USE_INSTANCING_MORPH1508+#endif`,Zhe=`#ifdef USE_INSTANCING_MORPH15091509 float morphTargetInfluences[ MORPHTARGETS_COUNT ];15101510 float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;15111511 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15121512 morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;15131513 }1514-#endif`,Yhe=`#if defined( USE_MORPHCOLORS )1514+#endif`,Khe=`#if defined( USE_MORPHCOLORS )15151515 vColor *= morphTargetBaseInfluence;15161516 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15171517 #if defined( USE_COLOR_ALPHA )
@@ -1520,12 +1520,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15201520 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];15211521 #endif15221522 }1523-#endif`,Zhe=`#ifdef USE_MORPHNORMALS1523+#endif`,Qhe=`#ifdef USE_MORPHNORMALS15241524 objectNormal *= morphTargetBaseInfluence;15251525 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15261526 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];15271527 }1528-#endif`,Khe=`#ifdef USE_MORPHTARGETS1528+#endif`,Jhe=`#ifdef USE_MORPHTARGETS15291529 #ifndef USE_INSTANCING_MORPH15301530 uniform float morphTargetBaseInfluence;15311531 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1539,12 +1539,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15391539 ivec3 morphUV = ivec3( x, y, morphTargetIndex );15401540 return texelFetch( morphTargetsTexture, morphUV, 0 );15411541 }1542-#endif`,Qhe=`#ifdef USE_MORPHTARGETS1542+#endif`,efe=`#ifdef USE_MORPHTARGETS15431543 transformed *= morphTargetBaseInfluence;15441544 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {15451545 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];15461546 }1547-#endif`,Jhe=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;1547+#endif`,tfe=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;15481548 #ifdef FLAT_SHADED15491549 vec3 fdx = dFdx( vViewPosition );15501550 vec3 fdy = dFdy( vViewPosition );
@@ -1585,7 +1585,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
15851585 tbn2[1] *= faceDirection;15861586 #endif15871587 #endif1588-vec3 nonPerturbedNormal = normal;`,efe=`#ifdef USE_NORMALMAP_OBJECTSPACE1588+vec3 nonPerturbedNormal = normal;`,nfe=`#ifdef USE_NORMALMAP_OBJECTSPACE15891589 normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;15901590 #ifdef FLIP_SIDED15911591 normal = - normal;
@@ -1603,19 +1603,19 @@ vec3 nonPerturbedNormal = normal;`,efe=`#ifdef USE_NORMALMAP_OBJECTSPACE
16031603 normal = normalize( tbn * mapN );16041604 #elif defined( USE_BUMPMAP )16051605 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );1606-#endif`,tfe=`#ifndef FLAT_SHADED1606+#endif`,ife=`#ifndef FLAT_SHADED16071607 varying vec3 vNormal;16081608 #ifdef USE_TANGENT16091609 varying vec3 vTangent;16101610 varying vec3 vBitangent;16111611 #endif1612-#endif`,nfe=`#ifndef FLAT_SHADED1612+#endif`,rfe=`#ifndef FLAT_SHADED16131613 varying vec3 vNormal;16141614 #ifdef USE_TANGENT16151615 varying vec3 vTangent;16161616 varying vec3 vBitangent;16171617 #endif1618-#endif`,ife=`#ifndef FLAT_SHADED1618+#endif`,sfe=`#ifndef FLAT_SHADED16191619 vNormal = normalize( transformedNormal );16201620 #ifdef USE_TANGENT16211621 vTangent = normalize( transformedTangent );
@@ -1624,7 +1624,7 @@ vec3 nonPerturbedNormal = normal;`,efe=`#ifdef USE_NORMALMAP_OBJECTSPACE
16241624 vBitangent = - vBitangent;16251625 #endif16261626 #endif1627-#endif`,rfe=`#ifdef USE_NORMALMAP1627+#endif`,ofe=`#ifdef USE_NORMALMAP16281628 uniform sampler2D normalMap;16291629 uniform vec2 normalScale;16301630 #endif
@@ -1646,13 +1646,13 @@ vec3 nonPerturbedNormal = normal;`,efe=`#ifdef USE_NORMALMAP_OBJECTSPACE
16461646 float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );16471647 return mat3( T * scale, B * scale, N );16481648 }1649-#endif`,sfe=`#ifdef USE_CLEARCOAT1649+#endif`,afe=`#ifdef USE_CLEARCOAT16501650 vec3 clearcoatNormal = nonPerturbedNormal;1651-#endif`,ofe=`#ifdef USE_CLEARCOAT_NORMALMAP1651+#endif`,lfe=`#ifdef USE_CLEARCOAT_NORMALMAP16521652 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;16531653 clearcoatMapN.xy *= clearcoatNormalScale;16541654 clearcoatNormal = normalize( tbn2 * clearcoatMapN );1655-#endif`,afe=`#ifdef USE_CLEARCOATMAP1655+#endif`,cfe=`#ifdef USE_CLEARCOATMAP16561656 uniform sampler2D clearcoatMap;16571657 #endif16581658 #ifdef USE_CLEARCOAT_NORMALMAP
@@ -1661,18 +1661,18 @@ vec3 nonPerturbedNormal = normal;`,efe=`#ifdef USE_NORMALMAP_OBJECTSPACE
16611661 #endif16621662 #ifdef USE_CLEARCOAT_ROUGHNESSMAP16631663 uniform sampler2D clearcoatRoughnessMap;1664-#endif`,lfe=`#ifdef USE_IRIDESCENCEMAP1664+#endif`,ufe=`#ifdef USE_IRIDESCENCEMAP16651665 uniform sampler2D iridescenceMap;16661666 #endif16671667 #ifdef USE_IRIDESCENCE_THICKNESSMAP16681668 uniform sampler2D iridescenceThicknessMap;1669-#endif`,cfe=`#ifdef OPAQUE1669+#endif`,hfe=`#ifdef OPAQUE16701670 diffuseColor.a = 1.0;16711671 #endif16721672 #ifdef USE_TRANSMISSION16731673 diffuseColor.a *= material.transmissionAlpha;16741674 #endif1675-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,ufe=`vec3 packNormalToRGB( const in vec3 normal ) {1675+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,ffe=`vec3 packNormalToRGB( const in vec3 normal ) {16761676 return normalize( normal ) * 0.5 + 0.5;16771677 }16781678 vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -1751,9 +1751,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
17511751 #else17521752 return ( near * far ) / ( ( far - near ) * depth - far );17531753 #endif1754-}`,hfe=`#ifdef PREMULTIPLIED_ALPHA1754+}`,dfe=`#ifdef PREMULTIPLIED_ALPHA17551755 gl_FragColor.rgb *= gl_FragColor.a;1756-#endif`,ffe=`vec4 mvPosition = vec4( transformed, 1.0 );1756+#endif`,pfe=`vec4 mvPosition = vec4( transformed, 1.0 );17571757 #ifdef USE_BATCHING17581758 mvPosition = batchingMatrix * mvPosition;17591759 #endif
@@ -1761,22 +1761,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
17611761 mvPosition = instanceMatrix * mvPosition;17621762 #endif17631763 mvPosition = modelViewMatrix * mvPosition;1764-gl_Position = projectionMatrix * mvPosition;`,dfe=`#ifdef DITHERING1764+gl_Position = projectionMatrix * mvPosition;`,Afe=`#ifdef DITHERING17651765 gl_FragColor.rgb = dithering( gl_FragColor.rgb );1766-#endif`,pfe=`#ifdef DITHERING1766+#endif`,mfe=`#ifdef DITHERING17671767 vec3 dithering( vec3 color ) {17681768 float grid_position = rand( gl_FragCoord.xy );17691769 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );17701770 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );17711771 return color + dither_shift_RGB;17721772 }1773-#endif`,Afe=`float roughnessFactor = roughness;1773+#endif`,gfe=`float roughnessFactor = roughness;17741774 #ifdef USE_ROUGHNESSMAP17751775 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );17761776 roughnessFactor *= texelRoughness.g;1777-#endif`,mfe=`#ifdef USE_ROUGHNESSMAP1777+#endif`,_fe=`#ifdef USE_ROUGHNESSMAP17781778 uniform sampler2D roughnessMap;1779-#endif`,gfe=`#if NUM_SPOT_LIGHT_COORDS > 01779+#endif`,xfe=`#if NUM_SPOT_LIGHT_COORDS > 017801780 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];17811781 #endif17821782 #if NUM_SPOT_LIGHT_MAPS > 0
@@ -1976,7 +1976,7 @@ gl_Position = projectionMatrix * mvPosition;`,dfe=`#ifdef DITHERING
19761976 }19771977 #endif19781978 #endif1979-#endif`,_fe=`#if NUM_SPOT_LIGHT_COORDS > 01979+#endif`,yfe=`#if NUM_SPOT_LIGHT_COORDS > 019801980 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];19811981 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];19821982 #endif
@@ -2017,7 +2017,7 @@ gl_Position = projectionMatrix * mvPosition;`,dfe=`#ifdef DITHERING
20172017 };20182018 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];20192019 #endif2020-#endif`,xfe=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )2020+#endif`,vfe=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )20212021 #ifdef HAS_NORMAL20222022 vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );20232023 #else
@@ -2053,7 +2053,7 @@ gl_Position = projectionMatrix * mvPosition;`,dfe=`#ifdef DITHERING
20532053 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;20542054 }20552055 #pragma unroll_loop_end2056-#endif`,yfe=`float getShadowMask() {2056+#endif`,bfe=`float getShadowMask() {20572057 float shadow = 1.0;20582058 #ifdef USE_SHADOWMAP20592059 #if NUM_DIR_LIGHT_SHADOWS > 0
@@ -2085,12 +2085,12 @@ gl_Position = projectionMatrix * mvPosition;`,dfe=`#ifdef DITHERING
20852085 #endif20862086 #endif20872087 return shadow;2088-}`,vfe=`#ifdef USE_SKINNING2088+}`,wfe=`#ifdef USE_SKINNING20892089 mat4 boneMatX = getBoneMatrix( skinIndex.x );20902090 mat4 boneMatY = getBoneMatrix( skinIndex.y );20912091 mat4 boneMatZ = getBoneMatrix( skinIndex.z );20922092 mat4 boneMatW = getBoneMatrix( skinIndex.w );2093-#endif`,bfe=`#ifdef USE_SKINNING2093+#endif`,Sfe=`#ifdef USE_SKINNING20942094 uniform mat4 bindMatrix;20952095 uniform mat4 bindMatrixInverse;20962096 uniform highp sampler2D boneTexture;
@@ -2105,7 +2105,7 @@ gl_Position = projectionMatrix * mvPosition;`,dfe=`#ifdef DITHERING
21052105 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );21062106 return mat4( v1, v2, v3, v4 );21072107 }2108-#endif`,wfe=`#ifdef USE_SKINNING2108+#endif`,Tfe=`#ifdef USE_SKINNING21092109 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );21102110 vec4 skinned = vec4( 0.0 );21112111 skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2113,7 +2113,7 @@ gl_Position = projectionMatrix * mvPosition;`,dfe=`#ifdef DITHERING
21132113 skinned += boneMatZ * skinVertex * skinWeight.z;21142114 skinned += boneMatW * skinVertex * skinWeight.w;21152115 transformed = ( bindMatrixInverse * skinned ).xyz;2116-#endif`,Sfe=`#ifdef USE_SKINNING2116+#endif`,Efe=`#ifdef USE_SKINNING21172117 mat4 skinMatrix = mat4( 0.0 );21182118 skinMatrix += skinWeight.x * boneMatX;21192119 skinMatrix += skinWeight.y * boneMatY;
@@ -2124,17 +2124,17 @@ gl_Position = projectionMatrix * mvPosition;`,dfe=`#ifdef DITHERING
21242124 #ifdef USE_TANGENT21252125 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;21262126 #endif2127-#endif`,Tfe=`float specularStrength;2127+#endif`,Mfe=`float specularStrength;21282128 #ifdef USE_SPECULARMAP21292129 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );21302130 specularStrength = texelSpecular.r;21312131 #else21322132 specularStrength = 1.0;2133-#endif`,Efe=`#ifdef USE_SPECULARMAP2133+#endif`,Cfe=`#ifdef USE_SPECULARMAP21342134 uniform sampler2D specularMap;2135-#endif`,Mfe=`#if defined( TONE_MAPPING )2135+#endif`,Rfe=`#if defined( TONE_MAPPING )21362136 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );2137-#endif`,Cfe=`#ifndef saturate2137+#endif`,Pfe=`#ifndef saturate21382138 #define saturate( a ) clamp( a, 0.0, 1.0 )21392139 #endif21402140 uniform float toneMappingExposure;
@@ -2231,7 +2231,7 @@ vec3 NeutralToneMapping( vec3 color ) {
22312231 float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );22322232 return mix( color, vec3( newPeak ), g );22332233 }2234-vec3 CustomToneMapping( vec3 color ) { return color; }`,Rfe=`#ifdef USE_TRANSMISSION2234+vec3 CustomToneMapping( vec3 color ) { return color; }`,Ife=`#ifdef USE_TRANSMISSION22352235 material.transmission = transmission;22362236 material.transmissionAlpha = 1.0;22372237 material.thickness = thickness;
@@ -2252,7 +2252,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Rfe=`#ifdef USE_TRANSMIS
22522252 material.attenuationColor, material.attenuationDistance );22532253 material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );22542254 totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );2255-#endif`,Pfe=`#ifdef USE_TRANSMISSION2255+#endif`,Nfe=`#ifdef USE_TRANSMISSION22562256 uniform float transmission;22572257 uniform float thickness;22582258 uniform float attenuationDistance;
@@ -2378,7 +2378,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Rfe=`#ifdef USE_TRANSMIS
23782378 float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;23792379 return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );23802380 }2381-#endif`,Ife=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2381+#endif`,Lfe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )23822382 varying vec2 vUv;23832383 #endif23842384 #ifdef USE_MAP
@@ -2448,7 +2448,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Rfe=`#ifdef USE_TRANSMIS
24482448 #ifdef USE_THICKNESSMAP24492449 uniform mat3 thicknessMapTransform;24502450 varying vec2 vThicknessMapUv;2451-#endif`,Nfe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2451+#endif`,Dfe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )24522452 varying vec2 vUv;24532453 #endif24542454 #ifdef USE_MAP
@@ -2542,7 +2542,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Rfe=`#ifdef USE_TRANSMIS
25422542 #ifdef USE_THICKNESSMAP25432543 uniform mat3 thicknessMapTransform;25442544 varying vec2 vThicknessMapUv;2545-#endif`,Lfe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2545+#endif`,Ffe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )25462546 vUv = vec3( uv, 1 ).xy;25472547 #endif25482548 #ifdef USE_MAP
@@ -2613,7 +2613,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Rfe=`#ifdef USE_TRANSMIS
26132613 #endif26142614 #ifdef USE_THICKNESSMAP26152615 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;2616-#endif`,Dfe=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 02616+#endif`,Ofe=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 026172617 vec4 worldPosition = vec4( transformed, 1.0 );26182618 #ifdef USE_BATCHING26192619 worldPosition = batchingMatrix * worldPosition;
@@ -2622,12 +2622,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,Rfe=`#ifdef USE_TRANSMIS
26222622 worldPosition = instanceMatrix * worldPosition;26232623 #endif26242624 worldPosition = modelMatrix * worldPosition;2625-#endif`,Ffe=`varying vec2 vUv;2625+#endif`,Bfe=`varying vec2 vUv;26262626 uniform mat3 uvTransform;26272627 void main() {26282628 vUv = ( uvTransform * vec3( uv, 1 ) ).xy;26292629 gl_Position = vec4( position.xy, 1.0, 1.0 );2630-}`,Ofe=`uniform sampler2D t2D;2630+}`,Ufe=`uniform sampler2D t2D;26312631 uniform float backgroundIntensity;26322632 varying vec2 vUv;26332633 void main() {
@@ -2639,14 +2639,14 @@ void main() {
26392639 gl_FragColor = texColor;26402640 #include <tonemapping_fragment>26412641 #include <colorspace_fragment>2642-}`,Bfe=`varying vec3 vWorldDirection;2642+}`,kfe=`varying vec3 vWorldDirection;26432643 #include <common>26442644 void main() {26452645 vWorldDirection = transformDirection( position, modelMatrix );26462646 #include <begin_vertex>26472647 #include <project_vertex>26482648 gl_Position.z = gl_Position.w;2649-}`,Ufe=`#ifdef ENVMAP_TYPE_CUBE2649+}`,Gfe=`#ifdef ENVMAP_TYPE_CUBE26502650 uniform samplerCube envMap;26512651 #elif defined( ENVMAP_TYPE_CUBE_UV )26522652 uniform sampler2D envMap;
@@ -2668,14 +2668,14 @@ void main() {
26682668 gl_FragColor = texColor;26692669 #include <tonemapping_fragment>26702670 #include <colorspace_fragment>2671-}`,kfe=`varying vec3 vWorldDirection;2671+}`,zfe=`varying vec3 vWorldDirection;26722672 #include <common>26732673 void main() {26742674 vWorldDirection = transformDirection( position, modelMatrix );26752675 #include <begin_vertex>26762676 #include <project_vertex>26772677 gl_Position.z = gl_Position.w;2678-}`,Gfe=`uniform samplerCube tCube;2678+}`,Vfe=`uniform samplerCube tCube;26792679 uniform float tFlip;26802680 uniform float opacity;26812681 varying vec3 vWorldDirection;
@@ -2685,7 +2685,7 @@ void main() {
26852685 gl_FragColor.a *= opacity;26862686 #include <tonemapping_fragment>26872687 #include <colorspace_fragment>2688-}`,zfe=`#include <common>2688+}`,qfe=`#include <common>26892689 #include <batching_pars_vertex>26902690 #include <uv_pars_vertex>26912691 #include <displacementmap_pars_vertex>
@@ -2712,7 +2712,7 @@ void main() {
27122712 #include <logdepthbuf_vertex>27132713 #include <clipping_planes_vertex>27142714 vHighPrecisionZW = gl_Position.zw;2715-}`,Vfe=`#if DEPTH_PACKING == 32002715+}`,Hfe=`#if DEPTH_PACKING == 320027162716 uniform float opacity;27172717 #endif27182718 #include <common>
@@ -2750,7 +2750,7 @@ void main() {
27502750 #elif DEPTH_PACKING == 320327512751 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );27522752 #endif2753-}`,qfe=`#define DISTANCE2753+}`,Wfe=`#define DISTANCE27542754 varying vec3 vWorldPosition;27552755 #include <common>27562756 #include <batching_pars_vertex>
@@ -2777,7 +2777,7 @@ void main() {
27772777 #include <worldpos_vertex>27782778 #include <clipping_planes_vertex>27792779 vWorldPosition = worldPosition.xyz;2780-}`,Hfe=`#define DISTANCE2780+}`,jfe=`#define DISTANCE27812781 uniform vec3 referencePosition;27822782 uniform float nearDistance;27832783 uniform float farDistance;
@@ -2800,13 +2800,13 @@ void main() {
28002800 dist = ( dist - nearDistance ) / ( farDistance - nearDistance );28012801 dist = saturate( dist );28022802 gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );2803-}`,Wfe=`varying vec3 vWorldDirection;2803+}`,Xfe=`varying vec3 vWorldDirection;28042804 #include <common>28052805 void main() {28062806 vWorldDirection = transformDirection( position, modelMatrix );28072807 #include <begin_vertex>28082808 #include <project_vertex>2809-}`,jfe=`uniform sampler2D tEquirect;2809+}`,$fe=`uniform sampler2D tEquirect;28102810 varying vec3 vWorldDirection;28112811 #include <common>28122812 void main() {
@@ -2815,7 +2815,7 @@ void main() {
28152815 gl_FragColor = texture2D( tEquirect, sampleUV );28162816 #include <tonemapping_fragment>28172817 #include <colorspace_fragment>2818-}`,Xfe=`uniform float scale;2818+}`,Yfe=`uniform float scale;28192819 attribute float lineDistance;28202820 varying float vLineDistance;28212821 #include <common>
@@ -2837,7 +2837,7 @@ void main() {
28372837 #include <logdepthbuf_vertex>28382838 #include <clipping_planes_vertex>28392839 #include <fog_vertex>2840-}`,$fe=`uniform vec3 diffuse;2840+}`,Zfe=`uniform vec3 diffuse;28412841 uniform float opacity;28422842 uniform float dashSize;28432843 uniform float totalSize;
@@ -2865,7 +2865,7 @@ void main() {
28652865 #include <colorspace_fragment>28662866 #include <fog_fragment>28672867 #include <premultiplied_alpha_fragment>2868-}`,Yfe=`#include <common>2868+}`,Kfe=`#include <common>28692869 #include <batching_pars_vertex>28702870 #include <uv_pars_vertex>28712871 #include <envmap_pars_vertex>
@@ -2897,7 +2897,7 @@ void main() {
28972897 #include <worldpos_vertex>28982898 #include <envmap_vertex>28992899 #include <fog_vertex>2900-}`,Zfe=`uniform vec3 diffuse;2900+}`,Qfe=`uniform vec3 diffuse;29012901 uniform float opacity;29022902 #ifndef FLAT_SHADED29032903 varying vec3 vNormal;
@@ -2945,7 +2945,7 @@ void main() {
29452945 #include <fog_fragment>29462946 #include <premultiplied_alpha_fragment>29472947 #include <dithering_fragment>2948-}`,Kfe=`#define LAMBERT2948+}`,Jfe=`#define LAMBERT29492949 varying vec3 vViewPosition;29502950 #include <common>29512951 #include <batching_pars_vertex>
@@ -2984,7 +2984,7 @@ void main() {
29842984 #include <envmap_vertex>29852985 #include <shadowmap_vertex>29862986 #include <fog_vertex>2987-}`,Qfe=`#define LAMBERT2987+}`,ede=`#define LAMBERT29882988 uniform vec3 diffuse;29892989 uniform vec3 emissive;29902990 uniform float opacity;
@@ -3042,7 +3042,7 @@ void main() {
30423042 #include <fog_fragment>30433043 #include <premultiplied_alpha_fragment>30443044 #include <dithering_fragment>3045-}`,Jfe=`#define MATCAP3045+}`,tde=`#define MATCAP30463046 varying vec3 vViewPosition;30473047 #include <common>30483048 #include <batching_pars_vertex>
@@ -3076,7 +3076,7 @@ void main() {
30763076 #include <clipping_planes_vertex>30773077 #include <fog_vertex>30783078 vViewPosition = - mvPosition.xyz;3079-}`,ede=`#define MATCAP3079+}`,nde=`#define MATCAP30803080 uniform vec3 diffuse;30813081 uniform float opacity;30823082 uniform sampler2D matcap;
@@ -3122,7 +3122,7 @@ void main() {
31223122 #include <fog_fragment>31233123 #include <premultiplied_alpha_fragment>31243124 #include <dithering_fragment>3125-}`,tde=`#define NORMAL3125+}`,ide=`#define NORMAL31263126 #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )31273127 varying vec3 vViewPosition;31283128 #endif
@@ -3155,7 +3155,7 @@ void main() {
31553155 #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )31563156 vViewPosition = - mvPosition.xyz;31573157 #endif3158-}`,nde=`#define NORMAL3158+}`,rde=`#define NORMAL31593159 uniform float opacity;31603160 #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )31613161 varying vec3 vViewPosition;
@@ -3176,7 +3176,7 @@ void main() {
31763176 #ifdef OPAQUE31773177 gl_FragColor.a = 1.0;31783178 #endif3179-}`,ide=`#define PHONG3179+}`,sde=`#define PHONG31803180 varying vec3 vViewPosition;31813181 #include <common>31823182 #include <batching_pars_vertex>
@@ -3215,7 +3215,7 @@ void main() {
32153215 #include <envmap_vertex>32163216 #include <shadowmap_vertex>32173217 #include <fog_vertex>3218-}`,rde=`#define PHONG3218+}`,ode=`#define PHONG32193219 uniform vec3 diffuse;32203220 uniform vec3 emissive;32213221 uniform vec3 specular;
@@ -3275,7 +3275,7 @@ void main() {
32753275 #include <fog_fragment>32763276 #include <premultiplied_alpha_fragment>32773277 #include <dithering_fragment>3278-}`,sde=`#define STANDARD3278+}`,ade=`#define STANDARD32793279 varying vec3 vViewPosition;32803280 #ifdef USE_TRANSMISSION32813281 varying vec3 vWorldPosition;
@@ -3318,7 +3318,7 @@ void main() {
33183318 #ifdef USE_TRANSMISSION33193319 vWorldPosition = worldPosition.xyz;33203320 #endif3321-}`,ode=`#define STANDARD3321+}`,lde=`#define STANDARD33223322 #ifdef PHYSICAL33233323 #define IOR33243324 #define USE_SPECULAR
@@ -3443,7 +3443,7 @@ void main() {
34433443 #include <fog_fragment>34443444 #include <premultiplied_alpha_fragment>34453445 #include <dithering_fragment>3446-}`,ade=`#define TOON3446+}`,cde=`#define TOON34473447 varying vec3 vViewPosition;34483448 #include <common>34493449 #include <batching_pars_vertex>
@@ -3480,7 +3480,7 @@ void main() {
34803480 #include <worldpos_vertex>34813481 #include <shadowmap_vertex>34823482 #include <fog_vertex>3483-}`,lde=`#define TOON3483+}`,ude=`#define TOON34843484 uniform vec3 diffuse;34853485 uniform vec3 emissive;34863486 uniform float opacity;
@@ -3532,7 +3532,7 @@ void main() {
35323532 #include <fog_fragment>35333533 #include <premultiplied_alpha_fragment>35343534 #include <dithering_fragment>3535-}`,cde=`uniform float size;3535+}`,hde=`uniform float size;35363536 uniform float scale;35373537 #include <common>35383538 #include <color_pars_vertex>
@@ -3563,7 +3563,7 @@ void main() {
35633563 #include <clipping_planes_vertex>35643564 #include <worldpos_vertex>35653565 #include <fog_vertex>3566-}`,ude=`uniform vec3 diffuse;3566+}`,fde=`uniform vec3 diffuse;35673567 uniform float opacity;35683568 #include <common>35693569 #include <color_pars_fragment>
@@ -3588,7 +3588,7 @@ void main() {
35883588 #include <colorspace_fragment>35893589 #include <fog_fragment>35903590 #include <premultiplied_alpha_fragment>3591-}`,hde=`#include <common>3591+}`,dde=`#include <common>35923592 #include <batching_pars_vertex>35933593 #include <fog_pars_vertex>35943594 #include <morphtarget_pars_vertex>
@@ -3611,7 +3611,7 @@ void main() {
36113611 #include <worldpos_vertex>36123612 #include <shadowmap_vertex>36133613 #include <fog_vertex>3614-}`,fde=`uniform vec3 color;3614+}`,pde=`uniform vec3 color;36153615 uniform float opacity;36163616 #include <common>36173617 #include <fog_pars_fragment>
@@ -3627,7 +3627,7 @@ void main() {
36273627 #include <colorspace_fragment>36283628 #include <fog_fragment>36293629 #include <premultiplied_alpha_fragment>3630-}`,dde=`uniform float rotation;3630+}`,Ade=`uniform float rotation;36313631 uniform vec2 center;36323632 #include <common>36333633 #include <uv_pars_vertex>
@@ -3651,7 +3651,7 @@ void main() {
36513651 #include <logdepthbuf_vertex>36523652 #include <clipping_planes_vertex>36533653 #include <fog_vertex>3654-}`,pde=`uniform vec3 diffuse;3654+}`,mde=`uniform vec3 diffuse;36553655 uniform float opacity;36563656 #include <common>36573657 #include <uv_pars_fragment>
@@ -3676,7 +3676,7 @@ void main() {
36763676 #include <tonemapping_fragment>36773677 #include <colorspace_fragment>36783678 #include <fog_fragment>3679-}`,On={alphahash_fragment:Fue,alphahash_pars_fragment:Oue,alphamap_fragment:Bue,alphamap_pars_fragment:Uue,alphatest_fragment:kue,alphatest_pars_fragment:Gue,aomap_fragment:zue,aomap_pars_fragment:Vue,batching_pars_vertex:que,batching_vertex:Hue,begin_vertex:Wue,beginnormal_vertex:jue,bsdfs:Xue,iridescence_fragment:$ue,bumpmap_pars_fragment:Yue,clipping_planes_fragment:Zue,clipping_planes_pars_fragment:Kue,clipping_planes_pars_vertex:Que,clipping_planes_vertex:Jue,color_fragment:ehe,color_pars_fragment:the,color_pars_vertex:nhe,color_vertex:ihe,common:rhe,cube_uv_reflection_fragment:she,defaultnormal_vertex:ohe,displacementmap_pars_vertex:ahe,displacementmap_vertex:lhe,emissivemap_fragment:che,emissivemap_pars_fragment:uhe,colorspace_fragment:hhe,colorspace_pars_fragment:fhe,envmap_fragment:dhe,envmap_common_pars_fragment:phe,envmap_pars_fragment:Ahe,envmap_pars_vertex:mhe,envmap_physical_pars_fragment:Mhe,envmap_vertex:ghe,fog_vertex:_he,fog_pars_vertex:xhe,fog_fragment:yhe,fog_pars_fragment:vhe,gradientmap_pars_fragment:bhe,lightmap_pars_fragment:whe,lights_lambert_fragment:She,lights_lambert_pars_fragment:The,lights_pars_begin:Ehe,lights_toon_fragment:Che,lights_toon_pars_fragment:Rhe,lights_phong_fragment:Phe,lights_phong_pars_fragment:Ihe,lights_physical_fragment:Nhe,lights_physical_pars_fragment:Lhe,lights_fragment_begin:Dhe,lights_fragment_maps:Fhe,lights_fragment_end:Ohe,lightprobes_pars_fragment:Bhe,logdepthbuf_fragment:Uhe,logdepthbuf_pars_fragment:khe,logdepthbuf_pars_vertex:Ghe,logdepthbuf_vertex:zhe,map_fragment:Vhe,map_pars_fragment:qhe,map_particle_fragment:Hhe,map_particle_pars_fragment:Whe,metalnessmap_fragment:jhe,metalnessmap_pars_fragment:Xhe,morphinstance_vertex:$he,morphcolor_vertex:Yhe,morphnormal_vertex:Zhe,morphtarget_pars_vertex:Khe,morphtarget_vertex:Qhe,normal_fragment_begin:Jhe,normal_fragment_maps:efe,normal_pars_fragment:tfe,normal_pars_vertex:nfe,normal_vertex:ife,normalmap_pars_fragment:rfe,clearcoat_normal_fragment_begin:sfe,clearcoat_normal_fragment_maps:ofe,clearcoat_pars_fragment:afe,iridescence_pars_fragment:lfe,opaque_fragment:cfe,packing:ufe,premultiplied_alpha_fragment:hfe,project_vertex:ffe,dithering_fragment:dfe,dithering_pars_fragment:pfe,roughnessmap_fragment:Afe,roughnessmap_pars_fragment:mfe,shadowmap_pars_fragment:gfe,shadowmap_pars_vertex:_fe,shadowmap_vertex:xfe,shadowmask_pars_fragment:yfe,skinbase_vertex:vfe,skinning_pars_vertex:bfe,skinning_vertex:wfe,skinnormal_vertex:Sfe,specularmap_fragment:Tfe,specularmap_pars_fragment:Efe,tonemapping_fragment:Mfe,tonemapping_pars_fragment:Cfe,transmission_fragment:Rfe,transmission_pars_fragment:Pfe,uv_pars_fragment:Ife,uv_pars_vertex:Nfe,uv_vertex:Lfe,worldpos_vertex:Dfe,background_vert:Ffe,background_frag:Ofe,backgroundCube_vert:Bfe,backgroundCube_frag:Ufe,cube_vert:kfe,cube_frag:Gfe,depth_vert:zfe,depth_frag:Vfe,distance_vert:qfe,distance_frag:Hfe,equirect_vert:Wfe,equirect_frag:jfe,linedashed_vert:Xfe,linedashed_frag:$fe,meshbasic_vert:Yfe,meshbasic_frag:Zfe,meshlambert_vert:Kfe,meshlambert_frag:Qfe,meshmatcap_vert:Jfe,meshmatcap_frag:ede,meshnormal_vert:tde,meshnormal_frag:nde,meshphong_vert:ide,meshphong_frag:rde,meshphysical_vert:sde,meshphysical_frag:ode,meshtoon_vert:ade,meshtoon_frag:lde,points_vert:cde,points_frag:ude,shadow_vert:hde,shadow_frag:fde,sprite_vert:dde,sprite_frag:pde},Nt={common:{diffuse:{value:new Ut(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Sn},alphaMap:{value:null},alphaMapTransform:{value:new Sn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Sn}},envmap:{envMap:{value:null},envMapRotation:{value:new Sn},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Sn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Sn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Sn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Sn},normalScale:{value:new Oe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Sn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Sn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Sn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Sn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ut(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 ie},probesMax:{value:new ie},probesResolution:{value:new ie}},points:{diffuse:{value:new Ut(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Sn},alphaTest:{value:0},uvTransform:{value:new Sn}},sprite:{diffuse:{value:new Ut(16777215)},opacity:{value:1},center:{value:new Oe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Sn},alphaMap:{value:null},alphaMapTransform:{value:new Sn},alphaTest:{value:0}}},_a={basic:{uniforms:Ho([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.fog]),vertexShader:On.meshbasic_vert,fragmentShader:On.meshbasic_frag},lambert:{uniforms:Ho([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 Ut(0)},envMapIntensity:{value:1}}]),vertexShader:On.meshlambert_vert,fragmentShader:On.meshlambert_frag},phong:{uniforms:Ho([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 Ut(0)},specular:{value:new Ut(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:On.meshphong_vert,fragmentShader:On.meshphong_frag},standard:{uniforms:Ho([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 Ut(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:On.meshphysical_vert,fragmentShader:On.meshphysical_frag},toon:{uniforms:Ho([Nt.common,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.gradientmap,Nt.fog,Nt.lights,{emissive:{value:new Ut(0)}}]),vertexShader:On.meshtoon_vert,fragmentShader:On.meshtoon_frag},matcap:{uniforms:Ho([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,{matcap:{value:null}}]),vertexShader:On.meshmatcap_vert,fragmentShader:On.meshmatcap_frag},points:{uniforms:Ho([Nt.points,Nt.fog]),vertexShader:On.points_vert,fragmentShader:On.points_frag},dashed:{uniforms:Ho([Nt.common,Nt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:On.linedashed_vert,fragmentShader:On.linedashed_frag},depth:{uniforms:Ho([Nt.common,Nt.displacementmap]),vertexShader:On.depth_vert,fragmentShader:On.depth_frag},normal:{uniforms:Ho([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,{opacity:{value:1}}]),vertexShader:On.meshnormal_vert,fragmentShader:On.meshnormal_frag},sprite:{uniforms:Ho([Nt.sprite,Nt.fog]),vertexShader:On.sprite_vert,fragmentShader:On.sprite_frag},background:{uniforms:{uvTransform:{value:new Sn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:On.background_vert,fragmentShader:On.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Sn}},vertexShader:On.backgroundCube_vert,fragmentShader:On.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:On.cube_vert,fragmentShader:On.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:On.equirect_vert,fragmentShader:On.equirect_frag},distance:{uniforms:Ho([Nt.common,Nt.displacementmap,{referencePosition:{value:new ie},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:On.distance_vert,fragmentShader:On.distance_frag},shadow:{uniforms:Ho([Nt.lights,Nt.fog,{color:{value:new Ut(0)},opacity:{value:1}}]),vertexShader:On.shadow_vert,fragmentShader:On.shadow_frag}};_a.physical={uniforms:Ho([_a.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Sn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Sn},clearcoatNormalScale:{value:new Oe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Sn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Sn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Sn},sheen:{value:0},sheenColor:{value:new Ut(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Sn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Sn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Sn},transmissionSamplerSize:{value:new Oe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Sn},attenuationDistance:{value:0},attenuationColor:{value:new Ut(0)},specularColor:{value:new Ut(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Sn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Sn},anisotropyVector:{value:new Oe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Sn}}]),vertexShader:On.meshphysical_vert,fragmentShader:On.meshphysical_frag};var i3={r:0,b:0,g:0},Ade=new on,UW=new Sn;UW.set(-1,0,0,0,1,0,0,0,1);function mde(i,e,t,n,r,s){let o=new Ut(0),a=r===!0?0:1,l,c,u=null,f=0,p=null;function x(P){let R=P.isScene===!0?P.background:null;if(R&&R.isTexture){let C=P.backgroundBlurriness>0;R=e.get(R,C)}return R}function v(P){let R=!1,C=x(P);C===null?S(o,a):C&&C.isColor&&(S(C,1),R=!0);let L=i.xr.getEnvironmentBlendMode();L==="additive"?t.buffers.color.setClear(0,0,0,1,s):L==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||R)&&(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(P,R){let C=x(R);C&&(C.isCubeTexture||C.mapping===ju)?(c===void 0&&(c=new Gn(new qc(1,1,1),new $r({name:"BackgroundCubeMaterial",uniforms:jA(_a.backgroundCube.uniforms),vertexShader:_a.backgroundCube.vertexShader,fragmentShader:_a.backgroundCube.fragmentShader,side:ui,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(L,D,F){this.matrixWorld.copyPosition(F.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=C,c.material.uniforms.backgroundBlurriness.value=R.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=R.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Ade.makeRotationFromEuler(R.backgroundRotation)).transpose(),C.isCubeTexture&&C.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(UW),c.material.toneMapped=sn.getTransfer(C.colorSpace)!==Bt,(u!==C||f!==C.version||p!==i.toneMapping)&&(c.material.needsUpdate=!0,u=C,f=C.version,p=i.toneMapping),c.layers.enableAll(),P.unshift(c,c.geometry,c.material,0,0,null)):C&&C.isTexture&&(l===void 0&&(l=new Gn(new RA(2,2),new $r({name:"BackgroundMaterial",uniforms:jA(_a.background.uniforms),vertexShader:_a.background.vertexShader,fragmentShader:_a.background.fragmentShader,side:go,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=C,l.material.uniforms.backgroundIntensity.value=R.backgroundIntensity,l.material.toneMapped=sn.getTransfer(C.colorSpace)!==Bt,C.matrixAutoUpdate===!0&&C.updateMatrix(),l.material.uniforms.uvTransform.value.copy(C.matrix),(u!==C||f!==C.version||p!==i.toneMapping)&&(l.material.needsUpdate=!0,u=C,f=C.version,p=i.toneMapping),l.layers.enableAll(),P.unshift(l,l.geometry,l.material,0,0,null))}function S(P,R){P.getRGB(i3,EL(i)),t.buffers.color.setClear(i3.r,i3.g,i3.b,R,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(P,R=1){o.set(P),a=R,S(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(P){a=P,S(o,a)},render:v,addToRenderList:w,dispose:T}}function gde(i,e){let t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=p(null),s=r,o=!1;function a(V,H,Z,J,j){let K=!1,ee=f(V,J,Z,H);s!==ee&&(s=ee,c(s.object)),K=x(V,J,Z,j),K&&v(V,J,Z,j),j!==null&&e.update(j,i.ELEMENT_ARRAY_BUFFER),(K||o)&&(o=!1,C(V,H,Z,J),j!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(j).buffer))}function l(){return i.createVertexArray()}function c(V){return i.bindVertexArray(V)}function u(V){return i.deleteVertexArray(V)}function f(V,H,Z,J){let j=J.wireframe===!0,K=n[H.id];K===void 0&&(K={},n[H.id]=K);let ee=V.isInstancedMesh===!0?V.id:0,ae=K[ee];ae===void 0&&(ae={},K[ee]=ae);let ce=ae[Z.id];ce===void 0&&(ce={},ae[Z.id]=ce);let de=ce[j];return de===void 0&&(de=p(l()),ce[j]=de),de}function p(V){let H=[],Z=[],J=[];for(let j=0;j<t;j++)H[j]=0,Z[j]=0,J[j]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:H,enabledAttributes:Z,attributeDivisors:J,object:V,attributes:{},index:null}}function x(V,H,Z,J){let j=s.attributes,K=H.attributes,ee=0,ae=Z.getAttributes();for(let ce in ae)if(ae[ce].location>=0){let ve=j[ce],Ie=K[ce];if(Ie===void 0&&(ce==="instanceMatrix"&&V.instanceMatrix&&(Ie=V.instanceMatrix),ce==="instanceColor"&&V.instanceColor&&(Ie=V.instanceColor)),ve===void 0||ve.attribute!==Ie||Ie&&ve.data!==Ie.data)return!0;ee++}return s.attributesNum!==ee||s.index!==J}function v(V,H,Z,J){let j={},K=H.attributes,ee=0,ae=Z.getAttributes();for(let ce in ae)if(ae[ce].location>=0){let ve=K[ce];ve===void 0&&(ce==="instanceMatrix"&&V.instanceMatrix&&(ve=V.instanceMatrix),ce==="instanceColor"&&V.instanceColor&&(ve=V.instanceColor));let Ie={};Ie.attribute=ve,ve&&ve.data&&(Ie.data=ve.data),j[ce]=Ie,ee++}s.attributes=j,s.attributesNum=ee,s.index=J}function w(){let V=s.newAttributes;for(let H=0,Z=V.length;H<Z;H++)V[H]=0}function S(V){T(V,0)}function T(V,H){let Z=s.newAttributes,J=s.enabledAttributes,j=s.attributeDivisors;Z[V]=1,J[V]===0&&(i.enableVertexAttribArray(V),J[V]=1),j[V]!==H&&(i.vertexAttribDivisor(V,H),j[V]=H)}function P(){let V=s.newAttributes,H=s.enabledAttributes;for(let Z=0,J=H.length;Z<J;Z++)H[Z]!==V[Z]&&(i.disableVertexAttribArray(Z),H[Z]=0)}function R(V,H,Z,J,j,K,ee){ee===!0?i.vertexAttribIPointer(V,H,Z,j,K):i.vertexAttribPointer(V,H,Z,J,j,K)}function C(V,H,Z,J){w();let j=J.attributes,K=Z.getAttributes(),ee=H.defaultAttributeValues;for(let ae in K){let ce=K[ae];if(ce.location>=0){let de=j[ae];if(de===void 0&&(ae==="instanceMatrix"&&V.instanceMatrix&&(de=V.instanceMatrix),ae==="instanceColor"&&V.instanceColor&&(de=V.instanceColor)),de!==void 0){let ve=de.normalized,Ie=de.itemSize,Qe=e.get(de);if(Qe===void 0)continue;let Ue=Qe.buffer,mt=Qe.type,Me=Qe.bytesPerElement,ze=mt===i.INT||mt===i.UNSIGNED_INT||de.gpuType===Dr;if(de.isInterleavedBufferAttribute){let $e=de.data,Et=$e.stride,Tt=de.offset;if($e.isInstancedInterleavedBuffer){for(let Ct=0;Ct<ce.locationSize;Ct++)T(ce.location+Ct,$e.meshPerAttribute);V.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=$e.meshPerAttribute*$e.count)}else for(let Ct=0;Ct<ce.locationSize;Ct++)S(ce.location+Ct);i.bindBuffer(i.ARRAY_BUFFER,Ue);for(let Ct=0;Ct<ce.locationSize;Ct++)R(ce.location+Ct,Ie/ce.locationSize,mt,ve,Et*Me,(Tt+Ie/ce.locationSize*Ct)*Me,ze)}else{if(de.isInstancedBufferAttribute){for(let $e=0;$e<ce.locationSize;$e++)T(ce.location+$e,de.meshPerAttribute);V.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=de.meshPerAttribute*de.count)}else for(let $e=0;$e<ce.locationSize;$e++)S(ce.location+$e);i.bindBuffer(i.ARRAY_BUFFER,Ue);for(let $e=0;$e<ce.locationSize;$e++)R(ce.location+$e,Ie/ce.locationSize,mt,ve,Ie*Me,Ie/ce.locationSize*$e*Me,ze)}}else if(ee!==void 0){let ve=ee[ae];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)}}}}P()}function L(){B();for(let V in n){let H=n[V];for(let Z in H){let J=H[Z];for(let j in J){let K=J[j];for(let ee in K)u(K[ee].object),delete K[ee];delete J[j]}}delete n[V]}}function D(V){if(n[V.id]===void 0)return;let H=n[V.id];for(let Z in H){let J=H[Z];for(let j in J){let K=J[j];for(let ee in K)u(K[ee].object),delete K[ee];delete J[j]}}delete n[V.id]}function F(V){for(let H in n){let Z=n[H];for(let J in Z){let j=Z[J];if(j[V.id]===void 0)continue;let K=j[V.id];for(let ee in K)u(K[ee].object),delete K[ee];delete j[V.id]}}}function N(V){for(let H in n){let Z=n[H],J=V.isInstancedMesh===!0?V.id:0,j=Z[J];if(j!==void 0){for(let K in j){let ee=j[K];for(let ae in ee)u(ee[ae].object),delete ee[ae];delete j[K]}delete Z[J],Object.keys(Z).length===0&&delete n[H]}}}function B(){z(),o=!0,s!==r&&(s=r,c(s.object))}function z(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:B,resetDefaultState:z,dispose:L,releaseStatesOfGeometry:D,releaseStatesOfObject:N,releaseStatesOfProgram:F,initAttributes:w,enableAttribute:S,disableUnusedAttributes:P}}function _de(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 p=0;for(let x=0;x<u;x++)p+=c[x];t.update(p,n,1)}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a}function xde(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){let F=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(F.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(F){return!(F!==vr&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(F){let N=F===Di&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(F!==zi&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&F!==Zi&&!N)}function l(F){if(F==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";F="mediump"}return F==="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&&(je("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);let f=t.logarithmicDepthBuffer===!0,p=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&p===!1&&je("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let x=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),v=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),P=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),R=i.getParameter(i.MAX_VARYING_VECTORS),C=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),L=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:p,maxTextures:x,maxVertexTextures:v,maxTextureSize:w,maxCubemapSize:S,maxAttributes:T,maxVertexUniforms:P,maxVaryings:R,maxFragmentUniforms:C,maxSamples:L,samples:D}}function yde(i){let e=this,t=null,n=0,r=!1,s=!1,o=new la,a=new Sn,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p){let x=f.length!==0||p||n!==0||r;return r=p,n=f.length,x},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,p){t=u(f,p,0)},this.setState=function(f,p,x){let v=f.clippingPlanes,w=f.clipIntersection,S=f.clipShadows,T=i.get(f);if(!r||v===null||v.length===0||s&&!S)s?u(null):c();else{let P=s?0:n,R=P*4,C=T.clippingState||null;l.value=C,C=u(v,p,R,x);for(let L=0;L!==R;++L)C[L]=t[L];T.clippingState=C,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=P}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,p,x,v){let w=f!==null?f.length:0,S=null;if(w!==0){if(S=l.value,v!==!0||S===null){let T=x+w*4,P=p.matrixWorldInverse;a.getNormalMatrix(P),(S===null||S.length<T)&&(S=new Float32Array(T));for(let R=0,C=x;R!==w;++R,C+=4)o.copy(f[R]).applyMatrix4(P,a),o.normal.toArray(S,C),S[C+3]=o.constant}l.value=S,l.needsUpdate=!0}return e.numPlanes=w,e.numIntersection=0,S}}var Op=4,pW=[.125,.215,.35,.446,.526,.582],$A=20,vde=256,C2=new Hc,AW=new Ut,DL=null,FL=0,OL=0,BL=!1,bde=new ie,s3=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=bde}=s;DL=this._renderer.getRenderTarget(),FL=this._renderer.getActiveCubeFace(),OL=this._renderer.getActiveMipmapLevel(),BL=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=_W(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=gW(),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(DL,FL,OL),this._renderer.xr.enabled=BL,e.scissorTest=!1,N_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===yl||e.mapping===nc?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),DL=this._renderer.getRenderTarget(),FL=this._renderer.getActiveCubeFace(),OL=this._renderer.getActiveMipmapLevel(),BL=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:bi,minFilter:bi,generateMipmaps:!1,type:Di,format:vr,colorSpace:$d,depthBuffer:!1},r=mW(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=mW(e,t,n);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=wde(s)),this._blurMaterial=Tde(s,e,t),this._ggxMaterial=Sde(s,e,t)}return r}_compileMaterial(e){let t=new Gn(new qn,e);this._renderer.compile(t,C2)}_sceneToCubeUV(e,t,n,r,s){let l=new Ir(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],f=this._renderer,p=f.autoClear,x=f.toneMapping;f.getClearColor(AW),f.toneMapping=zs,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Gn(new qc,new as({name:"PMREM.Background",side:ui,depthWrite:!1,depthTest:!1})));let w=this._backgroundBox,S=w.material,T=!1,P=e.background;P?P.isColor&&(S.color.copy(P),e.background=null,T=!0):(S.color.copy(AW),T=!0);for(let R=0;R<6;R++){let C=R%3;C===0?(l.up.set(0,c[R],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[R],s.y,s.z)):C===1?(l.up.set(0,0,c[R]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[R],s.z)):(l.up.set(0,c[R],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[R]));let L=this._cubeSize;N_(r,C*L,R>2?L:0,L,L),f.setRenderTarget(r),T&&f.render(w,l),f.render(e,l)}f.toneMapping=x,f.autoClear=p,e.background=P}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===yl||e.mapping===nc;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=_W()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=gW());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;N_(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,C2)}_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),p=0+c*1.25,x=f*p,{_lodMax:v}=this,w=this._sizeLods[n],S=3*w*(n>v-Op?n-v+Op:0),T=4*(this._cubeSize-w);l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=v-t,N_(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,C2),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=v-n,N_(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,C2)}_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"&&Ge("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let p=c.uniforms,x=this._sizeLods[n]-1,v=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*$A-1),w=s/v,S=isFinite(s)?1+Math.floor(u*w):$A;S>$A&&je(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${$A}`);let T=[],P=0;for(let F=0;F<$A;++F){let N=F/w,B=Math.exp(-N*N/2);T.push(B),F===0?P+=B:F<S&&(P+=2*B)}for(let F=0;F<T.length;F++)T[F]=T[F]/P;p.envMap.value=e.texture,p.samples.value=S,p.weights.value=T,p.latitudinal.value=o==="latitudinal",a&&(p.poleAxis.value=a);let{_lodMax:R}=this;p.dTheta.value=v,p.mipInt.value=R-n;let C=this._sizeLods[r],L=3*C*(r>R-Op?r-R+Op:0),D=4*(this._cubeSize-C);N_(t,L,D,3*C,2*C),l.setRenderTarget(t),l.render(f,C2)}};function wde(i){let e=[],t=[],n=[],r=i,s=i-Op+1+pW.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-Op?l=pW[o-i+Op-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,p=[u,u,f,u,f,f,u,u,f,f,u,f],x=6,v=6,w=3,S=2,T=1,P=new Float32Array(w*v*x),R=new Float32Array(S*v*x),C=new Float32Array(T*v*x);for(let D=0;D<x;D++){let F=D%3*2/3-1,N=D>2?0:-1,B=[F,N,0,F+2/3,N,0,F+2/3,N+1,0,F,N,0,F+2/3,N+1,0,F,N+1,0];P.set(B,w*v*D),R.set(p,S*v*D);let z=[D,D,D,D,D,D];C.set(z,T*v*D)}let L=new qn;L.setAttribute("position",new Li(P,w)),L.setAttribute("uv",new Li(R,S)),L.setAttribute("faceIndex",new Li(C,T)),n.push(new Gn(L,null)),r>Op&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function mW(i,e,t){let n=new ha(i,e,t);return n.texture.mapping=ju,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function N_(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Sde(i,e,t){return new $r({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:vde,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:l3(),fragmentShader:`3679+}`,On={alphahash_fragment:Bue,alphahash_pars_fragment:Uue,alphamap_fragment:kue,alphamap_pars_fragment:Gue,alphatest_fragment:zue,alphatest_pars_fragment:Vue,aomap_fragment:que,aomap_pars_fragment:Hue,batching_pars_vertex:Wue,batching_vertex:jue,begin_vertex:Xue,beginnormal_vertex:$ue,bsdfs:Yue,iridescence_fragment:Zue,bumpmap_pars_fragment:Kue,clipping_planes_fragment:Que,clipping_planes_pars_fragment:Jue,clipping_planes_pars_vertex:ehe,clipping_planes_vertex:the,color_fragment:nhe,color_pars_fragment:ihe,color_pars_vertex:rhe,color_vertex:she,common:ohe,cube_uv_reflection_fragment:ahe,defaultnormal_vertex:lhe,displacementmap_pars_vertex:che,displacementmap_vertex:uhe,emissivemap_fragment:hhe,emissivemap_pars_fragment:fhe,colorspace_fragment:dhe,colorspace_pars_fragment:phe,envmap_fragment:Ahe,envmap_common_pars_fragment:mhe,envmap_pars_fragment:ghe,envmap_pars_vertex:_he,envmap_physical_pars_fragment:Rhe,envmap_vertex:xhe,fog_vertex:yhe,fog_pars_vertex:vhe,fog_fragment:bhe,fog_pars_fragment:whe,gradientmap_pars_fragment:She,lightmap_pars_fragment:The,lights_lambert_fragment:Ehe,lights_lambert_pars_fragment:Mhe,lights_pars_begin:Che,lights_toon_fragment:Phe,lights_toon_pars_fragment:Ihe,lights_phong_fragment:Nhe,lights_phong_pars_fragment:Lhe,lights_physical_fragment:Dhe,lights_physical_pars_fragment:Fhe,lights_fragment_begin:Ohe,lights_fragment_maps:Bhe,lights_fragment_end:Uhe,lightprobes_pars_fragment:khe,logdepthbuf_fragment:Ghe,logdepthbuf_pars_fragment:zhe,logdepthbuf_pars_vertex:Vhe,logdepthbuf_vertex:qhe,map_fragment:Hhe,map_pars_fragment:Whe,map_particle_fragment:jhe,map_particle_pars_fragment:Xhe,metalnessmap_fragment:$he,metalnessmap_pars_fragment:Yhe,morphinstance_vertex:Zhe,morphcolor_vertex:Khe,morphnormal_vertex:Qhe,morphtarget_pars_vertex:Jhe,morphtarget_vertex:efe,normal_fragment_begin:tfe,normal_fragment_maps:nfe,normal_pars_fragment:ife,normal_pars_vertex:rfe,normal_vertex:sfe,normalmap_pars_fragment:ofe,clearcoat_normal_fragment_begin:afe,clearcoat_normal_fragment_maps:lfe,clearcoat_pars_fragment:cfe,iridescence_pars_fragment:ufe,opaque_fragment:hfe,packing:ffe,premultiplied_alpha_fragment:dfe,project_vertex:pfe,dithering_fragment:Afe,dithering_pars_fragment:mfe,roughnessmap_fragment:gfe,roughnessmap_pars_fragment:_fe,shadowmap_pars_fragment:xfe,shadowmap_pars_vertex:yfe,shadowmap_vertex:vfe,shadowmask_pars_fragment:bfe,skinbase_vertex:wfe,skinning_pars_vertex:Sfe,skinning_vertex:Tfe,skinnormal_vertex:Efe,specularmap_fragment:Mfe,specularmap_pars_fragment:Cfe,tonemapping_fragment:Rfe,tonemapping_pars_fragment:Pfe,transmission_fragment:Ife,transmission_pars_fragment:Nfe,uv_pars_fragment:Lfe,uv_pars_vertex:Dfe,uv_vertex:Ffe,worldpos_vertex:Ofe,background_vert:Bfe,background_frag:Ufe,backgroundCube_vert:kfe,backgroundCube_frag:Gfe,cube_vert:zfe,cube_frag:Vfe,depth_vert:qfe,depth_frag:Hfe,distance_vert:Wfe,distance_frag:jfe,equirect_vert:Xfe,equirect_frag:$fe,linedashed_vert:Yfe,linedashed_frag:Zfe,meshbasic_vert:Kfe,meshbasic_frag:Qfe,meshlambert_vert:Jfe,meshlambert_frag:ede,meshmatcap_vert:tde,meshmatcap_frag:nde,meshnormal_vert:ide,meshnormal_frag:rde,meshphong_vert:sde,meshphong_frag:ode,meshphysical_vert:ade,meshphysical_frag:lde,meshtoon_vert:cde,meshtoon_frag:ude,points_vert:hde,points_frag:fde,shadow_vert:dde,shadow_frag:pde,sprite_vert:Ade,sprite_frag:mde},Nt={common:{diffuse:{value:new Ut(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Sn},alphaMap:{value:null},alphaMapTransform:{value:new Sn},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Sn}},envmap:{envMap:{value:null},envMapRotation:{value:new Sn},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Sn}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Sn}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Sn},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Sn},normalScale:{value:new Oe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Sn},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Sn}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Sn}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Sn}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ut(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 ie},probesMax:{value:new ie},probesResolution:{value:new ie}},points:{diffuse:{value:new Ut(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Sn},alphaTest:{value:0},uvTransform:{value:new Sn}},sprite:{diffuse:{value:new Ut(16777215)},opacity:{value:1},center:{value:new Oe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Sn},alphaMap:{value:null},alphaMapTransform:{value:new Sn},alphaTest:{value:0}}},_a={basic:{uniforms:Ho([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.fog]),vertexShader:On.meshbasic_vert,fragmentShader:On.meshbasic_frag},lambert:{uniforms:Ho([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 Ut(0)},envMapIntensity:{value:1}}]),vertexShader:On.meshlambert_vert,fragmentShader:On.meshlambert_frag},phong:{uniforms:Ho([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 Ut(0)},specular:{value:new Ut(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:On.meshphong_vert,fragmentShader:On.meshphong_frag},standard:{uniforms:Ho([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 Ut(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:On.meshphysical_vert,fragmentShader:On.meshphysical_frag},toon:{uniforms:Ho([Nt.common,Nt.aomap,Nt.lightmap,Nt.emissivemap,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.gradientmap,Nt.fog,Nt.lights,{emissive:{value:new Ut(0)}}]),vertexShader:On.meshtoon_vert,fragmentShader:On.meshtoon_frag},matcap:{uniforms:Ho([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,{matcap:{value:null}}]),vertexShader:On.meshmatcap_vert,fragmentShader:On.meshmatcap_frag},points:{uniforms:Ho([Nt.points,Nt.fog]),vertexShader:On.points_vert,fragmentShader:On.points_frag},dashed:{uniforms:Ho([Nt.common,Nt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:On.linedashed_vert,fragmentShader:On.linedashed_frag},depth:{uniforms:Ho([Nt.common,Nt.displacementmap]),vertexShader:On.depth_vert,fragmentShader:On.depth_frag},normal:{uniforms:Ho([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,{opacity:{value:1}}]),vertexShader:On.meshnormal_vert,fragmentShader:On.meshnormal_frag},sprite:{uniforms:Ho([Nt.sprite,Nt.fog]),vertexShader:On.sprite_vert,fragmentShader:On.sprite_frag},background:{uniforms:{uvTransform:{value:new Sn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:On.background_vert,fragmentShader:On.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Sn}},vertexShader:On.backgroundCube_vert,fragmentShader:On.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:On.cube_vert,fragmentShader:On.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:On.equirect_vert,fragmentShader:On.equirect_frag},distance:{uniforms:Ho([Nt.common,Nt.displacementmap,{referencePosition:{value:new ie},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:On.distance_vert,fragmentShader:On.distance_frag},shadow:{uniforms:Ho([Nt.lights,Nt.fog,{color:{value:new Ut(0)},opacity:{value:1}}]),vertexShader:On.shadow_vert,fragmentShader:On.shadow_frag}};_a.physical={uniforms:Ho([_a.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Sn},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Sn},clearcoatNormalScale:{value:new Oe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Sn},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Sn},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Sn},sheen:{value:0},sheenColor:{value:new Ut(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Sn},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Sn},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Sn},transmissionSamplerSize:{value:new Oe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Sn},attenuationDistance:{value:0},attenuationColor:{value:new Ut(0)},specularColor:{value:new Ut(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Sn},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Sn},anisotropyVector:{value:new Oe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Sn}}]),vertexShader:On.meshphysical_vert,fragmentShader:On.meshphysical_frag};var s3={r:0,b:0,g:0},gde=new on,GW=new Sn;GW.set(-1,0,0,0,1,0,0,0,1);function _de(i,e,t,n,r,s){let o=new Ut(0),a=r===!0?0:1,l,c,u=null,f=0,p=null;function x(P){let R=P.isScene===!0?P.background:null;if(R&&R.isTexture){let C=P.backgroundBlurriness>0;R=e.get(R,C)}return R}function v(P){let R=!1,C=x(P);C===null?S(o,a):C&&C.isColor&&(S(C,1),R=!0);let L=i.xr.getEnvironmentBlendMode();L==="additive"?t.buffers.color.setClear(0,0,0,1,s):L==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(i.autoClear||R)&&(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(P,R){let C=x(R);C&&(C.isCubeTexture||C.mapping===$u)?(c===void 0&&(c=new Gn(new Hc(1,1,1),new $r({name:"BackgroundCubeMaterial",uniforms:$A(_a.backgroundCube.uniforms),vertexShader:_a.backgroundCube.vertexShader,fragmentShader:_a.backgroundCube.fragmentShader,side:hi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(L,D,F){this.matrixWorld.copyPosition(F.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(c)),c.material.uniforms.envMap.value=C,c.material.uniforms.backgroundBlurriness.value=R.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=R.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(gde.makeRotationFromEuler(R.backgroundRotation)).transpose(),C.isCubeTexture&&C.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(GW),c.material.toneMapped=sn.getTransfer(C.colorSpace)!==Bt,(u!==C||f!==C.version||p!==i.toneMapping)&&(c.material.needsUpdate=!0,u=C,f=C.version,p=i.toneMapping),c.layers.enableAll(),P.unshift(c,c.geometry,c.material,0,0,null)):C&&C.isTexture&&(l===void 0&&(l=new Gn(new IA(2,2),new $r({name:"BackgroundMaterial",uniforms:$A(_a.background.uniforms),vertexShader:_a.background.vertexShader,fragmentShader:_a.background.fragmentShader,side:go,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=C,l.material.uniforms.backgroundIntensity.value=R.backgroundIntensity,l.material.toneMapped=sn.getTransfer(C.colorSpace)!==Bt,C.matrixAutoUpdate===!0&&C.updateMatrix(),l.material.uniforms.uvTransform.value.copy(C.matrix),(u!==C||f!==C.version||p!==i.toneMapping)&&(l.material.needsUpdate=!0,u=C,f=C.version,p=i.toneMapping),l.layers.enableAll(),P.unshift(l,l.geometry,l.material,0,0,null))}function S(P,R){P.getRGB(s3,LL(i)),t.buffers.color.setClear(s3.r,s3.g,s3.b,R,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(P,R=1){o.set(P),a=R,S(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(P){a=P,S(o,a)},render:v,addToRenderList:w,dispose:T}}function xde(i,e){let t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=p(null),s=r,o=!1;function a(V,H,Z,J,j){let K=!1,ee=f(V,J,Z,H);s!==ee&&(s=ee,c(s.object)),K=x(V,J,Z,j),K&&v(V,J,Z,j),j!==null&&e.update(j,i.ELEMENT_ARRAY_BUFFER),(K||o)&&(o=!1,C(V,H,Z,J),j!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(j).buffer))}function l(){return i.createVertexArray()}function c(V){return i.bindVertexArray(V)}function u(V){return i.deleteVertexArray(V)}function f(V,H,Z,J){let j=J.wireframe===!0,K=n[H.id];K===void 0&&(K={},n[H.id]=K);let ee=V.isInstancedMesh===!0?V.id:0,ae=K[ee];ae===void 0&&(ae={},K[ee]=ae);let ce=ae[Z.id];ce===void 0&&(ce={},ae[Z.id]=ce);let de=ce[j];return de===void 0&&(de=p(l()),ce[j]=de),de}function p(V){let H=[],Z=[],J=[];for(let j=0;j<t;j++)H[j]=0,Z[j]=0,J[j]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:H,enabledAttributes:Z,attributeDivisors:J,object:V,attributes:{},index:null}}function x(V,H,Z,J){let j=s.attributes,K=H.attributes,ee=0,ae=Z.getAttributes();for(let ce in ae)if(ae[ce].location>=0){let ve=j[ce],Ie=K[ce];if(Ie===void 0&&(ce==="instanceMatrix"&&V.instanceMatrix&&(Ie=V.instanceMatrix),ce==="instanceColor"&&V.instanceColor&&(Ie=V.instanceColor)),ve===void 0||ve.attribute!==Ie||Ie&&ve.data!==Ie.data)return!0;ee++}return s.attributesNum!==ee||s.index!==J}function v(V,H,Z,J){let j={},K=H.attributes,ee=0,ae=Z.getAttributes();for(let ce in ae)if(ae[ce].location>=0){let ve=K[ce];ve===void 0&&(ce==="instanceMatrix"&&V.instanceMatrix&&(ve=V.instanceMatrix),ce==="instanceColor"&&V.instanceColor&&(ve=V.instanceColor));let Ie={};Ie.attribute=ve,ve&&ve.data&&(Ie.data=ve.data),j[ce]=Ie,ee++}s.attributes=j,s.attributesNum=ee,s.index=J}function w(){let V=s.newAttributes;for(let H=0,Z=V.length;H<Z;H++)V[H]=0}function S(V){T(V,0)}function T(V,H){let Z=s.newAttributes,J=s.enabledAttributes,j=s.attributeDivisors;Z[V]=1,J[V]===0&&(i.enableVertexAttribArray(V),J[V]=1),j[V]!==H&&(i.vertexAttribDivisor(V,H),j[V]=H)}function P(){let V=s.newAttributes,H=s.enabledAttributes;for(let Z=0,J=H.length;Z<J;Z++)H[Z]!==V[Z]&&(i.disableVertexAttribArray(Z),H[Z]=0)}function R(V,H,Z,J,j,K,ee){ee===!0?i.vertexAttribIPointer(V,H,Z,j,K):i.vertexAttribPointer(V,H,Z,J,j,K)}function C(V,H,Z,J){w();let j=J.attributes,K=Z.getAttributes(),ee=H.defaultAttributeValues;for(let ae in K){let ce=K[ae];if(ce.location>=0){let de=j[ae];if(de===void 0&&(ae==="instanceMatrix"&&V.instanceMatrix&&(de=V.instanceMatrix),ae==="instanceColor"&&V.instanceColor&&(de=V.instanceColor)),de!==void 0){let ve=de.normalized,Ie=de.itemSize,Qe=e.get(de);if(Qe===void 0)continue;let Ue=Qe.buffer,mt=Qe.type,Me=Qe.bytesPerElement,ze=mt===i.INT||mt===i.UNSIGNED_INT||de.gpuType===Dr;if(de.isInterleavedBufferAttribute){let $e=de.data,Et=$e.stride,Tt=de.offset;if($e.isInstancedInterleavedBuffer){for(let Ct=0;Ct<ce.locationSize;Ct++)T(ce.location+Ct,$e.meshPerAttribute);V.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=$e.meshPerAttribute*$e.count)}else for(let Ct=0;Ct<ce.locationSize;Ct++)S(ce.location+Ct);i.bindBuffer(i.ARRAY_BUFFER,Ue);for(let Ct=0;Ct<ce.locationSize;Ct++)R(ce.location+Ct,Ie/ce.locationSize,mt,ve,Et*Me,(Tt+Ie/ce.locationSize*Ct)*Me,ze)}else{if(de.isInstancedBufferAttribute){for(let $e=0;$e<ce.locationSize;$e++)T(ce.location+$e,de.meshPerAttribute);V.isInstancedMesh!==!0&&J._maxInstanceCount===void 0&&(J._maxInstanceCount=de.meshPerAttribute*de.count)}else for(let $e=0;$e<ce.locationSize;$e++)S(ce.location+$e);i.bindBuffer(i.ARRAY_BUFFER,Ue);for(let $e=0;$e<ce.locationSize;$e++)R(ce.location+$e,Ie/ce.locationSize,mt,ve,Ie*Me,Ie/ce.locationSize*$e*Me,ze)}}else if(ee!==void 0){let ve=ee[ae];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)}}}}P()}function L(){B();for(let V in n){let H=n[V];for(let Z in H){let J=H[Z];for(let j in J){let K=J[j];for(let ee in K)u(K[ee].object),delete K[ee];delete J[j]}}delete n[V]}}function D(V){if(n[V.id]===void 0)return;let H=n[V.id];for(let Z in H){let J=H[Z];for(let j in J){let K=J[j];for(let ee in K)u(K[ee].object),delete K[ee];delete J[j]}}delete n[V.id]}function F(V){for(let H in n){let Z=n[H];for(let J in Z){let j=Z[J];if(j[V.id]===void 0)continue;let K=j[V.id];for(let ee in K)u(K[ee].object),delete K[ee];delete j[V.id]}}}function N(V){for(let H in n){let Z=n[H],J=V.isInstancedMesh===!0?V.id:0,j=Z[J];if(j!==void 0){for(let K in j){let ee=j[K];for(let ae in ee)u(ee[ae].object),delete ee[ae];delete j[K]}delete Z[J],Object.keys(Z).length===0&&delete n[H]}}}function B(){z(),o=!0,s!==r&&(s=r,c(s.object))}function z(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:a,reset:B,resetDefaultState:z,dispose:L,releaseStatesOfGeometry:D,releaseStatesOfObject:N,releaseStatesOfProgram:F,initAttributes:w,enableAttribute:S,disableUnusedAttributes:P}}function yde(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 p=0;for(let x=0;x<u;x++)p+=c[x];t.update(p,n,1)}this.setMode=r,this.render=s,this.renderInstances=o,this.renderMultiDraw=a}function vde(i,e,t,n){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){let F=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(F.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(F){return!(F!==br&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(F){let N=F===Di&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(F!==zi&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&F!==Zi&&!N)}function l(F){if(F==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";F="mediump"}return F==="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&&(je("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);let f=t.logarithmicDepthBuffer===!0,p=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&p===!1&&je("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let x=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),v=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),P=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),R=i.getParameter(i.MAX_VARYING_VECTORS),C=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),L=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:p,maxTextures:x,maxVertexTextures:v,maxTextureSize:w,maxCubemapSize:S,maxAttributes:T,maxVertexUniforms:P,maxVaryings:R,maxFragmentUniforms:C,maxSamples:L,samples:D}}function bde(i){let e=this,t=null,n=0,r=!1,s=!1,o=new la,a=new Sn,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p){let x=f.length!==0||p||n!==0||r;return r=p,n=f.length,x},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,p){t=u(f,p,0)},this.setState=function(f,p,x){let v=f.clippingPlanes,w=f.clipIntersection,S=f.clipShadows,T=i.get(f);if(!r||v===null||v.length===0||s&&!S)s?u(null):c();else{let P=s?0:n,R=P*4,C=T.clippingState||null;l.value=C,C=u(v,p,R,x);for(let L=0;L!==R;++L)C[L]=t[L];T.clippingState=C,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=P}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,p,x,v){let w=f!==null?f.length:0,S=null;if(w!==0){if(S=l.value,v!==!0||S===null){let T=x+w*4,P=p.matrixWorldInverse;a.getNormalMatrix(P),(S===null||S.length<T)&&(S=new Float32Array(T));for(let R=0,C=x;R!==w;++R,C+=4)o.copy(f[R]).applyMatrix4(P,a),o.normal.toArray(S,C),S[C+3]=o.constant}l.value=S,l.needsUpdate=!0}return e.numPlanes=w,e.numIntersection=0,S}}var Bp=4,mW=[.125,.215,.35,.446,.526,.582],ZA=20,wde=256,P2=new Wc,gW=new Ut,zL=null,VL=0,qL=0,HL=!1,Sde=new ie,a3=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=Sde}=s;zL=this._renderer.getRenderTarget(),VL=this._renderer.getActiveCubeFace(),qL=this._renderer.getActiveMipmapLevel(),HL=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=yW(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=xW(),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(zL,VL,qL),this._renderer.xr.enabled=HL,e.scissorTest=!1,L_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===vl||e.mapping===ic?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),zL=this._renderer.getRenderTarget(),VL=this._renderer.getActiveCubeFace(),qL=this._renderer.getActiveMipmapLevel(),HL=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:bi,minFilter:bi,generateMipmaps:!1,type:Di,format:br,colorSpace:Yd,depthBuffer:!1},r=_W(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=_W(e,t,n);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=Tde(s)),this._blurMaterial=Mde(s,e,t),this._ggxMaterial=Ede(s,e,t)}return r}_compileMaterial(e){let t=new Gn(new qn,e);this._renderer.compile(t,P2)}_sceneToCubeUV(e,t,n,r,s){let l=new Nr(90,1,t,n),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],f=this._renderer,p=f.autoClear,x=f.toneMapping;f.getClearColor(gW),f.toneMapping=zs,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Gn(new Hc,new as({name:"PMREM.Background",side:hi,depthWrite:!1,depthTest:!1})));let w=this._backgroundBox,S=w.material,T=!1,P=e.background;P?P.isColor&&(S.color.copy(P),e.background=null,T=!0):(S.color.copy(gW),T=!0);for(let R=0;R<6;R++){let C=R%3;C===0?(l.up.set(0,c[R],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[R],s.y,s.z)):C===1?(l.up.set(0,0,c[R]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[R],s.z)):(l.up.set(0,c[R],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[R]));let L=this._cubeSize;L_(r,C*L,R>2?L:0,L,L),f.setRenderTarget(r),T&&f.render(w,l),f.render(e,l)}f.toneMapping=x,f.autoClear=p,e.background=P}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===vl||e.mapping===ic;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=yW()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=xW());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;L_(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,P2)}_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),p=0+c*1.25,x=f*p,{_lodMax:v}=this,w=this._sizeLods[n],S=3*w*(n>v-Bp?n-v+Bp:0),T=4*(this._cubeSize-w);l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=v-t,L_(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,P2),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=v-n,L_(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,P2)}_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"&&Ge("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let p=c.uniforms,x=this._sizeLods[n]-1,v=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*ZA-1),w=s/v,S=isFinite(s)?1+Math.floor(u*w):ZA;S>ZA&&je(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${ZA}`);let T=[],P=0;for(let F=0;F<ZA;++F){let N=F/w,B=Math.exp(-N*N/2);T.push(B),F===0?P+=B:F<S&&(P+=2*B)}for(let F=0;F<T.length;F++)T[F]=T[F]/P;p.envMap.value=e.texture,p.samples.value=S,p.weights.value=T,p.latitudinal.value=o==="latitudinal",a&&(p.poleAxis.value=a);let{_lodMax:R}=this;p.dTheta.value=v,p.mipInt.value=R-n;let C=this._sizeLods[r],L=3*C*(r>R-Bp?r-R+Bp:0),D=4*(this._cubeSize-C);L_(t,L,D,3*C,2*C),l.setRenderTarget(t),l.render(f,P2)}};function Tde(i){let e=[],t=[],n=[],r=i,s=i-Bp+1+mW.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-Bp?l=mW[o-i+Bp-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,p=[u,u,f,u,f,f,u,u,f,f,u,f],x=6,v=6,w=3,S=2,T=1,P=new Float32Array(w*v*x),R=new Float32Array(S*v*x),C=new Float32Array(T*v*x);for(let D=0;D<x;D++){let F=D%3*2/3-1,N=D>2?0:-1,B=[F,N,0,F+2/3,N,0,F+2/3,N+1,0,F,N,0,F+2/3,N+1,0,F,N+1,0];P.set(B,w*v*D),R.set(p,S*v*D);let z=[D,D,D,D,D,D];C.set(z,T*v*D)}let L=new qn;L.setAttribute("position",new Li(P,w)),L.setAttribute("uv",new Li(R,S)),L.setAttribute("faceIndex",new Li(C,T)),n.push(new Gn(L,null)),r>Bp&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function _W(i,e,t){let n=new ha(i,e,t);return n.texture.mapping=$u,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function L_(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function Ede(i,e,t){return new $r({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:wde,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:u3(),fragmentShader:`36803680 36813681 precision highp float;36823682 precision highp int;
@@ -3780,7 +3780,7 @@ void main() {
37803780 37813781 gl_FragColor = vec4(prefilteredColor, 1.0);37823782 }3783- `,blending:Yr,depthTest:!1,depthWrite:!1})}function Tde(i,e,t){let n=new Float32Array($A),r=new ie(0,1,0);return new $r({name:"SphericalGaussianBlur",defines:{n:$A,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:l3(),fragmentShader:`3783+ `,blending:Yr,depthTest:!1,depthWrite:!1})}function Mde(i,e,t){let n=new Float32Array(ZA),r=new ie(0,1,0);return new $r({name:"SphericalGaussianBlur",defines:{n:ZA,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:u3(),fragmentShader:`37843784 37853785 precision mediump float;37863786 precision mediump int;
@@ -3840,7 +3840,7 @@ void main() {
38403840 }38413841 38423842 }3843- `,blending:Yr,depthTest:!1,depthWrite:!1})}function gW(){return new $r({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:l3(),fragmentShader:`3843+ `,blending:Yr,depthTest:!1,depthWrite:!1})}function xW(){return new $r({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:u3(),fragmentShader:`38443844 38453845 precision mediump float;38463846 precision mediump int;
@@ -3859,7 +3859,7 @@ void main() {
38593859 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );38603860 38613861 }3862- `,blending:Yr,depthTest:!1,depthWrite:!1})}function _W(){return new $r({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:l3(),fragmentShader:`3862+ `,blending:Yr,depthTest:!1,depthWrite:!1})}function yW(){return new $r({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:u3(),fragmentShader:`38633863 38643864 precision mediump float;38653865 precision mediump int;
@@ -3875,7 +3875,7 @@ void main() {
38753875 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );38763876 38773877 }3878- `,blending:Yr,depthTest:!1,depthWrite:!1})}function l3(){return`3878+ `,blending:Yr,depthTest:!1,depthWrite:!1})}function u3(){return`38793879 38803880 precision mediump float;38813881 precision mediump int;
@@ -3930,7 +3930,7 @@ void main() {
39303930 gl_Position = vec4( position, 1.0 );39313931 39323932 }3933- `}var o3=class extends ha{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 Gu(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:`3933+ `}var l3=class extends ha{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 Vu(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:`39343934 39353935 varying vec3 vWorldDirection;39363936
@@ -3965,7 +3965,7 @@ void main() {
39653965 gl_FragColor = texture2D( tEquirect, sampleUV );39663966 39673967 }3968- `},r=new qc(5,5,5),s=new $r({name:"CubemapFromEquirect",uniforms:jA(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:ui,blending:Yr});s.uniforms.tEquirect.value=t;let o=new Gn(r,s),a=t.minFilter;return t.minFilter===xo&&(t.minFilter=bi),new T_(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 Ede(i){let e=new WeakMap,t=new WeakMap,n=null;function r(p,x=!1){return p==null?null:x?o(p):s(p)}function s(p){if(p&&p.isTexture){let x=p.mapping;if(x===op||x===ap)if(e.has(p)){let v=e.get(p).texture;return a(v,p.mapping)}else{let v=p.image;if(v&&v.height>0){let w=new o3(v.height);return w.fromEquirectangularTexture(i,p),e.set(p,w),p.addEventListener("dispose",c),a(w.texture,p.mapping)}else return null}}return p}function o(p){if(p&&p.isTexture){let x=p.mapping,v=x===op||x===ap,w=x===yl||x===nc;if(v||w){let S=t.get(p),T=S!==void 0?S.texture.pmremVersion:0;if(p.isRenderTargetTexture&&p.pmremVersion!==T)return n===null&&(n=new s3(i)),S=v?n.fromEquirectangular(p,S):n.fromCubemap(p,S),S.texture.pmremVersion=p.pmremVersion,t.set(p,S),S.texture;if(S!==void 0)return S.texture;{let P=p.image;return v&&P&&P.height>0||w&&P&&l(P)?(n===null&&(n=new s3(i)),S=v?n.fromEquirectangular(p):n.fromCubemap(p),S.texture.pmremVersion=p.pmremVersion,t.set(p,S),p.addEventListener("dispose",u),S.texture):null}}}return p}function a(p,x){return x===op?p.mapping=yl:x===ap&&(p.mapping=nc),p}function l(p){let x=0,v=6;for(let w=0;w<v;w++)p[w]!==void 0&&x++;return x===v}function c(p){let x=p.target;x.removeEventListener("dispose",c);let v=e.get(x);v!==void 0&&(e.delete(x),v.dispose())}function u(p){let x=p.target;x.removeEventListener("dispose",u);let v=t.get(x);v!==void 0&&(t.delete(x),v.dispose())}function f(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:f}}function Mde(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&&Kn("WebGLRenderer: "+n+" extension not supported."),r}}}function Cde(i,e,t,n){let r={},s=new WeakMap;function o(f){let p=f.target;p.index!==null&&e.remove(p.index);for(let v in p.attributes)e.remove(p.attributes[v]);p.removeEventListener("dispose",o),delete r[p.id];let x=s.get(p);x&&(e.remove(x),s.delete(p)),n.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function a(f,p){return r[p.id]===!0||(p.addEventListener("dispose",o),r[p.id]=!0,t.memory.geometries++),p}function l(f){let p=f.attributes;for(let x in p)e.update(p[x],i.ARRAY_BUFFER)}function c(f){let p=[],x=f.index,v=f.attributes.position,w=0;if(v===void 0)return;if(x!==null){let P=x.array;w=x.version;for(let R=0,C=P.length;R<C;R+=3){let L=P[R+0],D=P[R+1],F=P[R+2];p.push(L,D,D,F,F,L)}}else{let P=v.array;w=v.version;for(let R=0,C=P.length/3-1;R<C;R+=3){let L=R+0,D=R+1,F=R+2;p.push(L,D,D,F,F,L)}}let S=new(v.count>=65535?wA:bA)(p,1);S.version=w;let T=s.get(f);T&&e.remove(T),s.set(f,S)}function u(f){let p=s.get(f);if(p){let x=f.index;x!==null&&p.version<x.version&&c(f)}else c(f);return s.get(f)}return{get:a,update:l,getWireframeAttribute:u}}function Rde(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,p){i.drawElements(n,p,s,f*o),t.update(p,n,1)}function c(f,p,x){x!==0&&(i.drawElementsInstanced(n,p,s,f*o,x),t.update(p,n,x))}function u(f,p,x){if(x===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,p,0,s,f,0,x);let w=0;for(let S=0;S<x;S++)w+=p[S];t.update(w,n,1)}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function Pde(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:Ge("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 Ide(i,e,t){let n=new WeakMap,r=new gn;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,p=n.get(a);if(p===void 0||p.count!==f){let B=function(){F.dispose(),n.delete(a),a.removeEventListener("dispose",B)};p!==void 0&&p.texture.dispose();let x=a.morphAttributes.position!==void 0,v=a.morphAttributes.normal!==void 0,w=a.morphAttributes.color!==void 0,S=a.morphAttributes.position||[],T=a.morphAttributes.normal||[],P=a.morphAttributes.color||[],R=0;x===!0&&(R=1),v===!0&&(R=2),w===!0&&(R=3);let C=a.attributes.position.count*R,L=1;C>e.maxTextureSize&&(L=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);let D=new Float32Array(C*L*4*f),F=new vA(D,C,L,f);F.type=Zi,F.needsUpdate=!0;let N=R*4;for(let z=0;z<f;z++){let V=S[z],H=T[z],Z=P[z],J=C*L*4*z;for(let j=0;j<V.count;j++){let K=j*N;x===!0&&(r.fromBufferAttribute(V,j),D[J+K+0]=r.x,D[J+K+1]=r.y,D[J+K+2]=r.z,D[J+K+3]=0),v===!0&&(r.fromBufferAttribute(H,j),D[J+K+4]=r.x,D[J+K+5]=r.y,D[J+K+6]=r.z,D[J+K+7]=0),w===!0&&(r.fromBufferAttribute(Z,j),D[J+K+8]=r.x,D[J+K+9]=r.y,D[J+K+10]=r.z,D[J+K+11]=Z.itemSize===4?r.w:1)}}p={count:f,texture:F,size:new Oe(C,L)},n.set(a,p),a.addEventListener("dispose",B)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",o.morphTexture,t);else{let x=0;for(let w=0;w<c.length;w++)x+=c[w];let v=a.morphTargetsRelative?1:1-x;l.getUniforms().setValue(i,"morphTargetBaseInfluence",v),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",p.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",p.size)}return{update:s}}function Nde(i,e,t,n,r){let s=new WeakMap;function o(c){let u=r.render.frame,f=c.geometry,p=e.get(c,f);if(s.get(p)!==u&&(e.update(p),s.set(p,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 x=c.skeleton;s.get(x)!==u&&(x.update(),s.set(x,u))}return p}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 Lde={[f2]:"LINEAR_TONE_MAPPING",[d2]:"REINHARD_TONE_MAPPING",[p2]:"CINEON_TONE_MAPPING",[A2]:"ACES_FILMIC_TONE_MAPPING",[m2]:"AGX_TONE_MAPPING",[g2]:"NEUTRAL_TONE_MAPPING",[iL]:"CUSTOM_TONE_MAPPING"};function Dde(i,e,t,n,r,s){let o=new ha(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new ls(e,t):void 0}),a=new ha(e,t,{type:Di,depthBuffer:!1,stencilBuffer:!1}),l=new qn;l.setAttribute("position",new Rn([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new Rn([0,2,0,0,2,0],2));let c=new PT({uniforms:{tDiffuse:{value:null}},vertexShader:`3968+ `},r=new Hc(5,5,5),s=new $r({name:"CubemapFromEquirect",uniforms:$A(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:hi,blending:Yr});s.uniforms.tEquirect.value=t;let o=new Gn(r,s),a=t.minFilter;return t.minFilter===xo&&(t.minFilter=bi),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 Cde(i){let e=new WeakMap,t=new WeakMap,n=null;function r(p,x=!1){return p==null?null:x?o(p):s(p)}function s(p){if(p&&p.isTexture){let x=p.mapping;if(x===ap||x===lp)if(e.has(p)){let v=e.get(p).texture;return a(v,p.mapping)}else{let v=p.image;if(v&&v.height>0){let w=new l3(v.height);return w.fromEquirectangularTexture(i,p),e.set(p,w),p.addEventListener("dispose",c),a(w.texture,p.mapping)}else return null}}return p}function o(p){if(p&&p.isTexture){let x=p.mapping,v=x===ap||x===lp,w=x===vl||x===ic;if(v||w){let S=t.get(p),T=S!==void 0?S.texture.pmremVersion:0;if(p.isRenderTargetTexture&&p.pmremVersion!==T)return n===null&&(n=new a3(i)),S=v?n.fromEquirectangular(p,S):n.fromCubemap(p,S),S.texture.pmremVersion=p.pmremVersion,t.set(p,S),S.texture;if(S!==void 0)return S.texture;{let P=p.image;return v&&P&&P.height>0||w&&P&&l(P)?(n===null&&(n=new a3(i)),S=v?n.fromEquirectangular(p):n.fromCubemap(p),S.texture.pmremVersion=p.pmremVersion,t.set(p,S),p.addEventListener("dispose",u),S.texture):null}}}return p}function a(p,x){return x===ap?p.mapping=vl:x===lp&&(p.mapping=ic),p}function l(p){let x=0,v=6;for(let w=0;w<v;w++)p[w]!==void 0&&x++;return x===v}function c(p){let x=p.target;x.removeEventListener("dispose",c);let v=e.get(x);v!==void 0&&(e.delete(x),v.dispose())}function u(p){let x=p.target;x.removeEventListener("dispose",u);let v=t.get(x);v!==void 0&&(t.delete(x),v.dispose())}function f(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:f}}function Rde(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&&Kn("WebGLRenderer: "+n+" extension not supported."),r}}}function Pde(i,e,t,n){let r={},s=new WeakMap;function o(f){let p=f.target;p.index!==null&&e.remove(p.index);for(let v in p.attributes)e.remove(p.attributes[v]);p.removeEventListener("dispose",o),delete r[p.id];let x=s.get(p);x&&(e.remove(x),s.delete(p)),n.releaseStatesOfGeometry(p),p.isInstancedBufferGeometry===!0&&delete p._maxInstanceCount,t.memory.geometries--}function a(f,p){return r[p.id]===!0||(p.addEventListener("dispose",o),r[p.id]=!0,t.memory.geometries++),p}function l(f){let p=f.attributes;for(let x in p)e.update(p[x],i.ARRAY_BUFFER)}function c(f){let p=[],x=f.index,v=f.attributes.position,w=0;if(v===void 0)return;if(x!==null){let P=x.array;w=x.version;for(let R=0,C=P.length;R<C;R+=3){let L=P[R+0],D=P[R+1],F=P[R+2];p.push(L,D,D,F,F,L)}}else{let P=v.array;w=v.version;for(let R=0,C=P.length/3-1;R<C;R+=3){let L=R+0,D=R+1,F=R+2;p.push(L,D,D,F,F,L)}}let S=new(v.count>=65535?SA:wA)(p,1);S.version=w;let T=s.get(f);T&&e.remove(T),s.set(f,S)}function u(f){let p=s.get(f);if(p){let x=f.index;x!==null&&p.version<x.version&&c(f)}else c(f);return s.get(f)}return{get:a,update:l,getWireframeAttribute:u}}function Ide(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,p){i.drawElements(n,p,s,f*o),t.update(p,n,1)}function c(f,p,x){x!==0&&(i.drawElementsInstanced(n,p,s,f*o,x),t.update(p,n,x))}function u(f,p,x){if(x===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,p,0,s,f,0,x);let w=0;for(let S=0;S<x;S++)w+=p[S];t.update(w,n,1)}this.setMode=r,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function Nde(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:Ge("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 Lde(i,e,t){let n=new WeakMap,r=new gn;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,p=n.get(a);if(p===void 0||p.count!==f){let B=function(){F.dispose(),n.delete(a),a.removeEventListener("dispose",B)};p!==void 0&&p.texture.dispose();let x=a.morphAttributes.position!==void 0,v=a.morphAttributes.normal!==void 0,w=a.morphAttributes.color!==void 0,S=a.morphAttributes.position||[],T=a.morphAttributes.normal||[],P=a.morphAttributes.color||[],R=0;x===!0&&(R=1),v===!0&&(R=2),w===!0&&(R=3);let C=a.attributes.position.count*R,L=1;C>e.maxTextureSize&&(L=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);let D=new Float32Array(C*L*4*f),F=new bA(D,C,L,f);F.type=Zi,F.needsUpdate=!0;let N=R*4;for(let z=0;z<f;z++){let V=S[z],H=T[z],Z=P[z],J=C*L*4*z;for(let j=0;j<V.count;j++){let K=j*N;x===!0&&(r.fromBufferAttribute(V,j),D[J+K+0]=r.x,D[J+K+1]=r.y,D[J+K+2]=r.z,D[J+K+3]=0),v===!0&&(r.fromBufferAttribute(H,j),D[J+K+4]=r.x,D[J+K+5]=r.y,D[J+K+6]=r.z,D[J+K+7]=0),w===!0&&(r.fromBufferAttribute(Z,j),D[J+K+8]=r.x,D[J+K+9]=r.y,D[J+K+10]=r.z,D[J+K+11]=Z.itemSize===4?r.w:1)}}p={count:f,texture:F,size:new Oe(C,L)},n.set(a,p),a.addEventListener("dispose",B)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(i,"morphTexture",o.morphTexture,t);else{let x=0;for(let w=0;w<c.length;w++)x+=c[w];let v=a.morphTargetsRelative?1:1-x;l.getUniforms().setValue(i,"morphTargetBaseInfluence",v),l.getUniforms().setValue(i,"morphTargetInfluences",c)}l.getUniforms().setValue(i,"morphTargetsTexture",p.texture,t),l.getUniforms().setValue(i,"morphTargetsTextureSize",p.size)}return{update:s}}function Dde(i,e,t,n,r){let s=new WeakMap;function o(c){let u=r.render.frame,f=c.geometry,p=e.get(c,f);if(s.get(p)!==u&&(e.update(p),s.set(p,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 x=c.skeleton;s.get(x)!==u&&(x.update(),s.set(x,u))}return p}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 Fde={[p2]:"LINEAR_TONE_MAPPING",[A2]:"REINHARD_TONE_MAPPING",[m2]:"CINEON_TONE_MAPPING",[g2]:"ACES_FILMIC_TONE_MAPPING",[_2]:"AGX_TONE_MAPPING",[x2]:"NEUTRAL_TONE_MAPPING",[uL]:"CUSTOM_TONE_MAPPING"};function Ode(i,e,t,n,r,s){let o=new ha(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new ls(e,t):void 0}),a=new ha(e,t,{type:Di,depthBuffer:!1,stencilBuffer:!1}),l=new qn;l.setAttribute("position",new Rn([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new Rn([0,2,0,0,2,0],2));let c=new NT({uniforms:{tDiffuse:{value:null}},vertexShader:`39693969 precision highp float;39703970 39713971 uniform mat4 modelViewMatrix;
@@ -4011,17 +4011,17 @@ void main() {
40114011 #ifdef SRGB_TRANSFER40124012 gl_FragColor = sRGBTransferOETF( gl_FragColor );40134013 #endif4014- }`,depthTest:!1,depthWrite:!1}),u=new Gn(l,c),f=new Hc(-1,1,1,-1,0,1),p=null,x=null,v=!1,w,S=null,T=[],P=!1;this.setSize=function(R,C){o.setSize(R,C),a.setSize(R,C);for(let L=0;L<T.length;L++){let D=T[L];D.setSize&&D.setSize(R,C)}},this.setEffects=function(R){T=R,P=T.length>0&&T[0].isRenderPass===!0;let C=o.width,L=o.height;for(let D=0;D<T.length;D++){let F=T[D];F.setSize&&F.setSize(C,L)}},this.begin=function(R,C){if(v||R.toneMapping===zs&&T.length===0)return!1;if(S=C,C!==null){let L=C.width,D=C.height;(o.width!==L||o.height!==D)&&this.setSize(L,D)}return P===!1&&R.setRenderTarget(o),w=R.toneMapping,R.toneMapping=zs,!0},this.hasRenderPass=function(){return P},this.end=function(R,C){R.toneMapping=w,v=!0;let L=o,D=a;for(let F=0;F<T.length;F++){let N=T[F];if(N.enabled!==!1&&(N.render(R,D,L,C),N.needsSwap!==!1)){let B=L;L=D,D=B}}if(p!==R.outputColorSpace||x!==R.toneMapping){p=R.outputColorSpace,x=R.toneMapping,c.defines={},sn.getTransfer(p)===Bt&&(c.defines.SRGB_TRANSFER="");let F=Lde[x];F&&(c.defines[F]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=L.texture,R.setRenderTarget(S),R.render(u,f),S=null,v=!1},this.isCompositing=function(){return v},this.dispose=function(){o.depthTexture&&o.depthTexture.dispose(),o.dispose(),a.dispose(),l.dispose(),c.dispose()}}var kW=new ws,GL=new ls(1,1),GW=new vA,zW=new bT,VW=new Gu,xW=[],yW=[],vW=new Float32Array(16),bW=new Float32Array(9),wW=new Float32Array(4);function D_(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=xW[r];if(s===void 0&&(s=new Float32Array(r),xW[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 Vs(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 qs(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function c3(i,e){let t=yW[e];t===void 0&&(t=new Int32Array(e),yW[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Fde(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function Ode(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(Vs(t,e))return;i.uniform2fv(this.addr,e),qs(t,e)}}function Bde(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(Vs(t,e))return;i.uniform3fv(this.addr,e),qs(t,e)}}function Ude(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(Vs(t,e))return;i.uniform4fv(this.addr,e),qs(t,e)}}function kde(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Vs(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),qs(t,e)}else{if(Vs(t,n))return;wW.set(n),i.uniformMatrix2fv(this.addr,!1,wW),qs(t,n)}}function Gde(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Vs(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),qs(t,e)}else{if(Vs(t,n))return;bW.set(n),i.uniformMatrix3fv(this.addr,!1,bW),qs(t,n)}}function zde(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Vs(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),qs(t,e)}else{if(Vs(t,n))return;vW.set(n),i.uniformMatrix4fv(this.addr,!1,vW),qs(t,n)}}function Vde(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function qde(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(Vs(t,e))return;i.uniform2iv(this.addr,e),qs(t,e)}}function Hde(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(Vs(t,e))return;i.uniform3iv(this.addr,e),qs(t,e)}}function Wde(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(Vs(t,e))return;i.uniform4iv(this.addr,e),qs(t,e)}}function jde(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Xde(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(Vs(t,e))return;i.uniform2uiv(this.addr,e),qs(t,e)}}function $de(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(Vs(t,e))return;i.uniform3uiv(this.addr,e),qs(t,e)}}function Yde(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(Vs(t,e))return;i.uniform4uiv(this.addr,e),qs(t,e)}}function Zde(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?(GL.compareFunction=t.isReversedDepthBuffer()?jc:ih,s=GL):s=kW,t.setTexture2D(e||s,r)}function Kde(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||zW,r)}function Qde(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||VW,r)}function Jde(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||GW,r)}function epe(i){switch(i){case 5126:return Fde;case 35664:return Ode;case 35665:return Bde;case 35666:return Ude;case 35674:return kde;case 35675:return Gde;case 35676:return zde;case 5124:case 35670:return Vde;case 35667:case 35671:return qde;case 35668:case 35672:return Hde;case 35669:case 35673:return Wde;case 5125:return jde;case 36294:return Xde;case 36295:return $de;case 36296:return Yde;case 35678:case 36198:case 36298:case 36306:case 35682:return Zde;case 35679:case 36299:case 36307:return Kde;case 35680:case 36300:case 36308:case 36293:return Qde;case 36289:case 36303:case 36311:case 36292:return Jde}}function tpe(i,e){i.uniform1fv(this.addr,e)}function npe(i,e){let t=D_(e,this.size,2);i.uniform2fv(this.addr,t)}function ipe(i,e){let t=D_(e,this.size,3);i.uniform3fv(this.addr,t)}function rpe(i,e){let t=D_(e,this.size,4);i.uniform4fv(this.addr,t)}function spe(i,e){let t=D_(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function ope(i,e){let t=D_(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function ape(i,e){let t=D_(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function lpe(i,e){i.uniform1iv(this.addr,e)}function cpe(i,e){i.uniform2iv(this.addr,e)}function upe(i,e){i.uniform3iv(this.addr,e)}function hpe(i,e){i.uniform4iv(this.addr,e)}function fpe(i,e){i.uniform1uiv(this.addr,e)}function dpe(i,e){i.uniform2uiv(this.addr,e)}function ppe(i,e){i.uniform3uiv(this.addr,e)}function Ape(i,e){i.uniform4uiv(this.addr,e)}function mpe(i,e,t){let n=this.cache,r=e.length,s=c3(t,r);Vs(n,s)||(i.uniform1iv(this.addr,s),qs(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=GL:o=kW;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function gpe(i,e,t){let n=this.cache,r=e.length,s=c3(t,r);Vs(n,s)||(i.uniform1iv(this.addr,s),qs(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||zW,s[o])}function _pe(i,e,t){let n=this.cache,r=e.length,s=c3(t,r);Vs(n,s)||(i.uniform1iv(this.addr,s),qs(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||VW,s[o])}function xpe(i,e,t){let n=this.cache,r=e.length,s=c3(t,r);Vs(n,s)||(i.uniform1iv(this.addr,s),qs(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||GW,s[o])}function ype(i){switch(i){case 5126:return tpe;case 35664:return npe;case 35665:return ipe;case 35666:return rpe;case 35674:return spe;case 35675:return ope;case 35676:return ape;case 5124:case 35670:return lpe;case 35667:case 35671:return cpe;case 35668:case 35672:return upe;case 35669:case 35673:return hpe;case 5125:return fpe;case 36294:return dpe;case 36295:return ppe;case 36296:return Ape;case 35678:case 36198:case 36298:case 36306:case 35682:return mpe;case 35679:case 36299:case 36307:return gpe;case 35680:case 36300:case 36308:case 36293:return _pe;case 36289:case 36303:case 36311:case 36292:return xpe}}var zL=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=epe(t.type)}},VL=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=ype(t.type)}},qL=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)}}},UL=/(\w+)(\])?(\[|\.)?/g;function SW(i,e){i.seq.push(e),i.map[e.id]=e}function vpe(i,e,t){let n=i.name,r=n.length;for(UL.lastIndex=0;;){let s=UL.exec(n),o=UL.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){SW(t,c===void 0?new zL(a,i,e):new VL(a,i,e));break}else{let f=t.map[a];f===void 0&&(f=new qL(a),SW(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);vpe(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 TW(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var bpe=37297,wpe=0;function Spe(i,e){let t=i.split(`4014+ }`,depthTest:!1,depthWrite:!1}),u=new Gn(l,c),f=new Wc(-1,1,1,-1,0,1),p=null,x=null,v=!1,w,S=null,T=[],P=!1;this.setSize=function(R,C){o.setSize(R,C),a.setSize(R,C);for(let L=0;L<T.length;L++){let D=T[L];D.setSize&&D.setSize(R,C)}},this.setEffects=function(R){T=R,P=T.length>0&&T[0].isRenderPass===!0;let C=o.width,L=o.height;for(let D=0;D<T.length;D++){let F=T[D];F.setSize&&F.setSize(C,L)}},this.begin=function(R,C){if(v||R.toneMapping===zs&&T.length===0)return!1;if(S=C,C!==null){let L=C.width,D=C.height;(o.width!==L||o.height!==D)&&this.setSize(L,D)}return P===!1&&R.setRenderTarget(o),w=R.toneMapping,R.toneMapping=zs,!0},this.hasRenderPass=function(){return P},this.end=function(R,C){R.toneMapping=w,v=!0;let L=o,D=a;for(let F=0;F<T.length;F++){let N=T[F];if(N.enabled!==!1&&(N.render(R,D,L,C),N.needsSwap!==!1)){let B=L;L=D,D=B}}if(p!==R.outputColorSpace||x!==R.toneMapping){p=R.outputColorSpace,x=R.toneMapping,c.defines={},sn.getTransfer(p)===Bt&&(c.defines.SRGB_TRANSFER="");let F=Fde[x];F&&(c.defines[F]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=L.texture,R.setRenderTarget(S),R.render(u,f),S=null,v=!1},this.isCompositing=function(){return v},this.dispose=function(){o.depthTexture&&o.depthTexture.dispose(),o.dispose(),a.dispose(),l.dispose(),c.dispose()}}var zW=new Ts,XL=new ls(1,1),VW=new bA,qW=new ST,HW=new Vu,vW=[],bW=[],wW=new Float32Array(16),SW=new Float32Array(9),TW=new Float32Array(4);function F_(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=vW[r];if(s===void 0&&(s=new Float32Array(r),vW[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 Vs(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 qs(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function h3(i,e){let t=bW[e];t===void 0&&(t=new Int32Array(e),bW[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Bde(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function Ude(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(Vs(t,e))return;i.uniform2fv(this.addr,e),qs(t,e)}}function kde(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(Vs(t,e))return;i.uniform3fv(this.addr,e),qs(t,e)}}function Gde(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(Vs(t,e))return;i.uniform4fv(this.addr,e),qs(t,e)}}function zde(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Vs(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),qs(t,e)}else{if(Vs(t,n))return;TW.set(n),i.uniformMatrix2fv(this.addr,!1,TW),qs(t,n)}}function Vde(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Vs(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),qs(t,e)}else{if(Vs(t,n))return;SW.set(n),i.uniformMatrix3fv(this.addr,!1,SW),qs(t,n)}}function qde(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Vs(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),qs(t,e)}else{if(Vs(t,n))return;wW.set(n),i.uniformMatrix4fv(this.addr,!1,wW),qs(t,n)}}function Hde(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function Wde(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(Vs(t,e))return;i.uniform2iv(this.addr,e),qs(t,e)}}function jde(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(Vs(t,e))return;i.uniform3iv(this.addr,e),qs(t,e)}}function Xde(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(Vs(t,e))return;i.uniform4iv(this.addr,e),qs(t,e)}}function $de(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Yde(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(Vs(t,e))return;i.uniform2uiv(this.addr,e),qs(t,e)}}function Zde(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(Vs(t,e))return;i.uniform3uiv(this.addr,e),qs(t,e)}}function Kde(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(Vs(t,e))return;i.uniform4uiv(this.addr,e),qs(t,e)}}function Qde(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?(XL.compareFunction=t.isReversedDepthBuffer()?Xc:sh,s=XL):s=zW,t.setTexture2D(e||s,r)}function Jde(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||qW,r)}function epe(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||HW,r)}function tpe(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||VW,r)}function npe(i){switch(i){case 5126:return Bde;case 35664:return Ude;case 35665:return kde;case 35666:return Gde;case 35674:return zde;case 35675:return Vde;case 35676:return qde;case 5124:case 35670:return Hde;case 35667:case 35671:return Wde;case 35668:case 35672:return jde;case 35669:case 35673:return Xde;case 5125:return $de;case 36294:return Yde;case 36295:return Zde;case 36296:return Kde;case 35678:case 36198:case 36298:case 36306:case 35682:return Qde;case 35679:case 36299:case 36307:return Jde;case 35680:case 36300:case 36308:case 36293:return epe;case 36289:case 36303:case 36311:case 36292:return tpe}}function ipe(i,e){i.uniform1fv(this.addr,e)}function rpe(i,e){let t=F_(e,this.size,2);i.uniform2fv(this.addr,t)}function spe(i,e){let t=F_(e,this.size,3);i.uniform3fv(this.addr,t)}function ope(i,e){let t=F_(e,this.size,4);i.uniform4fv(this.addr,t)}function ape(i,e){let t=F_(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function lpe(i,e){let t=F_(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function cpe(i,e){let t=F_(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function upe(i,e){i.uniform1iv(this.addr,e)}function hpe(i,e){i.uniform2iv(this.addr,e)}function fpe(i,e){i.uniform3iv(this.addr,e)}function dpe(i,e){i.uniform4iv(this.addr,e)}function ppe(i,e){i.uniform1uiv(this.addr,e)}function Ape(i,e){i.uniform2uiv(this.addr,e)}function mpe(i,e){i.uniform3uiv(this.addr,e)}function gpe(i,e){i.uniform4uiv(this.addr,e)}function _pe(i,e,t){let n=this.cache,r=e.length,s=h3(t,r);Vs(n,s)||(i.uniform1iv(this.addr,s),qs(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=XL:o=zW;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function xpe(i,e,t){let n=this.cache,r=e.length,s=h3(t,r);Vs(n,s)||(i.uniform1iv(this.addr,s),qs(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||qW,s[o])}function ype(i,e,t){let n=this.cache,r=e.length,s=h3(t,r);Vs(n,s)||(i.uniform1iv(this.addr,s),qs(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||HW,s[o])}function vpe(i,e,t){let n=this.cache,r=e.length,s=h3(t,r);Vs(n,s)||(i.uniform1iv(this.addr,s),qs(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||VW,s[o])}function bpe(i){switch(i){case 5126:return ipe;case 35664:return rpe;case 35665:return spe;case 35666:return ope;case 35674:return ape;case 35675:return lpe;case 35676:return cpe;case 5124:case 35670:return upe;case 35667:case 35671:return hpe;case 35668:case 35672:return fpe;case 35669:case 35673:return dpe;case 5125:return ppe;case 36294:return Ape;case 36295:return mpe;case 36296:return gpe;case 35678:case 36198:case 36298:case 36306:case 35682:return _pe;case 35679:case 36299:case 36307:return xpe;case 35680:case 36300:case 36308:case 36293:return ype;case 36289:case 36303:case 36311:case 36292:return vpe}}var $L=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=npe(t.type)}},YL=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=bpe(t.type)}},ZL=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)}}},WL=/(\w+)(\])?(\[|\.)?/g;function EW(i,e){i.seq.push(e),i.map[e.id]=e}function wpe(i,e,t){let n=i.name,r=n.length;for(WL.lastIndex=0;;){let s=WL.exec(n),o=WL.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){EW(t,c===void 0?new $L(a,i,e):new YL(a,i,e));break}else{let f=t.map[a];f===void 0&&(f=new ZL(a),EW(t,f)),t=f}}}var D_=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);wpe(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 MW(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var Spe=37297,Tpe=0;function Epe(i,e){let t=i.split(`40154015 `),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(`4016-`)}var EW=new Sn;function Tpe(i){sn._getMatrix(EW,sn.workingColorSpace,i);let e=`mat3( ${EW.elements.map(t=>t.toFixed(4))} )`;switch(sn.getTransfer(i)){case Yd:return[e,"LinearTransferOETF"];case Bt:return[e,"sRGBTransferOETF"];default:return je("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function MW(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()+`4016+`)}var CW=new Sn;function Mpe(i){sn._getMatrix(CW,sn.workingColorSpace,i);let e=`mat3( ${CW.elements.map(t=>t.toFixed(4))} )`;switch(sn.getTransfer(i)){case Zd:return[e,"LinearTransferOETF"];case Bt:return[e,"sRGBTransferOETF"];default:return je("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function RW(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()+`40174017 40184018 `+s+`40194019 4020-`+Spe(i.getShaderSource(e),a)}else return s}function Epe(i,e){let t=Tpe(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`4021-`)}var Mpe={[f2]:"Linear",[d2]:"Reinhard",[p2]:"Cineon",[A2]:"ACESFilmic",[m2]:"AgX",[g2]:"Neutral",[iL]:"Custom"};function Cpe(i,e){let t=Mpe[e];return t===void 0?(je("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var r3=new ie;function Rpe(){sn.getLuminanceCoefficients(r3);let i=r3.x.toFixed(4),e=r3.y.toFixed(4),t=r3.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`4022-`)}function Ppe(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(P2).join(`4023-`)}function Ipe(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`4024-`)}function Npe(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 P2(i){return i!==""}function CW(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 RW(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var Lpe=/^[ \t]*#include +<([\w\d./]+)>/gm;function HL(i){return i.replace(Lpe,Fpe)}var Dpe=new Map;function Fpe(i,e){let t=On[e];if(t===void 0){let n=Dpe.get(e);if(n!==void 0)t=On[n],je('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return HL(t)}var Ope=/#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 PW(i){return i.replace(Ope,Bpe)}function Bpe(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 IW(i){let e=`precision ${i.precision} float;4020+`+Epe(i.getShaderSource(e),a)}else return s}function Cpe(i,e){let t=Mpe(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`4021+`)}var Rpe={[p2]:"Linear",[A2]:"Reinhard",[m2]:"Cineon",[g2]:"ACESFilmic",[_2]:"AgX",[x2]:"Neutral",[uL]:"Custom"};function Ppe(i,e){let t=Rpe[e];return t===void 0?(je("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}var o3=new ie;function Ipe(){sn.getLuminanceCoefficients(o3);let i=o3.x.toFixed(4),e=o3.y.toFixed(4),t=o3.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`4022+`)}function Npe(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(N2).join(`4023+`)}function Lpe(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`4024+`)}function Dpe(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 N2(i){return i!==""}function PW(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 IW(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var Fpe=/^[ \t]*#include +<([\w\d./]+)>/gm;function KL(i){return i.replace(Fpe,Bpe)}var Ope=new Map;function Bpe(i,e){let t=On[e];if(t===void 0){let n=Ope.get(e);if(n!==void 0)t=On[n],je('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">")}return KL(t)}var Upe=/#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 NW(i){return i.replace(Upe,kpe)}function kpe(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 LW(i){let e=`precision ${i.precision} float;40254025 precision ${i.precision} int;40264026 precision ${i.precision} sampler2D;40274027 precision ${i.precision} samplerCube;
@@ -4041,30 +4041,30 @@ void main() {
40414041 `;return i.precision==="highp"?e+=`40424042 #define HIGH_PRECISION`:i.precision==="mediump"?e+=`40434043 #define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`4044-#define LOW_PRECISION`),e}var Upe={[sp]:"SHADOWMAP_TYPE_PCF",[tc]:"SHADOWMAP_TYPE_VSM"};function kpe(i){return Upe[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var Gpe={[yl]:"ENVMAP_TYPE_CUBE",[nc]:"ENVMAP_TYPE_CUBE",[ju]:"ENVMAP_TYPE_CUBE_UV"};function zpe(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":Gpe[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var Vpe={[nc]:"ENVMAP_MODE_REFRACTION"};function qpe(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":Vpe[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var Hpe={[FA]:"ENVMAP_BLENDING_MULTIPLY",[KT]:"ENVMAP_BLENDING_MIX",[QT]:"ENVMAP_BLENDING_ADD"};function Wpe(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":Hpe[i.combine]||"ENVMAP_BLENDING_NONE"}function jpe(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 Xpe(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=kpe(t),c=zpe(t),u=qpe(t),f=Wpe(t),p=jpe(t),x=Ppe(t),v=Ipe(s),w=r.createProgram(),S,T,P=t.glslVersion?"#version "+t.glslVersion+`4045-`:"";t.isRawShaderMaterial?(S=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(P2).join(`4044+#define LOW_PRECISION`),e}var Gpe={[op]:"SHADOWMAP_TYPE_PCF",[nc]:"SHADOWMAP_TYPE_VSM"};function zpe(i){return Gpe[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var Vpe={[vl]:"ENVMAP_TYPE_CUBE",[ic]:"ENVMAP_TYPE_CUBE",[$u]:"ENVMAP_TYPE_CUBE_UV"};function qpe(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":Vpe[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var Hpe={[ic]:"ENVMAP_MODE_REFRACTION"};function Wpe(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":Hpe[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var jpe={[BA]:"ENVMAP_BLENDING_MULTIPLY",[JT]:"ENVMAP_BLENDING_MIX",[e3]:"ENVMAP_BLENDING_ADD"};function Xpe(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":jpe[i.combine]||"ENVMAP_BLENDING_NONE"}function $pe(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 Ype(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=zpe(t),c=qpe(t),u=Wpe(t),f=Xpe(t),p=$pe(t),x=Npe(t),v=Lpe(s),w=r.createProgram(),S,T,P=t.glslVersion?"#version "+t.glslVersion+`4045+`:"";t.isRawShaderMaterial?(S=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(N2).join(`40464046 `),S.length>0&&(S+=`4047-`),T=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(P2).join(`4047+`),T=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(N2).join(`40484048 `),T.length>0&&(T+=`4049-`)):(S=[IW(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,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",`4050-`].filter(P2).join(`4051-`),T=[IW(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,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:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.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!==zs?"#define TONE_MAPPING":"",t.toneMapping!==zs?On.tonemapping_pars_fragment:"",t.toneMapping!==zs?Cpe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",On.colorspace_pars_fragment,Epe("linearToOutputTexel",t.outputColorSpace),Rpe(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`4052-`].filter(P2).join(`4053-`)),o=HL(o),o=CW(o,t),o=RW(o,t),a=HL(a),a=CW(a,t),a=RW(a,t),o=PW(o),a=PW(a),t.isRawShaderMaterial!==!0&&(P=`#version 300 es4049+`)):(S=[LW(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,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",`4050+`].filter(N2).join(`4051+`),T=[LW(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,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:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.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!==zs?"#define TONE_MAPPING":"",t.toneMapping!==zs?On.tonemapping_pars_fragment:"",t.toneMapping!==zs?Ppe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",On.colorspace_pars_fragment,Cpe("linearToOutputTexel",t.outputColorSpace),Ipe(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`4052+`].filter(N2).join(`4053+`)),o=KL(o),o=PW(o,t),o=IW(o,t),a=KL(a),a=PW(a,t),a=IW(a,t),o=NW(o),a=NW(a),t.isRawShaderMaterial!==!0&&(P=`#version 300 es40544054 `,S=[x,"#define attribute in","#define varying out","#define texture2D texture"].join(`40554055 `)+`4056-`+S,T=["#define varying in",t.glslVersion===bL?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===bL?"":"#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(`4056+`+S,T=["#define varying in",t.glslVersion===RL?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===RL?"":"#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(`40574057 `)+`4058-`+T);let R=P+S+o,C=P+T+a,L=TW(r,r.VERTEX_SHADER,R),D=TW(r,r.FRAGMENT_SHADER,C);r.attachShader(w,L),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 F(V){if(i.debug.checkShaderErrors){let H=r.getProgramInfoLog(w)||"",Z=r.getShaderInfoLog(L)||"",J=r.getShaderInfoLog(D)||"",j=H.trim(),K=Z.trim(),ee=J.trim(),ae=!0,ce=!0;if(r.getProgramParameter(w,r.LINK_STATUS)===!1)if(ae=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,w,L,D);else{let de=MW(r,L,"vertex"),ve=MW(r,D,"fragment");Ge("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(w,r.VALIDATE_STATUS)+`4058+`+T);let R=P+S+o,C=P+T+a,L=MW(r,r.VERTEX_SHADER,R),D=MW(r,r.FRAGMENT_SHADER,C);r.attachShader(w,L),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 F(V){if(i.debug.checkShaderErrors){let H=r.getProgramInfoLog(w)||"",Z=r.getShaderInfoLog(L)||"",J=r.getShaderInfoLog(D)||"",j=H.trim(),K=Z.trim(),ee=J.trim(),ae=!0,ce=!0;if(r.getProgramParameter(w,r.LINK_STATUS)===!1)if(ae=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,w,L,D);else{let de=RW(r,L,"vertex"),ve=RW(r,D,"fragment");Ge("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(w,r.VALIDATE_STATUS)+`40594059 40604060 Material Name: `+V.name+`40614061 Material Type: `+V.type+`40624062 40634063 Program Info Log: `+j+`40644064 `+de+`4065-`+ve)}else j!==""?je("WebGLProgram: Program Info Log:",j):(K===""||ee==="")&&(ce=!1);ce&&(V.diagnostics={runnable:ae,programLog:j,vertexShader:{log:K,prefix:S},fragmentShader:{log:ee,prefix:T}})}r.deleteShader(L),r.deleteShader(D),N=new L_(r,w),B=Npe(r,w)}let N;this.getUniforms=function(){return N===void 0&&F(this),N};let B;this.getAttributes=function(){return B===void 0&&F(this),B};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=r.getProgramParameter(w,bpe)),z},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=wpe++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=L,this.fragmentShader=D,this}var $pe=0,WL=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 jL(e),t.set(e,n)),n}},jL=class{constructor(e){this.id=$pe++,this.code=e,this.usedTimes=0}};function Ype(i){return i===Ts||i===th||i===nh}function Zpe(i,e,t,n,r,s){let o=new A_,a=new WL,l=new Set,c=[],u=new Map,f=n.logarithmicDepthBuffer,p=n.precision,x={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 v(N){return l.add(N),N===0?"uv":`uv${N}`}function w(N,B,z,V,H,Z){let J=V.fog,j=H.geometry,K=N.isMeshStandardMaterial||N.isMeshLambertMaterial||N.isMeshPhongMaterial?V.environment:null,ee=N.isMeshStandardMaterial||N.isMeshLambertMaterial&&!N.envMap||N.isMeshPhongMaterial&&!N.envMap,ae=e.get(N.envMap||K,ee),ce=ae&&ae.mapping===ju?ae.image.height:null,de=x[N.type];N.precision!==null&&(p=n.getMaxPrecision(N.precision),p!==N.precision&&je("WebGLProgram.getParameters:",N.precision,"not supported, using",p,"instead."));let ve=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,Ie=ve!==void 0?ve.length:0,Qe=0;j.morphAttributes.position!==void 0&&(Qe=1),j.morphAttributes.normal!==void 0&&(Qe=2),j.morphAttributes.color!==void 0&&(Qe=3);let Ue,mt,Me,ze;if(de){let jt=_a[de];Ue=jt.vertexShader,mt=jt.fragmentShader}else{Ue=N.vertexShader,mt=N.fragmentShader;let jt=a.getVertexShaderStage(N),Hi=a.getFragmentShaderStage(N);a.update(N,jt,Hi),Me=jt.id,ze=Hi.id}let $e=i.getRenderTarget(),Et=i.state.buffers.depth.getReversed(),Tt=H.isInstancedMesh===!0,Ct=H.isBatchedMesh===!0,un=!!N.map,Gt=!!N.matcap,Xe=!!ae,st=!!N.aoMap,tt=!!N.lightMap,vt=!!N.bumpMap&&N.wireframe===!1,yt=!!N.normalMap,ln=!!N.displacementMap,Kt=!!N.emissiveMap,Qt=!!N.metalnessMap,xn=!!N.roughnessMap,ge=N.anisotropy>0,di=N.clearcoat>0,Bn=N.dispersion>0,le=N.iridescence>0,X=N.sheen>0,Te=N.transmission>0,Pe=ge&&!!N.anisotropyMap,Ve=di&&!!N.clearcoatMap,gt=di&&!!N.clearcoatNormalMap,St=di&&!!N.clearcoatRoughnessMap,qe=le&&!!N.iridescenceMap,Ke=le&&!!N.iridescenceThicknessMap,Rt=X&&!!N.sheenColorMap,en=X&&!!N.sheenRoughnessMap,Pt=!!N.specularMap,Mt=!!N.specularColorMap,cn=!!N.specularIntensityMap,yn=Te&&!!N.transmissionMap,Pn=Te&&!!N.thicknessMap,xe=!!N.gradientMap,bt=!!N.alphaMap,Ye=N.alphaTest>0,wt=!!N.alphaHash,Dt=!!N.extensions,ct=zs;N.toneMapped&&($e===null||$e.isXRRenderTarget===!0)&&(ct=i.toneMapping);let Ce={shaderID:de,shaderType:N.type,shaderName:N.name,vertexShader:Ue,fragmentShader:mt,defines:N.defines,customVertexShaderID:Me,customFragmentShaderID:ze,isRawShaderMaterial:N.isRawShaderMaterial===!0,glslVersion:N.glslVersion,precision:p,batching:Ct,batchingColor:Ct&&H._colorsTexture!==null,instancing:Tt,instancingColor:Tt&&H.instanceColor!==null,instancingMorph:Tt&&H.morphTexture!==null,outputColorSpace:$e===null?i.outputColorSpace:$e.isXRRenderTarget===!0?$e.texture.colorSpace:sn.workingColorSpace,alphaToCoverage:!!N.alphaToCoverage,map:un,matcap:Gt,envMap:Xe,envMapMode:Xe&&ae.mapping,envMapCubeUVHeight:ce,aoMap:st,lightMap:tt,bumpMap:vt,normalMap:yt,displacementMap:ln,emissiveMap:Kt,normalMapObjectSpace:yt&&N.normalMapType===e3,normalMapTangentSpace:yt&&N.normalMapType===vl,packedNormalMap:yt&&N.normalMapType===vl&&Ype(N.normalMap.format),metalnessMap:Qt,roughnessMap:xn,anisotropy:ge,anisotropyMap:Pe,clearcoat:di,clearcoatMap:Ve,clearcoatNormalMap:gt,clearcoatRoughnessMap:St,dispersion:Bn,iridescence:le,iridescenceMap:qe,iridescenceThicknessMap:Ke,sheen:X,sheenColorMap:Rt,sheenRoughnessMap:en,specularMap:Pt,specularColorMap:Mt,specularIntensityMap:cn,transmission:Te,transmissionMap:yn,thicknessMap:Pn,gradientMap:xe,opaque:N.transparent===!1&&N.blending===os&&N.alphaToCoverage===!1,alphaMap:bt,alphaTest:Ye,alphaHash:wt,combine:N.combine,mapUv:un&&v(N.map.channel),aoMapUv:st&&v(N.aoMap.channel),lightMapUv:tt&&v(N.lightMap.channel),bumpMapUv:vt&&v(N.bumpMap.channel),normalMapUv:yt&&v(N.normalMap.channel),displacementMapUv:ln&&v(N.displacementMap.channel),emissiveMapUv:Kt&&v(N.emissiveMap.channel),metalnessMapUv:Qt&&v(N.metalnessMap.channel),roughnessMapUv:xn&&v(N.roughnessMap.channel),anisotropyMapUv:Pe&&v(N.anisotropyMap.channel),clearcoatMapUv:Ve&&v(N.clearcoatMap.channel),clearcoatNormalMapUv:gt&&v(N.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:St&&v(N.clearcoatRoughnessMap.channel),iridescenceMapUv:qe&&v(N.iridescenceMap.channel),iridescenceThicknessMapUv:Ke&&v(N.iridescenceThicknessMap.channel),sheenColorMapUv:Rt&&v(N.sheenColorMap.channel),sheenRoughnessMapUv:en&&v(N.sheenRoughnessMap.channel),specularMapUv:Pt&&v(N.specularMap.channel),specularColorMapUv:Mt&&v(N.specularColorMap.channel),specularIntensityMapUv:cn&&v(N.specularIntensityMap.channel),transmissionMapUv:yn&&v(N.transmissionMap.channel),thicknessMapUv:Pn&&v(N.thicknessMap.channel),alphaMapUv:bt&&v(N.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(yt||ge),vertexNormals:!!j.attributes.normal,vertexColors:N.vertexColors,vertexAlphas:N.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:H.isPoints===!0&&!!j.attributes.uv&&(un||bt),fog:!!J,useFog:N.fog===!0,fogExp2:!!J&&J.isFogExp2,flatShading:N.wireframe===!1&&(N.flatShading===!0||j.attributes.normal===void 0&&yt===!1&&(N.isMeshLambertMaterial||N.isMeshPhongMaterial||N.isMeshStandardMaterial||N.isMeshPhysicalMaterial)),sizeAttenuation:N.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:Et,skinning:H.isSkinnedMesh===!0,hasPositionAttribute:j.attributes.position!==void 0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:Ie,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:Z.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:N.dithering,shadowMapEnabled:i.shadowMap.enabled&&z.length>0,shadowMapType:i.shadowMap.type,toneMapping:ct,decodeVideoTexture:un&&N.map.isVideoTexture===!0&&sn.getTransfer(N.map.colorSpace)===Bt,decodeVideoTextureEmissive:Kt&&N.emissiveMap.isVideoTexture===!0&&sn.getTransfer(N.emissiveMap.colorSpace)===Bt,premultipliedAlpha:N.premultipliedAlpha,doubleSided:N.side===rr,flipSided:N.side===ui,useDepthPacking:N.depthPacking>=0,depthPacking:N.depthPacking||0,index0AttributeName:N.index0AttributeName,extensionClipCullDistance:Dt&&N.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Dt&&N.extensions.multiDraw===!0||Ct)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:N.customProgramCacheKey()};return Ce.vertexUv1s=l.has(1),Ce.vertexUv2s=l.has(2),Ce.vertexUv3s=l.has(3),l.clear(),Ce}function S(N){let B=[];if(N.shaderID?B.push(N.shaderID):(B.push(N.customVertexShaderID),B.push(N.customFragmentShaderID)),N.defines!==void 0)for(let z in N.defines)B.push(z),B.push(N.defines[z]);return N.isRawShaderMaterial===!1&&(T(B,N),P(B,N),B.push(i.outputColorSpace)),B.push(N.customProgramCacheKey),B.join()}function T(N,B){N.push(B.precision),N.push(B.outputColorSpace),N.push(B.envMapMode),N.push(B.envMapCubeUVHeight),N.push(B.mapUv),N.push(B.alphaMapUv),N.push(B.lightMapUv),N.push(B.aoMapUv),N.push(B.bumpMapUv),N.push(B.normalMapUv),N.push(B.displacementMapUv),N.push(B.emissiveMapUv),N.push(B.metalnessMapUv),N.push(B.roughnessMapUv),N.push(B.anisotropyMapUv),N.push(B.clearcoatMapUv),N.push(B.clearcoatNormalMapUv),N.push(B.clearcoatRoughnessMapUv),N.push(B.iridescenceMapUv),N.push(B.iridescenceThicknessMapUv),N.push(B.sheenColorMapUv),N.push(B.sheenRoughnessMapUv),N.push(B.specularMapUv),N.push(B.specularColorMapUv),N.push(B.specularIntensityMapUv),N.push(B.transmissionMapUv),N.push(B.thicknessMapUv),N.push(B.combine),N.push(B.fogExp2),N.push(B.sizeAttenuation),N.push(B.morphTargetsCount),N.push(B.morphAttributeCount),N.push(B.numDirLights),N.push(B.numPointLights),N.push(B.numSpotLights),N.push(B.numSpotLightMaps),N.push(B.numHemiLights),N.push(B.numRectAreaLights),N.push(B.numDirLightShadows),N.push(B.numPointLightShadows),N.push(B.numSpotLightShadows),N.push(B.numSpotLightShadowsWithMaps),N.push(B.numLightProbes),N.push(B.shadowMapType),N.push(B.toneMapping),N.push(B.numClippingPlanes),N.push(B.numClipIntersection),N.push(B.depthPacking)}function P(N,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),N.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),N.push(o.mask)}function R(N){let B=x[N.type],z;if(B){let V=_a[B];z=XA.clone(V.uniforms)}else z=N.uniforms;return z}function C(N,B){let z=u.get(B);return z!==void 0?++z.usedTimes:(z=new Xpe(i,B,N,r),c.push(z),u.set(B,z)),z}function L(N){if(--N.usedTimes===0){let B=c.indexOf(N);c[B]=c[c.length-1],c.pop(),u.delete(N.cacheKey),N.destroy()}}function D(N){a.remove(N)}function F(){a.dispose()}return{getParameters:w,getProgramCacheKey:S,getUniforms:R,acquireProgram:C,releaseProgram:L,releaseShaderCache:D,programs:c,dispose:F}}function Kpe(){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 Qpe(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 NW(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 LW(){let i=[],e=0,t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function o(p){let x=0;return p.isInstancedMesh&&(x+=2),p.isSkinnedMesh&&(x+=1),x}function a(p,x,v,w,S,T){let P=i[e];return P===void 0?(P={id:p.id,object:p,geometry:x,material:v,materialVariant:o(p),groupOrder:w,renderOrder:p.renderOrder,z:S,group:T},i[e]=P):(P.id=p.id,P.object=p,P.geometry=x,P.material=v,P.materialVariant=o(p),P.groupOrder=w,P.renderOrder=p.renderOrder,P.z=S,P.group=T),e++,P}function l(p,x,v,w,S,T){let P=a(p,x,v,w,S,T);v.transmission>0?n.push(P):v.transparent===!0?r.push(P):t.push(P)}function c(p,x,v,w,S,T){let P=a(p,x,v,w,S,T);v.transmission>0?n.unshift(P):v.transparent===!0?r.unshift(P):t.unshift(P)}function u(p,x,v){t.length>1&&t.sort(p||Qpe),n.length>1&&n.sort(x||NW),r.length>1&&r.sort(x||NW),v&&(t.reverse(),n.reverse(),r.reverse())}function f(){for(let p=e,x=i.length;p<x;p++){let v=i[p];if(v.id===null)break;v.id=null,v.object=null,v.geometry=null,v.material=null,v.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:l,unshift:c,finish:f,sort:u}}function Jpe(){let i=new WeakMap;function e(n,r){let s=i.get(n),o;return s===void 0?(o=new LW,i.set(n,[o])):r>=s.length?(o=new LW,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function e0e(){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 ie,color:new Ut};break;case"SpotLight":t={position:new ie,direction:new ie,color:new Ut,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ie,color:new Ut,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ie,skyColor:new Ut,groundColor:new Ut};break;case"RectAreaLight":t={color:new Ut,position:new ie,halfWidth:new ie,halfHeight:new ie};break}return i[e.id]=t,t}}}function t0e(){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 n0e=0;function i0e(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function r0e(i){let e=new e0e,t=t0e(),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 ie);let r=new ie,s=new on,o=new on;function a(c){let u=0,f=0,p=0;for(let B=0;B<9;B++)n.probe[B].set(0,0,0);let x=0,v=0,w=0,S=0,T=0,P=0,R=0,C=0,L=0,D=0,F=0;c.sort(i0e);for(let B=0,z=c.length;B<z;B++){let V=c[B],H=V.color,Z=V.intensity,J=V.distance,j=null;if(V.shadow&&V.shadow.map&&(V.shadow.map.texture.format===Ts?j=V.shadow.map.texture:j=V.shadow.map.depthTexture||V.shadow.map.texture),V.isAmbientLight)u+=H.r*Z,f+=H.g*Z,p+=H.b*Z;else if(V.isLightProbe){for(let K=0;K<9;K++)n.probe[K].addScaledVector(V.sh.coefficients[K],Z);F++}else if(V.isDirectionalLight){let K=e.get(V);if(K.color.copy(V.color).multiplyScalar(V.intensity),V.castShadow){let ee=V.shadow,ae=t.get(V);ae.shadowIntensity=ee.intensity,ae.shadowBias=ee.bias,ae.shadowNormalBias=ee.normalBias,ae.shadowRadius=ee.radius,ae.shadowMapSize=ee.mapSize,n.directionalShadow[x]=ae,n.directionalShadowMap[x]=j,n.directionalShadowMatrix[x]=V.shadow.matrix,P++}n.directional[x]=K,x++}else if(V.isSpotLight){let K=e.get(V);K.position.setFromMatrixPosition(V.matrixWorld),K.color.copy(H).multiplyScalar(Z),K.distance=J,K.coneCos=Math.cos(V.angle),K.penumbraCos=Math.cos(V.angle*(1-V.penumbra)),K.decay=V.decay,n.spot[w]=K;let ee=V.shadow;if(V.map&&(n.spotLightMap[L]=V.map,L++,ee.updateMatrices(V),V.castShadow&&D++),n.spotLightMatrix[w]=ee.matrix,V.castShadow){let ae=t.get(V);ae.shadowIntensity=ee.intensity,ae.shadowBias=ee.bias,ae.shadowNormalBias=ee.normalBias,ae.shadowRadius=ee.radius,ae.shadowMapSize=ee.mapSize,n.spotShadow[w]=ae,n.spotShadowMap[w]=j,C++}w++}else if(V.isRectAreaLight){let K=e.get(V);K.color.copy(H).multiplyScalar(Z),K.halfWidth.set(V.width*.5,0,0),K.halfHeight.set(0,V.height*.5,0),n.rectArea[S]=K,S++}else if(V.isPointLight){let K=e.get(V);if(K.color.copy(V.color).multiplyScalar(V.intensity),K.distance=V.distance,K.decay=V.decay,V.castShadow){let ee=V.shadow,ae=t.get(V);ae.shadowIntensity=ee.intensity,ae.shadowBias=ee.bias,ae.shadowNormalBias=ee.normalBias,ae.shadowRadius=ee.radius,ae.shadowMapSize=ee.mapSize,ae.shadowCameraNear=ee.camera.near,ae.shadowCameraFar=ee.camera.far,n.pointShadow[v]=ae,n.pointShadowMap[v]=j,n.pointShadowMatrix[v]=V.shadow.matrix,R++}n.point[v]=K,v++}else if(V.isHemisphereLight){let K=e.get(V);K.skyColor.copy(V.color).multiplyScalar(Z),K.groundColor.copy(V.groundColor).multiplyScalar(Z),n.hemi[T]=K,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]=p;let N=n.hash;(N.directionalLength!==x||N.pointLength!==v||N.spotLength!==w||N.rectAreaLength!==S||N.hemiLength!==T||N.numDirectionalShadows!==P||N.numPointShadows!==R||N.numSpotShadows!==C||N.numSpotMaps!==L||N.numLightProbes!==F)&&(n.directional.length=x,n.spot.length=w,n.rectArea.length=S,n.point.length=v,n.hemi.length=T,n.directionalShadow.length=P,n.directionalShadowMap.length=P,n.pointShadow.length=R,n.pointShadowMap.length=R,n.spotShadow.length=C,n.spotShadowMap.length=C,n.directionalShadowMatrix.length=P,n.pointShadowMatrix.length=R,n.spotLightMatrix.length=C+L-D,n.spotLightMap.length=L,n.numSpotLightShadowsWithMaps=D,n.numLightProbes=F,N.directionalLength=x,N.pointLength=v,N.spotLength=w,N.rectAreaLength=S,N.hemiLength=T,N.numDirectionalShadows=P,N.numPointShadows=R,N.numSpotShadows=C,N.numSpotMaps=L,N.numLightProbes=F,n.version=n0e++)}function l(c,u){let f=0,p=0,x=0,v=0,w=0,S=u.matrixWorldInverse;for(let T=0,P=c.length;T<P;T++){let R=c[T];if(R.isDirectionalLight){let C=n.directional[f];C.direction.setFromMatrixPosition(R.matrixWorld),r.setFromMatrixPosition(R.target.matrixWorld),C.direction.sub(r),C.direction.transformDirection(S),f++}else if(R.isSpotLight){let C=n.spot[x];C.position.setFromMatrixPosition(R.matrixWorld),C.position.applyMatrix4(S),C.direction.setFromMatrixPosition(R.matrixWorld),r.setFromMatrixPosition(R.target.matrixWorld),C.direction.sub(r),C.direction.transformDirection(S),x++}else if(R.isRectAreaLight){let C=n.rectArea[v];C.position.setFromMatrixPosition(R.matrixWorld),C.position.applyMatrix4(S),o.identity(),s.copy(R.matrixWorld),s.premultiply(S),o.extractRotation(s),C.halfWidth.set(R.width*.5,0,0),C.halfHeight.set(0,R.height*.5,0),C.halfWidth.applyMatrix4(o),C.halfHeight.applyMatrix4(o),v++}else if(R.isPointLight){let C=n.point[p];C.position.setFromMatrixPosition(R.matrixWorld),C.position.applyMatrix4(S),p++}else if(R.isHemisphereLight){let C=n.hemi[w];C.direction.setFromMatrixPosition(R.matrixWorld),C.direction.transformDirection(S),w++}}}return{setup:a,setupView:l,state:n}}function DW(i){let e=new r0e(i),t=[],n=[],r=[];function s(p){f.camera=p,t.length=0,n.length=0,r.length=0}function o(p){t.push(p)}function a(p){n.push(p)}function l(p){r.push(p)}function c(){e.setup(t)}function u(p){e.setupView(t,p)}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 s0e(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new DW(i),e.set(r,[a])):s>=o.length?(a=new DW(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var o0e=`void main() {4065+`+ve)}else j!==""?je("WebGLProgram: Program Info Log:",j):(K===""||ee==="")&&(ce=!1);ce&&(V.diagnostics={runnable:ae,programLog:j,vertexShader:{log:K,prefix:S},fragmentShader:{log:ee,prefix:T}})}r.deleteShader(L),r.deleteShader(D),N=new D_(r,w),B=Dpe(r,w)}let N;this.getUniforms=function(){return N===void 0&&F(this),N};let B;this.getAttributes=function(){return B===void 0&&F(this),B};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=r.getProgramParameter(w,Spe)),z},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Tpe++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=L,this.fragmentShader=D,this}var Zpe=0,QL=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 JL(e),t.set(e,n)),n}},JL=class{constructor(e){this.id=Zpe++,this.code=e,this.usedTimes=0}};function Kpe(i){return i===Ms||i===ih||i===rh}function Qpe(i,e,t,n,r,s){let o=new g_,a=new QL,l=new Set,c=[],u=new Map,f=n.logarithmicDepthBuffer,p=n.precision,x={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 v(N){return l.add(N),N===0?"uv":`uv${N}`}function w(N,B,z,V,H,Z){let J=V.fog,j=H.geometry,K=N.isMeshStandardMaterial||N.isMeshLambertMaterial||N.isMeshPhongMaterial?V.environment:null,ee=N.isMeshStandardMaterial||N.isMeshLambertMaterial&&!N.envMap||N.isMeshPhongMaterial&&!N.envMap,ae=e.get(N.envMap||K,ee),ce=ae&&ae.mapping===$u?ae.image.height:null,de=x[N.type];N.precision!==null&&(p=n.getMaxPrecision(N.precision),p!==N.precision&&je("WebGLProgram.getParameters:",N.precision,"not supported, using",p,"instead."));let ve=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,Ie=ve!==void 0?ve.length:0,Qe=0;j.morphAttributes.position!==void 0&&(Qe=1),j.morphAttributes.normal!==void 0&&(Qe=2),j.morphAttributes.color!==void 0&&(Qe=3);let Ue,mt,Me,ze;if(de){let jt=_a[de];Ue=jt.vertexShader,mt=jt.fragmentShader}else{Ue=N.vertexShader,mt=N.fragmentShader;let jt=a.getVertexShaderStage(N),Hi=a.getFragmentShaderStage(N);a.update(N,jt,Hi),Me=jt.id,ze=Hi.id}let $e=i.getRenderTarget(),Et=i.state.buffers.depth.getReversed(),Tt=H.isInstancedMesh===!0,Ct=H.isBatchedMesh===!0,un=!!N.map,Gt=!!N.matcap,Xe=!!ae,st=!!N.aoMap,tt=!!N.lightMap,vt=!!N.bumpMap&&N.wireframe===!1,yt=!!N.normalMap,ln=!!N.displacementMap,Kt=!!N.emissiveMap,Qt=!!N.metalnessMap,xn=!!N.roughnessMap,ge=N.anisotropy>0,pi=N.clearcoat>0,Bn=N.dispersion>0,le=N.iridescence>0,X=N.sheen>0,Te=N.transmission>0,Pe=ge&&!!N.anisotropyMap,Ve=pi&&!!N.clearcoatMap,gt=pi&&!!N.clearcoatNormalMap,St=pi&&!!N.clearcoatRoughnessMap,qe=le&&!!N.iridescenceMap,Ke=le&&!!N.iridescenceThicknessMap,Rt=X&&!!N.sheenColorMap,en=X&&!!N.sheenRoughnessMap,Pt=!!N.specularMap,Mt=!!N.specularColorMap,cn=!!N.specularIntensityMap,yn=Te&&!!N.transmissionMap,Pn=Te&&!!N.thicknessMap,xe=!!N.gradientMap,bt=!!N.alphaMap,Ye=N.alphaTest>0,wt=!!N.alphaHash,Dt=!!N.extensions,ct=zs;N.toneMapped&&($e===null||$e.isXRRenderTarget===!0)&&(ct=i.toneMapping);let Ce={shaderID:de,shaderType:N.type,shaderName:N.name,vertexShader:Ue,fragmentShader:mt,defines:N.defines,customVertexShaderID:Me,customFragmentShaderID:ze,isRawShaderMaterial:N.isRawShaderMaterial===!0,glslVersion:N.glslVersion,precision:p,batching:Ct,batchingColor:Ct&&H._colorsTexture!==null,instancing:Tt,instancingColor:Tt&&H.instanceColor!==null,instancingMorph:Tt&&H.morphTexture!==null,outputColorSpace:$e===null?i.outputColorSpace:$e.isXRRenderTarget===!0?$e.texture.colorSpace:sn.workingColorSpace,alphaToCoverage:!!N.alphaToCoverage,map:un,matcap:Gt,envMap:Xe,envMapMode:Xe&&ae.mapping,envMapCubeUVHeight:ce,aoMap:st,lightMap:tt,bumpMap:vt,normalMap:yt,displacementMap:ln,emissiveMap:Kt,normalMapObjectSpace:yt&&N.normalMapType===n3,normalMapTangentSpace:yt&&N.normalMapType===bl,packedNormalMap:yt&&N.normalMapType===bl&&Kpe(N.normalMap.format),metalnessMap:Qt,roughnessMap:xn,anisotropy:ge,anisotropyMap:Pe,clearcoat:pi,clearcoatMap:Ve,clearcoatNormalMap:gt,clearcoatRoughnessMap:St,dispersion:Bn,iridescence:le,iridescenceMap:qe,iridescenceThicknessMap:Ke,sheen:X,sheenColorMap:Rt,sheenRoughnessMap:en,specularMap:Pt,specularColorMap:Mt,specularIntensityMap:cn,transmission:Te,transmissionMap:yn,thicknessMap:Pn,gradientMap:xe,opaque:N.transparent===!1&&N.blending===os&&N.alphaToCoverage===!1,alphaMap:bt,alphaTest:Ye,alphaHash:wt,combine:N.combine,mapUv:un&&v(N.map.channel),aoMapUv:st&&v(N.aoMap.channel),lightMapUv:tt&&v(N.lightMap.channel),bumpMapUv:vt&&v(N.bumpMap.channel),normalMapUv:yt&&v(N.normalMap.channel),displacementMapUv:ln&&v(N.displacementMap.channel),emissiveMapUv:Kt&&v(N.emissiveMap.channel),metalnessMapUv:Qt&&v(N.metalnessMap.channel),roughnessMapUv:xn&&v(N.roughnessMap.channel),anisotropyMapUv:Pe&&v(N.anisotropyMap.channel),clearcoatMapUv:Ve&&v(N.clearcoatMap.channel),clearcoatNormalMapUv:gt&&v(N.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:St&&v(N.clearcoatRoughnessMap.channel),iridescenceMapUv:qe&&v(N.iridescenceMap.channel),iridescenceThicknessMapUv:Ke&&v(N.iridescenceThicknessMap.channel),sheenColorMapUv:Rt&&v(N.sheenColorMap.channel),sheenRoughnessMapUv:en&&v(N.sheenRoughnessMap.channel),specularMapUv:Pt&&v(N.specularMap.channel),specularColorMapUv:Mt&&v(N.specularColorMap.channel),specularIntensityMapUv:cn&&v(N.specularIntensityMap.channel),transmissionMapUv:yn&&v(N.transmissionMap.channel),thicknessMapUv:Pn&&v(N.thicknessMap.channel),alphaMapUv:bt&&v(N.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(yt||ge),vertexNormals:!!j.attributes.normal,vertexColors:N.vertexColors,vertexAlphas:N.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:H.isPoints===!0&&!!j.attributes.uv&&(un||bt),fog:!!J,useFog:N.fog===!0,fogExp2:!!J&&J.isFogExp2,flatShading:N.wireframe===!1&&(N.flatShading===!0||j.attributes.normal===void 0&&yt===!1&&(N.isMeshLambertMaterial||N.isMeshPhongMaterial||N.isMeshStandardMaterial||N.isMeshPhysicalMaterial)),sizeAttenuation:N.sizeAttenuation===!0,logarithmicDepthBuffer:f,reversedDepthBuffer:Et,skinning:H.isSkinnedMesh===!0,hasPositionAttribute:j.attributes.position!==void 0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:Ie,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:Z.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:N.dithering,shadowMapEnabled:i.shadowMap.enabled&&z.length>0,shadowMapType:i.shadowMap.type,toneMapping:ct,decodeVideoTexture:un&&N.map.isVideoTexture===!0&&sn.getTransfer(N.map.colorSpace)===Bt,decodeVideoTextureEmissive:Kt&&N.emissiveMap.isVideoTexture===!0&&sn.getTransfer(N.emissiveMap.colorSpace)===Bt,premultipliedAlpha:N.premultipliedAlpha,doubleSided:N.side===rr,flipSided:N.side===hi,useDepthPacking:N.depthPacking>=0,depthPacking:N.depthPacking||0,index0AttributeName:N.index0AttributeName,extensionClipCullDistance:Dt&&N.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Dt&&N.extensions.multiDraw===!0||Ct)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:N.customProgramCacheKey()};return Ce.vertexUv1s=l.has(1),Ce.vertexUv2s=l.has(2),Ce.vertexUv3s=l.has(3),l.clear(),Ce}function S(N){let B=[];if(N.shaderID?B.push(N.shaderID):(B.push(N.customVertexShaderID),B.push(N.customFragmentShaderID)),N.defines!==void 0)for(let z in N.defines)B.push(z),B.push(N.defines[z]);return N.isRawShaderMaterial===!1&&(T(B,N),P(B,N),B.push(i.outputColorSpace)),B.push(N.customProgramCacheKey),B.join()}function T(N,B){N.push(B.precision),N.push(B.outputColorSpace),N.push(B.envMapMode),N.push(B.envMapCubeUVHeight),N.push(B.mapUv),N.push(B.alphaMapUv),N.push(B.lightMapUv),N.push(B.aoMapUv),N.push(B.bumpMapUv),N.push(B.normalMapUv),N.push(B.displacementMapUv),N.push(B.emissiveMapUv),N.push(B.metalnessMapUv),N.push(B.roughnessMapUv),N.push(B.anisotropyMapUv),N.push(B.clearcoatMapUv),N.push(B.clearcoatNormalMapUv),N.push(B.clearcoatRoughnessMapUv),N.push(B.iridescenceMapUv),N.push(B.iridescenceThicknessMapUv),N.push(B.sheenColorMapUv),N.push(B.sheenRoughnessMapUv),N.push(B.specularMapUv),N.push(B.specularColorMapUv),N.push(B.specularIntensityMapUv),N.push(B.transmissionMapUv),N.push(B.thicknessMapUv),N.push(B.combine),N.push(B.fogExp2),N.push(B.sizeAttenuation),N.push(B.morphTargetsCount),N.push(B.morphAttributeCount),N.push(B.numDirLights),N.push(B.numPointLights),N.push(B.numSpotLights),N.push(B.numSpotLightMaps),N.push(B.numHemiLights),N.push(B.numRectAreaLights),N.push(B.numDirLightShadows),N.push(B.numPointLightShadows),N.push(B.numSpotLightShadows),N.push(B.numSpotLightShadowsWithMaps),N.push(B.numLightProbes),N.push(B.shadowMapType),N.push(B.toneMapping),N.push(B.numClippingPlanes),N.push(B.numClipIntersection),N.push(B.depthPacking)}function P(N,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),N.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),N.push(o.mask)}function R(N){let B=x[N.type],z;if(B){let V=_a[B];z=YA.clone(V.uniforms)}else z=N.uniforms;return z}function C(N,B){let z=u.get(B);return z!==void 0?++z.usedTimes:(z=new Ype(i,B,N,r),c.push(z),u.set(B,z)),z}function L(N){if(--N.usedTimes===0){let B=c.indexOf(N);c[B]=c[c.length-1],c.pop(),u.delete(N.cacheKey),N.destroy()}}function D(N){a.remove(N)}function F(){a.dispose()}return{getParameters:w,getProgramCacheKey:S,getUniforms:R,acquireProgram:C,releaseProgram:L,releaseShaderCache:D,programs:c,dispose:F}}function Jpe(){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 e0e(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 DW(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 FW(){let i=[],e=0,t=[],n=[],r=[];function s(){e=0,t.length=0,n.length=0,r.length=0}function o(p){let x=0;return p.isInstancedMesh&&(x+=2),p.isSkinnedMesh&&(x+=1),x}function a(p,x,v,w,S,T){let P=i[e];return P===void 0?(P={id:p.id,object:p,geometry:x,material:v,materialVariant:o(p),groupOrder:w,renderOrder:p.renderOrder,z:S,group:T},i[e]=P):(P.id=p.id,P.object=p,P.geometry=x,P.material=v,P.materialVariant=o(p),P.groupOrder=w,P.renderOrder=p.renderOrder,P.z=S,P.group=T),e++,P}function l(p,x,v,w,S,T){let P=a(p,x,v,w,S,T);v.transmission>0?n.push(P):v.transparent===!0?r.push(P):t.push(P)}function c(p,x,v,w,S,T){let P=a(p,x,v,w,S,T);v.transmission>0?n.unshift(P):v.transparent===!0?r.unshift(P):t.unshift(P)}function u(p,x,v){t.length>1&&t.sort(p||e0e),n.length>1&&n.sort(x||DW),r.length>1&&r.sort(x||DW),v&&(t.reverse(),n.reverse(),r.reverse())}function f(){for(let p=e,x=i.length;p<x;p++){let v=i[p];if(v.id===null)break;v.id=null,v.object=null,v.geometry=null,v.material=null,v.group=null}}return{opaque:t,transmissive:n,transparent:r,init:s,push:l,unshift:c,finish:f,sort:u}}function t0e(){let i=new WeakMap;function e(n,r){let s=i.get(n),o;return s===void 0?(o=new FW,i.set(n,[o])):r>=s.length?(o=new FW,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function n0e(){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 ie,color:new Ut};break;case"SpotLight":t={position:new ie,direction:new ie,color:new Ut,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ie,color:new Ut,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ie,skyColor:new Ut,groundColor:new Ut};break;case"RectAreaLight":t={color:new Ut,position:new ie,halfWidth:new ie,halfHeight:new ie};break}return i[e.id]=t,t}}}function i0e(){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 r0e=0;function s0e(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function o0e(i){let e=new n0e,t=i0e(),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 ie);let r=new ie,s=new on,o=new on;function a(c){let u=0,f=0,p=0;for(let B=0;B<9;B++)n.probe[B].set(0,0,0);let x=0,v=0,w=0,S=0,T=0,P=0,R=0,C=0,L=0,D=0,F=0;c.sort(s0e);for(let B=0,z=c.length;B<z;B++){let V=c[B],H=V.color,Z=V.intensity,J=V.distance,j=null;if(V.shadow&&V.shadow.map&&(V.shadow.map.texture.format===Ms?j=V.shadow.map.texture:j=V.shadow.map.depthTexture||V.shadow.map.texture),V.isAmbientLight)u+=H.r*Z,f+=H.g*Z,p+=H.b*Z;else if(V.isLightProbe){for(let K=0;K<9;K++)n.probe[K].addScaledVector(V.sh.coefficients[K],Z);F++}else if(V.isDirectionalLight){let K=e.get(V);if(K.color.copy(V.color).multiplyScalar(V.intensity),V.castShadow){let ee=V.shadow,ae=t.get(V);ae.shadowIntensity=ee.intensity,ae.shadowBias=ee.bias,ae.shadowNormalBias=ee.normalBias,ae.shadowRadius=ee.radius,ae.shadowMapSize=ee.mapSize,n.directionalShadow[x]=ae,n.directionalShadowMap[x]=j,n.directionalShadowMatrix[x]=V.shadow.matrix,P++}n.directional[x]=K,x++}else if(V.isSpotLight){let K=e.get(V);K.position.setFromMatrixPosition(V.matrixWorld),K.color.copy(H).multiplyScalar(Z),K.distance=J,K.coneCos=Math.cos(V.angle),K.penumbraCos=Math.cos(V.angle*(1-V.penumbra)),K.decay=V.decay,n.spot[w]=K;let ee=V.shadow;if(V.map&&(n.spotLightMap[L]=V.map,L++,ee.updateMatrices(V),V.castShadow&&D++),n.spotLightMatrix[w]=ee.matrix,V.castShadow){let ae=t.get(V);ae.shadowIntensity=ee.intensity,ae.shadowBias=ee.bias,ae.shadowNormalBias=ee.normalBias,ae.shadowRadius=ee.radius,ae.shadowMapSize=ee.mapSize,n.spotShadow[w]=ae,n.spotShadowMap[w]=j,C++}w++}else if(V.isRectAreaLight){let K=e.get(V);K.color.copy(H).multiplyScalar(Z),K.halfWidth.set(V.width*.5,0,0),K.halfHeight.set(0,V.height*.5,0),n.rectArea[S]=K,S++}else if(V.isPointLight){let K=e.get(V);if(K.color.copy(V.color).multiplyScalar(V.intensity),K.distance=V.distance,K.decay=V.decay,V.castShadow){let ee=V.shadow,ae=t.get(V);ae.shadowIntensity=ee.intensity,ae.shadowBias=ee.bias,ae.shadowNormalBias=ee.normalBias,ae.shadowRadius=ee.radius,ae.shadowMapSize=ee.mapSize,ae.shadowCameraNear=ee.camera.near,ae.shadowCameraFar=ee.camera.far,n.pointShadow[v]=ae,n.pointShadowMap[v]=j,n.pointShadowMatrix[v]=V.shadow.matrix,R++}n.point[v]=K,v++}else if(V.isHemisphereLight){let K=e.get(V);K.skyColor.copy(V.color).multiplyScalar(Z),K.groundColor.copy(V.groundColor).multiplyScalar(Z),n.hemi[T]=K,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]=p;let N=n.hash;(N.directionalLength!==x||N.pointLength!==v||N.spotLength!==w||N.rectAreaLength!==S||N.hemiLength!==T||N.numDirectionalShadows!==P||N.numPointShadows!==R||N.numSpotShadows!==C||N.numSpotMaps!==L||N.numLightProbes!==F)&&(n.directional.length=x,n.spot.length=w,n.rectArea.length=S,n.point.length=v,n.hemi.length=T,n.directionalShadow.length=P,n.directionalShadowMap.length=P,n.pointShadow.length=R,n.pointShadowMap.length=R,n.spotShadow.length=C,n.spotShadowMap.length=C,n.directionalShadowMatrix.length=P,n.pointShadowMatrix.length=R,n.spotLightMatrix.length=C+L-D,n.spotLightMap.length=L,n.numSpotLightShadowsWithMaps=D,n.numLightProbes=F,N.directionalLength=x,N.pointLength=v,N.spotLength=w,N.rectAreaLength=S,N.hemiLength=T,N.numDirectionalShadows=P,N.numPointShadows=R,N.numSpotShadows=C,N.numSpotMaps=L,N.numLightProbes=F,n.version=r0e++)}function l(c,u){let f=0,p=0,x=0,v=0,w=0,S=u.matrixWorldInverse;for(let T=0,P=c.length;T<P;T++){let R=c[T];if(R.isDirectionalLight){let C=n.directional[f];C.direction.setFromMatrixPosition(R.matrixWorld),r.setFromMatrixPosition(R.target.matrixWorld),C.direction.sub(r),C.direction.transformDirection(S),f++}else if(R.isSpotLight){let C=n.spot[x];C.position.setFromMatrixPosition(R.matrixWorld),C.position.applyMatrix4(S),C.direction.setFromMatrixPosition(R.matrixWorld),r.setFromMatrixPosition(R.target.matrixWorld),C.direction.sub(r),C.direction.transformDirection(S),x++}else if(R.isRectAreaLight){let C=n.rectArea[v];C.position.setFromMatrixPosition(R.matrixWorld),C.position.applyMatrix4(S),o.identity(),s.copy(R.matrixWorld),s.premultiply(S),o.extractRotation(s),C.halfWidth.set(R.width*.5,0,0),C.halfHeight.set(0,R.height*.5,0),C.halfWidth.applyMatrix4(o),C.halfHeight.applyMatrix4(o),v++}else if(R.isPointLight){let C=n.point[p];C.position.setFromMatrixPosition(R.matrixWorld),C.position.applyMatrix4(S),p++}else if(R.isHemisphereLight){let C=n.hemi[w];C.direction.setFromMatrixPosition(R.matrixWorld),C.direction.transformDirection(S),w++}}}return{setup:a,setupView:l,state:n}}function OW(i){let e=new o0e(i),t=[],n=[],r=[];function s(p){f.camera=p,t.length=0,n.length=0,r.length=0}function o(p){t.push(p)}function a(p){n.push(p)}function l(p){r.push(p)}function c(){e.setup(t)}function u(p){e.setupView(t,p)}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 a0e(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new OW(i),e.set(r,[a])):s>=o.length?(a=new OW(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var l0e=`void main() {40664066 gl_Position = vec4( position, 1.0 );4067-}`,a0e=`uniform sampler2D shadow_pass;4067+}`,c0e=`uniform sampler2D shadow_pass;40684068 uniform vec2 resolution;40694069 uniform float radius;40704070 void main() {
@@ -4089,12 +4089,12 @@ void main() {
40894089 squared_mean = squared_mean / samples;40904090 float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );40914091 gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );4092-}`,l0e=[new ie(1,0,0),new ie(-1,0,0),new ie(0,1,0),new ie(0,-1,0),new ie(0,0,1),new ie(0,0,-1)],c0e=[new ie(0,-1,0),new ie(0,-1,0),new ie(0,0,1),new ie(0,0,-1),new ie(0,-1,0),new ie(0,-1,0)],FW=new on,R2=new ie,kL=new ie;function u0e(i,e,t){let n=new ec,r=new Oe,s=new Oe,o=new gn,a=new IT,l=new NT,c={},u=t.maxTextureSize,f={[go]:ui,[ui]:go,[rr]:rr},p=new $r({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:o0e,fragmentShader:a0e}),x=p.clone();x.defines.HORIZONTAL_PASS=1;let v=new qn;v.setAttribute("position",new Li(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let w=new Gn(v,p),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=sp;let T=this.type;this.render=function(D,F,N){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||D.length===0)return;this.type===$T&&(je("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=sp);let B=i.getRenderTarget(),z=i.getActiveCubeFace(),V=i.getActiveMipmapLevel(),H=i.state;H.setBlending(Yr),H.buffers.depth.getReversed()===!0?H.buffers.color.setClear(0,0,0,0):H.buffers.color.setClear(1,1,1,1),H.buffers.depth.setTest(!0),H.setScissorTest(!1);let Z=T!==this.type;Z&&F.traverse(function(J){J.material&&(Array.isArray(J.material)?J.material.forEach(j=>j.needsUpdate=!0):J.material.needsUpdate=!0)});for(let J=0,j=D.length;J<j;J++){let K=D[J],ee=K.shadow;if(ee===void 0){je("WebGLShadowMap:",K,"has no shadow.");continue}if(ee.autoUpdate===!1&&ee.needsUpdate===!1)continue;r.copy(ee.mapSize);let ae=ee.getFrameExtents();r.multiply(ae),s.copy(ee.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/ae.x),r.x=s.x*ae.x,ee.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/ae.y),r.y=s.y*ae.y,ee.mapSize.y=s.y));let ce=i.state.buffers.depth.getReversed();if(ee.camera._reversedDepth=ce,ee.map===null||Z===!0){if(ee.map!==null&&(ee.map.depthTexture!==null&&(ee.map.depthTexture.dispose(),ee.map.depthTexture=null),ee.map.dispose()),this.type===tc){if(K.isPointLight){je("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}ee.map=new ha(r.x,r.y,{format:Ts,type:Di,minFilter:bi,magFilter:bi,generateMipmaps:!1}),ee.map.texture.name=K.name+".shadowMap",ee.map.depthTexture=new ls(r.x,r.y,Zi),ee.map.depthTexture.name=K.name+".shadowMapDepth",ee.map.depthTexture.format=vs,ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=yi,ee.map.depthTexture.magFilter=yi}else K.isPointLight?(ee.map=new o3(r.x),ee.map.depthTexture=new x_(r.x,pi)):(ee.map=new ha(r.x,r.y),ee.map.depthTexture=new ls(r.x,r.y,pi)),ee.map.depthTexture.name=K.name+".shadowMap",ee.map.depthTexture.format=vs,this.type===sp?(ee.map.depthTexture.compareFunction=ce?jc:ih,ee.map.depthTexture.minFilter=bi,ee.map.depthTexture.magFilter=bi):(ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=yi,ee.map.depthTexture.magFilter=yi);ee.camera.updateProjectionMatrix()}let de=ee.map.isWebGLCubeRenderTarget?6:1;for(let ve=0;ve<de;ve++){if(ee.map.isWebGLCubeRenderTarget)i.setRenderTarget(ee.map,ve),i.clear();else{ve===0&&(i.setRenderTarget(ee.map),i.clear());let Ie=ee.getViewport(ve);o.set(s.x*Ie.x,s.y*Ie.y,s.x*Ie.z,s.y*Ie.w),H.viewport(o)}if(K.isPointLight){let Ie=ee.camera,Qe=ee.matrix,Ue=K.distance||Ie.far;Ue!==Ie.far&&(Ie.far=Ue,Ie.updateProjectionMatrix()),R2.setFromMatrixPosition(K.matrixWorld),Ie.position.copy(R2),kL.copy(Ie.position),kL.add(l0e[ve]),Ie.up.copy(c0e[ve]),Ie.lookAt(kL),Ie.updateMatrixWorld(),Qe.makeTranslation(-R2.x,-R2.y,-R2.z),FW.multiplyMatrices(Ie.projectionMatrix,Ie.matrixWorldInverse),ee._frustum.setFromProjectionMatrix(FW,Ie.coordinateSystem,Ie.reversedDepth)}else ee.updateMatrices(K);n=ee.getFrustum(),C(F,N,ee.camera,K,this.type)}ee.isPointLightShadow!==!0&&this.type===tc&&P(ee,N),ee.needsUpdate=!1}T=this.type,S.needsUpdate=!1,i.setRenderTarget(B,z,V)};function P(D,F){let N=e.update(w);p.defines.VSM_SAMPLES!==D.blurSamples&&(p.defines.VSM_SAMPLES=D.blurSamples,x.defines.VSM_SAMPLES=D.blurSamples,p.needsUpdate=!0,x.needsUpdate=!0),D.mapPass===null&&(D.mapPass=new ha(r.x,r.y,{format:Ts,type:Di})),p.uniforms.shadow_pass.value=D.map.depthTexture,p.uniforms.resolution.value=D.mapSize,p.uniforms.radius.value=D.radius,i.setRenderTarget(D.mapPass),i.clear(),i.renderBufferDirect(F,null,N,p,w,null),x.uniforms.shadow_pass.value=D.mapPass.texture,x.uniforms.resolution.value=D.mapSize,x.uniforms.radius.value=D.radius,i.setRenderTarget(D.map),i.clear(),i.renderBufferDirect(F,null,N,x,w,null)}function R(D,F,N,B){let z=null,V=N.isPointLight===!0?D.customDistanceMaterial:D.customDepthMaterial;if(V!==void 0)z=V;else if(z=N.isPointLight===!0?l:a,i.localClippingEnabled&&F.clipShadows===!0&&Array.isArray(F.clippingPlanes)&&F.clippingPlanes.length!==0||F.displacementMap&&F.displacementScale!==0||F.alphaMap&&F.alphaTest>0||F.map&&F.alphaTest>0||F.alphaToCoverage===!0){let H=z.uuid,Z=F.uuid,J=c[H];J===void 0&&(J={},c[H]=J);let j=J[Z];j===void 0&&(j=z.clone(),J[Z]=j,F.addEventListener("dispose",L)),z=j}if(z.visible=F.visible,z.wireframe=F.wireframe,B===tc?z.side=F.shadowSide!==null?F.shadowSide:F.side:z.side=F.shadowSide!==null?F.shadowSide:f[F.side],z.alphaMap=F.alphaMap,z.alphaTest=F.alphaToCoverage===!0?.5:F.alphaTest,z.map=F.map,z.clipShadows=F.clipShadows,z.clippingPlanes=F.clippingPlanes,z.clipIntersection=F.clipIntersection,z.displacementMap=F.displacementMap,z.displacementScale=F.displacementScale,z.displacementBias=F.displacementBias,z.wireframeLinewidth=F.wireframeLinewidth,z.linewidth=F.linewidth,N.isPointLight===!0&&z.isMeshDistanceMaterial===!0){let H=i.properties.get(z);H.light=N}return z}function C(D,F,N,B,z){if(D.visible===!1)return;if(D.layers.test(F.layers)&&(D.isMesh||D.isLine||D.isPoints)&&(D.castShadow||D.receiveShadow&&z===tc)&&(!D.frustumCulled||n.intersectsObject(D))){D.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,D.matrixWorld);let Z=e.update(D),J=D.material;if(Array.isArray(J)){let j=Z.groups;for(let K=0,ee=j.length;K<ee;K++){let ae=j[K],ce=J[ae.materialIndex];if(ce&&ce.visible){let de=R(D,ce,B,z);D.onBeforeShadow(i,D,F,N,Z,de,ae),i.renderBufferDirect(N,null,Z,de,D,ae),D.onAfterShadow(i,D,F,N,Z,de,ae)}}}else if(J.visible){let j=R(D,J,B,z);D.onBeforeShadow(i,D,F,N,Z,j,null),i.renderBufferDirect(N,null,Z,j,D,null),D.onAfterShadow(i,D,F,N,Z,j,null)}}let H=D.children;for(let Z=0,J=H.length;Z<J;Z++)C(H[Z],F,N,B,z)}function L(D){D.target.removeEventListener("dispose",L);for(let N in c){let B=c[N],z=D.target.uuid;z in B&&(B[z].dispose(),delete B[z])}}}function h0e(i,e){function t(){let xe=!1,bt=new gn,Ye=null,wt=new gn(0,0,0,0);return{setMask:function(Dt){Ye!==Dt&&!xe&&(i.colorMask(Dt,Dt,Dt,Dt),Ye=Dt)},setLocked:function(Dt){xe=Dt},setClear:function(Dt,ct,Ce,jt,Hi){Hi===!0&&(Dt*=jt,ct*=jt,Ce*=jt),bt.set(Dt,ct,Ce,jt),wt.equals(bt)===!1&&(i.clearColor(Dt,ct,Ce,jt),wt.copy(bt))},reset:function(){xe=!1,Ye=null,wt.set(-1,0,0,0)}}}function n(){let xe=!1,bt=!1,Ye=null,wt=null,Dt=null;return{setReversed:function(ct){if(bt!==ct){let Ce=e.get("EXT_clip_control");ct?Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.ZERO_TO_ONE_EXT):Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.NEGATIVE_ONE_TO_ONE_EXT),bt=ct;let jt=Dt;Dt=null,this.setClear(jt)}},getReversed:function(){return bt},setTest:function(ct){ct?$e(i.DEPTH_TEST):Et(i.DEPTH_TEST)},setMask:function(ct){Ye!==ct&&!xe&&(i.depthMask(ct),Ye=ct)},setFunc:function(ct){if(bt&&(ct=E2[ct]),wt!==ct){switch(ct){case dA:i.depthFunc(i.NEVER);break;case pA:i.depthFunc(i.ALWAYS);break;case AA:i.depthFunc(i.LESS);break;case ku:i.depthFunc(i.LEQUAL);break;case mA:i.depthFunc(i.EQUAL);break;case gA:i.depthFunc(i.GEQUAL);break;case _A:i.depthFunc(i.GREATER);break;case xA:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}wt=ct}},setLocked:function(ct){xe=ct},setClear:function(ct){Dt!==ct&&(Dt=ct,bt&&(ct=1-ct),i.clearDepth(ct))},reset:function(){xe=!1,Ye=null,wt=null,Dt=null,bt=!1}}}function r(){let xe=!1,bt=null,Ye=null,wt=null,Dt=null,ct=null,Ce=null,jt=null,Hi=null;return{setTest:function(Nn){xe||(Nn?$e(i.STENCIL_TEST):Et(i.STENCIL_TEST))},setMask:function(Nn){bt!==Nn&&!xe&&(i.stencilMask(Nn),bt=Nn)},setFunc:function(Nn,zr,gr){(Ye!==Nn||wt!==zr||Dt!==gr)&&(i.stencilFunc(Nn,zr,gr),Ye=Nn,wt=zr,Dt=gr)},setOp:function(Nn,zr,gr){(ct!==Nn||Ce!==zr||jt!==gr)&&(i.stencilOp(Nn,zr,gr),ct=Nn,Ce=zr,jt=gr)},setLocked:function(Nn){xe=Nn},setClear:function(Nn){Hi!==Nn&&(i.clearStencil(Nn),Hi=Nn)},reset:function(){xe=!1,bt=null,Ye=null,wt=null,Dt=null,ct=null,Ce=null,jt=null,Hi=null}}}let s=new t,o=new n,a=new r,l=new WeakMap,c=new WeakMap,u={},f={},p={},x=new WeakMap,v=[],w=null,S=!1,T=null,P=null,R=null,C=null,L=null,D=null,F=null,N=new Ut(0,0,0),B=0,z=!1,V=null,H=null,Z=null,J=null,j=null,K=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),ee=!1,ae=0,ce=i.getParameter(i.VERSION);ce.indexOf("WebGL")!==-1?(ae=parseFloat(/^WebGL (\d)/.exec(ce)[1]),ee=ae>=1):ce.indexOf("OpenGL ES")!==-1&&(ae=parseFloat(/^OpenGL ES (\d)/.exec(ce)[1]),ee=ae>=2);let de=null,ve={},Ie=i.getParameter(i.SCISSOR_BOX),Qe=i.getParameter(i.VIEWPORT),Ue=new gn().fromArray(Ie),mt=new gn().fromArray(Qe);function Me(xe,bt,Ye,wt){let Dt=new Uint8Array(4),ct=i.createTexture();i.bindTexture(xe,ct),i.texParameteri(xe,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(xe,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ce=0;Ce<Ye;Ce++)xe===i.TEXTURE_3D||xe===i.TEXTURE_2D_ARRAY?i.texImage3D(bt,0,i.RGBA,1,1,wt,0,i.RGBA,i.UNSIGNED_BYTE,Dt):i.texImage2D(bt+Ce,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,Dt);return ct}let ze={};ze[i.TEXTURE_2D]=Me(i.TEXTURE_2D,i.TEXTURE_2D,1),ze[i.TEXTURE_CUBE_MAP]=Me(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),ze[i.TEXTURE_2D_ARRAY]=Me(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),ze[i.TEXTURE_3D]=Me(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),$e(i.DEPTH_TEST),o.setFunc(ku),vt(!1),yt(e2),$e(i.CULL_FACE),st(Yr);function $e(xe){u[xe]!==!0&&(i.enable(xe),u[xe]=!0)}function Et(xe){u[xe]!==!1&&(i.disable(xe),u[xe]=!1)}function Tt(xe,bt){return p[xe]!==bt?(i.bindFramebuffer(xe,bt),p[xe]=bt,xe===i.DRAW_FRAMEBUFFER&&(p[i.FRAMEBUFFER]=bt),xe===i.FRAMEBUFFER&&(p[i.DRAW_FRAMEBUFFER]=bt),!0):!1}function Ct(xe,bt){let Ye=v,wt=!1;if(xe){Ye=x.get(bt),Ye===void 0&&(Ye=[],x.set(bt,Ye));let Dt=xe.textures;if(Ye.length!==Dt.length||Ye[0]!==i.COLOR_ATTACHMENT0){for(let ct=0,Ce=Dt.length;ct<Ce;ct++)Ye[ct]=i.COLOR_ATTACHMENT0+ct;Ye.length=Dt.length,wt=!0}}else Ye[0]!==i.BACK&&(Ye[0]=i.BACK,wt=!0);wt&&i.drawBuffers(Ye)}function un(xe){return w!==xe?(i.useProgram(xe),w=xe,!0):!1}let Gt={[Gs]:i.FUNC_ADD,[n2]:i.FUNC_SUBTRACT,[i2]:i.FUNC_REVERSE_SUBTRACT};Gt[YT]=i.MIN,Gt[ZT]=i.MAX;let Xe={[Wc]:i.ZERO,[r2]:i.ONE,[s2]:i.SRC_COLOR,[jd]:i.SRC_ALPHA,[h2]:i.SRC_ALPHA_SATURATE,[c2]:i.DST_COLOR,[a2]:i.DST_ALPHA,[o2]:i.ONE_MINUS_SRC_COLOR,[Xd]:i.ONE_MINUS_SRC_ALPHA,[u2]:i.ONE_MINUS_DST_COLOR,[l2]:i.ONE_MINUS_DST_ALPHA,[eW]:i.CONSTANT_COLOR,[tW]:i.ONE_MINUS_CONSTANT_COLOR,[nW]:i.CONSTANT_ALPHA,[iW]:i.ONE_MINUS_CONSTANT_ALPHA};function st(xe,bt,Ye,wt,Dt,ct,Ce,jt,Hi,Nn){if(xe===Yr){S===!0&&(Et(i.BLEND),S=!1);return}if(S===!1&&($e(i.BLEND),S=!0),xe!==Of){if(xe!==T||Nn!==z){if((P!==Gs||L!==Gs)&&(i.blendEquation(i.FUNC_ADD),P=Gs,L=Gs),Nn)switch(xe){case os:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case qu:i.blendFunc(i.ONE,i.ONE);break;case Hu:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Wu:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:Ge("WebGLState: Invalid blending: ",xe);break}else switch(xe){case os:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case qu:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Hu:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Wu:Ge("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ge("WebGLState: Invalid blending: ",xe);break}R=null,C=null,D=null,F=null,N.set(0,0,0),B=0,T=xe,z=Nn}return}Dt=Dt||bt,ct=ct||Ye,Ce=Ce||wt,(bt!==P||Dt!==L)&&(i.blendEquationSeparate(Gt[bt],Gt[Dt]),P=bt,L=Dt),(Ye!==R||wt!==C||ct!==D||Ce!==F)&&(i.blendFuncSeparate(Xe[Ye],Xe[wt],Xe[ct],Xe[Ce]),R=Ye,C=wt,D=ct,F=Ce),(jt.equals(N)===!1||Hi!==B)&&(i.blendColor(jt.r,jt.g,jt.b,Hi),N.copy(jt),B=Hi),T=xe,z=!1}function tt(xe,bt){xe.side===rr?Et(i.CULL_FACE):$e(i.CULL_FACE);let Ye=xe.side===ui;bt&&(Ye=!Ye),vt(Ye),xe.blending===os&&xe.transparent===!1?st(Yr):st(xe.blending,xe.blendEquation,xe.blendSrc,xe.blendDst,xe.blendEquationAlpha,xe.blendSrcAlpha,xe.blendDstAlpha,xe.blendColor,xe.blendAlpha,xe.premultipliedAlpha),o.setFunc(xe.depthFunc),o.setTest(xe.depthTest),o.setMask(xe.depthWrite),s.setMask(xe.colorWrite);let wt=xe.stencilWrite;a.setTest(wt),wt&&(a.setMask(xe.stencilWriteMask),a.setFunc(xe.stencilFunc,xe.stencilRef,xe.stencilFuncMask),a.setOp(xe.stencilFail,xe.stencilZFail,xe.stencilZPass)),Kt(xe.polygonOffset,xe.polygonOffsetFactor,xe.polygonOffsetUnits),xe.alphaToCoverage===!0?$e(i.SAMPLE_ALPHA_TO_COVERAGE):Et(i.SAMPLE_ALPHA_TO_COVERAGE)}function vt(xe){V!==xe&&(xe?i.frontFace(i.CW):i.frontFace(i.CCW),V=xe)}function yt(xe){xe!==jT?($e(i.CULL_FACE),xe!==H&&(xe===e2?i.cullFace(i.BACK):xe===XT?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Et(i.CULL_FACE),H=xe}function ln(xe){xe!==Z&&(ee&&i.lineWidth(xe),Z=xe)}function Kt(xe,bt,Ye){xe?($e(i.POLYGON_OFFSET_FILL),(J!==bt||j!==Ye)&&(J=bt,j=Ye,o.getReversed()&&(bt=-bt),i.polygonOffset(bt,Ye))):Et(i.POLYGON_OFFSET_FILL)}function Qt(xe){xe?$e(i.SCISSOR_TEST):Et(i.SCISSOR_TEST)}function xn(xe){xe===void 0&&(xe=i.TEXTURE0+K-1),de!==xe&&(i.activeTexture(xe),de=xe)}function ge(xe,bt,Ye){Ye===void 0&&(de===null?Ye=i.TEXTURE0+K-1:Ye=de);let wt=ve[Ye];wt===void 0&&(wt={type:void 0,texture:void 0},ve[Ye]=wt),(wt.type!==xe||wt.texture!==bt)&&(de!==Ye&&(i.activeTexture(Ye),de=Ye),i.bindTexture(xe,bt||ze[xe]),wt.type=xe,wt.texture=bt)}function di(){let xe=ve[de];xe!==void 0&&xe.type!==void 0&&(i.bindTexture(xe.type,null),xe.type=void 0,xe.texture=void 0)}function Bn(){try{i.compressedTexImage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function le(){try{i.compressedTexImage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function X(){try{i.texSubImage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Te(){try{i.texSubImage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Pe(){try{i.compressedTexSubImage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Ve(){try{i.compressedTexSubImage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function gt(){try{i.texStorage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function St(){try{i.texStorage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function qe(){try{i.texImage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Ke(){try{i.texImage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Rt(xe){return f[xe]!==void 0?f[xe]:i.getParameter(xe)}function en(xe,bt){f[xe]!==bt&&(i.pixelStorei(xe,bt),f[xe]=bt)}function Pt(xe){Ue.equals(xe)===!1&&(i.scissor(xe.x,xe.y,xe.z,xe.w),Ue.copy(xe))}function Mt(xe){mt.equals(xe)===!1&&(i.viewport(xe.x,xe.y,xe.z,xe.w),mt.copy(xe))}function cn(xe,bt){let Ye=c.get(bt);Ye===void 0&&(Ye=new WeakMap,c.set(bt,Ye));let wt=Ye.get(xe);wt===void 0&&(wt=i.getUniformBlockIndex(bt,xe.name),Ye.set(xe,wt))}function yn(xe,bt){let wt=c.get(bt).get(xe);l.get(bt)!==wt&&(i.uniformBlockBinding(bt,wt,xe.__bindingPointIndex),l.set(bt,wt))}function Pn(){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={},de=null,ve={},p={},x=new WeakMap,v=[],w=null,S=!1,T=null,P=null,R=null,C=null,L=null,D=null,F=null,N=new Ut(0,0,0),B=0,z=!1,V=null,H=null,Z=null,J=null,j=null,Ue.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:$e,disable:Et,bindFramebuffer:Tt,drawBuffers:Ct,useProgram:un,setBlending:st,setMaterial:tt,setFlipSided:vt,setCullFace:yt,setLineWidth:ln,setPolygonOffset:Kt,setScissorTest:Qt,activeTexture:xn,bindTexture:ge,unbindTexture:di,compressedTexImage2D:Bn,compressedTexImage3D:le,texImage2D:qe,texImage3D:Ke,pixelStorei:en,getParameter:Rt,updateUBOMapping:cn,uniformBlockBinding:yn,texStorage2D:gt,texStorage3D:St,texSubImage2D:X,texSubImage3D:Te,compressedTexSubImage2D:Pe,compressedTexSubImage3D:Ve,scissor:Pt,viewport:Mt,reset:Pn}}function f0e(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,p,x=new WeakMap,v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(le,X){return v?new OffscreenCanvas(le,X):f_("canvas")}function S(le,X,Te){let Pe=1,Ve=Bn(le);if((Ve.width>Te||Ve.height>Te)&&(Pe=Te/Math.max(Ve.width,Ve.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 gt=Math.floor(Pe*Ve.width),St=Math.floor(Pe*Ve.height);p===void 0&&(p=w(gt,St));let qe=X?w(gt,St):p;return qe.width=gt,qe.height=St,qe.getContext("2d").drawImage(le,0,0,gt,St),je("WebGLRenderer: Texture has been resized from ("+Ve.width+"x"+Ve.height+") to ("+gt+"x"+St+")."),qe}else return"data"in le&&je("WebGLRenderer: Image in DataTexture is too big ("+Ve.width+"x"+Ve.height+")."),le;return le}function T(le){return le.generateMipmaps}function P(le){i.generateMipmap(le)}function R(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 C(le,X,Te,Pe,Ve,gt=!1){if(le!==null){if(i[le]!==void 0)return i[le];je("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+le+"'")}let St;Pe&&(St=e.get("EXT_texture_norm16"),St||je("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let qe=X;if(X===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&&St&&(qe=St.R16_EXT),Te===i.SHORT&&St&&(qe=St.R16_SNORM_EXT)),X===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)),X===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&&St&&(qe=St.RG16_EXT),Te===i.SHORT&&St&&(qe=St.RG16_SNORM_EXT)),X===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)),X===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)),X===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)),X===i.RGB&&(Te===i.UNSIGNED_SHORT&&St&&(qe=St.RGB16_EXT),Te===i.SHORT&&St&&(qe=St.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)),X===i.RGBA){let Ke=gt?Yd:sn.getTransfer(Ve);Te===i.FLOAT&&(qe=i.RGBA32F),Te===i.HALF_FLOAT&&(qe=i.RGBA16F),Te===i.UNSIGNED_BYTE&&(qe=Ke===Bt?i.SRGB8_ALPHA8:i.RGBA8),Te===i.UNSIGNED_SHORT&&St&&(qe=St.RGBA16_EXT),Te===i.SHORT&&St&&(qe=St.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 L(le,X){let Te;return le?X===null||X===pi||X===Vo?Te=i.DEPTH24_STENCIL8:X===Zi?Te=i.DEPTH32F_STENCIL8:X===ja&&(Te=i.DEPTH24_STENCIL8,je("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):X===null||X===pi||X===Vo?Te=i.DEPTH_COMPONENT24:X===Zi?Te=i.DEPTH_COMPONENT32F:X===ja&&(Te=i.DEPTH_COMPONENT16),Te}function D(le,X){return T(le)===!0||le.isFramebufferTexture&&le.minFilter!==yi&&le.minFilter!==bi?Math.log2(Math.max(X.width,X.height))+1:le.mipmaps!==void 0&&le.mipmaps.length>0?le.mipmaps.length:le.isCompressedTexture&&Array.isArray(le.image)?X.mipmaps.length:1}function F(le){let X=le.target;X.removeEventListener("dispose",F),B(X),X.isVideoTexture&&u.delete(X),X.isHTMLTexture&&f.delete(X)}function N(le){let X=le.target;X.removeEventListener("dispose",N),V(X)}function B(le){let X=n.get(le);if(X.__webglInit===void 0)return;let Te=le.source,Pe=x.get(Te);if(Pe){let Ve=Pe[X.__cacheKey];Ve.usedTimes--,Ve.usedTimes===0&&z(le),Object.keys(Pe).length===0&&x.delete(Te)}n.remove(le)}function z(le){let X=n.get(le);i.deleteTexture(X.__webglTexture);let Te=le.source,Pe=x.get(Te);delete Pe[X.__cacheKey],o.memory.textures--}function V(le){let X=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(X.__webglFramebuffer[Pe]))for(let Ve=0;Ve<X.__webglFramebuffer[Pe].length;Ve++)i.deleteFramebuffer(X.__webglFramebuffer[Pe][Ve]);else i.deleteFramebuffer(X.__webglFramebuffer[Pe]);X.__webglDepthbuffer&&i.deleteRenderbuffer(X.__webglDepthbuffer[Pe])}else{if(Array.isArray(X.__webglFramebuffer))for(let Pe=0;Pe<X.__webglFramebuffer.length;Pe++)i.deleteFramebuffer(X.__webglFramebuffer[Pe]);else i.deleteFramebuffer(X.__webglFramebuffer);if(X.__webglDepthbuffer&&i.deleteRenderbuffer(X.__webglDepthbuffer),X.__webglMultisampledFramebuffer&&i.deleteFramebuffer(X.__webglMultisampledFramebuffer),X.__webglColorRenderbuffer)for(let Pe=0;Pe<X.__webglColorRenderbuffer.length;Pe++)X.__webglColorRenderbuffer[Pe]&&i.deleteRenderbuffer(X.__webglColorRenderbuffer[Pe]);X.__webglDepthRenderbuffer&&i.deleteRenderbuffer(X.__webglDepthRenderbuffer)}let Te=le.textures;for(let Pe=0,Ve=Te.length;Pe<Ve;Pe++){let gt=n.get(Te[Pe]);gt.__webglTexture&&(i.deleteTexture(gt.__webglTexture),o.memory.textures--),n.remove(Te[Pe])}n.remove(le)}let H=0;function Z(){H=0}function J(){return H}function j(le){H=le}function K(){let le=H;return le>=r.maxTextures&&je("WebGLTextures: Trying to use "+le+" texture units while this GPU supports only "+r.maxTextures),H+=1,le}function ee(le){let X=[];return X.push(le.wrapS),X.push(le.wrapT),X.push(le.wrapR||0),X.push(le.magFilter),X.push(le.minFilter),X.push(le.anisotropy),X.push(le.internalFormat),X.push(le.format),X.push(le.type),X.push(le.generateMipmaps),X.push(le.premultiplyAlpha),X.push(le.flipY),X.push(le.unpackAlignment),X.push(le.colorSpace),X.join()}function ae(le,X){let Te=n.get(le);if(le.isVideoTexture&&ge(le),le.isRenderTargetTexture===!1&&le.isExternalTexture!==!0&&le.version>0&&Te.__version!==le.version){let Pe=le.image;if(Pe===null)je("WebGLRenderer: Texture marked for update but no image data found.");else if(Pe.complete===!1)je("WebGLRenderer: Texture marked for update but image is incomplete");else{Et(Te,le,X);return}}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,Te.__webglTexture,i.TEXTURE0+X)}function ce(le,X){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Et(Te,le,X);return}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,Te.__webglTexture,i.TEXTURE0+X)}function de(le,X){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Et(Te,le,X);return}t.bindTexture(i.TEXTURE_3D,Te.__webglTexture,i.TEXTURE0+X)}function ve(le,X){let Te=n.get(le);if(le.isCubeDepthTexture!==!0&&le.version>0&&Te.__version!==le.version){Tt(Te,le,X);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Te.__webglTexture,i.TEXTURE0+X)}let Ie={[Mf]:i.REPEAT,[Go]:i.CLAMP_TO_EDGE,[Cf]:i.MIRRORED_REPEAT},Qe={[yi]:i.NEAREST,[x2]:i.NEAREST_MIPMAP_NEAREST,[ic]:i.NEAREST_MIPMAP_LINEAR,[bi]:i.LINEAR,[lp]:i.LINEAR_MIPMAP_NEAREST,[xo]:i.LINEAR_MIPMAP_LINEAR},Ue={[b2]:i.NEVER,[T2]:i.ALWAYS,[P_]:i.LESS,[ih]:i.LEQUAL,[w2]:i.EQUAL,[jc]:i.GEQUAL,[HA]:i.GREATER,[S2]:i.NOTEQUAL};function mt(le,X){if(X.type===Zi&&e.has("OES_texture_float_linear")===!1&&(X.magFilter===bi||X.magFilter===lp||X.magFilter===ic||X.magFilter===xo||X.minFilter===bi||X.minFilter===lp||X.minFilter===ic||X.minFilter===xo)&&je("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,Ie[X.wrapS]),i.texParameteri(le,i.TEXTURE_WRAP_T,Ie[X.wrapT]),(le===i.TEXTURE_3D||le===i.TEXTURE_2D_ARRAY)&&i.texParameteri(le,i.TEXTURE_WRAP_R,Ie[X.wrapR]),i.texParameteri(le,i.TEXTURE_MAG_FILTER,Qe[X.magFilter]),i.texParameteri(le,i.TEXTURE_MIN_FILTER,Qe[X.minFilter]),X.compareFunction&&(i.texParameteri(le,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(le,i.TEXTURE_COMPARE_FUNC,Ue[X.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(X.magFilter===yi||X.minFilter!==ic&&X.minFilter!==xo||X.type===Zi&&e.has("OES_texture_float_linear")===!1)return;if(X.anisotropy>1||n.get(X).__currentAnisotropy){let Te=e.get("EXT_texture_filter_anisotropic");i.texParameterf(le,Te.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(X.anisotropy,r.getMaxAnisotropy())),n.get(X).__currentAnisotropy=X.anisotropy}}}function Me(le,X){let Te=!1;le.__webglInit===void 0&&(le.__webglInit=!0,X.addEventListener("dispose",F));let Pe=X.source,Ve=x.get(Pe);Ve===void 0&&(Ve={},x.set(Pe,Ve));let gt=ee(X);if(gt!==le.__cacheKey){Ve[gt]===void 0&&(Ve[gt]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,Te=!0),Ve[gt].usedTimes++;let St=Ve[le.__cacheKey];St!==void 0&&(Ve[le.__cacheKey].usedTimes--,St.usedTimes===0&&z(X)),le.__cacheKey=gt,le.__webglTexture=Ve[gt].texture}return Te}function ze(le,X,Te){return Math.floor(Math.floor(le/Te)/X)}function $e(le,X,Te,Pe){let gt=le.updateRanges;if(gt.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,X.width,X.height,Te,Pe,X.data);else{gt.sort((en,Pt)=>en.start-Pt.start);let St=0;for(let en=1;en<gt.length;en++){let Pt=gt[St],Mt=gt[en],cn=Pt.start+Pt.count,yn=ze(Mt.start,X.width,4),Pn=ze(Pt.start,X.width,4);Mt.start<=cn+1&&yn===Pn&&ze(Mt.start+Mt.count-1,X.width,4)===yn?Pt.count=Math.max(Pt.count,Mt.start+Mt.count-Pt.start):(++St,gt[St]=Mt)}gt.length=St+1;let qe=t.getParameter(i.UNPACK_ROW_LENGTH),Ke=t.getParameter(i.UNPACK_SKIP_PIXELS),Rt=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,X.width);for(let en=0,Pt=gt.length;en<Pt;en++){let Mt=gt[en],cn=Math.floor(Mt.start/4),yn=Math.ceil(Mt.count/4),Pn=cn%X.width,xe=Math.floor(cn/X.width),bt=yn,Ye=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Pn),t.pixelStorei(i.UNPACK_SKIP_ROWS,xe),t.texSubImage2D(i.TEXTURE_2D,0,Pn,xe,bt,Ye,Te,Pe,X.data)}le.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,qe),t.pixelStorei(i.UNPACK_SKIP_PIXELS,Ke),t.pixelStorei(i.UNPACK_SKIP_ROWS,Rt)}}function Et(le,X,Te){let Pe=i.TEXTURE_2D;(X.isDataArrayTexture||X.isCompressedArrayTexture)&&(Pe=i.TEXTURE_2D_ARRAY),X.isData3DTexture&&(Pe=i.TEXTURE_3D);let Ve=Me(le,X),gt=X.source;t.bindTexture(Pe,le.__webglTexture,i.TEXTURE0+Te);let St=n.get(gt);if(gt.version!==St.__version||Ve===!0){if(t.activeTexture(i.TEXTURE0+Te),(typeof ImageBitmap<"u"&&X.image instanceof ImageBitmap)===!1){let Ye=sn.getPrimaries(sn.workingColorSpace),wt=X.colorSpace===qo?null:sn.getPrimaries(X.colorSpace),Dt=X.colorSpace===qo||Ye===wt?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,X.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Dt)}t.pixelStorei(i.UNPACK_ALIGNMENT,X.unpackAlignment);let Ke=S(X.image,!1,r.maxTextureSize);Ke=di(X,Ke);let Rt=s.convert(X.format,X.colorSpace),en=s.convert(X.type),Pt=C(X.internalFormat,Rt,en,X.normalized,X.colorSpace,X.isVideoTexture);mt(Pe,X);let Mt,cn=X.mipmaps,yn=X.isVideoTexture!==!0,Pn=St.__version===void 0||Ve===!0,xe=gt.dataReady,bt=D(X,Ke);if(X.isDepthTexture)Pt=L(X.format===eo,X.type),Pn&&(yn?t.texStorage2D(i.TEXTURE_2D,1,Pt,Ke.width,Ke.height):t.texImage2D(i.TEXTURE_2D,0,Pt,Ke.width,Ke.height,0,Rt,en,null));else if(X.isDataTexture)if(cn.length>0){yn&&Pn&&t.texStorage2D(i.TEXTURE_2D,bt,Pt,cn[0].width,cn[0].height);for(let Ye=0,wt=cn.length;Ye<wt;Ye++)Mt=cn[Ye],yn?xe&&t.texSubImage2D(i.TEXTURE_2D,Ye,0,0,Mt.width,Mt.height,Rt,en,Mt.data):t.texImage2D(i.TEXTURE_2D,Ye,Pt,Mt.width,Mt.height,0,Rt,en,Mt.data);X.generateMipmaps=!1}else yn?(Pn&&t.texStorage2D(i.TEXTURE_2D,bt,Pt,Ke.width,Ke.height),xe&&$e(X,Ke,Rt,en)):t.texImage2D(i.TEXTURE_2D,0,Pt,Ke.width,Ke.height,0,Rt,en,Ke.data);else if(X.isCompressedTexture)if(X.isCompressedArrayTexture){yn&&Pn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,bt,Pt,cn[0].width,cn[0].height,Ke.depth);for(let Ye=0,wt=cn.length;Ye<wt;Ye++)if(Mt=cn[Ye],X.format!==vr)if(Rt!==null)if(yn){if(xe)if(X.layerUpdates.size>0){let Dt=M2(Mt.width,Mt.height,X.format,X.type);for(let ct of X.layerUpdates){let Ce=Mt.data.subarray(ct*Dt/Mt.data.BYTES_PER_ELEMENT,(ct+1)*Dt/Mt.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ye,0,0,ct,Mt.width,Mt.height,1,Rt,Ce)}X.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ye,0,0,0,Mt.width,Mt.height,Ke.depth,Rt,Mt.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Ye,Pt,Mt.width,Mt.height,Ke.depth,0,Mt.data,0,0);else je("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else yn?xe&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Ye,0,0,0,Mt.width,Mt.height,Ke.depth,Rt,en,Mt.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Ye,Pt,Mt.width,Mt.height,Ke.depth,0,Rt,en,Mt.data)}else{yn&&Pn&&t.texStorage2D(i.TEXTURE_2D,bt,Pt,cn[0].width,cn[0].height);for(let Ye=0,wt=cn.length;Ye<wt;Ye++)Mt=cn[Ye],X.format!==vr?Rt!==null?yn?xe&&t.compressedTexSubImage2D(i.TEXTURE_2D,Ye,0,0,Mt.width,Mt.height,Rt,Mt.data):t.compressedTexImage2D(i.TEXTURE_2D,Ye,Pt,Mt.width,Mt.height,0,Mt.data):je("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):yn?xe&&t.texSubImage2D(i.TEXTURE_2D,Ye,0,0,Mt.width,Mt.height,Rt,en,Mt.data):t.texImage2D(i.TEXTURE_2D,Ye,Pt,Mt.width,Mt.height,0,Rt,en,Mt.data)}else if(X.isDataArrayTexture)if(yn){if(Pn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,bt,Pt,Ke.width,Ke.height,Ke.depth),xe)if(X.layerUpdates.size>0){let Ye=M2(Ke.width,Ke.height,X.format,X.type);for(let wt of X.layerUpdates){let Dt=Ke.data.subarray(wt*Ye/Ke.data.BYTES_PER_ELEMENT,(wt+1)*Ye/Ke.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,wt,Ke.width,Ke.height,1,Rt,en,Dt)}X.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Ke.width,Ke.height,Ke.depth,Rt,en,Ke.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Pt,Ke.width,Ke.height,Ke.depth,0,Rt,en,Ke.data);else if(X.isData3DTexture)yn?(Pn&&t.texStorage3D(i.TEXTURE_3D,bt,Pt,Ke.width,Ke.height,Ke.depth),xe&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Ke.width,Ke.height,Ke.depth,Rt,en,Ke.data)):t.texImage3D(i.TEXTURE_3D,0,Pt,Ke.width,Ke.height,Ke.depth,0,Rt,en,Ke.data);else if(X.isFramebufferTexture){if(Pn)if(yn)t.texStorage2D(i.TEXTURE_2D,bt,Pt,Ke.width,Ke.height);else{let Ye=Ke.width,wt=Ke.height;for(let Dt=0;Dt<bt;Dt++)t.texImage2D(i.TEXTURE_2D,Dt,Pt,Ye,wt,0,Rt,en,null),Ye>>=1,wt>>=1}}else if(X.isHTMLTexture){if("texElementImage2D"in i){let Ye=i.canvas;if(Ye.hasAttribute("layoutsubtree")||Ye.setAttribute("layoutsubtree","true"),Ke.parentNode!==Ye){Ye.appendChild(Ke),f.add(X),Ye.onpaint=wt=>{let Dt=wt.changedElements;for(let ct of f)Dt.includes(ct.image)&&(ct.needsUpdate=!0)},Ye.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,Ke);else{let Dt=i.RGBA,ct=i.RGBA,Ce=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,Dt,ct,Ce,Ke)}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(cn.length>0){if(yn&&Pn){let Ye=Bn(cn[0]);t.texStorage2D(i.TEXTURE_2D,bt,Pt,Ye.width,Ye.height)}for(let Ye=0,wt=cn.length;Ye<wt;Ye++)Mt=cn[Ye],yn?xe&&t.texSubImage2D(i.TEXTURE_2D,Ye,0,0,Rt,en,Mt):t.texImage2D(i.TEXTURE_2D,Ye,Pt,Rt,en,Mt);X.generateMipmaps=!1}else if(yn){if(Pn){let Ye=Bn(Ke);t.texStorage2D(i.TEXTURE_2D,bt,Pt,Ye.width,Ye.height)}xe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Rt,en,Ke)}else t.texImage2D(i.TEXTURE_2D,0,Pt,Rt,en,Ke);T(X)&&P(Pe),St.__version=gt.version,X.onUpdate&&X.onUpdate(X)}le.__version=X.version}function Tt(le,X,Te){if(X.image.length!==6)return;let Pe=Me(le,X),Ve=X.source;t.bindTexture(i.TEXTURE_CUBE_MAP,le.__webglTexture,i.TEXTURE0+Te);let gt=n.get(Ve);if(Ve.version!==gt.__version||Pe===!0){t.activeTexture(i.TEXTURE0+Te);let St=sn.getPrimaries(sn.workingColorSpace),qe=X.colorSpace===qo?null:sn.getPrimaries(X.colorSpace),Ke=X.colorSpace===qo||St===qe?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,X.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,X.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ke);let Rt=X.isCompressedTexture||X.image[0].isCompressedTexture,en=X.image[0]&&X.image[0].isDataTexture,Pt=[];for(let ct=0;ct<6;ct++)!Rt&&!en?Pt[ct]=S(X.image[ct],!0,r.maxCubemapSize):Pt[ct]=en?X.image[ct].image:X.image[ct],Pt[ct]=di(X,Pt[ct]);let Mt=Pt[0],cn=s.convert(X.format,X.colorSpace),yn=s.convert(X.type),Pn=C(X.internalFormat,cn,yn,X.normalized,X.colorSpace),xe=X.isVideoTexture!==!0,bt=gt.__version===void 0||Pe===!0,Ye=Ve.dataReady,wt=D(X,Mt);mt(i.TEXTURE_CUBE_MAP,X);let Dt;if(Rt){xe&&bt&&t.texStorage2D(i.TEXTURE_CUBE_MAP,wt,Pn,Mt.width,Mt.height);for(let ct=0;ct<6;ct++){Dt=Pt[ct].mipmaps;for(let Ce=0;Ce<Dt.length;Ce++){let jt=Dt[Ce];X.format!==vr?cn!==null?xe?Ye&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce,0,0,jt.width,jt.height,cn,jt.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce,Pn,jt.width,jt.height,0,jt.data):je("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce,0,0,jt.width,jt.height,cn,yn,jt.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce,Pn,jt.width,jt.height,0,cn,yn,jt.data)}}}else{if(Dt=X.mipmaps,xe&&bt){Dt.length>0&&wt++;let ct=Bn(Pt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,wt,Pn,ct.width,ct.height)}for(let ct=0;ct<6;ct++)if(en){xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,0,0,Pt[ct].width,Pt[ct].height,cn,yn,Pt[ct].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,Pn,Pt[ct].width,Pt[ct].height,0,cn,yn,Pt[ct].data);for(let Ce=0;Ce<Dt.length;Ce++){let Hi=Dt[Ce].image[ct].image;xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,0,0,Hi.width,Hi.height,cn,yn,Hi.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,Pn,Hi.width,Hi.height,0,cn,yn,Hi.data)}}else{xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,0,0,cn,yn,Pt[ct]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,Pn,cn,yn,Pt[ct]);for(let Ce=0;Ce<Dt.length;Ce++){let jt=Dt[Ce];xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,0,0,cn,yn,jt.image[ct]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,Pn,cn,yn,jt.image[ct])}}}T(X)&&P(i.TEXTURE_CUBE_MAP),gt.__version=Ve.version,X.onUpdate&&X.onUpdate(X)}le.__version=X.version}function Ct(le,X,Te,Pe,Ve,gt){let St=s.convert(Te.format,Te.colorSpace),qe=s.convert(Te.type),Ke=C(Te.internalFormat,St,qe,Te.normalized,Te.colorSpace),Rt=n.get(X),en=n.get(Te);if(en.__renderTarget=X,!Rt.__hasExternalTextures){let Pt=Math.max(1,X.width>>gt),Mt=Math.max(1,X.height>>gt);Ve===i.TEXTURE_3D||Ve===i.TEXTURE_2D_ARRAY?t.texImage3D(Ve,gt,Ke,Pt,Mt,X.depth,0,St,qe,null):t.texImage2D(Ve,gt,Ke,Pt,Mt,0,St,qe,null)}t.bindFramebuffer(i.FRAMEBUFFER,le),xn(X)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Pe,Ve,en.__webglTexture,0,Qt(X)):(Ve===i.TEXTURE_2D||Ve>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Ve<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Pe,Ve,en.__webglTexture,gt),t.bindFramebuffer(i.FRAMEBUFFER,null)}function un(le,X,Te){if(i.bindRenderbuffer(i.RENDERBUFFER,le),X.depthBuffer){let Pe=X.depthTexture,Ve=Pe&&Pe.isDepthTexture?Pe.type:null,gt=L(X.stencilBuffer,Ve),St=X.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;xn(X)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Qt(X),gt,X.width,X.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,Qt(X),gt,X.width,X.height):i.renderbufferStorage(i.RENDERBUFFER,gt,X.width,X.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,St,i.RENDERBUFFER,le)}else{let Pe=X.textures;for(let Ve=0;Ve<Pe.length;Ve++){let gt=Pe[Ve],St=s.convert(gt.format,gt.colorSpace),qe=s.convert(gt.type),Ke=C(gt.internalFormat,St,qe,gt.normalized,gt.colorSpace);xn(X)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Qt(X),Ke,X.width,X.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,Qt(X),Ke,X.width,X.height):i.renderbufferStorage(i.RENDERBUFFER,Ke,X.width,X.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Gt(le,X,Te){let Pe=X.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,le),!(X.depthTexture&&X.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let Ve=n.get(X.depthTexture);if(Ve.__renderTarget=X,(!Ve.__webglTexture||X.depthTexture.image.width!==X.width||X.depthTexture.image.height!==X.height)&&(X.depthTexture.image.width=X.width,X.depthTexture.image.height=X.height,X.depthTexture.needsUpdate=!0),Pe){if(Ve.__webglInit===void 0&&(Ve.__webglInit=!0,X.depthTexture.addEventListener("dispose",F)),Ve.__webglTexture===void 0){Ve.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,Ve.__webglTexture),mt(i.TEXTURE_CUBE_MAP,X.depthTexture);let Rt=s.convert(X.depthTexture.format),en=s.convert(X.depthTexture.type),Pt;X.depthTexture.format===vs?Pt=i.DEPTH_COMPONENT24:X.depthTexture.format===eo&&(Pt=i.DEPTH24_STENCIL8);for(let Mt=0;Mt<6;Mt++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Mt,0,Pt,X.width,X.height,0,Rt,en,null)}}else ae(X.depthTexture,0);let gt=Ve.__webglTexture,St=Qt(X),qe=Pe?i.TEXTURE_CUBE_MAP_POSITIVE_X+Te:i.TEXTURE_2D,Ke=X.depthTexture.format===eo?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(X.depthTexture.format===vs)xn(X)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Ke,qe,gt,0,St):i.framebufferTexture2D(i.FRAMEBUFFER,Ke,qe,gt,0);else if(X.depthTexture.format===eo)xn(X)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Ke,qe,gt,0,St):i.framebufferTexture2D(i.FRAMEBUFFER,Ke,qe,gt,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function Xe(le){let X=n.get(le),Te=le.isWebGLCubeRenderTarget===!0;if(X.__boundDepthTexture!==le.depthTexture){let Pe=le.depthTexture;if(X.__depthDisposeCallback&&X.__depthDisposeCallback(),Pe){let Ve=()=>{delete X.__boundDepthTexture,delete X.__depthDisposeCallback,Pe.removeEventListener("dispose",Ve)};Pe.addEventListener("dispose",Ve),X.__depthDisposeCallback=Ve}X.__boundDepthTexture=Pe}if(le.depthTexture&&!X.__autoAllocateDepthBuffer)if(Te)for(let Pe=0;Pe<6;Pe++)Gt(X.__webglFramebuffer[Pe],le,Pe);else{let Pe=le.texture.mipmaps;Pe&&Pe.length>0?Gt(X.__webglFramebuffer[0],le,0):Gt(X.__webglFramebuffer,le,0)}else if(Te){X.__webglDepthbuffer=[];for(let Pe=0;Pe<6;Pe++)if(t.bindFramebuffer(i.FRAMEBUFFER,X.__webglFramebuffer[Pe]),X.__webglDepthbuffer[Pe]===void 0)X.__webglDepthbuffer[Pe]=i.createRenderbuffer(),un(X.__webglDepthbuffer[Pe],le,!1);else{let Ve=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,gt=X.__webglDepthbuffer[Pe];i.bindRenderbuffer(i.RENDERBUFFER,gt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ve,i.RENDERBUFFER,gt)}}else{let Pe=le.texture.mipmaps;if(Pe&&Pe.length>0?t.bindFramebuffer(i.FRAMEBUFFER,X.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,X.__webglFramebuffer),X.__webglDepthbuffer===void 0)X.__webglDepthbuffer=i.createRenderbuffer(),un(X.__webglDepthbuffer,le,!1);else{let Ve=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,gt=X.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,gt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ve,i.RENDERBUFFER,gt)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function st(le,X,Te){let Pe=n.get(le);X!==void 0&&Ct(Pe.__webglFramebuffer,le,le.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Te!==void 0&&Xe(le)}function tt(le){let X=le.texture,Te=n.get(le),Pe=n.get(X);le.addEventListener("dispose",N);let Ve=le.textures,gt=le.isWebGLCubeRenderTarget===!0,St=Ve.length>1;if(St||(Pe.__webglTexture===void 0&&(Pe.__webglTexture=i.createTexture()),Pe.__version=X.version,o.memory.textures++),gt){Te.__webglFramebuffer=[];for(let qe=0;qe<6;qe++)if(X.mipmaps&&X.mipmaps.length>0){Te.__webglFramebuffer[qe]=[];for(let Ke=0;Ke<X.mipmaps.length;Ke++)Te.__webglFramebuffer[qe][Ke]=i.createFramebuffer()}else Te.__webglFramebuffer[qe]=i.createFramebuffer()}else{if(X.mipmaps&&X.mipmaps.length>0){Te.__webglFramebuffer=[];for(let qe=0;qe<X.mipmaps.length;qe++)Te.__webglFramebuffer[qe]=i.createFramebuffer()}else Te.__webglFramebuffer=i.createFramebuffer();if(St)for(let qe=0,Ke=Ve.length;qe<Ke;qe++){let Rt=n.get(Ve[qe]);Rt.__webglTexture===void 0&&(Rt.__webglTexture=i.createTexture(),o.memory.textures++)}if(le.samples>0&&xn(le)===!1){Te.__webglMultisampledFramebuffer=i.createFramebuffer(),Te.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Te.__webglMultisampledFramebuffer);for(let qe=0;qe<Ve.length;qe++){let Ke=Ve[qe];Te.__webglColorRenderbuffer[qe]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe]);let Rt=s.convert(Ke.format,Ke.colorSpace),en=s.convert(Ke.type),Pt=C(Ke.internalFormat,Rt,en,Ke.normalized,Ke.colorSpace,le.isXRRenderTarget===!0),Mt=Qt(le);i.renderbufferStorageMultisample(i.RENDERBUFFER,Mt,Pt,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(),un(Te.__webglDepthRenderbuffer,le,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(gt){t.bindTexture(i.TEXTURE_CUBE_MAP,Pe.__webglTexture),mt(i.TEXTURE_CUBE_MAP,X);for(let qe=0;qe<6;qe++)if(X.mipmaps&&X.mipmaps.length>0)for(let Ke=0;Ke<X.mipmaps.length;Ke++)Ct(Te.__webglFramebuffer[qe][Ke],le,X,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,Ke);else Ct(Te.__webglFramebuffer[qe],le,X,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,0);T(X)&&P(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(St){for(let qe=0,Ke=Ve.length;qe<Ke;qe++){let Rt=Ve[qe],en=n.get(Rt),Pt=i.TEXTURE_2D;(le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(Pt=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Pt,en.__webglTexture),mt(Pt,Rt),Ct(Te.__webglFramebuffer,le,Rt,i.COLOR_ATTACHMENT0+qe,Pt,0),T(Rt)&&P(Pt)}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,X),X.mipmaps&&X.mipmaps.length>0)for(let Ke=0;Ke<X.mipmaps.length;Ke++)Ct(Te.__webglFramebuffer[Ke],le,X,i.COLOR_ATTACHMENT0,qe,Ke);else Ct(Te.__webglFramebuffer,le,X,i.COLOR_ATTACHMENT0,qe,0);T(X)&&P(qe),t.unbindTexture()}le.depthBuffer&&Xe(le)}function vt(le){let X=le.textures;for(let Te=0,Pe=X.length;Te<Pe;Te++){let Ve=X[Te];if(T(Ve)){let gt=R(le),St=n.get(Ve).__webglTexture;t.bindTexture(gt,St),P(gt),t.unbindTexture()}}}let yt=[],ln=[];function Kt(le){if(le.samples>0){if(xn(le)===!1){let X=le.textures,Te=le.width,Pe=le.height,Ve=i.COLOR_BUFFER_BIT,gt=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,St=n.get(le),qe=X.length>1;if(qe)for(let Rt=0;Rt<X.length;Rt++)t.bindFramebuffer(i.FRAMEBUFFER,St.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Rt,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,St.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Rt,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,St.__webglMultisampledFramebuffer);let Ke=le.texture.mipmaps;Ke&&Ke.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,St.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,St.__webglFramebuffer);for(let Rt=0;Rt<X.length;Rt++){if(le.resolveDepthBuffer&&(le.depthBuffer&&(Ve|=i.DEPTH_BUFFER_BIT),le.stencilBuffer&&le.resolveStencilBuffer&&(Ve|=i.STENCIL_BUFFER_BIT)),qe){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,St.__webglColorRenderbuffer[Rt]);let en=n.get(X[Rt]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,en,0)}i.blitFramebuffer(0,0,Te,Pe,0,0,Te,Pe,Ve,i.NEAREST),l===!0&&(yt.length=0,ln.length=0,yt.push(i.COLOR_ATTACHMENT0+Rt),le.depthBuffer&&le.resolveDepthBuffer===!1&&(yt.push(gt),ln.push(gt),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,ln)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,yt))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),qe)for(let Rt=0;Rt<X.length;Rt++){t.bindFramebuffer(i.FRAMEBUFFER,St.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Rt,i.RENDERBUFFER,St.__webglColorRenderbuffer[Rt]);let en=n.get(X[Rt]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,St.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Rt,i.TEXTURE_2D,en,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,St.__webglMultisampledFramebuffer)}else if(le.depthBuffer&&le.resolveDepthBuffer===!1&&l){let X=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[X])}}}function Qt(le){return Math.min(r.maxSamples,le.samples)}function xn(le){let X=n.get(le);return le.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&X.__useRenderToTexture!==!1}function ge(le){let X=o.render.frame;u.get(le)!==X&&(u.set(le,X),le.update())}function di(le,X){let Te=le.colorSpace,Pe=le.format,Ve=le.type;return le.isCompressedTexture===!0||le.isVideoTexture===!0||Te!==$d&&Te!==qo&&(sn.getTransfer(Te)===Bt?(Pe!==vr||Ve!==zi)&&je("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ge("WebGLTextures: Unsupported texture color space:",Te)),X}function Bn(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=K,this.resetTextureUnits=Z,this.getTextureUnits=J,this.setTextureUnits=j,this.setTexture2D=ae,this.setTexture2DArray=ce,this.setTexture3D=de,this.setTextureCube=ve,this.rebindTextures=st,this.setupRenderTarget=tt,this.updateRenderTargetMipmap=vt,this.updateMultisampleRenderTarget=Kt,this.setupDepthRenderbuffer=Xe,this.setupFrameBufferTexture=Ct,this.useMultisampledRTT=xn,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function d0e(i,e){function t(n,r=qo){let s,o=sn.getTransfer(r);if(n===zi)return i.UNSIGNED_BYTE;if(n===OA)return i.UNSIGNED_SHORT_4_4_4_4;if(n===BA)return i.UNSIGNED_SHORT_5_5_5_1;if(n===UA)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===kA)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Xu)return i.BYTE;if(n===$u)return i.SHORT;if(n===ja)return i.UNSIGNED_SHORT;if(n===Dr)return i.INT;if(n===pi)return i.UNSIGNED_INT;if(n===Zi)return i.FLOAT;if(n===Di)return i.HALF_FLOAT;if(n===R_)return i.ALPHA;if(n===Bf)return i.RGB;if(n===vr)return i.RGBA;if(n===vs)return i.DEPTH_COMPONENT;if(n===eo)return i.DEPTH_STENCIL;if(n===Uf)return i.RED;if(n===Yu)return i.RED_INTEGER;if(n===Ts)return i.RG;if(n===Zu)return i.RG_INTEGER;if(n===cp)return i.RGBA_INTEGER;if(n===Ku||n===Qu||n===Ju||n===eh)if(o===Bt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Ku)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Qu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ju)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===eh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Ku)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Qu)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ju)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===eh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===GA||n===zA||n===VA||n===qA)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===GA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===zA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===VA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===qA)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===up||n===hp||n===fp||n===dp||n===pp||n===th||n===Ap)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===up||n===hp)return o===Bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===fp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===dp)return s.COMPRESSED_R11_EAC;if(n===pp)return s.COMPRESSED_SIGNED_R11_EAC;if(n===th)return s.COMPRESSED_RG11_EAC;if(n===Ap)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===mp||n===gp||n===_p||n===xp||n===yp||n===vp||n===bp||n===wp||n===Sp||n===Tp||n===Ep||n===Mp||n===Cp||n===Rp)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===gp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===_p)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===xp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===yp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===vp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===bp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===wp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Sp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Tp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ep)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Cp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Rp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Pp||n===Ip||n===Np)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Pp)return o===Bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ip)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Np)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Lp||n===Dp||n===nh||n===Fp)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Lp)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Dp)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===nh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Fp)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Vo?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var p0e=`4092+}`,u0e=[new ie(1,0,0),new ie(-1,0,0),new ie(0,1,0),new ie(0,-1,0),new ie(0,0,1),new ie(0,0,-1)],h0e=[new ie(0,-1,0),new ie(0,-1,0),new ie(0,0,1),new ie(0,0,-1),new ie(0,-1,0),new ie(0,-1,0)],BW=new on,I2=new ie,jL=new ie;function f0e(i,e,t){let n=new tc,r=new Oe,s=new Oe,o=new gn,a=new LT,l=new DT,c={},u=t.maxTextureSize,f={[go]:hi,[hi]:go,[rr]:rr},p=new $r({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:l0e,fragmentShader:c0e}),x=p.clone();x.defines.HORIZONTAL_PASS=1;let v=new qn;v.setAttribute("position",new Li(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let w=new Gn(v,p),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=op;let T=this.type;this.render=function(D,F,N){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||D.length===0)return;this.type===ZT&&(je("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=op);let B=i.getRenderTarget(),z=i.getActiveCubeFace(),V=i.getActiveMipmapLevel(),H=i.state;H.setBlending(Yr),H.buffers.depth.getReversed()===!0?H.buffers.color.setClear(0,0,0,0):H.buffers.color.setClear(1,1,1,1),H.buffers.depth.setTest(!0),H.setScissorTest(!1);let Z=T!==this.type;Z&&F.traverse(function(J){J.material&&(Array.isArray(J.material)?J.material.forEach(j=>j.needsUpdate=!0):J.material.needsUpdate=!0)});for(let J=0,j=D.length;J<j;J++){let K=D[J],ee=K.shadow;if(ee===void 0){je("WebGLShadowMap:",K,"has no shadow.");continue}if(ee.autoUpdate===!1&&ee.needsUpdate===!1)continue;r.copy(ee.mapSize);let ae=ee.getFrameExtents();r.multiply(ae),s.copy(ee.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/ae.x),r.x=s.x*ae.x,ee.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/ae.y),r.y=s.y*ae.y,ee.mapSize.y=s.y));let ce=i.state.buffers.depth.getReversed();if(ee.camera._reversedDepth=ce,ee.map===null||Z===!0){if(ee.map!==null&&(ee.map.depthTexture!==null&&(ee.map.depthTexture.dispose(),ee.map.depthTexture=null),ee.map.dispose()),this.type===nc){if(K.isPointLight){je("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}ee.map=new ha(r.x,r.y,{format:Ms,type:Di,minFilter:bi,magFilter:bi,generateMipmaps:!1}),ee.map.texture.name=K.name+".shadowMap",ee.map.depthTexture=new ls(r.x,r.y,Zi),ee.map.depthTexture.name=K.name+".shadowMapDepth",ee.map.depthTexture.format=ws,ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=yi,ee.map.depthTexture.magFilter=yi}else K.isPointLight?(ee.map=new l3(r.x),ee.map.depthTexture=new y_(r.x,Ai)):(ee.map=new ha(r.x,r.y),ee.map.depthTexture=new ls(r.x,r.y,Ai)),ee.map.depthTexture.name=K.name+".shadowMap",ee.map.depthTexture.format=ws,this.type===op?(ee.map.depthTexture.compareFunction=ce?Xc:sh,ee.map.depthTexture.minFilter=bi,ee.map.depthTexture.magFilter=bi):(ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=yi,ee.map.depthTexture.magFilter=yi);ee.camera.updateProjectionMatrix()}let de=ee.map.isWebGLCubeRenderTarget?6:1;for(let ve=0;ve<de;ve++){if(ee.map.isWebGLCubeRenderTarget)i.setRenderTarget(ee.map,ve),i.clear();else{ve===0&&(i.setRenderTarget(ee.map),i.clear());let Ie=ee.getViewport(ve);o.set(s.x*Ie.x,s.y*Ie.y,s.x*Ie.z,s.y*Ie.w),H.viewport(o)}if(K.isPointLight){let Ie=ee.camera,Qe=ee.matrix,Ue=K.distance||Ie.far;Ue!==Ie.far&&(Ie.far=Ue,Ie.updateProjectionMatrix()),I2.setFromMatrixPosition(K.matrixWorld),Ie.position.copy(I2),jL.copy(Ie.position),jL.add(u0e[ve]),Ie.up.copy(h0e[ve]),Ie.lookAt(jL),Ie.updateMatrixWorld(),Qe.makeTranslation(-I2.x,-I2.y,-I2.z),BW.multiplyMatrices(Ie.projectionMatrix,Ie.matrixWorldInverse),ee._frustum.setFromProjectionMatrix(BW,Ie.coordinateSystem,Ie.reversedDepth)}else ee.updateMatrices(K);n=ee.getFrustum(),C(F,N,ee.camera,K,this.type)}ee.isPointLightShadow!==!0&&this.type===nc&&P(ee,N),ee.needsUpdate=!1}T=this.type,S.needsUpdate=!1,i.setRenderTarget(B,z,V)};function P(D,F){let N=e.update(w);p.defines.VSM_SAMPLES!==D.blurSamples&&(p.defines.VSM_SAMPLES=D.blurSamples,x.defines.VSM_SAMPLES=D.blurSamples,p.needsUpdate=!0,x.needsUpdate=!0),D.mapPass===null&&(D.mapPass=new ha(r.x,r.y,{format:Ms,type:Di})),p.uniforms.shadow_pass.value=D.map.depthTexture,p.uniforms.resolution.value=D.mapSize,p.uniforms.radius.value=D.radius,i.setRenderTarget(D.mapPass),i.clear(),i.renderBufferDirect(F,null,N,p,w,null),x.uniforms.shadow_pass.value=D.mapPass.texture,x.uniforms.resolution.value=D.mapSize,x.uniforms.radius.value=D.radius,i.setRenderTarget(D.map),i.clear(),i.renderBufferDirect(F,null,N,x,w,null)}function R(D,F,N,B){let z=null,V=N.isPointLight===!0?D.customDistanceMaterial:D.customDepthMaterial;if(V!==void 0)z=V;else if(z=N.isPointLight===!0?l:a,i.localClippingEnabled&&F.clipShadows===!0&&Array.isArray(F.clippingPlanes)&&F.clippingPlanes.length!==0||F.displacementMap&&F.displacementScale!==0||F.alphaMap&&F.alphaTest>0||F.map&&F.alphaTest>0||F.alphaToCoverage===!0){let H=z.uuid,Z=F.uuid,J=c[H];J===void 0&&(J={},c[H]=J);let j=J[Z];j===void 0&&(j=z.clone(),J[Z]=j,F.addEventListener("dispose",L)),z=j}if(z.visible=F.visible,z.wireframe=F.wireframe,B===nc?z.side=F.shadowSide!==null?F.shadowSide:F.side:z.side=F.shadowSide!==null?F.shadowSide:f[F.side],z.alphaMap=F.alphaMap,z.alphaTest=F.alphaToCoverage===!0?.5:F.alphaTest,z.map=F.map,z.clipShadows=F.clipShadows,z.clippingPlanes=F.clippingPlanes,z.clipIntersection=F.clipIntersection,z.displacementMap=F.displacementMap,z.displacementScale=F.displacementScale,z.displacementBias=F.displacementBias,z.wireframeLinewidth=F.wireframeLinewidth,z.linewidth=F.linewidth,N.isPointLight===!0&&z.isMeshDistanceMaterial===!0){let H=i.properties.get(z);H.light=N}return z}function C(D,F,N,B,z){if(D.visible===!1)return;if(D.layers.test(F.layers)&&(D.isMesh||D.isLine||D.isPoints)&&(D.castShadow||D.receiveShadow&&z===nc)&&(!D.frustumCulled||n.intersectsObject(D))){D.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,D.matrixWorld);let Z=e.update(D),J=D.material;if(Array.isArray(J)){let j=Z.groups;for(let K=0,ee=j.length;K<ee;K++){let ae=j[K],ce=J[ae.materialIndex];if(ce&&ce.visible){let de=R(D,ce,B,z);D.onBeforeShadow(i,D,F,N,Z,de,ae),i.renderBufferDirect(N,null,Z,de,D,ae),D.onAfterShadow(i,D,F,N,Z,de,ae)}}}else if(J.visible){let j=R(D,J,B,z);D.onBeforeShadow(i,D,F,N,Z,j,null),i.renderBufferDirect(N,null,Z,j,D,null),D.onAfterShadow(i,D,F,N,Z,j,null)}}let H=D.children;for(let Z=0,J=H.length;Z<J;Z++)C(H[Z],F,N,B,z)}function L(D){D.target.removeEventListener("dispose",L);for(let N in c){let B=c[N],z=D.target.uuid;z in B&&(B[z].dispose(),delete B[z])}}}function d0e(i,e){function t(){let xe=!1,bt=new gn,Ye=null,wt=new gn(0,0,0,0);return{setMask:function(Dt){Ye!==Dt&&!xe&&(i.colorMask(Dt,Dt,Dt,Dt),Ye=Dt)},setLocked:function(Dt){xe=Dt},setClear:function(Dt,ct,Ce,jt,Hi){Hi===!0&&(Dt*=jt,ct*=jt,Ce*=jt),bt.set(Dt,ct,Ce,jt),wt.equals(bt)===!1&&(i.clearColor(Dt,ct,Ce,jt),wt.copy(bt))},reset:function(){xe=!1,Ye=null,wt.set(-1,0,0,0)}}}function n(){let xe=!1,bt=!1,Ye=null,wt=null,Dt=null;return{setReversed:function(ct){if(bt!==ct){let Ce=e.get("EXT_clip_control");ct?Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.ZERO_TO_ONE_EXT):Ce.clipControlEXT(Ce.LOWER_LEFT_EXT,Ce.NEGATIVE_ONE_TO_ONE_EXT),bt=ct;let jt=Dt;Dt=null,this.setClear(jt)}},getReversed:function(){return bt},setTest:function(ct){ct?$e(i.DEPTH_TEST):Et(i.DEPTH_TEST)},setMask:function(ct){Ye!==ct&&!xe&&(i.depthMask(ct),Ye=ct)},setFunc:function(ct){if(bt&&(ct=C2[ct]),wt!==ct){switch(ct){case pA:i.depthFunc(i.NEVER);break;case AA:i.depthFunc(i.ALWAYS);break;case mA:i.depthFunc(i.LESS);break;case Gu:i.depthFunc(i.LEQUAL);break;case gA:i.depthFunc(i.EQUAL);break;case _A:i.depthFunc(i.GEQUAL);break;case xA:i.depthFunc(i.GREATER);break;case yA:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}wt=ct}},setLocked:function(ct){xe=ct},setClear:function(ct){Dt!==ct&&(Dt=ct,bt&&(ct=1-ct),i.clearDepth(ct))},reset:function(){xe=!1,Ye=null,wt=null,Dt=null,bt=!1}}}function r(){let xe=!1,bt=null,Ye=null,wt=null,Dt=null,ct=null,Ce=null,jt=null,Hi=null;return{setTest:function(Nn){xe||(Nn?$e(i.STENCIL_TEST):Et(i.STENCIL_TEST))},setMask:function(Nn){bt!==Nn&&!xe&&(i.stencilMask(Nn),bt=Nn)},setFunc:function(Nn,zr,gr){(Ye!==Nn||wt!==zr||Dt!==gr)&&(i.stencilFunc(Nn,zr,gr),Ye=Nn,wt=zr,Dt=gr)},setOp:function(Nn,zr,gr){(ct!==Nn||Ce!==zr||jt!==gr)&&(i.stencilOp(Nn,zr,gr),ct=Nn,Ce=zr,jt=gr)},setLocked:function(Nn){xe=Nn},setClear:function(Nn){Hi!==Nn&&(i.clearStencil(Nn),Hi=Nn)},reset:function(){xe=!1,bt=null,Ye=null,wt=null,Dt=null,ct=null,Ce=null,jt=null,Hi=null}}}let s=new t,o=new n,a=new r,l=new WeakMap,c=new WeakMap,u={},f={},p={},x=new WeakMap,v=[],w=null,S=!1,T=null,P=null,R=null,C=null,L=null,D=null,F=null,N=new Ut(0,0,0),B=0,z=!1,V=null,H=null,Z=null,J=null,j=null,K=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),ee=!1,ae=0,ce=i.getParameter(i.VERSION);ce.indexOf("WebGL")!==-1?(ae=parseFloat(/^WebGL (\d)/.exec(ce)[1]),ee=ae>=1):ce.indexOf("OpenGL ES")!==-1&&(ae=parseFloat(/^OpenGL ES (\d)/.exec(ce)[1]),ee=ae>=2);let de=null,ve={},Ie=i.getParameter(i.SCISSOR_BOX),Qe=i.getParameter(i.VIEWPORT),Ue=new gn().fromArray(Ie),mt=new gn().fromArray(Qe);function Me(xe,bt,Ye,wt){let Dt=new Uint8Array(4),ct=i.createTexture();i.bindTexture(xe,ct),i.texParameteri(xe,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(xe,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Ce=0;Ce<Ye;Ce++)xe===i.TEXTURE_3D||xe===i.TEXTURE_2D_ARRAY?i.texImage3D(bt,0,i.RGBA,1,1,wt,0,i.RGBA,i.UNSIGNED_BYTE,Dt):i.texImage2D(bt+Ce,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,Dt);return ct}let ze={};ze[i.TEXTURE_2D]=Me(i.TEXTURE_2D,i.TEXTURE_2D,1),ze[i.TEXTURE_CUBE_MAP]=Me(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),ze[i.TEXTURE_2D_ARRAY]=Me(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),ze[i.TEXTURE_3D]=Me(i.TEXTURE_3D,i.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),$e(i.DEPTH_TEST),o.setFunc(Gu),vt(!1),yt(n2),$e(i.CULL_FACE),st(Yr);function $e(xe){u[xe]!==!0&&(i.enable(xe),u[xe]=!0)}function Et(xe){u[xe]!==!1&&(i.disable(xe),u[xe]=!1)}function Tt(xe,bt){return p[xe]!==bt?(i.bindFramebuffer(xe,bt),p[xe]=bt,xe===i.DRAW_FRAMEBUFFER&&(p[i.FRAMEBUFFER]=bt),xe===i.FRAMEBUFFER&&(p[i.DRAW_FRAMEBUFFER]=bt),!0):!1}function Ct(xe,bt){let Ye=v,wt=!1;if(xe){Ye=x.get(bt),Ye===void 0&&(Ye=[],x.set(bt,Ye));let Dt=xe.textures;if(Ye.length!==Dt.length||Ye[0]!==i.COLOR_ATTACHMENT0){for(let ct=0,Ce=Dt.length;ct<Ce;ct++)Ye[ct]=i.COLOR_ATTACHMENT0+ct;Ye.length=Dt.length,wt=!0}}else Ye[0]!==i.BACK&&(Ye[0]=i.BACK,wt=!0);wt&&i.drawBuffers(Ye)}function un(xe){return w!==xe?(i.useProgram(xe),w=xe,!0):!1}let Gt={[Gs]:i.FUNC_ADD,[r2]:i.FUNC_SUBTRACT,[s2]:i.FUNC_REVERSE_SUBTRACT};Gt[KT]=i.MIN,Gt[QT]=i.MAX;let Xe={[jc]:i.ZERO,[o2]:i.ONE,[a2]:i.SRC_COLOR,[Xd]:i.SRC_ALPHA,[d2]:i.SRC_ALPHA_SATURATE,[h2]:i.DST_COLOR,[c2]:i.DST_ALPHA,[l2]:i.ONE_MINUS_SRC_COLOR,[$d]:i.ONE_MINUS_SRC_ALPHA,[f2]:i.ONE_MINUS_DST_COLOR,[u2]:i.ONE_MINUS_DST_ALPHA,[nW]:i.CONSTANT_COLOR,[iW]:i.ONE_MINUS_CONSTANT_COLOR,[rW]:i.CONSTANT_ALPHA,[sW]:i.ONE_MINUS_CONSTANT_ALPHA};function st(xe,bt,Ye,wt,Dt,ct,Ce,jt,Hi,Nn){if(xe===Yr){S===!0&&(Et(i.BLEND),S=!1);return}if(S===!1&&($e(i.BLEND),S=!0),xe!==Bf){if(xe!==T||Nn!==z){if((P!==Gs||L!==Gs)&&(i.blendEquation(i.FUNC_ADD),P=Gs,L=Gs),Nn)switch(xe){case os:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Wu:i.blendFunc(i.ONE,i.ONE);break;case ju:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Xu:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:Ge("WebGLState: Invalid blending: ",xe);break}else switch(xe){case os:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Wu:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case ju:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Xu:Ge("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ge("WebGLState: Invalid blending: ",xe);break}R=null,C=null,D=null,F=null,N.set(0,0,0),B=0,T=xe,z=Nn}return}Dt=Dt||bt,ct=ct||Ye,Ce=Ce||wt,(bt!==P||Dt!==L)&&(i.blendEquationSeparate(Gt[bt],Gt[Dt]),P=bt,L=Dt),(Ye!==R||wt!==C||ct!==D||Ce!==F)&&(i.blendFuncSeparate(Xe[Ye],Xe[wt],Xe[ct],Xe[Ce]),R=Ye,C=wt,D=ct,F=Ce),(jt.equals(N)===!1||Hi!==B)&&(i.blendColor(jt.r,jt.g,jt.b,Hi),N.copy(jt),B=Hi),T=xe,z=!1}function tt(xe,bt){xe.side===rr?Et(i.CULL_FACE):$e(i.CULL_FACE);let Ye=xe.side===hi;bt&&(Ye=!Ye),vt(Ye),xe.blending===os&&xe.transparent===!1?st(Yr):st(xe.blending,xe.blendEquation,xe.blendSrc,xe.blendDst,xe.blendEquationAlpha,xe.blendSrcAlpha,xe.blendDstAlpha,xe.blendColor,xe.blendAlpha,xe.premultipliedAlpha),o.setFunc(xe.depthFunc),o.setTest(xe.depthTest),o.setMask(xe.depthWrite),s.setMask(xe.colorWrite);let wt=xe.stencilWrite;a.setTest(wt),wt&&(a.setMask(xe.stencilWriteMask),a.setFunc(xe.stencilFunc,xe.stencilRef,xe.stencilFuncMask),a.setOp(xe.stencilFail,xe.stencilZFail,xe.stencilZPass)),Kt(xe.polygonOffset,xe.polygonOffsetFactor,xe.polygonOffsetUnits),xe.alphaToCoverage===!0?$e(i.SAMPLE_ALPHA_TO_COVERAGE):Et(i.SAMPLE_ALPHA_TO_COVERAGE)}function vt(xe){V!==xe&&(xe?i.frontFace(i.CW):i.frontFace(i.CCW),V=xe)}function yt(xe){xe!==$T?($e(i.CULL_FACE),xe!==H&&(xe===n2?i.cullFace(i.BACK):xe===YT?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):Et(i.CULL_FACE),H=xe}function ln(xe){xe!==Z&&(ee&&i.lineWidth(xe),Z=xe)}function Kt(xe,bt,Ye){xe?($e(i.POLYGON_OFFSET_FILL),(J!==bt||j!==Ye)&&(J=bt,j=Ye,o.getReversed()&&(bt=-bt),i.polygonOffset(bt,Ye))):Et(i.POLYGON_OFFSET_FILL)}function Qt(xe){xe?$e(i.SCISSOR_TEST):Et(i.SCISSOR_TEST)}function xn(xe){xe===void 0&&(xe=i.TEXTURE0+K-1),de!==xe&&(i.activeTexture(xe),de=xe)}function ge(xe,bt,Ye){Ye===void 0&&(de===null?Ye=i.TEXTURE0+K-1:Ye=de);let wt=ve[Ye];wt===void 0&&(wt={type:void 0,texture:void 0},ve[Ye]=wt),(wt.type!==xe||wt.texture!==bt)&&(de!==Ye&&(i.activeTexture(Ye),de=Ye),i.bindTexture(xe,bt||ze[xe]),wt.type=xe,wt.texture=bt)}function pi(){let xe=ve[de];xe!==void 0&&xe.type!==void 0&&(i.bindTexture(xe.type,null),xe.type=void 0,xe.texture=void 0)}function Bn(){try{i.compressedTexImage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function le(){try{i.compressedTexImage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function X(){try{i.texSubImage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Te(){try{i.texSubImage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Pe(){try{i.compressedTexSubImage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Ve(){try{i.compressedTexSubImage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function gt(){try{i.texStorage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function St(){try{i.texStorage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function qe(){try{i.texImage2D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Ke(){try{i.texImage3D(...arguments)}catch(xe){Ge("WebGLState:",xe)}}function Rt(xe){return f[xe]!==void 0?f[xe]:i.getParameter(xe)}function en(xe,bt){f[xe]!==bt&&(i.pixelStorei(xe,bt),f[xe]=bt)}function Pt(xe){Ue.equals(xe)===!1&&(i.scissor(xe.x,xe.y,xe.z,xe.w),Ue.copy(xe))}function Mt(xe){mt.equals(xe)===!1&&(i.viewport(xe.x,xe.y,xe.z,xe.w),mt.copy(xe))}function cn(xe,bt){let Ye=c.get(bt);Ye===void 0&&(Ye=new WeakMap,c.set(bt,Ye));let wt=Ye.get(xe);wt===void 0&&(wt=i.getUniformBlockIndex(bt,xe.name),Ye.set(xe,wt))}function yn(xe,bt){let wt=c.get(bt).get(xe);l.get(bt)!==wt&&(i.uniformBlockBinding(bt,wt,xe.__bindingPointIndex),l.set(bt,wt))}function Pn(){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={},de=null,ve={},p={},x=new WeakMap,v=[],w=null,S=!1,T=null,P=null,R=null,C=null,L=null,D=null,F=null,N=new Ut(0,0,0),B=0,z=!1,V=null,H=null,Z=null,J=null,j=null,Ue.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:$e,disable:Et,bindFramebuffer:Tt,drawBuffers:Ct,useProgram:un,setBlending:st,setMaterial:tt,setFlipSided:vt,setCullFace:yt,setLineWidth:ln,setPolygonOffset:Kt,setScissorTest:Qt,activeTexture:xn,bindTexture:ge,unbindTexture:pi,compressedTexImage2D:Bn,compressedTexImage3D:le,texImage2D:qe,texImage3D:Ke,pixelStorei:en,getParameter:Rt,updateUBOMapping:cn,uniformBlockBinding:yn,texStorage2D:gt,texStorage3D:St,texSubImage2D:X,texSubImage3D:Te,compressedTexSubImage2D:Pe,compressedTexSubImage3D:Ve,scissor:Pt,viewport:Mt,reset:Pn}}function p0e(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,p,x=new WeakMap,v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(le,X){return v?new OffscreenCanvas(le,X):p_("canvas")}function S(le,X,Te){let Pe=1,Ve=Bn(le);if((Ve.width>Te||Ve.height>Te)&&(Pe=Te/Math.max(Ve.width,Ve.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 gt=Math.floor(Pe*Ve.width),St=Math.floor(Pe*Ve.height);p===void 0&&(p=w(gt,St));let qe=X?w(gt,St):p;return qe.width=gt,qe.height=St,qe.getContext("2d").drawImage(le,0,0,gt,St),je("WebGLRenderer: Texture has been resized from ("+Ve.width+"x"+Ve.height+") to ("+gt+"x"+St+")."),qe}else return"data"in le&&je("WebGLRenderer: Image in DataTexture is too big ("+Ve.width+"x"+Ve.height+")."),le;return le}function T(le){return le.generateMipmaps}function P(le){i.generateMipmap(le)}function R(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 C(le,X,Te,Pe,Ve,gt=!1){if(le!==null){if(i[le]!==void 0)return i[le];je("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+le+"'")}let St;Pe&&(St=e.get("EXT_texture_norm16"),St||je("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let qe=X;if(X===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&&St&&(qe=St.R16_EXT),Te===i.SHORT&&St&&(qe=St.R16_SNORM_EXT)),X===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)),X===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&&St&&(qe=St.RG16_EXT),Te===i.SHORT&&St&&(qe=St.RG16_SNORM_EXT)),X===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)),X===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)),X===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)),X===i.RGB&&(Te===i.UNSIGNED_SHORT&&St&&(qe=St.RGB16_EXT),Te===i.SHORT&&St&&(qe=St.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)),X===i.RGBA){let Ke=gt?Zd:sn.getTransfer(Ve);Te===i.FLOAT&&(qe=i.RGBA32F),Te===i.HALF_FLOAT&&(qe=i.RGBA16F),Te===i.UNSIGNED_BYTE&&(qe=Ke===Bt?i.SRGB8_ALPHA8:i.RGBA8),Te===i.UNSIGNED_SHORT&&St&&(qe=St.RGBA16_EXT),Te===i.SHORT&&St&&(qe=St.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 L(le,X){let Te;return le?X===null||X===Ai||X===Vo?Te=i.DEPTH24_STENCIL8:X===Zi?Te=i.DEPTH32F_STENCIL8:X===Xa&&(Te=i.DEPTH24_STENCIL8,je("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):X===null||X===Ai||X===Vo?Te=i.DEPTH_COMPONENT24:X===Zi?Te=i.DEPTH_COMPONENT32F:X===Xa&&(Te=i.DEPTH_COMPONENT16),Te}function D(le,X){return T(le)===!0||le.isFramebufferTexture&&le.minFilter!==yi&&le.minFilter!==bi?Math.log2(Math.max(X.width,X.height))+1:le.mipmaps!==void 0&&le.mipmaps.length>0?le.mipmaps.length:le.isCompressedTexture&&Array.isArray(le.image)?X.mipmaps.length:1}function F(le){let X=le.target;X.removeEventListener("dispose",F),B(X),X.isVideoTexture&&u.delete(X),X.isHTMLTexture&&f.delete(X)}function N(le){let X=le.target;X.removeEventListener("dispose",N),V(X)}function B(le){let X=n.get(le);if(X.__webglInit===void 0)return;let Te=le.source,Pe=x.get(Te);if(Pe){let Ve=Pe[X.__cacheKey];Ve.usedTimes--,Ve.usedTimes===0&&z(le),Object.keys(Pe).length===0&&x.delete(Te)}n.remove(le)}function z(le){let X=n.get(le);i.deleteTexture(X.__webglTexture);let Te=le.source,Pe=x.get(Te);delete Pe[X.__cacheKey],o.memory.textures--}function V(le){let X=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(X.__webglFramebuffer[Pe]))for(let Ve=0;Ve<X.__webglFramebuffer[Pe].length;Ve++)i.deleteFramebuffer(X.__webglFramebuffer[Pe][Ve]);else i.deleteFramebuffer(X.__webglFramebuffer[Pe]);X.__webglDepthbuffer&&i.deleteRenderbuffer(X.__webglDepthbuffer[Pe])}else{if(Array.isArray(X.__webglFramebuffer))for(let Pe=0;Pe<X.__webglFramebuffer.length;Pe++)i.deleteFramebuffer(X.__webglFramebuffer[Pe]);else i.deleteFramebuffer(X.__webglFramebuffer);if(X.__webglDepthbuffer&&i.deleteRenderbuffer(X.__webglDepthbuffer),X.__webglMultisampledFramebuffer&&i.deleteFramebuffer(X.__webglMultisampledFramebuffer),X.__webglColorRenderbuffer)for(let Pe=0;Pe<X.__webglColorRenderbuffer.length;Pe++)X.__webglColorRenderbuffer[Pe]&&i.deleteRenderbuffer(X.__webglColorRenderbuffer[Pe]);X.__webglDepthRenderbuffer&&i.deleteRenderbuffer(X.__webglDepthRenderbuffer)}let Te=le.textures;for(let Pe=0,Ve=Te.length;Pe<Ve;Pe++){let gt=n.get(Te[Pe]);gt.__webglTexture&&(i.deleteTexture(gt.__webglTexture),o.memory.textures--),n.remove(Te[Pe])}n.remove(le)}let H=0;function Z(){H=0}function J(){return H}function j(le){H=le}function K(){let le=H;return le>=r.maxTextures&&je("WebGLTextures: Trying to use "+le+" texture units while this GPU supports only "+r.maxTextures),H+=1,le}function ee(le){let X=[];return X.push(le.wrapS),X.push(le.wrapT),X.push(le.wrapR||0),X.push(le.magFilter),X.push(le.minFilter),X.push(le.anisotropy),X.push(le.internalFormat),X.push(le.format),X.push(le.type),X.push(le.generateMipmaps),X.push(le.premultiplyAlpha),X.push(le.flipY),X.push(le.unpackAlignment),X.push(le.colorSpace),X.join()}function ae(le,X){let Te=n.get(le);if(le.isVideoTexture&&ge(le),le.isRenderTargetTexture===!1&&le.isExternalTexture!==!0&&le.version>0&&Te.__version!==le.version){let Pe=le.image;if(Pe===null)je("WebGLRenderer: Texture marked for update but no image data found.");else if(Pe.complete===!1)je("WebGLRenderer: Texture marked for update but image is incomplete");else{Et(Te,le,X);return}}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,Te.__webglTexture,i.TEXTURE0+X)}function ce(le,X){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Et(Te,le,X);return}else le.isExternalTexture&&(Te.__webglTexture=le.sourceTexture?le.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,Te.__webglTexture,i.TEXTURE0+X)}function de(le,X){let Te=n.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Te.__version!==le.version){Et(Te,le,X);return}t.bindTexture(i.TEXTURE_3D,Te.__webglTexture,i.TEXTURE0+X)}function ve(le,X){let Te=n.get(le);if(le.isCubeDepthTexture!==!0&&le.version>0&&Te.__version!==le.version){Tt(Te,le,X);return}t.bindTexture(i.TEXTURE_CUBE_MAP,Te.__webglTexture,i.TEXTURE0+X)}let Ie={[Rf]:i.REPEAT,[Go]:i.CLAMP_TO_EDGE,[Pf]:i.MIRRORED_REPEAT},Qe={[yi]:i.NEAREST,[v2]:i.NEAREST_MIPMAP_NEAREST,[rc]:i.NEAREST_MIPMAP_LINEAR,[bi]:i.LINEAR,[cp]:i.LINEAR_MIPMAP_NEAREST,[xo]:i.LINEAR_MIPMAP_LINEAR},Ue={[S2]:i.NEVER,[M2]:i.ALWAYS,[I_]:i.LESS,[sh]:i.LEQUAL,[T2]:i.EQUAL,[Xc]:i.GEQUAL,[jA]:i.GREATER,[E2]:i.NOTEQUAL};function mt(le,X){if(X.type===Zi&&e.has("OES_texture_float_linear")===!1&&(X.magFilter===bi||X.magFilter===cp||X.magFilter===rc||X.magFilter===xo||X.minFilter===bi||X.minFilter===cp||X.minFilter===rc||X.minFilter===xo)&&je("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,Ie[X.wrapS]),i.texParameteri(le,i.TEXTURE_WRAP_T,Ie[X.wrapT]),(le===i.TEXTURE_3D||le===i.TEXTURE_2D_ARRAY)&&i.texParameteri(le,i.TEXTURE_WRAP_R,Ie[X.wrapR]),i.texParameteri(le,i.TEXTURE_MAG_FILTER,Qe[X.magFilter]),i.texParameteri(le,i.TEXTURE_MIN_FILTER,Qe[X.minFilter]),X.compareFunction&&(i.texParameteri(le,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(le,i.TEXTURE_COMPARE_FUNC,Ue[X.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(X.magFilter===yi||X.minFilter!==rc&&X.minFilter!==xo||X.type===Zi&&e.has("OES_texture_float_linear")===!1)return;if(X.anisotropy>1||n.get(X).__currentAnisotropy){let Te=e.get("EXT_texture_filter_anisotropic");i.texParameterf(le,Te.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(X.anisotropy,r.getMaxAnisotropy())),n.get(X).__currentAnisotropy=X.anisotropy}}}function Me(le,X){let Te=!1;le.__webglInit===void 0&&(le.__webglInit=!0,X.addEventListener("dispose",F));let Pe=X.source,Ve=x.get(Pe);Ve===void 0&&(Ve={},x.set(Pe,Ve));let gt=ee(X);if(gt!==le.__cacheKey){Ve[gt]===void 0&&(Ve[gt]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,Te=!0),Ve[gt].usedTimes++;let St=Ve[le.__cacheKey];St!==void 0&&(Ve[le.__cacheKey].usedTimes--,St.usedTimes===0&&z(X)),le.__cacheKey=gt,le.__webglTexture=Ve[gt].texture}return Te}function ze(le,X,Te){return Math.floor(Math.floor(le/Te)/X)}function $e(le,X,Te,Pe){let gt=le.updateRanges;if(gt.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,X.width,X.height,Te,Pe,X.data);else{gt.sort((en,Pt)=>en.start-Pt.start);let St=0;for(let en=1;en<gt.length;en++){let Pt=gt[St],Mt=gt[en],cn=Pt.start+Pt.count,yn=ze(Mt.start,X.width,4),Pn=ze(Pt.start,X.width,4);Mt.start<=cn+1&&yn===Pn&&ze(Mt.start+Mt.count-1,X.width,4)===yn?Pt.count=Math.max(Pt.count,Mt.start+Mt.count-Pt.start):(++St,gt[St]=Mt)}gt.length=St+1;let qe=t.getParameter(i.UNPACK_ROW_LENGTH),Ke=t.getParameter(i.UNPACK_SKIP_PIXELS),Rt=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,X.width);for(let en=0,Pt=gt.length;en<Pt;en++){let Mt=gt[en],cn=Math.floor(Mt.start/4),yn=Math.ceil(Mt.count/4),Pn=cn%X.width,xe=Math.floor(cn/X.width),bt=yn,Ye=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Pn),t.pixelStorei(i.UNPACK_SKIP_ROWS,xe),t.texSubImage2D(i.TEXTURE_2D,0,Pn,xe,bt,Ye,Te,Pe,X.data)}le.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,qe),t.pixelStorei(i.UNPACK_SKIP_PIXELS,Ke),t.pixelStorei(i.UNPACK_SKIP_ROWS,Rt)}}function Et(le,X,Te){let Pe=i.TEXTURE_2D;(X.isDataArrayTexture||X.isCompressedArrayTexture)&&(Pe=i.TEXTURE_2D_ARRAY),X.isData3DTexture&&(Pe=i.TEXTURE_3D);let Ve=Me(le,X),gt=X.source;t.bindTexture(Pe,le.__webglTexture,i.TEXTURE0+Te);let St=n.get(gt);if(gt.version!==St.__version||Ve===!0){if(t.activeTexture(i.TEXTURE0+Te),(typeof ImageBitmap<"u"&&X.image instanceof ImageBitmap)===!1){let Ye=sn.getPrimaries(sn.workingColorSpace),wt=X.colorSpace===qo?null:sn.getPrimaries(X.colorSpace),Dt=X.colorSpace===qo||Ye===wt?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,X.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Dt)}t.pixelStorei(i.UNPACK_ALIGNMENT,X.unpackAlignment);let Ke=S(X.image,!1,r.maxTextureSize);Ke=pi(X,Ke);let Rt=s.convert(X.format,X.colorSpace),en=s.convert(X.type),Pt=C(X.internalFormat,Rt,en,X.normalized,X.colorSpace,X.isVideoTexture);mt(Pe,X);let Mt,cn=X.mipmaps,yn=X.isVideoTexture!==!0,Pn=St.__version===void 0||Ve===!0,xe=gt.dataReady,bt=D(X,Ke);if(X.isDepthTexture)Pt=L(X.format===eo,X.type),Pn&&(yn?t.texStorage2D(i.TEXTURE_2D,1,Pt,Ke.width,Ke.height):t.texImage2D(i.TEXTURE_2D,0,Pt,Ke.width,Ke.height,0,Rt,en,null));else if(X.isDataTexture)if(cn.length>0){yn&&Pn&&t.texStorage2D(i.TEXTURE_2D,bt,Pt,cn[0].width,cn[0].height);for(let Ye=0,wt=cn.length;Ye<wt;Ye++)Mt=cn[Ye],yn?xe&&t.texSubImage2D(i.TEXTURE_2D,Ye,0,0,Mt.width,Mt.height,Rt,en,Mt.data):t.texImage2D(i.TEXTURE_2D,Ye,Pt,Mt.width,Mt.height,0,Rt,en,Mt.data);X.generateMipmaps=!1}else yn?(Pn&&t.texStorage2D(i.TEXTURE_2D,bt,Pt,Ke.width,Ke.height),xe&&$e(X,Ke,Rt,en)):t.texImage2D(i.TEXTURE_2D,0,Pt,Ke.width,Ke.height,0,Rt,en,Ke.data);else if(X.isCompressedTexture)if(X.isCompressedArrayTexture){yn&&Pn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,bt,Pt,cn[0].width,cn[0].height,Ke.depth);for(let Ye=0,wt=cn.length;Ye<wt;Ye++)if(Mt=cn[Ye],X.format!==br)if(Rt!==null)if(yn){if(xe)if(X.layerUpdates.size>0){let Dt=R2(Mt.width,Mt.height,X.format,X.type);for(let ct of X.layerUpdates){let Ce=Mt.data.subarray(ct*Dt/Mt.data.BYTES_PER_ELEMENT,(ct+1)*Dt/Mt.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ye,0,0,ct,Mt.width,Mt.height,1,Rt,Ce)}X.clearLayerUpdates()}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,Ye,0,0,0,Mt.width,Mt.height,Ke.depth,Rt,Mt.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,Ye,Pt,Mt.width,Mt.height,Ke.depth,0,Mt.data,0,0);else je("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else yn?xe&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,Ye,0,0,0,Mt.width,Mt.height,Ke.depth,Rt,en,Mt.data):t.texImage3D(i.TEXTURE_2D_ARRAY,Ye,Pt,Mt.width,Mt.height,Ke.depth,0,Rt,en,Mt.data)}else{yn&&Pn&&t.texStorage2D(i.TEXTURE_2D,bt,Pt,cn[0].width,cn[0].height);for(let Ye=0,wt=cn.length;Ye<wt;Ye++)Mt=cn[Ye],X.format!==br?Rt!==null?yn?xe&&t.compressedTexSubImage2D(i.TEXTURE_2D,Ye,0,0,Mt.width,Mt.height,Rt,Mt.data):t.compressedTexImage2D(i.TEXTURE_2D,Ye,Pt,Mt.width,Mt.height,0,Mt.data):je("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):yn?xe&&t.texSubImage2D(i.TEXTURE_2D,Ye,0,0,Mt.width,Mt.height,Rt,en,Mt.data):t.texImage2D(i.TEXTURE_2D,Ye,Pt,Mt.width,Mt.height,0,Rt,en,Mt.data)}else if(X.isDataArrayTexture)if(yn){if(Pn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,bt,Pt,Ke.width,Ke.height,Ke.depth),xe)if(X.layerUpdates.size>0){let Ye=R2(Ke.width,Ke.height,X.format,X.type);for(let wt of X.layerUpdates){let Dt=Ke.data.subarray(wt*Ye/Ke.data.BYTES_PER_ELEMENT,(wt+1)*Ye/Ke.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,wt,Ke.width,Ke.height,1,Rt,en,Dt)}X.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,Ke.width,Ke.height,Ke.depth,Rt,en,Ke.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,Pt,Ke.width,Ke.height,Ke.depth,0,Rt,en,Ke.data);else if(X.isData3DTexture)yn?(Pn&&t.texStorage3D(i.TEXTURE_3D,bt,Pt,Ke.width,Ke.height,Ke.depth),xe&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,Ke.width,Ke.height,Ke.depth,Rt,en,Ke.data)):t.texImage3D(i.TEXTURE_3D,0,Pt,Ke.width,Ke.height,Ke.depth,0,Rt,en,Ke.data);else if(X.isFramebufferTexture){if(Pn)if(yn)t.texStorage2D(i.TEXTURE_2D,bt,Pt,Ke.width,Ke.height);else{let Ye=Ke.width,wt=Ke.height;for(let Dt=0;Dt<bt;Dt++)t.texImage2D(i.TEXTURE_2D,Dt,Pt,Ye,wt,0,Rt,en,null),Ye>>=1,wt>>=1}}else if(X.isHTMLTexture){if("texElementImage2D"in i){let Ye=i.canvas;if(Ye.hasAttribute("layoutsubtree")||Ye.setAttribute("layoutsubtree","true"),Ke.parentNode!==Ye){Ye.appendChild(Ke),f.add(X),Ye.onpaint=wt=>{let Dt=wt.changedElements;for(let ct of f)Dt.includes(ct.image)&&(ct.needsUpdate=!0)},Ye.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,Ke);else{let Dt=i.RGBA,ct=i.RGBA,Ce=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,Dt,ct,Ce,Ke)}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(cn.length>0){if(yn&&Pn){let Ye=Bn(cn[0]);t.texStorage2D(i.TEXTURE_2D,bt,Pt,Ye.width,Ye.height)}for(let Ye=0,wt=cn.length;Ye<wt;Ye++)Mt=cn[Ye],yn?xe&&t.texSubImage2D(i.TEXTURE_2D,Ye,0,0,Rt,en,Mt):t.texImage2D(i.TEXTURE_2D,Ye,Pt,Rt,en,Mt);X.generateMipmaps=!1}else if(yn){if(Pn){let Ye=Bn(Ke);t.texStorage2D(i.TEXTURE_2D,bt,Pt,Ye.width,Ye.height)}xe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Rt,en,Ke)}else t.texImage2D(i.TEXTURE_2D,0,Pt,Rt,en,Ke);T(X)&&P(Pe),St.__version=gt.version,X.onUpdate&&X.onUpdate(X)}le.__version=X.version}function Tt(le,X,Te){if(X.image.length!==6)return;let Pe=Me(le,X),Ve=X.source;t.bindTexture(i.TEXTURE_CUBE_MAP,le.__webglTexture,i.TEXTURE0+Te);let gt=n.get(Ve);if(Ve.version!==gt.__version||Pe===!0){t.activeTexture(i.TEXTURE0+Te);let St=sn.getPrimaries(sn.workingColorSpace),qe=X.colorSpace===qo?null:sn.getPrimaries(X.colorSpace),Ke=X.colorSpace===qo||St===qe?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,X.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,X.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,X.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ke);let Rt=X.isCompressedTexture||X.image[0].isCompressedTexture,en=X.image[0]&&X.image[0].isDataTexture,Pt=[];for(let ct=0;ct<6;ct++)!Rt&&!en?Pt[ct]=S(X.image[ct],!0,r.maxCubemapSize):Pt[ct]=en?X.image[ct].image:X.image[ct],Pt[ct]=pi(X,Pt[ct]);let Mt=Pt[0],cn=s.convert(X.format,X.colorSpace),yn=s.convert(X.type),Pn=C(X.internalFormat,cn,yn,X.normalized,X.colorSpace),xe=X.isVideoTexture!==!0,bt=gt.__version===void 0||Pe===!0,Ye=Ve.dataReady,wt=D(X,Mt);mt(i.TEXTURE_CUBE_MAP,X);let Dt;if(Rt){xe&&bt&&t.texStorage2D(i.TEXTURE_CUBE_MAP,wt,Pn,Mt.width,Mt.height);for(let ct=0;ct<6;ct++){Dt=Pt[ct].mipmaps;for(let Ce=0;Ce<Dt.length;Ce++){let jt=Dt[Ce];X.format!==br?cn!==null?xe?Ye&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce,0,0,jt.width,jt.height,cn,jt.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce,Pn,jt.width,jt.height,0,jt.data):je("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce,0,0,jt.width,jt.height,cn,yn,jt.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce,Pn,jt.width,jt.height,0,cn,yn,jt.data)}}}else{if(Dt=X.mipmaps,xe&&bt){Dt.length>0&&wt++;let ct=Bn(Pt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,wt,Pn,ct.width,ct.height)}for(let ct=0;ct<6;ct++)if(en){xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,0,0,Pt[ct].width,Pt[ct].height,cn,yn,Pt[ct].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,Pn,Pt[ct].width,Pt[ct].height,0,cn,yn,Pt[ct].data);for(let Ce=0;Ce<Dt.length;Ce++){let Hi=Dt[Ce].image[ct].image;xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,0,0,Hi.width,Hi.height,cn,yn,Hi.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,Pn,Hi.width,Hi.height,0,cn,yn,Hi.data)}}else{xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,0,0,cn,yn,Pt[ct]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,0,Pn,cn,yn,Pt[ct]);for(let Ce=0;Ce<Dt.length;Ce++){let jt=Dt[Ce];xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,0,0,cn,yn,jt.image[ct]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,Pn,cn,yn,jt.image[ct])}}}T(X)&&P(i.TEXTURE_CUBE_MAP),gt.__version=Ve.version,X.onUpdate&&X.onUpdate(X)}le.__version=X.version}function Ct(le,X,Te,Pe,Ve,gt){let St=s.convert(Te.format,Te.colorSpace),qe=s.convert(Te.type),Ke=C(Te.internalFormat,St,qe,Te.normalized,Te.colorSpace),Rt=n.get(X),en=n.get(Te);if(en.__renderTarget=X,!Rt.__hasExternalTextures){let Pt=Math.max(1,X.width>>gt),Mt=Math.max(1,X.height>>gt);Ve===i.TEXTURE_3D||Ve===i.TEXTURE_2D_ARRAY?t.texImage3D(Ve,gt,Ke,Pt,Mt,X.depth,0,St,qe,null):t.texImage2D(Ve,gt,Ke,Pt,Mt,0,St,qe,null)}t.bindFramebuffer(i.FRAMEBUFFER,le),xn(X)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Pe,Ve,en.__webglTexture,0,Qt(X)):(Ve===i.TEXTURE_2D||Ve>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&Ve<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,Pe,Ve,en.__webglTexture,gt),t.bindFramebuffer(i.FRAMEBUFFER,null)}function un(le,X,Te){if(i.bindRenderbuffer(i.RENDERBUFFER,le),X.depthBuffer){let Pe=X.depthTexture,Ve=Pe&&Pe.isDepthTexture?Pe.type:null,gt=L(X.stencilBuffer,Ve),St=X.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;xn(X)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Qt(X),gt,X.width,X.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,Qt(X),gt,X.width,X.height):i.renderbufferStorage(i.RENDERBUFFER,gt,X.width,X.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,St,i.RENDERBUFFER,le)}else{let Pe=X.textures;for(let Ve=0;Ve<Pe.length;Ve++){let gt=Pe[Ve],St=s.convert(gt.format,gt.colorSpace),qe=s.convert(gt.type),Ke=C(gt.internalFormat,St,qe,gt.normalized,gt.colorSpace);xn(X)?a.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,Qt(X),Ke,X.width,X.height):Te?i.renderbufferStorageMultisample(i.RENDERBUFFER,Qt(X),Ke,X.width,X.height):i.renderbufferStorage(i.RENDERBUFFER,Ke,X.width,X.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function Gt(le,X,Te){let Pe=X.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,le),!(X.depthTexture&&X.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let Ve=n.get(X.depthTexture);if(Ve.__renderTarget=X,(!Ve.__webglTexture||X.depthTexture.image.width!==X.width||X.depthTexture.image.height!==X.height)&&(X.depthTexture.image.width=X.width,X.depthTexture.image.height=X.height,X.depthTexture.needsUpdate=!0),Pe){if(Ve.__webglInit===void 0&&(Ve.__webglInit=!0,X.depthTexture.addEventListener("dispose",F)),Ve.__webglTexture===void 0){Ve.__webglTexture=i.createTexture(),t.bindTexture(i.TEXTURE_CUBE_MAP,Ve.__webglTexture),mt(i.TEXTURE_CUBE_MAP,X.depthTexture);let Rt=s.convert(X.depthTexture.format),en=s.convert(X.depthTexture.type),Pt;X.depthTexture.format===ws?Pt=i.DEPTH_COMPONENT24:X.depthTexture.format===eo&&(Pt=i.DEPTH24_STENCIL8);for(let Mt=0;Mt<6;Mt++)i.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+Mt,0,Pt,X.width,X.height,0,Rt,en,null)}}else ae(X.depthTexture,0);let gt=Ve.__webglTexture,St=Qt(X),qe=Pe?i.TEXTURE_CUBE_MAP_POSITIVE_X+Te:i.TEXTURE_2D,Ke=X.depthTexture.format===eo?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(X.depthTexture.format===ws)xn(X)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Ke,qe,gt,0,St):i.framebufferTexture2D(i.FRAMEBUFFER,Ke,qe,gt,0);else if(X.depthTexture.format===eo)xn(X)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Ke,qe,gt,0,St):i.framebufferTexture2D(i.FRAMEBUFFER,Ke,qe,gt,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function Xe(le){let X=n.get(le),Te=le.isWebGLCubeRenderTarget===!0;if(X.__boundDepthTexture!==le.depthTexture){let Pe=le.depthTexture;if(X.__depthDisposeCallback&&X.__depthDisposeCallback(),Pe){let Ve=()=>{delete X.__boundDepthTexture,delete X.__depthDisposeCallback,Pe.removeEventListener("dispose",Ve)};Pe.addEventListener("dispose",Ve),X.__depthDisposeCallback=Ve}X.__boundDepthTexture=Pe}if(le.depthTexture&&!X.__autoAllocateDepthBuffer)if(Te)for(let Pe=0;Pe<6;Pe++)Gt(X.__webglFramebuffer[Pe],le,Pe);else{let Pe=le.texture.mipmaps;Pe&&Pe.length>0?Gt(X.__webglFramebuffer[0],le,0):Gt(X.__webglFramebuffer,le,0)}else if(Te){X.__webglDepthbuffer=[];for(let Pe=0;Pe<6;Pe++)if(t.bindFramebuffer(i.FRAMEBUFFER,X.__webglFramebuffer[Pe]),X.__webglDepthbuffer[Pe]===void 0)X.__webglDepthbuffer[Pe]=i.createRenderbuffer(),un(X.__webglDepthbuffer[Pe],le,!1);else{let Ve=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,gt=X.__webglDepthbuffer[Pe];i.bindRenderbuffer(i.RENDERBUFFER,gt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ve,i.RENDERBUFFER,gt)}}else{let Pe=le.texture.mipmaps;if(Pe&&Pe.length>0?t.bindFramebuffer(i.FRAMEBUFFER,X.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,X.__webglFramebuffer),X.__webglDepthbuffer===void 0)X.__webglDepthbuffer=i.createRenderbuffer(),un(X.__webglDepthbuffer,le,!1);else{let Ve=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,gt=X.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,gt),i.framebufferRenderbuffer(i.FRAMEBUFFER,Ve,i.RENDERBUFFER,gt)}}t.bindFramebuffer(i.FRAMEBUFFER,null)}function st(le,X,Te){let Pe=n.get(le);X!==void 0&&Ct(Pe.__webglFramebuffer,le,le.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),Te!==void 0&&Xe(le)}function tt(le){let X=le.texture,Te=n.get(le),Pe=n.get(X);le.addEventListener("dispose",N);let Ve=le.textures,gt=le.isWebGLCubeRenderTarget===!0,St=Ve.length>1;if(St||(Pe.__webglTexture===void 0&&(Pe.__webglTexture=i.createTexture()),Pe.__version=X.version,o.memory.textures++),gt){Te.__webglFramebuffer=[];for(let qe=0;qe<6;qe++)if(X.mipmaps&&X.mipmaps.length>0){Te.__webglFramebuffer[qe]=[];for(let Ke=0;Ke<X.mipmaps.length;Ke++)Te.__webglFramebuffer[qe][Ke]=i.createFramebuffer()}else Te.__webglFramebuffer[qe]=i.createFramebuffer()}else{if(X.mipmaps&&X.mipmaps.length>0){Te.__webglFramebuffer=[];for(let qe=0;qe<X.mipmaps.length;qe++)Te.__webglFramebuffer[qe]=i.createFramebuffer()}else Te.__webglFramebuffer=i.createFramebuffer();if(St)for(let qe=0,Ke=Ve.length;qe<Ke;qe++){let Rt=n.get(Ve[qe]);Rt.__webglTexture===void 0&&(Rt.__webglTexture=i.createTexture(),o.memory.textures++)}if(le.samples>0&&xn(le)===!1){Te.__webglMultisampledFramebuffer=i.createFramebuffer(),Te.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,Te.__webglMultisampledFramebuffer);for(let qe=0;qe<Ve.length;qe++){let Ke=Ve[qe];Te.__webglColorRenderbuffer[qe]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,Te.__webglColorRenderbuffer[qe]);let Rt=s.convert(Ke.format,Ke.colorSpace),en=s.convert(Ke.type),Pt=C(Ke.internalFormat,Rt,en,Ke.normalized,Ke.colorSpace,le.isXRRenderTarget===!0),Mt=Qt(le);i.renderbufferStorageMultisample(i.RENDERBUFFER,Mt,Pt,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(),un(Te.__webglDepthRenderbuffer,le,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(gt){t.bindTexture(i.TEXTURE_CUBE_MAP,Pe.__webglTexture),mt(i.TEXTURE_CUBE_MAP,X);for(let qe=0;qe<6;qe++)if(X.mipmaps&&X.mipmaps.length>0)for(let Ke=0;Ke<X.mipmaps.length;Ke++)Ct(Te.__webglFramebuffer[qe][Ke],le,X,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,Ke);else Ct(Te.__webglFramebuffer[qe],le,X,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+qe,0);T(X)&&P(i.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(St){for(let qe=0,Ke=Ve.length;qe<Ke;qe++){let Rt=Ve[qe],en=n.get(Rt),Pt=i.TEXTURE_2D;(le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(Pt=le.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(Pt,en.__webglTexture),mt(Pt,Rt),Ct(Te.__webglFramebuffer,le,Rt,i.COLOR_ATTACHMENT0+qe,Pt,0),T(Rt)&&P(Pt)}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,X),X.mipmaps&&X.mipmaps.length>0)for(let Ke=0;Ke<X.mipmaps.length;Ke++)Ct(Te.__webglFramebuffer[Ke],le,X,i.COLOR_ATTACHMENT0,qe,Ke);else Ct(Te.__webglFramebuffer,le,X,i.COLOR_ATTACHMENT0,qe,0);T(X)&&P(qe),t.unbindTexture()}le.depthBuffer&&Xe(le)}function vt(le){let X=le.textures;for(let Te=0,Pe=X.length;Te<Pe;Te++){let Ve=X[Te];if(T(Ve)){let gt=R(le),St=n.get(Ve).__webglTexture;t.bindTexture(gt,St),P(gt),t.unbindTexture()}}}let yt=[],ln=[];function Kt(le){if(le.samples>0){if(xn(le)===!1){let X=le.textures,Te=le.width,Pe=le.height,Ve=i.COLOR_BUFFER_BIT,gt=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,St=n.get(le),qe=X.length>1;if(qe)for(let Rt=0;Rt<X.length;Rt++)t.bindFramebuffer(i.FRAMEBUFFER,St.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Rt,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,St.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Rt,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,St.__webglMultisampledFramebuffer);let Ke=le.texture.mipmaps;Ke&&Ke.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,St.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,St.__webglFramebuffer);for(let Rt=0;Rt<X.length;Rt++){if(le.resolveDepthBuffer&&(le.depthBuffer&&(Ve|=i.DEPTH_BUFFER_BIT),le.stencilBuffer&&le.resolveStencilBuffer&&(Ve|=i.STENCIL_BUFFER_BIT)),qe){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,St.__webglColorRenderbuffer[Rt]);let en=n.get(X[Rt]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,en,0)}i.blitFramebuffer(0,0,Te,Pe,0,0,Te,Pe,Ve,i.NEAREST),l===!0&&(yt.length=0,ln.length=0,yt.push(i.COLOR_ATTACHMENT0+Rt),le.depthBuffer&&le.resolveDepthBuffer===!1&&(yt.push(gt),ln.push(gt),i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,ln)),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,yt))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),qe)for(let Rt=0;Rt<X.length;Rt++){t.bindFramebuffer(i.FRAMEBUFFER,St.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Rt,i.RENDERBUFFER,St.__webglColorRenderbuffer[Rt]);let en=n.get(X[Rt]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,St.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Rt,i.TEXTURE_2D,en,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,St.__webglMultisampledFramebuffer)}else if(le.depthBuffer&&le.resolveDepthBuffer===!1&&l){let X=le.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[X])}}}function Qt(le){return Math.min(r.maxSamples,le.samples)}function xn(le){let X=n.get(le);return le.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&X.__useRenderToTexture!==!1}function ge(le){let X=o.render.frame;u.get(le)!==X&&(u.set(le,X),le.update())}function pi(le,X){let Te=le.colorSpace,Pe=le.format,Ve=le.type;return le.isCompressedTexture===!0||le.isVideoTexture===!0||Te!==Yd&&Te!==qo&&(sn.getTransfer(Te)===Bt?(Pe!==br||Ve!==zi)&&je("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ge("WebGLTextures: Unsupported texture color space:",Te)),X}function Bn(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=K,this.resetTextureUnits=Z,this.getTextureUnits=J,this.setTextureUnits=j,this.setTexture2D=ae,this.setTexture2DArray=ce,this.setTexture3D=de,this.setTextureCube=ve,this.rebindTextures=st,this.setupRenderTarget=tt,this.updateRenderTargetMipmap=vt,this.updateMultisampleRenderTarget=Kt,this.setupDepthRenderbuffer=Xe,this.setupFrameBufferTexture=Ct,this.useMultisampledRTT=xn,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function A0e(i,e){function t(n,r=qo){let s,o=sn.getTransfer(r);if(n===zi)return i.UNSIGNED_BYTE;if(n===UA)return i.UNSIGNED_SHORT_4_4_4_4;if(n===kA)return i.UNSIGNED_SHORT_5_5_5_1;if(n===GA)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===zA)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Yu)return i.BYTE;if(n===Zu)return i.SHORT;if(n===Xa)return i.UNSIGNED_SHORT;if(n===Dr)return i.INT;if(n===Ai)return i.UNSIGNED_INT;if(n===Zi)return i.FLOAT;if(n===Di)return i.HALF_FLOAT;if(n===P_)return i.ALPHA;if(n===Uf)return i.RGB;if(n===br)return i.RGBA;if(n===ws)return i.DEPTH_COMPONENT;if(n===eo)return i.DEPTH_STENCIL;if(n===kf)return i.RED;if(n===Ku)return i.RED_INTEGER;if(n===Ms)return i.RG;if(n===Qu)return i.RG_INTEGER;if(n===up)return i.RGBA_INTEGER;if(n===Ju||n===eh||n===th||n===nh)if(o===Bt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Ju)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===eh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===th)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===nh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Ju)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===eh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===th)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===nh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===VA||n===qA||n===HA||n===WA)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===VA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===qA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===HA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===WA)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===hp||n===fp||n===dp||n===pp||n===Ap||n===ih||n===mp)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===hp||n===fp)return o===Bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===dp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===pp)return s.COMPRESSED_R11_EAC;if(n===Ap)return s.COMPRESSED_SIGNED_R11_EAC;if(n===ih)return s.COMPRESSED_RG11_EAC;if(n===mp)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===gp||n===_p||n===xp||n===yp||n===vp||n===bp||n===wp||n===Sp||n===Tp||n===Ep||n===Mp||n===Cp||n===Rp||n===Pp)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===gp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===_p)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===xp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===yp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===vp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===bp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===wp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Sp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Tp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Ep)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Cp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Rp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ip||n===Np||n===Lp)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Ip)return o===Bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Np)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Lp)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Dp||n===Fp||n===rh||n===Op)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Dp)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Fp)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===rh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Op)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Vo?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var m0e=`40934093 void main() {40944094 40954095 gl_Position = vec4( position, 1.0 );40964096 4097-}`,A0e=`4097+}`,g0e=`40984098 uniform sampler2DArray depthColor;40994099 uniform float depthWidth;41004100 uniform float depthHeight;
@@ -4113,23 +4113,23 @@ void main() {
41134113 41144114 }41154115 4116-}`,XL=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new Ty(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 $r({vertexShader:p0e,fragmentShader:A0e,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Gn(new RA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},$L=class extends zo{constructor(e,t){super();let n=this,r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,p=null,x=null,v=null,w=typeof XRWebGLBinding<"u",S=new XL,T={},P=t.getContextAttributes(),R=null,C=null,L=[],D=[],F=new Oe,N=null,B=new Ir;B.viewport=new gn;let z=new Ir;z.viewport=new gn;let V=[B,z],H=new E_,Z=null,J=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Me){let ze=L[Me];return ze===void 0&&(ze=new Kd,L[Me]=ze),ze.getTargetRaySpace()},this.getControllerGrip=function(Me){let ze=L[Me];return ze===void 0&&(ze=new Kd,L[Me]=ze),ze.getGripSpace()},this.getHand=function(Me){let ze=L[Me];return ze===void 0&&(ze=new Kd,L[Me]=ze),ze.getHandSpace()};function j(Me){let ze=D.indexOf(Me.inputSource);if(ze===-1)return;let $e=L[ze];$e!==void 0&&($e.update(Me.inputSource,Me.frame,c||o),$e.dispatchEvent({type:Me.type,data:Me.inputSource}))}function K(){r.removeEventListener("select",j),r.removeEventListener("selectstart",j),r.removeEventListener("selectend",j),r.removeEventListener("squeeze",j),r.removeEventListener("squeezestart",j),r.removeEventListener("squeezeend",j),r.removeEventListener("end",K),r.removeEventListener("inputsourceschange",ee);for(let Me=0;Me<L.length;Me++){let ze=D[Me];ze!==null&&(D[Me]=null,L[Me].disconnect(ze))}Z=null,J=null,S.reset();for(let Me in T)delete T[Me];e.setRenderTarget(R),x=null,p=null,f=null,r=null,C=null,mt.stop(),n.isPresenting=!1,e.setPixelRatio(N),e.setSize(F.width,F.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Me){s=Me,n.isPresenting===!0&&je("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Me){a=Me,n.isPresenting===!0&&je("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(Me){c=Me},this.getBaseLayer=function(){return p!==null?p:x},this.getBinding=function(){return f===null&&w&&(f=new XRWebGLBinding(r,t)),f},this.getFrame=function(){return v},this.getSession=function(){return r},this.setSession=async function(Me){if(r=Me,r!==null){if(R=e.getRenderTarget(),r.addEventListener("select",j),r.addEventListener("selectstart",j),r.addEventListener("selectend",j),r.addEventListener("squeeze",j),r.addEventListener("squeezestart",j),r.addEventListener("squeezeend",j),r.addEventListener("end",K),r.addEventListener("inputsourceschange",ee),P.xrCompatible!==!0&&await t.makeXRCompatible(),N=e.getPixelRatio(),e.getSize(F),w&&"createProjectionLayer"in XRWebGLBinding.prototype){let $e=null,Et=null,Tt=null;P.depth&&(Tt=P.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,$e=P.stencil?eo:vs,Et=P.stencil?Vo:pi);let Ct={colorFormat:t.RGBA8,depthFormat:Tt,scaleFactor:s};f=this.getBinding(),p=f.createProjectionLayer(Ct),r.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),C=new ha(p.textureWidth,p.textureHeight,{format:vr,type:zi,depthTexture:new ls(p.textureWidth,p.textureHeight,Et,void 0,void 0,void 0,void 0,void 0,void 0,$e),stencilBuffer:P.stencil,colorSpace:e.outputColorSpace,samples:P.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}else{let $e={antialias:P.antialias,alpha:!0,depth:P.depth,stencil:P.stencil,framebufferScaleFactor:s};x=new XRWebGLLayer(r,t,$e),r.updateRenderState({baseLayer:x}),e.setPixelRatio(1),e.setSize(x.framebufferWidth,x.framebufferHeight,!1),C=new ha(x.framebufferWidth,x.framebufferHeight,{format:vr,type:zi,colorSpace:e.outputColorSpace,stencilBuffer:P.stencil,resolveDepthBuffer:x.ignoreDepthValues===!1,resolveStencilBuffer:x.ignoreDepthValues===!1})}C.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 ee(Me){for(let ze=0;ze<Me.removed.length;ze++){let $e=Me.removed[ze],Et=D.indexOf($e);Et>=0&&(D[Et]=null,L[Et].disconnect($e))}for(let ze=0;ze<Me.added.length;ze++){let $e=Me.added[ze],Et=D.indexOf($e);if(Et===-1){for(let Ct=0;Ct<L.length;Ct++)if(Ct>=D.length){D.push($e),Et=Ct;break}else if(D[Ct]===null){D[Ct]=$e,Et=Ct;break}if(Et===-1)break}let Tt=L[Et];Tt&&Tt.connect($e)}}let ae=new ie,ce=new ie;function de(Me,ze,$e){ae.setFromMatrixPosition(ze.matrixWorld),ce.setFromMatrixPosition($e.matrixWorld);let Et=ae.distanceTo(ce),Tt=ze.projectionMatrix.elements,Ct=$e.projectionMatrix.elements,un=Tt[14]/(Tt[10]-1),Gt=Tt[14]/(Tt[10]+1),Xe=(Tt[9]+1)/Tt[5],st=(Tt[9]-1)/Tt[5],tt=(Tt[8]-1)/Tt[0],vt=(Ct[8]+1)/Ct[0],yt=un*tt,ln=un*vt,Kt=Et/(-tt+vt),Qt=Kt*-tt;if(ze.matrixWorld.decompose(Me.position,Me.quaternion,Me.scale),Me.translateX(Qt),Me.translateZ(Kt),Me.matrixWorld.compose(Me.position,Me.quaternion,Me.scale),Me.matrixWorldInverse.copy(Me.matrixWorld).invert(),Tt[10]===-1)Me.projectionMatrix.copy(ze.projectionMatrix),Me.projectionMatrixInverse.copy(ze.projectionMatrixInverse);else{let xn=un+Kt,ge=Gt+Kt,di=yt-Qt,Bn=ln+(Et-Qt),le=Xe*Gt/ge*xn,X=st*Gt/ge*xn;Me.projectionMatrix.makePerspective(di,Bn,le,X,xn,ge),Me.projectionMatrixInverse.copy(Me.projectionMatrix).invert()}}function ve(Me,ze){ze===null?Me.matrixWorld.copy(Me.matrix):Me.matrixWorld.multiplyMatrices(ze.matrixWorld,Me.matrix),Me.matrixWorldInverse.copy(Me.matrixWorld).invert()}this.updateCamera=function(Me){if(r===null)return;let ze=Me.near,$e=Me.far;S.texture!==null&&(S.depthNear>0&&(ze=S.depthNear),S.depthFar>0&&($e=S.depthFar)),H.near=z.near=B.near=ze,H.far=z.far=B.far=$e,(Z!==H.near||J!==H.far)&&(r.updateRenderState({depthNear:H.near,depthFar:H.far}),Z=H.near,J=H.far),H.layers.mask=Me.layers.mask|6,B.layers.mask=H.layers.mask&-5,z.layers.mask=H.layers.mask&-3;let Et=Me.parent,Tt=H.cameras;ve(H,Et);for(let Ct=0;Ct<Tt.length;Ct++)ve(Tt[Ct],Et);Tt.length===2?de(H,B,z):H.projectionMatrix.copy(B.projectionMatrix),Ie(Me,H,Et)};function Ie(Me,ze,$e){$e===null?Me.matrix.copy(ze.matrixWorld):(Me.matrix.copy($e.matrixWorld),Me.matrix.invert(),Me.matrix.multiply(ze.matrixWorld)),Me.matrix.decompose(Me.position,Me.quaternion,Me.scale),Me.updateMatrixWorld(!0),Me.projectionMatrix.copy(ze.projectionMatrix),Me.projectionMatrixInverse.copy(ze.projectionMatrixInverse),Me.isPerspectiveCamera&&(Me.fov=Rf*2*Math.atan(1/Me.projectionMatrix.elements[5]),Me.zoom=1)}this.getCamera=function(){return H},this.getFoveation=function(){if(!(p===null&&x===null))return l},this.setFoveation=function(Me){l=Me,p!==null&&(p.fixedFoveation=Me),x!==null&&x.fixedFoveation!==void 0&&(x.fixedFoveation=Me)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(H)},this.getCameraTexture=function(Me){return T[Me]};let Qe=null;function Ue(Me,ze){if(u=ze.getViewerPose(c||o),v=ze,u!==null){let $e=u.views;x!==null&&(e.setRenderTargetFramebuffer(C,x.framebuffer),e.setRenderTarget(C));let Et=!1;$e.length!==H.cameras.length&&(H.cameras.length=0,Et=!0);for(let Gt=0;Gt<$e.length;Gt++){let Xe=$e[Gt],st=null;if(x!==null)st=x.getViewport(Xe);else{let vt=f.getViewSubImage(p,Xe);st=vt.viewport,Gt===0&&(e.setRenderTargetTextures(C,vt.colorTexture,vt.depthStencilTexture),e.setRenderTarget(C))}let tt=V[Gt];tt===void 0&&(tt=new Ir,tt.layers.enable(Gt),tt.viewport=new gn,V[Gt]=tt),tt.matrix.fromArray(Xe.transform.matrix),tt.matrix.decompose(tt.position,tt.quaternion,tt.scale),tt.projectionMatrix.fromArray(Xe.projectionMatrix),tt.projectionMatrixInverse.copy(tt.projectionMatrix).invert(),tt.viewport.set(st.x,st.y,st.width,st.height),Gt===0&&(H.matrix.copy(tt.matrix),H.matrix.decompose(H.position,H.quaternion,H.scale)),Et===!0&&H.cameras.push(tt)}let Tt=r.enabledFeatures;if(Tt&&Tt.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&w){f=n.getBinding();let Gt=f.getDepthInformation($e[0]);Gt&&Gt.isValid&&Gt.texture&&S.init(Gt,r.renderState)}if(Tt&&Tt.includes("camera-access")&&w){e.state.unbindTexture(),f=n.getBinding();for(let Gt=0;Gt<$e.length;Gt++){let Xe=$e[Gt].camera;if(Xe){let st=T[Xe];st||(st=new Ty,T[Xe]=st);let tt=f.getCameraImage(Xe);st.sourceTexture=tt}}}}for(let $e=0;$e<L.length;$e++){let Et=D[$e],Tt=L[$e];Et!==null&&Tt!==void 0&&Tt.update(Et,ze,c||o)}Qe&&Qe(Me,ze),ze.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ze}),v=null}let mt=new BW;mt.setAnimationLoop(Ue),this.setAnimationLoop=function(Me){Qe=Me},this.dispose=function(){}}},m0e=new on,qW=new Sn;qW.set(-1,0,0,0,1,0,0,0,1);function g0e(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,EL(i)),T.isFog?(S.fogNear.value=T.near,S.fogFar.value=T.far):T.isFogExp2&&(S.fogDensity.value=T.density)}function r(S,T,P,R,C){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),p(S,T),T.isMeshPhysicalMaterial&&x(S,T,C)):T.isMeshMatcapMaterial?(s(S,T),v(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,P,R):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===ui&&(S.bumpScale.value*=-1)),T.normalMap&&(S.normalMap.value=T.normalMap,t(T.normalMap,S.normalMapTransform),S.normalScale.value.copy(T.normalScale),T.side===ui&&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 P=e.get(T),R=P.envMap,C=P.envMapRotation;R&&(S.envMap.value=R,S.envMapRotation.value.setFromMatrix4(m0e.makeRotationFromEuler(C)).transpose(),R.isCubeTexture&&R.isRenderTargetTexture===!1&&S.envMapRotation.value.premultiply(qW),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,P,R){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.size.value=T.size*P,S.scale.value=R*.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 p(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 x(S,T,P){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===ui&&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=P.texture,S.transmissionSamplerSize.value.set(P.width,P.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 v(S,T){T.matcap&&(S.matcap.value=T.matcap)}function w(S,T){let P=e.get(T).light;S.referencePosition.value.setFromMatrixPosition(P.matrixWorld),S.nearDistance.value=P.shadow.camera.near,S.farDistance.value=P.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function _0e(i,e,t,n){let r={},s={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(C,L){let D=L.program;n.uniformBlockBinding(C,D)}function c(C,L){let D=r[C.id];D===void 0&&(S(C),D=u(C),r[C.id]=D,C.addEventListener("dispose",P));let F=L.program;n.updateUBOMapping(C,F);let N=e.render.frame;s[C.id]!==N&&(p(C),s[C.id]=N)}function u(C){let L=f();C.__bindingPointIndex=L;let D=i.createBuffer(),F=C.__size,N=C.usage;return i.bindBuffer(i.UNIFORM_BUFFER,D),i.bufferData(i.UNIFORM_BUFFER,F,N),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,L,D),D}function f(){for(let C=0;C<a;C++)if(o.indexOf(C)===-1)return o.push(C),C;return Ge("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(C){let L=r[C.id],D=C.uniforms,F=C.__cache;i.bindBuffer(i.UNIFORM_BUFFER,L);for(let N=0,B=D.length;N<B;N++){let z=D[N];if(Array.isArray(z))for(let V=0,H=z.length;V<H;V++)x(z[V],N,V,F);else x(z,N,0,F)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function x(C,L,D,F){if(w(C,L,D,F)===!0){let N=C.__offset,B=C.value;if(Array.isArray(B)){let z=0;for(let V=0;V<B.length;V++){let H=B[V],Z=T(H);v(H,C.__data,z),typeof H!="number"&&typeof H!="boolean"&&!H.isMatrix3&&!ArrayBuffer.isView(H)&&(z+=Z.storage/Float32Array.BYTES_PER_ELEMENT)}}else v(B,C.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,N,C.__data)}}function v(C,L,D){typeof C=="number"||typeof C=="boolean"?L[0]=C:C.isMatrix3?(L[0]=C.elements[0],L[1]=C.elements[1],L[2]=C.elements[2],L[3]=0,L[4]=C.elements[3],L[5]=C.elements[4],L[6]=C.elements[5],L[7]=0,L[8]=C.elements[6],L[9]=C.elements[7],L[10]=C.elements[8],L[11]=0):ArrayBuffer.isView(C)?L.set(new C.constructor(C.buffer,C.byteOffset,L.length)):C.toArray(L,D)}function w(C,L,D,F){let N=C.value,B=L+"_"+D;if(F[B]===void 0)return typeof N=="number"||typeof N=="boolean"?F[B]=N:ArrayBuffer.isView(N)?F[B]=N.slice():F[B]=N.clone(),!0;{let z=F[B];if(typeof N=="number"||typeof N=="boolean"){if(z!==N)return F[B]=N,!0}else{if(ArrayBuffer.isView(N))return!0;if(z.equals(N)===!1)return z.copy(N),!0}}return!1}function S(C){let L=C.uniforms,D=0,F=16;for(let B=0,z=L.length;B<z;B++){let V=Array.isArray(L[B])?L[B]:[L[B]];for(let H=0,Z=V.length;H<Z;H++){let J=V[H],j=Array.isArray(J.value)?J.value:[J.value];for(let K=0,ee=j.length;K<ee;K++){let ae=j[K],ce=T(ae),de=D%F,ve=de%ce.boundary,Ie=de+ve;D+=ve,Ie!==0&&F-Ie<ce.storage&&(D+=F-Ie),J.__data=new Float32Array(ce.storage/Float32Array.BYTES_PER_ELEMENT),J.__offset=D,D+=ce.storage}}}let N=D%F;return N>0&&(D+=F-N),C.__size=D,C.__cache={},this}function T(C){let L={boundary:0,storage:0};return typeof C=="number"||typeof C=="boolean"?(L.boundary=4,L.storage=4):C.isVector2?(L.boundary=8,L.storage=8):C.isVector3||C.isColor?(L.boundary=16,L.storage=12):C.isVector4?(L.boundary=16,L.storage=16):C.isMatrix3?(L.boundary=48,L.storage=48):C.isMatrix4?(L.boundary=64,L.storage=64):C.isTexture?je("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(C)?(L.boundary=16,L.storage=C.byteLength):je("WebGLRenderer: Unsupported uniform value type.",C),L}function P(C){let L=C.target;L.removeEventListener("dispose",P);let D=o.indexOf(L.__bindingPointIndex);o.splice(D,1),i.deleteBuffer(r[L.id]),delete r[L.id],delete s[L.id]}function R(){for(let C in r)i.deleteBuffer(r[C]);o=[],r={},s={}}return{bind:l,update:c,dispose:R}}var x0e=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]),rh=null;function y0e(){return rh===null&&(rh=new SA(x0e,16,16,Ts,Di),rh.name="DFG_LUT",rh.minFilter=bi,rh.magFilter=bi,rh.wrapS=Go,rh.wrapT=Go,rh.generateMipmaps=!1,rh.needsUpdate=!0),rh}var a3=class{constructor(e={}){let{canvas:t=n3(),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:p=!1,outputBufferType:x=zi}=e;this.isWebGLRenderer=!0;let v;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");v=n.getContextAttributes().alpha}else v=o;let w=x,S=new Set([cp,Zu,Yu]),T=new Set([zi,pi,ja,Vo,OA,BA]),P=new Uint32Array(4),R=new Int32Array(4),C=new ie,L=null,D=null,F=[],N=[],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=zs,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let z=this,V=!1,H=null,Z=null,J=null,j=null;this._outputColorSpace=yr;let K=0,ee=0,ae=null,ce=-1,de=null,ve=new gn,Ie=new gn,Qe=null,Ue=new Ut(0),mt=0,Me=t.width,ze=t.height,$e=1,Et=null,Tt=null,Ct=new gn(0,0,Me,ze),un=new gn(0,0,Me,ze),Gt=!1,Xe=new ec,st=!1,tt=!1,vt=new on,yt=new ie,ln=new gn,Kt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Qt=!1;function xn(){return ae===null?$e:1}let ge=n;function di(te,Se){return t.getContext(te,Se)}try{let te={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",Hi,!1),t.addEventListener("webglcontextrestored",Nn,!1),t.addEventListener("webglcontextcreationerror",zr,!1),ge===null){let Se="webgl2";if(ge=di(Se,te),ge===null)throw di(Se)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(te){throw Ge("WebGLRenderer: "+te.message),te}let Bn,le,X,Te,Pe,Ve,gt,St,qe,Ke,Rt,en,Pt,Mt,cn,yn,Pn,xe,bt,Ye,wt,Dt,ct;function Ce(){Bn=new Mde(ge),Bn.init(),wt=new d0e(ge,Bn),le=new xde(ge,Bn,e,wt),X=new h0e(ge,Bn),le.reversedDepthBuffer&&p&&X.buffers.depth.setReversed(!0),Z=ge.createFramebuffer(),J=ge.createFramebuffer(),j=ge.createFramebuffer(),Te=new Pde(ge),Pe=new Kpe,Ve=new f0e(ge,Bn,X,Pe,le,wt,Te),gt=new Ede(z),St=new Due(ge),Dt=new gde(ge,St),qe=new Cde(ge,St,Te,Dt),Ke=new Nde(ge,qe,St,Dt,Te),xe=new Ide(ge,le,Ve),cn=new yde(Pe),Rt=new Zpe(z,gt,Bn,le,Dt,cn),en=new g0e(z,Pe),Pt=new Jpe,Mt=new s0e(Bn),Pn=new mde(z,gt,X,Ke,v,l),yn=new u0e(z,Ke,le),ct=new _0e(ge,Te,le,X),bt=new _de(ge,Bn,Te),Ye=new Rde(ge,Bn,Te),Te.programs=Rt.programs,z.capabilities=le,z.extensions=Bn,z.properties=Pe,z.renderLists=Pt,z.shadowMap=yn,z.state=X,z.info=Te}Ce(),w!==zi&&(B=new Dde(w,t.width,t.height,a,r,s));let jt=new $L(z,ge);this.xr=jt,this.getContext=function(){return ge},this.getContextAttributes=function(){return ge.getContextAttributes()},this.forceContextLoss=function(){let te=Bn.get("WEBGL_lose_context");te&&te.loseContext()},this.forceContextRestore=function(){let te=Bn.get("WEBGL_lose_context");te&&te.restoreContext()},this.getPixelRatio=function(){return $e},this.setPixelRatio=function(te){te!==void 0&&($e=te,this.setSize(Me,ze,!1))},this.getSize=function(te){return te.set(Me,ze)},this.setSize=function(te,Se,ke=!0){if(jt.isPresenting){je("WebGLRenderer: Can't change size while VR device is presenting.");return}Me=te,ze=Se,t.width=Math.floor(te*$e),t.height=Math.floor(Se*$e),ke===!0&&(t.style.width=te+"px",t.style.height=Se+"px"),B!==null&&B.setSize(t.width,t.height),this.setViewport(0,0,te,Se)},this.getDrawingBufferSize=function(te){return te.set(Me*$e,ze*$e).floor()},this.setDrawingBufferSize=function(te,Se,ke){Me=te,ze=Se,$e=ke,t.width=Math.floor(te*ke),t.height=Math.floor(Se*ke),this.setViewport(0,0,te,Se)},this.setEffects=function(te){if(w===zi){Ge("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(te){for(let Se=0;Se<te.length;Se++)if(te[Se].isOutputPass===!0){je("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}B.setEffects(te||[])},this.getCurrentViewport=function(te){return te.copy(ve)},this.getViewport=function(te){return te.copy(Ct)},this.setViewport=function(te,Se,ke,Le){te.isVector4?Ct.set(te.x,te.y,te.z,te.w):Ct.set(te,Se,ke,Le),X.viewport(ve.copy(Ct).multiplyScalar($e).round())},this.getScissor=function(te){return te.copy(un)},this.setScissor=function(te,Se,ke,Le){te.isVector4?un.set(te.x,te.y,te.z,te.w):un.set(te,Se,ke,Le),X.scissor(Ie.copy(un).multiplyScalar($e).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(te){X.setScissorTest(Gt=te)},this.setOpaqueSort=function(te){Et=te},this.setTransparentSort=function(te){Tt=te},this.getClearColor=function(te){return te.copy(Pn.getClearColor())},this.setClearColor=function(){Pn.setClearColor(...arguments)},this.getClearAlpha=function(){return Pn.getClearAlpha()},this.setClearAlpha=function(){Pn.setClearAlpha(...arguments)},this.clear=function(te=!0,Se=!0,ke=!0){let Le=0;if(te){let De=!1;if(ae!==null){let zt=ae.texture.format;De=S.has(zt)}if(De){let zt=ae.texture.type,Yt=T.has(zt),kt=Pn.getClearColor(),tn=Pn.getClearAlpha(),hn=kt.r,zn=kt.g,$n=kt.b;Yt?(P[0]=hn,P[1]=zn,P[2]=$n,P[3]=tn,ge.clearBufferuiv(ge.COLOR,0,P)):(R[0]=hn,R[1]=zn,R[2]=$n,R[3]=tn,ge.clearBufferiv(ge.COLOR,0,R))}else Le|=ge.COLOR_BUFFER_BIT}Se&&(Le|=ge.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ke&&(Le|=ge.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Le!==0&&ge.clear(Le)},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(te){te.setRenderer(this),H=te},this.dispose=function(){t.removeEventListener("webglcontextlost",Hi,!1),t.removeEventListener("webglcontextrestored",Nn,!1),t.removeEventListener("webglcontextcreationerror",zr,!1),Pn.dispose(),Pt.dispose(),Mt.dispose(),Pe.dispose(),gt.dispose(),Ke.dispose(),Dt.dispose(),ct.dispose(),Rt.dispose(),jt.dispose(),jt.removeEventListener("sessionstart",Is),jt.removeEventListener("sessionend",ol),du.stop()};function Hi(te){te.preventDefault(),yA("WebGLRenderer: Context Lost."),V=!0}function Nn(){yA("WebGLRenderer: Context Restored."),V=!1;let te=Te.autoReset,Se=yn.enabled,ke=yn.autoUpdate,Le=yn.needsUpdate,De=yn.type;Ce(),Te.autoReset=te,yn.enabled=Se,yn.autoUpdate=ke,yn.needsUpdate=Le,yn.type=De}function zr(te){Ge("WebGLRenderer: A WebGL context could not be created. Reason: ",te.statusMessage)}function gr(te){let Se=te.target;Se.removeEventListener("dispose",gr),rl(Se)}function rl(te){na(te),Pe.remove(te)}function na(te){let Se=Pe.get(te).programs;Se!==void 0&&(Se.forEach(function(ke){Rt.releaseProgram(ke)}),te.isShaderMaterial&&Rt.releaseShaderCache(te))}this.renderBufferDirect=function(te,Se,ke,Le,De,zt){Se===null&&(Se=Kt);let Yt=De.isMesh&&De.matrixWorld.determinantAffine()<0,kt=e9(te,Se,ke,Le,De);X.setMaterial(Le,Yt);let tn=ke.index,hn=1;if(Le.wireframe===!0){if(tn=qe.getWireframeAttribute(ke),tn===void 0)return;hn=2}let zn=ke.drawRange,$n=ke.attributes.position,pn=zn.start*hn,Ui=(zn.start+zn.count)*hn;zt!==null&&(pn=Math.max(pn,zt.start*hn),Ui=Math.min(Ui,(zt.start+zt.count)*hn)),tn!==null?(pn=Math.max(pn,0),Ui=Math.min(Ui,tn.count)):$n!=null&&(pn=Math.max(pn,0),Ui=Math.min(Ui,$n.count));let Vr=Ui-pn;if(Vr<0||Vr===1/0)return;Dt.setup(De,Le,kt,ke,tn);let Mr,Wi=bt;if(tn!==null&&(Mr=St.get(tn),Wi=Ye,Wi.setIndex(Mr)),De.isMesh)Le.wireframe===!0?(X.setLineWidth(Le.wireframeLinewidth*xn()),Wi.setMode(ge.LINES)):Wi.setMode(ge.TRIANGLES);else if(De.isLine){let ao=Le.linewidth;ao===void 0&&(ao=1),X.setLineWidth(ao*xn()),De.isLineSegments?Wi.setMode(ge.LINES):De.isLineLoop?Wi.setMode(ge.LINE_LOOP):Wi.setMode(ge.LINE_STRIP)}else De.isPoints?Wi.setMode(ge.POINTS):De.isSprite&&Wi.setMode(ge.TRIANGLES);if(De.isBatchedMesh)if(Bn.get("WEBGL_multi_draw"))Wi.renderMultiDraw(De._multiDrawStarts,De._multiDrawCounts,De._multiDrawCount);else{let ao=De._multiDrawStarts,Xt=De._multiDrawCounts,La=De._multiDrawCount,mi=tn?St.get(tn).bytesPerElement:1,al=Pe.get(Le).currentProgram.getUniforms();for(let vc=0;vc<La;vc++)al.setValue(ge,"_gl_DrawID",vc),Wi.render(ao[vc]/mi,Xt[vc])}else if(De.isInstancedMesh)Wi.renderInstances(pn,Vr,De.count);else if(ke.isInstancedBufferGeometry){let ao=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Xt=Math.min(ke.instanceCount,ao);Wi.renderInstances(pn,Vr,Xt)}else Wi.render(pn,Vr)};function sl(te,Se,ke){te.transparent===!0&&te.side===rr&&te.forceSinglePass===!1?(te.side=ui,te.needsUpdate=!0,ix(te,Se,ke),te.side=go,te.needsUpdate=!0,ix(te,Se,ke),te.side=rr):ix(te,Se,ke)}this.compile=function(te,Se,ke=null){ke===null&&(ke=te),D=Mt.get(ke),D.init(Se),N.push(D),ke.traverseVisible(function(De){De.isLight&&De.layers.test(Se.layers)&&(D.pushLight(De),De.castShadow&&D.pushShadow(De))}),te!==ke&&te.traverseVisible(function(De){De.isLight&&De.layers.test(Se.layers)&&(D.pushLight(De),De.castShadow&&D.pushShadow(De))}),D.setupLights();let Le=new Set;return te.traverse(function(De){if(!(De.isMesh||De.isPoints||De.isLine||De.isSprite))return;let zt=De.material;if(zt)if(Array.isArray(zt))for(let Yt=0;Yt<zt.length;Yt++){let kt=zt[Yt];sl(kt,ke,De),Le.add(kt)}else sl(zt,ke,De),Le.add(zt)}),D=N.pop(),Le},this.compileAsync=function(te,Se,ke=null){let Le=this.compile(te,Se,ke);return new Promise(De=>{function zt(){if(Le.forEach(function(Yt){Pe.get(Yt).currentProgram.isReady()&&Le.delete(Yt)}),Le.size===0){De(te);return}setTimeout(zt,10)}Bn.get("KHR_parallel_shader_compile")!==null?zt():setTimeout(zt,10)})};let Na=null;function or(te){Na&&Na(te)}function Is(){du.stop()}function ol(){du.start()}let du=new BW;du.setAnimationLoop(or),typeof self<"u"&&du.setContext(self),this.setAnimationLoop=function(te){Na=te,jt.setAnimationLoop(te),te===null?du.stop():du.start()},jt.addEventListener("sessionstart",Is),jt.addEventListener("sessionend",ol),this.render=function(te,Se){if(Se!==void 0&&Se.isCamera!==!0){Ge("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(V===!0)return;H!==null&&H.renderStart(te,Se);let ke=jt.enabled===!0&&jt.isPresenting===!0,Le=B!==null&&(ae===null||ke)&&B.begin(z,ae);if(te.matrixWorldAutoUpdate===!0&&te.updateMatrixWorld(),Se.parent===null&&Se.matrixWorldAutoUpdate===!0&&Se.updateMatrixWorld(),jt.enabled===!0&&jt.isPresenting===!0&&(B===null||B.isCompositing()===!1)&&(jt.cameraAutoUpdate===!0&&jt.updateCamera(Se),Se=jt.getCamera()),te.isScene===!0&&te.onBeforeRender(z,te,Se,ae),D=Mt.get(te,N.length),D.init(Se),D.state.textureUnits=Ve.getTextureUnits(),N.push(D),vt.multiplyMatrices(Se.projectionMatrix,Se.matrixWorldInverse),Xe.setFromProjectionMatrix(vt,mo,Se.reversedDepth),tt=this.localClippingEnabled,st=cn.init(this.clippingPlanes,tt),L=Pt.get(te,F.length),L.init(),F.push(L),jt.enabled===!0&&jt.isPresenting===!0){let Yt=z.xr.getDepthSensingMesh();Yt!==null&&Hb(Yt,Se,-1/0,z.sortObjects)}Hb(te,Se,0,z.sortObjects),L.finish(),z.sortObjects===!0&&L.sort(Et,Tt,Se.reversedDepth),Qt=jt.enabled===!1||jt.isPresenting===!1||jt.hasDepthSensing()===!1,Qt&&Pn.addToRenderList(L,te),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),st===!0&&cn.beginShadows();let De=D.state.shadowsArray;if(yn.render(De,te,Se),st===!0&&cn.endShadows(),(Le&&B.hasRenderPass())===!1){let Yt=L.opaque,kt=L.transmissive;if(D.setupLights(),Se.isArrayCamera){let tn=Se.cameras;if(kt.length>0)for(let hn=0,zn=tn.length;hn<zn;hn++){let $n=tn[hn];a4(Yt,kt,te,$n)}Qt&&Pn.render(te);for(let hn=0,zn=tn.length;hn<zn;hn++){let $n=tn[hn];o4(L,te,$n,$n.viewport)}}else kt.length>0&&a4(Yt,kt,te,Se),Qt&&Pn.render(te),o4(L,te,Se)}ae!==null&&ee===0&&(Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae)),Le&&B.end(z),te.isScene===!0&&te.onAfterRender(z,te,Se),Dt.resetDefaultState(),ce=-1,de=null,N.pop(),N.length>0?(D=N[N.length-1],Ve.setTextureUnits(D.state.textureUnits),st===!0&&cn.setGlobalState(z.clippingPlanes,D.state.camera)):D=null,F.pop(),F.length>0?L=F[F.length-1]:L=null,H!==null&&H.renderEnd()};function Hb(te,Se,ke,Le){if(te.visible===!1)return;if(te.layers.test(Se.layers)){if(te.isGroup)ke=te.renderOrder;else if(te.isLOD)te.autoUpdate===!0&&te.update(Se);else if(te.isLightProbeGrid)D.pushLightProbeGrid(te);else if(te.isLight)D.pushLight(te),te.castShadow&&D.pushShadow(te);else if(te.isSprite){if(!te.frustumCulled||Xe.intersectsSprite(te)){Le&&ln.setFromMatrixPosition(te.matrixWorld).applyMatrix4(vt);let Yt=Ke.update(te),kt=te.material;kt.visible&&L.push(te,Yt,kt,ke,ln.z,null)}}else if((te.isMesh||te.isLine||te.isPoints)&&(!te.frustumCulled||Xe.intersectsObject(te))){let Yt=Ke.update(te),kt=te.material;if(Le&&(te.boundingSphere!==void 0?(te.boundingSphere===null&&te.computeBoundingSphere(),ln.copy(te.boundingSphere.center)):(Yt.boundingSphere===null&&Yt.computeBoundingSphere(),ln.copy(Yt.boundingSphere.center)),ln.applyMatrix4(te.matrixWorld).applyMatrix4(vt)),Array.isArray(kt)){let tn=Yt.groups;for(let hn=0,zn=tn.length;hn<zn;hn++){let $n=tn[hn],pn=kt[$n.materialIndex];pn&&pn.visible&&L.push(te,Yt,pn,ke,ln.z,$n)}}else kt.visible&&L.push(te,Yt,kt,ke,ln.z,null)}}let zt=te.children;for(let Yt=0,kt=zt.length;Yt<kt;Yt++)Hb(zt[Yt],Se,ke,Le)}function o4(te,Se,ke,Le){let{opaque:De,transmissive:zt,transparent:Yt}=te;D.setupLightsView(ke),st===!0&&cn.setGlobalState(z.clippingPlanes,ke),Le&&X.viewport(ve.copy(Le)),De.length>0&&nx(De,Se,ke),zt.length>0&&nx(zt,Se,ke),Yt.length>0&&nx(Yt,Se,ke),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function a4(te,Se,ke,Le){if((ke.isScene===!0?ke.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[Le.id]===void 0){let pn=Bn.has("EXT_color_buffer_half_float")||Bn.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[Le.id]=new ha(1,1,{generateMipmaps:!0,type:pn?Di:zi,minFilter:xo,samples:Math.max(4,le.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:sn.workingColorSpace})}let zt=D.state.transmissionRenderTarget[Le.id],Yt=Le.viewport||ve;zt.setSize(Yt.z*z.transmissionResolutionScale,Yt.w*z.transmissionResolutionScale);let kt=z.getRenderTarget(),tn=z.getActiveCubeFace(),hn=z.getActiveMipmapLevel();z.setRenderTarget(zt),z.getClearColor(Ue),mt=z.getClearAlpha(),mt<1&&z.setClearColor(16777215,.5),z.clear(),Qt&&Pn.render(ke);let zn=z.toneMapping;z.toneMapping=zs;let $n=Le.viewport;if(Le.viewport!==void 0&&(Le.viewport=void 0),D.setupLightsView(Le),st===!0&&cn.setGlobalState(z.clippingPlanes,Le),nx(te,ke,Le),Ve.updateMultisampleRenderTarget(zt),Ve.updateRenderTargetMipmap(zt),Bn.has("WEBGL_multisampled_render_to_texture")===!1){let pn=!1;for(let Ui=0,Vr=Se.length;Ui<Vr;Ui++){let Mr=Se[Ui],{object:Wi,geometry:ao,material:Xt,group:La}=Mr;if(Xt.side===rr&&Wi.layers.test(Le.layers)){let mi=Xt.side;Xt.side=ui,Xt.needsUpdate=!0,l4(Wi,ke,Le,ao,Xt,La),Xt.side=mi,Xt.needsUpdate=!0,pn=!0}}pn===!0&&(Ve.updateMultisampleRenderTarget(zt),Ve.updateRenderTargetMipmap(zt))}z.setRenderTarget(kt,tn,hn),z.setClearColor(Ue,mt),$n!==void 0&&(Le.viewport=$n),z.toneMapping=zn}function nx(te,Se,ke){let Le=Se.isScene===!0?Se.overrideMaterial:null;for(let De=0,zt=te.length;De<zt;De++){let Yt=te[De],{object:kt,geometry:tn,group:hn}=Yt,zn=Yt.material;zn.allowOverride===!0&&Le!==null&&(zn=Le),kt.layers.test(ke.layers)&&l4(kt,Se,ke,tn,zn,hn)}}function l4(te,Se,ke,Le,De,zt){te.onBeforeRender(z,Se,ke,Le,De,zt),te.modelViewMatrix.multiplyMatrices(ke.matrixWorldInverse,te.matrixWorld),te.normalMatrix.getNormalMatrix(te.modelViewMatrix),De.onBeforeRender(z,Se,ke,Le,te,zt),De.transparent===!0&&De.side===rr&&De.forceSinglePass===!1?(De.side=ui,De.needsUpdate=!0,z.renderBufferDirect(ke,Se,Le,De,te,zt),De.side=go,De.needsUpdate=!0,z.renderBufferDirect(ke,Se,Le,De,te,zt),De.side=rr):z.renderBufferDirect(ke,Se,Le,De,te,zt),te.onAfterRender(z,Se,ke,Le,De,zt)}function ix(te,Se,ke){Se.isScene!==!0&&(Se=Kt);let Le=Pe.get(te),De=D.state.lights,zt=D.state.shadowsArray,Yt=De.state.version,kt=Rt.getParameters(te,De.state,zt,Se,ke,D.state.lightProbeGridArray),tn=Rt.getProgramCacheKey(kt),hn=Le.programs;Le.environment=te.isMeshStandardMaterial||te.isMeshLambertMaterial||te.isMeshPhongMaterial?Se.environment:null,Le.fog=Se.fog;let zn=te.isMeshStandardMaterial||te.isMeshLambertMaterial&&!te.envMap||te.isMeshPhongMaterial&&!te.envMap;Le.envMap=gt.get(te.envMap||Le.environment,zn),Le.envMapRotation=Le.environment!==null&&te.envMap===null?Se.environmentRotation:te.envMapRotation,hn===void 0&&(te.addEventListener("dispose",gr),hn=new Map,Le.programs=hn);let $n=hn.get(tn);if($n!==void 0){if(Le.currentProgram===$n&&Le.lightsStateVersion===Yt)return u4(te,kt),$n}else kt.uniforms=Rt.getUniforms(te),H!==null&&te.isNodeMaterial&&H.build(te,ke,kt),te.onBeforeCompile(kt,z),$n=Rt.acquireProgram(kt,tn),hn.set(tn,$n),Le.uniforms=kt.uniforms;let pn=Le.uniforms;return(!te.isShaderMaterial&&!te.isRawShaderMaterial||te.clipping===!0)&&(pn.clippingPlanes=cn.uniform),u4(te,kt),Le.needsLights=n9(te),Le.lightsStateVersion=Yt,Le.needsLights&&(pn.ambientLightColor.value=De.state.ambient,pn.lightProbe.value=De.state.probe,pn.directionalLights.value=De.state.directional,pn.directionalLightShadows.value=De.state.directionalShadow,pn.spotLights.value=De.state.spot,pn.spotLightShadows.value=De.state.spotShadow,pn.rectAreaLights.value=De.state.rectArea,pn.ltc_1.value=De.state.rectAreaLTC1,pn.ltc_2.value=De.state.rectAreaLTC2,pn.pointLights.value=De.state.point,pn.pointLightShadows.value=De.state.pointShadow,pn.hemisphereLights.value=De.state.hemi,pn.directionalShadowMatrix.value=De.state.directionalShadowMatrix,pn.spotLightMatrix.value=De.state.spotLightMatrix,pn.spotLightMap.value=De.state.spotLightMap,pn.pointShadowMatrix.value=De.state.pointShadowMatrix),Le.lightProbeGrid=D.state.lightProbeGridArray.length>0,Le.currentProgram=$n,Le.uniformsList=null,$n}function c4(te){if(te.uniformsList===null){let Se=te.currentProgram.getUniforms();te.uniformsList=L_.seqWithValue(Se.seq,te.uniforms)}return te.uniformsList}function u4(te,Se){let ke=Pe.get(te);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 Jk(te,Se){if(te.length===0)return null;if(te.length===1)return te[0].texture!==null?te[0]:null;C.setFromMatrixPosition(Se.matrixWorld);for(let ke=0,Le=te.length;ke<Le;ke++){let De=te[ke];if(De.texture!==null&&De.boundingBox.containsPoint(C))return De}return null}function e9(te,Se,ke,Le,De){Se.isScene!==!0&&(Se=Kt),Ve.resetTextureUnits();let zt=Se.fog,Yt=Le.isMeshStandardMaterial||Le.isMeshLambertMaterial||Le.isMeshPhongMaterial?Se.environment:null,kt=ae===null?z.outputColorSpace:ae.isXRRenderTarget===!0?ae.texture.colorSpace:sn.workingColorSpace,tn=Le.isMeshStandardMaterial||Le.isMeshLambertMaterial&&!Le.envMap||Le.isMeshPhongMaterial&&!Le.envMap,hn=gt.get(Le.envMap||Yt,tn),zn=Le.vertexColors===!0&&!!ke.attributes.color&&ke.attributes.color.itemSize===4,$n=!!ke.attributes.tangent&&(!!Le.normalMap||Le.anisotropy>0),pn=!!ke.morphAttributes.position,Ui=!!ke.morphAttributes.normal,Vr=!!ke.morphAttributes.color,Mr=zs;Le.toneMapped&&(ae===null||ae.isXRRenderTarget===!0)&&(Mr=z.toneMapping);let Wi=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,ao=Wi!==void 0?Wi.length:0,Xt=Pe.get(Le),La=D.state.lights;if(st===!0&&(tt===!0||te!==de)){let tr=te===de&&Le.id===ce;cn.setState(Le,te,tr)}let mi=!1;Le.version===Xt.__version?(Xt.needsLights&&Xt.lightsStateVersion!==La.state.version||Xt.outputColorSpace!==kt||De.isBatchedMesh&&Xt.batching===!1||!De.isBatchedMesh&&Xt.batching===!0||De.isBatchedMesh&&Xt.batchingColor===!0&&De.colorTexture===null||De.isBatchedMesh&&Xt.batchingColor===!1&&De.colorTexture!==null||De.isInstancedMesh&&Xt.instancing===!1||!De.isInstancedMesh&&Xt.instancing===!0||De.isSkinnedMesh&&Xt.skinning===!1||!De.isSkinnedMesh&&Xt.skinning===!0||De.isInstancedMesh&&Xt.instancingColor===!0&&De.instanceColor===null||De.isInstancedMesh&&Xt.instancingColor===!1&&De.instanceColor!==null||De.isInstancedMesh&&Xt.instancingMorph===!0&&De.morphTexture===null||De.isInstancedMesh&&Xt.instancingMorph===!1&&De.morphTexture!==null||Xt.envMap!==hn||Le.fog===!0&&Xt.fog!==zt||Xt.numClippingPlanes!==void 0&&(Xt.numClippingPlanes!==cn.numPlanes||Xt.numIntersection!==cn.numIntersection)||Xt.vertexAlphas!==zn||Xt.vertexTangents!==$n||Xt.morphTargets!==pn||Xt.morphNormals!==Ui||Xt.morphColors!==Vr||Xt.toneMapping!==Mr||Xt.morphTargetsCount!==ao||!!Xt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(mi=!0):(mi=!0,Xt.__version=Le.version);let al=Xt.currentProgram;mi===!0&&(al=ix(Le,Se,De),H&&Le.isNodeMaterial&&H.onUpdateProgram(Le,al,Xt));let vc=!1,Wh=!1,C0=!1,ji=al.getUniforms(),qr=Xt.uniforms;if(X.useProgram(al.program)&&(vc=!0,Wh=!0,C0=!0),Le.id!==ce&&(ce=Le.id,Wh=!0),Xt.needsLights){let tr=Jk(D.state.lightProbeGridArray,De);Xt.lightProbeGrid!==tr&&(Xt.lightProbeGrid=tr,Wh=!0)}if(vc||de!==te){X.buffers.depth.getReversed()&&te.reversedDepth!==!0&&(te._reversedDepth=!0,te.updateProjectionMatrix()),ji.setValue(ge,"projectionMatrix",te.projectionMatrix),ji.setValue(ge,"viewMatrix",te.matrixWorldInverse);let Xh=ji.map.cameraPosition;Xh!==void 0&&Xh.setValue(ge,yt.setFromMatrixPosition(te.matrixWorld)),le.logarithmicDepthBuffer&&ji.setValue(ge,"logDepthBufFC",2/(Math.log(te.far+1)/Math.LN2)),(Le.isMeshPhongMaterial||Le.isMeshToonMaterial||Le.isMeshLambertMaterial||Le.isMeshBasicMaterial||Le.isMeshStandardMaterial||Le.isShaderMaterial)&&ji.setValue(ge,"isOrthographic",te.isOrthographicCamera===!0),de!==te&&(de=te,Wh=!0,C0=!0)}if(Xt.needsLights&&(La.state.directionalShadowMap.length>0&&ji.setValue(ge,"directionalShadowMap",La.state.directionalShadowMap,Ve),La.state.spotShadowMap.length>0&&ji.setValue(ge,"spotShadowMap",La.state.spotShadowMap,Ve),La.state.pointShadowMap.length>0&&ji.setValue(ge,"pointShadowMap",La.state.pointShadowMap,Ve)),De.isSkinnedMesh){ji.setOptional(ge,De,"bindMatrix"),ji.setOptional(ge,De,"bindMatrixInverse");let tr=De.skeleton;tr&&(tr.boneTexture===null&&tr.computeBoneTexture(),ji.setValue(ge,"boneTexture",tr.boneTexture,Ve))}De.isBatchedMesh&&(ji.setOptional(ge,De,"batchingTexture"),ji.setValue(ge,"batchingTexture",De._matricesTexture,Ve),ji.setOptional(ge,De,"batchingIdTexture"),ji.setValue(ge,"batchingIdTexture",De._indirectTexture,Ve),ji.setOptional(ge,De,"batchingColorTexture"),De._colorsTexture!==null&&ji.setValue(ge,"batchingColorTexture",De._colorsTexture,Ve));let jh=ke.morphAttributes;if((jh.position!==void 0||jh.normal!==void 0||jh.color!==void 0)&&xe.update(De,ke,al),(Wh||Xt.receiveShadow!==De.receiveShadow)&&(Xt.receiveShadow=De.receiveShadow,ji.setValue(ge,"receiveShadow",De.receiveShadow)),(Le.isMeshStandardMaterial||Le.isMeshLambertMaterial||Le.isMeshPhongMaterial)&&Le.envMap===null&&Se.environment!==null&&(qr.envMapIntensity.value=Se.environmentIntensity),qr.dfgLUT!==void 0&&(qr.dfgLUT.value=y0e()),Wh){if(ji.setValue(ge,"toneMappingExposure",z.toneMappingExposure),Xt.needsLights&&t9(qr,C0),zt&&Le.fog===!0&&en.refreshFogUniforms(qr,zt),en.refreshMaterialUniforms(qr,Le,$e,ze,D.state.transmissionRenderTarget[te.id]),Xt.needsLights&&Xt.lightProbeGrid){let tr=Xt.lightProbeGrid;qr.probesSH.value=tr.texture,qr.probesMin.value.copy(tr.boundingBox.min),qr.probesMax.value.copy(tr.boundingBox.max),qr.probesResolution.value.copy(tr.resolution)}L_.upload(ge,c4(Xt),qr,Ve)}if(Le.isShaderMaterial&&Le.uniformsNeedUpdate===!0&&(L_.upload(ge,c4(Xt),qr,Ve),Le.uniformsNeedUpdate=!1),Le.isSpriteMaterial&&ji.setValue(ge,"center",De.center),ji.setValue(ge,"modelViewMatrix",De.modelViewMatrix),ji.setValue(ge,"normalMatrix",De.normalMatrix),ji.setValue(ge,"modelMatrix",De.matrixWorld),Le.uniformsGroups!==void 0){let tr=Le.uniformsGroups;for(let Xh=0,R0=tr.length;Xh<R0;Xh++){let h4=tr[Xh];ct.update(h4,al),ct.bind(h4,al)}}return al}function t9(te,Se){te.ambientLightColor.needsUpdate=Se,te.lightProbe.needsUpdate=Se,te.directionalLights.needsUpdate=Se,te.directionalLightShadows.needsUpdate=Se,te.pointLights.needsUpdate=Se,te.pointLightShadows.needsUpdate=Se,te.spotLights.needsUpdate=Se,te.spotLightShadows.needsUpdate=Se,te.rectAreaLights.needsUpdate=Se,te.hemisphereLights.needsUpdate=Se}function n9(te){return te.isMeshLambertMaterial||te.isMeshToonMaterial||te.isMeshPhongMaterial||te.isMeshStandardMaterial||te.isShadowMaterial||te.isShaderMaterial&&te.lights===!0}this.getActiveCubeFace=function(){return K},this.getActiveMipmapLevel=function(){return ee},this.getRenderTarget=function(){return ae},this.setRenderTargetTextures=function(te,Se,ke){let Le=Pe.get(te);Le.__autoAllocateDepthBuffer=te.resolveDepthBuffer===!1,Le.__autoAllocateDepthBuffer===!1&&(Le.__useRenderToTexture=!1),Pe.get(te.texture).__webglTexture=Se,Pe.get(te.depthTexture).__webglTexture=Le.__autoAllocateDepthBuffer?void 0:ke,Le.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(te,Se){let ke=Pe.get(te);ke.__webglFramebuffer=Se,ke.__useDefaultFramebuffer=Se===void 0},this.setRenderTarget=function(te,Se=0,ke=0){ae=te,K=Se,ee=ke;let Le=null,De=!1,zt=!1;if(te){let kt=Pe.get(te);if(kt.__useDefaultFramebuffer!==void 0){X.bindFramebuffer(ge.FRAMEBUFFER,kt.__webglFramebuffer),ve.copy(te.viewport),Ie.copy(te.scissor),Qe=te.scissorTest,X.viewport(ve),X.scissor(Ie),X.setScissorTest(Qe),ce=-1;return}else if(kt.__webglFramebuffer===void 0)Ve.setupRenderTarget(te);else if(kt.__hasExternalTextures)Ve.rebindTextures(te,Pe.get(te.texture).__webglTexture,Pe.get(te.depthTexture).__webglTexture);else if(te.depthBuffer){let zn=te.depthTexture;if(kt.__boundDepthTexture!==zn){if(zn!==null&&Pe.has(zn)&&(te.width!==zn.image.width||te.height!==zn.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");Ve.setupDepthRenderbuffer(te)}}let tn=te.texture;(tn.isData3DTexture||tn.isDataArrayTexture||tn.isCompressedArrayTexture)&&(zt=!0);let hn=Pe.get(te).__webglFramebuffer;te.isWebGLCubeRenderTarget?(Array.isArray(hn[Se])?Le=hn[Se][ke]:Le=hn[Se],De=!0):te.samples>0&&Ve.useMultisampledRTT(te)===!1?Le=Pe.get(te).__webglMultisampledFramebuffer:Array.isArray(hn)?Le=hn[ke]:Le=hn,ve.copy(te.viewport),Ie.copy(te.scissor),Qe=te.scissorTest}else ve.copy(Ct).multiplyScalar($e).floor(),Ie.copy(un).multiplyScalar($e).floor(),Qe=Gt;if(ke!==0&&(Le=Z),X.bindFramebuffer(ge.FRAMEBUFFER,Le)&&X.drawBuffers(te,Le),X.viewport(ve),X.scissor(Ie),X.setScissorTest(Qe),De){let kt=Pe.get(te.texture);ge.framebufferTexture2D(ge.FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_CUBE_MAP_POSITIVE_X+Se,kt.__webglTexture,ke)}else if(zt){let kt=Se;for(let tn=0;tn<te.textures.length;tn++){let hn=Pe.get(te.textures[tn]);ge.framebufferTextureLayer(ge.FRAMEBUFFER,ge.COLOR_ATTACHMENT0+tn,hn.__webglTexture,ke,kt)}}else if(te!==null&&ke!==0){let kt=Pe.get(te.texture);ge.framebufferTexture2D(ge.FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,kt.__webglTexture,ke)}ce=-1},this.readRenderTargetPixels=function(te,Se,ke,Le,De,zt,Yt,kt=0){if(!(te&&te.isWebGLRenderTarget)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let tn=Pe.get(te).__webglFramebuffer;if(te.isWebGLCubeRenderTarget&&Yt!==void 0&&(tn=tn[Yt]),tn){X.bindFramebuffer(ge.FRAMEBUFFER,tn);try{let hn=te.textures[kt],zn=hn.format,$n=hn.type;if(te.textures.length>1&&ge.readBuffer(ge.COLOR_ATTACHMENT0+kt),!le.textureFormatReadable(zn)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!le.textureTypeReadable($n)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Se>=0&&Se<=te.width-Le&&ke>=0&&ke<=te.height-De&&ge.readPixels(Se,ke,Le,De,wt.convert(zn),wt.convert($n),zt)}finally{let hn=ae!==null?Pe.get(ae).__webglFramebuffer:null;X.bindFramebuffer(ge.FRAMEBUFFER,hn)}}},this.readRenderTargetPixelsAsync=async function(te,Se,ke,Le,De,zt,Yt,kt=0){if(!(te&&te.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let tn=Pe.get(te).__webglFramebuffer;if(te.isWebGLCubeRenderTarget&&Yt!==void 0&&(tn=tn[Yt]),tn)if(Se>=0&&Se<=te.width-Le&&ke>=0&&ke<=te.height-De){X.bindFramebuffer(ge.FRAMEBUFFER,tn);let hn=te.textures[kt],zn=hn.format,$n=hn.type;if(te.textures.length>1&&ge.readBuffer(ge.COLOR_ATTACHMENT0+kt),!le.textureFormatReadable(zn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!le.textureTypeReadable($n))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let pn=ge.createBuffer();ge.bindBuffer(ge.PIXEL_PACK_BUFFER,pn),ge.bufferData(ge.PIXEL_PACK_BUFFER,zt.byteLength,ge.STREAM_READ),ge.readPixels(Se,ke,Le,De,wt.convert(zn),wt.convert($n),0);let Ui=ae!==null?Pe.get(ae).__webglFramebuffer:null;X.bindFramebuffer(ge.FRAMEBUFFER,Ui);let Vr=ge.fenceSync(ge.SYNC_GPU_COMMANDS_COMPLETE,0);return ge.flush(),await oW(ge,Vr,4),ge.bindBuffer(ge.PIXEL_PACK_BUFFER,pn),ge.getBufferSubData(ge.PIXEL_PACK_BUFFER,0,zt),ge.deleteBuffer(pn),ge.deleteSync(Vr),zt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(te,Se=null,ke=0){let Le=Math.pow(2,-ke),De=Math.floor(te.image.width*Le),zt=Math.floor(te.image.height*Le),Yt=Se!==null?Se.x:0,kt=Se!==null?Se.y:0;Ve.setTexture2D(te,0),ge.copyTexSubImage2D(ge.TEXTURE_2D,ke,0,0,Yt,kt,De,zt),X.unbindTexture()},this.copyTextureToTexture=function(te,Se,ke=null,Le=null,De=0,zt=0){let Yt,kt,tn,hn,zn,$n,pn,Ui,Vr,Mr=te.isCompressedTexture?te.mipmaps[zt]:te.image;if(ke!==null)Yt=ke.max.x-ke.min.x,kt=ke.max.y-ke.min.y,tn=ke.isBox3?ke.max.z-ke.min.z:1,hn=ke.min.x,zn=ke.min.y,$n=ke.isBox3?ke.min.z:0;else{let qr=Math.pow(2,-De);Yt=Math.floor(Mr.width*qr),kt=Math.floor(Mr.height*qr),te.isDataArrayTexture?tn=Mr.depth:te.isData3DTexture?tn=Math.floor(Mr.depth*qr):tn=1,hn=0,zn=0,$n=0}Le!==null?(pn=Le.x,Ui=Le.y,Vr=Le.z):(pn=0,Ui=0,Vr=0);let Wi=wt.convert(Se.format),ao=wt.convert(Se.type),Xt;Se.isData3DTexture?(Ve.setTexture3D(Se,0),Xt=ge.TEXTURE_3D):Se.isDataArrayTexture||Se.isCompressedArrayTexture?(Ve.setTexture2DArray(Se,0),Xt=ge.TEXTURE_2D_ARRAY):(Ve.setTexture2D(Se,0),Xt=ge.TEXTURE_2D),X.activeTexture(ge.TEXTURE0),X.pixelStorei(ge.UNPACK_FLIP_Y_WEBGL,Se.flipY),X.pixelStorei(ge.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Se.premultiplyAlpha),X.pixelStorei(ge.UNPACK_ALIGNMENT,Se.unpackAlignment);let La=X.getParameter(ge.UNPACK_ROW_LENGTH),mi=X.getParameter(ge.UNPACK_IMAGE_HEIGHT),al=X.getParameter(ge.UNPACK_SKIP_PIXELS),vc=X.getParameter(ge.UNPACK_SKIP_ROWS),Wh=X.getParameter(ge.UNPACK_SKIP_IMAGES);X.pixelStorei(ge.UNPACK_ROW_LENGTH,Mr.width),X.pixelStorei(ge.UNPACK_IMAGE_HEIGHT,Mr.height),X.pixelStorei(ge.UNPACK_SKIP_PIXELS,hn),X.pixelStorei(ge.UNPACK_SKIP_ROWS,zn),X.pixelStorei(ge.UNPACK_SKIP_IMAGES,$n);let C0=te.isDataArrayTexture||te.isData3DTexture,ji=Se.isDataArrayTexture||Se.isData3DTexture;if(te.isDepthTexture){let qr=Pe.get(te),jh=Pe.get(Se),tr=Pe.get(qr.__renderTarget),Xh=Pe.get(jh.__renderTarget);X.bindFramebuffer(ge.READ_FRAMEBUFFER,tr.__webglFramebuffer),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,Xh.__webglFramebuffer);for(let R0=0;R0<tn;R0++)C0&&(ge.framebufferTextureLayer(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Pe.get(te).__webglTexture,De,$n+R0),ge.framebufferTextureLayer(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Pe.get(Se).__webglTexture,zt,Vr+R0)),ge.blitFramebuffer(hn,zn,Yt,kt,pn,Ui,Yt,kt,ge.DEPTH_BUFFER_BIT,ge.NEAREST);X.bindFramebuffer(ge.READ_FRAMEBUFFER,null),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,null)}else if(De!==0||te.isRenderTargetTexture||Pe.has(te)){let qr=Pe.get(te),jh=Pe.get(Se);X.bindFramebuffer(ge.READ_FRAMEBUFFER,J),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,j);for(let tr=0;tr<tn;tr++)C0?ge.framebufferTextureLayer(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,qr.__webglTexture,De,$n+tr):ge.framebufferTexture2D(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,qr.__webglTexture,De),ji?ge.framebufferTextureLayer(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,jh.__webglTexture,zt,Vr+tr):ge.framebufferTexture2D(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,jh.__webglTexture,zt),De!==0?ge.blitFramebuffer(hn,zn,Yt,kt,pn,Ui,Yt,kt,ge.COLOR_BUFFER_BIT,ge.NEAREST):ji?ge.copyTexSubImage3D(Xt,zt,pn,Ui,Vr+tr,hn,zn,Yt,kt):ge.copyTexSubImage2D(Xt,zt,pn,Ui,hn,zn,Yt,kt);X.bindFramebuffer(ge.READ_FRAMEBUFFER,null),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,null)}else ji?te.isDataTexture||te.isData3DTexture?ge.texSubImage3D(Xt,zt,pn,Ui,Vr,Yt,kt,tn,Wi,ao,Mr.data):Se.isCompressedArrayTexture?ge.compressedTexSubImage3D(Xt,zt,pn,Ui,Vr,Yt,kt,tn,Wi,Mr.data):ge.texSubImage3D(Xt,zt,pn,Ui,Vr,Yt,kt,tn,Wi,ao,Mr):te.isDataTexture?ge.texSubImage2D(ge.TEXTURE_2D,zt,pn,Ui,Yt,kt,Wi,ao,Mr.data):te.isCompressedTexture?ge.compressedTexSubImage2D(ge.TEXTURE_2D,zt,pn,Ui,Mr.width,Mr.height,Wi,Mr.data):ge.texSubImage2D(ge.TEXTURE_2D,zt,pn,Ui,Yt,kt,Wi,ao,Mr);X.pixelStorei(ge.UNPACK_ROW_LENGTH,La),X.pixelStorei(ge.UNPACK_IMAGE_HEIGHT,mi),X.pixelStorei(ge.UNPACK_SKIP_PIXELS,al),X.pixelStorei(ge.UNPACK_SKIP_ROWS,vc),X.pixelStorei(ge.UNPACK_SKIP_IMAGES,Wh),zt===0&&Se.generateMipmaps&&ge.generateMipmap(Xt),X.unbindTexture()},this.initRenderTarget=function(te){Pe.get(te).__webglFramebuffer===void 0&&Ve.setupRenderTarget(te)},this.initTexture=function(te){te.isCubeTexture?Ve.setTextureCube(te,0):te.isData3DTexture?Ve.setTexture3D(te,0):te.isDataArrayTexture||te.isCompressedArrayTexture?Ve.setTexture2DArray(te,0):Ve.setTexture2D(te,0),X.unbindTexture()},this.resetState=function(){K=0,ee=0,ae=null,X.reset(),Dt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return mo}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=sn._getDrawingBufferColorSpace(e),t.unpackColorSpace=sn._getUnpackColorSpace()}};var u3=class extends Yi{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}},F_=new ie,HW=new on,WW=new on,jW=new ie,XW=new ie,h3=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(v,w){v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),w.parent===null&&w.matrixWorldAutoUpdate===!0&&w.updateMatrixWorld(),HW.copy(w.matrixWorldInverse),WW.multiplyMatrices(w.projectionMatrix,HW),u(v,v,w),this.sortObjects&&x(v)},this.setSize=function(v,w){n=v,r=w,s=n/2,o=r/2,l.style.width=v+"px",l.style.height=w+"px"};function c(v){v.isCSS2DObject&&(v.element.style.display="none");for(let w=0,S=v.children.length;w<S;w++)c(v.children[w])}function u(v,w,S){if(v.visible===!1){c(v);return}if(v.isCSS2DObject){F_.setFromMatrixPosition(v.matrixWorld),F_.applyMatrix4(WW);let T=F_.z>=-1&&F_.z<=1&&v.layers.test(S.layers)===!0,P=v.element;P.style.display=T===!0?"":"none",T===!0&&(v.onBeforeRender(t,w,S),P.style.transform="translate("+-100*v.center.x+"%,"+-100*v.center.y+"%)translate("+(F_.x*s+s)+"px,"+(-F_.y*o+o)+"px)",P.parentNode!==l&&l.appendChild(P),v.onAfterRender(t,w,S));let R={distanceToCameraSquared:f(S,v)};a.objects.set(v,R)}for(let T=0,P=v.children.length;T<P;T++)u(v.children[T],w,S)}function f(v,w){return jW.setFromMatrixPosition(v.matrixWorld),XW.setFromMatrixPosition(w.matrixWorld),jW.distanceToSquared(XW)}function p(v){let w=[];return v.traverseVisible(function(S){S.isCSS2DObject&&w.push(S)}),w}function x(v){let w=p(v).sort(function(T,P){if(T.renderOrder!==P.renderOrder)return P.renderOrder-T.renderOrder;let R=a.objects.get(T).distanceToCameraSquared,C=a.objects.get(P).distanceToCameraSquared;return R-C}),S=w.length;for(let T=0,P=w.length;T<P;T++)w[T].element.style.zIndex=S-T}}};function v0e(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var I2=v0e;var b0e=typeof global=="object"&&global&&global.Object===Object&&global,$W=b0e;var w0e=typeof self=="object"&&self&&self.Object===Object&&self,S0e=$W||w0e||Function("return this")(),f3=S0e;var T0e=function(){return f3.Date.now()},d3=T0e;var E0e=/\s/;function M0e(i){for(var e=i.length;e--&&E0e.test(i.charAt(e)););return e}var YW=M0e;var C0e=/^\s+/;function R0e(i){return i&&i.slice(0,YW(i)+1).replace(C0e,"")}var ZW=R0e;var P0e=f3.Symbol,O_=P0e;var KW=Object.prototype,I0e=KW.hasOwnProperty,N0e=KW.toString,N2=O_?O_.toStringTag:void 0;function L0e(i){var e=I0e.call(i,N2),t=i[N2];try{i[N2]=void 0;var n=!0}catch{}var r=N0e.call(i);return n&&(e?i[N2]=t:delete i[N2]),r}var QW=L0e;var D0e=Object.prototype,F0e=D0e.toString;function O0e(i){return F0e.call(i)}var JW=O0e;var B0e="[object Null]",U0e="[object Undefined]",ej=O_?O_.toStringTag:void 0;function k0e(i){return i==null?i===void 0?U0e:B0e:ej&&ej in Object(i)?QW(i):JW(i)}var tj=k0e;function G0e(i){return i!=null&&typeof i=="object"}var nj=G0e;var z0e="[object Symbol]";function V0e(i){return typeof i=="symbol"||nj(i)&&tj(i)==z0e}var ij=V0e;var rj=NaN,q0e=/^[-+]0x[0-9a-f]+$/i,H0e=/^0b[01]+$/i,W0e=/^0o[0-7]+$/i,j0e=parseInt;function X0e(i){if(typeof i=="number")return i;if(ij(i))return rj;if(I2(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=I2(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=ZW(i);var t=H0e.test(i);return t||W0e.test(i)?j0e(i.slice(2),t?2:8):q0e.test(i)?rj:+i}var YL=X0e;var $0e="Expected a function",Y0e=Math.max,Z0e=Math.min;function K0e(i,e,t){var n,r,s,o,a,l,c=0,u=!1,f=!1,p=!0;if(typeof i!="function")throw new TypeError($0e);e=YL(e)||0,I2(t)&&(u=!!t.leading,f="maxWait"in t,s=f?Y0e(YL(t.maxWait)||0,e):s,p="trailing"in t?!!t.trailing:p);function x(D){var F=n,N=r;return n=r=void 0,c=D,o=i.apply(N,F),o}function v(D){return c=D,a=setTimeout(T,e),u?x(D):o}function w(D){var F=D-l,N=D-c,B=e-F;return f?Z0e(B,s-N):B}function S(D){var F=D-l,N=D-c;return l===void 0||F>=e||F<0||f&&N>=s}function T(){var D=d3();if(S(D))return P(D);a=setTimeout(T,w(D))}function P(D){return a=void 0,p&&n?x(D):(n=r=void 0,o)}function R(){a!==void 0&&clearTimeout(a),c=0,n=l=r=a=void 0}function C(){return a===void 0?o:P(d3())}function L(){var D=d3(),F=S(D);if(n=arguments,r=this,l=D,F){if(a===void 0)return v(l);if(f)return clearTimeout(a),a=setTimeout(T,e),x(l)}return a===void 0&&(a=setTimeout(T,e)),o}return L.cancel=R,L.flush=C,L}var sj=K0e;function oj(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 Q0e(i){if(Array.isArray(i))return i}function J0e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function eAe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function tAe(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 nAe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4117-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iAe(i,e){return Q0e(i)||tAe(i,e)||rAe(i,e)||nAe()}function rAe(i,e){if(i){if(typeof i=="string")return oj(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)?oj(i,e):void 0}}var sAe=eAe(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;J0e(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Fr(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,p=f===void 0?function(){}:f,x=Object.keys(r).map(function(v){return new sAe(v,r[v])});return function v(){for(var w=arguments.length,S=new Array(w),T=0;T<w;T++)S[T]=arguments[T];var P=!!(this instanceof v&&this.constructor),R=P?S.shift():void 0,C=S[0],L=C===void 0?{}:C,D=Object.assign({},t instanceof Function?t(L):t,{initialised:!1}),F={};function N(V){return B(V,L),z(),N}var B=function(H,Z){u.call(N,H,D,Z),D.initialised=!0},z=sj(function(){D.initialised&&(p.call(N,D,F),F={})},1);return x.forEach(function(V){N[V.name]=H(V);function H(Z){var J=Z.name,j=Z.triggerUpdate,K=j===void 0?!1:j,ee=Z.onChange,ae=ee===void 0?function(ve,Ie){}:ee,ce=Z.defaultVal,de=ce===void 0?null:ce;return function(ve){var Ie=D[J];if(!arguments.length)return Ie;var Qe=ve===void 0?de:ve;return D[J]=Qe,ae.call(N,Qe,D,Ie),!F.hasOwnProperty(J)&&(F[J]=Ie),K&&z(),N}}}),Object.keys(o).forEach(function(V){N[V]=function(){for(var H,Z=arguments.length,J=new Array(Z),j=0;j<Z;j++)J[j]=arguments[j];return(H=o[V]).call.apply(H,[N,D].concat(J))}}),Object.entries(l).forEach(function(V){var H=iAe(V,2),Z=H[0],J=H[1];return N[Z]=N[J]}),N.resetProps=function(){return x.forEach(function(V){N[V.name](V.defaultVal)}),N},N.resetProps(),D._rerender=z,P&&R&&N(R),N}}var Or=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-Or.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?Or.Bounce.In(i*2)*.5:Or.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}}}}),L2=function(){return performance.now()},ZA=(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=L2()),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})(),B_={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=B_.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=B_.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=B_.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=B_.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}}},aj=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),ZL=new ZA,Hs=(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=Or.Linear.None,this._interpolationFunction=B_.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=aj.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=ZL,ZL.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=L2()),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 p=[a],x=0,v=f.length;x<v;x+=1){var w=this._handleRelativeValue(a,f[x]);if(isNaN(w)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}p.push(w)}u&&(n[o]=p)}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 P={};for(var T in f)P[T]=f[T];n[o]=f=P}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=L2()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=L2()),!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=Or.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=B_.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=L2()),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 p=Math.min(Math.trunc((o-this._duration)/a)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=p);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*p,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var x=0,v=this._chainedTweens.length;x<v;x++)this._chainedTweens[x].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 MHe=aj.nextId,sh=ZL,CHe=sh.getAll.bind(sh),RHe=sh.removeAll.bind(sh),PHe=sh.add.bind(sh),IHe=sh.remove.bind(sh),NHe=sh.update.bind(sh);function lj(i){let e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return cj(this.cover(e,t,n),e,t,n,i)}function cj(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,p=i._y1,x=i._z1,v,w,S,T,P,R,C,L,D,F,N;if(!o)return i._root=a,i;for(;o.length;)if((C=e>=(v=(l+f)/2))?l=v:f=v,(L=t>=(w=(c+p)/2))?c=w:p=w,(D=n>=(S=(u+x)/2))?u=S:x=S,s=o,!(o=o[F=D<<2|L<<1|C]))return s[F]=a,i;if(T=+i._x.call(null,o.data),P=+i._y.call(null,o.data),R=+i._z.call(null,o.data),e===T&&t===P&&n===R)return a.next=o,s?s[F]=a:i._root=a,i;do s=s?s[F]=new Array(8):i._root=new Array(8),(C=e>=(v=(l+f)/2))?l=v:f=v,(L=t>=(w=(c+p)/2))?c=w:p=w,(D=n>=(S=(u+x)/2))?u=S:x=S;while((F=D<<2|L<<1|C)===(N=(R>=S)<<2|(P>=w)<<1|T>=v));return s[N]=o,s[F]=a,i}function uj(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,p,x,v,w;f<e;++f)isNaN(x=+this._x.call(null,p=i[f]))||isNaN(v=+this._y.call(null,p))||isNaN(w=+this._z.call(null,p))||(t[f]=x,n[f]=v,r[f]=w,x<s&&(s=x),x>l&&(l=x),v<o&&(o=v),v>c&&(c=v),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)cj(this,t[f],n[f],r[f],i[f]);return this}function hj(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,p;n>i||i>=o||r>e||e>=a||s>t||t>=l;)switch(p=(t<s)<<2|(e<r)<<1|i<n,f=new Array(8),f[p]=u,u=f,c*=2,p){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 fj(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function dj(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 Fi(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 pj(i,e,t,n){var r,s=this._x0,o=this._y0,a=this._z0,l,c,u,f,p,x,v=this._x1,w=this._y1,S=this._z1,T=[],P=this._root,R,C;for(P&&T.push(new Fi(P,s,o,a,v,w,S)),n==null?n=1/0:(s=i-n,o=e-n,a=t-n,v=i+n,w=e+n,S=t+n,n*=n);R=T.pop();)if(!(!(P=R.node)||(l=R.x0)>v||(c=R.y0)>w||(u=R.z0)>S||(f=R.x1)<s||(p=R.y1)<o||(x=R.z1)<a))if(P.length){var L=(l+f)/2,D=(c+p)/2,F=(u+x)/2;T.push(new Fi(P[7],L,D,F,f,p,x),new Fi(P[6],l,D,F,L,p,x),new Fi(P[5],L,c,F,f,D,x),new Fi(P[4],l,c,F,L,D,x),new Fi(P[3],L,D,u,f,p,F),new Fi(P[2],l,D,u,L,p,F),new Fi(P[1],L,c,u,f,D,F),new Fi(P[0],l,c,u,L,D,F)),(C=(t>=F)<<2|(e>=D)<<1|i>=L)&&(R=T[T.length-1],T[T.length-1]=T[T.length-1-C],T[T.length-1-C]=R)}else{var N=i-+this._x.call(null,P.data),B=e-+this._y.call(null,P.data),z=t-+this._z.call(null,P.data),V=N*N+B*B+z*z;if(V<n){var H=Math.sqrt(n=V);s=i-H,o=e-H,a=t-H,v=i+H,w=e+H,S=t+H,r=P.data}}return r}var oAe=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function Aj(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,p,x,v,w,S,T)=>{if(!f.length)do{let P=f.data;oAe(i,e,t,this._x(P),this._y(P),this._z(P))<=n&&r.push(P)}while(f=f.next);return p>l||x>c||v>u||w<s||S<o||T<a}),r}function mj(i){if(isNaN(p=+this._x.call(null,i))||isNaN(x=+this._y.call(null,i))||isNaN(v=+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,p,x,v,w,S,T,P,R,C,L,D;if(!t)return this;if(t.length)for(;;){if((P=p>=(w=(o+c)/2))?o=w:c=w,(R=x>=(S=(a+u)/2))?a=S:u=S,(C=v>=(T=(l+f)/2))?l=T:f=T,e=t,!(t=t[L=C<<2|R<<1|P]))return this;if(!t.length)break;(e[L+1&7]||e[L+2&7]||e[L+3&7]||e[L+4&7]||e[L+5&7]||e[L+6&7]||e[L+7&7])&&(n=e,D=L)}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[L]=s:delete e[L],(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 gj(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function _j(){return this._root}function xj(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function yj(i){var e=[],t,n=this._root,r,s,o,a,l,c,u;for(n&&e.push(new Fi(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,p=(o+c)/2,x=(a+u)/2;(r=n[7])&&e.push(new Fi(r,f,p,x,l,c,u)),(r=n[6])&&e.push(new Fi(r,s,p,x,f,c,u)),(r=n[5])&&e.push(new Fi(r,f,o,x,l,p,u)),(r=n[4])&&e.push(new Fi(r,s,o,x,f,p,u)),(r=n[3])&&e.push(new Fi(r,f,p,a,l,c,x)),(r=n[2])&&e.push(new Fi(r,s,p,a,f,c,x)),(r=n[1])&&e.push(new Fi(r,f,o,a,l,p,x)),(r=n[0])&&e.push(new Fi(r,s,o,a,f,p,x))}return this}function vj(i){var e=[],t=[],n;for(this._root&&e.push(new Fi(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,p=(o+c)/2,x=(a+u)/2,v=(l+f)/2;(s=r[0])&&e.push(new Fi(s,o,a,l,p,x,v)),(s=r[1])&&e.push(new Fi(s,p,a,l,c,x,v)),(s=r[2])&&e.push(new Fi(s,o,x,l,p,u,v)),(s=r[3])&&e.push(new Fi(s,p,x,l,c,u,v)),(s=r[4])&&e.push(new Fi(s,o,a,v,p,x,f)),(s=r[5])&&e.push(new Fi(s,p,a,v,c,x,f)),(s=r[6])&&e.push(new Fi(s,o,x,v,p,u,f)),(s=r[7])&&e.push(new Fi(s,p,x,v,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 bj(i){return i[0]}function wj(i){return arguments.length?(this._x=i,this):this._x}function Sj(i){return i[1]}function Tj(i){return arguments.length?(this._y=i,this):this._y}function Ej(i){return i[2]}function Mj(i){return arguments.length?(this._z=i,this):this._z}function D2(i,e,t,n){var r=new KL(e??bj,t??Sj,n??Ej,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function KL(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 Cj(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var yo=D2.prototype=KL.prototype;yo.copy=function(){var i=new KL(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=Cj(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]=Cj(n));return i};yo.add=lj;yo.addAll=uj;yo.cover=hj;yo.data=fj;yo.extent=dj;yo.find=pj;yo.findAllWithinRadius=Aj;yo.remove=mj;yo.removeAll=gj;yo.root=_j;yo.size=xj;yo.visit=yj;yo.visitAfter=vj;yo.x=wj;yo.y=Tj;yo.z=Mj;function KA(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function QL(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function p3(i){let e,t,n;i.length!==2?(e=KA,t=(a,l)=>KA(i(a),l),n=(a,l)=>i(a)-l):(e=i===KA||i===QL?i:aAe,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 aAe(){return 0}function JL(i){return i===null?NaN:+i}var Rj=p3(KA),Pj=Rj.right,lAe=Rj.left,cAe=p3(JL).center,F2=Pj;function Bp(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 vo=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 uAe=Math.sqrt(50),hAe=Math.sqrt(10),fAe=Math.sqrt(2);function A3(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>=uAe?10:s>=hAe?5:s>=fAe?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?A3(i,e,t*2):[a,l,c]}function m3(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?A3(e,i,t):A3(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 O2(i,e,t){return e=+e,i=+i,t=+t,A3(i,e,t)[2]}function eD(i,e,t){e=+e,i=+i,t=+t;let n=e<i,r=n?O2(e,i,t):O2(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function g3(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 _3(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*dAe(i){for(let e of i)yield*e}function oh(i){return Array.from(dAe(i))}function Gf(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 x3(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 y3(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function v3(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function tD(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function k2(){}var B2=.7,S3=1/B2,U_="\\s*([+-]?\\d+)\\s*",U2="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ah="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",pAe=/^#([0-9a-f]{3,8})$/,AAe=new RegExp(`^rgb\\(${U_},${U_},${U_}\\)$`),mAe=new RegExp(`^rgb\\(${ah},${ah},${ah}\\)$`),gAe=new RegExp(`^rgba\\(${U_},${U_},${U_},${U2}\\)$`),_Ae=new RegExp(`^rgba\\(${ah},${ah},${ah},${U2}\\)$`),xAe=new RegExp(`^hsl\\(${U2},${ah},${ah}\\)$`),yAe=new RegExp(`^hsla\\(${U2},${ah},${ah},${U2}\\)$`),Ij={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};v3(k2,Yc,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:Nj,formatHex:Nj,formatHex8:vAe,formatHsl:bAe,formatRgb:Lj,toString:Lj});function Nj(){return this.rgb().formatHex()}function vAe(){return this.rgb().formatHex8()}function bAe(){return kj(this).formatHsl()}function Lj(){return this.rgb().formatRgb()}function Yc(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=pAe.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?Dj(e):t===3?new Xa(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?b3(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?b3(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=AAe.exec(i))?new Xa(e[1],e[2],e[3],1):(e=mAe.exec(i))?new Xa(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=gAe.exec(i))?b3(e[1],e[2],e[3],e[4]):(e=_Ae.exec(i))?b3(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=xAe.exec(i))?Bj(e[1],e[2]/100,e[3]/100,1):(e=yAe.exec(i))?Bj(e[1],e[2]/100,e[3]/100,e[4]):Ij.hasOwnProperty(i)?Dj(Ij[i]):i==="transparent"?new Xa(NaN,NaN,NaN,0):null}function Dj(i){return new Xa(i>>16&255,i>>8&255,i&255,1)}function b3(i,e,t,n){return n<=0&&(i=e=t=NaN),new Xa(i,e,t,n)}function wAe(i){return i instanceof k2||(i=Yc(i)),i?(i=i.rgb(),new Xa(i.r,i.g,i.b,i.opacity)):new Xa}function k_(i,e,t,n){return arguments.length===1?wAe(i):new Xa(i,e,t,n??1)}function Xa(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}v3(Xa,k_,tD(k2,{brighter(i){return i=i==null?S3:Math.pow(S3,i),new Xa(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?B2:Math.pow(B2,i),new Xa(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new Xa(JA(this.r),JA(this.g),JA(this.b),T3(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:Fj,formatHex:Fj,formatHex8:SAe,formatRgb:Oj,toString:Oj}));function Fj(){return`#${QA(this.r)}${QA(this.g)}${QA(this.b)}`}function SAe(){return`#${QA(this.r)}${QA(this.g)}${QA(this.b)}${QA((isNaN(this.opacity)?1:this.opacity)*255)}`}function Oj(){let i=T3(this.opacity);return`${i===1?"rgb(":"rgba("}${JA(this.r)}, ${JA(this.g)}, ${JA(this.b)}${i===1?")":`, ${i})`}`}function T3(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function JA(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function QA(i){return i=JA(i),(i<16?"0":"")+i.toString(16)}function Bj(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new $c(i,e,t,n)}function kj(i){if(i instanceof $c)return new $c(i.h,i.s,i.l,i.opacity);if(i instanceof k2||(i=Yc(i)),!i)return new $c;if(i instanceof $c)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 $c(o,a,l,i.opacity)}function Gj(i,e,t,n){return arguments.length===1?kj(i):new $c(i,e,t,n??1)}function $c(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}v3($c,Gj,tD(k2,{brighter(i){return i=i==null?S3:Math.pow(S3,i),new $c(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?B2:Math.pow(B2,i),new $c(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 Xa(nD(i>=240?i-240:i+120,r,n),nD(i,r,n),nD(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new $c(Uj(this.h),w3(this.s),w3(this.l),T3(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=T3(this.opacity);return`${i===1?"hsl(":"hsla("}${Uj(this.h)}, ${w3(this.s)*100}%, ${w3(this.l)*100}%${i===1?")":`, ${i})`}`}}));function Uj(i){return i=(i||0)%360,i<0?i+360:i}function w3(i){return Math.max(0,Math.min(1,i||0))}function nD(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 iD(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 zj(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 iD((t-n/e)*e,o,r,s,a)}}function Vj(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 iD((t-n/e)*e,r,s,o,a)}}var G2=i=>()=>i;function TAe(i,e){return function(t){return i+t*e}}function EAe(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 qj(i){return(i=+i)==1?E3:function(e,t){return t-e?EAe(e,t,i):G2(isNaN(e)?t:e)}}function E3(i,e){var t=e-i;return t?TAe(i,t):G2(isNaN(i)?e:i)}var rD=(function i(e){var t=qj(e);function n(r,s){var o=t((r=k_(r)).r,(s=k_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),c=E3(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 Hj(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=k_(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 aje=Hj(zj),lje=Hj(Vj);function M3(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 C3(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function sD(i,e){return(C3(e)?M3:oD)(i,e)}function oD(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]=em(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 Wj(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function lh(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function jj(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]=em(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var lD=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,aD=new RegExp(lD.source,"g");function MAe(i){return function(){return i}}function CAe(i){return function(e){return i(e)+""}}function Xj(i,e){var t=lD.lastIndex=aD.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=lD.exec(i))&&(r=aD.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:lh(n,r)})),t=aD.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?CAe(l[0].x):MAe(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 em(i,e){var t=typeof e,n;return e==null||t==="boolean"?G2(e):(t==="number"?lh:t==="string"?(n=Yc(e))?(e=n,rD):Xj:e instanceof Yc?rD:e instanceof Date?Wj:C3(e)?M3:Array.isArray(e)?oD:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?jj:lh)(i,e)}function cD(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function uD(i){return function(){return i}}function hD(i){return+i}var $j=[0,1];function G_(i){return i}function fD(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:uD(isNaN(e)?NaN:.5)}function RAe(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function PAe(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=fD(r,n),s=t(o,s)):(n=fD(n,r),s=t(s,o)),function(a){return s(n(a))}}function IAe(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]=fD(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=F2(i,a,1,n)-1;return s[l](r[l](a))}}function Yj(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function NAe(){var i=$j,e=$j,t=em,n,r,s,o=G_,a,l,c;function u(){var p=Math.min(i.length,e.length);return o!==G_&&(o=RAe(i[0],i[p-1])),a=p>2?IAe:PAe,l=c=null,f}function f(p){return p==null||isNaN(p=+p)?s:(l||(l=a(i.map(n),e,t)))(n(o(p)))}return f.invert=function(p){return o(r((c||(c=a(e,i.map(n),lh)))(p)))},f.domain=function(p){return arguments.length?(i=Array.from(p,hD),u()):i.slice()},f.range=function(p){return arguments.length?(e=Array.from(p),u()):e.slice()},f.rangeRound=function(p){return e=Array.from(p),t=cD,u()},f.clamp=function(p){return arguments.length?(o=p?!0:G_,u()):o!==G_},f.interpolate=function(p){return arguments.length?(t=p,u()):t},f.unknown=function(p){return arguments.length?(s=p,f):s},function(p,x){return n=p,r=x,u()}}function dD(){return NAe()(G_,G_)}function Zj(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function tm(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 ch(i){return i=tm(Math.abs(i)),i?i[1]:NaN}function Kj(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 Qj(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var LAe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Up(i){if(!(e=LAe.exec(i)))throw new Error("invalid format: "+i);var e;return new R3({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]})}Up.prototype=R3.prototype;function R3(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+""}R3.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 Jj(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 z2;function eX(i,e){var t=tm(i,e);if(!t)return z2=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(z2=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")+tm(i,Math.max(0,e+s-1))[0]}function pD(i,e){var t=tm(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 AD={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:Zj,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)=>pD(i*100,e),r:pD,s:eX,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function mD(i){return i}var tX=Array.prototype.map,nX=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function iX(i){var e=i.grouping===void 0||i.thousands===void 0?mD:Kj(tX.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?mD:Qj(tX.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,p){f=Up(f);var x=f.fill,v=f.align,w=f.sign,S=f.symbol,T=f.zero,P=f.width,R=f.comma,C=f.precision,L=f.trim,D=f.type;D==="n"?(R=!0,D="g"):AD[D]||(C===void 0&&(C=12),L=!0,D="g"),(T||x==="0"&&v==="=")&&(T=!0,x="0",v="=");var F=(p&&p.prefix!==void 0?p.prefix:"")+(S==="$"?t:S==="#"&&/[boxX]/.test(D)?"0"+D.toLowerCase():""),N=(S==="$"?n:/[%p]/.test(D)?o:"")+(p&&p.suffix!==void 0?p.suffix:""),B=AD[D],z=/[defgprs%]/.test(D);C=C===void 0?6:/[gprs]/.test(D)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function V(H){var Z=F,J=N,j,K,ee;if(D==="c")J=B(H)+J,H="";else{H=+H;var ae=H<0||1/H<0;if(H=isNaN(H)?l:B(Math.abs(H),C),L&&(H=Jj(H)),ae&&+H==0&&w!=="+"&&(ae=!1),Z=(ae?w==="("?w:a:w==="-"||w==="("?"":w)+Z,J=(D==="s"&&!isNaN(H)&&z2!==void 0?nX[8+z2/3]:"")+J+(ae&&w==="("?")":""),z){for(j=-1,K=H.length;++j<K;)if(ee=H.charCodeAt(j),48>ee||ee>57){J=(ee===46?r+H.slice(j+1):H.slice(j))+J,H=H.slice(0,j);break}}}R&&!T&&(H=e(H,1/0));var ce=Z.length+H.length+J.length,de=ce<P?new Array(P-ce+1).join(x):"";switch(R&&T&&(H=e(de+H,de.length?P-J.length:1/0),de=""),v){case"<":H=Z+H+J+de;break;case"=":H=Z+de+H+J;break;case"^":H=de.slice(0,ce=de.length>>1)+Z+H+J+de.slice(ce);break;default:H=de+Z+H+J;break}return s(H)}return V.toString=function(){return f+""},V}function u(f,p){var x=Math.max(-8,Math.min(8,Math.floor(ch(p)/3)))*3,v=Math.pow(10,-x),w=c((f=Up(f),f.type="f",f),{suffix:nX[8+x/3]});return function(S){return w(v*S)}}return{format:c,formatPrefix:u}}var P3,I3,N3;gD({thousands:",",grouping:[3],currency:["$",""]});function gD(i){return P3=iX(i),I3=P3.format,N3=P3.formatPrefix,P3}function _D(i){return Math.max(0,-ch(Math.abs(i)))}function xD(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ch(e)/3)))*3-ch(Math.abs(i)))}function yD(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,ch(e)-ch(i))+1}function vD(i,e,t,n){var r=eD(i,e,t),s;switch(n=Up(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=xD(r,o))&&(n.precision=s),N3(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=yD(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=_D(r))&&(n.precision=s-(n.type==="%")*2);break}}return I3(n)}function bD(i){var e=i.domain;return i.ticks=function(t){var n=e();return m3(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return vD(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=O2(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 $a(){var i=dD();return i.copy=function(){return Yj(i,$a())},y3.apply(i,arguments),bD(i)}function V2(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[F2(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 V2().domain([i,e]).range(r).unknown(s)},y3.apply(bD(o),arguments)}var Cn=1e-6,nm=1e-12,Jn=Math.PI,to=Jn/2,z_=Jn/4,no=Jn*2,Ki=180/Jn,mn=Jn/180,ei=Math.abs,V_=Math.atan,cs=Math.atan2,fn=Math.cos,q2=Math.ceil,rX=Math.exp;var L3=Math.hypot,sX=Math.log;var an=Math.sin,oX=Math.sign||function(i){return i>0?1:i<0?-1:0},bo=Math.sqrt,aX=Math.tan;function lX(i){return i>1?0:i<-1?Jn:Math.acos(i)}function Wo(i){return i>1?to:i<-1?-to:Math.asin(i)}function wD(i){return(i=an(i/2))*i}function Zr(){}function D3(i,e){i&&uX.hasOwnProperty(i.type)&&uX[i.type](i,e)}var cX={Feature:function(i,e){D3(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)D3(t[n].geometry,e)}},uX={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){SD(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)SD(t[n],e,0)},Polygon:function(i,e){hX(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)hX(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)D3(t[n],e)}};function SD(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 hX(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)SD(i[t],e,1);e.polygonEnd()}function kp(i,e){i&&cX.hasOwnProperty(i.type)?cX[i.type](i,e):D3(i,e)}var H2=new vo,fX=new vo,dX,pX,TD,ED,MD,uh={point:Zr,lineStart:Zr,lineEnd:Zr,polygonStart:function(){H2=new vo,uh.lineStart=DAe,uh.lineEnd=FAe},polygonEnd:function(){var i=+H2;fX.add(i<0?no+i:i),this.lineStart=this.lineEnd=this.point=Zr},sphere:function(){fX.add(no)}};function DAe(){uh.point=OAe}function FAe(){AX(dX,pX)}function OAe(i,e){uh.point=AX,dX=i,pX=e,i*=mn,e*=mn,TD=i,ED=fn(e=e/2+z_),MD=an(e)}function AX(i,e){i*=mn,e*=mn,e=e/2+z_;var t=i-TD,n=t>=0?1:-1,r=n*t,s=fn(e),o=an(e),a=MD*o,l=ED*s+a*fn(r),c=a*n*an(r);H2.add(cs(c,l)),TD=i,ED=s,MD=o}function im(i){return[cs(i[1],i[0]),Wo(i[2])]}function sc(i){var e=i[0],t=i[1],n=fn(t);return[n*fn(e),n*an(e),an(t)]}function W2(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function zf(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 F3(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function j2(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function rm(i){var e=bo(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var Br,Ya,Kr,wl,sm,xX,yX,q_,X2,Gp,qf,Vf={point:CD,lineStart:mX,lineEnd:gX,polygonStart:function(){Vf.point=bX,Vf.lineStart=BAe,Vf.lineEnd=UAe,X2=new vo,uh.polygonStart()},polygonEnd:function(){uh.polygonEnd(),Vf.point=CD,Vf.lineStart=mX,Vf.lineEnd=gX,H2<0?(Br=-(Kr=180),Ya=-(wl=90)):X2>Cn?wl=90:X2<-Cn&&(Ya=-90),qf[0]=Br,qf[1]=Kr},sphere:function(){Br=-(Kr=180),Ya=-(wl=90)}};function CD(i,e){Gp.push(qf=[Br=i,Kr=i]),e<Ya&&(Ya=e),e>wl&&(wl=e)}function vX(i,e){var t=sc([i*mn,e*mn]);if(q_){var n=zf(q_,t),r=[n[1],-n[0],0],s=zf(r,n);rm(s),s=im(s);var o=i-sm,a=o>0?1:-1,l=s[0]*Ki*a,c,u=ei(o)>180;u^(a*sm<l&&l<a*i)?(c=s[1]*Ki,c>wl&&(wl=c)):(l=(l+360)%360-180,u^(a*sm<l&&l<a*i)?(c=-s[1]*Ki,c<Ya&&(Ya=c)):(e<Ya&&(Ya=e),e>wl&&(wl=e))),u?i<sm?bl(Br,i)>bl(Br,Kr)&&(Kr=i):bl(i,Kr)>bl(Br,Kr)&&(Br=i):Kr>=Br?(i<Br&&(Br=i),i>Kr&&(Kr=i)):i>sm?bl(Br,i)>bl(Br,Kr)&&(Kr=i):bl(i,Kr)>bl(Br,Kr)&&(Br=i)}else Gp.push(qf=[Br=i,Kr=i]);e<Ya&&(Ya=e),e>wl&&(wl=e),q_=t,sm=i}function mX(){Vf.point=vX}function gX(){qf[0]=Br,qf[1]=Kr,Vf.point=CD,q_=null}function bX(i,e){if(q_){var t=i-sm;X2.add(ei(t)>180?t+(t>0?360:-360):t)}else xX=i,yX=e;uh.point(i,e),vX(i,e)}function BAe(){uh.lineStart()}function UAe(){bX(xX,yX),uh.lineEnd(),ei(X2)>Cn&&(Br=-(Kr=180)),qf[0]=Br,qf[1]=Kr,q_=null}function bl(i,e){return(e-=i)<0?e+360:e}function kAe(i,e){return i[0]-e[0]}function _X(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:e<i[0]||i[1]<e}function O3(i){var e,t,n,r,s,o,a;if(wl=Kr=-(Br=Ya=1/0),Gp=[],kp(i,Vf),t=Gp.length){for(Gp.sort(kAe),e=1,n=Gp[0],s=[n];e<t;++e)r=Gp[e],_X(n,r[0])||_X(n,r[1])?(bl(n[0],r[1])>bl(n[0],n[1])&&(n[1]=r[1]),bl(r[0],n[1])>bl(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=bl(n[1],r[0]))>o&&(o=a,Br=r[0],Kr=n[1])}return Gp=qf=null,Br===1/0||Ya===1/0?[[NaN,NaN],[NaN,NaN]]:[[Br,Ya],[Kr,wl]]}var $2,B3,U3,k3,G3,z3,V3,q3,RD,PD,ID,TX,EX,xa,ya,va,Zc={sphere:Zr,point:ND,lineStart:wX,lineEnd:SX,polygonStart:function(){Zc.lineStart=VAe,Zc.lineEnd=qAe},polygonEnd:function(){Zc.lineStart=wX,Zc.lineEnd=SX}};function ND(i,e){i*=mn,e*=mn;var t=fn(e);Y2(t*fn(i),t*an(i),an(e))}function Y2(i,e,t){++$2,U3+=(i-U3)/$2,k3+=(e-k3)/$2,G3+=(t-G3)/$2}function wX(){Zc.point=GAe}function GAe(i,e){i*=mn,e*=mn;var t=fn(e);xa=t*fn(i),ya=t*an(i),va=an(e),Zc.point=zAe,Y2(xa,ya,va)}function zAe(i,e){i*=mn,e*=mn;var t=fn(e),n=t*fn(i),r=t*an(i),s=an(e),o=cs(bo((o=ya*s-va*r)*o+(o=va*n-xa*s)*o+(o=xa*r-ya*n)*o),xa*n+ya*r+va*s);B3+=o,z3+=o*(xa+(xa=n)),V3+=o*(ya+(ya=r)),q3+=o*(va+(va=s)),Y2(xa,ya,va)}function SX(){Zc.point=ND}function VAe(){Zc.point=HAe}function qAe(){MX(TX,EX),Zc.point=ND}function HAe(i,e){TX=i,EX=e,i*=mn,e*=mn,Zc.point=MX;var t=fn(e);xa=t*fn(i),ya=t*an(i),va=an(e),Y2(xa,ya,va)}function MX(i,e){i*=mn,e*=mn;var t=fn(e),n=t*fn(i),r=t*an(i),s=an(e),o=ya*s-va*r,a=va*n-xa*s,l=xa*r-ya*n,c=L3(o,a,l),u=Wo(c),f=c&&-u/c;RD.add(f*o),PD.add(f*a),ID.add(f*l),B3+=u,z3+=u*(xa+(xa=n)),V3+=u*(ya+(ya=r)),q3+=u*(va+(va=s)),Y2(xa,ya,va)}function H3(i){$2=B3=U3=k3=G3=z3=V3=q3=0,RD=new vo,PD=new vo,ID=new vo,kp(i,Zc);var e=+RD,t=+PD,n=+ID,r=L3(e,t,n);return r<nm&&(e=z3,t=V3,n=q3,B3<Cn&&(e=U3,t=k3,n=G3),r=L3(e,t,n),r<nm)?[NaN,NaN]:[cs(t,e)*Ki,Wo(n/r)*Ki]}function Z2(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 LD(i,e){return ei(i)>Jn&&(i-=Math.round(i/no)*no),[i,e]}LD.invert=LD;function DD(i,e,t){return(i%=no)?e||t?Z2(RX(i),PX(e,t)):RX(i):e||t?PX(e,t):LD}function CX(i){return function(e,t){return e+=i,ei(e)>Jn&&(e-=Math.round(e/no)*no),[e,t]}}function RX(i){var e=CX(i);return e.invert=CX(-i),e}function PX(i,e){var t=fn(i),n=an(i),r=fn(e),s=an(e);function o(a,l){var c=fn(l),u=fn(a)*c,f=an(a)*c,p=an(l),x=p*t+u*n;return[cs(f*r-x*s,u*t-p*n),Wo(x*r+f*s)]}return o.invert=function(a,l){var c=fn(l),u=fn(a)*c,f=an(a)*c,p=an(l),x=p*r-f*s;return[cs(f*r+p*s,u*t+x*n),Wo(x*t-u*n)]},o}function FD(i){i=DD(i[0]*mn,i[1]*mn,i.length>2?i[2]*mn:0);function e(t){return t=i(t[0]*mn,t[1]*mn),t[0]*=Ki,t[1]*=Ki,t}return e.invert=function(t){return t=i.invert(t[0]*mn,t[1]*mn),t[0]*=Ki,t[1]*=Ki,t},e}function NX(i,e,t,n,r,s){if(t){var o=fn(e),a=an(e),l=n*t;r==null?(r=e+n*no,s=e-l/2):(r=IX(o,r),s=IX(o,s),(n>0?r<s:r>s)&&(r+=n*no));for(var c,u=r;n>0?u>s:u<s;u-=l)c=im([o,-a*fn(u),-a*an(u)]),i.point(c[0],c[1])}}function IX(i,e){e=sc(e),e[0]-=i,rm(e);var t=lX(-e[1]);return((-e[2]<0?-t:t)+no-Cn)%no}function W3(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:Zr,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function H_(i,e){return ei(i[0]-e[0])<Cn&&ei(i[1]-e[1])<Cn}function j3(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 X3(i,e,t,n,r){var s=[],o=[],a,l;if(i.forEach(function(v){if(!((w=v.length-1)<=0)){var w,S=v[0],T=v[w],P;if(H_(S,T)){if(!S[2]&&!T[2]){for(r.lineStart(),a=0;a<w;++a)r.point((S=v[a])[0],S[1]);r.lineEnd();return}T[0]+=2*Cn}s.push(P=new j3(S,v,null,!0)),o.push(P.o=new j3(S,null,P,!1)),s.push(P=new j3(T,v,null,!1)),o.push(P.o=new j3(T,null,P,!0))}}),!!s.length){for(o.sort(e),LX(s),LX(o),a=0,l=o.length;a<l;++a)o[a].e=t=!t;for(var c=s[0],u,f;;){for(var p=c,x=!0;p.v;)if((p=p.n)===c)return;u=p.z,r.lineStart();do{if(p.v=p.o.v=!0,p.e){if(x)for(a=0,l=u.length;a<l;++a)r.point((f=u[a])[0],f[1]);else n(p.x,p.n.x,1,r);p=p.n}else{if(x)for(u=p.p.z,a=u.length-1;a>=0;--a)r.point((f=u[a])[0],f[1]);else n(p.x,p.p.x,-1,r);p=p.p}p=p.o,u=p.z,x=!x}while(!p.v);r.lineEnd()}}}function LX(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 OD(i){return ei(i[0])<=Jn?i[0]:oX(i[0])*((ei(i[0])+Jn)%no-Jn)}function $3(i,e){var t=OD(e),n=e[1],r=an(n),s=[an(t),-fn(t),0],o=0,a=0,l=new vo;r===1?n=to+Cn:r===-1&&(n=-to-Cn);for(var c=0,u=i.length;c<u;++c)if(p=(f=i[c]).length)for(var f,p,x=f[p-1],v=OD(x),w=x[1]/2+z_,S=an(w),T=fn(w),P=0;P<p;++P,v=C,S=D,T=F,x=R){var R=f[P],C=OD(R),L=R[1]/2+z_,D=an(L),F=fn(L),N=C-v,B=N>=0?1:-1,z=B*N,V=z>Jn,H=S*D;if(l.add(cs(H*B*an(z),T*F+H*fn(z))),o+=V?N+B*no:N,V^v>=t^C>=t){var Z=zf(sc(x),sc(R));rm(Z);var J=zf(s,Z);rm(J);var j=(V^N>=0?-1:1)*Wo(J[2]);(n>j||n===j&&(Z[0]||Z[1]))&&(a+=V^N>=0?1:-1)}}return(o<-Cn||o<Cn&&l<-nm)^a&1}function Y3(i,e,t,n){return function(r){var s=e(r),o=W3(),a=e(o),l=!1,c,u,f,p={point:x,lineStart:w,lineEnd:S,polygonStart:function(){p.point=T,p.lineStart=P,p.lineEnd=R,u=[],c=[]},polygonEnd:function(){p.point=x,p.lineStart=w,p.lineEnd=S,u=oh(u);var C=$3(c,n);u.length?(l||(r.polygonStart(),l=!0),X3(u,jAe,C,t,r)):C&&(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 x(C,L){i(C,L)&&r.point(C,L)}function v(C,L){s.point(C,L)}function w(){p.point=v,s.lineStart()}function S(){p.point=x,s.lineEnd()}function T(C,L){f.push([C,L]),a.point(C,L)}function P(){a.lineStart(),f=[]}function R(){T(f[0][0],f[0][1]),a.lineEnd();var C=a.clean(),L=o.result(),D,F=L.length,N,B,z;if(f.pop(),c.push(f),f=null,!!F){if(C&1){if(B=L[0],(N=B.length-1)>0){for(l||(r.polygonStart(),l=!0),r.lineStart(),D=0;D<N;++D)r.point((z=B[D])[0],z[1]);r.lineEnd()}return}F>1&&C&2&&L.push(L.pop().concat(L.shift())),u.push(L.filter(WAe))}}return p}}function WAe(i){return i.length>1}function jAe(i,e){return((i=i.x)[0]<0?i[1]-to-Cn:to-i[1])-((e=e.x)[0]<0?e[1]-to-Cn:to-e[1])}var BD=Y3(function(){return!0},XAe,YAe,[-Jn,-to]);function XAe(i){var e=NaN,t=NaN,n=NaN,r;return{lineStart:function(){i.lineStart(),r=1},point:function(s,o){var a=s>0?Jn:-Jn,l=ei(s-e);ei(l-Jn)<Cn?(i.point(e,t=(t+o)/2>0?to:-to),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),i.point(s,t),r=0):n!==a&&l>=Jn&&(ei(e-n)<Cn&&(e-=n*Cn),ei(s-a)<Cn&&(s-=a*Cn),t=$Ae(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 $Ae(i,e,t,n){var r,s,o=an(i-t);return ei(o)>Cn?V_((an(e)*(s=fn(n))*an(t)-an(n)*(r=fn(e))*an(i))/(r*s*o)):(e+n)/2}function YAe(i,e,t,n){var r;if(i==null)r=t*to,n.point(-Jn,r),n.point(0,r),n.point(Jn,r),n.point(Jn,0),n.point(Jn,-r),n.point(0,-r),n.point(-Jn,-r),n.point(-Jn,0),n.point(-Jn,r);else if(ei(i[0]-e[0])>Cn){var s=i[0]<e[0]?Jn:-Jn;r=t*s/2,n.point(-s,r),n.point(0,r),n.point(s,r)}else n.point(e[0],e[1])}function DX(i){var e=fn(i),t=2*mn,n=e>0,r=ei(e)>Cn;function s(u,f,p,x){NX(x,i,t,p,u,f)}function o(u,f){return fn(u)*fn(f)>e}function a(u){var f,p,x,v,w;return{lineStart:function(){v=x=!1,w=1},point:function(S,T){var P=[S,T],R,C=o(S,T),L=n?C?0:c(S,T):C?c(S+(S<0?Jn:-Jn),T):0;if(!f&&(v=x=C)&&u.lineStart(),C!==x&&(R=l(f,P),(!R||H_(f,R)||H_(P,R))&&(P[2]=1)),C!==x)w=0,C?(u.lineStart(),R=l(P,f),u.point(R[0],R[1])):(R=l(f,P),u.point(R[0],R[1],2),u.lineEnd()),f=R;else if(r&&f&&n^C){var D;!(L&p)&&(D=l(P,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)))}C&&(!f||!H_(f,P))&&u.point(P[0],P[1]),f=P,x=C,p=L},lineEnd:function(){x&&u.lineEnd(),f=null},clean:function(){return w|(v&&x)<<1}}}function l(u,f,p){var x=sc(u),v=sc(f),w=[1,0,0],S=zf(x,v),T=W2(S,S),P=S[0],R=T-P*P;if(!R)return!p&&u;var C=e*T/R,L=-e*P/R,D=zf(w,S),F=j2(w,C),N=j2(S,L);F3(F,N);var B=D,z=W2(F,B),V=W2(B,B),H=z*z-V*(W2(F,F)-1);if(!(H<0)){var Z=bo(H),J=j2(B,(-z-Z)/V);if(F3(J,F),J=im(J),!p)return J;var j=u[0],K=f[0],ee=u[1],ae=f[1],ce;K<j&&(ce=j,j=K,K=ce);var de=K-j,ve=ei(de-Jn)<Cn,Ie=ve||de<Cn;if(!ve&&ae<ee&&(ce=ee,ee=ae,ae=ce),Ie?ve?ee+ae>0^J[1]<(ei(J[0]-j)<Cn?ee:ae):ee<=J[1]&&J[1]<=ae:de>Jn^(j<=J[0]&&J[0]<=K)){var Qe=j2(B,(-z+Z)/V);return F3(Qe,F),[J,im(Qe)]}}}function c(u,f){var p=n?i:Jn-i,x=0;return u<-p?x|=1:u>p&&(x|=2),f<-p?x|=4:f>p&&(x|=8),x}return Y3(o,a,s,n?[0,-i]:[-Jn,i-Jn])}function FX(i,e,t,n,r,s){var o=i[0],a=i[1],l=e[0],c=e[1],u=0,f=1,p=l-o,x=c-a,v;if(v=t-o,!(!p&&v>0)){if(v/=p,p<0){if(v<u)return;v<f&&(f=v)}else if(p>0){if(v>f)return;v>u&&(u=v)}if(v=r-o,!(!p&&v<0)){if(v/=p,p<0){if(v>f)return;v>u&&(u=v)}else if(p>0){if(v<u)return;v<f&&(f=v)}if(v=n-a,!(!x&&v>0)){if(v/=x,x<0){if(v<u)return;v<f&&(f=v)}else if(x>0){if(v>f)return;v>u&&(u=v)}if(v=s-a,!(!x&&v<0)){if(v/=x,x<0){if(v>f)return;v>u&&(u=v)}else if(x>0){if(v<u)return;v<f&&(f=v)}return u>0&&(i[0]=o+u*p,i[1]=a+u*x),f<1&&(e[0]=o+f*p,e[1]=a+f*x),!0}}}}}var K2=1e9,Z3=-K2;function UD(i,e,t,n){function r(c,u){return i<=c&&c<=t&&e<=u&&u<=n}function s(c,u,f,p){var x=0,v=0;if(c==null||(x=o(c,f))!==(v=o(u,f))||l(c,u)<0^f>0)do p.point(x===0||x===3?i:t,x>1?n:e);while((x=(x+f+4)%4)!==v);else p.point(u[0],u[1])}function o(c,u){return ei(c[0]-i)<Cn?u>0?0:3:ei(c[0]-t)<Cn?u>0?2:1:ei(c[1]-e)<Cn?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),p=o(u,1);return f!==p?f-p: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=W3(),p,x,v,w,S,T,P,R,C,L,D,F={point:N,lineStart:H,lineEnd:Z,polygonStart:z,polygonEnd:V};function N(j,K){r(j,K)&&u.point(j,K)}function B(){for(var j=0,K=0,ee=x.length;K<ee;++K)for(var ae=x[K],ce=1,de=ae.length,ve=ae[0],Ie,Qe,Ue=ve[0],mt=ve[1];ce<de;++ce)Ie=Ue,Qe=mt,ve=ae[ce],Ue=ve[0],mt=ve[1],Qe<=n?mt>n&&(Ue-Ie)*(n-Qe)>(mt-Qe)*(i-Ie)&&++j:mt<=n&&(Ue-Ie)*(n-Qe)<(mt-Qe)*(i-Ie)&&--j;return j}function z(){u=f,p=[],x=[],D=!0}function V(){var j=B(),K=D&&j,ee=(p=oh(p)).length;(K||ee)&&(c.polygonStart(),K&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),ee&&X3(p,a,j,s,c),c.polygonEnd()),u=c,p=x=v=null}function H(){F.point=J,x&&x.push(v=[]),L=!0,C=!1,P=R=NaN}function Z(){p&&(J(w,S),T&&C&&f.rejoin(),p.push(f.result())),F.point=N,C&&u.lineEnd()}function J(j,K){var ee=r(j,K);if(x&&v.push([j,K]),L)w=j,S=K,T=ee,L=!1,ee&&(u.lineStart(),u.point(j,K));else if(ee&&C)u.point(j,K);else{var ae=[P=Math.max(Z3,Math.min(K2,P)),R=Math.max(Z3,Math.min(K2,R))],ce=[j=Math.max(Z3,Math.min(K2,j)),K=Math.max(Z3,Math.min(K2,K))];FX(ae,ce,i,e,t,n)?(C||(u.lineStart(),u.point(ae[0],ae[1])),u.point(ce[0],ce[1]),ee||u.lineEnd(),D=!1):ee&&(u.lineStart(),u.point(j,K),D=!1)}P=j,R=K,C=ee}return F}}var kD,GD,K3,Q3,W_={sphere:Zr,point:Zr,lineStart:ZAe,lineEnd:Zr,polygonStart:Zr,polygonEnd:Zr};function ZAe(){W_.point=QAe,W_.lineEnd=KAe}function KAe(){W_.point=W_.lineEnd=Zr}function QAe(i,e){i*=mn,e*=mn,GD=i,K3=an(e),Q3=fn(e),W_.point=JAe}function JAe(i,e){i*=mn,e*=mn;var t=an(e),n=fn(e),r=ei(i-GD),s=fn(r),o=an(r),a=n*o,l=Q3*t-K3*n*s,c=K3*t+Q3*n*s;kD.add(cs(bo(a*a+l*l),c)),GD=i,K3=t,Q3=n}function OX(i){return kD=new vo,kp(i,W_),+kD}var zD=[null,null],eme={type:"LineString",coordinates:zD};function Za(i,e){return zD[0]=i,zD[1]=e,OX(eme)}var BX={Feature:function(i,e){return J3(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if(J3(t[n].geometry,e))return!0;return!1}},UX={Sphere:function(){return!0},Point:function(i,e){return kX(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(kX(t[n],e))return!0;return!1},LineString:function(i,e){return GX(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(GX(t[n],e))return!0;return!1},Polygon:function(i,e){return zX(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(zX(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if(J3(t[n],e))return!0;return!1}};function J3(i,e){return i&&UX.hasOwnProperty(i.type)?UX[i.type](i,e):!1}function kX(i,e){return Za(i,e)===0}function GX(i,e){for(var t,n,r,s=0,o=i.length;s<o;s++){if(n=Za(i[s],e),n===0||s>0&&(r=Za(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))<nm*r))return!0;t=n}return!1}function zX(i,e){return!!$3(i.map(tme),VX(e))}function tme(i){return i=i.map(VX),i.pop(),i}function VX(i){return[i[0]*mn,i[1]*mn]}function VD(i,e){return(i&&BX.hasOwnProperty(i.type)?BX[i.type]:J3)(i,e)}function qX(i,e,t){var n=Gf(i,e-Cn,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function HX(i,e,t){var n=Gf(i,e-Cn,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function qD(){var i,e,t,n,r,s,o,a,l=10,c=l,u=90,f=360,p,x,v,w,S=2.5;function T(){return{type:"MultiLineString",coordinates:P()}}function P(){return Gf(q2(n/u)*u,t,u).map(v).concat(Gf(q2(a/f)*f,o,f).map(w)).concat(Gf(q2(e/l)*l,i,l).filter(function(R){return ei(R%u)>Cn}).map(p)).concat(Gf(q2(s/c)*c,r,c).filter(function(R){return ei(R%f)>Cn}).map(x))}return T.lines=function(){return P().map(function(R){return{type:"LineString",coordinates:R}})},T.outline=function(){return{type:"Polygon",coordinates:[v(n).concat(w(o).slice(1),v(t).reverse().slice(1),w(a).reverse().slice(1))]}},T.extent=function(R){return arguments.length?T.extentMajor(R).extentMinor(R):T.extentMinor()},T.extentMajor=function(R){return arguments.length?(n=+R[0][0],t=+R[1][0],a=+R[0][1],o=+R[1][1],n>t&&(R=n,n=t,t=R),a>o&&(R=a,a=o,o=R),T.precision(S)):[[n,a],[t,o]]},T.extentMinor=function(R){return arguments.length?(e=+R[0][0],i=+R[1][0],s=+R[0][1],r=+R[1][1],e>i&&(R=e,e=i,i=R),s>r&&(R=s,s=r,r=R),T.precision(S)):[[e,s],[i,r]]},T.step=function(R){return arguments.length?T.stepMajor(R).stepMinor(R):T.stepMinor()},T.stepMajor=function(R){return arguments.length?(u=+R[0],f=+R[1],T):[u,f]},T.stepMinor=function(R){return arguments.length?(l=+R[0],c=+R[1],T):[l,c]},T.precision=function(R){return arguments.length?(S=+R,p=qX(s,r,90),x=HX(e,i,S),v=qX(a,o,90),w=HX(n,t,S),T):S},T.extentMajor([[-180,-90+Cn],[180,90-Cn]]).extentMinor([[-180,-80-Cn],[180,80+Cn]])}function HD(){return qD()()}function om(i,e){var t=i[0]*mn,n=i[1]*mn,r=e[0]*mn,s=e[1]*mn,o=fn(n),a=an(n),l=fn(s),c=an(s),u=o*fn(t),f=o*an(t),p=l*fn(r),x=l*an(r),v=2*Wo(bo(wD(s-n)+o*l*wD(r-t))),w=an(v),S=v?function(T){var P=an(T*=v)/w,R=an(v-T)/w,C=R*u+P*p,L=R*f+P*x,D=R*a+P*c;return[cs(L,C)*Ki,cs(D,bo(C*C+L*L))*Ki]}:function(){return[t*Ki,n*Ki]};return S.distance=v,S}var WD=i=>i;var j_=1/0,eE=j_,Q2=-j_,tE=Q2,nme={point:ime,lineStart:Zr,lineEnd:Zr,polygonStart:Zr,polygonEnd:Zr,result:function(){var i=[[j_,eE],[Q2,tE]];return Q2=tE=-(eE=j_=1/0),i}};function ime(i,e){i<j_&&(j_=i),i>Q2&&(Q2=i),e<eE&&(eE=e),e>tE&&(tE=e)}var jD=nme;function J2(i){return function(e){var t=new XD;for(var n in i)t[n]=i[n];return t.stream=e,t}}function XD(){}XD.prototype={constructor:XD,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 $D(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),kp(t,i.stream(jD)),e(jD.result()),n!=null&&i.clipExtent(n),i}function YD(i,e,t){return $D(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 WX(i,e,t){return YD(i,[[0,0],e],t)}function jX(i,e,t){return $D(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 XX(i,e,t){return $D(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 $X=16,rme=fn(30*mn);function ZD(i,e){return+e?ome(i,e):sme(i)}function sme(i){return J2({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function ome(i,e){function t(n,r,s,o,a,l,c,u,f,p,x,v,w,S){var T=c-n,P=u-r,R=T*T+P*P;if(R>4*e&&w--){var C=o+p,L=a+x,D=l+v,F=bo(C*C+L*L+D*D),N=Wo(D/=F),B=ei(ei(D)-1)<Cn||ei(s-f)<Cn?(s+f)/2:cs(L,C),z=i(B,N),V=z[0],H=z[1],Z=V-n,J=H-r,j=P*Z-T*J;(j*j/R>e||ei((T*Z+P*J)/R-.5)>.3||o*p+a*x+l*v<rme)&&(t(n,r,s,o,a,l,V,H,B,C/=F,L/=F,D,w,S),S.point(V,H),t(V,H,B,C,L,D,c,u,f,p,x,v,w,S))}}return function(n){var r,s,o,a,l,c,u,f,p,x,v,w,S={point:T,lineStart:P,lineEnd:C,polygonStart:function(){n.polygonStart(),S.lineStart=L},polygonEnd:function(){n.polygonEnd(),S.lineStart=P}};function T(N,B){N=i(N,B),n.point(N[0],N[1])}function P(){f=NaN,S.point=R,n.lineStart()}function R(N,B){var z=sc([N,B]),V=i(N,B);t(f,p,u,x,v,w,f=V[0],p=V[1],u=N,x=z[0],v=z[1],w=z[2],$X,n),n.point(f,p)}function C(){S.point=T,n.lineEnd()}function L(){P(),S.point=D,S.lineEnd=F}function D(N,B){R(r=N,B),s=f,o=p,a=x,l=v,c=w,S.point=R}function F(){t(f,p,u,x,v,w,s,o,r,a,l,c,$X,n),S.lineEnd=C,C()}return S}}var ame=J2({point:function(i,e){this.stream.point(i*mn,e*mn)}});function lme(i){return J2({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function cme(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 YX(i,e,t,n,r,s){if(!s)return cme(i,e,t,n,r);var o=fn(s),a=an(s),l=o*i,c=a*i,u=o/i,f=a/i,p=(a*t-o*e)/i,x=(a*e+o*t)/i;function v(w,S){return w*=n,S*=r,[l*w-c*S+e,t-c*w-l*S]}return v.invert=function(w,S){return[n*(u*w-f*S+p),r*(x-f*w-u*S)]},v}function KD(i){return ume(function(){return i})()}function ume(i){var e,t=150,n=480,r=250,s=0,o=0,a=0,l=0,c=0,u,f=0,p=1,x=1,v=null,w=BD,S=null,T,P,R,C=WD,L=.5,D,F,N,B,z;function V(j){return N(j[0]*mn,j[1]*mn)}function H(j){return j=N.invert(j[0],j[1]),j&&[j[0]*Ki,j[1]*Ki]}V.stream=function(j){return B&&z===j?B:B=ame(lme(u)(w(D(C(z=j)))))},V.preclip=function(j){return arguments.length?(w=j,v=void 0,J()):w},V.postclip=function(j){return arguments.length?(C=j,S=T=P=R=null,J()):C},V.clipAngle=function(j){return arguments.length?(w=+j?DX(v=j*mn):(v=null,BD),J()):v*Ki},V.clipExtent=function(j){return arguments.length?(C=j==null?(S=T=P=R=null,WD):UD(S=+j[0][0],T=+j[0][1],P=+j[1][0],R=+j[1][1]),J()):S==null?null:[[S,T],[P,R]]},V.scale=function(j){return arguments.length?(t=+j,Z()):t},V.translate=function(j){return arguments.length?(n=+j[0],r=+j[1],Z()):[n,r]},V.center=function(j){return arguments.length?(s=j[0]%360*mn,o=j[1]%360*mn,Z()):[s*Ki,o*Ki]},V.rotate=function(j){return arguments.length?(a=j[0]%360*mn,l=j[1]%360*mn,c=j.length>2?j[2]%360*mn:0,Z()):[a*Ki,l*Ki,c*Ki]},V.angle=function(j){return arguments.length?(f=j%360*mn,Z()):f*Ki},V.reflectX=function(j){return arguments.length?(p=j?-1:1,Z()):p<0},V.reflectY=function(j){return arguments.length?(x=j?-1:1,Z()):x<0},V.precision=function(j){return arguments.length?(D=ZD(F,L=j*j),J()):bo(L)},V.fitExtent=function(j,K){return YD(V,j,K)},V.fitSize=function(j,K){return WX(V,j,K)},V.fitWidth=function(j,K){return jX(V,j,K)},V.fitHeight=function(j,K){return XX(V,j,K)};function Z(){var j=YX(t,0,0,p,x,f).apply(null,e(s,o)),K=YX(t,n-j[0],r-j[1],p,x,f);return u=DD(a,l,c),F=Z2(e,K),N=Z2(u,F),D=ZD(F,L),J()}function J(){return B=z=null,V}return function(){return e=i.apply(this,arguments),V.invert=e.invert&&H,Z()}}function ZX(i){return function(e,t){var n=bo(e*e+t*t),r=i(n),s=an(r),o=fn(r);return[cs(e*s,n*o),Wo(n&&t*s/n)]}}function ev(i,e){return[i,sX(aX((to+e)/2))]}ev.invert=function(i,e){return[i,2*V_(rX(e))-to]};function QD(i,e){var t=fn(e),n=1+fn(i)*t;return[t*an(i)/n,an(e)/n]}QD.invert=ZX(function(i){return 2*V_(i)});function JD(){return KD(QD).scale(250).clipAngle(142)}function n6(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 hme(i){if(Array.isArray(i))return i}function fme(i){if(Array.isArray(i))return n6(i)}function tv(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 dme(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function pme(i,e,t){return e=sE(e),Sme(i,t$()?Reflect.construct(e,[],sE(i).constructor):e.apply(i,t))}function e$(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ame(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function ti(i,e){return i.get(tv(i,e))}function zp(i,e,t){e$(i,e),e.set(i,t)}function Vp(i,e,t){return i.set(tv(i,e),t),t}function mme(i,e){e$(i,e),e.add(i)}function gme(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,i$(n.key),n)}}function _me(i,e,t){return e&&gme(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function X_(i,e,t){return(e=i$(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function sE(i){return sE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},sE(i)}function xme(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&&i6(i,e)}function t$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(t$=function(){return!!i})()}function yme(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function vme(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 bme(){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 wme(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4119-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sme(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 dme(i)}function i6(i,e){return i6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},i6(i,e)}function rE(i,e){return hme(i)||vme(i,e)||r$(i,e)||bme()}function n$(i){return fme(i)||yme(i)||r$(i)||wme()}function Tme(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 i$(i){var e=Tme(i,"string");return typeof e=="symbol"?e:e+""}function r$(i,e){if(i){if(typeof i=="string")return n6(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)?n6(i,e):void 0}}var s$=function(e){e instanceof Array?e.forEach(s$):(e.map&&e.map.dispose(),e.dispose())},r6=function(e){e.geometry&&e.geometry.dispose(),e.material&&s$(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(r6)};function o$(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 Eme(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 am(i){return i*Math.PI/180}var a$=function(e){return 1-(ev(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},e6=function(e){return Math.max(0,Math.min(1,a$(e)))},KX=function(e){return .5-ev.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},Mme=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=$a().domain([1,0]).range([t,n]).clamp(!0),s=$a().domain([e6(t),e6(n)]).range([1,0]).clamp(!0),o=function(f){return s(e6(r(f)))},a=e.array,l=0,c=a.length;l<c;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},QX=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,a$(a))));var l=Math.floor(a*s);return[o,l]},s6=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,p=o===void 0?l-1:o,x=n,v=Math.min(l-1,f);x<=v;x++)for(var w=r,S=Math.min(l-1,p);w<=S;w++){var T=w,P=u;if(t){T=w===0?w:KX(w/l)*l;var R=w+1===l?w+1:KX((w+1)/l)*l;P=(R-T)*180/l}var C=-180+(x+.5)*c,L=90-(T*180/l+P/2),D=P;a.push({x,y:w,lng:C,lat:L,latLen:D})}return a},Cme=6,Rme=7,Pme=3,Ime=90,hh=new WeakMap,qp=new WeakMap,t6=new WeakMap,nE=new WeakMap,oc=new WeakMap,oE=new WeakMap,$_=new WeakMap,lm=new WeakMap,iE=new WeakSet,l$=(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 Ame(this,e),n=pme(this,e),mme(n,iE),zp(n,hh,void 0),zp(n,qp,void 0),zp(n,t6,void 0),zp(n,nE,void 0),zp(n,oc,{}),zp(n,oE,void 0),zp(n,$_,void 0),zp(n,lm,void 0),X_(n,"minLevel",void 0),X_(n,"maxLevel",void 0),X_(n,"thresholds",n$(new Array(30)).map(function(p,x){return 8/Math.pow(2,x)})),X_(n,"curvatureResolution",5),X_(n,"tileMargin",0),X_(n,"clearTiles",function(){Object.values(ti(oc,n)).forEach(function(p){p.forEach(function(x){x.obj&&(n.remove(x.obj),r6(x.obj),delete x.obj)})}),Vp(oc,n,{})}),Vp(hh,n,t),n.tileUrl=s,Vp(qp,n,f),n.minLevel=a,n.maxLevel=c,n.level=0,n.add(Vp(lm,n,new Gn(new Aa(ti(hh,n)*.99,180,90),new as({color:0})))),ti(lm,n).visible=!1,ti(lm,n).material.polygonOffset=!0,ti(lm,n).material.polygonOffsetUnits=3,ti(lm,n).material.polygonOffsetFactor=1,n}return xme(e,i),_me(e,[{key:"tileUrl",get:function(){return ti(t6,this)},set:function(n){Vp(t6,this,n),this.updatePov(ti($_,this))}},{key:"level",get:function(){return ti(nE,this)},set:function(n){var r,s=this;ti(oc,this)[n]||tv(iE,this,Nme).call(this,n);var o=ti(nE,this);if(Vp(nE,this,n),!(n===o||o===void 0)){if(ti(lm,this).visible=n>0,ti(oc,this)[n].forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!0)}),o<n&&((r=ti(oc,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++)ti(oc,this)[a]&&ti(oc,this)[a].forEach(function(l){l.obj&&(s.remove(l.obj),r6(l.obj),delete l.obj)});tv(iE,this,JX).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof Df))){Vp($_,this,n);var s;if(Vp(oE,this,function(u){if(!u.hullPnts){var f=360/Math.pow(2,r.level),p=u.lng,x=u.lat,v=u.latLen,w=p-f/2,S=p+f/2,T=x-v/2,P=x+v/2;u.hullPnts=[[x,p],[T,w],[P,w],[T,S],[P,S]].map(function(R){var C=rE(R,2),L=C[0],D=C[1];return o$(L,D,ti(hh,r))}).map(function(R){var C=R.x,L=R.y,D=R.z;return new ie(C,L,D)})}return s||(s=new ec,n.updateMatrix(),n.updateMatrixWorld(),s.setFromProjectionMatrix(new on().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse))),u.hullPnts.some(function(R){return s.containsPoint(R.clone().applyMatrix4(r.matrixWorld))})}),this.tileUrl){var o=n.position.clone(),a=o.distanceTo(this.getWorldPosition(new ie)),l=(a-ti(hh,this))/ti(hh,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)),tv(iE,this,JX).call(this)}}}}])})(Lr);function Nme(i){var e=this;if(i>Rme){ti(oc,this)[i]=[];return}var t=ti(oc,this)[i]=s6(i,ti(qp,this));t.forEach(function(n){return n.centroid=o$(n.lat,n.lng,ti(hh,e))}),t.octree=D2().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function JX(){var i=this;if(!(!this.tileUrl||this.level===void 0||!ti(oc,this).hasOwnProperty(this.level))&&!(!ti(oE,this)&&this.level>Cme)){var e=ti(oc,this)[this.level];if(ti($_,this)){var t=this.worldToLocal(ti($_,this).position.clone());if(e.octree){var n,r=this.worldToLocal(ti($_,this).position.clone()),s=(r.length()-ti(hh,this))*Pme;e=(n=e.octree).findAllWithinRadius.apply(n,n$(r).concat([s]))}else{var o=Eme(t),a=(o.r/ti(hh,this)-1)*Ime,l=a/Math.cos(am(o.lat)),c=[o.lng-l,o.lng+l],u=[o.lat+a,o.lat-a],f=QX(this.level,ti(qp,this),c[0],u[0]),p=rE(f,2),x=p[0],v=p[1],w=QX(this.level,ti(qp,this),c[1],u[1]),S=rE(w,2),T=S[0],P=S[1];!e.record&&(e.record={});var R=e.record;if(!R.hasOwnProperty("".concat(Math.round((x+T)/2),"_").concat(Math.round((v+P)/2))))e=s6(this.level,ti(qp,this),x,v,T,P).map(function(N){var B="".concat(N.x,"_").concat(N.y);return R.hasOwnProperty(B)?R[B]:(R[B]=N,e.push(N),N)});else{for(var C=[],L=x;L<=T;L++)for(var D=v;D<=P;D++){var F="".concat(L,"_").concat(D);R.hasOwnProperty(F)||(R[F]=s6(this.level,ti(qp,this),L,D,L,D)[0],e.push(R[F])),C.push(R[F])}e=C}}}e.filter(function(N){return!N.obj}).filter(ti(oE,this)||function(){return!0}).forEach(function(N){var B=N.x,z=N.y,V=N.lng,H=N.lat,Z=N.latLen,J=360/Math.pow(2,i.level);if(!N.obj){var j=J*(1-i.tileMargin),K=Z*(1-i.tileMargin),ee=am(V),ae=am(-H),ce=new Gn(new Aa(ti(hh,i),Math.ceil(j/i.curvatureResolution),Math.ceil(K/i.curvatureResolution),am(90-j/2)+ee,am(j),am(90-K/2)+ae,am(K)),new ma);if(ti(qp,i)){var de=[H+Z/2,H-Z/2].map(function(Ue){return .5-Ue/180}),ve=rE(de,2),Ie=ve[0],Qe=ve[1];Mme(ce.geometry.attributes.uv,Ie,Qe)}N.obj=ce}N.loading||(N.loading=!0,new xl().load(i.tileUrl(B,z,i.level),function(Ue){var mt=N.obj;mt&&(Ue.colorSpace=yr,mt.material.map=Ue,mt.material.color=null,mt.material.needsUpdate=!0,i.add(mt)),N.loading=!1}))})}}var sv=new Set,o6=!1;function d6(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length;sv.size&&sv.clear();let s=f$(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,c=0;if(n&&(s=Bme(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let p=t;p<r;p+=t){let x=i[p],v=i[p+1];x<a&&(a=x),v<l&&(l=v),x>u&&(u=x),v>f&&(f=v)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return a6(s,o,a,l,c),o}function f$(i,e,t,n,r){let s=null;if(r===Zme(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=h$(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=h$(o/n|0,i[o],i[o+1],s);return s&&ov(s,s.next)&&(lv(s),s=s.next),s}function um(i,e=i){let t=e===i,n=i,r;do r=!1,n!==n.next&&(sv.size===0||!sv.has(n))&&(ov(n,n.next)||Es(n.prev,n,n.next)===0)?((t||n===e)&&(e=n.prev),o6=!0,lv(n),n=n.prev,r=!0):(t||n!==e)&&(n=n.next,r=!t);while(r||n!==e);return e}function a6(i,e,t,n,r){r&&Hme(i,t,n,r);let s=i,o=!1;for(;i.prev!==i.next;){let a=i.prev,l=i.next;if(Es(a,i,l)<0&&(r?Dme(i,t,n,r):Lme(i))){e.push(a.i,i.i,l.i),lv(i),i=l,s=l;continue}if(i=l,i===s){if(o6=!1,i=um(i),o6){s=i;continue}if(!o){i=Fme(i,e),s=i,o=!0;continue}Ome(i,e,t,n,r);break}}}function Lme(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),p=Math.max(r,s,o),x=Math.max(a,l,c),v=n.next;for(;v!==e;){if(v.x>=u&&v.x<=p&&v.y>=f&&v.y<=x&&!(r===v.x&&a===v.y)&&uE(r,a,s,l,o,c,v.x,v.y)&&Es(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function Dme(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,p=o.y,x=Math.min(a,l,c),v=Math.min(u,f,p),w=Math.max(a,l,c),S=Math.max(u,f,p),T=h6(x,v,e,t,n),P=h6(w,S,e,t,n),R=i.prevZ;for(;R&&R.z>=T;){if(R.x>=x&&R.x<=w&&R.y>=v&&R.y<=S&&R!==o&&!(a===R.x&&u===R.y)&&uE(a,u,l,f,c,p,R.x,R.y)&&Es(R.prev,R,R.next)>=0)return!1;R=R.prevZ}let C=i.nextZ;for(;C&&C.z<=P;){if(C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==o&&!(a===C.x&&u===C.y)&&uE(a,u,l,f,c,p,C.x,C.y)&&Es(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Fme(i,e){let t=i,n=!1;do{let r=t.prev,s=t.next.next;A$(r,t,t.next,s,!1)&&av(r,s)&&av(s,r)&&(e.push(r.i,t.i,s.i),lv(t),lv(t.next),t=i=s,n=!0),t=t.next}while(t!==i);return n?um(t):t}function Ome(i,e,t,n,r){let s=i;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&Xme(s,o)){let a=m$(s,o);s=um(s,s.next),a=um(a,a.next),a6(s,e,t,n,r),a6(a,e,t,n,r);return}o=o.next}s=s.next}while(s!==i)}var l6=!1;function Bme(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=f$(i,a,l,n,!1);c===c.next&&sv.add(c),r.push(jme(c))}r.sort(Ume),Gme(i.length/n,e.length),p$(t,t),l6=!0;for(let s=0;s<r.length;s++)t=kme(r[s],t);return l6=!1,um(t)}function Ume(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 kme(i,e){let t=Vme(i,e);if(!t)return e;let n=m$(t,i),r=n.next;return p$(t,r.next),um(n,n.next),um(t,t.next)}var d$=16,Qr=new Float64Array(0),cE=0,c6=[],u6=[];function Gme(i,e){let t=Math.ceil((i+2*e)/d$)+e+2;Qr.length<t*4&&(Qr=new Float64Array(t*4)),cE=0}function p$(i,e){let t=i;do{let n=cE++;c6[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<d$&&t!==e);u6[n]=t;let c=n*4;Qr[c]=r,Qr[c+1]=s,Qr[c+2]=o,Qr[c+3]=a}while(t!==e)}function zme(i,e){let t=i.z*4;e.x<Qr[t]&&(Qr[t]=e.x),e.y<Qr[t+1]&&(Qr[t+1]=e.y),e.x>Qr[t+2]&&(Qr[t+2]=e.x),e.y>Qr[t+3]&&(Qr[t+3]=e.y)}function c$(i){let e=u6[i];for(;e.prev.next!==e;)e=e.next;return u6[i]=e,e}function u$(i){let e=c6[i];for(;e.prev.next!==e;)e=e.next;return c6[i]=e,e}function Vme(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(ov(i,t))return t;for(let p=0,x=0;p<cE;p++,x+=4){if(r<Qr[x+1]||r>Qr[x+3]||Qr[x]>n||Qr[x+2]<=s)continue;let v=c$(p);t=u$(p);do{if(t.prev.next===t){if(ov(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!==v)}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 p=0,x=0;p<cE;p++,x+=4){if(Qr[x+2]<a||Qr[x]>n||Qr[x+3]<c||Qr[x+1]>u)continue;let v=c$(p);t=u$(p);do{if(t.prev.next===t&&n>=t.x&&t.x>=a&&n!==t.x&&uE(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);(av(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&&qme(o,t)))&&(o=t,f=w)}t=t.next}while(t!==v)}return o}function qme(i,e){return Es(i.prev,i,e.prev)<0&&Es(e.next,i,i.next)<0}var ac=[],nv=[],cm=new Uint32Array(0),iv=new Uint32Array(0),rv=new Uint32Array(256);function Hme(i,e,t,n){let r=i,s=0;do r.z=h6(r.x,r.y,e,t,n),ac[s++]=r,r=r.next;while(r!==i);Wme(s);let o=null;for(let a=0;a<s;a++){let l=ac[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function Wme(i){if(i<=32){for(let e=1;e<i;e++){let t=ac[e],n=t.z,r=e-1;for(;r>=0&&ac[r].z>n;)ac[r+1]=ac[r],r--;ac[r+1]=t}return}cm.length<i&&(cm=new Uint32Array(i),iv=new Uint32Array(i),nv=new Array(i));for(let e=0;e<i;e++)cm[e]=ac[e].z;aE(i,ac,cm,nv,iv,0),aE(i,nv,iv,ac,cm,8),aE(i,ac,cm,nv,iv,16),aE(i,nv,iv,ac,cm,24)}function aE(i,e,t,n,r,s){rv.fill(0);for(let a=0;a<i;a++)rv[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){let l=rv[a];rv[a]=o,o+=l}for(let a=0;a<i;a++){let l=t[a],c=rv[l>>>s&255]++;n[c]=e[a],r[c]=l}}function h6(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 jme(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 uE(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 Xme(i,e){let t=ov(i,e)&&Es(i.prev,i,i.next)>0&&Es(e.prev,e,e.next)>0;return i.next.i!==e.i&&(t||av(i,e)&&av(e,i)&&(Es(i.prev,i,e.prev)!==0||Es(i,e.prev,e)!==0))&&!$me(i,e)&&(t||Yme(i,e))}function Es(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function ov(i,e){return i.x===e.x&&i.y===e.y}function A$(i,e,t,n,r=!0){let s=Es(i,e,t),o=Es(i,e,n),a=Es(t,n,i),l=Es(t,n,e);return(s>0&&o<0||s<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:r?!!(s===0&&lE(i,t,e)||o===0&&lE(i,n,e)||a===0&&lE(t,i,n)||l===0&&lE(t,e,n)):!1}function lE(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 $me(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&&A$(o,a,i,e))return!0;o=a}while(o!==i);return!1}function av(i,e){return Es(i.prev,i,i.next)<0?Es(i,e,i.next)>=0&&Es(i,i.prev,e)>=0:Es(i,e,i.prev)<0||Es(i,i.next,e)<0}function Yme(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 m$(i,e){let t=f6(i.i,i.x,i.y),n=f6(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 h$(i,e,t,n){let r=f6(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 lv(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),l6&&zme(i.prev,i.next)}function f6(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function Zme(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 Y_(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 A6(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 Kme(i){if(Array.isArray(i))return i}function Qme(i){if(Array.isArray(i))return A6(i)}function Jme(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function ege(i,e,t){return e=hE(e),cge(i,x$()?Reflect.construct(e,[],hE(i).constructor):e.apply(i,t))}function tge(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function nge(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function ige(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=_6(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.4120-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 hE(i){return hE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},hE(i)}function rge(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&&m6(i,e)}function x$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(x$=function(){return!!i})()}function sge(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function oge(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 age(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4121-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lge(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4122-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cge(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 Jme(i)}function m6(i,e){return m6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},m6(i,e)}function cv(i,e){return Kme(i)||oge(i,e)||_6(i,e)||age()}function uge(i){return Qme(i)||sge(i)||_6(i)||lge()}function _6(i,e){if(i){if(typeof i=="string")return A6(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)?A6(i,e):void 0}}var g$=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=Za(s,r)*180/Math.PI;if(o>t)for(var a=om(r,s),l=r.length>2||s.length>2?lh(r[2]||0,s[2]||0):null,c=l?function(p){return[].concat(uge(a(p)),[l(p)])}:a,u=1/Math.ceil(o/t),f=u;f<1;)n.push(c(f)),f+=u}n.push(r=s)}),n},g6=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:qn,Float32BufferAttribute:Rn},hge=new g6.BufferGeometry().setAttribute?"setAttribute":"addAttribute",x6=(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;tge(this,e),n=ege(this,e),n.type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var o=({Point:u,MultiPoint:f,LineString:p,MultiLineString:x,Polygon:v,MultiPolygon:w}[t.type]||function(){return[]})(t.coordinates,r),a=[],l=[],c=0;o.forEach(function(S){var T=a.length;uv({indices:a,vertices:l},S),n.addGroup(T,a.length-T,c++)}),a.length&&n.setIndex(a),l.length&&n[hge]("position",new g6.Float32BufferAttribute(l,3));function u(S,T){var P=p6(S[1],S[0],T+(S[2]||0)),R=[];return[{vertices:P,indices:R}]}function f(S,T){var P={vertices:[],indices:[]};return S.map(function(R){return u(R,T)}).forEach(function(R){var C=cv(R,1),L=C[0];uv(P,L)}),[P]}function p(S,T){for(var P=g$(S,s).map(function(N){var B=cv(N,3),z=B[0],V=B[1],H=B[2],Z=H===void 0?0:H;return p6(V,z,T+Z)}),R=Y_([P]),C=R.vertices,L=Math.round(C.length/3),D=[],F=1;F<L;F++)D.push(F-1,F);return[{vertices:C,indices:D}]}function x(S,T){var P={vertices:[],indices:[]};return S.map(function(R){return p(R,T)}).forEach(function(R){var C=cv(R,1),L=C[0];uv(P,L)}),[P]}function v(S,T){for(var P=S.map(function(j){return g$(j,s).map(function(K){var ee=cv(K,3),ae=ee[0],ce=ee[1],de=ee[2],ve=de===void 0?0:de;return p6(ce,ae,T+ve)})}),R=Y_(P),C=R.vertices,L=R.holes,D=L[0]||1/0,F=C.slice(0,D*3),N=C.slice(D*3),B=new Set(L),z=Math.round(C.length/3),V=[],H=[],Z=1;Z<z;Z++)B.has(Z)||(Z<D?V.push(Z-1,Z):H.push(Z-1-D,Z-D));var J=[{indices:V,vertices:F}];return L.length&&J.push({indices:H,vertices:N}),J}function w(S,T){var P={vertices:[],indices:[]},R={vertices:[],indices:[]};S.map(function(L){return v(L,T)}).forEach(function(L){var D=cv(L,2),F=D[0],N=D[1];uv(P,F),N&&uv(R,N)});var C=[P];return R.vertices.length&&C.push(R),C}return n}return rge(e,i),nge(e)})(g6.BufferGeometry);function uv(i,e){var t=Math.round(i.vertices.length/3);_$(i.vertices,e.vertices),_$(i.indices,e.indices.map(function(n){return n+t}))}function _$(i,e){var t=ige(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 p6(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 hv={};Wse(hv,{computeMikkTSpaceTangents:()=>fge,computeMorphedAttributes:()=>yge,deepCloneAttribute:()=>pge,deinterleaveAttribute:()=>fE,deinterleaveGeometry:()=>mge,estimateBytesUsed:()=>gge,interleaveAttributes:()=>Age,mergeAttributes:()=>y6,mergeGeometries:()=>dge,mergeGroups:()=>vge,mergeVertices:()=>_ge,toCreasedNormals:()=>bge,toTrianglesDrawMode:()=>xge});function fge(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 Li(s,4)),i!==r&&i.copy(r),i}function dge(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 qn,c=0;for(let u=0;u<i.length;++u){let f=i[u],p=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 x in f.attributes){if(!n.has(x))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+x+'" attribute exists among all geometries, or in none of them.'),null;s[x]===void 0&&(s[x]=[]),s[x].push(f.attributes[x]),p++}if(p!==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 x in f.morphAttributes){if(!r.has(x))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[x]===void 0&&(o[x]=[]),o[x].push(f.morphAttributes[x])}if(e){let x;if(t)x=f.index.count;else if(f.attributes.position!==void 0)x=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,x,u),c+=x}}if(t){let u=0,f=[];for(let p=0;p<i.length;++p){let x=i[p].index;for(let v=0;v<x.count;++v)f.push(x.getX(v)+u);u+=i[p].attributes.position.count}l.setIndex(f)}for(let u in s){let f=y6(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 p=0;p<f;++p){let x=[];for(let w=0;w<o[u].length;++w)x.push(o[u][w][p]);let v=y6(x);if(!v)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(v)}}}return l}function y6(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 Li(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 p=0,x=u.count;p<x;p++)for(let v=0;v<t;v++){let w=u.getComponent(p,v);a.setComponent(p+f,v,w)}}else o.set(u.array,l);l+=u.count*t}return r!==void 0&&(a.gpuType=r),a}function pge(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?fE(i):i.isInstancedBufferAttribute?new ml().copy(i):new Li().copy(i)}function Age(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 Pf(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],p=f.itemSize,x=f.count,v=new _o(r,p,s,f.normalized);o.push(v),s+=p;for(let w=0;w<x;w++)for(let S=0;S<p;S++)v[l[S]](w,f[a[S]](w))}return o}function fE(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 ml(s,n,r,i.meshPerAttribute):o=new Li(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 mge(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,fE(s)),e[r]=n.get(s))}for(let r in t){let s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,fE(s)),t[r]=n.get(s))}}function gge(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 _ge(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"],p=["setX","setY","setZ","setW"];for(let P=0,R=a.length;P<R;P++){let C=a[P],L=i.attributes[C];l[C]=new L.constructor(new L.array.constructor(L.count*L.itemSize),L.itemSize,L.normalized);let D=i.morphAttributes[C];D&&(c[C]||(c[C]=[]),D.forEach((F,N)=>{let B=new F.array.constructor(F.count*F.itemSize);c[C][N]=new F.constructor(B,F.itemSize,F.normalized)}))}let x=e*.5,v=Math.log10(1/e),w=Math.pow(10,v),S=x*w;for(let P=0;P<s;P++){let R=n?n.getX(P):P,C="";for(let L=0,D=a.length;L<D;L++){let F=a[L],N=i.getAttribute(F),B=N.itemSize;for(let z=0;z<B;z++)C+=`${~~(N[f[z]](R)*w+S)},`}if(C in t)u.push(t[C]);else{for(let L=0,D=a.length;L<D;L++){let F=a[L],N=i.getAttribute(F),B=i.morphAttributes[F],z=N.itemSize,V=l[F],H=c[F];for(let Z=0;Z<z;Z++){let J=f[Z],j=p[Z];if(V[j](o,N[J](R)),B)for(let K=0,ee=B.length;K<ee;K++)H[K][j](o,B[K][J](R))}}t[C]=o,u.push(o),o++}}let T=i.clone();for(let P in i.attributes){let R=l[P];if(T.setAttribute(P,new R.constructor(R.array.slice(0,o*R.itemSize),R.itemSize,R.normalized)),P in c)for(let C=0;C<c[P].length;C++){let L=c[P][C];T.morphAttributes[P][C]=new L.constructor(L.array.slice(0,o*L.itemSize),L.itemSize,L.normalized)}}return T.setIndex(u),T}function xge(i,e){if(e===sL)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===JT||e===oL){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===JT)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 yge(i){let e=new ie,t=new ie,n=new ie,r=new ie,s=new ie,o=new ie,a=new ie,l=new ie,c=new ie;function u(ce,de,ve,Ie,Qe,Ue,mt,Me){e.fromBufferAttribute(de,Qe),t.fromBufferAttribute(de,Ue),n.fromBufferAttribute(de,mt);let ze=ce.morphTargetInfluences;if(ve&&ze){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let $e=0,Et=ve.length;$e<Et;$e++){let Tt=ze[$e],Ct=ve[$e];Tt!==0&&(r.fromBufferAttribute(Ct,Qe),s.fromBufferAttribute(Ct,Ue),o.fromBufferAttribute(Ct,mt),Ie?(a.addScaledVector(r,Tt),l.addScaledVector(s,Tt),c.addScaledVector(o,Tt)):(a.addScaledVector(r.sub(e),Tt),l.addScaledVector(s.sub(t),Tt),c.addScaledVector(o.sub(n),Tt)))}e.add(a),t.add(l),n.add(c)}ce.isSkinnedMesh&&(ce.applyBoneTransform(Qe,e),ce.applyBoneTransform(Ue,t),ce.applyBoneTransform(mt,n)),Me[Qe*3+0]=e.x,Me[Qe*3+1]=e.y,Me[Qe*3+2]=e.z,Me[Ue*3+0]=t.x,Me[Ue*3+1]=t.y,Me[Ue*3+2]=t.z,Me[mt*3+0]=n.x,Me[mt*3+1]=n.y,Me[mt*3+2]=n.z}let f=i.geometry,p=i.material,x,v,w,S=f.index,T=f.attributes.position,P=f.morphAttributes.position,R=f.morphTargetsRelative,C=f.attributes.normal,L=f.morphAttributes.normal,D=f.groups,F=f.drawRange,N,B,z,V,H,Z,J,j=new Float32Array(T.count*T.itemSize),K=new Float32Array(C.count*C.itemSize);if(S!==null)if(Array.isArray(p))for(N=0,z=D.length;N<z;N++)for(H=D[N],Z=Math.max(H.start,F.start),J=Math.min(H.start+H.count,F.start+F.count),B=Z,V=J;B<V;B+=3)x=S.getX(B),v=S.getX(B+1),w=S.getX(B+2),u(i,T,P,R,x,v,w,j),u(i,C,L,R,x,v,w,K);else for(Z=Math.max(0,F.start),J=Math.min(S.count,F.start+F.count),N=Z,z=J;N<z;N+=3)x=S.getX(N),v=S.getX(N+1),w=S.getX(N+2),u(i,T,P,R,x,v,w,j),u(i,C,L,R,x,v,w,K);else if(Array.isArray(p))for(N=0,z=D.length;N<z;N++)for(H=D[N],Z=Math.max(H.start,F.start),J=Math.min(H.start+H.count,F.start+F.count),B=Z,V=J;B<V;B+=3)x=B,v=B+1,w=B+2,u(i,T,P,R,x,v,w,j),u(i,C,L,R,x,v,w,K);else for(Z=Math.max(0,F.start),J=Math.min(T.count,F.start+F.count),N=Z,z=J;N<z;N+=3)x=N,v=N+1,w=N+2,u(i,T,P,R,x,v,w,j),u(i,C,L,R,x,v,w,K);let ee=new Rn(j,3),ae=new Rn(K,3);return{positionAttribute:T,normalAttribute:C,morphedPositionAttribute:ee,morphedNormalAttribute:ae}}function vge(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 bge(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 C=0;C<r;C++)s[3*C+0]=n.getX(C),s[3*C+1]=n.getY(C),s[3*C+2]=n.getZ(C)}let o=Math.cos(e),a=(1+1e-10)*100,l=r/3,c=new Float64Array(l*3);for(let C=0;C<l;C++){let L=9*C,D=s[L+0],F=s[L+1],N=s[L+2],B=s[L+3],z=s[L+4],V=s[L+5],H=s[L+6],Z=s[L+7],J=s[L+8],j=H-B,K=Z-z,ee=J-V,ae=D-B,ce=F-z,de=N-V,ve=K*de-ee*ce,Ie=ee*ae-j*de,Qe=j*ce-K*ae,Ue=1/(Math.sqrt(ve*ve+Ie*Ie+Qe*Qe)||1);c[3*C+0]=ve*Ue,c[3*C+1]=Ie*Ue,c[3*C+2]=Qe*Ue}let u=new Int32Array(r),f=new Int32Array(r*3),p=1;for(;p<r*2;)p<<=1;let x=p-1,v=new Int32Array(p),w=0;for(let C=0;C<r;C++){let L=3*C,D=~~(s[L+0]*a),F=~~(s[L+1]*a),N=~~(s[L+2]*a),B=(Math.imul(D,73856093)^Math.imul(F,19349663)^Math.imul(N,83492791))&x;for(;;){let z=v[B];if(z===0){let H=3*w;f[H+0]=D,f[H+1]=F,f[H+2]=N,v[B]=w+1,u[C]=w++;break}let V=3*(z-1);if(f[V+0]===D&&f[V+1]===F&&f[V+2]===N){u[C]=z-1;break}B=B+1&x}}let S=new Int32Array(w+1);for(let C=0;C<r;C++)S[u[C]+1]++;for(let C=0;C<w;C++)S[C+1]+=S[C];let T=new Int32Array(r),P=S.slice(0,w);for(let C=0;C<l;C++){let L=3*C;T[P[u[L+0]]++]=C,T[P[u[L+1]]++]=C,T[P[u[L+2]]++]=C}let R=new Float32Array(r*3);for(let C=0;C<l;C++){let L=3*C,D=c[L+0],F=c[L+1],N=c[L+2];for(let B=0;B<3;B++){let z=L+B,V=u[z],H=0,Z=0,J=0;for(let K=S[V],ee=S[V+1];K<ee;K++){let ae=3*T[K],ce=c[ae+0],de=c[ae+1],ve=c[ae+2];D*ce+F*de+N*ve>o&&(H+=ce,Z+=de,J+=ve)}let j=1/(Math.sqrt(H*H+Z*Z+J*J)||1);R[3*z+0]=H*j,R[3*z+1]=Z*j,R[3*z+2]=J*j}}return t.setAttribute("normal",new Li(R,3,!1)),t}var rt=(function(i){return typeof i=="function"?i:typeof i=="string"?function(e){return e[i]}:function(e){return i}});function dE(i){"@babel/helpers - typeof";return dE=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},dE(i)}var wge=/^\s+/,Sge=/\s+$/;function dn(i,e){if(i=i||"",e=e||{},i instanceof dn)return i;if(!(this instanceof dn))return new dn(i,e);var t=Tge(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}dn.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=E$(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=v$(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=v$(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=y$(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=y$(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 b$(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return Rge(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(br(this._r,255)*100)+"%",g:Math.round(br(this._g,255)*100)+"%",b:Math.round(br(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(br(this._r,255)*100)+"%, "+Math.round(br(this._g,255)*100)+"%, "+Math.round(br(this._b,255)*100)+"%)":"rgba("+Math.round(br(this._r,255)*100)+"%, "+Math.round(br(this._g,255)*100)+"%, "+Math.round(br(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:zge[b$(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+w$(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=dn(e);n="#"+w$(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 dn(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(Lge,arguments)},brighten:function(){return this._applyModification(Dge,arguments)},darken:function(){return this._applyModification(Fge,arguments)},desaturate:function(){return this._applyModification(Pge,arguments)},saturate:function(){return this._applyModification(Ige,arguments)},greyscale:function(){return this._applyModification(Nge,arguments)},spin:function(){return this._applyModification(Oge,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(kge,arguments)},complement:function(){return this._applyCombination(Bge,arguments)},monochromatic:function(){return this._applyCombination(Gge,arguments)},splitcomplement:function(){return this._applyCombination(Uge,arguments)},triad:function(){return this._applyCombination(S$,[3])},tetrad:function(){return this._applyCombination(S$,[4])}};dn.fromRatio=function(i,e){if(dE(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=fv(i[n]));i=t}return dn(i,e)};function Tge(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=Wge(i)),dE(i)=="object"&&(Hf(i.r)&&Hf(i.g)&&Hf(i.b)?(e=Ege(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):Hf(i.h)&&Hf(i.s)&&Hf(i.v)?(n=fv(i.s),r=fv(i.v),e=Cge(i.h,n,r),o=!0,a="hsv"):Hf(i.h)&&Hf(i.s)&&Hf(i.l)&&(n=fv(i.s),s=fv(i.l),e=Mge(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=E$(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 Ege(i,e,t){return{r:br(i,255)*255,g:br(e,255)*255,b:br(t,255)*255}}function y$(i,e,t){i=br(i,255),e=br(e,255),t=br(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 Mge(i,e,t){var n,r,s;i=br(i,360),e=br(e,100),t=br(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 v$(i,e,t){i=br(i,255),e=br(e,255),t=br(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 Cge(i,e,t){i=br(i,360)*6,e=br(e,100),t=br(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 b$(i,e,t,n){var r=[Qc(Math.round(i).toString(16)),Qc(Math.round(e).toString(16)),Qc(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 Rge(i,e,t,n,r){var s=[Qc(Math.round(i).toString(16)),Qc(Math.round(e).toString(16)),Qc(Math.round(t).toString(16)),Qc(M$(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 w$(i,e,t,n){var r=[Qc(M$(n)),Qc(Math.round(i).toString(16)),Qc(Math.round(e).toString(16)),Qc(Math.round(t).toString(16))];return r.join("")}dn.equals=function(i,e){return!i||!e?!1:dn(i).toRgbString()==dn(e).toRgbString()};dn.random=function(){return dn.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Pge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.s-=e/100,t.s=pE(t.s),dn(t)}function Ige(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.s+=e/100,t.s=pE(t.s),dn(t)}function Nge(i){return dn(i).desaturate(100)}function Lge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.l+=e/100,t.l=pE(t.l),dn(t)}function Dge(i,e){e=e===0?0:e||10;var t=dn(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)))),dn(t)}function Fge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.l-=e/100,t.l=pE(t.l),dn(t)}function Oge(i,e){var t=dn(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,dn(t)}function Bge(i){var e=dn(i).toHsl();return e.h=(e.h+180)%360,dn(e)}function S$(i,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=dn(i).toHsl(),n=[dn(i)],r=360/e,s=1;s<e;s++)n.push(dn({h:(t.h+s*r)%360,s:t.s,l:t.l}));return n}function Uge(i){var e=dn(i).toHsl(),t=e.h;return[dn(i),dn({h:(t+72)%360,s:e.s,l:e.l}),dn({h:(t+216)%360,s:e.s,l:e.l})]}function kge(i,e,t){e=e||6,t=t||30;var n=dn(i).toHsl(),r=360/t,s=[dn(i)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,s.push(dn(n));return s}function Gge(i,e){e=e||6;for(var t=dn(i).toHsv(),n=t.h,r=t.s,s=t.v,o=[],a=1/e;e--;)o.push(dn({h:n,s:r,v:s})),s=(s+a)%1;return o}dn.mix=function(i,e,t){t=t===0?0:t||50;var n=dn(i).toRgb(),r=dn(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 dn(o)};dn.readability=function(i,e){var t=dn(i),n=dn(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};dn.isReadable=function(i,e,t){var n=dn.readability(i,e),r,s;switch(s=!1,r=jge(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};dn.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=dn.readability(i,e[c]),s>r&&(r=s,n=dn(e[c]));return dn.isReadable(i,n,{level:a,size:l})||!o?n:(t.includeFallbackColors=!1,dn.mostReadable(i,["#fff","#000"],t))};var v6=dn.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"},zge=dn.hexNames=Vge(v6);function Vge(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function E$(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function br(i,e){qge(i)&&(i="100%");var t=Hge(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 pE(i){return Math.min(1,Math.max(0,i))}function Sl(i){return parseInt(i,16)}function qge(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function Hge(i){return typeof i=="string"&&i.indexOf("%")!=-1}function Qc(i){return i.length==1?"0"+i:""+i}function fv(i){return i<=1&&(i=i*100+"%"),i}function M$(i){return Math.round(parseFloat(i)*255).toString(16)}function T$(i){return Sl(i)/255}var Kc=(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 Hf(i){return!!Kc.CSS_UNIT.exec(i)}function Wge(i){i=i.replace(wge,"").replace(Sge,"").toLowerCase();var e=!1;if(v6[i])i=v6[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Kc.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=Kc.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Kc.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=Kc.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Kc.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=Kc.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Kc.hex8.exec(i))?{r:Sl(t[1]),g:Sl(t[2]),b:Sl(t[3]),a:T$(t[4]),format:e?"name":"hex8"}:(t=Kc.hex6.exec(i))?{r:Sl(t[1]),g:Sl(t[2]),b:Sl(t[3]),format:e?"name":"hex"}:(t=Kc.hex4.exec(i))?{r:Sl(t[1]+""+t[1]),g:Sl(t[2]+""+t[2]),b:Sl(t[3]+""+t[3]),a:T$(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Kc.hex3.exec(i))?{r:Sl(t[1]+""+t[1]),g:Sl(t[2]+""+t[2]),b:Sl(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function jge(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 T6(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 Xge(i){if(Array.isArray(i))return i}function $ge(i){if(Array.isArray(i))return T6(i)}function C$(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 Yge(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Zge(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function jo(i,e){return i.get(C$(i,e))}function Z_(i,e,t){Yge(i,e),e.set(i,t)}function AE(i,e,t){return i.set(C$(i,e),t),t}function Kge(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,o_e(n.key),n)}}function Qge(i,e,t){return e&&Kge(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Jge(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function e_e(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 t_e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4123-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function n_e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4124-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i_e(i,e){return Xge(i)||e_e(i,e)||R$(i,e)||t_e()}function r_e(i){return $ge(i)||Jge(i)||R$(i)||n_e()}function s_e(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 o_e(i){var e=s_e(i,"string");return typeof e=="symbol"?e:e+""}function R$(i,e){if(i){if(typeof i=="string")return T6(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)?T6(i,e):void 0}}var K_=new WeakMap,dv=new WeakMap,Q_=new WeakMap,b6=new WeakMap,w6=new WeakMap,S6=new WeakMap,P$=(function(){function i(){Zge(this,i),Z_(this,K_,new Map),Z_(this,dv,new Map),Z_(this,Q_,function(e){return e}),Z_(this,b6,function(){return{}}),Z_(this,w6,function(){}),Z_(this,S6,function(){})}return Qge(i,[{key:"getObj",value:function(t){return jo(K_,this).get(jo(Q_,this).call(this,t))}},{key:"getData",value:function(t){return jo(dv,this).get(t)}},{key:"entries",value:function(){return r_e(jo(dv,this).entries()).map(function(t){var n=i_e(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return AE(Q_,this,rt(t)),this}},{key:"onCreateObj",value:function(t){return AE(b6,this,t),this}},{key:"onUpdateObj",value:function(t){return AE(w6,this,t),this}},{key:"onRemoveObj",value:function(t){return AE(S6,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!jo(K_,n).has(jo(Q_,n).call(n,s))}).forEach(function(s){var o=jo(b6,n).call(n,s);jo(K_,n).set(jo(Q_,n).call(n,s),o),jo(dv,n).set(o,s)});var r=new Map(t.map(function(s){return[jo(Q_,n).call(n,s),s]}));return jo(K_,this).forEach(function(s,o){r.has(o)?jo(w6,n).call(n,s,r.get(o)):(jo(S6,n).call(n,s,o),jo(K_,n).delete(o),jo(dv,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();var Ym=Xse(I$(),1);var vi=11102230246251565e-32,Ms=134217729,Av=(3+8*vi)*vi;function hm(i,e,t,n,r){let s,o,a,l,c=e[0],u=n[0],f=0,p=0;u>c==u>-c?(s=c,c=e[++f]):(s=u,u=n[++p]);let x=0;if(f<i&&p<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[++p]),s=o,a!==0&&(r[x++]=a);f<i&&p<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[++p]),s=o,a!==0&&(r[x++]=a);for(;f<i;)o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f],s=o,a!==0&&(r[x++]=a);for(;p<t;)o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++p],s=o,a!==0&&(r[x++]=a);return(s!==0||x===0)&&(r[x++]=s),x}function mv(i,e){let t=e[0];for(let n=1;n<i;n++)t+=e[n];return t}function ut(i){return new Float64Array(i)}var a_e=(3+16*vi)*vi,l_e=(2+12*vi)*vi,c_e=(9+64*vi)*vi*vi,J_=ut(4),N$=ut(8),L$=ut(12),D$=ut(16),ba=ut(4);function u_e(i,e,t,n,r,s,o){let a,l,c,u,f,p,x,v,w,S,T,P,R,C,L,D,F,N,B=i-r,z=t-r,V=e-s,H=n-s;C=B*H,p=Ms*B,x=p-(p-B),v=B-x,p=Ms*H,w=p-(p-H),S=H-w,L=v*S-(C-x*w-v*w-x*S),D=V*z,p=Ms*V,x=p-(p-V),v=V-x,p=Ms*z,w=p-(p-z),S=z-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,J_[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,J_[1]=R-(T+f)+(f-D),N=P+T,f=N-P,J_[2]=P-(N-f)+(T-f),J_[3]=N;let Z=mv(4,J_),J=l_e*o;if(Z>=J||-Z>=J||(f=i-B,a=i-(B+f)+(f-r),f=t-z,c=t-(z+f)+(f-r),f=e-V,l=e-(V+f)+(f-s),f=n-H,u=n-(H+f)+(f-s),a===0&&l===0&&c===0&&u===0)||(J=c_e*o+Av*Math.abs(Z),Z+=B*u+H*a-(V*c+z*l),Z>=J||-Z>=J))return Z;C=a*H,p=Ms*a,x=p-(p-a),v=a-x,p=Ms*H,w=p-(p-H),S=H-w,L=v*S-(C-x*w-v*w-x*S),D=l*z,p=Ms*l,x=p-(p-l),v=l-x,p=Ms*z,w=p-(p-z),S=z-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,ba[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,ba[1]=R-(T+f)+(f-D),N=P+T,f=N-P,ba[2]=P-(N-f)+(T-f),ba[3]=N;let j=hm(4,J_,4,ba,N$);C=B*u,p=Ms*B,x=p-(p-B),v=B-x,p=Ms*u,w=p-(p-u),S=u-w,L=v*S-(C-x*w-v*w-x*S),D=V*c,p=Ms*V,x=p-(p-V),v=V-x,p=Ms*c,w=p-(p-c),S=c-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,ba[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,ba[1]=R-(T+f)+(f-D),N=P+T,f=N-P,ba[2]=P-(N-f)+(T-f),ba[3]=N;let K=hm(j,N$,4,ba,L$);C=a*u,p=Ms*a,x=p-(p-a),v=a-x,p=Ms*u,w=p-(p-u),S=u-w,L=v*S-(C-x*w-v*w-x*S),D=l*c,p=Ms*l,x=p-(p-l),v=l-x,p=Ms*c,w=p-(p-c),S=c-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,ba[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,ba[1]=R-(T+f)+(f-D),N=P+T,f=N-P,ba[2]=P-(N-f)+(T-f),ba[3]=N;let ee=hm(K,L$,4,ba,D$);return D$[ee-1]}function Hp(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)>=a_e*c?l:-u_e(i,e,t,n,r,s,c)}var _Ze=(7+56*vi)*vi,xZe=(3+28*vi)*vi,yZe=(26+288*vi)*vi*vi,vZe=ut(4),bZe=ut(4),wZe=ut(4),SZe=ut(4),TZe=ut(4),EZe=ut(4),MZe=ut(4),CZe=ut(4),RZe=ut(4),PZe=ut(8),IZe=ut(8),NZe=ut(8),LZe=ut(4),DZe=ut(8),FZe=ut(8),OZe=ut(16),BZe=ut(12),UZe=ut(192),kZe=ut(192);var VZe=(10+96*vi)*vi,qZe=(4+48*vi)*vi,HZe=(44+576*vi)*vi*vi,WZe=ut(4),jZe=ut(4),XZe=ut(4),$Ze=ut(4),YZe=ut(4),ZZe=ut(4),KZe=ut(4),QZe=ut(4),JZe=ut(8),eKe=ut(8),tKe=ut(8),nKe=ut(8),iKe=ut(8),rKe=ut(8),sKe=ut(8),oKe=ut(8),aKe=ut(8),lKe=ut(4),cKe=ut(4),uKe=ut(4),hKe=ut(8),fKe=ut(16),dKe=ut(16),pKe=ut(16),AKe=ut(32),mKe=ut(32),gKe=ut(48),_Ke=ut(64),xKe=ut(1152),yKe=ut(1152);var SKe=(16+224*vi)*vi,TKe=(5+72*vi)*vi,EKe=(71+1408*vi)*vi*vi,MKe=ut(4),CKe=ut(4),RKe=ut(4),PKe=ut(4),IKe=ut(4),NKe=ut(4),LKe=ut(4),DKe=ut(4),FKe=ut(4),OKe=ut(4),BKe=ut(24),UKe=ut(24),kKe=ut(24),GKe=ut(24),zKe=ut(24),VKe=ut(24),qKe=ut(24),HKe=ut(24),WKe=ut(24),jKe=ut(24),XKe=ut(1152),$Ke=ut(1152),YKe=ut(1152),ZKe=ut(1152),KKe=ut(1152),QKe=ut(2304),JKe=ut(2304),eQe=ut(3456),tQe=ut(5760),nQe=ut(8),iQe=ut(8),rQe=ut(8),sQe=ut(16),oQe=ut(24),aQe=ut(48),lQe=ut(48),cQe=ut(96),uQe=ut(192),hQe=ut(384),fQe=ut(384),dQe=ut(384),pQe=ut(768);var AQe=ut(96),mQe=ut(96),gQe=ut(96),_Qe=ut(1152);var O$=Math.pow(2,-52),mE=new Uint32Array(512),Wp=class i{static from(e,t=m_e,n=g_e){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 z=e[2*B],V=e[2*B+1];z<a&&(a=z),V<l&&(l=V),z>c&&(c=z),V>u&&(u=V),this._ids[B]=B}let f=(a+c)/2,p=(l+u)/2,x=0,v=0,w=0;for(let B=0,z=1/0;B<o;B++){let V=M6(f,p,e[2*B],e[2*B+1]);V<z&&(x=B,z=V)}let S=e[2*x],T=e[2*x+1];for(let B=0,z=1/0;B<o;B++){if(B===x)continue;let V=M6(S,T,e[2*B],e[2*B+1]);V<z&&V>0&&(v=B,z=V)}let P=e[2*v],R=e[2*v+1],C=1/0;for(let B=0;B<o;B++){if(B===x||B===v)continue;let z=p_e(S,T,P,R,e[2*B],e[2*B+1]);z<C&&(w=B,C=z)}let L=e[2*w],D=e[2*w+1];if(C===1/0){for(let V=0;V<o;V++)this._dists[V]=e[2*V]-e[0]||e[2*V+1]-e[1];e1(this._ids,this._dists,0,o-1);let B=new Uint32Array(o),z=0;for(let V=0,H=-1/0;V<o;V++){let Z=this._ids[V],J=this._dists[Z];J>H&&(B[z++]=Z,H=J)}this.hull=B.subarray(0,z),this.triangles=new Uint32Array(0),this.halfedges=new Int32Array(0);return}if(Hp(S,T,P,R,L,D)<0){let B=v,z=P,V=R;v=w,P=L,R=D,w=B,L=z,D=V}let F=A_e(S,T,P,R,L,D);this._cx=F.x,this._cy=F.y;for(let B=0;B<o;B++)this._dists[B]=M6(e[2*B],e[2*B+1],F.x,F.y);e1(this._ids,this._dists,0,o-1),this._hullStart=x;let N=3;n[x]=t[w]=v,n[v]=t[x]=w,n[w]=t[v]=x,r[x]=0,r[v]=1,r[w]=2,s.fill(-1),s[this._hashKey(S,T)]=x,s[this._hashKey(P,R)]=v,s[this._hashKey(L,D)]=w,this.trianglesLen=0,this._addTriangle(x,v,w,-1,-1,-1);for(let B=0,z=0,V=0;B<this._ids.length;B++){let H=this._ids[B],Z=e[2*H],J=e[2*H+1];if(B>0&&Math.abs(Z-z)<=O$&&Math.abs(J-V)<=O$||(z=Z,V=J,H===x||H===v||H===w))continue;let j=0;for(let de=0,ve=this._hashKey(Z,J);de<this._hashSize&&(j=s[(ve+de)%this._hashSize],!(j!==-1&&j!==n[j]));de++);j=t[j];let K=j,ee;for(;ee=n[K],Hp(Z,J,e[2*K],e[2*K+1],e[2*ee],e[2*ee+1])>=0;)if(K=ee,K===j){K=-1;break}if(K===-1)continue;let ae=this._addTriangle(K,H,n[K],-1,-1,r[K]);r[H]=this._legalize(ae+2),r[K]=ae,N++;let ce=n[K];for(;ee=n[ce],Hp(Z,J,e[2*ce],e[2*ce+1],e[2*ee],e[2*ee+1])<0;)ae=this._addTriangle(ce,H,ee,r[H],-1,r[ce]),r[H]=this._legalize(ae+2),n[ce]=ce,N--,ce=ee;if(K===j)for(;ee=t[K],Hp(Z,J,e[2*ee],e[2*ee+1],e[2*K],e[2*K+1])<0;)ae=this._addTriangle(ee,H,K,-1,r[K],r[ee]),this._legalize(ae+2),r[ee]=ae,n[K]=K,N--,K=ee;this._hullStart=t[H]=K,n[K]=t[ce]=H,n[H]=ce,s[this._hashKey(Z,J)]=H,s[this._hashKey(e[2*K],e[2*K+1])]=K}this.hull=new Uint32Array(N);for(let B=0,z=this._hullStart;B<N;B++)this.hull[B]=z,z=n[z];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(f_e(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=mE[--s];continue}let c=a-a%3,u=l+(e+1)%3,f=c+(a+2)%3,p=t[o],x=t[e],v=t[u],w=t[f];if(d_e(r[2*p],r[2*p+1],r[2*x],r[2*x+1],r[2*v],r[2*v+1],r[2*w],r[2*w+1])){t[e]=w,t[a]=p;let T=n[f];if(T===-1){let R=this._hullStart;do{if(this._hullTri[R]===f){this._hullTri[R]=e;break}R=this._hullPrev[R]}while(R!==this._hullStart)}this._link(e,T),this._link(a,n[o]),this._link(o,f);let P=c+(a+1)%3;s<mE.length&&(mE[s++]=P)}else{if(s===0)break;e=mE[--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 f_e(i,e){let t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function M6(i,e,t,n){let r=i-t,s=e-n;return r*r+s*s}function d_e(i,e,t,n,r,s,o,a){let l=i-o,c=e-a,u=t-o,f=n-a,p=r-o,x=s-a,v=l*l+c*c,w=u*u+f*f,S=p*p+x*x;return l*(f*S-w*x)-c*(u*S-w*p)+v*(u*x-f*p)<0}function p_e(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,p=.5/(o*c-a*l),x=(c*u-a*f)*p,v=(o*f-l*u)*p;return x*x+v*v}function A_e(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,p=.5/(o*c-a*l),x=i+(c*u-a*f)*p,v=e+(o*f-l*u)*p;return{x,y:v}}function e1(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;gv(i,r,s),e[i[t]]>e[i[n]]&&gv(i,t,n),e[i[s]]>e[i[n]]&&gv(i,s,n),e[i[t]]>e[i[s]]&&gv(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;gv(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(e1(i,e,s,n),e1(i,e,t,o-1)):(e1(i,e,t,o-1),e1(i,e,s,n))}}function gv(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function m_e(i){return i[0]}function g_e(i){return i[1]}function B$(i,e){var t,n,r=0,s,o,a,l,c,u,f,p=i[0],x=i[1],v=e.length;for(t=0;t<v;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]-p,a=u[1]-x,n;n<S;n++){if(f=w[n+1],l=f[0]-p,c=f[1]-x,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=Hp(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 U$(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 k$(i){return i.type==="Feature"?i.geometry:i}function __e(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");let n=U$(i),r=k$(e),s=r.type,o=e.bbox,a=r.coordinates;if(o&&x_e(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){let u=B$(n,a[c]);if(u===0)return!t.ignoreBoundary;u&&(l=!0)}return l}function x_e(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var G$=__e;var lc=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 jp=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 _v=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,P,R;w<T;w+=3,S+=2){let C=n[w]*2,L=n[w+1]*2,D=n[w+2]*2,F=e[C],N=e[C+1],B=e[L],z=e[L+1],V=e[D],H=e[D+1],Z=B-F,J=z-N,j=V-F,K=H-N,ee=(Z*K-J*j)*2;if(Math.abs(ee)<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 ae=1e9*Math.sign((s-F)*K-(o-N)*j);P=(F+V)/2-ae*K,R=(N+H)/2+ae*j}else{let ae=1/ee,ce=Z*Z+J*J,de=j*j+K*K;P=F+(K*ce-J*de)*ae,R=N+(Z*de-j*ce)*ae}a[S]=P,a[S+1]=R}let l=t[t.length-1],c,u=l*4,f,p=e[2*l],x,v=e[2*l+1];r.fill(0);for(let w=0;w<t.length;++w)l=t[w],c=u,f=p,x=v,u=l*4,p=e[2*l],v=e[2*l+1],r[c+2]=r[u]=x-v,r[c+3]=r[u+1]=p-f}render(e){let t=e==null?e=new lc: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 p=n[u];if(p<u)continue;let x=Math.floor(u/3)*2,v=Math.floor(p/3)*2,w=o[x],S=o[x+1],T=o[v],P=o[v+1];this._renderSegment(w,S,T,P,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,p=o[f],x=o[f+1],v=l*4,w=this._project(p,x,a[v+2],a[v+3]);w&&this._renderSegment(p,x,w[0],w[1],e)}return t&&t.value()}renderBounds(e){let t=e==null?e=new lc: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 lc: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 jp;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,p=0;for(let x=0;x<n;x+=2)if(s=a,o=l,a=t[x],l=t[x+1],c=u,u=this._regioncode(a,l),c===0&&u===0)f=p,p=0,r?r.push(a,l):r=[a,l];else{let v,w,S,T,P;if(c===0){if((v=this._clipSegment(s,o,a,l,c,u))===null)continue;[w,S,T,P]=v}else{if((v=this._clipSegment(a,l,s,o,u,c))===null)continue;[T,P,w,S]=v,f=p,p=this._edgecode(w,S),f&&p&&this._edge(e,f,p,r,r.length),r?r.push(w,S):r=[w,S]}f=p,p=this._edgecode(T,P),f&&p&&this._edge(e,f,p,r,r.length),r?r.push(T,P):r=[T,P]}if(r)f=p,p=this._edgecode(r[0],r[1]),f&&p&&this._edge(e,f,p,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,p=this._edgecode(a[u-2],a[u-1]);c<u;c+=2)f=p,p=this._edgecode(a[c],a[c+1]),f&&p&&(c=this._edge(e,f,p,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 y_e=2*Math.PI,t1=Math.pow;function v_e(i){return i[0]}function b_e(i){return i[1]}function w_e(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 S_e(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}var n1=class i{static from(e,t=v_e,n=b_e,r){return new i("length"in e?T_e(e,t,n,r):Float64Array.from(E_e(e,t,n,r)))}constructor(e){this._delaunator=new Wp(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&&w_e(e)){this.collinear=Int32Array.from({length:t.length/2},(p,x)=>x).sort((p,x)=>t[2*p]-t[2*x]||t[2*p+1]-t[2*x+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 p=0,x=t.length/2;p<x;++p){let v=S_e(t[2*p],t[2*p+1],f);t[2*p]=v[0],t[2*p+1]=v[1]}this._delaunator=new Wp(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 _v(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=t1(t-c[e*2],2)+t1(n-c[e*2+1],2),p=r[e],x=p;do{let v=l[x],w=t1(t-c[v*2],2)+t1(n-c[v*2+1],2);if(w<f&&(f=w,u=v),x=x%3===2?x-2:x+1,l[x]!==e)break;if(x=a[x],x===-1){if(x=s[(o[e]+1)%s.length],x!==v&&t1(t-c[x*2],2)+t1(n-c[x*2+1],2)<f)return x;break}}while(x!==p);return u}render(e){let t=e==null?e=new lc: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 lc: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,y_e)}return n&&n.value()}renderHull(e){let t=e==null?e=new lc: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 jp;return this.renderHull(e),e.value()}renderTriangle(e,t){let n=t==null?t=new lc: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 jp;return this.renderTriangle(e,t),t.value()}};function T_e(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*E_e(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 xv=Math.PI,z$=xv/2,QQe=xv/4,JQe=xv*2,C6=180/xv,R6=xv/180;var P6=Math.atan2,gE=Math.cos;var V$=Math.max,q$=Math.min;var _E=Math.sin,H$=Math.sign||function(i){return i>0?1:i<0?-1:0},xE=Math.sqrt;function I6(i){return i>1?z$:i<-1?-z$:Math.asin(i)}function N6(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Ka(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 yv(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function vv(i){var e=xE(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function L6(i){return[P6(i[1],i[0])*C6,I6(V$(-1,q$(1,i[2])))*C6]}function fh(i){let e=i[0]*R6,t=i[1]*R6,n=gE(t);return[n*gE(e),n*_E(e),_E(t)]}function yE(i){return i=i.map(e=>fh(e)),N6(i[0],Ka(i[2],i[1]))}function j$(i){let e=C_e(i),t=P_e(e),n=R_e(t,i),r=N_e(t,i.length),s=M_e(r,i),o=I_e(t,i),{polygons:a,centers:l}=L_e(o,t,i),c=D_e(a),u=O_e(t,i),f=F_e(n,t);return{delaunay:e,edges:n,triangles:t,centers:l,neighbors:r,polygons:a,mesh:c,hull:u,urquhart:f,find:s}}function M_e(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=fh([r,s]);do a=o,o=null,l=t(u,fh(e[a])),i[a].forEach(f=>{let p=t(u,fh(e[f]));if(p<l){l=p,o=f,c=f;return}});while(o!==null);return c}}function C_e(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);let t=FD(i[e]),n=JD().translate([0,0]).scale(1).rotate(t.invert([180,0]));i=i.map(n);let r=[],s=1;for(let p=0,x=i.length;p<x;p++){let v=i[p][0]**2+i[p][1]**2;!isFinite(v)||v>1e32?r.push(p):v>s&&(s=v)}let o=1e6*xE(s);r.forEach(p=>i[p]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);let a=n1.from(i);a.projection=n;let{triangles:l,halfedges:c,inedges:u}=a,f=[];for(let p=0,x=c.length;p<x;p++)if(c[p]<0){let v=p%3==2?p-2:p+1,w=p%3==0?p+2:p-1,S=c[v],T=c[w];c[S]=T,c[T]=S,c[v]=c[w]=-1,l[p]=l[v]=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(p,v,w)),p+=2-p%3}else l[p]>i.length-3-1&&(l[p]=e);return a}function R_e(i,e){let t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(yE(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(Bp([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function P_e(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 I_e(i,e){return i.map(t=>{let n=t.map(s=>e[s]).map(fh),r=yv(yv(Ka(n[1],n[0]),Ka(n[2],n[1])),Ka(n[0],n[2]));return L6(vv(r))})}function N_e(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 L_e(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=fh(t[0]),l=fh(t[1]),c=vv(yv(a,l)),u=vv(Ka(a,l)),f=Ka(c,u),p=[c,Ka(c,f),Ka(Ka(c,f),f),Ka(Ka(Ka(c,f),f),f)].map(L6).map(o);return n.push(p),n.push(p.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],p=a[(c+2)%3];n[u]=n[u]||[],n[u].push([f,p,l,[u,f,p]])}});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=W$(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),f=W$(t[a[0][3][2]],t[a[0][3][0]],r[l[0]]),p=o(u),x=o(f);return[l[0],x,l[1],p]}});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 W$(i,e,t){i=fh(i),e=fh(e),t=fh(t);let n=H$(N6(Ka(e,i),t));return L6(vv(yv(i,e)).map(r=>n*r))}function D_e(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 F_e(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=Bp([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 O_e(i,e){let t=new Set,n=[];i.map(a=>{if(!(yE(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 D6(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=j$(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return H3(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return H3(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=>yE(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=>Za(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||Za([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 O6(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 B_e(i){if(Array.isArray(i))return i}function U_e(i){if(Array.isArray(i))return O6(i)}function k_e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function G_e(i,e,t){return e=bE(e),$_e(i,$$()?Reflect.construct(e,[],bE(i).constructor):e.apply(i,t))}function z_e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function V_e(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function bE(i){return bE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},bE(i)}function q_e(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&&B6(i,e)}function $$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($$=function(){return!!i})()}function H_e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function W_e(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 j_e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4125-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function X_e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4126-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $_e(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 k_e(i)}function B6(i,e){return B6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},B6(i,e)}function dh(i,e){return B_e(i)||W_e(i,e)||Y$(i,e)||j_e()}function F6(i){return U_e(i)||H_e(i)||Y$(i)||X_e()}function Y$(i,e){if(i){if(typeof i=="string")return O6(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)?O6(i,e):void 0}}function Y_e(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=Z_e(i,n),s=oh(r),o=K_e(i,n),a=[].concat(F6(s),F6(o)),l={type:"Polygon",coordinates:i},c=O3(l),u=dh(c,2),f=dh(u[0],2),p=f[0],x=f[1],v=dh(u[1],2),w=v[0],S=v[1],T=p>w||S>=89||x<=-89,P=[];if(T){var R=D6(a).triangles(),C=new Map(a.map(function(ee,ae){var ce=dh(ee,2),de=ce[0],ve=ce[1];return["".concat(de,"-").concat(ve),ae]}));R.features.forEach(function(ee){var ae,ce=ee.geometry.coordinates[0].slice(0,3).reverse(),de=[];if(ce.forEach(function(Ie){var Qe=dh(Ie,2),Ue=Qe[0],mt=Qe[1],Me="".concat(Ue,"-").concat(mt);C.has(Me)&&de.push(C.get(Me))}),de.length===3){if(de.some(function(Ie){return Ie<s.length})){var ve=ee.properties.circumcenter;if(!U6(ve,l,T))return}(ae=P).push.apply(ae,de)}})}else if(o.length)for(var B=Wp.from(a),z=function(ae){var ce,de=[2,1,0].map(function(Qe){return B.triangles[ae+Qe]}),ve=de.map(function(Qe){return a[Qe]});if(de.some(function(Qe){return Qe<s.length})){var Ie=[0,1].map(function(Qe){return _3(ve,function(Ue){return Ue[Qe]})});if(!U6(Ie,l,T))return 1}(ce=P).push.apply(ce,F6(de))},V=0,H=B.triangles.length;V<H;V+=3)z(V);else{var L=Y_(r),D=L.vertices,F=L.holes,N=F===void 0?[]:F;P=d6(D,N,2)}var Z=$a(Bp(a,function(ee){return ee[0]}),[0,1]),J=$a(Bp(a,function(ee){return ee[1]}),[0,1]),j=a.map(function(ee){var ae=dh(ee,2),ce=ae[0],de=ae[1];return[Z(ce),J(de)]}),K={points:a,indices:P,uvs:j};return{contour:r,triangles:K}}function Z_e(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var o=Za(s,r)*180/Math.PI;if(o>e)for(var a=om(r,s),l=1/Math.ceil(o/e),c=l;c<1;)n.push(a(c)),c+=l}n.push(r=s)}),n})}function K_e(i,e){var t={type:"Polygon",coordinates:i},n=O3(t),r=dh(n,2),s=dh(r[0],2),o=s[0],a=s[1],l=dh(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 Q_e(e,{minLng:o,maxLng:c,minLat:a,maxLat:u}).filter(function(p){return U6(p,t,f)})}function Q_e(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],p=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},x=[],v=f[0];v<=f[1];v++){var w=l(v);p(w)&&x.push([w,c(v)])}return x}function U6(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?VD(e,i):G$(i,e)}var vE=window.THREE?window.THREE:{BufferGeometry:qn,Float32BufferAttribute:Rn},X$=new vE.BufferGeometry().setAttribute?"setAttribute":"addAttribute",wE=(function(i){function e(t,n,r,s,o,a,l){var c;z_e(this,e),c=G_e(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=Y_e(t,{resolution:l}),f=u.contour,p=u.triangles,x=oh(p.uvs),v=[],w=[],S=[],T=0,P=function(F){var N=Math.round(v.length/3),B=S.length;v=v.concat(F.vertices),w=w.concat(F.uvs),S=S.concat(N?F.indices.map(function(z){return z+N}):F.indices),c.addGroup(B,S.length-B,T++)};a&&P(C()),s&&P(L(n,!1)),o&&P(L(r,!0)),c.setIndex(S),c[X$]("position",new vE.Float32BufferAttribute(v,3)),c[X$]("uv",new vE.Float32BufferAttribute(w,2)),c.computeVertexNormals();function R(D,F){var N=typeof F=="function"?F:function(){return F},B=D.map(function(z){return z.map(function(V){var H=dh(V,2),Z=H[0],J=H[1];return J_e(J,Z,N(Z,J))})});return Y_(B)}function C(){for(var D=R(f,n),F=D.vertices,N=D.holes,B=R(f,r),z=B.vertices,V=oh([z,F]),H=Math.round(z.length/3),Z=new Set(N),J=0,j=[],K=0;K<H;K++){var ee=K+1;if(ee===H)ee=J;else if(Z.has(ee)){var ae=ee;ee=J,J=ae}j.push(K,K+H,ee+H),j.push(ee+H,ee,K)}for(var ce=[],de=1;de>=0;de--)for(var ve=0;ve<H;ve+=1)ce.push(ve/(H-1),de);return{indices:j,vertices:V,uvs:ce}}function L(D){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return{indices:F?p.indices:p.indices.slice().reverse(),vertices:R([p.points],D).vertices,uvs:x}}return c}return q_e(e,i),V_e(e)})(vE.BufferGeometry);function J_e(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 k6(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 e1e(i){if(Array.isArray(i))return i}function t1e(i){if(Array.isArray(i))return k6(i)}function n1e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function i1e(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 r1e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4127-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function s1e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4128-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function o1e(i,e){if(i==null)return{};var t,n,r=a1e(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 a1e(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 l1e(i,e){return e1e(i)||i1e(i,e)||Z$(i,e)||r1e()}function c1e(i){return t1e(i)||n1e(i)||Z$(i)||s1e()}function u1e(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 h1e(i){var e=u1e(i,"string");return typeof e=="symbol"?e:e+""}function Z$(i,e){if(i){if(typeof i=="string")return k6(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)?k6(i,e):void 0}}var K$=(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,p){var x=f.keyAccessor,v=f.isProp,w;if(v){var S=u,T=S[x],P=o1e(S,[x].map(h1e));w=T,u=P}else w=x(u,p);p+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=l1e(u,2),p=f[0],x=f[1];return a(x,[].concat(c1e(c),[p]))})})(s),e instanceof Array&&e.length===0&&o.length===1&&(o[0].keys=[])),o});var hi=(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(Ne){return e.locateFile?e.locateFile(Ne,s):s+Ne}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(nt,It,He){var h=new XMLHttpRequest;h.open("GET",nt,!0),h.responseType="arraybuffer",h.onload=function(){if(h.status==200||h.status==0&&h.response){It(h.response);return}var wi=wt(nt);if(wi){It(wi.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(Ne){u=Ne},p=function(){return u},x=8;function v(Ne,nt,It,He){switch(It=It||"i8",It.charAt(It.length-1)==="*"&&(It="i32"),It){case"i1":J[Ne>>0]=nt;break;case"i8":J[Ne>>0]=nt;break;case"i16":K[Ne>>1]=nt;break;case"i32":ae[Ne>>2]=nt;break;case"i64":Ve=[nt>>>0,(Pe=nt,+vt(Pe)>=1?Pe>0?(Kt(+ln(Pe/4294967296),4294967295)|0)>>>0:~~+yt((Pe-+(~~Pe>>>0))/4294967296)>>>0:0)],ae[Ne>>2]=Ve[0],ae[Ne+4>>2]=Ve[1];break;case"float":de[Ne>>2]=nt;break;case"double":ve[Ne>>3]=nt;break;default:P0("invalid type for setValue: "+It)}}function w(Ne,nt,It){switch(nt=nt||"i8",nt.charAt(nt.length-1)==="*"&&(nt="i32"),nt){case"i1":return J[Ne>>0];case"i8":return J[Ne>>0];case"i16":return K[Ne>>1];case"i32":return ae[Ne>>2];case"i64":return ae[Ne>>2];case"float":return de[Ne>>2];case"double":return ve[Ne>>3];default:P0("invalid type for getValue: "+nt)}return null}var S=!1;function T(Ne,nt){Ne||P0("Assertion failed: "+nt)}function P(Ne){var nt=e["_"+Ne];return T(nt,"Cannot call unknown function "+Ne+", make sure it is exported"),nt}function R(Ne,nt,It,He,h){var Xi={string:function(Qn){var Ni=0;if(Qn!=null&&Qn!==0){var jb=(Qn.length<<2)+1;Ni=i9(jb),B(Qn,Ni,jb)}return Ni},array:function(Qn){var Ni=i9(Qn.length);return V(Qn,Ni),Ni}};function wi(Qn){return nt==="string"?F(Qn):nt==="boolean"?!!Qn:Qn}var ne=P(Ne),$i=[],Da=0;if(He)for(var js=0;js<He.length;js++){var Ns=Xi[It[js]];Ns?(Da===0&&(Da=ere()),$i[js]=Ns(He[js])):$i[js]=He[js]}var is=ne.apply(null,$i);return is=wi(is),Da!==0&&Jie(Da),is}function C(Ne,nt,It,He){It=It||[];var h=It.every(function(wi){return wi==="number"}),Xi=nt!=="string";return Xi&&h&&!He?P(Ne):function(){return R(Ne,nt,It,arguments,He)}}var L=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function D(Ne,nt,It){for(var He=nt+It,h=nt;Ne[h]&&!(h>=He);)++h;if(h-nt>16&&Ne.subarray&&L)return L.decode(Ne.subarray(nt,h));for(var Xi="";nt<h;){var wi=Ne[nt++];if(!(wi&128)){Xi+=String.fromCharCode(wi);continue}var ne=Ne[nt++]&63;if((wi&224)==192){Xi+=String.fromCharCode((wi&31)<<6|ne);continue}var $i=Ne[nt++]&63;if((wi&240)==224?wi=(wi&15)<<12|ne<<6|$i:wi=(wi&7)<<18|ne<<12|$i<<6|Ne[nt++]&63,wi<65536)Xi+=String.fromCharCode(wi);else{var Da=wi-65536;Xi+=String.fromCharCode(55296|Da>>10,56320|Da&1023)}}return Xi}function F(Ne,nt){return Ne?D(j,Ne,nt):""}function N(Ne,nt,It,He){if(!(He>0))return 0;for(var h=It,Xi=It+He-1,wi=0;wi<Ne.length;++wi){var ne=Ne.charCodeAt(wi);if(ne>=55296&&ne<=57343){var $i=Ne.charCodeAt(++wi);ne=65536+((ne&1023)<<10)|$i&1023}if(ne<=127){if(It>=Xi)break;nt[It++]=ne}else if(ne<=2047){if(It+1>=Xi)break;nt[It++]=192|ne>>6,nt[It++]=128|ne&63}else if(ne<=65535){if(It+2>=Xi)break;nt[It++]=224|ne>>12,nt[It++]=128|ne>>6&63,nt[It++]=128|ne&63}else{if(It+3>=Xi)break;nt[It++]=240|ne>>18,nt[It++]=128|ne>>12&63,nt[It++]=128|ne>>6&63,nt[It++]=128|ne&63}}return nt[It]=0,It-h}function B(Ne,nt,It){return N(Ne,j,nt,It)}var z=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function V(Ne,nt){J.set(Ne,nt)}function H(Ne,nt){return Ne%nt>0&&(Ne+=nt-Ne%nt),Ne}var Z,J,j,K,ee,ae,ce,de,ve;function Ie(Ne){Z=Ne,e.HEAP8=J=new Int8Array(Ne),e.HEAP16=K=new Int16Array(Ne),e.HEAP32=ae=new Int32Array(Ne),e.HEAPU8=j=new Uint8Array(Ne),e.HEAPU16=ee=new Uint16Array(Ne),e.HEAPU32=ce=new Uint32Array(Ne),e.HEAPF32=de=new Float32Array(Ne),e.HEAPF64=ve=new Float64Array(Ne)}var Qe=5271296,Ue=28384,mt=e.TOTAL_MEMORY||33554432;e.buffer?Z=e.buffer:Z=new ArrayBuffer(mt),mt=Z.byteLength,Ie(Z),ae[Ue>>2]=Qe;function Me(Ne){for(;Ne.length>0;){var nt=Ne.shift();if(typeof nt=="function"){nt();continue}var It=nt.func;typeof It=="number"?nt.arg===void 0?e.dynCall_v(It):e.dynCall_vi(It,nt.arg):It(nt.arg===void 0?null:nt.arg)}}var ze=[],$e=[],Et=[],Tt=[];function Ct(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)st(e.preRun.shift());Me(ze)}function un(){Me($e)}function Gt(){Me(Et)}function Xe(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)tt(e.postRun.shift());Me(Tt)}function st(Ne){ze.unshift(Ne)}function tt(Ne){Tt.unshift(Ne)}var vt=Math.abs,yt=Math.ceil,ln=Math.floor,Kt=Math.min,Qt=0,xn=null,ge=null;function di(Ne){Qt++,e.monitorRunDependencies&&e.monitorRunDependencies(Qt)}function Bn(Ne){if(Qt--,e.monitorRunDependencies&&e.monitorRunDependencies(Qt),Qt==0&&(xn!==null&&(clearInterval(xn),xn=null),ge)){var nt=ge;ge=null,nt()}}e.preloadedImages={},e.preloadedAudios={};var le=null,X="data:application/octet-stream;base64,";function Te(Ne){return String.prototype.startsWith?Ne.startsWith(X):Ne.indexOf(X)===0}var Pe,Ve;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 gt=28400;function St(Ne){return Ne}function qe(Ne){var nt=/\b__Z[\w\d_]+/g;return Ne.replace(nt,function(It){var He=It;return It===He?It:He+" ["+It+"]"})}function Ke(){var Ne=new Error;if(!Ne.stack){try{throw new Error(0)}catch(nt){Ne=nt}if(!Ne.stack)return"(no stack trace available)"}return Ne.stack.toString()}function Rt(){var Ne=Ke();return e.extraStackTrace&&(Ne+=`4129-`+e.extraStackTrace()),qe(Ne)}function en(Ne,nt,It,He){P0("Assertion failed: "+F(Ne)+", at: "+[nt?F(nt):"unknown filename",It,He?F(He):"unknown function"])}function Pt(){return J.length}function Mt(Ne,nt,It){j.set(j.subarray(nt,nt+It),Ne)}function cn(Ne){return e.___errno_location&&(ae[e.___errno_location()>>2]=Ne),Ne}function yn(Ne){P0("OOM")}function Pn(Ne){try{var nt=new ArrayBuffer(Ne);return nt.byteLength!=Ne?void 0:(new Int8Array(nt).set(J),tn(nt),Ie(nt),1)}catch{}}function xe(Ne){var nt=Pt(),It=16777216,He=2147483648-It;if(Ne>He)return!1;for(var h=16777216,Xi=Math.max(nt,h);Xi<Ne;)Xi<=536870912?Xi=H(2*Xi,It):Xi=Math.min(H((3*Xi+2147483648)/4,It),He);var wi=Pn(Xi);return!!wi}var bt=typeof atob=="function"?atob:function(Ne){var nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",It="",He,h,Xi,wi,ne,$i,Da,js=0;Ne=Ne.replace(/[^A-Za-z0-9\+\/\=]/g,"");do wi=nt.indexOf(Ne.charAt(js++)),ne=nt.indexOf(Ne.charAt(js++)),$i=nt.indexOf(Ne.charAt(js++)),Da=nt.indexOf(Ne.charAt(js++)),He=wi<<2|ne>>4,h=(ne&15)<<4|$i>>2,Xi=($i&3)<<6|Da,It=It+String.fromCharCode(He),$i!==64&&(It=It+String.fromCharCode(h)),Da!==64&&(It=It+String.fromCharCode(Xi));while(js<Ne.length);return It};function Ye(Ne){try{for(var nt=bt(Ne),It=new Uint8Array(nt.length),He=0;He<nt.length;++He)It[He]=nt.charCodeAt(He);return It}catch{throw new Error("Converting base64 string to bytes failed.")}}function wt(Ne){if(Te(Ne))return Ye(Ne.slice(X.length))}var Dt={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},ct={a:P0,b:f,c:p,d:en,e:cn,f:Pt,g:Mt,h:xe,i:yn,j:St,k:qe,l:Pn,m:Ke,n:Rt,o:gt,p:Ue},Ce=(function(Ne,nt,It){"almost asm";var He=new Ne.Int8Array(It),h=new Ne.Int32Array(It),Xi=new Ne.Uint8Array(It),wi=new Ne.Float32Array(It),ne=new Ne.Float64Array(It),$i=nt.o|0,Da=nt.p|0,js=Ne.Math.floor,Ns=Ne.Math.abs,is=Ne.Math.sqrt,Qn=Ne.Math.cos,Ni=Ne.Math.sin,jb=Ne.Math.tan,tre=Ne.Math.acos,rx=Ne.Math.asin,a9=Ne.Math.atan,ia=Ne.Math.atan2,eg=Ne.Math.ceil,Fa=Ne.Math.imul,p4=Ne.Math.min,nre=Ne.Math.max,$h=Ne.Math.clz32,ire=nt.a,Dn=nt.b,Q=nt.c,li=nt.d,l9=nt.e,rre=nt.f,sre=nt.g,ore=nt.h,are=nt.i,Y=28416;function lre(d){return He=new Int8Array(d),Xi=new Uint8Array(d),h=new Int32Array(d),wi=new Float32Array(d),ne=new Float64Array(d),It=d,!0}function cre(d){d=d|0;var A=0;return A=Y,Y=Y+d|0,Y=Y+15&-16,A|0}function ure(){return Y|0}function hre(d){d=d|0,Y=d}function fre(d,A){d=d|0,A=A|0,Y=d}function dre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;return(d|0)<0?(A=2,A|0):(d|0)>13780509?(A=Zb(15,A)|0,A|0):(m=((d|0)<0)<<31>>31,g=cr(d|0,m|0,3,0)|0,_=Q()|0,m=pt(d|0,m|0,1,0)|0,m=cr(g|0,_|0,m|0,Q()|0)|0,m=pt(m|0,Q()|0,1,0)|0,d=Q()|0,h[A>>2]=m,h[A+4>>2]=d,A=0,A|0)}function c9(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,u9(d,A,m,_,0)|0}function u9(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0;if(M=Y,Y=Y+16|0,b=M,!(h9(d,A,m,_,g)|0))return _=0,Y=M,_|0;do if((m|0)>=0){if((m|0)>13780509){if(y=Zb(15,b)|0,y|0)break;E=b,b=h[E>>2]|0,E=h[E+4>>2]|0}else y=((m|0)<0)<<31>>31,I=cr(m|0,y|0,3,0)|0,E=Q()|0,y=pt(m|0,y|0,1,0)|0,y=cr(I|0,E|0,y|0,Q()|0)|0,y=pt(y|0,Q()|0,1,0)|0,E=Q()|0,h[b>>2]=y,h[b+4>>2]=E,b=y;if(hd(_|0,0,b<<3|0)|0,g|0){hd(g|0,0,b<<2|0)|0,y=pu(d,A,m,_,g,b,E,0)|0;break}y=ra(b,4)|0,y?(I=pu(d,A,m,_,y,b,E,0)|0,_t(y),y=I):y=13}else y=2;while(!1);return I=y,Y=M,I|0}function h9(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0;if(oe=Y,Y=Y+16|0,W=oe,$=oe+8|0,q=W,h[q>>2]=d,h[q+4>>2]=A,(m|0)<0)return $=2,Y=oe,$|0;if(y=_,h[y>>2]=d,h[y+4>>2]=A,y=(g|0)!=0,y&&(h[g>>2]=0),ki(d,A)|0)return $=9,Y=oe,$|0;h[$>>2]=0;e:do if((m|0)>=1)if(y)for(O=1,I=0,G=0,q=1,y=d;;){if(!(I|G)){if(y=Ls(y,A,4,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,ki(y,A)|0){y=9;break e}}if(y=Ls(y,A,h[26864+(G<<2)>>2]|0,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,d=_+(O<<3)|0,h[d>>2]=y,h[d+4>>2]=A,h[g+(O<<2)>>2]=q,d=I+1|0,b=(d|0)==(q|0),E=G+1|0,M=(E|0)==6,ki(y,A)|0){y=9;break e}if(q=q+(M&b&1)|0,(q|0)>(m|0)){y=0;break}else O=O+1|0,I=b?0:d,G=b?M?0:E:G}else for(O=1,I=0,G=0,q=1,y=d;;){if(!(I|G)){if(y=Ls(y,A,4,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,ki(y,A)|0){y=9;break e}}if(y=Ls(y,A,h[26864+(G<<2)>>2]|0,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,d=_+(O<<3)|0,h[d>>2]=y,h[d+4>>2]=A,d=I+1|0,b=(d|0)==(q|0),E=G+1|0,M=(E|0)==6,ki(y,A)|0){y=9;break e}if(q=q+(M&b&1)|0,(q|0)>(m|0)){y=0;break}else O=O+1|0,I=b?0:d,G=b?M?0:E:G}else y=0;while(!1);return $=y,Y=oe,$|0}function pu(d,A,m,_,g,y,b,E){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0,E=E|0;var M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0;if(oe=Y,Y=Y+16|0,W=oe+8|0,$=oe,M=Yh(d|0,A|0,y|0,b|0)|0,O=Q()|0,G=_+(M<<3)|0,ue=G,_e=h[ue>>2]|0,ue=h[ue+4>>2]|0,I=(_e|0)==(d|0)&(ue|0)==(A|0),!((_e|0)==0&(ue|0)==0|I))do M=pt(M|0,O|0,1,0)|0,M=ud(M|0,Q()|0,y|0,b|0)|0,O=Q()|0,G=_+(M<<3)|0,_e=G,ue=h[_e>>2]|0,_e=h[_e+4>>2]|0,I=(ue|0)==(d|0)&(_e|0)==(A|0);while(!((ue|0)==0&(_e|0)==0|I));if(M=g+(M<<2)|0,I&&(h[M>>2]|0)<=(E|0)||(_e=G,h[_e>>2]=d,h[_e+4>>2]=A,h[M>>2]=E,(E|0)>=(m|0)))return _e=0,Y=oe,_e|0;switch(I=E+1|0,h[W>>2]=0,M=Ls(d,A,2,W,$)|0,M|0){case 9:{q=9;break}case 0:{M=$,M=pu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M||(q=9);break}default:}e:do if((q|0)==9){switch(h[W>>2]=0,M=Ls(d,A,3,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=pu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}switch(h[W>>2]=0,M=Ls(d,A,1,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=pu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}switch(h[W>>2]=0,M=Ls(d,A,5,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=pu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}switch(h[W>>2]=0,M=Ls(d,A,4,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=pu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}switch(h[W>>2]=0,M=Ls(d,A,6,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=pu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}return _e=0,Y=oe,_e|0}while(!1);return _e=M,Y=oe,_e|0}function Ls(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if(m>>>0>6)return g=1,g|0;b=(h[_>>2]|0)%6|0,h[_>>2]=b;e:do if((b|0)>0)for(y=0;;){switch(m|0){case 1:{m=5;break}case 5:{m=4;break}case 4:{m=6;break}case 6:{m=2;break}case 2:{m=3;break}case 3:{m=1;break}default:}if(y=y+1|0,(y|0)==(b|0))break e}while(!1);if(G=et(d|0,A|0,45)|0,Q()|0,O=G&127,O>>>0>121)return g=5,g|0;M=Oa(d,A)|0,y=et(d|0,A|0,52)|0,Q()|0,y=y&15;e:do if(!y)I=15;else{for(;;){if(b=(15-y|0)*3|0,E=et(d|0,A|0,b|0)|0,Q()|0,E=E&7,(E|0)==7){A=5;break}if($=(zl(y)|0)==0,y=y+-1|0,q=ht(7,0,b|0)|0,A=A&~(Q()|0),W=ht(h[($?432:16)+(E*28|0)+(m<<2)>>2]|0,0,b|0)|0,b=Q()|0,m=h[($?640:224)+(E*28|0)+(m<<2)>>2]|0,d=W|d&~q,A=b|A,!m){m=0;break e}if(!y){I=15;break e}}return A|0}while(!1);(I|0)==15&&($=h[848+(O*28|0)+(m<<2)>>2]|0,W=ht($|0,0,45)|0,d=W|d,A=Q()|0|A&-1040385,m=h[4272+(O*28|0)+(m<<2)>>2]|0,($&127|0)==127&&($=ht(h[848+(O*28|0)+20>>2]|0,0,45)|0,A=Q()|0|A&-1040385,m=h[4272+(O*28|0)+20>>2]|0,d=I0($|d,A)|0,A=Q()|0,h[_>>2]=(h[_>>2]|0)+1)),E=et(d|0,A|0,45)|0,Q()|0,E=E&127;e:do if(ar(E)|0){t:do if((Oa(d,A)|0)==1){if((O|0)!=(E|0))if(A9(E,h[7696+(O*28|0)>>2]|0)|0){d=E4(d,A)|0,b=1,A=Q()|0;break}else li(27634,26928,533,26936);switch(M|0){case 3:{d=I0(d,A)|0,A=Q()|0,h[_>>2]=(h[_>>2]|0)+1,b=0;break t}case 5:{d=E4(d,A)|0,A=Q()|0,h[_>>2]=(h[_>>2]|0)+5,b=0;break t}case 0:return $=9,$|0;default:return $=1,$|0}}else b=0;while(!1);if((m|0)>0){y=0;do d=T4(d,A)|0,A=Q()|0,y=y+1|0;while((y|0)!=(m|0))}if((O|0)!=(E|0)){if(!(A4(E)|0)){if((b|0)!=0|(Oa(d,A)|0)!=5)break;h[_>>2]=(h[_>>2]|0)+1;break}switch(G&127){case 8:case 118:break e;default:}(Oa(d,A)|0)!=3&&(h[_>>2]=(h[_>>2]|0)+1)}}else if((m|0)>0){y=0;do d=I0(d,A)|0,A=Q()|0,y=y+1|0;while((y|0)!=(m|0))}while(!1);return h[_>>2]=((h[_>>2]|0)+m|0)%6|0,$=g,h[$>>2]=d,h[$+4>>2]=A,$=0,$|0}function pre(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,f9(d,A,m,_)|0?(hd(_|0,0,m*48|0)|0,_=Are(d,A,m,_)|0,_|0):(_=0,_|0)}function f9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if($=Y,Y=Y+16|0,q=$,W=$+8|0,G=q,h[G>>2]=d,h[G+4>>2]=A,(m|0)<0)return W=2,Y=$,W|0;if(!m)return W=_,h[W>>2]=d,h[W+4>>2]=A,W=0,Y=$,W|0;h[W>>2]=0;e:do if(ki(d,A)|0)d=9;else{g=0,G=d;do{if(d=Ls(G,A,4,W,q)|0,d|0)break e;if(A=q,G=h[A>>2]|0,A=h[A+4>>2]|0,g=g+1|0,ki(G,A)|0){d=9;break e}}while((g|0)<(m|0));O=_,h[O>>2]=G,h[O+4>>2]=A,O=m+-1|0,I=0,d=1;do{if(g=26864+(I<<2)|0,(I|0)==5)for(b=h[g>>2]|0,y=0,g=d;;){if(d=q,d=Ls(h[d>>2]|0,h[d+4>>2]|0,b,W,q)|0,d|0)break e;if((y|0)!=(O|0))if(M=q,E=h[M>>2]|0,M=h[M+4>>2]|0,d=_+(g<<3)|0,h[d>>2]=E,h[d+4>>2]=M,!(ki(E,M)|0))d=g+1|0;else{d=9;break e}else d=g;if(y=y+1|0,(y|0)>=(m|0))break;g=d}else for(b=q,M=h[g>>2]|0,E=0,g=d,y=h[b>>2]|0,b=h[b+4>>2]|0;;){if(d=Ls(y,b,M,W,q)|0,d|0)break e;if(b=q,y=h[b>>2]|0,b=h[b+4>>2]|0,d=_+(g<<3)|0,h[d>>2]=y,h[d+4>>2]=b,d=g+1|0,ki(y,b)|0){d=9;break e}if(E=E+1|0,(E|0)>=(m|0))break;g=d}I=I+1|0}while(I>>>0<6);d=q,d=(G|0)==(h[d>>2]|0)&&(A|0)==(h[d+4>>2]|0)?0:9}while(!1);return W=d,Y=$,W|0}function Are(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;if(G=Y,Y=Y+16|0,b=G,!m)return h[_>>2]=d,h[_+4>>2]=A,_=0,Y=G,_|0;do if((m|0)>=0){if((m|0)>13780509){if(g=Zb(15,b)|0,g|0)break;y=b,g=h[y>>2]|0,y=h[y+4>>2]|0}else g=((m|0)<0)<<31>>31,O=cr(m|0,g|0,3,0)|0,y=Q()|0,g=pt(m|0,g|0,1,0)|0,g=cr(O|0,y|0,g|0,Q()|0)|0,g=pt(g|0,Q()|0,1,0)|0,y=Q()|0,O=b,h[O>>2]=g,h[O+4>>2]=y;if(I=ra(g,8)|0,!I)g=13;else{if(O=ra(g,4)|0,!O){_t(I),g=13;break}if(g=pu(d,A,m,I,O,g,y,0)|0,g|0){_t(I),_t(O);break}if(A=h[b>>2]|0,b=h[b+4>>2]|0,(b|0)>0|(b|0)==0&A>>>0>0){g=0,E=0,M=0;do d=I+(E<<3)|0,y=h[d>>2]|0,d=h[d+4>>2]|0,!((y|0)==0&(d|0)==0)&&(h[O+(E<<2)>>2]|0)==(m|0)&&(q=_+(g<<3)|0,h[q>>2]=y,h[q+4>>2]=d,g=g+1|0),E=pt(E|0,M|0,1,0)|0,M=Q()|0;while((M|0)<(b|0)|(M|0)==(b|0)&E>>>0<A>>>0)}_t(I),_t(O),g=0}}else g=2;while(!1);return q=g,Y=G,q|0}function Xb(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;for(E=Y,Y=Y+16|0,y=E,b=E+8|0,g=(ki(d,A)|0)==0,g=g?1:2;;){if(h[b>>2]=0,I=(Ls(d,A,g,b,y)|0)==0,M=y,I&((h[M>>2]|0)==(m|0)?(h[M+4>>2]|0)==(_|0):0)){d=4;break}if(g=g+1|0,g>>>0>=7){g=7,d=4;break}}return(d|0)==4?(Y=E,g|0):0}function mre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;if(E=Y,Y=Y+48|0,g=E+16|0,y=E+8|0,b=E,m=fx(m)|0,m|0)return b=m,Y=E,b|0;if(I=d,M=h[I+4>>2]|0,m=y,h[m>>2]=h[I>>2],h[m+4>>2]=M,L9(y,g),m=x9(g,A,b)|0,!m){if(A=h[y>>2]|0,y=h[d+8>>2]|0,(y|0)>0){g=h[d+12>>2]|0,m=0;do A=(h[g+(m<<3)>>2]|0)+A|0,m=m+1|0;while((m|0)<(y|0))}m=b,g=h[m>>2]|0,m=h[m+4>>2]|0,y=((A|0)<0)<<31>>31,(m|0)<(y|0)|(m|0)==(y|0)&g>>>0<A>>>0?(m=b,h[m>>2]=A,h[m+4>>2]=y,m=y):A=g,M=pt(A|0,m|0,12,0)|0,I=Q()|0,m=b,h[m>>2]=M,h[m+4>>2]=I,m=_,h[m>>2]=M,h[m+4>>2]=I,m=0}return I=m,Y=E,I|0}function d9(d,A,m,_,g,y,b){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0;var E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0,ci=0,gi=0,lo=0,Un=0,_i=0,sa=0;if(gi=Y,Y=Y+64|0,Ot=gi+48|0,at=gi+32|0,dt=gi+24|0,Fe=gi+8|0,Ze=gi,M=h[d>>2]|0,(M|0)<=0)return ci=0,Y=gi,ci|0;for(Ee=d+4|0,ye=Ot+8|0,At=at+8|0,We=Fe+8|0,E=0,be=0;;){I=h[Ee>>2]|0,re=I+(be<<4)|0,h[Ot>>2]=h[re>>2],h[Ot+4>>2]=h[re+4>>2],h[Ot+8>>2]=h[re+8>>2],h[Ot+12>>2]=h[re+12>>2],(be|0)==(M+-1|0)?(h[at>>2]=h[I>>2],h[at+4>>2]=h[I+4>>2],h[at+8>>2]=h[I+8>>2],h[at+12>>2]=h[I+12>>2]):(re=I+(be+1<<4)|0,h[at>>2]=h[re>>2],h[at+4>>2]=h[re+4>>2],h[at+8>>2]=h[re+8>>2],h[at+12>>2]=h[re+12>>2]),M=Ire(Ot,at,_,dt)|0;e:do if(M)I=0,E=M;else if(M=dt,I=h[M>>2]|0,M=h[M+4>>2]|0,(M|0)>0|(M|0)==0&I>>>0>0){_e=0,re=0;t:for(;;){if(Un=1/(+(I>>>0)+4294967296*+(M|0)),sa=+ne[Ot>>3],M=Ds(I|0,M|0,_e|0,re|0)|0,_i=+(M>>>0)+4294967296*+(Q()|0),lo=+(_e>>>0)+4294967296*+(re|0),ne[Fe>>3]=Un*(sa*_i)+Un*(+ne[at>>3]*lo),ne[We>>3]=Un*(+ne[ye>>3]*_i)+Un*(+ne[At>>3]*lo),M=M4(Fe,_,Ze)|0,M|0){E=M;break}ue=Ze,oe=h[ue>>2]|0,ue=h[ue+4>>2]|0,q=Yh(oe|0,ue|0,A|0,m|0)|0,O=Q()|0,M=b+(q<<3)|0,G=M,I=h[G>>2]|0,G=h[G+4>>2]|0;n:do if((I|0)==0&(G|0)==0)me=M,ci=16;else for(W=0,$=0;;){if((W|0)>(m|0)|(W|0)==(m|0)&$>>>0>A>>>0){E=1;break t}if((I|0)==(oe|0)&(G|0)==(ue|0))break n;if(M=pt(q|0,O|0,1,0)|0,q=ud(M|0,Q()|0,A|0,m|0)|0,O=Q()|0,$=pt($|0,W|0,1,0)|0,W=Q()|0,M=b+(q<<3)|0,G=M,I=h[G>>2]|0,G=h[G+4>>2]|0,(I|0)==0&(G|0)==0){me=M,ci=16;break}}while(!1);if((ci|0)==16&&(ci=0,!((oe|0)==0&(ue|0)==0))&&($=me,h[$>>2]=oe,h[$+4>>2]=ue,$=y+(h[g>>2]<<3)|0,h[$>>2]=oe,h[$+4>>2]=ue,$=g,$=pt(h[$>>2]|0,h[$+4>>2]|0,1,0)|0,oe=Q()|0,ue=g,h[ue>>2]=$,h[ue+4>>2]=oe),_e=pt(_e|0,re|0,1,0)|0,re=Q()|0,M=dt,I=h[M>>2]|0,M=h[M+4>>2]|0,!((M|0)>(re|0)|(M|0)==(re|0)&I>>>0>_e>>>0)){I=1;break e}}I=0}else I=1;while(!1);if(be=be+1|0,!I){ci=21;break}if(M=h[d>>2]|0,(be|0)>=(M|0)){E=0,ci=21;break}}return(ci|0)==21?(Y=gi,E|0):0}function gre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0,ci=0,gi=0,lo=0,Un=0,_i=0;if(_i=Y,Y=Y+112|0,ci=_i+80|0,M=_i+72|0,gi=_i,lo=_i+56|0,g=fx(m)|0,g|0)return Un=g,Y=_i,Un|0;if(I=d+8|0,Un=lr((h[I>>2]<<5)+32|0)|0,!Un)return Un=13,Y=_i,Un|0;if(D4(d,Un),g=fx(m)|0,!g){if(at=d,dt=h[at+4>>2]|0,g=M,h[g>>2]=h[at>>2],h[g+4>>2]=dt,L9(M,ci),g=x9(ci,A,gi)|0,g)at=0,dt=0;else{if(g=h[M>>2]|0,y=h[I>>2]|0,(y|0)>0){b=h[d+12>>2]|0,m=0;do g=(h[b+(m<<3)>>2]|0)+g|0,m=m+1|0;while((m|0)!=(y|0));m=g}else m=g;g=gi,y=h[g>>2]|0,g=h[g+4>>2]|0,b=((m|0)<0)<<31>>31,(g|0)<(b|0)|(g|0)==(b|0)&y>>>0<m>>>0?(g=gi,h[g>>2]=m,h[g+4>>2]=b,g=b):m=y,at=pt(m|0,g|0,12,0)|0,dt=Q()|0,g=gi,h[g>>2]=at,h[g+4>>2]=dt,g=0}if(!g){if(m=ra(at,8)|0,!m)return _t(Un),Un=13,Y=_i,Un|0;if(E=ra(at,8)|0,!E)return _t(Un),_t(m),Un=13,Y=_i,Un|0;We=ci,h[We>>2]=0,h[We+4>>2]=0,We=d,Ot=h[We+4>>2]|0,g=M,h[g>>2]=h[We>>2],h[g+4>>2]=Ot,g=d9(M,at,dt,A,ci,m,E)|0;e:do if(g)_t(m),_t(E),_t(Un);else{t:do if((h[I>>2]|0)>0){for(b=d+12|0,y=0;g=d9((h[b>>2]|0)+(y<<3)|0,at,dt,A,ci,m,E)|0,y=y+1|0,!(g|0);)if((y|0)>=(h[I>>2]|0))break t;_t(m),_t(E),_t(Un);break e}while(!1);(dt|0)>0|(dt|0)==0&at>>>0>0&&hd(E|0,0,at<<3|0)|0,Ot=ci,We=h[Ot+4>>2]|0;t:do if((We|0)>0|(We|0)==0&(h[Ot>>2]|0)>>>0>0){Ee=m,ye=E,At=m,We=E,Ot=m,g=m,me=m,Fe=E,Ze=E,m=E;n:for(;;){for(ue=0,_e=0,re=0,be=0,y=0,b=0;;){E=gi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));if(A=Ee+(ue<<3)|0,I=h[A>>2]|0,A=h[A+4>>2]|0,h9(I,A,1,gi,0)|0){E=gi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));E=ra(7,4)|0,E|0&&(pu(I,A,1,gi,E,7,0,0)|0,_t(E))}for(oe=0;;){$=gi+(oe<<3)|0,W=h[$>>2]|0,$=h[$+4>>2]|0;i:do if((W|0)==0&($|0)==0)E=y,M=b;else{if(O=Yh(W|0,$|0,at|0,dt|0)|0,I=Q()|0,E=_+(O<<3)|0,A=E,M=h[A>>2]|0,A=h[A+4>>2]|0,!((M|0)==0&(A|0)==0)){G=0,q=0;do{if((G|0)>(dt|0)|(G|0)==(dt|0)&q>>>0>at>>>0)break n;if((M|0)==(W|0)&(A|0)==($|0)){E=y,M=b;break i}E=pt(O|0,I|0,1,0)|0,O=ud(E|0,Q()|0,at|0,dt|0)|0,I=Q()|0,q=pt(q|0,G|0,1,0)|0,G=Q()|0,E=_+(O<<3)|0,A=E,M=h[A>>2]|0,A=h[A+4>>2]|0}while(!((M|0)==0&(A|0)==0))}if((W|0)==0&($|0)==0){E=y,M=b;break}ig(W,$,lo)|0,F4(d,Un,lo)|0&&(q=pt(y|0,b|0,1,0)|0,b=Q()|0,G=E,h[G>>2]=W,h[G+4>>2]=$,y=ye+(y<<3)|0,h[y>>2]=W,h[y+4>>2]=$,y=q),E=y,M=b}while(!1);if(oe=oe+1|0,oe>>>0>=7)break;y=E,b=M}if(ue=pt(ue|0,_e|0,1,0)|0,_e=Q()|0,re=pt(re|0,be|0,1,0)|0,be=Q()|0,b=ci,y=h[b>>2]|0,b=h[b+4>>2]|0,(be|0)<(b|0)|(be|0)==(b|0)&re>>>0<y>>>0)y=E,b=M;else break}if((b|0)>0|(b|0)==0&y>>>0>0){y=0,b=0;do be=Ee+(y<<3)|0,h[be>>2]=0,h[be+4>>2]=0,y=pt(y|0,b|0,1,0)|0,b=Q()|0,be=ci,re=h[be+4>>2]|0;while((b|0)<(re|0)|((b|0)==(re|0)?y>>>0<(h[be>>2]|0)>>>0:0))}if(be=ci,h[be>>2]=E,h[be+4>>2]=M,(M|0)>0|(M|0)==0&E>>>0>0)oe=m,ue=Ze,_e=Ot,re=Fe,be=ye,m=me,Ze=g,Fe=At,me=oe,g=ue,Ot=We,We=_e,At=re,ye=Ee,Ee=be;else break t}_t(At),_t(We),_t(Un),g=1;break e}else g=E;while(!1);_t(Un),_t(m),_t(g),g=0}while(!1);return Un=g,Y=_i,Un|0}}return _t(Un),Un=g,Y=_i,Un|0}function _re(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0;if(E=Y,Y=Y+16|0,b=E,d=Lre(d,A,((A|0)<0)<<31>>31,b)|0,d|0)return b=d,Y=E,b|0;if(y=pse(b,m)|0,m=b+4|0,(h[b>>2]|0)>0){A=0;do{if(g=h[m>>2]|0,_=g+(A<<4)+4|0,_t(h[_>>2]|0),h[_>>2]=0,h[g+(A<<4)>>2]=0,_=g+(A<<4)+8|0,g=g+(A<<4)+12|0,(h[_>>2]|0)>0){d=0;do M=h[g>>2]|0,I=M+(d<<3)+4|0,_t(h[I>>2]|0),h[I>>2]=0,h[M+(d<<3)>>2]=0,d=d+1|0;while((d|0)<(h[_>>2]|0))}_t(h[g>>2]|0),h[g>>2]=0,h[_>>2]=0,A=A+1|0}while((A|0)<(h[b>>2]|0))}return _t(h[m>>2]|0),h[m>>2]=0,h[b>>2]=0,I=y,Y=E,I|0}function Gl(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;if(b=h[d>>2]|0,(b|0)<=0)return g=0,_=0,b=g<0,_=12.566370614359172-_,_=g+_,g=b?_:g,ne[A>>3]=g,0;if(y=h[d+4>>2]|0,d=(b|0)!=1&1,E=+ne[y>>3]*.5+.7853981633974483,g=+ne[y+(d<<4)>>3]*.5+.7853981633974483,m=+Ni(+E)*+Ni(+g),_=+ne[y+(d<<4)+8>>3]-+ne[y+8>>3],m=+ia(+(+Ni(+_)*m),+(+Qn(+E)*+Qn(+g)+ +Qn(+_)*m))*-2,_=m+0,m=_-m,(b|0)==1)return E=_,g=m,b=E<0,g=12.566370614359172-g,g=E+g,E=b?g:E,ne[A>>3]=E,0;for(d=1,g=_;O=d,d=d+1|0,G=(d|0)%(b|0)|0,I=+ne[y+(O<<4)>>3]*.5+.7853981633974483,M=+ne[y+(G<<4)>>3]*.5+.7853981633974483,_=+Ni(+I)*+Ni(+M),E=+ne[y+(G<<4)+8>>3]-+ne[y+(O<<4)+8>>3],m=+ia(+(+Ni(+E)*_),+(+Qn(+I)*+Qn(+M)+ +Qn(+E)*_))*-2-m,_=g+m,m=_-g-m,!((d|0)>=(b|0));)g=_;return G=_<0,I=12.566370614359172-m,I=_+I,I=G?I:_,ne[A>>3]=I,0}function xre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+192|0,_=b+176|0,g=b,y=b+168|0,d=N0(d,A,g)|0,d|0?(y=d,Y=b,y|0):(h[y>>2]=h[g>>2],h[y+4>>2]=g+8,h[_>>2]=h[y>>2],h[_+4>>2]=h[y+4>>2],Gl(_,m)|0,y=0,Y=b,y|0)}function yre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+192|0,_=b+176|0,g=b,y=b+168|0,d=N0(d,A,g)|0,d?(y=d,Y=b,y|0):(h[y>>2]=h[g>>2],h[y+4>>2]=g+8,h[_>>2]=h[y>>2],h[_+4>>2]=h[y+4>>2],Gl(_,m)|0,ne[m>>3]=+ne[m>>3]*4058973249931477e-8,y=0,Y=b,y|0)}function vre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+192|0,_=b+176|0,g=b,y=b+168|0,d=N0(d,A,g)|0,d?(y=d,Y=b,y|0):(h[y>>2]=h[g>>2],h[y+4>>2]=g+8,h[_>>2]=h[y>>2],h[_+4>>2]=h[y+4>>2],Gl(_,m)|0,ne[m>>3]=+ne[m>>3]*4058973249931477e-8*1e6,y=0,Y=b,y|0)}function ar(d){return d=d|0,d>>>0>121?(d=0,d|0):(d=h[7696+(d*28|0)+16>>2]|0,d|0)}function A4(d){return d=d|0,(d|0)==4|(d|0)==117|0}function p9(d){return d=d|0,h[11120+((h[d>>2]|0)*216|0)+((h[d+4>>2]|0)*72|0)+((h[d+8>>2]|0)*24|0)+(h[d+12>>2]<<3)>>2]|0}function bre(d){return d=d|0,h[11120+((h[d>>2]|0)*216|0)+((h[d+4>>2]|0)*72|0)+((h[d+8>>2]|0)*24|0)+(h[d+12>>2]<<3)+4>>2]|0}function wre(d,A){d=d|0,A=A|0,d=7696+(d*28|0)|0,h[A>>2]=h[d>>2],h[A+4>>2]=h[d+4>>2],h[A+8>>2]=h[d+8>>2],h[A+12>>2]=h[d+12>>2]}function Sre(d,A){d=d|0,A=A|0;var m=0,_=0;if(A>>>0>20)return A=-1,A|0;do if((h[11120+(A*216|0)>>2]|0)!=(d|0))if((h[11120+(A*216|0)+8>>2]|0)!=(d|0))if((h[11120+(A*216|0)+16>>2]|0)!=(d|0))if((h[11120+(A*216|0)+24>>2]|0)!=(d|0))if((h[11120+(A*216|0)+32>>2]|0)!=(d|0))if((h[11120+(A*216|0)+40>>2]|0)!=(d|0))if((h[11120+(A*216|0)+48>>2]|0)!=(d|0))if((h[11120+(A*216|0)+56>>2]|0)!=(d|0))if((h[11120+(A*216|0)+64>>2]|0)!=(d|0))if((h[11120+(A*216|0)+72>>2]|0)!=(d|0))if((h[11120+(A*216|0)+80>>2]|0)!=(d|0))if((h[11120+(A*216|0)+88>>2]|0)!=(d|0))if((h[11120+(A*216|0)+96>>2]|0)!=(d|0))if((h[11120+(A*216|0)+104>>2]|0)!=(d|0))if((h[11120+(A*216|0)+112>>2]|0)!=(d|0))if((h[11120+(A*216|0)+120>>2]|0)!=(d|0))if((h[11120+(A*216|0)+128>>2]|0)!=(d|0))if((h[11120+(A*216|0)+136>>2]|0)==(d|0))d=2,m=1,_=2;else{if((h[11120+(A*216|0)+144>>2]|0)==(d|0)){d=0,m=2,_=0;break}if((h[11120+(A*216|0)+152>>2]|0)==(d|0)){d=0,m=2,_=1;break}if((h[11120+(A*216|0)+160>>2]|0)==(d|0)){d=0,m=2,_=2;break}if((h[11120+(A*216|0)+168>>2]|0)==(d|0)){d=1,m=2,_=0;break}if((h[11120+(A*216|0)+176>>2]|0)==(d|0)){d=1,m=2,_=1;break}if((h[11120+(A*216|0)+184>>2]|0)==(d|0)){d=1,m=2,_=2;break}if((h[11120+(A*216|0)+192>>2]|0)==(d|0)){d=2,m=2,_=0;break}if((h[11120+(A*216|0)+200>>2]|0)==(d|0)){d=2,m=2,_=1;break}if((h[11120+(A*216|0)+208>>2]|0)==(d|0)){d=2,m=2,_=2;break}else d=-1;return d|0}else d=2,m=1,_=1;else d=2,m=1,_=0;else d=1,m=1,_=2;else d=1,m=1,_=1;else d=1,m=1,_=0;else d=0,m=1,_=2;else d=0,m=1,_=1;else d=0,m=1,_=0;else d=2,m=0,_=2;else d=2,m=0,_=1;else d=2,m=0,_=0;else d=1,m=0,_=2;else d=1,m=0,_=1;else d=1,m=0,_=0;else d=0,m=0,_=2;else d=0,m=0,_=1;else d=0,m=0,_=0;while(!1);return A=h[11120+(A*216|0)+(m*72|0)+(d*24|0)+(_<<3)+4>>2]|0,A|0}function A9(d,A){return d=d|0,A=A|0,(h[7696+(d*28|0)+20>>2]|0)==(A|0)?(A=1,A|0):(A=(h[7696+(d*28|0)+24>>2]|0)==(A|0),A|0)}function m4(d,A){return d=d|0,A=A|0,h[848+(d*28|0)+(A<<2)>>2]|0}function g4(d,A){return d=d|0,A=A|0,(h[848+(d*28|0)>>2]|0)==(A|0)?(A=0,A|0):(h[848+(d*28|0)+4>>2]|0)==(A|0)?(A=1,A|0):(h[848+(d*28|0)+8>>2]|0)==(A|0)?(A=2,A|0):(h[848+(d*28|0)+12>>2]|0)==(A|0)?(A=3,A|0):(h[848+(d*28|0)+16>>2]|0)==(A|0)?(A=4,A|0):(h[848+(d*28|0)+20>>2]|0)==(A|0)?(A=5,A|0):((h[848+(d*28|0)+24>>2]|0)==(A|0)?6:7)|0}function Tre(){return 122}function Ere(d){d=d|0;var A=0,m=0,_=0;A=0;do ht(A|0,0,45)|0,_=Q()|0|134225919,m=d+(A<<3)|0,h[m>>2]=-1,h[m+4>>2]=_,A=A+1|0;while((A|0)!=122);return 0}function Mre(d){d=d|0;var A=0,m=0,_=0;return _=+ne[d+16>>3],m=+ne[d+24>>3],A=_-m,+(_<m?A+6.283185307179586:A)}function Cre(d){return d=d|0,+ne[d+16>>3]<+ne[d+24>>3]|0}function Rre(d){return d=d|0,+(+ne[d>>3]-+ne[d+8>>3])}function m9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;return m=+ne[A>>3],!(m>=+ne[d+8>>3])||!(m<=+ne[d>>3])?(A=0,A|0):(_=+ne[d+16>>3],m=+ne[d+24>>3],g=+ne[A+8>>3],A=g>=m,d=g<=_&1,_<m?A&&(d=1):A||(d=0),A=(d|0)!=0,A|0)}function _4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;return+ne[d>>3]<+ne[A+8>>3]||+ne[d+8>>3]>+ne[A>>3]?(_=0,_|0):(y=+ne[d+16>>3],m=d+24|0,O=+ne[m>>3],b=y<O,_=A+16|0,I=+ne[_>>3],g=A+24|0,M=+ne[g>>3],E=I<M,A=O-I<M-y,d=b?E|A?1:2:0,A=E?b?1:A?2:1:0,y=+ll(y,d),y<+ll(+ne[g>>3],A)||(O=+ll(+ne[m>>3],d),O>+ll(+ne[_>>3],A))?(E=0,E|0):(E=1,E|0))}function Pre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0;y=+ne[d+16>>3],M=+ne[d+24>>3],d=y<M,E=+ne[A+16>>3],b=+ne[A+24>>3],g=E<b,A=M-E<b-y,h[m>>2]=d?g|A?1:2:0,h[_>>2]=g?d?1:A?2:1:0}function g9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;return+ne[d>>3]<+ne[A>>3]||+ne[d+8>>3]>+ne[A+8>>3]?(_=0,_|0):(_=d+16|0,M=+ne[_>>3],y=+ne[d+24>>3],b=M<y,m=A+16|0,O=+ne[m>>3],g=A+24|0,I=+ne[g>>3],E=O<I,A=y-O<I-M,d=b?E|A?1:2:0,A=E?b?1:A?2:1:0,y=+ll(y,d),y<=+ll(+ne[g>>3],A)?(O=+ll(+ne[_>>3],d),E=O>=+ll(+ne[m>>3],A),E|0):(E=0,E|0))}function _9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0;g=Y,Y=Y+176|0,_=g,h[_>>2]=4,E=+ne[A>>3],ne[_+8>>3]=E,y=+ne[A+16>>3],ne[_+16>>3]=y,ne[_+24>>3]=E,E=+ne[A+24>>3],ne[_+32>>3]=E,b=+ne[A+8>>3],ne[_+40>>3]=b,ne[_+48>>3]=E,ne[_+56>>3]=b,ne[_+64>>3]=y,A=_+72|0,m=A+96|0;do h[A>>2]=0,A=A+4|0;while((A|0)<(m|0));bc(d|0,_|0,168)|0,Y=g}function x9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0;$=Y,Y=Y+288|0,O=$+264|0,G=$+96|0,I=$,E=I,M=E+96|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));return A=R4(A,I)|0,A|0?(W=A,Y=$,W|0):(M=I,I=h[M>>2]|0,M=h[M+4>>2]|0,ig(I,M,O)|0,N0(I,M,G)|0,b=+cx(O,G+8|0),ne[O>>3]=+ne[d>>3],M=O+8|0,ne[M>>3]=+ne[d+16>>3],ne[G>>3]=+ne[d+8>>3],I=G+8|0,ne[I>>3]=+ne[d+24>>3],g=+cx(O,G),ue=+ne[M>>3]-+ne[I>>3],y=+Ns(+ue),oe=+ne[O>>3]-+ne[G>>3],_=+Ns(+oe),!(ue==0|oe==0)&&(ue=+j9(+y,+_),ue=+eg(+(g*g/+iw(+(ue/+iw(+y,+_)),3)/(b*(b*2.59807621135)*.8))),ne[$i>>3]=ue,q=~~ue>>>0,W=+Ns(ue)>=1?ue>0?~~+p4(+js(ue/4294967296),4294967295)>>>0:~~+eg((ue-+(~~ue>>>0))/4294967296)>>>0:0,(h[$i+4>>2]&2146435072|0)!=2146435072)?(G=(q|0)==0&(W|0)==0,A=m,h[A>>2]=G?1:q,h[A+4>>2]=G?0:W,A=0):A=1,W=A,Y=$,W|0)}function Ire(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0;I=Y,Y=Y+288|0,b=I+264|0,E=I+96|0,M=I,g=M,y=g+96|0;do h[g>>2]=0,g=g+4|0;while((g|0)<(y|0));return m=R4(m,M)|0,m|0?(_=m,Y=I,_|0):(m=M,g=h[m>>2]|0,m=h[m+4>>2]|0,ig(g,m,b)|0,N0(g,m,E)|0,O=+cx(b,E+8|0),O=+eg(+(+cx(d,A)/(O*2))),ne[$i>>3]=O,m=~~O>>>0,g=+Ns(O)>=1?O>0?~~+p4(+js(O/4294967296),4294967295)>>>0:~~+eg((O-+(~~O>>>0))/4294967296)>>>0:0,(h[$i+4>>2]&2146435072|0)==2146435072?(_=1,Y=I,_|0):(M=(m|0)==0&(g|0)==0,h[_>>2]=M?1:m,h[_+4>>2]=M?0:g,_=0,Y=I,_|0))}function Nre(d,A){d=d|0,A=+A;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;y=d+16|0,b=+ne[y>>3],m=d+24|0,g=+ne[m>>3],_=b-g,_=b<g?_+6.283185307179586:_,I=+ne[d>>3],E=d+8|0,M=+ne[E>>3],O=I-M,_=(_*A-_)*.5,A=(O*A-O)*.5,I=I+A,ne[d>>3]=I>1.5707963267948966?1.5707963267948966:I,A=M-A,ne[E>>3]=A<-1.5707963267948966?-1.5707963267948966:A,A=b+_,A=A>3.141592653589793?A+-6.283185307179586:A,ne[y>>3]=A<-3.141592653589793?A+6.283185307179586:A,A=g-_,A=A>3.141592653589793?A+-6.283185307179586:A,ne[m>>3]=A<-3.141592653589793?A+6.283185307179586:A}function Lre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0;if(dt=Y,Y=Y+224|0,At=dt,Fe=dt+48|0,M=(m|0)>0|(m|0)==0&A>>>0>0,M&(m>>>0>0|(m|0)==0&A>>>0>17895697))return at=14,Y=dt,at|0;if((m|0)<0)return at=2,Y=dt,at|0;if((A|0)==0&(m|0)==0)return h[_>>2]=0,h[_+4>>2]=0,at=0,Y=dt,at|0;for(g=d,g=b4(h[g>>2]|0,h[g+4>>2]|0)|0,b=0,E=0;;){if(y=d+(b<<3)|0,at=y,!(Yb(h[at>>2]|0,h[at+4>>2]|0)|0)){g=5,We=159;break}if(at=y,at=(b4(h[at>>2]|0,h[at+4>>2]|0)|0)==(g|0),b=pt(b|0,E|0,1,0)|0,E=Q()|0,!at){g=12,We=159;break}if(!((E|0)<(m|0)|(E|0)==(m|0)&b>>>0<A>>>0)){We=8;break}}if((We|0)==8){do if((m|0)>0|(m|0)==0&A>>>0>1){if(g=A<<3,b=lr(g)|0,!b)return at=13,Y=dt,at|0;for(bc(b|0,d|0,g|0)|0,Jb(b,A,8,1),g=1,y=0;Ot=b+(g<<3)|0,at=b+(g+-1<<3)|0,at=(h[Ot>>2]|0)==(h[at>>2]|0)?(h[Ot+4>>2]|0)==(h[at+4>>2]|0):0,g=pt(g|0,y|0,1,0)|0,y=Q()|0,!at;)if(!((y|0)<(m|0)|(y|0)==(m|0)&g>>>0<A>>>0)){We=14;break}if((We|0)==14){_t(b);break}return _t(b),at=10,Y=dt,at|0}while(!1);if(g=cr(A|0,m|0,6,0)|0,y=Q()|0,M){b=0,E=0;do at=d+(E<<3)|0,at=((ki(h[at>>2]|0,h[at+4>>2]|0)|0)!=0)<<31>>31,g=pt(g|0,y|0,at|0,((at|0)<0)<<31>>31|0)|0,y=Q()|0,E=pt(E|0,b|0,1,0)|0,b=Q()|0;while((b|0)<(m|0)|(b|0)==(m|0)&E>>>0<A>>>0);me=g,be=y}else me=g,be=y;if(_e=cr(me|0,be|0,10,0)|0,re=Q()|0,Ot=lr(me<<5)|0,!Ot)return at=13,Y=dt,at|0;if(at=ra(_e,4)|0,!at)return _t(Ot),at=13,Y=dt,at|0;e:do if(M){for(ye=d,x4(h[ye>>2]|0,h[ye+4>>2]|0,At)|0,W=Ot,$=0,oe=0,g=0,ue=0;;){M=At,M=(h[M>>2]|0)==0&(h[M+4>>2]|0)==0,y=M?26990:26995,b=M?5:6,E=0,M=At+((M&1)<<3)|0,I=pt(b|0,E|0,-1,-1)|0,O=Q()|0,G=0,q=0;do Ee=M+(G<<3)|0,Ze=h[Ee+4>>2]|0,ye=W+(G<<5)|0,h[ye>>2]=h[Ee>>2],h[ye+4>>2]=Ze,He[W+(G<<5)+9>>0]=0,He[W+(G<<5)+8>>0]=0,h[W+(G<<5)+20>>2]=W,ye=W+(G<<5)+24|0,h[ye>>2]=1,h[ye+4>>2]=0,ye=He[y+G>>0]|0,Ze=pt(I|0,O|0,G|0,q|0)|0,Ze=Yh(Ze|0,Q()|0,b|0,E|0)|0,Q()|0,Ze=He[y+Ze>>0]|0,G=pt(G|0,q|0,1,0)|0,q=Q()|0,Ee=He[y+((G|0)==(b|0)&(q|0)==(E|0)?0:G)>>0]|0,ye=ye&255,h[W+(ye<<5)+16>>2]=W+((Ze&255)<<5),h[W+(ye<<5)+12>>2]=W+((Ee&255)<<5);while(q>>>0<E>>>0|(q|0)==(E|0)&G>>>0<b>>>0);if($=pt($|0,oe|0,1,0)|0,oe=Q()|0,g=pt(b|0,E|0,g|0,ue|0)|0,ue=Q()|0,!((oe|0)<(m|0)|(oe|0)==(m|0)&$>>>0<A>>>0))break e;ye=d+($<<3)|0,x4(h[ye>>2]|0,h[ye+4>>2]|0,At)|0||(W=Ot+(g<<5)|0)}li(27634,26956,108,26975)}while(!1);if((be|0)>0|(be|0)==0&me>>>0>0){E=0,M=0;do{if(y=Ot+(E<<5)|0,b=h[y>>2]|0,y=h[y+4>>2]|0,g=et(b|0,y|0,30)|0,y=cr(g^b|0,(Q()|0)^y|0,484763065,-1084733587)|0,b=Q()|0,g=et(y|0,b|0,27)|0,b=cr(g^y|0,(Q()|0)^b|0,321982955,-1798288965)|0,y=Q()|0,g=et(b|0,y|0,31)|0,y=Yh(g^b|0,(Q()|0)^y|0,_e|0,re|0)|0,b=Q()|0,g=at+(y<<2)|0,h[g>>2]|0)do g=pt(y|0,b|0,1,0)|0,y=ud(g|0,Q()|0,_e|0,re|0)|0,b=Q()|0,g=at+(y<<2)|0;while((h[g>>2]|0)!=0);h[g>>2]=Ot+(E<<5),E=pt(E|0,M|0,1,0)|0,M=Q()|0}while((M|0)<(be|0)|(M|0)==(be|0)&E>>>0<me>>>0);G=0,q=0;do{if(E=Ot+(G<<5)|0,M=Ot+(G<<5)+9|0,!(He[M>>0]|0)){if(ye=E,v9(h[ye>>2]|0,h[ye+4>>2]|0,At)|0){We=39;break}O=At,I=h[O>>2]|0,O=h[O+4>>2]|0,y=et(I|0,O|0,30)|0,y=cr(y^I|0,(Q()|0)^O|0,484763065,-1084733587)|0,b=Q()|0,g=et(y|0,b|0,27)|0,b=cr(g^y|0,(Q()|0)^b|0,321982955,-1798288965)|0,y=Q()|0,g=et(b|0,y|0,31)|0,y=Yh(g^b|0,(Q()|0)^y|0,_e|0,re|0)|0,b=Q()|0,g=h[at+(y<<2)>>2]|0;e:do if(g|0){for(;ye=g,!((h[ye>>2]|0)==(I|0)&&(h[ye+4>>2]|0)==(O|0));)if(g=pt(y|0,b|0,1,0)|0,y=ud(g|0,Q()|0,_e|0,re|0)|0,b=Q()|0,g=h[at+(y<<2)>>2]|0,!g)break e;He[M>>0]=1,He[g+9>>0]=1,y=g+16|0,ye=Ot+(G<<5)+12|0,h[(h[ye>>2]|0)+16>>2]=h[y>>2],m=g+12|0,Ee=h[Ot+(G<<5)+16>>2]|0,h[Ee+12>>2]=h[m>>2],h[(h[m>>2]|0)+16>>2]=Ee,h[(h[y>>2]|0)+12>>2]=h[ye>>2],y=$b(E)|0,ye=$b(g)|0,g=y+24|0,m=h[g+4>>2]|0,Ee=ye+24|0,Ze=h[Ee+4>>2]|0,Ee=(m|0)<(Ze|0)|((m|0)==(Ze|0)?(h[g>>2]|0)>>>0<(h[Ee>>2]|0)>>>0:0),g=Ee?y:ye,y=Ee?ye:y,(y|0)!=(g|0)&&(Ze=g+24|0,ye=y+24|0,Ee=ye,Ze=pt(h[Ee>>2]|0,h[Ee+4>>2]|0,h[Ze>>2]|0,h[Ze+4>>2]|0)|0,Ee=Q()|0,h[ye>>2]=Ze,h[ye+4>>2]=Ee,h[g+20>>2]=y)}while(!1)}G=pt(G|0,q|0,1,0)|0,q=Q()|0}while((q|0)<(be|0)|(q|0)==(be|0)&G>>>0<me>>>0);(We|0)==39&&li(27634,26956,258,27001),g=0,y=0;do He[Ot+(g<<5)+8>>0]=0,g=pt(g|0,y|0,1,0)|0,y=Q()|0;while((y|0)<(be|0)|(y|0)==(be|0)&g>>>0<me>>>0);for(I=0,b=0,M=0,O=0;;){if(g=Ot+(I<<5)|0,(He[Ot+(I<<5)+8>>0]|0)==0&&(He[Ot+(I<<5)+9>>0]|0)==0){E=g,y=h[E>>2]|0,E=h[E+4>>2]|0;do He[g+8>>0]=1,g=h[g+12>>2]|0,ye=g;while(!((h[ye>>2]|0)==(y|0)&&(h[ye+4>>2]|0)==(E|0)));b=pt(b|0,M|0,1,0)|0,E=Q()|0}else E=M;if(I=pt(I|0,O|0,1,0)|0,O=Q()|0,(O|0)<(be|0)|(O|0)==(be|0)&I>>>0<me>>>0)M=E;else break}g=0,y=0;do He[Ot+(g<<5)+8>>0]=0,g=pt(g|0,y|0,1,0)|0,y=Q()|0;while((y|0)<(be|0)|(y|0)==(be|0)&g>>>0<me>>>0);Ee=b,Ze=E,g=1}else Ee=0,Ze=0,g=0;ye=lr(Ee*24|0)|0;e:do if(ye|0){t:do if(g){d=0,_e=0,m=0,A=0;n:for(;;){if(g=Ot+(d<<5)|0,(He[Ot+(d<<5)+8>>0]|0)==0&&(He[Ot+(d<<5)+9>>0]|0)==0){ue=g,oe=h[ue>>2]|0,ue=h[ue+4>>2]|0,y=0,b=0;do y=pt(y|0,b|0,2,0)|0,b=Q()|0,g=h[g+12>>2]|0,re=g;while(!((h[re>>2]|0)==(oe|0)&&(h[re+4>>2]|0)==(ue|0)));if($=lr(y<<4)|0,!$)break;y=oe,b=ue,W=0,q=0,E=0,M=0;do{if(sx(y,b,Fe)|0){We=69;break n}if(re=h[Fe>>2]|0,O=re+-1|0,G=((O|0)<0)<<31>>31,(re|0)>1){b=E,I=0,y=M,E=0;do re=$+(b<<4)|0,M=Fe+8+(I<<4)|0,h[re>>2]=h[M>>2],h[re+4>>2]=h[M+4>>2],h[re+8>>2]=h[M+8>>2],h[re+12>>2]=h[M+12>>2],b=pt(b|0,y|0,1,0)|0,y=Q()|0,I=pt(I|0,E|0,1,0)|0,E=Q()|0;while((E|0)<(G|0)|(E|0)==(G|0)&I>>>0<O>>>0);E=b,M=y}W=pt(W|0,q|0,O|0,G|0)|0,q=Q()|0,He[g+8>>0]=1,g=h[g+12>>2]|0,b=g,y=h[b>>2]|0,b=h[b+4>>2]|0}while(!((y|0)==(oe|0)&(b|0)==(ue|0)));if(y=Dse($,W<<4)|0,!y){We=75;break}ue=$b(g)|0,re=h[ue+4>>2]|0,g=ye+(m*24|0)|0,h[g>>2]=h[ue>>2],h[g+4>>2]=re,g=ye+(m*24|0)+16|0,h[g>>2]=W,h[ye+(m*24|0)+20>>2]=y,h[At>>2]=h[g>>2],h[At+4>>2]=h[g+4>>2],Gl(At,ye+(m*24|0)+8|0)|0,y=pt(m|0,_e|0,1,0)|0,g=Q()|0}else y=m,g=_e;if(d=pt(d|0,A|0,1,0)|0,A=Q()|0,(A|0)<(be|0)|(A|0)==(be|0)&d>>>0<me>>>0)_e=g,m=y;else break t}if((We|0)==69?li(27634,26956,351,27016):(We|0)==75&&_t($),(_e|0)>0|(_e|0)==0&m>>>0>0)for(E=0,M=0,g=m,b=_e;y=h[ye+(E*24|0)+20>>2]|0,y?(_t(y),y=_e,g=m):y=b,E=pt(E|0,M|0,1,0)|0,M=Q()|0,(M|0)<(y|0)|(M|0)==(y|0)&E>>>0<g>>>0;)b=y;_t(ye);break e}while(!1);Jb(ye,Ee,24,2);t:do if((Ee|0)==0&(Ze|0)==0){if(re=lr(192)|0,re|0){if(h[re+16>>2]=0,h[re+20>>2]=0,q=re+8|0,h[q>>2]=3,g=lr(48)|0,W=re+12|0,h[W>>2]=g,g|0){h[g>>2]=h[3860],h[g+4>>2]=h[3861],h[g+8>>2]=h[3862],h[g+12>>2]=h[3863],G=g+16|0,h[G>>2]=h[3864],h[G+4>>2]=h[3865],h[G+8>>2]=h[3866],h[G+12>>2]=h[3867],G=g+32|0,h[G>>2]=h[3868],h[G+4>>2]=h[3869],h[G+8>>2]=h[3870],h[G+12>>2]=h[3871],h[At>>2]=h[q>>2],h[At+4>>2]=h[q+4>>2],Gl(At,re)|0,h[re+40>>2]=0,h[re+44>>2]=0,G=re+32|0,h[G>>2]=3,g=lr(48)|0,$=re+36|0,h[$>>2]=g;do if(!g)E=0,M=1;else{if(h[g>>2]=h[3872],h[g+4>>2]=h[3873],h[g+8>>2]=h[3874],h[g+12>>2]=h[3875],O=g+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=g+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[At>>2]=h[G>>2],h[At+4>>2]=h[G+4>>2],Gl(At,re+24|0)|0,h[re+64>>2]=0,h[re+68>>2]=0,O=re+56|0,h[O>>2]=3,g=lr(48)|0,oe=re+60|0,h[oe>>2]=g,!g){E=0,M=2;break}if(h[g>>2]=h[3884],h[g+4>>2]=h[3885],h[g+8>>2]=h[3886],h[g+12>>2]=h[3887],I=g+16|0,h[I>>2]=h[3888],h[I+4>>2]=h[3889],h[I+8>>2]=h[3890],h[I+12>>2]=h[3891],I=g+32|0,h[I>>2]=h[3892],h[I+4>>2]=h[3893],h[I+8>>2]=h[3894],h[I+12>>2]=h[3895],h[At>>2]=h[O>>2],h[At+4>>2]=h[O+4>>2],Gl(At,re+48|0)|0,h[re+88>>2]=0,h[re+92>>2]=0,I=re+80|0,h[I>>2]=3,g=lr(48)|0,ue=re+84|0,h[ue>>2]=g,!g){E=0,M=3;break}if(h[g>>2]=h[3896],h[g+4>>2]=h[3897],h[g+8>>2]=h[3898],h[g+12>>2]=h[3899],M=g+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=g+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[At>>2]=h[I>>2],h[At+4>>2]=h[I+4>>2],Gl(At,re+72|0)|0,h[re+112>>2]=0,h[re+116>>2]=0,M=re+104|0,h[M>>2]=3,g=lr(48)|0,d=re+108|0,h[d>>2]=g,!g){E=0,M=4;break}if(h[g>>2]=h[3908],h[g+4>>2]=h[3909],h[g+8>>2]=h[3910],h[g+12>>2]=h[3911],E=g+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=g+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[At>>2]=h[M>>2],h[At+4>>2]=h[M+4>>2],Gl(At,re+96|0)|0,h[re+136>>2]=0,h[re+140>>2]=0,E=re+128|0,h[E>>2]=3,g=lr(48)|0,A=re+132|0,h[A>>2]=g,!g){E=0,M=5;break}if(h[g>>2]=h[3920],h[g+4>>2]=h[3921],h[g+8>>2]=h[3922],h[g+12>>2]=h[3923],b=g+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=g+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[At>>2]=h[E>>2],h[At+4>>2]=h[E+4>>2],Gl(At,re+120|0)|0,h[re+160>>2]=0,h[re+164>>2]=0,b=re+152|0,h[b>>2]=3,g=lr(48)|0,m=re+156|0,h[m>>2]=g,!g){E=0,M=6;break}if(h[g>>2]=h[3932],h[g+4>>2]=h[3933],h[g+8>>2]=h[3934],h[g+12>>2]=h[3935],y=g+16|0,h[y>>2]=h[3936],h[y+4>>2]=h[3937],h[y+8>>2]=h[3938],h[y+12>>2]=h[3939],y=g+32|0,h[y>>2]=h[3940],h[y+4>>2]=h[3941],h[y+8>>2]=h[3942],h[y+12>>2]=h[3943],h[At>>2]=h[b>>2],h[At+4>>2]=h[b+4>>2],Gl(At,re+144|0)|0,h[re+184>>2]=0,h[re+188>>2]=0,y=re+176|0,h[y>>2]=3,g=lr(48)|0,_e=re+180|0,h[_e>>2]=g,!g){E=0,M=7;break}if(h[g>>2]=h[3944],h[g+4>>2]=h[3945],h[g+8>>2]=h[3946],h[g+12>>2]=h[3947],Fe=g+16|0,h[Fe>>2]=h[3948],h[Fe+4>>2]=h[3949],h[Fe+8>>2]=h[3950],h[Fe+12>>2]=h[3951],g=g+32|0,h[g>>2]=h[3952],h[g+4>>2]=h[3953],h[g+8>>2]=h[3954],h[g+12>>2]=h[3955],h[At>>2]=h[y>>2],h[At+4>>2]=h[y+4>>2],Gl(At,re+168|0)|0,Jb(re,8,24,3),g=lr(128)|0,h[_+4>>2]=g,g|0){h[_>>2]=8,h[g>>2]=h[q>>2],h[g+4>>2]=h[q+4>>2],h[g+8>>2]=h[q+8>>2],h[g+12>>2]=h[q+12>>2],We=g+16|0,h[We>>2]=h[G>>2],h[We+4>>2]=h[G+4>>2],h[We+8>>2]=h[G+8>>2],h[We+12>>2]=h[G+12>>2],We=g+32|0,h[We>>2]=h[O>>2],h[We+4>>2]=h[O+4>>2],h[We+8>>2]=h[O+8>>2],h[We+12>>2]=h[O+12>>2],We=g+48|0,h[We>>2]=h[I>>2],h[We+4>>2]=h[I+4>>2],h[We+8>>2]=h[I+8>>2],h[We+12>>2]=h[I+12>>2],We=g+64|0,h[We>>2]=h[M>>2],h[We+4>>2]=h[M+4>>2],h[We+8>>2]=h[M+8>>2],h[We+12>>2]=h[M+12>>2],We=g+80|0,h[We>>2]=h[E>>2],h[We+4>>2]=h[E+4>>2],h[We+8>>2]=h[E+8>>2],h[We+12>>2]=h[E+12>>2],We=g+96|0,h[We>>2]=h[b>>2],h[We+4>>2]=h[b+4>>2],h[We+8>>2]=h[b+8>>2],h[We+12>>2]=h[b+12>>2],We=g+112|0,h[We>>2]=h[y>>2],h[We+4>>2]=h[y+4>>2],h[We+8>>2]=h[y+8>>2],h[We+12>>2]=h[y+12>>2],_t(re),We=158;break t}g=h[W>>2]|0,g|0&&_t(g),g=h[$>>2]|0,g|0&&_t(g),g=h[oe>>2]|0,g|0&&_t(g),g=h[ue>>2]|0,g|0&&_t(g),g=h[d>>2]|0,g|0&&_t(g),g=h[A>>2]|0,g|0&&_t(g),g=h[m>>2]|0,g|0&&_t(g),g=h[_e>>2]|0,g|0&&_t(g),_t(re);break t}while(!1);g=0,b=0;do y=h[re+(g*24|0)+12>>2]|0,y|0&&_t(y),g=pt(g|0,b|0,1,0)|0,b=Q()|0;while(b>>>0<E>>>0|(b|0)==(E|0)&g>>>0<M>>>0)}_t(re),We=152}}else{if((Ze|0)>0|(Ze|0)==0&Ee>>>0>0){b=0,E=0,M=0,y=0,g=0,I=0;do Fe=ye+(b*24|0)|0,At=E,E=h[Fe>>2]|0,We=M,M=h[Fe+4>>2]|0,y=pt(y|0,g|0,((E|0)!=(At|0)|(M|0)!=(We|0))&1|0,0)|0,g=Q()|0,b=pt(b|0,I|0,1,0)|0,I=Q()|0;while((I|0)<(Ze|0)|(I|0)==(Ze|0)&b>>>0<Ee>>>0);ue=y,oe=g}else ue=0,oe=0;if(d=lr(ue*24|0)|0,d){n:do if((Ze|0)>=0){for(q=0,W=0,y=0,b=0,$=0,E=0;;){if(!((q|0)==(Ee|0)&(W|0)==(Ze|0))&&(At=ye+(y*24|0)|0,We=ye+(q*24|0)|0,(h[At>>2]|0)==(h[We>>2]|0)?(h[At+4>>2]|0)==(h[We+4>>2]|0):0))g=$;else{if(O=ye+(y*24|0)|0,We=Ds(q|0,W|0,y|0,b|0)|0,At=Q()|0,G=pt(We|0,At|0,-1,-1)|0,b=Q()|0,(At|0)>0|(At|0)==0&We>>>0>1){if(g=lr(G<<3)|0,!g)break;M=0,I=0;do We=M,M=pt(M|0,I|0,1,0)|0,I=Q()|0,Fe=O+(M*24|0)+16|0,At=h[Fe+4>>2]|0,We=g+(We<<3)|0,h[We>>2]=h[Fe>>2],h[We+4>>2]=At;while((I|0)<(b|0)|(I|0)==(b|0)&M>>>0<G>>>0)}else g=0;At=ye+(y*24|0)+16|0,We=h[At+4>>2]|0,b=d+(E*24|0)+8|0,h[b>>2]=h[At>>2],h[b+4>>2]=We,h[d+(E*24|0)+16>>2]=G,h[d+(E*24|0)+20>>2]=g,ne[d+(E*24|0)>>3]=+ne[ye+(y*24|0)+8>>3],E=pt(E|0,$|0,1,0)|0,y=q,b=W,g=Q()|0}if(We=q,q=pt(q|0,W|0,1,0)|0,At=W,W=Q()|0,(At|0)<(Ze|0)|(At|0)==(Ze|0)&We>>>0<Ee>>>0)$=g;else break n}if(($|0)>0|($|0)==0&E>>>0>0){g=0,b=0;do y=h[d+(g*24|0)+20>>2]|0,y|0&&_t(y),g=pt(g|0,b|0,1,0)|0,b=Q()|0;while((b|0)<($|0)|(b|0)==($|0)&g>>>0<E>>>0)}_t(d),We=152;break t}while(!1);if(Jb(d,ue,24,3),g=lr(ue<<4)|0,b=_+4|0,h[b>>2]=g,g){h[_>>2]=ue;do if((oe|0)>0|(oe|0)==0&ue>>>0>0){if(_=d+8|0,h[g>>2]=h[_>>2],h[g+4>>2]=h[_+4>>2],h[g+8>>2]=h[_+8>>2],h[g+12>>2]=h[_+12>>2],(ue|0)==1&(oe|0)==0||(_=g+16|0,We=d+32|0,h[_>>2]=h[We>>2],h[_+4>>2]=h[We+4>>2],h[_+8>>2]=h[We+8>>2],h[_+12>>2]=h[We+12>>2],!((oe|0)>0|(oe|0)==0&ue>>>0>2)))break;g=2,y=0;do _=(h[b>>2]|0)+(g<<4)|0,We=d+(g*24|0)+8|0,h[_>>2]=h[We>>2],h[_+4>>2]=h[We+4>>2],h[_+8>>2]=h[We+8>>2],h[_+12>>2]=h[We+12>>2],g=pt(g|0,y|0,1,0)|0,y=Q()|0;while((y|0)<(oe|0)|(y|0)==(oe|0)&g>>>0<ue>>>0)}while(!1);_t(d),We=158;break}else{if((oe|0)>0|(oe|0)==0&ue>>>0>0){g=0,b=0;do y=h[d+(g*24|0)+20>>2]|0,y|0&&_t(y),g=pt(g|0,b|0,1,0)|0,b=Q()|0;while((b|0)<(oe|0)|(b|0)==(oe|0)&g>>>0<ue>>>0)}_t(d),We=152;break}}else We=152}while(!1);if((We|0)==158)return _t(Ot),_t(at),_t(ye),at=0,Y=dt,at|0;if((We|0)==152&&(Ze|0)>0|(Ze|0)==0&Ee>>>0>0)for(E=0,M=0,g=Ee,b=Ze;y=h[ye+(E*24|0)+20>>2]|0,y?(_t(y),y=Ze,g=Ee):y=b,E=pt(E|0,M|0,1,0)|0,M=Q()|0,(M|0)<(y|0)|(M|0)==(y|0)&E>>>0<g>>>0;)b=y;return _t(ye),_t(Ot),_t(at),at=13,Y=dt,at|0}while(!1);return _t(Ot),_t(at),at=13,Y=dt,at|0}else if((We|0)==159)return Y=dt,g|0;return 0}function Dre(d,A){d=d|0,A=A|0;var m=0,_=0;return _=d,d=h[_>>2]|0,_=h[_+4>>2]|0,m=A,A=h[m>>2]|0,m=h[m+4>>2]|0,(_>>>0<m>>>0|(_|0)==(m|0)&d>>>0<A>>>0?-1:(_>>>0>m>>>0|(_|0)==(m|0)&d>>>0>A>>>0)&1)|0}function $b(d){d=d|0;var A=0,m=0;return A=d+20|0,m=h[A>>2]|0,(m|0)==(d|0)?d|0:(m=$b(m)|0,h[A>>2]=m,m|0)}function Fre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0;return E=d,b=h[E>>2]|0,E=h[E+4>>2]|0,y=A,g=h[y>>2]|0,y=h[y+4>>2]|0,E>>>0<y>>>0|(E|0)==(y|0)&b>>>0<g>>>0?(A=-1,A|0):E>>>0>y>>>0|(E|0)==(y|0)&b>>>0>g>>>0?(A=1,A|0):(_=+ne[d+8>>3],m=+ne[A+8>>3],_<m?(A=-1,A|0):(A=_>m&1,A|0))}function Ore(d,A){d=d|0,A=A|0;var m=0,_=0;return _=+ne[d>>3],m=+ne[A>>3],(_>m?-1:_<m&1)|0}function Bre(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0;if(G=Y,Y=Y+64|0,O=G,E=G+56|0,!(!0&(A&2013265920|0)==134217728&(!0&(_&2013265920|0)==134217728)))return g=5,Y=G,g|0;if((d|0)==(m|0)&(A|0)==(_|0))return h[g>>2]=0,g=0,Y=G,g|0;if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,I=et(m|0,_|0,52)|0,Q()|0,(b|0)!=(I&15|0))return g=12,Y=G,g|0;if(y=b+-1|0,b>>>0>1){S4(d,A,y,O)|0,S4(m,_,y,E)|0,I=O,M=h[I>>2]|0,I=h[I+4>>2]|0;e:do if((M|0)==(h[E>>2]|0)&&(I|0)==(h[E+4>>2]|0)){b=(b^15)*3|0,y=et(d|0,A|0,b|0)|0,Q()|0,y=y&7,b=et(m|0,_|0,b|0)|0,Q()|0,b=b&7;do if((y|0)==0|(b|0)==0)h[g>>2]=1,y=0;else if((y|0)==7)y=5;else{if((y|0)==1|(b|0)==1&&ki(M,I)|0){y=5;break}if((h[15824+(y<<2)>>2]|0)!=(b|0)&&(h[15856+(y<<2)>>2]|0)!=(b|0))break e;h[g>>2]=1,y=0}while(!1);return g=y,Y=G,g|0}while(!1)}y=O,b=y+56|0;do h[y>>2]=0,y=y+4|0;while((y|0)<(b|0));return c9(d,A,1,O)|0,A=O,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0))&&(A=O+8|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))&&(A=O+16|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))&&(A=O+24|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))&&(A=O+32|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))&&(A=O+40|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))?(y=O+48|0,y=((h[y>>2]|0)==(m|0)?(h[y+4>>2]|0)==(_|0):0)&1):y=1,h[g>>2]=y,g=0,Y=G,g|0}function Ure(d,A,m,_,g){return d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,m=Xb(d,A,m,_)|0,(m|0)==7?(g=11,g|0):(_=ht(m|0,0,56)|0,A=A&-2130706433|(Q()|0)|268435456,h[g>>2]=d|_,h[g+4>>2]=A,g=0,g|0)}function kre(d,A,m){return d=d|0,A=A|0,m=m|0,!0&(A&2013265920|0)==268435456?(h[m>>2]=d,h[m+4>>2]=A&-2130706433|134217728,m=0,m|0):(m=6,m|0)}function Gre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;return g=Y,Y=Y+16|0,_=g,h[_>>2]=0,!0&(A&2013265920|0)==268435456?(y=et(d|0,A|0,56)|0,Q()|0,_=Ls(d,A&-2130706433|134217728,y&7,_,m)|0,Y=g,_|0):(_=6,Y=g,_|0)}function y9(d,A){d=d|0,A=A|0;var m=0;switch(m=et(d|0,A|0,56)|0,Q()|0,m&7){case 0:case 7:return m=0,m|0;default:}return m=A&-2130706433|134217728,!(!0&(A&2013265920|0)==268435456)||!0&(A&117440512|0)==16777216&(ki(d,m)|0)!=0?(m=0,m|0):(m=Yb(d,m)|0,m|0)}function zre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return g=Y,Y=Y+16|0,_=g,!0&(A&2013265920|0)==268435456?(y=A&-2130706433|134217728,b=m,h[b>>2]=d,h[b+4>>2]=y,h[_>>2]=0,A=et(d|0,A|0,56)|0,Q()|0,_=Ls(d,y,A&7,_,m+8|0)|0,Y=g,_|0):(_=6,Y=g,_|0)}function x4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0;return g=(ki(d,A)|0)==0,A=A&-2130706433,_=m,h[_>>2]=g?d:0,h[_+4>>2]=g?A|285212672:0,_=m+8|0,h[_>>2]=d,h[_+4>>2]=A|301989888,_=m+16|0,h[_>>2]=d,h[_+4>>2]=A|318767104,_=m+24|0,h[_>>2]=d,h[_+4>>2]=A|335544320,_=m+32|0,h[_>>2]=d,h[_+4>>2]=A|352321536,m=m+40|0,h[m>>2]=d,h[m+4>>2]=A|369098752,0}function sx(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+16|0,g=b,y=A&-2130706433|134217728,!0&(A&2013265920|0)==268435456?(_=et(d|0,A|0,56)|0,Q()|0,_=Ise(d,y,_&7)|0,(_|0)==-1?(h[m>>2]=0,y=6,Y=b,y|0):(ng(d,y,g)|0&&li(27634,27035,282,27050),A=et(d|0,A|0,52)|0,Q()|0,A=A&15,ki(d,y)|0?y4(g,A,_,2,m):v4(g,A,_,2,m),y=0,Y=b,y|0)):(y=6,Y=b,y|0)}function v9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+16|0,_=b+8|0,g=b,y=A&-2130706433|134217728,!0&(A&2013265920|0)==268435456?(h[_>>2]=0,A=et(d|0,A|0,56)|0,Q()|0,A=Ls(d,y,A&7,_,g)|0,A|0?(m=A,Y=b,m|0):(_=h[g>>2]|0,g=h[g+4>>2]|0,A=Xb(_,g,d,y)|0,(A|0)==7?(m=11,Y=b,m|0):(d=ht(A|0,0,56)|0,y=g&-2130706433|(Q()|0)|268435456,h[m>>2]=_|d,h[m+4>>2]=y,m=0,Y=b,m|0))):(m=6,Y=b,m|0)}function Vre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0;h[m>>2]=0,I=+ne[d>>3],O=+ne[d+8>>3],M=+ne[d+16>>3],g=0,y=5,_=5,d=0;do oe=+ne[15888+(g*24|0)>>3]-I,$=+ne[15888+(g*24|0)+8>>3]-O,b=+ne[15888+(g*24|0)+16>>3]-M,b=oe*oe+$*$+b*b,b<_&&(h[m>>2]=g,y=b,d=g,_=b),g=g+1|0;while((g|0)!=20);if(y=+tre(+(1-y*.5)),y<1e-16)M=0,b=0;else{if(me=+ne[16368+(d*24|0)>>3],re=+ne[15888+(d*24|0)>>3],be=+ne[15888+(d*24|0)+8>>3],_e=+ne[15888+(d*24|0)+16>>3],Fe=-(_e+(re*0+be*0)),b=re*Fe+0,oe=be*Fe+0,Fe=_e*Fe+1,ue=+is(+(Fe*Fe+(b*b+oe*oe))),ue=ue>0?1/ue:0,b=b*ue,oe=oe*ue,ue=Fe*ue,Fe=-(I*re+O*be+M*_e),$=I+re*Fe,_=O+be*Fe,I=M+_e*Fe,O=+is(+(I*I+($*$+_*_))),O=O>0?1/O:0,$=$*O,_=_*O,O=I*O,_=+lx(me-+lx(+ia(+(O*(be*b-re*oe)+($*(_e*oe-be*ue)+_*(re*ue-_e*b))),+(ue*O+(b*$+oe*_))))),zl(A)|0?b=+lx(_+-.3334731722518321):b=_,_=+jb(+y)*2.618033988749896,(A|0)>0){d=0;do _=_*2.6457513110645907,d=d+1|0;while((d|0)!=(A|0))}M=+Qn(+b)*_,b=+Ni(+b)*_}A=m+4|0,W=m+12|0,h[W>>2]=0,y=+Ns(+b)*1.1547005383792515,_=+Ns(+M)+y*.5,d=~~_,g=~~y,_=_-+(d|0),y=y-+(g|0);do if(_<.5)if(_<.3333333333333333)if(h[A>>2]=d,y<(_+1)*.5){h[m+8>>2]=g;break}else{g=g+1|0,h[m+8>>2]=g;break}else if(Fe=1-_,g=(!(y<Fe)&1)+g|0,h[m+8>>2]=g,Fe<=y&y<_*2){d=d+1|0,h[A>>2]=d;break}else{h[A>>2]=d;break}else{if(!(_<.6666666666666666))if(d=d+1|0,h[A>>2]=d,y<_*.5){h[m+8>>2]=g;break}else{g=g+1|0,h[m+8>>2]=g;break}if(y<1-_){if(h[m+8>>2]=g,_*2+-1<y){h[A>>2]=d;break}}else g=g+1|0,h[m+8>>2]=g;d=d+1|0,h[A>>2]=d}while(!1);do if(M<0)if(g&1){q=(g+1|0)/2|0,q=Ds(d|0,((d|0)<0)<<31>>31|0,q|0,((q|0)<0)<<31>>31|0)|0,d=~~(+(d|0)-((+(q>>>0)+4294967296*+(Q()|0))*2+1)),h[A>>2]=d,q=A;break}else{q=(g|0)/2|0,q=Ds(d|0,((d|0)<0)<<31>>31|0,q|0,((q|0)<0)<<31>>31|0)|0,d=~~(+(d|0)-(+(q>>>0)+4294967296*+(Q()|0))*2),h[A>>2]=d,q=A;break}else q=A;while(!1);G=m+8|0,A=0-g|0,b<0?(m=d-((g<<1|1|0)/2|0)|0,h[q>>2]=m,h[G>>2]=A,g=A):m=d,d=g-m|0,A=0-m|0,(m|0)<0?(h[G>>2]=d,h[W>>2]=A,h[q>>2]=0,E=0):(d=g,E=m,A=0),m=E-d|0,g=A-d|0,(d|0)<0?(h[q>>2]=m,h[W>>2]=g,h[G>>2]=0,E=m,d=0):g=A,m=E-g|0,A=d-g|0,(g|0)<0?(h[q>>2]=m,h[G>>2]=A,h[W>>2]=0,g=0):(A=d,m=E),d=(A|0)<(m|0)?A:m,d=(g|0)<(d|0)?g:d,!((d|0)<=0)&&(h[q>>2]=m-d,h[G>>2]=A-d,h[W>>2]=g-d)}function qre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;_=Y,Y=Y+16|0,g=_,b=h[d+12>>2]|0,y=+((h[d+8>>2]|0)-b|0),ne[g>>3]=+((h[d+4>>2]|0)-b|0)-y*.5,ne[g+8>>3]=y*.8660254037844386,ox(g,h[d>>2]|0,A,0,m),Y=_}function ox(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0;if(y=+Pse(d),y<1e-16){A=15888+(A*24|0)|0,h[g>>2]=h[A>>2],h[g+4>>2]=h[A+4>>2],h[g+8>>2]=h[A+8>>2],h[g+12>>2]=h[A+12>>2],h[g+16>>2]=h[A+16>>2],h[g+20>>2]=h[A+20>>2];return}if(b=+ia(+ +ne[d+8>>3],+ +ne[d>>3]),(m|0)>0){d=0;do y=y*.37796447300922725,d=d+1|0;while((d|0)!=(m|0))}E=y*.3333333333333333,_?(m=(zl(m)|0)==0,y=+a9(+((m?E:E*.37796447300922725)*.381966011250105))):(y=+a9(+(y*.381966011250105)),zl(m)|0&&(b=+lx(b+.3334731722518321))),G=+lx(+ne[16368+(A*24|0)>>3]-b),E=+ne[15888+(A*24|0)>>3],O=+ne[15888+(A*24|0)+8>>3],oe=+ne[15888+(A*24|0)+16>>3],W=-(oe+(E*0+O*0)),I=E*W+0,b=O*W+0,W=oe*W+1,q=+is(+(W*W+(I*I+b*b))),q=q>0?1/q:0,I=I*q,b=b*q,q=W*q,W=+Qn(+G),G=+Ni(+G),ue=+Qn(+y),$=+Ni(+y),M=ue*E+$*(W*I+G*(oe*b-O*q)),y=ue*O+$*(W*b+G*(E*q-oe*I)),b=ue*oe+$*(W*q+G*(O*I-E*b)),E=+is(+(b*b+(M*M+y*y))),E=E>0?1/E:0,ne[g>>3]=M*E,ne[g+8>>3]=y*E,ne[g+16>>3]=b*E}function y4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0,ci=0,gi=0,lo=0,Un=0,_i=0,sa=0,As=0,Hr=0,ms=0,rs=0,Ba=0,Xs=0,$s=0,ql=0,co=0,Si=0,L0=0;if(Ba=Y,Y=Y+256|0,y=Ba+240|0,ci=Ba+224|0,Hr=Ba,ms=Ba+208|0,rs=Ba+192|0,gi=Ba+168|0,lo=Ba+152|0,Un=Ba+136|0,_i=Ba+120|0,sa=Ba+104|0,As=Ba+80|0,h[y>>2]=A,h[ci>>2]=h[d>>2],h[ci+4>>2]=h[d+4>>2],h[ci+8>>2]=h[d+8>>2],h[ci+12>>2]=h[d+12>>2],b9(ci,y,Hr),h[g>>2]=0,ci=_+m+((_|0)==5&1)|0,(ci|0)<=(m|0)){Y=Ba;return}me=h[y>>2]|0,be=ms+4|0,_e=ms+8|0,re=ms+12|0,Fe=rs+8|0,Ze=m+5|0,Ee=16848+(me<<2)|0,ye=gi+8|0,At=16928+(me<<2)|0,We=lo+8|0,Ot=Un+8|0,at=_i+8|0,dt=rs+8|0,W=gi+8|0,oe=gi+16|0,$=As+8|0,ue=As+16|0,q=m,_=0,b=0,E=0,M=0;e:for(;;){G=Hr+(((q|0)%5|0)<<4)|0,h[ms>>2]=h[G>>2],h[ms+4>>2]=h[G+4>>2],h[ms+8>>2]=h[G+8>>2],h[ms+12>>2]=h[G+12>>2];do;while((tg(ms,me,0,1)|0)==2);if((q|0)>(m|0)&(zl(A)|0)!=0){if(G=h[ms>>2]|0,d=h[be>>2]|0,I=h[_e>>2]|0,y=h[re>>2]|0,Xs=+(E-M|0),ne[rs>>3]=+(b-M|0)-Xs*.5,ne[Fe>>3]=Xs*.8660254037844386,M=h[17008+(G*80|0)+(_<<2)>>2]|0,O=h[18608+(G*80|0)+(M*20|0)>>2]|0,E=h[18608+(G*80|0)+(M*20|0)+16>>2]|0,(E|0)>0){b=0,_=I;do co=y+d|0,Si=(co|0)<0,I=_+d-(Si?co:0)|0,ql=(I|0)<0,$s=y+_-(Si?co:0)-(ql?I:0)|0,y=($s|0)<0,d=(Si?0:co)-(ql?I:0)-(y?$s:0)|0,_=(ql?0:I)-(y?$s:0)|0,$s=y?0:$s,y=(_|0)<(d|0)?_:d,y=($s|0)<(y|0)?$s:y,I=(y|0)>0,d=d-(I?y:0)|0,_=_-(I?y:0)|0,y=$s-(I?y:0)|0,b=b+1|0;while((b|0)<(E|0))}else _=I;switch(Si=(h[Ee>>2]|0)*3|0,$s=(Fa(Si,h[18608+(G*80|0)+(M*20|0)+4>>2]|0)|0)+d|0,I=(Fa(Si,h[18608+(G*80|0)+(M*20|0)+8>>2]|0)|0)+_|0,Si=(Fa(Si,h[18608+(G*80|0)+(M*20|0)+12>>2]|0)|0)+y|0,M=($s|0)<0,I=I-(M?$s:0)|0,ql=(I|0)<0,Si=Si+(M?0-$s|0:0)+(ql?0-I|0:0)|0,co=(Si|0)<0,$s=(M?0:$s)-(ql?I:0)-(co?Si:0)|0,I=(ql?0:I)-(co?Si:0)|0,Si=co?0:Si,co=(I|0)<($s|0)?I:$s,co=(Si|0)<(co|0)?Si:co,ql=(co|0)>0,Si=Si-(ql?co:0)|0,Xs=+(I-(ql?co:0)-Si|0),ne[gi>>3]=+($s-(ql?co:0)-Si|0)-Xs*.5,ne[ye>>3]=Xs*.8660254037844386,Xs=+(h[At>>2]|0),ne[lo>>3]=Xs*3,ne[We>>3]=0,L0=Xs*-1.5,ne[Un>>3]=L0,ne[Ot>>3]=Xs*2.598076211353316,ne[_i>>3]=L0,ne[at>>3]=Xs*-2.598076211353316,h[17008+(O*80|0)+(G<<2)>>2]|0){case 1:{d=Un,_=lo;break}case 3:{d=_i,_=Un;break}case 2:{d=lo,_=_i;break}default:{d=12;break e}}O9(rs,gi,_,d,sa),ox(sa,O,me,1,As),Si=h[g>>2]|0,Xs=+rx(+ +ne[ue>>3]),L0=+ia(+ +ne[$>>3],+ +ne[As>>3]),ne[g+8+(Si<<4)>>3]=Xs,ne[g+8+(Si<<4)+8>>3]=L0,h[g>>2]=(h[g>>2]|0)+1}if((q|0)<(Ze|0)&&(Si=h[re>>2]|0,Xs=+((h[_e>>2]|0)-Si|0),ne[rs>>3]=+((h[be>>2]|0)-Si|0)-Xs*.5,ne[dt>>3]=Xs*.8660254037844386,ox(rs,h[ms>>2]|0,me,1,gi),Si=h[g>>2]|0,Xs=+rx(+ +ne[oe>>3]),L0=+ia(+ +ne[W>>3],+ +ne[gi>>3]),ne[g+8+(Si<<4)>>3]=Xs,ne[g+8+(Si<<4)+8>>3]=L0,h[g>>2]=(h[g>>2]|0)+1),q=q+1|0,(q|0)>=(ci|0)){d=3;break}else _=h[ms>>2]|0,b=h[be>>2]|0,E=h[_e>>2]|0,M=h[re>>2]|0}if((d|0)==3){Y=Ba;return}else(d|0)==12&&li(27073,27120,599,27130)}function b9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;$=Y,Y=Y+128|0,_=$+64|0,g=$,y=_,b=20208,E=y+60|0;do h[y>>2]=h[b>>2],y=y+4|0,b=b+4|0;while((y|0)<(E|0));y=g,b=20272,E=y+60|0;do h[y>>2]=h[b>>2],y=y+4|0,b=b+4|0;while((y|0)<(E|0));if(O=(zl(h[A>>2]|0)|0)==0,O=O?_:g,W=d+4|0,y=h[W>>2]|0,G=d+8|0,_=h[G>>2]|0,q=d+12|0,g=h[q>>2]|0,b=_+(y<<1)|0,h[W>>2]=b,_=g+(_<<1)|0,h[G>>2]=_,y=(g<<1)+y|0,h[q>>2]=y,g=_-b|0,E=y-b|0,(b|0)<0&&(h[G>>2]=g,h[q>>2]=E,h[W>>2]=0,_=g,b=0,y=E),E=b-_|0,g=y-_|0,(_|0)<0?(h[W>>2]=E,h[q>>2]=g,h[G>>2]=0,_=0):(g=y,E=b),b=E-g|0,y=_-g|0,(g|0)<0?(h[W>>2]=b,h[G>>2]=y,h[q>>2]=0,g=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(g=g-_|0,y=y-_|0,b=b-_|0,h[W>>2]=b,h[G>>2]=y,h[q>>2]=g),M=(y<<1)+b|0,E=g+(b<<1)|0,h[W>>2]=E,h[G>>2]=M,y=(g<<1)+y|0,h[q>>2]=y,_=M-E|0,g=y-E|0,(E|0)<0?(h[G>>2]=_,h[q>>2]=g,h[W>>2]=0,E=0,y=g):_=M,b=E-_|0,g=y-_|0,(_|0)<0?(h[W>>2]=b,h[q>>2]=g,h[G>>2]=0,E=b,_=0):g=y,b=E-g|0,y=_-g|0,(g|0)<0?(h[W>>2]=b,h[G>>2]=y,h[q>>2]=0,g=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[W>>2]=b-_,h[G>>2]=y-_,h[q>>2]=g-_),zl(h[A>>2]|0)|0&&(y=h[W>>2]|0,b=h[G>>2]|0,g=h[q>>2]|0,_=(b*3|0)+y|0,y=g+(y*3|0)|0,h[W>>2]=y,h[G>>2]=_,b=(g*3|0)+b|0,h[q>>2]=b,g=_-y|0,E=b-y|0,(y|0)<0?(h[G>>2]=g,h[q>>2]=E,h[W>>2]=0,_=g,M=0):(M=y,E=b),y=M-_|0,g=E-_|0,(_|0)<0?(h[W>>2]=y,h[q>>2]=g,h[G>>2]=0,M=y,b=0):(b=_,g=E),y=M-g|0,_=b-g|0,(g|0)<0?(h[W>>2]=y,h[G>>2]=_,h[q>>2]=0,b=_,g=0):y=M,_=(b|0)<(y|0)?b:y,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[W>>2]=y-_,h[G>>2]=b-_,h[q>>2]=g-_),h[A>>2]=(h[A>>2]|0)+1),h[m>>2]=h[d>>2],g=h[G>>2]|0,_=h[q>>2]|0,A=h[O+4>>2]|0,I=h[O+8>>2]|0,b=(h[O>>2]|0)+(h[W>>2]|0)|0,M=m+4|0,h[M>>2]=b,g=A+g|0,A=m+8|0,h[A>>2]=g,_=I+_|0,I=m+12|0,h[I>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[A>>2]=y,h[I>>2]=_,h[M>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[M>>2]=b,_=_-g|0,h[I>>2]=_,h[A>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[M>>2]=E,h[A>>2]=y,h[I>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[M>>2]=b-g,h[A>>2]=y-g,h[I>>2]=_-g),h[m+16>>2]=h[d>>2],g=h[G>>2]|0,_=h[q>>2]|0,A=h[O+16>>2]|0,I=h[O+20>>2]|0,b=(h[O+12>>2]|0)+(h[W>>2]|0)|0,M=m+20|0,h[M>>2]=b,g=A+g|0,A=m+24|0,h[A>>2]=g,_=I+_|0,I=m+28|0,h[I>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[A>>2]=y,h[I>>2]=_,h[M>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[M>>2]=b,_=_-g|0,h[I>>2]=_,h[A>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[M>>2]=E,h[A>>2]=y,h[I>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[M>>2]=b-g,h[A>>2]=y-g,h[I>>2]=_-g),h[m+32>>2]=h[d>>2],g=h[G>>2]|0,_=h[q>>2]|0,A=h[O+28>>2]|0,I=h[O+32>>2]|0,b=(h[O+24>>2]|0)+(h[W>>2]|0)|0,M=m+36|0,h[M>>2]=b,g=A+g|0,A=m+40|0,h[A>>2]=g,_=I+_|0,I=m+44|0,h[I>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[A>>2]=y,h[I>>2]=_,h[M>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[M>>2]=b,_=_-g|0,h[I>>2]=_,h[A>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[M>>2]=E,h[A>>2]=y,h[I>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[M>>2]=b-g,h[A>>2]=y-g,h[I>>2]=_-g),h[m+48>>2]=h[d>>2],g=h[G>>2]|0,_=h[q>>2]|0,A=h[O+40>>2]|0,I=h[O+44>>2]|0,b=(h[O+36>>2]|0)+(h[W>>2]|0)|0,M=m+52|0,h[M>>2]=b,g=A+g|0,A=m+56|0,h[A>>2]=g,_=I+_|0,I=m+60|0,h[I>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[A>>2]=y,h[I>>2]=_,h[M>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[M>>2]=b,_=_-g|0,h[I>>2]=_,h[A>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[M>>2]=E,h[A>>2]=y,h[I>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[M>>2]=b-g,h[A>>2]=y-g,h[I>>2]=_-g),h[m+64>>2]=h[d>>2],y=h[G>>2]|0,_=h[q>>2]|0,I=h[O+52>>2]|0,M=h[O+56>>2]|0,b=(h[O+48>>2]|0)+(h[W>>2]|0)|0,A=m+68|0,h[A>>2]=b,y=I+y|0,I=m+72|0,h[I>>2]=y,_=M+_|0,M=m+76|0,h[M>>2]=_,g=y-b|0,(b|0)<0?(_=_-b|0,h[I>>2]=g,h[M>>2]=_,h[A>>2]=0,y=0):(g=y,y=b),(g|0)<0&&(y=y-g|0,h[A>>2]=y,_=_-g|0,h[M>>2]=_,h[I>>2]=0,g=0),E=y-_|0,b=g-_|0,(_|0)<0?(h[A>>2]=E,h[I>>2]=b,h[M>>2]=0,y=E,_=0):b=g,g=(b|0)<(y|0)?b:y,g=(_|0)<(g|0)?_:g,(g|0)<=0){Y=$;return}h[A>>2]=y-g,h[I>>2]=b-g,h[M>>2]=_-g,Y=$}function tg(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0;if(q=h[16928+(A<<2)>>2]|0,G=(_|0)!=0,q=G?q*3|0:q,O=d+4|0,E=h[O>>2]|0,I=d+8|0,y=h[I>>2]|0,G){if(b=d+12|0,_=h[b>>2]|0,g=y+E+_|0,(g|0)==(q|0))return q=1,q|0;M=b}else M=d+12|0,g=h[M>>2]|0,_=g,g=y+E+g|0;if((g|0)<=(q|0))return q=0,q|0;do if((_|0)>0){if(g=h[d>>2]|0,(y|0)>0){g=18608+(g*80|0)+60|0,b=E;break}g=18608+(g*80|0)+40|0,m?(b=E-q|0,m=y+b|0,W=(m|0)<0,y=_+y-(W?m:0)|0,E=(y|0)<0,_=_+b-(W?m:0)-(E?y:0)|0,b=(_|0)<0,m=(W?0:m)-(E?y:0)-(b?_:0)|0,y=(E?0:y)-(b?_:0)|0,_=b?0:_,b=(y|0)<(m|0)?y:m,b=(_|0)<(b|0)?_:b,E=(b|0)>0,y=y-(E?b:0)|0,_=_-(E?b:0)|0,b=m-(E?b:0)+q|0,h[O>>2]=b,h[I>>2]=y,h[M>>2]=_):b=E}else g=18608+((h[d>>2]|0)*80|0)+20|0,b=E;while(!1);if(h[d>>2]=h[g>>2],E=h[g+16>>2]|0,(E|0)>0){m=0;do W=_+b|0,$=(W|0)<0,_e=$?W:0,oe=y+b-_e|0,ue=(oe|0)<0,d=ue?oe:0,b=_+y-_e-d|0,y=(b|0)<0,_=y?0:b,b=y?b:0,y=(ue?0:oe)-b|0,b=($?0:W)-d-b|0,d=(y|0)<(b|0)?y:b,d=(_|0)<(d|0)?_:d,(d|0)>0&&(b=b-d|0,y=y-d|0,_=_-d|0),m=m+1|0;while((m|0)<(E|0));h[O>>2]=b,h[I>>2]=y,h[M>>2]=_}return oe=h[16848+(A<<2)>>2]|0,oe=G?oe*3|0:oe,ue=Fa(oe,h[g+8>>2]|0)|0,_e=Fa(oe,h[g+12>>2]|0)|0,b=(Fa(oe,h[g+4>>2]|0)|0)+b|0,h[O>>2]=b,y=ue+y|0,h[I>>2]=y,_=_e+_|0,h[M>>2]=_,g=y-b|0,(b|0)<0?(_=_-b|0,h[I>>2]=g,h[M>>2]=_,h[O>>2]=0,y=0):(g=y,y=b),(g|0)<0?(d=y-g|0,h[O>>2]=d,_=_-g|0,h[M>>2]=_,h[I>>2]=0,b=0):(d=y,b=g),y=d-_|0,g=b-_|0,(_|0)<0?(h[O>>2]=y,h[I>>2]=g,h[M>>2]=0,_=0):(g=b,y=d),b=(g|0)<(y|0)?g:y,b=(_|0)<(b|0)?_:b,(b|0)>0&&(y=y-b|0,g=g-b|0,_=_-b|0,h[O>>2]=y,h[I>>2]=g,h[M>>2]=_),G?(_e=(g+y+_|0)==(q|0)?1:2,_e|0):(_e=2,_e|0)}function Hre(d,A){d=d|0,A=A|0;var m=0;do m=tg(d,A,0,1)|0;while((m|0)==2);return m|0}function v4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0,ci=0,gi=0,lo=0,Un=0,_i=0,sa=0,As=0,Hr=0,ms=0,rs=0;if(As=Y,Y=Y+272|0,y=As+256|0,b=As+240|0,Un=As,_i=As+224|0,sa=As+208|0,We=As+184|0,Ot=As+168|0,at=As+152|0,dt=As+136|0,ci=As+120|0,gi=As+96|0,h[y>>2]=A,h[b>>2]=h[d>>2],h[b+4>>2]=h[d+4>>2],h[b+8>>2]=h[d+8>>2],h[b+12>>2]=h[d+12>>2],w9(b,y,Un),h[g>>2]=0,At=_+m+((_|0)==6&1)|0,(At|0)<=(m|0)){Y=As;return}_e=h[y>>2]|0,re=m+6|0,be=sa+8|0,me=We+8|0,Fe=16928+(_e<<2)|0,Ze=Ot+8|0,Ee=at+8|0,ye=dt+8|0,oe=h[b>>2]|0,q=_i+4|0,W=_i+8|0,$=_i+12|0,ue=sa+8|0,M=We+8|0,O=We+16|0,I=gi+8|0,G=gi+16|0,b=0,E=m,_=-1;e:for(;;){if(y=(E|0)%6|0,d=Un+(y<<4)|0,h[_i>>2]=h[d>>2],h[_i+4>>2]=h[d+4>>2],h[_i+8>>2]=h[d+8>>2],h[_i+12>>2]=h[d+12>>2],d=b,b=tg(_i,_e,0,1)|0,(E|0)>(m|0)&(zl(A)|0)!=0&&(lo=h[_i>>2]|0,(d|0)!=1&(lo|0)!=(_|0))){switch(rs=(y+5|0)%6|0,d=h[Un+(rs<<4)+12>>2]|0,Hr=+((h[Un+(rs<<4)+8>>2]|0)-d|0),ne[sa>>3]=+((h[Un+(rs<<4)+4>>2]|0)-d|0)-Hr*.5,ne[be>>3]=Hr*.8660254037844386,d=h[Un+(y<<4)+12>>2]|0,Hr=+((h[Un+(y<<4)+8>>2]|0)-d|0),ne[We>>3]=+((h[Un+(y<<4)+4>>2]|0)-d|0)-Hr*.5,ne[me>>3]=Hr*.8660254037844386,Hr=+(h[Fe>>2]|0),ne[Ot>>3]=Hr*3,ne[Ze>>3]=0,ms=Hr*-1.5,ne[at>>3]=ms,ne[Ee>>3]=Hr*2.598076211353316,ne[dt>>3]=ms,ne[ye>>3]=Hr*-2.598076211353316,h[17008+(oe*80|0)+(((_|0)==(oe|0)?lo:_)<<2)>>2]|0){case 1:{d=at,_=Ot;break}case 3:{d=dt,_=at;break}case 2:{d=Ot,_=dt;break}default:{d=8;break e}}O9(sa,We,_,d,ci),!(B9(sa,ci)|0)&&!(B9(We,ci)|0)&&(ox(ci,oe,_e,1,gi),rs=h[g>>2]|0,Hr=+rx(+ +ne[G>>3]),ms=+ia(+ +ne[I>>3],+ +ne[gi>>3]),ne[g+8+(rs<<4)>>3]=Hr,ne[g+8+(rs<<4)+8>>3]=ms,h[g>>2]=(h[g>>2]|0)+1)}if((E|0)<(re|0)&&(rs=h[$>>2]|0,Hr=+((h[W>>2]|0)-rs|0),ne[sa>>3]=+((h[q>>2]|0)-rs|0)-Hr*.5,ne[ue>>3]=Hr*.8660254037844386,ox(sa,h[_i>>2]|0,_e,1,We),rs=h[g>>2]|0,Hr=+rx(+ +ne[O>>3]),ms=+ia(+ +ne[M>>3],+ +ne[We>>3]),ne[g+8+(rs<<4)>>3]=Hr,ne[g+8+(rs<<4)+8>>3]=ms,h[g>>2]=(h[g>>2]|0)+1),E=E+1|0,(E|0)>=(At|0)){d=3;break}else _=h[_i>>2]|0}if((d|0)==3){Y=As;return}else(d|0)==8&&li(27157,27120,766,27202)}function w9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0;oe=Y,Y=Y+160|0,_=oe+80|0,g=oe,y=_,b=20336,E=y+72|0;do h[y>>2]=h[b>>2],y=y+4|0,b=b+4|0;while((y|0)<(E|0));y=g,b=20416,E=y+72|0;do h[y>>2]=h[b>>2],y=y+4|0,b=b+4|0;while((y|0)<(E|0));G=(zl(h[A>>2]|0)|0)==0,G=G?_:g,$=d+4|0,y=h[$>>2]|0,q=d+8|0,_=h[q>>2]|0,W=d+12|0,g=h[W>>2]|0,b=_+(y<<1)|0,h[$>>2]=b,_=g+(_<<1)|0,h[q>>2]=_,y=(g<<1)+y|0,h[W>>2]=y,g=_-b|0,E=y-b|0,(b|0)<0&&(h[q>>2]=g,h[W>>2]=E,h[$>>2]=0,_=g,b=0,y=E),E=b-_|0,g=y-_|0,(_|0)<0?(h[$>>2]=E,h[W>>2]=g,h[q>>2]=0,_=0):(g=y,E=b),b=E-g|0,y=_-g|0,(g|0)<0?(h[$>>2]=b,h[q>>2]=y,h[W>>2]=0,g=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(g=g-_|0,y=y-_|0,b=b-_|0,h[$>>2]=b,h[q>>2]=y,h[W>>2]=g),M=(y<<1)+b|0,E=g+(b<<1)|0,h[$>>2]=E,h[q>>2]=M,y=(g<<1)+y|0,h[W>>2]=y,_=M-E|0,g=y-E|0,(E|0)<0?(h[q>>2]=_,h[W>>2]=g,h[$>>2]=0,E=0,y=g):_=M,b=E-_|0,g=y-_|0,(_|0)<0?(h[$>>2]=b,h[W>>2]=g,h[q>>2]=0,E=b,_=0):g=y,b=E-g|0,y=_-g|0,(g|0)<0?(h[$>>2]=b,h[q>>2]=y,h[W>>2]=0,g=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[$>>2]=b-_,h[q>>2]=y-_,h[W>>2]=g-_),zl(h[A>>2]|0)|0&&(y=h[$>>2]|0,b=h[q>>2]|0,g=h[W>>2]|0,_=(b*3|0)+y|0,y=g+(y*3|0)|0,h[$>>2]=y,h[q>>2]=_,b=(g*3|0)+b|0,h[W>>2]=b,g=_-y|0,E=b-y|0,(y|0)<0?(h[q>>2]=g,h[W>>2]=E,h[$>>2]=0,_=g,M=0):(M=y,E=b),y=M-_|0,g=E-_|0,(_|0)<0?(h[$>>2]=y,h[W>>2]=g,h[q>>2]=0,M=y,b=0):(b=_,g=E),y=M-g|0,_=b-g|0,(g|0)<0?(h[$>>2]=y,h[q>>2]=_,h[W>>2]=0,b=_,g=0):y=M,_=(b|0)<(y|0)?b:y,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[$>>2]=y-_,h[q>>2]=b-_,h[W>>2]=g-_),h[A>>2]=(h[A>>2]|0)+1),M=0;do h[m+(M<<4)>>2]=h[d>>2],g=h[q>>2]|0,_=h[W>>2]|0,I=h[G+(M*12|0)+4>>2]|0,O=h[G+(M*12|0)+8>>2]|0,b=(h[G+(M*12|0)>>2]|0)+(h[$>>2]|0)|0,A=m+(M<<4)+4|0,h[A>>2]=b,g=I+g|0,I=m+(M<<4)+8|0,h[I>>2]=g,_=O+_|0,O=m+(M<<4)+12|0,h[O>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[I>>2]=y,h[O>>2]=_,h[A>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[A>>2]=b,_=_-g|0,h[O>>2]=_,h[I>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[A>>2]=E,h[I>>2]=y,h[O>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[A>>2]=b-g,h[I>>2]=y-g,h[O>>2]=_-g),M=M+1|0;while((M|0)!=6);Y=oe}function b4(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,52)|0,Q()|0,A&15|0}function S9(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,45)|0,Q()|0,A&127|0}function Wre(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,(m+-1|0)>>>0>14?(_=4,_|0):(m=et(d|0,A|0,(15-m|0)*3|0)|0,Q()|0,h[_>>2]=m&7,_=0,_|0)}function jre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;if(d>>>0>15)return _=4,_|0;if(A>>>0>121)return _=17,_|0;b=ht(d|0,0,52)|0,g=Q()|0,E=ht(A|0,0,45)|0,g=g|(Q()|0)|134225919;e:do if((d|0)>=1){for(E=1,b=(He[20496+A>>0]|0)!=0,y=-1;;){if(A=h[m+(E+-1<<2)>>2]|0,A>>>0>6){g=18,A=10;break}if(!((A|0)==0|b^1))if((A|0)==1){g=19,A=10;break}else b=0;if(I=(15-E|0)*3|0,M=ht(7,0,I|0)|0,g=g&~(Q()|0),A=ht(A|0,((A|0)<0)<<31>>31|0,I|0)|0,y=A|y&~M,g=Q()|0|g,(E|0)<(d|0))E=E+1|0;else break e}if((A|0)==10)return g|0}else y=-1;while(!1);return I=_,h[I>>2]=y,h[I+4>>2]=g,I=0,I|0}function Yb(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0;return!(!0&(A&-16777216|0)==134217728)||(_=et(d|0,A|0,52)|0,Q()|0,_=_&15,m=et(d|0,A|0,45)|0,Q()|0,m=m&127,m>>>0>121)?(d=0,d|0):(b=(_^15)*3|0,g=et(d|0,A|0,b|0)|0,b=ht(g|0,Q()|0,b|0)|0,g=Q()|0,y=Ds(-1227133514,-1171,b|0,g|0)|0,!((b&613566756&y|0)==0&(g&4681&(Q()|0)|0)==0)||(b=(_*3|0)+19|0,y=ht(~d|0,~A|0,b|0)|0,b=et(y|0,Q()|0,b|0)|0,!((_|0)==15|(b|0)==0&(Q()|0)==0))?(b=0,b|0):!(He[20496+m>>0]|0)||(A=A&8191,(d|0)==0&(A|0)==0)?(b=1,b|0):(b=U4(d|0,A|0,0)|0,Q()|0,((63-b|0)%3|0|0)!=0|0))}function Xre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0;return!0&(A&-16777216|0)==134217728&&(_=et(d|0,A|0,52)|0,Q()|0,_=_&15,m=et(d|0,A|0,45)|0,Q()|0,m=m&127,m>>>0<=121)&&(b=(_^15)*3|0,g=et(d|0,A|0,b|0)|0,b=ht(g|0,Q()|0,b|0)|0,g=Q()|0,y=Ds(-1227133514,-1171,b|0,g|0)|0,(b&613566756&y|0)==0&(g&4681&(Q()|0)|0)==0)&&(b=(_*3|0)+19|0,y=ht(~d|0,~A|0,b|0)|0,b=et(y|0,Q()|0,b|0)|0,(_|0)==15|(b|0)==0&(Q()|0)==0)&&(!(He[20496+m>>0]|0)||(m=A&8191,(d|0)==0&(m|0)==0)||(b=U4(d|0,m|0,0)|0,Q()|0,(63-b|0)%3|0|0))||y9(d,A)|0?(b=1,b|0):(b=(U9(d,A)|0)!=0&1,b|0)}function w4(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0;if(g=ht(A|0,0,52)|0,y=Q()|0,m=ht(m|0,0,45)|0,m=y|(Q()|0)|134225919,(A|0)<1){y=-1,_=m,A=d,h[A>>2]=y,d=d+4|0,h[d>>2]=_;return}for(y=1,g=-1;b=(15-y|0)*3|0,E=ht(7,0,b|0)|0,m=m&~(Q()|0),b=ht(_|0,0,b|0)|0,g=g&~E|b,m=m|(Q()|0),(y|0)!=(A|0);)y=y+1|0;E=d,b=E,h[b>>2]=g,E=E+4|0,h[E>>2]=m}function S4(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;if(y=et(d|0,A|0,52)|0,Q()|0,y=y&15,m>>>0>15)return _=4,_|0;if((y|0)<(m|0))return _=12,_|0;if((y|0)==(m|0))return h[_>>2]=d,h[_+4>>2]=A,_=0,_|0;if(g=ht(m|0,0,52)|0,g=g|d,d=Q()|0|A&-15728641,(y|0)>(m|0))do A=ht(7,0,(14-m|0)*3|0)|0,m=m+1|0,g=A|g,d=Q()|0|d;while((m|0)<(y|0));return h[_>>2]=g,h[_+4>>2]=d,_=0,_|0}function ax(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;if(y=et(d|0,A|0,52)|0,Q()|0,y=y&15,!((m|0)<16&(y|0)<=(m|0)))return _=4,_|0;g=m-y|0,m=et(d|0,A|0,45)|0,Q()|0;e:do if(!(ar(m&127)|0))m=ld(7,0,g,((g|0)<0)<<31>>31)|0,g=Q()|0;else{t:do if(y|0){for(m=1;b=ht(7,0,(15-m|0)*3|0)|0,!!((b&d|0)==0&((Q()|0)&A|0)==0);)if(m>>>0<y>>>0)m=m+1|0;else break t;m=ld(7,0,g,((g|0)<0)<<31>>31)|0,g=Q()|0;break e}while(!1);m=ld(7,0,g,((g|0)<0)<<31>>31)|0,m=cr(m|0,Q()|0,5,0)|0,m=pt(m|0,Q()|0,-5,-1)|0,m=cd(m|0,Q()|0,6,0)|0,m=pt(m|0,Q()|0,1,0)|0,g=Q()|0}while(!1);return b=_,h[b>>2]=m,h[b+4>>2]=g,b=0,b|0}function ki(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;if(g=et(d|0,A|0,45)|0,Q()|0,!(ar(g&127)|0))return g=0,g|0;g=et(d|0,A|0,52)|0,Q()|0,g=g&15;e:do if(!g)m=0;else for(_=1;;){if(m=et(d|0,A|0,(15-_|0)*3|0)|0,Q()|0,m=m&7,m|0)break e;if(_>>>0<g>>>0)_=_+1|0;else{m=0;break}}while(!1);return g=(m|0)==0&1,g|0}function $re(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0;if(b=Y,Y=Y+16|0,y=b,P4(y,d,A,m),A=y,d=h[A>>2]|0,A=h[A+4>>2]|0,(d|0)==0&(A|0)==0)return Y=b,0;g=0,m=0;do E=_+(g<<3)|0,h[E>>2]=d,h[E+4>>2]=A,g=pt(g|0,m|0,1,0)|0,m=Q()|0,I4(y),E=y,d=h[E>>2]|0,A=h[E+4>>2]|0;while(!((d|0)==0&(A|0)==0));return Y=b,0}function T9(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,(_|0)<(m|0)?(m=A,_=d,Dn(m|0),_|0):(m=ht(-1,-1,((_-m|0)*3|0)+3|0)|0,_=ht(~m|0,~(Q()|0)|0,(15-_|0)*3|0)|0,m=~(Q()|0)&A,_=~_&d,Dn(m|0),_|0)}function E9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0;return g=et(d|0,A|0,52)|0,Q()|0,g=g&15,(m|0)<16&(g|0)<=(m|0)?((g|0)<(m|0)&&(g=ht(-1,-1,((m+-1-g|0)*3|0)+3|0)|0,g=ht(~g|0,~(Q()|0)|0,(15-m|0)*3|0)|0,A=~(Q()|0)&A,d=~g&d),g=ht(m|0,0,52)|0,m=A&-15728641|(Q()|0),h[_>>2]=d|g,h[_+4>>2]=m,_=0,_|0):(_=4,_|0)}function Yre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0;if((m|0)==0&(_|0)==0)return dt=0,dt|0;if(g=d,y=h[g>>2]|0,g=h[g+4>>2]|0,!0&(g&15728640|0)==0){if(!((_|0)>0|(_|0)==0&m>>>0>0)||(dt=A,h[dt>>2]=y,h[dt+4>>2]=g,(m|0)==1&(_|0)==0))return dt=0,dt|0;g=1,y=0;do Ot=d+(g<<3)|0,at=h[Ot+4>>2]|0,dt=A+(g<<3)|0,h[dt>>2]=h[Ot>>2],h[dt+4>>2]=at,g=pt(g|0,y|0,1,0)|0,y=Q()|0;while((y|0)<(_|0)|(y|0)==(_|0)&g>>>0<m>>>0);return g=0,g|0}if(We=m<<3,at=lr(We)|0,!at)return dt=13,dt|0;if(bc(at|0,d|0,We|0)|0,Ot=ra(m,8)|0,!Ot)return _t(at),dt=13,dt|0;e:for(;;){g=at,I=h[g>>2]|0,g=h[g+4>>2]|0,ye=et(I|0,g|0,52)|0,Q()|0,ye=ye&15,At=ye+-1|0,Ee=(ye|0)!=0,Ze=(_|0)>0|(_|0)==0&m>>>0>0;t:do if(Ee&Ze){if(re=ht(At|0,0,52)|0,be=Q()|0,At>>>0>15){if(!((I|0)==0&(g|0)==0)){dt=16;break e}for(y=0,d=0;;){if(y=pt(y|0,d|0,1,0)|0,d=Q()|0,!((d|0)<(_|0)|(d|0)==(_|0)&y>>>0<m>>>0))break t;if(b=at+(y<<3)|0,Fe=h[b>>2]|0,b=h[b+4>>2]|0,!((Fe|0)==0&(b|0)==0)){g=b,dt=16;break e}}}for(E=I,d=g,y=0,b=0;;){if(!((E|0)==0&(d|0)==0)){if(!(!0&(d&117440512|0)==0)){dt=21;break e}if(O=et(E|0,d|0,52)|0,Q()|0,O=O&15,(O|0)<(At|0)){g=12,dt=27;break e}if((O|0)!=(At|0)&&(E=E|re,d=d&-15728641|be,O>>>0>=ye>>>0)){M=At;do Fe=ht(7,0,(14-M|0)*3|0)|0,M=M+1|0,E=Fe|E,d=Q()|0|d;while(M>>>0<O>>>0)}if(q=Yh(E|0,d|0,m|0,_|0)|0,W=Q()|0,M=Ot+(q<<3)|0,O=M,G=h[O>>2]|0,O=h[O+4>>2]|0,!((G|0)==0&(O|0)==0)){ue=0,_e=0;do{if((ue|0)>(_|0)|(ue|0)==(_|0)&_e>>>0>m>>>0){dt=31;break e}if((G|0)==(E|0)&(O&-117440513|0)==(d|0)){$=et(G|0,O|0,56)|0,Q()|0,$=$&7,oe=$+1|0,Fe=et(G|0,O|0,45)|0,Q()|0;n:do if(!(ar(Fe&127)|0))O=7;else{if(G=et(G|0,O|0,52)|0,Q()|0,G=G&15,!G){O=6;break}for(O=1;;){if(Fe=ht(7,0,(15-O|0)*3|0)|0,!((Fe&E|0)==0&((Q()|0)&d|0)==0)){O=7;break n}if(O>>>0<G>>>0)O=O+1|0;else{O=6;break}}}while(!1);if(($+2|0)>>>0>O>>>0){dt=41;break e}Fe=ht(oe|0,0,56)|0,d=Q()|0|d&-117440513,me=M,h[me>>2]=0,h[me+4>>2]=0,E=Fe|E}else q=pt(q|0,W|0,1,0)|0,q=ud(q|0,Q()|0,m|0,_|0)|0,W=Q()|0;_e=pt(_e|0,ue|0,1,0)|0,ue=Q()|0,M=Ot+(q<<3)|0,O=M,G=h[O>>2]|0,O=h[O+4>>2]|0}while(!((G|0)==0&(O|0)==0))}Fe=M,h[Fe>>2]=E,h[Fe+4>>2]=d}if(y=pt(y|0,b|0,1,0)|0,b=Q()|0,!((b|0)<(_|0)|(b|0)==(_|0)&y>>>0<m>>>0))break t;d=at+(y<<3)|0,E=h[d>>2]|0,d=h[d+4>>2]|0}}while(!1);if(Fe=pt(m|0,_|0,5,0)|0,me=Q()|0,me>>>0<0|(me|0)==0&Fe>>>0<11){dt=85;break}if(Fe=cd(m|0,_|0,6,0)|0,Q()|0,Fe=ra(Fe,8)|0,!Fe){dt=48;break}do if(Ze){for(oe=0,d=0,$=0,ue=0;;){if(O=Ot+(oe<<3)|0,b=O,y=h[b>>2]|0,b=h[b+4>>2]|0,(y|0)==0&(b|0)==0)me=$;else{G=et(y|0,b|0,56)|0,Q()|0,G=G&7,E=G+1|0,q=b&-117440513,me=et(y|0,b|0,45)|0,Q()|0;t:do if(ar(me&127)|0){if(W=et(y|0,b|0,52)|0,Q()|0,W=W&15,W|0)for(M=1;;){if(me=ht(7,0,(15-M|0)*3|0)|0,!((y&me|0)==0&(q&(Q()|0)|0)==0))break t;if(M>>>0<W>>>0)M=M+1|0;else break}b=ht(E|0,0,56)|0,y=b|y,b=Q()|0|q,E=O,h[E>>2]=y,h[E+4>>2]=b,E=G+2|0}while(!1);(E|0)==7?(me=Fe+(d<<3)|0,h[me>>2]=y,h[me+4>>2]=b&-117440513,d=pt(d|0,$|0,1,0)|0,me=Q()|0):me=$}if(oe=pt(oe|0,ue|0,1,0)|0,ue=Q()|0,(ue|0)<(_|0)|(ue|0)==(_|0)&oe>>>0<m>>>0)$=me;else break}if(Ze){if(_e=At>>>0>15,re=ht(At|0,0,52)|0,be=Q()|0,!Ee){for(y=0,M=0,E=0,b=0;(I|0)==0&(g|0)==0||(At=A+(y<<3)|0,h[At>>2]=I,h[At+4>>2]=g,y=pt(y|0,M|0,1,0)|0,M=Q()|0),E=pt(E|0,b|0,1,0)|0,b=Q()|0,!!((b|0)<(_|0)|(b|0)==(_|0)&E>>>0<m>>>0);)g=at+(E<<3)|0,I=h[g>>2]|0,g=h[g+4>>2]|0;g=me;break}for(y=0,M=0,b=0,E=0;;){do if(!((I|0)==0&(g|0)==0)){if(W=et(I|0,g|0,52)|0,Q()|0,W=W&15,_e|(W|0)<(At|0)){dt=80;break e}if((W|0)!=(At|0)){if(O=I|re,G=g&-15728641|be,W>>>0>=ye>>>0){q=At;do Ee=ht(7,0,(14-q|0)*3|0)|0,q=q+1|0,O=Ee|O,G=Q()|0|G;while(q>>>0<W>>>0)}}else O=I,G=g;$=Yh(O|0,G|0,m|0,_|0)|0,q=0,W=0,ue=Q()|0;do{if((q|0)>(_|0)|(q|0)==(_|0)&W>>>0>m>>>0){dt=81;break e}if(Ee=Ot+($<<3)|0,oe=h[Ee+4>>2]|0,(oe&-117440513|0)==(G|0)&&(h[Ee>>2]|0)==(O|0)){dt=65;break}Ee=pt($|0,ue|0,1,0)|0,$=ud(Ee|0,Q()|0,m|0,_|0)|0,ue=Q()|0,W=pt(W|0,q|0,1,0)|0,q=Q()|0,Ee=Ot+($<<3)|0}while(!((h[Ee>>2]|0)==(O|0)&&(h[Ee+4>>2]|0)==(G|0)));if((dt|0)==65&&(dt=0,!0&(oe&117440512|0)==100663296))break;Ee=A+(y<<3)|0,h[Ee>>2]=I,h[Ee+4>>2]=g,y=pt(y|0,M|0,1,0)|0,M=Q()|0}while(!1);if(b=pt(b|0,E|0,1,0)|0,E=Q()|0,!((E|0)<(_|0)|(E|0)==(_|0)&b>>>0<m>>>0))break;g=at+(b<<3)|0,I=h[g>>2]|0,g=h[g+4>>2]|0}g=me}else y=0,g=me}else y=0,d=0,g=0;while(!1);if(hd(Ot|0,0,We|0)|0,bc(at|0,Fe|0,d<<3|0)|0,_t(Fe),(d|0)==0&(g|0)==0){dt=89;break}else A=A+(y<<3)|0,_=g,m=d}if((dt|0)==16)!0&(g&117440512|0)==0?(g=4,dt=27):dt=21;else if((dt|0)==31)li(27634,27225,620,27235);else{if((dt|0)==41)return _t(at),_t(Ot),dt=10,dt|0;if((dt|0)==48)return _t(at),_t(Ot),dt=13,dt|0;(dt|0)==80?li(27634,27225,711,27235):(dt|0)==81?li(27634,27225,723,27235):(dt|0)==85&&(bc(A|0,at|0,m<<3|0)|0,dt=89)}return(dt|0)==21?(_t(at),_t(Ot),dt=5,dt|0):(dt|0)==27?(_t(at),_t(Ot),dt=g,dt|0):(dt|0)==89?(_t(at),_t(Ot),dt=0,dt|0):0}function Zre(d,A,m,_,g,y,b){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0;var E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0;if(oe=Y,Y=Y+16|0,$=oe,!((m|0)>0|(m|0)==0&A>>>0>0))return $=0,Y=oe,$|0;if((b|0)>=16)return $=12,Y=oe,$|0;q=0,W=0,G=0,E=0;e:for(;;){if(I=d+(q<<3)|0,M=h[I>>2]|0,I=h[I+4>>2]|0,O=et(M|0,I|0,52)|0,Q()|0,(O&15|0)>(b|0)){E=12,M=11;break}if(P4($,M,I,b),O=$,I=h[O>>2]|0,O=h[O+4>>2]|0,(I|0)==0&(O|0)==0)M=G;else{M=G;do{if(!((E|0)<(y|0)|(E|0)==(y|0)&M>>>0<g>>>0)){M=10;break e}G=_+(M<<3)|0,h[G>>2]=I,h[G+4>>2]=O,M=pt(M|0,E|0,1,0)|0,E=Q()|0,I4($),G=$,I=h[G>>2]|0,O=h[G+4>>2]|0}while(!((I|0)==0&(O|0)==0))}if(q=pt(q|0,W|0,1,0)|0,W=Q()|0,(W|0)<(m|0)|(W|0)==(m|0)&q>>>0<A>>>0)G=M;else{E=0,M=11;break}}return(M|0)==10?($=14,Y=oe,$|0):(M|0)==11?(Y=oe,E|0):0}function Kre(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;q=Y,Y=Y+16|0,G=q;e:do if((m|0)>0|(m|0)==0&A>>>0>0){for(I=0,b=0,y=0,O=0;;){if(M=d+(I<<3)|0,E=h[M>>2]|0,M=h[M+4>>2]|0,!((E|0)==0&(M|0)==0)&&(M=(ax(E,M,_,G)|0)==0,E=G,b=pt(h[E>>2]|0,h[E+4>>2]|0,b|0,y|0)|0,y=Q()|0,!M)){y=12;break}if(I=pt(I|0,O|0,1,0)|0,O=Q()|0,!((O|0)<(m|0)|(O|0)==(m|0)&I>>>0<A>>>0))break e}return Y=q,y|0}else b=0,y=0;while(!1);return h[g>>2]=b,h[g+4>>2]=y,g=0,Y=q,g|0}function Qre(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,52)|0,Q()|0,A&1|0}function Oa(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;if(g=et(d|0,A|0,52)|0,Q()|0,g=g&15,!g)return g=0,g|0;for(_=1;;){if(m=et(d|0,A|0,(15-_|0)*3|0)|0,Q()|0,m=m&7,m|0){_=5;break}if(_>>>0<g>>>0)_=_+1|0;else{m=0,_=5;break}}return(_|0)==5?m|0:0}function T4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(O=et(d|0,A|0,52)|0,Q()|0,O=O&15,!O)return I=A,O=d,Dn(I|0),O|0;for(I=1,m=0;;){switch(_=(15-I|0)*3|0,E=ht(7,0,_|0)|0,M=Q()|0,y=d&~E,b=A&~M,d=et(d|0,A|0,_|0)|0,Q()|0,d&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=d&7}_=ht(d|0,0,_|0)|0,g=Q()|0,d=_|y,A=g|b;e:do if(!m)if((_&E|0)==0&(g&M|0)==0)m=0;else if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,!b)m=1;else{m=1;t:for(;;){switch(M=et(d|0,A|0,(15-m|0)*3|0)|0,Q()|0,M&7){case 1:break t;case 0:break;default:{m=1;break e}}if(m>>>0<b>>>0)m=m+1|0;else{m=1;break e}}for(y=1;;){switch(g=(15-y|0)*3|0,m=et(d|0,A|0,g|0)|0,Q()|0,_=ht(7,0,g|0)|0,_=d&~_,A=A&~(Q()|0),m&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=m&7}if(d=ht(d|0,0,g|0)|0,d=d|_,A=Q()|0|A,y>>>0<b>>>0)y=y+1|0;else{m=1;break e}}}while(!1);if(I>>>0<O>>>0)I=I+1|0;else break}return Dn(A|0),d|0}function I0(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0;if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,!b)return y=A,b=d,Dn(y|0),b|0;for(y=1;;){switch(g=(15-y|0)*3|0,m=et(d|0,A|0,g|0)|0,Q()|0,_=ht(7,0,g|0)|0,_=d&~_,A=A&~(Q()|0),m&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=m&7}if(d=ht(d|0,0,g|0)|0,d=d|_,A=Q()|0|A,y>>>0<b>>>0)y=y+1|0;else break}return Dn(A|0),d|0}function Jre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(O=et(d|0,A|0,52)|0,Q()|0,O=O&15,!O)return I=A,O=d,Dn(I|0),O|0;for(I=1,m=0;;){switch(_=(15-I|0)*3|0,E=ht(7,0,_|0)|0,M=Q()|0,y=d&~E,b=A&~M,d=et(d|0,A|0,_|0)|0,Q()|0,d&7){case 1:{d=3;break}case 3:{d=2;break}case 2:{d=6;break}case 6:{d=4;break}case 4:{d=5;break}case 5:{d=1;break}default:d=d&7}_=ht(d|0,0,_|0)|0,g=Q()|0,d=_|y,A=g|b;e:do if(!m)if((_&E|0)==0&(g&M|0)==0)m=0;else if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,!b)m=1;else{m=1;t:for(;;){switch(M=et(d|0,A|0,(15-m|0)*3|0)|0,Q()|0,M&7){case 1:break t;case 0:break;default:{m=1;break e}}if(m>>>0<b>>>0)m=m+1|0;else{m=1;break e}}for(y=1;;){switch(m=(15-y|0)*3|0,_=ht(7,0,m|0)|0,_=d&~_,g=A&~(Q()|0),d=et(d|0,A|0,m|0)|0,Q()|0,d&7){case 1:{d=3;break}case 3:{d=2;break}case 2:{d=6;break}case 6:{d=4;break}case 4:{d=5;break}case 5:{d=1;break}default:d=d&7}if(d=ht(d|0,0,m|0)|0,d=d|_,A=Q()|0|g,y>>>0<b>>>0)y=y+1|0;else{m=1;break e}}}while(!1);if(I>>>0<O>>>0)I=I+1|0;else break}return Dn(A|0),d|0}function E4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0;if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,!b)return y=A,b=d,Dn(y|0),b|0;for(y=1;;){switch(_=(15-y|0)*3|0,m=ht(7,0,_|0)|0,m=d&~m,g=A&~(Q()|0),d=et(d|0,A|0,_|0)|0,Q()|0,d&7){case 1:{d=3;break}case 3:{d=2;break}case 2:{d=6;break}case 6:{d=4;break}case 4:{d=5;break}case 5:{d=1;break}default:d=d&7}if(d=ht(d|0,0,_|0)|0,d=d|m,A=Q()|0|g,y>>>0<b>>>0)y=y+1|0;else break}return Dn(A|0),d|0}function ese(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0;if(me=Y,Y=Y+16|0,be=me,ht(A|0,0,52)|0,m=Q()|0|134225919,!A)return(h[d+4>>2]|0)>2||(h[d+8>>2]|0)>2||(h[d+12>>2]|0)>2?(re=0,be=0,Dn(re|0),Y=me,be|0):(ht(p9(d)|0,0,45)|0,re=Q()|0|m,be=-1,Dn(re|0),Y=me,be|0);h[be>>2]=h[d>>2],h[be+4>>2]=h[d+4>>2],h[be+8>>2]=h[d+8>>2],h[be+12>>2]=h[d+12>>2],re=be+4|0;e:do if((A|0)>0)for(oe=be+8|0,ue=be+12|0,$=A,G=h[oe>>2]|0,q=h[ue>>2]|0,A=-1,O=h[be+4>>2]|0;;){W=$,$=$+-1|0,d=O-q|0,_=G-q|0,W&1?(y=Au(+((d*3|0)-_|0)*.14285714285714285)|0,h[re>>2]=y,d=Au(+((_<<1)+d|0)*.14285714285714285)|0,h[oe>>2]=d,h[ue>>2]=0,_=d-y|0,g=0-y|0,(y|0)<0?(h[oe>>2]=_,h[ue>>2]=g,h[re>>2]=0,d=_,b=0):(b=y,g=0),y=b-d|0,_=g-d|0,(d|0)<0?(h[re>>2]=y,h[ue>>2]=_,h[oe>>2]=0,b=y,y=0):(_=g,y=d),d=b-_|0,g=y-_|0,(_|0)<0?(h[re>>2]=d,h[oe>>2]=g,h[ue>>2]=0,y=0):(g=y,d=b,y=_),_=(g|0)<(d|0)?g:d,_=(y|0)<(_|0)?y:_,(_|0)>0&&(y=y-_|0,g=g-_|0,d=d-_|0,h[re>>2]=d,h[oe>>2]=g,h[ue>>2]=y),Ze=g+(d*3|0)|0,Fe=(Ze|0)<0,I=y+(g*3|0)-(Fe?Ze:0)|0,M=(I|0)<0,_=(y*3|0)+d-(Fe?Ze:0)-(M?I:0)|0,E=(_|0)<0,Ee=E?0:_,b=(M?0:I)-(E?_:0)|0,_=(Fe?0:Ze)-(M?I:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Ee|0)<(E|0)?Ee:E,I=(E|0)>0,M=I?E:0,b=b-(I?E:0)|0,E=Ee-(I?E:0)|0,I=y):(E=Au(+((d<<1)+_|0)*.14285714285714285)|0,h[re>>2]=E,g=Au(+((_*3|0)-d|0)*.14285714285714285)|0,h[oe>>2]=g,h[ue>>2]=0,_=g-E|0,d=0-E|0,(E|0)<0?(h[oe>>2]=_,h[ue>>2]=d,h[re>>2]=0,g=_,E=0):d=0,b=E-g|0,_=d-g|0,(g|0)<0?(h[re>>2]=b,h[ue>>2]=_,h[oe>>2]=0,y=_,g=0):(y=d,b=E),d=b-y|0,_=g-y|0,(y|0)<0?(h[re>>2]=d,h[oe>>2]=_,h[ue>>2]=0,g=_,y=0):d=b,_=(g|0)<(d|0)?g:d,_=(y|0)<(_|0)?y:_,(_|0)>0&&(y=y-_|0,g=g-_|0,d=d-_|0,h[re>>2]=d,h[oe>>2]=g,h[ue>>2]=y),Ze=y+(d*3|0)|0,Ee=(Ze|0)<0,I=(g*3|0)+d-(Ee?Ze:0)|0,M=(I|0)<0,_=(y*3|0)+g-(Ee?Ze:0)-(M?I:0)|0,E=(_|0)<0,Fe=E?0:_,b=(M?0:I)-(E?_:0)|0,_=(Ee?0:Ze)-(M?I:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Fe|0)<(E|0)?Fe:E,I=(E|0)>0,M=I?E:0,b=b-(I?E:0)|0,E=Fe-(I?E:0)|0,I=y),_=O+(M-_)|0,y=(_|0)<0,M=G-b-(y?_:0)|0,b=(M|0)<0,q=q-E+(y?0-_|0:0)+(b?0-M|0:0)|0,O=(q|0)<0,E=O?0:q,Ee=(b?0:M)-(O?q:0)|0,q=(y?0:_)-(b?M:0)-(O?q:0)|0,O=(Ee|0)<(q|0)?Ee:q,O=(E|0)<(O|0)?E:O,M=(O|0)>0,q=q-(M?O:0)|0,b=(15-W|0)*3|0,_=ht(7,0,b|0)|0,_=A&~_,y=m&~(Q()|0),G=(q|0)<0,Ze=G?q:0,Ee=Ee-(M?O:0)-Ze|0,Fe=(Ee|0)<0,Ze=(Fe?0-Ee|0:0)+(E-(M?O:0)-Ze)|0,m=(Ze|0)<0,A=m?0:Ze,Ze=m?Ze:0,m=(Fe?0:Ee)-Ze|0,Ze=(G?0:q)-(Fe?Ee:0)-Ze|0,Ee=(m|0)<(Ze|0)?m:Ze,Ee=(A|0)<(Ee|0)?A:Ee,Ee=(Ee|0)>0?Ee:0,A=A-Ee|0,m=m-Ee|0;t:do switch(Ze-Ee|0){case 0:switch(m|0){case 0:{A=(A|0)==0?0:(A|0)==1?1:7;break t}case 1:{A=(A|0)==0?2:(A|0)==1?3:7;break t}default:{_e=36;break t}}case 1:switch(m|0){case 0:{A=(A|0)==0?4:(A|0)==1?5:7;break t}case 1:if(A){_e=36;break t}else{A=6;break t}default:{_e=36;break t}}default:_e=36}while(!1);if((_e|0)==36&&(_e=0,A=7),A=ht(A|0,0,b|0)|0,A=A|_,m=Q()|0|y,(W|0)<=1)break e;G=g,q=I,O=d}else A=-1,d=h[re>>2]|0;while(!1);e:do if((d|0)<=2&&(h[be+8>>2]|0)<=2&&(h[be+12>>2]|0)<=2){if(_=p9(be)|0,d=ht(_|0,0,45)|0,A=d|A,d=Q()|0|m&-1040385,M=bre(be)|0,!(ar(_)|0)){if((M|0)<=0)break;for(E=0;;){b=et(A|0,d|0,52)|0,Q()|0,b=b&15;t:do if(b)for(y=1;;){switch(g=(15-y|0)*3|0,m=et(A|0,d|0,g|0)|0,Q()|0,_=ht(7,0,g|0)|0,A=A&~_,_=d&~(Q()|0),m&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=m&7}if(d=ht(d|0,0,g|0)|0,A=d|A,d=Q()|0|_,y>>>0<b>>>0)y=y+1|0;else break t}while(!1);if(E=E+1|0,(E|0)==(M|0))break e}}b=et(A|0,d|0,52)|0,Q()|0,b=b&15;t:do if(b){m=1;n:for(;;){switch(Ee=et(A|0,d|0,(15-m|0)*3|0)|0,Q()|0,Ee&7){case 1:break n;case 0:break;default:break t}if(m>>>0<b>>>0)m=m+1|0;else break t}if(A9(_,h[be>>2]|0)|0)for(y=1;;){switch(m=(15-y|0)*3|0,_=ht(7,0,m|0)|0,_=A&~_,g=d&~(Q()|0),d=et(A|0,d|0,m|0)|0,Q()|0,d&7){case 1:{d=3;break}case 3:{d=2;break}case 2:{d=6;break}case 6:{d=4;break}case 4:{d=5;break}case 5:{d=1;break}default:d=d&7}if(A=ht(d|0,0,m|0)|0,A=A|_,d=Q()|0|g,y>>>0<b>>>0)y=y+1|0;else break t}else for(y=1;;){switch(g=(15-y|0)*3|0,m=et(A|0,d|0,g|0)|0,Q()|0,_=ht(7,0,g|0)|0,A=A&~_,_=d&~(Q()|0),m&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=m&7}if(d=ht(d|0,0,g|0)|0,A=d|A,d=Q()|0|_,y>>>0<b>>>0)y=y+1|0;else break t}}while(!1);if((M|0)>0){m=0;do A=T4(A,d)|0,d=Q()|0,m=m+1|0;while((m|0)!=(M|0))}}else A=0,d=0;while(!1);return Ze=d,Ee=A,Dn(Ze|0),Y=me,Ee|0}function zl(d){return d=d|0,(d|0)%2|0|0}function M4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;if(O=Y,Y=Y+64|0,E=O+24|0,M=O+48|0,I=O,A>>>0>15)return I=4,Y=O,I|0;if(y=+ne[d>>3],ne[$i>>3]=y,(h[$i+4>>2]&2146435072|0)==2146435072||(_=+ne[d+8>>3],ne[$i>>3]=_,(h[$i+4>>2]&2146435072|0)==2146435072))return I=3,Y=O,I|0;g=+Qn(+y),G=g*+Qn(+_),g=g*+Ni(+_),_=+Ni(+y),ne[I>>3]=G,ne[I+8>>3]=g,ne[I+16>>3]=_,ne[$i>>3]=G;do if((h[$i+4>>2]&2146435072|0)!=2146435072&&(ne[$i>>3]=_,d=h[$i+4>>2]|0,ne[$i>>3]=g,!((h[$i+4>>2]&2146435072|0)==2146435072|!0&(d&2146435072|0)==2146435072)))if(h[E>>2]=h[I>>2],h[E+4>>2]=h[I+4>>2],h[E+8>>2]=h[I+8>>2],h[E+12>>2]=h[I+12>>2],h[E+16>>2]=h[I+16>>2],h[E+20>>2]=h[I+20>>2],Vre(E,A,M),M=ese(M,A)|0,I=Q()|0,h[m>>2]=M,h[m+4>>2]=I,(M|0)==0&(I|0)==0)li(27634,27225,1073,27248);else{b=0;break}else b=2;while(!1);return I=b,Y=O,I|0}function C4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if(W=m+4|0,$=et(d|0,A|0,52)|0,Q()|0,$=$&15,q=et(d|0,A|0,45)|0,Q()|0,_=($|0)==0,ar(q&127)|0){if(_)return $=1,$|0;_=1}else{if(_)return $=0,$|0;(h[W>>2]|0)==0&&(h[m+8>>2]|0)==0?_=(h[m+12>>2]|0)!=0&1:_=1}for(q=m+8|0,G=m+12|0,O=1,m=h[W>>2]|0,b=h[q>>2]|0,y=h[G>>2]|0;g=m*3|0,E=b*3|0,I=y*3|0,O&1?(M=b+g|0,h[W>>2]=M,y=y+E|0,h[q>>2]=y,g=I+m|0,h[G>>2]=g,m=y-M|0,b=g-M|0,(M|0)<0?(h[q>>2]=m,h[G>>2]=b,h[W>>2]=0,E=0,g=b):(m=y,E=M),b=E-m|0,y=g-m|0,(m|0)<0?(h[W>>2]=b,h[G>>2]=y,h[q>>2]=0,E=b,g=0):(y=g,g=m),m=E-y|0,b=g-y|0,(y|0)<0?(h[W>>2]=m,h[q>>2]=b,h[G>>2]=0,y=0):(b=g,m=E),g=(b|0)<(m|0)?b:m,g=(y|0)<(g|0)?y:g,(g|0)>0&&(y=y-g|0,b=b-g|0,m=m-g|0,h[W>>2]=m,h[q>>2]=b,h[G>>2]=y)):(M=E+m|0,E=y+g|0,h[W>>2]=E,h[q>>2]=M,g=I+b|0,h[G>>2]=g,m=M-E|0,y=g-E|0,(E|0)<0?(h[q>>2]=m,h[G>>2]=y,h[W>>2]=0,E=0,g=y):m=M,b=E-m|0,y=g-m|0,(m|0)<0?(h[W>>2]=b,h[G>>2]=y,h[q>>2]=0,E=b,g=0):(y=g,g=m),m=E-y|0,b=g-y|0,(y|0)<0?(h[W>>2]=m,h[q>>2]=b,h[G>>2]=0,y=0):(b=g,m=E),g=(b|0)<(m|0)?b:m,g=(y|0)<(g|0)?y:g,(g|0)>0&&(y=y-g|0,b=b-g|0,m=m-g|0,h[W>>2]=m,h[q>>2]=b,h[G>>2]=y)),g=et(d|0,A|0,(15-O|0)*3|0)|0,Q()|0,g=g&7,(g+-1|0)>>>0<6&&(M=h[22032+(g*12|0)+4>>2]|0,I=h[22032+(g*12|0)+8>>2]|0,E=(h[22032+(g*12|0)>>2]|0)+m|0,h[W>>2]=E,b=M+b|0,h[q>>2]=b,m=I+y|0,h[G>>2]=m,y=b-E|0,g=m-E|0,(E|0)<0&&(h[q>>2]=y,h[G>>2]=g,h[W>>2]=0,E=0,m=g,b=y),g=E-b|0,y=m-b|0,(b|0)<0?(h[W>>2]=g,h[G>>2]=y,h[q>>2]=0,E=g,b=0):y=m,m=E-y|0,g=b-y|0,(y|0)<0?(h[W>>2]=m,h[q>>2]=g,h[G>>2]=0,b=g,y=0):m=E,g=(b|0)<(m|0)?b:m,g=(y|0)<(g|0)?y:g,(g|0)>0&&(y=y-g|0,b=b-g|0,m=m-g|0,h[W>>2]=m,h[q>>2]=b,h[G>>2]=y)),O>>>0<$>>>0;)O=O+1|0;return _|0}function ng(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if($=Y,Y=Y+16|0,G=$,q=et(d|0,A|0,45)|0,Q()|0,q=q&127,q>>>0>121)return h[m>>2]=0,h[m+4>>2]=0,h[m+8>>2]=0,h[m+12>>2]=0,W=5,Y=$,W|0;e:do if((ar(q)|0)!=0&&(E=et(d|0,A|0,52)|0,Q()|0,E=E&15,(E|0)!=0)){_=1;t:for(;;){switch(W=et(d|0,A|0,(15-_|0)*3|0)|0,Q()|0,W&7){case 5:break t;case 0:break;default:{I=A;break e}}if(_>>>0<E>>>0)_=_+1|0;else{I=A;break e}}for(b=1,_=A;;){switch(A=(15-b|0)*3|0,g=ht(7,0,A|0)|0,g=d&~g,y=_&~(Q()|0),_=et(d|0,_|0,A|0)|0,Q()|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(d=ht(_|0,0,A|0)|0,d=d|g,_=Q()|0|y,b>>>0<E>>>0)b=b+1|0;else{I=_;break e}}}else I=A;while(!1);if(W=7696+(q*28|0)|0,h[m>>2]=h[W>>2],h[m+4>>2]=h[W+4>>2],h[m+8>>2]=h[W+8>>2],h[m+12>>2]=h[W+12>>2],!(C4(d,I,m)|0))return W=0,Y=$,W|0;if(W=m+4|0,h[G>>2]=h[W>>2],h[G+4>>2]=h[W+4>>2],h[G+8>>2]=h[W+8>>2],M=et(d|0,I|0,52)|0,Q()|0,O=M&15,M&1?(y=h[W>>2]|0,E=m+8|0,g=h[E>>2]|0,M=m+12|0,A=h[M>>2]|0,_=(g*3|0)+y|0,y=A+(y*3|0)|0,h[W>>2]=y,h[E>>2]=_,g=(A*3|0)+g|0,h[M>>2]=g,A=_-y|0,b=g-y|0,(y|0)<0&&(h[E>>2]=A,h[M>>2]=b,h[W>>2]=0,_=A,y=0,g=b),b=y-_|0,A=g-_|0,(_|0)<0?(h[W>>2]=b,h[M>>2]=A,h[E>>2]=0,_=0):(A=g,b=y),y=b-A|0,g=_-A|0,(A|0)<0?(h[W>>2]=y,h[E>>2]=g,h[M>>2]=0,A=0):(g=_,y=b),_=(g|0)<(y|0)?g:y,_=(A|0)<(_|0)?A:_,(_|0)>0&&(h[W>>2]=y-_,h[E>>2]=g-_,h[M>>2]=A-_),g=O+1|0):g=O,!(ar(q)|0))_=0;else{e:do if(!O)_=0;else for(A=1;;){if(_=et(d|0,I|0,(15-A|0)*3|0)|0,Q()|0,_=_&7,_|0)break e;if(A>>>0<O>>>0)A=A+1|0;else{_=0;break}}while(!1);_=(_|0)==4&1}if(!(tg(m,g,_,0)|0))(g|0)!=(O|0)&&(h[W>>2]=h[G>>2],h[W+4>>2]=h[G+4>>2],h[W+8>>2]=h[G+8>>2]);else{if(ar(q)|0)do;while((tg(m,g,0,0)|0)!=0);(g|0)!=(O|0)&&(E=m+12|0,d=h[E>>2]|0,_=(h[W>>2]|0)-d|0,b=m+8|0,d=(h[b>>2]|0)-d|0,A=Au(+((_<<1)+d|0)*.14285714285714285)|0,h[W>>2]=A,_=Au(+((d*3|0)-_|0)*.14285714285714285)|0,h[b>>2]=_,h[E>>2]=0,d=_-A|0,g=0-A|0,(A|0)<0?(h[b>>2]=d,h[E>>2]=g,h[W>>2]=0,_=d,A=0):g=0,y=A-_|0,d=g-_|0,(_|0)<0?(h[W>>2]=y,h[E>>2]=d,h[b>>2]=0,A=y,_=0):d=g,y=A-d|0,g=_-d|0,(d|0)<0?(h[W>>2]=y,h[b>>2]=g,h[E>>2]=0,A=y,d=0):g=_,_=(g|0)<(A|0)?g:A,_=(d|0)<(_|0)?d:_,(_|0)>0&&(h[W>>2]=A-_,h[b>>2]=g-_,h[E>>2]=d-_))}return W=0,Y=$,W|0}function ig(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0;return b=Y,Y=Y+48|0,_=b+24|0,g=b,y=ng(d,A,_)|0,y?(Y=b,y|0):(y=et(d|0,A|0,52)|0,Q()|0,qre(_,y&15,g),M=+rx(+ +ne[g+16>>3]),E=+ia(+ +ne[g+8>>3],+ +ne[g>>3]),ne[m>>3]=M,ne[m+8>>3]=E,y=0,Y=b,y|0)}function N0(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0;if(b=Y,Y=Y+16|0,y=b,_=ng(d,A,y)|0,_|0)return y=_,Y=b,y|0;_=et(d|0,A|0,45)|0,Q()|0,_=(ar(_&127)|0)==0,g=et(d|0,A|0,52)|0,Q()|0,g=g&15;e:do if(!_){if(g|0)for(_=1;;){if(E=ht(7,0,(15-_|0)*3|0)|0,!((E&d|0)==0&((Q()|0)&A|0)==0))break e;if(_>>>0<g>>>0)_=_+1|0;else break}return y4(y,g,0,5,m),E=0,Y=b,E|0}while(!1);return v4(y,g,0,6,m),E=0,Y=b,E|0}function tse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if(g=et(d|0,A|0,45)|0,Q()|0,!(ar(g&127)|0))return g=2,h[m>>2]=g,0;if(g=et(d|0,A|0,52)|0,Q()|0,g=g&15,!g)return g=5,h[m>>2]=g,0;for(_=1;;){if(y=ht(7,0,(15-_|0)*3|0)|0,!((y&d|0)==0&((Q()|0)&A|0)==0)){_=2,d=6;break}if(_>>>0<g>>>0)_=_+1|0;else{_=5,d=6;break}}return(d|0)==6&&(h[m>>2]=_),0}function M9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;G=Y,Y=Y+128|0,I=G+112|0,y=G+96|0,O=G,g=et(d|0,A|0,52)|0,Q()|0,E=g&15,h[I>>2]=E,b=et(d|0,A|0,45)|0,Q()|0,b=b&127;e:do if(ar(b)|0){if(E|0)for(_=1;;){if(M=ht(7,0,(15-_|0)*3|0)|0,!((M&d|0)==0&((Q()|0)&A|0)==0)){g=0;break e}if(_>>>0<E>>>0)_=_+1|0;else break}if(g&1)g=1;else return M=ht(E+1|0,0,52)|0,O=Q()|0|A&-15728641,I=ht(7,0,(14-E|0)*3|0)|0,O=M9((M|d)&~I,O&~(Q()|0),m)|0,Y=G,O|0}else g=0;while(!1);if(_=ng(d,A,y)|0,!_){g?(b9(y,I,O),M=5):(w9(y,I,O),M=6);e:do if(ar(b)|0)if(!E)d=5;else for(_=1;;){if(b=ht(7,0,(15-_|0)*3|0)|0,!((b&d|0)==0&((Q()|0)&A|0)==0)){d=2;break e}if(_>>>0<E>>>0)_=_+1|0;else{d=5;break}}else d=2;while(!1);hd(m|0,-1,d<<2|0)|0;e:do if(g)for(y=0;;){if(b=O+(y<<4)|0,Hre(b,h[I>>2]|0)|0,b=h[b>>2]|0,E=h[m>>2]|0,(E|0)==-1|(E|0)==(b|0))_=m;else{g=0;do{if(g=g+1|0,g>>>0>=d>>>0){_=1;break e}_=m+(g<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,y=y+1|0,y>>>0>=M>>>0){_=0;break}}else for(y=0;;){if(b=O+(y<<4)|0,tg(b,h[I>>2]|0,0,1)|0,b=h[b>>2]|0,E=h[m>>2]|0,(E|0)==-1|(E|0)==(b|0))_=m;else{g=0;do{if(g=g+1|0,g>>>0>=d>>>0){_=1;break e}_=m+(g<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,y=y+1|0,y>>>0>=M>>>0){_=0;break}}while(!1)}return O=_,Y=G,O|0}function nse(){return 12}function R4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0;if(d>>>0>15)return E=4,E|0;if(ht(d|0,0,52)|0,E=Q()|0|134225919,!d){m=0,_=0;do ar(_)|0&&(ht(_|0,0,45)|0,b=E|(Q()|0),d=A+(m<<3)|0,h[d>>2]=-1,h[d+4>>2]=b,m=m+1|0),_=_+1|0;while((_|0)!=122);return m=0,m|0}m=0,b=0;do{if(ar(b)|0){for(ht(b|0,0,45)|0,_=1,g=-1,y=E|(Q()|0);M=ht(7,0,(15-_|0)*3|0)|0,g=g&~M,y=y&~(Q()|0),(_|0)!=(d|0);)_=_+1|0;M=A+(m<<3)|0,h[M>>2]=g,h[M+4>>2]=y,m=m+1|0}b=b+1|0}while((b|0)!=122);return m=0,m|0}function ise(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0;if(re=Y,Y=Y+16|0,ue=re,_e=et(d|0,A|0,52)|0,Q()|0,_e=_e&15,m>>>0>15)return _e=4,Y=re,_e|0;if((_e|0)<(m|0))return _e=12,Y=re,_e|0;if((_e|0)!=(m|0))if(y=ht(m|0,0,52)|0,y=y|d,E=Q()|0|A&-15728641,(_e|0)>(m|0)){M=m;do oe=ht(7,0,(14-M|0)*3|0)|0,M=M+1|0,y=oe|y,E=Q()|0|E;while((M|0)<(_e|0));oe=y}else oe=y;else oe=d,E=A;$=et(oe|0,E|0,45)|0,Q()|0;e:do if(ar($&127)|0){if(M=et(oe|0,E|0,52)|0,Q()|0,M=M&15,M|0)for(y=1;;){if($=ht(7,0,(15-y|0)*3|0)|0,!(($&oe|0)==0&((Q()|0)&E|0)==0)){I=33;break e}if(y>>>0<M>>>0)y=y+1|0;else break}if($=_,h[$>>2]=0,h[$+4>>2]=0,(_e|0)>(m|0)){for($=A&-15728641,W=_e;;){if(q=W,W=W+-1|0,W>>>0>15|(_e|0)<(W|0)){I=19;break}if((_e|0)!=(W|0))if(y=ht(W|0,0,52)|0,y=y|d,M=Q()|0|$,(_e|0)<(q|0))G=y;else{I=W;do G=ht(7,0,(14-I|0)*3|0)|0,I=I+1|0,y=G|y,M=Q()|0|M;while((I|0)<(_e|0));G=y}else G=d,M=A;if(O=et(G|0,M|0,45)|0,Q()|0,!(ar(O&127)|0))y=0;else{O=et(G|0,M|0,52)|0,Q()|0,O=O&15;t:do if(!O)y=0;else for(I=1;;){if(y=et(G|0,M|0,(15-I|0)*3|0)|0,Q()|0,y=y&7,y|0)break t;if(I>>>0<O>>>0)I=I+1|0;else{y=0;break}}while(!1);y=(y|0)==0&1}if(M=et(d|0,A|0,(15-q|0)*3|0)|0,Q()|0,M=M&7,(M|0)==7){g=5,I=42;break}if(y=(y|0)!=0,(M|0)==1&y){g=5,I=42;break}if(G=M+(((M|0)!=0&y)<<31>>31)|0,G|0&&(I=_e-q|0,I=ld(7,0,I,((I|0)<0)<<31>>31)|0,O=Q()|0,y?(y=cr(I|0,O|0,5,0)|0,y=pt(y|0,Q()|0,-5,-1)|0,y=cd(y|0,Q()|0,6,0)|0,y=pt(y|0,Q()|0,1,0)|0,M=Q()|0):(y=I,M=O),q=G+-1|0,q=cr(I|0,O|0,q|0,((q|0)<0)<<31>>31|0)|0,q=pt(y|0,M|0,q|0,Q()|0)|0,G=Q()|0,O=_,O=pt(q|0,G|0,h[O>>2]|0,h[O+4>>2]|0)|0,G=Q()|0,q=_,h[q>>2]=O,h[q+4>>2]=G),(W|0)<=(m|0)){I=37;break}}if((I|0)==19)li(27634,27225,1407,27259);else if((I|0)==37){b=_,g=h[b+4>>2]|0,b=h[b>>2]|0;break}else if((I|0)==42)return Y=re,g|0}else g=0,b=0}else I=33;while(!1);e:do if((I|0)==33)if($=_,h[$>>2]=0,h[$+4>>2]=0,(_e|0)>(m|0)){for(y=_e;;){if(g=et(d|0,A|0,(15-y|0)*3|0)|0,Q()|0,g=g&7,(g|0)==7){g=5;break}if(b=_e-y|0,b=ld(7,0,b,((b|0)<0)<<31>>31)|0,g=cr(b|0,Q()|0,g|0,0)|0,b=Q()|0,$=_,b=pt(h[$>>2]|0,h[$+4>>2]|0,g|0,b|0)|0,g=Q()|0,$=_,h[$>>2]=b,h[$+4>>2]=g,y=y+-1|0,(y|0)<=(m|0))break e}return Y=re,g|0}else g=0,b=0;while(!1);return ax(oe,E,_e,ue)|0&&li(27634,27225,1367,27274),_e=ue,ue=h[_e+4>>2]|0,((g|0)>-1|(g|0)==-1&b>>>0>4294967295)&((ue|0)>(g|0)|((ue|0)==(g|0)?(h[_e>>2]|0)>>>0>b>>>0:0))?(_e=0,Y=re,_e|0):(li(27634,27225,1447,27259),0)}function rse(d,A,m,_,g,y){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0;var b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0;if(G=Y,Y=Y+16|0,b=G,g>>>0>15)return y=4,Y=G,y|0;if(E=et(m|0,_|0,52)|0,Q()|0,E=E&15,(E|0)>(g|0))return y=12,Y=G,y|0;if(ax(m,_,g,b)|0&&li(27634,27225,1367,27274),O=b,I=h[O+4>>2]|0,!(((A|0)>-1|(A|0)==-1&d>>>0>4294967295)&((I|0)>(A|0)|((I|0)==(A|0)?(h[O>>2]|0)>>>0>d>>>0:0))))return y=2,Y=G,y|0;O=g-E|0,g=ht(g|0,0,52)|0,M=Q()|0|_&-15728641,I=y,h[I>>2]=g|m,h[I+4>>2]=M,I=et(m|0,_|0,45)|0,Q()|0;e:do if(ar(I&127)|0){if(E|0)for(b=1;;){if(I=ht(7,0,(15-b|0)*3|0)|0,!((I&m|0)==0&((Q()|0)&_|0)==0))break e;if(b>>>0<E>>>0)b=b+1|0;else break}if((O|0)<1)return y=0,Y=G,y|0;for(I=E^15,_=-1,M=1,b=1;;){E=O-M|0,E=ld(7,0,E,((E|0)<0)<<31>>31)|0,m=Q()|0;do if(b)if(b=cr(E|0,m|0,5,0)|0,b=pt(b|0,Q()|0,-5,-1)|0,b=cd(b|0,Q()|0,6,0)|0,g=Q()|0,(A|0)>(g|0)|(A|0)==(g|0)&d>>>0>b>>>0){A=pt(d|0,A|0,-1,-1)|0,A=Ds(A|0,Q()|0,b|0,g|0)|0,b=Q()|0,q=y,$=h[q>>2]|0,q=h[q+4>>2]|0,oe=(I+_|0)*3|0,W=ht(7,0,oe|0)|0,q=q&~(Q()|0),_=cd(A|0,b|0,E|0,m|0)|0,d=Q()|0,g=pt(_|0,d|0,2,0)|0,oe=ht(g|0,Q()|0,oe|0)|0,q=Q()|0|q,g=y,h[g>>2]=oe|$&~W,h[g+4>>2]=q,d=cr(_|0,d|0,E|0,m|0)|0,d=Ds(A|0,b|0,d|0,Q()|0)|0,b=0,A=Q()|0;break}else{oe=y,W=h[oe>>2]|0,oe=h[oe+4>>2]|0,$=ht(7,0,(I+_|0)*3|0)|0,oe=oe&~(Q()|0),b=y,h[b>>2]=W&~$,h[b+4>>2]=oe,b=1;break}else W=y,g=h[W>>2]|0,W=h[W+4>>2]|0,_=(I+_|0)*3|0,q=ht(7,0,_|0)|0,W=W&~(Q()|0),oe=cd(d|0,A|0,E|0,m|0)|0,b=Q()|0,_=ht(oe|0,b|0,_|0)|0,W=Q()|0|W,$=y,h[$>>2]=_|g&~q,h[$+4>>2]=W,b=cr(oe|0,b|0,E|0,m|0)|0,d=Ds(d|0,A|0,b|0,Q()|0)|0,b=0,A=Q()|0;while(!1);if((O|0)>(M|0))_=~M,M=M+1|0;else{A=0;break}}return Y=G,A|0}while(!1);if((O|0)<1)return oe=0,Y=G,oe|0;for(g=E^15,b=1;;)if($=O-b|0,$=ld(7,0,$,(($|0)<0)<<31>>31)|0,oe=Q()|0,M=y,m=h[M>>2]|0,M=h[M+4>>2]|0,E=(g-b|0)*3|0,_=ht(7,0,E|0)|0,M=M&~(Q()|0),q=cd(d|0,A|0,$|0,oe|0)|0,W=Q()|0,E=ht(q|0,W|0,E|0)|0,M=Q()|0|M,I=y,h[I>>2]=E|m&~_,h[I+4>>2]=M,oe=cr(q|0,W|0,$|0,oe|0)|0,d=Ds(d|0,A|0,oe|0,Q()|0)|0,A=Q()|0,(O|0)<=(b|0)){A=0;break}else b=b+1|0;return Y=G,A|0}function P4(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;g=et(A|0,m|0,52)|0,Q()|0,g=g&15,(A|0)==0&(m|0)==0|((_|0)>15|(g|0)>(_|0))?(y=-1,A=-1,m=0,g=0):(A=T9(A,m,g+1|0,_)|0,b=(Q()|0)&-15728641,m=ht(_|0,0,52)|0,m=A|m,b=b|(Q()|0),A=(ki(m,b)|0)==0,y=g,A=A?-1:_,g=b),b=d,h[b>>2]=m,h[b+4>>2]=g,h[d+8>>2]=y,h[d+12>>2]=A}function C9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;if(g=et(d|0,A|0,52)|0,Q()|0,g=g&15,y=_+8|0,h[y>>2]=g,(d|0)==0&(A|0)==0|((m|0)>15|(g|0)>(m|0))){m=_,h[m>>2]=0,h[m+4>>2]=0,h[y>>2]=-1,h[_+12>>2]=-1;return}if(d=T9(d,A,g+1|0,m)|0,y=(Q()|0)&-15728641,g=ht(m|0,0,52)|0,g=d|g,y=y|(Q()|0),d=_,h[d>>2]=g,h[d+4>>2]=y,d=_+12|0,ki(g,y)|0){h[d>>2]=m;return}else{h[d>>2]=-1;return}}function I4(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0;if(m=d,A=h[m>>2]|0,m=h[m+4>>2]|0,!((A|0)==0&(m|0)==0)&&(_=et(A|0,m|0,52)|0,Q()|0,_=_&15,E=ht(1,0,(_^15)*3|0)|0,A=pt(E|0,Q()|0,A|0,m|0)|0,m=Q()|0,E=d,h[E>>2]=A,h[E+4>>2]=m,E=d+8|0,b=h[E>>2]|0,!((_|0)<(b|0)))){for(M=d+12|0,y=_;;){if((y|0)==(b|0)){_=5;break}if(I=(y|0)==(h[M>>2]|0),g=(15-y|0)*3|0,_=et(A|0,m|0,g|0)|0,Q()|0,_=_&7,I&((_|0)==1&!0)){_=7;break}if(!((_|0)==7&!0)){_=10;break}if(I=ht(1,0,g|0)|0,A=pt(A|0,m|0,I|0,Q()|0)|0,m=Q()|0,I=d,h[I>>2]=A,h[I+4>>2]=m,(y|0)>(b|0))y=y+-1|0;else{_=10;break}}if((_|0)==5){I=d,h[I>>2]=0,h[I+4>>2]=0,h[E>>2]=-1,h[M>>2]=-1;return}else if((_|0)==7){b=ht(1,0,g|0)|0,b=pt(A|0,m|0,b|0,Q()|0)|0,E=Q()|0,I=d,h[I>>2]=b,h[I+4>>2]=E,h[M>>2]=y+-1;return}else if((_|0)==10)return}}function lx(d){d=+d;var A=0;return A=d<0?d+6.283185307179586:d,+(d>=6.283185307179586?A+-6.283185307179586:A)}function ll(d,A){switch(d=+d,A=A|0,A|0){case 1:{d=d<0?d+6.283185307179586:d;break}case 2:{d=d>0?d+-6.283185307179586:d;break}default:}return+d}function sse(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return g=+ne[A>>3],_=+ne[d>>3],y=+Ni(+((g-_)*.5)),m=+Ni(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Qn(+g)*+Qn(+_)*m),+(+ia(+ +is(+m),+ +is(+(1-m)))*2)}function cx(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return g=+ne[A>>3],_=+ne[d>>3],y=+Ni(+((g-_)*.5)),m=+Ni(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Qn(+g)*+Qn(+_)*m),+(+ia(+ +is(+m),+ +is(+(1-m)))*2*6371.007180918475)}function ose(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return g=+ne[A>>3],_=+ne[d>>3],y=+Ni(+((g-_)*.5)),m=+Ni(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Qn(+g)*+Qn(+_)*m),+(+ia(+ +is(+m),+ +is(+(1-m)))*2*6371.007180918475*1e3)}function R9(d,A){return d=d|0,A=A|0,d>>>0>15?(A=4,A|0):(ne[A>>3]=+ne[20624+(d<<3)>>3],A=0,A|0)}function ase(d,A){return d=d|0,A=A|0,d>>>0>15?(A=4,A|0):(ne[A>>3]=+ne[20752+(d<<3)>>3],A=0,A|0)}function lse(d,A){return d=d|0,A=A|0,d>>>0>15?(A=4,A|0):(ne[A>>3]=+ne[20880+(d<<3)>>3],A=0,A|0)}function cse(d,A){return d=d|0,A=A|0,d>>>0>15?(A=4,A|0):(ne[A>>3]=+ne[21008+(d<<3)>>3],A=0,A|0)}function Zb(d,A){d=d|0,A=A|0;var m=0;return d>>>0>15?(A=4,A|0):(m=ld(7,0,d,((d|0)<0)<<31>>31)|0,m=cr(m|0,Q()|0,120,0)|0,d=Q()|0,h[A>>2]=m|2,h[A+4>>2]=d,A=0,A|0)}function use(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(E=Y,Y=Y+176|0,b=E,d=sx(d,A,b)|0,d|0)return b=d,Y=E,b|0;if(ne[m>>3]=0,d=h[b>>2]|0,(d|0)<=1)return b=0,Y=E,b|0;A=d+-1|0,d=0,_=+ne[b+8>>3],g=+ne[b+16>>3],y=0;do d=d+1|0,I=_,_=+ne[b+8+(d<<4)>>3],O=+Ni(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ni(+((g-M)*.5)),M=O*O+M*(+Qn(+_)*+Qn(+I)*M),y=y+ +ia(+ +is(+M),+ +is(+(1-M)))*2;while((d|0)<(A|0));return ne[m>>3]=y,b=0,Y=E,b|0}function hse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(E=Y,Y=Y+176|0,b=E,d=sx(d,A,b)|0,d|0)return b=d,y=+ne[m>>3],y=y*6371.007180918475,ne[m>>3]=y,Y=E,b|0;if(ne[m>>3]=0,d=h[b>>2]|0,(d|0)<=1)return b=0,y=0,y=y*6371.007180918475,ne[m>>3]=y,Y=E,b|0;A=d+-1|0,d=0,_=+ne[b+8>>3],g=+ne[b+16>>3],y=0;do d=d+1|0,I=_,_=+ne[b+8+(d<<4)>>3],O=+Ni(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ni(+((g-M)*.5)),M=O*O+M*(+Qn(+I)*+Qn(+_)*M),y=y+ +ia(+ +is(+M),+ +is(+(1-M)))*2;while((d|0)!=(A|0));return ne[m>>3]=y,b=0,O=y,O=O*6371.007180918475,ne[m>>3]=O,Y=E,b|0}function fse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(E=Y,Y=Y+176|0,b=E,d=sx(d,A,b)|0,d|0)return b=d,y=+ne[m>>3],y=y*6371.007180918475,y=y*1e3,ne[m>>3]=y,Y=E,b|0;if(ne[m>>3]=0,d=h[b>>2]|0,(d|0)<=1)return b=0,y=0,y=y*6371.007180918475,y=y*1e3,ne[m>>3]=y,Y=E,b|0;A=d+-1|0,d=0,_=+ne[b+8>>3],g=+ne[b+16>>3],y=0;do d=d+1|0,I=_,_=+ne[b+8+(d<<4)>>3],O=+Ni(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ni(+((g-M)*.5)),M=O*O+M*(+Qn(+I)*+Qn(+_)*M),y=y+ +ia(+ +is(+M),+ +is(+(1-M)))*2;while((d|0)!=(A|0));return ne[m>>3]=y,b=0,O=y,O=O*6371.007180918475,O=O*1e3,ne[m>>3]=O,Y=E,b|0}function dse(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0;if(d)for(y=d+4|0,b=d+8|0,_=1,g=d;;){if(A=h[g>>2]|0,A|0)do{if(m=h[A>>2]|0,m|0)do E=m,m=h[m+16>>2]|0,_t(E);while((m|0)!=0);E=A,A=h[A+8>>2]|0,_t(E)}while((A|0)!=0);if(A=g,g=h[g+8>>2]|0,_?(h[d>>2]=0,h[y>>2]=0,h[b>>2]=0):_t(A),g)_=0;else break}}function pse(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0;if(h[A>>2]=0,ue=A+4|0,h[ue>>2]=0,_e=A+8|0,h[_e>>2]=0,oe=h[d>>2]|0,(oe|0)<=0)return A=0,A|0;$=d+4|0,d=A,W=0;e:for(;;){if(W){if(m=ra(1,12)|0,!m){m=5;break}h[d+8>>2]=m,d=m}if(M=h[$>>2]|0,I=ra(1,12)|0,!I){d=13,m=37;break}if(q=d+4|0,_=h[q>>2]|0,h[((_|0)==0?d:_+8|0)>>2]=I,h[q>>2]=I,_=h[M+(W<<4)>>2]|0,(_|0)<3){d=1,m=37;break}g=M+(W<<4)+4|0,y=I+4|0,m=0,b=0;do{if(E=b,b=lr(24)|0,!b){d=13,m=37;break e}k4(b|0,(h[g>>2]|0)+(m<<4)|0,16)|0,h[b+16>>2]=0,E?h[E+16>>2]=b:h[I>>2]=b,h[y>>2]=b,m=m+1|0}while((m|0)<(_|0));if(G=h[M+(W<<4)+8>>2]|0,(G|0)>0){O=M+(W<<4)+12|0,M=0;do{if(_=h[O>>2]|0,m=I,I=ra(1,12)|0,!I){d=13,m=37;break e}if(h[m+8>>2]=I,h[q>>2]=I,E=h[_+(M<<3)>>2]|0,(E|0)<3){d=1,m=37;break e}_=_+(M<<3)+4|0,g=I+4|0,m=0,y=0;do{if(b=y,y=lr(24)|0,!y){d=13,m=37;break e}k4(y|0,(h[_>>2]|0)+(m<<4)|0,16)|0,h[y+16>>2]=0,b?h[b+16>>2]=y:h[I>>2]=y,h[g>>2]=y,m=m+1|0}while((m|0)<(E|0));M=M+1|0}while((M|0)<(G|0))}if(W=W+1|0,(W|0)>=(oe|0)){d=0,m=50;break}}if((m|0)==5){if(!A)return A=13,A|0;for(_=1,g=A;;){if(d=h[g>>2]|0,d|0)do{if(m=h[d>>2]|0,m|0)do oe=m,m=h[m+16>>2]|0,_t(oe);while((m|0)!=0);oe=d,d=h[d+8>>2]|0,_t(oe)}while((d|0)!=0);if(d=g,g=h[g+8>>2]|0,_?(h[A>>2]=0,h[ue>>2]=0,h[_e>>2]=0):_t(d),g)_=0;else{d=13;break}}return d|0}else if((m|0)==37){if(!A)return A=d,A|0;for(g=1,y=A;;){if(m=h[y>>2]|0,m|0)do{if(_=h[m>>2]|0,_|0)do oe=_,_=h[_+16>>2]|0,_t(oe);while((_|0)!=0);oe=m,m=h[m+8>>2]|0,_t(oe)}while((m|0)!=0);if(m=y,y=h[y+8>>2]|0,g?(h[A>>2]=0,h[ue>>2]=0,h[_e>>2]=0):_t(m),y)g=0;else break}return d|0}else if((m|0)==50)return d|0;return 0}function ux(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0;if(_e=Y,Y=Y+16|0,ue=_e,O=et(d|0,A|0,52)|0,Q()|0,O=O&15,W=et(m|0,_|0,52)|0,Q()|0,(O|0)!=(W&15|0))return ue=12,Y=_e,ue|0;if(M=et(d|0,A|0,45)|0,Q()|0,M=M&127,I=et(m|0,_|0,45)|0,Q()|0,I=I&127,M>>>0>121|I>>>0>121)return ue=5,Y=_e,ue|0;if(W=(M|0)!=(I|0),W){if(b=g4(M,I)|0,(b|0)==7)return ue=1,Y=_e,ue|0;E=g4(I,M)|0,(E|0)==7?li(27291,27315,164,27325):(oe=b,y=E)}else oe=0,y=0;G=ar(M)|0,q=ar(I)|0,h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0;do if(oe){I=h[4272+(M*28|0)+(oe<<2)>>2]|0,b=(I|0)>0;e:do if(q)if(b)for(M=0,E=m,b=_;;){switch(E=Jre(E,b)|0,b=Q()|0,y|0){case 5:case 1:{y=3;break}case 3:{y=2;break}case 2:{y=6;break}case 6:{y=4;break}case 4:{y=5;break}default:}if(M=M+1|0,(M|0)==(I|0)){I=y,M=E,E=b;break e}}else I=y,M=m,E=_;else if(b)for(M=0,E=m,b=_;;){switch(E=E4(E,b)|0,b=Q()|0,y|0){case 1:{y=3;break}case 3:{y=2;break}case 2:{y=6;break}case 6:{y=4;break}case 4:{y=5;break}case 5:{y=1;break}default:}if(M=M+1|0,(M|0)==(I|0)){I=y,M=E,E=b;break e}}else I=y,M=m,E=_;while(!1);if(C4(M,E,ue)|0,W||li(27340,27315,194,27325),b=(G|0)!=0,y=(q|0)!=0,b&y&&li(27367,27315,195,27325),b){if(y=Oa(d,A)|0,(y|0)==7){y=5;break}if(He[21968+(y*7|0)+oe>>0]|0){y=1;break}q=h[21136+(y*28|0)+(oe<<2)>>2]|0,W=q}else if(y){if(y=Oa(M,E)|0,(y|0)==7){y=5;break}if(He[21968+(y*7|0)+I>>0]|0){y=1;break}W=0,q=h[21136+(I*28|0)+(y<<2)>>2]|0}else W=0,q=0;if((W|q|0)>=0){if((q|0)>0){m=ue+4|0,_=ue+8|0,G=ue+12|0,I=0,E=h[m>>2]|0,b=h[_>>2]|0,y=h[G>>2]|0;do $=b+E|0,A=($|0)<0,re=A?$:0,b=y+b-re|0,d=(b|0)<0,M=d?b:0,E=y+E-re-M|0,re=(E|0)<0,y=re?0:E,E=re?E:0,b=(d?0:b)-E|0,E=(A?0:$)-M-E|0,M=(b|0)<(E|0)?b:E,M=(y|0)<(M|0)?y:M,(M|0)>0&&(E=E-M|0,b=b-M|0,y=y-M|0),I=I+1|0;while((I|0)!=(q|0));h[m>>2]=E,h[_>>2]=b,h[G>>2]=y}if((oe+-1|0)>>>0<6?(y=h[22032+(oe*12|0)>>2]|0,E=h[22032+(oe*12|0)+4>>2]|0,re=h[22032+(oe*12|0)+8>>2]|0,b=(E|0)<(y|0)?E:y,b=(re|0)<(b|0)?re:b,b=(b|0)>0?b:0,y=y-b|0,E=E-b|0,b=re-b|0):(y=0,E=0,b=0),O)for(;;)if(M=y*3|0,I=E*3|0,m=b*3|0,zl(O)|0?(A=M+E|0,d=(A|0)<0,re=I+b-(d?A:0)|0,$=(re|0)<0,E=y+m-(d?A:0)-($?re:0)|0,b=(E|0)<0,oe=b?0:E,M=($?0:re)-(b?E:0)|0,E=(d?0:A)-($?re:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(oe|0)<(b|0)?oe:b,re=(b|0)>0,y=re?b:0,M=M-(re?b:0)|0,b=oe-(re?b:0)|0):($=M+b|0,A=($|0)<0,re=I+y-(A?$:0)|0,y=(re|0)<0,E=m+E-(A?$:0)-(y?re:0)|0,b=(E|0)<0,oe=b?0:E,M=(y?0:re)-(b?E:0)|0,E=(A?0:$)-(y?re:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(oe|0)<(b|0)?oe:b,re=(b|0)>0,y=re?b:0,M=M-(re?b:0)|0,b=oe-(re?b:0)|0),y=E-y|0,(O|0)>1)O=O+-1|0,E=M;else{E=M;break}if((W|0)>0){M=0;do A=y+E|0,d=(A|0)<0,re=E+b-(d?A:0)|0,$=(re|0)<0,oe=y+b-(d?A:0)-($?re:0)|0,y=(oe|0)<0,b=y?0:oe,E=($?0:re)-(y?oe:0)|0,oe=(d?0:A)-($?re:0)-(y?oe:0)|0,y=(E|0)<(oe|0)?E:oe,y=(b|0)<(y|0)?b:y,re=(y|0)>0,b=b-(re?y:0)|0,E=E-(re?y:0)|0,y=oe-(re?y:0)|0,M=M+1|0;while((M|0)!=(W|0))}m=ue+4|0,O=ue+8|0,oe=h[O>>2]|0,_=ue+12|0,re=h[_>>2]|0,M=(h[m>>2]|0)+y|0,h[m>>2]=M,E=oe+E|0,h[O>>2]=E,y=re+b|0,h[_>>2]=y,b=E-M|0,(M|0)<0?(y=y-M|0,h[O>>2]=b,h[_>>2]=y,h[m>>2]=0,E=0):(b=E,E=M),(b|0)<0&&(E=E-b|0,h[m>>2]=E,y=y-b|0,h[_>>2]=y,h[O>>2]=0,b=0),I=E-y|0,M=b-y|0,(y|0)<0?(h[m>>2]=I,h[O>>2]=M,h[_>>2]=0,E=I,y=0):M=b,b=(M|0)<(E|0)?M:E,b=(y|0)<(b|0)?y:b,(b|0)>0&&(h[m>>2]=E-b,h[O>>2]=M-b,h[_>>2]=y-b),$=77}else y=5}else if(C4(m,_,ue)|0,(G|0)!=0&(q|0)!=0)if((I|0)!=(M|0)&&li(27398,27315,264,27325),b=Oa(d,A)|0,y=Oa(m,_)|0,(b|0)==7|(y|0)==7)y=5;else if(He[21968+(b*7|0)+y>>0]|0)y=1;else if(m=h[21136+(b*28|0)+(y<<2)>>2]|0,(m|0)>0){O=ue+4|0,_=ue+8|0,G=ue+12|0,I=0,E=h[O>>2]|0,b=h[_>>2]|0,y=h[G>>2]|0;do oe=b+E|0,$=(oe|0)<0,d=$?oe:0,b=y+b-d|0,A=(b|0)<0,M=A?b:0,E=y+E-d-M|0,d=(E|0)<0,y=d?0:E,E=d?E:0,b=(A?0:b)-E|0,E=($?0:oe)-M-E|0,M=(b|0)<(E|0)?b:E,M=(y|0)<(M|0)?y:M,(M|0)>0&&(E=E-M|0,b=b-M|0,y=y-M|0),I=I+1|0;while((I|0)!=(m|0));h[O>>2]=E,h[_>>2]=b,h[G>>2]=y,$=77}else $=77;else $=77;while(!1);return($|0)==77&&(y=ue+4|0,h[g>>2]=h[y>>2],h[g+4>>2]=h[y+4>>2],h[g+8>>2]=h[y+8>>2],y=0),re=y,Y=_e,re|0}function P9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0;if(y=et(d|0,A|0,52)|0,Q()|0,y=y&15,me=et(d|0,A|0,45)|0,Q()|0,me=me&127,me>>>0>121)return _=5,_|0;if(ue=ar(me)|0,ht(y|0,0,52)|0,E=Q()|0|134225919,b=_,h[b>>2]=-1,h[b+4>>2]=E,b=h[m>>2]|0,E=h[m+4>>2]|0,m=h[m+8>>2]|0,!y){A=(b|0)<0,_e=A?b:0,be=E-_e|0,ue=(be|0)<0,_e=(ue?0-be|0:0)+(m-_e)|0,m=(_e|0)<0,g=m?0:_e,_e=m?_e:0,m=(ue?0:be)-_e|0,_e=(A?0:b)-(ue?be:0)-_e|0,be=(m|0)<(_e|0)?m:_e,be=(g|0)<(be|0)?g:be,be=(be|0)>0?be:0,g=g-be|0,m=m-be|0;e:do switch(_e-be|0){case 0:switch(m|0){case 0:if(g){g=(g|0)==1?1:7,re=11;break e}else{g=0;break e}case 1:if(g){g=(g|0)==1?3:7,re=11;break e}else{g=2;break e}default:return _=1,_|0}case 1:switch(m|0){case 0:if(g){g=(g|0)==1?5:7,re=11;break e}else{g=4;break e}case 1:{if(g)g=1;else{g=6;break e}return g|0}default:return _=1,_|0}default:return _=1,_|0}while(!1);return(re|0)==11&&(g|0)==7||(g=m4(me,g)|0,(g|0)==127)?(_=1,_|0):(be=ht(g|0,0,45)|0,me=Q()|0,re=_,me=h[re+4>>2]&-1040385|me,h[_>>2]=h[re>>2]|be,h[_+4>>2]=me,_=0,_|0)}for(;;){if(oe=y,y=y+-1|0,$=b-m|0,W=E-m|0,M=$>>>0>715827881|W>>>0>715827881,zl(oe)|0){if(M){if(O=($|0)>0,G=2147483647-$|0,q=-2147483648-$|0,O?(G|0)<($|0):(q|0)>($|0)){g=1,re=107;break}if(ye=$<<1,O?(2147483647-ye|0)<($|0):(-2147483648-ye|0)>($|0)){g=1,re=107;break}if((W|0)>0?(2147483647-W|0)<(W|0):(-2147483648-W|0)>(W|0)){g=1,re=107;break}if(M=$*3|0,I=W<<1,(O?(G|0)<(I|0):(q|0)>(I|0))||(($|0)>-1?(M|-2147483648|0)>=(W|0):(M^-2147483648|0)<(W|0))){g=1,re=107;break}}else M=$*3|0,I=W<<1;if(G=Au(+(M-W|0)*.14285714285714285)|0,O=Au(+(I+$|0)*.14285714285714285)|0,I=(O|0)<(G|0),M=I?G:O,I=I?O:G,(I|0)<0){if((I|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(I|0):(-2147483648-M|0)>(I|0))){re=24;break}if((M|0)>-1?(M|-2147483648|0)>=(I|0):(M^-2147483648|0)<(I|0)){re=24;break}}q=(G|0)<0,W=O-(q?G:0)|0,Ze=(W|0)<0,Fe=(q?0-G|0:0)-(Ze?W:0)|0,$=(Fe|0)<0,q=(q?0:G)-(Ze?W:0)-($?Fe:0)|0,W=(Ze?0:W)-($?Fe:0)|0,Fe=$?0:Fe,$=(W|0)<(q|0)?W:q,$=(Fe|0)<($|0)?Fe:$,Ze=($|0)>0,q=q-(Ze?$:0)|0,W=W-(Ze?$:0)|0,$=Fe-(Ze?$:0)|0,Ze=(q*3|0)+W|0,Fe=(Ze|0)<0,ye=(W*3|0)+$-(Fe?Ze:0)|0,M=(ye|0)<0,G=($*3|0)+q-(Fe?Ze:0)-(M?ye:0)|0,O=(G|0)<0,Ee=O?0:G,I=(M?0:ye)-(O?G:0)|0,G=(Fe?0:Ze)-(M?ye:0)-(O?G:0)|0,O=(I|0)<(G|0)?I:G,O=(Ee|0)<(O|0)?Ee:O,ye=(O|0)>0,M=ye?O:0,I=I-(ye?O:0)|0,O=Ee-(ye?O:0)|0}else{if(M){if(I=($|0)>0,I?(2147483647-$|0)<($|0):(-2147483648-$|0)>($|0)){g=1,re=107;break}if(M=$<<1,O=(W|0)>0,O?(2147483647-W|0)<(W|0):(-2147483648-W|0)>(W|0)){g=1,re=107;break}if(q=W<<1,O?(2147483647-q|0)<(W|0):(-2147483648-q|0)>(W|0)){g=1,re=107;break}if(I?(2147483647-M|0)<(W|0):(-2147483648-M|0)>(W|0)){g=1,re=107;break}if(I=W*3|0,(W|0)>-1?(I|-2147483648|0)>=($|0):(I^-2147483648|0)<($|0)){g=1,re=107;break}}else M=$<<1,I=W*3|0;if(G=Au(+(M+W|0)*.14285714285714285)|0,O=Au(+(I-$|0)*.14285714285714285)|0,I=(O|0)<(G|0),M=I?G:O,I=I?O:G,(I|0)<0){if((I|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(I|0):(-2147483648-M|0)>(I|0))){re=36;break}if((M|0)>-1?(M|-2147483648|0)>=(I|0):(M^-2147483648|0)<(I|0)){re=36;break}}q=(G|0)<0,W=O-(q?G:0)|0,Ee=(W|0)<0,ye=(q?0-G|0:0)-(Ee?W:0)|0,$=(ye|0)<0,q=(q?0:G)-(Ee?W:0)-($?ye:0)|0,W=(Ee?0:W)-($?ye:0)|0,ye=$?0:ye,$=(W|0)<(q|0)?W:q,$=(ye|0)<($|0)?ye:$,Ee=($|0)>0,q=q-(Ee?$:0)|0,W=W-(Ee?$:0)|0,$=ye-(Ee?$:0)|0,Ee=(q*3|0)+$|0,ye=(Ee|0)<0,Fe=(W*3|0)+q-(ye?Ee:0)|0,M=(Fe|0)<0,G=($*3|0)+W-(ye?Ee:0)-(M?Fe:0)|0,O=(G|0)<0,Ze=O?0:G,I=(M?0:Fe)-(O?G:0)|0,G=(ye?0:Ee)-(M?Fe:0)-(O?G:0)|0,O=(I|0)<(G|0)?I:G,O=(Ze|0)<(O|0)?Ze:O,Fe=(O|0)>0,M=Fe?O:0,I=I-(Fe?O:0)|0,O=Ze-(Fe?O:0)|0}M=b+(M-G)|0,Ee=(M|0)<0,I=E-I-(Ee?M:0)|0,G=(I|0)<0,Fe=m-O+(Ee?0-M|0:0)+(G?0-I|0:0)|0,b=(Fe|0)<0,O=b?0:Fe,ye=(G?0:I)-(b?Fe:0)|0,Fe=(Ee?0:M)-(G?I:0)-(b?Fe:0)|0,b=(ye|0)<(Fe|0)?ye:Fe,b=(O|0)<(b|0)?O:b,m=(b|0)>0,Fe=Fe-(m?b:0)|0,I=_,G=h[I>>2]|0,I=h[I+4>>2]|0,E=(15-oe|0)*3|0,M=ht(7,0,E|0)|0,M=G&~M,I=I&~(Q()|0),G=(Fe|0)<0,Ee=G?Fe:0,ye=ye-(m?b:0)-Ee|0,Ze=(ye|0)<0,Ee=(Ze?0-ye|0:0)+(O-(m?b:0)-Ee)|0,b=(Ee|0)<0,m=b?0:Ee,Ee=b?Ee:0,b=(Ze?0:ye)-Ee|0,Ee=(G?0:Fe)-(Ze?ye:0)-Ee|0,ye=(b|0)<(Ee|0)?b:Ee,ye=(m|0)<(ye|0)?m:ye,ye=(ye|0)>0?ye:0,m=m-ye|0,b=b-ye|0;e:do switch(Ee-ye|0){case 0:switch(b|0){case 0:{m=(m|0)==0?0:(m|0)==1?1:7;break e}case 1:{m=(m|0)==0?2:(m|0)==1?3:7;break e}default:{re=45;break e}}case 1:switch(b|0){case 0:{m=(m|0)==0?4:(m|0)==1?5:7;break e}case 1:if(m){re=45;break e}else{m=6;break e}default:{re=45;break e}}default:re=45}while(!1);if((re|0)==45&&(re=0,m=7),Ze=ht(m|0,0,E|0)|0,Ee=Q()|0|I,ye=_,h[ye>>2]=Ze|M,h[ye+4>>2]=Ee,(oe|0)<=1){re=47;break}else b=q,E=W,m=$}if((re|0)==24)li(27634,27425,416,27447);else if((re|0)==36)li(27634,27425,464,27461);else if((re|0)==47){if((q|0)>1|(W|0)>1|($|0)>1)return ye=1,ye|0;Fe=(q|0)<0,Ee=Fe?q:0,ye=W-Ee|0,Ze=(ye|0)<0,Ee=(Ze?0-ye|0:0)+($-Ee)|0,y=(Ee|0)<0,m=y?0:Ee,Ee=y?Ee:0,y=(Ze?0:ye)-Ee|0,Ee=(Fe?0:q)-(Ze?ye:0)-Ee|0,ye=(y|0)<(Ee|0)?y:Ee,ye=(m|0)<(ye|0)?m:ye,ye=(ye|0)>0?ye:0,m=m-ye|0,y=y-ye|0;e:do switch(Ee-ye|0){case 0:switch(y|0){case 0:{y=(m|0)==0?0:(m|0)==1?1:7;break e}case 1:{y=(m|0)==0?2:(m|0)==1?3:7;break e}default:{re=55;break e}}case 1:switch(y|0){case 0:{y=(m|0)==0?4:(m|0)==1?5:7;break e}case 1:if(m){re=55;break e}else{y=6;break e}default:{re=55;break e}}default:re=55}while(!1);(re|0)==55&&(y=7),E=m4(me,y)|0,(E|0)==127?I=0:I=ar(E)|0;e:do if(y){if(ue){if(m=Oa(d,A)|0,(m|0)==7)return ye=5,ye|0;b=h[21344+(m*28|0)+(y<<2)>>2]|0;t:do if((b|0)>0)for(m=y,y=0;;){switch(m|0){case 1:{m=5;break}case 5:{m=4;break}case 4:{m=6;break}case 6:{m=2;break}case 2:{m=3;break}case 3:{m=1;break}default:}if(y=y+1|0,(y|0)==(b|0))break t}else m=y;while(!1);if((m|0)==1)return ye=9,ye|0;y=m4(me,m)|0,(y|0)==127&&li(27476,27315,415,27506),ar(y)|0?li(27521,27315,416,27506):(g=y,be=b,_e=m)}else g=E,be=0,_e=y;if(M=h[4272+(me*28|0)+(_e<<2)>>2]|0,(M|0)<=-1&&li(27552,27315,423,27506),!I){if((be|0)<0)return ye=5,ye|0;if(be|0){b=_,m=0,y=h[b>>2]|0,b=h[b+4>>2]|0;do y=I0(y,b)|0,b=Q()|0,ye=_,h[ye>>2]=y,h[ye+4>>2]=b,m=m+1|0;while((m|0)<(be|0))}if((M|0)<=0){re=104;break}for(b=_,m=0,y=h[b>>2]|0,b=h[b+4>>2]|0;;)if(y=I0(y,b)|0,b=Q()|0,ye=_,h[ye>>2]=y,h[ye+4>>2]=b,m=m+1|0,(m|0)==(M|0)){re=104;break e}}if(E=g4(g,me)|0,(E|0)==7&&li(27291,27315,432,27506),m=_,y=h[m>>2]|0,m=h[m+4>>2]|0,(M|0)>0){b=0;do y=I0(y,m)|0,m=Q()|0,ye=_,h[ye>>2]=y,h[ye+4>>2]=m,b=b+1|0;while((b|0)!=(M|0))}if(m=Oa(y,m)|0,(m|0)==7&&li(27634,27315,444,27506),y=A4(g)|0,y=h[(y?21760:21552)+(E*28|0)+(m<<2)>>2]|0,(y|0)<0&&li(27634,27315,458,27506),!y)re=104;else{E=_,m=0,b=h[E>>2]|0,E=h[E+4>>2]|0;do b=T4(b,E)|0,E=Q()|0,ye=_,h[ye>>2]=b,h[ye+4>>2]=E,m=m+1|0;while((m|0)<(y|0));re=104}}else if((ue|0)!=0&(I|0)!=0){if(g=Oa(d,A)|0,m=_,m=Oa(h[m>>2]|0,h[m+4>>2]|0)|0,(g|0)==7|(m|0)==7||(m=h[21344+(g*28|0)+(m<<2)>>2]|0,(m|0)<0))return ye=5,ye|0;if(!m)g=E,re=105;else{b=_,g=0,y=h[b>>2]|0,b=h[b+4>>2]|0;do y=I0(y,b)|0,b=Q()|0,ye=_,h[ye>>2]=y,h[ye+4>>2]=b,g=g+1|0;while((g|0)<(m|0));g=E,re=104}}else g=E,re=104;while(!1);return(re|0)==104&&I&&(re=105),(re|0)==105&&(ye=_,(Oa(h[ye>>2]|0,h[ye+4>>2]|0)|0)==1)?(ye=9,ye|0):(Ee=_,Fe=h[Ee>>2]|0,Ee=h[Ee+4>>2]&-1040385,Ze=ht(g|0,0,45)|0,Ee=Ee|(Q()|0),ye=_,h[ye>>2]=Fe|Ze,h[ye+4>>2]=Ee,ye=0,ye|0)}else if((re|0)==107)return g|0;return 0}function Ase(d,A,m,_,g,y){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0;var b=0,E=0;return E=Y,Y=Y+16|0,b=E,g|0?(b=15,Y=E,b|0):(d=ux(d,A,m,_,b)|0,d||(g=h[b+4>>2]|0,d=h[b+8>>2]|0,h[y>>2]=(h[b>>2]|0)-d,h[y+4>>2]=g-d,d=0),b=d,Y=E,b|0)}function mse(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0;return G=Y,Y=Y+16|0,O=G,_|0?(O=15,Y=G,O|0):(E=h[m>>2]|0,b=h[m+4>>2]|0,h[O>>2]=E,M=O+4|0,h[M>>2]=b,I=O+8|0,h[I>>2]=0,m=(b|0)<(E|0),_=m?E:b,m=m?b:E,(m|0)<0?!((m|0)==-2147483648||((_|0)>0?(2147483647-_|0)<(m|0):(-2147483648-_|0)>(m|0)))&&!((_|0)>-1?(_|-2147483648|0)>=(m|0):(_^-2147483648|0)<(m|0))?y=5:_=1:y=5,(y|0)==5&&(_=b-E|0,y=0-E|0,(E|0)<0?(h[M>>2]=_,h[I>>2]=y,h[O>>2]=0,E=0):(_=b,y=0),b=E-_|0,m=y-_|0,(_|0)<0?(h[O>>2]=b,h[I>>2]=m,h[M>>2]=0,E=b,_=0):m=y,b=E-m|0,y=_-m|0,(m|0)<0?(h[O>>2]=b,h[M>>2]=y,h[I>>2]=0,m=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(m|0)<(_|0)?m:_,(_|0)>0&&(h[O>>2]=b-_,h[M>>2]=y-_,h[I>>2]=m-_),_=P9(d,A,O,g)|0),O=_,Y=G,O|0)}function N4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0;return M=Y,Y=Y+32|0,b=M+12|0,E=M,y=ux(d,A,d,A,b)|0,y|0?(E=y,Y=M,E|0):(d=ux(d,A,m,_,E)|0,d|0?(E=d,Y=M,E|0):(d=(h[b>>2]|0)-(h[E>>2]|0)|0,I=(d|0)<0,_=I?0-d|0:0,m=_+((h[b+4>>2]|0)-(h[E+4>>2]|0))|0,A=(m|0)<0,_=(h[b+8>>2]|0)-(h[E+8>>2]|0)+_+(A?0-m|0:0)|0,y=(_|0)<0,b=y?0:_,_=y?_:0,y=(A?0:m)-_|0,_=(I?0:d)-(A?m:0)-_|0,E=(y|0)<(_|0)?y:_,E=(b|0)<(E|0)?b:E,E=(E|0)>0?E:0,b=b-E|0,y=y-E|0,E=_-E|0,E=(E|0)>-1?E:0-E|0,y=(y|0)>-1?y:0-y|0,b=(b|0)>-1?b:0-b|0,b=(y|0)>(b|0)?y:b,b=(E|0)>(b|0)?E:b,E=g,h[E>>2]=b,h[E+4>>2]=((b|0)<0)<<31>>31,E=0,Y=M,E|0))}function gse(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0;return b=Y,Y=Y+16|0,y=b,d=N4(d,A,m,_,y)|0,d|0?(y=d,Y=b,y|0):(m=y,m=pt(h[m>>2]|0,h[m+4>>2]|0,1,0)|0,_=Q()|0,y=g,h[y>>2]=m,h[y+4>>2]=_,y=0,Y=b,y|0)}function _se(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0;return M=Y,Y=Y+16|0,y=M,b=N4(d,A,m,_,y)|0,b|0?(g=b,Y=M,g|0):(b=y,y=h[b>>2]|0,b=h[b+4>>2]|0,(y|0)==0&(b|0)==0?(h[g>>2]=d,h[g+4>>2]=A,g=0,Y=M,g|0):(E=I9(d,A,m,_,y,b,g,0,0,1,0)|0,E?(g=(I9(m,_,d,A,y,b,g,y,b,-1,-1)|0)==0,g=g?0:E,Y=M,g|0):(g=0,Y=M,g|0)))}function I9(d,A,m,_,g,y,b,E,M,I,O){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0,E=E|0,M=M|0,I=I|0,O=O|0;var G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0;if(Ot=Y,Y=Y+48|0,G=Ot+24|0,q=Ot+12|0,We=Ot,h[G>>2]=0,h[G+4>>2]=0,h[G+8>>2]=0,h[q>>2]=0,h[q+4>>2]=0,h[q+8>>2]=0,ux(d,A,d,A,G)|0&&li(27634,27315,696,27575),ux(d,A,m,_,q)|0&&li(27634,27315,701,27575),oe=G+8|0,_=h[oe>>2]|0,m=_-(h[G>>2]|0)|0,h[G>>2]=m,At=G+4|0,_=(h[At>>2]|0)-_|0,h[At>>2]=_,At=_+m|0,G=0-At|0,h[oe>>2]=G,oe=q+8|0,re=h[oe>>2]|0,_e=re-(h[q>>2]|0)|0,h[q>>2]=_e,ye=q+4|0,re=(h[ye>>2]|0)-re|0,h[ye>>2]=re,ye=re+_e|0,h[oe>>2]=0-ye,Ee=1/(+(g>>>0)+4294967296*+(y|0)),Fe=Ee*+(_e-m|0),Ze=Ee*+(re-_|0),Ee=Ee*+(At-ye|0),h[We>>2]=m,ye=We+4|0,h[ye>>2]=_,At=We+8|0,h[At>>2]=G,(y|0)<0)return I=0,Y=Ot,I|0;for(me=+(m|0),be=+(_|0),ue=+(G|0),_e=0,re=0;;){if($=+(_e>>>0)+4294967296*+(re|0),at=Fe*$+me,W=Ze*$+be,$=Ee*$+ue,_=~~+rw(+at),G=~~+rw(+W),m=~~+rw(+$),at=+Ns(+(+(_|0)-at)),W=+Ns(+(+(G|0)-W)),$=+Ns(+(+(m|0)-$)),at>W&at>$?(q=m+G|0,_=0-q|0):(q=0-_|0,W>$&&(G=q-m|0)),h[ye>>2]=G,h[We>>2]=q,h[At>>2]=0,m=_+G|0,(_|0)>0?(h[ye>>2]=m,h[At>>2]=_,h[We>>2]=0,q=0):(m=G,_=0),(m|0)<0?(G=q-m|0,h[We>>2]=G,_=_-m|0,h[At>>2]=_,h[ye>>2]=0,q=G-_|0,m=0-_|0,(_|0)<0?(h[We>>2]=q,h[ye>>2]=m,h[At>>2]=0,oe=m,_=0):(oe=0,q=G)):oe=m,m=(oe|0)<(q|0)?oe:q,m=(_|0)<(m|0)?_:m,(m|0)>0&&(h[We>>2]=q-m,h[ye>>2]=oe-m,h[At>>2]=_-m),m=cr(_e|0,re|0,I|0,O|0)|0,m=pt(m|0,Q()|0,E|0,M|0)|0,Q()|0,m=P9(d,A,We,b+(m<<3)|0)|0,m|0){_=20;break}if(oe=_e,_e=pt(_e|0,re|0,1,0)|0,q=re,re=Q()|0,!((q|0)<(y|0)|(q|0)==(y|0)&oe>>>0<g>>>0)){m=0,_=20;break}}return(_|0)==20?(Y=Ot,m|0):0}function ld(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;if((m|0)==0&(_|0)==0)return g=0,y=1,Dn(g|0),y|0;y=d,g=A,d=1,A=0;do b=(m&1|0)==0&!0,d=cr((b?1:y)|0,(b?0:g)|0,d|0,A|0)|0,A=Q()|0,m=W9(m|0,_|0,1)|0,_=Q()|0,y=cr(y|0,g|0,y|0,g|0)|0,g=Q()|0;while(!((m|0)==0&(_|0)==0));return Dn(A|0),d|0}function L4(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0;E=Y,Y=Y+16|0,y=E,b=et(d|0,A|0,52)|0,Q()|0,b=b&15;do if(b){if(g=ig(d,A,y)|0,!g){I=+ne[y>>3],M=1/+Qn(+I),O=+ne[26032+(b<<3)>>3],ne[m>>3]=I+O,ne[m+8>>3]=I-O,I=+ne[y+8>>3],M=O*M,ne[m+16>>3]=M+I,ne[m+24>>3]=I-M;break}return b=g,Y=E,b|0}else{if(g=et(d|0,A|0,45)|0,Q()|0,g=g&127,g>>>0>121)return b=5,Y=E,b|0;y=22128+(g<<5)|0,h[m>>2]=h[y>>2],h[m+4>>2]=h[y+4>>2],h[m+8>>2]=h[y+8>>2],h[m+12>>2]=h[y+12>>2],h[m+16>>2]=h[y+16>>2],h[m+20>>2]=h[y+20>>2],h[m+24>>2]=h[y+24>>2],h[m+28>>2]=h[y+28>>2];break}while(!1);return Nre(m,_?1.4:1.1),_=26160+(b<<3)|0,(h[_>>2]|0)==(d|0)&&(h[_+4>>2]|0)==(A|0)&&(ne[m>>3]=1.5707963267948966),b=26288+(b<<3)|0,(h[b>>2]|0)==(d|0)&&(h[b+4>>2]|0)==(A|0)&&(ne[m+8>>3]=-1.5707963267948966),+ne[m>>3]!=1.5707963267948966&&+ne[m+8>>3]!=-1.5707963267948966?(b=0,Y=E,b|0):(ne[m+16>>3]=3.141592653589793,ne[m+24>>3]=-3.141592653589793,b=0,Y=E,b|0)}function xse(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0;I=Y,Y=Y+48|0,b=I+32|0,y=I+40|0,E=I,w4(b,0,0,0),M=h[b>>2]|0,b=h[b+4>>2]|0;do if(m>>>0<=15){if(g=fx(_)|0,g|0){_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=g,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[y>>0]|0,He[M+1>>0]=He[y+1>>0]|0,He[M+2>>0]=He[y+2>>0]|0;break}if(g=ra((h[A+8>>2]|0)+1|0,32)|0,g){D4(A,g),O=E,h[O>>2]=M,h[O+4>>2]=b,h[E+8>>2]=0,h[E+12>>2]=m,h[E+16>>2]=_,h[E+20>>2]=A,h[E+24>>2]=g,He[E+28>>0]=0,M=E+29|0,He[M>>0]=He[y>>0]|0,He[M+1>>0]=He[y+1>>0]|0,He[M+2>>0]=He[y+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[y>>0]|0,He[M+1>>0]=He[y+1>>0]|0,He[M+2>>0]=He[y+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[y>>0]|0,He[O+1>>0]=He[y+1>>0]|0,He[O+2>>0]=He[y+2>>0]|0;while(!1);Kb(E),h[d>>2]=h[E>>2],h[d+4>>2]=h[E+4>>2],h[d+8>>2]=h[E+8>>2],h[d+12>>2]=h[E+12>>2],h[d+16>>2]=h[E+16>>2],h[d+20>>2]=h[E+20>>2],h[d+24>>2]=h[E+24>>2],h[d+28>>2]=h[E+28>>2],Y=I}function Kb(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0;if(me=Y,Y=Y+336|0,W=me+168|0,$=me,_=d,m=h[_>>2]|0,_=h[_+4>>2]|0,(m|0)==0&(_|0)==0){Y=me;return}if(A=d+28|0,He[A>>0]|0?(m=N9(m,_)|0,_=Q()|0):He[A>>0]=1,be=d+20|0,!(h[h[be>>2]>>2]|0)){A=d+24|0,m=h[A>>2]|0,m|0&&_t(m),re=d,h[re>>2]=0,h[re+4>>2]=0,h[d+8>>2]=0,h[be>>2]=0,h[d+12>>2]=-1,h[d+16>>2]=0,h[A>>2]=0,Y=me;return}re=d+16|0,A=h[re>>2]|0,g=A&15;e:do if((m|0)==0&(_|0)==0)_e=d+24|0;else{oe=d+12|0,G=(g|0)==3,O=A&255,M=(g|1|0)==3,q=d+24|0,I=(g+-1|0)>>>0<3,b=(g|2|0)==3,E=$+8|0;t:for(;;){if(y=et(m|0,_|0,52)|0,Q()|0,y=y&15,(y|0)==(h[oe>>2]|0)){switch(O&15){case 0:case 2:case 3:{if(g=ig(m,_,W)|0,g|0){ue=15;break t}if(F4(h[be>>2]|0,h[q>>2]|0,W)|0){ue=19;break t}break}default:}if(M&&(g=h[(h[be>>2]|0)+4>>2]|0,h[W>>2]=h[g>>2],h[W+4>>2]=h[g+4>>2],h[W+8>>2]=h[g+8>>2],h[W+12>>2]=h[g+12>>2],m9(26896,W)|0)){if(M4(h[(h[be>>2]|0)+4>>2]|0,y,$)|0){ue=25;break}if(g=$,(h[g>>2]|0)==(m|0)&&(h[g+4>>2]|0)==(_|0)){ue=29;break}}if(I){if(g=N0(m,_,W)|0,g|0){ue=32;break}if(L4(m,_,$,0)|0){ue=36;break}if(b&&D9(h[be>>2]|0,h[q>>2]|0,W,$)|0){ue=42;break}if(M&&F9(h[be>>2]|0,h[q>>2]|0,W,$)|0){ue=42;break}}if(G){if(A=L4(m,_,W,1)|0,g=h[q>>2]|0,A|0){ue=45;break}if(_4(g,W)|0){if(_9($,W),g9(W,h[q>>2]|0)|0){ue=53;break}if(F4(h[be>>2]|0,h[q>>2]|0,E)|0){ue=53;break}if(F9(h[be>>2]|0,h[q>>2]|0,$,W)|0){ue=53;break}}}}do if((y|0)<(h[oe>>2]|0)){if(A=L4(m,_,W,1)|0,g=h[q>>2]|0,A|0){ue=58;break t}if(!(_4(g,W)|0)){ue=73;break}if(g9(h[q>>2]|0,W)|0&&(_9($,W),D9(h[be>>2]|0,h[q>>2]|0,$,W)|0)){ue=65;break t}if(m=E9(m,_,y+1|0,$)|0,m|0){ue=67;break t}_=$,m=h[_>>2]|0,_=h[_+4>>2]|0}else ue=73;while(!1);if((ue|0)==73&&(ue=0,m=N9(m,_)|0,_=Q()|0),(m|0)==0&(_|0)==0){_e=q;break e}}switch(ue|0){case 15:{A=h[q>>2]|0,A|0&&_t(A),ue=d,h[ue>>2]=0,h[ue+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=g,ue=20;break}case 19:{h[d>>2]=m,h[d+4>>2]=_,ue=20;break}case 25:{li(27634,27600,470,27611);break}case 29:{h[d>>2]=m,h[d+4>>2]=_,Y=me;return}case 32:{A=h[q>>2]|0,A|0&&_t(A),_e=d,h[_e>>2]=0,h[_e+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=g,Y=me;return}case 36:{li(27634,27600,493,27611);break}case 42:{h[d>>2]=m,h[d+4>>2]=_,Y=me;return}case 45:{g|0&&_t(g),ue=d,h[ue>>2]=0,h[ue+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=A,ue=55;break}case 53:{h[d>>2]=m,h[d+4>>2]=_,ue=55;break}case 58:{g|0&&_t(g),ue=d,h[ue>>2]=0,h[ue+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=A,ue=71;break}case 65:{h[d>>2]=m,h[d+4>>2]=_,ue=71;break}case 67:{A=h[q>>2]|0,A|0&&_t(A),_e=d,h[_e>>2]=0,h[_e+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=m,Y=me;return}}if((ue|0)==20){Y=me;return}else if((ue|0)==55){Y=me;return}else if((ue|0)==71){Y=me;return}}while(!1);A=h[_e>>2]|0,A|0&&_t(A),ue=d,h[ue>>2]=0,h[ue+4>>2]=0,h[d+8>>2]=0,h[be>>2]=0,h[d+12>>2]=-1,h[re>>2]=0,h[_e>>2]=0,Y=me}function N9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;G=Y,Y=Y+16|0,O=G,_=et(d|0,A|0,52)|0,Q()|0,_=_&15,m=et(d|0,A|0,45)|0,Q()|0;do if(_){for(;m=ht(_+4095|0,0,52)|0,g=Q()|0|A&-15728641,y=(15-_|0)*3|0,b=ht(7,0,y|0)|0,E=Q()|0,m=m|d|b,g=g|E,M=et(d|0,A|0,y|0)|0,Q()|0,M=M&7,_=_+-1|0,!(M>>>0<6);)if(_)A=g,d=m;else{I=4;break}if((I|0)==4){m=et(m|0,g|0,45)|0,Q()|0;break}return O=(M|0)==0&(ki(m,g)|0)!=0,O=ht((O?2:1)+M|0,0,y|0)|0,I=Q()|0|A&~E,O=O|d&~b,Dn(I|0),Y=G,O|0}while(!1);return m=m&127,m>>>0>120?(I=0,O=0,Dn(I|0),Y=G,O|0):(w4(O,0,m+1|0,0),I=h[O+4>>2]|0,O=h[O>>2]|0,Dn(I|0),Y=G,O|0)}function yse(d,A,m,_,g,y){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0;var b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0;ue=Y,Y=Y+160|0,G=ue+80|0,E=ue+64|0,q=ue+112|0,oe=ue,xse(G,d,A,m),I=G,P4(E,h[I>>2]|0,h[I+4>>2]|0,A),I=E,M=h[I>>2]|0,I=h[I+4>>2]|0,b=h[G+8>>2]|0,W=q+4|0,h[W>>2]=h[G>>2],h[W+4>>2]=h[G+4>>2],h[W+8>>2]=h[G+8>>2],h[W+12>>2]=h[G+12>>2],h[W+16>>2]=h[G+16>>2],h[W+20>>2]=h[G+20>>2],h[W+24>>2]=h[G+24>>2],h[W+28>>2]=h[G+28>>2],W=oe,h[W>>2]=M,h[W+4>>2]=I,W=oe+8|0,h[W>>2]=b,d=oe+12|0,A=q,m=d+36|0;do h[d>>2]=h[A>>2],d=d+4|0,A=A+4|0;while((d|0)<(m|0));if(q=oe+48|0,h[q>>2]=h[E>>2],h[q+4>>2]=h[E+4>>2],h[q+8>>2]=h[E+8>>2],h[q+12>>2]=h[E+12>>2],(M|0)==0&(I|0)==0)return oe=b,Y=ue,oe|0;m=oe+16|0,O=oe+24|0,G=oe+28|0,b=0,E=0,A=M,d=I;do{if(!((b|0)<(g|0)|(b|0)==(g|0)&E>>>0<_>>>0)){$=4;break}if(I=E,E=pt(E|0,b|0,1,0)|0,b=Q()|0,I=y+(I<<3)|0,h[I>>2]=A,h[I+4>>2]=d,I4(q),d=q,A=h[d>>2]|0,d=h[d+4>>2]|0,(A|0)==0&(d|0)==0){if(Kb(m),A=m,d=h[A>>2]|0,A=h[A+4>>2]|0,(d|0)==0&(A|0)==0){$=10;break}C9(d,A,h[G>>2]|0,q),d=q,A=h[d>>2]|0,d=h[d+4>>2]|0}I=oe,h[I>>2]=A,h[I+4>>2]=d}while(!((A|0)==0&(d|0)==0));return($|0)==4?(d=oe+40|0,A=h[d>>2]|0,A|0&&_t(A),$=oe+16|0,h[$>>2]=0,h[$+4>>2]=0,h[O>>2]=0,h[oe+36>>2]=0,h[G>>2]=-1,h[oe+32>>2]=0,h[d>>2]=0,C9(0,0,0,q),h[oe>>2]=0,h[oe+4>>2]=0,h[W>>2]=0,oe=14,Y=ue,oe|0):(($|0)==10&&(h[oe>>2]=0,h[oe+4>>2]=0,h[W>>2]=h[O>>2]),oe=h[W>>2]|0,Y=ue,oe|0)}function vse(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0;if(G=Y,Y=Y+48|0,M=G+32|0,E=G+40|0,I=G,!(h[d>>2]|0))return O=_,h[O>>2]=0,h[O+4>>2]=0,O=0,Y=G,O|0;w4(M,0,0,0),b=M,g=h[b>>2]|0,b=h[b+4>>2]|0;do if(A>>>0>15)O=I,h[O>>2]=0,h[O+4>>2]=0,h[I+8>>2]=4,h[I+12>>2]=-1,O=I+16|0,m=I+29|0,h[O>>2]=0,h[O+4>>2]=0,h[O+8>>2]=0,He[O+12>>0]=0,He[m>>0]=He[E>>0]|0,He[m+1>>0]=He[E+1>>0]|0,He[m+2>>0]=He[E+2>>0]|0,m=4,O=9;else{if(m=fx(m)|0,m|0){M=I,h[M>>2]=0,h[M+4>>2]=0,h[I+8>>2]=m,h[I+12>>2]=-1,M=I+16|0,O=I+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(m=ra((h[d+8>>2]|0)+1|0,32)|0,!m){O=I,h[O>>2]=0,h[O+4>>2]=0,h[I+8>>2]=13,h[I+12>>2]=-1,O=I+16|0,m=I+29|0,h[O>>2]=0,h[O+4>>2]=0,h[O+8>>2]=0,He[O+12>>0]=0,He[m>>0]=He[E>>0]|0,He[m+1>>0]=He[E+1>>0]|0,He[m+2>>0]=He[E+2>>0]|0,m=13,O=9;break}D4(d,m),W=I,h[W>>2]=g,h[W+4>>2]=b,b=I+8|0,h[b>>2]=0,h[I+12>>2]=A,h[I+20>>2]=d,h[I+24>>2]=m,He[I+28>>0]=0,g=I+29|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,h[I+16>>2]=3,q=+Rre(m),q=q*+Mre(m),y=+Ns(+ +ne[m>>3]),y=q/+Qn(+ +iw(+y,+ +Ns(+ +ne[m+8>>3])))*6371.007180918475*6371.007180918475,g=I+12|0,m=h[g>>2]|0;e:do if((m|0)>0)do{if(R9(m+-1|0,M)|0,!(y/+ne[M>>3]>10))break e;W=h[g>>2]|0,m=W+-1|0,h[g>>2]=m}while((W|0)>1);while(!1);if(Kb(I),g=_,h[g>>2]=0,h[g+4>>2]=0,g=I,m=h[g>>2]|0,g=h[g+4>>2]|0,!((m|0)==0&(g|0)==0))do ax(m,g,A,M)|0,E=M,d=_,E=pt(h[d>>2]|0,h[d+4>>2]|0,h[E>>2]|0,h[E+4>>2]|0)|0,d=Q()|0,W=_,h[W>>2]=E,h[W+4>>2]=d,Kb(I),W=I,m=h[W>>2]|0,g=h[W+4>>2]|0;while(!((m|0)==0&(g|0)==0));m=h[b>>2]|0}while(!1);return W=m,Y=G,W|0}function hx(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;if(!(m9(A,m)|0)||(A=Cre(A)|0,_=+ne[m>>3],g=+ne[m+8>>3],g=A&g<0?g+6.283185307179586:g,q=h[d>>2]|0,(q|0)<=0))return q=0,q|0;if(G=h[d+4>>2]|0,A){A=0,O=g,m=-1,d=0;e:for(;;){for(I=d;b=+ne[G+(I<<4)>>3],g=+ne[G+(I<<4)+8>>3],d=(m+2|0)%(q|0)|0,y=+ne[G+(d<<4)>>3],E=+ne[G+(d<<4)+8>>3],b>y?(M=b,b=E):(M=y,y=b,b=g,g=E),_=_==y|_==M?_+2220446049250313e-31:_,!!(_<y|_>M);)if(m=I+1|0,(m|0)>=(q|0)){m=22;break e}else d=I,I=m,m=d;if(E=b<0?b+6.283185307179586:b,b=g<0?g+6.283185307179586:g,O=E==O|b==O?O+-2220446049250313e-31:O,M=E+(b-E)*((_-y)/(M-y)),(M<0?M+6.283185307179586:M)>O&&(A=A^1),d=I+1|0,(d|0)>=(q|0)){m=22;break}else m=I}if((m|0)==22)return A|0}else{A=0,O=g,m=-1,d=0;e:for(;;){for(I=d;b=+ne[G+(I<<4)>>3],g=+ne[G+(I<<4)+8>>3],d=(m+2|0)%(q|0)|0,y=+ne[G+(d<<4)>>3],E=+ne[G+(d<<4)+8>>3],b>y?(M=b,b=E):(M=y,y=b,b=g,g=E),_=_==y|_==M?_+2220446049250313e-31:_,!!(_<y|_>M);)if(m=I+1|0,(m|0)>=(q|0)){m=22;break e}else d=I,I=m,m=d;if(O=b==O|g==O?O+-2220446049250313e-31:O,b+(g-b)*((_-y)/(M-y))>O&&(A=A^1),d=I+1|0,(d|0)>=(q|0)){m=22;break}else m=I}if((m|0)==22)return A|0}return 0}function L9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0;if($=h[d>>2]|0,!$){h[A>>2]=0,h[A+4>>2]=0,h[A+8>>2]=0,h[A+12>>2]=0,h[A+16>>2]=0,h[A+20>>2]=0,h[A+24>>2]=0,h[A+28>>2]=0;return}if(oe=A+8|0,ne[oe>>3]=17976931348623157e292,ue=A+24|0,ne[ue>>3]=17976931348623157e292,ne[A>>3]=-17976931348623157e292,_e=A+16|0,ne[_e>>3]=-17976931348623157e292,!(($|0)<=0)){for(q=h[d+4>>2]|0,I=17976931348623157e292,O=-17976931348623157e292,G=0,d=-1,y=17976931348623157e292,b=17976931348623157e292,M=-17976931348623157e292,_=-17976931348623157e292,W=0;m=+ne[q+(W<<4)>>3],E=+ne[q+(W<<4)+8>>3],d=d+2|0,g=+ne[q+(((d|0)==($|0)?0:d)<<4)+8>>3],m<y&&(ne[oe>>3]=m,y=m),E<b&&(ne[ue>>3]=E,b=E),m>M?ne[A>>3]=m:m=M,E>_&&(ne[_e>>3]=E,_=E),I=E>0&E<I?E:I,O=E<0&E>O?E:O,G=G|+Ns(+(E-g))>3.141592653589793,d=W+1|0,(d|0)!=($|0);)re=W,M=m,W=d,d=re;G&&(ne[_e>>3]=O,ne[ue>>3]=I)}}function fx(d){return d=d|0,(d>>>0<4?0:15)|0}function D4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0;if($=h[d>>2]|0,$){if(oe=A+8|0,ne[oe>>3]=17976931348623157e292,ue=A+24|0,ne[ue>>3]=17976931348623157e292,ne[A>>3]=-17976931348623157e292,_e=A+16|0,ne[_e>>3]=-17976931348623157e292,($|0)>0){for(g=h[d+4>>2]|0,q=17976931348623157e292,W=-17976931348623157e292,_=0,m=-1,M=17976931348623157e292,I=17976931348623157e292,G=-17976931348623157e292,b=-17976931348623157e292,re=0;y=+ne[g+(re<<4)>>3],O=+ne[g+(re<<4)+8>>3],Ze=m+2|0,E=+ne[g+(((Ze|0)==($|0)?0:Ze)<<4)+8>>3],y<M&&(ne[oe>>3]=y,M=y),O<I&&(ne[ue>>3]=O,I=O),y>G?ne[A>>3]=y:y=G,O>b&&(ne[_e>>3]=O,b=O),q=O>0&O<q?O:q,W=O<0&O>W?O:W,_=_|+Ns(+(O-E))>3.141592653589793,m=re+1|0,(m|0)!=($|0);)Ze=re,G=y,re=m,m=Ze;_&&(ne[_e>>3]=W,ne[ue>>3]=q)}}else h[A>>2]=0,h[A+4>>2]=0,h[A+8>>2]=0,h[A+12>>2]=0,h[A+16>>2]=0,h[A+20>>2]=0,h[A+24>>2]=0,h[A+28>>2]=0;if(Ze=d+8|0,m=h[Ze>>2]|0,!((m|0)<=0)){Fe=d+12|0,me=0;do if(g=h[Fe>>2]|0,_=me,me=me+1|0,ue=A+(me<<5)|0,_e=h[g+(_<<3)>>2]|0,_e){if(re=A+(me<<5)+8|0,ne[re>>3]=17976931348623157e292,d=A+(me<<5)+24|0,ne[d>>3]=17976931348623157e292,ne[ue>>3]=-17976931348623157e292,be=A+(me<<5)+16|0,ne[be>>3]=-17976931348623157e292,(_e|0)>0){for($=h[g+(_<<3)+4>>2]|0,q=17976931348623157e292,W=-17976931348623157e292,g=0,_=-1,oe=0,M=17976931348623157e292,I=17976931348623157e292,O=-17976931348623157e292,b=-17976931348623157e292;y=+ne[$+(oe<<4)>>3],G=+ne[$+(oe<<4)+8>>3],_=_+2|0,E=+ne[$+(((_|0)==(_e|0)?0:_)<<4)+8>>3],y<M&&(ne[re>>3]=y,M=y),G<I&&(ne[d>>3]=G,I=G),y>O?ne[ue>>3]=y:y=O,G>b&&(ne[be>>3]=G,b=G),q=G>0&G<q?G:q,W=G<0&G>W?G:W,g=g|+Ns(+(G-E))>3.141592653589793,_=oe+1|0,(_|0)!=(_e|0);)Ee=oe,oe=_,O=y,_=Ee;g&&(ne[be>>3]=W,ne[d>>3]=q)}}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,m=h[Ze>>2]|0;while((me|0)<(m|0))}}function F4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if(!(hx(d,A,m)|0))return g=0,g|0;if(g=d+8|0,(h[g>>2]|0)<=0)return g=1,g|0;for(_=d+12|0,d=0;;){if(y=d,d=d+1|0,hx((h[_>>2]|0)+(y<<3)|0,A+(d<<5)|0,m)|0){d=0,_=6;break}if((d|0)>=(h[g>>2]|0)){d=1,_=6;break}}return(_|0)==6?d|0:0}function D9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(I=Y,Y=Y+16|0,E=I,b=m+8|0,!(hx(d,A,b)|0))return M=0,Y=I,M|0;M=d+8|0;e:do if((h[M>>2]|0)>0){for(y=d+12|0,g=0;;){if(O=g,g=g+1|0,hx((h[y>>2]|0)+(O<<3)|0,A+(g<<5)|0,b)|0){g=0;break}if((g|0)>=(h[M>>2]|0))break e}return Y=I,g|0}while(!1);if(Qb(d,A,m,_)|0)return O=0,Y=I,O|0;h[E>>2]=h[m>>2],h[E+4>>2]=b,g=h[M>>2]|0;e:do if((g|0)>0)for(d=d+12|0,b=0,y=g;;){if(g=h[d>>2]|0,(h[g+(b<<3)>>2]|0)>0){if(hx(E,_,h[g+(b<<3)+4>>2]|0)|0){g=0;break e}if(g=b+1|0,Qb((h[d>>2]|0)+(b<<3)|0,A+(g<<5)|0,m,_)|0){g=0;break e}y=h[M>>2]|0}else g=b+1|0;if((g|0)<(y|0))b=g;else{g=1;break}}else g=1;while(!1);return O=g,Y=I,O|0}function Qb(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0;if(Ze=Y,Y=Y+176|0,re=Ze+172|0,g=Ze+168|0,be=Ze,!(_4(A,_)|0))return d=0,Y=Ze,d|0;if(Pre(A,_,re,g),bc(be|0,m|0,168)|0,(h[m>>2]|0)>0){A=0;do Ee=be+8+(A<<4)+8|0,_e=+ll(+ne[Ee>>3],h[g>>2]|0),ne[Ee>>3]=_e,A=A+1|0;while((A|0)<(h[m>>2]|0))}oe=+ne[_>>3],ue=+ne[_+8>>3],_e=+ll(+ne[_+16>>3],h[g>>2]|0),W=+ll(+ne[_+24>>3],h[g>>2]|0);e:do if((h[d>>2]|0)>0){if(_=d+4|0,g=h[be>>2]|0,(g|0)<=0){for(A=0;;)if(A=A+1|0,(A|0)>=(h[d>>2]|0)){A=0;break e}}for(m=0;;){if(A=h[_>>2]|0,q=+ne[A+(m<<4)>>3],$=+ll(+ne[A+(m<<4)+8>>3],h[re>>2]|0),A=h[_>>2]|0,m=m+1|0,Ee=(m|0)%(h[d>>2]|0)|0,y=+ne[A+(Ee<<4)>>3],b=+ll(+ne[A+(Ee<<4)+8>>3],h[re>>2]|0),!(q>=oe)|!(y>=oe)&&!(q<=ue)|!(y<=ue)&&!($<=W)|!(b<=W)&&!($>=_e)|!(b>=_e)){G=y-q,I=b-$,A=0;do if(ye=A,A=A+1|0,Ee=(A|0)==(g|0)?0:A,y=+ne[be+8+(ye<<4)+8>>3],b=+ne[be+8+(Ee<<4)+8>>3]-y,E=+ne[be+8+(ye<<4)>>3],M=+ne[be+8+(Ee<<4)>>3]-E,O=G*b-I*M,O!=0&&(me=$-y,Fe=q-E,M=(me*M-b*Fe)/O,!(M<0|M>1))&&(O=(G*me-I*Fe)/O,O>=0&O<=1)){A=1;break e}while((A|0)<(g|0))}if((m|0)>=(h[d>>2]|0)){A=0;break}}}else A=0;while(!1);return ye=A,Y=Ze,ye|0}function F9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;if(Qb(d,A,m,_)|0)return y=1,y|0;if(y=d+8|0,(h[y>>2]|0)<=0)return y=0,y|0;for(g=d+12|0,d=0;;){if(b=d,d=d+1|0,Qb((h[g>>2]|0)+(b<<3)|0,A+(d<<5)|0,m,_)|0){d=1,g=6;break}if((d|0)>=(h[y>>2]|0)){d=0,g=6;break}}return(g|0)==6?d|0:0}function bse(){return 8}function wse(){return 16}function Sse(){return 168}function Tse(){return 8}function Ese(){return 16}function Mse(){return 12}function Cse(){return 8}function Rse(d){return d=d|0,+(+((h[d>>2]|0)>>>0)+4294967296*+(h[d+4>>2]|0))}function Pse(d){d=d|0;var A=0,m=0;return m=+ne[d>>3],A=+ne[d+8>>3],+ +is(+(m*m+A*A))}function O9(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;I=+ne[d>>3],M=+ne[A>>3]-I,E=+ne[d+8>>3],b=+ne[A+8>>3]-E,G=+ne[m>>3],y=+ne[_>>3]-G,q=+ne[m+8>>3],O=+ne[_+8>>3]-q,y=(y*(E-q)-(I-G)*O)/(M*O-b*y),ne[g>>3]=I+M*y,ne[g+8>>3]=E+b*y}function B9(d,A){return d=d|0,A=A|0,+Ns(+(+ne[d>>3]-+ne[A>>3]))<11920928955078125e-23?(A=+Ns(+(+ne[d+8>>3]-+ne[A+8>>3]))<11920928955078125e-23,A|0):(A=0,A|0)}function Ise(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if(y=Y,Y=Y+16|0,g=y,_=ki(d,A)|0,(m+-1|0)>>>0>5||(_=(_|0)!=0,(m|0)==1&_))return g=-1,Y=y,g|0;do if(dx(d,A,g)|0)_=-1;else if(_){_=((h[26416+(m<<2)>>2]|0)+5-(h[g>>2]|0)|0)%5|0;break}else{_=((h[26448+(m<<2)>>2]|0)+6-(h[g>>2]|0)|0)%6|0;break}while(!1);return g=_,Y=y,g|0}function dx(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(O=Y,Y=Y+32|0,E=O+16|0,M=O,_=ng(d,A,E)|0,_|0)return m=_,Y=O,m|0;y=S9(d,A)|0,I=Oa(d,A)|0,wre(y,M),_=Sre(y,h[E>>2]|0)|0;do if(ar(y)|0){do switch(y|0){case 4:{g=0;break}case 14:{g=1;break}case 24:{g=2;break}case 38:{g=3;break}case 49:{g=4;break}case 58:{g=5;break}case 63:{g=6;break}case 72:{g=7;break}case 83:{g=8;break}case 97:{g=9;break}case 107:{g=10;break}case 117:{g=11;break}default:li(27634,27636,75,27645)}while(!1);if(b=h[26480+(g*24|0)+8>>2]|0,A=h[26480+(g*24|0)+16>>2]|0,d=h[E>>2]|0,(d|0)!=(h[M>>2]|0)&&(M=A4(y)|0,d=h[E>>2]|0,M|(d|0)==(A|0)&&(_=(_+1|0)%6|0)),(I|0)==3&(d|0)==(A|0)){_=(_+5|0)%6|0;break}(I|0)==5&(d|0)==(b|0)&&(_=(_+1|0)%6|0)}while(!1);return h[m>>2]=_,m=0,Y=O,m|0}function Vl(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0;if(be=Y,Y=Y+32|0,re=be+24|0,ue=be+20|0,$=be+8|0,W=be+16|0,q=be,M=(ki(d,A)|0)==0,M=M?6:5,O=et(d|0,A|0,52)|0,Q()|0,O=O&15,M>>>0<=m>>>0)return _=2,Y=be,_|0;G=(O|0)==0,!G&&(oe=ht(7,0,(O^15)*3|0)|0,(oe&d|0)==0&((Q()|0)&A|0)==0)?g=m:y=4;e:do if((y|0)==4){if(g=(ki(d,A)|0)!=0,((g?4:5)|0)<(m|0)||dx(d,A,re)|0||(y=(h[re>>2]|0)+m|0,g?g=26768+(((y|0)%5|0)<<2)|0:g=26800+(((y|0)%6|0)<<2)|0,oe=h[g>>2]|0,(oe|0)==7))return _=1,Y=be,_|0;h[ue>>2]=0,g=Ls(d,A,oe,ue,$)|0;do if(!g){if(E=$,I=h[E>>2]|0,E=h[E+4>>2]|0,b=E>>>0<A>>>0|(E|0)==(A|0)&I>>>0<d>>>0,y=b?I:d,b=b?E:A,!G&&(G=ht(7,0,(O^15)*3|0)|0,(I&G|0)==0&(E&(Q()|0)|0)==0))g=m;else{if(E=(m+-1+M|0)%(M|0)|0,g=ki(d,A)|0,(E|0)<0&&li(27634,27636,248,27661),M=(g|0)!=0,((M?4:5)|0)<(E|0)&&li(27634,27636,248,27661),dx(d,A,re)|0&&li(27634,27636,248,27661),g=(h[re>>2]|0)+E|0,M?g=26768+(((g|0)%5|0)<<2)|0:g=26800+(((g|0)%6|0)<<2)|0,E=h[g>>2]|0,(E|0)==7&&li(27634,27636,248,27661),h[W>>2]=0,g=Ls(d,A,E,W,q)|0,g|0)break;I=q,M=h[I>>2]|0,I=h[I+4>>2]|0;do if(I>>>0<b>>>0|(I|0)==(b|0)&M>>>0<y>>>0){if(ki(M,I)|0?y=Xb(M,I,d,A)|0:y=h[26864+((((h[W>>2]|0)+(h[26832+(E<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,g=ki(M,I)|0,(y+-1|0)>>>0>5){g=-1,y=M,b=I;break}if(g=(g|0)!=0,(y|0)==1&g){g=-1,y=M,b=I;break}do if(dx(M,I,re)|0)g=-1;else if(g){g=((h[26416+(y<<2)>>2]|0)+5-(h[re>>2]|0)|0)%5|0;break}else{g=((h[26448+(y<<2)>>2]|0)+6-(h[re>>2]|0)|0)%6|0;break}while(!1);y=M,b=I}else g=m;while(!1);E=$,I=h[E>>2]|0,E=h[E+4>>2]|0}if((y|0)==(I|0)&(b|0)==(E|0)){if(M=(ki(I,E)|0)!=0,M?d=Xb(I,E,d,A)|0:d=h[26864+((((h[ue>>2]|0)+(h[26832+(oe<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,g=ki(I,E)|0,(d+-1|0)>>>0<=5&&(_e=(g|0)!=0,!((d|0)==1&_e)))do if(dx(I,E,re)|0)g=-1;else if(_e){g=((h[26416+(d<<2)>>2]|0)+5-(h[re>>2]|0)|0)%5|0;break}else{g=((h[26448+(d<<2)>>2]|0)+6-(h[re>>2]|0)|0)%6|0;break}while(!1);else g=-1;g=g+1|0,g=(g|0)==6|M&(g|0)==5?0:g}A=b,d=y;break e}while(!1);return _=g,Y=be,_|0}while(!1);return _e=ht(g|0,0,56)|0,re=Q()|0|A&-2130706433|536870912,h[_>>2]=_e|d,h[_+4>>2]=re,_=0,Y=be,_|0}function Nse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;return y=(ki(d,A)|0)==0,_=Vl(d,A,0,m)|0,g=(_|0)==0,y?!g||(_=Vl(d,A,1,m+8|0)|0,_|0)||(_=Vl(d,A,2,m+16|0)|0,_|0)||(_=Vl(d,A,3,m+24|0)|0,_|0)||(_=Vl(d,A,4,m+32|0)|0,_)?(y=_,y|0):Vl(d,A,5,m+40|0)|0:!g||(_=Vl(d,A,1,m+8|0)|0,_|0)||(_=Vl(d,A,2,m+16|0)|0,_|0)||(_=Vl(d,A,3,m+24|0)|0,_|0)||(_=Vl(d,A,4,m+32|0)|0,_|0)?(y=_,y|0):(y=m+40|0,h[y>>2]=0,h[y+4>>2]=0,y=0,y|0)}function Lse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0;return M=Y,Y=Y+192|0,g=M,y=M+168|0,b=et(d|0,A|0,56)|0,Q()|0,b=b&7,E=A&-2130706433|134217728,_=ng(d,E,y)|0,_|0?(E=_,Y=M,E|0):(A=et(d|0,A|0,52)|0,Q()|0,A=A&15,ki(d,E)|0?y4(y,A,b,1,g):v4(y,A,b,1,g),E=g+8|0,h[m>>2]=h[E>>2],h[m+4>>2]=h[E+4>>2],h[m+8>>2]=h[E+8>>2],h[m+12>>2]=h[E+12>>2],E=0,Y=M,E|0)}function U9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return g=Y,Y=Y+16|0,m=g,!(!0&(A&2013265920|0)==536870912)||(_=A&-2130706433|134217728,!(Yb(d,_)|0))?(_=0,Y=g,_|0):(y=et(d|0,A|0,56)|0,Q()|0,y=(Vl(d,_,y&7,m)|0)==0,_=m,_=y&((h[_>>2]|0)==(d|0)?(h[_+4>>2]|0)==(A|0):0)&1,Y=g,_|0)}function k9(){return 27680}function Jb(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;G=Y,Y=Y+208|0,M=G,I=G+192|0,b=Fa(m,A)|0,E=I,h[E>>2]=1,h[E+4>>2]=0;e:do if(b|0){for(E=0-m|0,h[M+4>>2]=m,h[M>>2]=m,g=2,A=m,y=m;A=A+m+y|0,h[M+(g<<2)>>2]=A,A>>>0<b>>>0;)q=y,g=g+1|0,y=A,A=q;if(y=d+b+E|0,y>>>0>d>>>0){b=y,g=1,A=1;do{do if((A&3|0)!=3)if(A=g+-1|0,(h[M+(A<<2)>>2]|0)>>>0<(b-d|0)>>>0?O4(d,m,_,g,M):tw(d,m,_,I,g,0,M),(g|0)==1){nw(I,1),g=0;break}else{nw(I,A),g=1;break}else O4(d,m,_,g,M),ew(I,2),g=g+2|0;while(!1);A=h[I>>2]|1,h[I>>2]=A,d=d+m|0}while(d>>>0<y>>>0)}else g=1,A=1;for(tw(d,m,_,I,g,0,M),y=I+4|0;;){if((g|0)==1&(A|0)==1)if(h[y>>2]|0)O=19;else break e;else(g|0)<2?O=19:(nw(I,2),q=g+-2|0,h[I>>2]=h[I>>2]^7,ew(I,1),tw(d+(0-(h[M+(q<<2)>>2]|0))+E|0,m,_,I,g+-1|0,1,M),nw(I,1),A=h[I>>2]|1,h[I>>2]=A,d=d+E|0,tw(d,m,_,I,q,1,M),g=q);(O|0)==19&&(O=0,A=G9(I)|0,ew(I,A),d=d+E|0,g=A+g|0,A=h[I>>2]|0)}}while(!1);Y=G}function O4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0;G=Y,Y=Y+240|0,O=G,h[O>>2]=d;e:do if((_|0)>1)for(I=0-A|0,E=d,y=_,_=1,b=d;;){if(E=E+I|0,M=y+-2|0,d=E+(0-(h[g+(M<<2)>>2]|0))|0,(dd[m&3](b,d)|0)>-1&&(dd[m&3](b,E)|0)>-1||(b=O+(_<<2)|0,(dd[m&3](d,E)|0)>-1?(h[b>>2]=d,y=y+-1|0):(h[b>>2]=E,d=E,y=M),_=_+1|0,(y|0)<=1))break e;E=d,b=h[O>>2]|0}else _=1;while(!1);V9(A,O,_),Y=G}function ew(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;g=d+4|0,A>>>0>31?(_=h[g>>2]|0,h[d>>2]=_,h[g>>2]=0,A=A+-32|0,m=0):(m=h[g>>2]|0,_=h[d>>2]|0),h[d>>2]=m<<32-A|_>>>A,h[g>>2]=m>>>A}function tw(d,A,m,_,g,y,b){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0;var E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;W=Y,Y=Y+240|0,G=W+232|0,q=W,$=h[_>>2]|0,h[G>>2]=$,M=h[_+4>>2]|0,I=G+4|0,h[I>>2]=M,h[q>>2]=d;e:do if(($|0)!=1|(M|0)!=0&&(O=0-A|0,E=d+(0-(h[b+(g<<2)>>2]|0))|0,(dd[m&3](E,d)|0)>=1))for(_=1,y=(y|0)==0,M=E;;){if(y&(g|0)>1){if(y=d+O|0,E=h[b+(g+-2<<2)>>2]|0,(dd[m&3](y,M)|0)>-1){E=10;break e}if((dd[m&3](y+(0-E)|0,M)|0)>-1){E=10;break e}}if(y=_+1|0,h[q+(_<<2)>>2]=M,$=G9(G)|0,ew(G,$),g=$+g|0,!((h[G>>2]|0)!=1|(h[I>>2]|0)!=0)){_=y,d=M,E=10;break e}if(d=M+(0-(h[b+(g<<2)>>2]|0))|0,(dd[m&3](d,h[q>>2]|0)|0)<1){d=M,_=y,y=0,E=9;break}else $=M,_=y,y=1,M=d,d=$}else _=1,E=9;while(!1);(E|0)==9&&(y|0)==0&&(E=10),(E|0)==10&&(V9(A,q,_),O4(d,A,m,g,b)),Y=W}function nw(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;g=d+4|0,A>>>0>31?(_=h[d>>2]|0,h[g>>2]=_,h[d>>2]=0,A=A+-32|0,m=0):(m=h[d>>2]|0,_=h[g>>2]|0),h[g>>2]=m>>>(32-A|0)|_<<A,h[d>>2]=m<<A}function G9(d){d=d|0;var A=0;return A=z9((h[d>>2]|0)+-1|0)|0,A?A|0:(A=z9(h[d+4>>2]|0)|0,((A|0)==0?0:A+32|0)|0)}function z9(d){d=d|0;var A=0;if(d)if(d&1)d=0;else for(A=d,d=0;d=d+1|0,!(A&2);)A=A>>>1;else d=32;return d|0}function V9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0;b=Y,Y=Y+256|0,_=b;e:do if((m|0)>=2&&(y=A+(m<<2)|0,h[y>>2]=_,d|0))for(;;){g=d>>>0<256?d:256,bc(_|0,h[A>>2]|0,g|0)|0,_=0;do E=A+(_<<2)|0,_=_+1|0,bc(h[E>>2]|0,h[A+(_<<2)>>2]|0,g|0)|0,h[E>>2]=(h[E>>2]|0)+g;while((_|0)!=(m|0));if(d=d-g|0,!d)break e;_=h[y>>2]|0}while(!1);Y=b}function Au(d){return d=+d,~~+X9(+d)|0}function lr(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0;Fe=Y,Y=Y+16|0,q=Fe;do if(d>>>0<245){if(I=d>>>0<11?16:d+11&-8,d=I>>>3,G=h[6921]|0,m=G>>>d,m&3|0)return A=(m&1^1)+d|0,d=27724+(A<<1<<2)|0,m=d+8|0,_=h[m>>2]|0,g=_+8|0,y=h[g>>2]|0,(y|0)==(d|0)?h[6921]=G&~(1<<A):(h[y+12>>2]=d,h[m>>2]=y),me=A<<3,h[_+4>>2]=me|3,me=_+me+4|0,h[me>>2]=h[me>>2]|1,me=g,Y=Fe,me|0;if(O=h[6923]|0,I>>>0>O>>>0){if(m|0)return A=2<<d,A=m<<d&(A|0-A),A=(A&0-A)+-1|0,E=A>>>12&16,A=A>>>E,m=A>>>5&8,A=A>>>m,y=A>>>2&4,A=A>>>y,d=A>>>1&2,A=A>>>d,_=A>>>1&1,_=(m|E|y|d|_)+(A>>>_)|0,A=27724+(_<<1<<2)|0,d=A+8|0,y=h[d>>2]|0,E=y+8|0,m=h[E>>2]|0,(m|0)==(A|0)?(d=G&~(1<<_),h[6921]=d):(h[m+12>>2]=A,h[d>>2]=m,d=G),me=_<<3,b=me-I|0,h[y+4>>2]=I|3,g=y+I|0,h[g+4>>2]=b|1,h[y+me>>2]=b,O|0&&(_=h[6926]|0,A=O>>>3,m=27724+(A<<1<<2)|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=_,h[A+12>>2]=_,h[_+8>>2]=A,h[_+12>>2]=m),h[6923]=b,h[6926]=g,me=E,Y=Fe,me|0;if(y=h[6922]|0,y){for(m=(y&0-y)+-1|0,g=m>>>12&16,m=m>>>g,_=m>>>5&8,m=m>>>_,b=m>>>2&4,m=m>>>b,E=m>>>1&2,m=m>>>E,M=m>>>1&1,M=h[27988+((_|g|b|E|M)+(m>>>M)<<2)>>2]|0,m=M,E=M,M=(h[M+4>>2]&-8)-I|0;d=h[m+16>>2]|0,!(!d&&(d=h[m+20>>2]|0,!d));)b=(h[d+4>>2]&-8)-I|0,g=b>>>0<M>>>0,m=d,E=g?d:E,M=g?b:M;if(b=E+I|0,b>>>0>E>>>0){g=h[E+24>>2]|0,A=h[E+12>>2]|0;do if((A|0)==(E|0)){if(d=E+20|0,A=h[d>>2]|0,!A&&(d=E+16|0,A=h[d>>2]|0,!A)){m=0;break}for(;;)if(_=A+20|0,m=h[_>>2]|0,m)A=m,d=_;else if(_=A+16|0,m=h[_>>2]|0,m)A=m,d=_;else break;h[d>>2]=0,m=A}else m=h[E+8>>2]|0,h[m+12>>2]=A,h[A+8>>2]=m,m=A;while(!1);do if(g|0){if(A=h[E+28>>2]|0,d=27988+(A<<2)|0,(E|0)==(h[d>>2]|0)){if(h[d>>2]=m,!m){h[6922]=y&~(1<<A);break}}else if(me=g+16|0,h[((h[me>>2]|0)==(E|0)?me:g+20|0)>>2]=m,!m)break;h[m+24>>2]=g,A=h[E+16>>2]|0,A|0&&(h[m+16>>2]=A,h[A+24>>2]=m),A=h[E+20>>2]|0,A|0&&(h[m+20>>2]=A,h[A+24>>2]=m)}while(!1);return M>>>0<16?(me=M+I|0,h[E+4>>2]=me|3,me=E+me+4|0,h[me>>2]=h[me>>2]|1):(h[E+4>>2]=I|3,h[b+4>>2]=M|1,h[b+M>>2]=M,O|0&&(_=h[6926]|0,A=O>>>3,m=27724+(A<<1<<2)|0,A=1<<A,A&G?(d=m+8|0,A=h[d>>2]|0):(h[6921]=A|G,A=m,d=m+8|0),h[d>>2]=_,h[A+12>>2]=_,h[_+8>>2]=A,h[_+12>>2]=m),h[6923]=M,h[6926]=b),me=E+8|0,Y=Fe,me|0}else G=I}else G=I}else G=I}else if(d>>>0<=4294967231)if(d=d+11|0,I=d&-8,_=h[6922]|0,_){g=0-I|0,d=d>>>8,d?I>>>0>16777215?M=31:(G=(d+1048320|0)>>>16&8,oe=d<<G,E=(oe+520192|0)>>>16&4,oe=oe<<E,M=(oe+245760|0)>>>16&2,M=14-(E|G|M)+(oe<<M>>>15)|0,M=I>>>(M+7|0)&1|M<<1):M=0,m=h[27988+(M<<2)>>2]|0;e:do if(!m)m=0,d=0,oe=61;else for(d=0,E=I<<((M|0)==31?0:25-(M>>>1)|0),y=0;;){if(b=(h[m+4>>2]&-8)-I|0,b>>>0<g>>>0)if(b)d=m,g=b;else{d=m,g=0,oe=65;break e}if(oe=h[m+20>>2]|0,m=h[m+16+(E>>>31<<2)>>2]|0,y=(oe|0)==0|(oe|0)==(m|0)?y:oe,m)E=E<<1;else{m=y,oe=61;break}}while(!1);if((oe|0)==61){if((m|0)==0&(d|0)==0){if(d=2<<M,d=(d|0-d)&_,!d){G=I;break}G=(d&0-d)+-1|0,b=G>>>12&16,G=G>>>b,y=G>>>5&8,G=G>>>y,E=G>>>2&4,G=G>>>E,M=G>>>1&2,G=G>>>M,m=G>>>1&1,d=0,m=h[27988+((y|b|E|M|m)+(G>>>m)<<2)>>2]|0}m?oe=65:(E=d,b=g)}if((oe|0)==65)for(y=m;;)if(G=(h[y+4>>2]&-8)-I|0,m=G>>>0<g>>>0,g=m?G:g,d=m?y:d,m=h[y+16>>2]|0,m||(m=h[y+20>>2]|0),m)y=m;else{E=d,b=g;break}if((E|0)!=0&&b>>>0<((h[6923]|0)-I|0)>>>0&&(O=E+I|0,O>>>0>E>>>0)){y=h[E+24>>2]|0,A=h[E+12>>2]|0;do if((A|0)==(E|0)){if(d=E+20|0,A=h[d>>2]|0,!A&&(d=E+16|0,A=h[d>>2]|0,!A)){A=0;break}for(;;)if(g=A+20|0,m=h[g>>2]|0,m)A=m,d=g;else if(g=A+16|0,m=h[g>>2]|0,m)A=m,d=g;else break;h[d>>2]=0}else me=h[E+8>>2]|0,h[me+12>>2]=A,h[A+8>>2]=me;while(!1);do if(y){if(d=h[E+28>>2]|0,m=27988+(d<<2)|0,(E|0)==(h[m>>2]|0)){if(h[m>>2]=A,!A){_=_&~(1<<d),h[6922]=_;break}}else if(me=y+16|0,h[((h[me>>2]|0)==(E|0)?me:y+20|0)>>2]=A,!A)break;h[A+24>>2]=y,d=h[E+16>>2]|0,d|0&&(h[A+16>>2]=d,h[d+24>>2]=A),d=h[E+20>>2]|0,d&&(h[A+20>>2]=d,h[d+24>>2]=A)}while(!1);e:do if(b>>>0<16)me=b+I|0,h[E+4>>2]=me|3,me=E+me+4|0,h[me>>2]=h[me>>2]|1;else{if(h[E+4>>2]=I|3,h[O+4>>2]=b|1,h[O+b>>2]=b,A=b>>>3,b>>>0<256){m=27724+(A<<1<<2)|0,d=h[6921]|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=O,h[A+12>>2]=O,h[O+8>>2]=A,h[O+12>>2]=m;break}if(A=b>>>8,A?b>>>0>16777215?m=31:(be=(A+1048320|0)>>>16&8,me=A<<be,re=(me+520192|0)>>>16&4,me=me<<re,m=(me+245760|0)>>>16&2,m=14-(re|be|m)+(me<<m>>>15)|0,m=b>>>(m+7|0)&1|m<<1):m=0,A=27988+(m<<2)|0,h[O+28>>2]=m,d=O+16|0,h[d+4>>2]=0,h[d>>2]=0,d=1<<m,!(_&d)){h[6922]=_|d,h[A>>2]=O,h[O+24>>2]=A,h[O+12>>2]=O,h[O+8>>2]=O;break}A=h[A>>2]|0;t:do if((h[A+4>>2]&-8|0)!=(b|0)){for(_=b<<((m|0)==31?0:25-(m>>>1)|0);m=A+16+(_>>>31<<2)|0,d=h[m>>2]|0,!!d;)if((h[d+4>>2]&-8|0)==(b|0)){A=d;break t}else _=_<<1,A=d;h[m>>2]=O,h[O+24>>2]=A,h[O+12>>2]=O,h[O+8>>2]=O;break e}while(!1);be=A+8|0,me=h[be>>2]|0,h[me+12>>2]=O,h[be>>2]=O,h[O+8>>2]=me,h[O+12>>2]=A,h[O+24>>2]=0}while(!1);return me=E+8|0,Y=Fe,me|0}else G=I}else G=I;else G=-1;while(!1);if(m=h[6923]|0,m>>>0>=G>>>0)return A=m-G|0,d=h[6926]|0,A>>>0>15?(me=d+G|0,h[6926]=me,h[6923]=A,h[me+4>>2]=A|1,h[d+m>>2]=A,h[d+4>>2]=G|3):(h[6923]=0,h[6926]=0,h[d+4>>2]=m|3,me=d+m+4|0,h[me>>2]=h[me>>2]|1),me=d+8|0,Y=Fe,me|0;if(b=h[6924]|0,b>>>0>G>>>0)return re=b-G|0,h[6924]=re,me=h[6927]|0,be=me+G|0,h[6927]=be,h[be+4>>2]=re|1,h[me+4>>2]=G|3,me=me+8|0,Y=Fe,me|0;if(h[7039]|0?d=h[7041]|0:(h[7041]=4096,h[7040]=4096,h[7042]=-1,h[7043]=-1,h[7044]=0,h[7032]=0,h[7039]=q&-16^1431655768,d=4096),E=G+48|0,M=G+47|0,y=d+M|0,g=0-d|0,I=y&g,I>>>0<=G>>>0||(d=h[7031]|0,d|0&&(O=h[7029]|0,q=O+I|0,q>>>0<=O>>>0|q>>>0>d>>>0)))return me=0,Y=Fe,me|0;e:do if(h[7032]&4)A=0,oe=143;else{m=h[6927]|0;t:do if(m){for(_=28132;q=h[_>>2]|0,!(q>>>0<=m>>>0&&(q+(h[_+4>>2]|0)|0)>>>0>m>>>0);)if(d=h[_+8>>2]|0,d)_=d;else{oe=128;break t}if(A=y-b&g,A>>>0<2147483647)if(d=fd(A|0)|0,(d|0)==((h[_>>2]|0)+(h[_+4>>2]|0)|0)){if((d|0)!=-1){b=A,y=d,oe=145;break e}}else _=d,oe=136;else A=0}else oe=128;while(!1);do if((oe|0)==128)if(m=fd(0)|0,(m|0)!=-1&&(A=m,W=h[7040]|0,$=W+-1|0,A=(($&A|0)==0?0:($+A&0-W)-A|0)+I|0,W=h[7029]|0,$=A+W|0,A>>>0>G>>>0&A>>>0<2147483647)){if(q=h[7031]|0,q|0&&$>>>0<=W>>>0|$>>>0>q>>>0){A=0;break}if(d=fd(A|0)|0,(d|0)==(m|0)){b=A,y=m,oe=145;break e}else _=d,oe=136}else A=0;while(!1);do if((oe|0)==136){if(m=0-A|0,!(E>>>0>A>>>0&(A>>>0<2147483647&(_|0)!=-1)))if((_|0)==-1){A=0;break}else{b=A,y=_,oe=145;break e}if(d=h[7041]|0,d=M-A+d&0-d,d>>>0>=2147483647){b=A,y=_,oe=145;break e}if((fd(d|0)|0)==-1){fd(m|0)|0,A=0;break}else{b=d+A|0,y=_,oe=145;break e}}while(!1);h[7032]=h[7032]|4,oe=143}while(!1);if((oe|0)==143&&I>>>0<2147483647&&(re=fd(I|0)|0,$=fd(0)|0,ue=$-re|0,_e=ue>>>0>(G+40|0)>>>0,!((re|0)==-1|_e^1|re>>>0<$>>>0&((re|0)!=-1&($|0)!=-1)^1))&&(b=_e?ue:A,y=re,oe=145),(oe|0)==145){A=(h[7029]|0)+b|0,h[7029]=A,A>>>0>(h[7030]|0)>>>0&&(h[7030]=A),M=h[6927]|0;e:do if(M){for(A=28132;;){if(d=h[A>>2]|0,m=h[A+4>>2]|0,(y|0)==(d+m|0)){oe=154;break}if(_=h[A+8>>2]|0,_)A=_;else break}if((oe|0)==154&&(be=A+4|0,(h[A+12>>2]&8|0)==0)&&y>>>0>M>>>0&d>>>0<=M>>>0){h[be>>2]=m+b,me=(h[6924]|0)+b|0,re=M+8|0,re=(re&7|0)==0?0:0-re&7,be=M+re|0,re=me-re|0,h[6927]=be,h[6924]=re,h[be+4>>2]=re|1,h[M+me+4>>2]=40,h[6928]=h[7043];break}for(y>>>0<(h[6925]|0)>>>0&&(h[6925]=y),m=y+b|0,A=28132;;){if((h[A>>2]|0)==(m|0)){oe=162;break}if(d=h[A+8>>2]|0,d)A=d;else break}if((oe|0)==162&&(h[A+12>>2]&8|0)==0){h[A>>2]=y,O=A+4|0,h[O>>2]=(h[O>>2]|0)+b,O=y+8|0,O=y+((O&7|0)==0?0:0-O&7)|0,A=m+8|0,A=m+((A&7|0)==0?0:0-A&7)|0,I=O+G|0,E=A-O-G|0,h[O+4>>2]=G|3;t:do if((M|0)==(A|0))me=(h[6924]|0)+E|0,h[6924]=me,h[6927]=I,h[I+4>>2]=me|1;else{if((h[6926]|0)==(A|0)){me=(h[6923]|0)+E|0,h[6923]=me,h[6926]=I,h[I+4>>2]=me|1,h[I+me>>2]=me;break}if(d=h[A+4>>2]|0,(d&3|0)==1){b=d&-8,_=d>>>3;n:do if(d>>>0<256)if(d=h[A+8>>2]|0,m=h[A+12>>2]|0,(m|0)==(d|0)){h[6921]=h[6921]&~(1<<_);break}else{h[d+12>>2]=m,h[m+8>>2]=d;break}else{y=h[A+24>>2]|0,d=h[A+12>>2]|0;do if((d|0)==(A|0)){if(m=A+16|0,_=m+4|0,d=h[_>>2]|0,d)m=_;else if(d=h[m>>2]|0,!d){d=0;break}for(;;)if(g=d+20|0,_=h[g>>2]|0,_)d=_,m=g;else if(g=d+16|0,_=h[g>>2]|0,_)d=_,m=g;else break;h[m>>2]=0}else me=h[A+8>>2]|0,h[me+12>>2]=d,h[d+8>>2]=me;while(!1);if(!y)break;m=h[A+28>>2]|0,_=27988+(m<<2)|0;do if((h[_>>2]|0)!=(A|0)){if(me=y+16|0,h[((h[me>>2]|0)==(A|0)?me:y+20|0)>>2]=d,!d)break n}else{if(h[_>>2]=d,d|0)break;h[6922]=h[6922]&~(1<<m);break n}while(!1);if(h[d+24>>2]=y,m=A+16|0,_=h[m>>2]|0,_|0&&(h[d+16>>2]=_,h[_+24>>2]=d),m=h[m+4>>2]|0,!m)break;h[d+20>>2]=m,h[m+24>>2]=d}while(!1);A=A+b|0,g=b+E|0}else g=E;if(A=A+4|0,h[A>>2]=h[A>>2]&-2,h[I+4>>2]=g|1,h[I+g>>2]=g,A=g>>>3,g>>>0<256){m=27724+(A<<1<<2)|0,d=h[6921]|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=I,h[A+12>>2]=I,h[I+8>>2]=A,h[I+12>>2]=m;break}A=g>>>8;do if(!A)_=0;else{if(g>>>0>16777215){_=31;break}be=(A+1048320|0)>>>16&8,me=A<<be,re=(me+520192|0)>>>16&4,me=me<<re,_=(me+245760|0)>>>16&2,_=14-(re|be|_)+(me<<_>>>15)|0,_=g>>>(_+7|0)&1|_<<1}while(!1);if(A=27988+(_<<2)|0,h[I+28>>2]=_,d=I+16|0,h[d+4>>2]=0,h[d>>2]=0,d=h[6922]|0,m=1<<_,!(d&m)){h[6922]=d|m,h[A>>2]=I,h[I+24>>2]=A,h[I+12>>2]=I,h[I+8>>2]=I;break}A=h[A>>2]|0;n:do if((h[A+4>>2]&-8|0)!=(g|0)){for(_=g<<((_|0)==31?0:25-(_>>>1)|0);m=A+16+(_>>>31<<2)|0,d=h[m>>2]|0,!!d;)if((h[d+4>>2]&-8|0)==(g|0)){A=d;break n}else _=_<<1,A=d;h[m>>2]=I,h[I+24>>2]=A,h[I+12>>2]=I,h[I+8>>2]=I;break t}while(!1);be=A+8|0,me=h[be>>2]|0,h[me+12>>2]=I,h[be>>2]=I,h[I+8>>2]=me,h[I+12>>2]=A,h[I+24>>2]=0}while(!1);return me=O+8|0,Y=Fe,me|0}for(A=28132;d=h[A>>2]|0,!(d>>>0<=M>>>0&&(me=d+(h[A+4>>2]|0)|0,me>>>0>M>>>0));)A=h[A+8>>2]|0;g=me+-47|0,d=g+8|0,d=g+((d&7|0)==0?0:0-d&7)|0,g=M+16|0,d=d>>>0<g>>>0?M:d,A=d+8|0,m=b+-40|0,re=y+8|0,re=(re&7|0)==0?0:0-re&7,be=y+re|0,re=m-re|0,h[6927]=be,h[6924]=re,h[be+4>>2]=re|1,h[y+m+4>>2]=40,h[6928]=h[7043],m=d+4|0,h[m>>2]=27,h[A>>2]=h[7033],h[A+4>>2]=h[7034],h[A+8>>2]=h[7035],h[A+12>>2]=h[7036],h[7033]=y,h[7034]=b,h[7036]=0,h[7035]=A,A=d+24|0;do be=A,A=A+4|0,h[A>>2]=7;while((be+8|0)>>>0<me>>>0);if((d|0)!=(M|0)){if(y=d-M|0,h[m>>2]=h[m>>2]&-2,h[M+4>>2]=y|1,h[d>>2]=y,A=y>>>3,y>>>0<256){m=27724+(A<<1<<2)|0,d=h[6921]|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=M,h[A+12>>2]=M,h[M+8>>2]=A,h[M+12>>2]=m;break}if(A=y>>>8,A?y>>>0>16777215?_=31:(be=(A+1048320|0)>>>16&8,me=A<<be,re=(me+520192|0)>>>16&4,me=me<<re,_=(me+245760|0)>>>16&2,_=14-(re|be|_)+(me<<_>>>15)|0,_=y>>>(_+7|0)&1|_<<1):_=0,m=27988+(_<<2)|0,h[M+28>>2]=_,h[M+20>>2]=0,h[g>>2]=0,A=h[6922]|0,d=1<<_,!(A&d)){h[6922]=A|d,h[m>>2]=M,h[M+24>>2]=m,h[M+12>>2]=M,h[M+8>>2]=M;break}A=h[m>>2]|0;t:do if((h[A+4>>2]&-8|0)!=(y|0)){for(_=y<<((_|0)==31?0:25-(_>>>1)|0);m=A+16+(_>>>31<<2)|0,d=h[m>>2]|0,!!d;)if((h[d+4>>2]&-8|0)==(y|0)){A=d;break t}else _=_<<1,A=d;h[m>>2]=M,h[M+24>>2]=A,h[M+12>>2]=M,h[M+8>>2]=M;break e}while(!1);be=A+8|0,me=h[be>>2]|0,h[me+12>>2]=M,h[be>>2]=M,h[M+8>>2]=me,h[M+12>>2]=A,h[M+24>>2]=0}}else me=h[6925]|0,(me|0)==0|y>>>0<me>>>0&&(h[6925]=y),h[7033]=y,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,me=b+-40|0,re=y+8|0,re=(re&7|0)==0?0:0-re&7,be=y+re|0,re=me-re|0,h[6927]=be,h[6924]=re,h[be+4>>2]=re|1,h[y+me+4>>2]=40,h[6928]=h[7043];while(!1);if(A=h[6924]|0,A>>>0>G>>>0)return re=A-G|0,h[6924]=re,me=h[6927]|0,be=me+G|0,h[6927]=be,h[be+4>>2]=re|1,h[me+4>>2]=G|3,me=me+8|0,Y=Fe,me|0}return me=k9()|0,h[me>>2]=12,me=0,Y=Fe,me|0}function _t(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0,M=0;if(d){m=d+-8|0,g=h[6925]|0,d=h[d+-4>>2]|0,A=d&-8,M=m+A|0;do if(d&1)E=m,b=m;else{if(_=h[m>>2]|0,!(d&3)||(b=m+(0-_)|0,y=_+A|0,b>>>0<g>>>0))return;if((h[6926]|0)==(b|0)){if(d=M+4|0,A=h[d>>2]|0,(A&3|0)!=3){E=b,A=y;break}h[6923]=y,h[d>>2]=A&-2,h[b+4>>2]=y|1,h[b+y>>2]=y;return}if(m=_>>>3,_>>>0<256)if(d=h[b+8>>2]|0,A=h[b+12>>2]|0,(A|0)==(d|0)){h[6921]=h[6921]&~(1<<m),E=b,A=y;break}else{h[d+12>>2]=A,h[A+8>>2]=d,E=b,A=y;break}g=h[b+24>>2]|0,d=h[b+12>>2]|0;do if((d|0)==(b|0)){if(A=b+16|0,m=A+4|0,d=h[m>>2]|0,d)A=m;else if(d=h[A>>2]|0,!d){d=0;break}for(;;)if(_=d+20|0,m=h[_>>2]|0,m)d=m,A=_;else if(_=d+16|0,m=h[_>>2]|0,m)d=m,A=_;else break;h[A>>2]=0}else E=h[b+8>>2]|0,h[E+12>>2]=d,h[d+8>>2]=E;while(!1);if(g){if(A=h[b+28>>2]|0,m=27988+(A<<2)|0,(h[m>>2]|0)==(b|0)){if(h[m>>2]=d,!d){h[6922]=h[6922]&~(1<<A),E=b,A=y;break}}else if(E=g+16|0,h[((h[E>>2]|0)==(b|0)?E:g+20|0)>>2]=d,!d){E=b,A=y;break}h[d+24>>2]=g,A=b+16|0,m=h[A>>2]|0,m|0&&(h[d+16>>2]=m,h[m+24>>2]=d),A=h[A+4>>2]|0,A?(h[d+20>>2]=A,h[A+24>>2]=d,E=b,A=y):(E=b,A=y)}else E=b,A=y}while(!1);if(!(b>>>0>=M>>>0)&&(d=M+4|0,_=h[d>>2]|0,!!(_&1))){if(_&2)h[d>>2]=_&-2,h[E+4>>2]=A|1,h[b+A>>2]=A,g=A;else{if((h[6927]|0)==(M|0)){if(M=(h[6924]|0)+A|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)+A|0,h[6923]=M,h[6926]=b,h[E+4>>2]=M|1,h[b+M>>2]=M;return}g=(_&-8)+A|0,m=_>>>3;do if(_>>>0<256)if(A=h[M+8>>2]|0,d=h[M+12>>2]|0,(d|0)==(A|0)){h[6921]=h[6921]&~(1<<m);break}else{h[A+12>>2]=d,h[d+8>>2]=A;break}else{y=h[M+24>>2]|0,d=h[M+12>>2]|0;do if((d|0)==(M|0)){if(A=M+16|0,m=A+4|0,d=h[m>>2]|0,d)A=m;else if(d=h[A>>2]|0,!d){m=0;break}for(;;)if(_=d+20|0,m=h[_>>2]|0,m)d=m,A=_;else if(_=d+16|0,m=h[_>>2]|0,m)d=m,A=_;else break;h[A>>2]=0,m=d}else m=h[M+8>>2]|0,h[m+12>>2]=d,h[d+8>>2]=m,m=d;while(!1);if(y|0){if(d=h[M+28>>2]|0,A=27988+(d<<2)|0,(h[A>>2]|0)==(M|0)){if(h[A>>2]=m,!m){h[6922]=h[6922]&~(1<<d);break}}else if(_=y+16|0,h[((h[_>>2]|0)==(M|0)?_:y+20|0)>>2]=m,!m)break;h[m+24>>2]=y,d=M+16|0,A=h[d>>2]|0,A|0&&(h[m+16>>2]=A,h[A+24>>2]=m),d=h[d+4>>2]|0,d|0&&(h[m+20>>2]=d,h[d+24>>2]=m)}}while(!1);if(h[E+4>>2]=g|1,h[b+g>>2]=g,(E|0)==(h[6926]|0)){h[6923]=g;return}}if(d=g>>>3,g>>>0<256){m=27724+(d<<1<<2)|0,A=h[6921]|0,d=1<<d,A&d?(A=m+8|0,d=h[A>>2]|0):(h[6921]=A|d,d=m,A=m+8|0),h[A>>2]=E,h[d+12>>2]=E,h[E+8>>2]=d,h[E+12>>2]=m;return}d=g>>>8,d?g>>>0>16777215?_=31:(b=(d+1048320|0)>>>16&8,M=d<<b,y=(M+520192|0)>>>16&4,M=M<<y,_=(M+245760|0)>>>16&2,_=14-(y|b|_)+(M<<_>>>15)|0,_=g>>>(_+7|0)&1|_<<1):_=0,d=27988+(_<<2)|0,h[E+28>>2]=_,h[E+20>>2]=0,h[E+16>>2]=0,A=h[6922]|0,m=1<<_;e:do if(!(A&m))h[6922]=A|m,h[d>>2]=E,h[E+24>>2]=d,h[E+12>>2]=E,h[E+8>>2]=E;else{d=h[d>>2]|0;t:do if((h[d+4>>2]&-8|0)!=(g|0)){for(_=g<<((_|0)==31?0:25-(_>>>1)|0);m=d+16+(_>>>31<<2)|0,A=h[m>>2]|0,!!A;)if((h[A+4>>2]&-8|0)==(g|0)){d=A;break t}else _=_<<1,d=A;h[m>>2]=E,h[E+24>>2]=d,h[E+12>>2]=E,h[E+8>>2]=E;break e}while(!1);b=d+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]=d,h[E+24>>2]=0}while(!1);if(M=(h[6929]|0)+-1|0,h[6929]=M,!(M|0)){for(d=28140;d=h[d>>2]|0,d;)d=d+8|0;h[6929]=-1}}}}function ra(d,A){d=d|0,A=A|0;var m=0;return d?(m=Fa(A,d)|0,(A|d)>>>0>65535&&(m=((m>>>0)/(d>>>0)|0|0)==(A|0)?m:-1)):m=0,d=lr(m)|0,!d||!(h[d+-4>>2]&3)||hd(d|0,0,m|0)|0,d|0}function Dse(d,A){d=d|0,A=A|0;var m=0,_=0;return d?A>>>0>4294967231?(A=k9()|0,h[A>>2]=12,A=0,A|0):(m=Fse(d+-8|0,A>>>0<11?16:A+11&-8)|0,m|0?(A=m+8|0,A|0):(m=lr(A)|0,m?(_=h[d+-4>>2]|0,_=(_&-8)-((_&3|0)==0?8:4)|0,bc(m|0,d|0,(_>>>0<A>>>0?_:A)|0)|0,_t(d),A=m,A|0):(A=0,A|0))):(A=lr(A)|0,A|0)}function Fse(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;if(O=d+4|0,G=h[O>>2]|0,m=G&-8,E=d+m|0,!(G&3))return A>>>0<256?(d=0,d|0):(m>>>0>=(A+4|0)>>>0&&(m-A|0)>>>0<=h[7041]<<1>>>0||(d=0),d|0);if(m>>>0>=A>>>0)return m=m-A|0,m>>>0<=15||(I=d+A|0,h[O>>2]=G&1|A|2,h[I+4>>2]=m|3,G=E+4|0,h[G>>2]=h[G>>2]|1,q9(I,m)),d|0;if((h[6927]|0)==(E|0))return I=(h[6924]|0)+m|0,m=I-A|0,_=d+A|0,I>>>0<=A>>>0?(d=0,d|0):(h[O>>2]=G&1|A|2,h[_+4>>2]=m|1,h[6927]=_,h[6924]=m,d|0);if((h[6926]|0)==(E|0))return _=(h[6923]|0)+m|0,_>>>0<A>>>0?(d=0,d|0):(m=_-A|0,m>>>0>15?(I=d+A|0,_=d+_|0,h[O>>2]=G&1|A|2,h[I+4>>2]=m|1,h[_>>2]=m,_=_+4|0,h[_>>2]=h[_>>2]&-2,_=I):(h[O>>2]=G&1|_|2,_=d+_+4|0,h[_>>2]=h[_>>2]|1,_=0,m=0),h[6923]=m,h[6926]=_,d|0);if(_=h[E+4>>2]|0,_&2|0||(M=(_&-8)+m|0,M>>>0<A>>>0))return d=0,d|0;I=M-A|0,g=_>>>3;do if(_>>>0<256)if(_=h[E+8>>2]|0,m=h[E+12>>2]|0,(m|0)==(_|0)){h[6921]=h[6921]&~(1<<g);break}else{h[_+12>>2]=m,h[m+8>>2]=_;break}else{b=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(_=E+16|0,g=_+4|0,m=h[g>>2]|0,m)_=g;else if(m=h[_>>2]|0,!m){g=0;break}for(;;)if(y=m+20|0,g=h[y>>2]|0,g)m=g,_=y;else if(y=m+16|0,g=h[y>>2]|0,g)m=g,_=y;else break;h[_>>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(b|0){if(m=h[E+28>>2]|0,_=27988+(m<<2)|0,(h[_>>2]|0)==(E|0)){if(h[_>>2]=g,!g){h[6922]=h[6922]&~(1<<m);break}}else if(y=b+16|0,h[((h[y>>2]|0)==(E|0)?y:b+20|0)>>2]=g,!g)break;h[g+24>>2]=b,m=E+16|0,_=h[m>>2]|0,_|0&&(h[g+16>>2]=_,h[_+24>>2]=g),m=h[m+4>>2]|0,m|0&&(h[g+20>>2]=m,h[m+24>>2]=g)}}while(!1);return I>>>0<16?(h[O>>2]=G&1|M|2,G=d+M+4|0,h[G>>2]=h[G>>2]|1,d|0):(E=d+A|0,h[O>>2]=G&1|A|2,h[E+4>>2]=I|3,G=d+M+4|0,h[G>>2]=h[G>>2]|1,q9(E,I),d|0)}function q9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0;E=d+A|0,m=h[d+4>>2]|0;do if(m&1)b=d;else{if(g=h[d>>2]|0,!(m&3))return;if(b=d+(0-g)|0,A=g+A|0,(h[6926]|0)==(b|0)){if(d=E+4|0,m=h[d>>2]|0,(m&3|0)!=3)break;h[6923]=A,h[d>>2]=m&-2,h[b+4>>2]=A|1,h[E>>2]=A;return}if(_=g>>>3,g>>>0<256)if(d=h[b+8>>2]|0,m=h[b+12>>2]|0,(m|0)==(d|0)){h[6921]=h[6921]&~(1<<_);break}else{h[d+12>>2]=m,h[m+8>>2]=d;break}y=h[b+24>>2]|0,d=h[b+12>>2]|0;do if((d|0)==(b|0)){if(m=b+16|0,_=m+4|0,d=h[_>>2]|0,d)m=_;else if(d=h[m>>2]|0,!d){d=0;break}for(;;)if(g=d+20|0,_=h[g>>2]|0,_)d=_,m=g;else if(g=d+16|0,_=h[g>>2]|0,_)d=_,m=g;else break;h[m>>2]=0}else g=h[b+8>>2]|0,h[g+12>>2]=d,h[d+8>>2]=g;while(!1);if(y){if(m=h[b+28>>2]|0,_=27988+(m<<2)|0,(h[_>>2]|0)==(b|0)){if(h[_>>2]=d,!d){h[6922]=h[6922]&~(1<<m);break}}else if(g=y+16|0,h[((h[g>>2]|0)==(b|0)?g:y+20|0)>>2]=d,!d)break;h[d+24>>2]=y,m=b+16|0,_=h[m>>2]|0,_|0&&(h[d+16>>2]=_,h[_+24>>2]=d),m=h[m+4>>2]|0,m&&(h[d+20>>2]=m,h[m+24>>2]=d)}}while(!1);if(d=E+4|0,_=h[d>>2]|0,_&2)h[d>>2]=_&-2,h[b+4>>2]=A|1,h[b+A>>2]=A,g=A;else{if((h[6927]|0)==(E|0)){if(E=(h[6924]|0)+A|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)+A|0,h[6923]=E,h[6926]=b,h[b+4>>2]=E|1,h[b+E>>2]=E;return}g=(_&-8)+A|0,m=_>>>3;do if(_>>>0<256)if(d=h[E+8>>2]|0,A=h[E+12>>2]|0,(A|0)==(d|0)){h[6921]=h[6921]&~(1<<m);break}else{h[d+12>>2]=A,h[A+8>>2]=d;break}else{y=h[E+24>>2]|0,A=h[E+12>>2]|0;do if((A|0)==(E|0)){if(d=E+16|0,m=d+4|0,A=h[m>>2]|0,A)d=m;else if(A=h[d>>2]|0,!A){m=0;break}for(;;)if(_=A+20|0,m=h[_>>2]|0,m)A=m,d=_;else if(_=A+16|0,m=h[_>>2]|0,m)A=m,d=_;else break;h[d>>2]=0,m=A}else m=h[E+8>>2]|0,h[m+12>>2]=A,h[A+8>>2]=m,m=A;while(!1);if(y|0){if(A=h[E+28>>2]|0,d=27988+(A<<2)|0,(h[d>>2]|0)==(E|0)){if(h[d>>2]=m,!m){h[6922]=h[6922]&~(1<<A);break}}else if(_=y+16|0,h[((h[_>>2]|0)==(E|0)?_:y+20|0)>>2]=m,!m)break;h[m+24>>2]=y,A=E+16|0,d=h[A>>2]|0,d|0&&(h[m+16>>2]=d,h[d+24>>2]=m),A=h[A+4>>2]|0,A|0&&(h[m+20>>2]=A,h[A+24>>2]=m)}}while(!1);if(h[b+4>>2]=g|1,h[b+g>>2]=g,(b|0)==(h[6926]|0)){h[6923]=g;return}}if(A=g>>>3,g>>>0<256){m=27724+(A<<1<<2)|0,d=h[6921]|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=b,h[A+12>>2]=b,h[b+8>>2]=A,h[b+12>>2]=m;return}if(A=g>>>8,A?g>>>0>16777215?_=31:(y=(A+1048320|0)>>>16&8,E=A<<y,m=(E+520192|0)>>>16&4,E=E<<m,_=(E+245760|0)>>>16&2,_=14-(m|y|_)+(E<<_>>>15)|0,_=g>>>(_+7|0)&1|_<<1):_=0,A=27988+(_<<2)|0,h[b+28>>2]=_,h[b+20>>2]=0,h[b+16>>2]=0,d=h[6922]|0,m=1<<_,!(d&m)){h[6922]=d|m,h[A>>2]=b,h[b+24>>2]=A,h[b+12>>2]=b,h[b+8>>2]=b;return}A=h[A>>2]|0;e:do if((h[A+4>>2]&-8|0)!=(g|0)){for(_=g<<((_|0)==31?0:25-(_>>>1)|0);m=A+16+(_>>>31<<2)|0,d=h[m>>2]|0,!!d;)if((h[d+4>>2]&-8|0)==(g|0)){A=d;break e}else _=_<<1,A=d;h[m>>2]=b,h[b+24>>2]=A,h[b+12>>2]=b,h[b+8>>2]=b;return}while(!1);y=A+8|0,E=h[y>>2]|0,h[E+12>>2]=b,h[y>>2]=b,h[b+8>>2]=E,h[b+12>>2]=A,h[b+24>>2]=0}function pt(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,m=d+m>>>0,Dn(A+_+(m>>>0<d>>>0|0)>>>0|0),m|0|0}function Ds(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,_=A-_-(m>>>0>d>>>0|0)>>>0,Dn(_|0),d-m>>>0|0|0}function H9(d){return d=d|0,(d?31-($h(d^d-1)|0)|0:32)|0}function B4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if(O=d,M=A,I=M,b=m,q=_,E=q,!I)return y=(g|0)!=0,E?y?(h[g>>2]=d|0,h[g+4>>2]=A&0,q=0,g=0,Dn(q|0),g|0):(q=0,g=0,Dn(q|0),g|0):(y&&(h[g>>2]=(O>>>0)%(b>>>0),h[g+4>>2]=0),q=0,g=(O>>>0)/(b>>>0)>>>0,Dn(q|0),g|0);y=(E|0)==0;do if(b){if(!y){if(y=($h(E|0)|0)-($h(I|0)|0)|0,y>>>0<=31){G=y+1|0,E=31-y|0,A=y-31>>31,b=G,d=O>>>(G>>>0)&A|I<<E,A=I>>>(G>>>0)&A,y=0,E=O<<E;break}return g?(h[g>>2]=d|0,h[g+4>>2]=M|A&0,q=0,g=0,Dn(q|0),g|0):(q=0,g=0,Dn(q|0),g|0)}if(y=b-1|0,y&b|0){E=($h(b|0)|0)+33-($h(I|0)|0)|0,$=64-E|0,G=32-E|0,M=G>>31,W=E-32|0,A=W>>31,b=E,d=G-1>>31&I>>>(W>>>0)|(I<<G|O>>>(E>>>0))&A,A=A&I>>>(E>>>0),y=O<<$&M,E=(I<<$|O>>>(W>>>0))&M|O<<G&E-33>>31;break}return g|0&&(h[g>>2]=y&O,h[g+4>>2]=0),(b|0)==1?(W=M|A&0,$=d|0|0,Dn(W|0),$|0):($=H9(b|0)|0,W=I>>>($>>>0)|0,$=I<<32-$|O>>>($>>>0)|0,Dn(W|0),$|0)}else{if(y)return g|0&&(h[g>>2]=(I>>>0)%(b>>>0),h[g+4>>2]=0),W=0,$=(I>>>0)/(b>>>0)>>>0,Dn(W|0),$|0;if(!O)return g|0&&(h[g>>2]=0,h[g+4>>2]=(I>>>0)%(E>>>0)),W=0,$=(I>>>0)/(E>>>0)>>>0,Dn(W|0),$|0;if(y=E-1|0,!(y&E))return g|0&&(h[g>>2]=d|0,h[g+4>>2]=y&I|A&0),W=0,$=I>>>((H9(E|0)|0)>>>0),Dn(W|0),$|0;if(y=($h(E|0)|0)-($h(I|0)|0)|0,y>>>0<=30){A=y+1|0,E=31-y|0,b=A,d=I<<E|O>>>(A>>>0),A=I>>>(A>>>0),y=0,E=O<<E;break}return g?(h[g>>2]=d|0,h[g+4>>2]=M|A&0,W=0,$=0,Dn(W|0),$|0):(W=0,$=0,Dn(W|0),$|0)}while(!1);if(!b)I=E,M=0,E=0;else{G=m|0|0,O=q|_&0,I=pt(G|0,O|0,-1,-1)|0,m=Q()|0,M=E,E=0;do _=M,M=y>>>31|M<<1,y=E|y<<1,_=d<<1|_>>>31|0,q=d>>>31|A<<1|0,Ds(I|0,m|0,_|0,q|0)|0,$=Q()|0,W=$>>31|(($|0)<0?-1:0)<<1,E=W&1,d=Ds(_|0,q|0,W&G|0,((($|0)<0?-1:0)>>31|(($|0)<0?-1:0)<<1)&O|0)|0,A=Q()|0,b=b-1|0;while((b|0)!=0);I=M,M=0}return b=0,g|0&&(h[g>>2]=d,h[g+4>>2]=A),W=(y|0)>>>31|(I|b)<<1|(b<<1|y>>>31)&0|M,$=(y<<1|0)&-2|E,Dn(W|0),$|0}function cd(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;return I=A>>31|((A|0)<0?-1:0)<<1,M=((A|0)<0?-1:0)>>31|((A|0)<0?-1:0)<<1,y=_>>31|((_|0)<0?-1:0)<<1,g=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,E=Ds(I^d|0,M^A|0,I|0,M|0)|0,b=Q()|0,d=y^I,A=g^M,Ds((B4(E,b,Ds(y^m|0,g^_|0,y|0,g|0)|0,Q()|0,0)|0)^d|0,(Q()|0)^A|0,d|0,A|0)|0}function Ose(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return y=d&65535,g=A&65535,m=Fa(g,y)|0,_=d>>>16,d=(m>>>16)+(Fa(g,_)|0)|0,g=A>>>16,A=Fa(g,y)|0,Dn((d>>>16)+(Fa(g,_)|0)+(((d&65535)+A|0)>>>16)|0),d+A<<16|m&65535|0|0}function cr(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;return g=d,y=m,m=Ose(g,y)|0,d=Q()|0,Dn((Fa(A,y)|0)+(Fa(_,g)|0)+d|d&0|0),m|0|0|0}function ud(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;return g=Y,Y=Y+16|0,E=g|0,b=A>>31|((A|0)<0?-1:0)<<1,y=((A|0)<0?-1:0)>>31|((A|0)<0?-1:0)<<1,I=_>>31|((_|0)<0?-1:0)<<1,M=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,d=Ds(b^d|0,y^A|0,b|0,y|0)|0,A=Q()|0,B4(d,A,Ds(I^m|0,M^_|0,I|0,M|0)|0,Q()|0,E)|0,_=Ds(h[E>>2]^b|0,h[E+4>>2]^y|0,b|0,y|0)|0,m=Q()|0,Y=g,Dn(m|0),_|0}function Yh(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;return y=Y,Y=Y+16|0,g=y|0,B4(d,A,m,_,g)|0,Y=y,Dn(h[g+4>>2]|0),h[g>>2]|0|0}function W9(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Dn(A>>m|0),d>>>m|(A&(1<<m)-1)<<32-m):(Dn(((A|0)<0?-1:0)|0),A>>m-32|0)}function et(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Dn(A>>>m|0),d>>>m|(A&(1<<m)-1)<<32-m):(Dn(0),A>>>m-32|0)}function ht(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Dn(A<<m|(d&(1<<m)-1<<32-m)>>>32-m|0),d<<m):(Dn(d<<m-32|0),0)}function U4(d,A,m){return d=d|0,A=A|0,m=m|0,A=$h(A)|0,(A|0)==32&&(A=A+($h(d)|0)|0),Dn(0),A|0}function j9(d,A){return d=+d,A=+A,d!=d?+A:A!=A?+d:+nre(+d,+A)}function iw(d,A){return d=+d,A=+A,d!=d?+A:A!=A?+d:+p4(+d,+A)}function rw(d){return d=+d,d>=0?+js(d+.5):+eg(d-.5)}function bc(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if((m|0)>=8192)return sre(d|0,A|0,m|0)|0,d|0;if(y=d|0,g=d+m|0,(d&3)==(A&3)){for(;d&3;){if(!m)return y|0;He[d>>0]=He[A>>0]|0,d=d+1|0,A=A+1|0,m=m-1|0}for(m=g&-4|0,_=m-64|0;(d|0)<=(_|0);)h[d>>2]=h[A>>2],h[d+4>>2]=h[A+4>>2],h[d+8>>2]=h[A+8>>2],h[d+12>>2]=h[A+12>>2],h[d+16>>2]=h[A+16>>2],h[d+20>>2]=h[A+20>>2],h[d+24>>2]=h[A+24>>2],h[d+28>>2]=h[A+28>>2],h[d+32>>2]=h[A+32>>2],h[d+36>>2]=h[A+36>>2],h[d+40>>2]=h[A+40>>2],h[d+44>>2]=h[A+44>>2],h[d+48>>2]=h[A+48>>2],h[d+52>>2]=h[A+52>>2],h[d+56>>2]=h[A+56>>2],h[d+60>>2]=h[A+60>>2],d=d+64|0,A=A+64|0;for(;(d|0)<(m|0);)h[d>>2]=h[A>>2],d=d+4|0,A=A+4|0}else for(m=g-4|0;(d|0)<(m|0);)He[d>>0]=He[A>>0]|0,He[d+1>>0]=He[A+1>>0]|0,He[d+2>>0]=He[A+2>>0]|0,He[d+3>>0]=He[A+3>>0]|0,d=d+4|0,A=A+4|0;for(;(d|0)<(g|0);)He[d>>0]=He[A>>0]|0,d=d+1|0,A=A+1|0;return y|0}function k4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0;if((A|0)<(d|0)&(d|0)<(A+m|0)){for(_=d,A=A+m|0,d=d+m|0;(m|0)>0;)d=d-1|0,A=A-1|0,m=m-1|0,He[d>>0]=He[A>>0]|0;d=_}else bc(d,A,m)|0;return d|0}function hd(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;if(y=d+m|0,A=A&255,(m|0)>=67){for(;d&3;)He[d>>0]=A,d=d+1|0;for(_=y&-4|0,b=A|A<<8|A<<16|A<<24,g=_-64|0;(d|0)<=(g|0);)h[d>>2]=b,h[d+4>>2]=b,h[d+8>>2]=b,h[d+12>>2]=b,h[d+16>>2]=b,h[d+20>>2]=b,h[d+24>>2]=b,h[d+28>>2]=b,h[d+32>>2]=b,h[d+36>>2]=b,h[d+40>>2]=b,h[d+44>>2]=b,h[d+48>>2]=b,h[d+52>>2]=b,h[d+56>>2]=b,h[d+60>>2]=b,d=d+64|0;for(;(d|0)<(_|0);)h[d>>2]=b,d=d+4|0}for(;(d|0)<(y|0);)He[d>>0]=A,d=d+1|0;return y-m|0}function X9(d){return d=+d,d>=0?+js(d+.5):+eg(d-.5)}function fd(d){d=d|0;var A=0,m=0,_=0;return _=rre()|0,m=h[Da>>2]|0,A=m+d|0,(d|0)>0&(A|0)<(m|0)|(A|0)<0?(are(A|0)|0,l9(12),-1):(A|0)>(_|0)&&!(ore(A|0)|0)?(l9(12),-1):(h[Da>>2]=A,m|0)}function Bse(d,A,m){return d=d|0,A=A|0,m=m|0,dd[d&3](A|0,m|0)|0}function Use(d,A){return d=d|0,A=A|0,ire(0),0}var dd=[Use,Dre,Fre,Ore];return{___divdi3:cd,___muldi3:cr,___remdi3:ud,___uremdi3:Yh,_areNeighborCells:Bre,_bitshift64Ashr:W9,_bitshift64Lshr:et,_bitshift64Shl:ht,_calloc:ra,_cellAreaKm2:yre,_cellAreaM2:vre,_cellAreaRads2:xre,_cellToBoundary:N0,_cellToCenterChild:E9,_cellToChildPos:ise,_cellToChildren:$re,_cellToChildrenSize:ax,_cellToLatLng:ig,_cellToLocalIj:Ase,_cellToParent:S4,_cellToVertex:Vl,_cellToVertexes:Nse,_cellsToDirectedEdge:Ure,_cellsToLinkedMultiPolygon:_re,_childPosToCell:rse,_compactCells:Yre,_constructCell:jre,_destroyLinkedMultiPolygon:dse,_directedEdgeToBoundary:sx,_directedEdgeToCells:zre,_edgeLengthKm:hse,_edgeLengthM:fse,_edgeLengthRads:use,_emscripten_replace_memory:lre,_free:_t,_getBaseCellNumber:S9,_getDirectedEdgeDestination:Gre,_getDirectedEdgeOrigin:kre,_getHexagonAreaAvgKm2:R9,_getHexagonAreaAvgM2:ase,_getHexagonEdgeLengthAvgKm:lse,_getHexagonEdgeLengthAvgM:cse,_getIcosahedronFaces:M9,_getIndexDigit:Wre,_getNumCells:Zb,_getPentagons:R4,_getRes0Cells:Ere,_getResolution:b4,_greatCircleDistanceKm:cx,_greatCircleDistanceM:ose,_greatCircleDistanceRads:sse,_gridDisk:c9,_gridDiskDistances:u9,_gridDistance:N4,_gridPathCells:_se,_gridPathCellsSize:gse,_gridRing:pre,_gridRingUnsafe:f9,_i64Add:pt,_i64Subtract:Ds,_isPentagon:ki,_isResClassIII:Qre,_isValidCell:Yb,_isValidDirectedEdge:y9,_isValidIndex:Xre,_isValidVertex:U9,_latLngToCell:M4,_llvm_ctlz_i64:U4,_llvm_maxnum_f64:j9,_llvm_minnum_f64:iw,_llvm_round_f64:rw,_localIjToCell:mse,_malloc:lr,_maxFaceCount:tse,_maxGridDiskSize:dre,_maxPolygonToCellsSize:mre,_maxPolygonToCellsSizeExperimental:vse,_memcpy:bc,_memmove:k4,_memset:hd,_originToDirectedEdges:x4,_pentagonCount:nse,_polygonToCells:gre,_polygonToCellsExperimental:yse,_readInt64AsDoubleFromPointer:Rse,_res0CellCount:Tre,_reverseDirectedEdge:v9,_round:X9,_sbrk:fd,_sizeOfCellBoundary:Sse,_sizeOfCoordIJ:Cse,_sizeOfGeoLoop:Tse,_sizeOfGeoPolygon:Ese,_sizeOfH3Index:bse,_sizeOfLatLng:wse,_sizeOfLinkedGeoPolygon:Mse,_uncompactCells:Zre,_uncompactCellsSize:Kre,_vertexToLatLng:Lse,dynCall_iii:Bse,establishStackSpace:fre,stackAlloc:cre,stackRestore:hre,stackSave:ure}})(Dt,ct,Z),jt=e.___divdi3=Ce.___divdi3,Hi=e.___muldi3=Ce.___muldi3,Nn=e.___remdi3=Ce.___remdi3,zr=e.___uremdi3=Ce.___uremdi3,gr=e._areNeighborCells=Ce._areNeighborCells,rl=e._bitshift64Ashr=Ce._bitshift64Ashr,na=e._bitshift64Lshr=Ce._bitshift64Lshr,sl=e._bitshift64Shl=Ce._bitshift64Shl,Na=e._calloc=Ce._calloc,or=e._cellAreaKm2=Ce._cellAreaKm2,Is=e._cellAreaM2=Ce._cellAreaM2,ol=e._cellAreaRads2=Ce._cellAreaRads2,du=e._cellToBoundary=Ce._cellToBoundary,Hb=e._cellToCenterChild=Ce._cellToCenterChild,o4=e._cellToChildPos=Ce._cellToChildPos,a4=e._cellToChildren=Ce._cellToChildren,nx=e._cellToChildrenSize=Ce._cellToChildrenSize,l4=e._cellToLatLng=Ce._cellToLatLng,ix=e._cellToLocalIj=Ce._cellToLocalIj,c4=e._cellToParent=Ce._cellToParent,u4=e._cellToVertex=Ce._cellToVertex,Jk=e._cellToVertexes=Ce._cellToVertexes,e9=e._cellsToDirectedEdge=Ce._cellsToDirectedEdge,t9=e._cellsToLinkedMultiPolygon=Ce._cellsToLinkedMultiPolygon,n9=e._childPosToCell=Ce._childPosToCell,te=e._compactCells=Ce._compactCells,Se=e._constructCell=Ce._constructCell,ke=e._destroyLinkedMultiPolygon=Ce._destroyLinkedMultiPolygon,Le=e._directedEdgeToBoundary=Ce._directedEdgeToBoundary,De=e._directedEdgeToCells=Ce._directedEdgeToCells,zt=e._edgeLengthKm=Ce._edgeLengthKm,Yt=e._edgeLengthM=Ce._edgeLengthM,kt=e._edgeLengthRads=Ce._edgeLengthRads,tn=e._emscripten_replace_memory=Ce._emscripten_replace_memory,hn=e._free=Ce._free,zn=e._getBaseCellNumber=Ce._getBaseCellNumber,$n=e._getDirectedEdgeDestination=Ce._getDirectedEdgeDestination,pn=e._getDirectedEdgeOrigin=Ce._getDirectedEdgeOrigin,Ui=e._getHexagonAreaAvgKm2=Ce._getHexagonAreaAvgKm2,Vr=e._getHexagonAreaAvgM2=Ce._getHexagonAreaAvgM2,Mr=e._getHexagonEdgeLengthAvgKm=Ce._getHexagonEdgeLengthAvgKm,Wi=e._getHexagonEdgeLengthAvgM=Ce._getHexagonEdgeLengthAvgM,ao=e._getIcosahedronFaces=Ce._getIcosahedronFaces,Xt=e._getIndexDigit=Ce._getIndexDigit,La=e._getNumCells=Ce._getNumCells,mi=e._getPentagons=Ce._getPentagons,al=e._getRes0Cells=Ce._getRes0Cells,vc=e._getResolution=Ce._getResolution,Wh=e._greatCircleDistanceKm=Ce._greatCircleDistanceKm,C0=e._greatCircleDistanceM=Ce._greatCircleDistanceM,ji=e._greatCircleDistanceRads=Ce._greatCircleDistanceRads,qr=e._gridDisk=Ce._gridDisk,jh=e._gridDiskDistances=Ce._gridDiskDistances,tr=e._gridDistance=Ce._gridDistance,Xh=e._gridPathCells=Ce._gridPathCells,R0=e._gridPathCellsSize=Ce._gridPathCellsSize,h4=e._gridRing=Ce._gridRing,R4e=e._gridRingUnsafe=Ce._gridRingUnsafe,P4e=e._i64Add=Ce._i64Add,I4e=e._i64Subtract=Ce._i64Subtract,N4e=e._isPentagon=Ce._isPentagon,L4e=e._isResClassIII=Ce._isResClassIII,D4e=e._isValidCell=Ce._isValidCell,F4e=e._isValidDirectedEdge=Ce._isValidDirectedEdge,O4e=e._isValidIndex=Ce._isValidIndex,B4e=e._isValidVertex=Ce._isValidVertex,U4e=e._latLngToCell=Ce._latLngToCell,k4e=e._llvm_ctlz_i64=Ce._llvm_ctlz_i64,G4e=e._llvm_maxnum_f64=Ce._llvm_maxnum_f64,z4e=e._llvm_minnum_f64=Ce._llvm_minnum_f64,V4e=e._llvm_round_f64=Ce._llvm_round_f64,q4e=e._localIjToCell=Ce._localIjToCell,H4e=e._malloc=Ce._malloc,W4e=e._maxFaceCount=Ce._maxFaceCount,j4e=e._maxGridDiskSize=Ce._maxGridDiskSize,X4e=e._maxPolygonToCellsSize=Ce._maxPolygonToCellsSize,$4e=e._maxPolygonToCellsSizeExperimental=Ce._maxPolygonToCellsSizeExperimental,Y4e=e._memcpy=Ce._memcpy,Z4e=e._memmove=Ce._memmove,K4e=e._memset=Ce._memset,Q4e=e._originToDirectedEdges=Ce._originToDirectedEdges,J4e=e._pentagonCount=Ce._pentagonCount,ePe=e._polygonToCells=Ce._polygonToCells,tPe=e._polygonToCellsExperimental=Ce._polygonToCellsExperimental,nPe=e._readInt64AsDoubleFromPointer=Ce._readInt64AsDoubleFromPointer,iPe=e._res0CellCount=Ce._res0CellCount,rPe=e._reverseDirectedEdge=Ce._reverseDirectedEdge,sPe=e._round=Ce._round,oPe=e._sbrk=Ce._sbrk,aPe=e._sizeOfCellBoundary=Ce._sizeOfCellBoundary,lPe=e._sizeOfCoordIJ=Ce._sizeOfCoordIJ,cPe=e._sizeOfGeoLoop=Ce._sizeOfGeoLoop,uPe=e._sizeOfGeoPolygon=Ce._sizeOfGeoPolygon,hPe=e._sizeOfH3Index=Ce._sizeOfH3Index,fPe=e._sizeOfLatLng=Ce._sizeOfLatLng,dPe=e._sizeOfLinkedGeoPolygon=Ce._sizeOfLinkedGeoPolygon,pPe=e._uncompactCells=Ce._uncompactCells,APe=e._uncompactCellsSize=Ce._uncompactCellsSize,mPe=e._vertexToLatLng=Ce._vertexToLatLng,gPe=e.establishStackSpace=Ce.establishStackSpace,i9=e.stackAlloc=Ce.stackAlloc,Jie=e.stackRestore=Ce.stackRestore,ere=e.stackSave=Ce.stackSave,_Pe=e.dynCall_iii=Ce.dynCall_iii;if(e.asm=Ce,e.cwrap=C,e.setValue=v,e.getValue=w,le){Te(le)||(le=o(le));{di("memory initializer");var f4=function(Ne){Ne.byteLength&&(Ne=new Uint8Array(Ne)),j.set(Ne,x),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,Bn("memory initializer")},r9=function(){a(le,f4,function(){throw"could not load memory initializer "+le})},s9=wt(le);if(s9)f4(s9.buffer);else if(e.memoryInitializerRequest){var o9=function(){var Ne=e.memoryInitializerRequest,nt=Ne.response;if(Ne.status!==200&&Ne.status!==0){var It=wt(e.memoryInitializerRequestURL);if(It)nt=It.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+Ne.status+", retrying "+le),r9();return}}f4(nt)};e.memoryInitializerRequest.response?setTimeout(o9,0):e.memoryInitializerRequest.addEventListener("load",o9)}else r9()}}var Wb;ge=function Ne(){Wb||d4(),Wb||(ge=Ne)};function d4(Ne){if(Ne=Ne||r,Qt>0||(Ct(),Qt>0))return;function nt(){Wb||(Wb=!0,!S&&(un(),Gt(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),Xe()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),nt()},1)):nt()}e.run=d4;function P0(Ne){throw e.onAbort&&e.onAbort(Ne),Ne+="",l(Ne),c(Ne),S=!0,"abort("+Ne+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=P0,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return d4(),i})(typeof hi=="object"?hi:{}),wn="number",vn=wn,i1=wn,Tn=wn,En=wn,io=wn,qt=wn,f1e=[["sizeOfH3Index",wn],["sizeOfLatLng",wn],["sizeOfCellBoundary",wn],["sizeOfGeoLoop",wn],["sizeOfGeoPolygon",wn],["sizeOfLinkedGeoPolygon",wn],["sizeOfCoordIJ",wn],["readInt64AsDoubleFromPointer",wn],["isValidCell",i1,[Tn,En]],["isValidIndex",i1,[Tn,En]],["latLngToCell",vn,[wn,wn,io,qt]],["cellToLatLng",vn,[Tn,En,qt]],["cellToBoundary",vn,[Tn,En,qt]],["maxGridDiskSize",vn,[wn,qt]],["gridDisk",vn,[Tn,En,wn,qt]],["gridDiskDistances",vn,[Tn,En,wn,qt,qt]],["gridRing",vn,[Tn,En,wn,qt]],["gridRingUnsafe",vn,[Tn,En,wn,qt]],["maxPolygonToCellsSize",vn,[qt,io,wn,qt]],["polygonToCells",vn,[qt,io,wn,qt]],["maxPolygonToCellsSizeExperimental",vn,[qt,io,wn,qt]],["polygonToCellsExperimental",vn,[qt,io,wn,wn,wn,qt]],["cellsToLinkedMultiPolygon",vn,[qt,wn,qt]],["destroyLinkedMultiPolygon",null,[qt]],["compactCells",vn,[qt,qt,wn,wn]],["uncompactCells",vn,[qt,wn,wn,qt,wn,io]],["uncompactCellsSize",vn,[qt,wn,wn,io,qt]],["isPentagon",i1,[Tn,En]],["isResClassIII",i1,[Tn,En]],["getBaseCellNumber",wn,[Tn,En]],["getResolution",wn,[Tn,En]],["getIndexDigit",wn,[Tn,En,wn]],["constructCell",vn,[wn,wn,qt,qt]],["maxFaceCount",vn,[Tn,En,qt]],["getIcosahedronFaces",vn,[Tn,En,qt]],["cellToParent",vn,[Tn,En,io,qt]],["cellToChildren",vn,[Tn,En,io,qt]],["cellToCenterChild",vn,[Tn,En,io,qt]],["cellToChildrenSize",vn,[Tn,En,io,qt]],["cellToChildPos",vn,[Tn,En,io,qt]],["childPosToCell",vn,[wn,wn,Tn,En,io,qt]],["areNeighborCells",vn,[Tn,En,Tn,En,qt]],["cellsToDirectedEdge",vn,[Tn,En,Tn,En,qt]],["getDirectedEdgeOrigin",vn,[Tn,En,qt]],["getDirectedEdgeDestination",vn,[Tn,En,qt]],["isValidDirectedEdge",i1,[Tn,En]],["directedEdgeToCells",vn,[Tn,En,qt]],["originToDirectedEdges",vn,[Tn,En,qt]],["directedEdgeToBoundary",vn,[Tn,En,qt]],["reverseDirectedEdge",vn,[Tn,En,qt]],["gridDistance",vn,[Tn,En,Tn,En,qt]],["gridPathCells",vn,[Tn,En,Tn,En,qt]],["gridPathCellsSize",vn,[Tn,En,Tn,En,qt]],["cellToLocalIj",vn,[Tn,En,Tn,En,wn,qt]],["localIjToCell",vn,[Tn,En,qt,wn,qt]],["getHexagonAreaAvgM2",vn,[io,qt]],["getHexagonAreaAvgKm2",vn,[io,qt]],["getHexagonEdgeLengthAvgM",vn,[io,qt]],["getHexagonEdgeLengthAvgKm",vn,[io,qt]],["greatCircleDistanceM",wn,[qt,qt]],["greatCircleDistanceKm",wn,[qt,qt]],["greatCircleDistanceRads",wn,[qt,qt]],["cellAreaM2",vn,[Tn,En,qt]],["cellAreaKm2",vn,[Tn,En,qt]],["cellAreaRads2",vn,[Tn,En,qt]],["edgeLengthM",vn,[Tn,En,qt]],["edgeLengthKm",vn,[Tn,En,qt]],["edgeLengthRads",vn,[Tn,En,qt]],["getNumCells",vn,[io,qt]],["getRes0Cells",vn,[qt]],["res0CellCount",wn],["getPentagons",vn,[wn,qt]],["pentagonCount",wn],["cellToVertex",vn,[Tn,En,wn,qt]],["cellToVertexes",vn,[Tn,En,qt]],["vertexToLatLng",vn,[Tn,En,qt]],["isValidVertex",i1,[Tn,En]]],d1e=0,p1e=1,A1e=2,m1e=3,eY=4,g1e=5,_1e=6,x1e=7,y1e=8,v1e=9,b1e=10,w1e=11,S1e=12,T1e=13,E1e=14,M1e=15,C1e=16,R1e=17,P1e=18,I1e=19,us={};us[d1e]="Success";us[p1e]="The operation failed but a more specific error is not available";us[A1e]="Argument was outside of acceptable range";us[m1e]="Latitude or longitude arguments were outside of acceptable range";us[eY]="Resolution argument was outside of acceptable range";us[g1e]="Cell argument was not valid";us[_1e]="Directed edge argument was not valid";us[x1e]="Undirected edge argument was not valid";us[y1e]="Vertex argument was not valid";us[v1e]="Pentagon distortion was encountered";us[b1e]="Duplicate input";us[w1e]="Cell arguments were not neighbors";us[S1e]="Cell arguments had incompatible resolutions";us[T1e]="Memory allocation failed";us[E1e]="Bounds of provided memory were insufficient";us[M1e]="Mode or flags argument was not valid";us[C1e]="Index argument was not valid";us[R1e]="Base cell number was outside of acceptable range";us[P1e]="Child indexing digits invalid";us[I1e]="Child indexing digits refer to a deleted subsequence";var N1e=1e3,tY=1001,nY=1002,EE={};EE[N1e]="Unknown unit";EE[tY]="Array length out of bounds";EE[nY]="Got unexpected null value for H3 index";var L1e="Unknown error";function iY(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||L1e)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function rY(i,e){var t=arguments.length===2?{value:e}:{};return iY(us,i,t)}function sY(i,e){var t=arguments.length===2?{value:e}:{};return iY(EE,i,t)}function wv(i){if(i!==0)throw rY(i)}var Qa={};f1e.forEach(function(e){Qa[e[0]]=hi.cwrap.apply(hi,e)});var r1=16;var Sv=4;var s1=8,D1e=8,SE=Qa.sizeOfH3Index(),G6=Qa.sizeOfLatLng(),F1e=Qa.sizeOfCellBoundary(),O1e=Qa.sizeOfGeoPolygon(),bv=Qa.sizeOfGeoLoop(),SJe=Qa.sizeOfLinkedGeoPolygon(),TJe=Qa.sizeOfCoordIJ();function B1e(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw rY(eY,i);return i}function U1e(i){if(!i)throw sY(nY);return i}var k1e=Math.pow(2,32)-1,EJe=Math.pow(2,31)-1;function G1e(i){if(i>k1e)throw sY(tY,i);return i}var z1e=/[^0-9a-fA-F]/;function oY(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||z1e.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),r1),t=parseInt(i.substring(i.length-8),r1);return[t,e]}function Q$(i){if(i>=0)return i.toString(r1);i=i&2147483647;var e=aY(8,i.toString(r1)),t=(parseInt(e[0],r1)+8).toString(r1);return e=t+e.substring(1),e}function V1e(i,e){return Q$(e)+aY(8,Q$(i))}function aY(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}var MJe=Math.pow(2,32);function J$(i,e,t){for(var n=i.length,r=hi._calloc(n,G6),s=t?1:0,o=t?0:1,a=0;a<n*2;a+=2)hi.HEAPF64.set([i[a/2][s],i[a/2][o]].map(hY),r/s1+a);return hi.HEAPU32.set([n,r],e/Sv),e}function q1e(i,e){var t=i.length-1,n=hi._calloc(O1e),r=0,s=r+bv,o=s+Sv;J$(i[0],n+r,e);var a;if(t>0){a=hi._calloc(t,bv);for(var l=0;l<t;l++)J$(i[l+1],a+bv*l,e)}return hi.setValue(n+s,t,"i32"),hi.setValue(n+o,a,"i32"),n}function H1e(i){var e=0,t=e+bv,n=t+Sv,r=Sv;hi._free(hi.getValue(i+e+r,"i8*"));var s=hi.getValue(i+t,"i32");if(s>0){for(var o=hi.getValue(i+n,"i32"),a=0;a<s;a++)hi._free(hi.getValue(o+bv*a+r,"i8*"));hi._free(o)}hi._free(i)}function lY(i,e){e===void 0&&(e=0);var t=hi.getValue(i+SE*e,"i32"),n=hi.getValue(i+SE*e+Sv,"i32");return n?V1e(t,n):null}function W1e(i){return Qa.readInt64AsDoubleFromPointer(i)}function j1e(i,e){for(var t=[],n=0;n<e;n++){var r=lY(i,n);r!==null&&t.push(r)}return t}function TE(i){return Y1e(hi.getValue(i,"double"))}function cY(i){return[TE(i),TE(i+s1)]}function X1e(i){return[TE(i+s1),TE(i)]}function $1e(i,e,t){for(var n=hi.getValue(i,"i32"),r=i+s1,s=[],o=e?X1e:cY,a=0;a<n*2;a+=2)s.push(o(r+s1*a));return t&&s.push(s[0]),s}function uY(i,e,t){var n=hi._malloc(G6);hi.HEAPF64.set([i,e].map(hY),n/s1);var r=hi._malloc(SE);try{return wv(Qa.latLngToCell(n,t,r)),U1e(lY(r))}finally{hi._free(r),hi._free(n)}}function z6(i){var e=hi._malloc(G6),t=oY(i),n=t[0],r=t[1];try{return wv(Qa.cellToLatLng(n,r,e)),cY(e)}finally{hi._free(e)}}function V6(i,e){var t=hi._malloc(F1e),n=oY(i),r=n[0],s=n[1];try{return wv(Qa.cellToBoundary(r,s,t)),$1e(t,e,e)}finally{hi._free(t)}}function q6(i,e,t){if(B1e(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=q1e(n,t),s=hi._malloc(D1e);try{wv(Qa.maxPolygonToCellsSize(r,e,0,s));var o=G1e(W1e(s)),a=hi._calloc(o,SE);try{return wv(Qa.polygonToCells(r,e,0,a)),j1e(a,o)}finally{hi._free(a)}}finally{hi._free(s),H1e(r)}}function hY(i){return i*Math.PI/180}function Y1e(i){return i*180/Math.PI}function H6(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 Z1e=["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"],fY=new WeakMap,dY=new WeakMap,pY=new WeakMap,R8=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=Z1e,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=pY.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}},pY.set(e,t)),t}getMaterialData(e){let t=dY.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)}dY.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 p=l[f],x=s[f];if(f!=="_renderId"&&f!=="_equal"){if(p.equals!==void 0){if(p.equals(x)===!1)return p.copy(x),l._equal=!1,!1}else if(x.isTexture===!0){if(p.id!==x.id||p.version!==x.version)return p.id=x.id,p.version=x.version,l._equal=!1,!1}else if(p!==x)return l[f]=x,l._equal=!1,!1}}if(l.transmission>0){let{width:f,height:p}=e.context;if(a.bufferWidth!==f||a.bufferHeight!==p)return a.bufferWidth=f,a.bufferHeight=p,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,p=c.attributes,x=0,v=0;for(let C in f)x++;for(let C in p){v++;let L=p[C],D=f[C];if(D===void 0)return delete p[C],c._equal=!1,!1;let F=D.isInterleavedBufferAttribute?D.data.uuid:D.id,N=D.isInterleavedBufferAttribute?D.data.version:D.version;if(L.id!==F||L.version!==N)return L.id=F,L.version=N,c._equal=!1,!1}if(v!==x)return c.attributes=this.getAttributesData(f),c._equal=!1,!1;let w=o.index,S=c.indexId,T=c.indexVersion,P=w?w.id:null,R=w?w.version:null;if(S!==P||T!==R)return c.indexId=P,c.indexVersion=R,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 p=0;p<a.morphTargetInfluences.length;p++)a.morphTargetInfluences[p]!==r.morphTargetInfluences[p]&&(a.morphTargetInfluences[p]=r.morphTargetInfluences[p],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=fY.get(e);return n===void 0&&(n={renderId:-1,lightsData:[]},fY.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}},K1e=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function Q1e(i){let e=/(?:at\s+(.+?)\s+\()?(?:(.+?)@)?([^@\s()]+):(\d+):(\d+)/;return i.split(`4130-`).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&&!K1e.some(n=>n.test(t.file)))}var Ur=class{constructor(e=null){this.isStackTrace=!0,this.stack=Q1e(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(`4116+}`,eD=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new My(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 $r({vertexShader:m0e,fragmentShader:g0e,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Gn(new IA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},tD=class extends zo{constructor(e,t){super();let n=this,r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,p=null,x=null,v=null,w=typeof XRWebGLBinding<"u",S=new eD,T={},P=t.getContextAttributes(),R=null,C=null,L=[],D=[],F=new Oe,N=null,B=new Nr;B.viewport=new gn;let z=new Nr;z.viewport=new gn;let V=[B,z],H=new M_,Z=null,J=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Me){let ze=L[Me];return ze===void 0&&(ze=new Qd,L[Me]=ze),ze.getTargetRaySpace()},this.getControllerGrip=function(Me){let ze=L[Me];return ze===void 0&&(ze=new Qd,L[Me]=ze),ze.getGripSpace()},this.getHand=function(Me){let ze=L[Me];return ze===void 0&&(ze=new Qd,L[Me]=ze),ze.getHandSpace()};function j(Me){let ze=D.indexOf(Me.inputSource);if(ze===-1)return;let $e=L[ze];$e!==void 0&&($e.update(Me.inputSource,Me.frame,c||o),$e.dispatchEvent({type:Me.type,data:Me.inputSource}))}function K(){r.removeEventListener("select",j),r.removeEventListener("selectstart",j),r.removeEventListener("selectend",j),r.removeEventListener("squeeze",j),r.removeEventListener("squeezestart",j),r.removeEventListener("squeezeend",j),r.removeEventListener("end",K),r.removeEventListener("inputsourceschange",ee);for(let Me=0;Me<L.length;Me++){let ze=D[Me];ze!==null&&(D[Me]=null,L[Me].disconnect(ze))}Z=null,J=null,S.reset();for(let Me in T)delete T[Me];e.setRenderTarget(R),x=null,p=null,f=null,r=null,C=null,mt.stop(),n.isPresenting=!1,e.setPixelRatio(N),e.setSize(F.width,F.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Me){s=Me,n.isPresenting===!0&&je("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Me){a=Me,n.isPresenting===!0&&je("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(Me){c=Me},this.getBaseLayer=function(){return p!==null?p:x},this.getBinding=function(){return f===null&&w&&(f=new XRWebGLBinding(r,t)),f},this.getFrame=function(){return v},this.getSession=function(){return r},this.setSession=async function(Me){if(r=Me,r!==null){if(R=e.getRenderTarget(),r.addEventListener("select",j),r.addEventListener("selectstart",j),r.addEventListener("selectend",j),r.addEventListener("squeeze",j),r.addEventListener("squeezestart",j),r.addEventListener("squeezeend",j),r.addEventListener("end",K),r.addEventListener("inputsourceschange",ee),P.xrCompatible!==!0&&await t.makeXRCompatible(),N=e.getPixelRatio(),e.getSize(F),w&&"createProjectionLayer"in XRWebGLBinding.prototype){let $e=null,Et=null,Tt=null;P.depth&&(Tt=P.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,$e=P.stencil?eo:ws,Et=P.stencil?Vo:Ai);let Ct={colorFormat:t.RGBA8,depthFormat:Tt,scaleFactor:s};f=this.getBinding(),p=f.createProjectionLayer(Ct),r.updateRenderState({layers:[p]}),e.setPixelRatio(1),e.setSize(p.textureWidth,p.textureHeight,!1),C=new ha(p.textureWidth,p.textureHeight,{format:br,type:zi,depthTexture:new ls(p.textureWidth,p.textureHeight,Et,void 0,void 0,void 0,void 0,void 0,void 0,$e),stencilBuffer:P.stencil,colorSpace:e.outputColorSpace,samples:P.antialias?4:0,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}else{let $e={antialias:P.antialias,alpha:!0,depth:P.depth,stencil:P.stencil,framebufferScaleFactor:s};x=new XRWebGLLayer(r,t,$e),r.updateRenderState({baseLayer:x}),e.setPixelRatio(1),e.setSize(x.framebufferWidth,x.framebufferHeight,!1),C=new ha(x.framebufferWidth,x.framebufferHeight,{format:br,type:zi,colorSpace:e.outputColorSpace,stencilBuffer:P.stencil,resolveDepthBuffer:x.ignoreDepthValues===!1,resolveStencilBuffer:x.ignoreDepthValues===!1})}C.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 ee(Me){for(let ze=0;ze<Me.removed.length;ze++){let $e=Me.removed[ze],Et=D.indexOf($e);Et>=0&&(D[Et]=null,L[Et].disconnect($e))}for(let ze=0;ze<Me.added.length;ze++){let $e=Me.added[ze],Et=D.indexOf($e);if(Et===-1){for(let Ct=0;Ct<L.length;Ct++)if(Ct>=D.length){D.push($e),Et=Ct;break}else if(D[Ct]===null){D[Ct]=$e,Et=Ct;break}if(Et===-1)break}let Tt=L[Et];Tt&&Tt.connect($e)}}let ae=new ie,ce=new ie;function de(Me,ze,$e){ae.setFromMatrixPosition(ze.matrixWorld),ce.setFromMatrixPosition($e.matrixWorld);let Et=ae.distanceTo(ce),Tt=ze.projectionMatrix.elements,Ct=$e.projectionMatrix.elements,un=Tt[14]/(Tt[10]-1),Gt=Tt[14]/(Tt[10]+1),Xe=(Tt[9]+1)/Tt[5],st=(Tt[9]-1)/Tt[5],tt=(Tt[8]-1)/Tt[0],vt=(Ct[8]+1)/Ct[0],yt=un*tt,ln=un*vt,Kt=Et/(-tt+vt),Qt=Kt*-tt;if(ze.matrixWorld.decompose(Me.position,Me.quaternion,Me.scale),Me.translateX(Qt),Me.translateZ(Kt),Me.matrixWorld.compose(Me.position,Me.quaternion,Me.scale),Me.matrixWorldInverse.copy(Me.matrixWorld).invert(),Tt[10]===-1)Me.projectionMatrix.copy(ze.projectionMatrix),Me.projectionMatrixInverse.copy(ze.projectionMatrixInverse);else{let xn=un+Kt,ge=Gt+Kt,pi=yt-Qt,Bn=ln+(Et-Qt),le=Xe*Gt/ge*xn,X=st*Gt/ge*xn;Me.projectionMatrix.makePerspective(pi,Bn,le,X,xn,ge),Me.projectionMatrixInverse.copy(Me.projectionMatrix).invert()}}function ve(Me,ze){ze===null?Me.matrixWorld.copy(Me.matrix):Me.matrixWorld.multiplyMatrices(ze.matrixWorld,Me.matrix),Me.matrixWorldInverse.copy(Me.matrixWorld).invert()}this.updateCamera=function(Me){if(r===null)return;let ze=Me.near,$e=Me.far;S.texture!==null&&(S.depthNear>0&&(ze=S.depthNear),S.depthFar>0&&($e=S.depthFar)),H.near=z.near=B.near=ze,H.far=z.far=B.far=$e,(Z!==H.near||J!==H.far)&&(r.updateRenderState({depthNear:H.near,depthFar:H.far}),Z=H.near,J=H.far),H.layers.mask=Me.layers.mask|6,B.layers.mask=H.layers.mask&-5,z.layers.mask=H.layers.mask&-3;let Et=Me.parent,Tt=H.cameras;ve(H,Et);for(let Ct=0;Ct<Tt.length;Ct++)ve(Tt[Ct],Et);Tt.length===2?de(H,B,z):H.projectionMatrix.copy(B.projectionMatrix),Ie(Me,H,Et)};function Ie(Me,ze,$e){$e===null?Me.matrix.copy(ze.matrixWorld):(Me.matrix.copy($e.matrixWorld),Me.matrix.invert(),Me.matrix.multiply(ze.matrixWorld)),Me.matrix.decompose(Me.position,Me.quaternion,Me.scale),Me.updateMatrixWorld(!0),Me.projectionMatrix.copy(ze.projectionMatrix),Me.projectionMatrixInverse.copy(ze.projectionMatrixInverse),Me.isPerspectiveCamera&&(Me.fov=If*2*Math.atan(1/Me.projectionMatrix.elements[5]),Me.zoom=1)}this.getCamera=function(){return H},this.getFoveation=function(){if(!(p===null&&x===null))return l},this.setFoveation=function(Me){l=Me,p!==null&&(p.fixedFoveation=Me),x!==null&&x.fixedFoveation!==void 0&&(x.fixedFoveation=Me)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(H)},this.getCameraTexture=function(Me){return T[Me]};let Qe=null;function Ue(Me,ze){if(u=ze.getViewerPose(c||o),v=ze,u!==null){let $e=u.views;x!==null&&(e.setRenderTargetFramebuffer(C,x.framebuffer),e.setRenderTarget(C));let Et=!1;$e.length!==H.cameras.length&&(H.cameras.length=0,Et=!0);for(let Gt=0;Gt<$e.length;Gt++){let Xe=$e[Gt],st=null;if(x!==null)st=x.getViewport(Xe);else{let vt=f.getViewSubImage(p,Xe);st=vt.viewport,Gt===0&&(e.setRenderTargetTextures(C,vt.colorTexture,vt.depthStencilTexture),e.setRenderTarget(C))}let tt=V[Gt];tt===void 0&&(tt=new Nr,tt.layers.enable(Gt),tt.viewport=new gn,V[Gt]=tt),tt.matrix.fromArray(Xe.transform.matrix),tt.matrix.decompose(tt.position,tt.quaternion,tt.scale),tt.projectionMatrix.fromArray(Xe.projectionMatrix),tt.projectionMatrixInverse.copy(tt.projectionMatrix).invert(),tt.viewport.set(st.x,st.y,st.width,st.height),Gt===0&&(H.matrix.copy(tt.matrix),H.matrix.decompose(H.position,H.quaternion,H.scale)),Et===!0&&H.cameras.push(tt)}let Tt=r.enabledFeatures;if(Tt&&Tt.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&w){f=n.getBinding();let Gt=f.getDepthInformation($e[0]);Gt&&Gt.isValid&&Gt.texture&&S.init(Gt,r.renderState)}if(Tt&&Tt.includes("camera-access")&&w){e.state.unbindTexture(),f=n.getBinding();for(let Gt=0;Gt<$e.length;Gt++){let Xe=$e[Gt].camera;if(Xe){let st=T[Xe];st||(st=new My,T[Xe]=st);let tt=f.getCameraImage(Xe);st.sourceTexture=tt}}}}for(let $e=0;$e<L.length;$e++){let Et=D[$e],Tt=L[$e];Et!==null&&Tt!==void 0&&Tt.update(Et,ze,c||o)}Qe&&Qe(Me,ze),ze.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:ze}),v=null}let mt=new kW;mt.setAnimationLoop(Ue),this.setAnimationLoop=function(Me){Qe=Me},this.dispose=function(){}}},_0e=new on,WW=new Sn;WW.set(-1,0,0,0,1,0,0,0,1);function x0e(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,LL(i)),T.isFog?(S.fogNear.value=T.near,S.fogFar.value=T.far):T.isFogExp2&&(S.fogDensity.value=T.density)}function r(S,T,P,R,C){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),p(S,T),T.isMeshPhysicalMaterial&&x(S,T,C)):T.isMeshMatcapMaterial?(s(S,T),v(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,P,R):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===hi&&(S.bumpScale.value*=-1)),T.normalMap&&(S.normalMap.value=T.normalMap,t(T.normalMap,S.normalMapTransform),S.normalScale.value.copy(T.normalScale),T.side===hi&&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 P=e.get(T),R=P.envMap,C=P.envMapRotation;R&&(S.envMap.value=R,S.envMapRotation.value.setFromMatrix4(_0e.makeRotationFromEuler(C)).transpose(),R.isCubeTexture&&R.isRenderTargetTexture===!1&&S.envMapRotation.value.premultiply(WW),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,P,R){S.diffuse.value.copy(T.color),S.opacity.value=T.opacity,S.size.value=T.size*P,S.scale.value=R*.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 p(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 x(S,T,P){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===hi&&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=P.texture,S.transmissionSamplerSize.value.set(P.width,P.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 v(S,T){T.matcap&&(S.matcap.value=T.matcap)}function w(S,T){let P=e.get(T).light;S.referencePosition.value.setFromMatrixPosition(P.matrixWorld),S.nearDistance.value=P.shadow.camera.near,S.farDistance.value=P.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function y0e(i,e,t,n){let r={},s={},o=[],a=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS);function l(C,L){let D=L.program;n.uniformBlockBinding(C,D)}function c(C,L){let D=r[C.id];D===void 0&&(S(C),D=u(C),r[C.id]=D,C.addEventListener("dispose",P));let F=L.program;n.updateUBOMapping(C,F);let N=e.render.frame;s[C.id]!==N&&(p(C),s[C.id]=N)}function u(C){let L=f();C.__bindingPointIndex=L;let D=i.createBuffer(),F=C.__size,N=C.usage;return i.bindBuffer(i.UNIFORM_BUFFER,D),i.bufferData(i.UNIFORM_BUFFER,F,N),i.bindBuffer(i.UNIFORM_BUFFER,null),i.bindBufferBase(i.UNIFORM_BUFFER,L,D),D}function f(){for(let C=0;C<a;C++)if(o.indexOf(C)===-1)return o.push(C),C;return Ge("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function p(C){let L=r[C.id],D=C.uniforms,F=C.__cache;i.bindBuffer(i.UNIFORM_BUFFER,L);for(let N=0,B=D.length;N<B;N++){let z=D[N];if(Array.isArray(z))for(let V=0,H=z.length;V<H;V++)x(z[V],N,V,F);else x(z,N,0,F)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function x(C,L,D,F){if(w(C,L,D,F)===!0){let N=C.__offset,B=C.value;if(Array.isArray(B)){let z=0;for(let V=0;V<B.length;V++){let H=B[V],Z=T(H);v(H,C.__data,z),typeof H!="number"&&typeof H!="boolean"&&!H.isMatrix3&&!ArrayBuffer.isView(H)&&(z+=Z.storage/Float32Array.BYTES_PER_ELEMENT)}}else v(B,C.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,N,C.__data)}}function v(C,L,D){typeof C=="number"||typeof C=="boolean"?L[0]=C:C.isMatrix3?(L[0]=C.elements[0],L[1]=C.elements[1],L[2]=C.elements[2],L[3]=0,L[4]=C.elements[3],L[5]=C.elements[4],L[6]=C.elements[5],L[7]=0,L[8]=C.elements[6],L[9]=C.elements[7],L[10]=C.elements[8],L[11]=0):ArrayBuffer.isView(C)?L.set(new C.constructor(C.buffer,C.byteOffset,L.length)):C.toArray(L,D)}function w(C,L,D,F){let N=C.value,B=L+"_"+D;if(F[B]===void 0)return typeof N=="number"||typeof N=="boolean"?F[B]=N:ArrayBuffer.isView(N)?F[B]=N.slice():F[B]=N.clone(),!0;{let z=F[B];if(typeof N=="number"||typeof N=="boolean"){if(z!==N)return F[B]=N,!0}else{if(ArrayBuffer.isView(N))return!0;if(z.equals(N)===!1)return z.copy(N),!0}}return!1}function S(C){let L=C.uniforms,D=0,F=16;for(let B=0,z=L.length;B<z;B++){let V=Array.isArray(L[B])?L[B]:[L[B]];for(let H=0,Z=V.length;H<Z;H++){let J=V[H],j=Array.isArray(J.value)?J.value:[J.value];for(let K=0,ee=j.length;K<ee;K++){let ae=j[K],ce=T(ae),de=D%F,ve=de%ce.boundary,Ie=de+ve;D+=ve,Ie!==0&&F-Ie<ce.storage&&(D+=F-Ie),J.__data=new Float32Array(ce.storage/Float32Array.BYTES_PER_ELEMENT),J.__offset=D,D+=ce.storage}}}let N=D%F;return N>0&&(D+=F-N),C.__size=D,C.__cache={},this}function T(C){let L={boundary:0,storage:0};return typeof C=="number"||typeof C=="boolean"?(L.boundary=4,L.storage=4):C.isVector2?(L.boundary=8,L.storage=8):C.isVector3||C.isColor?(L.boundary=16,L.storage=12):C.isVector4?(L.boundary=16,L.storage=16):C.isMatrix3?(L.boundary=48,L.storage=48):C.isMatrix4?(L.boundary=64,L.storage=64):C.isTexture?je("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(C)?(L.boundary=16,L.storage=C.byteLength):je("WebGLRenderer: Unsupported uniform value type.",C),L}function P(C){let L=C.target;L.removeEventListener("dispose",P);let D=o.indexOf(L.__bindingPointIndex);o.splice(D,1),i.deleteBuffer(r[L.id]),delete r[L.id],delete s[L.id]}function R(){for(let C in r)i.deleteBuffer(r[C]);o=[],r={},s={}}return{bind:l,update:c,dispose:R}}var v0e=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]),oh=null;function b0e(){return oh===null&&(oh=new EA(v0e,16,16,Ms,Di),oh.name="DFG_LUT",oh.minFilter=bi,oh.magFilter=bi,oh.wrapS=Go,oh.wrapT=Go,oh.generateMipmaps=!1,oh.needsUpdate=!0),oh}var c3=class{constructor(e={}){let{canvas:t=r3(),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:p=!1,outputBufferType:x=zi}=e;this.isWebGLRenderer=!0;let v;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");v=n.getContextAttributes().alpha}else v=o;let w=x,S=new Set([up,Qu,Ku]),T=new Set([zi,Ai,Xa,Vo,UA,kA]),P=new Uint32Array(4),R=new Int32Array(4),C=new ie,L=null,D=null,F=[],N=[],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=zs,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let z=this,V=!1,H=null,Z=null,J=null,j=null;this._outputColorSpace=yr;let K=0,ee=0,ae=null,ce=-1,de=null,ve=new gn,Ie=new gn,Qe=null,Ue=new Ut(0),mt=0,Me=t.width,ze=t.height,$e=1,Et=null,Tt=null,Ct=new gn(0,0,Me,ze),un=new gn(0,0,Me,ze),Gt=!1,Xe=new tc,st=!1,tt=!1,vt=new on,yt=new ie,ln=new gn,Kt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Qt=!1;function xn(){return ae===null?$e:1}let ge=n;function pi(te,Se){return t.getContext(te,Se)}try{let te={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",Hi,!1),t.addEventListener("webglcontextrestored",Nn,!1),t.addEventListener("webglcontextcreationerror",zr,!1),ge===null){let Se="webgl2";if(ge=pi(Se,te),ge===null)throw pi(Se)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(te){throw Ge("WebGLRenderer: "+te.message),te}let Bn,le,X,Te,Pe,Ve,gt,St,qe,Ke,Rt,en,Pt,Mt,cn,yn,Pn,xe,bt,Ye,wt,Dt,ct;function Ce(){Bn=new Rde(ge),Bn.init(),wt=new A0e(ge,Bn),le=new vde(ge,Bn,e,wt),X=new d0e(ge,Bn),le.reversedDepthBuffer&&p&&X.buffers.depth.setReversed(!0),Z=ge.createFramebuffer(),J=ge.createFramebuffer(),j=ge.createFramebuffer(),Te=new Nde(ge),Pe=new Jpe,Ve=new p0e(ge,Bn,X,Pe,le,wt,Te),gt=new Cde(z),St=new Oue(ge),Dt=new xde(ge,St),qe=new Pde(ge,St,Te,Dt),Ke=new Dde(ge,qe,St,Dt,Te),xe=new Lde(ge,le,Ve),cn=new bde(Pe),Rt=new Qpe(z,gt,Bn,le,Dt,cn),en=new x0e(z,Pe),Pt=new t0e,Mt=new a0e(Bn),Pn=new _de(z,gt,X,Ke,v,l),yn=new f0e(z,Ke,le),ct=new y0e(ge,Te,le,X),bt=new yde(ge,Bn,Te),Ye=new Ide(ge,Bn,Te),Te.programs=Rt.programs,z.capabilities=le,z.extensions=Bn,z.properties=Pe,z.renderLists=Pt,z.shadowMap=yn,z.state=X,z.info=Te}Ce(),w!==zi&&(B=new Ode(w,t.width,t.height,a,r,s));let jt=new tD(z,ge);this.xr=jt,this.getContext=function(){return ge},this.getContextAttributes=function(){return ge.getContextAttributes()},this.forceContextLoss=function(){let te=Bn.get("WEBGL_lose_context");te&&te.loseContext()},this.forceContextRestore=function(){let te=Bn.get("WEBGL_lose_context");te&&te.restoreContext()},this.getPixelRatio=function(){return $e},this.setPixelRatio=function(te){te!==void 0&&($e=te,this.setSize(Me,ze,!1))},this.getSize=function(te){return te.set(Me,ze)},this.setSize=function(te,Se,ke=!0){if(jt.isPresenting){je("WebGLRenderer: Can't change size while VR device is presenting.");return}Me=te,ze=Se,t.width=Math.floor(te*$e),t.height=Math.floor(Se*$e),ke===!0&&(t.style.width=te+"px",t.style.height=Se+"px"),B!==null&&B.setSize(t.width,t.height),this.setViewport(0,0,te,Se)},this.getDrawingBufferSize=function(te){return te.set(Me*$e,ze*$e).floor()},this.setDrawingBufferSize=function(te,Se,ke){Me=te,ze=Se,$e=ke,t.width=Math.floor(te*ke),t.height=Math.floor(Se*ke),this.setViewport(0,0,te,Se)},this.setEffects=function(te){if(w===zi){Ge("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(te){for(let Se=0;Se<te.length;Se++)if(te[Se].isOutputPass===!0){je("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}B.setEffects(te||[])},this.getCurrentViewport=function(te){return te.copy(ve)},this.getViewport=function(te){return te.copy(Ct)},this.setViewport=function(te,Se,ke,Le){te.isVector4?Ct.set(te.x,te.y,te.z,te.w):Ct.set(te,Se,ke,Le),X.viewport(ve.copy(Ct).multiplyScalar($e).round())},this.getScissor=function(te){return te.copy(un)},this.setScissor=function(te,Se,ke,Le){te.isVector4?un.set(te.x,te.y,te.z,te.w):un.set(te,Se,ke,Le),X.scissor(Ie.copy(un).multiplyScalar($e).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(te){X.setScissorTest(Gt=te)},this.setOpaqueSort=function(te){Et=te},this.setTransparentSort=function(te){Tt=te},this.getClearColor=function(te){return te.copy(Pn.getClearColor())},this.setClearColor=function(){Pn.setClearColor(...arguments)},this.getClearAlpha=function(){return Pn.getClearAlpha()},this.setClearAlpha=function(){Pn.setClearAlpha(...arguments)},this.clear=function(te=!0,Se=!0,ke=!0){let Le=0;if(te){let De=!1;if(ae!==null){let zt=ae.texture.format;De=S.has(zt)}if(De){let zt=ae.texture.type,Yt=T.has(zt),kt=Pn.getClearColor(),tn=Pn.getClearAlpha(),hn=kt.r,zn=kt.g,$n=kt.b;Yt?(P[0]=hn,P[1]=zn,P[2]=$n,P[3]=tn,ge.clearBufferuiv(ge.COLOR,0,P)):(R[0]=hn,R[1]=zn,R[2]=$n,R[3]=tn,ge.clearBufferiv(ge.COLOR,0,R))}else Le|=ge.COLOR_BUFFER_BIT}Se&&(Le|=ge.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),ke&&(Le|=ge.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Le!==0&&ge.clear(Le)},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(te){te.setRenderer(this),H=te},this.dispose=function(){t.removeEventListener("webglcontextlost",Hi,!1),t.removeEventListener("webglcontextrestored",Nn,!1),t.removeEventListener("webglcontextcreationerror",zr,!1),Pn.dispose(),Pt.dispose(),Mt.dispose(),Pe.dispose(),gt.dispose(),Ke.dispose(),Dt.dispose(),ct.dispose(),Rt.dispose(),jt.dispose(),jt.removeEventListener("sessionstart",Ns),jt.removeEventListener("sessionend",ll),Au.stop()};function Hi(te){te.preventDefault(),vA("WebGLRenderer: Context Lost."),V=!0}function Nn(){vA("WebGLRenderer: Context Restored."),V=!1;let te=Te.autoReset,Se=yn.enabled,ke=yn.autoUpdate,Le=yn.needsUpdate,De=yn.type;Ce(),Te.autoReset=te,yn.enabled=Se,yn.autoUpdate=ke,yn.needsUpdate=Le,yn.type=De}function zr(te){Ge("WebGLRenderer: A WebGL context could not be created. Reason: ",te.statusMessage)}function gr(te){let Se=te.target;Se.removeEventListener("dispose",gr),ol(Se)}function ol(te){na(te),Pe.remove(te)}function na(te){let Se=Pe.get(te).programs;Se!==void 0&&(Se.forEach(function(ke){Rt.releaseProgram(ke)}),te.isShaderMaterial&&Rt.releaseShaderCache(te))}this.renderBufferDirect=function(te,Se,ke,Le,De,zt){Se===null&&(Se=Kt);let Yt=De.isMesh&&De.matrixWorld.determinantAffine()<0,kt=n9(te,Se,ke,Le,De);X.setMaterial(Le,Yt);let tn=ke.index,hn=1;if(Le.wireframe===!0){if(tn=qe.getWireframeAttribute(ke),tn===void 0)return;hn=2}let zn=ke.drawRange,$n=ke.attributes.position,pn=zn.start*hn,Ui=(zn.start+zn.count)*hn;zt!==null&&(pn=Math.max(pn,zt.start*hn),Ui=Math.min(Ui,(zt.start+zt.count)*hn)),tn!==null?(pn=Math.max(pn,0),Ui=Math.min(Ui,tn.count)):$n!=null&&(pn=Math.max(pn,0),Ui=Math.min(Ui,$n.count));let Vr=Ui-pn;if(Vr<0||Vr===1/0)return;Dt.setup(De,Le,kt,ke,tn);let Cr,Wi=bt;if(tn!==null&&(Cr=St.get(tn),Wi=Ye,Wi.setIndex(Cr)),De.isMesh)Le.wireframe===!0?(X.setLineWidth(Le.wireframeLinewidth*xn()),Wi.setMode(ge.LINES)):Wi.setMode(ge.TRIANGLES);else if(De.isLine){let ao=Le.linewidth;ao===void 0&&(ao=1),X.setLineWidth(ao*xn()),De.isLineSegments?Wi.setMode(ge.LINES):De.isLineLoop?Wi.setMode(ge.LINE_LOOP):Wi.setMode(ge.LINE_STRIP)}else De.isPoints?Wi.setMode(ge.POINTS):De.isSprite&&Wi.setMode(ge.TRIANGLES);if(De.isBatchedMesh)if(Bn.get("WEBGL_multi_draw"))Wi.renderMultiDraw(De._multiDrawStarts,De._multiDrawCounts,De._multiDrawCount);else{let ao=De._multiDrawStarts,Xt=De._multiDrawCounts,La=De._multiDrawCount,mi=tn?St.get(tn).bytesPerElement:1,cl=Pe.get(Le).currentProgram.getUniforms();for(let bc=0;bc<La;bc++)cl.setValue(ge,"_gl_DrawID",bc),Wi.render(ao[bc]/mi,Xt[bc])}else if(De.isInstancedMesh)Wi.renderInstances(pn,Vr,De.count);else if(ke.isInstancedBufferGeometry){let ao=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Xt=Math.min(ke.instanceCount,ao);Wi.renderInstances(pn,Vr,Xt)}else Wi.render(pn,Vr)};function al(te,Se,ke){te.transparent===!0&&te.side===rr&&te.forceSinglePass===!1?(te.side=hi,te.needsUpdate=!0,sx(te,Se,ke),te.side=go,te.needsUpdate=!0,sx(te,Se,ke),te.side=rr):sx(te,Se,ke)}this.compile=function(te,Se,ke=null){ke===null&&(ke=te),D=Mt.get(ke),D.init(Se),N.push(D),ke.traverseVisible(function(De){De.isLight&&De.layers.test(Se.layers)&&(D.pushLight(De),De.castShadow&&D.pushShadow(De))}),te!==ke&&te.traverseVisible(function(De){De.isLight&&De.layers.test(Se.layers)&&(D.pushLight(De),De.castShadow&&D.pushShadow(De))}),D.setupLights();let Le=new Set;return te.traverse(function(De){if(!(De.isMesh||De.isPoints||De.isLine||De.isSprite))return;let zt=De.material;if(zt)if(Array.isArray(zt))for(let Yt=0;Yt<zt.length;Yt++){let kt=zt[Yt];al(kt,ke,De),Le.add(kt)}else al(zt,ke,De),Le.add(zt)}),D=N.pop(),Le},this.compileAsync=function(te,Se,ke=null){let Le=this.compile(te,Se,ke);return new Promise(De=>{function zt(){if(Le.forEach(function(Yt){Pe.get(Yt).currentProgram.isReady()&&Le.delete(Yt)}),Le.size===0){De(te);return}setTimeout(zt,10)}Bn.get("KHR_parallel_shader_compile")!==null?zt():setTimeout(zt,10)})};let Na=null;function or(te){Na&&Na(te)}function Ns(){Au.stop()}function ll(){Au.start()}let Au=new kW;Au.setAnimationLoop(or),typeof self<"u"&&Au.setContext(self),this.setAnimationLoop=function(te){Na=te,jt.setAnimationLoop(te),te===null?Au.stop():Au.start()},jt.addEventListener("sessionstart",Ns),jt.addEventListener("sessionend",ll),this.render=function(te,Se){if(Se!==void 0&&Se.isCamera!==!0){Ge("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(V===!0)return;H!==null&&H.renderStart(te,Se);let ke=jt.enabled===!0&&jt.isPresenting===!0,Le=B!==null&&(ae===null||ke)&&B.begin(z,ae);if(te.matrixWorldAutoUpdate===!0&&te.updateMatrixWorld(),Se.parent===null&&Se.matrixWorldAutoUpdate===!0&&Se.updateMatrixWorld(),jt.enabled===!0&&jt.isPresenting===!0&&(B===null||B.isCompositing()===!1)&&(jt.cameraAutoUpdate===!0&&jt.updateCamera(Se),Se=jt.getCamera()),te.isScene===!0&&te.onBeforeRender(z,te,Se,ae),D=Mt.get(te,N.length),D.init(Se),D.state.textureUnits=Ve.getTextureUnits(),N.push(D),vt.multiplyMatrices(Se.projectionMatrix,Se.matrixWorldInverse),Xe.setFromProjectionMatrix(vt,mo,Se.reversedDepth),tt=this.localClippingEnabled,st=cn.init(this.clippingPlanes,tt),L=Pt.get(te,F.length),L.init(),F.push(L),jt.enabled===!0&&jt.isPresenting===!0){let Yt=z.xr.getDepthSensingMesh();Yt!==null&&jb(Yt,Se,-1/0,z.sortObjects)}jb(te,Se,0,z.sortObjects),L.finish(),z.sortObjects===!0&&L.sort(Et,Tt,Se.reversedDepth),Qt=jt.enabled===!1||jt.isPresenting===!1||jt.hasDepthSensing()===!1,Qt&&Pn.addToRenderList(L,te),this.info.render.frame++,this.info.autoReset===!0&&this.info.reset(),st===!0&&cn.beginShadows();let De=D.state.shadowsArray;if(yn.render(De,te,Se),st===!0&&cn.endShadows(),(Le&&B.hasRenderPass())===!1){let Yt=L.opaque,kt=L.transmissive;if(D.setupLights(),Se.isArrayCamera){let tn=Se.cameras;if(kt.length>0)for(let hn=0,zn=tn.length;hn<zn;hn++){let $n=tn[hn];p4(Yt,kt,te,$n)}Qt&&Pn.render(te);for(let hn=0,zn=tn.length;hn<zn;hn++){let $n=tn[hn];d4(L,te,$n,$n.viewport)}}else kt.length>0&&p4(Yt,kt,te,Se),Qt&&Pn.render(te),d4(L,te,Se)}ae!==null&&ee===0&&(Ve.updateMultisampleRenderTarget(ae),Ve.updateRenderTargetMipmap(ae)),Le&&B.end(z),te.isScene===!0&&te.onAfterRender(z,te,Se),Dt.resetDefaultState(),ce=-1,de=null,N.pop(),N.length>0?(D=N[N.length-1],Ve.setTextureUnits(D.state.textureUnits),st===!0&&cn.setGlobalState(z.clippingPlanes,D.state.camera)):D=null,F.pop(),F.length>0?L=F[F.length-1]:L=null,H!==null&&H.renderEnd()};function jb(te,Se,ke,Le){if(te.visible===!1)return;if(te.layers.test(Se.layers)){if(te.isGroup)ke=te.renderOrder;else if(te.isLOD)te.autoUpdate===!0&&te.update(Se);else if(te.isLightProbeGrid)D.pushLightProbeGrid(te);else if(te.isLight)D.pushLight(te),te.castShadow&&D.pushShadow(te);else if(te.isSprite){if(!te.frustumCulled||Xe.intersectsSprite(te)){Le&&ln.setFromMatrixPosition(te.matrixWorld).applyMatrix4(vt);let Yt=Ke.update(te),kt=te.material;kt.visible&&L.push(te,Yt,kt,ke,ln.z,null)}}else if((te.isMesh||te.isLine||te.isPoints)&&(!te.frustumCulled||Xe.intersectsObject(te))){let Yt=Ke.update(te),kt=te.material;if(Le&&(te.boundingSphere!==void 0?(te.boundingSphere===null&&te.computeBoundingSphere(),ln.copy(te.boundingSphere.center)):(Yt.boundingSphere===null&&Yt.computeBoundingSphere(),ln.copy(Yt.boundingSphere.center)),ln.applyMatrix4(te.matrixWorld).applyMatrix4(vt)),Array.isArray(kt)){let tn=Yt.groups;for(let hn=0,zn=tn.length;hn<zn;hn++){let $n=tn[hn],pn=kt[$n.materialIndex];pn&&pn.visible&&L.push(te,Yt,pn,ke,ln.z,$n)}}else kt.visible&&L.push(te,Yt,kt,ke,ln.z,null)}}let zt=te.children;for(let Yt=0,kt=zt.length;Yt<kt;Yt++)jb(zt[Yt],Se,ke,Le)}function d4(te,Se,ke,Le){let{opaque:De,transmissive:zt,transparent:Yt}=te;D.setupLightsView(ke),st===!0&&cn.setGlobalState(z.clippingPlanes,ke),Le&&X.viewport(ve.copy(Le)),De.length>0&&rx(De,Se,ke),zt.length>0&&rx(zt,Se,ke),Yt.length>0&&rx(Yt,Se,ke),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function p4(te,Se,ke,Le){if((ke.isScene===!0?ke.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[Le.id]===void 0){let pn=Bn.has("EXT_color_buffer_half_float")||Bn.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[Le.id]=new ha(1,1,{generateMipmaps:!0,type:pn?Di:zi,minFilter:xo,samples:Math.max(4,le.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:sn.workingColorSpace})}let zt=D.state.transmissionRenderTarget[Le.id],Yt=Le.viewport||ve;zt.setSize(Yt.z*z.transmissionResolutionScale,Yt.w*z.transmissionResolutionScale);let kt=z.getRenderTarget(),tn=z.getActiveCubeFace(),hn=z.getActiveMipmapLevel();z.setRenderTarget(zt),z.getClearColor(Ue),mt=z.getClearAlpha(),mt<1&&z.setClearColor(16777215,.5),z.clear(),Qt&&Pn.render(ke);let zn=z.toneMapping;z.toneMapping=zs;let $n=Le.viewport;if(Le.viewport!==void 0&&(Le.viewport=void 0),D.setupLightsView(Le),st===!0&&cn.setGlobalState(z.clippingPlanes,Le),rx(te,ke,Le),Ve.updateMultisampleRenderTarget(zt),Ve.updateRenderTargetMipmap(zt),Bn.has("WEBGL_multisampled_render_to_texture")===!1){let pn=!1;for(let Ui=0,Vr=Se.length;Ui<Vr;Ui++){let Cr=Se[Ui],{object:Wi,geometry:ao,material:Xt,group:La}=Cr;if(Xt.side===rr&&Wi.layers.test(Le.layers)){let mi=Xt.side;Xt.side=hi,Xt.needsUpdate=!0,A4(Wi,ke,Le,ao,Xt,La),Xt.side=mi,Xt.needsUpdate=!0,pn=!0}}pn===!0&&(Ve.updateMultisampleRenderTarget(zt),Ve.updateRenderTargetMipmap(zt))}z.setRenderTarget(kt,tn,hn),z.setClearColor(Ue,mt),$n!==void 0&&(Le.viewport=$n),z.toneMapping=zn}function rx(te,Se,ke){let Le=Se.isScene===!0?Se.overrideMaterial:null;for(let De=0,zt=te.length;De<zt;De++){let Yt=te[De],{object:kt,geometry:tn,group:hn}=Yt,zn=Yt.material;zn.allowOverride===!0&&Le!==null&&(zn=Le),kt.layers.test(ke.layers)&&A4(kt,Se,ke,tn,zn,hn)}}function A4(te,Se,ke,Le,De,zt){te.onBeforeRender(z,Se,ke,Le,De,zt),te.modelViewMatrix.multiplyMatrices(ke.matrixWorldInverse,te.matrixWorld),te.normalMatrix.getNormalMatrix(te.modelViewMatrix),De.onBeforeRender(z,Se,ke,Le,te,zt),De.transparent===!0&&De.side===rr&&De.forceSinglePass===!1?(De.side=hi,De.needsUpdate=!0,z.renderBufferDirect(ke,Se,Le,De,te,zt),De.side=go,De.needsUpdate=!0,z.renderBufferDirect(ke,Se,Le,De,te,zt),De.side=rr):z.renderBufferDirect(ke,Se,Le,De,te,zt),te.onAfterRender(z,Se,ke,Le,De,zt)}function sx(te,Se,ke){Se.isScene!==!0&&(Se=Kt);let Le=Pe.get(te),De=D.state.lights,zt=D.state.shadowsArray,Yt=De.state.version,kt=Rt.getParameters(te,De.state,zt,Se,ke,D.state.lightProbeGridArray),tn=Rt.getProgramCacheKey(kt),hn=Le.programs;Le.environment=te.isMeshStandardMaterial||te.isMeshLambertMaterial||te.isMeshPhongMaterial?Se.environment:null,Le.fog=Se.fog;let zn=te.isMeshStandardMaterial||te.isMeshLambertMaterial&&!te.envMap||te.isMeshPhongMaterial&&!te.envMap;Le.envMap=gt.get(te.envMap||Le.environment,zn),Le.envMapRotation=Le.environment!==null&&te.envMap===null?Se.environmentRotation:te.envMapRotation,hn===void 0&&(te.addEventListener("dispose",gr),hn=new Map,Le.programs=hn);let $n=hn.get(tn);if($n!==void 0){if(Le.currentProgram===$n&&Le.lightsStateVersion===Yt)return g4(te,kt),$n}else kt.uniforms=Rt.getUniforms(te),H!==null&&te.isNodeMaterial&&H.build(te,ke,kt),te.onBeforeCompile(kt,z),$n=Rt.acquireProgram(kt,tn),hn.set(tn,$n),Le.uniforms=kt.uniforms;let pn=Le.uniforms;return(!te.isShaderMaterial&&!te.isRawShaderMaterial||te.clipping===!0)&&(pn.clippingPlanes=cn.uniform),g4(te,kt),Le.needsLights=r9(te),Le.lightsStateVersion=Yt,Le.needsLights&&(pn.ambientLightColor.value=De.state.ambient,pn.lightProbe.value=De.state.probe,pn.directionalLights.value=De.state.directional,pn.directionalLightShadows.value=De.state.directionalShadow,pn.spotLights.value=De.state.spot,pn.spotLightShadows.value=De.state.spotShadow,pn.rectAreaLights.value=De.state.rectArea,pn.ltc_1.value=De.state.rectAreaLTC1,pn.ltc_2.value=De.state.rectAreaLTC2,pn.pointLights.value=De.state.point,pn.pointLightShadows.value=De.state.pointShadow,pn.hemisphereLights.value=De.state.hemi,pn.directionalShadowMatrix.value=De.state.directionalShadowMatrix,pn.spotLightMatrix.value=De.state.spotLightMatrix,pn.spotLightMap.value=De.state.spotLightMap,pn.pointShadowMatrix.value=De.state.pointShadowMatrix),Le.lightProbeGrid=D.state.lightProbeGridArray.length>0,Le.currentProgram=$n,Le.uniformsList=null,$n}function m4(te){if(te.uniformsList===null){let Se=te.currentProgram.getUniforms();te.uniformsList=D_.seqWithValue(Se.seq,te.uniforms)}return te.uniformsList}function g4(te,Se){let ke=Pe.get(te);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 t9(te,Se){if(te.length===0)return null;if(te.length===1)return te[0].texture!==null?te[0]:null;C.setFromMatrixPosition(Se.matrixWorld);for(let ke=0,Le=te.length;ke<Le;ke++){let De=te[ke];if(De.texture!==null&&De.boundingBox.containsPoint(C))return De}return null}function n9(te,Se,ke,Le,De){Se.isScene!==!0&&(Se=Kt),Ve.resetTextureUnits();let zt=Se.fog,Yt=Le.isMeshStandardMaterial||Le.isMeshLambertMaterial||Le.isMeshPhongMaterial?Se.environment:null,kt=ae===null?z.outputColorSpace:ae.isXRRenderTarget===!0?ae.texture.colorSpace:sn.workingColorSpace,tn=Le.isMeshStandardMaterial||Le.isMeshLambertMaterial&&!Le.envMap||Le.isMeshPhongMaterial&&!Le.envMap,hn=gt.get(Le.envMap||Yt,tn),zn=Le.vertexColors===!0&&!!ke.attributes.color&&ke.attributes.color.itemSize===4,$n=!!ke.attributes.tangent&&(!!Le.normalMap||Le.anisotropy>0),pn=!!ke.morphAttributes.position,Ui=!!ke.morphAttributes.normal,Vr=!!ke.morphAttributes.color,Cr=zs;Le.toneMapped&&(ae===null||ae.isXRRenderTarget===!0)&&(Cr=z.toneMapping);let Wi=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,ao=Wi!==void 0?Wi.length:0,Xt=Pe.get(Le),La=D.state.lights;if(st===!0&&(tt===!0||te!==de)){let tr=te===de&&Le.id===ce;cn.setState(Le,te,tr)}let mi=!1;Le.version===Xt.__version?(Xt.needsLights&&Xt.lightsStateVersion!==La.state.version||Xt.outputColorSpace!==kt||De.isBatchedMesh&&Xt.batching===!1||!De.isBatchedMesh&&Xt.batching===!0||De.isBatchedMesh&&Xt.batchingColor===!0&&De.colorTexture===null||De.isBatchedMesh&&Xt.batchingColor===!1&&De.colorTexture!==null||De.isInstancedMesh&&Xt.instancing===!1||!De.isInstancedMesh&&Xt.instancing===!0||De.isSkinnedMesh&&Xt.skinning===!1||!De.isSkinnedMesh&&Xt.skinning===!0||De.isInstancedMesh&&Xt.instancingColor===!0&&De.instanceColor===null||De.isInstancedMesh&&Xt.instancingColor===!1&&De.instanceColor!==null||De.isInstancedMesh&&Xt.instancingMorph===!0&&De.morphTexture===null||De.isInstancedMesh&&Xt.instancingMorph===!1&&De.morphTexture!==null||Xt.envMap!==hn||Le.fog===!0&&Xt.fog!==zt||Xt.numClippingPlanes!==void 0&&(Xt.numClippingPlanes!==cn.numPlanes||Xt.numIntersection!==cn.numIntersection)||Xt.vertexAlphas!==zn||Xt.vertexTangents!==$n||Xt.morphTargets!==pn||Xt.morphNormals!==Ui||Xt.morphColors!==Vr||Xt.toneMapping!==Cr||Xt.morphTargetsCount!==ao||!!Xt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(mi=!0):(mi=!0,Xt.__version=Le.version);let cl=Xt.currentProgram;mi===!0&&(cl=sx(Le,Se,De),H&&Le.isNodeMaterial&&H.onUpdateProgram(Le,cl,Xt));let bc=!1,Xh=!1,R0=!1,ji=cl.getUniforms(),qr=Xt.uniforms;if(X.useProgram(cl.program)&&(bc=!0,Xh=!0,R0=!0),Le.id!==ce&&(ce=Le.id,Xh=!0),Xt.needsLights){let tr=t9(D.state.lightProbeGridArray,De);Xt.lightProbeGrid!==tr&&(Xt.lightProbeGrid=tr,Xh=!0)}if(bc||de!==te){X.buffers.depth.getReversed()&&te.reversedDepth!==!0&&(te._reversedDepth=!0,te.updateProjectionMatrix()),ji.setValue(ge,"projectionMatrix",te.projectionMatrix),ji.setValue(ge,"viewMatrix",te.matrixWorldInverse);let Yh=ji.map.cameraPosition;Yh!==void 0&&Yh.setValue(ge,yt.setFromMatrixPosition(te.matrixWorld)),le.logarithmicDepthBuffer&&ji.setValue(ge,"logDepthBufFC",2/(Math.log(te.far+1)/Math.LN2)),(Le.isMeshPhongMaterial||Le.isMeshToonMaterial||Le.isMeshLambertMaterial||Le.isMeshBasicMaterial||Le.isMeshStandardMaterial||Le.isShaderMaterial)&&ji.setValue(ge,"isOrthographic",te.isOrthographicCamera===!0),de!==te&&(de=te,Xh=!0,R0=!0)}if(Xt.needsLights&&(La.state.directionalShadowMap.length>0&&ji.setValue(ge,"directionalShadowMap",La.state.directionalShadowMap,Ve),La.state.spotShadowMap.length>0&&ji.setValue(ge,"spotShadowMap",La.state.spotShadowMap,Ve),La.state.pointShadowMap.length>0&&ji.setValue(ge,"pointShadowMap",La.state.pointShadowMap,Ve)),De.isSkinnedMesh){ji.setOptional(ge,De,"bindMatrix"),ji.setOptional(ge,De,"bindMatrixInverse");let tr=De.skeleton;tr&&(tr.boneTexture===null&&tr.computeBoneTexture(),ji.setValue(ge,"boneTexture",tr.boneTexture,Ve))}De.isBatchedMesh&&(ji.setOptional(ge,De,"batchingTexture"),ji.setValue(ge,"batchingTexture",De._matricesTexture,Ve),ji.setOptional(ge,De,"batchingIdTexture"),ji.setValue(ge,"batchingIdTexture",De._indirectTexture,Ve),ji.setOptional(ge,De,"batchingColorTexture"),De._colorsTexture!==null&&ji.setValue(ge,"batchingColorTexture",De._colorsTexture,Ve));let $h=ke.morphAttributes;if(($h.position!==void 0||$h.normal!==void 0||$h.color!==void 0)&&xe.update(De,ke,cl),(Xh||Xt.receiveShadow!==De.receiveShadow)&&(Xt.receiveShadow=De.receiveShadow,ji.setValue(ge,"receiveShadow",De.receiveShadow)),(Le.isMeshStandardMaterial||Le.isMeshLambertMaterial||Le.isMeshPhongMaterial)&&Le.envMap===null&&Se.environment!==null&&(qr.envMapIntensity.value=Se.environmentIntensity),qr.dfgLUT!==void 0&&(qr.dfgLUT.value=b0e()),Xh){if(ji.setValue(ge,"toneMappingExposure",z.toneMappingExposure),Xt.needsLights&&i9(qr,R0),zt&&Le.fog===!0&&en.refreshFogUniforms(qr,zt),en.refreshMaterialUniforms(qr,Le,$e,ze,D.state.transmissionRenderTarget[te.id]),Xt.needsLights&&Xt.lightProbeGrid){let tr=Xt.lightProbeGrid;qr.probesSH.value=tr.texture,qr.probesMin.value.copy(tr.boundingBox.min),qr.probesMax.value.copy(tr.boundingBox.max),qr.probesResolution.value.copy(tr.resolution)}D_.upload(ge,m4(Xt),qr,Ve)}if(Le.isShaderMaterial&&Le.uniformsNeedUpdate===!0&&(D_.upload(ge,m4(Xt),qr,Ve),Le.uniformsNeedUpdate=!1),Le.isSpriteMaterial&&ji.setValue(ge,"center",De.center),ji.setValue(ge,"modelViewMatrix",De.modelViewMatrix),ji.setValue(ge,"normalMatrix",De.normalMatrix),ji.setValue(ge,"modelMatrix",De.matrixWorld),Le.uniformsGroups!==void 0){let tr=Le.uniformsGroups;for(let Yh=0,P0=tr.length;Yh<P0;Yh++){let _4=tr[Yh];ct.update(_4,cl),ct.bind(_4,cl)}}return cl}function i9(te,Se){te.ambientLightColor.needsUpdate=Se,te.lightProbe.needsUpdate=Se,te.directionalLights.needsUpdate=Se,te.directionalLightShadows.needsUpdate=Se,te.pointLights.needsUpdate=Se,te.pointLightShadows.needsUpdate=Se,te.spotLights.needsUpdate=Se,te.spotLightShadows.needsUpdate=Se,te.rectAreaLights.needsUpdate=Se,te.hemisphereLights.needsUpdate=Se}function r9(te){return te.isMeshLambertMaterial||te.isMeshToonMaterial||te.isMeshPhongMaterial||te.isMeshStandardMaterial||te.isShadowMaterial||te.isShaderMaterial&&te.lights===!0}this.getActiveCubeFace=function(){return K},this.getActiveMipmapLevel=function(){return ee},this.getRenderTarget=function(){return ae},this.setRenderTargetTextures=function(te,Se,ke){let Le=Pe.get(te);Le.__autoAllocateDepthBuffer=te.resolveDepthBuffer===!1,Le.__autoAllocateDepthBuffer===!1&&(Le.__useRenderToTexture=!1),Pe.get(te.texture).__webglTexture=Se,Pe.get(te.depthTexture).__webglTexture=Le.__autoAllocateDepthBuffer?void 0:ke,Le.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(te,Se){let ke=Pe.get(te);ke.__webglFramebuffer=Se,ke.__useDefaultFramebuffer=Se===void 0},this.setRenderTarget=function(te,Se=0,ke=0){ae=te,K=Se,ee=ke;let Le=null,De=!1,zt=!1;if(te){let kt=Pe.get(te);if(kt.__useDefaultFramebuffer!==void 0){X.bindFramebuffer(ge.FRAMEBUFFER,kt.__webglFramebuffer),ve.copy(te.viewport),Ie.copy(te.scissor),Qe=te.scissorTest,X.viewport(ve),X.scissor(Ie),X.setScissorTest(Qe),ce=-1;return}else if(kt.__webglFramebuffer===void 0)Ve.setupRenderTarget(te);else if(kt.__hasExternalTextures)Ve.rebindTextures(te,Pe.get(te.texture).__webglTexture,Pe.get(te.depthTexture).__webglTexture);else if(te.depthBuffer){let zn=te.depthTexture;if(kt.__boundDepthTexture!==zn){if(zn!==null&&Pe.has(zn)&&(te.width!==zn.image.width||te.height!==zn.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");Ve.setupDepthRenderbuffer(te)}}let tn=te.texture;(tn.isData3DTexture||tn.isDataArrayTexture||tn.isCompressedArrayTexture)&&(zt=!0);let hn=Pe.get(te).__webglFramebuffer;te.isWebGLCubeRenderTarget?(Array.isArray(hn[Se])?Le=hn[Se][ke]:Le=hn[Se],De=!0):te.samples>0&&Ve.useMultisampledRTT(te)===!1?Le=Pe.get(te).__webglMultisampledFramebuffer:Array.isArray(hn)?Le=hn[ke]:Le=hn,ve.copy(te.viewport),Ie.copy(te.scissor),Qe=te.scissorTest}else ve.copy(Ct).multiplyScalar($e).floor(),Ie.copy(un).multiplyScalar($e).floor(),Qe=Gt;if(ke!==0&&(Le=Z),X.bindFramebuffer(ge.FRAMEBUFFER,Le)&&X.drawBuffers(te,Le),X.viewport(ve),X.scissor(Ie),X.setScissorTest(Qe),De){let kt=Pe.get(te.texture);ge.framebufferTexture2D(ge.FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_CUBE_MAP_POSITIVE_X+Se,kt.__webglTexture,ke)}else if(zt){let kt=Se;for(let tn=0;tn<te.textures.length;tn++){let hn=Pe.get(te.textures[tn]);ge.framebufferTextureLayer(ge.FRAMEBUFFER,ge.COLOR_ATTACHMENT0+tn,hn.__webglTexture,ke,kt)}}else if(te!==null&&ke!==0){let kt=Pe.get(te.texture);ge.framebufferTexture2D(ge.FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,kt.__webglTexture,ke)}ce=-1},this.readRenderTargetPixels=function(te,Se,ke,Le,De,zt,Yt,kt=0){if(!(te&&te.isWebGLRenderTarget)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let tn=Pe.get(te).__webglFramebuffer;if(te.isWebGLCubeRenderTarget&&Yt!==void 0&&(tn=tn[Yt]),tn){X.bindFramebuffer(ge.FRAMEBUFFER,tn);try{let hn=te.textures[kt],zn=hn.format,$n=hn.type;if(te.textures.length>1&&ge.readBuffer(ge.COLOR_ATTACHMENT0+kt),!le.textureFormatReadable(zn)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!le.textureTypeReadable($n)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Se>=0&&Se<=te.width-Le&&ke>=0&&ke<=te.height-De&&ge.readPixels(Se,ke,Le,De,wt.convert(zn),wt.convert($n),zt)}finally{let hn=ae!==null?Pe.get(ae).__webglFramebuffer:null;X.bindFramebuffer(ge.FRAMEBUFFER,hn)}}},this.readRenderTargetPixelsAsync=async function(te,Se,ke,Le,De,zt,Yt,kt=0){if(!(te&&te.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let tn=Pe.get(te).__webglFramebuffer;if(te.isWebGLCubeRenderTarget&&Yt!==void 0&&(tn=tn[Yt]),tn)if(Se>=0&&Se<=te.width-Le&&ke>=0&&ke<=te.height-De){X.bindFramebuffer(ge.FRAMEBUFFER,tn);let hn=te.textures[kt],zn=hn.format,$n=hn.type;if(te.textures.length>1&&ge.readBuffer(ge.COLOR_ATTACHMENT0+kt),!le.textureFormatReadable(zn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!le.textureTypeReadable($n))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let pn=ge.createBuffer();ge.bindBuffer(ge.PIXEL_PACK_BUFFER,pn),ge.bufferData(ge.PIXEL_PACK_BUFFER,zt.byteLength,ge.STREAM_READ),ge.readPixels(Se,ke,Le,De,wt.convert(zn),wt.convert($n),0);let Ui=ae!==null?Pe.get(ae).__webglFramebuffer:null;X.bindFramebuffer(ge.FRAMEBUFFER,Ui);let Vr=ge.fenceSync(ge.SYNC_GPU_COMMANDS_COMPLETE,0);return ge.flush(),await lW(ge,Vr,4),ge.bindBuffer(ge.PIXEL_PACK_BUFFER,pn),ge.getBufferSubData(ge.PIXEL_PACK_BUFFER,0,zt),ge.deleteBuffer(pn),ge.deleteSync(Vr),zt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(te,Se=null,ke=0){let Le=Math.pow(2,-ke),De=Math.floor(te.image.width*Le),zt=Math.floor(te.image.height*Le),Yt=Se!==null?Se.x:0,kt=Se!==null?Se.y:0;Ve.setTexture2D(te,0),ge.copyTexSubImage2D(ge.TEXTURE_2D,ke,0,0,Yt,kt,De,zt),X.unbindTexture()},this.copyTextureToTexture=function(te,Se,ke=null,Le=null,De=0,zt=0){let Yt,kt,tn,hn,zn,$n,pn,Ui,Vr,Cr=te.isCompressedTexture?te.mipmaps[zt]:te.image;if(ke!==null)Yt=ke.max.x-ke.min.x,kt=ke.max.y-ke.min.y,tn=ke.isBox3?ke.max.z-ke.min.z:1,hn=ke.min.x,zn=ke.min.y,$n=ke.isBox3?ke.min.z:0;else{let qr=Math.pow(2,-De);Yt=Math.floor(Cr.width*qr),kt=Math.floor(Cr.height*qr),te.isDataArrayTexture?tn=Cr.depth:te.isData3DTexture?tn=Math.floor(Cr.depth*qr):tn=1,hn=0,zn=0,$n=0}Le!==null?(pn=Le.x,Ui=Le.y,Vr=Le.z):(pn=0,Ui=0,Vr=0);let Wi=wt.convert(Se.format),ao=wt.convert(Se.type),Xt;Se.isData3DTexture?(Ve.setTexture3D(Se,0),Xt=ge.TEXTURE_3D):Se.isDataArrayTexture||Se.isCompressedArrayTexture?(Ve.setTexture2DArray(Se,0),Xt=ge.TEXTURE_2D_ARRAY):(Ve.setTexture2D(Se,0),Xt=ge.TEXTURE_2D),X.activeTexture(ge.TEXTURE0),X.pixelStorei(ge.UNPACK_FLIP_Y_WEBGL,Se.flipY),X.pixelStorei(ge.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Se.premultiplyAlpha),X.pixelStorei(ge.UNPACK_ALIGNMENT,Se.unpackAlignment);let La=X.getParameter(ge.UNPACK_ROW_LENGTH),mi=X.getParameter(ge.UNPACK_IMAGE_HEIGHT),cl=X.getParameter(ge.UNPACK_SKIP_PIXELS),bc=X.getParameter(ge.UNPACK_SKIP_ROWS),Xh=X.getParameter(ge.UNPACK_SKIP_IMAGES);X.pixelStorei(ge.UNPACK_ROW_LENGTH,Cr.width),X.pixelStorei(ge.UNPACK_IMAGE_HEIGHT,Cr.height),X.pixelStorei(ge.UNPACK_SKIP_PIXELS,hn),X.pixelStorei(ge.UNPACK_SKIP_ROWS,zn),X.pixelStorei(ge.UNPACK_SKIP_IMAGES,$n);let R0=te.isDataArrayTexture||te.isData3DTexture,ji=Se.isDataArrayTexture||Se.isData3DTexture;if(te.isDepthTexture){let qr=Pe.get(te),$h=Pe.get(Se),tr=Pe.get(qr.__renderTarget),Yh=Pe.get($h.__renderTarget);X.bindFramebuffer(ge.READ_FRAMEBUFFER,tr.__webglFramebuffer),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,Yh.__webglFramebuffer);for(let P0=0;P0<tn;P0++)R0&&(ge.framebufferTextureLayer(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Pe.get(te).__webglTexture,De,$n+P0),ge.framebufferTextureLayer(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Pe.get(Se).__webglTexture,zt,Vr+P0)),ge.blitFramebuffer(hn,zn,Yt,kt,pn,Ui,Yt,kt,ge.DEPTH_BUFFER_BIT,ge.NEAREST);X.bindFramebuffer(ge.READ_FRAMEBUFFER,null),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,null)}else if(De!==0||te.isRenderTargetTexture||Pe.has(te)){let qr=Pe.get(te),$h=Pe.get(Se);X.bindFramebuffer(ge.READ_FRAMEBUFFER,J),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,j);for(let tr=0;tr<tn;tr++)R0?ge.framebufferTextureLayer(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,qr.__webglTexture,De,$n+tr):ge.framebufferTexture2D(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,qr.__webglTexture,De),ji?ge.framebufferTextureLayer(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,$h.__webglTexture,zt,Vr+tr):ge.framebufferTexture2D(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,$h.__webglTexture,zt),De!==0?ge.blitFramebuffer(hn,zn,Yt,kt,pn,Ui,Yt,kt,ge.COLOR_BUFFER_BIT,ge.NEAREST):ji?ge.copyTexSubImage3D(Xt,zt,pn,Ui,Vr+tr,hn,zn,Yt,kt):ge.copyTexSubImage2D(Xt,zt,pn,Ui,hn,zn,Yt,kt);X.bindFramebuffer(ge.READ_FRAMEBUFFER,null),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,null)}else ji?te.isDataTexture||te.isData3DTexture?ge.texSubImage3D(Xt,zt,pn,Ui,Vr,Yt,kt,tn,Wi,ao,Cr.data):Se.isCompressedArrayTexture?ge.compressedTexSubImage3D(Xt,zt,pn,Ui,Vr,Yt,kt,tn,Wi,Cr.data):ge.texSubImage3D(Xt,zt,pn,Ui,Vr,Yt,kt,tn,Wi,ao,Cr):te.isDataTexture?ge.texSubImage2D(ge.TEXTURE_2D,zt,pn,Ui,Yt,kt,Wi,ao,Cr.data):te.isCompressedTexture?ge.compressedTexSubImage2D(ge.TEXTURE_2D,zt,pn,Ui,Cr.width,Cr.height,Wi,Cr.data):ge.texSubImage2D(ge.TEXTURE_2D,zt,pn,Ui,Yt,kt,Wi,ao,Cr);X.pixelStorei(ge.UNPACK_ROW_LENGTH,La),X.pixelStorei(ge.UNPACK_IMAGE_HEIGHT,mi),X.pixelStorei(ge.UNPACK_SKIP_PIXELS,cl),X.pixelStorei(ge.UNPACK_SKIP_ROWS,bc),X.pixelStorei(ge.UNPACK_SKIP_IMAGES,Xh),zt===0&&Se.generateMipmaps&&ge.generateMipmap(Xt),X.unbindTexture()},this.initRenderTarget=function(te){Pe.get(te).__webglFramebuffer===void 0&&Ve.setupRenderTarget(te)},this.initTexture=function(te){te.isCubeTexture?Ve.setTextureCube(te,0):te.isData3DTexture?Ve.setTexture3D(te,0):te.isDataArrayTexture||te.isCompressedArrayTexture?Ve.setTexture2DArray(te,0):Ve.setTexture2D(te,0),X.unbindTexture()},this.resetState=function(){K=0,ee=0,ae=null,X.reset(),Dt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return mo}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=sn._getDrawingBufferColorSpace(e),t.unpackColorSpace=sn._getUnpackColorSpace()}};var f3=class extends Yi{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}},O_=new ie,jW=new on,XW=new on,$W=new ie,YW=new ie,d3=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(v,w){v.matrixWorldAutoUpdate===!0&&v.updateMatrixWorld(),w.parent===null&&w.matrixWorldAutoUpdate===!0&&w.updateMatrixWorld(),jW.copy(w.matrixWorldInverse),XW.multiplyMatrices(w.projectionMatrix,jW),u(v,v,w),this.sortObjects&&x(v)},this.setSize=function(v,w){n=v,r=w,s=n/2,o=r/2,l.style.width=v+"px",l.style.height=w+"px"};function c(v){v.isCSS2DObject&&(v.element.style.display="none");for(let w=0,S=v.children.length;w<S;w++)c(v.children[w])}function u(v,w,S){if(v.visible===!1){c(v);return}if(v.isCSS2DObject){O_.setFromMatrixPosition(v.matrixWorld),O_.applyMatrix4(XW);let T=O_.z>=-1&&O_.z<=1&&v.layers.test(S.layers)===!0,P=v.element;P.style.display=T===!0?"":"none",T===!0&&(v.onBeforeRender(t,w,S),P.style.transform="translate("+-100*v.center.x+"%,"+-100*v.center.y+"%)translate("+(O_.x*s+s)+"px,"+(-O_.y*o+o)+"px)",P.parentNode!==l&&l.appendChild(P),v.onAfterRender(t,w,S));let R={distanceToCameraSquared:f(S,v)};a.objects.set(v,R)}for(let T=0,P=v.children.length;T<P;T++)u(v.children[T],w,S)}function f(v,w){return $W.setFromMatrixPosition(v.matrixWorld),YW.setFromMatrixPosition(w.matrixWorld),$W.distanceToSquared(YW)}function p(v){let w=[];return v.traverseVisible(function(S){S.isCSS2DObject&&w.push(S)}),w}function x(v){let w=p(v).sort(function(T,P){if(T.renderOrder!==P.renderOrder)return P.renderOrder-T.renderOrder;let R=a.objects.get(T).distanceToCameraSquared,C=a.objects.get(P).distanceToCameraSquared;return R-C}),S=w.length;for(let T=0,P=w.length;T<P;T++)w[T].element.style.zIndex=S-T}}};function w0e(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var L2=w0e;var S0e=typeof global=="object"&&global&&global.Object===Object&&global,ZW=S0e;var T0e=typeof self=="object"&&self&&self.Object===Object&&self,E0e=ZW||T0e||Function("return this")(),p3=E0e;var M0e=function(){return p3.Date.now()},A3=M0e;var C0e=/\s/;function R0e(i){for(var e=i.length;e--&&C0e.test(i.charAt(e)););return e}var KW=R0e;var P0e=/^\s+/;function I0e(i){return i&&i.slice(0,KW(i)+1).replace(P0e,"")}var QW=I0e;var N0e=p3.Symbol,B_=N0e;var JW=Object.prototype,L0e=JW.hasOwnProperty,D0e=JW.toString,D2=B_?B_.toStringTag:void 0;function F0e(i){var e=L0e.call(i,D2),t=i[D2];try{i[D2]=void 0;var n=!0}catch{}var r=D0e.call(i);return n&&(e?i[D2]=t:delete i[D2]),r}var ej=F0e;var O0e=Object.prototype,B0e=O0e.toString;function U0e(i){return B0e.call(i)}var tj=U0e;var k0e="[object Null]",G0e="[object Undefined]",nj=B_?B_.toStringTag:void 0;function z0e(i){return i==null?i===void 0?G0e:k0e:nj&&nj in Object(i)?ej(i):tj(i)}var ij=z0e;function V0e(i){return i!=null&&typeof i=="object"}var rj=V0e;var q0e="[object Symbol]";function H0e(i){return typeof i=="symbol"||rj(i)&&ij(i)==q0e}var sj=H0e;var oj=NaN,W0e=/^[-+]0x[0-9a-f]+$/i,j0e=/^0b[01]+$/i,X0e=/^0o[0-7]+$/i,$0e=parseInt;function Y0e(i){if(typeof i=="number")return i;if(sj(i))return oj;if(L2(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=L2(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=QW(i);var t=j0e.test(i);return t||X0e.test(i)?$0e(i.slice(2),t?2:8):W0e.test(i)?oj:+i}var nD=Y0e;var Z0e="Expected a function",K0e=Math.max,Q0e=Math.min;function J0e(i,e,t){var n,r,s,o,a,l,c=0,u=!1,f=!1,p=!0;if(typeof i!="function")throw new TypeError(Z0e);e=nD(e)||0,L2(t)&&(u=!!t.leading,f="maxWait"in t,s=f?K0e(nD(t.maxWait)||0,e):s,p="trailing"in t?!!t.trailing:p);function x(D){var F=n,N=r;return n=r=void 0,c=D,o=i.apply(N,F),o}function v(D){return c=D,a=setTimeout(T,e),u?x(D):o}function w(D){var F=D-l,N=D-c,B=e-F;return f?Q0e(B,s-N):B}function S(D){var F=D-l,N=D-c;return l===void 0||F>=e||F<0||f&&N>=s}function T(){var D=A3();if(S(D))return P(D);a=setTimeout(T,w(D))}function P(D){return a=void 0,p&&n?x(D):(n=r=void 0,o)}function R(){a!==void 0&&clearTimeout(a),c=0,n=l=r=a=void 0}function C(){return a===void 0?o:P(A3())}function L(){var D=A3(),F=S(D);if(n=arguments,r=this,l=D,F){if(a===void 0)return v(l);if(f)return clearTimeout(a),a=setTimeout(T,e),x(l)}return a===void 0&&(a=setTimeout(T,e)),o}return L.cancel=R,L.flush=C,L}var aj=J0e;function lj(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 eAe(i){if(Array.isArray(i))return i}function tAe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function nAe(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function iAe(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 rAe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4117+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sAe(i,e){return eAe(i)||iAe(i,e)||oAe(i,e)||rAe()}function oAe(i,e){if(i){if(typeof i=="string")return lj(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)?lj(i,e):void 0}}var aAe=nAe(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;tAe(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Fr(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,p=f===void 0?function(){}:f,x=Object.keys(r).map(function(v){return new aAe(v,r[v])});return function v(){for(var w=arguments.length,S=new Array(w),T=0;T<w;T++)S[T]=arguments[T];var P=!!(this instanceof v&&this.constructor),R=P?S.shift():void 0,C=S[0],L=C===void 0?{}:C,D=Object.assign({},t instanceof Function?t(L):t,{initialised:!1}),F={};function N(V){return B(V,L),z(),N}var B=function(H,Z){u.call(N,H,D,Z),D.initialised=!0},z=aj(function(){D.initialised&&(p.call(N,D,F),F={})},1);return x.forEach(function(V){N[V.name]=H(V);function H(Z){var J=Z.name,j=Z.triggerUpdate,K=j===void 0?!1:j,ee=Z.onChange,ae=ee===void 0?function(ve,Ie){}:ee,ce=Z.defaultVal,de=ce===void 0?null:ce;return function(ve){var Ie=D[J];if(!arguments.length)return Ie;var Qe=ve===void 0?de:ve;return D[J]=Qe,ae.call(N,Qe,D,Ie),!F.hasOwnProperty(J)&&(F[J]=Ie),K&&z(),N}}}),Object.keys(o).forEach(function(V){N[V]=function(){for(var H,Z=arguments.length,J=new Array(Z),j=0;j<Z;j++)J[j]=arguments[j];return(H=o[V]).call.apply(H,[N,D].concat(J))}}),Object.entries(l).forEach(function(V){var H=sAe(V,2),Z=H[0],J=H[1];return N[Z]=N[J]}),N.resetProps=function(){return x.forEach(function(V){N[V.name](V.defaultVal)}),N},N.resetProps(),D._rerender=z,P&&R&&N(R),N}}var Or=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-Or.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?Or.Bounce.In(i*2)*.5:Or.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}}}}),F2=function(){return performance.now()},QA=(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=F2()),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})(),U_={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=U_.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=U_.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=U_.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=U_.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}}},cj=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),iD=new QA,Hs=(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=Or.Linear.None,this._interpolationFunction=U_.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=cj.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=iD,iD.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=F2()),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 p=[a],x=0,v=f.length;x<v;x+=1){var w=this._handleRelativeValue(a,f[x]);if(isNaN(w)){u=!1,console.warn("Found invalid interpolation list. Skipping.");break}p.push(w)}u&&(n[o]=p)}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 P={};for(var T in f)P[T]=f[T];n[o]=f=P}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=F2()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=F2()),!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=Or.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=U_.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=F2()),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 p=Math.min(Math.trunc((o-this._duration)/a)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=p);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*p,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var x=0,v=this._chainedTweens.length;x<v;x++)this._chainedTweens[x].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 NHe=cj.nextId,ah=iD,LHe=ah.getAll.bind(ah),DHe=ah.removeAll.bind(ah),FHe=ah.add.bind(ah),OHe=ah.remove.bind(ah),BHe=ah.update.bind(ah);function uj(i){let e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return hj(this.cover(e,t,n),e,t,n,i)}function hj(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,p=i._y1,x=i._z1,v,w,S,T,P,R,C,L,D,F,N;if(!o)return i._root=a,i;for(;o.length;)if((C=e>=(v=(l+f)/2))?l=v:f=v,(L=t>=(w=(c+p)/2))?c=w:p=w,(D=n>=(S=(u+x)/2))?u=S:x=S,s=o,!(o=o[F=D<<2|L<<1|C]))return s[F]=a,i;if(T=+i._x.call(null,o.data),P=+i._y.call(null,o.data),R=+i._z.call(null,o.data),e===T&&t===P&&n===R)return a.next=o,s?s[F]=a:i._root=a,i;do s=s?s[F]=new Array(8):i._root=new Array(8),(C=e>=(v=(l+f)/2))?l=v:f=v,(L=t>=(w=(c+p)/2))?c=w:p=w,(D=n>=(S=(u+x)/2))?u=S:x=S;while((F=D<<2|L<<1|C)===(N=(R>=S)<<2|(P>=w)<<1|T>=v));return s[N]=o,s[F]=a,i}function fj(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,p,x,v,w;f<e;++f)isNaN(x=+this._x.call(null,p=i[f]))||isNaN(v=+this._y.call(null,p))||isNaN(w=+this._z.call(null,p))||(t[f]=x,n[f]=v,r[f]=w,x<s&&(s=x),x>l&&(l=x),v<o&&(o=v),v>c&&(c=v),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)hj(this,t[f],n[f],r[f],i[f]);return this}function dj(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,p;n>i||i>=o||r>e||e>=a||s>t||t>=l;)switch(p=(t<s)<<2|(e<r)<<1|i<n,f=new Array(8),f[p]=u,u=f,c*=2,p){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 pj(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function Aj(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 Fi(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 mj(i,e,t,n){var r,s=this._x0,o=this._y0,a=this._z0,l,c,u,f,p,x,v=this._x1,w=this._y1,S=this._z1,T=[],P=this._root,R,C;for(P&&T.push(new Fi(P,s,o,a,v,w,S)),n==null?n=1/0:(s=i-n,o=e-n,a=t-n,v=i+n,w=e+n,S=t+n,n*=n);R=T.pop();)if(!(!(P=R.node)||(l=R.x0)>v||(c=R.y0)>w||(u=R.z0)>S||(f=R.x1)<s||(p=R.y1)<o||(x=R.z1)<a))if(P.length){var L=(l+f)/2,D=(c+p)/2,F=(u+x)/2;T.push(new Fi(P[7],L,D,F,f,p,x),new Fi(P[6],l,D,F,L,p,x),new Fi(P[5],L,c,F,f,D,x),new Fi(P[4],l,c,F,L,D,x),new Fi(P[3],L,D,u,f,p,F),new Fi(P[2],l,D,u,L,p,F),new Fi(P[1],L,c,u,f,D,F),new Fi(P[0],l,c,u,L,D,F)),(C=(t>=F)<<2|(e>=D)<<1|i>=L)&&(R=T[T.length-1],T[T.length-1]=T[T.length-1-C],T[T.length-1-C]=R)}else{var N=i-+this._x.call(null,P.data),B=e-+this._y.call(null,P.data),z=t-+this._z.call(null,P.data),V=N*N+B*B+z*z;if(V<n){var H=Math.sqrt(n=V);s=i-H,o=e-H,a=t-H,v=i+H,w=e+H,S=t+H,r=P.data}}return r}var lAe=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function gj(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,p,x,v,w,S,T)=>{if(!f.length)do{let P=f.data;lAe(i,e,t,this._x(P),this._y(P),this._z(P))<=n&&r.push(P)}while(f=f.next);return p>l||x>c||v>u||w<s||S<o||T<a}),r}function _j(i){if(isNaN(p=+this._x.call(null,i))||isNaN(x=+this._y.call(null,i))||isNaN(v=+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,p,x,v,w,S,T,P,R,C,L,D;if(!t)return this;if(t.length)for(;;){if((P=p>=(w=(o+c)/2))?o=w:c=w,(R=x>=(S=(a+u)/2))?a=S:u=S,(C=v>=(T=(l+f)/2))?l=T:f=T,e=t,!(t=t[L=C<<2|R<<1|P]))return this;if(!t.length)break;(e[L+1&7]||e[L+2&7]||e[L+3&7]||e[L+4&7]||e[L+5&7]||e[L+6&7]||e[L+7&7])&&(n=e,D=L)}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[L]=s:delete e[L],(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 xj(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function yj(){return this._root}function vj(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function bj(i){var e=[],t,n=this._root,r,s,o,a,l,c,u;for(n&&e.push(new Fi(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,p=(o+c)/2,x=(a+u)/2;(r=n[7])&&e.push(new Fi(r,f,p,x,l,c,u)),(r=n[6])&&e.push(new Fi(r,s,p,x,f,c,u)),(r=n[5])&&e.push(new Fi(r,f,o,x,l,p,u)),(r=n[4])&&e.push(new Fi(r,s,o,x,f,p,u)),(r=n[3])&&e.push(new Fi(r,f,p,a,l,c,x)),(r=n[2])&&e.push(new Fi(r,s,p,a,f,c,x)),(r=n[1])&&e.push(new Fi(r,f,o,a,l,p,x)),(r=n[0])&&e.push(new Fi(r,s,o,a,f,p,x))}return this}function wj(i){var e=[],t=[],n;for(this._root&&e.push(new Fi(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,p=(o+c)/2,x=(a+u)/2,v=(l+f)/2;(s=r[0])&&e.push(new Fi(s,o,a,l,p,x,v)),(s=r[1])&&e.push(new Fi(s,p,a,l,c,x,v)),(s=r[2])&&e.push(new Fi(s,o,x,l,p,u,v)),(s=r[3])&&e.push(new Fi(s,p,x,l,c,u,v)),(s=r[4])&&e.push(new Fi(s,o,a,v,p,x,f)),(s=r[5])&&e.push(new Fi(s,p,a,v,c,x,f)),(s=r[6])&&e.push(new Fi(s,o,x,v,p,u,f)),(s=r[7])&&e.push(new Fi(s,p,x,v,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 Sj(i){return i[0]}function Tj(i){return arguments.length?(this._x=i,this):this._x}function Ej(i){return i[1]}function Mj(i){return arguments.length?(this._y=i,this):this._y}function Cj(i){return i[2]}function Rj(i){return arguments.length?(this._z=i,this):this._z}function O2(i,e,t,n){var r=new rD(e??Sj,t??Ej,n??Cj,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function rD(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 Pj(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var yo=O2.prototype=rD.prototype;yo.copy=function(){var i=new rD(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=Pj(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]=Pj(n));return i};yo.add=uj;yo.addAll=fj;yo.cover=dj;yo.data=pj;yo.extent=Aj;yo.find=mj;yo.findAllWithinRadius=gj;yo.remove=_j;yo.removeAll=xj;yo.root=yj;yo.size=vj;yo.visit=bj;yo.visitAfter=wj;yo.x=Tj;yo.y=Mj;yo.z=Rj;function JA(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function sD(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function m3(i){let e,t,n;i.length!==2?(e=JA,t=(a,l)=>JA(i(a),l),n=(a,l)=>i(a)-l):(e=i===JA||i===sD?i:cAe,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 cAe(){return 0}function oD(i){return i===null?NaN:+i}var Ij=m3(JA),Nj=Ij.right,uAe=Ij.left,hAe=m3(oD).center,B2=Nj;function Up(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 vo=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 fAe=Math.sqrt(50),dAe=Math.sqrt(10),pAe=Math.sqrt(2);function g3(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>=fAe?10:s>=dAe?5:s>=pAe?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?g3(i,e,t*2):[a,l,c]}function _3(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?g3(e,i,t):g3(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 U2(i,e,t){return e=+e,i=+i,t=+t,g3(i,e,t)[2]}function aD(i,e,t){e=+e,i=+i,t=+t;let n=e<i,r=n?U2(e,i,t):U2(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function x3(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 y3(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*AAe(i){for(let e of i)yield*e}function lh(i){return Array.from(AAe(i))}function zf(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 v3(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 b3(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function w3(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function lD(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function z2(){}var k2=.7,E3=1/k2,k_="\\s*([+-]?\\d+)\\s*",G2="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ch="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",mAe=/^#([0-9a-f]{3,8})$/,gAe=new RegExp(`^rgb\\(${k_},${k_},${k_}\\)$`),_Ae=new RegExp(`^rgb\\(${ch},${ch},${ch}\\)$`),xAe=new RegExp(`^rgba\\(${k_},${k_},${k_},${G2}\\)$`),yAe=new RegExp(`^rgba\\(${ch},${ch},${ch},${G2}\\)$`),vAe=new RegExp(`^hsl\\(${G2},${ch},${ch}\\)$`),bAe=new RegExp(`^hsla\\(${G2},${ch},${ch},${G2}\\)$`),Lj={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};w3(z2,Zc,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:Dj,formatHex:Dj,formatHex8:wAe,formatHsl:SAe,formatRgb:Fj,toString:Fj});function Dj(){return this.rgb().formatHex()}function wAe(){return this.rgb().formatHex8()}function SAe(){return zj(this).formatHsl()}function Fj(){return this.rgb().formatRgb()}function Zc(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=mAe.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?Oj(e):t===3?new $a(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?S3(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?S3(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=gAe.exec(i))?new $a(e[1],e[2],e[3],1):(e=_Ae.exec(i))?new $a(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=xAe.exec(i))?S3(e[1],e[2],e[3],e[4]):(e=yAe.exec(i))?S3(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=vAe.exec(i))?kj(e[1],e[2]/100,e[3]/100,1):(e=bAe.exec(i))?kj(e[1],e[2]/100,e[3]/100,e[4]):Lj.hasOwnProperty(i)?Oj(Lj[i]):i==="transparent"?new $a(NaN,NaN,NaN,0):null}function Oj(i){return new $a(i>>16&255,i>>8&255,i&255,1)}function S3(i,e,t,n){return n<=0&&(i=e=t=NaN),new $a(i,e,t,n)}function TAe(i){return i instanceof z2||(i=Zc(i)),i?(i=i.rgb(),new $a(i.r,i.g,i.b,i.opacity)):new $a}function G_(i,e,t,n){return arguments.length===1?TAe(i):new $a(i,e,t,n??1)}function $a(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}w3($a,G_,lD(z2,{brighter(i){return i=i==null?E3:Math.pow(E3,i),new $a(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?k2:Math.pow(k2,i),new $a(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new $a(tm(this.r),tm(this.g),tm(this.b),M3(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:Bj,formatHex:Bj,formatHex8:EAe,formatRgb:Uj,toString:Uj}));function Bj(){return`#${em(this.r)}${em(this.g)}${em(this.b)}`}function EAe(){return`#${em(this.r)}${em(this.g)}${em(this.b)}${em((isNaN(this.opacity)?1:this.opacity)*255)}`}function Uj(){let i=M3(this.opacity);return`${i===1?"rgb(":"rgba("}${tm(this.r)}, ${tm(this.g)}, ${tm(this.b)}${i===1?")":`, ${i})`}`}function M3(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function tm(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function em(i){return i=tm(i),(i<16?"0":"")+i.toString(16)}function kj(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new Yc(i,e,t,n)}function zj(i){if(i instanceof Yc)return new Yc(i.h,i.s,i.l,i.opacity);if(i instanceof z2||(i=Zc(i)),!i)return new Yc;if(i instanceof Yc)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 Yc(o,a,l,i.opacity)}function Vj(i,e,t,n){return arguments.length===1?zj(i):new Yc(i,e,t,n??1)}function Yc(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}w3(Yc,Vj,lD(z2,{brighter(i){return i=i==null?E3:Math.pow(E3,i),new Yc(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?k2:Math.pow(k2,i),new Yc(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 $a(cD(i>=240?i-240:i+120,r,n),cD(i,r,n),cD(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new Yc(Gj(this.h),T3(this.s),T3(this.l),M3(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=M3(this.opacity);return`${i===1?"hsl(":"hsla("}${Gj(this.h)}, ${T3(this.s)*100}%, ${T3(this.l)*100}%${i===1?")":`, ${i})`}`}}));function Gj(i){return i=(i||0)%360,i<0?i+360:i}function T3(i){return Math.max(0,Math.min(1,i||0))}function cD(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 uD(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 qj(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 uD((t-n/e)*e,o,r,s,a)}}function Hj(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 uD((t-n/e)*e,r,s,o,a)}}var V2=i=>()=>i;function MAe(i,e){return function(t){return i+t*e}}function CAe(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 Wj(i){return(i=+i)==1?C3:function(e,t){return t-e?CAe(e,t,i):V2(isNaN(e)?t:e)}}function C3(i,e){var t=e-i;return t?MAe(i,t):V2(isNaN(i)?e:i)}var hD=(function i(e){var t=Wj(e);function n(r,s){var o=t((r=G_(r)).r,(s=G_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),c=C3(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 jj(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=G_(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 fje=jj(qj),dje=jj(Hj);function R3(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 P3(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function fD(i,e){return(P3(e)?R3:dD)(i,e)}function dD(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]=nm(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 Xj(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function uh(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function $j(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]=nm(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var AD=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pD=new RegExp(AD.source,"g");function RAe(i){return function(){return i}}function PAe(i){return function(e){return i(e)+""}}function Yj(i,e){var t=AD.lastIndex=pD.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=AD.exec(i))&&(r=pD.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:uh(n,r)})),t=pD.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?PAe(l[0].x):RAe(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 nm(i,e){var t=typeof e,n;return e==null||t==="boolean"?V2(e):(t==="number"?uh:t==="string"?(n=Zc(e))?(e=n,hD):Yj:e instanceof Zc?hD:e instanceof Date?Xj:P3(e)?R3:Array.isArray(e)?dD:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?$j:uh)(i,e)}function mD(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function gD(i){return function(){return i}}function _D(i){return+i}var Zj=[0,1];function z_(i){return i}function xD(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:gD(isNaN(e)?NaN:.5)}function IAe(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function NAe(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=xD(r,n),s=t(o,s)):(n=xD(n,r),s=t(s,o)),function(a){return s(n(a))}}function LAe(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]=xD(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=B2(i,a,1,n)-1;return s[l](r[l](a))}}function Kj(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function DAe(){var i=Zj,e=Zj,t=nm,n,r,s,o=z_,a,l,c;function u(){var p=Math.min(i.length,e.length);return o!==z_&&(o=IAe(i[0],i[p-1])),a=p>2?LAe:NAe,l=c=null,f}function f(p){return p==null||isNaN(p=+p)?s:(l||(l=a(i.map(n),e,t)))(n(o(p)))}return f.invert=function(p){return o(r((c||(c=a(e,i.map(n),uh)))(p)))},f.domain=function(p){return arguments.length?(i=Array.from(p,_D),u()):i.slice()},f.range=function(p){return arguments.length?(e=Array.from(p),u()):e.slice()},f.rangeRound=function(p){return e=Array.from(p),t=mD,u()},f.clamp=function(p){return arguments.length?(o=p?!0:z_,u()):o!==z_},f.interpolate=function(p){return arguments.length?(t=p,u()):t},f.unknown=function(p){return arguments.length?(s=p,f):s},function(p,x){return n=p,r=x,u()}}function yD(){return DAe()(z_,z_)}function Qj(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function im(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 hh(i){return i=im(Math.abs(i)),i?i[1]:NaN}function Jj(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 eX(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var FAe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function kp(i){if(!(e=FAe.exec(i)))throw new Error("invalid format: "+i);var e;return new I3({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]})}kp.prototype=I3.prototype;function I3(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+""}I3.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 tX(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 q2;function nX(i,e){var t=im(i,e);if(!t)return q2=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(q2=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")+im(i,Math.max(0,e+s-1))[0]}function vD(i,e){var t=im(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 bD={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:Qj,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)=>vD(i*100,e),r:vD,s:nX,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function wD(i){return i}var iX=Array.prototype.map,rX=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function sX(i){var e=i.grouping===void 0||i.thousands===void 0?wD:Jj(iX.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?wD:eX(iX.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,p){f=kp(f);var x=f.fill,v=f.align,w=f.sign,S=f.symbol,T=f.zero,P=f.width,R=f.comma,C=f.precision,L=f.trim,D=f.type;D==="n"?(R=!0,D="g"):bD[D]||(C===void 0&&(C=12),L=!0,D="g"),(T||x==="0"&&v==="=")&&(T=!0,x="0",v="=");var F=(p&&p.prefix!==void 0?p.prefix:"")+(S==="$"?t:S==="#"&&/[boxX]/.test(D)?"0"+D.toLowerCase():""),N=(S==="$"?n:/[%p]/.test(D)?o:"")+(p&&p.suffix!==void 0?p.suffix:""),B=bD[D],z=/[defgprs%]/.test(D);C=C===void 0?6:/[gprs]/.test(D)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function V(H){var Z=F,J=N,j,K,ee;if(D==="c")J=B(H)+J,H="";else{H=+H;var ae=H<0||1/H<0;if(H=isNaN(H)?l:B(Math.abs(H),C),L&&(H=tX(H)),ae&&+H==0&&w!=="+"&&(ae=!1),Z=(ae?w==="("?w:a:w==="-"||w==="("?"":w)+Z,J=(D==="s"&&!isNaN(H)&&q2!==void 0?rX[8+q2/3]:"")+J+(ae&&w==="("?")":""),z){for(j=-1,K=H.length;++j<K;)if(ee=H.charCodeAt(j),48>ee||ee>57){J=(ee===46?r+H.slice(j+1):H.slice(j))+J,H=H.slice(0,j);break}}}R&&!T&&(H=e(H,1/0));var ce=Z.length+H.length+J.length,de=ce<P?new Array(P-ce+1).join(x):"";switch(R&&T&&(H=e(de+H,de.length?P-J.length:1/0),de=""),v){case"<":H=Z+H+J+de;break;case"=":H=Z+de+H+J;break;case"^":H=de.slice(0,ce=de.length>>1)+Z+H+J+de.slice(ce);break;default:H=de+Z+H+J;break}return s(H)}return V.toString=function(){return f+""},V}function u(f,p){var x=Math.max(-8,Math.min(8,Math.floor(hh(p)/3)))*3,v=Math.pow(10,-x),w=c((f=kp(f),f.type="f",f),{suffix:rX[8+x/3]});return function(S){return w(v*S)}}return{format:c,formatPrefix:u}}var N3,L3,D3;SD({thousands:",",grouping:[3],currency:["$",""]});function SD(i){return N3=sX(i),L3=N3.format,D3=N3.formatPrefix,N3}function TD(i){return Math.max(0,-hh(Math.abs(i)))}function ED(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(hh(e)/3)))*3-hh(Math.abs(i)))}function MD(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,hh(e)-hh(i))+1}function CD(i,e,t,n){var r=aD(i,e,t),s;switch(n=kp(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=ED(r,o))&&(n.precision=s),D3(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=MD(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=TD(r))&&(n.precision=s-(n.type==="%")*2);break}}return L3(n)}function RD(i){var e=i.domain;return i.ticks=function(t){var n=e();return _3(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return CD(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=U2(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 Ya(){var i=yD();return i.copy=function(){return Kj(i,Ya())},b3.apply(i,arguments),RD(i)}function H2(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[B2(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 H2().domain([i,e]).range(r).unknown(s)},b3.apply(RD(o),arguments)}var Cn=1e-6,rm=1e-12,Jn=Math.PI,to=Jn/2,V_=Jn/4,no=Jn*2,Ki=180/Jn,mn=Jn/180,ei=Math.abs,q_=Math.atan,cs=Math.atan2,fn=Math.cos,W2=Math.ceil,oX=Math.exp;var F3=Math.hypot,aX=Math.log;var an=Math.sin,lX=Math.sign||function(i){return i>0?1:i<0?-1:0},bo=Math.sqrt,cX=Math.tan;function uX(i){return i>1?0:i<-1?Jn:Math.acos(i)}function Wo(i){return i>1?to:i<-1?-to:Math.asin(i)}function PD(i){return(i=an(i/2))*i}function Zr(){}function O3(i,e){i&&fX.hasOwnProperty(i.type)&&fX[i.type](i,e)}var hX={Feature:function(i,e){O3(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)O3(t[n].geometry,e)}},fX={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){ID(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)ID(t[n],e,0)},Polygon:function(i,e){dX(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)dX(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)O3(t[n],e)}};function ID(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 dX(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)ID(i[t],e,1);e.polygonEnd()}function Gp(i,e){i&&hX.hasOwnProperty(i.type)?hX[i.type](i,e):O3(i,e)}var j2=new vo,pX=new vo,AX,mX,ND,LD,DD,fh={point:Zr,lineStart:Zr,lineEnd:Zr,polygonStart:function(){j2=new vo,fh.lineStart=OAe,fh.lineEnd=BAe},polygonEnd:function(){var i=+j2;pX.add(i<0?no+i:i),this.lineStart=this.lineEnd=this.point=Zr},sphere:function(){pX.add(no)}};function OAe(){fh.point=UAe}function BAe(){gX(AX,mX)}function UAe(i,e){fh.point=gX,AX=i,mX=e,i*=mn,e*=mn,ND=i,LD=fn(e=e/2+V_),DD=an(e)}function gX(i,e){i*=mn,e*=mn,e=e/2+V_;var t=i-ND,n=t>=0?1:-1,r=n*t,s=fn(e),o=an(e),a=DD*o,l=LD*s+a*fn(r),c=a*n*an(r);j2.add(cs(c,l)),ND=i,LD=s,DD=o}function sm(i){return[cs(i[1],i[0]),Wo(i[2])]}function oc(i){var e=i[0],t=i[1],n=fn(t);return[n*fn(e),n*an(e),an(t)]}function X2(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Vf(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 B3(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function $2(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function om(i){var e=bo(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var Br,Za,Kr,Sl,am,vX,bX,H_,Y2,zp,Hf,qf={point:FD,lineStart:_X,lineEnd:xX,polygonStart:function(){qf.point=SX,qf.lineStart=kAe,qf.lineEnd=GAe,Y2=new vo,fh.polygonStart()},polygonEnd:function(){fh.polygonEnd(),qf.point=FD,qf.lineStart=_X,qf.lineEnd=xX,j2<0?(Br=-(Kr=180),Za=-(Sl=90)):Y2>Cn?Sl=90:Y2<-Cn&&(Za=-90),Hf[0]=Br,Hf[1]=Kr},sphere:function(){Br=-(Kr=180),Za=-(Sl=90)}};function FD(i,e){zp.push(Hf=[Br=i,Kr=i]),e<Za&&(Za=e),e>Sl&&(Sl=e)}function wX(i,e){var t=oc([i*mn,e*mn]);if(H_){var n=Vf(H_,t),r=[n[1],-n[0],0],s=Vf(r,n);om(s),s=sm(s);var o=i-am,a=o>0?1:-1,l=s[0]*Ki*a,c,u=ei(o)>180;u^(a*am<l&&l<a*i)?(c=s[1]*Ki,c>Sl&&(Sl=c)):(l=(l+360)%360-180,u^(a*am<l&&l<a*i)?(c=-s[1]*Ki,c<Za&&(Za=c)):(e<Za&&(Za=e),e>Sl&&(Sl=e))),u?i<am?wl(Br,i)>wl(Br,Kr)&&(Kr=i):wl(i,Kr)>wl(Br,Kr)&&(Br=i):Kr>=Br?(i<Br&&(Br=i),i>Kr&&(Kr=i)):i>am?wl(Br,i)>wl(Br,Kr)&&(Kr=i):wl(i,Kr)>wl(Br,Kr)&&(Br=i)}else zp.push(Hf=[Br=i,Kr=i]);e<Za&&(Za=e),e>Sl&&(Sl=e),H_=t,am=i}function _X(){qf.point=wX}function xX(){Hf[0]=Br,Hf[1]=Kr,qf.point=FD,H_=null}function SX(i,e){if(H_){var t=i-am;Y2.add(ei(t)>180?t+(t>0?360:-360):t)}else vX=i,bX=e;fh.point(i,e),wX(i,e)}function kAe(){fh.lineStart()}function GAe(){SX(vX,bX),fh.lineEnd(),ei(Y2)>Cn&&(Br=-(Kr=180)),Hf[0]=Br,Hf[1]=Kr,H_=null}function wl(i,e){return(e-=i)<0?e+360:e}function zAe(i,e){return i[0]-e[0]}function yX(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:e<i[0]||i[1]<e}function U3(i){var e,t,n,r,s,o,a;if(Sl=Kr=-(Br=Za=1/0),zp=[],Gp(i,qf),t=zp.length){for(zp.sort(zAe),e=1,n=zp[0],s=[n];e<t;++e)r=zp[e],yX(n,r[0])||yX(n,r[1])?(wl(n[0],r[1])>wl(n[0],n[1])&&(n[1]=r[1]),wl(r[0],n[1])>wl(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=wl(n[1],r[0]))>o&&(o=a,Br=r[0],Kr=n[1])}return zp=Hf=null,Br===1/0||Za===1/0?[[NaN,NaN],[NaN,NaN]]:[[Br,Za],[Kr,Sl]]}var Z2,k3,G3,z3,V3,q3,H3,W3,OD,BD,UD,MX,CX,xa,ya,va,Kc={sphere:Zr,point:kD,lineStart:TX,lineEnd:EX,polygonStart:function(){Kc.lineStart=HAe,Kc.lineEnd=WAe},polygonEnd:function(){Kc.lineStart=TX,Kc.lineEnd=EX}};function kD(i,e){i*=mn,e*=mn;var t=fn(e);K2(t*fn(i),t*an(i),an(e))}function K2(i,e,t){++Z2,G3+=(i-G3)/Z2,z3+=(e-z3)/Z2,V3+=(t-V3)/Z2}function TX(){Kc.point=VAe}function VAe(i,e){i*=mn,e*=mn;var t=fn(e);xa=t*fn(i),ya=t*an(i),va=an(e),Kc.point=qAe,K2(xa,ya,va)}function qAe(i,e){i*=mn,e*=mn;var t=fn(e),n=t*fn(i),r=t*an(i),s=an(e),o=cs(bo((o=ya*s-va*r)*o+(o=va*n-xa*s)*o+(o=xa*r-ya*n)*o),xa*n+ya*r+va*s);k3+=o,q3+=o*(xa+(xa=n)),H3+=o*(ya+(ya=r)),W3+=o*(va+(va=s)),K2(xa,ya,va)}function EX(){Kc.point=kD}function HAe(){Kc.point=jAe}function WAe(){RX(MX,CX),Kc.point=kD}function jAe(i,e){MX=i,CX=e,i*=mn,e*=mn,Kc.point=RX;var t=fn(e);xa=t*fn(i),ya=t*an(i),va=an(e),K2(xa,ya,va)}function RX(i,e){i*=mn,e*=mn;var t=fn(e),n=t*fn(i),r=t*an(i),s=an(e),o=ya*s-va*r,a=va*n-xa*s,l=xa*r-ya*n,c=F3(o,a,l),u=Wo(c),f=c&&-u/c;OD.add(f*o),BD.add(f*a),UD.add(f*l),k3+=u,q3+=u*(xa+(xa=n)),H3+=u*(ya+(ya=r)),W3+=u*(va+(va=s)),K2(xa,ya,va)}function j3(i){Z2=k3=G3=z3=V3=q3=H3=W3=0,OD=new vo,BD=new vo,UD=new vo,Gp(i,Kc);var e=+OD,t=+BD,n=+UD,r=F3(e,t,n);return r<rm&&(e=q3,t=H3,n=W3,k3<Cn&&(e=G3,t=z3,n=V3),r=F3(e,t,n),r<rm)?[NaN,NaN]:[cs(t,e)*Ki,Wo(n/r)*Ki]}function Q2(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 GD(i,e){return ei(i)>Jn&&(i-=Math.round(i/no)*no),[i,e]}GD.invert=GD;function zD(i,e,t){return(i%=no)?e||t?Q2(IX(i),NX(e,t)):IX(i):e||t?NX(e,t):GD}function PX(i){return function(e,t){return e+=i,ei(e)>Jn&&(e-=Math.round(e/no)*no),[e,t]}}function IX(i){var e=PX(i);return e.invert=PX(-i),e}function NX(i,e){var t=fn(i),n=an(i),r=fn(e),s=an(e);function o(a,l){var c=fn(l),u=fn(a)*c,f=an(a)*c,p=an(l),x=p*t+u*n;return[cs(f*r-x*s,u*t-p*n),Wo(x*r+f*s)]}return o.invert=function(a,l){var c=fn(l),u=fn(a)*c,f=an(a)*c,p=an(l),x=p*r-f*s;return[cs(f*r+p*s,u*t+x*n),Wo(x*t-u*n)]},o}function VD(i){i=zD(i[0]*mn,i[1]*mn,i.length>2?i[2]*mn:0);function e(t){return t=i(t[0]*mn,t[1]*mn),t[0]*=Ki,t[1]*=Ki,t}return e.invert=function(t){return t=i.invert(t[0]*mn,t[1]*mn),t[0]*=Ki,t[1]*=Ki,t},e}function DX(i,e,t,n,r,s){if(t){var o=fn(e),a=an(e),l=n*t;r==null?(r=e+n*no,s=e-l/2):(r=LX(o,r),s=LX(o,s),(n>0?r<s:r>s)&&(r+=n*no));for(var c,u=r;n>0?u>s:u<s;u-=l)c=sm([o,-a*fn(u),-a*an(u)]),i.point(c[0],c[1])}}function LX(i,e){e=oc(e),e[0]-=i,om(e);var t=uX(-e[1]);return((-e[2]<0?-t:t)+no-Cn)%no}function X3(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:Zr,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function W_(i,e){return ei(i[0]-e[0])<Cn&&ei(i[1]-e[1])<Cn}function $3(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 Y3(i,e,t,n,r){var s=[],o=[],a,l;if(i.forEach(function(v){if(!((w=v.length-1)<=0)){var w,S=v[0],T=v[w],P;if(W_(S,T)){if(!S[2]&&!T[2]){for(r.lineStart(),a=0;a<w;++a)r.point((S=v[a])[0],S[1]);r.lineEnd();return}T[0]+=2*Cn}s.push(P=new $3(S,v,null,!0)),o.push(P.o=new $3(S,null,P,!1)),s.push(P=new $3(T,v,null,!1)),o.push(P.o=new $3(T,null,P,!0))}}),!!s.length){for(o.sort(e),FX(s),FX(o),a=0,l=o.length;a<l;++a)o[a].e=t=!t;for(var c=s[0],u,f;;){for(var p=c,x=!0;p.v;)if((p=p.n)===c)return;u=p.z,r.lineStart();do{if(p.v=p.o.v=!0,p.e){if(x)for(a=0,l=u.length;a<l;++a)r.point((f=u[a])[0],f[1]);else n(p.x,p.n.x,1,r);p=p.n}else{if(x)for(u=p.p.z,a=u.length-1;a>=0;--a)r.point((f=u[a])[0],f[1]);else n(p.x,p.p.x,-1,r);p=p.p}p=p.o,u=p.z,x=!x}while(!p.v);r.lineEnd()}}}function FX(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 qD(i){return ei(i[0])<=Jn?i[0]:lX(i[0])*((ei(i[0])+Jn)%no-Jn)}function Z3(i,e){var t=qD(e),n=e[1],r=an(n),s=[an(t),-fn(t),0],o=0,a=0,l=new vo;r===1?n=to+Cn:r===-1&&(n=-to-Cn);for(var c=0,u=i.length;c<u;++c)if(p=(f=i[c]).length)for(var f,p,x=f[p-1],v=qD(x),w=x[1]/2+V_,S=an(w),T=fn(w),P=0;P<p;++P,v=C,S=D,T=F,x=R){var R=f[P],C=qD(R),L=R[1]/2+V_,D=an(L),F=fn(L),N=C-v,B=N>=0?1:-1,z=B*N,V=z>Jn,H=S*D;if(l.add(cs(H*B*an(z),T*F+H*fn(z))),o+=V?N+B*no:N,V^v>=t^C>=t){var Z=Vf(oc(x),oc(R));om(Z);var J=Vf(s,Z);om(J);var j=(V^N>=0?-1:1)*Wo(J[2]);(n>j||n===j&&(Z[0]||Z[1]))&&(a+=V^N>=0?1:-1)}}return(o<-Cn||o<Cn&&l<-rm)^a&1}function K3(i,e,t,n){return function(r){var s=e(r),o=X3(),a=e(o),l=!1,c,u,f,p={point:x,lineStart:w,lineEnd:S,polygonStart:function(){p.point=T,p.lineStart=P,p.lineEnd=R,u=[],c=[]},polygonEnd:function(){p.point=x,p.lineStart=w,p.lineEnd=S,u=lh(u);var C=Z3(c,n);u.length?(l||(r.polygonStart(),l=!0),Y3(u,$Ae,C,t,r)):C&&(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 x(C,L){i(C,L)&&r.point(C,L)}function v(C,L){s.point(C,L)}function w(){p.point=v,s.lineStart()}function S(){p.point=x,s.lineEnd()}function T(C,L){f.push([C,L]),a.point(C,L)}function P(){a.lineStart(),f=[]}function R(){T(f[0][0],f[0][1]),a.lineEnd();var C=a.clean(),L=o.result(),D,F=L.length,N,B,z;if(f.pop(),c.push(f),f=null,!!F){if(C&1){if(B=L[0],(N=B.length-1)>0){for(l||(r.polygonStart(),l=!0),r.lineStart(),D=0;D<N;++D)r.point((z=B[D])[0],z[1]);r.lineEnd()}return}F>1&&C&2&&L.push(L.pop().concat(L.shift())),u.push(L.filter(XAe))}}return p}}function XAe(i){return i.length>1}function $Ae(i,e){return((i=i.x)[0]<0?i[1]-to-Cn:to-i[1])-((e=e.x)[0]<0?e[1]-to-Cn:to-e[1])}var HD=K3(function(){return!0},YAe,KAe,[-Jn,-to]);function YAe(i){var e=NaN,t=NaN,n=NaN,r;return{lineStart:function(){i.lineStart(),r=1},point:function(s,o){var a=s>0?Jn:-Jn,l=ei(s-e);ei(l-Jn)<Cn?(i.point(e,t=(t+o)/2>0?to:-to),i.point(n,t),i.lineEnd(),i.lineStart(),i.point(a,t),i.point(s,t),r=0):n!==a&&l>=Jn&&(ei(e-n)<Cn&&(e-=n*Cn),ei(s-a)<Cn&&(s-=a*Cn),t=ZAe(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 ZAe(i,e,t,n){var r,s,o=an(i-t);return ei(o)>Cn?q_((an(e)*(s=fn(n))*an(t)-an(n)*(r=fn(e))*an(i))/(r*s*o)):(e+n)/2}function KAe(i,e,t,n){var r;if(i==null)r=t*to,n.point(-Jn,r),n.point(0,r),n.point(Jn,r),n.point(Jn,0),n.point(Jn,-r),n.point(0,-r),n.point(-Jn,-r),n.point(-Jn,0),n.point(-Jn,r);else if(ei(i[0]-e[0])>Cn){var s=i[0]<e[0]?Jn:-Jn;r=t*s/2,n.point(-s,r),n.point(0,r),n.point(s,r)}else n.point(e[0],e[1])}function OX(i){var e=fn(i),t=2*mn,n=e>0,r=ei(e)>Cn;function s(u,f,p,x){DX(x,i,t,p,u,f)}function o(u,f){return fn(u)*fn(f)>e}function a(u){var f,p,x,v,w;return{lineStart:function(){v=x=!1,w=1},point:function(S,T){var P=[S,T],R,C=o(S,T),L=n?C?0:c(S,T):C?c(S+(S<0?Jn:-Jn),T):0;if(!f&&(v=x=C)&&u.lineStart(),C!==x&&(R=l(f,P),(!R||W_(f,R)||W_(P,R))&&(P[2]=1)),C!==x)w=0,C?(u.lineStart(),R=l(P,f),u.point(R[0],R[1])):(R=l(f,P),u.point(R[0],R[1],2),u.lineEnd()),f=R;else if(r&&f&&n^C){var D;!(L&p)&&(D=l(P,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)))}C&&(!f||!W_(f,P))&&u.point(P[0],P[1]),f=P,x=C,p=L},lineEnd:function(){x&&u.lineEnd(),f=null},clean:function(){return w|(v&&x)<<1}}}function l(u,f,p){var x=oc(u),v=oc(f),w=[1,0,0],S=Vf(x,v),T=X2(S,S),P=S[0],R=T-P*P;if(!R)return!p&&u;var C=e*T/R,L=-e*P/R,D=Vf(w,S),F=$2(w,C),N=$2(S,L);B3(F,N);var B=D,z=X2(F,B),V=X2(B,B),H=z*z-V*(X2(F,F)-1);if(!(H<0)){var Z=bo(H),J=$2(B,(-z-Z)/V);if(B3(J,F),J=sm(J),!p)return J;var j=u[0],K=f[0],ee=u[1],ae=f[1],ce;K<j&&(ce=j,j=K,K=ce);var de=K-j,ve=ei(de-Jn)<Cn,Ie=ve||de<Cn;if(!ve&&ae<ee&&(ce=ee,ee=ae,ae=ce),Ie?ve?ee+ae>0^J[1]<(ei(J[0]-j)<Cn?ee:ae):ee<=J[1]&&J[1]<=ae:de>Jn^(j<=J[0]&&J[0]<=K)){var Qe=$2(B,(-z+Z)/V);return B3(Qe,F),[J,sm(Qe)]}}}function c(u,f){var p=n?i:Jn-i,x=0;return u<-p?x|=1:u>p&&(x|=2),f<-p?x|=4:f>p&&(x|=8),x}return K3(o,a,s,n?[0,-i]:[-Jn,i-Jn])}function BX(i,e,t,n,r,s){var o=i[0],a=i[1],l=e[0],c=e[1],u=0,f=1,p=l-o,x=c-a,v;if(v=t-o,!(!p&&v>0)){if(v/=p,p<0){if(v<u)return;v<f&&(f=v)}else if(p>0){if(v>f)return;v>u&&(u=v)}if(v=r-o,!(!p&&v<0)){if(v/=p,p<0){if(v>f)return;v>u&&(u=v)}else if(p>0){if(v<u)return;v<f&&(f=v)}if(v=n-a,!(!x&&v>0)){if(v/=x,x<0){if(v<u)return;v<f&&(f=v)}else if(x>0){if(v>f)return;v>u&&(u=v)}if(v=s-a,!(!x&&v<0)){if(v/=x,x<0){if(v>f)return;v>u&&(u=v)}else if(x>0){if(v<u)return;v<f&&(f=v)}return u>0&&(i[0]=o+u*p,i[1]=a+u*x),f<1&&(e[0]=o+f*p,e[1]=a+f*x),!0}}}}}var J2=1e9,Q3=-J2;function WD(i,e,t,n){function r(c,u){return i<=c&&c<=t&&e<=u&&u<=n}function s(c,u,f,p){var x=0,v=0;if(c==null||(x=o(c,f))!==(v=o(u,f))||l(c,u)<0^f>0)do p.point(x===0||x===3?i:t,x>1?n:e);while((x=(x+f+4)%4)!==v);else p.point(u[0],u[1])}function o(c,u){return ei(c[0]-i)<Cn?u>0?0:3:ei(c[0]-t)<Cn?u>0?2:1:ei(c[1]-e)<Cn?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),p=o(u,1);return f!==p?f-p: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=X3(),p,x,v,w,S,T,P,R,C,L,D,F={point:N,lineStart:H,lineEnd:Z,polygonStart:z,polygonEnd:V};function N(j,K){r(j,K)&&u.point(j,K)}function B(){for(var j=0,K=0,ee=x.length;K<ee;++K)for(var ae=x[K],ce=1,de=ae.length,ve=ae[0],Ie,Qe,Ue=ve[0],mt=ve[1];ce<de;++ce)Ie=Ue,Qe=mt,ve=ae[ce],Ue=ve[0],mt=ve[1],Qe<=n?mt>n&&(Ue-Ie)*(n-Qe)>(mt-Qe)*(i-Ie)&&++j:mt<=n&&(Ue-Ie)*(n-Qe)<(mt-Qe)*(i-Ie)&&--j;return j}function z(){u=f,p=[],x=[],D=!0}function V(){var j=B(),K=D&&j,ee=(p=lh(p)).length;(K||ee)&&(c.polygonStart(),K&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),ee&&Y3(p,a,j,s,c),c.polygonEnd()),u=c,p=x=v=null}function H(){F.point=J,x&&x.push(v=[]),L=!0,C=!1,P=R=NaN}function Z(){p&&(J(w,S),T&&C&&f.rejoin(),p.push(f.result())),F.point=N,C&&u.lineEnd()}function J(j,K){var ee=r(j,K);if(x&&v.push([j,K]),L)w=j,S=K,T=ee,L=!1,ee&&(u.lineStart(),u.point(j,K));else if(ee&&C)u.point(j,K);else{var ae=[P=Math.max(Q3,Math.min(J2,P)),R=Math.max(Q3,Math.min(J2,R))],ce=[j=Math.max(Q3,Math.min(J2,j)),K=Math.max(Q3,Math.min(J2,K))];BX(ae,ce,i,e,t,n)?(C||(u.lineStart(),u.point(ae[0],ae[1])),u.point(ce[0],ce[1]),ee||u.lineEnd(),D=!1):ee&&(u.lineStart(),u.point(j,K),D=!1)}P=j,R=K,C=ee}return F}}var jD,XD,J3,eE,j_={sphere:Zr,point:Zr,lineStart:QAe,lineEnd:Zr,polygonStart:Zr,polygonEnd:Zr};function QAe(){j_.point=eme,j_.lineEnd=JAe}function JAe(){j_.point=j_.lineEnd=Zr}function eme(i,e){i*=mn,e*=mn,XD=i,J3=an(e),eE=fn(e),j_.point=tme}function tme(i,e){i*=mn,e*=mn;var t=an(e),n=fn(e),r=ei(i-XD),s=fn(r),o=an(r),a=n*o,l=eE*t-J3*n*s,c=J3*t+eE*n*s;jD.add(cs(bo(a*a+l*l),c)),XD=i,J3=t,eE=n}function UX(i){return jD=new vo,Gp(i,j_),+jD}var $D=[null,null],nme={type:"LineString",coordinates:$D};function Ka(i,e){return $D[0]=i,$D[1]=e,UX(nme)}var kX={Feature:function(i,e){return tE(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if(tE(t[n].geometry,e))return!0;return!1}},GX={Sphere:function(){return!0},Point:function(i,e){return zX(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(zX(t[n],e))return!0;return!1},LineString:function(i,e){return VX(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(VX(t[n],e))return!0;return!1},Polygon:function(i,e){return qX(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(qX(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if(tE(t[n],e))return!0;return!1}};function tE(i,e){return i&&GX.hasOwnProperty(i.type)?GX[i.type](i,e):!1}function zX(i,e){return Ka(i,e)===0}function VX(i,e){for(var t,n,r,s=0,o=i.length;s<o;s++){if(n=Ka(i[s],e),n===0||s>0&&(r=Ka(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))<rm*r))return!0;t=n}return!1}function qX(i,e){return!!Z3(i.map(ime),HX(e))}function ime(i){return i=i.map(HX),i.pop(),i}function HX(i){return[i[0]*mn,i[1]*mn]}function YD(i,e){return(i&&kX.hasOwnProperty(i.type)?kX[i.type]:tE)(i,e)}function WX(i,e,t){var n=zf(i,e-Cn,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function jX(i,e,t){var n=zf(i,e-Cn,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function ZD(){var i,e,t,n,r,s,o,a,l=10,c=l,u=90,f=360,p,x,v,w,S=2.5;function T(){return{type:"MultiLineString",coordinates:P()}}function P(){return zf(W2(n/u)*u,t,u).map(v).concat(zf(W2(a/f)*f,o,f).map(w)).concat(zf(W2(e/l)*l,i,l).filter(function(R){return ei(R%u)>Cn}).map(p)).concat(zf(W2(s/c)*c,r,c).filter(function(R){return ei(R%f)>Cn}).map(x))}return T.lines=function(){return P().map(function(R){return{type:"LineString",coordinates:R}})},T.outline=function(){return{type:"Polygon",coordinates:[v(n).concat(w(o).slice(1),v(t).reverse().slice(1),w(a).reverse().slice(1))]}},T.extent=function(R){return arguments.length?T.extentMajor(R).extentMinor(R):T.extentMinor()},T.extentMajor=function(R){return arguments.length?(n=+R[0][0],t=+R[1][0],a=+R[0][1],o=+R[1][1],n>t&&(R=n,n=t,t=R),a>o&&(R=a,a=o,o=R),T.precision(S)):[[n,a],[t,o]]},T.extentMinor=function(R){return arguments.length?(e=+R[0][0],i=+R[1][0],s=+R[0][1],r=+R[1][1],e>i&&(R=e,e=i,i=R),s>r&&(R=s,s=r,r=R),T.precision(S)):[[e,s],[i,r]]},T.step=function(R){return arguments.length?T.stepMajor(R).stepMinor(R):T.stepMinor()},T.stepMajor=function(R){return arguments.length?(u=+R[0],f=+R[1],T):[u,f]},T.stepMinor=function(R){return arguments.length?(l=+R[0],c=+R[1],T):[l,c]},T.precision=function(R){return arguments.length?(S=+R,p=WX(s,r,90),x=jX(e,i,S),v=WX(a,o,90),w=jX(n,t,S),T):S},T.extentMajor([[-180,-90+Cn],[180,90-Cn]]).extentMinor([[-180,-80-Cn],[180,80+Cn]])}function KD(){return ZD()()}function lm(i,e){var t=i[0]*mn,n=i[1]*mn,r=e[0]*mn,s=e[1]*mn,o=fn(n),a=an(n),l=fn(s),c=an(s),u=o*fn(t),f=o*an(t),p=l*fn(r),x=l*an(r),v=2*Wo(bo(PD(s-n)+o*l*PD(r-t))),w=an(v),S=v?function(T){var P=an(T*=v)/w,R=an(v-T)/w,C=R*u+P*p,L=R*f+P*x,D=R*a+P*c;return[cs(L,C)*Ki,cs(D,bo(C*C+L*L))*Ki]}:function(){return[t*Ki,n*Ki]};return S.distance=v,S}var QD=i=>i;var X_=1/0,nE=X_,ev=-X_,iE=ev,rme={point:sme,lineStart:Zr,lineEnd:Zr,polygonStart:Zr,polygonEnd:Zr,result:function(){var i=[[X_,nE],[ev,iE]];return ev=iE=-(nE=X_=1/0),i}};function sme(i,e){i<X_&&(X_=i),i>ev&&(ev=i),e<nE&&(nE=e),e>iE&&(iE=e)}var JD=rme;function tv(i){return function(e){var t=new e6;for(var n in i)t[n]=i[n];return t.stream=e,t}}function e6(){}e6.prototype={constructor:e6,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 t6(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),Gp(t,i.stream(JD)),e(JD.result()),n!=null&&i.clipExtent(n),i}function n6(i,e,t){return t6(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 XX(i,e,t){return n6(i,[[0,0],e],t)}function $X(i,e,t){return t6(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 YX(i,e,t){return t6(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 ZX=16,ome=fn(30*mn);function i6(i,e){return+e?lme(i,e):ame(i)}function ame(i){return tv({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function lme(i,e){function t(n,r,s,o,a,l,c,u,f,p,x,v,w,S){var T=c-n,P=u-r,R=T*T+P*P;if(R>4*e&&w--){var C=o+p,L=a+x,D=l+v,F=bo(C*C+L*L+D*D),N=Wo(D/=F),B=ei(ei(D)-1)<Cn||ei(s-f)<Cn?(s+f)/2:cs(L,C),z=i(B,N),V=z[0],H=z[1],Z=V-n,J=H-r,j=P*Z-T*J;(j*j/R>e||ei((T*Z+P*J)/R-.5)>.3||o*p+a*x+l*v<ome)&&(t(n,r,s,o,a,l,V,H,B,C/=F,L/=F,D,w,S),S.point(V,H),t(V,H,B,C,L,D,c,u,f,p,x,v,w,S))}}return function(n){var r,s,o,a,l,c,u,f,p,x,v,w,S={point:T,lineStart:P,lineEnd:C,polygonStart:function(){n.polygonStart(),S.lineStart=L},polygonEnd:function(){n.polygonEnd(),S.lineStart=P}};function T(N,B){N=i(N,B),n.point(N[0],N[1])}function P(){f=NaN,S.point=R,n.lineStart()}function R(N,B){var z=oc([N,B]),V=i(N,B);t(f,p,u,x,v,w,f=V[0],p=V[1],u=N,x=z[0],v=z[1],w=z[2],ZX,n),n.point(f,p)}function C(){S.point=T,n.lineEnd()}function L(){P(),S.point=D,S.lineEnd=F}function D(N,B){R(r=N,B),s=f,o=p,a=x,l=v,c=w,S.point=R}function F(){t(f,p,u,x,v,w,s,o,r,a,l,c,ZX,n),S.lineEnd=C,C()}return S}}var cme=tv({point:function(i,e){this.stream.point(i*mn,e*mn)}});function ume(i){return tv({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function hme(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 KX(i,e,t,n,r,s){if(!s)return hme(i,e,t,n,r);var o=fn(s),a=an(s),l=o*i,c=a*i,u=o/i,f=a/i,p=(a*t-o*e)/i,x=(a*e+o*t)/i;function v(w,S){return w*=n,S*=r,[l*w-c*S+e,t-c*w-l*S]}return v.invert=function(w,S){return[n*(u*w-f*S+p),r*(x-f*w-u*S)]},v}function r6(i){return fme(function(){return i})()}function fme(i){var e,t=150,n=480,r=250,s=0,o=0,a=0,l=0,c=0,u,f=0,p=1,x=1,v=null,w=HD,S=null,T,P,R,C=QD,L=.5,D,F,N,B,z;function V(j){return N(j[0]*mn,j[1]*mn)}function H(j){return j=N.invert(j[0],j[1]),j&&[j[0]*Ki,j[1]*Ki]}V.stream=function(j){return B&&z===j?B:B=cme(ume(u)(w(D(C(z=j)))))},V.preclip=function(j){return arguments.length?(w=j,v=void 0,J()):w},V.postclip=function(j){return arguments.length?(C=j,S=T=P=R=null,J()):C},V.clipAngle=function(j){return arguments.length?(w=+j?OX(v=j*mn):(v=null,HD),J()):v*Ki},V.clipExtent=function(j){return arguments.length?(C=j==null?(S=T=P=R=null,QD):WD(S=+j[0][0],T=+j[0][1],P=+j[1][0],R=+j[1][1]),J()):S==null?null:[[S,T],[P,R]]},V.scale=function(j){return arguments.length?(t=+j,Z()):t},V.translate=function(j){return arguments.length?(n=+j[0],r=+j[1],Z()):[n,r]},V.center=function(j){return arguments.length?(s=j[0]%360*mn,o=j[1]%360*mn,Z()):[s*Ki,o*Ki]},V.rotate=function(j){return arguments.length?(a=j[0]%360*mn,l=j[1]%360*mn,c=j.length>2?j[2]%360*mn:0,Z()):[a*Ki,l*Ki,c*Ki]},V.angle=function(j){return arguments.length?(f=j%360*mn,Z()):f*Ki},V.reflectX=function(j){return arguments.length?(p=j?-1:1,Z()):p<0},V.reflectY=function(j){return arguments.length?(x=j?-1:1,Z()):x<0},V.precision=function(j){return arguments.length?(D=i6(F,L=j*j),J()):bo(L)},V.fitExtent=function(j,K){return n6(V,j,K)},V.fitSize=function(j,K){return XX(V,j,K)},V.fitWidth=function(j,K){return $X(V,j,K)},V.fitHeight=function(j,K){return YX(V,j,K)};function Z(){var j=KX(t,0,0,p,x,f).apply(null,e(s,o)),K=KX(t,n-j[0],r-j[1],p,x,f);return u=zD(a,l,c),F=Q2(e,K),N=Q2(u,F),D=i6(F,L),J()}function J(){return B=z=null,V}return function(){return e=i.apply(this,arguments),V.invert=e.invert&&H,Z()}}function QX(i){return function(e,t){var n=bo(e*e+t*t),r=i(n),s=an(r),o=fn(r);return[cs(e*s,n*o),Wo(n&&t*s/n)]}}function nv(i,e){return[i,aX(cX((to+e)/2))]}nv.invert=function(i,e){return[i,2*q_(oX(e))-to]};function s6(i,e){var t=fn(e),n=1+fn(i)*t;return[t*an(i)/n,an(e)/n]}s6.invert=QX(function(i){return 2*q_(i)});function o6(){return r6(s6).scale(250).clipAngle(142)}function c6(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 dme(i){if(Array.isArray(i))return i}function pme(i){if(Array.isArray(i))return c6(i)}function iv(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 Ame(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function mme(i,e,t){return e=aE(e),Eme(i,i$()?Reflect.construct(e,[],aE(i).constructor):e.apply(i,t))}function n$(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function gme(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function ti(i,e){return i.get(iv(i,e))}function Vp(i,e,t){n$(i,e),e.set(i,t)}function qp(i,e,t){return i.set(iv(i,e),t),t}function _me(i,e){n$(i,e),e.add(i)}function xme(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,s$(n.key),n)}}function yme(i,e,t){return e&&xme(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function $_(i,e,t){return(e=s$(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function aE(i){return aE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},aE(i)}function vme(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&&u6(i,e)}function i$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(i$=function(){return!!i})()}function bme(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function wme(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 Sme(){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 Tme(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4119+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Eme(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 Ame(i)}function u6(i,e){return u6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},u6(i,e)}function oE(i,e){return dme(i)||wme(i,e)||o$(i,e)||Sme()}function r$(i){return pme(i)||bme(i)||o$(i)||Tme()}function Mme(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 s$(i){var e=Mme(i,"string");return typeof e=="symbol"?e:e+""}function o$(i,e){if(i){if(typeof i=="string")return c6(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)?c6(i,e):void 0}}var a$=function(e){e instanceof Array?e.forEach(a$):(e.map&&e.map.dispose(),e.dispose())},h6=function(e){e.geometry&&e.geometry.dispose(),e.material&&a$(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(h6)};function l$(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 Cme(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 cm(i){return i*Math.PI/180}var c$=function(e){return 1-(nv(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},a6=function(e){return Math.max(0,Math.min(1,c$(e)))},JX=function(e){return .5-nv.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},Rme=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=Ya().domain([1,0]).range([t,n]).clamp(!0),s=Ya().domain([a6(t),a6(n)]).range([1,0]).clamp(!0),o=function(f){return s(a6(r(f)))},a=e.array,l=0,c=a.length;l<c;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},e$=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,c$(a))));var l=Math.floor(a*s);return[o,l]},f6=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,p=o===void 0?l-1:o,x=n,v=Math.min(l-1,f);x<=v;x++)for(var w=r,S=Math.min(l-1,p);w<=S;w++){var T=w,P=u;if(t){T=w===0?w:JX(w/l)*l;var R=w+1===l?w+1:JX((w+1)/l)*l;P=(R-T)*180/l}var C=-180+(x+.5)*c,L=90-(T*180/l+P/2),D=P;a.push({x,y:w,lng:C,lat:L,latLen:D})}return a},Pme=6,Ime=7,Nme=3,Lme=90,dh=new WeakMap,Hp=new WeakMap,l6=new WeakMap,rE=new WeakMap,ac=new WeakMap,lE=new WeakMap,Y_=new WeakMap,um=new WeakMap,sE=new WeakSet,u$=(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 gme(this,e),n=mme(this,e),_me(n,sE),Vp(n,dh,void 0),Vp(n,Hp,void 0),Vp(n,l6,void 0),Vp(n,rE,void 0),Vp(n,ac,{}),Vp(n,lE,void 0),Vp(n,Y_,void 0),Vp(n,um,void 0),$_(n,"minLevel",void 0),$_(n,"maxLevel",void 0),$_(n,"thresholds",r$(new Array(30)).map(function(p,x){return 8/Math.pow(2,x)})),$_(n,"curvatureResolution",5),$_(n,"tileMargin",0),$_(n,"clearTiles",function(){Object.values(ti(ac,n)).forEach(function(p){p.forEach(function(x){x.obj&&(n.remove(x.obj),h6(x.obj),delete x.obj)})}),qp(ac,n,{})}),qp(dh,n,t),n.tileUrl=s,qp(Hp,n,f),n.minLevel=a,n.maxLevel=c,n.level=0,n.add(qp(um,n,new Gn(new Aa(ti(dh,n)*.99,180,90),new as({color:0})))),ti(um,n).visible=!1,ti(um,n).material.polygonOffset=!0,ti(um,n).material.polygonOffsetUnits=3,ti(um,n).material.polygonOffsetFactor=1,n}return vme(e,i),yme(e,[{key:"tileUrl",get:function(){return ti(l6,this)},set:function(n){qp(l6,this,n),this.updatePov(ti(Y_,this))}},{key:"level",get:function(){return ti(rE,this)},set:function(n){var r,s=this;ti(ac,this)[n]||iv(sE,this,Dme).call(this,n);var o=ti(rE,this);if(qp(rE,this,n),!(n===o||o===void 0)){if(ti(um,this).visible=n>0,ti(ac,this)[n].forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!0)}),o<n&&((r=ti(ac,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++)ti(ac,this)[a]&&ti(ac,this)[a].forEach(function(l){l.obj&&(s.remove(l.obj),h6(l.obj),delete l.obj)});iv(sE,this,t$).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof Ff))){qp(Y_,this,n);var s;if(qp(lE,this,function(u){if(!u.hullPnts){var f=360/Math.pow(2,r.level),p=u.lng,x=u.lat,v=u.latLen,w=p-f/2,S=p+f/2,T=x-v/2,P=x+v/2;u.hullPnts=[[x,p],[T,w],[P,w],[T,S],[P,S]].map(function(R){var C=oE(R,2),L=C[0],D=C[1];return l$(L,D,ti(dh,r))}).map(function(R){var C=R.x,L=R.y,D=R.z;return new ie(C,L,D)})}return s||(s=new tc,n.updateMatrix(),n.updateMatrixWorld(),s.setFromProjectionMatrix(new on().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse))),u.hullPnts.some(function(R){return s.containsPoint(R.clone().applyMatrix4(r.matrixWorld))})}),this.tileUrl){var o=n.position.clone(),a=o.distanceTo(this.getWorldPosition(new ie)),l=(a-ti(dh,this))/ti(dh,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)),iv(sE,this,t$).call(this)}}}}])})(vr);function Dme(i){var e=this;if(i>Ime){ti(ac,this)[i]=[];return}var t=ti(ac,this)[i]=f6(i,ti(Hp,this));t.forEach(function(n){return n.centroid=l$(n.lat,n.lng,ti(dh,e))}),t.octree=O2().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function t$(){var i=this;if(!(!this.tileUrl||this.level===void 0||!ti(ac,this).hasOwnProperty(this.level))&&!(!ti(lE,this)&&this.level>Pme)){var e=ti(ac,this)[this.level];if(ti(Y_,this)){var t=this.worldToLocal(ti(Y_,this).position.clone());if(e.octree){var n,r=this.worldToLocal(ti(Y_,this).position.clone()),s=(r.length()-ti(dh,this))*Nme;e=(n=e.octree).findAllWithinRadius.apply(n,r$(r).concat([s]))}else{var o=Cme(t),a=(o.r/ti(dh,this)-1)*Lme,l=a/Math.cos(cm(o.lat)),c=[o.lng-l,o.lng+l],u=[o.lat+a,o.lat-a],f=e$(this.level,ti(Hp,this),c[0],u[0]),p=oE(f,2),x=p[0],v=p[1],w=e$(this.level,ti(Hp,this),c[1],u[1]),S=oE(w,2),T=S[0],P=S[1];!e.record&&(e.record={});var R=e.record;if(!R.hasOwnProperty("".concat(Math.round((x+T)/2),"_").concat(Math.round((v+P)/2))))e=f6(this.level,ti(Hp,this),x,v,T,P).map(function(N){var B="".concat(N.x,"_").concat(N.y);return R.hasOwnProperty(B)?R[B]:(R[B]=N,e.push(N),N)});else{for(var C=[],L=x;L<=T;L++)for(var D=v;D<=P;D++){var F="".concat(L,"_").concat(D);R.hasOwnProperty(F)||(R[F]=f6(this.level,ti(Hp,this),L,D,L,D)[0],e.push(R[F])),C.push(R[F])}e=C}}}e.filter(function(N){return!N.obj}).filter(ti(lE,this)||function(){return!0}).forEach(function(N){var B=N.x,z=N.y,V=N.lng,H=N.lat,Z=N.latLen,J=360/Math.pow(2,i.level);if(!N.obj){var j=J*(1-i.tileMargin),K=Z*(1-i.tileMargin),ee=cm(V),ae=cm(-H),ce=new Gn(new Aa(ti(dh,i),Math.ceil(j/i.curvatureResolution),Math.ceil(K/i.curvatureResolution),cm(90-j/2)+ee,cm(j),cm(90-K/2)+ae,cm(K)),new ma);if(ti(Hp,i)){var de=[H+Z/2,H-Z/2].map(function(Ue){return .5-Ue/180}),ve=oE(de,2),Ie=ve[0],Qe=ve[1];Rme(ce.geometry.attributes.uv,Ie,Qe)}N.obj=ce}N.loading||(N.loading=!0,new ja().load(i.tileUrl(B,z,i.level),function(Ue){var mt=N.obj;mt&&(Ue.colorSpace=yr,mt.material.map=Ue,mt.material.color=null,mt.material.needsUpdate=!0,i.add(mt)),N.loading=!1}))})}}var av=new Set,d6=!1;function y6(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length;av.size&&av.clear();let s=p$(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,c=0;if(n&&(s=kme(i,e,s,t)),i.length>80*t){a=i[0],l=i[1];let u=a,f=l;for(let p=t;p<r;p+=t){let x=i[p],v=i[p+1];x<a&&(a=x),v<l&&(l=v),x>u&&(u=x),v>f&&(f=v)}c=Math.max(u-a,f-l),c=c!==0?32767/c:0}return p6(s,o,a,l,c),o}function p$(i,e,t,n,r){let s=null;if(r===Qme(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=d$(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=d$(o/n|0,i[o],i[o+1],s);return s&&lv(s,s.next)&&(uv(s),s=s.next),s}function fm(i,e=i){let t=e===i,n=i,r;do r=!1,n!==n.next&&(av.size===0||!av.has(n))&&(lv(n,n.next)||Cs(n.prev,n,n.next)===0)?((t||n===e)&&(e=n.prev),d6=!0,uv(n),n=n.prev,r=!0):(t||n!==e)&&(n=n.next,r=!t);while(r||n!==e);return e}function p6(i,e,t,n,r){r&&jme(i,t,n,r);let s=i,o=!1;for(;i.prev!==i.next;){let a=i.prev,l=i.next;if(Cs(a,i,l)<0&&(r?Ome(i,t,n,r):Fme(i))){e.push(a.i,i.i,l.i),uv(i),i=l,s=l;continue}if(i=l,i===s){if(d6=!1,i=fm(i),d6){s=i;continue}if(!o){i=Bme(i,e),s=i,o=!0;continue}Ume(i,e,t,n,r);break}}}function Fme(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),p=Math.max(r,s,o),x=Math.max(a,l,c),v=n.next;for(;v!==e;){if(v.x>=u&&v.x<=p&&v.y>=f&&v.y<=x&&!(r===v.x&&a===v.y)&&fE(r,a,s,l,o,c,v.x,v.y)&&Cs(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function Ome(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,p=o.y,x=Math.min(a,l,c),v=Math.min(u,f,p),w=Math.max(a,l,c),S=Math.max(u,f,p),T=_6(x,v,e,t,n),P=_6(w,S,e,t,n),R=i.prevZ;for(;R&&R.z>=T;){if(R.x>=x&&R.x<=w&&R.y>=v&&R.y<=S&&R!==o&&!(a===R.x&&u===R.y)&&fE(a,u,l,f,c,p,R.x,R.y)&&Cs(R.prev,R,R.next)>=0)return!1;R=R.prevZ}let C=i.nextZ;for(;C&&C.z<=P;){if(C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==o&&!(a===C.x&&u===C.y)&&fE(a,u,l,f,c,p,C.x,C.y)&&Cs(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Bme(i,e){let t=i,n=!1;do{let r=t.prev,s=t.next.next;g$(r,t,t.next,s,!1)&&cv(r,s)&&cv(s,r)&&(e.push(r.i,t.i,s.i),uv(t),uv(t.next),t=i=s,n=!0),t=t.next}while(t!==i);return n?fm(t):t}function Ume(i,e,t,n,r){let s=i;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&Yme(s,o)){let a=_$(s,o);s=fm(s,s.next),a=fm(a,a.next),p6(s,e,t,n,r),p6(a,e,t,n,r);return}o=o.next}s=s.next}while(s!==i)}var A6=!1;function kme(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=p$(i,a,l,n,!1);c===c.next&&av.add(c),r.push($me(c))}r.sort(Gme),Vme(i.length/n,e.length),m$(t,t),A6=!0;for(let s=0;s<r.length;s++)t=zme(r[s],t);return A6=!1,fm(t)}function Gme(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 zme(i,e){let t=Hme(i,e);if(!t)return e;let n=_$(t,i),r=n.next;return m$(t,r.next),fm(n,n.next),fm(t,t.next)}var A$=16,Qr=new Float64Array(0),hE=0,m6=[],g6=[];function Vme(i,e){let t=Math.ceil((i+2*e)/A$)+e+2;Qr.length<t*4&&(Qr=new Float64Array(t*4)),hE=0}function m$(i,e){let t=i;do{let n=hE++;m6[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<A$&&t!==e);g6[n]=t;let c=n*4;Qr[c]=r,Qr[c+1]=s,Qr[c+2]=o,Qr[c+3]=a}while(t!==e)}function qme(i,e){let t=i.z*4;e.x<Qr[t]&&(Qr[t]=e.x),e.y<Qr[t+1]&&(Qr[t+1]=e.y),e.x>Qr[t+2]&&(Qr[t+2]=e.x),e.y>Qr[t+3]&&(Qr[t+3]=e.y)}function h$(i){let e=g6[i];for(;e.prev.next!==e;)e=e.next;return g6[i]=e,e}function f$(i){let e=m6[i];for(;e.prev.next!==e;)e=e.next;return m6[i]=e,e}function Hme(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(lv(i,t))return t;for(let p=0,x=0;p<hE;p++,x+=4){if(r<Qr[x+1]||r>Qr[x+3]||Qr[x]>n||Qr[x+2]<=s)continue;let v=h$(p);t=f$(p);do{if(t.prev.next===t){if(lv(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!==v)}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 p=0,x=0;p<hE;p++,x+=4){if(Qr[x+2]<a||Qr[x]>n||Qr[x+3]<c||Qr[x+1]>u)continue;let v=h$(p);t=f$(p);do{if(t.prev.next===t&&n>=t.x&&t.x>=a&&n!==t.x&&fE(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);(cv(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&&Wme(o,t)))&&(o=t,f=w)}t=t.next}while(t!==v)}return o}function Wme(i,e){return Cs(i.prev,i,e.prev)<0&&Cs(e.next,i,i.next)<0}var lc=[],rv=[],hm=new Uint32Array(0),sv=new Uint32Array(0),ov=new Uint32Array(256);function jme(i,e,t,n){let r=i,s=0;do r.z=_6(r.x,r.y,e,t,n),lc[s++]=r,r=r.next;while(r!==i);Xme(s);let o=null;for(let a=0;a<s;a++){let l=lc[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function Xme(i){if(i<=32){for(let e=1;e<i;e++){let t=lc[e],n=t.z,r=e-1;for(;r>=0&&lc[r].z>n;)lc[r+1]=lc[r],r--;lc[r+1]=t}return}hm.length<i&&(hm=new Uint32Array(i),sv=new Uint32Array(i),rv=new Array(i));for(let e=0;e<i;e++)hm[e]=lc[e].z;cE(i,lc,hm,rv,sv,0),cE(i,rv,sv,lc,hm,8),cE(i,lc,hm,rv,sv,16),cE(i,rv,sv,lc,hm,24)}function cE(i,e,t,n,r,s){ov.fill(0);for(let a=0;a<i;a++)ov[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){let l=ov[a];ov[a]=o,o+=l}for(let a=0;a<i;a++){let l=t[a],c=ov[l>>>s&255]++;n[c]=e[a],r[c]=l}}function _6(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 $me(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 fE(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 Yme(i,e){let t=lv(i,e)&&Cs(i.prev,i,i.next)>0&&Cs(e.prev,e,e.next)>0;return i.next.i!==e.i&&(t||cv(i,e)&&cv(e,i)&&(Cs(i.prev,i,e.prev)!==0||Cs(i,e.prev,e)!==0))&&!Zme(i,e)&&(t||Kme(i,e))}function Cs(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function lv(i,e){return i.x===e.x&&i.y===e.y}function g$(i,e,t,n,r=!0){let s=Cs(i,e,t),o=Cs(i,e,n),a=Cs(t,n,i),l=Cs(t,n,e);return(s>0&&o<0||s<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:r?!!(s===0&&uE(i,t,e)||o===0&&uE(i,n,e)||a===0&&uE(t,i,n)||l===0&&uE(t,e,n)):!1}function uE(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 Zme(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&&g$(o,a,i,e))return!0;o=a}while(o!==i);return!1}function cv(i,e){return Cs(i.prev,i,i.next)<0?Cs(i,e,i.next)>=0&&Cs(i,i.prev,e)>=0:Cs(i,e,i.prev)<0||Cs(i,i.next,e)<0}function Kme(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 _$(i,e){let t=x6(i.i,i.x,i.y),n=x6(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 d$(i,e,t,n){let r=x6(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 uv(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),A6&&qme(i.prev,i.next)}function x6(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function Qme(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 Z_(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 b6(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 Jme(i){if(Array.isArray(i))return i}function ege(i){if(Array.isArray(i))return b6(i)}function tge(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function nge(i,e,t){return e=dE(e),hge(i,v$()?Reflect.construct(e,[],dE(i).constructor):e.apply(i,t))}function ige(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function rge(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function sge(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=T6(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.4120+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 dE(i){return dE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},dE(i)}function oge(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&&w6(i,e)}function v$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(v$=function(){return!!i})()}function age(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function lge(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 cge(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4121+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uge(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4122+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hge(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 tge(i)}function w6(i,e){return w6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},w6(i,e)}function hv(i,e){return Jme(i)||lge(i,e)||T6(i,e)||cge()}function fge(i){return ege(i)||age(i)||T6(i)||uge()}function T6(i,e){if(i){if(typeof i=="string")return b6(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)?b6(i,e):void 0}}var x$=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=Ka(s,r)*180/Math.PI;if(o>t)for(var a=lm(r,s),l=r.length>2||s.length>2?uh(r[2]||0,s[2]||0):null,c=l?function(p){return[].concat(fge(a(p)),[l(p)])}:a,u=1/Math.ceil(o/t),f=u;f<1;)n.push(c(f)),f+=u}n.push(r=s)}),n},S6=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:qn,Float32BufferAttribute:Rn},dge=new S6.BufferGeometry().setAttribute?"setAttribute":"addAttribute",E6=(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;ige(this,e),n=nge(this,e),n.type="GeoJsonGeometry",n.parameters={geoJson:t,radius:r,resolution:s};var o=({Point:u,MultiPoint:f,LineString:p,MultiLineString:x,Polygon:v,MultiPolygon:w}[t.type]||function(){return[]})(t.coordinates,r),a=[],l=[],c=0;o.forEach(function(S){var T=a.length;fv({indices:a,vertices:l},S),n.addGroup(T,a.length-T,c++)}),a.length&&n.setIndex(a),l.length&&n[dge]("position",new S6.Float32BufferAttribute(l,3));function u(S,T){var P=v6(S[1],S[0],T+(S[2]||0)),R=[];return[{vertices:P,indices:R}]}function f(S,T){var P={vertices:[],indices:[]};return S.map(function(R){return u(R,T)}).forEach(function(R){var C=hv(R,1),L=C[0];fv(P,L)}),[P]}function p(S,T){for(var P=x$(S,s).map(function(N){var B=hv(N,3),z=B[0],V=B[1],H=B[2],Z=H===void 0?0:H;return v6(V,z,T+Z)}),R=Z_([P]),C=R.vertices,L=Math.round(C.length/3),D=[],F=1;F<L;F++)D.push(F-1,F);return[{vertices:C,indices:D}]}function x(S,T){var P={vertices:[],indices:[]};return S.map(function(R){return p(R,T)}).forEach(function(R){var C=hv(R,1),L=C[0];fv(P,L)}),[P]}function v(S,T){for(var P=S.map(function(j){return x$(j,s).map(function(K){var ee=hv(K,3),ae=ee[0],ce=ee[1],de=ee[2],ve=de===void 0?0:de;return v6(ce,ae,T+ve)})}),R=Z_(P),C=R.vertices,L=R.holes,D=L[0]||1/0,F=C.slice(0,D*3),N=C.slice(D*3),B=new Set(L),z=Math.round(C.length/3),V=[],H=[],Z=1;Z<z;Z++)B.has(Z)||(Z<D?V.push(Z-1,Z):H.push(Z-1-D,Z-D));var J=[{indices:V,vertices:F}];return L.length&&J.push({indices:H,vertices:N}),J}function w(S,T){var P={vertices:[],indices:[]},R={vertices:[],indices:[]};S.map(function(L){return v(L,T)}).forEach(function(L){var D=hv(L,2),F=D[0],N=D[1];fv(P,F),N&&fv(R,N)});var C=[P];return R.vertices.length&&C.push(R),C}return n}return oge(e,i),rge(e)})(S6.BufferGeometry);function fv(i,e){var t=Math.round(i.vertices.length/3);y$(i.vertices,e.vertices),y$(i.indices,e.indices.map(function(n){return n+t}))}function y$(i,e){var t=sge(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 v6(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 dv={};Xse(dv,{computeMikkTSpaceTangents:()=>pge,computeMorphedAttributes:()=>bge,deepCloneAttribute:()=>mge,deinterleaveAttribute:()=>pE,deinterleaveGeometry:()=>_ge,estimateBytesUsed:()=>xge,interleaveAttributes:()=>gge,mergeAttributes:()=>M6,mergeGeometries:()=>Age,mergeGroups:()=>wge,mergeVertices:()=>yge,toCreasedNormals:()=>Sge,toTrianglesDrawMode:()=>vge});function pge(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 Li(s,4)),i!==r&&i.copy(r),i}function Age(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 qn,c=0;for(let u=0;u<i.length;++u){let f=i[u],p=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 x in f.attributes){if(!n.has(x))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+x+'" attribute exists among all geometries, or in none of them.'),null;s[x]===void 0&&(s[x]=[]),s[x].push(f.attributes[x]),p++}if(p!==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 x in f.morphAttributes){if(!r.has(x))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[x]===void 0&&(o[x]=[]),o[x].push(f.morphAttributes[x])}if(e){let x;if(t)x=f.index.count;else if(f.attributes.position!==void 0)x=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,x,u),c+=x}}if(t){let u=0,f=[];for(let p=0;p<i.length;++p){let x=i[p].index;for(let v=0;v<x.count;++v)f.push(x.getX(v)+u);u+=i[p].attributes.position.count}l.setIndex(f)}for(let u in s){let f=M6(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 p=0;p<f;++p){let x=[];for(let w=0;w<o[u].length;++w)x.push(o[u][w][p]);let v=M6(x);if(!v)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(v)}}}return l}function M6(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 Li(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 p=0,x=u.count;p<x;p++)for(let v=0;v<t;v++){let w=u.getComponent(p,v);a.setComponent(p+f,v,w)}}else o.set(u.array,l);l+=u.count*t}return r!==void 0&&(a.gpuType=r),a}function mge(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?pE(i):i.isInstancedBufferAttribute?new _l().copy(i):new Li().copy(i)}function gge(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 Nf(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],p=f.itemSize,x=f.count,v=new _o(r,p,s,f.normalized);o.push(v),s+=p;for(let w=0;w<x;w++)for(let S=0;S<p;S++)v[l[S]](w,f[a[S]](w))}return o}function pE(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 _l(s,n,r,i.meshPerAttribute):o=new Li(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 _ge(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,pE(s)),e[r]=n.get(s))}for(let r in t){let s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,pE(s)),t[r]=n.get(s))}}function xge(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 yge(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"],p=["setX","setY","setZ","setW"];for(let P=0,R=a.length;P<R;P++){let C=a[P],L=i.attributes[C];l[C]=new L.constructor(new L.array.constructor(L.count*L.itemSize),L.itemSize,L.normalized);let D=i.morphAttributes[C];D&&(c[C]||(c[C]=[]),D.forEach((F,N)=>{let B=new F.array.constructor(F.count*F.itemSize);c[C][N]=new F.constructor(B,F.itemSize,F.normalized)}))}let x=e*.5,v=Math.log10(1/e),w=Math.pow(10,v),S=x*w;for(let P=0;P<s;P++){let R=n?n.getX(P):P,C="";for(let L=0,D=a.length;L<D;L++){let F=a[L],N=i.getAttribute(F),B=N.itemSize;for(let z=0;z<B;z++)C+=`${~~(N[f[z]](R)*w+S)},`}if(C in t)u.push(t[C]);else{for(let L=0,D=a.length;L<D;L++){let F=a[L],N=i.getAttribute(F),B=i.morphAttributes[F],z=N.itemSize,V=l[F],H=c[F];for(let Z=0;Z<z;Z++){let J=f[Z],j=p[Z];if(V[j](o,N[J](R)),B)for(let K=0,ee=B.length;K<ee;K++)H[K][j](o,B[K][J](R))}}t[C]=o,u.push(o),o++}}let T=i.clone();for(let P in i.attributes){let R=l[P];if(T.setAttribute(P,new R.constructor(R.array.slice(0,o*R.itemSize),R.itemSize,R.normalized)),P in c)for(let C=0;C<c[P].length;C++){let L=c[P][C];T.morphAttributes[P][C]=new L.constructor(L.array.slice(0,o*L.itemSize),L.itemSize,L.normalized)}}return T.setIndex(u),T}function vge(i,e){if(e===fL)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===t3||e===dL){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===t3)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 bge(i){let e=new ie,t=new ie,n=new ie,r=new ie,s=new ie,o=new ie,a=new ie,l=new ie,c=new ie;function u(ce,de,ve,Ie,Qe,Ue,mt,Me){e.fromBufferAttribute(de,Qe),t.fromBufferAttribute(de,Ue),n.fromBufferAttribute(de,mt);let ze=ce.morphTargetInfluences;if(ve&&ze){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let $e=0,Et=ve.length;$e<Et;$e++){let Tt=ze[$e],Ct=ve[$e];Tt!==0&&(r.fromBufferAttribute(Ct,Qe),s.fromBufferAttribute(Ct,Ue),o.fromBufferAttribute(Ct,mt),Ie?(a.addScaledVector(r,Tt),l.addScaledVector(s,Tt),c.addScaledVector(o,Tt)):(a.addScaledVector(r.sub(e),Tt),l.addScaledVector(s.sub(t),Tt),c.addScaledVector(o.sub(n),Tt)))}e.add(a),t.add(l),n.add(c)}ce.isSkinnedMesh&&(ce.applyBoneTransform(Qe,e),ce.applyBoneTransform(Ue,t),ce.applyBoneTransform(mt,n)),Me[Qe*3+0]=e.x,Me[Qe*3+1]=e.y,Me[Qe*3+2]=e.z,Me[Ue*3+0]=t.x,Me[Ue*3+1]=t.y,Me[Ue*3+2]=t.z,Me[mt*3+0]=n.x,Me[mt*3+1]=n.y,Me[mt*3+2]=n.z}let f=i.geometry,p=i.material,x,v,w,S=f.index,T=f.attributes.position,P=f.morphAttributes.position,R=f.morphTargetsRelative,C=f.attributes.normal,L=f.morphAttributes.normal,D=f.groups,F=f.drawRange,N,B,z,V,H,Z,J,j=new Float32Array(T.count*T.itemSize),K=new Float32Array(C.count*C.itemSize);if(S!==null)if(Array.isArray(p))for(N=0,z=D.length;N<z;N++)for(H=D[N],Z=Math.max(H.start,F.start),J=Math.min(H.start+H.count,F.start+F.count),B=Z,V=J;B<V;B+=3)x=S.getX(B),v=S.getX(B+1),w=S.getX(B+2),u(i,T,P,R,x,v,w,j),u(i,C,L,R,x,v,w,K);else for(Z=Math.max(0,F.start),J=Math.min(S.count,F.start+F.count),N=Z,z=J;N<z;N+=3)x=S.getX(N),v=S.getX(N+1),w=S.getX(N+2),u(i,T,P,R,x,v,w,j),u(i,C,L,R,x,v,w,K);else if(Array.isArray(p))for(N=0,z=D.length;N<z;N++)for(H=D[N],Z=Math.max(H.start,F.start),J=Math.min(H.start+H.count,F.start+F.count),B=Z,V=J;B<V;B+=3)x=B,v=B+1,w=B+2,u(i,T,P,R,x,v,w,j),u(i,C,L,R,x,v,w,K);else for(Z=Math.max(0,F.start),J=Math.min(T.count,F.start+F.count),N=Z,z=J;N<z;N+=3)x=N,v=N+1,w=N+2,u(i,T,P,R,x,v,w,j),u(i,C,L,R,x,v,w,K);let ee=new Rn(j,3),ae=new Rn(K,3);return{positionAttribute:T,normalAttribute:C,morphedPositionAttribute:ee,morphedNormalAttribute:ae}}function wge(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 Sge(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 C=0;C<r;C++)s[3*C+0]=n.getX(C),s[3*C+1]=n.getY(C),s[3*C+2]=n.getZ(C)}let o=Math.cos(e),a=(1+1e-10)*100,l=r/3,c=new Float64Array(l*3);for(let C=0;C<l;C++){let L=9*C,D=s[L+0],F=s[L+1],N=s[L+2],B=s[L+3],z=s[L+4],V=s[L+5],H=s[L+6],Z=s[L+7],J=s[L+8],j=H-B,K=Z-z,ee=J-V,ae=D-B,ce=F-z,de=N-V,ve=K*de-ee*ce,Ie=ee*ae-j*de,Qe=j*ce-K*ae,Ue=1/(Math.sqrt(ve*ve+Ie*Ie+Qe*Qe)||1);c[3*C+0]=ve*Ue,c[3*C+1]=Ie*Ue,c[3*C+2]=Qe*Ue}let u=new Int32Array(r),f=new Int32Array(r*3),p=1;for(;p<r*2;)p<<=1;let x=p-1,v=new Int32Array(p),w=0;for(let C=0;C<r;C++){let L=3*C,D=~~(s[L+0]*a),F=~~(s[L+1]*a),N=~~(s[L+2]*a),B=(Math.imul(D,73856093)^Math.imul(F,19349663)^Math.imul(N,83492791))&x;for(;;){let z=v[B];if(z===0){let H=3*w;f[H+0]=D,f[H+1]=F,f[H+2]=N,v[B]=w+1,u[C]=w++;break}let V=3*(z-1);if(f[V+0]===D&&f[V+1]===F&&f[V+2]===N){u[C]=z-1;break}B=B+1&x}}let S=new Int32Array(w+1);for(let C=0;C<r;C++)S[u[C]+1]++;for(let C=0;C<w;C++)S[C+1]+=S[C];let T=new Int32Array(r),P=S.slice(0,w);for(let C=0;C<l;C++){let L=3*C;T[P[u[L+0]]++]=C,T[P[u[L+1]]++]=C,T[P[u[L+2]]++]=C}let R=new Float32Array(r*3);for(let C=0;C<l;C++){let L=3*C,D=c[L+0],F=c[L+1],N=c[L+2];for(let B=0;B<3;B++){let z=L+B,V=u[z],H=0,Z=0,J=0;for(let K=S[V],ee=S[V+1];K<ee;K++){let ae=3*T[K],ce=c[ae+0],de=c[ae+1],ve=c[ae+2];D*ce+F*de+N*ve>o&&(H+=ce,Z+=de,J+=ve)}let j=1/(Math.sqrt(H*H+Z*Z+J*J)||1);R[3*z+0]=H*j,R[3*z+1]=Z*j,R[3*z+2]=J*j}}return t.setAttribute("normal",new Li(R,3,!1)),t}var rt=(function(i){return typeof i=="function"?i:typeof i=="string"?function(e){return e[i]}:function(e){return i}});function AE(i){"@babel/helpers - typeof";return AE=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},AE(i)}var Tge=/^\s+/,Ege=/\s+$/;function dn(i,e){if(i=i||"",e=e||{},i instanceof dn)return i;if(!(this instanceof dn))return new dn(i,e);var t=Mge(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}dn.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=C$(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=w$(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=w$(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=b$(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=b$(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 S$(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return Ige(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(wr(this._r,255)*100)+"%",g:Math.round(wr(this._g,255)*100)+"%",b:Math.round(wr(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(wr(this._r,255)*100)+"%, "+Math.round(wr(this._g,255)*100)+"%, "+Math.round(wr(this._b,255)*100)+"%)":"rgba("+Math.round(wr(this._r,255)*100)+"%, "+Math.round(wr(this._g,255)*100)+"%, "+Math.round(wr(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:qge[S$(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+T$(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=dn(e);n="#"+T$(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 dn(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(Fge,arguments)},brighten:function(){return this._applyModification(Oge,arguments)},darken:function(){return this._applyModification(Bge,arguments)},desaturate:function(){return this._applyModification(Nge,arguments)},saturate:function(){return this._applyModification(Lge,arguments)},greyscale:function(){return this._applyModification(Dge,arguments)},spin:function(){return this._applyModification(Uge,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(zge,arguments)},complement:function(){return this._applyCombination(kge,arguments)},monochromatic:function(){return this._applyCombination(Vge,arguments)},splitcomplement:function(){return this._applyCombination(Gge,arguments)},triad:function(){return this._applyCombination(E$,[3])},tetrad:function(){return this._applyCombination(E$,[4])}};dn.fromRatio=function(i,e){if(AE(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=pv(i[n]));i=t}return dn(i,e)};function Mge(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=Xge(i)),AE(i)=="object"&&(Wf(i.r)&&Wf(i.g)&&Wf(i.b)?(e=Cge(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):Wf(i.h)&&Wf(i.s)&&Wf(i.v)?(n=pv(i.s),r=pv(i.v),e=Pge(i.h,n,r),o=!0,a="hsv"):Wf(i.h)&&Wf(i.s)&&Wf(i.l)&&(n=pv(i.s),s=pv(i.l),e=Rge(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=C$(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 Cge(i,e,t){return{r:wr(i,255)*255,g:wr(e,255)*255,b:wr(t,255)*255}}function b$(i,e,t){i=wr(i,255),e=wr(e,255),t=wr(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 Rge(i,e,t){var n,r,s;i=wr(i,360),e=wr(e,100),t=wr(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 w$(i,e,t){i=wr(i,255),e=wr(e,255),t=wr(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 Pge(i,e,t){i=wr(i,360)*6,e=wr(e,100),t=wr(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 S$(i,e,t,n){var r=[Jc(Math.round(i).toString(16)),Jc(Math.round(e).toString(16)),Jc(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 Ige(i,e,t,n,r){var s=[Jc(Math.round(i).toString(16)),Jc(Math.round(e).toString(16)),Jc(Math.round(t).toString(16)),Jc(R$(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 T$(i,e,t,n){var r=[Jc(R$(n)),Jc(Math.round(i).toString(16)),Jc(Math.round(e).toString(16)),Jc(Math.round(t).toString(16))];return r.join("")}dn.equals=function(i,e){return!i||!e?!1:dn(i).toRgbString()==dn(e).toRgbString()};dn.random=function(){return dn.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Nge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.s-=e/100,t.s=mE(t.s),dn(t)}function Lge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.s+=e/100,t.s=mE(t.s),dn(t)}function Dge(i){return dn(i).desaturate(100)}function Fge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.l+=e/100,t.l=mE(t.l),dn(t)}function Oge(i,e){e=e===0?0:e||10;var t=dn(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)))),dn(t)}function Bge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.l-=e/100,t.l=mE(t.l),dn(t)}function Uge(i,e){var t=dn(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,dn(t)}function kge(i){var e=dn(i).toHsl();return e.h=(e.h+180)%360,dn(e)}function E$(i,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var t=dn(i).toHsl(),n=[dn(i)],r=360/e,s=1;s<e;s++)n.push(dn({h:(t.h+s*r)%360,s:t.s,l:t.l}));return n}function Gge(i){var e=dn(i).toHsl(),t=e.h;return[dn(i),dn({h:(t+72)%360,s:e.s,l:e.l}),dn({h:(t+216)%360,s:e.s,l:e.l})]}function zge(i,e,t){e=e||6,t=t||30;var n=dn(i).toHsl(),r=360/t,s=[dn(i)];for(n.h=(n.h-(r*e>>1)+720)%360;--e;)n.h=(n.h+r)%360,s.push(dn(n));return s}function Vge(i,e){e=e||6;for(var t=dn(i).toHsv(),n=t.h,r=t.s,s=t.v,o=[],a=1/e;e--;)o.push(dn({h:n,s:r,v:s})),s=(s+a)%1;return o}dn.mix=function(i,e,t){t=t===0?0:t||50;var n=dn(i).toRgb(),r=dn(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 dn(o)};dn.readability=function(i,e){var t=dn(i),n=dn(e);return(Math.max(t.getLuminance(),n.getLuminance())+.05)/(Math.min(t.getLuminance(),n.getLuminance())+.05)};dn.isReadable=function(i,e,t){var n=dn.readability(i,e),r,s;switch(s=!1,r=$ge(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};dn.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=dn.readability(i,e[c]),s>r&&(r=s,n=dn(e[c]));return dn.isReadable(i,n,{level:a,size:l})||!o?n:(t.includeFallbackColors=!1,dn.mostReadable(i,["#fff","#000"],t))};var C6=dn.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"},qge=dn.hexNames=Hge(C6);function Hge(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function C$(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function wr(i,e){Wge(i)&&(i="100%");var t=jge(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 mE(i){return Math.min(1,Math.max(0,i))}function Tl(i){return parseInt(i,16)}function Wge(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function jge(i){return typeof i=="string"&&i.indexOf("%")!=-1}function Jc(i){return i.length==1?"0"+i:""+i}function pv(i){return i<=1&&(i=i*100+"%"),i}function R$(i){return Math.round(parseFloat(i)*255).toString(16)}function M$(i){return Tl(i)/255}var Qc=(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 Wf(i){return!!Qc.CSS_UNIT.exec(i)}function Xge(i){i=i.replace(Tge,"").replace(Ege,"").toLowerCase();var e=!1;if(C6[i])i=C6[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Qc.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=Qc.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Qc.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=Qc.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Qc.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=Qc.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Qc.hex8.exec(i))?{r:Tl(t[1]),g:Tl(t[2]),b:Tl(t[3]),a:M$(t[4]),format:e?"name":"hex8"}:(t=Qc.hex6.exec(i))?{r:Tl(t[1]),g:Tl(t[2]),b:Tl(t[3]),format:e?"name":"hex"}:(t=Qc.hex4.exec(i))?{r:Tl(t[1]+""+t[1]),g:Tl(t[2]+""+t[2]),b:Tl(t[3]+""+t[3]),a:M$(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Qc.hex3.exec(i))?{r:Tl(t[1]+""+t[1]),g:Tl(t[2]+""+t[2]),b:Tl(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function $ge(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 N6(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 Yge(i){if(Array.isArray(i))return i}function Zge(i){if(Array.isArray(i))return N6(i)}function P$(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 Kge(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Qge(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function jo(i,e){return i.get(P$(i,e))}function K_(i,e,t){Kge(i,e),e.set(i,t)}function gE(i,e,t){return i.set(P$(i,e),t),t}function Jge(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,l_e(n.key),n)}}function e_e(i,e,t){return e&&Jge(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function t_e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function n_e(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 i_e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4123+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function r_e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4124+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function s_e(i,e){return Yge(i)||n_e(i,e)||I$(i,e)||i_e()}function o_e(i){return Zge(i)||t_e(i)||I$(i)||r_e()}function a_e(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 l_e(i){var e=a_e(i,"string");return typeof e=="symbol"?e:e+""}function I$(i,e){if(i){if(typeof i=="string")return N6(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)?N6(i,e):void 0}}var Q_=new WeakMap,Av=new WeakMap,J_=new WeakMap,R6=new WeakMap,P6=new WeakMap,I6=new WeakMap,N$=(function(){function i(){Qge(this,i),K_(this,Q_,new Map),K_(this,Av,new Map),K_(this,J_,function(e){return e}),K_(this,R6,function(){return{}}),K_(this,P6,function(){}),K_(this,I6,function(){})}return e_e(i,[{key:"getObj",value:function(t){return jo(Q_,this).get(jo(J_,this).call(this,t))}},{key:"getData",value:function(t){return jo(Av,this).get(t)}},{key:"entries",value:function(){return o_e(jo(Av,this).entries()).map(function(t){var n=s_e(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return gE(J_,this,rt(t)),this}},{key:"onCreateObj",value:function(t){return gE(R6,this,t),this}},{key:"onUpdateObj",value:function(t){return gE(P6,this,t),this}},{key:"onRemoveObj",value:function(t){return gE(I6,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!jo(Q_,n).has(jo(J_,n).call(n,s))}).forEach(function(s){var o=jo(R6,n).call(n,s);jo(Q_,n).set(jo(J_,n).call(n,s),o),jo(Av,n).set(o,s)});var r=new Map(t.map(function(s){return[jo(J_,n).call(n,s),s]}));return jo(Q_,this).forEach(function(s,o){r.has(o)?jo(P6,n).call(n,s,r.get(o)):(jo(I6,n).call(n,s,o),jo(Q_,n).delete(o),jo(Av,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();var Km=Yse(L$(),1);var vi=11102230246251565e-32,Rs=134217729,gv=(3+8*vi)*vi;function dm(i,e,t,n,r){let s,o,a,l,c=e[0],u=n[0],f=0,p=0;u>c==u>-c?(s=c,c=e[++f]):(s=u,u=n[++p]);let x=0;if(f<i&&p<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[++p]),s=o,a!==0&&(r[x++]=a);f<i&&p<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[++p]),s=o,a!==0&&(r[x++]=a);for(;f<i;)o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++f],s=o,a!==0&&(r[x++]=a);for(;p<t;)o=s+u,l=o-s,a=s-(o-l)+(u-l),u=n[++p],s=o,a!==0&&(r[x++]=a);return(s!==0||x===0)&&(r[x++]=s),x}function _v(i,e){let t=e[0];for(let n=1;n<i;n++)t+=e[n];return t}function ut(i){return new Float64Array(i)}var c_e=(3+16*vi)*vi,u_e=(2+12*vi)*vi,h_e=(9+64*vi)*vi*vi,e1=ut(4),D$=ut(8),F$=ut(12),O$=ut(16),ba=ut(4);function f_e(i,e,t,n,r,s,o){let a,l,c,u,f,p,x,v,w,S,T,P,R,C,L,D,F,N,B=i-r,z=t-r,V=e-s,H=n-s;C=B*H,p=Rs*B,x=p-(p-B),v=B-x,p=Rs*H,w=p-(p-H),S=H-w,L=v*S-(C-x*w-v*w-x*S),D=V*z,p=Rs*V,x=p-(p-V),v=V-x,p=Rs*z,w=p-(p-z),S=z-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,e1[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,e1[1]=R-(T+f)+(f-D),N=P+T,f=N-P,e1[2]=P-(N-f)+(T-f),e1[3]=N;let Z=_v(4,e1),J=u_e*o;if(Z>=J||-Z>=J||(f=i-B,a=i-(B+f)+(f-r),f=t-z,c=t-(z+f)+(f-r),f=e-V,l=e-(V+f)+(f-s),f=n-H,u=n-(H+f)+(f-s),a===0&&l===0&&c===0&&u===0)||(J=h_e*o+gv*Math.abs(Z),Z+=B*u+H*a-(V*c+z*l),Z>=J||-Z>=J))return Z;C=a*H,p=Rs*a,x=p-(p-a),v=a-x,p=Rs*H,w=p-(p-H),S=H-w,L=v*S-(C-x*w-v*w-x*S),D=l*z,p=Rs*l,x=p-(p-l),v=l-x,p=Rs*z,w=p-(p-z),S=z-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,ba[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,ba[1]=R-(T+f)+(f-D),N=P+T,f=N-P,ba[2]=P-(N-f)+(T-f),ba[3]=N;let j=dm(4,e1,4,ba,D$);C=B*u,p=Rs*B,x=p-(p-B),v=B-x,p=Rs*u,w=p-(p-u),S=u-w,L=v*S-(C-x*w-v*w-x*S),D=V*c,p=Rs*V,x=p-(p-V),v=V-x,p=Rs*c,w=p-(p-c),S=c-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,ba[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,ba[1]=R-(T+f)+(f-D),N=P+T,f=N-P,ba[2]=P-(N-f)+(T-f),ba[3]=N;let K=dm(j,D$,4,ba,F$);C=a*u,p=Rs*a,x=p-(p-a),v=a-x,p=Rs*u,w=p-(p-u),S=u-w,L=v*S-(C-x*w-v*w-x*S),D=l*c,p=Rs*l,x=p-(p-l),v=l-x,p=Rs*c,w=p-(p-c),S=c-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,ba[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,ba[1]=R-(T+f)+(f-D),N=P+T,f=N-P,ba[2]=P-(N-f)+(T-f),ba[3]=N;let ee=dm(K,F$,4,ba,O$);return O$[ee-1]}function Wp(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)>=c_e*c?l:-f_e(i,e,t,n,r,s,c)}var wZe=(7+56*vi)*vi,SZe=(3+28*vi)*vi,TZe=(26+288*vi)*vi*vi,EZe=ut(4),MZe=ut(4),CZe=ut(4),RZe=ut(4),PZe=ut(4),IZe=ut(4),NZe=ut(4),LZe=ut(4),DZe=ut(4),FZe=ut(8),OZe=ut(8),BZe=ut(8),UZe=ut(4),kZe=ut(8),GZe=ut(8),zZe=ut(16),VZe=ut(12),qZe=ut(192),HZe=ut(192);var XZe=(10+96*vi)*vi,$Ze=(4+48*vi)*vi,YZe=(44+576*vi)*vi*vi,ZZe=ut(4),KZe=ut(4),QZe=ut(4),JZe=ut(4),eKe=ut(4),tKe=ut(4),nKe=ut(4),iKe=ut(4),rKe=ut(8),sKe=ut(8),oKe=ut(8),aKe=ut(8),lKe=ut(8),cKe=ut(8),uKe=ut(8),hKe=ut(8),fKe=ut(8),dKe=ut(4),pKe=ut(4),AKe=ut(4),mKe=ut(8),gKe=ut(16),_Ke=ut(16),xKe=ut(16),yKe=ut(32),vKe=ut(32),bKe=ut(48),wKe=ut(64),SKe=ut(1152),TKe=ut(1152);var RKe=(16+224*vi)*vi,PKe=(5+72*vi)*vi,IKe=(71+1408*vi)*vi*vi,NKe=ut(4),LKe=ut(4),DKe=ut(4),FKe=ut(4),OKe=ut(4),BKe=ut(4),UKe=ut(4),kKe=ut(4),GKe=ut(4),zKe=ut(4),VKe=ut(24),qKe=ut(24),HKe=ut(24),WKe=ut(24),jKe=ut(24),XKe=ut(24),$Ke=ut(24),YKe=ut(24),ZKe=ut(24),KKe=ut(24),QKe=ut(1152),JKe=ut(1152),eQe=ut(1152),tQe=ut(1152),nQe=ut(1152),iQe=ut(2304),rQe=ut(2304),sQe=ut(3456),oQe=ut(5760),aQe=ut(8),lQe=ut(8),cQe=ut(8),uQe=ut(16),hQe=ut(24),fQe=ut(48),dQe=ut(48),pQe=ut(96),AQe=ut(192),mQe=ut(384),gQe=ut(384),_Qe=ut(384),xQe=ut(768);var yQe=ut(96),vQe=ut(96),bQe=ut(96),wQe=ut(1152);var U$=Math.pow(2,-52),_E=new Uint32Array(512),jp=class i{static from(e,t=__e,n=x_e){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 z=e[2*B],V=e[2*B+1];z<a&&(a=z),V<l&&(l=V),z>c&&(c=z),V>u&&(u=V),this._ids[B]=B}let f=(a+c)/2,p=(l+u)/2,x=0,v=0,w=0;for(let B=0,z=1/0;B<o;B++){let V=D6(f,p,e[2*B],e[2*B+1]);V<z&&(x=B,z=V)}let S=e[2*x],T=e[2*x+1];for(let B=0,z=1/0;B<o;B++){if(B===x)continue;let V=D6(S,T,e[2*B],e[2*B+1]);V<z&&V>0&&(v=B,z=V)}let P=e[2*v],R=e[2*v+1],C=1/0;for(let B=0;B<o;B++){if(B===x||B===v)continue;let z=m_e(S,T,P,R,e[2*B],e[2*B+1]);z<C&&(w=B,C=z)}let L=e[2*w],D=e[2*w+1];if(C===1/0){for(let V=0;V<o;V++)this._dists[V]=e[2*V]-e[0]||e[2*V+1]-e[1];t1(this._ids,this._dists,0,o-1);let B=new Uint32Array(o),z=0;for(let V=0,H=-1/0;V<o;V++){let Z=this._ids[V],J=this._dists[Z];J>H&&(B[z++]=Z,H=J)}this.hull=B.subarray(0,z),this.triangles=new Uint32Array(0),this.halfedges=new Int32Array(0);return}if(Wp(S,T,P,R,L,D)<0){let B=v,z=P,V=R;v=w,P=L,R=D,w=B,L=z,D=V}let F=g_e(S,T,P,R,L,D);this._cx=F.x,this._cy=F.y;for(let B=0;B<o;B++)this._dists[B]=D6(e[2*B],e[2*B+1],F.x,F.y);t1(this._ids,this._dists,0,o-1),this._hullStart=x;let N=3;n[x]=t[w]=v,n[v]=t[x]=w,n[w]=t[v]=x,r[x]=0,r[v]=1,r[w]=2,s.fill(-1),s[this._hashKey(S,T)]=x,s[this._hashKey(P,R)]=v,s[this._hashKey(L,D)]=w,this.trianglesLen=0,this._addTriangle(x,v,w,-1,-1,-1);for(let B=0,z=0,V=0;B<this._ids.length;B++){let H=this._ids[B],Z=e[2*H],J=e[2*H+1];if(B>0&&Math.abs(Z-z)<=U$&&Math.abs(J-V)<=U$||(z=Z,V=J,H===x||H===v||H===w))continue;let j=0;for(let de=0,ve=this._hashKey(Z,J);de<this._hashSize&&(j=s[(ve+de)%this._hashSize],!(j!==-1&&j!==n[j]));de++);j=t[j];let K=j,ee;for(;ee=n[K],Wp(Z,J,e[2*K],e[2*K+1],e[2*ee],e[2*ee+1])>=0;)if(K=ee,K===j){K=-1;break}if(K===-1)continue;let ae=this._addTriangle(K,H,n[K],-1,-1,r[K]);r[H]=this._legalize(ae+2),r[K]=ae,N++;let ce=n[K];for(;ee=n[ce],Wp(Z,J,e[2*ce],e[2*ce+1],e[2*ee],e[2*ee+1])<0;)ae=this._addTriangle(ce,H,ee,r[H],-1,r[ce]),r[H]=this._legalize(ae+2),n[ce]=ce,N--,ce=ee;if(K===j)for(;ee=t[K],Wp(Z,J,e[2*ee],e[2*ee+1],e[2*K],e[2*K+1])<0;)ae=this._addTriangle(ee,H,K,-1,r[K],r[ee]),this._legalize(ae+2),r[ee]=ae,n[K]=K,N--,K=ee;this._hullStart=t[H]=K,n[K]=t[ce]=H,n[H]=ce,s[this._hashKey(Z,J)]=H,s[this._hashKey(e[2*K],e[2*K+1])]=K}this.hull=new Uint32Array(N);for(let B=0,z=this._hullStart;B<N;B++)this.hull[B]=z,z=n[z];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(e,t){return Math.floor(p_e(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=_E[--s];continue}let c=a-a%3,u=l+(e+1)%3,f=c+(a+2)%3,p=t[o],x=t[e],v=t[u],w=t[f];if(A_e(r[2*p],r[2*p+1],r[2*x],r[2*x+1],r[2*v],r[2*v+1],r[2*w],r[2*w+1])){t[e]=w,t[a]=p;let T=n[f];if(T===-1){let R=this._hullStart;do{if(this._hullTri[R]===f){this._hullTri[R]=e;break}R=this._hullPrev[R]}while(R!==this._hullStart)}this._link(e,T),this._link(a,n[o]),this._link(o,f);let P=c+(a+1)%3;s<_E.length&&(_E[s++]=P)}else{if(s===0)break;e=_E[--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 p_e(i,e){let t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function D6(i,e,t,n){let r=i-t,s=e-n;return r*r+s*s}function A_e(i,e,t,n,r,s,o,a){let l=i-o,c=e-a,u=t-o,f=n-a,p=r-o,x=s-a,v=l*l+c*c,w=u*u+f*f,S=p*p+x*x;return l*(f*S-w*x)-c*(u*S-w*p)+v*(u*x-f*p)<0}function m_e(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,p=.5/(o*c-a*l),x=(c*u-a*f)*p,v=(o*f-l*u)*p;return x*x+v*v}function g_e(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,p=.5/(o*c-a*l),x=i+(c*u-a*f)*p,v=e+(o*f-l*u)*p;return{x,y:v}}function t1(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;xv(i,r,s),e[i[t]]>e[i[n]]&&xv(i,t,n),e[i[s]]>e[i[n]]&&xv(i,s,n),e[i[t]]>e[i[s]]&&xv(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;xv(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(t1(i,e,s,n),t1(i,e,t,o-1)):(t1(i,e,t,o-1),t1(i,e,s,n))}}function xv(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function __e(i){return i[0]}function x_e(i){return i[1]}function k$(i,e){var t,n,r=0,s,o,a,l,c,u,f,p=i[0],x=i[1],v=e.length;for(t=0;t<v;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]-p,a=u[1]-x,n;n<S;n++){if(f=w[n+1],l=f[0]-p,c=f[1]-x,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=Wp(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 G$(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 z$(i){return i.type==="Feature"?i.geometry:i}function y_e(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");let n=G$(i),r=z$(e),s=r.type,o=e.bbox,a=r.coordinates;if(o&&v_e(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){let u=k$(n,a[c]);if(u===0)return!t.ignoreBoundary;u&&(l=!0)}return l}function v_e(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var V$=y_e;var cc=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 Xp=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 yv=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,P,R;w<T;w+=3,S+=2){let C=n[w]*2,L=n[w+1]*2,D=n[w+2]*2,F=e[C],N=e[C+1],B=e[L],z=e[L+1],V=e[D],H=e[D+1],Z=B-F,J=z-N,j=V-F,K=H-N,ee=(Z*K-J*j)*2;if(Math.abs(ee)<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 ae=1e9*Math.sign((s-F)*K-(o-N)*j);P=(F+V)/2-ae*K,R=(N+H)/2+ae*j}else{let ae=1/ee,ce=Z*Z+J*J,de=j*j+K*K;P=F+(K*ce-J*de)*ae,R=N+(Z*de-j*ce)*ae}a[S]=P,a[S+1]=R}let l=t[t.length-1],c,u=l*4,f,p=e[2*l],x,v=e[2*l+1];r.fill(0);for(let w=0;w<t.length;++w)l=t[w],c=u,f=p,x=v,u=l*4,p=e[2*l],v=e[2*l+1],r[c+2]=r[u]=x-v,r[c+3]=r[u+1]=p-f}render(e){let t=e==null?e=new cc: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 p=n[u];if(p<u)continue;let x=Math.floor(u/3)*2,v=Math.floor(p/3)*2,w=o[x],S=o[x+1],T=o[v],P=o[v+1];this._renderSegment(w,S,T,P,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,p=o[f],x=o[f+1],v=l*4,w=this._project(p,x,a[v+2],a[v+3]);w&&this._renderSegment(p,x,w[0],w[1],e)}return t&&t.value()}renderBounds(e){let t=e==null?e=new cc: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 cc: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 Xp;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,p=0;for(let x=0;x<n;x+=2)if(s=a,o=l,a=t[x],l=t[x+1],c=u,u=this._regioncode(a,l),c===0&&u===0)f=p,p=0,r?r.push(a,l):r=[a,l];else{let v,w,S,T,P;if(c===0){if((v=this._clipSegment(s,o,a,l,c,u))===null)continue;[w,S,T,P]=v}else{if((v=this._clipSegment(a,l,s,o,u,c))===null)continue;[T,P,w,S]=v,f=p,p=this._edgecode(w,S),f&&p&&this._edge(e,f,p,r,r.length),r?r.push(w,S):r=[w,S]}f=p,p=this._edgecode(T,P),f&&p&&this._edge(e,f,p,r,r.length),r?r.push(T,P):r=[T,P]}if(r)f=p,p=this._edgecode(r[0],r[1]),f&&p&&this._edge(e,f,p,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,p=this._edgecode(a[u-2],a[u-1]);c<u;c+=2)f=p,p=this._edgecode(a[c],a[c+1]),f&&p&&(c=this._edge(e,f,p,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 b_e=2*Math.PI,n1=Math.pow;function w_e(i){return i[0]}function S_e(i){return i[1]}function T_e(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 E_e(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}var i1=class i{static from(e,t=w_e,n=S_e,r){return new i("length"in e?M_e(e,t,n,r):Float64Array.from(C_e(e,t,n,r)))}constructor(e){this._delaunator=new jp(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&&T_e(e)){this.collinear=Int32Array.from({length:t.length/2},(p,x)=>x).sort((p,x)=>t[2*p]-t[2*x]||t[2*p+1]-t[2*x+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 p=0,x=t.length/2;p<x;++p){let v=E_e(t[2*p],t[2*p+1],f);t[2*p]=v[0],t[2*p+1]=v[1]}this._delaunator=new jp(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 yv(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=n1(t-c[e*2],2)+n1(n-c[e*2+1],2),p=r[e],x=p;do{let v=l[x],w=n1(t-c[v*2],2)+n1(n-c[v*2+1],2);if(w<f&&(f=w,u=v),x=x%3===2?x-2:x+1,l[x]!==e)break;if(x=a[x],x===-1){if(x=s[(o[e]+1)%s.length],x!==v&&n1(t-c[x*2],2)+n1(n-c[x*2+1],2)<f)return x;break}}while(x!==p);return u}render(e){let t=e==null?e=new cc: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 cc: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,b_e)}return n&&n.value()}renderHull(e){let t=e==null?e=new cc: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 Xp;return this.renderHull(e),e.value()}renderTriangle(e,t){let n=t==null?t=new cc: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 Xp;return this.renderTriangle(e,t),t.value()}};function M_e(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*C_e(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 vv=Math.PI,q$=vv/2,iJe=vv/4,rJe=vv*2,F6=180/vv,O6=vv/180;var B6=Math.atan2,xE=Math.cos;var H$=Math.max,W$=Math.min;var yE=Math.sin,j$=Math.sign||function(i){return i>0?1:i<0?-1:0},vE=Math.sqrt;function U6(i){return i>1?q$:i<-1?-q$:Math.asin(i)}function k6(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Qa(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 bv(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function wv(i){var e=vE(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function G6(i){return[B6(i[1],i[0])*F6,U6(H$(-1,W$(1,i[2])))*F6]}function ph(i){let e=i[0]*O6,t=i[1]*O6,n=xE(t);return[n*xE(e),n*yE(e),yE(t)]}function bE(i){return i=i.map(e=>ph(e)),k6(i[0],Qa(i[2],i[1]))}function $$(i){let e=P_e(i),t=N_e(e),n=I_e(t,i),r=D_e(t,i.length),s=R_e(r,i),o=L_e(t,i),{polygons:a,centers:l}=F_e(o,t,i),c=O_e(a),u=U_e(t,i),f=B_e(n,t);return{delaunay:e,edges:n,triangles:t,centers:l,neighbors:r,polygons:a,mesh:c,hull:u,urquhart:f,find:s}}function R_e(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=ph([r,s]);do a=o,o=null,l=t(u,ph(e[a])),i[a].forEach(f=>{let p=t(u,ph(e[f]));if(p<l){l=p,o=f,c=f;return}});while(o!==null);return c}}function P_e(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);let t=VD(i[e]),n=o6().translate([0,0]).scale(1).rotate(t.invert([180,0]));i=i.map(n);let r=[],s=1;for(let p=0,x=i.length;p<x;p++){let v=i[p][0]**2+i[p][1]**2;!isFinite(v)||v>1e32?r.push(p):v>s&&(s=v)}let o=1e6*vE(s);r.forEach(p=>i[p]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);let a=i1.from(i);a.projection=n;let{triangles:l,halfedges:c,inedges:u}=a,f=[];for(let p=0,x=c.length;p<x;p++)if(c[p]<0){let v=p%3==2?p-2:p+1,w=p%3==0?p+2:p-1,S=c[v],T=c[w];c[S]=T,c[T]=S,c[v]=c[w]=-1,l[p]=l[v]=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(p,v,w)),p+=2-p%3}else l[p]>i.length-3-1&&(l[p]=e);return a}function I_e(i,e){let t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(bE(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(Up([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function N_e(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 L_e(i,e){return i.map(t=>{let n=t.map(s=>e[s]).map(ph),r=bv(bv(Qa(n[1],n[0]),Qa(n[2],n[1])),Qa(n[0],n[2]));return G6(wv(r))})}function D_e(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 F_e(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=ph(t[0]),l=ph(t[1]),c=wv(bv(a,l)),u=wv(Qa(a,l)),f=Qa(c,u),p=[c,Qa(c,f),Qa(Qa(c,f),f),Qa(Qa(Qa(c,f),f),f)].map(G6).map(o);return n.push(p),n.push(p.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],p=a[(c+2)%3];n[u]=n[u]||[],n[u].push([f,p,l,[u,f,p]])}});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=X$(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),f=X$(t[a[0][3][2]],t[a[0][3][0]],r[l[0]]),p=o(u),x=o(f);return[l[0],x,l[1],p]}});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 X$(i,e,t){i=ph(i),e=ph(e),t=ph(t);let n=j$(k6(Qa(e,i),t));return G6(wv(bv(i,e)).map(r=>n*r))}function O_e(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 B_e(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=Up([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 U_e(i,e){let t=new Set,n=[];i.map(a=>{if(!(bE(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 z6(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=$$(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return j3(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return j3(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=>bE(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=>Ka(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||Ka([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 q6(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 k_e(i){if(Array.isArray(i))return i}function G_e(i){if(Array.isArray(i))return q6(i)}function z_e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function V_e(i,e,t){return e=SE(e),Z_e(i,Z$()?Reflect.construct(e,[],SE(i).constructor):e.apply(i,t))}function q_e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function H_e(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function SE(i){return SE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},SE(i)}function W_e(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&&H6(i,e)}function Z$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Z$=function(){return!!i})()}function j_e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function X_e(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 $_e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4125+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Y_e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4126+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Z_e(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 z_e(i)}function H6(i,e){return H6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},H6(i,e)}function Ah(i,e){return k_e(i)||X_e(i,e)||K$(i,e)||$_e()}function V6(i){return G_e(i)||j_e(i)||K$(i)||Y_e()}function K$(i,e){if(i){if(typeof i=="string")return q6(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)?q6(i,e):void 0}}function K_e(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=Q_e(i,n),s=lh(r),o=J_e(i,n),a=[].concat(V6(s),V6(o)),l={type:"Polygon",coordinates:i},c=U3(l),u=Ah(c,2),f=Ah(u[0],2),p=f[0],x=f[1],v=Ah(u[1],2),w=v[0],S=v[1],T=p>w||S>=89||x<=-89,P=[];if(T){var R=z6(a).triangles(),C=new Map(a.map(function(ee,ae){var ce=Ah(ee,2),de=ce[0],ve=ce[1];return["".concat(de,"-").concat(ve),ae]}));R.features.forEach(function(ee){var ae,ce=ee.geometry.coordinates[0].slice(0,3).reverse(),de=[];if(ce.forEach(function(Ie){var Qe=Ah(Ie,2),Ue=Qe[0],mt=Qe[1],Me="".concat(Ue,"-").concat(mt);C.has(Me)&&de.push(C.get(Me))}),de.length===3){if(de.some(function(Ie){return Ie<s.length})){var ve=ee.properties.circumcenter;if(!W6(ve,l,T))return}(ae=P).push.apply(ae,de)}})}else if(o.length)for(var B=jp.from(a),z=function(ae){var ce,de=[2,1,0].map(function(Qe){return B.triangles[ae+Qe]}),ve=de.map(function(Qe){return a[Qe]});if(de.some(function(Qe){return Qe<s.length})){var Ie=[0,1].map(function(Qe){return y3(ve,function(Ue){return Ue[Qe]})});if(!W6(Ie,l,T))return 1}(ce=P).push.apply(ce,V6(de))},V=0,H=B.triangles.length;V<H;V+=3)z(V);else{var L=Z_(r),D=L.vertices,F=L.holes,N=F===void 0?[]:F;P=y6(D,N,2)}var Z=Ya(Up(a,function(ee){return ee[0]}),[0,1]),J=Ya(Up(a,function(ee){return ee[1]}),[0,1]),j=a.map(function(ee){var ae=Ah(ee,2),ce=ae[0],de=ae[1];return[Z(ce),J(de)]}),K={points:a,indices:P,uvs:j};return{contour:r,triangles:K}}function Q_e(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var o=Ka(s,r)*180/Math.PI;if(o>e)for(var a=lm(r,s),l=1/Math.ceil(o/e),c=l;c<1;)n.push(a(c)),c+=l}n.push(r=s)}),n})}function J_e(i,e){var t={type:"Polygon",coordinates:i},n=U3(t),r=Ah(n,2),s=Ah(r[0],2),o=s[0],a=s[1],l=Ah(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 e1e(e,{minLng:o,maxLng:c,minLat:a,maxLat:u}).filter(function(p){return W6(p,t,f)})}function e1e(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],p=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},x=[],v=f[0];v<=f[1];v++){var w=l(v);p(w)&&x.push([w,c(v)])}return x}function W6(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?YD(e,i):V$(i,e)}var wE=window.THREE?window.THREE:{BufferGeometry:qn,Float32BufferAttribute:Rn},Y$=new wE.BufferGeometry().setAttribute?"setAttribute":"addAttribute",TE=(function(i){function e(t,n,r,s,o,a,l){var c;q_e(this,e),c=V_e(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=K_e(t,{resolution:l}),f=u.contour,p=u.triangles,x=lh(p.uvs),v=[],w=[],S=[],T=0,P=function(F){var N=Math.round(v.length/3),B=S.length;v=v.concat(F.vertices),w=w.concat(F.uvs),S=S.concat(N?F.indices.map(function(z){return z+N}):F.indices),c.addGroup(B,S.length-B,T++)};a&&P(C()),s&&P(L(n,!1)),o&&P(L(r,!0)),c.setIndex(S),c[Y$]("position",new wE.Float32BufferAttribute(v,3)),c[Y$]("uv",new wE.Float32BufferAttribute(w,2)),c.computeVertexNormals();function R(D,F){var N=typeof F=="function"?F:function(){return F},B=D.map(function(z){return z.map(function(V){var H=Ah(V,2),Z=H[0],J=H[1];return t1e(J,Z,N(Z,J))})});return Z_(B)}function C(){for(var D=R(f,n),F=D.vertices,N=D.holes,B=R(f,r),z=B.vertices,V=lh([z,F]),H=Math.round(z.length/3),Z=new Set(N),J=0,j=[],K=0;K<H;K++){var ee=K+1;if(ee===H)ee=J;else if(Z.has(ee)){var ae=ee;ee=J,J=ae}j.push(K,K+H,ee+H),j.push(ee+H,ee,K)}for(var ce=[],de=1;de>=0;de--)for(var ve=0;ve<H;ve+=1)ce.push(ve/(H-1),de);return{indices:j,vertices:V,uvs:ce}}function L(D){var F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return{indices:F?p.indices:p.indices.slice().reverse(),vertices:R([p.points],D).vertices,uvs:x}}return c}return W_e(e,i),H_e(e)})(wE.BufferGeometry);function t1e(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 j6(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 n1e(i){if(Array.isArray(i))return i}function i1e(i){if(Array.isArray(i))return j6(i)}function r1e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function s1e(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 o1e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.4127+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function a1e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.4128+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function l1e(i,e){if(i==null)return{};var t,n,r=c1e(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 c1e(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 u1e(i,e){return n1e(i)||s1e(i,e)||Q$(i,e)||o1e()}function h1e(i){return i1e(i)||r1e(i)||Q$(i)||a1e()}function f1e(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 d1e(i){var e=f1e(i,"string");return typeof e=="symbol"?e:e+""}function Q$(i,e){if(i){if(typeof i=="string")return j6(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)?j6(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,p){var x=f.keyAccessor,v=f.isProp,w;if(v){var S=u,T=S[x],P=l1e(S,[x].map(d1e));w=T,u=P}else w=x(u,p);p+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=u1e(u,2),p=f[0],x=f[1];return a(x,[].concat(h1e(c),[p]))})})(s),e instanceof Array&&e.length===0&&o.length===1&&(o[0].keys=[])),o});var fi=(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(Ne){return e.locateFile?e.locateFile(Ne,s):s+Ne}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(nt,It,He){var h=new XMLHttpRequest;h.open("GET",nt,!0),h.responseType="arraybuffer",h.onload=function(){if(h.status==200||h.status==0&&h.response){It(h.response);return}var wi=wt(nt);if(wi){It(wi.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(Ne){u=Ne},p=function(){return u},x=8;function v(Ne,nt,It,He){switch(It=It||"i8",It.charAt(It.length-1)==="*"&&(It="i32"),It){case"i1":J[Ne>>0]=nt;break;case"i8":J[Ne>>0]=nt;break;case"i16":K[Ne>>1]=nt;break;case"i32":ae[Ne>>2]=nt;break;case"i64":Ve=[nt>>>0,(Pe=nt,+vt(Pe)>=1?Pe>0?(Kt(+ln(Pe/4294967296),4294967295)|0)>>>0:~~+yt((Pe-+(~~Pe>>>0))/4294967296)>>>0:0)],ae[Ne>>2]=Ve[0],ae[Ne+4>>2]=Ve[1];break;case"float":de[Ne>>2]=nt;break;case"double":ve[Ne>>3]=nt;break;default:I0("invalid type for setValue: "+It)}}function w(Ne,nt,It){switch(nt=nt||"i8",nt.charAt(nt.length-1)==="*"&&(nt="i32"),nt){case"i1":return J[Ne>>0];case"i8":return J[Ne>>0];case"i16":return K[Ne>>1];case"i32":return ae[Ne>>2];case"i64":return ae[Ne>>2];case"float":return de[Ne>>2];case"double":return ve[Ne>>3];default:I0("invalid type for getValue: "+nt)}return null}var S=!1;function T(Ne,nt){Ne||I0("Assertion failed: "+nt)}function P(Ne){var nt=e["_"+Ne];return T(nt,"Cannot call unknown function "+Ne+", make sure it is exported"),nt}function R(Ne,nt,It,He,h){var Xi={string:function(Qn){var Ni=0;if(Qn!=null&&Qn!==0){var $b=(Qn.length<<2)+1;Ni=s9($b),B(Qn,Ni,$b)}return Ni},array:function(Qn){var Ni=s9(Qn.length);return V(Qn,Ni),Ni}};function wi(Qn){return nt==="string"?F(Qn):nt==="boolean"?!!Qn:Qn}var ne=P(Ne),$i=[],Da=0;if(He)for(var js=0;js<He.length;js++){var Ls=Xi[It[js]];Ls?(Da===0&&(Da=nre()),$i[js]=Ls(He[js])):$i[js]=He[js]}var is=ne.apply(null,$i);return is=wi(is),Da!==0&&tre(Da),is}function C(Ne,nt,It,He){It=It||[];var h=It.every(function(wi){return wi==="number"}),Xi=nt!=="string";return Xi&&h&&!He?P(Ne):function(){return R(Ne,nt,It,arguments,He)}}var L=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function D(Ne,nt,It){for(var He=nt+It,h=nt;Ne[h]&&!(h>=He);)++h;if(h-nt>16&&Ne.subarray&&L)return L.decode(Ne.subarray(nt,h));for(var Xi="";nt<h;){var wi=Ne[nt++];if(!(wi&128)){Xi+=String.fromCharCode(wi);continue}var ne=Ne[nt++]&63;if((wi&224)==192){Xi+=String.fromCharCode((wi&31)<<6|ne);continue}var $i=Ne[nt++]&63;if((wi&240)==224?wi=(wi&15)<<12|ne<<6|$i:wi=(wi&7)<<18|ne<<12|$i<<6|Ne[nt++]&63,wi<65536)Xi+=String.fromCharCode(wi);else{var Da=wi-65536;Xi+=String.fromCharCode(55296|Da>>10,56320|Da&1023)}}return Xi}function F(Ne,nt){return Ne?D(j,Ne,nt):""}function N(Ne,nt,It,He){if(!(He>0))return 0;for(var h=It,Xi=It+He-1,wi=0;wi<Ne.length;++wi){var ne=Ne.charCodeAt(wi);if(ne>=55296&&ne<=57343){var $i=Ne.charCodeAt(++wi);ne=65536+((ne&1023)<<10)|$i&1023}if(ne<=127){if(It>=Xi)break;nt[It++]=ne}else if(ne<=2047){if(It+1>=Xi)break;nt[It++]=192|ne>>6,nt[It++]=128|ne&63}else if(ne<=65535){if(It+2>=Xi)break;nt[It++]=224|ne>>12,nt[It++]=128|ne>>6&63,nt[It++]=128|ne&63}else{if(It+3>=Xi)break;nt[It++]=240|ne>>18,nt[It++]=128|ne>>12&63,nt[It++]=128|ne>>6&63,nt[It++]=128|ne&63}}return nt[It]=0,It-h}function B(Ne,nt,It){return N(Ne,j,nt,It)}var z=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function V(Ne,nt){J.set(Ne,nt)}function H(Ne,nt){return Ne%nt>0&&(Ne+=nt-Ne%nt),Ne}var Z,J,j,K,ee,ae,ce,de,ve;function Ie(Ne){Z=Ne,e.HEAP8=J=new Int8Array(Ne),e.HEAP16=K=new Int16Array(Ne),e.HEAP32=ae=new Int32Array(Ne),e.HEAPU8=j=new Uint8Array(Ne),e.HEAPU16=ee=new Uint16Array(Ne),e.HEAPU32=ce=new Uint32Array(Ne),e.HEAPF32=de=new Float32Array(Ne),e.HEAPF64=ve=new Float64Array(Ne)}var Qe=5271296,Ue=28384,mt=e.TOTAL_MEMORY||33554432;e.buffer?Z=e.buffer:Z=new ArrayBuffer(mt),mt=Z.byteLength,Ie(Z),ae[Ue>>2]=Qe;function Me(Ne){for(;Ne.length>0;){var nt=Ne.shift();if(typeof nt=="function"){nt();continue}var It=nt.func;typeof It=="number"?nt.arg===void 0?e.dynCall_v(It):e.dynCall_vi(It,nt.arg):It(nt.arg===void 0?null:nt.arg)}}var ze=[],$e=[],Et=[],Tt=[];function Ct(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)st(e.preRun.shift());Me(ze)}function un(){Me($e)}function Gt(){Me(Et)}function Xe(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)tt(e.postRun.shift());Me(Tt)}function st(Ne){ze.unshift(Ne)}function tt(Ne){Tt.unshift(Ne)}var vt=Math.abs,yt=Math.ceil,ln=Math.floor,Kt=Math.min,Qt=0,xn=null,ge=null;function pi(Ne){Qt++,e.monitorRunDependencies&&e.monitorRunDependencies(Qt)}function Bn(Ne){if(Qt--,e.monitorRunDependencies&&e.monitorRunDependencies(Qt),Qt==0&&(xn!==null&&(clearInterval(xn),xn=null),ge)){var nt=ge;ge=null,nt()}}e.preloadedImages={},e.preloadedAudios={};var le=null,X="data:application/octet-stream;base64,";function Te(Ne){return String.prototype.startsWith?Ne.startsWith(X):Ne.indexOf(X)===0}var Pe,Ve;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 gt=28400;function St(Ne){return Ne}function qe(Ne){var nt=/\b__Z[\w\d_]+/g;return Ne.replace(nt,function(It){var He=It;return It===He?It:He+" ["+It+"]"})}function Ke(){var Ne=new Error;if(!Ne.stack){try{throw new Error(0)}catch(nt){Ne=nt}if(!Ne.stack)return"(no stack trace available)"}return Ne.stack.toString()}function Rt(){var Ne=Ke();return e.extraStackTrace&&(Ne+=`4129+`+e.extraStackTrace()),qe(Ne)}function en(Ne,nt,It,He){I0("Assertion failed: "+F(Ne)+", at: "+[nt?F(nt):"unknown filename",It,He?F(He):"unknown function"])}function Pt(){return J.length}function Mt(Ne,nt,It){j.set(j.subarray(nt,nt+It),Ne)}function cn(Ne){return e.___errno_location&&(ae[e.___errno_location()>>2]=Ne),Ne}function yn(Ne){I0("OOM")}function Pn(Ne){try{var nt=new ArrayBuffer(Ne);return nt.byteLength!=Ne?void 0:(new Int8Array(nt).set(J),tn(nt),Ie(nt),1)}catch{}}function xe(Ne){var nt=Pt(),It=16777216,He=2147483648-It;if(Ne>He)return!1;for(var h=16777216,Xi=Math.max(nt,h);Xi<Ne;)Xi<=536870912?Xi=H(2*Xi,It):Xi=Math.min(H((3*Xi+2147483648)/4,It),He);var wi=Pn(Xi);return!!wi}var bt=typeof atob=="function"?atob:function(Ne){var nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",It="",He,h,Xi,wi,ne,$i,Da,js=0;Ne=Ne.replace(/[^A-Za-z0-9\+\/\=]/g,"");do wi=nt.indexOf(Ne.charAt(js++)),ne=nt.indexOf(Ne.charAt(js++)),$i=nt.indexOf(Ne.charAt(js++)),Da=nt.indexOf(Ne.charAt(js++)),He=wi<<2|ne>>4,h=(ne&15)<<4|$i>>2,Xi=($i&3)<<6|Da,It=It+String.fromCharCode(He),$i!==64&&(It=It+String.fromCharCode(h)),Da!==64&&(It=It+String.fromCharCode(Xi));while(js<Ne.length);return It};function Ye(Ne){try{for(var nt=bt(Ne),It=new Uint8Array(nt.length),He=0;He<nt.length;++He)It[He]=nt.charCodeAt(He);return It}catch{throw new Error("Converting base64 string to bytes failed.")}}function wt(Ne){if(Te(Ne))return Ye(Ne.slice(X.length))}var Dt={Math,Int8Array,Int32Array,Uint8Array,Float32Array,Float64Array},ct={a:I0,b:f,c:p,d:en,e:cn,f:Pt,g:Mt,h:xe,i:yn,j:St,k:qe,l:Pn,m:Ke,n:Rt,o:gt,p:Ue},Ce=(function(Ne,nt,It){"almost asm";var He=new Ne.Int8Array(It),h=new Ne.Int32Array(It),Xi=new Ne.Uint8Array(It),wi=new Ne.Float32Array(It),ne=new Ne.Float64Array(It),$i=nt.o|0,Da=nt.p|0,js=Ne.Math.floor,Ls=Ne.Math.abs,is=Ne.Math.sqrt,Qn=Ne.Math.cos,Ni=Ne.Math.sin,$b=Ne.Math.tan,ire=Ne.Math.acos,ox=Ne.Math.asin,c9=Ne.Math.atan,ia=Ne.Math.atan2,ng=Ne.Math.ceil,Fa=Ne.Math.imul,v4=Ne.Math.min,rre=Ne.Math.max,Zh=Ne.Math.clz32,sre=nt.a,Dn=nt.b,Q=nt.c,ci=nt.d,u9=nt.e,ore=nt.f,are=nt.g,lre=nt.h,cre=nt.i,Y=28416;function ure(d){return He=new Int8Array(d),Xi=new Uint8Array(d),h=new Int32Array(d),wi=new Float32Array(d),ne=new Float64Array(d),It=d,!0}function hre(d){d=d|0;var A=0;return A=Y,Y=Y+d|0,Y=Y+15&-16,A|0}function fre(){return Y|0}function dre(d){d=d|0,Y=d}function pre(d,A){d=d|0,A=A|0,Y=d}function Are(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;return(d|0)<0?(A=2,A|0):(d|0)>13780509?(A=Qb(15,A)|0,A|0):(m=((d|0)<0)<<31>>31,g=cr(d|0,m|0,3,0)|0,_=Q()|0,m=pt(d|0,m|0,1,0)|0,m=cr(g|0,_|0,m|0,Q()|0)|0,m=pt(m|0,Q()|0,1,0)|0,d=Q()|0,h[A>>2]=m,h[A+4>>2]=d,A=0,A|0)}function h9(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,f9(d,A,m,_,0)|0}function f9(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0;if(M=Y,Y=Y+16|0,b=M,!(d9(d,A,m,_,g)|0))return _=0,Y=M,_|0;do if((m|0)>=0){if((m|0)>13780509){if(y=Qb(15,b)|0,y|0)break;E=b,b=h[E>>2]|0,E=h[E+4>>2]|0}else y=((m|0)<0)<<31>>31,I=cr(m|0,y|0,3,0)|0,E=Q()|0,y=pt(m|0,y|0,1,0)|0,y=cr(I|0,E|0,y|0,Q()|0)|0,y=pt(y|0,Q()|0,1,0)|0,E=Q()|0,h[b>>2]=y,h[b+4>>2]=E,b=y;if(fd(_|0,0,b<<3|0)|0,g|0){fd(g|0,0,b<<2|0)|0,y=mu(d,A,m,_,g,b,E,0)|0;break}y=ra(b,4)|0,y?(I=mu(d,A,m,_,y,b,E,0)|0,_t(y),y=I):y=13}else y=2;while(!1);return I=y,Y=M,I|0}function d9(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0;if(oe=Y,Y=Y+16|0,W=oe,$=oe+8|0,q=W,h[q>>2]=d,h[q+4>>2]=A,(m|0)<0)return $=2,Y=oe,$|0;if(y=_,h[y>>2]=d,h[y+4>>2]=A,y=(g|0)!=0,y&&(h[g>>2]=0),ki(d,A)|0)return $=9,Y=oe,$|0;h[$>>2]=0;e:do if((m|0)>=1)if(y)for(O=1,I=0,G=0,q=1,y=d;;){if(!(I|G)){if(y=Ds(y,A,4,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,ki(y,A)|0){y=9;break e}}if(y=Ds(y,A,h[26864+(G<<2)>>2]|0,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,d=_+(O<<3)|0,h[d>>2]=y,h[d+4>>2]=A,h[g+(O<<2)>>2]=q,d=I+1|0,b=(d|0)==(q|0),E=G+1|0,M=(E|0)==6,ki(y,A)|0){y=9;break e}if(q=q+(M&b&1)|0,(q|0)>(m|0)){y=0;break}else O=O+1|0,I=b?0:d,G=b?M?0:E:G}else for(O=1,I=0,G=0,q=1,y=d;;){if(!(I|G)){if(y=Ds(y,A,4,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,ki(y,A)|0){y=9;break e}}if(y=Ds(y,A,h[26864+(G<<2)>>2]|0,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,d=_+(O<<3)|0,h[d>>2]=y,h[d+4>>2]=A,d=I+1|0,b=(d|0)==(q|0),E=G+1|0,M=(E|0)==6,ki(y,A)|0){y=9;break e}if(q=q+(M&b&1)|0,(q|0)>(m|0)){y=0;break}else O=O+1|0,I=b?0:d,G=b?M?0:E:G}else y=0;while(!1);return $=y,Y=oe,$|0}function mu(d,A,m,_,g,y,b,E){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0,E=E|0;var M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0;if(oe=Y,Y=Y+16|0,W=oe+8|0,$=oe,M=Kh(d|0,A|0,y|0,b|0)|0,O=Q()|0,G=_+(M<<3)|0,ue=G,_e=h[ue>>2]|0,ue=h[ue+4>>2]|0,I=(_e|0)==(d|0)&(ue|0)==(A|0),!((_e|0)==0&(ue|0)==0|I))do M=pt(M|0,O|0,1,0)|0,M=hd(M|0,Q()|0,y|0,b|0)|0,O=Q()|0,G=_+(M<<3)|0,_e=G,ue=h[_e>>2]|0,_e=h[_e+4>>2]|0,I=(ue|0)==(d|0)&(_e|0)==(A|0);while(!((ue|0)==0&(_e|0)==0|I));if(M=g+(M<<2)|0,I&&(h[M>>2]|0)<=(E|0)||(_e=G,h[_e>>2]=d,h[_e+4>>2]=A,h[M>>2]=E,(E|0)>=(m|0)))return _e=0,Y=oe,_e|0;switch(I=E+1|0,h[W>>2]=0,M=Ds(d,A,2,W,$)|0,M|0){case 9:{q=9;break}case 0:{M=$,M=mu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M||(q=9);break}default:}e:do if((q|0)==9){switch(h[W>>2]=0,M=Ds(d,A,3,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=mu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}switch(h[W>>2]=0,M=Ds(d,A,1,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=mu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}switch(h[W>>2]=0,M=Ds(d,A,5,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=mu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}switch(h[W>>2]=0,M=Ds(d,A,4,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=mu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}switch(h[W>>2]=0,M=Ds(d,A,6,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=mu(h[M>>2]|0,h[M+4>>2]|0,m,_,g,y,b,I)|0,M|0)break e;break}default:break e}return _e=0,Y=oe,_e|0}while(!1);return _e=M,Y=oe,_e|0}function Ds(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if(m>>>0>6)return g=1,g|0;b=(h[_>>2]|0)%6|0,h[_>>2]=b;e:do if((b|0)>0)for(y=0;;){switch(m|0){case 1:{m=5;break}case 5:{m=4;break}case 4:{m=6;break}case 6:{m=2;break}case 2:{m=3;break}case 3:{m=1;break}default:}if(y=y+1|0,(y|0)==(b|0))break e}while(!1);if(G=et(d|0,A|0,45)|0,Q()|0,O=G&127,O>>>0>121)return g=5,g|0;M=Oa(d,A)|0,y=et(d|0,A|0,52)|0,Q()|0,y=y&15;e:do if(!y)I=15;else{for(;;){if(b=(15-y|0)*3|0,E=et(d|0,A|0,b|0)|0,Q()|0,E=E&7,(E|0)==7){A=5;break}if($=(zl(y)|0)==0,y=y+-1|0,q=ht(7,0,b|0)|0,A=A&~(Q()|0),W=ht(h[($?432:16)+(E*28|0)+(m<<2)>>2]|0,0,b|0)|0,b=Q()|0,m=h[($?640:224)+(E*28|0)+(m<<2)>>2]|0,d=W|d&~q,A=b|A,!m){m=0;break e}if(!y){I=15;break e}}return A|0}while(!1);(I|0)==15&&($=h[848+(O*28|0)+(m<<2)>>2]|0,W=ht($|0,0,45)|0,d=W|d,A=Q()|0|A&-1040385,m=h[4272+(O*28|0)+(m<<2)>>2]|0,($&127|0)==127&&($=ht(h[848+(O*28|0)+20>>2]|0,0,45)|0,A=Q()|0|A&-1040385,m=h[4272+(O*28|0)+20>>2]|0,d=N0($|d,A)|0,A=Q()|0,h[_>>2]=(h[_>>2]|0)+1)),E=et(d|0,A|0,45)|0,Q()|0,E=E&127;e:do if(ar(E)|0){t:do if((Oa(d,A)|0)==1){if((O|0)!=(E|0))if(g9(E,h[7696+(O*28|0)>>2]|0)|0){d=L4(d,A)|0,b=1,A=Q()|0;break}else ci(27634,26928,533,26936);switch(M|0){case 3:{d=N0(d,A)|0,A=Q()|0,h[_>>2]=(h[_>>2]|0)+1,b=0;break t}case 5:{d=L4(d,A)|0,A=Q()|0,h[_>>2]=(h[_>>2]|0)+5,b=0;break t}case 0:return $=9,$|0;default:return $=1,$|0}}else b=0;while(!1);if((m|0)>0){y=0;do d=N4(d,A)|0,A=Q()|0,y=y+1|0;while((y|0)!=(m|0))}if((O|0)!=(E|0)){if(!(b4(E)|0)){if((b|0)!=0|(Oa(d,A)|0)!=5)break;h[_>>2]=(h[_>>2]|0)+1;break}switch(G&127){case 8:case 118:break e;default:}(Oa(d,A)|0)!=3&&(h[_>>2]=(h[_>>2]|0)+1)}}else if((m|0)>0){y=0;do d=N0(d,A)|0,A=Q()|0,y=y+1|0;while((y|0)!=(m|0))}while(!1);return h[_>>2]=((h[_>>2]|0)+m|0)%6|0,$=g,h[$>>2]=d,h[$+4>>2]=A,$=0,$|0}function mre(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,p9(d,A,m,_)|0?(fd(_|0,0,m*48|0)|0,_=gre(d,A,m,_)|0,_|0):(_=0,_|0)}function p9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if($=Y,Y=Y+16|0,q=$,W=$+8|0,G=q,h[G>>2]=d,h[G+4>>2]=A,(m|0)<0)return W=2,Y=$,W|0;if(!m)return W=_,h[W>>2]=d,h[W+4>>2]=A,W=0,Y=$,W|0;h[W>>2]=0;e:do if(ki(d,A)|0)d=9;else{g=0,G=d;do{if(d=Ds(G,A,4,W,q)|0,d|0)break e;if(A=q,G=h[A>>2]|0,A=h[A+4>>2]|0,g=g+1|0,ki(G,A)|0){d=9;break e}}while((g|0)<(m|0));O=_,h[O>>2]=G,h[O+4>>2]=A,O=m+-1|0,I=0,d=1;do{if(g=26864+(I<<2)|0,(I|0)==5)for(b=h[g>>2]|0,y=0,g=d;;){if(d=q,d=Ds(h[d>>2]|0,h[d+4>>2]|0,b,W,q)|0,d|0)break e;if((y|0)!=(O|0))if(M=q,E=h[M>>2]|0,M=h[M+4>>2]|0,d=_+(g<<3)|0,h[d>>2]=E,h[d+4>>2]=M,!(ki(E,M)|0))d=g+1|0;else{d=9;break e}else d=g;if(y=y+1|0,(y|0)>=(m|0))break;g=d}else for(b=q,M=h[g>>2]|0,E=0,g=d,y=h[b>>2]|0,b=h[b+4>>2]|0;;){if(d=Ds(y,b,M,W,q)|0,d|0)break e;if(b=q,y=h[b>>2]|0,b=h[b+4>>2]|0,d=_+(g<<3)|0,h[d>>2]=y,h[d+4>>2]=b,d=g+1|0,ki(y,b)|0){d=9;break e}if(E=E+1|0,(E|0)>=(m|0))break;g=d}I=I+1|0}while(I>>>0<6);d=q,d=(G|0)==(h[d>>2]|0)&&(A|0)==(h[d+4>>2]|0)?0:9}while(!1);return W=d,Y=$,W|0}function gre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;if(G=Y,Y=Y+16|0,b=G,!m)return h[_>>2]=d,h[_+4>>2]=A,_=0,Y=G,_|0;do if((m|0)>=0){if((m|0)>13780509){if(g=Qb(15,b)|0,g|0)break;y=b,g=h[y>>2]|0,y=h[y+4>>2]|0}else g=((m|0)<0)<<31>>31,O=cr(m|0,g|0,3,0)|0,y=Q()|0,g=pt(m|0,g|0,1,0)|0,g=cr(O|0,y|0,g|0,Q()|0)|0,g=pt(g|0,Q()|0,1,0)|0,y=Q()|0,O=b,h[O>>2]=g,h[O+4>>2]=y;if(I=ra(g,8)|0,!I)g=13;else{if(O=ra(g,4)|0,!O){_t(I),g=13;break}if(g=mu(d,A,m,I,O,g,y,0)|0,g|0){_t(I),_t(O);break}if(A=h[b>>2]|0,b=h[b+4>>2]|0,(b|0)>0|(b|0)==0&A>>>0>0){g=0,E=0,M=0;do d=I+(E<<3)|0,y=h[d>>2]|0,d=h[d+4>>2]|0,!((y|0)==0&(d|0)==0)&&(h[O+(E<<2)>>2]|0)==(m|0)&&(q=_+(g<<3)|0,h[q>>2]=y,h[q+4>>2]=d,g=g+1|0),E=pt(E|0,M|0,1,0)|0,M=Q()|0;while((M|0)<(b|0)|(M|0)==(b|0)&E>>>0<A>>>0)}_t(I),_t(O),g=0}}else g=2;while(!1);return q=g,Y=G,q|0}function Yb(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;for(E=Y,Y=Y+16|0,y=E,b=E+8|0,g=(ki(d,A)|0)==0,g=g?1:2;;){if(h[b>>2]=0,I=(Ds(d,A,g,b,y)|0)==0,M=y,I&((h[M>>2]|0)==(m|0)?(h[M+4>>2]|0)==(_|0):0)){d=4;break}if(g=g+1|0,g>>>0>=7){g=7,d=4;break}}return(d|0)==4?(Y=E,g|0):0}function _re(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;if(E=Y,Y=Y+48|0,g=E+16|0,y=E+8|0,b=E,m=px(m)|0,m|0)return b=m,Y=E,b|0;if(I=d,M=h[I+4>>2]|0,m=y,h[m>>2]=h[I>>2],h[m+4>>2]=M,F9(y,g),m=v9(g,A,b)|0,!m){if(A=h[y>>2]|0,y=h[d+8>>2]|0,(y|0)>0){g=h[d+12>>2]|0,m=0;do A=(h[g+(m<<3)>>2]|0)+A|0,m=m+1|0;while((m|0)<(y|0))}m=b,g=h[m>>2]|0,m=h[m+4>>2]|0,y=((A|0)<0)<<31>>31,(m|0)<(y|0)|(m|0)==(y|0)&g>>>0<A>>>0?(m=b,h[m>>2]=A,h[m+4>>2]=y,m=y):A=g,M=pt(A|0,m|0,12,0)|0,I=Q()|0,m=b,h[m>>2]=M,h[m+4>>2]=I,m=_,h[m>>2]=M,h[m+4>>2]=I,m=0}return I=m,Y=E,I|0}function A9(d,A,m,_,g,y,b){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0;var E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0,ui=0,gi=0,lo=0,Un=0,_i=0,sa=0;if(gi=Y,Y=Y+64|0,Ot=gi+48|0,at=gi+32|0,dt=gi+24|0,Fe=gi+8|0,Ze=gi,M=h[d>>2]|0,(M|0)<=0)return ui=0,Y=gi,ui|0;for(Ee=d+4|0,ye=Ot+8|0,At=at+8|0,We=Fe+8|0,E=0,be=0;;){I=h[Ee>>2]|0,re=I+(be<<4)|0,h[Ot>>2]=h[re>>2],h[Ot+4>>2]=h[re+4>>2],h[Ot+8>>2]=h[re+8>>2],h[Ot+12>>2]=h[re+12>>2],(be|0)==(M+-1|0)?(h[at>>2]=h[I>>2],h[at+4>>2]=h[I+4>>2],h[at+8>>2]=h[I+8>>2],h[at+12>>2]=h[I+12>>2]):(re=I+(be+1<<4)|0,h[at>>2]=h[re>>2],h[at+4>>2]=h[re+4>>2],h[at+8>>2]=h[re+8>>2],h[at+12>>2]=h[re+12>>2]),M=Lre(Ot,at,_,dt)|0;e:do if(M)I=0,E=M;else if(M=dt,I=h[M>>2]|0,M=h[M+4>>2]|0,(M|0)>0|(M|0)==0&I>>>0>0){_e=0,re=0;t:for(;;){if(Un=1/(+(I>>>0)+4294967296*+(M|0)),sa=+ne[Ot>>3],M=Fs(I|0,M|0,_e|0,re|0)|0,_i=+(M>>>0)+4294967296*+(Q()|0),lo=+(_e>>>0)+4294967296*+(re|0),ne[Fe>>3]=Un*(sa*_i)+Un*(+ne[at>>3]*lo),ne[We>>3]=Un*(+ne[ye>>3]*_i)+Un*(+ne[At>>3]*lo),M=D4(Fe,_,Ze)|0,M|0){E=M;break}ue=Ze,oe=h[ue>>2]|0,ue=h[ue+4>>2]|0,q=Kh(oe|0,ue|0,A|0,m|0)|0,O=Q()|0,M=b+(q<<3)|0,G=M,I=h[G>>2]|0,G=h[G+4>>2]|0;n:do if((I|0)==0&(G|0)==0)me=M,ui=16;else for(W=0,$=0;;){if((W|0)>(m|0)|(W|0)==(m|0)&$>>>0>A>>>0){E=1;break t}if((I|0)==(oe|0)&(G|0)==(ue|0))break n;if(M=pt(q|0,O|0,1,0)|0,q=hd(M|0,Q()|0,A|0,m|0)|0,O=Q()|0,$=pt($|0,W|0,1,0)|0,W=Q()|0,M=b+(q<<3)|0,G=M,I=h[G>>2]|0,G=h[G+4>>2]|0,(I|0)==0&(G|0)==0){me=M,ui=16;break}}while(!1);if((ui|0)==16&&(ui=0,!((oe|0)==0&(ue|0)==0))&&($=me,h[$>>2]=oe,h[$+4>>2]=ue,$=y+(h[g>>2]<<3)|0,h[$>>2]=oe,h[$+4>>2]=ue,$=g,$=pt(h[$>>2]|0,h[$+4>>2]|0,1,0)|0,oe=Q()|0,ue=g,h[ue>>2]=$,h[ue+4>>2]=oe),_e=pt(_e|0,re|0,1,0)|0,re=Q()|0,M=dt,I=h[M>>2]|0,M=h[M+4>>2]|0,!((M|0)>(re|0)|(M|0)==(re|0)&I>>>0>_e>>>0)){I=1;break e}}I=0}else I=1;while(!1);if(be=be+1|0,!I){ui=21;break}if(M=h[d>>2]|0,(be|0)>=(M|0)){E=0,ui=21;break}}return(ui|0)==21?(Y=gi,E|0):0}function xre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0,ui=0,gi=0,lo=0,Un=0,_i=0;if(_i=Y,Y=Y+112|0,ui=_i+80|0,M=_i+72|0,gi=_i,lo=_i+56|0,g=px(m)|0,g|0)return Un=g,Y=_i,Un|0;if(I=d+8|0,Un=lr((h[I>>2]<<5)+32|0)|0,!Un)return Un=13,Y=_i,Un|0;if(z4(d,Un),g=px(m)|0,!g){if(at=d,dt=h[at+4>>2]|0,g=M,h[g>>2]=h[at>>2],h[g+4>>2]=dt,F9(M,ui),g=v9(ui,A,gi)|0,g)at=0,dt=0;else{if(g=h[M>>2]|0,y=h[I>>2]|0,(y|0)>0){b=h[d+12>>2]|0,m=0;do g=(h[b+(m<<3)>>2]|0)+g|0,m=m+1|0;while((m|0)!=(y|0));m=g}else m=g;g=gi,y=h[g>>2]|0,g=h[g+4>>2]|0,b=((m|0)<0)<<31>>31,(g|0)<(b|0)|(g|0)==(b|0)&y>>>0<m>>>0?(g=gi,h[g>>2]=m,h[g+4>>2]=b,g=b):m=y,at=pt(m|0,g|0,12,0)|0,dt=Q()|0,g=gi,h[g>>2]=at,h[g+4>>2]=dt,g=0}if(!g){if(m=ra(at,8)|0,!m)return _t(Un),Un=13,Y=_i,Un|0;if(E=ra(at,8)|0,!E)return _t(Un),_t(m),Un=13,Y=_i,Un|0;We=ui,h[We>>2]=0,h[We+4>>2]=0,We=d,Ot=h[We+4>>2]|0,g=M,h[g>>2]=h[We>>2],h[g+4>>2]=Ot,g=A9(M,at,dt,A,ui,m,E)|0;e:do if(g)_t(m),_t(E),_t(Un);else{t:do if((h[I>>2]|0)>0){for(b=d+12|0,y=0;g=A9((h[b>>2]|0)+(y<<3)|0,at,dt,A,ui,m,E)|0,y=y+1|0,!(g|0);)if((y|0)>=(h[I>>2]|0))break t;_t(m),_t(E),_t(Un);break e}while(!1);(dt|0)>0|(dt|0)==0&at>>>0>0&&fd(E|0,0,at<<3|0)|0,Ot=ui,We=h[Ot+4>>2]|0;t:do if((We|0)>0|(We|0)==0&(h[Ot>>2]|0)>>>0>0){Ee=m,ye=E,At=m,We=E,Ot=m,g=m,me=m,Fe=E,Ze=E,m=E;n:for(;;){for(ue=0,_e=0,re=0,be=0,y=0,b=0;;){E=gi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));if(A=Ee+(ue<<3)|0,I=h[A>>2]|0,A=h[A+4>>2]|0,d9(I,A,1,gi,0)|0){E=gi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));E=ra(7,4)|0,E|0&&(mu(I,A,1,gi,E,7,0,0)|0,_t(E))}for(oe=0;;){$=gi+(oe<<3)|0,W=h[$>>2]|0,$=h[$+4>>2]|0;i:do if((W|0)==0&($|0)==0)E=y,M=b;else{if(O=Kh(W|0,$|0,at|0,dt|0)|0,I=Q()|0,E=_+(O<<3)|0,A=E,M=h[A>>2]|0,A=h[A+4>>2]|0,!((M|0)==0&(A|0)==0)){G=0,q=0;do{if((G|0)>(dt|0)|(G|0)==(dt|0)&q>>>0>at>>>0)break n;if((M|0)==(W|0)&(A|0)==($|0)){E=y,M=b;break i}E=pt(O|0,I|0,1,0)|0,O=hd(E|0,Q()|0,at|0,dt|0)|0,I=Q()|0,q=pt(q|0,G|0,1,0)|0,G=Q()|0,E=_+(O<<3)|0,A=E,M=h[A>>2]|0,A=h[A+4>>2]|0}while(!((M|0)==0&(A|0)==0))}if((W|0)==0&($|0)==0){E=y,M=b;break}sg(W,$,lo)|0,V4(d,Un,lo)|0&&(q=pt(y|0,b|0,1,0)|0,b=Q()|0,G=E,h[G>>2]=W,h[G+4>>2]=$,y=ye+(y<<3)|0,h[y>>2]=W,h[y+4>>2]=$,y=q),E=y,M=b}while(!1);if(oe=oe+1|0,oe>>>0>=7)break;y=E,b=M}if(ue=pt(ue|0,_e|0,1,0)|0,_e=Q()|0,re=pt(re|0,be|0,1,0)|0,be=Q()|0,b=ui,y=h[b>>2]|0,b=h[b+4>>2]|0,(be|0)<(b|0)|(be|0)==(b|0)&re>>>0<y>>>0)y=E,b=M;else break}if((b|0)>0|(b|0)==0&y>>>0>0){y=0,b=0;do be=Ee+(y<<3)|0,h[be>>2]=0,h[be+4>>2]=0,y=pt(y|0,b|0,1,0)|0,b=Q()|0,be=ui,re=h[be+4>>2]|0;while((b|0)<(re|0)|((b|0)==(re|0)?y>>>0<(h[be>>2]|0)>>>0:0))}if(be=ui,h[be>>2]=E,h[be+4>>2]=M,(M|0)>0|(M|0)==0&E>>>0>0)oe=m,ue=Ze,_e=Ot,re=Fe,be=ye,m=me,Ze=g,Fe=At,me=oe,g=ue,Ot=We,We=_e,At=re,ye=Ee,Ee=be;else break t}_t(At),_t(We),_t(Un),g=1;break e}else g=E;while(!1);_t(Un),_t(m),_t(g),g=0}while(!1);return Un=g,Y=_i,Un|0}}return _t(Un),Un=g,Y=_i,Un|0}function yre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0;if(E=Y,Y=Y+16|0,b=E,d=Fre(d,A,((A|0)<0)<<31>>31,b)|0,d|0)return b=d,Y=E,b|0;if(y=mse(b,m)|0,m=b+4|0,(h[b>>2]|0)>0){A=0;do{if(g=h[m>>2]|0,_=g+(A<<4)+4|0,_t(h[_>>2]|0),h[_>>2]=0,h[g+(A<<4)>>2]=0,_=g+(A<<4)+8|0,g=g+(A<<4)+12|0,(h[_>>2]|0)>0){d=0;do M=h[g>>2]|0,I=M+(d<<3)+4|0,_t(h[I>>2]|0),h[I>>2]=0,h[M+(d<<3)>>2]=0,d=d+1|0;while((d|0)<(h[_>>2]|0))}_t(h[g>>2]|0),h[g>>2]=0,h[_>>2]=0,A=A+1|0}while((A|0)<(h[b>>2]|0))}return _t(h[m>>2]|0),h[m>>2]=0,h[b>>2]=0,I=y,Y=E,I|0}function Gl(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;if(b=h[d>>2]|0,(b|0)<=0)return g=0,_=0,b=g<0,_=12.566370614359172-_,_=g+_,g=b?_:g,ne[A>>3]=g,0;if(y=h[d+4>>2]|0,d=(b|0)!=1&1,E=+ne[y>>3]*.5+.7853981633974483,g=+ne[y+(d<<4)>>3]*.5+.7853981633974483,m=+Ni(+E)*+Ni(+g),_=+ne[y+(d<<4)+8>>3]-+ne[y+8>>3],m=+ia(+(+Ni(+_)*m),+(+Qn(+E)*+Qn(+g)+ +Qn(+_)*m))*-2,_=m+0,m=_-m,(b|0)==1)return E=_,g=m,b=E<0,g=12.566370614359172-g,g=E+g,E=b?g:E,ne[A>>3]=E,0;for(d=1,g=_;O=d,d=d+1|0,G=(d|0)%(b|0)|0,I=+ne[y+(O<<4)>>3]*.5+.7853981633974483,M=+ne[y+(G<<4)>>3]*.5+.7853981633974483,_=+Ni(+I)*+Ni(+M),E=+ne[y+(G<<4)+8>>3]-+ne[y+(O<<4)+8>>3],m=+ia(+(+Ni(+E)*_),+(+Qn(+I)*+Qn(+M)+ +Qn(+E)*_))*-2-m,_=g+m,m=_-g-m,!((d|0)>=(b|0));)g=_;return G=_<0,I=12.566370614359172-m,I=_+I,I=G?I:_,ne[A>>3]=I,0}function vre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+192|0,_=b+176|0,g=b,y=b+168|0,d=L0(d,A,g)|0,d|0?(y=d,Y=b,y|0):(h[y>>2]=h[g>>2],h[y+4>>2]=g+8,h[_>>2]=h[y>>2],h[_+4>>2]=h[y+4>>2],Gl(_,m)|0,y=0,Y=b,y|0)}function bre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+192|0,_=b+176|0,g=b,y=b+168|0,d=L0(d,A,g)|0,d?(y=d,Y=b,y|0):(h[y>>2]=h[g>>2],h[y+4>>2]=g+8,h[_>>2]=h[y>>2],h[_+4>>2]=h[y+4>>2],Gl(_,m)|0,ne[m>>3]=+ne[m>>3]*4058973249931477e-8,y=0,Y=b,y|0)}function wre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+192|0,_=b+176|0,g=b,y=b+168|0,d=L0(d,A,g)|0,d?(y=d,Y=b,y|0):(h[y>>2]=h[g>>2],h[y+4>>2]=g+8,h[_>>2]=h[y>>2],h[_+4>>2]=h[y+4>>2],Gl(_,m)|0,ne[m>>3]=+ne[m>>3]*4058973249931477e-8*1e6,y=0,Y=b,y|0)}function ar(d){return d=d|0,d>>>0>121?(d=0,d|0):(d=h[7696+(d*28|0)+16>>2]|0,d|0)}function b4(d){return d=d|0,(d|0)==4|(d|0)==117|0}function m9(d){return d=d|0,h[11120+((h[d>>2]|0)*216|0)+((h[d+4>>2]|0)*72|0)+((h[d+8>>2]|0)*24|0)+(h[d+12>>2]<<3)>>2]|0}function Sre(d){return d=d|0,h[11120+((h[d>>2]|0)*216|0)+((h[d+4>>2]|0)*72|0)+((h[d+8>>2]|0)*24|0)+(h[d+12>>2]<<3)+4>>2]|0}function Tre(d,A){d=d|0,A=A|0,d=7696+(d*28|0)|0,h[A>>2]=h[d>>2],h[A+4>>2]=h[d+4>>2],h[A+8>>2]=h[d+8>>2],h[A+12>>2]=h[d+12>>2]}function Ere(d,A){d=d|0,A=A|0;var m=0,_=0;if(A>>>0>20)return A=-1,A|0;do if((h[11120+(A*216|0)>>2]|0)!=(d|0))if((h[11120+(A*216|0)+8>>2]|0)!=(d|0))if((h[11120+(A*216|0)+16>>2]|0)!=(d|0))if((h[11120+(A*216|0)+24>>2]|0)!=(d|0))if((h[11120+(A*216|0)+32>>2]|0)!=(d|0))if((h[11120+(A*216|0)+40>>2]|0)!=(d|0))if((h[11120+(A*216|0)+48>>2]|0)!=(d|0))if((h[11120+(A*216|0)+56>>2]|0)!=(d|0))if((h[11120+(A*216|0)+64>>2]|0)!=(d|0))if((h[11120+(A*216|0)+72>>2]|0)!=(d|0))if((h[11120+(A*216|0)+80>>2]|0)!=(d|0))if((h[11120+(A*216|0)+88>>2]|0)!=(d|0))if((h[11120+(A*216|0)+96>>2]|0)!=(d|0))if((h[11120+(A*216|0)+104>>2]|0)!=(d|0))if((h[11120+(A*216|0)+112>>2]|0)!=(d|0))if((h[11120+(A*216|0)+120>>2]|0)!=(d|0))if((h[11120+(A*216|0)+128>>2]|0)!=(d|0))if((h[11120+(A*216|0)+136>>2]|0)==(d|0))d=2,m=1,_=2;else{if((h[11120+(A*216|0)+144>>2]|0)==(d|0)){d=0,m=2,_=0;break}if((h[11120+(A*216|0)+152>>2]|0)==(d|0)){d=0,m=2,_=1;break}if((h[11120+(A*216|0)+160>>2]|0)==(d|0)){d=0,m=2,_=2;break}if((h[11120+(A*216|0)+168>>2]|0)==(d|0)){d=1,m=2,_=0;break}if((h[11120+(A*216|0)+176>>2]|0)==(d|0)){d=1,m=2,_=1;break}if((h[11120+(A*216|0)+184>>2]|0)==(d|0)){d=1,m=2,_=2;break}if((h[11120+(A*216|0)+192>>2]|0)==(d|0)){d=2,m=2,_=0;break}if((h[11120+(A*216|0)+200>>2]|0)==(d|0)){d=2,m=2,_=1;break}if((h[11120+(A*216|0)+208>>2]|0)==(d|0)){d=2,m=2,_=2;break}else d=-1;return d|0}else d=2,m=1,_=1;else d=2,m=1,_=0;else d=1,m=1,_=2;else d=1,m=1,_=1;else d=1,m=1,_=0;else d=0,m=1,_=2;else d=0,m=1,_=1;else d=0,m=1,_=0;else d=2,m=0,_=2;else d=2,m=0,_=1;else d=2,m=0,_=0;else d=1,m=0,_=2;else d=1,m=0,_=1;else d=1,m=0,_=0;else d=0,m=0,_=2;else d=0,m=0,_=1;else d=0,m=0,_=0;while(!1);return A=h[11120+(A*216|0)+(m*72|0)+(d*24|0)+(_<<3)+4>>2]|0,A|0}function g9(d,A){return d=d|0,A=A|0,(h[7696+(d*28|0)+20>>2]|0)==(A|0)?(A=1,A|0):(A=(h[7696+(d*28|0)+24>>2]|0)==(A|0),A|0)}function w4(d,A){return d=d|0,A=A|0,h[848+(d*28|0)+(A<<2)>>2]|0}function S4(d,A){return d=d|0,A=A|0,(h[848+(d*28|0)>>2]|0)==(A|0)?(A=0,A|0):(h[848+(d*28|0)+4>>2]|0)==(A|0)?(A=1,A|0):(h[848+(d*28|0)+8>>2]|0)==(A|0)?(A=2,A|0):(h[848+(d*28|0)+12>>2]|0)==(A|0)?(A=3,A|0):(h[848+(d*28|0)+16>>2]|0)==(A|0)?(A=4,A|0):(h[848+(d*28|0)+20>>2]|0)==(A|0)?(A=5,A|0):((h[848+(d*28|0)+24>>2]|0)==(A|0)?6:7)|0}function Mre(){return 122}function Cre(d){d=d|0;var A=0,m=0,_=0;A=0;do ht(A|0,0,45)|0,_=Q()|0|134225919,m=d+(A<<3)|0,h[m>>2]=-1,h[m+4>>2]=_,A=A+1|0;while((A|0)!=122);return 0}function Rre(d){d=d|0;var A=0,m=0,_=0;return _=+ne[d+16>>3],m=+ne[d+24>>3],A=_-m,+(_<m?A+6.283185307179586:A)}function Pre(d){return d=d|0,+ne[d+16>>3]<+ne[d+24>>3]|0}function Ire(d){return d=d|0,+(+ne[d>>3]-+ne[d+8>>3])}function _9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;return m=+ne[A>>3],!(m>=+ne[d+8>>3])||!(m<=+ne[d>>3])?(A=0,A|0):(_=+ne[d+16>>3],m=+ne[d+24>>3],g=+ne[A+8>>3],A=g>=m,d=g<=_&1,_<m?A&&(d=1):A||(d=0),A=(d|0)!=0,A|0)}function T4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;return+ne[d>>3]<+ne[A+8>>3]||+ne[d+8>>3]>+ne[A>>3]?(_=0,_|0):(y=+ne[d+16>>3],m=d+24|0,O=+ne[m>>3],b=y<O,_=A+16|0,I=+ne[_>>3],g=A+24|0,M=+ne[g>>3],E=I<M,A=O-I<M-y,d=b?E|A?1:2:0,A=E?b?1:A?2:1:0,y=+ul(y,d),y<+ul(+ne[g>>3],A)||(O=+ul(+ne[m>>3],d),O>+ul(+ne[_>>3],A))?(E=0,E|0):(E=1,E|0))}function Nre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0;y=+ne[d+16>>3],M=+ne[d+24>>3],d=y<M,E=+ne[A+16>>3],b=+ne[A+24>>3],g=E<b,A=M-E<b-y,h[m>>2]=d?g|A?1:2:0,h[_>>2]=g?d?1:A?2:1:0}function x9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;return+ne[d>>3]<+ne[A>>3]||+ne[d+8>>3]>+ne[A+8>>3]?(_=0,_|0):(_=d+16|0,M=+ne[_>>3],y=+ne[d+24>>3],b=M<y,m=A+16|0,O=+ne[m>>3],g=A+24|0,I=+ne[g>>3],E=O<I,A=y-O<I-M,d=b?E|A?1:2:0,A=E?b?1:A?2:1:0,y=+ul(y,d),y<=+ul(+ne[g>>3],A)?(O=+ul(+ne[_>>3],d),E=O>=+ul(+ne[m>>3],A),E|0):(E=0,E|0))}function y9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0;g=Y,Y=Y+176|0,_=g,h[_>>2]=4,E=+ne[A>>3],ne[_+8>>3]=E,y=+ne[A+16>>3],ne[_+16>>3]=y,ne[_+24>>3]=E,E=+ne[A+24>>3],ne[_+32>>3]=E,b=+ne[A+8>>3],ne[_+40>>3]=b,ne[_+48>>3]=E,ne[_+56>>3]=b,ne[_+64>>3]=y,A=_+72|0,m=A+96|0;do h[A>>2]=0,A=A+4|0;while((A|0)<(m|0));wc(d|0,_|0,168)|0,Y=g}function v9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0;$=Y,Y=Y+288|0,O=$+264|0,G=$+96|0,I=$,E=I,M=E+96|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));return A=O4(A,I)|0,A|0?(W=A,Y=$,W|0):(M=I,I=h[M>>2]|0,M=h[M+4>>2]|0,sg(I,M,O)|0,L0(I,M,G)|0,b=+hx(O,G+8|0),ne[O>>3]=+ne[d>>3],M=O+8|0,ne[M>>3]=+ne[d+16>>3],ne[G>>3]=+ne[d+8>>3],I=G+8|0,ne[I>>3]=+ne[d+24>>3],g=+hx(O,G),ue=+ne[M>>3]-+ne[I>>3],y=+Ls(+ue),oe=+ne[O>>3]-+ne[G>>3],_=+Ls(+oe),!(ue==0|oe==0)&&(ue=+$9(+y,+_),ue=+ng(+(g*g/+sw(+(ue/+sw(+y,+_)),3)/(b*(b*2.59807621135)*.8))),ne[$i>>3]=ue,q=~~ue>>>0,W=+Ls(ue)>=1?ue>0?~~+v4(+js(ue/4294967296),4294967295)>>>0:~~+ng((ue-+(~~ue>>>0))/4294967296)>>>0:0,(h[$i+4>>2]&2146435072|0)!=2146435072)?(G=(q|0)==0&(W|0)==0,A=m,h[A>>2]=G?1:q,h[A+4>>2]=G?0:W,A=0):A=1,W=A,Y=$,W|0)}function Lre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0;I=Y,Y=Y+288|0,b=I+264|0,E=I+96|0,M=I,g=M,y=g+96|0;do h[g>>2]=0,g=g+4|0;while((g|0)<(y|0));return m=O4(m,M)|0,m|0?(_=m,Y=I,_|0):(m=M,g=h[m>>2]|0,m=h[m+4>>2]|0,sg(g,m,b)|0,L0(g,m,E)|0,O=+hx(b,E+8|0),O=+ng(+(+hx(d,A)/(O*2))),ne[$i>>3]=O,m=~~O>>>0,g=+Ls(O)>=1?O>0?~~+v4(+js(O/4294967296),4294967295)>>>0:~~+ng((O-+(~~O>>>0))/4294967296)>>>0:0,(h[$i+4>>2]&2146435072|0)==2146435072?(_=1,Y=I,_|0):(M=(m|0)==0&(g|0)==0,h[_>>2]=M?1:m,h[_+4>>2]=M?0:g,_=0,Y=I,_|0))}function Dre(d,A){d=d|0,A=+A;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;y=d+16|0,b=+ne[y>>3],m=d+24|0,g=+ne[m>>3],_=b-g,_=b<g?_+6.283185307179586:_,I=+ne[d>>3],E=d+8|0,M=+ne[E>>3],O=I-M,_=(_*A-_)*.5,A=(O*A-O)*.5,I=I+A,ne[d>>3]=I>1.5707963267948966?1.5707963267948966:I,A=M-A,ne[E>>3]=A<-1.5707963267948966?-1.5707963267948966:A,A=b+_,A=A>3.141592653589793?A+-6.283185307179586:A,ne[y>>3]=A<-3.141592653589793?A+6.283185307179586:A,A=g-_,A=A>3.141592653589793?A+-6.283185307179586:A,ne[m>>3]=A<-3.141592653589793?A+6.283185307179586:A}function Fre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0;if(dt=Y,Y=Y+224|0,At=dt,Fe=dt+48|0,M=(m|0)>0|(m|0)==0&A>>>0>0,M&(m>>>0>0|(m|0)==0&A>>>0>17895697))return at=14,Y=dt,at|0;if((m|0)<0)return at=2,Y=dt,at|0;if((A|0)==0&(m|0)==0)return h[_>>2]=0,h[_+4>>2]=0,at=0,Y=dt,at|0;for(g=d,g=R4(h[g>>2]|0,h[g+4>>2]|0)|0,b=0,E=0;;){if(y=d+(b<<3)|0,at=y,!(Kb(h[at>>2]|0,h[at+4>>2]|0)|0)){g=5,We=159;break}if(at=y,at=(R4(h[at>>2]|0,h[at+4>>2]|0)|0)==(g|0),b=pt(b|0,E|0,1,0)|0,E=Q()|0,!at){g=12,We=159;break}if(!((E|0)<(m|0)|(E|0)==(m|0)&b>>>0<A>>>0)){We=8;break}}if((We|0)==8){do if((m|0)>0|(m|0)==0&A>>>0>1){if(g=A<<3,b=lr(g)|0,!b)return at=13,Y=dt,at|0;for(wc(b|0,d|0,g|0)|0,tw(b,A,8,1),g=1,y=0;Ot=b+(g<<3)|0,at=b+(g+-1<<3)|0,at=(h[Ot>>2]|0)==(h[at>>2]|0)?(h[Ot+4>>2]|0)==(h[at+4>>2]|0):0,g=pt(g|0,y|0,1,0)|0,y=Q()|0,!at;)if(!((y|0)<(m|0)|(y|0)==(m|0)&g>>>0<A>>>0)){We=14;break}if((We|0)==14){_t(b);break}return _t(b),at=10,Y=dt,at|0}while(!1);if(g=cr(A|0,m|0,6,0)|0,y=Q()|0,M){b=0,E=0;do at=d+(E<<3)|0,at=((ki(h[at>>2]|0,h[at+4>>2]|0)|0)!=0)<<31>>31,g=pt(g|0,y|0,at|0,((at|0)<0)<<31>>31|0)|0,y=Q()|0,E=pt(E|0,b|0,1,0)|0,b=Q()|0;while((b|0)<(m|0)|(b|0)==(m|0)&E>>>0<A>>>0);me=g,be=y}else me=g,be=y;if(_e=cr(me|0,be|0,10,0)|0,re=Q()|0,Ot=lr(me<<5)|0,!Ot)return at=13,Y=dt,at|0;if(at=ra(_e,4)|0,!at)return _t(Ot),at=13,Y=dt,at|0;e:do if(M){for(ye=d,E4(h[ye>>2]|0,h[ye+4>>2]|0,At)|0,W=Ot,$=0,oe=0,g=0,ue=0;;){M=At,M=(h[M>>2]|0)==0&(h[M+4>>2]|0)==0,y=M?26990:26995,b=M?5:6,E=0,M=At+((M&1)<<3)|0,I=pt(b|0,E|0,-1,-1)|0,O=Q()|0,G=0,q=0;do Ee=M+(G<<3)|0,Ze=h[Ee+4>>2]|0,ye=W+(G<<5)|0,h[ye>>2]=h[Ee>>2],h[ye+4>>2]=Ze,He[W+(G<<5)+9>>0]=0,He[W+(G<<5)+8>>0]=0,h[W+(G<<5)+20>>2]=W,ye=W+(G<<5)+24|0,h[ye>>2]=1,h[ye+4>>2]=0,ye=He[y+G>>0]|0,Ze=pt(I|0,O|0,G|0,q|0)|0,Ze=Kh(Ze|0,Q()|0,b|0,E|0)|0,Q()|0,Ze=He[y+Ze>>0]|0,G=pt(G|0,q|0,1,0)|0,q=Q()|0,Ee=He[y+((G|0)==(b|0)&(q|0)==(E|0)?0:G)>>0]|0,ye=ye&255,h[W+(ye<<5)+16>>2]=W+((Ze&255)<<5),h[W+(ye<<5)+12>>2]=W+((Ee&255)<<5);while(q>>>0<E>>>0|(q|0)==(E|0)&G>>>0<b>>>0);if($=pt($|0,oe|0,1,0)|0,oe=Q()|0,g=pt(b|0,E|0,g|0,ue|0)|0,ue=Q()|0,!((oe|0)<(m|0)|(oe|0)==(m|0)&$>>>0<A>>>0))break e;ye=d+($<<3)|0,E4(h[ye>>2]|0,h[ye+4>>2]|0,At)|0||(W=Ot+(g<<5)|0)}ci(27634,26956,108,26975)}while(!1);if((be|0)>0|(be|0)==0&me>>>0>0){E=0,M=0;do{if(y=Ot+(E<<5)|0,b=h[y>>2]|0,y=h[y+4>>2]|0,g=et(b|0,y|0,30)|0,y=cr(g^b|0,(Q()|0)^y|0,484763065,-1084733587)|0,b=Q()|0,g=et(y|0,b|0,27)|0,b=cr(g^y|0,(Q()|0)^b|0,321982955,-1798288965)|0,y=Q()|0,g=et(b|0,y|0,31)|0,y=Kh(g^b|0,(Q()|0)^y|0,_e|0,re|0)|0,b=Q()|0,g=at+(y<<2)|0,h[g>>2]|0)do g=pt(y|0,b|0,1,0)|0,y=hd(g|0,Q()|0,_e|0,re|0)|0,b=Q()|0,g=at+(y<<2)|0;while((h[g>>2]|0)!=0);h[g>>2]=Ot+(E<<5),E=pt(E|0,M|0,1,0)|0,M=Q()|0}while((M|0)<(be|0)|(M|0)==(be|0)&E>>>0<me>>>0);G=0,q=0;do{if(E=Ot+(G<<5)|0,M=Ot+(G<<5)+9|0,!(He[M>>0]|0)){if(ye=E,w9(h[ye>>2]|0,h[ye+4>>2]|0,At)|0){We=39;break}O=At,I=h[O>>2]|0,O=h[O+4>>2]|0,y=et(I|0,O|0,30)|0,y=cr(y^I|0,(Q()|0)^O|0,484763065,-1084733587)|0,b=Q()|0,g=et(y|0,b|0,27)|0,b=cr(g^y|0,(Q()|0)^b|0,321982955,-1798288965)|0,y=Q()|0,g=et(b|0,y|0,31)|0,y=Kh(g^b|0,(Q()|0)^y|0,_e|0,re|0)|0,b=Q()|0,g=h[at+(y<<2)>>2]|0;e:do if(g|0){for(;ye=g,!((h[ye>>2]|0)==(I|0)&&(h[ye+4>>2]|0)==(O|0));)if(g=pt(y|0,b|0,1,0)|0,y=hd(g|0,Q()|0,_e|0,re|0)|0,b=Q()|0,g=h[at+(y<<2)>>2]|0,!g)break e;He[M>>0]=1,He[g+9>>0]=1,y=g+16|0,ye=Ot+(G<<5)+12|0,h[(h[ye>>2]|0)+16>>2]=h[y>>2],m=g+12|0,Ee=h[Ot+(G<<5)+16>>2]|0,h[Ee+12>>2]=h[m>>2],h[(h[m>>2]|0)+16>>2]=Ee,h[(h[y>>2]|0)+12>>2]=h[ye>>2],y=Zb(E)|0,ye=Zb(g)|0,g=y+24|0,m=h[g+4>>2]|0,Ee=ye+24|0,Ze=h[Ee+4>>2]|0,Ee=(m|0)<(Ze|0)|((m|0)==(Ze|0)?(h[g>>2]|0)>>>0<(h[Ee>>2]|0)>>>0:0),g=Ee?y:ye,y=Ee?ye:y,(y|0)!=(g|0)&&(Ze=g+24|0,ye=y+24|0,Ee=ye,Ze=pt(h[Ee>>2]|0,h[Ee+4>>2]|0,h[Ze>>2]|0,h[Ze+4>>2]|0)|0,Ee=Q()|0,h[ye>>2]=Ze,h[ye+4>>2]=Ee,h[g+20>>2]=y)}while(!1)}G=pt(G|0,q|0,1,0)|0,q=Q()|0}while((q|0)<(be|0)|(q|0)==(be|0)&G>>>0<me>>>0);(We|0)==39&&ci(27634,26956,258,27001),g=0,y=0;do He[Ot+(g<<5)+8>>0]=0,g=pt(g|0,y|0,1,0)|0,y=Q()|0;while((y|0)<(be|0)|(y|0)==(be|0)&g>>>0<me>>>0);for(I=0,b=0,M=0,O=0;;){if(g=Ot+(I<<5)|0,(He[Ot+(I<<5)+8>>0]|0)==0&&(He[Ot+(I<<5)+9>>0]|0)==0){E=g,y=h[E>>2]|0,E=h[E+4>>2]|0;do He[g+8>>0]=1,g=h[g+12>>2]|0,ye=g;while(!((h[ye>>2]|0)==(y|0)&&(h[ye+4>>2]|0)==(E|0)));b=pt(b|0,M|0,1,0)|0,E=Q()|0}else E=M;if(I=pt(I|0,O|0,1,0)|0,O=Q()|0,(O|0)<(be|0)|(O|0)==(be|0)&I>>>0<me>>>0)M=E;else break}g=0,y=0;do He[Ot+(g<<5)+8>>0]=0,g=pt(g|0,y|0,1,0)|0,y=Q()|0;while((y|0)<(be|0)|(y|0)==(be|0)&g>>>0<me>>>0);Ee=b,Ze=E,g=1}else Ee=0,Ze=0,g=0;ye=lr(Ee*24|0)|0;e:do if(ye|0){t:do if(g){d=0,_e=0,m=0,A=0;n:for(;;){if(g=Ot+(d<<5)|0,(He[Ot+(d<<5)+8>>0]|0)==0&&(He[Ot+(d<<5)+9>>0]|0)==0){ue=g,oe=h[ue>>2]|0,ue=h[ue+4>>2]|0,y=0,b=0;do y=pt(y|0,b|0,2,0)|0,b=Q()|0,g=h[g+12>>2]|0,re=g;while(!((h[re>>2]|0)==(oe|0)&&(h[re+4>>2]|0)==(ue|0)));if($=lr(y<<4)|0,!$)break;y=oe,b=ue,W=0,q=0,E=0,M=0;do{if(ax(y,b,Fe)|0){We=69;break n}if(re=h[Fe>>2]|0,O=re+-1|0,G=((O|0)<0)<<31>>31,(re|0)>1){b=E,I=0,y=M,E=0;do re=$+(b<<4)|0,M=Fe+8+(I<<4)|0,h[re>>2]=h[M>>2],h[re+4>>2]=h[M+4>>2],h[re+8>>2]=h[M+8>>2],h[re+12>>2]=h[M+12>>2],b=pt(b|0,y|0,1,0)|0,y=Q()|0,I=pt(I|0,E|0,1,0)|0,E=Q()|0;while((E|0)<(G|0)|(E|0)==(G|0)&I>>>0<O>>>0);E=b,M=y}W=pt(W|0,q|0,O|0,G|0)|0,q=Q()|0,He[g+8>>0]=1,g=h[g+12>>2]|0,b=g,y=h[b>>2]|0,b=h[b+4>>2]|0}while(!((y|0)==(oe|0)&(b|0)==(ue|0)));if(y=Ose($,W<<4)|0,!y){We=75;break}ue=Zb(g)|0,re=h[ue+4>>2]|0,g=ye+(m*24|0)|0,h[g>>2]=h[ue>>2],h[g+4>>2]=re,g=ye+(m*24|0)+16|0,h[g>>2]=W,h[ye+(m*24|0)+20>>2]=y,h[At>>2]=h[g>>2],h[At+4>>2]=h[g+4>>2],Gl(At,ye+(m*24|0)+8|0)|0,y=pt(m|0,_e|0,1,0)|0,g=Q()|0}else y=m,g=_e;if(d=pt(d|0,A|0,1,0)|0,A=Q()|0,(A|0)<(be|0)|(A|0)==(be|0)&d>>>0<me>>>0)_e=g,m=y;else break t}if((We|0)==69?ci(27634,26956,351,27016):(We|0)==75&&_t($),(_e|0)>0|(_e|0)==0&m>>>0>0)for(E=0,M=0,g=m,b=_e;y=h[ye+(E*24|0)+20>>2]|0,y?(_t(y),y=_e,g=m):y=b,E=pt(E|0,M|0,1,0)|0,M=Q()|0,(M|0)<(y|0)|(M|0)==(y|0)&E>>>0<g>>>0;)b=y;_t(ye);break e}while(!1);tw(ye,Ee,24,2);t:do if((Ee|0)==0&(Ze|0)==0){if(re=lr(192)|0,re|0){if(h[re+16>>2]=0,h[re+20>>2]=0,q=re+8|0,h[q>>2]=3,g=lr(48)|0,W=re+12|0,h[W>>2]=g,g|0){h[g>>2]=h[3860],h[g+4>>2]=h[3861],h[g+8>>2]=h[3862],h[g+12>>2]=h[3863],G=g+16|0,h[G>>2]=h[3864],h[G+4>>2]=h[3865],h[G+8>>2]=h[3866],h[G+12>>2]=h[3867],G=g+32|0,h[G>>2]=h[3868],h[G+4>>2]=h[3869],h[G+8>>2]=h[3870],h[G+12>>2]=h[3871],h[At>>2]=h[q>>2],h[At+4>>2]=h[q+4>>2],Gl(At,re)|0,h[re+40>>2]=0,h[re+44>>2]=0,G=re+32|0,h[G>>2]=3,g=lr(48)|0,$=re+36|0,h[$>>2]=g;do if(!g)E=0,M=1;else{if(h[g>>2]=h[3872],h[g+4>>2]=h[3873],h[g+8>>2]=h[3874],h[g+12>>2]=h[3875],O=g+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=g+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[At>>2]=h[G>>2],h[At+4>>2]=h[G+4>>2],Gl(At,re+24|0)|0,h[re+64>>2]=0,h[re+68>>2]=0,O=re+56|0,h[O>>2]=3,g=lr(48)|0,oe=re+60|0,h[oe>>2]=g,!g){E=0,M=2;break}if(h[g>>2]=h[3884],h[g+4>>2]=h[3885],h[g+8>>2]=h[3886],h[g+12>>2]=h[3887],I=g+16|0,h[I>>2]=h[3888],h[I+4>>2]=h[3889],h[I+8>>2]=h[3890],h[I+12>>2]=h[3891],I=g+32|0,h[I>>2]=h[3892],h[I+4>>2]=h[3893],h[I+8>>2]=h[3894],h[I+12>>2]=h[3895],h[At>>2]=h[O>>2],h[At+4>>2]=h[O+4>>2],Gl(At,re+48|0)|0,h[re+88>>2]=0,h[re+92>>2]=0,I=re+80|0,h[I>>2]=3,g=lr(48)|0,ue=re+84|0,h[ue>>2]=g,!g){E=0,M=3;break}if(h[g>>2]=h[3896],h[g+4>>2]=h[3897],h[g+8>>2]=h[3898],h[g+12>>2]=h[3899],M=g+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=g+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[At>>2]=h[I>>2],h[At+4>>2]=h[I+4>>2],Gl(At,re+72|0)|0,h[re+112>>2]=0,h[re+116>>2]=0,M=re+104|0,h[M>>2]=3,g=lr(48)|0,d=re+108|0,h[d>>2]=g,!g){E=0,M=4;break}if(h[g>>2]=h[3908],h[g+4>>2]=h[3909],h[g+8>>2]=h[3910],h[g+12>>2]=h[3911],E=g+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=g+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[At>>2]=h[M>>2],h[At+4>>2]=h[M+4>>2],Gl(At,re+96|0)|0,h[re+136>>2]=0,h[re+140>>2]=0,E=re+128|0,h[E>>2]=3,g=lr(48)|0,A=re+132|0,h[A>>2]=g,!g){E=0,M=5;break}if(h[g>>2]=h[3920],h[g+4>>2]=h[3921],h[g+8>>2]=h[3922],h[g+12>>2]=h[3923],b=g+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=g+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[At>>2]=h[E>>2],h[At+4>>2]=h[E+4>>2],Gl(At,re+120|0)|0,h[re+160>>2]=0,h[re+164>>2]=0,b=re+152|0,h[b>>2]=3,g=lr(48)|0,m=re+156|0,h[m>>2]=g,!g){E=0,M=6;break}if(h[g>>2]=h[3932],h[g+4>>2]=h[3933],h[g+8>>2]=h[3934],h[g+12>>2]=h[3935],y=g+16|0,h[y>>2]=h[3936],h[y+4>>2]=h[3937],h[y+8>>2]=h[3938],h[y+12>>2]=h[3939],y=g+32|0,h[y>>2]=h[3940],h[y+4>>2]=h[3941],h[y+8>>2]=h[3942],h[y+12>>2]=h[3943],h[At>>2]=h[b>>2],h[At+4>>2]=h[b+4>>2],Gl(At,re+144|0)|0,h[re+184>>2]=0,h[re+188>>2]=0,y=re+176|0,h[y>>2]=3,g=lr(48)|0,_e=re+180|0,h[_e>>2]=g,!g){E=0,M=7;break}if(h[g>>2]=h[3944],h[g+4>>2]=h[3945],h[g+8>>2]=h[3946],h[g+12>>2]=h[3947],Fe=g+16|0,h[Fe>>2]=h[3948],h[Fe+4>>2]=h[3949],h[Fe+8>>2]=h[3950],h[Fe+12>>2]=h[3951],g=g+32|0,h[g>>2]=h[3952],h[g+4>>2]=h[3953],h[g+8>>2]=h[3954],h[g+12>>2]=h[3955],h[At>>2]=h[y>>2],h[At+4>>2]=h[y+4>>2],Gl(At,re+168|0)|0,tw(re,8,24,3),g=lr(128)|0,h[_+4>>2]=g,g|0){h[_>>2]=8,h[g>>2]=h[q>>2],h[g+4>>2]=h[q+4>>2],h[g+8>>2]=h[q+8>>2],h[g+12>>2]=h[q+12>>2],We=g+16|0,h[We>>2]=h[G>>2],h[We+4>>2]=h[G+4>>2],h[We+8>>2]=h[G+8>>2],h[We+12>>2]=h[G+12>>2],We=g+32|0,h[We>>2]=h[O>>2],h[We+4>>2]=h[O+4>>2],h[We+8>>2]=h[O+8>>2],h[We+12>>2]=h[O+12>>2],We=g+48|0,h[We>>2]=h[I>>2],h[We+4>>2]=h[I+4>>2],h[We+8>>2]=h[I+8>>2],h[We+12>>2]=h[I+12>>2],We=g+64|0,h[We>>2]=h[M>>2],h[We+4>>2]=h[M+4>>2],h[We+8>>2]=h[M+8>>2],h[We+12>>2]=h[M+12>>2],We=g+80|0,h[We>>2]=h[E>>2],h[We+4>>2]=h[E+4>>2],h[We+8>>2]=h[E+8>>2],h[We+12>>2]=h[E+12>>2],We=g+96|0,h[We>>2]=h[b>>2],h[We+4>>2]=h[b+4>>2],h[We+8>>2]=h[b+8>>2],h[We+12>>2]=h[b+12>>2],We=g+112|0,h[We>>2]=h[y>>2],h[We+4>>2]=h[y+4>>2],h[We+8>>2]=h[y+8>>2],h[We+12>>2]=h[y+12>>2],_t(re),We=158;break t}g=h[W>>2]|0,g|0&&_t(g),g=h[$>>2]|0,g|0&&_t(g),g=h[oe>>2]|0,g|0&&_t(g),g=h[ue>>2]|0,g|0&&_t(g),g=h[d>>2]|0,g|0&&_t(g),g=h[A>>2]|0,g|0&&_t(g),g=h[m>>2]|0,g|0&&_t(g),g=h[_e>>2]|0,g|0&&_t(g),_t(re);break t}while(!1);g=0,b=0;do y=h[re+(g*24|0)+12>>2]|0,y|0&&_t(y),g=pt(g|0,b|0,1,0)|0,b=Q()|0;while(b>>>0<E>>>0|(b|0)==(E|0)&g>>>0<M>>>0)}_t(re),We=152}}else{if((Ze|0)>0|(Ze|0)==0&Ee>>>0>0){b=0,E=0,M=0,y=0,g=0,I=0;do Fe=ye+(b*24|0)|0,At=E,E=h[Fe>>2]|0,We=M,M=h[Fe+4>>2]|0,y=pt(y|0,g|0,((E|0)!=(At|0)|(M|0)!=(We|0))&1|0,0)|0,g=Q()|0,b=pt(b|0,I|0,1,0)|0,I=Q()|0;while((I|0)<(Ze|0)|(I|0)==(Ze|0)&b>>>0<Ee>>>0);ue=y,oe=g}else ue=0,oe=0;if(d=lr(ue*24|0)|0,d){n:do if((Ze|0)>=0){for(q=0,W=0,y=0,b=0,$=0,E=0;;){if(!((q|0)==(Ee|0)&(W|0)==(Ze|0))&&(At=ye+(y*24|0)|0,We=ye+(q*24|0)|0,(h[At>>2]|0)==(h[We>>2]|0)?(h[At+4>>2]|0)==(h[We+4>>2]|0):0))g=$;else{if(O=ye+(y*24|0)|0,We=Fs(q|0,W|0,y|0,b|0)|0,At=Q()|0,G=pt(We|0,At|0,-1,-1)|0,b=Q()|0,(At|0)>0|(At|0)==0&We>>>0>1){if(g=lr(G<<3)|0,!g)break;M=0,I=0;do We=M,M=pt(M|0,I|0,1,0)|0,I=Q()|0,Fe=O+(M*24|0)+16|0,At=h[Fe+4>>2]|0,We=g+(We<<3)|0,h[We>>2]=h[Fe>>2],h[We+4>>2]=At;while((I|0)<(b|0)|(I|0)==(b|0)&M>>>0<G>>>0)}else g=0;At=ye+(y*24|0)+16|0,We=h[At+4>>2]|0,b=d+(E*24|0)+8|0,h[b>>2]=h[At>>2],h[b+4>>2]=We,h[d+(E*24|0)+16>>2]=G,h[d+(E*24|0)+20>>2]=g,ne[d+(E*24|0)>>3]=+ne[ye+(y*24|0)+8>>3],E=pt(E|0,$|0,1,0)|0,y=q,b=W,g=Q()|0}if(We=q,q=pt(q|0,W|0,1,0)|0,At=W,W=Q()|0,(At|0)<(Ze|0)|(At|0)==(Ze|0)&We>>>0<Ee>>>0)$=g;else break n}if(($|0)>0|($|0)==0&E>>>0>0){g=0,b=0;do y=h[d+(g*24|0)+20>>2]|0,y|0&&_t(y),g=pt(g|0,b|0,1,0)|0,b=Q()|0;while((b|0)<($|0)|(b|0)==($|0)&g>>>0<E>>>0)}_t(d),We=152;break t}while(!1);if(tw(d,ue,24,3),g=lr(ue<<4)|0,b=_+4|0,h[b>>2]=g,g){h[_>>2]=ue;do if((oe|0)>0|(oe|0)==0&ue>>>0>0){if(_=d+8|0,h[g>>2]=h[_>>2],h[g+4>>2]=h[_+4>>2],h[g+8>>2]=h[_+8>>2],h[g+12>>2]=h[_+12>>2],(ue|0)==1&(oe|0)==0||(_=g+16|0,We=d+32|0,h[_>>2]=h[We>>2],h[_+4>>2]=h[We+4>>2],h[_+8>>2]=h[We+8>>2],h[_+12>>2]=h[We+12>>2],!((oe|0)>0|(oe|0)==0&ue>>>0>2)))break;g=2,y=0;do _=(h[b>>2]|0)+(g<<4)|0,We=d+(g*24|0)+8|0,h[_>>2]=h[We>>2],h[_+4>>2]=h[We+4>>2],h[_+8>>2]=h[We+8>>2],h[_+12>>2]=h[We+12>>2],g=pt(g|0,y|0,1,0)|0,y=Q()|0;while((y|0)<(oe|0)|(y|0)==(oe|0)&g>>>0<ue>>>0)}while(!1);_t(d),We=158;break}else{if((oe|0)>0|(oe|0)==0&ue>>>0>0){g=0,b=0;do y=h[d+(g*24|0)+20>>2]|0,y|0&&_t(y),g=pt(g|0,b|0,1,0)|0,b=Q()|0;while((b|0)<(oe|0)|(b|0)==(oe|0)&g>>>0<ue>>>0)}_t(d),We=152;break}}else We=152}while(!1);if((We|0)==158)return _t(Ot),_t(at),_t(ye),at=0,Y=dt,at|0;if((We|0)==152&&(Ze|0)>0|(Ze|0)==0&Ee>>>0>0)for(E=0,M=0,g=Ee,b=Ze;y=h[ye+(E*24|0)+20>>2]|0,y?(_t(y),y=Ze,g=Ee):y=b,E=pt(E|0,M|0,1,0)|0,M=Q()|0,(M|0)<(y|0)|(M|0)==(y|0)&E>>>0<g>>>0;)b=y;return _t(ye),_t(Ot),_t(at),at=13,Y=dt,at|0}while(!1);return _t(Ot),_t(at),at=13,Y=dt,at|0}else if((We|0)==159)return Y=dt,g|0;return 0}function Ore(d,A){d=d|0,A=A|0;var m=0,_=0;return _=d,d=h[_>>2]|0,_=h[_+4>>2]|0,m=A,A=h[m>>2]|0,m=h[m+4>>2]|0,(_>>>0<m>>>0|(_|0)==(m|0)&d>>>0<A>>>0?-1:(_>>>0>m>>>0|(_|0)==(m|0)&d>>>0>A>>>0)&1)|0}function Zb(d){d=d|0;var A=0,m=0;return A=d+20|0,m=h[A>>2]|0,(m|0)==(d|0)?d|0:(m=Zb(m)|0,h[A>>2]=m,m|0)}function Bre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0;return E=d,b=h[E>>2]|0,E=h[E+4>>2]|0,y=A,g=h[y>>2]|0,y=h[y+4>>2]|0,E>>>0<y>>>0|(E|0)==(y|0)&b>>>0<g>>>0?(A=-1,A|0):E>>>0>y>>>0|(E|0)==(y|0)&b>>>0>g>>>0?(A=1,A|0):(_=+ne[d+8>>3],m=+ne[A+8>>3],_<m?(A=-1,A|0):(A=_>m&1,A|0))}function Ure(d,A){d=d|0,A=A|0;var m=0,_=0;return _=+ne[d>>3],m=+ne[A>>3],(_>m?-1:_<m&1)|0}function kre(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0;if(G=Y,Y=Y+64|0,O=G,E=G+56|0,!(!0&(A&2013265920|0)==134217728&(!0&(_&2013265920|0)==134217728)))return g=5,Y=G,g|0;if((d|0)==(m|0)&(A|0)==(_|0))return h[g>>2]=0,g=0,Y=G,g|0;if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,I=et(m|0,_|0,52)|0,Q()|0,(b|0)!=(I&15|0))return g=12,Y=G,g|0;if(y=b+-1|0,b>>>0>1){I4(d,A,y,O)|0,I4(m,_,y,E)|0,I=O,M=h[I>>2]|0,I=h[I+4>>2]|0;e:do if((M|0)==(h[E>>2]|0)&&(I|0)==(h[E+4>>2]|0)){b=(b^15)*3|0,y=et(d|0,A|0,b|0)|0,Q()|0,y=y&7,b=et(m|0,_|0,b|0)|0,Q()|0,b=b&7;do if((y|0)==0|(b|0)==0)h[g>>2]=1,y=0;else if((y|0)==7)y=5;else{if((y|0)==1|(b|0)==1&&ki(M,I)|0){y=5;break}if((h[15824+(y<<2)>>2]|0)!=(b|0)&&(h[15856+(y<<2)>>2]|0)!=(b|0))break e;h[g>>2]=1,y=0}while(!1);return g=y,Y=G,g|0}while(!1)}y=O,b=y+56|0;do h[y>>2]=0,y=y+4|0;while((y|0)<(b|0));return h9(d,A,1,O)|0,A=O,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0))&&(A=O+8|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))&&(A=O+16|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))&&(A=O+24|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))&&(A=O+32|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))&&(A=O+40|0,!((h[A>>2]|0)==(m|0)&&(h[A+4>>2]|0)==(_|0)))?(y=O+48|0,y=((h[y>>2]|0)==(m|0)?(h[y+4>>2]|0)==(_|0):0)&1):y=1,h[g>>2]=y,g=0,Y=G,g|0}function Gre(d,A,m,_,g){return d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,m=Yb(d,A,m,_)|0,(m|0)==7?(g=11,g|0):(_=ht(m|0,0,56)|0,A=A&-2130706433|(Q()|0)|268435456,h[g>>2]=d|_,h[g+4>>2]=A,g=0,g|0)}function zre(d,A,m){return d=d|0,A=A|0,m=m|0,!0&(A&2013265920|0)==268435456?(h[m>>2]=d,h[m+4>>2]=A&-2130706433|134217728,m=0,m|0):(m=6,m|0)}function Vre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;return g=Y,Y=Y+16|0,_=g,h[_>>2]=0,!0&(A&2013265920|0)==268435456?(y=et(d|0,A|0,56)|0,Q()|0,_=Ds(d,A&-2130706433|134217728,y&7,_,m)|0,Y=g,_|0):(_=6,Y=g,_|0)}function b9(d,A){d=d|0,A=A|0;var m=0;switch(m=et(d|0,A|0,56)|0,Q()|0,m&7){case 0:case 7:return m=0,m|0;default:}return m=A&-2130706433|134217728,!(!0&(A&2013265920|0)==268435456)||!0&(A&117440512|0)==16777216&(ki(d,m)|0)!=0?(m=0,m|0):(m=Kb(d,m)|0,m|0)}function qre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return g=Y,Y=Y+16|0,_=g,!0&(A&2013265920|0)==268435456?(y=A&-2130706433|134217728,b=m,h[b>>2]=d,h[b+4>>2]=y,h[_>>2]=0,A=et(d|0,A|0,56)|0,Q()|0,_=Ds(d,y,A&7,_,m+8|0)|0,Y=g,_|0):(_=6,Y=g,_|0)}function E4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0;return g=(ki(d,A)|0)==0,A=A&-2130706433,_=m,h[_>>2]=g?d:0,h[_+4>>2]=g?A|285212672:0,_=m+8|0,h[_>>2]=d,h[_+4>>2]=A|301989888,_=m+16|0,h[_>>2]=d,h[_+4>>2]=A|318767104,_=m+24|0,h[_>>2]=d,h[_+4>>2]=A|335544320,_=m+32|0,h[_>>2]=d,h[_+4>>2]=A|352321536,m=m+40|0,h[m>>2]=d,h[m+4>>2]=A|369098752,0}function ax(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+16|0,g=b,y=A&-2130706433|134217728,!0&(A&2013265920|0)==268435456?(_=et(d|0,A|0,56)|0,Q()|0,_=Lse(d,y,_&7)|0,(_|0)==-1?(h[m>>2]=0,y=6,Y=b,y|0):(rg(d,y,g)|0&&ci(27634,27035,282,27050),A=et(d|0,A|0,52)|0,Q()|0,A=A&15,ki(d,y)|0?M4(g,A,_,2,m):C4(g,A,_,2,m),y=0,Y=b,y|0)):(y=6,Y=b,y|0)}function w9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;return b=Y,Y=Y+16|0,_=b+8|0,g=b,y=A&-2130706433|134217728,!0&(A&2013265920|0)==268435456?(h[_>>2]=0,A=et(d|0,A|0,56)|0,Q()|0,A=Ds(d,y,A&7,_,g)|0,A|0?(m=A,Y=b,m|0):(_=h[g>>2]|0,g=h[g+4>>2]|0,A=Yb(_,g,d,y)|0,(A|0)==7?(m=11,Y=b,m|0):(d=ht(A|0,0,56)|0,y=g&-2130706433|(Q()|0)|268435456,h[m>>2]=_|d,h[m+4>>2]=y,m=0,Y=b,m|0))):(m=6,Y=b,m|0)}function Hre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0;h[m>>2]=0,I=+ne[d>>3],O=+ne[d+8>>3],M=+ne[d+16>>3],g=0,y=5,_=5,d=0;do oe=+ne[15888+(g*24|0)>>3]-I,$=+ne[15888+(g*24|0)+8>>3]-O,b=+ne[15888+(g*24|0)+16>>3]-M,b=oe*oe+$*$+b*b,b<_&&(h[m>>2]=g,y=b,d=g,_=b),g=g+1|0;while((g|0)!=20);if(y=+ire(+(1-y*.5)),y<1e-16)M=0,b=0;else{if(me=+ne[16368+(d*24|0)>>3],re=+ne[15888+(d*24|0)>>3],be=+ne[15888+(d*24|0)+8>>3],_e=+ne[15888+(d*24|0)+16>>3],Fe=-(_e+(re*0+be*0)),b=re*Fe+0,oe=be*Fe+0,Fe=_e*Fe+1,ue=+is(+(Fe*Fe+(b*b+oe*oe))),ue=ue>0?1/ue:0,b=b*ue,oe=oe*ue,ue=Fe*ue,Fe=-(I*re+O*be+M*_e),$=I+re*Fe,_=O+be*Fe,I=M+_e*Fe,O=+is(+(I*I+($*$+_*_))),O=O>0?1/O:0,$=$*O,_=_*O,O=I*O,_=+ux(me-+ux(+ia(+(O*(be*b-re*oe)+($*(_e*oe-be*ue)+_*(re*ue-_e*b))),+(ue*O+(b*$+oe*_))))),zl(A)|0?b=+ux(_+-.3334731722518321):b=_,_=+$b(+y)*2.618033988749896,(A|0)>0){d=0;do _=_*2.6457513110645907,d=d+1|0;while((d|0)!=(A|0))}M=+Qn(+b)*_,b=+Ni(+b)*_}A=m+4|0,W=m+12|0,h[W>>2]=0,y=+Ls(+b)*1.1547005383792515,_=+Ls(+M)+y*.5,d=~~_,g=~~y,_=_-+(d|0),y=y-+(g|0);do if(_<.5)if(_<.3333333333333333)if(h[A>>2]=d,y<(_+1)*.5){h[m+8>>2]=g;break}else{g=g+1|0,h[m+8>>2]=g;break}else if(Fe=1-_,g=(!(y<Fe)&1)+g|0,h[m+8>>2]=g,Fe<=y&y<_*2){d=d+1|0,h[A>>2]=d;break}else{h[A>>2]=d;break}else{if(!(_<.6666666666666666))if(d=d+1|0,h[A>>2]=d,y<_*.5){h[m+8>>2]=g;break}else{g=g+1|0,h[m+8>>2]=g;break}if(y<1-_){if(h[m+8>>2]=g,_*2+-1<y){h[A>>2]=d;break}}else g=g+1|0,h[m+8>>2]=g;d=d+1|0,h[A>>2]=d}while(!1);do if(M<0)if(g&1){q=(g+1|0)/2|0,q=Fs(d|0,((d|0)<0)<<31>>31|0,q|0,((q|0)<0)<<31>>31|0)|0,d=~~(+(d|0)-((+(q>>>0)+4294967296*+(Q()|0))*2+1)),h[A>>2]=d,q=A;break}else{q=(g|0)/2|0,q=Fs(d|0,((d|0)<0)<<31>>31|0,q|0,((q|0)<0)<<31>>31|0)|0,d=~~(+(d|0)-(+(q>>>0)+4294967296*+(Q()|0))*2),h[A>>2]=d,q=A;break}else q=A;while(!1);G=m+8|0,A=0-g|0,b<0?(m=d-((g<<1|1|0)/2|0)|0,h[q>>2]=m,h[G>>2]=A,g=A):m=d,d=g-m|0,A=0-m|0,(m|0)<0?(h[G>>2]=d,h[W>>2]=A,h[q>>2]=0,E=0):(d=g,E=m,A=0),m=E-d|0,g=A-d|0,(d|0)<0?(h[q>>2]=m,h[W>>2]=g,h[G>>2]=0,E=m,d=0):g=A,m=E-g|0,A=d-g|0,(g|0)<0?(h[q>>2]=m,h[G>>2]=A,h[W>>2]=0,g=0):(A=d,m=E),d=(A|0)<(m|0)?A:m,d=(g|0)<(d|0)?g:d,!((d|0)<=0)&&(h[q>>2]=m-d,h[G>>2]=A-d,h[W>>2]=g-d)}function Wre(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;_=Y,Y=Y+16|0,g=_,b=h[d+12>>2]|0,y=+((h[d+8>>2]|0)-b|0),ne[g>>3]=+((h[d+4>>2]|0)-b|0)-y*.5,ne[g+8>>3]=y*.8660254037844386,lx(g,h[d>>2]|0,A,0,m),Y=_}function lx(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0;if(y=+Nse(d),y<1e-16){A=15888+(A*24|0)|0,h[g>>2]=h[A>>2],h[g+4>>2]=h[A+4>>2],h[g+8>>2]=h[A+8>>2],h[g+12>>2]=h[A+12>>2],h[g+16>>2]=h[A+16>>2],h[g+20>>2]=h[A+20>>2];return}if(b=+ia(+ +ne[d+8>>3],+ +ne[d>>3]),(m|0)>0){d=0;do y=y*.37796447300922725,d=d+1|0;while((d|0)!=(m|0))}E=y*.3333333333333333,_?(m=(zl(m)|0)==0,y=+c9(+((m?E:E*.37796447300922725)*.381966011250105))):(y=+c9(+(y*.381966011250105)),zl(m)|0&&(b=+ux(b+.3334731722518321))),G=+ux(+ne[16368+(A*24|0)>>3]-b),E=+ne[15888+(A*24|0)>>3],O=+ne[15888+(A*24|0)+8>>3],oe=+ne[15888+(A*24|0)+16>>3],W=-(oe+(E*0+O*0)),I=E*W+0,b=O*W+0,W=oe*W+1,q=+is(+(W*W+(I*I+b*b))),q=q>0?1/q:0,I=I*q,b=b*q,q=W*q,W=+Qn(+G),G=+Ni(+G),ue=+Qn(+y),$=+Ni(+y),M=ue*E+$*(W*I+G*(oe*b-O*q)),y=ue*O+$*(W*b+G*(E*q-oe*I)),b=ue*oe+$*(W*q+G*(O*I-E*b)),E=+is(+(b*b+(M*M+y*y))),E=E>0?1/E:0,ne[g>>3]=M*E,ne[g+8>>3]=y*E,ne[g+16>>3]=b*E}function M4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0,ui=0,gi=0,lo=0,Un=0,_i=0,sa=0,ms=0,Hr=0,gs=0,rs=0,Ba=0,Xs=0,$s=0,ql=0,co=0,Si=0,D0=0;if(Ba=Y,Y=Y+256|0,y=Ba+240|0,ui=Ba+224|0,Hr=Ba,gs=Ba+208|0,rs=Ba+192|0,gi=Ba+168|0,lo=Ba+152|0,Un=Ba+136|0,_i=Ba+120|0,sa=Ba+104|0,ms=Ba+80|0,h[y>>2]=A,h[ui>>2]=h[d>>2],h[ui+4>>2]=h[d+4>>2],h[ui+8>>2]=h[d+8>>2],h[ui+12>>2]=h[d+12>>2],S9(ui,y,Hr),h[g>>2]=0,ui=_+m+((_|0)==5&1)|0,(ui|0)<=(m|0)){Y=Ba;return}me=h[y>>2]|0,be=gs+4|0,_e=gs+8|0,re=gs+12|0,Fe=rs+8|0,Ze=m+5|0,Ee=16848+(me<<2)|0,ye=gi+8|0,At=16928+(me<<2)|0,We=lo+8|0,Ot=Un+8|0,at=_i+8|0,dt=rs+8|0,W=gi+8|0,oe=gi+16|0,$=ms+8|0,ue=ms+16|0,q=m,_=0,b=0,E=0,M=0;e:for(;;){G=Hr+(((q|0)%5|0)<<4)|0,h[gs>>2]=h[G>>2],h[gs+4>>2]=h[G+4>>2],h[gs+8>>2]=h[G+8>>2],h[gs+12>>2]=h[G+12>>2];do;while((ig(gs,me,0,1)|0)==2);if((q|0)>(m|0)&(zl(A)|0)!=0){if(G=h[gs>>2]|0,d=h[be>>2]|0,I=h[_e>>2]|0,y=h[re>>2]|0,Xs=+(E-M|0),ne[rs>>3]=+(b-M|0)-Xs*.5,ne[Fe>>3]=Xs*.8660254037844386,M=h[17008+(G*80|0)+(_<<2)>>2]|0,O=h[18608+(G*80|0)+(M*20|0)>>2]|0,E=h[18608+(G*80|0)+(M*20|0)+16>>2]|0,(E|0)>0){b=0,_=I;do co=y+d|0,Si=(co|0)<0,I=_+d-(Si?co:0)|0,ql=(I|0)<0,$s=y+_-(Si?co:0)-(ql?I:0)|0,y=($s|0)<0,d=(Si?0:co)-(ql?I:0)-(y?$s:0)|0,_=(ql?0:I)-(y?$s:0)|0,$s=y?0:$s,y=(_|0)<(d|0)?_:d,y=($s|0)<(y|0)?$s:y,I=(y|0)>0,d=d-(I?y:0)|0,_=_-(I?y:0)|0,y=$s-(I?y:0)|0,b=b+1|0;while((b|0)<(E|0))}else _=I;switch(Si=(h[Ee>>2]|0)*3|0,$s=(Fa(Si,h[18608+(G*80|0)+(M*20|0)+4>>2]|0)|0)+d|0,I=(Fa(Si,h[18608+(G*80|0)+(M*20|0)+8>>2]|0)|0)+_|0,Si=(Fa(Si,h[18608+(G*80|0)+(M*20|0)+12>>2]|0)|0)+y|0,M=($s|0)<0,I=I-(M?$s:0)|0,ql=(I|0)<0,Si=Si+(M?0-$s|0:0)+(ql?0-I|0:0)|0,co=(Si|0)<0,$s=(M?0:$s)-(ql?I:0)-(co?Si:0)|0,I=(ql?0:I)-(co?Si:0)|0,Si=co?0:Si,co=(I|0)<($s|0)?I:$s,co=(Si|0)<(co|0)?Si:co,ql=(co|0)>0,Si=Si-(ql?co:0)|0,Xs=+(I-(ql?co:0)-Si|0),ne[gi>>3]=+($s-(ql?co:0)-Si|0)-Xs*.5,ne[ye>>3]=Xs*.8660254037844386,Xs=+(h[At>>2]|0),ne[lo>>3]=Xs*3,ne[We>>3]=0,D0=Xs*-1.5,ne[Un>>3]=D0,ne[Ot>>3]=Xs*2.598076211353316,ne[_i>>3]=D0,ne[at>>3]=Xs*-2.598076211353316,h[17008+(O*80|0)+(G<<2)>>2]|0){case 1:{d=Un,_=lo;break}case 3:{d=_i,_=Un;break}case 2:{d=lo,_=_i;break}default:{d=12;break e}}U9(rs,gi,_,d,sa),lx(sa,O,me,1,ms),Si=h[g>>2]|0,Xs=+ox(+ +ne[ue>>3]),D0=+ia(+ +ne[$>>3],+ +ne[ms>>3]),ne[g+8+(Si<<4)>>3]=Xs,ne[g+8+(Si<<4)+8>>3]=D0,h[g>>2]=(h[g>>2]|0)+1}if((q|0)<(Ze|0)&&(Si=h[re>>2]|0,Xs=+((h[_e>>2]|0)-Si|0),ne[rs>>3]=+((h[be>>2]|0)-Si|0)-Xs*.5,ne[dt>>3]=Xs*.8660254037844386,lx(rs,h[gs>>2]|0,me,1,gi),Si=h[g>>2]|0,Xs=+ox(+ +ne[oe>>3]),D0=+ia(+ +ne[W>>3],+ +ne[gi>>3]),ne[g+8+(Si<<4)>>3]=Xs,ne[g+8+(Si<<4)+8>>3]=D0,h[g>>2]=(h[g>>2]|0)+1),q=q+1|0,(q|0)>=(ui|0)){d=3;break}else _=h[gs>>2]|0,b=h[be>>2]|0,E=h[_e>>2]|0,M=h[re>>2]|0}if((d|0)==3){Y=Ba;return}else(d|0)==12&&ci(27073,27120,599,27130)}function S9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;$=Y,Y=Y+128|0,_=$+64|0,g=$,y=_,b=20208,E=y+60|0;do h[y>>2]=h[b>>2],y=y+4|0,b=b+4|0;while((y|0)<(E|0));y=g,b=20272,E=y+60|0;do h[y>>2]=h[b>>2],y=y+4|0,b=b+4|0;while((y|0)<(E|0));if(O=(zl(h[A>>2]|0)|0)==0,O=O?_:g,W=d+4|0,y=h[W>>2]|0,G=d+8|0,_=h[G>>2]|0,q=d+12|0,g=h[q>>2]|0,b=_+(y<<1)|0,h[W>>2]=b,_=g+(_<<1)|0,h[G>>2]=_,y=(g<<1)+y|0,h[q>>2]=y,g=_-b|0,E=y-b|0,(b|0)<0&&(h[G>>2]=g,h[q>>2]=E,h[W>>2]=0,_=g,b=0,y=E),E=b-_|0,g=y-_|0,(_|0)<0?(h[W>>2]=E,h[q>>2]=g,h[G>>2]=0,_=0):(g=y,E=b),b=E-g|0,y=_-g|0,(g|0)<0?(h[W>>2]=b,h[G>>2]=y,h[q>>2]=0,g=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(g=g-_|0,y=y-_|0,b=b-_|0,h[W>>2]=b,h[G>>2]=y,h[q>>2]=g),M=(y<<1)+b|0,E=g+(b<<1)|0,h[W>>2]=E,h[G>>2]=M,y=(g<<1)+y|0,h[q>>2]=y,_=M-E|0,g=y-E|0,(E|0)<0?(h[G>>2]=_,h[q>>2]=g,h[W>>2]=0,E=0,y=g):_=M,b=E-_|0,g=y-_|0,(_|0)<0?(h[W>>2]=b,h[q>>2]=g,h[G>>2]=0,E=b,_=0):g=y,b=E-g|0,y=_-g|0,(g|0)<0?(h[W>>2]=b,h[G>>2]=y,h[q>>2]=0,g=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[W>>2]=b-_,h[G>>2]=y-_,h[q>>2]=g-_),zl(h[A>>2]|0)|0&&(y=h[W>>2]|0,b=h[G>>2]|0,g=h[q>>2]|0,_=(b*3|0)+y|0,y=g+(y*3|0)|0,h[W>>2]=y,h[G>>2]=_,b=(g*3|0)+b|0,h[q>>2]=b,g=_-y|0,E=b-y|0,(y|0)<0?(h[G>>2]=g,h[q>>2]=E,h[W>>2]=0,_=g,M=0):(M=y,E=b),y=M-_|0,g=E-_|0,(_|0)<0?(h[W>>2]=y,h[q>>2]=g,h[G>>2]=0,M=y,b=0):(b=_,g=E),y=M-g|0,_=b-g|0,(g|0)<0?(h[W>>2]=y,h[G>>2]=_,h[q>>2]=0,b=_,g=0):y=M,_=(b|0)<(y|0)?b:y,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[W>>2]=y-_,h[G>>2]=b-_,h[q>>2]=g-_),h[A>>2]=(h[A>>2]|0)+1),h[m>>2]=h[d>>2],g=h[G>>2]|0,_=h[q>>2]|0,A=h[O+4>>2]|0,I=h[O+8>>2]|0,b=(h[O>>2]|0)+(h[W>>2]|0)|0,M=m+4|0,h[M>>2]=b,g=A+g|0,A=m+8|0,h[A>>2]=g,_=I+_|0,I=m+12|0,h[I>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[A>>2]=y,h[I>>2]=_,h[M>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[M>>2]=b,_=_-g|0,h[I>>2]=_,h[A>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[M>>2]=E,h[A>>2]=y,h[I>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[M>>2]=b-g,h[A>>2]=y-g,h[I>>2]=_-g),h[m+16>>2]=h[d>>2],g=h[G>>2]|0,_=h[q>>2]|0,A=h[O+16>>2]|0,I=h[O+20>>2]|0,b=(h[O+12>>2]|0)+(h[W>>2]|0)|0,M=m+20|0,h[M>>2]=b,g=A+g|0,A=m+24|0,h[A>>2]=g,_=I+_|0,I=m+28|0,h[I>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[A>>2]=y,h[I>>2]=_,h[M>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[M>>2]=b,_=_-g|0,h[I>>2]=_,h[A>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[M>>2]=E,h[A>>2]=y,h[I>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[M>>2]=b-g,h[A>>2]=y-g,h[I>>2]=_-g),h[m+32>>2]=h[d>>2],g=h[G>>2]|0,_=h[q>>2]|0,A=h[O+28>>2]|0,I=h[O+32>>2]|0,b=(h[O+24>>2]|0)+(h[W>>2]|0)|0,M=m+36|0,h[M>>2]=b,g=A+g|0,A=m+40|0,h[A>>2]=g,_=I+_|0,I=m+44|0,h[I>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[A>>2]=y,h[I>>2]=_,h[M>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[M>>2]=b,_=_-g|0,h[I>>2]=_,h[A>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[M>>2]=E,h[A>>2]=y,h[I>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[M>>2]=b-g,h[A>>2]=y-g,h[I>>2]=_-g),h[m+48>>2]=h[d>>2],g=h[G>>2]|0,_=h[q>>2]|0,A=h[O+40>>2]|0,I=h[O+44>>2]|0,b=(h[O+36>>2]|0)+(h[W>>2]|0)|0,M=m+52|0,h[M>>2]=b,g=A+g|0,A=m+56|0,h[A>>2]=g,_=I+_|0,I=m+60|0,h[I>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[A>>2]=y,h[I>>2]=_,h[M>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[M>>2]=b,_=_-g|0,h[I>>2]=_,h[A>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[M>>2]=E,h[A>>2]=y,h[I>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[M>>2]=b-g,h[A>>2]=y-g,h[I>>2]=_-g),h[m+64>>2]=h[d>>2],y=h[G>>2]|0,_=h[q>>2]|0,I=h[O+52>>2]|0,M=h[O+56>>2]|0,b=(h[O+48>>2]|0)+(h[W>>2]|0)|0,A=m+68|0,h[A>>2]=b,y=I+y|0,I=m+72|0,h[I>>2]=y,_=M+_|0,M=m+76|0,h[M>>2]=_,g=y-b|0,(b|0)<0?(_=_-b|0,h[I>>2]=g,h[M>>2]=_,h[A>>2]=0,y=0):(g=y,y=b),(g|0)<0&&(y=y-g|0,h[A>>2]=y,_=_-g|0,h[M>>2]=_,h[I>>2]=0,g=0),E=y-_|0,b=g-_|0,(_|0)<0?(h[A>>2]=E,h[I>>2]=b,h[M>>2]=0,y=E,_=0):b=g,g=(b|0)<(y|0)?b:y,g=(_|0)<(g|0)?_:g,(g|0)<=0){Y=$;return}h[A>>2]=y-g,h[I>>2]=b-g,h[M>>2]=_-g,Y=$}function ig(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0;if(q=h[16928+(A<<2)>>2]|0,G=(_|0)!=0,q=G?q*3|0:q,O=d+4|0,E=h[O>>2]|0,I=d+8|0,y=h[I>>2]|0,G){if(b=d+12|0,_=h[b>>2]|0,g=y+E+_|0,(g|0)==(q|0))return q=1,q|0;M=b}else M=d+12|0,g=h[M>>2]|0,_=g,g=y+E+g|0;if((g|0)<=(q|0))return q=0,q|0;do if((_|0)>0){if(g=h[d>>2]|0,(y|0)>0){g=18608+(g*80|0)+60|0,b=E;break}g=18608+(g*80|0)+40|0,m?(b=E-q|0,m=y+b|0,W=(m|0)<0,y=_+y-(W?m:0)|0,E=(y|0)<0,_=_+b-(W?m:0)-(E?y:0)|0,b=(_|0)<0,m=(W?0:m)-(E?y:0)-(b?_:0)|0,y=(E?0:y)-(b?_:0)|0,_=b?0:_,b=(y|0)<(m|0)?y:m,b=(_|0)<(b|0)?_:b,E=(b|0)>0,y=y-(E?b:0)|0,_=_-(E?b:0)|0,b=m-(E?b:0)+q|0,h[O>>2]=b,h[I>>2]=y,h[M>>2]=_):b=E}else g=18608+((h[d>>2]|0)*80|0)+20|0,b=E;while(!1);if(h[d>>2]=h[g>>2],E=h[g+16>>2]|0,(E|0)>0){m=0;do W=_+b|0,$=(W|0)<0,_e=$?W:0,oe=y+b-_e|0,ue=(oe|0)<0,d=ue?oe:0,b=_+y-_e-d|0,y=(b|0)<0,_=y?0:b,b=y?b:0,y=(ue?0:oe)-b|0,b=($?0:W)-d-b|0,d=(y|0)<(b|0)?y:b,d=(_|0)<(d|0)?_:d,(d|0)>0&&(b=b-d|0,y=y-d|0,_=_-d|0),m=m+1|0;while((m|0)<(E|0));h[O>>2]=b,h[I>>2]=y,h[M>>2]=_}return oe=h[16848+(A<<2)>>2]|0,oe=G?oe*3|0:oe,ue=Fa(oe,h[g+8>>2]|0)|0,_e=Fa(oe,h[g+12>>2]|0)|0,b=(Fa(oe,h[g+4>>2]|0)|0)+b|0,h[O>>2]=b,y=ue+y|0,h[I>>2]=y,_=_e+_|0,h[M>>2]=_,g=y-b|0,(b|0)<0?(_=_-b|0,h[I>>2]=g,h[M>>2]=_,h[O>>2]=0,y=0):(g=y,y=b),(g|0)<0?(d=y-g|0,h[O>>2]=d,_=_-g|0,h[M>>2]=_,h[I>>2]=0,b=0):(d=y,b=g),y=d-_|0,g=b-_|0,(_|0)<0?(h[O>>2]=y,h[I>>2]=g,h[M>>2]=0,_=0):(g=b,y=d),b=(g|0)<(y|0)?g:y,b=(_|0)<(b|0)?_:b,(b|0)>0&&(y=y-b|0,g=g-b|0,_=_-b|0,h[O>>2]=y,h[I>>2]=g,h[M>>2]=_),G?(_e=(g+y+_|0)==(q|0)?1:2,_e|0):(_e=2,_e|0)}function jre(d,A){d=d|0,A=A|0;var m=0;do m=ig(d,A,0,1)|0;while((m|0)==2);return m|0}function C4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0,ui=0,gi=0,lo=0,Un=0,_i=0,sa=0,ms=0,Hr=0,gs=0,rs=0;if(ms=Y,Y=Y+272|0,y=ms+256|0,b=ms+240|0,Un=ms,_i=ms+224|0,sa=ms+208|0,We=ms+184|0,Ot=ms+168|0,at=ms+152|0,dt=ms+136|0,ui=ms+120|0,gi=ms+96|0,h[y>>2]=A,h[b>>2]=h[d>>2],h[b+4>>2]=h[d+4>>2],h[b+8>>2]=h[d+8>>2],h[b+12>>2]=h[d+12>>2],T9(b,y,Un),h[g>>2]=0,At=_+m+((_|0)==6&1)|0,(At|0)<=(m|0)){Y=ms;return}_e=h[y>>2]|0,re=m+6|0,be=sa+8|0,me=We+8|0,Fe=16928+(_e<<2)|0,Ze=Ot+8|0,Ee=at+8|0,ye=dt+8|0,oe=h[b>>2]|0,q=_i+4|0,W=_i+8|0,$=_i+12|0,ue=sa+8|0,M=We+8|0,O=We+16|0,I=gi+8|0,G=gi+16|0,b=0,E=m,_=-1;e:for(;;){if(y=(E|0)%6|0,d=Un+(y<<4)|0,h[_i>>2]=h[d>>2],h[_i+4>>2]=h[d+4>>2],h[_i+8>>2]=h[d+8>>2],h[_i+12>>2]=h[d+12>>2],d=b,b=ig(_i,_e,0,1)|0,(E|0)>(m|0)&(zl(A)|0)!=0&&(lo=h[_i>>2]|0,(d|0)!=1&(lo|0)!=(_|0))){switch(rs=(y+5|0)%6|0,d=h[Un+(rs<<4)+12>>2]|0,Hr=+((h[Un+(rs<<4)+8>>2]|0)-d|0),ne[sa>>3]=+((h[Un+(rs<<4)+4>>2]|0)-d|0)-Hr*.5,ne[be>>3]=Hr*.8660254037844386,d=h[Un+(y<<4)+12>>2]|0,Hr=+((h[Un+(y<<4)+8>>2]|0)-d|0),ne[We>>3]=+((h[Un+(y<<4)+4>>2]|0)-d|0)-Hr*.5,ne[me>>3]=Hr*.8660254037844386,Hr=+(h[Fe>>2]|0),ne[Ot>>3]=Hr*3,ne[Ze>>3]=0,gs=Hr*-1.5,ne[at>>3]=gs,ne[Ee>>3]=Hr*2.598076211353316,ne[dt>>3]=gs,ne[ye>>3]=Hr*-2.598076211353316,h[17008+(oe*80|0)+(((_|0)==(oe|0)?lo:_)<<2)>>2]|0){case 1:{d=at,_=Ot;break}case 3:{d=dt,_=at;break}case 2:{d=Ot,_=dt;break}default:{d=8;break e}}U9(sa,We,_,d,ui),!(k9(sa,ui)|0)&&!(k9(We,ui)|0)&&(lx(ui,oe,_e,1,gi),rs=h[g>>2]|0,Hr=+ox(+ +ne[G>>3]),gs=+ia(+ +ne[I>>3],+ +ne[gi>>3]),ne[g+8+(rs<<4)>>3]=Hr,ne[g+8+(rs<<4)+8>>3]=gs,h[g>>2]=(h[g>>2]|0)+1)}if((E|0)<(re|0)&&(rs=h[$>>2]|0,Hr=+((h[W>>2]|0)-rs|0),ne[sa>>3]=+((h[q>>2]|0)-rs|0)-Hr*.5,ne[ue>>3]=Hr*.8660254037844386,lx(sa,h[_i>>2]|0,_e,1,We),rs=h[g>>2]|0,Hr=+ox(+ +ne[O>>3]),gs=+ia(+ +ne[M>>3],+ +ne[We>>3]),ne[g+8+(rs<<4)>>3]=Hr,ne[g+8+(rs<<4)+8>>3]=gs,h[g>>2]=(h[g>>2]|0)+1),E=E+1|0,(E|0)>=(At|0)){d=3;break}else _=h[_i>>2]|0}if((d|0)==3){Y=ms;return}else(d|0)==8&&ci(27157,27120,766,27202)}function T9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0;oe=Y,Y=Y+160|0,_=oe+80|0,g=oe,y=_,b=20336,E=y+72|0;do h[y>>2]=h[b>>2],y=y+4|0,b=b+4|0;while((y|0)<(E|0));y=g,b=20416,E=y+72|0;do h[y>>2]=h[b>>2],y=y+4|0,b=b+4|0;while((y|0)<(E|0));G=(zl(h[A>>2]|0)|0)==0,G=G?_:g,$=d+4|0,y=h[$>>2]|0,q=d+8|0,_=h[q>>2]|0,W=d+12|0,g=h[W>>2]|0,b=_+(y<<1)|0,h[$>>2]=b,_=g+(_<<1)|0,h[q>>2]=_,y=(g<<1)+y|0,h[W>>2]=y,g=_-b|0,E=y-b|0,(b|0)<0&&(h[q>>2]=g,h[W>>2]=E,h[$>>2]=0,_=g,b=0,y=E),E=b-_|0,g=y-_|0,(_|0)<0?(h[$>>2]=E,h[W>>2]=g,h[q>>2]=0,_=0):(g=y,E=b),b=E-g|0,y=_-g|0,(g|0)<0?(h[$>>2]=b,h[q>>2]=y,h[W>>2]=0,g=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(g=g-_|0,y=y-_|0,b=b-_|0,h[$>>2]=b,h[q>>2]=y,h[W>>2]=g),M=(y<<1)+b|0,E=g+(b<<1)|0,h[$>>2]=E,h[q>>2]=M,y=(g<<1)+y|0,h[W>>2]=y,_=M-E|0,g=y-E|0,(E|0)<0?(h[q>>2]=_,h[W>>2]=g,h[$>>2]=0,E=0,y=g):_=M,b=E-_|0,g=y-_|0,(_|0)<0?(h[$>>2]=b,h[W>>2]=g,h[q>>2]=0,E=b,_=0):g=y,b=E-g|0,y=_-g|0,(g|0)<0?(h[$>>2]=b,h[q>>2]=y,h[W>>2]=0,g=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[$>>2]=b-_,h[q>>2]=y-_,h[W>>2]=g-_),zl(h[A>>2]|0)|0&&(y=h[$>>2]|0,b=h[q>>2]|0,g=h[W>>2]|0,_=(b*3|0)+y|0,y=g+(y*3|0)|0,h[$>>2]=y,h[q>>2]=_,b=(g*3|0)+b|0,h[W>>2]=b,g=_-y|0,E=b-y|0,(y|0)<0?(h[q>>2]=g,h[W>>2]=E,h[$>>2]=0,_=g,M=0):(M=y,E=b),y=M-_|0,g=E-_|0,(_|0)<0?(h[$>>2]=y,h[W>>2]=g,h[q>>2]=0,M=y,b=0):(b=_,g=E),y=M-g|0,_=b-g|0,(g|0)<0?(h[$>>2]=y,h[q>>2]=_,h[W>>2]=0,b=_,g=0):y=M,_=(b|0)<(y|0)?b:y,_=(g|0)<(_|0)?g:_,(_|0)>0&&(h[$>>2]=y-_,h[q>>2]=b-_,h[W>>2]=g-_),h[A>>2]=(h[A>>2]|0)+1),M=0;do h[m+(M<<4)>>2]=h[d>>2],g=h[q>>2]|0,_=h[W>>2]|0,I=h[G+(M*12|0)+4>>2]|0,O=h[G+(M*12|0)+8>>2]|0,b=(h[G+(M*12|0)>>2]|0)+(h[$>>2]|0)|0,A=m+(M<<4)+4|0,h[A>>2]=b,g=I+g|0,I=m+(M<<4)+8|0,h[I>>2]=g,_=O+_|0,O=m+(M<<4)+12|0,h[O>>2]=_,y=g-b|0,(b|0)<0&&(_=_-b|0,h[I>>2]=y,h[O>>2]=_,h[A>>2]=0,g=y,b=0),(g|0)<0&&(b=b-g|0,h[A>>2]=b,_=_-g|0,h[O>>2]=_,h[I>>2]=0,g=0),E=b-_|0,y=g-_|0,(_|0)<0?(h[A>>2]=E,h[I>>2]=y,h[O>>2]=0,b=E,_=0):y=g,g=(y|0)<(b|0)?y:b,g=(_|0)<(g|0)?_:g,(g|0)>0&&(h[A>>2]=b-g,h[I>>2]=y-g,h[O>>2]=_-g),M=M+1|0;while((M|0)!=6);Y=oe}function R4(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,52)|0,Q()|0,A&15|0}function E9(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,45)|0,Q()|0,A&127|0}function Xre(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,(m+-1|0)>>>0>14?(_=4,_|0):(m=et(d|0,A|0,(15-m|0)*3|0)|0,Q()|0,h[_>>2]=m&7,_=0,_|0)}function $re(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;if(d>>>0>15)return _=4,_|0;if(A>>>0>121)return _=17,_|0;b=ht(d|0,0,52)|0,g=Q()|0,E=ht(A|0,0,45)|0,g=g|(Q()|0)|134225919;e:do if((d|0)>=1){for(E=1,b=(He[20496+A>>0]|0)!=0,y=-1;;){if(A=h[m+(E+-1<<2)>>2]|0,A>>>0>6){g=18,A=10;break}if(!((A|0)==0|b^1))if((A|0)==1){g=19,A=10;break}else b=0;if(I=(15-E|0)*3|0,M=ht(7,0,I|0)|0,g=g&~(Q()|0),A=ht(A|0,((A|0)<0)<<31>>31|0,I|0)|0,y=A|y&~M,g=Q()|0|g,(E|0)<(d|0))E=E+1|0;else break e}if((A|0)==10)return g|0}else y=-1;while(!1);return I=_,h[I>>2]=y,h[I+4>>2]=g,I=0,I|0}function Kb(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0;return!(!0&(A&-16777216|0)==134217728)||(_=et(d|0,A|0,52)|0,Q()|0,_=_&15,m=et(d|0,A|0,45)|0,Q()|0,m=m&127,m>>>0>121)?(d=0,d|0):(b=(_^15)*3|0,g=et(d|0,A|0,b|0)|0,b=ht(g|0,Q()|0,b|0)|0,g=Q()|0,y=Fs(-1227133514,-1171,b|0,g|0)|0,!((b&613566756&y|0)==0&(g&4681&(Q()|0)|0)==0)||(b=(_*3|0)+19|0,y=ht(~d|0,~A|0,b|0)|0,b=et(y|0,Q()|0,b|0)|0,!((_|0)==15|(b|0)==0&(Q()|0)==0))?(b=0,b|0):!(He[20496+m>>0]|0)||(A=A&8191,(d|0)==0&(A|0)==0)?(b=1,b|0):(b=W4(d|0,A|0,0)|0,Q()|0,((63-b|0)%3|0|0)!=0|0))}function Yre(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0;return!0&(A&-16777216|0)==134217728&&(_=et(d|0,A|0,52)|0,Q()|0,_=_&15,m=et(d|0,A|0,45)|0,Q()|0,m=m&127,m>>>0<=121)&&(b=(_^15)*3|0,g=et(d|0,A|0,b|0)|0,b=ht(g|0,Q()|0,b|0)|0,g=Q()|0,y=Fs(-1227133514,-1171,b|0,g|0)|0,(b&613566756&y|0)==0&(g&4681&(Q()|0)|0)==0)&&(b=(_*3|0)+19|0,y=ht(~d|0,~A|0,b|0)|0,b=et(y|0,Q()|0,b|0)|0,(_|0)==15|(b|0)==0&(Q()|0)==0)&&(!(He[20496+m>>0]|0)||(m=A&8191,(d|0)==0&(m|0)==0)||(b=W4(d|0,m|0,0)|0,Q()|0,(63-b|0)%3|0|0))||b9(d,A)|0?(b=1,b|0):(b=(G9(d,A)|0)!=0&1,b|0)}function P4(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0;if(g=ht(A|0,0,52)|0,y=Q()|0,m=ht(m|0,0,45)|0,m=y|(Q()|0)|134225919,(A|0)<1){y=-1,_=m,A=d,h[A>>2]=y,d=d+4|0,h[d>>2]=_;return}for(y=1,g=-1;b=(15-y|0)*3|0,E=ht(7,0,b|0)|0,m=m&~(Q()|0),b=ht(_|0,0,b|0)|0,g=g&~E|b,m=m|(Q()|0),(y|0)!=(A|0);)y=y+1|0;E=d,b=E,h[b>>2]=g,E=E+4|0,h[E>>2]=m}function I4(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;if(y=et(d|0,A|0,52)|0,Q()|0,y=y&15,m>>>0>15)return _=4,_|0;if((y|0)<(m|0))return _=12,_|0;if((y|0)==(m|0))return h[_>>2]=d,h[_+4>>2]=A,_=0,_|0;if(g=ht(m|0,0,52)|0,g=g|d,d=Q()|0|A&-15728641,(y|0)>(m|0))do A=ht(7,0,(14-m|0)*3|0)|0,m=m+1|0,g=A|g,d=Q()|0|d;while((m|0)<(y|0));return h[_>>2]=g,h[_+4>>2]=d,_=0,_|0}function cx(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;if(y=et(d|0,A|0,52)|0,Q()|0,y=y&15,!((m|0)<16&(y|0)<=(m|0)))return _=4,_|0;g=m-y|0,m=et(d|0,A|0,45)|0,Q()|0;e:do if(!(ar(m&127)|0))m=cd(7,0,g,((g|0)<0)<<31>>31)|0,g=Q()|0;else{t:do if(y|0){for(m=1;b=ht(7,0,(15-m|0)*3|0)|0,!!((b&d|0)==0&((Q()|0)&A|0)==0);)if(m>>>0<y>>>0)m=m+1|0;else break t;m=cd(7,0,g,((g|0)<0)<<31>>31)|0,g=Q()|0;break e}while(!1);m=cd(7,0,g,((g|0)<0)<<31>>31)|0,m=cr(m|0,Q()|0,5,0)|0,m=pt(m|0,Q()|0,-5,-1)|0,m=ud(m|0,Q()|0,6,0)|0,m=pt(m|0,Q()|0,1,0)|0,g=Q()|0}while(!1);return b=_,h[b>>2]=m,h[b+4>>2]=g,b=0,b|0}function ki(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;if(g=et(d|0,A|0,45)|0,Q()|0,!(ar(g&127)|0))return g=0,g|0;g=et(d|0,A|0,52)|0,Q()|0,g=g&15;e:do if(!g)m=0;else for(_=1;;){if(m=et(d|0,A|0,(15-_|0)*3|0)|0,Q()|0,m=m&7,m|0)break e;if(_>>>0<g>>>0)_=_+1|0;else{m=0;break}}while(!1);return g=(m|0)==0&1,g|0}function Zre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0;if(b=Y,Y=Y+16|0,y=b,B4(y,d,A,m),A=y,d=h[A>>2]|0,A=h[A+4>>2]|0,(d|0)==0&(A|0)==0)return Y=b,0;g=0,m=0;do E=_+(g<<3)|0,h[E>>2]=d,h[E+4>>2]=A,g=pt(g|0,m|0,1,0)|0,m=Q()|0,U4(y),E=y,d=h[E>>2]|0,A=h[E+4>>2]|0;while(!((d|0)==0&(A|0)==0));return Y=b,0}function M9(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,(_|0)<(m|0)?(m=A,_=d,Dn(m|0),_|0):(m=ht(-1,-1,((_-m|0)*3|0)+3|0)|0,_=ht(~m|0,~(Q()|0)|0,(15-_|0)*3|0)|0,m=~(Q()|0)&A,_=~_&d,Dn(m|0),_|0)}function C9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0;return g=et(d|0,A|0,52)|0,Q()|0,g=g&15,(m|0)<16&(g|0)<=(m|0)?((g|0)<(m|0)&&(g=ht(-1,-1,((m+-1-g|0)*3|0)+3|0)|0,g=ht(~g|0,~(Q()|0)|0,(15-m|0)*3|0)|0,A=~(Q()|0)&A,d=~g&d),g=ht(m|0,0,52)|0,m=A&-15728641|(Q()|0),h[_>>2]=d|g,h[_+4>>2]=m,_=0,_|0):(_=4,_|0)}function Kre(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0,dt=0;if((m|0)==0&(_|0)==0)return dt=0,dt|0;if(g=d,y=h[g>>2]|0,g=h[g+4>>2]|0,!0&(g&15728640|0)==0){if(!((_|0)>0|(_|0)==0&m>>>0>0)||(dt=A,h[dt>>2]=y,h[dt+4>>2]=g,(m|0)==1&(_|0)==0))return dt=0,dt|0;g=1,y=0;do Ot=d+(g<<3)|0,at=h[Ot+4>>2]|0,dt=A+(g<<3)|0,h[dt>>2]=h[Ot>>2],h[dt+4>>2]=at,g=pt(g|0,y|0,1,0)|0,y=Q()|0;while((y|0)<(_|0)|(y|0)==(_|0)&g>>>0<m>>>0);return g=0,g|0}if(We=m<<3,at=lr(We)|0,!at)return dt=13,dt|0;if(wc(at|0,d|0,We|0)|0,Ot=ra(m,8)|0,!Ot)return _t(at),dt=13,dt|0;e:for(;;){g=at,I=h[g>>2]|0,g=h[g+4>>2]|0,ye=et(I|0,g|0,52)|0,Q()|0,ye=ye&15,At=ye+-1|0,Ee=(ye|0)!=0,Ze=(_|0)>0|(_|0)==0&m>>>0>0;t:do if(Ee&Ze){if(re=ht(At|0,0,52)|0,be=Q()|0,At>>>0>15){if(!((I|0)==0&(g|0)==0)){dt=16;break e}for(y=0,d=0;;){if(y=pt(y|0,d|0,1,0)|0,d=Q()|0,!((d|0)<(_|0)|(d|0)==(_|0)&y>>>0<m>>>0))break t;if(b=at+(y<<3)|0,Fe=h[b>>2]|0,b=h[b+4>>2]|0,!((Fe|0)==0&(b|0)==0)){g=b,dt=16;break e}}}for(E=I,d=g,y=0,b=0;;){if(!((E|0)==0&(d|0)==0)){if(!(!0&(d&117440512|0)==0)){dt=21;break e}if(O=et(E|0,d|0,52)|0,Q()|0,O=O&15,(O|0)<(At|0)){g=12,dt=27;break e}if((O|0)!=(At|0)&&(E=E|re,d=d&-15728641|be,O>>>0>=ye>>>0)){M=At;do Fe=ht(7,0,(14-M|0)*3|0)|0,M=M+1|0,E=Fe|E,d=Q()|0|d;while(M>>>0<O>>>0)}if(q=Kh(E|0,d|0,m|0,_|0)|0,W=Q()|0,M=Ot+(q<<3)|0,O=M,G=h[O>>2]|0,O=h[O+4>>2]|0,!((G|0)==0&(O|0)==0)){ue=0,_e=0;do{if((ue|0)>(_|0)|(ue|0)==(_|0)&_e>>>0>m>>>0){dt=31;break e}if((G|0)==(E|0)&(O&-117440513|0)==(d|0)){$=et(G|0,O|0,56)|0,Q()|0,$=$&7,oe=$+1|0,Fe=et(G|0,O|0,45)|0,Q()|0;n:do if(!(ar(Fe&127)|0))O=7;else{if(G=et(G|0,O|0,52)|0,Q()|0,G=G&15,!G){O=6;break}for(O=1;;){if(Fe=ht(7,0,(15-O|0)*3|0)|0,!((Fe&E|0)==0&((Q()|0)&d|0)==0)){O=7;break n}if(O>>>0<G>>>0)O=O+1|0;else{O=6;break}}}while(!1);if(($+2|0)>>>0>O>>>0){dt=41;break e}Fe=ht(oe|0,0,56)|0,d=Q()|0|d&-117440513,me=M,h[me>>2]=0,h[me+4>>2]=0,E=Fe|E}else q=pt(q|0,W|0,1,0)|0,q=hd(q|0,Q()|0,m|0,_|0)|0,W=Q()|0;_e=pt(_e|0,ue|0,1,0)|0,ue=Q()|0,M=Ot+(q<<3)|0,O=M,G=h[O>>2]|0,O=h[O+4>>2]|0}while(!((G|0)==0&(O|0)==0))}Fe=M,h[Fe>>2]=E,h[Fe+4>>2]=d}if(y=pt(y|0,b|0,1,0)|0,b=Q()|0,!((b|0)<(_|0)|(b|0)==(_|0)&y>>>0<m>>>0))break t;d=at+(y<<3)|0,E=h[d>>2]|0,d=h[d+4>>2]|0}}while(!1);if(Fe=pt(m|0,_|0,5,0)|0,me=Q()|0,me>>>0<0|(me|0)==0&Fe>>>0<11){dt=85;break}if(Fe=ud(m|0,_|0,6,0)|0,Q()|0,Fe=ra(Fe,8)|0,!Fe){dt=48;break}do if(Ze){for(oe=0,d=0,$=0,ue=0;;){if(O=Ot+(oe<<3)|0,b=O,y=h[b>>2]|0,b=h[b+4>>2]|0,(y|0)==0&(b|0)==0)me=$;else{G=et(y|0,b|0,56)|0,Q()|0,G=G&7,E=G+1|0,q=b&-117440513,me=et(y|0,b|0,45)|0,Q()|0;t:do if(ar(me&127)|0){if(W=et(y|0,b|0,52)|0,Q()|0,W=W&15,W|0)for(M=1;;){if(me=ht(7,0,(15-M|0)*3|0)|0,!((y&me|0)==0&(q&(Q()|0)|0)==0))break t;if(M>>>0<W>>>0)M=M+1|0;else break}b=ht(E|0,0,56)|0,y=b|y,b=Q()|0|q,E=O,h[E>>2]=y,h[E+4>>2]=b,E=G+2|0}while(!1);(E|0)==7?(me=Fe+(d<<3)|0,h[me>>2]=y,h[me+4>>2]=b&-117440513,d=pt(d|0,$|0,1,0)|0,me=Q()|0):me=$}if(oe=pt(oe|0,ue|0,1,0)|0,ue=Q()|0,(ue|0)<(_|0)|(ue|0)==(_|0)&oe>>>0<m>>>0)$=me;else break}if(Ze){if(_e=At>>>0>15,re=ht(At|0,0,52)|0,be=Q()|0,!Ee){for(y=0,M=0,E=0,b=0;(I|0)==0&(g|0)==0||(At=A+(y<<3)|0,h[At>>2]=I,h[At+4>>2]=g,y=pt(y|0,M|0,1,0)|0,M=Q()|0),E=pt(E|0,b|0,1,0)|0,b=Q()|0,!!((b|0)<(_|0)|(b|0)==(_|0)&E>>>0<m>>>0);)g=at+(E<<3)|0,I=h[g>>2]|0,g=h[g+4>>2]|0;g=me;break}for(y=0,M=0,b=0,E=0;;){do if(!((I|0)==0&(g|0)==0)){if(W=et(I|0,g|0,52)|0,Q()|0,W=W&15,_e|(W|0)<(At|0)){dt=80;break e}if((W|0)!=(At|0)){if(O=I|re,G=g&-15728641|be,W>>>0>=ye>>>0){q=At;do Ee=ht(7,0,(14-q|0)*3|0)|0,q=q+1|0,O=Ee|O,G=Q()|0|G;while(q>>>0<W>>>0)}}else O=I,G=g;$=Kh(O|0,G|0,m|0,_|0)|0,q=0,W=0,ue=Q()|0;do{if((q|0)>(_|0)|(q|0)==(_|0)&W>>>0>m>>>0){dt=81;break e}if(Ee=Ot+($<<3)|0,oe=h[Ee+4>>2]|0,(oe&-117440513|0)==(G|0)&&(h[Ee>>2]|0)==(O|0)){dt=65;break}Ee=pt($|0,ue|0,1,0)|0,$=hd(Ee|0,Q()|0,m|0,_|0)|0,ue=Q()|0,W=pt(W|0,q|0,1,0)|0,q=Q()|0,Ee=Ot+($<<3)|0}while(!((h[Ee>>2]|0)==(O|0)&&(h[Ee+4>>2]|0)==(G|0)));if((dt|0)==65&&(dt=0,!0&(oe&117440512|0)==100663296))break;Ee=A+(y<<3)|0,h[Ee>>2]=I,h[Ee+4>>2]=g,y=pt(y|0,M|0,1,0)|0,M=Q()|0}while(!1);if(b=pt(b|0,E|0,1,0)|0,E=Q()|0,!((E|0)<(_|0)|(E|0)==(_|0)&b>>>0<m>>>0))break;g=at+(b<<3)|0,I=h[g>>2]|0,g=h[g+4>>2]|0}g=me}else y=0,g=me}else y=0,d=0,g=0;while(!1);if(fd(Ot|0,0,We|0)|0,wc(at|0,Fe|0,d<<3|0)|0,_t(Fe),(d|0)==0&(g|0)==0){dt=89;break}else A=A+(y<<3)|0,_=g,m=d}if((dt|0)==16)!0&(g&117440512|0)==0?(g=4,dt=27):dt=21;else if((dt|0)==31)ci(27634,27225,620,27235);else{if((dt|0)==41)return _t(at),_t(Ot),dt=10,dt|0;if((dt|0)==48)return _t(at),_t(Ot),dt=13,dt|0;(dt|0)==80?ci(27634,27225,711,27235):(dt|0)==81?ci(27634,27225,723,27235):(dt|0)==85&&(wc(A|0,at|0,m<<3|0)|0,dt=89)}return(dt|0)==21?(_t(at),_t(Ot),dt=5,dt|0):(dt|0)==27?(_t(at),_t(Ot),dt=g,dt|0):(dt|0)==89?(_t(at),_t(Ot),dt=0,dt|0):0}function Qre(d,A,m,_,g,y,b){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0;var E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0;if(oe=Y,Y=Y+16|0,$=oe,!((m|0)>0|(m|0)==0&A>>>0>0))return $=0,Y=oe,$|0;if((b|0)>=16)return $=12,Y=oe,$|0;q=0,W=0,G=0,E=0;e:for(;;){if(I=d+(q<<3)|0,M=h[I>>2]|0,I=h[I+4>>2]|0,O=et(M|0,I|0,52)|0,Q()|0,(O&15|0)>(b|0)){E=12,M=11;break}if(B4($,M,I,b),O=$,I=h[O>>2]|0,O=h[O+4>>2]|0,(I|0)==0&(O|0)==0)M=G;else{M=G;do{if(!((E|0)<(y|0)|(E|0)==(y|0)&M>>>0<g>>>0)){M=10;break e}G=_+(M<<3)|0,h[G>>2]=I,h[G+4>>2]=O,M=pt(M|0,E|0,1,0)|0,E=Q()|0,U4($),G=$,I=h[G>>2]|0,O=h[G+4>>2]|0}while(!((I|0)==0&(O|0)==0))}if(q=pt(q|0,W|0,1,0)|0,W=Q()|0,(W|0)<(m|0)|(W|0)==(m|0)&q>>>0<A>>>0)G=M;else{E=0,M=11;break}}return(M|0)==10?($=14,Y=oe,$|0):(M|0)==11?(Y=oe,E|0):0}function Jre(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;q=Y,Y=Y+16|0,G=q;e:do if((m|0)>0|(m|0)==0&A>>>0>0){for(I=0,b=0,y=0,O=0;;){if(M=d+(I<<3)|0,E=h[M>>2]|0,M=h[M+4>>2]|0,!((E|0)==0&(M|0)==0)&&(M=(cx(E,M,_,G)|0)==0,E=G,b=pt(h[E>>2]|0,h[E+4>>2]|0,b|0,y|0)|0,y=Q()|0,!M)){y=12;break}if(I=pt(I|0,O|0,1,0)|0,O=Q()|0,!((O|0)<(m|0)|(O|0)==(m|0)&I>>>0<A>>>0))break e}return Y=q,y|0}else b=0,y=0;while(!1);return h[g>>2]=b,h[g+4>>2]=y,g=0,Y=q,g|0}function ese(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,52)|0,Q()|0,A&1|0}function Oa(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;if(g=et(d|0,A|0,52)|0,Q()|0,g=g&15,!g)return g=0,g|0;for(_=1;;){if(m=et(d|0,A|0,(15-_|0)*3|0)|0,Q()|0,m=m&7,m|0){_=5;break}if(_>>>0<g>>>0)_=_+1|0;else{m=0,_=5;break}}return(_|0)==5?m|0:0}function N4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(O=et(d|0,A|0,52)|0,Q()|0,O=O&15,!O)return I=A,O=d,Dn(I|0),O|0;for(I=1,m=0;;){switch(_=(15-I|0)*3|0,E=ht(7,0,_|0)|0,M=Q()|0,y=d&~E,b=A&~M,d=et(d|0,A|0,_|0)|0,Q()|0,d&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=d&7}_=ht(d|0,0,_|0)|0,g=Q()|0,d=_|y,A=g|b;e:do if(!m)if((_&E|0)==0&(g&M|0)==0)m=0;else if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,!b)m=1;else{m=1;t:for(;;){switch(M=et(d|0,A|0,(15-m|0)*3|0)|0,Q()|0,M&7){case 1:break t;case 0:break;default:{m=1;break e}}if(m>>>0<b>>>0)m=m+1|0;else{m=1;break e}}for(y=1;;){switch(g=(15-y|0)*3|0,m=et(d|0,A|0,g|0)|0,Q()|0,_=ht(7,0,g|0)|0,_=d&~_,A=A&~(Q()|0),m&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=m&7}if(d=ht(d|0,0,g|0)|0,d=d|_,A=Q()|0|A,y>>>0<b>>>0)y=y+1|0;else{m=1;break e}}}while(!1);if(I>>>0<O>>>0)I=I+1|0;else break}return Dn(A|0),d|0}function N0(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0;if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,!b)return y=A,b=d,Dn(y|0),b|0;for(y=1;;){switch(g=(15-y|0)*3|0,m=et(d|0,A|0,g|0)|0,Q()|0,_=ht(7,0,g|0)|0,_=d&~_,A=A&~(Q()|0),m&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=m&7}if(d=ht(d|0,0,g|0)|0,d=d|_,A=Q()|0|A,y>>>0<b>>>0)y=y+1|0;else break}return Dn(A|0),d|0}function tse(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(O=et(d|0,A|0,52)|0,Q()|0,O=O&15,!O)return I=A,O=d,Dn(I|0),O|0;for(I=1,m=0;;){switch(_=(15-I|0)*3|0,E=ht(7,0,_|0)|0,M=Q()|0,y=d&~E,b=A&~M,d=et(d|0,A|0,_|0)|0,Q()|0,d&7){case 1:{d=3;break}case 3:{d=2;break}case 2:{d=6;break}case 6:{d=4;break}case 4:{d=5;break}case 5:{d=1;break}default:d=d&7}_=ht(d|0,0,_|0)|0,g=Q()|0,d=_|y,A=g|b;e:do if(!m)if((_&E|0)==0&(g&M|0)==0)m=0;else if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,!b)m=1;else{m=1;t:for(;;){switch(M=et(d|0,A|0,(15-m|0)*3|0)|0,Q()|0,M&7){case 1:break t;case 0:break;default:{m=1;break e}}if(m>>>0<b>>>0)m=m+1|0;else{m=1;break e}}for(y=1;;){switch(m=(15-y|0)*3|0,_=ht(7,0,m|0)|0,_=d&~_,g=A&~(Q()|0),d=et(d|0,A|0,m|0)|0,Q()|0,d&7){case 1:{d=3;break}case 3:{d=2;break}case 2:{d=6;break}case 6:{d=4;break}case 4:{d=5;break}case 5:{d=1;break}default:d=d&7}if(d=ht(d|0,0,m|0)|0,d=d|_,A=Q()|0|g,y>>>0<b>>>0)y=y+1|0;else{m=1;break e}}}while(!1);if(I>>>0<O>>>0)I=I+1|0;else break}return Dn(A|0),d|0}function L4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0;if(b=et(d|0,A|0,52)|0,Q()|0,b=b&15,!b)return y=A,b=d,Dn(y|0),b|0;for(y=1;;){switch(_=(15-y|0)*3|0,m=ht(7,0,_|0)|0,m=d&~m,g=A&~(Q()|0),d=et(d|0,A|0,_|0)|0,Q()|0,d&7){case 1:{d=3;break}case 3:{d=2;break}case 2:{d=6;break}case 6:{d=4;break}case 4:{d=5;break}case 5:{d=1;break}default:d=d&7}if(d=ht(d|0,0,_|0)|0,d=d|m,A=Q()|0|g,y>>>0<b>>>0)y=y+1|0;else break}return Dn(A|0),d|0}function nse(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0;if(me=Y,Y=Y+16|0,be=me,ht(A|0,0,52)|0,m=Q()|0|134225919,!A)return(h[d+4>>2]|0)>2||(h[d+8>>2]|0)>2||(h[d+12>>2]|0)>2?(re=0,be=0,Dn(re|0),Y=me,be|0):(ht(m9(d)|0,0,45)|0,re=Q()|0|m,be=-1,Dn(re|0),Y=me,be|0);h[be>>2]=h[d>>2],h[be+4>>2]=h[d+4>>2],h[be+8>>2]=h[d+8>>2],h[be+12>>2]=h[d+12>>2],re=be+4|0;e:do if((A|0)>0)for(oe=be+8|0,ue=be+12|0,$=A,G=h[oe>>2]|0,q=h[ue>>2]|0,A=-1,O=h[be+4>>2]|0;;){W=$,$=$+-1|0,d=O-q|0,_=G-q|0,W&1?(y=gu(+((d*3|0)-_|0)*.14285714285714285)|0,h[re>>2]=y,d=gu(+((_<<1)+d|0)*.14285714285714285)|0,h[oe>>2]=d,h[ue>>2]=0,_=d-y|0,g=0-y|0,(y|0)<0?(h[oe>>2]=_,h[ue>>2]=g,h[re>>2]=0,d=_,b=0):(b=y,g=0),y=b-d|0,_=g-d|0,(d|0)<0?(h[re>>2]=y,h[ue>>2]=_,h[oe>>2]=0,b=y,y=0):(_=g,y=d),d=b-_|0,g=y-_|0,(_|0)<0?(h[re>>2]=d,h[oe>>2]=g,h[ue>>2]=0,y=0):(g=y,d=b,y=_),_=(g|0)<(d|0)?g:d,_=(y|0)<(_|0)?y:_,(_|0)>0&&(y=y-_|0,g=g-_|0,d=d-_|0,h[re>>2]=d,h[oe>>2]=g,h[ue>>2]=y),Ze=g+(d*3|0)|0,Fe=(Ze|0)<0,I=y+(g*3|0)-(Fe?Ze:0)|0,M=(I|0)<0,_=(y*3|0)+d-(Fe?Ze:0)-(M?I:0)|0,E=(_|0)<0,Ee=E?0:_,b=(M?0:I)-(E?_:0)|0,_=(Fe?0:Ze)-(M?I:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Ee|0)<(E|0)?Ee:E,I=(E|0)>0,M=I?E:0,b=b-(I?E:0)|0,E=Ee-(I?E:0)|0,I=y):(E=gu(+((d<<1)+_|0)*.14285714285714285)|0,h[re>>2]=E,g=gu(+((_*3|0)-d|0)*.14285714285714285)|0,h[oe>>2]=g,h[ue>>2]=0,_=g-E|0,d=0-E|0,(E|0)<0?(h[oe>>2]=_,h[ue>>2]=d,h[re>>2]=0,g=_,E=0):d=0,b=E-g|0,_=d-g|0,(g|0)<0?(h[re>>2]=b,h[ue>>2]=_,h[oe>>2]=0,y=_,g=0):(y=d,b=E),d=b-y|0,_=g-y|0,(y|0)<0?(h[re>>2]=d,h[oe>>2]=_,h[ue>>2]=0,g=_,y=0):d=b,_=(g|0)<(d|0)?g:d,_=(y|0)<(_|0)?y:_,(_|0)>0&&(y=y-_|0,g=g-_|0,d=d-_|0,h[re>>2]=d,h[oe>>2]=g,h[ue>>2]=y),Ze=y+(d*3|0)|0,Ee=(Ze|0)<0,I=(g*3|0)+d-(Ee?Ze:0)|0,M=(I|0)<0,_=(y*3|0)+g-(Ee?Ze:0)-(M?I:0)|0,E=(_|0)<0,Fe=E?0:_,b=(M?0:I)-(E?_:0)|0,_=(Ee?0:Ze)-(M?I:0)-(E?_:0)|0,E=(b|0)<(_|0)?b:_,E=(Fe|0)<(E|0)?Fe:E,I=(E|0)>0,M=I?E:0,b=b-(I?E:0)|0,E=Fe-(I?E:0)|0,I=y),_=O+(M-_)|0,y=(_|0)<0,M=G-b-(y?_:0)|0,b=(M|0)<0,q=q-E+(y?0-_|0:0)+(b?0-M|0:0)|0,O=(q|0)<0,E=O?0:q,Ee=(b?0:M)-(O?q:0)|0,q=(y?0:_)-(b?M:0)-(O?q:0)|0,O=(Ee|0)<(q|0)?Ee:q,O=(E|0)<(O|0)?E:O,M=(O|0)>0,q=q-(M?O:0)|0,b=(15-W|0)*3|0,_=ht(7,0,b|0)|0,_=A&~_,y=m&~(Q()|0),G=(q|0)<0,Ze=G?q:0,Ee=Ee-(M?O:0)-Ze|0,Fe=(Ee|0)<0,Ze=(Fe?0-Ee|0:0)+(E-(M?O:0)-Ze)|0,m=(Ze|0)<0,A=m?0:Ze,Ze=m?Ze:0,m=(Fe?0:Ee)-Ze|0,Ze=(G?0:q)-(Fe?Ee:0)-Ze|0,Ee=(m|0)<(Ze|0)?m:Ze,Ee=(A|0)<(Ee|0)?A:Ee,Ee=(Ee|0)>0?Ee:0,A=A-Ee|0,m=m-Ee|0;t:do switch(Ze-Ee|0){case 0:switch(m|0){case 0:{A=(A|0)==0?0:(A|0)==1?1:7;break t}case 1:{A=(A|0)==0?2:(A|0)==1?3:7;break t}default:{_e=36;break t}}case 1:switch(m|0){case 0:{A=(A|0)==0?4:(A|0)==1?5:7;break t}case 1:if(A){_e=36;break t}else{A=6;break t}default:{_e=36;break t}}default:_e=36}while(!1);if((_e|0)==36&&(_e=0,A=7),A=ht(A|0,0,b|0)|0,A=A|_,m=Q()|0|y,(W|0)<=1)break e;G=g,q=I,O=d}else A=-1,d=h[re>>2]|0;while(!1);e:do if((d|0)<=2&&(h[be+8>>2]|0)<=2&&(h[be+12>>2]|0)<=2){if(_=m9(be)|0,d=ht(_|0,0,45)|0,A=d|A,d=Q()|0|m&-1040385,M=Sre(be)|0,!(ar(_)|0)){if((M|0)<=0)break;for(E=0;;){b=et(A|0,d|0,52)|0,Q()|0,b=b&15;t:do if(b)for(y=1;;){switch(g=(15-y|0)*3|0,m=et(A|0,d|0,g|0)|0,Q()|0,_=ht(7,0,g|0)|0,A=A&~_,_=d&~(Q()|0),m&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=m&7}if(d=ht(d|0,0,g|0)|0,A=d|A,d=Q()|0|_,y>>>0<b>>>0)y=y+1|0;else break t}while(!1);if(E=E+1|0,(E|0)==(M|0))break e}}b=et(A|0,d|0,52)|0,Q()|0,b=b&15;t:do if(b){m=1;n:for(;;){switch(Ee=et(A|0,d|0,(15-m|0)*3|0)|0,Q()|0,Ee&7){case 1:break n;case 0:break;default:break t}if(m>>>0<b>>>0)m=m+1|0;else break t}if(g9(_,h[be>>2]|0)|0)for(y=1;;){switch(m=(15-y|0)*3|0,_=ht(7,0,m|0)|0,_=A&~_,g=d&~(Q()|0),d=et(A|0,d|0,m|0)|0,Q()|0,d&7){case 1:{d=3;break}case 3:{d=2;break}case 2:{d=6;break}case 6:{d=4;break}case 4:{d=5;break}case 5:{d=1;break}default:d=d&7}if(A=ht(d|0,0,m|0)|0,A=A|_,d=Q()|0|g,y>>>0<b>>>0)y=y+1|0;else break t}else for(y=1;;){switch(g=(15-y|0)*3|0,m=et(A|0,d|0,g|0)|0,Q()|0,_=ht(7,0,g|0)|0,A=A&~_,_=d&~(Q()|0),m&7){case 1:{d=5;break}case 5:{d=4;break}case 4:{d=6;break}case 6:{d=2;break}case 2:{d=3;break}case 3:{d=1;break}default:d=m&7}if(d=ht(d|0,0,g|0)|0,A=d|A,d=Q()|0|_,y>>>0<b>>>0)y=y+1|0;else break t}}while(!1);if((M|0)>0){m=0;do A=N4(A,d)|0,d=Q()|0,m=m+1|0;while((m|0)!=(M|0))}}else A=0,d=0;while(!1);return Ze=d,Ee=A,Dn(Ze|0),Y=me,Ee|0}function zl(d){return d=d|0,(d|0)%2|0|0}function D4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;if(O=Y,Y=Y+64|0,E=O+24|0,M=O+48|0,I=O,A>>>0>15)return I=4,Y=O,I|0;if(y=+ne[d>>3],ne[$i>>3]=y,(h[$i+4>>2]&2146435072|0)==2146435072||(_=+ne[d+8>>3],ne[$i>>3]=_,(h[$i+4>>2]&2146435072|0)==2146435072))return I=3,Y=O,I|0;g=+Qn(+y),G=g*+Qn(+_),g=g*+Ni(+_),_=+Ni(+y),ne[I>>3]=G,ne[I+8>>3]=g,ne[I+16>>3]=_,ne[$i>>3]=G;do if((h[$i+4>>2]&2146435072|0)!=2146435072&&(ne[$i>>3]=_,d=h[$i+4>>2]|0,ne[$i>>3]=g,!((h[$i+4>>2]&2146435072|0)==2146435072|!0&(d&2146435072|0)==2146435072)))if(h[E>>2]=h[I>>2],h[E+4>>2]=h[I+4>>2],h[E+8>>2]=h[I+8>>2],h[E+12>>2]=h[I+12>>2],h[E+16>>2]=h[I+16>>2],h[E+20>>2]=h[I+20>>2],Hre(E,A,M),M=nse(M,A)|0,I=Q()|0,h[m>>2]=M,h[m+4>>2]=I,(M|0)==0&(I|0)==0)ci(27634,27225,1073,27248);else{b=0;break}else b=2;while(!1);return I=b,Y=O,I|0}function F4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if(W=m+4|0,$=et(d|0,A|0,52)|0,Q()|0,$=$&15,q=et(d|0,A|0,45)|0,Q()|0,_=($|0)==0,ar(q&127)|0){if(_)return $=1,$|0;_=1}else{if(_)return $=0,$|0;(h[W>>2]|0)==0&&(h[m+8>>2]|0)==0?_=(h[m+12>>2]|0)!=0&1:_=1}for(q=m+8|0,G=m+12|0,O=1,m=h[W>>2]|0,b=h[q>>2]|0,y=h[G>>2]|0;g=m*3|0,E=b*3|0,I=y*3|0,O&1?(M=b+g|0,h[W>>2]=M,y=y+E|0,h[q>>2]=y,g=I+m|0,h[G>>2]=g,m=y-M|0,b=g-M|0,(M|0)<0?(h[q>>2]=m,h[G>>2]=b,h[W>>2]=0,E=0,g=b):(m=y,E=M),b=E-m|0,y=g-m|0,(m|0)<0?(h[W>>2]=b,h[G>>2]=y,h[q>>2]=0,E=b,g=0):(y=g,g=m),m=E-y|0,b=g-y|0,(y|0)<0?(h[W>>2]=m,h[q>>2]=b,h[G>>2]=0,y=0):(b=g,m=E),g=(b|0)<(m|0)?b:m,g=(y|0)<(g|0)?y:g,(g|0)>0&&(y=y-g|0,b=b-g|0,m=m-g|0,h[W>>2]=m,h[q>>2]=b,h[G>>2]=y)):(M=E+m|0,E=y+g|0,h[W>>2]=E,h[q>>2]=M,g=I+b|0,h[G>>2]=g,m=M-E|0,y=g-E|0,(E|0)<0?(h[q>>2]=m,h[G>>2]=y,h[W>>2]=0,E=0,g=y):m=M,b=E-m|0,y=g-m|0,(m|0)<0?(h[W>>2]=b,h[G>>2]=y,h[q>>2]=0,E=b,g=0):(y=g,g=m),m=E-y|0,b=g-y|0,(y|0)<0?(h[W>>2]=m,h[q>>2]=b,h[G>>2]=0,y=0):(b=g,m=E),g=(b|0)<(m|0)?b:m,g=(y|0)<(g|0)?y:g,(g|0)>0&&(y=y-g|0,b=b-g|0,m=m-g|0,h[W>>2]=m,h[q>>2]=b,h[G>>2]=y)),g=et(d|0,A|0,(15-O|0)*3|0)|0,Q()|0,g=g&7,(g+-1|0)>>>0<6&&(M=h[22032+(g*12|0)+4>>2]|0,I=h[22032+(g*12|0)+8>>2]|0,E=(h[22032+(g*12|0)>>2]|0)+m|0,h[W>>2]=E,b=M+b|0,h[q>>2]=b,m=I+y|0,h[G>>2]=m,y=b-E|0,g=m-E|0,(E|0)<0&&(h[q>>2]=y,h[G>>2]=g,h[W>>2]=0,E=0,m=g,b=y),g=E-b|0,y=m-b|0,(b|0)<0?(h[W>>2]=g,h[G>>2]=y,h[q>>2]=0,E=g,b=0):y=m,m=E-y|0,g=b-y|0,(y|0)<0?(h[W>>2]=m,h[q>>2]=g,h[G>>2]=0,b=g,y=0):m=E,g=(b|0)<(m|0)?b:m,g=(y|0)<(g|0)?y:g,(g|0)>0&&(y=y-g|0,b=b-g|0,m=m-g|0,h[W>>2]=m,h[q>>2]=b,h[G>>2]=y)),O>>>0<$>>>0;)O=O+1|0;return _|0}function rg(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if($=Y,Y=Y+16|0,G=$,q=et(d|0,A|0,45)|0,Q()|0,q=q&127,q>>>0>121)return h[m>>2]=0,h[m+4>>2]=0,h[m+8>>2]=0,h[m+12>>2]=0,W=5,Y=$,W|0;e:do if((ar(q)|0)!=0&&(E=et(d|0,A|0,52)|0,Q()|0,E=E&15,(E|0)!=0)){_=1;t:for(;;){switch(W=et(d|0,A|0,(15-_|0)*3|0)|0,Q()|0,W&7){case 5:break t;case 0:break;default:{I=A;break e}}if(_>>>0<E>>>0)_=_+1|0;else{I=A;break e}}for(b=1,_=A;;){switch(A=(15-b|0)*3|0,g=ht(7,0,A|0)|0,g=d&~g,y=_&~(Q()|0),_=et(d|0,_|0,A|0)|0,Q()|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(d=ht(_|0,0,A|0)|0,d=d|g,_=Q()|0|y,b>>>0<E>>>0)b=b+1|0;else{I=_;break e}}}else I=A;while(!1);if(W=7696+(q*28|0)|0,h[m>>2]=h[W>>2],h[m+4>>2]=h[W+4>>2],h[m+8>>2]=h[W+8>>2],h[m+12>>2]=h[W+12>>2],!(F4(d,I,m)|0))return W=0,Y=$,W|0;if(W=m+4|0,h[G>>2]=h[W>>2],h[G+4>>2]=h[W+4>>2],h[G+8>>2]=h[W+8>>2],M=et(d|0,I|0,52)|0,Q()|0,O=M&15,M&1?(y=h[W>>2]|0,E=m+8|0,g=h[E>>2]|0,M=m+12|0,A=h[M>>2]|0,_=(g*3|0)+y|0,y=A+(y*3|0)|0,h[W>>2]=y,h[E>>2]=_,g=(A*3|0)+g|0,h[M>>2]=g,A=_-y|0,b=g-y|0,(y|0)<0&&(h[E>>2]=A,h[M>>2]=b,h[W>>2]=0,_=A,y=0,g=b),b=y-_|0,A=g-_|0,(_|0)<0?(h[W>>2]=b,h[M>>2]=A,h[E>>2]=0,_=0):(A=g,b=y),y=b-A|0,g=_-A|0,(A|0)<0?(h[W>>2]=y,h[E>>2]=g,h[M>>2]=0,A=0):(g=_,y=b),_=(g|0)<(y|0)?g:y,_=(A|0)<(_|0)?A:_,(_|0)>0&&(h[W>>2]=y-_,h[E>>2]=g-_,h[M>>2]=A-_),g=O+1|0):g=O,!(ar(q)|0))_=0;else{e:do if(!O)_=0;else for(A=1;;){if(_=et(d|0,I|0,(15-A|0)*3|0)|0,Q()|0,_=_&7,_|0)break e;if(A>>>0<O>>>0)A=A+1|0;else{_=0;break}}while(!1);_=(_|0)==4&1}if(!(ig(m,g,_,0)|0))(g|0)!=(O|0)&&(h[W>>2]=h[G>>2],h[W+4>>2]=h[G+4>>2],h[W+8>>2]=h[G+8>>2]);else{if(ar(q)|0)do;while((ig(m,g,0,0)|0)!=0);(g|0)!=(O|0)&&(E=m+12|0,d=h[E>>2]|0,_=(h[W>>2]|0)-d|0,b=m+8|0,d=(h[b>>2]|0)-d|0,A=gu(+((_<<1)+d|0)*.14285714285714285)|0,h[W>>2]=A,_=gu(+((d*3|0)-_|0)*.14285714285714285)|0,h[b>>2]=_,h[E>>2]=0,d=_-A|0,g=0-A|0,(A|0)<0?(h[b>>2]=d,h[E>>2]=g,h[W>>2]=0,_=d,A=0):g=0,y=A-_|0,d=g-_|0,(_|0)<0?(h[W>>2]=y,h[E>>2]=d,h[b>>2]=0,A=y,_=0):d=g,y=A-d|0,g=_-d|0,(d|0)<0?(h[W>>2]=y,h[b>>2]=g,h[E>>2]=0,A=y,d=0):g=_,_=(g|0)<(A|0)?g:A,_=(d|0)<(_|0)?d:_,(_|0)>0&&(h[W>>2]=A-_,h[b>>2]=g-_,h[E>>2]=d-_))}return W=0,Y=$,W|0}function sg(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0;return b=Y,Y=Y+48|0,_=b+24|0,g=b,y=rg(d,A,_)|0,y?(Y=b,y|0):(y=et(d|0,A|0,52)|0,Q()|0,Wre(_,y&15,g),M=+ox(+ +ne[g+16>>3]),E=+ia(+ +ne[g+8>>3],+ +ne[g>>3]),ne[m>>3]=M,ne[m+8>>3]=E,y=0,Y=b,y|0)}function L0(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0;if(b=Y,Y=Y+16|0,y=b,_=rg(d,A,y)|0,_|0)return y=_,Y=b,y|0;_=et(d|0,A|0,45)|0,Q()|0,_=(ar(_&127)|0)==0,g=et(d|0,A|0,52)|0,Q()|0,g=g&15;e:do if(!_){if(g|0)for(_=1;;){if(E=ht(7,0,(15-_|0)*3|0)|0,!((E&d|0)==0&((Q()|0)&A|0)==0))break e;if(_>>>0<g>>>0)_=_+1|0;else break}return M4(y,g,0,5,m),E=0,Y=b,E|0}while(!1);return C4(y,g,0,6,m),E=0,Y=b,E|0}function ise(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if(g=et(d|0,A|0,45)|0,Q()|0,!(ar(g&127)|0))return g=2,h[m>>2]=g,0;if(g=et(d|0,A|0,52)|0,Q()|0,g=g&15,!g)return g=5,h[m>>2]=g,0;for(_=1;;){if(y=ht(7,0,(15-_|0)*3|0)|0,!((y&d|0)==0&((Q()|0)&A|0)==0)){_=2,d=6;break}if(_>>>0<g>>>0)_=_+1|0;else{_=5,d=6;break}}return(d|0)==6&&(h[m>>2]=_),0}function R9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;G=Y,Y=Y+128|0,I=G+112|0,y=G+96|0,O=G,g=et(d|0,A|0,52)|0,Q()|0,E=g&15,h[I>>2]=E,b=et(d|0,A|0,45)|0,Q()|0,b=b&127;e:do if(ar(b)|0){if(E|0)for(_=1;;){if(M=ht(7,0,(15-_|0)*3|0)|0,!((M&d|0)==0&((Q()|0)&A|0)==0)){g=0;break e}if(_>>>0<E>>>0)_=_+1|0;else break}if(g&1)g=1;else return M=ht(E+1|0,0,52)|0,O=Q()|0|A&-15728641,I=ht(7,0,(14-E|0)*3|0)|0,O=R9((M|d)&~I,O&~(Q()|0),m)|0,Y=G,O|0}else g=0;while(!1);if(_=rg(d,A,y)|0,!_){g?(S9(y,I,O),M=5):(T9(y,I,O),M=6);e:do if(ar(b)|0)if(!E)d=5;else for(_=1;;){if(b=ht(7,0,(15-_|0)*3|0)|0,!((b&d|0)==0&((Q()|0)&A|0)==0)){d=2;break e}if(_>>>0<E>>>0)_=_+1|0;else{d=5;break}}else d=2;while(!1);fd(m|0,-1,d<<2|0)|0;e:do if(g)for(y=0;;){if(b=O+(y<<4)|0,jre(b,h[I>>2]|0)|0,b=h[b>>2]|0,E=h[m>>2]|0,(E|0)==-1|(E|0)==(b|0))_=m;else{g=0;do{if(g=g+1|0,g>>>0>=d>>>0){_=1;break e}_=m+(g<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,y=y+1|0,y>>>0>=M>>>0){_=0;break}}else for(y=0;;){if(b=O+(y<<4)|0,ig(b,h[I>>2]|0,0,1)|0,b=h[b>>2]|0,E=h[m>>2]|0,(E|0)==-1|(E|0)==(b|0))_=m;else{g=0;do{if(g=g+1|0,g>>>0>=d>>>0){_=1;break e}_=m+(g<<2)|0,E=h[_>>2]|0}while(!((E|0)==-1|(E|0)==(b|0)))}if(h[_>>2]=b,y=y+1|0,y>>>0>=M>>>0){_=0;break}}while(!1)}return O=_,Y=G,O|0}function rse(){return 12}function O4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0;if(d>>>0>15)return E=4,E|0;if(ht(d|0,0,52)|0,E=Q()|0|134225919,!d){m=0,_=0;do ar(_)|0&&(ht(_|0,0,45)|0,b=E|(Q()|0),d=A+(m<<3)|0,h[d>>2]=-1,h[d+4>>2]=b,m=m+1|0),_=_+1|0;while((_|0)!=122);return m=0,m|0}m=0,b=0;do{if(ar(b)|0){for(ht(b|0,0,45)|0,_=1,g=-1,y=E|(Q()|0);M=ht(7,0,(15-_|0)*3|0)|0,g=g&~M,y=y&~(Q()|0),(_|0)!=(d|0);)_=_+1|0;M=A+(m<<3)|0,h[M>>2]=g,h[M+4>>2]=y,m=m+1|0}b=b+1|0}while((b|0)!=122);return m=0,m|0}function sse(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0;if(re=Y,Y=Y+16|0,ue=re,_e=et(d|0,A|0,52)|0,Q()|0,_e=_e&15,m>>>0>15)return _e=4,Y=re,_e|0;if((_e|0)<(m|0))return _e=12,Y=re,_e|0;if((_e|0)!=(m|0))if(y=ht(m|0,0,52)|0,y=y|d,E=Q()|0|A&-15728641,(_e|0)>(m|0)){M=m;do oe=ht(7,0,(14-M|0)*3|0)|0,M=M+1|0,y=oe|y,E=Q()|0|E;while((M|0)<(_e|0));oe=y}else oe=y;else oe=d,E=A;$=et(oe|0,E|0,45)|0,Q()|0;e:do if(ar($&127)|0){if(M=et(oe|0,E|0,52)|0,Q()|0,M=M&15,M|0)for(y=1;;){if($=ht(7,0,(15-y|0)*3|0)|0,!(($&oe|0)==0&((Q()|0)&E|0)==0)){I=33;break e}if(y>>>0<M>>>0)y=y+1|0;else break}if($=_,h[$>>2]=0,h[$+4>>2]=0,(_e|0)>(m|0)){for($=A&-15728641,W=_e;;){if(q=W,W=W+-1|0,W>>>0>15|(_e|0)<(W|0)){I=19;break}if((_e|0)!=(W|0))if(y=ht(W|0,0,52)|0,y=y|d,M=Q()|0|$,(_e|0)<(q|0))G=y;else{I=W;do G=ht(7,0,(14-I|0)*3|0)|0,I=I+1|0,y=G|y,M=Q()|0|M;while((I|0)<(_e|0));G=y}else G=d,M=A;if(O=et(G|0,M|0,45)|0,Q()|0,!(ar(O&127)|0))y=0;else{O=et(G|0,M|0,52)|0,Q()|0,O=O&15;t:do if(!O)y=0;else for(I=1;;){if(y=et(G|0,M|0,(15-I|0)*3|0)|0,Q()|0,y=y&7,y|0)break t;if(I>>>0<O>>>0)I=I+1|0;else{y=0;break}}while(!1);y=(y|0)==0&1}if(M=et(d|0,A|0,(15-q|0)*3|0)|0,Q()|0,M=M&7,(M|0)==7){g=5,I=42;break}if(y=(y|0)!=0,(M|0)==1&y){g=5,I=42;break}if(G=M+(((M|0)!=0&y)<<31>>31)|0,G|0&&(I=_e-q|0,I=cd(7,0,I,((I|0)<0)<<31>>31)|0,O=Q()|0,y?(y=cr(I|0,O|0,5,0)|0,y=pt(y|0,Q()|0,-5,-1)|0,y=ud(y|0,Q()|0,6,0)|0,y=pt(y|0,Q()|0,1,0)|0,M=Q()|0):(y=I,M=O),q=G+-1|0,q=cr(I|0,O|0,q|0,((q|0)<0)<<31>>31|0)|0,q=pt(y|0,M|0,q|0,Q()|0)|0,G=Q()|0,O=_,O=pt(q|0,G|0,h[O>>2]|0,h[O+4>>2]|0)|0,G=Q()|0,q=_,h[q>>2]=O,h[q+4>>2]=G),(W|0)<=(m|0)){I=37;break}}if((I|0)==19)ci(27634,27225,1407,27259);else if((I|0)==37){b=_,g=h[b+4>>2]|0,b=h[b>>2]|0;break}else if((I|0)==42)return Y=re,g|0}else g=0,b=0}else I=33;while(!1);e:do if((I|0)==33)if($=_,h[$>>2]=0,h[$+4>>2]=0,(_e|0)>(m|0)){for(y=_e;;){if(g=et(d|0,A|0,(15-y|0)*3|0)|0,Q()|0,g=g&7,(g|0)==7){g=5;break}if(b=_e-y|0,b=cd(7,0,b,((b|0)<0)<<31>>31)|0,g=cr(b|0,Q()|0,g|0,0)|0,b=Q()|0,$=_,b=pt(h[$>>2]|0,h[$+4>>2]|0,g|0,b|0)|0,g=Q()|0,$=_,h[$>>2]=b,h[$+4>>2]=g,y=y+-1|0,(y|0)<=(m|0))break e}return Y=re,g|0}else g=0,b=0;while(!1);return cx(oe,E,_e,ue)|0&&ci(27634,27225,1367,27274),_e=ue,ue=h[_e+4>>2]|0,((g|0)>-1|(g|0)==-1&b>>>0>4294967295)&((ue|0)>(g|0)|((ue|0)==(g|0)?(h[_e>>2]|0)>>>0>b>>>0:0))?(_e=0,Y=re,_e|0):(ci(27634,27225,1447,27259),0)}function ose(d,A,m,_,g,y){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0;var b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0;if(G=Y,Y=Y+16|0,b=G,g>>>0>15)return y=4,Y=G,y|0;if(E=et(m|0,_|0,52)|0,Q()|0,E=E&15,(E|0)>(g|0))return y=12,Y=G,y|0;if(cx(m,_,g,b)|0&&ci(27634,27225,1367,27274),O=b,I=h[O+4>>2]|0,!(((A|0)>-1|(A|0)==-1&d>>>0>4294967295)&((I|0)>(A|0)|((I|0)==(A|0)?(h[O>>2]|0)>>>0>d>>>0:0))))return y=2,Y=G,y|0;O=g-E|0,g=ht(g|0,0,52)|0,M=Q()|0|_&-15728641,I=y,h[I>>2]=g|m,h[I+4>>2]=M,I=et(m|0,_|0,45)|0,Q()|0;e:do if(ar(I&127)|0){if(E|0)for(b=1;;){if(I=ht(7,0,(15-b|0)*3|0)|0,!((I&m|0)==0&((Q()|0)&_|0)==0))break e;if(b>>>0<E>>>0)b=b+1|0;else break}if((O|0)<1)return y=0,Y=G,y|0;for(I=E^15,_=-1,M=1,b=1;;){E=O-M|0,E=cd(7,0,E,((E|0)<0)<<31>>31)|0,m=Q()|0;do if(b)if(b=cr(E|0,m|0,5,0)|0,b=pt(b|0,Q()|0,-5,-1)|0,b=ud(b|0,Q()|0,6,0)|0,g=Q()|0,(A|0)>(g|0)|(A|0)==(g|0)&d>>>0>b>>>0){A=pt(d|0,A|0,-1,-1)|0,A=Fs(A|0,Q()|0,b|0,g|0)|0,b=Q()|0,q=y,$=h[q>>2]|0,q=h[q+4>>2]|0,oe=(I+_|0)*3|0,W=ht(7,0,oe|0)|0,q=q&~(Q()|0),_=ud(A|0,b|0,E|0,m|0)|0,d=Q()|0,g=pt(_|0,d|0,2,0)|0,oe=ht(g|0,Q()|0,oe|0)|0,q=Q()|0|q,g=y,h[g>>2]=oe|$&~W,h[g+4>>2]=q,d=cr(_|0,d|0,E|0,m|0)|0,d=Fs(A|0,b|0,d|0,Q()|0)|0,b=0,A=Q()|0;break}else{oe=y,W=h[oe>>2]|0,oe=h[oe+4>>2]|0,$=ht(7,0,(I+_|0)*3|0)|0,oe=oe&~(Q()|0),b=y,h[b>>2]=W&~$,h[b+4>>2]=oe,b=1;break}else W=y,g=h[W>>2]|0,W=h[W+4>>2]|0,_=(I+_|0)*3|0,q=ht(7,0,_|0)|0,W=W&~(Q()|0),oe=ud(d|0,A|0,E|0,m|0)|0,b=Q()|0,_=ht(oe|0,b|0,_|0)|0,W=Q()|0|W,$=y,h[$>>2]=_|g&~q,h[$+4>>2]=W,b=cr(oe|0,b|0,E|0,m|0)|0,d=Fs(d|0,A|0,b|0,Q()|0)|0,b=0,A=Q()|0;while(!1);if((O|0)>(M|0))_=~M,M=M+1|0;else{A=0;break}}return Y=G,A|0}while(!1);if((O|0)<1)return oe=0,Y=G,oe|0;for(g=E^15,b=1;;)if($=O-b|0,$=cd(7,0,$,(($|0)<0)<<31>>31)|0,oe=Q()|0,M=y,m=h[M>>2]|0,M=h[M+4>>2]|0,E=(g-b|0)*3|0,_=ht(7,0,E|0)|0,M=M&~(Q()|0),q=ud(d|0,A|0,$|0,oe|0)|0,W=Q()|0,E=ht(q|0,W|0,E|0)|0,M=Q()|0|M,I=y,h[I>>2]=E|m&~_,h[I+4>>2]=M,oe=cr(q|0,W|0,$|0,oe|0)|0,d=Fs(d|0,A|0,oe|0,Q()|0)|0,A=Q()|0,(O|0)<=(b|0)){A=0;break}else b=b+1|0;return Y=G,A|0}function B4(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;g=et(A|0,m|0,52)|0,Q()|0,g=g&15,(A|0)==0&(m|0)==0|((_|0)>15|(g|0)>(_|0))?(y=-1,A=-1,m=0,g=0):(A=M9(A,m,g+1|0,_)|0,b=(Q()|0)&-15728641,m=ht(_|0,0,52)|0,m=A|m,b=b|(Q()|0),A=(ki(m,b)|0)==0,y=g,A=A?-1:_,g=b),b=d,h[b>>2]=m,h[b+4>>2]=g,h[d+8>>2]=y,h[d+12>>2]=A}function P9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;if(g=et(d|0,A|0,52)|0,Q()|0,g=g&15,y=_+8|0,h[y>>2]=g,(d|0)==0&(A|0)==0|((m|0)>15|(g|0)>(m|0))){m=_,h[m>>2]=0,h[m+4>>2]=0,h[y>>2]=-1,h[_+12>>2]=-1;return}if(d=M9(d,A,g+1|0,m)|0,y=(Q()|0)&-15728641,g=ht(m|0,0,52)|0,g=d|g,y=y|(Q()|0),d=_,h[d>>2]=g,h[d+4>>2]=y,d=_+12|0,ki(g,y)|0){h[d>>2]=m;return}else{h[d>>2]=-1;return}}function U4(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0;if(m=d,A=h[m>>2]|0,m=h[m+4>>2]|0,!((A|0)==0&(m|0)==0)&&(_=et(A|0,m|0,52)|0,Q()|0,_=_&15,E=ht(1,0,(_^15)*3|0)|0,A=pt(E|0,Q()|0,A|0,m|0)|0,m=Q()|0,E=d,h[E>>2]=A,h[E+4>>2]=m,E=d+8|0,b=h[E>>2]|0,!((_|0)<(b|0)))){for(M=d+12|0,y=_;;){if((y|0)==(b|0)){_=5;break}if(I=(y|0)==(h[M>>2]|0),g=(15-y|0)*3|0,_=et(A|0,m|0,g|0)|0,Q()|0,_=_&7,I&((_|0)==1&!0)){_=7;break}if(!((_|0)==7&!0)){_=10;break}if(I=ht(1,0,g|0)|0,A=pt(A|0,m|0,I|0,Q()|0)|0,m=Q()|0,I=d,h[I>>2]=A,h[I+4>>2]=m,(y|0)>(b|0))y=y+-1|0;else{_=10;break}}if((_|0)==5){I=d,h[I>>2]=0,h[I+4>>2]=0,h[E>>2]=-1,h[M>>2]=-1;return}else if((_|0)==7){b=ht(1,0,g|0)|0,b=pt(A|0,m|0,b|0,Q()|0)|0,E=Q()|0,I=d,h[I>>2]=b,h[I+4>>2]=E,h[M>>2]=y+-1;return}else if((_|0)==10)return}}function ux(d){d=+d;var A=0;return A=d<0?d+6.283185307179586:d,+(d>=6.283185307179586?A+-6.283185307179586:A)}function ul(d,A){switch(d=+d,A=A|0,A|0){case 1:{d=d<0?d+6.283185307179586:d;break}case 2:{d=d>0?d+-6.283185307179586:d;break}default:}return+d}function ase(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return g=+ne[A>>3],_=+ne[d>>3],y=+Ni(+((g-_)*.5)),m=+Ni(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Qn(+g)*+Qn(+_)*m),+(+ia(+ +is(+m),+ +is(+(1-m)))*2)}function hx(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return g=+ne[A>>3],_=+ne[d>>3],y=+Ni(+((g-_)*.5)),m=+Ni(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Qn(+g)*+Qn(+_)*m),+(+ia(+ +is(+m),+ +is(+(1-m)))*2*6371.007180918475)}function lse(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return g=+ne[A>>3],_=+ne[d>>3],y=+Ni(+((g-_)*.5)),m=+Ni(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Qn(+g)*+Qn(+_)*m),+(+ia(+ +is(+m),+ +is(+(1-m)))*2*6371.007180918475*1e3)}function I9(d,A){return d=d|0,A=A|0,d>>>0>15?(A=4,A|0):(ne[A>>3]=+ne[20624+(d<<3)>>3],A=0,A|0)}function cse(d,A){return d=d|0,A=A|0,d>>>0>15?(A=4,A|0):(ne[A>>3]=+ne[20752+(d<<3)>>3],A=0,A|0)}function use(d,A){return d=d|0,A=A|0,d>>>0>15?(A=4,A|0):(ne[A>>3]=+ne[20880+(d<<3)>>3],A=0,A|0)}function hse(d,A){return d=d|0,A=A|0,d>>>0>15?(A=4,A|0):(ne[A>>3]=+ne[21008+(d<<3)>>3],A=0,A|0)}function Qb(d,A){d=d|0,A=A|0;var m=0;return d>>>0>15?(A=4,A|0):(m=cd(7,0,d,((d|0)<0)<<31>>31)|0,m=cr(m|0,Q()|0,120,0)|0,d=Q()|0,h[A>>2]=m|2,h[A+4>>2]=d,A=0,A|0)}function fse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(E=Y,Y=Y+176|0,b=E,d=ax(d,A,b)|0,d|0)return b=d,Y=E,b|0;if(ne[m>>3]=0,d=h[b>>2]|0,(d|0)<=1)return b=0,Y=E,b|0;A=d+-1|0,d=0,_=+ne[b+8>>3],g=+ne[b+16>>3],y=0;do d=d+1|0,I=_,_=+ne[b+8+(d<<4)>>3],O=+Ni(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ni(+((g-M)*.5)),M=O*O+M*(+Qn(+_)*+Qn(+I)*M),y=y+ +ia(+ +is(+M),+ +is(+(1-M)))*2;while((d|0)<(A|0));return ne[m>>3]=y,b=0,Y=E,b|0}function dse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(E=Y,Y=Y+176|0,b=E,d=ax(d,A,b)|0,d|0)return b=d,y=+ne[m>>3],y=y*6371.007180918475,ne[m>>3]=y,Y=E,b|0;if(ne[m>>3]=0,d=h[b>>2]|0,(d|0)<=1)return b=0,y=0,y=y*6371.007180918475,ne[m>>3]=y,Y=E,b|0;A=d+-1|0,d=0,_=+ne[b+8>>3],g=+ne[b+16>>3],y=0;do d=d+1|0,I=_,_=+ne[b+8+(d<<4)>>3],O=+Ni(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ni(+((g-M)*.5)),M=O*O+M*(+Qn(+I)*+Qn(+_)*M),y=y+ +ia(+ +is(+M),+ +is(+(1-M)))*2;while((d|0)!=(A|0));return ne[m>>3]=y,b=0,O=y,O=O*6371.007180918475,ne[m>>3]=O,Y=E,b|0}function pse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(E=Y,Y=Y+176|0,b=E,d=ax(d,A,b)|0,d|0)return b=d,y=+ne[m>>3],y=y*6371.007180918475,y=y*1e3,ne[m>>3]=y,Y=E,b|0;if(ne[m>>3]=0,d=h[b>>2]|0,(d|0)<=1)return b=0,y=0,y=y*6371.007180918475,y=y*1e3,ne[m>>3]=y,Y=E,b|0;A=d+-1|0,d=0,_=+ne[b+8>>3],g=+ne[b+16>>3],y=0;do d=d+1|0,I=_,_=+ne[b+8+(d<<4)>>3],O=+Ni(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ni(+((g-M)*.5)),M=O*O+M*(+Qn(+I)*+Qn(+_)*M),y=y+ +ia(+ +is(+M),+ +is(+(1-M)))*2;while((d|0)!=(A|0));return ne[m>>3]=y,b=0,O=y,O=O*6371.007180918475,O=O*1e3,ne[m>>3]=O,Y=E,b|0}function Ase(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0;if(d)for(y=d+4|0,b=d+8|0,_=1,g=d;;){if(A=h[g>>2]|0,A|0)do{if(m=h[A>>2]|0,m|0)do E=m,m=h[m+16>>2]|0,_t(E);while((m|0)!=0);E=A,A=h[A+8>>2]|0,_t(E)}while((A|0)!=0);if(A=g,g=h[g+8>>2]|0,_?(h[d>>2]=0,h[y>>2]=0,h[b>>2]=0):_t(A),g)_=0;else break}}function mse(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0;if(h[A>>2]=0,ue=A+4|0,h[ue>>2]=0,_e=A+8|0,h[_e>>2]=0,oe=h[d>>2]|0,(oe|0)<=0)return A=0,A|0;$=d+4|0,d=A,W=0;e:for(;;){if(W){if(m=ra(1,12)|0,!m){m=5;break}h[d+8>>2]=m,d=m}if(M=h[$>>2]|0,I=ra(1,12)|0,!I){d=13,m=37;break}if(q=d+4|0,_=h[q>>2]|0,h[((_|0)==0?d:_+8|0)>>2]=I,h[q>>2]=I,_=h[M+(W<<4)>>2]|0,(_|0)<3){d=1,m=37;break}g=M+(W<<4)+4|0,y=I+4|0,m=0,b=0;do{if(E=b,b=lr(24)|0,!b){d=13,m=37;break e}j4(b|0,(h[g>>2]|0)+(m<<4)|0,16)|0,h[b+16>>2]=0,E?h[E+16>>2]=b:h[I>>2]=b,h[y>>2]=b,m=m+1|0}while((m|0)<(_|0));if(G=h[M+(W<<4)+8>>2]|0,(G|0)>0){O=M+(W<<4)+12|0,M=0;do{if(_=h[O>>2]|0,m=I,I=ra(1,12)|0,!I){d=13,m=37;break e}if(h[m+8>>2]=I,h[q>>2]=I,E=h[_+(M<<3)>>2]|0,(E|0)<3){d=1,m=37;break e}_=_+(M<<3)+4|0,g=I+4|0,m=0,y=0;do{if(b=y,y=lr(24)|0,!y){d=13,m=37;break e}j4(y|0,(h[_>>2]|0)+(m<<4)|0,16)|0,h[y+16>>2]=0,b?h[b+16>>2]=y:h[I>>2]=y,h[g>>2]=y,m=m+1|0}while((m|0)<(E|0));M=M+1|0}while((M|0)<(G|0))}if(W=W+1|0,(W|0)>=(oe|0)){d=0,m=50;break}}if((m|0)==5){if(!A)return A=13,A|0;for(_=1,g=A;;){if(d=h[g>>2]|0,d|0)do{if(m=h[d>>2]|0,m|0)do oe=m,m=h[m+16>>2]|0,_t(oe);while((m|0)!=0);oe=d,d=h[d+8>>2]|0,_t(oe)}while((d|0)!=0);if(d=g,g=h[g+8>>2]|0,_?(h[A>>2]=0,h[ue>>2]=0,h[_e>>2]=0):_t(d),g)_=0;else{d=13;break}}return d|0}else if((m|0)==37){if(!A)return A=d,A|0;for(g=1,y=A;;){if(m=h[y>>2]|0,m|0)do{if(_=h[m>>2]|0,_|0)do oe=_,_=h[_+16>>2]|0,_t(oe);while((_|0)!=0);oe=m,m=h[m+8>>2]|0,_t(oe)}while((m|0)!=0);if(m=y,y=h[y+8>>2]|0,g?(h[A>>2]=0,h[ue>>2]=0,h[_e>>2]=0):_t(m),y)g=0;else break}return d|0}else if((m|0)==50)return d|0;return 0}function fx(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0;if(_e=Y,Y=Y+16|0,ue=_e,O=et(d|0,A|0,52)|0,Q()|0,O=O&15,W=et(m|0,_|0,52)|0,Q()|0,(O|0)!=(W&15|0))return ue=12,Y=_e,ue|0;if(M=et(d|0,A|0,45)|0,Q()|0,M=M&127,I=et(m|0,_|0,45)|0,Q()|0,I=I&127,M>>>0>121|I>>>0>121)return ue=5,Y=_e,ue|0;if(W=(M|0)!=(I|0),W){if(b=S4(M,I)|0,(b|0)==7)return ue=1,Y=_e,ue|0;E=S4(I,M)|0,(E|0)==7?ci(27291,27315,164,27325):(oe=b,y=E)}else oe=0,y=0;G=ar(M)|0,q=ar(I)|0,h[ue>>2]=0,h[ue+4>>2]=0,h[ue+8>>2]=0,h[ue+12>>2]=0;do if(oe){I=h[4272+(M*28|0)+(oe<<2)>>2]|0,b=(I|0)>0;e:do if(q)if(b)for(M=0,E=m,b=_;;){switch(E=tse(E,b)|0,b=Q()|0,y|0){case 5:case 1:{y=3;break}case 3:{y=2;break}case 2:{y=6;break}case 6:{y=4;break}case 4:{y=5;break}default:}if(M=M+1|0,(M|0)==(I|0)){I=y,M=E,E=b;break e}}else I=y,M=m,E=_;else if(b)for(M=0,E=m,b=_;;){switch(E=L4(E,b)|0,b=Q()|0,y|0){case 1:{y=3;break}case 3:{y=2;break}case 2:{y=6;break}case 6:{y=4;break}case 4:{y=5;break}case 5:{y=1;break}default:}if(M=M+1|0,(M|0)==(I|0)){I=y,M=E,E=b;break e}}else I=y,M=m,E=_;while(!1);if(F4(M,E,ue)|0,W||ci(27340,27315,194,27325),b=(G|0)!=0,y=(q|0)!=0,b&y&&ci(27367,27315,195,27325),b){if(y=Oa(d,A)|0,(y|0)==7){y=5;break}if(He[21968+(y*7|0)+oe>>0]|0){y=1;break}q=h[21136+(y*28|0)+(oe<<2)>>2]|0,W=q}else if(y){if(y=Oa(M,E)|0,(y|0)==7){y=5;break}if(He[21968+(y*7|0)+I>>0]|0){y=1;break}W=0,q=h[21136+(I*28|0)+(y<<2)>>2]|0}else W=0,q=0;if((W|q|0)>=0){if((q|0)>0){m=ue+4|0,_=ue+8|0,G=ue+12|0,I=0,E=h[m>>2]|0,b=h[_>>2]|0,y=h[G>>2]|0;do $=b+E|0,A=($|0)<0,re=A?$:0,b=y+b-re|0,d=(b|0)<0,M=d?b:0,E=y+E-re-M|0,re=(E|0)<0,y=re?0:E,E=re?E:0,b=(d?0:b)-E|0,E=(A?0:$)-M-E|0,M=(b|0)<(E|0)?b:E,M=(y|0)<(M|0)?y:M,(M|0)>0&&(E=E-M|0,b=b-M|0,y=y-M|0),I=I+1|0;while((I|0)!=(q|0));h[m>>2]=E,h[_>>2]=b,h[G>>2]=y}if((oe+-1|0)>>>0<6?(y=h[22032+(oe*12|0)>>2]|0,E=h[22032+(oe*12|0)+4>>2]|0,re=h[22032+(oe*12|0)+8>>2]|0,b=(E|0)<(y|0)?E:y,b=(re|0)<(b|0)?re:b,b=(b|0)>0?b:0,y=y-b|0,E=E-b|0,b=re-b|0):(y=0,E=0,b=0),O)for(;;)if(M=y*3|0,I=E*3|0,m=b*3|0,zl(O)|0?(A=M+E|0,d=(A|0)<0,re=I+b-(d?A:0)|0,$=(re|0)<0,E=y+m-(d?A:0)-($?re:0)|0,b=(E|0)<0,oe=b?0:E,M=($?0:re)-(b?E:0)|0,E=(d?0:A)-($?re:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(oe|0)<(b|0)?oe:b,re=(b|0)>0,y=re?b:0,M=M-(re?b:0)|0,b=oe-(re?b:0)|0):($=M+b|0,A=($|0)<0,re=I+y-(A?$:0)|0,y=(re|0)<0,E=m+E-(A?$:0)-(y?re:0)|0,b=(E|0)<0,oe=b?0:E,M=(y?0:re)-(b?E:0)|0,E=(A?0:$)-(y?re:0)-(b?E:0)|0,b=(M|0)<(E|0)?M:E,b=(oe|0)<(b|0)?oe:b,re=(b|0)>0,y=re?b:0,M=M-(re?b:0)|0,b=oe-(re?b:0)|0),y=E-y|0,(O|0)>1)O=O+-1|0,E=M;else{E=M;break}if((W|0)>0){M=0;do A=y+E|0,d=(A|0)<0,re=E+b-(d?A:0)|0,$=(re|0)<0,oe=y+b-(d?A:0)-($?re:0)|0,y=(oe|0)<0,b=y?0:oe,E=($?0:re)-(y?oe:0)|0,oe=(d?0:A)-($?re:0)-(y?oe:0)|0,y=(E|0)<(oe|0)?E:oe,y=(b|0)<(y|0)?b:y,re=(y|0)>0,b=b-(re?y:0)|0,E=E-(re?y:0)|0,y=oe-(re?y:0)|0,M=M+1|0;while((M|0)!=(W|0))}m=ue+4|0,O=ue+8|0,oe=h[O>>2]|0,_=ue+12|0,re=h[_>>2]|0,M=(h[m>>2]|0)+y|0,h[m>>2]=M,E=oe+E|0,h[O>>2]=E,y=re+b|0,h[_>>2]=y,b=E-M|0,(M|0)<0?(y=y-M|0,h[O>>2]=b,h[_>>2]=y,h[m>>2]=0,E=0):(b=E,E=M),(b|0)<0&&(E=E-b|0,h[m>>2]=E,y=y-b|0,h[_>>2]=y,h[O>>2]=0,b=0),I=E-y|0,M=b-y|0,(y|0)<0?(h[m>>2]=I,h[O>>2]=M,h[_>>2]=0,E=I,y=0):M=b,b=(M|0)<(E|0)?M:E,b=(y|0)<(b|0)?y:b,(b|0)>0&&(h[m>>2]=E-b,h[O>>2]=M-b,h[_>>2]=y-b),$=77}else y=5}else if(F4(m,_,ue)|0,(G|0)!=0&(q|0)!=0)if((I|0)!=(M|0)&&ci(27398,27315,264,27325),b=Oa(d,A)|0,y=Oa(m,_)|0,(b|0)==7|(y|0)==7)y=5;else if(He[21968+(b*7|0)+y>>0]|0)y=1;else if(m=h[21136+(b*28|0)+(y<<2)>>2]|0,(m|0)>0){O=ue+4|0,_=ue+8|0,G=ue+12|0,I=0,E=h[O>>2]|0,b=h[_>>2]|0,y=h[G>>2]|0;do oe=b+E|0,$=(oe|0)<0,d=$?oe:0,b=y+b-d|0,A=(b|0)<0,M=A?b:0,E=y+E-d-M|0,d=(E|0)<0,y=d?0:E,E=d?E:0,b=(A?0:b)-E|0,E=($?0:oe)-M-E|0,M=(b|0)<(E|0)?b:E,M=(y|0)<(M|0)?y:M,(M|0)>0&&(E=E-M|0,b=b-M|0,y=y-M|0),I=I+1|0;while((I|0)!=(m|0));h[O>>2]=E,h[_>>2]=b,h[G>>2]=y,$=77}else $=77;else $=77;while(!1);return($|0)==77&&(y=ue+4|0,h[g>>2]=h[y>>2],h[g+4>>2]=h[y+4>>2],h[g+8>>2]=h[y+8>>2],y=0),re=y,Y=_e,re|0}function N9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0;if(y=et(d|0,A|0,52)|0,Q()|0,y=y&15,me=et(d|0,A|0,45)|0,Q()|0,me=me&127,me>>>0>121)return _=5,_|0;if(ue=ar(me)|0,ht(y|0,0,52)|0,E=Q()|0|134225919,b=_,h[b>>2]=-1,h[b+4>>2]=E,b=h[m>>2]|0,E=h[m+4>>2]|0,m=h[m+8>>2]|0,!y){A=(b|0)<0,_e=A?b:0,be=E-_e|0,ue=(be|0)<0,_e=(ue?0-be|0:0)+(m-_e)|0,m=(_e|0)<0,g=m?0:_e,_e=m?_e:0,m=(ue?0:be)-_e|0,_e=(A?0:b)-(ue?be:0)-_e|0,be=(m|0)<(_e|0)?m:_e,be=(g|0)<(be|0)?g:be,be=(be|0)>0?be:0,g=g-be|0,m=m-be|0;e:do switch(_e-be|0){case 0:switch(m|0){case 0:if(g){g=(g|0)==1?1:7,re=11;break e}else{g=0;break e}case 1:if(g){g=(g|0)==1?3:7,re=11;break e}else{g=2;break e}default:return _=1,_|0}case 1:switch(m|0){case 0:if(g){g=(g|0)==1?5:7,re=11;break e}else{g=4;break e}case 1:{if(g)g=1;else{g=6;break e}return g|0}default:return _=1,_|0}default:return _=1,_|0}while(!1);return(re|0)==11&&(g|0)==7||(g=w4(me,g)|0,(g|0)==127)?(_=1,_|0):(be=ht(g|0,0,45)|0,me=Q()|0,re=_,me=h[re+4>>2]&-1040385|me,h[_>>2]=h[re>>2]|be,h[_+4>>2]=me,_=0,_|0)}for(;;){if(oe=y,y=y+-1|0,$=b-m|0,W=E-m|0,M=$>>>0>715827881|W>>>0>715827881,zl(oe)|0){if(M){if(O=($|0)>0,G=2147483647-$|0,q=-2147483648-$|0,O?(G|0)<($|0):(q|0)>($|0)){g=1,re=107;break}if(ye=$<<1,O?(2147483647-ye|0)<($|0):(-2147483648-ye|0)>($|0)){g=1,re=107;break}if((W|0)>0?(2147483647-W|0)<(W|0):(-2147483648-W|0)>(W|0)){g=1,re=107;break}if(M=$*3|0,I=W<<1,(O?(G|0)<(I|0):(q|0)>(I|0))||(($|0)>-1?(M|-2147483648|0)>=(W|0):(M^-2147483648|0)<(W|0))){g=1,re=107;break}}else M=$*3|0,I=W<<1;if(G=gu(+(M-W|0)*.14285714285714285)|0,O=gu(+(I+$|0)*.14285714285714285)|0,I=(O|0)<(G|0),M=I?G:O,I=I?O:G,(I|0)<0){if((I|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(I|0):(-2147483648-M|0)>(I|0))){re=24;break}if((M|0)>-1?(M|-2147483648|0)>=(I|0):(M^-2147483648|0)<(I|0)){re=24;break}}q=(G|0)<0,W=O-(q?G:0)|0,Ze=(W|0)<0,Fe=(q?0-G|0:0)-(Ze?W:0)|0,$=(Fe|0)<0,q=(q?0:G)-(Ze?W:0)-($?Fe:0)|0,W=(Ze?0:W)-($?Fe:0)|0,Fe=$?0:Fe,$=(W|0)<(q|0)?W:q,$=(Fe|0)<($|0)?Fe:$,Ze=($|0)>0,q=q-(Ze?$:0)|0,W=W-(Ze?$:0)|0,$=Fe-(Ze?$:0)|0,Ze=(q*3|0)+W|0,Fe=(Ze|0)<0,ye=(W*3|0)+$-(Fe?Ze:0)|0,M=(ye|0)<0,G=($*3|0)+q-(Fe?Ze:0)-(M?ye:0)|0,O=(G|0)<0,Ee=O?0:G,I=(M?0:ye)-(O?G:0)|0,G=(Fe?0:Ze)-(M?ye:0)-(O?G:0)|0,O=(I|0)<(G|0)?I:G,O=(Ee|0)<(O|0)?Ee:O,ye=(O|0)>0,M=ye?O:0,I=I-(ye?O:0)|0,O=Ee-(ye?O:0)|0}else{if(M){if(I=($|0)>0,I?(2147483647-$|0)<($|0):(-2147483648-$|0)>($|0)){g=1,re=107;break}if(M=$<<1,O=(W|0)>0,O?(2147483647-W|0)<(W|0):(-2147483648-W|0)>(W|0)){g=1,re=107;break}if(q=W<<1,O?(2147483647-q|0)<(W|0):(-2147483648-q|0)>(W|0)){g=1,re=107;break}if(I?(2147483647-M|0)<(W|0):(-2147483648-M|0)>(W|0)){g=1,re=107;break}if(I=W*3|0,(W|0)>-1?(I|-2147483648|0)>=($|0):(I^-2147483648|0)<($|0)){g=1,re=107;break}}else M=$<<1,I=W*3|0;if(G=gu(+(M+W|0)*.14285714285714285)|0,O=gu(+(I-$|0)*.14285714285714285)|0,I=(O|0)<(G|0),M=I?G:O,I=I?O:G,(I|0)<0){if((I|0)==-2147483648||((M|0)>0?(2147483647-M|0)<(I|0):(-2147483648-M|0)>(I|0))){re=36;break}if((M|0)>-1?(M|-2147483648|0)>=(I|0):(M^-2147483648|0)<(I|0)){re=36;break}}q=(G|0)<0,W=O-(q?G:0)|0,Ee=(W|0)<0,ye=(q?0-G|0:0)-(Ee?W:0)|0,$=(ye|0)<0,q=(q?0:G)-(Ee?W:0)-($?ye:0)|0,W=(Ee?0:W)-($?ye:0)|0,ye=$?0:ye,$=(W|0)<(q|0)?W:q,$=(ye|0)<($|0)?ye:$,Ee=($|0)>0,q=q-(Ee?$:0)|0,W=W-(Ee?$:0)|0,$=ye-(Ee?$:0)|0,Ee=(q*3|0)+$|0,ye=(Ee|0)<0,Fe=(W*3|0)+q-(ye?Ee:0)|0,M=(Fe|0)<0,G=($*3|0)+W-(ye?Ee:0)-(M?Fe:0)|0,O=(G|0)<0,Ze=O?0:G,I=(M?0:Fe)-(O?G:0)|0,G=(ye?0:Ee)-(M?Fe:0)-(O?G:0)|0,O=(I|0)<(G|0)?I:G,O=(Ze|0)<(O|0)?Ze:O,Fe=(O|0)>0,M=Fe?O:0,I=I-(Fe?O:0)|0,O=Ze-(Fe?O:0)|0}M=b+(M-G)|0,Ee=(M|0)<0,I=E-I-(Ee?M:0)|0,G=(I|0)<0,Fe=m-O+(Ee?0-M|0:0)+(G?0-I|0:0)|0,b=(Fe|0)<0,O=b?0:Fe,ye=(G?0:I)-(b?Fe:0)|0,Fe=(Ee?0:M)-(G?I:0)-(b?Fe:0)|0,b=(ye|0)<(Fe|0)?ye:Fe,b=(O|0)<(b|0)?O:b,m=(b|0)>0,Fe=Fe-(m?b:0)|0,I=_,G=h[I>>2]|0,I=h[I+4>>2]|0,E=(15-oe|0)*3|0,M=ht(7,0,E|0)|0,M=G&~M,I=I&~(Q()|0),G=(Fe|0)<0,Ee=G?Fe:0,ye=ye-(m?b:0)-Ee|0,Ze=(ye|0)<0,Ee=(Ze?0-ye|0:0)+(O-(m?b:0)-Ee)|0,b=(Ee|0)<0,m=b?0:Ee,Ee=b?Ee:0,b=(Ze?0:ye)-Ee|0,Ee=(G?0:Fe)-(Ze?ye:0)-Ee|0,ye=(b|0)<(Ee|0)?b:Ee,ye=(m|0)<(ye|0)?m:ye,ye=(ye|0)>0?ye:0,m=m-ye|0,b=b-ye|0;e:do switch(Ee-ye|0){case 0:switch(b|0){case 0:{m=(m|0)==0?0:(m|0)==1?1:7;break e}case 1:{m=(m|0)==0?2:(m|0)==1?3:7;break e}default:{re=45;break e}}case 1:switch(b|0){case 0:{m=(m|0)==0?4:(m|0)==1?5:7;break e}case 1:if(m){re=45;break e}else{m=6;break e}default:{re=45;break e}}default:re=45}while(!1);if((re|0)==45&&(re=0,m=7),Ze=ht(m|0,0,E|0)|0,Ee=Q()|0|I,ye=_,h[ye>>2]=Ze|M,h[ye+4>>2]=Ee,(oe|0)<=1){re=47;break}else b=q,E=W,m=$}if((re|0)==24)ci(27634,27425,416,27447);else if((re|0)==36)ci(27634,27425,464,27461);else if((re|0)==47){if((q|0)>1|(W|0)>1|($|0)>1)return ye=1,ye|0;Fe=(q|0)<0,Ee=Fe?q:0,ye=W-Ee|0,Ze=(ye|0)<0,Ee=(Ze?0-ye|0:0)+($-Ee)|0,y=(Ee|0)<0,m=y?0:Ee,Ee=y?Ee:0,y=(Ze?0:ye)-Ee|0,Ee=(Fe?0:q)-(Ze?ye:0)-Ee|0,ye=(y|0)<(Ee|0)?y:Ee,ye=(m|0)<(ye|0)?m:ye,ye=(ye|0)>0?ye:0,m=m-ye|0,y=y-ye|0;e:do switch(Ee-ye|0){case 0:switch(y|0){case 0:{y=(m|0)==0?0:(m|0)==1?1:7;break e}case 1:{y=(m|0)==0?2:(m|0)==1?3:7;break e}default:{re=55;break e}}case 1:switch(y|0){case 0:{y=(m|0)==0?4:(m|0)==1?5:7;break e}case 1:if(m){re=55;break e}else{y=6;break e}default:{re=55;break e}}default:re=55}while(!1);(re|0)==55&&(y=7),E=w4(me,y)|0,(E|0)==127?I=0:I=ar(E)|0;e:do if(y){if(ue){if(m=Oa(d,A)|0,(m|0)==7)return ye=5,ye|0;b=h[21344+(m*28|0)+(y<<2)>>2]|0;t:do if((b|0)>0)for(m=y,y=0;;){switch(m|0){case 1:{m=5;break}case 5:{m=4;break}case 4:{m=6;break}case 6:{m=2;break}case 2:{m=3;break}case 3:{m=1;break}default:}if(y=y+1|0,(y|0)==(b|0))break t}else m=y;while(!1);if((m|0)==1)return ye=9,ye|0;y=w4(me,m)|0,(y|0)==127&&ci(27476,27315,415,27506),ar(y)|0?ci(27521,27315,416,27506):(g=y,be=b,_e=m)}else g=E,be=0,_e=y;if(M=h[4272+(me*28|0)+(_e<<2)>>2]|0,(M|0)<=-1&&ci(27552,27315,423,27506),!I){if((be|0)<0)return ye=5,ye|0;if(be|0){b=_,m=0,y=h[b>>2]|0,b=h[b+4>>2]|0;do y=N0(y,b)|0,b=Q()|0,ye=_,h[ye>>2]=y,h[ye+4>>2]=b,m=m+1|0;while((m|0)<(be|0))}if((M|0)<=0){re=104;break}for(b=_,m=0,y=h[b>>2]|0,b=h[b+4>>2]|0;;)if(y=N0(y,b)|0,b=Q()|0,ye=_,h[ye>>2]=y,h[ye+4>>2]=b,m=m+1|0,(m|0)==(M|0)){re=104;break e}}if(E=S4(g,me)|0,(E|0)==7&&ci(27291,27315,432,27506),m=_,y=h[m>>2]|0,m=h[m+4>>2]|0,(M|0)>0){b=0;do y=N0(y,m)|0,m=Q()|0,ye=_,h[ye>>2]=y,h[ye+4>>2]=m,b=b+1|0;while((b|0)!=(M|0))}if(m=Oa(y,m)|0,(m|0)==7&&ci(27634,27315,444,27506),y=b4(g)|0,y=h[(y?21760:21552)+(E*28|0)+(m<<2)>>2]|0,(y|0)<0&&ci(27634,27315,458,27506),!y)re=104;else{E=_,m=0,b=h[E>>2]|0,E=h[E+4>>2]|0;do b=N4(b,E)|0,E=Q()|0,ye=_,h[ye>>2]=b,h[ye+4>>2]=E,m=m+1|0;while((m|0)<(y|0));re=104}}else if((ue|0)!=0&(I|0)!=0){if(g=Oa(d,A)|0,m=_,m=Oa(h[m>>2]|0,h[m+4>>2]|0)|0,(g|0)==7|(m|0)==7||(m=h[21344+(g*28|0)+(m<<2)>>2]|0,(m|0)<0))return ye=5,ye|0;if(!m)g=E,re=105;else{b=_,g=0,y=h[b>>2]|0,b=h[b+4>>2]|0;do y=N0(y,b)|0,b=Q()|0,ye=_,h[ye>>2]=y,h[ye+4>>2]=b,g=g+1|0;while((g|0)<(m|0));g=E,re=104}}else g=E,re=104;while(!1);return(re|0)==104&&I&&(re=105),(re|0)==105&&(ye=_,(Oa(h[ye>>2]|0,h[ye+4>>2]|0)|0)==1)?(ye=9,ye|0):(Ee=_,Fe=h[Ee>>2]|0,Ee=h[Ee+4>>2]&-1040385,Ze=ht(g|0,0,45)|0,Ee=Ee|(Q()|0),ye=_,h[ye>>2]=Fe|Ze,h[ye+4>>2]=Ee,ye=0,ye|0)}else if((re|0)==107)return g|0;return 0}function gse(d,A,m,_,g,y){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0;var b=0,E=0;return E=Y,Y=Y+16|0,b=E,g|0?(b=15,Y=E,b|0):(d=fx(d,A,m,_,b)|0,d||(g=h[b+4>>2]|0,d=h[b+8>>2]|0,h[y>>2]=(h[b>>2]|0)-d,h[y+4>>2]=g-d,d=0),b=d,Y=E,b|0)}function _se(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0;return G=Y,Y=Y+16|0,O=G,_|0?(O=15,Y=G,O|0):(E=h[m>>2]|0,b=h[m+4>>2]|0,h[O>>2]=E,M=O+4|0,h[M>>2]=b,I=O+8|0,h[I>>2]=0,m=(b|0)<(E|0),_=m?E:b,m=m?b:E,(m|0)<0?!((m|0)==-2147483648||((_|0)>0?(2147483647-_|0)<(m|0):(-2147483648-_|0)>(m|0)))&&!((_|0)>-1?(_|-2147483648|0)>=(m|0):(_^-2147483648|0)<(m|0))?y=5:_=1:y=5,(y|0)==5&&(_=b-E|0,y=0-E|0,(E|0)<0?(h[M>>2]=_,h[I>>2]=y,h[O>>2]=0,E=0):(_=b,y=0),b=E-_|0,m=y-_|0,(_|0)<0?(h[O>>2]=b,h[I>>2]=m,h[M>>2]=0,E=b,_=0):m=y,b=E-m|0,y=_-m|0,(m|0)<0?(h[O>>2]=b,h[M>>2]=y,h[I>>2]=0,m=0):(y=_,b=E),_=(y|0)<(b|0)?y:b,_=(m|0)<(_|0)?m:_,(_|0)>0&&(h[O>>2]=b-_,h[M>>2]=y-_,h[I>>2]=m-_),_=N9(d,A,O,g)|0),O=_,Y=G,O|0)}function k4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0;return M=Y,Y=Y+32|0,b=M+12|0,E=M,y=fx(d,A,d,A,b)|0,y|0?(E=y,Y=M,E|0):(d=fx(d,A,m,_,E)|0,d|0?(E=d,Y=M,E|0):(d=(h[b>>2]|0)-(h[E>>2]|0)|0,I=(d|0)<0,_=I?0-d|0:0,m=_+((h[b+4>>2]|0)-(h[E+4>>2]|0))|0,A=(m|0)<0,_=(h[b+8>>2]|0)-(h[E+8>>2]|0)+_+(A?0-m|0:0)|0,y=(_|0)<0,b=y?0:_,_=y?_:0,y=(A?0:m)-_|0,_=(I?0:d)-(A?m:0)-_|0,E=(y|0)<(_|0)?y:_,E=(b|0)<(E|0)?b:E,E=(E|0)>0?E:0,b=b-E|0,y=y-E|0,E=_-E|0,E=(E|0)>-1?E:0-E|0,y=(y|0)>-1?y:0-y|0,b=(b|0)>-1?b:0-b|0,b=(y|0)>(b|0)?y:b,b=(E|0)>(b|0)?E:b,E=g,h[E>>2]=b,h[E+4>>2]=((b|0)<0)<<31>>31,E=0,Y=M,E|0))}function xse(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0;return b=Y,Y=Y+16|0,y=b,d=k4(d,A,m,_,y)|0,d|0?(y=d,Y=b,y|0):(m=y,m=pt(h[m>>2]|0,h[m+4>>2]|0,1,0)|0,_=Q()|0,y=g,h[y>>2]=m,h[y+4>>2]=_,y=0,Y=b,y|0)}function yse(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0;return M=Y,Y=Y+16|0,y=M,b=k4(d,A,m,_,y)|0,b|0?(g=b,Y=M,g|0):(b=y,y=h[b>>2]|0,b=h[b+4>>2]|0,(y|0)==0&(b|0)==0?(h[g>>2]=d,h[g+4>>2]=A,g=0,Y=M,g|0):(E=L9(d,A,m,_,y,b,g,0,0,1,0)|0,E?(g=(L9(m,_,d,A,y,b,g,y,b,-1,-1)|0)==0,g=g?0:E,Y=M,g|0):(g=0,Y=M,g|0)))}function L9(d,A,m,_,g,y,b,E,M,I,O){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0,E=E|0,M=M|0,I=I|0,O=O|0;var G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0,At=0,We=0,Ot=0,at=0;if(Ot=Y,Y=Y+48|0,G=Ot+24|0,q=Ot+12|0,We=Ot,h[G>>2]=0,h[G+4>>2]=0,h[G+8>>2]=0,h[q>>2]=0,h[q+4>>2]=0,h[q+8>>2]=0,fx(d,A,d,A,G)|0&&ci(27634,27315,696,27575),fx(d,A,m,_,q)|0&&ci(27634,27315,701,27575),oe=G+8|0,_=h[oe>>2]|0,m=_-(h[G>>2]|0)|0,h[G>>2]=m,At=G+4|0,_=(h[At>>2]|0)-_|0,h[At>>2]=_,At=_+m|0,G=0-At|0,h[oe>>2]=G,oe=q+8|0,re=h[oe>>2]|0,_e=re-(h[q>>2]|0)|0,h[q>>2]=_e,ye=q+4|0,re=(h[ye>>2]|0)-re|0,h[ye>>2]=re,ye=re+_e|0,h[oe>>2]=0-ye,Ee=1/(+(g>>>0)+4294967296*+(y|0)),Fe=Ee*+(_e-m|0),Ze=Ee*+(re-_|0),Ee=Ee*+(At-ye|0),h[We>>2]=m,ye=We+4|0,h[ye>>2]=_,At=We+8|0,h[At>>2]=G,(y|0)<0)return I=0,Y=Ot,I|0;for(me=+(m|0),be=+(_|0),ue=+(G|0),_e=0,re=0;;){if($=+(_e>>>0)+4294967296*+(re|0),at=Fe*$+me,W=Ze*$+be,$=Ee*$+ue,_=~~+ow(+at),G=~~+ow(+W),m=~~+ow(+$),at=+Ls(+(+(_|0)-at)),W=+Ls(+(+(G|0)-W)),$=+Ls(+(+(m|0)-$)),at>W&at>$?(q=m+G|0,_=0-q|0):(q=0-_|0,W>$&&(G=q-m|0)),h[ye>>2]=G,h[We>>2]=q,h[At>>2]=0,m=_+G|0,(_|0)>0?(h[ye>>2]=m,h[At>>2]=_,h[We>>2]=0,q=0):(m=G,_=0),(m|0)<0?(G=q-m|0,h[We>>2]=G,_=_-m|0,h[At>>2]=_,h[ye>>2]=0,q=G-_|0,m=0-_|0,(_|0)<0?(h[We>>2]=q,h[ye>>2]=m,h[At>>2]=0,oe=m,_=0):(oe=0,q=G)):oe=m,m=(oe|0)<(q|0)?oe:q,m=(_|0)<(m|0)?_:m,(m|0)>0&&(h[We>>2]=q-m,h[ye>>2]=oe-m,h[At>>2]=_-m),m=cr(_e|0,re|0,I|0,O|0)|0,m=pt(m|0,Q()|0,E|0,M|0)|0,Q()|0,m=N9(d,A,We,b+(m<<3)|0)|0,m|0){_=20;break}if(oe=_e,_e=pt(_e|0,re|0,1,0)|0,q=re,re=Q()|0,!((q|0)<(y|0)|(q|0)==(y|0)&oe>>>0<g>>>0)){m=0,_=20;break}}return(_|0)==20?(Y=Ot,m|0):0}function cd(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;if((m|0)==0&(_|0)==0)return g=0,y=1,Dn(g|0),y|0;y=d,g=A,d=1,A=0;do b=(m&1|0)==0&!0,d=cr((b?1:y)|0,(b?0:g)|0,d|0,A|0)|0,A=Q()|0,m=X9(m|0,_|0,1)|0,_=Q()|0,y=cr(y|0,g|0,y|0,g|0)|0,g=Q()|0;while(!((m|0)==0&(_|0)==0));return Dn(A|0),d|0}function G4(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0;E=Y,Y=Y+16|0,y=E,b=et(d|0,A|0,52)|0,Q()|0,b=b&15;do if(b){if(g=sg(d,A,y)|0,!g){I=+ne[y>>3],M=1/+Qn(+I),O=+ne[26032+(b<<3)>>3],ne[m>>3]=I+O,ne[m+8>>3]=I-O,I=+ne[y+8>>3],M=O*M,ne[m+16>>3]=M+I,ne[m+24>>3]=I-M;break}return b=g,Y=E,b|0}else{if(g=et(d|0,A|0,45)|0,Q()|0,g=g&127,g>>>0>121)return b=5,Y=E,b|0;y=22128+(g<<5)|0,h[m>>2]=h[y>>2],h[m+4>>2]=h[y+4>>2],h[m+8>>2]=h[y+8>>2],h[m+12>>2]=h[y+12>>2],h[m+16>>2]=h[y+16>>2],h[m+20>>2]=h[y+20>>2],h[m+24>>2]=h[y+24>>2],h[m+28>>2]=h[y+28>>2];break}while(!1);return Dre(m,_?1.4:1.1),_=26160+(b<<3)|0,(h[_>>2]|0)==(d|0)&&(h[_+4>>2]|0)==(A|0)&&(ne[m>>3]=1.5707963267948966),b=26288+(b<<3)|0,(h[b>>2]|0)==(d|0)&&(h[b+4>>2]|0)==(A|0)&&(ne[m+8>>3]=-1.5707963267948966),+ne[m>>3]!=1.5707963267948966&&+ne[m+8>>3]!=-1.5707963267948966?(b=0,Y=E,b|0):(ne[m+16>>3]=3.141592653589793,ne[m+24>>3]=-3.141592653589793,b=0,Y=E,b|0)}function vse(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0;I=Y,Y=Y+48|0,b=I+32|0,y=I+40|0,E=I,P4(b,0,0,0),M=h[b>>2]|0,b=h[b+4>>2]|0;do if(m>>>0<=15){if(g=px(_)|0,g|0){_=E,h[_>>2]=0,h[_+4>>2]=0,h[E+8>>2]=g,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[y>>0]|0,He[M+1>>0]=He[y+1>>0]|0,He[M+2>>0]=He[y+2>>0]|0;break}if(g=ra((h[A+8>>2]|0)+1|0,32)|0,g){z4(A,g),O=E,h[O>>2]=M,h[O+4>>2]=b,h[E+8>>2]=0,h[E+12>>2]=m,h[E+16>>2]=_,h[E+20>>2]=A,h[E+24>>2]=g,He[E+28>>0]=0,M=E+29|0,He[M>>0]=He[y>>0]|0,He[M+1>>0]=He[y+1>>0]|0,He[M+2>>0]=He[y+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[y>>0]|0,He[M+1>>0]=He[y+1>>0]|0,He[M+2>>0]=He[y+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[y>>0]|0,He[O+1>>0]=He[y+1>>0]|0,He[O+2>>0]=He[y+2>>0]|0;while(!1);Jb(E),h[d>>2]=h[E>>2],h[d+4>>2]=h[E+4>>2],h[d+8>>2]=h[E+8>>2],h[d+12>>2]=h[E+12>>2],h[d+16>>2]=h[E+16>>2],h[d+20>>2]=h[E+20>>2],h[d+24>>2]=h[E+24>>2],h[d+28>>2]=h[E+28>>2],Y=I}function Jb(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0;if(me=Y,Y=Y+336|0,W=me+168|0,$=me,_=d,m=h[_>>2]|0,_=h[_+4>>2]|0,(m|0)==0&(_|0)==0){Y=me;return}if(A=d+28|0,He[A>>0]|0?(m=D9(m,_)|0,_=Q()|0):He[A>>0]=1,be=d+20|0,!(h[h[be>>2]>>2]|0)){A=d+24|0,m=h[A>>2]|0,m|0&&_t(m),re=d,h[re>>2]=0,h[re+4>>2]=0,h[d+8>>2]=0,h[be>>2]=0,h[d+12>>2]=-1,h[d+16>>2]=0,h[A>>2]=0,Y=me;return}re=d+16|0,A=h[re>>2]|0,g=A&15;e:do if((m|0)==0&(_|0)==0)_e=d+24|0;else{oe=d+12|0,G=(g|0)==3,O=A&255,M=(g|1|0)==3,q=d+24|0,I=(g+-1|0)>>>0<3,b=(g|2|0)==3,E=$+8|0;t:for(;;){if(y=et(m|0,_|0,52)|0,Q()|0,y=y&15,(y|0)==(h[oe>>2]|0)){switch(O&15){case 0:case 2:case 3:{if(g=sg(m,_,W)|0,g|0){ue=15;break t}if(V4(h[be>>2]|0,h[q>>2]|0,W)|0){ue=19;break t}break}default:}if(M&&(g=h[(h[be>>2]|0)+4>>2]|0,h[W>>2]=h[g>>2],h[W+4>>2]=h[g+4>>2],h[W+8>>2]=h[g+8>>2],h[W+12>>2]=h[g+12>>2],_9(26896,W)|0)){if(D4(h[(h[be>>2]|0)+4>>2]|0,y,$)|0){ue=25;break}if(g=$,(h[g>>2]|0)==(m|0)&&(h[g+4>>2]|0)==(_|0)){ue=29;break}}if(I){if(g=L0(m,_,W)|0,g|0){ue=32;break}if(G4(m,_,$,0)|0){ue=36;break}if(b&&O9(h[be>>2]|0,h[q>>2]|0,W,$)|0){ue=42;break}if(M&&B9(h[be>>2]|0,h[q>>2]|0,W,$)|0){ue=42;break}}if(G){if(A=G4(m,_,W,1)|0,g=h[q>>2]|0,A|0){ue=45;break}if(T4(g,W)|0){if(y9($,W),x9(W,h[q>>2]|0)|0){ue=53;break}if(V4(h[be>>2]|0,h[q>>2]|0,E)|0){ue=53;break}if(B9(h[be>>2]|0,h[q>>2]|0,$,W)|0){ue=53;break}}}}do if((y|0)<(h[oe>>2]|0)){if(A=G4(m,_,W,1)|0,g=h[q>>2]|0,A|0){ue=58;break t}if(!(T4(g,W)|0)){ue=73;break}if(x9(h[q>>2]|0,W)|0&&(y9($,W),O9(h[be>>2]|0,h[q>>2]|0,$,W)|0)){ue=65;break t}if(m=C9(m,_,y+1|0,$)|0,m|0){ue=67;break t}_=$,m=h[_>>2]|0,_=h[_+4>>2]|0}else ue=73;while(!1);if((ue|0)==73&&(ue=0,m=D9(m,_)|0,_=Q()|0),(m|0)==0&(_|0)==0){_e=q;break e}}switch(ue|0){case 15:{A=h[q>>2]|0,A|0&&_t(A),ue=d,h[ue>>2]=0,h[ue+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=g,ue=20;break}case 19:{h[d>>2]=m,h[d+4>>2]=_,ue=20;break}case 25:{ci(27634,27600,470,27611);break}case 29:{h[d>>2]=m,h[d+4>>2]=_,Y=me;return}case 32:{A=h[q>>2]|0,A|0&&_t(A),_e=d,h[_e>>2]=0,h[_e+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=g,Y=me;return}case 36:{ci(27634,27600,493,27611);break}case 42:{h[d>>2]=m,h[d+4>>2]=_,Y=me;return}case 45:{g|0&&_t(g),ue=d,h[ue>>2]=0,h[ue+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=A,ue=55;break}case 53:{h[d>>2]=m,h[d+4>>2]=_,ue=55;break}case 58:{g|0&&_t(g),ue=d,h[ue>>2]=0,h[ue+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=A,ue=71;break}case 65:{h[d>>2]=m,h[d+4>>2]=_,ue=71;break}case 67:{A=h[q>>2]|0,A|0&&_t(A),_e=d,h[_e>>2]=0,h[_e+4>>2]=0,h[be>>2]=0,h[oe>>2]=-1,h[re>>2]=0,h[q>>2]=0,h[d+8>>2]=m,Y=me;return}}if((ue|0)==20){Y=me;return}else if((ue|0)==55){Y=me;return}else if((ue|0)==71){Y=me;return}}while(!1);A=h[_e>>2]|0,A|0&&_t(A),ue=d,h[ue>>2]=0,h[ue+4>>2]=0,h[d+8>>2]=0,h[be>>2]=0,h[d+12>>2]=-1,h[re>>2]=0,h[_e>>2]=0,Y=me}function D9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;G=Y,Y=Y+16|0,O=G,_=et(d|0,A|0,52)|0,Q()|0,_=_&15,m=et(d|0,A|0,45)|0,Q()|0;do if(_){for(;m=ht(_+4095|0,0,52)|0,g=Q()|0|A&-15728641,y=(15-_|0)*3|0,b=ht(7,0,y|0)|0,E=Q()|0,m=m|d|b,g=g|E,M=et(d|0,A|0,y|0)|0,Q()|0,M=M&7,_=_+-1|0,!(M>>>0<6);)if(_)A=g,d=m;else{I=4;break}if((I|0)==4){m=et(m|0,g|0,45)|0,Q()|0;break}return O=(M|0)==0&(ki(m,g)|0)!=0,O=ht((O?2:1)+M|0,0,y|0)|0,I=Q()|0|A&~E,O=O|d&~b,Dn(I|0),Y=G,O|0}while(!1);return m=m&127,m>>>0>120?(I=0,O=0,Dn(I|0),Y=G,O|0):(P4(O,0,m+1|0,0),I=h[O+4>>2]|0,O=h[O>>2]|0,Dn(I|0),Y=G,O|0)}function bse(d,A,m,_,g,y){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0;var b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0;ue=Y,Y=Y+160|0,G=ue+80|0,E=ue+64|0,q=ue+112|0,oe=ue,vse(G,d,A,m),I=G,B4(E,h[I>>2]|0,h[I+4>>2]|0,A),I=E,M=h[I>>2]|0,I=h[I+4>>2]|0,b=h[G+8>>2]|0,W=q+4|0,h[W>>2]=h[G>>2],h[W+4>>2]=h[G+4>>2],h[W+8>>2]=h[G+8>>2],h[W+12>>2]=h[G+12>>2],h[W+16>>2]=h[G+16>>2],h[W+20>>2]=h[G+20>>2],h[W+24>>2]=h[G+24>>2],h[W+28>>2]=h[G+28>>2],W=oe,h[W>>2]=M,h[W+4>>2]=I,W=oe+8|0,h[W>>2]=b,d=oe+12|0,A=q,m=d+36|0;do h[d>>2]=h[A>>2],d=d+4|0,A=A+4|0;while((d|0)<(m|0));if(q=oe+48|0,h[q>>2]=h[E>>2],h[q+4>>2]=h[E+4>>2],h[q+8>>2]=h[E+8>>2],h[q+12>>2]=h[E+12>>2],(M|0)==0&(I|0)==0)return oe=b,Y=ue,oe|0;m=oe+16|0,O=oe+24|0,G=oe+28|0,b=0,E=0,A=M,d=I;do{if(!((b|0)<(g|0)|(b|0)==(g|0)&E>>>0<_>>>0)){$=4;break}if(I=E,E=pt(E|0,b|0,1,0)|0,b=Q()|0,I=y+(I<<3)|0,h[I>>2]=A,h[I+4>>2]=d,U4(q),d=q,A=h[d>>2]|0,d=h[d+4>>2]|0,(A|0)==0&(d|0)==0){if(Jb(m),A=m,d=h[A>>2]|0,A=h[A+4>>2]|0,(d|0)==0&(A|0)==0){$=10;break}P9(d,A,h[G>>2]|0,q),d=q,A=h[d>>2]|0,d=h[d+4>>2]|0}I=oe,h[I>>2]=A,h[I+4>>2]=d}while(!((A|0)==0&(d|0)==0));return($|0)==4?(d=oe+40|0,A=h[d>>2]|0,A|0&&_t(A),$=oe+16|0,h[$>>2]=0,h[$+4>>2]=0,h[O>>2]=0,h[oe+36>>2]=0,h[G>>2]=-1,h[oe+32>>2]=0,h[d>>2]=0,P9(0,0,0,q),h[oe>>2]=0,h[oe+4>>2]=0,h[W>>2]=0,oe=14,Y=ue,oe|0):(($|0)==10&&(h[oe>>2]=0,h[oe+4>>2]=0,h[W>>2]=h[O>>2]),oe=h[W>>2]|0,Y=ue,oe|0)}function wse(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0;if(G=Y,Y=Y+48|0,M=G+32|0,E=G+40|0,I=G,!(h[d>>2]|0))return O=_,h[O>>2]=0,h[O+4>>2]=0,O=0,Y=G,O|0;P4(M,0,0,0),b=M,g=h[b>>2]|0,b=h[b+4>>2]|0;do if(A>>>0>15)O=I,h[O>>2]=0,h[O+4>>2]=0,h[I+8>>2]=4,h[I+12>>2]=-1,O=I+16|0,m=I+29|0,h[O>>2]=0,h[O+4>>2]=0,h[O+8>>2]=0,He[O+12>>0]=0,He[m>>0]=He[E>>0]|0,He[m+1>>0]=He[E+1>>0]|0,He[m+2>>0]=He[E+2>>0]|0,m=4,O=9;else{if(m=px(m)|0,m|0){M=I,h[M>>2]=0,h[M+4>>2]=0,h[I+8>>2]=m,h[I+12>>2]=-1,M=I+16|0,O=I+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(m=ra((h[d+8>>2]|0)+1|0,32)|0,!m){O=I,h[O>>2]=0,h[O+4>>2]=0,h[I+8>>2]=13,h[I+12>>2]=-1,O=I+16|0,m=I+29|0,h[O>>2]=0,h[O+4>>2]=0,h[O+8>>2]=0,He[O+12>>0]=0,He[m>>0]=He[E>>0]|0,He[m+1>>0]=He[E+1>>0]|0,He[m+2>>0]=He[E+2>>0]|0,m=13,O=9;break}z4(d,m),W=I,h[W>>2]=g,h[W+4>>2]=b,b=I+8|0,h[b>>2]=0,h[I+12>>2]=A,h[I+20>>2]=d,h[I+24>>2]=m,He[I+28>>0]=0,g=I+29|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,h[I+16>>2]=3,q=+Ire(m),q=q*+Rre(m),y=+Ls(+ +ne[m>>3]),y=q/+Qn(+ +sw(+y,+ +Ls(+ +ne[m+8>>3])))*6371.007180918475*6371.007180918475,g=I+12|0,m=h[g>>2]|0;e:do if((m|0)>0)do{if(I9(m+-1|0,M)|0,!(y/+ne[M>>3]>10))break e;W=h[g>>2]|0,m=W+-1|0,h[g>>2]=m}while((W|0)>1);while(!1);if(Jb(I),g=_,h[g>>2]=0,h[g+4>>2]=0,g=I,m=h[g>>2]|0,g=h[g+4>>2]|0,!((m|0)==0&(g|0)==0))do cx(m,g,A,M)|0,E=M,d=_,E=pt(h[d>>2]|0,h[d+4>>2]|0,h[E>>2]|0,h[E+4>>2]|0)|0,d=Q()|0,W=_,h[W>>2]=E,h[W+4>>2]=d,Jb(I),W=I,m=h[W>>2]|0,g=h[W+4>>2]|0;while(!((m|0)==0&(g|0)==0));m=h[b>>2]|0}while(!1);return W=m,Y=G,W|0}function dx(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;if(!(_9(A,m)|0)||(A=Pre(A)|0,_=+ne[m>>3],g=+ne[m+8>>3],g=A&g<0?g+6.283185307179586:g,q=h[d>>2]|0,(q|0)<=0))return q=0,q|0;if(G=h[d+4>>2]|0,A){A=0,O=g,m=-1,d=0;e:for(;;){for(I=d;b=+ne[G+(I<<4)>>3],g=+ne[G+(I<<4)+8>>3],d=(m+2|0)%(q|0)|0,y=+ne[G+(d<<4)>>3],E=+ne[G+(d<<4)+8>>3],b>y?(M=b,b=E):(M=y,y=b,b=g,g=E),_=_==y|_==M?_+2220446049250313e-31:_,!!(_<y|_>M);)if(m=I+1|0,(m|0)>=(q|0)){m=22;break e}else d=I,I=m,m=d;if(E=b<0?b+6.283185307179586:b,b=g<0?g+6.283185307179586:g,O=E==O|b==O?O+-2220446049250313e-31:O,M=E+(b-E)*((_-y)/(M-y)),(M<0?M+6.283185307179586:M)>O&&(A=A^1),d=I+1|0,(d|0)>=(q|0)){m=22;break}else m=I}if((m|0)==22)return A|0}else{A=0,O=g,m=-1,d=0;e:for(;;){for(I=d;b=+ne[G+(I<<4)>>3],g=+ne[G+(I<<4)+8>>3],d=(m+2|0)%(q|0)|0,y=+ne[G+(d<<4)>>3],E=+ne[G+(d<<4)+8>>3],b>y?(M=b,b=E):(M=y,y=b,b=g,g=E),_=_==y|_==M?_+2220446049250313e-31:_,!!(_<y|_>M);)if(m=I+1|0,(m|0)>=(q|0)){m=22;break e}else d=I,I=m,m=d;if(O=b==O|g==O?O+-2220446049250313e-31:O,b+(g-b)*((_-y)/(M-y))>O&&(A=A^1),d=I+1|0,(d|0)>=(q|0)){m=22;break}else m=I}if((m|0)==22)return A|0}return 0}function F9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0;if($=h[d>>2]|0,!$){h[A>>2]=0,h[A+4>>2]=0,h[A+8>>2]=0,h[A+12>>2]=0,h[A+16>>2]=0,h[A+20>>2]=0,h[A+24>>2]=0,h[A+28>>2]=0;return}if(oe=A+8|0,ne[oe>>3]=17976931348623157e292,ue=A+24|0,ne[ue>>3]=17976931348623157e292,ne[A>>3]=-17976931348623157e292,_e=A+16|0,ne[_e>>3]=-17976931348623157e292,!(($|0)<=0)){for(q=h[d+4>>2]|0,I=17976931348623157e292,O=-17976931348623157e292,G=0,d=-1,y=17976931348623157e292,b=17976931348623157e292,M=-17976931348623157e292,_=-17976931348623157e292,W=0;m=+ne[q+(W<<4)>>3],E=+ne[q+(W<<4)+8>>3],d=d+2|0,g=+ne[q+(((d|0)==($|0)?0:d)<<4)+8>>3],m<y&&(ne[oe>>3]=m,y=m),E<b&&(ne[ue>>3]=E,b=E),m>M?ne[A>>3]=m:m=M,E>_&&(ne[_e>>3]=E,_=E),I=E>0&E<I?E:I,O=E<0&E>O?E:O,G=G|+Ls(+(E-g))>3.141592653589793,d=W+1|0,(d|0)!=($|0);)re=W,M=m,W=d,d=re;G&&(ne[_e>>3]=O,ne[ue>>3]=I)}}function px(d){return d=d|0,(d>>>0<4?0:15)|0}function z4(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0;if($=h[d>>2]|0,$){if(oe=A+8|0,ne[oe>>3]=17976931348623157e292,ue=A+24|0,ne[ue>>3]=17976931348623157e292,ne[A>>3]=-17976931348623157e292,_e=A+16|0,ne[_e>>3]=-17976931348623157e292,($|0)>0){for(g=h[d+4>>2]|0,q=17976931348623157e292,W=-17976931348623157e292,_=0,m=-1,M=17976931348623157e292,I=17976931348623157e292,G=-17976931348623157e292,b=-17976931348623157e292,re=0;y=+ne[g+(re<<4)>>3],O=+ne[g+(re<<4)+8>>3],Ze=m+2|0,E=+ne[g+(((Ze|0)==($|0)?0:Ze)<<4)+8>>3],y<M&&(ne[oe>>3]=y,M=y),O<I&&(ne[ue>>3]=O,I=O),y>G?ne[A>>3]=y:y=G,O>b&&(ne[_e>>3]=O,b=O),q=O>0&O<q?O:q,W=O<0&O>W?O:W,_=_|+Ls(+(O-E))>3.141592653589793,m=re+1|0,(m|0)!=($|0);)Ze=re,G=y,re=m,m=Ze;_&&(ne[_e>>3]=W,ne[ue>>3]=q)}}else h[A>>2]=0,h[A+4>>2]=0,h[A+8>>2]=0,h[A+12>>2]=0,h[A+16>>2]=0,h[A+20>>2]=0,h[A+24>>2]=0,h[A+28>>2]=0;if(Ze=d+8|0,m=h[Ze>>2]|0,!((m|0)<=0)){Fe=d+12|0,me=0;do if(g=h[Fe>>2]|0,_=me,me=me+1|0,ue=A+(me<<5)|0,_e=h[g+(_<<3)>>2]|0,_e){if(re=A+(me<<5)+8|0,ne[re>>3]=17976931348623157e292,d=A+(me<<5)+24|0,ne[d>>3]=17976931348623157e292,ne[ue>>3]=-17976931348623157e292,be=A+(me<<5)+16|0,ne[be>>3]=-17976931348623157e292,(_e|0)>0){for($=h[g+(_<<3)+4>>2]|0,q=17976931348623157e292,W=-17976931348623157e292,g=0,_=-1,oe=0,M=17976931348623157e292,I=17976931348623157e292,O=-17976931348623157e292,b=-17976931348623157e292;y=+ne[$+(oe<<4)>>3],G=+ne[$+(oe<<4)+8>>3],_=_+2|0,E=+ne[$+(((_|0)==(_e|0)?0:_)<<4)+8>>3],y<M&&(ne[re>>3]=y,M=y),G<I&&(ne[d>>3]=G,I=G),y>O?ne[ue>>3]=y:y=O,G>b&&(ne[be>>3]=G,b=G),q=G>0&G<q?G:q,W=G<0&G>W?G:W,g=g|+Ls(+(G-E))>3.141592653589793,_=oe+1|0,(_|0)!=(_e|0);)Ee=oe,oe=_,O=y,_=Ee;g&&(ne[be>>3]=W,ne[d>>3]=q)}}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,m=h[Ze>>2]|0;while((me|0)<(m|0))}}function V4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if(!(dx(d,A,m)|0))return g=0,g|0;if(g=d+8|0,(h[g>>2]|0)<=0)return g=1,g|0;for(_=d+12|0,d=0;;){if(y=d,d=d+1|0,dx((h[_>>2]|0)+(y<<3)|0,A+(d<<5)|0,m)|0){d=0,_=6;break}if((d|0)>=(h[g>>2]|0)){d=1,_=6;break}}return(_|0)==6?d|0:0}function O9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(I=Y,Y=Y+16|0,E=I,b=m+8|0,!(dx(d,A,b)|0))return M=0,Y=I,M|0;M=d+8|0;e:do if((h[M>>2]|0)>0){for(y=d+12|0,g=0;;){if(O=g,g=g+1|0,dx((h[y>>2]|0)+(O<<3)|0,A+(g<<5)|0,b)|0){g=0;break}if((g|0)>=(h[M>>2]|0))break e}return Y=I,g|0}while(!1);if(ew(d,A,m,_)|0)return O=0,Y=I,O|0;h[E>>2]=h[m>>2],h[E+4>>2]=b,g=h[M>>2]|0;e:do if((g|0)>0)for(d=d+12|0,b=0,y=g;;){if(g=h[d>>2]|0,(h[g+(b<<3)>>2]|0)>0){if(dx(E,_,h[g+(b<<3)+4>>2]|0)|0){g=0;break e}if(g=b+1|0,ew((h[d>>2]|0)+(b<<3)|0,A+(g<<5)|0,m,_)|0){g=0;break e}y=h[M>>2]|0}else g=b+1|0;if((g|0)<(y|0))b=g;else{g=1;break}}else g=1;while(!1);return O=g,Y=I,O|0}function ew(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0,Ze=0,Ee=0,ye=0;if(Ze=Y,Y=Y+176|0,re=Ze+172|0,g=Ze+168|0,be=Ze,!(T4(A,_)|0))return d=0,Y=Ze,d|0;if(Nre(A,_,re,g),wc(be|0,m|0,168)|0,(h[m>>2]|0)>0){A=0;do Ee=be+8+(A<<4)+8|0,_e=+ul(+ne[Ee>>3],h[g>>2]|0),ne[Ee>>3]=_e,A=A+1|0;while((A|0)<(h[m>>2]|0))}oe=+ne[_>>3],ue=+ne[_+8>>3],_e=+ul(+ne[_+16>>3],h[g>>2]|0),W=+ul(+ne[_+24>>3],h[g>>2]|0);e:do if((h[d>>2]|0)>0){if(_=d+4|0,g=h[be>>2]|0,(g|0)<=0){for(A=0;;)if(A=A+1|0,(A|0)>=(h[d>>2]|0)){A=0;break e}}for(m=0;;){if(A=h[_>>2]|0,q=+ne[A+(m<<4)>>3],$=+ul(+ne[A+(m<<4)+8>>3],h[re>>2]|0),A=h[_>>2]|0,m=m+1|0,Ee=(m|0)%(h[d>>2]|0)|0,y=+ne[A+(Ee<<4)>>3],b=+ul(+ne[A+(Ee<<4)+8>>3],h[re>>2]|0),!(q>=oe)|!(y>=oe)&&!(q<=ue)|!(y<=ue)&&!($<=W)|!(b<=W)&&!($>=_e)|!(b>=_e)){G=y-q,I=b-$,A=0;do if(ye=A,A=A+1|0,Ee=(A|0)==(g|0)?0:A,y=+ne[be+8+(ye<<4)+8>>3],b=+ne[be+8+(Ee<<4)+8>>3]-y,E=+ne[be+8+(ye<<4)>>3],M=+ne[be+8+(Ee<<4)>>3]-E,O=G*b-I*M,O!=0&&(me=$-y,Fe=q-E,M=(me*M-b*Fe)/O,!(M<0|M>1))&&(O=(G*me-I*Fe)/O,O>=0&O<=1)){A=1;break e}while((A|0)<(g|0))}if((m|0)>=(h[d>>2]|0)){A=0;break}}}else A=0;while(!1);return ye=A,Y=Ze,ye|0}function B9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;if(ew(d,A,m,_)|0)return y=1,y|0;if(y=d+8|0,(h[y>>2]|0)<=0)return y=0,y|0;for(g=d+12|0,d=0;;){if(b=d,d=d+1|0,ew((h[g>>2]|0)+(b<<3)|0,A+(d<<5)|0,m,_)|0){d=1,g=6;break}if((d|0)>=(h[y>>2]|0)){d=0,g=6;break}}return(g|0)==6?d|0:0}function Sse(){return 8}function Tse(){return 16}function Ese(){return 168}function Mse(){return 8}function Cse(){return 16}function Rse(){return 12}function Pse(){return 8}function Ise(d){return d=d|0,+(+((h[d>>2]|0)>>>0)+4294967296*+(h[d+4>>2]|0))}function Nse(d){d=d|0;var A=0,m=0;return m=+ne[d>>3],A=+ne[d+8>>3],+ +is(+(m*m+A*A))}function U9(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;I=+ne[d>>3],M=+ne[A>>3]-I,E=+ne[d+8>>3],b=+ne[A+8>>3]-E,G=+ne[m>>3],y=+ne[_>>3]-G,q=+ne[m+8>>3],O=+ne[_+8>>3]-q,y=(y*(E-q)-(I-G)*O)/(M*O-b*y),ne[g>>3]=I+M*y,ne[g+8>>3]=E+b*y}function k9(d,A){return d=d|0,A=A|0,+Ls(+(+ne[d>>3]-+ne[A>>3]))<11920928955078125e-23?(A=+Ls(+(+ne[d+8>>3]-+ne[A+8>>3]))<11920928955078125e-23,A|0):(A=0,A|0)}function Lse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if(y=Y,Y=Y+16|0,g=y,_=ki(d,A)|0,(m+-1|0)>>>0>5||(_=(_|0)!=0,(m|0)==1&_))return g=-1,Y=y,g|0;do if(Ax(d,A,g)|0)_=-1;else if(_){_=((h[26416+(m<<2)>>2]|0)+5-(h[g>>2]|0)|0)%5|0;break}else{_=((h[26448+(m<<2)>>2]|0)+6-(h[g>>2]|0)|0)%6|0;break}while(!1);return g=_,Y=y,g|0}function Ax(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0;if(O=Y,Y=Y+32|0,E=O+16|0,M=O,_=rg(d,A,E)|0,_|0)return m=_,Y=O,m|0;y=E9(d,A)|0,I=Oa(d,A)|0,Tre(y,M),_=Ere(y,h[E>>2]|0)|0;do if(ar(y)|0){do switch(y|0){case 4:{g=0;break}case 14:{g=1;break}case 24:{g=2;break}case 38:{g=3;break}case 49:{g=4;break}case 58:{g=5;break}case 63:{g=6;break}case 72:{g=7;break}case 83:{g=8;break}case 97:{g=9;break}case 107:{g=10;break}case 117:{g=11;break}default:ci(27634,27636,75,27645)}while(!1);if(b=h[26480+(g*24|0)+8>>2]|0,A=h[26480+(g*24|0)+16>>2]|0,d=h[E>>2]|0,(d|0)!=(h[M>>2]|0)&&(M=b4(y)|0,d=h[E>>2]|0,M|(d|0)==(A|0)&&(_=(_+1|0)%6|0)),(I|0)==3&(d|0)==(A|0)){_=(_+5|0)%6|0;break}(I|0)==5&(d|0)==(b|0)&&(_=(_+1|0)%6|0)}while(!1);return h[m>>2]=_,m=0,Y=O,m|0}function Vl(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0;if(be=Y,Y=Y+32|0,re=be+24|0,ue=be+20|0,$=be+8|0,W=be+16|0,q=be,M=(ki(d,A)|0)==0,M=M?6:5,O=et(d|0,A|0,52)|0,Q()|0,O=O&15,M>>>0<=m>>>0)return _=2,Y=be,_|0;G=(O|0)==0,!G&&(oe=ht(7,0,(O^15)*3|0)|0,(oe&d|0)==0&((Q()|0)&A|0)==0)?g=m:y=4;e:do if((y|0)==4){if(g=(ki(d,A)|0)!=0,((g?4:5)|0)<(m|0)||Ax(d,A,re)|0||(y=(h[re>>2]|0)+m|0,g?g=26768+(((y|0)%5|0)<<2)|0:g=26800+(((y|0)%6|0)<<2)|0,oe=h[g>>2]|0,(oe|0)==7))return _=1,Y=be,_|0;h[ue>>2]=0,g=Ds(d,A,oe,ue,$)|0;do if(!g){if(E=$,I=h[E>>2]|0,E=h[E+4>>2]|0,b=E>>>0<A>>>0|(E|0)==(A|0)&I>>>0<d>>>0,y=b?I:d,b=b?E:A,!G&&(G=ht(7,0,(O^15)*3|0)|0,(I&G|0)==0&(E&(Q()|0)|0)==0))g=m;else{if(E=(m+-1+M|0)%(M|0)|0,g=ki(d,A)|0,(E|0)<0&&ci(27634,27636,248,27661),M=(g|0)!=0,((M?4:5)|0)<(E|0)&&ci(27634,27636,248,27661),Ax(d,A,re)|0&&ci(27634,27636,248,27661),g=(h[re>>2]|0)+E|0,M?g=26768+(((g|0)%5|0)<<2)|0:g=26800+(((g|0)%6|0)<<2)|0,E=h[g>>2]|0,(E|0)==7&&ci(27634,27636,248,27661),h[W>>2]=0,g=Ds(d,A,E,W,q)|0,g|0)break;I=q,M=h[I>>2]|0,I=h[I+4>>2]|0;do if(I>>>0<b>>>0|(I|0)==(b|0)&M>>>0<y>>>0){if(ki(M,I)|0?y=Yb(M,I,d,A)|0:y=h[26864+((((h[W>>2]|0)+(h[26832+(E<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,g=ki(M,I)|0,(y+-1|0)>>>0>5){g=-1,y=M,b=I;break}if(g=(g|0)!=0,(y|0)==1&g){g=-1,y=M,b=I;break}do if(Ax(M,I,re)|0)g=-1;else if(g){g=((h[26416+(y<<2)>>2]|0)+5-(h[re>>2]|0)|0)%5|0;break}else{g=((h[26448+(y<<2)>>2]|0)+6-(h[re>>2]|0)|0)%6|0;break}while(!1);y=M,b=I}else g=m;while(!1);E=$,I=h[E>>2]|0,E=h[E+4>>2]|0}if((y|0)==(I|0)&(b|0)==(E|0)){if(M=(ki(I,E)|0)!=0,M?d=Yb(I,E,d,A)|0:d=h[26864+((((h[ue>>2]|0)+(h[26832+(oe<<2)>>2]|0)|0)%6|0)<<2)>>2]|0,g=ki(I,E)|0,(d+-1|0)>>>0<=5&&(_e=(g|0)!=0,!((d|0)==1&_e)))do if(Ax(I,E,re)|0)g=-1;else if(_e){g=((h[26416+(d<<2)>>2]|0)+5-(h[re>>2]|0)|0)%5|0;break}else{g=((h[26448+(d<<2)>>2]|0)+6-(h[re>>2]|0)|0)%6|0;break}while(!1);else g=-1;g=g+1|0,g=(g|0)==6|M&(g|0)==5?0:g}A=b,d=y;break e}while(!1);return _=g,Y=be,_|0}while(!1);return _e=ht(g|0,0,56)|0,re=Q()|0|A&-2130706433|536870912,h[_>>2]=_e|d,h[_+4>>2]=re,_=0,Y=be,_|0}function Dse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;return y=(ki(d,A)|0)==0,_=Vl(d,A,0,m)|0,g=(_|0)==0,y?!g||(_=Vl(d,A,1,m+8|0)|0,_|0)||(_=Vl(d,A,2,m+16|0)|0,_|0)||(_=Vl(d,A,3,m+24|0)|0,_|0)||(_=Vl(d,A,4,m+32|0)|0,_)?(y=_,y|0):Vl(d,A,5,m+40|0)|0:!g||(_=Vl(d,A,1,m+8|0)|0,_|0)||(_=Vl(d,A,2,m+16|0)|0,_|0)||(_=Vl(d,A,3,m+24|0)|0,_|0)||(_=Vl(d,A,4,m+32|0)|0,_|0)?(y=_,y|0):(y=m+40|0,h[y>>2]=0,h[y+4>>2]=0,y=0,y|0)}function Fse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0,M=0;return M=Y,Y=Y+192|0,g=M,y=M+168|0,b=et(d|0,A|0,56)|0,Q()|0,b=b&7,E=A&-2130706433|134217728,_=rg(d,E,y)|0,_|0?(E=_,Y=M,E|0):(A=et(d|0,A|0,52)|0,Q()|0,A=A&15,ki(d,E)|0?M4(y,A,b,1,g):C4(y,A,b,1,g),E=g+8|0,h[m>>2]=h[E>>2],h[m+4>>2]=h[E+4>>2],h[m+8>>2]=h[E+8>>2],h[m+12>>2]=h[E+12>>2],E=0,Y=M,E|0)}function G9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return g=Y,Y=Y+16|0,m=g,!(!0&(A&2013265920|0)==536870912)||(_=A&-2130706433|134217728,!(Kb(d,_)|0))?(_=0,Y=g,_|0):(y=et(d|0,A|0,56)|0,Q()|0,y=(Vl(d,_,y&7,m)|0)==0,_=m,_=y&((h[_>>2]|0)==(d|0)?(h[_+4>>2]|0)==(A|0):0)&1,Y=g,_|0)}function z9(){return 27680}function tw(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0;G=Y,Y=Y+208|0,M=G,I=G+192|0,b=Fa(m,A)|0,E=I,h[E>>2]=1,h[E+4>>2]=0;e:do if(b|0){for(E=0-m|0,h[M+4>>2]=m,h[M>>2]=m,g=2,A=m,y=m;A=A+m+y|0,h[M+(g<<2)>>2]=A,A>>>0<b>>>0;)q=y,g=g+1|0,y=A,A=q;if(y=d+b+E|0,y>>>0>d>>>0){b=y,g=1,A=1;do{do if((A&3|0)!=3)if(A=g+-1|0,(h[M+(A<<2)>>2]|0)>>>0<(b-d|0)>>>0?q4(d,m,_,g,M):iw(d,m,_,I,g,0,M),(g|0)==1){rw(I,1),g=0;break}else{rw(I,A),g=1;break}else q4(d,m,_,g,M),nw(I,2),g=g+2|0;while(!1);A=h[I>>2]|1,h[I>>2]=A,d=d+m|0}while(d>>>0<y>>>0)}else g=1,A=1;for(iw(d,m,_,I,g,0,M),y=I+4|0;;){if((g|0)==1&(A|0)==1)if(h[y>>2]|0)O=19;else break e;else(g|0)<2?O=19:(rw(I,2),q=g+-2|0,h[I>>2]=h[I>>2]^7,nw(I,1),iw(d+(0-(h[M+(q<<2)>>2]|0))+E|0,m,_,I,g+-1|0,1,M),rw(I,1),A=h[I>>2]|1,h[I>>2]=A,d=d+E|0,iw(d,m,_,I,q,1,M),g=q);(O|0)==19&&(O=0,A=V9(I)|0,nw(I,A),d=d+E|0,g=A+g|0,A=h[I>>2]|0)}}while(!1);Y=G}function q4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0;G=Y,Y=Y+240|0,O=G,h[O>>2]=d;e:do if((_|0)>1)for(I=0-A|0,E=d,y=_,_=1,b=d;;){if(E=E+I|0,M=y+-2|0,d=E+(0-(h[g+(M<<2)>>2]|0))|0,(pd[m&3](b,d)|0)>-1&&(pd[m&3](b,E)|0)>-1||(b=O+(_<<2)|0,(pd[m&3](d,E)|0)>-1?(h[b>>2]=d,y=y+-1|0):(h[b>>2]=E,d=E,y=M),_=_+1|0,(y|0)<=1))break e;E=d,b=h[O>>2]|0}else _=1;while(!1);H9(A,O,_),Y=G}function nw(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;g=d+4|0,A>>>0>31?(_=h[g>>2]|0,h[d>>2]=_,h[g>>2]=0,A=A+-32|0,m=0):(m=h[g>>2]|0,_=h[d>>2]|0),h[d>>2]=m<<32-A|_>>>A,h[g>>2]=m>>>A}function iw(d,A,m,_,g,y,b){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,y=y|0,b=b|0;var E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;W=Y,Y=Y+240|0,G=W+232|0,q=W,$=h[_>>2]|0,h[G>>2]=$,M=h[_+4>>2]|0,I=G+4|0,h[I>>2]=M,h[q>>2]=d;e:do if(($|0)!=1|(M|0)!=0&&(O=0-A|0,E=d+(0-(h[b+(g<<2)>>2]|0))|0,(pd[m&3](E,d)|0)>=1))for(_=1,y=(y|0)==0,M=E;;){if(y&(g|0)>1){if(y=d+O|0,E=h[b+(g+-2<<2)>>2]|0,(pd[m&3](y,M)|0)>-1){E=10;break e}if((pd[m&3](y+(0-E)|0,M)|0)>-1){E=10;break e}}if(y=_+1|0,h[q+(_<<2)>>2]=M,$=V9(G)|0,nw(G,$),g=$+g|0,!((h[G>>2]|0)!=1|(h[I>>2]|0)!=0)){_=y,d=M,E=10;break e}if(d=M+(0-(h[b+(g<<2)>>2]|0))|0,(pd[m&3](d,h[q>>2]|0)|0)<1){d=M,_=y,y=0,E=9;break}else $=M,_=y,y=1,M=d,d=$}else _=1,E=9;while(!1);(E|0)==9&&(y|0)==0&&(E=10),(E|0)==10&&(H9(A,q,_),q4(d,A,m,g,b)),Y=W}function rw(d,A){d=d|0,A=A|0;var m=0,_=0,g=0;g=d+4|0,A>>>0>31?(_=h[d>>2]|0,h[g>>2]=_,h[d>>2]=0,A=A+-32|0,m=0):(m=h[d>>2]|0,_=h[g>>2]|0),h[g>>2]=m>>>(32-A|0)|_<<A,h[d>>2]=m<<A}function V9(d){d=d|0;var A=0;return A=q9((h[d>>2]|0)+-1|0)|0,A?A|0:(A=q9(h[d+4>>2]|0)|0,((A|0)==0?0:A+32|0)|0)}function q9(d){d=d|0;var A=0;if(d)if(d&1)d=0;else for(A=d,d=0;d=d+1|0,!(A&2);)A=A>>>1;else d=32;return d|0}function H9(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0,E=0;b=Y,Y=Y+256|0,_=b;e:do if((m|0)>=2&&(y=A+(m<<2)|0,h[y>>2]=_,d|0))for(;;){g=d>>>0<256?d:256,wc(_|0,h[A>>2]|0,g|0)|0,_=0;do E=A+(_<<2)|0,_=_+1|0,wc(h[E>>2]|0,h[A+(_<<2)>>2]|0,g|0)|0,h[E>>2]=(h[E>>2]|0)+g;while((_|0)!=(m|0));if(d=d-g|0,!d)break e;_=h[y>>2]|0}while(!1);Y=b}function gu(d){return d=+d,~~+Y9(+d)|0}function lr(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0,oe=0,ue=0,_e=0,re=0,be=0,me=0,Fe=0;Fe=Y,Y=Y+16|0,q=Fe;do if(d>>>0<245){if(I=d>>>0<11?16:d+11&-8,d=I>>>3,G=h[6921]|0,m=G>>>d,m&3|0)return A=(m&1^1)+d|0,d=27724+(A<<1<<2)|0,m=d+8|0,_=h[m>>2]|0,g=_+8|0,y=h[g>>2]|0,(y|0)==(d|0)?h[6921]=G&~(1<<A):(h[y+12>>2]=d,h[m>>2]=y),me=A<<3,h[_+4>>2]=me|3,me=_+me+4|0,h[me>>2]=h[me>>2]|1,me=g,Y=Fe,me|0;if(O=h[6923]|0,I>>>0>O>>>0){if(m|0)return A=2<<d,A=m<<d&(A|0-A),A=(A&0-A)+-1|0,E=A>>>12&16,A=A>>>E,m=A>>>5&8,A=A>>>m,y=A>>>2&4,A=A>>>y,d=A>>>1&2,A=A>>>d,_=A>>>1&1,_=(m|E|y|d|_)+(A>>>_)|0,A=27724+(_<<1<<2)|0,d=A+8|0,y=h[d>>2]|0,E=y+8|0,m=h[E>>2]|0,(m|0)==(A|0)?(d=G&~(1<<_),h[6921]=d):(h[m+12>>2]=A,h[d>>2]=m,d=G),me=_<<3,b=me-I|0,h[y+4>>2]=I|3,g=y+I|0,h[g+4>>2]=b|1,h[y+me>>2]=b,O|0&&(_=h[6926]|0,A=O>>>3,m=27724+(A<<1<<2)|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=_,h[A+12>>2]=_,h[_+8>>2]=A,h[_+12>>2]=m),h[6923]=b,h[6926]=g,me=E,Y=Fe,me|0;if(y=h[6922]|0,y){for(m=(y&0-y)+-1|0,g=m>>>12&16,m=m>>>g,_=m>>>5&8,m=m>>>_,b=m>>>2&4,m=m>>>b,E=m>>>1&2,m=m>>>E,M=m>>>1&1,M=h[27988+((_|g|b|E|M)+(m>>>M)<<2)>>2]|0,m=M,E=M,M=(h[M+4>>2]&-8)-I|0;d=h[m+16>>2]|0,!(!d&&(d=h[m+20>>2]|0,!d));)b=(h[d+4>>2]&-8)-I|0,g=b>>>0<M>>>0,m=d,E=g?d:E,M=g?b:M;if(b=E+I|0,b>>>0>E>>>0){g=h[E+24>>2]|0,A=h[E+12>>2]|0;do if((A|0)==(E|0)){if(d=E+20|0,A=h[d>>2]|0,!A&&(d=E+16|0,A=h[d>>2]|0,!A)){m=0;break}for(;;)if(_=A+20|0,m=h[_>>2]|0,m)A=m,d=_;else if(_=A+16|0,m=h[_>>2]|0,m)A=m,d=_;else break;h[d>>2]=0,m=A}else m=h[E+8>>2]|0,h[m+12>>2]=A,h[A+8>>2]=m,m=A;while(!1);do if(g|0){if(A=h[E+28>>2]|0,d=27988+(A<<2)|0,(E|0)==(h[d>>2]|0)){if(h[d>>2]=m,!m){h[6922]=y&~(1<<A);break}}else if(me=g+16|0,h[((h[me>>2]|0)==(E|0)?me:g+20|0)>>2]=m,!m)break;h[m+24>>2]=g,A=h[E+16>>2]|0,A|0&&(h[m+16>>2]=A,h[A+24>>2]=m),A=h[E+20>>2]|0,A|0&&(h[m+20>>2]=A,h[A+24>>2]=m)}while(!1);return M>>>0<16?(me=M+I|0,h[E+4>>2]=me|3,me=E+me+4|0,h[me>>2]=h[me>>2]|1):(h[E+4>>2]=I|3,h[b+4>>2]=M|1,h[b+M>>2]=M,O|0&&(_=h[6926]|0,A=O>>>3,m=27724+(A<<1<<2)|0,A=1<<A,A&G?(d=m+8|0,A=h[d>>2]|0):(h[6921]=A|G,A=m,d=m+8|0),h[d>>2]=_,h[A+12>>2]=_,h[_+8>>2]=A,h[_+12>>2]=m),h[6923]=M,h[6926]=b),me=E+8|0,Y=Fe,me|0}else G=I}else G=I}else G=I}else if(d>>>0<=4294967231)if(d=d+11|0,I=d&-8,_=h[6922]|0,_){g=0-I|0,d=d>>>8,d?I>>>0>16777215?M=31:(G=(d+1048320|0)>>>16&8,oe=d<<G,E=(oe+520192|0)>>>16&4,oe=oe<<E,M=(oe+245760|0)>>>16&2,M=14-(E|G|M)+(oe<<M>>>15)|0,M=I>>>(M+7|0)&1|M<<1):M=0,m=h[27988+(M<<2)>>2]|0;e:do if(!m)m=0,d=0,oe=61;else for(d=0,E=I<<((M|0)==31?0:25-(M>>>1)|0),y=0;;){if(b=(h[m+4>>2]&-8)-I|0,b>>>0<g>>>0)if(b)d=m,g=b;else{d=m,g=0,oe=65;break e}if(oe=h[m+20>>2]|0,m=h[m+16+(E>>>31<<2)>>2]|0,y=(oe|0)==0|(oe|0)==(m|0)?y:oe,m)E=E<<1;else{m=y,oe=61;break}}while(!1);if((oe|0)==61){if((m|0)==0&(d|0)==0){if(d=2<<M,d=(d|0-d)&_,!d){G=I;break}G=(d&0-d)+-1|0,b=G>>>12&16,G=G>>>b,y=G>>>5&8,G=G>>>y,E=G>>>2&4,G=G>>>E,M=G>>>1&2,G=G>>>M,m=G>>>1&1,d=0,m=h[27988+((y|b|E|M|m)+(G>>>m)<<2)>>2]|0}m?oe=65:(E=d,b=g)}if((oe|0)==65)for(y=m;;)if(G=(h[y+4>>2]&-8)-I|0,m=G>>>0<g>>>0,g=m?G:g,d=m?y:d,m=h[y+16>>2]|0,m||(m=h[y+20>>2]|0),m)y=m;else{E=d,b=g;break}if((E|0)!=0&&b>>>0<((h[6923]|0)-I|0)>>>0&&(O=E+I|0,O>>>0>E>>>0)){y=h[E+24>>2]|0,A=h[E+12>>2]|0;do if((A|0)==(E|0)){if(d=E+20|0,A=h[d>>2]|0,!A&&(d=E+16|0,A=h[d>>2]|0,!A)){A=0;break}for(;;)if(g=A+20|0,m=h[g>>2]|0,m)A=m,d=g;else if(g=A+16|0,m=h[g>>2]|0,m)A=m,d=g;else break;h[d>>2]=0}else me=h[E+8>>2]|0,h[me+12>>2]=A,h[A+8>>2]=me;while(!1);do if(y){if(d=h[E+28>>2]|0,m=27988+(d<<2)|0,(E|0)==(h[m>>2]|0)){if(h[m>>2]=A,!A){_=_&~(1<<d),h[6922]=_;break}}else if(me=y+16|0,h[((h[me>>2]|0)==(E|0)?me:y+20|0)>>2]=A,!A)break;h[A+24>>2]=y,d=h[E+16>>2]|0,d|0&&(h[A+16>>2]=d,h[d+24>>2]=A),d=h[E+20>>2]|0,d&&(h[A+20>>2]=d,h[d+24>>2]=A)}while(!1);e:do if(b>>>0<16)me=b+I|0,h[E+4>>2]=me|3,me=E+me+4|0,h[me>>2]=h[me>>2]|1;else{if(h[E+4>>2]=I|3,h[O+4>>2]=b|1,h[O+b>>2]=b,A=b>>>3,b>>>0<256){m=27724+(A<<1<<2)|0,d=h[6921]|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=O,h[A+12>>2]=O,h[O+8>>2]=A,h[O+12>>2]=m;break}if(A=b>>>8,A?b>>>0>16777215?m=31:(be=(A+1048320|0)>>>16&8,me=A<<be,re=(me+520192|0)>>>16&4,me=me<<re,m=(me+245760|0)>>>16&2,m=14-(re|be|m)+(me<<m>>>15)|0,m=b>>>(m+7|0)&1|m<<1):m=0,A=27988+(m<<2)|0,h[O+28>>2]=m,d=O+16|0,h[d+4>>2]=0,h[d>>2]=0,d=1<<m,!(_&d)){h[6922]=_|d,h[A>>2]=O,h[O+24>>2]=A,h[O+12>>2]=O,h[O+8>>2]=O;break}A=h[A>>2]|0;t:do if((h[A+4>>2]&-8|0)!=(b|0)){for(_=b<<((m|0)==31?0:25-(m>>>1)|0);m=A+16+(_>>>31<<2)|0,d=h[m>>2]|0,!!d;)if((h[d+4>>2]&-8|0)==(b|0)){A=d;break t}else _=_<<1,A=d;h[m>>2]=O,h[O+24>>2]=A,h[O+12>>2]=O,h[O+8>>2]=O;break e}while(!1);be=A+8|0,me=h[be>>2]|0,h[me+12>>2]=O,h[be>>2]=O,h[O+8>>2]=me,h[O+12>>2]=A,h[O+24>>2]=0}while(!1);return me=E+8|0,Y=Fe,me|0}else G=I}else G=I;else G=-1;while(!1);if(m=h[6923]|0,m>>>0>=G>>>0)return A=m-G|0,d=h[6926]|0,A>>>0>15?(me=d+G|0,h[6926]=me,h[6923]=A,h[me+4>>2]=A|1,h[d+m>>2]=A,h[d+4>>2]=G|3):(h[6923]=0,h[6926]=0,h[d+4>>2]=m|3,me=d+m+4|0,h[me>>2]=h[me>>2]|1),me=d+8|0,Y=Fe,me|0;if(b=h[6924]|0,b>>>0>G>>>0)return re=b-G|0,h[6924]=re,me=h[6927]|0,be=me+G|0,h[6927]=be,h[be+4>>2]=re|1,h[me+4>>2]=G|3,me=me+8|0,Y=Fe,me|0;if(h[7039]|0?d=h[7041]|0:(h[7041]=4096,h[7040]=4096,h[7042]=-1,h[7043]=-1,h[7044]=0,h[7032]=0,h[7039]=q&-16^1431655768,d=4096),E=G+48|0,M=G+47|0,y=d+M|0,g=0-d|0,I=y&g,I>>>0<=G>>>0||(d=h[7031]|0,d|0&&(O=h[7029]|0,q=O+I|0,q>>>0<=O>>>0|q>>>0>d>>>0)))return me=0,Y=Fe,me|0;e:do if(h[7032]&4)A=0,oe=143;else{m=h[6927]|0;t:do if(m){for(_=28132;q=h[_>>2]|0,!(q>>>0<=m>>>0&&(q+(h[_+4>>2]|0)|0)>>>0>m>>>0);)if(d=h[_+8>>2]|0,d)_=d;else{oe=128;break t}if(A=y-b&g,A>>>0<2147483647)if(d=dd(A|0)|0,(d|0)==((h[_>>2]|0)+(h[_+4>>2]|0)|0)){if((d|0)!=-1){b=A,y=d,oe=145;break e}}else _=d,oe=136;else A=0}else oe=128;while(!1);do if((oe|0)==128)if(m=dd(0)|0,(m|0)!=-1&&(A=m,W=h[7040]|0,$=W+-1|0,A=(($&A|0)==0?0:($+A&0-W)-A|0)+I|0,W=h[7029]|0,$=A+W|0,A>>>0>G>>>0&A>>>0<2147483647)){if(q=h[7031]|0,q|0&&$>>>0<=W>>>0|$>>>0>q>>>0){A=0;break}if(d=dd(A|0)|0,(d|0)==(m|0)){b=A,y=m,oe=145;break e}else _=d,oe=136}else A=0;while(!1);do if((oe|0)==136){if(m=0-A|0,!(E>>>0>A>>>0&(A>>>0<2147483647&(_|0)!=-1)))if((_|0)==-1){A=0;break}else{b=A,y=_,oe=145;break e}if(d=h[7041]|0,d=M-A+d&0-d,d>>>0>=2147483647){b=A,y=_,oe=145;break e}if((dd(d|0)|0)==-1){dd(m|0)|0,A=0;break}else{b=d+A|0,y=_,oe=145;break e}}while(!1);h[7032]=h[7032]|4,oe=143}while(!1);if((oe|0)==143&&I>>>0<2147483647&&(re=dd(I|0)|0,$=dd(0)|0,ue=$-re|0,_e=ue>>>0>(G+40|0)>>>0,!((re|0)==-1|_e^1|re>>>0<$>>>0&((re|0)!=-1&($|0)!=-1)^1))&&(b=_e?ue:A,y=re,oe=145),(oe|0)==145){A=(h[7029]|0)+b|0,h[7029]=A,A>>>0>(h[7030]|0)>>>0&&(h[7030]=A),M=h[6927]|0;e:do if(M){for(A=28132;;){if(d=h[A>>2]|0,m=h[A+4>>2]|0,(y|0)==(d+m|0)){oe=154;break}if(_=h[A+8>>2]|0,_)A=_;else break}if((oe|0)==154&&(be=A+4|0,(h[A+12>>2]&8|0)==0)&&y>>>0>M>>>0&d>>>0<=M>>>0){h[be>>2]=m+b,me=(h[6924]|0)+b|0,re=M+8|0,re=(re&7|0)==0?0:0-re&7,be=M+re|0,re=me-re|0,h[6927]=be,h[6924]=re,h[be+4>>2]=re|1,h[M+me+4>>2]=40,h[6928]=h[7043];break}for(y>>>0<(h[6925]|0)>>>0&&(h[6925]=y),m=y+b|0,A=28132;;){if((h[A>>2]|0)==(m|0)){oe=162;break}if(d=h[A+8>>2]|0,d)A=d;else break}if((oe|0)==162&&(h[A+12>>2]&8|0)==0){h[A>>2]=y,O=A+4|0,h[O>>2]=(h[O>>2]|0)+b,O=y+8|0,O=y+((O&7|0)==0?0:0-O&7)|0,A=m+8|0,A=m+((A&7|0)==0?0:0-A&7)|0,I=O+G|0,E=A-O-G|0,h[O+4>>2]=G|3;t:do if((M|0)==(A|0))me=(h[6924]|0)+E|0,h[6924]=me,h[6927]=I,h[I+4>>2]=me|1;else{if((h[6926]|0)==(A|0)){me=(h[6923]|0)+E|0,h[6923]=me,h[6926]=I,h[I+4>>2]=me|1,h[I+me>>2]=me;break}if(d=h[A+4>>2]|0,(d&3|0)==1){b=d&-8,_=d>>>3;n:do if(d>>>0<256)if(d=h[A+8>>2]|0,m=h[A+12>>2]|0,(m|0)==(d|0)){h[6921]=h[6921]&~(1<<_);break}else{h[d+12>>2]=m,h[m+8>>2]=d;break}else{y=h[A+24>>2]|0,d=h[A+12>>2]|0;do if((d|0)==(A|0)){if(m=A+16|0,_=m+4|0,d=h[_>>2]|0,d)m=_;else if(d=h[m>>2]|0,!d){d=0;break}for(;;)if(g=d+20|0,_=h[g>>2]|0,_)d=_,m=g;else if(g=d+16|0,_=h[g>>2]|0,_)d=_,m=g;else break;h[m>>2]=0}else me=h[A+8>>2]|0,h[me+12>>2]=d,h[d+8>>2]=me;while(!1);if(!y)break;m=h[A+28>>2]|0,_=27988+(m<<2)|0;do if((h[_>>2]|0)!=(A|0)){if(me=y+16|0,h[((h[me>>2]|0)==(A|0)?me:y+20|0)>>2]=d,!d)break n}else{if(h[_>>2]=d,d|0)break;h[6922]=h[6922]&~(1<<m);break n}while(!1);if(h[d+24>>2]=y,m=A+16|0,_=h[m>>2]|0,_|0&&(h[d+16>>2]=_,h[_+24>>2]=d),m=h[m+4>>2]|0,!m)break;h[d+20>>2]=m,h[m+24>>2]=d}while(!1);A=A+b|0,g=b+E|0}else g=E;if(A=A+4|0,h[A>>2]=h[A>>2]&-2,h[I+4>>2]=g|1,h[I+g>>2]=g,A=g>>>3,g>>>0<256){m=27724+(A<<1<<2)|0,d=h[6921]|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=I,h[A+12>>2]=I,h[I+8>>2]=A,h[I+12>>2]=m;break}A=g>>>8;do if(!A)_=0;else{if(g>>>0>16777215){_=31;break}be=(A+1048320|0)>>>16&8,me=A<<be,re=(me+520192|0)>>>16&4,me=me<<re,_=(me+245760|0)>>>16&2,_=14-(re|be|_)+(me<<_>>>15)|0,_=g>>>(_+7|0)&1|_<<1}while(!1);if(A=27988+(_<<2)|0,h[I+28>>2]=_,d=I+16|0,h[d+4>>2]=0,h[d>>2]=0,d=h[6922]|0,m=1<<_,!(d&m)){h[6922]=d|m,h[A>>2]=I,h[I+24>>2]=A,h[I+12>>2]=I,h[I+8>>2]=I;break}A=h[A>>2]|0;n:do if((h[A+4>>2]&-8|0)!=(g|0)){for(_=g<<((_|0)==31?0:25-(_>>>1)|0);m=A+16+(_>>>31<<2)|0,d=h[m>>2]|0,!!d;)if((h[d+4>>2]&-8|0)==(g|0)){A=d;break n}else _=_<<1,A=d;h[m>>2]=I,h[I+24>>2]=A,h[I+12>>2]=I,h[I+8>>2]=I;break t}while(!1);be=A+8|0,me=h[be>>2]|0,h[me+12>>2]=I,h[be>>2]=I,h[I+8>>2]=me,h[I+12>>2]=A,h[I+24>>2]=0}while(!1);return me=O+8|0,Y=Fe,me|0}for(A=28132;d=h[A>>2]|0,!(d>>>0<=M>>>0&&(me=d+(h[A+4>>2]|0)|0,me>>>0>M>>>0));)A=h[A+8>>2]|0;g=me+-47|0,d=g+8|0,d=g+((d&7|0)==0?0:0-d&7)|0,g=M+16|0,d=d>>>0<g>>>0?M:d,A=d+8|0,m=b+-40|0,re=y+8|0,re=(re&7|0)==0?0:0-re&7,be=y+re|0,re=m-re|0,h[6927]=be,h[6924]=re,h[be+4>>2]=re|1,h[y+m+4>>2]=40,h[6928]=h[7043],m=d+4|0,h[m>>2]=27,h[A>>2]=h[7033],h[A+4>>2]=h[7034],h[A+8>>2]=h[7035],h[A+12>>2]=h[7036],h[7033]=y,h[7034]=b,h[7036]=0,h[7035]=A,A=d+24|0;do be=A,A=A+4|0,h[A>>2]=7;while((be+8|0)>>>0<me>>>0);if((d|0)!=(M|0)){if(y=d-M|0,h[m>>2]=h[m>>2]&-2,h[M+4>>2]=y|1,h[d>>2]=y,A=y>>>3,y>>>0<256){m=27724+(A<<1<<2)|0,d=h[6921]|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=M,h[A+12>>2]=M,h[M+8>>2]=A,h[M+12>>2]=m;break}if(A=y>>>8,A?y>>>0>16777215?_=31:(be=(A+1048320|0)>>>16&8,me=A<<be,re=(me+520192|0)>>>16&4,me=me<<re,_=(me+245760|0)>>>16&2,_=14-(re|be|_)+(me<<_>>>15)|0,_=y>>>(_+7|0)&1|_<<1):_=0,m=27988+(_<<2)|0,h[M+28>>2]=_,h[M+20>>2]=0,h[g>>2]=0,A=h[6922]|0,d=1<<_,!(A&d)){h[6922]=A|d,h[m>>2]=M,h[M+24>>2]=m,h[M+12>>2]=M,h[M+8>>2]=M;break}A=h[m>>2]|0;t:do if((h[A+4>>2]&-8|0)!=(y|0)){for(_=y<<((_|0)==31?0:25-(_>>>1)|0);m=A+16+(_>>>31<<2)|0,d=h[m>>2]|0,!!d;)if((h[d+4>>2]&-8|0)==(y|0)){A=d;break t}else _=_<<1,A=d;h[m>>2]=M,h[M+24>>2]=A,h[M+12>>2]=M,h[M+8>>2]=M;break e}while(!1);be=A+8|0,me=h[be>>2]|0,h[me+12>>2]=M,h[be>>2]=M,h[M+8>>2]=me,h[M+12>>2]=A,h[M+24>>2]=0}}else me=h[6925]|0,(me|0)==0|y>>>0<me>>>0&&(h[6925]=y),h[7033]=y,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,me=b+-40|0,re=y+8|0,re=(re&7|0)==0?0:0-re&7,be=y+re|0,re=me-re|0,h[6927]=be,h[6924]=re,h[be+4>>2]=re|1,h[y+me+4>>2]=40,h[6928]=h[7043];while(!1);if(A=h[6924]|0,A>>>0>G>>>0)return re=A-G|0,h[6924]=re,me=h[6927]|0,be=me+G|0,h[6927]=be,h[be+4>>2]=re|1,h[me+4>>2]=G|3,me=me+8|0,Y=Fe,me|0}return me=z9()|0,h[me>>2]=12,me=0,Y=Fe,me|0}function _t(d){d=d|0;var A=0,m=0,_=0,g=0,y=0,b=0,E=0,M=0;if(d){m=d+-8|0,g=h[6925]|0,d=h[d+-4>>2]|0,A=d&-8,M=m+A|0;do if(d&1)E=m,b=m;else{if(_=h[m>>2]|0,!(d&3)||(b=m+(0-_)|0,y=_+A|0,b>>>0<g>>>0))return;if((h[6926]|0)==(b|0)){if(d=M+4|0,A=h[d>>2]|0,(A&3|0)!=3){E=b,A=y;break}h[6923]=y,h[d>>2]=A&-2,h[b+4>>2]=y|1,h[b+y>>2]=y;return}if(m=_>>>3,_>>>0<256)if(d=h[b+8>>2]|0,A=h[b+12>>2]|0,(A|0)==(d|0)){h[6921]=h[6921]&~(1<<m),E=b,A=y;break}else{h[d+12>>2]=A,h[A+8>>2]=d,E=b,A=y;break}g=h[b+24>>2]|0,d=h[b+12>>2]|0;do if((d|0)==(b|0)){if(A=b+16|0,m=A+4|0,d=h[m>>2]|0,d)A=m;else if(d=h[A>>2]|0,!d){d=0;break}for(;;)if(_=d+20|0,m=h[_>>2]|0,m)d=m,A=_;else if(_=d+16|0,m=h[_>>2]|0,m)d=m,A=_;else break;h[A>>2]=0}else E=h[b+8>>2]|0,h[E+12>>2]=d,h[d+8>>2]=E;while(!1);if(g){if(A=h[b+28>>2]|0,m=27988+(A<<2)|0,(h[m>>2]|0)==(b|0)){if(h[m>>2]=d,!d){h[6922]=h[6922]&~(1<<A),E=b,A=y;break}}else if(E=g+16|0,h[((h[E>>2]|0)==(b|0)?E:g+20|0)>>2]=d,!d){E=b,A=y;break}h[d+24>>2]=g,A=b+16|0,m=h[A>>2]|0,m|0&&(h[d+16>>2]=m,h[m+24>>2]=d),A=h[A+4>>2]|0,A?(h[d+20>>2]=A,h[A+24>>2]=d,E=b,A=y):(E=b,A=y)}else E=b,A=y}while(!1);if(!(b>>>0>=M>>>0)&&(d=M+4|0,_=h[d>>2]|0,!!(_&1))){if(_&2)h[d>>2]=_&-2,h[E+4>>2]=A|1,h[b+A>>2]=A,g=A;else{if((h[6927]|0)==(M|0)){if(M=(h[6924]|0)+A|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)+A|0,h[6923]=M,h[6926]=b,h[E+4>>2]=M|1,h[b+M>>2]=M;return}g=(_&-8)+A|0,m=_>>>3;do if(_>>>0<256)if(A=h[M+8>>2]|0,d=h[M+12>>2]|0,(d|0)==(A|0)){h[6921]=h[6921]&~(1<<m);break}else{h[A+12>>2]=d,h[d+8>>2]=A;break}else{y=h[M+24>>2]|0,d=h[M+12>>2]|0;do if((d|0)==(M|0)){if(A=M+16|0,m=A+4|0,d=h[m>>2]|0,d)A=m;else if(d=h[A>>2]|0,!d){m=0;break}for(;;)if(_=d+20|0,m=h[_>>2]|0,m)d=m,A=_;else if(_=d+16|0,m=h[_>>2]|0,m)d=m,A=_;else break;h[A>>2]=0,m=d}else m=h[M+8>>2]|0,h[m+12>>2]=d,h[d+8>>2]=m,m=d;while(!1);if(y|0){if(d=h[M+28>>2]|0,A=27988+(d<<2)|0,(h[A>>2]|0)==(M|0)){if(h[A>>2]=m,!m){h[6922]=h[6922]&~(1<<d);break}}else if(_=y+16|0,h[((h[_>>2]|0)==(M|0)?_:y+20|0)>>2]=m,!m)break;h[m+24>>2]=y,d=M+16|0,A=h[d>>2]|0,A|0&&(h[m+16>>2]=A,h[A+24>>2]=m),d=h[d+4>>2]|0,d|0&&(h[m+20>>2]=d,h[d+24>>2]=m)}}while(!1);if(h[E+4>>2]=g|1,h[b+g>>2]=g,(E|0)==(h[6926]|0)){h[6923]=g;return}}if(d=g>>>3,g>>>0<256){m=27724+(d<<1<<2)|0,A=h[6921]|0,d=1<<d,A&d?(A=m+8|0,d=h[A>>2]|0):(h[6921]=A|d,d=m,A=m+8|0),h[A>>2]=E,h[d+12>>2]=E,h[E+8>>2]=d,h[E+12>>2]=m;return}d=g>>>8,d?g>>>0>16777215?_=31:(b=(d+1048320|0)>>>16&8,M=d<<b,y=(M+520192|0)>>>16&4,M=M<<y,_=(M+245760|0)>>>16&2,_=14-(y|b|_)+(M<<_>>>15)|0,_=g>>>(_+7|0)&1|_<<1):_=0,d=27988+(_<<2)|0,h[E+28>>2]=_,h[E+20>>2]=0,h[E+16>>2]=0,A=h[6922]|0,m=1<<_;e:do if(!(A&m))h[6922]=A|m,h[d>>2]=E,h[E+24>>2]=d,h[E+12>>2]=E,h[E+8>>2]=E;else{d=h[d>>2]|0;t:do if((h[d+4>>2]&-8|0)!=(g|0)){for(_=g<<((_|0)==31?0:25-(_>>>1)|0);m=d+16+(_>>>31<<2)|0,A=h[m>>2]|0,!!A;)if((h[A+4>>2]&-8|0)==(g|0)){d=A;break t}else _=_<<1,d=A;h[m>>2]=E,h[E+24>>2]=d,h[E+12>>2]=E,h[E+8>>2]=E;break e}while(!1);b=d+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]=d,h[E+24>>2]=0}while(!1);if(M=(h[6929]|0)+-1|0,h[6929]=M,!(M|0)){for(d=28140;d=h[d>>2]|0,d;)d=d+8|0;h[6929]=-1}}}}function ra(d,A){d=d|0,A=A|0;var m=0;return d?(m=Fa(A,d)|0,(A|d)>>>0>65535&&(m=((m>>>0)/(d>>>0)|0|0)==(A|0)?m:-1)):m=0,d=lr(m)|0,!d||!(h[d+-4>>2]&3)||fd(d|0,0,m|0)|0,d|0}function Ose(d,A){d=d|0,A=A|0;var m=0,_=0;return d?A>>>0>4294967231?(A=z9()|0,h[A>>2]=12,A=0,A|0):(m=Bse(d+-8|0,A>>>0<11?16:A+11&-8)|0,m|0?(A=m+8|0,A|0):(m=lr(A)|0,m?(_=h[d+-4>>2]|0,_=(_&-8)-((_&3|0)==0?8:4)|0,wc(m|0,d|0,(_>>>0<A>>>0?_:A)|0)|0,_t(d),A=m,A|0):(A=0,A|0))):(A=lr(A)|0,A|0)}function Bse(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0,M=0,I=0,O=0,G=0;if(O=d+4|0,G=h[O>>2]|0,m=G&-8,E=d+m|0,!(G&3))return A>>>0<256?(d=0,d|0):(m>>>0>=(A+4|0)>>>0&&(m-A|0)>>>0<=h[7041]<<1>>>0||(d=0),d|0);if(m>>>0>=A>>>0)return m=m-A|0,m>>>0<=15||(I=d+A|0,h[O>>2]=G&1|A|2,h[I+4>>2]=m|3,G=E+4|0,h[G>>2]=h[G>>2]|1,W9(I,m)),d|0;if((h[6927]|0)==(E|0))return I=(h[6924]|0)+m|0,m=I-A|0,_=d+A|0,I>>>0<=A>>>0?(d=0,d|0):(h[O>>2]=G&1|A|2,h[_+4>>2]=m|1,h[6927]=_,h[6924]=m,d|0);if((h[6926]|0)==(E|0))return _=(h[6923]|0)+m|0,_>>>0<A>>>0?(d=0,d|0):(m=_-A|0,m>>>0>15?(I=d+A|0,_=d+_|0,h[O>>2]=G&1|A|2,h[I+4>>2]=m|1,h[_>>2]=m,_=_+4|0,h[_>>2]=h[_>>2]&-2,_=I):(h[O>>2]=G&1|_|2,_=d+_+4|0,h[_>>2]=h[_>>2]|1,_=0,m=0),h[6923]=m,h[6926]=_,d|0);if(_=h[E+4>>2]|0,_&2|0||(M=(_&-8)+m|0,M>>>0<A>>>0))return d=0,d|0;I=M-A|0,g=_>>>3;do if(_>>>0<256)if(_=h[E+8>>2]|0,m=h[E+12>>2]|0,(m|0)==(_|0)){h[6921]=h[6921]&~(1<<g);break}else{h[_+12>>2]=m,h[m+8>>2]=_;break}else{b=h[E+24>>2]|0,m=h[E+12>>2]|0;do if((m|0)==(E|0)){if(_=E+16|0,g=_+4|0,m=h[g>>2]|0,m)_=g;else if(m=h[_>>2]|0,!m){g=0;break}for(;;)if(y=m+20|0,g=h[y>>2]|0,g)m=g,_=y;else if(y=m+16|0,g=h[y>>2]|0,g)m=g,_=y;else break;h[_>>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(b|0){if(m=h[E+28>>2]|0,_=27988+(m<<2)|0,(h[_>>2]|0)==(E|0)){if(h[_>>2]=g,!g){h[6922]=h[6922]&~(1<<m);break}}else if(y=b+16|0,h[((h[y>>2]|0)==(E|0)?y:b+20|0)>>2]=g,!g)break;h[g+24>>2]=b,m=E+16|0,_=h[m>>2]|0,_|0&&(h[g+16>>2]=_,h[_+24>>2]=g),m=h[m+4>>2]|0,m|0&&(h[g+20>>2]=m,h[m+24>>2]=g)}}while(!1);return I>>>0<16?(h[O>>2]=G&1|M|2,G=d+M+4|0,h[G>>2]=h[G>>2]|1,d|0):(E=d+A|0,h[O>>2]=G&1|A|2,h[E+4>>2]=I|3,G=d+M+4|0,h[G>>2]=h[G>>2]|1,W9(E,I),d|0)}function W9(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0,b=0,E=0;E=d+A|0,m=h[d+4>>2]|0;do if(m&1)b=d;else{if(g=h[d>>2]|0,!(m&3))return;if(b=d+(0-g)|0,A=g+A|0,(h[6926]|0)==(b|0)){if(d=E+4|0,m=h[d>>2]|0,(m&3|0)!=3)break;h[6923]=A,h[d>>2]=m&-2,h[b+4>>2]=A|1,h[E>>2]=A;return}if(_=g>>>3,g>>>0<256)if(d=h[b+8>>2]|0,m=h[b+12>>2]|0,(m|0)==(d|0)){h[6921]=h[6921]&~(1<<_);break}else{h[d+12>>2]=m,h[m+8>>2]=d;break}y=h[b+24>>2]|0,d=h[b+12>>2]|0;do if((d|0)==(b|0)){if(m=b+16|0,_=m+4|0,d=h[_>>2]|0,d)m=_;else if(d=h[m>>2]|0,!d){d=0;break}for(;;)if(g=d+20|0,_=h[g>>2]|0,_)d=_,m=g;else if(g=d+16|0,_=h[g>>2]|0,_)d=_,m=g;else break;h[m>>2]=0}else g=h[b+8>>2]|0,h[g+12>>2]=d,h[d+8>>2]=g;while(!1);if(y){if(m=h[b+28>>2]|0,_=27988+(m<<2)|0,(h[_>>2]|0)==(b|0)){if(h[_>>2]=d,!d){h[6922]=h[6922]&~(1<<m);break}}else if(g=y+16|0,h[((h[g>>2]|0)==(b|0)?g:y+20|0)>>2]=d,!d)break;h[d+24>>2]=y,m=b+16|0,_=h[m>>2]|0,_|0&&(h[d+16>>2]=_,h[_+24>>2]=d),m=h[m+4>>2]|0,m&&(h[d+20>>2]=m,h[m+24>>2]=d)}}while(!1);if(d=E+4|0,_=h[d>>2]|0,_&2)h[d>>2]=_&-2,h[b+4>>2]=A|1,h[b+A>>2]=A,g=A;else{if((h[6927]|0)==(E|0)){if(E=(h[6924]|0)+A|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)+A|0,h[6923]=E,h[6926]=b,h[b+4>>2]=E|1,h[b+E>>2]=E;return}g=(_&-8)+A|0,m=_>>>3;do if(_>>>0<256)if(d=h[E+8>>2]|0,A=h[E+12>>2]|0,(A|0)==(d|0)){h[6921]=h[6921]&~(1<<m);break}else{h[d+12>>2]=A,h[A+8>>2]=d;break}else{y=h[E+24>>2]|0,A=h[E+12>>2]|0;do if((A|0)==(E|0)){if(d=E+16|0,m=d+4|0,A=h[m>>2]|0,A)d=m;else if(A=h[d>>2]|0,!A){m=0;break}for(;;)if(_=A+20|0,m=h[_>>2]|0,m)A=m,d=_;else if(_=A+16|0,m=h[_>>2]|0,m)A=m,d=_;else break;h[d>>2]=0,m=A}else m=h[E+8>>2]|0,h[m+12>>2]=A,h[A+8>>2]=m,m=A;while(!1);if(y|0){if(A=h[E+28>>2]|0,d=27988+(A<<2)|0,(h[d>>2]|0)==(E|0)){if(h[d>>2]=m,!m){h[6922]=h[6922]&~(1<<A);break}}else if(_=y+16|0,h[((h[_>>2]|0)==(E|0)?_:y+20|0)>>2]=m,!m)break;h[m+24>>2]=y,A=E+16|0,d=h[A>>2]|0,d|0&&(h[m+16>>2]=d,h[d+24>>2]=m),A=h[A+4>>2]|0,A|0&&(h[m+20>>2]=A,h[A+24>>2]=m)}}while(!1);if(h[b+4>>2]=g|1,h[b+g>>2]=g,(b|0)==(h[6926]|0)){h[6923]=g;return}}if(A=g>>>3,g>>>0<256){m=27724+(A<<1<<2)|0,d=h[6921]|0,A=1<<A,d&A?(d=m+8|0,A=h[d>>2]|0):(h[6921]=d|A,A=m,d=m+8|0),h[d>>2]=b,h[A+12>>2]=b,h[b+8>>2]=A,h[b+12>>2]=m;return}if(A=g>>>8,A?g>>>0>16777215?_=31:(y=(A+1048320|0)>>>16&8,E=A<<y,m=(E+520192|0)>>>16&4,E=E<<m,_=(E+245760|0)>>>16&2,_=14-(m|y|_)+(E<<_>>>15)|0,_=g>>>(_+7|0)&1|_<<1):_=0,A=27988+(_<<2)|0,h[b+28>>2]=_,h[b+20>>2]=0,h[b+16>>2]=0,d=h[6922]|0,m=1<<_,!(d&m)){h[6922]=d|m,h[A>>2]=b,h[b+24>>2]=A,h[b+12>>2]=b,h[b+8>>2]=b;return}A=h[A>>2]|0;e:do if((h[A+4>>2]&-8|0)!=(g|0)){for(_=g<<((_|0)==31?0:25-(_>>>1)|0);m=A+16+(_>>>31<<2)|0,d=h[m>>2]|0,!!d;)if((h[d+4>>2]&-8|0)==(g|0)){A=d;break e}else _=_<<1,A=d;h[m>>2]=b,h[b+24>>2]=A,h[b+12>>2]=b,h[b+8>>2]=b;return}while(!1);y=A+8|0,E=h[y>>2]|0,h[E+12>>2]=b,h[y>>2]=b,h[b+8>>2]=E,h[b+12>>2]=A,h[b+24>>2]=0}function pt(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,m=d+m>>>0,Dn(A+_+(m>>>0<d>>>0|0)>>>0|0),m|0|0}function Fs(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,_=A-_-(m>>>0>d>>>0|0)>>>0,Dn(_|0),d-m>>>0|0|0}function j9(d){return d=d|0,(d?31-(Zh(d^d-1)|0)|0:32)|0}function H4(d,A,m,_,g){d=d|0,A=A|0,m=m|0,_=_|0,g=g|0;var y=0,b=0,E=0,M=0,I=0,O=0,G=0,q=0,W=0,$=0;if(O=d,M=A,I=M,b=m,q=_,E=q,!I)return y=(g|0)!=0,E?y?(h[g>>2]=d|0,h[g+4>>2]=A&0,q=0,g=0,Dn(q|0),g|0):(q=0,g=0,Dn(q|0),g|0):(y&&(h[g>>2]=(O>>>0)%(b>>>0),h[g+4>>2]=0),q=0,g=(O>>>0)/(b>>>0)>>>0,Dn(q|0),g|0);y=(E|0)==0;do if(b){if(!y){if(y=(Zh(E|0)|0)-(Zh(I|0)|0)|0,y>>>0<=31){G=y+1|0,E=31-y|0,A=y-31>>31,b=G,d=O>>>(G>>>0)&A|I<<E,A=I>>>(G>>>0)&A,y=0,E=O<<E;break}return g?(h[g>>2]=d|0,h[g+4>>2]=M|A&0,q=0,g=0,Dn(q|0),g|0):(q=0,g=0,Dn(q|0),g|0)}if(y=b-1|0,y&b|0){E=(Zh(b|0)|0)+33-(Zh(I|0)|0)|0,$=64-E|0,G=32-E|0,M=G>>31,W=E-32|0,A=W>>31,b=E,d=G-1>>31&I>>>(W>>>0)|(I<<G|O>>>(E>>>0))&A,A=A&I>>>(E>>>0),y=O<<$&M,E=(I<<$|O>>>(W>>>0))&M|O<<G&E-33>>31;break}return g|0&&(h[g>>2]=y&O,h[g+4>>2]=0),(b|0)==1?(W=M|A&0,$=d|0|0,Dn(W|0),$|0):($=j9(b|0)|0,W=I>>>($>>>0)|0,$=I<<32-$|O>>>($>>>0)|0,Dn(W|0),$|0)}else{if(y)return g|0&&(h[g>>2]=(I>>>0)%(b>>>0),h[g+4>>2]=0),W=0,$=(I>>>0)/(b>>>0)>>>0,Dn(W|0),$|0;if(!O)return g|0&&(h[g>>2]=0,h[g+4>>2]=(I>>>0)%(E>>>0)),W=0,$=(I>>>0)/(E>>>0)>>>0,Dn(W|0),$|0;if(y=E-1|0,!(y&E))return g|0&&(h[g>>2]=d|0,h[g+4>>2]=y&I|A&0),W=0,$=I>>>((j9(E|0)|0)>>>0),Dn(W|0),$|0;if(y=(Zh(E|0)|0)-(Zh(I|0)|0)|0,y>>>0<=30){A=y+1|0,E=31-y|0,b=A,d=I<<E|O>>>(A>>>0),A=I>>>(A>>>0),y=0,E=O<<E;break}return g?(h[g>>2]=d|0,h[g+4>>2]=M|A&0,W=0,$=0,Dn(W|0),$|0):(W=0,$=0,Dn(W|0),$|0)}while(!1);if(!b)I=E,M=0,E=0;else{G=m|0|0,O=q|_&0,I=pt(G|0,O|0,-1,-1)|0,m=Q()|0,M=E,E=0;do _=M,M=y>>>31|M<<1,y=E|y<<1,_=d<<1|_>>>31|0,q=d>>>31|A<<1|0,Fs(I|0,m|0,_|0,q|0)|0,$=Q()|0,W=$>>31|(($|0)<0?-1:0)<<1,E=W&1,d=Fs(_|0,q|0,W&G|0,((($|0)<0?-1:0)>>31|(($|0)<0?-1:0)<<1)&O|0)|0,A=Q()|0,b=b-1|0;while((b|0)!=0);I=M,M=0}return b=0,g|0&&(h[g>>2]=d,h[g+4>>2]=A),W=(y|0)>>>31|(I|b)<<1|(b<<1|y>>>31)&0|M,$=(y<<1|0)&-2|E,Dn(W|0),$|0}function ud(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;return I=A>>31|((A|0)<0?-1:0)<<1,M=((A|0)<0?-1:0)>>31|((A|0)<0?-1:0)<<1,y=_>>31|((_|0)<0?-1:0)<<1,g=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,E=Fs(I^d|0,M^A|0,I|0,M|0)|0,b=Q()|0,d=y^I,A=g^M,Fs((H4(E,b,Fs(y^m|0,g^_|0,y|0,g|0)|0,Q()|0,0)|0)^d|0,(Q()|0)^A|0,d|0,A|0)|0}function Use(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return y=d&65535,g=A&65535,m=Fa(g,y)|0,_=d>>>16,d=(m>>>16)+(Fa(g,_)|0)|0,g=A>>>16,A=Fa(g,y)|0,Dn((d>>>16)+(Fa(g,_)|0)+(((d&65535)+A|0)>>>16)|0),d+A<<16|m&65535|0|0}function cr(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;return g=d,y=m,m=Use(g,y)|0,d=Q()|0,Dn((Fa(A,y)|0)+(Fa(_,g)|0)+d|d&0|0),m|0|0|0}function hd(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0,E=0,M=0,I=0;return g=Y,Y=Y+16|0,E=g|0,b=A>>31|((A|0)<0?-1:0)<<1,y=((A|0)<0?-1:0)>>31|((A|0)<0?-1:0)<<1,I=_>>31|((_|0)<0?-1:0)<<1,M=((_|0)<0?-1:0)>>31|((_|0)<0?-1:0)<<1,d=Fs(b^d|0,y^A|0,b|0,y|0)|0,A=Q()|0,H4(d,A,Fs(I^m|0,M^_|0,I|0,M|0)|0,Q()|0,E)|0,_=Fs(h[E>>2]^b|0,h[E+4>>2]^y|0,b|0,y|0)|0,m=Q()|0,Y=g,Dn(m|0),_|0}function Kh(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;return y=Y,Y=Y+16|0,g=y|0,H4(d,A,m,_,g)|0,Y=y,Dn(h[g+4>>2]|0),h[g>>2]|0|0}function X9(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Dn(A>>m|0),d>>>m|(A&(1<<m)-1)<<32-m):(Dn(((A|0)<0?-1:0)|0),A>>m-32|0)}function et(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Dn(A>>>m|0),d>>>m|(A&(1<<m)-1)<<32-m):(Dn(0),A>>>m-32|0)}function ht(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Dn(A<<m|(d&(1<<m)-1<<32-m)>>>32-m|0),d<<m):(Dn(d<<m-32|0),0)}function W4(d,A,m){return d=d|0,A=A|0,m=m|0,A=Zh(A)|0,(A|0)==32&&(A=A+(Zh(d)|0)|0),Dn(0),A|0}function $9(d,A){return d=+d,A=+A,d!=d?+A:A!=A?+d:+rre(+d,+A)}function sw(d,A){return d=+d,A=+A,d!=d?+A:A!=A?+d:+v4(+d,+A)}function ow(d){return d=+d,d>=0?+js(d+.5):+ng(d-.5)}function wc(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if((m|0)>=8192)return are(d|0,A|0,m|0)|0,d|0;if(y=d|0,g=d+m|0,(d&3)==(A&3)){for(;d&3;){if(!m)return y|0;He[d>>0]=He[A>>0]|0,d=d+1|0,A=A+1|0,m=m-1|0}for(m=g&-4|0,_=m-64|0;(d|0)<=(_|0);)h[d>>2]=h[A>>2],h[d+4>>2]=h[A+4>>2],h[d+8>>2]=h[A+8>>2],h[d+12>>2]=h[A+12>>2],h[d+16>>2]=h[A+16>>2],h[d+20>>2]=h[A+20>>2],h[d+24>>2]=h[A+24>>2],h[d+28>>2]=h[A+28>>2],h[d+32>>2]=h[A+32>>2],h[d+36>>2]=h[A+36>>2],h[d+40>>2]=h[A+40>>2],h[d+44>>2]=h[A+44>>2],h[d+48>>2]=h[A+48>>2],h[d+52>>2]=h[A+52>>2],h[d+56>>2]=h[A+56>>2],h[d+60>>2]=h[A+60>>2],d=d+64|0,A=A+64|0;for(;(d|0)<(m|0);)h[d>>2]=h[A>>2],d=d+4|0,A=A+4|0}else for(m=g-4|0;(d|0)<(m|0);)He[d>>0]=He[A>>0]|0,He[d+1>>0]=He[A+1>>0]|0,He[d+2>>0]=He[A+2>>0]|0,He[d+3>>0]=He[A+3>>0]|0,d=d+4|0,A=A+4|0;for(;(d|0)<(g|0);)He[d>>0]=He[A>>0]|0,d=d+1|0,A=A+1|0;return y|0}function j4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0;if((A|0)<(d|0)&(d|0)<(A+m|0)){for(_=d,A=A+m|0,d=d+m|0;(m|0)>0;)d=d-1|0,A=A-1|0,m=m-1|0,He[d>>0]=He[A>>0]|0;d=_}else wc(d,A,m)|0;return d|0}function fd(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0,b=0;if(y=d+m|0,A=A&255,(m|0)>=67){for(;d&3;)He[d>>0]=A,d=d+1|0;for(_=y&-4|0,b=A|A<<8|A<<16|A<<24,g=_-64|0;(d|0)<=(g|0);)h[d>>2]=b,h[d+4>>2]=b,h[d+8>>2]=b,h[d+12>>2]=b,h[d+16>>2]=b,h[d+20>>2]=b,h[d+24>>2]=b,h[d+28>>2]=b,h[d+32>>2]=b,h[d+36>>2]=b,h[d+40>>2]=b,h[d+44>>2]=b,h[d+48>>2]=b,h[d+52>>2]=b,h[d+56>>2]=b,h[d+60>>2]=b,d=d+64|0;for(;(d|0)<(_|0);)h[d>>2]=b,d=d+4|0}for(;(d|0)<(y|0);)He[d>>0]=A,d=d+1|0;return y-m|0}function Y9(d){return d=+d,d>=0?+js(d+.5):+ng(d-.5)}function dd(d){d=d|0;var A=0,m=0,_=0;return _=ore()|0,m=h[Da>>2]|0,A=m+d|0,(d|0)>0&(A|0)<(m|0)|(A|0)<0?(cre(A|0)|0,u9(12),-1):(A|0)>(_|0)&&!(lre(A|0)|0)?(u9(12),-1):(h[Da>>2]=A,m|0)}function kse(d,A,m){return d=d|0,A=A|0,m=m|0,pd[d&3](A|0,m|0)|0}function Gse(d,A){return d=d|0,A=A|0,sre(0),0}var pd=[Gse,Ore,Bre,Ure];return{___divdi3:ud,___muldi3:cr,___remdi3:hd,___uremdi3:Kh,_areNeighborCells:kre,_bitshift64Ashr:X9,_bitshift64Lshr:et,_bitshift64Shl:ht,_calloc:ra,_cellAreaKm2:bre,_cellAreaM2:wre,_cellAreaRads2:vre,_cellToBoundary:L0,_cellToCenterChild:C9,_cellToChildPos:sse,_cellToChildren:Zre,_cellToChildrenSize:cx,_cellToLatLng:sg,_cellToLocalIj:gse,_cellToParent:I4,_cellToVertex:Vl,_cellToVertexes:Dse,_cellsToDirectedEdge:Gre,_cellsToLinkedMultiPolygon:yre,_childPosToCell:ose,_compactCells:Kre,_constructCell:$re,_destroyLinkedMultiPolygon:Ase,_directedEdgeToBoundary:ax,_directedEdgeToCells:qre,_edgeLengthKm:dse,_edgeLengthM:pse,_edgeLengthRads:fse,_emscripten_replace_memory:ure,_free:_t,_getBaseCellNumber:E9,_getDirectedEdgeDestination:Vre,_getDirectedEdgeOrigin:zre,_getHexagonAreaAvgKm2:I9,_getHexagonAreaAvgM2:cse,_getHexagonEdgeLengthAvgKm:use,_getHexagonEdgeLengthAvgM:hse,_getIcosahedronFaces:R9,_getIndexDigit:Xre,_getNumCells:Qb,_getPentagons:O4,_getRes0Cells:Cre,_getResolution:R4,_greatCircleDistanceKm:hx,_greatCircleDistanceM:lse,_greatCircleDistanceRads:ase,_gridDisk:h9,_gridDiskDistances:f9,_gridDistance:k4,_gridPathCells:yse,_gridPathCellsSize:xse,_gridRing:mre,_gridRingUnsafe:p9,_i64Add:pt,_i64Subtract:Fs,_isPentagon:ki,_isResClassIII:ese,_isValidCell:Kb,_isValidDirectedEdge:b9,_isValidIndex:Yre,_isValidVertex:G9,_latLngToCell:D4,_llvm_ctlz_i64:W4,_llvm_maxnum_f64:$9,_llvm_minnum_f64:sw,_llvm_round_f64:ow,_localIjToCell:_se,_malloc:lr,_maxFaceCount:ise,_maxGridDiskSize:Are,_maxPolygonToCellsSize:_re,_maxPolygonToCellsSizeExperimental:wse,_memcpy:wc,_memmove:j4,_memset:fd,_originToDirectedEdges:E4,_pentagonCount:rse,_polygonToCells:xre,_polygonToCellsExperimental:bse,_readInt64AsDoubleFromPointer:Ise,_res0CellCount:Mre,_reverseDirectedEdge:w9,_round:Y9,_sbrk:dd,_sizeOfCellBoundary:Ese,_sizeOfCoordIJ:Pse,_sizeOfGeoLoop:Mse,_sizeOfGeoPolygon:Cse,_sizeOfH3Index:Sse,_sizeOfLatLng:Tse,_sizeOfLinkedGeoPolygon:Rse,_uncompactCells:Qre,_uncompactCellsSize:Jre,_vertexToLatLng:Fse,dynCall_iii:kse,establishStackSpace:pre,stackAlloc:hre,stackRestore:dre,stackSave:fre}})(Dt,ct,Z),jt=e.___divdi3=Ce.___divdi3,Hi=e.___muldi3=Ce.___muldi3,Nn=e.___remdi3=Ce.___remdi3,zr=e.___uremdi3=Ce.___uremdi3,gr=e._areNeighborCells=Ce._areNeighborCells,ol=e._bitshift64Ashr=Ce._bitshift64Ashr,na=e._bitshift64Lshr=Ce._bitshift64Lshr,al=e._bitshift64Shl=Ce._bitshift64Shl,Na=e._calloc=Ce._calloc,or=e._cellAreaKm2=Ce._cellAreaKm2,Ns=e._cellAreaM2=Ce._cellAreaM2,ll=e._cellAreaRads2=Ce._cellAreaRads2,Au=e._cellToBoundary=Ce._cellToBoundary,jb=e._cellToCenterChild=Ce._cellToCenterChild,d4=e._cellToChildPos=Ce._cellToChildPos,p4=e._cellToChildren=Ce._cellToChildren,rx=e._cellToChildrenSize=Ce._cellToChildrenSize,A4=e._cellToLatLng=Ce._cellToLatLng,sx=e._cellToLocalIj=Ce._cellToLocalIj,m4=e._cellToParent=Ce._cellToParent,g4=e._cellToVertex=Ce._cellToVertex,t9=e._cellToVertexes=Ce._cellToVertexes,n9=e._cellsToDirectedEdge=Ce._cellsToDirectedEdge,i9=e._cellsToLinkedMultiPolygon=Ce._cellsToLinkedMultiPolygon,r9=e._childPosToCell=Ce._childPosToCell,te=e._compactCells=Ce._compactCells,Se=e._constructCell=Ce._constructCell,ke=e._destroyLinkedMultiPolygon=Ce._destroyLinkedMultiPolygon,Le=e._directedEdgeToBoundary=Ce._directedEdgeToBoundary,De=e._directedEdgeToCells=Ce._directedEdgeToCells,zt=e._edgeLengthKm=Ce._edgeLengthKm,Yt=e._edgeLengthM=Ce._edgeLengthM,kt=e._edgeLengthRads=Ce._edgeLengthRads,tn=e._emscripten_replace_memory=Ce._emscripten_replace_memory,hn=e._free=Ce._free,zn=e._getBaseCellNumber=Ce._getBaseCellNumber,$n=e._getDirectedEdgeDestination=Ce._getDirectedEdgeDestination,pn=e._getDirectedEdgeOrigin=Ce._getDirectedEdgeOrigin,Ui=e._getHexagonAreaAvgKm2=Ce._getHexagonAreaAvgKm2,Vr=e._getHexagonAreaAvgM2=Ce._getHexagonAreaAvgM2,Cr=e._getHexagonEdgeLengthAvgKm=Ce._getHexagonEdgeLengthAvgKm,Wi=e._getHexagonEdgeLengthAvgM=Ce._getHexagonEdgeLengthAvgM,ao=e._getIcosahedronFaces=Ce._getIcosahedronFaces,Xt=e._getIndexDigit=Ce._getIndexDigit,La=e._getNumCells=Ce._getNumCells,mi=e._getPentagons=Ce._getPentagons,cl=e._getRes0Cells=Ce._getRes0Cells,bc=e._getResolution=Ce._getResolution,Xh=e._greatCircleDistanceKm=Ce._greatCircleDistanceKm,R0=e._greatCircleDistanceM=Ce._greatCircleDistanceM,ji=e._greatCircleDistanceRads=Ce._greatCircleDistanceRads,qr=e._gridDisk=Ce._gridDisk,$h=e._gridDiskDistances=Ce._gridDiskDistances,tr=e._gridDistance=Ce._gridDistance,Yh=e._gridPathCells=Ce._gridPathCells,P0=e._gridPathCellsSize=Ce._gridPathCellsSize,_4=e._gridRing=Ce._gridRing,D4e=e._gridRingUnsafe=Ce._gridRingUnsafe,F4e=e._i64Add=Ce._i64Add,O4e=e._i64Subtract=Ce._i64Subtract,B4e=e._isPentagon=Ce._isPentagon,U4e=e._isResClassIII=Ce._isResClassIII,k4e=e._isValidCell=Ce._isValidCell,G4e=e._isValidDirectedEdge=Ce._isValidDirectedEdge,z4e=e._isValidIndex=Ce._isValidIndex,V4e=e._isValidVertex=Ce._isValidVertex,q4e=e._latLngToCell=Ce._latLngToCell,H4e=e._llvm_ctlz_i64=Ce._llvm_ctlz_i64,W4e=e._llvm_maxnum_f64=Ce._llvm_maxnum_f64,j4e=e._llvm_minnum_f64=Ce._llvm_minnum_f64,X4e=e._llvm_round_f64=Ce._llvm_round_f64,$4e=e._localIjToCell=Ce._localIjToCell,Y4e=e._malloc=Ce._malloc,Z4e=e._maxFaceCount=Ce._maxFaceCount,K4e=e._maxGridDiskSize=Ce._maxGridDiskSize,Q4e=e._maxPolygonToCellsSize=Ce._maxPolygonToCellsSize,J4e=e._maxPolygonToCellsSizeExperimental=Ce._maxPolygonToCellsSizeExperimental,ePe=e._memcpy=Ce._memcpy,tPe=e._memmove=Ce._memmove,nPe=e._memset=Ce._memset,iPe=e._originToDirectedEdges=Ce._originToDirectedEdges,rPe=e._pentagonCount=Ce._pentagonCount,sPe=e._polygonToCells=Ce._polygonToCells,oPe=e._polygonToCellsExperimental=Ce._polygonToCellsExperimental,aPe=e._readInt64AsDoubleFromPointer=Ce._readInt64AsDoubleFromPointer,lPe=e._res0CellCount=Ce._res0CellCount,cPe=e._reverseDirectedEdge=Ce._reverseDirectedEdge,uPe=e._round=Ce._round,hPe=e._sbrk=Ce._sbrk,fPe=e._sizeOfCellBoundary=Ce._sizeOfCellBoundary,dPe=e._sizeOfCoordIJ=Ce._sizeOfCoordIJ,pPe=e._sizeOfGeoLoop=Ce._sizeOfGeoLoop,APe=e._sizeOfGeoPolygon=Ce._sizeOfGeoPolygon,mPe=e._sizeOfH3Index=Ce._sizeOfH3Index,gPe=e._sizeOfLatLng=Ce._sizeOfLatLng,_Pe=e._sizeOfLinkedGeoPolygon=Ce._sizeOfLinkedGeoPolygon,xPe=e._uncompactCells=Ce._uncompactCells,yPe=e._uncompactCellsSize=Ce._uncompactCellsSize,vPe=e._vertexToLatLng=Ce._vertexToLatLng,bPe=e.establishStackSpace=Ce.establishStackSpace,s9=e.stackAlloc=Ce.stackAlloc,tre=e.stackRestore=Ce.stackRestore,nre=e.stackSave=Ce.stackSave,wPe=e.dynCall_iii=Ce.dynCall_iii;if(e.asm=Ce,e.cwrap=C,e.setValue=v,e.getValue=w,le){Te(le)||(le=o(le));{pi("memory initializer");var x4=function(Ne){Ne.byteLength&&(Ne=new Uint8Array(Ne)),j.set(Ne,x),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,Bn("memory initializer")},o9=function(){a(le,x4,function(){throw"could not load memory initializer "+le})},a9=wt(le);if(a9)x4(a9.buffer);else if(e.memoryInitializerRequest){var l9=function(){var Ne=e.memoryInitializerRequest,nt=Ne.response;if(Ne.status!==200&&Ne.status!==0){var It=wt(e.memoryInitializerRequestURL);if(It)nt=It.buffer;else{console.warn("a problem seems to have happened with Module.memoryInitializerRequest, status: "+Ne.status+", retrying "+le),o9();return}}x4(nt)};e.memoryInitializerRequest.response?setTimeout(l9,0):e.memoryInitializerRequest.addEventListener("load",l9)}else o9()}}var Xb;ge=function Ne(){Xb||y4(),Xb||(ge=Ne)};function y4(Ne){if(Ne=Ne||r,Qt>0||(Ct(),Qt>0))return;function nt(){Xb||(Xb=!0,!S&&(un(),Gt(),e.onRuntimeInitialized&&e.onRuntimeInitialized(),Xe()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),nt()},1)):nt()}e.run=y4;function I0(Ne){throw e.onAbort&&e.onAbort(Ne),Ne+="",l(Ne),c(Ne),S=!0,"abort("+Ne+"). Build with -s ASSERTIONS=1 for more info."}if(e.abort=I0,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return y4(),i})(typeof fi=="object"?fi:{}),wn="number",vn=wn,r1=wn,Tn=wn,En=wn,io=wn,qt=wn,p1e=[["sizeOfH3Index",wn],["sizeOfLatLng",wn],["sizeOfCellBoundary",wn],["sizeOfGeoLoop",wn],["sizeOfGeoPolygon",wn],["sizeOfLinkedGeoPolygon",wn],["sizeOfCoordIJ",wn],["readInt64AsDoubleFromPointer",wn],["isValidCell",r1,[Tn,En]],["isValidIndex",r1,[Tn,En]],["latLngToCell",vn,[wn,wn,io,qt]],["cellToLatLng",vn,[Tn,En,qt]],["cellToBoundary",vn,[Tn,En,qt]],["maxGridDiskSize",vn,[wn,qt]],["gridDisk",vn,[Tn,En,wn,qt]],["gridDiskDistances",vn,[Tn,En,wn,qt,qt]],["gridRing",vn,[Tn,En,wn,qt]],["gridRingUnsafe",vn,[Tn,En,wn,qt]],["maxPolygonToCellsSize",vn,[qt,io,wn,qt]],["polygonToCells",vn,[qt,io,wn,qt]],["maxPolygonToCellsSizeExperimental",vn,[qt,io,wn,qt]],["polygonToCellsExperimental",vn,[qt,io,wn,wn,wn,qt]],["cellsToLinkedMultiPolygon",vn,[qt,wn,qt]],["destroyLinkedMultiPolygon",null,[qt]],["compactCells",vn,[qt,qt,wn,wn]],["uncompactCells",vn,[qt,wn,wn,qt,wn,io]],["uncompactCellsSize",vn,[qt,wn,wn,io,qt]],["isPentagon",r1,[Tn,En]],["isResClassIII",r1,[Tn,En]],["getBaseCellNumber",wn,[Tn,En]],["getResolution",wn,[Tn,En]],["getIndexDigit",wn,[Tn,En,wn]],["constructCell",vn,[wn,wn,qt,qt]],["maxFaceCount",vn,[Tn,En,qt]],["getIcosahedronFaces",vn,[Tn,En,qt]],["cellToParent",vn,[Tn,En,io,qt]],["cellToChildren",vn,[Tn,En,io,qt]],["cellToCenterChild",vn,[Tn,En,io,qt]],["cellToChildrenSize",vn,[Tn,En,io,qt]],["cellToChildPos",vn,[Tn,En,io,qt]],["childPosToCell",vn,[wn,wn,Tn,En,io,qt]],["areNeighborCells",vn,[Tn,En,Tn,En,qt]],["cellsToDirectedEdge",vn,[Tn,En,Tn,En,qt]],["getDirectedEdgeOrigin",vn,[Tn,En,qt]],["getDirectedEdgeDestination",vn,[Tn,En,qt]],["isValidDirectedEdge",r1,[Tn,En]],["directedEdgeToCells",vn,[Tn,En,qt]],["originToDirectedEdges",vn,[Tn,En,qt]],["directedEdgeToBoundary",vn,[Tn,En,qt]],["reverseDirectedEdge",vn,[Tn,En,qt]],["gridDistance",vn,[Tn,En,Tn,En,qt]],["gridPathCells",vn,[Tn,En,Tn,En,qt]],["gridPathCellsSize",vn,[Tn,En,Tn,En,qt]],["cellToLocalIj",vn,[Tn,En,Tn,En,wn,qt]],["localIjToCell",vn,[Tn,En,qt,wn,qt]],["getHexagonAreaAvgM2",vn,[io,qt]],["getHexagonAreaAvgKm2",vn,[io,qt]],["getHexagonEdgeLengthAvgM",vn,[io,qt]],["getHexagonEdgeLengthAvgKm",vn,[io,qt]],["greatCircleDistanceM",wn,[qt,qt]],["greatCircleDistanceKm",wn,[qt,qt]],["greatCircleDistanceRads",wn,[qt,qt]],["cellAreaM2",vn,[Tn,En,qt]],["cellAreaKm2",vn,[Tn,En,qt]],["cellAreaRads2",vn,[Tn,En,qt]],["edgeLengthM",vn,[Tn,En,qt]],["edgeLengthKm",vn,[Tn,En,qt]],["edgeLengthRads",vn,[Tn,En,qt]],["getNumCells",vn,[io,qt]],["getRes0Cells",vn,[qt]],["res0CellCount",wn],["getPentagons",vn,[wn,qt]],["pentagonCount",wn],["cellToVertex",vn,[Tn,En,wn,qt]],["cellToVertexes",vn,[Tn,En,qt]],["vertexToLatLng",vn,[Tn,En,qt]],["isValidVertex",r1,[Tn,En]]],A1e=0,m1e=1,g1e=2,_1e=3,nY=4,x1e=5,y1e=6,v1e=7,b1e=8,w1e=9,S1e=10,T1e=11,E1e=12,M1e=13,C1e=14,R1e=15,P1e=16,I1e=17,N1e=18,L1e=19,us={};us[A1e]="Success";us[m1e]="The operation failed but a more specific error is not available";us[g1e]="Argument was outside of acceptable range";us[_1e]="Latitude or longitude arguments were outside of acceptable range";us[nY]="Resolution argument was outside of acceptable range";us[x1e]="Cell argument was not valid";us[y1e]="Directed edge argument was not valid";us[v1e]="Undirected edge argument was not valid";us[b1e]="Vertex argument was not valid";us[w1e]="Pentagon distortion was encountered";us[S1e]="Duplicate input";us[T1e]="Cell arguments were not neighbors";us[E1e]="Cell arguments had incompatible resolutions";us[M1e]="Memory allocation failed";us[C1e]="Bounds of provided memory were insufficient";us[R1e]="Mode or flags argument was not valid";us[P1e]="Index argument was not valid";us[I1e]="Base cell number was outside of acceptable range";us[N1e]="Child indexing digits invalid";us[L1e]="Child indexing digits refer to a deleted subsequence";var D1e=1e3,iY=1001,rY=1002,CE={};CE[D1e]="Unknown unit";CE[iY]="Array length out of bounds";CE[rY]="Got unexpected null value for H3 index";var F1e="Unknown error";function sY(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||F1e)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function oY(i,e){var t=arguments.length===2?{value:e}:{};return sY(us,i,t)}function aY(i,e){var t=arguments.length===2?{value:e}:{};return sY(CE,i,t)}function Tv(i){if(i!==0)throw oY(i)}var Ja={};p1e.forEach(function(e){Ja[e[0]]=fi.cwrap.apply(fi,e)});var s1=16;var Ev=4;var o1=8,O1e=8,EE=Ja.sizeOfH3Index(),X6=Ja.sizeOfLatLng(),B1e=Ja.sizeOfCellBoundary(),U1e=Ja.sizeOfGeoPolygon(),Sv=Ja.sizeOfGeoLoop(),RJe=Ja.sizeOfLinkedGeoPolygon(),PJe=Ja.sizeOfCoordIJ();function k1e(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw oY(nY,i);return i}function G1e(i){if(!i)throw aY(rY);return i}var z1e=Math.pow(2,32)-1,IJe=Math.pow(2,31)-1;function V1e(i){if(i>z1e)throw aY(iY,i);return i}var q1e=/[^0-9a-fA-F]/;function lY(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||q1e.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),s1),t=parseInt(i.substring(i.length-8),s1);return[t,e]}function eY(i){if(i>=0)return i.toString(s1);i=i&2147483647;var e=cY(8,i.toString(s1)),t=(parseInt(e[0],s1)+8).toString(s1);return e=t+e.substring(1),e}function H1e(i,e){return eY(e)+cY(8,eY(i))}function cY(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}var NJe=Math.pow(2,32);function tY(i,e,t){for(var n=i.length,r=fi._calloc(n,X6),s=t?1:0,o=t?0:1,a=0;a<n*2;a+=2)fi.HEAPF64.set([i[a/2][s],i[a/2][o]].map(dY),r/o1+a);return fi.HEAPU32.set([n,r],e/Ev),e}function W1e(i,e){var t=i.length-1,n=fi._calloc(U1e),r=0,s=r+Sv,o=s+Ev;tY(i[0],n+r,e);var a;if(t>0){a=fi._calloc(t,Sv);for(var l=0;l<t;l++)tY(i[l+1],a+Sv*l,e)}return fi.setValue(n+s,t,"i32"),fi.setValue(n+o,a,"i32"),n}function j1e(i){var e=0,t=e+Sv,n=t+Ev,r=Ev;fi._free(fi.getValue(i+e+r,"i8*"));var s=fi.getValue(i+t,"i32");if(s>0){for(var o=fi.getValue(i+n,"i32"),a=0;a<s;a++)fi._free(fi.getValue(o+Sv*a+r,"i8*"));fi._free(o)}fi._free(i)}function uY(i,e){e===void 0&&(e=0);var t=fi.getValue(i+EE*e,"i32"),n=fi.getValue(i+EE*e+Ev,"i32");return n?H1e(t,n):null}function X1e(i){return Ja.readInt64AsDoubleFromPointer(i)}function $1e(i,e){for(var t=[],n=0;n<e;n++){var r=uY(i,n);r!==null&&t.push(r)}return t}function ME(i){return K1e(fi.getValue(i,"double"))}function hY(i){return[ME(i),ME(i+o1)]}function Y1e(i){return[ME(i+o1),ME(i)]}function Z1e(i,e,t){for(var n=fi.getValue(i,"i32"),r=i+o1,s=[],o=e?Y1e:hY,a=0;a<n*2;a+=2)s.push(o(r+o1*a));return t&&s.push(s[0]),s}function fY(i,e,t){var n=fi._malloc(X6);fi.HEAPF64.set([i,e].map(dY),n/o1);var r=fi._malloc(EE);try{return Tv(Ja.latLngToCell(n,t,r)),G1e(uY(r))}finally{fi._free(r),fi._free(n)}}function $6(i){var e=fi._malloc(X6),t=lY(i),n=t[0],r=t[1];try{return Tv(Ja.cellToLatLng(n,r,e)),hY(e)}finally{fi._free(e)}}function Y6(i,e){var t=fi._malloc(B1e),n=lY(i),r=n[0],s=n[1];try{return Tv(Ja.cellToBoundary(r,s,t)),Z1e(t,e,e)}finally{fi._free(t)}}function Z6(i,e,t){if(k1e(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=W1e(n,t),s=fi._malloc(O1e);try{Tv(Ja.maxPolygonToCellsSize(r,e,0,s));var o=V1e(X1e(s)),a=fi._calloc(o,EE);try{return Tv(Ja.polygonToCells(r,e,0,a)),$1e(a,o)}finally{fi._free(a)}}finally{fi._free(s),j1e(r)}}function dY(i){return i*Math.PI/180}function K1e(i){return i*180/Math.PI}function K6(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 Q1e=["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"],pY=new WeakMap,AY=new WeakMap,mY=new WeakMap,O8=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=Q1e,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=mY.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}},mY.set(e,t)),t}getMaterialData(e){let t=AY.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)}AY.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 p=l[f],x=s[f];if(f!=="_renderId"&&f!=="_equal"){if(p.equals!==void 0){if(p.equals(x)===!1)return p.copy(x),l._equal=!1,!1}else if(x.isTexture===!0){if(p.id!==x.id||p.version!==x.version)return p.id=x.id,p.version=x.version,l._equal=!1,!1}else if(p!==x)return l[f]=x,l._equal=!1,!1}}if(l.transmission>0){let{width:f,height:p}=e.context;if(a.bufferWidth!==f||a.bufferHeight!==p)return a.bufferWidth=f,a.bufferHeight=p,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,p=c.attributes,x=0,v=0;for(let C in f)x++;for(let C in p){v++;let L=p[C],D=f[C];if(D===void 0)return delete p[C],c._equal=!1,!1;let F=D.isInterleavedBufferAttribute?D.data.uuid:D.id,N=D.isInterleavedBufferAttribute?D.data.version:D.version;if(L.id!==F||L.version!==N)return L.id=F,L.version=N,c._equal=!1,!1}if(v!==x)return c.attributes=this.getAttributesData(f),c._equal=!1,!1;let w=o.index,S=c.indexId,T=c.indexVersion,P=w?w.id:null,R=w?w.version:null;if(S!==P||T!==R)return c.indexId=P,c.indexVersion=R,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 p=0;p<a.morphTargetInfluences.length;p++)a.morphTargetInfluences[p]!==r.morphTargetInfluences[p]&&(a.morphTargetInfluences[p]=r.morphTargetInfluences[p],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=pY.get(e);return n===void 0&&(n={renderId:-1,lightsData:[]},pY.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}},J1e=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function exe(i){let e=/(?:at\s+(.+?)\s+\()?(?:(.+?)@)?([^@\s()]+):(\d+):(\d+)/;return i.split(`4130+`).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&&!J1e.some(n=>n.test(t.file)))}var Ur=class{constructor(e=null){this.isStackTrace=!0,this.stack=exe(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(`41314131 `);return`${e}4132-${t}`}};function A7(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 G1=i=>A7(i),vb=i=>A7(i),Wv=(...i)=>A7(i),J1e=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),AY=new WeakMap;function BZ(i){return J1e.get(i)}function mM(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 UZ(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;Ge(`TSL: Unsupported type: ${i}`,new Ur)}function exe(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;Ge(`TSL: Unsupported type: ${i}`,new Ur)}function txe(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;Ge(`TSL: Unsupported type: ${i}`,new Ur)}function r0(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 m7(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 Ut(...e):t==="vec2"?new Oe(...e):t==="vec3"?new ie(...e):t==="vec4"?new gn(...e):t==="mat2"?new C_(...e):t==="mat3"?new Sn(...e):t==="mat4"?new on(...e):i==="bool"?e[0]||!1:i==="float"||i==="int"||i==="uint"?e[0]||0:i==="string"?e[0]||"":i==="ArrayBuffer"?ixe(e[0]):null}function kZ(i){let e=AY.get(i);return e===void 0&&(e={},AY.set(i,e)),e}function nxe(i){let e="",t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function ixe(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var x1={VERTEX:"vertex",FRAGMENT:"fragment"},_n={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},rxe={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Eo={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},GZ=["fragment","vertex"],uM=["setup","analyze","generate"],hM=[...GZ,"compute"],zm=["x","y","z","w"],sxe={analyze:"setup",generate:"analyze"},oxe=0,$t=class i extends zo{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=_n.NONE,this.updateBeforeType=_n.NONE,this.updateAfterType=_n.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=oxe++,this.stackTrace=null,i.captureStackTrace===!0&&(this.stackTrace=new Ur)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Xc.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,_n.FRAME)}onRenderUpdate(e){return this.onUpdate(e,_n.RENDER)}onObjectUpdate(e){return this.onUpdate(e,_n.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(G1(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=Wv(vb(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(){je("Abstract function.")}updateAfter(){je("Abstract function.")}update(){je("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=sxe[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):(je("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"&&(Ge(`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}};$t.captureStackTrace=!1;var Jf=class extends $t{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} ]`}},gM=class extends $t{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)}},pr=class extends $t{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)}},P8=class extends pr{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){Ge(`TSL: Length of parameters exceeds maximum length of function '${n}()' type.`,this.stackTrace);break}let f=u.getNodeType(e),p=e.getTypeLength(f),x;if(l+p>r&&(Ge(`TSL: Length of '${n}()' data exceeds maximum length of output type.`,this.stackTrace),p=r-l,f=e.getTypeFromLength(p)),l+=p,x=u.build(e,f),e.getComponentType(f)!==o){let w=e.getTypeFromLength(p,o);x=e.format(x,f,w)}a.push(x)}let c=`${e.getType(n)}( ${a.join(", ")} )`;return e.format(c,n,t)}},axe=zm.join(""),_M=class extends $t{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(zm.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===axe.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}},I8=class extends pr{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 p=0;p<u;p++){let x=zm[p];x===n[0]?(f.push(l),p+=n.length-1):f.push(c+"."+x)}return`${e.getType(s)}( ${f.join(", ")} )`}},N8=class extends pr{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 p=zm[f];p===t[u]?(c.push("1.0 - "+(a+"."+p)),u++):c.push(a+"."+p)}return`${e.getType(r)}( ${c.join(", ")} )`}},eb=class extends $t{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?r0(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=r0(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=nxe(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?m7(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){je("Abstract function.")}},mY=/float|u?int/,gc=class extends eb{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 mY.test(n)&&mY.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},L8=class extends $t{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){je(`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}},l0=null,D8=new Map;function Be(i,e){if(D8.has(i)){je(`TSL: Redefinition of method chaining '${i}'.`);return}if(typeof e!="function")throw new Error(`THREE.TSL: Node element ${i} is not a function`);D8.set(i,e),i!=="assign"&&($t.prototype[i]=function(...t){return this.isStackNode?this.addToStack(e(...t)):e(this,...t)},$t.prototype[i+"Assign"]=function(...t){return this.isStackNode?this.assign(t[0],e(...t)):this.assign(e(this,...t))})}var lxe=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),gY=i=>lxe(i).split("").sort().join("");$t.prototype.assign=function(...i){if(this.isStackNode!==!0)return l0!==null?l0.assign(this,...i):Ge("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new Ur),this;{let e=D8.get("assign");return this.addToStack(e(...i))}};$t.prototype.toVarIntent=function(){return this};$t.prototype.get=function(i){return new L8(this,i)};var jv={};function ME(i,e,t){jv[i]=jv[e]=jv[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new _M(this,i),this._cache[i]=o),o},set(o){this[i].assign(Vt(o))}};let n=i.toUpperCase(),r=e.toUpperCase(),s=t.toUpperCase();$t.prototype["set"+n]=$t.prototype["set"+r]=$t.prototype["set"+s]=function(o){let a=gY(i);return new I8(this,a,Vt(o))},$t.prototype["flip"+n]=$t.prototype["flip"+r]=$t.prototype["flip"+s]=function(){let o=gY(i);return new N8(this,o)}}var ph=["x","y","z","w"],Ah=["r","g","b","a"],mh=["s","t","p","q"];for(let i=0;i<4;i++){let e=ph[i],t=Ah[i],n=mh[i];ME(e,t,n);for(let r=0;r<4;r++){e=ph[i]+ph[r],t=Ah[i]+Ah[r],n=mh[i]+mh[r],ME(e,t,n);for(let s=0;s<4;s++){e=ph[i]+ph[r]+ph[s],t=Ah[i]+Ah[r]+Ah[s],n=mh[i]+mh[r]+mh[s],ME(e,t,n);for(let o=0;o<4;o++)e=ph[i]+ph[r]+ph[s]+ph[o],t=Ah[i]+Ah[r]+Ah[s]+Ah[o],n=mh[i]+mh[r]+mh[s]+mh[o],ME(e,t,n)}}}for(let i=0;i<32;i++)jv[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new Jf(this,new gc(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(Vt(e))}};Object.defineProperties($t.prototype,jv);var cxe=function(i,e=null){let t=r0(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Vt(B8(i,e)):t==="shader"?i.isFn?i:Ae(i):i},uxe=function(i,e=null){for(let t in i)i[t]=Vt(i[t],e);return i},hxe=function(i,e=null){let t=i.length;for(let n=0;n<t;n++)i[n]=Vt(i[n],e);return i},zZ=function(i,e=null,t=null,n=null){function r(u){return n!==null?(u=Vt(Object.assign(u,n)),n.intent===!0&&(u=u.toVarIntent())):u=Vt(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?(Ge(`TSL: "${f}" parameter length is less than minimum required.`,new Ur),u.concat(new Array(a-u.length).fill(0))):l!==void 0&&u.length>l?(Ge(`TSL: "${f}" parameter length exceeds limit.`,new Ur),u.slice(0,l)):u}return e===null?s=(...u)=>r(new i(...Tm(c(u)))):t!==null?(t=Vt(t),s=(...u)=>r(new i(e,...Tm(c(u)),t))):s=(...u)=>r(new i(e,...Tm(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},fxe=function(i,...e){return new i(...Tm(e))},F8=class extends $t{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 p=t.layout.inputs;if(VZ(n)){let x=n;for(let v=0;v<p.length;v++){let w=x[v];w&&w.isNode&&w.build(e)}}else{let x=n[0];for(let v of p){let w=x[v.name];w&&w.isNode&&w.build(e)}}}let u=e.buildFunctionNode(t);e.addInclude(u);let f=n?dxe(n):null;c=u.call(f)}else{let u=new Proxy(e,{get:(w,S,T)=>{let P;return Symbol.iterator===S?P=function*(){yield void 0}:P=Reflect.get(w,S,T),P}}),f=n?pxe(n):null,p=Array.isArray(n)?n.length>0:n!==null,x=t.jsFunc,v=p||x.length>1?x(f,u):x(u);c=Vt(v)}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 p of this.shaderNode.subBuilds)f.subBuilds.add(p)}n=s[o]}else r==="analyze"?a.build(e,t):r==="generate"&&(n=a.build(e,t)||"");return e.fnCall=l,n}};function VZ(i){return i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)}function dxe(i){let e;return IC(i),VZ(i)?e=[...i]:e=i[0],e}function pxe(i){let e=0;return IC(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 Vt(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 $t&&(i[n]===void 0?s=i[e++]:s=Reflect.get(i,n,r));else s=Reflect.get(t,n,r);s=Vt(s)}return s}})}var O8=class extends $t{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 F8(this,e)}setup(){return this.call()}},Axe=[!1,!0],mxe=[0,1,2,3],gxe=[-1,-2],qZ=[.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],g7=new Map;for(let i of Axe)g7.set(i,new gc(i));var _7=new Map;for(let i of mxe)_7.set(i,new gc(i,"uint"));var x7=new Map([..._7].map(i=>new gc(i.value,"int")));for(let i of gxe)x7.set(i,new gc(i,"int"));var RC=new Map([...x7].map(i=>new gc(i.value)));for(let i of qZ)RC.set(i,new gc(i));for(let i of qZ)RC.set(-i,new gc(-i));var PC={bool:g7,uint:_7,ints:x7,float:RC},_Y=new Map([...g7,...RC]),B8=(i,e)=>_Y.has(i)?_Y.get(i):i.isNode===!0?i:new gc(i,e),Rs=function(i,e=null){return(...t)=>{for(let r of t)if(r===void 0)return Ge(`TSL: Invalid parameter for the type "${i}".`,new Ur),new gc(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=[m7(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return qv(e.get(t[0]));if(t.length===1){let r=B8(t[0],i);return r.nodeType===i?qv(r):qv(new gM(r,i))}let n=t.map(r=>B8(r));return qv(new P8(n,i))}};function P1(i){return i&&i.isNode&&i.traverse(e=>{e.isConstNode&&(i=e.value)}),!!i}var HZ=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function b1(i,e){return new O8(i,e)}var Vt=(i,e=null)=>cxe(i,e),qv=(i,e=null)=>Vt(i,e).toVarIntent(),IC=(i,e=null)=>new uxe(i,e),Tm=(i,e=null)=>new hxe(i,e),Hn=(i,e=null,t=null,n=null)=>new zZ(i,e,t,n),xt=(i,...e)=>new fxe(i,...e),lt=(i,e=null,t=null,n={})=>new zZ(i,e,t,{...n,intent:!0}),y7=(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)}}),_xe=0,U8=class extends $t{constructor(e,t=null){super();let n=null;t!==null&&(typeof t=="object"?n=t.return:(typeof t=="string"?n=t:Ge("TSL: Invalid layout type.",new Ur),t=null)),this.shaderNode=new b1(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"+_xe++,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 Ge('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}};function Ae(i,e=null){let t=new U8(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 tb=i=>{l0=i},v7=()=>l0,Wt=(...i)=>l0.If(...i),xxe=(...i)=>l0.Switch(...i);function NC(i){return l0&&l0.addToStack(i),i}Be("toStack",NC);var WZ=new Rs("color"),se=new Rs("float",PC.float),fe=new Rs("int",PC.ints),it=new Rs("uint",PC.uint),Ll=new Rs("bool",PC.bool),ft=new Rs("vec2"),wr=new Rs("ivec2"),b7=new Rs("uvec2"),jZ=new Rs("bvec2"),pe=new Rs("vec3"),w7=new Rs("ivec3"),Vm=new Rs("uvec3"),S7=new Rs("bvec3"),Lt=new Rs("vec4"),T7=new Rs("ivec4"),E7=new Rs("uvec4"),XZ=new Rs("bvec4"),LC=new Rs("mat2"),so=new Rs("mat3"),o0=new Rs("mat4");Be("toColor",WZ);Be("toFloat",se);Be("toInt",fe);Be("toUint",it);Be("toBool",Ll);Be("toVec2",ft);Be("toIVec2",wr);Be("toUVec2",b7);Be("toBVec2",jZ);Be("toVec3",pe);Be("toIVec3",w7);Be("toUVec3",Vm);Be("toBVec3",S7);Be("toVec4",Lt);Be("toIVec4",T7);Be("toUVec4",E7);Be("toBVec4",XZ);Be("toMat2",LC);Be("toMat3",so);Be("toMat4",o0);var $Z=Hn(Jf).setParameterLength(2),YZ=(i,e)=>new gM(Vt(i),e),yxe=(i,e)=>new _M(Vt(i),e);Be("element",$Z);Be("convert",YZ);var vxe=i=>(je("TSL: append() has been renamed to Stack().",new Ur),NC(i));Be("append",i=>(je("TSL: .append() has been renamed to .toStack().",new Ur),NC(i)));var fi=class extends $t{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1,r=null){super(e),this.name=t,this.varying=n,this.placeholderNode=Vt(r),this.isPropertyNode=!0,this.global=!0}getNodeType(e){let t=super.getNodeType(e);return t==="output"?e.getOutputType():t}customCacheKey(){return G1(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)}},nd=(i,e,t=null)=>new fi(i,e,!1,t),qm=(i,e,t=null)=>new fi(i,e,!0,t),Ci=xt(fi,"vec4","DiffuseColor"),xm=xt(fi,"vec3","DiffuseContribution"),k8=xt(fi,"vec3","EmissiveColor"),wh=xt(fi,"float","Roughness"),Qf=xt(fi,"float","Metalness"),xM=xt(fi,"float","Clearcoat"),S1=xt(fi,"float","ClearcoatRoughness"),Rl=xt(fi,"vec3","Sheen"),Jp=xt(fi,"float","SheenRoughness"),DC=xt(fi,"float","Iridescence"),yM=xt(fi,"float","IridescenceIOR"),vM=xt(fi,"float","IridescenceThickness"),bM=xt(fi,"float","AlphaT"),Qp=xt(fi,"float","Anisotropy"),Xv=xt(fi,"vec3","AnisotropyT"),Em=xt(fi,"vec3","AnisotropyB"),c0=xt(fi,"color","SpecularColor"),vm=xt(fi,"color","SpecularColorBlended"),bm=xt(fi,"float","SpecularF90"),wM=xt(fi,"float","Shininess"),T1=xt(fi,"output","Output"),Mm=xt(fi,"float","dashSize"),nb=xt(fi,"float","gapSize"),bxe=xt(fi,"float","pointWidth"),$v=xt(fi,"float","IOR"),SM=xt(fi,"float","Transmission"),M7=xt(fi,"float","Thickness"),C7=xt(fi,"float","AttenuationDistance"),R7=xt(fi,"color","AttenuationColor"),P7=xt(fi,"float","Dispersion"),G8=xt(fi,"float","AmbientOcclusion",!1,1),TM=class extends $t{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}},ZZ=(i,e=1,t=null)=>new TM(i,!1,e,t),FC=(i,e=0,t=null)=>new TM(i,!0,e,t),wxe=FC("frame",0,_n.FRAME),Zt=FC("render",0,_n.RENDER),KZ=ZZ("object",1,_n.OBJECT),Nm=class extends eb{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=KZ}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.',new Ur),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 p=e.getVarFromNode(this,null,"bool");f=e.getPropertyName(p),u.propertyName=f,c=e.format(l,o,n),e.addLineFlowCode(`${f} = ${c}`,this)}c=f}return e.format(c,n,t)}},Ht=(i,e)=>{let t=HZ(e||i);if(t===i&&(i=m7(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new Nm(i,t)},EM=class extends pr{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)}},QZ=(...i)=>{let e;if(i.length===1){let t=i[0];e=new EM(null,t.length,t)}else{let t=i[0],n=i[1];e=new EM(t,n)}return Vt(e)};Be("toArray",(i,e)=>QZ(Array(e).fill(i)));var z8=class extends pr{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 zm.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 p=e.getVarFromNode(this,null,a),x=e.getPropertyName(p);e.addLineFlowCode(`${x} = ${l}`,this);let v=n.node,S=v.node.context({assign:!0}).build(e);for(let T=0;T<v.components.length;T++){let P=v.components[T];e.addLineFlowCode(`${S}.${P} = ${x}[ ${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)}},JZ=Hn(z8).setParameterLength(2);Be("assign",JZ);var V8=class extends pr{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",p;return f?p="&"+l.build(e):p=l.build(e,u),p};if(Array.isArray(s)){if(s.length>r.length)Ge("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(Ge("TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");s.length<r.length;)s.push(se(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)):(Ge(`TSL: Input '${l.name}' not found in 'Fn()'.`),t.push(o(se(0),l)))}return`${n.build(e,"property")}( ${t.join(", ")} )`}},eK=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?Tm(e):IC(e[0]),new V8(Vt(i),e));Be("call",eK);var Sxe={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},kr=class i extends pr{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(Sxe[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 p=e.renderer.coordinateSystem===mo;if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">=")return p?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 p&&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 x=`( ${c} ${n} ${u} )`;return!p&&o==="bool"&&e.isVector(a)&&e.isVector(l)&&(x=`all${x}`),e.format(x,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}},fs=lt(kr,"+").setParameterLength(2,1/0).setName("add"),ni=lt(kr,"-").setParameterLength(2,1/0).setName("sub"),bn=lt(kr,"*").setParameterLength(2,1/0).setName("mul"),Dl=lt(kr,"/").setParameterLength(2,1/0).setName("div"),OC=lt(kr,"%").setParameterLength(2).setName("mod"),tK=lt(kr,"==").setParameterLength(2).setName("equal"),nK=lt(kr,"!=").setParameterLength(2).setName("notEqual"),iK=lt(kr,"<").setParameterLength(2).setName("lessThan"),I7=lt(kr,">").setParameterLength(2).setName("greaterThan"),rK=lt(kr,"<=").setParameterLength(2).setName("lessThanEqual"),sK=lt(kr,">=").setParameterLength(2).setName("greaterThanEqual"),oK=lt(kr,"&&").setParameterLength(2,1/0).setName("and"),aK=lt(kr,"||").setParameterLength(2,1/0).setName("or"),lK=lt(kr,"!").setParameterLength(1).setName("not"),cK=lt(kr,"^^").setParameterLength(2).setName("xor"),uK=lt(kr,"&").setParameterLength(2).setName("bitAnd"),hK=lt(kr,"~").setParameterLength(1).setName("bitNot"),fK=lt(kr,"|").setParameterLength(2).setName("bitOr"),dK=lt(kr,"^").setParameterLength(2).setName("bitXor"),pK=lt(kr,"<<").setParameterLength(2).setName("shiftLeft"),AK=lt(kr,">>").setParameterLength(2).setName("shiftRight"),mK=Ae(([i])=>(i.addAssign(1),i)),gK=Ae(([i])=>(i.subAssign(1),i)),_K=Ae(([i])=>{let e=fe(i).toConst();return i.addAssign(1),e}),xK=Ae(([i])=>{let e=fe(i).toConst();return i.subAssign(1),e});Be("add",fs);Be("sub",ni);Be("mul",bn);Be("div",Dl);Be("mod",OC);Be("equal",tK);Be("notEqual",nK);Be("lessThan",iK);Be("greaterThan",I7);Be("lessThanEqual",rK);Be("greaterThanEqual",sK);Be("and",oK);Be("or",aK);Be("not",lK);Be("xor",cK);Be("bitAnd",uK);Be("bitNot",hK);Be("bitOr",fK);Be("bitXor",dK);Be("shiftLeft",pK);Be("shiftRight",AK);Be("incrementBefore",mK);Be("decrementBefore",gK);Be("increment",_K);Be("decrement",xK);var Re=class i extends pr{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=ni(1,t);else if(r===i.RECIPROCAL)s=Dl(1,t);else if(r===i.DIFFERENCE)s=Ji(ni(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=Jo(bn(o,Lt(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===mo&&r===i.STEP?f.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):u===mo&&(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===Ha&&r===i.ATAN&&l!==null&&(r="atan2"),e.shaderStage!=="fragment"&&(r===i.DFDX||r===i.DFDY)&&(je(`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}};Re.ALL="all";Re.ANY="any";Re.RADIANS="radians";Re.DEGREES="degrees";Re.EXP="exp";Re.EXP2="exp2";Re.LOG="log";Re.LOG2="log2";Re.SQRT="sqrt";Re.INVERSE_SQRT="inversesqrt";Re.FLOOR="floor";Re.CEIL="ceil";Re.NORMALIZE="normalize";Re.FRACT="fract";Re.SIN="sin";Re.SINH="sinh";Re.COS="cos";Re.COSH="cosh";Re.TAN="tan";Re.TANH="tanh";Re.ASIN="asin";Re.ASINH="asinh";Re.ACOS="acos";Re.ACOSH="acosh";Re.ATAN="atan";Re.ATANH="atanh";Re.ABS="abs";Re.SIGN="sign";Re.LENGTH="length";Re.NEGATE="negate";Re.ONE_MINUS="oneMinus";Re.DFDX="dFdx";Re.DFDY="dFdy";Re.ROUND="round";Re.RECIPROCAL="reciprocal";Re.TRUNC="trunc";Re.FWIDTH="fwidth";Re.TRANSPOSE="transpose";Re.DETERMINANT="determinant";Re.INVERSE="inverse";Re.EQUALS="equals";Re.MIN="min";Re.MAX="max";Re.STEP="step";Re.REFLECT="reflect";Re.DISTANCE="distance";Re.DIFFERENCE="difference";Re.DOT="dot";Re.CROSS="cross";Re.POW="pow";Re.TRANSFORM_DIRECTION="transformDirection";Re.MIX="mix";Re.CLAMP="clamp";Re.REFRACT="refract";Re.SMOOTHSTEP="smoothstep";Re.FACEFORWARD="faceforward";var BC=se(1e-6),Txe=se(1e6),MM=se(Math.PI),Exe=se(Math.PI*2),Mxe=se(Math.PI*2),Cxe=se(Math.PI*.5),yK=lt(Re,Re.ALL).setParameterLength(1),vK=lt(Re,Re.ANY).setParameterLength(1),bK=lt(Re,Re.RADIANS).setParameterLength(1),wK=lt(Re,Re.DEGREES).setParameterLength(1),N7=lt(Re,Re.EXP).setParameterLength(1),I1=lt(Re,Re.EXP2).setParameterLength(1),UC=lt(Re,Re.LOG).setParameterLength(1),Th=lt(Re,Re.LOG2).setParameterLength(1),Ca=lt(Re,Re.SQRT).setParameterLength(1),L7=lt(Re,Re.INVERSE_SQRT).setParameterLength(1),Eh=lt(Re,Re.FLOOR).setParameterLength(1),kC=lt(Re,Re.CEIL).setParameterLength(1),Jo=lt(Re,Re.NORMALIZE).setParameterLength(1),su=lt(Re,Re.FRACT).setParameterLength(1),Ta=lt(Re,Re.SIN).setParameterLength(1),SK=lt(Re,Re.SINH).setParameterLength(1),tu=lt(Re,Re.COS).setParameterLength(1),TK=lt(Re,Re.COSH).setParameterLength(1),EK=lt(Re,Re.TAN).setParameterLength(1),MK=lt(Re,Re.TANH).setParameterLength(1),CK=lt(Re,Re.ASIN).setParameterLength(1),RK=lt(Re,Re.ASINH).setParameterLength(1),D7=lt(Re,Re.ACOS).setParameterLength(1),PK=lt(Re,Re.ACOSH).setParameterLength(1),F7=lt(Re,Re.ATAN).setParameterLength(1,2),IK=lt(Re,Re.ATANH).setParameterLength(1),Ji=lt(Re,Re.ABS).setParameterLength(1),O7=lt(Re,Re.SIGN).setParameterLength(1),Mh=lt(Re,Re.LENGTH).setParameterLength(1),B7=lt(Re,Re.NEGATE).setParameterLength(1),NK=lt(Re,Re.ONE_MINUS).setParameterLength(1),U7=lt(Re,Re.DFDX).setParameterLength(1),k7=lt(Re,Re.DFDY).setParameterLength(1),LK=lt(Re,Re.ROUND).setParameterLength(1),DK=lt(Re,Re.RECIPROCAL).setParameterLength(1),G7=lt(Re,Re.TRUNC).setParameterLength(1),z7=lt(Re,Re.FWIDTH).setParameterLength(1),FK=lt(Re,Re.TRANSPOSE).setParameterLength(1),OK=lt(Re,Re.DETERMINANT).setParameterLength(1),BK=lt(Re,Re.INVERSE).setParameterLength(1),Ja=lt(Re,Re.MIN).setParameterLength(2,1/0),Sr=lt(Re,Re.MAX).setParameterLength(2,1/0),Lm=lt(Re,Re.STEP).setParameterLength(2),UK=lt(Re,Re.REFLECT).setParameterLength(2),kK=lt(Re,Re.DISTANCE).setParameterLength(2),GK=lt(Re,Re.DIFFERENCE).setParameterLength(2),_c=lt(Re,Re.DOT).setParameterLength(2),ed=lt(Re,Re.CROSS).setParameterLength(2),pc=lt(Re,Re.POW).setParameterLength(2),V7=i=>bn(i,i),zK=i=>bn(i,i,i),q7=i=>bn(i,i,i,i),VK=lt(Re,Re.TRANSFORM_DIRECTION).setParameterLength(2),qK=(i,e)=>Jo(bn(e,Lt(pe(i),0)).xyz),HK=(i,e)=>Jo(Lt(pe(i),0).mul(e).xyz),WK=i=>bn(O7(i),pc(Ji(i),1/3)),H7=i=>_c(i,i),Xn=lt(Re,Re.MIX).setParameterLength(3),ou=(i,e=0,t=1)=>new Re(Re.CLAMP,Vt(i),Vt(e),Vt(t)),GC=i=>ou(i),W7=lt(Re,Re.REFRACT).setParameterLength(3),Fl=lt(Re,Re.SMOOTHSTEP).setParameterLength(3),j7=lt(Re,Re.FACEFORWARD).setParameterLength(3),jK=Ae(([i])=>{let n=43758.5453,r=_c(i.xy,ft(12.9898,78.233)),s=OC(r,MM);return su(Ta(s).mul(n))}),XK=(i,e,t)=>Xn(e,t,i),$K=(i,e,t)=>Fl(e,t,i),YK=(i,e)=>Lm(e,i),Rxe=j7,Pxe=L7;Be("all",yK);Be("any",vK);Be("radians",bK);Be("degrees",wK);Be("exp",N7);Be("exp2",I1);Be("log",UC);Be("log2",Th);Be("sqrt",Ca);Be("inverseSqrt",L7);Be("floor",Eh);Be("ceil",kC);Be("normalize",Jo);Be("fract",su);Be("sin",Ta);Be("sinh",SK);Be("cos",tu);Be("cosh",TK);Be("tan",EK);Be("tanh",MK);Be("asin",CK);Be("asinh",RK);Be("acos",D7);Be("acosh",PK);Be("atan",F7);Be("atanh",IK);Be("abs",Ji);Be("sign",O7);Be("length",Mh);Be("lengthSq",H7);Be("negate",B7);Be("oneMinus",NK);Be("dFdx",U7);Be("dFdy",k7);Be("round",LK);Be("reciprocal",DK);Be("trunc",G7);Be("fwidth",z7);Be("min",Ja);Be("max",Sr);Be("step",YK);Be("reflect",UK);Be("distance",kK);Be("dot",_c);Be("cross",ed);Be("pow",pc);Be("pow2",V7);Be("pow3",zK);Be("pow4",q7);Be("transformDirection",VK);Be("transformNormalByViewMatrix",qK);Be("transformNormalByInverseViewMatrix",HK);Be("mix",XK);Be("clamp",ou);Be("refract",W7);Be("smoothstep",$K);Be("faceForward",j7);Be("difference",GK);Be("saturate",GC);Be("cbrt",WK);Be("transpose",FK);Be("determinant",OK);Be("inverse",BK);Be("rand",jK);var q8=class extends $t{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?nd(n).build(e):"";r.nodeProperty=u;let f=s.build(e,"bool");if(e.context.uniformFlow&&a!==null){let v=o.build(e,n),w=a.build(e,n),S=e.getTernary(f,v,w);return e.format(S,n,t)}e.addFlowCode(`4132+${t}`}};function b7(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 z1=i=>b7(i),wb=i=>b7(i),Xv=(...i)=>b7(i),txe=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),gY=new WeakMap;function kZ(i){return txe.get(i)}function _M(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 GZ(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;Ge(`TSL: Unsupported type: ${i}`,new Ur)}function nxe(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;Ge(`TSL: Unsupported type: ${i}`,new Ur)}function ixe(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;Ge(`TSL: Unsupported type: ${i}`,new Ur)}function s0(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 w7(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 Ut(...e):t==="vec2"?new Oe(...e):t==="vec3"?new ie(...e):t==="vec4"?new gn(...e):t==="mat2"?new R_(...e):t==="mat3"?new Sn(...e):t==="mat4"?new on(...e):i==="bool"?e[0]||!1:i==="float"||i==="int"||i==="uint"?e[0]||0:i==="string"?e[0]||"":i==="ArrayBuffer"?sxe(e[0]):null}function zZ(i){let e=gY.get(i);return e===void 0&&(e={},gY.set(i,e)),e}function rxe(i){let e="",t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function sxe(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var y1={VERTEX:"vertex",FRAGMENT:"fragment"},_n={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},oxe={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Eo={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},VZ=["fragment","vertex"],fM=["setup","analyze","generate"],dM=[...VZ,"compute"],qm=["x","y","z","w"],axe={analyze:"setup",generate:"analyze"},lxe=0,$t=class i extends zo{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=_n.NONE,this.updateBeforeType=_n.NONE,this.updateAfterType=_n.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=lxe++,this.stackTrace=null,i.captureStackTrace===!0&&(this.stackTrace=new Ur)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=$c.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,_n.FRAME)}onRenderUpdate(e){return this.onUpdate(e,_n.RENDER)}onObjectUpdate(e){return this.onUpdate(e,_n.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(z1(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=Xv(wb(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(){je("Abstract function.")}updateAfter(){je("Abstract function.")}update(){je("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=axe[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):(je("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"&&(Ge(`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}};$t.captureStackTrace=!1;var ed=class extends $t{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} ]`}},xM=class extends $t{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)}},pr=class extends $t{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)}},B8=class extends pr{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){Ge(`TSL: Length of parameters exceeds maximum length of function '${n}()' type.`,this.stackTrace);break}let f=u.getNodeType(e),p=e.getTypeLength(f),x;if(l+p>r&&(Ge(`TSL: Length of '${n}()' data exceeds maximum length of output type.`,this.stackTrace),p=r-l,f=e.getTypeFromLength(p)),l+=p,x=u.build(e,f),e.getComponentType(f)!==o){let w=e.getTypeFromLength(p,o);x=e.format(x,f,w)}a.push(x)}let c=`${e.getType(n)}( ${a.join(", ")} )`;return e.format(c,n,t)}},cxe=qm.join(""),yM=class extends $t{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(qm.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===cxe.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}},U8=class extends pr{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 p=0;p<u;p++){let x=qm[p];x===n[0]?(f.push(l),p+=n.length-1):f.push(c+"."+x)}return`${e.getType(s)}( ${f.join(", ")} )`}},k8=class extends pr{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 p=qm[f];p===t[u]?(c.push("1.0 - "+(a+"."+p)),u++):c.push(a+"."+p)}return`${e.getType(r)}( ${c.join(", ")} )`}},nb=class extends $t{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?s0(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=s0(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=rxe(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?w7(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){je("Abstract function.")}},_Y=/float|u?int/,_c=class extends nb{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 _Y.test(n)&&_Y.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},G8=class extends $t{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){je(`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}},c0=null,z8=new Map;function Be(i,e){if(z8.has(i)){je(`TSL: Redefinition of method chaining '${i}'.`);return}if(typeof e!="function")throw new Error(`THREE.TSL: Node element ${i} is not a function`);z8.set(i,e),i!=="assign"&&($t.prototype[i]=function(...t){return this.isStackNode?this.addToStack(e(...t)):e(this,...t)},$t.prototype[i+"Assign"]=function(...t){return this.isStackNode?this.assign(t[0],e(...t)):this.assign(e(this,...t))})}var uxe=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),xY=i=>uxe(i).split("").sort().join("");$t.prototype.assign=function(...i){if(this.isStackNode!==!0)return c0!==null?c0.assign(this,...i):Ge("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new Ur),this;{let e=z8.get("assign");return this.addToStack(e(...i))}};$t.prototype.toVarIntent=function(){return this};$t.prototype.get=function(i){return new G8(this,i)};var $v={};function RE(i,e,t){$v[i]=$v[e]=$v[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new yM(this,i),this._cache[i]=o),o},set(o){this[i].assign(Vt(o))}};let n=i.toUpperCase(),r=e.toUpperCase(),s=t.toUpperCase();$t.prototype["set"+n]=$t.prototype["set"+r]=$t.prototype["set"+s]=function(o){let a=xY(i);return new U8(this,a,Vt(o))},$t.prototype["flip"+n]=$t.prototype["flip"+r]=$t.prototype["flip"+s]=function(){let o=xY(i);return new k8(this,o)}}var mh=["x","y","z","w"],gh=["r","g","b","a"],_h=["s","t","p","q"];for(let i=0;i<4;i++){let e=mh[i],t=gh[i],n=_h[i];RE(e,t,n);for(let r=0;r<4;r++){e=mh[i]+mh[r],t=gh[i]+gh[r],n=_h[i]+_h[r],RE(e,t,n);for(let s=0;s<4;s++){e=mh[i]+mh[r]+mh[s],t=gh[i]+gh[r]+gh[s],n=_h[i]+_h[r]+_h[s],RE(e,t,n);for(let o=0;o<4;o++)e=mh[i]+mh[r]+mh[s]+mh[o],t=gh[i]+gh[r]+gh[s]+gh[o],n=_h[i]+_h[r]+_h[s]+_h[o],RE(e,t,n)}}}for(let i=0;i<32;i++)$v[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new ed(this,new _c(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(Vt(e))}};Object.defineProperties($t.prototype,$v);var hxe=function(i,e=null){let t=s0(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Vt(H8(i,e)):t==="shader"?i.isFn?i:Ae(i):i},fxe=function(i,e=null){for(let t in i)i[t]=Vt(i[t],e);return i},dxe=function(i,e=null){let t=i.length;for(let n=0;n<t;n++)i[n]=Vt(i[n],e);return i},qZ=function(i,e=null,t=null,n=null){function r(u){return n!==null?(u=Vt(Object.assign(u,n)),n.intent===!0&&(u=u.toVarIntent())):u=Vt(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?(Ge(`TSL: "${f}" parameter length is less than minimum required.`,new Ur),u.concat(new Array(a-u.length).fill(0))):l!==void 0&&u.length>l?(Ge(`TSL: "${f}" parameter length exceeds limit.`,new Ur),u.slice(0,l)):u}return e===null?s=(...u)=>r(new i(...Mm(c(u)))):t!==null?(t=Vt(t),s=(...u)=>r(new i(e,...Mm(c(u)),t))):s=(...u)=>r(new i(e,...Mm(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},pxe=function(i,...e){return new i(...Mm(e))},V8=class extends $t{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 p=t.layout.inputs;if(HZ(n)){let x=n;for(let v=0;v<p.length;v++){let w=x[v];w&&w.isNode&&w.build(e)}}else{let x=n[0];for(let v of p){let w=x[v.name];w&&w.isNode&&w.build(e)}}}let u=e.buildFunctionNode(t);e.addInclude(u);let f=n?Axe(n):null;c=u.call(f)}else{let u=new Proxy(e,{get:(w,S,T)=>{let P;return Symbol.iterator===S?P=function*(){yield void 0}:P=Reflect.get(w,S,T),P}}),f=n?mxe(n):null,p=Array.isArray(n)?n.length>0:n!==null,x=t.jsFunc,v=p||x.length>1?x(f,u):x(u);c=Vt(v)}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 p of this.shaderNode.subBuilds)f.subBuilds.add(p)}n=s[o]}else r==="analyze"?a.build(e,t):r==="generate"&&(n=a.build(e,t)||"");return e.fnCall=l,n}};function HZ(i){return i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)}function Axe(i){let e;return LC(i),HZ(i)?e=[...i]:e=i[0],e}function mxe(i){let e=0;return LC(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 Vt(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 $t&&(i[n]===void 0?s=i[e++]:s=Reflect.get(i,n,r));else s=Reflect.get(t,n,r);s=Vt(s)}return s}})}var q8=class extends $t{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 V8(this,e)}setup(){return this.call()}},gxe=[!1,!0],_xe=[0,1,2,3],xxe=[-1,-2],WZ=[.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],S7=new Map;for(let i of gxe)S7.set(i,new _c(i));var T7=new Map;for(let i of _xe)T7.set(i,new _c(i,"uint"));var E7=new Map([...T7].map(i=>new _c(i.value,"int")));for(let i of xxe)E7.set(i,new _c(i,"int"));var IC=new Map([...E7].map(i=>new _c(i.value)));for(let i of WZ)IC.set(i,new _c(i));for(let i of WZ)IC.set(-i,new _c(-i));var NC={bool:S7,uint:T7,ints:E7,float:IC},yY=new Map([...S7,...IC]),H8=(i,e)=>yY.has(i)?yY.get(i):i.isNode===!0?i:new _c(i,e),Is=function(i,e=null){return(...t)=>{for(let r of t)if(r===void 0)return Ge(`TSL: Invalid parameter for the type "${i}".`,new Ur),new _c(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=[w7(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return Wv(e.get(t[0]));if(t.length===1){let r=H8(t[0],i);return r.nodeType===i?Wv(r):Wv(new xM(r,i))}let n=t.map(r=>H8(r));return Wv(new B8(n,i))}};function I1(i){return i&&i.isNode&&i.traverse(e=>{e.isConstNode&&(i=e.value)}),!!i}var jZ=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function w1(i,e){return new q8(i,e)}var Vt=(i,e=null)=>hxe(i,e),Wv=(i,e=null)=>Vt(i,e).toVarIntent(),LC=(i,e=null)=>new fxe(i,e),Mm=(i,e=null)=>new dxe(i,e),Hn=(i,e=null,t=null,n=null)=>new qZ(i,e,t,n),xt=(i,...e)=>new pxe(i,...e),lt=(i,e=null,t=null,n={})=>new qZ(i,e,t,{...n,intent:!0}),M7=(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)}}),yxe=0,W8=class extends $t{constructor(e,t=null){super();let n=null;t!==null&&(typeof t=="object"?n=t.return:(typeof t=="string"?n=t:Ge("TSL: Invalid layout type.",new Ur),t=null)),this.shaderNode=new w1(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"+yxe++,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 Ge('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}};function Ae(i,e=null){let t=new W8(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 ib=i=>{c0=i},C7=()=>c0,Wt=(...i)=>c0.If(...i),vxe=(...i)=>c0.Switch(...i);function DC(i){return c0&&c0.addToStack(i),i}Be("toStack",DC);var XZ=new Is("color"),se=new Is("float",NC.float),fe=new Is("int",NC.ints),it=new Is("uint",NC.uint),Dl=new Is("bool",NC.bool),ft=new Is("vec2"),Sr=new Is("ivec2"),R7=new Is("uvec2"),$Z=new Is("bvec2"),pe=new Is("vec3"),P7=new Is("ivec3"),Hm=new Is("uvec3"),I7=new Is("bvec3"),Lt=new Is("vec4"),N7=new Is("ivec4"),L7=new Is("uvec4"),YZ=new Is("bvec4"),FC=new Is("mat2"),so=new Is("mat3"),a0=new Is("mat4");Be("toColor",XZ);Be("toFloat",se);Be("toInt",fe);Be("toUint",it);Be("toBool",Dl);Be("toVec2",ft);Be("toIVec2",Sr);Be("toUVec2",R7);Be("toBVec2",$Z);Be("toVec3",pe);Be("toIVec3",P7);Be("toUVec3",Hm);Be("toBVec3",I7);Be("toVec4",Lt);Be("toIVec4",N7);Be("toUVec4",L7);Be("toBVec4",YZ);Be("toMat2",FC);Be("toMat3",so);Be("toMat4",a0);var ZZ=Hn(ed).setParameterLength(2),KZ=(i,e)=>new xM(Vt(i),e),bxe=(i,e)=>new yM(Vt(i),e);Be("element",ZZ);Be("convert",KZ);var wxe=i=>(je("TSL: append() has been renamed to Stack().",new Ur),DC(i));Be("append",i=>(je("TSL: .append() has been renamed to .toStack().",new Ur),DC(i)));var di=class extends $t{static get type(){return"PropertyNode"}constructor(e,t=null,n=!1,r=null){super(e),this.name=t,this.varying=n,this.placeholderNode=Vt(r),this.isPropertyNode=!0,this.global=!0}getNodeType(e){let t=super.getNodeType(e);return t==="output"?e.getOutputType():t}customCacheKey(){return z1(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)}},id=(i,e,t=null)=>new di(i,e,!1,t),Wm=(i,e,t=null)=>new di(i,e,!0,t),Ci=xt(di,"vec4","DiffuseColor"),vm=xt(di,"vec3","DiffuseContribution"),j8=xt(di,"vec3","EmissiveColor"),Th=xt(di,"float","Roughness"),Jf=xt(di,"float","Metalness"),vM=xt(di,"float","Clearcoat"),T1=xt(di,"float","ClearcoatRoughness"),Pl=xt(di,"vec3","Sheen"),e0=xt(di,"float","SheenRoughness"),OC=xt(di,"float","Iridescence"),bM=xt(di,"float","IridescenceIOR"),wM=xt(di,"float","IridescenceThickness"),SM=xt(di,"float","AlphaT"),Jp=xt(di,"float","Anisotropy"),Yv=xt(di,"vec3","AnisotropyT"),Cm=xt(di,"vec3","AnisotropyB"),u0=xt(di,"color","SpecularColor"),wm=xt(di,"color","SpecularColorBlended"),Sm=xt(di,"float","SpecularF90"),TM=xt(di,"float","Shininess"),E1=xt(di,"output","Output"),Rm=xt(di,"float","dashSize"),rb=xt(di,"float","gapSize"),Sxe=xt(di,"float","pointWidth"),Zv=xt(di,"float","IOR"),EM=xt(di,"float","Transmission"),D7=xt(di,"float","Thickness"),F7=xt(di,"float","AttenuationDistance"),O7=xt(di,"color","AttenuationColor"),B7=xt(di,"float","Dispersion"),X8=xt(di,"float","AmbientOcclusion",!1,1),MM=class extends $t{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}},QZ=(i,e=1,t=null)=>new MM(i,!1,e,t),BC=(i,e=0,t=null)=>new MM(i,!0,e,t),Txe=BC("frame",0,_n.FRAME),Zt=BC("render",0,_n.RENDER),JZ=QZ("object",1,_n.OBJECT),Dm=class extends nb{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=JZ}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.',new Ur),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 p=e.getVarFromNode(this,null,"bool");f=e.getPropertyName(p),u.propertyName=f,c=e.format(l,o,n),e.addLineFlowCode(`${f} = ${c}`,this)}c=f}return e.format(c,n,t)}},Ht=(i,e)=>{let t=jZ(e||i);if(t===i&&(i=w7(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new Dm(i,t)},CM=class extends pr{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)}},eK=(...i)=>{let e;if(i.length===1){let t=i[0];e=new CM(null,t.length,t)}else{let t=i[0],n=i[1];e=new CM(t,n)}return Vt(e)};Be("toArray",(i,e)=>eK(Array(e).fill(i)));var $8=class extends pr{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 qm.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 p=e.getVarFromNode(this,null,a),x=e.getPropertyName(p);e.addLineFlowCode(`${x} = ${l}`,this);let v=n.node,S=v.node.context({assign:!0}).build(e);for(let T=0;T<v.components.length;T++){let P=v.components[T];e.addLineFlowCode(`${S}.${P} = ${x}[ ${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)}},tK=Hn($8).setParameterLength(2);Be("assign",tK);var Y8=class extends pr{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",p;return f?p="&"+l.build(e):p=l.build(e,u),p};if(Array.isArray(s)){if(s.length>r.length)Ge("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(Ge("TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");s.length<r.length;)s.push(se(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)):(Ge(`TSL: Input '${l.name}' not found in 'Fn()'.`),t.push(o(se(0),l)))}return`${n.build(e,"property")}( ${t.join(", ")} )`}},nK=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?Mm(e):LC(e[0]),new Y8(Vt(i),e));Be("call",nK);var Exe={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},kr=class i extends pr{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(Exe[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 p=e.renderer.coordinateSystem===mo;if(n==="=="||n==="!="||n==="<"||n===">"||n==="<="||n===">=")return p?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 p&&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 x=`( ${c} ${n} ${u} )`;return!p&&o==="bool"&&e.isVector(a)&&e.isVector(l)&&(x=`all${x}`),e.format(x,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}},fs=lt(kr,"+").setParameterLength(2,1/0).setName("add"),ni=lt(kr,"-").setParameterLength(2,1/0).setName("sub"),bn=lt(kr,"*").setParameterLength(2,1/0).setName("mul"),Fl=lt(kr,"/").setParameterLength(2,1/0).setName("div"),UC=lt(kr,"%").setParameterLength(2).setName("mod"),iK=lt(kr,"==").setParameterLength(2).setName("equal"),rK=lt(kr,"!=").setParameterLength(2).setName("notEqual"),sK=lt(kr,"<").setParameterLength(2).setName("lessThan"),U7=lt(kr,">").setParameterLength(2).setName("greaterThan"),oK=lt(kr,"<=").setParameterLength(2).setName("lessThanEqual"),aK=lt(kr,">=").setParameterLength(2).setName("greaterThanEqual"),lK=lt(kr,"&&").setParameterLength(2,1/0).setName("and"),cK=lt(kr,"||").setParameterLength(2,1/0).setName("or"),uK=lt(kr,"!").setParameterLength(1).setName("not"),hK=lt(kr,"^^").setParameterLength(2).setName("xor"),fK=lt(kr,"&").setParameterLength(2).setName("bitAnd"),dK=lt(kr,"~").setParameterLength(1).setName("bitNot"),pK=lt(kr,"|").setParameterLength(2).setName("bitOr"),AK=lt(kr,"^").setParameterLength(2).setName("bitXor"),mK=lt(kr,"<<").setParameterLength(2).setName("shiftLeft"),gK=lt(kr,">>").setParameterLength(2).setName("shiftRight"),_K=Ae(([i])=>(i.addAssign(1),i)),xK=Ae(([i])=>(i.subAssign(1),i)),yK=Ae(([i])=>{let e=fe(i).toConst();return i.addAssign(1),e}),vK=Ae(([i])=>{let e=fe(i).toConst();return i.subAssign(1),e});Be("add",fs);Be("sub",ni);Be("mul",bn);Be("div",Fl);Be("mod",UC);Be("equal",iK);Be("notEqual",rK);Be("lessThan",sK);Be("greaterThan",U7);Be("lessThanEqual",oK);Be("greaterThanEqual",aK);Be("and",lK);Be("or",cK);Be("not",uK);Be("xor",hK);Be("bitAnd",fK);Be("bitNot",dK);Be("bitOr",pK);Be("bitXor",AK);Be("shiftLeft",mK);Be("shiftRight",gK);Be("incrementBefore",_K);Be("decrementBefore",xK);Be("increment",yK);Be("decrement",vK);var Re=class i extends pr{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=ni(1,t);else if(r===i.RECIPROCAL)s=Fl(1,t);else if(r===i.DIFFERENCE)s=Ji(ni(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=Jo(bn(o,Lt(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===mo&&r===i.STEP?f.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):u===mo&&(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===Ha&&r===i.ATAN&&l!==null&&(r="atan2"),e.shaderStage!=="fragment"&&(r===i.DFDX||r===i.DFDY)&&(je(`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}};Re.ALL="all";Re.ANY="any";Re.RADIANS="radians";Re.DEGREES="degrees";Re.EXP="exp";Re.EXP2="exp2";Re.LOG="log";Re.LOG2="log2";Re.SQRT="sqrt";Re.INVERSE_SQRT="inversesqrt";Re.FLOOR="floor";Re.CEIL="ceil";Re.NORMALIZE="normalize";Re.FRACT="fract";Re.SIN="sin";Re.SINH="sinh";Re.COS="cos";Re.COSH="cosh";Re.TAN="tan";Re.TANH="tanh";Re.ASIN="asin";Re.ASINH="asinh";Re.ACOS="acos";Re.ACOSH="acosh";Re.ATAN="atan";Re.ATANH="atanh";Re.ABS="abs";Re.SIGN="sign";Re.LENGTH="length";Re.NEGATE="negate";Re.ONE_MINUS="oneMinus";Re.DFDX="dFdx";Re.DFDY="dFdy";Re.ROUND="round";Re.RECIPROCAL="reciprocal";Re.TRUNC="trunc";Re.FWIDTH="fwidth";Re.TRANSPOSE="transpose";Re.DETERMINANT="determinant";Re.INVERSE="inverse";Re.EQUALS="equals";Re.MIN="min";Re.MAX="max";Re.STEP="step";Re.REFLECT="reflect";Re.DISTANCE="distance";Re.DIFFERENCE="difference";Re.DOT="dot";Re.CROSS="cross";Re.POW="pow";Re.TRANSFORM_DIRECTION="transformDirection";Re.MIX="mix";Re.CLAMP="clamp";Re.REFRACT="refract";Re.SMOOTHSTEP="smoothstep";Re.FACEFORWARD="faceforward";var kC=se(1e-6),Mxe=se(1e6),RM=se(Math.PI),Cxe=se(Math.PI*2),Rxe=se(Math.PI*2),Pxe=se(Math.PI*.5),bK=lt(Re,Re.ALL).setParameterLength(1),wK=lt(Re,Re.ANY).setParameterLength(1),SK=lt(Re,Re.RADIANS).setParameterLength(1),TK=lt(Re,Re.DEGREES).setParameterLength(1),k7=lt(Re,Re.EXP).setParameterLength(1),N1=lt(Re,Re.EXP2).setParameterLength(1),GC=lt(Re,Re.LOG).setParameterLength(1),Mh=lt(Re,Re.LOG2).setParameterLength(1),Ca=lt(Re,Re.SQRT).setParameterLength(1),G7=lt(Re,Re.INVERSE_SQRT).setParameterLength(1),Ch=lt(Re,Re.FLOOR).setParameterLength(1),zC=lt(Re,Re.CEIL).setParameterLength(1),Jo=lt(Re,Re.NORMALIZE).setParameterLength(1),ou=lt(Re,Re.FRACT).setParameterLength(1),Ta=lt(Re,Re.SIN).setParameterLength(1),EK=lt(Re,Re.SINH).setParameterLength(1),nu=lt(Re,Re.COS).setParameterLength(1),MK=lt(Re,Re.COSH).setParameterLength(1),CK=lt(Re,Re.TAN).setParameterLength(1),RK=lt(Re,Re.TANH).setParameterLength(1),PK=lt(Re,Re.ASIN).setParameterLength(1),IK=lt(Re,Re.ASINH).setParameterLength(1),z7=lt(Re,Re.ACOS).setParameterLength(1),NK=lt(Re,Re.ACOSH).setParameterLength(1),V7=lt(Re,Re.ATAN).setParameterLength(1,2),LK=lt(Re,Re.ATANH).setParameterLength(1),Ji=lt(Re,Re.ABS).setParameterLength(1),q7=lt(Re,Re.SIGN).setParameterLength(1),Rh=lt(Re,Re.LENGTH).setParameterLength(1),H7=lt(Re,Re.NEGATE).setParameterLength(1),DK=lt(Re,Re.ONE_MINUS).setParameterLength(1),W7=lt(Re,Re.DFDX).setParameterLength(1),j7=lt(Re,Re.DFDY).setParameterLength(1),FK=lt(Re,Re.ROUND).setParameterLength(1),OK=lt(Re,Re.RECIPROCAL).setParameterLength(1),X7=lt(Re,Re.TRUNC).setParameterLength(1),$7=lt(Re,Re.FWIDTH).setParameterLength(1),BK=lt(Re,Re.TRANSPOSE).setParameterLength(1),UK=lt(Re,Re.DETERMINANT).setParameterLength(1),kK=lt(Re,Re.INVERSE).setParameterLength(1),el=lt(Re,Re.MIN).setParameterLength(2,1/0),Tr=lt(Re,Re.MAX).setParameterLength(2,1/0),Fm=lt(Re,Re.STEP).setParameterLength(2),GK=lt(Re,Re.REFLECT).setParameterLength(2),zK=lt(Re,Re.DISTANCE).setParameterLength(2),VK=lt(Re,Re.DIFFERENCE).setParameterLength(2),xc=lt(Re,Re.DOT).setParameterLength(2),td=lt(Re,Re.CROSS).setParameterLength(2),Ac=lt(Re,Re.POW).setParameterLength(2),Y7=i=>bn(i,i),qK=i=>bn(i,i,i),Z7=i=>bn(i,i,i,i),HK=lt(Re,Re.TRANSFORM_DIRECTION).setParameterLength(2),WK=(i,e)=>Jo(bn(e,Lt(pe(i),0)).xyz),jK=(i,e)=>Jo(Lt(pe(i),0).mul(e).xyz),XK=i=>bn(q7(i),Ac(Ji(i),1/3)),K7=i=>xc(i,i),Xn=lt(Re,Re.MIX).setParameterLength(3),au=(i,e=0,t=1)=>new Re(Re.CLAMP,Vt(i),Vt(e),Vt(t)),VC=i=>au(i),Q7=lt(Re,Re.REFRACT).setParameterLength(3),Ol=lt(Re,Re.SMOOTHSTEP).setParameterLength(3),J7=lt(Re,Re.FACEFORWARD).setParameterLength(3),$K=Ae(([i])=>{let n=43758.5453,r=xc(i.xy,ft(12.9898,78.233)),s=UC(r,RM);return ou(Ta(s).mul(n))}),YK=(i,e,t)=>Xn(e,t,i),ZK=(i,e,t)=>Ol(e,t,i),KK=(i,e)=>Fm(e,i),Ixe=J7,Nxe=G7;Be("all",bK);Be("any",wK);Be("radians",SK);Be("degrees",TK);Be("exp",k7);Be("exp2",N1);Be("log",GC);Be("log2",Mh);Be("sqrt",Ca);Be("inverseSqrt",G7);Be("floor",Ch);Be("ceil",zC);Be("normalize",Jo);Be("fract",ou);Be("sin",Ta);Be("sinh",EK);Be("cos",nu);Be("cosh",MK);Be("tan",CK);Be("tanh",RK);Be("asin",PK);Be("asinh",IK);Be("acos",z7);Be("acosh",NK);Be("atan",V7);Be("atanh",LK);Be("abs",Ji);Be("sign",q7);Be("length",Rh);Be("lengthSq",K7);Be("negate",H7);Be("oneMinus",DK);Be("dFdx",W7);Be("dFdy",j7);Be("round",FK);Be("reciprocal",OK);Be("trunc",X7);Be("fwidth",$7);Be("min",el);Be("max",Tr);Be("step",KK);Be("reflect",GK);Be("distance",zK);Be("dot",xc);Be("cross",td);Be("pow",Ac);Be("pow2",Y7);Be("pow3",qK);Be("pow4",Z7);Be("transformDirection",HK);Be("transformNormalByViewMatrix",WK);Be("transformNormalByInverseViewMatrix",jK);Be("mix",YK);Be("clamp",au);Be("refract",Q7);Be("smoothstep",ZK);Be("faceForward",J7);Be("difference",VK);Be("saturate",VC);Be("cbrt",XK);Be("transpose",BK);Be("determinant",UK);Be("inverse",kK);Be("rand",$K);var Z8=class extends $t{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?id(n).build(e):"";r.nodeProperty=u;let f=s.build(e,"bool");if(e.context.uniformFlow&&a!==null){let v=o.build(e,n),w=a.build(e,n),S=e.getTernary(f,v,w);return e.format(S,n,t)}e.addFlowCode(`41334133 ${e.tab}if ( ${f} ) {41344134 41354135 `).addFlowTab();let x=o.build(e,n);if(x&&(c?x=u+" = "+x+";":(x="return "+x+";",l===null&&(je("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),x="// "+x))),e.removeFlowTab().addFlowCode(e.tab+" "+x+`
@@ -4142,30 +4142,30 @@ ${e.tab}if ( ${f} ) {
41424142 41434143 `)}else e.addFlowCode(`41444144 4145-`);return e.format(u,n,t)}},Qo=Hn(q8).setParameterLength(2,3);Be("select",Qo);var ib=class extends $t{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}},id=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new ib(t,e)},ZK=i=>id(i,{uniformFlow:!0}),X7=(i,e)=>id(i,{nodeName:e});function KK(i,e,t=null){return id(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function QK(i,e=null){return id(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function JK(i,e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.'),X7(i,e)}Be("context",id);Be("label",JK);Be("uniformFlow",ZK);Be("setName",X7);Be("builtinShadowContext",(i,e,t)=>KK(e,t,i));Be("builtinAOContext",(i,e)=>QK(e,i));var E1=class extends $t{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&&Ge('TSL: ".toVar()" can not be used with void type.',this.stackTrace),t.build(e);let u=e.getVectorType(c),f=t.build(e,u),p=e.getVarFromNode(this,n,u,void 0,l),x=e.getPropertyName(p),v=x;if(l)if(o)v=a?`const ${x}`:`let ${x}`;else{let w=t.getArrayCount(e);v=`const ${e.getVar(p.type,x,w)}`}return e.addLineFlowCode(`${v} = ${f}`,this),x}_hasStack(e){return e.getDataFromNode(this).stack!==void 0}},$7=Hn(E1),eQ=(i,e=null)=>$7(i,e).toStack(),tQ=(i,e=null)=>$7(i,e,!0).toStack(),nQ=i=>$7(i).setIntent(!0).toStack();Be("toVar",eQ);Be("toConst",tQ);Be("toVarIntent",nQ);var H8=class extends $t{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}},Cm=(i,e,t=null)=>new H8(Vt(i),e,t),W8=class extends $t{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=Cm(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=Cm(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(x1.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(x1.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,x1.VERTEX);if(e.shaderStage===x1.VERTEX){let a=n.node.build(e,s);e.addLineFlowCode(`${o} = ${a}`,this)}else e.flowNodeFromShaderStage(x1.VERTEX,n.node,s,o);n[t]=o}return e.getPropertyName(r)}},d0=Hn(W8).setParameterLength(1,2),iQ=i=>d0(i);Be("toVarying",d0);Be("toVertexStage",iQ);var rQ=Ae(([i])=>{let e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Xn(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),sQ=Ae(([i])=>{let e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Xn(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Y7="WorkingColorSpace",Ixe="OutputColorSpace",rb=class extends pr{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===Y7?sn.workingColorSpace:t===Ixe?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 sn.enabled===!1||n===r||!n||!r||(sn.getTransfer(n)===Bt&&(s=Lt(rQ(s.rgb),s.a)),sn.getPrimaries(n)!==sn.getPrimaries(r)&&(s=Lt(so(sn._getMatrix(new Sn,n,r)).mul(s.rgb),s.a)),sn.getTransfer(r)===Bt&&(s=Lt(sQ(s.rgb),s.a))),s}},oQ=(i,e)=>new rb(Vt(i),Y7,e),zC=(i,e)=>new rb(Vt(i),e,Y7),Nxe=(i,e,t)=>new rb(Vt(i),e,t);Be("workingToColorSpace",oQ);Be("colorSpaceToWorking",zC);var Lxe=class extends Jf{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)}},CM=class extends $t{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=_n.OBJECT}setGroup(e){return this.group=e,this}element(e){return new Lxe(this,Vt(e))}setNodeType(e){let t=Ht(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}},Dxe=(i,e,t)=>new CM(i,e,t),j8=class extends CM{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(Zt)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}},aQ=(i,e,t=null)=>new j8(i,e,t),X8=class extends pr{static get type(){return"ToneMappingNode"}constructor(e,t=cQ,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return Wv(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===zs)return t;let r=null,s=e.renderer.library.getToneMappingFunction(n);return s!==null?r=Lt(s(t.rgb,this.exposureNode),t.a):(Ge("ToneMappingNode: Unsupported Tone Mapping configuration.",n),r=t),r}},lQ=(i,e,t)=>new X8(i,Vt(e),Vt(t)),cQ=aQ("toneMappingExposure","float");Be("toneMapping",(i,e,t)=>lQ(e,t,i));var xY=new WeakMap;function yY(i,e){let t=xY.get(i);return t===void 0&&(t=new Pf(i,e),xY.set(i,t)),t}var bh=class extends eb{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=Zd,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=yY(r.array,s):a=yY(r,s);let l=new _o(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=d0(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 VC(i,e=null,t=0,n=0,r=Zd,s=!1){return e==="mat3"||e===null&&i.itemSize===9?so(new bh(i,"vec3",9,0).setUsage(r).setInstanced(s),new bh(i,"vec3",9,3).setUsage(r).setInstanced(s),new bh(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?o0(new bh(i,"vec4",16,0).setUsage(r).setInstanced(s),new bh(i,"vec4",16,4).setUsage(r).setInstanced(s),new bh(i,"vec4",16,8).setUsage(r).setInstanced(s),new bh(i,"vec4",16,12).setUsage(r).setInstanced(s)):new bh(i,e,t,n).setUsage(r)}var Z7=(i,e=null,t=0,n=0)=>VC(i,e,t,n),Fxe=(i,e=null,t=0,n=0)=>VC(i,e,t,n,WA),qC=(i,e=null,t=0,n=0)=>VC(i,e,t,n,Zd,!0),K7=(i,e=null,t=0,n=0)=>VC(i,e,t,n,WA,!0);Be("toAttribute",i=>Z7(i.value));var Cs=class i extends $t{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=d0(this).build(e,t),s}};Cs.VERTEX="vertex";Cs.INSTANCE="instance";Cs.SUBGROUP="subgroup";Cs.INVOCATION_LOCAL="invocationLocal";Cs.INVOCATION_SUBGROUP="invocationSubgroup";Cs.DRAW="draw";var uQ=xt(Cs,Cs.VERTEX),ru=xt(Cs,Cs.INSTANCE),Oxe=xt(Cs,Cs.SUBGROUP),Bxe=xt(Cs,Cs.INVOCATION_SUBGROUP),Uxe=xt(Cs,Cs.INVOCATION_LOCAL),hQ=xt(Cs,Cs.DRAW),$8=class extends $t{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=_n.OBJECT,this.onInitFunction=null,this.countNode=null}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.',new Ur),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=Ht(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=ru.build(e,"uint");e.flow.code=`${e.tab}if ( ${o} >= ${s} ) { return; }4145+`);return e.format(u,n,t)}},Qo=Hn(Z8).setParameterLength(2,3);Be("select",Qo);var sb=class extends $t{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}},rd=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new sb(t,e)},QK=i=>rd(i,{uniformFlow:!0}),eU=(i,e)=>rd(i,{nodeName:e});function JK(i,e,t=null){return rd(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function eQ(i,e=null){return rd(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function tQ(i,e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.'),eU(i,e)}Be("context",rd);Be("label",tQ);Be("uniformFlow",QK);Be("setName",eU);Be("builtinShadowContext",(i,e,t)=>JK(e,t,i));Be("builtinAOContext",(i,e)=>eQ(e,i));var M1=class extends $t{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&&Ge('TSL: ".toVar()" can not be used with void type.',this.stackTrace),t.build(e);let u=e.getVectorType(c),f=t.build(e,u),p=e.getVarFromNode(this,n,u,void 0,l),x=e.getPropertyName(p),v=x;if(l)if(o)v=a?`const ${x}`:`let ${x}`;else{let w=t.getArrayCount(e);v=`const ${e.getVar(p.type,x,w)}`}return e.addLineFlowCode(`${v} = ${f}`,this),x}_hasStack(e){return e.getDataFromNode(this).stack!==void 0}},tU=Hn(M1),nQ=(i,e=null)=>tU(i,e).toStack(),iQ=(i,e=null)=>tU(i,e,!0).toStack(),rQ=i=>tU(i).setIntent(!0).toStack();Be("toVar",nQ);Be("toConst",iQ);Be("toVarIntent",rQ);var K8=class extends $t{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}},Pm=(i,e,t=null)=>new K8(Vt(i),e,t),Q8=class extends $t{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=Pm(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=Pm(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(y1.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(y1.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,y1.VERTEX);if(e.shaderStage===y1.VERTEX){let a=n.node.build(e,s);e.addLineFlowCode(`${o} = ${a}`,this)}else e.flowNodeFromShaderStage(y1.VERTEX,n.node,s,o);n[t]=o}return e.getPropertyName(r)}},p0=Hn(Q8).setParameterLength(1,2),sQ=i=>p0(i);Be("toVarying",p0);Be("toVertexStage",sQ);var oQ=Ae(([i])=>{let e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return Xn(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),aQ=Ae(([i])=>{let e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return Xn(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),nU="WorkingColorSpace",Lxe="OutputColorSpace",ob=class extends pr{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===nU?sn.workingColorSpace:t===Lxe?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 sn.enabled===!1||n===r||!n||!r||(sn.getTransfer(n)===Bt&&(s=Lt(oQ(s.rgb),s.a)),sn.getPrimaries(n)!==sn.getPrimaries(r)&&(s=Lt(so(sn._getMatrix(new Sn,n,r)).mul(s.rgb),s.a)),sn.getTransfer(r)===Bt&&(s=Lt(aQ(s.rgb),s.a))),s}},lQ=(i,e)=>new ob(Vt(i),nU,e),qC=(i,e)=>new ob(Vt(i),e,nU),Dxe=(i,e,t)=>new ob(Vt(i),e,t);Be("workingToColorSpace",lQ);Be("colorSpaceToWorking",qC);var Fxe=class extends ed{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)}},PM=class extends $t{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=_n.OBJECT}setGroup(e){return this.group=e,this}element(e){return new Fxe(this,Vt(e))}setNodeType(e){let t=Ht(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}},Oxe=(i,e,t)=>new PM(i,e,t),J8=class extends PM{static get type(){return"RendererReferenceNode"}constructor(e,t,n=null){super(e,t,n),this.renderer=n,this.setGroup(Zt)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}},cQ=(i,e,t=null)=>new J8(i,e,t),eF=class extends pr{static get type(){return"ToneMappingNode"}constructor(e,t=hQ,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return Xv(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===zs)return t;let r=null,s=e.renderer.library.getToneMappingFunction(n);return s!==null?r=Lt(s(t.rgb,this.exposureNode),t.a):(Ge("ToneMappingNode: Unsupported Tone Mapping configuration.",n),r=t),r}},uQ=(i,e,t)=>new eF(i,Vt(e),Vt(t)),hQ=cQ("toneMappingExposure","float");Be("toneMapping",(i,e,t)=>uQ(e,t,i));var vY=new WeakMap;function bY(i,e){let t=vY.get(i);return t===void 0&&(t=new Nf(i,e),vY.set(i,t)),t}var Sh=class extends nb{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=Kd,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=bY(r.array,s):a=bY(r,s);let l=new _o(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=p0(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 HC(i,e=null,t=0,n=0,r=Kd,s=!1){return e==="mat3"||e===null&&i.itemSize===9?so(new Sh(i,"vec3",9,0).setUsage(r).setInstanced(s),new Sh(i,"vec3",9,3).setUsage(r).setInstanced(s),new Sh(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?a0(new Sh(i,"vec4",16,0).setUsage(r).setInstanced(s),new Sh(i,"vec4",16,4).setUsage(r).setInstanced(s),new Sh(i,"vec4",16,8).setUsage(r).setInstanced(s),new Sh(i,"vec4",16,12).setUsage(r).setInstanced(s)):new Sh(i,e,t,n).setUsage(r)}var iU=(i,e=null,t=0,n=0)=>HC(i,e,t,n),Bxe=(i,e=null,t=0,n=0)=>HC(i,e,t,n,XA),WC=(i,e=null,t=0,n=0)=>HC(i,e,t,n,Kd,!0),rU=(i,e=null,t=0,n=0)=>HC(i,e,t,n,XA,!0);Be("toAttribute",i=>iU(i.value));var Ps=class i extends $t{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=p0(this).build(e,t),s}};Ps.VERTEX="vertex";Ps.INSTANCE="instance";Ps.SUBGROUP="subgroup";Ps.INVOCATION_LOCAL="invocationLocal";Ps.INVOCATION_SUBGROUP="invocationSubgroup";Ps.DRAW="draw";var fQ=xt(Ps,Ps.VERTEX),su=xt(Ps,Ps.INSTANCE),Uxe=xt(Ps,Ps.SUBGROUP),kxe=xt(Ps,Ps.INVOCATION_SUBGROUP),Gxe=xt(Ps,Ps.INVOCATION_LOCAL),dQ=xt(Ps,Ps.DRAW),tF=class extends $t{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=_n.OBJECT,this.onInitFunction=null,this.countNode=null}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.',new Ur),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=Ht(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=su.build(e,"uint");e.flow.code=`${e.tab}if ( ${o} >= ${s} ) { return; }41464146 4147-${e.flow.code}`}}else{let s=e.getNodeProperties(this).outputComputeNode;if(s)return s.build(e,t)}}},Q7=(i,e=[64])=>{(e.length===0||e.length>3)&&Ge("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new Ur);for(let t=0;t<e.length;t++){let n=e[t];(typeof n!="number"||n<=0||!Number.isInteger(n))&&Ge(`TSL: compute() workgroupSize element at index [ ${t} ] must be a positive integer`,new Ur)}for(;e.length<3;)e.push(1);return new $8(Vt(i),e)},fQ=(i,e,t)=>{let n=Q7(i,t);return typeof e=="number"?n.count=e:n.dispatchSize=e,n};Be("compute",fQ);Be("computeKernel",Q7);var Y8=class extends $t{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}},M1=i=>new Y8(Vt(i));function dQ(i,e=!0){return je('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),M1(i).setParent(e)}Be("cache",dQ);Be("isolate",M1);var Z8=class extends $t{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)}},pQ=Hn(Z8).setParameterLength(2);Be("bypass",pQ);var J7=Ae(([i,e,t,n=se(0),r=se(1),s=Ll(!1)])=>{let o=i.sub(e).div(t.sub(e));return P1(s)&&(o=o.clamp()),o.mul(r.sub(n)).add(n)});function AQ(i,e,t,n=se(0),r=se(1)){return J7(i,e,t,n,r,!0)}Be("remap",J7);Be("remapClamp",AQ);var C1=class extends $t{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)}},Il=Hn(C1).setParameterLength(1,2),mQ=i=>(i?Qo(i,Il("discard")):Il("discard")).toStack(),kxe=()=>Il("return").toStack();Be("discard",mQ);var eU=Ae(([i])=>Lt(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),gQ=Ae(([i])=>i.a.equal(0).select(Lt(0),Lt(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"}),K8=class extends pr{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=Lt(t.rgb,t.a.clamp(0,1)),t=gQ(t);let n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||zs,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||qo;return n!==zs&&(t=t.toneMapping(n)),r!==qo&&r!==sn.workingColorSpace&&(t=t.workingToColorSpace(r)),t=eU(t),t}},tU=(i,e=null,t=null)=>new K8(Vt(i),e,t);Be("renderOutput",tU);var Q8=class extends pr{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+`#4147+${e.flow.code}`}}else{let s=e.getNodeProperties(this).outputComputeNode;if(s)return s.build(e,t)}}},sU=(i,e=[64])=>{(e.length===0||e.length>3)&&Ge("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new Ur);for(let t=0;t<e.length;t++){let n=e[t];(typeof n!="number"||n<=0||!Number.isInteger(n))&&Ge(`TSL: compute() workgroupSize element at index [ ${t} ] must be a positive integer`,new Ur)}for(;e.length<3;)e.push(1);return new tF(Vt(i),e)},pQ=(i,e,t)=>{let n=sU(i,t);return typeof e=="number"?n.count=e:n.dispatchSize=e,n};Be("compute",pQ);Be("computeKernel",sU);var nF=class extends $t{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}},C1=i=>new nF(Vt(i));function AQ(i,e=!0){return je('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),C1(i).setParent(e)}Be("cache",AQ);Be("isolate",C1);var iF=class extends $t{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)}},mQ=Hn(iF).setParameterLength(2);Be("bypass",mQ);var oU=Ae(([i,e,t,n=se(0),r=se(1),s=Dl(!1)])=>{let o=i.sub(e).div(t.sub(e));return I1(s)&&(o=o.clamp()),o.mul(r.sub(n)).add(n)});function gQ(i,e,t,n=se(0),r=se(1)){return oU(i,e,t,n,r,!0)}Be("remap",oU);Be("remapClamp",gQ);var R1=class extends $t{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)}},Nl=Hn(R1).setParameterLength(1,2),_Q=i=>(i?Qo(i,Nl("discard")):Nl("discard")).toStack(),zxe=()=>Nl("return").toStack();Be("discard",_Q);var aU=Ae(([i])=>Lt(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),xQ=Ae(([i])=>i.a.equal(0).select(Lt(0),Lt(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"}),rF=class extends pr{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=Lt(t.rgb,t.a.clamp(0,1)),t=xQ(t);let n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||zs,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||qo;return n!==zs&&(t=t.toneMapping(n)),r!==qo&&r!==sn.workingColorSpace&&(t=t.workingToColorSpace(r)),t=aU(t),t}},lU=(i,e=null,t=null)=>new rF(Vt(i),e,t);Be("renderOutput",lU);var sF=class extends pr{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+`#41484148 `,o+=e.flow.code.replace(/^\t/mg,"")+`41494149 `,o+="/* ... */ "+n+` /* ... */41504150 `,o+="// #"+s+`#4151-`,yA(o)}return n}},_Q=(i,e=null)=>new Q8(Vt(i),e).toStack();Be("debug",_Q);var RM=class extends zo{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(){}},J8=class extends $t{static get type(){return"InspectorNode"}constructor(e,t="",n=null){super(),this.node=e,this.name=t,this.callback=n,this.updateType=_n.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!==RM&&Kn('TSL: ".toInspector()" is only available with WebGPU.'),t}};function xQ(i,e="",t=null){return i=Vt(i),i.before(new J8(i,e,t))}Be("toInspector",xQ);function Gxe(i){je("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}var PM=class extends $t{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):d0(this).build(e,n)}else return je(`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}},Nl=(i,e=null)=>new PM(i,e),Pi=(i=0)=>Nl("uv"+(i>0?i:""),"vec2"),eF=class extends $t{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)}},Dm=Hn(eF).setParameterLength(1,2),tF=class extends Nm{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=_n.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))}}},nU=Hn(tF).setParameterLength(1),IM=class extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}},iU=new ws,xc=class extends Nm{static get type(){return"TextureNode"}constructor(e=iU,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=_n.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===pi?"uvec4":this.value.type===Dr?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Pi(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=Ht(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=Ht(!1)),t=t.toVar(),this.sampler?t=this._flipYUniform.select(t.flipY(),t):t=this._flipYUniform.select(t.setY(fe(Dm(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 IM("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);let r=Ae(()=>{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?_n.OBJECT:_n.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(kf.TEXTURE_COMPARE))o=this.compareNode;else{let l=n.compareFunction;l===null||l===P_||l===ih||l===HA||l===jc?a=this.compareNode:(o=this.compareNode,Kn('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 p=this.value,x;return s?x=e.generateTextureBias(p,t,n,s,o,u):l?x=e.generateTextureGrad(p,t,n,l,o,u):c?a?x=e.generateTextureGatherCompare(p,t,n,a,o,u,f):x=e.generateTextureGather(p,t,n,c,o,u,f):a?x=e.generateTextureCompare(p,t,n,a,o,u):this.sampler===!1?x=e.generateTextureLoad(p,t,n,r,o,u):r?x=e.generateTextureLevel(p,t,n,r,o,u):x=e.generateTexture(p,t,n,o,u),x}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:p,compareNode:x,compareStepNode:v,depthNode:w,gradNode:S,gatherNode:T,offsetNode:P}=r,R=this.generateUV(e,u),C=f?f.build(e,"float"):null,L=p?p.build(e,"float"):null,D=w?w.build(e,"int"):null,F=x?x.build(e,"float"):null,N=v?v.build(e,"float"):null,B=S?[S[0].build(e,"vec2"),S[1].build(e,"vec2")]:null,z=T?T.build(e,"int"):null,V=P?this.generateOffset(e,P):null,H=this._flipYUniform?this._flipYUniform.build(e,"bool"):null;z&&(a="vec4");let Z=D;Z===null&&n.isArrayTexture&&this.isTexture3DNode!==!0&&(Z="0");let J=e.getVarFromNode(this);l=e.getPropertyName(J);let j=this.generateSnippet(e,s,R,C,L,Z,F,B,z,V,H);if(N!==null){let K=n.compareFunction;K===HA||K===jc?j=Lm(Il(j,a),Il(N,"float")).build(e,a):j=Lm(Il(N,"float"),Il(j,a)).build(e,a)}e.addLineFlowCode(`${l} = ${j}`,this),o.snippet=j,o.propertyName=l}let c=l;return e.needsToWorkingColorSpace(n)&&(c=zC(Il(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=Vt(e),t.referenceNode=this.getBase(),Vt(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){let t=this.clone();t.biasNode=Vt(e).mul(nU(t)),t.referenceNode=this.getBase();let n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===yi||n.magFilter===yi)&&(je("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),Vt(t)}level(e){let t=this.clone();return t.levelNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}size(e){return Dm(this,e)}bias(e){let t=this.clone();return t.biasNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){let t=this.clone();return t.compareNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}grad(e,t){let n=this.clone();return n.gradNode=[Vt(e),Vt(t)],n.referenceNode=this.getBase(),Vt(n)}gather(e=0){let t=this.clone();return t.gatherNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}depth(e){let t=this.clone();return t.depthNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}offset(e){let t=this.clone();return t.offsetNode=Vt(e),t.referenceNode=this.getBase(),Vt(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}},zxe=Hn(xc).setParameterLength(1,4).setName("texture"),ai=(i=iU,e=null,t=null,n=null)=>{let r;return i&&i.isTextureNode===!0?(r=Vt(i.clone()),r.referenceNode=i.getBase(),e!==null&&(r.uvNode=Vt(e)),t!==null&&(r.levelNode=Vt(t)),n!==null&&(r.biasNode=Vt(n))):r=zxe(i,e,t,n),r},Vxe=(i=iU)=>ai(i),es=(...i)=>ai(...i).setSampler(!1),qxe=(i,e,t)=>ai(i,e).level(t),Hxe=i=>(i.isNode===!0?i:ai(i)).convert("sampler"),Wxe=i=>(i.isNode===!0?i:ai(i)).convert("samplerComparison"),sb=class extends Nm{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"}},z1=(i,e,t)=>new sb(i,e,t),nF=class extends Jf{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)}},iF=class extends sb{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?r0(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=_n.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 nF(this,Vt(e))}},To=(i,e)=>new iF(i,e),rF=class extends $t{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},rd=Hn(rF).setParameterLength(1),Tv,Ev,Mo=class i extends $t{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=_n.NONE;return(this.scope===i.SIZE||this.scope===i.VIEWPORT||this.scope===i.DPR)&&(e=_n.RENDER),this.updateType=e,e}update({renderer:e}){let t=e.getRenderTarget();this.scope===i.VIEWPORT?t!==null?Ev.copy(t.viewport):(e.getViewport(Ev),Ev.multiplyScalar(e.getPixelRatio())):this.scope===i.DPR?this._output.value=e.getPixelRatio():t!==null?(Tv.width=t.width,Tv.height=t.height):e.getDrawingBufferSize(Tv)}setup(){let e=this.scope,t=null;return e===i.SIZE?t=Ht(Tv||(Tv=new Oe)):e===i.VIEWPORT?t=Ht(Ev||(Ev=new gn)):e===i.DPR?t=Ht(1):t=ft(Hm.div(Fm)),this._output=t,t}generate(e){if(this.scope===i.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let n=e.getNodeProperties(Fm).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}};Mo.COORDINATE="coordinate";Mo.VIEWPORT="viewport";Mo.SIZE="size";Mo.UV="uv";Mo.DPR="dpr";var rU=xt(Mo,Mo.DPR),iu=xt(Mo,Mo.UV),Fm=xt(Mo,Mo.SIZE),Hm=xt(Mo,Mo.COORDINATE),R1=xt(Mo,Mo.VIEWPORT),sU=R1.zw,yQ=Hm.sub(R1.xy),jxe=yQ.div(sU),Xxe=Ae(()=>(je('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new Ur),Fm),"vec2").once()(),W6=null,CE=null,j6=null,RE=null,X6=null,PE=null,$6=null,IE=null,Y6=null,NE=null,Z6=null,LE=null,K6=null,DE=null,p0=Ht(0,"uint").setName("u_cameraIndex").setGroup(FC("cameraIndex")).toVarying("v_cameraIndex"),e0=Ht("float").setName("cameraNear").setGroup(Zt).onRenderUpdate(({camera:i})=>i.near),t0=Ht("float").setName("cameraFar").setGroup(Zt).onRenderUpdate(({camera:i})=>i.far),Ma=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrix);CE===null?CE=To(t).setGroup(Zt).setName("cameraProjectionMatrices"):CE.array=t,e=CE.element(i.isMultiViewCamera?rd("gl_ViewID_OVR"):p0)}else W6===null&&(W6=Ht(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=W6;return e}).once()(),vQ=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrixInverse);RE===null?RE=To(t).setGroup(Zt).setName("cameraProjectionMatricesInverse"):RE.array=t,e=RE.element(i.isMultiViewCamera?rd("gl_ViewID_OVR"):p0)}else j6===null&&(j6=Ht(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Zt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=j6;return e}).once()(),A0=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorldInverse);PE===null?PE=To(t).setGroup(Zt).setName("cameraViewMatrices"):PE.array=t,e=PE.element(i.isMultiViewCamera?rd("gl_ViewID_OVR"):p0)}else X6===null&&(X6=Ht(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=X6;return e}).once()(),bb=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorld);IE===null?IE=To(t).setGroup(Zt).setName("cameraWorldMatrices"):IE.array=t,e=IE.element(i.isMultiViewCamera?rd("gl_ViewID_OVR"):p0)}else $6===null&&($6=Ht(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=$6;return e}).once()(),$xe=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.normalMatrix);NE===null?NE=To(t).setGroup(Zt).setName("cameraNormalMatrices"):NE.array=t,e=NE.element(i.isMultiViewCamera?rd("gl_ViewID_OVR"):p0)}else Y6===null&&(Y6=Ht(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=Y6;return e}).once()(),bQ=Ae(({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 ie);LE===null?LE=To(t).setGroup(Zt).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)}):LE.array=t,e=LE.element(i.isMultiViewCamera?rd("gl_ViewID_OVR"):p0)}else Z6===null&&(Z6=Ht(new ie).setName("cameraPosition").setGroup(Zt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld))),e=Z6;return e}).once()(),Yxe=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.viewport);DE===null?DE=To(t,"vec4").setGroup(Zt).setName("cameraViewports"):DE.array=t,e=DE.element(p0)}else K6===null&&(K6=Lt(0,0,Fm.x,Fm.y).toConst("cameraViewport")),e=K6;return e}).once()(),vY=new Wa,ds=class i extends $t{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=_n.OBJECT,this.uniformNode=new Nm(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 ie,n.value.setFromMatrixPosition(t.matrixWorld);else if(r===i.SCALE)n.value=n.value||new ie,n.value.setFromMatrixScale(t.matrixWorld);else if(r===i.DIRECTION)n.value=n.value||new ie,t.getWorldDirection(n.value);else if(r===i.VIEW_POSITION){let s=e.camera;n.value=n.value||new ie,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(),vY.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=vY.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 Zxe=Hn(ds,ds.DIRECTION).setParameterLength(1),Kxe=Hn(ds,ds.WORLD_MATRIX).setParameterLength(1),Qxe=Hn(ds,ds.POSITION).setParameterLength(1),Jxe=Hn(ds,ds.SCALE).setParameterLength(1),eye=Hn(ds,ds.VIEW_POSITION).setParameterLength(1),tye=Hn(ds,ds.RADIUS).setParameterLength(1),el=class extends ds{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},nye=xt(el,el.DIRECTION),Ac=xt(el,el.WORLD_MATRIX),iye=xt(el,el.POSITION),rye=xt(el,el.SCALE),sye=xt(el,el.VIEW_POSITION),oye=xt(el,el.RADIUS),wQ=Ht(new Sn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),aye=Ht(new on).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),Ih=Ae(i=>i.context.modelViewMatrix||SQ).once()().toVar("modelViewMatrix"),SQ=A0.mul(Ac),sF=Ae(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Ht("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),oF=Ae(i=>{let e=i.context.isHighPrecisionModelViewMatrix;return Ht("mat3").onObjectUpdate(({object:t,camera:n})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),TQ=Ae(i=>i.shaderStage!=="fragment"?(Kn("TSL: `clipSpace` is only available in fragment stage."),Lt()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),Zo=Nl("position","vec3"),fr=Zo.toVarying("positionLocal"),Om=Zo.toVarying("positionPrevious"),Ch=Ae(i=>Ac.mul(fr).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),oU=Ae(()=>fr.transformDirection(Ac).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),ts=Ae(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){let e=vQ.mul(TQ);return e.xyz.div(e.w).toVar("positionView")}return i.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),Vi=Ae(i=>{let e;return i.camera.isOrthographicCamera?e=pe(0,0,1):e=ts.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])(),aF=class extends $t{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===ui?"false":e.getFrontFacing()}},EQ=xt(aF),aU=se(EQ).mul(2).sub(1),Wm=Ae(([i],{material:e})=>{let t=e.side;return t===ui?i=i.mul(-1):t===rr&&(i=i.mul(aU)),i}),lye=i=>(Kn('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),Wm(i)),HC=Nl("normal","vec3"),ta=Ae(i=>i.geometry.hasAttribute("normal")===!1?(je('TSL: Vertex attribute "normal" not found on geometry.'),pe(0,1,0)):HC,"vec3").once()().toVar("normalLocal"),MQ=ts.dFdx().cross(ts.dFdy()).normalize().toVar("normalFlat"),N1=Ae(i=>{let e;return i.isFlatShading()?e=MQ:e=cU(ta).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),CQ=Ae(i=>{let e=N1.transformNormalByInverseViewMatrix(A0);return i.isFlatShading()!==!0&&(e=e.toVarying("v_normalWorldGeometry")),e.normalize().toVar("normalWorldGeometry")},"vec3").once()(),oi=Ae(i=>{let e;return i.subBuildFn==="NORMAL"||i.subBuildFn==="VERTEX"?(e=N1,i.isFlatShading()!==!0&&(e=Wm(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),m0=oi.transformNormalByInverseViewMatrix(A0).toVar("normalWorld"),n0=Ae(({subBuildFn:i,context:e})=>{let t;return i==="NORMAL"||i==="VERTEX"?t=oi:t=e.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),lU=Ae(([i,e=Ac])=>so(e).inverse().transpose().mul(i).normalize());Be("transformNormal",lU);var cU=Ae(([i],e)=>{let t=e.context.modelNormalViewMatrix;return t?i.transformNormalByViewMatrix(t):wQ.mul(i).transformNormalByViewMatrix(A0)}),cye=Ae(()=>(je('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),oi)).once(["NORMAL","VERTEX"])(),uye=Ae(()=>(je('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),m0)).once(["NORMAL","VERTEX"])(),hye=Ae(()=>(je('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),n0)).once(["NORMAL","VERTEX"])(),Q6=new on,RQ=Ht(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),fM=Ht(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),NM=Ht(new on).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?Q6.makeRotationFromEuler(n).transpose():Q6.identity(),Q6}),PQ=Vi.negate().reflect(oi),IQ=Vi.negate().refract(oi,RQ),NQ=PQ.transformDirection(bb).toVar("reflectVector"),LQ=IQ.transformDirection(bb).toVar("refractVector"),DQ=new Gu,lF=class extends xc{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===yl?NQ:e.mapping===nc?LQ:(Ge('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===Ha?pe(t.x,t.y.negate(),t.z):t:(t=NM.mul(t),(e.renderer.coordinateSystem===Ha||!n.isRenderTargetTexture)&&(t=pe(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}},uU=Hn(lF).setParameterLength(1,4).setName("cubeTexture"),Ea=(i=DQ,e=null,t=null,n=null)=>{let r;return i&&i.isCubeTextureNode===!0?(r=Vt(i.clone()),r.referenceNode=i,e!==null&&(r.uvNode=Vt(e)),t!==null&&(r.levelNode=Vt(t)),n!==null&&(r.biasNode=Vt(n))):r=uU(i,e,t,n),r},fye=(i=DQ)=>uU(i),cF=class extends Jf{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)}},L1=class extends $t{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=_n.OBJECT}element(e){return new cF(this,Vt(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;this.count!==null?t=z1(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=To(null,e),t.updateType=_n.OBJECT):e==="texture"?t=ai(null):e==="cubeTexture"?t=Ea(null):t=Ht(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}},nr=(i,e,t)=>new L1(i,e,t),FQ=(i,e,t,n)=>new L1(i,e,n,t),uF=class extends L1{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}},Zf=(i,e,t=null)=>new uF(i,e,t),OQ=Pi(),dye=ts.dFdx(),pye=ts.dFdy(),BQ=OQ.dFdx(),UQ=OQ.dFdy(),kQ=oi,GQ=pye.cross(kQ),zQ=kQ.cross(dye),hF=GQ.mul(BQ.x).add(zQ.mul(UQ.x)),fF=GQ.mul(BQ.y).add(zQ.mul(UQ.y)),bY=hF.dot(hF).max(fF.dot(fF)),VQ=bY.equal(0).select(0,bY.inverseSqrt()),Aye=hF.mul(VQ).toVar("tangentViewFrame"),mye=fF.mul(VQ).toVar("bitangentViewFrame"),WC=Nl("tangent","vec4"),u0=WC.xyz.toVar("tangentLocal"),jC=Ae(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=Ih.mul(Lt(u0,0)).xyz.toVarying("v_tangentView").normalize():e=Aye,i.isFlatShading()!==!0&&(e=Wm(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),qQ=jC.transformDirection(bb).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),XC=Ae(([i,e],t)=>{let n=i.mul(WC.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),gye=XC(HC.cross(WC),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),_ye=XC(ta.cross(u0),"v_bitangentLocal").normalize().toVar("bitangentLocal"),HQ=Ae(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=XC(oi.cross(jC),"v_bitangentView").normalize():e=mye,i.isFlatShading()!==!0&&(e=Wm(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),xye=XC(m0.cross(qQ),"v_bitangentWorld").normalize().toVar("bitangentWorld"),wm=so(jC,HQ,oi).toVar("TBNViewMatrix"),WQ=Vi.mul(wm),yye=(i,e)=>i.sub(WQ.mul(e)),jQ=Ae(()=>{let i=Em.cross(Vi);return i=i.cross(Em).normalize(),i=Xn(i,oi,Qp.mul(wh.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),hU=i=>Vt(i).mul(.5).add(.5),XQ=i=>Vt(i).mul(2).sub(1),dF=i=>pe(i,Ca(GC(se(1).sub(_c(i,i))))),vye=i=>(Kn('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),hU(i)),bye=i=>(Kn('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),XQ(i)),pF=class extends pr{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=vl,this.unpackNormalMode=v2}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,s=this.node.mul(2).sub(1);if(t===vl?r===t3?s=dF(s.xy):r===aL?s=dF(s.yw):r!==v2&&Ge(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==v2&&Ge(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${r}'`),n!==null){let a=n;e.isFlatShading()===!0&&(a=Wm(a)),s=pe(s.xy.mul(a),s.z)}let o=null;return t===e3?o=cU(s):t===vl?o=wm.mul(s).normalize():(Ge(`NodeMaterial: Unsupported normal map type: ${t}`),o=oi),o}},AF=Hn(pF).setParameterLength(1,2),wye=Ae(({textureNode:i,bumpScale:e})=>{let t=r=>i.isolate().context({getUV:s=>r(s.uvNode||Pi()),forceUVContext:!0}),n=se(t(r=>r));return ft(se(t(r=>r.add(r.dFdx()))).sub(n),se(t(r=>r.add(r.dFdy()))).sub(n)).mul(e)}),Sye=Ae(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(aU),u=c.sign().mul(n.x.mul(a).add(n.y.mul(l)));return c.abs().mul(t).sub(u).normalize()}),mF=class extends pr{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 oi;let t=this.scaleNode!==null?this.scaleNode:1,n=wye({textureNode:this.textureNode,bumpScale:t});return Sye({surf_pos:ts,surf_norm:oi,dHdxy:n})}},fU=Hn(mF).setParameterLength(1,2),wY=new Map,ot=class i extends $t{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=wY.get(e);return n===void 0&&(n=Zf(e,t),wY.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=se(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=AF(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==Ts||t.normalMap.format==nh||t.normalMap.format==th)&&(r.unpackNormalMode=t3)):t.bumpMap?r=fU(this.getTexture("bump").r,this.getFloat("bumpScale")):r=oi;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=AF(this.getTexture(n),this.getCache(n+"Scale","vec2")):r=oi;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=LC(y1.x,y1.y,y1.y.negate(),y1.x).mul(s.rg.mul(2).sub(ft(1)).normalize().mul(s.b))}else r=y1;else if(n===i.IRIDESCENCE_THICKNESS){let s=nr("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){let o=nr("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=se(1);else if(n===i.LINE_DASH_OFFSET)r=t.dashOffset?this.getFloat(n):se(0);else{let s=this.getNodeType(e);r=this.getCache(n,s)}return r}};ot.ALPHA_TEST="alphaTest";ot.COLOR="color";ot.OPACITY="opacity";ot.SHININESS="shininess";ot.SPECULAR="specular";ot.SPECULAR_STRENGTH="specularStrength";ot.SPECULAR_INTENSITY="specularIntensity";ot.SPECULAR_COLOR="specularColor";ot.REFLECTIVITY="reflectivity";ot.ROUGHNESS="roughness";ot.METALNESS="metalness";ot.NORMAL="normal";ot.CLEARCOAT="clearcoat";ot.CLEARCOAT_ROUGHNESS="clearcoatRoughness";ot.CLEARCOAT_NORMAL="clearcoatNormal";ot.EMISSIVE="emissive";ot.ROTATION="rotation";ot.SHEEN="sheen";ot.SHEEN_ROUGHNESS="sheenRoughness";ot.ANISOTROPY="anisotropy";ot.IRIDESCENCE="iridescence";ot.IRIDESCENCE_IOR="iridescenceIOR";ot.IRIDESCENCE_THICKNESS="iridescenceThickness";ot.IOR="ior";ot.TRANSMISSION="transmission";ot.THICKNESS="thickness";ot.ATTENUATION_DISTANCE="attenuationDistance";ot.ATTENUATION_COLOR="attenuationColor";ot.LINE_SCALE="scale";ot.LINE_DASH_SIZE="dashSize";ot.LINE_GAP_SIZE="gapSize";ot.LINE_WIDTH="linewidth";ot.LINE_DASH_OFFSET="dashOffset";ot.POINT_SIZE="size";ot.DISPERSION="dispersion";ot.LIGHT_MAP="light";ot.AO="ao";var $Q=xt(ot,ot.ALPHA_TEST),YQ=xt(ot,ot.COLOR),ZQ=xt(ot,ot.SHININESS),KQ=xt(ot,ot.EMISSIVE),dU=xt(ot,ot.OPACITY),QQ=xt(ot,ot.SPECULAR),gF=xt(ot,ot.SPECULAR_INTENSITY),JQ=xt(ot,ot.SPECULAR_COLOR),Yv=xt(ot,ot.SPECULAR_STRENGTH),dM=xt(ot,ot.REFLECTIVITY),eJ=xt(ot,ot.ROUGHNESS),tJ=xt(ot,ot.METALNESS),nJ=xt(ot,ot.NORMAL),iJ=xt(ot,ot.CLEARCOAT),rJ=xt(ot,ot.CLEARCOAT_ROUGHNESS),sJ=xt(ot,ot.CLEARCOAT_NORMAL),oJ=xt(ot,ot.ROTATION),aJ=xt(ot,ot.SHEEN),lJ=xt(ot,ot.SHEEN_ROUGHNESS),cJ=xt(ot,ot.ANISOTROPY),uJ=xt(ot,ot.IRIDESCENCE),hJ=xt(ot,ot.IRIDESCENCE_IOR),fJ=xt(ot,ot.IRIDESCENCE_THICKNESS),dJ=xt(ot,ot.TRANSMISSION),pJ=xt(ot,ot.THICKNESS),AJ=xt(ot,ot.IOR),mJ=xt(ot,ot.ATTENUATION_DISTANCE),gJ=xt(ot,ot.ATTENUATION_COLOR),pU=xt(ot,ot.LINE_SCALE),AU=xt(ot,ot.LINE_DASH_SIZE),mU=xt(ot,ot.LINE_GAP_SIZE),LM=xt(ot,ot.LINE_WIDTH),gU=xt(ot,ot.LINE_DASH_OFFSET),_J=xt(ot,ot.POINT_SIZE),xJ=xt(ot,ot.DISPERSION),_U=xt(ot,ot.LIGHT_MAP),yJ=xt(ot,ot.AO),y1=Ht(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))}),vJ=Ae(i=>i.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection"),Ra=class i extends $t{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===i.OBJECT?this.updateType=_n.OBJECT:e===i.MATERIAL?this.updateType=_n.RENDER:e===i.FRAME?this.updateType=_n.FRAME:e===i.BEFORE_OBJECT?this.updateBeforeType=_n.OBJECT:e===i.BEFORE_MATERIAL?this.updateBeforeType=_n.RENDER:e===i.BEFORE_FRAME&&(this.updateBeforeType=_n.FRAME)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}};Ra.OBJECT="object";Ra.MATERIAL="material";Ra.FRAME="frame";Ra.BEFORE_OBJECT="beforeObject";Ra.BEFORE_MATERIAL="beforeMaterial";Ra.BEFORE_FRAME="beforeFrame";var V1=(i,e)=>new Ra(i,e).toStack(),wb=i=>V1(Ra.OBJECT,i),Tye=i=>V1(Ra.MATERIAL,i),bJ=i=>V1(Ra.FRAME,i),Eye=i=>V1(Ra.BEFORE_OBJECT,i),Mye=i=>V1(Ra.BEFORE_MATERIAL,i),Cye=i=>V1(Ra.BEFORE_FRAME,i),_F=class extends Jf{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}},Rye=Hn(_F).setParameterLength(2),xF=class extends sb{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=BZ(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=Eo.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 Rye(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(Eo.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=Z7(this.value),this._varying=d0(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}},a0=(i,e=null,t=0)=>new xF(i,e,t),yF=new WeakMap,SY=new WeakMap,vF=new WeakMap;function wJ(i,e){let t,n=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=a0(e,"mat4",n).element(ru);else if(n*16*4<=i.getUniformBufferLimit())t=z1(e.array,"mat4",n).element(ru);else{let o=yF.get(e);o||(o=new Vu(e.array,16,1),yF.set(e,o));let a=e.usage===WA?K7:qC,l=[a(o,"vec4",16,0),a(o,"vec4",16,4),a(o,"vec4",16,8),a(o,"vec4",16,12)];t=o0(...l)}return t}function Pye(i,e,t){let n=vF.get(i);if(n===void 0){let r=e.clone();n={previousInstanceMatrix:r,node:wJ(t,r)},vF.set(i,n)}return n.node}var xU=qm("vec3","vInstanceColor"),SJ=Ae(([i,e=null],t)=>{let n=i.isStorageInstancedBufferAttribute===!0,r=e&&e.isStorageInstancedBufferAttribute===!0,s=wJ(t,i),o=null;n||Math.max(i.count,1)*16*4>t.getUniformBufferLimit()&&(o=yF.get(i));let a=null,l=null;if(e)if(r)a=a0(e,"vec3",Math.max(e.count,1)).element(ru);else{let u=SY.get(e);u||(u=new ml(e.array,3),SY.set(e,u)),l=u;let f=e.usage===WA?K7:qC;a=pe(f(u,"vec3",3,0))}(o!==null||l!==null)&&bJ(()=>{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(fr).xyz;if(fr.assign(c),t.needsPreviousData()){let u=t.object;wb(({object:p})=>{vF.get(p).previousInstanceMatrix.array.set(i.array)});let f=Pye(u,i,t);Om.assign(f.mul(Om).xyz)}if(t.hasGeometryAttribute("normal")){let u=lU(ta,s);ta.assign(u)}a!==null&&xU.assign(a)},"void"),TJ=Ae(([i])=>{let{instanceMatrix:e,instanceColor:t}=i;SJ(e,t)},"void"),Iye=Ae(([i,e])=>{let t=fe(Dm(es(i),0).x).toConst(),n=fe(e),r=n.mod(t).toConst(),s=n.div(t).toConst();return es(i,wr(r,s))}),Nye=Ae(([i,e])=>{let t=fe(Dm(es(i),0).x).toConst(),n=fe(e).mod(t).toConst(),r=fe(e).div(t).toConst();return es(i,wr(n,r)).x}),yU=qm("vec4","vBatchColor"),EJ=Ae(([i],e)=>{let t=e.getDrawIndex()===null?ru:hQ,n=Nye(i._indirectTexture,fe(t)),r=i._matricesTexture,s=fe(Dm(es(r),0).x).toConst(),o=se(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),c=o0(es(r,wr(a,l)),es(r,wr(a.add(1),l)),es(r,wr(a.add(2),l)),es(r,wr(a.add(3),l))),u=i._colorsTexture;if(u!==null){let v=Iye(u,n);yU.assign(v)}let f=so(c);fr.assign(c.mul(fr));let p=ta.div(pe(f[0].dot(f[0]),f[1].dot(f[1]),f[2].dot(f[2]))),x=f.mul(p).xyz;ta.assign(x),e.hasGeometryAttribute("tangent")&&u0.mulAssign(f)},"void"),DM=new WeakMap,FM=new WeakMap;function vU(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=fs(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 MJ(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=fs(o.x.mul(a),o.y.mul(l),o.z.mul(c),o.w.mul(u));f=r.mul(f).mul(n);let p=f.transformDirection(e).xyz,x=f.transformDirection(t).xyz;return{skinNormal:p,skinTangent:x}}function CJ(i,e,t,n,r){let s=i.skeleton,o=FM.get(s);if(o===void 0){s.update();let a=new Float32Array(s.boneMatrices);o={previousBoneMatrices:a,node:z1(a,"mat4",s.bones.length)},FM.set(s,o)}return vU(o.node,Om,e,t,n,r)}var RJ=Ae(([i],e)=>{let t=Nl("skinIndex","uvec4"),n=Nl("skinWeight","vec4"),r=nr("bindMatrix","mat4"),s=nr("bindMatrixInverse","mat4"),o=FQ("skeleton.boneMatrices","mat4",i.skeleton.bones.length);if(wb(({object:l,frameId:c})=>{let u=l.skeleton;if(DM.get(u)!==c){DM.set(u,c);let f=FM.get(u);f!==void 0&&f.previousBoneMatrices.set(u.boneMatrices),u.update()}}),e.needsPreviousData()){let l=CJ(i,r,s,t,n);Om.assign(l)}let a=vU(o,fr,r,s,t,n);if(fr.assign(a),e.hasGeometryAttribute("normal")){let{skinNormal:l,skinTangent:c}=MJ(o,ta,u0,r,s,t,n);ta.assign(l),e.hasGeometryAttribute("tangent")&&u0.assign(c)}},"void"),Lye=Ae(([i,e=null],t)=>{let n=a0(new ml(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(ru).toVar(),r=a0(new ml(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(ru).toVar(),s=a0(new ml(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(ru).toVar(),o=Ht(i.bindMatrix,"mat4"),a=Ht(i.bindMatrixInverse,"mat4"),l=z1(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),c=i.skeleton;if(wb(({frameId:f})=>{if(DM.get(c)!==f){DM.set(c,f);let p=FM.get(c);p!==void 0&&p.previousBoneMatrices.set(c.boneMatrices),c.update()}}),t.needsPreviousData()){let f=CJ(i,o,a,r,s);Om.assign(f)}let u=vU(l,n,o,a,r,s);if(e!==null&&e.assign(u),t.hasGeometryAttribute("normal")){let{skinNormal:f,skinTangent:p}=MJ(l,ta,u0,o,a,r,s);ta.assign(f),t.hasGeometryAttribute("tangent")&&u0.assign(p)}return u}),bF=class extends $t{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]=Il(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=Ae(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,p=null,x=null,v=null,w=null;l.isNode?l.getNodeType(e)==="bool"?(c=!0,x="bool",f=l.build(e,x)):(x="int",p=this.getVarName(o),u="0",f=l.build(e,x),v="<"):(x=l.type||"int",p=l.name||this.getVarName(o),u=l.start,f=l.end,v=l.condition,w=l.update,typeof u=="number"?u=e.generateConst(x,u):u&&u.isNode&&(u=u.build(e,x)),typeof f=="number"?f=e.generateConst(x,f):f&&f.isNode&&(f=f.build(e,x)),u!==void 0&&f===void 0?(u=u+" - 1",f="0",v=">="):f!==void 0&&u===void 0&&(u="0",v="<"),v===void 0&&(Number(u)>Number(f)?v=">=":v="<"));let S;if(c)S=`while ( ${f} )`;else{let T={start:u,end:f},P=T.start,R=T.end,C,L=()=>v.includes("<")?"+=":"-=";if(w!=null)switch(typeof w){case"function":C=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":C=p+" "+L()+" "+e.generateConst(x,w);break;case"string":C=p+" "+w;break;default:w.isNode?C=p+" "+L()+" "+w.build(e):(Ge("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),C="break /* invalid update */")}else x==="int"||x==="uint"?w=v.includes("<")?"++":"--":w=L()+" 1.",C=p+" "+w;let D=e.getVar(x,p)+" = "+P,F=p+" "+v+" "+R;S=`for ( ${D}; ${F}; ${C} )`}e.addFlowCode((o===0?`4151+`,vA(o)}return n}},yQ=(i,e=null)=>new sF(Vt(i),e).toStack();Be("debug",yQ);var IM=class extends zo{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(){}},oF=class extends $t{static get type(){return"InspectorNode"}constructor(e,t="",n=null){super(),this.node=e,this.name=t,this.callback=n,this.updateType=_n.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!==IM&&Kn('TSL: ".toInspector()" is only available with WebGPU.'),t}};function vQ(i,e="",t=null){return i=Vt(i),i.before(new oF(i,e,t))}Be("toInspector",vQ);function Vxe(i){je("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}var NM=class extends $t{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):p0(this).build(e,n)}else return je(`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}},Ll=(i,e=null)=>new NM(i,e),Pi=(i=0)=>Ll("uv"+(i>0?i:""),"vec2"),aF=class extends $t{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)}},Om=Hn(aF).setParameterLength(1,2),lF=class extends Dm{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=_n.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))}}},cU=Hn(lF).setParameterLength(1),LM=class extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}},uU=new Ts,yc=class extends Dm{static get type(){return"TextureNode"}constructor(e=uU,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=_n.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===Ai?"uvec4":this.value.type===Dr?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Pi(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=Ht(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=Ht(!1)),t=t.toVar(),this.sampler?t=this._flipYUniform.select(t.flipY(),t):t=this._flipYUniform.select(t.setY(fe(Om(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 LM("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);let r=Ae(()=>{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?_n.OBJECT:_n.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(Gf.TEXTURE_COMPARE))o=this.compareNode;else{let l=n.compareFunction;l===null||l===I_||l===sh||l===jA||l===Xc?a=this.compareNode:(o=this.compareNode,Kn('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 p=this.value,x;return s?x=e.generateTextureBias(p,t,n,s,o,u):l?x=e.generateTextureGrad(p,t,n,l,o,u):c?a?x=e.generateTextureGatherCompare(p,t,n,a,o,u,f):x=e.generateTextureGather(p,t,n,c,o,u,f):a?x=e.generateTextureCompare(p,t,n,a,o,u):this.sampler===!1?x=e.generateTextureLoad(p,t,n,r,o,u):r?x=e.generateTextureLevel(p,t,n,r,o,u):x=e.generateTexture(p,t,n,o,u),x}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:p,compareNode:x,compareStepNode:v,depthNode:w,gradNode:S,gatherNode:T,offsetNode:P}=r,R=this.generateUV(e,u),C=f?f.build(e,"float"):null,L=p?p.build(e,"float"):null,D=w?w.build(e,"int"):null,F=x?x.build(e,"float"):null,N=v?v.build(e,"float"):null,B=S?[S[0].build(e,"vec2"),S[1].build(e,"vec2")]:null,z=T?T.build(e,"int"):null,V=P?this.generateOffset(e,P):null,H=this._flipYUniform?this._flipYUniform.build(e,"bool"):null;z&&(a="vec4");let Z=D;Z===null&&n.isArrayTexture&&this.isTexture3DNode!==!0&&(Z="0");let J=e.getVarFromNode(this);l=e.getPropertyName(J);let j=this.generateSnippet(e,s,R,C,L,Z,F,B,z,V,H);if(N!==null){let K=n.compareFunction;K===jA||K===Xc?j=Fm(Nl(j,a),Nl(N,"float")).build(e,a):j=Fm(Nl(N,"float"),Nl(j,a)).build(e,a)}e.addLineFlowCode(`${l} = ${j}`,this),o.snippet=j,o.propertyName=l}let c=l;return e.needsToWorkingColorSpace(n)&&(c=qC(Nl(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=Vt(e),t.referenceNode=this.getBase(),Vt(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){let t=this.clone();t.biasNode=Vt(e).mul(cU(t)),t.referenceNode=this.getBase();let n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===yi||n.magFilter===yi)&&(je("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),Vt(t)}level(e){let t=this.clone();return t.levelNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}size(e){return Om(this,e)}bias(e){let t=this.clone();return t.biasNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){let t=this.clone();return t.compareNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}grad(e,t){let n=this.clone();return n.gradNode=[Vt(e),Vt(t)],n.referenceNode=this.getBase(),Vt(n)}gather(e=0){let t=this.clone();return t.gatherNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}depth(e){let t=this.clone();return t.depthNode=Vt(e),t.referenceNode=this.getBase(),Vt(t)}offset(e){let t=this.clone();return t.offsetNode=Vt(e),t.referenceNode=this.getBase(),Vt(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}},qxe=Hn(yc).setParameterLength(1,4).setName("texture"),li=(i=uU,e=null,t=null,n=null)=>{let r;return i&&i.isTextureNode===!0?(r=Vt(i.clone()),r.referenceNode=i.getBase(),e!==null&&(r.uvNode=Vt(e)),t!==null&&(r.levelNode=Vt(t)),n!==null&&(r.biasNode=Vt(n))):r=qxe(i,e,t,n),r},Hxe=(i=uU)=>li(i),es=(...i)=>li(...i).setSampler(!1),Wxe=(i,e,t)=>li(i,e).level(t),jxe=i=>(i.isNode===!0?i:li(i)).convert("sampler"),Xxe=i=>(i.isNode===!0?i:li(i)).convert("samplerComparison"),ab=class extends Dm{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"}},V1=(i,e,t)=>new ab(i,e,t),cF=class extends ed{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)}},uF=class extends ab{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?s0(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=_n.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 cF(this,Vt(e))}},To=(i,e)=>new uF(i,e),hF=class extends $t{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},sd=Hn(hF).setParameterLength(1),Mv,Cv,Mo=class i extends $t{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=_n.NONE;return(this.scope===i.SIZE||this.scope===i.VIEWPORT||this.scope===i.DPR)&&(e=_n.RENDER),this.updateType=e,e}update({renderer:e}){let t=e.getRenderTarget();this.scope===i.VIEWPORT?t!==null?Cv.copy(t.viewport):(e.getViewport(Cv),Cv.multiplyScalar(e.getPixelRatio())):this.scope===i.DPR?this._output.value=e.getPixelRatio():t!==null?(Mv.width=t.width,Mv.height=t.height):e.getDrawingBufferSize(Mv)}setup(){let e=this.scope,t=null;return e===i.SIZE?t=Ht(Mv||(Mv=new Oe)):e===i.VIEWPORT?t=Ht(Cv||(Cv=new gn)):e===i.DPR?t=Ht(1):t=ft(jm.div(Bm)),this._output=t,t}generate(e){if(this.scope===i.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let n=e.getNodeProperties(Bm).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}};Mo.COORDINATE="coordinate";Mo.VIEWPORT="viewport";Mo.SIZE="size";Mo.UV="uv";Mo.DPR="dpr";var hU=xt(Mo,Mo.DPR),ru=xt(Mo,Mo.UV),Bm=xt(Mo,Mo.SIZE),jm=xt(Mo,Mo.COORDINATE),P1=xt(Mo,Mo.VIEWPORT),fU=P1.zw,bQ=jm.sub(P1.xy),$xe=bQ.div(fU),Yxe=Ae(()=>(je('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new Ur),Bm),"vec2").once()(),Q6=null,PE=null,J6=null,IE=null,e8=null,NE=null,t8=null,LE=null,n8=null,DE=null,i8=null,FE=null,r8=null,OE=null,A0=Ht(0,"uint").setName("u_cameraIndex").setGroup(BC("cameraIndex")).toVarying("v_cameraIndex"),t0=Ht("float").setName("cameraNear").setGroup(Zt).onRenderUpdate(({camera:i})=>i.near),n0=Ht("float").setName("cameraFar").setGroup(Zt).onRenderUpdate(({camera:i})=>i.far),Ma=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrix);PE===null?PE=To(t).setGroup(Zt).setName("cameraProjectionMatrices"):PE.array=t,e=PE.element(i.isMultiViewCamera?sd("gl_ViewID_OVR"):A0)}else Q6===null&&(Q6=Ht(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=Q6;return e}).once()(),wQ=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrixInverse);IE===null?IE=To(t).setGroup(Zt).setName("cameraProjectionMatricesInverse"):IE.array=t,e=IE.element(i.isMultiViewCamera?sd("gl_ViewID_OVR"):A0)}else J6===null&&(J6=Ht(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Zt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=J6;return e}).once()(),m0=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorldInverse);NE===null?NE=To(t).setGroup(Zt).setName("cameraViewMatrices"):NE.array=t,e=NE.element(i.isMultiViewCamera?sd("gl_ViewID_OVR"):A0)}else e8===null&&(e8=Ht(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=e8;return e}).once()(),Sb=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorld);LE===null?LE=To(t).setGroup(Zt).setName("cameraWorldMatrices"):LE.array=t,e=LE.element(i.isMultiViewCamera?sd("gl_ViewID_OVR"):A0)}else t8===null&&(t8=Ht(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=t8;return e}).once()(),Zxe=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.normalMatrix);DE===null?DE=To(t).setGroup(Zt).setName("cameraNormalMatrices"):DE.array=t,e=DE.element(i.isMultiViewCamera?sd("gl_ViewID_OVR"):A0)}else n8===null&&(n8=Ht(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=n8;return e}).once()(),SQ=Ae(({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 ie);FE===null?FE=To(t).setGroup(Zt).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)}):FE.array=t,e=FE.element(i.isMultiViewCamera?sd("gl_ViewID_OVR"):A0)}else i8===null&&(i8=Ht(new ie).setName("cameraPosition").setGroup(Zt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld))),e=i8;return e}).once()(),Kxe=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.viewport);OE===null?OE=To(t,"vec4").setGroup(Zt).setName("cameraViewports"):OE.array=t,e=OE.element(A0)}else r8===null&&(r8=Lt(0,0,Bm.x,Bm.y).toConst("cameraViewport")),e=r8;return e}).once()(),wY=new Wa,ds=class i extends $t{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=_n.OBJECT,this.uniformNode=new Dm(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 ie,n.value.setFromMatrixPosition(t.matrixWorld);else if(r===i.SCALE)n.value=n.value||new ie,n.value.setFromMatrixScale(t.matrixWorld);else if(r===i.DIRECTION)n.value=n.value||new ie,t.getWorldDirection(n.value);else if(r===i.VIEW_POSITION){let s=e.camera;n.value=n.value||new ie,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(),wY.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=wY.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 Qxe=Hn(ds,ds.DIRECTION).setParameterLength(1),Jxe=Hn(ds,ds.WORLD_MATRIX).setParameterLength(1),eye=Hn(ds,ds.POSITION).setParameterLength(1),tye=Hn(ds,ds.SCALE).setParameterLength(1),nye=Hn(ds,ds.VIEW_POSITION).setParameterLength(1),iye=Hn(ds,ds.RADIUS).setParameterLength(1),tl=class extends ds{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},rye=xt(tl,tl.DIRECTION),mc=xt(tl,tl.WORLD_MATRIX),sye=xt(tl,tl.POSITION),oye=xt(tl,tl.SCALE),aye=xt(tl,tl.VIEW_POSITION),lye=xt(tl,tl.RADIUS),TQ=Ht(new Sn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),cye=Ht(new on).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),Lh=Ae(i=>i.context.modelViewMatrix||EQ).once()().toVar("modelViewMatrix"),EQ=m0.mul(mc),fF=Ae(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Ht("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),dF=Ae(i=>{let e=i.context.isHighPrecisionModelViewMatrix;return Ht("mat3").onObjectUpdate(({object:t,camera:n})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),MQ=Ae(i=>i.shaderStage!=="fragment"?(Kn("TSL: `clipSpace` is only available in fragment stage."),Lt()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),Zo=Ll("position","vec3"),fr=Zo.toVarying("positionLocal"),Um=Zo.toVarying("positionPrevious"),Ph=Ae(i=>mc.mul(fr).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),dU=Ae(()=>fr.transformDirection(mc).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),ts=Ae(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){let e=wQ.mul(MQ);return e.xyz.div(e.w).toVar("positionView")}return i.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),Vi=Ae(i=>{let e;return i.camera.isOrthographicCamera?e=pe(0,0,1):e=ts.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])(),pF=class extends $t{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===hi?"false":e.getFrontFacing()}},CQ=xt(pF),pU=se(CQ).mul(2).sub(1),Xm=Ae(([i],{material:e})=>{let t=e.side;return t===hi?i=i.mul(-1):t===rr&&(i=i.mul(pU)),i}),uye=i=>(Kn('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),Xm(i)),jC=Ll("normal","vec3"),ta=Ae(i=>i.geometry.hasAttribute("normal")===!1?(je('TSL: Vertex attribute "normal" not found on geometry.'),pe(0,1,0)):jC,"vec3").once()().toVar("normalLocal"),RQ=ts.dFdx().cross(ts.dFdy()).normalize().toVar("normalFlat"),L1=Ae(i=>{let e;return i.isFlatShading()?e=RQ:e=mU(ta).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),PQ=Ae(i=>{let e=L1.transformNormalByInverseViewMatrix(m0);return i.isFlatShading()!==!0&&(e=e.toVarying("v_normalWorldGeometry")),e.normalize().toVar("normalWorldGeometry")},"vec3").once()(),ai=Ae(i=>{let e;return i.subBuildFn==="NORMAL"||i.subBuildFn==="VERTEX"?(e=L1,i.isFlatShading()!==!0&&(e=Xm(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),g0=ai.transformNormalByInverseViewMatrix(m0).toVar("normalWorld"),i0=Ae(({subBuildFn:i,context:e})=>{let t;return i==="NORMAL"||i==="VERTEX"?t=ai:t=e.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),AU=Ae(([i,e=mc])=>so(e).inverse().transpose().mul(i).normalize());Be("transformNormal",AU);var mU=Ae(([i],e)=>{let t=e.context.modelNormalViewMatrix;return t?i.transformNormalByViewMatrix(t):TQ.mul(i).transformNormalByViewMatrix(m0)}),hye=Ae(()=>(je('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),ai)).once(["NORMAL","VERTEX"])(),fye=Ae(()=>(je('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),g0)).once(["NORMAL","VERTEX"])(),dye=Ae(()=>(je('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),i0)).once(["NORMAL","VERTEX"])(),s8=new on,IQ=Ht(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),pM=Ht(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),DM=Ht(new on).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?s8.makeRotationFromEuler(n).transpose():s8.identity(),s8}),NQ=Vi.negate().reflect(ai),LQ=Vi.negate().refract(ai,IQ),DQ=NQ.transformDirection(Sb).toVar("reflectVector"),FQ=LQ.transformDirection(Sb).toVar("refractVector"),OQ=new Vu,AF=class extends yc{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===vl?DQ:e.mapping===ic?FQ:(Ge('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===Ha?pe(t.x,t.y.negate(),t.z):t:(t=DM.mul(t),(e.renderer.coordinateSystem===Ha||!n.isRenderTargetTexture)&&(t=pe(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}},gU=Hn(AF).setParameterLength(1,4).setName("cubeTexture"),Ea=(i=OQ,e=null,t=null,n=null)=>{let r;return i&&i.isCubeTextureNode===!0?(r=Vt(i.clone()),r.referenceNode=i,e!==null&&(r.uvNode=Vt(e)),t!==null&&(r.levelNode=Vt(t)),n!==null&&(r.biasNode=Vt(n))):r=gU(i,e,t,n),r},pye=(i=OQ)=>gU(i),mF=class extends ed{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)}},D1=class extends $t{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=_n.OBJECT}element(e){return new mF(this,Vt(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;this.count!==null?t=V1(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=To(null,e),t.updateType=_n.OBJECT):e==="texture"?t=li(null):e==="cubeTexture"?t=Ea(null):t=Ht(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}},nr=(i,e,t)=>new D1(i,e,t),BQ=(i,e,t,n)=>new D1(i,e,n,t),gF=class extends D1{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}},Kf=(i,e,t=null)=>new gF(i,e,t),UQ=Pi(),Aye=ts.dFdx(),mye=ts.dFdy(),kQ=UQ.dFdx(),GQ=UQ.dFdy(),zQ=ai,VQ=mye.cross(zQ),qQ=zQ.cross(Aye),_F=VQ.mul(kQ.x).add(qQ.mul(GQ.x)),xF=VQ.mul(kQ.y).add(qQ.mul(GQ.y)),SY=_F.dot(_F).max(xF.dot(xF)),HQ=SY.equal(0).select(0,SY.inverseSqrt()),gye=_F.mul(HQ).toVar("tangentViewFrame"),_ye=xF.mul(HQ).toVar("bitangentViewFrame"),XC=Ll("tangent","vec4"),h0=XC.xyz.toVar("tangentLocal"),$C=Ae(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=Lh.mul(Lt(h0,0)).xyz.toVarying("v_tangentView").normalize():e=gye,i.isFlatShading()!==!0&&(e=Xm(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),WQ=$C.transformDirection(Sb).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),YC=Ae(([i,e],t)=>{let n=i.mul(XC.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),xye=YC(jC.cross(XC),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),yye=YC(ta.cross(h0),"v_bitangentLocal").normalize().toVar("bitangentLocal"),jQ=Ae(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=YC(ai.cross($C),"v_bitangentView").normalize():e=_ye,i.isFlatShading()!==!0&&(e=Xm(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),vye=YC(g0.cross(WQ),"v_bitangentWorld").normalize().toVar("bitangentWorld"),Tm=so($C,jQ,ai).toVar("TBNViewMatrix"),XQ=Vi.mul(Tm),bye=(i,e)=>i.sub(XQ.mul(e)),$Q=Ae(()=>{let i=Cm.cross(Vi);return i=i.cross(Cm).normalize(),i=Xn(i,ai,Jp.mul(Th.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),_U=i=>Vt(i).mul(.5).add(.5),YQ=i=>Vt(i).mul(2).sub(1),yF=i=>pe(i,Ca(VC(se(1).sub(xc(i,i))))),wye=i=>(Kn('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),_U(i)),Sye=i=>(Kn('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),YQ(i)),vF=class extends pr{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=bl,this.unpackNormalMode=w2}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,s=this.node.mul(2).sub(1);if(t===bl?r===i3?s=yF(s.xy):r===pL?s=yF(s.yw):r!==w2&&Ge(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==w2&&Ge(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${r}'`),n!==null){let a=n;e.isFlatShading()===!0&&(a=Xm(a)),s=pe(s.xy.mul(a),s.z)}let o=null;return t===n3?o=mU(s):t===bl?o=Tm.mul(s).normalize():(Ge(`NodeMaterial: Unsupported normal map type: ${t}`),o=ai),o}},bF=Hn(vF).setParameterLength(1,2),Tye=Ae(({textureNode:i,bumpScale:e})=>{let t=r=>i.isolate().context({getUV:s=>r(s.uvNode||Pi()),forceUVContext:!0}),n=se(t(r=>r));return ft(se(t(r=>r.add(r.dFdx()))).sub(n),se(t(r=>r.add(r.dFdy()))).sub(n)).mul(e)}),Eye=Ae(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(pU),u=c.sign().mul(n.x.mul(a).add(n.y.mul(l)));return c.abs().mul(t).sub(u).normalize()}),wF=class extends pr{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 ai;let t=this.scaleNode!==null?this.scaleNode:1,n=Tye({textureNode:this.textureNode,bumpScale:t});return Eye({surf_pos:ts,surf_norm:ai,dHdxy:n})}},xU=Hn(wF).setParameterLength(1,2),TY=new Map,ot=class i extends $t{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=TY.get(e);return n===void 0&&(n=Kf(e,t),TY.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=se(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=bF(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==Ms||t.normalMap.format==rh||t.normalMap.format==ih)&&(r.unpackNormalMode=i3)):t.bumpMap?r=xU(this.getTexture("bump").r,this.getFloat("bumpScale")):r=ai;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=bF(this.getTexture(n),this.getCache(n+"Scale","vec2")):r=ai;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=FC(v1.x,v1.y,v1.y.negate(),v1.x).mul(s.rg.mul(2).sub(ft(1)).normalize().mul(s.b))}else r=v1;else if(n===i.IRIDESCENCE_THICKNESS){let s=nr("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){let o=nr("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=se(1);else if(n===i.LINE_DASH_OFFSET)r=t.dashOffset?this.getFloat(n):se(0);else{let s=this.getNodeType(e);r=this.getCache(n,s)}return r}};ot.ALPHA_TEST="alphaTest";ot.COLOR="color";ot.OPACITY="opacity";ot.SHININESS="shininess";ot.SPECULAR="specular";ot.SPECULAR_STRENGTH="specularStrength";ot.SPECULAR_INTENSITY="specularIntensity";ot.SPECULAR_COLOR="specularColor";ot.REFLECTIVITY="reflectivity";ot.ROUGHNESS="roughness";ot.METALNESS="metalness";ot.NORMAL="normal";ot.CLEARCOAT="clearcoat";ot.CLEARCOAT_ROUGHNESS="clearcoatRoughness";ot.CLEARCOAT_NORMAL="clearcoatNormal";ot.EMISSIVE="emissive";ot.ROTATION="rotation";ot.SHEEN="sheen";ot.SHEEN_ROUGHNESS="sheenRoughness";ot.ANISOTROPY="anisotropy";ot.IRIDESCENCE="iridescence";ot.IRIDESCENCE_IOR="iridescenceIOR";ot.IRIDESCENCE_THICKNESS="iridescenceThickness";ot.IOR="ior";ot.TRANSMISSION="transmission";ot.THICKNESS="thickness";ot.ATTENUATION_DISTANCE="attenuationDistance";ot.ATTENUATION_COLOR="attenuationColor";ot.LINE_SCALE="scale";ot.LINE_DASH_SIZE="dashSize";ot.LINE_GAP_SIZE="gapSize";ot.LINE_WIDTH="linewidth";ot.LINE_DASH_OFFSET="dashOffset";ot.POINT_SIZE="size";ot.DISPERSION="dispersion";ot.LIGHT_MAP="light";ot.AO="ao";var ZQ=xt(ot,ot.ALPHA_TEST),KQ=xt(ot,ot.COLOR),QQ=xt(ot,ot.SHININESS),JQ=xt(ot,ot.EMISSIVE),yU=xt(ot,ot.OPACITY),eJ=xt(ot,ot.SPECULAR),SF=xt(ot,ot.SPECULAR_INTENSITY),tJ=xt(ot,ot.SPECULAR_COLOR),Kv=xt(ot,ot.SPECULAR_STRENGTH),AM=xt(ot,ot.REFLECTIVITY),nJ=xt(ot,ot.ROUGHNESS),iJ=xt(ot,ot.METALNESS),rJ=xt(ot,ot.NORMAL),sJ=xt(ot,ot.CLEARCOAT),oJ=xt(ot,ot.CLEARCOAT_ROUGHNESS),aJ=xt(ot,ot.CLEARCOAT_NORMAL),lJ=xt(ot,ot.ROTATION),cJ=xt(ot,ot.SHEEN),uJ=xt(ot,ot.SHEEN_ROUGHNESS),hJ=xt(ot,ot.ANISOTROPY),fJ=xt(ot,ot.IRIDESCENCE),dJ=xt(ot,ot.IRIDESCENCE_IOR),pJ=xt(ot,ot.IRIDESCENCE_THICKNESS),AJ=xt(ot,ot.TRANSMISSION),mJ=xt(ot,ot.THICKNESS),gJ=xt(ot,ot.IOR),_J=xt(ot,ot.ATTENUATION_DISTANCE),xJ=xt(ot,ot.ATTENUATION_COLOR),vU=xt(ot,ot.LINE_SCALE),bU=xt(ot,ot.LINE_DASH_SIZE),wU=xt(ot,ot.LINE_GAP_SIZE),FM=xt(ot,ot.LINE_WIDTH),SU=xt(ot,ot.LINE_DASH_OFFSET),yJ=xt(ot,ot.POINT_SIZE),vJ=xt(ot,ot.DISPERSION),TU=xt(ot,ot.LIGHT_MAP),bJ=xt(ot,ot.AO),v1=Ht(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))}),wJ=Ae(i=>i.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection"),Ra=class i extends $t{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===i.OBJECT?this.updateType=_n.OBJECT:e===i.MATERIAL?this.updateType=_n.RENDER:e===i.FRAME?this.updateType=_n.FRAME:e===i.BEFORE_OBJECT?this.updateBeforeType=_n.OBJECT:e===i.BEFORE_MATERIAL?this.updateBeforeType=_n.RENDER:e===i.BEFORE_FRAME&&(this.updateBeforeType=_n.FRAME)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}};Ra.OBJECT="object";Ra.MATERIAL="material";Ra.FRAME="frame";Ra.BEFORE_OBJECT="beforeObject";Ra.BEFORE_MATERIAL="beforeMaterial";Ra.BEFORE_FRAME="beforeFrame";var q1=(i,e)=>new Ra(i,e).toStack(),Tb=i=>q1(Ra.OBJECT,i),Mye=i=>q1(Ra.MATERIAL,i),SJ=i=>q1(Ra.FRAME,i),Cye=i=>q1(Ra.BEFORE_OBJECT,i),Rye=i=>q1(Ra.BEFORE_MATERIAL,i),Pye=i=>q1(Ra.BEFORE_FRAME,i),TF=class extends ed{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}},Iye=Hn(TF).setParameterLength(2),EF=class extends ab{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=kZ(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=Eo.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 Iye(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(Eo.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=iU(this.value),this._varying=p0(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}},l0=(i,e=null,t=0)=>new EF(i,e,t),MF=new WeakMap,EY=new WeakMap,CF=new WeakMap;function TJ(i,e){let t,n=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=l0(e,"mat4",n).element(su);else if(n*16*4<=i.getUniformBufferLimit())t=V1(e.array,"mat4",n).element(su);else{let o=MF.get(e);o||(o=new Hu(e.array,16,1),MF.set(e,o));let a=e.usage===XA?rU:WC,l=[a(o,"vec4",16,0),a(o,"vec4",16,4),a(o,"vec4",16,8),a(o,"vec4",16,12)];t=a0(...l)}return t}function Nye(i,e,t){let n=CF.get(i);if(n===void 0){let r=e.clone();n={previousInstanceMatrix:r,node:TJ(t,r)},CF.set(i,n)}return n.node}var EU=Wm("vec3","vInstanceColor"),EJ=Ae(([i,e=null],t)=>{let n=i.isStorageInstancedBufferAttribute===!0,r=e&&e.isStorageInstancedBufferAttribute===!0,s=TJ(t,i),o=null;n||Math.max(i.count,1)*16*4>t.getUniformBufferLimit()&&(o=MF.get(i));let a=null,l=null;if(e)if(r)a=l0(e,"vec3",Math.max(e.count,1)).element(su);else{let u=EY.get(e);u||(u=new _l(e.array,3),EY.set(e,u)),l=u;let f=e.usage===XA?rU:WC;a=pe(f(u,"vec3",3,0))}(o!==null||l!==null)&&SJ(()=>{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(fr).xyz;if(fr.assign(c),t.needsPreviousData()){let u=t.object;Tb(({object:p})=>{CF.get(p).previousInstanceMatrix.array.set(i.array)});let f=Nye(u,i,t);Um.assign(f.mul(Um).xyz)}if(t.hasGeometryAttribute("normal")){let u=AU(ta,s);ta.assign(u)}a!==null&&EU.assign(a)},"void"),MJ=Ae(([i])=>{let{instanceMatrix:e,instanceColor:t}=i;EJ(e,t)},"void"),Lye=Ae(([i,e])=>{let t=fe(Om(es(i),0).x).toConst(),n=fe(e),r=n.mod(t).toConst(),s=n.div(t).toConst();return es(i,Sr(r,s))}),Dye=Ae(([i,e])=>{let t=fe(Om(es(i),0).x).toConst(),n=fe(e).mod(t).toConst(),r=fe(e).div(t).toConst();return es(i,Sr(n,r)).x}),MU=Wm("vec4","vBatchColor"),CJ=Ae(([i],e)=>{let t=e.getDrawIndex()===null?su:dQ,n=Dye(i._indirectTexture,fe(t)),r=i._matricesTexture,s=fe(Om(es(r),0).x).toConst(),o=se(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),c=a0(es(r,Sr(a,l)),es(r,Sr(a.add(1),l)),es(r,Sr(a.add(2),l)),es(r,Sr(a.add(3),l))),u=i._colorsTexture;if(u!==null){let v=Lye(u,n);MU.assign(v)}let f=so(c);fr.assign(c.mul(fr));let p=ta.div(pe(f[0].dot(f[0]),f[1].dot(f[1]),f[2].dot(f[2]))),x=f.mul(p).xyz;ta.assign(x),e.hasGeometryAttribute("tangent")&&h0.mulAssign(f)},"void"),OM=new WeakMap,BM=new WeakMap;function CU(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=fs(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 RJ(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=fs(o.x.mul(a),o.y.mul(l),o.z.mul(c),o.w.mul(u));f=r.mul(f).mul(n);let p=f.transformDirection(e).xyz,x=f.transformDirection(t).xyz;return{skinNormal:p,skinTangent:x}}function PJ(i,e,t,n,r){let s=i.skeleton,o=BM.get(s);if(o===void 0){s.update();let a=new Float32Array(s.boneMatrices);o={previousBoneMatrices:a,node:V1(a,"mat4",s.bones.length)},BM.set(s,o)}return CU(o.node,Um,e,t,n,r)}var IJ=Ae(([i],e)=>{let t=Ll("skinIndex","uvec4"),n=Ll("skinWeight","vec4"),r=nr("bindMatrix","mat4"),s=nr("bindMatrixInverse","mat4"),o=BQ("skeleton.boneMatrices","mat4",i.skeleton.bones.length);if(Tb(({object:l,frameId:c})=>{let u=l.skeleton;if(OM.get(u)!==c){OM.set(u,c);let f=BM.get(u);f!==void 0&&f.previousBoneMatrices.set(u.boneMatrices),u.update()}}),e.needsPreviousData()){let l=PJ(i,r,s,t,n);Um.assign(l)}let a=CU(o,fr,r,s,t,n);if(fr.assign(a),e.hasGeometryAttribute("normal")){let{skinNormal:l,skinTangent:c}=RJ(o,ta,h0,r,s,t,n);ta.assign(l),e.hasGeometryAttribute("tangent")&&h0.assign(c)}},"void"),Fye=Ae(([i,e=null],t)=>{let n=l0(new _l(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(su).toVar(),r=l0(new _l(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(su).toVar(),s=l0(new _l(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(su).toVar(),o=Ht(i.bindMatrix,"mat4"),a=Ht(i.bindMatrixInverse,"mat4"),l=V1(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),c=i.skeleton;if(Tb(({frameId:f})=>{if(OM.get(c)!==f){OM.set(c,f);let p=BM.get(c);p!==void 0&&p.previousBoneMatrices.set(c.boneMatrices),c.update()}}),t.needsPreviousData()){let f=PJ(i,o,a,r,s);Um.assign(f)}let u=CU(l,n,o,a,r,s);if(e!==null&&e.assign(u),t.hasGeometryAttribute("normal")){let{skinNormal:f,skinTangent:p}=RJ(l,ta,h0,o,a,r,s);ta.assign(f),t.hasGeometryAttribute("tangent")&&h0.assign(p)}return u}),RF=class extends $t{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]=Nl(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=Ae(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,p=null,x=null,v=null,w=null;l.isNode?l.getNodeType(e)==="bool"?(c=!0,x="bool",f=l.build(e,x)):(x="int",p=this.getVarName(o),u="0",f=l.build(e,x),v="<"):(x=l.type||"int",p=l.name||this.getVarName(o),u=l.start,f=l.end,v=l.condition,w=l.update,typeof u=="number"?u=e.generateConst(x,u):u&&u.isNode&&(u=u.build(e,x)),typeof f=="number"?f=e.generateConst(x,f):f&&f.isNode&&(f=f.build(e,x)),u!==void 0&&f===void 0?(u=u+" - 1",f="0",v=">="):f!==void 0&&u===void 0&&(u="0",v="<"),v===void 0&&(Number(u)>Number(f)?v=">=":v="<"));let S;if(c)S=`while ( ${f} )`;else{let T={start:u,end:f},P=T.start,R=T.end,C,L=()=>v.includes("<")?"+=":"-=";if(w!=null)switch(typeof w){case"function":C=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;case"number":C=p+" "+L()+" "+e.generateConst(x,w);break;case"string":C=p+" "+w;break;default:w.isNode?C=p+" "+L()+" "+w.build(e):(Ge("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),C="break /* invalid update */")}else x==="int"||x==="uint"?w=v.includes("<")?"++":"--":w=L()+" 1.",C=p+" "+w;let D=e.getVar(x,p)+" = "+P,F=p+" "+v+" "+R;S=`for ( ${D}; ${F}; ${C} )`}e.addFlowCode((o===0?`41524152 `:"")+e.tab+S+` {41534153 41544154 `).addFlowTab()}let s=r.build(e,"void");t.returnsNode.build(e,"void"),e.removeFlowTab().addFlowCode(`41554155 `+e.tab+s);for(let o=0,a=this.params.length-1;o<a;o++)e.addFlowCode((o===0?"":e.tab)+`}41564156 4157-`).removeFlowTab();e.addFlowTab()}},Ri=(...i)=>new bF(Tm(i,"int")).toStack(),Dye=()=>Il("continue").toStack(),PJ=()=>Il("break").toStack(),J6=new WeakMap,Tl=new gn,TY=new WeakMap,EY=Ae(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{let o=fe(uQ).mul(t).add(s),a=o.div(n),l=o.sub(a.mul(n));return es(i,wr(l,a)).depth(r).xyz.mul(e)});function Fye(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=J6.get(i);if(o===void 0||o.count!==s){let T=function(){w.dispose(),J6.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,p=1,x=4096;f>x&&(p=Math.ceil(f/x),f=x);let v=new Float32Array(f*p*4*s),w=new vA(v,f,p,s);w.type=Zi,w.needsUpdate=!0;let S=u*4;for(let P=0;P<s;P++){let R=a[P],C=l[P],L=c[P],D=f*p*4*P;for(let F=0;F<R.count;F++){let N=F*S;e===!0&&(Tl.fromBufferAttribute(R,F),v[D+N+0]=Tl.x,v[D+N+1]=Tl.y,v[D+N+2]=Tl.z,v[D+N+3]=0),t===!0&&(Tl.fromBufferAttribute(C,F),v[D+N+4]=Tl.x,v[D+N+5]=Tl.y,v[D+N+6]=Tl.z,v[D+N+7]=0),n===!0&&(Tl.fromBufferAttribute(L,F),v[D+N+8]=Tl.x,v[D+N+9]=Tl.y,v[D+N+10]=Tl.z,v[D+N+11]=L.itemSize===4?Tl.w:1)}}o={count:s,texture:w,stride:u,size:new Oe(f,p)},J6.set(i,o),i.addEventListener("dispose",T)}return o}var IJ=Ae(([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=TY.get(i);(o===void 0||o.count!==s)&&(o={base:Ht(1),influences:i.morphTargetInfluences?To(i.morphTargetInfluences,"float"):null,count:s},TY.set(i,o));let{base:a,influences:l}=o,{texture:c,stride:u,size:f}=Fye(e);t===!0&&fr.mulAssign(a),n===!0&&ta.mulAssign(a);let p=fe(f.width);Ri(s,({i:x})=>{let v=se(0).toVar();i.count>1&&i.morphTexture!==null&&i.morphTexture!==void 0?v.assign(es(i.morphTexture,wr(fe(x).add(1),fe(ru))).r):v.assign(l.element(x).toVar()),Wt(v.notEqual(0),()=>{t===!0&&fr.addAssign(EY({bufferMap:c,influence:v,stride:u,width:p,depth:x,offset:fe(0)})),n===!0&&ta.addAssign(EY({bufferMap:c,influence:v,stride:u,width:p,depth:x,offset:fe(1)}))})}),wb(({object:x})=>{let{base:v,influences:w}=o;x.geometry.morphTargetsRelative?v.value=1:v.value=1-x.morphTargetInfluences.reduce((S,T)=>S+T,0),w&&(w.array=x.morphTargetInfluences,w.update())})},"void"),h0=class extends $t{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}},wF=class extends h0{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},SF=class extends ib{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:se(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)}},NJ=Hn(SF),TF=class extends h0{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},fm=new Oe,D1=class extends xc{static get type(){return"ViewportTextureNode"}constructor(e=iu,t=null,n=null){let r=null;n===null?(r=new TA,r.minFilter=xo,n=r):r=n,super(n,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=r,this.isOutputTextureNode=!0,this.updateBeforeType=_n.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(fm):s.getDrawingBufferSize?s.getDrawingBufferSize(fm):fm.set(s.width,s.height);let o=this.getTextureForReference(s);(o.image.width!==fm.width||o.image.height!==fm.height)&&(o.image.width=fm.width,o.image.height=fm.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}},Oye=Hn(D1).setParameterLength(0,3),bU=Hn(D1,null,null,{generateMipmaps:!0}).setParameterLength(0,3),Bye=bU(),LJ=(i=iu,e=null)=>Bye.sample(i,e),e8=null,EF=class extends D1{static get type(){return"ViewportDepthTextureNode"}constructor(e=iu,t=null,n=null){n===null&&(e8===null&&(e8=new ls),n=e8),super(e,t,n)}},wU=Hn(EF).setParameterLength(0,3),au=class i extends $t{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=OJ().assign(n));else if(t===i.DEPTH)e.isPerspectiveCamera?r=SU(ts.z,e0,t0):r=Rm(ts.z,e0,t0);else if(t===i.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){let s=$C(n,e0,t0);r=Rm(s,e0,t0)}else r=n;else r=Rm(ts.z,e0,t0);return r}};au.DEPTH_BASE="depthBase";au.DEPTH="depth";au.LINEAR_DEPTH="linearDepth";var Rm=(i,e,t)=>i.add(e).div(e.sub(t)),Uye=(i,e,t)=>i.add(t).div(t.sub(e)),DJ=Ae(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?t.sub(e).mul(i).sub(t):e.sub(t).mul(i).sub(e)),SU=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),FJ=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),$C=Ae(([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))),YC=(i,e,t)=>{e=e.max(1e-6).toVar();let n=Th(i.negate().div(e)),r=Th(t.div(e));return n.div(r)},kye=(i,e,t)=>{let n=i.mul(UC(t.div(e)));return se(Math.E).pow(n).mul(e).negate()},OJ=Hn(au,au.DEPTH_BASE),TU=xt(au,au.DEPTH),OM=Hn(au,au.LINEAR_DEPTH).setParameterLength(0,1),Gye=OM(wU());TU.assign=i=>OJ(i);var Nh=class i extends $t{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 Ae(()=>{let n=se().toVar("distanceToPlane"),r=se().toVar("distanceToGradient"),s=se(1).toVar("clipOpacity"),o=t.length;if(this.hardwareClipping===!1&&o>0){let l=To(t).setGroup(Zt);Ri(o,({i:c})=>{let u=l.element(c);n.assign(ts.dot(u.xyz).negate().add(u.w)),r.assign(n.fwidth().div(2)),s.mulAssign(Fl(r.negate(),r,n))})}let a=e.length;if(a>0){let l=To(e).setGroup(Zt),c=se(1).toVar("intersectionClipOpacity");Ri(a,({i:u})=>{let f=l.element(u);n.assign(ts.dot(f.xyz).negate().add(f.w)),r.assign(n.fwidth().div(2)),c.mulAssign(Fl(r.negate(),r,n).oneMinus())}),s.mulAssign(c.oneMinus())}Ci.a.mulAssign(s),Ci.a.equal(0).discard()})()}setupDefault(e,t){return Ae(()=>{let n=t.length;if(this.hardwareClipping===!1&&n>0){let s=To(t).setGroup(Zt);Ri(n,({i:o})=>{let a=s.element(o);ts.dot(a.xyz).greaterThan(a.w).discard()})}let r=e.length;if(r>0){let s=To(e).setGroup(Zt),o=Ll(!0).toVar("clipped");Ri(r,({i:a})=>{let l=s.element(a);o.assign(ts.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){let n=e.length;return t.enableHardwareClipping(n),Ae(()=>{let r=To(e).setGroup(Zt),s=rd(t.getClipDistance());Ri(n,({i:o})=>{let a=r.element(o),l=ts.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}};Nh.ALPHA_TO_COVERAGE="alphaToCoverage";Nh.DEFAULT="default";Nh.HARDWARE="hardware";var zye=()=>new Nh,Vye=()=>new Nh(Nh.ALPHA_TO_COVERAGE),qye=()=>new Nh(Nh.HARDWARE),Hye=.05,MY=Ae(([i])=>su(bn(1e4,Ta(bn(17,i.x).add(bn(.1,i.y)))).mul(fs(.1,Ji(Ta(bn(13,i.y).add(i.x))))))),CY=Ae(([i])=>MY(ft(MY(i.xy),i.z))),Wye=Ae(([i])=>{let e=Sr(Mh(U7(i.xyz)),Mh(k7(i.xyz))),t=se(1).div(se(Hye).mul(e)).toVar("pixScale"),n=ft(I1(Eh(Th(t))),I1(kC(Th(t)))),r=ft(CY(Eh(n.x.mul(i.xyz))),CY(Eh(n.y.mul(i.xyz)))),s=su(Th(t)),o=fs(bn(s.oneMinus(),r.x),bn(s,r.y)),a=Ja(s,s.oneMinus()),l=pe(o.mul(o).div(bn(2,a).mul(ni(1,a))),o.sub(bn(.5,a)).div(ni(1,a)),ni(1,ni(1,o).mul(ni(1,o)).div(bn(2,a).mul(ni(1,a))))),c=o.lessThan(a.oneMinus()).select(o.lessThan(a).select(l.x,l.y),l.z);return ou(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]}),MF=class extends PM{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 gn(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}},BJ=(i=0)=>new MF(i),Ar=class extends Ss{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(G1(t.slice(0,-4)),n.getCacheKey());return this.type+vb(e)}build(e){this.setup(e)}setupObserver(e){return new R8(e)}setup(e){e.context.setupNormal=()=>Cm(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=Cm(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=Lt(l,Ci.a).max(0);o=this.setupOutput(e,c),T1.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(),p=this.mrtNode;f!==null?(u&&T1.assign(o),o=f,p!==null&&(o=f.merge(p))):p!==null&&(o=p)}}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=Vye():e.stack.addToStack(zye())}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(qye()),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=YC(ts.z,e0,t0):r=Rm(ts.z,e0,t0))}r!==null&&TU.assign(r).toStack()}setupPositionView(){return Ih.mul(fr).xyz}setupModelViewProjection(){return Ma.mul(ts)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),vJ}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&IJ(t),t.isSkinnedMesh===!0&&RJ(t),this.displacementMap){let r=Zf("displacementMap","texture"),s=Zf("displacementScale","float"),o=Zf("displacementBias","float");fr.addAssign(ta.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&EJ(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&TJ(t),this.positionNode!==null&&fr.assign(Cm(this.positionNode,"POSITION","vec3")),fr}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&Ll(this.maskNode).not().discard();let r=this.colorNode?Lt(this.colorNode):YQ;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul(BJ())),t.instanceColor&&(r=xU.mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=yU.mul(r)),Ci.assign(r);let s=this.opacityNode?se(this.opacityNode):dU;Ci.a.assign(Ci.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?se(this.alphaTestNode):$Q,this.alphaToCoverage===!0?(Ci.a=Fl(o,o.add(z7(Ci.a)),Ci.a),Ci.a.lessThanEqual(0).discard()):Ci.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Ci.a.lessThan(Wye(fr)).discard(),e.isOpaque()&&Ci.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?pe(0):Ci.rgb}setupNormal(){return this.normalNode?pe(this.normalNode):nJ}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Zf("envMap","cubeTexture"):Zf("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new TF(_U)),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 wF(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=yJ),e.context.getAO&&(t=e.context.getAO(t,e)),t!==null&&(G8.assign(t),e.context.ambientOcclusion=G8)}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=NJ(l,u,a,n,r)}else n!==null&&(c=pe(r!==null?Xn(c,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(k8.assign(pe(s||KQ)),c=c.add(k8)),c}setupFog(e,t){let n=e.fogNode;return n&&(T1.assign(t),t=Lt(n.toVar())),t}setupPremultipliedAlpha(e,t){return eU(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=Ss.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}},jye=new gl,CF=class extends Ar{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(jye),this.setValues(e)}},Xye=new qy,RF=class extends Ar{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(Xye),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){let e=this.offsetNode?se(this.offsetNode):gU,t=this.dashScaleNode?se(this.dashScaleNode):pU,n=this.dashSizeNode?se(this.dashSizeNode):AU,r=this.gapSizeNode?se(this.gapSizeNode):mU;Mm.assign(n),nb.assign(r);let s=d0(Nl("lineDistance").mul(t));(e?s.add(e):s).mod(Mm.add(nb)).greaterThan(Mm).discard()}};var pM=qm("vec3","worldStart"),PF=qm("vec3","worldEnd"),UJ=qm("float","lineDistance"),_m=qm("vec4","worldPos"),RY=Ae(({start:i,end:e})=>{let t=Ma.element(2).element(2),n=Ma.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"}),$ye=Ae(({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),p=o.dot(o).mul(u).sub(l.mul(l)),v=a.mul(l).sub(c.mul(u)).div(p).clamp(),w=a.add(l.mul(v)).div(u).clamp();return ft(v,w)},{p1:"vec3",p2:"vec3",p3:"vec3",p4:"vec3",return:"vec2"}),DJe=Ae(({material:i})=>{let e=i._useDash,t=i._useWorldUnits,n=Nl("instanceStart"),r=Nl("instanceEnd"),s=Lt(Ih.mul(Lt(n,1))).toVar("start"),o=Lt(Ih.mul(Lt(r,1))).toVar("end"),a,l;e&&(a=se(Nl("instanceDistanceStart")).toVar("distanceStart"),l=se(Nl("instanceDistanceEnd")).toVar("distanceEnd")),t&&(pM.assign(s.xyz),PF.assign(o.xyz));let c=R1.z.div(R1.w),u=Ma.element(2).element(3).equal(-1);if(Wt(u,()=>{Wt(s.z.lessThan(0).and(o.z.greaterThan(0)),()=>{let T=RY({start:s,end:o});o.assign(Lt(Xn(s.xyz,o.xyz,T),o.w)),e&&l.assign(Xn(a,l,T))}).ElseIf(o.z.lessThan(0).and(s.z.greaterThanEqual(0)),()=>{let T=RY({start:o,end:s});s.assign(Lt(Xn(o.xyz,s.xyz,T),s.w)),e&&a.assign(Xn(l,a,T))})}),e){let T=i.dashScaleNode?se(i.dashScaleNode):pU,P=i.offsetNode?se(i.offsetNode):gU,R=Zo.y.lessThan(.5).select(T.mul(a),T.mul(l));R=R.add(P),UJ.assign(R)}let f=Ma.mul(s),p=Ma.mul(o),x=f.xyz.div(f.w),v=p.xyz.div(p.w),w=v.xy.sub(x.xy).toVar();w.x.assign(w.x.mul(c)),w.assign(w.normalize());let S=Lt().toVar();if(t){let T=o.xyz.sub(s.xyz).normalize(),P=Xn(s.xyz,o.xyz,.5).normalize(),R=T.cross(P).normalize(),C=T.cross(R);_m.assign(Zo.y.lessThan(.5).select(s,o));let L=LM.mul(.5);_m.addAssign(Lt(Zo.x.lessThan(0).select(R.mul(L),R.mul(L).negate()),0)),e||(_m.addAssign(Lt(Zo.y.lessThan(.5).select(T.mul(L).negate(),T.mul(L)),0)),_m.addAssign(Lt(C.mul(L),0)),Wt(Zo.y.greaterThan(1).or(Zo.y.lessThan(0)),()=>{_m.subAssign(Lt(C.mul(2).mul(L),0))})),S.assign(Ma.mul(_m));let D=pe().toVar();D.assign(Zo.y.lessThan(.5).select(x,v)),S.z.assign(D.z.mul(S.w))}else{let T=ft(w.y,w.x.negate()).toVar("offset");w.x.assign(w.x.div(c)),T.x.assign(T.x.div(c)),T.assign(Zo.x.lessThan(0).select(T.negate(),T)),Wt(Zo.y.lessThan(0),()=>{T.assign(T.sub(w))}).ElseIf(Zo.y.greaterThan(1),()=>{T.assign(T.add(w))}),T.assign(T.mul(LM)),T.assign(T.div(R1.w.div(rU))),S.assign(Zo.y.lessThan(.5).select(f,p)),T.assign(T.mul(S.w)),S.assign(S.add(Lt(T,0,0)))}return S})(),FJe=Ae(({material:i,renderer:e})=>{let t=i._useAlphaToCoverage,n=i._useDash,r=i._useWorldUnits,s=Pi();if(n){let a=i.dashSizeNode?se(i.dashSizeNode):AU,l=i.gapSizeNode?se(i.gapSizeNode):mU;Mm.assign(a),nb.assign(l),s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),UJ.mod(Mm.add(nb)).greaterThan(Mm).discard()}let o=se(1).toVar("alpha");if(r){let a=_m.xyz.normalize().mul(1e5),l=PF.sub(pM),c=$ye({p1:pM,p2:PF,p3:pe(0,0,0),p4:a}),u=pM.add(l.mul(c.x)),f=a.mul(c.y),v=u.sub(f).length().div(LM);if(!n)if(t&&e.currentSamples>0){let w=v.fwidth();o.assign(Fl(w.negate().add(.5),w.add(.5),v).oneMinus())}else v.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=se(c.fwidth()).toVar("dlen");Wt(s.y.abs().greaterThan(1),()=>{o.assign(Fl(u.oneMinus(),u.add(1),c).oneMinus())})}else Wt(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 Yye=new zy,IF=class extends Ar{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(Yye),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?se(this.opacityNode):dU;Ci.assign(zC(Lt(hU(oi),e),yr))}},EU=Ae(([i=oU])=>{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 ft(e,t)}),NF=Ae(([i=Pi()])=>{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)}),BM=class extends ua{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 Gu(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 qc(5,5,5),o=EU(oU),a=new Ar;a.colorNode=ai(t,o,0),a.side=ui,a.blending=Yr;let l=new Gn(s,a),c=new Qd;c.add(l),t.minFilter===xo&&(t.minFilter=bi);let u=new T_(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)}},Zv=new WeakMap,LF=class extends pr{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Ea(null);let t=new Gu;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=_n.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===op||o===ap){if(Zv.has(s)){let a=Zv.get(s);PY(a,s.mapping),this._cubeTexture=a}else{let a=s.image;if(Zye(a)){let l=new BM(a.height);l.fromEquirectangularTexture(t,s),PY(l.texture,s.mapping),this._cubeTexture=l.texture,Zv.set(s,l.texture),s.addEventListener("dispose",kJ)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function Zye(i){return i==null?!1:i.height>0}function kJ(i){let e=i.target;e.removeEventListener("dispose",kJ);let t=Zv.get(e);t!==void 0&&(Zv.delete(e),t.dispose())}function PY(i,e){e===op?i.mapping=yl:e===ap&&(i.mapping=nc)}var GJ=Hn(LF).setParameterLength(1),ob=class extends h0{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=GJ(this.envNode)}},DF=class extends h0{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){let t=se(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}},F1=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},UM=class extends F1{constructor(){super()}indirect({context:e}){let t=e.ambientOcclusion,n=e.reflectedLight,r=e.irradianceLightMap;n.indirectDiffuse.assign(Lt(0)),r?n.indirectDiffuse.addAssign(r):n.indirectDiffuse.addAssign(Lt(1,1,1,0)),n.indirectDiffuse.mulAssign(t),n.indirectDiffuse.mulAssign(Ci.rgb)}finish(e){let{material:t,context:n}=e,r=n.outgoingLight,s=e.context.environment;if(s)switch(t.combine){case FA:r.rgb.assign(Xn(r.rgb,r.rgb.mul(s.rgb),Yv.mul(dM)));break;case KT:r.rgb.assign(Xn(r.rgb,s.rgb,Yv.mul(dM)));break;case QT:r.rgb.addAssign(s.rgb.mul(Yv.mul(dM)));break;default:je("BasicLightingModel: Unsupported .combine value:",t.combine);break}}},Kye=new as,FF=class extends Ar{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Kye),this.setValues(e)}setupNormal(){return Wm(N1)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new ob(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new DF(_U)),t}setupOutgoingLight(){return Ci.rgb}setupLightingModel(){return new UM}},O1=Ae(({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))}),Bm=Ae(i=>i.diffuseColor.mul(1/Math.PI)),Qye=()=>se(.25),Jye=Ae(({dotNH:i})=>wM.mul(se(.5)).add(1).mul(se(1/Math.PI)).mul(i.pow(wM))),e2e=Ae(({lightDirection:i})=>{let e=i.add(Vi).normalize(),t=oi.dot(e).clamp(),n=Vi.dot(e).clamp(),r=O1({f0:c0,f90:1,dotVH:n}),s=Qye(),o=Jye({dotNH:t});return r.mul(s).mul(o)}),kM=class extends UM{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=oi.dot(e).clamp().mul(t);n.directDiffuse.addAssign(s.mul(Bm({diffuseColor:Ci.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(e2e({lightDirection:e})).mul(Yv))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Bm({diffuseColor:Ci}))),r.indirectDiffuse.mulAssign(t)}},t2e=new ma,OF=class extends Ar{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(t2e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new ob(t):null}setupLightingModel(){return new kM(!1)}},n2e=new PA,BF=class extends Ar{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(n2e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new ob(t):null}setupLightingModel(){return new kM}setupVariants(){let e=(this.shininessNode?se(this.shininessNode):ZQ).max(1e-4);wM.assign(e);let t=this.specularNode||QQ;c0.assign(t)}},zJ=Ae(i=>{if(i.geometry.hasAttribute("normal")===!1)return se(0);let e=N1.dFdx().abs().max(N1.dFdy().abs());return e.x.max(e.y).max(e.z)}),MU=Ae(i=>{let{roughness:e}=i,t=zJ(),n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),VJ=Ae(({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 Dl(.5,r.add(s).max(BC))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),i2e=Ae(({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 Dl(.5,l.add(c).max(BC))}).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"}]}),qJ=Ae(({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"}]}),r2e=se(1/Math.PI),s2e=Ae(({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 r2e.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"}]}),CU=Ae(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,normalView:s=oi,USE_IRIDESCENCE:o,USE_ANISOTROPY:a})=>{let l=n.pow2(),c=i.add(Vi).normalize(),u=s.dot(i).clamp(),f=s.dot(Vi).clamp(),p=s.dot(c).clamp(),x=Vi.dot(c).clamp(),v=O1({f0:e,f90:t,dotVH:x}),w,S;if(P1(o)&&(v=DC.mix(v,r)),P1(a)){let T=Xv.dot(i),P=Xv.dot(Vi),R=Xv.dot(c),C=Em.dot(i),L=Em.dot(Vi),D=Em.dot(c);w=i2e({alphaT:bM,alphaB:l,dotTV:P,dotBV:L,dotTL:T,dotBL:C,dotNV:f,dotNL:u}),S=s2e({alphaT:bM,alphaB:l,dotNH:p,dotTH:R,dotBH:D})}else w=VJ({alpha:l,dotNL:u,dotNV:f}),S=qJ({alpha:l,dotNH:p});return v.mul(w).mul(S)}),o2e=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]),gh=null,ab=Ae(({roughness:i,dotNV:e})=>{gh===null&&(gh=new SA(o2e,16,16,Ts,Di),gh.name="DFG_LUT",gh.minFilter=bi,gh.magFilter=bi,gh.wrapS=Go,gh.wrapT=Go,gh.generateMipmaps=!1,gh.needsUpdate=!0);let t=ft(i,e);return ai(gh,t).rg}),a2e=Ae(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let a=CU({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o}),l=oi.dot(i).clamp(),c=oi.dot(Vi).clamp(),u=ab({roughness:n,dotNV:c}),f=ab({roughness:n,dotNV:l}),p=e.mul(u.x).add(t.mul(u.y)),x=e.mul(f.x).add(t.mul(f.y)),v=u.x.add(u.y),w=f.x.add(f.y),S=se(1).sub(v),T=se(1).sub(w),P=e.add(e.oneMinus().mul(.047619)),R=p.mul(x).mul(P).div(se(1).sub(S.mul(T).mul(P).mul(P)).add(BC)),C=S.mul(T),L=R.mul(C);return a.add(L)}),HJ=Ae(i=>{let{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=ab({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),UF=Ae(({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"}]}),l2e=Ae(({roughness:i,dotNH:e})=>{let t=i.pow2(),n=se(1).div(t),s=e.pow2().oneMinus().max(.0078125);return se(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"}]}),c2e=Ae(({dotNV:i,dotNL:e})=>se(1).div(se(4).mul(e.add(i).sub(e.mul(i))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),u2e=Ae(({lightDirection:i})=>{let e=i.add(Vi).normalize(),t=oi.dot(i).clamp(),n=oi.dot(Vi).clamp(),r=oi.dot(e).clamp(),s=l2e({roughness:Jp,dotNH:r}),o=c2e({dotNV:n,dotNL:t});return Rl.mul(s).mul(o)}),IY=Ae(({N:i,V:e,roughness:t})=>{let s=.0078125,o=i.dot(e).saturate(),a=ft(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"}]}),h2e=Ae(({f:i})=>{let e=i.length();return Sr(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),FE=Ae(({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,Sr(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"}]}),t8=Ae(({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 Wt(u.dot(t.sub(r)).greaterThanEqual(0),()=>{let p=e.sub(i.mul(e.dot(i))).normalize(),x=i.cross(p).negate(),v=n.mul(so(p,x,i).transpose()).toVar(),w=v.mul(r.sub(t)).normalize().toVar(),S=v.mul(s.sub(t)).normalize().toVar(),T=v.mul(o.sub(t)).normalize().toVar(),P=v.mul(a.sub(t)).normalize().toVar(),R=pe(0).toVar();R.addAssign(FE({v1:w,v2:S})),R.addAssign(FE({v1:S,v2:T})),R.addAssign(FE({v1:T,v2:P})),R.addAssign(FE({v1:P,v2:w})),f.assign(pe(h2e({f:R})))}),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 ZC=1/6,WJ=i=>bn(ZC,bn(i,bn(i,i.negate().add(3)).sub(3)).add(1)),kF=i=>bn(ZC,bn(i,bn(i,bn(3,i).sub(6))).add(4)),jJ=i=>bn(ZC,bn(i,bn(i,bn(-3,i).add(3)).add(3)).add(1)),GF=i=>bn(ZC,pc(i,3)),NY=i=>WJ(i).add(kF(i)),LY=i=>jJ(i).add(GF(i)),DY=i=>fs(-1,kF(i).div(WJ(i).add(kF(i)))),FY=i=>fs(1,GF(i).div(jJ(i).add(GF(i)))),OY=(i,e,t)=>{let n=i.uvNode,r=bn(n,e.zw).add(.5),s=Eh(r),o=su(r),a=NY(o.x),l=LY(o.x),c=DY(o.x),u=FY(o.x),f=DY(o.y),p=FY(o.y),x=ft(s.x.add(c),s.y.add(f)).sub(.5).mul(e.xy),v=ft(s.x.add(u),s.y.add(f)).sub(.5).mul(e.xy),w=ft(s.x.add(c),s.y.add(p)).sub(.5).mul(e.xy),S=ft(s.x.add(u),s.y.add(p)).sub(.5).mul(e.xy),T=NY(o.y).mul(fs(a.mul(i.sample(x).level(t)),l.mul(i.sample(v).level(t)))),P=LY(o.y).mul(fs(a.mul(i.sample(w).level(t)),l.mul(i.sample(S).level(t))));return T.add(P)},RU=Ae(([i,e])=>{let t=ft(i.size(fe(e))),n=ft(i.size(fe(e.add(1)))),r=Dl(1,t),s=Dl(1,n),o=OY(i,Lt(r,t),Eh(e)),a=OY(i,Lt(s,n),kC(e));return su(e).mix(o,a)}),f2e=Ae(([i,e])=>{let t=e.mul(nU(i));return RU(i,t)}),BY=Ae(([i,e,t,n,r])=>{let s=pe(W7(e.negate(),Jo(i),Dl(1,n))),o=pe(Mh(r[0].xyz),Mh(r[1].xyz),Mh(r[2].xyz));return Jo(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"}]}),d2e=Ae(([i,e])=>i.mul(ou(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),p2e=bU(),A2e=LJ(),UY=Ae(([i,e,t],{material:n})=>{let s=(n.side===ui?p2e:A2e).sample(i),o=Th(Fm.x).mul(d2e(e,t));return RU(s,o)}),kY=Ae(([i,e,t])=>(Wt(t.notEqual(0),()=>{let n=UC(e).negate().div(t);return N7(n.negate().mul(i))}),pe(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),m2e=Ae(([i,e,t,n,r,s,o,a,l,c,u,f,p,x,v])=>{let w,S;if(v){w=Lt().toVar(),S=pe().toVar();let L=u.sub(1).mul(v.mul(.025)),D=pe(u.sub(L),u,u.add(L));Ri({start:0,end:3},({i:F})=>{let N=D.element(F),B=BY(i,e,f,N,a),z=o.add(B),V=c.mul(l.mul(Lt(z,1))),H=ft(V.xy.div(V.w)).toVar();H.addAssign(1),H.divAssign(2),H.assign(ft(H.x,H.y.oneMinus()));let Z=UY(H,t,N);w.element(F).assign(Z.element(F)),w.a.addAssign(Z.a),S.element(F).assign(n.element(F).mul(kY(Mh(B),p,x).element(F)))}),w.a.divAssign(3)}else{let L=BY(i,e,f,u,a),D=o.add(L),F=c.mul(l.mul(Lt(D,1))),N=ft(F.xy.div(F.w)).toVar();N.addAssign(1),N.divAssign(2),N.assign(ft(N.x,N.y.oneMinus())),w=UY(N,t,u),S=n.mul(kY(Mh(L),p,x))}let T=S.rgb.mul(w.rgb),P=i.dot(e).clamp(),R=pe(HJ({dotNV:P,specularColor:r,specularF90:s,roughness:t})),C=S.r.add(S.g,S.b).div(3);return Lt(R.oneMinus().mul(T),w.a.oneMinus().mul(C).oneMinus())}),g2e=so(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),_2e=i=>{let e=i.sqrt();return pe(1).add(e).div(pe(1).sub(e))},GY=(i,e)=>i.sub(e).div(i.add(e)).pow2(),x2e=(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=se(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),g2e.mul(a)},zY=Ae(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{let s=Xn(i,e,Fl(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();Wt(a.lessThan(0),()=>pe(1));let l=a.sqrt(),c=GY(s,i),u=O1({f0:c,f90:1,dotVH:t}),f=u.oneMinus(),p=s.lessThan(i).select(Math.PI,0),x=se(Math.PI).sub(p),v=_2e(r.clamp(0,.9999)),w=GY(v,s.toVec3()),S=O1({f0:w,f90:1,dotVH:l}),T=pe(v.x.lessThan(s).select(Math.PI,0),v.y.lessThan(s).select(Math.PI,0),v.z.lessThan(s).select(Math.PI,0)),P=s.mul(n,l,2),R=pe(x).add(T),C=u.mul(S).clamp(1e-5,.9999),L=C.sqrt(),D=f.pow2().mul(S).div(pe(1).sub(C)),N=u.add(D).toVar(),B=D.sub(f).toVar();return Ri({start:1,end:2,condition:"<=",name:"m"},({m:z})=>{B.mulAssign(L);let V=x2e(se(z).mul(P),se(z).mul(R)).mul(2);N.addAssign(B.mul(V))}),N.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"}]}),Mv=Ae(({normal:i,viewDir:e,roughness:t})=>{let n=i.dot(e).saturate(),r=t.mul(t),s=t.add(.1).reciprocal(),o=se(-1.9362).add(t.mul(1.0678)).add(r.mul(.4573)).sub(s.mul(.8469)),a=se(-.6014).add(t.mul(.5538)).sub(r.mul(.467)).sub(s.mul(.1255));return o.mul(n).add(a).exp().saturate()}),Cv=pe(.04),OE=se(1),GM=class extends F1{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=oi.dot(Vi).clamp(),n=zY({outsideIOR:se(1),eta2:yM,cosTheta1:t,thinFilmThickness:vM,baseF0:c0}),r=zY({outsideIOR:se(1),eta2:yM,cosTheta1:t,thinFilmThickness:vM,baseF0:Ci.rgb});this.iridescenceFresnel=Xn(n,r,Qf),this.iridescenceF0Dielectric=UF({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=UF({f:r,f90:1,dotVH:t}),this.iridescenceF0=Xn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Qf)}if(this.transmission===!0){let t=Ch,n=bQ.sub(Ch).normalize(),r=m0,s=e.context;s.backdrop=m2e(r,n,wh,xm,vm,bm,t,Ac,A0,Ma,$v,M7,R7,C7,this.dispersion?P7:null),s.backdropAlpha=SM,Ci.a.mulAssign(Xn(1,s.backdrop.a,SM))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){let o=oi.dot(Vi).clamp(),a=ab({roughness:wh,dotNV:o}),l=s?DC.mix(r,s):r,c=l.mul(a.x).add(n.mul(a.y)),f=a.x.add(a.y).oneMinus(),p=l.add(l.oneMinus().mul(.047619)),x=c.mul(p).div(f.mul(p).oneMinus());e.addAssign(c),t.addAssign(x.mul(f))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=oi.dot(e).clamp().mul(t).toVar();if(this.sheen===!0){this.sheenSpecularDirect.addAssign(s.mul(u2e({lightDirection:e})));let o=Mv({normal:oi,viewDir:Vi,roughness:Jp}),a=Mv({normal:oi,viewDir:e,roughness:Jp}),l=Rl.r.max(Rl.g).max(Rl.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){let a=n0.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(CU({lightDirection:e,f0:Cv,f90:OE,roughness:S1,normalView:n0})))}n.directDiffuse.addAssign(s.mul(Bm({diffuseColor:xm}))),n.directSpecular.addAssign(s.mul(a2e({lightDirection:e,f0:vm,f90:1,roughness:wh,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),p=oi,x=Vi,v=ts.toVar(),w=IY({N:p,V:x,roughness:wh}),S=o.sample(w).toVar(),T=a.sample(w).toVar(),P=so(pe(S.x,0,S.y),pe(0,1,0),pe(S.z,0,S.w)).toVar(),R=vm.mul(T.x).add(bm.sub(vm).mul(T.y)).toVar();if(s.directSpecular.addAssign(e.mul(R).mul(t8({N:p,V:x,P:v,mInv:P,p0:l,p1:c,p2:u,p3:f}))),s.directDiffuse.addAssign(e.mul(xm).mul(t8({N:p,V:x,P:v,mInv:so(1,0,0,0,1,0,0,0,1),p0:l,p1:c,p2:u,p3:f}))),this.clearcoat===!0){let C=n0,L=IY({N:C,V:x,roughness:S1}),D=o.sample(L),F=a.sample(L),N=so(pe(D.x,0,D.y),pe(0,1,0),pe(D.z,0,D.w)),B=Cv.mul(F.x).add(OE.sub(Cv).mul(F.y));this.clearcoatSpecularDirect.addAssign(e.mul(B).mul(t8({N:C,V:x,P:v,mInv:N,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(Bm({diffuseColor:xm})).toVar();if(this.sheen===!0){let s=Mv({normal:oi,viewDir:Vi,roughness:Jp}),o=Rl.r.max(Rl.g).max(Rl.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(Rl,Mv({normal:oi,viewDir:Vi,roughness:Jp}))),this.clearcoat===!0){let S=n0.dot(Vi).clamp(),T=HJ({dotNV:S,specularColor:Cv,specularF90:OE,roughness:S1});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,bm,c0,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,bm,Ci.rgb,this.iridescenceF0Metallic);let c=Xn(s,a,Qf),u=Xn(o,l,Qf),f=s.add(o),p=xm.mul(f.oneMinus()),x=n.mul(1/Math.PI),v=t.mul(c).add(u.mul(x)).toVar(),w=p.mul(x).toVar();if(this.sheen===!0){let S=Mv({normal:oi,viewDir:Vi,roughness:Jp}),T=Rl.r.max(Rl.g).max(Rl.b).mul(S).oneMinus();v.mulAssign(T),w.mulAssign(T)}r.indirectSpecular.addAssign(v),r.indirectDiffuse.addAssign(w)}ambientOcclusion(e){let{ambientOcclusion:t,reflectedLight:n}=e.context,s=oi.dot(Vi).clamp().add(t),o=wh.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=n0.dot(Vi).clamp(),r=O1({dotVH:n,f0:Cv,f90:OE}),s=t.mul(xM.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(xM));t.assign(s)}if(this.sheen===!0){let n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}},VY=se(1),zF=se(-2),BE=se(.8),n8=se(-1),UE=se(.4),i8=se(2),kE=se(.305),r8=se(3),qY=se(.21),y2e=se(4),HY=se(4),v2e=se(16),b2e=Ae(([i])=>{let e=pe(Ji(i)).toVar(),t=se(-1).toVar();return Wt(e.x.greaterThan(e.z),()=>{Wt(e.x.greaterThan(e.y),()=>{t.assign(Qo(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(Qo(i.y.greaterThan(0),1,4))})}).Else(()=>{Wt(e.z.greaterThan(e.y),()=>{t.assign(Qo(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(Qo(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),w2e=Ae(([i,e])=>{let t=ft().toVar();return Wt(e.equal(0),()=>{t.assign(ft(i.z,i.y).div(Ji(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(ft(i.x.negate(),i.z.negate()).div(Ji(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(ft(i.x.negate(),i.y).div(Ji(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(ft(i.z.negate(),i.y).div(Ji(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(ft(i.x.negate(),i.z).div(Ji(i.y)))}).Else(()=>{t.assign(ft(i.x,i.y).div(Ji(i.z)))}),bn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),S2e=Ae(([i])=>{let e=se(0).toVar();return Wt(i.greaterThanEqual(BE),()=>{e.assign(VY.sub(i).mul(n8.sub(zF)).div(VY.sub(BE)).add(zF))}).ElseIf(i.greaterThanEqual(UE),()=>{e.assign(BE.sub(i).mul(i8.sub(n8)).div(BE.sub(UE)).add(n8))}).ElseIf(i.greaterThanEqual(kE),()=>{e.assign(UE.sub(i).mul(r8.sub(i8)).div(UE.sub(kE)).add(i8))}).ElseIf(i.greaterThanEqual(qY),()=>{e.assign(kE.sub(i).mul(y2e.sub(r8)).div(kE.sub(qY)).add(r8))}).Else(()=>{e.assign(se(-2).mul(Th(bn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),XJ=Ae(([i,e])=>{let t=i.toVar();t.assign(bn(2,t).sub(1));let n=pe(t,1).toVar();return Wt(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"}]}),$J=Ae(([i,e,t,n,r,s])=>{let o=se(t),a=pe(e),l=ou(S2e(o),zF,s),c=su(l),u=Eh(l),f=pe(lb(i,a,u,n,r,s)).toVar();return Wt(c.notEqual(0),()=>{let p=pe(lb(i,a,u.add(1),n,r,s)).toVar();f.assign(Xn(f,p,c))}),f}),lb=Ae(([i,e,t,n,r,s])=>{let o=se(t).toVar(),a=pe(e),l=se(b2e(a)).toVar(),c=se(Sr(HY.sub(o),0)).toVar();o.assign(Sr(o,HY));let u=se(I1(o)).toVar(),f=ft(w2e(a,l).mul(u.sub(2)).add(1)).toVar();return Wt(l.greaterThan(2),()=>{f.y.addAssign(u),l.subAssign(3)}),f.x.addAssign(l.mul(u)),f.x.addAssign(c.mul(bn(3,v2e))),f.y.addAssign(bn(4,I1(s).sub(u))),f.x.mulAssign(n),f.y.mulAssign(r),i.sample(f).grad(ft(),ft())}),s8=Ae(({envMap:i,mipInt:e,outputDirection:t,theta:n,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=tu(n),c=t.mul(l).add(r.cross(t).mul(Ta(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return lb(i,c,e,s,o,a)}),YJ=Ae(({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 p=pe(Qo(e,t,ed(t,n))).toVar();Wt(p.equal(pe(0)),()=>{p.assign(pe(n.z,0,n.x.negate()))}),p.assign(Jo(p));let x=pe().toVar();return x.addAssign(r.element(0).mul(s8({theta:0,axis:p,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),Ri({start:fe(1),end:i},({i:v})=>{Wt(v.greaterThanEqual(s),()=>{PJ()});let w=se(o.mul(se(v))).toVar();x.addAssign(r.element(v).mul(s8({theta:w.mul(-1),axis:p,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),x.addAssign(r.element(v).mul(s8({theta:w,axis:p,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})))}),Lt(x,1)}),T2e=Ae(([i])=>{let e=it(i).toVar();return e.assign(e.shiftLeft(it(16)).bitOr(e.shiftRight(it(16)))),e.assign(e.bitAnd(it(1431655765)).shiftLeft(it(1)).bitOr(e.bitAnd(it(2863311530)).shiftRight(it(1)))),e.assign(e.bitAnd(it(858993459)).shiftLeft(it(2)).bitOr(e.bitAnd(it(3435973836)).shiftRight(it(2)))),e.assign(e.bitAnd(it(252645135)).shiftLeft(it(4)).bitOr(e.bitAnd(it(4042322160)).shiftRight(it(4)))),e.assign(e.bitAnd(it(16711935)).shiftLeft(it(8)).bitOr(e.bitAnd(it(4278255360)).shiftRight(it(8)))),se(e).mul(23283064365386963e-26)}),E2e=Ae(([i,e])=>ft(se(i).div(se(e)),T2e(i))),M2e=Ae(([i,e,t])=>{let n=t.mul(t).toConst(),r=pe(1,0,0).toConst(),s=ed(e,r).toConst(),o=Ca(i.x).toConst(),a=bn(2,3.14159265359).mul(i.y).toConst(),l=o.mul(tu(a)).toConst(),c=o.mul(Ta(a)).toVar(),u=bn(.5,e.z.add(1)).toConst();c.assign(u.oneMinus().mul(Ca(l.mul(l).oneMinus())).add(u.mul(c)));let f=r.mul(l).add(s.mul(c)).add(e.mul(Ca(Sr(0,l.mul(l).add(c.mul(c)).oneMinus()))));return Jo(pe(n.mul(f.x),n.mul(f.y),Sr(0,f.z)))}),ZJ=Ae(({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=se(0).toVar();return Wt(i.lessThan(.001),()=>{c.assign(lb(t,l,e,s,o,a))}).Else(()=>{let f=Qo(Ji(l.z).lessThan(.999),pe(0,0,1),pe(1,0,0)),p=Jo(ed(f,l)).toVar(),x=ed(l,p).toVar();Ri({start:it(0),end:r},({i:v})=>{let w=E2e(v,r),S=M2e(w,pe(0,0,1),i),T=Jo(p.mul(S.x).add(x.mul(S.y)).add(l.mul(S.z))),P=Jo(T.mul(_c(l,T).mul(2)).sub(l)),R=Sr(_c(l,P),0);Wt(R.greaterThan(0),()=>{let C=lb(t,P,e,s,o,a);c.addAssign(C.mul(R)),u.addAssign(R)})}),Wt(u.greaterThan(0),()=>{c.assign(c.div(u))})}),Lt(c,1)}),s0=4,WY=[.125,.215,.35,.446,.526,.582],ym=20,C2e=512,Rv=new Hc(-1,1,1,-1,0,1),R2e=new Ir(90,1),jY=new Ut,o8=null,a8=0,l8=0,P2e=new ie,zM=new WeakMap,I2e=[3,1,5,0,4,2],c8=XJ(Pi(),Nl("faceIndex")).normalize(),KC=pe(c8.x,c8.y,c8.z),VF=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=P2e,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.');o8=this._renderer.getRenderTarget(),a8=this._renderer.getActiveCubeFace(),l8=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 Kn('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 Kn('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 Kn('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=$Y(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=YY(),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===yl||e.mapping===nc?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(o8,a8,l8),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),o8=this._renderer.getRenderTarget(),a8=this._renderer.getActiveCubeFace(),l8=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 XY(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=XY(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=N2e(t)),this._blurMaterial=L2e(t,e.width,e.height),this._ggxMaterial=D2e(t,e.width,e.height)}}async _compileMaterial(e){let t=new Gn(new qn,e);await this._renderer.compile(t,Rv)}_sceneToCubeUV(e,t,n,r,s){let o=R2e;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(jY),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Gn(new qc,new as({name:"PMREM.Background",side:ui,depthWrite:!1,depthTest:!1})));let f=this._backgroundBox,p=f.material,x=!1,v=e.background;v?v.isColor&&(p.color.copy(v),e.background=null,x=!0):(p.color.copy(jY),x=!0),c.setRenderTarget(r),c.clear(),x&&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=v}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===yl||e.mapping===nc;r?this._cubemapMaterial===null&&(this._cubemapMaterial=$Y(e)):this._equirectMaterial===null&&(this._equirectMaterial=YY(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,Rv)}_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=zM.get(o),c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),p=0+c*1.25,x=f*p,{_lodMax:v}=this,w=this._sizeLods[n],S=3*w*(n>v-s0?n-v+s0:0),T=4*(this._cubeSize-w);e.texture.frame=(e.texture.frame||0)+1,l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=v-t,this._setViewport(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,Rv),s.texture.frame=(s.texture.frame||0)+1,l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=v-n,this._setViewport(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,Rv)}_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"&&Ge("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let p=zM.get(c),x=this._sizeLods[n]-1,v=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*ym-1),w=s/v,S=isFinite(s)?1+Math.floor(u*w):ym;S>ym&&je(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${ym}`);let T=[],P=0;for(let F=0;F<ym;++F){let N=F/w,B=Math.exp(-N*N/2);T.push(B),F===0?P+=B:F<S&&(P+=2*B)}for(let F=0;F<T.length;F++)T[F]=T[F]/P;e.texture.frame=(e.texture.frame||0)+1,p.envMap.value=e.texture,p.samples.value=S,p.weights.array=T,p.latitudinal.value=o==="latitudinal"?1:0,a&&(p.poleAxis.value=a);let{_lodMax:R}=this;p.dTheta.value=v,p.mipInt.value=R-n;let C=this._sizeLods[r],L=3*C*(r>R-s0?r-R+s0:0),D=4*(this._cubeSize-C);this._setViewport(t,L,D,3*C,2*C),l.setRenderTarget(t),l.render(f,Rv)}_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 N2e(i){let e=[],t=[],n=[],r=i,s=i-s0+1+WY.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-s0?l=WY[o-i+s0-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,p=[u,u,f,u,f,f,u,u,f,f,u,f],x=6,v=6,w=3,S=2,T=1,P=new Float32Array(w*v*x),R=new Float32Array(S*v*x),C=new Float32Array(T*v*x);for(let D=0;D<x;D++){let F=D%3*2/3-1,N=D>2?0:-1,B=[F,N,0,F+2/3,N,0,F+2/3,N+1,0,F,N,0,F+2/3,N+1,0,F,N+1,0],z=I2e[D];P.set(B,w*v*z),R.set(p,S*v*z);let V=[z,z,z,z,z,z];C.set(V,T*v*z)}let L=new qn;L.setAttribute("position",new Li(P,w)),L.setAttribute("uv",new Li(R,S)),L.setAttribute("faceIndex",new Li(C,T)),n.push(new Gn(L,null)),r>s0&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function XY(i,e,t){let n={magFilter:bi,minFilter:bi,generateMipmaps:!1,type:Di,format:vr,colorSpace:$d,depthBuffer:t},r=new ua(i,e,n);return r.texture.mapping=ju,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function QC(i){let e=new Ar;return e.depthTest=!1,e.depthWrite=!1,e.blending=Yr,e.name=`PMREM_${i}`,e}function L2e(i,e,t){let n=To(new Array(ym).fill(0)),r=Ht(new ie(0,1,0)),s=Ht(0),o=se(ym),a=Ht(0),l=Ht(1),c=ai(),u=Ht(0),f=se(1/e),p=se(1/t),x=se(i),v={n:o,latitudinal:a,weights:n,poleAxis:r,outputDirection:KC,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:f,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:x},w=QC("blur");return w.fragmentNode=YJ({...v,latitudinal:a.equal(1)}),zM.set(w,v),w}function D2e(i,e,t){let n=ai(),r=Ht(0),s=Ht(0),o=se(1/e),a=se(1/t),l=se(i),c={envMap:n,roughness:r,mipInt:s,CUBEUV_TEXEL_WIDTH:o,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:l},u=QC("ggx");return u.fragmentNode=ZJ({...c,N_immutable:KC,GGX_SAMPLES:it(C2e)}),zM.set(u,c),u}function $Y(i){let e=QC("cubemap");return e.fragmentNode=Ea(i,KC),e}function YY(i){let e=QC("equirect");return e.fragmentNode=ai(i,EU(KC),0),e}var ZY=new WeakMap;function F2e(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 O2e(i,e,t){let n=B2e(e),r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){let o=i.image;if(i.isCubeTexture)if(U2e(o))r=t.fromCubemap(i,r);else return null;else if(k2e(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 B2e(i){let e=ZY.get(i);return e===void 0&&(e=new WeakMap,ZY.set(i,e)),e}var qF=class extends pr{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 ws;r.isRenderTargetTexture=!0,this._texture=ai(r),this._width=Ht(0),this._height=Ht(0),this._maxMip=Ht(0),this.updateBeforeType=_n.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){let t=F2e(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===ju?t=r:t=O2e(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new VF(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?NM.mul(pe(t.x,t.y.negate(),t.z)):NM.mul(t);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),$J(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function U2e(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 k2e(i){return i==null?!1:i.height>0}var PU=Hn(qF).setParameterLength(1,3),KY=new WeakMap,HF=class extends h0{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],p=this._getPMREMNodeCache(e.renderer),x=p.get(f);x===void 0&&(x=PU(f),p.set(f,x)),n=x}let s=t.useAnisotropy===!0||t.anisotropy>0?jQ:oi,o=n.context(QY(wh,s)).mul(fM),a=n.context(G2e(m0)).mul(Math.PI).mul(fM),l=M1(o),c=M1(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(c);let u=e.context.lightingModel.clearcoatRadiance;if(u){let f=n.context(QY(S1,n0)).mul(fM),p=M1(f);u.addAssign(p)}}_getPMREMNodeCache(e){let t=KY.get(e);return t===void 0&&(t=new WeakMap,KY.set(e,t)),t}},QY=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=Vi.negate().reflect(e),t=q7(i).mix(t,e).normalize(),t=t.transformDirection(bb)),t),getTextureLevel:()=>i}},G2e=i=>({getUV:()=>i,getTextureLevel:()=>se(1)}),z2e=new S_,VM=class extends Ar{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(z2e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new HF(t):null}setupLightingModel(){return new GM}setupSpecular(){let e=Xn(pe(.04),Ci.rgb,Qf);c0.assign(pe(.04)),vm.assign(e),bm.assign(1)}setupVariants(){let e=this.metalnessNode?se(this.metalnessNode):tJ;Qf.assign(e);let t=this.roughnessNode?se(this.roughnessNode):eJ;t=MU({roughness:t}),wh.assign(t),this.setupSpecular(),xm.assign(Ci.rgb.mul(e.oneMinus()))}},V2e=new ky,WF=class extends VM{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(V2e),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?se(this.iorNode):AJ;$v.assign(e),c0.assign(Ja(V7($v.sub(1).div($v.add(1))).mul(JQ),pe(1)).mul(gF)),vm.assign(Xn(c0,Ci.rgb,Qf)),bm.assign(Xn(gF,1,Qf))}setupLightingModel(){return new GM(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){let t=this.clearcoatNode?se(this.clearcoatNode):iJ,n=this.clearcoatRoughnessNode?se(this.clearcoatRoughnessNode):rJ;xM.assign(t),S1.assign(MU({roughness:n}))}if(this.useSheen){let t=this.sheenNode?pe(this.sheenNode):aJ,n=this.sheenRoughnessNode?se(this.sheenRoughnessNode):lJ;Rl.assign(t),Jp.assign(n)}if(this.useIridescence){let t=this.iridescenceNode?se(this.iridescenceNode):uJ,n=this.iridescenceIORNode?se(this.iridescenceIORNode):hJ,r=this.iridescenceThicknessNode?se(this.iridescenceThicknessNode):fJ;DC.assign(t),yM.assign(n),vM.assign(r)}if(this.useAnisotropy){let t=(this.anisotropyNode?ft(this.anisotropyNode):cJ).toVar();Qp.assign(t.length()),Wt(Qp.equal(0),()=>{t.assign(ft(1,0))}).Else(()=>{t.divAssign(ft(Qp)),Qp.assign(Qp.saturate())}),bM.assign(Qp.pow2().mix(wh.pow2(),1)),Xv.assign(wm[0].mul(t.x).add(wm[1].mul(t.y))),Em.assign(wm[1].mul(t.x).sub(wm[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?se(this.transmissionNode):dJ,n=this.thicknessNode?se(this.thicknessNode):pJ,r=this.attenuationDistanceNode?se(this.attenuationDistanceNode):mJ,s=this.attenuationColorNode?pe(this.attenuationColorNode):gJ;if(SM.assign(t),M7.assign(n),C7.assign(r),R7.assign(s),this.useDispersion){let o=this.dispersionNode?se(this.dispersionNode):xJ;P7.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pe(this.clearcoatNormalNode):sJ}setup(e){e.context.setupClearcoatNormal=()=>Cm(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}};var q2e=Ae(({normal:i,lightDirection:e,builder:t})=>{let n=i.dot(e),r=ft(n.mul(.5).add(.5),0);if(t.material.gradientMap){let s=Zf("gradientMap","texture").context({getUV:()=>r});return pe(s.r)}else{let s=r.fwidth().mul(.5);return Xn(pe(.7),pe(1),Fl(se(.7).sub(s.x),se(.7).add(s.x),r.x))}}),jF=class extends F1{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){let s=q2e({normal:HC,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(Bm({diffuseColor:Ci.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Bm({diffuseColor:Ci}))),r.indirectDiffuse.mulAssign(t)}},H2e=new Gy,XF=class extends Ar{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(H2e),this.setValues(e)}setupLightingModel(){return new jF}},KJ=Ae(()=>{let i=pe(Vi.z,0,Vi.x.negate()).normalize(),e=Vi.cross(i);return ft(i.dot(oi),e.dot(oi)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),W2e=new Vy,$F=class extends Ar{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(W2e),this.setValues(e)}setupVariants(e){let t=KJ,n;e.material.matcap?n=Zf("matcap","texture").context({getUV:()=>t}):n=pe(Xn(.2,.8,t.y)),Ci.rgb.mulAssign(n.rgb)}},YF=class extends pr{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 LC(s,o,o.negate(),s).mul(n)}else{let s=t,o=o0(Lt(1,0,0,0),Lt(0,tu(s.x),Ta(s.x).negate(),0),Lt(0,Ta(s.x),tu(s.x),0),Lt(0,0,0,1)),a=o0(Lt(tu(s.y),0,Ta(s.y),0),Lt(0,1,0,0),Lt(Ta(s.y).negate(),0,tu(s.y),0),Lt(0,0,0,1)),l=o0(Lt(tu(s.z),Ta(s.z).negate(),0,0),Lt(Ta(s.z),tu(s.z),0,0),Lt(0,0,1,0),Lt(0,0,0,1));return o.mul(a).mul(l).mul(Lt(n,1)).xyz}}},Sb=Hn(YF).setParameterLength(2),j2e=new If,qM=class extends Ar{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(j2e),this.setValues(e)}setupPositionView(e){let{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=Ih.mul(pe(r||0)),c=ft(Ac[0].xyz.length(),Ac[1].xyz.length());o!==null&&(c=c.mul(ft(o))),n.isPerspectiveCamera&&a===!1&&(c=c.mul(l.z.negate()));let u=Zo.xy;if(t.center&&t.center.isVector2===!0){let x=Dxe("center","vec2",t);u=u.sub(x.sub(.5))}u=u.mul(c);let f=se(s||oJ),p=Sb(u,f);return Lt(l.xy.add(p),l.zw)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}},X2e=new Jd,$2e=new Oe,ZF=class extends qM{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(X2e),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return Ih.mul(pe(e||fr)).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?ft(o):_J;c=c.mul(rU),n.isPerspectiveCamera&&a===!0&&(c=c.mul(Y2e.div(ts.z.negate()))),s&&s.isNode&&(c=c.mul(ft(s)));let u=Zo.xy;if(r&&r.isNode){let f=se(r);u=Sb(u,f)}return u=u.mul(c),u=u.div(sU.div(2)),u=u.mul(l.w),l=l.add(Lt(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)}},Y2e=Ht(1).onFrameUpdate(function({renderer:i}){let e=i.getSize($2e);this.value=.5*e.y}),KF=class extends F1{constructor(){super(),this.shadowNode=se(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Ci.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Ci.rgb)}},Z2e=new Uy,QF=class extends Ar{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(Z2e),this.setValues(e)}setupLightingModel(){return new KF}},OJe=nd("vec3"),BJe=nd("vec3"),UJe=nd("vec3");var JF=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()}},Lh=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])}},K2e=0,JY=new WeakMap;function Q2e(i){let e=Object.keys(i),t=JY.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)}JY.set(i.constructor,t)}for(let n=0;n<t.length;n++)e.push(t[n]);return e}var eO=class{constructor(e,t,n,r,s,o,a,l,c,u){this.id=K2e++,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,p=(s.start+s.count)*u;r!==null&&(f=Math.max(f,r.start*u),p=Math.min(p,(r.start+r.count)*u));let x=n.attributes.position,v=1/0;l?v=a.count:x!=null&&(v=x.count),f=Math.max(f,0),p=Math.min(p,v);let w=p-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 Q2e(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+",",G1(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=Wv(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=Wv(e,1)),e=Wv(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()}},_h=[],tO=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);_h[0]=e,_h[1]=t,_h[2]=o,_h[3]=s;let u=c.get(_h);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),c.set(_h,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)),_h[0]=null,_h[1]=null,_h[2]=null,_h[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Lh)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,c,u,f){let p=this.getChainMap(f),x=new eO(e,t,n,r,s,o,a,l,c,u);return x.onDispose=()=>{this.pipelines.delete(x),this.bindings.deleteForRender(x),this.nodes.delete(x),p.delete(x.getChainArray())},x}},Dh=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}},mc={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},i0=16,J2e=211,eve=212,nO=class extends Dh{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===mc.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===mc.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===mc.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===mc.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===WA)&&(this.backend.updateAttribute(e),n.version=r.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}};function QJ(i){return i.index!==null?i.index.version:i.attributes.position.version}function JJ(i){return i.index!==null?i.index.id:i.attributes.position.id}function eZ(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?wA:bA)(e,1);return r.version=QJ(i),r.__id=JJ(i),r}var iO=class extends Dh{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,mc.STORAGE):this.updateAttribute(s,mc.VERTEX);let n=this.getIndex(e);n!==null&&this.updateAttribute(n,mc.INDEX);let r=e.geometry.indirect;r!==null&&this.updateAttribute(r,mc.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=eZ(t),s.set(t,o)):(o.version!==QJ(t)||o.__id!==JJ(t))&&(this.attributes.delete(o),o=eZ(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()}},rO=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):Ge("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===Xu||e.type===zi?t=1:e.type===$u||e.type===ja||e.type===Di?t=2:(e.type===Dr||e.type===pi||e.type===Zi)&&(t=4);let n=4;e.format===R_||e.format===Uf||e.format===Yu||e.format===vs||e.format===eo?n=1:e.format===Ts||e.format===Zu?n=2:(e.format===Bf||e.format===y2)&&(n=3);let r=t*n;e.type===OA||e.type===BA?r=2:(e.type===Vo||e.type===UA||e.type===kA)&&(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 p=c[f];if(p.data)u+=p.data.byteLength;else{let x=p.width||Math.max(1,s>>f),v=p.height||Math.max(1,o>>f);u+=x*v*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}},HM=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},sO=class extends HM{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}},oO=class extends HM{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},tve=0,Kv=class{constructor(e,t,n,r=null,s=null){this.id=tve++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}},aO=class extends Dh{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 Kv(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 Kv(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 Kv(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 oO(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 sO(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)}},lO=class extends Dh{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?mc.INDIRECT:mc.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?mc.INDIRECT:mc.STORAGE,p=n.get(l);this.attributes.update(u,f),p.attribute!==u&&(p.attribute=u,r=!0)}if(l.isUniformBuffer)l.update()&&n.updateBinding(l);else if(l.isSampledTexture){let u=l.update(),f=l.texture,p=this.textures.get(f);if(u&&(this.textures.updateTexture(f),l.generation!==p.generation&&(l.generation=p.generation,r=!0),p.bindGroups.add(e)),n.get(f).externalTexture!==void 0||p.isDefaultTexture?s=!1:(o=o*10+f.id,a+=f.version),f.isStorageTexture===!0&&f.mipmapsAutoUpdate===!0){let v=this.get(f);l.store===!0?v.needsMipmap=!0:this.textures.needsMipmaps(f)&&v.needsMipmap===!0&&(this.backend.generateMipmaps(f),v.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)}},nve=Object.freeze([]);function ive(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 tZ(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 nZ(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===rr&&i.forceSinglePass===!1}var cO=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?(nZ(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?(nZ(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||ive),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||tZ),this.transparent.length>1&&this.transparent.sort(t||tZ),n&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:nve);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}},o1=[],uO=class{constructor(e){this.lighting=e,this.lists=new Lh}get(e,t){let n=this.lists;o1[0]=e,o1[1]=t;let r=n.get(o1);return r===void 0&&(r=new cO(this.lighting,e,t),n.set(o1,r)),o1[0]=null,o1[1]=null,r}dispose(){this.lists=new Lh}},rve=0,hO=class{constructor(){this.id=rve++,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 gn,this.scissor=!1,this.scissorValue=new gn,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 eee(this)}};function eee(i){let{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(let s of e)r.push(s.id);return vb(r)}var fO=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 hO,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={}}},sve=new ie,dO=class extends Dh{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,p=!1,x=u!==void 0&&u.image!==void 0&&u.image.depth>1,v=a.depth>1&&(e.useArrayDepthTexture||e.multiview||x);u===void 0&&f&&(u=new ls,u.format=e.stencilBuffer?eo:vs,u.type=e.stencilBuffer?Vo:pi,u.image.width=l,u.image.height=c,u.image.depth=a.depth,u.renderTarget=e,s[t]=u),u&&(u.isArrayTexture=v),(n.width!==a.width||a.height!==n.height)&&(p=!0,u&&(u.needsUpdate=!0,u.image.width=l,u.image.height=c,u.image.depth=v?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&&(p=!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];p&&(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=zi}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 p=f&&f.changedElements;for(let x of u)(!p||p.includes(x.image))&&(x.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)je("Renderer: Texture marked for update but image is undefined.");else if(c.complete===!1)je("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){let f=[];for(let p of e.images)f.push(p);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&&sn.enabled===!0&&sn.getTransfer(e.colorSpace)!==Bt&&je("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=sve){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)}}},cb=class extends Ut{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)}},WM=class extends ib{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 tee(i,e=null,t=null){if(e&&e.isNode){let n=e;e=()=>n}return new WM(new Map([[i,e]]),t)}Be("overrideNode",(i,e,t)=>tee(e,t,i));function nee(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 WM(t,e)}Be("overrideNodes",(i,e)=>nee(e,i));var jM=class extends fi{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):(Ge(`TSL: Member "${t}" not found in struct "${n}".`,new Ur),s="float"),s}getHash(){return String(this.id)}generate(){return this.name}},ove=(i,e)=>new jM(i,e),pO=class extends $t{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 Ge("TSL: Invalid node added to stack.",new Ur),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 b1(t);return this._currentCond=Qo(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=new b1(t),r=Qo(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new b1(e),this}Switch(e){return this._expressionNode=Vt(e),this}Case(...e){let t=[];if(e.length>=2)for(let a=0;a<e.length-1;a++)t.push(this._expressionNode.equal(Vt(e[a])));else Ge("TSL: Invalid parameter length. Case() requires at least two parameters.",new Ur);let n=e[e.length-1],r=new b1(n),s=t[0];for(let a=1;a<t.length;a++)s=s.or(t[a]);let o=Qo(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=v7(),r=e.buildStage;tb(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 tb(n),e.removeActiveStack(this),s}},AM=Hn(pO).setParameterLength(0,1);function ave(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 AO=class extends $t{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=ave(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let n of this.membersLayout){let r=n.type,s=exe(r),o=txe(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)}},mO=class extends $t{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}},lve=(i,e=null)=>{let t=new AO(i,e);return y7((...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 mO(t,s)},t)},XM=class extends $t{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}},cve=Hn(XM),$M=class{constructor(e=os){this.blending=e,this.blendSrc=jd,this.blendDst=Xd,this.blendEquation=Gs,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)}},uve=new $M(Yr),hve=new $M(t2);function iee(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}var gO=class extends XM{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:hve},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||uve}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=ree(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=iee(s,o);if(a===-1)continue;let l=e.getOutputType(a);r[a]=t[o].convert(l)}return this.members=r,super.setup(e)}},ree=Hn(gO),Um=class extends pr{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)} )`}},see=lt(Um).setParameterLength(2),fve=i=>new Um(i,"int","float"),oee=i=>new Um(i,"uint","float"),dve=i=>new Um(i,"float","int"),pve=i=>new Um(i,"float","uint"),GE={},lu=class i extends Re{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,n){n==="int"?t.assign(see(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return it;case"int":return fe;case"uvec2":return b7;case"uvec3":return Vm;case"uvec4":return E7;case"ivec2":return wr;case"ivec3":return w7;case"ivec4":return T7}}_createTrailingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return Ae(([s])=>{let o=it(0);this._resolveElementType(s,o,t);let a=se(o.bitAnd(B7(o))),c=oee(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 Ae(([s])=>{Wt(s.equal(it(0)),()=>it(32));let o=it(0),a=it(0);return this._resolveElementType(s,o,t),Wt(o.shiftRight(16).equal(0),()=>{a.addAssign(16),o.shiftLeftAssign(16)}),Wt(o.shiftRight(24).equal(0),()=>{a.addAssign(8),o.shiftLeftAssign(8)}),Wt(o.shiftRight(28).equal(0),()=>{a.addAssign(4),o.shiftLeftAssign(4)}),Wt(o.shiftRight(30).equal(0),()=>{a.addAssign(2),o.shiftLeftAssign(2)}),Wt(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 Ae(([s])=>{let o=it(0);this._resolveElementType(s,o,t),o.assign(o.sub(o.shiftRight(it(1)).bitAnd(it(1431655765)))),o.assign(o.bitAnd(it(858993459)).add(o.shiftRight(it(2)).bitAnd(it(858993459))));let a=o.add(o.shiftRight(it(4))).bitAnd(it(252645135)).mul(it(16843009)).shiftRight(it(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 Ae(([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=GE[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}}GE[l]=u}let f=GE[c];return f===void 0&&(f=this._createMainLayout(c,s,a,u),GE[c]=f),Ae(()=>f(n))()}};lu.COUNT_TRAILING_ZEROS="countTrailingZeros";lu.COUNT_LEADING_ZEROS="countLeadingZeros";lu.COUNT_ONE_BITS="countOneBits";var Ave=lt(lu,lu.COUNT_TRAILING_ZEROS).setParameterLength(1),mve=lt(lu,lu.COUNT_LEADING_ZEROS).setParameterLength(1),gve=lt(lu,lu.COUNT_ONE_BITS).setParameterLength(1),_ve=Ae(([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)}),_O=(i,e)=>pc(bn(4,i.mul(ni(1,i))),e),xve=(i,e)=>i.lessThan(.5)?_O(i.mul(2),e).div(2):ni(1,_O(bn(ni(1,i),2),e).div(2)),yve=(i,e,t)=>pc(Dl(pc(i,e),fs(pc(i,e),pc(ni(1,i),t))),1/e),vve=(i,e)=>Ta(MM.mul(e.mul(i).sub(1))).div(MM.mul(e.mul(i).sub(1))),ub=class extends pr{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)})`}},bve=lt(ub,"snorm").setParameterLength(1),wve=lt(ub,"unorm").setParameterLength(1),Sve=lt(ub,"float16").setParameterLength(1),hb=class extends pr{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)})`}},Tve=lt(hb,"snorm").setParameterLength(1),Eve=lt(hb,"unorm").setParameterLength(1),Mve=lt(hb,"float16").setParameterLength(1),Yf=Ae(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),Cve=Ae(([i])=>pe(Yf(i.z.add(Yf(i.y.mul(1)))),Yf(i.z.add(Yf(i.x.mul(1)))),Yf(i.y.add(Yf(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Rve=Ae(([i,e,t])=>{let n=pe(i).toVar(),r=se(1.4).toVar(),s=se(0).toVar(),o=pe(n).toVar();return Ri({start:se(0),end:se(3),type:"float",condition:"<="},()=>{let a=pe(Cve(o.mul(2))).toVar();n.addAssign(a.add(t.mul(se(.1).mul(e)))),o.mulAssign(1.8),r.mulAssign(1.5),n.mulAssign(1.2);let l=se(Yf(n.z.add(Yf(n.x.add(Yf(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"}]}),xO=class extends $t{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 p=t[f],x=c[f];p.getNodeType(e)===x.type&&u++}u>s&&(r=o,s=u)}}this._candidateFn=n=r}return n}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}},Pve=Hn(xO),Co=i=>(...e)=>Pve(i,...e),q1=Ht(0).setGroup(Zt).onRenderUpdate(i=>i.time),Ive=Ht(0).setGroup(Zt).onRenderUpdate(i=>i.deltaTime),aee=Ht(0,"uint").setGroup(Zt).onRenderUpdate(i=>i.frameId),Nve=(i=q1)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),Lve=(i=q1)=>i.fract().round(),Dve=(i=q1)=>i.add(.5).fract().mul(2).sub(1).abs(),Fve=(i=q1)=>i.fract();function Ove(i,e=null){return id(e,{getUV:typeof i=="function"?i:()=>i})}var Bve=Ae(([i,e,t=ft(.5)])=>Sb(i.sub(t),e).add(t)),Uve=Ae(([i,e,t=ft(.5)])=>{let n=i.sub(t),r=n.dot(n),o=r.mul(r).mul(e);return i.add(n.mul(o))}),kve=Ae(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=Ac.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=Ac;let r=A0.mul(n);return P1(e)&&(r[0][0]=Ac[0].length(),r[0][1]=0,r[0][2]=0),P1(t)&&(r[1][0]=0,r[1][1]=Ac[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Ma.mul(r).mul(fr)}),Gve=Ae(([i=null])=>{let e=OM();return OM(wU(i)).sub(e).lessThan(0).select(iu,i)}),zve=Ae(([i,e=Pi(),t=se(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=ft(o,a);return e.add(c).mul(l)}),lee=Ae(([i,e=null,t=null,n=se(1),r=fr,s=ta])=>{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,p=t!==null?t.value:u,x=ai(u,a).mul(o.x),v=ai(f,l).mul(o.y),w=ai(p,c).mul(o.z);return fs(x,v,w)}),Vve=(...i)=>lee(...i),a1=new la,dm=new ie,l1=new ie,u8=new ie,Pv=new on,zE=new ie(0,0,-1),xh=new gn,Iv=new ie,VE=new ie,Nv=new gn,qE=new Oe,YM=new ua,qve=iu.flipX();YM.depthTexture=new ls(1,1);var HE=!1,yO=class i extends xc{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||YM.texture,qve),this._reflectorBaseNode=e.reflector||new vO(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:YM.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()}},vO=class extends $t{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();let{target:n=new Yi,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&&(Kn('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?_n.RENDER:_n.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){let n=this.resolutionScale;t.getDrawingBufferSize(qE),e.setSize(Math.round(qE.width*n),Math.round(qE.height*n))}setup(e){return this._updateResolution(YM,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 ua(0,0,{type:Di,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=rL,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new ls),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&HE)return!1;HE=!0;let{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(qE),this._updateResolution(l,r),l1.setFromMatrixPosition(o.matrixWorld),u8.setFromMatrixPosition(n.matrixWorld),Pv.extractRotation(o.matrixWorld),dm.set(0,0,1),dm.applyMatrix4(Pv),Iv.subVectors(l1,u8);let c=Iv.dot(dm)>0,u=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){HE=!1;return}u=!0}Iv.reflect(dm).negate(),Iv.add(l1),Pv.extractRotation(n.matrixWorld),zE.set(0,0,-1),zE.applyMatrix4(Pv),zE.add(u8),VE.subVectors(l1,zE),VE.reflect(dm).negate(),VE.add(l1),a.coordinateSystem=n.coordinateSystem,a.position.copy(Iv),a.up.set(0,1,0),a.up.applyMatrix4(Pv),a.up.reflect(dm),a.lookAt(VE),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),a1.setFromNormalAndCoplanarPoint(dm,l1),a1.applyMatrix4(a.matrixWorldInverse),xh.set(a1.normal.x,a1.normal.y,a1.normal.z,a1.constant);let f=a.projectionMatrix;Nv.x=(Math.sign(xh.x)+f.elements[8])/f.elements[0],Nv.y=(Math.sign(xh.y)+f.elements[9])/f.elements[5],Nv.z=-1,Nv.w=(1+f.elements[10])/f.elements[14],xh.multiplyScalar(1/xh.dot(Nv));let p=0;f.elements[2]=xh.x,f.elements[6]=xh.y,f.elements[10]=r.coordinateSystem===Ha?xh.z-p:xh.z+1-p,f.elements[14]=xh.w,this.textureNode.value=l.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=l.depthTexture),s.visible=!1;let x=r.getRenderTarget(),v=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(v),r.setRenderTarget(x),r.autoClear=w,s.visible=!0,HE=!1,this.forceUpdate=!1}get resolution(){return Kn('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){Kn('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}},Hve=i=>new yO(i),h8=new Hc(-1,1,1,-1,0,1),bO=class extends qn{constructor(e=!1){super();let t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Rn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Rn(t,2))}},Wve=new bO,fb=class extends Gn{constructor(e=null){super(Wve,e),this.camera=h8,this.isQuadMesh=!0}async renderAsync(e){Kn('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,h8)}render(e){e.render(this,h8)}},jve=new Oe,wO=class extends xc{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Di}){let s=new ua(t,n,r);super(s.texture,Pi()),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 fb(new Ar),this.updateBeforeType=_n.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(jve),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 xc(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},cee=(i,...e)=>new wO(Vt(i),...e),Xve=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():cee(i,...e),v1=Ae(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===Ha?(i=ft(i.x,i.y.oneMinus()).mul(2).sub(1),r=Lt(pe(i,e),1)):r=Lt(pe(i.x,i.y.oneMinus(),e).mul(2).sub(1),1);let s=Lt(t.mul(r));return s.xyz.div(s.w)}),$ve=Ae(([i,e])=>{let t=e.mul(Lt(i,1)),n=t.xy.div(t.w).mul(.5).add(.5).toVar();return ft(n.x,n.y.oneMinus())}),Yve=Ae(([i,e,t])=>{let n=Dm(es(e)),r=wr(i.mul(n)).toVar(),s=es(e,r).toVar(),o=es(e,r.sub(wr(2,0))).toVar(),a=es(e,r.sub(wr(1,0))).toVar(),l=es(e,r.add(wr(1,0))).toVar(),c=es(e,r.add(wr(2,0))).toVar(),u=es(e,r.add(wr(0,2))).toVar(),f=es(e,r.add(wr(0,1))).toVar(),p=es(e,r.sub(wr(0,1))).toVar(),x=es(e,r.sub(wr(0,2))).toVar(),v=Ji(ni(se(2).mul(a).sub(o),s)).toVar(),w=Ji(ni(se(2).mul(l).sub(c),s)).toVar(),S=Ji(ni(se(2).mul(f).sub(u),s)).toVar(),T=Ji(ni(se(2).mul(p).sub(x),s)).toVar(),P=v1(i,s,t).toVar(),R=v.lessThan(w).select(P.sub(v1(i.sub(ft(se(1).div(n.x),0)),a,t)),P.negate().add(v1(i.add(ft(se(1).div(n.x),0)),l,t))),C=S.lessThan(T).select(P.sub(v1(i.add(ft(0,se(1).div(n.y))),f,t)),P.negate().add(v1(i.sub(ft(0,se(1).div(n.y))),p,t)));return Jo(ed(R,C))}),IU=Ae(([i])=>su(se(52.9829189).mul(su(_c(i,ft(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),nu=Ae(([i,e,t])=>{let n=se(2.399963229728653),r=Ca(se(i).add(.5).div(se(e))),s=se(i).mul(n).add(t);return ft(tu(s),Ta(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]}),SO=class extends $t{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(Pi())}sample(e){return this.callback(e)}},Zve=(i,e=null)=>new SO(i,Vt(e)),km=class extends ml{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},TO=class extends Li{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},Kve=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=mM("float")):(t=UZ(e),n=mM(e));let r=new TO(i,t,n);return a0(r,e,i)},Qve=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=mM("float")):(t=UZ(e),n=mM(e));let r=new km(i,t,n);return a0(r,e,r.count)},EO=class extends $t{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}},Jve=xt(EO),f8=new on,uee=Ht(0).setGroup(Zt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),MO=Ht(1).setGroup(Zt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),hee=Ht(new on).setGroup(Zt).onRenderUpdate(({scene:i})=>{let e=i.background;return e!==null&&e.isTexture&&e.mapping!==_2||i.backgroundNode&&i.backgroundNode.isNode?f8.makeRotationFromEuler(i.backgroundRotation).transpose():f8.identity(),f8}),ZM=class extends xc{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=Eo.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(Eo.READ_WRITE)}toReadOnly(){return this.setAccess(Eo.READ_ONLY)}toWriteOnly(){return this.setAccess(Eo.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}},fee=Hn(ZM).setParameterLength(1,3),ebe=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?n=i.store(e,t):(n=fee(i,e,t),t!==null&&n.toStack()),n},CO=class extends ZM{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")}},tbe=Hn(CO).setParameterLength(1,3),nbe=Ae(({texture:i,uv:e})=>{let n=pe().toVar();return Wt(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()}),RO=class extends xc{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 nbe({texture:this,uv:e})}},NU=Hn(RO).setParameterLength(1,3),ibe=(...i)=>NU(...i).setSampler(!1),rbe=(i,e,t)=>NU(i,e).level(t),PO=class extends L1{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}},sbe=(i,e,t)=>new PO(i,e,t),iZ=new WeakMap,IO=class extends pr{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=_n.OBJECT,this.updateAfterType=_n.OBJECT,this.previousModelWorldMatrix=Ht(new on),this.previousProjectionMatrix=Ht(new on).setGroup(Zt),this.previousCameraViewMatrix=Ht(new on)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){let r=rZ(n);this.previousModelWorldMatrix.value.copy(r);let s=dee(t);s.frameId!==e&&(s.frameId=e,s.previousProjectionMatrix===void 0?(s.previousProjectionMatrix=new on,s.previousCameraViewMatrix=new on,s.currentProjectionMatrix=new on,s.currentCameraViewMatrix=new on,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}){rZ(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?Ma:Ht(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(Ih).mul(fr),r=this.previousProjectionMatrix.mul(t).mul(Om),s=n.xy.div(n.w),o=r.xy.div(r.w);return ni(s,o)}};function dee(i){let e=iZ.get(i);return e===void 0&&(e={},iZ.set(i,e)),e}function rZ(i,e=0){let t=dee(i),n=t[e];return n===void 0&&(t[e]=n=new on,t[e].copy(i.matrixWorld)),n}var obe=xt(IO),abe=Ae(([i,e])=>Ja(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),lbe=Ae(([i,e])=>Ja(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),cbe=Ae(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),ube=Ae(([i,e])=>Xn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),Lm(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),hbe=Ae(([i,e])=>{let t=e.a.add(i.a.mul(e.a.oneMinus()));return Lt(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"}]}),fbe=Ae(([i])=>LU(i.rgb)),dbe=Ae(([i,e=se(1)])=>e.mix(LU(i.rgb),i.rgb).max(0)),pbe=Ae(([i,e=se(0)])=>{let t=fs(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 Xn(i.rgb,n,r).max(0)}),Abe=Ae(([i,e=se(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(_c(t,i.rgb).mul(n.oneMinus()))))).max(0)}),LU=(i,e=pe(sn.getLuminanceCoefficients(new ie)))=>_c(i,e),mbe=Ae(([i,e=pe(1),t=pe(0),n=pe(1),r=se(1),s=pe(sn.getLuminanceCoefficients(new ie,$d))])=>{let o=i.rgb.dot(pe(s)),a=Sr(i.rgb.mul(e).add(t),0),l=a.pow(n);return Wt(a.r.greaterThan(0),()=>{a.r.assign(l.r)}),Wt(a.g.greaterThan(0),()=>{a.g.assign(l.g)}),Wt(a.b.greaterThan(0),()=>{a.b.assign(l.b)}),a.assign(o.add(a.sub(o).mul(r)).max(0)),Lt(a.rgb,i.a)}),gbe=Ae(([i,e])=>i.mul(e).floor().div(e)),WE=null,NO=class extends D1{static get type(){return"ViewportSharedTextureNode"}constructor(e=iu,t=null){WE===null&&(WE=new TA),super(e,t,WE)}getTextureForReference(){return WE}updateReference(){return this}},_be=Hn(NO).setParameterLength(0,2),jE=new Oe,KM=class extends xc{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)}},QM=class extends KM{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}},Fh=class i extends pr{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 ua(this._width,this._height,{type:Di,...r});s.texture.name="output";let o=null;(this.scope===i.DEPTH||r.depthBuffer!==!1)&&(o=new ls,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=Ht(0),this._cameraFar=Ht(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=_n.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return je("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return je("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 QM(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 QM(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=$C(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=Rm(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=Zi),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),jE.set(s.width,s.height)):(r=this.camera,t.getDrawingBufferSize(jE)),this.setSize(jE.width,jE.height);let o=t.getRenderTarget(),a=t.getMRT(),l=t.autoClear,c=t.transparent,u=t.opaque,f=r.layers.mask,p=t.contextNode,x=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:id({...t.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),t.contextNode=this._contextNodeCache.context);let v=n.name;n.name=this.name?this.name:n.name,t.render(n,r),n.name=v,n.overrideMaterial=x,t.setRenderTarget(o),t.setMRT(a),t.autoClear=l,t.transparent=c,t.opaque=u,t.contextNode=p,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 gn),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 gn),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,n,r))}dispose(){this.renderTarget.dispose()}};Fh.COLOR="color";Fh.DEPTH="depth";var xbe=(i,e,t)=>new Fh(Fh.COLOR,i,e,t),ybe=(i,e)=>new KM(i,e),vbe=(i,e,t)=>new Fh(Fh.DEPTH,i,e,t),LO=class extends Fh{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Fh.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 p=this._getOutlineMaterial(l);t.renderObject(r,s,o,a,p,c,u,f)}t.renderObject(r,s,o,a,l,c,u,f)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){let e=new Ar;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=ui;let t=ta.negate(),n=Ma.mul(Ih),r=se(1),s=n.mul(Lt(fr,1)),o=n.mul(Lt(fr.add(t),1)),a=Jo(s.sub(o));return e.vertexNode=s.add(a.mul(this.thicknessNode).mul(s.w).mul(r)),e.colorNode=Lt(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}},bbe=(i,e,t=new Ut(0,0,0),n=.003,r=1)=>new LO(i,e,Vt(t),Vt(n),Vt(r)),pee=Ae(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Aee=Ae(([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"}]}),mee=Ae(([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"}]}),wbe=Ae(([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)}),gee=Ae(([i,e])=>{let t=so(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=so(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=wbe(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Sbe=so(pe(1.6605,-.1246,-.0182),pe(-.5876,1.1329,-.1006),pe(-.0728,-.0083,1.1187)),Tbe=so(pe(.6274,.0691,.0164),pe(.3293,.9195,.088),pe(.0433,.0113,.8956)),Ebe=Ae(([i])=>{let e=pe(i).toVar(),t=pe(e.mul(e)).toVar(),n=pe(t.mul(t)).toVar();return se(15.5).mul(n.mul(t)).sub(bn(40.14,n.mul(e))).add(bn(31.96,n).sub(bn(6.868,t.mul(e))).add(bn(.4298,t).add(bn(.1191,e).sub(.00232))))}),_ee=Ae(([i,e])=>{let t=pe(i).toVar(),n=so(pe(.856627153315983,.137318972929847,.11189821299995),pe(.0951212405381588,.761241990602591,.0767994186031903),pe(.0482516061458583,.101439036467562,.811302368396859)),r=so(pe(1.1271005818144368,-.1413297634984383,-.14132976349843826),pe(-.11060664309660323,1.157823702216272,-.11060664309660294),pe(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=se(-12.47393),o=se(4.026069);return t.mulAssign(e),t.assign(Tbe.mul(t)),t.assign(n.mul(t)),t.assign(Sr(t,1e-10)),t.assign(Th(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(ou(t,0,1)),t.assign(Ebe(t)),t.assign(r.mul(t)),t.assign(pc(Sr(pe(0),t),pe(2.2))),t.assign(Sbe.mul(t)),t.assign(ou(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),xee=Ae(([i,e])=>{let t=se(.76),n=se(.15);i=i.mul(e);let r=Ja(i.r,Ja(i.g,i.b)),s=Qo(r.lessThan(.08),r.sub(bn(6.25,r.mul(r))),.04);i.subAssign(s);let o=Sr(i.r,Sr(i.g,i.b));Wt(o.lessThan(t),()=>i);let a=ni(1,t),l=ni(1,a.mul(a).div(o.add(a.sub(t))));i.mulAssign(l.div(o));let c=ni(1,Dl(1,n.mul(o.sub(l)).add(1)));return Xn(i,pe(l),c)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Qi=class extends $t{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}},JC=Hn(Qi).setParameterLength(1,3),Mbe=(i,e)=>JC(i,e,"js"),Cbe=(i,e)=>JC(i,e,"wgsl"),Rbe=(i,e)=>JC(i,e,"glsl"),JM=class extends Qi{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+`4158-`,t==="property"?a:e.format(`${a}()`,s,t)}},yee=(i,e=[],t="")=>{let n=new JM(i,e,t);return y7((...s)=>n.call(...s),n)},Pbe=(i,e)=>yee(i,e,"glsl"),Ibe=(i,e)=>yee(i,e,"wgsl");function DU(i){let e,t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||ts.z).negate()}var vee=Ae(([i,e],t)=>{let n=DU(t);return Fl(i,e,n)}),bee=Ae(([i],e)=>{let t=DU(e);return i.mul(i,t,t).negate().exp().oneMinus()}),Nbe=Ae(([i,e],t)=>{let n=DU(t),s=e.sub(Ch.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),DO=Ae(([i,e])=>Lt(e.toFloat().mix(T1.rgb,i.toVec3()),T1.a)),pm=null,Am=null,FO=class extends $t{static get type(){return"RangeNode"}constructor(e=se(),t=se()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){let t=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),r=e.getTypeLength(r0(t.value)),s=e.getTypeLength(r0(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 IM('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(r0(o)),c=e.getTypeLength(r0(a));pm=pm||new gn,Am=Am||new gn,pm.setScalar(0),Am.setScalar(0),l===1?pm.setScalar(o):o.isColor?pm.set(o.r,o.g,o.b,1):pm.set(o.x,o.y,o.z||0,o.w||0),c===1?Am.setScalar(a):a.isColor?Am.set(a.r,a.g,a.b,1):Am.set(a.x,a.y,a.z||0,a.w||0);let u=4,f=u*t.count,p=new Float32Array(f);for(let w=0;w<f;w++){let S=w%u,T=pm.getComponent(S),P=Am.getComponent(S);p[w]=Xc.lerp(T,P,Math.random())}let x=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=z1(p,"vec4",t.count).element(ru).convert(x);else{let w=new ml(p,4);e.geometry.setAttribute("__range"+this.id,w),n=qC(w).convert(x)}}else n=se(0);return n}},Lbe=Hn(FO).setParameterLength(2),OO=class extends $t{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):(je(`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}},Tb=(i,e)=>new OO(i,e),Dbe=Tb("numWorkgroups","uvec3"),Fbe=Tb("workgroupId","uvec3"),Obe=Tb("globalId","uvec3"),Bbe=Tb("localId","uvec3"),Ube=Tb("subgroupSize","uint"),BO=class extends $t{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 4159-`):e.addLineFlowCode(`${t}Barrier()`,this)}},FU=Hn(BO),kbe=()=>FU("workgroup").toStack(),Gbe=()=>FU("storage").toStack(),zbe=()=>FU("texture").toStack(),UO=class extends Jf{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}},kO=class extends $t{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 je('TSL: "label()" has been deprecated. Use "setName()" instead.',new Ur),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new UO(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)}},Vbe=(i,e)=>new kO("Workgroup",i,e),ps=class extends $t{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=Il(u,s).toConst()),t.constNode.build(e)}};ps.ATOMIC_LOAD="atomicLoad";ps.ATOMIC_STORE="atomicStore";ps.ATOMIC_ADD="atomicAdd";ps.ATOMIC_SUB="atomicSub";ps.ATOMIC_MAX="atomicMax";ps.ATOMIC_MIN="atomicMin";ps.ATOMIC_AND="atomicAnd";ps.ATOMIC_OR="atomicOr";ps.ATOMIC_XOR="atomicXor";var qbe=Hn(ps),Bh=(i,e,t)=>qbe(i,e,t).toStack(),Hbe=i=>Bh(ps.ATOMIC_LOAD,i,null),Wbe=(i,e)=>Bh(ps.ATOMIC_STORE,i,e),jbe=(i,e)=>Bh(ps.ATOMIC_ADD,i,e),Xbe=(i,e)=>Bh(ps.ATOMIC_SUB,i,e),$be=(i,e)=>Bh(ps.ATOMIC_MAX,i,e),Ybe=(i,e)=>Bh(ps.ATOMIC_MIN,i,e),Zbe=(i,e)=>Bh(ps.ATOMIC_AND,i,e),Kbe=(i,e)=>Bh(ps.ATOMIC_OR,i,e),Qbe=(i,e)=>Bh(ps.ATOMIC_XOR,i,e),Ft=class i extends pr{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}};Ft.SUBGROUP_ELECT="subgroupElect";Ft.SUBGROUP_BALLOT="subgroupBallot";Ft.SUBGROUP_ADD="subgroupAdd";Ft.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd";Ft.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd";Ft.SUBGROUP_MUL="subgroupMul";Ft.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul";Ft.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul";Ft.SUBGROUP_AND="subgroupAnd";Ft.SUBGROUP_OR="subgroupOr";Ft.SUBGROUP_XOR="subgroupXor";Ft.SUBGROUP_MIN="subgroupMin";Ft.SUBGROUP_MAX="subgroupMax";Ft.SUBGROUP_ALL="subgroupAll";Ft.SUBGROUP_ANY="subgroupAny";Ft.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst";Ft.QUAD_SWAP_X="quadSwapX";Ft.QUAD_SWAP_Y="quadSwapY";Ft.QUAD_SWAP_DIAGONAL="quadSwapDiagonal";Ft.SUBGROUP_BROADCAST="subgroupBroadcast";Ft.SUBGROUP_SHUFFLE="subgroupShuffle";Ft.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor";Ft.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp";Ft.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown";Ft.QUAD_BROADCAST="quadBroadcast";var Jbe=lt(Ft,Ft.SUBGROUP_ELECT).setParameterLength(0),ewe=lt(Ft,Ft.SUBGROUP_BALLOT).setParameterLength(1),twe=lt(Ft,Ft.SUBGROUP_ADD).setParameterLength(1),nwe=lt(Ft,Ft.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),iwe=lt(Ft,Ft.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),rwe=lt(Ft,Ft.SUBGROUP_MUL).setParameterLength(1),swe=lt(Ft,Ft.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),owe=lt(Ft,Ft.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),awe=lt(Ft,Ft.SUBGROUP_AND).setParameterLength(1),lwe=lt(Ft,Ft.SUBGROUP_OR).setParameterLength(1),cwe=lt(Ft,Ft.SUBGROUP_XOR).setParameterLength(1),uwe=lt(Ft,Ft.SUBGROUP_MIN).setParameterLength(1),hwe=lt(Ft,Ft.SUBGROUP_MAX).setParameterLength(1),fwe=lt(Ft,Ft.SUBGROUP_ALL).setParameterLength(0),dwe=lt(Ft,Ft.SUBGROUP_ANY).setParameterLength(0),pwe=lt(Ft,Ft.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),Awe=lt(Ft,Ft.QUAD_SWAP_X).setParameterLength(1),mwe=lt(Ft,Ft.QUAD_SWAP_Y).setParameterLength(1),gwe=lt(Ft,Ft.QUAD_SWAP_DIAGONAL).setParameterLength(1),_we=lt(Ft,Ft.SUBGROUP_BROADCAST).setParameterLength(2),xwe=lt(Ft,Ft.SUBGROUP_SHUFFLE).setParameterLength(2),ywe=lt(Ft,Ft.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),vwe=lt(Ft,Ft.SUBGROUP_SHUFFLE_UP).setParameterLength(2),bwe=lt(Ft,Ft.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),wwe=lt(Ft,Ft.QUAD_BROADCAST).setParameterLength(1),XE;function eR(i){XE=XE||new WeakMap;let e=XE.get(i);return e===void 0&&XE.set(i,e={}),e}function tR(i){let e=eR(i);return e.shadowMatrix||(e.shadowMatrix=Ht("mat4").setGroup(Zt).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 wee(i,e=Ch){let t=tR(i).mul(e);return t.xyz.div(t.w)}function OU(i){let e=eR(i);return e.position||(e.position=Ht(new ie).setGroup(Zt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function See(i){let e=eR(i);return e.targetPosition||(e.targetPosition=Ht(new ie).setGroup(Zt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function BU(i){let e=eR(i);return e.viewPosition||(e.viewPosition=Ht(new ie).setGroup(Zt).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new ie,n.value.setFromMatrixPosition(i.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}var UU=i=>A0.transformDirection(OU(i).sub(See(i))),Swe=nd("vec3","totalDiffuse"),Twe=nd("vec3","totalSpecular"),Ewe=nd("vec3","outgoingLight"),Mwe=i=>i.sort((e,t)=>e.id-t.id),Cwe=(i,e)=>{for(let t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},d8=new WeakMap,Lv=[],db=class extends $t{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=Swe,this.totalSpecularNode=Twe,this.outgoingLightNode=Ewe,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let n=0;n<e.length;n++){let r=e[n];if(Lv.push(r.id),Lv.push(r.castShadow?1:0),r.isSpotLight===!0){let s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;Lv.push(s,o)}}let t=vb(Lv);return Lv.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=Mwe([...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=Cwe(l.id,r)),c===null){let u=a.getLightNodeClass(l.constructor);if(u===null){je(`LightsNode.setupNodeLights: Light node not found for ${l.constructor.name}`);continue}d8.has(l)===!1&&d8.set(l,new u(l)),c=d8.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:p,directSpecular:x,indirectDiffuse:v,indirectSpecular:w}=r.reflectedLight,S=p.add(v);u!==null&&(f!==null?S=pe(f.mix(S,u)):S=pe(u)),a.assign(S),l.assign(x.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}},Rwe=(i=[])=>new db().setLights(i),GO=class extends $t{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=_n.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){kU.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||Ch)}},kU=nd("vec3","shadowPositionWorld");function Pwe(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 Ut),e.clearAlpha=i.getClearAlpha(),e.autoClear=i.autoClear,e.scissorTest=i.getScissorTest(),e}function Iwe(i,e){return e=Pwe(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function Nwe(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 Lwe(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function Dwe(i,e){return e=Lwe(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function Fwe(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function Owe(i,e,t){return t=Iwe(i,t),t=Dwe(e,t),t}function Bwe(i,e,t){Nwe(i,t),Fwe(e,t)}var eC=new WeakMap,Tee=Ae(({depthTexture:i,shadowCoord:e,depthLayer:t})=>{let n=ai(i,e.xy).setName("t_basic");return i.isArrayTexture&&(n=n.depth(t)),n.compare(e.z)}),Eee=Ae(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=(u,f)=>{let p=ai(i,u);return i.isArrayTexture&&(p=p.depth(n)),p.compare(f)},s=nr("mapSize","vec2",t).setGroup(Zt),o=nr("radius","float",t).setGroup(Zt),a=ft(1).div(s),l=o.mul(a.x),c=IU(Hm.xy).mul(6.28318530718);return fs(r(e.xy.add(nu(0,5,c).mul(l)),e.z),r(e.xy.add(nu(1,5,c).mul(l)),e.z),r(e.xy.add(nu(2,5,c).mul(l)),e.z),r(e.xy.add(nu(3,5,c).mul(l)),e.z),r(e.xy.add(nu(4,5,c).mul(l)),e.z)).mul(1/5)}),Mee=Ae(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=nr("mapSize","vec2",t).setGroup(Zt),s=ft(1).div(r),o=e.xy,a=su(o.mul(r).add(.5)).toConst();o.subAssign(a.sub(.5).mul(s));let l=x=>{let v=ai(i,o).offset(x).gather();return i.isArrayTexture&&(v=v.depth(n)),v.compare(e.z)},c=l(wr(-1,1)).toConst(),u=l(wr(1,1)).toConst(),f=l(wr(-1,-1)).toConst(),p=l(wr(1,-1)).toConst();return fs(Xn(c.x,u.y,a.x).add(c.y).add(u.x).mul(a.y),Xn(c.w,u.z,a.x).add(c.z).add(u.w),Xn(f.x,p.y,a.x).add(f.y).add(p.x),Xn(f.w,p.z,a.x).add(f.z).add(p.w).mul(a.y.oneMinus())).mul(1/9)}),Cee=Ae(({depthTexture:i,shadowCoord:e,depthLayer:t},n)=>{let r=ai(i).sample(e.xy);i.isArrayTexture&&(r=r.depth(t)),r=r.rg;let s=r.x,o=Sr(1e-7,r.y.mul(r.y)),a=n.renderer.reversedDepthBuffer?Lm(s,e.z):Lm(e.z,s),l=se(1).toVar();return Wt(a.notEqual(1),()=>{let c=e.z.sub(s),u=o.div(o.add(c.mul(c)));u=ou(ni(u,.3).div(.65)),l.assign(Sr(a,u))}),l}),Ree=i=>{let e=eC.get(i);return e===void 0&&(e=new Ar,e.colorNode=Lt(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=Yr,e.fog=!1,eC.set(i,e)),e},Pee=i=>{let e=eC.get(i);e!==void 0&&(e.dispose(),eC.delete(i))},sZ=new Lh,c1=[],Iee=(i,e,t,n)=>{c1[0]=i,c1[1]=e;let r=sZ.get(c1);return(r===void 0||r.shadowType!==t||r.useVelocity!==n)&&(r=(s,o,a,l,c,u,f,p,x)=>{(s.castShadow===!0||s.receiveShadow&&t===tc)&&(n&&(kZ(s).useVelocity=!0),s.onBeforeShadow(i,s,a,e.camera,l,o.overrideMaterial,u),i.renderObject(s,o,a,l,c,u,f,p,x),s.onAfterShadow(i,s,a,e.camera,l,o.overrideMaterial,u))},r.shadowType=t,r.useVelocity=n,sZ.set(c1,r)),c1[0]=null,c1[1]=null,r},Uwe=Ae(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=se(0).toVar("meanVertical"),o=se(0).toVar("squareMeanVertical"),a=i.lessThanEqual(se(1)).select(se(0),se(2).div(i.sub(1))),l=i.lessThanEqual(se(1)).select(se(0),se(-1));Ri({start:fe(0),end:fe(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(se(u).mul(a)),p=n.sample(fs(Hm.xy,ft(0,f).mul(e)).div(t));n.value.isArrayTexture&&(p=p.depth(r)),p=p.x,s.addAssign(p),o.addAssign(p.mul(p))}),s.divAssign(i),o.divAssign(i);let c=Ca(o.sub(s.mul(s)).max(0));return ft(s,c)}),kwe=Ae(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=se(0).toVar("meanHorizontal"),o=se(0).toVar("squareMeanHorizontal"),a=i.lessThanEqual(se(1)).select(se(0),se(2).div(i.sub(1))),l=i.lessThanEqual(se(1)).select(se(0),se(-1));Ri({start:fe(0),end:fe(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(se(u).mul(a)),p=n.sample(fs(Hm.xy,ft(f,0).mul(e)).div(t));n.value.isArrayTexture&&(p=p.depth(r)),s.addAssign(p.x),o.addAssign(fs(p.y.mul(p.y),p.x.mul(p.x)))}),s.divAssign(i),o.divAssign(i);let c=Ca(o.sub(s.mul(s)).max(0));return ft(s,c)}),Gwe=[Tee,Eee,Mee,Cee],p8,$E=new fb,tC=class extends GO{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,se(1))}setupShadowCoord(e,t){let{shadow:n}=this,{renderer:r}=e,s=n.biasNode||nr("bias","float",n).setGroup(Zt),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=nr("near","float",n.camera).setGroup(Zt),u=nr("far","float",n.camera).setGroup(Zt);a=YC(l.negate(),c,u)}return o=pe(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return Gwe[e]}setupRenderTarget(e,t){let n=new ls(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?jc:ih;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(kf.TEXTURE_COMPARE);if((l===sp||l===$T)&&c?(o.minFilter=bi,o.magFilter=bi):(o.minFilter=yi,o.magFilter=yi),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===tc&&s.isPointLightShadow!==!0){o.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ts,type:Di,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:Ts,type:Di,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:Ts,type:Di,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ts,type:Di,depthBuffer:!1}));let D=ai(o);o.isArrayTexture&&(D=D.depth(this.depthLayer));let F=ai(this.vsmShadowMapVertical.texture);o.isArrayTexture&&(F=F.depth(this.depthLayer));let N=nr("blurSamples","float",s).setGroup(Zt),B=nr("radius","float",s).setGroup(Zt),z=nr("mapSize","vec2",s).setGroup(Zt),V=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Ar);V.fragmentNode=Uwe({samples:N,radius:B,size:z,shadowPass:D,depthLayer:this.depthLayer}).context(e.getSharedContext()),V.name="VSMVertical",V=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Ar),V.fragmentNode=kwe({samples:N,radius:B,size:z,shadowPass:F,depthLayer:this.depthLayer}).context(e.getSharedContext()),V.name="VSMHorizontal"}let u=nr("intensity","float",s).setGroup(Zt),f=nr("normalBias","float",s).setGroup(Zt),p=tR(r),x=m0.mul(f),v;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?v=p.mul(kU.add(x)):v=Ht("mat4").onObjectUpdate(({object:F},N)=>N.value.multiplyMatrices(p.value,F.matrixWorld)).mul(fr).add(p.mul(Lt(x,0)));let w=this.setupShadowCoord(e,v),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===tc&&s.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:o,P=this.setupShadowFilter(e,{filterFn:S,shadowTexture:a.texture,depthTexture:T,shadowCoord:w,shadow:s,depthLayer:this.depthLayer}),R;t.shadowMap.transmitted===!0&&(a.texture.isCubeTexture?R=Ea(a.texture,w.xyz):(R=ai(a.texture,w),o.isArrayTexture&&(R=R.depth(this.depthLayer))));let C;R?C=Xn(1,P.rgb.mix(R,1),u.mul(R.a)).toVar():C=Xn(1,P,u).toVar(),this.shadowMap=a,this.shadow.map=a;let L=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return R&&C.toInspector(`${L} / Color`,()=>this.shadowMap.texture.isCubeTexture?Ea(this.shadowMap.texture,NF()):ai(this.shadowMap.texture)),C.toInspector(`${L} / Depth`,()=>{let D=nr("near","float",this.shadow.camera),F=nr("far","float",this.shadow.camera),N;this.shadowMap.texture.isCubeTexture?N=Ea(this.shadowMap.depthTexture,NF()).r:N=ai(this.shadowMap.depthTexture).r;let B;return this.shadow.camera.isPerspectiveCamera?B=$C(N,D,F):B=DJ(N,D,F),B=Rm(B,D,F),B.oneMinus()})}setup(e){if(e.renderer.shadowMap.enabled!==!1)return Ae(()=>{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(),p=s.getMRT(),x=p?p.has("velocity"):!1;p8=Owe(s,o,p8),o.overrideMaterial=Ree(n),s.setRenderObjectFunction(Iee(s,r,l,x)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(f),l===tc&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=u,Bwe(s,o,p8)}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),$E.material=this.vsmMaterialVertical,$E.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),$E.material=this.vsmMaterialHorizontal,$E.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,Pee(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))}},Nee=(i,e)=>new tC(i,e),zwe=new Ut,oZ=new on,Dv=new ie,A8=new ie,Vwe=[new ie(1,0,0),new ie(-1,0,0),new ie(0,-1,0),new ie(0,1,0),new ie(0,0,1),new ie(0,0,-1)],qwe=[new ie(0,-1,0),new ie(0,-1,0),new ie(0,0,-1),new ie(0,0,1),new ie(0,-1,0),new ie(0,-1,0)],Hwe=[new ie(1,0,0),new ie(-1,0,0),new ie(0,1,0),new ie(0,-1,0),new ie(0,0,1),new ie(0,0,-1)],Wwe=[new ie(0,-1,0),new ie(0,-1,0),new ie(0,0,1),new ie(0,0,-1),new ie(0,-1,0),new ie(0,-1,0)],Lee=Ae(({depthTexture:i,bd3D:e,dp:t})=>Ea(i,e).compare(t)),Dee=Ae(({depthTexture:i,bd3D:e,dp:t,shadow:n})=>{let r=nr("radius","float",n).setGroup(Zt),s=nr("mapSize","vec2",n).setGroup(Zt),o=r.div(s.x),a=Ji(e),l=Jo(ed(e,a.x.greaterThan(a.z).select(pe(0,1,0),pe(1,0,0)))),c=ed(e,l),u=IU(Hm.xy).mul(6.28318530718),f=nu(0,5,u),p=nu(1,5,u),x=nu(2,5,u),v=nu(3,5,u),w=nu(4,5,u);return Ea(i,e.add(l.mul(f.x).add(c.mul(f.y)).mul(o))).compare(t).add(Ea(i,e.add(l.mul(p.x).add(c.mul(p.y)).mul(o))).compare(t)).add(Ea(i,e.add(l.mul(x.x).add(c.mul(x.y)).mul(o))).compare(t)).add(Ea(i,e.add(l.mul(v.x).add(c.mul(v.y)).mul(o))).compare(t)).add(Ea(i,e.add(l.mul(w.x).add(c.mul(w.y)).mul(o))).compare(t)).mul(1/5)}),jwe=Ae(({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=Ht("float").setGroup(Zt).onRenderUpdate(()=>n.camera.near),c=Ht("float").setGroup(Zt).onRenderUpdate(()=>n.camera.far),u=nr("bias","float",n).setGroup(Zt),f=se(1).toVar();return Wt(a.sub(c).lessThanEqual(0).and(a.sub(l).greaterThanEqual(0)),()=>{let p;r.renderer.reversedDepthBuffer?(p=FJ(a.negate(),l,c),p.subAssign(u)):r.renderer.logarithmicDepthBuffer?(p=YC(a.negate(),l,c),p.addAssign(u)):(p=SU(a.negate(),l,c),p.addAssign(u));let x=s.normalize();f.assign(i({depthTexture:e,bd3D:x,dp:p,shadow:n}))}),f}),zO=class extends tC{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===nL?Lee:Dee}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return jwe({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){let n=new x_(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?jc:ih;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===Ha,u=c?Vwe:Hwe,f=c?qwe:Wwe;n.setSize(t.mapSize.width,t.mapSize.width);let p=s.autoClear,x=s.getClearColor(zwe),v=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()),Dv.setFromMatrixPosition(r.matrixWorld),a.position.copy(Dv),A8.copy(a.position),A8.add(u[w]),a.up.copy(f[w]),a.lookAt(A8),a.updateMatrixWorld(),l.makeTranslation(-Dv.x,-Dv.y,-Dv.z),oZ.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(oZ,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=p,s.setClearColor(x,v)}},Fee=(i,e)=>new zO(i,e),td=class extends h0{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new Ut,this.colorNode=e&&e.colorNode||Ht(this.color).setGroup(Zt),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=_n.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 BU(this.light).sub(e.context.positionView||ts)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return Nee(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=Vt(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)}},GU=Ae(({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)}),Oee=({color:i,lightVector:e,cutoffDistance:t,decayExponent:n})=>{let r=e.normalize(),s=e.length(),o=GU({lightDistance:s,cutoffDistance:t,decayExponent:n}),a=i.mul(o);return{lightDirection:r,lightColor:a}},VO=class extends td{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Ht(0).setGroup(Zt),this.decayExponentNode=Ht(2).setGroup(Zt)}update(e){let{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return Fee(this.light)}setupDirect(e){return Oee({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},Xwe=Ae(([i=Pi()])=>{let e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),$we=Ae(([i=Pi()],{renderer:e,material:t})=>{let n=H7(i.mul(2).sub(1)),r;if(t.alphaToCoverage&&e.currentSamples>0){let s=se(n.fwidth()).toVar();r=Fl(s.oneMinus(),s.add(1),n).oneMinus()}else r=Qo(n.greaterThan(1),0,1);return r}),Qv=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=Ll(i).toVar();return Qo(s,r,n).uniformFlow()}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),nC=Ae(([i,e])=>{let t=Ll(e).toVar(),n=se(i).toVar();return Qo(t,n.negate(),n).uniformFlow()}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),hs=Ae(([i])=>{let e=se(i).toVar();return fe(Eh(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),dr=Ae(([i,e])=>{let t=se(i).toVar();return e.assign(hs(t)),t.sub(se(e))}),Ywe=Ae(([i,e,t,n,r,s])=>{let o=se(s).toVar(),a=se(r).toVar(),l=se(n).toVar(),c=se(t).toVar(),u=se(e).toVar(),f=se(i).toVar(),p=se(ni(1,a)).toVar();return ni(1,o).mul(f.mul(p).add(u.mul(a))).add(o.mul(c.mul(p).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"}]}),Zwe=Ae(([i,e,t,n,r,s])=>{let o=se(s).toVar(),a=se(r).toVar(),l=pe(n).toVar(),c=pe(t).toVar(),u=pe(e).toVar(),f=pe(i).toVar(),p=se(ni(1,a)).toVar();return ni(1,o).mul(f.mul(p).add(u.mul(a))).add(o.mul(c.mul(p).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"}]}),Bee=Co([Ywe,Zwe]),Kwe=Ae(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=se(u).toVar(),p=se(c).toVar(),x=se(l).toVar(),v=se(a).toVar(),w=se(o).toVar(),S=se(s).toVar(),T=se(r).toVar(),P=se(n).toVar(),R=se(t).toVar(),C=se(e).toVar(),L=se(i).toVar(),D=se(ni(1,x)).toVar(),F=se(ni(1,p)).toVar();return se(ni(1,f)).toVar().mul(F.mul(L.mul(D).add(C.mul(x))).add(p.mul(R.mul(D).add(P.mul(x))))).add(f.mul(F.mul(T.mul(D).add(S.mul(x))).add(p.mul(w.mul(D).add(v.mul(x))))))}).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"}]}),Qwe=Ae(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=se(u).toVar(),p=se(c).toVar(),x=se(l).toVar(),v=pe(a).toVar(),w=pe(o).toVar(),S=pe(s).toVar(),T=pe(r).toVar(),P=pe(n).toVar(),R=pe(t).toVar(),C=pe(e).toVar(),L=pe(i).toVar(),D=se(ni(1,x)).toVar(),F=se(ni(1,p)).toVar();return se(ni(1,f)).toVar().mul(F.mul(L.mul(D).add(C.mul(x))).add(p.mul(R.mul(D).add(P.mul(x))))).add(f.mul(F.mul(T.mul(D).add(S.mul(x))).add(p.mul(w.mul(D).add(v.mul(x))))))}).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"}]}),Uee=Co([Kwe,Qwe]),Jwe=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=it(i).toVar(),o=it(s.bitAnd(it(7))).toVar(),a=se(Qv(o.lessThan(it(4)),r,n)).toVar(),l=se(bn(2,Qv(o.lessThan(it(4)),n,r))).toVar();return nC(a,Ll(o.bitAnd(it(1)))).add(nC(l,Ll(o.bitAnd(it(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),eSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=se(e).toVar(),a=it(i).toVar(),l=it(a.bitAnd(it(15))).toVar(),c=se(Qv(l.lessThan(it(8)),o,s)).toVar(),u=se(Qv(l.lessThan(it(4)),s,Qv(l.equal(it(12)).or(l.equal(it(14))),o,r))).toVar();return nC(c,Ll(l.bitAnd(it(1)))).add(nC(u,Ll(l.bitAnd(it(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"}]}),ro=Co([Jwe,eSe]),tSe=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=Vm(i).toVar();return pe(ro(s.x,r,n),ro(s.y,r,n),ro(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"}]}),nSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=se(e).toVar(),a=Vm(i).toVar();return pe(ro(a.x,o,s,r),ro(a.y,o,s,r),ro(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"}]}),fc=Co([tSe,nSe]),iSe=Ae(([i])=>{let e=se(i).toVar();return bn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),rSe=Ae(([i])=>{let e=se(i).toVar();return bn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),sSe=Ae(([i])=>{let e=pe(i).toVar();return bn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),kee=Co([iSe,sSe]),oSe=Ae(([i])=>{let e=pe(i).toVar();return bn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Gee=Co([rSe,oSe]),Pl=Ae(([i,e])=>{let t=fe(e).toVar(),n=it(i).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(fe(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),zee=Ae(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(Pl(t,fe(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Pl(i,fe(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Pl(e,fe(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(Pl(t,fe(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Pl(i,fe(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Pl(e,fe(4))),e.addAssign(i)}),Eb=Ae(([i,e,t])=>{let n=it(t).toVar(),r=it(e).toVar(),s=it(i).toVar();return n.bitXorAssign(r),n.subAssign(Pl(r,fe(14))),s.bitXorAssign(n),s.subAssign(Pl(n,fe(11))),r.bitXorAssign(s),r.subAssign(Pl(s,fe(25))),n.bitXorAssign(r),n.subAssign(Pl(r,fe(16))),s.bitXorAssign(n),s.subAssign(Pl(n,fe(4))),r.bitXorAssign(s),r.subAssign(Pl(s,fe(14))),n.bitXorAssign(r),n.subAssign(Pl(r,fe(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),ea=Ae(([i])=>{let e=it(i).toVar();return se(e).div(se(it(fe(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),Rh=Ae(([i])=>{let e=se(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"}]}),aSe=Ae(([i])=>{let e=fe(i).toVar(),t=it(it(1)).toVar(),n=it(it(fe(3735928559)).add(t.shiftLeft(it(2))).add(it(13))).toVar();return Eb(n.add(it(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),lSe=Ae(([i,e])=>{let t=fe(e).toVar(),n=fe(i).toVar(),r=it(it(2)).toVar(),s=it().toVar(),o=it().toVar(),a=it().toVar();return s.assign(o.assign(a.assign(it(fe(3735928559)).add(r.shiftLeft(it(2))).add(it(13))))),s.addAssign(it(n)),o.addAssign(it(t)),Eb(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),cSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=fe(e).toVar(),s=fe(i).toVar(),o=it(it(3)).toVar(),a=it().toVar(),l=it().toVar(),c=it().toVar();return a.assign(l.assign(c.assign(it(fe(3735928559)).add(o.shiftLeft(it(2))).add(it(13))))),a.addAssign(it(s)),l.addAssign(it(r)),c.addAssign(it(n)),Eb(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),uSe=Ae(([i,e,t,n])=>{let r=fe(n).toVar(),s=fe(t).toVar(),o=fe(e).toVar(),a=fe(i).toVar(),l=it(it(4)).toVar(),c=it().toVar(),u=it().toVar(),f=it().toVar();return c.assign(u.assign(f.assign(it(fe(3735928559)).add(l.shiftLeft(it(2))).add(it(13))))),c.addAssign(it(a)),u.addAssign(it(o)),f.addAssign(it(s)),zee(c,u,f),c.addAssign(it(r)),Eb(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"}]}),hSe=Ae(([i,e,t,n,r])=>{let s=fe(r).toVar(),o=fe(n).toVar(),a=fe(t).toVar(),l=fe(e).toVar(),c=fe(i).toVar(),u=it(it(5)).toVar(),f=it().toVar(),p=it().toVar(),x=it().toVar();return f.assign(p.assign(x.assign(it(fe(3735928559)).add(u.shiftLeft(it(2))).add(it(13))))),f.addAssign(it(c)),p.addAssign(it(l)),x.addAssign(it(a)),zee(f,p,x),f.addAssign(it(o)),p.addAssign(it(s)),Eb(f,p,x)}).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"}]}),Oi=Co([aSe,lSe,cSe,uSe,hSe]),fSe=Ae(([i,e])=>{let t=fe(e).toVar(),n=fe(i).toVar(),r=it(Oi(n,t)).toVar(),s=Vm().toVar();return s.x.assign(r.bitAnd(fe(255))),s.y.assign(r.shiftRight(fe(8)).bitAnd(fe(255))),s.z.assign(r.shiftRight(fe(16)).bitAnd(fe(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),dSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=fe(e).toVar(),s=fe(i).toVar(),o=it(Oi(s,r,n)).toVar(),a=Vm().toVar();return a.x.assign(o.bitAnd(fe(255))),a.y.assign(o.shiftRight(fe(8)).bitAnd(fe(255))),a.z.assign(o.shiftRight(fe(16)).bitAnd(fe(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),dc=Co([fSe,dSe]),pSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=se(dr(e.x,t)).toVar(),s=se(dr(e.y,n)).toVar(),o=se(Rh(r)).toVar(),a=se(Rh(s)).toVar(),l=se(Bee(ro(Oi(t,n),r,s),ro(Oi(t.add(fe(1)),n),r.sub(1),s),ro(Oi(t,n.add(fe(1))),r,s.sub(1)),ro(Oi(t.add(fe(1)),n.add(fe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return kee(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),ASe=Ae(([i])=>{let e=pe(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=fe().toVar(),s=se(dr(e.x,t)).toVar(),o=se(dr(e.y,n)).toVar(),a=se(dr(e.z,r)).toVar(),l=se(Rh(s)).toVar(),c=se(Rh(o)).toVar(),u=se(Rh(a)).toVar(),f=se(Uee(ro(Oi(t,n,r),s,o,a),ro(Oi(t.add(fe(1)),n,r),s.sub(1),o,a),ro(Oi(t,n.add(fe(1)),r),s,o.sub(1),a),ro(Oi(t.add(fe(1)),n.add(fe(1)),r),s.sub(1),o.sub(1),a),ro(Oi(t,n,r.add(fe(1))),s,o,a.sub(1)),ro(Oi(t.add(fe(1)),n,r.add(fe(1))),s.sub(1),o,a.sub(1)),ro(Oi(t,n.add(fe(1)),r.add(fe(1))),s,o.sub(1),a.sub(1)),ro(Oi(t.add(fe(1)),n.add(fe(1)),r.add(fe(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return Gee(f)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),zU=Co([pSe,ASe]),mSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=se(dr(e.x,t)).toVar(),s=se(dr(e.y,n)).toVar(),o=se(Rh(r)).toVar(),a=se(Rh(s)).toVar(),l=pe(Bee(fc(dc(t,n),r,s),fc(dc(t.add(fe(1)),n),r.sub(1),s),fc(dc(t,n.add(fe(1))),r,s.sub(1)),fc(dc(t.add(fe(1)),n.add(fe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return kee(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),gSe=Ae(([i])=>{let e=pe(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=fe().toVar(),s=se(dr(e.x,t)).toVar(),o=se(dr(e.y,n)).toVar(),a=se(dr(e.z,r)).toVar(),l=se(Rh(s)).toVar(),c=se(Rh(o)).toVar(),u=se(Rh(a)).toVar(),f=pe(Uee(fc(dc(t,n,r),s,o,a),fc(dc(t.add(fe(1)),n,r),s.sub(1),o,a),fc(dc(t,n.add(fe(1)),r),s,o.sub(1),a),fc(dc(t.add(fe(1)),n.add(fe(1)),r),s.sub(1),o.sub(1),a),fc(dc(t,n,r.add(fe(1))),s,o,a.sub(1)),fc(dc(t.add(fe(1)),n,r.add(fe(1))),s.sub(1),o,a.sub(1)),fc(dc(t,n.add(fe(1)),r.add(fe(1))),s,o.sub(1),a.sub(1)),fc(dc(t.add(fe(1)),n.add(fe(1)),r.add(fe(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return Gee(f)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Mb=Co([mSe,gSe]),_Se=Ae(([i])=>{let e=se(i).toVar(),t=fe(hs(e)).toVar();return ea(Oi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),xSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe(hs(e.x)).toVar(),n=fe(hs(e.y)).toVar();return ea(Oi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),ySe=Ae(([i])=>{let e=pe(i).toVar(),t=fe(hs(e.x)).toVar(),n=fe(hs(e.y)).toVar(),r=fe(hs(e.z)).toVar();return ea(Oi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),vSe=Ae(([i])=>{let e=Lt(i).toVar(),t=fe(hs(e.x)).toVar(),n=fe(hs(e.y)).toVar(),r=fe(hs(e.z)).toVar(),s=fe(hs(e.w)).toVar();return ea(Oi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),bSe=Co([_Se,xSe,ySe,vSe]),wSe=Ae(([i])=>{let e=se(i).toVar(),t=fe(hs(e)).toVar();return pe(ea(Oi(t,fe(0))),ea(Oi(t,fe(1))),ea(Oi(t,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),SSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe(hs(e.x)).toVar(),n=fe(hs(e.y)).toVar();return pe(ea(Oi(t,n,fe(0))),ea(Oi(t,n,fe(1))),ea(Oi(t,n,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),TSe=Ae(([i])=>{let e=pe(i).toVar(),t=fe(hs(e.x)).toVar(),n=fe(hs(e.y)).toVar(),r=fe(hs(e.z)).toVar();return pe(ea(Oi(t,n,r,fe(0))),ea(Oi(t,n,r,fe(1))),ea(Oi(t,n,r,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),ESe=Ae(([i])=>{let e=Lt(i).toVar(),t=fe(hs(e.x)).toVar(),n=fe(hs(e.y)).toVar(),r=fe(hs(e.z)).toVar(),s=fe(hs(e.w)).toVar();return pe(ea(Oi(t,n,r,s,fe(0))),ea(Oi(t,n,r,s,fe(1))),ea(Oi(t,n,r,s,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),nR=Co([wSe,SSe,TSe,ESe]),iC=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar(),l=se(0).toVar(),c=se(1).toVar();return Ri(o,()=>{l.addAssign(c.mul(zU(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"}]}),iR=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar(),l=pe(0).toVar(),c=se(1).toVar();return Ri(o,()=>{l.addAssign(c.mul(Mb(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"}]}),MSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar();return ft(iC(a,o,s,r),iC(a.add(pe(fe(19),fe(193),fe(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"}]}),CSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar(),l=pe(iR(a,o,s,r)).toVar(),c=se(iC(a.add(pe(fe(19),fe(193),fe(17))),o,s,r)).toVar();return Lt(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"}]}),RSe=Ae(([i,e,t,n,r,s,o])=>{let a=fe(o).toVar(),l=se(s).toVar(),c=fe(r).toVar(),u=fe(n).toVar(),f=fe(t).toVar(),p=fe(e).toVar(),x=ft(i).toVar(),v=pe(nR(ft(p.add(u),f.add(c)))).toVar(),w=ft(v.x,v.y).toVar();w.subAssign(.5),w.mulAssign(l),w.addAssign(.5);let S=ft(ft(se(p),se(f)).add(w)).toVar(),T=ft(S.sub(x)).toVar();return Wt(a.equal(fe(2)),()=>Ji(T.x).add(Ji(T.y))),Wt(a.equal(fe(3)),()=>Sr(Ji(T.x),Ji(T.y))),_c(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"}]}),PSe=Ae(([i,e,t,n,r,s,o,a,l])=>{let c=fe(l).toVar(),u=se(a).toVar(),f=fe(o).toVar(),p=fe(s).toVar(),x=fe(r).toVar(),v=fe(n).toVar(),w=fe(t).toVar(),S=fe(e).toVar(),T=pe(i).toVar(),P=pe(nR(pe(S.add(x),w.add(p),v.add(f)))).toVar();P.subAssign(.5),P.mulAssign(u),P.addAssign(.5);let R=pe(pe(se(S),se(w),se(v)).add(P)).toVar(),C=pe(R.sub(T)).toVar();return Wt(c.equal(fe(2)),()=>Ji(C.x).add(Ji(C.y)).add(Ji(C.z))),Wt(c.equal(fe(3)),()=>Sr(Ji(C.x),Ji(C.y),Ji(C.z))),_c(C,C)}).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"}]}),H1=Co([RSe,PSe]),ISe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=ft(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=ft(dr(s.x,o),dr(s.y,a)).toVar(),c=se(1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(H1(l,u,f,o,a,r,n)).toVar();c.assign(Ja(c,p))})}),Wt(n.equal(fe(0)),()=>{c.assign(Ca(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),NSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=ft(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=ft(dr(s.x,o),dr(s.y,a)).toVar(),c=ft(1e6,1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(H1(l,u,f,o,a,r,n)).toVar();Wt(p.lessThan(c.x),()=>{c.y.assign(c.x),c.x.assign(p)}).ElseIf(p.lessThan(c.y),()=>{c.y.assign(p)})})}),Wt(n.equal(fe(0)),()=>{c.assign(Ca(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),LSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=ft(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=ft(dr(s.x,o),dr(s.y,a)).toVar(),c=pe(1e6,1e6,1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(H1(l,u,f,o,a,r,n)).toVar();Wt(p.lessThan(c.x),()=>{c.z.assign(c.y),c.y.assign(c.x),c.x.assign(p)}).ElseIf(p.lessThan(c.y),()=>{c.z.assign(c.y),c.y.assign(p)}).ElseIf(p.lessThan(c.z),()=>{c.z.assign(p)})})}),Wt(n.equal(fe(0)),()=>{c.assign(Ca(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),DSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=pe(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=fe().toVar(),c=pe(dr(s.x,o),dr(s.y,a),dr(s.z,l)).toVar(),u=se(1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ri({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(H1(c,f,p,x,o,a,l,r,n)).toVar();u.assign(Ja(u,v))})})}),Wt(n.equal(fe(0)),()=>{u.assign(Ca(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),FSe=Co([ISe,DSe]),OSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=pe(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=fe().toVar(),c=pe(dr(s.x,o),dr(s.y,a),dr(s.z,l)).toVar(),u=ft(1e6,1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ri({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(H1(c,f,p,x,o,a,l,r,n)).toVar();Wt(v.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(v)}).ElseIf(v.lessThan(u.y),()=>{u.y.assign(v)})})})}),Wt(n.equal(fe(0)),()=>{u.assign(Ca(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),BSe=Co([NSe,OSe]),USe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=pe(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=fe().toVar(),c=pe(dr(s.x,o),dr(s.y,a),dr(s.z,l)).toVar(),u=pe(1e6,1e6,1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ri({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(H1(c,f,p,x,o,a,l,r,n)).toVar();Wt(v.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(v)}).ElseIf(v.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(v)}).ElseIf(v.lessThan(u.z),()=>{u.z.assign(v)})})})}),Wt(n.equal(fe(0)),()=>{u.assign(Ca(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),VU=Co([LSe,USe]),kSe=Ae(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=fe(i).toVar(),p=ft(e).toVar(),x=ft(t).toVar(),v=ft(n).toVar(),w=se(r).toVar(),S=se(s).toVar(),T=se(o).toVar(),P=Ll(a).toVar(),R=fe(l).toVar(),C=se(c).toVar(),L=se(u).toVar(),D=p.mul(x).add(v),F=se(0).toVar();return Wt(f.equal(fe(0)),()=>{F.assign(Mb(D))}),Wt(f.equal(fe(1)),()=>{F.assign(nR(D))}),Wt(f.equal(fe(2)),()=>{F.assign(VU(D,w,fe(0)))}),Wt(f.equal(fe(3)),()=>{F.assign(iR(pe(D,0),R,C,L))}),F.assign(F.mul(T.sub(S)).add(S)),Wt(P,()=>{F.assign(ou(F,S,T))}),F}).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"}]}),GSe=Ae(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=fe(i).toVar(),p=pe(e).toVar(),x=pe(t).toVar(),v=pe(n).toVar(),w=se(r).toVar(),S=se(s).toVar(),T=se(o).toVar(),P=Ll(a).toVar(),R=fe(l).toVar(),C=se(c).toVar(),L=se(u).toVar(),D=p.mul(x).add(v),F=se(0).toVar();return Wt(f.equal(fe(0)),()=>{F.assign(Mb(D))}),Wt(f.equal(fe(1)),()=>{F.assign(nR(D))}),Wt(f.equal(fe(2)),()=>{F.assign(VU(D,w,fe(0)))}),Wt(f.equal(fe(3)),()=>{F.assign(iR(D,R,C,L))}),F.assign(F.mul(T.sub(S)).add(S)),Wt(P,()=>{F.assign(ou(F,S,T))}),F}).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"}]}),zSe=Ae(([i])=>{let e=i.y,t=i.z,n=pe().toVar();return Wt(e.lessThan(1e-4),()=>{n.assign(pe(t,t,t))}).Else(()=>{let r=i.x;r=r.sub(Eh(r)).mul(6).toVar();let s=fe(G7(r)),o=r.sub(se(s)),a=t.mul(e.oneMinus()),l=t.mul(e.mul(o).oneMinus()),c=t.mul(e.mul(o.oneMinus()).oneMinus());Wt(s.equal(fe(0)),()=>{n.assign(pe(t,c,a))}).ElseIf(s.equal(fe(1)),()=>{n.assign(pe(l,t,a))}).ElseIf(s.equal(fe(2)),()=>{n.assign(pe(a,t,c))}).ElseIf(s.equal(fe(3)),()=>{n.assign(pe(a,l,t))}).ElseIf(s.equal(fe(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"}]}),VSe=Ae(([i])=>{let e=pe(i).toVar(),t=se(e.x).toVar(),n=se(e.y).toVar(),r=se(e.z).toVar(),s=se(Ja(t,Ja(n,r))).toVar(),o=se(Sr(t,Sr(n,r))).toVar(),a=se(o.sub(s)).toVar(),l=se().toVar(),c=se().toVar(),u=se().toVar();return u.assign(o),Wt(o.greaterThan(0),()=>{c.assign(a.div(o))}).Else(()=>{c.assign(0)}),Wt(c.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{Wt(t.greaterThanEqual(o),()=>{l.assign(n.sub(r).div(a))}).ElseIf(n.greaterThanEqual(o),()=>{l.assign(fs(2,r.sub(t).div(a)))}).Else(()=>{l.assign(fs(4,t.sub(n).div(a)))}),l.mulAssign(1/6),Wt(l.lessThan(0),()=>{l.addAssign(1)})}),pe(l,c,u)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),qSe=Ae(([i])=>{let e=pe(i).toVar(),t=S7(I7(e,pe(.04045))).toVar(),n=pe(e.div(12.92)).toVar(),r=pe(pc(Sr(e.add(pe(.055)),pe(0)).div(1.055),pe(2.4))).toVar();return Xn(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Vee=(i,e)=>{i=se(i),e=se(e);let t=ft(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return Fl(i.sub(t),i.add(t),e)},qee=(i,e,t,n)=>Xn(i,e,t[n].clamp()),HSe=(i,e,t=Pi())=>qee(i,e,t,"x"),WSe=(i,e,t=Pi())=>qee(i,e,t,"y"),jSe=(i,e,t,n,r=Pi())=>{let s=r.x.clamp(),o=r.y.clamp(),a=Xn(i,e,s),l=Xn(t,n,s);return Xn(a,l,o)},Hee=(i,e,t,n,r)=>Xn(i,e,Vee(t,n[r])),XSe=(i,e,t,n=Pi())=>Hee(i,e,t,n,"x"),$Se=(i,e,t,n=Pi())=>Hee(i,e,t,n,"y"),YSe=(i=1,e=0,t=Pi())=>t.mul(i).add(e),ZSe=(i,e=1)=>(i=se(i),i.abs().pow(e).mul(i.sign())),KSe=(i,e=1,t=.5)=>se(i).sub(t).mul(e).add(t),QSe=(i=Pi(),e=1,t=0)=>zU(i.convert("vec2|vec3")).mul(e).add(t),JSe=(i=Pi(),e=1,t=0)=>Mb(i.convert("vec2|vec3")).mul(e).add(t),eTe=(i=Pi(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Lt(Mb(i),zU(i.add(ft(19,73)))).mul(e).add(t)),tTe=(i,e=Pi(),t=ft(1,1),n=ft(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>kSe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),nTe=(i,e=Pi(),t=ft(1,1),n=ft(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>GSe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),iTe=(i=Pi(),e=1)=>FSe(i.convert("vec2|vec3"),e,fe(1)),rTe=(i=Pi(),e=1)=>BSe(i.convert("vec2|vec3"),e,fe(1)),sTe=(i=Pi(),e=1)=>VU(i.convert("vec2|vec3"),e,fe(1)),oTe=(i=Pi())=>bSe(i.convert("vec2|vec3")),aTe=(i=Pi(),e=3,t=2,n=.5,r=1)=>iC(i,fe(e),t,n).mul(r),lTe=(i=Pi(),e=3,t=2,n=.5,r=1)=>MSe(i,fe(e),t,n).mul(r),cTe=(i=Pi(),e=3,t=2,n=.5,r=1)=>iR(i,fe(e),t,n).mul(r),uTe=(i=Pi(),e=3,t=2,n=.5,r=1)=>CSe(i,fe(e),t,n).mul(r),hTe=(i,e=se(0))=>fs(i,e),fTe=(i,e=se(0))=>ni(i,e),dTe=(i,e=se(1))=>bn(i,e),pTe=(i,e=se(1))=>Dl(i,e),ATe=(i,e=se(1))=>OC(i,e),mTe=(i,e=se(1))=>pc(i,e),gTe=(i=se(0),e=se(1))=>F7(i,e),_Te=()=>q1,xTe=()=>aee,yTe=(i,e=se(1))=>ni(e,i),vTe=(i,e,t,n)=>i.greaterThan(e).mix(t,n),bTe=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),wTe=(i,e,t,n)=>i.equal(e).mix(t,n),STe=(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},TTe=(i,e=ft(.5,.5),t=ft(1,1),n=se(0),r=ft(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=ft(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},ETe=(i,e)=>{i=ft(i),e=se(e);let t=e.mul(Math.PI/180);return Sb(i,t)},MTe=(i,e,t)=>{i=pe(i),e=se(e),t=pe(t);let n=e.mul(Math.PI/180),r=t.normalize(),s=n.cos(),o=n.sin(),a=se(1).sub(s);return i.mul(s).add(r.cross(i).mul(o)).add(r.mul(r.dot(i)).mul(a))},CTe=(i,e)=>(i=pe(i),e=se(e),fU(i,e)),RTe=Ae(([i,e,t])=>{let n=Jo(i).toVar(),r=ni(se(.5).mul(e.sub(t)),Ch).div(n).toVar(),s=ni(se(-.5).mul(e.sub(t)),Ch).div(n).toVar(),o=pe().toVar();o.x=n.x.greaterThan(se(0)).select(r.x,s.x),o.y=n.y.greaterThan(se(0)).select(r.y,s.y),o.z=n.z.greaterThan(se(0)).select(r.z,s.z);let a=Ja(o.x,o.y,o.z).toVar();return Ch.add(n.mul(a)).toVar().sub(t)}),Wee=Ae(([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(bn(t,t).sub(bn(n,n)))),s}),k=Object.freeze({__proto__:null,BRDF_GGX:CU,BRDF_Lambert:Bm,BasicPointShadowFilter:Lee,BasicShadowFilter:Tee,Break:PJ,Const:tQ,Continue:Dye,DFGLUT:ab,D_GGX:qJ,Discard:mQ,EPSILON:BC,F_Schlick:O1,Fn:Ae,HALF_PI:Cxe,INFINITY:Txe,If:Wt,Loop:Ri,NodeAccess:Eo,NodeShaderStage:x1,NodeType:rxe,NodeUpdateType:_n,OnBeforeFrameUpdate:Cye,OnBeforeMaterialUpdate:Mye,OnBeforeObjectUpdate:Eye,OnFrameUpdate:bJ,OnMaterialUpdate:Tye,OnObjectUpdate:wb,PCFShadowFilter:Eee,PCFSoftShadowFilter:Mee,PI:MM,PI2:Exe,PointShadowFilter:Dee,Return:kxe,Schlick_to_F0:UF,ShaderNode:b1,Stack:NC,Switch:xxe,TBNViewMatrix:wm,TWO_PI:Mxe,VSMShadowFilter:Cee,V_GGX_SmithCorrelated:VJ,Var:eQ,VarIntent:nQ,abs:Ji,acesFilmicToneMapping:gee,acos:D7,acosh:PK,add:fs,addMethodChaining:Be,addNodeElement:Gxe,agxToneMapping:_ee,all:yK,alphaT:bM,ambientOcclusion:G8,and:oK,anisotropy:Qp,anisotropyB:Em,anisotropyT:Xv,any:vK,append:vxe,array:QZ,asin:CK,asinh:RK,assign:JZ,atan:F7,atanh:IK,atomicAdd:jbe,atomicAnd:Zbe,atomicFunc:Bh,atomicLoad:Hbe,atomicMax:$be,atomicMin:Ybe,atomicOr:Kbe,atomicStore:Wbe,atomicSub:Xbe,atomicXor:Qbe,attenuationColor:R7,attenuationDistance:C7,attribute:Nl,attributeArray:Kve,backgroundBlurriness:uee,backgroundIntensity:MO,backgroundRotation:hee,batch:EJ,batchColor:yU,bentNormalView:jQ,billboarding:kve,bitAnd:uK,bitNot:hK,bitOr:fK,bitXor:dK,bitangentGeometry:gye,bitangentLocal:_ye,bitangentView:HQ,bitangentWorld:xye,bitcast:see,blendBurn:abe,blendColor:hbe,blendDodge:lbe,blendOverlay:ube,blendScreen:cbe,blur:YJ,bool:Ll,buffer:z1,bufferAttribute:Z7,builtin:rd,builtinAOContext:QK,builtinShadowContext:KK,bumpMap:fU,bvec2:jZ,bvec3:S7,bvec4:XZ,bypass:pQ,cache:dQ,call:eK,cameraFar:t0,cameraIndex:p0,cameraNear:e0,cameraNormalMatrix:$xe,cameraPosition:bQ,cameraProjectionMatrix:Ma,cameraProjectionMatrixInverse:vQ,cameraViewMatrix:A0,cameraViewport:Yxe,cameraWorldMatrix:bb,cbrt:WK,cdl:mbe,ceil:kC,checker:Xwe,cineonToneMapping:mee,clamp:ou,clearcoat:xM,clearcoatNormalView:n0,clearcoatRoughness:S1,clipSpace:TQ,code:JC,color:WZ,colorSpaceToWorking:zC,colorToDirection:bye,compute:fQ,computeKernel:Q7,computeSkinning:Lye,context:id,convert:YZ,convertColorSpace:Nxe,convertToTexture:Xve,cos:tu,cosh:TK,countLeadingZeros:mve,countOneBits:gve,countTrailingZeros:Ave,cross:ed,cubeTexture:Ea,cubeTextureBase:uU,dFdx:U7,dFdy:k7,dashSize:Mm,debug:_Q,decrement:xK,decrementBefore:gK,defaultBuildStages:uM,defaultShaderStages:GZ,defined:P1,degrees:wK,deltaTime:Ive,densityFogFactor:bee,depth:TU,depthPass:vbe,determinant:OK,difference:GK,diffuseColor:Ci,diffuseContribution:xm,directPointLight:Oee,directionToColor:vye,directionToFaceDirection:lye,dispersion:P7,disposeShadowMaterial:Pee,distance:kK,div:Dl,dot:_c,drawIndex:hQ,dynamicBufferAttribute:Fxe,element:$Z,emissive:k8,equal:tK,equirectDirection:NF,equirectUV:EU,exp:N7,exp2:I1,exponentialHeightFogFactor:Nbe,expression:Il,faceDirection:aU,faceForward:j7,faceforward:Rxe,float:se,floatBitsToInt:fve,floatBitsToUint:oee,floor:Eh,fog:DO,fract:su,frameGroup:wxe,frameId:aee,frontFacing:EQ,fwidth:z7,gain:xve,gapSize:nb,getConstNodeType:HZ,getCurrentStack:v7,getDirection:XJ,getDistanceAttenuation:GU,getGeometryRoughness:zJ,getNormalFromDepth:Yve,getParallaxCorrectNormal:RTe,getRoughness:MU,getScreenPosition:$ve,getShIrradianceAt:Wee,getShadowMaterial:Ree,getShadowRenderObjectFunction:Iee,getTextureIndex:iee,getViewPosition:v1,ggxConvolution:ZJ,globalId:Obe,glsl:Rbe,glslFn:Pbe,grayscale:fbe,greaterThan:I7,greaterThanEqual:sK,hash:_ve,highpModelNormalViewMatrix:oF,highpModelViewMatrix:sF,hue:Abe,increment:_K,incrementBefore:mK,inspector:xQ,instance:SJ,instanceColor:xU,instanceIndex:ru,instancedArray:Qve,instancedBufferAttribute:qC,instancedDynamicBufferAttribute:K7,instancedMesh:TJ,int:fe,intBitsToFloat:dve,interleavedGradientNoise:IU,inverse:BK,inverseSqrt:L7,inversesqrt:Pxe,invocationLocalIndex:Uxe,invocationSubgroupIndex:Bxe,ior:$v,iridescence:DC,iridescenceIOR:yM,iridescenceThickness:vM,isolate:M1,ivec2:wr,ivec3:w7,ivec4:T7,js:Mbe,label:JK,length:Mh,lengthSq:H7,lessThan:iK,lessThanEqual:rK,lightPosition:OU,lightProjectionUV:wee,lightShadowMatrix:tR,lightTargetDirection:UU,lightTargetPosition:See,lightViewPosition:BU,lightingContext:NJ,lights:Rwe,linearDepth:OM,linearToneMapping:pee,localId:Bbe,log:UC,log2:Th,logarithmicDepthToViewZ:kye,luminance:LU,mat2:LC,mat3:so,mat4:o0,matcapUV:KJ,materialAO:yJ,materialAlphaTest:$Q,materialAnisotropy:cJ,materialAnisotropyVector:y1,materialAttenuationColor:gJ,materialAttenuationDistance:mJ,materialClearcoat:iJ,materialClearcoatNormal:sJ,materialClearcoatRoughness:rJ,materialColor:YQ,materialDispersion:xJ,materialEmissive:KQ,materialEnvIntensity:fM,materialEnvRotation:NM,materialIOR:AJ,materialIridescence:uJ,materialIridescenceIOR:hJ,materialIridescenceThickness:fJ,materialLightMap:_U,materialLineDashOffset:gU,materialLineDashSize:AU,materialLineGapSize:mU,materialLineScale:pU,materialLineWidth:LM,materialMetalness:tJ,materialNormal:nJ,materialOpacity:dU,materialPointSize:_J,materialReference:Zf,materialReflectivity:dM,materialRefractionRatio:RQ,materialRotation:oJ,materialRoughness:eJ,materialSheen:aJ,materialSheenRoughness:lJ,materialShininess:ZQ,materialSpecular:QQ,materialSpecularColor:JQ,materialSpecularIntensity:gF,materialSpecularStrength:Yv,materialThickness:pJ,materialTransmission:dJ,max:Sr,maxMipLevel:nU,mediumpModelViewMatrix:SQ,metalness:Qf,min:Ja,mix:Xn,mixElement:XK,mod:OC,modelDirection:nye,modelNormalMatrix:wQ,modelPosition:iye,modelRadius:oye,modelScale:rye,modelViewMatrix:Ih,modelViewPosition:sye,modelViewProjection:vJ,modelWorldMatrix:Ac,modelWorldMatrixInverse:aye,morphReference:IJ,mrt:ree,mul:bn,mx_aastep:Vee,mx_add:hTe,mx_atan2:gTe,mx_cell_noise_float:oTe,mx_contrast:KSe,mx_divide:pTe,mx_fractal_noise_float:aTe,mx_fractal_noise_vec2:lTe,mx_fractal_noise_vec3:cTe,mx_fractal_noise_vec4:uTe,mx_frame:xTe,mx_heighttonormal:CTe,mx_hsvtorgb:zSe,mx_ifequal:wTe,mx_ifgreater:vTe,mx_ifgreatereq:bTe,mx_invert:yTe,mx_modulo:ATe,mx_multiply:dTe,mx_noise_float:QSe,mx_noise_vec3:JSe,mx_noise_vec4:eTe,mx_place2d:TTe,mx_power:mTe,mx_ramp4:jSe,mx_ramplr:HSe,mx_ramptb:WSe,mx_rgbtohsv:VSe,mx_rotate2d:ETe,mx_rotate3d:MTe,mx_safepower:ZSe,mx_separate:STe,mx_splitlr:XSe,mx_splittb:$Se,mx_srgb_texture_to_lin_rec709:qSe,mx_subtract:fTe,mx_timer:_Te,mx_transform_uv:YSe,mx_unifiednoise2d:tTe,mx_unifiednoise3d:nTe,mx_worley_noise_float:iTe,mx_worley_noise_vec2:rTe,mx_worley_noise_vec3:sTe,negate:B7,negateOnBackSide:Wm,neutralToneMapping:xee,nodeArray:Tm,nodeImmutable:xt,nodeObject:Vt,nodeObjectIntent:qv,nodeObjects:IC,nodeProxy:Hn,nodeProxyConstructor:y7,nodeProxyIntent:lt,normalFlat:MQ,normalGeometry:HC,normalLocal:ta,normalMap:AF,normalView:oi,normalViewGeometry:N1,normalWorld:m0,normalWorldGeometry:CQ,normalize:Jo,not:lK,notEqual:nK,numWorkgroups:Dbe,objectDirection:Zxe,objectGroup:KZ,objectPosition:Qxe,objectRadius:tye,objectScale:Jxe,objectViewPosition:eye,objectWorldMatrix:Kxe,oneMinus:NK,or:aK,orthographicDepthToViewZ:DJ,oscSawtooth:Fve,oscSine:Nve,oscSquare:Lve,oscTriangle:Dve,output:T1,outputStruct:cve,overloadingFn:Co,overrideNode:tee,overrideNodes:nee,packHalf2x16:Sve,packNormalToRGB:hU,packSnorm2x16:bve,packUnorm2x16:wve,parabola:_O,parallaxDirection:WQ,parallaxUV:yye,parameter:ove,pass:xbe,passTexture:ybe,pcurve:yve,perspectiveDepthToViewZ:$C,pmremTexture:PU,pointShadow:Fee,pointUV:Jve,pointWidth:bxe,positionGeometry:Zo,positionLocal:fr,positionPrevious:Om,positionView:ts,positionViewDirection:Vi,positionWorld:Ch,positionWorldDirection:oU,posterize:gbe,pow:pc,pow2:V7,pow3:zK,pow4:q7,premultiplyAlpha:eU,property:nd,quadBroadcast:wwe,quadSwapDiagonal:gwe,quadSwapX:Awe,quadSwapY:mwe,radians:bK,rand:jK,range:Lbe,rangeFogFactor:vee,reciprocal:DK,reference:nr,referenceBuffer:FQ,reflect:UK,reflectVector:NQ,reflectView:PQ,reflector:Hve,refract:W7,refractVector:LQ,refractView:IQ,reinhardToneMapping:Aee,remap:J7,remapClamp:AQ,renderGroup:Zt,renderOutput:tU,rendererReference:aQ,replaceDefaultUV:Ove,rotate:Sb,rotateUV:Bve,roughness:wh,round:LK,rtt:cee,sRGBTransferEOTF:rQ,sRGBTransferOETF:sQ,sample:Zve,sampler:Hxe,samplerComparison:Wxe,saturate:GC,saturation:dbe,screenCoordinate:Hm,screenDPR:rU,screenSize:Fm,screenUV:iu,select:Qo,setCurrentStack:tb,setName:X7,shaderStages:hM,shadow:Nee,shadowPositionWorld:kU,shapeCircle:$we,sharedUniformGroup:FC,sheen:Rl,sheenRoughness:Jp,shiftLeft:pK,shiftRight:AK,shininess:wM,sign:O7,sin:Ta,sinc:vve,sinh:SK,skinning:RJ,smoothstep:Fl,smoothstepElement:$K,specularColor:c0,specularColorBlended:vm,specularF90:bm,spherizeUV:Uve,split:yxe,spritesheetUV:zve,sqrt:Ca,stack:AM,step:Lm,stepElement:YK,storage:a0,storageBarrier:Gbe,storageTexture:fee,storageTexture3D:tbe,struct:lve,sub:ni,subBuild:Cm,subgroupAdd:twe,subgroupAll:fwe,subgroupAnd:awe,subgroupAny:dwe,subgroupBallot:ewe,subgroupBroadcast:_we,subgroupBroadcastFirst:pwe,subgroupElect:Jbe,subgroupExclusiveAdd:iwe,subgroupExclusiveMul:owe,subgroupInclusiveAdd:nwe,subgroupInclusiveMul:swe,subgroupIndex:Oxe,subgroupMax:hwe,subgroupMin:uwe,subgroupMul:rwe,subgroupOr:lwe,subgroupShuffle:xwe,subgroupShuffleDown:bwe,subgroupShuffleUp:vwe,subgroupShuffleXor:ywe,subgroupSize:Ube,subgroupXor:cwe,tan:EK,tangentGeometry:WC,tangentLocal:u0,tangentView:jC,tangentWorld:qQ,tanh:MK,texture:ai,texture3D:NU,texture3DLevel:rbe,texture3DLoad:ibe,textureBarrier:zbe,textureBicubic:f2e,textureBicubicLevel:RU,textureCubeUV:$J,textureLevel:qxe,textureLoad:es,textureSize:Dm,textureStore:ebe,thickness:M7,time:q1,toneMapping:lQ,toneMappingExposure:cQ,toonOutlinePass:bbe,transformDirection:VK,transformNormal:lU,transformNormalByInverseViewMatrix:HK,transformNormalByViewMatrix:qK,transformNormalToView:cU,transformedClearcoatNormalView:hye,transformedNormalView:cye,transformedNormalWorld:uye,transmission:SM,transpose:FK,triNoise3D:Rve,triplanarTexture:Vve,triplanarTextures:lee,trunc:G7,uint:it,uintBitsToFloat:pve,uniform:Ht,uniformArray:To,uniformCubeTexture:fye,uniformFlow:ZK,uniformGroup:ZZ,uniformTexture:Vxe,unpackHalf2x16:Mve,unpackNormal:dF,unpackRGBToNormal:XQ,unpackSnorm2x16:Tve,unpackUnorm2x16:Eve,unpremultiplyAlpha:gQ,userData:sbe,uv:Pi,uvec2:b7,uvec3:Vm,uvec4:E7,varying:d0,varyingProperty:qm,vec2:ft,vec3:pe,vec4:Lt,vectorComponents:zm,velocity:obe,vertexColor:BJ,vertexIndex:uQ,vertexStage:iQ,vibrance:pbe,viewZToLogarithmicDepth:YC,viewZToOrthographicDepth:Rm,viewZToPerspectiveDepth:SU,viewZToReversedOrthographicDepth:Uye,viewZToReversedPerspectiveDepth:FJ,viewport:R1,viewportCoordinate:yQ,viewportDepthTexture:wU,viewportLinearDepth:Gye,viewportMipTexture:bU,viewportOpaqueMipTexture:LJ,viewportResolution:Xxe,viewportSafeUV:Gve,viewportSharedTexture:_be,viewportSize:sU,viewportTexture:Oye,viewportUV:jxe,vogelDiskSample:nu,wgsl:Cbe,wgslFn:Ibe,workgroupArray:Vbe,workgroupBarrier:kbe,workgroupId:Fbe,workingToColorSpace:oQ,xor:cK}),Jc=new cb,qO=class extends Dh{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(Jc),Jc.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(Jc),Jc.a=1,o=!0;else if(s.isNode===!0){let l=this.get(e),c=s;Jc.copy(r._clearColor);let u=l.backgroundMesh;if(u===void 0){let R=function(){s.removeEventListener("dispose",R),u.material.dispose(),u.geometry.dispose()},p=Lt(c).mul(MO).context({getUV:()=>hee.mul(CQ),getTextureLevel:()=>uee}),x=Ma.element(3).element(3).equal(1),v=Dl(1,Ma.element(1).element(1)).mul(3),w=x.select(fr.mul(v),fr),S=Ih.mul(Lt(w,0)),T=Ma.mul(Lt(S.xyz,1));T=T.setZ(T.w);let P=new Ar;P.name="Background.material",P.side=ui,P.depthTest=!1,P.depthWrite=!1,P.allowOverride=!1,P.fog=!1,P.lights=!1,P.vertexNode=T,P.colorNode=p,l.backgroundMeshNode=p,l.backgroundMesh=u=new Gn(new Aa(1,32,32),P),u.frustumCulled=!1,u.name="Background.mesh",s.addEventListener("dispose",R)}let f=c.getCacheKey();l.backgroundCacheKey!==f&&(l.backgroundMeshNode.node=Lt(c).mul(MO),l.backgroundMeshNode.needsUpdate=!0,u.material.needsUpdate=!0,l.backgroundCacheKey=f),t.unshift(u,u.geometry,u.material,0,0,null,null)}else Ge("Renderer: Unsupported background configuration.",s);let a=r.xr.getEnvironmentBlendMode();if(a==="additive"?Jc.set(0,0,0,1):a==="alpha-blend"&&Jc.set(0,0,0,0),r.autoClear===!0||o===!0){let l=n.clearColorValue;l.r=Jc.r,l.g=Jc.g,l.b=Jc.b,l.a=Jc.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}},PTe=0,pb=class{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=PTe++}},HO=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 pb(t.name,[]);e.push(r);for(let s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}},rC=class{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}},WO=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}},sC=class{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}},jO=class extends sC{constructor(e,t,n=null,r=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=r}},XO=class{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}},ITe=0,Jv=class{constructor(e=null){this.id=ITe++,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)}},$O=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},Oh=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}},YO=class extends Oh{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},ZO=class extends Oh{constructor(e,t=new Oe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},KO=class extends Oh{constructor(e,t=new ie){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},QO=class extends Oh{constructor(e,t=new gn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},JO=class extends Oh{constructor(e,t=new Ut){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},eB=class extends Oh{constructor(e,t=new C_){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},tB=class extends Oh{constructor(e,t=new Sn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},nB=class extends Oh{constructor(e,t=new on){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},iB=class extends YO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},rB=class extends ZO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},sB=class extends KO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},oB=class extends QO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},aB=class extends JO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},lB=class extends eB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},cB=class extends tB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},uB=class extends nB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},NTe=0,aZ=new WeakMap,lZ=new WeakMap,LTe=new WeakMap,DTe=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),YE=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0")),jee=i=>{if(i.writeUsageCount>0)return!0;if(i.subBuildsCache!==void 0){for(let e in i.subBuildsCache)if(jee(i.subBuildsCache[e]))return!0}return!1},oC=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=AM(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new Jv,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:NTe++})}isFlatShading(){return this.material.flatShading===!0||this.geometry.hasAttribute("normal")===!1}isOpaque(){let e=this.material;return e.transparent===!1&&e.blending===os&&e.alphaToCoverage===!1}createRenderTarget(e,t,n){return new ua(e,t,n)}createCubeRenderTarget(e,t){return new BM(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===Dr?o="ivec":r===pi&&(o="uvec"),s===Uf||s===Yu?r===Dr?t="int":r===pi?t="uint":t="float":s===Ts||s===Zu?t=`${o}2`:s===Bf||s===y2?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,p)=>f.nodeUniform.node.id-p.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=aZ.get(a);l===void 0&&(l=new Map,aZ.set(a,l));let c=G1(o);s=l.get(c),s===void 0&&(s=new pb(e,t),l.set(c,s))}else s=new pb(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 hM)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!==_n.NONE||n!==_n.NONE)&&this.sequentialNodes.add(e)}buildUpdateNodes(){for(let e of this.nodes)e.getUpdateType()!==_n.NONE&&this.updateNodes.push(e);for(let e of this.sequentialNodes){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();t!==_n.NONE&&this.updateBeforeNodes.push(e),n!==_n.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===bi||e.magFilter===lp||e.magFilter===ic||e.magFilter===xo||e.minFilter===bi||e.minFilter===lp||e.minFilter===ic||e.minFilter===xo}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 Jv(t?this.getCache():null)),n.cache}isAvailable(){return!1}getVertexIndex(){je("Abstract function.")}getInstanceIndex(){je("Abstract function.")}getDrawIndex(){je("Abstract function.")}getFrontFacing(){je("Abstract function.")}getFragCoord(){je("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(jee(r[s]))return!0}return!1}generateTexture(){je("Abstract function.")}generateTextureLod(){je("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 Ut:e==="vec2"||e==="uvec2"||e==="ivec2"?t=new Oe:e==="vec3"||e==="uvec3"||e==="ivec3"?t=new ie:(e==="vec4"||e==="uvec4"||e==="ivec4")&&(t=new gn)),e==="float")return YE(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")}( ${YE(t.r)}, ${YE(t.g)}, ${YE(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 rC(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===Dr?"int":t===pi?"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=BZ(e),r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return DTe.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 m_)&&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=AM(this.stack);let e=v7();return this.stacks.push(e),tb(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,tb(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 rC(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 $O(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 WO(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 p=e.getArrayCount(this);l=new sC(t,n,s,p),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 jO(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&&je(`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 XO("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+`;4160-`),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=lZ.get(t);n===void 0&&(n=new WeakMap,lZ.set(t,n));let r=n.get(e);if(r===void 0){r=new JM;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 jM(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 Jv,this.stack=AM();for(let u of uM)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(){je("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};4157+`).removeFlowTab();e.addFlowTab()}},Ri=(...i)=>new RF(Mm(i,"int")).toStack(),Oye=()=>Nl("continue").toStack(),NJ=()=>Nl("break").toStack(),o8=new WeakMap,El=new gn,MY=new WeakMap,CY=Ae(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{let o=fe(fQ).mul(t).add(s),a=o.div(n),l=o.sub(a.mul(n));return es(i,Sr(l,a)).depth(r).xyz.mul(e)});function Bye(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=o8.get(i);if(o===void 0||o.count!==s){let T=function(){w.dispose(),o8.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,p=1,x=4096;f>x&&(p=Math.ceil(f/x),f=x);let v=new Float32Array(f*p*4*s),w=new bA(v,f,p,s);w.type=Zi,w.needsUpdate=!0;let S=u*4;for(let P=0;P<s;P++){let R=a[P],C=l[P],L=c[P],D=f*p*4*P;for(let F=0;F<R.count;F++){let N=F*S;e===!0&&(El.fromBufferAttribute(R,F),v[D+N+0]=El.x,v[D+N+1]=El.y,v[D+N+2]=El.z,v[D+N+3]=0),t===!0&&(El.fromBufferAttribute(C,F),v[D+N+4]=El.x,v[D+N+5]=El.y,v[D+N+6]=El.z,v[D+N+7]=0),n===!0&&(El.fromBufferAttribute(L,F),v[D+N+8]=El.x,v[D+N+9]=El.y,v[D+N+10]=El.z,v[D+N+11]=L.itemSize===4?El.w:1)}}o={count:s,texture:w,stride:u,size:new Oe(f,p)},o8.set(i,o),i.addEventListener("dispose",T)}return o}var LJ=Ae(([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=MY.get(i);(o===void 0||o.count!==s)&&(o={base:Ht(1),influences:i.morphTargetInfluences?To(i.morphTargetInfluences,"float"):null,count:s},MY.set(i,o));let{base:a,influences:l}=o,{texture:c,stride:u,size:f}=Bye(e);t===!0&&fr.mulAssign(a),n===!0&&ta.mulAssign(a);let p=fe(f.width);Ri(s,({i:x})=>{let v=se(0).toVar();i.count>1&&i.morphTexture!==null&&i.morphTexture!==void 0?v.assign(es(i.morphTexture,Sr(fe(x).add(1),fe(su))).r):v.assign(l.element(x).toVar()),Wt(v.notEqual(0),()=>{t===!0&&fr.addAssign(CY({bufferMap:c,influence:v,stride:u,width:p,depth:x,offset:fe(0)})),n===!0&&ta.addAssign(CY({bufferMap:c,influence:v,stride:u,width:p,depth:x,offset:fe(1)}))})}),Tb(({object:x})=>{let{base:v,influences:w}=o;x.geometry.morphTargetsRelative?v.value=1:v.value=1-x.morphTargetInfluences.reduce((S,T)=>S+T,0),w&&(w.array=x.morphTargetInfluences,w.update())})},"void"),f0=class extends $t{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}},PF=class extends f0{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},IF=class extends sb{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:se(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)}},DJ=Hn(IF),NF=class extends f0{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},pm=new Oe,F1=class extends yc{static get type(){return"ViewportTextureNode"}constructor(e=ru,t=null,n=null){let r=null;n===null?(r=new MA,r.minFilter=xo,n=r):r=n,super(n,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=r,this.isOutputTextureNode=!0,this.updateBeforeType=_n.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(pm):s.getDrawingBufferSize?s.getDrawingBufferSize(pm):pm.set(s.width,s.height);let o=this.getTextureForReference(s);(o.image.width!==pm.width||o.image.height!==pm.height)&&(o.image.width=pm.width,o.image.height=pm.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}},Uye=Hn(F1).setParameterLength(0,3),RU=Hn(F1,null,null,{generateMipmaps:!0}).setParameterLength(0,3),kye=RU(),FJ=(i=ru,e=null)=>kye.sample(i,e),a8=null,LF=class extends F1{static get type(){return"ViewportDepthTextureNode"}constructor(e=ru,t=null,n=null){n===null&&(a8===null&&(a8=new ls),n=a8),super(e,t,n)}},PU=Hn(LF).setParameterLength(0,3),lu=class i extends $t{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=UJ().assign(n));else if(t===i.DEPTH)e.isPerspectiveCamera?r=IU(ts.z,t0,n0):r=Im(ts.z,t0,n0);else if(t===i.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){let s=ZC(n,t0,n0);r=Im(s,t0,n0)}else r=n;else r=Im(ts.z,t0,n0);return r}};lu.DEPTH_BASE="depthBase";lu.DEPTH="depth";lu.LINEAR_DEPTH="linearDepth";var Im=(i,e,t)=>i.add(e).div(e.sub(t)),Gye=(i,e,t)=>i.add(t).div(t.sub(e)),OJ=Ae(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?t.sub(e).mul(i).sub(t):e.sub(t).mul(i).sub(e)),IU=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),BJ=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),ZC=Ae(([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))),KC=(i,e,t)=>{e=e.max(1e-6).toVar();let n=Mh(i.negate().div(e)),r=Mh(t.div(e));return n.div(r)},zye=(i,e,t)=>{let n=i.mul(GC(t.div(e)));return se(Math.E).pow(n).mul(e).negate()},UJ=Hn(lu,lu.DEPTH_BASE),NU=xt(lu,lu.DEPTH),UM=Hn(lu,lu.LINEAR_DEPTH).setParameterLength(0,1),Vye=UM(PU());NU.assign=i=>UJ(i);var Dh=class i extends $t{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 Ae(()=>{let n=se().toVar("distanceToPlane"),r=se().toVar("distanceToGradient"),s=se(1).toVar("clipOpacity"),o=t.length;if(this.hardwareClipping===!1&&o>0){let l=To(t).setGroup(Zt);Ri(o,({i:c})=>{let u=l.element(c);n.assign(ts.dot(u.xyz).negate().add(u.w)),r.assign(n.fwidth().div(2)),s.mulAssign(Ol(r.negate(),r,n))})}let a=e.length;if(a>0){let l=To(e).setGroup(Zt),c=se(1).toVar("intersectionClipOpacity");Ri(a,({i:u})=>{let f=l.element(u);n.assign(ts.dot(f.xyz).negate().add(f.w)),r.assign(n.fwidth().div(2)),c.mulAssign(Ol(r.negate(),r,n).oneMinus())}),s.mulAssign(c.oneMinus())}Ci.a.mulAssign(s),Ci.a.equal(0).discard()})()}setupDefault(e,t){return Ae(()=>{let n=t.length;if(this.hardwareClipping===!1&&n>0){let s=To(t).setGroup(Zt);Ri(n,({i:o})=>{let a=s.element(o);ts.dot(a.xyz).greaterThan(a.w).discard()})}let r=e.length;if(r>0){let s=To(e).setGroup(Zt),o=Dl(!0).toVar("clipped");Ri(r,({i:a})=>{let l=s.element(a);o.assign(ts.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){let n=e.length;return t.enableHardwareClipping(n),Ae(()=>{let r=To(e).setGroup(Zt),s=sd(t.getClipDistance());Ri(n,({i:o})=>{let a=r.element(o),l=ts.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}};Dh.ALPHA_TO_COVERAGE="alphaToCoverage";Dh.DEFAULT="default";Dh.HARDWARE="hardware";var qye=()=>new Dh,Hye=()=>new Dh(Dh.ALPHA_TO_COVERAGE),Wye=()=>new Dh(Dh.HARDWARE),jye=.05,RY=Ae(([i])=>ou(bn(1e4,Ta(bn(17,i.x).add(bn(.1,i.y)))).mul(fs(.1,Ji(Ta(bn(13,i.y).add(i.x))))))),PY=Ae(([i])=>RY(ft(RY(i.xy),i.z))),Xye=Ae(([i])=>{let e=Tr(Rh(W7(i.xyz)),Rh(j7(i.xyz))),t=se(1).div(se(jye).mul(e)).toVar("pixScale"),n=ft(N1(Ch(Mh(t))),N1(zC(Mh(t)))),r=ft(PY(Ch(n.x.mul(i.xyz))),PY(Ch(n.y.mul(i.xyz)))),s=ou(Mh(t)),o=fs(bn(s.oneMinus(),r.x),bn(s,r.y)),a=el(s,s.oneMinus()),l=pe(o.mul(o).div(bn(2,a).mul(ni(1,a))),o.sub(bn(.5,a)).div(ni(1,a)),ni(1,ni(1,o).mul(ni(1,o)).div(bn(2,a).mul(ni(1,a))))),c=o.lessThan(a.oneMinus()).select(o.lessThan(a).select(l.x,l.y),l.z);return au(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]}),DF=class extends NM{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 gn(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}},kJ=(i=0)=>new DF(i),Ar=class extends Es{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(z1(t.slice(0,-4)),n.getCacheKey());return this.type+wb(e)}build(e){this.setup(e)}setupObserver(e){return new O8(e)}setup(e){e.context.setupNormal=()=>Pm(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=Pm(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=Lt(l,Ci.a).max(0);o=this.setupOutput(e,c),E1.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(),p=this.mrtNode;f!==null?(u&&E1.assign(o),o=f,p!==null&&(o=f.merge(p))):p!==null&&(o=p)}}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=Hye():e.stack.addToStack(qye())}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(Wye()),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=KC(ts.z,t0,n0):r=Im(ts.z,t0,n0))}r!==null&&NU.assign(r).toStack()}setupPositionView(){return Lh.mul(fr).xyz}setupModelViewProjection(){return Ma.mul(ts)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),wJ}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&LJ(t),t.isSkinnedMesh===!0&&IJ(t),this.displacementMap){let r=Kf("displacementMap","texture"),s=Kf("displacementScale","float"),o=Kf("displacementBias","float");fr.addAssign(ta.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&CJ(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&MJ(t),this.positionNode!==null&&fr.assign(Pm(this.positionNode,"POSITION","vec3")),fr}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&Dl(this.maskNode).not().discard();let r=this.colorNode?Lt(this.colorNode):KQ;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul(kJ())),t.instanceColor&&(r=EU.mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=MU.mul(r)),Ci.assign(r);let s=this.opacityNode?se(this.opacityNode):yU;Ci.a.assign(Ci.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?se(this.alphaTestNode):ZQ,this.alphaToCoverage===!0?(Ci.a=Ol(o,o.add($7(Ci.a)),Ci.a),Ci.a.lessThanEqual(0).discard()):Ci.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Ci.a.lessThan(Xye(fr)).discard(),e.isOpaque()&&Ci.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?pe(0):Ci.rgb}setupNormal(){return this.normalNode?pe(this.normalNode):rJ}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Kf("envMap","cubeTexture"):Kf("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new NF(TU)),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 PF(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=bJ),e.context.getAO&&(t=e.context.getAO(t,e)),t!==null&&(X8.assign(t),e.context.ambientOcclusion=X8)}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=DJ(l,u,a,n,r)}else n!==null&&(c=pe(r!==null?Xn(c,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(j8.assign(pe(s||JQ)),c=c.add(j8)),c}setupFog(e,t){let n=e.fogNode;return n&&(E1.assign(t),t=Lt(n.toVar())),t}setupPremultipliedAlpha(e,t){return aU(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=Es.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}},$ye=new xl,FF=class extends Ar{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues($ye),this.setValues(e)}},Yye=new Wy,OF=class extends Ar{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(Yye),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){let e=this.offsetNode?se(this.offsetNode):SU,t=this.dashScaleNode?se(this.dashScaleNode):vU,n=this.dashSizeNode?se(this.dashSizeNode):bU,r=this.gapSizeNode?se(this.gapSizeNode):wU;Rm.assign(n),rb.assign(r);let s=p0(Ll("lineDistance").mul(t));(e?s.add(e):s).mod(Rm.add(rb)).greaterThan(Rm).discard()}};var mM=Wm("vec3","worldStart"),BF=Wm("vec3","worldEnd"),GJ=Wm("float","lineDistance"),ym=Wm("vec4","worldPos"),IY=Ae(({start:i,end:e})=>{let t=Ma.element(2).element(2),n=Ma.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"}),Zye=Ae(({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),p=o.dot(o).mul(u).sub(l.mul(l)),v=a.mul(l).sub(c.mul(u)).div(p).clamp(),w=a.add(l.mul(v)).div(u).clamp();return ft(v,w)},{p1:"vec3",p2:"vec3",p3:"vec3",p4:"vec3",return:"vec2"}),kJe=Ae(({material:i})=>{let e=i._useDash,t=i._useWorldUnits,n=Ll("instanceStart"),r=Ll("instanceEnd"),s=Lt(Lh.mul(Lt(n,1))).toVar("start"),o=Lt(Lh.mul(Lt(r,1))).toVar("end"),a,l;e&&(a=se(Ll("instanceDistanceStart")).toVar("distanceStart"),l=se(Ll("instanceDistanceEnd")).toVar("distanceEnd")),t&&(mM.assign(s.xyz),BF.assign(o.xyz));let c=P1.z.div(P1.w),u=Ma.element(2).element(3).equal(-1);if(Wt(u,()=>{Wt(s.z.lessThan(0).and(o.z.greaterThan(0)),()=>{let T=IY({start:s,end:o});o.assign(Lt(Xn(s.xyz,o.xyz,T),o.w)),e&&l.assign(Xn(a,l,T))}).ElseIf(o.z.lessThan(0).and(s.z.greaterThanEqual(0)),()=>{let T=IY({start:o,end:s});s.assign(Lt(Xn(o.xyz,s.xyz,T),s.w)),e&&a.assign(Xn(l,a,T))})}),e){let T=i.dashScaleNode?se(i.dashScaleNode):vU,P=i.offsetNode?se(i.offsetNode):SU,R=Zo.y.lessThan(.5).select(T.mul(a),T.mul(l));R=R.add(P),GJ.assign(R)}let f=Ma.mul(s),p=Ma.mul(o),x=f.xyz.div(f.w),v=p.xyz.div(p.w),w=v.xy.sub(x.xy).toVar();w.x.assign(w.x.mul(c)),w.assign(w.normalize());let S=Lt().toVar();if(t){let T=o.xyz.sub(s.xyz).normalize(),P=Xn(s.xyz,o.xyz,.5).normalize(),R=T.cross(P).normalize(),C=T.cross(R);ym.assign(Zo.y.lessThan(.5).select(s,o));let L=FM.mul(.5);ym.addAssign(Lt(Zo.x.lessThan(0).select(R.mul(L),R.mul(L).negate()),0)),e||(ym.addAssign(Lt(Zo.y.lessThan(.5).select(T.mul(L).negate(),T.mul(L)),0)),ym.addAssign(Lt(C.mul(L),0)),Wt(Zo.y.greaterThan(1).or(Zo.y.lessThan(0)),()=>{ym.subAssign(Lt(C.mul(2).mul(L),0))})),S.assign(Ma.mul(ym));let D=pe().toVar();D.assign(Zo.y.lessThan(.5).select(x,v)),S.z.assign(D.z.mul(S.w))}else{let T=ft(w.y,w.x.negate()).toVar("offset");w.x.assign(w.x.div(c)),T.x.assign(T.x.div(c)),T.assign(Zo.x.lessThan(0).select(T.negate(),T)),Wt(Zo.y.lessThan(0),()=>{T.assign(T.sub(w))}).ElseIf(Zo.y.greaterThan(1),()=>{T.assign(T.add(w))}),T.assign(T.mul(FM)),T.assign(T.div(P1.w.div(hU))),S.assign(Zo.y.lessThan(.5).select(f,p)),T.assign(T.mul(S.w)),S.assign(S.add(Lt(T,0,0)))}return S})(),GJe=Ae(({material:i,renderer:e})=>{let t=i._useAlphaToCoverage,n=i._useDash,r=i._useWorldUnits,s=Pi();if(n){let a=i.dashSizeNode?se(i.dashSizeNode):bU,l=i.gapSizeNode?se(i.gapSizeNode):wU;Rm.assign(a),rb.assign(l),s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),GJ.mod(Rm.add(rb)).greaterThan(Rm).discard()}let o=se(1).toVar("alpha");if(r){let a=ym.xyz.normalize().mul(1e5),l=BF.sub(mM),c=Zye({p1:mM,p2:BF,p3:pe(0,0,0),p4:a}),u=mM.add(l.mul(c.x)),f=a.mul(c.y),v=u.sub(f).length().div(FM);if(!n)if(t&&e.currentSamples>0){let w=v.fwidth();o.assign(Ol(w.negate().add(.5),w.add(.5),v).oneMinus())}else v.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=se(c.fwidth()).toVar("dlen");Wt(s.y.abs().greaterThan(1),()=>{o.assign(Ol(u.oneMinus(),u.add(1),c).oneMinus())})}else Wt(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 Kye=new qy,UF=class extends Ar{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(Kye),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?se(this.opacityNode):yU;Ci.assign(qC(Lt(_U(ai),e),yr))}},LU=Ae(([i=dU])=>{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 ft(e,t)}),kF=Ae(([i=Pi()])=>{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)}),kM=class extends ua{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 Vu(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 Hc(5,5,5),o=LU(dU),a=new Ar;a.colorNode=li(t,o,0),a.side=hi,a.blending=Yr;let l=new Gn(s,a),c=new Jd;c.add(l),t.minFilter===xo&&(t.minFilter=bi);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)}},Qv=new WeakMap,GF=class extends pr{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Ea(null);let t=new Vu;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=_n.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===ap||o===lp){if(Qv.has(s)){let a=Qv.get(s);NY(a,s.mapping),this._cubeTexture=a}else{let a=s.image;if(Qye(a)){let l=new kM(a.height);l.fromEquirectangularTexture(t,s),NY(l.texture,s.mapping),this._cubeTexture=l.texture,Qv.set(s,l.texture),s.addEventListener("dispose",zJ)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function Qye(i){return i==null?!1:i.height>0}function zJ(i){let e=i.target;e.removeEventListener("dispose",zJ);let t=Qv.get(e);t!==void 0&&(Qv.delete(e),t.dispose())}function NY(i,e){e===ap?i.mapping=vl:e===lp&&(i.mapping=ic)}var VJ=Hn(GF).setParameterLength(1),lb=class extends f0{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=VJ(this.envNode)}},zF=class extends f0{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){let t=se(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}},O1=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},GM=class extends O1{constructor(){super()}indirect({context:e}){let t=e.ambientOcclusion,n=e.reflectedLight,r=e.irradianceLightMap;n.indirectDiffuse.assign(Lt(0)),r?n.indirectDiffuse.addAssign(r):n.indirectDiffuse.addAssign(Lt(1,1,1,0)),n.indirectDiffuse.mulAssign(t),n.indirectDiffuse.mulAssign(Ci.rgb)}finish(e){let{material:t,context:n}=e,r=n.outgoingLight,s=e.context.environment;if(s)switch(t.combine){case BA:r.rgb.assign(Xn(r.rgb,r.rgb.mul(s.rgb),Kv.mul(AM)));break;case JT:r.rgb.assign(Xn(r.rgb,s.rgb,Kv.mul(AM)));break;case e3:r.rgb.addAssign(s.rgb.mul(Kv.mul(AM)));break;default:je("BasicLightingModel: Unsupported .combine value:",t.combine);break}}},Jye=new as,VF=class extends Ar{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Jye),this.setValues(e)}setupNormal(){return Xm(L1)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new lb(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new zF(TU)),t}setupOutgoingLight(){return Ci.rgb}setupLightingModel(){return new GM}},B1=Ae(({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))}),km=Ae(i=>i.diffuseColor.mul(1/Math.PI)),e2e=()=>se(.25),t2e=Ae(({dotNH:i})=>TM.mul(se(.5)).add(1).mul(se(1/Math.PI)).mul(i.pow(TM))),n2e=Ae(({lightDirection:i})=>{let e=i.add(Vi).normalize(),t=ai.dot(e).clamp(),n=Vi.dot(e).clamp(),r=B1({f0:u0,f90:1,dotVH:n}),s=e2e(),o=t2e({dotNH:t});return r.mul(s).mul(o)}),zM=class extends GM{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=ai.dot(e).clamp().mul(t);n.directDiffuse.addAssign(s.mul(km({diffuseColor:Ci.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(n2e({lightDirection:e})).mul(Kv))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(km({diffuseColor:Ci}))),r.indirectDiffuse.mulAssign(t)}},i2e=new ma,qF=class extends Ar{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(i2e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new lb(t):null}setupLightingModel(){return new zM(!1)}},r2e=new NA,HF=class extends Ar{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(r2e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new lb(t):null}setupLightingModel(){return new zM}setupVariants(){let e=(this.shininessNode?se(this.shininessNode):QQ).max(1e-4);TM.assign(e);let t=this.specularNode||eJ;u0.assign(t)}},qJ=Ae(i=>{if(i.geometry.hasAttribute("normal")===!1)return se(0);let e=L1.dFdx().abs().max(L1.dFdy().abs());return e.x.max(e.y).max(e.z)}),DU=Ae(i=>{let{roughness:e}=i,t=qJ(),n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),HJ=Ae(({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 Fl(.5,r.add(s).max(kC))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),s2e=Ae(({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 Fl(.5,l.add(c).max(kC))}).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"}]}),WJ=Ae(({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"}]}),o2e=se(1/Math.PI),a2e=Ae(({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 o2e.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"}]}),FU=Ae(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,normalView:s=ai,USE_IRIDESCENCE:o,USE_ANISOTROPY:a})=>{let l=n.pow2(),c=i.add(Vi).normalize(),u=s.dot(i).clamp(),f=s.dot(Vi).clamp(),p=s.dot(c).clamp(),x=Vi.dot(c).clamp(),v=B1({f0:e,f90:t,dotVH:x}),w,S;if(I1(o)&&(v=OC.mix(v,r)),I1(a)){let T=Yv.dot(i),P=Yv.dot(Vi),R=Yv.dot(c),C=Cm.dot(i),L=Cm.dot(Vi),D=Cm.dot(c);w=s2e({alphaT:SM,alphaB:l,dotTV:P,dotBV:L,dotTL:T,dotBL:C,dotNV:f,dotNL:u}),S=a2e({alphaT:SM,alphaB:l,dotNH:p,dotTH:R,dotBH:D})}else w=HJ({alpha:l,dotNL:u,dotNV:f}),S=WJ({alpha:l,dotNH:p});return v.mul(w).mul(S)}),l2e=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]),xh=null,cb=Ae(({roughness:i,dotNV:e})=>{xh===null&&(xh=new EA(l2e,16,16,Ms,Di),xh.name="DFG_LUT",xh.minFilter=bi,xh.magFilter=bi,xh.wrapS=Go,xh.wrapT=Go,xh.generateMipmaps=!1,xh.needsUpdate=!0);let t=ft(i,e);return li(xh,t).rg}),c2e=Ae(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let a=FU({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o}),l=ai.dot(i).clamp(),c=ai.dot(Vi).clamp(),u=cb({roughness:n,dotNV:c}),f=cb({roughness:n,dotNV:l}),p=e.mul(u.x).add(t.mul(u.y)),x=e.mul(f.x).add(t.mul(f.y)),v=u.x.add(u.y),w=f.x.add(f.y),S=se(1).sub(v),T=se(1).sub(w),P=e.add(e.oneMinus().mul(.047619)),R=p.mul(x).mul(P).div(se(1).sub(S.mul(T).mul(P).mul(P)).add(kC)),C=S.mul(T),L=R.mul(C);return a.add(L)}),jJ=Ae(i=>{let{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=cb({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),WF=Ae(({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"}]}),u2e=Ae(({roughness:i,dotNH:e})=>{let t=i.pow2(),n=se(1).div(t),s=e.pow2().oneMinus().max(.0078125);return se(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"}]}),h2e=Ae(({dotNV:i,dotNL:e})=>se(1).div(se(4).mul(e.add(i).sub(e.mul(i))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),f2e=Ae(({lightDirection:i})=>{let e=i.add(Vi).normalize(),t=ai.dot(i).clamp(),n=ai.dot(Vi).clamp(),r=ai.dot(e).clamp(),s=u2e({roughness:e0,dotNH:r}),o=h2e({dotNV:n,dotNL:t});return Pl.mul(s).mul(o)}),LY=Ae(({N:i,V:e,roughness:t})=>{let s=.0078125,o=i.dot(e).saturate(),a=ft(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"}]}),d2e=Ae(({f:i})=>{let e=i.length();return Tr(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),BE=Ae(({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,Tr(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"}]}),l8=Ae(({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 Wt(u.dot(t.sub(r)).greaterThanEqual(0),()=>{let p=e.sub(i.mul(e.dot(i))).normalize(),x=i.cross(p).negate(),v=n.mul(so(p,x,i).transpose()).toVar(),w=v.mul(r.sub(t)).normalize().toVar(),S=v.mul(s.sub(t)).normalize().toVar(),T=v.mul(o.sub(t)).normalize().toVar(),P=v.mul(a.sub(t)).normalize().toVar(),R=pe(0).toVar();R.addAssign(BE({v1:w,v2:S})),R.addAssign(BE({v1:S,v2:T})),R.addAssign(BE({v1:T,v2:P})),R.addAssign(BE({v1:P,v2:w})),f.assign(pe(d2e({f:R})))}),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 QC=1/6,XJ=i=>bn(QC,bn(i,bn(i,i.negate().add(3)).sub(3)).add(1)),jF=i=>bn(QC,bn(i,bn(i,bn(3,i).sub(6))).add(4)),$J=i=>bn(QC,bn(i,bn(i,bn(-3,i).add(3)).add(3)).add(1)),XF=i=>bn(QC,Ac(i,3)),DY=i=>XJ(i).add(jF(i)),FY=i=>$J(i).add(XF(i)),OY=i=>fs(-1,jF(i).div(XJ(i).add(jF(i)))),BY=i=>fs(1,XF(i).div($J(i).add(XF(i)))),UY=(i,e,t)=>{let n=i.uvNode,r=bn(n,e.zw).add(.5),s=Ch(r),o=ou(r),a=DY(o.x),l=FY(o.x),c=OY(o.x),u=BY(o.x),f=OY(o.y),p=BY(o.y),x=ft(s.x.add(c),s.y.add(f)).sub(.5).mul(e.xy),v=ft(s.x.add(u),s.y.add(f)).sub(.5).mul(e.xy),w=ft(s.x.add(c),s.y.add(p)).sub(.5).mul(e.xy),S=ft(s.x.add(u),s.y.add(p)).sub(.5).mul(e.xy),T=DY(o.y).mul(fs(a.mul(i.sample(x).level(t)),l.mul(i.sample(v).level(t)))),P=FY(o.y).mul(fs(a.mul(i.sample(w).level(t)),l.mul(i.sample(S).level(t))));return T.add(P)},OU=Ae(([i,e])=>{let t=ft(i.size(fe(e))),n=ft(i.size(fe(e.add(1)))),r=Fl(1,t),s=Fl(1,n),o=UY(i,Lt(r,t),Ch(e)),a=UY(i,Lt(s,n),zC(e));return ou(e).mix(o,a)}),p2e=Ae(([i,e])=>{let t=e.mul(cU(i));return OU(i,t)}),kY=Ae(([i,e,t,n,r])=>{let s=pe(Q7(e.negate(),Jo(i),Fl(1,n))),o=pe(Rh(r[0].xyz),Rh(r[1].xyz),Rh(r[2].xyz));return Jo(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"}]}),A2e=Ae(([i,e])=>i.mul(au(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),m2e=RU(),g2e=FJ(),GY=Ae(([i,e,t],{material:n})=>{let s=(n.side===hi?m2e:g2e).sample(i),o=Mh(Bm.x).mul(A2e(e,t));return OU(s,o)}),zY=Ae(([i,e,t])=>(Wt(t.notEqual(0),()=>{let n=GC(e).negate().div(t);return k7(n.negate().mul(i))}),pe(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),_2e=Ae(([i,e,t,n,r,s,o,a,l,c,u,f,p,x,v])=>{let w,S;if(v){w=Lt().toVar(),S=pe().toVar();let L=u.sub(1).mul(v.mul(.025)),D=pe(u.sub(L),u,u.add(L));Ri({start:0,end:3},({i:F})=>{let N=D.element(F),B=kY(i,e,f,N,a),z=o.add(B),V=c.mul(l.mul(Lt(z,1))),H=ft(V.xy.div(V.w)).toVar();H.addAssign(1),H.divAssign(2),H.assign(ft(H.x,H.y.oneMinus()));let Z=GY(H,t,N);w.element(F).assign(Z.element(F)),w.a.addAssign(Z.a),S.element(F).assign(n.element(F).mul(zY(Rh(B),p,x).element(F)))}),w.a.divAssign(3)}else{let L=kY(i,e,f,u,a),D=o.add(L),F=c.mul(l.mul(Lt(D,1))),N=ft(F.xy.div(F.w)).toVar();N.addAssign(1),N.divAssign(2),N.assign(ft(N.x,N.y.oneMinus())),w=GY(N,t,u),S=n.mul(zY(Rh(L),p,x))}let T=S.rgb.mul(w.rgb),P=i.dot(e).clamp(),R=pe(jJ({dotNV:P,specularColor:r,specularF90:s,roughness:t})),C=S.r.add(S.g,S.b).div(3);return Lt(R.oneMinus().mul(T),w.a.oneMinus().mul(C).oneMinus())}),x2e=so(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),y2e=i=>{let e=i.sqrt();return pe(1).add(e).div(pe(1).sub(e))},VY=(i,e)=>i.sub(e).div(i.add(e)).pow2(),v2e=(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=se(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),x2e.mul(a)},qY=Ae(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{let s=Xn(i,e,Ol(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();Wt(a.lessThan(0),()=>pe(1));let l=a.sqrt(),c=VY(s,i),u=B1({f0:c,f90:1,dotVH:t}),f=u.oneMinus(),p=s.lessThan(i).select(Math.PI,0),x=se(Math.PI).sub(p),v=y2e(r.clamp(0,.9999)),w=VY(v,s.toVec3()),S=B1({f0:w,f90:1,dotVH:l}),T=pe(v.x.lessThan(s).select(Math.PI,0),v.y.lessThan(s).select(Math.PI,0),v.z.lessThan(s).select(Math.PI,0)),P=s.mul(n,l,2),R=pe(x).add(T),C=u.mul(S).clamp(1e-5,.9999),L=C.sqrt(),D=f.pow2().mul(S).div(pe(1).sub(C)),N=u.add(D).toVar(),B=D.sub(f).toVar();return Ri({start:1,end:2,condition:"<=",name:"m"},({m:z})=>{B.mulAssign(L);let V=v2e(se(z).mul(P),se(z).mul(R)).mul(2);N.addAssign(B.mul(V))}),N.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"}]}),Rv=Ae(({normal:i,viewDir:e,roughness:t})=>{let n=i.dot(e).saturate(),r=t.mul(t),s=t.add(.1).reciprocal(),o=se(-1.9362).add(t.mul(1.0678)).add(r.mul(.4573)).sub(s.mul(.8469)),a=se(-.6014).add(t.mul(.5538)).sub(r.mul(.467)).sub(s.mul(.1255));return o.mul(n).add(a).exp().saturate()}),Pv=pe(.04),UE=se(1),VM=class extends O1{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=ai.dot(Vi).clamp(),n=qY({outsideIOR:se(1),eta2:bM,cosTheta1:t,thinFilmThickness:wM,baseF0:u0}),r=qY({outsideIOR:se(1),eta2:bM,cosTheta1:t,thinFilmThickness:wM,baseF0:Ci.rgb});this.iridescenceFresnel=Xn(n,r,Jf),this.iridescenceF0Dielectric=WF({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=WF({f:r,f90:1,dotVH:t}),this.iridescenceF0=Xn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Jf)}if(this.transmission===!0){let t=Ph,n=SQ.sub(Ph).normalize(),r=g0,s=e.context;s.backdrop=_2e(r,n,Th,vm,wm,Sm,t,mc,m0,Ma,Zv,D7,O7,F7,this.dispersion?B7:null),s.backdropAlpha=EM,Ci.a.mulAssign(Xn(1,s.backdrop.a,EM))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){let o=ai.dot(Vi).clamp(),a=cb({roughness:Th,dotNV:o}),l=s?OC.mix(r,s):r,c=l.mul(a.x).add(n.mul(a.y)),f=a.x.add(a.y).oneMinus(),p=l.add(l.oneMinus().mul(.047619)),x=c.mul(p).div(f.mul(p).oneMinus());e.addAssign(c),t.addAssign(x.mul(f))}direct({lightDirection:e,lightColor:t,reflectedLight:n}){let s=ai.dot(e).clamp().mul(t).toVar();if(this.sheen===!0){this.sheenSpecularDirect.addAssign(s.mul(f2e({lightDirection:e})));let o=Rv({normal:ai,viewDir:Vi,roughness:e0}),a=Rv({normal:ai,viewDir:e,roughness:e0}),l=Pl.r.max(Pl.g).max(Pl.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){let a=i0.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(FU({lightDirection:e,f0:Pv,f90:UE,roughness:T1,normalView:i0})))}n.directDiffuse.addAssign(s.mul(km({diffuseColor:vm}))),n.directSpecular.addAssign(s.mul(c2e({lightDirection:e,f0:wm,f90:1,roughness:Th,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),p=ai,x=Vi,v=ts.toVar(),w=LY({N:p,V:x,roughness:Th}),S=o.sample(w).toVar(),T=a.sample(w).toVar(),P=so(pe(S.x,0,S.y),pe(0,1,0),pe(S.z,0,S.w)).toVar(),R=wm.mul(T.x).add(Sm.sub(wm).mul(T.y)).toVar();if(s.directSpecular.addAssign(e.mul(R).mul(l8({N:p,V:x,P:v,mInv:P,p0:l,p1:c,p2:u,p3:f}))),s.directDiffuse.addAssign(e.mul(vm).mul(l8({N:p,V:x,P:v,mInv:so(1,0,0,0,1,0,0,0,1),p0:l,p1:c,p2:u,p3:f}))),this.clearcoat===!0){let C=i0,L=LY({N:C,V:x,roughness:T1}),D=o.sample(L),F=a.sample(L),N=so(pe(D.x,0,D.y),pe(0,1,0),pe(D.z,0,D.w)),B=Pv.mul(F.x).add(UE.sub(Pv).mul(F.y));this.clearcoatSpecularDirect.addAssign(e.mul(B).mul(l8({N:C,V:x,P:v,mInv:N,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(km({diffuseColor:vm})).toVar();if(this.sheen===!0){let s=Rv({normal:ai,viewDir:Vi,roughness:e0}),o=Pl.r.max(Pl.g).max(Pl.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(Pl,Rv({normal:ai,viewDir:Vi,roughness:e0}))),this.clearcoat===!0){let S=i0.dot(Vi).clamp(),T=jJ({dotNV:S,specularColor:Pv,specularF90:UE,roughness:T1});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,Sm,u0,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,Sm,Ci.rgb,this.iridescenceF0Metallic);let c=Xn(s,a,Jf),u=Xn(o,l,Jf),f=s.add(o),p=vm.mul(f.oneMinus()),x=n.mul(1/Math.PI),v=t.mul(c).add(u.mul(x)).toVar(),w=p.mul(x).toVar();if(this.sheen===!0){let S=Rv({normal:ai,viewDir:Vi,roughness:e0}),T=Pl.r.max(Pl.g).max(Pl.b).mul(S).oneMinus();v.mulAssign(T),w.mulAssign(T)}r.indirectSpecular.addAssign(v),r.indirectDiffuse.addAssign(w)}ambientOcclusion(e){let{ambientOcclusion:t,reflectedLight:n}=e.context,s=ai.dot(Vi).clamp().add(t),o=Th.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=i0.dot(Vi).clamp(),r=B1({dotVH:n,f0:Pv,f90:UE}),s=t.mul(vM.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(vM));t.assign(s)}if(this.sheen===!0){let n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}},HY=se(1),$F=se(-2),kE=se(.8),c8=se(-1),GE=se(.4),u8=se(2),zE=se(.305),h8=se(3),WY=se(.21),b2e=se(4),jY=se(4),w2e=se(16),S2e=Ae(([i])=>{let e=pe(Ji(i)).toVar(),t=se(-1).toVar();return Wt(e.x.greaterThan(e.z),()=>{Wt(e.x.greaterThan(e.y),()=>{t.assign(Qo(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(Qo(i.y.greaterThan(0),1,4))})}).Else(()=>{Wt(e.z.greaterThan(e.y),()=>{t.assign(Qo(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(Qo(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),T2e=Ae(([i,e])=>{let t=ft().toVar();return Wt(e.equal(0),()=>{t.assign(ft(i.z,i.y).div(Ji(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(ft(i.x.negate(),i.z.negate()).div(Ji(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(ft(i.x.negate(),i.y).div(Ji(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(ft(i.z.negate(),i.y).div(Ji(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(ft(i.x.negate(),i.z).div(Ji(i.y)))}).Else(()=>{t.assign(ft(i.x,i.y).div(Ji(i.z)))}),bn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),E2e=Ae(([i])=>{let e=se(0).toVar();return Wt(i.greaterThanEqual(kE),()=>{e.assign(HY.sub(i).mul(c8.sub($F)).div(HY.sub(kE)).add($F))}).ElseIf(i.greaterThanEqual(GE),()=>{e.assign(kE.sub(i).mul(u8.sub(c8)).div(kE.sub(GE)).add(c8))}).ElseIf(i.greaterThanEqual(zE),()=>{e.assign(GE.sub(i).mul(h8.sub(u8)).div(GE.sub(zE)).add(u8))}).ElseIf(i.greaterThanEqual(WY),()=>{e.assign(zE.sub(i).mul(b2e.sub(h8)).div(zE.sub(WY)).add(h8))}).Else(()=>{e.assign(se(-2).mul(Mh(bn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),YJ=Ae(([i,e])=>{let t=i.toVar();t.assign(bn(2,t).sub(1));let n=pe(t,1).toVar();return Wt(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"}]}),ZJ=Ae(([i,e,t,n,r,s])=>{let o=se(t),a=pe(e),l=au(E2e(o),$F,s),c=ou(l),u=Ch(l),f=pe(ub(i,a,u,n,r,s)).toVar();return Wt(c.notEqual(0),()=>{let p=pe(ub(i,a,u.add(1),n,r,s)).toVar();f.assign(Xn(f,p,c))}),f}),ub=Ae(([i,e,t,n,r,s])=>{let o=se(t).toVar(),a=pe(e),l=se(S2e(a)).toVar(),c=se(Tr(jY.sub(o),0)).toVar();o.assign(Tr(o,jY));let u=se(N1(o)).toVar(),f=ft(T2e(a,l).mul(u.sub(2)).add(1)).toVar();return Wt(l.greaterThan(2),()=>{f.y.addAssign(u),l.subAssign(3)}),f.x.addAssign(l.mul(u)),f.x.addAssign(c.mul(bn(3,w2e))),f.y.addAssign(bn(4,N1(s).sub(u))),f.x.mulAssign(n),f.y.mulAssign(r),i.sample(f).grad(ft(),ft())}),f8=Ae(({envMap:i,mipInt:e,outputDirection:t,theta:n,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{let l=nu(n),c=t.mul(l).add(r.cross(t).mul(Ta(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return ub(i,c,e,s,o,a)}),KJ=Ae(({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 p=pe(Qo(e,t,td(t,n))).toVar();Wt(p.equal(pe(0)),()=>{p.assign(pe(n.z,0,n.x.negate()))}),p.assign(Jo(p));let x=pe().toVar();return x.addAssign(r.element(0).mul(f8({theta:0,axis:p,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),Ri({start:fe(1),end:i},({i:v})=>{Wt(v.greaterThanEqual(s),()=>{NJ()});let w=se(o.mul(se(v))).toVar();x.addAssign(r.element(v).mul(f8({theta:w.mul(-1),axis:p,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),x.addAssign(r.element(v).mul(f8({theta:w,axis:p,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f})))}),Lt(x,1)}),M2e=Ae(([i])=>{let e=it(i).toVar();return e.assign(e.shiftLeft(it(16)).bitOr(e.shiftRight(it(16)))),e.assign(e.bitAnd(it(1431655765)).shiftLeft(it(1)).bitOr(e.bitAnd(it(2863311530)).shiftRight(it(1)))),e.assign(e.bitAnd(it(858993459)).shiftLeft(it(2)).bitOr(e.bitAnd(it(3435973836)).shiftRight(it(2)))),e.assign(e.bitAnd(it(252645135)).shiftLeft(it(4)).bitOr(e.bitAnd(it(4042322160)).shiftRight(it(4)))),e.assign(e.bitAnd(it(16711935)).shiftLeft(it(8)).bitOr(e.bitAnd(it(4278255360)).shiftRight(it(8)))),se(e).mul(23283064365386963e-26)}),C2e=Ae(([i,e])=>ft(se(i).div(se(e)),M2e(i))),R2e=Ae(([i,e,t])=>{let n=t.mul(t).toConst(),r=pe(1,0,0).toConst(),s=td(e,r).toConst(),o=Ca(i.x).toConst(),a=bn(2,3.14159265359).mul(i.y).toConst(),l=o.mul(nu(a)).toConst(),c=o.mul(Ta(a)).toVar(),u=bn(.5,e.z.add(1)).toConst();c.assign(u.oneMinus().mul(Ca(l.mul(l).oneMinus())).add(u.mul(c)));let f=r.mul(l).add(s.mul(c)).add(e.mul(Ca(Tr(0,l.mul(l).add(c.mul(c)).oneMinus()))));return Jo(pe(n.mul(f.x),n.mul(f.y),Tr(0,f.z)))}),QJ=Ae(({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=se(0).toVar();return Wt(i.lessThan(.001),()=>{c.assign(ub(t,l,e,s,o,a))}).Else(()=>{let f=Qo(Ji(l.z).lessThan(.999),pe(0,0,1),pe(1,0,0)),p=Jo(td(f,l)).toVar(),x=td(l,p).toVar();Ri({start:it(0),end:r},({i:v})=>{let w=C2e(v,r),S=R2e(w,pe(0,0,1),i),T=Jo(p.mul(S.x).add(x.mul(S.y)).add(l.mul(S.z))),P=Jo(T.mul(xc(l,T).mul(2)).sub(l)),R=Tr(xc(l,P),0);Wt(R.greaterThan(0),()=>{let C=ub(t,P,e,s,o,a);c.addAssign(C.mul(R)),u.addAssign(R)})}),Wt(u.greaterThan(0),()=>{c.assign(c.div(u))})}),Lt(c,1)}),o0=4,XY=[.125,.215,.35,.446,.526,.582],bm=20,P2e=512,Iv=new Wc(-1,1,1,-1,0,1),I2e=new Nr(90,1),$Y=new Ut,d8=null,p8=0,A8=0,N2e=new ie,qM=new WeakMap,L2e=[3,1,5,0,4,2],m8=YJ(Pi(),Ll("faceIndex")).normalize(),JC=pe(m8.x,m8.y,m8.z),YF=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=N2e,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.');d8=this._renderer.getRenderTarget(),p8=this._renderer.getActiveCubeFace(),A8=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 Kn('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 Kn('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 Kn('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=ZY(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=KY(),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===vl||e.mapping===ic?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(d8,p8,A8),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),d8=this._renderer.getRenderTarget(),p8=this._renderer.getActiveCubeFace(),A8=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 YY(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=YY(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=D2e(t)),this._blurMaterial=F2e(t,e.width,e.height),this._ggxMaterial=O2e(t,e.width,e.height)}}async _compileMaterial(e){let t=new Gn(new qn,e);await this._renderer.compile(t,Iv)}_sceneToCubeUV(e,t,n,r,s){let o=I2e;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($Y),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Gn(new Hc,new as({name:"PMREM.Background",side:hi,depthWrite:!1,depthTest:!1})));let f=this._backgroundBox,p=f.material,x=!1,v=e.background;v?v.isColor&&(p.color.copy(v),e.background=null,x=!0):(p.color.copy($Y),x=!0),c.setRenderTarget(r),c.clear(),x&&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=v}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===vl||e.mapping===ic;r?this._cubemapMaterial===null&&(this._cubemapMaterial=ZY(e)):this._equirectMaterial===null&&(this._equirectMaterial=KY(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,Iv)}_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=qM.get(o),c=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),f=Math.sqrt(c*c-u*u),p=0+c*1.25,x=f*p,{_lodMax:v}=this,w=this._sizeLods[n],S=3*w*(n>v-o0?n-v+o0:0),T=4*(this._cubeSize-w);e.texture.frame=(e.texture.frame||0)+1,l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=v-t,this._setViewport(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,Iv),s.texture.frame=(s.texture.frame||0)+1,l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=v-n,this._setViewport(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,Iv)}_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"&&Ge("blur direction must be either latitudinal or longitudinal!");let u=3,f=this._lodMeshes[r];f.material=c;let p=qM.get(c),x=this._sizeLods[n]-1,v=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*bm-1),w=s/v,S=isFinite(s)?1+Math.floor(u*w):bm;S>bm&&je(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${bm}`);let T=[],P=0;for(let F=0;F<bm;++F){let N=F/w,B=Math.exp(-N*N/2);T.push(B),F===0?P+=B:F<S&&(P+=2*B)}for(let F=0;F<T.length;F++)T[F]=T[F]/P;e.texture.frame=(e.texture.frame||0)+1,p.envMap.value=e.texture,p.samples.value=S,p.weights.array=T,p.latitudinal.value=o==="latitudinal"?1:0,a&&(p.poleAxis.value=a);let{_lodMax:R}=this;p.dTheta.value=v,p.mipInt.value=R-n;let C=this._sizeLods[r],L=3*C*(r>R-o0?r-R+o0:0),D=4*(this._cubeSize-C);this._setViewport(t,L,D,3*C,2*C),l.setRenderTarget(t),l.render(f,Iv)}_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 D2e(i){let e=[],t=[],n=[],r=i,s=i-o0+1+XY.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-o0?l=XY[o-i+o0-1]:o===0&&(l=0),t.push(l);let c=1/(a-2),u=-c,f=1+c,p=[u,u,f,u,f,f,u,u,f,f,u,f],x=6,v=6,w=3,S=2,T=1,P=new Float32Array(w*v*x),R=new Float32Array(S*v*x),C=new Float32Array(T*v*x);for(let D=0;D<x;D++){let F=D%3*2/3-1,N=D>2?0:-1,B=[F,N,0,F+2/3,N,0,F+2/3,N+1,0,F,N,0,F+2/3,N+1,0,F,N+1,0],z=L2e[D];P.set(B,w*v*z),R.set(p,S*v*z);let V=[z,z,z,z,z,z];C.set(V,T*v*z)}let L=new qn;L.setAttribute("position",new Li(P,w)),L.setAttribute("uv",new Li(R,S)),L.setAttribute("faceIndex",new Li(C,T)),n.push(new Gn(L,null)),r>o0&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function YY(i,e,t){let n={magFilter:bi,minFilter:bi,generateMipmaps:!1,type:Di,format:br,colorSpace:Yd,depthBuffer:t},r=new ua(i,e,n);return r.texture.mapping=$u,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function eR(i){let e=new Ar;return e.depthTest=!1,e.depthWrite=!1,e.blending=Yr,e.name=`PMREM_${i}`,e}function F2e(i,e,t){let n=To(new Array(bm).fill(0)),r=Ht(new ie(0,1,0)),s=Ht(0),o=se(bm),a=Ht(0),l=Ht(1),c=li(),u=Ht(0),f=se(1/e),p=se(1/t),x=se(i),v={n:o,latitudinal:a,weights:n,poleAxis:r,outputDirection:JC,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:f,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:x},w=eR("blur");return w.fragmentNode=KJ({...v,latitudinal:a.equal(1)}),qM.set(w,v),w}function O2e(i,e,t){let n=li(),r=Ht(0),s=Ht(0),o=se(1/e),a=se(1/t),l=se(i),c={envMap:n,roughness:r,mipInt:s,CUBEUV_TEXEL_WIDTH:o,CUBEUV_TEXEL_HEIGHT:a,CUBEUV_MAX_MIP:l},u=eR("ggx");return u.fragmentNode=QJ({...c,N_immutable:JC,GGX_SAMPLES:it(P2e)}),qM.set(u,c),u}function ZY(i){let e=eR("cubemap");return e.fragmentNode=Ea(i,JC),e}function KY(i){let e=eR("equirect");return e.fragmentNode=li(i,LU(JC),0),e}var QY=new WeakMap;function B2e(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 U2e(i,e,t){let n=k2e(e),r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){let o=i.image;if(i.isCubeTexture)if(G2e(o))r=t.fromCubemap(i,r);else return null;else if(z2e(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 k2e(i){let e=QY.get(i);return e===void 0&&(e=new WeakMap,QY.set(i,e)),e}var ZF=class extends pr{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 Ts;r.isRenderTargetTexture=!0,this._texture=li(r),this._width=Ht(0),this._height=Ht(0),this._maxMip=Ht(0),this.updateBeforeType=_n.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){let t=B2e(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===$u?t=r:t=U2e(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new YF(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?DM.mul(pe(t.x,t.y.negate(),t.z)):DM.mul(t);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),ZJ(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function G2e(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 z2e(i){return i==null?!1:i.height>0}var BU=Hn(ZF).setParameterLength(1,3),JY=new WeakMap,KF=class extends f0{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],p=this._getPMREMNodeCache(e.renderer),x=p.get(f);x===void 0&&(x=BU(f),p.set(f,x)),n=x}let s=t.useAnisotropy===!0||t.anisotropy>0?$Q:ai,o=n.context(eZ(Th,s)).mul(pM),a=n.context(V2e(g0)).mul(Math.PI).mul(pM),l=C1(o),c=C1(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(c);let u=e.context.lightingModel.clearcoatRadiance;if(u){let f=n.context(eZ(T1,i0)).mul(pM),p=C1(f);u.addAssign(p)}}_getPMREMNodeCache(e){let t=JY.get(e);return t===void 0&&(t=new WeakMap,JY.set(e,t)),t}},eZ=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=Vi.negate().reflect(e),t=Z7(i).mix(t,e).normalize(),t=t.transformDirection(Sb)),t),getTextureLevel:()=>i}},V2e=i=>({getUV:()=>i,getTextureLevel:()=>se(1)}),q2e=new T_,HM=class extends Ar{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(q2e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new KF(t):null}setupLightingModel(){return new VM}setupSpecular(){let e=Xn(pe(.04),Ci.rgb,Jf);u0.assign(pe(.04)),wm.assign(e),Sm.assign(1)}setupVariants(){let e=this.metalnessNode?se(this.metalnessNode):iJ;Jf.assign(e);let t=this.roughnessNode?se(this.roughnessNode):nJ;t=DU({roughness:t}),Th.assign(t),this.setupSpecular(),vm.assign(Ci.rgb.mul(e.oneMinus()))}},H2e=new zy,QF=class extends HM{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(H2e),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?se(this.iorNode):gJ;Zv.assign(e),u0.assign(el(Y7(Zv.sub(1).div(Zv.add(1))).mul(tJ),pe(1)).mul(SF)),wm.assign(Xn(u0,Ci.rgb,Jf)),Sm.assign(Xn(SF,1,Jf))}setupLightingModel(){return new VM(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){let t=this.clearcoatNode?se(this.clearcoatNode):sJ,n=this.clearcoatRoughnessNode?se(this.clearcoatRoughnessNode):oJ;vM.assign(t),T1.assign(DU({roughness:n}))}if(this.useSheen){let t=this.sheenNode?pe(this.sheenNode):cJ,n=this.sheenRoughnessNode?se(this.sheenRoughnessNode):uJ;Pl.assign(t),e0.assign(n)}if(this.useIridescence){let t=this.iridescenceNode?se(this.iridescenceNode):fJ,n=this.iridescenceIORNode?se(this.iridescenceIORNode):dJ,r=this.iridescenceThicknessNode?se(this.iridescenceThicknessNode):pJ;OC.assign(t),bM.assign(n),wM.assign(r)}if(this.useAnisotropy){let t=(this.anisotropyNode?ft(this.anisotropyNode):hJ).toVar();Jp.assign(t.length()),Wt(Jp.equal(0),()=>{t.assign(ft(1,0))}).Else(()=>{t.divAssign(ft(Jp)),Jp.assign(Jp.saturate())}),SM.assign(Jp.pow2().mix(Th.pow2(),1)),Yv.assign(Tm[0].mul(t.x).add(Tm[1].mul(t.y))),Cm.assign(Tm[1].mul(t.x).sub(Tm[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?se(this.transmissionNode):AJ,n=this.thicknessNode?se(this.thicknessNode):mJ,r=this.attenuationDistanceNode?se(this.attenuationDistanceNode):_J,s=this.attenuationColorNode?pe(this.attenuationColorNode):xJ;if(EM.assign(t),D7.assign(n),F7.assign(r),O7.assign(s),this.useDispersion){let o=this.dispersionNode?se(this.dispersionNode):vJ;B7.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pe(this.clearcoatNormalNode):aJ}setup(e){e.context.setupClearcoatNormal=()=>Pm(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}};var W2e=Ae(({normal:i,lightDirection:e,builder:t})=>{let n=i.dot(e),r=ft(n.mul(.5).add(.5),0);if(t.material.gradientMap){let s=Kf("gradientMap","texture").context({getUV:()=>r});return pe(s.r)}else{let s=r.fwidth().mul(.5);return Xn(pe(.7),pe(1),Ol(se(.7).sub(s.x),se(.7).add(s.x),r.x))}}),JF=class extends O1{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){let s=W2e({normal:jC,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(km({diffuseColor:Ci.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(km({diffuseColor:Ci}))),r.indirectDiffuse.mulAssign(t)}},j2e=new Vy,eO=class extends Ar{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(j2e),this.setValues(e)}setupLightingModel(){return new JF}},JJ=Ae(()=>{let i=pe(Vi.z,0,Vi.x.negate()).normalize(),e=Vi.cross(i);return ft(i.dot(ai),e.dot(ai)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),X2e=new Hy,tO=class extends Ar{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(X2e),this.setValues(e)}setupVariants(e){let t=JJ,n;e.material.matcap?n=Kf("matcap","texture").context({getUV:()=>t}):n=pe(Xn(.2,.8,t.y)),Ci.rgb.mulAssign(n.rgb)}},nO=class extends pr{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 FC(s,o,o.negate(),s).mul(n)}else{let s=t,o=a0(Lt(1,0,0,0),Lt(0,nu(s.x),Ta(s.x).negate(),0),Lt(0,Ta(s.x),nu(s.x),0),Lt(0,0,0,1)),a=a0(Lt(nu(s.y),0,Ta(s.y),0),Lt(0,1,0,0),Lt(Ta(s.y).negate(),0,nu(s.y),0),Lt(0,0,0,1)),l=a0(Lt(nu(s.z),Ta(s.z).negate(),0,0),Lt(Ta(s.z),nu(s.z),0,0),Lt(0,0,1,0),Lt(0,0,0,1));return o.mul(a).mul(l).mul(Lt(n,1)).xyz}}},Eb=Hn(nO).setParameterLength(2),$2e=new zu,WM=class extends Ar{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($2e),this.setValues(e)}setupPositionView(e){let{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=Lh.mul(pe(r||0)),c=ft(mc[0].xyz.length(),mc[1].xyz.length());o!==null&&(c=c.mul(ft(o))),n.isPerspectiveCamera&&a===!1&&(c=c.mul(l.z.negate()));let u=Zo.xy;if(t.center&&t.center.isVector2===!0){let x=Oxe("center","vec2",t);u=u.sub(x.sub(.5))}u=u.mul(c);let f=se(s||lJ),p=Eb(u,f);return Lt(l.xy.add(p),l.zw)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}},Y2e=new ep,Z2e=new Oe,iO=class extends WM{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(Y2e),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return Lh.mul(pe(e||fr)).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?ft(o):yJ;c=c.mul(hU),n.isPerspectiveCamera&&a===!0&&(c=c.mul(K2e.div(ts.z.negate()))),s&&s.isNode&&(c=c.mul(ft(s)));let u=Zo.xy;if(r&&r.isNode){let f=se(r);u=Eb(u,f)}return u=u.mul(c),u=u.div(fU.div(2)),u=u.mul(l.w),l=l.add(Lt(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)}},K2e=Ht(1).onFrameUpdate(function({renderer:i}){let e=i.getSize(Z2e);this.value=.5*e.y}),rO=class extends O1{constructor(){super(),this.shadowNode=se(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Ci.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Ci.rgb)}},Q2e=new Gy,sO=class extends Ar{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(Q2e),this.setValues(e)}setupLightingModel(){return new rO}},zJe=id("vec3"),VJe=id("vec3"),qJe=id("vec3");var oO=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()}},Fh=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])}},J2e=0,tZ=new WeakMap;function eve(i){let e=Object.keys(i),t=tZ.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)}tZ.set(i.constructor,t)}for(let n=0;n<t.length;n++)e.push(t[n]);return e}var aO=class{constructor(e,t,n,r,s,o,a,l,c,u){this.id=J2e++,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,p=(s.start+s.count)*u;r!==null&&(f=Math.max(f,r.start*u),p=Math.min(p,(r.start+r.count)*u));let x=n.attributes.position,v=1/0;l?v=a.count:x!=null&&(v=x.count),f=Math.max(f,0),p=Math.min(p,v);let w=p-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 eve(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+",",z1(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=Xv(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=Xv(e,1)),e=Xv(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()}},yh=[],lO=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);yh[0]=e,yh[1]=t,yh[2]=o,yh[3]=s;let u=c.get(yh);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),c.set(yh,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)),yh[0]=null,yh[1]=null,yh[2]=null,yh[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Fh)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,c,u,f){let p=this.getChainMap(f),x=new aO(e,t,n,r,s,o,a,l,c,u);return x.onDispose=()=>{this.pipelines.delete(x),this.bindings.deleteForRender(x),this.nodes.delete(x),p.delete(x.getChainArray())},x}},Oh=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}},gc={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},r0=16,tve=211,nve=212,cO=class extends Oh{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===gc.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===gc.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===gc.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===gc.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===XA)&&(this.backend.updateAttribute(e),n.version=r.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}};function eee(i){return i.index!==null?i.index.version:i.attributes.position.version}function tee(i){return i.index!==null?i.index.id:i.attributes.position.id}function nZ(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?SA:wA)(e,1);return r.version=eee(i),r.__id=tee(i),r}var uO=class extends Oh{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,gc.STORAGE):this.updateAttribute(s,gc.VERTEX);let n=this.getIndex(e);n!==null&&this.updateAttribute(n,gc.INDEX);let r=e.geometry.indirect;r!==null&&this.updateAttribute(r,gc.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=nZ(t),s.set(t,o)):(o.version!==eee(t)||o.__id!==tee(t))&&(this.attributes.delete(o),o=nZ(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()}},hO=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):Ge("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===Yu||e.type===zi?t=1:e.type===Zu||e.type===Xa||e.type===Di?t=2:(e.type===Dr||e.type===Ai||e.type===Zi)&&(t=4);let n=4;e.format===P_||e.format===kf||e.format===Ku||e.format===ws||e.format===eo?n=1:e.format===Ms||e.format===Qu?n=2:(e.format===Uf||e.format===b2)&&(n=3);let r=t*n;e.type===UA||e.type===kA?r=2:(e.type===Vo||e.type===GA||e.type===zA)&&(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 p=c[f];if(p.data)u+=p.data.byteLength;else{let x=p.width||Math.max(1,s>>f),v=p.height||Math.max(1,o>>f);u+=x*v*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}},jM=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},fO=class extends jM{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}},dO=class extends jM{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},ive=0,Jv=class{constructor(e,t,n,r=null,s=null){this.id=ive++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}},pO=class extends Oh{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 Jv(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 Jv(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 Jv(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 dO(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 fO(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)}},AO=class extends Oh{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?gc.INDIRECT:gc.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?gc.INDIRECT:gc.STORAGE,p=n.get(l);this.attributes.update(u,f),p.attribute!==u&&(p.attribute=u,r=!0)}if(l.isUniformBuffer)l.update()&&n.updateBinding(l);else if(l.isSampledTexture){let u=l.update(),f=l.texture,p=this.textures.get(f);if(u&&(this.textures.updateTexture(f),l.generation!==p.generation&&(l.generation=p.generation,r=!0),p.bindGroups.add(e)),n.get(f).externalTexture!==void 0||p.isDefaultTexture?s=!1:(o=o*10+f.id,a+=f.version),f.isStorageTexture===!0&&f.mipmapsAutoUpdate===!0){let v=this.get(f);l.store===!0?v.needsMipmap=!0:this.textures.needsMipmaps(f)&&v.needsMipmap===!0&&(this.backend.generateMipmaps(f),v.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)}},rve=Object.freeze([]);function sve(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 iZ(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 rZ(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===rr&&i.forceSinglePass===!1}var mO=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?(rZ(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?(rZ(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||sve),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||iZ),this.transparent.length>1&&this.transparent.sort(t||iZ),n&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:rve);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}},a1=[],gO=class{constructor(e){this.lighting=e,this.lists=new Fh}get(e,t){let n=this.lists;a1[0]=e,a1[1]=t;let r=n.get(a1);return r===void 0&&(r=new mO(this.lighting,e,t),n.set(a1,r)),a1[0]=null,a1[1]=null,r}dispose(){this.lists=new Fh}},ove=0,_O=class{constructor(){this.id=ove++,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 gn,this.scissor=!1,this.scissorValue=new gn,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 nee(this)}};function nee(i){let{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(let s of e)r.push(s.id);return wb(r)}var xO=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 _O,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={}}},ave=new ie,yO=class extends Oh{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,p=!1,x=u!==void 0&&u.image!==void 0&&u.image.depth>1,v=a.depth>1&&(e.useArrayDepthTexture||e.multiview||x);u===void 0&&f&&(u=new ls,u.format=e.stencilBuffer?eo:ws,u.type=e.stencilBuffer?Vo:Ai,u.image.width=l,u.image.height=c,u.image.depth=a.depth,u.renderTarget=e,s[t]=u),u&&(u.isArrayTexture=v),(n.width!==a.width||a.height!==n.height)&&(p=!0,u&&(u.needsUpdate=!0,u.image.width=l,u.image.height=c,u.image.depth=v?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&&(p=!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];p&&(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=zi}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 p=f&&f.changedElements;for(let x of u)(!p||p.includes(x.image))&&(x.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)je("Renderer: Texture marked for update but image is undefined.");else if(c.complete===!1)je("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){let f=[];for(let p of e.images)f.push(p);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&&sn.enabled===!0&&sn.getTransfer(e.colorSpace)!==Bt&&je("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=ave){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)}}},hb=class extends Ut{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)}},XM=class extends sb{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 iee(i,e=null,t=null){if(e&&e.isNode){let n=e;e=()=>n}return new XM(new Map([[i,e]]),t)}Be("overrideNode",(i,e,t)=>iee(e,t,i));function ree(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 XM(t,e)}Be("overrideNodes",(i,e)=>ree(e,i));var $M=class extends di{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):(Ge(`TSL: Member "${t}" not found in struct "${n}".`,new Ur),s="float"),s}getHash(){return String(this.id)}generate(){return this.name}},lve=(i,e)=>new $M(i,e),vO=class extends $t{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 Ge("TSL: Invalid node added to stack.",new Ur),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 w1(t);return this._currentCond=Qo(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=new w1(t),r=Qo(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new w1(e),this}Switch(e){return this._expressionNode=Vt(e),this}Case(...e){let t=[];if(e.length>=2)for(let a=0;a<e.length-1;a++)t.push(this._expressionNode.equal(Vt(e[a])));else Ge("TSL: Invalid parameter length. Case() requires at least two parameters.",new Ur);let n=e[e.length-1],r=new w1(n),s=t[0];for(let a=1;a<t.length;a++)s=s.or(t[a]);let o=Qo(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=C7(),r=e.buildStage;ib(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 ib(n),e.removeActiveStack(this),s}},gM=Hn(vO).setParameterLength(0,1);function cve(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 bO=class extends $t{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=cve(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let n of this.membersLayout){let r=n.type,s=nxe(r),o=ixe(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)}},wO=class extends $t{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}},uve=(i,e=null)=>{let t=new bO(i,e);return M7((...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 wO(t,s)},t)},YM=class extends $t{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}},hve=Hn(YM),ZM=class{constructor(e=os){this.blending=e,this.blendSrc=Xd,this.blendDst=$d,this.blendEquation=Gs,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)}},fve=new ZM(Yr),dve=new ZM(i2);function see(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}var SO=class extends YM{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:dve},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||fve}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=oee(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=see(s,o);if(a===-1)continue;let l=e.getOutputType(a);r[a]=t[o].convert(l)}return this.members=r,super.setup(e)}},oee=Hn(SO),Gm=class extends pr{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)} )`}},aee=lt(Gm).setParameterLength(2),pve=i=>new Gm(i,"int","float"),lee=i=>new Gm(i,"uint","float"),Ave=i=>new Gm(i,"float","int"),mve=i=>new Gm(i,"float","uint"),VE={},cu=class i extends Re{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,n){n==="int"?t.assign(aee(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return it;case"int":return fe;case"uvec2":return R7;case"uvec3":return Hm;case"uvec4":return L7;case"ivec2":return Sr;case"ivec3":return P7;case"ivec4":return N7}}_createTrailingZerosBaseLayout(e,t){let n=this._returnDataNode(t);return Ae(([s])=>{let o=it(0);this._resolveElementType(s,o,t);let a=se(o.bitAnd(H7(o))),c=lee(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 Ae(([s])=>{Wt(s.equal(it(0)),()=>it(32));let o=it(0),a=it(0);return this._resolveElementType(s,o,t),Wt(o.shiftRight(16).equal(0),()=>{a.addAssign(16),o.shiftLeftAssign(16)}),Wt(o.shiftRight(24).equal(0),()=>{a.addAssign(8),o.shiftLeftAssign(8)}),Wt(o.shiftRight(28).equal(0),()=>{a.addAssign(4),o.shiftLeftAssign(4)}),Wt(o.shiftRight(30).equal(0),()=>{a.addAssign(2),o.shiftLeftAssign(2)}),Wt(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 Ae(([s])=>{let o=it(0);this._resolveElementType(s,o,t),o.assign(o.sub(o.shiftRight(it(1)).bitAnd(it(1431655765)))),o.assign(o.bitAnd(it(858993459)).add(o.shiftRight(it(2)).bitAnd(it(858993459))));let a=o.add(o.shiftRight(it(4))).bitAnd(it(252645135)).mul(it(16843009)).shiftRight(it(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 Ae(([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=VE[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}}VE[l]=u}let f=VE[c];return f===void 0&&(f=this._createMainLayout(c,s,a,u),VE[c]=f),Ae(()=>f(n))()}};cu.COUNT_TRAILING_ZEROS="countTrailingZeros";cu.COUNT_LEADING_ZEROS="countLeadingZeros";cu.COUNT_ONE_BITS="countOneBits";var gve=lt(cu,cu.COUNT_TRAILING_ZEROS).setParameterLength(1),_ve=lt(cu,cu.COUNT_LEADING_ZEROS).setParameterLength(1),xve=lt(cu,cu.COUNT_ONE_BITS).setParameterLength(1),yve=Ae(([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)}),TO=(i,e)=>Ac(bn(4,i.mul(ni(1,i))),e),vve=(i,e)=>i.lessThan(.5)?TO(i.mul(2),e).div(2):ni(1,TO(bn(ni(1,i),2),e).div(2)),bve=(i,e,t)=>Ac(Fl(Ac(i,e),fs(Ac(i,e),Ac(ni(1,i),t))),1/e),wve=(i,e)=>Ta(RM.mul(e.mul(i).sub(1))).div(RM.mul(e.mul(i).sub(1))),fb=class extends pr{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)})`}},Sve=lt(fb,"snorm").setParameterLength(1),Tve=lt(fb,"unorm").setParameterLength(1),Eve=lt(fb,"float16").setParameterLength(1),db=class extends pr{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)})`}},Mve=lt(db,"snorm").setParameterLength(1),Cve=lt(db,"unorm").setParameterLength(1),Rve=lt(db,"float16").setParameterLength(1),Zf=Ae(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),Pve=Ae(([i])=>pe(Zf(i.z.add(Zf(i.y.mul(1)))),Zf(i.z.add(Zf(i.x.mul(1)))),Zf(i.y.add(Zf(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Ive=Ae(([i,e,t])=>{let n=pe(i).toVar(),r=se(1.4).toVar(),s=se(0).toVar(),o=pe(n).toVar();return Ri({start:se(0),end:se(3),type:"float",condition:"<="},()=>{let a=pe(Pve(o.mul(2))).toVar();n.addAssign(a.add(t.mul(se(.1).mul(e)))),o.mulAssign(1.8),r.mulAssign(1.5),n.mulAssign(1.2);let l=se(Zf(n.z.add(Zf(n.x.add(Zf(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"}]}),EO=class extends $t{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 p=t[f],x=c[f];p.getNodeType(e)===x.type&&u++}u>s&&(r=o,s=u)}}this._candidateFn=n=r}return n}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}},Nve=Hn(EO),Co=i=>(...e)=>Nve(i,...e),H1=Ht(0).setGroup(Zt).onRenderUpdate(i=>i.time),Lve=Ht(0).setGroup(Zt).onRenderUpdate(i=>i.deltaTime),cee=Ht(0,"uint").setGroup(Zt).onRenderUpdate(i=>i.frameId),Dve=(i=H1)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),Fve=(i=H1)=>i.fract().round(),Ove=(i=H1)=>i.add(.5).fract().mul(2).sub(1).abs(),Bve=(i=H1)=>i.fract();function Uve(i,e=null){return rd(e,{getUV:typeof i=="function"?i:()=>i})}var kve=Ae(([i,e,t=ft(.5)])=>Eb(i.sub(t),e).add(t)),Gve=Ae(([i,e,t=ft(.5)])=>{let n=i.sub(t),r=n.dot(n),o=r.mul(r).mul(e);return i.add(n.mul(o))}),zve=Ae(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=mc.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=mc;let r=m0.mul(n);return I1(e)&&(r[0][0]=mc[0].length(),r[0][1]=0,r[0][2]=0),I1(t)&&(r[1][0]=0,r[1][1]=mc[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Ma.mul(r).mul(fr)}),Vve=Ae(([i=null])=>{let e=UM();return UM(PU(i)).sub(e).lessThan(0).select(ru,i)}),qve=Ae(([i,e=Pi(),t=se(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=ft(o,a);return e.add(c).mul(l)}),uee=Ae(([i,e=null,t=null,n=se(1),r=fr,s=ta])=>{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,p=t!==null?t.value:u,x=li(u,a).mul(o.x),v=li(f,l).mul(o.y),w=li(p,c).mul(o.z);return fs(x,v,w)}),Hve=(...i)=>uee(...i),l1=new la,Am=new ie,c1=new ie,g8=new ie,Nv=new on,qE=new ie(0,0,-1),vh=new gn,Lv=new ie,HE=new ie,Dv=new gn,WE=new Oe,KM=new ua,Wve=ru.flipX();KM.depthTexture=new ls(1,1);var jE=!1,MO=class i extends yc{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||KM.texture,Wve),this._reflectorBaseNode=e.reflector||new CO(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:KM.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()}},CO=class extends $t{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();let{target:n=new Yi,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&&(Kn('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?_n.RENDER:_n.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){let n=this.resolutionScale;t.getDrawingBufferSize(WE),e.setSize(Math.round(WE.width*n),Math.round(WE.height*n))}setup(e){return this._updateResolution(KM,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 ua(0,0,{type:Di,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=hL,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new ls),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&jE)return!1;jE=!0;let{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(WE),this._updateResolution(l,r),c1.setFromMatrixPosition(o.matrixWorld),g8.setFromMatrixPosition(n.matrixWorld),Nv.extractRotation(o.matrixWorld),Am.set(0,0,1),Am.applyMatrix4(Nv),Lv.subVectors(c1,g8);let c=Lv.dot(Am)>0,u=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){jE=!1;return}u=!0}Lv.reflect(Am).negate(),Lv.add(c1),Nv.extractRotation(n.matrixWorld),qE.set(0,0,-1),qE.applyMatrix4(Nv),qE.add(g8),HE.subVectors(c1,qE),HE.reflect(Am).negate(),HE.add(c1),a.coordinateSystem=n.coordinateSystem,a.position.copy(Lv),a.up.set(0,1,0),a.up.applyMatrix4(Nv),a.up.reflect(Am),a.lookAt(HE),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),l1.setFromNormalAndCoplanarPoint(Am,c1),l1.applyMatrix4(a.matrixWorldInverse),vh.set(l1.normal.x,l1.normal.y,l1.normal.z,l1.constant);let f=a.projectionMatrix;Dv.x=(Math.sign(vh.x)+f.elements[8])/f.elements[0],Dv.y=(Math.sign(vh.y)+f.elements[9])/f.elements[5],Dv.z=-1,Dv.w=(1+f.elements[10])/f.elements[14],vh.multiplyScalar(1/vh.dot(Dv));let p=0;f.elements[2]=vh.x,f.elements[6]=vh.y,f.elements[10]=r.coordinateSystem===Ha?vh.z-p:vh.z+1-p,f.elements[14]=vh.w,this.textureNode.value=l.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=l.depthTexture),s.visible=!1;let x=r.getRenderTarget(),v=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(v),r.setRenderTarget(x),r.autoClear=w,s.visible=!0,jE=!1,this.forceUpdate=!1}get resolution(){return Kn('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){Kn('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}},jve=i=>new MO(i),_8=new Wc(-1,1,1,-1,0,1),RO=class extends qn{constructor(e=!1){super();let t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Rn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Rn(t,2))}},Xve=new RO,pb=class extends Gn{constructor(e=null){super(Xve,e),this.camera=_8,this.isQuadMesh=!0}async renderAsync(e){Kn('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,_8)}render(e){e.render(this,_8)}},$ve=new Oe,PO=class extends yc{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Di}){let s=new ua(t,n,r);super(s.texture,Pi()),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 pb(new Ar),this.updateBeforeType=_n.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($ve),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 yc(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},hee=(i,...e)=>new PO(Vt(i),...e),Yve=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():hee(i,...e),b1=Ae(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===Ha?(i=ft(i.x,i.y.oneMinus()).mul(2).sub(1),r=Lt(pe(i,e),1)):r=Lt(pe(i.x,i.y.oneMinus(),e).mul(2).sub(1),1);let s=Lt(t.mul(r));return s.xyz.div(s.w)}),Zve=Ae(([i,e])=>{let t=e.mul(Lt(i,1)),n=t.xy.div(t.w).mul(.5).add(.5).toVar();return ft(n.x,n.y.oneMinus())}),Kve=Ae(([i,e,t])=>{let n=Om(es(e)),r=Sr(i.mul(n)).toVar(),s=es(e,r).toVar(),o=es(e,r.sub(Sr(2,0))).toVar(),a=es(e,r.sub(Sr(1,0))).toVar(),l=es(e,r.add(Sr(1,0))).toVar(),c=es(e,r.add(Sr(2,0))).toVar(),u=es(e,r.add(Sr(0,2))).toVar(),f=es(e,r.add(Sr(0,1))).toVar(),p=es(e,r.sub(Sr(0,1))).toVar(),x=es(e,r.sub(Sr(0,2))).toVar(),v=Ji(ni(se(2).mul(a).sub(o),s)).toVar(),w=Ji(ni(se(2).mul(l).sub(c),s)).toVar(),S=Ji(ni(se(2).mul(f).sub(u),s)).toVar(),T=Ji(ni(se(2).mul(p).sub(x),s)).toVar(),P=b1(i,s,t).toVar(),R=v.lessThan(w).select(P.sub(b1(i.sub(ft(se(1).div(n.x),0)),a,t)),P.negate().add(b1(i.add(ft(se(1).div(n.x),0)),l,t))),C=S.lessThan(T).select(P.sub(b1(i.add(ft(0,se(1).div(n.y))),f,t)),P.negate().add(b1(i.sub(ft(0,se(1).div(n.y))),p,t)));return Jo(td(R,C))}),UU=Ae(([i])=>ou(se(52.9829189).mul(ou(xc(i,ft(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),iu=Ae(([i,e,t])=>{let n=se(2.399963229728653),r=Ca(se(i).add(.5).div(se(e))),s=se(i).mul(n).add(t);return ft(nu(s),Ta(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]}),IO=class extends $t{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(Pi())}sample(e){return this.callback(e)}},Qve=(i,e=null)=>new IO(i,Vt(e)),zm=class extends _l{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},NO=class extends Li{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},Jve=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=_M("float")):(t=GZ(e),n=_M(e));let r=new NO(i,t,n);return l0(r,e,i)},ebe=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=_M("float")):(t=GZ(e),n=_M(e));let r=new zm(i,t,n);return l0(r,e,r.count)},LO=class extends $t{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}},tbe=xt(LO),x8=new on,fee=Ht(0).setGroup(Zt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),DO=Ht(1).setGroup(Zt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),dee=Ht(new on).setGroup(Zt).onRenderUpdate(({scene:i})=>{let e=i.background;return e!==null&&e.isTexture&&e.mapping!==y2||i.backgroundNode&&i.backgroundNode.isNode?x8.makeRotationFromEuler(i.backgroundRotation).transpose():x8.identity(),x8}),QM=class extends yc{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=Eo.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(Eo.READ_WRITE)}toReadOnly(){return this.setAccess(Eo.READ_ONLY)}toWriteOnly(){return this.setAccess(Eo.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}},pee=Hn(QM).setParameterLength(1,3),nbe=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?n=i.store(e,t):(n=pee(i,e,t),t!==null&&n.toStack()),n},FO=class extends QM{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")}},ibe=Hn(FO).setParameterLength(1,3),rbe=Ae(({texture:i,uv:e})=>{let n=pe().toVar();return Wt(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()}),OO=class extends yc{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 rbe({texture:this,uv:e})}},kU=Hn(OO).setParameterLength(1,3),sbe=(...i)=>kU(...i).setSampler(!1),obe=(i,e,t)=>kU(i,e).level(t),BO=class extends D1{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}},abe=(i,e,t)=>new BO(i,e,t),sZ=new WeakMap,UO=class extends pr{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=_n.OBJECT,this.updateAfterType=_n.OBJECT,this.previousModelWorldMatrix=Ht(new on),this.previousProjectionMatrix=Ht(new on).setGroup(Zt),this.previousCameraViewMatrix=Ht(new on)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:n}){let r=oZ(n);this.previousModelWorldMatrix.value.copy(r);let s=Aee(t);s.frameId!==e&&(s.frameId=e,s.previousProjectionMatrix===void 0?(s.previousProjectionMatrix=new on,s.previousCameraViewMatrix=new on,s.currentProjectionMatrix=new on,s.currentCameraViewMatrix=new on,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}){oZ(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?Ma:Ht(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(Lh).mul(fr),r=this.previousProjectionMatrix.mul(t).mul(Um),s=n.xy.div(n.w),o=r.xy.div(r.w);return ni(s,o)}};function Aee(i){let e=sZ.get(i);return e===void 0&&(e={},sZ.set(i,e)),e}function oZ(i,e=0){let t=Aee(i),n=t[e];return n===void 0&&(t[e]=n=new on,t[e].copy(i.matrixWorld)),n}var lbe=xt(UO),cbe=Ae(([i,e])=>el(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),ube=Ae(([i,e])=>el(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),hbe=Ae(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),fbe=Ae(([i,e])=>Xn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),Fm(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),dbe=Ae(([i,e])=>{let t=e.a.add(i.a.mul(e.a.oneMinus()));return Lt(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"}]}),pbe=Ae(([i])=>GU(i.rgb)),Abe=Ae(([i,e=se(1)])=>e.mix(GU(i.rgb),i.rgb).max(0)),mbe=Ae(([i,e=se(0)])=>{let t=fs(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 Xn(i.rgb,n,r).max(0)}),gbe=Ae(([i,e=se(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(xc(t,i.rgb).mul(n.oneMinus()))))).max(0)}),GU=(i,e=pe(sn.getLuminanceCoefficients(new ie)))=>xc(i,e),_be=Ae(([i,e=pe(1),t=pe(0),n=pe(1),r=se(1),s=pe(sn.getLuminanceCoefficients(new ie,Yd))])=>{let o=i.rgb.dot(pe(s)),a=Tr(i.rgb.mul(e).add(t),0),l=a.pow(n);return Wt(a.r.greaterThan(0),()=>{a.r.assign(l.r)}),Wt(a.g.greaterThan(0),()=>{a.g.assign(l.g)}),Wt(a.b.greaterThan(0),()=>{a.b.assign(l.b)}),a.assign(o.add(a.sub(o).mul(r)).max(0)),Lt(a.rgb,i.a)}),xbe=Ae(([i,e])=>i.mul(e).floor().div(e)),XE=null,kO=class extends F1{static get type(){return"ViewportSharedTextureNode"}constructor(e=ru,t=null){XE===null&&(XE=new MA),super(e,t,XE)}getTextureForReference(){return XE}updateReference(){return this}},ybe=Hn(kO).setParameterLength(0,2),$E=new Oe,JM=class extends yc{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)}},eC=class extends JM{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}},Bh=class i extends pr{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 ua(this._width,this._height,{type:Di,...r});s.texture.name="output";let o=null;(this.scope===i.DEPTH||r.depthBuffer!==!1)&&(o=new ls,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=Ht(0),this._cameraFar=Ht(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=_n.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return je("PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead."),this.setResolutionScale(e)}getResolution(){return je("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 eC(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 eC(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=ZC(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=Im(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=Zi),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),$E.set(s.width,s.height)):(r=this.camera,t.getDrawingBufferSize($E)),this.setSize($E.width,$E.height);let o=t.getRenderTarget(),a=t.getMRT(),l=t.autoClear,c=t.transparent,u=t.opaque,f=r.layers.mask,p=t.contextNode,x=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:rd({...t.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),t.contextNode=this._contextNodeCache.context);let v=n.name;n.name=this.name?this.name:n.name,t.render(n,r),n.name=v,n.overrideMaterial=x,t.setRenderTarget(o),t.setMRT(a),t.autoClear=l,t.transparent=c,t.opaque=u,t.contextNode=p,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 gn),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 gn),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,n,r))}dispose(){this.renderTarget.dispose()}};Bh.COLOR="color";Bh.DEPTH="depth";var vbe=(i,e,t)=>new Bh(Bh.COLOR,i,e,t),bbe=(i,e)=>new JM(i,e),wbe=(i,e,t)=>new Bh(Bh.DEPTH,i,e,t),GO=class extends Bh{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Bh.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 p=this._getOutlineMaterial(l);t.renderObject(r,s,o,a,p,c,u,f)}t.renderObject(r,s,o,a,l,c,u,f)}),super.updateBefore(e),t.setRenderObjectFunction(n)}_createMaterial(){let e=new Ar;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=hi;let t=ta.negate(),n=Ma.mul(Lh),r=se(1),s=n.mul(Lt(fr,1)),o=n.mul(Lt(fr.add(t),1)),a=Jo(s.sub(o));return e.vertexNode=s.add(a.mul(this.thicknessNode).mul(s.w).mul(r)),e.colorNode=Lt(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}},Sbe=(i,e,t=new Ut(0,0,0),n=.003,r=1)=>new GO(i,e,Vt(t),Vt(n),Vt(r)),mee=Ae(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),gee=Ae(([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"}]}),_ee=Ae(([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"}]}),Tbe=Ae(([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)}),xee=Ae(([i,e])=>{let t=so(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=so(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=Tbe(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Ebe=so(pe(1.6605,-.1246,-.0182),pe(-.5876,1.1329,-.1006),pe(-.0728,-.0083,1.1187)),Mbe=so(pe(.6274,.0691,.0164),pe(.3293,.9195,.088),pe(.0433,.0113,.8956)),Cbe=Ae(([i])=>{let e=pe(i).toVar(),t=pe(e.mul(e)).toVar(),n=pe(t.mul(t)).toVar();return se(15.5).mul(n.mul(t)).sub(bn(40.14,n.mul(e))).add(bn(31.96,n).sub(bn(6.868,t.mul(e))).add(bn(.4298,t).add(bn(.1191,e).sub(.00232))))}),yee=Ae(([i,e])=>{let t=pe(i).toVar(),n=so(pe(.856627153315983,.137318972929847,.11189821299995),pe(.0951212405381588,.761241990602591,.0767994186031903),pe(.0482516061458583,.101439036467562,.811302368396859)),r=so(pe(1.1271005818144368,-.1413297634984383,-.14132976349843826),pe(-.11060664309660323,1.157823702216272,-.11060664309660294),pe(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=se(-12.47393),o=se(4.026069);return t.mulAssign(e),t.assign(Mbe.mul(t)),t.assign(n.mul(t)),t.assign(Tr(t,1e-10)),t.assign(Mh(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(au(t,0,1)),t.assign(Cbe(t)),t.assign(r.mul(t)),t.assign(Ac(Tr(pe(0),t),pe(2.2))),t.assign(Ebe.mul(t)),t.assign(au(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),vee=Ae(([i,e])=>{let t=se(.76),n=se(.15);i=i.mul(e);let r=el(i.r,el(i.g,i.b)),s=Qo(r.lessThan(.08),r.sub(bn(6.25,r.mul(r))),.04);i.subAssign(s);let o=Tr(i.r,Tr(i.g,i.b));Wt(o.lessThan(t),()=>i);let a=ni(1,t),l=ni(1,a.mul(a).div(o.add(a.sub(t))));i.mulAssign(l.div(o));let c=ni(1,Fl(1,n.mul(o.sub(l)).add(1)));return Xn(i,pe(l),c)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Qi=class extends $t{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}},tR=Hn(Qi).setParameterLength(1,3),Rbe=(i,e)=>tR(i,e,"js"),Pbe=(i,e)=>tR(i,e,"wgsl"),Ibe=(i,e)=>tR(i,e,"glsl"),tC=class extends Qi{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+`4158+`,t==="property"?a:e.format(`${a}()`,s,t)}},bee=(i,e=[],t="")=>{let n=new tC(i,e,t);return M7((...s)=>n.call(...s),n)},Nbe=(i,e)=>bee(i,e,"glsl"),Lbe=(i,e)=>bee(i,e,"wgsl");function zU(i){let e,t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||ts.z).negate()}var wee=Ae(([i,e],t)=>{let n=zU(t);return Ol(i,e,n)}),See=Ae(([i],e)=>{let t=zU(e);return i.mul(i,t,t).negate().exp().oneMinus()}),Dbe=Ae(([i,e],t)=>{let n=zU(t),s=e.sub(Ph.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),zO=Ae(([i,e])=>Lt(e.toFloat().mix(E1.rgb,i.toVec3()),E1.a)),mm=null,gm=null,VO=class extends $t{static get type(){return"RangeNode"}constructor(e=se(),t=se()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){let t=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),r=e.getTypeLength(s0(t.value)),s=e.getTypeLength(s0(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 LM('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(s0(o)),c=e.getTypeLength(s0(a));mm=mm||new gn,gm=gm||new gn,mm.setScalar(0),gm.setScalar(0),l===1?mm.setScalar(o):o.isColor?mm.set(o.r,o.g,o.b,1):mm.set(o.x,o.y,o.z||0,o.w||0),c===1?gm.setScalar(a):a.isColor?gm.set(a.r,a.g,a.b,1):gm.set(a.x,a.y,a.z||0,a.w||0);let u=4,f=u*t.count,p=new Float32Array(f);for(let w=0;w<f;w++){let S=w%u,T=mm.getComponent(S),P=gm.getComponent(S);p[w]=$c.lerp(T,P,Math.random())}let x=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=V1(p,"vec4",t.count).element(su).convert(x);else{let w=new _l(p,4);e.geometry.setAttribute("__range"+this.id,w),n=WC(w).convert(x)}}else n=se(0);return n}},Fbe=Hn(VO).setParameterLength(2),qO=class extends $t{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):(je(`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}},Mb=(i,e)=>new qO(i,e),Obe=Mb("numWorkgroups","uvec3"),Bbe=Mb("workgroupId","uvec3"),Ube=Mb("globalId","uvec3"),kbe=Mb("localId","uvec3"),Gbe=Mb("subgroupSize","uint"),HO=class extends $t{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 4159+`):e.addLineFlowCode(`${t}Barrier()`,this)}},VU=Hn(HO),zbe=()=>VU("workgroup").toStack(),Vbe=()=>VU("storage").toStack(),qbe=()=>VU("texture").toStack(),WO=class extends ed{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}},jO=class extends $t{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 je('TSL: "label()" has been deprecated. Use "setName()" instead.',new Ur),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new WO(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)}},Hbe=(i,e)=>new jO("Workgroup",i,e),ps=class extends $t{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=Nl(u,s).toConst()),t.constNode.build(e)}};ps.ATOMIC_LOAD="atomicLoad";ps.ATOMIC_STORE="atomicStore";ps.ATOMIC_ADD="atomicAdd";ps.ATOMIC_SUB="atomicSub";ps.ATOMIC_MAX="atomicMax";ps.ATOMIC_MIN="atomicMin";ps.ATOMIC_AND="atomicAnd";ps.ATOMIC_OR="atomicOr";ps.ATOMIC_XOR="atomicXor";var Wbe=Hn(ps),kh=(i,e,t)=>Wbe(i,e,t).toStack(),jbe=i=>kh(ps.ATOMIC_LOAD,i,null),Xbe=(i,e)=>kh(ps.ATOMIC_STORE,i,e),$be=(i,e)=>kh(ps.ATOMIC_ADD,i,e),Ybe=(i,e)=>kh(ps.ATOMIC_SUB,i,e),Zbe=(i,e)=>kh(ps.ATOMIC_MAX,i,e),Kbe=(i,e)=>kh(ps.ATOMIC_MIN,i,e),Qbe=(i,e)=>kh(ps.ATOMIC_AND,i,e),Jbe=(i,e)=>kh(ps.ATOMIC_OR,i,e),ewe=(i,e)=>kh(ps.ATOMIC_XOR,i,e),Ft=class i extends pr{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}};Ft.SUBGROUP_ELECT="subgroupElect";Ft.SUBGROUP_BALLOT="subgroupBallot";Ft.SUBGROUP_ADD="subgroupAdd";Ft.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd";Ft.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd";Ft.SUBGROUP_MUL="subgroupMul";Ft.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul";Ft.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul";Ft.SUBGROUP_AND="subgroupAnd";Ft.SUBGROUP_OR="subgroupOr";Ft.SUBGROUP_XOR="subgroupXor";Ft.SUBGROUP_MIN="subgroupMin";Ft.SUBGROUP_MAX="subgroupMax";Ft.SUBGROUP_ALL="subgroupAll";Ft.SUBGROUP_ANY="subgroupAny";Ft.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst";Ft.QUAD_SWAP_X="quadSwapX";Ft.QUAD_SWAP_Y="quadSwapY";Ft.QUAD_SWAP_DIAGONAL="quadSwapDiagonal";Ft.SUBGROUP_BROADCAST="subgroupBroadcast";Ft.SUBGROUP_SHUFFLE="subgroupShuffle";Ft.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor";Ft.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp";Ft.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown";Ft.QUAD_BROADCAST="quadBroadcast";var twe=lt(Ft,Ft.SUBGROUP_ELECT).setParameterLength(0),nwe=lt(Ft,Ft.SUBGROUP_BALLOT).setParameterLength(1),iwe=lt(Ft,Ft.SUBGROUP_ADD).setParameterLength(1),rwe=lt(Ft,Ft.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),swe=lt(Ft,Ft.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),owe=lt(Ft,Ft.SUBGROUP_MUL).setParameterLength(1),awe=lt(Ft,Ft.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),lwe=lt(Ft,Ft.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),cwe=lt(Ft,Ft.SUBGROUP_AND).setParameterLength(1),uwe=lt(Ft,Ft.SUBGROUP_OR).setParameterLength(1),hwe=lt(Ft,Ft.SUBGROUP_XOR).setParameterLength(1),fwe=lt(Ft,Ft.SUBGROUP_MIN).setParameterLength(1),dwe=lt(Ft,Ft.SUBGROUP_MAX).setParameterLength(1),pwe=lt(Ft,Ft.SUBGROUP_ALL).setParameterLength(0),Awe=lt(Ft,Ft.SUBGROUP_ANY).setParameterLength(0),mwe=lt(Ft,Ft.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),gwe=lt(Ft,Ft.QUAD_SWAP_X).setParameterLength(1),_we=lt(Ft,Ft.QUAD_SWAP_Y).setParameterLength(1),xwe=lt(Ft,Ft.QUAD_SWAP_DIAGONAL).setParameterLength(1),ywe=lt(Ft,Ft.SUBGROUP_BROADCAST).setParameterLength(2),vwe=lt(Ft,Ft.SUBGROUP_SHUFFLE).setParameterLength(2),bwe=lt(Ft,Ft.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),wwe=lt(Ft,Ft.SUBGROUP_SHUFFLE_UP).setParameterLength(2),Swe=lt(Ft,Ft.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),Twe=lt(Ft,Ft.QUAD_BROADCAST).setParameterLength(1),YE;function nR(i){YE=YE||new WeakMap;let e=YE.get(i);return e===void 0&&YE.set(i,e={}),e}function iR(i){let e=nR(i);return e.shadowMatrix||(e.shadowMatrix=Ht("mat4").setGroup(Zt).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 Tee(i,e=Ph){let t=iR(i).mul(e);return t.xyz.div(t.w)}function qU(i){let e=nR(i);return e.position||(e.position=Ht(new ie).setGroup(Zt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function Eee(i){let e=nR(i);return e.targetPosition||(e.targetPosition=Ht(new ie).setGroup(Zt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function HU(i){let e=nR(i);return e.viewPosition||(e.viewPosition=Ht(new ie).setGroup(Zt).onRenderUpdate(({camera:t},n)=>{n.value=n.value||new ie,n.value.setFromMatrixPosition(i.matrixWorld),n.value.applyMatrix4(t.matrixWorldInverse)}))}var WU=i=>m0.transformDirection(qU(i).sub(Eee(i))),Ewe=id("vec3","totalDiffuse"),Mwe=id("vec3","totalSpecular"),Cwe=id("vec3","outgoingLight"),Rwe=i=>i.sort((e,t)=>e.id-t.id),Pwe=(i,e)=>{for(let t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},y8=new WeakMap,Fv=[],Ab=class extends $t{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=Ewe,this.totalSpecularNode=Mwe,this.outgoingLightNode=Cwe,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let n=0;n<e.length;n++){let r=e[n];if(Fv.push(r.id),Fv.push(r.castShadow?1:0),r.isSpotLight===!0){let s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;Fv.push(s,o)}}let t=wb(Fv);return Fv.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=Rwe([...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=Pwe(l.id,r)),c===null){let u=a.getLightNodeClass(l.constructor);if(u===null){je(`LightsNode.setupNodeLights: Light node not found for ${l.constructor.name}`);continue}y8.has(l)===!1&&y8.set(l,new u(l)),c=y8.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:p,directSpecular:x,indirectDiffuse:v,indirectSpecular:w}=r.reflectedLight,S=p.add(v);u!==null&&(f!==null?S=pe(f.mix(S,u)):S=pe(u)),a.assign(S),l.assign(x.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}},Iwe=(i=[])=>new Ab().setLights(i),XO=class extends $t{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=_n.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){jU.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||Ph)}},jU=id("vec3","shadowPositionWorld");function Nwe(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 Ut),e.clearAlpha=i.getClearAlpha(),e.autoClear=i.autoClear,e.scissorTest=i.getScissorTest(),e}function Lwe(i,e){return e=Nwe(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function Dwe(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 Fwe(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function Owe(i,e){return e=Fwe(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function Bwe(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function Uwe(i,e,t){return t=Lwe(i,t),t=Owe(e,t),t}function kwe(i,e,t){Dwe(i,t),Bwe(e,t)}var nC=new WeakMap,Mee=Ae(({depthTexture:i,shadowCoord:e,depthLayer:t})=>{let n=li(i,e.xy).setName("t_basic");return i.isArrayTexture&&(n=n.depth(t)),n.compare(e.z)}),Cee=Ae(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=(u,f)=>{let p=li(i,u);return i.isArrayTexture&&(p=p.depth(n)),p.compare(f)},s=nr("mapSize","vec2",t).setGroup(Zt),o=nr("radius","float",t).setGroup(Zt),a=ft(1).div(s),l=o.mul(a.x),c=UU(jm.xy).mul(6.28318530718);return fs(r(e.xy.add(iu(0,5,c).mul(l)),e.z),r(e.xy.add(iu(1,5,c).mul(l)),e.z),r(e.xy.add(iu(2,5,c).mul(l)),e.z),r(e.xy.add(iu(3,5,c).mul(l)),e.z),r(e.xy.add(iu(4,5,c).mul(l)),e.z)).mul(1/5)}),Ree=Ae(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=nr("mapSize","vec2",t).setGroup(Zt),s=ft(1).div(r),o=e.xy,a=ou(o.mul(r).add(.5)).toConst();o.subAssign(a.sub(.5).mul(s));let l=x=>{let v=li(i,o).offset(x).gather();return i.isArrayTexture&&(v=v.depth(n)),v.compare(e.z)},c=l(Sr(-1,1)).toConst(),u=l(Sr(1,1)).toConst(),f=l(Sr(-1,-1)).toConst(),p=l(Sr(1,-1)).toConst();return fs(Xn(c.x,u.y,a.x).add(c.y).add(u.x).mul(a.y),Xn(c.w,u.z,a.x).add(c.z).add(u.w),Xn(f.x,p.y,a.x).add(f.y).add(p.x),Xn(f.w,p.z,a.x).add(f.z).add(p.w).mul(a.y.oneMinus())).mul(1/9)}),Pee=Ae(({depthTexture:i,shadowCoord:e,depthLayer:t},n)=>{let r=li(i).sample(e.xy);i.isArrayTexture&&(r=r.depth(t)),r=r.rg;let s=r.x,o=Tr(1e-7,r.y.mul(r.y)),a=n.renderer.reversedDepthBuffer?Fm(s,e.z):Fm(e.z,s),l=se(1).toVar();return Wt(a.notEqual(1),()=>{let c=e.z.sub(s),u=o.div(o.add(c.mul(c)));u=au(ni(u,.3).div(.65)),l.assign(Tr(a,u))}),l}),Iee=i=>{let e=nC.get(i);return e===void 0&&(e=new Ar,e.colorNode=Lt(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=Yr,e.fog=!1,nC.set(i,e)),e},Nee=i=>{let e=nC.get(i);e!==void 0&&(e.dispose(),nC.delete(i))},aZ=new Fh,u1=[],Lee=(i,e,t,n)=>{u1[0]=i,u1[1]=e;let r=aZ.get(u1);return(r===void 0||r.shadowType!==t||r.useVelocity!==n)&&(r=(s,o,a,l,c,u,f,p,x)=>{(s.castShadow===!0||s.receiveShadow&&t===nc)&&(n&&(zZ(s).useVelocity=!0),s.onBeforeShadow(i,s,a,e.camera,l,o.overrideMaterial,u),i.renderObject(s,o,a,l,c,u,f,p,x),s.onAfterShadow(i,s,a,e.camera,l,o.overrideMaterial,u))},r.shadowType=t,r.useVelocity=n,aZ.set(u1,r)),u1[0]=null,u1[1]=null,r},Gwe=Ae(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=se(0).toVar("meanVertical"),o=se(0).toVar("squareMeanVertical"),a=i.lessThanEqual(se(1)).select(se(0),se(2).div(i.sub(1))),l=i.lessThanEqual(se(1)).select(se(0),se(-1));Ri({start:fe(0),end:fe(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(se(u).mul(a)),p=n.sample(fs(jm.xy,ft(0,f).mul(e)).div(t));n.value.isArrayTexture&&(p=p.depth(r)),p=p.x,s.addAssign(p),o.addAssign(p.mul(p))}),s.divAssign(i),o.divAssign(i);let c=Ca(o.sub(s.mul(s)).max(0));return ft(s,c)}),zwe=Ae(({samples:i,radius:e,size:t,shadowPass:n,depthLayer:r})=>{let s=se(0).toVar("meanHorizontal"),o=se(0).toVar("squareMeanHorizontal"),a=i.lessThanEqual(se(1)).select(se(0),se(2).div(i.sub(1))),l=i.lessThanEqual(se(1)).select(se(0),se(-1));Ri({start:fe(0),end:fe(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(se(u).mul(a)),p=n.sample(fs(jm.xy,ft(f,0).mul(e)).div(t));n.value.isArrayTexture&&(p=p.depth(r)),s.addAssign(p.x),o.addAssign(fs(p.y.mul(p.y),p.x.mul(p.x)))}),s.divAssign(i),o.divAssign(i);let c=Ca(o.sub(s.mul(s)).max(0));return ft(s,c)}),Vwe=[Mee,Cee,Ree,Pee],v8,ZE=new pb,iC=class extends XO{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,se(1))}setupShadowCoord(e,t){let{shadow:n}=this,{renderer:r}=e,s=n.biasNode||nr("bias","float",n).setGroup(Zt),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=nr("near","float",n.camera).setGroup(Zt),u=nr("far","float",n.camera).setGroup(Zt);a=KC(l.negate(),c,u)}return o=pe(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return Vwe[e]}setupRenderTarget(e,t){let n=new ls(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Xc:sh;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(Gf.TEXTURE_COMPARE);if((l===op||l===ZT)&&c?(o.minFilter=bi,o.magFilter=bi):(o.minFilter=yi,o.magFilter=yi),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===nc&&s.isPointLightShadow!==!0){o.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ms,type:Di,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:Ms,type:Di,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:Ms,type:Di,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ms,type:Di,depthBuffer:!1}));let D=li(o);o.isArrayTexture&&(D=D.depth(this.depthLayer));let F=li(this.vsmShadowMapVertical.texture);o.isArrayTexture&&(F=F.depth(this.depthLayer));let N=nr("blurSamples","float",s).setGroup(Zt),B=nr("radius","float",s).setGroup(Zt),z=nr("mapSize","vec2",s).setGroup(Zt),V=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Ar);V.fragmentNode=Gwe({samples:N,radius:B,size:z,shadowPass:D,depthLayer:this.depthLayer}).context(e.getSharedContext()),V.name="VSMVertical",V=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Ar),V.fragmentNode=zwe({samples:N,radius:B,size:z,shadowPass:F,depthLayer:this.depthLayer}).context(e.getSharedContext()),V.name="VSMHorizontal"}let u=nr("intensity","float",s).setGroup(Zt),f=nr("normalBias","float",s).setGroup(Zt),p=iR(r),x=g0.mul(f),v;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?v=p.mul(jU.add(x)):v=Ht("mat4").onObjectUpdate(({object:F},N)=>N.value.multiplyMatrices(p.value,F.matrixWorld)).mul(fr).add(p.mul(Lt(x,0)));let w=this.setupShadowCoord(e,v),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===nc&&s.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:o,P=this.setupShadowFilter(e,{filterFn:S,shadowTexture:a.texture,depthTexture:T,shadowCoord:w,shadow:s,depthLayer:this.depthLayer}),R;t.shadowMap.transmitted===!0&&(a.texture.isCubeTexture?R=Ea(a.texture,w.xyz):(R=li(a.texture,w),o.isArrayTexture&&(R=R.depth(this.depthLayer))));let C;R?C=Xn(1,P.rgb.mix(R,1),u.mul(R.a)).toVar():C=Xn(1,P,u).toVar(),this.shadowMap=a,this.shadow.map=a;let L=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return R&&C.toInspector(`${L} / Color`,()=>this.shadowMap.texture.isCubeTexture?Ea(this.shadowMap.texture,kF()):li(this.shadowMap.texture)),C.toInspector(`${L} / Depth`,()=>{let D=nr("near","float",this.shadow.camera),F=nr("far","float",this.shadow.camera),N;this.shadowMap.texture.isCubeTexture?N=Ea(this.shadowMap.depthTexture,kF()).r:N=li(this.shadowMap.depthTexture).r;let B;return this.shadow.camera.isPerspectiveCamera?B=ZC(N,D,F):B=OJ(N,D,F),B=Im(B,D,F),B.oneMinus()})}setup(e){if(e.renderer.shadowMap.enabled!==!1)return Ae(()=>{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(),p=s.getMRT(),x=p?p.has("velocity"):!1;v8=Uwe(s,o,v8),o.overrideMaterial=Iee(n),s.setRenderObjectFunction(Lee(s,r,l,x)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(f),l===nc&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=u,kwe(s,o,v8)}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),ZE.material=this.vsmMaterialVertical,ZE.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),ZE.material=this.vsmMaterialHorizontal,ZE.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,Nee(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))}},Dee=(i,e)=>new iC(i,e),qwe=new Ut,lZ=new on,Ov=new ie,b8=new ie,Hwe=[new ie(1,0,0),new ie(-1,0,0),new ie(0,-1,0),new ie(0,1,0),new ie(0,0,1),new ie(0,0,-1)],Wwe=[new ie(0,-1,0),new ie(0,-1,0),new ie(0,0,-1),new ie(0,0,1),new ie(0,-1,0),new ie(0,-1,0)],jwe=[new ie(1,0,0),new ie(-1,0,0),new ie(0,1,0),new ie(0,-1,0),new ie(0,0,1),new ie(0,0,-1)],Xwe=[new ie(0,-1,0),new ie(0,-1,0),new ie(0,0,1),new ie(0,0,-1),new ie(0,-1,0),new ie(0,-1,0)],Fee=Ae(({depthTexture:i,bd3D:e,dp:t})=>Ea(i,e).compare(t)),Oee=Ae(({depthTexture:i,bd3D:e,dp:t,shadow:n})=>{let r=nr("radius","float",n).setGroup(Zt),s=nr("mapSize","vec2",n).setGroup(Zt),o=r.div(s.x),a=Ji(e),l=Jo(td(e,a.x.greaterThan(a.z).select(pe(0,1,0),pe(1,0,0)))),c=td(e,l),u=UU(jm.xy).mul(6.28318530718),f=iu(0,5,u),p=iu(1,5,u),x=iu(2,5,u),v=iu(3,5,u),w=iu(4,5,u);return Ea(i,e.add(l.mul(f.x).add(c.mul(f.y)).mul(o))).compare(t).add(Ea(i,e.add(l.mul(p.x).add(c.mul(p.y)).mul(o))).compare(t)).add(Ea(i,e.add(l.mul(x.x).add(c.mul(x.y)).mul(o))).compare(t)).add(Ea(i,e.add(l.mul(v.x).add(c.mul(v.y)).mul(o))).compare(t)).add(Ea(i,e.add(l.mul(w.x).add(c.mul(w.y)).mul(o))).compare(t)).mul(1/5)}),$we=Ae(({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=Ht("float").setGroup(Zt).onRenderUpdate(()=>n.camera.near),c=Ht("float").setGroup(Zt).onRenderUpdate(()=>n.camera.far),u=nr("bias","float",n).setGroup(Zt),f=se(1).toVar();return Wt(a.sub(c).lessThanEqual(0).and(a.sub(l).greaterThanEqual(0)),()=>{let p;r.renderer.reversedDepthBuffer?(p=BJ(a.negate(),l,c),p.subAssign(u)):r.renderer.logarithmicDepthBuffer?(p=KC(a.negate(),l,c),p.addAssign(u)):(p=IU(a.negate(),l,c),p.addAssign(u));let x=s.normalize();f.assign(i({depthTexture:e,bd3D:x,dp:p,shadow:n}))}),f}),$O=class extends iC{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===cL?Fee:Oee}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return $we({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){let n=new y_(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Xc:sh;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===Ha,u=c?Hwe:jwe,f=c?Wwe:Xwe;n.setSize(t.mapSize.width,t.mapSize.width);let p=s.autoClear,x=s.getClearColor(qwe),v=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()),Ov.setFromMatrixPosition(r.matrixWorld),a.position.copy(Ov),b8.copy(a.position),b8.add(u[w]),a.up.copy(f[w]),a.lookAt(b8),a.updateMatrixWorld(),l.makeTranslation(-Ov.x,-Ov.y,-Ov.z),lZ.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(lZ,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=p,s.setClearColor(x,v)}},Bee=(i,e)=>new $O(i,e),nd=class extends f0{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new Ut,this.colorNode=e&&e.colorNode||Ht(this.color).setGroup(Zt),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=_n.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 HU(this.light).sub(e.context.positionView||ts)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return Dee(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=Vt(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)}},XU=Ae(({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)}),Uee=({color:i,lightVector:e,cutoffDistance:t,decayExponent:n})=>{let r=e.normalize(),s=e.length(),o=XU({lightDistance:s,cutoffDistance:t,decayExponent:n}),a=i.mul(o);return{lightDirection:r,lightColor:a}},YO=class extends nd{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=Ht(0).setGroup(Zt),this.decayExponentNode=Ht(2).setGroup(Zt)}update(e){let{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return Bee(this.light)}setupDirect(e){return Uee({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},Ywe=Ae(([i=Pi()])=>{let e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),Zwe=Ae(([i=Pi()],{renderer:e,material:t})=>{let n=K7(i.mul(2).sub(1)),r;if(t.alphaToCoverage&&e.currentSamples>0){let s=se(n.fwidth()).toVar();r=Ol(s.oneMinus(),s.add(1),n).oneMinus()}else r=Qo(n.greaterThan(1),0,1);return r}),eb=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=Dl(i).toVar();return Qo(s,r,n).uniformFlow()}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),rC=Ae(([i,e])=>{let t=Dl(e).toVar(),n=se(i).toVar();return Qo(t,n.negate(),n).uniformFlow()}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),hs=Ae(([i])=>{let e=se(i).toVar();return fe(Ch(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),dr=Ae(([i,e])=>{let t=se(i).toVar();return e.assign(hs(t)),t.sub(se(e))}),Kwe=Ae(([i,e,t,n,r,s])=>{let o=se(s).toVar(),a=se(r).toVar(),l=se(n).toVar(),c=se(t).toVar(),u=se(e).toVar(),f=se(i).toVar(),p=se(ni(1,a)).toVar();return ni(1,o).mul(f.mul(p).add(u.mul(a))).add(o.mul(c.mul(p).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"}]}),Qwe=Ae(([i,e,t,n,r,s])=>{let o=se(s).toVar(),a=se(r).toVar(),l=pe(n).toVar(),c=pe(t).toVar(),u=pe(e).toVar(),f=pe(i).toVar(),p=se(ni(1,a)).toVar();return ni(1,o).mul(f.mul(p).add(u.mul(a))).add(o.mul(c.mul(p).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"}]}),kee=Co([Kwe,Qwe]),Jwe=Ae(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=se(u).toVar(),p=se(c).toVar(),x=se(l).toVar(),v=se(a).toVar(),w=se(o).toVar(),S=se(s).toVar(),T=se(r).toVar(),P=se(n).toVar(),R=se(t).toVar(),C=se(e).toVar(),L=se(i).toVar(),D=se(ni(1,x)).toVar(),F=se(ni(1,p)).toVar();return se(ni(1,f)).toVar().mul(F.mul(L.mul(D).add(C.mul(x))).add(p.mul(R.mul(D).add(P.mul(x))))).add(f.mul(F.mul(T.mul(D).add(S.mul(x))).add(p.mul(w.mul(D).add(v.mul(x))))))}).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"}]}),eSe=Ae(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=se(u).toVar(),p=se(c).toVar(),x=se(l).toVar(),v=pe(a).toVar(),w=pe(o).toVar(),S=pe(s).toVar(),T=pe(r).toVar(),P=pe(n).toVar(),R=pe(t).toVar(),C=pe(e).toVar(),L=pe(i).toVar(),D=se(ni(1,x)).toVar(),F=se(ni(1,p)).toVar();return se(ni(1,f)).toVar().mul(F.mul(L.mul(D).add(C.mul(x))).add(p.mul(R.mul(D).add(P.mul(x))))).add(f.mul(F.mul(T.mul(D).add(S.mul(x))).add(p.mul(w.mul(D).add(v.mul(x))))))}).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"}]}),Gee=Co([Jwe,eSe]),tSe=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=it(i).toVar(),o=it(s.bitAnd(it(7))).toVar(),a=se(eb(o.lessThan(it(4)),r,n)).toVar(),l=se(bn(2,eb(o.lessThan(it(4)),n,r))).toVar();return rC(a,Dl(o.bitAnd(it(1)))).add(rC(l,Dl(o.bitAnd(it(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),nSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=se(e).toVar(),a=it(i).toVar(),l=it(a.bitAnd(it(15))).toVar(),c=se(eb(l.lessThan(it(8)),o,s)).toVar(),u=se(eb(l.lessThan(it(4)),s,eb(l.equal(it(12)).or(l.equal(it(14))),o,r))).toVar();return rC(c,Dl(l.bitAnd(it(1)))).add(rC(u,Dl(l.bitAnd(it(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"}]}),ro=Co([tSe,nSe]),iSe=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=Hm(i).toVar();return pe(ro(s.x,r,n),ro(s.y,r,n),ro(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"}]}),rSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=se(e).toVar(),a=Hm(i).toVar();return pe(ro(a.x,o,s,r),ro(a.y,o,s,r),ro(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"}]}),dc=Co([iSe,rSe]),sSe=Ae(([i])=>{let e=se(i).toVar();return bn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),oSe=Ae(([i])=>{let e=se(i).toVar();return bn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),aSe=Ae(([i])=>{let e=pe(i).toVar();return bn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),zee=Co([sSe,aSe]),lSe=Ae(([i])=>{let e=pe(i).toVar();return bn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Vee=Co([oSe,lSe]),Il=Ae(([i,e])=>{let t=fe(e).toVar(),n=it(i).toVar();return n.shiftLeft(t).bitOr(n.shiftRight(fe(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),qee=Ae(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(Il(t,fe(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Il(i,fe(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Il(e,fe(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(Il(t,fe(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Il(i,fe(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Il(e,fe(4))),e.addAssign(i)}),Cb=Ae(([i,e,t])=>{let n=it(t).toVar(),r=it(e).toVar(),s=it(i).toVar();return n.bitXorAssign(r),n.subAssign(Il(r,fe(14))),s.bitXorAssign(n),s.subAssign(Il(n,fe(11))),r.bitXorAssign(s),r.subAssign(Il(s,fe(25))),n.bitXorAssign(r),n.subAssign(Il(r,fe(16))),s.bitXorAssign(n),s.subAssign(Il(n,fe(4))),r.bitXorAssign(s),r.subAssign(Il(s,fe(14))),n.bitXorAssign(r),n.subAssign(Il(r,fe(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),ea=Ae(([i])=>{let e=it(i).toVar();return se(e).div(se(it(fe(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),Ih=Ae(([i])=>{let e=se(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"}]}),cSe=Ae(([i])=>{let e=fe(i).toVar(),t=it(it(1)).toVar(),n=it(it(fe(3735928559)).add(t.shiftLeft(it(2))).add(it(13))).toVar();return Cb(n.add(it(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),uSe=Ae(([i,e])=>{let t=fe(e).toVar(),n=fe(i).toVar(),r=it(it(2)).toVar(),s=it().toVar(),o=it().toVar(),a=it().toVar();return s.assign(o.assign(a.assign(it(fe(3735928559)).add(r.shiftLeft(it(2))).add(it(13))))),s.addAssign(it(n)),o.addAssign(it(t)),Cb(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),hSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=fe(e).toVar(),s=fe(i).toVar(),o=it(it(3)).toVar(),a=it().toVar(),l=it().toVar(),c=it().toVar();return a.assign(l.assign(c.assign(it(fe(3735928559)).add(o.shiftLeft(it(2))).add(it(13))))),a.addAssign(it(s)),l.addAssign(it(r)),c.addAssign(it(n)),Cb(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),fSe=Ae(([i,e,t,n])=>{let r=fe(n).toVar(),s=fe(t).toVar(),o=fe(e).toVar(),a=fe(i).toVar(),l=it(it(4)).toVar(),c=it().toVar(),u=it().toVar(),f=it().toVar();return c.assign(u.assign(f.assign(it(fe(3735928559)).add(l.shiftLeft(it(2))).add(it(13))))),c.addAssign(it(a)),u.addAssign(it(o)),f.addAssign(it(s)),qee(c,u,f),c.addAssign(it(r)),Cb(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"}]}),dSe=Ae(([i,e,t,n,r])=>{let s=fe(r).toVar(),o=fe(n).toVar(),a=fe(t).toVar(),l=fe(e).toVar(),c=fe(i).toVar(),u=it(it(5)).toVar(),f=it().toVar(),p=it().toVar(),x=it().toVar();return f.assign(p.assign(x.assign(it(fe(3735928559)).add(u.shiftLeft(it(2))).add(it(13))))),f.addAssign(it(c)),p.addAssign(it(l)),x.addAssign(it(a)),qee(f,p,x),f.addAssign(it(o)),p.addAssign(it(s)),Cb(f,p,x)}).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"}]}),Oi=Co([cSe,uSe,hSe,fSe,dSe]),pSe=Ae(([i,e])=>{let t=fe(e).toVar(),n=fe(i).toVar(),r=it(Oi(n,t)).toVar(),s=Hm().toVar();return s.x.assign(r.bitAnd(fe(255))),s.y.assign(r.shiftRight(fe(8)).bitAnd(fe(255))),s.z.assign(r.shiftRight(fe(16)).bitAnd(fe(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),ASe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=fe(e).toVar(),s=fe(i).toVar(),o=it(Oi(s,r,n)).toVar(),a=Hm().toVar();return a.x.assign(o.bitAnd(fe(255))),a.y.assign(o.shiftRight(fe(8)).bitAnd(fe(255))),a.z.assign(o.shiftRight(fe(16)).bitAnd(fe(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),pc=Co([pSe,ASe]),mSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=se(dr(e.x,t)).toVar(),s=se(dr(e.y,n)).toVar(),o=se(Ih(r)).toVar(),a=se(Ih(s)).toVar(),l=se(kee(ro(Oi(t,n),r,s),ro(Oi(t.add(fe(1)),n),r.sub(1),s),ro(Oi(t,n.add(fe(1))),r,s.sub(1)),ro(Oi(t.add(fe(1)),n.add(fe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return zee(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),gSe=Ae(([i])=>{let e=pe(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=fe().toVar(),s=se(dr(e.x,t)).toVar(),o=se(dr(e.y,n)).toVar(),a=se(dr(e.z,r)).toVar(),l=se(Ih(s)).toVar(),c=se(Ih(o)).toVar(),u=se(Ih(a)).toVar(),f=se(Gee(ro(Oi(t,n,r),s,o,a),ro(Oi(t.add(fe(1)),n,r),s.sub(1),o,a),ro(Oi(t,n.add(fe(1)),r),s,o.sub(1),a),ro(Oi(t.add(fe(1)),n.add(fe(1)),r),s.sub(1),o.sub(1),a),ro(Oi(t,n,r.add(fe(1))),s,o,a.sub(1)),ro(Oi(t.add(fe(1)),n,r.add(fe(1))),s.sub(1),o,a.sub(1)),ro(Oi(t,n.add(fe(1)),r.add(fe(1))),s,o.sub(1),a.sub(1)),ro(Oi(t.add(fe(1)),n.add(fe(1)),r.add(fe(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return Vee(f)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),$U=Co([mSe,gSe]),_Se=Ae(([i])=>{let e=ft(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=se(dr(e.x,t)).toVar(),s=se(dr(e.y,n)).toVar(),o=se(Ih(r)).toVar(),a=se(Ih(s)).toVar(),l=pe(kee(dc(pc(t,n),r,s),dc(pc(t.add(fe(1)),n),r.sub(1),s),dc(pc(t,n.add(fe(1))),r,s.sub(1)),dc(pc(t.add(fe(1)),n.add(fe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return zee(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),xSe=Ae(([i])=>{let e=pe(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=fe().toVar(),s=se(dr(e.x,t)).toVar(),o=se(dr(e.y,n)).toVar(),a=se(dr(e.z,r)).toVar(),l=se(Ih(s)).toVar(),c=se(Ih(o)).toVar(),u=se(Ih(a)).toVar(),f=pe(Gee(dc(pc(t,n,r),s,o,a),dc(pc(t.add(fe(1)),n,r),s.sub(1),o,a),dc(pc(t,n.add(fe(1)),r),s,o.sub(1),a),dc(pc(t.add(fe(1)),n.add(fe(1)),r),s.sub(1),o.sub(1),a),dc(pc(t,n,r.add(fe(1))),s,o,a.sub(1)),dc(pc(t.add(fe(1)),n,r.add(fe(1))),s.sub(1),o,a.sub(1)),dc(pc(t,n.add(fe(1)),r.add(fe(1))),s,o.sub(1),a.sub(1)),dc(pc(t.add(fe(1)),n.add(fe(1)),r.add(fe(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return Vee(f)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Rb=Co([_Se,xSe]),ySe=Ae(([i])=>{let e=se(i).toVar(),t=fe(hs(e)).toVar();return ea(Oi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),vSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe(hs(e.x)).toVar(),n=fe(hs(e.y)).toVar();return ea(Oi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),bSe=Ae(([i])=>{let e=pe(i).toVar(),t=fe(hs(e.x)).toVar(),n=fe(hs(e.y)).toVar(),r=fe(hs(e.z)).toVar();return ea(Oi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),wSe=Ae(([i])=>{let e=Lt(i).toVar(),t=fe(hs(e.x)).toVar(),n=fe(hs(e.y)).toVar(),r=fe(hs(e.z)).toVar(),s=fe(hs(e.w)).toVar();return ea(Oi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),SSe=Co([ySe,vSe,bSe,wSe]),TSe=Ae(([i])=>{let e=se(i).toVar(),t=fe(hs(e)).toVar();return pe(ea(Oi(t,fe(0))),ea(Oi(t,fe(1))),ea(Oi(t,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),ESe=Ae(([i])=>{let e=ft(i).toVar(),t=fe(hs(e.x)).toVar(),n=fe(hs(e.y)).toVar();return pe(ea(Oi(t,n,fe(0))),ea(Oi(t,n,fe(1))),ea(Oi(t,n,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),MSe=Ae(([i])=>{let e=pe(i).toVar(),t=fe(hs(e.x)).toVar(),n=fe(hs(e.y)).toVar(),r=fe(hs(e.z)).toVar();return pe(ea(Oi(t,n,r,fe(0))),ea(Oi(t,n,r,fe(1))),ea(Oi(t,n,r,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),CSe=Ae(([i])=>{let e=Lt(i).toVar(),t=fe(hs(e.x)).toVar(),n=fe(hs(e.y)).toVar(),r=fe(hs(e.z)).toVar(),s=fe(hs(e.w)).toVar();return pe(ea(Oi(t,n,r,s,fe(0))),ea(Oi(t,n,r,s,fe(1))),ea(Oi(t,n,r,s,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),rR=Co([TSe,ESe,MSe,CSe]),sC=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar(),l=se(0).toVar(),c=se(1).toVar();return Ri(o,()=>{l.addAssign(c.mul($U(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"}]}),sR=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar(),l=pe(0).toVar(),c=se(1).toVar();return Ri(o,()=>{l.addAssign(c.mul(Rb(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"}]}),RSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar();return ft(sC(a,o,s,r),sC(a.add(pe(fe(19),fe(193),fe(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"}]}),PSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar(),l=pe(sR(a,o,s,r)).toVar(),c=se(sC(a.add(pe(fe(19),fe(193),fe(17))),o,s,r)).toVar();return Lt(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"}]}),ISe=Ae(([i,e,t,n,r,s,o])=>{let a=fe(o).toVar(),l=se(s).toVar(),c=fe(r).toVar(),u=fe(n).toVar(),f=fe(t).toVar(),p=fe(e).toVar(),x=ft(i).toVar(),v=pe(rR(ft(p.add(u),f.add(c)))).toVar(),w=ft(v.x,v.y).toVar();w.subAssign(.5),w.mulAssign(l),w.addAssign(.5);let S=ft(ft(se(p),se(f)).add(w)).toVar(),T=ft(S.sub(x)).toVar();return Wt(a.equal(fe(2)),()=>Ji(T.x).add(Ji(T.y))),Wt(a.equal(fe(3)),()=>Tr(Ji(T.x),Ji(T.y))),xc(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"}]}),NSe=Ae(([i,e,t,n,r,s,o,a,l])=>{let c=fe(l).toVar(),u=se(a).toVar(),f=fe(o).toVar(),p=fe(s).toVar(),x=fe(r).toVar(),v=fe(n).toVar(),w=fe(t).toVar(),S=fe(e).toVar(),T=pe(i).toVar(),P=pe(rR(pe(S.add(x),w.add(p),v.add(f)))).toVar();P.subAssign(.5),P.mulAssign(u),P.addAssign(.5);let R=pe(pe(se(S),se(w),se(v)).add(P)).toVar(),C=pe(R.sub(T)).toVar();return Wt(c.equal(fe(2)),()=>Ji(C.x).add(Ji(C.y)).add(Ji(C.z))),Wt(c.equal(fe(3)),()=>Tr(Ji(C.x),Ji(C.y),Ji(C.z))),xc(C,C)}).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"}]}),W1=Co([ISe,NSe]),LSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=ft(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=ft(dr(s.x,o),dr(s.y,a)).toVar(),c=se(1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(W1(l,u,f,o,a,r,n)).toVar();c.assign(el(c,p))})}),Wt(n.equal(fe(0)),()=>{c.assign(Ca(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),DSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=ft(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=ft(dr(s.x,o),dr(s.y,a)).toVar(),c=ft(1e6,1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(W1(l,u,f,o,a,r,n)).toVar();Wt(p.lessThan(c.x),()=>{c.y.assign(c.x),c.x.assign(p)}).ElseIf(p.lessThan(c.y),()=>{c.y.assign(p)})})}),Wt(n.equal(fe(0)),()=>{c.assign(Ca(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),FSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=ft(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=ft(dr(s.x,o),dr(s.y,a)).toVar(),c=pe(1e6,1e6,1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(W1(l,u,f,o,a,r,n)).toVar();Wt(p.lessThan(c.x),()=>{c.z.assign(c.y),c.y.assign(c.x),c.x.assign(p)}).ElseIf(p.lessThan(c.y),()=>{c.z.assign(c.y),c.y.assign(p)}).ElseIf(p.lessThan(c.z),()=>{c.z.assign(p)})})}),Wt(n.equal(fe(0)),()=>{c.assign(Ca(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),OSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=pe(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=fe().toVar(),c=pe(dr(s.x,o),dr(s.y,a),dr(s.z,l)).toVar(),u=se(1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ri({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(W1(c,f,p,x,o,a,l,r,n)).toVar();u.assign(el(u,v))})})}),Wt(n.equal(fe(0)),()=>{u.assign(Ca(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),BSe=Co([LSe,OSe]),USe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=pe(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=fe().toVar(),c=pe(dr(s.x,o),dr(s.y,a),dr(s.z,l)).toVar(),u=ft(1e6,1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ri({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(W1(c,f,p,x,o,a,l,r,n)).toVar();Wt(v.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(v)}).ElseIf(v.lessThan(u.y),()=>{u.y.assign(v)})})})}),Wt(n.equal(fe(0)),()=>{u.assign(Ca(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),kSe=Co([DSe,USe]),GSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=se(e).toVar(),s=pe(i).toVar(),o=fe().toVar(),a=fe().toVar(),l=fe().toVar(),c=pe(dr(s.x,o),dr(s.y,a),dr(s.z,l)).toVar(),u=pe(1e6,1e6,1e6).toVar();return Ri({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ri({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ri({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(W1(c,f,p,x,o,a,l,r,n)).toVar();Wt(v.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(v)}).ElseIf(v.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(v)}).ElseIf(v.lessThan(u.z),()=>{u.z.assign(v)})})})}),Wt(n.equal(fe(0)),()=>{u.assign(Ca(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),YU=Co([FSe,GSe]),zSe=Ae(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=fe(i).toVar(),p=ft(e).toVar(),x=ft(t).toVar(),v=ft(n).toVar(),w=se(r).toVar(),S=se(s).toVar(),T=se(o).toVar(),P=Dl(a).toVar(),R=fe(l).toVar(),C=se(c).toVar(),L=se(u).toVar(),D=p.mul(x).add(v),F=se(0).toVar();return Wt(f.equal(fe(0)),()=>{F.assign(Rb(D))}),Wt(f.equal(fe(1)),()=>{F.assign(rR(D))}),Wt(f.equal(fe(2)),()=>{F.assign(YU(D,w,fe(0)))}),Wt(f.equal(fe(3)),()=>{F.assign(sR(pe(D,0),R,C,L))}),F.assign(F.mul(T.sub(S)).add(S)),Wt(P,()=>{F.assign(au(F,S,T))}),F}).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"}]}),VSe=Ae(([i,e,t,n,r,s,o,a,l,c,u])=>{let f=fe(i).toVar(),p=pe(e).toVar(),x=pe(t).toVar(),v=pe(n).toVar(),w=se(r).toVar(),S=se(s).toVar(),T=se(o).toVar(),P=Dl(a).toVar(),R=fe(l).toVar(),C=se(c).toVar(),L=se(u).toVar(),D=p.mul(x).add(v),F=se(0).toVar();return Wt(f.equal(fe(0)),()=>{F.assign(Rb(D))}),Wt(f.equal(fe(1)),()=>{F.assign(rR(D))}),Wt(f.equal(fe(2)),()=>{F.assign(YU(D,w,fe(0)))}),Wt(f.equal(fe(3)),()=>{F.assign(sR(D,R,C,L))}),F.assign(F.mul(T.sub(S)).add(S)),Wt(P,()=>{F.assign(au(F,S,T))}),F}).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"}]}),qSe=Ae(([i])=>{let e=i.y,t=i.z,n=pe().toVar();return Wt(e.lessThan(1e-4),()=>{n.assign(pe(t,t,t))}).Else(()=>{let r=i.x;r=r.sub(Ch(r)).mul(6).toVar();let s=fe(X7(r)),o=r.sub(se(s)),a=t.mul(e.oneMinus()),l=t.mul(e.mul(o).oneMinus()),c=t.mul(e.mul(o.oneMinus()).oneMinus());Wt(s.equal(fe(0)),()=>{n.assign(pe(t,c,a))}).ElseIf(s.equal(fe(1)),()=>{n.assign(pe(l,t,a))}).ElseIf(s.equal(fe(2)),()=>{n.assign(pe(a,t,c))}).ElseIf(s.equal(fe(3)),()=>{n.assign(pe(a,l,t))}).ElseIf(s.equal(fe(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"}]}),HSe=Ae(([i])=>{let e=pe(i).toVar(),t=se(e.x).toVar(),n=se(e.y).toVar(),r=se(e.z).toVar(),s=se(el(t,el(n,r))).toVar(),o=se(Tr(t,Tr(n,r))).toVar(),a=se(o.sub(s)).toVar(),l=se().toVar(),c=se().toVar(),u=se().toVar();return u.assign(o),Wt(o.greaterThan(0),()=>{c.assign(a.div(o))}).Else(()=>{c.assign(0)}),Wt(c.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{Wt(t.greaterThanEqual(o),()=>{l.assign(n.sub(r).div(a))}).ElseIf(n.greaterThanEqual(o),()=>{l.assign(fs(2,r.sub(t).div(a)))}).Else(()=>{l.assign(fs(4,t.sub(n).div(a)))}),l.mulAssign(1/6),Wt(l.lessThan(0),()=>{l.addAssign(1)})}),pe(l,c,u)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),WSe=Ae(([i])=>{let e=pe(i).toVar(),t=I7(U7(e,pe(.04045))).toVar(),n=pe(e.div(12.92)).toVar(),r=pe(Ac(Tr(e.add(pe(.055)),pe(0)).div(1.055),pe(2.4))).toVar();return Xn(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Hee=(i,e)=>{i=se(i),e=se(e);let t=ft(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return Ol(i.sub(t),i.add(t),e)},Wee=(i,e,t,n)=>Xn(i,e,t[n].clamp()),jSe=(i,e,t=Pi())=>Wee(i,e,t,"x"),XSe=(i,e,t=Pi())=>Wee(i,e,t,"y"),$Se=(i,e,t,n,r=Pi())=>{let s=r.x.clamp(),o=r.y.clamp(),a=Xn(i,e,s),l=Xn(t,n,s);return Xn(a,l,o)},jee=(i,e,t,n,r)=>Xn(i,e,Hee(t,n[r])),YSe=(i,e,t,n=Pi())=>jee(i,e,t,n,"x"),ZSe=(i,e,t,n=Pi())=>jee(i,e,t,n,"y"),KSe=(i=1,e=0,t=Pi())=>t.mul(i).add(e),QSe=(i,e=1)=>(i=se(i),i.abs().pow(e).mul(i.sign())),JSe=(i,e=1,t=.5)=>se(i).sub(t).mul(e).add(t),eTe=(i=Pi(),e=1,t=0)=>$U(i.convert("vec2|vec3")).mul(e).add(t),tTe=(i=Pi(),e=1,t=0)=>Rb(i.convert("vec2|vec3")).mul(e).add(t),nTe=(i=Pi(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Lt(Rb(i),$U(i.add(ft(19,73)))).mul(e).add(t)),iTe=(i,e=Pi(),t=ft(1,1),n=ft(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>zSe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),rTe=(i,e=Pi(),t=ft(1,1),n=ft(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>VSe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),sTe=(i=Pi(),e=1)=>BSe(i.convert("vec2|vec3"),e,fe(1)),oTe=(i=Pi(),e=1)=>kSe(i.convert("vec2|vec3"),e,fe(1)),aTe=(i=Pi(),e=1)=>YU(i.convert("vec2|vec3"),e,fe(1)),lTe=(i=Pi())=>SSe(i.convert("vec2|vec3")),cTe=(i=Pi(),e=3,t=2,n=.5,r=1)=>sC(i,fe(e),t,n).mul(r),uTe=(i=Pi(),e=3,t=2,n=.5,r=1)=>RSe(i,fe(e),t,n).mul(r),hTe=(i=Pi(),e=3,t=2,n=.5,r=1)=>sR(i,fe(e),t,n).mul(r),fTe=(i=Pi(),e=3,t=2,n=.5,r=1)=>PSe(i,fe(e),t,n).mul(r),dTe=(i,e=se(0))=>fs(i,e),pTe=(i,e=se(0))=>ni(i,e),ATe=(i,e=se(1))=>bn(i,e),mTe=(i,e=se(1))=>Fl(i,e),gTe=(i,e=se(1))=>UC(i,e),_Te=(i,e=se(1))=>Ac(i,e),xTe=(i=se(0),e=se(1))=>V7(i,e),yTe=()=>H1,vTe=()=>cee,bTe=(i,e=se(1))=>ni(e,i),wTe=(i,e,t,n)=>i.greaterThan(e).mix(t,n),STe=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),TTe=(i,e,t,n)=>i.equal(e).mix(t,n),ETe=(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},MTe=(i,e=ft(.5,.5),t=ft(1,1),n=se(0),r=ft(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=ft(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},CTe=(i,e)=>{i=ft(i),e=se(e);let t=e.mul(Math.PI/180);return Eb(i,t)},RTe=(i,e,t)=>{i=pe(i),e=se(e),t=pe(t);let n=e.mul(Math.PI/180),r=t.normalize(),s=n.cos(),o=n.sin(),a=se(1).sub(s);return i.mul(s).add(r.cross(i).mul(o)).add(r.mul(r.dot(i)).mul(a))},PTe=(i,e)=>(i=pe(i),e=se(e),xU(i,e)),ITe=Ae(([i,e,t])=>{let n=Jo(i).toVar(),r=ni(se(.5).mul(e.sub(t)),Ph).div(n).toVar(),s=ni(se(-.5).mul(e.sub(t)),Ph).div(n).toVar(),o=pe().toVar();o.x=n.x.greaterThan(se(0)).select(r.x,s.x),o.y=n.y.greaterThan(se(0)).select(r.y,s.y),o.z=n.z.greaterThan(se(0)).select(r.z,s.z);let a=el(o.x,o.y,o.z).toVar();return Ph.add(n.mul(a)).toVar().sub(t)}),Xee=Ae(([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(bn(t,t).sub(bn(n,n)))),s}),k=Object.freeze({__proto__:null,BRDF_GGX:FU,BRDF_Lambert:km,BasicPointShadowFilter:Fee,BasicShadowFilter:Mee,Break:NJ,Const:iQ,Continue:Oye,DFGLUT:cb,D_GGX:WJ,Discard:_Q,EPSILON:kC,F_Schlick:B1,Fn:Ae,HALF_PI:Pxe,INFINITY:Mxe,If:Wt,Loop:Ri,NodeAccess:Eo,NodeShaderStage:y1,NodeType:oxe,NodeUpdateType:_n,OnBeforeFrameUpdate:Pye,OnBeforeMaterialUpdate:Rye,OnBeforeObjectUpdate:Cye,OnFrameUpdate:SJ,OnMaterialUpdate:Mye,OnObjectUpdate:Tb,PCFShadowFilter:Cee,PCFSoftShadowFilter:Ree,PI:RM,PI2:Cxe,PointShadowFilter:Oee,Return:zxe,Schlick_to_F0:WF,ShaderNode:w1,Stack:DC,Switch:vxe,TBNViewMatrix:Tm,TWO_PI:Rxe,VSMShadowFilter:Pee,V_GGX_SmithCorrelated:HJ,Var:nQ,VarIntent:rQ,abs:Ji,acesFilmicToneMapping:xee,acos:z7,acosh:NK,add:fs,addMethodChaining:Be,addNodeElement:Vxe,agxToneMapping:yee,all:bK,alphaT:SM,ambientOcclusion:X8,and:lK,anisotropy:Jp,anisotropyB:Cm,anisotropyT:Yv,any:wK,append:wxe,array:eK,asin:PK,asinh:IK,assign:tK,atan:V7,atanh:LK,atomicAdd:$be,atomicAnd:Qbe,atomicFunc:kh,atomicLoad:jbe,atomicMax:Zbe,atomicMin:Kbe,atomicOr:Jbe,atomicStore:Xbe,atomicSub:Ybe,atomicXor:ewe,attenuationColor:O7,attenuationDistance:F7,attribute:Ll,attributeArray:Jve,backgroundBlurriness:fee,backgroundIntensity:DO,backgroundRotation:dee,batch:CJ,batchColor:MU,bentNormalView:$Q,billboarding:zve,bitAnd:fK,bitNot:dK,bitOr:pK,bitXor:AK,bitangentGeometry:xye,bitangentLocal:yye,bitangentView:jQ,bitangentWorld:vye,bitcast:aee,blendBurn:cbe,blendColor:dbe,blendDodge:ube,blendOverlay:fbe,blendScreen:hbe,blur:KJ,bool:Dl,buffer:V1,bufferAttribute:iU,builtin:sd,builtinAOContext:eQ,builtinShadowContext:JK,bumpMap:xU,bvec2:$Z,bvec3:I7,bvec4:YZ,bypass:mQ,cache:AQ,call:nK,cameraFar:n0,cameraIndex:A0,cameraNear:t0,cameraNormalMatrix:Zxe,cameraPosition:SQ,cameraProjectionMatrix:Ma,cameraProjectionMatrixInverse:wQ,cameraViewMatrix:m0,cameraViewport:Kxe,cameraWorldMatrix:Sb,cbrt:XK,cdl:_be,ceil:zC,checker:Ywe,cineonToneMapping:_ee,clamp:au,clearcoat:vM,clearcoatNormalView:i0,clearcoatRoughness:T1,clipSpace:MQ,code:tR,color:XZ,colorSpaceToWorking:qC,colorToDirection:Sye,compute:pQ,computeKernel:sU,computeSkinning:Fye,context:rd,convert:KZ,convertColorSpace:Dxe,convertToTexture:Yve,cos:nu,cosh:MK,countLeadingZeros:_ve,countOneBits:xve,countTrailingZeros:gve,cross:td,cubeTexture:Ea,cubeTextureBase:gU,dFdx:W7,dFdy:j7,dashSize:Rm,debug:yQ,decrement:vK,decrementBefore:xK,defaultBuildStages:fM,defaultShaderStages:VZ,defined:I1,degrees:TK,deltaTime:Lve,densityFogFactor:See,depth:NU,depthPass:wbe,determinant:UK,difference:VK,diffuseColor:Ci,diffuseContribution:vm,directPointLight:Uee,directionToColor:wye,directionToFaceDirection:uye,dispersion:B7,disposeShadowMaterial:Nee,distance:zK,div:Fl,dot:xc,drawIndex:dQ,dynamicBufferAttribute:Bxe,element:ZZ,emissive:j8,equal:iK,equirectDirection:kF,equirectUV:LU,exp:k7,exp2:N1,exponentialHeightFogFactor:Dbe,expression:Nl,faceDirection:pU,faceForward:J7,faceforward:Ixe,float:se,floatBitsToInt:pve,floatBitsToUint:lee,floor:Ch,fog:zO,fract:ou,frameGroup:Txe,frameId:cee,frontFacing:CQ,fwidth:$7,gain:vve,gapSize:rb,getConstNodeType:jZ,getCurrentStack:C7,getDirection:YJ,getDistanceAttenuation:XU,getGeometryRoughness:qJ,getNormalFromDepth:Kve,getParallaxCorrectNormal:ITe,getRoughness:DU,getScreenPosition:Zve,getShIrradianceAt:Xee,getShadowMaterial:Iee,getShadowRenderObjectFunction:Lee,getTextureIndex:see,getViewPosition:b1,ggxConvolution:QJ,globalId:Ube,glsl:Ibe,glslFn:Nbe,grayscale:pbe,greaterThan:U7,greaterThanEqual:aK,hash:yve,highpModelNormalViewMatrix:dF,highpModelViewMatrix:fF,hue:gbe,increment:yK,incrementBefore:_K,inspector:vQ,instance:EJ,instanceColor:EU,instanceIndex:su,instancedArray:ebe,instancedBufferAttribute:WC,instancedDynamicBufferAttribute:rU,instancedMesh:MJ,int:fe,intBitsToFloat:Ave,interleavedGradientNoise:UU,inverse:kK,inverseSqrt:G7,inversesqrt:Nxe,invocationLocalIndex:Gxe,invocationSubgroupIndex:kxe,ior:Zv,iridescence:OC,iridescenceIOR:bM,iridescenceThickness:wM,isolate:C1,ivec2:Sr,ivec3:P7,ivec4:N7,js:Rbe,label:tQ,length:Rh,lengthSq:K7,lessThan:sK,lessThanEqual:oK,lightPosition:qU,lightProjectionUV:Tee,lightShadowMatrix:iR,lightTargetDirection:WU,lightTargetPosition:Eee,lightViewPosition:HU,lightingContext:DJ,lights:Iwe,linearDepth:UM,linearToneMapping:mee,localId:kbe,log:GC,log2:Mh,logarithmicDepthToViewZ:zye,luminance:GU,mat2:FC,mat3:so,mat4:a0,matcapUV:JJ,materialAO:bJ,materialAlphaTest:ZQ,materialAnisotropy:hJ,materialAnisotropyVector:v1,materialAttenuationColor:xJ,materialAttenuationDistance:_J,materialClearcoat:sJ,materialClearcoatNormal:aJ,materialClearcoatRoughness:oJ,materialColor:KQ,materialDispersion:vJ,materialEmissive:JQ,materialEnvIntensity:pM,materialEnvRotation:DM,materialIOR:gJ,materialIridescence:fJ,materialIridescenceIOR:dJ,materialIridescenceThickness:pJ,materialLightMap:TU,materialLineDashOffset:SU,materialLineDashSize:bU,materialLineGapSize:wU,materialLineScale:vU,materialLineWidth:FM,materialMetalness:iJ,materialNormal:rJ,materialOpacity:yU,materialPointSize:yJ,materialReference:Kf,materialReflectivity:AM,materialRefractionRatio:IQ,materialRotation:lJ,materialRoughness:nJ,materialSheen:cJ,materialSheenRoughness:uJ,materialShininess:QQ,materialSpecular:eJ,materialSpecularColor:tJ,materialSpecularIntensity:SF,materialSpecularStrength:Kv,materialThickness:mJ,materialTransmission:AJ,max:Tr,maxMipLevel:cU,mediumpModelViewMatrix:EQ,metalness:Jf,min:el,mix:Xn,mixElement:YK,mod:UC,modelDirection:rye,modelNormalMatrix:TQ,modelPosition:sye,modelRadius:lye,modelScale:oye,modelViewMatrix:Lh,modelViewPosition:aye,modelViewProjection:wJ,modelWorldMatrix:mc,modelWorldMatrixInverse:cye,morphReference:LJ,mrt:oee,mul:bn,mx_aastep:Hee,mx_add:dTe,mx_atan2:xTe,mx_cell_noise_float:lTe,mx_contrast:JSe,mx_divide:mTe,mx_fractal_noise_float:cTe,mx_fractal_noise_vec2:uTe,mx_fractal_noise_vec3:hTe,mx_fractal_noise_vec4:fTe,mx_frame:vTe,mx_heighttonormal:PTe,mx_hsvtorgb:qSe,mx_ifequal:TTe,mx_ifgreater:wTe,mx_ifgreatereq:STe,mx_invert:bTe,mx_modulo:gTe,mx_multiply:ATe,mx_noise_float:eTe,mx_noise_vec3:tTe,mx_noise_vec4:nTe,mx_place2d:MTe,mx_power:_Te,mx_ramp4:$Se,mx_ramplr:jSe,mx_ramptb:XSe,mx_rgbtohsv:HSe,mx_rotate2d:CTe,mx_rotate3d:RTe,mx_safepower:QSe,mx_separate:ETe,mx_splitlr:YSe,mx_splittb:ZSe,mx_srgb_texture_to_lin_rec709:WSe,mx_subtract:pTe,mx_timer:yTe,mx_transform_uv:KSe,mx_unifiednoise2d:iTe,mx_unifiednoise3d:rTe,mx_worley_noise_float:sTe,mx_worley_noise_vec2:oTe,mx_worley_noise_vec3:aTe,negate:H7,negateOnBackSide:Xm,neutralToneMapping:vee,nodeArray:Mm,nodeImmutable:xt,nodeObject:Vt,nodeObjectIntent:Wv,nodeObjects:LC,nodeProxy:Hn,nodeProxyConstructor:M7,nodeProxyIntent:lt,normalFlat:RQ,normalGeometry:jC,normalLocal:ta,normalMap:bF,normalView:ai,normalViewGeometry:L1,normalWorld:g0,normalWorldGeometry:PQ,normalize:Jo,not:uK,notEqual:rK,numWorkgroups:Obe,objectDirection:Qxe,objectGroup:JZ,objectPosition:eye,objectRadius:iye,objectScale:tye,objectViewPosition:nye,objectWorldMatrix:Jxe,oneMinus:DK,or:cK,orthographicDepthToViewZ:OJ,oscSawtooth:Bve,oscSine:Dve,oscSquare:Fve,oscTriangle:Ove,output:E1,outputStruct:hve,overloadingFn:Co,overrideNode:iee,overrideNodes:ree,packHalf2x16:Eve,packNormalToRGB:_U,packSnorm2x16:Sve,packUnorm2x16:Tve,parabola:TO,parallaxDirection:XQ,parallaxUV:bye,parameter:lve,pass:vbe,passTexture:bbe,pcurve:bve,perspectiveDepthToViewZ:ZC,pmremTexture:BU,pointShadow:Bee,pointUV:tbe,pointWidth:Sxe,positionGeometry:Zo,positionLocal:fr,positionPrevious:Um,positionView:ts,positionViewDirection:Vi,positionWorld:Ph,positionWorldDirection:dU,posterize:xbe,pow:Ac,pow2:Y7,pow3:qK,pow4:Z7,premultiplyAlpha:aU,property:id,quadBroadcast:Twe,quadSwapDiagonal:xwe,quadSwapX:gwe,quadSwapY:_we,radians:SK,rand:$K,range:Fbe,rangeFogFactor:wee,reciprocal:OK,reference:nr,referenceBuffer:BQ,reflect:GK,reflectVector:DQ,reflectView:NQ,reflector:jve,refract:Q7,refractVector:FQ,refractView:LQ,reinhardToneMapping:gee,remap:oU,remapClamp:gQ,renderGroup:Zt,renderOutput:lU,rendererReference:cQ,replaceDefaultUV:Uve,rotate:Eb,rotateUV:kve,roughness:Th,round:FK,rtt:hee,sRGBTransferEOTF:oQ,sRGBTransferOETF:aQ,sample:Qve,sampler:jxe,samplerComparison:Xxe,saturate:VC,saturation:Abe,screenCoordinate:jm,screenDPR:hU,screenSize:Bm,screenUV:ru,select:Qo,setCurrentStack:ib,setName:eU,shaderStages:dM,shadow:Dee,shadowPositionWorld:jU,shapeCircle:Zwe,sharedUniformGroup:BC,sheen:Pl,sheenRoughness:e0,shiftLeft:mK,shiftRight:gK,shininess:TM,sign:q7,sin:Ta,sinc:wve,sinh:EK,skinning:IJ,smoothstep:Ol,smoothstepElement:ZK,specularColor:u0,specularColorBlended:wm,specularF90:Sm,spherizeUV:Gve,split:bxe,spritesheetUV:qve,sqrt:Ca,stack:gM,step:Fm,stepElement:KK,storage:l0,storageBarrier:Vbe,storageTexture:pee,storageTexture3D:ibe,struct:uve,sub:ni,subBuild:Pm,subgroupAdd:iwe,subgroupAll:pwe,subgroupAnd:cwe,subgroupAny:Awe,subgroupBallot:nwe,subgroupBroadcast:ywe,subgroupBroadcastFirst:mwe,subgroupElect:twe,subgroupExclusiveAdd:swe,subgroupExclusiveMul:lwe,subgroupInclusiveAdd:rwe,subgroupInclusiveMul:awe,subgroupIndex:Uxe,subgroupMax:dwe,subgroupMin:fwe,subgroupMul:owe,subgroupOr:uwe,subgroupShuffle:vwe,subgroupShuffleDown:Swe,subgroupShuffleUp:wwe,subgroupShuffleXor:bwe,subgroupSize:Gbe,subgroupXor:hwe,tan:CK,tangentGeometry:XC,tangentLocal:h0,tangentView:$C,tangentWorld:WQ,tanh:RK,texture:li,texture3D:kU,texture3DLevel:obe,texture3DLoad:sbe,textureBarrier:qbe,textureBicubic:p2e,textureBicubicLevel:OU,textureCubeUV:ZJ,textureLevel:Wxe,textureLoad:es,textureSize:Om,textureStore:nbe,thickness:D7,time:H1,toneMapping:uQ,toneMappingExposure:hQ,toonOutlinePass:Sbe,transformDirection:HK,transformNormal:AU,transformNormalByInverseViewMatrix:jK,transformNormalByViewMatrix:WK,transformNormalToView:mU,transformedClearcoatNormalView:dye,transformedNormalView:hye,transformedNormalWorld:fye,transmission:EM,transpose:BK,triNoise3D:Ive,triplanarTexture:Hve,triplanarTextures:uee,trunc:X7,uint:it,uintBitsToFloat:mve,uniform:Ht,uniformArray:To,uniformCubeTexture:pye,uniformFlow:QK,uniformGroup:QZ,uniformTexture:Hxe,unpackHalf2x16:Rve,unpackNormal:yF,unpackRGBToNormal:YQ,unpackSnorm2x16:Mve,unpackUnorm2x16:Cve,unpremultiplyAlpha:xQ,userData:abe,uv:Pi,uvec2:R7,uvec3:Hm,uvec4:L7,varying:p0,varyingProperty:Wm,vec2:ft,vec3:pe,vec4:Lt,vectorComponents:qm,velocity:lbe,vertexColor:kJ,vertexIndex:fQ,vertexStage:sQ,vibrance:mbe,viewZToLogarithmicDepth:KC,viewZToOrthographicDepth:Im,viewZToPerspectiveDepth:IU,viewZToReversedOrthographicDepth:Gye,viewZToReversedPerspectiveDepth:BJ,viewport:P1,viewportCoordinate:bQ,viewportDepthTexture:PU,viewportLinearDepth:Vye,viewportMipTexture:RU,viewportOpaqueMipTexture:FJ,viewportResolution:Yxe,viewportSafeUV:Vve,viewportSharedTexture:ybe,viewportSize:fU,viewportTexture:Uye,viewportUV:$xe,vogelDiskSample:iu,wgsl:Pbe,wgslFn:Lbe,workgroupArray:Hbe,workgroupBarrier:zbe,workgroupId:Bbe,workingToColorSpace:lQ,xor:hK}),eu=new hb,ZO=class extends Oh{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(eu),eu.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(eu),eu.a=1,o=!0;else if(s.isNode===!0){let l=this.get(e),c=s;eu.copy(r._clearColor);let u=l.backgroundMesh;if(u===void 0){let R=function(){s.removeEventListener("dispose",R),u.material.dispose(),u.geometry.dispose()},p=Lt(c).mul(DO).context({getUV:()=>dee.mul(PQ),getTextureLevel:()=>fee}),x=Ma.element(3).element(3).equal(1),v=Fl(1,Ma.element(1).element(1)).mul(3),w=x.select(fr.mul(v),fr),S=Lh.mul(Lt(w,0)),T=Ma.mul(Lt(S.xyz,1));T=T.setZ(T.w);let P=new Ar;P.name="Background.material",P.side=hi,P.depthTest=!1,P.depthWrite=!1,P.allowOverride=!1,P.fog=!1,P.lights=!1,P.vertexNode=T,P.colorNode=p,l.backgroundMeshNode=p,l.backgroundMesh=u=new Gn(new Aa(1,32,32),P),u.frustumCulled=!1,u.name="Background.mesh",s.addEventListener("dispose",R)}let f=c.getCacheKey();l.backgroundCacheKey!==f&&(l.backgroundMeshNode.node=Lt(c).mul(DO),l.backgroundMeshNode.needsUpdate=!0,u.material.needsUpdate=!0,l.backgroundCacheKey=f),t.unshift(u,u.geometry,u.material,0,0,null,null)}else Ge("Renderer: Unsupported background configuration.",s);let a=r.xr.getEnvironmentBlendMode();if(a==="additive"?eu.set(0,0,0,1):a==="alpha-blend"&&eu.set(0,0,0,0),r.autoClear===!0||o===!0){let l=n.clearColorValue;l.r=eu.r,l.g=eu.g,l.b=eu.b,l.a=eu.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}},NTe=0,mb=class{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=NTe++}},KO=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 mb(t.name,[]);e.push(r);for(let s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}},oC=class{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}},QO=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}},aC=class{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}},JO=class extends aC{constructor(e,t,n=null,r=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=r}},eB=class{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}},LTe=0,tb=class{constructor(e=null){this.id=LTe++,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)}},tB=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},Uh=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}},nB=class extends Uh{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},iB=class extends Uh{constructor(e,t=new Oe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},rB=class extends Uh{constructor(e,t=new ie){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},sB=class extends Uh{constructor(e,t=new gn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},oB=class extends Uh{constructor(e,t=new Ut){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},aB=class extends Uh{constructor(e,t=new R_){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},lB=class extends Uh{constructor(e,t=new Sn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},cB=class extends Uh{constructor(e,t=new on){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},uB=class extends nB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},hB=class extends iB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},fB=class extends rB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},dB=class extends sB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},pB=class extends oB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},AB=class extends aB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},mB=class extends lB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},gB=class extends cB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},DTe=0,cZ=new WeakMap,uZ=new WeakMap,FTe=new WeakMap,OTe=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),KE=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0")),$ee=i=>{if(i.writeUsageCount>0)return!0;if(i.subBuildsCache!==void 0){for(let e in i.subBuildsCache)if($ee(i.subBuildsCache[e]))return!0}return!1},lC=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=gM(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new tb,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:DTe++})}isFlatShading(){return this.material.flatShading===!0||this.geometry.hasAttribute("normal")===!1}isOpaque(){let e=this.material;return e.transparent===!1&&e.blending===os&&e.alphaToCoverage===!1}createRenderTarget(e,t,n){return new ua(e,t,n)}createCubeRenderTarget(e,t){return new kM(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===Dr?o="ivec":r===Ai&&(o="uvec"),s===kf||s===Ku?r===Dr?t="int":r===Ai?t="uint":t="float":s===Ms||s===Qu?t=`${o}2`:s===Uf||s===b2?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,p)=>f.nodeUniform.node.id-p.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=cZ.get(a);l===void 0&&(l=new Map,cZ.set(a,l));let c=z1(o);s=l.get(c),s===void 0&&(s=new mb(e,t),l.set(c,s))}else s=new mb(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 dM)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!==_n.NONE||n!==_n.NONE)&&this.sequentialNodes.add(e)}buildUpdateNodes(){for(let e of this.nodes)e.getUpdateType()!==_n.NONE&&this.updateNodes.push(e);for(let e of this.sequentialNodes){let t=e.getUpdateBeforeType(),n=e.getUpdateAfterType();t!==_n.NONE&&this.updateBeforeNodes.push(e),n!==_n.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===bi||e.magFilter===cp||e.magFilter===rc||e.magFilter===xo||e.minFilter===bi||e.minFilter===cp||e.minFilter===rc||e.minFilter===xo}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 tb(t?this.getCache():null)),n.cache}isAvailable(){return!1}getVertexIndex(){je("Abstract function.")}getInstanceIndex(){je("Abstract function.")}getDrawIndex(){je("Abstract function.")}getFrontFacing(){je("Abstract function.")}getFragCoord(){je("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($ee(r[s]))return!0}return!1}generateTexture(){je("Abstract function.")}generateTextureLod(){je("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 Ut:e==="vec2"||e==="uvec2"||e==="ivec2"?t=new Oe:e==="vec3"||e==="uvec3"||e==="ivec3"?t=new ie:(e==="vec4"||e==="uvec4"||e==="ivec4")&&(t=new gn)),e==="float")return KE(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")}( ${KE(t.r)}, ${KE(t.g)}, ${KE(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 oC(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===Dr?"int":t===Ai?"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=kZ(e),r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return OTe.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 __)&&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=gM(this.stack);let e=C7();return this.stacks.push(e),ib(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,ib(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 oC(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 tB(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 QO(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 p=e.getArrayCount(this);l=new aC(t,n,s,p),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 JO(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&&je(`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 eB("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+`;4160+`),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=uZ.get(t);n===void 0&&(n=new WeakMap,uZ.set(t,n));let r=n.get(e);if(r===void 0){r=new tC;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 $M(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 tb,this.stack=gM();for(let u of fM)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(){je("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};41614161 `),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(){je("Abstract function.")}getVaryings(){je("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?`41624162 `:`41634163 `)}getUniforms(){je("Abstract function.")}getCodes(e){let t=this.codes[e],n="";if(t!==void 0)for(let r of t)n+=r.code+`4164-`;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(){je("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()}:Ge('NodeBuilder: "renderer.contextNode" must be an instance of `context()`.'),n&&n.contextNode&&(n.contextNode.isContextNode===!0?this.context={...this.context,...n.contextNode.getFlowContextData()}:Ge('NodeBuilder: "material.contextNode" must be an instance of `context()`.')),n!==null){let r=t.library.fromMaterial(n);r===null&&(Ge(`NodeBuilder: Material "${n.type}" is not compatible.`),r=new Ar),r.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(let e of uM){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of hM){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 uM){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of hM){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this);await wL()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=LTe.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 iB(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new rB(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new sB(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new oB(e);else if(t==="color")r=new aB(e);else if(t==="mat2")r=new lB(e);else if(t==="mat3")r=new cB(e);else if(t==="mat4")r=new uB(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 System4165-`}needsPreviousData(){let e=this.renderer.getMRT();return e&&e.has("velocity")||kZ(this.object).useVelocity===!0}},aC=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===_n.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===_n.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===_n.OBJECT&&e.updateBefore(this)}updateAfterNode(e){let t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===_n.FRAME){let r=this._getMaps(this.updateAfterMap,n);r.frameId!==this.frameId&&e.updateAfter(this)!==!1&&(r.frameId=this.frameId)}else if(t===_n.RENDER){let r=this._getMaps(this.updateAfterMap,n);r.renderId!==this.renderId&&e.updateAfter(this)!==!1&&(r.renderId=this.renderId)}else t===_n.OBJECT&&e.updateAfter(this)}updateNode(e){let t=e.getUpdateType(),n=e.updateReference(this);if(t===_n.FRAME){let r=this._getMaps(this.updateMap,n);r.frameId!==this.frameId&&e.update(this)!==!1&&(r.frameId=this.frameId)}else if(t===_n.RENDER){let r=this._getMaps(this.updateMap,n);r.renderId!==this.renderId&&e.update(this)!==!1&&(r.renderId=this.renderId)}else t===_n.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}},Ab=class{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}};Ab.isNodeFunctionInput=!0;var hB=class extends td{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},fB=class extends td{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:UU(this.light),lightColor:e}}},dB=class extends td{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=OU(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Ht(new Ut).setGroup(Zt)}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=m0.dot(r).mul(.5).add(.5),a=Xn(n,t,o);e.context.irradiance.addAssign(a)}},mb=class extends td{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Ht(0).setGroup(Zt),this.penumbraCosNode=Ht(0).setGroup(Zt),this.cutoffDistanceNode=Ht(0).setGroup(Zt),this.decayExponentNode=Ht(0).setGroup(Zt),this.colorNode=Ht(this.color).setGroup(Zt)}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 Fl(n,r,t)}getLightCoord(e){let t=e.getNodeProperties(this),n=t.projectionUV;return n===void 0&&(n=wee(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(UU(s)),c=this.getSpotAttenuation(e,l),u=o.length(),f=GU({lightDistance:u,cutoffDistance:n,decayExponent:r}),p=t.mul(c).mul(f),x,v;return s.colorNode?(v=this.getLightCoord(e),x=s.colorNode(v)):s.map&&(v=this.getLightCoord(e),x=ai(s.map,v.xy).onRenderUpdate(()=>s.map)),x&&(p=v.mul(2).sub(1).abs().lessThan(1).all().select(p.mul(x),p)),{lightColor:p,lightDirection:a}}},pB=class extends mb{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=ai(n,ft(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)}},AB=class extends td{static get type(){return"LightProbeNode"}constructor(e=null){super(e);let t=[];for(let n=0;n<9;n++)t.push(new ie);this.lightProbe=To(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=Wee(m0,this.lightProbe);e.context.irradiance.addAssign(t)}},FTe=Ae(([i,e])=>{let t=i.abs().sub(e);return Mh(Sr(t,0)).add(Ja(Sr(t.x,t.y),0))}),mB=class extends mb{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=se(0),n=this.penumbraCosNode,r=tR(this.light).mul(e.context.positionWorld||Ch);return Wt(r.w.greaterThan(0),()=>{let s=r.xyz.div(r.w),o=FTe(s.xy.sub(ft(.5)),ft(.5)),a=Dl(-1,ni(1,D7(n)).sub(1));t.assign(GC(o.mul(-2).mul(a)))}),t}},m8=new on,ZE=new on,Fv=null,gB=class extends td{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Ht(new ie).setGroup(Zt),this.halfWidth=Ht(new ie).setGroup(Zt),this.updateType=_n.RENDER}update(e){super.update(e);let{light:t}=this,n=e.camera.matrixWorldInverse;ZE.identity(),m8.copy(t.matrixWorld),m8.premultiply(n),ZE.extractRotation(m8),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(ZE),this.halfHeight.value.applyMatrix4(ZE)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=ai(Fv.LTC_FLOAT_1),n=ai(Fv.LTC_FLOAT_2)):(t=ai(Fv.LTC_HALF_1),n=ai(Fv.LTC_HALF_2));let{colorNode:r,light:s}=this,o=BU(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){Fv=e}},lC=class{parseFunction(){je("Abstract function.")}},gb=class{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){je("Abstract function.")}};gb.isNodeFunction=!0;var OTe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,BTe=/[a-z_0-9]+/ig,cZ="#pragma main",UTe=i=>{i=i.trim();let e=i.indexOf(cZ),t=e!==-1?i.slice(e+cZ.length):i,n=t.match(OTe);if(n!==null&&n.length===5){let r=n[4],s=[],o=null;for(;(o=BTe.exec(r))!==null;)s.push(o);let a=[],l=0;for(;l<s.length;){let v=s[l][0]==="const";v===!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 P=s[l++][0];a.push(new Ab(S,P,T,w,v))}let c=t.substring(n[0].length),u=n[3]!==void 0?n[3]:"",f=n[2],p=n[1]!==void 0?n[1]:"",x=e!==-1?i.slice(0,e):"";return{type:f,inputs:a,name:u,precision:p,inputsCode:r,blockCode:c,headerCode:x}}else throw new Error("THREE.FunctionNode: Function is not a GLSL code.")},_B=class extends gb{constructor(e){let{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=UTe(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}},xB=class extends lC{parseFunction(e){return new _B(e)}},cc=[],Wf=[],uZ=Ht(0,"int").setGroup(Zt),yB=class extends Dh{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new aC,this.nodeBuilderCache=new Map,this.callHashCache=new Lh,this.groupsData=new Lh,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===_n.OBJECT)return!0;cc[0]=t,cc[1]=e;let n=this.groupsData.get(cc);return n===void 0&&this.groupsData.set(cc,n={}),cc[0]=null,cc[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 Ar),t?await l.buildAsync():l.build(),Ge("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 Ar),l.build();let u=c.stackTrace;!u&&c.stack&&(u=new Ur(c.stack)),Ge("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 HO(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){cc[0]=e,cc[1]=t;let n=this.renderer.info.calls,r=this.callHashCache.get(cc)||{};if(r.callId!==n){if(Wf.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Wf.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){Wf.push(t.getCacheKey(!0)),Wf.push(this.renderer.shadowMap.enabled?1:0),Wf.push(this.renderer.shadowMap.type);let o=this.getEnvironmentNode(e);o&&Wf.push(o.getCacheKey())}let s=this.getFogNode(e);s&&Wf.push(s.getCacheKey()),r.callId=n,r.cacheKey=vb(Wf),this.callHashCache.set(cc,r),Wf.length=0}return cc[0]=null,cc[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===op||n.mapping===ap||n.mapping===ju){if(e.backgroundBlurriness>0||n.mapping===ju)return PU(n);{let o;return n.isCubeTexture===!0?o=Ea(n):o=ai(n),GJ(o)}}else{if(n.isTexture===!0)return ai(n,iu.flipY()).setUpdateMatrix(!0);n.isColor!==!0&&Ge("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=nr("color","color",n).setGroup(Zt),o=nr("density","float",n).setGroup(Zt);return DO(s,bee(o))}else if(n.isFog){let s=nr("color","color",n).setGroup(Zt),o=nr("near","float",n).setGroup(Zt),a=nr("far","float",n).setGroup(Zt);return DO(s,vee(o,a))}else Ge("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 Ea(n);if(n.isTexture===!0)return ai(n);Ge("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=ai(e,iu).depth(rd("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):n=ai(e,iu).depth(uZ).renderOutput(t.toneMapping,t.currentColorSpace):n=ai(e,iu).renderOutput(t.toneMapping,t.currentColorSpace),n}setOutputLayerIndex(e){uZ.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 aC,this.nodeBuilderCache=new Map,this.cacheLib={}}},g8=new la,cC=class i{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewMatrix=new on,this.viewNormalMatrix=new Sn,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++){g8.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let o=t[n+s],a=g8.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=g8.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 gn;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}},vB=class{constructor(e,t,n){this.bundleGroup=e,this.camera=t,this.renderContext=n}},Xp=[],bB=class{constructor(){this.bundles=new Lh}get(e,t,n){let r=this.bundles;Xp[0]=e,Xp[1]=t,Xp[2]=n;let s=r.get(Xp);return s===void 0&&(s=new vB(e,t,n),r.set(Xp,s)),Xp[0]=null,Xp[1]=null,Xp[2]=null,s}dispose(){this.bundles=new Lh}},uC=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)){je(`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)){je(`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)}},kTe=new db,hZ=new WeakMap,wB=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new db().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return kTe;let t=hZ.get(e);return t===void 0&&(t=this.createNode(),hZ.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},Sm=class extends ua{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}},fZ=new ie,dZ=new ie,pZ=new WeakMap,SB=class extends zo{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new Ir,this._cameraL.viewport=new gn,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new Ir,this._cameraR.viewport=new gn,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new E_,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=WTe.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Oe,this._onSessionEvent=VTe.bind(this),this._onSessionEnd=qTe.bind(this),this._onInputSourcesChange=HTe.bind(this),this._onAnimationFrame=jTe.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&&je("XRManager: Cannot change framebuffer scale while presenting.")}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,this.isPresenting===!0&&je("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){Kn(`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&&(Kn("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 ua(n.textureWidth,n.textureHeight,{depth:2,minFilter:bi,magFilter:bi,depthBuffer:!0,multiview:!1,useArrayDepthTexture:!0,samples:0}),this._xrRenderTarget.texture.isArrayTexture=!0,this._useMultiviewIfPossible===!0&&Kn("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 RA(e,t),u=new Sm(s,o,{format:vr,type:zi,depthTexture:new ls(s,o,l.stencil?Vo:pi,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?eo:vs),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let f=new as({color:16777215,side:go});f.map=u.texture,f.map.offset.y=1,f.map.repeat.y=-1;let p=new Gn(c,f);p.position.copy(n),p.quaternion.copy(r);let x={type:"quad",width:e,height:t,translation:n,quaternion:r,pixelwidth:s,pixelheight:o,plane:p,material:f,rendercall:a,renderTarget:u};if(this._layers.push(x),this._session!==null){x.plane.material=new as({color:16777215,side:go}),x.plane.material.blending=Of,x.plane.material.blendEquation=Gs,x.plane.material.blendSrc=Wc,x.plane.material.blendDst=Wc,x.xrlayer=this._createXRLayer(x);let v=this._session.renderState.layers;v.unshift(x.xrlayer),this._session.updateRenderState({layers:v})}else u.isXRRenderTarget=!1;return p}createCylinderLayer(e,t,n,r,s,o,a,l,c={}){let u=new EA(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),f=new Sm(o,a,{format:vr,type:zi,depthTexture:new ls(o,a,c.stencil?Vo:pi,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?eo:vs),stencilBuffer:c.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});f._autoAllocateDepthBuffer=!0;let p=new as({color:16777215,side:ui});p.map=f.texture,p.map.offset.y=1,p.map.repeat.y=-1;let x=new Gn(u,p);x.position.copy(r),x.quaternion.copy(s);let v={type:"cylinder",radius:e,centralAngle:t,aspectratio:n,translation:r,quaternion:s,pixelwidth:o,pixelheight:a,plane:x,material:p,rendercall:l,renderTarget:f};if(this._layers.push(v),this._session!==null){v.plane.material=new as({color:16777215,side:ui}),v.plane.material.blending=Of,v.plane.material.blendEquation=Gs,v.plane.material.blendSrc=Wc,v.plane.material.blendDst=Wc,v.xrlayer=this._createXRLayer(v);let w=this._session.renderState.layers;w.unshift(v.xrlayer),this._session.updateRenderState({layers:w})}else f.isXRRenderTarget=!1;return x}renderLayers(){let e=new ie,t=new bs,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=pZ.get(l),c===void 0&&(c=l.context({getOutput:f=>tU(f,n.toneMapping,n.outputColorSpace)}),pZ.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?eo:vs,s=t.stencil?Vo:pi);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,p=new ls(c.textureWidth,c.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,r,f);if(this._xrRenderTarget=new Sm(c.textureWidth,c.textureHeight,{format:vr,type:zi,colorSpace:t.outputColorSpace,depthTexture:p,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 x of this._layers)x.plane.material=new as({color:16777215,side:x.type==="cylinder"?ui:go}),x.plane.material.blending=Of,x.plane.material.blendEquation=Gs,x.plane.material.blendSrc=Wc,x.plane.material.blendDst=Wc,x.xrlayer=this._createXRLayer(x),u.unshift(x.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 Sm(s.framebufferWidth,s.framebufferHeight,{format:vr,type:zi,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;AZ(s,l);for(let u=0;u<c.length;u++)AZ(c[u],l);c.length===2?GTe(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),zTe(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new Kd,this._controllers[e]=t),t}};function GTe(i,e,t){fZ.setFromMatrixPosition(e.matrixWorld),dZ.setFromMatrixPosition(t.matrixWorld);let n=fZ.distanceTo(dZ),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],p=o*u,x=o*f,v=n/(-u+f),w=v*-u;if(e.matrixWorld.decompose(i.position,i.quaternion,i.scale),i.translateX(w),i.translateZ(v),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+v,T=a+v,P=p-w,R=x+(n-w),C=l*a/T*S,L=c*a/T*S;i.projectionMatrix.makePerspective(P,R,C,L,S,T),i.projectionMatrixInverse.copy(i.projectionMatrix).invert()}}function AZ(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function zTe(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=Rf*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function VTe(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 qTe(){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 Sm(t.pixelwidth,t.pixelheight,{format:vr,type:zi,depthTexture:new ls(t.pixelwidth,t.pixelheight,t.stencilBuffer?Vo:pi,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?eo: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 HTe(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 WTe(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 jTe(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 p=0;p<l.length;p++){let x=l[p],v;if(c!==null)v=c.viewports[p];else if(this._supportsLayers===!0){let S=this._glBinding.getViewSubImage(this._glProjLayer,x);v=S.viewport,p===0&&r.setXRRenderTargetTextures(this._xrRenderTarget,S.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:S.depthStencilTexture)}else v=s.getViewport(x);let w=this._cameras[p];w===void 0&&(w=new Ir,w.layers.enable(p),w.viewport=new gn,w.matrixWorldAutoUpdate=!1,this._cameras[p]=w),w.matrix.fromArray(x.transform.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale),w.projectionMatrix.fromArray(x.projectionMatrix),w.projectionMatrixInverse.copy(w.projectionMatrix).invert(),w.viewport.set(v.x,v.y,v.width,v.height),p===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 TB=class extends zo{constructor(e){super(),this.domElement=e,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new gn(0,0,this._width,this._height),this._scissor=new gn(0,0,this._width,this._height),this._scissorTest=!1,this.colorTexture=new TA,this.depthTexture=new ls}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"})}},mZ=new Qd,u1=new Oe,_8=new gn,KE=new ec,QE=new by,h1=new on,jf=new gn,XTe={[go]:ui,[ui]:go,[rr]:rr},EB=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=Di,multiview:p=!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=yr,this.toneMapping=zs,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new rO,this.contextNode=id(),this.library=new uC,this.lighting=new wB,this._samples=c||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new TB(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new RM,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 x=this.alpha===!0?0:1;this._clearColor=new cb(0,0,0,x),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:sp},this.xr=new SB(this,p),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(v,w,S)=>{await this.compileAsync(S,w,v);let P=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,R=this._renderLists.get(v,w),C=this._renderContexts.get(P,this._mrt),L=v.overrideMaterial||S.material,D=this._objects.get(S,L,v,w,R.lightsNode,C,C.clippingContext),{fragmentShader:F,vertexShader:N}=D.getNodeBuilderState();return{fragmentShader:F,vertexShader:N}}}}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 yB(this,n),this._animation=new JF(this,this._nodes,this.info),this._attributes=new nO(n,this.info),this._background=new qO(this,this._nodes),this._geometries=new iO(this._attributes,this.info),this._textures=new dO(this,n,this.info),this._pipelines=new aO(n,this._nodes,this.info),this._bindings=new lO(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new tO(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new uO(this.lighting),this._bundles=new bB,this._renderContexts=new fO(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:mZ,p=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,x=this._renderContexts.get(p,this._mrt),v=this._activeMipmapLevel,w=[];this._currentRenderContext=x,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=w,r.renderId++,r.update(),x.depth=this.depth,x.stencil=this.stencil,x.clippingContext||(x.clippingContext=new cC),x.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,p);let S=t.isArrayCamera?QE:KE;t.isArrayCamera?S.setFromArrayCamera(t):(h1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix(h1,t.coordinateSystem,t.reversedDepth));let T=this._renderLists.get(u,t);if(T.begin(),this._projectObject(e,t,0,T,x.clippingContext),n!==e&&n.traverseVisible(function(D){D.isLight&&D.layers.test(t.layers)&&T.pushLight(D)}),T.finish(),p!==null){this._textures.updateRenderTarget(p,v);let D=this._textures.get(p);x.textures=D.textures,x.depthTexture=D.depthTexture}else x.textures=null,x.depthTexture=null;n!==e?this._background.update(n,T,x):this._background.update(u,T,x);let P=T.opaque,R=T.transparent,C=T.transparentDoublePass,L=T.lightsNode;this.opaque===!0&&P.length>0&&this._renderObjects(P,t,u,L),this.transparent===!0&&R.length>0&&this._renderTransparents(R,C,t,u,L),r.renderId=s,this._currentRenderContext=o,this._currentRenderObjectFunction=a,this._handleObjectFunction=l,this._compilationPromises=c;for(let D of w){let F=this._objects.get(D.object,D.material,D.scene,D.camera,D.lightsNode,D.renderContext,D.clippingContext,D.passId);F.drawRange=D.object.geometry.drawRange,F.group=D.group,await this._nodes.getForRenderAsync(F),this._nodes.updateBefore(F),this._geometries.updateForRender(F),this._nodes.updateForRender(F),this._bindings.updateForRender(F);let N=[];this._pipelines.getForRender(F,N),N.length>0&&await Promise.all(N),this._nodes.updateAfter(F),await wL()}}async renderAsync(e,t){Kn('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){Ge("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=sF,t.modelNormalViewMatrix=oF):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===sF&&e.modelNormalViewMatrix===oF}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return Kn('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:4164+`;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(){je("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()}:Ge('NodeBuilder: "renderer.contextNode" must be an instance of `context()`.'),n&&n.contextNode&&(n.contextNode.isContextNode===!0?this.context={...this.context,...n.contextNode.getFlowContextData()}:Ge('NodeBuilder: "material.contextNode" must be an instance of `context()`.')),n!==null){let r=t.library.fromMaterial(n);r===null&&(Ge(`NodeBuilder: Material "${n.type}" is not compatible.`),r=new Ar),r.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(let e of fM){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of dM){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 fM){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of dM){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this);await PL()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=FTe.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 uB(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new hB(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new fB(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new dB(e);else if(t==="color")r=new pB(e);else if(t==="mat2")r=new AB(e);else if(t==="mat3")r=new mB(e);else if(t==="mat4")r=new gB(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 System4165+`}needsPreviousData(){let e=this.renderer.getMRT();return e&&e.has("velocity")||zZ(this.object).useVelocity===!0}},cC=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===_n.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===_n.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===_n.OBJECT&&e.updateBefore(this)}updateAfterNode(e){let t=e.getUpdateAfterType(),n=e.updateReference(this);if(t===_n.FRAME){let r=this._getMaps(this.updateAfterMap,n);r.frameId!==this.frameId&&e.updateAfter(this)!==!1&&(r.frameId=this.frameId)}else if(t===_n.RENDER){let r=this._getMaps(this.updateAfterMap,n);r.renderId!==this.renderId&&e.updateAfter(this)!==!1&&(r.renderId=this.renderId)}else t===_n.OBJECT&&e.updateAfter(this)}updateNode(e){let t=e.getUpdateType(),n=e.updateReference(this);if(t===_n.FRAME){let r=this._getMaps(this.updateMap,n);r.frameId!==this.frameId&&e.update(this)!==!1&&(r.frameId=this.frameId)}else if(t===_n.RENDER){let r=this._getMaps(this.updateMap,n);r.renderId!==this.renderId&&e.update(this)!==!1&&(r.renderId=this.renderId)}else t===_n.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}},gb=class{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}};gb.isNodeFunctionInput=!0;var _B=class extends nd{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},xB=class extends nd{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:WU(this.light),lightColor:e}}},yB=class extends nd{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=qU(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Ht(new Ut).setGroup(Zt)}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=g0.dot(r).mul(.5).add(.5),a=Xn(n,t,o);e.context.irradiance.addAssign(a)}},_b=class extends nd{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=Ht(0).setGroup(Zt),this.penumbraCosNode=Ht(0).setGroup(Zt),this.cutoffDistanceNode=Ht(0).setGroup(Zt),this.decayExponentNode=Ht(0).setGroup(Zt),this.colorNode=Ht(this.color).setGroup(Zt)}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 Ol(n,r,t)}getLightCoord(e){let t=e.getNodeProperties(this),n=t.projectionUV;return n===void 0&&(n=Tee(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(WU(s)),c=this.getSpotAttenuation(e,l),u=o.length(),f=XU({lightDistance:u,cutoffDistance:n,decayExponent:r}),p=t.mul(c).mul(f),x,v;return s.colorNode?(v=this.getLightCoord(e),x=s.colorNode(v)):s.map&&(v=this.getLightCoord(e),x=li(s.map,v.xy).onRenderUpdate(()=>s.map)),x&&(p=v.mul(2).sub(1).abs().lessThan(1).all().select(p.mul(x),p)),{lightColor:p,lightDirection:a}}},vB=class extends _b{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=li(n,ft(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)}},bB=class extends nd{static get type(){return"LightProbeNode"}constructor(e=null){super(e);let t=[];for(let n=0;n<9;n++)t.push(new ie);this.lightProbe=To(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=Xee(g0,this.lightProbe);e.context.irradiance.addAssign(t)}},BTe=Ae(([i,e])=>{let t=i.abs().sub(e);return Rh(Tr(t,0)).add(el(Tr(t.x,t.y),0))}),wB=class extends _b{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=se(0),n=this.penumbraCosNode,r=iR(this.light).mul(e.context.positionWorld||Ph);return Wt(r.w.greaterThan(0),()=>{let s=r.xyz.div(r.w),o=BTe(s.xy.sub(ft(.5)),ft(.5)),a=Fl(-1,ni(1,z7(n)).sub(1));t.assign(VC(o.mul(-2).mul(a)))}),t}},w8=new on,QE=new on,Bv=null,SB=class extends nd{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=Ht(new ie).setGroup(Zt),this.halfWidth=Ht(new ie).setGroup(Zt),this.updateType=_n.RENDER}update(e){super.update(e);let{light:t}=this,n=e.camera.matrixWorldInverse;QE.identity(),w8.copy(t.matrixWorld),w8.premultiply(n),QE.extractRotation(w8),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(QE),this.halfHeight.value.applyMatrix4(QE)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=li(Bv.LTC_FLOAT_1),n=li(Bv.LTC_FLOAT_2)):(t=li(Bv.LTC_HALF_1),n=li(Bv.LTC_HALF_2));let{colorNode:r,light:s}=this,o=HU(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){Bv=e}},uC=class{parseFunction(){je("Abstract function.")}},xb=class{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){je("Abstract function.")}};xb.isNodeFunction=!0;var UTe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,kTe=/[a-z_0-9]+/ig,hZ="#pragma main",GTe=i=>{i=i.trim();let e=i.indexOf(hZ),t=e!==-1?i.slice(e+hZ.length):i,n=t.match(UTe);if(n!==null&&n.length===5){let r=n[4],s=[],o=null;for(;(o=kTe.exec(r))!==null;)s.push(o);let a=[],l=0;for(;l<s.length;){let v=s[l][0]==="const";v===!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 P=s[l++][0];a.push(new gb(S,P,T,w,v))}let c=t.substring(n[0].length),u=n[3]!==void 0?n[3]:"",f=n[2],p=n[1]!==void 0?n[1]:"",x=e!==-1?i.slice(0,e):"";return{type:f,inputs:a,name:u,precision:p,inputsCode:r,blockCode:c,headerCode:x}}else throw new Error("THREE.FunctionNode: Function is not a GLSL code.")},TB=class extends xb{constructor(e){let{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=GTe(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}},EB=class extends uC{parseFunction(e){return new TB(e)}},uc=[],jf=[],fZ=Ht(0,"int").setGroup(Zt),MB=class extends Oh{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new cC,this.nodeBuilderCache=new Map,this.callHashCache=new Fh,this.groupsData=new Fh,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===_n.OBJECT)return!0;uc[0]=t,uc[1]=e;let n=this.groupsData.get(uc);return n===void 0&&this.groupsData.set(uc,n={}),uc[0]=null,uc[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 Ar),t?await l.buildAsync():l.build(),Ge("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 Ar),l.build();let u=c.stackTrace;!u&&c.stack&&(u=new Ur(c.stack)),Ge("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 KO(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){uc[0]=e,uc[1]=t;let n=this.renderer.info.calls,r=this.callHashCache.get(uc)||{};if(r.callId!==n){if(jf.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),jf.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){jf.push(t.getCacheKey(!0)),jf.push(this.renderer.shadowMap.enabled?1:0),jf.push(this.renderer.shadowMap.type);let o=this.getEnvironmentNode(e);o&&jf.push(o.getCacheKey())}let s=this.getFogNode(e);s&&jf.push(s.getCacheKey()),r.callId=n,r.cacheKey=wb(jf),this.callHashCache.set(uc,r),jf.length=0}return uc[0]=null,uc[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===ap||n.mapping===lp||n.mapping===$u){if(e.backgroundBlurriness>0||n.mapping===$u)return BU(n);{let o;return n.isCubeTexture===!0?o=Ea(n):o=li(n),VJ(o)}}else{if(n.isTexture===!0)return li(n,ru.flipY()).setUpdateMatrix(!0);n.isColor!==!0&&Ge("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=nr("color","color",n).setGroup(Zt),o=nr("density","float",n).setGroup(Zt);return zO(s,See(o))}else if(n.isFog){let s=nr("color","color",n).setGroup(Zt),o=nr("near","float",n).setGroup(Zt),a=nr("far","float",n).setGroup(Zt);return zO(s,wee(o,a))}else Ge("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 Ea(n);if(n.isTexture===!0)return li(n);Ge("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=li(e,ru).depth(sd("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):n=li(e,ru).depth(fZ).renderOutput(t.toneMapping,t.currentColorSpace):n=li(e,ru).renderOutput(t.toneMapping,t.currentColorSpace),n}setOutputLayerIndex(e){fZ.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 cC,this.nodeBuilderCache=new Map,this.cacheLib={}}},S8=new la,hC=class i{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewMatrix=new on,this.viewNormalMatrix=new Sn,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++){S8.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let o=t[n+s],a=S8.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=S8.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 gn;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}},CB=class{constructor(e,t,n){this.bundleGroup=e,this.camera=t,this.renderContext=n}},$p=[],RB=class{constructor(){this.bundles=new Fh}get(e,t,n){let r=this.bundles;$p[0]=e,$p[1]=t,$p[2]=n;let s=r.get($p);return s===void 0&&(s=new CB(e,t,n),r.set($p,s)),$p[0]=null,$p[1]=null,$p[2]=null,s}dispose(){this.bundles=new Fh}},fC=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)){je(`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)){je(`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)}},zTe=new Ab,dZ=new WeakMap,PB=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new Ab().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return zTe;let t=dZ.get(e);return t===void 0&&(t=this.createNode(),dZ.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},Em=class extends ua{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}},pZ=new ie,AZ=new ie,mZ=new WeakMap,IB=class extends zo{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new Nr,this._cameraL.viewport=new gn,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new Nr,this._cameraR.viewport=new gn,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new M_,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=XTe.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Oe,this._onSessionEvent=HTe.bind(this),this._onSessionEnd=WTe.bind(this),this._onInputSourcesChange=jTe.bind(this),this._onAnimationFrame=$Te.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&&je("XRManager: Cannot change framebuffer scale while presenting.")}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,this.isPresenting===!0&&je("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){Kn(`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&&(Kn("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 ua(n.textureWidth,n.textureHeight,{depth:2,minFilter:bi,magFilter:bi,depthBuffer:!0,multiview:!1,useArrayDepthTexture:!0,samples:0}),this._xrRenderTarget.texture.isArrayTexture=!0,this._useMultiviewIfPossible===!0&&Kn("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 IA(e,t),u=new Em(s,o,{format:br,type:zi,depthTexture:new ls(s,o,l.stencil?Vo:Ai,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?eo:ws),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let f=new as({color:16777215,side:go});f.map=u.texture,f.map.offset.y=1,f.map.repeat.y=-1;let p=new Gn(c,f);p.position.copy(n),p.quaternion.copy(r);let x={type:"quad",width:e,height:t,translation:n,quaternion:r,pixelwidth:s,pixelheight:o,plane:p,material:f,rendercall:a,renderTarget:u};if(this._layers.push(x),this._session!==null){x.plane.material=new as({color:16777215,side:go}),x.plane.material.blending=Bf,x.plane.material.blendEquation=Gs,x.plane.material.blendSrc=jc,x.plane.material.blendDst=jc,x.xrlayer=this._createXRLayer(x);let v=this._session.renderState.layers;v.unshift(x.xrlayer),this._session.updateRenderState({layers:v})}else u.isXRRenderTarget=!1;return p}createCylinderLayer(e,t,n,r,s,o,a,l,c={}){let u=new CA(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),f=new Em(o,a,{format:br,type:zi,depthTexture:new ls(o,a,c.stencil?Vo:Ai,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?eo:ws),stencilBuffer:c.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});f._autoAllocateDepthBuffer=!0;let p=new as({color:16777215,side:hi});p.map=f.texture,p.map.offset.y=1,p.map.repeat.y=-1;let x=new Gn(u,p);x.position.copy(r),x.quaternion.copy(s);let v={type:"cylinder",radius:e,centralAngle:t,aspectratio:n,translation:r,quaternion:s,pixelwidth:o,pixelheight:a,plane:x,material:p,rendercall:l,renderTarget:f};if(this._layers.push(v),this._session!==null){v.plane.material=new as({color:16777215,side:hi}),v.plane.material.blending=Bf,v.plane.material.blendEquation=Gs,v.plane.material.blendSrc=jc,v.plane.material.blendDst=jc,v.xrlayer=this._createXRLayer(v);let w=this._session.renderState.layers;w.unshift(v.xrlayer),this._session.updateRenderState({layers:w})}else f.isXRRenderTarget=!1;return x}renderLayers(){let e=new ie,t=new Ss,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=mZ.get(l),c===void 0&&(c=l.context({getOutput:f=>lU(f,n.toneMapping,n.outputColorSpace)}),mZ.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?eo:ws,s=t.stencil?Vo:Ai);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,p=new ls(c.textureWidth,c.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,r,f);if(this._xrRenderTarget=new Em(c.textureWidth,c.textureHeight,{format:br,type:zi,colorSpace:t.outputColorSpace,depthTexture:p,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 x of this._layers)x.plane.material=new as({color:16777215,side:x.type==="cylinder"?hi:go}),x.plane.material.blending=Bf,x.plane.material.blendEquation=Gs,x.plane.material.blendSrc=jc,x.plane.material.blendDst=jc,x.xrlayer=this._createXRLayer(x),u.unshift(x.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 Em(s.framebufferWidth,s.framebufferHeight,{format:br,type:zi,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;gZ(s,l);for(let u=0;u<c.length;u++)gZ(c[u],l);c.length===2?VTe(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),qTe(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new Qd,this._controllers[e]=t),t}};function VTe(i,e,t){pZ.setFromMatrixPosition(e.matrixWorld),AZ.setFromMatrixPosition(t.matrixWorld);let n=pZ.distanceTo(AZ),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],p=o*u,x=o*f,v=n/(-u+f),w=v*-u;if(e.matrixWorld.decompose(i.position,i.quaternion,i.scale),i.translateX(w),i.translateZ(v),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+v,T=a+v,P=p-w,R=x+(n-w),C=l*a/T*S,L=c*a/T*S;i.projectionMatrix.makePerspective(P,R,C,L,S,T),i.projectionMatrixInverse.copy(i.projectionMatrix).invert()}}function gZ(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function qTe(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=If*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function HTe(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 WTe(){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 Em(t.pixelwidth,t.pixelheight,{format:br,type:zi,depthTexture:new ls(t.pixelwidth,t.pixelheight,t.stencilBuffer?Vo:Ai,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?eo:ws),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 jTe(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 XTe(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 $Te(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 p=0;p<l.length;p++){let x=l[p],v;if(c!==null)v=c.viewports[p];else if(this._supportsLayers===!0){let S=this._glBinding.getViewSubImage(this._glProjLayer,x);v=S.viewport,p===0&&r.setXRRenderTargetTextures(this._xrRenderTarget,S.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:S.depthStencilTexture)}else v=s.getViewport(x);let w=this._cameras[p];w===void 0&&(w=new Nr,w.layers.enable(p),w.viewport=new gn,w.matrixWorldAutoUpdate=!1,this._cameras[p]=w),w.matrix.fromArray(x.transform.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale),w.projectionMatrix.fromArray(x.projectionMatrix),w.projectionMatrixInverse.copy(w.projectionMatrix).invert(),w.viewport.set(v.x,v.y,v.width,v.height),p===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 NB=class extends zo{constructor(e){super(),this.domElement=e,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new gn(0,0,this._width,this._height),this._scissor=new gn(0,0,this._width,this._height),this._scissorTest=!1,this.colorTexture=new MA,this.depthTexture=new ls}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"})}},_Z=new Jd,h1=new Oe,T8=new gn,JE=new tc,eM=new Sy,f1=new on,Xf=new gn,YTe={[go]:hi,[hi]:go,[rr]:rr},LB=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=Di,multiview:p=!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=yr,this.toneMapping=zs,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new hO,this.contextNode=rd(),this.library=new fC,this.lighting=new PB,this._samples=c||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new NB(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new IM,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 x=this.alpha===!0?0:1;this._clearColor=new hb(0,0,0,x),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:op},this.xr=new IB(this,p),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(v,w,S)=>{await this.compileAsync(S,w,v);let P=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,R=this._renderLists.get(v,w),C=this._renderContexts.get(P,this._mrt),L=v.overrideMaterial||S.material,D=this._objects.get(S,L,v,w,R.lightsNode,C,C.clippingContext),{fragmentShader:F,vertexShader:N}=D.getNodeBuilderState();return{fragmentShader:F,vertexShader:N}}}}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 MB(this,n),this._animation=new oO(this,this._nodes,this.info),this._attributes=new cO(n,this.info),this._background=new ZO(this,this._nodes),this._geometries=new uO(this._attributes,this.info),this._textures=new yO(this,n,this.info),this._pipelines=new pO(n,this._nodes,this.info),this._bindings=new AO(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new lO(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new gO(this.lighting),this._bundles=new RB,this._renderContexts=new xO(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:_Z,p=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,x=this._renderContexts.get(p,this._mrt),v=this._activeMipmapLevel,w=[];this._currentRenderContext=x,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=w,r.renderId++,r.update(),x.depth=this.depth,x.stencil=this.stencil,x.clippingContext||(x.clippingContext=new hC),x.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,p);let S=t.isArrayCamera?eM:JE;t.isArrayCamera?S.setFromArrayCamera(t):(f1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix(f1,t.coordinateSystem,t.reversedDepth));let T=this._renderLists.get(u,t);if(T.begin(),this._projectObject(e,t,0,T,x.clippingContext),n!==e&&n.traverseVisible(function(D){D.isLight&&D.layers.test(t.layers)&&T.pushLight(D)}),T.finish(),p!==null){this._textures.updateRenderTarget(p,v);let D=this._textures.get(p);x.textures=D.textures,x.depthTexture=D.depthTexture}else x.textures=null,x.depthTexture=null;n!==e?this._background.update(n,T,x):this._background.update(u,T,x);let P=T.opaque,R=T.transparent,C=T.transparentDoublePass,L=T.lightsNode;this.opaque===!0&&P.length>0&&this._renderObjects(P,t,u,L),this.transparent===!0&&R.length>0&&this._renderTransparents(R,C,t,u,L),r.renderId=s,this._currentRenderContext=o,this._currentRenderObjectFunction=a,this._handleObjectFunction=l,this._compilationPromises=c;for(let D of w){let F=this._objects.get(D.object,D.material,D.scene,D.camera,D.lightsNode,D.renderContext,D.clippingContext,D.passId);F.drawRange=D.object.geometry.drawRange,F.group=D.group,await this._nodes.getForRenderAsync(F),this._nodes.updateBefore(F),this._geometries.updateForRender(F),this._nodes.updateForRender(F),this._bindings.updateForRender(F);let N=[];this._pipelines.getForRender(F,N),N.length>0&&await Promise.all(N),this._nodes.updateAfter(F),await PL()}}async renderAsync(e,t){Kn('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){Ge("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=fF,t.modelNormalViewMatrix=dF):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===fF&&e.modelNormalViewMatrix===dF}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return Kn('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:41664166 41674167 Message: ${e.message}`;e.reason&&(t+=`4168-Reason: ${e.reason}`),Ge(t),this._isDeviceLost=!0}_onError(e){let t=`WebGPURenderer: Uncaptured ${e.api} ${e.type}`;e.message&&(t+=`: ${e.message}`),Ge(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:p,opaque:x}=o;this.opaque===!0&&x.length>0&&this._renderObjects(x,s,t,n),this.transparent===!0&&p.length>0&&this._renderTransparents(p,f,s,t,n),this._currentRenderBundle=null,this.backend.finishBundle(a,l),c.version=r.version}else{let{renderObjects:f}=c;for(let p=0,x=f.length;p<x;p++){let v=f[p];this._nodes.needsRefresh(v)&&(this._nodes.updateBefore(v),this._geometries.updateForRender(v),this._nodes.updateForRender(v),this._bindings.updateForRender(v),this._nodes.updateAfter(v))}}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!==zs,r=t!==sn.workingColorSpace;if(n===!1&&r===!1)return null;let{width:s,height:o}=this.getDrawingBufferSize(u1),{depth:a,stencil:l}=this,c=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(c);if(u===void 0){u=new ua(s,o,{depthBuffer:a,stencilBuffer:l,type:this._outputBufferType,format:vr,colorSpace:sn.workingColorSpace,generateMipmaps:!1,minFilter:bi,magFilter:bi,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 p=this._outputRenderTarget?this._outputRenderTarget.viewport:c._viewport,x=this._outputRenderTarget?this._outputRenderTarget.scissor:c._scissor,v=this._outputRenderTarget?1:c._pixelRatio,w=this._outputRenderTarget?this._outputRenderTarget.scissorTest:c._scissorTest;return u.viewport.copy(p),u.scissor.copy(x),u.viewport.multiplyScalar(v),u.scissor.multiplyScalar(v),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:mZ,f=this._renderTarget||this._outputRenderTarget,p=this._activeCubeFace,x=this._activeMipmapLevel,v;if(r!==null?(v=r,this.setRenderTarget(v)):v=f,v!==null&&v.depthBuffer===!0){let Z=this._textures.get(v);Z.depthInitialized!==!0&&((this.autoClear===!1||this.autoClear===!0&&this.autoClearDepth===!1)&&this.clearDepth(),Z.depthInitialized=!0)}let w=this._renderContexts.get(v,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,v),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t);let S=this._canvasTarget,T=S._viewport,P=S._scissor,R=S._pixelRatio;v!==null&&(T=v.viewport,P=v.scissor,R=1),this.getDrawingBufferSize(u1),_8.set(0,0,u1.width,u1.height);let C=T.minDepth===void 0?0:T.minDepth,L=T.maxDepth===void 0?1:T.maxDepth;w.viewportValue.copy(T).multiplyScalar(R).floor(),w.viewportValue.width>>=x,w.viewportValue.height>>=x,w.viewportValue.minDepth=C,w.viewportValue.maxDepth=L,w.viewport=w.viewportValue.equals(_8)===!1,w.scissorValue.copy(P).multiplyScalar(R).floor(),w.scissor=S._scissorTest&&w.scissorValue.equals(_8)===!1,w.scissorValue.width>>=x,w.scissorValue.height>>=x,w.clippingContext||(w.clippingContext=new cC),w.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,v);let D=t.isArrayCamera?QE:KE;t.isArrayCamera?D.setFromArrayCamera(t):(h1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix(h1,t.coordinateSystem,t.reversedDepth));let F=this._renderLists.get(e,t);if(F.begin(),this._projectObject(e,t,0,F,w.clippingContext),F.finish(),this.sortObjects===!0&&F.sort(this._opaqueSort,this._transparentSort,t.reversedDepth),v!==null){this._textures.updateRenderTarget(v,x);let Z=this._textures.get(v);w.textures=Z.textures,w.depthTexture=Z.depthTexture,w.width=Z.width,w.height=Z.height,w.renderTarget=v,w.depth=v.depthBuffer,w.stencil=v.stencilBuffer}else w.textures=null,w.depthTexture=null,w.width=u1.width,w.height=u1.height,w.depth=this.depth,w.stencil=this.stencil;w.width>>=x,w.height>>=x,w.activeCubeFace=p,w.activeMipmapLevel=x,w.occlusionQueryCount=F.occlusionQueryCount,w.scissorValue.max(jf.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,F,w),w.camera=t,this.backend.beginRender(w);let{bundles:N,lightsNode:B,transparentDoublePass:z,transparent:V,opaque:H}=F;return N.length>0&&this._renderBundles(N,u,B),this.opaque===!0&&H.length>0&&this._renderObjects(H,t,u,B),this.transparent===!0&&V.length>0&&this._renderTransparents(V,z,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,p,x),this._renderOutput(v)),u.onAfterRender(this,e,t,v),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 fb(new Ar),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){Kn('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(){Kn('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){Kn('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){Kn('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!==zs,t=this.currentColorSpace!==sn.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:zs}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:sn.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 je("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 x=()=>{u.removeEventListener("dispose",x),o.delete(u),a.deleteForCompute(u),l.delete(u)};u.addEventListener("dispose",x);let v=u.onInitFunction;v!==null&&v.call(u,{renderer:this})}l.updateForCompute(u),a.updateForCompute(u);let f=a.getForCompute(u),p=o.getForCompute(u,f);s.compute(e,u,f,p,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 Kn('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){Kn('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=jf.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=jf.copy(t).floor();else{Ge("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=jf.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?QE:KE;if(!e.frustumCulled||l.intersectsSprite(e)){this.sortObjects===!0&&jf.setFromMatrixPosition(e.matrixWorld).applyMatrix4(h1);let{geometry:c,material:u}=e;u.visible&&r.push(e,c,u,n,jf.z,null,s)}}else if(e.isLineLoop)Ge("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?QE:KE;if(!e.frustumCulled||l.intersectsObject(e)){let{geometry:c,material:u}=e;if(this.sortObjects===!0&&(c.boundingSphere===null&&c.computeBoundingSphere(),jf.copy(c.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(h1)),Array.isArray(u)){let f=c.groups;for(let p=0,x=f.length;p<x;p++){let v=f[p],w=u[v.materialIndex];w&&w.visible&&r.push(e,c,w,n,jf.z,v,s)}}else u.visible&&r.push(e,c,u,n,jf.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 p=e.children;for(let x=0,v=p.length;x<v;x++)this._projectObject(p[x],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=ui;this._renderObjects(t,n,r,s,"backSide");for(let{material:o}of t)o.side=go;this._renderObjects(e,n,r,s);for(let{material:o}of t)o.side=rr}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:p}=e[o];this._currentRenderObjectFunction(l,n,t,c,u,f,r,p,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,p;if(o?(f=e.castShadowNode.rgb,p=e.castShadowNode.a,this.shadowMap.transmitted!==!0&&Kn("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(f=pe(0),p=se(1)),r&&(p=p.mul(nr("map","texture",e).a)),s&&(p=p.mul(e.colorNode.a)),c=Lt(f,p),a){let x=e.maskShadowNode||e.maskNode;c=Ae(([v])=>(x.not().discard(),v))(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,p,x,v,w,S,T,P=this._currentSourceMaterial;if(e.onBeforeRender(this,t,n,r,s,o),s.allowOverride===!0&&t.overrideMaterial!==null){this._currentSourceMaterial=s;let R=t.overrideMaterial;if(u=!0,f=R.isNodeMaterial?R.colorNode:null,p=R.isNodeMaterial?R.depthNode:null,x=R.isNodeMaterial?R.positionNode:null,v=t.overrideMaterial.side,w=R.displacementMap,S=R.displacementScale,T=R.displacementBias,s.positionNode&&s.positionNode.isNode&&(R.positionNode=s.positionNode),R.alphaTest=s.alphaTest,R.alphaMap=s.alphaMap,R.displacementMap=s.displacementMap,R.displacementScale=s.displacementScale,R.displacementBias=s.displacementBias,R.transparent=s.transparent||s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode||s.backdropNode&&s.backdropNode.isNode,R.isShadowPassMaterial){let{colorNode:C,depthNode:L,positionNode:D}=this._getShadowNodes(s);this.shadowMap.type===tc?R.side=s.shadowSide!==null?s.shadowSide:s.side:R.side=s.shadowSide!==null?s.shadowSide:XTe[s.side],C!==null&&(R.colorNode=C),L!==null&&(R.depthNode=L),D!==null&&(R.positionNode=D)}s=R}s.transparent===!0&&s.side===rr&&s.forceSinglePass===!1?(s.side=ui,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=go,this._handleObjectFunction(e,s,t,n,a,o,l,c),s.side=rr):this._handleObjectFunction(e,s,t,n,a,o,l,c),u&&(t.overrideMaterial.colorNode=f,t.overrideMaterial.depthNode=p,t.overrideMaterial.positionNode=x,t.overrideMaterial.side=v,t.overrideMaterial.displacementMap=w,t.overrideMaterial.displacementScale=S,t.overrideMaterial.displacementBias=T),this._currentSourceMaterial=P,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}},hC=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 Xee(i){return i+(i0-i%i0)%i0}var fC=class extends hC{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 Xee(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},dC=class extends fC{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},$Te=0,pC=class extends dC{constructor(e,t){super("UniformBuffer_"+$Te++,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 Xee(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},MB=class extends dC{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%i0,c=l%o,u=l+c;t+=c,u!==0&&i0-u<a&&(t+=i0-u),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/i0)*i0}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);Ge("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 ZTe(n,r,s)===!1&&(this.buffer.set(r,s),YTe(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 YTe(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function ZTe(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}var KTe=0,AC=class extends MB{constructor(e,t){super(e),this.id=KTe++,this.groupNode=t,this.isNodeUniformsGroup=!0}},mC=class extends hC{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}},QTe=0,CB=class extends mC{constructor(e,t){super(e,t),this.id=QTe++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},B1=class extends CB{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()}},gC=class extends B1{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}},_b=class extends B1{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}},gZ={bitcast_int_uint:new Qi("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new Qi("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }"),textureGather:new Qi(`4168+Reason: ${e.reason}`),Ge(t),this._isDeviceLost=!0}_onError(e){let t=`WebGPURenderer: Uncaptured ${e.api} ${e.type}`;e.message&&(t+=`: ${e.message}`),Ge(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:p,opaque:x}=o;this.opaque===!0&&x.length>0&&this._renderObjects(x,s,t,n),this.transparent===!0&&p.length>0&&this._renderTransparents(p,f,s,t,n),this._currentRenderBundle=null,this.backend.finishBundle(a,l),c.version=r.version}else{let{renderObjects:f}=c;for(let p=0,x=f.length;p<x;p++){let v=f[p];this._nodes.needsRefresh(v)&&(this._nodes.updateBefore(v),this._geometries.updateForRender(v),this._nodes.updateForRender(v),this._bindings.updateForRender(v),this._nodes.updateAfter(v))}}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!==zs,r=t!==sn.workingColorSpace;if(n===!1&&r===!1)return null;let{width:s,height:o}=this.getDrawingBufferSize(h1),{depth:a,stencil:l}=this,c=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(c);if(u===void 0){u=new ua(s,o,{depthBuffer:a,stencilBuffer:l,type:this._outputBufferType,format:br,colorSpace:sn.workingColorSpace,generateMipmaps:!1,minFilter:bi,magFilter:bi,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 p=this._outputRenderTarget?this._outputRenderTarget.viewport:c._viewport,x=this._outputRenderTarget?this._outputRenderTarget.scissor:c._scissor,v=this._outputRenderTarget?1:c._pixelRatio,w=this._outputRenderTarget?this._outputRenderTarget.scissorTest:c._scissorTest;return u.viewport.copy(p),u.scissor.copy(x),u.viewport.multiplyScalar(v),u.scissor.multiplyScalar(v),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:_Z,f=this._renderTarget||this._outputRenderTarget,p=this._activeCubeFace,x=this._activeMipmapLevel,v;if(r!==null?(v=r,this.setRenderTarget(v)):v=f,v!==null&&v.depthBuffer===!0){let Z=this._textures.get(v);Z.depthInitialized!==!0&&((this.autoClear===!1||this.autoClear===!0&&this.autoClearDepth===!1)&&this.clearDepth(),Z.depthInitialized=!0)}let w=this._renderContexts.get(v,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,v),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t);let S=this._canvasTarget,T=S._viewport,P=S._scissor,R=S._pixelRatio;v!==null&&(T=v.viewport,P=v.scissor,R=1),this.getDrawingBufferSize(h1),T8.set(0,0,h1.width,h1.height);let C=T.minDepth===void 0?0:T.minDepth,L=T.maxDepth===void 0?1:T.maxDepth;w.viewportValue.copy(T).multiplyScalar(R).floor(),w.viewportValue.width>>=x,w.viewportValue.height>>=x,w.viewportValue.minDepth=C,w.viewportValue.maxDepth=L,w.viewport=w.viewportValue.equals(T8)===!1,w.scissorValue.copy(P).multiplyScalar(R).floor(),w.scissor=S._scissorTest&&w.scissorValue.equals(T8)===!1,w.scissorValue.width>>=x,w.scissorValue.height>>=x,w.clippingContext||(w.clippingContext=new hC),w.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,v);let D=t.isArrayCamera?eM:JE;t.isArrayCamera?D.setFromArrayCamera(t):(f1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix(f1,t.coordinateSystem,t.reversedDepth));let F=this._renderLists.get(e,t);if(F.begin(),this._projectObject(e,t,0,F,w.clippingContext),F.finish(),this.sortObjects===!0&&F.sort(this._opaqueSort,this._transparentSort,t.reversedDepth),v!==null){this._textures.updateRenderTarget(v,x);let Z=this._textures.get(v);w.textures=Z.textures,w.depthTexture=Z.depthTexture,w.width=Z.width,w.height=Z.height,w.renderTarget=v,w.depth=v.depthBuffer,w.stencil=v.stencilBuffer}else w.textures=null,w.depthTexture=null,w.width=h1.width,w.height=h1.height,w.depth=this.depth,w.stencil=this.stencil;w.width>>=x,w.height>>=x,w.activeCubeFace=p,w.activeMipmapLevel=x,w.occlusionQueryCount=F.occlusionQueryCount,w.scissorValue.max(Xf.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,F,w),w.camera=t,this.backend.beginRender(w);let{bundles:N,lightsNode:B,transparentDoublePass:z,transparent:V,opaque:H}=F;return N.length>0&&this._renderBundles(N,u,B),this.opaque===!0&&H.length>0&&this._renderObjects(H,t,u,B),this.transparent===!0&&V.length>0&&this._renderTransparents(V,z,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,p,x),this._renderOutput(v)),u.onAfterRender(this,e,t,v),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 pb(new Ar),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){Kn('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(){Kn('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){Kn('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){Kn('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!==zs,t=this.currentColorSpace!==sn.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:zs}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:sn.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 je("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 x=()=>{u.removeEventListener("dispose",x),o.delete(u),a.deleteForCompute(u),l.delete(u)};u.addEventListener("dispose",x);let v=u.onInitFunction;v!==null&&v.call(u,{renderer:this})}l.updateForCompute(u),a.updateForCompute(u);let f=a.getForCompute(u),p=o.getForCompute(u,f);s.compute(e,u,f,p,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 Kn('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){Kn('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=Xf.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=Xf.copy(t).floor();else{Ge("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=Xf.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?eM:JE;if(!e.frustumCulled||l.intersectsSprite(e)){this.sortObjects===!0&&Xf.setFromMatrixPosition(e.matrixWorld).applyMatrix4(f1);let{geometry:c,material:u}=e;u.visible&&r.push(e,c,u,n,Xf.z,null,s)}}else if(e.isLineLoop)Ge("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?eM:JE;if(!e.frustumCulled||l.intersectsObject(e)){let{geometry:c,material:u}=e;if(this.sortObjects===!0&&(c.boundingSphere===null&&c.computeBoundingSphere(),Xf.copy(c.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(f1)),Array.isArray(u)){let f=c.groups;for(let p=0,x=f.length;p<x;p++){let v=f[p],w=u[v.materialIndex];w&&w.visible&&r.push(e,c,w,n,Xf.z,v,s)}}else u.visible&&r.push(e,c,u,n,Xf.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 p=e.children;for(let x=0,v=p.length;x<v;x++)this._projectObject(p[x],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=hi;this._renderObjects(t,n,r,s,"backSide");for(let{material:o}of t)o.side=go;this._renderObjects(e,n,r,s);for(let{material:o}of t)o.side=rr}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:p}=e[o];this._currentRenderObjectFunction(l,n,t,c,u,f,r,p,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,p;if(o?(f=e.castShadowNode.rgb,p=e.castShadowNode.a,this.shadowMap.transmitted!==!0&&Kn("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(f=pe(0),p=se(1)),r&&(p=p.mul(nr("map","texture",e).a)),s&&(p=p.mul(e.colorNode.a)),c=Lt(f,p),a){let x=e.maskShadowNode||e.maskNode;c=Ae(([v])=>(x.not().discard(),v))(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,p,x,v,w,S,T,P=this._currentSourceMaterial;if(e.onBeforeRender(this,t,n,r,s,o),s.allowOverride===!0&&t.overrideMaterial!==null){this._currentSourceMaterial=s;let R=t.overrideMaterial;if(u=!0,f=R.isNodeMaterial?R.colorNode:null,p=R.isNodeMaterial?R.depthNode:null,x=R.isNodeMaterial?R.positionNode:null,v=t.overrideMaterial.side,w=R.displacementMap,S=R.displacementScale,T=R.displacementBias,s.positionNode&&s.positionNode.isNode&&(R.positionNode=s.positionNode),R.alphaTest=s.alphaTest,R.alphaMap=s.alphaMap,R.displacementMap=s.displacementMap,R.displacementScale=s.displacementScale,R.displacementBias=s.displacementBias,R.transparent=s.transparent||s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode||s.backdropNode&&s.backdropNode.isNode,R.isShadowPassMaterial){let{colorNode:C,depthNode:L,positionNode:D}=this._getShadowNodes(s);this.shadowMap.type===nc?R.side=s.shadowSide!==null?s.shadowSide:s.side:R.side=s.shadowSide!==null?s.shadowSide:YTe[s.side],C!==null&&(R.colorNode=C),L!==null&&(R.depthNode=L),D!==null&&(R.positionNode=D)}s=R}s.transparent===!0&&s.side===rr&&s.forceSinglePass===!1?(s.side=hi,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=go,this._handleObjectFunction(e,s,t,n,a,o,l,c),s.side=rr):this._handleObjectFunction(e,s,t,n,a,o,l,c),u&&(t.overrideMaterial.colorNode=f,t.overrideMaterial.depthNode=p,t.overrideMaterial.positionNode=x,t.overrideMaterial.side=v,t.overrideMaterial.displacementMap=w,t.overrideMaterial.displacementScale=S,t.overrideMaterial.displacementBias=T),this._currentSourceMaterial=P,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}},dC=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 Yee(i){return i+(r0-i%r0)%r0}var pC=class extends dC{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 Yee(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},AC=class extends pC{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},ZTe=0,mC=class extends AC{constructor(e,t){super("UniformBuffer_"+ZTe++,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 Yee(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},DB=class extends AC{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%r0,c=l%o,u=l+c;t+=c,u!==0&&r0-u<a&&(t+=r0-u),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/r0)*r0}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);Ge("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 QTe(n,r,s)===!1&&(this.buffer.set(r,s),KTe(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 KTe(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function QTe(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}var JTe=0,gC=class extends DB{constructor(e,t){super(e),this.id=JTe++,this.groupNode=t,this.isNodeUniformsGroup=!0}},_C=class extends dC{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}},e3e=0,FB=class extends _C{constructor(e,t){super(e,t),this.id=e3e++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},U1=class extends FB{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()}},xC=class extends U1{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}},yb=class extends U1{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}},xZ={bitcast_int_uint:new Qi("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new Qi("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }"),textureGather:new Qi(`41694169 vec4 tsl_textureGather( const int comp, sampler2D map, vec2 coord, ivec2 offset, bool flipY ) {41704170 if ( flipY ) offset.y = - offset.y;41714171 vec2 size = vec2( textureSize( map, 0 ) );
@@ -4221,7 +4221,7 @@ vec4 tsl_textureGatherCompare_array( sampler2DArrayShadow map, vec3 coord, ivec2
42214221 );42224222 return flipY ? ret.wzyx : ret;42234223 }4224-`)},JTe={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"},_Z={low:"lowp",medium:"mediump",high:"highp"},xZ={swizzleAssign:!0,storageBuffer:!1},yZ={perspective:"smooth",linear:"noperspective"},vZ={centroid:"centroid"},bZ=`4224+`)},t3e={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"},yZ={low:"lowp",medium:"mediump",high:"highp"},vZ={swizzleAssign:!0,storageBuffer:!1},bZ={perspective:"smooth",linear:"noperspective"},wZ={centroid:"centroid"},SZ=`42254225 precision highp float;42264226 precision highp int;42274227 precision highp sampler2D;
@@ -4242,17 +4242,17 @@ precision highp isampler2DArray;
42424242 precision highp sampler2DShadow;42434243 precision highp sampler2DArrayShadow;42444244 precision highp samplerCubeShadow;4245-`,RB=class extends oC{constructor(e,t){super(e,t,new xB),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==qo}_include(e){let t=gZ[e];return t.build(this),this.addInclude(t),t}getMethod(e){return gZ[e]!==void 0&&this._include(e),JTe[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(", ")} ) {4245+`,OB=class extends lC{constructor(e,t){super(e,t,new EB),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==qo}_include(e){let t=xZ[e];return t.build(this),this.addInclude(t),t}getMethod(e){return xZ[e]!==void 0&&this._include(e),t3e[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(", ")} ) {42464246 42474247 ${n.vars}42484248 42494249 ${n.code}42504250 return ${n.result};42514251 4252-}`}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?Yu:Uf;s===2?a=o?Zu:Ts:s===3?a=o?y2:Bf:s===4&&(a=o?cp:vr);let l={Float32Array:Zi,Uint8Array:zi,Uint16Array:ja,Uint32Array:pi,Int8Array:Xu,Int16Array:$u,Int32Array:Dr,Uint8ClampedArray:zi},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,p=new n.constructor(f);p.set(n,0),t.array=p;let x=new SA(t.array,c,u,a,l[t.array.constructor.name]||Zi);x.needsUpdate=!0,x.isPBOTexture=!0;let v=new xc(x,null,null);v.setPrecision("high"),t.pboNode=v,t.pbo=v.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),p=f.propertySizeName;p===void 0&&(p=c+"Size",this.getVarFromNode(t,p,"uint"),this.addLineFlowCode(`${p} = uint( textureSize( ${o}, 0 ).x )`,e),f.propertySizeName=p);let{itemSize:x}=r,v="."+zm.join("").slice(0,x),w=`ivec2(${a} % ${p}, ${a} / ${p})`,S=this.generateTextureLoad(null,o,w,"0",null,null),T="vec4";r.pbo.type===pi?T="uvec4":r.pbo.type===Dr&&(T="ivec4"),this.addLineFlowCode(`${c} = ${T}(${S})${v}`,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} ) )`;Ge(`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===pi?f="u":u.type===Dr&&(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,p=f>0?f:"";a=`${c.name} {4252+}`}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?Ku:kf;s===2?a=o?Qu:Ms:s===3?a=o?b2:Uf:s===4&&(a=o?up:br);let l={Float32Array:Zi,Uint8Array:zi,Uint16Array:Xa,Uint32Array:Ai,Int8Array:Yu,Int16Array:Zu,Int32Array:Dr,Uint8ClampedArray:zi},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,p=new n.constructor(f);p.set(n,0),t.array=p;let x=new EA(t.array,c,u,a,l[t.array.constructor.name]||Zi);x.needsUpdate=!0,x.isPBOTexture=!0;let v=new yc(x,null,null);v.setPrecision("high"),t.pboNode=v,t.pbo=v.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),p=f.propertySizeName;p===void 0&&(p=c+"Size",this.getVarFromNode(t,p,"uint"),this.addLineFlowCode(`${p} = uint( textureSize( ${o}, 0 ).x )`,e),f.propertySizeName=p);let{itemSize:x}=r,v="."+qm.join("").slice(0,x),w=`ivec2(${a} % ${p}, ${a} / ${p})`,S=this.generateTextureLoad(null,o,w,"0",null,null),T="vec4";r.pbo.type===Ai?T="uvec4":r.pbo.type===Dr&&(T="ivec4"),this.addLineFlowCode(`${c} = ${T}(${S})${v}`,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} ) )`;Ge(`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===Ai?f="u":u.type===Dr&&(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,p=f>0?f:"";a=`${c.name} {42534253 ${u} ${o.name}[${p}];42544254 };4255-`}else{let c=o.groupNode.name;if(r[c]===void 0){let u=this.uniformGroups[c];if(u!==void 0){let f=[];for(let p of u.uniforms){let x=p.getType(),v=this.getVectorType(x),w=p.nodeUniform.node.precision,S=`${v} ${p.name};`;w!==null&&(S=_Z[w]+" "+S),f.push(" "+S)}r[c]=f}}l=!0}if(!l){let c=o.node.precision;c!==null&&(a=_Z[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(`4255+`}else{let c=o.groupNode.name;if(r[c]===void 0){let u=this.uniformGroups[c];if(u!==void 0){let f=[];for(let p of u.uniforms){let x=p.getType(),v=this.getVectorType(x),w=p.nodeUniform.node.precision,S=`${v} ${p.name};`;w!==null&&(S=yZ[w]+" "+S),f.push(" "+S)}r[c]=f}}l=!0}if(!l){let c=o.node.precision;c!==null&&(a=yZ[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(`42564256 `))+`42574257 `}return s+=n.join(`42584258 `),s}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==Dr){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};
@@ -4265,14 +4265,14 @@ ${n.code}
42654265 `)+`42664266 42674267 `+t.join(`4268-`)}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=yZ[r.interpolationType]||r.interpolationType,a=vZ[r.interpolationSampling]||"";t+=`${o} ${a} out ${s} ${r.name};4268+`)}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=bZ[r.interpolationType]||r.interpolationType,a=wZ[r.interpolationSampling]||"";t+=`${o} ${a} out ${s} ${r.name};42694269 `}else{let o=s.includes("int")||s.includes("uv")||s.includes("iv")?"flat ":"";t+=`${o}out ${s} ${r.name};42704270 `}else t+=`${s} ${r.name};4271-`}else if(e==="fragment"){for(let r of n)if(r.needsInterpolation){let s=this.getType(r.type);if(r.interpolationType){let o=yZ[r.interpolationType]||r.interpolationType,a=vZ[r.interpolationSampling]||"";t+=`${o} ${a} in ${s} ${r.name};4271+`}else if(e==="fragment"){for(let r of n)if(r.needsInterpolation){let s=this.getType(r.type);if(r.interpolationType){let o=bZ[r.interpolationType]||r.interpolationType,a=wZ[r.interpolationSampling]||"";t+=`${o} ${a} in ${s} ${r.name};42724272 `}else{let o=s.includes("int")||s.includes("uv")||s.includes("iv")?"flat ":"";t+=`${o}in ${s} ${r.name};42734273 `}}}for(let r of this.builtins[e])t+=`${r};42744274 `;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(){Ge("GLSLNodeBuilder: WebGLBackend does not support the subgroupSize node")}getInvocationSubgroupIndex(){Ge("GLSLNodeBuilder: WebGLBackend does not support the invocationSubgroupIndex node")}getSubgroupIndex(){Ge("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(`4275-`)}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=xZ[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)}xZ[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};4275+`)}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=vZ[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)}vZ[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};42764276 `)}return t}_getGLSLUniformStruct(e,t){return`42774277 layout( std140 ) uniform ${e} {42784278 ${t}
@@ -4284,7 +4284,7 @@ ${this.getSignature()}
42844284 ${e.extensions}42854285 42864286 // precision4287-${bZ}4287+${SZ}42884288 42894289 // structs42904290 ${e.structs}
@@ -4323,7 +4323,7 @@ ${this.getSignature()}
43234323 ${e.extensions}43244324 43254325 // precision4326-${bZ}4326+${SZ}43274327 43284328 // structs43294329 ${e.structs}
@@ -4354,7 +4354,7 @@ void main() {
43544354 `,a===s&&t!=="compute"&&(n+=`// result43554355 `,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+=`43564356 uniform uint nodeUniformDrawId;4357-`)}}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 B1(s.name,s.node,l),u.push(a);else if(t==="cubeTexture"||t==="cubeDepthTexture")a=new gC(s.name,s.node,l),u.push(a);else if(t==="texture3D")a=new _b(s.name,s.node,l),u.push(a);else if(t==="buffer"){s.name=`buffer${e.id}`;let f=this.getSharedDataFromNode(e),p=f.buffer;p===void 0&&(e.name=`NodeBuffer_${e.id}`,p=new pC(e,l),p.name=e.name,f.buffer=p),u.push(p),a=p}else{let f=this.uniformGroups[c];f===void 0?(f=new AC(c,l),this.uniformGroups[c]=f,u.push(f)):u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let p=a.name;f.uniforms.some(v=>v.name===p)||f.addUniform(a)}o.uniformGPU=a}return s}},x8=null,f1=null,_C=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[rc.RENDER]:null,[rc.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:")?rc.COMPUTE:rc.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){Kn("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 x8=x8||new Oe,this.renderer.getDrawingBufferSize(x8)}setScissorTest(){}getClearColor(){let e=this.renderer;return f1=f1||new cb,e.getClearColor(f1),f1.getRGB(f1),f1}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:n3(),"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(){}},e3e=0,PB=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}},IB=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===Dr,id:e3e++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let p=this._createBuffer(r,t,s,o);f=new PB(f,p)}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 p=()=>{t.buffer=null,t._mapped=!1,t.removeEventListener("release",p),t.removeEventListener("dispose",p)};t.addEventListener("release",p),t.addEventListener("dispose",p),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}},Ov,Xf,NB=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;Ov={[Gs]:e.FUNC_ADD,[n2]:e.FUNC_SUBTRACT,[i2]:e.FUNC_REVERSE_SUBTRACT},Xf={[Wc]:e.ZERO,[r2]:e.ONE,[s2]:e.SRC_COLOR,[jd]:e.SRC_ALPHA,[h2]:e.SRC_ALPHA_SATURATE,[c2]:e.DST_COLOR,[a2]:e.DST_ALPHA,[o2]:e.ONE_MINUS_SRC_COLOR,[Xd]:e.ONE_MINUS_SRC_ALPHA,[u2]:e.ONE_MINUS_DST_COLOR,[l2]:e.ONE_MINUS_DST_ALPHA};let t=e.getParameter(e.SCISSOR_BOX),n=e.getParameter(e.VIEWPORT);this.currentScissor=new gn().fromArray(t),this.currentViewport=new gn().fromArray(n),this._tempVec4=new gn}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!==jT?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===e2?t.cullFace(t.BACK):e===XT?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){Kn("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===t2?l=n:c.blending!==Yr&&(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===Of){let u=t.blendSrcAlpha!==null?t.blendSrcAlpha:o,f=t.blendDstAlpha!==null?t.blendDstAlpha:a,p=t.blendEquationAlpha!==null?t.blendEquationAlpha:l;r.blendEquationSeparateiOES(e,Ov[l],Ov[p]),r.blendFuncSeparateiOES(e,Xf[o],Xf[a],Xf[u],Xf[f])}else if(r.blendEquationSeparateiOES(e,n.FUNC_ADD,n.FUNC_ADD),c)switch(s){case os:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case qu:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case Hu:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Wu: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 os:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case qu:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Hu:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Wu: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===Yr){this.currentBlendingEnabled===!0&&(this.disable(c.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(c.BLEND),this.currentBlendingEnabled=!0),e!==Of){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==Gs||this.currentBlendEquationAlpha!==Gs)&&(c.blendEquation(c.FUNC_ADD),this.currentBlendEquation=Gs,this.currentBlendEquationAlpha=Gs),l)switch(e){case os:c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case qu:c.blendFunc(c.ONE,c.ONE);break;case Hu:c.blendFuncSeparate(c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ZERO,c.ONE);break;case Wu:c.blendFuncSeparate(c.DST_COLOR,c.ONE_MINUS_SRC_ALPHA,c.ZERO,c.ONE);break;default:Ge("WebGLState: Invalid blending: ",e);break}else switch(e){case os:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case qu:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE,c.ONE,c.ONE);break;case Hu:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Wu:Ge("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ge("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(Ov[t],Ov[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(c.blendFuncSeparate(Xf[n],Xf[r],Xf[o],Xf[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=E2[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case dA:t.depthFunc(t.NEVER);break;case pA:t.depthFunc(t.ALWAYS);break;case AA:t.depthFunc(t.LESS);break;case ku:t.depthFunc(t.LEQUAL);break;case mA:t.depthFunc(t.EQUAL);break;case gA:t.depthFunc(t.GEQUAL);break;case _A:t.depthFunc(t.GREATER);break;case xA: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===rr?this.disable(r.CULL_FACE):this.enable(r.CULL_FACE);let s=e.side===ui;t&&(s=!s),this.setFlipSided(s),e.blending===os&&e.transparent===!1?this.setBlending(Yr):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)}},LB=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=qo){let{gl:n,extensions:r}=this,s,o=sn.getTransfer(t);if(e===zi)return n.UNSIGNED_BYTE;if(e===OA)return n.UNSIGNED_SHORT_4_4_4_4;if(e===BA)return n.UNSIGNED_SHORT_5_5_5_1;if(e===UA)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===kA)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===Xu)return n.BYTE;if(e===$u)return n.SHORT;if(e===ja)return n.UNSIGNED_SHORT;if(e===Dr)return n.INT;if(e===pi)return n.UNSIGNED_INT;if(e===Zi)return n.FLOAT;if(e===Di)return n.HALF_FLOAT;if(e===R_)return n.ALPHA;if(e===Bf)return n.RGB;if(e===vr)return n.RGBA;if(e===vs)return n.DEPTH_COMPONENT;if(e===eo)return n.DEPTH_STENCIL;if(e===Uf)return n.RED;if(e===Yu)return n.RED_INTEGER;if(e===Ts)return n.RG;if(e===Zu)return n.RG_INTEGER;if(e===cp)return n.RGBA_INTEGER;if(e===Ku||e===Qu||e===Ju||e===eh)if(o===Bt)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===Ku)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Qu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===Ju)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===eh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===Ku)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Qu)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Ju)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===eh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===GA||e===zA||e===VA||e===qA)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===GA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===zA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===VA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===qA)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===up||e===hp||e===fp||e===dp||e===pp||e===th||e===Ap)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===up||e===hp)return o===Bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===fp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===dp)return s.COMPRESSED_R11_EAC;if(e===pp)return s.COMPRESSED_SIGNED_R11_EAC;if(e===th)return s.COMPRESSED_RG11_EAC;if(e===Ap)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===mp||e===gp||e===_p||e===xp||e===yp||e===vp||e===bp||e===wp||e===Sp||e===Tp||e===Ep||e===Mp||e===Cp||e===Rp)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===gp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===_p)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===xp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===yp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===vp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===bp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===wp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===Sp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===Tp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===Ep)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===Mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===Cp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===Rp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===Pp||e===Ip||e===Np)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===Pp)return o===Bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===Ip)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===Np)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===Lp||e===Dp||e===nh||e===Fp)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===Lp)return s.COMPRESSED_RED_RGTC1_EXT;if(e===Dp)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===nh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===Fp)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===Vo?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()})}},wZ=!1,JE,y8,SZ,DB=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,wZ===!1&&(this._init(),wZ=!0)}_init(){let e=this.gl;JE={[Mf]:e.REPEAT,[Go]:e.CLAMP_TO_EDGE,[Cf]:e.MIRRORED_REPEAT},y8={[yi]:e.NEAREST,[x2]:e.NEAREST_MIPMAP_NEAREST,[ic]:e.NEAREST_MIPMAP_LINEAR,[bi]:e.LINEAR,[lp]:e.LINEAR_MIPMAP_NEAREST,[xo]:e.LINEAR_MIPMAP_LINEAR},SZ={[b2]:e.NEVER,[T2]:e.ALWAYS,[P_]:e.LESS,[ih]:e.LEQUAL,[w2]:e.EQUAL,[jc]:e.GEQUAL,[HA]:e.GREATER,[S2]: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];je("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let c=null;r&&(c=l.get("EXT_texture_norm16"),c||je("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?Yd:sn.getTransfer(s);n===a.FLOAT&&(u=a.RGB32F),n===a.HALF_FLOAT&&(u=a.RGB16F),n===a.UNSIGNED_BYTE&&(u=f===Bt?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?Yd:sn.getTransfer(s);n===a.FLOAT&&(u=a.RGBA32F),n===a.HALF_FLOAT&&(u=a.RGBA16F),n===a.UNSIGNED_BYTE&&(u=f===Bt?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=sn.getPrimaries(sn.workingColorSpace),l=t.colorSpace===qo?null:sn.getPrimaries(t.colorSpace),c=t.colorSpace===qo||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,JE[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,JE[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,JE[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,y8[t.magFilter]);let u=t.mipmaps!==void 0&&t.mipmaps.length>0,f=t.minFilter===bi&&u?xo:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,y8[f]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,SZ[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===yi||t.minFilter!==ic&&t.minFilter!==xo||t.type===Zi&&r.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){let p=r.get("EXT_texture_filter_anisotropic");n.texParameterf(e,p.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:p,depth:x}=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,p,x):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,u,c,f,p,x):e.isVideoTexture||n.texStorage2D(o,u,c,f,p)}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,p=t.image;for(let x=0;x<f.length;x++){let v=f[x];e.isCompressedArrayTexture?e.format!==n.RGBA?l!==null?n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,x,0,0,0,v.width,v.height,p.depth,l,v.data):je("WebGLBackend: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texSubImage3D(n.TEXTURE_2D_ARRAY,x,0,0,0,v.width,v.height,p.depth,l,c,v.data):l!==null?n.compressedTexSubImage2D(n.TEXTURE_2D,x,0,0,v.width,v.height,l,v.data):je("WebGLBackend: Unsupported compressed texture format")}}else if(e.isCubeTexture){let f=t.images,p=e.mipmaps;for(let x=0;x<6;x++){let v=eM(f[x]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,0,0,r,s,l,c,v);for(let w=0;w<p.length;w++){let S=p[w],T=eM(S.images[x]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+x,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 p=M2(f.width,f.height,e.format,e.type);for(let x of e.layerUpdates){let v=f.data.subarray(x*p/f.data.BYTES_PER_ELEMENT,(x+1)*p/f.data.BYTES_PER_ELEMENT);n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,x,f.width,f.height,1,l,c,v)}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 p=0,x=f.length;p<x;p++){let v=f[p],w=eM(v);n.texSubImage2D(a,p,0,0,v.width,v.height,l,c,w)}else{let p=eM(t.image);n.texSubImage2D(a,0,0,0,r,s,l,c,p)}}}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:p,glFormat:x}=l.get(t);c.bindTexture(f,u);let v,w,S,T,P,R,C,L,D,F=e.isCompressedTexture?e.mipmaps[o]:e.image;if(n!==null)v=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,P=n.min.y,R=n.isBox3?n.min.z:0;else{let j=Math.pow(2,-s);v=Math.floor(F.width*j),w=Math.floor(F.height*j),e.isDataArrayTexture||e.isArrayTexture?S=F.depth:e.isData3DTexture?S=Math.floor(F.depth*j):S=1,T=0,P=0,R=0}r!==null?(C=r.x,L=r.y,D=r.z):(C=0,L=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 N=c.getParameter(a.UNPACK_ROW_LENGTH),B=c.getParameter(a.UNPACK_IMAGE_HEIGHT),z=c.getParameter(a.UNPACK_SKIP_PIXELS),V=c.getParameter(a.UNPACK_SKIP_ROWS),H=c.getParameter(a.UNPACK_SKIP_IMAGES);c.pixelStorei(a.UNPACK_ROW_LENGTH,F.width),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,F.height),c.pixelStorei(a.UNPACK_SKIP_PIXELS,T),c.pixelStorei(a.UNPACK_SKIP_ROWS,P),c.pixelStorei(a.UNPACK_SKIP_IMAGES,R);let Z=e.isDataArrayTexture||e.isData3DTexture||t.isArrayTexture,J=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isDepthTexture){let j=l.get(e),K=l.get(t),ee=l.get(j.renderTarget),ae=l.get(K.renderTarget),ce=ee.framebuffers[j.cacheKey],de=ae.framebuffers[K.cacheKey],ve=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,Ie=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,ce),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,de);for(let Qe=0;Qe<S;Qe++)Z&&(a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,j.textureGPU,s,R+Qe),a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+Qe)),a.blitFramebuffer(T,P,v,w,C,L,v,w,a.DEPTH_BUFFER_BIT,a.NEAREST);c.bindFramebuffer(a.READ_FRAMEBUFFER,ve),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,Ie)}else if(s!==0||e.isRenderTargetTexture||l.has(e)){let j=l.get(e);this._srcFramebuffer===null&&(this._srcFramebuffer=a.createFramebuffer()),this._dstFramebuffer===null&&(this._dstFramebuffer=a.createFramebuffer());let K=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,ee=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,this._srcFramebuffer),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,this._dstFramebuffer);for(let ae=0;ae<S;ae++)Z?a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,j.textureGPU,s,R+ae):a.framebufferTexture2D(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,j.textureGPU,s),J?a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+ae):a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,u,o),s!==0?a.blitFramebuffer(T,P,v,w,C,L,v,w,a.COLOR_BUFFER_BIT,a.NEAREST):J?a.copyTexSubImage3D(f,o,C,L,D+ae,T,P,v,w):a.copyTexSubImage2D(f,o,C,L,T,P,v,w);c.bindFramebuffer(a.READ_FRAMEBUFFER,K),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,ee)}else J?e.isDataTexture||e.isData3DTexture?a.texSubImage3D(f,o,C,L,D,v,w,S,x,p,F.data):t.isCompressedArrayTexture?a.compressedTexSubImage3D(f,o,C,L,D,v,w,S,x,F.data):a.texSubImage3D(f,o,C,L,D,v,w,S,x,p,F):e.isDataTexture?a.texSubImage2D(a.TEXTURE_2D,o,C,L,v,w,x,p,F.data):e.isCompressedTexture?a.compressedTexSubImage2D(a.TEXTURE_2D,o,C,L,F.width,F.height,x,F.data):a.texSubImage2D(a.TEXTURE_2D,o,C,L,v,w,x,p,F);c.pixelStorei(a.UNPACK_ROW_LENGTH,N),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,B),c.pixelStorei(a.UNPACK_SKIP_PIXELS,z),c.pixelStorei(a.UNPACK_SKIP_ROWS,V),c.pixelStorei(a.UNPACK_SKIP_IMAGES,H),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,p=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(f){let x=a!==0||l!==0,v,w;if(e.isDepthTexture===!0?(v=r.DEPTH_BUFFER_BIT,w=r.DEPTH_ATTACHMENT,t.stencil&&(v|=r.STENCIL_BUFFER_BIT)):(v=r.COLOR_BUFFER_BIT,w=r.COLOR_ATTACHMENT0),x){let S=this.backend.get(t.renderTarget),T=S.framebuffers[t.getCacheKey()],P=S.msaaFrameBuffer;s.bindFramebuffer(r.DRAW_FRAMEBUFFER,T),s.bindFramebuffer(r.READ_FRAMEBUFFER,P);let R=p-l-u;r.blitFramebuffer(a,R,a+c,R+u,a,R,a+c,R+u,v,r.NEAREST),s.bindFramebuffer(r.READ_FRAMEBUFFER,T),s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,R,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,v,r.NEAREST),r.deleteFramebuffer(S)}}else s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,p-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 p=s.DEPTH_COMPONENT24;r===!0?this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(s.RENDERBUFFER,o.samples,p,u,f):n>0?(a&&a.isDepthTexture&&a.type===s.FLOAT&&(p=s.DEPTH_COMPONENT32F),s.renderbufferStorageMultisample(s.RENDERBUFFER,n,p,u,f)):s.renderbufferStorage(s.RENDERBUFFER,p,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),p=l.createFramebuffer();a.state.bindFramebuffer(l.READ_FRAMEBUFFER,p);let x=e.isCubeTexture?l.TEXTURE_CUBE_MAP_POSITIVE_X+o:l.TEXTURE_2D;l.framebufferTexture2D(l.READ_FRAMEBUFFER,l.COLOR_ATTACHMENT0,x,c,0);let v=this._getTypedArrayType(f),w=this._getBytesPerTexel(f,u),T=r*s*w,P=l.createBuffer();l.bindBuffer(l.PIXEL_PACK_BUFFER,P),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 R=new v(T/v.BYTES_PER_ELEMENT);return l.bindBuffer(l.PIXEL_PACK_BUFFER,P),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,R),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),a.state.bindFramebuffer(l.READ_FRAMEBUFFER,null),l.deleteFramebuffer(p),R}_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 eM(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 FB=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)}},OB=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}},TZ={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"},BB=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)}}},xC=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&&(je(`TimestampQueryPool: No timestamp available for uid ${e}.`),t=0),t}hasTimestampQuery(e){return this.timestamps.has(e)}allocateQueriesForContext(){}async resolveQueriesAsync(){}dispose(){}},UB=class extends xC{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){je("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 Kn(`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){Ge("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){Ge("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 Ge("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){Ge("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}}},yC=class extends _C{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 FB(this),this.capabilities=new OB(this),this.attributeUtils=new IB(this),this.textureUtils=new DB(this),this.bufferRenderer=new BB(this),this.state=new NB(this),this.utils=new LB(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:(je("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 mo}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&&je("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 UB(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(rc.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(rc.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(),p=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 x=0;x<r.textures.length;x++)x===0?a.clearBufferfv(a.COLOR,x,[u.r,u.g,u.b,u.a]):a.clearBufferfv(a.COLOR,x,[0,0,0,1]);t&&n?a.clearBufferfi(a.DEPTH_STENCIL,0,f,p):t?a.clearBufferfv(a.DEPTH,0,[f]):n&&a.clearBufferiv(a.STENCIL,0,[p]),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(rc.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),p=this.vaoCache[f];p===void 0?this.vaoCache[f]=this._createVao(u):o.setVertexState(p),o.useProgram(l),this._bindUniforms(n);let x=this._getTransformFeedback(c);a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,x),a.beginTransformFeedback(a.POINTS),s=s!==null?s:t.count,Array.isArray(s)?(Kn("WebGLBackend.compute(): The count parameter must be a single number, not an array."),s=s[0]):s&&typeof s=="object"&&s.isIndirectStorageBufferAttribute&&(Kn("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 v=0;v<c.length;v++){let w=c[v];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(rc.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 p=0;p<f;p++)a.uniform1ui(l,p),t.render(c[p],u[p])}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 p=t.isMesh&&t.matrixWorld.determinantAffine()<0;c.setMaterial(r,p,o),s.mrt!==null&&s.textures!==null&&c.setMRTBlending(s.textures,s.mrt,r),c.useProgram(a);let x=e.getAttributes(),v=this.get(x),w=v.vaoGPU;if(w===void 0){let F=this._getVaoKey(x);w=this.vaoCache[F],w===void 0&&(w=this._createVao(x),this.vaoCache[F]=w,v.vaoGPU=w)}let S=e.getIndex(),T=S!==null?this.get(S).bufferGPU:null;c.setVertexState(w,T);let P=u.lastOcclusionObject;if(P!==t&&P!==void 0){if(P!==null&&P.occlusionTest===!0&&(l.endQuery(l.ANY_SAMPLES_PASSED),u.occlusionQueryIndex++),t.occlusionTest===!0){let F=l.createQuery();l.beginQuery(l.ANY_SAMPLES_PASSED,F),u.occlusionQueries[u.occlusionQueryIndex]=F,u.occlusionQueryObjects[u.occlusionQueryIndex]=t}u.lastOcclusionObject=t}let R=this.bufferRenderer;t.isPoints?R.mode=l.POINTS:t.isLineSegments?R.mode=l.LINES:t.isLine?R.mode=l.LINE_STRIP:t.isLineLoop?R.mode=l.LINE_LOOP:r.wireframe===!0?(c.setLineWidth(r.wireframeLinewidth*this.renderer.getPixelRatio()),R.mode=l.LINES):R.mode=l.TRIANGLES;let{vertexCount:C,instanceCount:L}=f,{firstVertex:D}=f;if(R.object=t,S!==null){D*=S.array.BYTES_PER_ELEMENT;let F=this.get(S);R.index=S.count,R.type=F.type}else R.index=0;if(e.camera.isArrayCamera===!0&&e.camera.cameras.length>0&&e.camera.isMultiViewCamera===!1){let F=this.get(e.camera),N=e.camera.cameras,B=e.getBindingGroup("cameraIndex").bindings[0];if(F.indexesGPU===void 0||F.indexesGPU.length!==N.length){let j=new Uint32Array([0,0,0,0]),K=[];for(let ee=0,ae=N.length;ee<ae;ee++){let ce=l.createBuffer();j[0]=ee,l.bindBuffer(l.UNIFORM_BUFFER,ce),l.bufferData(l.UNIFORM_BUFFER,j,l.STATIC_DRAW),K.push(ce)}F.indexesGPU=K}let z=0;e:for(let j of e.getBindings())for(let K of j.bindings){if(K===B)break e;(K.isUniformsGroup||K.isUniformBuffer)&&z++}let V=this.renderer.getPixelRatio(),H=this._currentContext.renderTarget,Z=this._isRenderCameraDepthArray(this._currentContext),J=this._currentContext.activeCubeFace;if(Z){let j=this.get(H.depthTexture);if(j.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){j.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;let{stencilBuffer:K}=H;for(let ee=0,ae=N.length;ee<ae;ee++)this.renderer._activeCubeFace=ee,this._currentContext.activeCubeFace=ee,this._setFramebuffer(this._currentContext),this.clear(!1,!0,K,this._currentContext,!1,!1);this.renderer._activeCubeFace=J,this._currentContext.activeCubeFace=J}}for(let j=0,K=N.length;j<K;j++){let ee=N[j];if(t.layers.test(ee.layers)){Z&&(this.renderer._activeCubeFace=j,this._currentContext.activeCubeFace=j,this._setFramebuffer(this._currentContext));let ae=ee.viewport;if(ae!==void 0){let ce=ae.x*V,de=ae.y*V,ve=ae.width*V,Ie=ae.height*V;c.viewport(Math.floor(ce),Math.floor(e.context.height-Ie-de),Math.floor(ve),Math.floor(Ie))}c.bindBufferBase(l.UNIFORM_BUFFER,z,F.indexesGPU[j]),this._draw(t,R,D,C,L,a)}this._currentContext.activeCubeFace=J,this.renderer._activeCubeFace=J}}else this._draw(t,R,D,C,L,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 RB(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 p=this.parallel,x=()=>{n.getProgramParameter(a,p.COMPLETION_STATUS_KHR)?(this._completeCompile(e,r),f()):requestAnimationFrame(x)};x()});t.push(u);return}this._completeCompile(e,r)}_handleSource(e,t){let n=e.split(`4357+`)}}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 U1(s.name,s.node,l),u.push(a);else if(t==="cubeTexture"||t==="cubeDepthTexture")a=new xC(s.name,s.node,l),u.push(a);else if(t==="texture3D")a=new yb(s.name,s.node,l),u.push(a);else if(t==="buffer"){s.name=`buffer${e.id}`;let f=this.getSharedDataFromNode(e),p=f.buffer;p===void 0&&(e.name=`NodeBuffer_${e.id}`,p=new mC(e,l),p.name=e.name,f.buffer=p),u.push(p),a=p}else{let f=this.uniformGroups[c];f===void 0?(f=new gC(c,l),this.uniformGroups[c]=f,u.push(f)):u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let p=a.name;f.uniforms.some(v=>v.name===p)||f.addUniform(a)}o.uniformGPU=a}return s}},E8=null,d1=null,yC=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[sc.RENDER]:null,[sc.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:")?sc.COMPUTE:sc.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){Kn("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 E8=E8||new Oe,this.renderer.getDrawingBufferSize(E8)}setScissorTest(){}getClearColor(){let e=this.renderer;return d1=d1||new hb,e.getClearColor(d1),d1.getRGB(d1),d1}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:r3(),"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(){}},n3e=0,BB=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}},UB=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===Dr,id:n3e++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let p=this._createBuffer(r,t,s,o);f=new BB(f,p)}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 p=()=>{t.buffer=null,t._mapped=!1,t.removeEventListener("release",p),t.removeEventListener("dispose",p)};t.addEventListener("release",p),t.addEventListener("dispose",p),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}},Uv,$f,kB=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;Uv={[Gs]:e.FUNC_ADD,[r2]:e.FUNC_SUBTRACT,[s2]:e.FUNC_REVERSE_SUBTRACT},$f={[jc]:e.ZERO,[o2]:e.ONE,[a2]:e.SRC_COLOR,[Xd]:e.SRC_ALPHA,[d2]:e.SRC_ALPHA_SATURATE,[h2]:e.DST_COLOR,[c2]:e.DST_ALPHA,[l2]:e.ONE_MINUS_SRC_COLOR,[$d]:e.ONE_MINUS_SRC_ALPHA,[f2]:e.ONE_MINUS_DST_COLOR,[u2]:e.ONE_MINUS_DST_ALPHA};let t=e.getParameter(e.SCISSOR_BOX),n=e.getParameter(e.VIEWPORT);this.currentScissor=new gn().fromArray(t),this.currentViewport=new gn().fromArray(n),this._tempVec4=new gn}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!==$T?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===n2?t.cullFace(t.BACK):e===YT?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){Kn("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===i2?l=n:c.blending!==Yr&&(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===Bf){let u=t.blendSrcAlpha!==null?t.blendSrcAlpha:o,f=t.blendDstAlpha!==null?t.blendDstAlpha:a,p=t.blendEquationAlpha!==null?t.blendEquationAlpha:l;r.blendEquationSeparateiOES(e,Uv[l],Uv[p]),r.blendFuncSeparateiOES(e,$f[o],$f[a],$f[u],$f[f])}else if(r.blendEquationSeparateiOES(e,n.FUNC_ADD,n.FUNC_ADD),c)switch(s){case os:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Wu:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case ju:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Xu: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 os:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Wu:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case ju:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Xu: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===Yr){this.currentBlendingEnabled===!0&&(this.disable(c.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(c.BLEND),this.currentBlendingEnabled=!0),e!==Bf){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==Gs||this.currentBlendEquationAlpha!==Gs)&&(c.blendEquation(c.FUNC_ADD),this.currentBlendEquation=Gs,this.currentBlendEquationAlpha=Gs),l)switch(e){case os:c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Wu:c.blendFunc(c.ONE,c.ONE);break;case ju:c.blendFuncSeparate(c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ZERO,c.ONE);break;case Xu:c.blendFuncSeparate(c.DST_COLOR,c.ONE_MINUS_SRC_ALPHA,c.ZERO,c.ONE);break;default:Ge("WebGLState: Invalid blending: ",e);break}else switch(e){case os:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Wu:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE,c.ONE,c.ONE);break;case ju:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Xu:Ge("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ge("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(Uv[t],Uv[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(c.blendFuncSeparate($f[n],$f[r],$f[o],$f[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=C2[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case pA:t.depthFunc(t.NEVER);break;case AA:t.depthFunc(t.ALWAYS);break;case mA:t.depthFunc(t.LESS);break;case Gu:t.depthFunc(t.LEQUAL);break;case gA:t.depthFunc(t.EQUAL);break;case _A:t.depthFunc(t.GEQUAL);break;case xA:t.depthFunc(t.GREATER);break;case yA: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===rr?this.disable(r.CULL_FACE):this.enable(r.CULL_FACE);let s=e.side===hi;t&&(s=!s),this.setFlipSided(s),e.blending===os&&e.transparent===!1?this.setBlending(Yr):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)}},GB=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=qo){let{gl:n,extensions:r}=this,s,o=sn.getTransfer(t);if(e===zi)return n.UNSIGNED_BYTE;if(e===UA)return n.UNSIGNED_SHORT_4_4_4_4;if(e===kA)return n.UNSIGNED_SHORT_5_5_5_1;if(e===GA)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===zA)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===Yu)return n.BYTE;if(e===Zu)return n.SHORT;if(e===Xa)return n.UNSIGNED_SHORT;if(e===Dr)return n.INT;if(e===Ai)return n.UNSIGNED_INT;if(e===Zi)return n.FLOAT;if(e===Di)return n.HALF_FLOAT;if(e===P_)return n.ALPHA;if(e===Uf)return n.RGB;if(e===br)return n.RGBA;if(e===ws)return n.DEPTH_COMPONENT;if(e===eo)return n.DEPTH_STENCIL;if(e===kf)return n.RED;if(e===Ku)return n.RED_INTEGER;if(e===Ms)return n.RG;if(e===Qu)return n.RG_INTEGER;if(e===up)return n.RGBA_INTEGER;if(e===Ju||e===eh||e===th||e===nh)if(o===Bt)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===Ju)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===eh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===th)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===nh)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===Ju)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===eh)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===th)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===nh)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===VA||e===qA||e===HA||e===WA)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===VA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===qA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===HA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===WA)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===hp||e===fp||e===dp||e===pp||e===Ap||e===ih||e===mp)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===hp||e===fp)return o===Bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===dp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===pp)return s.COMPRESSED_R11_EAC;if(e===Ap)return s.COMPRESSED_SIGNED_R11_EAC;if(e===ih)return s.COMPRESSED_RG11_EAC;if(e===mp)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===gp||e===_p||e===xp||e===yp||e===vp||e===bp||e===wp||e===Sp||e===Tp||e===Ep||e===Mp||e===Cp||e===Rp||e===Pp)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===gp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===_p)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===xp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===yp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===vp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===bp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===wp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===Sp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===Tp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===Ep)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===Mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===Cp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===Rp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===Pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===Ip||e===Np||e===Lp)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===Ip)return o===Bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===Np)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===Lp)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===Dp||e===Fp||e===rh||e===Op)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===Dp)return s.COMPRESSED_RED_RGTC1_EXT;if(e===Fp)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===rh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===Op)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===Vo?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()})}},TZ=!1,tM,M8,EZ,zB=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,TZ===!1&&(this._init(),TZ=!0)}_init(){let e=this.gl;tM={[Rf]:e.REPEAT,[Go]:e.CLAMP_TO_EDGE,[Pf]:e.MIRRORED_REPEAT},M8={[yi]:e.NEAREST,[v2]:e.NEAREST_MIPMAP_NEAREST,[rc]:e.NEAREST_MIPMAP_LINEAR,[bi]:e.LINEAR,[cp]:e.LINEAR_MIPMAP_NEAREST,[xo]:e.LINEAR_MIPMAP_LINEAR},EZ={[S2]:e.NEVER,[M2]:e.ALWAYS,[I_]:e.LESS,[sh]:e.LEQUAL,[T2]:e.EQUAL,[Xc]:e.GEQUAL,[jA]:e.GREATER,[E2]: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];je("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let c=null;r&&(c=l.get("EXT_texture_norm16"),c||je("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?Zd:sn.getTransfer(s);n===a.FLOAT&&(u=a.RGB32F),n===a.HALF_FLOAT&&(u=a.RGB16F),n===a.UNSIGNED_BYTE&&(u=f===Bt?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?Zd:sn.getTransfer(s);n===a.FLOAT&&(u=a.RGBA32F),n===a.HALF_FLOAT&&(u=a.RGBA16F),n===a.UNSIGNED_BYTE&&(u=f===Bt?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=sn.getPrimaries(sn.workingColorSpace),l=t.colorSpace===qo?null:sn.getPrimaries(t.colorSpace),c=t.colorSpace===qo||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,tM[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,tM[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,tM[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,M8[t.magFilter]);let u=t.mipmaps!==void 0&&t.mipmaps.length>0,f=t.minFilter===bi&&u?xo:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,M8[f]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,EZ[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===yi||t.minFilter!==rc&&t.minFilter!==xo||t.type===Zi&&r.has("OES_texture_float_linear")===!1)return;if(t.anisotropy>1){let p=r.get("EXT_texture_filter_anisotropic");n.texParameterf(e,p.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:p,depth:x}=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,p,x):e.isData3DTexture?n.texStorage3D(n.TEXTURE_3D,u,c,f,p,x):e.isVideoTexture||n.texStorage2D(o,u,c,f,p)}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,p=t.image;for(let x=0;x<f.length;x++){let v=f[x];e.isCompressedArrayTexture?e.format!==n.RGBA?l!==null?n.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,x,0,0,0,v.width,v.height,p.depth,l,v.data):je("WebGLBackend: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texSubImage3D(n.TEXTURE_2D_ARRAY,x,0,0,0,v.width,v.height,p.depth,l,c,v.data):l!==null?n.compressedTexSubImage2D(n.TEXTURE_2D,x,0,0,v.width,v.height,l,v.data):je("WebGLBackend: Unsupported compressed texture format")}}else if(e.isCubeTexture){let f=t.images,p=e.mipmaps;for(let x=0;x<6;x++){let v=nM(f[x]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,0,0,r,s,l,c,v);for(let w=0;w<p.length;w++){let S=p[w],T=nM(S.images[x]);n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+x,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 p=R2(f.width,f.height,e.format,e.type);for(let x of e.layerUpdates){let v=f.data.subarray(x*p/f.data.BYTES_PER_ELEMENT,(x+1)*p/f.data.BYTES_PER_ELEMENT);n.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,x,f.width,f.height,1,l,c,v)}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 p=0,x=f.length;p<x;p++){let v=f[p],w=nM(v);n.texSubImage2D(a,p,0,0,v.width,v.height,l,c,w)}else{let p=nM(t.image);n.texSubImage2D(a,0,0,0,r,s,l,c,p)}}}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:p,glFormat:x}=l.get(t);c.bindTexture(f,u);let v,w,S,T,P,R,C,L,D,F=e.isCompressedTexture?e.mipmaps[o]:e.image;if(n!==null)v=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,P=n.min.y,R=n.isBox3?n.min.z:0;else{let j=Math.pow(2,-s);v=Math.floor(F.width*j),w=Math.floor(F.height*j),e.isDataArrayTexture||e.isArrayTexture?S=F.depth:e.isData3DTexture?S=Math.floor(F.depth*j):S=1,T=0,P=0,R=0}r!==null?(C=r.x,L=r.y,D=r.z):(C=0,L=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 N=c.getParameter(a.UNPACK_ROW_LENGTH),B=c.getParameter(a.UNPACK_IMAGE_HEIGHT),z=c.getParameter(a.UNPACK_SKIP_PIXELS),V=c.getParameter(a.UNPACK_SKIP_ROWS),H=c.getParameter(a.UNPACK_SKIP_IMAGES);c.pixelStorei(a.UNPACK_ROW_LENGTH,F.width),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,F.height),c.pixelStorei(a.UNPACK_SKIP_PIXELS,T),c.pixelStorei(a.UNPACK_SKIP_ROWS,P),c.pixelStorei(a.UNPACK_SKIP_IMAGES,R);let Z=e.isDataArrayTexture||e.isData3DTexture||t.isArrayTexture,J=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isDepthTexture){let j=l.get(e),K=l.get(t),ee=l.get(j.renderTarget),ae=l.get(K.renderTarget),ce=ee.framebuffers[j.cacheKey],de=ae.framebuffers[K.cacheKey],ve=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,Ie=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,ce),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,de);for(let Qe=0;Qe<S;Qe++)Z&&(a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,j.textureGPU,s,R+Qe),a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+Qe)),a.blitFramebuffer(T,P,v,w,C,L,v,w,a.DEPTH_BUFFER_BIT,a.NEAREST);c.bindFramebuffer(a.READ_FRAMEBUFFER,ve),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,Ie)}else if(s!==0||e.isRenderTargetTexture||l.has(e)){let j=l.get(e);this._srcFramebuffer===null&&(this._srcFramebuffer=a.createFramebuffer()),this._dstFramebuffer===null&&(this._dstFramebuffer=a.createFramebuffer());let K=c.currentBoundFramebuffers[a.READ_FRAMEBUFFER]??null,ee=c.currentBoundFramebuffers[a.DRAW_FRAMEBUFFER]??null;c.bindFramebuffer(a.READ_FRAMEBUFFER,this._srcFramebuffer),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,this._dstFramebuffer);for(let ae=0;ae<S;ae++)Z?a.framebufferTextureLayer(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,j.textureGPU,s,R+ae):a.framebufferTexture2D(a.READ_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,j.textureGPU,s),J?a.framebufferTextureLayer(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,u,o,D+ae):a.framebufferTexture2D(a.DRAW_FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,u,o),s!==0?a.blitFramebuffer(T,P,v,w,C,L,v,w,a.COLOR_BUFFER_BIT,a.NEAREST):J?a.copyTexSubImage3D(f,o,C,L,D+ae,T,P,v,w):a.copyTexSubImage2D(f,o,C,L,T,P,v,w);c.bindFramebuffer(a.READ_FRAMEBUFFER,K),c.bindFramebuffer(a.DRAW_FRAMEBUFFER,ee)}else J?e.isDataTexture||e.isData3DTexture?a.texSubImage3D(f,o,C,L,D,v,w,S,x,p,F.data):t.isCompressedArrayTexture?a.compressedTexSubImage3D(f,o,C,L,D,v,w,S,x,F.data):a.texSubImage3D(f,o,C,L,D,v,w,S,x,p,F):e.isDataTexture?a.texSubImage2D(a.TEXTURE_2D,o,C,L,v,w,x,p,F.data):e.isCompressedTexture?a.compressedTexSubImage2D(a.TEXTURE_2D,o,C,L,F.width,F.height,x,F.data):a.texSubImage2D(a.TEXTURE_2D,o,C,L,v,w,x,p,F);c.pixelStorei(a.UNPACK_ROW_LENGTH,N),c.pixelStorei(a.UNPACK_IMAGE_HEIGHT,B),c.pixelStorei(a.UNPACK_SKIP_PIXELS,z),c.pixelStorei(a.UNPACK_SKIP_ROWS,V),c.pixelStorei(a.UNPACK_SKIP_IMAGES,H),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,p=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(f){let x=a!==0||l!==0,v,w;if(e.isDepthTexture===!0?(v=r.DEPTH_BUFFER_BIT,w=r.DEPTH_ATTACHMENT,t.stencil&&(v|=r.STENCIL_BUFFER_BIT)):(v=r.COLOR_BUFFER_BIT,w=r.COLOR_ATTACHMENT0),x){let S=this.backend.get(t.renderTarget),T=S.framebuffers[t.getCacheKey()],P=S.msaaFrameBuffer;s.bindFramebuffer(r.DRAW_FRAMEBUFFER,T),s.bindFramebuffer(r.READ_FRAMEBUFFER,P);let R=p-l-u;r.blitFramebuffer(a,R,a+c,R+u,a,R,a+c,R+u,v,r.NEAREST),s.bindFramebuffer(r.READ_FRAMEBUFFER,T),s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,R,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,v,r.NEAREST),r.deleteFramebuffer(S)}}else s.bindTexture(r.TEXTURE_2D,o),r.copyTexSubImage2D(r.TEXTURE_2D,0,0,0,a,p-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 p=s.DEPTH_COMPONENT24;r===!0?this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(s.RENDERBUFFER,o.samples,p,u,f):n>0?(a&&a.isDepthTexture&&a.type===s.FLOAT&&(p=s.DEPTH_COMPONENT32F),s.renderbufferStorageMultisample(s.RENDERBUFFER,n,p,u,f)):s.renderbufferStorage(s.RENDERBUFFER,p,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),p=l.createFramebuffer();a.state.bindFramebuffer(l.READ_FRAMEBUFFER,p);let x=e.isCubeTexture?l.TEXTURE_CUBE_MAP_POSITIVE_X+o:l.TEXTURE_2D;l.framebufferTexture2D(l.READ_FRAMEBUFFER,l.COLOR_ATTACHMENT0,x,c,0);let v=this._getTypedArrayType(f),w=this._getBytesPerTexel(f,u),T=r*s*w,P=l.createBuffer();l.bindBuffer(l.PIXEL_PACK_BUFFER,P),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 R=new v(T/v.BYTES_PER_ELEMENT);return l.bindBuffer(l.PIXEL_PACK_BUFFER,P),l.getBufferSubData(l.PIXEL_PACK_BUFFER,0,R),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),a.state.bindFramebuffer(l.READ_FRAMEBUFFER,null),l.deleteFramebuffer(p),R}_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 nM(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 VB=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)}},qB=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}},MZ={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"},HB=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)}}},vC=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&&(je(`TimestampQueryPool: No timestamp available for uid ${e}.`),t=0),t}hasTimestampQuery(e){return this.timestamps.has(e)}allocateQueriesForContext(){}async resolveQueriesAsync(){}dispose(){}},WB=class extends vC{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){je("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 Kn(`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){Ge("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){Ge("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 Ge("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){Ge("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}}},bC=class extends yC{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 VB(this),this.capabilities=new qB(this),this.attributeUtils=new UB(this),this.textureUtils=new zB(this),this.bufferRenderer=new HB(this),this.state=new kB(this),this.utils=new GB(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:(je("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 mo}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&&je("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 WB(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(sc.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(sc.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(),p=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 x=0;x<r.textures.length;x++)x===0?a.clearBufferfv(a.COLOR,x,[u.r,u.g,u.b,u.a]):a.clearBufferfv(a.COLOR,x,[0,0,0,1]);t&&n?a.clearBufferfi(a.DEPTH_STENCIL,0,f,p):t?a.clearBufferfv(a.DEPTH,0,[f]):n&&a.clearBufferiv(a.STENCIL,0,[p]),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(sc.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),p=this.vaoCache[f];p===void 0?this.vaoCache[f]=this._createVao(u):o.setVertexState(p),o.useProgram(l),this._bindUniforms(n);let x=this._getTransformFeedback(c);a.bindTransformFeedback(a.TRANSFORM_FEEDBACK,x),a.beginTransformFeedback(a.POINTS),s=s!==null?s:t.count,Array.isArray(s)?(Kn("WebGLBackend.compute(): The count parameter must be a single number, not an array."),s=s[0]):s&&typeof s=="object"&&s.isIndirectStorageBufferAttribute&&(Kn("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 v=0;v<c.length;v++){let w=c[v];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(sc.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 p=0;p<f;p++)a.uniform1ui(l,p),t.render(c[p],u[p])}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 p=t.isMesh&&t.matrixWorld.determinantAffine()<0;c.setMaterial(r,p,o),s.mrt!==null&&s.textures!==null&&c.setMRTBlending(s.textures,s.mrt,r),c.useProgram(a);let x=e.getAttributes(),v=this.get(x),w=v.vaoGPU;if(w===void 0){let F=this._getVaoKey(x);w=this.vaoCache[F],w===void 0&&(w=this._createVao(x),this.vaoCache[F]=w,v.vaoGPU=w)}let S=e.getIndex(),T=S!==null?this.get(S).bufferGPU:null;c.setVertexState(w,T);let P=u.lastOcclusionObject;if(P!==t&&P!==void 0){if(P!==null&&P.occlusionTest===!0&&(l.endQuery(l.ANY_SAMPLES_PASSED),u.occlusionQueryIndex++),t.occlusionTest===!0){let F=l.createQuery();l.beginQuery(l.ANY_SAMPLES_PASSED,F),u.occlusionQueries[u.occlusionQueryIndex]=F,u.occlusionQueryObjects[u.occlusionQueryIndex]=t}u.lastOcclusionObject=t}let R=this.bufferRenderer;t.isPoints?R.mode=l.POINTS:t.isLineSegments?R.mode=l.LINES:t.isLine?R.mode=l.LINE_STRIP:t.isLineLoop?R.mode=l.LINE_LOOP:r.wireframe===!0?(c.setLineWidth(r.wireframeLinewidth*this.renderer.getPixelRatio()),R.mode=l.LINES):R.mode=l.TRIANGLES;let{vertexCount:C,instanceCount:L}=f,{firstVertex:D}=f;if(R.object=t,S!==null){D*=S.array.BYTES_PER_ELEMENT;let F=this.get(S);R.index=S.count,R.type=F.type}else R.index=0;if(e.camera.isArrayCamera===!0&&e.camera.cameras.length>0&&e.camera.isMultiViewCamera===!1){let F=this.get(e.camera),N=e.camera.cameras,B=e.getBindingGroup("cameraIndex").bindings[0];if(F.indexesGPU===void 0||F.indexesGPU.length!==N.length){let j=new Uint32Array([0,0,0,0]),K=[];for(let ee=0,ae=N.length;ee<ae;ee++){let ce=l.createBuffer();j[0]=ee,l.bindBuffer(l.UNIFORM_BUFFER,ce),l.bufferData(l.UNIFORM_BUFFER,j,l.STATIC_DRAW),K.push(ce)}F.indexesGPU=K}let z=0;e:for(let j of e.getBindings())for(let K of j.bindings){if(K===B)break e;(K.isUniformsGroup||K.isUniformBuffer)&&z++}let V=this.renderer.getPixelRatio(),H=this._currentContext.renderTarget,Z=this._isRenderCameraDepthArray(this._currentContext),J=this._currentContext.activeCubeFace;if(Z){let j=this.get(H.depthTexture);if(j.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){j.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;let{stencilBuffer:K}=H;for(let ee=0,ae=N.length;ee<ae;ee++)this.renderer._activeCubeFace=ee,this._currentContext.activeCubeFace=ee,this._setFramebuffer(this._currentContext),this.clear(!1,!0,K,this._currentContext,!1,!1);this.renderer._activeCubeFace=J,this._currentContext.activeCubeFace=J}}for(let j=0,K=N.length;j<K;j++){let ee=N[j];if(t.layers.test(ee.layers)){Z&&(this.renderer._activeCubeFace=j,this._currentContext.activeCubeFace=j,this._setFramebuffer(this._currentContext));let ae=ee.viewport;if(ae!==void 0){let ce=ae.x*V,de=ae.y*V,ve=ae.width*V,Ie=ae.height*V;c.viewport(Math.floor(ce),Math.floor(e.context.height-Ie-de),Math.floor(ve),Math.floor(Ie))}c.bindBufferBase(l.UNIFORM_BUFFER,z,F.indexesGPU[j]),this._draw(t,R,D,C,L,a)}this._currentContext.activeCubeFace=J,this.renderer._activeCubeFace=J}}else this._draw(t,R,D,C,L,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 OB(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 p=this.parallel,x=()=>{n.getProgramParameter(a,p.COMPLETION_STATUS_KHR)?(this._completeCompile(e,r),f()):requestAnimationFrame(x)};x()});t.push(u);return}this._completeCompile(e,r)}_handleSource(e,t){let n=e.split(`43584358 `),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(`43594359 `)}_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()+`43604360
@@ -4366,7 +4366,7 @@ Program Info Log: `+o+`
43664366 `+a+`43674367 `+l)}else o!==""&&je("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 es43684368 precision highp float;4369-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=[],p=[];for(let S=0;S<u.length;S++){let T=u[S];f.push(T.varyingName),p.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 x=o.attributes,v=[],w=[];for(let S=0;S<x.length;S++){let T=x[S].node.attribute;v.push(T),this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER)}for(let S=0;S<p.length;S++){let T=p[S].attribute;this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER);let P=this.get(T);w.push(P)}this.set(e,{programGPU:a,transformBuffers:w,attributes:v})}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=I_(s),c=l?1:s.BYTES_PER_ELEMENT;for(let u=0,f=a.length;u<f;u++){let p=a[u],x=p.start*c,v=p.count*c,w=x*(l?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,w,s,x,v)}}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=I_(s),l=a?1:s.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let p=o[u],x=o[u+1],v=p.start+p.count;if(x!==void 0&&x.start===v)continue;let w=c*l,S=(v-c)*l,T=w*(a?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,T,s,w,S),x!==void 0&&(c=x.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(TZ).filter(r=>TZ[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===kf.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,p=s.depth>1,x=s.isXRRenderTarget===!0,v=x===!0&&s._hasExternalTextures===!0,w=o.msaaFrameBuffer,S=o.depthRenderbuffer,T=this.extensions.get("WEBGL_multisampled_render_to_texture"),P=this.extensions.get("OVR_multiview2"),R=this._useMultisampledExtension(s),C=eee(e),L;if(u?(o.cubeFramebuffers||(o.cubeFramebuffers={}),L=o.cubeFramebuffers[C]):x&&v===!1?L=this._xrFramebuffer:(o.framebuffers||(o.framebuffers={}),L=o.framebuffers[C]),L===void 0){L=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,L);let D=e.textures,F=[];if(u){o.cubeFramebuffers[C]=L;let{textureGPU:B}=this.get(D[0]),z=this.renderer._activeCubeFace,V=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+z,B,V)}else{o.framebuffers[C]=L;for(let B=0;B<D.length;B++){let z=D[B],V=this.get(z);V.renderTarget=e.renderTarget,V.cacheKey=C;let H=t.COLOR_ATTACHMENT0+B;if(s.multiview)P.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,H,V.textureGPU,0,a,0,2);else if(f||p){let Z=this.renderer._activeCubeFace,J=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,H,V.textureGPU,J,Z)}else if(R)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,H,t.TEXTURE_2D,V.textureGPU,0,a);else{let Z=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,H,t.TEXTURE_2D,V.textureGPU,Z)}}}let N=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage(B,e,0,R),o.xrDepthRenderbuffer=B,F.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,N,t.RENDERBUFFER,B)}else if(e.depthTexture!==null){F.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);let B=this.get(e.depthTexture);if(B.renderTarget=e.renderTarget,B.cacheKey=C,s.multiview)P.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,N,B.textureGPU,0,a,0,2);else if(v&&R)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,N,t.TEXTURE_2D,B.textureGPU,0,a);else if(e.depthTexture.isArrayTexture){let z=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,N,B.textureGPU,0,z)}else if(e.depthTexture.isCubeTexture){let z=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,N,t.TEXTURE_CUBE_MAP_POSITIVE_X+z,B.textureGPU,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,N,t.TEXTURE_2D,B.textureGPU,0)}o.depthInvalidationArray=F}else{if(this._isRenderCameraDepthArray(e)){n.bindFramebuffer(t.FRAMEBUFFER,L);let F=this.renderer._activeCubeFace,N=this.get(e.depthTexture),B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,B,N.textureGPU,0,F)}if((x||R||s.multiview)&&s._isOpaqueFramebuffer!==!0){n.bindFramebuffer(t.FRAMEBUFFER,L);let F=this.get(e.textures[0]);s.multiview?P.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,F.textureGPU,0,a,0,2):R?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,F.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,F.textureGPU,0);let N=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,N,t.RENDERBUFFER,B)}else{let B=this.get(e.depthTexture);s.multiview?P.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,N,B.textureGPU,0,a,0,2):R?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,N,t.TEXTURE_2D,B.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,N,t.TEXTURE_2D,B.textureGPU,0)}}}if(a>0&&R===!1&&!s.multiview){if(w===void 0){let D=[];w=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,w);let F=[],N=e.textures;for(let B=0;B<N.length;B++){F[B]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,F[B]),D.push(t.COLOR_ATTACHMENT0+B);let z=e.textures[B],V=this.get(z);t.renderbufferStorageMultisample(t.RENDERBUFFER,a,V.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+B,t.RENDERBUFFER,F[B])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),o.msaaFrameBuffer=w,o.msaaRenderbuffers=F,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=L;n.drawBuffers(e,L)}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 p=0;p<u.length;p++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.TEXTURE_2D,null,0);for(let p=0;p<u.length;p++){if(f){let{textureGPU:x}=this.get(u[p]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,c[p]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,x,0)}if(e.scissor){let{x,y:v,width:w,height:S}=e.scissorValue,T=e.height-S-v;t.blitFramebuffer(x,T,x+w,T+S,x,T,x+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 p=0;p<u.length;p++){let{textureGPU:x}=this.get(u[p]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.RENDERBUFFER,c[p]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.TEXTURE_2D,x,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)}},Hv={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},Ph=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"},Sa={Store:"store"},Mi={Load:"load",Clear:"clear"},EZ={CCW:"ccw",CW:"cw"},MZ={None:"none",Back:"back"},vC={Uint16:"uint16",Uint32:"uint32"},he={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"},v8={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},hc={Linear:"linear",Nearest:"nearest"},si={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"},mm={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},CZ={None:0,All:15},$p={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},b8={Storage:"storage",ReadOnlyStorage:"read-only-storage"},w8={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},RZ={NonFiltering:"non-filtering",Comparison:"comparison"},gm={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},PZ={TwoD:"2d",ThreeD:"3d"},So={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},t3e={All:"all"},tM={Vertex:"vertex",Instance:"instance"},bC={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"},IZ={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"},kB=class extends mC{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()}},GB=class extends fC{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},n3e=0,zB=class extends GB{constructor(e,t){super("StorageBuffer_"+n3e++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:Eo.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},S8=[null],VB=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=he.Depth32FloatStencil8:t=he.Depth24PlusStencil8:this.backend.renderer.reversedDepthBuffer===!0?t=he.Depth32Float:t=he.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 Hv.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return Hv.LineList;if(e.isLine)return Hv.LineStrip;if(e.isMesh)return Hv.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===zi)return he.BGRA8Unorm;if(t===Di)return he.RGBA16Float;throw new Error("THREE.WebGPUUtils: Unsupported output buffer type.")}};function Sh(i,e){S8[0]=e,i.queue.submit(S8),S8[0]=null}var wC=class{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}},f0=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}},Gm=class{constructor(){this.label=""}reset(){this.label=""}},SC=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}},Pm=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}},Im=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}},TC=class{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new qB,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},qB=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},EC=class{constructor(){this.label="",this.code="",this.compilationHints=[]}reset(){this.label="",this.code="",this.compilationHints.length=0}},xb=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}},yb=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"}},Yp=new wC,Zp=new f0,nM=new Gm,T8=new SC,E8=new Im,d1=new TC,Bv=new Pm,iM=new EC,p1=new xb,Jr=new yb,HB=class extends Dh{constructor(e){super(),this.device=e;let t=`4369+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=[],p=[];for(let S=0;S<u.length;S++){let T=u[S];f.push(T.varyingName),p.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 x=o.attributes,v=[],w=[];for(let S=0;S<x.length;S++){let T=x[S].node.attribute;v.push(T),this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER)}for(let S=0;S<p.length;S++){let T=p[S].attribute;this.has(T)||this.attributeUtils.createAttribute(T,r.ARRAY_BUFFER);let P=this.get(T);w.push(P)}this.set(e,{programGPU:a,transformBuffers:w,attributes:v})}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=N_(s),c=l?1:s.BYTES_PER_ELEMENT;for(let u=0,f=a.length;u<f;u++){let p=a[u],x=p.start*c,v=p.count*c,w=x*(l?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,w,s,x,v)}}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=N_(s),l=a?1:s.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let p=o[u],x=o[u+1],v=p.start+p.count;if(x!==void 0&&x.start===v)continue;let w=c*l,S=(v-c)*l,T=w*(a?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,T,s,w,S),x!==void 0&&(c=x.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(MZ).filter(r=>MZ[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===Gf.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,p=s.depth>1,x=s.isXRRenderTarget===!0,v=x===!0&&s._hasExternalTextures===!0,w=o.msaaFrameBuffer,S=o.depthRenderbuffer,T=this.extensions.get("WEBGL_multisampled_render_to_texture"),P=this.extensions.get("OVR_multiview2"),R=this._useMultisampledExtension(s),C=nee(e),L;if(u?(o.cubeFramebuffers||(o.cubeFramebuffers={}),L=o.cubeFramebuffers[C]):x&&v===!1?L=this._xrFramebuffer:(o.framebuffers||(o.framebuffers={}),L=o.framebuffers[C]),L===void 0){L=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,L);let D=e.textures,F=[];if(u){o.cubeFramebuffers[C]=L;let{textureGPU:B}=this.get(D[0]),z=this.renderer._activeCubeFace,V=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+z,B,V)}else{o.framebuffers[C]=L;for(let B=0;B<D.length;B++){let z=D[B],V=this.get(z);V.renderTarget=e.renderTarget,V.cacheKey=C;let H=t.COLOR_ATTACHMENT0+B;if(s.multiview)P.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,H,V.textureGPU,0,a,0,2);else if(f||p){let Z=this.renderer._activeCubeFace,J=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,H,V.textureGPU,J,Z)}else if(R)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,H,t.TEXTURE_2D,V.textureGPU,0,a);else{let Z=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,H,t.TEXTURE_2D,V.textureGPU,Z)}}}let N=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let B=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage(B,e,0,R),o.xrDepthRenderbuffer=B,F.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,B),t.framebufferRenderbuffer(t.FRAMEBUFFER,N,t.RENDERBUFFER,B)}else if(e.depthTexture!==null){F.push(c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);let B=this.get(e.depthTexture);if(B.renderTarget=e.renderTarget,B.cacheKey=C,s.multiview)P.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,N,B.textureGPU,0,a,0,2);else if(v&&R)T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,N,t.TEXTURE_2D,B.textureGPU,0,a);else if(e.depthTexture.isArrayTexture){let z=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,N,B.textureGPU,0,z)}else if(e.depthTexture.isCubeTexture){let z=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,N,t.TEXTURE_CUBE_MAP_POSITIVE_X+z,B.textureGPU,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,N,t.TEXTURE_2D,B.textureGPU,0)}o.depthInvalidationArray=F}else{if(this._isRenderCameraDepthArray(e)){n.bindFramebuffer(t.FRAMEBUFFER,L);let F=this.renderer._activeCubeFace,N=this.get(e.depthTexture),B=c?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,B,N.textureGPU,0,F)}if((x||R||s.multiview)&&s._isOpaqueFramebuffer!==!0){n.bindFramebuffer(t.FRAMEBUFFER,L);let F=this.get(e.textures[0]);s.multiview?P.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,F.textureGPU,0,a,0,2):R?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,F.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,F.textureGPU,0);let N=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,N,t.RENDERBUFFER,B)}else{let B=this.get(e.depthTexture);s.multiview?P.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,N,B.textureGPU,0,a,0,2):R?T.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,N,t.TEXTURE_2D,B.textureGPU,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,N,t.TEXTURE_2D,B.textureGPU,0)}}}if(a>0&&R===!1&&!s.multiview){if(w===void 0){let D=[];w=t.createFramebuffer(),n.bindFramebuffer(t.FRAMEBUFFER,w);let F=[],N=e.textures;for(let B=0;B<N.length;B++){F[B]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,F[B]),D.push(t.COLOR_ATTACHMENT0+B);let z=e.textures[B],V=this.get(z);t.renderbufferStorageMultisample(t.RENDERBUFFER,a,V.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+B,t.RENDERBUFFER,F[B])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),o.msaaFrameBuffer=w,o.msaaRenderbuffers=F,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=L;n.drawBuffers(e,L)}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 p=0;p<u.length;p++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.TEXTURE_2D,null,0);for(let p=0;p<u.length;p++){if(f){let{textureGPU:x}=this.get(u[p]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,c[p]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,x,0)}if(e.scissor){let{x,y:v,width:w,height:S}=e.scissorValue,T=e.height-S-v;t.blitFramebuffer(x,T,x+w,T+S,x,T,x+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 p=0;p<u.length;p++){let{textureGPU:x}=this.get(u[p]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.RENDERBUFFER,c[p]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+p,t.TEXTURE_2D,x,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)}},jv={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},Nh=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"},Sa={Store:"store"},Mi={Load:"load",Clear:"clear"},CZ={CCW:"ccw",CW:"cw"},RZ={None:"none",Back:"back"},wC={Uint16:"uint16",Uint32:"uint32"},he={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"},C8={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},fc={Linear:"linear",Nearest:"nearest"},oi={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"},_m={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},PZ={None:0,All:15},Yp={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},R8={Storage:"storage",ReadOnlyStorage:"read-only-storage"},P8={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},IZ={NonFiltering:"non-filtering",Comparison:"comparison"},xm={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},NZ={TwoD:"2d",ThreeD:"3d"},So={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},i3e={All:"all"},iM={Vertex:"vertex",Instance:"instance"},SC={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"},LZ={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"},jB=class extends _C{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()}},XB=class extends pC{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},r3e=0,$B=class extends XB{constructor(e,t){super("StorageBuffer_"+r3e++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:Eo.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},I8=[null],YB=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=he.Depth32FloatStencil8:t=he.Depth24PlusStencil8:this.backend.renderer.reversedDepthBuffer===!0?t=he.Depth32Float:t=he.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 jv.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return jv.LineList;if(e.isLine)return jv.LineStrip;if(e.isMesh)return jv.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===zi)return he.BGRA8Unorm;if(t===Di)return he.RGBA16Float;throw new Error("THREE.WebGPUUtils: Unsupported output buffer type.")}};function Eh(i,e){I8[0]=e,i.queue.submit(I8),I8[0]=null}var TC=class{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}},d0=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}},Vm=class{constructor(){this.label=""}reset(){this.label=""}},EC=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}},Nm=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}},Lm=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}},MC=class{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new ZB,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},ZB=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},CC=class{constructor(){this.label="",this.code="",this.compilationHints=[]}reset(){this.label="",this.code="",this.compilationHints.length=0}},vb=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}},bb=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"}},Zp=new TC,Kp=new d0,rM=new Vm,N8=new EC,L8=new Lm,p1=new MC,kv=new Nm,sM=new CC,A1=new vb,Jr=new bb,KB=class extends Oh{constructor(e){super(),this.device=e;let t=`43704370 struct VarysStruct {43714371 @builtin( position ) Position: vec4f,43724372 @location( 0 ) vTex : vec2f,
@@ -4440,7 +4440,7 @@ fn main_cube( Varys: VarysStruct ) -> @location( 0 ) vec4<f32> {
44404440 return textureSample( imgCube, imgSampler, faceMat[ Varys.vBaseArrayLayer ] * vec3f( fract( Varys.vTex ), 1 ) );44414441 44424442 }4443-`;this.mipmapSampler=e.createSampler({minFilter:hc.Linear}),this.flipYSampler=e.createSampler({minFilter:hc.Nearest}),Zp.size=4,Zp.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(Zp),Zp.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),Zp.size=4,Zp.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(Zp),Zp.reset(),this.transferPipelines={},iM.label="mipmap",iM.code=t,this.mipmapShaderModule=e.createShaderModule(iM),iM.reset()}getTransferPipeline(e,t){t=t||"2d-array";let n=`${e}-${t}`,r=this.transferPipelines[n];return r===void 0&&(d1.label=`mipmap-${e}-${t}`,d1.vertex={module:this.mipmapShaderModule},d1.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},d1.layout="auto",r=this.device.createRenderPipeline(d1),d1.reset(),this.transferPipelines[n]=r),r}flipY(e,t,n=0){let r=t.format,{width:s,height:o}=t.size;p1.size.width=s,p1.size.height=o,p1.format=r,p1.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let a=this.device.createTexture(p1);p1.reset();let l=this.getTransferPipeline(r,e.textureBindingViewDimension),c=this.getTransferPipeline(r,a.textureBindingViewDimension),u=this.device.createCommandEncoder(nM),f=(p,x,v,w,S,T)=>{let P=p.getBindGroupLayout(0);Jr.dimension=x.textureBindingViewDimension||"2d-array",Jr.mipLevelCount=1;let R=x.createView(Jr);Jr.reset(),Yp.layout=P,Yp.entries.push({binding:0,resource:this.flipYSampler},{binding:1,resource:R},{binding:2,resource:{buffer:T?this.flipUniformBuffer:this.noFlipUniformBuffer}});let C=this.device.createBindGroup(Yp);Yp.reset(),Jr.dimension="2d",Jr.mipLevelCount=1,Jr.baseArrayLayer=S,Jr.arrayLayerCount=1;let L=w.createView(Jr);Jr.reset(),Bv.view=L,Bv.loadOp=Mi.Clear,Bv.storeOp=Sa.Store,E8.colorAttachments.push(Bv);let D=u.beginRenderPass(E8);E8.reset(),Bv.reset(),D.setPipeline(p),D.setBindGroup(0,C),D.draw(3,1,0,v),D.end()};f(l,e,n,a,0,!1),f(c,a,0,e,n,!0),Sh(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&&(nM.label="mipmapEncoder",s=this.device.createCommandEncoder(nM),nM.reset()),this._mipmapRunBundles(s,r),t===null&&Sh(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++){Jr.dimension=t,Jr.baseMipLevel=o-1,Jr.mipLevelCount=1;let l=e.createView(Jr);Jr.reset(),Yp.layout=r,Yp.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:l},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let c=this.device.createBindGroup(Yp);Yp.reset(),Jr.dimension="2d",Jr.baseMipLevel=o,Jr.mipLevelCount=1,Jr.baseArrayLayer=a,Jr.arrayLayerCount=1;let u=e.createView(Jr);Jr.reset();let f=new Pm;f.view=u,f.loadOp=Mi.Clear,f.storeOp=Sa.Store;let p=new Im;p.colorAttachments.push(f),T8.colorFormats=[e.format];let x=this.device.createRenderBundleEncoder(T8);T8.reset(),x.setPipeline(n),x.setBindGroup(0,c),x.draw(3,1,0,a),s.push({renderBundles:[x.finish()],passDescriptor:p})}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()}}},WB=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}},U1=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"}},jB=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}},XB=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}},$B=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}},YB=class extends U1{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}},MC=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},rM=new f0,i3e=new Gm,Xo=new WB,Ko=new U1,sM=new jB,Kf=new XB,oM=new $B,A1=new YB,Kp=new xb,Yo=new MC,r3e={[b2]:"never",[P_]:"less",[w2]:"equal",[ih]:"less-equal",[HA]:"greater",[jc]:"greater-equal",[T2]:"always",[S2]:"not-equal"},s3e=[0,1,3,2,4,5];function NZ(i,e,t,n,r,s,o,a,l,c){Ko.texture=e,Ko.mipLevel=t,Ko.origin.z=n,Kf.offset=n*s,Kf.bytesPerRow=o,Kf.rowsPerImage=a,Yo.width=l,Yo.height=c,i.queue.writeTexture(Ko,r.data,Kf,Yo),Ko.reset(),Kf.reset(),Yo.reset()}var ZB=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){Xo.addressModeU=this._convertAddressMode(n.wrapS),Xo.addressModeV=this._convertAddressMode(n.wrapT),Xo.addressModeW=this._convertAddressMode(n.wrapR),Xo.magFilter=this._convertFilterMode(n.magFilter),Xo.minFilter=this._convertFilterMode(n.minFilter),Xo.mipmapFilter=this._convertMipmapFilterMode(n.minFilter),n.isDepthTexture&&(n.compareFunction===null||r.compareNode===null)&&(Xo.magFilter=hc.Nearest,Xo.minFilter=hc.Nearest,Xo.mipmapFilter=hc.Nearest),Xo.magFilter===hc.Linear&&Xo.minFilter===hc.Linear&&Xo.mipmapFilter===hc.Linear&&(Xo.maxAnisotropy=n.anisotropy),n.isDepthTexture&&n.compareFunction!==null&&r.compareNode!==null&&t.hasCompatibility(kf.TEXTURE_COMPARE)&&(Xo.compare=r3e[n.compareFunction]);let l=t.device.createSampler(Xo);Xo.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=KB(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||KB(e,n.device);r.format=u;let{samples:f,primarySamples:p,isMSAA:x}=n.utils.getTextureSampleData(e),v=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;e.isStorageTexture===!0&&(v|=GPUTextureUsage.STORAGE_BINDING),e.isCompressedTexture!==!0&&e.isCompressedArrayTexture!==!0&&u!==he.RGB9E5UFloat&&(v|=GPUTextureUsage.RENDER_ATTACHMENT);let w=new xb;if(w.label=e.name,w.size.width=s,w.size.height=o,w.size.depthOrArrayLayers=a,w.mipLevelCount=l,w.sampleCount=p,w.dimension=c,w.format=u,w.usage=v,u===void 0){je("WebGPURenderer: Texture format not supported."),this.createDefaultTexture(e);return}e.isCubeTexture&&(w.textureBindingViewDimension=So.Cube);try{r.texture=n.device.createTexture(w)}catch{je("WebGPURenderer: Failed to create texture with descriptor:",w),this.createDefaultTexture(e);return}if(x){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(),Kp.label="colorBuffer",Kp.size.width=n,Kp.size.height=r,Kp.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),Kp.format=e.utils.getPreferredCanvasFormat(),Kp.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,l=e.device.createTexture(Kp),Kp.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=eo,f=n.renderer.reversedDepthBuffer===!0?Zi:Vo):e&&(u=vs,f=n.renderer.reversedDepthBuffer===!0?Zi:pi),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),p=r*f;p=Math.ceil(p/256)*256,rM.size=(s-1)*p+r*f,rM.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let x=a.createBuffer(rM);rM.reset();let v=a.createCommandEncoder(i3e);Ko.texture=c,Ko.origin.x=t,Ko.origin.y=n,Ko.origin.z=o,sM.buffer=x,sM.bytesPerRow=p,Yo.width=r,Yo.height=s,v.copyTextureToBuffer(Ko,sM,Yo),Ko.reset(),sM.reset(),Yo.reset();let w=this._getTypedArrayType(u);Sh(a,v.finish()),await x.mapAsync(GPUMapMode.READ);let S=x.getMappedRange().slice();return x.destroy(),new w(S)}dispose(){this._samplerCache.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){let n=new ws;n.minFilter=yi,n.magFilter=yi,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 Gu;n.minFilter=yi,n.magFilter=yi,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?s3e[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;oM.source=e,oM.flipY=s,A1.texture=t,A1.mipLevel=a,A1.origin.z=r,A1.premultipliedAlpha=o,Yo.width=c,Yo.height=u;try{l.queue.copyExternalImageToTexture(oM,A1,Yo)}catch{}finally{oM.reset(),A1.reset(),Yo.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new HB(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;Ko.texture=t,Ko.mipLevel=a,Ko.origin.z=r,Kf.offset=e.width*e.height*u*o,Kf.bytesPerRow=f,Yo.width=e.width,Yo.height=e.height,l.queue.writeTexture(Ko,c,Kf,Yo),Ko.reset(),Kf.reset(),Yo.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,p=u.height,x=a?n.size.depthOrArrayLayers:1,v=Math.ceil(f/o.width)*o.byteLength,w=Math.ceil(p/o.height),S=v*w,T=Math.ceil(f/o.width)*o.width,P=w*o.height;if(l!==null)for(let R of l)NZ(s,t,c,R,u,S,v,w,T,P);else for(let R=0;R<x;R++)NZ(s,t,c,R,u,S,v,w,T,P)}}_getBlockData(e){if(e===he.BC1RGBAUnorm||e===he.BC1RGBAUnormSRGB)return{byteLength:8,width:4,height:4};if(e===he.BC2RGBAUnorm||e===he.BC2RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.BC3RGBAUnorm||e===he.BC3RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.BC4RUnorm||e===he.BC4RSnorm)return{byteLength:8,width:4,height:4};if(e===he.BC5RGUnorm||e===he.BC5RGSnorm)return{byteLength:16,width:4,height:4};if(e===he.BC6HRGBUFloat||e===he.BC6HRGBFloat)return{byteLength:16,width:4,height:4};if(e===he.BC7RGBAUnorm||e===he.BC7RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.ETC2RGB8Unorm||e===he.ETC2RGB8UnormSRGB)return{byteLength:8,width:4,height:4};if(e===he.ETC2RGB8A1Unorm||e===he.ETC2RGB8A1UnormSRGB)return{byteLength:8,width:4,height:4};if(e===he.ETC2RGBA8Unorm||e===he.ETC2RGBA8UnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.EACR11Unorm)return{byteLength:8,width:4,height:4};if(e===he.EACR11Snorm)return{byteLength:8,width:4,height:4};if(e===he.EACRG11Unorm)return{byteLength:16,width:4,height:4};if(e===he.EACRG11Snorm)return{byteLength:16,width:4,height:4};if(e===he.ASTC4x4Unorm||e===he.ASTC4x4UnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.ASTC5x4Unorm||e===he.ASTC5x4UnormSRGB)return{byteLength:16,width:5,height:4};if(e===he.ASTC5x5Unorm||e===he.ASTC5x5UnormSRGB)return{byteLength:16,width:5,height:5};if(e===he.ASTC6x5Unorm||e===he.ASTC6x5UnormSRGB)return{byteLength:16,width:6,height:5};if(e===he.ASTC6x6Unorm||e===he.ASTC6x6UnormSRGB)return{byteLength:16,width:6,height:6};if(e===he.ASTC8x5Unorm||e===he.ASTC8x5UnormSRGB)return{byteLength:16,width:8,height:5};if(e===he.ASTC8x6Unorm||e===he.ASTC8x6UnormSRGB)return{byteLength:16,width:8,height:6};if(e===he.ASTC8x8Unorm||e===he.ASTC8x8UnormSRGB)return{byteLength:16,width:8,height:8};if(e===he.ASTC10x5Unorm||e===he.ASTC10x5UnormSRGB)return{byteLength:16,width:10,height:5};if(e===he.ASTC10x6Unorm||e===he.ASTC10x6UnormSRGB)return{byteLength:16,width:10,height:6};if(e===he.ASTC10x8Unorm||e===he.ASTC10x8UnormSRGB)return{byteLength:16,width:10,height:8};if(e===he.ASTC10x10Unorm||e===he.ASTC10x10UnormSRGB)return{byteLength:16,width:10,height:10};if(e===he.ASTC12x10Unorm||e===he.ASTC12x10UnormSRGB)return{byteLength:16,width:12,height:10};if(e===he.ASTC12x12Unorm||e===he.ASTC12x12UnormSRGB)return{byteLength:16,width:12,height:12}}_convertAddressMode(e){let t=v8.ClampToEdge;return e===Mf?t=v8.Repeat:e===Cf&&(t=v8.MirrorRepeat),t}_convertFilterMode(e){let t=hc.Linear;return(e===yi||e===x2||e===ic)&&(t=hc.Nearest),t}_convertMipmapFilterMode(e){return e===ic||e===xo?hc.Linear:hc.Nearest}_getBytesPerTexel(e){if(e===he.R8Unorm||e===he.R8Snorm||e===he.R8Uint||e===he.R8Sint)return 1;if(e===he.R16Uint||e===he.R16Sint||e===he.R16Float||e===he.RG8Unorm||e===he.RG8Snorm||e===he.RG8Uint||e===he.RG8Sint||e===he.R16Unorm||e===he.R16Snorm)return 2;if(e===he.R32Uint||e===he.R32Sint||e===he.R32Float||e===he.RG16Uint||e===he.RG16Sint||e===he.RG16Float||e===he.RGBA8Unorm||e===he.RGBA8UnormSRGB||e===he.RGBA8Snorm||e===he.RGBA8Uint||e===he.RGBA8Sint||e===he.BGRA8Unorm||e===he.BGRA8UnormSRGB||e===he.RG16Unorm||e===he.RG16Snorm||e===he.RGB9E5UFloat||e===he.RGB10A2Unorm||e===he.RG11B10UFloat||e===he.Depth32Float||e===he.Depth24Plus||e===he.Depth24PlusStencil8||e===he.Depth32FloatStencil8)return 4;if(e===he.RG32Uint||e===he.RG32Sint||e===he.RG32Float||e===he.RGBA16Uint||e===he.RGBA16Sint||e===he.RGBA16Float||e===he.RGBA16Unorm||e===he.RGBA16Snorm)return 8;if(e===he.RGBA32Uint||e===he.RGBA32Sint||e===he.RGBA32Float)return 16}_getTypedArrayType(e){if(e===he.R8Uint)return Uint8Array;if(e===he.R8Sint)return Int8Array;if(e===he.R8Unorm)return Uint8Array;if(e===he.R8Snorm)return Int8Array;if(e===he.RG8Uint)return Uint8Array;if(e===he.RG8Sint)return Int8Array;if(e===he.RG8Unorm)return Uint8Array;if(e===he.RG8Snorm)return Int8Array;if(e===he.RGBA8Uint)return Uint8Array;if(e===he.RGBA8Sint)return Int8Array;if(e===he.RGBA8Unorm||e===he.RGBA8UnormSRGB)return Uint8Array;if(e===he.RGBA8Snorm)return Int8Array;if(e===he.R16Uint)return Uint16Array;if(e===he.R16Sint)return Int16Array;if(e===he.RG16Uint)return Uint16Array;if(e===he.RG16Sint)return Int16Array;if(e===he.RGBA16Uint)return Uint16Array;if(e===he.RGBA16Sint)return Int16Array;if(e===he.R16Float||e===he.RG16Float||e===he.RGBA16Float||e===he.R16Unorm)return Uint16Array;if(e===he.R16Snorm)return Int16Array;if(e===he.RG16Unorm)return Uint16Array;if(e===he.RG16Snorm)return Int16Array;if(e===he.RGBA16Unorm)return Uint16Array;if(e===he.RGBA16Snorm)return Int16Array;if(e===he.R32Uint)return Uint32Array;if(e===he.R32Sint)return Int32Array;if(e===he.R32Float)return Float32Array;if(e===he.RG32Uint)return Uint32Array;if(e===he.RG32Sint)return Int32Array;if(e===he.RG32Float)return Float32Array;if(e===he.RGBA32Uint)return Uint32Array;if(e===he.RGBA32Sint)return Int32Array;if(e===he.RGBA32Float)return Float32Array;if(e===he.BGRA8Unorm||e===he.BGRA8UnormSRGB)return Uint8Array;if(e===he.RGB10A2Unorm||e===he.RGB9E5UFloat||e===he.RG11B10UFloat)return Uint32Array;if(e===he.Depth32Float)return Float32Array;if(e===he.Depth24Plus||e===he.Depth24PlusStencil8)return Uint32Array;if(e===he.Depth32FloatStencil8)return Float32Array}_getDimension(e){let t;return e.is3DTexture||e.isData3DTexture?t=PZ.ThreeD:t=PZ.TwoD,t}};function KB(i,e){let t=i.format,n=i.type,r=i.normalized,s=i.colorSpace,o=sn.getTransfer(s),a,l=!1;if(r&&(l=e.features.has(bC.TextureFormatsTier1),l===!1&&je("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case Ku:case Qu:a=o===Bt?he.BC1RGBAUnormSRGB:he.BC1RGBAUnorm;break;case Ju:a=o===Bt?he.BC2RGBAUnormSRGB:he.BC2RGBAUnorm;break;case eh:a=o===Bt?he.BC3RGBAUnormSRGB:he.BC3RGBAUnorm;break;case Lp:a=he.BC4RUnorm;break;case Dp:a=he.BC4RSnorm;break;case nh:a=he.BC5RGUnorm;break;case Fp:a=he.BC5RGSnorm;break;case Pp:a=o===Bt?he.BC7RGBAUnormSRGB:he.BC7RGBAUnorm;break;case Ip:a=he.BC6HRGBFloat;break;case Np:a=he.BC6HRGBUFloat;break;case hp:case up:a=o===Bt?he.ETC2RGB8UnormSRGB:he.ETC2RGB8Unorm;break;case fp:a=o===Bt?he.ETC2RGBA8UnormSRGB:he.ETC2RGBA8Unorm;break;case dp:a=he.EACR11Unorm;break;case pp:a=he.EACR11Snorm;break;case th:a=he.EACRG11Unorm;break;case Ap:a=he.EACRG11Snorm;break;case mp:a=o===Bt?he.ASTC4x4UnormSRGB:he.ASTC4x4Unorm;break;case gp:a=o===Bt?he.ASTC5x4UnormSRGB:he.ASTC5x4Unorm;break;case _p:a=o===Bt?he.ASTC5x5UnormSRGB:he.ASTC5x5Unorm;break;case xp:a=o===Bt?he.ASTC6x5UnormSRGB:he.ASTC6x5Unorm;break;case yp:a=o===Bt?he.ASTC6x6UnormSRGB:he.ASTC6x6Unorm;break;case vp:a=o===Bt?he.ASTC8x5UnormSRGB:he.ASTC8x5Unorm;break;case bp:a=o===Bt?he.ASTC8x6UnormSRGB:he.ASTC8x6Unorm;break;case wp:a=o===Bt?he.ASTC8x8UnormSRGB:he.ASTC8x8Unorm;break;case Sp:a=o===Bt?he.ASTC10x5UnormSRGB:he.ASTC10x5Unorm;break;case Tp:a=o===Bt?he.ASTC10x6UnormSRGB:he.ASTC10x6Unorm;break;case Ep:a=o===Bt?he.ASTC10x8UnormSRGB:he.ASTC10x8Unorm;break;case Mp:a=o===Bt?he.ASTC10x10UnormSRGB:he.ASTC10x10Unorm;break;case Cp:a=o===Bt?he.ASTC12x10UnormSRGB:he.ASTC12x10Unorm;break;case Rp:a=o===Bt?he.ASTC12x12UnormSRGB:he.ASTC12x12Unorm;break;case vr:a=o===Bt?he.RGBA8UnormSRGB:he.RGBA8Unorm;break;default:Ge("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case vr:switch(n){case Xu:a=he.RGBA8Snorm;break;case $u:a=l?he.RGBA16Snorm:he.RGBA16Sint;break;case ja:a=l?he.RGBA16Unorm:he.RGBA16Uint;break;case pi:a=he.RGBA32Uint;break;case Dr:a=he.RGBA32Sint;break;case zi:a=o===Bt?he.RGBA8UnormSRGB:he.RGBA8Unorm;break;case Di:a=he.RGBA16Float;break;case Zi:a=he.RGBA32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case Bf:switch(n){case UA:a=he.RGB9E5UFloat;break;case kA:a=he.RG11B10UFloat;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Uf:switch(n){case Xu:a=he.R8Snorm;break;case $u:a=l?he.R16Snorm:he.R16Sint;break;case ja:a=l?he.R16Unorm:he.R16Uint;break;case pi:a=he.R32Uint;break;case Dr:a=he.R32Sint;break;case zi:a=he.R8Unorm;break;case Di:a=he.R16Float;break;case Zi:a=he.R32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case Ts:switch(n){case Xu:a=he.RG8Snorm;break;case $u:a=l?he.RG16Snorm:he.RG16Sint;break;case ja:a=l?he.RG16Unorm:he.RG16Uint;break;case pi:a=he.RG32Uint;break;case Dr:a=he.RG32Sint;break;case zi:a=he.RG8Unorm;break;case Di:a=he.RG16Float;break;case Zi:a=he.RG32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case vs:switch(n){case ja:a=he.Depth16Unorm;break;case pi:a=he.Depth24Plus;break;case Zi:a=he.Depth32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case eo:switch(n){case Vo:a=he.Depth24PlusStencil8;break;case Zi:e&&e.features.has(bC.Depth32FloatStencil8)===!1&&Ge('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.'),a=he.Depth32FloatStencil8;break;default:Ge("WebGPURenderer: Unsupported texture type with DepthStencilFormat.",n)}break;case Yu:switch(n){case Dr:a=he.R32Sint;break;case pi:a=he.R32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case Zu:switch(n){case Dr:a=he.RG32Sint;break;case pi:a=he.RG32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case cp:switch(n){case Dr:a=he.RGBA32Sint;break;case pi:a=he.RGBA32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:Ge("WebGPURenderer: Unsupported texture format.",t)}return a}var o3e=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,a3e=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,LZ={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"},l3e=i=>{i=i.trim();let e=i.match(o3e);if(e!==null&&e.length===4){let t=e[2],n=[],r=null;for(;(r=a3e.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:p}=n[u],x=p;x.startsWith("ptr")?x="pointer":(x.startsWith("texture")&&(x=p.split("<")[0]),x=LZ[x]),s.push(new Ab(x,f))}let o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:LZ[a]||a,inputs:s,name:l,inputsCode:t,blockCode:o,outputType:a}}else throw new Error("THREE.WGSLNodeFunction: Function is not a WGSL code.")},QB=class extends gb{constructor(e){let{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=l3e(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}},JB=class extends lC{parseFunction(e){return new QB(e)}},c3e={[Eo.READ_ONLY]:"read",[Eo.WRITE_ONLY]:"write",[Eo.READ_WRITE]:"read_write"},DZ={[Mf]:"repeat",[Go]:"clamp",[Cf]:"mirror"},M8={vertex:Ph.VERTEX,fragment:Ph.FRAGMENT,compute:Ph.COMPUTE},FZ={instance:!0,swizzleAssign:!1,storageBuffer:!0},u3e={"^^":"tsl_xor"},h3e={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>"},OZ={},Uv={tsl_xor:new Qi("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new Qi("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new Qi("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new Qi("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new Qi("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new Qi("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new Qi("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new Qi("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 Qi("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 Qi("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new Qi("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 Qi("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),inverse_mat2:new Qi(`4443+`;this.mipmapSampler=e.createSampler({minFilter:fc.Linear}),this.flipYSampler=e.createSampler({minFilter:fc.Nearest}),Kp.size=4,Kp.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(Kp),Kp.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),Kp.size=4,Kp.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(Kp),Kp.reset(),this.transferPipelines={},sM.label="mipmap",sM.code=t,this.mipmapShaderModule=e.createShaderModule(sM),sM.reset()}getTransferPipeline(e,t){t=t||"2d-array";let n=`${e}-${t}`,r=this.transferPipelines[n];return r===void 0&&(p1.label=`mipmap-${e}-${t}`,p1.vertex={module:this.mipmapShaderModule},p1.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},p1.layout="auto",r=this.device.createRenderPipeline(p1),p1.reset(),this.transferPipelines[n]=r),r}flipY(e,t,n=0){let r=t.format,{width:s,height:o}=t.size;A1.size.width=s,A1.size.height=o,A1.format=r,A1.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let a=this.device.createTexture(A1);A1.reset();let l=this.getTransferPipeline(r,e.textureBindingViewDimension),c=this.getTransferPipeline(r,a.textureBindingViewDimension),u=this.device.createCommandEncoder(rM),f=(p,x,v,w,S,T)=>{let P=p.getBindGroupLayout(0);Jr.dimension=x.textureBindingViewDimension||"2d-array",Jr.mipLevelCount=1;let R=x.createView(Jr);Jr.reset(),Zp.layout=P,Zp.entries.push({binding:0,resource:this.flipYSampler},{binding:1,resource:R},{binding:2,resource:{buffer:T?this.flipUniformBuffer:this.noFlipUniformBuffer}});let C=this.device.createBindGroup(Zp);Zp.reset(),Jr.dimension="2d",Jr.mipLevelCount=1,Jr.baseArrayLayer=S,Jr.arrayLayerCount=1;let L=w.createView(Jr);Jr.reset(),kv.view=L,kv.loadOp=Mi.Clear,kv.storeOp=Sa.Store,L8.colorAttachments.push(kv);let D=u.beginRenderPass(L8);L8.reset(),kv.reset(),D.setPipeline(p),D.setBindGroup(0,C),D.draw(3,1,0,v),D.end()};f(l,e,n,a,0,!1),f(c,a,0,e,n,!0),Eh(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&&(rM.label="mipmapEncoder",s=this.device.createCommandEncoder(rM),rM.reset()),this._mipmapRunBundles(s,r),t===null&&Eh(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++){Jr.dimension=t,Jr.baseMipLevel=o-1,Jr.mipLevelCount=1;let l=e.createView(Jr);Jr.reset(),Zp.layout=r,Zp.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:l},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let c=this.device.createBindGroup(Zp);Zp.reset(),Jr.dimension="2d",Jr.baseMipLevel=o,Jr.mipLevelCount=1,Jr.baseArrayLayer=a,Jr.arrayLayerCount=1;let u=e.createView(Jr);Jr.reset();let f=new Nm;f.view=u,f.loadOp=Mi.Clear,f.storeOp=Sa.Store;let p=new Lm;p.colorAttachments.push(f),N8.colorFormats=[e.format];let x=this.device.createRenderBundleEncoder(N8);N8.reset(),x.setPipeline(n),x.setBindGroup(0,c),x.draw(3,1,0,a),s.push({renderBundles:[x.finish()],passDescriptor:p})}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()}}},QB=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}},k1=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"}},JB=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}},e7=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}},t7=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}},n7=class extends k1{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}},RC=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},oM=new d0,s3e=new Vm,Xo=new QB,Ko=new k1,aM=new JB,Qf=new e7,lM=new t7,m1=new n7,Qp=new vb,Yo=new RC,o3e={[S2]:"never",[I_]:"less",[T2]:"equal",[sh]:"less-equal",[jA]:"greater",[Xc]:"greater-equal",[M2]:"always",[E2]:"not-equal"},a3e=[0,1,3,2,4,5];function DZ(i,e,t,n,r,s,o,a,l,c){Ko.texture=e,Ko.mipLevel=t,Ko.origin.z=n,Qf.offset=n*s,Qf.bytesPerRow=o,Qf.rowsPerImage=a,Yo.width=l,Yo.height=c,i.queue.writeTexture(Ko,r.data,Qf,Yo),Ko.reset(),Qf.reset(),Yo.reset()}var i7=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){Xo.addressModeU=this._convertAddressMode(n.wrapS),Xo.addressModeV=this._convertAddressMode(n.wrapT),Xo.addressModeW=this._convertAddressMode(n.wrapR),Xo.magFilter=this._convertFilterMode(n.magFilter),Xo.minFilter=this._convertFilterMode(n.minFilter),Xo.mipmapFilter=this._convertMipmapFilterMode(n.minFilter),n.isDepthTexture&&(n.compareFunction===null||r.compareNode===null)&&(Xo.magFilter=fc.Nearest,Xo.minFilter=fc.Nearest,Xo.mipmapFilter=fc.Nearest),Xo.magFilter===fc.Linear&&Xo.minFilter===fc.Linear&&Xo.mipmapFilter===fc.Linear&&(Xo.maxAnisotropy=n.anisotropy),n.isDepthTexture&&n.compareFunction!==null&&r.compareNode!==null&&t.hasCompatibility(Gf.TEXTURE_COMPARE)&&(Xo.compare=o3e[n.compareFunction]);let l=t.device.createSampler(Xo);Xo.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=r7(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||r7(e,n.device);r.format=u;let{samples:f,primarySamples:p,isMSAA:x}=n.utils.getTextureSampleData(e),v=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;e.isStorageTexture===!0&&(v|=GPUTextureUsage.STORAGE_BINDING),e.isCompressedTexture!==!0&&e.isCompressedArrayTexture!==!0&&u!==he.RGB9E5UFloat&&(v|=GPUTextureUsage.RENDER_ATTACHMENT);let w=new vb;if(w.label=e.name,w.size.width=s,w.size.height=o,w.size.depthOrArrayLayers=a,w.mipLevelCount=l,w.sampleCount=p,w.dimension=c,w.format=u,w.usage=v,u===void 0){je("WebGPURenderer: Texture format not supported."),this.createDefaultTexture(e);return}e.isCubeTexture&&(w.textureBindingViewDimension=So.Cube);try{r.texture=n.device.createTexture(w)}catch{je("WebGPURenderer: Failed to create texture with descriptor:",w),this.createDefaultTexture(e);return}if(x){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(),Qp.label="colorBuffer",Qp.size.width=n,Qp.size.height=r,Qp.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),Qp.format=e.utils.getPreferredCanvasFormat(),Qp.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,l=e.device.createTexture(Qp),Qp.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=eo,f=n.renderer.reversedDepthBuffer===!0?Zi:Vo):e&&(u=ws,f=n.renderer.reversedDepthBuffer===!0?Zi:Ai),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),p=r*f;p=Math.ceil(p/256)*256,oM.size=(s-1)*p+r*f,oM.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let x=a.createBuffer(oM);oM.reset();let v=a.createCommandEncoder(s3e);Ko.texture=c,Ko.origin.x=t,Ko.origin.y=n,Ko.origin.z=o,aM.buffer=x,aM.bytesPerRow=p,Yo.width=r,Yo.height=s,v.copyTextureToBuffer(Ko,aM,Yo),Ko.reset(),aM.reset(),Yo.reset();let w=this._getTypedArrayType(u);Eh(a,v.finish()),await x.mapAsync(GPUMapMode.READ);let S=x.getMappedRange().slice();return x.destroy(),new w(S)}dispose(){this._samplerCache.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){let n=new Ts;n.minFilter=yi,n.magFilter=yi,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 Vu;n.minFilter=yi,n.magFilter=yi,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?a3e[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;lM.source=e,lM.flipY=s,m1.texture=t,m1.mipLevel=a,m1.origin.z=r,m1.premultipliedAlpha=o,Yo.width=c,Yo.height=u;try{l.queue.copyExternalImageToTexture(lM,m1,Yo)}catch{}finally{lM.reset(),m1.reset(),Yo.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new KB(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;Ko.texture=t,Ko.mipLevel=a,Ko.origin.z=r,Qf.offset=e.width*e.height*u*o,Qf.bytesPerRow=f,Yo.width=e.width,Yo.height=e.height,l.queue.writeTexture(Ko,c,Qf,Yo),Ko.reset(),Qf.reset(),Yo.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,p=u.height,x=a?n.size.depthOrArrayLayers:1,v=Math.ceil(f/o.width)*o.byteLength,w=Math.ceil(p/o.height),S=v*w,T=Math.ceil(f/o.width)*o.width,P=w*o.height;if(l!==null)for(let R of l)DZ(s,t,c,R,u,S,v,w,T,P);else for(let R=0;R<x;R++)DZ(s,t,c,R,u,S,v,w,T,P)}}_getBlockData(e){if(e===he.BC1RGBAUnorm||e===he.BC1RGBAUnormSRGB)return{byteLength:8,width:4,height:4};if(e===he.BC2RGBAUnorm||e===he.BC2RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.BC3RGBAUnorm||e===he.BC3RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.BC4RUnorm||e===he.BC4RSnorm)return{byteLength:8,width:4,height:4};if(e===he.BC5RGUnorm||e===he.BC5RGSnorm)return{byteLength:16,width:4,height:4};if(e===he.BC6HRGBUFloat||e===he.BC6HRGBFloat)return{byteLength:16,width:4,height:4};if(e===he.BC7RGBAUnorm||e===he.BC7RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.ETC2RGB8Unorm||e===he.ETC2RGB8UnormSRGB)return{byteLength:8,width:4,height:4};if(e===he.ETC2RGB8A1Unorm||e===he.ETC2RGB8A1UnormSRGB)return{byteLength:8,width:4,height:4};if(e===he.ETC2RGBA8Unorm||e===he.ETC2RGBA8UnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.EACR11Unorm)return{byteLength:8,width:4,height:4};if(e===he.EACR11Snorm)return{byteLength:8,width:4,height:4};if(e===he.EACRG11Unorm)return{byteLength:16,width:4,height:4};if(e===he.EACRG11Snorm)return{byteLength:16,width:4,height:4};if(e===he.ASTC4x4Unorm||e===he.ASTC4x4UnormSRGB)return{byteLength:16,width:4,height:4};if(e===he.ASTC5x4Unorm||e===he.ASTC5x4UnormSRGB)return{byteLength:16,width:5,height:4};if(e===he.ASTC5x5Unorm||e===he.ASTC5x5UnormSRGB)return{byteLength:16,width:5,height:5};if(e===he.ASTC6x5Unorm||e===he.ASTC6x5UnormSRGB)return{byteLength:16,width:6,height:5};if(e===he.ASTC6x6Unorm||e===he.ASTC6x6UnormSRGB)return{byteLength:16,width:6,height:6};if(e===he.ASTC8x5Unorm||e===he.ASTC8x5UnormSRGB)return{byteLength:16,width:8,height:5};if(e===he.ASTC8x6Unorm||e===he.ASTC8x6UnormSRGB)return{byteLength:16,width:8,height:6};if(e===he.ASTC8x8Unorm||e===he.ASTC8x8UnormSRGB)return{byteLength:16,width:8,height:8};if(e===he.ASTC10x5Unorm||e===he.ASTC10x5UnormSRGB)return{byteLength:16,width:10,height:5};if(e===he.ASTC10x6Unorm||e===he.ASTC10x6UnormSRGB)return{byteLength:16,width:10,height:6};if(e===he.ASTC10x8Unorm||e===he.ASTC10x8UnormSRGB)return{byteLength:16,width:10,height:8};if(e===he.ASTC10x10Unorm||e===he.ASTC10x10UnormSRGB)return{byteLength:16,width:10,height:10};if(e===he.ASTC12x10Unorm||e===he.ASTC12x10UnormSRGB)return{byteLength:16,width:12,height:10};if(e===he.ASTC12x12Unorm||e===he.ASTC12x12UnormSRGB)return{byteLength:16,width:12,height:12}}_convertAddressMode(e){let t=C8.ClampToEdge;return e===Rf?t=C8.Repeat:e===Pf&&(t=C8.MirrorRepeat),t}_convertFilterMode(e){let t=fc.Linear;return(e===yi||e===v2||e===rc)&&(t=fc.Nearest),t}_convertMipmapFilterMode(e){return e===rc||e===xo?fc.Linear:fc.Nearest}_getBytesPerTexel(e){if(e===he.R8Unorm||e===he.R8Snorm||e===he.R8Uint||e===he.R8Sint)return 1;if(e===he.R16Uint||e===he.R16Sint||e===he.R16Float||e===he.RG8Unorm||e===he.RG8Snorm||e===he.RG8Uint||e===he.RG8Sint||e===he.R16Unorm||e===he.R16Snorm)return 2;if(e===he.R32Uint||e===he.R32Sint||e===he.R32Float||e===he.RG16Uint||e===he.RG16Sint||e===he.RG16Float||e===he.RGBA8Unorm||e===he.RGBA8UnormSRGB||e===he.RGBA8Snorm||e===he.RGBA8Uint||e===he.RGBA8Sint||e===he.BGRA8Unorm||e===he.BGRA8UnormSRGB||e===he.RG16Unorm||e===he.RG16Snorm||e===he.RGB9E5UFloat||e===he.RGB10A2Unorm||e===he.RG11B10UFloat||e===he.Depth32Float||e===he.Depth24Plus||e===he.Depth24PlusStencil8||e===he.Depth32FloatStencil8)return 4;if(e===he.RG32Uint||e===he.RG32Sint||e===he.RG32Float||e===he.RGBA16Uint||e===he.RGBA16Sint||e===he.RGBA16Float||e===he.RGBA16Unorm||e===he.RGBA16Snorm)return 8;if(e===he.RGBA32Uint||e===he.RGBA32Sint||e===he.RGBA32Float)return 16}_getTypedArrayType(e){if(e===he.R8Uint)return Uint8Array;if(e===he.R8Sint)return Int8Array;if(e===he.R8Unorm)return Uint8Array;if(e===he.R8Snorm)return Int8Array;if(e===he.RG8Uint)return Uint8Array;if(e===he.RG8Sint)return Int8Array;if(e===he.RG8Unorm)return Uint8Array;if(e===he.RG8Snorm)return Int8Array;if(e===he.RGBA8Uint)return Uint8Array;if(e===he.RGBA8Sint)return Int8Array;if(e===he.RGBA8Unorm||e===he.RGBA8UnormSRGB)return Uint8Array;if(e===he.RGBA8Snorm)return Int8Array;if(e===he.R16Uint)return Uint16Array;if(e===he.R16Sint)return Int16Array;if(e===he.RG16Uint)return Uint16Array;if(e===he.RG16Sint)return Int16Array;if(e===he.RGBA16Uint)return Uint16Array;if(e===he.RGBA16Sint)return Int16Array;if(e===he.R16Float||e===he.RG16Float||e===he.RGBA16Float||e===he.R16Unorm)return Uint16Array;if(e===he.R16Snorm)return Int16Array;if(e===he.RG16Unorm)return Uint16Array;if(e===he.RG16Snorm)return Int16Array;if(e===he.RGBA16Unorm)return Uint16Array;if(e===he.RGBA16Snorm)return Int16Array;if(e===he.R32Uint)return Uint32Array;if(e===he.R32Sint)return Int32Array;if(e===he.R32Float)return Float32Array;if(e===he.RG32Uint)return Uint32Array;if(e===he.RG32Sint)return Int32Array;if(e===he.RG32Float)return Float32Array;if(e===he.RGBA32Uint)return Uint32Array;if(e===he.RGBA32Sint)return Int32Array;if(e===he.RGBA32Float)return Float32Array;if(e===he.BGRA8Unorm||e===he.BGRA8UnormSRGB)return Uint8Array;if(e===he.RGB10A2Unorm||e===he.RGB9E5UFloat||e===he.RG11B10UFloat)return Uint32Array;if(e===he.Depth32Float)return Float32Array;if(e===he.Depth24Plus||e===he.Depth24PlusStencil8)return Uint32Array;if(e===he.Depth32FloatStencil8)return Float32Array}_getDimension(e){let t;return e.is3DTexture||e.isData3DTexture?t=NZ.ThreeD:t=NZ.TwoD,t}};function r7(i,e){let t=i.format,n=i.type,r=i.normalized,s=i.colorSpace,o=sn.getTransfer(s),a,l=!1;if(r&&(l=e.features.has(SC.TextureFormatsTier1),l===!1&&je("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case Ju:case eh:a=o===Bt?he.BC1RGBAUnormSRGB:he.BC1RGBAUnorm;break;case th:a=o===Bt?he.BC2RGBAUnormSRGB:he.BC2RGBAUnorm;break;case nh:a=o===Bt?he.BC3RGBAUnormSRGB:he.BC3RGBAUnorm;break;case Dp:a=he.BC4RUnorm;break;case Fp:a=he.BC4RSnorm;break;case rh:a=he.BC5RGUnorm;break;case Op:a=he.BC5RGSnorm;break;case Ip:a=o===Bt?he.BC7RGBAUnormSRGB:he.BC7RGBAUnorm;break;case Np:a=he.BC6HRGBFloat;break;case Lp:a=he.BC6HRGBUFloat;break;case fp:case hp:a=o===Bt?he.ETC2RGB8UnormSRGB:he.ETC2RGB8Unorm;break;case dp:a=o===Bt?he.ETC2RGBA8UnormSRGB:he.ETC2RGBA8Unorm;break;case pp:a=he.EACR11Unorm;break;case Ap:a=he.EACR11Snorm;break;case ih:a=he.EACRG11Unorm;break;case mp:a=he.EACRG11Snorm;break;case gp:a=o===Bt?he.ASTC4x4UnormSRGB:he.ASTC4x4Unorm;break;case _p:a=o===Bt?he.ASTC5x4UnormSRGB:he.ASTC5x4Unorm;break;case xp:a=o===Bt?he.ASTC5x5UnormSRGB:he.ASTC5x5Unorm;break;case yp:a=o===Bt?he.ASTC6x5UnormSRGB:he.ASTC6x5Unorm;break;case vp:a=o===Bt?he.ASTC6x6UnormSRGB:he.ASTC6x6Unorm;break;case bp:a=o===Bt?he.ASTC8x5UnormSRGB:he.ASTC8x5Unorm;break;case wp:a=o===Bt?he.ASTC8x6UnormSRGB:he.ASTC8x6Unorm;break;case Sp:a=o===Bt?he.ASTC8x8UnormSRGB:he.ASTC8x8Unorm;break;case Tp:a=o===Bt?he.ASTC10x5UnormSRGB:he.ASTC10x5Unorm;break;case Ep:a=o===Bt?he.ASTC10x6UnormSRGB:he.ASTC10x6Unorm;break;case Mp:a=o===Bt?he.ASTC10x8UnormSRGB:he.ASTC10x8Unorm;break;case Cp:a=o===Bt?he.ASTC10x10UnormSRGB:he.ASTC10x10Unorm;break;case Rp:a=o===Bt?he.ASTC12x10UnormSRGB:he.ASTC12x10Unorm;break;case Pp:a=o===Bt?he.ASTC12x12UnormSRGB:he.ASTC12x12Unorm;break;case br:a=o===Bt?he.RGBA8UnormSRGB:he.RGBA8Unorm;break;default:Ge("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case br:switch(n){case Yu:a=he.RGBA8Snorm;break;case Zu:a=l?he.RGBA16Snorm:he.RGBA16Sint;break;case Xa:a=l?he.RGBA16Unorm:he.RGBA16Uint;break;case Ai:a=he.RGBA32Uint;break;case Dr:a=he.RGBA32Sint;break;case zi:a=o===Bt?he.RGBA8UnormSRGB:he.RGBA8Unorm;break;case Di:a=he.RGBA16Float;break;case Zi:a=he.RGBA32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case Uf:switch(n){case GA:a=he.RGB9E5UFloat;break;case zA:a=he.RG11B10UFloat;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case kf:switch(n){case Yu:a=he.R8Snorm;break;case Zu:a=l?he.R16Snorm:he.R16Sint;break;case Xa:a=l?he.R16Unorm:he.R16Uint;break;case Ai:a=he.R32Uint;break;case Dr:a=he.R32Sint;break;case zi:a=he.R8Unorm;break;case Di:a=he.R16Float;break;case Zi:a=he.R32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case Ms:switch(n){case Yu:a=he.RG8Snorm;break;case Zu:a=l?he.RG16Snorm:he.RG16Sint;break;case Xa:a=l?he.RG16Unorm:he.RG16Uint;break;case Ai:a=he.RG32Uint;break;case Dr:a=he.RG32Sint;break;case zi:a=he.RG8Unorm;break;case Di:a=he.RG16Float;break;case Zi:a=he.RG32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case ws:switch(n){case Xa:a=he.Depth16Unorm;break;case Ai:a=he.Depth24Plus;break;case Zi:a=he.Depth32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case eo:switch(n){case Vo:a=he.Depth24PlusStencil8;break;case Zi:e&&e.features.has(SC.Depth32FloatStencil8)===!1&&Ge('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.'),a=he.Depth32FloatStencil8;break;default:Ge("WebGPURenderer: Unsupported texture type with DepthStencilFormat.",n)}break;case Ku:switch(n){case Dr:a=he.R32Sint;break;case Ai:a=he.R32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case Qu:switch(n){case Dr:a=he.RG32Sint;break;case Ai:a=he.RG32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case up:switch(n){case Dr:a=he.RGBA32Sint;break;case Ai:a=he.RGBA32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:Ge("WebGPURenderer: Unsupported texture format.",t)}return a}var l3e=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,c3e=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,FZ={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"},u3e=i=>{i=i.trim();let e=i.match(l3e);if(e!==null&&e.length===4){let t=e[2],n=[],r=null;for(;(r=c3e.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:p}=n[u],x=p;x.startsWith("ptr")?x="pointer":(x.startsWith("texture")&&(x=p.split("<")[0]),x=FZ[x]),s.push(new gb(x,f))}let o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:FZ[a]||a,inputs:s,name:l,inputsCode:t,blockCode:o,outputType:a}}else throw new Error("THREE.WGSLNodeFunction: Function is not a WGSL code.")},s7=class extends xb{constructor(e){let{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=u3e(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}},o7=class extends uC{parseFunction(e){return new s7(e)}},h3e={[Eo.READ_ONLY]:"read",[Eo.WRITE_ONLY]:"write",[Eo.READ_WRITE]:"read_write"},OZ={[Rf]:"repeat",[Go]:"clamp",[Pf]:"mirror"},D8={vertex:Nh.VERTEX,fragment:Nh.FRAGMENT,compute:Nh.COMPUTE},BZ={instance:!0,swizzleAssign:!1,storageBuffer:!0},f3e={"^^":"tsl_xor"},d3e={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>"},UZ={},Gv={tsl_xor:new Qi("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new Qi("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new Qi("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new Qi("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new Qi("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new Qi("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new Qi("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new Qi("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 Qi("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 Qi("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new Qi("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 Qi("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),inverse_mat2:new Qi(`44444444 fn tsl_inverse_mat2( m : mat2x2<f32> ) -> mat2x2<f32> {44454445 44464446 let det = m[ 0 ][ 0 ] * m[ 1 ][ 1 ] - m[ 0 ][ 1 ] * m[ 1 ][ 0 ];
@@ -4558,17 +4558,17 @@ fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRe
45584558 return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );45594559 45604560 }4561-`)},f3e={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"},$ee="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&($ee+=`diagnostic( off, derivative_uniformity );4562-`);var e7=class extends oC{constructor(e,t){super(e,t,new JB),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_${DZ[e.wrapS]}S_${DZ[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}`,n=OZ[t];if(n===void 0){let r=[],s=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f",o=`fn ${t}( coord : ${s} ) -> ${s} {4561+`)},p3e={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"},Zee="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(Zee+=`diagnostic( off, derivative_uniformity );4562+`);var a7=class extends lC{constructor(e,t){super(e,t,new o7),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_${OZ[e.wrapS]}S_${OZ[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}`,n=UZ[t];if(n===void 0){let r=[],s=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f",o=`fn ${t}( coord : ${s} ) -> ${s} {45634563 45644564 return ${s}(4565-`,a=(l,c)=>{l===Mf?(r.push(Uv.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${c} )`):l===Go?(r.push(Uv.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${c} )`):l===Cf?(r.push(Uv.mirrorWrapping_float),o+=` tsl_mirrorWrapping_float( coord.${c} )`):(o+=` coord.${c}`,je(`WebGPURenderer: Unsupported texture wrap type "${l}" for vertex shader.`))};a(e.wrapS,"x"),o+=`,4565+`,a=(l,c)=>{l===Rf?(r.push(Gv.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${c} )`):l===Go?(r.push(Gv.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${c} )`):l===Pf?(r.push(Gv.mirrorWrapping_float),o+=` tsl_mirrorWrapping_float( coord.${c} )`):(o+=` coord.${c}`,je(`WebGPURenderer: Unsupported texture wrap type "${l}" for vertex shader.`))};a(e.wrapS,"x"),o+=`,45664566 `,a(e.wrapT,"y"),(e.is3DTexture||e.isData3DTexture)&&(o+=`,45674567 `,a(e.wrapR,"z")),o+=`45684568 );45694569 45704570 }4571-`,OZ[t]=n=new Qi(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 E1(new C1(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new E1(new C1(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new E1(new C1("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 x=e.isDepthTexture?"u32":"f32";return`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${x}( ${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 )`,p=`${c}<f32>( ${l} - ${u} )`;return n=`${c}<u32>( clamp( floor( ${a}( ${n} ) * ${c}<f32>( ${l} ) ), ${f}, ${p} ) )`,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(kf.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.type===Zi||this.isSampleCompare(e)===!1&&e.minFilter===yi&&e.magFilter===yi||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]} )`;Ge(`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} )`;Ge(`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} )`;Ge(`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=u3e[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?e.isAtomic===!0?(je("WebGPURenderer: Atomic operations are only supported in compute shaders."),Eo.READ_WRITE):Eo.READ_ONLY:e.access}getStorageAccess(e,t){return c3e[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,p=this.getNodeAccess(e,n);if(t==="texture"||t==="storageTexture"?e.value.is3DTexture===!0?f=new _b(s.name,s.node,l,p):f=new B1(s.name,s.node,l,p):t==="cubeTexture"||t==="cubeDepthTexture"?f=new gC(s.name,s.node,l,p):t==="texture3D"&&(f=new _b(s.name,s.node,l,p)),f.store=e.isStorageTextureNode===!0,f.mipLevel=f.store?e.mipLevel:0,f.setVisibility(M8[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&f.store===!1||e.gatherNode!==null){let v=new kB(`${s.name}_sampler`,s.node,l);v.setVisibility(M8[n]),u.push(v,f),a=[v,f]}else u.push(f),a=[f]}else if(t==="buffer"||t==="storageBuffer"||t==="indirectStorageBuffer"){let f=this.getSharedDataFromNode(e),p=f.buffer;if(p===void 0){let x=t==="buffer"?pC:zB;p=new x(e,l),f.buffer=p}p.setVisibility(p.getVisibility()|M8[n]),u.push(p),a=p,s.name=r||"NodeBuffer_"+s.id}else{let f=this.uniformGroups[c];f===void 0&&(f=new AC(c,l),f.setVisibility(Ph.VERTEX|Ph.FRAGMENT|Ph.COMPUTE),this.uniformGroups[c]=f),u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let p=a.name;f.uniforms.some(v=>v.name===p)||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)} {4571+`,UZ[t]=n=new Qi(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 M1(new R1(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new M1(new R1(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new M1(new R1("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 x=e.isDepthTexture?"u32":"f32";return`textureSampleLevel( ${t}, ${t}_sampler, ${n}, ${x}( ${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 )`,p=`${c}<f32>( ${l} - ${u} )`;return n=`${c}<u32>( clamp( floor( ${a}( ${n} ) * ${c}<f32>( ${l} ) ), ${f}, ${p} ) )`,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(Gf.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.type===Zi||this.isSampleCompare(e)===!1&&e.minFilter===yi&&e.magFilter===yi||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]} )`;Ge(`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} )`;Ge(`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} )`;Ge(`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=f3e[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!=="compute"?e.isAtomic===!0?(je("WebGPURenderer: Atomic operations are only supported in compute shaders."),Eo.READ_WRITE):Eo.READ_ONLY:e.access}getStorageAccess(e,t){return h3e[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,p=this.getNodeAccess(e,n);if(t==="texture"||t==="storageTexture"?e.value.is3DTexture===!0?f=new yb(s.name,s.node,l,p):f=new U1(s.name,s.node,l,p):t==="cubeTexture"||t==="cubeDepthTexture"?f=new xC(s.name,s.node,l,p):t==="texture3D"&&(f=new yb(s.name,s.node,l,p)),f.store=e.isStorageTextureNode===!0,f.mipLevel=f.store?e.mipLevel:0,f.setVisibility(D8[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&f.store===!1||e.gatherNode!==null){let v=new jB(`${s.name}_sampler`,s.node,l);v.setVisibility(D8[n]),u.push(v,f),a=[v,f]}else u.push(f),a=[f]}else if(t==="buffer"||t==="storageBuffer"||t==="indirectStorageBuffer"){let f=this.getSharedDataFromNode(e),p=f.buffer;if(p===void 0){let x=t==="buffer"?mC:$B;p=new x(e,l),f.buffer=p}p.setVisibility(p.getVisibility()|D8[n]),u.push(p),a=p,s.name=r||"NodeBuffer_"+s.id}else{let f=this.uniformGroups[c];f===void 0&&(f=new gC(c,l),f.setVisibility(Nh.VERTEX|Nh.FRAGMENT|Nh.COMPUTE),this.uniformGroups[c]=f),u.indexOf(f)===-1&&u.push(f),a=this.getNodeUniform(s,t);let p=a.name;f.uniforms.some(v=>v.name===p)||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)} {45724572 ${n.vars}45734573 ${n.code}45744574 `;return n.result&&(s+=` return ${n.result};
@@ -4590,7 +4590,7 @@ ${n.code}
45904590 ${r.join(`45914591 `)}45924592 `}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(`,4593- `);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 p=c.node,x=p.value;(x.isCubeTexture===!0||this.isUnfilterable(x)===!1&&p.isStorageTextureNode!==!0||p.gatherNode!==null)&&(this.isSampleCompare(x)&&p.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(x);if(T>1&&(S="_multisampled"),x.isCubeTexture===!0&&x.isDepthTexture===!0)w="texture_depth_cube";else if(x.isCubeTexture===!0)w="texture_cube<f32>";else if(x.isDepthTexture===!0)t.compatibilityMode&&x.compareFunction===null?w=`texture${S}_2d<f32>`:w=`texture_depth${S}_2d${x.isArrayTexture===!0?"_array":""}`;else if(c.node.isStorageTextureNode===!0){let P=KB(x,t.device),R=this.getStorageAccess(c.node,e),C=c.node.value.is3DTexture,L=c.node.value.isArrayTexture;w=`texture_storage_${C?"3d":`2d${L?"_array":""}`}<${P}, ${R}>`}else if(x.isArrayTexture===!0||x.isDataArrayTexture===!0||x.isCompressedArrayTexture===!0)w="texture_2d_array<f32>";else if(x.is3DTexture===!0||x.isData3DTexture===!0)w="texture_3d<f32>";else{let P=this.getComponentTypeFromTexture(x).charAt(0);w=`texture${S}_2d<${P}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 p=c.node,x=this.getType(p.getNodeType(this)),v=p.bufferCount,w=v>0&&c.type==="buffer"?", "+v:"",S=p.isStorageBufferNode?`storage, ${this.getStorageAccess(p,e)}`:"uniform";if(this.isCustomStruct(c))s.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var<${S}> ${c.name} : ${x};`);else{let P=` value : array< ${p.isAtomic?`atomic<${x}>`:`${x}`}${w} >`;s.push(this._getWGSLStructBinding(c.name,P,S,f.binding++,f.group))}}else{let p=c.groupNode.name;if(a[p]===void 0){let x=this.uniformGroups[p];if(x!==void 0){let v=[];for(let S of x.uniforms){let T=S.getType(),P=this.getType(this.getVectorType(T));v.push(` ${S.name} : ${P}`)}let w=this.uniformGroupsBindings[p];w===void 0&&(w={index:f.binding++,id:f.group},this.uniformGroupsBindings[p]=w),a[p]={index:w.index,id:w.id,snippets:v}}}}}for(let c in a){let u=a[c];o.push(this._getWGSLStructBinding(c,u.snippets.join(`,4593+ `);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 p=c.node,x=p.value;(x.isCubeTexture===!0||this.isUnfilterable(x)===!1&&p.isStorageTextureNode!==!0||p.gatherNode!==null)&&(this.isSampleCompare(x)&&p.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(x);if(T>1&&(S="_multisampled"),x.isCubeTexture===!0&&x.isDepthTexture===!0)w="texture_depth_cube";else if(x.isCubeTexture===!0)w="texture_cube<f32>";else if(x.isDepthTexture===!0)t.compatibilityMode&&x.compareFunction===null?w=`texture${S}_2d<f32>`:w=`texture_depth${S}_2d${x.isArrayTexture===!0?"_array":""}`;else if(c.node.isStorageTextureNode===!0){let P=r7(x,t.device),R=this.getStorageAccess(c.node,e),C=c.node.value.is3DTexture,L=c.node.value.isArrayTexture;w=`texture_storage_${C?"3d":`2d${L?"_array":""}`}<${P}, ${R}>`}else if(x.isArrayTexture===!0||x.isDataArrayTexture===!0||x.isCompressedArrayTexture===!0)w="texture_2d_array<f32>";else if(x.is3DTexture===!0||x.isData3DTexture===!0)w="texture_3d<f32>";else{let P=this.getComponentTypeFromTexture(x).charAt(0);w=`texture${S}_2d<${P}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 p=c.node,x=this.getType(p.getNodeType(this)),v=p.bufferCount,w=v>0&&c.type==="buffer"?", "+v:"",S=p.isStorageBufferNode?`storage, ${this.getStorageAccess(p,e)}`:"uniform";if(this.isCustomStruct(c))s.push(`@binding( ${f.binding++} ) @group( ${f.group} ) var<${S}> ${c.name} : ${x};`);else{let P=` value : array< ${p.isAtomic?`atomic<${x}>`:`${x}`}${w} >`;s.push(this._getWGSLStructBinding(c.name,P,S,f.binding++,f.group))}}else{let p=c.groupNode.name;if(a[p]===void 0){let x=this.uniformGroups[p];if(x!==void 0){let v=[];for(let S of x.uniforms){let T=S.getType(),P=this.getType(this.getVectorType(T));v.push(` ${S.name} : ${P}`)}let w=this.uniformGroupsBindings[p];w===void 0&&(w={index:f.binding++,id:f.group},this.uniformGroupsBindings[p]=w),a[p]={index:w.index,id:w.id,snippets:v}}}}}for(let c in a){let u=a[c];o.push(this._getWGSLStructBinding(c,u.snippets.join(`,45944594 `),"uniform",u.index,u.id))}return[...r,...s,...o].join(`45954595 `)}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=`// code45964596
@@ -4603,7 +4603,7 @@ ${n.code}
46034603 `+v),r.returnType="OutputStruct",r.structs+=this._getWGSLStruct("OutputStruct",x),r.structs+=`46044604 var<private> output : OutputStruct;`,s+=`output.color = ${this.format(f.result,a.getNodeType(this),this.getOutputType())};46054605 4606- 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 h3e[e]||e}isAvailable(e){let t=FZ[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),FZ[e]=t),t}_getWGSLMethod(e){return Uv[e]!==void 0&&this._include(e),f3e[e]}_include(e){let t=Uv[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}4606+ 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 d3e[e]||e}isAvailable(e){let t=BZ[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),BZ[e]=t),t}_getWGSLMethod(e){return Gv[e]!==void 0&&this._include(e),p3e[e]}_include(e){let t=Gv[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}46074607 // directives46084608 ${e.directives}46094609
@@ -4634,7 +4634,7 @@ fn main( ${e.attributes} ) -> VaryingsStruct {
46344634 }46354635 `}_getWGSLFragmentCode(e){return`${this.getSignature()}46364636 // global4637-${$ee}4637+${Zee}46384638 46394639 // structs46404640 ${e.structs}
@@ -4697,10 +4697,10 @@ struct ${e} {
46974697 ${t}46984698 };`}_getWGSLStructBinding(e,t,n,r=0,s=0){let o=e+"Struct";return`${this._getWGSLStruct(o,t)}46994699 @binding( ${r} ) @group( ${s} )4700-var<${n}> ${e} : ${o};`}},$o=new f0,C8=new Gm,Yee=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"&&Yee.set(Float16Array,["float16"]);var d3e=new Map([[m_,["float16"]]]),p3e=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]),t7=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 p=0;p<l.length;p++)l[p]===65535&&(l[p]=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 p=n.itemSize*l.BYTES_PER_ELEMENT;c=Math.floor((p+3)/4)*4/l.BYTES_PER_ELEMENT}if(c!==void 0){let p=n.itemSize,x=new l.constructor(n.count*c);for(let v=0;v<n.count;v++)x.set(l.subarray(v*p,v*p+p),v*c);(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&(n.itemSize=c,n.array=x),l=x,s._itemSize=p,s._paddedItemSize=c}let u=l.byteLength,f=u+(4-u%4)%4;$o.label=n.name,$o.size=f,$o.usage=t,$o.mappedAtCreation=!0,o=a.createBuffer($o),$o.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=I_(a),p=f?1:a.BYTES_PER_ELEMENT;for(let x=0,v=u.length;x<v;x++){let w=u[x],S,T;if(c!==void 0){let R=Math.floor(w.start/l),C=Math.ceil((w.start+w.count)/l)-R;S=R*c*p,T=C*c*p}else S=w.start*p,T=w.count*p;let P=S*(f?a.BYTES_PER_ELEMENT:1);r.queue.writeBuffer(o,P,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,p;s.isInterleavedBufferAttribute===!0?(f=s.data.stride*o,p=s.data.isInstancedInterleavedBuffer?tM.Instance:tM.Vertex):(f=s.itemSize*o,p=s.isInstancedBufferAttribute?tM.Instance:tM.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:p},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 x=s.get(t);if(t._mapped===!0)throw new Error("THREE.WebGPUAttributeUtils: ReadbackBuffer must be released before being used again.");if(t._mapped=!0,x.readBufferGPU===void 0){$o.label=`${t.name}_readback`,$o.size=t.maxByteLength,$o.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer($o),$o.reset();let v=()=>{t.buffer=null,t._mapped=!1,u.unmap()},w=()=>{t.buffer=null,t._mapped=!1,u.destroy(),s.delete(t),t.removeEventListener("release",v),t.removeEventListener("dispose",w)};t.addEventListener("release",v),t.addEventListener("dispose",w),x.readBufferGPU=u}else u=x.readBufferGPU}else $o.label=`${e.name}_readback`,$o.size=c,$o.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer($o),$o.reset();C8.label=`readback_encoder_${e.name}`;let f=o.createCommandEncoder(C8);C8.reset(),f.copyBufferToBuffer(l,n,u,0,c);let p=f.finish();if(Sh(o,p),await u.mapAsync(GPUMapMode.READ,0,c),t===null){let v=u.getMappedRange(0,c).slice();return u.destroy(),v}else{if(t.isReadbackBuffer)return t.buffer=u.getMappedRange(0,c),t;{let x=u.getMappedRange(0,c);return new Uint8Array(t).set(new Uint8Array(x)),u.destroy(),t}}}_getVertexFormat(e){let{itemSize:t,normalized:n}=e,r=e.array.constructor,s=e.constructor,o;if(t===1)o=p3e.get(r);else{let l=(d3e.get(s)||Yee.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||Ge("WebGPUAttributeUtils: Vertex format not supported yet."),o}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}},El=new wC,kv=new f0,m1=new yb,n7=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},i7=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=G1(JSON.stringify(s)),a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new n7(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=I_(r),l=a?1:r.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let p=o[u],x=o[u+1],v=p.start+p.count;if(x!==void 0&&x.start===v)continue;let w=c*l,S=(v-c)*l,T=w*(a?r.BYTES_PER_ELEMENT:1);n.queue.writeBuffer(s,T,r,w,S),x!==void 0&&(c=x.start)}}}createBindGroupIndex(e,t){let r=this.backend.device,s=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,o=e[0];kv.label="bindingCameraIndex_"+o,kv.size=16,kv.usage=s;let a=r.createBuffer(kv);kv.reset(),r.queue.writeBuffer(a,0,e,0),El.label="bindGroupCameraIndex_"+o,El.layout=t,El.entries.push({binding:0,resource:{buffer:a}});let l=r.createBindGroup(El);return El.reset(),l}createBindGroup(e,t){let n=this.backend,r=n.device,s=0;El.label="bindGroup_"+e.name,El.layout=t;for(let a of e.bindings){if(a.isUniformBuffer){let l=n.get(a);El.entries.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){let l=n.get(a.attribute).buffer;El.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,p=`view-${l.texture.width}-${l.texture.height}`;if(l.texture.depthOrArrayLayers>1&&(p+=`-${l.texture.depthOrArrayLayers}`),p+=`-${u}-${f}`,c=l[p],c===void 0){let x=t3e.All,v;a.isSampledCubeTexture?v=So.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?v=So.TwoDArray:a.isSampledTexture3D?v=So.ThreeD:v=So.TwoD,m1.aspect=x,m1.dimension=v,m1.mipLevelCount=u,m1.baseMipLevel=f,c=l[p]=l.texture.createView(m1),m1.reset()}}El.entries.push({binding:s,resource:c})}else if(a.isSampler){let l=n.get(a);El.entries.push({binding:s,resource:l.sampler})}s++}let o=r.createBindGroup(El);return El.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&Ph.COMPUTE&&(r.access===Eo.READ_WRITE||r.access===Eo.WRITE_ONLY)?a.type=b8.Storage:a.type=b8.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===Eo.READ_WRITE?a.access=w8.ReadWrite:l===Eo.WRITE_ONLY?a.access=w8.WriteOnly:a.access=w8.ReadOnly,r.texture.isArrayTexture?a.viewDimension=So.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=So.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=gm.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=gm.UnfilterableFloat:a.sampleType=gm.Depth;else{let c=r.texture.type;c===Dr?a.sampleType=gm.SInt:c===pi?a.sampleType=gm.UInt:c===Zi&&(this.backend.hasFeature("float32-filterable")?a.sampleType=gm.Float:a.sampleType=gm.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=So.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=So.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=So.ThreeD),o.texture=a}else if(r.isSampler){let a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&r.textureNode.compareNode!==null&&s.hasCompatibility(kf.TEXTURE_COMPARE)?a.type=RZ.Comparison:a.type=RZ.NonFiltering),o.sampler=a}else Ge(`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()}},r7=class{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}},s7=class{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}},o7=class{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}},Gv=new s7,g1=new o7,_1=new SC,Ml=new TC,a7=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,p=c.get(o),x=[];for(let j of e.getBindings()){let K=c.get(j),{layoutGPU:ee}=K.layout;x.push(ee)}let v=c.attributeUtils.createShaderVertexBuffers(e),w;r.blending!==Yr&&(r.blending!==os||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),P=[];if(e.context.textures!==null){let j=e.context.textures,K=e.context.mrt;for(let ee=0;ee<j.length;ee++){let ae=j[ee],ce=f.getTextureFormatGPU(ae),de;if(K!==null)if(this.backend.compatibilityMode!==!0){let ve=K.getBlendMode(ae.name);ve.blending===t2?de=w:ve.blending!==Yr&&(de=this._getBlending(ve))}else Kn("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets."),de=w;else de=w;P.push({format:ce,blend:de,writeMask:T})}}else{let j=f.getCurrentColorFormat(e.context);P.push({format:j,blend:w,writeMask:T})}let R=c.get(a).module,C=c.get(l).module,L=this._getPrimitiveState(n,s,r),D=this._getDepthCompare(r),F=f.getCurrentDepthStencilFormat(e.context),N=this._getSampleCount(e.context);g1.bindGroupLayouts=x;let B=u.createPipelineLayout(g1);g1.reset(),Ml.label=`renderPipeline_${r.name||r.type}_${r.id}`,Ml.vertex=Object.assign({},R,{buffers:v}),Ml.fragment=Object.assign({},C,{targets:P}),Ml.primitive=L,Ml.multisample.count=N,Ml.multisample.alphaToCoverageEnabled=r.alphaToCoverage&&N>1,Ml.layout=B;let z={},V=e.context.depth,H=e.context.stencil;(V===!0||H===!0)&&(V===!0&&(z.format=F,z.depthWriteEnabled=r.depthWrite,z.depthCompare=D),H===!0&&(z.stencilFront=S,z.stencilBack=S,z.stencilReadMask=r.stencilFuncMask,z.stencilWriteMask=r.stencilWriteMask),r.polygonOffset===!0&&L.topology===Hv.TriangleList&&(z.depthBias=r.polygonOffsetUnits,z.depthBiasSlopeScale=r.polygonOffsetFactor,z.depthBiasClamp=0),Ml.depthStencil=z),u.pushErrorScope("validation");let Z=[{program:a,module:R.module},{program:l,module:C.module}],J=Ml.label;if(t===null)p.pipeline=u.createRenderPipeline(Ml),Ml.reset(),u.popErrorScope().then(j=>{j!==null&&(p.error=!0,Ge(`WebGPURenderer: Render pipeline creation failed (${J}): ${j.message}`),this._reportShaderDiagnostics(Z,J))});else{let j=new Promise(async K=>{try{let ee=null,ae=null;try{ae=u.createRenderPipelineAsync(Ml)}catch(de){ee=de}if(Ml.reset(),ae!==null)try{p.pipeline=await ae}catch(de){ee=de}let ce=await u.popErrorScope();if(ce!==null||ee!==null){p.error=!0;let de=ce&&ce.message||ee&&ee.message||"unknown";Ge(`WebGPURenderer: Async render pipeline creation failed (${J}): ${de}`),await this._reportShaderDiagnostics(Z,J)}}finally{K()}});t.push(j)}}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);_1.label=t,_1.colorFormats=a,_1.depthStencilFormat=o,_1.sampleCount=l;let c=s.createRenderBundleEncoder(_1);return _1.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 p=n.get(f),{layoutGPU:x}=p.layout;a.push(x)}let l=e.computeProgram,c=`computePipeline_${l.stage}${l.name?`_${l.name}`:""}`;r.pushErrorScope("validation"),g1.bindGroupLayouts=a;let u=r.createPipelineLayout(g1);g1.reset(),Gv.label=c,Gv.compute=s,Gv.layout=u,o.pipeline=r.createComputePipeline(Gv),Gv.reset(),r.popErrorScope().then(f=>{f!==null&&(o.error=!0,Ge(`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(`4700+var<${n}> ${e} : ${o};`}},$o=new d0,F8=new Vm,Kee=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"&&Kee.set(Float16Array,["float16"]);var A3e=new Map([[__,["float16"]]]),m3e=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]),l7=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 p=0;p<l.length;p++)l[p]===65535&&(l[p]=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 p=n.itemSize*l.BYTES_PER_ELEMENT;c=Math.floor((p+3)/4)*4/l.BYTES_PER_ELEMENT}if(c!==void 0){let p=n.itemSize,x=new l.constructor(n.count*c);for(let v=0;v<n.count;v++)x.set(l.subarray(v*p,v*p+p),v*c);(n.isStorageBufferAttribute||n.isStorageInstancedBufferAttribute)&&(n.itemSize=c,n.array=x),l=x,s._itemSize=p,s._paddedItemSize=c}let u=l.byteLength,f=u+(4-u%4)%4;$o.label=n.name,$o.size=f,$o.usage=t,$o.mappedAtCreation=!0,o=a.createBuffer($o),$o.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=N_(a),p=f?1:a.BYTES_PER_ELEMENT;for(let x=0,v=u.length;x<v;x++){let w=u[x],S,T;if(c!==void 0){let R=Math.floor(w.start/l),C=Math.ceil((w.start+w.count)/l)-R;S=R*c*p,T=C*c*p}else S=w.start*p,T=w.count*p;let P=S*(f?a.BYTES_PER_ELEMENT:1);r.queue.writeBuffer(o,P,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,p;s.isInterleavedBufferAttribute===!0?(f=s.data.stride*o,p=s.data.isInstancedInterleavedBuffer?iM.Instance:iM.Vertex):(f=s.itemSize*o,p=s.isInstancedBufferAttribute?iM.Instance:iM.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:p},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 x=s.get(t);if(t._mapped===!0)throw new Error("THREE.WebGPUAttributeUtils: ReadbackBuffer must be released before being used again.");if(t._mapped=!0,x.readBufferGPU===void 0){$o.label=`${t.name}_readback`,$o.size=t.maxByteLength,$o.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer($o),$o.reset();let v=()=>{t.buffer=null,t._mapped=!1,u.unmap()},w=()=>{t.buffer=null,t._mapped=!1,u.destroy(),s.delete(t),t.removeEventListener("release",v),t.removeEventListener("dispose",w)};t.addEventListener("release",v),t.addEventListener("dispose",w),x.readBufferGPU=u}else u=x.readBufferGPU}else $o.label=`${e.name}_readback`,$o.size=c,$o.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer($o),$o.reset();F8.label=`readback_encoder_${e.name}`;let f=o.createCommandEncoder(F8);F8.reset(),f.copyBufferToBuffer(l,n,u,0,c);let p=f.finish();if(Eh(o,p),await u.mapAsync(GPUMapMode.READ,0,c),t===null){let v=u.getMappedRange(0,c).slice();return u.destroy(),v}else{if(t.isReadbackBuffer)return t.buffer=u.getMappedRange(0,c),t;{let x=u.getMappedRange(0,c);return new Uint8Array(t).set(new Uint8Array(x)),u.destroy(),t}}}_getVertexFormat(e){let{itemSize:t,normalized:n}=e,r=e.array.constructor,s=e.constructor,o;if(t===1)o=m3e.get(r);else{let l=(A3e.get(s)||Kee.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||Ge("WebGPUAttributeUtils: Vertex format not supported yet."),o}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}},Ml=new TC,zv=new d0,g1=new bb,c7=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},u7=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=z1(JSON.stringify(s)),a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new c7(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=N_(r),l=a?1:r.BYTES_PER_ELEMENT,c=o[0].start;for(let u=0,f=o.length;u<f;u++){let p=o[u],x=o[u+1],v=p.start+p.count;if(x!==void 0&&x.start===v)continue;let w=c*l,S=(v-c)*l,T=w*(a?r.BYTES_PER_ELEMENT:1);n.queue.writeBuffer(s,T,r,w,S),x!==void 0&&(c=x.start)}}}createBindGroupIndex(e,t){let r=this.backend.device,s=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,o=e[0];zv.label="bindingCameraIndex_"+o,zv.size=16,zv.usage=s;let a=r.createBuffer(zv);zv.reset(),r.queue.writeBuffer(a,0,e,0),Ml.label="bindGroupCameraIndex_"+o,Ml.layout=t,Ml.entries.push({binding:0,resource:{buffer:a}});let l=r.createBindGroup(Ml);return Ml.reset(),l}createBindGroup(e,t){let n=this.backend,r=n.device,s=0;Ml.label="bindGroup_"+e.name,Ml.layout=t;for(let a of e.bindings){if(a.isUniformBuffer){let l=n.get(a);Ml.entries.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){let l=n.get(a.attribute).buffer;Ml.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,p=`view-${l.texture.width}-${l.texture.height}`;if(l.texture.depthOrArrayLayers>1&&(p+=`-${l.texture.depthOrArrayLayers}`),p+=`-${u}-${f}`,c=l[p],c===void 0){let x=i3e.All,v;a.isSampledCubeTexture?v=So.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?v=So.TwoDArray:a.isSampledTexture3D?v=So.ThreeD:v=So.TwoD,g1.aspect=x,g1.dimension=v,g1.mipLevelCount=u,g1.baseMipLevel=f,c=l[p]=l.texture.createView(g1),g1.reset()}}Ml.entries.push({binding:s,resource:c})}else if(a.isSampler){let l=n.get(a);Ml.entries.push({binding:s,resource:l.sampler})}s++}let o=r.createBindGroup(Ml);return Ml.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&Nh.COMPUTE&&(r.access===Eo.READ_WRITE||r.access===Eo.WRITE_ONLY)?a.type=R8.Storage:a.type=R8.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===Eo.READ_WRITE?a.access=P8.ReadWrite:l===Eo.WRITE_ONLY?a.access=P8.WriteOnly:a.access=P8.ReadOnly,r.texture.isArrayTexture?a.viewDimension=So.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=So.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=xm.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=xm.UnfilterableFloat:a.sampleType=xm.Depth;else{let c=r.texture.type;c===Dr?a.sampleType=xm.SInt:c===Ai?a.sampleType=xm.UInt:c===Zi&&(this.backend.hasFeature("float32-filterable")?a.sampleType=xm.Float:a.sampleType=xm.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=So.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=So.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=So.ThreeD),o.texture=a}else if(r.isSampler){let a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&r.textureNode.compareNode!==null&&s.hasCompatibility(Gf.TEXTURE_COMPARE)?a.type=IZ.Comparison:a.type=IZ.NonFiltering),o.sampler=a}else Ge(`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()}},h7=class{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}},f7=class{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}},d7=class{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}},Vv=new f7,_1=new d7,x1=new EC,Cl=new MC,p7=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,p=c.get(o),x=[];for(let j of e.getBindings()){let K=c.get(j),{layoutGPU:ee}=K.layout;x.push(ee)}let v=c.attributeUtils.createShaderVertexBuffers(e),w;r.blending!==Yr&&(r.blending!==os||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),P=[];if(e.context.textures!==null){let j=e.context.textures,K=e.context.mrt;for(let ee=0;ee<j.length;ee++){let ae=j[ee],ce=f.getTextureFormatGPU(ae),de;if(K!==null)if(this.backend.compatibilityMode!==!0){let ve=K.getBlendMode(ae.name);ve.blending===i2?de=w:ve.blending!==Yr&&(de=this._getBlending(ve))}else Kn("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets."),de=w;else de=w;P.push({format:ce,blend:de,writeMask:T})}}else{let j=f.getCurrentColorFormat(e.context);P.push({format:j,blend:w,writeMask:T})}let R=c.get(a).module,C=c.get(l).module,L=this._getPrimitiveState(n,s,r),D=this._getDepthCompare(r),F=f.getCurrentDepthStencilFormat(e.context),N=this._getSampleCount(e.context);_1.bindGroupLayouts=x;let B=u.createPipelineLayout(_1);_1.reset(),Cl.label=`renderPipeline_${r.name||r.type}_${r.id}`,Cl.vertex=Object.assign({},R,{buffers:v}),Cl.fragment=Object.assign({},C,{targets:P}),Cl.primitive=L,Cl.multisample.count=N,Cl.multisample.alphaToCoverageEnabled=r.alphaToCoverage&&N>1,Cl.layout=B;let z={},V=e.context.depth,H=e.context.stencil;(V===!0||H===!0)&&(V===!0&&(z.format=F,z.depthWriteEnabled=r.depthWrite,z.depthCompare=D),H===!0&&(z.stencilFront=S,z.stencilBack=S,z.stencilReadMask=r.stencilFuncMask,z.stencilWriteMask=r.stencilWriteMask),r.polygonOffset===!0&&L.topology===jv.TriangleList&&(z.depthBias=r.polygonOffsetUnits,z.depthBiasSlopeScale=r.polygonOffsetFactor,z.depthBiasClamp=0),Cl.depthStencil=z),u.pushErrorScope("validation");let Z=[{program:a,module:R.module},{program:l,module:C.module}],J=Cl.label;if(t===null)p.pipeline=u.createRenderPipeline(Cl),Cl.reset(),u.popErrorScope().then(j=>{j!==null&&(p.error=!0,Ge(`WebGPURenderer: Render pipeline creation failed (${J}): ${j.message}`),this._reportShaderDiagnostics(Z,J))});else{let j=new Promise(async K=>{try{let ee=null,ae=null;try{ae=u.createRenderPipelineAsync(Cl)}catch(de){ee=de}if(Cl.reset(),ae!==null)try{p.pipeline=await ae}catch(de){ee=de}let ce=await u.popErrorScope();if(ce!==null||ee!==null){p.error=!0;let de=ce&&ce.message||ee&&ee.message||"unknown";Ge(`WebGPURenderer: Async render pipeline creation failed (${J}): ${de}`),await this._reportShaderDiagnostics(Z,J)}}finally{K()}});t.push(j)}}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);x1.label=t,x1.colorFormats=a,x1.depthStencilFormat=o,x1.sampleCount=l;let c=s.createRenderBundleEncoder(x1);return x1.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 p=n.get(f),{layoutGPU:x}=p.layout;a.push(x)}let l=e.computeProgram,c=`computePipeline_${l.stage}${l.name?`_${l.name}`:""}`;r.pushErrorScope("validation"),_1.bindGroupLayouts=a;let u=r.createPipelineLayout(_1);_1.reset(),Vv.label=c,Vv.compute=s,Vv.layout=u,o.pipeline=r.createComputePipeline(Vv),Vv.reset(),r.popErrorScope().then(f=>{f!==null&&(o.error=!0,Ge(`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(`47014701 `);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=`47024702 ${o[a.lineNum-1]}`,a.linePos>0&&(u+=`4703- ${" ".repeat(a.linePos-1)}^`)),(a.type==="error"?Ge:je)(c+u)}}}_getBlending(e){let t,n,r=e.blending,s=e.blendSrc,o=e.blendDst,a=e.blendEquation;if(r===Of){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,p,x)=>{t={srcFactor:u,dstFactor:f,operation:mm.Add},n={srcFactor:p,dstFactor:x,operation:mm.Add}};if(l)switch(r){case os:c(si.One,si.OneMinusSrcAlpha,si.One,si.OneMinusSrcAlpha);break;case qu:c(si.One,si.One,si.One,si.One);break;case Hu:c(si.Zero,si.OneMinusSrc,si.Zero,si.One);break;case Wu:c(si.Dst,si.OneMinusSrcAlpha,si.Zero,si.One);break}else switch(r){case os:c(si.SrcAlpha,si.OneMinusSrcAlpha,si.One,si.OneMinusSrcAlpha);break;case qu:c(si.SrcAlpha,si.One,si.One,si.One);break;case Hu:Ge(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case Wu:Ge(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break}}if(t!==void 0&&n!==void 0)return{color:t,alpha:n};Ge("WebGPURenderer: Invalid blending: ",r)}_getBlendFactor(e){let t;switch(e){case Wc:t=si.Zero;break;case r2:t=si.One;break;case s2:t=si.Src;break;case o2:t=si.OneMinusSrc;break;case jd:t=si.SrcAlpha;break;case Xd:t=si.OneMinusSrcAlpha;break;case c2:t=si.Dst;break;case u2:t=si.OneMinusDst;break;case a2:t=si.DstAlpha;break;case l2:t=si.OneMinusDstAlpha;break;case h2:t=si.SrcAlphaSaturated;break;case J2e:t=si.Constant;break;case eve:t=si.OneMinusConstant;break;default:Ge("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,n=e.stencilFunc;switch(n){case AL:t=wo.Never;break;case vy:t=wo.Always;break;case mL:t=wo.Less;break;case _L:t=wo.LessEqual;break;case gL:t=wo.Equal;break;case vL:t=wo.GreaterEqual;break;case xL:t=wo.Greater;break;case yL:t=wo.NotEqual;break;default:Ge("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case wf:t=$p.Keep;break;case lL:t=$p.Zero;break;case cL:t=$p.Replace;break;case pL:t=$p.Invert;break;case uL:t=$p.IncrementClamp;break;case hL:t=$p.DecrementClamp;break;case fL:t=$p.IncrementWrap;break;case dL:t=$p.DecrementWrap;break;default:Ge("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case Gs:t=mm.Add;break;case n2:t=mm.Subtract;break;case i2:t=mm.ReverseSubtract;break;case YT:t=mm.Min;break;case ZT:t=mm.Max;break;default:Ge("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?vC.Uint16:vC.Uint32);let o=n.side===ui;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(o=!o),r.frontFace=o===!0?EZ.CW:EZ.CCW,r.cullMode=n.side===rr?MZ.None:MZ.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?CZ.All:CZ.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=wo.Always;else{let n=this.backend.parameters.reversedDepthBuffer?E2[e.depthFunc]:e.depthFunc;switch(n){case dA:t=wo.Never;break;case pA:t=wo.Always;break;case AA:t=wo.Less;break;case ku:t=wo.LessEqual;break;case mA:t=wo.Equal;break;case gA:t=wo.GreaterEqual;break;case _A:t=wo.Greater;break;case xA:t=wo.NotEqual;break;default:Ge("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}},CC=class{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}},yh=new f0,A3e=new Gm,zv=new CC,l7=class extends xC{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,zv.label=`queryset_global_timestamp_${t}`,zv.type="timestamp",zv.count=this.maxQueries,this.querySet=this.device.createQuerySet(zv),zv.reset();let r=this.maxQueries*8;yh.label=`buffer_timestamp_resolve_${t}`,yh.size=r,yh.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(yh),yh.reset(),yh.label=`buffer_timestamp_result_${t}`,yh.size=r,yh.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(yh),yh.reset()}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return Kn(`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(A3e);r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);let s=r.finish();if(Sh(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 p=u.match(/^(.*):f(\d+)$/),x=parseInt(p[2]);l.includes(x)===!1&&l.push(x),a[x]===void 0&&(a[x]=0);let v=o[f],w=o[f+1],S=Number(w-v)/1e6;this.timestamps.set(u,S),a[x]+=S}let c=a[l[l.length-1]];return this.resultBuffer.unmap(),this.lastValue=c,this.frames=l,c}catch(e){return Ge("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){Ge("Error waiting for pending resolve:",e)}if(this.resultBuffer&&this.resultBuffer.mapState==="mapped")try{this.resultBuffer.unmap()}catch(e){Ge("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}}},c7=class{constructor(){this.label="",this.timestampWrites=void 0}reset(){this.label="",this.timestampWrites=void 0}},w1=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}},u7=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}},eu={r:0,g:0,b:0,a:1},Cl=new f0,wa=new Gm,aM=new c7,Vv=new CC,lM=new EC,cM=new u7,uc=new U1,vh=new U1,hr=new yb,$f=new MC,h7=class extends _C{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 VB(this),this.attributeUtils=new t7(this),this.bindingUtils=new i7(this),this.capabilities=new r7(this),this.pipelineUtils=new a7(this),this.textureUtils=new ZB(this),this.occludedResolveCache=new Map;let t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[kf.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(bC),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(bC.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===Di?"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 Ha}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 Im,s.colorAttachments.push(new Pm),e.depth===!0||e.stencil===!0){let l=new w1;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:So.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=[],p,x=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(hr.label=`colorAttachment_${w}`,hr.baseMipLevel=e.activeMipmapLevel,hr.mipLevelCount=1,hr.baseArrayLayer=e.activeCubeFace,hr.arrayLayerCount=1,hr.dimension=So.TwoD,n.isRenderTarget3D)p=e.activeCubeFace,hr.baseArrayLayer=0,hr.dimension=So.ThreeD;else if(n.isRenderTarget&&u[w].image.depth>1)if(x===!0){let T=e.camera.cameras;for(let P=0;P<T.length;P++){hr.baseArrayLayer=P,hr.arrayLayerCount=1,hr.dimension=So.TwoD;let R=S.texture.createView(hr);f.push({view:R,resolveTarget:void 0,depthSlice:void 0})}}else hr.dimension=So.TwoDArray;if(x!==!0){let T=S.texture.createView(hr),P,R;S.msaaTexture!==void 0?(P=S.msaaTexture.createView(),R=T):(P=T,R=void 0),f.push({view:P,resolveTarget:R,depthSlice:p})}hr.reset()}let v=[];for(let w=0;w<f.length;w++){let S=f[w],T=new Pm;T.view=S.view,T.depthSlice=S.depthSlice,T.resolveTarget=S.resolveTarget,v.push(T)}if(l={textureViews:f,colorAttachments:v,descriptor:new Im},e.depth){let w=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(hr.dimension=So.TwoD,hr.arrayLayerCount=1,hr.baseArrayLayer=e.activeCubeFace);let S=new w1;S.view=w.texture.createView(hr),l.depthStencilAttachment=S,hr.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],p={r:0,g:0,b:0,a:1};u===0&&t.clearValue&&(p=t.clearValue),f.loadOp=t.loadOp||Mi.Load,f.storeOp=t.storeOp||Sa.Store,f.clearValue=p,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,Vv.label=`occlusionQuerySet_${e.id}`,Vv.type="occlusion",Vv.count=r,s=n.createQuerySet(Vv),Vv.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:Mi.Load}),this.initTimestampQuery(rc.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:(eu.r=0,eu.g=0,eu.b=0,eu.a=1,f.clearValue=eu),f.loadOp=Mi.Clear):f.loadOp=Mi.Load,f.storeOp=Sa.Store}}else{let c=o.colorAttachments[0];e.clearColor?(c.clearValue=e.clearColorValue,c.loadOp=Mi.Clear):c.loadOp=Mi.Load,c.storeOp=Sa.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Mi.Clear):a.depthLoadOp=Mi.Load,a.depthStoreOp=Sa.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Mi.Clear):a.stencilLoadOp=Mi.Load,a.stencilStoreOp=Sa.Store),wa.label="renderContext_"+e.id;let l=n.createCommandEncoder(wa);if(wa.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),p={attributes:{},bindingGroups:[],pipeline:null,index:null};t.bundleEncoders.push(f),t.bundleSets.push(p)}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 Pm;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 Im;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]||(hr.dimension=So.TwoD,hr.baseArrayLayer=a,hr.arrayLayerCount=1,o.viewCache[f]=o.texture.createView(hr),hr.reset());let p=new w1;p.view=o.viewCache[f],p.depthLoadOp=s.depthLoadOp||Mi.Clear,p.depthStoreOp=s.depthStoreOp||Sa.Store,p.depthClearValue=s.depthClearValue||1,e.stencil&&(p.stencilLoadOp=s.stencilLoadOp,p.stencilStoreOp=s.stencilStoreOp,p.stencilClearValue=s.stencilClearValue),u.depthStencilAttachment=p}else{let f=new w1;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=Mi.Clear):o.depthLoadOp=Mi.Load),e.stencil&&(e.clearStencil?(o.stencilClearValue=e.clearStencilValue,o.stencilLoadOp=Mi.Clear):o.stencilLoadOp=Mi.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:p,minDepth:x,maxDepth:v}=e.viewportValue;l.setViewport(c,u,f,p,x,v)}if(e.scissor){let{x:c,y:u,width:f,height:p}=e.scissorValue;l.setScissorRect(c,u,f,p)}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&&(Cl.size=s,Cl.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,o=this.device.createBuffer(Cl),Cl.reset(),this.occludedResolveCache.set(s,o)),Cl.size=s,Cl.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let a=this.device.createBuffer(Cl);Cl.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(Sh(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 x=this.getClearColor();eu.r=x.r,eu.g=x.g,eu.b=x.b,eu.a=x.a}if(r===null){c=o.depth,u=o.stencil;let x=this._getDefaultRenderPassDescriptor();if(e){a=x.colorAttachments;let v=a[0];v.clearValue=eu,v.loadOp=Mi.Clear,v.storeOp=Sa.Store}(c||u)&&(l=x.depthStencilAttachment)}else{c=r.depth,u=r.stencil;let x={loadOp:e?Mi.Clear:Mi.Load,clearValue:e?eu:void 0};c&&(x.depthLoadOp=t?Mi.Clear:Mi.Load,x.depthClearValue=t?o.getClearDepth():void 0,x.depthStoreOp=Sa.Store),u&&(x.stencilLoadOp=n?Mi.Clear:Mi.Load,x.stencilClearValue=n?o.getClearStencil():void 0,x.stencilStoreOp=Sa.Store);let v=this._getRenderPassDescriptor(r,x);a=v.colorAttachments,l=v.depthStencilAttachment}c&&l&&(t?(l.depthLoadOp=Mi.Clear,l.depthClearValue=o.getClearDepth(),l.depthStoreOp=Sa.Store):(l.depthLoadOp=Mi.Load,l.depthStoreOp=Sa.Store)),u&&l&&(n?(l.stencilLoadOp=Mi.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=Sa.Store):(l.stencilLoadOp=Mi.Load,l.stencilStoreOp=Sa.Store)),wa.label="clear";let f=s.createCommandEncoder(wa);wa.reset(),f.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),Sh(s,f.finish())}beginCompute(e){let t=this.get(e),n="computeGroup_"+e.id;aM.label=n,wa.label=n,this.initTimestampQuery(rc.COMPUTE,this.getTimestampUID(e),aM),t.cmdEncoderGPU=this.device.createCommandEncoder(wa),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(aM),t.currentPipeline=null,wa.reset(),aM.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 p=n[u],x=this.get(p);l.setBindGroup(u,x.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,p=f[0];for(let w=1;w<f.length;w++)p*=f[w];let x=Math.ceil(u/p),v=this.device.limits.maxComputeWorkgroupsPerDimension;s=[x,1,1],x>v&&(s[0]=Math.min(x,v),s[1]=Math.ceil(x/v)),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(),Sh(this.device,t.cmdEncoderGPU.finish())}_draw(e,t,n,r,s,o,a,l,c){let{object:u,material:f,context:p}=e,x=e.getIndex(),v=x!==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 P=s[S];if(w[S]!==P.id){let R=this.get(P);l.setBindGroup(S,R.group),w[S]=P.id}}if(v===!0&&c.index!==x){let S=this.get(x).buffer,T=x.array instanceof Uint16Array?vC.Uint16:vC.Uint32;l.setIndexBuffer(S,T),c.index=x}for(let S=0,T=o.length;S<T;S++){let P=o[S];if(c.attributes[S]!==P){let R=this.get(P).buffer;l.setVertexBuffer(S,R),c.attributes[S]=P}}if(p.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,P=u._multiDrawCount,R=v===!0?x.array.BYTES_PER_ELEMENT:1;f.wireframe&&(R=u.geometry.attributes.position.count>65535?4:2);for(let C=0;C<P;C++)v===!0?l.drawIndexed(T[C],1,S[C]/R,0,C):l.draw(T[C],1,S[C],C),t.update(u,T[C],1)}else if(v===!0){let{vertexCount:S,instanceCount:T,firstVertex:P}=a,R=e.getIndirect();if(R!==null){let C=this.get(R).buffer,L=e.getIndirectOffset(),D=Array.isArray(L)?L:[L];for(let F=0;F<D.length;F++)l.drawIndexedIndirect(C,D[F])}else l.drawIndexed(S,T,P,0,0);t.update(u,S,T)}else{let{vertexCount:S,instanceCount:T,firstVertex:P}=a,R=e.getIndirect();if(R!==null){let C=this.get(R).buffer,L=e.getIndirectOffset(),D=Array.isArray(L)?L:[L];for(let F=0;F<D.length;F++)l.drawIndirect(C,D[F])}else l.draw(S,T,P,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 p=this.get(e.camera),x=e.camera.cameras,v=e.getBindingGroup("cameraIndex");if(p.indexesGPU===void 0||p.indexesGPU.length!==x.length){let S=this.get(v),T=[],P=new Uint32Array([0,0,0,0]);for(let R=0,C=x.length;R<C;R++){P[0]=R;let{layoutGPU:L}=S.layout,D=this.bindingUtils.createBindGroupIndex(P,L);T.push(D)}p.indexesGPU=T}let w=this.renderer.getPixelRatio();for(let S=0,T=x.length;S<T;S++){let P=x[S];if(n.layers.test(P.layers)){let R=P.viewport,C=o.currentPass,L=o.currentSets,D=o.bundleEncoders!==void 0;if(D){let F=o.bundleEncoders[S],N=o.bundleSets[S];C=F,L=N}if(R&&!D&&C.setViewport(Math.floor(R.x*w),Math.floor(R.y*w),Math.floor(R.width*w),Math.floor(R.height*w),r.viewportValue.minDepth,r.viewportValue.maxDepth),v&&p.indexesGPU){let F=u.indexOf(v);C.setBindGroup(F,p.indexesGPU[S]),L.bindingGroups[F]=v.id}this._draw(e,t,o,l,u,f,c,C,L)}}}else if(o.currentPass){if(o.occlusionQuerySet!==void 0){let p=o.lastOcclusionObject;p!==n&&(p!==null&&p.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,p=!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,p=!0),p}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 l7(this.device,e,2048));let r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);cM.querySet=r.querySet,cM.beginningOfPassWriteIndex=s,cM.endOfPassWriteIndex=s+1,n.timestampWrites=cM}createNodeBuilder(e,t){return new e7(e,t)}createProgram(e){let t=this.get(e);lM.label=e.stage+(e.name!==""?`_${e.name}`:""),lM.code=e.code,t.module={module:this.device.createShaderModule(lM),entryPoint:"main"},lM.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&Ph.VERTEX&&s.push("vertex"),e.visibility&Ph.FRAGMENT&&s.push("fragment"),e.visibility&Ph.COMPUTE&&s.push("compute");let o=`(${s.join(",")})`;Cl.label=`bindingBuffer${e.id}_${e.name}_${o}`,Cl.size=n,Cl.usage=r;let a=this.device.createBuffer(Cl);Cl.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 IZ[e]!==void 0&&(e=IZ[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,p=0,x=e.image.width,v=e.image.height,w=1;n!==null&&(n.isBox3===!0?(u=n.min.x,f=n.min.y,p=n.min.z,x=n.max.x-n.min.x,v=n.max.y-n.min.y,w=n.max.z-n.min.z):(u=n.min.x,f=n.min.y,x=n.max.x-n.min.x,v=n.max.y-n.min.y,w=1)),r!==null&&(a=r.x,l=r.y,c=r.z||0),wa.label="copyTextureToTexture_"+e.id+"_"+t.id;let S=this.device.createCommandEncoder(wa);wa.reset();let T=this.get(e).texture,P=this.get(t).texture;uc.texture=T,uc.mipLevel=s,uc.origin.x=u,uc.origin.y=f,uc.origin.z=p,vh.texture=P,vh.mipLevel=o,vh.origin.x=a,vh.origin.y=l,vh.origin.z=c,$f.width=x,$f.height=v,$f.depthOrArrayLayers=w,S.copyTextureToTexture(uc,vh,$f),uc.reset(),vh.reset(),$f.reset(),Sh(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){Ge("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):(wa.label="copyFramebufferToTexture_"+e.id,a=this.device.createCommandEncoder(wa),wa.reset()),uc.texture=s,uc.origin.x=n.x,uc.origin.y=n.y,vh.texture=o,$f.width=n.z,$f.height=n.w,a.copyTextureToTexture(uc,vh,$f),uc.reset(),vh.reset(),$f.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=Mi.Load;t.depth&&(l.depthStencilAttachment.depthLoadOp=Mi.Load),t.stencil&&(l.depthStencilAttachment.stencilLoadOp=Mi.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 Sh(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()}},f7=class extends IA{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}},d7=class extends IA{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}},p7=class extends uC{constructor(){super(),this.addMaterial(BF,"MeshPhongMaterial"),this.addMaterial(VM,"MeshStandardMaterial"),this.addMaterial(WF,"MeshPhysicalMaterial"),this.addMaterial(XF,"MeshToonMaterial"),this.addMaterial(FF,"MeshBasicMaterial"),this.addMaterial(OF,"MeshLambertMaterial"),this.addMaterial(IF,"MeshNormalMaterial"),this.addMaterial($F,"MeshMatcapMaterial"),this.addMaterial(CF,"LineBasicMaterial"),this.addMaterial(RF,"LineDashedMaterial"),this.addMaterial(ZF,"PointsMaterial"),this.addMaterial(qM,"SpriteMaterial"),this.addMaterial(QF,"ShadowMaterial"),this.addLight(VO,Xy),this.addLight(fB,NA),this.addLight(gB,$y),this.addLight(mb,IA),this.addLight(hB,LA),this.addLight(dB,Wy),this.addLight(AB,Yy),this.addLight(pB,f7),this.addLight(mB,d7),this.addToneMapping(pee,f2),this.addToneMapping(Aee,d2),this.addToneMapping(mee,p2),this.addToneMapping(gee,A2),this.addToneMapping(_ee,m2),this.addToneMapping(xee,g2)}},k1=class extends EB{constructor(e={}){let t;e.forceWebGL?t=yC:(t=h7,e.getFallback=()=>(je("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new yC(e)));let n=new t(e);super(n,e),this.library=new p7,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};var zJe=k.BRDF_GGX,VJe=k.BRDF_Lambert,qJe=k.BasicPointShadowFilter,HJe=k.BasicShadowFilter,WJe=k.Break,jJe=k.Const,XJe=k.Continue,$Je=k.DFGLUT,YJe=k.D_GGX,ZJe=k.Discard,KJe=k.EPSILON,QJe=k.F_Schlick,Zee=k.Fn,JJe=k.INFINITY,Kee=k.If,Qee=k.Loop,eet=k.NodeAccess,tet=k.NodeShaderStage,net=k.NodeType,iet=k.NodeUpdateType,ret=k.PCFShadowFilter,set=k.PCFSoftShadowFilter,oet=k.PI,aet=k.PI2,cet=k.TWO_PI,uet=k.HALF_PI,het=k.PointShadowFilter,fet=k.Return,det=k.Schlick_to_F0,pet=k.ShaderNode,Aet=k.Stack,met=k.Switch,get=k.TBNViewMatrix,_et=k.VSMShadowFilter,xet=k.V_GGX_SmithCorrelated,yet=k.Var,vet=k.VarIntent,bet=k.abs,wet=k.acesFilmicToneMapping,Tet=k.acos,Eet=k.acosh,Met=k.add,Cet=k.addMethodChaining,Ret=k.addNodeElement,Pet=k.agxToneMapping,Iet=k.all,Net=k.alphaT,Let=k.ambientOcclusion,Det=k.and,Fet=k.anisotropy,Oet=k.anisotropyB,Bet=k.anisotropyT,Uet=k.any,ket=k.append,Get=k.array,Jee=k.asin,zet=k.asinh,Vet=k.assign,qet=k.atan,Het=k.atanh,Wet=k.atomicAdd,jet=k.atomicAnd,Xet=k.atomicFunc,$et=k.atomicLoad,Yet=k.atomicMax,Zet=k.atomicMin,Ket=k.atomicOr,Qet=k.atomicStore,Jet=k.atomicSub,ett=k.atomicXor,ttt=k.attenuationColor,ntt=k.attenuationDistance,itt=k.attribute,rtt=k.attributeArray,stt=k.backgroundBlurriness,ott=k.backgroundIntensity,att=k.backgroundRotation,ltt=k.batch,ctt=k.bentNormalView,utt=k.billboarding,htt=k.bitAnd,ftt=k.bitNot,dtt=k.bitOr,ptt=k.bitXor,Att=k.bitangentGeometry,mtt=k.bitangentLocal,gtt=k.bitangentView,_tt=k.bitangentWorld,xtt=k.bitcast,ytt=k.blendBurn,vtt=k.blendColor,btt=k.blendDodge,wtt=k.blendOverlay,Stt=k.blendScreen,Ttt=k.blur,Ett=k.bool,Mtt=k.buffer,Ctt=k.bufferAttribute,Rtt=k.bumpMap,Ptt=k.builtin,Itt=k.builtinAOContext,Ntt=k.builtinShadowContext,Ltt=k.bvec2,Dtt=k.bvec3,Ftt=k.bvec4,Ott=k.bypass,Btt=k.cache,Utt=k.call,ktt=k.cameraFar,Gtt=k.cameraIndex,ztt=k.cameraNear,Vtt=k.cameraNormalMatrix,qtt=k.cameraPosition,Htt=k.cameraProjectionMatrix,Wtt=k.cameraProjectionMatrixInverse,jtt=k.cameraViewMatrix,Xtt=k.cameraViewport,$tt=k.cameraWorldMatrix,Ytt=k.cbrt,Ztt=k.cdl,Ktt=k.ceil,Qtt=k.checker,Jtt=k.cineonToneMapping,ent=k.clamp,tnt=k.clearcoat,nnt=k.clearcoatNormalView,int=k.clearcoatRoughness,rnt=k.clipSpace,snt=k.code,ont=k.color,ant=k.colorSpaceToWorking,lnt=k.colorToDirection,cnt=k.compute,unt=k.computeKernel,hnt=k.computeSkinning,fnt=k.context,dnt=k.convert,pnt=k.convertColorSpace,Ant=k.convertToTexture,mnt=k.countLeadingZeros,gnt=k.countOneBits,_nt=k.countTrailingZeros,ete=k.cos,xnt=k.cosh,ynt=k.cross,vnt=k.cubeTexture,bnt=k.cubeTextureBase,wnt=k.dFdx,Snt=k.dFdy,Tnt=k.dashSize,Ent=k.debug,Mnt=k.decrement,Cnt=k.decrementBefore,Rnt=k.defaultBuildStages,Pnt=k.defaultShaderStages,Int=k.defined,Nnt=k.degrees,Lnt=k.deltaTime,Dnt=k.densityFog,Fnt=k.densityFogFactor,Ont=k.depth,Bnt=k.depthPass,Unt=k.determinant,knt=k.difference,Gnt=k.diffuseColor,znt=k.directPointLight,Vnt=k.directionToColor,qnt=k.directionToFaceDirection,Hnt=k.dispersion,Wnt=k.distance,jnt=k.div,Xnt=k.dot,$nt=k.drawIndex,Ynt=k.dynamicBufferAttribute,Znt=k.element,Knt=k.emissive,Qnt=k.equal,Jnt=k.equirectDirection,eit=k.equirectUV,tte=k.exp,tit=k.exp2,nit=k.exponentialHeightFogFactor,iit=k.expression,rit=k.faceDirection,sit=k.faceForward,oit=k.faceforward,nte=k.float,ait=k.floatBitsToInt,lit=k.floatBitsToUint,cit=k.floor,uit=k.fog,hit=k.fract,fit=k.frameGroup,dit=k.frameId,pit=k.frontFacing,Ait=k.fwidth,mit=k.gain,git=k.gapSize,_it=k.getConstNodeType,xit=k.getCurrentStack,yit=k.getDirection,vit=k.getDistanceAttenuation,bit=k.getGeometryRoughness,wit=k.getNormalFromDepth,Sit=k.interleavedGradientNoise,Tit=k.vogelDiskSample,Eit=k.getParallaxCorrectNormal,Mit=k.getRoughness,Cit=k.getScreenPosition,Rit=k.getShIrradianceAt,Pit=k.getShadowMaterial,Iit=k.getShadowRenderObjectFunction,Nit=k.getTextureIndex,Lit=k.getViewPosition,Dit=k.globalId,Fit=k.glsl,Oit=k.glslFn,Bit=k.grayscale,Uit=k.greaterThan,kit=k.greaterThanEqual,Git=k.hash,zit=k.highpModelNormalViewMatrix,Vit=k.highpModelViewMatrix,qit=k.hue,Hit=k.increment,Wit=k.incrementBefore,jit=k.instance,ite=k.instanceIndex,Xit=k.instancedArray,$it=k.instancedBufferAttribute,Yit=k.instancedDynamicBufferAttribute,Zit=k.instancedMesh,Kit=k.int,Qit=k.intBitsToFloat,Jit=k.inverse,ert=k.inverseSqrt,trt=k.inversesqrt,nrt=k.invocationLocalIndex,irt=k.invocationSubgroupIndex,rrt=k.ior,srt=k.iridescence,ort=k.iridescenceIOR,art=k.iridescenceThickness,lrt=k.ivec2,crt=k.ivec3,urt=k.ivec4,hrt=k.js,frt=k.label,drt=k.length,prt=k.lengthSq,Art=k.lessThan,mrt=k.lessThanEqual,grt=k.lightPosition,_rt=k.lightProjectionUV,xrt=k.lightShadowMatrix,yrt=k.lightTargetDirection,vrt=k.lightTargetPosition,brt=k.lightViewPosition,wrt=k.lightingContext,Srt=k.lights,Trt=k.linearDepth,Ert=k.linearToneMapping,Mrt=k.localId,Crt=k.log,Rrt=k.log2,Prt=k.logarithmicDepthToViewZ,Irt=k.luminance,Nrt=k.mat2,Lrt=k.mat3,Drt=k.mat4,Frt=k.matcapUV,Ort=k.materialAO,Brt=k.materialAlphaTest,Urt=k.materialAnisotropy,krt=k.materialAnisotropyVector,Grt=k.materialAttenuationColor,zrt=k.materialAttenuationDistance,Vrt=k.materialClearcoat,qrt=k.materialClearcoatNormal,Hrt=k.materialClearcoatRoughness,Wrt=k.materialColor,jrt=k.materialDispersion,Xrt=k.materialEmissive,$rt=k.materialEnvIntensity,Yrt=k.materialEnvRotation,Zrt=k.materialIOR,Krt=k.materialIridescence,Qrt=k.materialIridescenceIOR,Jrt=k.materialIridescenceThickness,est=k.materialLightMap,tst=k.materialLineDashOffset,nst=k.materialLineDashSize,ist=k.materialLineGapSize,rst=k.materialLineScale,sst=k.materialLineWidth,ost=k.materialMetalness,ast=k.materialNormal,lst=k.materialOpacity,cst=k.materialPointSize,ust=k.materialReference,hst=k.materialReflectivity,fst=k.materialRefractionRatio,dst=k.materialRotation,pst=k.materialRoughness,Ast=k.materialSheen,mst=k.materialSheenRoughness,gst=k.materialShininess,_st=k.materialSpecular,xst=k.materialSpecularColor,yst=k.materialSpecularIntensity,vst=k.materialSpecularStrength,bst=k.materialThickness,wst=k.materialTransmission,Sst=k.max,Tst=k.maxMipLevel,Est=k.mediumpModelViewMatrix,Mst=k.metalness,Cst=k.min,Rst=k.mix,Pst=k.mixElement,Ist=k.mod,Nst=k.modelDirection,Lst=k.modelNormalMatrix,Dst=k.modelPosition,Fst=k.modelRadius,Ost=k.modelScale,Bst=k.modelViewMatrix,Ust=k.modelViewPosition,kst=k.modelViewProjection,Gst=k.modelWorldMatrix,zst=k.modelWorldMatrixInverse,Vst=k.morphReference,qst=k.mrt,Hst=k.mul,Wst=k.mx_aastep,jst=k.mx_add,Xst=k.mx_atan2,$st=k.mx_cell_noise_float,Yst=k.mx_contrast,Zst=k.mx_divide,Kst=k.mx_fractal_noise_float,Qst=k.mx_fractal_noise_vec2,Jst=k.mx_fractal_noise_vec3,eot=k.mx_fractal_noise_vec4,tot=k.mx_frame,not=k.mx_heighttonormal,iot=k.mx_hsvtorgb,rot=k.mx_ifequal,sot=k.mx_ifgreater,oot=k.mx_ifgreatereq,aot=k.mx_invert,lot=k.mx_modulo,cot=k.mx_multiply,uot=k.mx_noise_float,hot=k.mx_noise_vec3,fot=k.mx_noise_vec4,dot=k.mx_place2d,pot=k.mx_power,Aot=k.mx_ramp4,mot=k.mx_ramplr,got=k.mx_ramptb,_ot=k.mx_rgbtohsv,xot=k.mx_rotate2d,yot=k.mx_rotate3d,vot=k.mx_safepower,bot=k.mx_separate,wot=k.mx_splitlr,Sot=k.mx_splittb,Tot=k.mx_srgb_texture_to_lin_rec709,Eot=k.mx_subtract,Mot=k.mx_timer,Cot=k.mx_transform_uv,Rot=k.mx_unifiednoise2d,Pot=k.mx_unifiednoise3d,Iot=k.mx_worley_noise_float,Not=k.mx_worley_noise_vec2,Lot=k.mx_worley_noise_vec3,rte=k.negate,Dot=k.negateOnBackSide,Fot=k.neutralToneMapping,Oot=k.nodeArray,Bot=k.nodeImmutable,Uot=k.nodeObject,kot=k.nodeObjectIntent,Got=k.nodeObjects,zot=k.nodeProxy,Vot=k.nodeProxyIntent,qot=k.normalFlat,Hot=k.normalGeometry,Wot=k.normalLocal,jot=k.normalMap,Xot=k.normalView,$ot=k.normalViewGeometry,Yot=k.normalWorld,Zot=k.normalWorldGeometry,Kot=k.normalize,Qot=k.not,Jot=k.notEqual,eat=k.numWorkgroups,tat=k.objectDirection,nat=k.objectGroup,iat=k.objectPosition,rat=k.objectRadius,sat=k.objectScale,oat=k.objectViewPosition,aat=k.objectWorldMatrix,lat=k.OnBeforeObjectUpdate,cat=k.OnBeforeMaterialUpdate,uat=k.OnObjectUpdate,hat=k.OnMaterialUpdate,fat=k.oneMinus,dat=k.or,pat=k.orthographicDepthToViewZ,Aat=k.oscSawtooth,mat=k.oscSine,gat=k.oscSquare,_at=k.oscTriangle,xat=k.output,yat=k.outputStruct,vat=k.overloadingFn,bat=k.overrideNode,wat=k.overrideNodes,Sat=k.packHalf2x16,Tat=k.packSnorm2x16,Eat=k.packUnorm2x16,Mat=k.packNormalToRGB,Cat=k.parabola,Rat=k.parallaxDirection,Pat=k.parallaxUV,Iat=k.parameter,Nat=k.pass,Lat=k.passTexture,Dat=k.pcurve,Fat=k.perspectiveDepthToViewZ,Oat=k.pmremTexture,Bat=k.pointShadow,Uat=k.pointUV,kat=k.pointWidth,Gat=k.positionGeometry,zat=k.positionLocal,Vat=k.positionPrevious,qat=k.positionView,Hat=k.positionViewDirection,Wat=k.positionWorld,jat=k.positionWorldDirection,Xat=k.posterize,$at=k.pow,Yat=k.pow2,Zat=k.pow3,Kat=k.pow4,Qat=k.premultiplyAlpha,Jat=k.property,elt=k.radians,tlt=k.rand,nlt=k.range,ilt=k.rangeFog,rlt=k.rangeFogFactor,slt=k.reciprocal,olt=k.reference,alt=k.referenceBuffer,llt=k.reflect,clt=k.reflectVector,ult=k.reflectView,hlt=k.reflector,flt=k.refract,dlt=k.refractVector,plt=k.refractView,Alt=k.reinhardToneMapping,mlt=k.remap,glt=k.remapClamp,_lt=k.renderGroup,xlt=k.renderOutput,ylt=k.rendererReference,vlt=k.replaceDefaultUV,blt=k.rotate,wlt=k.rotateUV,Slt=k.roughness,Tlt=k.round,Elt=k.rtt,Mlt=k.sRGBTransferEOTF,Clt=k.sRGBTransferOETF,Rlt=k.sample,Plt=k.sampler,Ilt=k.samplerComparison,Nlt=k.saturate,Llt=k.saturation,Dlt=k.screen,Flt=k.screenCoordinate,Olt=k.screenDPR,Blt=k.screenSize,Ult=k.screenUV,klt=k.select,Glt=k.setCurrentStack,zlt=k.setName,Vlt=k.shaderStages,qlt=k.shadow,Hlt=k.shadowPositionWorld,Wlt=k.shapeCircle,jlt=k.sharedUniformGroup,Xlt=k.sheen,$lt=k.sheenRoughness,Ylt=k.shiftLeft,Zlt=k.shiftRight,Klt=k.shininess,Qlt=k.sign,ste=k.sin,Jlt=k.sinh,ect=k.sinc,tct=k.skinning,nct=k.smoothstep,ict=k.smoothstepElement,rct=k.specularColor,sct=k.specularF90,oct=k.spherizeUV,act=k.split,lct=k.spritesheetUV,ote=k.sqrt,cct=k.stack,uct=k.step,hct=k.stepElement,ate=k.storage,fct=k.storageBarrier,dct=k.storageTexture,pct=k.storageTexture3D,Act=k.struct,mct=k.sub,gct=k.subgroupAdd,_ct=k.subgroupAll,xct=k.subgroupAnd,yct=k.subgroupAny,vct=k.subgroupBallot,bct=k.subgroupBroadcast,wct=k.subgroupBroadcastFirst,Sct=k.subBuild,Tct=k.subgroupElect,Ect=k.subgroupExclusiveAdd,Mct=k.subgroupExclusiveMul,Cct=k.subgroupInclusiveAdd,Rct=k.subgroupInclusiveMul,Pct=k.subgroupIndex,Ict=k.subgroupMax,Nct=k.subgroupMin,Lct=k.subgroupMul,Dct=k.subgroupOr,Fct=k.subgroupShuffle,Oct=k.subgroupShuffleDown,Bct=k.subgroupShuffleUp,Uct=k.subgroupShuffleXor,kct=k.subgroupSize,Gct=k.subgroupXor,zct=k.tan,Vct=k.tanh,qct=k.tangentGeometry,Hct=k.tangentLocal,Wct=k.tangentView,jct=k.tangentWorld,Xct=k.texture,$ct=k.texture3D,Yct=k.textureBarrier,Zct=k.textureBicubic,Kct=k.textureBicubicLevel,Qct=k.textureCubeUV,Jct=k.textureLoad,eut=k.textureSize,tut=k.textureLevel,nut=k.textureStore,iut=k.thickness,rut=k.time,sut=k.toneMapping,out=k.toneMappingExposure,aut=k.toonOutlinePass,lut=k.transformDirection,cut=k.transformNormal,uut=k.transformNormalByInverseViewMatrix,hut=k.transformNormalByViewMatrix,fut=k.transformNormalToView,dut=k.transformedClearcoatNormalView,put=k.transformedNormalView,Aut=k.transformedNormalWorld,mut=k.transmission,gut=k.transpose,_ut=k.triNoise3D,xut=k.triplanarTexture,yut=k.triplanarTextures,vut=k.trunc,but=k.uint,wut=k.uintBitsToFloat,lte=k.uniform,Sut=k.uniformArray,Tut=k.uniformCubeTexture,Eut=k.uniformGroup,Mut=k.uniformFlow,Cut=k.uniformTexture,Rut=k.unpackHalf2x16,Put=k.unpackSnorm2x16,Iut=k.unpackUnorm2x16,Nut=k.unpackRGBToNormal,Lut=k.unpremultiplyAlpha,Dut=k.userData,Fut=k.uv,Out=k.uvec2,But=k.uvec3,Uut=k.uvec4,kut=k.varying,Gut=k.varyingProperty,zut=k.vec2,Vut=k.vec3,qut=k.vec4,Hut=k.vectorComponents,Wut=k.velocity,jut=k.vertexColor,Xut=k.vertexIndex,$ut=k.vertexStage,Yut=k.vibrance,Zut=k.viewZToLogarithmicDepth,Kut=k.viewZToOrthographicDepth,Qut=k.viewZToPerspectiveDepth,Jut=k.viewZToReversedOrthographicDepth,eht=k.viewZToReversedPerspectiveDepth,tht=k.viewport,nht=k.viewportCoordinate,iht=k.viewportDepthTexture,rht=k.viewportLinearDepth,sht=k.viewportMipTexture,oht=k.viewportOpaqueMipTexture,aht=k.viewportResolution,lht=k.viewportSafeUV,cht=k.viewportSharedTexture,uht=k.viewportSize,hht=k.viewportTexture,fht=k.viewportUV,dht=k.wgsl,pht=k.wgslFn,Aht=k.workgroupArray,mht=k.workgroupBarrier,ght=k.workgroupId,_ht=k.workingToColorSpace,xht=k.xor;var cte=new da,rR=new ie,W1=class extends Zy{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 Rn(e,3)),this.setAttribute("uv",new Rn(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 Vu(t,6,1);return this.setAttribute("instanceStart",new _o(n,3,0)),this.setAttribute("instanceEnd",new _o(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 Vu(t,6,1);return this.setAttribute("instanceColorStart",new _o(n,3,0)),this.setAttribute("instanceColorEnd",new _o(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 By(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new da);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),cte.setFromBufferAttribute(t),this.boundingBox.union(cte))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Wa),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++)rR.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(rR)),rR.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(rR));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}};_a.line={uniforms:XA.merge([Nt.common,Nt.fog,Nt.line]),vertexShader:`4703+ ${" ".repeat(a.linePos-1)}^`)),(a.type==="error"?Ge:je)(c+u)}}}_getBlending(e){let t,n,r=e.blending,s=e.blendSrc,o=e.blendDst,a=e.blendEquation;if(r===Bf){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,p,x)=>{t={srcFactor:u,dstFactor:f,operation:_m.Add},n={srcFactor:p,dstFactor:x,operation:_m.Add}};if(l)switch(r){case os:c(oi.One,oi.OneMinusSrcAlpha,oi.One,oi.OneMinusSrcAlpha);break;case Wu:c(oi.One,oi.One,oi.One,oi.One);break;case ju:c(oi.Zero,oi.OneMinusSrc,oi.Zero,oi.One);break;case Xu:c(oi.Dst,oi.OneMinusSrcAlpha,oi.Zero,oi.One);break}else switch(r){case os:c(oi.SrcAlpha,oi.OneMinusSrcAlpha,oi.One,oi.OneMinusSrcAlpha);break;case Wu:c(oi.SrcAlpha,oi.One,oi.One,oi.One);break;case ju:Ge(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case Xu:Ge(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break}}if(t!==void 0&&n!==void 0)return{color:t,alpha:n};Ge("WebGPURenderer: Invalid blending: ",r)}_getBlendFactor(e){let t;switch(e){case jc:t=oi.Zero;break;case o2:t=oi.One;break;case a2:t=oi.Src;break;case l2:t=oi.OneMinusSrc;break;case Xd:t=oi.SrcAlpha;break;case $d:t=oi.OneMinusSrcAlpha;break;case h2:t=oi.Dst;break;case f2:t=oi.OneMinusDst;break;case c2:t=oi.DstAlpha;break;case u2:t=oi.OneMinusDstAlpha;break;case d2:t=oi.SrcAlphaSaturated;break;case tve:t=oi.Constant;break;case nve:t=oi.OneMinusConstant;break;default:Ge("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,n=e.stencilFunc;switch(n){case bL:t=wo.Never;break;case wy:t=wo.Always;break;case wL:t=wo.Less;break;case TL:t=wo.LessEqual;break;case SL:t=wo.Equal;break;case CL:t=wo.GreaterEqual;break;case EL:t=wo.Greater;break;case ML:t=wo.NotEqual;break;default:Ge("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case Tf:t=Yp.Keep;break;case AL:t=Yp.Zero;break;case mL:t=Yp.Replace;break;case vL:t=Yp.Invert;break;case gL:t=Yp.IncrementClamp;break;case _L:t=Yp.DecrementClamp;break;case xL:t=Yp.IncrementWrap;break;case yL:t=Yp.DecrementWrap;break;default:Ge("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case Gs:t=_m.Add;break;case r2:t=_m.Subtract;break;case s2:t=_m.ReverseSubtract;break;case KT:t=_m.Min;break;case QT:t=_m.Max;break;default:Ge("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?wC.Uint16:wC.Uint32);let o=n.side===hi;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(o=!o),r.frontFace=o===!0?CZ.CW:CZ.CCW,r.cullMode=n.side===rr?RZ.None:RZ.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?PZ.All:PZ.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=wo.Always;else{let n=this.backend.parameters.reversedDepthBuffer?C2[e.depthFunc]:e.depthFunc;switch(n){case pA:t=wo.Never;break;case AA:t=wo.Always;break;case mA:t=wo.Less;break;case Gu:t=wo.LessEqual;break;case gA:t=wo.Equal;break;case _A:t=wo.GreaterEqual;break;case xA:t=wo.Greater;break;case yA:t=wo.NotEqual;break;default:Ge("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}},PC=class{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}},bh=new d0,g3e=new Vm,qv=new PC,A7=class extends vC{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,qv.label=`queryset_global_timestamp_${t}`,qv.type="timestamp",qv.count=this.maxQueries,this.querySet=this.device.createQuerySet(qv),qv.reset();let r=this.maxQueries*8;bh.label=`buffer_timestamp_resolve_${t}`,bh.size=r,bh.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(bh),bh.reset(),bh.label=`buffer_timestamp_result_${t}`,bh.size=r,bh.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(bh),bh.reset()}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return Kn(`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(g3e);r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);let s=r.finish();if(Eh(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 p=u.match(/^(.*):f(\d+)$/),x=parseInt(p[2]);l.includes(x)===!1&&l.push(x),a[x]===void 0&&(a[x]=0);let v=o[f],w=o[f+1],S=Number(w-v)/1e6;this.timestamps.set(u,S),a[x]+=S}let c=a[l[l.length-1]];return this.resultBuffer.unmap(),this.lastValue=c,this.frames=l,c}catch(e){return Ge("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){Ge("Error waiting for pending resolve:",e)}if(this.resultBuffer&&this.resultBuffer.mapState==="mapped")try{this.resultBuffer.unmap()}catch(e){Ge("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}}},m7=class{constructor(){this.label="",this.timestampWrites=void 0}reset(){this.label="",this.timestampWrites=void 0}},S1=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}},g7=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}},tu={r:0,g:0,b:0,a:1},Rl=new d0,wa=new Vm,cM=new m7,Hv=new PC,uM=new CC,hM=new g7,hc=new k1,wh=new k1,hr=new bb,Yf=new RC,_7=class extends yC{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 YB(this),this.attributeUtils=new l7(this),this.bindingUtils=new u7(this),this.capabilities=new h7(this),this.pipelineUtils=new p7(this),this.textureUtils=new i7(this),this.occludedResolveCache=new Map;let t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[Gf.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(SC),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(SC.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===Di?"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 Ha}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 Lm,s.colorAttachments.push(new Nm),e.depth===!0||e.stencil===!0){let l=new S1;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:So.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=[],p,x=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(hr.label=`colorAttachment_${w}`,hr.baseMipLevel=e.activeMipmapLevel,hr.mipLevelCount=1,hr.baseArrayLayer=e.activeCubeFace,hr.arrayLayerCount=1,hr.dimension=So.TwoD,n.isRenderTarget3D)p=e.activeCubeFace,hr.baseArrayLayer=0,hr.dimension=So.ThreeD;else if(n.isRenderTarget&&u[w].image.depth>1)if(x===!0){let T=e.camera.cameras;for(let P=0;P<T.length;P++){hr.baseArrayLayer=P,hr.arrayLayerCount=1,hr.dimension=So.TwoD;let R=S.texture.createView(hr);f.push({view:R,resolveTarget:void 0,depthSlice:void 0})}}else hr.dimension=So.TwoDArray;if(x!==!0){let T=S.texture.createView(hr),P,R;S.msaaTexture!==void 0?(P=S.msaaTexture.createView(),R=T):(P=T,R=void 0),f.push({view:P,resolveTarget:R,depthSlice:p})}hr.reset()}let v=[];for(let w=0;w<f.length;w++){let S=f[w],T=new Nm;T.view=S.view,T.depthSlice=S.depthSlice,T.resolveTarget=S.resolveTarget,v.push(T)}if(l={textureViews:f,colorAttachments:v,descriptor:new Lm},e.depth){let w=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(hr.dimension=So.TwoD,hr.arrayLayerCount=1,hr.baseArrayLayer=e.activeCubeFace);let S=new S1;S.view=w.texture.createView(hr),l.depthStencilAttachment=S,hr.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],p={r:0,g:0,b:0,a:1};u===0&&t.clearValue&&(p=t.clearValue),f.loadOp=t.loadOp||Mi.Load,f.storeOp=t.storeOp||Sa.Store,f.clearValue=p,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,Hv.label=`occlusionQuerySet_${e.id}`,Hv.type="occlusion",Hv.count=r,s=n.createQuerySet(Hv),Hv.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:Mi.Load}),this.initTimestampQuery(sc.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:(tu.r=0,tu.g=0,tu.b=0,tu.a=1,f.clearValue=tu),f.loadOp=Mi.Clear):f.loadOp=Mi.Load,f.storeOp=Sa.Store}}else{let c=o.colorAttachments[0];e.clearColor?(c.clearValue=e.clearColorValue,c.loadOp=Mi.Clear):c.loadOp=Mi.Load,c.storeOp=Sa.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Mi.Clear):a.depthLoadOp=Mi.Load,a.depthStoreOp=Sa.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Mi.Clear):a.stencilLoadOp=Mi.Load,a.stencilStoreOp=Sa.Store),wa.label="renderContext_"+e.id;let l=n.createCommandEncoder(wa);if(wa.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),p={attributes:{},bindingGroups:[],pipeline:null,index:null};t.bundleEncoders.push(f),t.bundleSets.push(p)}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 Nm;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 Lm;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]||(hr.dimension=So.TwoD,hr.baseArrayLayer=a,hr.arrayLayerCount=1,o.viewCache[f]=o.texture.createView(hr),hr.reset());let p=new S1;p.view=o.viewCache[f],p.depthLoadOp=s.depthLoadOp||Mi.Clear,p.depthStoreOp=s.depthStoreOp||Sa.Store,p.depthClearValue=s.depthClearValue||1,e.stencil&&(p.stencilLoadOp=s.stencilLoadOp,p.stencilStoreOp=s.stencilStoreOp,p.stencilClearValue=s.stencilClearValue),u.depthStencilAttachment=p}else{let f=new S1;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=Mi.Clear):o.depthLoadOp=Mi.Load),e.stencil&&(e.clearStencil?(o.stencilClearValue=e.clearStencilValue,o.stencilLoadOp=Mi.Clear):o.stencilLoadOp=Mi.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:p,minDepth:x,maxDepth:v}=e.viewportValue;l.setViewport(c,u,f,p,x,v)}if(e.scissor){let{x:c,y:u,width:f,height:p}=e.scissorValue;l.setScissorRect(c,u,f,p)}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&&(Rl.size=s,Rl.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,o=this.device.createBuffer(Rl),Rl.reset(),this.occludedResolveCache.set(s,o)),Rl.size=s,Rl.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let a=this.device.createBuffer(Rl);Rl.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(Eh(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 x=this.getClearColor();tu.r=x.r,tu.g=x.g,tu.b=x.b,tu.a=x.a}if(r===null){c=o.depth,u=o.stencil;let x=this._getDefaultRenderPassDescriptor();if(e){a=x.colorAttachments;let v=a[0];v.clearValue=tu,v.loadOp=Mi.Clear,v.storeOp=Sa.Store}(c||u)&&(l=x.depthStencilAttachment)}else{c=r.depth,u=r.stencil;let x={loadOp:e?Mi.Clear:Mi.Load,clearValue:e?tu:void 0};c&&(x.depthLoadOp=t?Mi.Clear:Mi.Load,x.depthClearValue=t?o.getClearDepth():void 0,x.depthStoreOp=Sa.Store),u&&(x.stencilLoadOp=n?Mi.Clear:Mi.Load,x.stencilClearValue=n?o.getClearStencil():void 0,x.stencilStoreOp=Sa.Store);let v=this._getRenderPassDescriptor(r,x);a=v.colorAttachments,l=v.depthStencilAttachment}c&&l&&(t?(l.depthLoadOp=Mi.Clear,l.depthClearValue=o.getClearDepth(),l.depthStoreOp=Sa.Store):(l.depthLoadOp=Mi.Load,l.depthStoreOp=Sa.Store)),u&&l&&(n?(l.stencilLoadOp=Mi.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=Sa.Store):(l.stencilLoadOp=Mi.Load,l.stencilStoreOp=Sa.Store)),wa.label="clear";let f=s.createCommandEncoder(wa);wa.reset(),f.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),Eh(s,f.finish())}beginCompute(e){let t=this.get(e),n="computeGroup_"+e.id;cM.label=n,wa.label=n,this.initTimestampQuery(sc.COMPUTE,this.getTimestampUID(e),cM),t.cmdEncoderGPU=this.device.createCommandEncoder(wa),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(cM),t.currentPipeline=null,wa.reset(),cM.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 p=n[u],x=this.get(p);l.setBindGroup(u,x.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,p=f[0];for(let w=1;w<f.length;w++)p*=f[w];let x=Math.ceil(u/p),v=this.device.limits.maxComputeWorkgroupsPerDimension;s=[x,1,1],x>v&&(s[0]=Math.min(x,v),s[1]=Math.ceil(x/v)),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(),Eh(this.device,t.cmdEncoderGPU.finish())}_draw(e,t,n,r,s,o,a,l,c){let{object:u,material:f,context:p}=e,x=e.getIndex(),v=x!==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 P=s[S];if(w[S]!==P.id){let R=this.get(P);l.setBindGroup(S,R.group),w[S]=P.id}}if(v===!0&&c.index!==x){let S=this.get(x).buffer,T=x.array instanceof Uint16Array?wC.Uint16:wC.Uint32;l.setIndexBuffer(S,T),c.index=x}for(let S=0,T=o.length;S<T;S++){let P=o[S];if(c.attributes[S]!==P){let R=this.get(P).buffer;l.setVertexBuffer(S,R),c.attributes[S]=P}}if(p.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,P=u._multiDrawCount,R=v===!0?x.array.BYTES_PER_ELEMENT:1;f.wireframe&&(R=u.geometry.attributes.position.count>65535?4:2);for(let C=0;C<P;C++)v===!0?l.drawIndexed(T[C],1,S[C]/R,0,C):l.draw(T[C],1,S[C],C),t.update(u,T[C],1)}else if(v===!0){let{vertexCount:S,instanceCount:T,firstVertex:P}=a,R=e.getIndirect();if(R!==null){let C=this.get(R).buffer,L=e.getIndirectOffset(),D=Array.isArray(L)?L:[L];for(let F=0;F<D.length;F++)l.drawIndexedIndirect(C,D[F])}else l.drawIndexed(S,T,P,0,0);t.update(u,S,T)}else{let{vertexCount:S,instanceCount:T,firstVertex:P}=a,R=e.getIndirect();if(R!==null){let C=this.get(R).buffer,L=e.getIndirectOffset(),D=Array.isArray(L)?L:[L];for(let F=0;F<D.length;F++)l.drawIndirect(C,D[F])}else l.draw(S,T,P,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 p=this.get(e.camera),x=e.camera.cameras,v=e.getBindingGroup("cameraIndex");if(p.indexesGPU===void 0||p.indexesGPU.length!==x.length){let S=this.get(v),T=[],P=new Uint32Array([0,0,0,0]);for(let R=0,C=x.length;R<C;R++){P[0]=R;let{layoutGPU:L}=S.layout,D=this.bindingUtils.createBindGroupIndex(P,L);T.push(D)}p.indexesGPU=T}let w=this.renderer.getPixelRatio();for(let S=0,T=x.length;S<T;S++){let P=x[S];if(n.layers.test(P.layers)){let R=P.viewport,C=o.currentPass,L=o.currentSets,D=o.bundleEncoders!==void 0;if(D){let F=o.bundleEncoders[S],N=o.bundleSets[S];C=F,L=N}if(R&&!D&&C.setViewport(Math.floor(R.x*w),Math.floor(R.y*w),Math.floor(R.width*w),Math.floor(R.height*w),r.viewportValue.minDepth,r.viewportValue.maxDepth),v&&p.indexesGPU){let F=u.indexOf(v);C.setBindGroup(F,p.indexesGPU[S]),L.bindingGroups[F]=v.id}this._draw(e,t,o,l,u,f,c,C,L)}}}else if(o.currentPass){if(o.occlusionQuerySet!==void 0){let p=o.lastOcclusionObject;p!==n&&(p!==null&&p.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,p=!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,p=!0),p}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 A7(this.device,e,2048));let r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);hM.querySet=r.querySet,hM.beginningOfPassWriteIndex=s,hM.endOfPassWriteIndex=s+1,n.timestampWrites=hM}createNodeBuilder(e,t){return new a7(e,t)}createProgram(e){let t=this.get(e);uM.label=e.stage+(e.name!==""?`_${e.name}`:""),uM.code=e.code,t.module={module:this.device.createShaderModule(uM),entryPoint:"main"},uM.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&Nh.VERTEX&&s.push("vertex"),e.visibility&Nh.FRAGMENT&&s.push("fragment"),e.visibility&Nh.COMPUTE&&s.push("compute");let o=`(${s.join(",")})`;Rl.label=`bindingBuffer${e.id}_${e.name}_${o}`,Rl.size=n,Rl.usage=r;let a=this.device.createBuffer(Rl);Rl.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 LZ[e]!==void 0&&(e=LZ[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,p=0,x=e.image.width,v=e.image.height,w=1;n!==null&&(n.isBox3===!0?(u=n.min.x,f=n.min.y,p=n.min.z,x=n.max.x-n.min.x,v=n.max.y-n.min.y,w=n.max.z-n.min.z):(u=n.min.x,f=n.min.y,x=n.max.x-n.min.x,v=n.max.y-n.min.y,w=1)),r!==null&&(a=r.x,l=r.y,c=r.z||0),wa.label="copyTextureToTexture_"+e.id+"_"+t.id;let S=this.device.createCommandEncoder(wa);wa.reset();let T=this.get(e).texture,P=this.get(t).texture;hc.texture=T,hc.mipLevel=s,hc.origin.x=u,hc.origin.y=f,hc.origin.z=p,wh.texture=P,wh.mipLevel=o,wh.origin.x=a,wh.origin.y=l,wh.origin.z=c,Yf.width=x,Yf.height=v,Yf.depthOrArrayLayers=w,S.copyTextureToTexture(hc,wh,Yf),hc.reset(),wh.reset(),Yf.reset(),Eh(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){Ge("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):(wa.label="copyFramebufferToTexture_"+e.id,a=this.device.createCommandEncoder(wa),wa.reset()),hc.texture=s,hc.origin.x=n.x,hc.origin.y=n.y,wh.texture=o,Yf.width=n.z,Yf.height=n.w,a.copyTextureToTexture(hc,wh,Yf),hc.reset(),wh.reset(),Yf.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=Mi.Load;t.depth&&(l.depthStencilAttachment.depthLoadOp=Mi.Load),t.stencil&&(l.depthStencilAttachment.stencilLoadOp=Mi.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 Eh(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()}},x7=class extends LA{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}},y7=class extends LA{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}},v7=class extends fC{constructor(){super(),this.addMaterial(HF,"MeshPhongMaterial"),this.addMaterial(HM,"MeshStandardMaterial"),this.addMaterial(QF,"MeshPhysicalMaterial"),this.addMaterial(eO,"MeshToonMaterial"),this.addMaterial(VF,"MeshBasicMaterial"),this.addMaterial(qF,"MeshLambertMaterial"),this.addMaterial(UF,"MeshNormalMaterial"),this.addMaterial(tO,"MeshMatcapMaterial"),this.addMaterial(FF,"LineBasicMaterial"),this.addMaterial(OF,"LineDashedMaterial"),this.addMaterial(iO,"PointsMaterial"),this.addMaterial(WM,"SpriteMaterial"),this.addMaterial(sO,"ShadowMaterial"),this.addLight(YO,Yy),this.addLight(xB,DA),this.addLight(SB,Zy),this.addLight(_b,LA),this.addLight(_B,FA),this.addLight(yB,Xy),this.addLight(bB,Ky),this.addLight(vB,x7),this.addLight(wB,y7),this.addToneMapping(mee,p2),this.addToneMapping(gee,A2),this.addToneMapping(_ee,m2),this.addToneMapping(xee,g2),this.addToneMapping(yee,_2),this.addToneMapping(vee,x2)}},G1=class extends LB{constructor(e={}){let t;e.forceWebGL?t=bC:(t=_7,e.getFallback=()=>(je("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new bC(e)));let n=new t(e);super(n,e),this.library=new v7,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};var jJe=k.BRDF_GGX,XJe=k.BRDF_Lambert,$Je=k.BasicPointShadowFilter,YJe=k.BasicShadowFilter,ZJe=k.Break,KJe=k.Const,QJe=k.Continue,JJe=k.DFGLUT,eet=k.D_GGX,tet=k.Discard,net=k.EPSILON,iet=k.F_Schlick,Qee=k.Fn,ret=k.INFINITY,Jee=k.If,ete=k.Loop,set=k.NodeAccess,oet=k.NodeShaderStage,aet=k.NodeType,cet=k.NodeUpdateType,uet=k.PCFShadowFilter,het=k.PCFSoftShadowFilter,fet=k.PI,det=k.PI2,pet=k.TWO_PI,Aet=k.HALF_PI,met=k.PointShadowFilter,get=k.Return,_et=k.Schlick_to_F0,xet=k.ShaderNode,yet=k.Stack,vet=k.Switch,bet=k.TBNViewMatrix,wet=k.VSMShadowFilter,Tet=k.V_GGX_SmithCorrelated,Eet=k.Var,Met=k.VarIntent,Cet=k.abs,Ret=k.acesFilmicToneMapping,Pet=k.acos,Iet=k.acosh,Net=k.add,Let=k.addMethodChaining,Det=k.addNodeElement,Fet=k.agxToneMapping,Oet=k.all,Bet=k.alphaT,Uet=k.ambientOcclusion,ket=k.and,Get=k.anisotropy,zet=k.anisotropyB,Vet=k.anisotropyT,qet=k.any,Het=k.append,Wet=k.array,tte=k.asin,jet=k.asinh,Xet=k.assign,$et=k.atan,Yet=k.atanh,Zet=k.atomicAdd,Ket=k.atomicAnd,Qet=k.atomicFunc,Jet=k.atomicLoad,ett=k.atomicMax,ttt=k.atomicMin,ntt=k.atomicOr,itt=k.atomicStore,rtt=k.atomicSub,stt=k.atomicXor,ott=k.attenuationColor,att=k.attenuationDistance,ltt=k.attribute,ctt=k.attributeArray,utt=k.backgroundBlurriness,htt=k.backgroundIntensity,ftt=k.backgroundRotation,dtt=k.batch,ptt=k.bentNormalView,Att=k.billboarding,mtt=k.bitAnd,gtt=k.bitNot,_tt=k.bitOr,xtt=k.bitXor,ytt=k.bitangentGeometry,vtt=k.bitangentLocal,btt=k.bitangentView,wtt=k.bitangentWorld,Stt=k.bitcast,Ttt=k.blendBurn,Ett=k.blendColor,Mtt=k.blendDodge,Ctt=k.blendOverlay,Rtt=k.blendScreen,Ptt=k.blur,Itt=k.bool,Ntt=k.buffer,Ltt=k.bufferAttribute,Dtt=k.bumpMap,Ftt=k.builtin,Ott=k.builtinAOContext,Btt=k.builtinShadowContext,Utt=k.bvec2,ktt=k.bvec3,Gtt=k.bvec4,ztt=k.bypass,Vtt=k.cache,qtt=k.call,Htt=k.cameraFar,Wtt=k.cameraIndex,jtt=k.cameraNear,Xtt=k.cameraNormalMatrix,$tt=k.cameraPosition,Ytt=k.cameraProjectionMatrix,Ztt=k.cameraProjectionMatrixInverse,Ktt=k.cameraViewMatrix,Qtt=k.cameraViewport,Jtt=k.cameraWorldMatrix,ent=k.cbrt,tnt=k.cdl,nnt=k.ceil,int=k.checker,rnt=k.cineonToneMapping,snt=k.clamp,ont=k.clearcoat,ant=k.clearcoatNormalView,lnt=k.clearcoatRoughness,cnt=k.clipSpace,unt=k.code,hnt=k.color,fnt=k.colorSpaceToWorking,dnt=k.colorToDirection,pnt=k.compute,Ant=k.computeKernel,mnt=k.computeSkinning,gnt=k.context,_nt=k.convert,xnt=k.convertColorSpace,ynt=k.convertToTexture,vnt=k.countLeadingZeros,bnt=k.countOneBits,wnt=k.countTrailingZeros,nte=k.cos,Snt=k.cosh,Tnt=k.cross,Ent=k.cubeTexture,Mnt=k.cubeTextureBase,Cnt=k.dFdx,Rnt=k.dFdy,Pnt=k.dashSize,Int=k.debug,Nnt=k.decrement,Lnt=k.decrementBefore,Dnt=k.defaultBuildStages,Fnt=k.defaultShaderStages,Ont=k.defined,Bnt=k.degrees,Unt=k.deltaTime,knt=k.densityFog,Gnt=k.densityFogFactor,znt=k.depth,Vnt=k.depthPass,qnt=k.determinant,Hnt=k.difference,Wnt=k.diffuseColor,jnt=k.directPointLight,Xnt=k.directionToColor,$nt=k.directionToFaceDirection,Ynt=k.dispersion,Znt=k.distance,Knt=k.div,Qnt=k.dot,Jnt=k.drawIndex,eit=k.dynamicBufferAttribute,tit=k.element,nit=k.emissive,iit=k.equal,rit=k.equirectDirection,sit=k.equirectUV,ite=k.exp,oit=k.exp2,ait=k.exponentialHeightFogFactor,lit=k.expression,cit=k.faceDirection,uit=k.faceForward,hit=k.faceforward,rte=k.float,fit=k.floatBitsToInt,dit=k.floatBitsToUint,pit=k.floor,Ait=k.fog,mit=k.fract,git=k.frameGroup,_it=k.frameId,xit=k.frontFacing,yit=k.fwidth,vit=k.gain,bit=k.gapSize,wit=k.getConstNodeType,Sit=k.getCurrentStack,Tit=k.getDirection,Eit=k.getDistanceAttenuation,Mit=k.getGeometryRoughness,Cit=k.getNormalFromDepth,Rit=k.interleavedGradientNoise,Pit=k.vogelDiskSample,Iit=k.getParallaxCorrectNormal,Nit=k.getRoughness,Lit=k.getScreenPosition,Dit=k.getShIrradianceAt,Fit=k.getShadowMaterial,Oit=k.getShadowRenderObjectFunction,Bit=k.getTextureIndex,Uit=k.getViewPosition,kit=k.globalId,Git=k.glsl,zit=k.glslFn,Vit=k.grayscale,qit=k.greaterThan,Hit=k.greaterThanEqual,Wit=k.hash,jit=k.highpModelNormalViewMatrix,Xit=k.highpModelViewMatrix,$it=k.hue,Yit=k.increment,Zit=k.incrementBefore,Kit=k.instance,ste=k.instanceIndex,Qit=k.instancedArray,Jit=k.instancedBufferAttribute,ert=k.instancedDynamicBufferAttribute,trt=k.instancedMesh,nrt=k.int,irt=k.intBitsToFloat,rrt=k.inverse,srt=k.inverseSqrt,ort=k.inversesqrt,art=k.invocationLocalIndex,lrt=k.invocationSubgroupIndex,crt=k.ior,urt=k.iridescence,hrt=k.iridescenceIOR,frt=k.iridescenceThickness,drt=k.ivec2,prt=k.ivec3,Art=k.ivec4,mrt=k.js,grt=k.label,_rt=k.length,xrt=k.lengthSq,yrt=k.lessThan,vrt=k.lessThanEqual,brt=k.lightPosition,wrt=k.lightProjectionUV,Srt=k.lightShadowMatrix,Trt=k.lightTargetDirection,Ert=k.lightTargetPosition,Mrt=k.lightViewPosition,Crt=k.lightingContext,Rrt=k.lights,Prt=k.linearDepth,Irt=k.linearToneMapping,Nrt=k.localId,Lrt=k.log,Drt=k.log2,Frt=k.logarithmicDepthToViewZ,Ort=k.luminance,Brt=k.mat2,Urt=k.mat3,krt=k.mat4,Grt=k.matcapUV,zrt=k.materialAO,Vrt=k.materialAlphaTest,qrt=k.materialAnisotropy,Hrt=k.materialAnisotropyVector,Wrt=k.materialAttenuationColor,jrt=k.materialAttenuationDistance,Xrt=k.materialClearcoat,$rt=k.materialClearcoatNormal,Yrt=k.materialClearcoatRoughness,Zrt=k.materialColor,Krt=k.materialDispersion,Qrt=k.materialEmissive,Jrt=k.materialEnvIntensity,est=k.materialEnvRotation,tst=k.materialIOR,nst=k.materialIridescence,ist=k.materialIridescenceIOR,rst=k.materialIridescenceThickness,sst=k.materialLightMap,ost=k.materialLineDashOffset,ast=k.materialLineDashSize,lst=k.materialLineGapSize,cst=k.materialLineScale,ust=k.materialLineWidth,hst=k.materialMetalness,fst=k.materialNormal,dst=k.materialOpacity,pst=k.materialPointSize,Ast=k.materialReference,mst=k.materialReflectivity,gst=k.materialRefractionRatio,_st=k.materialRotation,xst=k.materialRoughness,yst=k.materialSheen,vst=k.materialSheenRoughness,bst=k.materialShininess,wst=k.materialSpecular,Sst=k.materialSpecularColor,Tst=k.materialSpecularIntensity,Est=k.materialSpecularStrength,Mst=k.materialThickness,Cst=k.materialTransmission,Rst=k.max,Pst=k.maxMipLevel,Ist=k.mediumpModelViewMatrix,Nst=k.metalness,Lst=k.min,Dst=k.mix,Fst=k.mixElement,Ost=k.mod,Bst=k.modelDirection,Ust=k.modelNormalMatrix,kst=k.modelPosition,Gst=k.modelRadius,zst=k.modelScale,Vst=k.modelViewMatrix,qst=k.modelViewPosition,Hst=k.modelViewProjection,Wst=k.modelWorldMatrix,jst=k.modelWorldMatrixInverse,Xst=k.morphReference,$st=k.mrt,Yst=k.mul,Zst=k.mx_aastep,Kst=k.mx_add,Qst=k.mx_atan2,Jst=k.mx_cell_noise_float,eot=k.mx_contrast,tot=k.mx_divide,not=k.mx_fractal_noise_float,iot=k.mx_fractal_noise_vec2,rot=k.mx_fractal_noise_vec3,sot=k.mx_fractal_noise_vec4,oot=k.mx_frame,aot=k.mx_heighttonormal,lot=k.mx_hsvtorgb,cot=k.mx_ifequal,uot=k.mx_ifgreater,hot=k.mx_ifgreatereq,fot=k.mx_invert,dot=k.mx_modulo,pot=k.mx_multiply,Aot=k.mx_noise_float,mot=k.mx_noise_vec3,got=k.mx_noise_vec4,_ot=k.mx_place2d,xot=k.mx_power,yot=k.mx_ramp4,vot=k.mx_ramplr,bot=k.mx_ramptb,wot=k.mx_rgbtohsv,Sot=k.mx_rotate2d,Tot=k.mx_rotate3d,Eot=k.mx_safepower,Mot=k.mx_separate,Cot=k.mx_splitlr,Rot=k.mx_splittb,Pot=k.mx_srgb_texture_to_lin_rec709,Iot=k.mx_subtract,Not=k.mx_timer,Lot=k.mx_transform_uv,Dot=k.mx_unifiednoise2d,Fot=k.mx_unifiednoise3d,Oot=k.mx_worley_noise_float,Bot=k.mx_worley_noise_vec2,Uot=k.mx_worley_noise_vec3,ote=k.negate,kot=k.negateOnBackSide,Got=k.neutralToneMapping,zot=k.nodeArray,Vot=k.nodeImmutable,qot=k.nodeObject,Hot=k.nodeObjectIntent,Wot=k.nodeObjects,jot=k.nodeProxy,Xot=k.nodeProxyIntent,$ot=k.normalFlat,Yot=k.normalGeometry,Zot=k.normalLocal,Kot=k.normalMap,Qot=k.normalView,Jot=k.normalViewGeometry,eat=k.normalWorld,tat=k.normalWorldGeometry,nat=k.normalize,iat=k.not,rat=k.notEqual,sat=k.numWorkgroups,oat=k.objectDirection,aat=k.objectGroup,lat=k.objectPosition,cat=k.objectRadius,uat=k.objectScale,hat=k.objectViewPosition,fat=k.objectWorldMatrix,dat=k.OnBeforeObjectUpdate,pat=k.OnBeforeMaterialUpdate,Aat=k.OnObjectUpdate,mat=k.OnMaterialUpdate,gat=k.oneMinus,_at=k.or,xat=k.orthographicDepthToViewZ,yat=k.oscSawtooth,vat=k.oscSine,bat=k.oscSquare,wat=k.oscTriangle,Sat=k.output,Tat=k.outputStruct,Eat=k.overloadingFn,Mat=k.overrideNode,Cat=k.overrideNodes,Rat=k.packHalf2x16,Pat=k.packSnorm2x16,Iat=k.packUnorm2x16,Nat=k.packNormalToRGB,Lat=k.parabola,Dat=k.parallaxDirection,Fat=k.parallaxUV,Oat=k.parameter,Bat=k.pass,Uat=k.passTexture,kat=k.pcurve,Gat=k.perspectiveDepthToViewZ,zat=k.pmremTexture,Vat=k.pointShadow,qat=k.pointUV,Hat=k.pointWidth,Wat=k.positionGeometry,jat=k.positionLocal,Xat=k.positionPrevious,$at=k.positionView,Yat=k.positionViewDirection,Zat=k.positionWorld,Kat=k.positionWorldDirection,Qat=k.posterize,Jat=k.pow,elt=k.pow2,tlt=k.pow3,nlt=k.pow4,ilt=k.premultiplyAlpha,rlt=k.property,slt=k.radians,olt=k.rand,alt=k.range,llt=k.rangeFog,clt=k.rangeFogFactor,ult=k.reciprocal,hlt=k.reference,flt=k.referenceBuffer,dlt=k.reflect,plt=k.reflectVector,Alt=k.reflectView,mlt=k.reflector,glt=k.refract,_lt=k.refractVector,xlt=k.refractView,ylt=k.reinhardToneMapping,vlt=k.remap,blt=k.remapClamp,wlt=k.renderGroup,Slt=k.renderOutput,Tlt=k.rendererReference,Elt=k.replaceDefaultUV,Mlt=k.rotate,Clt=k.rotateUV,Rlt=k.roughness,Plt=k.round,Ilt=k.rtt,Nlt=k.sRGBTransferEOTF,Llt=k.sRGBTransferOETF,Dlt=k.sample,Flt=k.sampler,Olt=k.samplerComparison,Blt=k.saturate,Ult=k.saturation,klt=k.screen,Glt=k.screenCoordinate,zlt=k.screenDPR,Vlt=k.screenSize,qlt=k.screenUV,Hlt=k.select,Wlt=k.setCurrentStack,jlt=k.setName,Xlt=k.shaderStages,$lt=k.shadow,Ylt=k.shadowPositionWorld,Zlt=k.shapeCircle,Klt=k.sharedUniformGroup,Qlt=k.sheen,Jlt=k.sheenRoughness,ect=k.shiftLeft,tct=k.shiftRight,nct=k.shininess,ict=k.sign,ate=k.sin,rct=k.sinh,sct=k.sinc,oct=k.skinning,act=k.smoothstep,lct=k.smoothstepElement,cct=k.specularColor,uct=k.specularF90,hct=k.spherizeUV,fct=k.split,dct=k.spritesheetUV,lte=k.sqrt,pct=k.stack,Act=k.step,mct=k.stepElement,cte=k.storage,gct=k.storageBarrier,_ct=k.storageTexture,xct=k.storageTexture3D,yct=k.struct,vct=k.sub,bct=k.subgroupAdd,wct=k.subgroupAll,Sct=k.subgroupAnd,Tct=k.subgroupAny,Ect=k.subgroupBallot,Mct=k.subgroupBroadcast,Cct=k.subgroupBroadcastFirst,Rct=k.subBuild,Pct=k.subgroupElect,Ict=k.subgroupExclusiveAdd,Nct=k.subgroupExclusiveMul,Lct=k.subgroupInclusiveAdd,Dct=k.subgroupInclusiveMul,Fct=k.subgroupIndex,Oct=k.subgroupMax,Bct=k.subgroupMin,Uct=k.subgroupMul,kct=k.subgroupOr,Gct=k.subgroupShuffle,zct=k.subgroupShuffleDown,Vct=k.subgroupShuffleUp,qct=k.subgroupShuffleXor,Hct=k.subgroupSize,Wct=k.subgroupXor,jct=k.tan,Xct=k.tanh,$ct=k.tangentGeometry,Yct=k.tangentLocal,Zct=k.tangentView,Kct=k.tangentWorld,Qct=k.texture,Jct=k.texture3D,eut=k.textureBarrier,tut=k.textureBicubic,nut=k.textureBicubicLevel,iut=k.textureCubeUV,rut=k.textureLoad,sut=k.textureSize,out=k.textureLevel,aut=k.textureStore,lut=k.thickness,cut=k.time,uut=k.toneMapping,hut=k.toneMappingExposure,fut=k.toonOutlinePass,dut=k.transformDirection,put=k.transformNormal,Aut=k.transformNormalByInverseViewMatrix,mut=k.transformNormalByViewMatrix,gut=k.transformNormalToView,_ut=k.transformedClearcoatNormalView,xut=k.transformedNormalView,yut=k.transformedNormalWorld,vut=k.transmission,but=k.transpose,wut=k.triNoise3D,Sut=k.triplanarTexture,Tut=k.triplanarTextures,Eut=k.trunc,Mut=k.uint,Cut=k.uintBitsToFloat,ute=k.uniform,Rut=k.uniformArray,Put=k.uniformCubeTexture,Iut=k.uniformGroup,Nut=k.uniformFlow,Lut=k.uniformTexture,Dut=k.unpackHalf2x16,Fut=k.unpackSnorm2x16,Out=k.unpackUnorm2x16,But=k.unpackRGBToNormal,Uut=k.unpremultiplyAlpha,kut=k.userData,Gut=k.uv,zut=k.uvec2,Vut=k.uvec3,qut=k.uvec4,Hut=k.varying,Wut=k.varyingProperty,jut=k.vec2,Xut=k.vec3,$ut=k.vec4,Yut=k.vectorComponents,Zut=k.velocity,Kut=k.vertexColor,Qut=k.vertexIndex,Jut=k.vertexStage,eht=k.vibrance,tht=k.viewZToLogarithmicDepth,nht=k.viewZToOrthographicDepth,iht=k.viewZToPerspectiveDepth,rht=k.viewZToReversedOrthographicDepth,sht=k.viewZToReversedPerspectiveDepth,oht=k.viewport,aht=k.viewportCoordinate,lht=k.viewportDepthTexture,cht=k.viewportLinearDepth,uht=k.viewportMipTexture,hht=k.viewportOpaqueMipTexture,fht=k.viewportResolution,dht=k.viewportSafeUV,pht=k.viewportSharedTexture,Aht=k.viewportSize,mht=k.viewportTexture,ght=k.viewportUV,_ht=k.wgsl,xht=k.wgslFn,yht=k.workgroupArray,vht=k.workgroupBarrier,bht=k.workgroupId,wht=k.workingToColorSpace,Sht=k.xor;var hte=new da,oR=new ie,j1=class extends Qy{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 Rn(e,3)),this.setAttribute("uv",new Rn(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 Hu(t,6,1);return this.setAttribute("instanceStart",new _o(n,3,0)),this.setAttribute("instanceEnd",new _o(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 Hu(t,6,1);return this.setAttribute("instanceColorStart",new _o(n,3,0)),this.setAttribute("instanceColorEnd",new _o(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 ky(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new da);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),hte.setFromBufferAttribute(t),this.boundingBox.union(hte))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Wa),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++)oR.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(oR)),oR.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(oR));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}};_a.line={uniforms:YA.merge([Nt.common,Nt.fog,Nt.line]),vertexShader:`47044704 #include <common>47054705 #include <color_pars_vertex>47064706 #include <fog_pars_vertex>
@@ -5092,10 +5092,10 @@ var<${n}> ${e} : ${o};`}},$o=new f0,C8=new Gm,Yee=new Map([[Int8Array,["sint8","
50925092 #include <premultiplied_alpha_fragment>50935093 50945094 }5095- `};var g0=class extends $r{constructor(e){super({type:"LineMaterial",uniforms:XA.clone(_a.line.uniforms),vertexShader:_a.line.vertexShader,fragmentShader:_a.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 qU=new gn,ute=new ie,hte=new ie,Ro=new gn,Po=new gn,Uh=new gn,HU=new ie,WU=new on,Io=new Qy,fte=new ie,sR=new da,oR=new Wa,kh=new gn,Gh,jm;function dte(i,e,t){return kh.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),kh.multiplyScalar(1/kh.w),kh.x=jm/t.width,kh.y=jm/t.height,kh.applyMatrix4(i.projectionMatrixInverse),kh.multiplyScalar(1/kh.w),Math.abs(Math.max(kh.x,kh.y))}function g3e(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++){Io.start.fromBufferAttribute(r,a),Io.end.fromBufferAttribute(s,a),Io.applyMatrix4(t);let c=new ie,u=new ie;Gh.distanceSqToSegment(Io.start,Io.end,u,c),u.distanceTo(c)<jm*.5&&e.push({point:u,pointOnLine:c,distance:Gh.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function _3e(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;Gh.at(1,Uh),Uh.w=1,Uh.applyMatrix4(e.matrixWorldInverse),Uh.applyMatrix4(n),Uh.multiplyScalar(1/Uh.w),Uh.x*=s.x/2,Uh.y*=s.y/2,Uh.z=0,HU.copy(Uh),WU.multiplyMatrices(e.matrixWorldInverse,o);for(let p=0,x=u;p<x;p++){if(Ro.fromBufferAttribute(l,p),Po.fromBufferAttribute(c,p),Ro.w=1,Po.w=1,Ro.applyMatrix4(WU),Po.applyMatrix4(WU),Ro.z>f&&Po.z>f)continue;if(Ro.z>f){let R=Ro.z-Po.z,C=(Ro.z-f)/R;Ro.lerp(Po,C)}else if(Po.z>f){let R=Po.z-Ro.z,C=(Po.z-f)/R;Po.lerp(Ro,C)}Ro.applyMatrix4(n),Po.applyMatrix4(n),Ro.multiplyScalar(1/Ro.w),Po.multiplyScalar(1/Po.w),Ro.x*=s.x/2,Ro.y*=s.y/2,Po.x*=s.x/2,Po.y*=s.y/2,Io.start.copy(Ro),Io.start.z=0,Io.end.copy(Po),Io.end.z=0;let w=Io.closestPointToPointParameter(HU,!0);Io.at(w,fte);let S=Xc.lerp(Ro.z,Po.z,w),T=S>=-1&&S<=1,P=HU.distanceTo(fte)<jm*.5;if(T&&P){Io.start.fromBufferAttribute(l,p),Io.end.fromBufferAttribute(c,p),Io.start.applyMatrix4(o),Io.end.applyMatrix4(o);let R=new ie,C=new ie;Gh.distanceSqToSegment(Io.start,Io.end,C,R),t.push({point:C,pointOnLine:R,distance:Gh.origin.distanceTo(C),object:i,face:null,faceIndex:p,uv:null,uv1:null})}}}var aR=class extends Gn{constructor(e=new W1,t=new g0({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)ute.fromBufferAttribute(t,o),hte.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+ute.distanceTo(hte);let s=new Vu(r,2,1);return e.setAttribute("instanceDistanceStart",new _o(s,1,0)),e.setAttribute("instanceDistanceEnd",new _o(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;Gh=e.ray;let o=this.matrixWorld,a=this.geometry,l=this.material;jm=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),oR.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=jm*.5;else{let f=Math.max(r.near,oR.distanceToPoint(Gh.origin));c=dte(r,f,l.resolution)}if(oR.radius+=c,Gh.intersectsSphere(oR)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),sR.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=jm*.5;else{let f=Math.max(r.near,sR.distanceToPoint(Gh.origin));u=dte(r,f,l.resolution)}sR.expandByScalar(u),Gh.intersectsBox(sR)!==!1&&(n?g3e(this,t):_3e(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(qU),this.material.uniforms.resolution.value.set(qU.z,qU.w))}};var j1=class extends W1{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 lR=class extends aR{constructor(e=new j1,t=new g0({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}};var X1=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){let r=[],s=x3e(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}};function x3e(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===`5096-`)l=0,c-=o;else{let p=y3e(f,s,l,c,t);n=="tb"?(l=0,c+=t.ascender*s):l+=p.offsetX,a.push(p.path)}}return a}function y3e(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 Jy,a,l,c,u,f,p,x,v;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,p=w[S++]*e+n,o.quadraticCurveTo(f,p,c,u);break;case"b":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,p=w[S++]*e+n,x=w[S++]*e+t,v=w[S++]*e+n,o.bezierCurveTo(f,p,x,v,c,u);break}}return{offsetX:s.ha*e,path:o}}var Cb=class i extends Fy{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 X1(t.font.data),new i(t.text,t)}};function ZU(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 v3e(i){if(Array.isArray(i))return i}function b3e(i){if(Array.isArray(i))return ZU(i)}function Tte(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 w3e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function pte(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 S3e(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){pte(s,n,r,o,a,"next",l)}function a(l){pte(s,n,r,o,a,"throw",l)}o(void 0)})}}function AR(i,e,t){return e=K1(e),L3e(i,nk()?Reflect.construct(e,t||[],K1(i).constructor):e.apply(i,t))}function T3e(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function mR(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Rb(i,e){return i.get(Tte(i,e))}function jU(i,e,t){T3e(i,e),e.set(i,t)}function XU(i,e,t){return i.set(Tte(i,e),t),t}function tk(i,e,t){if(nk())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 E3e(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,Ete(n.key),n)}}function gR(i,e,t){return e&&E3e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function oo(i,e,t){return(e=Ete(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function KU(){return KU=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=D3e(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},KU.apply(null,arguments)}function K1(i){return K1=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},K1(i)}function _R(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&&JU(i,e)}function nk(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(nk=function(){return!!i})()}function M3e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function C3e(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 R3e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5097-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function P3e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5098-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ate(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 Bi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ate(Object(t),!0).forEach(function(n){oo(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Ate(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function I3e(i,e){if(i==null)return{};var t,n,r=N3e(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 N3e(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 L3e(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 w3e(i)}function QU(){var i,e,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",r=t.toStringTag||"@@toStringTag";function s(x,v,w,S){var T=v&&v.prototype instanceof a?v:a,P=Object.create(T.prototype);return Ol(P,"_invoke",(function(R,C,L){var D,F,N,B=0,z=L||[],V=!1,H={p:0,n:0,v:i,a:Z,f:Z.bind(i,4),d:function(J,j){return D=J,F=0,N=i,H.n=j,o}};function Z(J,j){for(F=J,N=j,e=0;!V&&B&&!K&&e<z.length;e++){var K,ee=z[e],ae=H.p,ce=ee[2];J>3?(K=ce===j)&&(N=ee[(F=ee[4])?5:(F=3,3)],ee[4]=ee[5]=i):ee[0]<=ae&&((K=J<2&&ae<ee[1])?(F=0,H.v=j,H.n=ee[1]):ae<ce&&(K=J<3||ee[0]>j||j>ce)&&(ee[4]=J,ee[5]=j,H.n=ce,F=0))}if(K||J>1)return o;throw V=!0,j}return function(J,j,K){if(B>1)throw TypeError("Generator is already running");for(V&&j===1&&Z(j,K),F=j,N=K;(e=F<2?i:N)||!V;){D||(F?F<3?(F>1&&(H.n=-1),Z(F,N)):H.n=N:H.v=N);try{if(B=2,D){if(F||(J="next"),e=D[J]){if(!(e=e.call(D,N)))throw TypeError("iterator result is not an object");if(!e.done)return e;N=e.value,F<2&&(F=0)}else F===1&&(e=D.return)&&e.call(D),F<2&&(N=TypeError("The iterator does not provide a '"+J+"' method"),F=1);D=i}else if((e=(V=H.n<0)?N:R.call(C,H))!==o)break}catch(ee){D=i,F=1,N=ee}finally{B=1}}return{value:e,done:V}}})(x,w,S),!0),P}var o={};function a(){}function l(){}function c(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(Ol(e={},n,function(){return this}),e),f=c.prototype=a.prototype=Object.create(u);function p(x){return Object.setPrototypeOf?Object.setPrototypeOf(x,c):(x.__proto__=c,Ol(x,r,"GeneratorFunction")),x.prototype=Object.create(f),x}return l.prototype=c,Ol(f,"constructor",c),Ol(c,"constructor",l),l.displayName="GeneratorFunction",Ol(c,r,"GeneratorFunction"),Ol(f),Ol(f,r,"Generator"),Ol(f,n,function(){return this}),Ol(f,"toString",function(){return"[object Generator]"}),(QU=function(){return{w:s,m:p}})()}function Ol(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}Ol=function(s,o,a,l){function c(u,f){Ol(s,u,function(p){return this._invoke(u,f,p)})}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))},Ol(i,e,t,n)}function JU(i,e){return JU=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},JU(i,e)}function mr(i,e){return v3e(i)||C3e(i,e)||Mte(i,e)||R3e()}function D3e(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=K1(i))!==null;);return i}function $U(i,e,t,n){var r=KU(K1(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function qi(i){return b3e(i)||M3e(i)||Mte(i)||P3e()}function F3e(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 Ete(i){var e=F3e(i,"string");return typeof e=="symbol"?e:e+""}function Mte(i,e){if(i){if(typeof i=="string")return ZU(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)?ZU(i,e):void 0}}var Cte=function(e){e instanceof Array?e.forEach(Cte):(e.map&&e.map.dispose(),e.dispose())},y0=function(e){e.geometry&&e.geometry.dispose(),e.material&&Cte(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(y0)},Gr=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),y0(t)}};function Pa(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 sr=100;function mte(){return sr}function yc(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=sr*(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 Rte(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/sr-1}}function $m(i){return i*Math.PI/180}var Ib=window.THREE?window.THREE:{BackSide:ui,BufferAttribute:Li,Color:Ut,Mesh:Gn,ShaderMaterial:$r},O3e=`5095+ `};var _0=class extends $r{constructor(e){super({type:"LineMaterial",uniforms:YA.clone(_a.line.uniforms),vertexShader:_a.line.vertexShader,fragmentShader:_a.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 ZU=new gn,fte=new ie,dte=new ie,Ro=new gn,Po=new gn,Gh=new gn,KU=new ie,QU=new on,Io=new e2,pte=new ie,aR=new da,lR=new Wa,zh=new gn,Vh,$m;function Ate(i,e,t){return zh.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),zh.multiplyScalar(1/zh.w),zh.x=$m/t.width,zh.y=$m/t.height,zh.applyMatrix4(i.projectionMatrixInverse),zh.multiplyScalar(1/zh.w),Math.abs(Math.max(zh.x,zh.y))}function x3e(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++){Io.start.fromBufferAttribute(r,a),Io.end.fromBufferAttribute(s,a),Io.applyMatrix4(t);let c=new ie,u=new ie;Vh.distanceSqToSegment(Io.start,Io.end,u,c),u.distanceTo(c)<$m*.5&&e.push({point:u,pointOnLine:c,distance:Vh.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function y3e(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;Vh.at(1,Gh),Gh.w=1,Gh.applyMatrix4(e.matrixWorldInverse),Gh.applyMatrix4(n),Gh.multiplyScalar(1/Gh.w),Gh.x*=s.x/2,Gh.y*=s.y/2,Gh.z=0,KU.copy(Gh),QU.multiplyMatrices(e.matrixWorldInverse,o);for(let p=0,x=u;p<x;p++){if(Ro.fromBufferAttribute(l,p),Po.fromBufferAttribute(c,p),Ro.w=1,Po.w=1,Ro.applyMatrix4(QU),Po.applyMatrix4(QU),Ro.z>f&&Po.z>f)continue;if(Ro.z>f){let R=Ro.z-Po.z,C=(Ro.z-f)/R;Ro.lerp(Po,C)}else if(Po.z>f){let R=Po.z-Ro.z,C=(Po.z-f)/R;Po.lerp(Ro,C)}Ro.applyMatrix4(n),Po.applyMatrix4(n),Ro.multiplyScalar(1/Ro.w),Po.multiplyScalar(1/Po.w),Ro.x*=s.x/2,Ro.y*=s.y/2,Po.x*=s.x/2,Po.y*=s.y/2,Io.start.copy(Ro),Io.start.z=0,Io.end.copy(Po),Io.end.z=0;let w=Io.closestPointToPointParameter(KU,!0);Io.at(w,pte);let S=$c.lerp(Ro.z,Po.z,w),T=S>=-1&&S<=1,P=KU.distanceTo(pte)<$m*.5;if(T&&P){Io.start.fromBufferAttribute(l,p),Io.end.fromBufferAttribute(c,p),Io.start.applyMatrix4(o),Io.end.applyMatrix4(o);let R=new ie,C=new ie;Vh.distanceSqToSegment(Io.start,Io.end,C,R),t.push({point:C,pointOnLine:R,distance:Vh.origin.distanceTo(C),object:i,face:null,faceIndex:p,uv:null,uv1:null})}}}var cR=class extends Gn{constructor(e=new j1,t=new _0({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)fte.fromBufferAttribute(t,o),dte.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+fte.distanceTo(dte);let s=new Hu(r,2,1);return e.setAttribute("instanceDistanceStart",new _o(s,1,0)),e.setAttribute("instanceDistanceEnd",new _o(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;Vh=e.ray;let o=this.matrixWorld,a=this.geometry,l=this.material;$m=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),lR.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=$m*.5;else{let f=Math.max(r.near,lR.distanceToPoint(Vh.origin));c=Ate(r,f,l.resolution)}if(lR.radius+=c,Vh.intersectsSphere(lR)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),aR.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=$m*.5;else{let f=Math.max(r.near,aR.distanceToPoint(Vh.origin));u=Ate(r,f,l.resolution)}aR.expandByScalar(u),Vh.intersectsBox(aR)!==!1&&(n?x3e(this,t):y3e(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(ZU),this.material.uniforms.resolution.value.set(ZU.z,ZU.w))}};var X1=class extends j1{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 uR=class extends cR{constructor(e=new X1,t=new _0({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}};var $1=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){let r=[],s=v3e(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}};function v3e(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===`5096+`)l=0,c-=o;else{let p=b3e(f,s,l,c,t);n=="tb"?(l=0,c+=t.ascender*s):l+=p.offsetX,a.push(p.path)}}return a}function b3e(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 t2,a,l,c,u,f,p,x,v;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,p=w[S++]*e+n,o.quadraticCurveTo(f,p,c,u);break;case"b":c=w[S++]*e+t,u=w[S++]*e+n,f=w[S++]*e+t,p=w[S++]*e+n,x=w[S++]*e+t,v=w[S++]*e+n,o.bezierCurveTo(f,p,x,v,c,u);break}}return{offsetX:s.ha*e,path:o}}var Pb=class i extends By{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 $1(t.font.data),new i(t.text,t)}};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 w3e(i){if(Array.isArray(i))return i}function S3e(i){if(Array.isArray(i))return ik(i)}function Mte(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 T3e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function mte(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 E3e(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){mte(s,n,r,o,a,"next",l)}function a(l){mte(s,n,r,o,a,"throw",l)}o(void 0)})}}function gR(i,e,t){return e=Q1(e),F3e(i,ck()?Reflect.construct(e,t||[],Q1(i).constructor):e.apply(i,t))}function M3e(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _R(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Ib(i,e){return i.get(Mte(i,e))}function JU(i,e,t){M3e(i,e),e.set(i,t)}function ek(i,e,t){return i.set(Mte(i,e),t),t}function lk(i,e,t){if(ck())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 C3e(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,Cte(n.key),n)}}function xR(i,e,t){return e&&C3e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function oo(i,e,t){return(e=Cte(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function rk(){return rk=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=O3e(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},rk.apply(null,arguments)}function Q1(i){return Q1=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Q1(i)}function yR(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&&ok(i,e)}function ck(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ck=function(){return!!i})()}function R3e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function P3e(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 I3e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5097+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function N3e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5098+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gte(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 Bi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?gte(Object(t),!0).forEach(function(n){oo(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):gte(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function L3e(i,e){if(i==null)return{};var t,n,r=D3e(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 D3e(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 F3e(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 T3e(i)}function sk(){var i,e,t=typeof Symbol=="function"?Symbol:{},n=t.iterator||"@@iterator",r=t.toStringTag||"@@toStringTag";function s(x,v,w,S){var T=v&&v.prototype instanceof a?v:a,P=Object.create(T.prototype);return Bl(P,"_invoke",(function(R,C,L){var D,F,N,B=0,z=L||[],V=!1,H={p:0,n:0,v:i,a:Z,f:Z.bind(i,4),d:function(J,j){return D=J,F=0,N=i,H.n=j,o}};function Z(J,j){for(F=J,N=j,e=0;!V&&B&&!K&&e<z.length;e++){var K,ee=z[e],ae=H.p,ce=ee[2];J>3?(K=ce===j)&&(N=ee[(F=ee[4])?5:(F=3,3)],ee[4]=ee[5]=i):ee[0]<=ae&&((K=J<2&&ae<ee[1])?(F=0,H.v=j,H.n=ee[1]):ae<ce&&(K=J<3||ee[0]>j||j>ce)&&(ee[4]=J,ee[5]=j,H.n=ce,F=0))}if(K||J>1)return o;throw V=!0,j}return function(J,j,K){if(B>1)throw TypeError("Generator is already running");for(V&&j===1&&Z(j,K),F=j,N=K;(e=F<2?i:N)||!V;){D||(F?F<3?(F>1&&(H.n=-1),Z(F,N)):H.n=N:H.v=N);try{if(B=2,D){if(F||(J="next"),e=D[J]){if(!(e=e.call(D,N)))throw TypeError("iterator result is not an object");if(!e.done)return e;N=e.value,F<2&&(F=0)}else F===1&&(e=D.return)&&e.call(D),F<2&&(N=TypeError("The iterator does not provide a '"+J+"' method"),F=1);D=i}else if((e=(V=H.n<0)?N:R.call(C,H))!==o)break}catch(ee){D=i,F=1,N=ee}finally{B=1}}return{value:e,done:V}}})(x,w,S),!0),P}var o={};function a(){}function l(){}function c(){}e=Object.getPrototypeOf;var u=[][n]?e(e([][n]())):(Bl(e={},n,function(){return this}),e),f=c.prototype=a.prototype=Object.create(u);function p(x){return Object.setPrototypeOf?Object.setPrototypeOf(x,c):(x.__proto__=c,Bl(x,r,"GeneratorFunction")),x.prototype=Object.create(f),x}return l.prototype=c,Bl(f,"constructor",c),Bl(c,"constructor",l),l.displayName="GeneratorFunction",Bl(c,r,"GeneratorFunction"),Bl(f),Bl(f,r,"Generator"),Bl(f,n,function(){return this}),Bl(f,"toString",function(){return"[object Generator]"}),(sk=function(){return{w:s,m:p}})()}function Bl(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}Bl=function(s,o,a,l){function c(u,f){Bl(s,u,function(p){return this._invoke(u,f,p)})}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))},Bl(i,e,t,n)}function ok(i,e){return ok=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},ok(i,e)}function mr(i,e){return w3e(i)||P3e(i,e)||Rte(i,e)||I3e()}function O3e(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=Q1(i))!==null;);return i}function tk(i,e,t,n){var r=rk(Q1(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function qi(i){return S3e(i)||R3e(i)||Rte(i)||N3e()}function B3e(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 Cte(i){var e=B3e(i,"string");return typeof e=="symbol"?e:e+""}function Rte(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 Pte=function(e){e instanceof Array?e.forEach(Pte):(e.map&&e.map.dispose(),e.dispose())},v0=function(e){e.geometry&&e.geometry.dispose(),e.material&&Pte(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(v0)},Gr=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),v0(t)}};function Pa(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 sr=100;function _te(){return sr}function vc(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=sr*(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 Ite(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/sr-1}}function Zm(i){return i*Math.PI/180}var Lb=window.THREE?window.THREE:{BackSide:hi,BufferAttribute:Li,Color:Ut,Mesh:Gn,ShaderMaterial:$r},U3e=`50995099 uniform float hollowRadius;51005100 51015101 varying vec3 vVertexWorldPosition;
@@ -5115,7 +5115,7 @@ void main() {
51155115 vVertexAngularDistanceToHollowRadius = vertexAngle - edgeAngle;51165116 51175117 gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);5118-}`,B3e=`5118+}`,k3e=`51195119 uniform vec3 color;51205120 uniform float coefficient;51215121 uniform float power;
@@ -5138,7 +5138,7 @@ void main() {
51385138 power51395139 );51405140 gl_FragColor = vec4(color, intensity);5141-}`;function U3e(i,e,t,n){return new Ib.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:O3e,fragmentShader:B3e,uniforms:{coefficient:{value:i},color:{value:new Ib.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function k3e(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 Ib.BufferAttribute(n,3)),t}var G3e=(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,p=f===void 0?1:f,x=r.hollowRadius,v=x===void 0?0:x,w=r.backside,S=w===void 0?!0:w;mR(this,e),n=AR(this,e);var T=k3e(t,l),P=U3e(u,o,p,v);return S&&(P.side=Ib.BackSide),n.geometry=T,n.material=P,n}return _R(e,i),gR(e)})(Ib.Mesh),zh=window.THREE?window.THREE:{Color:Ut,Group:Lr,LineBasicMaterial:gl,LineSegments:__,Mesh:Gn,MeshPhongMaterial:PA,SphereGeometry:Aa,SRGBColorSpace:yr,TextureLoader:xl},Pte=Fr({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){y0(e.globeObj),y0(e.tileEngine),y0(e.graticulesObj)}},stateInit:function(){var e=new zh.MeshPhongMaterial({color:0}),t=new zh.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new l$(sr),r=new zh.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new zh.LineSegments(new x6(HD(),sr,2),new zh.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){Gr(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 zh.SphereGeometry(sr,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new zh.TextureLoader().load(e.globeImageUrl,function(a){var l;a.colorSpace=zh.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 zh.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new zh.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),y0(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new G3e(e.globeObj.geometry,{color:e.atmosphereColor,size:sr*e.atmosphereAltitude,hollowRadius:sr,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())}}),Vh=function(e){return isNaN(e)?parseInt(dn(e).toHex(),16):e},fu=function(e){return e&&isNaN(e)?Yc(e).opacity:1},v0=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=mr(a,4),c=l[0],u=l[1],f=l[2],p=l[3];r=new Ut("rgb(".concat(+c,",").concat(+u,",").concat(+f,")")),s=Math.min(+p,1)}else r=new Ut(e);n&&r.convertLinearToSRGB();var x=r.toArray();return t?[].concat(qi(x),[s]):x};function z3e(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var gte=window.THREE?window.THREE:{BufferAttribute:Li};function qh(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 gte.BufferAttribute(new t(i),e);for(var n=new gte.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function V3e(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 YU=new WeakMap,cR=new WeakMap,uR=new WeakMap,tl=(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 mR(this,e),n=AR(this,e),oo(n,"scene",void 0),jU(n,YU,void 0),jU(n,cR,void 0),jU(n,uR,void 0),n.scene=t,XU(YU,n,o),XU(cR,n,l),XU(uR,n,u),n.onRemoveObj(function(){}),n}return _R(e,i),gR(e,[{key:"onCreateObj",value:function(n){var r=this;return $U(e,"onCreateObj",this)([function(s){var o=n(s);return s[Rb(cR,r)]=o,o[Rb(YU,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return $U(e,"onRemoveObj",this)([function(s,o){var a=$U(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),y0(s),delete a[Rb(cR,r)]};Rb(uR,r)?setTimeout(l,Rb(uR,r)):l()}]),this}}])})(P$),cu=window.THREE?window.THREE:{BufferGeometry:qn,CylinderGeometry:EA,Matrix4:on,Mesh:Gn,MeshLambertMaterial:ma,Object3D:Yi,Vector3:ie},_te=Object.assign({},hv),xte=_te.BufferGeometryUtils||_te,Ite=Fr({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;Gr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new tl(e,{objBindAttr:"__threeObjPoint"})},update:function(e,t){var n=rt(e.pointLat),r=rt(e.pointLng),s=rt(e.pointAltitude),o=rt(e.pointRadius),a=rt(e.pointColor),l=new cu.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new cu.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new cu.Matrix4().makeTranslation(0,0,-.5));var c=2*Math.PI*sr/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&Gr(e.scene),e.dataMapper.scene=e.pointsMerge?new cu.Object3D:e.scene,e.dataMapper.onCreateObj(x).onUpdateObj(v).digest(e.pointsData),e.pointsMerge){var f=e.pointsData.length?(xte.mergeGeometries||xte.mergeBufferGeometries)(e.pointsData.map(function(w){var S=e.dataMapper.getObj(w),T=S.geometry.clone();S.updateMatrix(),T.applyMatrix4(S.matrix);var P=v0(a(w));return T.setAttribute("color",qh(Array(T.getAttribute("position").count).fill(P),4)),T})):new cu.BufferGeometry,p=new cu.Mesh(f,new cu.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));p.__globeObjType="points",p.__data=e.pointsData,e.dataMapper.clear(),Gr(e.scene),e.scene.add(p)}function x(){var w=new cu.Mesh(l);return w.__globeObjType="point",w}function v(w,S){var T=function(N){var B=w.__currentTargetD=N,z=B.r,V=B.alt,H=B.lat,Z=B.lng;Object.assign(w.position,yc(H,Z));var J=e.pointsMerge?new cu.Vector3(0,0,0):e.scene.localToWorld(new cu.Vector3(0,0,0));w.lookAt(J),w.scale.x=w.scale.y=Math.min(30,z)*c,w.scale.z=Math.max(V*sr,.1)},P={alt:+s(S),r:+o(S),lat:+n(S),lng:+r(S)},R=w.__currentTargetD||Object.assign({},P,{alt:-.001});if(Object.keys(P).some(function(F){return R[F]!==P[F]})&&(e.pointsMerge||!e.pointsTransitionDuration||e.pointsTransitionDuration<0?T(P):e.tweenGroup.add(new Hs(R).to(P,e.pointsTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(T).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var C=a(S),L=C?fu(C):0,D=!!L;w.visible=D,D&&(u.hasOwnProperty(C)||(u[C]=new cu.MeshLambertMaterial({color:Vh(C),transparent:L<1,opacity:L})),w.material=u[C])}}}}),Nte=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:`5141+}`;function G3e(i,e,t,n){return new Lb.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:U3e,fragmentShader:k3e,uniforms:{coefficient:{value:i},color:{value:new Lb.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function z3e(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 Lb.BufferAttribute(n,3)),t}var V3e=(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,p=f===void 0?1:f,x=r.hollowRadius,v=x===void 0?0:x,w=r.backside,S=w===void 0?!0:w;_R(this,e),n=gR(this,e);var T=z3e(t,l),P=G3e(u,o,p,v);return S&&(P.side=Lb.BackSide),n.geometry=T,n.material=P,n}return yR(e,i),xR(e)})(Lb.Mesh),qh=window.THREE?window.THREE:{Color:Ut,Group:vr,LineBasicMaterial:xl,LineSegments:x_,Mesh:Gn,MeshPhongMaterial:NA,SphereGeometry:Aa,SRGBColorSpace:yr,TextureLoader:ja},Nte=Fr({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){v0(e.globeObj),v0(e.tileEngine),v0(e.graticulesObj)}},stateInit:function(){var e=new qh.MeshPhongMaterial({color:0}),t=new qh.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new u$(sr),r=new qh.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new qh.LineSegments(new E6(KD(),sr,2),new qh.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){Gr(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 qh.SphereGeometry(sr,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new qh.TextureLoader().load(e.globeImageUrl,function(a){var l;a.colorSpace=qh.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 qh.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new qh.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),v0(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new V3e(e.globeObj.geometry,{color:e.atmosphereColor,size:sr*e.atmosphereAltitude,hollowRadius:sr,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())}}),Hh=function(e){return isNaN(e)?parseInt(dn(e).toHex(),16):e},du=function(e){return e&&isNaN(e)?Zc(e).opacity:1},b0=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=mr(a,4),c=l[0],u=l[1],f=l[2],p=l[3];r=new Ut("rgb(".concat(+c,",").concat(+u,",").concat(+f,")")),s=Math.min(+p,1)}else r=new Ut(e);n&&r.convertLinearToSRGB();var x=r.toArray();return t?[].concat(qi(x),[s]):x};function q3e(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var xte=window.THREE?window.THREE:{BufferAttribute:Li};function Wh(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 xte.BufferAttribute(new t(i),e);for(var n=new xte.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function H3e(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 nk=new WeakMap,hR=new WeakMap,fR=new WeakMap,nl=(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 _R(this,e),n=gR(this,e),oo(n,"scene",void 0),JU(n,nk,void 0),JU(n,hR,void 0),JU(n,fR,void 0),n.scene=t,ek(nk,n,o),ek(hR,n,l),ek(fR,n,u),n.onRemoveObj(function(){}),n}return yR(e,i),xR(e,[{key:"onCreateObj",value:function(n){var r=this;return tk(e,"onCreateObj",this)([function(s){var o=n(s);return s[Ib(hR,r)]=o,o[Ib(nk,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return tk(e,"onRemoveObj",this)([function(s,o){var a=tk(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),v0(s),delete a[Ib(hR,r)]};Ib(fR,r)?setTimeout(l,Ib(fR,r)):l()}]),this}}])})(N$),uu=window.THREE?window.THREE:{BufferGeometry:qn,CylinderGeometry:CA,Matrix4:on,Mesh:Gn,MeshLambertMaterial:ma,Object3D:Yi,Vector3:ie},yte=Object.assign({},dv),vte=yte.BufferGeometryUtils||yte,Lte=Fr({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;Gr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new nl(e,{objBindAttr:"__threeObjPoint"})},update:function(e,t){var n=rt(e.pointLat),r=rt(e.pointLng),s=rt(e.pointAltitude),o=rt(e.pointRadius),a=rt(e.pointColor),l=new uu.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new uu.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new uu.Matrix4().makeTranslation(0,0,-.5));var c=2*Math.PI*sr/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&Gr(e.scene),e.dataMapper.scene=e.pointsMerge?new uu.Object3D:e.scene,e.dataMapper.onCreateObj(x).onUpdateObj(v).digest(e.pointsData),e.pointsMerge){var f=e.pointsData.length?(vte.mergeGeometries||vte.mergeBufferGeometries)(e.pointsData.map(function(w){var S=e.dataMapper.getObj(w),T=S.geometry.clone();S.updateMatrix(),T.applyMatrix4(S.matrix);var P=b0(a(w));return T.setAttribute("color",Wh(Array(T.getAttribute("position").count).fill(P),4)),T})):new uu.BufferGeometry,p=new uu.Mesh(f,new uu.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));p.__globeObjType="points",p.__data=e.pointsData,e.dataMapper.clear(),Gr(e.scene),e.scene.add(p)}function x(){var w=new uu.Mesh(l);return w.__globeObjType="point",w}function v(w,S){var T=function(N){var B=w.__currentTargetD=N,z=B.r,V=B.alt,H=B.lat,Z=B.lng;Object.assign(w.position,vc(H,Z));var J=e.pointsMerge?new uu.Vector3(0,0,0):e.scene.localToWorld(new uu.Vector3(0,0,0));w.lookAt(J),w.scale.x=w.scale.y=Math.min(30,z)*c,w.scale.z=Math.max(V*sr,.1)},P={alt:+s(S),r:+o(S),lat:+n(S),lng:+r(S)},R=w.__currentTargetD||Object.assign({},P,{alt:-.001});if(Object.keys(P).some(function(F){return R[F]!==P[F]})&&(e.pointsMerge||!e.pointsTransitionDuration||e.pointsTransitionDuration<0?T(P):e.tweenGroup.add(new Hs(R).to(P,e.pointsTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(T).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var C=a(S),L=C?du(C):0,D=!!L;w.visible=D,D&&(u.hasOwnProperty(C)||(u[C]=new uu.MeshLambertMaterial({color:Hh(C),transparent:L<1,opacity:L})),w.material=u[C])}}}}),Dte=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:`51425142 `.concat(On.common,`51435143 `).concat(On.logdepthbuf_pars_vertex,`51445144
@@ -5178,7 +5178,7 @@ void main() {
51785178 51795179 `).concat(On.logdepthbuf_fragment,`51805180 }5181- `)}},ek=function(e){return e.uniforms.uSurfaceRadius={type:"float",value:0},e.vertexShader=(`attribute float surfaceRadius;5181+ `)}},ak=function(e){return e.uniforms.uSurfaceRadius={type:"float",value:0},e.vertexShader=(`attribute float surfaceRadius;51825182 varying float vSurfaceRadius;51835183 varying vec3 vPos;51845184 `+e.vertexShader).replace("void main() {",["void main() {","vSurfaceRadius = surfaceRadius;","vPos = position;"].join(`
@@ -5186,7 +5186,7 @@ varying vec3 vPos;
51865186 varying float vSurfaceRadius;51875187 varying vec3 vPos;51885188 `+e.fragmentShader).replace("void main() {",["void main() {","if (length(vPos) < max(uSurfaceRadius, vSurfaceRadius)) discard;"].join(`5189-`)),e},q3e=function(e){return e.vertexShader=`5189+`)),e},W3e=function(e){return e.vertexShader=`51905190 attribute float r;51915191 51925192 const float PI = 3.1415926535897932384626433832795;
@@ -5219,7 +5219,7 @@ varying vec3 vPos;
52195219 gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);52205220 }52215221 `),`5222- `),e},ik=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},H3e=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)}}},W3e=["stroke"],uu=window.THREE?window.THREE:{BufferGeometry:qn,CubicBezierCurve3:b_,Curve:pa,Group:Lr,Line:Lf,Mesh:Gn,NormalBlending:os,ShaderMaterial:$r,TubeGeometry:Oy,Vector3:ie},j3e=Ym.default.default||Ym.default,Lte=Fr({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 j3e,sharedMaterial:new uu.ShaderMaterial(Bi(Bi({},Nte()),{},{transparent:!0,blending:uu.NormalBlending}))}},init:function(e,t){Gr(e),t.scene=e,t.dataMapper=new tl(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new uu.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=mr(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=rt(e.arcStartLat),n=rt(e.arcStartLng),r=rt(e.arcStartAltitude),s=rt(e.arcEndLat),o=rt(e.arcEndLng),a=rt(e.arcEndAltitude),l=rt(e.arcAltitude),c=rt(e.arcAltitudeAutoScale),u=rt(e.arcStroke),f=rt(e.arcColor),p=rt(e.arcDashLength),x=rt(e.arcDashGap),v=rt(e.arcDashInitialGap),w=rt(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(R,C){var L=u(C),D=L!=null;if(!R.children.length||D!==(R.children[0].type==="Mesh")){Gr(R);var F=D?new uu.Mesh:new uu.Line(new uu.BufferGeometry);F.material=e.sharedMaterial.clone(),R.add(F)}var N=R.children[0];Object.assign(N.material.uniforms,{dashSize:{value:p(C)},gapSize:{value:x(C)},dashOffset:{value:v(C)}});var B=w(C);N.__dashAnimateStep=B>0?1e3/B:0;var z=T(f(C),e.arcCurveResolution,D?e.arcCircularResolution+1:1),V=P(e.arcCurveResolution,D?e.arcCircularResolution+1:1,!0);N.geometry.setAttribute("color",z),N.geometry.setAttribute("relDistance",V);var H=function(K){var ee=R.__currentTargetD=K,ae=ee.stroke,ce=I3e(ee,W3e),de=S(ce);D?(N.geometry&&N.geometry.dispose(),N.geometry=new uu.TubeGeometry(de,e.arcCurveResolution,ae/2,e.arcCircularResolution),N.geometry.setAttribute("color",z),N.geometry.setAttribute("relDistance",V)):N.geometry.setFromPoints(de.getPoints(e.arcCurveResolution))},Z={stroke:L,alt:l(C),altAutoScale:+c(C),startLat:+t(C),startLng:+n(C),startAlt:+r(C),endLat:+s(C),endLng:+o(C),endAlt:+a(C)},J=R.__currentTargetD||Object.assign({},Z,{altAutoScale:-.001});Object.keys(Z).some(function(j){return J[j]!==Z[j]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?H(Z):e.tweenGroup.add(new Hs(J).to(Z,e.arcsTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.arcsData);function S(R){var C=R.alt,L=R.altAutoScale,D=R.startLat,F=R.startLng,N=R.startAlt,B=R.endLat,z=R.endLng,V=R.endAlt,H=function(Me){var ze=mr(Me,3),$e=ze[0],Et=ze[1],Tt=ze[2],Ct=yc(Et,$e,Tt),un=Ct.x,Gt=Ct.y,Xe=Ct.z;return new uu.Vector3(un,Gt,Xe)},Z=[F,D],J=[z,B],j=C;if(j==null&&(j=Za(Z,J)/2*L+Math.max(N,V)),j||N||V){var K=om(Z,J),ee=function(Me,ze){return ze+(ze-Me)*(Me<ze?.5:.25)},ae=[.25,.75].map(function(mt){return[].concat(qi(K(mt)),[ee(mt<.5?N:V,j)])}),ce=mr(ae,2),de=ce[0],ve=ce[1],Ie=tk(uu.CubicBezierCurve3,qi([[].concat(Z,[N]),de,ve,[].concat(J,[V])].map(H)));return Ie}else{var Qe=.001;return Ue.apply(void 0,qi([[].concat(Z,[Qe]),[].concat(J,[Qe])].map(H)))}function Ue(mt,Me){var ze=mt.angleTo(Me),$e=ze===0?function(){return mt.clone()}:function(Tt){return new uu.Vector3().addVectors(mt.clone().multiplyScalar(Math.sin((1-Tt)*ze)),Me.clone().multiplyScalar(Math.sin(Tt*ze))).divideScalar(Math.sin(ze))},Et=new uu.Curve;return Et.getPoint=$e,Et}}function T(R,C){var L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,D=C+1,F;if(R instanceof Array||R instanceof Function){var N=R instanceof Array?$a().domain(R.map(function(j,K){return K/(R.length-1)})).range(R):R;F=function(K){return v0(N(K),!0,!0)}}else{var B=v0(R,!0,!0);F=function(){return B}}for(var z=[],V=0,H=D;V<H;V++)for(var Z=F(V/(H-1)),J=0;J<L;J++)z.push(Z);return qh(z,4)}function P(R){for(var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,D=R+1,F=[],N=0,B=D;N<B;N++)for(var z=N/(B-1),V=0;V<C;V++)F.push(z);return L&&F.reverse(),qh(F,1)}}}),_0=window.THREE?window.THREE:{BufferGeometry:qn,DoubleSide:rr,Mesh:Gn,MeshLambertMaterial:ma,Object3D:Yi},yte=Object.assign({},hv),vte=yte.BufferGeometryUtils||yte,Dte=Fr({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;Gr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new tl(e,{objBindAttr:"__threeObjHexbin"})},update:function(e,t){var n=rt(e.hexBinPointLat),r=rt(e.hexBinPointLng),s=rt(e.hexBinPointWeight),o=rt(e.hexAltitude),a=rt(e.hexTopColor),l=rt(e.hexSideColor),c=rt(e.hexMargin),u=K$(e.hexBinPointsData.map(function(P){return Bi(Bi({},P),{},{h3Idx:uY(n(P),r(P),e.hexBinResolution)})}),"h3Idx"),f=Object.entries(u).map(function(P){var R=mr(P,2),C=R[0],L=R[1];return{h3Idx:C,points:L,sumWeight:L.reduce(function(D,F){return D+ +s(F)},0)}}),p={};if(!e.hexBinMerge&&t.hasOwnProperty("hexBinMerge")&&Gr(e.scene),e.dataMapper.scene=e.hexBinMerge?new _0.Object3D:e.scene,e.dataMapper.id(function(P){return P.h3Idx}).onCreateObj(S).onUpdateObj(T).digest(f),e.hexBinMerge){var x=f.length?(vte.mergeGeometries||vte.mergeBufferGeometries)(f.map(function(P){var R=e.dataMapper.getObj(P),C=R.geometry.toNonIndexed();R.updateMatrix(),C.applyMatrix4(R.matrix);var L=v0(a(P)),D=v0(l(P)),F=C.getAttribute("position").count,N=C.groups[0].count;return C.setAttribute("color",qh(qi(new Array(F)).map(function(B,z){return z>=N?L:D}),4)),C})):new _0.BufferGeometry,v=new _0.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:_0.DoubleSide});v.onBeforeCompile=function(P){v.userData.shader=ek(P)};var w=new _0.Mesh(x,v);w.__globeObjType="hexBinPoints",w.__data=f,e.dataMapper.clear(),Gr(e.scene),e.scene.add(w)}function S(P){var R=new _0.Mesh;R.__hexCenter=z6(P.h3Idx),R.__hexGeoJson=V6(P.h3Idx,!0).reverse();var C=R.__hexCenter[1];return R.__hexGeoJson.forEach(function(L){var D=L[0];Math.abs(C-D)>170&&(L[0]+=C>D?360:-360)}),R.__globeObjType="hexbin",R}function T(P,R){var C=function(ee,ae,ce){return ee-(ee-ae)*ce},L=Math.max(0,Math.min(1,+c(R))),D=mr(P.__hexCenter,2),F=D[0],N=D[1],B=L===0?P.__hexGeoJson:P.__hexGeoJson.map(function(K){var ee=mr(K,2),ae=ee[0],ce=ee[1];return[[ae,N],[ce,F]].map(function(de){var ve=mr(de,2),Ie=ve[0],Qe=ve[1];return C(Ie,Qe,L)})}),z=e.hexTopCurvatureResolution;P.geometry&&P.geometry.dispose(),P.geometry=new wE([B],0,sr,!1,!0,!0,z);var V={alt:+o(R)},H=function(ee){var ae=P.__currentTargetD=ee,ce=ae.alt;P.scale.x=P.scale.y=P.scale.z=1+ce;var de=sr/(ce+1);P.geometry.setAttribute("surfaceRadius",qh(Array(P.geometry.getAttribute("position").count).fill(de),1))},Z=P.__currentTargetD||Object.assign({},V,{alt:-.001});if(Object.keys(V).some(function(K){return Z[K]!==V[K]})&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?H(V):e.tweenGroup.add(new Hs(Z).to(V,e.hexTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.hexBinMerge){var J=l(R),j=a(R);[J,j].forEach(function(K){if(!p.hasOwnProperty(K)){var ee=fu(K);p[K]=ik(new _0.MeshLambertMaterial({color:Vh(K),transparent:ee<1,opacity:ee,side:_0.DoubleSide}),ek)}}),P.material=[J,j].map(function(K){return p[K]})}}}}),Fte=function(e){return e*e},sd=function(e){return e*Math.PI/180};function X3e(i,e){var t=Math.sqrt,n=Math.cos,r=function(u){return Fte(Math.sin(u/2))},s=sd(i[1]),o=sd(e[1]),a=sd(i[0]),l=sd(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var $3e=Math.sqrt(2*Math.PI);function Y3e(i,e){return Math.exp(-Fte(i/e)/2)/(e*$3e)}var Z3e=function(e){var t=mr(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,p=f===void 0?function(){return 1}:f,x=o.bandwidth,v=[n,r],w=x*Math.PI/180;return x3(s.map(function(S){var T=p(S);if(!T)return 0;var P=X3e(v,[l(S),u(S)]);return Y3e(P,w)*T}))},K3e=(function(){var i=S3e(QU().m(function e(t){var n,r,s,o,a,l,c,u,f,p,x,v,w,S,T,P,R,C,L,D,F,N,B,z,V,H,Z,J,j,K,ee,ae,ce,de,ve,Ie,Qe,Ue,mt,Me,ze=arguments,$e,Et,Tt;return QU().w(function(Ct){for(;;)switch(Ct.n){case 0:if(r=ze.length>1&&ze[1]!==void 0?ze[1]:[],s=ze.length>2&&ze[2]!==void 0?ze[2]:{},o=s.lngAccessor,a=o===void 0?function(un){return un[0]}:o,l=s.latAccessor,c=l===void 0?function(un){return un[1]}:l,u=s.weightAccessor,f=u===void 0?function(){return 1}:u,p=s.bandwidth,(n=navigator)!==null&&n!==void 0&&n.gpu){Ct.n=1;break}return console.warn("WebGPU not enabled in browser. Please consider enabling it to improve performance."),Ct.a(2,t.map(function(un){return Z3e(un,r,{lngAccessor:a,latAccessor:c,weightAccessor:f,bandwidth:p})}));case 1:return x=4,v=Zee,w=Kee,S=lte,T=ate,P=nte,R=ite,C=Qee,L=ote,D=ste,F=ete,N=Jee,B=tte,z=rte,V=T(new km(new Float32Array(t.flat().map(sd)),2),"vec2",t.length),H=T(new km(new Float32Array(r.map(function(un){return[sd(a(un)),sd(c(un)),f(un)]}).flat()),3),"vec3",r.length),Z=new km(t.length,1),J=T(Z,"float",t.length),j=P(Math.PI),K=L(j.mul(2)),ee=function(Gt){return Gt.mul(Gt)},ae=function(Gt){return ee(D(Gt.div(2)))},ce=function(Gt,Xe){var st=P(Gt[1]),tt=P(Xe[1]),vt=P(Gt[0]),yt=P(Xe[0]);return P(2).mul(N(L(ae(tt.sub(st)).add(F(st).mul(F(tt)).mul(ae(yt.sub(vt)))))))},de=function(Gt,Xe){return B(z(ee(Gt.div(Xe)).div(2))).div(Xe.mul(K))},ve=S(sd(p)),Ie=S(sd(p*x)),Qe=S(r.length),Ue=v(function(){var un=V.element(R),Gt=J.element(R);Gt.assign(0),C(Qe,function(Xe){var st=Xe.i,tt=H.element(st),vt=tt.z;w(vt,function(){var yt=ce(tt.xy,un.xy);w(yt&&yt.lessThan(Ie),function(){Gt.addAssign(de(yt,ve).mul(vt))})})})}),mt=Ue().compute(t.length),Me=new k1,Ct.n=2,Me.computeAsync(mt);case 2:return $e=Array,Et=Float32Array,Ct.n=3,Me.getArrayBufferAsync(Z);case 3:return Tt=Ct.v,Ct.a(2,$e.from.call($e,new Et(Tt)))}},e)}));return function(t){return i.apply(this,arguments)}})(),hR=window.THREE?window.THREE:{Mesh:Gn,MeshLambertMaterial:ma,SphereGeometry:Aa},Q3e=3.5,J3e=.1,bte=100,eEe=function(e){var t=Yc(H6(e));return t.opacity=Math.cbrt(e),t.formatRgb()},Ote=Fr({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 eEe}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Gr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new tl(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new hR.Mesh(new hR.SphereGeometry(sr),ik(new hR.MeshLambertMaterial({vertexColors:!0,transparent:!0}),q3e));return s.__globeObjType="heatmap",s})},update:function(e){var t=rt(e.heatmapPoints),n=rt(e.heatmapPointLat),r=rt(e.heatmapPointLng),s=rt(e.heatmapPointWeight),o=rt(e.heatmapBandwidth),a=rt(e.heatmapColorFn),l=rt(e.heatmapColorSaturation),c=rt(e.heatmapBaseAltitude),u=rt(e.heatmapTopAltitude);e.dataMapper.onUpdateObj(function(f,p){var x=o(p),v=a(p),w=l(p),S=c(p),T=u(p),P=t(p).map(function(F){var N=n(F),B=r(F),z=yc(N,B),V=z.x,H=z.y,Z=z.z;return{x:V,y:H,z:Z,lat:N,lng:B,weight:s(F)}}),R=Math.max(J3e,x/Q3e),C=Math.ceil(360/(R||-1));f.geometry.parameters.widthSegments!==C&&(f.geometry.dispose(),f.geometry=new hR.SphereGeometry(sr,C,C/2));var L=V3e(f.geometry.getAttribute("position")),D=L.map(function(F){var N=mr(F,3),B=N[0],z=N[1],V=N[2],H=Rte({x:B,y:z,z:V}),Z=H.lng,J=H.lat;return[Z,J]});K3e(D,P,{latAccessor:function(N){return N.lat},lngAccessor:function(N){return N.lng},weightAccessor:function(N){return N.weight},bandwidth:x}).then(function(F){var N=qi(new Array(bte)).map(function(H,Z){return v0(v(Z/(bte-1)))}),B=function(Z){var J=f.__currentTargetD=Z,j=J.kdeVals,K=J.topAlt,ee=J.saturation,ae=g3(j.map(Math.abs))||1e-15,ce=V2([0,ae/ee],N);f.geometry.setAttribute("color",qh(j.map(function(ve){return ce(Math.abs(ve))}),4));var de=$a([0,ae],[sr*(1+S),sr*(1+(K||S))]);f.geometry.setAttribute("r",qh(j.map(de)))},z={kdeVals:F,topAlt:T,saturation:w},V=f.__currentTargetD||Object.assign({},z,{kdeVals:F.map(function(){return 0}),topAlt:T&&S,saturation:.5});V.kdeVals.length!==F.length&&(V.kdeVals=F.slice()),Object.keys(z).some(function(H){return V[H]!==z[H]})&&(!e.heatmapsTransitionDuration||e.heatmapsTransitionDuration<0?B(z):e.tweenGroup.add(new Hs(V).to(z,e.heatmapsTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(B).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),x0=window.THREE?window.THREE:{DoubleSide:rr,Group:Lr,LineBasicMaterial:gl,LineSegments:__,Mesh:Gn,MeshBasicMaterial:as},Bte=Fr({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;Gr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new tl(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new x0.Group;return s.__defaultSideMaterial=ik(new x0.MeshBasicMaterial({side:x0.DoubleSide,depthWrite:!0}),ek),s.__defaultCapMaterial=new x0.MeshBasicMaterial({side:x0.DoubleSide,depthWrite:!0}),s.add(new x0.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new x0.LineSegments(void 0,new x0.LineBasicMaterial)),s.__globeObjType="polygon",s})},update:function(e){var t=rt(e.polygonGeoJsonGeometry),n=rt(e.polygonAltitude),r=rt(e.polygonCapCurvatureResolution),s=rt(e.polygonCapColor),o=rt(e.polygonCapMaterial),a=rt(e.polygonSideColor),l=rt(e.polygonSideMaterial),c=rt(e.polygonStrokeColor),u=[];e.polygonsData.forEach(function(f){var p={data:f,capColor:s(f),capMaterial:o(f),sideColor:a(f),sideMaterial:l(f),strokeColor:c(f),altitude:+n(f),capCurvatureResolution:+r(f)},x=t(f),v=f.__id||"".concat(Math.round(Math.random()*1e9));f.__id=v,x.type==="Polygon"?u.push(Bi({id:"".concat(v,"_0"),coords:x.coordinates},p)):x.type==="MultiPolygon"?u.push.apply(u,qi(x.coordinates.map(function(w,S){return Bi({id:"".concat(v,"_").concat(S),coords:w},p)}))):console.warn("Unsupported GeoJson geometry type: ".concat(x.type,". Skipping geometry..."))}),e.dataMapper.onUpdateObj(function(f,p){var x=p.coords,v=p.capColor,w=p.capMaterial,S=p.sideColor,T=p.sideMaterial,P=p.strokeColor,R=p.altitude,C=p.capCurvatureResolution,L=mr(f.children,2),D=L[0],F=L[1],N=!!P;F.visible=N;var B=!!(v||w),z=!!(S||T);tEe(D.geometry.parameters||{},{polygonGeoJson:x,curvatureResolution:C,closedTop:B,includeSides:z})||(D.geometry&&D.geometry.dispose(),D.geometry=new wE(x,0,sr,!1,B,z,C)),N&&(!F.geometry.parameters||F.geometry.parameters.geoJson.coordinates!==x||F.geometry.parameters.resolution!==C)&&(F.geometry&&F.geometry.dispose(),F.geometry=new x6({type:"Polygon",coordinates:x},sr,C));var V=z?0:-1,H=B?z?1:0:-1;if(V>=0&&(D.material[V]=T||f.__defaultSideMaterial),H>=0&&(D.material[H]=w||f.__defaultCapMaterial),[[!T&&S,V],[!w&&v,H]].forEach(function(ae){var ce=mr(ae,2),de=ce[0],ve=ce[1];if(!(!de||ve<0)){var Ie=D.material[ve],Qe=fu(de);Ie.color.set(Vh(de)),Ie.transparent=Qe<1,Ie.opacity=Qe}}),N){var Z=F.material,J=fu(P);Z.color.set(Vh(P)),Z.transparent=J<1,Z.opacity=J}var j={alt:R},K=function(ce){var de=f.__currentTargetD=ce,ve=de.alt;D.scale.x=D.scale.y=D.scale.z=1+ve,N&&(F.scale.x=F.scale.y=F.scale.z=1+ve+1e-4),H3e(f.__defaultSideMaterial,function(Ie){return Ie.uSurfaceRadius.value=sr/(ve+1)})},ee=f.__currentTargetD||Object.assign({},j,{alt:-.001});Object.keys(j).some(function(ae){return ee[ae]!==j[ae]})&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||ee.alt===j.alt?K(j):e.tweenGroup.add(new Hs(ee).to(j,e.polygonsTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(K).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(u)}});function tEe(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=mr(n,2),s=r[0],o=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],o)})}var $1=window.THREE?window.THREE:{BufferGeometry:qn,DoubleSide:rr,Mesh:Gn,MeshLambertMaterial:ma,Vector3:ie},wte=Object.assign({},hv),Ste=wte.BufferGeometryUtils||wte,Ute=Fr({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;Gr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new tl(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new $1.Mesh(void 0,new $1.MeshLambertMaterial({side:$1.DoubleSide}));return s.__globeObjType="hexPolygon",s})},update:function(e){var t=rt(e.hexPolygonGeoJsonGeometry),n=rt(e.hexPolygonColor),r=rt(e.hexPolygonAltitude),s=rt(e.hexPolygonResolution),o=rt(e.hexPolygonMargin),a=rt(e.hexPolygonUseDots),l=rt(e.hexPolygonCurvatureResolution),c=rt(e.hexPolygonDotResolution);e.dataMapper.onUpdateObj(function(u,f){var p=t(f),x=s(f),v=r(f),w=Math.max(0,Math.min(1,+o(f))),S=a(f),T=l(f),P=c(f),R=n(f),C=fu(R);u.material.color.set(Vh(R)),u.material.transparent=C<1,u.material.opacity=C;var L={alt:v,margin:w,curvatureResolution:T},D={geoJson:p,h3Res:x},F=u.__currentTargetD||Object.assign({},L,{alt:-.001}),N=u.__currentMemD||D;if(Object.keys(L).some(function(H){return F[H]!==L[H]})||Object.keys(D).some(function(H){return N[H]!==D[H]})){u.__currentMemD=D;var B=[];p.type==="Polygon"?q6(p.coordinates,x,!0).forEach(function(H){return B.push(H)}):p.type==="MultiPolygon"?p.coordinates.forEach(function(H){return q6(H,x,!0).forEach(function(Z){return B.push(Z)})}):console.warn("Unsupported GeoJson geometry type: ".concat(p.type,". Skipping geometry..."));var z=B.map(function(H){var Z=z6(H),J=V6(H,!0).reverse(),j=Z[1];return J.forEach(function(K){var ee=K[0];Math.abs(j-ee)>170&&(K[0]+=j>ee?360:-360)}),{h3Idx:H,hexCenter:Z,hexGeoJson:J}}),V=function(Z){var J=u.__currentTargetD=Z,j=J.alt,K=J.margin,ee=J.curvatureResolution;u.geometry&&u.geometry.dispose(),u.geometry=z.length?(Ste.mergeGeometries||Ste.mergeBufferGeometries)(z.map(function(ae){var ce=mr(ae.hexCenter,2),de=ce[0],ve=ce[1];if(S){var Ie=yc(de,ve,j),Qe=yc(ae.hexGeoJson[0][1],ae.hexGeoJson[0][0],j),Ue=.85*(1-K)*new $1.Vector3(Ie.x,Ie.y,Ie.z).distanceTo(new $1.Vector3(Qe.x,Qe.y,Qe.z)),mt=new y_(Ue,P);return mt.rotateX($m(-de)),mt.rotateY($m(ve)),mt.translate(Ie.x,Ie.y,Ie.z),mt}else{var Me=function(Et,Tt,Ct){return Et-(Et-Tt)*Ct},ze=K===0?ae.hexGeoJson:ae.hexGeoJson.map(function($e){var Et=mr($e,2),Tt=Et[0],Ct=Et[1];return[[Tt,ve],[Ct,de]].map(function(un){var Gt=mr(un,2),Xe=Gt[0],st=Gt[1];return Me(Xe,st,K)})});return new wE([ze],sr,sr*(1+j),!1,!0,!1,ee)}})):new $1.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?V(L):e.tweenGroup.add(new Hs(F).to(L,e.hexPolygonsTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(V).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),nEe=window.THREE?window.THREE:{Vector3:ie};function iEe(i,e){var t=function(o,a){var l=o[o.length-1];return[].concat(qi(o),qi(Array(a-o.length).fill(l)))},n=Math.max(i.length,e.length),r=sD.apply(void 0,qi([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=mr(o,3),l=a[0],c=a[1],u=a[2];return new nEe.Vector3(l,c,u)})}}var Xm=window.THREE?window.THREE:{BufferGeometry:qn,Color:Ut,Group:Lr,Line:Lf,NormalBlending:os,ShaderMaterial:$r,Vector3:ie},rEe=Ym.default.default||Ym.default,kte=Fr({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 rEe,sharedMaterial:new Xm.ShaderMaterial(Bi(Bi({},Nte()),{},{transparent:!0,blending:Xm.NormalBlending}))}},init:function(e,t){Gr(e),t.scene=e,t.dataMapper=new tl(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new Xm.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=mr(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=rt(e.pathPoints),n=rt(e.pathPointLat),r=rt(e.pathPointLng),s=rt(e.pathPointAlt),o=rt(e.pathStroke),a=rt(e.pathColor),l=rt(e.pathDashLength),c=rt(e.pathDashGap),u=rt(e.pathDashInitialGap),f=rt(e.pathDashAnimateTime);e.dataMapper.onUpdateObj(function(S,T){var P=o(T),R=P!=null;if(!S.children.length||R===(S.children[0].type==="Line")){Gr(S);var C=R?new lR(new j1,new g0):new Xm.Line(new Xm.BufferGeometry,e.sharedMaterial.clone());S.add(C)}var L=S.children[0],D=x(t(T),n,r,s,e.pathResolution),F=f(T);if(L.__dashAnimateStep=F>0?1e3/F:0,R){L.material.resolution=e.rendererSize;{var z=l(T),V=c(T),H=u(T);L.material.dashed=V>0,L.material.dashed?L.material.defines.USE_DASH="":delete L.material.defines.USE_DASH,L.material.dashed&&(L.material.dashScale=1/p(D),L.material.dashSize=z,L.material.gapSize=V,L.material.dashOffset=-H)}{var Z=a(T);if(Z instanceof Array){var J=v(a(T),D.length-1,1,!1);L.geometry.setColors(J.array),L.material.vertexColors=!0}else{var j=Z,K=fu(j);L.material.color=new Xm.Color(Vh(j)),L.material.transparent=K<1,L.material.opacity=K,L.material.vertexColors=!1}}L.material.needsUpdate=!0}else{Object.assign(L.material.uniforms,{dashSize:{value:l(T)},gapSize:{value:c(T)},dashOffset:{value:u(T)}});var N=v(a(T),D.length),B=w(D.length,1,!0);L.geometry.setAttribute("color",N),L.geometry.setAttribute("relDistance",B)}var ee=iEe(S.__currentTargetD&&S.__currentTargetD.points||[D[0]],D),ae=function(Ie){var Qe=S.__currentTargetD=Ie,Ue=Qe.stroke,mt=Qe.interpolK,Me=S.__currentTargetD.points=ee(mt);if(R){var ze;L.geometry.setPositions((ze=[]).concat.apply(ze,qi(Me.map(function($e){var Et=$e.x,Tt=$e.y,Ct=$e.z;return[Et,Tt,Ct]})))),L.material.linewidth=Ue,L.material.dashed&&L.computeLineDistances()}else L.geometry.setFromPoints(Me),L.geometry.computeBoundingSphere()},ce={stroke:P,interpolK:1},de=Object.assign({},S.__currentTargetD||ce,{interpolK:0});Object.keys(ce).some(function(ve){return de[ve]!==ce[ve]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?ae(ce):e.tweenGroup.add(new Hs(de).to(ce,e.pathTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(ae).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.pathsData);function p(S){var T=0,P;return S.forEach(function(R){P&&(T+=P.distanceTo(R)),P=R}),T}function x(S,T,P,R,C){var L=function(B,z,V){for(var H=[],Z=1;Z<=V;Z++)H.push(B+(z-B)*Z/(V+1));return H},D=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,V=[],H=null;return B.forEach(function(Z){if(H){for(;Math.abs(H[1]-Z[1])>180;)H[1]+=360*(H[1]<Z[1]?1:-1);var J=Math.sqrt(Math.pow(Z[0]-H[0],2)+Math.pow(Z[1]-H[1],2));if(J>z)for(var j=Math.floor(J/z),K=L(H[0],Z[0],j),ee=L(H[1],Z[1],j),ae=L(H[2],Z[2],j),ce=0,de=K.length;ce<de;ce++)V.push([K[ce],ee[ce],ae[ce]])}V.push(H=Z)}),V},F=function(B){var z=mr(B,3),V=z[0],H=z[1],Z=z[2],J=yc(V,H,Z),j=J.x,K=J.y,ee=J.z;return new Xm.Vector3(j,K,ee)};return D(S.map(function(N){return[T(N),P(N),R(N)]}),C).map(F)}function v(S,T){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,R=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,C=T+1,L;if(S instanceof Array||S instanceof Function){var D=S instanceof Array?$a().domain(S.map(function(Z,J){return J/(S.length-1)})).range(S):S;L=function(J){return v0(D(J),R,!0)}}else{var F=v0(S,R,!0);L=function(){return F}}for(var N=[],B=0,z=C;B<z;B++)for(var V=L(B/(z-1)),H=0;H<P;H++)N.push(V);return qh(N,R?4:3)}function w(S){for(var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,R=S+1,C=[],L=0,D=R;L<D;L++)for(var F=L/(D-1),N=0;N<T;N++)C.push(F);return P&&C.reverse(),qh(C,1)}}}),fR=window.THREE?window.THREE:{Euler:fa,Mesh:Gn,MeshLambertMaterial:ma,SphereGeometry:Aa},Gte=Fr({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 fR.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Gr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new tl(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new fR.Mesh;return s.__globeObjType="tile",s})},update:function(e){var t=rt(e.tileLat),n=rt(e.tileLng),r=rt(e.tileAltitude),s=rt(e.tileWidth),o=rt(e.tileHeight),a=rt(e.tileUseGlobeProjection),l=rt(e.tileMaterial),c=rt(e.tileCurvatureResolution);e.dataMapper.onUpdateObj(function(u,f){u.material=l(f);var p=a(f),x=c(f),v=function(P){var R=u.__currentTargetD=P,C=R.lat,L=R.lng,D=R.alt,F=R.width,N=R.height,B=Y1(L),z=Y1(-C);u.geometry&&u.geometry.dispose(),u.geometry=new fR.SphereGeometry(sr*(1+D),Math.ceil(F/(x||-1)),Math.ceil(N/(x||-1)),Y1(90-F/2)+(p?B:0),Y1(F),Y1(90-N/2)+(p?z:0),Y1(N)),p||u.setRotationFromEuler(new fR.Euler(z,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?v(w):e.tweenGroup.add(new Hs(S).to(w,e.tilesTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(v).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),Y1=function(e){return e*Math.PI/180},Pb=window.THREE?window.THREE:{BufferGeometry:qn,Color:Ut,Points:Sy,PointsMaterial:Jd},zte=Fr({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){Gr(e),t.scene=e,t.dataMapper=new tl(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new Pb.Points(new Pb.BufferGeometry,new Pb.PointsMaterial);return n.__globeObjType="particles",n}).onUpdateObj(function(n,r){var s=rt(t.particlesList),o=rt(t.particleLat),a=rt(t.particleLng),l=rt(t.particleAltitude);n.geometry.setAttribute("position",qh(s(r).map(function(c){return Object.values(yc(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=rt(e.particlesColor),r=rt(e.particlesSize),s=rt(e.particlesSizeAttenuation),o=rt(e.particlesTexture);e.dataMapper.entries().forEach(function(a){var l=mr(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 Pb.Color(16777215),u.material.transparent=!1,u.material.alphaTest=.5,u.material.map=o(c);else{var f=n(c),p=fu(f);u.material.color=new Pb.Color(Vh(f)),u.material.transparent=p<1,u.material.opacity=p,u.material.alphaTest=0}})}}),sEe=window.THREE?window.THREE:{BufferGeometry:qn},oEe=(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;mR(this,e),t=AR(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 _R(e,i),gR(e)})(sEe.BufferGeometry),Z1=window.THREE?window.THREE:{Color:Ut,Group:Lr,Line:Lf,LineBasicMaterial:gl,Vector3:ie},aEe=Ym.default.default||Ym.default,Vte=Fr({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;Gr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new tl(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new Z1.Group;return s.__globeObjType="ring",s}),t.ticker=new aEe,t.ticker.onTick.add(function(s){if(t.ringsData.length){var o=rt(t.ringColor),a=rt(t.ringAltitude),l=rt(t.ringMaxRadius),c=rt(t.ringPropagationSpeed),u=rt(t.ringRepeatPeriod);t.dataMapper.entries().filter(function(f){var p=mr(f,2),x=p[1];return x}).forEach(function(f){var p=mr(f,2),x=p[0],v=p[1];if((v.__nextRingTime||0)<=s){var w=u(x)/1e3;v.__nextRingTime=s+(w<=0?1/0:w);var S=new Z1.Line(new oEe(1,t.ringResolution),new Z1.LineBasicMaterial),T=o(x),P=T instanceof Array||T instanceof Function,R;P?T instanceof Array?(R=$a().domain(T.map(function(V,H){return H/(T.length-1)})).range(T),S.material.transparent=T.some(function(V){return fu(V)<1})):(R=T,S.material.transparent=!0):(S.material.color=new Z1.Color(Vh(T)),z3e(S.material,fu(T)));var C=sr*(1+a(x)),L=l(x),D=L*Math.PI/180,F=c(x),N=F<=0,B=function(H){var Z=H.t,J=(N?1-Z:Z)*D;if(S.scale.x=S.scale.y=C*Math.sin(J),S.position.z=C*(1-Math.cos(J)),P){var j=R(Z);S.material.color=new Z1.Color(Vh(j)),S.material.transparent&&(S.material.opacity=fu(j))}};if(F===0)B({t:0}),v.add(S);else{var z=Math.abs(L/F)*1e3;t.tweenGroup.add(new Hs({t:0}).to({t:1},z).onUpdate(B).onStart(function(){return v.add(S)}).onComplete(function(){t.tweenGroup.remove(this),v.remove(S),y0(S)}).start())}}})}})},update:function(e){var t=rt(e.ringLat),n=rt(e.ringLng),r=rt(e.ringAltitude),s=e.scene.localToWorld(new Z1.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),c=n(a),u=r(a);Object.assign(o.position,yc(l,c,u)),o.lookAt(s)}).digest(e.ringsData)}}),lEe={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 "}},cEe="normal",uEe=1189,hEe=-100,fEe="normal",dEe={yMin:-334,xMin:-111,yMax:1189,xMax:1672},pEe=1e3,AEe={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.\r5222+ `),e},uk=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},j3e=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)}}},X3e=["stroke"],hu=window.THREE?window.THREE:{BufferGeometry:qn,CubicBezierCurve3:w_,Curve:pa,Group:vr,Line:Df,Mesh:Gn,NormalBlending:os,ShaderMaterial:$r,TubeGeometry:Uy,Vector3:ie},$3e=Km.default.default||Km.default,Fte=Fr({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 $3e,sharedMaterial:new hu.ShaderMaterial(Bi(Bi({},Dte()),{},{transparent:!0,blending:hu.NormalBlending}))}},init:function(e,t){Gr(e),t.scene=e,t.dataMapper=new nl(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new hu.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=mr(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=rt(e.arcStartLat),n=rt(e.arcStartLng),r=rt(e.arcStartAltitude),s=rt(e.arcEndLat),o=rt(e.arcEndLng),a=rt(e.arcEndAltitude),l=rt(e.arcAltitude),c=rt(e.arcAltitudeAutoScale),u=rt(e.arcStroke),f=rt(e.arcColor),p=rt(e.arcDashLength),x=rt(e.arcDashGap),v=rt(e.arcDashInitialGap),w=rt(e.arcDashAnimateTime);e.dataMapper.onUpdateObj(function(R,C){var L=u(C),D=L!=null;if(!R.children.length||D!==(R.children[0].type==="Mesh")){Gr(R);var F=D?new hu.Mesh:new hu.Line(new hu.BufferGeometry);F.material=e.sharedMaterial.clone(),R.add(F)}var N=R.children[0];Object.assign(N.material.uniforms,{dashSize:{value:p(C)},gapSize:{value:x(C)},dashOffset:{value:v(C)}});var B=w(C);N.__dashAnimateStep=B>0?1e3/B:0;var z=T(f(C),e.arcCurveResolution,D?e.arcCircularResolution+1:1),V=P(e.arcCurveResolution,D?e.arcCircularResolution+1:1,!0);N.geometry.setAttribute("color",z),N.geometry.setAttribute("relDistance",V);var H=function(K){var ee=R.__currentTargetD=K,ae=ee.stroke,ce=L3e(ee,X3e),de=S(ce);D?(N.geometry&&N.geometry.dispose(),N.geometry=new hu.TubeGeometry(de,e.arcCurveResolution,ae/2,e.arcCircularResolution),N.geometry.setAttribute("color",z),N.geometry.setAttribute("relDistance",V)):N.geometry.setFromPoints(de.getPoints(e.arcCurveResolution))},Z={stroke:L,alt:l(C),altAutoScale:+c(C),startLat:+t(C),startLng:+n(C),startAlt:+r(C),endLat:+s(C),endLng:+o(C),endAlt:+a(C)},J=R.__currentTargetD||Object.assign({},Z,{altAutoScale:-.001});Object.keys(Z).some(function(j){return J[j]!==Z[j]})&&(!e.arcsTransitionDuration||e.arcsTransitionDuration<0?H(Z):e.tweenGroup.add(new Hs(J).to(Z,e.arcsTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.arcsData);function S(R){var C=R.alt,L=R.altAutoScale,D=R.startLat,F=R.startLng,N=R.startAlt,B=R.endLat,z=R.endLng,V=R.endAlt,H=function(Me){var ze=mr(Me,3),$e=ze[0],Et=ze[1],Tt=ze[2],Ct=vc(Et,$e,Tt),un=Ct.x,Gt=Ct.y,Xe=Ct.z;return new hu.Vector3(un,Gt,Xe)},Z=[F,D],J=[z,B],j=C;if(j==null&&(j=Ka(Z,J)/2*L+Math.max(N,V)),j||N||V){var K=lm(Z,J),ee=function(Me,ze){return ze+(ze-Me)*(Me<ze?.5:.25)},ae=[.25,.75].map(function(mt){return[].concat(qi(K(mt)),[ee(mt<.5?N:V,j)])}),ce=mr(ae,2),de=ce[0],ve=ce[1],Ie=lk(hu.CubicBezierCurve3,qi([[].concat(Z,[N]),de,ve,[].concat(J,[V])].map(H)));return Ie}else{var Qe=.001;return Ue.apply(void 0,qi([[].concat(Z,[Qe]),[].concat(J,[Qe])].map(H)))}function Ue(mt,Me){var ze=mt.angleTo(Me),$e=ze===0?function(){return mt.clone()}:function(Tt){return new hu.Vector3().addVectors(mt.clone().multiplyScalar(Math.sin((1-Tt)*ze)),Me.clone().multiplyScalar(Math.sin(Tt*ze))).divideScalar(Math.sin(ze))},Et=new hu.Curve;return Et.getPoint=$e,Et}}function T(R,C){var L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,D=C+1,F;if(R instanceof Array||R instanceof Function){var N=R instanceof Array?Ya().domain(R.map(function(j,K){return K/(R.length-1)})).range(R):R;F=function(K){return b0(N(K),!0,!0)}}else{var B=b0(R,!0,!0);F=function(){return B}}for(var z=[],V=0,H=D;V<H;V++)for(var Z=F(V/(H-1)),J=0;J<L;J++)z.push(Z);return Wh(z,4)}function P(R){for(var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,L=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,D=R+1,F=[],N=0,B=D;N<B;N++)for(var z=N/(B-1),V=0;V<C;V++)F.push(z);return L&&F.reverse(),Wh(F,1)}}}),x0=window.THREE?window.THREE:{BufferGeometry:qn,DoubleSide:rr,Mesh:Gn,MeshLambertMaterial:ma,Object3D:Yi},bte=Object.assign({},dv),wte=bte.BufferGeometryUtils||bte,Ote=Fr({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;Gr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new nl(e,{objBindAttr:"__threeObjHexbin"})},update:function(e,t){var n=rt(e.hexBinPointLat),r=rt(e.hexBinPointLng),s=rt(e.hexBinPointWeight),o=rt(e.hexAltitude),a=rt(e.hexTopColor),l=rt(e.hexSideColor),c=rt(e.hexMargin),u=J$(e.hexBinPointsData.map(function(P){return Bi(Bi({},P),{},{h3Idx:fY(n(P),r(P),e.hexBinResolution)})}),"h3Idx"),f=Object.entries(u).map(function(P){var R=mr(P,2),C=R[0],L=R[1];return{h3Idx:C,points:L,sumWeight:L.reduce(function(D,F){return D+ +s(F)},0)}}),p={};if(!e.hexBinMerge&&t.hasOwnProperty("hexBinMerge")&&Gr(e.scene),e.dataMapper.scene=e.hexBinMerge?new x0.Object3D:e.scene,e.dataMapper.id(function(P){return P.h3Idx}).onCreateObj(S).onUpdateObj(T).digest(f),e.hexBinMerge){var x=f.length?(wte.mergeGeometries||wte.mergeBufferGeometries)(f.map(function(P){var R=e.dataMapper.getObj(P),C=R.geometry.toNonIndexed();R.updateMatrix(),C.applyMatrix4(R.matrix);var L=b0(a(P)),D=b0(l(P)),F=C.getAttribute("position").count,N=C.groups[0].count;return C.setAttribute("color",Wh(qi(new Array(F)).map(function(B,z){return z>=N?L:D}),4)),C})):new x0.BufferGeometry,v=new x0.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:x0.DoubleSide});v.onBeforeCompile=function(P){v.userData.shader=ak(P)};var w=new x0.Mesh(x,v);w.__globeObjType="hexBinPoints",w.__data=f,e.dataMapper.clear(),Gr(e.scene),e.scene.add(w)}function S(P){var R=new x0.Mesh;R.__hexCenter=$6(P.h3Idx),R.__hexGeoJson=Y6(P.h3Idx,!0).reverse();var C=R.__hexCenter[1];return R.__hexGeoJson.forEach(function(L){var D=L[0];Math.abs(C-D)>170&&(L[0]+=C>D?360:-360)}),R.__globeObjType="hexbin",R}function T(P,R){var C=function(ee,ae,ce){return ee-(ee-ae)*ce},L=Math.max(0,Math.min(1,+c(R))),D=mr(P.__hexCenter,2),F=D[0],N=D[1],B=L===0?P.__hexGeoJson:P.__hexGeoJson.map(function(K){var ee=mr(K,2),ae=ee[0],ce=ee[1];return[[ae,N],[ce,F]].map(function(de){var ve=mr(de,2),Ie=ve[0],Qe=ve[1];return C(Ie,Qe,L)})}),z=e.hexTopCurvatureResolution;P.geometry&&P.geometry.dispose(),P.geometry=new TE([B],0,sr,!1,!0,!0,z);var V={alt:+o(R)},H=function(ee){var ae=P.__currentTargetD=ee,ce=ae.alt;P.scale.x=P.scale.y=P.scale.z=1+ce;var de=sr/(ce+1);P.geometry.setAttribute("surfaceRadius",Wh(Array(P.geometry.getAttribute("position").count).fill(de),1))},Z=P.__currentTargetD||Object.assign({},V,{alt:-.001});if(Object.keys(V).some(function(K){return Z[K]!==V[K]})&&(e.hexBinMerge||!e.hexTransitionDuration||e.hexTransitionDuration<0?H(V):e.tweenGroup.add(new Hs(Z).to(V,e.hexTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.hexBinMerge){var J=l(R),j=a(R);[J,j].forEach(function(K){if(!p.hasOwnProperty(K)){var ee=du(K);p[K]=uk(new x0.MeshLambertMaterial({color:Hh(K),transparent:ee<1,opacity:ee,side:x0.DoubleSide}),ak)}}),P.material=[J,j].map(function(K){return p[K]})}}}}),Bte=function(e){return e*e},od=function(e){return e*Math.PI/180};function Y3e(i,e){var t=Math.sqrt,n=Math.cos,r=function(u){return Bte(Math.sin(u/2))},s=od(i[1]),o=od(e[1]),a=od(i[0]),l=od(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var Z3e=Math.sqrt(2*Math.PI);function K3e(i,e){return Math.exp(-Bte(i/e)/2)/(e*Z3e)}var Q3e=function(e){var t=mr(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,p=f===void 0?function(){return 1}:f,x=o.bandwidth,v=[n,r],w=x*Math.PI/180;return v3(s.map(function(S){var T=p(S);if(!T)return 0;var P=Y3e(v,[l(S),u(S)]);return K3e(P,w)*T}))},J3e=(function(){var i=E3e(sk().m(function e(t){var n,r,s,o,a,l,c,u,f,p,x,v,w,S,T,P,R,C,L,D,F,N,B,z,V,H,Z,J,j,K,ee,ae,ce,de,ve,Ie,Qe,Ue,mt,Me,ze=arguments,$e,Et,Tt;return sk().w(function(Ct){for(;;)switch(Ct.n){case 0:if(r=ze.length>1&&ze[1]!==void 0?ze[1]:[],s=ze.length>2&&ze[2]!==void 0?ze[2]:{},o=s.lngAccessor,a=o===void 0?function(un){return un[0]}:o,l=s.latAccessor,c=l===void 0?function(un){return un[1]}:l,u=s.weightAccessor,f=u===void 0?function(){return 1}:u,p=s.bandwidth,(n=navigator)!==null&&n!==void 0&&n.gpu){Ct.n=1;break}return console.warn("WebGPU not enabled in browser. Please consider enabling it to improve performance."),Ct.a(2,t.map(function(un){return Q3e(un,r,{lngAccessor:a,latAccessor:c,weightAccessor:f,bandwidth:p})}));case 1:return x=4,v=Qee,w=Jee,S=ute,T=cte,P=rte,R=ste,C=ete,L=lte,D=ate,F=nte,N=tte,B=ite,z=ote,V=T(new zm(new Float32Array(t.flat().map(od)),2),"vec2",t.length),H=T(new zm(new Float32Array(r.map(function(un){return[od(a(un)),od(c(un)),f(un)]}).flat()),3),"vec3",r.length),Z=new zm(t.length,1),J=T(Z,"float",t.length),j=P(Math.PI),K=L(j.mul(2)),ee=function(Gt){return Gt.mul(Gt)},ae=function(Gt){return ee(D(Gt.div(2)))},ce=function(Gt,Xe){var st=P(Gt[1]),tt=P(Xe[1]),vt=P(Gt[0]),yt=P(Xe[0]);return P(2).mul(N(L(ae(tt.sub(st)).add(F(st).mul(F(tt)).mul(ae(yt.sub(vt)))))))},de=function(Gt,Xe){return B(z(ee(Gt.div(Xe)).div(2))).div(Xe.mul(K))},ve=S(od(p)),Ie=S(od(p*x)),Qe=S(r.length),Ue=v(function(){var un=V.element(R),Gt=J.element(R);Gt.assign(0),C(Qe,function(Xe){var st=Xe.i,tt=H.element(st),vt=tt.z;w(vt,function(){var yt=ce(tt.xy,un.xy);w(yt&&yt.lessThan(Ie),function(){Gt.addAssign(de(yt,ve).mul(vt))})})})}),mt=Ue().compute(t.length),Me=new G1,Ct.n=2,Me.computeAsync(mt);case 2:return $e=Array,Et=Float32Array,Ct.n=3,Me.getArrayBufferAsync(Z);case 3:return Tt=Ct.v,Ct.a(2,$e.from.call($e,new Et(Tt)))}},e)}));return function(t){return i.apply(this,arguments)}})(),dR=window.THREE?window.THREE:{Mesh:Gn,MeshLambertMaterial:ma,SphereGeometry:Aa},eEe=3.5,tEe=.1,Ste=100,nEe=function(e){var t=Zc(K6(e));return t.opacity=Math.cbrt(e),t.formatRgb()},Ute=Fr({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 nEe}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Gr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new nl(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new dR.Mesh(new dR.SphereGeometry(sr),uk(new dR.MeshLambertMaterial({vertexColors:!0,transparent:!0}),W3e));return s.__globeObjType="heatmap",s})},update:function(e){var t=rt(e.heatmapPoints),n=rt(e.heatmapPointLat),r=rt(e.heatmapPointLng),s=rt(e.heatmapPointWeight),o=rt(e.heatmapBandwidth),a=rt(e.heatmapColorFn),l=rt(e.heatmapColorSaturation),c=rt(e.heatmapBaseAltitude),u=rt(e.heatmapTopAltitude);e.dataMapper.onUpdateObj(function(f,p){var x=o(p),v=a(p),w=l(p),S=c(p),T=u(p),P=t(p).map(function(F){var N=n(F),B=r(F),z=vc(N,B),V=z.x,H=z.y,Z=z.z;return{x:V,y:H,z:Z,lat:N,lng:B,weight:s(F)}}),R=Math.max(tEe,x/eEe),C=Math.ceil(360/(R||-1));f.geometry.parameters.widthSegments!==C&&(f.geometry.dispose(),f.geometry=new dR.SphereGeometry(sr,C,C/2));var L=H3e(f.geometry.getAttribute("position")),D=L.map(function(F){var N=mr(F,3),B=N[0],z=N[1],V=N[2],H=Ite({x:B,y:z,z:V}),Z=H.lng,J=H.lat;return[Z,J]});J3e(D,P,{latAccessor:function(N){return N.lat},lngAccessor:function(N){return N.lng},weightAccessor:function(N){return N.weight},bandwidth:x}).then(function(F){var N=qi(new Array(Ste)).map(function(H,Z){return b0(v(Z/(Ste-1)))}),B=function(Z){var J=f.__currentTargetD=Z,j=J.kdeVals,K=J.topAlt,ee=J.saturation,ae=x3(j.map(Math.abs))||1e-15,ce=H2([0,ae/ee],N);f.geometry.setAttribute("color",Wh(j.map(function(ve){return ce(Math.abs(ve))}),4));var de=Ya([0,ae],[sr*(1+S),sr*(1+(K||S))]);f.geometry.setAttribute("r",Wh(j.map(de)))},z={kdeVals:F,topAlt:T,saturation:w},V=f.__currentTargetD||Object.assign({},z,{kdeVals:F.map(function(){return 0}),topAlt:T&&S,saturation:.5});V.kdeVals.length!==F.length&&(V.kdeVals=F.slice()),Object.keys(z).some(function(H){return V[H]!==z[H]})&&(!e.heatmapsTransitionDuration||e.heatmapsTransitionDuration<0?B(z):e.tweenGroup.add(new Hs(V).to(z,e.heatmapsTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(B).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),y0=window.THREE?window.THREE:{DoubleSide:rr,Group:vr,LineBasicMaterial:xl,LineSegments:x_,Mesh:Gn,MeshBasicMaterial:as},kte=Fr({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;Gr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new nl(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new y0.Group;return s.__defaultSideMaterial=uk(new y0.MeshBasicMaterial({side:y0.DoubleSide,depthWrite:!0}),ak),s.__defaultCapMaterial=new y0.MeshBasicMaterial({side:y0.DoubleSide,depthWrite:!0}),s.add(new y0.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new y0.LineSegments(void 0,new y0.LineBasicMaterial)),s.__globeObjType="polygon",s})},update:function(e){var t=rt(e.polygonGeoJsonGeometry),n=rt(e.polygonAltitude),r=rt(e.polygonCapCurvatureResolution),s=rt(e.polygonCapColor),o=rt(e.polygonCapMaterial),a=rt(e.polygonSideColor),l=rt(e.polygonSideMaterial),c=rt(e.polygonStrokeColor),u=[];e.polygonsData.forEach(function(f){var p={data:f,capColor:s(f),capMaterial:o(f),sideColor:a(f),sideMaterial:l(f),strokeColor:c(f),altitude:+n(f),capCurvatureResolution:+r(f)},x=t(f),v=f.__id||"".concat(Math.round(Math.random()*1e9));f.__id=v,x.type==="Polygon"?u.push(Bi({id:"".concat(v,"_0"),coords:x.coordinates},p)):x.type==="MultiPolygon"?u.push.apply(u,qi(x.coordinates.map(function(w,S){return Bi({id:"".concat(v,"_").concat(S),coords:w},p)}))):console.warn("Unsupported GeoJson geometry type: ".concat(x.type,". Skipping geometry..."))}),e.dataMapper.onUpdateObj(function(f,p){var x=p.coords,v=p.capColor,w=p.capMaterial,S=p.sideColor,T=p.sideMaterial,P=p.strokeColor,R=p.altitude,C=p.capCurvatureResolution,L=mr(f.children,2),D=L[0],F=L[1],N=!!P;F.visible=N;var B=!!(v||w),z=!!(S||T);iEe(D.geometry.parameters||{},{polygonGeoJson:x,curvatureResolution:C,closedTop:B,includeSides:z})||(D.geometry&&D.geometry.dispose(),D.geometry=new TE(x,0,sr,!1,B,z,C)),N&&(!F.geometry.parameters||F.geometry.parameters.geoJson.coordinates!==x||F.geometry.parameters.resolution!==C)&&(F.geometry&&F.geometry.dispose(),F.geometry=new E6({type:"Polygon",coordinates:x},sr,C));var V=z?0:-1,H=B?z?1:0:-1;if(V>=0&&(D.material[V]=T||f.__defaultSideMaterial),H>=0&&(D.material[H]=w||f.__defaultCapMaterial),[[!T&&S,V],[!w&&v,H]].forEach(function(ae){var ce=mr(ae,2),de=ce[0],ve=ce[1];if(!(!de||ve<0)){var Ie=D.material[ve],Qe=du(de);Ie.color.set(Hh(de)),Ie.transparent=Qe<1,Ie.opacity=Qe}}),N){var Z=F.material,J=du(P);Z.color.set(Hh(P)),Z.transparent=J<1,Z.opacity=J}var j={alt:R},K=function(ce){var de=f.__currentTargetD=ce,ve=de.alt;D.scale.x=D.scale.y=D.scale.z=1+ve,N&&(F.scale.x=F.scale.y=F.scale.z=1+ve+1e-4),j3e(f.__defaultSideMaterial,function(Ie){return Ie.uSurfaceRadius.value=sr/(ve+1)})},ee=f.__currentTargetD||Object.assign({},j,{alt:-.001});Object.keys(j).some(function(ae){return ee[ae]!==j[ae]})&&(!e.polygonsTransitionDuration||e.polygonsTransitionDuration<0||ee.alt===j.alt?K(j):e.tweenGroup.add(new Hs(ee).to(j,e.polygonsTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(K).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(u)}});function iEe(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=mr(n,2),s=r[0],o=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],o)})}var Y1=window.THREE?window.THREE:{BufferGeometry:qn,DoubleSide:rr,Mesh:Gn,MeshLambertMaterial:ma,Vector3:ie},Tte=Object.assign({},dv),Ete=Tte.BufferGeometryUtils||Tte,Gte=Fr({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;Gr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new nl(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new Y1.Mesh(void 0,new Y1.MeshLambertMaterial({side:Y1.DoubleSide}));return s.__globeObjType="hexPolygon",s})},update:function(e){var t=rt(e.hexPolygonGeoJsonGeometry),n=rt(e.hexPolygonColor),r=rt(e.hexPolygonAltitude),s=rt(e.hexPolygonResolution),o=rt(e.hexPolygonMargin),a=rt(e.hexPolygonUseDots),l=rt(e.hexPolygonCurvatureResolution),c=rt(e.hexPolygonDotResolution);e.dataMapper.onUpdateObj(function(u,f){var p=t(f),x=s(f),v=r(f),w=Math.max(0,Math.min(1,+o(f))),S=a(f),T=l(f),P=c(f),R=n(f),C=du(R);u.material.color.set(Hh(R)),u.material.transparent=C<1,u.material.opacity=C;var L={alt:v,margin:w,curvatureResolution:T},D={geoJson:p,h3Res:x},F=u.__currentTargetD||Object.assign({},L,{alt:-.001}),N=u.__currentMemD||D;if(Object.keys(L).some(function(H){return F[H]!==L[H]})||Object.keys(D).some(function(H){return N[H]!==D[H]})){u.__currentMemD=D;var B=[];p.type==="Polygon"?Z6(p.coordinates,x,!0).forEach(function(H){return B.push(H)}):p.type==="MultiPolygon"?p.coordinates.forEach(function(H){return Z6(H,x,!0).forEach(function(Z){return B.push(Z)})}):console.warn("Unsupported GeoJson geometry type: ".concat(p.type,". Skipping geometry..."));var z=B.map(function(H){var Z=$6(H),J=Y6(H,!0).reverse(),j=Z[1];return J.forEach(function(K){var ee=K[0];Math.abs(j-ee)>170&&(K[0]+=j>ee?360:-360)}),{h3Idx:H,hexCenter:Z,hexGeoJson:J}}),V=function(Z){var J=u.__currentTargetD=Z,j=J.alt,K=J.margin,ee=J.curvatureResolution;u.geometry&&u.geometry.dispose(),u.geometry=z.length?(Ete.mergeGeometries||Ete.mergeBufferGeometries)(z.map(function(ae){var ce=mr(ae.hexCenter,2),de=ce[0],ve=ce[1];if(S){var Ie=vc(de,ve,j),Qe=vc(ae.hexGeoJson[0][1],ae.hexGeoJson[0][0],j),Ue=.85*(1-K)*new Y1.Vector3(Ie.x,Ie.y,Ie.z).distanceTo(new Y1.Vector3(Qe.x,Qe.y,Qe.z)),mt=new v_(Ue,P);return mt.rotateX(Zm(-de)),mt.rotateY(Zm(ve)),mt.translate(Ie.x,Ie.y,Ie.z),mt}else{var Me=function(Et,Tt,Ct){return Et-(Et-Tt)*Ct},ze=K===0?ae.hexGeoJson:ae.hexGeoJson.map(function($e){var Et=mr($e,2),Tt=Et[0],Ct=Et[1];return[[Tt,ve],[Ct,de]].map(function(un){var Gt=mr(un,2),Xe=Gt[0],st=Gt[1];return Me(Xe,st,K)})});return new TE([ze],sr,sr*(1+j),!1,!0,!1,ee)}})):new Y1.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?V(L):e.tweenGroup.add(new Hs(F).to(L,e.hexPolygonsTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(V).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),rEe=window.THREE?window.THREE:{Vector3:ie};function sEe(i,e){var t=function(o,a){var l=o[o.length-1];return[].concat(qi(o),qi(Array(a-o.length).fill(l)))},n=Math.max(i.length,e.length),r=fD.apply(void 0,qi([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=mr(o,3),l=a[0],c=a[1],u=a[2];return new rEe.Vector3(l,c,u)})}}var Ym=window.THREE?window.THREE:{BufferGeometry:qn,Color:Ut,Group:vr,Line:Df,NormalBlending:os,ShaderMaterial:$r,Vector3:ie},oEe=Km.default.default||Km.default,zte=Fr({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 oEe,sharedMaterial:new Ym.ShaderMaterial(Bi(Bi({},Dte()),{},{transparent:!0,blending:Ym.NormalBlending}))}},init:function(e,t){Gr(e),t.scene=e,t.dataMapper=new nl(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new Ym.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=mr(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=rt(e.pathPoints),n=rt(e.pathPointLat),r=rt(e.pathPointLng),s=rt(e.pathPointAlt),o=rt(e.pathStroke),a=rt(e.pathColor),l=rt(e.pathDashLength),c=rt(e.pathDashGap),u=rt(e.pathDashInitialGap),f=rt(e.pathDashAnimateTime);e.dataMapper.onUpdateObj(function(S,T){var P=o(T),R=P!=null;if(!S.children.length||R===(S.children[0].type==="Line")){Gr(S);var C=R?new uR(new X1,new _0):new Ym.Line(new Ym.BufferGeometry,e.sharedMaterial.clone());S.add(C)}var L=S.children[0],D=x(t(T),n,r,s,e.pathResolution),F=f(T);if(L.__dashAnimateStep=F>0?1e3/F:0,R){L.material.resolution=e.rendererSize;{var z=l(T),V=c(T),H=u(T);L.material.dashed=V>0,L.material.dashed?L.material.defines.USE_DASH="":delete L.material.defines.USE_DASH,L.material.dashed&&(L.material.dashScale=1/p(D),L.material.dashSize=z,L.material.gapSize=V,L.material.dashOffset=-H)}{var Z=a(T);if(Z instanceof Array){var J=v(a(T),D.length-1,1,!1);L.geometry.setColors(J.array),L.material.vertexColors=!0}else{var j=Z,K=du(j);L.material.color=new Ym.Color(Hh(j)),L.material.transparent=K<1,L.material.opacity=K,L.material.vertexColors=!1}}L.material.needsUpdate=!0}else{Object.assign(L.material.uniforms,{dashSize:{value:l(T)},gapSize:{value:c(T)},dashOffset:{value:u(T)}});var N=v(a(T),D.length),B=w(D.length,1,!0);L.geometry.setAttribute("color",N),L.geometry.setAttribute("relDistance",B)}var ee=sEe(S.__currentTargetD&&S.__currentTargetD.points||[D[0]],D),ae=function(Ie){var Qe=S.__currentTargetD=Ie,Ue=Qe.stroke,mt=Qe.interpolK,Me=S.__currentTargetD.points=ee(mt);if(R){var ze;L.geometry.setPositions((ze=[]).concat.apply(ze,qi(Me.map(function($e){var Et=$e.x,Tt=$e.y,Ct=$e.z;return[Et,Tt,Ct]})))),L.material.linewidth=Ue,L.material.dashed&&L.computeLineDistances()}else L.geometry.setFromPoints(Me),L.geometry.computeBoundingSphere()},ce={stroke:P,interpolK:1},de=Object.assign({},S.__currentTargetD||ce,{interpolK:0});Object.keys(ce).some(function(ve){return de[ve]!==ce[ve]})&&(!e.pathTransitionDuration||e.pathTransitionDuration<0?ae(ce):e.tweenGroup.add(new Hs(de).to(ce,e.pathTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(ae).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.pathsData);function p(S){var T=0,P;return S.forEach(function(R){P&&(T+=P.distanceTo(R)),P=R}),T}function x(S,T,P,R,C){var L=function(B,z,V){for(var H=[],Z=1;Z<=V;Z++)H.push(B+(z-B)*Z/(V+1));return H},D=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,V=[],H=null;return B.forEach(function(Z){if(H){for(;Math.abs(H[1]-Z[1])>180;)H[1]+=360*(H[1]<Z[1]?1:-1);var J=Math.sqrt(Math.pow(Z[0]-H[0],2)+Math.pow(Z[1]-H[1],2));if(J>z)for(var j=Math.floor(J/z),K=L(H[0],Z[0],j),ee=L(H[1],Z[1],j),ae=L(H[2],Z[2],j),ce=0,de=K.length;ce<de;ce++)V.push([K[ce],ee[ce],ae[ce]])}V.push(H=Z)}),V},F=function(B){var z=mr(B,3),V=z[0],H=z[1],Z=z[2],J=vc(V,H,Z),j=J.x,K=J.y,ee=J.z;return new Ym.Vector3(j,K,ee)};return D(S.map(function(N){return[T(N),P(N),R(N)]}),C).map(F)}function v(S,T){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,R=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,C=T+1,L;if(S instanceof Array||S instanceof Function){var D=S instanceof Array?Ya().domain(S.map(function(Z,J){return J/(S.length-1)})).range(S):S;L=function(J){return b0(D(J),R,!0)}}else{var F=b0(S,R,!0);L=function(){return F}}for(var N=[],B=0,z=C;B<z;B++)for(var V=L(B/(z-1)),H=0;H<P;H++)N.push(V);return Wh(N,R?4:3)}function w(S){for(var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1,P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,R=S+1,C=[],L=0,D=R;L<D;L++)for(var F=L/(D-1),N=0;N<T;N++)C.push(F);return P&&C.reverse(),Wh(C,1)}}}),pR=window.THREE?window.THREE:{Euler:fa,Mesh:Gn,MeshLambertMaterial:ma,SphereGeometry:Aa},Vte=Fr({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 pR.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Gr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new nl(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new pR.Mesh;return s.__globeObjType="tile",s})},update:function(e){var t=rt(e.tileLat),n=rt(e.tileLng),r=rt(e.tileAltitude),s=rt(e.tileWidth),o=rt(e.tileHeight),a=rt(e.tileUseGlobeProjection),l=rt(e.tileMaterial),c=rt(e.tileCurvatureResolution);e.dataMapper.onUpdateObj(function(u,f){u.material=l(f);var p=a(f),x=c(f),v=function(P){var R=u.__currentTargetD=P,C=R.lat,L=R.lng,D=R.alt,F=R.width,N=R.height,B=Z1(L),z=Z1(-C);u.geometry&&u.geometry.dispose(),u.geometry=new pR.SphereGeometry(sr*(1+D),Math.ceil(F/(x||-1)),Math.ceil(N/(x||-1)),Z1(90-F/2)+(p?B:0),Z1(F),Z1(90-N/2)+(p?z:0),Z1(N)),p||u.setRotationFromEuler(new pR.Euler(z,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?v(w):e.tweenGroup.add(new Hs(S).to(w,e.tilesTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(v).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),Z1=function(e){return e*Math.PI/180},Nb=window.THREE?window.THREE:{BufferGeometry:qn,Color:Ut,Points:Ey,PointsMaterial:ep},qte=Fr({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){Gr(e),t.scene=e,t.dataMapper=new nl(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new Nb.Points(new Nb.BufferGeometry,new Nb.PointsMaterial);return n.__globeObjType="particles",n}).onUpdateObj(function(n,r){var s=rt(t.particlesList),o=rt(t.particleLat),a=rt(t.particleLng),l=rt(t.particleAltitude);n.geometry.setAttribute("position",Wh(s(r).map(function(c){return Object.values(vc(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=rt(e.particlesColor),r=rt(e.particlesSize),s=rt(e.particlesSizeAttenuation),o=rt(e.particlesTexture);e.dataMapper.entries().forEach(function(a){var l=mr(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 Nb.Color(16777215),u.material.transparent=!1,u.material.alphaTest=.5,u.material.map=o(c);else{var f=n(c),p=du(f);u.material.color=new Nb.Color(Hh(f)),u.material.transparent=p<1,u.material.opacity=p,u.material.alphaTest=0}})}}),aEe=window.THREE?window.THREE:{BufferGeometry:qn},lEe=(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;_R(this,e),t=gR(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 yR(e,i),xR(e)})(aEe.BufferGeometry),K1=window.THREE?window.THREE:{Color:Ut,Group:vr,Line:Df,LineBasicMaterial:xl,Vector3:ie},cEe=Km.default.default||Km.default,Hte=Fr({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;Gr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new nl(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new K1.Group;return s.__globeObjType="ring",s}),t.ticker=new cEe,t.ticker.onTick.add(function(s){if(t.ringsData.length){var o=rt(t.ringColor),a=rt(t.ringAltitude),l=rt(t.ringMaxRadius),c=rt(t.ringPropagationSpeed),u=rt(t.ringRepeatPeriod);t.dataMapper.entries().filter(function(f){var p=mr(f,2),x=p[1];return x}).forEach(function(f){var p=mr(f,2),x=p[0],v=p[1];if((v.__nextRingTime||0)<=s){var w=u(x)/1e3;v.__nextRingTime=s+(w<=0?1/0:w);var S=new K1.Line(new lEe(1,t.ringResolution),new K1.LineBasicMaterial),T=o(x),P=T instanceof Array||T instanceof Function,R;P?T instanceof Array?(R=Ya().domain(T.map(function(V,H){return H/(T.length-1)})).range(T),S.material.transparent=T.some(function(V){return du(V)<1})):(R=T,S.material.transparent=!0):(S.material.color=new K1.Color(Hh(T)),q3e(S.material,du(T)));var C=sr*(1+a(x)),L=l(x),D=L*Math.PI/180,F=c(x),N=F<=0,B=function(H){var Z=H.t,J=(N?1-Z:Z)*D;if(S.scale.x=S.scale.y=C*Math.sin(J),S.position.z=C*(1-Math.cos(J)),P){var j=R(Z);S.material.color=new K1.Color(Hh(j)),S.material.transparent&&(S.material.opacity=du(j))}};if(F===0)B({t:0}),v.add(S);else{var z=Math.abs(L/F)*1e3;t.tweenGroup.add(new Hs({t:0}).to({t:1},z).onUpdate(B).onStart(function(){return v.add(S)}).onComplete(function(){t.tweenGroup.remove(this),v.remove(S),v0(S)}).start())}}})}})},update:function(e){var t=rt(e.ringLat),n=rt(e.ringLng),r=rt(e.ringAltitude),s=e.scene.localToWorld(new K1.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),c=n(a),u=r(a);Object.assign(o.position,vc(l,c,u)),o.lookAt(s)}).digest(e.ringsData)}}),uEe={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 "}},hEe="normal",fEe=1189,dEe=-100,pEe="normal",AEe={yMin:-334,xMin:-111,yMax:1189,xMax:1672},mEe=1e3,gEe={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.\r52235223 \r52245224 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: \r52255225 \r
@@ -5231,7 +5231,7 @@ This License becomes null and void to the extent applicable to Fonts or Font Sof
52315231 \r52325232 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. \r52335233 \r5234-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"},mEe=-334,gEe="Helvetiker",_Ee=1522,xEe=50,yEe={glyphs:lEe,cssFontWeight:cEe,ascender:uEe,underlinePosition:hEe,cssFontStyle:fEe,boundingBox:dEe,resolution:pEe,original_font_information:AEe,descender:mEe,familyName:gEe,lineHeight:_Ee,underlineThickness:xEe},hu=Bi(Bi({},window.THREE?window.THREE:{BoxGeometry:qc,CircleGeometry:y_,DoubleSide:rr,Group:Lr,Mesh:Gn,MeshLambertMaterial:ma,TextGeometry:Cb,Vector3:ie}),{},{Font:X1,TextGeometry:Cb}),qte=Fr({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:yEe,onChange:function(e,t){t.font=new hu.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;Gr(e),t.scene=e,t.tweenGroup=r;var s=new hu.CircleGeometry(1,32);t.dataMapper=new tl(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new hu.MeshLambertMaterial;o.side=rr;var a=new hu.Group;a.add(new hu.Mesh(s,o));var l=new hu.Mesh(void 0,o);a.add(l);var c=new hu.Mesh;return c.visible=!1,l.add(c),a.__globeObjType="label",a})},update:function(e){var t=rt(e.labelLat),n=rt(e.labelLng),r=rt(e.labelAltitude),s=rt(e.labelText),o=rt(e.labelSize),a=rt(e.labelRotation),l=rt(e.labelColor),c=rt(e.labelIncludeDot),u=rt(e.labelDotRadius),f=rt(e.labelDotOrientation),p=new Set(["right","top","bottom"]),x=2*Math.PI*sr/360;e.dataMapper.onUpdateObj(function(v,w){var S=mr(v.children,2),T=S[0],P=S[1],R=mr(P.children,1),C=R[0],L=l(w),D=fu(L);P.material.color.set(Vh(L)),P.material.transparent=D<1,P.material.opacity=D;var F=c(w),N=f(w);!F||!p.has(N)&&(N="bottom");var B=F?+u(w)*x:1e-12;T.scale.x=T.scale.y=B;var z=+o(w)*x;if(P.geometry&&P.geometry.dispose(),P.geometry=new hu.TextGeometry(s(w),{font:e.font,size:z,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),C.geometry&&C.geometry.dispose(),P.geometry.computeBoundingBox(),C.geometry=tk(hu.BoxGeometry,qi(new hu.Vector3().subVectors(P.geometry.boundingBox.max,P.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),N!=="right"&&P.geometry.center(),F){var V=B+z/2;N==="right"&&(P.position.x=V),P.position.y={right:-z/2,top:V+z/2,bottom:-V-z/2}[N]}var H=function(K){var ee=v.__currentTargetD=K,ae=ee.lat,ce=ee.lng,de=ee.alt,ve=ee.rot,Ie=ee.scale;Object.assign(v.position,yc(ae,ce,de)),v.lookAt(e.scene.localToWorld(new hu.Vector3(0,0,0))),v.rotateY(Math.PI),v.rotateZ(-ve*Math.PI/180),v.scale.x=v.scale.y=v.scale.z=Ie},Z={lat:+t(w),lng:+n(w),alt:+r(w),rot:+a(w),scale:1},J=v.__currentTargetD||Object.assign({},Z,{scale:1e-12});Object.keys(Z).some(function(j){return J[j]!==Z[j]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?H(Z):e.tweenGroup.add(new Hs(J).to(Z,e.labelsTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),vEe=Bi(Bi({},window.THREE?window.THREE:{}),{},{CSS2DObject:u3}),Hte=Fr({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=mr(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;Gr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new tl(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var o=rt(t.htmlElement)(s),a=new vEe.CSS2DObject(o);return a.__globeObjType="html",a})},update:function(e,t){var n=this,r=rt(e.htmlLat),s=rt(e.htmlLng),o=rt(e.htmlAltitude);t.hasOwnProperty("htmlElement")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(a,l){var c=function(p){var x=a.__currentTargetD=p,v=x.alt,w=x.lat,S=x.lng;Object.assign(a.position,yc(w,S,v)),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 Hs(a.__currentTargetD).to(u,e.htmlTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(c).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),dR=window.THREE?window.THREE:{Group:Lr,Mesh:Gn,MeshLambertMaterial:ma,SphereGeometry:Aa},Wte=Fr({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new dR.Mesh(new dR.SphereGeometry(1,16,8),new dR.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){Gr(e),t.scene=e,t.dataMapper=new tl(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=rt(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new dR.Group;return s.add(r),s.__globeObjType="object",s})},update:function(e,t){var n=rt(e.objectLat),r=rt(e.objectLng),s=rt(e.objectAltitude),o=rt(e.objectFacesSurface),a=rt(e.objectRotation);t.hasOwnProperty("objectThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(l,c){var u=+n(c),f=+r(c),p=+s(c);Object.assign(l.position,yc(u,f,p)),o(c)?l.setRotationFromEuler(new fa($m(-u),$m(f),0,"YXZ")):l.rotation.set(0,0,0);var x=l.children[0],v=a(c);v&&x.setRotationFromEuler(new fa($m(v.x||0),$m(v.y||0),$m(v.z||0)))}).digest(e.objectsData)}}),jte=Fr({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){Gr(e),t.scene=e,t.dataMapper=new tl(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=rt(t.customThreeObject)(n,sr);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||Gr(e.scene);var n=rt(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,sr)}).digest(e.customLayerData)}}),pR=window.THREE?window.THREE:{Camera:Df,Group:Lr,Vector2:Oe,Vector3:ie},bEe=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],Xte=Pa("globeLayer",Pte),wEe=Object.assign.apply(Object,qi(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return oo({},i,Xte.linkProp(i))}))),SEe=Object.assign.apply(Object,qi(["globeMaterial","globeTileEngineClearCache"].map(function(i){return oo({},i,Xte.linkMethod(i))}))),TEe=Pa("pointsLayer",Ite),EEe=Object.assign.apply(Object,qi(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return oo({},i,TEe.linkProp(i))}))),MEe=Pa("arcsLayer",Lte),CEe=Object.assign.apply(Object,qi(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return oo({},i,MEe.linkProp(i))}))),REe=Pa("hexBinLayer",Dte),PEe=Object.assign.apply(Object,qi(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return oo({},i,REe.linkProp(i))}))),IEe=Pa("heatmapsLayer",Ote),NEe=Object.assign.apply(Object,qi(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return oo({},i,IEe.linkProp(i))}))),LEe=Pa("hexedPolygonsLayer",Ute),DEe=Object.assign.apply(Object,qi(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return oo({},i,LEe.linkProp(i))}))),FEe=Pa("polygonsLayer",Bte),OEe=Object.assign.apply(Object,qi(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return oo({},i,FEe.linkProp(i))}))),BEe=Pa("pathsLayer",kte),UEe=Object.assign.apply(Object,qi(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return oo({},i,BEe.linkProp(i))}))),kEe=Pa("tilesLayer",Gte),GEe=Object.assign.apply(Object,qi(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return oo({},i,kEe.linkProp(i))}))),zEe=Pa("particlesLayer",zte),VEe=Object.assign.apply(Object,qi(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return oo({},i,zEe.linkProp(i))}))),qEe=Pa("ringsLayer",Vte),HEe=Object.assign.apply(Object,qi(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return oo({},i,qEe.linkProp(i))}))),WEe=Pa("labelsLayer",qte),jEe=Object.assign.apply(Object,qi(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return oo({},i,WEe.linkProp(i))}))),XEe=Pa("htmlElementsLayer",Hte),$Ee=Object.assign.apply(Object,qi(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return oo({},i,XEe.linkProp(i))}))),YEe=Pa("objectsLayer",Wte),ZEe=Object.assign.apply(Object,qi(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return oo({},i,YEe.linkProp(i))}))),KEe=Pa("customLayer",jte),QEe=Object.assign.apply(Object,qi(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return oo({},i,KEe.linkProp(i))}))),JEe=Fr({props:Bi(Bi(Bi(Bi(Bi(Bi(Bi(Bi(Bi(Bi(Bi(Bi(Bi(Bi(Bi({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new pR.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},wEe),EEe),CEe),PEe),NEe),OEe),DEe),UEe),GEe),VEe),HEe),jEe),$Ee),ZEe),QEe),methods:Bi({getGlobeRadius:mte,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 yc.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 Rte.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof pR.Camera?t.position:t,r=mte(),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 p=o.distanceTo(f);if(p<l)return!1;var x=f.length(),v=Math.acos((Math.pow(a,2)+Math.pow(p,2)-Math.pow(x,2))/(2*a*p));return v<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()})}},SEe),stateInit:function(){var e=new ZA,t={tweenGroup:e},n={globeLayer:Pte(t),pointsLayer:Ite(t),arcsLayer:Lte(t),hexBinLayer:Dte(t),heatmapsLayer:Ote(t),polygonsLayer:Bte(t),hexedPolygonsLayer:Ute(t),pathsLayer:kte(t),tilesLayer:Gte(t),particlesLayer:zte(t),ringsLayer:Vte(t),labelsLayer:qte(t),htmlElementsLayer:Hte(t),objectsLayer:Wte(t),customLayer:jte(t)};return Bi(Bi({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;Gr(e),t.scene=e,t.scene.visible=!1,bEe.forEach(function(c){var u=new pR.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 Hs({k:1e-6}).to({k:1},600).easing(Or.Quadratic.Out).onUpdate(function(f){var p=f.k;return t.scene.scale.set(p,p,p)}).onComplete(function(){t.tweenGroup.remove(this)}).start());var u=new pR.Vector3(0,1,0);t.tweenGroup.add(new Hs({rot:Math.PI*2}).to({rot:0},1200).easing(Or.Quintic.Out).onUpdate(function(f){var p=f.rot;return t.scene.setRotationFromAxisAngle(u,p)}).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 eMe(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;mR(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=AR(this,s,[].concat(l)),o.__kapsuleInstance=tk(i,[].concat(qi(t?[o]:[]),l)),o}return _R(s,r),gR(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 tMe=window.THREE?window.THREE:{Group:Lr},rk=eMe(JEe,tMe.Group,!0);var sk={type:"change"},lk={type:"start"},ck={type:"end"},$te=1e-6,Ii={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},xR=new Oe,b0=new Oe,nMe=new ie,yR=new ie,ok=new ie,Q1=new bs,Yte=new ie,vR=new ie,ak=new ie,bR=new ie,wR=class extends Ff{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 ie,this.state=Ii.NONE,this.keyState=Ii.NONE,this._lastPosition=new ie,this._lastZoom=1,this._touchZoomDistanceStart=0,this._touchZoomDistanceEnd=0,this._lastAngle=0,this._eye=new ie,this._movePrev=new Oe,this._moveCurr=new Oe,this._lastAxis=new ie,this._zoomStart=new Oe,this._zoomEnd=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._pointers=[],this._pointerPositions={},this._onPointerMove=rMe.bind(this),this._onPointerDown=iMe.bind(this),this._onPointerUp=sMe.bind(this),this._onPointerCancel=oMe.bind(this),this._onContextMenu=dMe.bind(this),this._onMouseWheel=fMe.bind(this),this._onKeyDown=lMe.bind(this),this._onKeyUp=aMe.bind(this),this._onTouchStart=pMe.bind(this),this._onTouchMove=AMe.bind(this),this._onTouchEnd=mMe.bind(this),this._onMouseDown=cMe.bind(this),this._onMouseMove=uMe.bind(this),this._onMouseUp=hMe.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)>$te&&(this.dispatchEvent(sk),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>$te||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(sk),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=Ii.NONE,this.keyState=Ii.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(sk),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(b0.copy(this._panEnd).sub(this._panStart),b0.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;b0.x*=e,b0.y*=t}b0.multiplyScalar(this._eye.length()*this.panSpeed),yR.copy(this._eye).cross(this.object.up).setLength(b0.x),yR.add(nMe.copy(this.object.up).setLength(b0.y)),this.object.position.add(yR),this.target.add(yR),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(b0.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){bR.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=bR.length();e?(this._eye.copy(this.object.position).sub(this.target),Yte.copy(this._eye).normalize(),vR.copy(this.object.up).normalize(),ak.crossVectors(vR,Yte).normalize(),vR.setLength(this._moveCurr.y-this._movePrev.y),ak.setLength(this._moveCurr.x-this._movePrev.x),bR.copy(vR.add(ak)),ok.crossVectors(bR,this._eye).normalize(),e*=this.rotateSpeed,Q1.setFromAxisAngle(ok,e),this._eye.applyQuaternion(Q1),this.object.up.applyQuaternion(Q1),this._lastAxis.copy(ok),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),Q1.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(Q1),this.object.up.applyQuaternion(Q1)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===Ii.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=Xc.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=Xc.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 xR.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),xR}_getMouseOnCircle(e,t){return xR.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),xR}_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 iMe(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 rMe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function sMe(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 oMe(i){this._removePointer(i)}function aMe(){this.enabled!==!1&&(this.keyState=Ii.NONE,window.addEventListener("keydown",this._onKeyDown))}function lMe(i){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===Ii.NONE&&(i.code===this.keys[Ii.ROTATE]&&!this.noRotate?this.keyState=Ii.ROTATE:i.code===this.keys[Ii.ZOOM]&&!this.noZoom?this.keyState=Ii.ZOOM:i.code===this.keys[Ii.PAN]&&!this.noPan&&(this.keyState=Ii.PAN)))}function cMe(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=Ii.ZOOM;break;case ga.ROTATE:this.state=Ii.ROTATE;break;case ga.PAN:this.state=Ii.PAN;break;default:this.state=Ii.NONE}let t=this.keyState!==Ii.NONE?this.keyState:this.state;t===Ii.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr)):t===Ii.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._zoomEnd.copy(this._zoomStart)):t===Ii.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent(lk)}function uMe(i){let e=this.keyState!==Ii.NONE?this.keyState:this.state;e===Ii.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY))):e===Ii.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY)):e===Ii.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY))}function hMe(){this.state=Ii.NONE,this.dispatchEvent(ck)}function fMe(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(lk),this.dispatchEvent(ck)}}function dMe(i){this.enabled!==!1&&i.preventDefault()}function pMe(i){if(this._trackPointer(i),this._pointers.length===1)this.state=Ii.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);else{this.state=Ii.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(lk)}function AMe(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 mMe(i){switch(this._pointers.length){case 0:this.state=Ii.NONE;break;case 1:this.state=Ii.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=Ii.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(ck)}var Zte={type:"change"},hk={type:"start"},Qte={type:"end"},SR=new Nf,Kte=new la,gMe=Math.cos(70*Xc.DEG2RAD),Ws=new ie,nl=2*Math.PI,er={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},uk=1e-6,TR=class extends Ff{constructor(e,t=null){super(e,t),this.state=er.NONE,this.target=new ie,this.cursor=new ie,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:rp.ROTATE,TWO:rp.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 ie,this._lastQuaternion=new bs,this._lastTargetPosition=new ie,this._quat=new bs().setFromUnitVectors(e.up,new ie(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new M_,this._sphericalDelta=new M_,this._scale=1,this._panOffset=new ie,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 ie,this._mouse=new Oe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=xMe.bind(this),this._onPointerDown=_Me.bind(this),this._onPointerUp=yMe.bind(this),this._onContextMenu=MMe.bind(this),this._onMouseWheel=wMe.bind(this),this._onKeyDown=SMe.bind(this),this._onTouchStart=TMe.bind(this),this._onTouchMove=EMe.bind(this),this._onMouseDown=vMe.bind(this),this._onMouseMove=bMe.bind(this),this._interceptControlDown=CMe.bind(this),this._interceptControlUp=RMe.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(Zte),this.update(),this.state=er.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;Ws.copy(t).sub(this.target),Ws.applyQuaternion(this._quat),this._spherical.setFromVector3(Ws),this.autoRotate&&this.state===er.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+=nl:n>Math.PI&&(n-=nl),r<-Math.PI?r+=nl:r>Math.PI&&(r-=nl),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(Ws.setFromSpherical(this._spherical),Ws.applyQuaternion(this._quatInverse),t.copy(this.target).add(Ws),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=Ws.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 ie(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 ie(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=Ws.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):(SR.origin.copy(this.object.position),SR.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(SR.direction))<gMe?this.object.lookAt(this.target):(Kte.setFromNormalAndCoplanarPoint(this.object.up,this.target),SR.intersectPlane(Kte,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)>uk||8*(1-this._lastQuaternion.dot(this.object.quaternion))>uk||this._lastTargetPosition.distanceToSquared(this.target)>uk?(this.dispatchEvent(Zte),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?nl/60*this.autoRotateSpeed*e:nl/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){Ws.setFromMatrixColumn(t,0),Ws.multiplyScalar(-e),this._panOffset.add(Ws)}_panUp(e,t){this.screenSpacePanning===!0?Ws.setFromMatrixColumn(t,1):(Ws.setFromMatrixColumn(t,0),Ws.crossVectors(this.object.up,Ws)),Ws.multiplyScalar(e),this._panOffset.add(Ws)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;Ws.copy(r).sub(this.target);let s=Ws.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(nl*this._rotateDelta.x/t.clientHeight),this._rotateUp(nl*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(nl*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(-nl*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(nl*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(-nl*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(nl*this._rotateDelta.x/t.clientHeight),this._rotateUp(nl*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 _Me(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 xMe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function yMe(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(Qte),this.state=er.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 vMe(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=er.DOLLY;break;case ga.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=er.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=er.ROTATE}break;case ga.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=er.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=er.PAN}break;default:this.state=er.NONE}this.state!==er.NONE&&this.dispatchEvent(hk)}function bMe(i){switch(this.state){case er.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case er.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case er.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function wMe(i){this.enabled===!1||this.enableZoom===!1||this.state!==er.NONE||(i.preventDefault(),this.dispatchEvent(hk),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(Qte))}function SMe(i){this.enabled!==!1&&this._handleKeyDown(i)}function TMe(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case rp.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=er.TOUCH_ROTATE;break;case rp.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=er.TOUCH_PAN;break;default:this.state=er.NONE}break;case 2:switch(this.touches.TWO){case rp.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=er.TOUCH_DOLLY_PAN;break;case rp.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=er.TOUCH_DOLLY_ROTATE;break;default:this.state=er.NONE}break;default:this.state=er.NONE}this.state!==er.NONE&&this.dispatchEvent(hk)}function EMe(i){switch(this._trackPointer(i),this.state){case er.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case er.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case er.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case er.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=er.NONE}}function MMe(i){this.enabled!==!1&&i.preventDefault()}function CMe(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function RMe(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var PMe={type:"change"},Jte=1e-6,ene=new bs,ER=class extends Ff{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 ie(0,0,0),this._rotationVector=new ie(0,0,0),this._lastQuaternion=new bs,this._lastPosition=new ie,this._status=0,this._onKeyDown=IMe.bind(this),this._onKeyUp=NMe.bind(this),this._onPointerMove=DMe.bind(this),this._onPointerDown=LMe.bind(this),this._onPointerUp=FMe.bind(this),this._onPointerCancel=OMe.bind(this),this._onContextMenu=BMe.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),ene.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(ene),(this._lastPosition.distanceToSquared(t.position)>Jte||8*(1-this._lastQuaternion.dot(t.quaternion))>Jte)&&(this.dispatchEvent(PMe),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 IMe(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 NMe(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 LMe(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 DMe(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 FMe(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 OMe(){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 BMe(i){this.enabled!==!1&&i.preventDefault()}var tne={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`5234+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"},_Ee=-334,xEe="Helvetiker",yEe=1522,vEe=50,bEe={glyphs:uEe,cssFontWeight:hEe,ascender:fEe,underlinePosition:dEe,cssFontStyle:pEe,boundingBox:AEe,resolution:mEe,original_font_information:gEe,descender:_Ee,familyName:xEe,lineHeight:yEe,underlineThickness:vEe},fu=Bi(Bi({},window.THREE?window.THREE:{BoxGeometry:Hc,CircleGeometry:v_,DoubleSide:rr,Group:vr,Mesh:Gn,MeshLambertMaterial:ma,TextGeometry:Pb,Vector3:ie}),{},{Font:$1,TextGeometry:Pb}),Wte=Fr({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:bEe,onChange:function(e,t){t.font=new fu.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;Gr(e),t.scene=e,t.tweenGroup=r;var s=new fu.CircleGeometry(1,32);t.dataMapper=new nl(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new fu.MeshLambertMaterial;o.side=rr;var a=new fu.Group;a.add(new fu.Mesh(s,o));var l=new fu.Mesh(void 0,o);a.add(l);var c=new fu.Mesh;return c.visible=!1,l.add(c),a.__globeObjType="label",a})},update:function(e){var t=rt(e.labelLat),n=rt(e.labelLng),r=rt(e.labelAltitude),s=rt(e.labelText),o=rt(e.labelSize),a=rt(e.labelRotation),l=rt(e.labelColor),c=rt(e.labelIncludeDot),u=rt(e.labelDotRadius),f=rt(e.labelDotOrientation),p=new Set(["right","top","bottom"]),x=2*Math.PI*sr/360;e.dataMapper.onUpdateObj(function(v,w){var S=mr(v.children,2),T=S[0],P=S[1],R=mr(P.children,1),C=R[0],L=l(w),D=du(L);P.material.color.set(Hh(L)),P.material.transparent=D<1,P.material.opacity=D;var F=c(w),N=f(w);!F||!p.has(N)&&(N="bottom");var B=F?+u(w)*x:1e-12;T.scale.x=T.scale.y=B;var z=+o(w)*x;if(P.geometry&&P.geometry.dispose(),P.geometry=new fu.TextGeometry(s(w),{font:e.font,size:z,depth:0,bevelEnabled:!0,bevelThickness:0,bevelSize:0,curveSegments:e.labelResolution}),C.geometry&&C.geometry.dispose(),P.geometry.computeBoundingBox(),C.geometry=lk(fu.BoxGeometry,qi(new fu.Vector3().subVectors(P.geometry.boundingBox.max,P.geometry.boundingBox.min).clampScalar(0,1/0).toArray())),N!=="right"&&P.geometry.center(),F){var V=B+z/2;N==="right"&&(P.position.x=V),P.position.y={right:-z/2,top:V+z/2,bottom:-V-z/2}[N]}var H=function(K){var ee=v.__currentTargetD=K,ae=ee.lat,ce=ee.lng,de=ee.alt,ve=ee.rot,Ie=ee.scale;Object.assign(v.position,vc(ae,ce,de)),v.lookAt(e.scene.localToWorld(new fu.Vector3(0,0,0))),v.rotateY(Math.PI),v.rotateZ(-ve*Math.PI/180),v.scale.x=v.scale.y=v.scale.z=Ie},Z={lat:+t(w),lng:+n(w),alt:+r(w),rot:+a(w),scale:1},J=v.__currentTargetD||Object.assign({},Z,{scale:1e-12});Object.keys(Z).some(function(j){return J[j]!==Z[j]})&&(!e.labelsTransitionDuration||e.labelsTransitionDuration<0?H(Z):e.tweenGroup.add(new Hs(J).to(Z,e.labelsTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),wEe=Bi(Bi({},window.THREE?window.THREE:{}),{},{CSS2DObject:f3}),jte=Fr({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=mr(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;Gr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new nl(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var o=rt(t.htmlElement)(s),a=new wEe.CSS2DObject(o);return a.__globeObjType="html",a})},update:function(e,t){var n=this,r=rt(e.htmlLat),s=rt(e.htmlLng),o=rt(e.htmlAltitude);t.hasOwnProperty("htmlElement")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(a,l){var c=function(p){var x=a.__currentTargetD=p,v=x.alt,w=x.lat,S=x.lng;Object.assign(a.position,vc(w,S,v)),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 Hs(a.__currentTargetD).to(u,e.htmlTransitionDuration).easing(Or.Quadratic.InOut).onUpdate(c).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),AR=window.THREE?window.THREE:{Group:vr,Mesh:Gn,MeshLambertMaterial:ma,SphereGeometry:Aa},Xte=Fr({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new AR.Mesh(new AR.SphereGeometry(1,16,8),new AR.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){Gr(e),t.scene=e,t.dataMapper=new nl(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=rt(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new AR.Group;return s.add(r),s.__globeObjType="object",s})},update:function(e,t){var n=rt(e.objectLat),r=rt(e.objectLng),s=rt(e.objectAltitude),o=rt(e.objectFacesSurface),a=rt(e.objectRotation);t.hasOwnProperty("objectThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(l,c){var u=+n(c),f=+r(c),p=+s(c);Object.assign(l.position,vc(u,f,p)),o(c)?l.setRotationFromEuler(new fa(Zm(-u),Zm(f),0,"YXZ")):l.rotation.set(0,0,0);var x=l.children[0],v=a(c);v&&x.setRotationFromEuler(new fa(Zm(v.x||0),Zm(v.y||0),Zm(v.z||0)))}).digest(e.objectsData)}}),$te=Fr({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){Gr(e),t.scene=e,t.dataMapper=new nl(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=rt(t.customThreeObject)(n,sr);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||Gr(e.scene);var n=rt(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,sr)}).digest(e.customLayerData)}}),mR=window.THREE?window.THREE:{Camera:Ff,Group:vr,Vector2:Oe,Vector3:ie},SEe=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],Yte=Pa("globeLayer",Nte),TEe=Object.assign.apply(Object,qi(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return oo({},i,Yte.linkProp(i))}))),EEe=Object.assign.apply(Object,qi(["globeMaterial","globeTileEngineClearCache"].map(function(i){return oo({},i,Yte.linkMethod(i))}))),MEe=Pa("pointsLayer",Lte),CEe=Object.assign.apply(Object,qi(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return oo({},i,MEe.linkProp(i))}))),REe=Pa("arcsLayer",Fte),PEe=Object.assign.apply(Object,qi(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return oo({},i,REe.linkProp(i))}))),IEe=Pa("hexBinLayer",Ote),NEe=Object.assign.apply(Object,qi(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return oo({},i,IEe.linkProp(i))}))),LEe=Pa("heatmapsLayer",Ute),DEe=Object.assign.apply(Object,qi(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return oo({},i,LEe.linkProp(i))}))),FEe=Pa("hexedPolygonsLayer",Gte),OEe=Object.assign.apply(Object,qi(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return oo({},i,FEe.linkProp(i))}))),BEe=Pa("polygonsLayer",kte),UEe=Object.assign.apply(Object,qi(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return oo({},i,BEe.linkProp(i))}))),kEe=Pa("pathsLayer",zte),GEe=Object.assign.apply(Object,qi(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return oo({},i,kEe.linkProp(i))}))),zEe=Pa("tilesLayer",Vte),VEe=Object.assign.apply(Object,qi(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return oo({},i,zEe.linkProp(i))}))),qEe=Pa("particlesLayer",qte),HEe=Object.assign.apply(Object,qi(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return oo({},i,qEe.linkProp(i))}))),WEe=Pa("ringsLayer",Hte),jEe=Object.assign.apply(Object,qi(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return oo({},i,WEe.linkProp(i))}))),XEe=Pa("labelsLayer",Wte),$Ee=Object.assign.apply(Object,qi(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return oo({},i,XEe.linkProp(i))}))),YEe=Pa("htmlElementsLayer",jte),ZEe=Object.assign.apply(Object,qi(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return oo({},i,YEe.linkProp(i))}))),KEe=Pa("objectsLayer",Xte),QEe=Object.assign.apply(Object,qi(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return oo({},i,KEe.linkProp(i))}))),JEe=Pa("customLayer",$te),eMe=Object.assign.apply(Object,qi(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return oo({},i,JEe.linkProp(i))}))),tMe=Fr({props:Bi(Bi(Bi(Bi(Bi(Bi(Bi(Bi(Bi(Bi(Bi(Bi(Bi(Bi(Bi({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new mR.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},TEe),CEe),PEe),NEe),DEe),UEe),OEe),GEe),VEe),HEe),jEe),$Ee),ZEe),QEe),eMe),methods:Bi({getGlobeRadius:_te,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 vc.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 Ite.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof mR.Camera?t.position:t,r=_te(),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 p=o.distanceTo(f);if(p<l)return!1;var x=f.length(),v=Math.acos((Math.pow(a,2)+Math.pow(p,2)-Math.pow(x,2))/(2*a*p));return v<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()})}},EEe),stateInit:function(){var e=new QA,t={tweenGroup:e},n={globeLayer:Nte(t),pointsLayer:Lte(t),arcsLayer:Fte(t),hexBinLayer:Ote(t),heatmapsLayer:Ute(t),polygonsLayer:kte(t),hexedPolygonsLayer:Gte(t),pathsLayer:zte(t),tilesLayer:Vte(t),particlesLayer:qte(t),ringsLayer:Hte(t),labelsLayer:Wte(t),htmlElementsLayer:jte(t),objectsLayer:Xte(t),customLayer:$te(t)};return Bi(Bi({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;Gr(e),t.scene=e,t.scene.visible=!1,SEe.forEach(function(c){var u=new mR.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 Hs({k:1e-6}).to({k:1},600).easing(Or.Quadratic.Out).onUpdate(function(f){var p=f.k;return t.scene.scale.set(p,p,p)}).onComplete(function(){t.tweenGroup.remove(this)}).start());var u=new mR.Vector3(0,1,0);t.tweenGroup.add(new Hs({rot:Math.PI*2}).to({rot:0},1200).easing(Or.Quintic.Out).onUpdate(function(f){var p=f.rot;return t.scene.setRotationFromAxisAngle(u,p)}).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 nMe(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;_R(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=gR(this,s,[].concat(l)),o.__kapsuleInstance=lk(i,[].concat(qi(t?[o]:[]),l)),o}return yR(s,r),xR(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 iMe=window.THREE?window.THREE:{Group:vr},hk=nMe(tMe,iMe.Group,!0);var fk={type:"change"},Ak={type:"start"},mk={type:"end"},Zte=1e-6,Ii={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},vR=new Oe,w0=new Oe,rMe=new ie,bR=new ie,dk=new ie,J1=new Ss,Kte=new ie,wR=new ie,pk=new ie,SR=new ie,TR=class extends Of{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 ie,this.state=Ii.NONE,this.keyState=Ii.NONE,this._lastPosition=new ie,this._lastZoom=1,this._touchZoomDistanceStart=0,this._touchZoomDistanceEnd=0,this._lastAngle=0,this._eye=new ie,this._movePrev=new Oe,this._moveCurr=new Oe,this._lastAxis=new ie,this._zoomStart=new Oe,this._zoomEnd=new Oe,this._panStart=new Oe,this._panEnd=new Oe,this._pointers=[],this._pointerPositions={},this._onPointerMove=oMe.bind(this),this._onPointerDown=sMe.bind(this),this._onPointerUp=aMe.bind(this),this._onPointerCancel=lMe.bind(this),this._onContextMenu=AMe.bind(this),this._onMouseWheel=pMe.bind(this),this._onKeyDown=uMe.bind(this),this._onKeyUp=cMe.bind(this),this._onTouchStart=mMe.bind(this),this._onTouchMove=gMe.bind(this),this._onTouchEnd=_Me.bind(this),this._onMouseDown=hMe.bind(this),this._onMouseMove=fMe.bind(this),this._onMouseUp=dMe.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)>Zte&&(this.dispatchEvent(fk),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>Zte||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(fk),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=Ii.NONE,this.keyState=Ii.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(fk),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(w0.copy(this._panEnd).sub(this._panStart),w0.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;w0.x*=e,w0.y*=t}w0.multiplyScalar(this._eye.length()*this.panSpeed),bR.copy(this._eye).cross(this.object.up).setLength(w0.x),bR.add(rMe.copy(this.object.up).setLength(w0.y)),this.object.position.add(bR),this.target.add(bR),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(w0.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){SR.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=SR.length();e?(this._eye.copy(this.object.position).sub(this.target),Kte.copy(this._eye).normalize(),wR.copy(this.object.up).normalize(),pk.crossVectors(wR,Kte).normalize(),wR.setLength(this._moveCurr.y-this._movePrev.y),pk.setLength(this._moveCurr.x-this._movePrev.x),SR.copy(wR.add(pk)),dk.crossVectors(SR,this._eye).normalize(),e*=this.rotateSpeed,J1.setFromAxisAngle(dk,e),this._eye.applyQuaternion(J1),this.object.up.applyQuaternion(J1),this._lastAxis.copy(dk),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),J1.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(J1),this.object.up.applyQuaternion(J1)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===Ii.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=$c.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=$c.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 vR.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),vR}_getMouseOnCircle(e,t){return vR.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),vR}_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 sMe(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 oMe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function aMe(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 lMe(i){this._removePointer(i)}function cMe(){this.enabled!==!1&&(this.keyState=Ii.NONE,window.addEventListener("keydown",this._onKeyDown))}function uMe(i){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===Ii.NONE&&(i.code===this.keys[Ii.ROTATE]&&!this.noRotate?this.keyState=Ii.ROTATE:i.code===this.keys[Ii.ZOOM]&&!this.noZoom?this.keyState=Ii.ZOOM:i.code===this.keys[Ii.PAN]&&!this.noPan&&(this.keyState=Ii.PAN)))}function hMe(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=Ii.ZOOM;break;case ga.ROTATE:this.state=Ii.ROTATE;break;case ga.PAN:this.state=Ii.PAN;break;default:this.state=Ii.NONE}let t=this.keyState!==Ii.NONE?this.keyState:this.state;t===Ii.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr)):t===Ii.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._zoomEnd.copy(this._zoomStart)):t===Ii.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent(Ak)}function fMe(i){let e=this.keyState!==Ii.NONE?this.keyState:this.state;e===Ii.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY))):e===Ii.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY)):e===Ii.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY))}function dMe(){this.state=Ii.NONE,this.dispatchEvent(mk)}function pMe(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(Ak),this.dispatchEvent(mk)}}function AMe(i){this.enabled!==!1&&i.preventDefault()}function mMe(i){if(this._trackPointer(i),this._pointers.length===1)this.state=Ii.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);else{this.state=Ii.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(Ak)}function gMe(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 _Me(i){switch(this._pointers.length){case 0:this.state=Ii.NONE;break;case 1:this.state=Ii.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=Ii.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(mk)}var Qte={type:"change"},_k={type:"start"},ene={type:"end"},ER=new Lf,Jte=new la,xMe=Math.cos(70*$c.DEG2RAD),Ws=new ie,il=2*Math.PI,er={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},gk=1e-6,MR=class extends Of{constructor(e,t=null){super(e,t),this.state=er.NONE,this.target=new ie,this.cursor=new ie,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:sp.ROTATE,TWO:sp.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 ie,this._lastQuaternion=new Ss,this._lastTargetPosition=new ie,this._quat=new Ss().setFromUnitVectors(e.up,new ie(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new C_,this._sphericalDelta=new C_,this._scale=1,this._panOffset=new ie,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 ie,this._mouse=new Oe,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=vMe.bind(this),this._onPointerDown=yMe.bind(this),this._onPointerUp=bMe.bind(this),this._onContextMenu=RMe.bind(this),this._onMouseWheel=TMe.bind(this),this._onKeyDown=EMe.bind(this),this._onTouchStart=MMe.bind(this),this._onTouchMove=CMe.bind(this),this._onMouseDown=wMe.bind(this),this._onMouseMove=SMe.bind(this),this._interceptControlDown=PMe.bind(this),this._interceptControlUp=IMe.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(Qte),this.update(),this.state=er.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;Ws.copy(t).sub(this.target),Ws.applyQuaternion(this._quat),this._spherical.setFromVector3(Ws),this.autoRotate&&this.state===er.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+=il:n>Math.PI&&(n-=il),r<-Math.PI?r+=il:r>Math.PI&&(r-=il),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(Ws.setFromSpherical(this._spherical),Ws.applyQuaternion(this._quatInverse),t.copy(this.target).add(Ws),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=Ws.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 ie(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 ie(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=Ws.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):(ER.origin.copy(this.object.position),ER.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(ER.direction))<xMe?this.object.lookAt(this.target):(Jte.setFromNormalAndCoplanarPoint(this.object.up,this.target),ER.intersectPlane(Jte,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)>gk||8*(1-this._lastQuaternion.dot(this.object.quaternion))>gk||this._lastTargetPosition.distanceToSquared(this.target)>gk?(this.dispatchEvent(Qte),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?il/60*this.autoRotateSpeed*e:il/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){Ws.setFromMatrixColumn(t,0),Ws.multiplyScalar(-e),this._panOffset.add(Ws)}_panUp(e,t){this.screenSpacePanning===!0?Ws.setFromMatrixColumn(t,1):(Ws.setFromMatrixColumn(t,0),Ws.crossVectors(this.object.up,Ws)),Ws.multiplyScalar(e),this._panOffset.add(Ws)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;Ws.copy(r).sub(this.target);let s=Ws.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(il*this._rotateDelta.x/t.clientHeight),this._rotateUp(il*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(il*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(-il*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(il*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(-il*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(il*this._rotateDelta.x/t.clientHeight),this._rotateUp(il*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 yMe(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 vMe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function bMe(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(ene),this.state=er.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 wMe(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=er.DOLLY;break;case ga.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=er.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=er.ROTATE}break;case ga.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=er.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=er.PAN}break;default:this.state=er.NONE}this.state!==er.NONE&&this.dispatchEvent(_k)}function SMe(i){switch(this.state){case er.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case er.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case er.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function TMe(i){this.enabled===!1||this.enableZoom===!1||this.state!==er.NONE||(i.preventDefault(),this.dispatchEvent(_k),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(ene))}function EMe(i){this.enabled!==!1&&this._handleKeyDown(i)}function MMe(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case sp.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=er.TOUCH_ROTATE;break;case sp.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=er.TOUCH_PAN;break;default:this.state=er.NONE}break;case 2:switch(this.touches.TWO){case sp.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=er.TOUCH_DOLLY_PAN;break;case sp.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=er.TOUCH_DOLLY_ROTATE;break;default:this.state=er.NONE}break;default:this.state=er.NONE}this.state!==er.NONE&&this.dispatchEvent(_k)}function CMe(i){switch(this._trackPointer(i),this.state){case er.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case er.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case er.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case er.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=er.NONE}}function RMe(i){this.enabled!==!1&&i.preventDefault()}function PMe(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function IMe(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var NMe={type:"change"},tne=1e-6,nne=new Ss,CR=class extends Of{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 ie(0,0,0),this._rotationVector=new ie(0,0,0),this._lastQuaternion=new Ss,this._lastPosition=new ie,this._status=0,this._onKeyDown=LMe.bind(this),this._onKeyUp=DMe.bind(this),this._onPointerMove=OMe.bind(this),this._onPointerDown=FMe.bind(this),this._onPointerUp=BMe.bind(this),this._onPointerCancel=UMe.bind(this),this._onContextMenu=kMe.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),nne.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(nne),(this._lastPosition.distanceToSquared(t.position)>tne||8*(1-this._lastQuaternion.dot(t.quaternion))>tne)&&(this.dispatchEvent(NMe),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 LMe(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 DMe(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 FMe(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 OMe(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 BMe(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 UMe(){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 kMe(i){this.enabled!==!1&&i.preventDefault()}var ine={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`52355235 52365236 varying vec2 vUv;52375237
@@ -5254,8 +5254,8 @@ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
52545254 gl_FragColor = opacity * texel;52555255 52565256 5257- }`};var od=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(){}},UMe=new Hc(-1,1,1,-1,0,1),fk=class extends qn{constructor(){super(),this.setAttribute("position",new Rn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Rn([0,2,0,0,2,0],2))}},kMe=new fk,MR=class{constructor(e){this._mesh=new Gn(kMe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,UMe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};var CR=class extends od{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof $r?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=XA.clone(e.uniforms),this.material=new $r({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 MR(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 Nb=class extends od{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)}},RR=class extends od{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}};var PR=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 ha(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Di}),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 CR(tne),this.copyPass.material.blending=Yr,this.timer=new DA}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()}Nb!==void 0&&(o instanceof Nb?n=!0:o instanceof RR&&(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 IR=class extends od{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 Ut}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 Ia(){return Ia=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},Ia.apply(null,arguments)}function nne(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function w0(i,e){return w0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},w0(i,e)}function ine(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,w0(i,e)}function NR(i){return NR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},NR(i)}function rne(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function dk(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(dk=function(){return!!i})()}function sne(i,e,t){if(dk())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&w0(r,t.prototype),r}function LR(i){var e=typeof Map=="function"?new Map:void 0;return LR=function(n){if(n===null||!rne(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 sne(n,arguments,NR(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),w0(r,n)},LR(i)}var il=(function(i){ine(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 nne(n)}return e})(LR(Error));function one(i,e){return i.substr(-e.length)===e}var GMe=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function ane(i){if(typeof i!="string")return i;var e=i.match(GMe);return e?parseFloat(i):i}var zMe=function(e){return function(t,n){n===void 0&&(n="16px");var r=t,s=n;if(typeof t=="string"){if(!one(t,"px"))throw new il(69,e,t);r=ane(t)}if(typeof n=="string"){if(!one(n,"px"))throw new il(70,e,n);s=ane(n)}if(typeof r=="string")throw new il(71,t,e);if(typeof s=="string")throw new il(72,n,e);return""+r/s+e}},cne=zMe,tdt=cne("em");var ndt=cne("rem");function pk(i){return Math.round(i*255)}function VMe(i,e,t){return pk(i)+","+pk(e)+","+pk(t)}function Lb(i,e,t,n){if(n===void 0&&(n=VMe),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,p=l+u,x=c+u;return n(f,p,x)}var lne={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 qMe(i){if(typeof i!="string")return i;var e=i.toLowerCase();return lne[e]?"#"+lne[e]:i}var HMe=/^#[a-fA-F0-9]{6}$/,WMe=/^#[a-fA-F0-9]{8}$/,jMe=/^#[a-fA-F0-9]{3}$/,XMe=/^#[a-fA-F0-9]{4}$/,Ak=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,$Me=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,YMe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,ZMe=/^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 S0(i){if(typeof i!="string")throw new il(3);var e=qMe(i);if(e.match(HMe))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(WMe)){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(jMe))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(XMe)){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=Ak.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=$Me.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=YMe.exec(e);if(o){var a=parseInt(""+o[1],10),l=parseInt(""+o[2],10)/100,c=parseInt(""+o[3],10)/100,u="rgb("+Lb(a,l,c)+")",f=Ak.exec(u);if(!f)throw new il(4,e,u);return{red:parseInt(""+f[1],10),green:parseInt(""+f[2],10),blue:parseInt(""+f[3],10)}}var p=ZMe.exec(e.substring(0,50));if(p){var x=parseInt(""+p[1],10),v=parseInt(""+p[2],10)/100,w=parseInt(""+p[3],10)/100,S="rgb("+Lb(x,v,w)+")",T=Ak.exec(S);if(!T)throw new il(4,e,S);return{red:parseInt(""+T[1],10),green:parseInt(""+T[2],10),blue:parseInt(""+T[3],10),alpha:parseFloat(""+p[4])>1?parseFloat(""+p[4])/100:parseFloat(""+p[4])}}throw new il(5)}function KMe(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 T0(i){return KMe(S0(i))}var QMe=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},gk=QMe;function Zm(i){var e=i.toString(16);return e.length===1?"0"+e:e}function mk(i){return Zm(Math.round(i*255))}function JMe(i,e,t){return gk("#"+mk(i)+mk(e)+mk(t))}function DR(i,e,t){return Lb(i,e,t,JMe)}function eCe(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return DR(i,e,t);if(typeof i=="object"&&e===void 0&&t===void 0)return DR(i.hue,i.saturation,i.lightness);throw new il(1)}function tCe(i,e,t,n){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?DR(i,e,t):"rgba("+Lb(i,e,t)+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?DR(i.hue,i.saturation,i.lightness):"rgba("+Lb(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new il(2)}function _k(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return gk("#"+Zm(i)+Zm(e)+Zm(t));if(typeof i=="object"&&e===void 0&&t===void 0)return gk("#"+Zm(i.red)+Zm(i.green)+Zm(i.blue));throw new il(6)}function FR(i,e,t,n){if(typeof i=="string"&&typeof e=="number"){var r=S0(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?_k(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?_k(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")"}throw new il(7)}var nCe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},iCe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},rCe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},sCe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function E0(i){if(typeof i!="object")throw new il(8);if(iCe(i))return FR(i);if(nCe(i))return _k(i);if(sCe(i))return tCe(i);if(rCe(i))return eCe(i);throw new il(8)}function une(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):une(i,e,r)}}function Bl(i){return une(i,i.length,[])}function oCe(i,e){if(e==="transparent")return e;var t=T0(e);return E0(Ia({},t,{hue:t.hue+parseFloat(i)}))}var idt=Bl(oCe);function J1(i,e,t){return Math.max(i,Math.min(e,t))}function aCe(i,e){if(e==="transparent")return e;var t=T0(e);return E0(Ia({},t,{lightness:J1(0,1,t.lightness-parseFloat(i))}))}var rdt=Bl(aCe);function lCe(i,e){if(e==="transparent")return e;var t=T0(e);return E0(Ia({},t,{saturation:J1(0,1,t.saturation-parseFloat(i))}))}var sdt=Bl(lCe);function cCe(i,e){if(e==="transparent")return e;var t=T0(e);return E0(Ia({},t,{lightness:J1(0,1,t.lightness+parseFloat(i))}))}var odt=Bl(cCe);function uCe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=S0(e),r=Ia({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=S0(t),o=Ia({},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,p=1-f,x={red:Math.floor(r.red*f+o.red*p),green:Math.floor(r.green*f+o.green*p),blue:Math.floor(r.blue*f+o.blue*p),alpha:r.alpha*parseFloat(i)+o.alpha*(1-parseFloat(i))};return FR(x)}var hCe=Bl(uCe),hne=hCe;function fCe(i,e){if(e==="transparent")return e;var t=S0(e),n=typeof t.alpha=="number"?t.alpha:1,r=Ia({},t,{alpha:J1(0,1,(n*100+parseFloat(i)*100)/100)});return FR(r)}var dCe=Bl(fCe),fne=dCe;function pCe(i,e){if(e==="transparent")return e;var t=T0(e);return E0(Ia({},t,{saturation:J1(0,1,t.saturation+parseFloat(i))}))}var adt=Bl(pCe);function ACe(i,e){return e==="transparent"?e:E0(Ia({},T0(e),{hue:parseFloat(i)}))}var ldt=Bl(ACe);function mCe(i,e){return e==="transparent"?e:E0(Ia({},T0(e),{lightness:parseFloat(i)}))}var cdt=Bl(mCe);function gCe(i,e){return e==="transparent"?e:E0(Ia({},T0(e),{saturation:parseFloat(i)}))}var udt=Bl(gCe);function _Ce(i,e){return e==="transparent"?e:hne(parseFloat(i),"rgb(0, 0, 0)",e)}var hdt=Bl(_Ce);function xCe(i,e){return e==="transparent"?e:hne(parseFloat(i),"rgb(255, 255, 255)",e)}var fdt=Bl(xCe);function yCe(i,e){if(e==="transparent")return e;var t=S0(e),n=typeof t.alpha=="number"?t.alpha:1,r=Ia({},t,{alpha:J1(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return FR(r)}var ddt=Bl(yCe);var OR="http://www.w3.org/1999/xhtml",xk={svg:"http://www.w3.org/2000/svg",xhtml:OR,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function BR(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),xk.hasOwnProperty(e)?{space:xk[e],local:i}:i}function vCe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===OR&&e.documentElement.namespaceURI===OR?e.createElement(i):e.createElementNS(t,i)}}function bCe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function UR(i){var e=BR(i);return(e.local?bCe:vCe)(e)}function wCe(){}function kR(i){return i==null?wCe:function(){return this.querySelector(i)}}function dne(i){typeof i!="function"&&(i=kR(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 ns(n,this._parents)}function yk(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function SCe(){return[]}function pne(i){return i==null?SCe:function(){return this.querySelectorAll(i)}}function TCe(i){return function(){return yk(i.apply(this,arguments))}}function Ane(i){typeof i=="function"?i=TCe(i):i=pne(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 ns(n,r)}function mne(i){return function(){return this.matches(i)}}function GR(i){return function(e){return e.matches(i)}}var ECe=Array.prototype.find;function MCe(i){return function(){return ECe.call(this.children,i)}}function CCe(){return this.firstElementChild}function gne(i){return this.select(i==null?CCe:MCe(typeof i=="function"?i:GR(i)))}var RCe=Array.prototype.filter;function PCe(){return Array.from(this.children)}function ICe(i){return function(){return RCe.call(this.children,i)}}function _ne(i){return this.selectAll(i==null?PCe:ICe(typeof i=="function"?i:GR(i)))}function xne(i){typeof i!="function"&&(i=mne(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 ns(n,this._parents)}function zR(i){return new Array(i.length)}function yne(){return new ns(this._enter||this._groups.map(zR),this._parents)}function Db(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}Db.prototype={constructor:Db,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 vne(i){return function(){return i}}function NCe(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 Db(i,s[o]);for(;o<l;++o)(a=e[o])&&(r[o]=a)}function LCe(i,e,t,n,r,s,o){var a,l,c=new Map,u=e.length,f=s.length,p=new Array(u),x;for(a=0;a<u;++a)(l=e[a])&&(p[a]=x=o.call(l,l.__data__,a,e)+"",c.has(x)?r[a]=l:c.set(x,l));for(a=0;a<f;++a)x=o.call(i,s[a],a,s)+"",(l=c.get(x))?(n[a]=l,l.__data__=s[a],c.delete(x)):t[a]=new Db(i,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(p[a])===l&&(r[a]=l)}function DCe(i){return i.__data__}function bne(i,e){if(!arguments.length)return Array.from(this,DCe);var t=e?LCe:NCe,n=this._parents,r=this._groups;typeof i!="function"&&(i=vne(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],p=f.length,x=FCe(i.call(u,u&&u.__data__,c,n)),v=x.length,w=a[c]=new Array(v),S=o[c]=new Array(v),T=l[c]=new Array(p);t(u,f,w,S,T,x,e);for(var P=0,R=0,C,L;P<v;++P)if(C=w[P]){for(P>=R&&(R=P+1);!(L=S[R])&&++R<v;);C._next=L||null}}return o=new ns(o,n),o._enter=a,o._exit=l,o}function FCe(i){return typeof i=="object"&&"length"in i?i:Array.from(i)}function wne(){return new ns(this._exit||this._groups.map(zR),this._parents)}function Sne(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 Tne(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,p=a[l]=new Array(f),x,v=0;v<f;++v)(x=c[v]||u[v])&&(p[v]=x);for(;l<r;++l)a[l]=t[l];return new ns(a,this._parents)}function Ene(){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 Mne(i){i||(i=OCe);function e(f,p){return f&&p?i(f.__data__,p.__data__):!f-!p}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 ns(r,this._parents).order()}function OCe(i,e){return i<e?-1:i>e?1:i>=e?0:NaN}function Cne(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function Rne(){return Array.from(this)}function Pne(){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 Ine(){let i=0;for(let e of this)++i;return i}function Nne(){return!this.node()}function Lne(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 BCe(i){return function(){this.removeAttribute(i)}}function UCe(i){return function(){this.removeAttributeNS(i.space,i.local)}}function kCe(i,e){return function(){this.setAttribute(i,e)}}function GCe(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function zCe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function VCe(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 Dne(i,e){var t=BR(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?UCe:BCe:typeof e=="function"?t.local?VCe:zCe:t.local?GCe:kCe)(t,e))}function VR(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function qCe(i){return function(){this.style.removeProperty(i)}}function HCe(i,e,t){return function(){this.style.setProperty(i,e,t)}}function WCe(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function Fne(i,e,t){return arguments.length>1?this.each((e==null?qCe:typeof e=="function"?WCe:HCe)(i,e,t??"")):jCe(this.node(),i)}function jCe(i,e){return i.style.getPropertyValue(e)||VR(i).getComputedStyle(i,null).getPropertyValue(e)}function XCe(i){return function(){delete this[i]}}function $Ce(i,e){return function(){this[i]=e}}function YCe(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function One(i,e){return arguments.length>1?this.each((e==null?XCe:typeof e=="function"?YCe:$Ce)(i,e)):this.node()[i]}function Bne(i){return i.trim().split(/^|\s+/)}function vk(i){return i.classList||new Une(i)}function Une(i){this._node=i,this._names=Bne(i.getAttribute("class")||"")}Une.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 kne(i,e){for(var t=vk(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function Gne(i,e){for(var t=vk(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function ZCe(i){return function(){kne(this,i)}}function KCe(i){return function(){Gne(this,i)}}function QCe(i,e){return function(){(e.apply(this,arguments)?kne:Gne)(this,i)}}function zne(i,e){var t=Bne(i+"");if(arguments.length<2){for(var n=vk(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?QCe:e?ZCe:KCe)(t,e))}function JCe(){this.textContent=""}function eRe(i){return function(){this.textContent=i}}function tRe(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function Vne(i){return arguments.length?this.each(i==null?JCe:(typeof i=="function"?tRe:eRe)(i)):this.node().textContent}function nRe(){this.innerHTML=""}function iRe(i){return function(){this.innerHTML=i}}function rRe(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function qne(i){return arguments.length?this.each(i==null?nRe:(typeof i=="function"?rRe:iRe)(i)):this.node().innerHTML}function sRe(){this.nextSibling&&this.parentNode.appendChild(this)}function Hne(){return this.each(sRe)}function oRe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Wne(){return this.each(oRe)}function jne(i){var e=typeof i=="function"?i:UR(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function aRe(){return null}function Xne(i,e){var t=typeof i=="function"?i:UR(i),n=e==null?aRe:typeof e=="function"?e:kR(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function lRe(){var i=this.parentNode;i&&i.removeChild(this)}function $ne(){return this.each(lRe)}function cRe(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function uRe(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function Yne(i){return this.select(i?uRe:cRe)}function Zne(i){return arguments.length?this.property("__data__",i):this.node().__data__}function hRe(i){return function(e){i.call(this,e,this.__data__)}}function fRe(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 dRe(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 pRe(i,e,t){return function(){var n=this.__on,r,s=hRe(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 Kne(i,e,t){var n=fRe(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?pRe:dRe,r=0;r<s;++r)this.each(a(n[r],e,t));return this}function Qne(i,e,t){var n=VR(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 ARe(i,e){return function(){return Qne(this,i,e)}}function mRe(i,e){return function(){return Qne(this,i,e.apply(this,arguments))}}function Jne(i,e){return this.each((typeof e=="function"?mRe:ARe)(i,e))}function*eie(){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 bk=[null];function ns(i,e){this._groups=i,this._parents=e}function gRe(){return new ns([[document.documentElement]],bk)}function _Re(){return this}ns.prototype=gRe.prototype={constructor:ns,select:dne,selectAll:Ane,selectChild:gne,selectChildren:_ne,filter:xne,data:bne,enter:yne,exit:wne,join:Sne,merge:Tne,selection:_Re,order:Ene,sort:Mne,call:Cne,nodes:Rne,node:Pne,size:Ine,empty:Nne,each:Lne,attr:Dne,style:Fne,property:One,classed:zne,text:Vne,html:qne,raise:Hne,lower:Wne,append:jne,insert:Xne,remove:$ne,clone:Yne,datum:Zne,on:Kne,dispatch:Jne,[Symbol.iterator]:eie};function wk(i){return typeof i=="string"?new ns([[document.querySelector(i)]],[document.documentElement]):new ns([[i]],bk)}function tie(i){let e;for(;e=i.sourceEvent;)i=e;return i}function Sk(i,e){if(i=tie(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 Bb,Tr,oie,Ck,M0,nie,aie,lie,Tk,HR,Fb,cie,Rk,Ek,Mk,xRe,jR={},XR=[],yRe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,YR=Array.isArray;function Hh(i,e){for(var t in e)i[t]=e[t];return i}function Pk(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function vRe(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?Bb.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 Ob(i,o,n,r,null)}function Ob(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??++oie,__i:-1,__u:0};return r==null&&Tr.vnode!=null&&Tr.vnode(s),s}function ZR(i){return i.children}function WR(i,e){this.props=i,this.context=e}function Km(i,e){if(e==null)return i.__?Km(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"?Km(i):null}function bRe(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=Hh({},e);s.__v=e.__v+1,Tr.vnode&&Tr.vnode(s),Ik(i.__P,s,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,n,t??Km(e),!!(32&e.__u),r),s.__v=e.__v,s.__.__k[s.__i]=s,pie(n,s,r),e.__e=e.__=null,s.__e!=t&&uie(s)}}function uie(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}),uie(i)}function iie(i){(!i.__d&&(i.__d=!0)&&M0.push(i)&&!$R.__r++||nie!=Tr.debounceRendering)&&((nie=Tr.debounceRendering)||aie)($R)}function $R(){try{for(var i,e=1;M0.length;)M0.length>e&&M0.sort(lie),i=M0.shift(),e=M0.length,bRe(i)}finally{M0.length=$R.__r=0}}function hie(i,e,t,n,r,s,o,a,l,c,u){var f,p,x,v,w,S,T=n&&n.__k||XR,P=e.length;for(l=wRe(t,e,T,l,P),f=0;f<P;f++)(x=t.__k[f])!=null&&(p=x.__i!=-1&&T[x.__i]||jR,x.__i=f,S=Ik(i,x,p,r,s,o,a,l,c,u),v=x.__e,x.ref&&p.ref!=x.ref&&(p.ref&&Nk(p.ref,null,x),u.push(x.ref,x.__c||v,x)),w==null&&v!=null&&(w=v),4&x.__u?(l=fie(x,l,i),p.__e&&(p.__e=null)):typeof x.type=="function"&&S!==void 0?l=S:v&&(l=v.nextSibling),x.__u&=-7);return t.__e=w,l}function wRe(i,e,t,n,r){var s,o,a,l,c,u=t.length,f=u,p=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]=Ob(null,o,null,null,null):YR(o)?o=i.__k[s]=Ob(ZR,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[s]=Ob(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):i.__k[s]=o,l=s+p,o.__=i,o.__b=i.__b+1,a=null,(c=o.__i=SRe(o,t,l,f))!=-1&&(f--,(a=t[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(r>u?p--:r<u&&p++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?p--:c==l+1?p++:(c>l?p--:p++,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=Km(a)),mie(a,a));return n}function fie(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=fie(n[r],e,t));return e}i.__e!=e&&(e&&i.type&&!e.parentNode&&(e=Km(i)),e=t.insertBefore(i.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function SRe(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 rie(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||yRe.test(e)?t:t+"px"}function qR(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||rie(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||rie(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(cie,"$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[Fb]=n[Fb]:(t[Fb]=Rk,i.addEventListener(e,s?Mk:Ek,s)):i.removeEventListener(e,s?Mk:Ek,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 sie(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[HR]==null)e[HR]=Rk++;else if(e[HR]<t[Fb])return;return t(Tr.event?Tr.event(e):e)}}}function Ik(i,e,t,n,r,s,o,a,l,c){var u,f,p,x,v,w,S,T,P,R,C,L,D,F,N,B,z=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),s=[a=e.__e=t.__e]),(u=Tr.__b)&&u(e);e:if(typeof z=="function"){f=o.length;try{if(P=e.props,R=z.prototype&&z.prototype.render,C=(u=z.contextType)&&n[u.__c],L=u?C?C.props.value:u.__:n,t.__c?T=(p=e.__c=t.__c).__=p.__E:(R?e.__c=p=new z(P,L):(e.__c=p=new WR(P,L),p.constructor=z,p.render=ERe),C&&C.sub(p),p.state||(p.state={}),p.__n=n,x=p.__d=!0,p.__h=[],p._sb=[]),R&&p.__s==null&&(p.__s=p.state),R&&z.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Hh({},p.__s)),Hh(p.__s,z.getDerivedStateFromProps(P,p.__s))),v=p.props,w=p.state,p.__v=e,x)R&&z.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),R&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(R&&z.getDerivedStateFromProps==null&&P!==v&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(P,L),e.__v==t.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(P,p.__s,L)===!1){e.__v!=t.__v&&(p.props=P,p.state=p.__s,p.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(V){V&&(V.__=e)}),XR.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&o.push(p),a=Km(t);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(P,p.__s,L),R&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(v,w,S)})}if(p.context=L,p.props=P,p.__P=i,p.__e=!1,D=Tr.__r,F=0,R)p.state=p.__s,p.__d=!1,D&&D(e),u=p.render(p.props,p.state,p.context),XR.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,D&&D(e),u=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++F<25);p.state=p.__s,p.getChildContext!=null&&(n=Hh(Hh({},n),p.getChildContext())),R&&!x&&p.getSnapshotBeforeUpdate!=null&&(S=p.getSnapshotBeforeUpdate(v,w)),N=u!=null&&u.type===ZR&&u.key==null?Aie(u.props.children):u,a=hie(i,YR(N)?N:[N],e,t,n,r,s,o,a,l,c),p.base=e.__e,e.__u&=-161,p.__h.length&&o.push(p),T&&(p.__E=p.__=null)}catch(V){if(o.length=f,e.__v=null,l||s!=null){if(V.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--;)Pk(s[B])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),V.then||die(e),Tr.__e(V,e,t)}}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=TRe(t.__e,e,t,n,r,s,o,l,c);return(u=Tr.diffed)&&u(e),128&e.__u?void 0:a}function die(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(die))}function pie(i,e,t){for(var n=0;n<t.length;n++)Nk(t[n],t[++n],t[++n]);Tr.__c&&Tr.__c(e,i),i.some(function(r){try{i=r.__h,r.__h=[],i.some(function(s){s.call(r)})}catch(s){Tr.__e(s,r.__v)}})}function Aie(i){return typeof i!="object"||i==null||i.__b>0?i:YR(i)?i.map(Aie):i.constructor!==void 0?null:Hh({},i)}function TRe(i,e,t,n,r,s,o,a,l){var c,u,f,p,x,v,w,S=t.props||jR,T=e.props,P=e.type;if(P=="svg"?r="http://www.w3.org/2000/svg":P=="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((x=s[c])&&"setAttribute"in x==!!P&&(P?x.localName==P:x.nodeType==3)){i=x,s[c]=null;break}}if(i==null){if(P==null)return document.createTextNode(T);i=document.createElementNS(r,P,T.is&&T),a&&(Tr.__m&&Tr.__m(e,s),a=!1),s=null}if(P==null)S===T||a&&i.data==T||(i.data=T);else{if(s=P=="textarea"&&T.defaultValue!=null?null:s&&Bb.call(i.childNodes),!a&&s!=null)for(S={},c=0;c<i.attributes.length;c++)S[(x=i.attributes[c]).name]=x.value;for(c in S)x=S[c],c=="dangerouslySetInnerHTML"?f=x:c=="children"||c in T||c=="value"&&"defaultValue"in T||c=="checked"&&"defaultChecked"in T||qR(i,c,null,x,r);for(c in T)x=T[c],c=="children"?p=x:c=="dangerouslySetInnerHTML"?u=x:c=="value"?v=x:c=="checked"?w=x:a&&typeof x!="function"||S[c]===x||qR(i,c,x,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=""),hie(e.type=="template"?i.content:i,YR(p)?p:[p],e,t,n,P=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:t.__k&&Km(t,0),a,l),s!=null)for(c=s.length;c--;)Pk(s[c]);a&&P!="textarea"||(c="value",P=="progress"&&v==null?i.removeAttribute("value"):v!=null&&(v!==i[c]||P=="progress"&&!v||P=="option"&&v!=S[c])&&qR(i,c,v,S[c],r),c="checked",w!=null&&w!=i[c]&&qR(i,c,w,S[c],r))}return i}function Nk(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){Tr.__e(r,t)}}function mie(i,e,t){var n,r;if(Tr.unmount&&Tr.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||Nk(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){Tr.__e(s,e)}n.base=n.__P=n.__n=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&mie(n[r],e,t||typeof i.type!="function");t||Pk(i.__e),i.__c=i.__=i.__e=void 0}function ERe(i,e,t){return this.constructor(i,t)}function gie(i,e,t){var n,r,s,o;e==document&&(e=document.documentElement),Tr.__&&Tr.__(i,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,s=[],o=[],Ik(e,i=(!n&&t||e).__k=vRe(ZR,null,[i]),r||jR,jR,e.namespaceURI,!n&&t?[t]:r?null:e.firstChild?Bb.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n,o),pie(s,i,o),i.props.children=null}function Lk(i,e,t){var n,r,s,o,a=Hh({},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?Bb.call(arguments,2):t),Ob(i.type,a,n||i.key,r||i.ref,null)}Bb=XR.slice,Tr={__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}},oie=0,Ck=function(i){return i!=null&&i.constructor===void 0},WR.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Hh({},this.state),typeof i=="function"&&(i=i(Hh({},t),this.props)),i&&Hh(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),iie(this))},WR.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),iie(this))},WR.prototype.render=ZR,M0=[],aie=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,lie=function(i,e){return i.__v.__b-e.__v.__b},$R.__r=0,Tk=Math.random().toString(8),HR="__d"+Tk,Fb="__a"+Tk,cie=/(PointerCapture)$|Capture$/i,Rk=0,Ek=sie(!1),Mk=sie(!0),xRe=0;function _ie(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 MRe(i){if(Array.isArray(i))return i}function CRe(i,e,t){return(e=DRe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function RRe(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 PRe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5258-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xie(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 IRe(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?xie(Object(t),!0).forEach(function(n){CRe(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):xie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function NRe(i,e){return MRe(i)||RRe(i,e)||FRe(i,e)||PRe()}function LRe(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 DRe(i){var e=LRe(i,"string");return typeof e=="symbol"?e:e+""}function KR(i){"@babel/helpers - typeof";return KR=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},KR(i)}function FRe(i,e){if(i){if(typeof i=="string")return _ie(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)?_ie(i,e):void 0}}var Dk=function(e){if(KR(e)!=="object")return e;var t=Lk(e);if(t.props){var n;t.props=IRe({},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(Dk):Dk(t.props.children))}return t},ORe=function(e){return Ck(Lk(e))},BRe=function(e,t){delete t.__k,gie(Dk(e),t)};function URe(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 kRe=`.float-tooltip-kap {5257+ }`};var ad=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(){}},GMe=new Wc(-1,1,1,-1,0,1),xk=class extends qn{constructor(){super(),this.setAttribute("position",new Rn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Rn([0,2,0,0,2,0],2))}},zMe=new xk,RR=class{constructor(e){this._mesh=new Gn(zMe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,GMe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};var PR=class extends ad{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof $r?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=YA.clone(e.uniforms),this.material=new $r({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 RR(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 Db=class extends ad{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)}},IR=class extends ad{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}};var NR=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 ha(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Di}),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 PR(ine),this.copyPass.material.blending=Yr,this.timer=new OA}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()}Db!==void 0&&(o instanceof Db?n=!0:o instanceof IR&&(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 LR=class extends ad{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 Ut}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 Ia(){return Ia=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},Ia.apply(null,arguments)}function rne(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function S0(i,e){return S0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},S0(i,e)}function sne(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,S0(i,e)}function DR(i){return DR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},DR(i)}function one(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function yk(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(yk=function(){return!!i})()}function ane(i,e,t){if(yk())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&S0(r,t.prototype),r}function FR(i){var e=typeof Map=="function"?new Map:void 0;return FR=function(n){if(n===null||!one(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 ane(n,arguments,DR(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),S0(r,n)},FR(i)}var rl=(function(i){sne(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 rne(n)}return e})(FR(Error));function lne(i,e){return i.substr(-e.length)===e}var VMe=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function cne(i){if(typeof i!="string")return i;var e=i.match(VMe);return e?parseFloat(i):i}var qMe=function(e){return function(t,n){n===void 0&&(n="16px");var r=t,s=n;if(typeof t=="string"){if(!lne(t,"px"))throw new rl(69,e,t);r=cne(t)}if(typeof n=="string"){if(!lne(n,"px"))throw new rl(70,e,n);s=cne(n)}if(typeof r=="string")throw new rl(71,t,e);if(typeof s=="string")throw new rl(72,n,e);return""+r/s+e}},hne=qMe,odt=hne("em");var adt=hne("rem");function vk(i){return Math.round(i*255)}function HMe(i,e,t){return vk(i)+","+vk(e)+","+vk(t)}function Fb(i,e,t,n){if(n===void 0&&(n=HMe),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,p=l+u,x=c+u;return n(f,p,x)}var une={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 WMe(i){if(typeof i!="string")return i;var e=i.toLowerCase();return une[e]?"#"+une[e]:i}var jMe=/^#[a-fA-F0-9]{6}$/,XMe=/^#[a-fA-F0-9]{8}$/,$Me=/^#[a-fA-F0-9]{3}$/,YMe=/^#[a-fA-F0-9]{4}$/,bk=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,ZMe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,KMe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,QMe=/^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 T0(i){if(typeof i!="string")throw new rl(3);var e=WMe(i);if(e.match(jMe))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(XMe)){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($Me))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(YMe)){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=bk.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=ZMe.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=KMe.exec(e);if(o){var a=parseInt(""+o[1],10),l=parseInt(""+o[2],10)/100,c=parseInt(""+o[3],10)/100,u="rgb("+Fb(a,l,c)+")",f=bk.exec(u);if(!f)throw new rl(4,e,u);return{red:parseInt(""+f[1],10),green:parseInt(""+f[2],10),blue:parseInt(""+f[3],10)}}var p=QMe.exec(e.substring(0,50));if(p){var x=parseInt(""+p[1],10),v=parseInt(""+p[2],10)/100,w=parseInt(""+p[3],10)/100,S="rgb("+Fb(x,v,w)+")",T=bk.exec(S);if(!T)throw new rl(4,e,S);return{red:parseInt(""+T[1],10),green:parseInt(""+T[2],10),blue:parseInt(""+T[3],10),alpha:parseFloat(""+p[4])>1?parseFloat(""+p[4])/100:parseFloat(""+p[4])}}throw new rl(5)}function JMe(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 E0(i){return JMe(T0(i))}var eCe=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},Sk=eCe;function Qm(i){var e=i.toString(16);return e.length===1?"0"+e:e}function wk(i){return Qm(Math.round(i*255))}function tCe(i,e,t){return Sk("#"+wk(i)+wk(e)+wk(t))}function OR(i,e,t){return Fb(i,e,t,tCe)}function nCe(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return OR(i,e,t);if(typeof i=="object"&&e===void 0&&t===void 0)return OR(i.hue,i.saturation,i.lightness);throw new rl(1)}function iCe(i,e,t,n){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?OR(i,e,t):"rgba("+Fb(i,e,t)+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?OR(i.hue,i.saturation,i.lightness):"rgba("+Fb(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new rl(2)}function Tk(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return Sk("#"+Qm(i)+Qm(e)+Qm(t));if(typeof i=="object"&&e===void 0&&t===void 0)return Sk("#"+Qm(i.red)+Qm(i.green)+Qm(i.blue));throw new rl(6)}function BR(i,e,t,n){if(typeof i=="string"&&typeof e=="number"){var r=T0(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?Tk(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?Tk(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")"}throw new rl(7)}var rCe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},sCe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},oCe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},aCe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function M0(i){if(typeof i!="object")throw new rl(8);if(sCe(i))return BR(i);if(rCe(i))return Tk(i);if(aCe(i))return iCe(i);if(oCe(i))return nCe(i);throw new rl(8)}function fne(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):fne(i,e,r)}}function Ul(i){return fne(i,i.length,[])}function lCe(i,e){if(e==="transparent")return e;var t=E0(e);return M0(Ia({},t,{hue:t.hue+parseFloat(i)}))}var ldt=Ul(lCe);function ex(i,e,t){return Math.max(i,Math.min(e,t))}function cCe(i,e){if(e==="transparent")return e;var t=E0(e);return M0(Ia({},t,{lightness:ex(0,1,t.lightness-parseFloat(i))}))}var cdt=Ul(cCe);function uCe(i,e){if(e==="transparent")return e;var t=E0(e);return M0(Ia({},t,{saturation:ex(0,1,t.saturation-parseFloat(i))}))}var udt=Ul(uCe);function hCe(i,e){if(e==="transparent")return e;var t=E0(e);return M0(Ia({},t,{lightness:ex(0,1,t.lightness+parseFloat(i))}))}var hdt=Ul(hCe);function fCe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=T0(e),r=Ia({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=T0(t),o=Ia({},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,p=1-f,x={red:Math.floor(r.red*f+o.red*p),green:Math.floor(r.green*f+o.green*p),blue:Math.floor(r.blue*f+o.blue*p),alpha:r.alpha*parseFloat(i)+o.alpha*(1-parseFloat(i))};return BR(x)}var dCe=Ul(fCe),dne=dCe;function pCe(i,e){if(e==="transparent")return e;var t=T0(e),n=typeof t.alpha=="number"?t.alpha:1,r=Ia({},t,{alpha:ex(0,1,(n*100+parseFloat(i)*100)/100)});return BR(r)}var ACe=Ul(pCe),pne=ACe;function mCe(i,e){if(e==="transparent")return e;var t=E0(e);return M0(Ia({},t,{saturation:ex(0,1,t.saturation+parseFloat(i))}))}var fdt=Ul(mCe);function gCe(i,e){return e==="transparent"?e:M0(Ia({},E0(e),{hue:parseFloat(i)}))}var ddt=Ul(gCe);function _Ce(i,e){return e==="transparent"?e:M0(Ia({},E0(e),{lightness:parseFloat(i)}))}var pdt=Ul(_Ce);function xCe(i,e){return e==="transparent"?e:M0(Ia({},E0(e),{saturation:parseFloat(i)}))}var Adt=Ul(xCe);function yCe(i,e){return e==="transparent"?e:dne(parseFloat(i),"rgb(0, 0, 0)",e)}var mdt=Ul(yCe);function vCe(i,e){return e==="transparent"?e:dne(parseFloat(i),"rgb(255, 255, 255)",e)}var gdt=Ul(vCe);function bCe(i,e){if(e==="transparent")return e;var t=T0(e),n=typeof t.alpha=="number"?t.alpha:1,r=Ia({},t,{alpha:ex(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return BR(r)}var _dt=Ul(bCe);var UR="http://www.w3.org/1999/xhtml",Ek={svg:"http://www.w3.org/2000/svg",xhtml:UR,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function kR(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),Ek.hasOwnProperty(e)?{space:Ek[e],local:i}:i}function wCe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===UR&&e.documentElement.namespaceURI===UR?e.createElement(i):e.createElementNS(t,i)}}function SCe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function GR(i){var e=kR(i);return(e.local?SCe:wCe)(e)}function TCe(){}function zR(i){return i==null?TCe:function(){return this.querySelector(i)}}function Ane(i){typeof i!="function"&&(i=zR(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 ns(n,this._parents)}function Mk(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function ECe(){return[]}function mne(i){return i==null?ECe:function(){return this.querySelectorAll(i)}}function MCe(i){return function(){return Mk(i.apply(this,arguments))}}function gne(i){typeof i=="function"?i=MCe(i):i=mne(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 ns(n,r)}function _ne(i){return function(){return this.matches(i)}}function VR(i){return function(e){return e.matches(i)}}var CCe=Array.prototype.find;function RCe(i){return function(){return CCe.call(this.children,i)}}function PCe(){return this.firstElementChild}function xne(i){return this.select(i==null?PCe:RCe(typeof i=="function"?i:VR(i)))}var ICe=Array.prototype.filter;function NCe(){return Array.from(this.children)}function LCe(i){return function(){return ICe.call(this.children,i)}}function yne(i){return this.selectAll(i==null?NCe:LCe(typeof i=="function"?i:VR(i)))}function vne(i){typeof i!="function"&&(i=_ne(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 ns(n,this._parents)}function qR(i){return new Array(i.length)}function bne(){return new ns(this._enter||this._groups.map(qR),this._parents)}function Ob(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}Ob.prototype={constructor:Ob,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 wne(i){return function(){return i}}function DCe(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 Ob(i,s[o]);for(;o<l;++o)(a=e[o])&&(r[o]=a)}function FCe(i,e,t,n,r,s,o){var a,l,c=new Map,u=e.length,f=s.length,p=new Array(u),x;for(a=0;a<u;++a)(l=e[a])&&(p[a]=x=o.call(l,l.__data__,a,e)+"",c.has(x)?r[a]=l:c.set(x,l));for(a=0;a<f;++a)x=o.call(i,s[a],a,s)+"",(l=c.get(x))?(n[a]=l,l.__data__=s[a],c.delete(x)):t[a]=new Ob(i,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(p[a])===l&&(r[a]=l)}function OCe(i){return i.__data__}function Sne(i,e){if(!arguments.length)return Array.from(this,OCe);var t=e?FCe:DCe,n=this._parents,r=this._groups;typeof i!="function"&&(i=wne(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],p=f.length,x=BCe(i.call(u,u&&u.__data__,c,n)),v=x.length,w=a[c]=new Array(v),S=o[c]=new Array(v),T=l[c]=new Array(p);t(u,f,w,S,T,x,e);for(var P=0,R=0,C,L;P<v;++P)if(C=w[P]){for(P>=R&&(R=P+1);!(L=S[R])&&++R<v;);C._next=L||null}}return o=new ns(o,n),o._enter=a,o._exit=l,o}function BCe(i){return typeof i=="object"&&"length"in i?i:Array.from(i)}function Tne(){return new ns(this._exit||this._groups.map(qR),this._parents)}function Ene(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 Mne(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,p=a[l]=new Array(f),x,v=0;v<f;++v)(x=c[v]||u[v])&&(p[v]=x);for(;l<r;++l)a[l]=t[l];return new ns(a,this._parents)}function Cne(){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 Rne(i){i||(i=UCe);function e(f,p){return f&&p?i(f.__data__,p.__data__):!f-!p}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 ns(r,this._parents).order()}function UCe(i,e){return i<e?-1:i>e?1:i>=e?0:NaN}function Pne(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function Ine(){return Array.from(this)}function Nne(){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 Lne(){let i=0;for(let e of this)++i;return i}function Dne(){return!this.node()}function Fne(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 kCe(i){return function(){this.removeAttribute(i)}}function GCe(i){return function(){this.removeAttributeNS(i.space,i.local)}}function zCe(i,e){return function(){this.setAttribute(i,e)}}function VCe(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function qCe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function HCe(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 One(i,e){var t=kR(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?GCe:kCe:typeof e=="function"?t.local?HCe:qCe:t.local?VCe:zCe)(t,e))}function HR(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function WCe(i){return function(){this.style.removeProperty(i)}}function jCe(i,e,t){return function(){this.style.setProperty(i,e,t)}}function XCe(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function Bne(i,e,t){return arguments.length>1?this.each((e==null?WCe:typeof e=="function"?XCe:jCe)(i,e,t??"")):$Ce(this.node(),i)}function $Ce(i,e){return i.style.getPropertyValue(e)||HR(i).getComputedStyle(i,null).getPropertyValue(e)}function YCe(i){return function(){delete this[i]}}function ZCe(i,e){return function(){this[i]=e}}function KCe(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function Une(i,e){return arguments.length>1?this.each((e==null?YCe:typeof e=="function"?KCe:ZCe)(i,e)):this.node()[i]}function kne(i){return i.trim().split(/^|\s+/)}function Ck(i){return i.classList||new Gne(i)}function Gne(i){this._node=i,this._names=kne(i.getAttribute("class")||"")}Gne.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 zne(i,e){for(var t=Ck(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function Vne(i,e){for(var t=Ck(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function QCe(i){return function(){zne(this,i)}}function JCe(i){return function(){Vne(this,i)}}function eRe(i,e){return function(){(e.apply(this,arguments)?zne:Vne)(this,i)}}function qne(i,e){var t=kne(i+"");if(arguments.length<2){for(var n=Ck(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?eRe:e?QCe:JCe)(t,e))}function tRe(){this.textContent=""}function nRe(i){return function(){this.textContent=i}}function iRe(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function Hne(i){return arguments.length?this.each(i==null?tRe:(typeof i=="function"?iRe:nRe)(i)):this.node().textContent}function rRe(){this.innerHTML=""}function sRe(i){return function(){this.innerHTML=i}}function oRe(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function Wne(i){return arguments.length?this.each(i==null?rRe:(typeof i=="function"?oRe:sRe)(i)):this.node().innerHTML}function aRe(){this.nextSibling&&this.parentNode.appendChild(this)}function jne(){return this.each(aRe)}function lRe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Xne(){return this.each(lRe)}function $ne(i){var e=typeof i=="function"?i:GR(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function cRe(){return null}function Yne(i,e){var t=typeof i=="function"?i:GR(i),n=e==null?cRe:typeof e=="function"?e:zR(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function uRe(){var i=this.parentNode;i&&i.removeChild(this)}function Zne(){return this.each(uRe)}function hRe(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function fRe(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function Kne(i){return this.select(i?fRe:hRe)}function Qne(i){return arguments.length?this.property("__data__",i):this.node().__data__}function dRe(i){return function(e){i.call(this,e,this.__data__)}}function pRe(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 ARe(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 mRe(i,e,t){return function(){var n=this.__on,r,s=dRe(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 Jne(i,e,t){var n=pRe(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?mRe:ARe,r=0;r<s;++r)this.each(a(n[r],e,t));return this}function eie(i,e,t){var n=HR(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 gRe(i,e){return function(){return eie(this,i,e)}}function _Re(i,e){return function(){return eie(this,i,e.apply(this,arguments))}}function tie(i,e){return this.each((typeof e=="function"?_Re:gRe)(i,e))}function*nie(){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 Rk=[null];function ns(i,e){this._groups=i,this._parents=e}function xRe(){return new ns([[document.documentElement]],Rk)}function yRe(){return this}ns.prototype=xRe.prototype={constructor:ns,select:Ane,selectAll:gne,selectChild:xne,selectChildren:yne,filter:vne,data:Sne,enter:bne,exit:Tne,join:Ene,merge:Mne,selection:yRe,order:Cne,sort:Rne,call:Pne,nodes:Ine,node:Nne,size:Lne,empty:Dne,each:Fne,attr:One,style:Bne,property:Une,classed:qne,text:Hne,html:Wne,raise:jne,lower:Xne,append:$ne,insert:Yne,remove:Zne,clone:Kne,datum:Qne,on:Jne,dispatch:tie,[Symbol.iterator]:nie};function Pk(i){return typeof i=="string"?new ns([[document.querySelector(i)]],[document.documentElement]):new ns([[i]],Rk)}function iie(i){let e;for(;e=i.sourceEvent;)i=e;return i}function Ik(i,e){if(i=iie(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 kb,Er,lie,Fk,C0,rie,cie,uie,Nk,jR,Bb,hie,Ok,Lk,Dk,vRe,$R={},YR=[],bRe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,KR=Array.isArray;function jh(i,e){for(var t in e)i[t]=e[t];return i}function Bk(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function wRe(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?kb.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 Ub(i,o,n,r,null)}function Ub(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??++lie,__i:-1,__u:0};return r==null&&Er.vnode!=null&&Er.vnode(s),s}function QR(i){return i.children}function XR(i,e){this.props=i,this.context=e}function Jm(i,e){if(e==null)return i.__?Jm(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"?Jm(i):null}function SRe(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=jh({},e);s.__v=e.__v+1,Er.vnode&&Er.vnode(s),Uk(i.__P,s,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,n,t??Jm(e),!!(32&e.__u),r),s.__v=e.__v,s.__.__k[s.__i]=s,mie(n,s,r),e.__e=e.__=null,s.__e!=t&&fie(s)}}function fie(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}),fie(i)}function sie(i){(!i.__d&&(i.__d=!0)&&C0.push(i)&&!ZR.__r++||rie!=Er.debounceRendering)&&((rie=Er.debounceRendering)||cie)(ZR)}function ZR(){try{for(var i,e=1;C0.length;)C0.length>e&&C0.sort(uie),i=C0.shift(),e=C0.length,SRe(i)}finally{C0.length=ZR.__r=0}}function die(i,e,t,n,r,s,o,a,l,c,u){var f,p,x,v,w,S,T=n&&n.__k||YR,P=e.length;for(l=TRe(t,e,T,l,P),f=0;f<P;f++)(x=t.__k[f])!=null&&(p=x.__i!=-1&&T[x.__i]||$R,x.__i=f,S=Uk(i,x,p,r,s,o,a,l,c,u),v=x.__e,x.ref&&p.ref!=x.ref&&(p.ref&&kk(p.ref,null,x),u.push(x.ref,x.__c||v,x)),w==null&&v!=null&&(w=v),4&x.__u?(l=pie(x,l,i),p.__e&&(p.__e=null)):typeof x.type=="function"&&S!==void 0?l=S:v&&(l=v.nextSibling),x.__u&=-7);return t.__e=w,l}function TRe(i,e,t,n,r){var s,o,a,l,c,u=t.length,f=u,p=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]=Ub(null,o,null,null,null):KR(o)?o=i.__k[s]=Ub(QR,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[s]=Ub(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):i.__k[s]=o,l=s+p,o.__=i,o.__b=i.__b+1,a=null,(c=o.__i=ERe(o,t,l,f))!=-1&&(f--,(a=t[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(r>u?p--:r<u&&p++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?p--:c==l+1?p++:(c>l?p--:p++,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=Jm(a)),_ie(a,a));return n}function pie(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=pie(n[r],e,t));return e}i.__e!=e&&(e&&i.type&&!e.parentNode&&(e=Jm(i)),e=t.insertBefore(i.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function ERe(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 oie(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||bRe.test(e)?t:t+"px"}function WR(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||oie(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||oie(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(hie,"$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[Bb]=n[Bb]:(t[Bb]=Ok,i.addEventListener(e,s?Dk:Lk,s)):i.removeEventListener(e,s?Dk:Lk,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 aie(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[jR]==null)e[jR]=Ok++;else if(e[jR]<t[Bb])return;return t(Er.event?Er.event(e):e)}}}function Uk(i,e,t,n,r,s,o,a,l,c){var u,f,p,x,v,w,S,T,P,R,C,L,D,F,N,B,z=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),s=[a=e.__e=t.__e]),(u=Er.__b)&&u(e);e:if(typeof z=="function"){f=o.length;try{if(P=e.props,R=z.prototype&&z.prototype.render,C=(u=z.contextType)&&n[u.__c],L=u?C?C.props.value:u.__:n,t.__c?T=(p=e.__c=t.__c).__=p.__E:(R?e.__c=p=new z(P,L):(e.__c=p=new XR(P,L),p.constructor=z,p.render=CRe),C&&C.sub(p),p.state||(p.state={}),p.__n=n,x=p.__d=!0,p.__h=[],p._sb=[]),R&&p.__s==null&&(p.__s=p.state),R&&z.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=jh({},p.__s)),jh(p.__s,z.getDerivedStateFromProps(P,p.__s))),v=p.props,w=p.state,p.__v=e,x)R&&z.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),R&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(R&&z.getDerivedStateFromProps==null&&P!==v&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(P,L),e.__v==t.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(P,p.__s,L)===!1){e.__v!=t.__v&&(p.props=P,p.state=p.__s,p.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(V){V&&(V.__=e)}),YR.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&o.push(p),a=Jm(t);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(P,p.__s,L),R&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(v,w,S)})}if(p.context=L,p.props=P,p.__P=i,p.__e=!1,D=Er.__r,F=0,R)p.state=p.__s,p.__d=!1,D&&D(e),u=p.render(p.props,p.state,p.context),YR.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,D&&D(e),u=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++F<25);p.state=p.__s,p.getChildContext!=null&&(n=jh(jh({},n),p.getChildContext())),R&&!x&&p.getSnapshotBeforeUpdate!=null&&(S=p.getSnapshotBeforeUpdate(v,w)),N=u!=null&&u.type===QR&&u.key==null?gie(u.props.children):u,a=die(i,KR(N)?N:[N],e,t,n,r,s,o,a,l,c),p.base=e.__e,e.__u&=-161,p.__h.length&&o.push(p),T&&(p.__E=p.__=null)}catch(V){if(o.length=f,e.__v=null,l||s!=null){if(V.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--;)Bk(s[B])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),V.then||Aie(e),Er.__e(V,e,t)}}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=MRe(t.__e,e,t,n,r,s,o,l,c);return(u=Er.diffed)&&u(e),128&e.__u?void 0:a}function Aie(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(Aie))}function mie(i,e,t){for(var n=0;n<t.length;n++)kk(t[n],t[++n],t[++n]);Er.__c&&Er.__c(e,i),i.some(function(r){try{i=r.__h,r.__h=[],i.some(function(s){s.call(r)})}catch(s){Er.__e(s,r.__v)}})}function gie(i){return typeof i!="object"||i==null||i.__b>0?i:KR(i)?i.map(gie):i.constructor!==void 0?null:jh({},i)}function MRe(i,e,t,n,r,s,o,a,l){var c,u,f,p,x,v,w,S=t.props||$R,T=e.props,P=e.type;if(P=="svg"?r="http://www.w3.org/2000/svg":P=="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((x=s[c])&&"setAttribute"in x==!!P&&(P?x.localName==P:x.nodeType==3)){i=x,s[c]=null;break}}if(i==null){if(P==null)return document.createTextNode(T);i=document.createElementNS(r,P,T.is&&T),a&&(Er.__m&&Er.__m(e,s),a=!1),s=null}if(P==null)S===T||a&&i.data==T||(i.data=T);else{if(s=P=="textarea"&&T.defaultValue!=null?null:s&&kb.call(i.childNodes),!a&&s!=null)for(S={},c=0;c<i.attributes.length;c++)S[(x=i.attributes[c]).name]=x.value;for(c in S)x=S[c],c=="dangerouslySetInnerHTML"?f=x:c=="children"||c in T||c=="value"&&"defaultValue"in T||c=="checked"&&"defaultChecked"in T||WR(i,c,null,x,r);for(c in T)x=T[c],c=="children"?p=x:c=="dangerouslySetInnerHTML"?u=x:c=="value"?v=x:c=="checked"?w=x:a&&typeof x!="function"||S[c]===x||WR(i,c,x,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=""),die(e.type=="template"?i.content:i,KR(p)?p:[p],e,t,n,P=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:t.__k&&Jm(t,0),a,l),s!=null)for(c=s.length;c--;)Bk(s[c]);a&&P!="textarea"||(c="value",P=="progress"&&v==null?i.removeAttribute("value"):v!=null&&(v!==i[c]||P=="progress"&&!v||P=="option"&&v!=S[c])&&WR(i,c,v,S[c],r),c="checked",w!=null&&w!=i[c]&&WR(i,c,w,S[c],r))}return i}function kk(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){Er.__e(r,t)}}function _ie(i,e,t){var n,r;if(Er.unmount&&Er.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||kk(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){Er.__e(s,e)}n.base=n.__P=n.__n=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&_ie(n[r],e,t||typeof i.type!="function");t||Bk(i.__e),i.__c=i.__=i.__e=void 0}function CRe(i,e,t){return this.constructor(i,t)}function xie(i,e,t){var n,r,s,o;e==document&&(e=document.documentElement),Er.__&&Er.__(i,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,s=[],o=[],Uk(e,i=(!n&&t||e).__k=wRe(QR,null,[i]),r||$R,$R,e.namespaceURI,!n&&t?[t]:r?null:e.firstChild?kb.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n,o),mie(s,i,o),i.props.children=null}function Gk(i,e,t){var n,r,s,o,a=jh({},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?kb.call(arguments,2):t),Ub(i.type,a,n||i.key,r||i.ref,null)}kb=YR.slice,Er={__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}},lie=0,Fk=function(i){return i!=null&&i.constructor===void 0},XR.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=jh({},this.state),typeof i=="function"&&(i=i(jh({},t),this.props)),i&&jh(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),sie(this))},XR.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),sie(this))},XR.prototype.render=QR,C0=[],cie=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,uie=function(i,e){return i.__v.__b-e.__v.__b},ZR.__r=0,Nk=Math.random().toString(8),jR="__d"+Nk,Bb="__a"+Nk,hie=/(PointerCapture)$|Capture$/i,Ok=0,Lk=aie(!1),Dk=aie(!0),vRe=0;function yie(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 RRe(i){if(Array.isArray(i))return i}function PRe(i,e,t){return(e=ORe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function IRe(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 NRe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5258+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vie(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 LRe(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vie(Object(t),!0).forEach(function(n){PRe(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):vie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function DRe(i,e){return RRe(i)||IRe(i,e)||BRe(i,e)||NRe()}function FRe(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 ORe(i){var e=FRe(i,"string");return typeof e=="symbol"?e:e+""}function JR(i){"@babel/helpers - typeof";return JR=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},JR(i)}function BRe(i,e){if(i){if(typeof i=="string")return yie(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)?yie(i,e):void 0}}var zk=function(e){if(JR(e)!=="object")return e;var t=Gk(e);if(t.props){var n;t.props=LRe({},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(zk):zk(t.props.children))}return t},URe=function(e){return Fk(Gk(e))},kRe=function(e,t){delete t.__k,xie(zk(e),t)};function GRe(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 zRe=`.float-tooltip-kap {52595259 position: absolute;52605260 width: max-content; /* prevent shrinking near right edge */52615261 max-width: max(50%, 150px);
@@ -5266,7 +5266,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52665266 background: rgba(0,0,0,0.6);52675267 pointer-events: none;52685268 }5269-`;URe(kRe);var yie=Fr({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&&KR(e)==="object"&&!!e.node&&typeof e.node=="function",a=wk(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=NRe(c,2),f=u[0],p=u[1];return t.tooltipEl.style(f,p)}),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=Sk(c),f=a.node(),p=f.offsetWidth,x=f.offsetHeight,v=[t.offsetX===null||t.offsetX===void 0?"-".concat(u[0]/p*100,"%"):typeof t.offsetX=="number"?"calc(-50% + ".concat(t.offsetX,"px)"):t.offsetX,t.offsetY===null||t.offsetY===void 0?x>130&&x-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(v.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):ORe(e.content)?(e.tooltipEl.text(""),BRe(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 GRe(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 zRe=`.scene-nav-info {5269+`;GRe(zRe);var bie=Fr({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&&JR(e)==="object"&&!!e.node&&typeof e.node=="function",a=Pk(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=DRe(c,2),f=u[0],p=u[1];return t.tooltipEl.style(f,p)}),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=Ik(c),f=a.node(),p=f.offsetWidth,x=f.offsetHeight,v=[t.offsetX===null||t.offsetX===void 0?"-".concat(u[0]/p*100,"%"):typeof t.offsetX=="number"?"calc(-50% + ".concat(t.offsetX,"px)"):t.offsetX,t.offsetY===null||t.offsetY===void 0?x>130&&x-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(v.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):URe(e.content)?(e.tooltipEl.text(""),kRe(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 VRe(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 qRe=`.scene-nav-info {52705270 position: absolute;52715271 bottom: 5px;52725272 width: 100%;
@@ -5281,9 +5281,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
52815281 52825282 .scene-container canvas:focus {52835283 outline: none;5284-}`;GRe(zRe);function Fk(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 VRe(i){if(Array.isArray(i))return i}function qRe(i){if(Array.isArray(i))return Fk(i)}function HRe(i,e,t){return(e=KRe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function WRe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function jRe(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 XRe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5285-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $Re(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5286-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function YRe(i,e){return VRe(i)||jRe(i,e)||vie(i,e)||XRe()}function Qm(i){return qRe(i)||WRe(i)||vie(i)||$Re()}function ZRe(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 KRe(i){var e=ZRe(i,"string");return typeof e=="symbol"?e:e+""}function vie(i,e){if(i){if(typeof i=="string")return Fk(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)?Fk(i,e):void 0}}var bie=function(e){e instanceof Array?e.forEach(bie):(e.map&&e.map.dispose(),e.dispose())},wie=function(e){e.geometry&&e.geometry.dispose(),e.material&&bie(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(wie)},QRe=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),wie(t)}},Er=window.THREE?window.THREE:{WebGLRenderer:a3,Scene:Qd,PerspectiveCamera:Ir,Raycaster:Ky,SRGBColorSpace:yr,TextureLoader:xl,Vector2:Oe,Vector3:ie,Box3:da,Color:Ut,Mesh:Gn,SphereGeometry:Aa,MeshBasicMaterial:as,BackSide:ui,Timer:DA},Ok=Fr({props:{width:{default:window.innerWidth,onChange:function(e,t,n){isNaN(e)&&(t.width=n)}},height:{default:window.innerHeight,onChange:function(e,t,n){isNaN(e)&&(t.height=n)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(e,t){t.hoverObj=null,t.tooltip&&t.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(e){if(e.initialised){e.controls.enabled&&e.controls.update&&e.controls.update(Math.min(1,e.timer.update().getDelta())),e.postProcessingComposer?e.postProcessingComposer.render():e.renderer.render(e.scene,e.camera),e.extraRenderers.forEach(function(o){return o.render(e.scene,e.camera)});var t=+new Date;if(e.enablePointerInteraction&&t-e.lastRaycasterCheck>=e.pointerRaycasterThrottleMs){e.lastRaycasterCheck=t;var n=null;if(e.hoverDuringDrag||!e.isPointerDragging){var r=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&r.sort(function(o,a){return e.hoverOrderComparator(o.object,a.object)});var s=r.find(function(o){return e.hoverFilter(o.object)})||null;n=s?s.object:null,e.intersection=s||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&rt(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos,n=t.x,r=t.y;return{x:n,y:r}},cameraPosition:function(e,t,n,r){var s=e.camera;if(t&&e.initialised){var o,a,l=t,c=n||{x:0,y:0,z:0};if((o=e.povPosTween)===null||o===void 0||o.end(),(a=e.povTgtTween)===null||a===void 0||a.end(),!r)p(l),x(c);else{var u=Object.assign({},s.position),f=v();e.tweenGroup.add(e.povPosTween=new Hs(u).to(l,r).easing(Or.Quadratic.Out).onUpdate(p).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new Hs(f).to(c,r/3).easing(Or.Quadratic.Out).onUpdate(x).onComplete(function(){e.povTgtTween=void 0,e.tweenGroup.remove(this)}).start())}return this}return Object.assign({},s.position,{lookAt:v()});function p(w){var S=w.x,T=w.y,P=w.z;S!==void 0&&(s.position.x=S),T!==void 0&&(s.position.y=T),P!==void 0&&(s.position.z=P)}function x(w){var S=new Er.Vector3(w.x,w.y,w.z);e.controls.enabled&&e.controls.target?e.controls.target=S:s.lookAt(S)}function v(){return Object.assign(new Er.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 Er.Vector3(0,0,0),a=Math.max.apply(Math,Qm(Object.entries(t).map(function(x){var v=YRe(x,2),w=v[0],S=v[1];return Math.max.apply(Math,Qm(S.map(function(T){return Math.abs(o[w]-T)})))})))*2,l=(1-r*2/e.height)*s.fov,c=a/Math.atan(l*Math.PI/180),u=c/s.aspect,f=Math.max(c,u);if(f>0){var p=o.clone().sub(s.position).normalize().multiplyScalar(-f);this.cameraPosition(p,o,n)}}return this},getBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},n=new Er.Box3(new Er.Vector3(0,0,0),new Er.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,Qm(["x","y","z"].map(function(s){return HRe({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new Er.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 Er.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new Er.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new Er.Vector3))},intersectingObjects:function(e,t,n){var r=new Er.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new Er.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;QRe(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 Er.Scene,camera:new Er.PerspectiveCamera,timer:new Er.Timer,tweenGroup:new ZA,lastRaycasterCheck:0}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.controlType,s=r===void 0?"trackball":r,o=n.useWebGPU,a=o===void 0?!1:o,l=n.rendererConfig,c=l===void 0?{}:l,u=n.extraRenderers,f=u===void 0?[]:u,p=n.waitForLoadComplete,x=p===void 0?!0:p;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[s]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.tooltip=new yie(t.container),t.pointerPos=new Er.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(v){return t.container.addEventListener(v,function(w){if(v==="pointerdown"&&(t.isPointerPressed=!0),!t.isPointerDragging&&w.type==="pointermove"&&(w.pressure>0||t.isPointerPressed)&&(w.pointerType==="mouse"||w.movementX===void 0||[w.movementX,w.movementY].some(function(P){return Math.abs(P)>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(P){var R=P.getBoundingClientRect(),C=window.pageXOffset||document.documentElement.scrollLeft,L=window.pageYOffset||document.documentElement.scrollTop;return{top:R.top+L,left:R.left+C}}},{passive:!0})}),t.container.addEventListener("pointerup",function(v){t.isPointerPressed&&(t.isPointerPressed=!1,!(t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag))&&requestAnimationFrame(function(){v.button===0&&t.onClick(t.hoverObj||null,v,t.intersection),v.button===2&&t.onRightClick&&t.onRightClick(t.hoverObj||null,v,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(v){t.onRightClick&&v.preventDefault()}),t.renderer=new(a?k1:Er.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},c)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=f,t.extraRenderers.forEach(function(v){v.domElement.style.position="absolute",v.domElement.style.top="0px",v.domElement.style.pointerEvents="none",t.container.appendChild(v.domElement)}),t.postProcessingComposer=new PR(t.renderer),t.postProcessingComposer.addPass(new IR(t.scene,t.camera)),t.controls=new{trackball:wR,orbit:TR,fly:ER}[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(Qm(t.extraRenderers)).forEach(function(v){return v.setSize(t.width,t.height)}),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new Er.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!x,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))){var n,r=e.width,s=e.height;e.container.style.width="".concat(r,"px"),e.container.style.height="".concat(s,"px"),[e.renderer,e.postProcessingComposer].concat(Qm(e.extraRenderers)).forEach(function(x){return x.setSize(r,s)}),e.camera.aspect=r/s;var o=e.viewOffset.slice(0,2);o.some(function(x){return x})&&(n=e.camera).setViewOffset.apply(n,[r,s].concat(Qm(o),[r,s])),e.camera.updateProjectionMatrix()}if(t.hasOwnProperty("viewOffset")){var a,l=e.width,c=e.height,u=e.viewOffset.slice(0,2);u.some(function(x){return x})?(a=e.camera).setViewOffset.apply(a,[l,c].concat(Qm(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 Er.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=S0(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Er.Color(fne(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new Er.TextureLoader().load(e.backgroundImageUrl,function(x){x.colorSpace=Er.SRGBColorSpace,e.skysphere.material=new Er.MeshBasicMaterial({map:x,side:Er.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&p()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&p())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(x){return e.scene.remove(x)}),e.lights.forEach(function(x){return e.scene.add(x)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(x){return e.scene.remove(x)}),e.objects.forEach(function(x){return e.scene.add(x)}));function p(){e.loadComplete=e.scene.visible=!0}}});function JRe(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 e4e=`.scene-container .clickable {5284+}`;VRe(qRe);function Vk(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 HRe(i){if(Array.isArray(i))return i}function WRe(i){if(Array.isArray(i))return Vk(i)}function jRe(i,e,t){return(e=JRe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function XRe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function $Re(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 YRe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.5285+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZRe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5286+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function KRe(i,e){return HRe(i)||$Re(i,e)||wie(i,e)||YRe()}function eg(i){return WRe(i)||XRe(i)||wie(i)||ZRe()}function QRe(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 JRe(i){var e=QRe(i,"string");return typeof e=="symbol"?e:e+""}function wie(i,e){if(i){if(typeof i=="string")return Vk(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)?Vk(i,e):void 0}}var Sie=function(e){e instanceof Array?e.forEach(Sie):(e.map&&e.map.dispose(),e.dispose())},Tie=function(e){e.geometry&&e.geometry.dispose(),e.material&&Sie(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(Tie)},e4e=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),Tie(t)}},Mr=window.THREE?window.THREE:{WebGLRenderer:c3,Scene:Jd,PerspectiveCamera:Nr,Raycaster:Jy,SRGBColorSpace:yr,TextureLoader:ja,Vector2:Oe,Vector3:ie,Box3:da,Color:Ut,Mesh:Gn,SphereGeometry:Aa,MeshBasicMaterial:as,BackSide:hi,Timer:OA},qk=Fr({props:{width:{default:window.innerWidth,onChange:function(e,t,n){isNaN(e)&&(t.width=n)}},height:{default:window.innerHeight,onChange:function(e,t,n){isNaN(e)&&(t.height=n)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(e,t){t.hoverObj=null,t.tooltip&&t.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(e){if(e.initialised){e.controls.enabled&&e.controls.update&&e.controls.update(Math.min(1,e.timer.update().getDelta())),e.postProcessingComposer?e.postProcessingComposer.render():e.renderer.render(e.scene,e.camera),e.extraRenderers.forEach(function(o){return o.render(e.scene,e.camera)});var t=+new Date;if(e.enablePointerInteraction&&t-e.lastRaycasterCheck>=e.pointerRaycasterThrottleMs){e.lastRaycasterCheck=t;var n=null;if(e.hoverDuringDrag||!e.isPointerDragging){var r=this.intersectingObjects(e.pointerPos.x,e.pointerPos.y);e.hoverOrderComparator&&r.sort(function(o,a){return e.hoverOrderComparator(o.object,a.object)});var s=r.find(function(o){return e.hoverFilter(o.object)})||null;n=s?s.object:null,e.intersection=s||null}n!==e.hoverObj&&(e.onHover(n,e.hoverObj,e.intersection),e.tooltip.content(n&&rt(e.tooltipContent)(n,e.intersection)||null),e.hoverObj=n)}e.tweenGroup.update()}return this},getPointerPos:function(e){var t=e.pointerPos,n=t.x,r=t.y;return{x:n,y:r}},cameraPosition:function(e,t,n,r){var s=e.camera;if(t&&e.initialised){var o,a,l=t,c=n||{x:0,y:0,z:0};if((o=e.povPosTween)===null||o===void 0||o.end(),(a=e.povTgtTween)===null||a===void 0||a.end(),!r)p(l),x(c);else{var u=Object.assign({},s.position),f=v();e.tweenGroup.add(e.povPosTween=new Hs(u).to(l,r).easing(Or.Quadratic.Out).onUpdate(p).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new Hs(f).to(c,r/3).easing(Or.Quadratic.Out).onUpdate(x).onComplete(function(){e.povTgtTween=void 0,e.tweenGroup.remove(this)}).start())}return this}return Object.assign({},s.position,{lookAt:v()});function p(w){var S=w.x,T=w.y,P=w.z;S!==void 0&&(s.position.x=S),T!==void 0&&(s.position.y=T),P!==void 0&&(s.position.z=P)}function x(w){var S=new Mr.Vector3(w.x,w.y,w.z);e.controls.enabled&&e.controls.target?e.controls.target=S:s.lookAt(S)}function v(){return Object.assign(new Mr.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 Mr.Vector3(0,0,0),a=Math.max.apply(Math,eg(Object.entries(t).map(function(x){var v=KRe(x,2),w=v[0],S=v[1];return Math.max.apply(Math,eg(S.map(function(T){return Math.abs(o[w]-T)})))})))*2,l=(1-r*2/e.height)*s.fov,c=a/Math.atan(l*Math.PI/180),u=c/s.aspect,f=Math.max(c,u);if(f>0){var p=o.clone().sub(s.position).normalize().multiplyScalar(-f);this.cameraPosition(p,o,n)}}return this},getBbox:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},n=new Mr.Box3(new Mr.Vector3(0,0,0),new Mr.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,eg(["x","y","z"].map(function(s){return jRe({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new Mr.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 Mr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new Mr.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new Mr.Vector3))},intersectingObjects:function(e,t,n){var r=new Mr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new Mr.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;e4e(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 Mr.Scene,camera:new Mr.PerspectiveCamera,timer:new Mr.Timer,tweenGroup:new QA,lastRaycasterCheck:0}},init:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.controlType,s=r===void 0?"trackball":r,o=n.useWebGPU,a=o===void 0?!1:o,l=n.rendererConfig,c=l===void 0?{}:l,u=n.extraRenderers,f=u===void 0?[]:u,p=n.waitForLoadComplete,x=p===void 0?!0:p;e.innerHTML="",e.appendChild(t.container=document.createElement("div")),t.container.className="scene-container",t.container.style.position="relative",t.container.appendChild(t.navInfo=document.createElement("div")),t.navInfo.className="scene-nav-info",t.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[s]||"",t.navInfo.style.display=t.showNavInfo?null:"none",t.tooltip=new bie(t.container),t.pointerPos=new Mr.Vector2,t.pointerPos.x=-2,t.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(v){return t.container.addEventListener(v,function(w){if(v==="pointerdown"&&(t.isPointerPressed=!0),!t.isPointerDragging&&w.type==="pointermove"&&(w.pressure>0||t.isPointerPressed)&&(w.pointerType==="mouse"||w.movementX===void 0||[w.movementX,w.movementY].some(function(P){return Math.abs(P)>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(P){var R=P.getBoundingClientRect(),C=window.pageXOffset||document.documentElement.scrollLeft,L=window.pageYOffset||document.documentElement.scrollTop;return{top:R.top+L,left:R.left+C}}},{passive:!0})}),t.container.addEventListener("pointerup",function(v){t.isPointerPressed&&(t.isPointerPressed=!1,!(t.isPointerDragging&&(t.isPointerDragging=!1,!t.clickAfterDrag))&&requestAnimationFrame(function(){v.button===0&&t.onClick(t.hoverObj||null,v,t.intersection),v.button===2&&t.onRightClick&&t.onRightClick(t.hoverObj||null,v,t.intersection)}))},{passive:!0,capture:!0}),t.container.addEventListener("contextmenu",function(v){t.onRightClick&&v.preventDefault()}),t.renderer=new(a?G1:Mr.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},c)),t.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),t.container.appendChild(t.renderer.domElement),t.extraRenderers=f,t.extraRenderers.forEach(function(v){v.domElement.style.position="absolute",v.domElement.style.top="0px",v.domElement.style.pointerEvents="none",t.container.appendChild(v.domElement)}),t.postProcessingComposer=new NR(t.renderer),t.postProcessingComposer.addPass(new LR(t.scene,t.camera)),t.controls=new{trackball:TR,orbit:MR,fly:CR}[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(eg(t.extraRenderers)).forEach(function(v){return v.setSize(t.width,t.height)}),t.camera.aspect=t.width/t.height,t.camera.updateProjectionMatrix(),t.camera.position.z=1e3,t.scene.add(t.skysphere=new Mr.Mesh),t.skysphere.visible=!1,t.loadComplete=t.scene.visible=!x,window.scene=t.scene},update:function(e,t){if(e.width&&e.height&&(t.hasOwnProperty("width")||t.hasOwnProperty("height"))){var n,r=e.width,s=e.height;e.container.style.width="".concat(r,"px"),e.container.style.height="".concat(s,"px"),[e.renderer,e.postProcessingComposer].concat(eg(e.extraRenderers)).forEach(function(x){return x.setSize(r,s)}),e.camera.aspect=r/s;var o=e.viewOffset.slice(0,2);o.some(function(x){return x})&&(n=e.camera).setViewOffset.apply(n,[r,s].concat(eg(o),[r,s])),e.camera.updateProjectionMatrix()}if(t.hasOwnProperty("viewOffset")){var a,l=e.width,c=e.height,u=e.viewOffset.slice(0,2);u.some(function(x){return x})?(a=e.camera).setViewOffset.apply(a,[l,c].concat(eg(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 Mr.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=T0(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Mr.Color(pne(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new Mr.TextureLoader().load(e.backgroundImageUrl,function(x){x.colorSpace=Mr.SRGBColorSpace,e.skysphere.material=new Mr.MeshBasicMaterial({map:x,side:Mr.BackSide}),e.skysphere.visible=!0,e.onBackgroundImageLoaded&&setTimeout(e.onBackgroundImageLoaded),!e.loadComplete&&p()}):(e.skysphere.visible=!1,e.skysphere.material.map=null,!e.loadComplete&&p())),t.hasOwnProperty("showNavInfo")&&(e.navInfo.style.display=e.showNavInfo?null:"none"),t.hasOwnProperty("lights")&&((t.lights||[]).forEach(function(x){return e.scene.remove(x)}),e.lights.forEach(function(x){return e.scene.add(x)})),t.hasOwnProperty("objects")&&((t.objects||[]).forEach(function(x){return e.scene.remove(x)}),e.objects.forEach(function(x){return e.scene.add(x)}));function p(){e.loadComplete=e.scene.visible=!0}}});function t4e(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 n4e=`.scene-container .clickable {52875287 cursor: pointer;5288-}`;JRe(e4e);function Bk(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 t4e(i){if(Array.isArray(i))return Bk(i)}function kb(i,e,t){return(e=a4e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function n4e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function i4e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5289-In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sie(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 Jm(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sie(Object(t),!0).forEach(function(n){kb(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Sie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function r4e(i,e){if(i==null)return{};var t,n,r=s4e(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 s4e(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 QR(i){return t4e(i)||n4e(i)||l4e(i)||i4e()}function o4e(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function a4e(i){var e=o4e(i,"string");return typeof e=="symbol"?e:e+""}function l4e(i,e){if(i){if(typeof i=="string")return Bk(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)?Bk(i,e):void 0}}function Tie(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 c4e=["rendererConfig","waitForGlobeReady"],Ub=Jm(Jm({},window.THREE?window.THREE:{AmbientLight:LA,DirectionalLight:NA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:h3}),Eie=Tie("globe",rk),u4e=Object.assign.apply(Object,QR(["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 kb({},i,Eie.linkProp(i))}))),h4e=Object.assign.apply(Object,QR(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return kb({},i,Eie.linkMethod(i))}))),Mie=Tie("renderObjs",Ok),f4e=Object.assign.apply(Object,QR(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return kb({},i,Mie.linkProp(i))}))),d4e=Object.assign.apply(Object,QR(["lights","postProcessingComposer"].map(function(i){return kb({},i,Mie.linkMethod(i))}))),Cie=Fr({props:Jm(Jm({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}))}}},u4e),f4e),methods:Jm(Jm({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 Hs(r).to(o,n).easing(Or.Cubic.InOut).onUpdate(l).onComplete(function(){e.povTween=void 0,e.tweenGroup.remove(this)}).start())}return this;function a(){return e.globe.toGeoCoords(e.renderObjs.cameraPosition())}function l(c){var u=c.lat,f=c.lng,p=c.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(u,f,p)),e.globe.setPointOfView(e.renderObjs.camera())}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var o=(t=e.globe).getCoords.apply(t,r);return e.renderObjs.getScreenCoords(o.x,o.y,o.z)},toGlobeCoords:function(e,t,n){var r=e.renderObjs.intersectingObjects(t,n).find(function(l){return(l.object.__globeObjType||l.object.parent.__globeObjType)==="globe"});if(!r)return null;var s=e.globe.toGeoCoords(r.point),o=s.lat,a=s.lng;return{lat:o,lng:a}},scene:function(e){return e.renderObjs.scene()},camera:function(e){return e.renderObjs.camera()},renderer:function(e){return e.renderObjs.renderer()},controls:function(e){return e.renderObjs.controls()},_destructor:function(e){this.pauseAnimation(),this.pointsData([]),this.arcsData([]),this.polygonsData([]),this.pathsData([]),this.heatmapsData([]),this.hexBinPointsData([]),this.hexPolygonsData([]),this.tilesData([]),this.particlesData([]),this.labelsData([]),this.htmlElementsData([]),this.objectsData([]),this.customLayerData([]),e.globe._destructor(),e.renderObjs._destructor()}},h4e),d4e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=r4e(e,c4e),o=new rk(Jm({waitForGlobeReady:r},s));return{globe:o,renderObjs:Ok({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new Ub.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new Ub.AmbientLight(13421772,Math.PI),new Ub.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new ZA}},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 Ub.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}};Ub.REVISION<155&&(t.renderObjs.renderer().useLegacyLights=!1),t.renderObjs.hoverFilter(function(c){var u=a(c);if(!u)return!1;var f=u.__globeObjType;if(f!=="globe"&&!l.hasOwnProperty(f))return!1;var p=l.hasOwnProperty(f)&&u.__data?l[f](u.__data):null;return["points","hexBinPoints"].some(function(x){return x===f})&&Array.isArray(p)?!1:t.pointerEventsFilter(u,p)}).tooltipContent(function(c,u){var f={point:t.pointLabel,arc:t.arcLabel,polygon:t.polygonLabel,path:t.pathLabel,hexbin:t.hexLabel,hexPolygon:t.hexPolygonLabel,tile:t.tileLabel,particles:t.particleLabel,label:t.labelLabel,object:t.objectLabel,custom:t.customLayerLabel},p=a(c),x=p&&p.__globeObjType;return p&&x&&f.hasOwnProperty(x)&&l.hasOwnProperty(x)&&rt(f[x])(l[x](p.__data,u))||""}).onHover(function(c,u,f){var p={point:t.onPointHover,arc:t.onArcHover,polygon:t.onPolygonHover,path:t.onPathHover,heatmap:t.onHeatmapHover,hexbin:t.onHexHover,hexPolygon:t.onHexPolygonHover,tile:t.onTileHover,particles:t.onParticleHover,label:t.onLabelHover,object:t.onObjectHover,custom:t.onCustomLayerHover},x={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},v=a(c);if(v&&!p.hasOwnProperty(v.__globeObjType)&&(v=null),v!==t.hoverObj){var w,S=t.hoverObj?t.hoverObj.__globeObjType:null,T=t.hoverData,P=v?v.__globeObjType:null,R=(w=v)!==null&&w!==void 0&&w.__data?l[P](v.__data,f):null;S&&S!==P&&p[S]&&p[S](null,T||null),P&&p[P]&&p[P](R,S===P?T:null),t.renderObjs.renderer().domElement.classList[P&&x[P]&&rt(t.showPointerCursor)(P,R)?"add":"remove"]("clickable"),t.hoverObj=v,t.hoverData=R}}).onClick(function(c,u,f){if(c){var p={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},x=a(c),v=x.__globeObjType;if(x&&p.hasOwnProperty(v)&&p[v]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(v==="globe"){var T=n.toGeoCoords(S),P=T.lat,R=T.lng;w.unshift({lat:P,lng:R})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}).onRightClick(function(c,u,f){if(c){var p={globe:t.onGlobeRightClick,point:t.onPointRightClick,arc:t.onArcRightClick,polygon:t.onPolygonRightClick,path:t.onPathRightClick,heatmap:t.onHeatmapRightClick,hexbin:t.onHexRightClick,hexPolygon:t.onHexPolygonRightClick,tile:t.onTileRightClick,particles:t.onParticleRightClick,label:t.onLabelRightClick,object:t.onObjectRightClick,custom:t.onCustomLayerRightClick},x=a(c),v=x.__globeObjType;if(x&&p.hasOwnProperty(v)&&p[v]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(v==="globe"){var T=n.toGeoCoords(S),P=T.lat,R=T.lng;w.unshift({lat:P,lng:R})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}),this._animationCycle()}});var Nie=4,kk=100,Vk=kk+.2,ad=8,p4e=96,Lie=.045,Die=.08;function qk(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 Ai=null,JR="",Ps={group:null,tiles:new Map,key:"",variant:""},Ul={group:null,prefix:null},Gk=null,t4=new Map,Hk=new Map,Rie=new Map;function Fie(){let i=Hz(U.map)==="sphere"&&rf(U.map)!==null;we.globeToggle.hidden=!i,Bie(),!i&&Ai&&(Gb(),Ps.group=null,Ul.group=null,Ul.prefix=null,Ai._destructor(),Ai=null,JR="",Gk=null,we.globe.replaceChildren())}function Wk(){U.globeActive?Bie():Gie()}var zb=2.5,e4=2,Vb=.08,n4=4;function A4e(i){let e=Number.isFinite(i)?i:e4;return Os(zb/2**(e-e4),Vb,n4)}function Oie(i){let e=Number.isFinite(i)?Math.max(i,Vb/2):zb,t=(U.variant?.maxZoom??e4)+2;return Os(e4+Math.log2(zb/e),0,t)}function jk(i){if(!Ai||!U.globeActive)return;let e=Ai.pointOfView(),t=Os((Number.isFinite(e.altitude)?e.altitude:zb)/2**i,Vb,n4);Ai.pointOfView({altitude:t},180)}function Bie(){let i=rf(U.map),e=U.engine?.getView();if(Ai&&U.globeActive&&i&&e){let t=Ai.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);Number.isFinite(n)&&Number.isFinite(r)&&(e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(Oie(t.altitude)))}U.globeActive=!1,we.globe.hidden=!0,we.globeToggle.setAttribute("aria-pressed","false"),we.viewport.hidden=!1,Gb(),U.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function Uie(){if(!Ai||!U.globeActive)return null;let i=Ai.pointOfView();return{lat:i.lat,lng:i.lng}}function kie(i,e,t){if(!Ai)return;let n=Ai.pointOfView().altitude;Ai.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function Gie(){let i=rf(U.map);if(!i)return;if(U.globeActive=!0,we.viewport.hidden=!0,we.globe.hidden=!1,we.globeToggle.setAttribute("aria-pressed","true"),U.overviewKey="",!Ai){Ai=Cie({animateIn:!1})(we.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=>v4e(o.pin)).objectLabel(o=>o.pin.location.title).onObjectClick(o=>Px(o.pin)).onObjectHover(o=>{we.globe.style.cursor=o?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),Iie()}),document.addEventListener("atlas:selection",y4e),document.addEventListener("atlas:filters",Uk),document.addEventListener("atlas:grid",()=>{Pie(),Uk()}),Ai.onGlobeClick(({lat:o,lng:a})=>{if(!U.gridEnabled)return;let l=rf(U.map);if(!l)return;let[c,u]=l.toWorld(o,a),f=Ww([c,-u],U.gridPrefix.length+1);f&&Y0(f)});let s=Ai.controls();s.minDistance=kk*(1+Vb),s.maxDistance=kk*(1+n4),Ps.group=new Lr,Ai.scene().add(Ps.group),Ul.group=new Lr,Ai.scene().add(Ul.group)}Xk();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]);Ai.pointOfView({lat:s,lng:o,altitude:A4e(e.getZoom())})}else Ai.pointOfView({lat:10,lng:0,altitude:zb});let n=U.variant||U.map.variants[0],r=`${U.game.stamp}:${U.map.slug}:${n.tiles}`;if(JR!==r){JR=r;let s=await w4e(n);s&&JR===r&&Ai.globeImageUrl(s)}Gk!==U.pins&&(Gk=U.pins,t4.clear(),Hk.clear(),Ai.objectsData(b4e(i))),Uk(),qie(),Iie(),Pie(),document.dispatchEvent(new Event("atlas:globe-camera"))}function Pie(){if(!Ai||!Ul.group)return;for(let e of[...Ul.group.children])Ul.group.remove(e),e.geometry?.dispose(),e.material?.map?.dispose(),e.material?.dispose();let i=U.globeActive?rf(U.map):null;if(!i||!U.gridEnabled){Ul.prefix=null;return}for(let e of Hw()){if(!U.subgridVisible&&e.role==="child")continue;let t=zie(e.extent,i);Ul.group.add(m4e(t,e.role)),(e.role==="child"||e.role==="leaf")&&Ul.group.add(g4e(e,t))}Ul.prefix!==null&&Ul.prefix!==U.gridPrefix&&_4e(i),Ul.prefix=U.gridPrefix}function zie(i,e){let[t,n]=e.toLatLng(i[0],-i[3]).reverse(),[r,s]=e.toLatLng(i[2],-i[1]).reverse();return{west:t,north:n,east:r,south:s}}function m4e(i,e){let t=[],r=(l,c,u,f)=>{for(let p=0;p<12;p++){let x=p/12;t.push(...qk(l+(u-l)*x,c+(f-c)*x,Vk+.25))}};r(i.north,i.west,i.north,i.east),r(i.north,i.east,i.south,i.east),r(i.south,i.east,i.south,i.west),r(i.south,i.west,i.north,i.west);let s=new qn;s.setAttribute("position",new Rn(t,3));let o=e==="neighbor",a=new gl({color:e==="scope"||e==="leaf"?3843529:14212838,transparent:!0,opacity:o?.12:e==="child"?.4:.9,depthWrite:!1});return new wy(s,a)}function g4e(i,e){let t=document.createElement("canvas");t.width=96,t.height=96;let n=t.getContext("2d");n.font="700 44px ui-monospace, SFMono-Regular, Menlo, monospace",n.textAlign="center",n.textBaseline="middle",n.lineWidth=8,n.strokeStyle="rgba(8, 12, 16, 0.85)";let r=i.hash.slice(-1)||i.hash;n.strokeText(r,48,50),n.fillStyle="#d8dee6",n.fillText(r,48,50);let s=new If({depthWrite:!1,transparent:!0,opacity:.85});new xl().load(t.toDataURL("image/png"),u=>{s.map=u,s.needsUpdate=!0});let o=new g_(s),a=(e.north+e.south)/2,l=(e.west+e.east)/2;o.position.set(...qk(a,l,Vk+.3));let c=Os(Math.abs(e.east-e.west)*.35,1.2,14);return o.scale.set(c,c,1),o}function _4e(i){let t=Hw().find(l=>l.role==="scope"||l.role==="leaf");if(!t)return;let n=zie(t.extent,i),r=(n.north+n.south)/2,s=(n.west+n.east)/2,o=Math.max(Math.abs(n.east-n.west),Math.abs(n.north-n.south)),a=Os(o/45,Vb,n4);Ai.pointOfView({lat:r,lng:s,altitude:a},400)}function Iie(){if(!Ai||!Ps.group)return;let i=U.globeActive?U.variant||U.map.variants[0]:null;if(!i){Gb();return}Ps.variant!==i.tiles&&(Gb(),Ps.variant=i.tiles);let e=Ai.pointOfView(),t=Math.min(Math.round(Oie(e.altitude))+1,i.maxZoom);if(t<=Nie||!i.formats[t]){Gb(),Ps.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>p4e&&c>1;)c--;let u=new Set;for(let p=-c;p<=c;p++){let x=l+p;if(!(x<0||x>=r))for(let v=-c;v<=c;v++){let w=((a+v)%n+n)%n;u.add(`${t}/${w}/${x}`)}}let f=`${i.tiles}:${[...u].sort().join(",")}`;if(f!==Ps.key){Ps.key=f;for(let[p,x]of Ps.tiles)u.has(p)||(Ps.group.remove(x),Vie(x),Ps.tiles.delete(p));for(let p of u){if(Ps.tiles.has(p))continue;let[x,v,w]=p.split("/").map(Number),S=x4e(i,x,v,w);Ps.tiles.set(p,S),Ps.group.add(S)}}}function x4e(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<=ad;w++){let S=o-w/ad*r;for(let T=0;T<=ad;T++){let P=s+T/ad*r;a.push(...qk(S,P,Vk)),l.push(T/ad,1-w/ad)}}let u=ad+1;for(let w=0;w<ad;w++)for(let S=0;S<ad;S++){let T=w*u+S;c.push(T,T+u,T+1),c.push(T+1,T+u,T+u+1)}let f=new qn;f.setAttribute("position",new Rn(a,3)),f.setAttribute("uv",new Rn(l,2)),f.setIndex(c);let p=new as,x=new Gn(f,p);x.visible=!1;let v=`${U.game.base}/tiles/${i.tiles}/${e}/${t}/${n}.${i.formats[e]}`;return new xl().load(v,w=>{w.colorSpace=yr,p.map=w,p.needsUpdate=!0,x.visible=!0}),x}function Gb(){if(Ps.group){for(let i of Ps.tiles.values())Ps.group.remove(i),Vie(i);Ps.tiles.clear(),Ps.key=""}}function Vie(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function qie(){if(Ai){for(let[i,e]of t4){let t=i===U.selectedPin;e.material=Wie(i.category,t);let n=t?Die:Lie;e.scale.set(n,n,1)}Ai.objectAltitude(i=>i.pin===U.selectedPin?.03:.014)}}function y4e(){if(!Ai||!U.globeActive)return;qie();let i=Hk.get(U.selectedPin);if(i){let e=Ai.pointOfView().altitude;Ai.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function Hie(i){return!(i.filteredHidden||U.hiddenCategories.has(i.category.id)||U.gridEnabled&&U.gridPrefix&&!Ed(i))}function Uk(){if(!(!Ai||!U.globeActive))for(let[i,e]of t4)e.visible=Hie(i)}function v4e(i){let e=new g_(Wie(i.category,i===U.selectedPin)),t=i===U.selectedPin?Die:Lie;return e.scale.set(t,t,1),e.visible=Hie(i),t4.set(i,e),e}function Wie(i,e){let t=`${Gx(i)}:${e?"ringed":"plain"}`,n=Rie.get(t);if(n)return n;n=new If({depthWrite:!1,sizeAttenuation:!1}),Rie.set(t,n);let r=U.markerIcons.get(Gx(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=Z0(),l.strokeText(Dc(i.title),40,41),l.fillStyle=K0(i),l.fillText(Dc(i.title),40,41)),e&&(l.beginPath(),l.arc(40,40,36,0,Math.PI*2),l.lineWidth=5,l.strokeStyle="#ffffff",l.stroke()),new xl().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 jie(){U.globeActive&&Gie()}function Xk(){!Ai||we.globe.hidden||Ai.width(we.globe.clientWidth).height(we.globe.clientHeight)}function b4e(i){let e=[];for(let t of U.pins){let[n,r]=Ng(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),Hk.set(t,{lat:s,lng:o})}return e}async function w4e(i){let e=Math.min(Nie,i.maxZoom),t=i.formats[e];if(!t)return null;let n=2**e,r=n/2,s=document.createElement("canvas");s.width=n*256,s.height=r*256;let o=s.getContext("2d"),a=[];for(let l=0;l<r;l++)for(let c=0;c<n;c++){let u=`${U.game.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push(S4e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function S4e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function Xie(){let i=U.variant,e=we.overviewCanvas,t=e.getContext("2d"),n=Eu(),r=U.game.tileGrid.size,s=U.game.tileGrid.tileSize,o=n[2]-n[0],a=n[3]-n[1],l=0;for(;l<i.fullZoom&&Math.max(o,a)/r*s*2**l<168;)l++;let c=s*2**l/r;e.width=Math.max(1,Math.round(o*c)),e.height=Math.max(1,Math.round(a*c)),t.clearRect(0,0,e.width,e.height),i.background&&(t.fillStyle=i.background,t.fillRect(0,0,e.width,e.height));let u=++U.overviewRun,f=i.formats[l],p=Math.floor(n[0]/r*2**l),x=Math.ceil(n[2]/r*2**l),v=Math.floor(-n[3]/r*2**l),w=Math.ceil(-n[1]/r*2**l);for(let S=v;S<w;S++)for(let T=p;T<x;T++){if(!f||!r4(i,l,T,S))continue;let P=new Image;P.onload=()=>{U.overviewRun===u&&t.drawImage(P,T*s-n[0]*c,S*s+n[3]*c,s,s)},P.src=`${U.game.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}ex()}function ex(){let i=Uie();if(i){let w=rf(U.map);if(!w||!U.variant)return;let S=Eu(),[T,P]=w.toWorld(i.lat,i.lng),R=we.overviewCanvas,C=Os((T-S[0])/(S[2]-S[0]),0,1),L=Os((P+S[3])/(S[3]-S[1]),0,1);U.overviewKey="",we.overviewShelf.hidden=!1;let D=we.overviewViewport.style,F=22;D.left=`${C*R.width-F/2}px`,D.top=`${L*R.height-F/2}px`,D.width=`${F}px`,D.height=`${F}px`;return}let e=U.engine?.getView();if(!e||!U.variant)return;let t=Eu(),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,we.overviewShelf.hidden=a,a))return;let c=we.overviewCanvas,u=Os((n[0]-t[0])/r,0,1),f=Os((n[2]-t[0])/r,0,1),p=Os((t[3]-n[3])/s,0,1),x=Os((t[3]-n[1])/s,0,1),v=we.overviewViewport.style;v.left=`${u*c.width}px`,v.top=`${p*c.height}px`,v.width=`${Math.max(8,(f-u)*c.width)}px`,v.height=`${Math.max(8,(x-p)*c.height)}px`}function i4(i,e=!0){U.overviewDocked=i,i&&U.overviewPointer!==null&&(U.overviewPointer=null,tx()),we.overviewShelf.classList.toggle("is-docked",i),we.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";we.overviewDock.setAttribute("aria-label",t),we.overviewDock.title=t,e&&Nc()}function $k(i,e){let t=we.overviewCanvas.getBoundingClientRect(),n=Eu(),r=(a,l,c)=>Os((a-l)/(c-l),0,1);if(U.globeActive){let a=rf(U.map);if(!a)return;let l=n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),c=-n[3]+r(i.clientY,t.top,t.bottom)*(n[3]-n[1]),[u,f]=a.toLatLng(l,c);kie(u,f,e);return}let s=U.engine?.getView();if(!s||!U.variant)return;let o=[n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),n[3]-r(i.clientY,t.top,t.bottom)*(n[3]-n[1])];if(e){s.animate({center:o,duration:180});return}s.cancelAnimations(),s.setCenter(o)}function kl(i){return new cH({updateWhileAnimating:!0,...i})}function $ie(){let i=U.game.tileGrid.size,e=[0,-i,i,0];U.projection=new md({code:"ATLAS:PIXELS",units:"pixels",extent:e}),U.sources={grid:new gf({wrapX:!1}),gridContext:new gf({wrapX:!1}),zoneScrim:new gf({wrapX:!1}),zones:new gf({wrapX:!1}),zoneTitles:new gf({wrapX:!1}),text:new gf({wrapX:!1}),pins:new gf({wrapX:!1}),priority:new gf({wrapX:!1})},U.layers={raster:new G5({zIndex:0}),rasterDetail:new G5({zIndex:1}),grid:kl({source:U.sources.grid,style:bI,renderOrder:Zl,renderBuffer:40,zIndex:5}),zoneScrim:kl({source:U.sources.zoneScrim,style:_V,zIndex:6}),zones:kl({source:U.sources.zones,style:xV,renderBuffer:32,zIndex:10}),zoneTitles:kl({source:U.sources.zoneTitles,style:yV,renderOrder:Zl,renderBuffer:160,zIndex:20}),zoneTitleDetail:kl({source:U.sources.zoneTitles,style:vV,renderOrder:Zl,renderBuffer:160,zIndex:44}),text:kl({source:U.sources.text,style:fV,renderOrder:Zl,renderBuffer:220,zIndex:30}),textDetail:kl({source:U.sources.text,style:dV,renderOrder:Zl,renderBuffer:220,zIndex:45}),zoneText:kl({source:U.sources.text,style:pV,renderOrder:Zl,renderBuffer:220,zIndex:41}),pins:kl({source:U.sources.pins,style:cV,renderOrder:Zl,renderBuffer:48,zIndex:40}),zonePins:kl({source:U.sources.pins,style:uV,renderOrder:Zl,renderBuffer:48,zIndex:42}),pinLabels:kl({source:U.sources.pins,style:hV,renderOrder:Zl,renderBuffer:180,zIndex:45}),gridContext:kl({source:U.sources.gridContext,style:bI,renderOrder:Zl,renderBuffer:40,zIndex:48}),priority:kl({source:U.sources.priority,style:AV,renderOrder:Zl,renderBuffer:220,zIndex:50})},U.engine=new Fq({target:we.viewport,layers:Object.values(U.layers),controls:fS({attribution:!1,rotate:!1,zoom:!1}),interactions:_S({onFocusOnly:!1}),view:Yk(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&&tx()}),U.engine.on("postrender",ex),we.viewport.addEventListener("wheel",()=>{document.activeElement!==we.viewport&&we.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){Y0(r.hash);return}}let n=U.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>s4(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:s4});n&&Px(n)}),U.engine.on("pointermove",t=>{if(t.dragging){Lg(null);return}let n=U.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>s4(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:s4}),r=n&&Mu(n.category)==="text"?null:n;Lg(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",()=>Lg(null))}function s4(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 Yk(i){let e=U.game.tileGrid.size;return new hl({projection:U.projection,center:[e/2,-e/2],resolutions:Zk(i),minZoom:0,maxZoom:i,extent:[0,-e,e,0],constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function Zk(i){let e=U.game.tileGrid.size/U.game.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function cf(i,e){U.game=U.catalog.games.find(r=>r.slug===i)||U.catalog.games[0],U.engine||$ie(),!e&&!U.restore&&(U.restore=Sg(U.game.slug)),we.game.value=U.game.slug,F0(we.map,U.game.maps,"title"),we.map.disabled=U.game.maps.length===1,we.map.title=we.map.disabled?"This game has one map":"Choose a map";let t=U.restore?.game===U.game.slug?U.restore:null,n=e&&U.game.maps.find(r=>r.slug===e)||t&&U.game.maps.find(r=>r.slug===t.map);await Kk((n||U.game.maps[0]).slug)}async function Kk(i){let e=U.game.maps.find(s=>s.slug===i)||U.game.maps[0],t=++U.mapRun;we.loading.hidden=!1;let n;try{n=await UV(e)}catch{U.mapRun===t&&(we.loading.hidden=!0,nA());return}if(U.mapRun!==t)return;U.settling=!0,U.map=n,document.documentElement.style.setProperty("--icon-outset-color",Z0()),we.map.value=U.map.slug,F0(we.variant,U.map.variants,"name"),we.variantField.hidden=U.map.variants.length<2,U.styleCache.clear(),Lg(null),U.gridPrefix="",U.hiddenCategories.clear(),U.collapsedSections.clear(),U.collapsedSections.add("zones");for(let s of U.map.groups)for(let o of s.categories)o.visible||U.hiddenCategories.add(o.id);let r=U.restore?.map===U.map.slug?U.restore:null;r&&(U.hiddenCategories=new Set(r.hidden),U.collapsedSections=new Set(r.collapsed)),i4(!!U.restore?.overviewDocked,!1),Yw(U.restore?!!U.restore.dockFolded:!0,!1),U.dockDismissed=!!U.restore?.dockDismissed,U.search="",we.search.value="",we.dock.hidden=!1,Lc(),DV(),TI(),NV(),Qk(r?Os(r.variant,0,U.map.variants.length-1):0,!0),Fie(),U.restore=null,we.sidebar.classList.remove("is-open"),we.mobileLegend.setAttribute("aria-expanded","false"),_z(),U.settling=!1,Nc()}function Qk(i,e=!1){let t=U.variant;U.variant=U.map.variants[i]||U.map.variants[0];let n=U.variant,r=e?null:M4e(t,n),s=Tu(n);we.variant.value=String(U.map.variants.indexOf(U.variant)),e?U.engine.setView(Yk(s)):(U.engine.getView().setMinZoom(n.minZoom),U.engine.getView().setMaxZoom(s));let o=++U.tileRun,a=0;U.tileStats={requested:0,loaded:0,errors:0,peakPending:0},we.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&&(we.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new mz({projection:U.projection,tileGrid:new bx({extent:[0,-U.game.tileGrid.size,U.game.tileGrid.size,0],origin:[0,0],resolutions:Zk(w),tileSize:U.game.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,P,R])=>{let C=n.formats[T];if(!(!C||P<0||R<0||!S(T,P,R)))return`${U.game.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${P}/${R}.${C}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>r4(n,w,S,T)),p=U.layers.raster.getSource();U.layers.raster.setSource(f),U.layers.raster.setExtent(Eu()),U.layers.raster.setBackground(n.background||void 0),p?.clear();let x=U.layers.rasterDetail.getSource();n.maxZoom>u?(U.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&r4(n,w,S,T))),U.layers.rasterDetail.setExtent(Eu()),U.layers.rasterDetail.setVisible(!0)):U.layers.rasterDetail.setVisible(!1),x?.clear(),qw(),U.gridEnabled&&(Su(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()),U.overviewKey="",Xie();let v=e&&U.restore?.map===U.map.slug?U.restore:null;if(U.renderedShard!==(n.shard||0)&&(TI(),$l()),v?.center&&Number.isFinite(v.zoom)){let w=U.engine.getView();w.setCenter(v.center),w.setZoom(v.zoom),U.fitZoom=v.zoom,tA()}else e?requestAnimationFrame(C4e):(r&&U.engine.getView().animate({center:r,duration:200}),tA());Nc()}function r4(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=E4e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function E4e(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 Tu(i){return i.maxZoom+2}function tx(){tA(),Nc()}function M4e(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+Os(r,0,1)*e.bounds.width,-(e.bounds.y+Os(s,0,1)*e.bounds.height)]}function Yie(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");we.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>U.engine?.updateSize())}function Eu(){let i=U.game.tileGrid.size,e=U.variant?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function C4e(){if(!U.engine||!U.variant)return;let i=U.engine.getView();i.fit(Eu(),{size:U.engine.getSize(),padding:[36,36,36,36],maxZoom:U.variant.maxZoom,duration:0}),U.fitZoom=i.getZoom()||0,tA()}function qb(i){let e=U.engine.getView(),t=e.getZoom()||0;e.animate({zoom:Os(t+i,U.variant.minZoom,Tu(U.variant)),duration:140})}function tA(){let i=U.engine?.getView().getZoom();if(we.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!U.engine||!U.pins.length){we.visibleCount.textContent="0 locations visible";return}let e=U.engine.getView().calculateExtent(U.engine.getSize()),t=0;for(let n of U.pins){if(Kl(n))continue;let[r,s]=n.coordinate;r>=e[0]&&r<=e[2]&&s>=e[1]&&s<=e[3]&&t++}we.visibleCount.textContent=`${Fc(U.eligibleLocations)} enabled \xB7 ${Fc(t)} in view`}function Zie(){we.game.addEventListener("change",()=>{cf(we.game.value)}),we.map.addEventListener("change",()=>{Kk(we.map.value)}),we.addBundles.addEventListener("click",()=>{II()}),we.emptyOpen.addEventListener("click",()=>{II()}),we.variant.addEventListener("change",()=>{Qk(Number(we.variant.value)),jie()}),we.globeToggle.addEventListener("click",()=>Wk()),we.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){OV(r.dataset.sectionToggle);return}if(!r.dataset.category)return;let s=Number(r.dataset.category);r.checked?U.hiddenCategories.delete(s):U.hiddenCategories.add(s),$l(),Cd()});let i=null,e=()=>{for(let s of we.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&&we.layers.contains(r)&&r.classList.add("is-hovered")};we.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),we.layers.addEventListener("pointerleave",()=>{i=null,e()}),we.layers.addEventListener("scroll",e,{passive:!0}),we.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-category], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),BV(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),cS()}),we.soloChip.addEventListener("click",()=>Vx(!0)),nn("#expand-all").addEventListener("click",()=>RI(!1)),nn("#collapse-all").addEventListener("click",()=>RI(!0)),nn("#show-all").addEventListener("click",()=>Vx(!0)),nn("#hide-all").addEventListener("click",()=>Vx(!1)),we.zoneToggle.addEventListener("change",()=>{aS(we.zoneToggle.checked)}),we.zoneIndex.addEventListener("click",n=>{let r=n.target.closest("[data-zone]");r&&RV(Number(r.dataset.zone))}),we.zoneIndex.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),PV(Number(r.dataset.zone)))}),we.search.addEventListener("input",()=>{U.search=we.search.value.trim().toLocaleLowerCase(),$l(),U.search&&$w()}),we.dockFold.addEventListener("click",()=>{QP(!U.dockFolded)}),we.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&JP(s)}),we.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&JP(s)}),nn("#close-detail").addEventListener("click",Lc),nn("#zoom-in").addEventListener("click",()=>U.globeActive?jk(1):qb(1)),nn("#zoom-out").addEventListener("click",()=>U.globeActive?jk(-1):qb(-1)),we.gridBack.addEventListener("click",ZP),we.gridInput.addEventListener("input",()=>{let n=Td(),r=[...we.gridInput.value.toLocaleLowerCase()].filter(s=>Hl.includes(s)).slice(0,n).join("");we.gridInput.value=r,Y0(r)}),we.subgridToggle.addEventListener("click",()=>{Rx(!U.subgridVisible),we.viewport.focus({preventScroll:!0})}),we.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Rx(!U.subgridVisible);return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),we.viewport.focus({preventScroll:!0}))}),we.viewport.addEventListener("keydown",n=>{if(!Xw(n.target)){if(n.key==="+"||n.key==="=")qb(1);else if(n.key==="-")qb(-1);else if(n.key==="Escape")Lc();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{Xw(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if(!Xw(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){we.globeToggle.hidden||(n.preventDefault(),Wk());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),we.search.focus(),we.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),we.dock.hidden||QP(!U.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),Yie();return}Bz(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||lS(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&lS(!1)}),window.addEventListener("blur",()=>lS(!1)),window.addEventListener("hashchange",()=>{let n=Tg();n.game===U.game?.slug&&n.map===U.map?.slug||(U.restore=null,cf(n.game||U.catalog.games[0].slug,n.map))}),window.addEventListener("resize",()=>{U.engine?.updateSize(),ex(),Xk()}),document.addEventListener("atlas:globe-camera",()=>ex()),we.overview.addEventListener("pointerdown",n=>{U.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),we.overview.setPointerCapture(n.pointerId),U.overviewPointer=n.pointerId,$k(n,!0))}),we.overview.addEventListener("pointermove",n=>{U.overviewPointer===n.pointerId&&(n.preventDefault(),$k(n,!1))});let t=n=>{U.overviewPointer===n.pointerId&&(U.overviewPointer=null,tx())};we.overview.addEventListener("pointerup",t),we.overview.addEventListener("pointercancel",t),we.overviewDock.addEventListener("click",()=>{i4(!U.overviewDocked),we.viewport.focus({preventScroll:!0})}),we.mobileLegend.addEventListener("click",()=>{let n=we.sidebar.classList.toggle("is-open");we.mobileLegend.setAttribute("aria-expanded",String(n))})}function Kie(){let i=()=>({game:U.game?.title,map:U.map?.title,variant:U.variant?.name,zoom:U.engine?.getView().getZoom(),center:U.engine?.getView().getCenter(),resolution:U.engine?.getView().getResolution(),nativeMaxZoom:U.variant?.maxZoom,maxZoom:U.variant?Tu(U.variant):null,interpolate:U.variant?.interpolate,tileStats:{...U.tileStats},pins:U.pins.length,eligibleLocations:U.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,labelsHeld:U.labelsHeld,hoveredPin:U.hoveredPin?.location.title||null,selectedPin:U.selectedPin?.location.title||null,fitZoom:U.fitZoom,filters:{hiddenCategories:[...U.hiddenCategories].sort(),collapsedSections:[...U.collapsedSections].sort()},ui:{sidebarCollapsed:document.querySelector(".app-shell")?.classList.contains("sidebar-collapsed")??!1,detailOpen:!we.detail.hidden,detailTitle:we.detail.hidden?null:we.detailTitle.textContent||null,searchQuery:U.search,searchResultsVisible:!we.searchResults.hidden,soloChip:we.soloChip.hidden?null:we.soloChip.textContent,visibleCountText:we.visibleCount.textContent,overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed,subgridVisible:U.subgridVisible},zones:{visible:U.zonesVisible,count:U.zoneRecords.size,focused:U.zoneRecords.get(U.focusedZoneID)?.zone.title||null,highlighted:[...U.highlightedZones].map(e=>U.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:U.pins.filter(e=>!e.filteredHidden&&e.insideHighlightedZone).length},grid:{enabled:U.gridEnabled,prefix:U.gridPrefix,maximumDepth:Td(),extent:U.gridEnabled?Mg():null,cells:[...U.sources.grid.getFeatures(),...U.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:U.gridPrefix?U.pins.filter(e=>!e.filteredHidden&&Ed(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>U.layers[e]?.setVisible(t),refreshCatalog:nA},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 Qie(){Zie();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(),F0(we.game,U.catalog.games,"title"),PI(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{nA()}),U.catalog.games.length){let e=Tg(),t=Sg(),n=t&&(!e.game||e.game===t.game&&e.map===t.map);U.restore=n?t:null,await cf(e.game||t?.game||U.catalog.games[0].slug,e.map||t?.map),U.restore=null}else we.loading.hidden=!0;Kie(),requestAnimationFrame(()=>we.viewport.focus({preventScroll:!0}))}catch(i){we.loading.hidden=!0,we.fatalMessage.textContent=i instanceof Error?i.message:String(i),we.fatal.hidden=!1}}Qie();})();5288+}`;t4e(n4e);function Hk(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 i4e(i){if(Array.isArray(i))return Hk(i)}function zb(i,e,t){return(e=c4e(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function r4e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function s4e(){throw new TypeError(`Invalid attempt to spread non-iterable instance.5289+In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Eie(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 tg(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Eie(Object(t),!0).forEach(function(n){zb(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Eie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function o4e(i,e){if(i==null)return{};var t,n,r=a4e(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 a4e(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 e4(i){return i4e(i)||r4e(i)||u4e(i)||s4e()}function l4e(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 c4e(i){var e=l4e(i,"string");return typeof e=="symbol"?e:e+""}function u4e(i,e){if(i){if(typeof i=="string")return Hk(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)?Hk(i,e):void 0}}function Mie(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 h4e=["rendererConfig","waitForGlobeReady"],Gb=tg(tg({},window.THREE?window.THREE:{AmbientLight:FA,DirectionalLight:DA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:d3}),Cie=Mie("globe",hk),f4e=Object.assign.apply(Object,e4(["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 zb({},i,Cie.linkProp(i))}))),d4e=Object.assign.apply(Object,e4(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return zb({},i,Cie.linkMethod(i))}))),Rie=Mie("renderObjs",qk),p4e=Object.assign.apply(Object,e4(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return zb({},i,Rie.linkProp(i))}))),A4e=Object.assign.apply(Object,e4(["lights","postProcessingComposer"].map(function(i){return zb({},i,Rie.linkMethod(i))}))),Pie=Fr({props:tg(tg({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}))}}},f4e),p4e),methods:tg(tg({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 Hs(r).to(o,n).easing(Or.Cubic.InOut).onUpdate(l).onComplete(function(){e.povTween=void 0,e.tweenGroup.remove(this)}).start())}return this;function a(){return e.globe.toGeoCoords(e.renderObjs.cameraPosition())}function l(c){var u=c.lat,f=c.lng,p=c.altitude;e.renderObjs.cameraPosition(e.globe.getCoords(u,f,p)),e.globe.setPointOfView(e.renderObjs.camera())}},getScreenCoords:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];var o=(t=e.globe).getCoords.apply(t,r);return e.renderObjs.getScreenCoords(o.x,o.y,o.z)},toGlobeCoords:function(e,t,n){var r=e.renderObjs.intersectingObjects(t,n).find(function(l){return(l.object.__globeObjType||l.object.parent.__globeObjType)==="globe"});if(!r)return null;var s=e.globe.toGeoCoords(r.point),o=s.lat,a=s.lng;return{lat:o,lng:a}},scene:function(e){return e.renderObjs.scene()},camera:function(e){return e.renderObjs.camera()},renderer:function(e){return e.renderObjs.renderer()},controls:function(e){return e.renderObjs.controls()},_destructor:function(e){this.pauseAnimation(),this.pointsData([]),this.arcsData([]),this.polygonsData([]),this.pathsData([]),this.heatmapsData([]),this.hexBinPointsData([]),this.hexPolygonsData([]),this.tilesData([]),this.particlesData([]),this.labelsData([]),this.htmlElementsData([]),this.objectsData([]),this.customLayerData([]),e.globe._destructor(),e.renderObjs._destructor()}},d4e),A4e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=o4e(e,h4e),o=new hk(tg({waitForGlobeReady:r},s));return{globe:o,renderObjs:qk({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new Gb.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new Gb.AmbientLight(13421772,Math.PI),new Gb.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new QA}},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 Gb.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}};Gb.REVISION<155&&(t.renderObjs.renderer().useLegacyLights=!1),t.renderObjs.hoverFilter(function(c){var u=a(c);if(!u)return!1;var f=u.__globeObjType;if(f!=="globe"&&!l.hasOwnProperty(f))return!1;var p=l.hasOwnProperty(f)&&u.__data?l[f](u.__data):null;return["points","hexBinPoints"].some(function(x){return x===f})&&Array.isArray(p)?!1:t.pointerEventsFilter(u,p)}).tooltipContent(function(c,u){var f={point:t.pointLabel,arc:t.arcLabel,polygon:t.polygonLabel,path:t.pathLabel,hexbin:t.hexLabel,hexPolygon:t.hexPolygonLabel,tile:t.tileLabel,particles:t.particleLabel,label:t.labelLabel,object:t.objectLabel,custom:t.customLayerLabel},p=a(c),x=p&&p.__globeObjType;return p&&x&&f.hasOwnProperty(x)&&l.hasOwnProperty(x)&&rt(f[x])(l[x](p.__data,u))||""}).onHover(function(c,u,f){var p={point:t.onPointHover,arc:t.onArcHover,polygon:t.onPolygonHover,path:t.onPathHover,heatmap:t.onHeatmapHover,hexbin:t.onHexHover,hexPolygon:t.onHexPolygonHover,tile:t.onTileHover,particles:t.onParticleHover,label:t.onLabelHover,object:t.onObjectHover,custom:t.onCustomLayerHover},x={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},v=a(c);if(v&&!p.hasOwnProperty(v.__globeObjType)&&(v=null),v!==t.hoverObj){var w,S=t.hoverObj?t.hoverObj.__globeObjType:null,T=t.hoverData,P=v?v.__globeObjType:null,R=(w=v)!==null&&w!==void 0&&w.__data?l[P](v.__data,f):null;S&&S!==P&&p[S]&&p[S](null,T||null),P&&p[P]&&p[P](R,S===P?T:null),t.renderObjs.renderer().domElement.classList[P&&x[P]&&rt(t.showPointerCursor)(P,R)?"add":"remove"]("clickable"),t.hoverObj=v,t.hoverData=R}}).onClick(function(c,u,f){if(c){var p={globe:t.onGlobeClick,point:t.onPointClick,arc:t.onArcClick,polygon:t.onPolygonClick,path:t.onPathClick,heatmap:t.onHeatmapClick,hexbin:t.onHexClick,hexPolygon:t.onHexPolygonClick,tile:t.onTileClick,particles:t.onParticleClick,label:t.onLabelClick,object:t.onObjectClick,custom:t.onCustomLayerClick},x=a(c),v=x.__globeObjType;if(x&&p.hasOwnProperty(v)&&p[v]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(v==="globe"){var T=n.toGeoCoords(S),P=T.lat,R=T.lng;w.unshift({lat:P,lng:R})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}).onRightClick(function(c,u,f){if(c){var p={globe:t.onGlobeRightClick,point:t.onPointRightClick,arc:t.onArcRightClick,polygon:t.onPolygonRightClick,path:t.onPathRightClick,heatmap:t.onHeatmapRightClick,hexbin:t.onHexRightClick,hexPolygon:t.onHexPolygonRightClick,tile:t.onTileRightClick,particles:t.onParticleRightClick,label:t.onLabelRightClick,object:t.onObjectRightClick,custom:t.onCustomLayerRightClick},x=a(c),v=x.__globeObjType;if(x&&p.hasOwnProperty(v)&&p[v]){var w=[u],S=f!=null&&f.isVector3?f:f?.point;if(v==="globe"){var T=n.toGeoCoords(S),P=T.lat,R=T.lng;w.unshift({lat:P,lng:R})}else w.push(n.toGeoCoords(S));l.hasOwnProperty(v)&&w.unshift(l[v](x.__data,f)),p[v].apply(p,w)}}}),this._animationCycle()}});var Die=4,jk=100,r4=jk+.2,ld=8,m4e=96,Fie=.045,Oie=.08;function s4(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 ii=null,n4="",As={group:null,tiles:new Map,key:"",variant:""},sl={group:null,prefix:null},pu={group:null,key:""},g4e=180,Xk=null,tx=new Map,o4=new Map,Iie=new Map;function Bie(){let i=jz(U.map)==="sphere"&&of(U.map)!==null;we.globeToggle.hidden=!i,kie(),!i&&ii&&(Vb(),As.group=null,sl.group=null,sl.prefix=null,pu.group=null,pu.key="",ii._destructor(),ii=null,n4="",Xk=null,we.globe.replaceChildren())}function a4(){U.globeActive?kie():Vie()}var qb=2.5,i4=2,Hb=.08,l4=4;function _4e(i){let e=Number.isFinite(i)?i:i4;return vs(qb/2**(e-i4),Hb,l4)}function Uie(i){let e=Number.isFinite(i)?Math.max(i,Hb/2):qb,t=(U.variant?.maxZoom??i4)+2;return vs(i4+Math.log2(qb/e),0,t)}function Yk(i){if(!ii||!U.globeActive)return;let e=ii.pointOfView(),t=vs((Number.isFinite(e.altitude)?e.altitude:qb)/2**i,Hb,l4);ii.pointOfView({altitude:t},180)}function kie(){let i=of(U.map),e=U.engine?.getView();if(ii&&U.globeActive&&i&&e){let t=ii.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);Number.isFinite(n)&&Number.isFinite(r)&&(e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(Uie(t.altitude)))}U.globeActive=!1,we.globe.hidden=!0,we.globeToggle.setAttribute("aria-pressed","false"),we.viewport.hidden=!1,Vb(),U.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function Gie(){if(!ii||!U.globeActive)return null;let i=ii.pointOfView();return{lat:i.lat,lng:i.lng}}function zie(i,e,t){if(!ii)return;let n=ii.pointOfView().altitude;ii.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function Vie(){let i=of(U.map);if(!i)return;if(U.globeActive=!0,we.viewport.hidden=!0,we.globe.hidden=!1,we.globeToggle.setAttribute("aria-pressed","true"),U.overviewKey="",!ii){ii=Pie({animateIn:!1})(we.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=>E4e(o.pin)).objectLabel(o=>o.pin.location.title).onObjectClick(o=>Nx(o.pin)).onObjectHover(o=>{we.globe.style.cursor=o?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),Lie(),t4()}),document.addEventListener("atlas:selection",T4e),document.addEventListener("atlas:filters",Wk),document.addEventListener("atlas:grid",()=>{Nie(),Wk(),t4()}),document.addEventListener("atlas:labels",t4),ii.onGlobeClick(({lat:o,lng:a})=>{if(!U.gridEnabled)return;let l=of(U.map);if(!l)return;let[c,u]=l.toWorld(o,a),f=Xw([c,-u],U.gridPrefix.length+1);f&&Z0(f)});let s=ii.controls();s.minDistance=jk*(1+Hb),s.maxDistance=jk*(1+l4),As.group=new vr,ii.scene().add(As.group),sl.group=new vr,ii.scene().add(sl.group),pu.group=new vr,ii.scene().add(pu.group),window.__atlasGlobe={detail:As,grid:sl,labels:pu,sprites:tx}}Zk();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]);ii.pointOfView({lat:s,lng:o,altitude:_4e(e.getZoom())})}else ii.pointOfView({lat:10,lng:0,altitude:qb});let n=U.variant||U.map.variants[0],r=`${U.game.stamp}:${U.map.slug}:${n.tiles}`;if(n4!==r){n4=r;let s=await C4e(n);s&&n4===r&&ii.globeImageUrl(s)}Xk!==U.pins&&(Xk=U.pins,tx.clear(),o4.clear(),ii.objectsData(M4e(i))),Wk(),Wie(),Lie(),Nie(),t4(),document.dispatchEvent(new Event("atlas:globe-camera"))}function Nie(){if(!ii||!sl.group)return;for(let e of[...sl.group.children])sl.group.remove(e),e.geometry?.dispose(),e.material?.map?.dispose(),e.material?.dispose();let i=U.globeActive?of(U.map):null;if(!i||!U.gridEnabled){sl.prefix=null;return}for(let e of jw()){if(!U.subgridVisible&&e.role==="child")continue;let t=qie(e.extent,i);sl.group.add(v4e(t,e.role)),(e.role==="child"||e.role==="leaf")&&sl.group.add(b4e(e,t))}sl.prefix!==null&&sl.prefix!==U.gridPrefix&&w4e(i),sl.prefix=U.gridPrefix}function t4(){if(!ii||!pu.group)return;let i=U.globeActive&&U.labelsHeld,e=i?ii.pointOfView():null,t=i?`${Math.round(e.lat)}:${Math.round(e.lng)}:${e.altitude.toFixed(2)}:${U.gridPrefix}`:"";if(t===pu.key)return;pu.key=t;for(let r of[...pu.group.children])pu.group.remove(r),r.material?.map?.dispose(),r.material?.dispose();if(!i)return;let n=[];for(let[r,s]of tx){if(!s.visible)continue;let o=o4.get(r);if(!o)continue;let a=x4e(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,g4e))pu.group.add(y4e(r,s))}function x4e(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(vs(n,-1,1))*180/Math.PI}function y4e(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 zu({depthWrite:!1,sizeAttenuation:!1,transparent:!0});new ja().load(n.toDataURL("image/png"),u=>{a.map=u,a.needsUpdate=!0});let l=new TA(a);l.position.set(...s4(e.lat,e.lng,r4+.4));let c=.028;return l.scale.set(c*o/40,c,1),l.center.set(.5,0),l}function qie(i,e){let[t,n]=e.toLatLng(i[0],-i[3]).reverse(),[r,s]=e.toLatLng(i[2],-i[1]).reverse();return{west:t,north:n,east:r,south:s}}function v4e(i,e){let t=[],r=(l,c,u,f)=>{for(let p=0;p<12;p++){let x=p/12;t.push(...s4(l+(u-l)*x,c+(f-c)*x,r4+.25))}};r(i.north,i.west,i.north,i.east),r(i.north,i.east,i.south,i.east),r(i.south,i.east,i.south,i.west),r(i.south,i.west,i.north,i.west);let s=new qn;s.setAttribute("position",new Rn(t,3));let o=e==="neighbor",a=new xl({color:e==="scope"||e==="leaf"?3843529:14212838,transparent:!0,opacity:o?.12:e==="child"?.4:.9,depthWrite:!1});return new Ty(s,a)}function b4e(i,e){let t=document.createElement("canvas");t.width=96,t.height=96;let n=t.getContext("2d");n.font="700 44px ui-monospace, SFMono-Regular, Menlo, monospace",n.textAlign="center",n.textBaseline="middle",n.lineWidth=8,n.strokeStyle="rgba(8, 12, 16, 0.85)";let r=i.hash.slice(-1)||i.hash;n.strokeText(r,48,50),n.fillStyle="#d8dee6",n.fillText(r,48,50);let s=new zu({depthWrite:!1,transparent:!0,opacity:.85});new ja().load(t.toDataURL("image/png"),u=>{s.map=u,s.needsUpdate=!0});let o=new TA(s),a=(e.north+e.south)/2,l=(e.west+e.east)/2;o.position.set(...s4(a,l,r4+.3));let c=vs(Math.abs(e.east-e.west)*.35,1.2,14);return o.scale.set(c,c,1),o}function w4e(i){let t=jw().find(l=>l.role==="scope"||l.role==="leaf");if(!t)return;let n=qie(t.extent,i),r=(n.north+n.south)/2,s=(n.west+n.east)/2,o=Math.max(Math.abs(n.east-n.west),Math.abs(n.north-n.south)),a=vs(o/45,Hb,l4);ii.pointOfView({lat:r,lng:s,altitude:a},400)}function Lie(){if(!ii||!As.group)return;let i=U.globeActive?U.variant||U.map.variants[0]:null;if(!i){Vb();return}As.variant!==i.tiles&&(Vb(),As.variant=i.tiles);let e=ii.pointOfView(),t=Math.min(Math.round(Uie(e.altitude))+1,i.maxZoom);if(t<=Die||!i.formats[t]){Vb(),As.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>m4e&&c>1;)c--;let u=new Set;for(let p=-c;p<=c;p++){let x=l+p;if(!(x<0||x>=r))for(let v=-c;v<=c;v++){let w=((a+v)%n+n)%n;u.add(`${t}/${w}/${x}`)}}let f=`${i.tiles}:${[...u].sort().join(",")}`;if(f!==As.key){As.key=f;for(let[p,x]of As.tiles)u.has(p)||(As.group.remove(x),Hie(x),As.tiles.delete(p));for(let p of u){if(As.tiles.has(p))continue;let[x,v,w]=p.split("/").map(Number),S=S4e(i,x,v,w);As.tiles.set(p,S),As.group.add(S)}}}function S4e(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<=ld;w++){let S=o-w/ld*r;for(let T=0;T<=ld;T++){let P=s+T/ld*r;a.push(...s4(S,P,r4)),l.push(T/ld,1-w/ld)}}let u=ld+1;for(let w=0;w<ld;w++)for(let S=0;S<ld;S++){let T=w*u+S;c.push(T,T+u,T+1),c.push(T+1,T+u,T+u+1)}let f=new qn;f.setAttribute("position",new Rn(a,3)),f.setAttribute("uv",new Rn(l,2)),f.setIndex(c);let p=new as,x=new Gn(f,p);x.visible=!1;let v=`${U.game.base}/tiles/${i.tiles}/${e}/${t}/${n}.${i.formats[e]}`;return new ja().load(v,w=>{w.colorSpace=yr,p.map=w,p.needsUpdate=!0,x.visible=!0}),x}function Vb(){if(As.group){for(let i of As.tiles.values())As.group.remove(i),Hie(i);As.tiles.clear(),As.key=""}}function Hie(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function Wie(){if(ii){for(let[i,e]of tx){let t=i===U.selectedPin;e.material=Xie(i.category,t);let n=t?Oie:Fie;e.scale.set(n,n,1)}ii.objectAltitude(i=>i.pin===U.selectedPin?.03:.014)}}function T4e(){if(!ii||!U.globeActive)return;Wie();let i=o4.get(U.selectedPin);if(i){let e=ii.pointOfView().altitude;ii.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function jie(i){return!(i.filteredHidden||U.hiddenCategories.has(i.category.id)||U.gridEnabled&&U.gridPrefix&&!Md(i))}function Wk(){if(!(!ii||!U.globeActive))for(let[i,e]of tx)e.visible=jie(i)}function E4e(i){let e=new TA(Xie(i.category,i===U.selectedPin)),t=i===U.selectedPin?Oie:Fie;return e.scale.set(t,t,1),e.visible=jie(i),tx.set(i,e),e}function Xie(i,e){let t=`${Vx(i)}:${e?"ringed":"plain"}`,n=Iie.get(t);if(n)return n;n=new zu({depthWrite:!1,sizeAttenuation:!1}),Iie.set(t,n);let r=U.markerIcons.get(Vx(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=K0(),l.strokeText(Fc(i.title),40,41),l.fillStyle=Q0(i),l.fillText(Fc(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 ja().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 $ie(){U.globeActive&&Vie()}function Zk(){!ii||we.globe.hidden||ii.width(we.globe.clientWidth).height(we.globe.clientHeight)}function M4e(i){let e=[];for(let t of U.pins){let[n,r]=Dg(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),o4.set(t,{lat:s,lng:o})}return e}async function C4e(i){let e=Math.min(Die,i.maxZoom),t=i.formats[e];if(!t)return null;let n=2**e,r=n/2,s=document.createElement("canvas");s.width=n*256,s.height=r*256;let o=s.getContext("2d"),a=[];for(let l=0;l<r;l++)for(let c=0;c<n;c++){let u=`${U.game.base}/tiles/${i.tiles}/${e}/${c}/${l}.${t}`;a.push(R4e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function R4e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function Yie(){let i=U.variant,e=we.overviewCanvas,t=e.getContext("2d"),n=$l(),r=U.game.tileGrid.size,s=U.game.tileGrid.tileSize,o=n[2]-n[0],a=n[3]-n[1],l=0;for(;l<i.fullZoom&&Math.max(o,a)/r*s*2**l<168;)l++;let c=s*2**l/r;e.width=Math.max(1,Math.round(o*c)),e.height=Math.max(1,Math.round(a*c)),t.clearRect(0,0,e.width,e.height),i.background&&(t.fillStyle=i.background,t.fillRect(0,0,e.width,e.height));let u=++U.overviewRun,f=i.formats[l],p=Math.floor(n[0]/r*2**l),x=Math.ceil(n[2]/r*2**l),v=Math.floor(-n[3]/r*2**l),w=Math.ceil(-n[1]/r*2**l);for(let S=v;S<w;S++)for(let T=p;T<x;T++){if(!f||!u4(i,l,T,S))continue;let P=new Image;P.onload=()=>{U.overviewRun===u&&t.drawImage(P,T*s-n[0]*c,S*s+n[3]*c,s,s)},P.src=`${U.game.base}/tiles/${encodeURIComponent(i.tiles)}/${l}/${T}/${S}.${f}`}nx()}function nx(){let i=Gie();if(i){let w=of(U.map);if(!w||!U.variant)return;let S=$l(),[T,P]=w.toWorld(i.lat,i.lng),R=we.overviewCanvas,C=vs((T-S[0])/(S[2]-S[0]),0,1),L=vs((P+S[3])/(S[3]-S[1]),0,1);U.overviewKey="",we.overviewShelf.hidden=!1;let D=we.overviewViewport.style,F=22;D.left=`${C*R.width-F/2}px`,D.top=`${L*R.height-F/2}px`,D.width=`${F}px`,D.height=`${F}px`;return}let e=U.engine?.getView();if(!e||!U.variant)return;let t=$l(),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,we.overviewShelf.hidden=a,a))return;let c=we.overviewCanvas,u=vs((n[0]-t[0])/r,0,1),f=vs((n[2]-t[0])/r,0,1),p=vs((t[3]-n[3])/s,0,1),x=vs((t[3]-n[1])/s,0,1),v=we.overviewViewport.style;v.left=`${u*c.width}px`,v.top=`${p*c.height}px`,v.width=`${Math.max(8,(f-u)*c.width)}px`,v.height=`${Math.max(8,(x-p)*c.height)}px`}function c4(i,e=!0){U.overviewDocked=i,i&&U.overviewPointer!==null&&(U.overviewPointer=null,ix()),we.overviewShelf.classList.toggle("is-docked",i),we.overviewDock.setAttribute("aria-expanded",String(!i));let t=i?"Bring the overview back":"Put the overview away";we.overviewDock.setAttribute("aria-label",t),we.overviewDock.title=t,e&&Lc()}function Kk(i,e){let t=we.overviewCanvas.getBoundingClientRect(),n=$l(),r=(a,l,c)=>vs((a-l)/(c-l),0,1);if(U.globeActive){let a=of(U.map);if(!a)return;let l=n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),c=-n[3]+r(i.clientY,t.top,t.bottom)*(n[3]-n[1]),[u,f]=a.toLatLng(l,c);zie(u,f,e);return}let s=U.engine?.getView();if(!s||!U.variant)return;let o=[n[0]+r(i.clientX,t.left,t.right)*(n[2]-n[0]),n[3]-r(i.clientY,t.top,t.bottom)*(n[3]-n[1])];if(e){s.animate({center:o,duration:180});return}s.cancelAnimations(),s.setCenter(o)}function kl(i){return new hH({updateWhileAnimating:!0,...i})}function Zie(){let i=U.game.tileGrid.size,e=[0,-i,i,0];U.projection=new gd({code:"ATLAS:PIXELS",units:"pixels",extent:e}),U.sources={grid:new xf({wrapX:!1}),gridContext:new xf({wrapX:!1}),zoneScrim:new xf({wrapX:!1}),zones:new xf({wrapX:!1}),zoneTitles:new xf({wrapX:!1}),text:new xf({wrapX:!1}),pins:new xf({wrapX:!1}),priority:new xf({wrapX:!1})},U.layers={raster:new X5({zIndex:0}),rasterDetail:new X5({zIndex:1}),grid:kl({source:U.sources.grid,style:RI,renderOrder:Kl,renderBuffer:40,zIndex:5}),zoneScrim:kl({source:U.sources.zoneScrim,style:yV,zIndex:6}),zones:kl({source:U.sources.zones,style:vV,renderBuffer:32,zIndex:10}),zoneTitles:kl({source:U.sources.zoneTitles,style:bV,renderOrder:Kl,renderBuffer:160,zIndex:20}),zoneTitleDetail:kl({source:U.sources.zoneTitles,style:wV,renderOrder:Kl,renderBuffer:160,zIndex:44}),text:kl({source:U.sources.text,style:pV,renderOrder:Kl,renderBuffer:220,zIndex:30}),textDetail:kl({source:U.sources.text,style:AV,renderOrder:Kl,renderBuffer:220,zIndex:45}),zoneText:kl({source:U.sources.text,style:mV,renderOrder:Kl,renderBuffer:220,zIndex:41}),pins:kl({source:U.sources.pins,style:hV,renderOrder:Kl,renderBuffer:48,zIndex:40}),zonePins:kl({source:U.sources.pins,style:fV,renderOrder:Kl,renderBuffer:48,zIndex:42}),pinLabels:kl({source:U.sources.pins,style:dV,renderOrder:Kl,renderBuffer:180,zIndex:45}),gridContext:kl({source:U.sources.gridContext,style:RI,renderOrder:Kl,renderBuffer:40,zIndex:48}),priority:kl({source:U.sources.priority,style:gV,renderOrder:Kl,renderBuffer:220,zIndex:50})},U.engine=new Bq({target:we.viewport,layers:Object.values(U.layers),controls:pS({attribution:!1,rotate:!1,zoom:!1}),interactions:yS({onFocusOnly:!1}),view:f4(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&&ix()}),U.engine.on("postrender",nx),we.viewport.addEventListener("wheel",()=>{document.activeElement!==we.viewport&&we.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){Z0(r.hash);return}}let n=U.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>h4(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:h4});n&&Nx(n)}),U.engine.on("pointermove",t=>{if(t.dragging){Fg(null);return}let n=U.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>h4(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:h4}),r=n&&Cu(n.category)==="text"?null:n;Fg(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",()=>Fg(null))}function h4(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 f4(i,e=null){let t=U.game.tileGrid.size,n=e||[0,-t,t,0];return new dl({projection:U.projection,center:[(n[0]+n[2])/2,(n[1]+n[3])/2],resolutions:Qk(i),minZoom:0,maxZoom:i,extent:n,constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function Qk(i){let e=U.game.tileGrid.size/U.game.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function hf(i,e){U.game=U.catalog.games.find(r=>r.slug===i)||U.catalog.games[0],U.engine||Zie(),!e&&!U.restore&&(U.restore=Eg(U.game.slug)),we.game.value=U.game.slug,O0(we.map,U.game.maps,"title"),we.map.disabled=U.game.maps.length===1,we.map.title=we.map.disabled?"This game has one map":"Choose a map";let t=U.restore?.game===U.game.slug?U.restore:null,n=e&&U.game.maps.find(r=>r.slug===e)||t&&U.game.maps.find(r=>r.slug===t.map);await Jk((n||U.game.maps[0]).slug)}async function Jk(i){let e=U.game.maps.find(s=>s.slug===i)||U.game.maps[0],t=++U.mapRun;we.loading.hidden=!1;let n;try{n=await GV(e)}catch{U.mapRun===t&&(we.loading.hidden=!0,iA());return}if(U.mapRun!==t)return;U.settling=!0,U.map=n,document.documentElement.style.setProperty("--icon-outset-color",K0()),we.map.value=U.map.slug,O0(we.variant,U.map.variants,"name"),we.variantField.hidden=U.map.variants.length<2,U.styleCache.clear(),Fg(null),U.gridPrefix="",U.hiddenCategories.clear(),U.collapsedSections.clear(),U.collapsedSections.add("zones");for(let s of U.map.groups)for(let o of s.categories)o.visible||U.hiddenCategories.add(o.id);let r=U.restore?.map===U.map.slug?U.restore:null;r&&(U.hiddenCategories=new Set(r.hidden),U.collapsedSections=new Set(r.collapsed)),c4(!!U.restore?.overviewDocked,!1),Kw(U.restore?!!U.restore.dockFolded:!0,!1),U.dockDismissed=!!U.restore?.dockDismissed,U.search="",we.search.value="",we.dock.hidden=!1,Dc(),OV(),NI(),DV(),e9(r?vs(r.variant,0,U.map.variants.length-1):0,!0),Bie(),U.restore=null,we.sidebar.classList.remove("is-open"),we.mobileLegend.setAttribute("aria-expanded","false"),yz(),U.settling=!1,Lc()}function e9(i,e=!1){let t=U.variant;U.variant=U.map.variants[i]||U.map.variants[0];let n=U.variant,r=e?null:N4e(t,n),s=Mu(n);if(we.variant.value=String(U.map.variants.indexOf(U.variant)),e)U.engine.setView(f4(s,$l()));else{let w=U.engine.getView(),S=f4(s,$l());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},we.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&&(we.loading.hidden=!0))};return w.on("tileloadend",()=>S(!1)),w.on("tileloaderror",()=>S(!0)),w},c=(w,S)=>l(new _z({projection:U.projection,tileGrid:new Sx({extent:[0,-U.game.tileGrid.size,U.game.tileGrid.size,0],origin:[0,0],resolutions:Qk(w),tileSize:U.game.tileGrid.tileSize}),cacheSize:64,interpolate:n.interpolate,transition:0,wrapX:!1,tileUrlFunction:([T,P,R])=>{let C=n.formats[T];if(!(!C||P<0||R<0||!S(T,P,R)))return`${U.game.base}/tiles/${encodeURIComponent(n.tiles)}/${T}/${P}/${R}.${C}`}})),u=n.fullZoom??n.maxZoom,f=c(u,(w,S,T)=>u4(n,w,S,T)),p=U.layers.raster.getSource();U.layers.raster.setSource(f),U.layers.raster.setExtent($l()),U.layers.raster.setBackground(n.background||void 0),p?.clear();let x=U.layers.rasterDetail.getSource();n.maxZoom>u?(U.layers.rasterDetail.setSource(c(n.maxZoom,(w,S,T)=>w>u&&u4(n,w,S,T))),U.layers.rasterDetail.setExtent($l()),U.layers.rasterDetail.setVisible(!0)):U.layers.rasterDetail.setVisible(!1),x?.clear(),Ww(),U.gridEnabled&&(Eu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()),U.overviewKey="",Yie();let v=e&&U.restore?.map===U.map.slug?U.restore:null;if(U.renderedShard!==(n.shard||0)&&(NI(),Yl()),v?.center&&Number.isFinite(v.zoom)){let w=U.engine.getView();w.setCenter(v.center),w.setZoom(v.zoom),U.fitZoom=v.zoom,nA()}else e?requestAnimationFrame(L4e):(r&&U.engine.getView().animate({center:r,duration:200}),nA());Lc()}function u4(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=I4e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function I4e(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 Mu(i){return i.maxZoom+2}function ix(){nA(),Lc()}function N4e(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+vs(r,0,1)*e.bounds.width,-(e.bounds.y+vs(s,0,1)*e.bounds.height)]}function Kie(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");we.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>U.engine?.updateSize())}function $l(){let i=U.game.tileGrid.size,e=U.variant?.bounds||{x:0,y:0,width:i,height:i};return[e.x,-(e.y+e.height),e.x+e.width,-e.y]}function L4e(){if(!U.engine||!U.variant)return;let i=U.engine.getView();i.fit($l(),{size:U.engine.getSize(),padding:[36,36,36,36],maxZoom:U.variant.maxZoom,duration:0}),U.fitZoom=i.getZoom()||0,nA()}function Wb(i){let e=U.engine.getView(),t=e.getZoom()||0;e.animate({zoom:vs(t+i,U.variant.minZoom,Mu(U.variant)),duration:140})}function nA(){let i=U.engine?.getView().getZoom();if(we.viewport.dataset.zoom=Number.isFinite(i)?i.toFixed(3):"",!U.engine||!U.pins.length){we.visibleCount.textContent="0 locations visible";return}let e=U.engine.getView().calculateExtent(U.engine.getSize()),t=0;for(let n of U.pins){if(Ql(n))continue;let[r,s]=n.coordinate;r>=e[0]&&r<=e[2]&&s>=e[1]&&s<=e[3]&&t++}we.visibleCount.textContent=`${Oc(U.eligibleLocations)} enabled \xB7 ${Oc(t)} in view`}function Qie(){we.game.addEventListener("change",()=>{hf(we.game.value)}),we.map.addEventListener("change",()=>{Jk(we.map.value)}),we.addBundles.addEventListener("click",()=>{UI()}),we.emptyOpen.addEventListener("click",()=>{UI()}),we.variant.addEventListener("change",()=>{e9(Number(we.variant.value)),$ie()}),we.globeToggle.addEventListener("click",()=>a4()),we.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){UV(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),Yl(),Rd()});let i=null,e=()=>{for(let s of we.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&&we.layers.contains(r)&&r.classList.add("is-hovered")};we.layers.addEventListener("pointermove",n=>{i={x:n.clientX,y:n.clientY},e()},{passive:!0}),we.layers.addEventListener("pointerleave",()=>{i=null,e()}),we.layers.addEventListener("scroll",e,{passive:!0}),we.layers.addEventListener("click",n=>{let r=n.target.closest("[data-only-category], [data-only-section]");if(r){n.preventDefault(),n.stopPropagation(),kV(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),hS()}),we.soloChip.addEventListener("click",()=>Hx(!0)),nn("#expand-all").addEventListener("click",()=>OI(!1)),nn("#collapse-all").addEventListener("click",()=>OI(!0)),nn("#show-all").addEventListener("click",()=>Hx(!0)),nn("#hide-all").addEventListener("click",()=>Hx(!1)),we.zoneToggle.addEventListener("change",()=>{cS(we.zoneToggle.checked)}),we.zoneIndex.addEventListener("click",n=>{let r=n.target.closest("[data-zone]");r&&IV(Number(r.dataset.zone))}),we.zoneIndex.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),NV(Number(r.dataset.zone)))}),we.search.addEventListener("input",()=>{U.search=we.search.value.trim().toLocaleLowerCase(),Yl(),U.search&&Zw()}),we.dockFold.addEventListener("click",()=>{sI(!U.dockFolded)}),we.searchResults.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&oI(s)}),we.detailLinks.addEventListener("click",n=>{let r=n.target.closest("[data-location]");if(!r)return;let s=U.pinByID.get(Number(r.dataset.location));s&&oI(s)}),nn("#close-detail").addEventListener("click",Dc),nn("#zoom-in").addEventListener("click",()=>U.globeActive?Yk(1):Wb(1)),nn("#zoom-out").addEventListener("click",()=>U.globeActive?Yk(-1):Wb(-1)),we.gridBack.addEventListener("click",iI),we.gridInput.addEventListener("input",()=>{let n=Ed(),r=[...we.gridInput.value.toLocaleLowerCase()].filter(s=>Hl.includes(s)).slice(0,n).join("");we.gridInput.value=r,Z0(r)}),we.subgridToggle.addEventListener("click",()=>{Ix(!U.subgridVisible),we.viewport.focus({preventScroll:!0})}),we.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Ix(!U.subgridVisible);return}if(n.key==="`"){n.preventDefault(),we.globeToggle.hidden||a4();return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),we.viewport.focus({preventScroll:!0}))}),we.viewport.addEventListener("keydown",n=>{if(!Yw(n.target)){if(n.key==="+"||n.key==="=")Wb(1);else if(n.key==="-")Wb(-1);else if(n.key==="Escape")Dc();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{Yw(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if(!Yw(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){we.globeToggle.hidden||(n.preventDefault(),a4());return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="k"){n.preventDefault(),we.search.focus(),we.search.select();return}if((n.metaKey||n.ctrlKey)&&n.altKey&&n.code==="KeyB"){n.preventDefault(),we.dock.hidden||sI(!U.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),Kie();return}kz(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||uS(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&uS(!1)}),window.addEventListener("blur",()=>uS(!1)),window.addEventListener("hashchange",()=>{let n=Mg();n.game===U.game?.slug&&n.map===U.map?.slug||(U.restore=null,hf(n.game||U.catalog.games[0].slug,n.map))}),window.addEventListener("resize",()=>{U.engine?.updateSize(),nx(),Zk()}),document.addEventListener("atlas:globe-camera",()=>nx()),we.overview.addEventListener("pointerdown",n=>{U.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),we.overview.setPointerCapture(n.pointerId),U.overviewPointer=n.pointerId,Kk(n,!0))}),we.overview.addEventListener("pointermove",n=>{U.overviewPointer===n.pointerId&&(n.preventDefault(),Kk(n,!1))});let t=n=>{U.overviewPointer===n.pointerId&&(U.overviewPointer=null,ix())};we.overview.addEventListener("pointerup",t),we.overview.addEventListener("pointercancel",t),we.overviewDock.addEventListener("click",()=>{c4(!U.overviewDocked),we.viewport.focus({preventScroll:!0})}),we.mobileLegend.addEventListener("click",()=>{let n=we.sidebar.classList.toggle("is-open");we.mobileLegend.setAttribute("aria-expanded",String(n))})}function Jie(){let i=()=>({game:U.game?.title,map:U.map?.title,variant:U.variant?.name,zoom:U.engine?.getView().getZoom(),center:U.engine?.getView().getCenter(),resolution:U.engine?.getView().getResolution(),nativeMaxZoom:U.variant?.maxZoom,maxZoom:U.variant?Mu(U.variant):null,interpolate:U.variant?.interpolate,tileStats:{...U.tileStats},pins:U.pins.length,eligibleLocations:U.eligibleLocations,domNodes:document.querySelectorAll("*").length,canvases:document.querySelectorAll("canvas").length,rasterCacheSize:64,labelsHeld:U.labelsHeld,hoveredPin:U.hoveredPin?.location.title||null,selectedPin:U.selectedPin?.location.title||null,fitZoom:U.fitZoom,filters:{hiddenCategories:[...U.hiddenCategories].sort(),collapsedSections:[...U.collapsedSections].sort()},ui:{sidebarCollapsed:document.querySelector(".app-shell")?.classList.contains("sidebar-collapsed")??!1,detailOpen:!we.detail.hidden,detailTitle:we.detail.hidden?null:we.detailTitle.textContent||null,searchQuery:U.search,searchResultsVisible:!we.searchResults.hidden,soloChip:we.soloChip.hidden?null:we.soloChip.textContent,visibleCountText:we.visibleCount.textContent,overviewDocked:U.overviewDocked,dockFolded:U.dockFolded,dockDismissed:U.dockDismissed,subgridVisible:U.subgridVisible},zones:{visible:U.zonesVisible,count:U.zoneRecords.size,focused:U.zoneRecords.get(U.focusedZoneID)?.zone.title||null,highlighted:[...U.highlightedZones].map(e=>U.zoneRecords.get(e)?.zone.title).filter(Boolean),focusedPins:U.pins.filter(e=>!e.filteredHidden&&e.insideHighlightedZone).length},grid:{enabled:U.gridEnabled,prefix:U.gridPrefix,maximumDepth:Ed(),extent:U.gridEnabled?Rg():null,cells:[...U.sources.grid.getFeatures(),...U.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:U.gridPrefix?U.pins.filter(e=>!e.filteredHidden&&Md(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>U.layers[e]?.setVisible(t),refreshCatalog:iA},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 ere(){Qie();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(),O0(we.game,U.catalog.games,"title"),BI(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{iA()}),U.catalog.games.length){let e=Mg(),t=Eg(),n=t&&(!e.game||e.game===t.game&&e.map===t.map);U.restore=n?t:null,await hf(e.game||t?.game||U.catalog.games[0].slug,e.map||t?.map),U.restore=null}else we.loading.hidden=!0;Jie(),requestAnimationFrame(()=>we.viewport.focus({preventScroll:!0}))}catch(i){we.loading.hidden=!0,we.fatalMessage.textContent=i instanceof Error?i.message:String(i),we.fatal.hidden=!1}}ere();})();
M frontend/src/engine.js +9 -3
M frontend/src/events.js +7 -0
M frontend/src/globe.js +99 -1
@@ -72,6 +72,10 @@ const detail = { group: null, tiles: new Map(), key: "", variant: "" };
7272 // The geohash grid drawn on the sphere: cell boundaries and their letters,7373 // rebuilt from the same plan the chart tiles its cells from.7474 const grid = { group: null, prefix: null };75+// The names held up while Z is down: label sprites over the pins nearest76+// the camera, rebuilt as the view settles and dropped on release.77+const labels = { group: null, key: "" };78+const labelBudget = 180;7579 // The pins the standing sprites were built from. The renderer creates7680 // sprites lazily on its own tick, so nothing here may assume they exist7781 // the moment the data is handed over -- each sprite is born already
@@ -97,6 +101,8 @@ export function syncGlobe() {
97101 detail.group = null;98102 grid.group = null;99103 grid.prefix = null;104+ labels.group = null;105+ labels.key = "";100106 globe._destructor();101107 globe = null;102108 texturedFor = "";
@@ -223,15 +229,18 @@ async function enterGlobe() {
223229 .onZoom(() => {224230 document.dispatchEvent(new Event("atlas:globe-camera"));225231 updateDetailTiles();232+ rebuildGlobeLabels();226233 });227234 document.addEventListener("atlas:selection", syncSelection);228235 document.addEventListener("atlas:filters", syncFilters);229236 // A grid change moves both the boundaries and which pins are held to230- // the chosen cell.237+ // the chosen cell -- and which names Z is holding up.231238 document.addEventListener("atlas:grid", () => {232239 rebuildGlobeGrid();233240 syncFilters();241+ rebuildGlobeLabels();234242 });243+ document.addEventListener("atlas:labels", rebuildGlobeLabels);235244 // A cell chosen on the sphere is chosen the way the chart chooses it:236245 // the point pressed names its next-deeper cell through the same237246 // reverse-halving the navigator types.
@@ -253,6 +262,11 @@ async function enterGlobe() {
253262 globe.scene().add(detail.group);254263 grid.group = new Group();255264 globe.scene().add(grid.group);265+ labels.group = new Group();266+ globe.scene().add(labels.group);267+ // A window on the globe's working parts for the parity harness and a268+ // plain browser: counts, never control.269+ window.__atlasGlobe = { detail, grid, labels, sprites };256270 }257271 resizeGlobe();258272
@@ -286,6 +300,7 @@ async function enterGlobe() {
286300 restyleSelection();287301 updateDetailTiles();288302 rebuildGlobeGrid();303+ rebuildGlobeLabels();289304 document.dispatchEvent(new Event("atlas:globe-camera"));290305 }291306
@@ -320,6 +335,89 @@ function rebuildGlobeGrid() {
320335 grid.prefix = state.gridPrefix;321336 }322337 338+// rebuildGlobeLabels raises names over the pins while Z is held: the ones339+// nearest what the camera faces, within a budget -- a planet of two340+// thousand names at once is noise, and the chart's own flood is bounded by341+// its window the same way. Rebuilt as the camera settles, dropped on342+// release.343+function rebuildGlobeLabels() {344+ if (!globe || !labels.group) return;345+ const wanted = state.globeActive && state.labelsHeld;346+ const pov = wanted ? globe.pointOfView() : null;347+ const key = wanted348+ ? `${Math.round(pov.lat)}:${Math.round(pov.lng)}:${pov.altitude.toFixed(2)}:${state.gridPrefix}`349+ : "";350+ if (key === labels.key) return;351+ labels.key = key;352+ for (const child of [...labels.group.children]) {353+ labels.group.remove(child);354+ child.material?.map?.dispose();355+ child.material?.dispose();356+ }357+ if (!wanted) return;358+359+ const nearby = [];360+ for (const [pin, sprite] of sprites) {361+ if (!sprite.visible) continue;362+ const stood = placed.get(pin);363+ if (!stood) continue;364+ const distance = angularDistance(pov, stood);365+ if (distance > 85) continue;366+ nearby.push({ pin, stood, distance });367+ }368+ nearby.sort((a, b) => a.distance - b.distance);369+ for (const { pin, stood } of nearby.slice(0, labelBudget)) {370+ labels.group.add(labelSprite(pin, stood));371+ }372+}373+374+// angularDistance is the great-circle separation in degrees, which is what375+// "near what the camera faces" means on a sphere.376+function angularDistance(a, b) {377+ const rad = Math.PI / 180;378+ const inner =379+ Math.sin(a.lat * rad) * Math.sin(b.lat * rad) +380+ Math.cos(a.lat * rad) * Math.cos(b.lat * rad) * Math.cos((a.lng - b.lng) * rad);381+ return (Math.acos(clamp(inner, -1, 1)) * 180) / Math.PI;382+}383+384+// labelSprite writes one pin's name on a small card floated above its385+// marker, screen-sized like the marker itself.386+function labelSprite(pin, stood) {387+ const title = pin.location.title;388+ const canvas = document.createElement("canvas");389+ const context = canvas.getContext("2d");390+ const font = "600 26px Inter, system-ui, sans-serif";391+ context.font = font;392+ const width = Math.ceil(context.measureText(title).width) + 24;393+ canvas.width = width;394+ canvas.height = 40;395+ context.font = font;396+ context.textAlign = "center";397+ context.textBaseline = "middle";398+ context.fillStyle = "rgba(10, 13, 17, 0.78)";399+ context.fillRect(0, 0, width, 40);400+ context.fillStyle = "#e6ebf0";401+ context.fillText(title, width / 2, 21);402+ const material = new SpriteMaterial({403+ depthWrite: false,404+ sizeAttenuation: false,405+ transparent: true,406+ });407+ new TextureLoader().load(canvas.toDataURL("image/png"), (texture) => {408+ material.map = texture;409+ material.needsUpdate = true;410+ });411+ const sprite = new Sprite(material);412+ sprite.position.set(...surfacePoint(stood.lat, stood.lng, detailRadius + 0.4));413+ const height = 0.028;414+ sprite.scale.set((height * width) / 40, height, 1);415+ // Anchored at its bottom edge -- the far end of center's 0..1 contract --416+ // the card floats above the marker instead of covering it.417+ sprite.center.set(0.5, 0);418+ return sprite;419+}420+323421 // cellCorners lands a cell's chart extent on the sphere: latitudes and324422 // longitudes of its frame, through the map's declared flattening.325423 function cellCorners(extent, mapping) {
M frontend/src/navigation.js +8 -3
M frontend/src/pins.js +3 -0