The globe wore one static skin -- the whole planet composited at the orbit-reading level -- and past that depth it could only stretch. Now the pyramid follows the camera: closer than the skin can answer, the level the altitude asks for is fetched tile by tile around the point being faced, each tile a perfect square of latitude and longitude draped just off the surface through the same coordinate spelling the pins stand by. The neighborhood is bounded by the horizon and a tile budget, replaced as the camera moves, and disposed when the reader returns to the chart; far from the camera the base skin carries on. The same ground now reads as sharply on the sphere as on the sheet, because both are reading the same tiles.
- commit
- 54bdf2b6ccb59da31a1e44b9824f67b7ef6a9c5d
- parent
- 0208b20e5801c51528a03af843197d5ab30366f4
- author
- Dami <dami.etoile@gmail.com>
| M | assets/ | 500 | +++++++++++++++--------------- |
| M | frontend/ | 183 | +++++++++++- |
@@ -1,18 +1,18 @@
1-(()=>{var xse=Object.create;var I4=Object.defineProperty;var yse=Object.getOwnPropertyDescriptor;var vse=Object.getOwnPropertyNames;var bse=Object.getPrototypeOf,wse=Object.prototype.hasOwnProperty;var Sse=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},Tse=(i,e)=>{for(var t in e)I4(i,t,{get:e[t],enumerable:!0})},Ese=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of vse(e))!wse.call(i,r)&&r!==t&&I4(i,r,{get:()=>e[r],enumerable:!(n=yse(e,r))||n.enumerable});return i};var Mse=(i,e,t)=>(t=i!=null?xse(bse(i)):{},Ese(e||!i||!i.__esModule?I4(t,"default",{value:i,enumerable:!0}):t,i));var g$=Sse((uv,g6)=>{(function(i,e){typeof uv=="object"&&typeof g6=="object"?g6.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof uv=="object"?uv.FrameTicker=e():i.FrameTicker=e()})(uv,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 L9=i=>new Promise(e=>setTimeout(e,i)),rs=i=>document.querySelector(i);async function Cse(){for(let i=0;i<300&&!(window.__atlasDebug&&!rs("#map-loading")?.checkVisibility?.());i+=1)await L9(100)}async function Rse(){let i="";for(let e=0;e<100;e+=1){await L9(120),await new Promise(r=>requestAnimationFrame(r)),window.advanceTime?.();let t=window.__atlasDebug.snapshot(),n=JSON.stringify([t.zoom,t.center,t.resolution,t.tileStats]);if(n===i)return;i=n}}function ld(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function Pse(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function Ise(i){rs("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function C0(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function N4(i,e){let t=rs(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function L4(i,e=!1){let t=rs("#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 Nse(){let i=[],e=async p=>{await Rse(),i.push({name:p,snapshot:JSON.parse(window.render_game_to_text())})};await Cse(),localStorage.clear();let t=rs("#game-select"),n=t.options[0].value;C0(t,n),await e("initial"),N4("#pin-search","a"),await e("search-a");let r=rs(".search-result");r&&(r.click(),await e("search-select-first"),rs("#close-detail").click(),await e("detail-closed")),N4("#pin-search",""),await e("search-cleared");let s=rs(".category-row input");s&&(s.click(),await e("category-hidden"),s.click(),await e("category-restored"));let o=rs(".only-button");if(o){o.click(),await e("solo-first");let p=rs("#solo-chip");p&&!p.hidden&&p.click(),await e("solo-cleared")}let a=rs("#legend .layer-title");a&&(a.click(),await e("section-folded"),rs("#expand-all").click(),await e("sections-unfolded")),rs("#hide-all").click(),await e("all-hidden"),rs("#show-all").click(),await e("all-shown");let l=rs(".zone-index-item");l&&(l.click(),await e("zone-jumped"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await e("zone-highlighted"),l.dispatchEvent(new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0})),await e("zone-unhighlighted")),ld("g"),await e("grid-open"),N4("#grid-input","m"),await e("grid-descended"),ld(" "),await e("subgrid-hidden"),ld(" "),ld("Escape"),await e("grid-ascended"),ld("Escape"),await e("grid-closed"),ld("z"),await e("labels-on"),Pse("z"),await e("labels-off"),ld("b",{metaKey:!0}),await e("sidebar-collapsed"),ld("b",{metaKey:!0}),await e("sidebar-restored"),rs("#zoom-in").click(),await e("zoomed-in");let c=rs("#overview-dock");c&&!rs("#overview-shelf").hidden&&(c.click(),await e("overview-docked"),c.click(),await e("overview-undocked")),rs("#zoom-out").click(),await e("zoomed-out"),Ise("Escape"),await e("viewport-escape");let u=rs("#variant-select");u.options.length>1&&(C0(u,u.options[1].value),await e("variant-second"),C0(u,u.options[0].value),await e("variant-first"));let f=rs("#map-select");return f.options.length>1&&(C0(f,f.options[1].value),await e("map-second"),C0(f,f.options[0].value),await e("map-first")),t.options.length>1&&(C0(t,t.options[1].value),await e("game-second"),C0(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var D4=!1;async function D9(){if(!D4){D4=!0,L4("parity tour running\u2026");try{let i=await Nse(),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}`);L4(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){L4(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{D4=!1}}}window.__atlasTour=D9;window.addEventListener("keydown",i=>{i.key==="F9"&&D9()});var nn=i=>document.querySelector(i),we={game:nn("#game-select"),map:nn("#map-select"),variant:nn("#variant-select"),variantField:nn("#variant-field"),legend:nn("#legend"),search:nn("#pin-search"),searchResults:nn("#dock-results"),dock:nn("#dock"),dockCount:nn("#dock-count"),dockFlag:nn("#dock-flag"),dockFold:nn("#dock-fold"),dockRailName:nn("#dock-rail-name"),visibleCount:nn("#visible-count"),viewport:nn("#map"),globe:nn("#globe"),globeToggle:nn("#globe-toggle"),layers:nn("#layers"),zoneToggle:nn("#zone-toggle"),zoneCount:nn("#zone-count"),zoneIndex:nn("#zone-index"),zoneList:nn("#zone-list"),loading:nn("#map-loading"),labelsHint:nn("#labels-hint"),gridHint:nn("#grid-hint"),soloChip:nn("#solo-chip"),overview:nn("#overview"),overviewShelf:nn("#overview-shelf"),overviewDock:nn("#overview-dock"),overviewCanvas:nn("#overview-canvas"),overviewViewport:nn("#overview-viewport"),gridNavigator:nn("#grid-navigator"),gridInput:nn("#grid-input"),gridBack:nn("#grid-back"),subgridToggle:nn("#subgrid-toggle"),detail:nn("#pin-detail"),detailTitle:nn("#detail-title"),detailCategory:nn("#detail-category"),detailDescription:nn("#detail-description"),detailID:nn("#detail-id"),detailCoordinates:nn("#detail-coordinates"),detailCell:nn("#detail-cell"),detailCellField:nn("#detail-cell-field"),detailSource:nn("#detail-source"),detailSourceField:nn("#detail-source-field"),detailLinks:nn("#detail-links"),detailDot:nn("#detail-dot"),sidebar:nn("#sidebar"),mobileLegend:nn("#mobile-legend"),fatal:nn("#fatal-error"),fatalMessage:nn("#fatal-message"),emptyState:nn("#empty-state"),emptyPath:nn("#empty-path"),emptyOpen:nn("#empty-open"),addBundles:nn("#add-bundles")};function R0(i,e,t,n){i.replaceChildren(),e.forEach((r,s)=>{let o=document.createElement("option");o.value=n?String(r[n]):r.slug||String(s),o.textContent=r[t],i.append(o)})}var 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 Jm=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],Gl="0123456789bcdefghjkmnpqrstuvwxyz";var F4="atlas.session";var F9={light:"rgba(255, 255, 255, 0.96)",dark:"rgba(7, 9, 7, 0.98)"};var As={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function O4(i){let e=Er();for(let t=0,n=i.length;t<n;++t)N0(e,i[t]);return e}function Lse(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 ll(n,r,s,o,t)}function eg(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 Jb(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function cd(i,e,t){let n,r;return e<i[0]?n=i[0]-e:i[2]<e?n=e-i[2]:n=0,t<i[1]?r=i[1]-t:i[3]<t?r=t-i[3]:r=0,n*n+r*r}function xc(i,e){return cx(i,e[0],e[1])}function pu(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function cx(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function Qb(i,e){let t=i[0],n=i[1],r=i[2],s=i[3],o=e[0],a=e[1],l=As.UNKNOWN;return o<t?l=l|As.LEFT:o>r&&(l=l|As.RIGHT),a<n?l=l|As.BELOW:a>s&&(l=l|As.ABOVE),l===As.UNKNOWN&&(l=As.INTERSECTING),l}function Er(){return[1/0,1/0,-1/0,-1/0]}function ll(i,e,t,n,r){return r?(r[0]=i,r[1]=e,r[2]=t,r[3]=n,r):[i,e,t,n]}function P0(i){return ll(1/0,1/0,-1/0,-1/0,i)}function ew(i,e){let t=i[0],n=i[1];return ll(t,n,t,n,e)}function tg(i,e,t,n,r){let s=P0(r);return B4(s,i,e,t,n)}function I0(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function tw(i,e){return e[0]<i[0]&&(i[0]=e[0]),e[2]>i[2]&&(i[2]=e[2]),e[1]<i[1]&&(i[1]=e[1]),e[3]>i[3]&&(i[3]=e[3]),i}function N0(i,e){e[0]<i[0]&&(i[0]=e[0]),e[0]>i[2]&&(i[2]=e[0]),e[1]<i[1]&&(i[1]=e[1]),e[1]>i[3]&&(i[3]=e[1])}function B4(i,e,t,n,r){for(;t<n;t+=r)Dse(i,e[t],e[t+1]);return i}function Dse(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 nw(i,e){let t;return t=e(ng(i)),t||(t=e(ig(i)),t)||(t=e(rg(i)),t)||(t=e(zl(i)),t)?t:!1}function ux(i){let e=0;return mu(i)||(e=Wn(i)*gr(i)),e}function ng(i){return[i[0],i[1]]}function ig(i){return[i[2],i[1]]}function Ba(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function O9(i,e){let t;if(e==="bottom-left")t=ng(i);else if(e==="bottom-right")t=ig(i);else if(e==="top-left")t=zl(i);else if(e==="top-right")t=rg(i);else throw new Error("Invalid corner");return t}function hx(i,e,t,n,r){let[s,o,a,l,c,u,f,p]=U4(i,e,t,n);return ll(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 U4(i,e,t,n){let r=e*n[0]/2,s=e*n[1]/2,o=Math.cos(t),a=Math.sin(t),l=r*o,c=r*a,u=s*o,f=s*a,p=i[0],x=i[1];return[p-l+f,x-c-u,p-l-f,x-c+u,p+l-f,x+c+u,p+l+f,x+c-u,p-l+f,x-c-u]}function gr(i){return i[3]-i[1]}function Au(i,e,t){let n=t||Er();return _r(i,e)?(i[0]>e[0]?n[0]=i[0]:n[0]=e[0],i[1]>e[1]?n[1]=i[1]:n[1]=e[1],i[2]<e[2]?n[2]=i[2]:n[2]=e[2],i[3]<e[3]?n[3]=i[3]:n[3]=e[3]):P0(n),n}function k4(i,e){if(!_r(i,e))return[i.slice()];if(pu(e,i))return[];let[t,n,r,s]=i,o=Math.max(t,e[0]),a=Math.max(n,e[1]),l=Math.min(r,e[2]),c=Math.min(s,e[3]),u=[];return o>t&&u.push([t,n,o,s]),l<r&&u.push([l,n,r,s]),a>n&&u.push([o,n,l,a]),c<s&&u.push([o,c,l,s]),u}function zl(i){return[i[0],i[3]]}function rg(i){return[i[2],i[3]]}function Wn(i){return i[2]-i[0]}function _r(i,e){return i[0]<=e[2]&&i[2]>=e[0]&&i[1]<=e[3]&&i[3]>=e[1]}function mu(i){return i[2]<i[0]||i[3]<i[1]}function B9(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function U9(i,e,t){let n=!1,r=Qb(i,e),s=Qb(i,t);if(r===As.INTERSECTING||s===As.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&As.ABOVE&&!(r&As.ABOVE)&&(w=p-(x-c)/v,n=w>=o&&w<=l),!n&&s&As.RIGHT&&!(r&As.RIGHT)&&(S=x-(p-l)*v,n=S>=a&&S<=c),!n&&s&As.BELOW&&!(r&As.BELOW)&&(w=p-(x-a)/v,n=w>=o&&w<=l),!n&&s&As.LEFT&&!(r&As.LEFT)&&(S=x-(p-o)*v,n=S>=a&&S<=c)}return n}function k9(i,e,t,n){if(mu(i))return P0(t);let r=[];if(n>1){let a=i[2]-i[0],l=i[3]-i[1];for(let c=0;c<n;++c)r.push(i[0]+a*c/n,i[1],i[2],i[1]+l*c/n,i[2]-a*c/n,i[3],i[0],i[3]-l*c/n)}else r=[i[0],i[1],i[2],i[1],i[2],i[3],i[0],i[3]];e(r,r,2);let s=[],o=[];for(let a=0,l=r.length;a<l;a+=2)s.push(r[a]),o.push(r[a+1]);return Lse(s,o,t)}function G4(i,e){let t=e.getExtent(),n=Ba(i);if(e.canWrapX()&&(n[0]<t[0]||n[0]>=t[2])){let r=Wn(t),o=Math.floor((n[0]-t[0])/r)*r;i[0]-=o,i[2]-=o}return i}function iw(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]]];G4(i,e);let r=Wn(n);if(Wn(i)>r&&!t)return[[n[0],i[1],n[2],i[3]]];if(i[0]<n[0])return[[i[0]+r,i[1],n[2],i[3]],[n[0],i[1],i[2],i[3]]];if(i[2]>n[2])return[[i[0],i[1],n[2],i[3]],[n[0],i[1],i[2]-r,i[3]]]}return[i]}function G9(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(...k4(t[o],e[n]));t=s}return t}var z9={info:1,warn:2,error:3,none:4},Fse=z9.info;function rw(...i){Fse>z9.warn||console.warn(...i)}function _i(i,e,t){return Math.min(Math.max(i,e),t)}function V9(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 yc(i,e,t,n)}function yc(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function q9(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 sw(i){return i*180/Math.PI}function vc(i){return i*Math.PI/180}function gu(i,e){let t=i%e;return t*e<0?t+e:t}function Po(i,e,t){return i+t*(e-i)}function L0(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function fx(i,e){return Math.floor(L0(i,e))}function dx(i,e){return Math.ceil(L0(i,e))}function ow(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function H9(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function D0(i,e){let t=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=e[n]){t=!1;break}return t}function sg(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 W9(i,e){return i[0]*=e,i[1]*=e,i}function aw(i,e){if(e.canWrapX()){let t=Wn(e.getExtent()),n=j9(i,e,t);n&&(i[0]-=n*t)}return i}function j9(i,e,t){let n=e.getExtent(),r=0;return e.canWrapX()&&(i[0]<n[0]||i[0]>n[2])&&(t=t||Wn(n),r=Math.floor((i[0]-n[0])/t)),r}function X9(i,e,t){let n=Math.sqrt((e[0]-i[0])*(e[0]-i[0])+(e[1]-i[1])*(e[1]-i[1])),r=[(e[0]-i[0])/n,(e[1]-i[1])/n],s=[-r[1],r[0]],o=Math.sqrt((t[0]-i[0])*(t[0]-i[0])+(t[1]-i[1])*(t[1]-i[1])),a=[(t[0]-i[0])/o,(t[1]-i[1])/o],l=n===0||o===0?0:Math.acos(_i(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:Math.PI*2-l}var $h={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_||$h[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},ud=z4;var px=6378137,og=Math.PI*px,Ose=[-og,-og,og,og],Bse=[-180,-85,180,85],lw=px*Math.log(Math.tan(Math.PI/2)),hd=class extends ud{constructor(e){super({code:e,units:"m",extent:Ose,global:!0,worldExtent:Bse,getPointResolution:function(t,n){return t/Math.cosh(n[1]/px)}})}},V4=[new hd("EPSG:3857"),new hd("EPSG:102100"),new hd("EPSG:102113"),new hd("EPSG:900913"),new hd("http://www.opengis.net/def/crs/EPSG/0/3857"),new hd("http://www.opengis.net/gml/srs/epsg.xml#3857")];function $9(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]=og*i[s]/180;let o=px*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>lw?o=lw:o<-lw&&(o=-lw),e[s+1]=o}return e}function Y9(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]/og,e[s+1]=360*Math.atan(Math.exp(i[s+1]/px))/Math.PI-90;return e}var Use=6378137,Z9=[-180,-90,180,90],kse=Math.PI*Use/180,Yh=class extends ud{constructor(e,t){super({code:e,units:"degrees",extent:Z9,axisOrientation:t,global:!0,metersPerUnit:kse,worldExtent:Z9})}},q4=[new Yh("CRS:84"),new Yh("EPSG:4326","neu"),new Yh("urn:ogc:def:crs:OGC:1.3:CRS84"),new Yh("urn:ogc:def:crs:OGC:2:84"),new Yh("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Yh("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Yh("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var H4={};function K9(i){return H4[i]||H4[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function Q9(i,e){H4[i]=e}function _u(i){for(let e in i)delete i[e]}function bc(i){let e;for(e in i)return!1;return!e}var ag={};function lg(i,e,t){let n=i.getCode(),r=e.getCode();n in ag||(ag[n]={}),ag[n][r]=t}function cw(i,e){return i in ag&&e in ag[i]?ag[i][e]:null}var uw=.9996,Vl=.00669438,fw=Vl*Vl,dw=fw*Vl,F0=Vl/(1-Vl),J9=Math.sqrt(1-Vl),cg=(1-J9)/(1+J9),iG=cg*cg,W4=iG*cg,j4=W4*cg,rG=j4*cg,sG=1-Vl/4-3*fw/64-5*dw/256,Gse=3*Vl/8+3*fw/32+45*dw/1024,zse=15*fw/256+45*dw/1024,Vse=35*dw/3072,qse=3/2*cg-27/32*W4+269/512*rG,Hse=21/16*iG-55/32*j4,Wse=151/96*W4-417/128*rG,jse=1097/512*j4,hw=6378137;function Xse(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/uw/(hw*sG),a=o+qse*Math.sin(2*o)+Hse*Math.sin(4*o)+Wse*Math.sin(6*o)+jse*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-Vl*c,w=Math.sqrt(1-Vl*c),S=hw/w,T=(1-Vl)/v,P=F0*u**2,R=P*P,C=n/(S*uw),L=C*C,D=L*C,F=D*C,N=F*C,B=N*C,z=a-f/T*(L/2-F/24*(5+3*p+10*P-4*R-9*F0))+B/720*(61+90*p+298*P+45*x-252*F0-3*R),V=(C-D/6*(1+2*p+P)+N/120*(5-2*P+28*p-3*R+8*F0+24*x))/u;return V=ow(V+vc(oG(t.number)),-Math.PI,Math.PI),[sw(V),sw(z)]}var eG=-80,tG=84,$se=-180,Yse=180;function Zse(i,e,t){i=ow(i,$se,Yse),e<eG?e=eG:e>tG&&(e=tG);let n=vc(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=vc(i),u=oG(t.number),f=vc(u),p=hw/Math.sqrt(1-Vl*r**2),x=F0*s**2,v=s*ow(c-f,-Math.PI,Math.PI),w=v*v,S=w*v,T=S*v,P=T*v,R=P*v,C=hw*(sG*n-Gse*Math.sin(2*n)+zse*Math.sin(4*n)-Vse*Math.sin(6*n)),L=uw*p*(v+S/6*(1-a+x)+P/120*(5-18*a+l+72*x-58*F0))+5e5,D=uw*(C+p*o*(w/2+T/24*(5-a+9*x+4*x**2)+R/720*(61-58*a+l+600*x-330*F0)));return t.north||(D+=1e7),[L,D]}function oG(i){return(i-1)*6-180+3}var Kse=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function aG(i){let e=0;for(let r of Kse){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 nG(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 lG(i){return aG(i)?new ud({code:i,units:"m"}):null}function cG(i){let e=aG(i.getCode());return e?{forward:nG(Zse,e),inverse:nG(Xse,e)}:null}var Qse=63710088e-1;function X4(i,e,t){t=t||Qse;let n=vc(i[1]),r=vc(e[1]),s=(r-n)/2,o=vc(e[0]-i[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*t*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}var Jse=[cG],eoe=[lG];var Y4=!0;function hG(i){Y4=!(i===void 0?!0:i)}function K4(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 Z4(i){Q9(i.getCode(),i),lg(i,i,K4)}function toe(i){i.forEach(Z4)}function ms(i){if(typeof i!="string")return i;let e=K9(i);if(e)return e;for(let t of eoe){let n=t(i);if(n)return n}return null}function Q4(i,e,t,n){i=ms(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/$h[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=O0(i,ms("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=X4(c.slice(0,2),c.slice(2,4)),f=X4(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?$h[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function uG(i){toe(i),i.forEach(function(e){i.forEach(function(t){e!==t&&lg(e,t,K4)})})}function noe(i,e,t,n){i.forEach(function(r){e.forEach(function(s){lg(r,s,t),lg(s,r,n)})})}function pw(i,e){return i?typeof i=="string"?ms(i):i:ms(e)}function fG(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 ug(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||O0(i,e)===K4)&&t}function O0(i,e){let t=i.getCode(),n=e.getCode(),r=cw(t,n);if(r)return r;let s=null,o=null;for(let l of Jse)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=$4(s.inverse,o.forward);else{let l=cw(t,a);l&&(r=$4(l,o.forward))}else{let l=cw(a,n);l&&(r=$4(s.inverse,l))}return r&&(Z4(i),Z4(e),lg(i,e,r)),r}function $4(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function B0(i,e){let t=ms(i),n=ms(e);return O0(t,n)}function hg(i,e,t){let n=B0(e,t);if(!n){let r=ms(e).getCode(),s=ms(t).getCode();throw new Error(`No transform available between ${r} and ${s}`)}return n(i,void 0,i.length)}function dG(i,e,t,n){let r=B0(e,t);return k9(i,r,void 0,n)}var wc=null;function U0(){return wc}function Ax(i,e){return wc?hg(i,e,wc):i}function Sc(i,e){return wc?hg(i,wc,e):(Y4&&!D0(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(Y4=!1,rw("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function fd(i,e){return wc?dG(i,e,wc):i}function Tc(i,e){return wc?dG(i,wc,e):i}function pG(i,e){if(!wc)return i;let t=ms(e).getMetersPerUnit(),n=wc.getMetersPerUnit();return t&&n?i*t/n:i}function ioe(){uG(V4),uG(q4),noe(q4,V4,$9,Y9)}ioe();function J4(i){return i[0]>0&&i[1]>0}function AG(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 qr(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var Aw=class{constructor(e,t,n,r){this.minX=e,this.maxX=t,this.minY=n,this.maxY=r}contains(e){return this.containsXY(e[1],e[2])}containsTileRange(e){return this.minX<=e.minX&&e.maxX<=this.maxX&&this.minY<=e.minY&&e.maxY<=this.maxY}containsXY(e,t){return this.minX<=e&&e<=this.maxX&&this.minY<=t&&t<=this.maxY}equals(e){return this.minX==e.minX&&this.minY==e.minY&&this.maxX==e.maxX&&this.maxY==e.maxY}extend(e){e.minX<this.minX&&(this.minX=e.minX),e.maxX>this.maxX&&(this.maxX=e.maxX),e.minY<this.minY&&(this.minY=e.minY),e.maxY>this.maxY&&(this.maxY=e.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(e){return this.minX<=e.maxX&&this.maxX>=e.minX&&this.minY<=e.maxY&&this.maxY>=e.minY}};function k0(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new Aw(i,e,t,n)}var mw=Aw;function mG(i,e,t){let n,r;t=t||Ua;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 Ua(i,e){return i>e?1:i<e?-1:0}function gG(i,e){return i<e?1:i>e?-1:0}function fg(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 _G(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Ec(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 Io(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 xG(i,e,t){let n=e||Ua;return i.every(function(r,s){if(s===0)return!0;let o=n(i[s-1],r);return!(o>0||t&&o===0)})}function zn(i,e){if(!i)throw new Error(e)}function yG(i,e,t,n,r){return!nw(r,function(o){return!dd(i,e,t,n,o[0],o[1])})}function dd(i,e,t,n,r,s){let o=0,a=i[t-n],l=i[t-n+1];for(;e<t;e+=n){let c=i[e],u=i[e+1];l<=s?u>s&&(c-a)*(s-l)-(r-a)*(u-l)>0&&o++:u<=s&&(c-a)*(s-l)-(r-a)*(u-l)<0&&o--,a=c,l=u}return o!==0}function mx(i,e,t,n,r,s){if(t.length===0||!dd(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(dd(i,t[o-1],t[o],n,r,s))return!1;return!0}function vG(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(mx(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 gw(i,e,t,n,r,s){return s=s??B4(Er(),i,e,t,n),_r(r,s)?s[0]>=r[0]&&s[2]<=r[2]||s[1]>=r[1]&&s[3]<=r[3]?!0:bG(i,e,t,n,function(o,a){return U9(r,o,a)}):!1}function eP(i,e,t,n,r){return!!(gw(i,e,t,n,r)||dd(i,e,t,n,r[0],r[1])||dd(i,e,t,n,r[0],r[3])||dd(i,e,t,n,r[2],r[1])||dd(i,e,t,n,r[2],r[3]))}function tP(i,e,t,n,r){if(!eP(i,e,t[0],n,r))return!1;if(t.length===1)return!0;for(let s=1,o=t.length;s<o;++s)if(yG(i,t[s-1],t[s],n,r)&&!gw(i,t[s-1],t[s],n,r))return!1;return!0}function wG(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(tP(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function $n(){throw new Error("Unimplemented abstract method.")}var roe=0;function Nn(i){return i.ol_uid||(i.ol_uid=String(++roe))}function dg(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function soe(i,e,t){return i+"/"+e+"/"+t}function pg(i,e,t,n,r){return`${Nn(i)},${e},${soe(t,n,r)}`}function SG(i){return ooe(i[0],i[1],i[2])}function ooe(i,e,t){return(e<<i)+t}function TG(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 Ag=[0,0,0],pd=5,nP=class{constructor(e){let t=e.minZoom,n=e.resolutions;t===void 0&&n&&(t=n.findIndex(o=>o!==void 0)),this.minZoom=t!==void 0?t:0,this.resolutions_=n,zn(xG(this.resolutions_,(o,a)=>a-o,!0),"`resolutions` must be sorted in descending order");let r;if(!e.origins){for(let o=0,a=this.resolutions_.length-1;o<a;++o)if(!r)r=this.resolutions_[o]/this.resolutions_[o+1];else if(this.resolutions_[o]/this.resolutions_[o+1]!==r){r=void 0;break}}this.zoomFactor_=r,this.maxZoom=this.resolutions_.length-1,this.origin_=e.origin!==void 0?e.origin:null,this.origins_=null,e.origins!==void 0&&(this.origins_=e.origins,zn(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));let s=e.extent;s!==void 0&&!this.origin_&&!this.origins_&&(this.origin_=zl(s)),zn(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,e.tileSizes!==void 0&&(this.tileSizes_=e.tileSizes,zn(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=e.tileSize!==void 0?e.tileSize:this.tileSizes_?null:256,zn(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=s!==void 0?s:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],e.tileRanges!==void 0?this.fullTileRanges_=e.tileRanges:e.sizes!==void 0?this.fullTileRanges_=e.sizes.map((o,a)=>{let l=new mw(Math.min(0,o[0]),Math.max(o[0]-1,-1),Math.min(0,o[1]),Math.max(o[1]-1,-1));if(s){let c=this.getTileRangeForExtentAndZ(s,a);l.minX=Math.max(c.minX,l.minX),l.maxX=Math.min(c.maxX,l.maxX),l.minY=Math.max(c.minY,l.minY),l.maxY=Math.min(c.maxY,l.maxY)}return l}):s&&this.calculateTileRanges_(s)}forEachTileCoord(e,t,n){let r=this.getTileRangeForExtentAndZ(e,t);for(let s=r.minX,o=r.maxX;s<=o;++s)for(let a=r.minY,l=r.maxY;a<=l;++a)n([t,s,a])}forEachTileCoordParentTileRange(e,t,n,r){let s,o,a,l=null,c=e[0]-1;for(this.zoomFactor_===2?(o=e[1],a=e[2]):l=this.getTileCoordExtent(e,r);c>=this.minZoom;){if(o!==void 0&&a!==void 0?(o=Math.floor(o/2),a=Math.floor(a/2),s=k0(o,o,a,a,n)):s=this.getTileRangeForExtentAndZ(l,c,n),t(c,s))return!0;--c}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(e){return this.origin_?this.origin_:this.origins_[e]}getOrigins(){return this.origins_}getResolution(e){return this.resolutions_[e]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(e,t,n){if(e[0]<this.maxZoom){if(this.zoomFactor_===2){let s=e[1]*2,o=e[2]*2;return k0(s,s+1,o,o+1,t)}let r=this.getTileCoordExtent(e,n||this.tmpExtent_);return this.getTileRangeForExtentAndZ(r,e[0]+1,t)}return null}getTileRangeForTileCoordAndZ(e,t,n){if(t>this.maxZoom||t<this.minZoom)return null;let r=e[0],s=e[1],o=e[2];if(t===r)return k0(s,o,s,o,n);if(this.zoomFactor_){let l=Math.pow(this.zoomFactor_,t-r),c=Math.floor(s*l),u=Math.floor(o*l);if(t<r)return k0(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,p=Math.floor(l*(o+1))-1;return k0(c,f,u,p,n)}let a=this.getTileCoordExtent(e,this.tmpExtent_);return this.getTileRangeForExtentAndZ(a,t,n)}getTileRangeForExtentAndZ(e,t,n){this.getTileCoordForXYAndZ_(e[0],e[3],t,!1,Ag);let r=Ag[1],s=Ag[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,Ag);let o=Ag[1],a=Ag[2];return k0(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=qr(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=qr(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 ll(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=qr(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=dx(u,pd)-1,f=dx(f,pd)-1):(u=fx(u,pd),f=fx(f,pd)),dg(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=qr(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=dx(c,pd)-1,u=dx(u,pd)-1):(c=fx(c,pd),u=fx(u,pd)),dg(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=fg(this.resolutions_,e,t||0);return _i(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return eP(t,0,t.length,2,this.getTileCoordExtent(e))}calculateTileRanges_(e){let t=this.resolutions_.length,n=new Array(t);for(let r=this.minZoom;r<t;++r)n[r]=this.getTileRangeForExtentAndZ(e,r);this.fullTileRanges_=n}},gx=nP;function _w(i){let e=i.getDefaultTileGrid();return e||(e=loe(i),i.setDefaultTileGrid(e)),e}function MG(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=xw(t);if(!xc(s,r)){let o=Wn(s),a=Math.ceil((s[0]-r[0])/o);return r[0]+=o*a,i.getTileCoordForCoordAndZ(r,n)}return e}function aoe(i,e,t,n){n=n!==void 0?n:"top-left";let r=RG(i,e,t);return new gx({extent:i,origin:O9(i,n),resolutions:r,tileSize:t})}function CG(i){let e=i||{},t=e.extent||ms("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:RG(t,e.maxZoom,e.tileSize,e.maxResolution)};return new gx(n)}function RG(i,e,t,n){e=e!==void 0?e:42,t=qr(t!==void 0?t:256);let r=gr(i),s=Wn(i);n=n>0?n:Math.max(s/t[0],r/t[1]);let o=e+1,a=new Array(o);for(let l=0;l<o;++l)a[l]=n/Math.pow(2,l);return a}function loe(i,e,t,n){let r=xw(i);return aoe(r,e,t,n)}function xw(i){i=ms(i);let e=i.getExtent();if(!e){let t=180*$h.degrees/i.getMetersPerUnit();e=ll(-t,-t,t,t)}return e}var Mn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function Un(i,e,t,n,r){if(r){let o=t;t=function(a){return i.removeEventListener(e,t),o.call(n??this,a)}}else n&&n!==i&&(t=t.bind(n));let s={target:i,type:e,listener:t};return i.addEventListener(e,t),s}function mg(i,e,t,n){return Un(i,e,t,n,!0)}function ii(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),_u(i))}var Jt={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};var iP=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},Ad=iP;function Zh(){return!0}function Kh(){return!1}function Qh(){}function yw(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!Io(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function PG(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 rP=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var Xs=rP;var sP=class extends Ad{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let n=this.listeners_||(this.listeners_={}),r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){let t=typeof e=="string",n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;let s=t?new Xs(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,Qh);delete o[n]}return l}disposeInternal(){this.listeners_&&_u(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;let n=this.listeners_[e];if(!n)return;let r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=Qh,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},md=sP;var G0=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",coe=G0.includes("safari")&&!G0.includes("chrom"),CIe=coe&&(G0.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(G0)),IG=G0.includes("webkit")&&!G0.includes("edge"),oP=G0.includes("macintosh"),NG=typeof devicePixelRatio<"u"?devicePixelRatio:1,Ls=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,aP=typeof Image<"u"&&Image.prototype.decode;var vw=(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 LG(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[mg(n,Jt.LOAD,function(){o=!0,s||e()})];return n.src&&aP?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(mg(n,Jt.ERROR,t)),function(){r=!1,a.forEach(ii)}}function uoe(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 DG(i,e){return e&&(i.src=e),i.src&&aP?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):uoe(i)}var rn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function lP(i){return Math.pow(i,3)}function ql(i){return 1-lP(1-i)}function FG(i){return 3*i*i-2*i*i*i}function OG(i){return i}var cP=class extends md{constructor(e,t,n){super(),n=n||{},this.tileCoord=e,this.state=t,this.key="",this.transition_=n.transition===void 0?250:n.transition,this.transitionStarts_={},this.interpolate=!!n.interpolate}changed(){this.dispatchEvent(Jt.CHANGE)}release(){this.setState(rn.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(e){if(this.state!==rn.EMPTY){if(this.state!==rn.ERROR&&this.state>e)throw new Error("Tile load sequence violation");this.state=e,this.changed()}}load(){$n()}getAlpha(e,t){if(!this.transition_)return 1;let n=this.transitionStarts_[e];if(!n)n=t,this.transitionStarts_[e]=n;else if(n===-1)return 1;let r=t-n+1e3/60;return r>=this.transition_?1:lP(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()}},gg=cP;function Si(i,e,t,n){let r;return t&&t.length?r=t.shift():Ls?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 uP;function _x(){return uP||(uP=Si(1,1)),uP}function z0(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function hP(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function BG(i){for(;i.lastChild;)i.lastChild.remove()}function UG(i,e){let t=i.childNodes;for(let n=0;;++n){let r=t[n],s=e[n];if(!r&&!s)break;if(r!==s){if(!r){i.appendChild(s);continue}if(!s){i.removeChild(r),--n;continue}i.insertBefore(s,r)}}}function bw(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){let t=this.childNodes.indexOf(e);if(t===-1)throw new Error("Node to remove was not found");return this.childNodes.splice(t,1),e},insertBefore:function(e,t){let n=this.childNodes.indexOf(t);if(n===-1)throw new Error("Reference node not found");return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t==="firstElementChild"?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function cl(i){return typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas}var fP=class extends gg{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_,Ls?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_=hoe(),this.changed()}handleImageLoad_(){if(Ls)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_=LG(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 hoe(){let i=Si(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var ww=fP;var dP,V0=[];function kG(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 foe(){if(dP===void 0){let i=Si(6,6,V0);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",kG(i,4,5,4,0),kG(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;dP=pP(e,0)||pP(e,4)||pP(e,8),z0(i),V0.push(i.canvas)}return dP}function GG(i,e,t,n){let r=hg(t,e,i),s=Q4(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||xc(l,r)){let c=Q4(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function zG(i,e,t,n){let r=Ba(t),s=GG(i,e,r,n);return(!isFinite(s)||s<=0)&&nw(t,function(o){return s=GG(i,e,o,n),isFinite(s)&&s>0}),s}function VG(i,e,t,n,r,s,o,a,l,c,u,f,p,x){let v=Si(Math.round(t*i),Math.round(t*e),V0);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=Er();l.forEach(function(L,D,F){tw(S,L.extent)});let T,P=t/n,R=(f?1:1+Math.pow(2,-24))/P;if(!p||l.length!==1||c!==0){if(T=Si(Math.round(Wn(S)*P),Math.round(gr(S)*P),V0),f||(T.imageSmoothingEnabled=!1),r&&x){let L=(r[0]-S[0])*P,D=-(r[3]-S[3])*P,F=Wn(r)*P,N=gr(r)*P;T.rect(L,D,F,N),T.clip()}l.forEach(function(L,D,F){if(L.image.width>0&&L.image.height>0){if(L.clipExtent){T.save();let H=(L.clipExtent[0]-S[0])*P,Z=-(L.clipExtent[3]-S[3])*P,J=Wn(L.clipExtent)*P,j=gr(L.clipExtent)*P;T.rect(f?H:Math.round(H),f?Z:Math.round(Z),f?J:Math.round(H+J)-Math.round(H),f?j:Math.round(Z+j)-Math.round(Z)),T.clip()}let N=(L.extent[0]-S[0])*P,B=-(L.extent[3]-S[3])*P,z=Wn(L.extent)*P,V=gr(L.extent)*P;T.drawImage(L.image,c,c,L.image.width-2*c,L.image.height-2*c,f?N:Math.round(N),f?B:Math.round(B),f?z:Math.round(N+z)-Math.round(N),f?V:Math.round(B+V)-Math.round(B)),L.clipExtent&&T.restore()}})}let C=zl(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=q9(Ue);if(!mt)return;if(v.save(),v.beginPath(),foe()||!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(Wn($e)/Me.width,-gr($e)/Me.height)}v.drawImage(Me,0,0),v.restore()}),T&&(z0(T),V0.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 doe=[1,0,0,1,0,0],r5e=new Array(6);function $s(){return doe.slice(0)}function qG(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i}function Mr(i,e){let t=e[0],n=e[1];return e[0]=i[0]*t+i[2]*n+i[4],e[1]=i[1]*t+i[3]*n+i[5],e}function lo(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 Tw(i,e){let t=poe(e);zn(t!==0,"Transformation matrix cannot be inverted");let n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],l=e[5];return i[0]=o/t,i[1]=-r/t,i[2]=-s/t,i[3]=n/t,i[4]=(s*l-o*a)/t,i[5]=-(n*l-r*a)/t,i}function poe(i){return i[0]*i[3]-i[1]*i[2]}var Aoe=[1e5,1e5,1e5,1e5,2,2];function HG(i){return"matrix("+i.join(", ")+")"}function Sw(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function WG(i,e){let t=Sw(i),n=Sw(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*Aoe[r])!==0)return!1;return!0}var moe=10,jG=.25,AP=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?fG(R=>Mr(a,hg(R,this.targetProj_,this.sourceProj_))):B0(this.targetProj_,this.sourceProj_);this.transformInv_=function(R){let C=R[0]+"/"+R[1];return l[C]||(l[C]=c(R)),l[C]},this.maxSourceExtent_=r,this.errorThresholdSquared_=s*s,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!r&&!!this.sourceProj_.getExtent()&&Wn(r)>=Wn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?Wn(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?Wn(this.targetProj_.getExtent()):null;let u=zl(n),f=rg(n),p=ig(n),x=ng(n),v=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(p),T=this.transformInv_(x),P=moe+(o?Math.max(0,Math.ceil(Math.log2(ux(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=O4([s,o,a,l]),f=this.sourceWorldWidth_?Wn(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=O4([e,t,n,r]);v=Wn(S)/this.targetWorldWidth_>jG||v}!x&&this.sourceProj_.isGlobal()&&f&&(v=f>jG||v)}if(!v&&this.maxSourceExtent_&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!_r(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=(gu(s[0],p)+gu(a[0],p))/2-gu(T[0],p):P=(s[0]+a[0])/2-T[0];let R=(s[1]+a[1])/2-T[1];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=Er();return this.triangles_.forEach(function(t,n,r){let s=t.source;N0(e,s[0]),N0(e,s[1]),N0(e,s[2])}),e}getTriangles(){return this.triangles_}},XG=AP;var mP=class extends gg{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?Au(x,v):x;if(ux(S)===0){this.state=rn.EMPTY;return}let T=e.getExtent();T&&(w?w=Au(w,T):w=T);let P=r.getResolution(this.wrappedTileCoord_[0]),R=zG(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 XG(e,n,S,w,R*C,P),this.triangulation_.getTriangles().length===0){this.state=rn.EMPTY;return}this.sourceZ_=t.getZForResolution(R);let L=this.triangulation_.calculateSourceExtent();if(w&&(e.canWrapX()?(L[1]=_i(L[1],w[1],w[3]),L[3]=_i(L[3],w[1],w[3])):L=Au(L,w)),!ux(L))this.state=rn.EMPTY;else{let D=0,F=0;e.canWrapX()&&(D=Wn(T),F=Math.floor((L[0]-T[0])/D)),iw(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_=VG(r,s,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),o,l,this.triangulation_,e,this.gutter_,this.renderEdges_,this.interpolate),this.state=rn.LOADED}this.changed()}load(){for(let e of this.sourceTiles_)e.tile=e.getTile();if(this.state==rn.IDLE){this.state=rn.LOADING,this.changed();let e=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:t})=>{let n=t.getState();if(n==rn.IDLE||n==rn.LOADING){e++;let r=Un(t,Jt.CHANGE,s=>{let o=t.getState();(o==rn.LOADED||o==rn.ERROR||o==rn.EMPTY)&&(ii(r),e--,e===0&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(r)}}),e===0?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},n,r){t.getState()==rn.IDLE&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(ii),this.sourcesListenerKeys_=null}release(){this.canvas_&&(z0(this.canvas_.getContext("2d")),V0.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},Ew=mP;var goe=/\{z\}/g,_oe=/\{x\}/g,xoe=/\{y\}/g,yoe=/\{-y\}/g;function $G(i,e,t,n,r){return i.replace(goe,e.toString()).replace(_oe,t.toString()).replace(xoe,n.toString()).replace(yoe,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 YG(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 voe(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 $G(i,o,t[1],t[2],s)})}function ZG(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=voe(i[r],e);return boe(n)}function boe(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=SG(e),s=gu(r,i.length);return i[s](e,t,n)})}var Mc={PROPERTYCHANGE:"propertychange"};var _g=class extends md{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(Jt.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Un(this,e[s],t);return r}return Un(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){let r=e.length;n=new Array(r);for(let s=0;s<r;++s)n[s]=mg(this,e[s],t)}else n=mg(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)}};_g.prototype.on;_g.prototype.once;_g.prototype.un;function woe(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)ii(i[e]);else ii(i)}var Mw=_g;var Cw=class extends Xs{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},gP=class extends Mw{constructor(e){super(),this.on,this.once,this.un,Nn(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new Cw(n,e,t)),n=Mc.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new Cw(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],bc(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},gs=gP;var _P=class extends gs{constructor(e){super(),this.projection=ms(e.projection),this.attributions_=KG(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_=KG(e),this.changed()}setState(e){this.state_=e,this.changed()}};function KG(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var Rw=_P;var xP=class extends Rw{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&&qr(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),t),this.tmpSize=[0,0],this.key_=e.key||Nn(this),this.tileOptions={transition:e.transition,interpolate:e.interpolate},this.zDirection=e.zDirection?e.zDirection:0}getGutterForProjection(e){return 0}getKey(){return this.key_}setKey(e){this.key_!==e&&(this.key_=e,this.changed())}getResolutions(e){let t=e?this.getTileGridForProjection(e):this.tileGrid;return t?t.getResolutions():null}getTile(e,t,n,r,s,o){return $n()}getTileGrid(){return this.tileGrid}getTileGridForProjection(e){return this.tileGrid?this.tileGrid:_w(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=qr(r.getTileSize(e),this.tmpSize);return s==1?o:AG(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=MG(r,e,n)),TG(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},Pw=class extends Xs{constructor(e,t){super(e),this.tile=t}},QG=xP;var Iw={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var yP=class i extends QG{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tilePixelRatio:e.tilePixelRatio,wrapX:e.wrapX,transition:e.transition,interpolate:e.interpolate,key:e.key,attributionsCollapsible:e.attributionsCollapsible,zDirection:e.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===i.prototype.tileUrlFunction,this.tileLoadFunction=e.tileLoadFunction,e.tileUrlFunction&&(this.tileUrlFunction=e.tileUrlFunction),this.urls=null,e.urls?this.setUrls(e.urls):e.url&&this.setUrl(e.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(e){let t=e.target,n=Nn(t),r=t.getState(),s;r==rn.LOADING?(this.tileLoadingKeys_[n]=!0,s=Iw.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==rn.ERROR?Iw.TILELOADERROR:r==rn.LOADED?Iw.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new Pw(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=YG(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`2-`);this.generateTileUrlFunction_?this.setTileUrlFunction(ZG(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},JG=yP;var vP=class extends JG{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Soe,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:ww,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!ug(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||ug(t,e)))return this.tileGrid;let n=Nn(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=_w(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||ug(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 Ew(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=pg(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=ms(e);if(n){let r=Nn(n);r in this.tileGridForProjection||(this.tileGridForProjection[r]=t)}}};function Soe(i,e){if(Ls){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 ez=vP;var bP=class extends ez{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:CG({extent:xw(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_}},tz=bP;function Cc(){if(!U.map||!U.variant||U.settling)return;let i=U.engine?.getView();try{let e=nz();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(F4,JSON.stringify(e))}catch{}}function nz(){try{let i=JSON.parse(localStorage.getItem(F4)||"null");if(i&&i.games)return i}catch{}return{last:"",games:{}}}function xg(i){let e=nz(),t=i||e.last,n=t&&e.games[t];return n&&n.game&&n.map?n:null}function yg(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{game:i,map:e}}function iz(){if(!U.game||!U.map)return;let i=`#${U.game.slug}/${U.map.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var wP=class i extends gs{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e)if(typeof e.getSimplifiedGeometry=="function"){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}clone(){let e=new i,t=this.geometryName_;e.setGeometryName(t);let n=this.getPropertiesInternal();if(n){let s=this.getGeometry();for(let o in n)o===t&&s?e.set(o,s.clone()):e.set(o,n[o],!0)}let r=this.getStyle();return r&&e.setStyle(r),e}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(ii(this.geometryChangeKey_),this.geometryChangeKey_=null);let e=this.getGeometry();e&&(this.geometryChangeKey_=Un(e,Jt.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?Toe(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 Toe(i){if(typeof i=="function")return i;let e;return Array.isArray(i)?e=i:(zn(typeof i.getZIndex=="function","Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[i]),function(){return e}}var gd=wP;function ka(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 Nw(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 rz(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 sz(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 oz=$s(),Eoe=[NaN,NaN],SP=class extends gs{constructor(){super(),this.extent_=Er(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=yw((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);let r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return $n()}closestPointXY(e,t,n,r){return $n()}containsXY(e,t){return this.closestPointXY(e,t,Eoe,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t=t||[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return $n()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&P0(t),this.extentRevision_=this.getRevision()}return B9(this.extent_,e)}rotate(e,t){$n()}scale(e,t,n){$n()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return $n()}getType(){return $n()}applyTransform(e){$n()}intersectsExtent(e){return $n()}translate(e,t){$n()}transform(e,t){let n=ms(e),r=n.getUnits()=="tile-pixels"?function(s,o,a){let l=n.getExtent(),c=n.getWorldExtent(),u=gr(c)/gr(l);lo(oz,c[0],c[3],u,-u,0,0,0);let f=ka(s,0,s.length,a,oz,o),p=B0(n,t);return p?p(f,f,a):f}:B0(n,t);return this.applyTransform(r),this}},az=SP;var TP=class extends az{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return tg(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return $n()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=lz(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){$n()}setLayout(e,t,n){let r;if(e)r=lz(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=Moe(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();Nw(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||(n=Ba(this.getExtent()));let r=this.getFlatCoordinates();if(r){let s=this.getStride();rz(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();sz(n,0,n.length,r,e,t,n),this.changed()}}};function Moe(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function lz(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function cz(i,e,t){let n=i.getFlatCoordinates();if(!n)return null;let r=i.getStride();return ka(n,0,n.length,r,e,t)}var xu=TP;function uz(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function xx(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 EP(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=xx(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function hz(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=EP(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 MP=class i extends xu{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){let s=this.flatCoordinates,o=yc(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 ew(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return cx(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=uz(this.flatCoordinates,0,e,this.stride),this.changed()}},Jh=MP;function CP(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 RP(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=CP(i,e,a,n),e=a}return r}function fz(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=RP(i,e,a,n),e=a[a.length-1]}return r}function dz(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]=Po(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 PP(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=yc(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function IP(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=PP(i,e,a,n,r),e=a}return r}function pz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=IP(i,e,a,n,r),e=a[a.length-1]}return r}function NP(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,p;if(r===0){if(p=yc(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(dz(i,x-n,x,n,o,a,u),p=yc(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&&(dz(i,t-n,e,n,o,a,u),p=yc(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 LP(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=NP(i,e,x,n,r,s,o,a,l,c,u),e=x}return c}function Az(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=LP(i,e,x,n,r,s,o,a,l,c,u),e=x[x.length-1]}return c}function yu(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=e;o<t;o+=n)r[s++]=i.slice(o,o+n);return r.length=s,r}function vg(i,e,t,n,r){r=r!==void 0?r:[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=t[o];r[s++]=yu(i,e,l,n,r[s]),e=l}return r.length=s,r}function yx(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?[]:vg(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}function vx(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=V9(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 mz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=vx(i,e,u,n,r,s,o),a.push(o),e=u}return o}function _d(i,e){return e*Math.round(i/e)}function Coe(i,e,t,n,r,s,o){if(e==t)return o;let a=_d(i[e],r),l=_d(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=_d(i[e],r),u=_d(i[e+1],r),e+=n,e==t)return s[o++]=c,s[o++]=u,o;while(c==a&&u==l);for(;e<t;){let f=_d(i[e],r),p=_d(i[e+1],r);if(e+=n,f==c&&p==u)continue;let x=c-a,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 bx(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Coe(i,e,u,n,r,s,o),a.push(o),e=u}return o}function gz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=bx(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var DP=class i extends xu{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new i(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<cd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(PP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),NP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return CP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return yu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=vx(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return gw(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=xx(this.flatCoordinates,0,e,this.stride),this.changed()}},FP=DP;function wx(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(Ua),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,mx(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 Lw(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=wx(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function _z(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 OP(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 BP(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=OP(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 xz(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(!BP(i,e,a,n,r))return!1;a.length&&(e=a[a.length-1])}return!0}function Dw(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=OP(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&_z(i,e,a,n),e=a}return e}function UP(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=Dw(i,e,t[s],n,r);return e}function yz(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=OP(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 Fw=class i extends xu{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?Ec(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return e.applyProperties(this),e}closestPointXY(e,t,n,r){return r<cd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(IP(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),LP(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return mx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return RP(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Dw(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,vg(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=Ba(this.getExtent());this.flatInteriorPoint_=wx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Jh(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new FP(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 FP(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;BP(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Dw(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=bx(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return tP(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=EP(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},vu=Fw;function kP(i){if(mu(i))throw new Error("Cannot create polygon from empty extent");let e=i[0],t=i[1],n=i[2],r=i[3],s=[e,t,e,r,n,r,n,t,e,t];return new Fw(s,"XY",[s.length])}function vz(){let i=U.variant?.surface;return i?[i.x,-(i.y+i.height),i.x+i.width,-i.y]:Su()}function bz(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),wz(),U.gridEnabled?(we.gridInput.focus(),we.gridInput.select()):we.viewport.focus({preventScroll:!0}),!0):i.key===" "&&U.gridEnabled&&i.target!==we.subgridToggle?(i.preventDefault(),Sx(!U.subgridVisible),!0):i.key==="Escape"&&U.gridEnabled?(i.preventDefault(),GP(),!0):!1}function wz(i=!U.gridEnabled){U.gridEnabled=i,i&&Sx(!0),Bw(),bu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()}function Sx(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"),Sz()}function Sz(){if(!U.gridEnabled){we.gridHint.textContent="G \xB7 grid off";return}we.gridHint.textContent=`G-${U.gridPrefix||"root"}`+(U.subgridVisible?"":" no subgrid")}function Tx(i){let e=q0(),t=[...i.toLocaleLowerCase()].filter(r=>Gl.includes(r)).slice(0,e).join(""),n=t!==U.gridPrefix;U.gridPrefix=t,U.gridEnabled||(U.gridEnabled=!0),Bw(),bu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed(),n&&(Rc(),U.engine.getView().fit(bg(),{size:U.engine.getSize(),padding:[52,52,52,52],maxZoom:wu(U.variant),duration:180}))}function GP(){if(U.gridEnabled){if(!U.gridPrefix){wz(!1);return}Tx(U.gridPrefix.slice(0,-1))}}function Bw(){if(!U.sources||(U.sources.grid.clear(),U.sources.gridContext.clear(),we.gridNavigator.hidden=!U.gridEnabled,Sz(),!U.gridEnabled||!U.variant))return;let i=q0();if(we.gridInput.maxLength=i,we.gridInput.value=U.gridPrefix,we.gridBack.title=U.gridPrefix?"Back one geohash level":"Close geohash grid",Poe(),U.gridPrefix.length>=i){Ow(U.gridPrefix,bg(),"leaf");return}U.gridPrefix&&Ow(U.gridPrefix,bg(),"scope");for(let e of Gl){let t=U.gridPrefix+e;Ow(t,zP(t),"child")}}function Poe(){for(let i=0;i<U.gridPrefix.length;i++){let e=U.gridPrefix.slice(0,i),t=U.gridPrefix.slice(0,i+1);for(let n of Gl){let r=e+n;r!==t&&Ow(r,zP(r),"neighbor",U.gridPrefix.length-i)}}}function Ow(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 gd({geometry:new vu([[[r,s],[r,a],[o,a],[o,s],[r,s]]]),gridCell:{hash:i,extent:e,role:t,count:l,contextDistance:n},priority:t==="neighbor"?-n*100+Gl.indexOf(i[i.length-1]):Gl.indexOf(i[i.length-1])});(t==="neighbor"?U.sources.gridContext:U.sources.grid).addFeature(c)}function bg(){return zP(U.gridPrefix)}function zP(i){let e=[...vz()],t=!0;for(let n of i){let r=Gl.indexOf(n);if(!(r<0))for(let s of[16,8,4,2,1]){if(t){let o=(e[0]+e[2])/2;r&s?e[0]=o:e[2]=o}else{let o=(e[1]+e[3])/2;r&s?e[1]=o:e[3]=o}t=!t}}return e}function q0(){return 3}function Tz(i,e=q0()){let t=[...vz()],[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+=Gl[l]}return o}function wg(i){if(!U.gridEnabled||!U.gridPrefix)return!1;let e=bg(),[t,n]=i.coordinate;return t>=e[0]&&t<=e[2]&&n>=e[1]&&n<=e[3]}function H0(){return F9[U.map?.iconOutset==="dark"?"dark":"light"]}function Ioe(i){let e=U.map?.iconOutset==="dark",t=Loe(i);return(e?t>.3:t<.88)?i:Noe(i,e?.74:.42)}function Noe(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 Loe(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 Uw(i){let e=Math.abs(Number(i)||0);return Jm[(Math.imul(e,2654435761)>>>0)%Jm.length]}function ef(i,e){let t=String(i||"#ffffff").replace("#",""),n=t.length===3?t.split("").map(s=>s+s).join(""):t.slice(0,6).padEnd(6,"f"),r=Number.parseInt(n,16);return`rgba(${r>>16&255}, ${r>>8&255}, ${r&255}, ${e})`}function Sg(i,e){i.style.setProperty("--pin-color",W0(e))}function W0(i){return Ioe(i.color||Uw(i.id))}function Tg(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("${VP(e.iconAsset)}")`),i.classList.add("has-source-icon")}function VP(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${U.game.base}/icons/${e}`}function Pc(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function Ez(i){return Math.imul(Number(i)||0,2654435761)>>>0}function Mz(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`3-4-`).trim()}function Ic(i){return new Intl.NumberFormat().format(i)}function No(i,e,t){return Math.min(t,Math.max(e,i))}function kw(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var Doe=100;function xd(){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,Doe),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),Sg(r,n.category);let s=document.createElement("span");s.className="result-dot",Tg(s,n.category,Pc(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 ${Ic(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}we.searchResults.replaceChildren(t),Ooe(i.length),Foe()}var Cz=28;function Foe(){let i=U.selectedPin?.location.title||"",e=i.length>Cz?`${i.slice(0,Cz-1).trimEnd()}\u2026`:i;we.dockRailName.textContent=e?` \xB7 ${e}`:"",we.dockRailName.hidden=!e}function Ooe(i){we.dockCount.textContent=`${Ic(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 Gw(){!U.dockFolded||U.dockDismissed||zw(!1)}function qP(i){U.dockDismissed=i,zw(i)}function zw(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&&Cc()}function HP(i){U.hiddenCategories.delete(i.category.id),Mx(),Hl(),yd(),Ex(i,!0)}function Ex(i,e=!1){U.selectedPin=i,document.dispatchEvent(new Event("atlas:selection")),bu(),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,Uoe(i),we.detailID.textContent=String(i.location.id),we.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=Tz(i.coordinate);we.detailCell.textContent=t,we.detailCellField.hidden=!t;let n=Boe(i);if(we.detailSource.textContent=n,we.detailSourceField.hidden=!n,Sg(we.detailDot,i.category),Tg(we.detailDot,i.category,Pc(i.category.title)),we.detail.hidden=!1,Gw(),xd(),e){let r=U.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(wu(U.variant),Math.max(r.getZoom()||0,4)),duration:220})}}function Boe(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 Uoe(i){let e=await Rz();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=Mz(t.d)||"No description is included in the archive.",koe(i)}function koe(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 Rc(){let i=U.selectedPin!==null;U.selectedPin=null,document.dispatchEvent(new Event("atlas:selection")),U.sources&&(bu(),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&&xd()}function Tu(i){let e=i.attrs?.["atlas.render.as"];return e||(i.displayType==="text"?"text":"pin")}function Pz(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function j0(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 qw=[NaN,NaN,NaN,0],WP;function Goe(){return WP||(WP=Si(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),WP}var zoe=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Voe=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,qoe=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Hoe=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Vw(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Rx(i){throw new Error('failed to parse "'+i+'" as color')}function Iz(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(Voe)||i.match(zoe)||i.match(qoe);if(s){let o=s[4],a=100/255;return[_i(Vw(s[1],a)+.5|0,0,255),_i(Vw(s[2],a)+.5|0,0,255),_i(Vw(s[3],a)+.5|0,0,255),o!==void 0?_i(Vw(o,100),0,1):1]}Rx(i)}if(i.startsWith("#")){if(Hoe.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}Rx(i)}let e=Goe();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&&Rx(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Iz(n);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);let r=Array.from(e.getImageData(0,0,1,1).data);return r[3]=L0(r[3]/255,3),r}function Nz(i){return typeof i=="string"?i:Ix(i)}var Woe=1024,Cx={},jP=0;function Lz(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function XP(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function $P(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function YP(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function ZP(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function KP(i){let e=YP(i[0]),t=YP(i[1]),n=YP(i[2]),r=ZP(e*.222488403+t*.716873169+n*.06060791),s=500*(ZP(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-ZP(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 Dz(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=$P(e),s=$P(e+t/500*Math.cos(n)),o=$P(e-t/200*Math.sin(n)),a=XP(s*3.021973625-r*1.617392459-o*.404875592),l=XP(s*-.943766287+r*1.916279586+o*.027607165),c=XP(s*.069407491-r*.22898585+o*1.159737864);return[_i(a+.5|0,0,255),_i(l+.5|0,0,255),_i(c+.5|0,0,255),i[3]]}function Px(i){if(i==="none")return qw;if(Cx.hasOwnProperty(i))return Cx[i];if(jP>=Woe){let t=0;for(let n in Cx)(t++&3)===0&&(delete Cx[n],--jP)}let e=Iz(i);e.length!==4&&Rx(i);for(let t of e)isNaN(t)&&Rx(i);return Cx[i]=e,++jP,e}function Wl(i){return Array.isArray(i)?i:Px(i)}function Ix(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 JP=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=QP(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=QP(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=QP(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]=_x().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=_x().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function QP(i,e){let t=e?Wl(e):"null";return i+":"+t}var Lo=new JP;var Nx=null,Hw=class extends md{constructor(e,t,n,r,s){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=s,this.imageState_=r===void 0?Mn.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===Mn.LOADED){Nx||(Nx=Si(1,1,void 0,{willReadFrequently:!0})),Nx.drawImage(this.image_,0,0);try{Nx.getImageData(0,0,1,1),this.tainted_=!1}catch{Nx=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(Jt.CHANGE)}handleImageError_(){this.imageState_=Mn.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Mn.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],n=Si(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Mn.IDLE){this.image_||this.initializeImage_(),this.imageState_=Mn.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&DG(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Mn.LOADED)return;let t=this.image_,n=Si(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=Nz(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation="destination-in",n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||(this.ready_=new Promise(e=>{if(this.imageState_===Mn.LOADED||this.imageState_===Mn.ERROR)e();else{let t=()=>{(this.imageState_===Mn.LOADED||this.imageState_===Mn.ERROR)&&(this.removeEventListener(Jt.CHANGE,t),e())};this.addEventListener(Jt.CHANGE,t)}})),this.ready_}};function vd(i,e,t,n,r,s){let o=e===void 0?void 0:Lo.get(e,r);return o||(o=new Hw(i,i&&"src"in i?i.src||void 0:e,t,n,r),Lo.set(e,r,o,s)),s&&o&&!Lo.getPattern(e,r)&&Lo.set(e,r,o,s),o}var Fz=Hw;function Ga(i){return i?Array.isArray(i)?Ix(i):typeof i=="object"&&"src"in i?joe(i):i:null}function joe(i){if(!i.offset||!i.size)return Lo.getPattern(i.src,i.color);let e=i.src+":"+i.offset,t=Lo.getPattern(e,i.color);if(t)return t;let n=Lo.get(i.src,null);if(n.getImageState()!==Mn.LOADED)return null;let r=Si(i.size[0],i.size[1]);return r.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),vd(r.canvas,e,void 0,Mn.LOADED,i.color,!0),Lo.getPattern(e,i.color)}var Lx="ol-hidden";var bd="ol-unselectable";var Eg="ol-control",eI="ol-collapsed",Xoe=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"),Oz=["style","variant","weight","size","lineHeight","family"],Ww={normal:400,bold:700},jw=function(i){let e=i.match(Xoe);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=Oz.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[Oz[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in Ww&&(t.weight=Ww[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var Xw="10px sans-serif",Ds="#000",Eu="round",za=[],Va=0,Mu="round",tf=10,Uz=0,Do="#000",wd="center",$0="middle",nf=[0,0,0,0],rf=1,X0=new gs,Dx=null,Bz,tI={},$oe=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Yoe(i,e,t){return`${i} ${e} 16px "${t}"`}var kz=(function(){let e,t;async function n(s){await t.ready;let o=jw(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let p=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),x=Ww[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=X0.getProperties(),a=Object.keys(o).filter(l=>o[l]<100);for(let l=a.length-1;l>=0;--l){let c=a[l],u=o[c];u<100&&(await n(c)?(_u(tI),X0.set(c,100)):(u+=10,X0.set(c,u,!0),u<100&&(s=!1)))}e=void 0,s||(e=setTimeout(r,100))}return async function(s){t||(t=Ls?self.fonts:document.fonts);let o=jw(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if($oe.has(c))continue;let u=Yoe(o.style,o.weight,c);X0.get(u)===void 0&&(X0.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),Zoe=(function(){let i;return function(e){let t=tI[e];if(t==null){if(Ls){let n=jw(e),r=Gz(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);tI[e]=t}return t}})();function Gz(i,e){return Dx||(Dx=Si(1,1)),i!=Bz&&(Dx.font=i,Bz=Dx.font),Dx.measureText(e)}function zz(i,e){return Gz(i,e).width}function nI(i,e,t){if(e in t)return t[e];let n=e.split(`5-`).reduce((r,s)=>Math.max(r,zz(i,s)),0);return t[e]=n,n}function Vz(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=zz(p,f);t.push(x),o+=x;let v=Zoe(p);n.push(v),l=Math.max(l,v)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function qz(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]),Koe(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 Koe(i,e){let t=i.contextInstructions;for(let n=0,r=t.length;n<r;n+=2)Array.isArray(t[n+1])?e[t[n]].apply(e,t[n+1]):e[t[n]]=t[n+1]}var iI=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=qr(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){let e=this.getScale();return new i({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return $n()}getImage(e){return $n()}getHitDetectionImage(){return $n()}getPixelRatio(e){return 1}getImageState(){return $n()}getImageSize(){return $n()}getOrigin(){return $n()}getSize(){return $n()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=qr(e)}listenImageChange(e){$n()}load(){$n()}unlistenImageChange(e){$n()}ready(){return Promise.resolve()}},$w=iI;var rI=class i extends $w{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=Lo.get(n,null)?.getImage(1);if(!r){let s=this.renderOptions_,o=Math.ceil(s.size*e),a=Si(o,o);this.draw_(s,a,e),r=a.canvas;let l=new Fz(r,void 0,null,Mn.LOADED,null);Lo.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=Eu,t=Mu,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=Ga(this.stroke_.getColor()??Do),a=this.stroke_.getWidth()??rf,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Mu,e=this.stroke_.getLineCap()??Eu,n=this.stroke_.getMiterLimit()??tf);let l=this.calculateLineJoinSize_(t,a,n),c=Math.max(this.radius,this.radius2_||0),u=Math.ceil(2*c+l);return{strokeStyle:o,strokeWidth:a,size:u,lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:t,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();let e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let r=this.fill_.getColor();r===null&&(r=Ds),t.fillStyle=Ga(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=Wl(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Si(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{let r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);let s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){let l=s+a*o,c=a%2===0?n:r;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=Ds,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()}},Yw=rI;var sI=class i extends Yw{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}},Zw=sI;var oI=class i{constructor(e){e=e||{},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){let e=this.getColor();return new i({color:Array.isArray(e)?e.slice():e||void 0})}getColor(){return this.color_}setColor(e){if(e!==null&&typeof e=="object"&&"src"in e){let t=vd(null,e.src,{crossOrigin:"anonymous"},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===Mn.IDLE&&t.load(),t.getImageState()===Mn.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?Nn(e):typeof e=="object"&&"src"in e?e.src+":"+e.offset:Wl(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},Hr=oI;function Hz(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 aI=class i extends $w{constructor(e){e=e||{};let t=e.opacity!==void 0?e.opacity:1,n=e.rotation!==void 0?e.rotation:0,r=e.scale!==void 0?e.scale:1,s=e.rotateWithView!==void 0?e.rotateWithView:!1;super({opacity:t,rotation:n,scale:r,displacement:e.displacement!==void 0?e.displacement:[0,0],rotateWithView:s,declutterMode:e.declutterMode}),this.anchor_=e.anchor!==void 0?e.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin!==void 0?e.anchorOrigin:"top-left",this.anchorXUnits_=e.anchorXUnits!==void 0?e.anchorXUnits:"fraction",this.anchorYUnits_=e.anchorYUnits!==void 0?e.anchorYUnits:"fraction",this.crossOrigin_=e.crossOrigin!==void 0?e.crossOrigin:null,this.referrerPolicy_=e.referrerPolicy;let o=e.img!==void 0?e.img:null,a=e.src;zn(!(a!==void 0&&o),"`image` and `src` cannot be provided at the same time"),(a===void 0||a.length===0)&&o&&(a=o.src||Nn(o)),zn(a!==void 0&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),zn(!((e.width!==void 0||e.height!==void 0)&&e.scale!==void 0),"`width` or `height` cannot be provided together with `scale`");let l;if(e.src!==void 0?l=Mn.IDLE:o!==void 0&&("complete"in o?o.complete?l=o.src?Mn.LOADED:Mn.IDLE:l=Mn.LOADING:l=Mn.LOADED),this.color_=e.color!==void 0?Wl(e.color):null,this.iconImage_=vd(o,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},l,this.color_),this.offset_=e.offset!==void 0?e.offset:[0,0],this.offsetOrigin_=e.offsetOrigin!==void 0?e.offsetOrigin:"top-left",this.origin_=null,this.size_=e.size!==void 0?e.size:null,this.initialOptions_,e.width!==void 0||e.height!==void 0){let c,u;if(e.size)[c,u]=e.size;else{let f=this.getImage(1);if(f.width&&f.height)c=f.width,u=f.height;else if(f instanceof HTMLImageElement){this.initialOptions_=e;let p=()=>{if(this.unlistenImageChange(p),!this.initialOptions_)return;let x=this.iconImage_.getSize();this.setScale(Hz(x[0],x[1],e.width,e.height))};this.listenImageChange(p);return}}c!==void 0&&this.setScale(Hz(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?Wl(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((o,a)=>o===t[a]))return;this.color_=t;let n=this.getSrc(),r=n!==void 0?null:this.getHitDetectionImage(),s=n!==void 0?Mn.IDLE:this.iconImage_.getImageState();this.iconImage_=vd(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!="top-left"){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_=="top-right"||this.offsetOrigin_=="bottom-right")&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_=="bottom-left"||this.offsetOrigin_=="bottom-right")&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=vd(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Mn.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==Mn.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==Mn.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(Jt.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(Jt.CHANGE,e)}ready(){return this.iconImage_.ready()}},Y0=aI;var lI=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}},Ys=lI;var Kw=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=Wz,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_=Wz,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function jz(i){let e;if(typeof i=="function")e=i;else{let t;Array.isArray(i)?t=i:(zn(typeof i.getZIndex=="function","Expected an `Style` or an array of `Style`"),t=[i]),e=function(){return t}}return e}var cI=null;function uI(i,e){if(!cI){let t=new Hr({color:"rgba(255,255,255,0.4)"}),n=new Ys({color:"#3399CC",width:1.25});cI=[new Kw({image:new Zw({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return cI}function Wz(i){return i.getGeometry()}var Fs=Kw;var Qoe="#333",hI=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_=qr(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 Hr({color:Qoe}),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 Hr?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_=qr(e!==void 0?e:1)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}},sf=hI;function jl(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function Yz(i){let e=i.get("pin");return!e||Xl(e)||e.insideHighlightedZone||Mg(e)?null:fI(e,!1)}function Zz(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Xl(e)||Mg(e)?null:fI(e,!1)}function Kz(i){let e=i.get("pin");return!e||Xl(e)||!U.labelsHeld?null:nV(e)}function Qz(i){let e=i.get("pin");if(!e||Xl(e)||e.insideHighlightedZone||Mg(e)||Bx())return null;if(U.labelsHeld)return Fx(e,!1);let t=U.fitZoom+Math.log2(uV(e.category));return(U.engine.getView().getZoom()||0)<t?null:Fx(e,!1)}function Jz(i){let e=i.get("pin");return!e||Xl(e)||e.insideHighlightedZone||Mg(e)||!Bx()?null:Fx(e,!1)}function eV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||Xl(e)||Mg(e)?null:Fx(e,!1)}function tV(i){let e=i.get("pin");if(!e||Xl(e))return null;if(Tu(e.category)==="text")return Fx(e,e===U.selectedPin);let t=fI(e,e===U.selectedPin);return e===U.hoveredPin||e===U.selectedPin?[t,nV(e)]:t}function fI(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let n=W0(i.category),r=e?2e7:i.priority,s=U.markerIcons.get(Ox(i.category)),o;return s?o=new Fs({image:new Y0({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new Fs({text:new sf({text:Pc(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new Hr({color:n}),stroke:new Ys({color:H0(),width:e?4:3})}),zIndex:r}),U.styleCache.set(t,o),o}function nV(i){let e=`marker-label:${i.location.id}`;if(U.styleCache.has(e))return U.styleCache.get(e);let t=new Fs({text:new sf({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new Hr({color:"#f2ece0"}),stroke:new Ys({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new Hr({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 iV(i){if(!i.iconAsset)return;let e=Ox(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=W0(i),o=document.createElement("canvas");o.width=64,o.height=64;let a=o.getContext("2d");a.imageSmoothingEnabled=!i.iconPicture,a.drawImage(t,6,6,52,52),i.iconPicture||(a.globalCompositeOperation="source-in",a.fillStyle=s,a.fillRect(0,0,64,64));let l=document.createElement("canvas");l.width=64,l.height=64;let c=l.getContext("2d");c.drawImage(t,6,6,52,52),c.globalCompositeOperation="source-in",c.fillStyle=H0(),c.fillRect(0,0,64,64);for(let u=-3;u<=3;u++)for(let f=-3;f<=3;f++)f*f+u*u<=10&&r.drawImage(l,f,u);r.drawImage(o,0,0),U.markerIcons.set(e,n.toDataURL("image/png")),Joe(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.priority.changed()},t.onerror=()=>U.markerIcons.set(e,!1),t.src=VP(i.iconAsset)}function Joe(){for(let i of U.styleCache.keys())i.startsWith("marker:")&&U.styleCache.delete(i)}function Ox(i){return`${i.iconAsset||""}:${W0(i)}:${U.map?.iconOutset||"light"}`}function Fx(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let r=[new Fs({text:new sf({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new Hr({color:e?"#7fd0ea":"#f2ece0"}),stroke:new Ys({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new Hr({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new Ys({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 dI(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=eae(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=Jm[Math.max(0,Gl.indexOf(t.hash[t.hash.length-1]))%Jm.length],v=new Fs({fill:r?void 0:new Hr({color:s?`rgba(5, 8, 16, ${Math.min(.52,.3+t.contextDistance*.06)})`:ef(x,n?.14:.055)}),stroke:new Ys({color:n||r?"#ffffff":ef(x,s?.44:.82),width:n?2.5:r?f?1.8:2.5:s?1:1.4}),text:u&&!f?new sf({text:t.hash,font:l,fill:new Hr({color:n||r?"#ffffff":s?ef(x,.72):x}),stroke:new Ys({color:"rgba(0,0,0,0.96)",width:4}),backgroundFill:new Hr({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 eae(i,e,t,n,r){if(!r)return!0;let s=tae(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 Xz=document.createElement("canvas").getContext("2d"),$z=new Map;function tae(i,e){let t=`${e}|${i}`,n=$z.get(t);return n===void 0&&(Xz.font=e,n=Xz.measureText(i).width,$z.set(t,n)),n}var nae=new Fs({fill:new Hr({color:"rgba(5, 8, 16, 0.62)"})});function rV(){return U.zonesVisible?nae:null}function sV(i){if(!U.zonesVisible)return null;let e=i.get("zone"),t=i.get("child"),n=U.highlightedZones.has(e.id),r=cV(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 Fs({stroke:new Ys({color:ef(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 Fs({fill:new Hr({color:ef(o,t?.035:.07)}),stroke:new Ys({color:ef(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 Fs({stroke:new Ys({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Fs({fill:new Hr({color:ef(o,.22)}),stroke:new Ys({color:o,width:2.6}),zIndex:9001})];return U.styleCache.set(s,l),l}function oV(i){if(!U.zonesVisible||Bx())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:lV(i)}function aV(i){return!U.zonesVisible||!Bx()?null:lV(i)}function lV(i){let e=i.get("child"),t=i.get("zone"),n=U.highlightedZones.has(t.id),r=cV(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 Fs({text:new sf({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new Hr({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new Ys({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 Hr({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new Ys({color:n?"#ffffff":ef(o,r?.24:.55),width:n?2:1}),padding:[5,8,5,8],overflow:!0}),zIndex:n?91e5:i.get("priority")});return U.styleCache.set(s,a),a}function cV(i){if(!U.highlightedZones.size||U.highlightedZones.has(i))return!1;for(let e of U.highlightedZones)if(iae(i,e))return!1;return!0}function iae(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 xu{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Ec(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){let e=new i(this.flatCoordinates.slice(),this.layout);return e.applyProperties(this),e}closestPointXY(e,t,n,r){if(r<cd(this.getExtent(),e,t))return r;let s=this.flatCoordinates,o=this.stride;for(let a=0,l=s.length;a<l;a+=o){let c=yc(e,t,s[a],s[a+1]);if(c<r){r=c;for(let u=0;u<o;++u)n[u]=s[a+u];n.length=o}}return r}getCoordinates(){return yu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Jh(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 Jh(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(cx(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=xx(this.flatCoordinates,0,e,this.stride),this.changed()}},hV=pI;function Qw(i,e,t,n){let r=[],s=Er();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=tg(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 AI=class i extends xu{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){let r=e,s=[],o=[];for(let a=0,l=r.length;a<l;++a){let c=r[a],u=s.length,f=c.getEnds();for(let p=0,x=f.length;p<x;++p)f[p]+=u;Ec(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;Ec(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let r=0,s=t.length;r<s;++r)t[r]+=n}this.endss_.push(t),this.changed()}clone(){let e=this.endss_.length,t=new Array(e);for(let r=0;r<e;++r)t[r]=this.endss_[r].slice();let n=new i(this.flatCoordinates.slice(),this.layout,t);return n.applyProperties(this),n}closestPointXY(e,t,n,r){return r<cd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(pz(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Az(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return vG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return fz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),UP(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,yx(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=Qw(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Lw(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new hV(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;xz(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=UP(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=gz(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{let s=this.endss_[e-1];t=s[s.length-1]}let n=this.endss_[e].slice(),r=n[n.length-1];if(t!==0)for(let s=0,o=n.length;s<o;++s)n[s]-=t;return new vu(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){let e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[],s=0;for(let o=0,a=n.length;o<a;++o){let l=n[o].slice(),c=l[l.length-1];if(s!==0)for(let f=0,p=l.length;f<p;++f)l[f]-=s;let u=new vu(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return wG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=hz(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()}},fV=AI;function mI(){let i=(U.map.zones||[]).filter(xI);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,Jw(!0),we.zoneIndex.hidden=i.length===0,we.zoneCount.textContent=Ic(i.length);for(let e of i){let t=Er(),n=[],r=!1;for(let l of e.features||[]){let c=oae(l);c&&(r=!0,n.push(c),tw(t,c.getExtent()),U.sources.zones.addFeature(new gd({geometry:c,zone:e,color:Uw(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=Uw(e.id),o=e.center?Cg(e.center.lat,e.center.lng):Ba(t),a=Math.max(t[2]-t[0],t[3]-t[1]);U.sources.zoneTitles.addFeature(new gd({geometry:new Jh(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(),rae()}function pV(){if(U.sources.zoneScrim.clear(),!U.highlightedZones.size)return;let[i,e,t,n]=U.projection.getExtent(),r=[dV([[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(dV(c.getCoordinates(),u>0))})}U.sources.zoneScrim.addFeature(new gd({geometry:new vu(r)}))}function dV(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 rae(){let i=document.createDocumentFragment();for(let{zone:e,depth:t}of sae()){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 sae(){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 Jw(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 AV(i){let e=U.zoneRecords.get(i);e&&(U.focusedZoneID=i,gV(),Rc(),U.engine.getView().fit(e.extent,{size:U.engine.getSize(),padding:[54,54,54,54],maxZoom:wu(U.variant),duration:220}),we.sidebar.classList.remove("is-open"),we.mobileLegend.setAttribute("aria-expanded","false"))}function mV(i){U.zoneRecords.has(i)&&(U.highlightedZones.has(i)?U.highlightedZones.delete(i):(U.highlightedZones.add(i),Jw(!0)),U.hoveredPin=null,gI(),_I(),gV(),pV(),U.layers.zones.changed(),U.layers.zoneTitles.changed(),U.layers.zoneTitleDetail.changed())}function gV(){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 oae(i){if(!i?.coordinates)return null;let e=([t,n])=>Cg(n,t);return i.type==="Polygon"?new vu(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new fV(i.coordinates.map(t=>t.map(n=>n.map(e)))):null}function Cg(i,e){let t=aae(),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 aae(){let i=U.game.tileGrid,e=U.map?.grid;return e?{...i,...e}:i}function _V(){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){Tu(e)!=="text"&&iV(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:Cg(t.lat,t.lng),filteredHidden:!1,priority:hae(e,t),feature:null};n.feature=new gd({geometry:new Jh(n.coordinate),pin:n,priority:n.priority}),U.pins.push(n),U.pinByID.set(t.id,n),Tu(e)==="text"?U.sources.text.addFeature(n.feature):U.sources.pins.addFeature(n.feature)}}Hl()}function Hl(){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)}gI(),_I(),U.selectedPin?.filteredHidden&&Rc(),xd(),document.dispatchEvent(new Event("atlas:filters"))}function gI(){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=>lae(n,e.coordinate)))}function lae(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 _I(){U.eligibleLocations=U.pins.filter(i=>!Xl(i)).length,bu(),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(),Z0()}function bu(){U.sources.priority.clear();for(let i of U.pins){if(Xl(i))continue;let e=!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search);(i===U.selectedPin||i===U.hoveredPin||e||wg(i))&&U.sources.priority.addFeature(i.feature)}}function Rg(i){U.hoveredPin!==i&&(U.hoveredPin=i,U.sources&&(bu(),U.layers.pins.changed(),U.layers.priority.changed()))}function eS(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 Mg(i){return i===U.selectedPin||i===U.hoveredPin||wg(i)||!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search)}function Xl(i){return i.filteredHidden||cae(i)||uae(i)||!xI(i.location)}function xI(i){let e=U.variant?.shard;return!e||!i.shard||i.shard===e}function cae(i){return!U.highlightedZones.size||i.insideHighlightedZone||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function uae(i){return!U.gridEnabled||!U.gridPrefix||wg(i)||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function hae(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+Ez(e.id)%1e3}function uV(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function Bx(){return(U.engine?.getView().getZoom()||0)>=(U.variant?.maxZoom||0)-.05}function xV(i){let e=[],t=[];for(let n of i){let r=[];for(let s of n.categories)(Tu(s)==="text"?t:r).push(s);r.length&&e.push({key:`group-${n.id}`,title:n.title,categories:r})}return t.length&&e.unshift({key:"text",title:"Text",categories:t}),e}function yV(){let i=document.createDocumentFragment();for(let e of U.map.sections){let t=document.createElement("section");t.className="layer-section",t.dataset.layerSection=e.key;let n=e.categories.reduce((s,o)=>s+o.locations.length,0);t.append(fae(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.categories)r.append(dae(s));t.append(r),i.append(t)}we.legend.replaceChildren(i),tS(),yd()}function fae(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=Ic(t),r.append(s,o,a);let l=vV(`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 vV(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 dae(i){let e=Tu(i)==="text",t=document.createElement("label");t.className="category-row",Sg(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",Tg(r,i,Pc(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=Ic(i.locations.length);let a=vV(`Show only ${i.title}`);return a.dataset.onlyCategory=String(i.id),t.append(n,r,s,a,o),t}function yI(i){if(U.collapsedSections.clear(),i)for(let e of we.layers.querySelectorAll("[data-section]"))U.collapsedSections.add(e.dataset.section);tS()}function tS(){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)}Cc()}function Ux(i){if(U.hiddenCategories.clear(),!i)for(let e of U.map.groups)for(let t of e.categories)U.hiddenCategories.add(t.id);Mx(),Hl(),xd(),yd()}function Mx(){for(let i of document.querySelectorAll("[data-category]"))i.checked=!U.hiddenCategories.has(Number(i.dataset.category))}function bV(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);Mx(),Hl(),yd()}function wV(i){if(U.map){if(pae(i)){Ux(!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)}Mx(),Hl(),xd(),yd()}}function pae(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 Aae(){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 yd(){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)))}Aae(),Cc()}}async function SV(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 mae(r,s),{...i,grid:n.grid,variants:n.variants,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:xV(n.groups)}}function mae(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 Rz(){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 nS=null;function K0(){return nS||(nS=gae().finally(()=>{nS=null})),nS}async function gae(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=U.game;if(U.catalog=await i.json(),R0(we.game,U.catalog.games,"title"),vI(),!U.catalog.games.length)return;let t=e&&U.catalog.games.find(n=>n.slug===e.slug);if(!t){let n=yg();await of(n.game||xg()?.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 of(t.slug,U.map?.slug);return}U.game=t,we.game.value=t.slug}function vI(){let i=!U.catalog?.games?.length;we.emptyState.hidden=!i,U.catalog?.bundlesDir&&(we.emptyPath.textContent=U.catalog.bundlesDir)}async function bI(){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 K0();let t=e.imported?.[0];t&&U.catalog.games.some(n=>n.slug===t)&&await of(t)}finally{for(let i of[we.emptyOpen,we.addBundles])i.disabled=!1}}var Zs={ADD:"add",REMOVE:"remove"};var TV={LENGTH:"length"},Pg=class extends Xs{constructor(e,t,n){super(e),this.element=t,this.index=n}},wI=class extends gs{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(TV.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 Pg(Zs.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 Pg(Zs.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 Pg(Zs.REMOVE,r,e)),this.dispatchEvent(new Pg(Zs.ADD,t,e))}updateLength_(){this.set(TV.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")}},co=wI;var SI=class extends Xs{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Sd=SI;var TI=class extends Sd{constructor(e,t,n,r,s,o){super(e,t,s),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0?r:!1,this.activePointers=o}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},Cu=TI;var nr={SINGLECLICK:"singleclick",CLICK:Jt.CLICK,DBLCLICK:Jt.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var kx={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var EI=class extends md{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=Un(n,kx.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=Un(n,kx.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_,vw?{passive:!1}:!1)}emulateClick_(e){let t=new Cu(nr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Cu(nr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new Cu(nr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==nr.POINTERUP||t.type==nr.POINTERCANCEL){delete this.trackedTouches_[n];for(let r in this.trackedTouches_)if(this.trackedTouches_[r].target!==t.target){delete this.trackedTouches_[r];break}}else(t.type==nr.POINTERDOWN||t.type==nr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new Cu(nr.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(ii),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new Cu(nr.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(Un(n,nr.POINTERMOVE,this.handlePointerMove_,this),Un(n,nr.POINTERUP,this.handlePointerUp_,this),Un(this.element_,nr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(Un(this.element_.getRootNode(),nr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new Cu(nr.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new Cu(nr.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(ii(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(ii(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(ii),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},EV=EI;var Ru={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var uo={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var Gx=1/0,MI=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,_u(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){zn(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=Gx?(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==Gx?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},MV=MI;var CI=class extends MV{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())}}},CV=CI;function RV(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return Gx;if(!i.wantedTiles[t][e.getKey()])return Gx;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 Os={ANIMATING:0,INTERACTING:1};var $l={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function RI(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=_i(n[0],p,x),T=_i(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 PV(i){return i}function PI(i,e,t,n){let r=Wn(e)/t[0],s=gr(e)/t[1];return n?Math.min(i,Math.max(r,s)):Math.min(i,Math.min(r,s))}function II(i,e,t){let n=Math.min(i,e),r=50;return n*=Math.log(1+r*Math.max(0,i/e-1))/r+1,t&&(n=Math.max(n,t),n/=Math.log(1+r*Math.max(0,t/i-1))/r+1),_i(n,t/2,e*2)}function IV(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?PI(l,t,o,n):l;if(a)return e?II(r,u,c):_i(r,c,u);let f=Math.min(u,r),p=Math.floor(fg(i,f,s));return i[p]>u&&p<i.length-1?i[p+1]:i[p]}})}function NV(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?PI(e,r,l,s):e;if(c)return n?II(o,u,t):_i(o,t,u);let f=1e-9,p=Math.ceil(Math.log(e/u)/Math.log(i)-f),x=-a*(.5-f)+.5,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 _i(T,t,u)}})}function NI(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?PI(i,n,a,r):i;return!t||!l?_i(s,e,c):II(s,c,e)}})}function Ig(i){if(i!==void 0)return 0}function LI(i){if(i!==void 0)return i}function LV(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 DV(i){let e=i===void 0?vc(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var DI=0,OI=class extends gs{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=pw(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&&hG(),e.center&&(e.center=Sc(e.center,this.projection_)),e.extent&&(e.extent=Tc(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in $l)delete t[a];this.setProperties(t,!0);let n=xae(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=_ae(e),s=n.constraint,o=yae(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=Sc(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=Sc(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&&iS(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||FG,callback:n};if(u.center&&(f.sourceCenter=o,f.targetCenter=u.center.slice(),o=f.targetCenter),u.zoom!==void 0?(f.sourceResolution=a,f.targetResolution=this.getResolutionForZoom(u.zoom),a=f.targetResolution):u.resolution&&(f.sourceResolution=a,f.targetResolution=u.resolution,a=f.targetResolution),u.rotation!==void 0){f.sourceRotation=l;let p=gu(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+p,l=f.targetRotation}vae(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(Os.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Os.ANIMATING]>0}getInteracting(){return this.hints_[Os.INTERACTING]>0}cancelAnimations(){this.setHint(Os.ANIMATING,-this.hints_[Os.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&iS(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?gu(l.targetRotation+Math.PI,2*Math.PI)-Math.PI:l.sourceRotation+f*(l.targetRotation-l.sourceRotation);if(l.anchor){let x=this.constraints_.rotation(p,!0);this.targetCenter_=this.calculateCenterRotate(x,l.anchor)}this.nextRotation_=l.targetRotation,this.targetRotation_=p}if(this.applyTargetState_(!0),t=!0,!l.complete)break}if(s){this.animations_[n]=null,this.setHint(Os.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&iS(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]],sg(n,e-this.getRotation()),H9(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&&Ax(e,this.getProjection())}getCenterInternal(){return this.get($l.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(e){return e!==void 0?(e[0]=this.hints_[0],e[1]=this.hints_[1],e):this.hints_.slice()}calculateExtent(e){let t=this.calculateExtentInternal(e);return fd(t,this.getProjection())}calculateExtentInternal(e){e=e||this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();zn(t,"The view center is not defined");let n=this.getResolution();zn(n!==void 0,"The view resolution is not defined");let r=this.getRotation();return zn(r!==void 0,"The view rotation is not defined"),hx(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($l.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Tc(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t=t||this.getViewportSizeMinusPadding_();let n=Wn(e)/t[0],r=gr(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e=e||2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(s){return t/Math.pow(e,s*r)})}getRotation(){return this.get($l.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=FI(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=fg(this.resolutions_,e,1);t=s,n=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=n/this.resolutions_[s+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=_i(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,_i(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(zn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){zn(!mu(e),"Cannot fit empty extent provided as `geometry`");let r=Tc(e,this.getProjection());n=kP(r)}else if(e.getType()==="Circle"){let r=Tc(e.getExtent(),this.getProjection());n=kP(r),n.rotate(this.getRotation(),Ba(r))}else{let r=U0();r?n=e.clone().transform(r,this.getProjection()):n=e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),s=e.getFlatCoordinates(),o=e.getStride(),a=1/0,l=1/0,c=-1/0,u=-1/0;for(let f=0,p=s.length;f<p;f+=o){let x=s[f]*n-s[f+1]*r,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=Ba(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:Qh;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),iS(S,!0))}centerOn(e,t,n){this.centerOnInternal(Sc(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(FI(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=FI(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=Ax(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&&Sc(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=Sc(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&&Sc(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($l.ROTATION)!==r&&this.set($l.ROTATION,r),this.get($l.RESOLUTION)!==o&&(this.set($l.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get($l.CENTER)||!D0(this.get($l.CENTER),a))&&this.set($l.CENTER,a),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e!==void 0?e:200;let r=t||0,s=this.constraints_.rotation(this.targetRotation_),o=this.getViewportSize_(s),a=this.constraints_.resolution(this.targetResolution_,r,o),l=this.constraints_.center(this.targetCenter_,a,o,!1,this.calculateCenterShift(this.targetCenter_,a,s,o));if(e===0&&!this.cancelAnchor_){this.targetResolution_=a,this.targetRotation_=s,this.targetCenter_=l,this.applyTargetState_();return}n=n||(e===0?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,(this.getResolution()!==a||this.getRotation()!==s||!this.getCenterInternal()||!D0(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:ql,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Os.INTERACTING,1)}endInteraction(e,t,n){n=n&&Sc(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(Os.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 iS(i,e){setTimeout(function(){i(e)},0)}function _ae(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return RI(i.extent,i.constrainOnlyCenter,t)}let e=pw(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,RI(t,!1,!1)}return PV}function xae(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:DI,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=pw(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=IV(S,u,!v&&w,f):e=NI(t,n,u,!v&&w,f)}else{let T=(x?Math.max(Wn(x),gr(x)):360*$h.degrees/p.getMetersPerUnit())/256/Math.pow(2,DI),P=T/Math.pow(2,28-DI);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=NV(l,t,n,u,!v&&w,f):e=NI(t,n,u,!v&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function yae(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?DV():t===!1?LI:typeof t=="number"?LV(t):LI}return Ig}function vae(i){return!(i.sourceCenter&&i.targetCenter&&!D0(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function FI(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 ul=OI;var BI=class extends gs{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!==Qh&&this.listenerKeys.push(Un(e,Ru.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},Ng=BI;var UI=class extends Ng{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=e.collapsed!==void 0?e.collapsed:!0,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible!==void 0?e.collapsible:!0,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className!==void 0?e.className:"ol-attribution",n=e.tipLabel!==void 0?e.tipLabel:"Attributions",r=e.expandClassName!==void 0?e.expandClassName:t+"-expand",s=e.collapseLabel!==void 0?e.collapseLabel:"\u203A",o=e.collapseClassName!==void 0?e.collapseClassName:t+"-collapse";typeof s=="string"?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=s,this.collapseLabel_.className=o):this.collapseLabel_=s;let a=e.label!==void 0?e.label:"i";typeof a=="string"?(this.label_=document.createElement("span"),this.label_.textContent=a,this.label_.className=r):this.label_=a;let l=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(l),this.toggleButton_.addEventListener(Jt.CLICK,this.handleClick_.bind(this),!1);let c=t+" "+bd+" "+Eg+(this.collapsed_&&this.collapsible_?" "+eI:"")+(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=>PG(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!Io(t,this.renderedAttributions_)){BG(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(eI),this.collapsed_?hP(this.collapseLabel_,this.label_):hP(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)}},FV=UI;var kI=class extends Ng{constructor(e){e=e||{},super({element:document.createElement("div"),render:e.render,target:e.target});let t=e.className!==void 0?e.className:"ol-rotate",n=e.label!==void 0?e.label:"\u21E7",r=e.compassClassName!==void 0?e.compassClassName:"ol-compass";this.label_=null,typeof n=="string"?(this.label_=document.createElement("span"),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let s=e.tipLabel?e.tipLabel:"Reset rotation",o=document.createElement("button");o.className=t+"-reset",o.setAttribute("type","button"),o.title=s,o.appendChild(this.label_),o.addEventListener(Jt.CLICK,this.handleClick_.bind(this),!1);let a=t+" "+bd+" "+Eg,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(Lx)}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:ql}):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(Lx);!s&&n===0?this.element.classList.add(Lx):s&&n!==0&&this.element.classList.remove(Lx)}this.label_.style.transform=r}this.rotation_=n}},OV=kI;var GI=class extends Ng{constructor(e){e=e||{},super({element:document.createElement("div"),target:e.target});let t=e.className!==void 0?e.className:"ol-zoom",n=e.delta!==void 0?e.delta:1,r=e.zoomInClassName!==void 0?e.zoomInClassName:t+"-in",s=e.zoomOutClassName!==void 0?e.zoomOutClassName:t+"-out",o=e.zoomInLabel!==void 0?e.zoomInLabel:"+",a=e.zoomOutLabel!==void 0?e.zoomOutLabel:"\u2013",l=e.zoomInTipLabel!==void 0?e.zoomInTipLabel:"Zoom in",c=e.zoomOutTipLabel!==void 0?e.zoomOutTipLabel:"Zoom out",u=document.createElement("button");u.className=r,u.setAttribute("type","button"),u.title=l,u.appendChild(typeof o=="string"?document.createTextNode(o):o),u.addEventListener(Jt.CLICK,this.handleClick_.bind(this,n),!1);let f=document.createElement("button");f.className=s,f.setAttribute("type","button"),f.title=c,f.appendChild(typeof a=="string"?document.createTextNode(a):a),f.addEventListener(Jt.CLICK,this.handleClick_.bind(this,-n),!1);let p=t+" "+bd+" "+Eg,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:ql})):n.setZoom(s)}}},BV=GI;function rS(i){i=i||{};let e=new co;return(i.zoom===void 0||i.zoom)&&e.push(new BV(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new OV(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new FV(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_}},UV=zI;var VI={ACTIVE:"active"};var qI=class extends gs{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(VI.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(VI.ACTIVE,e)}setMap(e){this.map_=e}};function kV(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:OG,center:i.getConstrainedCenter(r)})}}function Lg(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:ql})}var Pu=qI;var HI=class extends Pu{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==nr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();Lg(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},GV=HI;function zx(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 zV=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},bae=function(i){let e=i.map.getTargetElement(),t=e.getRootNode(),n=i.map.getOwnerDocument().activeElement;return t instanceof ShadowRoot?t.host.contains(n):e.contains(n)},sS=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?bae(i):!0},VV=Zh;var oS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(IG&&oP&&e.ctrlKey)};var aS=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var qV=function(i){let e=i.originalEvent;return oP?e.metaKey:e.ctrlKey},HV=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},lS=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},cS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var WV=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var WI=class extends Pu{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==nr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==nr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==nr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==nr.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function Dg(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 Iu=WI;var jI=class extends Iu{constructor(e){super({stopDown:Kh}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:zx(aS,WV);this.condition_=e.onFocusOnly?zx(sS,t):t,this.noKinetic_=!1}handleDragEvent(e){let t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());let n=this.targetPointers,r=t.getEventPixel(Dg(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();W9(s,a.getResolution()),sg(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:ql})}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}},jV=jI;var XI=class extends Iu{constructor(e){e=e||{},super({stopDown:Kh}),this.condition_=e.condition?e.condition:zV,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!cS(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===Ig)return;let r=t.getSize(),s=e.pixel,o=Math.atan2(r[1]/2-s[1],s[0]-r[0]/2);if(this.lastAngle_!==void 0){let a=o-this.lastAngle_;n.adjustRotationInternal(-a)}this.lastAngle_=o}handleUpEvent(e){return cS(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return cS(e)&&oS(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},XV=XI;var $I=class extends Ad{constructor(e){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_,n="px",r=this.element_.style;r.left=Math.min(e[0],t[0])+n,r.top=Math.min(e[1],t[1])+n,r.width=Math.abs(t[0]-e[0])+n,r.height=Math.abs(t[1]-e[1])+n}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let t=this.element_.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_,r=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);r[4]=r[0].slice(),this.geometry_?this.geometry_.setCoordinates([r]):this.geometry_=new vu([r])}getGeometry(){return this.geometry_}},$V=$I;var Fg={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},Q0=class extends Xs{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},YI=class extends Iu{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new $V(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??oS,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 Q0(Fg.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 Q0(t?Fg.BOXEND:Fg.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 Q0(Fg.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Q0(Fg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new Q0(Fg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},YV=YI;var ZI=class extends YV{constructor(e){e=e||{};let t=e.condition?e.condition:HV;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:ql})}},ZV=ZI;var Td={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var KI=class extends Pu{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return aS(t)&&lS(t)},this.condition_=e.condition!==void 0?e.condition:this.defaultCondition_,this.duration_=e.duration!==void 0?e.duration:100,this.pixelDelta_=e.pixelDelta!==void 0?e.pixelDelta:128}handleEvent(e){let t=!1;if(e.type==Jt.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Td.DOWN||r==Td.LEFT||r==Td.RIGHT||r==Td.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Td.DOWN?c=-a:r==Td.LEFT?l=-a:r==Td.RIGHT?l=a:c=a;let u=[l,c];sg(u,o.getRotation()),kV(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},KV=KI;var QI=class extends Pu{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!qV(t)&&lS(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();Lg(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},QV=QI;var wae=40,Sae=300,Tae=3,JI=class extends Pu{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:VV;this.condition_=e.onFocusOnly?zx(sS,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(e){if(this.ctrlKeyListenerKeys_.forEach(ii),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(Un(t,"keydown",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!0)}),Un(t,"keyup",n=>{n.key==="Control"&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==Jt.WHEEL)return!0;let n=e.map,r=e.originalEvent;r.preventDefault();let s=r.ctrlKey&&!this.ctrlKeyPressed_;r.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let o=r.deltaY;switch(r.deltaMode){case WheelEvent.DOM_DELTA_LINE:o*=wae;break;case WheelEvent.DOM_DELTA_PAGE:o*=Sae;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*Tae),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;let c=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),c),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-_i(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),Lg(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)}},JV=JI;var e5=class extends Iu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Kh),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!==Ig&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Dg(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}},eq=e5;var t5=class extends Iu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Kh),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(Dg(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}},tq=t5;function uS(i){i=i||{};let e=new co,t=new UV(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new XV),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new GV({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new jV({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new eq),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new tq({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new KV),e.push(new QV({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new JV({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new ZV({duration:i.zoomDuration})),e}var Ti={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var n5=class extends gs{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties=="object"&&(delete t.properties,Object.assign(t,e.properties)),t[Ti.OPACITY]=e.opacity!==void 0?e.opacity:1,zn(typeof t[Ti.OPACITY]=="number","Layer opacity must be a number"),t[Ti.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ti.Z_INDEX]=e.zIndex,t[Ti.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ti.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ti.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ti.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=_i(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return $n()}getLayerStatesArray(e){return $n()}getExtent(){return this.get(Ti.EXTENT)}getMaxResolution(){return this.get(Ti.MAX_RESOLUTION)}getMinResolution(){return this.get(Ti.MIN_RESOLUTION)}getMinZoom(){return this.get(Ti.MIN_ZOOM)}getMaxZoom(){return this.get(Ti.MAX_ZOOM)}getOpacity(){return this.get(Ti.OPACITY)}getSourceState(){return $n()}getVisible(){return this.get(Ti.VISIBLE)}getZIndex(){return this.get(Ti.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ti.EXTENT,e)}setMaxResolution(e){this.set(Ti.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ti.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ti.MAX_ZOOM,e)}setMinZoom(e){this.set(Ti.MIN_ZOOM,e)}setOpacity(e){zn(typeof e=="number","Layer opacity must be a number"),this.set(Ti.OPACITY,e)}setVisible(e){this.set(Ti.VISIBLE,e)}setZIndex(e){this.set(Ti.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},hS=n5;var Ed={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Nc=class extends Xs{constructor(e,t){super(e),this.layer=t}},i5={LAYERS:"layers"},r5=class i extends hS{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(i5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new co(n.slice(),{unique:!0}):zn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new co(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(ii),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(Un(e,Zs.ADD,this.handleLayersAdd_,this),Un(e,Zs.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(ii);_u(this.listenerKeys_);let t=e.getArray();for(let n=0,r=t.length;n<r;n++){let s=t[n];this.registerLayerListeners_(s),this.dispatchEvent(new Nc(Ed.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[Un(e,Mc.PROPERTYCHANGE,this.handleLayerChange_,this),Un(e,Jt.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(Un(e,Ed.ADDLAYER,this.handleLayerGroupAdd_,this),Un(e,Ed.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Nn(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Nc(Ed.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Nc(Ed.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Nc(Ed.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=Nn(t);this.listenerKeys_[n].forEach(ii),delete this.listenerKeys_[n],this.dispatchEvent(new Nc(Ed.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(i5.LAYERS)}setLayers(e){let t=this.getLayers();if(t){let n=t.getArray();for(let r=0,s=n.length;r<s;++r)this.dispatchEvent(new Nc(Ed.REMOVELAYER,n[r]))}this.set(i5.LAYERS,e)}getLayersArray(e){return e=e!==void 0?e:[],this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){let t=e!==void 0?e:[],n=t.length;this.getLayers().forEach(function(o){o.getLayerStatesArray(t)});let r=this.getLayerState(),s=r.zIndex;!e&&r.zIndex===void 0&&(s=0);for(let o=n,a=t.length;o<a;o++){let l=t[o];l.opacity*=r.opacity,l.visible=l.visible&&r.visible,l.maxResolution=Math.min(l.maxResolution,r.maxResolution),l.minResolution=Math.max(l.minResolution,r.minResolution),l.minZoom=Math.max(l.minZoom,r.minZoom),l.maxZoom=Math.min(l.maxZoom,r.maxZoom),r.extent!==void 0&&(l.extent!==void 0?l.extent=Au(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},Vx=r5;var ho={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var s5=class extends hS{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Ti.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Ti.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(ii(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=Un(e,Jt.CHANGE,this.handleSourceChange_,this),e.getState()==="ready"&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),e instanceof ul?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 qx(r,t.viewState)&&(!s||_r(s,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=e instanceof ul?e.getViewStateAndExtent():e,r=t(n);return Array.isArray(r)||(r=[r]),r}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(Ti.MAP,e)}getMapInternal(){return this.get(Ti.MAP)}setMap(e){this.mapPrecomposeKey_&&(ii(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(ii(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=Un(e,ho.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=Un(this,Jt.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);zn(!t.some(r=>r.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(Ti.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function qx(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 J0=s5;function fS(i,e,t=0,n=i.length-1,r=Eae){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));fS(i,e,x,v,r)}let s=i[e],o=t,a=n;for(Hx(i,t,e),r(i[n],s)>0&&Hx(i,t,n);o<a;){for(Hx(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?Hx(i,t,a):(a++,Hx(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function Hx(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function Eae(i,e){return i<e?-1:i>e?1:0}var eA=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(!pS(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;pS(e,l)&&(t.leaf?n.push(a):a5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!pS(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(pS(e,o)){if(t.leaf||a5(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=Bg([]),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=Mae(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&a5(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=Bg(e.slice(t,n+1)),Og(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=Bg([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));nq(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);nq(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 Og(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=o5(c),f=Pae(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),jx(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=Bg(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Og(n,this.toBBox),Og(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=Bg([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Og(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=Wx(e,0,a,this.toBBox),c=Wx(e,a,n,this.toBBox),u=Iae(l,c),f=o5(l)+o5(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:Cae,s=e.leaf?this.compareMinY:Rae,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=Wx(e,0,t,s),a=Wx(e,n-t,n,s),l=dS(o)+dS(a);for(let c=t;c<n-t;c++){let u=e.children[c];jx(o,e.leaf?s(u):u),l+=dS(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];jx(a,e.leaf?s(u):u),l+=dS(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)jx(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():Og(e[t],this.toBBox)}};function Mae(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 Og(i,e){Wx(i,0,i.children.length,e,i)}function Wx(i,e,t,n,r){r||(r=Bg(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];jx(r,i.leaf?n(o):o)}return r}function jx(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 Cae(i,e){return i.minX-e.minX}function Rae(i,e){return i.minY-e.minY}function o5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function dS(i){return i.maxX-i.minX+(i.maxY-i.minY)}function Pae(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 Iae(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 a5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function pS(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function Bg(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function nq(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;fS(i,o,e,t,r),s.push(e,o,o,t)}}var nA=0,mS=0,Fo=1<<nA++,ri=1<<nA++,Oo=1<<nA++,sa=1<<nA++,lf=1<<nA++,tA=1<<nA++,gS=Math.pow(2,nA)-1,c5={[Fo]:"boolean",[ri]:"number",[Oo]:"string",[sa]:"color",[lf]:"number[]",[tA]:"size"},Nae=Object.keys(c5).map(Number).sort(Ua);function Lae(i){return i in c5}function af(i){let e=[];for(let t of Nae)Xx(i,t)&&e.push(c5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function Xx(i,e){return(i&e)===e}function AS(i,e){return!!(i&e)}function Md(i,e){return i===e}var Cr=class{constructor(e,t){if(!Lae(e))throw new Error(`literal expressions must have a specific type, got ${af(e)}`);this.type=e,this.value=t}},_S=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function xS(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function Wr(i,e,t){switch(typeof i){case"boolean":{if(Md(e,Oo))return new Cr(Oo,i?"true":"false");if(!Xx(e,Fo))throw new Error(`got a boolean, but expected ${af(e)}`);return new Cr(Fo,i)}case"number":{if(Md(e,tA))return new Cr(tA,qr(i));if(Md(e,Fo))return new Cr(Fo,!!i);if(Md(e,Oo))return new Cr(Oo,i.toString());if(!Xx(e,ri))throw new Error(`got a number, but expected ${af(e)}`);return new Cr(ri,i)}case"string":{if(Md(e,sa))return new Cr(sa,Px(i));if(Md(e,Fo))return new Cr(Fo,!!i);if(!Xx(e,Oo))throw new Error(`got a string, but expected ${af(e)}`);return new Cr(Oo,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 Wae(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Md(e,tA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new Cr(tA,i)}if(Md(e,sa)){if(i.length===3)return new Cr(sa,[...i,1]);if(i.length===4)return new Cr(sa,i);throw new Error(`expected an array of 3 or 4 values for a color, got ${i.length}`)}if(!Xx(e,lf))throw new Error(`got an array of numbers, but expected ${af(e)}`);return new Cr(lf,i)}var Je={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},Dae={[Je.Get]:Dn(Yn(1,1/0),iq),[Je.Var]:Fae(),[Je.Has]:Dn(Yn(1,1/0),iq),[Je.Id]:Dn(Oae,Ug),[Je.Concat]:Dn(Yn(2,1/0),ki(Oo)),[Je.GeometryType]:Dn(Bae,Ug),[Je.LineMetric]:Dn(Uae,Ug),[Je.Resolution]:Dn(l5,Ug),[Je.Zoom]:Dn(l5,Ug),[Je.Time]:Dn(l5,Ug),[Je.Any]:Dn(Yn(2,1/0),ki(Fo)),[Je.All]:Dn(Yn(2,1/0),ki(Fo)),[Je.Not]:Dn(Yn(1,1),ki(Fo)),[Je.Equal]:Dn(Yn(2,2),sq()),[Je.NotEqual]:Dn(Yn(2,2),sq()),[Je.GreaterThan]:Dn(Yn(2,2),ki(ri)),[Je.GreaterThanOrEqualTo]:Dn(Yn(2,2),ki(ri)),[Je.LessThan]:Dn(Yn(2,2),ki(ri)),[Je.LessThanOrEqualTo]:Dn(Yn(2,2),ki(ri)),[Je.Multiply]:Dn(Yn(2,1/0),rq),[Je.Coalesce]:Dn(Yn(2,1/0),rq),[Je.Divide]:Dn(Yn(2,2),ki(ri)),[Je.Add]:Dn(Yn(2,1/0),ki(ri)),[Je.Subtract]:Dn(Yn(2,2),ki(ri)),[Je.Clamp]:Dn(Yn(3,3),ki(ri)),[Je.Mod]:Dn(Yn(2,2),ki(ri)),[Je.Pow]:Dn(Yn(2,2),ki(ri)),[Je.Abs]:Dn(Yn(1,1),ki(ri)),[Je.Floor]:Dn(Yn(1,1),ki(ri)),[Je.Ceil]:Dn(Yn(1,1),ki(ri)),[Je.Round]:Dn(Yn(1,1),ki(ri)),[Je.Sin]:Dn(Yn(1,1),ki(ri)),[Je.Cos]:Dn(Yn(1,1),ki(ri)),[Je.Atan]:Dn(Yn(1,2),ki(ri)),[Je.Sqrt]:Dn(Yn(1,1),ki(ri)),[Je.Match]:Dn(Yn(4,1/0),oq,Gae),[Je.Between]:Dn(Yn(3,3),ki(ri)),[Je.Interpolate]:Dn(Yn(6,1/0),oq,zae),[Je.Case]:Dn(Yn(3,1/0),kae,Vae),[Je.In]:Dn(Yn(2,2),qae),[Je.Number]:Dn(Yn(1,1/0),ki(gS)),[Je.String]:Dn(Yn(1,1/0),ki(gS)),[Je.Array]:Dn(Yn(1,1/0),ki(ri)),[Je.Color]:Dn(Yn(1,4),ki(ri)),[Je.Band]:Dn(Yn(1,3),ki(ri)),[Je.Palette]:Dn(Yn(2,2),Hae),[Je.ToString]:Dn(Yn(1,1),ki(Fo|ri|Oo|sa))};function iq(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=i[s+1];switch(typeof o){case"number":{r[s]=new Cr(ri,o);break}case"string":{r[s]=new Cr(Oo,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 Fae(){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=Wr(s,gS,t);if(!(o instanceof Cr))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${n}`);let a=o.type;if(typeof s=="string"&&AS(r,sa)&&!AS(r,Oo)?a=sa:Array.isArray(s)&&s.length===2&&AS(r,tA)&&!AS(r,lf)&&(a=tA),r&=a,r===mS)throw new Error(`the type expected from the var operator (${af(e)}) did not have any overlap with the type of the corresponding style variables (${af(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===mS)throw new Error(`a new type expected from the var operator (${af(e)}) did not have any overlap with the previous type expected for it (${af(o)}), variable name: ${n}`)}return t.variables.set(n,r),new _S(r,"var",new Cr(Oo,n))}}function Oae(i,e,t){t.featureId=!0}function Bae(i,e,t){t.geometryType=!0}function Uae(i,e,t){t.mCoordinate=!0}function l5(i,e,t){t.mapState=!0}function Ug(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Yn(i,e){return function(t,n,r){let s=t[0],o=t.length-1;if(i===e){if(o!==i){let a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${s}, got ${o}`)}}else if(o<i||o>e){let a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function rq(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=Wr(i[s+1],e,t);r[s]=o}return r}function ki(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=Wr(e[o+1],i,n);s[o]=a}return s}}function sq(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=gS;for(let a=0;a<r;++a){let l=Wr(i[a+1],o,t);o&=l.type}if(o===mS)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=Wr(i[a+1],o,t);s[a]=l}return s}}function kae(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 oq(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 Gae(i,e,t){let n=i.length-1,r=Wr(i[i.length-1],e,t),s=Oo|ri|Fo,o=new Array(n-2);for(let l=0;l<n-2;l+=2){try{let c=Wr(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===mS)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=Wr(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=Wr(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[Wr(i[1],s,t),...o,r]}function zae(i,e,t){let n=i[1],r;switch(n[0]){case"linear":r=1;break;case"exponential":let l=n[1];if(typeof l!="number"||l<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(l)} instead`);r=l;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(n)}`)}let s=new Cr(ri,r),o;try{o=Wr(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=Wr(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=Wr(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 Vae(i,e,t){let n=Wr(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=Wr(i[s+1],Fo,t);r[s]=o}catch(o){throw new Error(`failed to parse argument ${s} of case expression: ${o.message}`)}try{let o=Wr(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 qae(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=Oo:r=ri;let s=new Array(n.length);for(let a=0;a<s.length;a++)try{let l=Wr(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[Wr(i[1],r,t),...s]}function Hae(i,e,t){let n;try{n=Wr(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=Wr(r[o],sa,t)}catch(l){throw new Error(`failed to parse color at index ${o} in palette expression: ${l.message}`)}if(!(a instanceof Cr))throw new Error(`the palette color at index ${o} must be a literal value`);s[o]=a}return[n,...s]}function Dn(...i){return function(e,t,n){let r=e[0],s;for(let o=0;o<i.length;o++){let a=i[o](e,t,n);if(o==i.length-1){if(!a)throw new Error("expected last argument validator to return the parsed args");s=a}}return new _S(t,r,...s)}}function Wae(i,e,t){let n=i[0],r=Dae[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function yS(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 yS(i.getGeometries()[0]);default:return""}}function u5(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Dc(i,e,t){let n=Wr(i,e,t);return Lc(n,t)}function Lc(i,e){if(i instanceof Cr){if(i.type===sa&&typeof i.value=="string"){let n=Px(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 jae(i,e);case Je.Get:case Je.Var:case Je.Has:return Xae(i,e);case Je.Id:return n=>n.featureId;case Je.GeometryType:return n=>n.geometryType;case Je.Concat:{let n=i.args.map(r=>Lc(r,e));return r=>"".concat(...n.map(s=>s(r).toString()))}case Je.Resolution:return n=>n.resolution;case Je.Any:case Je.All:case Je.Between:case Je.In:case Je.Not:return Yae(i,e);case Je.Equal:case Je.NotEqual:case Je.LessThan:case Je.LessThanOrEqualTo:case Je.GreaterThan:case Je.GreaterThanOrEqualTo:return $ae(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 Zae(i,e);case Je.Case:return Kae(i,e);case Je.Match:return Qae(i,e);case Je.Interpolate:return Jae(i,e);case Je.ToString:return ele(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function jae(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Lc(i.args[s],e);switch(t){case Je.Coalesce:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a<"u"&&a!==null)return a}throw new Error("Expected one of the values to be non-null")};case Je.Number:case Je.String:return s=>{for(let o=0;o<n;++o){let a=r[o](s);if(typeof a===t)return a}throw new Error(`Expected one of the values to be a ${t}`)};default:throw new Error(`Unsupported assertion operator ${t}`)}}function Xae(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 $ae(i,e){let t=i.operator,n=Lc(i.args[0],e),r=Lc(i.args[1],e);switch(t){case Je.Equal:return s=>n(s)===r(s);case Je.NotEqual:return s=>n(s)!==r(s);case Je.LessThan:return s=>n(s)<r(s);case Je.LessThanOrEqualTo:return s=>n(s)<=r(s);case Je.GreaterThan:return s=>n(s)>r(s);case Je.GreaterThanOrEqualTo:return s=>n(s)>=r(s);default:throw new Error(`Unsupported comparison operator ${t}`)}}function Yae(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Lc(i.args[s],e);switch(t){case Je.Any:return s=>{for(let o=0;o<n;++o)if(r[o](s))return!0;return!1};case Je.All:return s=>{for(let o=0;o<n;++o)if(!r[o](s))return!1;return!0};case Je.Between:return s=>{let o=r[0](s),a=r[1](s),l=r[2](s);return o>=a&&o<=l};case Je.In:return s=>{let o=r[0](s);for(let a=1;a<n;++a)if(o===r[a](s))return!0;return!1};case Je.Not:return s=>!r[0](s);default:throw new Error(`Unsupported logical operator ${t}`)}}function Zae(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Lc(i.args[s],e);switch(t){case Je.Multiply:return s=>{let o=1;for(let a=0;a<n;++a)o*=r[a](s);return o};case Je.Divide:return s=>r[0](s)/r[1](s);case Je.Add:return s=>{let o=0;for(let a=0;a<n;++a)o+=r[a](s);return o};case Je.Subtract:return s=>r[0](s)-r[1](s);case Je.Clamp:return s=>{let o=r[0](s),a=r[1](s);if(o<a)return a;let l=r[2](s);return o>l?l:o};case Je.Mod:return s=>r[0](s)%r[1](s);case Je.Pow:return s=>Math.pow(r[0](s),r[1](s));case Je.Abs:return s=>Math.abs(r[0](s));case Je.Floor:return s=>Math.floor(r[0](s));case Je.Ceil:return s=>Math.ceil(r[0](s));case Je.Round:return s=>Math.round(r[0](s));case Je.Sin:return s=>Math.sin(r[0](s));case Je.Cos:return s=>Math.cos(r[0](s));case Je.Atan:return n===2?s=>Math.atan2(r[0](s),r[1](s)):s=>Math.atan(r[0](s));case Je.Sqrt:return s=>Math.sqrt(r[0](s));default:throw new Error(`Unsupported numeric operator ${t}`)}}function Kae(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Lc(i.args[r],e);return r=>{for(let s=0;s<t-1;s+=2)if(n[s](r))return n[s+1](r);return n[t-1](r)}}function Qae(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Lc(i.args[r],e);return r=>{let s=n[0](r);for(let o=1;o<t-1;o+=2)if(s===n[o](r))return n[o+1](r);return n[t-1](r)}}function Jae(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Lc(i.args[r],e);return r=>{let s=n[0](r),o=n[1](r),a,l;for(let c=2;c<t;c+=2){let u=n[c](r),f=n[c+1](r),p=Array.isArray(f);if(p&&(f=Lz(f)),u>=o)return c===2?f:p?tle(s,o,a,l,u,f):$x(s,o,a,l,u,f);a=u,l=f}return l}}function ele(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Lc(i.args[s],e);if(t===Je.ToString)return s=>{let o=r[0](s);return i.args[0].type===sa?Ix(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function $x(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 tle(i,e,t,n,r,s){if(r-t===0)return n;let a=KP(n),l=KP(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[$x(i,e,t,a[0],r,l[0]),$x(i,e,t,a[1],r,l[1]),a[2]+$x(i,e,t,0,r,c),$x(i,e,t,n[3],r,s[3])];return Dz(u)}function nle(i){return!0}function ile(i,e){e=e??xS();let t=rle(i,e),n=u5();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=yS(r.getGeometry())),t(n)}}function aq(i,e){e=e??xS();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=h5(i[o],e);let r=u5(),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=yS(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 hq(i,e){if(e=e??xS(),!Array.isArray(i))return aq([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 ile(s,e)}return aq(i,e)}function rle(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r],o="filter"in s?Dc(s.filter,Fo,e):nle,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=h5(s.style[c],e)}else a=[h5(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 h5(i,e){let t=Yx(i,"",e),n=Zx(i,"",e),r=sle(i,e),s=ole(i,e),o=fo(i,"z-index",e);if(!t&&!n&&!r&&!s&&!bc(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new Fs;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 Yx(i,e,t){let n;if(e+"fill-pattern-src"in i)n=ule(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=bS(i,e+"fill-color",t)}if(!n)return null;let r=new Hr;return function(s){let o=n(s);return o===qw?null:(r.setColor(o),r)}}function Zx(i,e,t){let n=fo(i,e+"stroke-width",t),r=bS(i,e+"stroke-color",t);if(!n&&!r)return null;let s=cf(i,e+"stroke-line-cap",t),o=cf(i,e+"stroke-line-join",t),a=fq(i,e+"stroke-line-dash",t),l=fo(i,e+"stroke-line-dash-offset",t),c=fo(i,e+"stroke-miter-limit",t),u=fo(i,e+"stroke-offset",t),f=new Ys;return function(p){if(r){let x=r(p);if(x===qw)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 sle(i,e){let t="text-",n=cf(i,t+"value",e);if(!n)return null;let r=Yx(i,t,e),s=Yx(i,t+"background-",e),o=Zx(i,t,e),a=Zx(i,t+"background-",e),l=cf(i,t+"font",e),c=fo(i,t+"max-angle",e),u=fo(i,t+"offset-x",e),f=fo(i,t+"offset-y",e),p=kg(i,t+"overflow",e),x=cf(i,t+"placement",e),v=fo(i,t+"repeat",e),w=wS(i,t+"scale",e),S=kg(i,t+"rotate-with-view",e),T=fo(i,t+"rotation",e),P=cf(i,t+"align",e),R=cf(i,t+"justify",e),C=cf(i,t+"baseline",e),L=kg(i,t+"keep-upright",e),D=fq(i,t+"padding",e),F=SS(i,t+"declutter-mode"),N=new sf({declutterMode:F});return function(B){if(N.setText(n(B)),r&&N.setFill(r(B)),s&&N.setBackgroundFill(s(B)),o&&N.setStroke(o(B)),a&&N.setBackgroundStroke(a(B)),l&&N.setFont(l(B)),c&&N.setMaxAngle(c(B)),u&&N.setOffsetX(u(B)),f&&N.setOffsetY(f(B)),p&&N.setOverflow(p(B)),x){let z=x(B);if(z!=="point"&&z!=="line")throw new Error("Expected point or line for text-placement");N.setPlacement(z)}if(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 ole(i,e){return"icon-src"in i?ale(i,e):"shape-points"in i?lle(i,e):"circle-radius"in i?cle(i,e):null}function ale(i,e){let t="icon-",n=t+"src",r=dq(i[n],n),s=vS(i,t+"anchor",e),o=wS(i,t+"scale",e),a=fo(i,t+"opacity",e),l=vS(i,t+"displacement",e),c=fo(i,t+"rotation",e),u=kg(i,t+"rotate-with-view",e),f=cq(i,t+"anchor-origin"),p=uq(i,t+"anchor-x-units"),x=uq(i,t+"anchor-y-units"),v=uf(i,t+"color"),w,S=null;v!==void 0&&(Array.isArray(v)&&v.length>0&&typeof v[0]=="string"?S=bS(i,t+"color",e):w=pq(v,t+"color"));let T=fle(i,t+"cross-origin"),P=dle(i,t+"offset"),R=cq(i,t+"offset-origin"),C=f5(i,t+"width"),L=f5(i,t+"height"),D=hle(i,t+"size"),F=SS(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 Y0(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 lle(i,e){let t="shape-",n=t+"points",r=t+"radius",s=d5(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=fo(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=fo(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=Yx(i,t,e),p=Zx(i,t,e),x=wS(i,t+"scale",e),v=vS(i,t+"displacement",e),w=fo(i,t+"rotation",e),S=kg(i,t+"rotate-with-view",e),T=f5(i,t+"angle"),P=SS(i,t+"declutter-mode"),R=new Yw({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 cle(i,e){let t="circle-",n=Yx(i,t,e),r=Zx(i,t,e),s=fo(i,t+"radius",e),o=wS(i,t+"scale",e),a=vS(i,t+"displacement",e),l=fo(i,t+"rotation",e),c=kg(i,t+"rotate-with-view",e),u=SS(i,t+"declutter-mode"),f=new Zw({radius:5,declutterMode:u});return function(p){return s&&f.setRadius(s(p)),n&&f.setFill(n(p)),r&&f.setStroke(r(p)),a&&f.setDisplacement(a(p)),l&&f.setRotation(l(p)),c&&f.setRotateWithView(c(p)),o&&f.setScale(o(p)),f}}function uf(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function fo(i,e,t){let n=uf(i,e);if(n===void 0)return;let r=Dc(n,ri,t);return function(s){return d5(r(s),e)}}function cf(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,Oo,t);return function(s){return dq(r(s),e)}}function ule(i,e,t){let n=cf(i,e+"pattern-src",t),r=lq(i,e+"pattern-offset",t),s=lq(i,e+"pattern-size",t),o=bS(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function kg(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,Fo,t);return function(s){let o=r(s);if(typeof o!="boolean")throw new Error(`Expected a boolean for ${e}`);return o}}function bS(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,sa,t);return function(s){return pq(r(s),e)}}function fq(i,e,t){let n=uf(i,e);if(n===void 0)return null;if(Array.isArray(n)&&(n.length===0||typeof n[0]!="string")){let s=n.map((o,a)=>{if(typeof o=="number")return()=>o;let l=Dc(o,ri,t);return function(c){return d5(l(c),`${e}[${a}]`)}});return function(o){let a=new Array(s.length);for(let l=0;l<s.length;++l)a[l]=s[l](o);return a}}let r=Dc(n,lf,t);return function(s){return Kx(r(s),e)}}function vS(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,lf,t);return function(s){let o=Kx(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function lq(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,lf,t);return function(s){return Aq(r(s),e)}}function wS(i,e,t){let n=uf(i,e);if(n===void 0)return null;let r=Dc(n,lf|ri,t);return function(s){return ple(r(s),e)}}function f5(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 hle(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return qr(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 fle(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 cq(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 uq(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 dle(i,e){let t=i[e];if(t!==void 0)return Kx(t,e)}function SS(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 Kx(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 dq(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function d5(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=Kx(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 Aq(i,e){let t=Kx(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function ple(i,e){return typeof i=="number"?i:Aq(i,e)}var mq={RENDER_ORDER:"renderOrder"},p5=class extends J0{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(mq.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 eA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(mq.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?uI:e;let t=Ale(e);this.styleFunction_=e===null?void 0:jz(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function Ale(i){if(i===void 0)return uI;if(!i)return null;if(typeof i=="function"||i instanceof Fs)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof Fs){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof Fs))throw new Error("Expected a list of style instances");n[r]=s}return n}return hq(i)}var TS=p5;var A5=class extends Xs{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},ES=A5;var m5=class extends Ad{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){$n()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;lo(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Tw(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=aw(e.slice(),p),v=[[0,0]];if(p.canWrapX()&&r){let C=p.getExtent(),L=Wn(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()&&qx(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,Zh,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){$n()}scheduleExpireIconCache(e){Lo.canExpireCache()&&e.postRenderFunctions.push(mle)}};function mle(i,e){Lo.expire()}var gq=m5;var g5=class extends gq{constructor(e){super(e),this.fontChangeListenerKey_=Un(X0,Mc.PROPERTYCHANGE,e.redrawText,e),this.element_=Ls?bw():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=bd+" ol-layers";let n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new ES(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(ho.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof TS&&u.layer.getDeclutter())&&(e.declutter={});let r=e.viewState;this.children_.length=0;let o=this.getMap().getTargetElement(),a;cl(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(!qx(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),UG(this.element_,this.children_);for(let u of a?this.children_:[]){let f=u.firstElementChild||u,p=u.style.backgroundColor;if(p&&(!cl(f)||f.width>0)&&(a.fillStyle=p,a.fillRect(0,0,a.canvas.width,a.canvas.height)),!cl(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(...Sw(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(ho.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))}}},_q=g5;function xq(i){if(i instanceof J0){i.setMapInternal(null);return}i instanceof Vx&&i.getLayers().forEach(xq)}function yq(i,e){if(i instanceof J0){i.setMapInternal(e);return}if(i instanceof Vx){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)yq(t[n],e)}}var _5=class extends gs{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=gle(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:NG,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=$s(),this.pixelToCoordinateTransform_=$s(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,Ls||(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,Ls||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(Ls?new co:rS()),this.interactions=t.interactions||(Ls?new co:uS({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new CV(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(uo.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(uo.VIEW,this.handleViewChanged_),this.addChangeListener(uo.SIZE,this.handleSizeChanged_),this.addChangeListener(uo.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof ul)&&e.view.then(function(r){n.setView(new ul(r))}),this.controls.addEventListener(Zs.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(Zs.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(Zs.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(Zs.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(Zs.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(Zs.REMOVE,r=>{let s=r.element.getId();s!==void 0&&delete this.overlayIdIndex_[s.toString()],r.element.setMap(null)}),this.controls.forEach(r=>{r.setMap(this)}),this.interactions.forEach(r=>{r.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){yq(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){let t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(e);n=n!==void 0?n:{};let s=n.hitTolerance!==void 0?n.hitTolerance:0,o=n.layerFilter!==void 0?n.layerFilter:Zh,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 Vx?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:Zh,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(uo.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Ax(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Mr(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){let t=this.overlayIdIndex_[e.toString()];return t!==void 0?t:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(uo.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof co){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=Sc(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Mr(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(uo.SIZE)}getView(){return this.get(uo.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 RV(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new Cu(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===kx.POINTERDOWN||n===Jt.WHEEL||n===Jt.KEYDOWN){let r=this.getOwnerDocument(),s=this.viewport_.getRootNode?this.viewport_.getRootNode():r,o=t.target,a=s instanceof ShadowRoot?s.host===o?s.host.ownerDocument:s:s===r?r.documentElement:s;if(this.overlayContainerStopEvent_.contains(o)||!a.contains(o))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){let r=this.getInteractions().getArray().slice();for(let s=r.length-1;s>=0;s--){let o=r[s];if(o.getMap()!==this||!o.getActive()||!this.getTargetElement())continue;if(!o.handleEvent(e)||e.propagationStopped)break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let r=this.maxTilesLoading_,s=r,o=e?e.viewHints:void 0,a=o?o[Os.ANIMATING]||o[Os.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(ho.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(ho.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Sd(Ru.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Sd(Ru.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_&&!cl(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(cl(t)||t.appendChild(this.viewport_),this.renderer_||(this.renderer_=new _q(this)),!cl(t)){this.mapBrowserEventHandler_=new EV(this,this.moveTolerance_);for(let r in nr)this.mapBrowserEventHandler_.addEventListener(nr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_,vw?{passive:!1}:!1);let n;if(this.keyboardEventTarget_)n=this.keyboardEventTarget_;else{let r=t.getRootNode();n=r instanceof ShadowRoot?r.host:t}if(this.targetChangeHandlerKeys_=[Un(n,Jt.KEYDOWN,this.handleBrowserEvent,this),Un(n,Jt.KEYPRESS,this.handleBrowserEvent,this)],!cl(t)){let r=t.getRootNode();r instanceof ShadowRoot&&this.resizeObserver_.observe(r.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(ii(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(ii(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=Un(e,Mc.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=Un(e,Jt.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(ii),this.layerGroupPropertyListenerKeys_=null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Nc("addlayer",e)),this.layerGroupPropertyListenerKeys_=[Un(e,Mc.PROPERTYCHANGE,this.render,this),Un(e,Jt.CHANGE,this.render,this),Un(e,"addlayer",this.handleLayerAdd_,this),Un(e,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;let e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){let r=e[t].layer;r.hasRenderer()&&r.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){xq(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&&J4(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:hx(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:o,wantedTiles:{},mapId:Nn(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let l=isNaN(a.nextRotation)?a.rotation:a.nextRotation;s.nextExtent=hx(a.nextCenter,a.nextResolution,l,t)}}this.frameState_=s,this.renderer_.renderFrame(s),s&&(s.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,s.postRenderFunctions),r&&(!this.previousExtent_||!mu(this.previousExtent_)&&!I0(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Sd(Ru.MOVESTART,this,r)),this.previousExtent_=P0(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Os.ANIMATING]&&!s.viewHints[Os.INTERACTING]&&!I0(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Sd(Ru.MOVEEND,this,s)),Jb(s.extent,this.previousExtent_))),this.dispatchEvent(new Sd(Ru.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Ru.LOADSTART)||this.hasListener(Ru.LOADEND)||this.hasListener(ho.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new Nc("removelayer",t)),this.set(uo.LAYERGROUP,e)}setSize(e){this.set(uo.SIZE,e)}setTarget(e){this.set(uo.TARGET,e)}setView(e){if(!e||e instanceof ul){this.set(uo.VIEW,e);return}this.set(uo.VIEW,new ul);let t=this;e.then(function(n){t.setView(new ul(n))})}updateSize(){let e=this.getTargetElement(),t;if(e){let r,s;if(cl(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)],!J4(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&rw("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!Io(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function gle(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 Vx({layers:i.layers});t[uo.LAYERGROUP]=n,t[uo.TARGET]=i.target,t[uo.VIEW]=i.view instanceof ul?i.view:new ul;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new co(i.controls.slice()):(zn(typeof i.controls.getArray=="function","Expected `controls` to be an array or an `ol/Collection.js`"),r=i.controls));let s;i.interactions!==void 0&&(Array.isArray(i.interactions)?s=new co(i.interactions.slice()):(zn(typeof i.interactions.getArray=="function","Expected `interactions` to be an array or an `ol/Collection.js`"),s=i.interactions));let o;return i.overlays!==void 0?Array.isArray(i.overlays)?o=new co(i.overlays.slice()):(zn(typeof i.overlays.getArray=="function","Expected `overlays` to be an array or an `ol/Collection.js`"),o=i.overlays):o=new co,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var vq=_5;function MS(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var _le=new Error("disposed");var xle=[256,256],x5=class extends gg{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=MS(this.data_);return e?[e.width,e.height]:xle}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(_le),this.controller_=null),super.disposeInternal()}},y5=x5;var v5=class{constructor(e){this.highWaterMark=e!==void 0?e:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){let e=this.pop();e instanceof Ad&&e.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(e){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(e){return this.entries_.hasOwnProperty(e)}forEach(e){let t=this.oldest_;for(;t;)e(t.value_,t.key_,this),t=t.newer}get(e,t){let n=this.entries_[e];return zn(n!==void 0,"Tried to get a value for a key that does not exist in the cache"),n===this.newest_||(n===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(n.newer.older=n.older,n.older.newer=n.newer),n.newer=null,n.older=this.newest_,this.newest_.newer=n,this.newest_=n),n.value_}remove(e){let t=this.entries_[e];return zn(t!==void 0,"Tried to get a value for a key that does not exist in the cache"),t===this.newest_?(this.newest_=t.older,this.newest_&&(this.newest_.newer=null)):t===this.oldest_?(this.oldest_=t.newer,this.oldest_&&(this.oldest_.older=null)):(t.newer.older=t.older,t.older.newer=t.newer),delete this.entries_[e],--this.count_,t.value_}getCount(){return this.count_}getKeys(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.key_;return e}getValues(){let e=new Array(this.count_),t=0,n;for(n=this.newest_;n;n=n.older)e[t++]=n.value_;return e}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(e){return this.entries_[e]?.value_}pop(){let e=this.oldest_;return delete this.entries_[e.key_],e.newer&&(e.newer.older=null),this.oldest_=e.newer,this.oldest_||(this.newest_=null),--this.count_,e.value_}replace(e,t){this.get(e),this.entries_[e].value_=t}set(e,t){zn(!(e in this.entries_),"Tried to set a value for a key that is used already");let n={key_:e,newer:null,older:this.newest_,value_:t};this.newest_?this.newest_.newer=n:this.oldest_=n,this.newest_=n,this.entries_[e]=n,++this.count_}setSize(e){this.highWaterMark=e}},b5=v5;var w5=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(_x(),{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}},CS=w5;var yle=5,S5=class extends Mw{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=yle,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(e){this.staleKeys_.unshift(e),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(e){this.renderedSourceKey_?this.renderedSourceKey_!==e&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=e):this.renderedSourceKey_=e}getFeatures(e){return $n()}getData(e){return null}prepareFrame(e){return $n()}renderFrame(e,t){return $n()}forEachFeatureAtCoordinate(e,t,n,r,s){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(e){let t=e.target;(t.getState()===Mn.LOADED||t.getState()===Mn.ERROR)&&this.renderIfReadyAndVisible()}loadImage(e){let t=e.getState();return t!=Mn.LOADED&&t!=Mn.ERROR&&e.addEventListener(Jt.CHANGE,this.boundHandleImageChange_),t==Mn.IDLE&&(e.load(),t=e.getState()),t==Mn.LOADED}renderIfReadyAndVisible(){let e=this.getLayer();e&&e.getVisible()&&e.getSourceState()==="ready"&&e.changed()}renderDeferred(e){}disposeInternal(){delete this.layer_,super.disposeInternal()}},bq=S5;var E5=[],Gg=null;function vle(){Gg=Si(1,1,void 0,{willReadFrequently:!0})}var T5=class extends bq{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=$s(),this.pixelTransform=$s(),this.inversePixelTransform=$s(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){Gg||vle(),Gg.clearRect(0,0,1,1);let r;try{Gg.drawImage(e,t,n,1,1,0,0,1,1),r=Gg.getImageData(0,0,1,1).data}catch{return Gg=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(cl(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&&Io(Wl(e.style.backgroundColor),Wl(n)))){let c=e.firstElementChild;cl(c)&&(l=c.getContext("2d"))}if(l&&WG(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=Ls?bw():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Si();let u=l.canvas;a.appendChild(u),c=u.style,c.position="absolute",c.left="0",c.transformOrigin="top left",this.container=a,this.context=l}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=zl(n),s=rg(n),o=ig(n),a=ng(n);Mr(t.coordinateToPixelTransform,r),Mr(t.coordinateToPixelTransform,s),Mr(t.coordinateToPixelTransform,o),Mr(t.coordinateToPixelTransform,a);let l=this.inversePixelTransform;Mr(l,r),Mr(l,s),Mr(l,o),Mr(l,a),e.save(),e.beginPath(),e.moveTo(Math.round(r[0]),Math.round(r[1])),e.lineTo(Math.round(s[0]),Math.round(s[1])),e.lineTo(Math.round(o[0]),Math.round(o[1])),e.lineTo(Math.round(a[0]),Math.round(a[1])),e.clip()}prepareContainer(e,t){let n=e.extent,r=e.viewState.resolution,s=e.viewState.rotation,o=e.pixelRatio,a=Math.round(Wn(n)/r*o),l=Math.round(gr(n)/r*o);lo(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),Tw(this.inversePixelTransform,this.pixelTransform);let c=HG(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 ES(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(ho.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(ho.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new CS),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(ho.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(ho.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 lo(this.tempTransform,l,c,u,f,-n,p,x)}disposeInternal(){delete this.frameState,super.disposeInternal()}},RS=T5;function M5(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 ble(i,e,t){let n=i[t];return n?n.delete(e):!1}function wq(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=Au(e,Tc(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=Au(e,r))}return e}var C5=class extends RS{constructor(e,t){super(e),t=t||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=Er(),this.tempTileRange_=new mw(0,0,0,0),this.tempTileCoord_=dg(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new b5(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new b5(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=pg(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||ug(f,u)?void 0:this.getSourceTileCache()),!c)return null;s.set(l,c)}return c}getTile(e,t,n,r){let s=this.getOrCreateTile(e,t,n,r);return s||null}getData(e){let t=this.frameState;if(!t)return null;let n=this.getLayer(),r=Mr(t.pixelToCoordinateTransform,e.slice()),s=n.getExtent();if(s&&!xc(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=qr(l.getTileSize(u)),w=l.getResolution(u),S;if(p instanceof ww||p instanceof Ew)S=p.getImage();else if(p instanceof y5){if(S=MS(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=Nn(l);u in e.wantedTiles||(e.wantedTiles[u]={});let f=e.wantedTiles[u],p=a.getMapInternal(),x=Math.max(n-s,c.getMinZoom(),c.getZForResolution(Math.min(a.getMaxResolution(),p?p.getView().getResolutionForZoom(Math.max(a.getMinZoom(),0)):c.getResolution(0)),l.zDirection)),v=o.rotation,w=v?U4(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||!M5(r,L,S))continue;let F=L.getKey();if(f[F]=!0,L.getState()===rn.IDLE&&!e.tileQueue.isKeyQueued(F)){let N=dg(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=pg(this.getLayer().getSource(),a[l],r,s,o);if(n.containsKey(c)){let u=n.peek(c);if(u.getState()===rn.LOADED)return u.endTransition(Nn(this)),M5(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=pg(l,c,n,u,f),x=!1;if(a.containsKey(p)){let v=a.peek(p);v.getState()===rn.LOADED&&(M5(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?Tc(n.extent,s):null,this.layerExtent&&(v=Au(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=wq(e,e.nextExtent);this.enqueueTiles(e,ee,K,L,D)}let F=wq(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=Nn(this),B=e.time;for(let K of L[p]){let ee=K.getState();if(ee===rn.EMPTY)continue;let ae=K.tileCoord;if(ee===rn.LOADED&&K.getAlpha(N,B)===1){K.endTransition(N);continue}if(ee!==rn.ERROR&&(this.renderComplete=!1),this.findStaleTile_(ae,L)){ble(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);lo(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(Ua);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(zl(C),ee),Ue=f.getTileCoordExtent(Qe),mt=Mr(this.tempTransform,[w*(Ue[0]-C[0])/x,w*(C[3]-Ue[3])/x]),Me=w*u.getGutterForProjection(s);for(let ze of L[ee]){if(ze.getState()!==rn.LOADED)continue;let $e=ze.tileCoord,Et=Qe[1]-$e[1],Tt=Math.round(mt[0]-(Et-1)*ve),Ct=Qe[2]-$e[2],un=Math.round(mt[1]-(Ct-1)*Ie),Gt=Math.round(mt[0]-Et*ve),Xe=Math.round(mt[1]-Ct*Ie),st=Tt-Gt,tt=un-Xe,vt=ee===p;if(vt&&ze.inTransition(N)){j.push({tile:ze,x:Gt,y:Xe,w:st,h:tt,gutter:Me}),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze);continue}let yt=[Gt,Xe,Gt+st,Xe+tt],ln=[];for(let Qt=0,xn=Z.length;Qt<xn;++Qt)ee<J[Qt]&&_r(yt,Z[Qt])&&ln.push(Z[Qt]);let Kt;ln.length>0&&(Kt=G9(yt,ln)),Z.push(yt),J.push(ee),this.drawTile(ze,e,Gt,Xe,st,tt,Me,vt,Kt),this.renderedTiles.unshift(ze),this.updateUsedTiles(e.usedTiles,u,ze)}}for(let K=0,ee=j.length;K<ee;++K){let{tile:ae,x:ce,y:de,w:ve,h:Ie,gutter:Qe}=j[K];this.drawTile(ae,e,ce,de,ve,Ie,Qe,!0,void 0)}if(this.renderedResolution=x,this.extentChanged=!this.renderedExtent_||!I0(this.renderedExtent_,C),this.renderedExtent_=C,this.renderedPixelRatio=l,this.postRender(this.context,e),this.layerExtent&&V.restore(),V.imageSmoothingEnabled=!0,this.renderComplete){let K=(ee,ae)=>{let ce=Nn(u),de=ae.wantedTiles[ce],ve=de?Object.keys(de).length:0;this.updateCacheSize(ve),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};e.postRenderFunctions.push(K)}return this.container}updateCacheSize(e){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,e*2)}drawTile(e,t,n,r,s,o,a,l,c){let u;if(e instanceof y5){if(u=MS(e.getData()),!u)throw new Error("Rendering array data is not yet supported")}else u=this.getTileImage(e);if(!u)return;let f=this.getRenderContext(t),p=Nn(this),x=t.layerStatesArray[t.layerIndex],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=Nn(t);r in e||(e[r]={}),e[r][n.getKey()]=!0}},Sq=C5;var Qx={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var R5=class extends J0{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(Qx.PRELOAD)}setPreload(e){this.set(Qx.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(Qx.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(Qx.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},Tq=R5;var P5=class extends Tq{constructor(e){super(e)}createRenderer(){return new Sq(this,{cacheSize:this.getCacheSize()})}},I5=P5;var N5=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){}},PS=N5;var Jx={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},ey=[Jx.FILL],Nu=[Jx.STROKE],hf=[Jx.BEGIN_PATH],L5=[Jx.CLOSE_PATH],An=Jx;var D5=class extends PS{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],xc(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=Qb(c,p),S!==w?(x&&(a[l++]=u,a[l++]=f,x=!1),a[l++]=p[0],a[l++]=p[1]):S===As.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,yx,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,p,e,r||n,yx,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,vg,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,f,e,r||n,vg,s]);break;case"LineString":case"Circle":c=e.getFlatCoordinates(),u=this.appendFlatLineCoordinates(c,0,c.length,a,!1,!1),this.instructions.push([An.CUSTOM,l,u,e,n,yu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,yu,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([An.CUSTOM,l,u,e,n,yu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,yu,s]));break;case"Point":c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),u=this.coordinates.length,this.instructions.push([An.CUSTOM,l,u,e,n,void 0,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,void 0,s]);break;default:}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[An.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[An.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,s,o=-1;for(t=0;t<n;++t)r=e[t],s=r[0],s==An.END_GEOMETRY?o=t:s==An.BEGIN_GEOMETRY&&(r[2]=t,_G(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=Ga(n||Ds)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){let n=e.getColor();t.strokeStyle=Ga(n||Do);let r=e.getLineCap();t.lineCap=r!==void 0?r:Eu;let s=e.getLineDash();t.lineDash=s?s.slice():za;let o=e.getLineDashOffset();t.lineDashOffset=o||Va;let a=e.getLineJoin();t.lineJoin=a!==void 0?a:Mu;let l=e.getWidth();t.lineWidth=l!==void 0?l:rf;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:tf;let u=e.getOffset();t.strokeOffset=u??Uz,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&&!Io(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_=Jb(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;eg(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Lu=D5;var F5=class extends Lu{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&&!xc(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||xc(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}},Eq=F5;var O5=class extends Lu{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,Do,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,za,Va],hf);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Nu),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,Do,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,za,Va],hf);let l=e.getEnds(),c=e.getFlatCoordinates(),u=e.getStride(),f=0;for(let p=0,x=l.length;p<x;++p)f=this.drawFlatCoordinates_(c,f,l[p],u,a);this.hitDetectionInstructions.push(Nu),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Nu),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Nu),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(hf)}},Mq=O5;var B5=class extends Lu{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r,s){let o=this.state,a=o.fillStyle!==void 0,l=o.strokeStyle!==void 0,c=n.length;this.instructions.push(hf),this.hitDetectionInstructions.push(hf);for(let u=0;u<c;++u){let f=n[u],p=this.coordinates.length,x=this.appendFlatLineCoordinates(e,t,f,r,!0,!l);this.instructions.push([An.MOVE_TO_LINE_TO,p,x,s*this.pixelRatio,!0]),this.hitDetectionInstructions.push([An.MOVE_TO_LINE_TO,p,x,s,!0]),l&&(this.instructions.push(L5),this.hitDetectionInstructions.push(L5)),t=f}return a&&(this.instructions.push(ey),this.hitDetectionInstructions.push(ey)),l&&(this.instructions.push(Nu),this.hitDetectionInstructions.push(Nu)),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,Ds]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Do,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,za,Va]);let l=e.getFlatCoordinates(),c=e.getStride(),u=this.coordinates.length;this.appendFlatLineCoordinates(l,0,l.length,c,!1,!1);let f=[An.CIRCLE,u,a];this.instructions.push(hf,f),this.hitDetectionInstructions.push(hf,f),r.fillStyle!==void 0&&(this.instructions.push(ey),this.hitDetectionInstructions.push(ey)),r.strokeStyle!==void 0&&(this.instructions.push(Nu),this.hitDetectionInstructions.push(Nu)),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,Ds]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Do,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,za,Va]);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,Ds]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([An.SET_STROKE_STYLE,Do,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,za,Va]);let l=e.getEndss(),c=e.getOrientedFlatCoordinates(),u=e.getStride(),f=0;for(let p=0,x=l.length;p<x;++p)f=this.drawFlatCoordinatess_(c,f,l[p],u,a);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(e!==0){let t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=_d(t[n],e)}return super.finish()}setFillStrokeStyles_(){let e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){let t=this.state,n=t.fillStyle,r=t.strokeStyle,s=t.strokeOffset;return Math.abs(s)>0&&n!==void 0&&r!==void 0?(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=s,e(),t.fillStyle=n,!0):!1}},U5=B5;var k5=0,G5=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 k5=u,G5=f,!0}function Cq(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+k5*F,z=P+k5*N,V=T+G5*F,H=P+G5*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 Rq(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=Po(c,f,v),S=Po(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=Po(c,f,v/x),S=Po(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 Pq(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 ty={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},z5=class extends Lu{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[Ds]={fillStyle:Ds},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,s=this.textStrokeState_,o=this.textState_;if(this.text_===""||!o||!r&&!s)return;let a=this.coordinates,l=a.length,c=e.getType(),u=null,f=e.getStride();if(o.placement==="line"&&(c=="LineString"||c=="MultiLineString"||c=="Polygon"||c=="MultiPolygon")){let p=e.getExtent();if(!_r(this.maxExtent,p))return;let x;if(u=e.getFlatCoordinates(),c=="LineString")x=[u.length];else if(c=="MultiLineString")x=e.getEnds();else if(c=="Polygon")x=e.getEnds().slice(0,1);else if(c=="MultiPolygon"){let T=e.getEndss();x=[];for(let P=0,R=T.length;P<R;++P)x.push(T[P][0])}if((c=="LineString"||c=="MultiLineString")&&!pu(this.getBufferedMaxExtent(),p)){let T=Cq(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=Rq(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=Pq(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!=nf&&(o.scale[0]<0||o.scale[1]<0)){let C=o.padding[0],L=o.padding[1],D=o.padding[2],F=o.padding[3];o.scale[0]<0&&(L=-L,F=-F),o.scale[1]<0&&(C=-C,D=-D),S=[C,L,D,F]}let T=this.pixelRatio;this.instructions.push([An.DRAW_IMAGE,l,x,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,S==nf?nf:S.map(function(C){return C*T}),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]=Ds),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_?Ds:this.fillKey_,this.textOffsetX_,this.textOffsetY_,p]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let s=this.textKey_;s in this.textStates||(this.textStates[s]={font:t.font,textAlign:t.textAlign||wd,justify:t.justify,textBaseline:t.textBaseline||$0,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=ty[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&&Ds,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=Ga(o.getColor()||Ds)):(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()||Eu,s.lineDash=w?w.slice():za,s.lineDashOffset=S===void 0?Va:S,s.lineJoin=a.getLineJoin()||Mu,s.lineWidth=T===void 0?rf:T,s.miterLimit=P===void 0?tf:P,s.strokeStyle=Ga(a.getColor()||Do)}n=this.textState_;let l=e.getFont()||Xw;kz(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()||$0,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||nf,n.scale=c===void 0?[1,1]:c;let u=e.getOffsetX(),f=e.getOffsetY(),p=e.getRotateWithView(),x=e.getKeepUpright(),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:Nn(s.strokeStyle))+s.lineCap+s.lineDashOffset+"|"+s.lineWidth+s.lineJoin+s.miterLimit+"["+s.lineDash.join()+"]":"",this.textKey_=n.font+n.scale+(n.textAlign||"?")+(n.repeat||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle=="string"?r.fillStyle:"|"+Nn(r.fillStyle):""}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},Iq=z5;var Sle={Circle:U5,Default:Lu,Image:Eq,LineString:Mq,Polygon:U5,Text:Iq},V5=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=Sle[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},Nq=V5;function Lq(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 IS(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]=Tle(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 Tle(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=X9([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 NS(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 Ele(){return q5||(q5=new Intl.Segmenter(void 0,{granularity:"grapheme"})),q5}function Dq(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=Po(w,x,C),D=Po(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=Po(w,x,C),V=Po(S,v,C),H=!1;if(p)if(f){let ae=[L,D,z,V];Nw(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(Ele().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=Po(w,x,C),mt=Po(S,v,C);J.push([Ue,mt,Ie/2,de,Qe]),s+=Ie}return J}var zg=Er(),Cd=[],ff=[],df=[],Rd=[];function Fq(i){return i[3].declutterBox}var Oq=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function H5(i,e){return e==="start"?e=Oq.test(i)?"right":"left":e==="end"&&(e=Oq.test(i)?"left":"right"),ty[e]}function Mle(i,e,t){return t>0&&i.push(`7-`,""),i.push(e,""),i}function Cle(i,e,t){return t%2===0&&(i+=e),i}var W5=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_=$s(),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 CS: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?ty[l.justify]:H5(Array.isArray(e)?e[0]:e,l.textAlign||wd),p=r&&o.lineWidth?o.lineWidth:0,x=Array.isArray(e)?e:String(e).split(`8-`).reduce(Mle,[]),{width:v,height:w,widths:S,heights:T,lineWidths:P}=Vz(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)&&(Cd[0]=F,Rd[0]=F,Cd[1]=N,ff[1]=N,ff[0]=F+L,df[0]=ff[0],df[1]=N+D,Rd[1]=df[1]);let B;return f!==0?(B=lo($s(),n,r,1,1,f,-n,-r),Mr(B,Cd),Mr(B,ff),Mr(B,df),Mr(B,Rd),ll(Math.min(Cd[0],ff[0],df[0],Rd[0]),Math.min(Cd[1],ff[1],df[1],Rd[1]),Math.max(Cd[0],ff[0],df[0],Rd[0]),Math.max(Cd[1],ff[1],df[1],Rd[1]),zg)):ll(Math.min(F,F+L),Math.min(N,N+D),Math.max(F,F+L),Math.max(N,N+D),zg),x&&(T=Math.round(T),P=Math.round(P)),{drawImageX:T,drawImageY:P,drawImageW:R,drawImageH:C,originX:c,originY:u,declutterBox:{minX:zg[0],minY:zg[1],maxX:zg[2],maxY:zg[3],value:S},canvasTransform:B,scale:p}}replayImageOrLabel_(e,t,n,r,s,o,a){let l=!!(o||a),c=r.declutterBox,u=a?a[2]*r.scale[0]/2:0;return c.minX-u<=t[0]&&c.maxX+u>=0&&c.minY-u<=t[1]&&c.maxY+u>=0&&(l&&this.replayTextBackground_(e,Cd,ff,df,Rd,o,a),qz(e,r.canvasTransform,s,n,r.originX,r.originY,r.drawImageW,r.drawImageH,r.drawImageX,r.drawImageY,r.scale)),!0}fill_(e){let t=this.alignAndScaleFill_;if(t){let n=Mr(this.renderedTransform_,[0,0]),r=512*this.pixelRatio;e.save(),e.translate(n[0]%r,n[1]%r),t!==1&&e.scale(t,t)}e.fill(),t&&e.restore()}setStrokeStyle_(e,t){e.strokeStyle=t[1],t[1]&&(e.lineWidth=t[2],e.lineCap=t[3],e.lineJoin=t[4],e.miterLimit=t[5],e.lineDashOffset=t[7],e.setLineDash(t[6]))}drawLabelWithPointPlacement_(e,t,n,r){let s=this.textStates[t],o=this.createLabel(e,t,r,n),a=this.strokeStates[n],l=this.pixelRatio,c=H5(Array.isArray(e)?e[0]:e,s.textAlign||wd),u=ty[s.textBaseline||$0],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_&&Io(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=ka(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),qG(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&&!_r(a,Qe.getExtent())?f=Ue[2]+1:++f:f=Ue[2],c&&(c.zIndex=Ue[4]);break;case An.BEGIN_PATH:Z>ce&&(this.fill_(e),Z=0),J>ce&&(e.stroke(),J=0),!Z&&!J&&(e.beginPath(),C=NaN,L=NaN),++f;break;case An.CIRCLE:x=Ue[1],P=Ue[2]??0;let Me=u[x],ze=u[x+1],$e=u[x+2]-P,Et=u[x+3]-P,Tt=$e-Me,Ct=Et-ze,un=Math.sqrt(Tt*Tt+Ct*Ct);e.moveTo(Me+un,ze),e.arc(Me,ze,un,0,2*Math.PI,!0),++f;break;case An.CLOSE_PATH:e.closePath(),++f;break;case An.CUSTOM:x=Ue[1],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 On=Ue[15];if(!N&&Ue.length>=20){B=Ue[19],z=Ue[20],V=Ue[21],H=Ue[22];let In=this.drawLabelWithPointPlacement_(B,z,V,H);N=In.label,Ue[3]=N;let kr=Ue[23];S=(In.anchorX-kr)*this.pixelRatio,Ue[4]=S;let mr=Ue[24];T=(In.anchorY-mr)*this.pixelRatio,Ue[5]=T,vt=N.height,Ue[6]=vt,di=N.width,Ue[13]=di}let le;Ue.length>25&&(le=Ue[25]);let X,Te,Pe;Ue.length>17?(X=Ue[16],Te=Ue[17],Pe=Ue[18]):(X=nf,Te=null,Pe=null),Qt&&ee?xn+=K:!Qt&&!ee&&(xn-=K);let Ve=0;for(;x<v;x+=2){if(le&&le[Ve++]<di/this.pixelRatio)continue;let In=this.calculateImageOrLabelDimensions_(N.width,N.height,u[x],u[x+1],di,vt,S,T,ln,Kt,xn,ge,s,X,!!Te||!!Pe,de),kr=[e,t,N,In,yt,Te,Pe];if(l){let mr,il,ta;if(On){let sr=v-x;if(!On[sr]){On[sr]={args:kr,declutterMode:R};continue}let Rs=On[sr];mr=Rs.args,il=Rs.declutterMode,delete On[sr],ta=Fq(mr)}let rl,Ia;if(mr&&(il!=="declutter"||!l.collides(ta))&&(rl=!0),(R!=="declutter"||!l.collides(In.declutterBox))&&(Ia=!0),il==="declutter"&&R==="declutter"){let sr=rl&&Ia;rl=sr,Ia=sr}rl&&(il!=="none"&&l.insert(ta),this.replayImageOrLabel_.apply(this,mr)),Ia&&(R!=="none"&&l.insert(In.declutterBox),this.replayImageOrLabel_.apply(this,kr))}else this.replayImageOrLabel_.apply(this,kr)}++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(Cle,"")),z=Ue[12];let cn=[Ue[13],Ue[13]];R=Ue[14]||"declutter";let yn=Ue[15],Rn=Ue[16],xe=this.textStates[z],bt=xe.font,Ye=[xe.scale[0]*en,xe.scale[1]*en],wt;bt in this.widths_?wt=this.widths_[bt]:(wt={},this.widths_[bt]=wt);let Dt=Lq(u,gt,St,2),ct=Math.abs(Ye[0])*nI(bt,B,wt);if(Ke||ct<=Dt){let In=this.textStates[z].textAlign,kr=(Dt-ct)*H5(B,In),mr=Dq(u,gt,St,2,B,kr,Rt,Math.abs(Ye[0]),nI,bt,wt,ee?0:this.viewRotation_,yn);e:if(mr){let il=[],ta,rl,Ia,sr,Rs;if(V)for(ta=0,rl=mr.length;ta<rl;++ta){Rs=mr[ta],Ia=Rs[4],sr=this.createLabel(Ia,z,"",V),S=Rs[2]+(Ye[0]<0?-Mt:Mt)-Rn,T=qe*sr.height+(.5-qe)*2*Mt*Ye[1]/Ye[0]-Pt;let sl=this.calculateImageOrLabelDimensions_(sr.width,sr.height,Rs[0],Rs[1],sr.width,sr.height,S,T,0,0,Rs[3],cn,!1,nf,!1,de);if(l&&R==="declutter"&&l.collides(sl.declutterBox))break e;il.push([e,t,sr,sl,1,null,null])}if(H)for(ta=0,rl=mr.length;ta<rl;++ta){Rs=mr[ta],Ia=Rs[4],sr=this.createLabel(Ia,z,H,""),S=Rs[2]-Rn,T=qe*sr.height-Pt;let sl=this.calculateImageOrLabelDimensions_(sr.width,sr.height,Rs[0],Rs[1],sr.width,sr.height,S,T,0,0,Rs[3],cn,!1,nf,!1,de);if(l&&R==="declutter"&&l.collides(sl.declutterBox))break e;il.push([e,t,sr,sl,1,null,null])}l&&R!=="none"&&l.load(il.map(Fq));for(let sl=0,hu=il.length;sl<hu;++sl)this.replayImageOrLabel_.apply(this,il[sl])}}++f;break;case An.END_GEOMETRY:if(o!==void 0){de=Ue[1];let In=o(de,Qe,R);if(In)return In}++f;break;case An.FILL:ce?Z++:this.fill_(e),++f;break;case An.MOVE_TO_LINE_TO:x=Ue[1],v=Ue[2],P=Ue[3];let Ce,jt,qi;if(P){let kr=(Ue[4]??!1)||Math.abs(u[x]-u[v-2])<1e-6&&Math.abs(u[x+1]-u[v-1])<1e-6;IS(u,x,v,2,P,kr,w),NS(w,2,kr),Ce=w,jt=0,qi=Ce.length}else Ce=u,jt=x,qi=v;ve=Ce[jt],Ie=Ce[jt+1],e.moveTo(ve,Ie),C=ve+.5|0,L=Ie+.5|0;for(let In=jt+2;In<qi;In+=2)ve=Ce[In],Ie=Ce[In+1],D=ve+.5|0,F=Ie+.5|0,(In==qi-2||D!==C||F!==L)&&(e.lineTo(ve,Ie),C=D,L=F);++f;break;case An.SET_FILL_STYLE:this.alignAndScaleFill_=Ue[2],Z?(this.fill_(e),Z=0,J&&(e.stroke(),J=0)):J&&Ue[1]&&(e.stroke(),J=0),e.fillStyle=Ue[1],++f;break;case An.SET_STROKE_STYLE:Z&&Ue[1]&&(this.fill_(e),Z=0),J&&(e.stroke(),J=0),this.setStrokeStyle_(e,Ue),++f;break;case An.STROKE:ce?J++:e.stroke(),++f;break;default:++f;break}}Z&&this.fill_(e),J&&e.stroke()}execute(e,t,n,r,s,o){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,n,r,s){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,s)}},Bq=W5;var Pd=["Polygon","Circle","LineString","Image","Text","Default"],$5=["Image","Text"],Uq=Pd.filter(i=>!$5.includes(i)),kq=!1,Gq=!1;function Rle(){let i=0,e=n=>{let r=Si(1,1,null,{willReadFrequently:n}),s=0,o=performance.now();for(;performance.now()-o<50;++s)r.fillStyle=`rgba(255,0,${s%256},1)`,r.fillRect(0,0,1,1),r.getImageData(0,0,1,1);return i=s>i?s:i,s};kq={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],Gq=!0}var X5=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_=$s(),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 Bq(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){Gq===!1&&Rle(),r=Math.round(r);let a=r*2+1,l=lo(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Si(a,a,null,{willReadFrequently:kq}));let u=this.hitDetectionContext_;u.canvas.width!==a||u.canvas.height!==a?(u.canvas.width=a,u.canvas.height=a):c||u.clearRect(0,0,a,a);let f;this.renderBuffer_!==void 0&&(f=Er(),N0(f,e),eg(f,t*(this.renderBuffer_+r),f));let p=Ple(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(Ua);let S,T,P,R,C;for(S=w.length-1;S>=0;--S){let L=w[S].toString();for(P=this.executorsByZIndex_[L],T=Pd.length-1;T>=0;--T)if(x=Pd[T],R=P[x],R!==void 0&&(C=R.executeHitDetection(u,l,n,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 ka(a,0,8,2,e,a),a}isEmpty(){return bc(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?gG:Ua),o=o||Pd;let c=Pd.length;for(let u=0,f=l.length;u<f;++u){let p=l[u].toString(),x=this.executorsByZIndex_[p];for(let 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+Pd.indexOf(S);this.deferredZIndexContexts_[L]||(this.deferredZIndexContexts_[L]=[]),this.deferredZIndexContexts_[L].push(P)}}}}this.renderedContext_=e}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){let e=this.deferredZIndexContexts_,t=Object.keys(e).map(Number).sort(Ua);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}},j5={};function Ple(i){if(j5[i]!==void 0)return j5[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 j5[i]=r,r}var zq=X5;var Y5=class extends PS{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?L0(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=s,this.squaredTolerance_=o,this.userTransform_=a,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=$s()}drawImages_(e,t,n,r){if(!this.image_)return;let s=ka(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_;lo(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=ka(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=ka(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=IS(l,0,u,2,o,f,l),NS(l,2,f)}a.moveTo(l[0],l[1]);let c=l.length;s&&(c-=2);for(let u=2;u<c;u+=2)a.lineTo(l[u],l[u+1]);return s&&a.closePath(),n}drawRings_(e,t,n,r,s){for(let o=0,a=n.length;o<a;++o)t=this.moveToLineTo_(e,t,n[o],r,!0,s);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!_r(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=cz(e,this.transform_,this.pixelCoordinates_),n=t[2]-t[0],r=t[3]-t[1],s=Math.sqrt(n*n+r*r),o=this.context_;o.beginPath(),o.arc(t[0],t[1],s,0,2*Math.PI),this.fillState_&&o.fill(),this.strokeState_&&o.stroke()}this.text_!==""&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case"Point":this.drawPoint(e);break;case"LineString":this.drawLineString(e);break;case"Polygon":this.drawPolygon(e);break;case"MultiPoint":this.drawMultiPoint(e);break;case"MultiLineString":this.drawMultiLineString(e);break;case"MultiPolygon":this.drawMultiPolygon(e);break;case"GeometryCollection":this.drawGeometryCollection(e);break;case"Circle":this.drawCircle(e);break;default:}}drawFeature(e,t){let n=t.getGeometryFunction()(e);n&&(this.setStyle(t),this.drawGeometry(n))}drawGeometryCollection(e){let t=e.getGeometriesArray();for(let n=0,r=t.length;n<r;++n)this.drawGeometry(t[n])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==""&&this.drawText_(t,0,t.length,n)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!_r(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(n,0,n.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(this.text_!==""){let t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getExtent();if(_r(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let n=this.context_,r=e.getFlatCoordinates(),s=0,o=e.getEnds(),a=e.getStride();n.beginPath();for(let l=0,c=o.length;l<c;++l)s=this.moveToLineTo_(r,s,o[l],a,!1,this.strokeState_.strokeOffset);n.stroke()}if(this.text_!==""){let n=e.getFlatMidpoints();this.drawText_(n,0,n.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!_r(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),!!_r(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getOrientedFlatCoordinates(),r=0,s=e.getEndss(),o=e.getStride();t.beginPath();for(let a=0,l=s.length;a<l;++a){let c=s[a];r=this.drawRings_(n,r,c,o,this.strokeState_?.strokeOffset)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==""){let t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){let t=this.context_,n=this.contextFillState_;n?n.fillStyle!=e.fillStyle&&(n.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){let t=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=e.lineCap&&(n.lineCap=e.lineCap,t.lineCap=e.lineCap),Io(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){let t=this.context_,n=this.contextTextState_,r=e.textAlign?e.textAlign:wd;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=r&&(n.textAlign=r,t.textAlign=r),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{let n=e.getColor();this.fillState_={fillStyle:Ga(n||Ds)}}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||za,f=t.getOffset();this.strokeState_={lineCap:r!==void 0?r:Eu,lineDash:this.pixelRatio_===1?u:u.map(p=>p*this.pixelRatio_),lineDashOffset:(o||Va)*this.pixelRatio_,lineJoin:a!==void 0?a:Mu,lineWidth:(l!==void 0?l:rf)*this.pixelRatio_,miterLimit:c!==void 0?c:tf,strokeStyle:Ga(n||Do),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:Ga(x||Ds)}}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:Eu,lineDash:w||za,lineDashOffset:S||Va,lineJoin:T!==void 0?T:Mu,lineWidth:P!==void 0?P:rf,miterLimit:R!==void 0?R:tf,strokeStyle:Ga(x||Do)}}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:Xw,textAlign:f!==void 0?f:wd,textBaseline:p!==void 0?p:$0},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]]}}},Vq=Y5;var Fc=.5;function qq(i,e,t,n,r,s,o,a,l){let c=l?fd(r,l):r,u=i[0]*Fc,f=i[1]*Fc,p=Si(u,f);p.imageSmoothingEnabled=!1;let x=p.canvas,v=new Vq(p,Fc,r,null,o,a,l?O0(U0(),l):null),w=t.length,S=Math.floor((256*256*256-1)/w),T={};for(let R=1;R<=w;++R){let C=t[R-1],L=C.getStyleFunction()||n;if(!L)continue;let D=L(C,s);if(!D)continue;Array.isArray(D)||(D=[D]);let N=(R*S).toString(16).padStart(7,"#00000");for(let B=0,z=D.length;B<z;++B){let V=D[B],H=V.getGeometryFunction()(C);if(!H||!_r(c,H.getExtent()))continue;let Z=V.clone(),J=Z.getFill();J&&J.setColor(N);let j=Z.getStroke();j&&(j.setColor(N),j.setLineDash(null)),Z.setText(void 0);let K=V.getImage();if(K){let de=K.getImageSize();if(!de)continue;let ve=Si(de[0],de[1],void 0,{alpha:!1}),Ie=ve.canvas;ve.fillStyle=N,ve.fillRect(0,0,Ie.width,Ie.height),Z.setImage(new Y0({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(Ua);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 Hq(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Fc),s=Math.floor(Math.round(i[1])*Fc),o=(_i(r,0,t.width-1)+_i(s,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],u=t.data[o+2]+256*(l+256*a),f=Math.floor((256*256*256-1)/e.length);u&&u%f===0&&n.push(e[u/f-1])}return n}var Ile=.5,Wq={Point:Ule,LineString:Fle,Polygon:Gle,MultiPoint:kle,MultiLineString:Ole,MultiPolygon:Ble,GeometryCollection:Dle,Circle:Nle};function jq(i,e){return parseInt(Nn(i),10)-parseInt(Nn(e),10)}function Z5(i,e){let t=K5(i,e);return t*t}function K5(i,e){return Ile*i/e}function Nle(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 Q5(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)),Lle(i,e,t,n,s,o,a),f}function Lle(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())Xq(i,l,t,e,o);else{let u=Wq[l.getType()];u(i,l,t,e,o,s)}}function Xq(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)Xq(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function Dle(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=Wq[o[a].getType()];c(i,o[a],t,n,r,s)}}function Fle(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 Ole(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 Ble(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 Ule(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 kle(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 Gle(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 J5=class extends RS{constructor(e){super(e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Er(),this.wrappedRenderedExtent_=Er(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1}renderWorlds(e,t,n){let r=t.extent,s=t.viewState,o=s.center,a=s.resolution,l=s.projection,c=s.rotation,u=l.getExtent(),f=this.getLayer().getSource(),p=this.getLayer().getDeclutter(),x=t.pixelRatio,v=t.viewHints,w=!(v[Os.ANIMATING]||v[Os.INTERACTING]),S=this.context,T=Math.round(Wn(r)/a*x),P=Math.round(gr(r)/a*x),R=f.getWrapX()&&l.canWrapX(),C=R?Wn(u):null,L=R?Math.ceil((r[2]-u[2])/C)+(this.extendX_?2:1):1,D=R?Math.floor((r[0]-u[0])/C)-(this.extendX_?1:0):0;do{let F=this.getRenderTransform(o,a,0,x,T,P,D*C);t.declutter&&(F=F.slice(0)),e.execute(S,[S.canvas.width,S.canvas.height],F,c,w,n===void 0?Pd:n?$5:Uq,n?p&&t.declutter[p]:void 0)}while(++D<L)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Si(this.context.canvas.width,this.context.canvas.height,E5))}resetDrawContext_(){if(this.opacity_!==1&&this.targetContext_){let e=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=e,z0(this.context),E5.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(ho.PRERENDER)||this.getLayer().hasListener(ho.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=Tc(n.extent,l);a=_r(u,e.extent),a&&!pu(u,e.extent)&&(e.declutter?this.clipExtent_=u:(this.clipUnrotated(s,e,u),c=!0))}return a&&this.renderWorlds(o,e,this.getLayer().getDeclutter()?!1:void 0),c&&s.restore(),this.postRender(s,e),this.renderedRotation_!==r.rotation&&(this.renderedRotation_=r.rotation,this.hitDetectionImageData_=null),e.declutter||this.resetDrawContext_(),this.container}getFeatures(e){return new Promise(t=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){let n=this.frameState.size.slice(),r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,l=this.wrappedRenderedExtent_,c=this.getLayer(),u=[],f=n[0]*Fc,p=n[1]*Fc;u.push(this.getRenderTransform(r,s,o,Fc,f,p,0).slice());let x=c.getSource(),v=a.getExtent();if(x.getWrapX()&&a.canWrapX()&&!pu(v,l)){let S=l[0],T=Wn(v),P=0,R;for(;S<v[0];)--P,R=T*P,u.push(this.getRenderTransform(r,s,o,Fc,f,p,R).slice()),S+=T;for(P=0,S=l[2];S>v[2];)++P,R=T*P,u.push(this.getRenderTransform(r,s,o,Fc,f,p,R).slice()),S-=T}let w=U0();this.hitDetectionImageData_=qq(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,Z5(s,this.renderedPixelRatio_),w?a:null)}t(Hq(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=Nn(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[Os.ANIMATING],s=e.viewHints[Os.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=jq);let S=c.center.slice(),T=eg(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&&!mu(K)&&(this.extendX_=K[0]<C[0]||K[2]>C[2])}if(L&&(!pu(C,e.extent)||this.extendX_)){let K=Wn(C),ee=Math.max(Wn(T)/2,K),ae=C[0],ce=C[2];this.extendX_&&(ae-=K,ce+=K),T[0]=ae-ee,T[2]=ce+ee,aw(S,u);let de=G4(R[0],u);de[0]<C[0]&&de[2]<C[2]?R.push([de[0]+K,de[1],de[2]+K,de[3]]):de[0]>C[0]&&de[2]>C[2]&&R.push([de[0]-K,de[1],de[2]-K,de[3]])}if(this.ready&&this.renderedResolution_==f&&this.renderedPixelRatio_===p&&this.renderedRevision_==x&&this.renderedRenderOrder_==w&&this.renderedFrameDeclutter_===!!e.declutter&&pu(this.wrappedRenderedExtent_,T))return Io(this.renderedExtent_,P)||(this.hitDetectionImageData_=null,this.renderedExtent_=P),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new Nq(K5(f,p),T,f,p),F=U0(),N;if(F){for(let K=0,ee=R.length;K<ee;++K){let ae=R[K],ce=fd(ae,u);n.loadFeatures(ce,pG(f,u),F)}N=O0(F,u)}else for(let K=0,ee=R.length;K<ee;++K)n.loadFeatures(R[K],f,u);let B=Z5(f,p),z=!0,V=(K,ee)=>{let ae,ce=K.getStyleFunction()||t.getStyleFunction();if(ce&&(ae=ce(K,f)),ae){let de=this.renderFeature(K,B,ae,D,N,this.getLayer().getDeclutter(),ee);z=z&&!de}},H=fd(T,u),Z=n.getFeaturesInExtent(H);w&&Z.sort(w);for(let K=0,ee=Z.length;K<ee;++K)V(Z[K],K);this.renderedFeatures_=Z,this.ready=z;let J=D.finish(),j=new zq(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=Q5(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=Q5(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},$q=J5;var eN=class extends TS{constructor(e){super(e)}createRenderer(){return new $q(this)}},Yq=eN;var zle=!1;function Vle(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=zle,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 tN(i,e){return function(t,n,r,s,o){Vle(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function Zq(i,e){return[[-1/0,-1/0,1/0,1/0]]}function nN(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=mG(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]:Po(i[a+u],i[a+n+u],l);return s}var Kq=$s(),ny=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"?ew(this.flatCoordinates_):tg(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=Ba(this.getExtent());this.flatInteriorPoints_=wx(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=yz(this.flatCoordinates_,this.ends_),t=Qw(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=Lw(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=nN(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=nN(e,t,o,this.stride_,.5);Ec(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=ms(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let r=gr(n)/gr(t);lo(Kq,n[0],n[3],r,-r,0,0,0),ka(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Kq,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=yw((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=vx(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=mz(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=bx(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}};ny.prototype.getFlatCoordinates=ny.prototype.getOrientedFlatCoordinates;var iA=ny;var iN=class{constructor(e){this.rbush_=new eA(e),this.items_={}}insert(e,t){let n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[Nn(t)]=n}load(e,t){let n=new Array(t.length);for(let r=0,s=t.length;r<s;r++){let o=e[r],a=t[r],l={minX:o[0],minY:o[1],maxX:o[2],maxY:o[3],value:a};n[r]=l,this.items_[Nn(a)]=l}this.rbush_.load(n)}remove(e){let t=Nn(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[Nn(t)],r=[n.minX,n.minY,n.maxX,n.maxY];I0(r,e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(r){return r.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let r=0,s=e.length;r<s;r++)if(n=t(e[r]),n)return n;return n}isEmpty(){return bc(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return ll(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]}},rN=iN;var hl={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Du=class extends Xs{constructor(e,t,n){super(e),this.feature=t,this.features=n}},sN=class extends Rw{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_=Qh,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0?!0:e.overlaps,this.url_=e.url,e.loader!==void 0?this.loader_=e.loader:this.url_!==void 0&&(zn(this.format_,"`format` must be set when `url` is set"),this.loader_=tN(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:Zq;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new rN:null,this.loadedExtentsRtree_=new rN,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 co(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=Nn(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let n=e.getGeometry();if(n){let r=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(r,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new Du(hl.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof iA||(this.featureChangeKeys_[e]=[Un(t,Jt.CHANGE,this.handleFeatureChange_,this),Un(t,Mc.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 iA){let s=this.idIndex_[r];s instanceof iA?Array.isArray(s)?s.push(t):this.idIndex_[r]=[s,t]:n=!1}else n=!1}return n&&(zn(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],n=[],r=[];for(let s=0,o=e.length;s<o;s++){let a=e[s],l=Nn(a);this.addToIndex_(l,a)&&n.push(a)}for(let s=0,o=n.length;s<o;s++){let a=n[s],l=Nn(a);this.setupChangeEvents_(l,a);let c=a.getGeometry();if(c){let u=c.getExtent();t.push(u),r.push(a)}else this.nullGeometryFeatures_[l]=a}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener(hl.ADDFEATURE))for(let s=0,o=n.length;s<o;s++)this.dispatchEvent(new Du(hl.ADDFEATURE,n[s]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(hl.ADDFEATURE,function(n){t||(t=!0,e.push(n.feature),t=!1)}),this.addEventListener(hl.REMOVEFEATURE,function(n){t||(t=!0,e.remove(n.feature),t=!1)}),e.addEventListener(Zs.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(Zs.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 Du(hl.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 iA||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 iA||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(),bc(this.nullGeometryFeatures_)||Ec(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=iw(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||Zh,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof iA?0:u.closestPointXY(n,r,o,a),a<f){s=c;let p=Math.sqrt(a);l[0]=n-p,l[1]=r-p,l[2]=n+p,l[3]=r+p}}}),s}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){let t=this.idIndex_[e.toString()];return t!==void 0?t:null}getFeatureByUid(e){let t=this.uidIndex_[e];return t!==void 0?t:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,n=Nn(t),r=t.getGeometry();if(!r)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{let o=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(o,t)):this.featuresRtree_&&this.featuresRtree_.update(o,t)}let s=t.getId();if(s!==void 0){let o=s.toString();this.idIndex_[o]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[o]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new Du(hl.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();if(t!==void 0){let n=this.idIndex_[String(t)];return Array.isArray(n)?n.includes(e):n===e}return Nn(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&bc(this.nullGeometryFeatures_):this.featuresCollection_?this.featuresCollection_.getLength()===0:!0}loadFeatures(e,t,n){let r=this.loadedExtentsRtree_,s=this.strategy_(e,t,n);for(let o=0,a=s.length;o<a;++o){let l=s[o];if(!r.forEachInExtent(l,function(u){return pu(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Du(hl.FEATURESLOADSTART));let u=v=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Du(hl.FEATURESLOADEND,void 0,v))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Du(hl.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=k4(r.extent,e);for(let o of s)t.insert(o,{extent:o})})}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){if(!e)return;this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=Nn(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(ii),delete this.featureChangeKeys_[t];let r=e.getId();if(r!==void 0){let s=r.toString(),o=this.idIndex_[s];o===e?delete this.idIndex_[s]:Array.isArray(o)&&(o.splice(o.indexOf(e),1),o.length===1&&(this.idIndex_[s]=o[0]))}return delete this.uidIndex_[t],this.hasListener(hl.REMOVEFEATURE)&&this.dispatchEvent(new Du(hl.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(let t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){zn(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(tN(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},pf=sN;var ma={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Qd={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},UT=0,Zy=1,kT=2;var XN=0,Jd=1,GT=2,Kl=3,Ao=0,ui=1,ir=2,$r=0,ss=1,zu=2,Vu=3,qu=4,If=5,Ky=6,Bs=100,Qy=101,Jy=102,zT=103,VT=104,qc=200,e2=201,t2=202,n2=203,Ud=204,kd=205,i2=206,r2=207,s2=208,o2=209,a2=210,GH=211,zH=212,VH=213,qH=214,lA=0,cA=1,uA=2,Bu=3,hA=4,fA=5,dA=6,pA=7,PA=0,qT=1,HT=2,ks=0,l2=1,c2=2,u2=3,h2=4,$N=5,f2=6,d2=7;var p2=300,gl=301,Ql=302,ep=303,tp=304,Hu=306,Sf=1e3,ko=1001,Tf=1002,xi=1003,A2=1004;var Jl=1005;var vi=1006,np=1007;var go=1008,YN=1008,Gi=1009,Wu=1010,ju=1011,Wa=1012,Ir=1013,pi=1014,Yi=1015,Li=1016,IA=1017,NA=1018,zo=1020,LA=35902,DA=35899,S_=1021,Nf=1022,xr=1023,ys=1026,Qs=1027,Lf=1028,Xu=1029,Ss=1030,$u=1031,m2=1032,ip=1033,Yu=33776,Zu=33777,Ku=33778,Qu=33779,FA=35840,OA=35841,BA=35842,UA=35843,rp=36196,sp=37492,op=37496,ap=37488,lp=37489,Ju=37490,cp=37491,up=37808,hp=37809,fp=37810,dp=37811,pp=37812,Ap=37813,mp=37814,gp=37815,_p=37816,xp=37817,yp=37818,vp=37819,bp=37820,wp=37821,Sp=36492,Tp=36494,Ep=36495,Mp=36283,Cp=36284,eh=36285,Rp=36286;var my=2300,fT=2301,uT=2302,DN=2303,FN=2400,ON=2401,BN=2402;var ZN=0,KN=1,WT=2,HH=3200;var _l=0,jT=1,Vo="",jr="srgb",Gd="srgb-linear",zd="linear",Bt="srgb",g2="",XT="rg",QN="ga",JN=0,yf=7680,eL=7681,tL=7682,nL=7683,iL=34055,rL=34056,sL=5386,oL=512,aL=513,lL=514,cL=515,uL=516,hL=517,fL=518,gy=519,_2=512,T_=513,x2=514,th=515,kA=516,y2=517,Hc=518,v2=519,Vd=35044,GA=35048;var dL="300 es",po=2e3,qa=2001,ec={COMPUTE:"compute",RENDER:"render"};var Df={TEXTURE_COMPARE:"depthTextureCompare"};function qle(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function E_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function l_(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function $T(){let i=l_("canvas");return i.style.display="block",i}var Qq={},c_=null;function AA(...i){let e="THREE."+i.shift();c_?c_("log",e,...i):console.log(e,...i)}function WH(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=WH(i);let e="THREE."+i.shift();if(c_)c_("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function Ge(...i){i=WH(i);let e="THREE."+i.shift();if(c_)c_("error",e,...i);else{let t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function Zn(...i){let e=i.join(" ");e in Qq||(Qq[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 jH(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 b2={[lA]:cA,[uA]:dA,[hA]:pA,[Bu]:fA,[cA]:lA,[dA]:uA,[pA]:hA,[fA]:Bu},Go=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}}},Bo=["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"],Jq=1234567,fy=Math.PI/180,Ef=180/Math.PI;function Ou(){let i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(Bo[i&255]+Bo[i>>8&255]+Bo[i>>16&255]+Bo[i>>24&255]+"-"+Bo[e&255]+Bo[e>>8&255]+"-"+Bo[e>>16&15|64]+Bo[e>>24&255]+"-"+Bo[t&63|128]+Bo[t>>8&255]+"-"+Bo[t>>16&255]+Bo[t>>24&255]+Bo[n&255]+Bo[n>>8&255]+Bo[n>>16&255]+Bo[n>>24&255]).toLowerCase()}function Pn(i,e,t){return Math.max(e,Math.min(t,i))}function AL(i,e){return(i%e+e)%e}function Hle(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Wle(i,e,t){return i!==e?(t-i)/(e-i):0}function dy(i,e,t){return(1-t)*i+t*e}function jle(i,e,t,n){return dy(i,e,1-Math.exp(-t*n))}function Xle(i,e=1){return e-Math.abs(AL(i,e*2)-e)}function $le(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function Yle(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function Zle(i,e){return i+Math.floor(Math.random()*(e-i+1))}function Kle(i,e){return i+Math.random()*(e-i)}function Qle(i){return i*(.5-Math.random())}function Jle(i){i!==void 0&&(Jq=i);let e=Jq+=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 ece(i){return i*fy}function tce(i){return i*Ef}function nce(i){return(i&i-1)===0&&i!==0}function ice(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function rce(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function sce(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 la(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return i/4294967295;case Uint16Array:return i/65535;case Uint8Array:return i/255;case Int32Array:return Math.max(i/2147483647,-1);case Int16Array:return Math.max(i/32767,-1);case Int8Array:return Math.max(i/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function qn(i,e){switch(e.constructor){case Float32Array:return i;case Uint32Array:return Math.round(i*4294967295);case Uint16Array:return Math.round(i*65535);case Uint8Array:return Math.round(i*255);case Int32Array:return Math.round(i*2147483647);case Int16Array:return Math.round(i*32767);case Int8Array:return Math.round(i*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}var Wc={DEG2RAD:fy,RAD2DEG:Ef,generateUUID:Ou,clamp:Pn,euclideanModulo:AL,mapLinear:Hle,inverseLerp:Wle,lerp:dy,damp:jle,pingpong:Xle,smoothstep:$le,smootherstep:Yle,randInt:Zle,randFloat:Kle,randFloatSpread:Qle,seededRandom:Jle,degToRad:ece,radToDeg:tce,isPowerOfTwo:nce,ceilPowerOfTwo:ice,floorPowerOfTwo:rce,setQuaternionFromProperEuler:sce,normalize:qn,denormalize:la},yL=class yL{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Pn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Pn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};yL.prototype.isVector2=!0;var Oe=yL,vs=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(Pn(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){let c=Math.acos(a),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},vL=class vL{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(eH.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(eH.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),f=2*(s*n-o*t);return this.x=t+l*c+o*f-a*u,this.y=n+l*u+a*c-s*f,this.z=r+l*f+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this.z=Pn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this.z=Pn(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Pn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return oN.copy(this).projectOnVector(e),this.sub(oN)}reflect(e){return this.sub(oN.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Pn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};vL.prototype.isVector3=!0;var ie=vL,oN=new ie,eH=new vs,bL=class bL{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 Zn("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(aN.makeScale(e,t)),this}rotate(e){return Zn("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(aN.makeRotation(-e)),this}translate(e,t){return Zn("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(aN.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)}};bL.prototype.isMatrix3=!0;var Sn=bL,aN=new Sn,tH=new Sn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),nH=new Sn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function oce(){let i={enabled:!0,workingColorSpace:Gd,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Bt&&(r.r=wf(r.r),r.g=wf(r.g),r.b=wf(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Bt&&(r.r=a_(r.r),r.g=a_(r.g),r.b=a_(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Vo?zd:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return Zn("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),i.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return Zn("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),i.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[Gd]:{primaries:e,whitePoint:n,transfer:zd,toXYZ:tH,fromXYZ:nH,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:jr},outputColorSpaceConfig:{drawingBufferColorSpace:jr}},[jr]:{primaries:e,whitePoint:n,transfer:Bt,toXYZ:tH,fromXYZ:nH,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:jr}}}),i}var sn=oce();function wf(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function a_(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Vg,dT=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Vg===void 0&&(Vg=l_("canvas")),Vg.width=e.width,Vg.height=e.height;let r=Vg.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Vg}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=l_("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=wf(s[o]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(wf(t[n]/255)*255):t[n]=wf(t[n]);return{data:t,width:e.width,height:e.height}}else return je("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},ace=0,u_=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:ace++}),this.uuid=Ou(),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(lN(r[o].image)):s.push(lN(r[o]))}else s=lN(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function lN(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?dT.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 lce=0,cN=new ie,bs=class i extends Go{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=ko,r=ko,s=vi,o=go,a=xr,l=Gi,c=i.DEFAULT_ANISOTROPY,u=Vo){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:lce++}),this.uuid=Ou(),this.name="",this.source=new u_(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Oe(0,0),this.repeat=new Oe(1,1),this.center=new Oe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Sn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(cN).x}get height(){return this.source.getSize(cN).y}get depth(){return this.source.getSize(cN).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!==p2)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Sf:e.x=e.x-Math.floor(e.x);break;case ko:e.x=e.x<0?0:1;break;case Tf:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Sf:e.y=e.y-Math.floor(e.y);break;case ko:e.y=e.y<0?0:1;break;case Tf:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};bs.DEFAULT_IMAGE=null;bs.DEFAULT_MAPPING=p2;bs.DEFAULT_ANISOTROPY=1;var wL=class wL{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=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this.z=Pn(this.z,e.z,t.z),this.w=Pn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this.z=Pn(this.z,e,t),this.w=Pn(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Pn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};wL.prototype.isVector4=!0;var gn=wL,ca=class extends Go{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:vi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new gn(0,0,e,t),this.scissorTest=!1,this.viewport=new gn(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},s=new bs(r),o=n.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:vi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let r=Object.assign({},e.textures[t].image);this.textures[t].source=new u_(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}},ua=class extends ca{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}},mA=class extends bs{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=xi,this.minFilter=xi,this.wrapR=ko,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}};var pT=class extends bs{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=xi,this.minFilter=xi,this.wrapR=ko,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var BT=class BT{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 BT().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();let t=this.elements,n=e.elements,r=1/qg.setFromMatrixColumn(e,0).length(),s=1/qg.setFromMatrixColumn(e,1).length(),o=1/qg.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){let p=o*u,x=o*f,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(cce,e,uce)}lookAt(e,t,n){let r=this.elements;return fl.subVectors(e,t),fl.lengthSq()===0&&(fl.z=1),fl.normalize(),Id.crossVectors(n,fl),Id.lengthSq()===0&&(Math.abs(n.z)===1?fl.x+=1e-4:fl.z+=1e-4,fl.normalize(),Id.crossVectors(n,fl)),Id.normalize(),LS.crossVectors(fl,Id),r[0]=Id.x,r[4]=LS.x,r[8]=fl.x,r[1]=Id.y,r[5]=LS.y,r[9]=fl.y,r[2]=Id.z,r[6]=LS.z,r[10]=fl.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],p=n[9],x=n[13],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=qg.set(r[0],r[1],r[2]).length(),a=qg.set(r[4],r[5],r[6]).length(),l=qg.set(r[8],r[9],r[10]).length();s<0&&(o=-o),Oc.copy(this);let c=1/o,u=1/a,f=1/l;return Oc.elements[0]*=c,Oc.elements[1]*=c,Oc.elements[2]*=c,Oc.elements[4]*=u,Oc.elements[5]*=u,Oc.elements[6]*=u,Oc.elements[8]*=f,Oc.elements[9]*=f,Oc.elements[10]*=f,t.setFromRotationMatrix(Oc),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=po,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===po)v=-(o+s)/(o-s),w=-2*o*s/(o-s);else if(a===qa)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=po,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===po)v=-2/(o-s),w=-(o+s)/(o-s);else if(a===qa)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}};BT.prototype.isMatrix4=!0;var on=BT,qg=new ie,Oc=new on,cce=new ie(0,0,0),uce=new ie(1,1,1),Id=new ie,LS=new ie,fl=new ie,iH=new on,rH=new vs,ha=class i{constructor(e=0,t=0,n=0,r=i.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],p=r[6],x=r[10];switch(t){case"XYZ":this._y=Math.asin(Pn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,x),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Pn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,x),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Pn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,x),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Pn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,x),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Pn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,x));break;case"XZY":this._z=Math.asin(-Pn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,x),this._y=0);break;default:je("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return iH.makeRotationFromQuaternion(e),this.setFromRotationMatrix(iH,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return rH.setFromEuler(this),this.setFromQuaternion(rH,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}};ha.DEFAULT_ORDER="XYZ";var h_=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},hce=0,sH=new ie,Hg=new vs,Af=new on,DS=new ie,iy=new ie,fce=new ie,dce=new vs,oH=new ie(1,0,0),aH=new ie(0,1,0),lH=new ie(0,0,1),cH={type:"added"},pce={type:"removed"},Wg={type:"childadded",child:null},uN={type:"childremoved",child:null},$i=class i extends Go{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:hce++}),this.uuid=Ou(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=i.DEFAULT_UP.clone();let e=new ie,t=new ha,n=new vs,r=new ie(1,1,1);function s(){n.setFromEuler(t,!1)}function o(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new on},normalMatrix:{value:new Sn}}),this.matrix=new on,this.matrixWorld=new on,this.matrixAutoUpdate=i.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new h_,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Hg.setFromAxisAngle(e,t),this.quaternion.multiply(Hg),this}rotateOnWorldAxis(e,t){return Hg.setFromAxisAngle(e,t),this.quaternion.premultiply(Hg),this}rotateX(e){return this.rotateOnAxis(oH,e)}rotateY(e){return this.rotateOnAxis(aH,e)}rotateZ(e){return this.rotateOnAxis(lH,e)}translateOnAxis(e,t){return sH.copy(e).applyQuaternion(this.quaternion),this.position.add(sH.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(oH,e)}translateY(e){return this.translateOnAxis(aH,e)}translateZ(e){return this.translateOnAxis(lH,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Af.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?DS.copy(e):DS.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),iy.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Af.lookAt(iy,DS,this.up):Af.lookAt(DS,iy,this.up),this.quaternion.setFromRotationMatrix(Af),r&&(Af.extractRotation(r.matrixWorld),Hg.setFromRotationMatrix(Af),this.quaternion.premultiply(Hg.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Ge("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(cH),Wg.child=e,this.dispatchEvent(Wg),Wg.child=null):Ge("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(pce),uN.child=e,this.dispatchEvent(uN),uN.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Af.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Af.multiply(e.parent.matrixWorld)),e.applyMatrix4(Af),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(cH),Wg.child=e,this.dispatchEvent(Wg),Wg.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){let o=this.children[n].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(iy,e,fce),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(iy,dce,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}};$i.DEFAULT_UP=new ie(0,1,0);$i.DEFAULT_MATRIX_AUTO_UPDATE=!0;$i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var xs=class extends $i{constructor(){super(),this.isGroup=!0,this.type="Group"}},Ace={type:"move"},qd=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new xs,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 xs,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 xs,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(Ace)))}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 xs;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},XH={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Nd={h:0,s:0,l:0},FS={h:0,s:0,l:0};function hN(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=jr){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=AL(e,1),t=Pn(t,0,1),n=Pn(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=hN(o,s,e+1/3),this.g=hN(o,s,e),this.b=hN(o,s,e-1/3)}return sn.colorSpaceToWorking(this,r),this}setStyle(e,t=jr){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=jr){let n=XH[e.toLowerCase()];return n!==void 0?this.setHex(n,t):je("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=wf(e.r),this.g=wf(e.g),this.b=wf(e.b),this}copyLinearToSRGB(e){return this.r=a_(e.r),this.g=a_(e.g),this.b=a_(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=jr){return sn.workingToColorSpace(Uo.copy(this),e),Math.round(Pn(Uo.r*255,0,255))*65536+Math.round(Pn(Uo.g*255,0,255))*256+Math.round(Pn(Uo.b*255,0,255))}getHexString(e=jr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=sn.workingColorSpace){sn.workingToColorSpace(Uo.copy(this),t);let n=Uo.r,r=Uo.g,s=Uo.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(Uo.copy(this),t),e.r=Uo.r,e.g=Uo.g,e.b=Uo.b,e}getStyle(e=jr){sn.workingToColorSpace(Uo.copy(this),e);let t=Uo.r,n=Uo.g,r=Uo.b;return e!==jr?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(Nd),this.setHSL(Nd.h+e,Nd.s+t,Nd.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Nd),e.getHSL(FS);let n=dy(Nd.h,FS.h,t),r=dy(Nd.s,FS.s,t),s=dy(Nd.l,FS.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}},Uo=new Ut;Ut.NAMES=XH;var Hd=class extends $i{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new ha,this.environmentIntensity=1,this.environmentRotation=new ha,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},Bc=new ie,mf=new ie,fN=new ie,gf=new ie,jg=new ie,Xg=new ie,uH=new ie,dN=new ie,pN=new ie,AN=new ie,mN=new gn,gN=new gn,_N=new gn,vf=class i{constructor(e=new ie,t=new ie,n=new ie){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Bc.subVectors(e,t),r.cross(Bc);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,n,r,s){Bc.subVectors(r,t),mf.subVectors(n,t),fN.subVectors(e,t);let o=Bc.dot(Bc),a=Bc.dot(mf),l=Bc.dot(fN),c=mf.dot(mf),u=mf.dot(fN),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,gf)===null?!1:gf.x>=0&&gf.y>=0&&gf.x+gf.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,gf)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,gf.x),l.addScaledVector(o,gf.y),l.addScaledVector(a,gf.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return mN.setScalar(0),gN.setScalar(0),_N.setScalar(0),mN.fromBufferAttribute(e,t),gN.fromBufferAttribute(e,n),_N.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(mN,s.x),o.addScaledVector(gN,s.y),o.addScaledVector(_N,s.z),o}static isFrontFacing(e,t,n,r){return Bc.subVectors(n,t),mf.subVectors(e,t),Bc.cross(mf).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Bc.subVectors(this.c,this.b),mf.subVectors(this.a,this.b),Bc.cross(mf).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return i.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return i.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,s){return i.getInterpolation(e,this.a,this.b,this.c,t,n,r,s)}containsPoint(e){return i.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return i.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,s=this.c,o,a;jg.subVectors(r,n),Xg.subVectors(s,n),dN.subVectors(e,n);let l=jg.dot(dN),c=Xg.dot(dN);if(l<=0&&c<=0)return t.copy(n);pN.subVectors(e,r);let u=jg.dot(pN),f=Xg.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(jg,o);AN.subVectors(e,s);let x=jg.dot(AN),v=Xg.dot(AN);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(Xg,a);let S=u*v-x*f;if(S<=0&&f-u>=0&&x-v>=0)return uH.subVectors(s,r),a=(f-u)/(f-u+(x-v)),t.copy(r).addScaledVector(uH,a);let T=1/(S+w+p);return o=w*T,a=p*T,t.copy(n).addScaledVector(jg,o).addScaledVector(Xg,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},fa=class{constructor(e=new ie(1/0,1/0,1/0),t=new ie(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Uc.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Uc.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=Uc.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Uc):Uc.fromBufferAttribute(s,o),Uc.applyMatrix4(e.matrixWorld),this.expandByPoint(Uc);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),OS.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),OS.copy(n.boundingBox)),OS.applyMatrix4(e.matrixWorld),this.union(OS)}let r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Uc),Uc.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ry),BS.subVectors(this.max,ry),$g.subVectors(e.a,ry),Yg.subVectors(e.b,ry),Zg.subVectors(e.c,ry),Ld.subVectors(Yg,$g),Dd.subVectors(Zg,Yg),rA.subVectors($g,Zg);let t=[0,-Ld.z,Ld.y,0,-Dd.z,Dd.y,0,-rA.z,rA.y,Ld.z,0,-Ld.x,Dd.z,0,-Dd.x,rA.z,0,-rA.x,-Ld.y,Ld.x,0,-Dd.y,Dd.x,0,-rA.y,rA.x,0];return!xN(t,$g,Yg,Zg,BS)||(t=[1,0,0,0,1,0,0,0,1],!xN(t,$g,Yg,Zg,BS))?!1:(US.crossVectors(Ld,Dd),t=[US.x,US.y,US.z],xN(t,$g,Yg,Zg,BS))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Uc).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Uc).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(_f[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_f[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_f[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_f[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_f[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_f[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_f[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_f[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_f),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},_f=[new ie,new ie,new ie,new ie,new ie,new ie,new ie,new ie],Uc=new ie,OS=new fa,$g=new ie,Yg=new ie,Zg=new ie,Ld=new ie,Dd=new ie,rA=new ie,ry=new ie,BS=new ie,US=new ie,sA=new ie;function xN(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){sA.fromArray(i,s);let a=r.x*Math.abs(sA.x)+r.y*Math.abs(sA.y)+r.z*Math.abs(sA.z),l=e.dot(sA),c=t.dot(sA),u=n.dot(sA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var bf=mce();function mce(){let i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){let c=l-127;c<-27?(n[l]=0,n[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,r[l]=24,r[l|256]=24):(n[l]=31744,n[l|256]=64512,r[l]=13,r[l|256]=13)}let s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function dl(i){Math.abs(i)>65504&&je("DataUtils.toHalfFloat(): Value out of range."),i=Pn(i,-65504,65504),bf.floatView[0]=i;let e=bf.uint32View[0],t=e>>23&511;return bf.baseTable[t]+((e&8388607)>>bf.shiftTable[t])}function kS(i){let e=i>>10;return bf.uint32View[0]=bf.mantissaTable[bf.offsetTable[e]+(i&1023)]+bf.exponentTable[e],bf.floatView[0]}var _s=new ie,GS=new Oe,gce=0,Ni=class extends Go{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:gce++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Vd,this.updateRanges=[],this.gpuType=Yi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)GS.fromBufferAttribute(this,t),GS.applyMatrix3(e),this.setXY(t,GS.x,GS.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)_s.fromBufferAttribute(this,t),_s.applyMatrix3(e),this.setXYZ(t,_s.x,_s.y,_s.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)_s.fromBufferAttribute(this,t),_s.applyMatrix4(e),this.setXYZ(t,_s.x,_s.y,_s.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)_s.fromBufferAttribute(this,t),_s.applyNormalMatrix(e),this.setXYZ(t,_s.x,_s.y,_s.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)_s.fromBufferAttribute(this,t),_s.transformDirection(e),this.setXYZ(t,_s.x,_s.y,_s.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=la(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=qn(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=la(t,this.array)),t}setX(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=la(t,this.array)),t}setY(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=la(t,this.array)),t}setZ(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=la(t,this.array)),t}setW(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array),s=qn(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Vd&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var gA=class extends Ni{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var _A=class extends Ni{constructor(e,t,n){super(new Uint32Array(e),t,n)}},f_=class extends Ni{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=kS(this.array[e*this.itemSize]);return this.normalized&&(t=la(t,this.array)),t}setX(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize]=dl(t),this}getY(e){let t=kS(this.array[e*this.itemSize+1]);return this.normalized&&(t=la(t,this.array)),t}setY(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+1]=dl(t),this}getZ(e){let t=kS(this.array[e*this.itemSize+2]);return this.normalized&&(t=la(t,this.array)),t}setZ(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+2]=dl(t),this}getW(e){let t=kS(this.array[e*this.itemSize+3]);return this.normalized&&(t=la(t,this.array)),t}setW(e,t){return this.normalized&&(t=qn(t,this.array)),this.array[e*this.itemSize+3]=dl(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array)),this.array[e+0]=dl(t),this.array[e+1]=dl(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array)),this.array[e+0]=dl(t),this.array[e+1]=dl(n),this.array[e+2]=dl(r),this}setXYZW(e,t,n,r,s){return e*=this.itemSize,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array),s=qn(s,this.array)),this.array[e+0]=dl(t),this.array[e+1]=dl(n),this.array[e+2]=dl(r),this.array[e+3]=dl(s),this}},kn=class extends Ni{constructor(e,t,n){super(new Float32Array(e),t,n)}},_ce=new fa,sy=new ie,yN=new ie,Ha=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):_ce.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;sy.subVectors(e,this.center);let t=sy.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(sy,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):(yN.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(sy.copy(e.center).add(yN)),this.expandByPoint(sy.copy(e.center).sub(yN))),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}},xce=0,Yl=new on,vN=new $i,Kg=new ie,pl=new fa,oy=new fa,Ks=new ie,Kn=class i extends Go{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:xce++}),this.uuid=Ou(),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(qle(e)?_A:gA)(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 Yl.makeRotationFromQuaternion(e),this.applyMatrix4(Yl),this}rotateX(e){return Yl.makeRotationX(e),this.applyMatrix4(Yl),this}rotateY(e){return Yl.makeRotationY(e),this.applyMatrix4(Yl),this}rotateZ(e){return Yl.makeRotationZ(e),this.applyMatrix4(Yl),this}translate(e,t,n){return Yl.makeTranslation(e,t,n),this.applyMatrix4(Yl),this}scale(e,t,n){return Yl.makeScale(e,t,n),this.applyMatrix4(Yl),this}lookAt(e){return vN.lookAt(e),vN.updateMatrix(),this.applyMatrix4(vN.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Kg).negate(),this.translate(Kg.x,Kg.y,Kg.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let r=0,s=e.length;r<s;r++){let o=e[r];n.push(o.x,o.y,o.z||0)}this.setAttribute("position",new kn(n,3))}else{let n=Math.min(e.length,t.count);for(let r=0;r<n;r++){let s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&je("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new fa);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ie(-1/0,-1/0,-1/0),new ie(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){let s=t[n];pl.setFromBufferAttribute(s),this.morphTargetsRelative?(Ks.addVectors(this.boundingBox.min,pl.min),this.boundingBox.expandByPoint(Ks),Ks.addVectors(this.boundingBox.max,pl.max),this.boundingBox.expandByPoint(Ks)):(this.boundingBox.expandByPoint(pl.min),this.boundingBox.expandByPoint(pl.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ge('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ha);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ge("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new ie,1/0);return}if(e){let n=this.boundingSphere.center;if(pl.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];oy.setFromBufferAttribute(a),this.morphTargetsRelative?(Ks.addVectors(pl.min,oy.min),pl.expandByPoint(Ks),Ks.addVectors(pl.max,oy.max),pl.expandByPoint(Ks)):(pl.expandByPoint(oy.min),pl.expandByPoint(oy.max))}pl.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)Ks.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Ks));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++)Ks.fromBufferAttribute(a,c),l&&(Kg.fromBufferAttribute(e,c),Ks.add(Kg)),r=Math.max(r,n.distanceToSquared(Ks))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Ge('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Ge("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,r=t.normal,s=t.uv,o=this.getAttribute("tangent");(o===void 0||o.count!==n.count)&&(o=new Ni(new Float32Array(4*n.count),4),this.setAttribute("tangent",o));let a=[],l=[];for(let N=0;N<n.count;N++)a[N]=new ie,l[N]=new ie;let c=new ie,u=new ie,f=new ie,p=new Oe,x=new Oe,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 Ni(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let p=0,x=n.count;p<x;p++)n.setXYZ(p,0,0,0);let r=new ie,s=new ie,o=new ie,a=new ie,l=new ie,c=new ie,u=new ie,f=new ie;if(e)for(let p=0,x=e.count;p<x;p+=3){let 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++)Ks.fromBufferAttribute(e,t),Ks.normalize(),e.setXYZ(t,Ks.x,Ks.y,Ks.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 Ni(p,u,f)}if(this.index===null)return je("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new i,n=this.index.array,r=this.attributes;for(let a in r){let l=r[a],c=e(l,n);t.setAttribute(a,c)}let s=this.morphAttributes;for(let a in s){let l=[],c=s[a];for(let u=0,f=c.length;u<f;u++){let p=c[u],x=e(p,n);l.push(x)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,l=o.length;a<l;a++){let c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let f=0,p=c.length;f<p;f++){let x=c[f];u.push(x.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let c in r){let u=r[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],f=s[c];for(let p=0,x=f.length;p<x;p++)u.push(f[p].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let c=0,u=o.length;c<u;c++){let f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},Mf=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Vd,this.updateRanges=[],this.version=0,this.uuid=Ou()}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=Ou()),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=Ou()),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}}},oa=new ie,mo=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++)oa.fromBufferAttribute(this,t),oa.applyMatrix4(e),this.setXYZ(t,oa.x,oa.y,oa.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)oa.fromBufferAttribute(this,t),oa.applyNormalMatrix(e),this.setXYZ(t,oa.x,oa.y,oa.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)oa.fromBufferAttribute(this,t),oa.transformDirection(e),this.setXYZ(t,oa.x,oa.y,oa.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=la(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=qn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=qn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=qn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=qn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=qn(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=la(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=la(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=la(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=la(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=qn(t,this.array),n=qn(n,this.array),r=qn(r,this.array),s=qn(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){AA("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Ni(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new i(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){AA("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}}},yce=0,ws=class extends Go{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:yce++}),this.uuid=Ou(),this.name="",this.type="Material",this.blending=ss,this.side=Ao,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Ud,this.blendDst=kd,this.blendEquation=Bs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ut(0,0,0),this.blendAlpha=0,this.depthFunc=Bu,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=gy,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=yf,this.stencilZFail=yf,this.stencilZPass=yf,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){je(`Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){je(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ss&&(n.blending=this.blending),this.side!==Ao&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Ud&&(n.blendSrc=this.blendSrc),this.blendDst!==kd&&(n.blendDst=this.blendDst),this.blendEquation!==Bs&&(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!==Bu&&(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!==gy&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==yf&&(n.stencilFail=this.stencilFail),this.stencilZFail!==yf&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==yf&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Ut().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new Oe().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new Oe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let r=t.length;n=new Array(r);for(let s=0;s!==r;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},Wd=class extends ws{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ut(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Qg,ay=new ie,Jg=new ie,e_=new ie,t_=new Oe,ly=new Oe,$H=new on,zS=new ie,cy=new ie,VS=new ie,hH=new Oe,bN=new Oe,fH=new Oe,_y=class extends $i{constructor(e=new Wd){if(super(),this.isSprite=!0,this.type="Sprite",Qg===void 0){Qg=new Kn;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new Mf(t,5);Qg.setIndex([0,1,2,0,2,3]),Qg.setAttribute("position",new mo(n,3,0,!1)),Qg.setAttribute("uv",new mo(n,2,3,!1))}this.geometry=Qg,this.material=e,this.center=new Oe(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Ge('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Jg.setFromMatrixScale(this.matrixWorld),$H.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),e_.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Jg.multiplyScalar(-e_.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;qS(zS.set(-.5,-.5,0),e_,o,Jg,r,s),qS(cy.set(.5,-.5,0),e_,o,Jg,r,s),qS(VS.set(.5,.5,0),e_,o,Jg,r,s),hH.set(0,0),bN.set(1,0),fH.set(1,1);let a=e.ray.intersectTriangle(zS,cy,VS,!1,ay);if(a===null&&(qS(cy.set(-.5,.5,0),e_,o,Jg,r,s),bN.set(0,1),a=e.ray.intersectTriangle(zS,VS,cy,!1,ay),a===null))return;let l=e.ray.origin.distanceTo(ay);l<e.near||l>e.far||t.push({distance:l,point:ay.clone(),uv:vf.getInterpolation(ay,zS,cy,VS,hH,bN,fH,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 qS(i,e,t,n,r,s){t_.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(ly.x=s*t_.x-r*t_.y,ly.y=r*t_.x+s*t_.y):ly.copy(t_),i.copy(e),i.x+=ly.x,i.y+=ly.y,i.applyMatrix4($H)}var xf=new ie,wN=new ie,HS=new ie,Fd=new ie,SN=new ie,WS=new ie,TN=new ie,Cf=class{constructor(e=new ie,t=new ie(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,xf)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=xf.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(xf.copy(this.origin).addScaledVector(this.direction,t),xf.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){wN.copy(e).add(t).multiplyScalar(.5),HS.copy(t).sub(e).normalize(),Fd.copy(this.origin).sub(wN);let s=e.distanceTo(t)*.5,o=-this.direction.dot(HS),a=Fd.dot(this.direction),l=-Fd.dot(HS),c=Fd.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(wN).addScaledVector(HS,p),x}intersectSphere(e,t){xf.subVectors(e.center,this.origin);let n=xf.dot(this.direction),r=xf.dot(xf)-n*n,s=e.radius*e.radius;if(r>s)return null;let o=Math.sqrt(s-r),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,s,o,a,l,c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,p=this.origin;return c>=0?(n=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(n=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),u>=0?(s=(e.min.y-p.y)*u,o=(e.max.y-p.y)*u):(s=(e.max.y-p.y)*u,o=(e.min.y-p.y)*u),n>o||s>r||((s>n||isNaN(n))&&(n=s),(o<r||isNaN(r))&&(r=o),f>=0?(a=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(a=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),n>l||a>r)||((a>n||n!==n)&&(n=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,xf)!==null}intersectTriangle(e,t,n,r,s){SN.subVectors(t,e),WS.subVectors(n,e),TN.crossVectors(SN,WS);let o=this.direction.dot(TN),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Fd.subVectors(this.origin,e);let l=a*this.direction.dot(WS.crossVectors(Fd,WS));if(l<0)return null;let c=a*this.direction.dot(SN.cross(Fd));if(c<0||l+c>o)return null;let u=-a*Fd.dot(TN);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)}},Us=class extends ws{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 ha,this.combine=PA,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}},dH=new on,oA=new Cf,jS=new Ha,pH=new ie,XS=new ie,$S=new ie,YS=new ie,EN=new ie,ZS=new ie,AH=new ie,KS=new ie,Hn=class extends $i{constructor(e=new Kn,t=new Us){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){ZS.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(EN.fromBufferAttribute(f,e),o?ZS.addScaledVector(EN,u):ZS.addScaledVector(EN.sub(t),u))}t.add(ZS)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),jS.copy(n.boundingSphere),jS.applyMatrix4(s),oA.copy(e.ray).recast(e.near),!(jS.containsPoint(oA.origin)===!1&&(oA.intersectSphere(jS,pH)===null||oA.origin.distanceToSquared(pH)>(e.far-e.near)**2))&&(dH.copy(s).invert(),oA.copy(e.ray).applyMatrix4(dH),!(n.boundingBox!==null&&oA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,oA)))}_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=QS(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=QS(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=QS(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=QS(this,o,e,n,c,u,f,P,R,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function vce(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===Ao,a),l===null)return null;KS.copy(a),KS.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(KS);return c<t.near||c>t.far?null:{distance:c,point:KS.clone(),object:i}}function QS(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,XS),i.getVertexPosition(l,$S),i.getVertexPosition(c,YS);let u=vce(i,e,t,n,XS,$S,YS,AH);if(u){let f=new ie;vf.getBarycoord(AH,XS,$S,YS,f),r&&(u.uv=vf.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=vf.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=vf.getInterpolatedAttribute(o,a,l,c,f,new ie),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));let p={a,b:l,c,normal:new ie,materialIndex:0};vf.getNormal(XS,$S,YS,p.normal),u.face=p,u.barycoord=f}return u}var xA=class extends bs{constructor(e=null,t=1,n=1,r,s,o,a,l,c=xi,u=xi,f,p){super(null,o,a,l,c,u,r,s,f,p),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Al=class extends Ni{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};var MN=new ie,bce=new ie,wce=new Sn,aa=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=MN.subVectors(n,t).cross(bce.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(MN),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(MN).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)}},aA=new Ha,Sce=new Oe(.5,.5),JS=new ie,Zl=class{constructor(e=new aa,t=new aa,n=new aa,r=new aa,s=new aa,o=new aa){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=po,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===po)r[5].setComponents(c+l,x+p,T+S,L+C).normalize();else if(t===qa)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(),aA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),aA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(aA)}intersectsSprite(e){aA.center.set(0,0,0);let t=Sce.distanceTo(e.center);return aA.radius=.7071067811865476+t,aA.applyMatrix4(e.matrixWorld),this.intersectsSphere(aA)}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(JS.x=r.normal.x>0?e.max.x:e.min.x,JS.y=r.normal.y>0?e.max.y:e.min.y,JS.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(JS)<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)}},mH=new on,xy=class i{constructor(){this.coordinateSystem=po,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];mH.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new Zl),n[r].setFromProjectionMatrix(mH,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 Zl),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var kc=class extends ws{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}},AT=new ie,mT=new ie,gH=new on,uy=new Cf,eT=new Ha,CN=new ie,_H=new ie,jd=class extends $i{constructor(e=new Kn,t=new kc){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let r=1,s=t.count;r<s;r++)AT.fromBufferAttribute(t,r-1),mT.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=AT.distanceTo(mT);e.setAttribute("lineDistance",new kn(n,1))}else je("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),eT.copy(n.boundingSphere),eT.applyMatrix4(r),eT.radius+=s,e.ray.intersectsSphere(eT)===!1)return;gH.copy(r).invert(),uy.copy(e.ray).applyMatrix4(gH);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=tT(this,e,uy,l,T,P,w);R&&t.push(R)}if(this.isLineLoop){let w=u.getX(v-1),S=u.getX(x),T=tT(this,e,uy,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=tT(this,e,uy,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=tT(this,e,uy,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 tT(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(AT.fromBufferAttribute(a,r),mT.fromBufferAttribute(a,s),t.distanceSqToSegment(AT,mT,CN,_H)>n)return;CN.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(CN);if(!(c<e.near||c>e.far))return{distance:c,point:_H.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var xH=new ie,yH=new ie,d_=class extends jd{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let r=0,s=t.count;r<s;r+=2)xH.fromBufferAttribute(t,r),yH.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+xH.distanceTo(yH);e.setAttribute("lineDistance",new kn(n,1))}else je("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var Xd=class extends ws{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}},vH=new on,UN=new Cf,nT=new Ha,iT=new ie,yy=class extends $i{constructor(e=new Kn,t=new Xd){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),nT.copy(n.boundingSphere),nT.applyMatrix4(r),nT.radius+=s,e.ray.intersectsSphere(nT)===!1)return;vH.copy(r).invert(),UN.copy(e.ray).applyMatrix4(vH);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);iT.fromBufferAttribute(f,S),bH(iT,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++)iT.fromBufferAttribute(f,v),bH(iT,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 bH(i,e,t,n,r,s,o){let a=UN.distanceSqToPoint(i);if(a<t){let l=new ie;UN.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 yA=class extends bs{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=xi,this.minFilter=xi,this.generateMipmaps=!1,this.needsUpdate=!0}};var Uu=class extends bs{constructor(e=[],t=gl,n,r,s,o,a,l,c,u){super(e,t,n,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}};var os=class extends bs{constructor(e,t,n=pi,r,s,o,a=xi,l=xi,c,u=ys,f=1){if(u!==ys&&u!==Qs)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let p={width:e,height:t,depth:f};super(p,r,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new u_(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},p_=class extends os{constructor(e,t=pi,n=gl,r,s,o=xi,a=xi,l,c=ys){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}},vy=class extends bs{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Gc=class i extends Kn{constructor(e=1,t=1,n=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:s,depthSegments:o};let a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let l=[],c=[],u=[],f=[],p=0,x=0;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 kn(c,3)),this.setAttribute("normal",new kn(u,3)),this.setAttribute("uv",new kn(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 A_=class i extends Kn{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let s=[],o=[],a=[],l=[],c=new ie,u=new Oe;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let f=0,p=3;f<=t;f++,p+=3){let x=n+f/t*r;c.x=e*Math.cos(x),c.y=e*Math.sin(x),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[p]/e+1)/2,u.y=(o[p+1]/e+1)/2,l.push(u.x,u.y)}for(let f=1;f<=t;f++)s.push(f,f+1,0);this.setIndex(s),this.setAttribute("position",new kn(o,3)),this.setAttribute("normal",new kn(a,3)),this.setAttribute("uv",new kn(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.segments,e.thetaStart,e.thetaLength)}},vA=class i extends Kn{constructor(e=1,t=1,n=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;r=Math.floor(r),s=Math.floor(s);let u=[],f=[],p=[],x=[],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 kn(f,3)),this.setAttribute("normal",new kn(p,3)),this.setAttribute("uv",new kn(x,2));function P(){let C=new ie,L=new ie,D=0,F=(t-e)/n;for(let N=0;N<=s;N++){let B=[],z=N/s,V=z*(t-e)+e;for(let H=0;H<=r;H++){let Z=H/r,J=Z*l+a,j=Math.sin(J),K=Math.cos(J);L.x=V*j,L.y=-z*n+S,L.z=V*K,f.push(L.x,L.y,L.z),C.set(j,F,K).normalize(),p.push(C.x,C.y,C.z),x.push(Z,1-z),B.push(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 da=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(Pn(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(Pn(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}},m_=class extends da{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}},gT=class extends m_{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function mL(){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 wH=new ie,SH=new ie,RN=new mL,PN=new mL,IN=new mL,_T=class extends da{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]:(SH.subVectors(r[0],r[1]).add(r[0]),c=SH);let f=r[a%s],p=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(wH.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=wH),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),RN.initNonuniformCatmullRom(c.x,f.x,p.x,u.x,v,w,S),PN.initNonuniformCatmullRom(c.y,f.y,p.y,u.y,v,w,S),IN.initNonuniformCatmullRom(c.z,f.z,p.z,u.z,v,w,S)}else this.curveType==="catmullrom"&&(RN.initCatmullRom(c.x,f.x,p.x,u.x,this.tension),PN.initCatmullRom(c.y,f.y,p.y,u.y,this.tension),IN.initCatmullRom(c.z,f.z,p.z,u.z,this.tension));return n.set(RN.calc(l),PN.calc(l),IN.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 TH(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 Tce(i,e){let t=1-i;return t*t*e}function Ece(i,e){return 2*(1-i)*i*e}function Mce(i,e){return i*i*e}function py(i,e,t,n){return Tce(i,e)+Ece(i,t)+Mce(i,n)}function Cce(i,e){let t=1-i;return t*t*t*e}function Rce(i,e){let t=1-i;return 3*t*t*i*e}function Pce(i,e){return 3*(1-i)*i*i*e}function Ice(i,e){return i*i*i*e}function Ay(i,e,t,n,r){return Cce(i,e)+Rce(i,t)+Pce(i,n)+Ice(i,r)}var by=class extends da{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(Ay(e,r.x,s.x,o.x,a.x),Ay(e,r.y,s.y,o.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},g_=class extends da{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(Ay(e,r.x,s.x,o.x,a.x),Ay(e,r.y,s.y,o.y,a.y),Ay(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}},wy=class extends da{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}},xT=class extends da{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}},Sy=class extends da{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(py(e,r.x,s.x,o.x),py(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}},Ty=class extends da{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(py(e,r.x,s.x,o.x),py(e,r.y,s.y,o.y),py(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}},Ey=class extends da{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(TH(a,l.x,c.x,u.x,f.x),TH(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}},yT=Object.freeze({__proto__:null,ArcCurve:gT,CatmullRomCurve3:_T,CubicBezierCurve:by,CubicBezierCurve3:g_,EllipseCurve:m_,LineCurve:wy,LineCurve3:xT,QuadraticBezierCurve:Sy,QuadraticBezierCurve3:Ty,SplineCurve:Ey}),vT=class extends da{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 yT[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 yT[r.type]().fromJSON(r))}return this}},bA=class extends vT{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 wy(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 Sy(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 by(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 Ey(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,s,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,n,r,s,o),this}absarc(e,t,n,r,s,o){return this.absellipse(e,t,n,n,r,s,o),this}ellipse(e,t,n,r,s,o,a,l){let c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,n,r,s,o,a,l),this}absellipse(e,t,n,r,s,o,a,l){let c=new m_(e,t,n,r,s,o,a,l);if(this.curves.length>0){let f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);let u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},My=class extends bA{constructor(e){super(e),this.uuid=Ou(),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 bA().fromJSON(r))}return this}};function Nce(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=YH(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=Bce(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 Cy(s,o,t,a,l,c,0),o}function YH(i,e,t,n,r){let s;if(r===$ce(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=EH(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=EH(o/n|0,i[o],i[o+1],s);return s&&__(s,s.next)&&(Py(s),s=s.next),s}function wA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(__(t,t.next)||Pr(t.prev,t,t.next)===0)){if(Py(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Cy(i,e,t,n,r,s,o){if(!i)return;!o&&s&&Vce(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?Dce(i,n,r,s):Lce(i)){e.push(l.i,i.i,c.i),Py(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=Fce(wA(i),e),Cy(i,e,t,n,r,s,2)):o===2&&Oce(i,e,t,n,r,s):Cy(wA(i),e,t,n,r,s,1);break}}}function Lce(i){let e=i.prev,t=i,n=i.next;if(Pr(e,t,n)>=0)return!1;let r=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=Math.min(r,s,o),f=Math.min(a,l,c),p=Math.max(r,s,o),x=Math.max(a,l,c),v=n.next;for(;v!==e;){if(v.x>=u&&v.x<=p&&v.y>=f&&v.y<=x&&hy(r,a,s,l,o,c,v.x,v.y)&&Pr(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function Dce(i,e,t,n){let r=i.prev,s=i,o=i.next;if(Pr(r,s,o)>=0)return!1;let a=r.x,l=s.x,c=o.x,u=r.y,f=s.y,p=o.y,x=Math.min(a,l,c),v=Math.min(u,f,p),w=Math.max(a,l,c),S=Math.max(u,f,p),T=kN(x,v,e,t,n),P=kN(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&&hy(a,u,l,f,c,p,R.x,R.y)&&Pr(R.prev,R,R.next)>=0||(R=R.prevZ,C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==r&&C!==o&&hy(a,u,l,f,c,p,C.x,C.y)&&Pr(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;R&&R.z>=T;){if(R.x>=x&&R.x<=w&&R.y>=v&&R.y<=S&&R!==r&&R!==o&&hy(a,u,l,f,c,p,R.x,R.y)&&Pr(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;C&&C.z<=P;){if(C.x>=x&&C.x<=w&&C.y>=v&&C.y<=S&&C!==r&&C!==o&&hy(a,u,l,f,c,p,C.x,C.y)&&Pr(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Fce(i,e){let t=i;do{let n=t.prev,r=t.next.next;!__(n,r)&&KH(n,t,t.next,r)&&Ry(n,r)&&Ry(r,n)&&(e.push(n.i,t.i,r.i),Py(t),Py(t.next),t=i=r),t=t.next}while(t!==i);return wA(t)}function Oce(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Wce(o,a)){let l=QH(o,a);o=wA(o,o.next),l=wA(l,l.next),Cy(o,e,t,n,r,s,0),Cy(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function Bce(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=YH(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(Hce(c))}r.sort(Uce);for(let s=0;s<r.length;s++)t=kce(r[s],t);return t}function Uce(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 kce(i,e){let t=Gce(i,e);if(!t)return e;let n=QH(t,i);return wA(n,n.next),wA(t,t.next)}function Gce(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(__(i,t))return t;do{if(__(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){let f=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=n&&f>s&&(s=f,o=t.x<t.next.x?t:t.next,f===n))return o}t=t.next}while(t!==e);if(!o)return null;let a=o,l=o.x,c=o.y,u=1/0;t=o;do{if(n>=t.x&&t.x>=l&&n!==t.x&&ZH(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);Ry(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&zce(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function zce(i,e){return Pr(i.prev,i,e.prev)<0&&Pr(e.next,i,i.next)<0}function Vce(i,e,t,n){let r=i;do r.z===0&&(r.z=kN(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,qce(r)}function qce(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 kN(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 Hce(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 ZH(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 hy(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&ZH(i,e,t,n,r,s,o,a)}function Wce(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!jce(i,e)&&(Ry(i,e)&&Ry(e,i)&&Xce(i,e)&&(Pr(i.prev,i,e.prev)||Pr(i,e.prev,e))||__(i,e)&&Pr(i.prev,i,i.next)>0&&Pr(e.prev,e,e.next)>0)}function Pr(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function __(i,e){return i.x===e.x&&i.y===e.y}function KH(i,e,t,n){let r=sT(Pr(i,e,t)),s=sT(Pr(i,e,n)),o=sT(Pr(t,n,i)),a=sT(Pr(t,n,e));return!!(r!==s&&o!==a||r===0&&rT(i,t,e)||s===0&&rT(i,n,e)||o===0&&rT(t,i,n)||a===0&&rT(t,e,n))}function rT(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function sT(i){return i>0?1:i<0?-1:0}function jce(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&&KH(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Ry(i,e){return Pr(i.prev,i,i.next)<0?Pr(i,e,i.next)>=0&&Pr(i,i.prev,e)>=0:Pr(i,e,i.prev)<0||Pr(i,i.next,e)<0}function Xce(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 QH(i,e){let t=GN(i.i,i.x,i.y),n=GN(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 EH(i,e,t,n){let r=GN(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 Py(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 GN(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function $ce(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 Nce(e,t,n)}},Bd=class i{static area(e){let t=e.length,n=0;for(let r=t-1,s=0;s<t;r=s++)n+=e[r].x*e[s].y-e[s].x*e[r].y;return n*.5}static isClockWise(e){return i.area(e)<0}static triangulateShape(e,t){let n=[],r=[],s=[];MH(e),CH(n,e);let o=e.length;t.forEach(MH);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,CH(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 MH(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function CH(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var Iy=class i extends Kn{constructor(e=new My([new Oe(.5,.5),new Oe(-.5,.5),new Oe(-.5,-.5),new Oe(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new kn(r,3)),this.setAttribute("uv",new kn(s,2)),this.computeVertexNormals();function o(a){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:1,p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,x=t.bevelThickness!==void 0?t.bevelThickness:.2,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:Yce,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(!Bd.isClockWise(z)){z=z.reverse();for(let Xe=0,st=V.length;Xe<st;Xe++){let tt=V[Xe];Bd.isClockWise(tt)&&(V[Xe]=tt.reverse())}}function Z(Xe){let tt=10000000000000001e-36,vt=Xe[0];for(let yt=1;yt<=Xe.length;yt++){let ln=yt%Xe.length,Kt=Xe[ln],Qt=Kt.x-vt.x,xn=Kt.y-vt.y,ge=Qt*Qt+xn*xn,di=Math.max(Math.abs(Kt.x),Math.abs(Kt.y),Math.abs(vt.x),Math.abs(vt.y)),On=tt*di*di;if(ge<=On){Xe.splice(ln,1),yt--;continue}vt=Kt}}Z(z),V.forEach(Z);let J=V.length,j=z;for(let Xe=0;Xe<J;Xe++){let st=V[Xe];z=z.concat(st)}function K(Xe,st,tt){return st||Ge("ExtrudeGeometry: vec does not exist"),Xe.clone().addScaledVector(st,tt)}let ee=z.length;function ae(Xe,st,tt){let vt,yt,ln,Kt=Xe.x-st.x,Qt=Xe.y-st.y,xn=tt.x-Xe.x,ge=tt.y-Xe.y,di=Kt*Kt+Qt*Qt,On=Kt*ge-Qt*xn;if(Math.abs(On)>Number.EPSILON){let le=Math.sqrt(di),X=Math.sqrt(xn*xn+ge*ge),Te=st.x-Qt/le,Pe=st.y+Kt/le,Ve=tt.x-ge/X,gt=tt.y+xn/X,St=((Ve-Te)*ge-(gt-Pe)*xn)/(Kt*ge-Qt*xn);vt=Te+Kt*St-Xe.x,yt=Pe+Qt*St-Xe.y;let qe=vt*vt+yt*yt;if(qe<=2)return new Oe(vt,yt);ln=Math.sqrt(qe/2)}else{let le=!1;Kt>Number.EPSILON?xn>Number.EPSILON&&(le=!0):Kt<-Number.EPSILON?xn<-Number.EPSILON&&(le=!0):Math.sign(Qt)===Math.sign(ge)&&(le=!0),le?(vt=-Qt,yt=Kt,ln=Math.sqrt(di)):(vt=Kt,yt=Qt,ln=Math.sqrt(di/2))}return new Oe(vt/ln,yt/ln)}let ce=[];for(let Xe=0,st=j.length,tt=st-1,vt=Xe+1;Xe<st;Xe++,tt++,vt++)tt===st&&(tt=0),vt===st&&(vt=0),ce[Xe]=ae(j[Xe],j[tt],j[vt]);let de=[],ve,Ie=ce.concat();for(let Xe=0,st=J;Xe<st;Xe++){let tt=V[Xe];ve=[];for(let vt=0,yt=tt.length,ln=yt-1,Kt=vt+1;vt<yt;vt++,ln++,Kt++)ln===yt&&(ln=0),Kt===yt&&(Kt=0),ve[vt]=ae(tt[vt],tt[ln],tt[Kt]);de.push(ve),Ie=Ie.concat(ve)}let Qe;if(S===0)Qe=Bd.triangulateShape(j,V);else{let Xe=[],st=[];for(let tt=0;tt<S;tt++){let vt=tt/S,yt=x*Math.cos(vt*Math.PI/2),ln=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,On=xn.length;di<On;di++){let le=K(xn[di],ve[di],ln);Et(le.x,le.y,-yt),vt===0&&ge.push(le)}vt===0&&st.push(ge)}}Qe=Bd.triangulateShape(Xe,st)}let Ue=Qe.length,mt=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,On=st+yt+xn,le=st+vt+xn;Ct(ge,di,On,le)}}}function Et(Xe,st,tt){l.push(Xe),l.push(st),l.push(tt)}function Tt(Xe,st,tt){un(Xe),un(st),un(tt);let vt=r.length/3,yt=P.generateTopUV(n,r,vt-3,vt-2,vt-1);Gt(yt[0]),Gt(yt[1]),Gt(yt[2])}function Ct(Xe,st,tt,vt){un(Xe),un(st),un(vt),un(st),un(tt),un(vt);let yt=r.length/3,ln=P.generateSideWallUV(n,r,yt-6,yt-3,yt-2,yt-1);Gt(ln[0]),Gt(ln[1]),Gt(ln[3]),Gt(ln[1]),Gt(ln[2]),Gt(ln[3])}function un(Xe){r.push(l[Xe*3+0]),r.push(l[Xe*3+1]),r.push(l[Xe*3+2])}function Gt(Xe){s.push(Xe.x),s.push(Xe.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return Zce(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 yT[r.type]().fromJSON(r)),new i(n,e.options)}},Yce={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 Zce(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 SA=class i extends Kn{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};let s=e/2,o=t/2,a=Math.floor(n),l=Math.floor(r),c=a+1,u=l+1,f=e/a,p=t/l,x=[],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 kn(v,3)),this.setAttribute("normal",new kn(w,3)),this.setAttribute("uv",new kn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.width,e.height,e.widthSegments,e.heightSegments)}};var pa=class i extends Kn{constructor(e=1,t=32,n=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let l=Math.min(o+a,Math.PI),c=0,u=[],f=new ie,p=new ie,x=[],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 kn(v,3)),this.setAttribute("normal",new kn(w,3)),this.setAttribute("uv",new kn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var Ny=class i extends Kn{constructor(e=new Ty(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 kn(f,3)),this.setAttribute("normal",new kn(p,3)),this.setAttribute("uv",new kn(x,2));function w(){for(let R=0;R<t;R++)S(R);S(s===!1?t:0),P(),T()}function S(R){u=e.getPointAt(R/t,u);let C=o.normals[R],L=o.binormals[R];for(let D=0;D<=r;D++){let F=D/r*Math.PI*2,N=Math.sin(F),B=-Math.cos(F);l.x=B*C.x+N*L.x,l.y=B*C.y+N*L.y,l.z=B*C.z+N*L.z,l.normalize(),p.push(l.x,l.y,l.z),a.x=u.x+n*l.x,a.y=u.y+n*l.y,a.z=u.z+n*l.z,f.push(a.x,a.y,a.z)}}function T(){for(let R=1;R<=t;R++)for(let C=1;C<=r;C++){let L=(r+1)*(R-1)+(C-1),D=(r+1)*R+(C-1),F=(r+1)*R+C,N=(r+1)*(R-1)+C;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 yT[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},Ly=class extends Kn{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){let t=[],n=new Set,r=new ie,s=new ie;if(e.index!==null){let o=e.attributes.position,a=e.index,l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){let f=l[c],p=f.start,x=f.count;for(let 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),RH(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),RH(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new kn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function RH(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 Dy=class extends ws{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ut(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};function zA(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(PH(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(PH(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 qo(i){let e={};for(let t=0;t<i.length;t++){let n=zA(i[t]);for(let r in n)e[r]=n[r]}return e}function PH(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function Kce(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function gL(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:sn.workingColorSpace}var VA={clone:zA,merge:qo},Qce=`void main() {1+(()=>{var Ese=Object.create;var D4=Object.defineProperty;var Mse=Object.getOwnPropertyDescriptor;var Cse=Object.getOwnPropertyNames;var Rse=Object.getPrototypeOf,Pse=Object.prototype.hasOwnProperty;var Ise=(i,e)=>()=>{try{return e||i((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},Nse=(i,e)=>{for(var t in e)D4(i,t,{get:e[t],enumerable:!0})},Lse=(i,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Cse(e))!Pse.call(i,r)&&r!==t&&D4(i,r,{get:()=>e[r],enumerable:!(n=Mse(e,r))||n.enumerable});return i};var Dse=(i,e,t)=>(t=i!=null?Ese(Rse(i)):{},Lse(e||!i||!i.__esModule?D4(t,"default",{value:i,enumerable:!0}):t,i));var v$=Ise((fv,y6)=>{(function(i,e){typeof fv=="object"&&typeof y6=="object"?y6.exports=e():typeof define=="function"&&define.amd?define("FrameTicker",[],e):typeof fv=="object"?fv.FrameTicker=e():i.FrameTicker=e()})(fv,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 B9=i=>new Promise(e=>setTimeout(e,i)),ss=i=>document.querySelector(i);async function Fse(){for(let i=0;i<300&&!(window.__atlasDebug&&!ss("#map-loading")?.checkVisibility?.());i+=1)await B9(100)}async function Ose(){let i="";for(let e=0;e<100;e+=1){await B9(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 ud(i,e={}){window.dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0,...e}))}function Bse(i,e={}){window.dispatchEvent(new KeyboardEvent("keyup",{key:i,bubbles:!0,cancelable:!0,...e}))}function Use(i){ss("#map").dispatchEvent(new KeyboardEvent("keydown",{key:i,bubbles:!0,cancelable:!0}))}function P0(i,e){i.value=e,i.dispatchEvent(new Event("change",{bubbles:!0}))}function F4(i,e){let t=ss(i);t.value=e,t.dispatchEvent(new Event("input",{bubbles:!0}))}function O4(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 kse(){let i=[],e=async p=>{await Ose(),i.push({name:p,snapshot:JSON.parse(window.render_game_to_text())})};await Fse(),localStorage.clear();let t=ss("#game-select"),n=t.options[0].value;P0(t,n),await e("initial"),F4("#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")),F4("#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")),ud("g"),await e("grid-open"),F4("#grid-input","m"),await e("grid-descended"),ud(" "),await e("subgrid-hidden"),ud(" "),ud("Escape"),await e("grid-ascended"),ud("Escape"),await e("grid-closed"),ud("z"),await e("labels-on"),Bse("z"),await e("labels-off"),ud("b",{metaKey:!0}),await e("sidebar-collapsed"),ud("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"),Use("Escape"),await e("viewport-escape");let u=ss("#variant-select");u.options.length>1&&(P0(u,u.options[1].value),await e("variant-second"),P0(u,u.options[0].value),await e("variant-first"));let f=ss("#map-select");return f.options.length>1&&(P0(f,f.options[1].value),await e("map-second"),P0(f,f.options[0].value),await e("map-first")),t.options.length>1&&(P0(t,t.options[1].value),await e("game-second"),P0(t,n),await e("game-first")),localStorage.clear(),{viewport:[window.innerWidth,window.innerHeight],steps:i}}var B4=!1;async function U9(){if(!B4){B4=!0,O4("parity tour running\u2026");try{let i=await kse(),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}`);O4(`parity tour complete \u2713 ${i.steps.length} steps`),console.log("parity tour saved to",t)}catch(i){O4(`parity tour failed: ${i}`,!0),console.error("parity tour failed",i)}finally{B4=!1}}}window.__atlasTour=U9;window.addEventListener("keydown",i=>{i.key==="F9"&&U9()});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 I0(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 tg=["#4fb3d5","#c9924b","#82b56a","#c96a6a","#9581cc","#4bc9a9","#d4b04a","#6a92c9","#b08a5a","#8fb3a2"],zl="0123456789bcdefghjkmnpqrstuvwxyz";var U4="atlas.session";var k9={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 k4(i){let e=Cr();for(let t=0,n=i.length;t<n;++t)D0(e,i[t]);return e}function Gse(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 ng(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 nw(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i.slice()}function hd(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 vc(i,e){return hx(i,e[0],e[1])}function Au(i,e){return i[0]<=e[0]&&e[2]<=i[2]&&i[1]<=e[1]&&e[3]<=i[3]}function hx(i,e,t){return i[0]<=e&&e<=i[2]&&i[1]<=t&&t<=i[3]}function tw(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 N0(i){return cl(1/0,1/0,-1/0,-1/0,i)}function iw(i,e){let t=i[0],n=i[1];return cl(t,n,t,n,e)}function ig(i,e,t,n,r){let s=N0(r);return G4(s,i,e,t,n)}function L0(i,e){return i[0]==e[0]&&i[2]==e[2]&&i[1]==e[1]&&i[3]==e[3]}function rw(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 D0(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 G4(i,e,t,n,r){for(;t<n;t+=r)zse(i,e[t],e[t+1]);return i}function zse(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 sw(i,e){let t;return t=e(rg(i)),t||(t=e(sg(i)),t)||(t=e(og(i)),t)||(t=e(Vl(i)),t)?t:!1}function fx(i){let e=0;return gu(i)||(e=jn(i)*_r(i)),e}function rg(i){return[i[0],i[1]]}function sg(i){return[i[2],i[1]]}function Ua(i){return[(i[0]+i[2])/2,(i[1]+i[3])/2]}function G9(i,e){let t;if(e==="bottom-left")t=rg(i);else if(e==="bottom-right")t=sg(i);else if(e==="top-left")t=Vl(i);else if(e==="top-right")t=og(i);else throw new Error("Invalid corner");return t}function dx(i,e,t,n,r){let[s,o,a,l,c,u,f,p]=z4(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 z4(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 mu(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]):N0(n),n}function V4(i,e){if(!xr(i,e))return[i.slice()];if(Au(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 Vl(i){return[i[0],i[3]]}function og(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 gu(i){return i[2]<i[0]||i[3]<i[1]}function z9(i,e){return e?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e):i}function V9(i,e,t){let n=!1,r=tw(i,e),s=tw(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 q9(i,e,t,n){if(gu(i))return N0(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 Gse(s,o,t)}function q4(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 ow(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]]];q4(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 H9(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(...V4(t[o],e[n]));t=s}return t}var W9={info:1,warn:2,error:3,none:4},Vse=W9.info;function aw(...i){Vse>W9.warn||console.warn(...i)}function _i(i,e,t){return Math.min(Math.max(i,e),t)}function j9(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 bc(i,e,t,n)}function bc(i,e,t,n){let r=t-i,s=n-e;return r*r+s*s}function X9(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 lw(i){return i*180/Math.PI}function wc(i){return i*Math.PI/180}function _u(i,e){let t=i%e;return t*e<0?t+e:t}function Io(i,e,t){return i+t*(e-i)}function F0(i,e){let t=Math.pow(10,e);return Math.round(i*t)/t}function px(i,e){return Math.floor(F0(i,e))}function Ax(i,e){return Math.ceil(F0(i,e))}function cw(i,e,t){if(i>=e&&i<t)return i;let n=t-e;return((i-e)%n+n)%n+e}function $9(i,e){return i[0]+=+e[0],i[1]+=+e[1],i}function O0(i,e){let t=!0;for(let n=i.length-1;n>=0;--n)if(i[n]!=e[n]){t=!1;break}return t}function ag(i,e){let t=Math.cos(e),n=Math.sin(e),r=i[0]*t-i[1]*n,s=i[1]*t+i[0]*n;return i[0]=r,i[1]=s,i}function Y9(i,e){return i[0]*=e,i[1]*=e,i}function uw(i,e){if(e.canWrapX()){let t=jn(e.getExtent()),n=Z9(i,e,t);n&&(i[0]-=n*t)}return i}function Z9(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 K9(i,e,t){let n=Math.sqrt((e[0]-i[0])*(e[0]-i[0])+(e[1]-i[1])*(e[1]-i[1])),r=[(e[0]-i[0])/n,(e[1]-i[1])/n],s=[-r[1],r[0]],o=Math.sqrt((t[0]-i[0])*(t[0]-i[0])+(t[1]-i[1])*(t[1]-i[1])),a=[(t[0]-i[0])/o,(t[1]-i[1])/o],l=n===0||o===0?0:Math.acos(_i(a[0]*r[0]+a[1]*r[1],-1,1));return l=Math.max(l,1e-5),a[0]*s[0]+a[1]*s[1]>0?l:Math.PI*2-l}var Yh={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var H4=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_||Yh[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_}},fd=H4;var mx=6378137,lg=Math.PI*mx,qse=[-lg,-lg,lg,lg],Hse=[-180,-85,180,85],hw=mx*Math.log(Math.tan(Math.PI/2)),dd=class extends fd{constructor(e){super({code:e,units:"m",extent:qse,global:!0,worldExtent:Hse,getPointResolution:function(t,n){return t/Math.cosh(n[1]/mx)}})}},W4=[new dd("EPSG:3857"),new dd("EPSG:102100"),new dd("EPSG:102113"),new dd("EPSG:900913"),new dd("http://www.opengis.net/def/crs/EPSG/0/3857"),new dd("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Q9(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]=lg*i[s]/180;let o=mx*Math.log(Math.tan(Math.PI*(+i[s+1]+90)/360));o>hw?o=hw:o<-hw&&(o=-hw),e[s+1]=o}return e}function J9(i,e,t,n){let r=i.length;t=t>1?t:2,n=n??t,e===void 0&&(t>2?e=i.slice():e=new Array(r));for(let s=0;s<r;s+=n)e[s]=180*i[s]/lg,e[s+1]=360*Math.atan(Math.exp(i[s+1]/mx))/Math.PI-90;return e}var Wse=6378137,eG=[-180,-90,180,90],jse=Math.PI*Wse/180,Zh=class extends fd{constructor(e,t){super({code:e,units:"degrees",extent:eG,axisOrientation:t,global:!0,metersPerUnit:jse,worldExtent:eG})}},j4=[new Zh("CRS:84"),new Zh("EPSG:4326","neu"),new Zh("urn:ogc:def:crs:OGC:1.3:CRS84"),new Zh("urn:ogc:def:crs:OGC:2:84"),new Zh("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Zh("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Zh("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];var X4={};function tG(i){return X4[i]||X4[i.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function nG(i,e){X4[i]=e}function xu(i){for(let e in i)delete i[e]}function Sc(i){let e;for(e in i)return!1;return!e}var cg={};function ug(i,e,t){let n=i.getCode(),r=e.getCode();n in cg||(cg[n]={}),cg[n][r]=t}function fw(i,e){return i in cg&&e in cg[i]?cg[i][e]:null}var dw=.9996,ql=.00669438,Aw=ql*ql,mw=Aw*ql,B0=ql/(1-ql),iG=Math.sqrt(1-ql),hg=(1-iG)/(1+iG),aG=hg*hg,$4=aG*hg,Y4=$4*hg,lG=Y4*hg,cG=1-ql/4-3*Aw/64-5*mw/256,Xse=3*ql/8+3*Aw/32+45*mw/1024,$se=15*Aw/256+45*mw/1024,Yse=35*mw/3072,Zse=3/2*hg-27/32*$4+269/512*lG,Kse=21/16*aG-55/32*Y4,Qse=151/96*$4-417/128*lG,Jse=1097/512*Y4,pw=6378137;function eoe(i,e,t){let n=i-5e5,o=(t.north?e:e-1e7)/dw/(pw*cG),a=o+Zse*Math.sin(2*o)+Kse*Math.sin(4*o)+Qse*Math.sin(6*o)+Jse*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-ql*c,w=Math.sqrt(1-ql*c),S=pw/w,T=(1-ql)/v,P=B0*u**2,R=P*P,C=n/(S*dw),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*B0))+B/720*(61+90*p+298*P+45*x-252*B0-3*R),V=(C-D/6*(1+2*p+P)+N/120*(5-2*P+28*p-3*R+8*B0+24*x))/u;return V=cw(V+wc(uG(t.number)),-Math.PI,Math.PI),[lw(V),lw(z)]}var rG=-80,sG=84,toe=-180,noe=180;function ioe(i,e,t){i=cw(i,toe,noe),e<rG?e=rG:e>sG&&(e=sG);let n=wc(e),r=Math.sin(n),s=Math.cos(n),o=r/s,a=o*o,l=a*a,c=wc(i),u=uG(t.number),f=wc(u),p=pw/Math.sqrt(1-ql*r**2),x=B0*s**2,v=s*cw(c-f,-Math.PI,Math.PI),w=v*v,S=w*v,T=S*v,P=T*v,R=P*v,C=pw*(cG*n-Xse*Math.sin(2*n)+$se*Math.sin(4*n)-Yse*Math.sin(6*n)),L=dw*p*(v+S/6*(1-a+x)+P/120*(5-18*a+l+72*x-58*B0))+5e5,D=dw*(C+p*o*(w/2+T/24*(5-a+9*x+4*x**2)+R/720*(61-58*a+l+600*x-330*B0)));return t.north||(D+=1e7),[L,D]}function uG(i){return(i-1)*6-180+3}var roe=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function hG(i){let e=0;for(let r of roe){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 oG(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 fG(i){return hG(i)?new fd({code:i,units:"m"}):null}function dG(i){let e=hG(i.getCode());return e?{forward:oG(ioe,e),inverse:oG(eoe,e)}:null}var soe=63710088e-1;function Z4(i,e,t){t=t||soe;let n=wc(i[1]),r=wc(e[1]),s=(r-n)/2,o=wc(e[0]-i[0])/2,a=Math.sin(s)*Math.sin(s)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(r);return 2*t*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}var ooe=[dG],aoe=[fG];var Q4=!0;function AG(i){Q4=!(i===void 0?!0:i)}function eP(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 J4(i){nG(i.getCode(),i),ug(i,i,eP)}function loe(i){i.forEach(J4)}function _s(i){if(typeof i!="string")return i;let e=tG(i);if(e)return e;for(let t of aoe){let n=t(i);if(n)return n}return null}function tP(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/Yh[n])}}else{let o=i.getUnits();if(o=="degrees"&&!n||n=="degrees")r=e;else{let a=U0(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=Z4(c.slice(0,2),c.slice(2,4)),f=Z4(c.slice(4,6),c.slice(6,8));r=(u+f)/2}let l=n?Yh[n]:i.getMetersPerUnit();l!==void 0&&(r/=l)}}return r}function pG(i){loe(i),i.forEach(function(e){i.forEach(function(t){e!==t&&ug(e,t,eP)})})}function coe(i,e,t,n){i.forEach(function(r){e.forEach(function(s){ug(r,s,t),ug(s,r,n)})})}function gw(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 fg(i,e){if(i===e)return!0;let t=i.getUnits()===e.getUnits();return(i.getCode()===e.getCode()||U0(i,e)===eP)&&t}function U0(i,e){let t=i.getCode(),n=e.getCode(),r=fw(t,n);if(r)return r;let s=null,o=null;for(let l of ooe)s||(s=l(i)),o||(o=l(e));if(!s&&!o)return null;let a="EPSG:4326";if(o)if(s)r=K4(s.inverse,o.forward);else{let l=fw(t,a);l&&(r=K4(l,o.forward))}else{let l=fw(a,n);l&&(r=K4(s.inverse,l))}return r&&(J4(i),J4(e),ug(i,e,r)),r}function K4(i,e){return function(t,n,r,s){return n=i(t,n,r,s),e(n,n,r,s)}}function k0(i,e){let t=_s(i),n=_s(e);return U0(t,n)}function dg(i,e,t){let n=k0(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 gG(i,e,t,n){let r=k0(e,t);return q9(i,r,void 0,n)}var Tc=null;function G0(){return Tc}function gx(i,e){return Tc?dg(i,e,Tc):i}function Ec(i,e){return Tc?dg(i,Tc,e):(Q4&&!O0(i,[0,0])&&i[0]>=-180&&i[0]<=180&&i[1]>=-90&&i[1]<=90&&(Q4=!1,aw("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),i)}function pd(i,e){return Tc?gG(i,e,Tc):i}function Mc(i,e){return Tc?gG(i,Tc,e):i}function _G(i,e){if(!Tc)return i;let t=_s(e).getMetersPerUnit(),n=Tc.getMetersPerUnit();return t&&n?i*t/n:i}function uoe(){pG(W4),pG(j4),coe(j4,W4,Q9,J9)}uoe();function nP(i){return i[0]>0&&i[1]>0}function xG(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 Hr(i,e){return Array.isArray(i)?i:(e===void 0?e=[i,i]:(e[0]=i,e[1]=i),e)}var _w=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 z0(i,e,t,n,r){return r!==void 0?(r.minX=i,r.maxX=e,r.minY=t,r.maxY=n,r):new _w(i,e,t,n)}var xw=_w;function yG(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 vG(i,e){return i<e?1:i>e?-1:0}function pg(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 bG(i,e,t){for(;e<t;){let n=i[e];i[e]=i[t],i[t]=n,++e,--t}}function Cc(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 No(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 wG(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 SG(i,e,t,n,r){return!sw(r,function(o){return!Ad(i,e,t,n,o[0],o[1])})}function Ad(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 _x(i,e,t,n,r,s){if(t.length===0||!Ad(i,e,t[0],n,r,s))return!1;for(let o=1,a=t.length;o<a;++o)if(Ad(i,t[o-1],t[o],n,r,s))return!1;return!0}function TG(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(_x(i,e,l,n,r,s))return!0;e=l[l.length-1]}return!1}function EG(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 yw(i,e,t,n,r,s){return s=s??G4(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:EG(i,e,t,n,function(o,a){return V9(r,o,a)}):!1}function iP(i,e,t,n,r){return!!(yw(i,e,t,n,r)||Ad(i,e,t,n,r[0],r[1])||Ad(i,e,t,n,r[0],r[3])||Ad(i,e,t,n,r[2],r[1])||Ad(i,e,t,n,r[2],r[3]))}function rP(i,e,t,n,r){if(!iP(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(SG(i,t[s-1],t[s],n,r)&&!yw(i,t[s-1],t[s],n,r))return!1;return!0}function MG(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];if(rP(i,e,a,n,r))return!0;e=a[a.length-1]}return!1}function Yn(){throw new Error("Unimplemented abstract method.")}var hoe=0;function Ln(i){return i.ol_uid||(i.ol_uid=String(++hoe))}function Ag(i,e,t,n){return n!==void 0?(n[0]=i,n[1]=e,n[2]=t,n):[i,e,t]}function foe(i,e,t){return i+"/"+e+"/"+t}function mg(i,e,t,n,r){return`${Ln(i)},${e},${foe(t,n,r)}`}function CG(i){return doe(i[0],i[1],i[2])}function doe(i,e,t){return(e<<i)+t}function RG(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 gg=[0,0,0],md=5,sP=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(wG(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_=Vl(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 xw(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=z0(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 z0(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 z0(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 z0(c,c,u,u,n);let f=Math.floor(l*(s+1))-1,p=Math.floor(l*(o+1))-1;return z0(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,gg);let r=gg[1],s=gg[2];this.getTileCoordForXYAndZ_(e[2],e[1],t,!0,gg);let o=gg[1],a=gg[2];return z0(r,o,s,a,n)}getTileCoordCenter(e){let t=this.getOrigin(e[0]),n=this.getResolution(e[0]),r=Hr(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=Hr(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=Hr(this.getTileSize(o),this.tmpSize_),u=a*(e-l[0])/n/c[0],f=a*(l[1]-t)/n/c[1];return r?(u=Ax(u,md)-1,f=Ax(f,md)-1):(u=px(u,md),f=px(f,md)),Ag(o,u,f,s)}getTileCoordForXYAndZ_(e,t,n,r,s){let o=this.getOrigin(n),a=this.getResolution(n),l=Hr(this.getTileSize(n),this.tmpSize_),c=(e-o[0])/a/l[0],u=(o[1]-t)/a/l[1];return r?(c=Ax(c,md)-1,u=Ax(u,md)-1):(c=px(c,md),u=px(u,md)),Ag(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=pg(this.resolutions_,e,t||0);return _i(n,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(e,t){return iP(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}},xx=sP;function vw(i){let e=i.getDefaultTileGrid();return e||(e=Aoe(i),i.setDefaultTileGrid(e)),e}function IG(i,e,t){let n=e[0],r=i.getTileCoordCenter(e),s=bw(t);if(!vc(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 poe(i,e,t,n){n=n!==void 0?n:"top-left";let r=LG(i,e,t);return new xx({extent:i,origin:G9(i,n),resolutions:r,tileSize:t})}function NG(i){let e=i||{},t=e.extent||_s("EPSG:3857").getExtent(),n={extent:t,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:LG(t,e.maxZoom,e.tileSize,e.maxResolution)};return new xx(n)}function LG(i,e,t,n){e=e!==void 0?e:42,t=Hr(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 Aoe(i,e,t,n){let r=bw(i);return poe(r,e,t,n)}function bw(i){i=_s(i);let e=i.getExtent();if(!e){let t=180*Yh.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 _g(i,e,t,n){return kn(i,e,t,n,!0)}function ii(i){i&&i.target&&(i.target.removeEventListener(i.type,i.listener),xu(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 oP=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}},gd=oP;function Kh(){return!0}function Qh(){return!1}function Jh(){}function ww(i){let e,t,n;return function(){let r=Array.prototype.slice.call(arguments);return(!t||this!==n||!No(r,t))&&(n=this,t=r,e=i.apply(this,arguments)),e}}function DG(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 aP=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}};var $s=aP;var lP=class extends gd{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 $s(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,Jh);delete o[n]}return l}disposeInternal(){this.listeners_&&xu(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]=Jh,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},_d=lP;var V0=typeof navigator<"u"&&typeof navigator.userAgent<"u"?navigator.userAgent.toLowerCase():"",moe=V0.includes("safari")&&!V0.includes("chrom"),UIe=moe&&(V0.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(V0)),FG=V0.includes("webkit")&&!V0.includes("edge"),cP=V0.includes("macintosh"),OG=typeof devicePixelRatio<"u"?devicePixelRatio:1,Fs=typeof WorkerGlobalScope<"u"&&typeof OffscreenCanvas<"u"&&self instanceof WorkerGlobalScope,uP=typeof Image<"u"&&Image.prototype.decode;var Sw=(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 BG(i,e,t){let n=i,r=!0,s=!1,o=!1,a=[_g(n,Jt.LOAD,function(){o=!0,s||e()})];return n.src&&uP?(s=!0,n.decode().then(function(){r&&e()}).catch(function(l){r&&(o?e():t())})):a.push(_g(n,Jt.ERROR,t)),function(){r=!1,a.forEach(ii)}}function goe(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 UG(i,e){return e&&(i.src=e),i.src&&uP?new Promise((t,n)=>i.decode().then(()=>t(i)).catch(r=>i.complete&&i.width?t(i):n(r))):goe(i)}var rn={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function hP(i){return Math.pow(i,3)}function Hl(i){return 1-hP(1-i)}function kG(i){return 3*i*i-2*i*i*i}function GG(i){return i}var fP=class extends _d{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:hP(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()}},xg=fP;function Si(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 dP;function yx(){return dP||(dP=Si(1,1)),dP}function q0(i){let e=i.canvas;e.width=1,e.height=1,i.clearRect(0,0,1,1)}function pP(i,e){let t=e.parentNode;t&&t.replaceChild(i,e)}function zG(i){for(;i.lastChild;)i.lastChild.remove()}function VG(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 Tw(){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 AP=class extends xg{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_=_oe(),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_=BG(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};function _oe(){let i=Si(1,1);return i.fillStyle="rgba(0,0,0,0)",i.fillRect(0,0,1,1),i.canvas}var Ew=AP;var mP,H0=[];function qG(i,e,t,n,r){i.beginPath(),i.moveTo(0,0),i.lineTo(e,t),i.lineTo(n,r),i.closePath(),i.save(),i.clip(),i.fillRect(0,0,Math.max(e,n)+1,Math.max(t,r)),i.restore()}function gP(i,e){return Math.abs(i[e*4]-210)>2||Math.abs(i[e*4+3]-.75*255)>2}function xoe(){if(mP===void 0){let i=Si(6,6,H0);i.globalCompositeOperation="lighter",i.fillStyle="rgba(210, 0, 0, 0.75)",qG(i,4,5,4,0),qG(i,4,5,0,5);let e=i.getImageData(0,0,3,3).data;mP=gP(e,0)||gP(e,4)||gP(e,8),q0(i),H0.push(i.canvas)}return mP}function HG(i,e,t,n){let r=dg(t,e,i),s=tP(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||vc(l,r)){let c=tP(i,s,r)/s;isFinite(c)&&c>0&&(s/=c)}return s}function WG(i,e,t,n){let r=Ua(t),s=HG(i,e,r,n);return(!isFinite(s)||s<=0)&&sw(t,function(o){return s=HG(i,e,o,n),isFinite(s)&&s>0}),s}function jG(i,e,t,n,r,s,o,a,l,c,u,f,p,x){let v=Si(Math.round(t*i),Math.round(t*e),H0);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){rw(S,L.extent)});let T,P=t/n,R=(f?1:1+Math.pow(2,-24))/P;if(!p||l.length!==1||c!==0){if(T=Si(Math.round(jn(S)*P),Math.round(_r(S)*P),H0),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=Vl(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=X9(Ue);if(!mt)return;if(v.save(),v.beginPath(),xoe()||!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&&(q0(T),H0.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 yoe=[1,0,0,1,0,0],p5e=new Array(6);function Ys(){return yoe.slice(0)}function XG(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 co(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 Cw(i,e){let t=voe(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 voe(i){return i[0]*i[3]-i[1]*i[2]}var boe=[1e5,1e5,1e5,1e5,2,2];function $G(i){return"matrix("+i.join(", ")+")"}function Mw(i){return i.substring(7,i.length-1).split(",").map(parseFloat)}function YG(i,e){let t=Mw(i),n=Mw(e);for(let r=0;r<6;++r)if(Math.round((t[r]-n[r])*boe[r])!==0)return!1;return!0}var woe=10,ZG=.25,_P=class{constructor(e,t,n,r,s,o,a){this.sourceProj_=e,this.targetProj_=t;let l={},c=a?mG(R=>Rr(a,dg(R,this.targetProj_,this.sourceProj_))):k0(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=Vl(n),f=og(n),p=sg(n),x=rg(n),v=this.transformInv_(u),w=this.transformInv_(f),S=this.transformInv_(p),T=this.transformInv_(x),P=woe+(o?Math.max(0,Math.ceil(Math.log2(fx(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=k4([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=k4([e,t,n,r]);v=jn(S)/this.targetWorldWidth_>ZG||v}!x&&this.sourceProj_.isGlobal()&&f&&(v=f>ZG||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=(_u(s[0],p)+_u(a[0],p))/2-_u(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;D0(e,s[0]),D0(e,s[1]),D0(e,s[2])}),e}getTriangles(){return this.triangles_}},KG=_P;var xP=class extends xg{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?mu(x,v):x;if(fx(S)===0){this.state=rn.EMPTY;return}let T=e.getExtent();T&&(w?w=mu(w,T):w=T);let P=r.getResolution(this.wrappedTileCoord_[0]),R=WG(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 KG(e,n,S,w,R*C,P),this.triangulation_.getTriangles().length===0){this.state=rn.EMPTY;return}this.sourceZ_=t.getZForResolution(R);let L=this.triangulation_.calculateSourceExtent();if(w&&(e.canWrapX()?(L[1]=_i(L[1],w[1],w[3]),L[3]=_i(L[3],w[1],w[3])):L=mu(L,w)),!fx(L))this.state=rn.EMPTY;else{let D=0,F=0;e.canWrapX()&&(D=jn(T),F=Math.floor((L[0]-T[0])/D)),ow(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_=jG(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_&&(q0(this.canvas_.getContext("2d")),H0.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},Rw=xP;var Soe=/\{z\}/g,Toe=/\{x\}/g,Eoe=/\{y\}/g,Moe=/\{-y\}/g;function QG(i,e,t,n,r){return i.replace(Soe,e.toString()).replace(Toe,t.toString()).replace(Eoe,n.toString()).replace(Moe,function(){if(r===void 0)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(r-n).toString()})}function JG(i){let e=[],t=/\{([a-z])-([a-z])\}/.exec(i);if(t){let n=t[1].charCodeAt(0),r=t[2].charCodeAt(0),s;for(s=n;s<=r;++s)e.push(i.replace(t[0],String.fromCharCode(s)));return e}if(t=/\{(\d+)-(\d+)\}/.exec(i),t){let n=parseInt(t[2],10);for(let r=parseInt(t[1],10);r<=n;r++)e.push(i.replace(t[0],r.toString()));return e}return e.push(i),e}function Coe(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 QG(i,o,t[1],t[2],s)})}function ez(i,e){let t=i.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Coe(i[r],e);return Roe(n)}function Roe(i){return i.length===1?i[0]:(function(e,t,n){if(!e)return;let r=CG(e),s=_u(r,i.length);return i[s](e,t,n)})}var Rc={PROPERTYCHANGE:"propertychange"};var yg=class extends _d{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]=_g(this,e[s],t)}else n=_g(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)Poe(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)}};yg.prototype.on;yg.prototype.once;yg.prototype.un;function Poe(i){if(Array.isArray(i))for(let e=0,t=i.length;e<t;++e)ii(i[e]);else ii(i)}var Pw=yg;var Iw=class extends $s{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},yP=class extends Pw{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 Iw(n,e,t)),n=Rc.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new Iw(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],Sc(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},xs=yP;var vP=class extends xs{constructor(e){super(),this.projection=_s(e.projection),this.attributions_=tz(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_=tz(e),this.changed()}setState(e){this.state_=e,this.changed()}};function tz(i){return i?typeof i=="function"?i:(Array.isArray(i)||(i=[i]),e=>i):null}var Nw=vP;var bP=class extends Nw{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&&Hr(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:vw(e)}getTilePixelRatio(e){return this.tilePixelRatio_}getTilePixelSize(e,t,n){let r=this.getTileGridForProjection(n),s=this.getTilePixelRatio(t),o=Hr(r.getTileSize(e),this.tmpSize);return s==1?o:xG(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=IG(r,e,n)),RG(e,r)?e:null}clear(){}refresh(){this.clear(),super.refresh()}},Lw=class extends $s{constructor(e,t){super(e),this.tile=t}},nz=bP;var Dw={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};var wP=class i extends nz{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=Dw.TILELOADSTART):n in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[n],s=r==rn.ERROR?Dw.TILELOADERROR:r==rn.LOADED?Dw.TILELOADEND:void 0),s!=null&&this.dispatchEvent(new Lw(s,t))}setTileLoadFunction(e){this.tileLoadFunction=e,this.changed()}setTileUrlFunction(e,t){this.tileUrlFunction=e,typeof t<"u"?this.setKey(t):this.changed()}setUrl(e){let t=JG(e);this.urls=t,this.setUrls(t)}setUrls(e){this.urls=e;let t=e.join(`2+`);this.generateTileUrlFunction_?this.setTileUrlFunction(ez(e,this.tileGrid),t):this.setKey(t)}tileUrlFunction(e,t,n){}},iz=wP;var SP=class extends iz{constructor(e){super({attributions:e.attributions,cacheSize:e.cacheSize,projection:e.projection,state:e.state,tileGrid:e.tileGrid,tileLoadFunction:e.tileLoadFunction?e.tileLoadFunction:Ioe,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:Ew,this.tileGridForProjection={},this.reprojectionErrorThreshold_=e.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(e){return this.getProjection()&&e&&!fg(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||fg(t,e)))return this.tileGrid;let n=Ln(e);return n in this.tileGridForProjection||(this.tileGridForProjection[n]=vw(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||fg(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 Rw(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=mg(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 Ioe(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 rz=SP;var TP=class extends rz{constructor(e){e=e||{};let t=e.projection!==void 0?e.projection:"EPSG:3857",n=e.tileGrid!==void 0?e.tileGrid:NG({extent:bw(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_}},sz=TP;function Pc(){if(!U.map||!U.variant||U.settling)return;let i=U.engine?.getView();try{let e=oz();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(U4,JSON.stringify(e))}catch{}}function oz(){try{let i=JSON.parse(localStorage.getItem(U4)||"null");if(i&&i.games)return i}catch{}return{last:"",games:{}}}function vg(i){let e=oz(),t=i||e.last,n=t&&e.games[t];return n&&n.game&&n.map?n:null}function bg(){let[i,e]=decodeURIComponent(location.hash.replace(/^#\/?/,"")).split("/").map(t=>t.trim());return{game:i,map:e}}function az(){if(!U.game||!U.map)return;let i=`#${U.game.slug}/${U.map.slug}`;location.hash!==i&&history.replaceState(null,"",i)}var EP=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?Noe(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 Noe(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 xd=EP;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 Fw(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 lz(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 cz(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 uz=Ys(),Loe=[NaN,NaN],MP=class extends xs{constructor(){super(),this.extent_=Cr(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=ww((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,Loe,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]))&&N0(t),this.extentRevision_=this.getRevision()}return z9(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);co(uz,c[0],c[3],u,-u,0,0,0);let f=Ga(s,0,s.length,a,uz,o),p=k0(n,t);return p?p(f,f,a):f}:k0(n,t);return this.applyTransform(r),this}},hz=MP;var CP=class extends hz{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(e){return ig(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=fz(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){Yn()}setLayout(e,t,n){let r;if(e)r=fz(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=Doe(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();Fw(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();lz(r,0,r.length,s,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();cz(n,0,n.length,r,e,t,n),this.changed()}}};function Doe(i){let e;return i==2?e="XY":i==3?e="XYZ":i==4&&(e="XYZM"),e}function fz(i){let e;return i=="XY"?e=2:i=="XYZ"||i=="XYM"?e=3:i=="XYZM"&&(e=4),e}function dz(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 yu=CP;function pz(i,e,t,n){for(let r=0,s=t.length;r<s;++r)i[e++]=t[r];return e}function vx(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 RP(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=vx(i,e,t[o],n);r[s++]=l,e=l}return r.length=s,r}function Az(i,e,t,n,r){r=r||[];let s=0;for(let o=0,a=t.length;o<a;++o){let l=RP(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 PP=class i extends yu{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=bc(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 iw(this.flatCoordinates,e)}getType(){return"Point"}intersectsExtent(e){return hx(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=pz(this.flatCoordinates,0,e,this.stride),this.changed()}},ef=PP;function IP(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 NP(i,e,t,n){let r=0;for(let s=0,o=t.length;s<o;++s){let a=t[s];r+=IP(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+=NP(i,e,a,n),e=a[a.length-1]}return r}function gz(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]=Io(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 LP(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=bc(s,o,a,l);c>r&&(r=c),s=a,o=l}return r}function DP(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=LP(i,e,a,n,r),e=a}return r}function _z(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s){let a=t[s];r=DP(i,e,a,n,r),e=a[a.length-1]}return r}function FP(i,e,t,n,r,s,o,a,l,c,u){if(e==t)return c;let f,p;if(r===0){if(p=bc(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(gz(i,x-n,x,n,o,a,u),p=bc(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&&(gz(i,t-n,e,n,o,a,u),p=bc(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 OP(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=FP(i,e,x,n,r,s,o,a,l,c,u),e=x}return c}function xz(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=OP(i,e,x,n,r,s,o,a,l,c,u),e=x[x.length-1]}return c}function vu(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 wg(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++]=vu(i,e,l,n,r[s]),e=l}return r.length=s,r}function bx(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?[]:wg(i,e,l,n,r[s]),e=l[l.length-1]}return r.length=s,r}function wx(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=j9(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 yz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=wx(i,e,u,n,r,s,o),a.push(o),e=u}return o}function yd(i,e){return e*Math.round(i/e)}function Foe(i,e,t,n,r,s,o){if(e==t)return o;let a=yd(i[e],r),l=yd(i[e+1],r);e+=n,s[o++]=a,s[o++]=l;let c,u;do if(c=yd(i[e],r),u=yd(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=yd(i[e],r),p=yd(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 Sx(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l];o=Foe(i,e,u,n,r,s,o),a.push(o),e=u}return o}function vz(i,e,t,n,r,s,o,a){for(let l=0,c=t.length;l<c;++l){let u=t[l],f=[];o=Sx(i,e,u,n,r,s,o,f),a.push(f),e=u[u.length-1]}return o}var BP=class i extends yu{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<hd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(LP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),FP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return IP(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return vu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(e){let t=[];return t.length=wx(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,0),new i(t,"XY")}getType(){return"LinearRing"}intersectsExtent(e){return yw(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=vx(this.flatCoordinates,0,e,this.stride),this.changed()}},UP=BP;function Tx(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,_x(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 Ow(i,e,t,n,r){let s=[];for(let o=0,a=t.length;o<a;++o){let l=t[o];s=Tx(i,e,l,n,r,2*o,s),e=l[l.length-1]}return s}function bz(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 kP(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 GP(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=kP(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 wz(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!1;a.length&&(e=a[a.length-1])}return!0}function Bw(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=kP(i,e,a,n);(s===0?r&&l||!r&&!l:r&&!l||!r&&l)&&bz(i,e,a,n),e=a}return e}function zP(i,e,t,n,r){for(let s=0,o=t.length;s<o;++s)e=Bw(i,e,t[s],n,r);return e}function Sz(i,e){let t=[],n=0,r=0,s;for(let o=0,a=e.length;o<a;++o){let l=e[o],c=kP(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 Uw=class i extends yu{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?Cc(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<hd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(DP(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),OP(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return _x(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return NP(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e!==void 0?(t=this.getOrientedFlatCoordinates().slice(),Bw(t,0,this.ends_,this.stride,e)):t=this.flatCoordinates,wg(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=Ua(this.getExtent());this.flatInteriorPoint_=Tx(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new ef(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new UP(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 UP(t.slice(s,l),e);r.push(c),s=l}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;GP(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=Bw(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=Sx(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(e),t,0,n),new i(t,"XY",n)}getType(){return"Polygon"}intersectsExtent(e){return rP(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||(this.flatCoordinates=[]);let n=RP(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},bu=Uw;function VP(i){if(gu(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 Uw(s,"XY",[s.length])}function Tz(){let i=U.variant?.surface;return i?[i.x,-(i.y+i.height),i.x+i.width,-i.y]:Tu()}function Ez(i){return i.key.toLocaleLowerCase()==="g"?(i.preventDefault(),Mz(),U.gridEnabled?(we.gridInput.focus(),we.gridInput.select()):we.viewport.focus({preventScroll:!0}),!0):i.key===" "&&U.gridEnabled&&i.target!==we.subgridToggle?(i.preventDefault(),Ex(!U.subgridVisible),!0):i.key==="Escape"&&U.gridEnabled?(i.preventDefault(),qP(),!0):!1}function Mz(i=!U.gridEnabled){U.gridEnabled=i,i&&Ex(!0),Gw(),wu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()}function Ex(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"),Cz()}function Cz(){if(!U.gridEnabled){we.gridHint.textContent="G \xB7 grid off";return}we.gridHint.textContent=`G-${U.gridPrefix||"root"}`+(U.subgridVisible?"":" no subgrid")}function Mx(i){let e=W0(),t=[...i.toLocaleLowerCase()].filter(r=>zl.includes(r)).slice(0,e).join(""),n=t!==U.gridPrefix;U.gridPrefix=t,U.gridEnabled||(U.gridEnabled=!0),Gw(),wu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed(),n&&(Ic(),U.engine.getView().fit(Sg(),{size:U.engine.getSize(),padding:[52,52,52,52],maxZoom:Su(U.variant),duration:180}))}function qP(){if(U.gridEnabled){if(!U.gridPrefix){Mz(!1);return}Mx(U.gridPrefix.slice(0,-1))}}function Gw(){if(!U.sources||(U.sources.grid.clear(),U.sources.gridContext.clear(),we.gridNavigator.hidden=!U.gridEnabled,Cz(),!U.gridEnabled||!U.variant))return;let i=W0();if(we.gridInput.maxLength=i,we.gridInput.value=U.gridPrefix,we.gridBack.title=U.gridPrefix?"Back one geohash level":"Close geohash grid",Boe(),U.gridPrefix.length>=i){kw(U.gridPrefix,Sg(),"leaf");return}U.gridPrefix&&kw(U.gridPrefix,Sg(),"scope");for(let e of zl){let t=U.gridPrefix+e;kw(t,HP(t),"child")}}function Boe(){for(let i=0;i<U.gridPrefix.length;i++){let e=U.gridPrefix.slice(0,i),t=U.gridPrefix.slice(0,i+1);for(let n of zl){let r=e+n;r!==t&&kw(r,HP(r),"neighbor",U.gridPrefix.length-i)}}}function kw(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 xd({geometry:new bu([[[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+zl.indexOf(i[i.length-1]):zl.indexOf(i[i.length-1])});(t==="neighbor"?U.sources.gridContext:U.sources.grid).addFeature(c)}function Sg(){return HP(U.gridPrefix)}function HP(i){let e=[...Tz()],t=!0;for(let n of i){let r=zl.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 W0(){return 3}function Rz(i,e=W0()){let t=[...Tz()],[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+=zl[l]}return o}function Tg(i){if(!U.gridEnabled||!U.gridPrefix)return!1;let e=Sg(),[t,n]=i.coordinate;return t>=e[0]&&t<=e[2]&&n>=e[1]&&n<=e[3]}function j0(){return k9[U.map?.iconOutset==="dark"?"dark":"light"]}function Uoe(i){let e=U.map?.iconOutset==="dark",t=Goe(i);return(e?t>.3:t<.88)?i:koe(i,e?.74:.42)}function koe(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 Goe(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 zw(i){let e=Math.abs(Number(i)||0);return tg[(Math.imul(e,2654435761)>>>0)%tg.length]}function tf(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 Eg(i,e){i.style.setProperty("--pin-color",X0(e))}function X0(i){return Uoe(i.color||zw(i.id))}function Mg(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("${WP(e.iconAsset)}")`),i.classList.add("has-source-icon")}function WP(i){let e=i.split("/").map(t=>encodeURIComponent(t)).join("/");return`${U.game.base}/icons/${e}`}function Nc(i){return i.split(/\s+/).slice(0,2).map(e=>e[0]||"").join("")}function Pz(i){return Math.imul(Number(i)||0,2654435761)>>>0}function Iz(i){return String(i||"").replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/[*_`>#]/g,"").replace(/\r/g,"").replace(/\n{3,}/g,`3+4+`).trim()}function Lc(i){return new Intl.NumberFormat().format(i)}function Lo(i,e,t){return Math.min(t,Math.max(e,i))}function Vw(i){return i instanceof HTMLElement&&(i.matches("input, textarea, select")||i.isContentEditable)}var zoe=100;function vd(){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,zoe),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),Eg(r,n.category);let s=document.createElement("span");s.className="result-dot",Mg(s,n.category,Nc(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 ${Lc(i.length)} \u2014 search or filter to narrow the list.`,t.append(n)}we.searchResults.replaceChildren(t),qoe(i.length),Voe()}var Nz=28;function Voe(){let i=U.selectedPin?.location.title||"",e=i.length>Nz?`${i.slice(0,Nz-1).trimEnd()}\u2026`:i;we.dockRailName.textContent=e?` \xB7 ${e}`:"",we.dockRailName.hidden=!e}function qoe(i){we.dockCount.textContent=`${Lc(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 qw(){!U.dockFolded||U.dockDismissed||Hw(!1)}function jP(i){U.dockDismissed=i,Hw(i)}function Hw(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&&Pc()}function XP(i){U.hiddenCategories.delete(i.category.id),Rx(),Wl(),bd(),Cx(i,!0)}function Cx(i,e=!1){U.selectedPin=i,document.dispatchEvent(new Event("atlas:selection")),wu(),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,Woe(i),we.detailID.textContent=String(i.location.id),we.detailCoordinates.textContent=`${i.location.lat.toFixed(6)}, ${i.location.lng.toFixed(6)}`;let t=Rz(i.coordinate);we.detailCell.textContent=t,we.detailCellField.hidden=!t;let n=Hoe(i);if(we.detailSource.textContent=n,we.detailSourceField.hidden=!n,Eg(we.detailDot,i.category),Mg(we.detailDot,i.category,Nc(i.category.title)),we.detail.hidden=!1,qw(),vd(),e){let r=U.engine.getView();r.animate({center:i.coordinate,zoom:Math.min(Su(U.variant),Math.max(r.getZoom()||0,4)),duration:220})}}function Hoe(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 Woe(i){let e=await Lz();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=Iz(t.d)||"No description is included in the archive.",joe(i)}function joe(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 Ic(){let i=U.selectedPin!==null;U.selectedPin=null,document.dispatchEvent(new Event("atlas:selection")),U.sources&&(wu(),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&&vd()}function Eu(i){let e=i.attrs?.["atlas.render.as"];return e||(i.displayType==="text"?"text":"pin")}function Dz(i){return i?.attrs?.["atlas.geometry.surface"]||"plane"}function $0(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],$P;function Xoe(){return $P||($P=Si(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),$P}var $oe=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Yoe=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Zoe=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,Koe=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function Ww(i,e){return i.endsWith("%")?Number(i.substring(0,i.length-1))/e:Number(i)}function Ix(i){throw new Error('failed to parse "'+i+'" as color')}function Fz(i){if(i.toLowerCase().startsWith("rgb")){let s=i.match(Yoe)||i.match($oe)||i.match(Zoe);if(s){let o=s[4],a=100/255;return[_i(Ww(s[1],a)+.5|0,0,255),_i(Ww(s[2],a)+.5|0,0,255),_i(Ww(s[3],a)+.5|0,0,255),o!==void 0?_i(Ww(o,100),0,1):1]}Ix(i)}if(i.startsWith("#")){if(Koe.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}Ix(i)}let e=Xoe();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&&Ix(i));let n=e.fillStyle;if(n.startsWith("#")||n.startsWith("rgba"))return Fz(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]=F0(r[3]/255,3),r}function Oz(i){return typeof i=="string"?i:Lx(i)}var Qoe=1024,Px={},YP=0;function Bz(i){if(i.length===4)return i;let e=i.slice();return e[3]=1,e}function ZP(i){return i>.0031308?Math.pow(i,1/2.4)*269.025-14.025:i*3294.6}function KP(i){return i>.2068965?Math.pow(i,3):(i-4/29)*(108/841)}function QP(i){return i>10.314724?Math.pow((i+14.025)/269.025,2.4):i/3294.6}function JP(i){return i>.0088564?Math.pow(i,1/3):i/(108/841)+4/29}function eI(i){let e=QP(i[0]),t=QP(i[1]),n=QP(i[2]),r=JP(e*.222488403+t*.716873169+n*.06060791),s=500*(JP(e*.452247074+t*.399439023+n*.148375274)-r),o=200*(r-JP(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 Uz(i){let e=(i[0]+16)/116,t=i[1],n=i[2]*Math.PI/180,r=KP(e),s=KP(e+t/500*Math.cos(n)),o=KP(e-t/200*Math.sin(n)),a=ZP(s*3.021973625-r*1.617392459-o*.404875592),l=ZP(s*-.943766287+r*1.916279586+o*.027607165),c=ZP(s*.069407491-r*.22898585+o*1.159737864);return[_i(a+.5|0,0,255),_i(l+.5|0,0,255),_i(c+.5|0,0,255),i[3]]}function Nx(i){if(i==="none")return jw;if(Px.hasOwnProperty(i))return Px[i];if(YP>=Qoe){let t=0;for(let n in Px)(t++&3)===0&&(delete Px[n],--YP)}let e=Fz(i);e.length!==4&&Ix(i);for(let t of e)isNaN(t)&&Ix(i);return Px[i]=e,++YP,e}function jl(i){return Array.isArray(i)?i:Nx(i)}function Lx(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 nI=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=tI(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=tI(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let s=tI(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]=yx().createPattern(n.getImage(1),"repeat")}):this.patternCache_[s]=yx().createPattern(n.getImage(1),"repeat")),o||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function tI(i,e){let t=e?jl(e):"null";return i+":"+t}var Do=new nI;var Dx=null,Xw=class extends _d{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){Dx||(Dx=Si(1,1,void 0,{willReadFrequently:!0})),Dx.drawImage(this.image_,0,0);try{Dx.getImageData(0,0,1,1),this.tainted_=!1}catch{Dx=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(Jt.CHANGE)}handleImageError_(){this.imageState_=Mn.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Mn.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],n=Si(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Mn.IDLE){this.image_||this.initializeImage_(),this.imageState_=Mn.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&UG(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==Mn.LOADED)return;let t=this.image_,n=Si(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation="multiply",n.fillStyle=Oz(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 wd(i,e,t,n,r,s){let o=e===void 0?void 0:Do.get(e,r);return o||(o=new Xw(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=Xw;function za(i){return i?Array.isArray(i)?Lx(i):typeof i=="object"&&"src"in i?Joe(i):i:null}function Joe(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=Si(i.size[0],i.size[1]);return r.drawImage(n.getImage(1),i.offset[0],i.offset[1],i.size[0],i.size[1],0,0,i.size[0],i.size[1]),wd(r.canvas,e,void 0,Mn.LOADED,i.color,!0),Do.getPattern(e,i.color)}var Fx="ol-hidden";var Sd="ol-unselectable";var Cg="ol-control",iI="ol-collapsed",eae=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"),Gz=["style","variant","weight","size","lineHeight","family"],$w={normal:400,bold:700},Yw=function(i){let e=i.match(eae);if(!e)return null;let t={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let n=0,r=Gz.length;n<r;++n){let s=e[n+1];s!==void 0&&(t[Gz[n]]=typeof s=="string"?s.trim():s)}return isNaN(Number(t.weight))&&t.weight in $w&&(t.weight=$w[t.weight]),t.families=t.family.split(/,\s?/).map(n=>n.trim().replace(/^['"]|['"]$/g,"")),t};var Zw="10px sans-serif",Os="#000",Mu="round",Va=[],qa=0,Cu="round",nf=10,Vz=0,Fo="#000",Td="center",Z0="middle",rf=[0,0,0,0],sf=1,Y0=new xs,Ox=null,zz,rI={},tae=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function nae(i,e,t){return`${i} ${e} 16px "${t}"`}var qz=(function(){let e,t;async function n(s){await t.ready;let o=Yw(s),a=o.families[0].toLowerCase(),l=o.weight,c=[];return t.forEach(f=>{let p=f.family.replace(/^['"]|['"]$/g,"").toLowerCase(),x=$w[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=Y0.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)?(xu(rI),Y0.set(c,100)):(u+=10,Y0.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=Yw(s);if(!o)return;let a=o.families,l=!1;for(let c of a){if(tae.has(c))continue;let u=nae(o.style,o.weight,c);Y0.get(u)===void 0&&(Y0.set(u,0,!0),l=!0)}l&&(clearTimeout(e),e=setTimeout(r,100))}})(),iae=(function(){let i;return function(e){let t=rI[e];if(t==null){if(Fs){let n=Yw(e),r=Hz(e,"\u017Dg");t=(isNaN(Number(n.lineHeight))?1.2:Number(n.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else i||(i=document.createElement("div"),i.innerHTML="M",i.style.minHeight="0",i.style.maxHeight="none",i.style.height="auto",i.style.padding="0",i.style.border="none",i.style.position="absolute",i.style.display="block",i.style.left="-99999px"),i.style.font=e,document.body.appendChild(i),t=i.offsetHeight,document.body.removeChild(i);rI[e]=t}return t}})();function Hz(i,e){return Ox||(Ox=Si(1,1)),i!=zz&&(Ox.font=i,zz=Ox.font),Ox.measureText(e)}function Wz(i,e){return Hz(i,e).width}function sI(i,e,t){if(e in t)return t[e];let n=e.split(`5+`).reduce((r,s)=>Math.max(r,Wz(i,s)),0);return t[e]=n,n}function jz(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=Wz(p,f);t.push(x),o+=x;let v=iae(p);n.push(v),l=Math.max(l,v)}return{width:s,height:a,widths:t,heights:n,lineWidths:r}}function Xz(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]),rae(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 rae(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 oI=class i{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=Hr(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_=Hr(e)}listenImageChange(e){Yn()}load(){Yn()}unlistenImageChange(e){Yn()}ready(){return Promise.resolve()}},Kw=oI;var aI=class i extends Kw{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=Si(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=Mu,t=Cu,n=0,r=null,s=0,o,a=0;this.stroke_&&(o=za(this.stroke_.getColor()??Fo),a=this.stroke_.getWidth()??sf,r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??Cu,e=this.stroke_.getLineCap()??Mu,n=this.stroke_.getMiterLimit()??nf);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=Os),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=jl(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Si(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{let r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);let s=this.angle_-Math.PI/2,o=2*Math.PI/t;for(let a=0;a<t;a++){let l=s+a*o,c=a%2===0?n:r;e.lineTo(c*Math.cos(l),c*Math.sin(l))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=Os,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()}},Qw=aI;var lI=class i extends Qw{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}},Jw=lI;var cI=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=wd(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:jl(e).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}},Wr=cI;function $z(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 uI=class i extends Kw{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?jl(e.color):null,this.iconImage_=wd(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($z(x[0],x[1],e.width,e.height))};this.listenImageChange(p);return}}c!==void 0&&this.setScale($z(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?jl(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_=wd(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_=wd(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()}},K0=uI;var hI=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}},Zs=hI;var eS=class i{constructor(e){e=e||{},this.geometry_=null,this.geometryFunction_=Yz,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_=Yz,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function Zz(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 fI=null;function dI(i,e){if(!fI){let t=new Wr({color:"rgba(255,255,255,0.4)"}),n=new Zs({color:"#3399CC",width:1.25});fI=[new eS({image:new Jw({fill:t,stroke:n,radius:5}),fill:t,stroke:n})]}return fI}function Yz(i){return i.getGeometry()}var Bs=eS;var sae="#333",pI=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_=Hr(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 Wr({color:sae}),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 Wr?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_=Hr(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}},of=pI;function Xl(i,e){return(i.get("priority")||0)-(e.get("priority")||0)}function Jz(i){let e=i.get("pin");return!e||$l(e)||e.insideHighlightedZone||Rg(e)?null:AI(e,!1)}function eV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||$l(e)||Rg(e)?null:AI(e,!1)}function tV(i){let e=i.get("pin");return!e||$l(e)||!U.labelsHeld?null:oV(e)}function nV(i){let e=i.get("pin");if(!e||$l(e)||e.insideHighlightedZone||Rg(e)||kx())return null;if(U.labelsHeld)return Bx(e,!1);let t=U.fitZoom+Math.log2(pV(e.category));return(U.engine.getView().getZoom()||0)<t?null:Bx(e,!1)}function iV(i){let e=i.get("pin");return!e||$l(e)||e.insideHighlightedZone||Rg(e)||!kx()?null:Bx(e,!1)}function rV(i){let e=i.get("pin");return!e||!U.highlightedZones.size||!e.insideHighlightedZone||$l(e)||Rg(e)?null:Bx(e,!1)}function sV(i){let e=i.get("pin");if(!e||$l(e))return null;if(Eu(e.category)==="text")return Bx(e,e===U.selectedPin);let t=AI(e,e===U.selectedPin);return e===U.hoveredPin||e===U.selectedPin?[t,oV(e)]:t}function AI(i,e){let t=`marker:${i.category.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let n=X0(i.category),r=e?2e7:i.priority,s=U.markerIcons.get(Ux(i.category)),o;return s?o=new Bs({image:new K0({src:s,width:e?36:31,height:e?36:31}),zIndex:r}):o=new Bs({text:new of({text:Nc(i.category.title),font:`900 ${e?15:13}px Inter, sans-serif`,fill:new Wr({color:n}),stroke:new Zs({color:j0(),width:e?4:3})}),zIndex:r}),U.styleCache.set(t,o),o}function oV(i){let e=`marker-label:${i.location.id}`;if(U.styleCache.has(e))return U.styleCache.get(e);let t=new Bs({text:new of({text:i.location.title,offsetY:21,font:'700 10px "Arial Narrow", "Roboto Condensed", sans-serif',fill:new Wr({color:"#f2ece0"}),stroke:new Zs({color:"rgba(0,0,0,0.98)",width:3}),backgroundFill:new Wr({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 aV(i){if(!i.iconAsset)return;let e=Ux(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=X0(i),o=document.createElement("canvas");o.width=64,o.height=64;let a=o.getContext("2d");a.imageSmoothingEnabled=!i.iconPicture,a.drawImage(t,6,6,52,52),i.iconPicture||(a.globalCompositeOperation="source-in",a.fillStyle=s,a.fillRect(0,0,64,64));let l=document.createElement("canvas");l.width=64,l.height=64;let c=l.getContext("2d");c.drawImage(t,6,6,52,52),c.globalCompositeOperation="source-in",c.fillStyle=j0(),c.fillRect(0,0,64,64);for(let u=-3;u<=3;u++)for(let f=-3;f<=3;f++)f*f+u*u<=10&&r.drawImage(l,f,u);r.drawImage(o,0,0),U.markerIcons.set(e,n.toDataURL("image/png")),oae(),U.layers.pins.changed(),U.layers.zonePins.changed(),U.layers.priority.changed()},t.onerror=()=>U.markerIcons.set(e,!1),t.src=WP(i.iconAsset)}function oae(){for(let i of U.styleCache.keys())i.startsWith("marker:")&&U.styleCache.delete(i)}function Ux(i){return`${i.iconAsset||""}:${X0(i)}:${U.map?.iconOutset||"light"}`}function Bx(i,e){let t=`text:${i.location.id}:${e?1:0}`;if(U.styleCache.has(t))return U.styleCache.get(t);let r=[new Bs({text:new of({text:i.location.title,font:`${e?"900":"800"} 14px "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new Wr({color:e?"#7fd0ea":"#f2ece0"}),stroke:new Zs({color:"rgba(0,0,0,0.95)",width:4}),backgroundFill:new Wr({color:e?"rgba(13,16,23,0.9)":"rgba(10,12,17,0.58)"}),backgroundStroke:e?new Zs({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 mI(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=aae(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=tg[Math.max(0,zl.indexOf(t.hash[t.hash.length-1]))%tg.length],v=new Bs({fill:r?void 0:new Wr({color:s?`rgba(5, 8, 16, ${Math.min(.52,.3+t.contextDistance*.06)})`:tf(x,n?.14:.055)}),stroke:new Zs({color:n||r?"#ffffff":tf(x,s?.44:.82),width:n?2.5:r?f?1.8:2.5:s?1:1.4}),text:u&&!f?new of({text:t.hash,font:l,fill:new Wr({color:n||r?"#ffffff":s?tf(x,.72):x}),stroke:new Zs({color:"rgba(0,0,0,0.96)",width:4}),backgroundFill:new Wr({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 aae(i,e,t,n,r){if(!r)return!0;let s=lae(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 Kz=document.createElement("canvas").getContext("2d"),Qz=new Map;function lae(i,e){let t=`${e}|${i}`,n=Qz.get(t);return n===void 0&&(Kz.font=e,n=Kz.measureText(i).width,Qz.set(t,n)),n}var cae=new Bs({fill:new Wr({color:"rgba(5, 8, 16, 0.62)"})});function lV(){return U.zonesVisible?cae:null}function cV(i){if(!U.zonesVisible)return null;let e=i.get("zone"),t=i.get("child"),n=U.highlightedZones.has(e.id),r=dV(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 Bs({stroke:new Zs({color:tf(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 Bs({fill:new Wr({color:tf(o,t?.035:.07)}),stroke:new Zs({color:tf(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 Bs({stroke:new Zs({color:"rgba(255,255,255,0.94)",width:5}),zIndex:9e3}),new Bs({fill:new Wr({color:tf(o,.22)}),stroke:new Zs({color:o,width:2.6}),zIndex:9001})];return U.styleCache.set(s,l),l}function uV(i){if(!U.zonesVisible||kx())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:fV(i)}function hV(i){return!U.zonesVisible||!kx()?null:fV(i)}function fV(i){let e=i.get("child"),t=i.get("zone"),n=U.highlightedZones.has(t.id),r=dV(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 Bs({text:new of({text:t.title.toLocaleUpperCase(),font:`${e?"700 12px":"800 14px"} "Arial Narrow", "Roboto Condensed", sans-serif`,fill:new Wr({color:n?"#10131a":r?"rgba(196,191,177,0.56)":e?"#c8c2b4":"#f2ece0"}),stroke:new Zs({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 Wr({color:n?o:r?"rgba(8,11,18,0.84)":"rgba(13,16,23,0.72)"}),backgroundStroke:new Zs({color:n?"#ffffff":tf(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 dV(i){if(!U.highlightedZones.size||U.highlightedZones.has(i))return!1;for(let e of U.highlightedZones)if(uae(i,e))return!1;return!0}function uae(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 gI=class i extends yu{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){Cc(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<hd(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=bc(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 vu(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new ef(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 ef(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(hx(e,o,a))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=vx(this.flatCoordinates,0,e,this.stride),this.changed()}},AV=gI;function tS(i,e,t,n){let r=[],s=Cr();for(let o=0,a=t.length;o<a;++o){let l=t[o];s=ig(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 _I=class i extends yu{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;Cc(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;Cc(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<hd(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(_z(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),xz(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return TG(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(),zP(t,0,this.endss_,this.stride,e)):t=this.flatCoordinates,bx(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=tS(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Ow(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new AV(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;wz(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=zP(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(e){let t=[],n=[];return t.length=vz(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 bu(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 bu(t.slice(s,c),e,l);r.push(u),s=c}return r}getType(){return"MultiPolygon"}intersectsExtent(e){return MG(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||(this.flatCoordinates=[]);let n=Az(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()}},mV=_I;function xI(){let i=(U.map.zones||[]).filter(bI);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,nS(!0),we.zoneIndex.hidden=i.length===0,we.zoneCount.textContent=Lc(i.length);for(let e of i){let t=Cr(),n=[],r=!1;for(let l of e.features||[]){let c=dae(l);c&&(r=!0,n.push(c),rw(t,c.getExtent()),U.sources.zones.addFeature(new xd({geometry:c,zone:e,color:zw(e.id),child:e.parentRegionId!=null})))}if(!r)continue;let s=zw(e.id),o=e.center?Pg(e.center.lat,e.center.lng):Ua(t),a=Math.max(t[2]-t[0],t[3]-t[1]);U.sources.zoneTitles.addFeature(new xd({geometry:new ef(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,_V(),hae()}function _V(){if(U.sources.zoneScrim.clear(),!U.highlightedZones.size)return;let[i,e,t,n]=U.projection.getExtent(),r=[gV([[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(gV(c.getCoordinates(),u>0))})}U.sources.zoneScrim.addFeature(new xd({geometry:new bu(r)}))}function gV(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 hae(){let i=document.createDocumentFragment();for(let{zone:e,depth:t}of fae()){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 fae(){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 nS(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 xV(i){let e=U.zoneRecords.get(i);e&&(U.focusedZoneID=i,vV(),Ic(),U.engine.getView().fit(e.extent,{size:U.engine.getSize(),padding:[54,54,54,54],maxZoom:Su(U.variant),duration:220}),we.sidebar.classList.remove("is-open"),we.mobileLegend.setAttribute("aria-expanded","false"))}function yV(i){U.zoneRecords.has(i)&&(U.highlightedZones.has(i)?U.highlightedZones.delete(i):(U.highlightedZones.add(i),nS(!0)),U.hoveredPin=null,yI(),vI(),vV(),_V(),U.layers.zones.changed(),U.layers.zoneTitles.changed(),U.layers.zoneTitleDetail.changed())}function vV(){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 dae(i){if(!i?.coordinates)return null;let e=([t,n])=>Pg(n,t);return i.type==="Polygon"?new bu(i.coordinates.map(t=>t.map(e))):i.type==="MultiPolygon"?new mV(i.coordinates.map(t=>t.map(n=>n.map(e)))):null}function Pg(i,e){let t=pae(),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 pae(){let i=U.game.tileGrid,e=U.map?.grid;return e?{...i,...e}:i}function bV(){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){Eu(e)!=="text"&&aV(e);for(let t of e.locations){let n={location:t,category:e,group:i,coordinate:Pg(t.lat,t.lng),filteredHidden:!1,priority:_ae(e,t),feature:null};n.feature=new xd({geometry:new ef(n.coordinate),pin:n,priority:n.priority}),U.pins.push(n),U.pinByID.set(t.id,n),Eu(e)==="text"?U.sources.text.addFeature(n.feature):U.sources.pins.addFeature(n.feature)}}Wl()}function Wl(){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)}yI(),vI(),U.selectedPin?.filteredHidden&&Ic(),vd(),document.dispatchEvent(new Event("atlas:filters"))}function yI(){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=>Aae(n,e.coordinate)))}function Aae(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 vI(){U.eligibleLocations=U.pins.filter(i=>!$l(i)).length,wu(),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(),Q0()}function wu(){U.sources.priority.clear();for(let i of U.pins){if($l(i))continue;let e=!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search);(i===U.selectedPin||i===U.hoveredPin||e||Tg(i))&&U.sources.priority.addFeature(i.feature)}}function Ig(i){U.hoveredPin!==i&&(U.hoveredPin=i,U.sources&&(wu(),U.layers.pins.changed(),U.layers.priority.changed()))}function iS(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 Rg(i){return i===U.selectedPin||i===U.hoveredPin||Tg(i)||!!U.search&&i.location.title.toLocaleLowerCase().includes(U.search)}function $l(i){return i.filteredHidden||mae(i)||gae(i)||!bI(i.location)}function bI(i){let e=U.variant?.shard;return!e||!i.shard||i.shard===e}function mae(i){return!U.highlightedZones.size||i.insideHighlightedZone||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function gae(i){return!U.gridEnabled||!U.gridPrefix||Tg(i)||i===U.selectedPin?!1:!(U.search&&i.location.title.toLocaleLowerCase().includes(U.search))}function _ae(i,e){return Math.max(0,1e6-Math.min(i.locations.length,999)*1e3)+Pz(e.id)%1e3}function pV(i){return i.locations.length>200?4:i.locations.length>75?2.5:1}function kx(){return(U.engine?.getView().getZoom()||0)>=(U.variant?.maxZoom||0)-.05}function wV(i){let e=[],t=[];for(let n of i){let r=[];for(let s of n.categories)(Eu(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 SV(){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(xae(e.key,e.title,n));let r=document.createElement("div");r.className="category-toggles";for(let s of e.categories)r.append(yae(s));t.append(r),i.append(t)}we.legend.replaceChildren(i),rS(),bd()}function xae(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=Lc(t),r.append(s,o,a);let l=TV(`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 TV(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 yae(i){let e=Eu(i)==="text",t=document.createElement("label");t.className="category-row",Eg(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",Mg(r,i,Nc(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=Lc(i.locations.length);let a=TV(`Show only ${i.title}`);return a.dataset.onlyCategory=String(i.id),t.append(n,r,s,a,o),t}function wI(i){if(U.collapsedSections.clear(),i)for(let e of we.layers.querySelectorAll("[data-section]"))U.collapsedSections.add(e.dataset.section);rS()}function rS(){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)}Pc()}function Gx(i){if(U.hiddenCategories.clear(),!i)for(let e of U.map.groups)for(let t of e.categories)U.hiddenCategories.add(t.id);Rx(),Wl(),vd(),bd()}function Rx(){for(let i of document.querySelectorAll("[data-category]"))i.checked=!U.hiddenCategories.has(Number(i.dataset.category))}function EV(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);Rx(),Wl(),bd()}function MV(i){if(U.map){if(vae(i)){Gx(!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)}Rx(),Wl(),vd(),bd()}}function vae(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 bd(){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(),Pc()}}async function CV(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 wae(r,s),{...i,grid:n.grid,variants:n.variants,groups:n.groups,zones:n.zones||[],attrs:n.attrs||{},merged:n.merged||[],sections:wV(n.groups)}}function wae(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 Lz(){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 sS=null;function J0(){return sS||(sS=Sae().finally(()=>{sS=null})),sS}async function Sae(){let i=await fetch("/data/catalog.json");if(!i.ok)return;let e=U.game;if(U.catalog=await i.json(),I0(we.game,U.catalog.games,"title"),SI(),!U.catalog.games.length)return;let t=e&&U.catalog.games.find(n=>n.slug===e.slug);if(!t){let n=bg();await af(n.game||vg()?.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 af(t.slug,U.map?.slug);return}U.game=t,we.game.value=t.slug}function SI(){let i=!U.catalog?.games?.length;we.emptyState.hidden=!i,U.catalog?.bundlesDir&&(we.emptyPath.textContent=U.catalog.bundlesDir)}async function TI(){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 J0();let t=e.imported?.[0];t&&U.catalog.games.some(n=>n.slug===t)&&await af(t)}finally{for(let i of[we.emptyOpen,we.addBundles])i.disabled=!1}}var Ks={ADD:"add",REMOVE:"remove"};var RV={LENGTH:"length"},Ng=class extends $s{constructor(e,t,n){super(e),this.element=t,this.index=n}},EI=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(RV.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 Ng(Ks.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 Ng(Ks.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 Ng(Ks.REMOVE,r,e)),this.dispatchEvent(new Ng(Ks.ADD,t,e))}updateLength_(){this.set(RV.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")}},uo=EI;var MI=class extends $s{constructor(e,t,n){super(e),this.map=t,this.frameState=n!==void 0?n:null}},Ed=MI;var CI=class extends Ed{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()}},Ru=CI;var nr={SINGLECLICK:"singleclick",CLICK:Jt.CLICK,DBLCLICK:Jt.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var zx={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};var RI=class extends _d{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,zx.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=kn(n,zx.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_,Sw?{passive:!1}:!1)}emulateClick_(e){let t=new Ru(nr.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_!==void 0?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new Ru(nr.DBLCLICK,this.map_,e),this.dispatchEvent(t)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let n=new Ru(nr.SINGLECLICK,this.map_,e);this.dispatchEvent(n)},250)}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==nr.POINTERUP||t.type==nr.POINTERCANCEL){delete this.trackedTouches_[n];for(let r in this.trackedTouches_)if(this.trackedTouches_[r].target!==t.target){delete this.trackedTouches_[r];break}}else(t.type==nr.POINTERDOWN||t.type==nr.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new Ru(nr.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(ii),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new Ru(nr.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let n=this.map_.getOwnerDocument();this.dragListenerKeys_.push(kn(n,nr.POINTERMOVE,this.handlePointerMove_,this),kn(n,nr.POINTERUP,this.handlePointerUp_,this),kn(this.element_,nr.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==n&&this.dragListenerKeys_.push(kn(this.element_.getRootNode(),nr.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new Ru(nr.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new Ru(nr.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!="boolean"||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&(ii(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(Jt.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(ii(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(ii),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},PV=RI;var Pu={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"};var ho={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"};var Vx=1/0,PI=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,xu(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!=Vx?(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==Vx?delete this.queuedElements_[this.keyFunction_(o)]:(n[r]=l,t[r++]=o);t.length=r,n.length=r,this.heapify_()}},IV=PI;var II=class extends IV{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())}}},NV=II;function LV(i,e,t,n,r){if(!i||!(t in i.wantedTiles))return Vx;if(!i.wantedTiles[t][e.getKey()])return Vx;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 Us={ANIMATING:0,INTERACTING:1};var Yl={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function NI(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=_i(n[0],p,x),T=_i(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 DV(i){return i}function LI(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 DI(i,e,t){let n=Math.min(i,e),r=50;return n*=Math.log(1+r*Math.max(0,i/e-1))/r+1,t&&(n=Math.max(n,t),n/=Math.log(1+r*Math.max(0,t/i-1))/r+1),_i(n,t/2,e*2)}function FV(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?LI(l,t,o,n):l;if(a)return e?DI(r,u,c):_i(r,c,u);let f=Math.min(u,r),p=Math.floor(pg(i,f,s));return i[p]>u&&p<i.length-1?i[p+1]:i[p]}})}function OV(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?LI(e,r,l,s):e;if(c)return n?DI(o,u,t):_i(o,t,u);let f=1e-9,p=Math.ceil(Math.log(e/u)/Math.log(i)-f),x=-a*(.5-f)+.5,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 _i(T,t,u)}})}function FI(i,e,t,n,r){return t=t!==void 0?t:!0,(function(s,o,a,l){if(s!==void 0){let c=n?LI(i,n,a,r):i;return!t||!l?_i(s,e,c):DI(s,c,e)}})}function Lg(i){if(i!==void 0)return 0}function OI(i){if(i!==void 0)return i}function BV(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 UV(i){let e=i===void 0?wc(5):i;return(function(t,n){return n||t===void 0?t:Math.abs(t)<=e?0:t})}var BI=0,kI=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_=gw(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&&AG(),e.center&&(e.center=Ec(e.center,this.projection_)),e.extent&&(e.extent=Mc(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let a in Yl)delete t[a];this.setProperties(t,!0);let n=Eae(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=Tae(e),s=n.constraint,o=Mae(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=Ec(r.center,this.getProjection())),r.anchor&&(r=Object.assign({},r),r.anchor=Ec(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&&oS(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||kG,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=_u(u.rotation-l+Math.PI,2*Math.PI)-Math.PI;f.targetRotation=l+p,l=f.targetRotation}Cae(f)?f.complete=!0:s+=f.duration,c.push(f)}this.animations_.push(c),this.setHint(Us.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[Us.ANIMATING]>0}getInteracting(){return this.hints_[Us.INTERACTING]>0}cancelAnimations(){this.setHint(Us.ANIMATING,-this.hints_[Us.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let r=this.animations_[t];if(r[0].callback&&oS(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?_u(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(Us.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let o=r[0].callback;o&&oS(o,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],ag(n,e-this.getRotation()),$9(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&&gx(e,this.getProjection())}getCenterInternal(){return this.get(Yl.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 pd(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"),dx(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(Yl.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Mc(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(Yl.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=UI(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=pg(this.resolutions_,e,1);t=s,n=this.resolutions_[s],s==this.resolutions_.length-1?r=2:r=n/this.resolutions_[s+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=_i(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/Math.pow(n,_i(e-t,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,e-this.minZoom_)}fit(e,t){let n;if(Vn(Array.isArray(e)||typeof e.getSimplifiedGeometry=="function","Invalid extent or geometry provided as `geometry`"),Array.isArray(e)){Vn(!gu(e),"Cannot fit empty extent provided as `geometry`");let r=Mc(e,this.getProjection());n=VP(r)}else if(e.getType()==="Circle"){let r=Mc(e.getExtent(),this.getProjection());n=VP(r),n.rotate(this.getRotation(),Ua(r))}else{let r=G0();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:Jh;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),oS(S,!0))}centerOn(e,t,n){this.centerOnInternal(Ec(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(UI(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=UI(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=gx(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&&Ec(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=Ec(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&&Ec(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(Yl.ROTATION)!==r&&this.set(Yl.ROTATION,r),this.get(Yl.RESOLUTION)!==o&&(this.set(Yl.RESOLUTION,o),this.set("zoom",this.getZoom(),!0)),(!a||!this.get(Yl.CENTER)||!O0(this.get(Yl.CENTER),a))&&this.set(Yl.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()||!O0(this.getCenterInternal(),l))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:l,resolution:a,duration:e,easing:Hl,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Us.INTERACTING,1)}endInteraction(e,t,n){n=n&&Ec(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(Us.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 oS(i,e){setTimeout(function(){i(e)},0)}function Tae(i){if(i.extent!==void 0){let t=i.smoothExtentConstraint!==void 0?i.smoothExtentConstraint:!0;return NI(i.extent,i.constrainOnlyCenter,t)}let e=gw(i.projection,"EPSG:3857");if(i.multiWorld!==!0&&e.isGlobal()){let t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,NI(t,!1,!1)}return DV}function Eae(i){let e,t,n,o=i.minZoom!==void 0?i.minZoom:BI,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=gw(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=FV(S,u,!v&&w,f):e=FI(t,n,u,!v&&w,f)}else{let T=(x?Math.max(jn(x),_r(x)):360*Yh.degrees/p.getMetersPerUnit())/256/Math.pow(2,BI),P=T/Math.pow(2,28-BI);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=OV(l,t,n,u,!v&&w,f):e=FI(t,n,u,!v&&w,f)}return{constraint:e,maxResolution:t,minResolution:n,minZoom:o,zoomFactor:l}}function Mae(i){if(i.enableRotation!==void 0?i.enableRotation:!0){let t=i.constrainRotation;return t===void 0||t===!0?UV():t===!1?OI:typeof t=="number"?BV(t):OI}return Lg}function Cae(i){return!(i.sourceCenter&&i.targetCenter&&!O0(i.sourceCenter,i.targetCenter)||i.sourceResolution!==i.targetResolution||i.sourceRotation!==i.targetRotation)}function UI(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=kI;var GI=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!==Jh&&this.listenerKeys.push(kn(e,Pu.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e=="string"?document.getElementById(e):e}},Dg=GI;var zI=class extends Dg{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+" "+Sd+" "+Cg+(this.collapsed_&&this.collapsible_?" "+iI:"")+(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=>DG(()=>r))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?"":"none",this.renderedVisible_=n),!No(t,this.renderedAttributions_)){zG(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(iI),this.collapsed_?pP(this.collapseLabel_,this.label_):pP(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=zI;var VI=class extends Dg{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+" "+Sd+" "+Cg,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(Fx)}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:Hl}):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(Fx);!s&&n===0?this.element.classList.add(Fx):s&&n!==0&&this.element.classList.remove(Fx)}this.label_.style.transform=r}this.rotation_=n}},GV=VI;var qI=class extends Dg{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+" "+Sd+" "+Cg,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:Hl})):n.setZoom(s)}}},zV=qI;function aS(i){i=i||{};let e=new uo;return(i.zoom===void 0||i.zoom)&&e.push(new zV(i.zoomOptions)),(i.rotate===void 0||i.rotate)&&e.push(new GV(i.rotateOptions)),(i.attribution===void 0||i.attribution)&&e.push(new kV(i.attributionOptions)),e}var HI=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_}},VV=HI;var WI={ACTIVE:"active"};var jI=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(WI.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set(WI.ACTIVE,e)}setMap(e){this.map_=e}};function qV(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:GG,center:i.getConstrainedCenter(r)})}}function Fg(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:Hl})}var Iu=jI;var XI=class extends Iu{constructor(e){super(),e=e||{},this.delta_=e.delta?e.delta:1,this.duration_=e.duration!==void 0?e.duration:250}handleEvent(e){let t=!1;if(e.type==nr.DBLCLICK){let n=e.originalEvent,r=e.map,s=e.coordinate,o=n.shiftKey?-this.delta_:this.delta_,a=r.getView();Fg(a,o,s,this.duration_),n.preventDefault(),t=!0}return!t}},HV=XI;function qx(i){let e=arguments;return function(t){let n=!0;for(let r=0,s=e.length;r<s&&(n=n&&e[r](t),!!n);++r);return n}}var WV=function(i){let e=i.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Rae=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)},lS=function(i){let e=i.map.getTargetElement(),t=e.getRootNode();return(t instanceof ShadowRoot?t.host:e).hasAttribute("tabindex")?Rae(i):!0},jV=Kh;var cS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.button==0&&!(FG&&cP&&e.ctrlKey)};var uS=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey};var XV=function(i){let e=i.originalEvent;return cP?e.metaKey:e.ctrlKey},$V=function(i){let e=i.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},hS=function(i){let e=i.originalEvent,t=e.target.tagName;return t!=="INPUT"&&t!=="SELECT"&&t!=="TEXTAREA"&&!e.target.isContentEditable},fS=function(i){let e=i.originalEvent;return"pointerId"in e&&e.pointerType=="mouse"};var YV=function(i){let e=i.originalEvent;return"pointerId"in e&&e.isPrimary&&e.button===0};var $I=class extends Iu{constructor(e){e=e||{},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==nr.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==nr.POINTERUP){let n=this.handleUpEvent(e);this.handlingDownUpSequence=n&&this.targetPointers.length>0}}else if(e.type==nr.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==nr.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function Og(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 Nu=$I;var YI=class extends Nu{constructor(e){super({stopDown:Qh}),e=e||{},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:qx(uS,YV);this.condition_=e.onFocusOnly?qx(lS,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(Og(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();Y9(s,a.getResolution()),ag(s,a.getRotation()),a.adjustCenterInternal(s)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){let t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let r=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),o=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(o),l=t.getCoordinateFromPixelInternal([a[0]-r*Math.cos(s),a[1]-r*Math.sin(s)]);n.animateInternal({center:n.getConstrainedCenter(l),duration:500,easing:Hl})}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}},ZV=YI;var ZI=class extends Nu{constructor(e){e=e||{},super({stopDown:Qh}),this.condition_=e.condition?e.condition:WV,this.lastAngle_=void 0,this.duration_=e.duration!==void 0?e.duration:250}handleDragEvent(e){if(!fS(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===Lg)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 fS(e)?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){return fS(e)&&cS(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},KV=ZI;var KI=class extends gd{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 bu([r])}getGeometry(){return this.geometry_}},QV=KI;var Bg={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"},eA=class extends $s{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},QI=class extends Nu{constructor(e){super(),this.on,this.once,this.un,e=e??{},this.box_=new QV(e.className||"ol-dragbox"),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??cS,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 eA(Bg.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 eA(t?Bg.BOXEND:Bg.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 eA(Bg.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new eA(Bg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new eA(Bg.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(e)}},JV=QI;var JI=class extends JV{constructor(e){e=e||{};let t=e.condition?e.condition:$V;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:Hl})}},eq=JI;var Md={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};var e5=class extends Iu{constructor(e){super(),e=e||{},this.defaultCondition_=function(t){return uS(t)&&hS(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==Md.DOWN||r==Md.LEFT||r==Md.RIGHT||r==Md.UP)){let o=e.map.getView(),a=o.getResolution()*this.pixelDelta_,l=0,c=0;r==Md.DOWN?c=-a:r==Md.LEFT?l=-a:r==Md.RIGHT?l=a:c=a;let u=[l,c];ag(u,o.getRotation()),qV(o,u,this.duration_),n.preventDefault(),t=!0}}return!t}},tq=e5;var t5=class extends Iu{constructor(e){super(),e=e||{},this.condition_=e.condition?e.condition:function(t){return!XV(t)&&hS(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();Fg(a,o,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},nq=t5;var Pae=40,Iae=300,Nae=3,n5=class extends Iu{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:jV;this.condition_=e.onFocusOnly?qx(lS,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*=Pae;break;case WheelEvent.DOM_DELTA_PAGE:o*=Iae;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*Nae),l.adjustZoom(-o/this.deltaPerZoom_,this.lastAnchor_?n.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=o;let c=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,n),c),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-_i(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),Fg(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)}},iq=n5;var i5=class extends Nu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Qh),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!==Lg&&(this.anchor_=o.getCoordinateFromPixelInternal(o.getEventPixel(Og(this.targetPointers))),this.rotating_&&(o.render(),a.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},rq=i5;var r5=class extends Nu{constructor(e){e=e||{};let t=e;t.stopDown||(t.stopDown=Qh),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(Og(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}},sq=r5;function dS(i){i=i||{};let e=new uo,t=new VV(-.005,.05,100);return(i.altShiftDragRotate===void 0||i.altShiftDragRotate)&&e.push(new KV),(i.doubleClickZoom===void 0||i.doubleClickZoom)&&e.push(new HV({delta:i.zoomDelta,duration:i.zoomDuration})),(i.dragPan===void 0||i.dragPan)&&e.push(new ZV({onFocusOnly:i.onFocusOnly,kinetic:t})),(i.pinchRotate===void 0||i.pinchRotate)&&e.push(new rq),(i.pinchZoom===void 0||i.pinchZoom)&&e.push(new sq({duration:i.zoomDuration})),(i.keyboard===void 0||i.keyboard)&&(e.push(new tq),e.push(new nq({delta:i.zoomDelta,duration:i.zoomDuration}))),(i.mouseWheelZoom===void 0||i.mouseWheelZoom)&&e.push(new iq({onFocusOnly:i.onFocusOnly,duration:i.zoomDuration})),(i.shiftDragZoom===void 0||i.shiftDragZoom)&&e.push(new eq({duration:i.zoomDuration})),e}var Ti={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};var s5=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[Ti.OPACITY]=e.opacity!==void 0?e.opacity:1,Vn(typeof t[Ti.OPACITY]=="number","Layer opacity must be a number"),t[Ti.VISIBLE]=e.visible!==void 0?e.visible:!0,t[Ti.Z_INDEX]=e.zIndex,t[Ti.MAX_RESOLUTION]=e.maxResolution!==void 0?e.maxResolution:1/0,t[Ti.MIN_RESOLUTION]=e.minResolution!==void 0?e.minResolution:0,t[Ti.MIN_ZOOM]=e.minZoom!==void 0?e.minZoom:-1/0,t[Ti.MAX_ZOOM]=e.maxZoom!==void 0?e.maxZoom:1/0,this.className_=t.className!==void 0?t.className:"ol-layer",delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0?!0:e},n=this.getZIndex();return t.opacity=_i(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return Yn()}getLayerStatesArray(e){return Yn()}getExtent(){return this.get(Ti.EXTENT)}getMaxResolution(){return this.get(Ti.MAX_RESOLUTION)}getMinResolution(){return this.get(Ti.MIN_RESOLUTION)}getMinZoom(){return this.get(Ti.MIN_ZOOM)}getMaxZoom(){return this.get(Ti.MAX_ZOOM)}getOpacity(){return this.get(Ti.OPACITY)}getSourceState(){return Yn()}getVisible(){return this.get(Ti.VISIBLE)}getZIndex(){return this.get(Ti.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(Ti.EXTENT,e)}setMaxResolution(e){this.set(Ti.MAX_RESOLUTION,e)}setMinResolution(e){this.set(Ti.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(Ti.MAX_ZOOM,e)}setMinZoom(e){this.set(Ti.MIN_ZOOM,e)}setOpacity(e){Vn(typeof e=="number","Layer opacity must be a number"),this.set(Ti.OPACITY,e)}setVisible(e){this.set(Ti.VISIBLE,e)}setZIndex(e){this.set(Ti.Z_INDEX,e)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},pS=s5;var Cd={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"},Dc=class extends $s{constructor(e,t){super(e),this.layer=t}},o5={LAYERS:"layers"},a5=class i extends pS{constructor(e){e=e||{};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(o5.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new uo(n.slice(),{unique:!0}):Vn(typeof n.getArray=="function","Expected `layers` to be an array or a `Collection`"):n=new uo(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,Ks.ADD,this.handleLayersAdd_,this),kn(e,Ks.REMOVE,this.handleLayersRemove_,this));for(let n in this.listenerKeys_)this.listenerKeys_[n].forEach(ii);xu(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 Dc(Cd.ADDLAYER,s))}this.changed()}registerLayerListeners_(e){let t=[kn(e,Rc.PROPERTYCHANGE,this.handleLayerChange_,this),kn(e,Jt.CHANGE,this.handleLayerChange_,this)];e instanceof i&&t.push(kn(e,Cd.ADDLAYER,this.handleLayerGroupAdd_,this),kn(e,Cd.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Ln(e)]=t}handleLayerGroupAdd_(e){this.dispatchEvent(new Dc(Cd.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Dc(Cd.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Dc(Cd.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 Dc(Cd.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(o5.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 Dc(Cd.REMOVELAYER,n[r]))}this.set(o5.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=mu(l.extent,r.extent):l.extent=r.extent),l.zIndex===void 0&&(l.zIndex=s)}return t}getSourceState(){return"ready"}},Hx=a5;var fo={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};var l5=class extends pS{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(Ti.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e=e||[],e.push(this),e}getLayerStatesArray(e){return e=e||[],e.push(this.getLayerState()),e}getSource(){return this.get(Ti.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():"undefined"}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!=="ready")&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(ii(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=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 Wx(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(Ti.MAP,e)}getMapInternal(){return this.get(Ti.MAP)}setMap(e){this.mapPrecomposeKey_&&(ii(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),e||this.changed(),this.mapRenderKey_&&(ii(this.mapRenderKey_),this.mapRenderKey_=null),e&&(this.mapPrecomposeKey_=kn(e,fo.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(Ti.SOURCE,e)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function Wx(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 tA=l5;function AS(i,e,t=0,n=i.length-1,r=Lae){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));AS(i,e,x,v,r)}let s=i[e],o=t,a=n;for(jx(i,t,e),r(i[n],s)>0&&jx(i,t,n);o<a;){for(jx(i,o,a),o++,a--;r(i[o],s)<0;)o++;for(;r(i[a],s)>0;)a--}r(i[t],s)===0?jx(i,t,a):(a++,jx(i,a,n)),a<=e&&(t=a+1),e<=a&&(n=a-1)}}function jx(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function Lae(i,e){return i<e?-1:i>e?1:0}var nA=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(!gS(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;gS(e,l)&&(t.leaf?n.push(a):u5(e,l)?this._all(a,n):s.push(a))}t=s.pop()}return n}collides(e){let t=this.data;if(!gS(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(gS(e,o)){if(t.leaf||u5(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=kg([]),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=Dae(e,n.children,t);if(u!==-1)return n.children.splice(u,1),s.push(n),this._condense(s),this}!c&&!n.leaf&&u5(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=kg(e.slice(t,n+1)),Ug(a,this.toBBox),a;r||(r=Math.ceil(Math.log(s)/Math.log(o)),o=Math.ceil(s/Math.pow(o,r-1))),a=kg([]),a.leaf=!1,a.height=r;let l=Math.ceil(s/o),c=l*Math.ceil(Math.sqrt(o));oq(e,t,n,c,this.compareMinX);for(let u=t;u<=n;u+=c){let f=Math.min(u+c-1,n);oq(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 Ug(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=c5(c),f=Bae(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),$x(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=kg(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Ug(n,this.toBBox),Ug(a,this.toBBox),t?e[t-1].children.push(a):this._splitRoot(n,a)}_splitRoot(e,t){this.data=kg([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Ug(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=Xx(e,0,a,this.toBBox),c=Xx(e,a,n,this.toBBox),u=Uae(l,c),f=c5(l)+c5(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:Fae,s=e.leaf?this.compareMinY:Oae,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=Xx(e,0,t,s),a=Xx(e,n-t,n,s),l=mS(o)+mS(a);for(let c=t;c<n-t;c++){let u=e.children[c];$x(o,e.leaf?s(u):u),l+=mS(o)}for(let c=n-t-1;c>=t;c--){let u=e.children[c];$x(a,e.leaf?s(u):u),l+=mS(a)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)$x(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():Ug(e[t],this.toBBox)}};function Dae(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 Ug(i,e){Xx(i,0,i.children.length,e,i)}function Xx(i,e,t,n,r){r||(r=kg(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];$x(r,i.leaf?n(o):o)}return r}function $x(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 Fae(i,e){return i.minX-e.minX}function Oae(i,e){return i.minY-e.minY}function c5(i){return(i.maxX-i.minX)*(i.maxY-i.minY)}function mS(i){return i.maxX-i.minX+(i.maxY-i.minY)}function Bae(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 Uae(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 u5(i,e){return i.minX<=e.minX&&i.minY<=e.minY&&e.maxX<=i.maxX&&e.maxY<=i.maxY}function gS(i,e){return e.minX<=i.maxX&&e.minY<=i.maxY&&e.maxX>=i.minX&&e.maxY>=i.minY}function kg(i){return{children:i,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function oq(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;AS(i,o,e,t,r),s.push(e,o,o,t)}}var rA=0,xS=0,Oo=1<<rA++,ri=1<<rA++,Bo=1<<rA++,oa=1<<rA++,cf=1<<rA++,iA=1<<rA++,yS=Math.pow(2,rA)-1,f5={[Oo]:"boolean",[ri]:"number",[Bo]:"string",[oa]:"color",[cf]:"number[]",[iA]:"size"},kae=Object.keys(f5).map(Number).sort(ka);function Gae(i){return i in f5}function lf(i){let e=[];for(let t of kae)Yx(i,t)&&e.push(f5[t]);return e.length===0?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function Yx(i,e){return(i&e)===e}function _S(i,e){return!!(i&e)}function Rd(i,e){return i===e}var Pr=class{constructor(e,t){if(!Gae(e))throw new Error(`literal expressions must have a specific type, got ${lf(e)}`);this.type=e,this.value=t}},vS=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function bS(i){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:i}}function jr(i,e,t){switch(typeof i){case"boolean":{if(Rd(e,Bo))return new Pr(Bo,i?"true":"false");if(!Yx(e,Oo))throw new Error(`got a boolean, but expected ${lf(e)}`);return new Pr(Oo,i)}case"number":{if(Rd(e,iA))return new Pr(iA,Hr(i));if(Rd(e,Oo))return new Pr(Oo,!!i);if(Rd(e,Bo))return new Pr(Bo,i.toString());if(!Yx(e,ri))throw new Error(`got a number, but expected ${lf(e)}`);return new Pr(ri,i)}case"string":{if(Rd(e,oa))return new Pr(oa,Nx(i));if(Rd(e,Oo))return new Pr(Oo,!!i);if(!Yx(e,Bo))throw new Error(`got a string, but expected ${lf(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 Qae(i,e,t);for(let n of i)if(typeof n!="number")throw new Error("expected an array of numbers");if(Rd(e,iA)){if(i.length!==2)throw new Error(`expected an array of two values for a size, got ${i.length}`);return new Pr(iA,i)}if(Rd(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(!Yx(e,cf))throw new Error(`got an array of numbers, but expected ${lf(e)}`);return new Pr(cf,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"},zae={[Je.Get]:Fn(Zn(1,1/0),aq),[Je.Var]:Vae(),[Je.Has]:Fn(Zn(1,1/0),aq),[Je.Id]:Fn(qae,Gg),[Je.Concat]:Fn(Zn(2,1/0),ki(Bo)),[Je.GeometryType]:Fn(Hae,Gg),[Je.LineMetric]:Fn(Wae,Gg),[Je.Resolution]:Fn(h5,Gg),[Je.Zoom]:Fn(h5,Gg),[Je.Time]:Fn(h5,Gg),[Je.Any]:Fn(Zn(2,1/0),ki(Oo)),[Je.All]:Fn(Zn(2,1/0),ki(Oo)),[Je.Not]:Fn(Zn(1,1),ki(Oo)),[Je.Equal]:Fn(Zn(2,2),cq()),[Je.NotEqual]:Fn(Zn(2,2),cq()),[Je.GreaterThan]:Fn(Zn(2,2),ki(ri)),[Je.GreaterThanOrEqualTo]:Fn(Zn(2,2),ki(ri)),[Je.LessThan]:Fn(Zn(2,2),ki(ri)),[Je.LessThanOrEqualTo]:Fn(Zn(2,2),ki(ri)),[Je.Multiply]:Fn(Zn(2,1/0),lq),[Je.Coalesce]:Fn(Zn(2,1/0),lq),[Je.Divide]:Fn(Zn(2,2),ki(ri)),[Je.Add]:Fn(Zn(2,1/0),ki(ri)),[Je.Subtract]:Fn(Zn(2,2),ki(ri)),[Je.Clamp]:Fn(Zn(3,3),ki(ri)),[Je.Mod]:Fn(Zn(2,2),ki(ri)),[Je.Pow]:Fn(Zn(2,2),ki(ri)),[Je.Abs]:Fn(Zn(1,1),ki(ri)),[Je.Floor]:Fn(Zn(1,1),ki(ri)),[Je.Ceil]:Fn(Zn(1,1),ki(ri)),[Je.Round]:Fn(Zn(1,1),ki(ri)),[Je.Sin]:Fn(Zn(1,1),ki(ri)),[Je.Cos]:Fn(Zn(1,1),ki(ri)),[Je.Atan]:Fn(Zn(1,2),ki(ri)),[Je.Sqrt]:Fn(Zn(1,1),ki(ri)),[Je.Match]:Fn(Zn(4,1/0),uq,Xae),[Je.Between]:Fn(Zn(3,3),ki(ri)),[Je.Interpolate]:Fn(Zn(6,1/0),uq,$ae),[Je.Case]:Fn(Zn(3,1/0),jae,Yae),[Je.In]:Fn(Zn(2,2),Zae),[Je.Number]:Fn(Zn(1,1/0),ki(yS)),[Je.String]:Fn(Zn(1,1/0),ki(yS)),[Je.Array]:Fn(Zn(1,1/0),ki(ri)),[Je.Color]:Fn(Zn(1,4),ki(ri)),[Je.Band]:Fn(Zn(1,3),ki(ri)),[Je.Palette]:Fn(Zn(2,2),Kae),[Je.ToString]:Fn(Zn(1,1),ki(Oo|ri|Bo|oa))};function aq(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 Vae(){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=jr(s,yS,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"&&_S(r,oa)&&!_S(r,Bo)?a=oa:Array.isArray(s)&&s.length===2&&_S(r,iA)&&!_S(r,cf)&&(a=iA),r&=a,r===xS)throw new Error(`the type expected from the var operator (${lf(e)}) did not have any overlap with the type of the corresponding style variables (${lf(a)}), variable name: ${n}`)}if(t.variables.has(n)){let o=t.variables.get(n);if(r&=o,r===xS)throw new Error(`a new type expected from the var operator (${lf(e)}) did not have any overlap with the previous type expected for it (${lf(o)}), variable name: ${n}`)}return t.variables.set(n,r),new vS(r,"var",new Pr(Bo,n))}}function qae(i,e,t){t.featureId=!0}function Hae(i,e,t){t.geometryType=!0}function Wae(i,e,t){t.mCoordinate=!0}function h5(i,e,t){t.mapState=!0}function Gg(i,e,t){let n=i[0];if(i.length!==1)throw new Error(`expected no arguments for ${n} operation`);return[]}function Zn(i,e){return function(t,n,r){let s=t[0],o=t.length-1;if(i===e){if(o!==i){let a=i===1?"":"s";throw new Error(`expected ${i} argument${a} for ${s}, got ${o}`)}}else if(o<i||o>e){let a=e===1/0?`${i} or more`:`${i} to ${e}`;throw new Error(`expected ${a} arguments for ${s}, got ${o}`)}}}function lq(i,e,t){let n=i.length-1,r=new Array(n);for(let s=0;s<n;++s){let o=jr(i[s+1],e,t);r[s]=o}return r}function ki(i){return function(e,t,n){let r=e.length-1,s=new Array(r);for(let o=0;o<r;++o){let a=jr(e[o+1],i,n);s[o]=a}return s}}function cq(){return function(i,e,t){let n=i[0],r=i.length-1,s=new Array(r),o=yS;for(let a=0;a<r;++a){let l=jr(i[a+1],o,t);o&=l.type}if(o===xS)throw new Error(`no common type was found among the arguments of ${n}`);for(let a=0;a<r;++a){let l=jr(i[a+1],o,t);s[a]=l}return s}}function jae(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 uq(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 Xae(i,e,t){let n=i.length-1,r=jr(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=jr(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===xS)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=jr(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=jr(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[jr(i[1],s,t),...o,r]}function $ae(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=jr(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=jr(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=jr(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 Yae(i,e,t){let n=jr(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=jr(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=jr(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 Zae(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=jr(n[a],r,t);s[a]=l}catch(l){throw new Error(`failed to parse haystack item ${a} for "in" expression: ${l.message}`)}return[jr(i[1],r,t),...s]}function Kae(i,e,t){let n;try{n=jr(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=jr(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 vS(t,r,...s)}}function Qae(i,e,t){let n=i[0],r=zae[n];if(!r)throw new Error(`unknown operator: ${n}`);return r(i,e,t)}function wS(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 wS(i.getGeometries()[0]);default:return""}}function d5(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Oc(i,e,t){let n=jr(i,e,t);return Fc(n,t)}function Fc(i,e){if(i instanceof Pr){if(i.type===oa&&typeof i.value=="string"){let n=Nx(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 Jae(i,e);case Je.Get:case Je.Var:case Je.Has:return ele(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=>Fc(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 nle(i,e);case Je.Equal:case Je.NotEqual:case Je.LessThan:case Je.LessThanOrEqualTo:case Je.GreaterThan:case Je.GreaterThanOrEqualTo:return tle(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 ile(i,e);case Je.Case:return rle(i,e);case Je.Match:return sle(i,e);case Je.Interpolate:return ole(i,e);case Je.ToString:return ale(i,e);default:throw new Error(`Unsupported operator ${t}`)}}function Jae(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Fc(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 ele(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 tle(i,e){let t=i.operator,n=Fc(i.args[0],e),r=Fc(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 nle(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Fc(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 ile(i,e){let t=i.operator,n=i.args.length,r=new Array(n);for(let s=0;s<n;++s)r[s]=Fc(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 rle(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Fc(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 sle(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Fc(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 ole(i,e){let t=i.args.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=Fc(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=Bz(f)),u>=o)return c===2?f:p?lle(s,o,a,l,u,f):Zx(s,o,a,l,u,f);a=u,l=f}return l}}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]=Fc(i.args[s],e);if(t===Je.ToString)return s=>{let o=r[0](s);return i.args[0].type===oa?Lx(o):o.toString()};throw new Error(`Unsupported convert operator ${t}`)}function Zx(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 lle(i,e,t,n,r,s){if(r-t===0)return n;let a=eI(n),l=eI(s),c=l[2]-a[2];c>180?c-=360:c<-180&&(c+=360);let u=[Zx(i,e,t,a[0],r,l[0]),Zx(i,e,t,a[1],r,l[1]),a[2]+Zx(i,e,t,0,r,c),Zx(i,e,t,n[3],r,s[3])];return Uz(u)}function cle(i){return!0}function ule(i,e){e=e??bS();let t=hle(i,e),n=d5();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=wS(r.getGeometry())),t(n)}}function hq(i,e){e=e??bS();let t=i.length,n=new Array(t);for(let o=0;o<t;++o)n[o]=p5(i[o],e);let r=d5(),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=wS(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 Aq(i,e){if(e=e??bS(),!Array.isArray(i))return hq([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 ule(s,e)}return hq(i,e)}function hle(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?Oc(s.filter,Oo,e):cle,a;if(Array.isArray(s.style)){let l=s.style.length;a=new Array(l);for(let c=0;c<l;++c)a[c]=p5(s.style[c],e)}else a=[p5(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 p5(i,e){let t=Kx(i,"",e),n=Qx(i,"",e),r=fle(i,e),s=dle(i,e),o=po(i,"z-index",e);if(!t&&!n&&!r&&!s&&!Sc(i))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(i));let a=new Bs;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 Kx(i,e,t){let n;if(e+"fill-pattern-src"in i)n=gle(i,e+"fill-",t);else{if(i[e+"fill-color"]==="none")return s=>null;n=TS(i,e+"fill-color",t)}if(!n)return null;let r=new Wr;return function(s){let o=n(s);return o===jw?null:(r.setColor(o),r)}}function Qx(i,e,t){let n=po(i,e+"stroke-width",t),r=TS(i,e+"stroke-color",t);if(!n&&!r)return null;let s=uf(i,e+"stroke-line-cap",t),o=uf(i,e+"stroke-line-join",t),a=mq(i,e+"stroke-line-dash",t),l=po(i,e+"stroke-line-dash-offset",t),c=po(i,e+"stroke-miter-limit",t),u=po(i,e+"stroke-offset",t),f=new Zs;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 fle(i,e){let t="text-",n=uf(i,t+"value",e);if(!n)return null;let r=Kx(i,t,e),s=Kx(i,t+"background-",e),o=Qx(i,t,e),a=Qx(i,t+"background-",e),l=uf(i,t+"font",e),c=po(i,t+"max-angle",e),u=po(i,t+"offset-x",e),f=po(i,t+"offset-y",e),p=zg(i,t+"overflow",e),x=uf(i,t+"placement",e),v=po(i,t+"repeat",e),w=ES(i,t+"scale",e),S=zg(i,t+"rotate-with-view",e),T=po(i,t+"rotation",e),P=uf(i,t+"align",e),R=uf(i,t+"justify",e),C=uf(i,t+"baseline",e),L=zg(i,t+"keep-upright",e),D=mq(i,t+"padding",e),F=MS(i,t+"declutter-mode"),N=new of({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 dle(i,e){return"icon-src"in i?ple(i,e):"shape-points"in i?Ale(i,e):"circle-radius"in i?mle(i,e):null}function ple(i,e){let t="icon-",n=t+"src",r=gq(i[n],n),s=SS(i,t+"anchor",e),o=ES(i,t+"scale",e),a=po(i,t+"opacity",e),l=SS(i,t+"displacement",e),c=po(i,t+"rotation",e),u=zg(i,t+"rotate-with-view",e),f=dq(i,t+"anchor-origin"),p=pq(i,t+"anchor-x-units"),x=pq(i,t+"anchor-y-units"),v=hf(i,t+"color"),w,S=null;v!==void 0&&(Array.isArray(v)&&v.length>0&&typeof v[0]=="string"?S=TS(i,t+"color",e):w=_q(v,t+"color"));let T=xle(i,t+"cross-origin"),P=yle(i,t+"offset"),R=dq(i,t+"offset-origin"),C=A5(i,t+"width"),L=A5(i,t+"height"),D=_le(i,t+"size"),F=MS(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 K0(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 Ale(i,e){let t="shape-",n=t+"points",r=t+"radius",s=m5(i[n],n);if(!(r in i))throw new Error(`Expected a number for ${r}`);let o=po(i,r,e),a=typeof i[r]=="number"?i[r]:5,l=t+"radius2",c=po(i,l,e),u=typeof i[l]=="number"?i[l]:void 0,f=Kx(i,t,e),p=Qx(i,t,e),x=ES(i,t+"scale",e),v=SS(i,t+"displacement",e),w=po(i,t+"rotation",e),S=zg(i,t+"rotate-with-view",e),T=A5(i,t+"angle"),P=MS(i,t+"declutter-mode"),R=new Qw({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 mle(i,e){let t="circle-",n=Kx(i,t,e),r=Qx(i,t,e),s=po(i,t+"radius",e),o=ES(i,t+"scale",e),a=SS(i,t+"displacement",e),l=po(i,t+"rotation",e),c=zg(i,t+"rotate-with-view",e),u=MS(i,t+"declutter-mode"),f=new Jw({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 hf(i,e){if(!(e in i))return;let t=i[e];return t===void 0?void 0:t}function po(i,e,t){let n=hf(i,e);if(n===void 0)return;let r=Oc(n,ri,t);return function(s){return m5(r(s),e)}}function uf(i,e,t){let n=hf(i,e);if(n===void 0)return null;let r=Oc(n,Bo,t);return function(s){return gq(r(s),e)}}function gle(i,e,t){let n=uf(i,e+"pattern-src",t),r=fq(i,e+"pattern-offset",t),s=fq(i,e+"pattern-size",t),o=TS(i,e+"color",t);return function(a){return{src:n(a),offset:r&&r(a),size:s&&s(a),color:o&&o(a)}}}function zg(i,e,t){let n=hf(i,e);if(n===void 0)return null;let r=Oc(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 TS(i,e,t){let n=hf(i,e);if(n===void 0)return null;let r=Oc(n,oa,t);return function(s){return _q(r(s),e)}}function mq(i,e,t){let n=hf(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=Oc(o,ri,t);return function(c){return m5(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=Oc(n,cf,t);return function(s){return Jx(r(s),e)}}function SS(i,e,t){let n=hf(i,e);if(n===void 0)return null;let r=Oc(n,cf,t);return function(s){let o=Jx(r(s),e);if(o.length!==2)throw new Error(`Expected two numbers for ${e}`);return o}}function fq(i,e,t){let n=hf(i,e);if(n===void 0)return null;let r=Oc(n,cf,t);return function(s){return xq(r(s),e)}}function ES(i,e,t){let n=hf(i,e);if(n===void 0)return null;let r=Oc(n,cf|ri,t);return function(s){return vle(r(s),e)}}function A5(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 _le(i,e){let t=i[e];if(t!==void 0){if(typeof t=="number")return Hr(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 xle(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 dq(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 pq(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 yle(i,e){let t=i[e];if(t!==void 0)return Jx(t,e)}function MS(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 Jx(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 gq(i,e){if(typeof i!="string")throw new Error(`Expected a string for ${e}`);return i}function m5(i,e){if(typeof i!="number")throw new Error(`Expected a number for ${e}`);return i}function _q(i,e){if(typeof i=="string")return i;let t=Jx(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 xq(i,e){let t=Jx(i,e);if(t.length!==2)throw new Error(`Expected an array of two numbers for ${e}`);return t}function vle(i,e){return typeof i=="number"?i:xq(i,e)}var yq={RENDER_ORDER:"renderOrder"},g5=class extends tA{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(yq.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 nA(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(yq.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?dI:e;let t=ble(e);this.styleFunction_=e===null?void 0:Zz(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function ble(i){if(i===void 0)return dI;if(!i)return null;if(typeof i=="function"||i instanceof Bs)return i;if(Array.isArray(i)&&i.length===0)return[];if(Array.isArray(i)&&i[0]instanceof Bs){let t=i.length,n=new Array(t);for(let r=0;r<t;++r){let s=i[r];if(!(s instanceof Bs))throw new Error("Expected a list of style instances");n[r]=s}return n}return Aq(i)}var CS=g5;var _5=class extends $s{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},RS=_5;var x5=class extends gd{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){Yn()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;co(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),Cw(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=uw(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()&&Wx(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,Kh,this,s,o)!==void 0}getMap(){return this.map_}renderFrame(e){Yn()}scheduleExpireIconCache(e){Do.canExpireCache()&&e.postRenderFunctions.push(wle)}};function wle(i,e){Do.expire()}var vq=x5;var y5=class extends vq{constructor(e){super(e),this.fontChangeListenerKey_=kn(Y0,Rc.PROPERTYCHANGE,e.redrawText,e),this.element_=Fs?Tw():document.createElement("div");let t=this.element_.style;t.position="absolute",t.width="100%",t.height="100%",t.zIndex="0",this.element_.className=Sd+" 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 RS(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(fo.PRECOMPOSE,e);let t=e.layerStatesArray.sort((u,f)=>u.zIndex-f.zIndex);t.some(u=>u.layer instanceof CS&&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(!Wx(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),VG(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(...Mw(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(fo.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))}}},bq=y5;function wq(i){if(i instanceof tA){i.setMapInternal(null);return}i instanceof Hx&&i.getLayers().forEach(wq)}function Sq(i,e){if(i instanceof tA){i.setMapInternal(e);return}if(i instanceof Hx){let t=i.getLayers().getArray();for(let n=0,r=t.length;n<r;++n)Sq(t[n],e)}}var v5=class extends xs{constructor(e){super(),e=e||{},this.on,this.once,this.un;let t=Sle(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:OG,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Ys(),this.pixelToCoordinateTransform_=Ys(),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 uo:aS()),this.interactions=t.interactions||(Fs?new uo:dS({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new NV(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(ho.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(ho.VIEW,this.handleViewChanged_),this.addChangeListener(ho.SIZE,this.handleSizeChanged_),this.addChangeListener(ho.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(Ks.ADD,r=>{r.element.setMap(this)}),this.controls.addEventListener(Ks.REMOVE,r=>{r.element.setMap(null)}),this.interactions.addEventListener(Ks.ADD,r=>{r.element.setMap(this)}),this.interactions.addEventListener(Ks.REMOVE,r=>{r.element.setMap(null)}),this.overlays_.addEventListener(Ks.ADD,r=>{this.addOverlayInternal_(r.element)}),this.overlays_.addEventListener(Ks.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){Sq(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:Kh,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 Hx?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:Kh,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(ho.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return gx(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(ho.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof uo){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=Ec(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(ho.SIZE)}getView(){return this.get(ho.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 LV(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t=t||e.type;let n=new Ru(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===zx.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[Us.ANIMATING]||o[Us.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(fo.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(fo.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new Ed(Pu.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new Ed(Pu.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 bq(this)),!ul(t)){this.mapBrowserEventHandler_=new PV(this,this.moveTolerance_);for(let r in nr)this.mapBrowserEventHandler_.addEventListener(nr[r],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(Jt.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(Jt.WHEEL,this.boundHandleBrowserEvent_,Sw?{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,Rc.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 Dc("addlayer",e)),this.layerGroupPropertyListenerKeys_=[kn(e,Rc.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){wq(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&&nP(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:dx(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=dx(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_||!gu(this.previousExtent_)&&!L0(s.extent,this.previousExtent_))&&(this.dispatchEvent(new Ed(Pu.MOVESTART,this,r)),this.previousExtent_=N0(this.previousExtent_)),this.previousExtent_&&!s.viewHints[Us.ANIMATING]&&!s.viewHints[Us.INTERACTING]&&!L0(s.extent,this.previousExtent_)&&(this.dispatchEvent(new Ed(Pu.MOVEEND,this,s)),nw(s.extent,this.previousExtent_))),this.dispatchEvent(new Ed(Pu.POSTRENDER,this,s)),this.renderComplete_=(this.hasListener(Pu.LOADSTART)||this.hasListener(Pu.LOADEND)||this.hasListener(fo.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 Dc("removelayer",t)),this.set(ho.LAYERGROUP,e)}setSize(e){this.set(ho.SIZE,e)}setTarget(e){this.set(ho.TARGET,e)}setView(e){if(!e||e instanceof hl){this.set(ho.VIEW,e);return}this.set(ho.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)],!nP(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&aw("No map visible because the map container's width or height are 0."))}let n=this.getSize();t&&(!n||!No(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function Sle(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 Hx({layers:i.layers});t[ho.LAYERGROUP]=n,t[ho.TARGET]=i.target,t[ho.VIEW]=i.view instanceof hl?i.view:new hl;let r;i.controls!==void 0&&(Array.isArray(i.controls)?r=new uo(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 uo(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 uo(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 uo,{controls:r,interactions:s,keyboardEventTarget:e,overlays:o,values:t}}var Tq=v5;function PS(i){return i instanceof Image||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageBitmap?i:null}var Tle=new Error("disposed");var Ele=[256,256],b5=class extends xg{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=PS(this.data_);return e?[e.width,e.height]:Ele}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(Tle),this.controller_=null),super.disposeInternal()}},w5=b5;var S5=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 gd&&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}},T5=S5;var E5=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(yx(),{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}},IS=E5;var Mle=5,M5=class extends Pw{constructor(e){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=e,this.staleKeys_=new Array,this.maxStaleKeys=Mle,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()}},Eq=M5;var R5=[],Vg=null;function Cle(){Vg=Si(1,1,void 0,{willReadFrequently:!0})}var C5=class extends Eq{constructor(e){super(e),this.container=null,this.renderedResolution,this.tempTransform=Ys(),this.pixelTransform=Ys(),this.inversePixelTransform=Ys(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(e,t,n){Vg||Cle(),Vg.clearRect(0,0,1,1);let r;try{Vg.drawImage(e,t,n,1,1,0,0,1,1),r=Vg.getImageData(0,0,1,1).data}catch{return Vg=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&&No(jl(e.style.backgroundColor),jl(n)))){let c=e.firstElementChild;ul(c)&&(l=c.getContext("2d"))}if(l&&YG(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?Tw():document.createElement("div"),a.className=o;let c=a.style;c.position="absolute",c.width="100%",c.height="100%",l=Si();let u=l.canvas;a.appendChild(u),c=u.style,c.position="absolute",c.left="0",c.transformOrigin="top left",this.container=a,this.context=l}!this.containerReused&&n&&!this.container.style.backgroundColor&&(this.container.style.backgroundColor=n)}clipUnrotated(e,t,n){let r=Vl(n),s=og(n),o=sg(n),a=rg(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);co(this.pixelTransform,e.size[0]/2,e.size[1]/2,1/o,1/o,s,-a/2,-l/2),Cw(this.inversePixelTransform,this.pixelTransform);let c=$G(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 RS(e,this.inversePixelTransform,n,t);r.dispatchEvent(s)}}preRender(e,t){this.frameState=t,!t.declutter&&this.dispatchRenderEvent_(fo.PRERENDER,e,t)}postRender(e,t){t.declutter||this.dispatchRenderEvent_(fo.POSTRENDER,e,t)}renderDeferredInternal(e){}getRenderContext(e){return e.declutter&&!this.deferredContext_&&(this.deferredContext_=new IS),e.declutter?this.deferredContext_.getContext():this.context}renderDeferred(e){e.declutter&&(this.dispatchRenderEvent_(fo.PRERENDER,this.context,e),e.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(e),this.dispatchRenderEvent_(fo.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 co(this.tempTransform,l,c,u,f,-n,p,x)}disposeInternal(){delete this.frameState,super.disposeInternal()}},NS=C5;function P5(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 Rle(i,e,t){let n=i[t];return n?n.delete(e):!1}function Mq(i,e){let t=i.layerStatesArray[i.layerIndex];t.extent&&(e=mu(e,Mc(t.extent,i.viewState.projection)));let n=t.layer.getRenderSource();if(!n.getWrapX()){let r=n.getTileGridForProjection(i.viewState.projection).getExtent();r&&(e=mu(e,r))}return e}var I5=class extends NS{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 xw(0,0,0,0),this.tempTileCoord_=Ag(0,0,0);let n=t.cacheSize!==void 0?t.cacheSize:512;this.tileCache_=new T5(n),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=n*.5}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new T5(512)),this.sourceTileCache_}getOrCreateTile(e,t,n,r){let s=this.tileCache_,a=this.getLayer().getSource(),l=mg(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||fg(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&&!vc(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=Hr(l.getTileSize(u)),w=l.getResolution(u),S;if(p instanceof Ew||p instanceof Rw)S=p.getImage();else if(p instanceof w5){if(S=PS(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?z4(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||!P5(r,L,S))continue;let F=L.getKey();if(f[F]=!0,L.getState()===rn.IDLE&&!e.tileQueue.isKeyQueued(F)){let N=Ag(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=mg(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)),P5(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=mg(l,c,n,u,f),x=!1;if(a.containsKey(p)){let v=a.peek(p);v.getState()===rn.LOADED&&(P5(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?Mc(n.extent,s):null,this.layerExtent&&(v=mu(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=Mq(e,e.nextExtent);this.enqueueTiles(e,ee,K,L,D)}let F=Mq(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)){Rle(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);co(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(Vl(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=H9(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_||!L0(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 w5){if(u=PS(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}},Cq=I5;var ey={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};var N5=class extends tA{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(ey.PRELOAD)}setPreload(e){this.set(ey.PRELOAD,e)}getUseInterimTilesOnError(){return this.get(ey.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(e){this.set(ey.USE_INTERIM_TILES_ON_ERROR,e)}getData(e){return super.getData(e)}},Rq=N5;var L5=class extends Rq{constructor(e){super(e)}createRenderer(){return new Cq(this,{cacheSize:this.getCacheSize()})}},D5=L5;var F5=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){}},LS=F5;var ty={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},ny=[ty.FILL],Lu=[ty.STROKE],ff=[ty.BEGIN_PATH],O5=[ty.CLOSE_PATH],An=ty;var B5=class extends LS{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],vc(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=tw(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,bx,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,p,e,r||n,bx,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,wg,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,f,e,r||n,wg,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,vu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,vu,s]);break;case"MultiPoint":c=e.getFlatCoordinates(),u=this.appendFlatPointCoordinates(c,a),u>l&&(this.instructions.push([An.CUSTOM,l,u,e,n,vu,s]),this.hitDetectionInstructions.push([An.CUSTOM,l,u,e,r||n,vu,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,bG(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||Os)??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:Mu;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:Cu;let l=e.getWidth();t.lineWidth=l!==void 0?l:sf;let c=e.getMiterLimit();t.miterLimit=c!==void 0?c:nf;let u=e.getOffset();t.strokeOffset=u??Vz,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&&!No(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_=nw(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;ng(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},Du=B5;var U5=class extends Du{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&&!vc(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||vc(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}},Pq=U5;var k5=class extends Du{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],ff);let l=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(l,0,l.length,c,a),this.hitDetectionInstructions.push(Lu),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],ff);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(Lu),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(Lu),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(Lu),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(ff)}},Iq=k5;var G5=class extends Du{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(ff),this.hitDetectionInstructions.push(ff);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(O5),this.hitDetectionInstructions.push(O5)),t=f}return a&&(this.instructions.push(ny),this.hitDetectionInstructions.push(ny)),l&&(this.instructions.push(Lu),this.hitDetectionInstructions.push(Lu)),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,Os]),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(ff,f),this.hitDetectionInstructions.push(ff,f),r.fillStyle!==void 0&&(this.instructions.push(ny),this.hitDetectionInstructions.push(ny)),r.strokeStyle!==void 0&&(this.instructions.push(Lu),this.hitDetectionInstructions.push(Lu)),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,Os]),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,Os]),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]=yd(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}},z5=G5;var V5=0,q5=1;function Ple(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 V5=u,q5=f,!0}function Nq(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(Ple(r,s,o,a,T,P,L,D)){let F=L-T,N=D-P,B=T+V5*F,z=P+V5*N,V=T+q5*F,H=P+q5*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 Lq(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=Io(c,f,v),S=Io(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=Io(c,f,v/x),S=Io(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 Dq(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 iy={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},H5=class extends Du{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[Os]={fillStyle:Os},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")&&!Au(this.getBufferedMaxExtent(),p)){let T=Nq(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=Lq(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=Dq(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!=rf&&(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==rf?rf: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]=Os),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_?Os: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||Td,justify:t.justify,textBaseline:t.textBaseline||Z0,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=iy[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&&Os,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()||Os)):(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()||Mu,s.lineDash=w?w.slice():Va,s.lineDashOffset=S===void 0?qa:S,s.lineJoin=a.getLineJoin()||Cu,s.lineWidth=T===void 0?sf:T,s.miterLimit=P===void 0?nf:P,s.strokeStyle=za(a.getColor()||Fo)}n=this.textState_;let l=e.getFont()||Zw;qz(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()||Z0,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||rf,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}},Fq=H5;var Ile={Circle:z5,Default:Du,Image:Pq,LineString:Iq,Polygon:z5,Text:Fq},W5=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=Ile[t];s=new o(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=s}return s}},Oq=W5;function Bq(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 DS(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]=Nle(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 Nle(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=K9([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 FS(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 j5;function Lle(){return j5||(j5=new Intl.Segmenter(void 0,{granularity:"grapheme"})),j5}function Uq(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=Io(w,x,C),D=Io(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=Io(w,x,C),V=Io(S,v,C),H=!1;if(p)if(f){let ae=[L,D,z,V];Fw(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(Lle().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=Io(w,x,C),mt=Io(S,v,C);J.push([Ue,mt,Ie/2,de,Qe]),s+=Ie}return J}var qg=Cr(),Pd=[],df=[],pf=[],Id=[];function kq(i){return i[3].declutterBox}var Gq=new RegExp("[\u0591-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFC\u0800-\u0FFF\uE800-\uEFFF]");function X5(i,e){return e==="start"?e=Gq.test(i)?"right":"left":e==="end"&&(e=Gq.test(i)?"left":"right"),iy[e]}function Dle(i,e,t){return t>0&&i.push(`7+`,""),i.push(e,""),i}function Fle(i,e,t){return t%2===0&&(i+=e),i}var $5=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_=Ys(),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 IS: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?iy[l.justify]:X5(Array.isArray(e)?e[0]:e,l.textAlign||Td),p=r&&o.lineWidth?o.lineWidth:0,x=Array.isArray(e)?e:String(e).split(`8+`).reduce(Dle,[]),{width:v,height:w,widths:S,heights:T,lineWidths:P}=jz(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)&&(Pd[0]=F,Id[0]=F,Pd[1]=N,df[1]=N,df[0]=F+L,pf[0]=df[0],pf[1]=N+D,Id[1]=pf[1]);let B;return f!==0?(B=co(Ys(),n,r,1,1,f,-n,-r),Rr(B,Pd),Rr(B,df),Rr(B,pf),Rr(B,Id),cl(Math.min(Pd[0],df[0],pf[0],Id[0]),Math.min(Pd[1],df[1],pf[1],Id[1]),Math.max(Pd[0],df[0],pf[0],Id[0]),Math.max(Pd[1],df[1],pf[1],Id[1]),qg)):cl(Math.min(F,F+L),Math.min(N,N+D),Math.max(F,F+L),Math.max(N,N+D),qg),x&&(T=Math.round(T),P=Math.round(P)),{drawImageX:T,drawImageY:P,drawImageW:R,drawImageH:C,originX:c,originY:u,declutterBox:{minX:qg[0],minY:qg[1],maxX:qg[2],maxY:qg[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,Pd,df,pf,Id,o,a),Xz(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=X5(Array.isArray(e)?e[0]:e,s.textAlign||Td),u=iy[s.textBaseline||Z0],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_&&No(n,this.renderedTransform_)?u=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),u=Ga(this.coordinates,0,this.coordinates.length,2,n,this.pixelCoordinates_),XG(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 Gr=Ue[23];S=(Nn.anchorX-Gr)*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=rf,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),Gr=[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:Gr,declutterMode:R};continue}let Is=Bn[or];gr=Is.args,rl=Is.declutterMode,delete Bn[or],na=kq(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,Gr))}else this.replayImageOrLabel_.apply(this,Gr)}++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(Fle,"")),z=Ue[12];let cn=[Ue[13],Ue[13]];R=Ue[14]||"declutter";let yn=Ue[15],Rn=Ue[16],xe=this.textStates[z],bt=xe.font,Ye=[xe.scale[0]*en,xe.scale[1]*en],wt;bt in this.widths_?wt=this.widths_[bt]:(wt={},this.widths_[bt]=wt);let Dt=Bq(u,gt,St,2),ct=Math.abs(Ye[0])*sI(bt,B,wt);if(Ke||ct<=Dt){let Nn=this.textStates[z].textAlign,Gr=(Dt-ct)*X5(B,Nn),gr=Uq(u,gt,St,2,B,Gr,Rt,Math.abs(Ye[0]),sI,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)-Rn,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,rf,!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]-Rn,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,rf,!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(kq));for(let ol=0,fu=rl.length;ol<fu;++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,qi;if(P){let Gr=(Ue[4]??!1)||Math.abs(u[x]-u[v-2])<1e-6&&Math.abs(u[x+1]-u[v-1])<1e-6;DS(u,x,v,2,P,Gr,w),FS(w,2,Gr),Ce=w,jt=0,qi=Ce.length}else Ce=u,jt=x,qi=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<qi;Nn+=2)ve=Ce[Nn],Ie=Ce[Nn+1],D=ve+.5|0,F=Ie+.5|0,(Nn==qi-2||D!==C||F!==L)&&(e.lineTo(ve,Ie),C=D,L=F);++f;break;case An.SET_FILL_STYLE:this.alignAndScaleFill_=Ue[2],Z?(this.fill_(e),Z=0,J&&(e.stroke(),J=0)):J&&Ue[1]&&(e.stroke(),J=0),e.fillStyle=Ue[1],++f;break;case An.SET_STROKE_STYLE:Z&&Ue[1]&&(this.fill_(e),Z=0),J&&(e.stroke(),J=0),this.setStrokeStyle_(e,Ue),++f;break;case An.STROKE:ce?J++:e.stroke(),++f;break;default:++f;break}}Z&&this.fill_(e),J&&e.stroke()}execute(e,t,n,r,s,o){this.viewRotation_=r,this.execute_(e,t,n,this.instructions,s,void 0,void 0,o)}executeHitDetection(e,t,n,r,s){return this.viewRotation_=n,this.execute_(e,[e.canvas.width,e.canvas.height],t,this.hitDetectionInstructions,!0,r,s)}},zq=$5;var Nd=["Polygon","Circle","LineString","Image","Text","Default"],K5=["Image","Text"],Vq=Nd.filter(i=>!K5.includes(i)),qq=!1,Hq=!1;function Ole(){let i=0,e=n=>{let r=Si(1,1,null,{willReadFrequently:n}),s=0,o=performance.now();for(;performance.now()-o<50;++s)r.fillStyle=`rgba(255,0,${s%256},1)`,r.fillRect(0,0,1,1),r.getImageData(0,0,1,1);return i=s>i?s:i,s};qq={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0}[i],Hq=!0}var Z5=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_=Ys(),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 zq(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){Hq===!1&&Ole(),r=Math.round(r);let a=r*2+1,l=co(this.hitDetectionTransform_,r+.5,r+.5,1/t,-1/t,-n,-e[0],-e[1]),c=!this.hitDetectionContext_;c&&(this.hitDetectionContext_=Si(a,a,null,{willReadFrequently:qq}));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(),D0(f,e),ng(f,t*(this.renderBuffer_+r),f));let p=Ble(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=Nd.length-1;T>=0;--T)if(x=Nd[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 Sc(this.executorsByZIndex_)}execute(e,t,n,r,s,o,a){let l=Object.keys(this.executorsByZIndex_).map(Number);l.sort(a?vG:ka),o=o||Nd;let c=Nd.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+Nd.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}},Y5={};function Ble(i){if(Y5[i]!==void 0)return Y5[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 Y5[i]=r,r}var Wq=Z5;var Q5=class extends LS{constructor(e,t,n,r,s,o,a){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?F0(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_=Ys()}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_;co(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=DS(l,0,u,2,o,f,l),FS(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=dz(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),No(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:Td;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||Os)}}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:Mu,lineDash:this.pixelRatio_===1?u:u.map(p=>p*this.pixelRatio_),lineDashOffset:(o||qa)*this.pixelRatio_,lineJoin:a!==void 0?a:Cu,lineWidth:(l!==void 0?l:sf)*this.pixelRatio_,miterLimit:c!==void 0?c:nf,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||Os)}}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:Mu,lineDash:w||Va,lineDashOffset:S||qa,lineJoin:T!==void 0?T:Cu,lineWidth:P!==void 0?P:sf,miterLimit:R!==void 0?R:nf,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:Zw,textAlign:f!==void 0?f:Td,textBaseline:p!==void 0?p:Z0},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]]}}},jq=Q5;var Bc=.5;function Xq(i,e,t,n,r,s,o,a,l){let c=l?pd(r,l):r,u=i[0]*Bc,f=i[1]*Bc,p=Si(u,f);p.imageSmoothingEnabled=!1;let x=p.canvas,v=new jq(p,Bc,r,null,o,a,l?U0(G0(),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=Si(de[0],de[1],void 0,{alpha:!1}),Ie=ve.canvas;ve.fillStyle=N,ve.fillRect(0,0,Ie.width,Ie.height),Z.setImage(new K0({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 $q(i,e,t){let n=[];if(t){let r=Math.floor(Math.round(i[0])*Bc),s=Math.floor(Math.round(i[1])*Bc),o=(_i(r,0,t.width-1)+_i(s,0,t.height-1)*t.width)*4,a=t.data[o],l=t.data[o+1],u=t.data[o+2]+256*(l+256*a),f=Math.floor((256*256*256-1)/e.length);u&&u%f===0&&n.push(e[u/f-1])}return n}var Ule=.5,Yq={Point:Wle,LineString:Vle,Polygon:Xle,MultiPoint:jle,MultiLineString:qle,MultiPolygon:Hle,GeometryCollection:zle,Circle:kle};function Zq(i,e){return parseInt(Ln(i),10)-parseInt(Ln(e),10)}function J5(i,e){let t=eN(i,e);return t*t}function eN(i,e){return Ule*i/e}function kle(i,e,t,n,r){let s=t.getFill(),o=t.getStroke();if(s||o){let l=i.getBuilder(t.getZIndex(),"Circle");l.setFillStrokeStyle(s,o),l.drawCircle(e,n,r)}let a=t.getText();if(a&&a.getText()){let l=i.getBuilder(t.getZIndex(),"Text");l.setTextStyle(a),l.drawText(e,n,r)}}function tN(i,e,t,n,r,s,o,a){let l=[],c=t.getImage();if(c){let p=!0,x=c.getImageState();x==Mn.LOADED||x==Mn.ERROR?p=!1:x==Mn.IDLE&&c.load(),p&&l.push(c.ready())}let u=t.getFill();u&&u.loading()&&l.push(u.ready());let f=l.length>0;return f&&Promise.all(l).then(()=>r(null)),Gle(i,e,t,n,s,o,a),f}function Gle(i,e,t,n,r,s,o){let a=t.getGeometryFunction()(e);if(!a)return;let l=a.simplifyTransformed(n,r);if(t.getRenderer())Kq(i,l,t,e,o);else{let u=Yq[l.getType()];u(i,l,t,e,o,s)}}function Kq(i,e,t,n,r){if(e.getType()=="GeometryCollection"){let o=e.getGeometries();for(let a=0,l=o.length;a<l;++a)Kq(i,o[a],t,n,r);return}i.getBuilder(t.getZIndex(),"Default").drawCustom(e,n,t.getRenderer(),t.getHitDetectionRenderer(),r)}function zle(i,e,t,n,r,s){let o=e.getGeometriesArray(),a,l;for(a=0,l=o.length;a<l;++a){let c=Yq[o[a].getType()];c(i,o[a],t,n,r,s)}}function Vle(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 qle(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 Hle(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 Wle(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 jle(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 Xle(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 nN=class extends NS{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[Us.ANIMATING]||v[Us.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?Nd:n?K5:Vq,n?p&&t.declutter[p]:void 0)}while(++D<L)}setDrawContext_(){this.opacity_!==1&&(this.targetContext_=this.context,this.context=Si(this.context.canvas.width,this.context.canvas.height,R5))}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,q0(this.context),R5.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(fo.PRERENDER)||this.getLayer().hasListener(fo.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=Mc(n.extent,l);a=xr(u,e.extent),a&&!Au(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]*Bc,p=n[1]*Bc;u.push(this.getRenderTransform(r,s,o,Bc,f,p,0).slice());let x=c.getSource(),v=a.getExtent();if(x.getWrapX()&&a.canWrapX()&&!Au(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,Bc,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,Bc,f,p,R).slice()),S-=T}let w=G0();this.hitDetectionImageData_=Xq(n,u,this.renderedFeatures_,c.getStyleFunction(),l,s,o,J5(s,this.renderedPixelRatio_),w?a:null)}t($q(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[Us.ANIMATING],s=e.viewHints[Us.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=Zq);let S=c.center.slice(),T=ng(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&&!gu(K)&&(this.extendX_=K[0]<C[0]||K[2]>C[2])}if(L&&(!Au(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,uw(S,u);let de=q4(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&&Au(this.wrappedRenderedExtent_,T))return No(this.renderedExtent_,P)||(this.hitDetectionImageData_=null,this.renderedExtent_=P),this.renderedCenter_=S,this.replayGroupChanged=!1,!0;this.replayGroup_=null;let D=new Oq(eN(f,p),T,f,p),F=G0(),N;if(F){for(let K=0,ee=R.length;K<ee;++K){let ae=R[K],ce=pd(ae,u);n.loadFeatures(ce,_G(f,u),F)}N=U0(F,u)}else for(let K=0,ee=R.length;K<ee;++K)n.loadFeatures(R[K],f,u);let B=J5(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=pd(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 Wq(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=tN(r,e,n[c],t,this.boundHandleStyleImageChange_,s,o,a)||l;else l=tN(r,e,n,t,this.boundHandleStyleImageChange_,s,o,a);return l}},Qq=nN;var iN=class extends CS{constructor(e){super(e)}createRenderer(){return new Qq(this)}},Jq=iN;var $le=!1;function Yle(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=$le,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 rN(i,e){return function(t,n,r,s,o){Yle(i,e,t,n,r,(a,l)=>{this.addFeatures(a),s!==void 0&&s(a)},()=>{this.changed(),o!==void 0&&o()})}}function eH(i,e){return[[-1/0,-1/0,1/0,1/0]]}function sN(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=yG(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]:Io(i[a+u],i[a+n+u],l);return s}var tH=Ys(),ry=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"?iw(this.flatCoordinates_):ig(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=Ua(this.getExtent());this.flatInteriorPoints_=Tx(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=Sz(this.flatCoordinates_,this.ends_),t=tS(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=Ow(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=sN(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=sN(e,t,o,this.stride_,.5);Cc(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);co(tH,n[0],n[3],r,-r,0,0,0),Ga(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,tH,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=ww((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=wx(n,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,e,n,0),r=[n.length];break;case"MultiLineString":r=[],n.length=yz(n,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,e,n,0,r);break;case"Polygon":r=[],n.length=Sx(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}};ry.prototype.getFlatCoordinates=ry.prototype.getOrientedFlatCoordinates;var sA=ry;var oN=class{constructor(e){this.rbush_=new nA(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];L0(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 Sc(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]}},aN=oN;var fl={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};var Fu=class extends $s{constructor(e,t,n){super(e),this.feature=t,this.features=n}},lN=class extends Nw{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_=Jh,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_=rN(this.url_,this.format_)),this.strategy_=e.strategy!==void 0?e.strategy:eH;let t=e.useSpatialIndex!==void 0?e.useSpatialIndex:!0;this.featuresRtree_=t?new aN:null,this.loadedExtentsRtree_=new aN,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 uo(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 Fu(fl.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof sA||(this.featureChangeKeys_[e]=[kn(t,Jt.CHANGE,this.handleFeatureChange_,this),kn(t,Rc.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 sA){let s=this.idIndex_[r];s instanceof sA?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 Fu(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(Ks.ADD,n=>{t||(t=!0,this.addFeature(n.element),t=!1)}),e.addEventListener(Ks.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 Fu(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 sA||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 sA||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(),Sc(this.nullGeometryFeatures_)||Cc(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=ow(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||Kh,this.featuresRtree_.forEachInExtent(l,function(c){if(t(c)){let u=c.getGeometry(),f=a;if(a=u instanceof sA?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 Fu(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()&&Sc(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 Au(u.extent,l)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new Fu(fl.FEATURESLOADSTART));let u=v=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Fu(fl.FEATURESLOADEND,void 0,v))},f=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Fu(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=V4(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 Fu(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(rN(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},Af=lN;var ga={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ep={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},zT=0,Qy=1,VT=2;var ZN=0,tp=1,qT=2,Jl=3,mo=0,ui=1,ir=2,Yr=0,os=1,Vu=2,qu=3,Hu=4,Nf=5,Jy=6,ks=100,e2=101,t2=102,HT=103,WT=104,Hc=200,n2=201,i2=202,r2=203,Gd=204,zd=205,s2=206,o2=207,a2=208,l2=209,c2=210,HH=211,WH=212,jH=213,XH=214,uA=0,hA=1,fA=2,Uu=3,dA=4,pA=5,AA=6,mA=7,NA=0,jT=1,XT=2,Gs=0,u2=1,h2=2,f2=3,d2=4,KN=5,p2=6,A2=7;var m2=300,_l=301,ec=302,np=303,ip=304,Wu=306,Tf=1e3,Go=1001,Ef=1002,xi=1003,g2=1004;var tc=1005;var vi=1006,rp=1007;var _o=1008,QN=1008,Gi=1009,ju=1010,Xu=1011,ja=1012,Lr=1013,pi=1014,Yi=1015,Li=1016,LA=1017,DA=1018,Vo=1020,FA=35902,OA=35899,E_=1021,Lf=1022,vr=1023,vs=1026,Js=1027,Df=1028,$u=1029,Ts=1030,Yu=1031,_2=1032,sp=1033,Zu=33776,Ku=33777,Qu=33778,Ju=33779,BA=35840,UA=35841,kA=35842,GA=35843,op=36196,ap=37492,lp=37496,cp=37488,up=37489,eh=37490,hp=37491,fp=37808,dp=37809,pp=37810,Ap=37811,mp=37812,gp=37813,_p=37814,xp=37815,yp=37816,vp=37817,bp=37818,wp=37819,Sp=37820,Tp=37821,Ep=36492,Mp=36494,Cp=36495,Rp=36283,Pp=36284,th=36285,Ip=36286;var _y=2300,AT=2301,dT=2302,BN=2303,UN=2400,kN=2401,GN=2402;var JN=0,eL=1,$T=2,$H=3200;var xl=0,YT=1,qo="",yr="srgb",Vd="srgb-linear",qd="linear",Bt="srgb",x2="",ZT="rg",tL="ga",nL=0,vf=7680,iL=7681,rL=7682,sL=7683,oL=34055,aL=34056,lL=5386,cL=512,uL=513,hL=514,fL=515,dL=516,pL=517,AL=518,xy=519,y2=512,M_=513,v2=514,nh=515,zA=516,b2=517,Wc=518,w2=519,Hd=35044,VA=35048;var mL="300 es",Ao=2e3,Ha=2001,nc={COMPUTE:"compute",RENDER:"render"};var Ff={TEXTURE_COMPARE:"depthTextureCompare"};function Zle(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}function C_(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function u_(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function KT(){let i=u_("canvas");return i.style.display="block",i}var nH={},h_=null;function gA(...i){let e="THREE."+i.shift();h_?h_("log",e,...i):console.log(e,...i)}function YH(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=YH(i);let e="THREE."+i.shift();if(h_)h_("warn",e,...i);else{let t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function Ge(...i){i=YH(i);let e="THREE."+i.shift();if(h_)h_("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 nH||(nH[e]=!0,je(...i))}function gL(){return typeof self<"u"&&typeof self.scheduler<"u"&&typeof self.scheduler.yield<"u"?self.scheduler.yield():new Promise(i=>{requestAnimationFrame(i)})}function ZH(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 S2={[uA]:hA,[fA]:AA,[dA]:mA,[Uu]:pA,[hA]:uA,[AA]:fA,[mA]:dA,[pA]:Uu},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"],iH=1234567,py=Math.PI/180,Mf=180/Math.PI;function Bu(){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 Pn(i,e,t){return Math.max(e,Math.min(t,i))}function _L(i,e){return(i%e+e)%e}function Kle(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Qle(i,e,t){return i!==e?(t-i)/(e-i):0}function Ay(i,e,t){return(1-t)*i+t*e}function Jle(i,e,t,n){return Ay(i,e,1-Math.exp(-t*n))}function ece(i,e=1){return e-Math.abs(_L(i,e*2)-e)}function tce(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function nce(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function ice(i,e){return i+Math.floor(Math.random()*(e-i+1))}function rce(i,e){return i+Math.random()*(e-i)}function sce(i){return i*(.5-Math.random())}function oce(i){i!==void 0&&(iH=i);let e=iH+=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 ace(i){return i*py}function lce(i){return i*Mf}function cce(i){return(i&i-1)===0&&i!==0}function uce(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function hce(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function fce(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 Hn(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 jc={DEG2RAD:py,RAD2DEG:Mf,generateUUID:Bu,clamp:Pn,euclideanModulo:_L,mapLinear:Kle,inverseLerp:Qle,lerp:Ay,damp:Jle,pingpong:ece,smoothstep:tce,smootherstep:nce,randInt:ice,randFloat:rce,randFloatSpread:sce,seededRandom:oce,degToRad:ace,radToDeg:lce,isPowerOfTwo:cce,ceilPowerOfTwo:uce,floorPowerOfTwo:hce,setQuaternionFromProperEuler:fce,normalize:Hn,denormalize:ca},wL=class wL{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("THREE.Vector2: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Pn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Pn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*r+e.x,this.y=s*r+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};wL.prototype.isVector2=!0;var Oe=wL,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(Pn(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-r*a,this._w=o*u-n*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(n=-n,r=-r,s=-s,o=-o,a=-a);let l=1-t;if(a<.9995){let c=Math.acos(a),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+o*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},SL=class SL{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("THREE.Vector3: index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(rH.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(rH.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*r,this.y=s[1]*t+s[4]*n+s[7]*r,this.z=s[2]*t+s[5]*n+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*r+s[14])*o,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*n),u=2*(a*t-s*r),f=2*(s*n-o*t);return this.x=t+l*c+o*f-a*u,this.y=n+l*u+a*c-s*f,this.z=r+l*f+s*u-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*r,this.y=s[1]*t+s[5]*n+s[9]*r,this.z=s[2]*t+s[6]*n+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this.z=Pn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this.z=Pn(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Pn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-n*l,this.z=n*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return cN.copy(this).projectOnVector(e),this.sub(cN)}reflect(e){return this.sub(cN.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Pn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};SL.prototype.isVector3=!0;var ie=SL,cN=new ie,rH=new bs,TL=class TL{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(uN.makeScale(e,t)),this}rotate(e){return Kn("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(uN.makeRotation(-e)),this}translate(e,t){return Kn("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(uN.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)}};TL.prototype.isMatrix3=!0;var Sn=TL,uN=new Sn,sH=new Sn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),oH=new Sn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function dce(){let i={enabled:!0,workingColorSpace:Vd,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Bt&&(r.r=Sf(r.r),r.g=Sf(r.g),r.b=Sf(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=c_(r.r),r.g=c_(r.g),r.b=c_(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?qd: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({[Vd]:{primaries:e,whitePoint:n,transfer:qd,toXYZ:sH,fromXYZ:oH,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:yr},outputColorSpaceConfig:{drawingBufferColorSpace:yr}},[yr]:{primaries:e,whitePoint:n,transfer:Bt,toXYZ:sH,fromXYZ:oH,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:yr}}}),i}var sn=dce();function Sf(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function c_(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}var Hg,mT=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{Hg===void 0&&(Hg=u_("canvas")),Hg.width=e.width,Hg.height=e.height;let r=Hg.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Hg}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=u_("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]=Sf(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(Sf(t[n]/255)*255):t[n]=Sf(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}},pce=0,f_=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:pce++}),this.uuid=Bu(),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(hN(r[o].image)):s.push(hN(r[o]))}else s=hN(r);n.url=s}return t||(e.images[this.uuid]=n),n}};function hN(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?mT.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 Ace=0,fN=new ie,ws=class i extends zo{constructor(e=i.DEFAULT_IMAGE,t=i.DEFAULT_MAPPING,n=Go,r=Go,s=vi,o=_o,a=vr,l=Gi,c=i.DEFAULT_ANISOTROPY,u=qo){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Ace++}),this.uuid=Bu(),this.name="",this.source=new f_(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(fN).x}get height(){return this.source.getSize(fN).y}get depth(){return this.source.getSize(fN).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!==m2)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Tf:e.x=e.x-Math.floor(e.x);break;case Go:e.x=e.x<0?0:1;break;case Ef: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 Tf:e.y=e.y-Math.floor(e.y);break;case Go:e.y=e.y<0?0:1;break;case Ef: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=m2;ws.DEFAULT_ANISOTROPY=1;var EL=class EL{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=Pn(this.x,e.x,t.x),this.y=Pn(this.y,e.y,t.y),this.z=Pn(this.z,e.z,t.z),this.w=Pn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Pn(this.x,e,t),this.y=Pn(this.y,e,t),this.z=Pn(this.z,e,t),this.w=Pn(this.w,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Pn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};EL.prototype.isVector4=!0;var gn=EL,ua=class extends zo{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:vi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new gn(0,0,e,t),this.scissorTest=!1,this.viewport=new gn(0,0,e,t),this.textures=[];let r={width:e,height:t,depth:n.depth},s=new 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:vi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let r=Object.assign({},e.textures[t].image);this.textures[t].source=new f_(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}},_A=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=xi,this.minFilter=xi,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 gT=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=xi,this.minFilter=xi,this.wrapR=Go,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var GT=class GT{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 GT().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/Wg.setFromMatrixColumn(e,0).length(),s=1/Wg.setFromMatrixColumn(e,1).length(),o=1/Wg.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(mce,e,gce)}lookAt(e,t,n){let r=this.elements;return dl.subVectors(e,t),dl.lengthSq()===0&&(dl.z=1),dl.normalize(),Ld.crossVectors(n,dl),Ld.lengthSq()===0&&(Math.abs(n.z)===1?dl.x+=1e-4:dl.z+=1e-4,dl.normalize(),Ld.crossVectors(n,dl)),Ld.normalize(),OS.crossVectors(dl,Ld),r[0]=Ld.x,r[4]=OS.x,r[8]=dl.x,r[1]=Ld.y,r[5]=OS.y,r[9]=dl.y,r[2]=Ld.z,r[6]=OS.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=Wg.set(r[0],r[1],r[2]).length(),a=Wg.set(r[4],r[5],r[6]).length(),l=Wg.set(r[8],r[9],r[10]).length();s<0&&(o=-o),Uc.copy(this);let c=1/o,u=1/a,f=1/l;return Uc.elements[0]*=c,Uc.elements[1]*=c,Uc.elements[2]*=c,Uc.elements[4]*=u,Uc.elements[5]*=u,Uc.elements[6]*=u,Uc.elements[8]*=f,Uc.elements[9]*=f,Uc.elements[10]*=f,t.setFromRotationMatrix(Uc),n.x=o,n.y=a,n.z=l,this}makePerspective(e,t,n,r,s,o,a=Ao,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===Ao)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=Ao,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===Ao)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}};GT.prototype.isMatrix4=!0;var on=GT,Wg=new ie,Uc=new on,mce=new ie(0,0,0),gce=new ie(1,1,1),Ld=new ie,OS=new ie,dl=new ie,aH=new on,lH=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(Pn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,x),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Pn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,x),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Pn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,x),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Pn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,x),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Pn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,x));break;case"XZY":this._z=Math.asin(-Pn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,x),this._y=0);break;default:je("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return aH.makeRotationFromQuaternion(e),this.setFromRotationMatrix(aH,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return lH.setFromEuler(this),this.setFromQuaternion(lH,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};fa.DEFAULT_ORDER="XYZ";var d_=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}},_ce=0,cH=new ie,jg=new bs,mf=new on,BS=new ie,sy=new ie,xce=new ie,yce=new bs,uH=new ie(1,0,0),hH=new ie(0,1,0),fH=new ie(0,0,1),dH={type:"added"},vce={type:"removed"},Xg={type:"childadded",child:null},dN={type:"childremoved",child:null},$i=class i extends zo{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:_ce++}),this.uuid=Bu(),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 d_,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 jg.setFromAxisAngle(e,t),this.quaternion.multiply(jg),this}rotateOnWorldAxis(e,t){return jg.setFromAxisAngle(e,t),this.quaternion.premultiply(jg),this}rotateX(e){return this.rotateOnAxis(uH,e)}rotateY(e){return this.rotateOnAxis(hH,e)}rotateZ(e){return this.rotateOnAxis(fH,e)}translateOnAxis(e,t){return cH.copy(e).applyQuaternion(this.quaternion),this.position.add(cH.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(uH,e)}translateY(e){return this.translateOnAxis(hH,e)}translateZ(e){return this.translateOnAxis(fH,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(mf.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?BS.copy(e):BS.set(e,t,n);let r=this.parent;this.updateWorldMatrix(!0,!1),sy.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?mf.lookAt(sy,BS,this.up):mf.lookAt(BS,sy,this.up),this.quaternion.setFromRotationMatrix(mf),r&&(mf.extractRotation(r.matrixWorld),jg.setFromRotationMatrix(mf),this.quaternion.premultiply(jg.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(dH),Xg.child=e,this.dispatchEvent(Xg),Xg.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(vce),dN.child=e,this.dispatchEvent(dN),dN.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),mf.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),mf.multiply(e.parent.matrixWorld)),e.applyMatrix4(mf),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(dH),Xg.child=e,this.dispatchEvent(Xg),Xg.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(sy,e,xce),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(sy,yce,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}};$i.DEFAULT_UP=new ie(0,1,0);$i.DEFAULT_MATRIX_AUTO_UPDATE=!0;$i.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Xr=class extends $i{constructor(){super(),this.isGroup=!0,this.type="Group"}},bce={type:"move"},Wd=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Xr,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 Xr,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 Xr,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 Xr;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},KH={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},Dd={h:0,s:0,l:0},US={h:0,s:0,l:0};function pN(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=_L(e,1),t=Pn(t,0,1),n=Pn(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=pN(o,s,e+1/3),this.g=pN(o,s,e),this.b=pN(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=KH[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=Sf(e.r),this.g=Sf(e.g),this.b=Sf(e.b),this}copyLinearToSRGB(e){return this.r=c_(e.r),this.g=c_(e.g),this.b=c_(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(Pn(ko.r*255,0,255))*65536+Math.round(Pn(ko.g*255,0,255))*256+Math.round(Pn(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(Dd),this.setHSL(Dd.h+e,Dd.s+t,Dd.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(Dd),e.getHSL(US);let n=Ay(Dd.h,US.h,t),r=Ay(Dd.s,US.s,t),s=Ay(Dd.l,US.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=KH;var jd=class extends $i{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new 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}},kc=new ie,gf=new ie,AN=new ie,_f=new ie,$g=new ie,Yg=new ie,pH=new ie,mN=new ie,gN=new ie,_N=new ie,xN=new gn,yN=new gn,vN=new gn,bf=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),kc.subVectors(e,t),r.cross(kc);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){kc.subVectors(r,t),gf.subVectors(n,t),AN.subVectors(e,t);let o=kc.dot(kc),a=kc.dot(gf),l=kc.dot(AN),c=gf.dot(gf),u=gf.dot(AN),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,_f)===null?!1:_f.x>=0&&_f.y>=0&&_f.x+_f.y<=1}static getInterpolation(e,t,n,r,s,o,a,l){return this.getBarycoord(e,t,n,r,_f)===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,_f.x),l.addScaledVector(o,_f.y),l.addScaledVector(a,_f.z),l)}static getInterpolatedAttribute(e,t,n,r,s,o){return xN.setScalar(0),yN.setScalar(0),vN.setScalar(0),xN.fromBufferAttribute(e,t),yN.fromBufferAttribute(e,n),vN.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(xN,s.x),o.addScaledVector(yN,s.y),o.addScaledVector(vN,s.z),o}static isFrontFacing(e,t,n,r){return kc.subVectors(n,t),gf.subVectors(e,t),kc.cross(gf).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 kc.subVectors(this.c,this.b),gf.subVectors(this.a,this.b),kc.cross(gf).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;$g.subVectors(r,n),Yg.subVectors(s,n),mN.subVectors(e,n);let l=$g.dot(mN),c=Yg.dot(mN);if(l<=0&&c<=0)return t.copy(n);gN.subVectors(e,r);let u=$g.dot(gN),f=Yg.dot(gN);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($g,o);_N.subVectors(e,s);let x=$g.dot(_N),v=Yg.dot(_N);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(Yg,a);let S=u*v-x*f;if(S<=0&&f-u>=0&&x-v>=0)return pH.subVectors(s,r),a=(f-u)/(f-u+(x-v)),t.copy(r).addScaledVector(pH,a);let T=1/(S+w+p);return o=w*T,a=p*T,t.copy(n).addScaledVector($g,o).addScaledVector(Yg,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(Gc.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Gc.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=Gc.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,Gc):Gc.fromBufferAttribute(s,o),Gc.applyMatrix4(e.matrixWorld),this.expandByPoint(Gc);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),kS.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),kS.copy(n.boundingBox)),kS.applyMatrix4(e.matrixWorld),this.union(kS)}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,Gc),Gc.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(oy),GS.subVectors(this.max,oy),Zg.subVectors(e.a,oy),Kg.subVectors(e.b,oy),Qg.subVectors(e.c,oy),Fd.subVectors(Kg,Zg),Od.subVectors(Qg,Kg),oA.subVectors(Zg,Qg);let t=[0,-Fd.z,Fd.y,0,-Od.z,Od.y,0,-oA.z,oA.y,Fd.z,0,-Fd.x,Od.z,0,-Od.x,oA.z,0,-oA.x,-Fd.y,Fd.x,0,-Od.y,Od.x,0,-oA.y,oA.x,0];return!bN(t,Zg,Kg,Qg,GS)||(t=[1,0,0,0,1,0,0,0,1],!bN(t,Zg,Kg,Qg,GS))?!1:(zS.crossVectors(Fd,Od),t=[zS.x,zS.y,zS.z],bN(t,Zg,Kg,Qg,GS))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Gc).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Gc).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:(xf[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),xf[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),xf[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),xf[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),xf[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),xf[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),xf[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),xf[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(xf),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}},xf=[new ie,new ie,new ie,new ie,new ie,new ie,new ie,new ie],Gc=new ie,kS=new da,Zg=new ie,Kg=new ie,Qg=new ie,Fd=new ie,Od=new ie,oA=new ie,oy=new ie,GS=new ie,zS=new ie,aA=new ie;function bN(i,e,t,n,r){for(let s=0,o=i.length-3;s<=o;s+=3){aA.fromArray(i,s);let a=r.x*Math.abs(aA.x)+r.y*Math.abs(aA.y)+r.z*Math.abs(aA.z),l=e.dot(aA),c=t.dot(aA),u=n.dot(aA);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}var wf=wce();function wce(){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=Pn(i,-65504,65504),wf.floatView[0]=i;let e=wf.uint32View[0],t=e>>23&511;return wf.baseTable[t]+((e&8388607)>>wf.shiftTable[t])}function VS(i){let e=i>>10;return wf.uint32View[0]=wf.mantissaTable[wf.offsetTable[e]+(i&1023)]+wf.exponentTable[e],wf.floatView[0]}var ys=new ie,qS=new Oe,Sce=0,Ni=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:Sce++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Hd,this.updateRanges=[],this.gpuType=Yi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)qS.fromBufferAttribute(this,t),qS.applyMatrix3(e),this.setXY(t,qS.x,qS.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=Hn(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=Hn(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=Hn(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=Hn(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=Hn(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Hn(t,this.array),n=Hn(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=Hn(t,this.array),n=Hn(n,this.array),r=Hn(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=Hn(t,this.array),n=Hn(n,this.array),r=Hn(r,this.array),s=Hn(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!==Hd&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}};var xA=class extends Ni{constructor(e,t,n){super(new Uint16Array(e),t,n)}};var yA=class extends Ni{constructor(e,t,n){super(new Uint32Array(e),t,n)}},p_=class extends Ni{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=VS(this.array[e*this.itemSize]);return this.normalized&&(t=ca(t,this.array)),t}setX(e,t){return this.normalized&&(t=Hn(t,this.array)),this.array[e*this.itemSize]=pl(t),this}getY(e){let t=VS(this.array[e*this.itemSize+1]);return this.normalized&&(t=ca(t,this.array)),t}setY(e,t){return this.normalized&&(t=Hn(t,this.array)),this.array[e*this.itemSize+1]=pl(t),this}getZ(e){let t=VS(this.array[e*this.itemSize+2]);return this.normalized&&(t=ca(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Hn(t,this.array)),this.array[e*this.itemSize+2]=pl(t),this}getW(e){let t=VS(this.array[e*this.itemSize+3]);return this.normalized&&(t=ca(t,this.array)),t}setW(e,t){return this.normalized&&(t=Hn(t,this.array)),this.array[e*this.itemSize+3]=pl(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Hn(t,this.array),n=Hn(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=Hn(t,this.array),n=Hn(n,this.array),r=Hn(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=Hn(t,this.array),n=Hn(n,this.array),r=Hn(r,this.array),s=Hn(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}},In=class extends Ni{constructor(e,t,n){super(new Float32Array(e),t,n)}},Tce=new da,ay=new ie,wN=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):Tce.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;ay.subVectors(e,this.center);let t=ay.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(ay,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):(wN.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ay.copy(e.center).add(wN)),this.expandByPoint(ay.copy(e.center).sub(wN))),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}},Ece=0,Zl=new on,SN=new $i,Jg=new ie,Al=new da,ly=new da,Qs=new ie,Wn=class i extends zo{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Ece++}),this.uuid=Bu(),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(Zle(e)?yA:xA)(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 Zl.makeRotationFromQuaternion(e),this.applyMatrix4(Zl),this}rotateX(e){return Zl.makeRotationX(e),this.applyMatrix4(Zl),this}rotateY(e){return Zl.makeRotationY(e),this.applyMatrix4(Zl),this}rotateZ(e){return Zl.makeRotationZ(e),this.applyMatrix4(Zl),this}translate(e,t,n){return Zl.makeTranslation(e,t,n),this.applyMatrix4(Zl),this}scale(e,t,n){return Zl.makeScale(e,t,n),this.applyMatrix4(Zl),this}lookAt(e){return SN.lookAt(e),SN.updateMatrix(),this.applyMatrix4(SN.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Jg).negate(),this.translate(Jg.x,Jg.y,Jg.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 In(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?(Qs.addVectors(this.boundingBox.min,Al.min),this.boundingBox.expandByPoint(Qs),Qs.addVectors(this.boundingBox.max,Al.max),this.boundingBox.expandByPoint(Qs)):(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];ly.setFromBufferAttribute(a),this.morphTargetsRelative?(Qs.addVectors(Al.min,ly.min),Al.expandByPoint(Qs),Qs.addVectors(Al.max,ly.max),Al.expandByPoint(Qs)):(Al.expandByPoint(ly.min),Al.expandByPoint(ly.max))}Al.getCenter(n);let r=0;for(let s=0,o=e.count;s<o;s++)Qs.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(Qs));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++)Qs.fromBufferAttribute(a,c),l&&(Jg.fromBufferAttribute(e,c),Qs.add(Jg)),r=Math.max(r,n.distanceToSquared(Qs))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&Ge('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Ge("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,r=t.normal,s=t.uv,o=this.getAttribute("tangent");(o===void 0||o.count!==n.count)&&(o=new Ni(new Float32Array(4*n.count),4),this.setAttribute("tangent",o));let a=[],l=[];for(let N=0;N<n.count;N++)a[N]=new ie,l[N]=new ie;let c=new ie,u=new ie,f=new ie,p=new Oe,x=new Oe,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 Ni(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let p=0,x=n.count;p<x;p++)n.setXYZ(p,0,0,0);let r=new ie,s=new ie,o=new ie,a=new ie,l=new ie,c=new ie,u=new ie,f=new ie;if(e)for(let p=0,x=e.count;p<x;p+=3){let 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++)Qs.fromBufferAttribute(e,t),Qs.normalize(),e.setXYZ(t,Qs.x,Qs.y,Qs.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 Ni(p,u,f)}if(this.index===null)return je("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new i,n=this.index.array,r=this.attributes;for(let a in r){let l=r[a],c=e(l,n);t.setAttribute(a,c)}let s=this.morphAttributes;for(let a in s){let l=[],c=s[a];for(let u=0,f=c.length;u<f;u++){let p=c[u],x=e(p,n);l.push(x)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,l=o.length;a<l;a++){let c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let c=n[l];e.data.attributes[l]=c.toJSON(e.data)}let r={},s=!1;for(let l in this.morphAttributes){let c=this.morphAttributes[l],u=[];for(let f=0,p=c.length;f<p;f++){let x=c[f];u.push(x.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let c in r){let u=r[c];this.setAttribute(c,u.clone(t))}let s=e.morphAttributes;for(let c in s){let u=[],f=s[c];for(let p=0,x=f.length;p<x;p++)u.push(f[p].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let c=0,u=o.length;c<u;c++){let f=o[c];this.addGroup(f.start,f.count,f.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}},Cf=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Hd,this.updateRanges=[],this.version=0,this.uuid=Bu()}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=Bu()),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=Bu()),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,go=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=Hn(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=Hn(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Hn(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Hn(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Hn(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=Hn(t,this.array),n=Hn(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=Hn(t,this.array),n=Hn(n,this.array),r=Hn(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=Hn(t,this.array),n=Hn(n,this.array),r=Hn(r,this.array),s=Hn(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){gA("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let n=0;n<this.count;n++){let r=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new Ni(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new i(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){gA("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}}},Mce=0,Ss=class extends zo{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Mce++}),this.uuid=Bu(),this.name="",this.type="Material",this.blending=os,this.side=mo,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Gd,this.blendDst=zd,this.blendEquation=ks,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ut(0,0,0),this.blendAlpha=0,this.depthFunc=Uu,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=xy,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=vf,this.stencilZFail=vf,this.stencilZPass=vf,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!==mo&&(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!==Gd&&(n.blendSrc=this.blendSrc),this.blendDst!==zd&&(n.blendDst=this.blendDst),this.blendEquation!==ks&&(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!==Uu&&(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!==xy&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==vf&&(n.stencilFail=this.stencilFail),this.stencilZFail!==vf&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==vf&&(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++}},Xd=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}},e_,cy=new ie,t_=new ie,n_=new ie,i_=new Oe,uy=new Oe,QH=new on,HS=new ie,hy=new ie,WS=new ie,AH=new Oe,TN=new Oe,mH=new Oe,yy=class extends $i{constructor(e=new Xd){if(super(),this.isSprite=!0,this.type="Sprite",e_===void 0){e_=new Wn;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 Cf(t,5);e_.setIndex([0,1,2,0,2,3]),e_.setAttribute("position",new go(n,3,0,!1)),e_.setAttribute("uv",new go(n,2,3,!1))}this.geometry=e_,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.'),t_.setFromMatrixScale(this.matrixWorld),QH.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),n_.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&t_.multiplyScalar(-n_.z);let n=this.material.rotation,r,s;n!==0&&(s=Math.cos(n),r=Math.sin(n));let o=this.center;jS(HS.set(-.5,-.5,0),n_,o,t_,r,s),jS(hy.set(.5,-.5,0),n_,o,t_,r,s),jS(WS.set(.5,.5,0),n_,o,t_,r,s),AH.set(0,0),TN.set(1,0),mH.set(1,1);let a=e.ray.intersectTriangle(HS,hy,WS,!1,cy);if(a===null&&(jS(hy.set(-.5,.5,0),n_,o,t_,r,s),TN.set(0,1),a=e.ray.intersectTriangle(HS,WS,hy,!1,cy),a===null))return;let l=e.ray.origin.distanceTo(cy);l<e.near||l>e.far||t.push({distance:l,point:cy.clone(),uv:bf.getInterpolation(cy,HS,hy,WS,AH,TN,mH,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){i_.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(uy.x=s*i_.x-r*i_.y,uy.y=r*i_.x+s*i_.y):uy.copy(i_),i.copy(e),i.x+=uy.x,i.y+=uy.y,i.applyMatrix4(QH)}var yf=new ie,EN=new ie,XS=new ie,Bd=new ie,MN=new ie,$S=new ie,CN=new ie,Rf=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,yf)),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=yf.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(yf.copy(this.origin).addScaledVector(this.direction,t),yf.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){EN.copy(e).add(t).multiplyScalar(.5),XS.copy(t).sub(e).normalize(),Bd.copy(this.origin).sub(EN);let s=e.distanceTo(t)*.5,o=-this.direction.dot(XS),a=Bd.dot(this.direction),l=-Bd.dot(XS),c=Bd.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(EN).addScaledVector(XS,p),x}intersectSphere(e,t){yf.subVectors(e.center,this.origin);let n=yf.dot(this.direction),r=yf.dot(yf)-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,yf)!==null}intersectTriangle(e,t,n,r,s){MN.subVectors(t,e),$S.subVectors(n,e),CN.crossVectors(MN,$S);let o=this.direction.dot(CN),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Bd.subVectors(this.origin,e);let l=a*this.direction.dot($S.crossVectors(Bd,$S));if(l<0)return null;let c=a*this.direction.dot(MN.cross(Bd));if(c<0||l+c>o)return null;let u=-a*Bd.dot(CN);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=NA,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}},gH=new on,lA=new Rf,YS=new Wa,_H=new ie,ZS=new ie,KS=new ie,QS=new ie,RN=new ie,JS=new ie,xH=new ie,eT=new ie,Gn=class extends $i{constructor(e=new Wn,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){JS.set(0,0,0);for(let l=0,c=s.length;l<c;l++){let u=a[l],f=s[l];u!==0&&(RN.fromBufferAttribute(f,e),o?JS.addScaledVector(RN,u):JS.addScaledVector(RN.sub(t),u))}t.add(JS)}return t}raycast(e,t){let n=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),YS.copy(n.boundingSphere),YS.applyMatrix4(s),lA.copy(e.ray).recast(e.near),!(YS.containsPoint(lA.origin)===!1&&(lA.intersectSphere(YS,_H)===null||lA.origin.distanceToSquared(_H)>(e.far-e.near)**2))&&(gH.copy(s).invert(),lA.copy(e.ray).applyMatrix4(gH),!(n.boundingBox!==null&&lA.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,lA)))}_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=tT(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=tT(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=tT(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=tT(this,o,e,n,c,u,f,P,R,C),r&&(r.faceIndex=Math.floor(S/3),t.push(r))}}}};function Cce(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===mo,a),l===null)return null;eT.copy(a),eT.applyMatrix4(i.matrixWorld);let c=t.ray.origin.distanceTo(eT);return c<t.near||c>t.far?null:{distance:c,point:eT.clone(),object:i}}function tT(i,e,t,n,r,s,o,a,l,c){i.getVertexPosition(a,ZS),i.getVertexPosition(l,KS),i.getVertexPosition(c,QS);let u=Cce(i,e,t,n,ZS,KS,QS,xH);if(u){let f=new ie;bf.getBarycoord(xH,ZS,KS,QS,f),r&&(u.uv=bf.getInterpolatedAttribute(r,a,l,c,f,new Oe)),s&&(u.uv1=bf.getInterpolatedAttribute(s,a,l,c,f,new Oe)),o&&(u.normal=bf.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};bf.getNormal(ZS,KS,QS,p.normal),u.face=p,u.barycoord=f}return u}var vA=class extends ws{constructor(e=null,t=1,n=1,r,s,o,a,l,c=xi,u=xi,f,p){super(null,o,a,l,c,u,r,s,f,p),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var ml=class extends Ni{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};var PN=new ie,Rce=new ie,Pce=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=PN.subVectors(n,t).cross(Rce.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(PN),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||Pce.getNormalMatrix(e),r=this.coplanarPoint(PN).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)}},cA=new Wa,Ice=new Oe(.5,.5),nT=new ie,Kl=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=Ao,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===Ao)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(),cA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),cA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(cA)}intersectsSprite(e){cA.center.set(0,0,0);let t=Ice.distanceTo(e.center);return cA.radius=.7071067811865476+t,cA.applyMatrix4(e.matrixWorld),this.intersectsSphere(cA)}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(nT.x=r.normal.x>0?e.max.x:e.min.x,nT.y=r.normal.y>0?e.max.y:e.min.y,nT.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(nT)<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)}},yH=new on,vy=class i{constructor(){this.coordinateSystem=Ao,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];yH.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),n[r]===void 0&&(n[r]=new Kl),n[r].setFromProjectionMatrix(yH,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 Kl),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new i().copy(this)}};var zc=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}},_T=new ie,xT=new ie,vH=new on,fy=new Rf,iT=new Wa,IN=new ie,bH=new ie,$d=class extends $i{constructor(e=new Wn,t=new zc){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++)_T.fromBufferAttribute(t,r-1),xT.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=_T.distanceTo(xT);e.setAttribute("lineDistance",new In(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(),iT.copy(n.boundingSphere),iT.applyMatrix4(r),iT.radius+=s,e.ray.intersectsSphere(iT)===!1)return;vH.copy(r).invert(),fy.copy(e.ray).applyMatrix4(vH);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=rT(this,e,fy,l,T,P,w);R&&t.push(R)}if(this.isLineLoop){let w=u.getX(v-1),S=u.getX(x),T=rT(this,e,fy,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=rT(this,e,fy,l,w,w+1,w);T&&t.push(T)}if(this.isLineLoop){let w=rT(this,e,fy,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 rT(i,e,t,n,r,s,o){let a=i.geometry.attributes.position;if(_T.fromBufferAttribute(a,r),xT.fromBufferAttribute(a,s),t.distanceSqToSegment(_T,xT,IN,bH)>n)return;IN.applyMatrix4(i.matrixWorld);let c=e.ray.origin.distanceTo(IN);if(!(c<e.near||c>e.far))return{distance:c,point:bH.clone().applyMatrix4(i.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:i}}var wH=new ie,SH=new ie,A_=class extends $d{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)wH.fromBufferAttribute(t,r),SH.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+wH.distanceTo(SH);e.setAttribute("lineDistance",new In(n,1))}else je("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}};var Yd=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}},TH=new on,zN=new Rf,sT=new Wa,oT=new ie,by=class extends $i{constructor(e=new Wn,t=new Yd){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(),sT.copy(n.boundingSphere),sT.applyMatrix4(r),sT.radius+=s,e.ray.intersectsSphere(sT)===!1)return;TH.copy(r).invert(),zN.copy(e.ray).applyMatrix4(TH);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);oT.fromBufferAttribute(f,S),EH(oT,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++)oT.fromBufferAttribute(f,v),EH(oT,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 EH(i,e,t,n,r,s,o){let a=zN.distanceSqToPoint(i);if(a<t){let l=new ie;zN.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 bA=class extends ws{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=xi,this.minFilter=xi,this.generateMipmaps=!1,this.needsUpdate=!0}};var ku=class extends ws{constructor(e=[],t=_l,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=xi,l=xi,c,u=vs,f=1){if(u!==vs&&u!==Js)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 f_(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}},m_=class extends ls{constructor(e,t=pi,n=_l,r,s,o=xi,a=xi,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}},wy=class extends ws{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}},Vc=class i extends Wn{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 In(c,3)),this.setAttribute("normal",new In(u,3)),this.setAttribute("uv",new In(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 g_=class i extends Wn{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 In(o,3)),this.setAttribute("normal",new In(a,3)),this.setAttribute("uv",new In(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)}},wA=class i extends Wn{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 In(f,3)),this.setAttribute("normal",new In(p,3)),this.setAttribute("uv",new In(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(Pn(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(Pn(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}},__=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}},yT=class extends __{constructor(e,t,n,r,s,o){super(e,t,n,n,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function xL(){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 MH=new ie,CH=new ie,NN=new xL,LN=new xL,DN=new xL,vT=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]:(CH.subVectors(r[0],r[1]).add(r[0]),c=CH);let f=r[a%s],p=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(MH.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=MH),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),NN.initNonuniformCatmullRom(c.x,f.x,p.x,u.x,v,w,S),LN.initNonuniformCatmullRom(c.y,f.y,p.y,u.y,v,w,S),DN.initNonuniformCatmullRom(c.z,f.z,p.z,u.z,v,w,S)}else this.curveType==="catmullrom"&&(NN.initCatmullRom(c.x,f.x,p.x,u.x,this.tension),LN.initCatmullRom(c.y,f.y,p.y,u.y,this.tension),DN.initCatmullRom(c.z,f.z,p.z,u.z,this.tension));return n.set(NN.calc(l),LN.calc(l),DN.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 RH(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 Nce(i,e){let t=1-i;return t*t*e}function Lce(i,e){return 2*(1-i)*i*e}function Dce(i,e){return i*i*e}function my(i,e,t,n){return Nce(i,e)+Lce(i,t)+Dce(i,n)}function Fce(i,e){let t=1-i;return t*t*t*e}function Oce(i,e){let t=1-i;return 3*t*t*i*e}function Bce(i,e){return 3*(1-i)*i*i*e}function Uce(i,e){return i*i*i*e}function gy(i,e,t,n,r){return Fce(i,e)+Oce(i,t)+Bce(i,n)+Uce(i,r)}var Sy=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(gy(e,r.x,s.x,o.x,a.x),gy(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}},x_=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(gy(e,r.x,s.x,o.x,a.x),gy(e,r.y,s.y,o.y,a.y),gy(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}},Ty=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}},bT=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}},Ey=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(my(e,r.x,s.x,o.x),my(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}},My=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(my(e,r.x,s.x,o.x),my(e,r.y,s.y,o.y),my(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}},Cy=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(RH(a,l.x,c.x,u.x,f.x),RH(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}},wT=Object.freeze({__proto__:null,ArcCurve:yT,CatmullRomCurve3:vT,CubicBezierCurve:Sy,CubicBezierCurve3:x_,EllipseCurve:__,LineCurve:Ty,LineCurve3:bT,QuadraticBezierCurve:Ey,QuadraticBezierCurve3:My,SplineCurve:Cy}),ST=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 wT[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 wT[r.type]().fromJSON(r))}return this}},SA=class extends ST{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 Ty(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 Ey(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 Sy(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 Cy(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 __(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}},Ry=class extends SA{constructor(e){super(e),this.uuid=Bu(),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 SA().fromJSON(r))}return this}};function kce(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length,s=JH(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(n&&(s=Hce(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 Py(s,o,t,a,l,c,0),o}function JH(i,e,t,n,r){let s;if(r===tue(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=PH(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=PH(o/n|0,i[o],i[o+1],s);return s&&y_(s,s.next)&&(Ny(s),s=s.next),s}function TA(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(y_(t,t.next)||Nr(t.prev,t,t.next)===0)){if(Ny(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Py(i,e,t,n,r,s,o){if(!i)return;!o&&s&&Yce(i,n,r,s);let a=i;for(;i.prev!==i.next;){let l=i.prev,c=i.next;if(s?zce(i,n,r,s):Gce(i)){e.push(l.i,i.i,c.i),Ny(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=Vce(TA(i),e),Py(i,e,t,n,r,s,2)):o===2&&qce(i,e,t,n,r,s):Py(TA(i),e,t,n,r,s,1);break}}}function Gce(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&&dy(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 zce(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=VN(x,v,e,t,n),P=VN(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&&dy(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&&dy(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&&dy(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&&dy(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 Vce(i,e){let t=i;do{let n=t.prev,r=t.next.next;!y_(n,r)&&tW(n,t,t.next,r)&&Iy(n,r)&&Iy(r,n)&&(e.push(n.i,t.i,r.i),Ny(t),Ny(t.next),t=i=r),t=t.next}while(t!==i);return TA(t)}function qce(i,e,t,n,r,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Qce(o,a)){let l=nW(o,a);o=TA(o,o.next),l=TA(l,l.next),Py(o,e,t,n,r,s,0),Py(l,e,t,n,r,s,0);return}a=a.next}o=o.next}while(o!==i)}function Hce(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=JH(i,a,l,n,!1);c===c.next&&(c.steiner=!0),r.push(Kce(c))}r.sort(Wce);for(let s=0;s<r.length;s++)t=jce(r[s],t);return t}function Wce(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 jce(i,e){let t=Xce(i,e);if(!t)return e;let n=nW(t,i);return TA(n,n.next),TA(t,t.next)}function Xce(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(y_(i,t))return t;do{if(y_(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&&eW(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);Iy(t,i)&&(f<u||f===u&&(t.x>o.x||t.x===o.x&&$ce(o,t)))&&(o=t,u=f)}t=t.next}while(t!==a);return o}function $ce(i,e){return Nr(i.prev,i,e.prev)<0&&Nr(e.next,i,i.next)<0}function Yce(i,e,t,n){let r=i;do r.z===0&&(r.z=VN(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,Zce(r)}function Zce(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 VN(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 Kce(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 eW(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 dy(i,e,t,n,r,s,o,a){return!(i===o&&e===a)&&eW(i,e,t,n,r,s,o,a)}function Qce(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!Jce(i,e)&&(Iy(i,e)&&Iy(e,i)&&eue(i,e)&&(Nr(i.prev,i,e.prev)||Nr(i,e.prev,e))||y_(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 y_(i,e){return i.x===e.x&&i.y===e.y}function tW(i,e,t,n){let r=lT(Nr(i,e,t)),s=lT(Nr(i,e,n)),o=lT(Nr(t,n,i)),a=lT(Nr(t,n,e));return!!(r!==s&&o!==a||r===0&&aT(i,t,e)||s===0&&aT(i,n,e)||o===0&&aT(t,i,n)||a===0&&aT(t,e,n))}function aT(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 lT(i){return i>0?1:i<0?-1:0}function Jce(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&&tW(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Iy(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 eue(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 nW(i,e){let t=qN(i.i,i.x,i.y),n=qN(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 PH(i,e,t,n){let r=qN(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 Ny(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 qN(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function tue(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 HN=class{static triangulate(e,t,n=2){return kce(e,t,n)}},kd=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=[];IH(e),NH(n,e);let o=e.length;t.forEach(IH);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,NH(n,t[l]);let a=HN.triangulate(n,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function IH(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function NH(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var Ly=class i extends Wn{constructor(e=new Ry([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 In(r,3)),this.setAttribute("uv",new In(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:nue,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(!kd.isClockWise(z)){z=z.reverse();for(let Xe=0,st=V.length;Xe<st;Xe++){let tt=V[Xe];kd.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=kd.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=kd.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 iue(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 wT[r.type]().fromJSON(r)),new i(n,e.options)}},nue={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 iue(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 EA=class i extends Wn{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 In(v,3)),this.setAttribute("normal",new In(w,3)),this.setAttribute("uv",new In(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 Wn{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 In(v,3)),this.setAttribute("normal",new In(w,3)),this.setAttribute("uv",new In(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 Dy=class i extends Wn{constructor(e=new My(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 In(f,3)),this.setAttribute("normal",new In(p,3)),this.setAttribute("uv",new In(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 wT[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}},Fy=class extends Wn{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),LH(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),LH(r,s,n)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new In(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}};function LH(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 Oy=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 qA(i){let e={};for(let t in i){e[t]={};for(let n in i[t]){let r=i[t][n];if(DH(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(DH(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=qA(i[t]);for(let r in n)e[r]=n[r]}return e}function DH(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function rue(i){let e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function yL(i){let e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:sn.workingColorSpace}var HA={clone:qA,merge:Ho},sue=`void main() {1010 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );11-}`,Jce=`void main() {11+}`,oue=`void main() {1212 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );13-}`,Xr=class extends ws{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Qce,this.fragmentShader=Jce,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=zA(e.uniforms),this.uniformsGroups=Kce(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}},bT=class extends Xr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},x_=class extends ws{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ut(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ha,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}},Fy=class extends x_{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Oe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Pn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ut(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ut(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ut(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},TA=class extends ws{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ut(16777215),this.specular=new Ut(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ha,this.combine=PA,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}},Oy=class extends ws{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ut(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},By=class extends ws{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}},Aa=class extends ws{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ha,this.combine=PA,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}},wT=class extends ws{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=HH,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}},ST=class extends ws{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},Uy=class extends ws{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ut(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=_l,this.normalScale=new Oe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}},ky=class extends kc{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};function oT(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var $d=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],s=t[n-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=n+2;;){if(r===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=r,r=t[++n],e<r)break t}o=t.length;break n}if(!(e>=s)){let a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(r=s,s=t[--n-1],e>=s)break t}o=n,n=0;break n}break e}for(;n<o;){let a=n+o>>>1;e<t[a]?o=a:n=a+1}if(r=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,r)}return this.interpolate_(n,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=n[s+o];return t}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}},TT=class extends $d{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:FN,endingEnd:FN}}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 ON:s=e,a=2*t-n;break;case BN: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 ON:o=e,l=2*n-t;break;case BN: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}},ET=class extends $d{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(n-t)/(r-t),f=1-u;for(let p=0;p!==a;++p)s[p]=o[c+p]*f+o[l+p]*u;return s}},MT=class extends $d{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},CT=class extends $d{interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this.inTangents,f=this.outTangents;if(!u||!f){let 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}},ml=class{constructor(e,t,n,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=oT(t,this.TimeBufferType),this.values=oT(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:oT(e.times,Array),values:oT(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new MT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new ET(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new TT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new CT(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 my:t=this.InterpolantFactoryMethodDiscrete;break;case fT:t=this.InterpolantFactoryMethodLinear;break;case uT:t=this.InterpolantFactoryMethodSmooth;break;case DN: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 my;case this.InterpolantFactoryMethodLinear:return fT;case this.InterpolantFactoryMethodSmooth:return uT;case this.InterpolantFactoryMethodBezier:return DN}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e}return this}trim(e,t){let n=this.times,r=n.length,s=0,o=r-1;for(;s!==r&&n[s]<e;)++s;for(;o!==-1&&n[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=n.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(Ge("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,r=this.values,s=n.length;s===0&&(Ge("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){Ge("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){Ge("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&E_(r))for(let a=0,l=r.length;a!==l;++a){let c=r[a];if(isNaN(c)){Ge("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===uT,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}};ml.prototype.ValueTypeName="";ml.prototype.TimeBufferType=Float32Array;ml.prototype.ValueBufferType=Float32Array;ml.prototype.DefaultInterpolation=fT;var Yd=class extends ml{constructor(e,t,n){super(e,t,n)}};Yd.prototype.ValueTypeName="bool";Yd.prototype.ValueBufferType=Array;Yd.prototype.DefaultInterpolation=my;Yd.prototype.InterpolantFactoryMethodLinear=void 0;Yd.prototype.InterpolantFactoryMethodSmooth=void 0;var RT=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}};RT.prototype.ValueTypeName="color";var PT=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}};PT.prototype.ValueTypeName="number";var IT=class extends $d{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(r-t),c=e*a;for(let u=c+a;c!==u;c+=4)vs.slerpFlat(s,0,o,c-a,o,c,l);return s}},Gy=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new IT(this.times,this.values,this.getValueSize(),e)}};Gy.prototype.ValueTypeName="quaternion";Gy.prototype.InterpolantFactoryMethodSmooth=void 0;var Zd=class extends ml{constructor(e,t,n){super(e,t,n)}};Zd.prototype.ValueTypeName="string";Zd.prototype.ValueBufferType=Array;Zd.prototype.DefaultInterpolation=my;Zd.prototype.InterpolantFactoryMethodLinear=void 0;Zd.prototype.InterpolantFactoryMethodSmooth=void 0;var NT=class extends ml{constructor(e,t,n,r){super(e,t,n,r)}};NT.prototype.ValueTypeName="vector";var hT={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(IH(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!IH(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function IH(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var LT=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}},JH=new LT,Kd=class{constructor(e){this.manager=e!==void 0?e:JH,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let n=this;return new Promise(function(r,s){n.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};Kd.DEFAULT_MATERIAL_NAME="__DEFAULT";var n_=new WeakMap,DT=class extends Kd{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=hT.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0);else{let f=n_.get(o);f===void 0&&(f=[],n_.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=l_("img");function l(){u(),t&&t(this);let f=n_.get(this)||[];for(let p=0;p<f.length;p++){let x=f[p];x.onLoad&&x.onLoad(this)}n_.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),hT.remove(`image:${e}`);let p=n_.get(this)||[];for(let x=0;x<p.length;x++){let v=p[x];v.onError&&v.onError(f)}n_.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),hT.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var zc=class extends Kd{constructor(e){super(e)}load(e,t,n,r){let s=new bs,o=new DT(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}},ku=class extends $i{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ut(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},zy=class extends ku{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy($i.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ut(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},NN=new on,NH=new ie,LH=new ie,Vy=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Oe(512,512),this.mapType=Gi,this.map=null,this.mapPass=null,this.matrix=new on,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Zl,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;NH.setFromMatrixPosition(e.matrixWorld),t.position.copy(NH),LH.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(LH),t.updateMatrixWorld(),NN.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(NN,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===qa||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(NN)}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,lT=new vs,Fu=new ie,Rf=class extends $i{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new on,this.projectionMatrix=new on,this.projectionMatrixInverse=new on,this.coordinateSystem=po,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,lT,Fu),Fu.x===1&&Fu.y===1&&Fu.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(aT,lT,Fu.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(aT,lT,Fu),Fu.x===1&&Fu.y===1&&Fu.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(aT,lT,Fu.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Od=new ie,DH=new Oe,FH=new Oe,Rr=class extends Rf{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Ef*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(fy*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ef*2*Math.atan(Math.tan(fy*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Od.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Od.x,Od.y).multiplyScalar(-e/Od.z),Od.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Od.x,Od.y).multiplyScalar(-e/Od.z)}getViewSize(e,t){return this.getViewBounds(e,DH,FH),t.subVectors(FH,DH)}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(fy*.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}},VN=class extends Vy{constructor(){super(new Rr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Ef*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},EA=class extends ku{constructor(e,t,n=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy($i.DEFAULT_UP),this.updateMatrix(),this.target=new $i,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new VN}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 Vy{constructor(){super(new Rr(90,1,.5,500)),this.isPointLightShadow=!0}},qy=class extends ku{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}},Vc=class extends Rf{constructor(e=-1,t=1,n=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,s=n-e,o=n+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){let c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},HN=class extends Vy{constructor(){super(new Vc(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},MA=class extends ku{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy($i.DEFAULT_UP),this.updateMatrix(),this.target=new $i,this.shadow=new HN}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}},CA=class extends ku{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},Hy=class extends ku{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}},FT=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)}},Wy=class extends ku{constructor(e=new FT,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 jy=class extends Kn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};var i_=-90,r_=1,y_=class extends $i{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Rr(i_,r_,e,t);r.layers=this.layers,this.add(r);let s=new Rr(i_,r_,e,t);s.layers=this.layers,this.add(s);let o=new Rr(i_,r_,e,t);o.layers=this.layers,this.add(o);let a=new Rr(i_,r_,e,t);a.layers=this.layers,this.add(a);let l=new Rr(i_,r_,e,t);l.layers=this.layers,this.add(l);let c=new Rr(i_,r_,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,s,o,a,l]=t;for(let c of t)this.remove(c);if(e===po)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===qa)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}},v_=class extends Rr{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},RA=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=eue.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 eue(){this._document.hidden===!1&&this.reset()}var _L="\\[\\]\\.:\\/",tue=new RegExp("["+_L+"]","g"),xL="[^"+_L+"]",nue="[^"+_L.replace("\\.","")+"]",iue=/((?:WC+[\/:])*)/.source.replace("WC",xL),rue=/(WCOD+)?/.source.replace("WCOD",nue),sue=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",xL),oue=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",xL),aue=new RegExp("^"+iue+rue+sue+oue+"$"),lue=["material","materials","bones","map"],WN=class{constructor(e,t,n){let r=n||cr.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=n.length;r!==s;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},cr=class i{constructor(e,t,n){this.path=t,this.parsedPath=n||i.parseTrackName(t),this.node=i.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new i.Composite(e,t,n):new i(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(tue,"")}static parseTrackName(e){let t=aue.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);lue.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let r=0,s=n.length;r!==s;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=i.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){je("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let c=t.objectIndex;switch(n){case"materials":if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Ge("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Ge("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Ge("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Ge("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Ge("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(c!==void 0){if(e[c]===void 0){Ge("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let o=e[r];if(o===void 0){let c=t.nodeName;Ge("PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){Ge("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Ge("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};cr.Composite=WN;cr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};cr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};cr.prototype.GetterByBindingType=[cr.prototype._getValue_direct,cr.prototype._getValue_array,cr.prototype._getValue_arrayElement,cr.prototype._getValue_toArray];cr.prototype.SetterByBindingTypeAndVersioning=[[cr.prototype._setValue_direct,cr.prototype._setValue_direct_setNeedsUpdate,cr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[cr.prototype._setValue_array,cr.prototype._setValue_array_setNeedsUpdate,cr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[cr.prototype._setValue_arrayElement,cr.prototype._setValue_arrayElement_setNeedsUpdate,cr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[cr.prototype._setValue_fromArray,cr.prototype._setValue_fromArray_setNeedsUpdate,cr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Tze=new Float32Array(1);var Gu=class extends Mf{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};var OH=new on,Xy=class{constructor(e,t,n=0,r=1/0){this.ray=new Cf(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new h_,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Ge("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return OH.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(OH),this}intersectObject(e,t=!0,n=[]){return jN(e,this,n,t),n.sort(BH),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)jN(e[r],this,n,t);return n.sort(BH),n}};function BH(i,e){return i.distance-e.distance}function jN(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++)jN(s[o],e,t,!0)}}var b_=class{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Pn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Pn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var SL=class SL{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}};SL.prototype.isMatrix2=!0;var w_=SL,UH=new Oe,OT=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=UH.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,UH).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)}},kH=new ie,cT=new ie,s_=new ie,o_=new ie,LN=new ie,cue=new ie,uue=new ie,$y=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){kH.subVectors(e,this.start),cT.subVectors(this.end,this.start);let n=cT.dot(cT);if(n===0)return 0;let s=cT.dot(kH)/n;return t&&(s=Pn(s,0,1)),s}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=cue,n=uue){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;s_.subVectors(c,a),o_.subVectors(u,l),LN.subVectors(a,l);let f=s_.dot(s_),p=o_.dot(o_),x=o_.dot(LN);if(f<=r&&p<=r)return t.copy(a),n.copy(l),t.sub(n),t.dot(t);if(f<=r)s=0,o=x/p,o=Pn(o,0,1);else{let v=s_.dot(LN);if(p<=r)o=0,s=Pn(-v/f,0,1);else{let w=s_.dot(o_),S=f*p-w*w;S!==0?s=Pn((w*x-v*p)/S,0,1):s=0,o=(w*s+x)/p,o<0?(o=0,s=Pn(-v/f,0,1)):o>1&&(o=1,s=Pn((w-v)/f,0,1))}}return t.copy(a).addScaledVector(s_,s),n.copy(l).addScaledVector(o_,o),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}};var Yy=class{constructor(){this.type="ShapePath",this.color=new Ut,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new bA,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=Bd.area(c);if(u===0)continue;let f=new OT;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 My;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 bA;u.curves=l.subPath.curves,c.holes.push(u)}return o}},Pf=class extends Go{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 w2(i,e,t,n){let r=hue(n);switch(t){case S_:return i*e;case Lf:return i*e/r.components*r.byteLength;case Xu:return i*e/r.components*r.byteLength;case Ss:return i*e*2/r.components*r.byteLength;case $u:return i*e*2/r.components*r.byteLength;case Nf:return i*e*3/r.components*r.byteLength;case xr:return i*e*4/r.components*r.byteLength;case ip:return i*e*4/r.components*r.byteLength;case Yu:case Zu:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Ku:case Qu:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case OA:case UA:return Math.max(i,16)*Math.max(e,8)/4;case FA:case BA:return Math.max(i,8)*Math.max(e,8)/2;case rp:case sp:case ap:case lp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case op:case Ju:case cp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case up:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case hp:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case fp:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case dp:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case pp:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case Ap:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case mp:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case gp:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case _p:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case xp:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case yp:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case vp:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case bp:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case wp:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Sp:case Tp:case Ep:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Mp:case Cp:return Math.ceil(i/4)*Math.ceil(e/4)*8;case eh:case Rp:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function hue(i){switch(i){case Gi:case Wu:return{byteLength:1,components:1};case Wa:case ju:case Li:return{byteLength:2,components:1};case IA:case NA:return{byteLength:2,components:4};case pi:case Ir:case Yi:return{byteLength:4,components:1};case LA:case DA: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 wW(){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 pue(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 Aue=`#ifdef USE_ALPHAHASH13+}`,$r=class extends Ss{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=sue,this.fragmentShader=oue,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=qA(e.uniforms),this.uniformsGroups=rue(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}},TT=class extends $r{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}},v_=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=xl,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}},By=class extends v_{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Oe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Pn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Ut(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ut(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ut(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},MA=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=xl,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=NA,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}},Uy=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=xl,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}},ky=class extends Ss{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xl,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=xl,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=NA,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}},ET=class extends Ss{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=$H,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}},MT=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}},Gy=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=xl,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}},zy=class extends zc{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 cT(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}var Zd=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_(){}},CT=class extends Zd{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:UN,endingEnd:UN}}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 kN:s=e,a=2*t-n;break;case GN: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 kN:o=e,l=2*n-t;break;case GN: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}},RT=class extends Zd{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}},PT=class extends Zd{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}},IT=class extends Zd{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}},gl=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=cT(t,this.TimeBufferType),this.values=cT(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:cT(e.times,Array),values:cT(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new PT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new RT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new CT(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new IT(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 _y:t=this.InterpolantFactoryMethodDiscrete;break;case AT:t=this.InterpolantFactoryMethodLinear;break;case dT:t=this.InterpolantFactoryMethodSmooth;break;case BN: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 _y;case this.InterpolantFactoryMethodLinear:return AT;case this.InterpolantFactoryMethodSmooth:return dT;case this.InterpolantFactoryMethodBezier:return BN}}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&&C_(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()===dT,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}};gl.prototype.ValueTypeName="";gl.prototype.TimeBufferType=Float32Array;gl.prototype.ValueBufferType=Float32Array;gl.prototype.DefaultInterpolation=AT;var Kd=class extends gl{constructor(e,t,n){super(e,t,n)}};Kd.prototype.ValueTypeName="bool";Kd.prototype.ValueBufferType=Array;Kd.prototype.DefaultInterpolation=_y;Kd.prototype.InterpolantFactoryMethodLinear=void 0;Kd.prototype.InterpolantFactoryMethodSmooth=void 0;var NT=class extends gl{constructor(e,t,n,r){super(e,t,n,r)}};NT.prototype.ValueTypeName="color";var LT=class extends gl{constructor(e,t,n,r){super(e,t,n,r)}};LT.prototype.ValueTypeName="number";var DT=class extends Zd{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}},Vy=class extends gl{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new DT(this.times,this.values,this.getValueSize(),e)}};Vy.prototype.ValueTypeName="quaternion";Vy.prototype.InterpolantFactoryMethodSmooth=void 0;var Qd=class extends gl{constructor(e,t,n){super(e,t,n)}};Qd.prototype.ValueTypeName="string";Qd.prototype.ValueBufferType=Array;Qd.prototype.DefaultInterpolation=_y;Qd.prototype.InterpolantFactoryMethodLinear=void 0;Qd.prototype.InterpolantFactoryMethodSmooth=void 0;var FT=class extends gl{constructor(e,t,n,r){super(e,t,n,r)}};FT.prototype.ValueTypeName="vector";var pT={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(FH(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!FH(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function FH(i){try{let e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var OT=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}},iW=new OT,Jd=class{constructor(e){this.manager=e!==void 0?e:iW,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}};Jd.DEFAULT_MATERIAL_NAME="__DEFAULT";var r_=new WeakMap,BT=class extends Jd{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=pT.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=r_.get(o);f===void 0&&(f=[],r_.set(o,f)),f.push({onLoad:t,onError:r})}return o}let a=u_("img");function l(){u(),t&&t(this);let f=r_.get(this)||[];for(let p=0;p<f.length;p++){let x=f[p];x.onLoad&&x.onLoad(this)}r_.delete(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),pT.remove(`image:${e}`);let p=r_.get(this)||[];for(let x=0;x<p.length;x++){let v=p[x];v.onError&&v.onError(f)}r_.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),pT.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}};var Ql=class extends Jd{constructor(e){super(e)}load(e,t,n,r){let s=new ws,o=new BT(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}},Gu=class extends $i{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ut(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},qy=class extends Gu{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy($i.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ut(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},FN=new on,OH=new ie,BH=new ie,Hy=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Oe(512,512),this.mapType=Gi,this.map=null,this.mapPass=null,this.matrix=new on,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Kl,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;OH.setFromMatrixPosition(e.matrixWorld),t.position.copy(OH),BH.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(BH),t.updateMatrixWorld(),FN.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(FN,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(FN)}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}},uT=new ie,hT=new bs,Ou=new ie,Pf=class extends $i{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new on,this.projectionMatrix=new on,this.projectionMatrixInverse=new on,this.coordinateSystem=Ao,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(uT,hT,Ou),Ou.x===1&&Ou.y===1&&Ou.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(uT,hT,Ou.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(uT,hT,Ou),Ou.x===1&&Ou.y===1&&Ou.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(uT,hT,Ou.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},Ud=new ie,UH=new Oe,kH=new Oe,Ir=class extends Pf{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=Mf*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(py*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Mf*2*Math.atan(Math.tan(py*.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){Ud.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Ud.x,Ud.y).multiplyScalar(-e/Ud.z),Ud.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ud.x,Ud.y).multiplyScalar(-e/Ud.z)}getViewSize(e,t){return this.getViewBounds(e,UH,kH),t.subVectors(kH,UH)}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(py*.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}},WN=class extends Hy{constructor(){super(new Ir(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Mf*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}},CA=class extends Gu{constructor(e,t,n=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy($i.DEFAULT_UP),this.updateMatrix(),this.target=new $i,this.distance=n,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new WN}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}},jN=class extends Hy{constructor(){super(new Ir(90,1,.5,500)),this.isPointLightShadow=!0}},Wy=class extends Gu{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 jN}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}},qc=class extends Pf{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}},XN=class extends Hy{constructor(){super(new qc(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},RA=class extends Gu{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy($i.DEFAULT_UP),this.updateMatrix(),this.target=new $i,this.shadow=new XN}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}},PA=class extends Gu{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}},jy=class extends Gu{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}},UT=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)}},Xy=class extends Gu{constructor(e=new UT,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 $y=class extends Wn{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 s_=-90,o_=1,b_=class extends $i{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new Ir(s_,o_,e,t);r.layers=this.layers,this.add(r);let s=new Ir(s_,o_,e,t);s.layers=this.layers,this.add(s);let o=new Ir(s_,o_,e,t);o.layers=this.layers,this.add(o);let a=new Ir(s_,o_,e,t);a.layers=this.layers,this.add(a);let l=new Ir(s_,o_,e,t);l.layers=this.layers,this.add(l);let c=new Ir(s_,o_,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===Ao)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}},w_=class extends Ir{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},IA=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=aue.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 aue(){this._document.hidden===!1&&this.reset()}var vL="\\[\\]\\.:\\/",lue=new RegExp("["+vL+"]","g"),bL="[^"+vL+"]",cue="[^"+vL.replace("\\.","")+"]",uue=/((?:WC+[\/:])*)/.source.replace("WC",bL),hue=/(WCOD+)?/.source.replace("WCOD",cue),fue=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",bL),due=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",bL),pue=new RegExp("^"+uue+hue+fue+due+"$"),Aue=["material","materials","bones","map"],$N=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(lue,"")}static parseTrackName(e){let t=pue.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);Aue.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=$N;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 Fze=new Float32Array(1);var zu=class extends Cf{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 GH=new on,Yy=class{constructor(e,t,n=0,r=1/0){this.ray=new Rf(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new d_,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 GH.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(GH),this}intersectObject(e,t=!0,n=[]){return YN(e,this,n,t),n.sort(zH),n}intersectObjects(e,t=!0,n=[]){for(let r=0,s=e.length;r<s;r++)YN(e[r],this,n,t);return n.sort(zH),n}};function zH(i,e){return i.distance-e.distance}function YN(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++)YN(s[o],e,t,!0)}}var S_=class{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Pn(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Pn(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var ML=class ML{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}};ML.prototype.isMatrix2=!0;var T_=ML,VH=new Oe,kT=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=VH.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,VH).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)}},qH=new ie,fT=new ie,a_=new ie,l_=new ie,ON=new ie,mue=new ie,gue=new ie,Zy=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){qH.subVectors(e,this.start),fT.subVectors(this.end,this.start);let n=fT.dot(fT);if(n===0)return 0;let s=fT.dot(qH)/n;return t&&(s=Pn(s,0,1)),s}closestPointToPoint(e,t,n){let r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=mue,n=gue){let r=10000000000000001e-32,s,o,a=this.start,l=e.start,c=this.end,u=e.end;a_.subVectors(c,a),l_.subVectors(u,l),ON.subVectors(a,l);let f=a_.dot(a_),p=l_.dot(l_),x=l_.dot(ON);if(f<=r&&p<=r)return t.copy(a),n.copy(l),t.sub(n),t.dot(t);if(f<=r)s=0,o=x/p,o=Pn(o,0,1);else{let v=a_.dot(ON);if(p<=r)o=0,s=Pn(-v/f,0,1);else{let w=a_.dot(l_),S=f*p-w*w;S!==0?s=Pn((w*x-v*p)/S,0,1):s=0,o=(w*s+x)/p,o<0?(o=0,s=Pn(-v/f,0,1)):o>1&&(o=1,s=Pn((w-v)/f,0,1))}}return t.copy(a).addScaledVector(a_,s),n.copy(l).addScaledVector(l_,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 Ky=class{constructor(){this.type="ShapePath",this.color=new Ut,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new SA,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=kd.area(c);if(u===0)continue;let f=new kT;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 Ry;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 SA;u.curves=l.subPath.curves,c.holes.push(u)}return o}},If=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 T2(i,e,t,n){let r=_ue(n);switch(t){case E_:return i*e;case Df:return i*e/r.components*r.byteLength;case $u:return i*e/r.components*r.byteLength;case Ts:return i*e*2/r.components*r.byteLength;case Yu:return i*e*2/r.components*r.byteLength;case Lf:return i*e*3/r.components*r.byteLength;case vr:return i*e*4/r.components*r.byteLength;case sp:return i*e*4/r.components*r.byteLength;case Zu:case Ku:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case Qu:case Ju:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case UA:case GA:return Math.max(i,16)*Math.max(e,8)/4;case BA:case kA:return Math.max(i,8)*Math.max(e,8)/2;case op:case ap:case cp:case up:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case lp:case eh:case hp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case fp:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case dp:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case pp:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case Ap:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case mp:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case gp:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case _p:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case xp:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case yp:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case vp:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case bp:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case wp:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case Sp:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case Tp:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Ep:case Mp:case Cp:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Rp:case Pp:return Math.ceil(i/4)*Math.ceil(e/4)*8;case th:case Ip:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function _ue(i){switch(i){case Gi:case ju:return{byteLength:1,components:1};case ja:case Xu:case Li:return{byteLength:2,components:1};case LA:case DA:return{byteLength:2,components:4};case pi:case Lr:case Yi:return{byteLength:4,components:1};case FA:case OA: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 MW(){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 vue(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`,mue=`#ifdef USE_ALPHAHASH15+#endif`,wue=`#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`,gue=`#ifdef USE_ALPHAMAP50+#endif`,Sue=`#ifdef USE_ALPHAMAP5151 diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;52-#endif`,_ue=`#ifdef USE_ALPHAMAP52+#endif`,Tue=`#ifdef USE_ALPHAMAP5353 uniform sampler2D alphaMap;54-#endif`,xue=`#ifdef USE_ALPHATEST54+#endif`,Eue=`#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`,yue=`#ifdef USE_ALPHATEST61+#endif`,Mue=`#ifdef USE_ALPHATEST6262 uniform float alphaTest;63-#endif`,vue=`#ifdef USE_AOMAP63+#endif`,Cue=`#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`,bue=`#ifdef USE_AOMAP76+#endif`,Rue=`#ifdef USE_AOMAP7777 uniform sampler2D aoMap;7878 uniform float aoMapIntensity;79-#endif`,wue=`#ifdef USE_BATCHING79+#endif`,Pue=`#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`,Sue=`#ifdef USE_BATCHING113+#endif`,Iue=`#ifdef USE_BATCHING114114 mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );115-#endif`,Tue=`vec3 transformed = vec3( position );115+#endif`,Nue=`vec3 transformed = vec3( position );116116 #ifdef USE_ALPHAHASH117117 vPosition = vec3( position );118-#endif`,Eue=`vec3 objectNormal = vec3( normal );118+#endif`,Lue=`vec3 objectNormal = vec3( normal );119119 #ifdef USE_TANGENT120120 vec3 objectTangent = vec3( tangent.xyz );121-#endif`,Mue=`float G_BlinnPhong_Implicit( ) {121+#endif`,Due=`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`,Cue=`#ifdef USE_IRIDESCENCE135+} // validated`,Fue=`#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`,Rue=`#ifdef USE_BUMPMAP198+#endif`,Oue=`#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`,Pue=`#if NUM_CLIPPING_PLANES > 0219+#endif`,Bue=`#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`,Iue=`#if NUM_CLIPPING_PLANES > 0265+#endif`,Uue=`#if NUM_CLIPPING_PLANES > 0266266 varying vec3 vClipPosition;267267 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];268-#endif`,Nue=`#if NUM_CLIPPING_PLANES > 0268+#endif`,kue=`#if NUM_CLIPPING_PLANES > 0269269 varying vec3 vClipPosition;270-#endif`,Lue=`#if NUM_CLIPPING_PLANES > 0270+#endif`,Gue=`#if NUM_CLIPPING_PLANES > 0271271 vClipPosition = - mvPosition.xyz;272-#endif`,Due=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )272+#endif`,zue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )273273 diffuseColor *= vColor;274-#endif`,Fue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )274+#endif`,Vue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )275275 varying vec4 vColor;276-#endif`,Oue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )276+#endif`,que=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )277277 varying vec4 vColor;278-#endif`,Bue=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )278+#endif`,Hue=`#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`,Uue=`#define PI 3.141592653589793291+#endif`,Wue=`#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`,kue=`#ifdef ENVMAP_TYPE_CUBE_UV362+} // validated`,jue=`#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`,Gue=`vec3 transformedNormal = objectNormal;455+#endif`,Xue=`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`,zue=`#ifdef USE_DISPLACEMENTMAP481+#endif`,$ue=`#ifdef USE_DISPLACEMENTMAP482482 uniform sampler2D displacementMap;483483 uniform float displacementScale;484484 uniform float displacementBias;485-#endif`,Vue=`#ifdef USE_DISPLACEMENTMAP485+#endif`,Yue=`#ifdef USE_DISPLACEMENTMAP486486 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );487-#endif`,que=`#ifdef USE_EMISSIVEMAP487+#endif`,Zue=`#ifdef USE_EMISSIVEMAP488488 vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );489489 #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE490490 emissiveColor = sRGBTransferEOTF( emissiveColor );491491 #endif492492 totalEmissiveRadiance *= emissiveColor.rgb;493-#endif`,Hue=`#ifdef USE_EMISSIVEMAP493+#endif`,Kue=`#ifdef USE_EMISSIVEMAP494494 uniform sampler2D emissiveMap;495-#endif`,Wue="gl_FragColor = linearToOutputTexel( gl_FragColor );",jue=`vec4 LinearTransferOETF( in vec4 value ) {495+#endif`,Que="gl_FragColor = linearToOutputTexel( gl_FragColor );",Jue=`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-}`,Xue=`#ifdef USE_ENVMAP503+}`,ehe=`#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`,$ue=`#ifdef USE_ENVMAP530+#endif`,the=`#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`,Yue=`#ifdef USE_ENVMAP538+#endif`,nhe=`#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`,Zue=`#ifdef USE_ENVMAP549+#endif`,ihe=`#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`,Kue=`#ifdef USE_ENVMAP560+#endif`,rhe=`#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`,Que=`#ifdef USE_FOG577+#endif`,she=`#ifdef USE_FOG578578 vFogDepth = - mvPosition.z;579-#endif`,Jue=`#ifdef USE_FOG579+#endif`,ohe=`#ifdef USE_FOG580580 varying float vFogDepth;581-#endif`,ehe=`#ifdef USE_FOG581+#endif`,ahe=`#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`,the=`#ifdef USE_FOG588+#endif`,lhe=`#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`,nhe=`#ifdef USE_GRADIENTMAP597+#endif`,che=`#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-}`,ihe=`#ifdef USE_LIGHTMAP609+}`,uhe=`#ifdef USE_LIGHTMAP610610 uniform sampler2D lightMap;611611 uniform float lightMapIntensity;612-#endif`,rhe=`LambertMaterial material;612+#endif`,hhe=`LambertMaterial material;613613 material.diffuseColor = diffuseColor.rgb;614-material.specularStrength = specularStrength;`,she=`varying vec3 vViewPosition;614+material.specularStrength = specularStrength;`,fhe=`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`,ohe=`uniform bool receiveShadow;628+#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,dhe=`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>`,ahe=`#ifdef USE_ENVMAP745+#include <lightprobes_pars_fragment>`,phe=`#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`,lhe=`ToonMaterial material;779-material.diffuseColor = diffuseColor.rgb;`,che=`varying vec3 vViewPosition;778+#endif`,Ahe=`ToonMaterial material;779+material.diffuseColor = diffuseColor.rgb;`,mhe=`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`,uhe=`BlinnPhongMaterial material;791+#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,ghe=`BlinnPhongMaterial material;792792 material.diffuseColor = diffuseColor.rgb;793793 material.specularColor = specular;794794 material.specularShininess = shininess;795-material.specularStrength = specularStrength;`,hhe=`varying vec3 vViewPosition;795+material.specularStrength = specularStrength;`,_he=`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`,fhe=`PhysicalMaterial material;812+#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,xhe=`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`,dhe=`uniform sampler2D dfgLUT;902+#endif`,yhe=`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-}`,phe=`1262+}`,vhe=`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`,Ahe=`#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`,mhe=`#if defined( RE_IndirectDiffuse )1405+#endif`,whe=`#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`,ghe=`#ifdef USE_LIGHT_PROBES_GRID1413+#endif`,She=`#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`,_he=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1458+#endif`,The=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )14591459 gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;1460-#endif`,xhe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )1460+#endif`,Ehe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )14611461 uniform float logDepthBufFC;14621462 varying float vFragDepth;14631463 varying float vIsPerspective;1464-#endif`,yhe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1464+#endif`,Mhe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER14651465 varying float vFragDepth;14661466 varying float vIsPerspective;1467-#endif`,vhe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER1467+#endif`,Che=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER14681468 vFragDepth = 1.0 + gl_Position.w;14691469 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );1470-#endif`,bhe=`#ifdef USE_MAP1470+#endif`,Rhe=`#ifdef USE_MAP14711471 vec4 sampledDiffuseColor = texture2D( map, vMapUv );14721472 #ifdef DECODE_VIDEO_TEXTURE14731473 sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );14741474 #endif14751475 diffuseColor *= sampledDiffuseColor;1476-#endif`,whe=`#ifdef USE_MAP1476+#endif`,Phe=`#ifdef USE_MAP14771477 uniform sampler2D map;1478-#endif`,She=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )1478+#endif`,Ihe=`#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`,The=`#if defined( USE_POINTS_UV )1490+#endif`,Nhe=`#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`,Ehe=`float metalnessFactor = metalness;1502+#endif`,Lhe=`float metalnessFactor = metalness;15031503 #ifdef USE_METALNESSMAP15041504 vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );15051505 metalnessFactor *= texelMetalness.b;1506-#endif`,Mhe=`#ifdef USE_METALNESSMAP1506+#endif`,Dhe=`#ifdef USE_METALNESSMAP15071507 uniform sampler2D metalnessMap;1508-#endif`,Che=`#ifdef USE_INSTANCING_MORPH1508+#endif`,Fhe=`#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`,Rhe=`#if defined( USE_MORPHCOLORS )1514+#endif`,Ohe=`#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`,Phe=`#ifdef USE_MORPHNORMALS1523+#endif`,Bhe=`#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`,Ihe=`#ifdef USE_MORPHTARGETS1528+#endif`,Uhe=`#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`,Nhe=`#ifdef USE_MORPHTARGETS1542+#endif`,khe=`#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`,Lhe=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;1547+#endif`,Ghe=`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;`,Dhe=`#ifdef USE_NORMALMAP_OBJECTSPACE1588+vec3 nonPerturbedNormal = normal;`,zhe=`#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;`,Dhe=`#ifdef USE_NORMALMAP_OBJECTSPACE
16031603 normal = normalize( tbn * mapN );16041604 #elif defined( USE_BUMPMAP )16051605 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );1606-#endif`,Fhe=`#ifndef FLAT_SHADED1606+#endif`,Vhe=`#ifndef FLAT_SHADED16071607 varying vec3 vNormal;16081608 #ifdef USE_TANGENT16091609 varying vec3 vTangent;16101610 varying vec3 vBitangent;16111611 #endif1612-#endif`,Ohe=`#ifndef FLAT_SHADED1612+#endif`,qhe=`#ifndef FLAT_SHADED16131613 varying vec3 vNormal;16141614 #ifdef USE_TANGENT16151615 varying vec3 vTangent;16161616 varying vec3 vBitangent;16171617 #endif1618-#endif`,Bhe=`#ifndef FLAT_SHADED1618+#endif`,Hhe=`#ifndef FLAT_SHADED16191619 vNormal = normalize( transformedNormal );16201620 #ifdef USE_TANGENT16211621 vTangent = normalize( transformedTangent );@@ -1624,7 +1624,7 @@ vec3 nonPerturbedNormal = normal;`,Dhe=`#ifdef USE_NORMALMAP_OBJECTSPACE
16241624 vBitangent = - vBitangent;16251625 #endif16261626 #endif1627-#endif`,Uhe=`#ifdef USE_NORMALMAP1627+#endif`,Whe=`#ifdef USE_NORMALMAP16281628 uniform sampler2D normalMap;16291629 uniform vec2 normalScale;16301630 #endif@@ -1646,13 +1646,13 @@ vec3 nonPerturbedNormal = normal;`,Dhe=`#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`,khe=`#ifdef USE_CLEARCOAT1649+#endif`,jhe=`#ifdef USE_CLEARCOAT16501650 vec3 clearcoatNormal = nonPerturbedNormal;1651-#endif`,Ghe=`#ifdef USE_CLEARCOAT_NORMALMAP1651+#endif`,Xhe=`#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`,zhe=`#ifdef USE_CLEARCOATMAP1655+#endif`,$he=`#ifdef USE_CLEARCOATMAP16561656 uniform sampler2D clearcoatMap;16571657 #endif16581658 #ifdef USE_CLEARCOAT_NORMALMAP@@ -1661,18 +1661,18 @@ vec3 nonPerturbedNormal = normal;`,Dhe=`#ifdef USE_NORMALMAP_OBJECTSPACE
16611661 #endif16621662 #ifdef USE_CLEARCOAT_ROUGHNESSMAP16631663 uniform sampler2D clearcoatRoughnessMap;1664-#endif`,Vhe=`#ifdef USE_IRIDESCENCEMAP1664+#endif`,Yhe=`#ifdef USE_IRIDESCENCEMAP16651665 uniform sampler2D iridescenceMap;16661666 #endif16671667 #ifdef USE_IRIDESCENCE_THICKNESSMAP16681668 uniform sampler2D iridescenceThicknessMap;1669-#endif`,qhe=`#ifdef OPAQUE1669+#endif`,Zhe=`#ifdef OPAQUE16701670 diffuseColor.a = 1.0;16711671 #endif16721672 #ifdef USE_TRANSMISSION16731673 diffuseColor.a *= material.transmissionAlpha;16741674 #endif1675-gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Hhe=`vec3 packNormalToRGB( const in vec3 normal ) {1675+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Khe=`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-}`,Whe=`#ifdef PREMULTIPLIED_ALPHA1754+}`,Qhe=`#ifdef PREMULTIPLIED_ALPHA17551755 gl_FragColor.rgb *= gl_FragColor.a;1756-#endif`,jhe=`vec4 mvPosition = vec4( transformed, 1.0 );1756+#endif`,Jhe=`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;`,Xhe=`#ifdef DITHERING1764+gl_Position = projectionMatrix * mvPosition;`,efe=`#ifdef DITHERING17651765 gl_FragColor.rgb = dithering( gl_FragColor.rgb );1766-#endif`,$he=`#ifdef DITHERING1766+#endif`,tfe=`#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`,Yhe=`float roughnessFactor = roughness;1773+#endif`,nfe=`float roughnessFactor = roughness;17741774 #ifdef USE_ROUGHNESSMAP17751775 vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );17761776 roughnessFactor *= texelRoughness.g;1777-#endif`,Zhe=`#ifdef USE_ROUGHNESSMAP1777+#endif`,ife=`#ifdef USE_ROUGHNESSMAP17781778 uniform sampler2D roughnessMap;1779-#endif`,Khe=`#if NUM_SPOT_LIGHT_COORDS > 01779+#endif`,rfe=`#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;`,Xhe=`#ifdef DITHERING
19761976 }19771977 #endif19781978 #endif1979-#endif`,Qhe=`#if NUM_SPOT_LIGHT_COORDS > 01979+#endif`,sfe=`#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;`,Xhe=`#ifdef DITHERING
20172017 };20182018 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];20192019 #endif2020-#endif`,Jhe=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )2020+#endif`,ofe=`#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;`,Xhe=`#ifdef DITHERING
20532053 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;20542054 }20552055 #pragma unroll_loop_end2056-#endif`,efe=`float getShadowMask() {2056+#endif`,afe=`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;`,Xhe=`#ifdef DITHERING
20852085 #endif20862086 #endif20872087 return shadow;2088-}`,tfe=`#ifdef USE_SKINNING2088+}`,lfe=`#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`,nfe=`#ifdef USE_SKINNING2093+#endif`,cfe=`#ifdef USE_SKINNING20942094 uniform mat4 bindMatrix;20952095 uniform mat4 bindMatrixInverse;20962096 uniform highp sampler2D boneTexture;@@ -2105,7 +2105,7 @@ gl_Position = projectionMatrix * mvPosition;`,Xhe=`#ifdef DITHERING
21052105 vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );21062106 return mat4( v1, v2, v3, v4 );21072107 }2108-#endif`,ife=`#ifdef USE_SKINNING2108+#endif`,ufe=`#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;`,Xhe=`#ifdef DITHERING
21132113 skinned += boneMatZ * skinVertex * skinWeight.z;21142114 skinned += boneMatW * skinVertex * skinWeight.w;21152115 transformed = ( bindMatrixInverse * skinned ).xyz;2116-#endif`,rfe=`#ifdef USE_SKINNING2116+#endif`,hfe=`#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;`,Xhe=`#ifdef DITHERING
21242124 #ifdef USE_TANGENT21252125 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;21262126 #endif2127-#endif`,sfe=`float specularStrength;2127+#endif`,ffe=`float specularStrength;21282128 #ifdef USE_SPECULARMAP21292129 vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );21302130 specularStrength = texelSpecular.r;21312131 #else21322132 specularStrength = 1.0;2133-#endif`,ofe=`#ifdef USE_SPECULARMAP2133+#endif`,dfe=`#ifdef USE_SPECULARMAP21342134 uniform sampler2D specularMap;2135-#endif`,afe=`#if defined( TONE_MAPPING )2135+#endif`,pfe=`#if defined( TONE_MAPPING )21362136 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );2137-#endif`,lfe=`#ifndef saturate2137+#endif`,Afe=`#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; }`,cfe=`#ifdef USE_TRANSMISSION2234+vec3 CustomToneMapping( vec3 color ) { return color; }`,mfe=`#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; }`,cfe=`#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`,ufe=`#ifdef USE_TRANSMISSION2255+#endif`,gfe=`#ifdef USE_TRANSMISSION22562256 uniform float transmission;22572257 uniform float thickness;22582258 uniform float attenuationDistance;@@ -2378,7 +2378,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,cfe=`#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`,hfe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2381+#endif`,_fe=`#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; }`,cfe=`#ifdef USE_TRANSMIS
24482448 #ifdef USE_THICKNESSMAP24492449 uniform mat3 thicknessMapTransform;24502450 varying vec2 vThicknessMapUv;2451-#endif`,ffe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2451+#endif`,xfe=`#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; }`,cfe=`#ifdef USE_TRANSMIS
25422542 #ifdef USE_THICKNESSMAP25432543 uniform mat3 thicknessMapTransform;25442544 varying vec2 vThicknessMapUv;2545-#endif`,dfe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )2545+#endif`,yfe=`#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; }`,cfe=`#ifdef USE_TRANSMIS
26132613 #endif26142614 #ifdef USE_THICKNESSMAP26152615 vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;2616-#endif`,pfe=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 02616+#endif`,vfe=`#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; }`,cfe=`#ifdef USE_TRANSMIS
26222622 worldPosition = instanceMatrix * worldPosition;26232623 #endif26242624 worldPosition = modelMatrix * worldPosition;2625-#endif`,Afe=`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-}`,mfe=`uniform sampler2D t2D;2630+}`,wfe=`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-}`,gfe=`varying vec3 vWorldDirection;2642+}`,Sfe=`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-}`,_fe=`#ifdef ENVMAP_TYPE_CUBE2649+}`,Tfe=`#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-}`,xfe=`varying vec3 vWorldDirection;2671+}`,Efe=`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-}`,yfe=`uniform samplerCube tCube;2678+}`,Mfe=`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-}`,vfe=`#include <common>2688+}`,Cfe=`#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-}`,bfe=`#if DEPTH_PACKING == 32002715+}`,Rfe=`#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-}`,wfe=`#define DISTANCE2753+}`,Pfe=`#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-}`,Sfe=`#define DISTANCE2780+}`,Ife=`#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-}`,Tfe=`varying vec3 vWorldDirection;2803+}`,Nfe=`varying vec3 vWorldDirection;28042804 #include <common>28052805 void main() {28062806 vWorldDirection = transformDirection( position, modelMatrix );28072807 #include <begin_vertex>28082808 #include <project_vertex>2809-}`,Efe=`uniform sampler2D tEquirect;2809+}`,Lfe=`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-}`,Mfe=`uniform float scale;2818+}`,Dfe=`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-}`,Cfe=`uniform vec3 diffuse;2840+}`,Ffe=`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-}`,Rfe=`#include <common>2868+}`,Ofe=`#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-}`,Pfe=`uniform vec3 diffuse;2900+}`,Bfe=`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-}`,Ife=`#define LAMBERT2948+}`,Ufe=`#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-}`,Nfe=`#define LAMBERT2987+}`,kfe=`#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-}`,Lfe=`#define MATCAP3045+}`,Gfe=`#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-}`,Dfe=`#define MATCAP3079+}`,zfe=`#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-}`,Ffe=`#define NORMAL3125+}`,Vfe=`#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-}`,Ofe=`#define NORMAL3158+}`,qfe=`#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-}`,Bfe=`#define PHONG3179+}`,Hfe=`#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-}`,Ufe=`#define PHONG3218+}`,Wfe=`#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-}`,kfe=`#define STANDARD3278+}`,jfe=`#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-}`,Gfe=`#define STANDARD3321+}`,Xfe=`#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-}`,zfe=`#define TOON3446+}`,$fe=`#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-}`,Vfe=`#define TOON3483+}`,Yfe=`#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-}`,qfe=`uniform float size;3535+}`,Zfe=`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-}`,Hfe=`uniform vec3 diffuse;3566+}`,Kfe=`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-}`,Wfe=`#include <common>3591+}`,Qfe=`#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-}`,jfe=`uniform vec3 color;3614+}`,Jfe=`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-}`,Xfe=`uniform float rotation;3630+}`,ede=`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-}`,$fe=`uniform vec3 diffuse;3654+}`,tde=`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-}`,Fn={alphahash_fragment:Aue,alphahash_pars_fragment:mue,alphamap_fragment:gue,alphamap_pars_fragment:_ue,alphatest_fragment:xue,alphatest_pars_fragment:yue,aomap_fragment:vue,aomap_pars_fragment:bue,batching_pars_vertex:wue,batching_vertex:Sue,begin_vertex:Tue,beginnormal_vertex:Eue,bsdfs:Mue,iridescence_fragment:Cue,bumpmap_pars_fragment:Rue,clipping_planes_fragment:Pue,clipping_planes_pars_fragment:Iue,clipping_planes_pars_vertex:Nue,clipping_planes_vertex:Lue,color_fragment:Due,color_pars_fragment:Fue,color_pars_vertex:Oue,color_vertex:Bue,common:Uue,cube_uv_reflection_fragment:kue,defaultnormal_vertex:Gue,displacementmap_pars_vertex:zue,displacementmap_vertex:Vue,emissivemap_fragment:que,emissivemap_pars_fragment:Hue,colorspace_fragment:Wue,colorspace_pars_fragment:jue,envmap_fragment:Xue,envmap_common_pars_fragment:$ue,envmap_pars_fragment:Yue,envmap_pars_vertex:Zue,envmap_physical_pars_fragment:ahe,envmap_vertex:Kue,fog_vertex:Que,fog_pars_vertex:Jue,fog_fragment:ehe,fog_pars_fragment:the,gradientmap_pars_fragment:nhe,lightmap_pars_fragment:ihe,lights_lambert_fragment:rhe,lights_lambert_pars_fragment:she,lights_pars_begin:ohe,lights_toon_fragment:lhe,lights_toon_pars_fragment:che,lights_phong_fragment:uhe,lights_phong_pars_fragment:hhe,lights_physical_fragment:fhe,lights_physical_pars_fragment:dhe,lights_fragment_begin:phe,lights_fragment_maps:Ahe,lights_fragment_end:mhe,lightprobes_pars_fragment:ghe,logdepthbuf_fragment:_he,logdepthbuf_pars_fragment:xhe,logdepthbuf_pars_vertex:yhe,logdepthbuf_vertex:vhe,map_fragment:bhe,map_pars_fragment:whe,map_particle_fragment:She,map_particle_pars_fragment:The,metalnessmap_fragment:Ehe,metalnessmap_pars_fragment:Mhe,morphinstance_vertex:Che,morphcolor_vertex:Rhe,morphnormal_vertex:Phe,morphtarget_pars_vertex:Ihe,morphtarget_vertex:Nhe,normal_fragment_begin:Lhe,normal_fragment_maps:Dhe,normal_pars_fragment:Fhe,normal_pars_vertex:Ohe,normal_vertex:Bhe,normalmap_pars_fragment:Uhe,clearcoat_normal_fragment_begin:khe,clearcoat_normal_fragment_maps:Ghe,clearcoat_pars_fragment:zhe,iridescence_pars_fragment:Vhe,opaque_fragment:qhe,packing:Hhe,premultiplied_alpha_fragment:Whe,project_vertex:jhe,dithering_fragment:Xhe,dithering_pars_fragment:$he,roughnessmap_fragment:Yhe,roughnessmap_pars_fragment:Zhe,shadowmap_pars_fragment:Khe,shadowmap_pars_vertex:Qhe,shadowmap_vertex:Jhe,shadowmask_pars_fragment:efe,skinbase_vertex:tfe,skinning_pars_vertex:nfe,skinning_vertex:ife,skinnormal_vertex:rfe,specularmap_fragment:sfe,specularmap_pars_fragment:ofe,tonemapping_fragment:afe,tonemapping_pars_fragment:lfe,transmission_fragment:cfe,transmission_pars_fragment:ufe,uv_pars_fragment:hfe,uv_pars_vertex:ffe,uv_vertex:dfe,worldpos_vertex:pfe,background_vert:Afe,background_frag:mfe,backgroundCube_vert:gfe,backgroundCube_frag:_fe,cube_vert:xfe,cube_frag:yfe,depth_vert:vfe,depth_frag:bfe,distance_vert:wfe,distance_frag:Sfe,equirect_vert:Tfe,equirect_frag:Efe,linedashed_vert:Mfe,linedashed_frag:Cfe,meshbasic_vert:Rfe,meshbasic_frag:Pfe,meshlambert_vert:Ife,meshlambert_frag:Nfe,meshmatcap_vert:Lfe,meshmatcap_frag:Dfe,meshnormal_vert:Ffe,meshnormal_frag:Ofe,meshphong_vert:Bfe,meshphong_frag:Ufe,meshphysical_vert:kfe,meshphysical_frag:Gfe,meshtoon_vert:zfe,meshtoon_frag:Vfe,points_vert:qfe,points_frag:Hfe,shadow_vert:Wfe,shadow_frag:jfe,sprite_vert:Xfe,sprite_frag:$fe},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}}},ga={basic:{uniforms:qo([Nt.common,Nt.specularmap,Nt.envmap,Nt.aomap,Nt.lightmap,Nt.fog]),vertexShader:Fn.meshbasic_vert,fragmentShader:Fn.meshbasic_frag},lambert:{uniforms:qo([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:Fn.meshlambert_vert,fragmentShader:Fn.meshlambert_frag},phong:{uniforms:qo([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:Fn.meshphong_vert,fragmentShader:Fn.meshphong_frag},standard:{uniforms:qo([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:Fn.meshphysical_vert,fragmentShader:Fn.meshphysical_frag},toon:{uniforms:qo([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:Fn.meshtoon_vert,fragmentShader:Fn.meshtoon_frag},matcap:{uniforms:qo([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,Nt.fog,{matcap:{value:null}}]),vertexShader:Fn.meshmatcap_vert,fragmentShader:Fn.meshmatcap_frag},points:{uniforms:qo([Nt.points,Nt.fog]),vertexShader:Fn.points_vert,fragmentShader:Fn.points_frag},dashed:{uniforms:qo([Nt.common,Nt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Fn.linedashed_vert,fragmentShader:Fn.linedashed_frag},depth:{uniforms:qo([Nt.common,Nt.displacementmap]),vertexShader:Fn.depth_vert,fragmentShader:Fn.depth_frag},normal:{uniforms:qo([Nt.common,Nt.bumpmap,Nt.normalmap,Nt.displacementmap,{opacity:{value:1}}]),vertexShader:Fn.meshnormal_vert,fragmentShader:Fn.meshnormal_frag},sprite:{uniforms:qo([Nt.sprite,Nt.fog]),vertexShader:Fn.sprite_vert,fragmentShader:Fn.sprite_frag},background:{uniforms:{uvTransform:{value:new Sn},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Fn.background_vert,fragmentShader:Fn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Sn}},vertexShader:Fn.backgroundCube_vert,fragmentShader:Fn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Fn.cube_vert,fragmentShader:Fn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Fn.equirect_vert,fragmentShader:Fn.equirect_frag},distance:{uniforms:qo([Nt.common,Nt.displacementmap,{referencePosition:{value:new ie},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Fn.distance_vert,fragmentShader:Fn.distance_frag},shadow:{uniforms:qo([Nt.lights,Nt.fog,{color:{value:new Ut(0)},opacity:{value:1}}]),vertexShader:Fn.shadow_vert,fragmentShader:Fn.shadow_frag}};ga.physical={uniforms:qo([ga.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:Fn.meshphysical_vert,fragmentShader:Fn.meshphysical_frag};var YT={r:0,b:0,g:0},Yfe=new on,SW=new Sn;SW.set(-1,0,0,0,1,0,0,0,1);function Zfe(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===Hu)?(c===void 0&&(c=new Hn(new Gc(1,1,1),new Xr({name:"BackgroundCubeMaterial",uniforms:zA(ga.backgroundCube.uniforms),vertexShader:ga.backgroundCube.vertexShader,fragmentShader:ga.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(Yfe.makeRotationFromEuler(R.backgroundRotation)).transpose(),C.isCubeTexture&&C.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(SW),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 Hn(new SA(2,2),new Xr({name:"BackgroundMaterial",uniforms:zA(ga.background.uniforms),vertexShader:ga.background.vertexShader,fragmentShader:ga.background.fragmentShader,side:Ao,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(YT,gL(i)),t.buffers.color.setClear(YT.r,YT.g,YT.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 Kfe(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===Ir;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 Qfe(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 Jfe(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!==xr&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(F){let N=F===Li&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(F!==Gi&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&F!==Yi&&!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 ede(i){let e=this,t=null,n=0,r=!1,s=!1,o=new aa,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 Pp=4,eW=[.125,.215,.35,.446,.526,.582],qA=20,tde=256,S2=new Vc,tW=new Ut,TL=null,EL=0,ML=0,CL=!1,nde=new ie,KT=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=nde}=s;TL=this._renderer.getRenderTarget(),EL=this._renderer.getActiveCubeFace(),ML=this._renderer.getActiveMipmapLevel(),CL=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=rW(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=iW(),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(TL,EL,ML),this._renderer.xr.enabled=CL,e.scissorTest=!1,M_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===gl||e.mapping===Ql?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),TL=this._renderer.getRenderTarget(),EL=this._renderer.getActiveCubeFace(),ML=this._renderer.getActiveMipmapLevel(),CL=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:vi,minFilter:vi,generateMipmaps:!1,type:Li,format:xr,colorSpace:Gd,depthBuffer:!1},r=nW(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=nW(e,t,n);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=ide(s)),this._blurMaterial=sde(s,e,t),this._ggxMaterial=rde(s,e,t)}return r}_compileMaterial(e){let t=new Hn(new Kn,e);this._renderer.compile(t,S2)}_sceneToCubeUV(e,t,n,r,s){let l=new Rr(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(tW),f.toneMapping=ks,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Hn(new Gc,new Us({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(tW),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;M_(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===gl||e.mapping===Ql;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=rW()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=iW());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;M_(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,S2)}_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-Pp?n-v+Pp:0),T=4*(this._cubeSize-w);l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=v-t,M_(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,S2),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=v-n,M_(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,S2)}_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*qA-1),w=s/v,S=isFinite(s)?1+Math.floor(u*w):qA;S>qA&&je(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${qA}`);let T=[],P=0;for(let F=0;F<qA;++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-Pp?r-R+Pp:0),D=4*(this._cubeSize-C);M_(t,L,D,3*C,2*C),l.setRenderTarget(t),l.render(f,S2)}};function ide(i){let e=[],t=[],n=[],r=i,s=i-Pp+1+eW.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-Pp?l=eW[o-i+Pp-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 Kn;L.setAttribute("position",new Ni(P,w)),L.setAttribute("uv",new Ni(R,S)),L.setAttribute("faceIndex",new Ni(C,T)),n.push(new Hn(L,null)),r>Pp&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function nW(i,e,t){let n=new ua(i,e,t);return n.texture.mapping=Hu,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function M_(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function rde(i,e,t){return new Xr({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:tde,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:e3(),fragmentShader:`3679+}`,On={alphahash_fragment:bue,alphahash_pars_fragment:wue,alphamap_fragment:Sue,alphamap_pars_fragment:Tue,alphatest_fragment:Eue,alphatest_pars_fragment:Mue,aomap_fragment:Cue,aomap_pars_fragment:Rue,batching_pars_vertex:Pue,batching_vertex:Iue,begin_vertex:Nue,beginnormal_vertex:Lue,bsdfs:Due,iridescence_fragment:Fue,bumpmap_pars_fragment:Oue,clipping_planes_fragment:Bue,clipping_planes_pars_fragment:Uue,clipping_planes_pars_vertex:kue,clipping_planes_vertex:Gue,color_fragment:zue,color_pars_fragment:Vue,color_pars_vertex:que,color_vertex:Hue,common:Wue,cube_uv_reflection_fragment:jue,defaultnormal_vertex:Xue,displacementmap_pars_vertex:$ue,displacementmap_vertex:Yue,emissivemap_fragment:Zue,emissivemap_pars_fragment:Kue,colorspace_fragment:Que,colorspace_pars_fragment:Jue,envmap_fragment:ehe,envmap_common_pars_fragment:the,envmap_pars_fragment:nhe,envmap_pars_vertex:ihe,envmap_physical_pars_fragment:phe,envmap_vertex:rhe,fog_vertex:she,fog_pars_vertex:ohe,fog_fragment:ahe,fog_pars_fragment:lhe,gradientmap_pars_fragment:che,lightmap_pars_fragment:uhe,lights_lambert_fragment:hhe,lights_lambert_pars_fragment:fhe,lights_pars_begin:dhe,lights_toon_fragment:Ahe,lights_toon_pars_fragment:mhe,lights_phong_fragment:ghe,lights_phong_pars_fragment:_he,lights_physical_fragment:xhe,lights_physical_pars_fragment:yhe,lights_fragment_begin:vhe,lights_fragment_maps:bhe,lights_fragment_end:whe,lightprobes_pars_fragment:She,logdepthbuf_fragment:The,logdepthbuf_pars_fragment:Ehe,logdepthbuf_pars_vertex:Mhe,logdepthbuf_vertex:Che,map_fragment:Rhe,map_pars_fragment:Phe,map_particle_fragment:Ihe,map_particle_pars_fragment:Nhe,metalnessmap_fragment:Lhe,metalnessmap_pars_fragment:Dhe,morphinstance_vertex:Fhe,morphcolor_vertex:Ohe,morphnormal_vertex:Bhe,morphtarget_pars_vertex:Uhe,morphtarget_vertex:khe,normal_fragment_begin:Ghe,normal_fragment_maps:zhe,normal_pars_fragment:Vhe,normal_pars_vertex:qhe,normal_vertex:Hhe,normalmap_pars_fragment:Whe,clearcoat_normal_fragment_begin:jhe,clearcoat_normal_fragment_maps:Xhe,clearcoat_pars_fragment:$he,iridescence_pars_fragment:Yhe,opaque_fragment:Zhe,packing:Khe,premultiplied_alpha_fragment:Qhe,project_vertex:Jhe,dithering_fragment:efe,dithering_pars_fragment:tfe,roughnessmap_fragment:nfe,roughnessmap_pars_fragment:ife,shadowmap_pars_fragment:rfe,shadowmap_pars_vertex:sfe,shadowmap_vertex:ofe,shadowmask_pars_fragment:afe,skinbase_vertex:lfe,skinning_pars_vertex:cfe,skinning_vertex:ufe,skinnormal_vertex:hfe,specularmap_fragment:ffe,specularmap_pars_fragment:dfe,tonemapping_fragment:pfe,tonemapping_pars_fragment:Afe,transmission_fragment:mfe,transmission_pars_fragment:gfe,uv_pars_fragment:_fe,uv_pars_vertex:xfe,uv_vertex:yfe,worldpos_vertex:vfe,background_vert:bfe,background_frag:wfe,backgroundCube_vert:Sfe,backgroundCube_frag:Tfe,cube_vert:Efe,cube_frag:Mfe,depth_vert:Cfe,depth_frag:Rfe,distance_vert:Pfe,distance_frag:Ife,equirect_vert:Nfe,equirect_frag:Lfe,linedashed_vert:Dfe,linedashed_frag:Ffe,meshbasic_vert:Ofe,meshbasic_frag:Bfe,meshlambert_vert:Ufe,meshlambert_frag:kfe,meshmatcap_vert:Gfe,meshmatcap_frag:zfe,meshnormal_vert:Vfe,meshnormal_frag:qfe,meshphong_vert:Hfe,meshphong_frag:Wfe,meshphysical_vert:jfe,meshphysical_frag:Xfe,meshtoon_vert:$fe,meshtoon_frag:Yfe,points_vert:Zfe,points_frag:Kfe,shadow_vert:Qfe,shadow_frag:Jfe,sprite_vert:ede,sprite_frag:tde},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 QT={r:0,b:0,g:0},nde=new on,CW=new Sn;CW.set(-1,0,0,0,1,0,0,0,1);function ide(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===Wu)?(c===void 0&&(c=new Gn(new Vc(1,1,1),new $r({name:"BackgroundCubeMaterial",uniforms:qA(_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(nde.makeRotationFromEuler(R.backgroundRotation)).transpose(),C.isCubeTexture&&C.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(CW),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 EA(2,2),new $r({name:"BackgroundMaterial",uniforms:qA(_a.background.uniforms),vertexShader:_a.background.vertexShader,fragmentShader:_a.background.fragmentShader,side:mo,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(QT,yL(i)),t.buffers.color.setClear(QT.r,QT.g,QT.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 rde(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===Lr;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 sde(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 ode(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===Li&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(F!==Gi&&n.convert(F)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE)&&F!==Yi&&!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 ade(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 Np=4,rW=[.125,.215,.35,.446,.526,.582],WA=20,lde=256,E2=new qc,sW=new Ut,CL=null,RL=0,PL=0,IL=!1,cde=new ie,e3=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=cde}=s;CL=this._renderer.getRenderTarget(),RL=this._renderer.getActiveCubeFace(),PL=this._renderer.getActiveMipmapLevel(),IL=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=lW(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=aW(),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(CL,RL,PL),this._renderer.xr.enabled=IL,e.scissorTest=!1,R_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===_l||e.mapping===ec?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),CL=this._renderer.getRenderTarget(),RL=this._renderer.getActiveCubeFace(),PL=this._renderer.getActiveMipmapLevel(),IL=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:vi,minFilter:vi,generateMipmaps:!1,type:Li,format:vr,colorSpace:Vd,depthBuffer:!1},r=oW(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=oW(e,t,n);let{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=ude(s)),this._blurMaterial=fde(s,e,t),this._ggxMaterial=hde(s,e,t)}return r}_compileMaterial(e){let t=new Gn(new Wn,e);this._renderer.compile(t,E2)}_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(sW),f.toneMapping=Gs,f.autoClear=!1,f.state.buffers.depth.getReversed()&&(f.setRenderTarget(r),f.clearDepth(),f.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Gn(new Vc,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(sW),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;R_(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===_l||e.mapping===ec;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=lW()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=aW());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;R_(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,E2)}_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-Np?n-v+Np:0),T=4*(this._cubeSize-w);l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=v-t,R_(s,S,T,3*w,2*w),r.setRenderTarget(s),r.render(a,E2),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=v-n,R_(e,S,T,3*w,2*w),r.setRenderTarget(e),r.render(a,E2)}_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*WA-1),w=s/v,S=isFinite(s)?1+Math.floor(u*w):WA;S>WA&&je(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${WA}`);let T=[],P=0;for(let F=0;F<WA;++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-Np?r-R+Np:0),D=4*(this._cubeSize-C);R_(t,L,D,3*C,2*C),l.setRenderTarget(t),l.render(f,E2)}};function ude(i){let e=[],t=[],n=[],r=i,s=i-Np+1+rW.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-Np?l=rW[o-i+Np-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 Wn;L.setAttribute("position",new Ni(P,w)),L.setAttribute("uv",new Ni(R,S)),L.setAttribute("faceIndex",new Ni(C,T)),n.push(new Gn(L,null)),r>Np&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function oW(i,e,t){let n=new ha(i,e,t);return n.texture.mapping=Wu,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function R_(i,e,t,n,r){i.viewport.set(e,t,n,r),i.scissor.set(e,t,n,r)}function hde(i,e,t){return new $r({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:lde,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:i3(),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:$r,depthTest:!1,depthWrite:!1})}function sde(i,e,t){let n=new Float32Array(qA),r=new ie(0,1,0);return new Xr({name:"SphericalGaussianBlur",defines:{n:qA,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:e3(),fragmentShader:`3783+ `,blending:Yr,depthTest:!1,depthWrite:!1})}function fde(i,e,t){let n=new Float32Array(WA),r=new ie(0,1,0);return new $r({name:"SphericalGaussianBlur",defines:{n:WA,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:i3(),fragmentShader:`37843784 37853785 precision mediump float;37863786 precision mediump int;@@ -3840,7 +3840,7 @@ void main() {
38403840 }38413841 38423842 }3843- `,blending:$r,depthTest:!1,depthWrite:!1})}function iW(){return new Xr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:e3(),fragmentShader:`3843+ `,blending:Yr,depthTest:!1,depthWrite:!1})}function aW(){return new $r({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:i3(),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:$r,depthTest:!1,depthWrite:!1})}function rW(){return new Xr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:e3(),fragmentShader:`3862+ `,blending:Yr,depthTest:!1,depthWrite:!1})}function lW(){return new $r({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:i3(),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:$r,depthTest:!1,depthWrite:!1})}function e3(){return`3878+ `,blending:Yr,depthTest:!1,depthWrite:!1})}function i3(){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 QT=class extends ua{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 Uu(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 t3=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 ku(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 Gc(5,5,5),s=new Xr({name:"CubemapFromEquirect",uniforms:zA(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:ui,blending:$r});s.uniforms.tEquirect.value=t;let o=new Hn(r,s),a=t.minFilter;return t.minFilter===go&&(t.minFilter=vi),new y_(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 ode(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===ep||x===tp)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 QT(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===ep||x===tp,w=x===gl||x===Ql;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 KT(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 KT(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===ep?p.mapping=gl:x===tp&&(p.mapping=Ql),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 ade(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&&Zn("WebGLRenderer: "+n+" extension not supported."),r}}}function lde(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?_A:gA)(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 cde(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 ude(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 hde(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 mA(D,C,L,f);F.type=Yi,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 fde(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 dde={[l2]:"LINEAR_TONE_MAPPING",[c2]:"REINHARD_TONE_MAPPING",[u2]:"CINEON_TONE_MAPPING",[h2]:"ACES_FILMIC_TONE_MAPPING",[f2]:"AGX_TONE_MAPPING",[d2]:"NEUTRAL_TONE_MAPPING",[$N]:"CUSTOM_TONE_MAPPING"};function pde(i,e,t,n,r,s){let o=new ua(e,t,{type:i,depthBuffer:r,stencilBuffer:s,samples:n?4:0,depthTexture:r?new os(e,t):void 0}),a=new ua(e,t,{type:Li,depthBuffer:!1,stencilBuffer:!1}),l=new Kn;l.setAttribute("position",new kn([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new kn([0,2,0,0,2,0],2));let c=new bT({uniforms:{tDiffuse:{value:null}},vertexShader:`3968+ `},r=new Vc(5,5,5),s=new $r({name:"CubemapFromEquirect",uniforms:qA(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===_o&&(t.minFilter=vi),new b_(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 dde(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===np||x===ip)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 t3(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===np||x===ip,w=x===_l||x===ec;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 e3(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 e3(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===np?p.mapping=_l:x===ip&&(p.mapping=ec),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 pde(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 Ade(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?yA:xA)(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 mde(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 gde(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 _de(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 _A(D,C,L,f);F.type=Yi,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 xde(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 yde={[u2]:"LINEAR_TONE_MAPPING",[h2]:"REINHARD_TONE_MAPPING",[f2]:"CINEON_TONE_MAPPING",[d2]:"ACES_FILMIC_TONE_MAPPING",[p2]:"AGX_TONE_MAPPING",[A2]:"NEUTRAL_TONE_MAPPING",[KN]:"CUSTOM_TONE_MAPPING"};function vde(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:Li,depthBuffer:!1,stencilBuffer:!1}),l=new Wn;l.setAttribute("position",new In([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new In([0,2,0,0,2,0],2));let c=new TT({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 Hn(l,c),f=new Vc(-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===ks&&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=ks,!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=dde[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 TW=new bs,IL=new os(1,1),EW=new mA,MW=new pT,CW=new Uu,sW=[],oW=[],aW=new Float32Array(16),lW=new Float32Array(9),cW=new Float32Array(4);function R_(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=sW[r];if(s===void 0&&(s=new Float32Array(r),sW[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 Gs(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 zs(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function t3(i,e){let t=oW[e];t===void 0&&(t=new Int32Array(e),oW[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Ade(i,e){let t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function mde(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(Gs(t,e))return;i.uniform2fv(this.addr,e),zs(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)&&(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(Gs(t,e))return;i.uniform3fv(this.addr,e),zs(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||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(Gs(t,e))return;i.uniform4fv(this.addr,e),zs(t,e)}}function xde(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Gs(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),zs(t,e)}else{if(Gs(t,n))return;cW.set(n),i.uniformMatrix2fv(this.addr,!1,cW),zs(t,n)}}function yde(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Gs(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),zs(t,e)}else{if(Gs(t,n))return;lW.set(n),i.uniformMatrix3fv(this.addr,!1,lW),zs(t,n)}}function vde(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(Gs(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),zs(t,e)}else{if(Gs(t,n))return;aW.set(n),i.uniformMatrix4fv(this.addr,!1,aW),zs(t,n)}}function bde(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(Gs(t,e))return;i.uniform2iv(this.addr,e),zs(t,e)}}function Sde(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(Gs(t,e))return;i.uniform3iv(this.addr,e),zs(t,e)}}function Tde(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(Gs(t,e))return;i.uniform4iv(this.addr,e),zs(t,e)}}function Ede(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Mde(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(Gs(t,e))return;i.uniform2uiv(this.addr,e),zs(t,e)}}function Cde(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(Gs(t,e))return;i.uniform3uiv(this.addr,e),zs(t,e)}}function Rde(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(Gs(t,e))return;i.uniform4uiv(this.addr,e),zs(t,e)}}function Pde(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?(IL.compareFunction=t.isReversedDepthBuffer()?Hc:th,s=IL):s=TW,t.setTexture2D(e||s,r)}function Ide(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||MW,r)}function Nde(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTextureCube(e||CW,r)}function Lde(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||EW,r)}function Dde(i){switch(i){case 5126:return Ade;case 35664:return mde;case 35665:return gde;case 35666:return _de;case 35674:return xde;case 35675:return yde;case 35676:return vde;case 5124:case 35670:return bde;case 35667:case 35671:return wde;case 35668:case 35672:return Sde;case 35669:case 35673:return Tde;case 5125:return Ede;case 36294:return Mde;case 36295:return Cde;case 36296:return Rde;case 35678:case 36198:case 36298:case 36306:case 35682:return Pde;case 35679:case 36299:case 36307:return Ide;case 35680:case 36300:case 36308:case 36293:return Nde;case 36289:case 36303:case 36311:case 36292:return Lde}}function Fde(i,e){i.uniform1fv(this.addr,e)}function Ode(i,e){let t=R_(e,this.size,2);i.uniform2fv(this.addr,t)}function Bde(i,e){let t=R_(e,this.size,3);i.uniform3fv(this.addr,t)}function Ude(i,e){let t=R_(e,this.size,4);i.uniform4fv(this.addr,t)}function kde(i,e){let t=R_(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Gde(i,e){let t=R_(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function zde(i,e){let t=R_(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function Vde(i,e){i.uniform1iv(this.addr,e)}function qde(i,e){i.uniform2iv(this.addr,e)}function Hde(i,e){i.uniform3iv(this.addr,e)}function Wde(i,e){i.uniform4iv(this.addr,e)}function jde(i,e){i.uniform1uiv(this.addr,e)}function Xde(i,e){i.uniform2uiv(this.addr,e)}function $de(i,e){i.uniform3uiv(this.addr,e)}function Yde(i,e){i.uniform4uiv(this.addr,e)}function Zde(i,e,t){let n=this.cache,r=e.length,s=t3(t,r);Gs(n,s)||(i.uniform1iv(this.addr,s),zs(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=IL:o=TW;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function Kde(i,e,t){let n=this.cache,r=e.length,s=t3(t,r);Gs(n,s)||(i.uniform1iv(this.addr,s),zs(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||MW,s[o])}function Qde(i,e,t){let n=this.cache,r=e.length,s=t3(t,r);Gs(n,s)||(i.uniform1iv(this.addr,s),zs(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||CW,s[o])}function Jde(i,e,t){let n=this.cache,r=e.length,s=t3(t,r);Gs(n,s)||(i.uniform1iv(this.addr,s),zs(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||EW,s[o])}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}}var NL=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=Dde(t.type)}},LL=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=epe(t.type)}},DL=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)}}},RL=/(\w+)(\])?(\[|\.)?/g;function uW(i,e){i.seq.push(e),i.map[e.id]=e}function tpe(i,e,t){let n=i.name,r=n.length;for(RL.lastIndex=0;;){let s=RL.exec(n),o=RL.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){uW(t,c===void 0?new NL(a,i,e):new LL(a,i,e));break}else{let f=t.map[a];f===void 0&&(f=new DL(a),uW(t,f)),t=f}}}var C_=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);tpe(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 hW(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var npe=37297,ipe=0;function rpe(i,e){let t=i.split(`4014+ }`,depthTest:!1,depthWrite:!1}),u=new Gn(l,c),f=new qc(-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===Gs&&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=Gs,!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=yde[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 RW=new ws,DL=new ls(1,1),PW=new _A,IW=new gT,NW=new ku,cW=[],uW=[],hW=new Float32Array(16),fW=new Float32Array(9),dW=new Float32Array(4);function I_(i,e,t){let n=i[0];if(n<=0||n>0)return i;let r=e*t,s=cW[r];if(s===void 0&&(s=new Float32Array(r),cW[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 zs(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 Vs(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function r3(i,e){let t=uW[e];t===void 0&&(t=new Int32Array(e),uW[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 wde(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(zs(t,e))return;i.uniform2fv(this.addr,e),Vs(t,e)}}function Sde(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(zs(t,e))return;i.uniform3fv(this.addr,e),Vs(t,e)}}function Tde(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(zs(t,e))return;i.uniform4fv(this.addr,e),Vs(t,e)}}function Ede(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(zs(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),Vs(t,e)}else{if(zs(t,n))return;dW.set(n),i.uniformMatrix2fv(this.addr,!1,dW),Vs(t,n)}}function Mde(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(zs(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),Vs(t,e)}else{if(zs(t,n))return;fW.set(n),i.uniformMatrix3fv(this.addr,!1,fW),Vs(t,n)}}function Cde(i,e){let t=this.cache,n=e.elements;if(n===void 0){if(zs(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),Vs(t,e)}else{if(zs(t,n))return;hW.set(n),i.uniformMatrix4fv(this.addr,!1,hW),Vs(t,n)}}function Rde(i,e){let t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function Pde(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(zs(t,e))return;i.uniform2iv(this.addr,e),Vs(t,e)}}function Ide(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(zs(t,e))return;i.uniform3iv(this.addr,e),Vs(t,e)}}function Nde(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(zs(t,e))return;i.uniform4iv(this.addr,e),Vs(t,e)}}function Lde(i,e){let t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function Dde(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(zs(t,e))return;i.uniform2uiv(this.addr,e),Vs(t,e)}}function Fde(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(zs(t,e))return;i.uniform3uiv(this.addr,e),Vs(t,e)}}function Ode(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(zs(t,e))return;i.uniform4uiv(this.addr,e),Vs(t,e)}}function Bde(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?(DL.compareFunction=t.isReversedDepthBuffer()?Wc:nh,s=DL):s=RW,t.setTexture2D(e||s,r)}function Ude(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||IW,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.setTextureCube(e||NW,r)}function Gde(i,e,t){let n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||PW,r)}function zde(i){switch(i){case 5126:return bde;case 35664:return wde;case 35665:return Sde;case 35666:return Tde;case 35674:return Ede;case 35675:return Mde;case 35676:return Cde;case 5124:case 35670:return Rde;case 35667:case 35671:return Pde;case 35668:case 35672:return Ide;case 35669:case 35673:return Nde;case 5125:return Lde;case 36294:return Dde;case 36295:return Fde;case 36296:return Ode;case 35678:case 36198:case 36298:case 36306:case 35682:return Bde;case 35679:case 36299:case 36307:return Ude;case 35680:case 36300:case 36308:case 36293:return kde;case 36289:case 36303:case 36311:case 36292:return Gde}}function Vde(i,e){i.uniform1fv(this.addr,e)}function qde(i,e){let t=I_(e,this.size,2);i.uniform2fv(this.addr,t)}function Hde(i,e){let t=I_(e,this.size,3);i.uniform3fv(this.addr,t)}function Wde(i,e){let t=I_(e,this.size,4);i.uniform4fv(this.addr,t)}function jde(i,e){let t=I_(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function Xde(i,e){let t=I_(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function $de(i,e){let t=I_(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function Yde(i,e){i.uniform1iv(this.addr,e)}function Zde(i,e){i.uniform2iv(this.addr,e)}function Kde(i,e){i.uniform3iv(this.addr,e)}function Qde(i,e){i.uniform4iv(this.addr,e)}function Jde(i,e){i.uniform1uiv(this.addr,e)}function epe(i,e){i.uniform2uiv(this.addr,e)}function tpe(i,e){i.uniform3uiv(this.addr,e)}function npe(i,e){i.uniform4uiv(this.addr,e)}function ipe(i,e,t){let n=this.cache,r=e.length,s=r3(t,r);zs(n,s)||(i.uniform1iv(this.addr,s),Vs(n,s));let o;this.type===i.SAMPLER_2D_SHADOW?o=DL:o=RW;for(let a=0;a!==r;++a)t.setTexture2D(e[a]||o,s[a])}function rpe(i,e,t){let n=this.cache,r=e.length,s=r3(t,r);zs(n,s)||(i.uniform1iv(this.addr,s),Vs(n,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||IW,s[o])}function spe(i,e,t){let n=this.cache,r=e.length,s=r3(t,r);zs(n,s)||(i.uniform1iv(this.addr,s),Vs(n,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||NW,s[o])}function ope(i,e,t){let n=this.cache,r=e.length,s=r3(t,r);zs(n,s)||(i.uniform1iv(this.addr,s),Vs(n,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||PW,s[o])}function ape(i){switch(i){case 5126:return Vde;case 35664:return qde;case 35665:return Hde;case 35666:return Wde;case 35674:return jde;case 35675:return Xde;case 35676:return $de;case 5124:case 35670:return Yde;case 35667:case 35671:return Zde;case 35668:case 35672:return Kde;case 35669:case 35673:return Qde;case 5125:return Jde;case 36294:return epe;case 36295:return tpe;case 36296:return npe;case 35678:case 36198:case 36298:case 36306:case 35682:return ipe;case 35679:case 36299:case 36307:return rpe;case 35680:case 36300:case 36308:case 36293:return spe;case 36289:case 36303:case 36311:case 36292:return ope}}var FL=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=zde(t.type)}},OL=class{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=ape(t.type)}},BL=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)}}},NL=/(\w+)(\])?(\[|\.)?/g;function pW(i,e){i.seq.push(e),i.map[e.id]=e}function lpe(i,e,t){let n=i.name,r=n.length;for(NL.lastIndex=0;;){let s=NL.exec(n),o=NL.lastIndex,a=s[1],l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){pW(t,c===void 0?new FL(a,i,e):new OL(a,i,e));break}else{let f=t.map[a];f===void 0&&(f=new BL(a),pW(t,f)),t=f}}}var P_=class{constructor(e,t){this.seq=[],this.map={};let n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let o=0;o<n;++o){let a=e.getActiveUniform(t,o),l=e.getUniformLocation(t,a.name);lpe(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 AW(i,e,t){let n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}var cpe=37297,upe=0;function hpe(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 fW=new Sn;function spe(i){sn._getMatrix(fW,sn.workingColorSpace,i);let e=`mat3( ${fW.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 dW(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 mW=new Sn;function fpe(i){sn._getMatrix(mW,sn.workingColorSpace,i);let e=`mat3( ${mW.elements.map(t=>t.toFixed(4))} )`;switch(sn.getTransfer(i)){case qd:return[e,"LinearTransferOETF"];case Bt:return[e,"sRGBTransferOETF"];default:return je("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function gW(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-`+rpe(i.getShaderSource(e),a)}else return s}function ope(i,e){let t=spe(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`4021-`)}var ape={[l2]:"Linear",[c2]:"Reinhard",[u2]:"Cineon",[h2]:"ACESFilmic",[f2]:"AgX",[d2]:"Neutral",[$N]:"Custom"};function lpe(i,e){let t=ape[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 ZT=new ie;function cpe(){sn.getLuminanceCoefficients(ZT);let i=ZT.x.toFixed(4),e=ZT.y.toFixed(4),t=ZT.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`4022-`)}function upe(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(E2).join(`4023-`)}function hpe(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`4024-`)}function fpe(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 E2(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 AW(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var dpe=/^[ \t]*#include +<([\w\d./]+)>/gm;function FL(i){return i.replace(dpe,Ape)}var ppe=new Map;function Ape(i,e){let t=Fn[e];if(t===void 0){let n=ppe.get(e);if(n!==void 0)t=Fn[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 FL(t)}var mpe=/#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 mW(i){return i.replace(mpe,gpe)}function gpe(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 gW(i){let e=`precision ${i.precision} float;4020+`+hpe(i.getShaderSource(e),a)}else return s}function dpe(i,e){let t=fpe(e);return[`vec4 ${i}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`4021+`)}var ppe={[u2]:"Linear",[h2]:"Reinhard",[f2]:"Cineon",[d2]:"ACESFilmic",[p2]:"AgX",[A2]:"Neutral",[KN]:"Custom"};function Ape(i,e){let t=ppe[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 JT=new ie;function mpe(){sn.getLuminanceCoefficients(JT);let i=JT.x.toFixed(4),e=JT.y.toFixed(4),t=JT.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${i}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`4022+`)}function gpe(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(C2).join(`4023+`)}function _pe(i){let e=[];for(let t in i){let n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`4024+`)}function xpe(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 C2(i){return i!==""}function _W(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 xW(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var ype=/^[ \t]*#include +<([\w\d./]+)>/gm;function UL(i){return i.replace(ype,bpe)}var vpe=new Map;function bpe(i,e){let t=On[e];if(t===void 0){let n=vpe.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 UL(t)}var wpe=/#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 yW(i){return i.replace(wpe,Spe)}function Spe(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 vW(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 _pe={[Jd]:"SHADOWMAP_TYPE_PCF",[Kl]:"SHADOWMAP_TYPE_VSM"};function xpe(i){return _pe[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var ype={[gl]:"ENVMAP_TYPE_CUBE",[Ql]:"ENVMAP_TYPE_CUBE",[Hu]:"ENVMAP_TYPE_CUBE_UV"};function vpe(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":ype[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var bpe={[Ql]:"ENVMAP_MODE_REFRACTION"};function wpe(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":bpe[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var Spe={[PA]:"ENVMAP_BLENDING_MULTIPLY",[qT]:"ENVMAP_BLENDING_MIX",[HT]:"ENVMAP_BLENDING_ADD"};function Tpe(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":Spe[i.combine]||"ENVMAP_BLENDING_NONE"}function Epe(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 Mpe(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=xpe(t),c=vpe(t),u=wpe(t),f=Tpe(t),p=Epe(t),x=upe(t),v=hpe(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(E2).join(`4044+#define LOW_PRECISION`),e}var Tpe={[tp]:"SHADOWMAP_TYPE_PCF",[Jl]:"SHADOWMAP_TYPE_VSM"};function Epe(i){return Tpe[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var Mpe={[_l]:"ENVMAP_TYPE_CUBE",[ec]:"ENVMAP_TYPE_CUBE",[Wu]:"ENVMAP_TYPE_CUBE_UV"};function Cpe(i){return i.envMap===!1?"ENVMAP_TYPE_CUBE":Mpe[i.envMapMode]||"ENVMAP_TYPE_CUBE"}var Rpe={[ec]:"ENVMAP_MODE_REFRACTION"};function Ppe(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":Rpe[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}var Ipe={[NA]:"ENVMAP_BLENDING_MULTIPLY",[jT]:"ENVMAP_BLENDING_MIX",[XT]:"ENVMAP_BLENDING_ADD"};function Npe(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":Ipe[i.combine]||"ENVMAP_BLENDING_NONE"}function Lpe(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 Dpe(i,e,t,n){let r=i.getContext(),s=t.defines,o=t.vertexShader,a=t.fragmentShader,l=Epe(t),c=Cpe(t),u=Ppe(t),f=Npe(t),p=Lpe(t),x=gpe(t),v=_pe(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(C2).join(`40464046 `),S.length>0&&(S+=`4047-`),T=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(E2).join(`4047+`),T=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(C2).join(`40484048 `),T.length>0&&(T+=`4049-`)):(S=[gW(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(E2).join(`4051-`),T=[gW(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!==ks?"#define TONE_MAPPING":"",t.toneMapping!==ks?Fn.tonemapping_pars_fragment:"",t.toneMapping!==ks?lpe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Fn.colorspace_pars_fragment,ope("linearToOutputTexel",t.outputColorSpace),cpe(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`4052-`].filter(E2).join(`4053-`)),o=FL(o),o=pW(o,t),o=AW(o,t),a=FL(a),a=pW(a,t),a=AW(a,t),o=mW(o),a=mW(a),t.isRawShaderMaterial!==!0&&(P=`#version 300 es4049+`)):(S=[vW(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(C2).join(`4051+`),T=[vW(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!==Gs?"#define TONE_MAPPING":"",t.toneMapping!==Gs?On.tonemapping_pars_fragment:"",t.toneMapping!==Gs?Ape("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",On.colorspace_pars_fragment,dpe("linearToOutputTexel",t.outputColorSpace),mpe(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`4052+`].filter(C2).join(`4053+`)),o=UL(o),o=_W(o,t),o=xW(o,t),a=UL(a),a=_W(a,t),a=xW(a,t),o=yW(o),a=yW(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===dL?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===dL?"":"#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===mL?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===mL?"":"#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=hW(r,r.VERTEX_SHADER,R),D=hW(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=dW(r,L,"vertex"),ve=dW(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=AW(r,r.VERTEX_SHADER,R),D=AW(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=gW(r,L,"vertex"),ve=gW(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 C_(r,w),B=fpe(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,npe)),z},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=ipe++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=L,this.fragmentShader=D,this}var Cpe=0,OL=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 BL(e),t.set(e,n)),n}},BL=class{constructor(e){this.id=Cpe++,this.code=e,this.usedTimes=0}};function Rpe(i){return i===Ss||i===Ju||i===eh}function Ppe(i,e,t,n,r,s){let o=new h_,a=new OL,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===Hu?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=ga[de];Ue=jt.vertexShader,mt=jt.fragmentShader}else{Ue=N.vertexShader,mt=N.fragmentShader;let jt=a.getVertexShaderStage(N),qi=a.getFragmentShaderStage(N);a.update(N,jt,qi),Me=jt.id,ze=qi.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,On=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,Rn=Te&&!!N.thicknessMap,xe=!!N.gradientMap,bt=!!N.alphaMap,Ye=N.alphaTest>0,wt=!!N.alphaHash,Dt=!!N.extensions,ct=ks;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===jT,normalMapTangentSpace:yt&&N.normalMapType===_l,packedNormalMap:yt&&N.normalMapType===_l&&Rpe(N.normalMap.format),metalnessMap:Qt,roughnessMap:xn,anisotropy:ge,anisotropyMap:Pe,clearcoat:di,clearcoatMap:Ve,clearcoatNormalMap:gt,clearcoatRoughnessMap:St,dispersion:On,iridescence:le,iridescenceMap:qe,iridescenceThicknessMap:Ke,sheen:X,sheenColorMap:Rt,sheenRoughnessMap:en,specularMap:Pt,specularColorMap:Mt,specularIntensityMap:cn,transmission:Te,transmissionMap:yn,thicknessMap:Rn,gradientMap:xe,opaque:N.transparent===!1&&N.blending===ss&&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:Rn&&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===ir,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=ga[B];z=VA.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 Mpe(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 Ipe(){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 Npe(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 _W(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 xW(){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||Npe),n.length>1&&n.sort(x||_W),r.length>1&&r.sort(x||_W),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 Lpe(){let i=new WeakMap;function e(n,r){let s=i.get(n),o;return s===void 0?(o=new xW,i.set(n,[o])):r>=s.length?(o=new xW,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function Dpe(){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 Fpe(){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 Ope=0;function Bpe(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Upe(i){let e=new Dpe,t=Fpe(),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(Bpe);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===Ss?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=Ope++)}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 yW(i){let e=new Upe(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 kpe(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new yW(i),e.set(r,[a])):s>=o.length?(a=new yW(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var Gpe=`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 P_(r,w),B=xpe(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,cpe)),z},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=upe++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=L,this.fragmentShader=D,this}var Fpe=0,kL=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 GL(e),t.set(e,n)),n}},GL=class{constructor(e){this.id=Fpe++,this.code=e,this.usedTimes=0}};function Ope(i){return i===Ts||i===eh||i===th}function Bpe(i,e,t,n,r,s){let o=new d_,a=new kL,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===Wu?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),qi=a.getFragmentShaderStage(N);a.update(N,jt,qi),Me=jt.id,ze=qi.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,Rn=Te&&!!N.thicknessMap,xe=!!N.gradientMap,bt=!!N.alphaMap,Ye=N.alphaTest>0,wt=!!N.alphaHash,Dt=!!N.extensions,ct=Gs;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===YT,normalMapTangentSpace:yt&&N.normalMapType===xl,packedNormalMap:yt&&N.normalMapType===xl&&Ope(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:Rn,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:Rn&&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===ir,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=HA.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 Dpe(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 Upe(){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 kpe(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 bW(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 wW(){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||kpe),n.length>1&&n.sort(x||bW),r.length>1&&r.sort(x||bW),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 Gpe(){let i=new WeakMap;function e(n,r){let s=i.get(n),o;return s===void 0?(o=new wW,i.set(n,[o])):r>=s.length?(o=new wW,s.push(o)):o=s[r],o}function t(){i=new WeakMap}return{get:e,dispose:t}}function zpe(){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 Vpe(){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 qpe=0;function Hpe(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function Wpe(i){let e=new zpe,t=Vpe(),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(Hpe);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=qpe++)}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 SW(i){let e=new Wpe(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 jpe(i){let e=new WeakMap;function t(r,s=0){let o=e.get(r),a;return o===void 0?(a=new SW(i),e.set(r,[a])):s>=o.length?(a=new SW(i),o.push(a)):a=o[s],a}function n(){e=new WeakMap}return{get:t,dispose:n}}var Xpe=`void main() {40664066 gl_Position = vec4( position, 1.0 );4067-}`,zpe=`uniform sampler2D shadow_pass;4067+}`,$pe=`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-}`,Vpe=[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)],qpe=[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)],vW=new on,T2=new ie,PL=new ie;function Hpe(i,e,t){let n=new Zl,r=new Oe,s=new Oe,o=new gn,a=new wT,l=new ST,c={},u=t.maxTextureSize,f={[Ao]:ui,[ui]:Ao,[ir]:ir},p=new Xr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:Gpe,fragmentShader:zpe}),x=p.clone();x.defines.HORIZONTAL_PASS=1;let v=new Kn;v.setAttribute("position",new Ni(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let w=new Hn(v,p),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Jd;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===GT&&(je("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Jd);let B=i.getRenderTarget(),z=i.getActiveCubeFace(),V=i.getActiveMipmapLevel(),H=i.state;H.setBlending($r),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===Kl){if(K.isPointLight){je("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}ee.map=new ua(r.x,r.y,{format:Ss,type:Li,minFilter:vi,magFilter:vi,generateMipmaps:!1}),ee.map.texture.name=K.name+".shadowMap",ee.map.depthTexture=new os(r.x,r.y,Yi),ee.map.depthTexture.name=K.name+".shadowMapDepth",ee.map.depthTexture.format=ys,ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=xi,ee.map.depthTexture.magFilter=xi}else K.isPointLight?(ee.map=new QT(r.x),ee.map.depthTexture=new p_(r.x,pi)):(ee.map=new ua(r.x,r.y),ee.map.depthTexture=new os(r.x,r.y,pi)),ee.map.depthTexture.name=K.name+".shadowMap",ee.map.depthTexture.format=ys,this.type===Jd?(ee.map.depthTexture.compareFunction=ce?Hc:th,ee.map.depthTexture.minFilter=vi,ee.map.depthTexture.magFilter=vi):(ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=xi,ee.map.depthTexture.magFilter=xi);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()),T2.setFromMatrixPosition(K.matrixWorld),Ie.position.copy(T2),PL.copy(Ie.position),PL.add(Vpe[ve]),Ie.up.copy(qpe[ve]),Ie.lookAt(PL),Ie.updateMatrixWorld(),Qe.makeTranslation(-T2.x,-T2.y,-T2.z),vW.multiplyMatrices(Ie.projectionMatrix,Ie.matrixWorldInverse),ee._frustum.setFromProjectionMatrix(vW,Ie.coordinateSystem,Ie.reversedDepth)}else ee.updateMatrices(K);n=ee.getFrustum(),C(F,N,ee.camera,K,this.type)}ee.isPointLightShadow!==!0&&this.type===Kl&&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 ua(r.x,r.y,{format:Ss,type:Li})),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===Kl?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===Kl)&&(!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 Wpe(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,qi){qi===!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=b2[ct]),wt!==ct){switch(ct){case lA:i.depthFunc(i.NEVER);break;case cA:i.depthFunc(i.ALWAYS);break;case uA:i.depthFunc(i.LESS);break;case Bu:i.depthFunc(i.LEQUAL);break;case hA:i.depthFunc(i.EQUAL);break;case fA:i.depthFunc(i.GEQUAL);break;case dA:i.depthFunc(i.GREATER);break;case pA: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,qi=null;return{setTest:function(In){xe||(In?$e(i.STENCIL_TEST):Et(i.STENCIL_TEST))},setMask:function(In){bt!==In&&!xe&&(i.stencilMask(In),bt=In)},setFunc:function(In,kr,mr){(Ye!==In||wt!==kr||Dt!==mr)&&(i.stencilFunc(In,kr,mr),Ye=In,wt=kr,Dt=mr)},setOp:function(In,kr,mr){(ct!==In||Ce!==kr||jt!==mr)&&(i.stencilOp(In,kr,mr),ct=In,Ce=kr,jt=mr)},setLocked:function(In){xe=In},setClear:function(In){qi!==In&&(i.clearStencil(In),qi=In)},reset:function(){xe=!1,bt=null,Ye=null,wt=null,Dt=null,ct=null,Ce=null,jt=null,qi=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(Bu),vt(!1),yt(Zy),$e(i.CULL_FACE),st($r);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={[Bs]:i.FUNC_ADD,[Qy]:i.FUNC_SUBTRACT,[Jy]:i.FUNC_REVERSE_SUBTRACT};Gt[zT]=i.MIN,Gt[VT]=i.MAX;let Xe={[qc]:i.ZERO,[e2]:i.ONE,[t2]:i.SRC_COLOR,[Ud]:i.SRC_ALPHA,[a2]:i.SRC_ALPHA_SATURATE,[s2]:i.DST_COLOR,[i2]:i.DST_ALPHA,[n2]:i.ONE_MINUS_SRC_COLOR,[kd]:i.ONE_MINUS_SRC_ALPHA,[o2]:i.ONE_MINUS_DST_COLOR,[r2]:i.ONE_MINUS_DST_ALPHA,[GH]:i.CONSTANT_COLOR,[zH]:i.ONE_MINUS_CONSTANT_COLOR,[VH]:i.CONSTANT_ALPHA,[qH]:i.ONE_MINUS_CONSTANT_ALPHA};function st(xe,bt,Ye,wt,Dt,ct,Ce,jt,qi,In){if(xe===$r){S===!0&&(Et(i.BLEND),S=!1);return}if(S===!1&&($e(i.BLEND),S=!0),xe!==If){if(xe!==T||In!==z){if((P!==Bs||L!==Bs)&&(i.blendEquation(i.FUNC_ADD),P=Bs,L=Bs),In)switch(xe){case ss:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case zu:i.blendFunc(i.ONE,i.ONE);break;case Vu:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case qu: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 ss:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case zu:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case Vu:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case qu: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=In}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||qi!==B)&&(i.blendColor(jt.r,jt.g,jt.b,qi),N.copy(jt),B=qi),T=xe,z=!1}function tt(xe,bt){xe.side===ir?Et(i.CULL_FACE):$e(i.CULL_FACE);let Ye=xe.side===ui;bt&&(Ye=!Ye),vt(Ye),xe.blending===ss&&xe.transparent===!1?st($r):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!==UT?($e(i.CULL_FACE),xe!==H&&(xe===Zy?i.cullFace(i.BACK):xe===kT?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 On(){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 Rn(){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:On,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:Rn}}function jpe(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):l_("canvas")}function S(le,X,Te){let Pe=1,Ve=On(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===pi||X===zo?Te=i.DEPTH24_STENCIL8:X===Yi?Te=i.DEPTH32F_STENCIL8:X===Wa&&(Te=i.DEPTH24_STENCIL8,je("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):X===null||X===pi||X===zo?Te=i.DEPTH_COMPONENT24:X===Yi?Te=i.DEPTH_COMPONENT32F:X===Wa&&(Te=i.DEPTH_COMPONENT16),Te}function D(le,X){return T(le)===!0||le.isFramebufferTexture&&le.minFilter!==xi&&le.minFilter!==vi?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={[Sf]:i.REPEAT,[ko]:i.CLAMP_TO_EDGE,[Tf]:i.MIRRORED_REPEAT},Qe={[xi]:i.NEAREST,[A2]:i.NEAREST_MIPMAP_NEAREST,[Jl]:i.NEAREST_MIPMAP_LINEAR,[vi]:i.LINEAR,[np]:i.LINEAR_MIPMAP_NEAREST,[go]:i.LINEAR_MIPMAP_LINEAR},Ue={[_2]:i.NEVER,[v2]:i.ALWAYS,[T_]:i.LESS,[th]:i.LEQUAL,[x2]:i.EQUAL,[Hc]:i.GEQUAL,[kA]:i.GREATER,[y2]:i.NOTEQUAL};function mt(le,X){if(X.type===Yi&&e.has("OES_texture_float_linear")===!1&&(X.magFilter===vi||X.magFilter===np||X.magFilter===Jl||X.magFilter===go||X.minFilter===vi||X.minFilter===np||X.minFilter===Jl||X.minFilter===go)&&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===xi||X.minFilter!==Jl&&X.minFilter!==go||X.type===Yi&&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),Rn=ze(Pt.start,X.width,4);Mt.start<=cn+1&&yn===Rn&&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),Rn=cn%X.width,xe=Math.floor(cn/X.width),bt=yn,Ye=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Rn),t.pixelStorei(i.UNPACK_SKIP_ROWS,xe),t.texSubImage2D(i.TEXTURE_2D,0,Rn,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===Vo?null:sn.getPrimaries(X.colorSpace),Dt=X.colorSpace===Vo||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,Rn=St.__version===void 0||Ve===!0,xe=gt.dataReady,bt=D(X,Ke);if(X.isDepthTexture)Pt=L(X.format===Qs,X.type),Rn&&(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&&Rn&&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?(Rn&&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&&Rn&&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!==xr)if(Rt!==null)if(yn){if(xe)if(X.layerUpdates.size>0){let Dt=w2(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&&Rn&&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!==xr?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(Rn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,bt,Pt,Ke.width,Ke.height,Ke.depth),xe)if(X.layerUpdates.size>0){let Ye=w2(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?(Rn&&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(Rn)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&&Rn){let Ye=On(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(Rn){let Ye=On(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===Vo?null:sn.getPrimaries(X.colorSpace),Ke=X.colorSpace===Vo||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),Rn=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,Rn,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!==xr?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,Rn,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,Rn,jt.width,jt.height,0,cn,yn,jt.data)}}}else{if(Dt=X.mipmaps,xe&&bt){Dt.length>0&&wt++;let ct=On(Pt[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,wt,Rn,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,Rn,Pt[ct].width,Pt[ct].height,0,cn,yn,Pt[ct].data);for(let Ce=0;Ce<Dt.length;Ce++){let qi=Dt[Ce].image[ct].image;xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,0,0,qi.width,qi.height,cn,yn,qi.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,Rn,qi.width,qi.height,0,cn,yn,qi.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,Rn,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,Rn,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===ys?Pt=i.DEPTH_COMPONENT24:X.depthTexture.format===Qs&&(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===Qs?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(X.depthTexture.format===ys)xn(X)?a.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Ke,qe,gt,0,St):i.framebufferTexture2D(i.FRAMEBUFFER,Ke,qe,gt,0);else if(X.depthTexture.format===Qs)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!==Gd&&Te!==Vo&&(sn.getTransfer(Te)===Bt?(Pe!==xr||Ve!==Gi)&&je("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ge("WebGLTextures: Unsupported texture color space:",Te)),X}function On(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 Xpe(i,e){function t(n,r=Vo){let s,o=sn.getTransfer(r);if(n===Gi)return i.UNSIGNED_BYTE;if(n===IA)return i.UNSIGNED_SHORT_4_4_4_4;if(n===NA)return i.UNSIGNED_SHORT_5_5_5_1;if(n===LA)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===DA)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Wu)return i.BYTE;if(n===ju)return i.SHORT;if(n===Wa)return i.UNSIGNED_SHORT;if(n===Ir)return i.INT;if(n===pi)return i.UNSIGNED_INT;if(n===Yi)return i.FLOAT;if(n===Li)return i.HALF_FLOAT;if(n===S_)return i.ALPHA;if(n===Nf)return i.RGB;if(n===xr)return i.RGBA;if(n===ys)return i.DEPTH_COMPONENT;if(n===Qs)return i.DEPTH_STENCIL;if(n===Lf)return i.RED;if(n===Xu)return i.RED_INTEGER;if(n===Ss)return i.RG;if(n===$u)return i.RG_INTEGER;if(n===ip)return i.RGBA_INTEGER;if(n===Yu||n===Zu||n===Ku||n===Qu)if(o===Bt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Yu)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Zu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ku)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Qu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Yu)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Zu)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ku)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Qu)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===FA||n===OA||n===BA||n===UA)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===FA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===OA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===BA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===UA)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===rp||n===sp||n===op||n===ap||n===lp||n===Ju||n===cp)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===rp||n===sp)return o===Bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===op)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===ap)return s.COMPRESSED_R11_EAC;if(n===lp)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Ju)return s.COMPRESSED_RG11_EAC;if(n===cp)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===up||n===hp||n===fp||n===dp||n===pp||n===Ap||n===mp||n===gp||n===_p||n===xp||n===yp||n===vp||n===bp||n===wp)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===up)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===hp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===fp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===dp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ap)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===gp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===_p)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===xp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===yp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===vp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===bp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===wp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Sp||n===Tp||n===Ep)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Sp)return o===Bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Tp)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Ep)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Mp||n===Cp||n===eh||n===Rp)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Mp)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Cp)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===eh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Rp)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===zo?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}var $pe=`4092+}`,Ype=[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)],Zpe=[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)],TW=new on,M2=new ie,LL=new ie;function Kpe(i,e,t){let n=new Kl,r=new Oe,s=new Oe,o=new gn,a=new ET,l=new MT,c={},u=t.maxTextureSize,f={[mo]:ui,[ui]:mo,[ir]:ir},p=new $r({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Oe},radius:{value:4}},vertexShader:Xpe,fragmentShader:$pe}),x=p.clone();x.defines.HORIZONTAL_PASS=1;let v=new Wn;v.setAttribute("position",new Ni(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=tp;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===qT&&(je("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=tp);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===Jl){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:Li,minFilter:vi,magFilter:vi,generateMipmaps:!1}),ee.map.texture.name=K.name+".shadowMap",ee.map.depthTexture=new ls(r.x,r.y,Yi),ee.map.depthTexture.name=K.name+".shadowMapDepth",ee.map.depthTexture.format=vs,ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=xi,ee.map.depthTexture.magFilter=xi}else K.isPointLight?(ee.map=new t3(r.x),ee.map.depthTexture=new m_(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===tp?(ee.map.depthTexture.compareFunction=ce?Wc:nh,ee.map.depthTexture.minFilter=vi,ee.map.depthTexture.magFilter=vi):(ee.map.depthTexture.compareFunction=null,ee.map.depthTexture.minFilter=xi,ee.map.depthTexture.magFilter=xi);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()),M2.setFromMatrixPosition(K.matrixWorld),Ie.position.copy(M2),LL.copy(Ie.position),LL.add(Ype[ve]),Ie.up.copy(Zpe[ve]),Ie.lookAt(LL),Ie.updateMatrixWorld(),Qe.makeTranslation(-M2.x,-M2.y,-M2.z),TW.multiplyMatrices(Ie.projectionMatrix,Ie.matrixWorldInverse),ee._frustum.setFromProjectionMatrix(TW,Ie.coordinateSystem,Ie.reversedDepth)}else ee.updateMatrices(K);n=ee.getFrustum(),C(F,N,ee.camera,K,this.type)}ee.isPointLightShadow!==!0&&this.type===Jl&&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:Li})),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===Jl?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===Jl)&&(!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 Qpe(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,qi){qi===!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=S2[ct]),wt!==ct){switch(ct){case uA:i.depthFunc(i.NEVER);break;case hA:i.depthFunc(i.ALWAYS);break;case fA:i.depthFunc(i.LESS);break;case Uu:i.depthFunc(i.LEQUAL);break;case dA:i.depthFunc(i.EQUAL);break;case pA:i.depthFunc(i.GEQUAL);break;case AA:i.depthFunc(i.GREATER);break;case mA: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,qi=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,Gr,gr){(Ye!==Nn||wt!==Gr||Dt!==gr)&&(i.stencilFunc(Nn,Gr,gr),Ye=Nn,wt=Gr,Dt=gr)},setOp:function(Nn,Gr,gr){(ct!==Nn||Ce!==Gr||jt!==gr)&&(i.stencilOp(Nn,Gr,gr),ct=Nn,Ce=Gr,jt=gr)},setLocked:function(Nn){xe=Nn},setClear:function(Nn){qi!==Nn&&(i.clearStencil(Nn),qi=Nn)},reset:function(){xe=!1,bt=null,Ye=null,wt=null,Dt=null,ct=null,Ce=null,jt=null,qi=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(Uu),vt(!1),yt(Qy),$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={[ks]:i.FUNC_ADD,[e2]:i.FUNC_SUBTRACT,[t2]:i.FUNC_REVERSE_SUBTRACT};Gt[HT]=i.MIN,Gt[WT]=i.MAX;let Xe={[Hc]:i.ZERO,[n2]:i.ONE,[i2]:i.SRC_COLOR,[Gd]:i.SRC_ALPHA,[c2]:i.SRC_ALPHA_SATURATE,[a2]:i.DST_COLOR,[s2]:i.DST_ALPHA,[r2]:i.ONE_MINUS_SRC_COLOR,[zd]:i.ONE_MINUS_SRC_ALPHA,[l2]:i.ONE_MINUS_DST_COLOR,[o2]:i.ONE_MINUS_DST_ALPHA,[HH]:i.CONSTANT_COLOR,[WH]:i.ONE_MINUS_CONSTANT_COLOR,[jH]:i.CONSTANT_ALPHA,[XH]:i.ONE_MINUS_CONSTANT_ALPHA};function st(xe,bt,Ye,wt,Dt,ct,Ce,jt,qi,Nn){if(xe===Yr){S===!0&&(Et(i.BLEND),S=!1);return}if(S===!1&&($e(i.BLEND),S=!0),xe!==Nf){if(xe!==T||Nn!==z){if((P!==ks||L!==ks)&&(i.blendEquation(i.FUNC_ADD),P=ks,L=ks),Nn)switch(xe){case os:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case Vu:i.blendFunc(i.ONE,i.ONE);break;case qu:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Hu: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 Vu:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case qu:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Hu: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||qi!==B)&&(i.blendColor(jt.r,jt.g,jt.b,qi),N.copy(jt),B=qi),T=xe,z=!1}function tt(xe,bt){xe.side===ir?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!==zT?($e(i.CULL_FACE),xe!==H&&(xe===Qy?i.cullFace(i.BACK):xe===VT?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 Rn(){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:Rn}}function Jpe(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):u_("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?qd: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===Yi?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===Yi?Te=i.DEPTH_COMPONENT32F:X===ja&&(Te=i.DEPTH_COMPONENT16),Te}function D(le,X){return T(le)===!0||le.isFramebufferTexture&&le.minFilter!==xi&&le.minFilter!==vi?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={[Tf]:i.REPEAT,[Go]:i.CLAMP_TO_EDGE,[Ef]:i.MIRRORED_REPEAT},Qe={[xi]:i.NEAREST,[g2]:i.NEAREST_MIPMAP_NEAREST,[tc]:i.NEAREST_MIPMAP_LINEAR,[vi]:i.LINEAR,[rp]:i.LINEAR_MIPMAP_NEAREST,[_o]:i.LINEAR_MIPMAP_LINEAR},Ue={[y2]:i.NEVER,[w2]:i.ALWAYS,[M_]:i.LESS,[nh]:i.LEQUAL,[v2]:i.EQUAL,[Wc]:i.GEQUAL,[zA]:i.GREATER,[b2]:i.NOTEQUAL};function mt(le,X){if(X.type===Yi&&e.has("OES_texture_float_linear")===!1&&(X.magFilter===vi||X.magFilter===rp||X.magFilter===tc||X.magFilter===_o||X.minFilter===vi||X.minFilter===rp||X.minFilter===tc||X.minFilter===_o)&&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===xi||X.minFilter!==tc&&X.minFilter!==_o||X.type===Yi&&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),Rn=ze(Pt.start,X.width,4);Mt.start<=cn+1&&yn===Rn&&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),Rn=cn%X.width,xe=Math.floor(cn/X.width),bt=yn,Ye=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Rn),t.pixelStorei(i.UNPACK_SKIP_ROWS,xe),t.texSubImage2D(i.TEXTURE_2D,0,Rn,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,Rn=St.__version===void 0||Ve===!0,xe=gt.dataReady,bt=D(X,Ke);if(X.isDepthTexture)Pt=L(X.format===Js,X.type),Rn&&(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&&Rn&&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?(Rn&&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&&Rn&&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=T2(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&&Rn&&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(Rn&&t.texStorage3D(i.TEXTURE_2D_ARRAY,bt,Pt,Ke.width,Ke.height,Ke.depth),xe)if(X.layerUpdates.size>0){let Ye=T2(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?(Rn&&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(Rn)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&&Rn){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(Rn){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),Rn=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,Rn,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,Rn,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,Rn,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,Rn,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,Rn,Pt[ct].width,Pt[ct].height,0,cn,yn,Pt[ct].data);for(let Ce=0;Ce<Dt.length;Ce++){let qi=Dt[Ce].image[ct].image;xe?Ye&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,0,0,qi.width,qi.height,cn,yn,qi.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+ct,Ce+1,Rn,qi.width,qi.height,0,cn,yn,qi.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,Rn,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,Rn,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===Js&&(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===Js?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===Js)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!==Vd&&Te!==qo&&(sn.getTransfer(Te)===Bt?(Pe!==vr||Ve!==Gi)&&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 e0e(i,e){function t(n,r=qo){let s,o=sn.getTransfer(r);if(n===Gi)return i.UNSIGNED_BYTE;if(n===LA)return i.UNSIGNED_SHORT_4_4_4_4;if(n===DA)return i.UNSIGNED_SHORT_5_5_5_1;if(n===FA)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===OA)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===ju)return i.BYTE;if(n===Xu)return i.SHORT;if(n===ja)return i.UNSIGNED_SHORT;if(n===Lr)return i.INT;if(n===pi)return i.UNSIGNED_INT;if(n===Yi)return i.FLOAT;if(n===Li)return i.HALF_FLOAT;if(n===E_)return i.ALPHA;if(n===Lf)return i.RGB;if(n===vr)return i.RGBA;if(n===vs)return i.DEPTH_COMPONENT;if(n===Js)return i.DEPTH_STENCIL;if(n===Df)return i.RED;if(n===$u)return i.RED_INTEGER;if(n===Ts)return i.RG;if(n===Yu)return i.RG_INTEGER;if(n===sp)return i.RGBA_INTEGER;if(n===Zu||n===Ku||n===Qu||n===Ju)if(o===Bt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Zu)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Ku)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Qu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Ju)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Zu)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Ku)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Qu)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Ju)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===BA||n===UA||n===kA||n===GA)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===BA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===UA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===kA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===GA)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===op||n===ap||n===lp||n===cp||n===up||n===eh||n===hp)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===op||n===ap)return o===Bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===lp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===cp)return s.COMPRESSED_R11_EAC;if(n===up)return s.COMPRESSED_SIGNED_R11_EAC;if(n===eh)return s.COMPRESSED_RG11_EAC;if(n===hp)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===fp||n===dp||n===pp||n===Ap||n===mp||n===gp||n===_p||n===xp||n===yp||n===vp||n===bp||n===wp||n===Sp||n===Tp)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===fp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===dp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Ap)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===gp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===_p)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===xp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===yp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===vp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===bp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===wp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Sp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Tp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Ep||n===Mp||n===Cp)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===Ep)return o===Bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Mp)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Cp)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Rp||n===Pp||n===th||n===Ip)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===Rp)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Pp)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===th)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ip)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 t0e=`40934093 void main() {40944094 40954095 gl_Position = vec4( position, 1.0 );40964096 4097-}`,Ype=`4097+}`,n0e=`40984098 uniform sampler2DArray depthColor;40994099 uniform float depthWidth;41004100 uniform float depthHeight;@@ -4113,23 +4113,23 @@ void main() {
41134113 41144114 }41154115 4116-}`,UL=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new vy(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 Xr({vertexShader:$pe,fragmentShader:Ype,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Hn(new SA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},kL=class extends Go{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 UL,T={},P=t.getContextAttributes(),R=null,C=null,L=[],D=[],F=new Oe,N=null,B=new Rr;B.viewport=new gn;let z=new Rr;z.viewport=new gn;let V=[B,z],H=new v_,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?Qs:ys,Et=P.stencil?zo: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 ua(p.textureWidth,p.textureHeight,{format:xr,type:Gi,depthTexture:new os(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 ua(x.framebufferWidth,x.framebufferHeight,{format:xr,type:Gi,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,On=ln+(Et-Qt),le=Xe*Gt/ge*xn,X=st*Gt/ge*xn;Me.projectionMatrix.makePerspective(di,On,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=Ef*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 Rr,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 vy,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 wW;mt.setAnimationLoop(Ue),this.setAnimationLoop=function(Me){Qe=Me},this.dispose=function(){}}},Zpe=new on,RW=new Sn;RW.set(-1,0,0,0,1,0,0,0,1);function Kpe(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,gL(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(Zpe.makeRotationFromEuler(C)).transpose(),R.isCubeTexture&&R.isRenderTargetTexture===!1&&S.envMapRotation.value.premultiply(RW),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 Qpe(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 Jpe=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]),nh=null;function e0e(){return nh===null&&(nh=new xA(Jpe,16,16,Ss,Li),nh.name="DFG_LUT",nh.minFilter=vi,nh.magFilter=vi,nh.wrapS=ko,nh.wrapT=ko,nh.generateMipmaps=!1,nh.needsUpdate=!0),nh}var JT=class{constructor(e={}){let{canvas:t=$T(),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=Gi}=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([ip,$u,Xu]),T=new Set([Gi,pi,Wa,zo,IA,NA]),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=ks,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let z=this,V=!1,H=null,Z=null,J=null,j=null;this._outputColorSpace=jr;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 Zl,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",qi,!1),t.addEventListener("webglcontextrestored",In,!1),t.addEventListener("webglcontextcreationerror",kr,!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 On,le,X,Te,Pe,Ve,gt,St,qe,Ke,Rt,en,Pt,Mt,cn,yn,Rn,xe,bt,Ye,wt,Dt,ct;function Ce(){On=new ade(ge),On.init(),wt=new Xpe(ge,On),le=new Jfe(ge,On,e,wt),X=new Wpe(ge,On),le.reversedDepthBuffer&&p&&X.buffers.depth.setReversed(!0),Z=ge.createFramebuffer(),J=ge.createFramebuffer(),j=ge.createFramebuffer(),Te=new ude(ge),Pe=new Ipe,Ve=new jpe(ge,On,X,Pe,le,wt,Te),gt=new ode(z),St=new pue(ge),Dt=new Kfe(ge,St),qe=new lde(ge,St,Te,Dt),Ke=new fde(ge,qe,St,Dt,Te),xe=new hde(ge,le,Ve),cn=new ede(Pe),Rt=new Ppe(z,gt,On,le,Dt,cn),en=new Kpe(z,Pe),Pt=new Lpe,Mt=new kpe(On),Rn=new Zfe(z,gt,X,Ke,v,l),yn=new Hpe(z,Ke,le),ct=new Qpe(ge,Te,le,X),bt=new Qfe(ge,On,Te),Ye=new cde(ge,On,Te),Te.programs=Rt.programs,z.capabilities=le,z.extensions=On,z.properties=Pe,z.renderLists=Pt,z.shadowMap=yn,z.state=X,z.info=Te}Ce(),w!==Gi&&(B=new pde(w,t.width,t.height,a,r,s));let jt=new kL(z,ge);this.xr=jt,this.getContext=function(){return ge},this.getContextAttributes=function(){return ge.getContextAttributes()},this.forceContextLoss=function(){let te=On.get("WEBGL_lose_context");te&&te.loseContext()},this.forceContextRestore=function(){let te=On.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===Gi){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(Rn.getClearColor())},this.setClearColor=function(){Rn.setClearColor(...arguments)},this.getClearAlpha=function(){return Rn.getClearAlpha()},this.setClearAlpha=function(){Rn.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=Rn.getClearColor(),tn=Rn.getClearAlpha(),hn=kt.r,Gn=kt.g,Xn=kt.b;Yt?(P[0]=hn,P[1]=Gn,P[2]=Xn,P[3]=tn,ge.clearBufferuiv(ge.COLOR,0,P)):(R[0]=hn,R[1]=Gn,R[2]=Xn,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",qi,!1),t.removeEventListener("webglcontextrestored",In,!1),t.removeEventListener("webglcontextcreationerror",kr,!1),Rn.dispose(),Pt.dispose(),Mt.dispose(),Pe.dispose(),gt.dispose(),Ke.dispose(),Dt.dispose(),ct.dispose(),Rt.dispose(),jt.dispose(),jt.removeEventListener("sessionstart",Rs),jt.removeEventListener("sessionend",sl),hu.stop()};function qi(te){te.preventDefault(),AA("WebGLRenderer: Context Lost."),V=!0}function In(){AA("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 kr(te){Ge("WebGLRenderer: A WebGL context could not be created. Reason: ",te.statusMessage)}function mr(te){let Se=te.target;Se.removeEventListener("dispose",mr),il(Se)}function il(te){ta(te),Pe.remove(te)}function ta(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=kk(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 Gn=ke.drawRange,Xn=ke.attributes.position,pn=Gn.start*hn,Bi=(Gn.start+Gn.count)*hn;zt!==null&&(pn=Math.max(pn,zt.start*hn),Bi=Math.min(Bi,(zt.start+zt.count)*hn)),tn!==null?(pn=Math.max(pn,0),Bi=Math.min(Bi,tn.count)):Xn!=null&&(pn=Math.max(pn,0),Bi=Math.min(Bi,Xn.count));let Gr=Bi-pn;if(Gr<0||Gr===1/0)return;Dt.setup(De,Le,kt,ke,tn);let Tr,Hi=bt;if(tn!==null&&(Tr=St.get(tn),Hi=Ye,Hi.setIndex(Tr)),De.isMesh)Le.wireframe===!0?(X.setLineWidth(Le.wireframeLinewidth*xn()),Hi.setMode(ge.LINES)):Hi.setMode(ge.TRIANGLES);else if(De.isLine){let so=Le.linewidth;so===void 0&&(so=1),X.setLineWidth(so*xn()),De.isLineSegments?Hi.setMode(ge.LINES):De.isLineLoop?Hi.setMode(ge.LINE_LOOP):Hi.setMode(ge.LINE_STRIP)}else De.isPoints?Hi.setMode(ge.POINTS):De.isSprite&&Hi.setMode(ge.TRIANGLES);if(De.isBatchedMesh)if(On.get("WEBGL_multi_draw"))Hi.renderMultiDraw(De._multiDrawStarts,De._multiDrawCounts,De._multiDrawCount);else{let so=De._multiDrawStarts,Xt=De._multiDrawCounts,Na=De._multiDrawCount,Ai=tn?St.get(tn).bytesPerElement:1,ol=Pe.get(Le).currentProgram.getUniforms();for(let gc=0;gc<Na;gc++)ol.setValue(ge,"_gl_DrawID",gc),Hi.render(so[gc]/Ai,Xt[gc])}else if(De.isInstancedMesh)Hi.renderInstances(pn,Gr,De.count);else if(ke.isInstancedBufferGeometry){let so=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Xt=Math.min(ke.instanceCount,so);Hi.renderInstances(pn,Gr,Xt)}else Hi.render(pn,Gr)};function rl(te,Se,ke){te.transparent===!0&&te.side===ir&&te.forceSinglePass===!1?(te.side=ui,te.needsUpdate=!0,Q1(te,Se,ke),te.side=Ao,te.needsUpdate=!0,Q1(te,Se,ke),te.side=ir):Q1(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];rl(kt,ke,De),Le.add(kt)}else rl(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)}On.get("KHR_parallel_shader_compile")!==null?zt():setTimeout(zt,10)})};let Ia=null;function sr(te){Ia&&Ia(te)}function Rs(){hu.stop()}function sl(){hu.start()}let hu=new wW;hu.setAnimationLoop(sr),typeof self<"u"&&hu.setContext(self),this.setAnimationLoop=function(te){Ia=te,jt.setAnimationLoop(te),te===null?hu.stop():hu.start()},jt.addEventListener("sessionstart",Rs),jt.addEventListener("sessionend",sl),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,po,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&&Bb(Yt,Se,-1/0,z.sortObjects)}Bb(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&&Rn.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,Gn=tn.length;hn<Gn;hn++){let Xn=tn[hn];QR(Yt,kt,te,Xn)}Qt&&Rn.render(te);for(let hn=0,Gn=tn.length;hn<Gn;hn++){let Xn=tn[hn];KR(L,te,Xn,Xn.viewport)}}else kt.length>0&&QR(Yt,kt,te,Se),Qt&&Rn.render(te),KR(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 Bb(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,Gn=tn.length;hn<Gn;hn++){let Xn=tn[hn],pn=kt[Xn.materialIndex];pn&&pn.visible&&L.push(te,Yt,pn,ke,ln.z,Xn)}}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++)Bb(zt[Yt],Se,ke,Le)}function KR(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&&K1(De,Se,ke),zt.length>0&&K1(zt,Se,ke),Yt.length>0&&K1(Yt,Se,ke),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function QR(te,Se,ke,Le){if((ke.isScene===!0?ke.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[Le.id]===void 0){let pn=On.has("EXT_color_buffer_half_float")||On.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[Le.id]=new ua(1,1,{generateMipmaps:!0,type:pn?Li:Gi,minFilter:go,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&&Rn.render(ke);let Gn=z.toneMapping;z.toneMapping=ks;let Xn=Le.viewport;if(Le.viewport!==void 0&&(Le.viewport=void 0),D.setupLightsView(Le),st===!0&&cn.setGlobalState(z.clippingPlanes,Le),K1(te,ke,Le),Ve.updateMultisampleRenderTarget(zt),Ve.updateRenderTargetMipmap(zt),On.has("WEBGL_multisampled_render_to_texture")===!1){let pn=!1;for(let Bi=0,Gr=Se.length;Bi<Gr;Bi++){let Tr=Se[Bi],{object:Hi,geometry:so,material:Xt,group:Na}=Tr;if(Xt.side===ir&&Hi.layers.test(Le.layers)){let Ai=Xt.side;Xt.side=ui,Xt.needsUpdate=!0,JR(Hi,ke,Le,so,Xt,Na),Xt.side=Ai,Xt.needsUpdate=!0,pn=!0}}pn===!0&&(Ve.updateMultisampleRenderTarget(zt),Ve.updateRenderTargetMipmap(zt))}z.setRenderTarget(kt,tn,hn),z.setClearColor(Ue,mt),Xn!==void 0&&(Le.viewport=Xn),z.toneMapping=Gn}function K1(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,Gn=Yt.material;Gn.allowOverride===!0&&Le!==null&&(Gn=Le),kt.layers.test(ke.layers)&&JR(kt,Se,ke,tn,Gn,hn)}}function JR(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===ir&&De.forceSinglePass===!1?(De.side=ui,De.needsUpdate=!0,z.renderBufferDirect(ke,Se,Le,De,te,zt),De.side=Ao,De.needsUpdate=!0,z.renderBufferDirect(ke,Se,Le,De,te,zt),De.side=ir):z.renderBufferDirect(ke,Se,Le,De,te,zt),te.onAfterRender(z,Se,ke,Le,De,zt)}function Q1(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 Gn=te.isMeshStandardMaterial||te.isMeshLambertMaterial&&!te.envMap||te.isMeshPhongMaterial&&!te.envMap;Le.envMap=gt.get(te.envMap||Le.environment,Gn),Le.envMapRotation=Le.environment!==null&&te.envMap===null?Se.environmentRotation:te.envMapRotation,hn===void 0&&(te.addEventListener("dispose",mr),hn=new Map,Le.programs=hn);let Xn=hn.get(tn);if(Xn!==void 0){if(Le.currentProgram===Xn&&Le.lightsStateVersion===Yt)return t4(te,kt),Xn}else kt.uniforms=Rt.getUniforms(te),H!==null&&te.isNodeMaterial&&H.build(te,ke,kt),te.onBeforeCompile(kt,z),Xn=Rt.acquireProgram(kt,tn),hn.set(tn,Xn),Le.uniforms=kt.uniforms;let pn=Le.uniforms;return(!te.isShaderMaterial&&!te.isRawShaderMaterial||te.clipping===!0)&&(pn.clippingPlanes=cn.uniform),t4(te,kt),Le.needsLights=zk(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=Xn,Le.uniformsList=null,Xn}function e4(te){if(te.uniformsList===null){let Se=te.currentProgram.getUniforms();te.uniformsList=C_.seqWithValue(Se.seq,te.uniforms)}return te.uniformsList}function t4(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 Uk(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 kk(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),Gn=Le.vertexColors===!0&&!!ke.attributes.color&&ke.attributes.color.itemSize===4,Xn=!!ke.attributes.tangent&&(!!Le.normalMap||Le.anisotropy>0),pn=!!ke.morphAttributes.position,Bi=!!ke.morphAttributes.normal,Gr=!!ke.morphAttributes.color,Tr=ks;Le.toneMapped&&(ae===null||ae.isXRRenderTarget===!0)&&(Tr=z.toneMapping);let Hi=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,so=Hi!==void 0?Hi.length:0,Xt=Pe.get(Le),Na=D.state.lights;if(st===!0&&(tt===!0||te!==de)){let er=te===de&&Le.id===ce;cn.setState(Le,te,er)}let Ai=!1;Le.version===Xt.__version?(Xt.needsLights&&Xt.lightsStateVersion!==Na.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!==Gn||Xt.vertexTangents!==Xn||Xt.morphTargets!==pn||Xt.morphNormals!==Bi||Xt.morphColors!==Gr||Xt.toneMapping!==Tr||Xt.morphTargetsCount!==so||!!Xt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(Ai=!0):(Ai=!0,Xt.__version=Le.version);let ol=Xt.currentProgram;Ai===!0&&(ol=Q1(Le,Se,De),H&&Le.isNodeMaterial&&H.onUpdateProgram(Le,ol,Xt));let gc=!1,qh=!1,b0=!1,Wi=ol.getUniforms(),zr=Xt.uniforms;if(X.useProgram(ol.program)&&(gc=!0,qh=!0,b0=!0),Le.id!==ce&&(ce=Le.id,qh=!0),Xt.needsLights){let er=Uk(D.state.lightProbeGridArray,De);Xt.lightProbeGrid!==er&&(Xt.lightProbeGrid=er,qh=!0)}if(gc||de!==te){X.buffers.depth.getReversed()&&te.reversedDepth!==!0&&(te._reversedDepth=!0,te.updateProjectionMatrix()),Wi.setValue(ge,"projectionMatrix",te.projectionMatrix),Wi.setValue(ge,"viewMatrix",te.matrixWorldInverse);let Wh=Wi.map.cameraPosition;Wh!==void 0&&Wh.setValue(ge,yt.setFromMatrixPosition(te.matrixWorld)),le.logarithmicDepthBuffer&&Wi.setValue(ge,"logDepthBufFC",2/(Math.log(te.far+1)/Math.LN2)),(Le.isMeshPhongMaterial||Le.isMeshToonMaterial||Le.isMeshLambertMaterial||Le.isMeshBasicMaterial||Le.isMeshStandardMaterial||Le.isShaderMaterial)&&Wi.setValue(ge,"isOrthographic",te.isOrthographicCamera===!0),de!==te&&(de=te,qh=!0,b0=!0)}if(Xt.needsLights&&(Na.state.directionalShadowMap.length>0&&Wi.setValue(ge,"directionalShadowMap",Na.state.directionalShadowMap,Ve),Na.state.spotShadowMap.length>0&&Wi.setValue(ge,"spotShadowMap",Na.state.spotShadowMap,Ve),Na.state.pointShadowMap.length>0&&Wi.setValue(ge,"pointShadowMap",Na.state.pointShadowMap,Ve)),De.isSkinnedMesh){Wi.setOptional(ge,De,"bindMatrix"),Wi.setOptional(ge,De,"bindMatrixInverse");let er=De.skeleton;er&&(er.boneTexture===null&&er.computeBoneTexture(),Wi.setValue(ge,"boneTexture",er.boneTexture,Ve))}De.isBatchedMesh&&(Wi.setOptional(ge,De,"batchingTexture"),Wi.setValue(ge,"batchingTexture",De._matricesTexture,Ve),Wi.setOptional(ge,De,"batchingIdTexture"),Wi.setValue(ge,"batchingIdTexture",De._indirectTexture,Ve),Wi.setOptional(ge,De,"batchingColorTexture"),De._colorsTexture!==null&&Wi.setValue(ge,"batchingColorTexture",De._colorsTexture,Ve));let Hh=ke.morphAttributes;if((Hh.position!==void 0||Hh.normal!==void 0||Hh.color!==void 0)&&xe.update(De,ke,ol),(qh||Xt.receiveShadow!==De.receiveShadow)&&(Xt.receiveShadow=De.receiveShadow,Wi.setValue(ge,"receiveShadow",De.receiveShadow)),(Le.isMeshStandardMaterial||Le.isMeshLambertMaterial||Le.isMeshPhongMaterial)&&Le.envMap===null&&Se.environment!==null&&(zr.envMapIntensity.value=Se.environmentIntensity),zr.dfgLUT!==void 0&&(zr.dfgLUT.value=e0e()),qh){if(Wi.setValue(ge,"toneMappingExposure",z.toneMappingExposure),Xt.needsLights&&Gk(zr,b0),zt&&Le.fog===!0&&en.refreshFogUniforms(zr,zt),en.refreshMaterialUniforms(zr,Le,$e,ze,D.state.transmissionRenderTarget[te.id]),Xt.needsLights&&Xt.lightProbeGrid){let er=Xt.lightProbeGrid;zr.probesSH.value=er.texture,zr.probesMin.value.copy(er.boundingBox.min),zr.probesMax.value.copy(er.boundingBox.max),zr.probesResolution.value.copy(er.resolution)}C_.upload(ge,e4(Xt),zr,Ve)}if(Le.isShaderMaterial&&Le.uniformsNeedUpdate===!0&&(C_.upload(ge,e4(Xt),zr,Ve),Le.uniformsNeedUpdate=!1),Le.isSpriteMaterial&&Wi.setValue(ge,"center",De.center),Wi.setValue(ge,"modelViewMatrix",De.modelViewMatrix),Wi.setValue(ge,"normalMatrix",De.normalMatrix),Wi.setValue(ge,"modelMatrix",De.matrixWorld),Le.uniformsGroups!==void 0){let er=Le.uniformsGroups;for(let Wh=0,w0=er.length;Wh<w0;Wh++){let n4=er[Wh];ct.update(n4,ol),ct.bind(n4,ol)}}return ol}function Gk(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 zk(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 Gn=te.depthTexture;if(kt.__boundDepthTexture!==Gn){if(Gn!==null&&Pe.has(Gn)&&(te.width!==Gn.image.width||te.height!==Gn.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],Gn=hn.format,Xn=hn.type;if(te.textures.length>1&&ge.readBuffer(ge.COLOR_ATTACHMENT0+kt),!le.textureFormatReadable(Gn)){Ge("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!le.textureTypeReadable(Xn)){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(Gn),wt.convert(Xn),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],Gn=hn.format,Xn=hn.type;if(te.textures.length>1&&ge.readBuffer(ge.COLOR_ATTACHMENT0+kt),!le.textureFormatReadable(Gn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!le.textureTypeReadable(Xn))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(Gn),wt.convert(Xn),0);let Bi=ae!==null?Pe.get(ae).__webglFramebuffer:null;X.bindFramebuffer(ge.FRAMEBUFFER,Bi);let Gr=ge.fenceSync(ge.SYNC_GPU_COMMANDS_COMPLETE,0);return ge.flush(),await jH(ge,Gr,4),ge.bindBuffer(ge.PIXEL_PACK_BUFFER,pn),ge.getBufferSubData(ge.PIXEL_PACK_BUFFER,0,zt),ge.deleteBuffer(pn),ge.deleteSync(Gr),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,Gn,Xn,pn,Bi,Gr,Tr=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,Gn=ke.min.y,Xn=ke.isBox3?ke.min.z:0;else{let zr=Math.pow(2,-De);Yt=Math.floor(Tr.width*zr),kt=Math.floor(Tr.height*zr),te.isDataArrayTexture?tn=Tr.depth:te.isData3DTexture?tn=Math.floor(Tr.depth*zr):tn=1,hn=0,Gn=0,Xn=0}Le!==null?(pn=Le.x,Bi=Le.y,Gr=Le.z):(pn=0,Bi=0,Gr=0);let Hi=wt.convert(Se.format),so=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 Na=X.getParameter(ge.UNPACK_ROW_LENGTH),Ai=X.getParameter(ge.UNPACK_IMAGE_HEIGHT),ol=X.getParameter(ge.UNPACK_SKIP_PIXELS),gc=X.getParameter(ge.UNPACK_SKIP_ROWS),qh=X.getParameter(ge.UNPACK_SKIP_IMAGES);X.pixelStorei(ge.UNPACK_ROW_LENGTH,Tr.width),X.pixelStorei(ge.UNPACK_IMAGE_HEIGHT,Tr.height),X.pixelStorei(ge.UNPACK_SKIP_PIXELS,hn),X.pixelStorei(ge.UNPACK_SKIP_ROWS,Gn),X.pixelStorei(ge.UNPACK_SKIP_IMAGES,Xn);let b0=te.isDataArrayTexture||te.isData3DTexture,Wi=Se.isDataArrayTexture||Se.isData3DTexture;if(te.isDepthTexture){let zr=Pe.get(te),Hh=Pe.get(Se),er=Pe.get(zr.__renderTarget),Wh=Pe.get(Hh.__renderTarget);X.bindFramebuffer(ge.READ_FRAMEBUFFER,er.__webglFramebuffer),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,Wh.__webglFramebuffer);for(let w0=0;w0<tn;w0++)b0&&(ge.framebufferTextureLayer(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Pe.get(te).__webglTexture,De,Xn+w0),ge.framebufferTextureLayer(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Pe.get(Se).__webglTexture,zt,Gr+w0)),ge.blitFramebuffer(hn,Gn,Yt,kt,pn,Bi,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 zr=Pe.get(te),Hh=Pe.get(Se);X.bindFramebuffer(ge.READ_FRAMEBUFFER,J),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,j);for(let er=0;er<tn;er++)b0?ge.framebufferTextureLayer(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,zr.__webglTexture,De,Xn+er):ge.framebufferTexture2D(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,zr.__webglTexture,De),Wi?ge.framebufferTextureLayer(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Hh.__webglTexture,zt,Gr+er):ge.framebufferTexture2D(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,Hh.__webglTexture,zt),De!==0?ge.blitFramebuffer(hn,Gn,Yt,kt,pn,Bi,Yt,kt,ge.COLOR_BUFFER_BIT,ge.NEAREST):Wi?ge.copyTexSubImage3D(Xt,zt,pn,Bi,Gr+er,hn,Gn,Yt,kt):ge.copyTexSubImage2D(Xt,zt,pn,Bi,hn,Gn,Yt,kt);X.bindFramebuffer(ge.READ_FRAMEBUFFER,null),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,null)}else Wi?te.isDataTexture||te.isData3DTexture?ge.texSubImage3D(Xt,zt,pn,Bi,Gr,Yt,kt,tn,Hi,so,Tr.data):Se.isCompressedArrayTexture?ge.compressedTexSubImage3D(Xt,zt,pn,Bi,Gr,Yt,kt,tn,Hi,Tr.data):ge.texSubImage3D(Xt,zt,pn,Bi,Gr,Yt,kt,tn,Hi,so,Tr):te.isDataTexture?ge.texSubImage2D(ge.TEXTURE_2D,zt,pn,Bi,Yt,kt,Hi,so,Tr.data):te.isCompressedTexture?ge.compressedTexSubImage2D(ge.TEXTURE_2D,zt,pn,Bi,Tr.width,Tr.height,Hi,Tr.data):ge.texSubImage2D(ge.TEXTURE_2D,zt,pn,Bi,Yt,kt,Hi,so,Tr);X.pixelStorei(ge.UNPACK_ROW_LENGTH,Na),X.pixelStorei(ge.UNPACK_IMAGE_HEIGHT,Ai),X.pixelStorei(ge.UNPACK_SKIP_PIXELS,ol),X.pixelStorei(ge.UNPACK_SKIP_ROWS,gc),X.pixelStorei(ge.UNPACK_SKIP_IMAGES,qh),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 po}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 n3=class extends $i{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}},P_=new ie,PW=new on,IW=new on,NW=new ie,LW=new ie,i3=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(),PW.copy(w.matrixWorldInverse),IW.multiplyMatrices(w.projectionMatrix,PW),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){P_.setFromMatrixPosition(v.matrixWorld),P_.applyMatrix4(IW);let T=P_.z>=-1&&P_.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("+(P_.x*s+s)+"px,"+(-P_.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 NW.setFromMatrixPosition(v.matrixWorld),LW.setFromMatrixPosition(w.matrixWorld),NW.distanceToSquared(LW)}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 t0e(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var M2=t0e;var n0e=typeof global=="object"&&global&&global.Object===Object&&global,DW=n0e;var i0e=typeof self=="object"&&self&&self.Object===Object&&self,r0e=DW||i0e||Function("return this")(),r3=r0e;var s0e=function(){return r3.Date.now()},s3=s0e;var o0e=/\s/;function a0e(i){for(var e=i.length;e--&&o0e.test(i.charAt(e)););return e}var FW=a0e;var l0e=/^\s+/;function c0e(i){return i&&i.slice(0,FW(i)+1).replace(l0e,"")}var OW=c0e;var u0e=r3.Symbol,I_=u0e;var BW=Object.prototype,h0e=BW.hasOwnProperty,f0e=BW.toString,C2=I_?I_.toStringTag:void 0;function d0e(i){var e=h0e.call(i,C2),t=i[C2];try{i[C2]=void 0;var n=!0}catch{}var r=f0e.call(i);return n&&(e?i[C2]=t:delete i[C2]),r}var UW=d0e;var p0e=Object.prototype,A0e=p0e.toString;function m0e(i){return A0e.call(i)}var kW=m0e;var g0e="[object Null]",_0e="[object Undefined]",GW=I_?I_.toStringTag:void 0;function x0e(i){return i==null?i===void 0?_0e:g0e:GW&&GW in Object(i)?UW(i):kW(i)}var zW=x0e;function y0e(i){return i!=null&&typeof i=="object"}var VW=y0e;var v0e="[object Symbol]";function b0e(i){return typeof i=="symbol"||VW(i)&&zW(i)==v0e}var qW=b0e;var HW=NaN,w0e=/^[-+]0x[0-9a-f]+$/i,S0e=/^0b[01]+$/i,T0e=/^0o[0-7]+$/i,E0e=parseInt;function M0e(i){if(typeof i=="number")return i;if(qW(i))return HW;if(M2(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=M2(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=OW(i);var t=S0e.test(i);return t||T0e.test(i)?E0e(i.slice(2),t?2:8):w0e.test(i)?HW:+i}var GL=M0e;var C0e="Expected a function",R0e=Math.max,P0e=Math.min;function I0e(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(C0e);e=GL(e)||0,M2(t)&&(u=!!t.leading,f="maxWait"in t,s=f?R0e(GL(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?P0e(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=s3();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(s3())}function L(){var D=s3(),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 WW=I0e;function jW(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 N0e(i){if(Array.isArray(i))return i}function L0e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function D0e(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function F0e(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 O0e(){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 B0e(i,e){return N0e(i)||F0e(i,e)||U0e(i,e)||O0e()}function U0e(i,e){if(i){if(typeof i=="string")return jW(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)?jW(i,e):void 0}}var k0e=D0e(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;L0e(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Nr(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 k0e(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=WW(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=B0e(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 Lr=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-Lr.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?Lr.Bounce.In(i*2)*.5:Lr.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}}}}),R2=function(){return performance.now()},WA=(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=R2()),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})(),N_={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=N_.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=N_.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=N_.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=N_.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}}},XW=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),zL=new WA,Vs=(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=Lr.Linear.None,this._interpolationFunction=N_.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=XW.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=R2()),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=R2()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=R2()),!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=Lr.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=N_.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=R2()),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 sHe=XW.nextId,ih=zL,oHe=ih.getAll.bind(ih),aHe=ih.removeAll.bind(ih),lHe=ih.add.bind(ih),cHe=ih.remove.bind(ih),uHe=ih.update.bind(ih);function $W(i){let e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return YW(this.cover(e,t,n),e,t,n,i)}function YW(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 ZW(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)YW(this,t[f],n[f],r[f],i[f]);return this}function KW(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 QW(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function JW(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 Di(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 ej(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 Di(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 Di(P[7],L,D,F,f,p,x),new Di(P[6],l,D,F,L,p,x),new Di(P[5],L,c,F,f,D,x),new Di(P[4],l,c,F,L,D,x),new Di(P[3],L,D,u,f,p,F),new Di(P[2],l,D,u,L,p,F),new Di(P[1],L,c,u,f,D,F),new Di(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 G0e=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function tj(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;G0e(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 nj(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 ij(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function rj(){return this._root}function sj(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function oj(i){var e=[],t,n=this._root,r,s,o,a,l,c,u;for(n&&e.push(new Di(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 Di(r,f,p,x,l,c,u)),(r=n[6])&&e.push(new Di(r,s,p,x,f,c,u)),(r=n[5])&&e.push(new Di(r,f,o,x,l,p,u)),(r=n[4])&&e.push(new Di(r,s,o,x,f,p,u)),(r=n[3])&&e.push(new Di(r,f,p,a,l,c,x)),(r=n[2])&&e.push(new Di(r,s,p,a,f,c,x)),(r=n[1])&&e.push(new Di(r,f,o,a,l,p,x)),(r=n[0])&&e.push(new Di(r,s,o,a,f,p,x))}return this}function aj(i){var e=[],t=[],n;for(this._root&&e.push(new Di(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 Di(s,o,a,l,p,x,v)),(s=r[1])&&e.push(new Di(s,p,a,l,c,x,v)),(s=r[2])&&e.push(new Di(s,o,x,l,p,u,v)),(s=r[3])&&e.push(new Di(s,p,x,l,c,u,v)),(s=r[4])&&e.push(new Di(s,o,a,v,p,x,f)),(s=r[5])&&e.push(new Di(s,p,a,v,c,x,f)),(s=r[6])&&e.push(new Di(s,o,x,v,p,u,f)),(s=r[7])&&e.push(new Di(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 lj(i){return i[0]}function cj(i){return arguments.length?(this._x=i,this):this._x}function uj(i){return i[1]}function hj(i){return arguments.length?(this._y=i,this):this._y}function fj(i){return i[2]}function dj(i){return arguments.length?(this._z=i,this):this._z}function P2(i,e,t,n){var r=new VL(e??lj,t??uj,n??fj,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function VL(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 _o=P2.prototype=VL.prototype;_o.copy=function(){var i=new VL(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};_o.add=$W;_o.addAll=ZW;_o.cover=KW;_o.data=QW;_o.extent=JW;_o.find=ej;_o.findAllWithinRadius=tj;_o.remove=nj;_o.removeAll=ij;_o.root=rj;_o.size=sj;_o.visit=oj;_o.visitAfter=aj;_o.x=cj;_o.y=hj;_o.z=dj;function jA(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 o3(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===qL?i:z0e,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 z0e(){return 0}function HL(i){return i===null?NaN:+i}var Aj=o3(jA),mj=Aj.right,V0e=Aj.left,q0e=o3(HL).center,I2=mj;function Ip(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 xo=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 H0e=Math.sqrt(50),W0e=Math.sqrt(10),j0e=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>=H0e?10:s>=W0e?5:s>=j0e?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 l3(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 N2(i,e,t){return e=+e,i=+i,t=+t,a3(i,e,t)[2]}function WL(i,e,t){e=+e,i=+i,t=+t;let n=e<i,r=n?N2(e,i,t):N2(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function c3(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 u3(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*X0e(i){for(let e of i)yield*e}function rh(i){return Array.from(X0e(i))}function Ff(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 h3(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 f3(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function d3(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function jL(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function F2(){}var L2=.7,m3=1/L2,L_="\\s*([+-]?\\d+)\\s*",D2="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",sh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$0e=/^#([0-9a-f]{3,8})$/,Y0e=new RegExp(`^rgb\\(${L_},${L_},${L_}\\)$`),Z0e=new RegExp(`^rgb\\(${sh},${sh},${sh}\\)$`),K0e=new RegExp(`^rgba\\(${L_},${L_},${L_},${D2}\\)$`),Q0e=new RegExp(`^rgba\\(${sh},${sh},${sh},${D2}\\)$`),J0e=new RegExp(`^hsl\\(${D2},${sh},${sh}\\)$`),eAe=new RegExp(`^hsla\\(${D2},${sh},${sh},${D2}\\)$`),gj={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};d3(F2,Xc,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:_j,formatHex:_j,formatHex8:tAe,formatHsl:nAe,formatRgb:xj,toString:xj});function _j(){return this.rgb().formatHex()}function tAe(){return this.rgb().formatHex8()}function nAe(){return Tj(this).formatHsl()}function xj(){return this.rgb().formatRgb()}function Xc(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=$0e.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?yj(e):t===3?new ja(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?p3(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?p3(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=Y0e.exec(i))?new ja(e[1],e[2],e[3],1):(e=Z0e.exec(i))?new ja(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=K0e.exec(i))?p3(e[1],e[2],e[3],e[4]):(e=Q0e.exec(i))?p3(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=J0e.exec(i))?wj(e[1],e[2]/100,e[3]/100,1):(e=eAe.exec(i))?wj(e[1],e[2]/100,e[3]/100,e[4]):gj.hasOwnProperty(i)?yj(gj[i]):i==="transparent"?new ja(NaN,NaN,NaN,0):null}function yj(i){return new ja(i>>16&255,i>>8&255,i&255,1)}function p3(i,e,t,n){return n<=0&&(i=e=t=NaN),new ja(i,e,t,n)}function iAe(i){return i instanceof F2||(i=Xc(i)),i?(i=i.rgb(),new ja(i.r,i.g,i.b,i.opacity)):new ja}function D_(i,e,t,n){return arguments.length===1?iAe(i):new ja(i,e,t,n??1)}function ja(i,e,t,n){this.r=+i,this.g=+e,this.b=+t,this.opacity=+n}d3(ja,D_,jL(F2,{brighter(i){return i=i==null?m3:Math.pow(m3,i),new ja(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?L2:Math.pow(L2,i),new ja(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new ja($A(this.r),$A(this.g),$A(this.b),g3(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:vj,formatHex:vj,formatHex8:rAe,formatRgb:bj,toString:bj}));function vj(){return`#${XA(this.r)}${XA(this.g)}${XA(this.b)}`}function rAe(){return`#${XA(this.r)}${XA(this.g)}${XA(this.b)}${XA((isNaN(this.opacity)?1:this.opacity)*255)}`}function bj(){let i=g3(this.opacity);return`${i===1?"rgb(":"rgba("}${$A(this.r)}, ${$A(this.g)}, ${$A(this.b)}${i===1?")":`, ${i})`}`}function g3(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function $A(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function XA(i){return i=$A(i),(i<16?"0":"")+i.toString(16)}function wj(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new jc(i,e,t,n)}function Tj(i){if(i instanceof jc)return new jc(i.h,i.s,i.l,i.opacity);if(i instanceof F2||(i=Xc(i)),!i)return new jc;if(i instanceof jc)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 jc(o,a,l,i.opacity)}function Ej(i,e,t,n){return arguments.length===1?Tj(i):new jc(i,e,t,n??1)}function jc(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}d3(jc,Ej,jL(F2,{brighter(i){return i=i==null?m3:Math.pow(m3,i),new jc(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?L2:Math.pow(L2,i),new jc(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 ja(XL(i>=240?i-240:i+120,r,n),XL(i,r,n),XL(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new jc(Sj(this.h),A3(this.s),A3(this.l),g3(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=g3(this.opacity);return`${i===1?"hsl(":"hsla("}${Sj(this.h)}, ${A3(this.s)*100}%, ${A3(this.l)*100}%${i===1?")":`, ${i})`}`}}));function Sj(i){return i=(i||0)%360,i<0?i+360:i}function A3(i){return Math.max(0,Math.min(1,i||0))}function XL(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 $L(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 Mj(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 $L((t-n/e)*e,o,r,s,a)}}function Cj(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 $L((t-n/e)*e,r,s,o,a)}}var O2=i=>()=>i;function sAe(i,e){return function(t){return i+t*e}}function oAe(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 Rj(i){return(i=+i)==1?_3:function(e,t){return t-e?oAe(e,t,i):O2(isNaN(e)?t:e)}}function _3(i,e){var t=e-i;return t?sAe(i,t):O2(isNaN(i)?e:i)}var YL=(function i(e){var t=Rj(e);function n(r,s){var o=t((r=D_(r)).r,(s=D_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),c=_3(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 Pj(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=D_(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 kWe=Pj(Mj),GWe=Pj(Cj);function x3(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 y3(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function ZL(i,e){return(y3(e)?x3:KL)(i,e)}function KL(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]=YA(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 Ij(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function oh(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function Nj(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]=YA(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var JL=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,QL=new RegExp(JL.source,"g");function aAe(i){return function(){return i}}function lAe(i){return function(e){return i(e)+""}}function Lj(i,e){var t=JL.lastIndex=QL.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=JL.exec(i))&&(r=QL.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:oh(n,r)})),t=QL.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?lAe(l[0].x):aAe(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 YA(i,e){var t=typeof e,n;return e==null||t==="boolean"?O2(e):(t==="number"?oh:t==="string"?(n=Xc(e))?(e=n,YL):Lj:e instanceof Xc?YL:e instanceof Date?Ij:y3(e)?x3:Array.isArray(e)?KL:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Nj:oh)(i,e)}function eD(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function tD(i){return function(){return i}}function nD(i){return+i}var Dj=[0,1];function F_(i){return i}function iD(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:tD(isNaN(e)?NaN:.5)}function cAe(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function uAe(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=iD(r,n),s=t(o,s)):(n=iD(n,r),s=t(s,o)),function(a){return s(n(a))}}function hAe(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]=iD(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=I2(i,a,1,n)-1;return s[l](r[l](a))}}function Fj(i,e){return e.domain(i.domain()).range(i.range()).interpolate(i.interpolate()).clamp(i.clamp()).unknown(i.unknown())}function fAe(){var i=Dj,e=Dj,t=YA,n,r,s,o=F_,a,l,c;function u(){var p=Math.min(i.length,e.length);return o!==F_&&(o=cAe(i[0],i[p-1])),a=p>2?hAe:uAe,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),oh)))(p)))},f.domain=function(p){return arguments.length?(i=Array.from(p,nD),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=eD,u()},f.clamp=function(p){return arguments.length?(o=p?!0:F_,u()):o!==F_},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 rD(){return fAe()(F_,F_)}function Oj(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function ZA(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 ah(i){return i=ZA(Math.abs(i)),i?i[1]:NaN}function Bj(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 Uj(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var dAe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Np(i){if(!(e=dAe.exec(i)))throw new Error("invalid format: "+i);var e;return new v3({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]})}Np.prototype=v3.prototype;function v3(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+""}v3.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 kj(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 B2;function Gj(i,e){var t=ZA(i,e);if(!t)return B2=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(B2=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")+ZA(i,Math.max(0,e+s-1))[0]}function sD(i,e){var t=ZA(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 oD={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:Oj,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)=>sD(i*100,e),r:sD,s:Gj,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function aD(i){return i}var zj=Array.prototype.map,Vj=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function qj(i){var e=i.grouping===void 0||i.thousands===void 0?aD:Bj(zj.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?aD:Uj(zj.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=Np(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"):oD[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=oD[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=kj(H)),ae&&+H==0&&w!=="+"&&(ae=!1),Z=(ae?w==="("?w:a:w==="-"||w==="("?"":w)+Z,J=(D==="s"&&!isNaN(H)&&B2!==void 0?Vj[8+B2/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(ah(p)/3)))*3,v=Math.pow(10,-x),w=c((f=Np(f),f.type="f",f),{suffix:Vj[8+x/3]});return function(S){return w(v*S)}}return{format:c,formatPrefix:u}}var b3,w3,S3;lD({thousands:",",grouping:[3],currency:["$",""]});function lD(i){return b3=qj(i),w3=b3.format,S3=b3.formatPrefix,b3}function cD(i){return Math.max(0,-ah(Math.abs(i)))}function uD(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ah(e)/3)))*3-ah(Math.abs(i)))}function hD(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,ah(e)-ah(i))+1}function fD(i,e,t,n){var r=WL(i,e,t),s;switch(n=Np(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=uD(r,o))&&(n.precision=s),S3(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=hD(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=cD(r))&&(n.precision=s-(n.type==="%")*2);break}}return w3(n)}function dD(i){var e=i.domain;return i.ticks=function(t){var n=e();return l3(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return fD(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=N2(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 Xa(){var i=rD();return i.copy=function(){return Fj(i,Xa())},f3.apply(i,arguments),dD(i)}function U2(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[I2(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 U2().domain([i,e]).range(r).unknown(s)},f3.apply(dD(o),arguments)}var Cn=1e-6,KA=1e-12,Jn=Math.PI,Js=Jn/2,O_=Jn/4,eo=Jn*2,Zi=180/Jn,mn=Jn/180,ei=Math.abs,B_=Math.atan,as=Math.atan2,fn=Math.cos,k2=Math.ceil,Hj=Math.exp;var T3=Math.hypot,Wj=Math.log;var an=Math.sin,jj=Math.sign||function(i){return i>0?1:i<0?-1:0},yo=Math.sqrt,Xj=Math.tan;function $j(i){return i>1?0:i<-1?Jn:Math.acos(i)}function Ho(i){return i>1?Js:i<-1?-Js:Math.asin(i)}function pD(i){return(i=an(i/2))*i}function Yr(){}function E3(i,e){i&&Zj.hasOwnProperty(i.type)&&Zj[i.type](i,e)}var Yj={Feature:function(i,e){E3(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)E3(t[n].geometry,e)}},Zj={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){AD(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)AD(t[n],e,0)},Polygon:function(i,e){Kj(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)Kj(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)E3(t[n],e)}};function AD(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 Kj(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)AD(i[t],e,1);e.polygonEnd()}function Lp(i,e){i&&Yj.hasOwnProperty(i.type)?Yj[i.type](i,e):E3(i,e)}var G2=new xo,Qj=new xo,Jj,eX,mD,gD,_D,lh={point:Yr,lineStart:Yr,lineEnd:Yr,polygonStart:function(){G2=new xo,lh.lineStart=pAe,lh.lineEnd=AAe},polygonEnd:function(){var i=+G2;Qj.add(i<0?eo+i:i),this.lineStart=this.lineEnd=this.point=Yr},sphere:function(){Qj.add(eo)}};function pAe(){lh.point=mAe}function AAe(){tX(Jj,eX)}function mAe(i,e){lh.point=tX,Jj=i,eX=e,i*=mn,e*=mn,mD=i,gD=fn(e=e/2+O_),_D=an(e)}function tX(i,e){i*=mn,e*=mn,e=e/2+O_;var t=i-mD,n=t>=0?1:-1,r=n*t,s=fn(e),o=an(e),a=_D*o,l=gD*s+a*fn(r),c=a*n*an(r);G2.add(as(c,l)),mD=i,gD=s,_D=o}function QA(i){return[as(i[1],i[0]),Ho(i[2])]}function tc(i){var e=i[0],t=i[1],n=fn(t);return[n*fn(e),n*an(e),an(t)]}function z2(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Of(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 M3(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function V2(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function JA(i){var e=yo(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var Dr,$a,Zr,yl,em,sX,oX,U_,q2,Dp,Uf,Bf={point:xD,lineStart:nX,lineEnd:iX,polygonStart:function(){Bf.point=lX,Bf.lineStart=gAe,Bf.lineEnd=_Ae,q2=new xo,lh.polygonStart()},polygonEnd:function(){lh.polygonEnd(),Bf.point=xD,Bf.lineStart=nX,Bf.lineEnd=iX,G2<0?(Dr=-(Zr=180),$a=-(yl=90)):q2>Cn?yl=90:q2<-Cn&&($a=-90),Uf[0]=Dr,Uf[1]=Zr},sphere:function(){Dr=-(Zr=180),$a=-(yl=90)}};function xD(i,e){Dp.push(Uf=[Dr=i,Zr=i]),e<$a&&($a=e),e>yl&&(yl=e)}function aX(i,e){var t=tc([i*mn,e*mn]);if(U_){var n=Of(U_,t),r=[n[1],-n[0],0],s=Of(r,n);JA(s),s=QA(s);var o=i-em,a=o>0?1:-1,l=s[0]*Zi*a,c,u=ei(o)>180;u^(a*em<l&&l<a*i)?(c=s[1]*Zi,c>yl&&(yl=c)):(l=(l+360)%360-180,u^(a*em<l&&l<a*i)?(c=-s[1]*Zi,c<$a&&($a=c)):(e<$a&&($a=e),e>yl&&(yl=e))),u?i<em?xl(Dr,i)>xl(Dr,Zr)&&(Zr=i):xl(i,Zr)>xl(Dr,Zr)&&(Dr=i):Zr>=Dr?(i<Dr&&(Dr=i),i>Zr&&(Zr=i)):i>em?xl(Dr,i)>xl(Dr,Zr)&&(Zr=i):xl(i,Zr)>xl(Dr,Zr)&&(Dr=i)}else Dp.push(Uf=[Dr=i,Zr=i]);e<$a&&($a=e),e>yl&&(yl=e),U_=t,em=i}function nX(){Bf.point=aX}function iX(){Uf[0]=Dr,Uf[1]=Zr,Bf.point=xD,U_=null}function lX(i,e){if(U_){var t=i-em;q2.add(ei(t)>180?t+(t>0?360:-360):t)}else sX=i,oX=e;lh.point(i,e),aX(i,e)}function gAe(){lh.lineStart()}function _Ae(){lX(sX,oX),lh.lineEnd(),ei(q2)>Cn&&(Dr=-(Zr=180)),Uf[0]=Dr,Uf[1]=Zr,U_=null}function xl(i,e){return(e-=i)<0?e+360:e}function xAe(i,e){return i[0]-e[0]}function rX(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:e<i[0]||i[1]<e}function C3(i){var e,t,n,r,s,o,a;if(yl=Zr=-(Dr=$a=1/0),Dp=[],Lp(i,Bf),t=Dp.length){for(Dp.sort(xAe),e=1,n=Dp[0],s=[n];e<t;++e)r=Dp[e],rX(n,r[0])||rX(n,r[1])?(xl(n[0],r[1])>xl(n[0],n[1])&&(n[1]=r[1]),xl(r[0],n[1])>xl(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=xl(n[1],r[0]))>o&&(o=a,Dr=r[0],Zr=n[1])}return Dp=Uf=null,Dr===1/0||$a===1/0?[[NaN,NaN],[NaN,NaN]]:[[Dr,$a],[Zr,yl]]}var H2,R3,P3,I3,N3,L3,D3,F3,yD,vD,bD,hX,fX,_a,xa,ya,$c={sphere:Yr,point:wD,lineStart:cX,lineEnd:uX,polygonStart:function(){$c.lineStart=bAe,$c.lineEnd=wAe},polygonEnd:function(){$c.lineStart=cX,$c.lineEnd=uX}};function wD(i,e){i*=mn,e*=mn;var t=fn(e);W2(t*fn(i),t*an(i),an(e))}function W2(i,e,t){++H2,P3+=(i-P3)/H2,I3+=(e-I3)/H2,N3+=(t-N3)/H2}function cX(){$c.point=yAe}function yAe(i,e){i*=mn,e*=mn;var t=fn(e);_a=t*fn(i),xa=t*an(i),ya=an(e),$c.point=vAe,W2(_a,xa,ya)}function vAe(i,e){i*=mn,e*=mn;var t=fn(e),n=t*fn(i),r=t*an(i),s=an(e),o=as(yo((o=xa*s-ya*r)*o+(o=ya*n-_a*s)*o+(o=_a*r-xa*n)*o),_a*n+xa*r+ya*s);R3+=o,L3+=o*(_a+(_a=n)),D3+=o*(xa+(xa=r)),F3+=o*(ya+(ya=s)),W2(_a,xa,ya)}function uX(){$c.point=wD}function bAe(){$c.point=SAe}function wAe(){dX(hX,fX),$c.point=wD}function SAe(i,e){hX=i,fX=e,i*=mn,e*=mn,$c.point=dX;var t=fn(e);_a=t*fn(i),xa=t*an(i),ya=an(e),W2(_a,xa,ya)}function dX(i,e){i*=mn,e*=mn;var t=fn(e),n=t*fn(i),r=t*an(i),s=an(e),o=xa*s-ya*r,a=ya*n-_a*s,l=_a*r-xa*n,c=T3(o,a,l),u=Ho(c),f=c&&-u/c;yD.add(f*o),vD.add(f*a),bD.add(f*l),R3+=u,L3+=u*(_a+(_a=n)),D3+=u*(xa+(xa=r)),F3+=u*(ya+(ya=s)),W2(_a,xa,ya)}function O3(i){H2=R3=P3=I3=N3=L3=D3=F3=0,yD=new xo,vD=new xo,bD=new xo,Lp(i,$c);var e=+yD,t=+vD,n=+bD,r=T3(e,t,n);return r<KA&&(e=L3,t=D3,n=F3,R3<Cn&&(e=P3,t=I3,n=N3),r=T3(e,t,n),r<KA)?[NaN,NaN]:[as(t,e)*Zi,Ho(n/r)*Zi]}function j2(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 SD(i,e){return ei(i)>Jn&&(i-=Math.round(i/eo)*eo),[i,e]}SD.invert=SD;function TD(i,e,t){return(i%=eo)?e||t?j2(AX(i),mX(e,t)):AX(i):e||t?mX(e,t):SD}function pX(i){return function(e,t){return e+=i,ei(e)>Jn&&(e-=Math.round(e/eo)*eo),[e,t]}}function AX(i){var e=pX(i);return e.invert=pX(-i),e}function mX(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[as(f*r-x*s,u*t-p*n),Ho(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[as(f*r+p*s,u*t+x*n),Ho(x*t-u*n)]},o}function ED(i){i=TD(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]*=Zi,t[1]*=Zi,t}return e.invert=function(t){return t=i.invert(t[0]*mn,t[1]*mn),t[0]*=Zi,t[1]*=Zi,t},e}function _X(i,e,t,n,r,s){if(t){var o=fn(e),a=an(e),l=n*t;r==null?(r=e+n*eo,s=e-l/2):(r=gX(o,r),s=gX(o,s),(n>0?r<s:r>s)&&(r+=n*eo));for(var c,u=r;n>0?u>s:u<s;u-=l)c=QA([o,-a*fn(u),-a*an(u)]),i.point(c[0],c[1])}}function gX(i,e){e=tc(e),e[0]-=i,JA(e);var t=$j(-e[1]);return((-e[2]<0?-t:t)+eo-Cn)%eo}function B3(){var i=[],e;return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){i.push(e=[])},lineEnd:Yr,rejoin:function(){i.length>1&&i.push(i.pop().concat(i.shift()))},result:function(){var t=i;return i=[],e=null,t}}}function k_(i,e){return ei(i[0]-e[0])<Cn&&ei(i[1]-e[1])<Cn}function U3(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 k3(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(k_(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 U3(S,v,null,!0)),o.push(P.o=new U3(S,null,P,!1)),s.push(P=new U3(T,v,null,!1)),o.push(P.o=new U3(T,null,P,!0))}}),!!s.length){for(o.sort(e),xX(s),xX(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 xX(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 MD(i){return ei(i[0])<=Jn?i[0]:jj(i[0])*((ei(i[0])+Jn)%eo-Jn)}function G3(i,e){var t=MD(e),n=e[1],r=an(n),s=[an(t),-fn(t),0],o=0,a=0,l=new xo;r===1?n=Js+Cn:r===-1&&(n=-Js-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=MD(x),w=x[1]/2+O_,S=an(w),T=fn(w),P=0;P<p;++P,v=C,S=D,T=F,x=R){var R=f[P],C=MD(R),L=R[1]/2+O_,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(as(H*B*an(z),T*F+H*fn(z))),o+=V?N+B*eo:N,V^v>=t^C>=t){var Z=Of(tc(x),tc(R));JA(Z);var J=Of(s,Z);JA(J);var j=(V^N>=0?-1:1)*Ho(J[2]);(n>j||n===j&&(Z[0]||Z[1]))&&(a+=V^N>=0?1:-1)}}return(o<-Cn||o<Cn&&l<-KA)^a&1}function z3(i,e,t,n){return function(r){var s=e(r),o=B3(),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=rh(u);var C=G3(c,n);u.length?(l||(r.polygonStart(),l=!0),k3(u,EAe,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(TAe))}}return p}}function TAe(i){return i.length>1}function EAe(i,e){return((i=i.x)[0]<0?i[1]-Js-Cn:Js-i[1])-((e=e.x)[0]<0?e[1]-Js-Cn:Js-e[1])}var CD=z3(function(){return!0},MAe,RAe,[-Jn,-Js]);function MAe(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?Js:-Js),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=CAe(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 CAe(i,e,t,n){var r,s,o=an(i-t);return ei(o)>Cn?B_((an(e)*(s=fn(n))*an(t)-an(n)*(r=fn(e))*an(i))/(r*s*o)):(e+n)/2}function RAe(i,e,t,n){var r;if(i==null)r=t*Js,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 yX(i){var e=fn(i),t=2*mn,n=e>0,r=ei(e)>Cn;function s(u,f,p,x){_X(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||k_(f,R)||k_(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||!k_(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=tc(u),v=tc(f),w=[1,0,0],S=Of(x,v),T=z2(S,S),P=S[0],R=T-P*P;if(!R)return!p&&u;var C=e*T/R,L=-e*P/R,D=Of(w,S),F=V2(w,C),N=V2(S,L);M3(F,N);var B=D,z=z2(F,B),V=z2(B,B),H=z*z-V*(z2(F,F)-1);if(!(H<0)){var Z=yo(H),J=V2(B,(-z-Z)/V);if(M3(J,F),J=QA(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=V2(B,(-z+Z)/V);return M3(Qe,F),[J,QA(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 z3(o,a,s,n?[0,-i]:[-Jn,i-Jn])}function vX(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 X2=1e9,V3=-X2;function RD(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=B3(),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=rh(p)).length;(K||ee)&&(c.polygonStart(),K&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),ee&&k3(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(V3,Math.min(X2,P)),R=Math.max(V3,Math.min(X2,R))],ce=[j=Math.max(V3,Math.min(X2,j)),K=Math.max(V3,Math.min(X2,K))];vX(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 PD,ID,q3,H3,G_={sphere:Yr,point:Yr,lineStart:PAe,lineEnd:Yr,polygonStart:Yr,polygonEnd:Yr};function PAe(){G_.point=NAe,G_.lineEnd=IAe}function IAe(){G_.point=G_.lineEnd=Yr}function NAe(i,e){i*=mn,e*=mn,ID=i,q3=an(e),H3=fn(e),G_.point=LAe}function LAe(i,e){i*=mn,e*=mn;var t=an(e),n=fn(e),r=ei(i-ID),s=fn(r),o=an(r),a=n*o,l=H3*t-q3*n*s,c=q3*t+H3*n*s;PD.add(as(yo(a*a+l*l),c)),ID=i,q3=t,H3=n}function bX(i){return PD=new xo,Lp(i,G_),+PD}var ND=[null,null],DAe={type:"LineString",coordinates:ND};function Ya(i,e){return ND[0]=i,ND[1]=e,bX(DAe)}var wX={Feature:function(i,e){return W3(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if(W3(t[n].geometry,e))return!0;return!1}},SX={Sphere:function(){return!0},Point:function(i,e){return TX(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(TX(t[n],e))return!0;return!1},LineString:function(i,e){return EX(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(EX(t[n],e))return!0;return!1},Polygon:function(i,e){return MX(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(MX(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if(W3(t[n],e))return!0;return!1}};function W3(i,e){return i&&SX.hasOwnProperty(i.type)?SX[i.type](i,e):!1}function TX(i,e){return Ya(i,e)===0}function EX(i,e){for(var t,n,r,s=0,o=i.length;s<o;s++){if(n=Ya(i[s],e),n===0||s>0&&(r=Ya(i[s],i[s-1]),r>0&&t<=r&&n<=r&&(t+n-r)*(1-Math.pow((t-n)/r,2))<KA*r))return!0;t=n}return!1}function MX(i,e){return!!G3(i.map(FAe),CX(e))}function FAe(i){return i=i.map(CX),i.pop(),i}function CX(i){return[i[0]*mn,i[1]*mn]}function LD(i,e){return(i&&wX.hasOwnProperty(i.type)?wX[i.type]:W3)(i,e)}function RX(i,e,t){var n=Ff(i,e-Cn,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function PX(i,e,t){var n=Ff(i,e-Cn,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function DD(){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 Ff(k2(n/u)*u,t,u).map(v).concat(Ff(k2(a/f)*f,o,f).map(w)).concat(Ff(k2(e/l)*l,i,l).filter(function(R){return ei(R%u)>Cn}).map(p)).concat(Ff(k2(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=RX(s,r,90),x=PX(e,i,S),v=RX(a,o,90),w=PX(n,t,S),T):S},T.extentMajor([[-180,-90+Cn],[180,90-Cn]]).extentMinor([[-180,-80-Cn],[180,80+Cn]])}function FD(){return DD()()}function tm(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*Ho(yo(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[as(L,C)*Zi,as(D,yo(C*C+L*L))*Zi]}:function(){return[t*Zi,n*Zi]};return S.distance=v,S}var OD=i=>i;var z_=1/0,j3=z_,$2=-z_,X3=$2,OAe={point:BAe,lineStart:Yr,lineEnd:Yr,polygonStart:Yr,polygonEnd:Yr,result:function(){var i=[[z_,j3],[$2,X3]];return $2=X3=-(j3=z_=1/0),i}};function BAe(i,e){i<z_&&(z_=i),i>$2&&($2=i),e<j3&&(j3=e),e>X3&&(X3=e)}var BD=OAe;function Y2(i){return function(e){var t=new UD;for(var n in i)t[n]=i[n];return t.stream=e,t}}function UD(){}UD.prototype={constructor:UD,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 kD(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),Lp(t,i.stream(BD)),e(BD.result()),n!=null&&i.clipExtent(n),i}function GD(i,e,t){return kD(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 IX(i,e,t){return GD(i,[[0,0],e],t)}function NX(i,e,t){return kD(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 LX(i,e,t){return kD(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 DX=16,UAe=fn(30*mn);function zD(i,e){return+e?GAe(i,e):kAe(i)}function kAe(i){return Y2({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function GAe(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=yo(C*C+L*L+D*D),N=Ho(D/=F),B=ei(ei(D)-1)<Cn||ei(s-f)<Cn?(s+f)/2:as(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<UAe)&&(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=tc([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],DX,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,DX,n),S.lineEnd=C,C()}return S}}var zAe=Y2({point:function(i,e){this.stream.point(i*mn,e*mn)}});function VAe(i){return Y2({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function qAe(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 FX(i,e,t,n,r,s){if(!s)return qAe(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 VD(i){return HAe(function(){return i})()}function HAe(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=CD,S=null,T,P,R,C=OD,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]*Zi,j[1]*Zi]}V.stream=function(j){return B&&z===j?B:B=zAe(VAe(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?yX(v=j*mn):(v=null,CD),J()):v*Zi},V.clipExtent=function(j){return arguments.length?(C=j==null?(S=T=P=R=null,OD):RD(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*Zi,o*Zi]},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*Zi,l*Zi,c*Zi]},V.angle=function(j){return arguments.length?(f=j%360*mn,Z()):f*Zi},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()):yo(L)},V.fitExtent=function(j,K){return GD(V,j,K)},V.fitSize=function(j,K){return IX(V,j,K)},V.fitWidth=function(j,K){return NX(V,j,K)},V.fitHeight=function(j,K){return LX(V,j,K)};function Z(){var j=FX(t,0,0,p,x,f).apply(null,e(s,o)),K=FX(t,n-j[0],r-j[1],p,x,f);return u=TD(a,l,c),F=j2(e,K),N=j2(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 OX(i){return function(e,t){var n=yo(e*e+t*t),r=i(n),s=an(r),o=fn(r);return[as(e*s,n*o),Ho(n&&t*s/n)]}}function Z2(i,e){return[i,Wj(Xj((Js+e)/2))]}Z2.invert=function(i,e){return[i,2*B_(Hj(e))-Js]};function qD(i,e){var t=fn(e),n=1+fn(i)*t;return[t*an(i)/n,an(e)/n]}qD.invert=OX(function(i){return 2*B_(i)});function HD(){return VD(qD).scale(250).clipAngle(142)}function XD(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 WAe(i){if(Array.isArray(i))return i}function jAe(i){if(Array.isArray(i))return XD(i)}function K2(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 XAe(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function $Ae(i,e,t){return e=K3(e),rme(i,zX()?Reflect.construct(e,[],K3(i).constructor):e.apply(i,t))}function GX(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function YAe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function ti(i,e){return i.get(K2(i,e))}function Fp(i,e,t){GX(i,e),e.set(i,t)}function Op(i,e,t){return i.set(K2(i,e),t),t}function ZAe(i,e){GX(i,e),e.add(i)}function KAe(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,qX(n.key),n)}}function QAe(i,e,t){return e&&KAe(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function V_(i,e,t){return(e=qX(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function K3(i){return K3=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},K3(i)}function JAe(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&&$D(i,e)}function zX(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zX=function(){return!!i})()}function eme(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function tme(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 nme(){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 ime(){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 rme(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 XAe(i)}function $D(i,e){return $D=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},$D(i,e)}function Z3(i,e){return WAe(i)||tme(i,e)||HX(i,e)||nme()}function VX(i){return jAe(i)||eme(i)||HX(i)||ime()}function sme(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 qX(i){var e=sme(i,"string");return typeof e=="symbol"?e:e+""}function HX(i,e){if(i){if(typeof i=="string")return XD(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)?XD(i,e):void 0}}var WX=function(e){e instanceof Array?e.forEach(WX):(e.map&&e.map.dispose(),e.dispose())},YD=function(e){e.geometry&&e.geometry.dispose(),e.material&&WX(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(YD)};function jX(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 ome(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 nm(i){return i*Math.PI/180}var XX=function(e){return 1-(Z2(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},WD=function(e){return Math.max(0,Math.min(1,XX(e)))},BX=function(e){return .5-Z2.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},ame=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=Xa().domain([1,0]).range([t,n]).clamp(!0),s=Xa().domain([WD(t),WD(n)]).range([1,0]).clamp(!0),o=function(f){return s(WD(r(f)))},a=e.array,l=0,c=a.length;l<c;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},UX=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,XX(a))));var l=Math.floor(a*s);return[o,l]},ZD=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:BX(w/l)*l;var R=w+1===l?w+1:BX((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},lme=6,cme=7,ume=3,hme=90,ch=new WeakMap,Bp=new WeakMap,jD=new WeakMap,$3=new WeakMap,nc=new WeakMap,Q3=new WeakMap,q_=new WeakMap,im=new WeakMap,Y3=new WeakSet,$X=(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 YAe(this,e),n=$Ae(this,e),ZAe(n,Y3),Fp(n,ch,void 0),Fp(n,Bp,void 0),Fp(n,jD,void 0),Fp(n,$3,void 0),Fp(n,nc,{}),Fp(n,Q3,void 0),Fp(n,q_,void 0),Fp(n,im,void 0),V_(n,"minLevel",void 0),V_(n,"maxLevel",void 0),V_(n,"thresholds",VX(new Array(30)).map(function(p,x){return 8/Math.pow(2,x)})),V_(n,"curvatureResolution",5),V_(n,"tileMargin",0),V_(n,"clearTiles",function(){Object.values(ti(nc,n)).forEach(function(p){p.forEach(function(x){x.obj&&(n.remove(x.obj),YD(x.obj),delete x.obj)})}),Op(nc,n,{})}),Op(ch,n,t),n.tileUrl=s,Op(Bp,n,f),n.minLevel=a,n.maxLevel=c,n.level=0,n.add(Op(im,n,new Hn(new pa(ti(ch,n)*.99,180,90),new Us({color:0})))),ti(im,n).visible=!1,ti(im,n).material.polygonOffset=!0,ti(im,n).material.polygonOffsetUnits=3,ti(im,n).material.polygonOffsetFactor=1,n}return JAe(e,i),QAe(e,[{key:"tileUrl",get:function(){return ti(jD,this)},set:function(n){Op(jD,this,n),this.updatePov(ti(q_,this))}},{key:"level",get:function(){return ti($3,this)},set:function(n){var r,s=this;ti(nc,this)[n]||K2(Y3,this,fme).call(this,n);var o=ti($3,this);if(Op($3,this,n),!(n===o||o===void 0)){if(ti(im,this).visible=n>0,ti(nc,this)[n].forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!0)}),o<n&&((r=ti(nc,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(nc,this)[a]&&ti(nc,this)[a].forEach(function(l){l.obj&&(s.remove(l.obj),YD(l.obj),delete l.obj)});K2(Y3,this,kX).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof Rf))){Op(q_,this,n);var s;if(Op(Q3,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=Z3(R,2),L=C[0],D=C[1];return jX(L,D,ti(ch,r))}).map(function(R){var C=R.x,L=R.y,D=R.z;return new ie(C,L,D)})}return s||(s=new Zl,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(ch,this))/ti(ch,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)),K2(Y3,this,kX).call(this)}}}}])})(xs);function fme(i){var e=this;if(i>cme){ti(nc,this)[i]=[];return}var t=ti(nc,this)[i]=ZD(i,ti(Bp,this));t.forEach(function(n){return n.centroid=jX(n.lat,n.lng,ti(ch,e))}),t.octree=P2().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function kX(){var i=this;if(!(!this.tileUrl||this.level===void 0||!ti(nc,this).hasOwnProperty(this.level))&&!(!ti(Q3,this)&&this.level>lme)){var e=ti(nc,this)[this.level];if(ti(q_,this)){var t=this.worldToLocal(ti(q_,this).position.clone());if(e.octree){var n,r=this.worldToLocal(ti(q_,this).position.clone()),s=(r.length()-ti(ch,this))*ume;e=(n=e.octree).findAllWithinRadius.apply(n,VX(r).concat([s]))}else{var o=ome(t),a=(o.r/ti(ch,this)-1)*hme,l=a/Math.cos(nm(o.lat)),c=[o.lng-l,o.lng+l],u=[o.lat+a,o.lat-a],f=UX(this.level,ti(Bp,this),c[0],u[0]),p=Z3(f,2),x=p[0],v=p[1],w=UX(this.level,ti(Bp,this),c[1],u[1]),S=Z3(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=ZD(this.level,ti(Bp,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]=ZD(this.level,ti(Bp,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(Q3,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=nm(V),ae=nm(-H),ce=new Hn(new pa(ti(ch,i),Math.ceil(j/i.curvatureResolution),Math.ceil(K/i.curvatureResolution),nm(90-j/2)+ee,nm(j),nm(90-K/2)+ae,nm(K)),new Aa);if(ti(Bp,i)){var de=[H+Z/2,H-Z/2].map(function(Ue){return .5-Ue/180}),ve=Z3(de,2),Ie=ve[0],Qe=ve[1];ame(ce.geometry.attributes.uv,Ie,Qe)}N.obj=ce}N.loading||(N.loading=!0,new zc().load(i.tileUrl(B,z,i.level),function(Ue){var mt=N.obj;mt&&(Ue.colorSpace=jr,mt.material.map=Ue,mt.material.color=null,mt.material.needsUpdate=!0,i.add(mt)),N.loading=!1}))})}}var tv=new Set,KD=!1;function r6(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length;tv.size&&tv.clear();let s=QX(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,c=0;if(n&&(s=gme(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 QD(s,o,a,l,c),o}function QX(i,e,t,n,r){let s=null;if(r===Pme(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=KX(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=KX(o/n|0,i[o],i[o+1],s);return s&&nv(s,s.next)&&(rv(s),s=s.next),s}function sm(i,e=i){let t=e===i,n=i,r;do r=!1,n!==n.next&&(tv.size===0||!tv.has(n))&&(nv(n,n.next)||Ts(n.prev,n,n.next)===0)?((t||n===e)&&(e=n.prev),KD=!0,rv(n),n=n.prev,r=!0):(t||n!==e)&&(n=n.next,r=!t);while(r||n!==e);return e}function QD(i,e,t,n,r){r&&Sme(i,t,n,r);let s=i,o=!1;for(;i.prev!==i.next;){let a=i.prev,l=i.next;if(Ts(a,i,l)<0&&(r?pme(i,t,n,r):dme(i))){e.push(a.i,i.i,l.i),rv(i),i=l,s=l;continue}if(i=l,i===s){if(KD=!1,i=sm(i),KD){s=i;continue}if(!o){i=Ame(i,e),s=i,o=!0;continue}mme(i,e,t,n,r);break}}}function dme(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)&&nE(r,a,s,l,o,c,v.x,v.y)&&Ts(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function pme(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=n6(x,v,e,t,n),P=n6(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)&&nE(a,u,l,f,c,p,R.x,R.y)&&Ts(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)&&nE(a,u,l,f,c,p,C.x,C.y)&&Ts(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Ame(i,e){let t=i,n=!1;do{let r=t.prev,s=t.next.next;t$(r,t,t.next,s,!1)&&iv(r,s)&&iv(s,r)&&(e.push(r.i,t.i,s.i),rv(t),rv(t.next),t=i=s,n=!0),t=t.next}while(t!==i);return n?sm(t):t}function mme(i,e,t,n,r){let s=i;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&Mme(s,o)){let a=n$(s,o);s=sm(s,s.next),a=sm(a,a.next),QD(s,e,t,n,r),QD(a,e,t,n,r);return}o=o.next}s=s.next}while(s!==i)}var JD=!1;function gme(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=QX(i,a,l,n,!1);c===c.next&&tv.add(c),r.push(Eme(c))}r.sort(_me),yme(i.length/n,e.length),e$(t,t),JD=!0;for(let s=0;s<r.length;s++)t=xme(r[s],t);return JD=!1,sm(t)}function _me(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 xme(i,e){let t=bme(i,e);if(!t)return e;let n=n$(t,i),r=n.next;return e$(t,r.next),sm(n,n.next),sm(t,t.next)}var JX=16,Kr=new Float64Array(0),tE=0,e6=[],t6=[];function yme(i,e){let t=Math.ceil((i+2*e)/JX)+e+2;Kr.length<t*4&&(Kr=new Float64Array(t*4)),tE=0}function e$(i,e){let t=i;do{let n=tE++;e6[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<JX&&t!==e);t6[n]=t;let c=n*4;Kr[c]=r,Kr[c+1]=s,Kr[c+2]=o,Kr[c+3]=a}while(t!==e)}function vme(i,e){let t=i.z*4;e.x<Kr[t]&&(Kr[t]=e.x),e.y<Kr[t+1]&&(Kr[t+1]=e.y),e.x>Kr[t+2]&&(Kr[t+2]=e.x),e.y>Kr[t+3]&&(Kr[t+3]=e.y)}function YX(i){let e=t6[i];for(;e.prev.next!==e;)e=e.next;return t6[i]=e,e}function ZX(i){let e=e6[i];for(;e.prev.next!==e;)e=e.next;return e6[i]=e,e}function bme(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(nv(i,t))return t;for(let p=0,x=0;p<tE;p++,x+=4){if(r<Kr[x+1]||r>Kr[x+3]||Kr[x]>n||Kr[x+2]<=s)continue;let v=YX(p);t=ZX(p);do{if(t.prev.next===t){if(nv(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<tE;p++,x+=4){if(Kr[x+2]<a||Kr[x]>n||Kr[x+3]<c||Kr[x+1]>u)continue;let v=YX(p);t=ZX(p);do{if(t.prev.next===t&&n>=t.x&&t.x>=a&&n!==t.x&&nE(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);(iv(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 Ts(i.prev,i,e.prev)<0&&Ts(e.next,i,i.next)<0}var ic=[],Q2=[],rm=new Uint32Array(0),J2=new Uint32Array(0),ev=new Uint32Array(256);function Sme(i,e,t,n){let r=i,s=0;do r.z=n6(r.x,r.y,e,t,n),ic[s++]=r,r=r.next;while(r!==i);Tme(s);let o=null;for(let a=0;a<s;a++){let l=ic[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function Tme(i){if(i<=32){for(let e=1;e<i;e++){let t=ic[e],n=t.z,r=e-1;for(;r>=0&&ic[r].z>n;)ic[r+1]=ic[r],r--;ic[r+1]=t}return}rm.length<i&&(rm=new Uint32Array(i),J2=new Uint32Array(i),Q2=new Array(i));for(let e=0;e<i;e++)rm[e]=ic[e].z;J3(i,ic,rm,Q2,J2,0),J3(i,Q2,J2,ic,rm,8),J3(i,ic,rm,Q2,J2,16),J3(i,Q2,J2,ic,rm,24)}function J3(i,e,t,n,r,s){ev.fill(0);for(let a=0;a<i;a++)ev[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){let l=ev[a];ev[a]=o,o+=l}for(let a=0;a<i;a++){let l=t[a],c=ev[l>>>s&255]++;n[c]=e[a],r[c]=l}}function n6(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 Eme(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 nE(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 Mme(i,e){let t=nv(i,e)&&Ts(i.prev,i,i.next)>0&&Ts(e.prev,e,e.next)>0;return i.next.i!==e.i&&(t||iv(i,e)&&iv(e,i)&&(Ts(i.prev,i,e.prev)!==0||Ts(i,e.prev,e)!==0))&&!Cme(i,e)&&(t||Rme(i,e))}function Ts(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function nv(i,e){return i.x===e.x&&i.y===e.y}function t$(i,e,t,n,r=!0){let s=Ts(i,e,t),o=Ts(i,e,n),a=Ts(t,n,i),l=Ts(t,n,e);return(s>0&&o<0||s<0&&o>0)&&(a>0&&l<0||a<0&&l>0)?!0:r?!!(s===0&&eE(i,t,e)||o===0&&eE(i,n,e)||a===0&&eE(t,i,n)||l===0&&eE(t,e,n)):!1}function eE(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 Cme(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&&t$(o,a,i,e))return!0;o=a}while(o!==i);return!1}function iv(i,e){return Ts(i.prev,i,i.next)<0?Ts(i,e,i.next)>=0&&Ts(i,i.prev,e)>=0:Ts(i,e,i.prev)<0||Ts(i,i.next,e)<0}function Rme(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 n$(i,e){let t=i6(i.i,i.x,i.y),n=i6(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 KX(i,e,t,n){let r=i6(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 rv(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),JD&&vme(i.prev,i.next)}function i6(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function Pme(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 H_(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 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 Ime(i){if(Array.isArray(i))return i}function Nme(i){if(Array.isArray(i))return o6(i)}function Lme(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Dme(i,e,t){return e=iE(e),qme(i,s$()?Reflect.construct(e,[],iE(i).constructor):e.apply(i,t))}function Fme(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Ome(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Bme(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=c6(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 iE(i){return iE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},iE(i)}function Ume(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&&a6(i,e)}function s$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(s$=function(){return!!i})()}function kme(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Gme(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 zme(){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 Vme(){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 qme(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 Lme(i)}function a6(i,e){return a6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},a6(i,e)}function sv(i,e){return Ime(i)||Gme(i,e)||c6(i,e)||zme()}function Hme(i){return Nme(i)||kme(i)||c6(i)||Vme()}function c6(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}}var i$=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=Ya(s,r)*180/Math.PI;if(o>t)for(var a=tm(r,s),l=r.length>2||s.length>2?oh(r[2]||0,s[2]||0):null,c=l?function(p){return[].concat(Hme(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},l6=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Kn,Float32BufferAttribute:kn},Wme=new l6.BufferGeometry().setAttribute?"setAttribute":"addAttribute",u6=(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;Fme(this,e),n=Dme(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;ov({indices:a,vertices:l},S),n.addGroup(T,a.length-T,c++)}),a.length&&n.setIndex(a),l.length&&n[Wme]("position",new l6.Float32BufferAttribute(l,3));function u(S,T){var P=s6(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=sv(R,1),L=C[0];ov(P,L)}),[P]}function p(S,T){for(var P=i$(S,s).map(function(N){var B=sv(N,3),z=B[0],V=B[1],H=B[2],Z=H===void 0?0:H;return s6(V,z,T+Z)}),R=H_([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=sv(R,1),L=C[0];ov(P,L)}),[P]}function v(S,T){for(var P=S.map(function(j){return i$(j,s).map(function(K){var ee=sv(K,3),ae=ee[0],ce=ee[1],de=ee[2],ve=de===void 0?0:de;return s6(ce,ae,T+ve)})}),R=H_(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=sv(L,2),F=D[0],N=D[1];ov(P,F),N&&ov(R,N)});var C=[P];return R.vertices.length&&C.push(R),C}return n}return Ume(e,i),Ome(e)})(l6.BufferGeometry);function ov(i,e){var t=Math.round(i.vertices.length/3);r$(i.vertices,e.vertices),r$(i.indices,e.indices.map(function(n){return n+t}))}function r$(i,e){var t=Bme(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 s6(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 av={};Tse(av,{computeMikkTSpaceTangents:()=>jme,computeMorphedAttributes:()=>ege,deepCloneAttribute:()=>$me,deinterleaveAttribute:()=>rE,deinterleaveGeometry:()=>Zme,estimateBytesUsed:()=>Kme,interleaveAttributes:()=>Yme,mergeAttributes:()=>h6,mergeGeometries:()=>Xme,mergeGroups:()=>tge,mergeVertices:()=>Qme,toCreasedNormals:()=>nge,toTrianglesDrawMode:()=>Jme});function jme(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 Ni(s,4)),i!==r&&i.copy(r),i}function Xme(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 Kn,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=h6(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=h6(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 h6(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 Ni(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 $me(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?rE(i):i.isInstancedBufferAttribute?new Al().copy(i):new Ni().copy(i)}function Yme(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 Mf(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 mo(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 rE(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 Al(s,n,r,i.meshPerAttribute):o=new Ni(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 Zme(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,rE(s)),e[r]=n.get(s))}for(let r in t){let s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,rE(s)),t[r]=n.get(s))}}function Kme(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 Qme(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 Jme(i,e){if(e===ZN)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===WT||e===KN){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===WT)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 ege(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 kn(j,3),ae=new kn(K,3);return{positionAttribute:T,normalAttribute:C,morphedPositionAttribute:ee,morphedNormalAttribute:ae}}function tge(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 nge(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 Ni(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 sE(i){"@babel/helpers - typeof";return sE=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},sE(i)}var ige=/^\s+/,rge=/\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=sge(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=f$(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=a$(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=a$(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=o$(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=o$(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 l$(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return cge(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(yr(this._r,255)*100)+"%",g:Math.round(yr(this._g,255)*100)+"%",b:Math.round(yr(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(yr(this._r,255)*100)+"%, "+Math.round(yr(this._g,255)*100)+"%, "+Math.round(yr(this._b,255)*100)+"%)":"rgba("+Math.round(yr(this._r,255)*100)+"%, "+Math.round(yr(this._g,255)*100)+"%, "+Math.round(yr(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:vge[l$(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+c$(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=dn(e);n="#"+c$(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(dge,arguments)},brighten:function(){return this._applyModification(pge,arguments)},darken:function(){return this._applyModification(Age,arguments)},desaturate:function(){return this._applyModification(uge,arguments)},saturate:function(){return this._applyModification(hge,arguments)},greyscale:function(){return this._applyModification(fge,arguments)},spin:function(){return this._applyModification(mge,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(xge,arguments)},complement:function(){return this._applyCombination(gge,arguments)},monochromatic:function(){return this._applyCombination(yge,arguments)},splitcomplement:function(){return this._applyCombination(_ge,arguments)},triad:function(){return this._applyCombination(u$,[3])},tetrad:function(){return this._applyCombination(u$,[4])}};dn.fromRatio=function(i,e){if(sE(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=lv(i[n]));i=t}return dn(i,e)};function sge(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=Tge(i)),sE(i)=="object"&&(kf(i.r)&&kf(i.g)&&kf(i.b)?(e=oge(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):kf(i.h)&&kf(i.s)&&kf(i.v)?(n=lv(i.s),r=lv(i.v),e=lge(i.h,n,r),o=!0,a="hsv"):kf(i.h)&&kf(i.s)&&kf(i.l)&&(n=lv(i.s),s=lv(i.l),e=age(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=f$(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 oge(i,e,t){return{r:yr(i,255)*255,g:yr(e,255)*255,b:yr(t,255)*255}}function o$(i,e,t){i=yr(i,255),e=yr(e,255),t=yr(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 age(i,e,t){var n,r,s;i=yr(i,360),e=yr(e,100),t=yr(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 a$(i,e,t){i=yr(i,255),e=yr(e,255),t=yr(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 lge(i,e,t){i=yr(i,360)*6,e=yr(e,100),t=yr(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 l$(i,e,t,n){var r=[Zc(Math.round(i).toString(16)),Zc(Math.round(e).toString(16)),Zc(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 cge(i,e,t,n,r){var s=[Zc(Math.round(i).toString(16)),Zc(Math.round(e).toString(16)),Zc(Math.round(t).toString(16)),Zc(d$(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 c$(i,e,t,n){var r=[Zc(d$(n)),Zc(Math.round(i).toString(16)),Zc(Math.round(e).toString(16)),Zc(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 uge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.s-=e/100,t.s=oE(t.s),dn(t)}function hge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.s+=e/100,t.s=oE(t.s),dn(t)}function fge(i){return dn(i).desaturate(100)}function dge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.l+=e/100,t.l=oE(t.l),dn(t)}function pge(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 Age(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.l-=e/100,t.l=oE(t.l),dn(t)}function mge(i,e){var t=dn(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,dn(t)}function gge(i){var e=dn(i).toHsl();return e.h=(e.h+180)%360,dn(e)}function u$(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 _ge(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 xge(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 yge(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=Ege(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 f6=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"},vge=dn.hexNames=bge(f6);function bge(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function f$(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function yr(i,e){wge(i)&&(i="100%");var t=Sge(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 oE(i){return Math.min(1,Math.max(0,i))}function vl(i){return parseInt(i,16)}function wge(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function Sge(i){return typeof i=="string"&&i.indexOf("%")!=-1}function Zc(i){return i.length==1?"0"+i:""+i}function lv(i){return i<=1&&(i=i*100+"%"),i}function d$(i){return Math.round(parseFloat(i)*255).toString(16)}function h$(i){return vl(i)/255}var Yc=(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 kf(i){return!!Yc.CSS_UNIT.exec(i)}function Tge(i){i=i.replace(ige,"").replace(rge,"").toLowerCase();var e=!1;if(f6[i])i=f6[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Yc.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=Yc.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Yc.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=Yc.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Yc.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=Yc.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Yc.hex8.exec(i))?{r:vl(t[1]),g:vl(t[2]),b:vl(t[3]),a:h$(t[4]),format:e?"name":"hex8"}:(t=Yc.hex6.exec(i))?{r:vl(t[1]),g:vl(t[2]),b:vl(t[3]),format:e?"name":"hex"}:(t=Yc.hex4.exec(i))?{r:vl(t[1]+""+t[1]),g:vl(t[2]+""+t[2]),b:vl(t[3]+""+t[3]),a:h$(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Yc.hex3.exec(i))?{r:vl(t[1]+""+t[1]),g:vl(t[2]+""+t[2]),b:vl(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function Ege(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 m6(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 Mge(i){if(Array.isArray(i))return i}function Cge(i){if(Array.isArray(i))return m6(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 Rge(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Pge(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Wo(i,e){return i.get(p$(i,e))}function W_(i,e,t){Rge(i,e),e.set(i,t)}function aE(i,e,t){return i.set(p$(i,e),t),t}function Ige(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,Gge(n.key),n)}}function Nge(i,e,t){return e&&Ige(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Lge(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Dge(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 Fge(){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 Oge(){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 Bge(i,e){return Mge(i)||Dge(i,e)||A$(i,e)||Fge()}function Uge(i){return Cge(i)||Lge(i)||A$(i)||Oge()}function kge(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 Gge(i){var e=kge(i,"string");return typeof e=="symbol"?e:e+""}function A$(i,e){if(i){if(typeof i=="string")return m6(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)?m6(i,e):void 0}}var j_=new WeakMap,cv=new WeakMap,X_=new WeakMap,d6=new WeakMap,p6=new WeakMap,A6=new WeakMap,m$=(function(){function i(){Pge(this,i),W_(this,j_,new Map),W_(this,cv,new Map),W_(this,X_,function(e){return e}),W_(this,d6,function(){return{}}),W_(this,p6,function(){}),W_(this,A6,function(){})}return Nge(i,[{key:"getObj",value:function(t){return Wo(j_,this).get(Wo(X_,this).call(this,t))}},{key:"getData",value:function(t){return Wo(cv,this).get(t)}},{key:"entries",value:function(){return Uge(Wo(cv,this).entries()).map(function(t){var n=Bge(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return aE(X_,this,rt(t)),this}},{key:"onCreateObj",value:function(t){return aE(d6,this,t),this}},{key:"onUpdateObj",value:function(t){return aE(p6,this,t),this}},{key:"onRemoveObj",value:function(t){return aE(A6,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!Wo(j_,n).has(Wo(X_,n).call(n,s))}).forEach(function(s){var o=Wo(d6,n).call(n,s);Wo(j_,n).set(Wo(X_,n).call(n,s),o),Wo(cv,n).set(o,s)});var r=new Map(t.map(function(s){return[Wo(X_,n).call(n,s),s]}));return Wo(j_,this).forEach(function(s,o){r.has(o)?Wo(p6,n).call(n,s,r.get(o)):(Wo(A6,n).call(n,s,o),Wo(j_,n).delete(o),Wo(cv,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();var Hm=Mse(g$(),1);var yi=11102230246251565e-32,Es=134217729,hv=(3+8*yi)*yi;function om(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 fv(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 zge=(3+16*yi)*yi,Vge=(2+12*yi)*yi,qge=(9+64*yi)*yi*yi,$_=ut(4),_$=ut(8),x$=ut(12),y$=ut(16),va=ut(4);function Hge(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=Es*B,x=p-(p-B),v=B-x,p=Es*H,w=p-(p-H),S=H-w,L=v*S-(C-x*w-v*w-x*S),D=V*z,p=Es*V,x=p-(p-V),v=V-x,p=Es*z,w=p-(p-z),S=z-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,$_[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,$_[1]=R-(T+f)+(f-D),N=P+T,f=N-P,$_[2]=P-(N-f)+(T-f),$_[3]=N;let Z=fv(4,$_),J=Vge*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=qge*o+hv*Math.abs(Z),Z+=B*u+H*a-(V*c+z*l),Z>=J||-Z>=J))return Z;C=a*H,p=Es*a,x=p-(p-a),v=a-x,p=Es*H,w=p-(p-H),S=H-w,L=v*S-(C-x*w-v*w-x*S),D=l*z,p=Es*l,x=p-(p-l),v=l-x,p=Es*z,w=p-(p-z),S=z-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,va[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,va[1]=R-(T+f)+(f-D),N=P+T,f=N-P,va[2]=P-(N-f)+(T-f),va[3]=N;let j=om(4,$_,4,va,_$);C=B*u,p=Es*B,x=p-(p-B),v=B-x,p=Es*u,w=p-(p-u),S=u-w,L=v*S-(C-x*w-v*w-x*S),D=V*c,p=Es*V,x=p-(p-V),v=V-x,p=Es*c,w=p-(p-c),S=c-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,va[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,va[1]=R-(T+f)+(f-D),N=P+T,f=N-P,va[2]=P-(N-f)+(T-f),va[3]=N;let K=om(j,_$,4,va,x$);C=a*u,p=Es*a,x=p-(p-a),v=a-x,p=Es*u,w=p-(p-u),S=u-w,L=v*S-(C-x*w-v*w-x*S),D=l*c,p=Es*l,x=p-(p-l),v=l-x,p=Es*c,w=p-(p-c),S=c-w,F=v*S-(D-x*w-v*w-x*S),T=L-F,f=L-T,va[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,va[1]=R-(T+f)+(f-D),N=P+T,f=N-P,va[2]=P-(N-f)+(T-f),va[3]=N;let ee=om(K,x$,4,va,y$);return y$[ee-1]}function Up(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)>=zge*c?l:-Hge(i,e,t,n,r,s,c)}var ZYe=(7+56*yi)*yi,KYe=(3+28*yi)*yi,QYe=(26+288*yi)*yi*yi,JYe=ut(4),eZe=ut(4),tZe=ut(4),nZe=ut(4),iZe=ut(4),rZe=ut(4),sZe=ut(4),oZe=ut(4),aZe=ut(4),lZe=ut(8),cZe=ut(8),uZe=ut(8),hZe=ut(4),fZe=ut(8),dZe=ut(8),pZe=ut(16),AZe=ut(12),mZe=ut(192),gZe=ut(192);var yZe=(10+96*yi)*yi,vZe=(4+48*yi)*yi,bZe=(44+576*yi)*yi*yi,wZe=ut(4),SZe=ut(4),TZe=ut(4),EZe=ut(4),MZe=ut(4),CZe=ut(4),RZe=ut(4),PZe=ut(4),IZe=ut(8),NZe=ut(8),LZe=ut(8),DZe=ut(8),FZe=ut(8),OZe=ut(8),BZe=ut(8),UZe=ut(8),kZe=ut(8),GZe=ut(4),zZe=ut(4),VZe=ut(4),qZe=ut(8),HZe=ut(16),WZe=ut(16),jZe=ut(16),XZe=ut(32),$Ze=ut(32),YZe=ut(48),ZZe=ut(64),KZe=ut(1152),QZe=ut(1152);var nKe=(16+224*yi)*yi,iKe=(5+72*yi)*yi,rKe=(71+1408*yi)*yi*yi,sKe=ut(4),oKe=ut(4),aKe=ut(4),lKe=ut(4),cKe=ut(4),uKe=ut(4),hKe=ut(4),fKe=ut(4),dKe=ut(4),pKe=ut(4),AKe=ut(24),mKe=ut(24),gKe=ut(24),_Ke=ut(24),xKe=ut(24),yKe=ut(24),vKe=ut(24),bKe=ut(24),wKe=ut(24),SKe=ut(24),TKe=ut(1152),EKe=ut(1152),MKe=ut(1152),CKe=ut(1152),RKe=ut(1152),PKe=ut(2304),IKe=ut(2304),NKe=ut(3456),LKe=ut(5760),DKe=ut(8),FKe=ut(8),OKe=ut(8),BKe=ut(16),UKe=ut(24),kKe=ut(48),GKe=ut(48),zKe=ut(96),VKe=ut(192),qKe=ut(384),HKe=ut(384),WKe=ut(384),jKe=ut(768);var XKe=ut(96),$Ke=ut(96),YKe=ut(96),ZKe=ut(1152);var b$=Math.pow(2,-52),lE=new Uint32Array(512),kp=class i{static from(e,t=Zge,n=Kge){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=_6(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=_6(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=$ge(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];Y_(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(Up(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=Yge(S,T,P,R,L,D);this._cx=F.x,this._cy=F.y;for(let B=0;B<o;B++)this._dists[B]=_6(e[2*B],e[2*B+1],F.x,F.y);Y_(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)<=b$&&Math.abs(J-V)<=b$||(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],Up(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],Up(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],Up(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(jge(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=lE[--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(Xge(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<lE.length&&(lE[s++]=P)}else{if(s===0)break;e=lE[--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 jge(i,e){let t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function _6(i,e,t,n){let r=i-t,s=e-n;return r*r+s*s}function Xge(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 $ge(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 Yge(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 Y_(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;dv(i,r,s),e[i[t]]>e[i[n]]&&dv(i,t,n),e[i[s]]>e[i[n]]&&dv(i,s,n),e[i[t]]>e[i[s]]&&dv(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;dv(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(Y_(i,e,s,n),Y_(i,e,t,o-1)):(Y_(i,e,t,o-1),Y_(i,e,s,n))}}function dv(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function Zge(i){return i[0]}function Kge(i){return i[1]}function w$(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=Up(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 S$(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 T$(i){return i.type==="Feature"?i.geometry:i}function Qge(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");let n=S$(i),r=T$(e),s=r.type,o=e.bbox,a=r.coordinates;if(o&&Jge(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){let u=w$(n,a[c]);if(u===0)return!t.ignoreBoundary;u&&(l=!0)}return l}function Jge(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var E$=Qge;var rc=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 Gp=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 pv=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 rc: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 rc: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 rc: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 Gp;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 e_e=2*Math.PI,Z_=Math.pow;function t_e(i){return i[0]}function n_e(i){return i[1]}function i_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 r_e(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}var K_=class i{static from(e,t=t_e,n=n_e,r){return new i("length"in e?s_e(e,t,n,r):Float64Array.from(o_e(e,t,n,r)))}constructor(e){this._delaunator=new kp(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&&i_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=r_e(t[2*p],t[2*p+1],f);t[2*p]=v[0],t[2*p+1]=v[1]}this._delaunator=new kp(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 pv(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=Z_(t-c[e*2],2)+Z_(n-c[e*2+1],2),p=r[e],x=p;do{let v=l[x],w=Z_(t-c[v*2],2)+Z_(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&&Z_(t-c[x*2],2)+Z_(n-c[x*2+1],2)<f)return x;break}}while(x!==p);return u}render(e){let t=e==null?e=new rc: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 rc: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,e_e)}return n&&n.value()}renderHull(e){let t=e==null?e=new rc: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 Gp;return this.renderHull(e),e.value()}renderTriangle(e,t){let n=t==null?t=new rc: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 Gp;return this.renderTriangle(e,t),t.value()}};function s_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*o_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 Av=Math.PI,M$=Av/2,PQe=Av/4,IQe=Av*2,x6=180/Av,y6=Av/180;var v6=Math.atan2,cE=Math.cos;var C$=Math.max,R$=Math.min;var uE=Math.sin,P$=Math.sign||function(i){return i>0?1:i<0?-1:0},hE=Math.sqrt;function b6(i){return i>1?M$:i<-1?-M$:Math.asin(i)}function w6(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Za(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 mv(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function gv(i){var e=hE(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function S6(i){return[v6(i[1],i[0])*x6,b6(C$(-1,R$(1,i[2])))*x6]}function uh(i){let e=i[0]*y6,t=i[1]*y6,n=cE(t);return[n*cE(e),n*uE(e),uE(t)]}function fE(i){return i=i.map(e=>uh(e)),w6(i[0],Za(i[2],i[1]))}function N$(i){let e=l_e(i),t=u_e(e),n=c_e(t,i),r=f_e(t,i.length),s=a_e(r,i),o=h_e(t,i),{polygons:a,centers:l}=d_e(o,t,i),c=p_e(a),u=m_e(t,i),f=A_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 a_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=uh([r,s]);do a=o,o=null,l=t(u,uh(e[a])),i[a].forEach(f=>{let p=t(u,uh(e[f]));if(p<l){l=p,o=f,c=f;return}});while(o!==null);return c}}function l_e(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);let t=ED(i[e]),n=HD().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*hE(s);r.forEach(p=>i[p]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);let a=K_.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 c_e(i,e){let t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(fE(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(Ip([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function u_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 h_e(i,e){return i.map(t=>{let n=t.map(s=>e[s]).map(uh),r=mv(mv(Za(n[1],n[0]),Za(n[2],n[1])),Za(n[0],n[2]));return S6(gv(r))})}function f_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 d_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=uh(t[0]),l=uh(t[1]),c=gv(mv(a,l)),u=gv(Za(a,l)),f=Za(c,u),p=[c,Za(c,f),Za(Za(c,f),f),Za(Za(Za(c,f),f),f)].map(S6).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=I$(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),f=I$(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 I$(i,e,t){i=uh(i),e=uh(e),t=uh(t);let n=P$(w6(Za(e,i),t));return S6(gv(mv(i,e)).map(r=>n*r))}function p_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 A_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=Ip([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 m_e(i,e){let t=new Set,n=[];i.map(a=>{if(!(fE(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 T6(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=N$(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return O3(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return O3(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=>fE(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=>Ya(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||Ya([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 M6(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 g_e(i){if(Array.isArray(i))return i}function __e(i){if(Array.isArray(i))return M6(i)}function x_e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function y_e(i,e,t){return e=pE(e),C_e(i,D$()?Reflect.construct(e,[],pE(i).constructor):e.apply(i,t))}function v_e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function b_e(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function pE(i){return pE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},pE(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&&C6(i,e)}function D$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(D$=function(){return!!i})()}function S_e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function T_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_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 M_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 C_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 x_e(i)}function C6(i,e){return C6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},C6(i,e)}function hh(i,e){return g_e(i)||T_e(i,e)||F$(i,e)||E_e()}function E6(i){return __e(i)||S_e(i)||F$(i)||M_e()}function F$(i,e){if(i){if(typeof i=="string")return M6(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)?M6(i,e):void 0}}function R_e(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=P_e(i,n),s=rh(r),o=I_e(i,n),a=[].concat(E6(s),E6(o)),l={type:"Polygon",coordinates:i},c=C3(l),u=hh(c,2),f=hh(u[0],2),p=f[0],x=f[1],v=hh(u[1],2),w=v[0],S=v[1],T=p>w||S>=89||x<=-89,P=[];if(T){var R=T6(a).triangles(),C=new Map(a.map(function(ee,ae){var ce=hh(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=hh(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(!R6(ve,l,T))return}(ae=P).push.apply(ae,de)}})}else if(o.length)for(var B=kp.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 u3(ve,function(Ue){return Ue[Qe]})});if(!R6(Ie,l,T))return 1}(ce=P).push.apply(ce,E6(de))},V=0,H=B.triangles.length;V<H;V+=3)z(V);else{var L=H_(r),D=L.vertices,F=L.holes,N=F===void 0?[]:F;P=r6(D,N,2)}var Z=Xa(Ip(a,function(ee){return ee[0]}),[0,1]),J=Xa(Ip(a,function(ee){return ee[1]}),[0,1]),j=a.map(function(ee){var ae=hh(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 P_e(i,e){return i.map(function(t){var n=[],r;return t.forEach(function(s){if(r){var o=Ya(s,r)*180/Math.PI;if(o>e)for(var a=tm(r,s),l=1/Math.ceil(o/e),c=l;c<1;)n.push(a(c)),c+=l}n.push(r=s)}),n})}function I_e(i,e){var t={type:"Polygon",coordinates:i},n=C3(t),r=hh(n,2),s=hh(r[0],2),o=s[0],a=s[1],l=hh(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 N_e(e,{minLng:o,maxLng:c,minLat:a,maxLat:u}).filter(function(p){return R6(p,t,f)})}function N_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 R6(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?LD(e,i):E$(i,e)}var dE=window.THREE?window.THREE:{BufferGeometry:Kn,Float32BufferAttribute:kn},L$=new dE.BufferGeometry().setAttribute?"setAttribute":"addAttribute",AE=(function(i){function e(t,n,r,s,o,a,l){var c;v_e(this,e),c=y_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=R_e(t,{resolution:l}),f=u.contour,p=u.triangles,x=rh(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[L$]("position",new dE.Float32BufferAttribute(v,3)),c[L$]("uv",new dE.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=hh(V,2),Z=H[0],J=H[1];return L_e(J,Z,N(Z,J))})});return H_(B)}function C(){for(var D=R(f,n),F=D.vertices,N=D.holes,B=R(f,r),z=B.vertices,V=rh([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),b_e(e)})(dE.BufferGeometry);function L_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 P6(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 D_e(i){if(Array.isArray(i))return i}function F_e(i){if(Array.isArray(i))return P6(i)}function O_e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function B_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 U_e(){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 k_e(){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 G_e(i,e){if(i==null)return{};var t,n,r=z_e(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 z_e(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 V_e(i,e){return D_e(i)||B_e(i,e)||O$(i,e)||U_e()}function q_e(i){return F_e(i)||O_e(i)||O$(i)||k_e()}function H_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 W_e(i){var e=H_e(i,"string");return typeof e=="symbol"?e:e+""}function O$(i,e){if(i){if(typeof i=="string")return P6(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)?P6(i,e):void 0}}var B$=(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=G_e(S,[x].map(W_e));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=V_e(u,2),p=f[0],x=f[1];return a(x,[].concat(q_e(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 bi=wt(nt);if(bi){It(bi.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:S0("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:S0("invalid type for getValue: "+nt)}return null}var S=!1;function T(Ne,nt){Ne||S0("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 ji={string:function(Qn){var Ii=0;if(Qn!=null&&Qn!==0){var kb=(Qn.length<<2)+1;Ii=Vk(kb),B(Qn,Ii,kb)}return Ii},array:function(Qn){var Ii=Vk(Qn.length);return V(Qn,Ii),Ii}};function bi(Qn){return nt==="string"?F(Qn):nt==="boolean"?!!Qn:Qn}var ne=P(Ne),Xi=[],La=0;if(He)for(var Hs=0;Hs<He.length;Hs++){var Ps=ji[It[Hs]];Ps?(La===0&&(La=Die()),Xi[Hs]=Ps(He[Hs])):Xi[Hs]=He[Hs]}var ns=ne.apply(null,Xi);return ns=bi(ns),La!==0&&Lie(La),ns}function C(Ne,nt,It,He){It=It||[];var h=It.every(function(bi){return bi==="number"}),ji=nt!=="string";return ji&&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 ji="";nt<h;){var bi=Ne[nt++];if(!(bi&128)){ji+=String.fromCharCode(bi);continue}var ne=Ne[nt++]&63;if((bi&224)==192){ji+=String.fromCharCode((bi&31)<<6|ne);continue}var Xi=Ne[nt++]&63;if((bi&240)==224?bi=(bi&15)<<12|ne<<6|Xi:bi=(bi&7)<<18|ne<<12|Xi<<6|Ne[nt++]&63,bi<65536)ji+=String.fromCharCode(bi);else{var La=bi-65536;ji+=String.fromCharCode(55296|La>>10,56320|La&1023)}}return ji}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,ji=It+He-1,bi=0;bi<Ne.length;++bi){var ne=Ne.charCodeAt(bi);if(ne>=55296&&ne<=57343){var Xi=Ne.charCodeAt(++bi);ne=65536+((ne&1023)<<10)|Xi&1023}if(ne<=127){if(It>=ji)break;nt[It++]=ne}else if(ne<=2047){if(It+1>=ji)break;nt[It++]=192|ne>>6,nt[It++]=128|ne&63}else if(ne<=65535){if(It+2>=ji)break;nt[It++]=224|ne>>12,nt[It++]=128|ne>>6&63,nt[It++]=128|ne&63}else{if(It+3>=ji)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 On(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){S0("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){S0("OOM")}function Rn(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,ji=Math.max(nt,h);ji<Ne;)ji<=536870912?ji=H(2*ji,It):ji=Math.min(H((3*ji+2147483648)/4,It),He);var bi=Rn(ji);return!!bi}var bt=typeof atob=="function"?atob:function(Ne){var nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",It="",He,h,ji,bi,ne,Xi,La,Hs=0;Ne=Ne.replace(/[^A-Za-z0-9\+\/\=]/g,"");do bi=nt.indexOf(Ne.charAt(Hs++)),ne=nt.indexOf(Ne.charAt(Hs++)),Xi=nt.indexOf(Ne.charAt(Hs++)),La=nt.indexOf(Ne.charAt(Hs++)),He=bi<<2|ne>>4,h=(ne&15)<<4|Xi>>2,ji=(Xi&3)<<6|La,It=It+String.fromCharCode(He),Xi!==64&&(It=It+String.fromCharCode(h)),La!==64&&(It=It+String.fromCharCode(ji));while(Hs<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:S0,b:f,c:p,d:en,e:cn,f:Pt,g:Mt,h:xe,i:yn,j:St,k:qe,l:Rn,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),ji=new Ne.Uint8Array(It),bi=new Ne.Float32Array(It),ne=new Ne.Float64Array(It),Xi=nt.o|0,La=nt.p|0,Hs=Ne.Math.floor,Ps=Ne.Math.abs,ns=Ne.Math.sqrt,Qn=Ne.Math.cos,Ii=Ne.Math.sin,kb=Ne.Math.tan,Fie=Ne.Math.acos,J1=Ne.Math.asin,jk=Ne.Math.atan,na=Ne.Math.atan2,Ym=Ne.Math.ceil,Da=Ne.Math.imul,s4=Ne.Math.min,Oie=Ne.Math.max,jh=Ne.Math.clz32,Bie=nt.a,Ln=nt.b,Q=nt.c,li=nt.d,Xk=nt.e,Uie=nt.f,kie=nt.g,Gie=nt.h,zie=nt.i,Y=28416;function Vie(d){return He=new Int8Array(d),ji=new Uint8Array(d),h=new Int32Array(d),bi=new Float32Array(d),ne=new Float64Array(d),It=d,!0}function qie(d){d=d|0;var A=0;return A=Y,Y=Y+d|0,Y=Y+15&-16,A|0}function Hie(){return Y|0}function Wie(d){d=d|0,Y=d}function jie(d,A){d=d|0,A=A|0,Y=d}function Xie(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=lr(d|0,m|0,3,0)|0,_=Q()|0,m=pt(d|0,m|0,1,0)|0,m=lr(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 $k(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,Yk(d,A,m,_,0)|0}function Yk(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,!(Zk(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=lr(m|0,y|0,3,0)|0,E=Q()|0,y=pt(m|0,y|0,1,0)|0,y=lr(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(sd(_|0,0,b<<3|0)|0,g|0){sd(g|0,0,b<<2|0)|0,y=fu(d,A,m,_,g,b,E,0)|0;break}y=ia(b,4)|0,y?(I=fu(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 Zk(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),Ui(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=Is(y,A,4,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,Ui(y,A)|0){y=9;break e}}if(y=Is(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,Ui(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=Is(y,A,4,$,W)|0,y|0)break e;if(A=W,y=h[A>>2]|0,A=h[A+4>>2]|0,Ui(y,A)|0){y=9;break e}}if(y=Is(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,Ui(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 fu(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=Xh(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=rd(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=Is(d,A,2,W,$)|0,M|0){case 9:{q=9;break}case 0:{M=$,M=fu(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=Is(d,A,3,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=fu(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=Is(d,A,1,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=fu(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=Is(d,A,5,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=fu(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=Is(d,A,4,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=fu(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=Is(d,A,6,W,$)|0,M|0){case 9:break;case 0:{if(M=$,M=fu(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 Is(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=Fa(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($=(Bl(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=T0($|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(or(E)|0){t:do if((Fa(d,A)|0)==1){if((O|0)!=(E|0))if(e9(E,h[7696+(O*28|0)>>2]|0)|0){d=g4(d,A)|0,b=1,A=Q()|0;break}else li(27634,26928,533,26936);switch(M|0){case 3:{d=T0(d,A)|0,A=Q()|0,h[_>>2]=(h[_>>2]|0)+1,b=0;break t}case 5:{d=g4(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=m4(d,A)|0,A=Q()|0,y=y+1|0;while((y|0)!=(m|0))}if((O|0)!=(E|0)){if(!(o4(E)|0)){if((b|0)!=0|(Fa(d,A)|0)!=5)break;h[_>>2]=(h[_>>2]|0)+1;break}switch(G&127){case 8:case 118:break e;default:}(Fa(d,A)|0)!=3&&(h[_>>2]=(h[_>>2]|0)+1)}}else if((m|0)>0){y=0;do d=T0(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 $ie(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,Kk(d,A,m,_)|0?(sd(_|0,0,m*48|0)|0,_=Yie(d,A,m,_)|0,_|0):(_=0,_|0)}function Kk(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(Ui(d,A)|0)d=9;else{g=0,G=d;do{if(d=Is(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,Ui(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=Is(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,!(Ui(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=Is(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,Ui(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 Yie(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=lr(m|0,g|0,3,0)|0,y=Q()|0,g=pt(m|0,g|0,1,0)|0,g=lr(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=ia(g,8)|0,!I)g=13;else{if(O=ia(g,4)|0,!O){_t(I),g=13;break}if(g=fu(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 Gb(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=(Ui(d,A)|0)==0,g=g?1:2;;){if(h[b>>2]=0,I=(Is(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 Zie(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=ax(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,_9(y,g),m=r9(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 Qk(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,mi=0,oo=0,Bn=0,gi=0,ra=0;if(mi=Y,Y=Y+64|0,Ot=mi+48|0,at=mi+32|0,dt=mi+24|0,Fe=mi+8|0,Ze=mi,M=h[d>>2]|0,(M|0)<=0)return ci=0,Y=mi,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=hre(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(Bn=1/(+(I>>>0)+4294967296*+(M|0)),ra=+ne[Ot>>3],M=Ns(I|0,M|0,_e|0,re|0)|0,gi=+(M>>>0)+4294967296*+(Q()|0),oo=+(_e>>>0)+4294967296*+(re|0),ne[Fe>>3]=Bn*(ra*gi)+Bn*(+ne[at>>3]*oo),ne[We>>3]=Bn*(+ne[ye>>3]*gi)+Bn*(+ne[At>>3]*oo),M=_4(Fe,_,Ze)|0,M|0){E=M;break}ue=Ze,oe=h[ue>>2]|0,ue=h[ue+4>>2]|0,q=Xh(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=rd(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=mi,E|0):0}function Kie(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,mi=0,oo=0,Bn=0,gi=0;if(gi=Y,Y=Y+112|0,ci=gi+80|0,M=gi+72|0,mi=gi,oo=gi+56|0,g=ax(m)|0,g|0)return Bn=g,Y=gi,Bn|0;if(I=d+8|0,Bn=ar((h[I>>2]<<5)+32|0)|0,!Bn)return Bn=13,Y=gi,Bn|0;if(T4(d,Bn),g=ax(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,_9(M,ci),g=r9(ci,A,mi)|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=mi,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=mi,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=mi,h[g>>2]=at,h[g+4>>2]=dt,g=0}if(!g){if(m=ia(at,8)|0,!m)return _t(Bn),Bn=13,Y=gi,Bn|0;if(E=ia(at,8)|0,!E)return _t(Bn),_t(m),Bn=13,Y=gi,Bn|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=Qk(M,at,dt,A,ci,m,E)|0;e:do if(g)_t(m),_t(E),_t(Bn);else{t:do if((h[I>>2]|0)>0){for(b=d+12|0,y=0;g=Qk((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(Bn);break e}while(!1);(dt|0)>0|(dt|0)==0&at>>>0>0&&sd(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=mi,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,Zk(I,A,1,mi,0)|0){E=mi,M=E+56|0;do h[E>>2]=0,E=E+4|0;while((E|0)<(M|0));E=ia(7,4)|0,E|0&&(fu(I,A,1,mi,E,7,0,0)|0,_t(E))}for(oe=0;;){$=mi+(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=Xh(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=rd(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}Qm(W,$,oo)|0,E4(d,Bn,oo)|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(Bn),g=1;break e}else g=E;while(!1);_t(Bn),_t(m),_t(g),g=0}while(!1);return Bn=g,Y=gi,Bn|0}}return _t(Bn),Bn=g,Y=gi,Bn|0}function Qie(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=dre(d,A,((A|0)<0)<<31>>31,b)|0,d|0)return b=d,Y=E,b|0;if(y=$re(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 Ol(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=+Ii(+E)*+Ii(+g),_=+ne[y+(d<<4)+8>>3]-+ne[y+8>>3],m=+na(+(+Ii(+_)*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,_=+Ii(+I)*+Ii(+M),E=+ne[y+(G<<4)+8>>3]-+ne[y+(O<<4)+8>>3],m=+na(+(+Ii(+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 Jie(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=E0(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],Ol(_,m)|0,y=0,Y=b,y|0)}function ere(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=E0(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],Ol(_,m)|0,ne[m>>3]=+ne[m>>3]*4058973249931477e-8,y=0,Y=b,y|0)}function tre(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=E0(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],Ol(_,m)|0,ne[m>>3]=+ne[m>>3]*4058973249931477e-8*1e6,y=0,Y=b,y|0)}function or(d){return d=d|0,d>>>0>121?(d=0,d|0):(d=h[7696+(d*28|0)+16>>2]|0,d|0)}function o4(d){return d=d|0,(d|0)==4|(d|0)==117|0}function Jk(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 nre(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 ire(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 rre(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 e9(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 a4(d,A){return d=d|0,A=A|0,h[848+(d*28|0)+(A<<2)>>2]|0}function l4(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 sre(){return 122}function ore(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 are(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 lre(d){return d=d|0,+ne[d+16>>3]<+ne[d+24>>3]|0}function cre(d){return d=d|0,+(+ne[d>>3]-+ne[d+8>>3])}function t9(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 c4(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=+al(y,d),y<+al(+ne[g>>3],A)||(O=+al(+ne[m>>3],d),O>+al(+ne[_>>3],A))?(E=0,E|0):(E=1,E|0))}function ure(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 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;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=+al(y,d),y<=+al(+ne[g>>3],A)?(O=+al(+ne[_>>3],d),E=O>=+al(+ne[m>>3],A),E|0):(E=0,E|0))}function i9(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));_c(d|0,_|0,168)|0,Y=g}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,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=y4(A,I)|0,A|0?(W=A,Y=$,W|0):(M=I,I=h[M>>2]|0,M=h[M+4>>2]|0,Qm(I,M,O)|0,E0(I,M,G)|0,b=+rx(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=+rx(O,G),ue=+ne[M>>3]-+ne[I>>3],y=+Ps(+ue),oe=+ne[O>>3]-+ne[G>>3],_=+Ps(+oe),!(ue==0|oe==0)&&(ue=+I9(+y,+_),ue=+Ym(+(g*g/+Zb(+(ue/+Zb(+y,+_)),3)/(b*(b*2.59807621135)*.8))),ne[Xi>>3]=ue,q=~~ue>>>0,W=+Ps(ue)>=1?ue>0?~~+s4(+Hs(ue/4294967296),4294967295)>>>0:~~+Ym((ue-+(~~ue>>>0))/4294967296)>>>0:0,(h[Xi+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 hre(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=y4(m,M)|0,m|0?(_=m,Y=I,_|0):(m=M,g=h[m>>2]|0,m=h[m+4>>2]|0,Qm(g,m,b)|0,E0(g,m,E)|0,O=+rx(b,E+8|0),O=+Ym(+(+rx(d,A)/(O*2))),ne[Xi>>3]=O,m=~~O>>>0,g=+Ps(O)>=1?O>0?~~+s4(+Hs(O/4294967296),4294967295)>>>0:~~+Ym((O-+(~~O>>>0))/4294967296)>>>0:0,(h[Xi+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 fre(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 dre(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=d4(h[g>>2]|0,h[g+4>>2]|0)|0,b=0,E=0;;){if(y=d+(b<<3)|0,at=y,!(Vb(h[at>>2]|0,h[at+4>>2]|0)|0)){g=5,We=159;break}if(at=y,at=(d4(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=ar(g)|0,!b)return at=13,Y=dt,at|0;for(_c(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=lr(A|0,m|0,6,0)|0,y=Q()|0,M){b=0,E=0;do at=d+(E<<3)|0,at=((Ui(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=lr(me|0,be|0,10,0)|0,re=Q()|0,Ot=ar(me<<5)|0,!Ot)return at=13,Y=dt,at|0;if(at=ia(_e,4)|0,!at)return _t(Ot),at=13,Y=dt,at|0;e:do if(M){for(ye=d,u4(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=Xh(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,u4(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=lr(g^b|0,(Q()|0)^y|0,484763065,-1084733587)|0,b=Q()|0,g=et(y|0,b|0,27)|0,b=lr(g^y|0,(Q()|0)^b|0,321982955,-1798288965)|0,y=Q()|0,g=et(b|0,y|0,31)|0,y=Xh(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=rd(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,o9(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=lr(y^I|0,(Q()|0)^O|0,484763065,-1084733587)|0,b=Q()|0,g=et(y|0,b|0,27)|0,b=lr(g^y|0,(Q()|0)^b|0,321982955,-1798288965)|0,y=Q()|0,g=et(b|0,y|0,31)|0,y=Xh(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=rd(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&&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=ar(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($=ar(y<<4)|0,!$)break;y=oe,b=ue,W=0,q=0,E=0,M=0;do{if(ex(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=pse($,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],Ol(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=ar(192)|0,re|0){if(h[re+16>>2]=0,h[re+20>>2]=0,q=re+8|0,h[q>>2]=3,g=ar(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],Ol(At,re)|0,h[re+40>>2]=0,h[re+44>>2]=0,G=re+32|0,h[G>>2]=3,g=ar(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],Ol(At,re+24|0)|0,h[re+64>>2]=0,h[re+68>>2]=0,O=re+56|0,h[O>>2]=3,g=ar(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],Ol(At,re+48|0)|0,h[re+88>>2]=0,h[re+92>>2]=0,I=re+80|0,h[I>>2]=3,g=ar(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],Ol(At,re+72|0)|0,h[re+112>>2]=0,h[re+116>>2]=0,M=re+104|0,h[M>>2]=3,g=ar(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],Ol(At,re+96|0)|0,h[re+136>>2]=0,h[re+140>>2]=0,E=re+128|0,h[E>>2]=3,g=ar(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],Ol(At,re+120|0)|0,h[re+160>>2]=0,h[re+164>>2]=0,b=re+152|0,h[b>>2]=3,g=ar(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],Ol(At,re+144|0)|0,h[re+184>>2]=0,h[re+188>>2]=0,y=re+176|0,h[y>>2]=3,g=ar(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],Ol(At,re+168|0)|0,jb(re,8,24,3),g=ar(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=ar(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=Ns(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=ar(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=ar(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 pre(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 Are(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 mre(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 gre(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){A4(d,A,y,O)|0,A4(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&&Ui(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 $k(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 _re(d,A,m,_,g){return d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,m=Gb(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 xre(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 yre(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,_=Is(d,A&-2130706433|134217728,y&7,_,m)|0,Y=g,_|0):(_=6,Y=g,_|0)}function s9(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&(Ui(d,m)|0)!=0?(m=0,m|0):(m=Vb(d,m)|0,m|0)}function vre(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,_=Is(d,y,A&7,_,m+8|0)|0,Y=g,_|0):(_=6,Y=g,_|0)}function u4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0;return g=(Ui(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 ex(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,_=hse(d,y,_&7)|0,(_|0)==-1?(h[m>>2]=0,y=6,Y=b,y|0):(Km(d,y,g)|0&&li(27634,27035,282,27050),A=et(d|0,A|0,52)|0,Q()|0,A=A&15,Ui(d,y)|0?h4(g,A,_,2,m):f4(g,A,_,2,m),y=0,Y=b,y|0)):(y=6,Y=b,y|0)}function o9(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=Is(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=Gb(_,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 bre(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=+Fie(+(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=+ns(+(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=+ns(+(I*I+($*$+_*_))),O=O>0?1/O:0,$=$*O,_=_*O,O=I*O,_=+ix(me-+ix(+na(+(O*(be*b-re*oe)+($*(_e*oe-be*ue)+_*(re*ue-_e*b))),+(ue*O+(b*$+oe*_))))),Bl(A)|0?b=+ix(_+-.3334731722518321):b=_,_=+kb(+y)*2.618033988749896,(A|0)>0){d=0;do _=_*2.6457513110645907,d=d+1|0;while((d|0)!=(A|0))}M=+Qn(+b)*_,b=+Ii(+b)*_}A=m+4|0,W=m+12|0,h[W>>2]=0,y=+Ps(+b)*1.1547005383792515,_=+Ps(+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=Ns(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=Ns(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,tx(g,h[d>>2]|0,A,0,m),Y=_}function tx(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=+use(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=+na(+ +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=(Bl(m)|0)==0,y=+jk(+((m?E:E*.37796447300922725)*.381966011250105))):(y=+jk(+(y*.381966011250105)),Bl(m)|0&&(b=+ix(b+.3334731722518321))),G=+ix(+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=+ns(+(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=+Ii(+G),ue=+Qn(+y),$=+Ii(+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=+ns(+(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 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,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,mi=0,oo=0,Bn=0,gi=0,ra=0,ds=0,Vr=0,ps=0,is=0,Oa=0,Ws=0,js=0,kl=0,ao=0,wi=0,M0=0;if(Oa=Y,Y=Y+256|0,y=Oa+240|0,ci=Oa+224|0,Vr=Oa,ps=Oa+208|0,is=Oa+192|0,mi=Oa+168|0,oo=Oa+152|0,Bn=Oa+136|0,gi=Oa+120|0,ra=Oa+104|0,ds=Oa+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],a9(ci,y,Vr),h[g>>2]=0,ci=_+m+((_|0)==5&1)|0,(ci|0)<=(m|0)){Y=Oa;return}me=h[y>>2]|0,be=ps+4|0,_e=ps+8|0,re=ps+12|0,Fe=is+8|0,Ze=m+5|0,Ee=16848+(me<<2)|0,ye=mi+8|0,At=16928+(me<<2)|0,We=oo+8|0,Ot=Bn+8|0,at=gi+8|0,dt=is+8|0,W=mi+8|0,oe=mi+16|0,$=ds+8|0,ue=ds+16|0,q=m,_=0,b=0,E=0,M=0;e:for(;;){G=Vr+(((q|0)%5|0)<<4)|0,h[ps>>2]=h[G>>2],h[ps+4>>2]=h[G+4>>2],h[ps+8>>2]=h[G+8>>2],h[ps+12>>2]=h[G+12>>2];do;while((Zm(ps,me,0,1)|0)==2);if((q|0)>(m|0)&(Bl(A)|0)!=0){if(G=h[ps>>2]|0,d=h[be>>2]|0,I=h[_e>>2]|0,y=h[re>>2]|0,Ws=+(E-M|0),ne[is>>3]=+(b-M|0)-Ws*.5,ne[Fe>>3]=Ws*.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 ao=y+d|0,wi=(ao|0)<0,I=_+d-(wi?ao:0)|0,kl=(I|0)<0,js=y+_-(wi?ao:0)-(kl?I:0)|0,y=(js|0)<0,d=(wi?0:ao)-(kl?I:0)-(y?js:0)|0,_=(kl?0:I)-(y?js:0)|0,js=y?0:js,y=(_|0)<(d|0)?_:d,y=(js|0)<(y|0)?js:y,I=(y|0)>0,d=d-(I?y:0)|0,_=_-(I?y:0)|0,y=js-(I?y:0)|0,b=b+1|0;while((b|0)<(E|0))}else _=I;switch(wi=(h[Ee>>2]|0)*3|0,js=(Da(wi,h[18608+(G*80|0)+(M*20|0)+4>>2]|0)|0)+d|0,I=(Da(wi,h[18608+(G*80|0)+(M*20|0)+8>>2]|0)|0)+_|0,wi=(Da(wi,h[18608+(G*80|0)+(M*20|0)+12>>2]|0)|0)+y|0,M=(js|0)<0,I=I-(M?js:0)|0,kl=(I|0)<0,wi=wi+(M?0-js|0:0)+(kl?0-I|0:0)|0,ao=(wi|0)<0,js=(M?0:js)-(kl?I:0)-(ao?wi:0)|0,I=(kl?0:I)-(ao?wi:0)|0,wi=ao?0:wi,ao=(I|0)<(js|0)?I:js,ao=(wi|0)<(ao|0)?wi:ao,kl=(ao|0)>0,wi=wi-(kl?ao:0)|0,Ws=+(I-(kl?ao:0)-wi|0),ne[mi>>3]=+(js-(kl?ao:0)-wi|0)-Ws*.5,ne[ye>>3]=Ws*.8660254037844386,Ws=+(h[At>>2]|0),ne[oo>>3]=Ws*3,ne[We>>3]=0,M0=Ws*-1.5,ne[Bn>>3]=M0,ne[Ot>>3]=Ws*2.598076211353316,ne[gi>>3]=M0,ne[at>>3]=Ws*-2.598076211353316,h[17008+(O*80|0)+(G<<2)>>2]|0){case 1:{d=Bn,_=oo;break}case 3:{d=gi,_=Bn;break}case 2:{d=oo,_=gi;break}default:{d=12;break e}}v9(is,mi,_,d,ra),tx(ra,O,me,1,ds),wi=h[g>>2]|0,Ws=+J1(+ +ne[ue>>3]),M0=+na(+ +ne[$>>3],+ +ne[ds>>3]),ne[g+8+(wi<<4)>>3]=Ws,ne[g+8+(wi<<4)+8>>3]=M0,h[g>>2]=(h[g>>2]|0)+1}if((q|0)<(Ze|0)&&(wi=h[re>>2]|0,Ws=+((h[_e>>2]|0)-wi|0),ne[is>>3]=+((h[be>>2]|0)-wi|0)-Ws*.5,ne[dt>>3]=Ws*.8660254037844386,tx(is,h[ps>>2]|0,me,1,mi),wi=h[g>>2]|0,Ws=+J1(+ +ne[oe>>3]),M0=+na(+ +ne[W>>3],+ +ne[mi>>3]),ne[g+8+(wi<<4)>>3]=Ws,ne[g+8+(wi<<4)+8>>3]=M0,h[g>>2]=(h[g>>2]|0)+1),q=q+1|0,(q|0)>=(ci|0)){d=3;break}else _=h[ps>>2]|0,b=h[be>>2]|0,E=h[_e>>2]|0,M=h[re>>2]|0}if((d|0)==3){Y=Oa;return}else(d|0)==12&&li(27073,27120,599,27130)}function a9(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=(Bl(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-_),Bl(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 Zm(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=Da(oe,h[g+8>>2]|0)|0,_e=Da(oe,h[g+12>>2]|0)|0,b=(Da(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 Sre(d,A){d=d|0,A=A|0;var m=0;do m=Zm(d,A,0,1)|0;while((m|0)==2);return m|0}function f4(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,mi=0,oo=0,Bn=0,gi=0,ra=0,ds=0,Vr=0,ps=0,is=0;if(ds=Y,Y=Y+272|0,y=ds+256|0,b=ds+240|0,Bn=ds,gi=ds+224|0,ra=ds+208|0,We=ds+184|0,Ot=ds+168|0,at=ds+152|0,dt=ds+136|0,ci=ds+120|0,mi=ds+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],l9(b,y,Bn),h[g>>2]=0,At=_+m+((_|0)==6&1)|0,(At|0)<=(m|0)){Y=ds;return}_e=h[y>>2]|0,re=m+6|0,be=ra+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=gi+4|0,W=gi+8|0,$=gi+12|0,ue=ra+8|0,M=We+8|0,O=We+16|0,I=mi+8|0,G=mi+16|0,b=0,E=m,_=-1;e:for(;;){if(y=(E|0)%6|0,d=Bn+(y<<4)|0,h[gi>>2]=h[d>>2],h[gi+4>>2]=h[d+4>>2],h[gi+8>>2]=h[d+8>>2],h[gi+12>>2]=h[d+12>>2],d=b,b=Zm(gi,_e,0,1)|0,(E|0)>(m|0)&(Bl(A)|0)!=0&&(oo=h[gi>>2]|0,(d|0)!=1&(oo|0)!=(_|0))){switch(is=(y+5|0)%6|0,d=h[Bn+(is<<4)+12>>2]|0,Vr=+((h[Bn+(is<<4)+8>>2]|0)-d|0),ne[ra>>3]=+((h[Bn+(is<<4)+4>>2]|0)-d|0)-Vr*.5,ne[be>>3]=Vr*.8660254037844386,d=h[Bn+(y<<4)+12>>2]|0,Vr=+((h[Bn+(y<<4)+8>>2]|0)-d|0),ne[We>>3]=+((h[Bn+(y<<4)+4>>2]|0)-d|0)-Vr*.5,ne[me>>3]=Vr*.8660254037844386,Vr=+(h[Fe>>2]|0),ne[Ot>>3]=Vr*3,ne[Ze>>3]=0,ps=Vr*-1.5,ne[at>>3]=ps,ne[Ee>>3]=Vr*2.598076211353316,ne[dt>>3]=ps,ne[ye>>3]=Vr*-2.598076211353316,h[17008+(oe*80|0)+(((_|0)==(oe|0)?oo:_)<<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}}v9(ra,We,_,d,ci),!(b9(ra,ci)|0)&&!(b9(We,ci)|0)&&(tx(ci,oe,_e,1,mi),is=h[g>>2]|0,Vr=+J1(+ +ne[G>>3]),ps=+na(+ +ne[I>>3],+ +ne[mi>>3]),ne[g+8+(is<<4)>>3]=Vr,ne[g+8+(is<<4)+8>>3]=ps,h[g>>2]=(h[g>>2]|0)+1)}if((E|0)<(re|0)&&(is=h[$>>2]|0,Vr=+((h[W>>2]|0)-is|0),ne[ra>>3]=+((h[q>>2]|0)-is|0)-Vr*.5,ne[ue>>3]=Vr*.8660254037844386,tx(ra,h[gi>>2]|0,_e,1,We),is=h[g>>2]|0,Vr=+J1(+ +ne[O>>3]),ps=+na(+ +ne[M>>3],+ +ne[We>>3]),ne[g+8+(is<<4)>>3]=Vr,ne[g+8+(is<<4)+8>>3]=ps,h[g>>2]=(h[g>>2]|0)+1),E=E+1|0,(E|0)>=(At|0)){d=3;break}else _=h[gi>>2]|0}if((d|0)==3){Y=ds;return}else(d|0)==8&&li(27157,27120,766,27202)}function l9(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=(Bl(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-_),Bl(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 d4(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,52)|0,Q()|0,A&15|0}function c9(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,45)|0,Q()|0,A&127|0}function Tre(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 Ere(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 Vb(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=Ns(-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=R4(d|0,A|0,0)|0,Q()|0,((63-b|0)%3|0|0)!=0|0))}function Mre(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=Ns(-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=R4(d|0,m|0,0)|0,Q()|0,(63-b|0)%3|0|0))||s9(d,A)|0?(b=1,b|0):(b=(w9(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 A4(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 nx(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(!(or(m&127)|0))m=nd(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=nd(7,0,g,((g|0)<0)<<31>>31)|0,g=Q()|0;break e}while(!1);m=nd(7,0,g,((g|0)<0)<<31>>31)|0,m=lr(m|0,Q()|0,5,0)|0,m=pt(m|0,Q()|0,-5,-1)|0,m=id(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 Ui(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,!(or(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 Cre(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,v4(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,b4(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 u9(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,(_|0)<(m|0)?(m=A,_=d,Ln(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,Ln(m|0),_|0)}function h9(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 Rre(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=ar(We)|0,!at)return dt=13,dt|0;if(_c(at|0,d|0,We|0)|0,Ot=ia(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=Xh(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(!(or(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=rd(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=id(m|0,_|0,6,0)|0,Q()|0,Fe=ia(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(or(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;$=Xh(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,$=rd(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(sd(Ot|0,0,We|0)|0,_c(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&&(_c(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 Pre(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(v4($,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,b4($),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 Ire(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=(nx(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 Nre(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,52)|0,Q()|0,A&1|0}function Fa(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 m4(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,Ln(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 Ln(A|0),d|0}function T0(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,Ln(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 Ln(A|0),d|0}function Lre(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,Ln(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 Ln(A|0),d|0}function g4(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,Ln(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 Ln(A|0),d|0}function Dre(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,Ln(re|0),Y=me,be|0):(ht(Jk(d)|0,0,45)|0,re=Q()|0|m,be=-1,Ln(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=du(+((d*3|0)-_|0)*.14285714285714285)|0,h[re>>2]=y,d=du(+((_<<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=du(+((d<<1)+_|0)*.14285714285714285)|0,h[re>>2]=E,g=du(+((_*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(_=Jk(be)|0,d=ht(_|0,0,45)|0,A=d|A,d=Q()|0|m&-1040385,M=nre(be)|0,!(or(_)|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(e9(_,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=m4(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,Ln(Ze|0),Y=me,Ee|0}function Bl(d){return d=d|0,(d|0)%2|0|0}function _4(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[Xi>>3]=y,(h[Xi+4>>2]&2146435072|0)==2146435072||(_=+ne[d+8>>3],ne[Xi>>3]=_,(h[Xi+4>>2]&2146435072|0)==2146435072))return I=3,Y=O,I|0;g=+Qn(+y),G=g*+Qn(+_),g=g*+Ii(+_),_=+Ii(+y),ne[I>>3]=G,ne[I+8>>3]=g,ne[I+16>>3]=_,ne[Xi>>3]=G;do if((h[Xi+4>>2]&2146435072|0)!=2146435072&&(ne[Xi>>3]=_,d=h[Xi+4>>2]|0,ne[Xi>>3]=g,!((h[Xi+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],bre(E,A,M),M=Dre(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 x4(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,or(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 Km(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((or(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],!(x4(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,!(or(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(!(Zm(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(or(q)|0)do;while((Zm(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=du(+((_<<1)+d|0)*.14285714285714285)|0,h[W>>2]=A,_=du(+((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 Qm(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=Km(d,A,_)|0,y?(Y=b,y|0):(y=et(d|0,A|0,52)|0,Q()|0,wre(_,y&15,g),M=+J1(+ +ne[g+16>>3]),E=+na(+ +ne[g+8>>3],+ +ne[g>>3]),ne[m>>3]=M,ne[m+8>>3]=E,y=0,Y=b,y|0)}function E0(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,_=Km(d,A,y)|0,_|0)return y=_,Y=b,y|0;_=et(d|0,A|0,45)|0,Q()|0,_=(or(_&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 h4(y,g,0,5,m),E=0,Y=b,E|0}while(!1);return f4(y,g,0,6,m),E=0,Y=b,E|0}function Fre(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,!(or(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 f9(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(or(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=f9((M|d)&~I,O&~(Q()|0),m)|0,Y=G,O|0}else g=0;while(!1);if(_=Km(d,A,y)|0,!_){g?(a9(y,I,O),M=5):(l9(y,I,O),M=6);e:do if(or(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);sd(m|0,-1,d<<2|0)|0;e:do if(g)for(y=0;;){if(b=O+(y<<4)|0,Sre(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,Zm(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 Ore(){return 12}function y4(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 or(_)|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(or(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 Bre(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(or($&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,!(or(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=nd(7,0,I,((I|0)<0)<<31>>31)|0,O=Q()|0,y?(y=lr(I|0,O|0,5,0)|0,y=pt(y|0,Q()|0,-5,-1)|0,y=id(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=lr(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=nd(7,0,b,((b|0)<0)<<31>>31)|0,g=lr(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 nx(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 Ure(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(nx(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(or(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=nd(7,0,E,((E|0)<0)<<31>>31)|0,m=Q()|0;do if(b)if(b=lr(E|0,m|0,5,0)|0,b=pt(b|0,Q()|0,-5,-1)|0,b=id(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=Ns(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),_=id(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=lr(_|0,d|0,E|0,m|0)|0,d=Ns(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=id(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=lr(oe|0,b|0,E|0,m|0)|0,d=Ns(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,$=nd(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=id(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=lr(q|0,W|0,$|0,oe|0)|0,d=Ns(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 v4(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=u9(A,m,g+1|0,_)|0,b=(Q()|0)&-15728641,m=ht(_|0,0,52)|0,m=A|m,b=b|(Q()|0),A=(Ui(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 d9(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=u9(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,Ui(g,y)|0){h[d>>2]=m;return}else{h[d>>2]=-1;return}}function b4(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 ix(d){d=+d;var A=0;return A=d<0?d+6.283185307179586:d,+(d>=6.283185307179586?A+-6.283185307179586:A)}function al(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 kre(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=+Ii(+((g-_)*.5)),m=+Ii(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Qn(+g)*+Qn(+_)*m),+(+na(+ +ns(+m),+ +ns(+(1-m)))*2)}function rx(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=+Ii(+((g-_)*.5)),m=+Ii(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Qn(+g)*+Qn(+_)*m),+(+na(+ +ns(+m),+ +ns(+(1-m)))*2*6371.007180918475)}function Gre(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=+Ii(+((g-_)*.5)),m=+Ii(+((+ne[A+8>>3]-+ne[d+8>>3])*.5)),m=y*y+m*(+Qn(+g)*+Qn(+_)*m),+(+na(+ +ns(+m),+ +ns(+(1-m)))*2*6371.007180918475*1e3)}function p9(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 zre(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 Vre(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 qre(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=nd(7,0,d,((d|0)<0)<<31>>31)|0,m=lr(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 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;if(E=Y,Y=Y+176|0,b=E,d=ex(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=+Ii(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ii(+((g-M)*.5)),M=O*O+M*(+Qn(+_)*+Qn(+I)*M),y=y+ +na(+ +ns(+M),+ +ns(+(1-M)))*2;while((d|0)<(A|0));return ne[m>>3]=y,b=0,Y=E,b|0}function Wre(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=ex(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=+Ii(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ii(+((g-M)*.5)),M=O*O+M*(+Qn(+I)*+Qn(+_)*M),y=y+ +na(+ +ns(+M),+ +ns(+(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 jre(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=ex(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=+Ii(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ii(+((g-M)*.5)),M=O*O+M*(+Qn(+I)*+Qn(+_)*M),y=y+ +na(+ +ns(+M),+ +ns(+(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 Xre(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 $re(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=ia(1,12)|0,!m){m=5;break}h[d+8>>2]=m,d=m}if(M=h[$>>2]|0,I=ia(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=ar(24)|0,!b){d=13,m=37;break e}P4(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=ia(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=ar(24)|0,!y){d=13,m=37;break e}P4(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 sx(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=l4(M,I)|0,(b|0)==7)return ue=1,Y=_e,ue|0;E=l4(I,M)|0,(E|0)==7?li(27291,27315,164,27325):(oe=b,y=E)}else oe=0,y=0;G=or(M)|0,q=or(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=Lre(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=g4(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(x4(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=Fa(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=Fa(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,Bl(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(x4(m,_,ue)|0,(G|0)!=0&(q|0)!=0)if((I|0)!=(M|0)&&li(27398,27315,264,27325),b=Fa(d,A)|0,y=Fa(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 A9(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=or(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=a4(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,Bl(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=du(+(M-W|0)*.14285714285714285)|0,O=du(+(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=du(+(M+W|0)*.14285714285714285)|0,O=du(+(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=a4(me,y)|0,(E|0)==127?I=0:I=or(E)|0;e:do if(y){if(ue){if(m=Fa(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=a4(me,m)|0,(y|0)==127&&li(27476,27315,415,27506),or(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=T0(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=T0(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=l4(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=T0(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=Fa(y,m)|0,(m|0)==7&&li(27634,27315,444,27506),y=o4(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=m4(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=Fa(d,A)|0,m=_,m=Fa(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=T0(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=_,(Fa(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 Yre(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=sx(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 Zre(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-_),_=A9(d,A,O,g)|0),O=_,Y=G,O|0)}function w4(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=sx(d,A,d,A,b)|0,y|0?(E=y,Y=M,E|0):(d=sx(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 Kre(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=w4(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 Qre(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=w4(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=m9(d,A,m,_,y,b,g,0,0,1,0)|0,E?(g=(m9(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 m9(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,sx(d,A,d,A,G)|0&&li(27634,27315,696,27575),sx(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,_=~~+Kb(+at),G=~~+Kb(+W),m=~~+Kb(+$),at=+Ps(+(+(_|0)-at)),W=+Ps(+(+(G|0)-W)),$=+Ps(+(+(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=lr(_e|0,re|0,I|0,O|0)|0,m=pt(m|0,Q()|0,E|0,M|0)|0,Q()|0,m=A9(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 nd(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,Ln(g|0),y|0;y=d,g=A,d=1,A=0;do b=(m&1|0)==0&!0,d=lr((b?1:y)|0,(b?0:g)|0,d|0,A|0)|0,A=Q()|0,m=P9(m|0,_|0,1)|0,_=Q()|0,y=lr(y|0,g|0,y|0,g|0)|0,g=Q()|0;while(!((m|0)==0&(_|0)==0));return Ln(A|0),d|0}function S4(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=Qm(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 fre(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 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,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=ax(_)|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=ia((h[A+8>>2]|0)+1|0,32)|0,g){T4(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);Hb(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 Hb(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=g9(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=Qm(m,_,W)|0,g|0){ue=15;break t}if(E4(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],t9(26896,W)|0)){if(_4(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=E0(m,_,W)|0,g|0){ue=32;break}if(S4(m,_,$,0)|0){ue=36;break}if(b&&x9(h[be>>2]|0,h[q>>2]|0,W,$)|0){ue=42;break}if(M&&y9(h[be>>2]|0,h[q>>2]|0,W,$)|0){ue=42;break}}if(G){if(A=S4(m,_,W,1)|0,g=h[q>>2]|0,A|0){ue=45;break}if(c4(g,W)|0){if(i9($,W),n9(W,h[q>>2]|0)|0){ue=53;break}if(E4(h[be>>2]|0,h[q>>2]|0,E)|0){ue=53;break}if(y9(h[be>>2]|0,h[q>>2]|0,$,W)|0){ue=53;break}}}}do if((y|0)<(h[oe>>2]|0)){if(A=S4(m,_,W,1)|0,g=h[q>>2]|0,A|0){ue=58;break t}if(!(c4(g,W)|0)){ue=73;break}if(n9(h[q>>2]|0,W)|0&&(i9($,W),x9(h[be>>2]|0,h[q>>2]|0,$,W)|0)){ue=65;break t}if(m=h9(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=g9(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 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,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&(Ui(m,g)|0)!=0,O=ht((O?2:1)+M|0,0,y|0)|0,I=Q()|0|A&~E,O=O|d&~b,Ln(I|0),Y=G,O|0}while(!1);return m=m&127,m>>>0>120?(I=0,O=0,Ln(I|0),Y=G,O|0):(p4(O,0,m+1|0,0),I=h[O+4>>2]|0,O=h[O>>2]|0,Ln(I|0),Y=G,O|0)}function ese(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,Jre(G,d,A,m),I=G,v4(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,b4(q),d=q,A=h[d>>2]|0,d=h[d+4>>2]|0,(A|0)==0&(d|0)==0){if(Hb(m),A=m,d=h[A>>2]|0,A=h[A+4>>2]|0,(d|0)==0&(A|0)==0){$=10;break}d9(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,d9(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 tse(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=ax(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=ia((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}T4(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=+cre(m),q=q*+are(m),y=+Ps(+ +ne[m>>3]),y=q/+Qn(+ +Zb(+y,+ +Ps(+ +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(p9(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(Hb(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 nx(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,Hb(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 ox(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(!(t9(A,m)|0)||(A=lre(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 _9(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|+Ps(+(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 ax(d){return d=d|0,(d>>>0<4?0:15)|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,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,_=_|+Ps(+(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|+Ps(+(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 E4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if(!(ox(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,ox((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 x9(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,!(ox(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,ox((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(Wb(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(ox(E,_,h[g+(b<<3)+4>>2]|0)|0){g=0;break e}if(g=b+1|0,Wb((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 Wb(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,!(c4(A,_)|0))return d=0,Y=Ze,d|0;if(ure(A,_,re,g),_c(be|0,m|0,168)|0,(h[m>>2]|0)>0){A=0;do Ee=be+8+(A<<4)+8|0,_e=+al(+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=+al(+ne[_+16>>3],h[g>>2]|0),W=+al(+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],$=+al(+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=+al(+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 y9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;if(Wb(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,Wb((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 nse(){return 8}function ise(){return 16}function rse(){return 168}function sse(){return 8}function ose(){return 16}function ase(){return 12}function lse(){return 8}function cse(d){return d=d|0,+(+((h[d>>2]|0)>>>0)+4294967296*+(h[d+4>>2]|0))}function use(d){d=d|0;var A=0,m=0;return m=+ne[d>>3],A=+ne[d+8>>3],+ +ns(+(m*m+A*A))}function v9(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,+Ps(+(+ne[d>>3]-+ne[A>>3]))<11920928955078125e-23?(A=+Ps(+(+ne[d+8>>3]-+ne[A+8>>3]))<11920928955078125e-23,A|0):(A=0,A|0)}function hse(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,_=Ui(d,A)|0,(m+-1|0)>>>0>5||(_=(_|0)!=0,(m|0)==1&_))return g=-1,Y=y,g|0;do if(lx(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 lx(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,_=Km(d,A,E)|0,_|0)return m=_,Y=O,m|0;y=c9(d,A)|0,I=Fa(d,A)|0,ire(y,M),_=rre(y,h[E>>2]|0)|0;do if(or(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=o4(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 Ul(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=(Ui(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=(Ui(d,A)|0)!=0,((g?4:5)|0)<(m|0)||lx(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=Is(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=Ui(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),lx(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=Is(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(Ui(M,I)|0?y=Gb(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=Ui(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(lx(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=(Ui(I,E)|0)!=0,M?d=Gb(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=Ui(I,E)|0,(d+-1|0)>>>0<=5&&(_e=(g|0)!=0,!((d|0)==1&_e)))do if(lx(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 fse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;return y=(Ui(d,A)|0)==0,_=Ul(d,A,0,m)|0,g=(_|0)==0,y?!g||(_=Ul(d,A,1,m+8|0)|0,_|0)||(_=Ul(d,A,2,m+16|0)|0,_|0)||(_=Ul(d,A,3,m+24|0)|0,_|0)||(_=Ul(d,A,4,m+32|0)|0,_)?(y=_,y|0):Ul(d,A,5,m+40|0)|0:!g||(_=Ul(d,A,1,m+8|0)|0,_|0)||(_=Ul(d,A,2,m+16|0)|0,_|0)||(_=Ul(d,A,3,m+24|0)|0,_|0)||(_=Ul(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 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;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,_=Km(d,E,y)|0,_|0?(E=_,Y=M,E|0):(A=et(d|0,A|0,52)|0,Q()|0,A=A&15,Ui(d,E)|0?h4(y,A,b,1,g):f4(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 w9(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,!(Vb(d,_)|0))?(_=0,Y=g,_|0):(y=et(d|0,A|0,56)|0,Q()|0,y=(Ul(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 S9(){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=Da(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?M4(d,m,_,g,M):$b(d,m,_,I,g,0,M),(g|0)==1){Yb(I,1),g=0;break}else{Yb(I,A),g=1;break}else M4(d,m,_,g,M),Xb(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($b(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:(Yb(I,2),q=g+-2|0,h[I>>2]=h[I>>2]^7,Xb(I,1),$b(d+(0-(h[M+(q<<2)>>2]|0))+E|0,m,_,I,g+-1|0,1,M),Yb(I,1),A=h[I>>2]|1,h[I>>2]=A,d=d+E|0,$b(d,m,_,I,q,1,M),g=q);(O|0)==19&&(O=0,A=T9(I)|0,Xb(I,A),d=d+E|0,g=A+g|0,A=h[I>>2]|0)}}while(!1);Y=G}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;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,(ad[m&3](b,d)|0)>-1&&(ad[m&3](b,E)|0)>-1||(b=O+(_<<2)|0,(ad[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);M9(A,O,_),Y=G}function Xb(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 $b(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,(ad[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,(ad[m&3](y,M)|0)>-1){E=10;break e}if((ad[m&3](y+(0-E)|0,M)|0)>-1){E=10;break e}}if(y=_+1|0,h[q+(_<<2)>>2]=M,$=T9(G)|0,Xb(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,(ad[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&&(M9(A,q,_),M4(d,A,m,g,b)),Y=W}function Yb(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 T9(d){d=d|0;var A=0;return A=E9((h[d>>2]|0)+-1|0)|0,A?A|0:(A=E9(h[d+4>>2]|0)|0,((A|0)==0?0:A+32|0)|0)}function E9(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 M9(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,_c(_|0,h[A>>2]|0,g|0)|0,_=0;do E=A+(_<<2)|0,_=_+1|0,_c(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 du(d){return d=+d,~~+N9(+d)|0}function ar(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=od(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=od(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=od(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((od(d|0)|0)==-1){od(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=od(I|0)|0,$=od(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=S9()|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 ia(d,A){d=d|0,A=A|0;var m=0;return d?(m=Da(A,d)|0,(A|d)>>>0>65535&&(m=((m>>>0)/(d>>>0)|0|0)==(A|0)?m:-1)):m=0,d=ar(m)|0,!d||!(h[d+-4>>2]&3)||sd(d|0,0,m|0)|0,d|0}function pse(d,A){d=d|0,A=A|0;var m=0,_=0;return d?A>>>0>4294967231?(A=S9()|0,h[A>>2]=12,A=0,A|0):(m=Ase(d+-8|0,A>>>0<11?16:A+11&-8)|0,m|0?(A=m+8|0,A|0):(m=ar(A)|0,m?(_=h[d+-4>>2]|0,_=(_&-8)-((_&3|0)==0?8:4)|0,_c(m|0,d|0,(_>>>0<A>>>0?_:A)|0)|0,_t(d),A=m,A|0):(A=0,A|0))):(A=ar(A)|0,A|0)}function Ase(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,C9(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,C9(E,I),d|0)}function C9(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,Ln(A+_+(m>>>0<d>>>0|0)>>>0|0),m|0|0}function Ns(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,_=A-_-(m>>>0>d>>>0|0)>>>0,Ln(_|0),d-m>>>0|0|0}function R9(d){return d=d|0,(d?31-(jh(d^d-1)|0)|0:32)|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;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,Ln(q|0),g|0):(q=0,g=0,Ln(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,Ln(q|0),g|0);y=(E|0)==0;do if(b){if(!y){if(y=(jh(E|0)|0)-(jh(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,Ln(q|0),g|0):(q=0,g=0,Ln(q|0),g|0)}if(y=b-1|0,y&b|0){E=(jh(b|0)|0)+33-(jh(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,Ln(W|0),$|0):($=R9(b|0)|0,W=I>>>($>>>0)|0,$=I<<32-$|O>>>($>>>0)|0,Ln(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,Ln(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,Ln(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>>>((R9(E|0)|0)>>>0),Ln(W|0),$|0;if(y=(jh(E|0)|0)-(jh(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,Ln(W|0),$|0):(W=0,$=0,Ln(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,Ns(I|0,m|0,_|0,q|0)|0,$=Q()|0,W=$>>31|(($|0)<0?-1:0)<<1,E=W&1,d=Ns(_|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,Ln(W|0),$|0}function id(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=Ns(I^d|0,M^A|0,I|0,M|0)|0,b=Q()|0,d=y^I,A=g^M,Ns((C4(E,b,Ns(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 mse(d,A){d=d|0,A=A|0;var m=0,_=0,g=0,y=0;return y=d&65535,g=A&65535,m=Da(g,y)|0,_=d>>>16,d=(m>>>16)+(Da(g,_)|0)|0,g=A>>>16,A=Da(g,y)|0,Ln((d>>>16)+(Da(g,_)|0)+(((d&65535)+A|0)>>>16)|0),d+A<<16|m&65535|0|0}function lr(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0;return g=d,y=m,m=mse(g,y)|0,d=Q()|0,Ln((Da(A,y)|0)+(Da(_,g)|0)+d|d&0|0),m|0|0|0}function rd(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=Ns(b^d|0,y^A|0,b|0,y|0)|0,A=Q()|0,C4(d,A,Ns(I^m|0,M^_|0,I|0,M|0)|0,Q()|0,E)|0,_=Ns(h[E>>2]^b|0,h[E+4>>2]^y|0,b|0,y|0)|0,m=Q()|0,Y=g,Ln(m|0),_|0}function Xh(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,C4(d,A,m,_,g)|0,Y=y,Ln(h[g+4>>2]|0),h[g>>2]|0|0}function P9(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Ln(A>>m|0),d>>>m|(A&(1<<m)-1)<<32-m):(Ln(((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?(Ln(A>>>m|0),d>>>m|(A&(1<<m)-1)<<32-m):(Ln(0),A>>>m-32|0)}function ht(d,A,m){return d=d|0,A=A|0,m=m|0,(m|0)<32?(Ln(A<<m|(d&(1<<m)-1<<32-m)>>>32-m|0),d<<m):(Ln(d<<m-32|0),0)}function R4(d,A,m){return d=d|0,A=A|0,m=m|0,A=jh(A)|0,(A|0)==32&&(A=A+(jh(d)|0)|0),Ln(0),A|0}function I9(d,A){return d=+d,A=+A,d!=d?+A:A!=A?+d:+Oie(+d,+A)}function Zb(d,A){return d=+d,A=+A,d!=d?+A:A!=A?+d:+s4(+d,+A)}function Kb(d){return d=+d,d>=0?+Hs(d+.5):+Ym(d-.5)}function _c(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if((m|0)>=8192)return kie(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 P4(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 _c(d,A,m)|0;return d|0}function sd(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 N9(d){return d=+d,d>=0?+Hs(d+.5):+Ym(d-.5)}function od(d){d=d|0;var A=0,m=0,_=0;return _=Uie()|0,m=h[La>>2]|0,A=m+d|0,(d|0)>0&(A|0)<(m|0)|(A|0)<0?(zie(A|0)|0,Xk(12),-1):(A|0)>(_|0)&&!(Gie(A|0)|0)?(Xk(12),-1):(h[La>>2]=A,m|0)}function gse(d,A,m){return d=d|0,A=A|0,m=m|0,ad[d&3](A|0,m|0)|0}function _se(d,A){return d=d|0,A=A|0,Bie(0),0}var ad=[_se,pre,Are,mre];return{___divdi3:id,___muldi3:lr,___remdi3:rd,___uremdi3:Xh,_areNeighborCells:gre,_bitshift64Ashr:P9,_bitshift64Lshr:et,_bitshift64Shl:ht,_calloc:ia,_cellAreaKm2:ere,_cellAreaM2:tre,_cellAreaRads2:Jie,_cellToBoundary:E0,_cellToCenterChild:h9,_cellToChildPos:Bre,_cellToChildren:Cre,_cellToChildrenSize:nx,_cellToLatLng:Qm,_cellToLocalIj:Yre,_cellToParent:A4,_cellToVertex:Ul,_cellToVertexes:fse,_cellsToDirectedEdge:_re,_cellsToLinkedMultiPolygon:Qie,_childPosToCell:Ure,_compactCells:Rre,_constructCell:Ere,_destroyLinkedMultiPolygon:Xre,_directedEdgeToBoundary:ex,_directedEdgeToCells:vre,_edgeLengthKm:Wre,_edgeLengthM:jre,_edgeLengthRads:Hre,_emscripten_replace_memory:Vie,_free:_t,_getBaseCellNumber:c9,_getDirectedEdgeDestination:yre,_getDirectedEdgeOrigin:xre,_getHexagonAreaAvgKm2:p9,_getHexagonAreaAvgM2:zre,_getHexagonEdgeLengthAvgKm:Vre,_getHexagonEdgeLengthAvgM:qre,_getIcosahedronFaces:f9,_getIndexDigit:Tre,_getNumCells:qb,_getPentagons:y4,_getRes0Cells:ore,_getResolution:d4,_greatCircleDistanceKm:rx,_greatCircleDistanceM:Gre,_greatCircleDistanceRads:kre,_gridDisk:$k,_gridDiskDistances:Yk,_gridDistance:w4,_gridPathCells:Qre,_gridPathCellsSize:Kre,_gridRing:$ie,_gridRingUnsafe:Kk,_i64Add:pt,_i64Subtract:Ns,_isPentagon:Ui,_isResClassIII:Nre,_isValidCell:Vb,_isValidDirectedEdge:s9,_isValidIndex:Mre,_isValidVertex:w9,_latLngToCell:_4,_llvm_ctlz_i64:R4,_llvm_maxnum_f64:I9,_llvm_minnum_f64:Zb,_llvm_round_f64:Kb,_localIjToCell:Zre,_malloc:ar,_maxFaceCount:Fre,_maxGridDiskSize:Xie,_maxPolygonToCellsSize:Zie,_maxPolygonToCellsSizeExperimental:tse,_memcpy:_c,_memmove:P4,_memset:sd,_originToDirectedEdges:u4,_pentagonCount:Ore,_polygonToCells:Kie,_polygonToCellsExperimental:ese,_readInt64AsDoubleFromPointer:cse,_res0CellCount:sre,_reverseDirectedEdge:o9,_round:N9,_sbrk:od,_sizeOfCellBoundary:rse,_sizeOfCoordIJ:lse,_sizeOfGeoLoop:sse,_sizeOfGeoPolygon:ose,_sizeOfH3Index:nse,_sizeOfLatLng:ise,_sizeOfLinkedGeoPolygon:ase,_uncompactCells:Pre,_uncompactCellsSize:Ire,_vertexToLatLng:dse,dynCall_iii:gse,establishStackSpace:jie,stackAlloc:qie,stackRestore:Wie,stackSave:Hie}})(Dt,ct,Z),jt=e.___divdi3=Ce.___divdi3,qi=e.___muldi3=Ce.___muldi3,In=e.___remdi3=Ce.___remdi3,kr=e.___uremdi3=Ce.___uremdi3,mr=e._areNeighborCells=Ce._areNeighborCells,il=e._bitshift64Ashr=Ce._bitshift64Ashr,ta=e._bitshift64Lshr=Ce._bitshift64Lshr,rl=e._bitshift64Shl=Ce._bitshift64Shl,Ia=e._calloc=Ce._calloc,sr=e._cellAreaKm2=Ce._cellAreaKm2,Rs=e._cellAreaM2=Ce._cellAreaM2,sl=e._cellAreaRads2=Ce._cellAreaRads2,hu=e._cellToBoundary=Ce._cellToBoundary,Bb=e._cellToCenterChild=Ce._cellToCenterChild,KR=e._cellToChildPos=Ce._cellToChildPos,QR=e._cellToChildren=Ce._cellToChildren,K1=e._cellToChildrenSize=Ce._cellToChildrenSize,JR=e._cellToLatLng=Ce._cellToLatLng,Q1=e._cellToLocalIj=Ce._cellToLocalIj,e4=e._cellToParent=Ce._cellToParent,t4=e._cellToVertex=Ce._cellToVertex,Uk=e._cellToVertexes=Ce._cellToVertexes,kk=e._cellsToDirectedEdge=Ce._cellsToDirectedEdge,Gk=e._cellsToLinkedMultiPolygon=Ce._cellsToLinkedMultiPolygon,zk=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,Gn=e._getBaseCellNumber=Ce._getBaseCellNumber,Xn=e._getDirectedEdgeDestination=Ce._getDirectedEdgeDestination,pn=e._getDirectedEdgeOrigin=Ce._getDirectedEdgeOrigin,Bi=e._getHexagonAreaAvgKm2=Ce._getHexagonAreaAvgKm2,Gr=e._getHexagonAreaAvgM2=Ce._getHexagonAreaAvgM2,Tr=e._getHexagonEdgeLengthAvgKm=Ce._getHexagonEdgeLengthAvgKm,Hi=e._getHexagonEdgeLengthAvgM=Ce._getHexagonEdgeLengthAvgM,so=e._getIcosahedronFaces=Ce._getIcosahedronFaces,Xt=e._getIndexDigit=Ce._getIndexDigit,Na=e._getNumCells=Ce._getNumCells,Ai=e._getPentagons=Ce._getPentagons,ol=e._getRes0Cells=Ce._getRes0Cells,gc=e._getResolution=Ce._getResolution,qh=e._greatCircleDistanceKm=Ce._greatCircleDistanceKm,b0=e._greatCircleDistanceM=Ce._greatCircleDistanceM,Wi=e._greatCircleDistanceRads=Ce._greatCircleDistanceRads,zr=e._gridDisk=Ce._gridDisk,Hh=e._gridDiskDistances=Ce._gridDiskDistances,er=e._gridDistance=Ce._gridDistance,Wh=e._gridPathCells=Ce._gridPathCells,w0=e._gridPathCellsSize=Ce._gridPathCellsSize,n4=e._gridRing=Ce._gridRing,o4e=e._gridRingUnsafe=Ce._gridRingUnsafe,a4e=e._i64Add=Ce._i64Add,l4e=e._i64Subtract=Ce._i64Subtract,c4e=e._isPentagon=Ce._isPentagon,u4e=e._isResClassIII=Ce._isResClassIII,h4e=e._isValidCell=Ce._isValidCell,f4e=e._isValidDirectedEdge=Ce._isValidDirectedEdge,d4e=e._isValidIndex=Ce._isValidIndex,p4e=e._isValidVertex=Ce._isValidVertex,A4e=e._latLngToCell=Ce._latLngToCell,m4e=e._llvm_ctlz_i64=Ce._llvm_ctlz_i64,g4e=e._llvm_maxnum_f64=Ce._llvm_maxnum_f64,_4e=e._llvm_minnum_f64=Ce._llvm_minnum_f64,x4e=e._llvm_round_f64=Ce._llvm_round_f64,y4e=e._localIjToCell=Ce._localIjToCell,v4e=e._malloc=Ce._malloc,b4e=e._maxFaceCount=Ce._maxFaceCount,w4e=e._maxGridDiskSize=Ce._maxGridDiskSize,S4e=e._maxPolygonToCellsSize=Ce._maxPolygonToCellsSize,T4e=e._maxPolygonToCellsSizeExperimental=Ce._maxPolygonToCellsSizeExperimental,E4e=e._memcpy=Ce._memcpy,M4e=e._memmove=Ce._memmove,C4e=e._memset=Ce._memset,R4e=e._originToDirectedEdges=Ce._originToDirectedEdges,P4e=e._pentagonCount=Ce._pentagonCount,I4e=e._polygonToCells=Ce._polygonToCells,N4e=e._polygonToCellsExperimental=Ce._polygonToCellsExperimental,L4e=e._readInt64AsDoubleFromPointer=Ce._readInt64AsDoubleFromPointer,D4e=e._res0CellCount=Ce._res0CellCount,F4e=e._reverseDirectedEdge=Ce._reverseDirectedEdge,O4e=e._round=Ce._round,B4e=e._sbrk=Ce._sbrk,U4e=e._sizeOfCellBoundary=Ce._sizeOfCellBoundary,k4e=e._sizeOfCoordIJ=Ce._sizeOfCoordIJ,G4e=e._sizeOfGeoLoop=Ce._sizeOfGeoLoop,z4e=e._sizeOfGeoPolygon=Ce._sizeOfGeoPolygon,V4e=e._sizeOfH3Index=Ce._sizeOfH3Index,q4e=e._sizeOfLatLng=Ce._sizeOfLatLng,H4e=e._sizeOfLinkedGeoPolygon=Ce._sizeOfLinkedGeoPolygon,W4e=e._uncompactCells=Ce._uncompactCells,j4e=e._uncompactCellsSize=Ce._uncompactCellsSize,X4e=e._vertexToLatLng=Ce._vertexToLatLng,$4e=e.establishStackSpace=Ce.establishStackSpace,Vk=e.stackAlloc=Ce.stackAlloc,Lie=e.stackRestore=Ce.stackRestore,Die=e.stackSave=Ce.stackSave,Y4e=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 i4=function(Ne){Ne.byteLength&&(Ne=new Uint8Array(Ne)),j.set(Ne,x),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,On("memory initializer")},qk=function(){a(le,i4,function(){throw"could not load memory initializer "+le})},Hk=wt(le);if(Hk)i4(Hk.buffer);else if(e.memoryInitializerRequest){var Wk=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),qk();return}}i4(nt)};e.memoryInitializerRequest.response?setTimeout(Wk,0):e.memoryInitializerRequest.addEventListener("load",Wk)}else qk()}}var Ub;ge=function Ne(){Ub||r4(),Ub||(ge=Ne)};function r4(Ne){if(Ne=Ne||r,Qt>0||(Ct(),Qt>0))return;function nt(){Ub||(Ub=!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=r4;function S0(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=S0,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return r4(),i})(typeof hi=="object"?hi:{}),wn="number",vn=wn,Q_=wn,Tn=wn,En=wn,to=wn,qt=wn,j_e=[["sizeOfH3Index",wn],["sizeOfLatLng",wn],["sizeOfCellBoundary",wn],["sizeOfGeoLoop",wn],["sizeOfGeoPolygon",wn],["sizeOfLinkedGeoPolygon",wn],["sizeOfCoordIJ",wn],["readInt64AsDoubleFromPointer",wn],["isValidCell",Q_,[Tn,En]],["isValidIndex",Q_,[Tn,En]],["latLngToCell",vn,[wn,wn,to,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,to,wn,qt]],["polygonToCells",vn,[qt,to,wn,qt]],["maxPolygonToCellsSizeExperimental",vn,[qt,to,wn,qt]],["polygonToCellsExperimental",vn,[qt,to,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,to]],["uncompactCellsSize",vn,[qt,wn,wn,to,qt]],["isPentagon",Q_,[Tn,En]],["isResClassIII",Q_,[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,to,qt]],["cellToChildren",vn,[Tn,En,to,qt]],["cellToCenterChild",vn,[Tn,En,to,qt]],["cellToChildrenSize",vn,[Tn,En,to,qt]],["cellToChildPos",vn,[Tn,En,to,qt]],["childPosToCell",vn,[wn,wn,Tn,En,to,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",Q_,[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,[to,qt]],["getHexagonAreaAvgKm2",vn,[to,qt]],["getHexagonEdgeLengthAvgM",vn,[to,qt]],["getHexagonEdgeLengthAvgKm",vn,[to,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,[to,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",Q_,[Tn,En]]],X_e=0,$_e=1,Y_e=2,Z_e=3,G$=4,K_e=5,Q_e=6,J_e=7,e1e=8,t1e=9,n1e=10,i1e=11,r1e=12,s1e=13,o1e=14,a1e=15,l1e=16,c1e=17,u1e=18,h1e=19,ls={};ls[X_e]="Success";ls[$_e]="The operation failed but a more specific error is not available";ls[Y_e]="Argument was outside of acceptable range";ls[Z_e]="Latitude or longitude arguments were outside of acceptable range";ls[G$]="Resolution argument was outside of acceptable range";ls[K_e]="Cell argument was not valid";ls[Q_e]="Directed edge argument was not valid";ls[J_e]="Undirected edge argument was not valid";ls[e1e]="Vertex argument was not valid";ls[t1e]="Pentagon distortion was encountered";ls[n1e]="Duplicate input";ls[i1e]="Cell arguments were not neighbors";ls[r1e]="Cell arguments had incompatible resolutions";ls[s1e]="Memory allocation failed";ls[o1e]="Bounds of provided memory were insufficient";ls[a1e]="Mode or flags argument was not valid";ls[l1e]="Index argument was not valid";ls[c1e]="Base cell number was outside of acceptable range";ls[u1e]="Child indexing digits invalid";ls[h1e]="Child indexing digits refer to a deleted subsequence";var f1e=1e3,z$=1001,V$=1002,_E={};_E[f1e]="Unknown unit";_E[z$]="Array length out of bounds";_E[V$]="Got unexpected null value for H3 index";var d1e="Unknown error";function q$(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||d1e)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function H$(i,e){var t=arguments.length===2?{value:e}:{};return q$(ls,i,t)}function W$(i,e){var t=arguments.length===2?{value:e}:{};return q$(_E,i,t)}function xv(i){if(i!==0)throw H$(i)}var Ka={};j_e.forEach(function(e){Ka[e[0]]=hi.cwrap.apply(hi,e)});var J_=16;var yv=4;var e1=8,p1e=8,mE=Ka.sizeOfH3Index(),I6=Ka.sizeOfLatLng(),A1e=Ka.sizeOfCellBoundary(),m1e=Ka.sizeOfGeoPolygon(),_v=Ka.sizeOfGeoLoop(),nJe=Ka.sizeOfLinkedGeoPolygon(),iJe=Ka.sizeOfCoordIJ();function g1e(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw H$(G$,i);return i}function _1e(i){if(!i)throw W$(V$);return i}var x1e=Math.pow(2,32)-1,rJe=Math.pow(2,31)-1;function y1e(i){if(i>x1e)throw W$(z$,i);return i}var v1e=/[^0-9a-fA-F]/;function j$(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||v1e.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),J_),t=parseInt(i.substring(i.length-8),J_);return[t,e]}function U$(i){if(i>=0)return i.toString(J_);i=i&2147483647;var e=X$(8,i.toString(J_)),t=(parseInt(e[0],J_)+8).toString(J_);return e=t+e.substring(1),e}function b1e(i,e){return U$(e)+X$(8,U$(i))}function X$(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}var sJe=Math.pow(2,32);function k$(i,e,t){for(var n=i.length,r=hi._calloc(n,I6),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(K$),r/e1+a);return hi.HEAPU32.set([n,r],e/yv),e}function w1e(i,e){var t=i.length-1,n=hi._calloc(m1e),r=0,s=r+_v,o=s+yv;k$(i[0],n+r,e);var a;if(t>0){a=hi._calloc(t,_v);for(var l=0;l<t;l++)k$(i[l+1],a+_v*l,e)}return hi.setValue(n+s,t,"i32"),hi.setValue(n+o,a,"i32"),n}function S1e(i){var e=0,t=e+_v,n=t+yv,r=yv;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+_v*a+r,"i8*"));hi._free(o)}hi._free(i)}function $$(i,e){e===void 0&&(e=0);var t=hi.getValue(i+mE*e,"i32"),n=hi.getValue(i+mE*e+yv,"i32");return n?b1e(t,n):null}function T1e(i){return Ka.readInt64AsDoubleFromPointer(i)}function E1e(i,e){for(var t=[],n=0;n<e;n++){var r=$$(i,n);r!==null&&t.push(r)}return t}function gE(i){return R1e(hi.getValue(i,"double"))}function Y$(i){return[gE(i),gE(i+e1)]}function M1e(i){return[gE(i+e1),gE(i)]}function C1e(i,e,t){for(var n=hi.getValue(i,"i32"),r=i+e1,s=[],o=e?M1e:Y$,a=0;a<n*2;a+=2)s.push(o(r+e1*a));return t&&s.push(s[0]),s}function Z$(i,e,t){var n=hi._malloc(I6);hi.HEAPF64.set([i,e].map(K$),n/e1);var r=hi._malloc(mE);try{return xv(Ka.latLngToCell(n,t,r)),_1e($$(r))}finally{hi._free(r),hi._free(n)}}function N6(i){var e=hi._malloc(I6),t=j$(i),n=t[0],r=t[1];try{return xv(Ka.cellToLatLng(n,r,e)),Y$(e)}finally{hi._free(e)}}function L6(i,e){var t=hi._malloc(A1e),n=j$(i),r=n[0],s=n[1];try{return xv(Ka.cellToBoundary(r,s,t)),C1e(t,e,e)}finally{hi._free(t)}}function D6(i,e,t){if(g1e(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=hi._malloc(p1e);try{xv(Ka.maxPolygonToCellsSize(r,e,0,s));var o=y1e(T1e(s)),a=hi._calloc(o,mE);try{return xv(Ka.polygonToCells(r,e,0,a)),E1e(a,o)}finally{hi._free(a)}}finally{hi._free(s),S1e(r)}}function K$(i){return i*Math.PI/180}function R1e(i){return i*180/Math.PI}function F6(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 P1e=["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"],Q$=new WeakMap,J$=new WeakMap,eY=new WeakMap,y8=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=P1e,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=eY.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}},eY.set(e,t)),t}getMaterialData(e){let t=J$.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)}J$.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=Q$.get(e);return n===void 0&&(n={renderId:-1,lightsData:[]},Q$.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}},I1e=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function N1e(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&&!I1e.some(n=>n.test(t.file)))}var Fr=class{constructor(e=null){this.isStackTrace=!0,this.stack=N1e(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+}`,zL=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){let n=new wy(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:t0e,fragmentShader:n0e,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Gn(new EA(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},VL=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 zL,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 w_,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 Wd,L[Me]=ze),ze.getTargetRaySpace()},this.getControllerGrip=function(Me){let ze=L[Me];return ze===void 0&&(ze=new Wd,L[Me]=ze),ze.getGripSpace()},this.getHand=function(Me){let ze=L[Me];return ze===void 0&&(ze=new Wd,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?Js: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:Gi,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:Gi,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=Mf*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 wy,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 MW;mt.setAnimationLoop(Ue),this.setAnimationLoop=function(Me){Qe=Me},this.dispose=function(){}}},i0e=new on,LW=new Sn;LW.set(-1,0,0,0,1,0,0,0,1);function r0e(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,yL(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(i0e.makeRotationFromEuler(C)).transpose(),R.isCubeTexture&&R.isRenderTargetTexture===!1&&S.envMapRotation.value.premultiply(LW),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 s0e(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 o0e=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]),ih=null;function a0e(){return ih===null&&(ih=new vA(o0e,16,16,Ts,Li),ih.name="DFG_LUT",ih.minFilter=vi,ih.magFilter=vi,ih.wrapS=Go,ih.wrapT=Go,ih.generateMipmaps=!1,ih.needsUpdate=!0),ih}var n3=class{constructor(e={}){let{canvas:t=KT(),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=Gi}=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([sp,Yu,$u]),T=new Set([Gi,pi,ja,Vo,LA,DA]),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=Gs,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 Kl,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",qi,!1),t.addEventListener("webglcontextrestored",Nn,!1),t.addEventListener("webglcontextcreationerror",Gr,!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,Rn,xe,bt,Ye,wt,Dt,ct;function Ce(){Bn=new pde(ge),Bn.init(),wt=new e0e(ge,Bn),le=new ode(ge,Bn,e,wt),X=new Qpe(ge,Bn),le.reversedDepthBuffer&&p&&X.buffers.depth.setReversed(!0),Z=ge.createFramebuffer(),J=ge.createFramebuffer(),j=ge.createFramebuffer(),Te=new gde(ge),Pe=new Upe,Ve=new Jpe(ge,Bn,X,Pe,le,wt,Te),gt=new dde(z),St=new vue(ge),Dt=new rde(ge,St),qe=new Ade(ge,St,Te,Dt),Ke=new xde(ge,qe,St,Dt,Te),xe=new _de(ge,le,Ve),cn=new ade(Pe),Rt=new Bpe(z,gt,Bn,le,Dt,cn),en=new r0e(z,Pe),Pt=new Gpe,Mt=new jpe(Bn),Rn=new ide(z,gt,X,Ke,v,l),yn=new Kpe(z,Ke,le),ct=new s0e(ge,Te,le,X),bt=new sde(ge,Bn,Te),Ye=new mde(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!==Gi&&(B=new vde(w,t.width,t.height,a,r,s));let jt=new VL(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===Gi){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(Rn.getClearColor())},this.setClearColor=function(){Rn.setClearColor(...arguments)},this.getClearAlpha=function(){return Rn.getClearAlpha()},this.setClearAlpha=function(){Rn.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=Rn.getClearColor(),tn=Rn.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",qi,!1),t.removeEventListener("webglcontextrestored",Nn,!1),t.removeEventListener("webglcontextcreationerror",Gr,!1),Rn.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),fu.stop()};function qi(te){te.preventDefault(),gA("WebGLRenderer: Context Lost."),V=!0}function Nn(){gA("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 Gr(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=qk(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,Bi=(zn.start+zn.count)*hn;zt!==null&&(pn=Math.max(pn,zt.start*hn),Bi=Math.min(Bi,(zt.start+zt.count)*hn)),tn!==null?(pn=Math.max(pn,0),Bi=Math.min(Bi,tn.count)):$n!=null&&(pn=Math.max(pn,0),Bi=Math.min(Bi,$n.count));let zr=Bi-pn;if(zr<0||zr===1/0)return;Dt.setup(De,Le,kt,ke,tn);let Mr,Hi=bt;if(tn!==null&&(Mr=St.get(tn),Hi=Ye,Hi.setIndex(Mr)),De.isMesh)Le.wireframe===!0?(X.setLineWidth(Le.wireframeLinewidth*xn()),Hi.setMode(ge.LINES)):Hi.setMode(ge.TRIANGLES);else if(De.isLine){let oo=Le.linewidth;oo===void 0&&(oo=1),X.setLineWidth(oo*xn()),De.isLineSegments?Hi.setMode(ge.LINES):De.isLineLoop?Hi.setMode(ge.LINE_LOOP):Hi.setMode(ge.LINE_STRIP)}else De.isPoints?Hi.setMode(ge.POINTS):De.isSprite&&Hi.setMode(ge.TRIANGLES);if(De.isBatchedMesh)if(Bn.get("WEBGL_multi_draw"))Hi.renderMultiDraw(De._multiDrawStarts,De._multiDrawCounts,De._multiDrawCount);else{let oo=De._multiDrawStarts,Xt=De._multiDrawCounts,La=De._multiDrawCount,Ai=tn?St.get(tn).bytesPerElement:1,al=Pe.get(Le).currentProgram.getUniforms();for(let xc=0;xc<La;xc++)al.setValue(ge,"_gl_DrawID",xc),Hi.render(oo[xc]/Ai,Xt[xc])}else if(De.isInstancedMesh)Hi.renderInstances(pn,zr,De.count);else if(ke.isInstancedBufferGeometry){let oo=ke._maxInstanceCount!==void 0?ke._maxInstanceCount:1/0,Xt=Math.min(ke.instanceCount,oo);Hi.renderInstances(pn,zr,Xt)}else Hi.render(pn,zr)};function sl(te,Se,ke){te.transparent===!0&&te.side===ir&&te.forceSinglePass===!1?(te.side=ui,te.needsUpdate=!0,ex(te,Se,ke),te.side=mo,te.needsUpdate=!0,ex(te,Se,ke),te.side=ir):ex(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(){fu.stop()}function ol(){fu.start()}let fu=new MW;fu.setAnimationLoop(or),typeof self<"u"&&fu.setContext(self),this.setAnimationLoop=function(te){Na=te,jt.setAnimationLoop(te),te===null?fu.stop():fu.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,Ao,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&&Gb(Yt,Se,-1/0,z.sortObjects)}Gb(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&&Rn.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];t4(Yt,kt,te,$n)}Qt&&Rn.render(te);for(let hn=0,zn=tn.length;hn<zn;hn++){let $n=tn[hn];e4(L,te,$n,$n.viewport)}}else kt.length>0&&t4(Yt,kt,te,Se),Qt&&Rn.render(te),e4(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 Gb(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++)Gb(zt[Yt],Se,ke,Le)}function e4(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&&J1(De,Se,ke),zt.length>0&&J1(zt,Se,ke),Yt.length>0&&J1(Yt,Se,ke),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1)}function t4(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?Li:Gi,minFilter:_o,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&&Rn.render(ke);let zn=z.toneMapping;z.toneMapping=Gs;let $n=Le.viewport;if(Le.viewport!==void 0&&(Le.viewport=void 0),D.setupLightsView(Le),st===!0&&cn.setGlobalState(z.clippingPlanes,Le),J1(te,ke,Le),Ve.updateMultisampleRenderTarget(zt),Ve.updateRenderTargetMipmap(zt),Bn.has("WEBGL_multisampled_render_to_texture")===!1){let pn=!1;for(let Bi=0,zr=Se.length;Bi<zr;Bi++){let Mr=Se[Bi],{object:Hi,geometry:oo,material:Xt,group:La}=Mr;if(Xt.side===ir&&Hi.layers.test(Le.layers)){let Ai=Xt.side;Xt.side=ui,Xt.needsUpdate=!0,n4(Hi,ke,Le,oo,Xt,La),Xt.side=Ai,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 J1(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)&&n4(kt,Se,ke,tn,zn,hn)}}function n4(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===ir&&De.forceSinglePass===!1?(De.side=ui,De.needsUpdate=!0,z.renderBufferDirect(ke,Se,Le,De,te,zt),De.side=mo,De.needsUpdate=!0,z.renderBufferDirect(ke,Se,Le,De,te,zt),De.side=ir):z.renderBufferDirect(ke,Se,Le,De,te,zt),te.onAfterRender(z,Se,ke,Le,De,zt)}function ex(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 r4(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),r4(te,kt),Le.needsLights=Wk(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 i4(te){if(te.uniformsList===null){let Se=te.currentProgram.getUniforms();te.uniformsList=P_.seqWithValue(Se.seq,te.uniforms)}return te.uniformsList}function r4(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 Vk(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 qk(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,Bi=!!ke.morphAttributes.normal,zr=!!ke.morphAttributes.color,Mr=Gs;Le.toneMapped&&(ae===null||ae.isXRRenderTarget===!0)&&(Mr=z.toneMapping);let Hi=ke.morphAttributes.position||ke.morphAttributes.normal||ke.morphAttributes.color,oo=Hi!==void 0?Hi.length:0,Xt=Pe.get(Le),La=D.state.lights;if(st===!0&&(tt===!0||te!==de)){let er=te===de&&Le.id===ce;cn.setState(Le,te,er)}let Ai=!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!==Bi||Xt.morphColors!==zr||Xt.toneMapping!==Mr||Xt.morphTargetsCount!==oo||!!Xt.lightProbeGrid!=D.state.lightProbeGridArray.length>0)&&(Ai=!0):(Ai=!0,Xt.__version=Le.version);let al=Xt.currentProgram;Ai===!0&&(al=ex(Le,Se,De),H&&Le.isNodeMaterial&&H.onUpdateProgram(Le,al,Xt));let xc=!1,Hh=!1,S0=!1,Wi=al.getUniforms(),Vr=Xt.uniforms;if(X.useProgram(al.program)&&(xc=!0,Hh=!0,S0=!0),Le.id!==ce&&(ce=Le.id,Hh=!0),Xt.needsLights){let er=Vk(D.state.lightProbeGridArray,De);Xt.lightProbeGrid!==er&&(Xt.lightProbeGrid=er,Hh=!0)}if(xc||de!==te){X.buffers.depth.getReversed()&&te.reversedDepth!==!0&&(te._reversedDepth=!0,te.updateProjectionMatrix()),Wi.setValue(ge,"projectionMatrix",te.projectionMatrix),Wi.setValue(ge,"viewMatrix",te.matrixWorldInverse);let jh=Wi.map.cameraPosition;jh!==void 0&&jh.setValue(ge,yt.setFromMatrixPosition(te.matrixWorld)),le.logarithmicDepthBuffer&&Wi.setValue(ge,"logDepthBufFC",2/(Math.log(te.far+1)/Math.LN2)),(Le.isMeshPhongMaterial||Le.isMeshToonMaterial||Le.isMeshLambertMaterial||Le.isMeshBasicMaterial||Le.isMeshStandardMaterial||Le.isShaderMaterial)&&Wi.setValue(ge,"isOrthographic",te.isOrthographicCamera===!0),de!==te&&(de=te,Hh=!0,S0=!0)}if(Xt.needsLights&&(La.state.directionalShadowMap.length>0&&Wi.setValue(ge,"directionalShadowMap",La.state.directionalShadowMap,Ve),La.state.spotShadowMap.length>0&&Wi.setValue(ge,"spotShadowMap",La.state.spotShadowMap,Ve),La.state.pointShadowMap.length>0&&Wi.setValue(ge,"pointShadowMap",La.state.pointShadowMap,Ve)),De.isSkinnedMesh){Wi.setOptional(ge,De,"bindMatrix"),Wi.setOptional(ge,De,"bindMatrixInverse");let er=De.skeleton;er&&(er.boneTexture===null&&er.computeBoneTexture(),Wi.setValue(ge,"boneTexture",er.boneTexture,Ve))}De.isBatchedMesh&&(Wi.setOptional(ge,De,"batchingTexture"),Wi.setValue(ge,"batchingTexture",De._matricesTexture,Ve),Wi.setOptional(ge,De,"batchingIdTexture"),Wi.setValue(ge,"batchingIdTexture",De._indirectTexture,Ve),Wi.setOptional(ge,De,"batchingColorTexture"),De._colorsTexture!==null&&Wi.setValue(ge,"batchingColorTexture",De._colorsTexture,Ve));let Wh=ke.morphAttributes;if((Wh.position!==void 0||Wh.normal!==void 0||Wh.color!==void 0)&&xe.update(De,ke,al),(Hh||Xt.receiveShadow!==De.receiveShadow)&&(Xt.receiveShadow=De.receiveShadow,Wi.setValue(ge,"receiveShadow",De.receiveShadow)),(Le.isMeshStandardMaterial||Le.isMeshLambertMaterial||Le.isMeshPhongMaterial)&&Le.envMap===null&&Se.environment!==null&&(Vr.envMapIntensity.value=Se.environmentIntensity),Vr.dfgLUT!==void 0&&(Vr.dfgLUT.value=a0e()),Hh){if(Wi.setValue(ge,"toneMappingExposure",z.toneMappingExposure),Xt.needsLights&&Hk(Vr,S0),zt&&Le.fog===!0&&en.refreshFogUniforms(Vr,zt),en.refreshMaterialUniforms(Vr,Le,$e,ze,D.state.transmissionRenderTarget[te.id]),Xt.needsLights&&Xt.lightProbeGrid){let er=Xt.lightProbeGrid;Vr.probesSH.value=er.texture,Vr.probesMin.value.copy(er.boundingBox.min),Vr.probesMax.value.copy(er.boundingBox.max),Vr.probesResolution.value.copy(er.resolution)}P_.upload(ge,i4(Xt),Vr,Ve)}if(Le.isShaderMaterial&&Le.uniformsNeedUpdate===!0&&(P_.upload(ge,i4(Xt),Vr,Ve),Le.uniformsNeedUpdate=!1),Le.isSpriteMaterial&&Wi.setValue(ge,"center",De.center),Wi.setValue(ge,"modelViewMatrix",De.modelViewMatrix),Wi.setValue(ge,"normalMatrix",De.normalMatrix),Wi.setValue(ge,"modelMatrix",De.matrixWorld),Le.uniformsGroups!==void 0){let er=Le.uniformsGroups;for(let jh=0,T0=er.length;jh<T0;jh++){let s4=er[jh];ct.update(s4,al),ct.bind(s4,al)}}return al}function Hk(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 Wk(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 Bi=ae!==null?Pe.get(ae).__webglFramebuffer:null;X.bindFramebuffer(ge.FRAMEBUFFER,Bi);let zr=ge.fenceSync(ge.SYNC_GPU_COMMANDS_COMPLETE,0);return ge.flush(),await ZH(ge,zr,4),ge.bindBuffer(ge.PIXEL_PACK_BUFFER,pn),ge.getBufferSubData(ge.PIXEL_PACK_BUFFER,0,zt),ge.deleteBuffer(pn),ge.deleteSync(zr),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,Bi,zr,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 Vr=Math.pow(2,-De);Yt=Math.floor(Mr.width*Vr),kt=Math.floor(Mr.height*Vr),te.isDataArrayTexture?tn=Mr.depth:te.isData3DTexture?tn=Math.floor(Mr.depth*Vr):tn=1,hn=0,zn=0,$n=0}Le!==null?(pn=Le.x,Bi=Le.y,zr=Le.z):(pn=0,Bi=0,zr=0);let Hi=wt.convert(Se.format),oo=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),Ai=X.getParameter(ge.UNPACK_IMAGE_HEIGHT),al=X.getParameter(ge.UNPACK_SKIP_PIXELS),xc=X.getParameter(ge.UNPACK_SKIP_ROWS),Hh=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 S0=te.isDataArrayTexture||te.isData3DTexture,Wi=Se.isDataArrayTexture||Se.isData3DTexture;if(te.isDepthTexture){let Vr=Pe.get(te),Wh=Pe.get(Se),er=Pe.get(Vr.__renderTarget),jh=Pe.get(Wh.__renderTarget);X.bindFramebuffer(ge.READ_FRAMEBUFFER,er.__webglFramebuffer),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,jh.__webglFramebuffer);for(let T0=0;T0<tn;T0++)S0&&(ge.framebufferTextureLayer(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Pe.get(te).__webglTexture,De,$n+T0),ge.framebufferTextureLayer(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Pe.get(Se).__webglTexture,zt,zr+T0)),ge.blitFramebuffer(hn,zn,Yt,kt,pn,Bi,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 Vr=Pe.get(te),Wh=Pe.get(Se);X.bindFramebuffer(ge.READ_FRAMEBUFFER,J),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,j);for(let er=0;er<tn;er++)S0?ge.framebufferTextureLayer(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Vr.__webglTexture,De,$n+er):ge.framebufferTexture2D(ge.READ_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,Vr.__webglTexture,De),Wi?ge.framebufferTextureLayer(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,Wh.__webglTexture,zt,zr+er):ge.framebufferTexture2D(ge.DRAW_FRAMEBUFFER,ge.COLOR_ATTACHMENT0,ge.TEXTURE_2D,Wh.__webglTexture,zt),De!==0?ge.blitFramebuffer(hn,zn,Yt,kt,pn,Bi,Yt,kt,ge.COLOR_BUFFER_BIT,ge.NEAREST):Wi?ge.copyTexSubImage3D(Xt,zt,pn,Bi,zr+er,hn,zn,Yt,kt):ge.copyTexSubImage2D(Xt,zt,pn,Bi,hn,zn,Yt,kt);X.bindFramebuffer(ge.READ_FRAMEBUFFER,null),X.bindFramebuffer(ge.DRAW_FRAMEBUFFER,null)}else Wi?te.isDataTexture||te.isData3DTexture?ge.texSubImage3D(Xt,zt,pn,Bi,zr,Yt,kt,tn,Hi,oo,Mr.data):Se.isCompressedArrayTexture?ge.compressedTexSubImage3D(Xt,zt,pn,Bi,zr,Yt,kt,tn,Hi,Mr.data):ge.texSubImage3D(Xt,zt,pn,Bi,zr,Yt,kt,tn,Hi,oo,Mr):te.isDataTexture?ge.texSubImage2D(ge.TEXTURE_2D,zt,pn,Bi,Yt,kt,Hi,oo,Mr.data):te.isCompressedTexture?ge.compressedTexSubImage2D(ge.TEXTURE_2D,zt,pn,Bi,Mr.width,Mr.height,Hi,Mr.data):ge.texSubImage2D(ge.TEXTURE_2D,zt,pn,Bi,Yt,kt,Hi,oo,Mr);X.pixelStorei(ge.UNPACK_ROW_LENGTH,La),X.pixelStorei(ge.UNPACK_IMAGE_HEIGHT,Ai),X.pixelStorei(ge.UNPACK_SKIP_PIXELS,al),X.pixelStorei(ge.UNPACK_SKIP_ROWS,xc),X.pixelStorei(ge.UNPACK_SKIP_IMAGES,Hh),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 Ao}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 s3=class extends $i{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}},N_=new ie,DW=new on,FW=new on,OW=new ie,BW=new ie,o3=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(),DW.copy(w.matrixWorldInverse),FW.multiplyMatrices(w.projectionMatrix,DW),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){N_.setFromMatrixPosition(v.matrixWorld),N_.applyMatrix4(FW);let T=N_.z>=-1&&N_.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("+(N_.x*s+s)+"px,"+(-N_.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 OW.setFromMatrixPosition(v.matrixWorld),BW.setFromMatrixPosition(w.matrixWorld),OW.distanceToSquared(BW)}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 l0e(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var R2=l0e;var c0e=typeof global=="object"&&global&&global.Object===Object&&global,UW=c0e;var u0e=typeof self=="object"&&self&&self.Object===Object&&self,h0e=UW||u0e||Function("return this")(),a3=h0e;var f0e=function(){return a3.Date.now()},l3=f0e;var d0e=/\s/;function p0e(i){for(var e=i.length;e--&&d0e.test(i.charAt(e)););return e}var kW=p0e;var A0e=/^\s+/;function m0e(i){return i&&i.slice(0,kW(i)+1).replace(A0e,"")}var GW=m0e;var g0e=a3.Symbol,L_=g0e;var zW=Object.prototype,_0e=zW.hasOwnProperty,x0e=zW.toString,P2=L_?L_.toStringTag:void 0;function y0e(i){var e=_0e.call(i,P2),t=i[P2];try{i[P2]=void 0;var n=!0}catch{}var r=x0e.call(i);return n&&(e?i[P2]=t:delete i[P2]),r}var VW=y0e;var v0e=Object.prototype,b0e=v0e.toString;function w0e(i){return b0e.call(i)}var qW=w0e;var S0e="[object Null]",T0e="[object Undefined]",HW=L_?L_.toStringTag:void 0;function E0e(i){return i==null?i===void 0?T0e:S0e:HW&&HW in Object(i)?VW(i):qW(i)}var WW=E0e;function M0e(i){return i!=null&&typeof i=="object"}var jW=M0e;var C0e="[object Symbol]";function R0e(i){return typeof i=="symbol"||jW(i)&&WW(i)==C0e}var XW=R0e;var $W=NaN,P0e=/^[-+]0x[0-9a-f]+$/i,I0e=/^0b[01]+$/i,N0e=/^0o[0-7]+$/i,L0e=parseInt;function D0e(i){if(typeof i=="number")return i;if(XW(i))return $W;if(R2(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=R2(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=GW(i);var t=I0e.test(i);return t||N0e.test(i)?L0e(i.slice(2),t?2:8):P0e.test(i)?$W:+i}var qL=D0e;var F0e="Expected a function",O0e=Math.max,B0e=Math.min;function U0e(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(F0e);e=qL(e)||0,R2(t)&&(u=!!t.leading,f="maxWait"in t,s=f?O0e(qL(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?B0e(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=l3();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(l3())}function L(){var D=l3(),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 YW=U0e;function ZW(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 k0e(i){if(Array.isArray(i))return i}function G0e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function z0e(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function V0e(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 q0e(){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 H0e(i,e){return k0e(i)||V0e(i,e)||W0e(i,e)||q0e()}function W0e(i,e){if(i){if(typeof i=="string")return ZW(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)?ZW(i,e):void 0}}var j0e=z0e(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;G0e(this,i),this.name=e,this.defaultVal=r,this.triggerUpdate=o,this.onChange=l});function Dr(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 j0e(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=YW(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=H0e(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 Fr=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-Fr.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?Fr.Bounce.In(i*2)*.5:Fr.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}}}}),I2=function(){return performance.now()},XA=(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=I2()),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})(),D_={Linear:function(i,e){var t=i.length-1,n=t*e,r=Math.floor(n),s=D_.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=D_.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=D_.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=D_.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}}},KW=(function(){function i(){}return i.nextId=function(){return i._nextId++},i._nextId=0,i})(),HL=new XA,qs=(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=Fr.Linear.None,this._interpolationFunction=D_.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=KW.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=HL,HL.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=I2()),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=I2()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},i.prototype.resume=function(e){return e===void 0&&(e=I2()),!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=Fr.Linear.None),this._easingFunction=e,this},i.prototype.interpolation=function(e){return e===void 0&&(e=D_.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=I2()),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 AHe=KW.nextId,rh=HL,mHe=rh.getAll.bind(rh),gHe=rh.removeAll.bind(rh),_He=rh.add.bind(rh),xHe=rh.remove.bind(rh),yHe=rh.update.bind(rh);function QW(i){let e=+this._x.call(null,i),t=+this._y.call(null,i),n=+this._z.call(null,i);return JW(this.cover(e,t,n),e,t,n,i)}function JW(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 ej(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)JW(this,t[f],n[f],r[f],i[f]);return this}function tj(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 nj(){var i=[];return this.visit(function(e){if(!e.length)do i.push(e.data);while(e=e.next)}),i}function ij(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 Di(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 rj(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 Di(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 Di(P[7],L,D,F,f,p,x),new Di(P[6],l,D,F,L,p,x),new Di(P[5],L,c,F,f,D,x),new Di(P[4],l,c,F,L,D,x),new Di(P[3],L,D,u,f,p,F),new Di(P[2],l,D,u,L,p,F),new Di(P[1],L,c,u,f,D,F),new Di(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 X0e=(i,e,t,n,r,s)=>Math.sqrt((i-n)**2+(e-r)**2+(t-s)**2);function sj(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;X0e(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 oj(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 aj(i){for(var e=0,t=i.length;e<t;++e)this.remove(i[e]);return this}function lj(){return this._root}function cj(){var i=0;return this.visit(function(e){if(!e.length)do++i;while(e=e.next)}),i}function uj(i){var e=[],t,n=this._root,r,s,o,a,l,c,u;for(n&&e.push(new Di(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 Di(r,f,p,x,l,c,u)),(r=n[6])&&e.push(new Di(r,s,p,x,f,c,u)),(r=n[5])&&e.push(new Di(r,f,o,x,l,p,u)),(r=n[4])&&e.push(new Di(r,s,o,x,f,p,u)),(r=n[3])&&e.push(new Di(r,f,p,a,l,c,x)),(r=n[2])&&e.push(new Di(r,s,p,a,f,c,x)),(r=n[1])&&e.push(new Di(r,f,o,a,l,p,x)),(r=n[0])&&e.push(new Di(r,s,o,a,f,p,x))}return this}function hj(i){var e=[],t=[],n;for(this._root&&e.push(new Di(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 Di(s,o,a,l,p,x,v)),(s=r[1])&&e.push(new Di(s,p,a,l,c,x,v)),(s=r[2])&&e.push(new Di(s,o,x,l,p,u,v)),(s=r[3])&&e.push(new Di(s,p,x,l,c,u,v)),(s=r[4])&&e.push(new Di(s,o,a,v,p,x,f)),(s=r[5])&&e.push(new Di(s,p,a,v,c,x,f)),(s=r[6])&&e.push(new Di(s,o,x,v,p,u,f)),(s=r[7])&&e.push(new Di(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 fj(i){return i[0]}function dj(i){return arguments.length?(this._x=i,this):this._x}function pj(i){return i[1]}function Aj(i){return arguments.length?(this._y=i,this):this._y}function mj(i){return i[2]}function gj(i){return arguments.length?(this._z=i,this):this._z}function N2(i,e,t,n){var r=new WL(e??fj,t??pj,n??mj,NaN,NaN,NaN,NaN,NaN,NaN);return i==null?r:r.addAll(i)}function WL(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 _j(i){for(var e={data:i.data},t=e;i=i.next;)t=t.next={data:i.data};return e}var xo=N2.prototype=WL.prototype;xo.copy=function(){var i=new WL(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=_j(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]=_j(n));return i};xo.add=QW;xo.addAll=ej;xo.cover=tj;xo.data=nj;xo.extent=ij;xo.find=rj;xo.findAllWithinRadius=sj;xo.remove=oj;xo.removeAll=aj;xo.root=lj;xo.size=cj;xo.visit=uj;xo.visitAfter=hj;xo.x=dj;xo.y=Aj;xo.z=gj;function $A(i,e){return i==null||e==null?NaN:i<e?-1:i>e?1:i>=e?0:NaN}function jL(i,e){return i==null||e==null?NaN:e<i?-1:e>i?1:e>=i?0:NaN}function c3(i){let e,t,n;i.length!==2?(e=$A,t=(a,l)=>$A(i(a),l),n=(a,l)=>i(a)-l):(e=i===$A||i===jL?i:$0e,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 $0e(){return 0}function XL(i){return i===null?NaN:+i}var xj=c3($A),yj=xj.right,Y0e=xj.left,Z0e=c3(XL).center,L2=yj;function Lp(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 yo=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 K0e=Math.sqrt(50),Q0e=Math.sqrt(10),J0e=Math.sqrt(2);function u3(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>=K0e?10:s>=Q0e?5:s>=J0e?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?u3(i,e,t*2):[a,l,c]}function h3(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?u3(e,i,t):u3(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 D2(i,e,t){return e=+e,i=+i,t=+t,u3(i,e,t)[2]}function $L(i,e,t){e=+e,i=+i,t=+t;let n=e<i,r=n?D2(e,i,t):D2(i,e,t);return(n?-1:1)*(r<0?1/-r:r)}function f3(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 d3(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*eAe(i){for(let e of i)yield*e}function sh(i){return Array.from(eAe(i))}function Of(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 p3(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 A3(i,e){switch(arguments.length){case 0:break;case 1:this.range(i);break;default:this.range(e).domain(i);break}return this}function m3(i,e,t){i.prototype=e.prototype=t,t.constructor=i}function YL(i,e){var t=Object.create(i.prototype);for(var n in e)t[n]=e[n];return t}function B2(){}var F2=.7,x3=1/F2,F_="\\s*([+-]?\\d+)\\s*",O2="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",oh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",tAe=/^#([0-9a-f]{3,8})$/,nAe=new RegExp(`^rgb\\(${F_},${F_},${F_}\\)$`),iAe=new RegExp(`^rgb\\(${oh},${oh},${oh}\\)$`),rAe=new RegExp(`^rgba\\(${F_},${F_},${F_},${O2}\\)$`),sAe=new RegExp(`^rgba\\(${oh},${oh},${oh},${O2}\\)$`),oAe=new RegExp(`^hsl\\(${O2},${oh},${oh}\\)$`),aAe=new RegExp(`^hsla\\(${O2},${oh},${oh},${O2}\\)$`),vj={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};m3(B2,$c,{copy(i){return Object.assign(new this.constructor,this,i)},displayable(){return this.rgb().displayable()},hex:bj,formatHex:bj,formatHex8:lAe,formatHsl:cAe,formatRgb:wj,toString:wj});function bj(){return this.rgb().formatHex()}function lAe(){return this.rgb().formatHex8()}function cAe(){return Rj(this).formatHsl()}function wj(){return this.rgb().formatRgb()}function $c(i){var e,t;return i=(i+"").trim().toLowerCase(),(e=tAe.exec(i))?(t=e[1].length,e=parseInt(e[1],16),t===6?Sj(e):t===3?new Xa(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?g3(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?g3(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=nAe.exec(i))?new Xa(e[1],e[2],e[3],1):(e=iAe.exec(i))?new Xa(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=rAe.exec(i))?g3(e[1],e[2],e[3],e[4]):(e=sAe.exec(i))?g3(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=oAe.exec(i))?Mj(e[1],e[2]/100,e[3]/100,1):(e=aAe.exec(i))?Mj(e[1],e[2]/100,e[3]/100,e[4]):vj.hasOwnProperty(i)?Sj(vj[i]):i==="transparent"?new Xa(NaN,NaN,NaN,0):null}function Sj(i){return new Xa(i>>16&255,i>>8&255,i&255,1)}function g3(i,e,t,n){return n<=0&&(i=e=t=NaN),new Xa(i,e,t,n)}function uAe(i){return i instanceof B2||(i=$c(i)),i?(i=i.rgb(),new Xa(i.r,i.g,i.b,i.opacity)):new Xa}function O_(i,e,t,n){return arguments.length===1?uAe(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}m3(Xa,O_,YL(B2,{brighter(i){return i=i==null?x3:Math.pow(x3,i),new Xa(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?F2:Math.pow(F2,i),new Xa(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new Xa(ZA(this.r),ZA(this.g),ZA(this.b),y3(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:Tj,formatHex:Tj,formatHex8:hAe,formatRgb:Ej,toString:Ej}));function Tj(){return`#${YA(this.r)}${YA(this.g)}${YA(this.b)}`}function hAe(){return`#${YA(this.r)}${YA(this.g)}${YA(this.b)}${YA((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ej(){let i=y3(this.opacity);return`${i===1?"rgb(":"rgba("}${ZA(this.r)}, ${ZA(this.g)}, ${ZA(this.b)}${i===1?")":`, ${i})`}`}function y3(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function ZA(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function YA(i){return i=ZA(i),(i<16?"0":"")+i.toString(16)}function Mj(i,e,t,n){return n<=0?i=e=t=NaN:t<=0||t>=1?i=e=NaN:e<=0&&(i=NaN),new Xc(i,e,t,n)}function Rj(i){if(i instanceof Xc)return new Xc(i.h,i.s,i.l,i.opacity);if(i instanceof B2||(i=$c(i)),!i)return new Xc;if(i instanceof Xc)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 Xc(o,a,l,i.opacity)}function Pj(i,e,t,n){return arguments.length===1?Rj(i):new Xc(i,e,t,n??1)}function Xc(i,e,t,n){this.h=+i,this.s=+e,this.l=+t,this.opacity=+n}m3(Xc,Pj,YL(B2,{brighter(i){return i=i==null?x3:Math.pow(x3,i),new Xc(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?F2:Math.pow(F2,i),new Xc(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(ZL(i>=240?i-240:i+120,r,n),ZL(i,r,n),ZL(i<120?i+240:i-120,r,n),this.opacity)},clamp(){return new Xc(Cj(this.h),_3(this.s),_3(this.l),y3(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=y3(this.opacity);return`${i===1?"hsl(":"hsla("}${Cj(this.h)}, ${_3(this.s)*100}%, ${_3(this.l)*100}%${i===1?")":`, ${i})`}`}}));function Cj(i){return i=(i||0)%360,i<0?i+360:i}function _3(i){return Math.max(0,Math.min(1,i||0))}function ZL(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 KL(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 Ij(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 KL((t-n/e)*e,o,r,s,a)}}function Nj(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 KL((t-n/e)*e,r,s,o,a)}}var U2=i=>()=>i;function fAe(i,e){return function(t){return i+t*e}}function dAe(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 Lj(i){return(i=+i)==1?v3:function(e,t){return t-e?dAe(e,t,i):U2(isNaN(e)?t:e)}}function v3(i,e){var t=e-i;return t?fAe(i,t):U2(isNaN(i)?e:i)}var QL=(function i(e){var t=Lj(e);function n(r,s){var o=t((r=O_(r)).r,(s=O_(s)).r),a=t(r.g,s.g),l=t(r.b,s.b),c=v3(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 Dj(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=O_(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 YWe=Dj(Ij),ZWe=Dj(Nj);function b3(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 w3(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function JL(i,e){return(w3(e)?b3:eD)(i,e)}function eD(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]=KA(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 Fj(i,e){var t=new Date;return i=+i,e=+e,function(n){return t.setTime(i*(1-n)+e*n),t}}function ah(i,e){return i=+i,e=+e,function(t){return i*(1-t)+e*t}}function Oj(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]=KA(i[r],e[r]):n[r]=e[r];return function(s){for(r in t)n[r]=t[r](s);return n}}var nD=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,tD=new RegExp(nD.source,"g");function pAe(i){return function(){return i}}function AAe(i){return function(e){return i(e)+""}}function Bj(i,e){var t=nD.lastIndex=tD.lastIndex=0,n,r,s,o=-1,a=[],l=[];for(i=i+"",e=e+"";(n=nD.exec(i))&&(r=tD.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:ah(n,r)})),t=tD.lastIndex;return t<e.length&&(s=e.slice(t),a[o]?a[o]+=s:a[++o]=s),a.length<2?l[0]?AAe(l[0].x):pAe(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 KA(i,e){var t=typeof e,n;return e==null||t==="boolean"?U2(e):(t==="number"?ah:t==="string"?(n=$c(e))?(e=n,QL):Bj:e instanceof $c?QL:e instanceof Date?Fj:w3(e)?b3:Array.isArray(e)?eD:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Oj:ah)(i,e)}function iD(i,e){return i=+i,e=+e,function(t){return Math.round(i*(1-t)+e*t)}}function rD(i){return function(){return i}}function sD(i){return+i}var Uj=[0,1];function B_(i){return i}function oD(i,e){return(e-=i=+i)?function(t){return(t-i)/e}:rD(isNaN(e)?NaN:.5)}function mAe(i,e){var t;return i>e&&(t=i,i=e,e=t),function(n){return Math.max(i,Math.min(e,n))}}function gAe(i,e,t){var n=i[0],r=i[1],s=e[0],o=e[1];return r<n?(n=oD(r,n),s=t(o,s)):(n=oD(n,r),s=t(s,o)),function(a){return s(n(a))}}function _Ae(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]=oD(i[o],i[o+1]),s[o]=t(e[o],e[o+1]);return function(a){var l=L2(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 xAe(){var i=Uj,e=Uj,t=KA,n,r,s,o=B_,a,l,c;function u(){var p=Math.min(i.length,e.length);return o!==B_&&(o=mAe(i[0],i[p-1])),a=p>2?_Ae:gAe,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),ah)))(p)))},f.domain=function(p){return arguments.length?(i=Array.from(p,sD),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=iD,u()},f.clamp=function(p){return arguments.length?(o=p?!0:B_,u()):o!==B_},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 aD(){return xAe()(B_,B_)}function Gj(i){return Math.abs(i=Math.round(i))>=1e21?i.toLocaleString("en").replace(/,/g,""):i.toString(10)}function QA(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 lh(i){return i=QA(Math.abs(i)),i?i[1]:NaN}function zj(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 Vj(i){return function(e){return e.replace(/[0-9]/g,function(t){return i[+t]})}}var yAe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Dp(i){if(!(e=yAe.exec(i)))throw new Error("invalid format: "+i);var e;return new S3({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]})}Dp.prototype=S3.prototype;function S3(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+""}S3.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 qj(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 k2;function Hj(i,e){var t=QA(i,e);if(!t)return k2=void 0,i.toPrecision(e);var n=t[0],r=t[1],s=r-(k2=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")+QA(i,Math.max(0,e+s-1))[0]}function lD(i,e){var t=QA(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 cD={"%":(i,e)=>(i*100).toFixed(e),b:i=>Math.round(i).toString(2),c:i=>i+"",d:Gj,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)=>lD(i*100,e),r:lD,s:Hj,X:i=>Math.round(i).toString(16).toUpperCase(),x:i=>Math.round(i).toString(16)};function uD(i){return i}var Wj=Array.prototype.map,jj=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function Xj(i){var e=i.grouping===void 0||i.thousands===void 0?uD:zj(Wj.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?uD:Vj(Wj.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=Dp(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"):cD[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=cD[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=qj(H)),ae&&+H==0&&w!=="+"&&(ae=!1),Z=(ae?w==="("?w:a:w==="-"||w==="("?"":w)+Z,J=(D==="s"&&!isNaN(H)&&k2!==void 0?jj[8+k2/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(lh(p)/3)))*3,v=Math.pow(10,-x),w=c((f=Dp(f),f.type="f",f),{suffix:jj[8+x/3]});return function(S){return w(v*S)}}return{format:c,formatPrefix:u}}var T3,E3,M3;hD({thousands:",",grouping:[3],currency:["$",""]});function hD(i){return T3=Xj(i),E3=T3.format,M3=T3.formatPrefix,T3}function fD(i){return Math.max(0,-lh(Math.abs(i)))}function dD(i,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(lh(e)/3)))*3-lh(Math.abs(i)))}function pD(i,e){return i=Math.abs(i),e=Math.abs(e)-i,Math.max(0,lh(e)-lh(i))+1}function AD(i,e,t,n){var r=$L(i,e,t),s;switch(n=Dp(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(i),Math.abs(e));return n.precision==null&&!isNaN(s=dD(r,o))&&(n.precision=s),M3(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(s=pD(r,Math.max(Math.abs(i),Math.abs(e))))&&(n.precision=s-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(s=fD(r))&&(n.precision=s-(n.type==="%")*2);break}}return E3(n)}function mD(i){var e=i.domain;return i.ticks=function(t){var n=e();return h3(n[0],n[n.length-1],t??10)},i.tickFormat=function(t,n){var r=e();return AD(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=D2(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=aD();return i.copy=function(){return kj(i,$a())},A3.apply(i,arguments),mD(i)}function G2(){var i=0,e=1,t=1,n=[.5],r=[0,1],s;function o(l){return l!=null&&l<=l?r[L2(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 G2().domain([i,e]).range(r).unknown(s)},A3.apply(mD(o),arguments)}var Cn=1e-6,JA=1e-12,Jn=Math.PI,eo=Jn/2,U_=Jn/4,to=Jn*2,Zi=180/Jn,mn=Jn/180,ei=Math.abs,k_=Math.atan,cs=Math.atan2,fn=Math.cos,z2=Math.ceil,$j=Math.exp;var C3=Math.hypot,Yj=Math.log;var an=Math.sin,Zj=Math.sign||function(i){return i>0?1:i<0?-1:0},vo=Math.sqrt,Kj=Math.tan;function Qj(i){return i>1?0:i<-1?Jn:Math.acos(i)}function Wo(i){return i>1?eo:i<-1?-eo:Math.asin(i)}function gD(i){return(i=an(i/2))*i}function Zr(){}function R3(i,e){i&&eX.hasOwnProperty(i.type)&&eX[i.type](i,e)}var Jj={Feature:function(i,e){R3(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)R3(t[n].geometry,e)}},eX={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){_D(i.coordinates,e,0)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)_D(t[n],e,0)},Polygon:function(i,e){tX(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)tX(t[n],e)},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)R3(t[n],e)}};function _D(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 tX(i,e){var t=-1,n=i.length;for(e.polygonStart();++t<n;)_D(i[t],e,1);e.polygonEnd()}function Fp(i,e){i&&Jj.hasOwnProperty(i.type)?Jj[i.type](i,e):R3(i,e)}var V2=new yo,nX=new yo,iX,rX,xD,yD,vD,ch={point:Zr,lineStart:Zr,lineEnd:Zr,polygonStart:function(){V2=new yo,ch.lineStart=vAe,ch.lineEnd=bAe},polygonEnd:function(){var i=+V2;nX.add(i<0?to+i:i),this.lineStart=this.lineEnd=this.point=Zr},sphere:function(){nX.add(to)}};function vAe(){ch.point=wAe}function bAe(){sX(iX,rX)}function wAe(i,e){ch.point=sX,iX=i,rX=e,i*=mn,e*=mn,xD=i,yD=fn(e=e/2+U_),vD=an(e)}function sX(i,e){i*=mn,e*=mn,e=e/2+U_;var t=i-xD,n=t>=0?1:-1,r=n*t,s=fn(e),o=an(e),a=vD*o,l=yD*s+a*fn(r),c=a*n*an(r);V2.add(cs(c,l)),xD=i,yD=s,vD=o}function em(i){return[cs(i[1],i[0]),Wo(i[2])]}function ic(i){var e=i[0],t=i[1],n=fn(t);return[n*fn(e),n*an(e),an(t)]}function q2(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]}function Bf(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 P3(i,e){i[0]+=e[0],i[1]+=e[1],i[2]+=e[2]}function H2(i,e){return[i[0]*e,i[1]*e,i[2]*e]}function tm(i){var e=vo(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);i[0]/=e,i[1]/=e,i[2]/=e}var Or,Ya,Kr,vl,nm,cX,uX,G_,W2,Op,kf,Uf={point:bD,lineStart:oX,lineEnd:aX,polygonStart:function(){Uf.point=fX,Uf.lineStart=SAe,Uf.lineEnd=TAe,W2=new yo,ch.polygonStart()},polygonEnd:function(){ch.polygonEnd(),Uf.point=bD,Uf.lineStart=oX,Uf.lineEnd=aX,V2<0?(Or=-(Kr=180),Ya=-(vl=90)):W2>Cn?vl=90:W2<-Cn&&(Ya=-90),kf[0]=Or,kf[1]=Kr},sphere:function(){Or=-(Kr=180),Ya=-(vl=90)}};function bD(i,e){Op.push(kf=[Or=i,Kr=i]),e<Ya&&(Ya=e),e>vl&&(vl=e)}function hX(i,e){var t=ic([i*mn,e*mn]);if(G_){var n=Bf(G_,t),r=[n[1],-n[0],0],s=Bf(r,n);tm(s),s=em(s);var o=i-nm,a=o>0?1:-1,l=s[0]*Zi*a,c,u=ei(o)>180;u^(a*nm<l&&l<a*i)?(c=s[1]*Zi,c>vl&&(vl=c)):(l=(l+360)%360-180,u^(a*nm<l&&l<a*i)?(c=-s[1]*Zi,c<Ya&&(Ya=c)):(e<Ya&&(Ya=e),e>vl&&(vl=e))),u?i<nm?yl(Or,i)>yl(Or,Kr)&&(Kr=i):yl(i,Kr)>yl(Or,Kr)&&(Or=i):Kr>=Or?(i<Or&&(Or=i),i>Kr&&(Kr=i)):i>nm?yl(Or,i)>yl(Or,Kr)&&(Kr=i):yl(i,Kr)>yl(Or,Kr)&&(Or=i)}else Op.push(kf=[Or=i,Kr=i]);e<Ya&&(Ya=e),e>vl&&(vl=e),G_=t,nm=i}function oX(){Uf.point=hX}function aX(){kf[0]=Or,kf[1]=Kr,Uf.point=bD,G_=null}function fX(i,e){if(G_){var t=i-nm;W2.add(ei(t)>180?t+(t>0?360:-360):t)}else cX=i,uX=e;ch.point(i,e),hX(i,e)}function SAe(){ch.lineStart()}function TAe(){fX(cX,uX),ch.lineEnd(),ei(W2)>Cn&&(Or=-(Kr=180)),kf[0]=Or,kf[1]=Kr,G_=null}function yl(i,e){return(e-=i)<0?e+360:e}function EAe(i,e){return i[0]-e[0]}function lX(i,e){return i[0]<=i[1]?i[0]<=e&&e<=i[1]:e<i[0]||i[1]<e}function I3(i){var e,t,n,r,s,o,a;if(vl=Kr=-(Or=Ya=1/0),Op=[],Fp(i,Uf),t=Op.length){for(Op.sort(EAe),e=1,n=Op[0],s=[n];e<t;++e)r=Op[e],lX(n,r[0])||lX(n,r[1])?(yl(n[0],r[1])>yl(n[0],n[1])&&(n[1]=r[1]),yl(r[0],n[1])>yl(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=yl(n[1],r[0]))>o&&(o=a,Or=r[0],Kr=n[1])}return Op=kf=null,Or===1/0||Ya===1/0?[[NaN,NaN],[NaN,NaN]]:[[Or,Ya],[Kr,vl]]}var j2,N3,L3,D3,F3,O3,B3,U3,wD,SD,TD,AX,mX,xa,ya,va,Yc={sphere:Zr,point:ED,lineStart:dX,lineEnd:pX,polygonStart:function(){Yc.lineStart=RAe,Yc.lineEnd=PAe},polygonEnd:function(){Yc.lineStart=dX,Yc.lineEnd=pX}};function ED(i,e){i*=mn,e*=mn;var t=fn(e);X2(t*fn(i),t*an(i),an(e))}function X2(i,e,t){++j2,L3+=(i-L3)/j2,D3+=(e-D3)/j2,F3+=(t-F3)/j2}function dX(){Yc.point=MAe}function MAe(i,e){i*=mn,e*=mn;var t=fn(e);xa=t*fn(i),ya=t*an(i),va=an(e),Yc.point=CAe,X2(xa,ya,va)}function CAe(i,e){i*=mn,e*=mn;var t=fn(e),n=t*fn(i),r=t*an(i),s=an(e),o=cs(vo((o=ya*s-va*r)*o+(o=va*n-xa*s)*o+(o=xa*r-ya*n)*o),xa*n+ya*r+va*s);N3+=o,O3+=o*(xa+(xa=n)),B3+=o*(ya+(ya=r)),U3+=o*(va+(va=s)),X2(xa,ya,va)}function pX(){Yc.point=ED}function RAe(){Yc.point=IAe}function PAe(){gX(AX,mX),Yc.point=ED}function IAe(i,e){AX=i,mX=e,i*=mn,e*=mn,Yc.point=gX;var t=fn(e);xa=t*fn(i),ya=t*an(i),va=an(e),X2(xa,ya,va)}function gX(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=C3(o,a,l),u=Wo(c),f=c&&-u/c;wD.add(f*o),SD.add(f*a),TD.add(f*l),N3+=u,O3+=u*(xa+(xa=n)),B3+=u*(ya+(ya=r)),U3+=u*(va+(va=s)),X2(xa,ya,va)}function k3(i){j2=N3=L3=D3=F3=O3=B3=U3=0,wD=new yo,SD=new yo,TD=new yo,Fp(i,Yc);var e=+wD,t=+SD,n=+TD,r=C3(e,t,n);return r<JA&&(e=O3,t=B3,n=U3,N3<Cn&&(e=L3,t=D3,n=F3),r=C3(e,t,n),r<JA)?[NaN,NaN]:[cs(t,e)*Zi,Wo(n/r)*Zi]}function $2(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 MD(i,e){return ei(i)>Jn&&(i-=Math.round(i/to)*to),[i,e]}MD.invert=MD;function CD(i,e,t){return(i%=to)?e||t?$2(xX(i),yX(e,t)):xX(i):e||t?yX(e,t):MD}function _X(i){return function(e,t){return e+=i,ei(e)>Jn&&(e-=Math.round(e/to)*to),[e,t]}}function xX(i){var e=_X(i);return e.invert=_X(-i),e}function yX(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 RD(i){i=CD(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]*=Zi,t[1]*=Zi,t}return e.invert=function(t){return t=i.invert(t[0]*mn,t[1]*mn),t[0]*=Zi,t[1]*=Zi,t},e}function bX(i,e,t,n,r,s){if(t){var o=fn(e),a=an(e),l=n*t;r==null?(r=e+n*to,s=e-l/2):(r=vX(o,r),s=vX(o,s),(n>0?r<s:r>s)&&(r+=n*to));for(var c,u=r;n>0?u>s:u<s;u-=l)c=em([o,-a*fn(u),-a*an(u)]),i.point(c[0],c[1])}}function vX(i,e){e=ic(e),e[0]-=i,tm(e);var t=Qj(-e[1]);return((-e[2]<0?-t:t)+to-Cn)%to}function G3(){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 z_(i,e){return ei(i[0]-e[0])<Cn&&ei(i[1]-e[1])<Cn}function z3(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 V3(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(z_(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 z3(S,v,null,!0)),o.push(P.o=new z3(S,null,P,!1)),s.push(P=new z3(T,v,null,!1)),o.push(P.o=new z3(T,null,P,!0))}}),!!s.length){for(o.sort(e),wX(s),wX(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 wX(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 PD(i){return ei(i[0])<=Jn?i[0]:Zj(i[0])*((ei(i[0])+Jn)%to-Jn)}function q3(i,e){var t=PD(e),n=e[1],r=an(n),s=[an(t),-fn(t),0],o=0,a=0,l=new yo;r===1?n=eo+Cn:r===-1&&(n=-eo-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=PD(x),w=x[1]/2+U_,S=an(w),T=fn(w),P=0;P<p;++P,v=C,S=D,T=F,x=R){var R=f[P],C=PD(R),L=R[1]/2+U_,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*to:N,V^v>=t^C>=t){var Z=Bf(ic(x),ic(R));tm(Z);var J=Bf(s,Z);tm(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<-JA)^a&1}function H3(i,e,t,n){return function(r){var s=e(r),o=G3(),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=sh(u);var C=q3(c,n);u.length?(l||(r.polygonStart(),l=!0),V3(u,LAe,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(NAe))}}return p}}function NAe(i){return i.length>1}function LAe(i,e){return((i=i.x)[0]<0?i[1]-eo-Cn:eo-i[1])-((e=e.x)[0]<0?e[1]-eo-Cn:eo-e[1])}var ID=H3(function(){return!0},DAe,OAe,[-Jn,-eo]);function DAe(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?eo:-eo),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=FAe(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 FAe(i,e,t,n){var r,s,o=an(i-t);return ei(o)>Cn?k_((an(e)*(s=fn(n))*an(t)-an(n)*(r=fn(e))*an(i))/(r*s*o)):(e+n)/2}function OAe(i,e,t,n){var r;if(i==null)r=t*eo,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 SX(i){var e=fn(i),t=2*mn,n=e>0,r=ei(e)>Cn;function s(u,f,p,x){bX(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||z_(f,R)||z_(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||!z_(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=ic(u),v=ic(f),w=[1,0,0],S=Bf(x,v),T=q2(S,S),P=S[0],R=T-P*P;if(!R)return!p&&u;var C=e*T/R,L=-e*P/R,D=Bf(w,S),F=H2(w,C),N=H2(S,L);P3(F,N);var B=D,z=q2(F,B),V=q2(B,B),H=z*z-V*(q2(F,F)-1);if(!(H<0)){var Z=vo(H),J=H2(B,(-z-Z)/V);if(P3(J,F),J=em(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=H2(B,(-z+Z)/V);return P3(Qe,F),[J,em(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 H3(o,a,s,n?[0,-i]:[-Jn,i-Jn])}function TX(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 Y2=1e9,W3=-Y2;function ND(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=G3(),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=sh(p)).length;(K||ee)&&(c.polygonStart(),K&&(c.lineStart(),s(null,null,1,c),c.lineEnd()),ee&&V3(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(W3,Math.min(Y2,P)),R=Math.max(W3,Math.min(Y2,R))],ce=[j=Math.max(W3,Math.min(Y2,j)),K=Math.max(W3,Math.min(Y2,K))];TX(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 LD,DD,j3,X3,V_={sphere:Zr,point:Zr,lineStart:BAe,lineEnd:Zr,polygonStart:Zr,polygonEnd:Zr};function BAe(){V_.point=kAe,V_.lineEnd=UAe}function UAe(){V_.point=V_.lineEnd=Zr}function kAe(i,e){i*=mn,e*=mn,DD=i,j3=an(e),X3=fn(e),V_.point=GAe}function GAe(i,e){i*=mn,e*=mn;var t=an(e),n=fn(e),r=ei(i-DD),s=fn(r),o=an(r),a=n*o,l=X3*t-j3*n*s,c=j3*t+X3*n*s;LD.add(cs(vo(a*a+l*l),c)),DD=i,j3=t,X3=n}function EX(i){return LD=new yo,Fp(i,V_),+LD}var FD=[null,null],zAe={type:"LineString",coordinates:FD};function Za(i,e){return FD[0]=i,FD[1]=e,EX(zAe)}var MX={Feature:function(i,e){return $3(i.geometry,e)},FeatureCollection:function(i,e){for(var t=i.features,n=-1,r=t.length;++n<r;)if($3(t[n].geometry,e))return!0;return!1}},CX={Sphere:function(){return!0},Point:function(i,e){return RX(i.coordinates,e)},MultiPoint:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(RX(t[n],e))return!0;return!1},LineString:function(i,e){return PX(i.coordinates,e)},MultiLineString:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(PX(t[n],e))return!0;return!1},Polygon:function(i,e){return IX(i.coordinates,e)},MultiPolygon:function(i,e){for(var t=i.coordinates,n=-1,r=t.length;++n<r;)if(IX(t[n],e))return!0;return!1},GeometryCollection:function(i,e){for(var t=i.geometries,n=-1,r=t.length;++n<r;)if($3(t[n],e))return!0;return!1}};function $3(i,e){return i&&CX.hasOwnProperty(i.type)?CX[i.type](i,e):!1}function RX(i,e){return Za(i,e)===0}function PX(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))<JA*r))return!0;t=n}return!1}function IX(i,e){return!!q3(i.map(VAe),NX(e))}function VAe(i){return i=i.map(NX),i.pop(),i}function NX(i){return[i[0]*mn,i[1]*mn]}function OD(i,e){return(i&&MX.hasOwnProperty(i.type)?MX[i.type]:$3)(i,e)}function LX(i,e,t){var n=Of(i,e-Cn,t).concat(e);return function(r){return n.map(function(s){return[r,s]})}}function DX(i,e,t){var n=Of(i,e-Cn,t).concat(e);return function(r){return n.map(function(s){return[s,r]})}}function BD(){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 Of(z2(n/u)*u,t,u).map(v).concat(Of(z2(a/f)*f,o,f).map(w)).concat(Of(z2(e/l)*l,i,l).filter(function(R){return ei(R%u)>Cn}).map(p)).concat(Of(z2(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=LX(s,r,90),x=DX(e,i,S),v=LX(a,o,90),w=DX(n,t,S),T):S},T.extentMajor([[-180,-90+Cn],[180,90-Cn]]).extentMinor([[-180,-80-Cn],[180,80+Cn]])}function UD(){return BD()()}function im(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(vo(gD(s-n)+o*l*gD(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)*Zi,cs(D,vo(C*C+L*L))*Zi]}:function(){return[t*Zi,n*Zi]};return S.distance=v,S}var kD=i=>i;var q_=1/0,Y3=q_,Z2=-q_,Z3=Z2,qAe={point:HAe,lineStart:Zr,lineEnd:Zr,polygonStart:Zr,polygonEnd:Zr,result:function(){var i=[[q_,Y3],[Z2,Z3]];return Z2=Z3=-(Y3=q_=1/0),i}};function HAe(i,e){i<q_&&(q_=i),i>Z2&&(Z2=i),e<Y3&&(Y3=e),e>Z3&&(Z3=e)}var GD=qAe;function K2(i){return function(e){var t=new zD;for(var n in i)t[n]=i[n];return t.stream=e,t}}function zD(){}zD.prototype={constructor:zD,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 VD(i,e,t){var n=i.clipExtent&&i.clipExtent();return i.scale(150).translate([0,0]),n!=null&&i.clipExtent(null),Fp(t,i.stream(GD)),e(GD.result()),n!=null&&i.clipExtent(n),i}function qD(i,e,t){return VD(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 FX(i,e,t){return qD(i,[[0,0],e],t)}function OX(i,e,t){return VD(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 BX(i,e,t){return VD(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 UX=16,WAe=fn(30*mn);function HD(i,e){return+e?XAe(i,e):jAe(i)}function jAe(i){return K2({point:function(e,t){e=i(e,t),this.stream.point(e[0],e[1])}})}function XAe(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=vo(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<WAe)&&(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=ic([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],UX,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,UX,n),S.lineEnd=C,C()}return S}}var $Ae=K2({point:function(i,e){this.stream.point(i*mn,e*mn)}});function YAe(i){return K2({point:function(e,t){var n=i(e,t);return this.stream.point(n[0],n[1])}})}function ZAe(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 ZAe(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 WD(i){return KAe(function(){return i})()}function KAe(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=ID,S=null,T,P,R,C=kD,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]*Zi,j[1]*Zi]}V.stream=function(j){return B&&z===j?B:B=$Ae(YAe(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?SX(v=j*mn):(v=null,ID),J()):v*Zi},V.clipExtent=function(j){return arguments.length?(C=j==null?(S=T=P=R=null,kD):ND(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*Zi,o*Zi]},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*Zi,l*Zi,c*Zi]},V.angle=function(j){return arguments.length?(f=j%360*mn,Z()):f*Zi},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=HD(F,L=j*j),J()):vo(L)},V.fitExtent=function(j,K){return qD(V,j,K)},V.fitSize=function(j,K){return FX(V,j,K)},V.fitWidth=function(j,K){return OX(V,j,K)},V.fitHeight=function(j,K){return BX(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=CD(a,l,c),F=$2(e,K),N=$2(u,F),D=HD(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 GX(i){return function(e,t){var n=vo(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 Q2(i,e){return[i,Yj(Kj((eo+e)/2))]}Q2.invert=function(i,e){return[i,2*k_($j(e))-eo]};function jD(i,e){var t=fn(e),n=1+fn(i)*t;return[t*an(i)/n,an(e)/n]}jD.invert=GX(function(i){return 2*k_(i)});function XD(){return WD(jD).scale(250).clipAngle(142)}function ZD(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 QAe(i){if(Array.isArray(i))return i}function JAe(i){if(Array.isArray(i))return ZD(i)}function J2(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 eme(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function tme(i,e,t){return e=eE(e),hme(i,WX()?Reflect.construct(e,[],eE(i).constructor):e.apply(i,t))}function HX(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function nme(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function ti(i,e){return i.get(J2(i,e))}function Bp(i,e,t){HX(i,e),e.set(i,t)}function Up(i,e,t){return i.set(J2(i,e),t),t}function ime(i,e){HX(i,e),e.add(i)}function rme(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,XX(n.key),n)}}function sme(i,e,t){return e&&rme(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function H_(i,e,t){return(e=XX(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function eE(i){return eE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},eE(i)}function ome(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&&KD(i,e)}function WX(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(WX=function(){return!!i})()}function ame(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function lme(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 cme(){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 ume(){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 hme(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 eme(i)}function KD(i,e){return KD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},KD(i,e)}function J3(i,e){return QAe(i)||lme(i,e)||$X(i,e)||cme()}function jX(i){return JAe(i)||ame(i)||$X(i)||ume()}function fme(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 XX(i){var e=fme(i,"string");return typeof e=="symbol"?e:e+""}function $X(i,e){if(i){if(typeof i=="string")return ZD(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)?ZD(i,e):void 0}}var YX=function(e){e instanceof Array?e.forEach(YX):(e.map&&e.map.dispose(),e.dispose())},QD=function(e){e.geometry&&e.geometry.dispose(),e.material&&YX(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(QD)};function ZX(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 dme(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 rm(i){return i*Math.PI/180}var KX=function(e){return 1-(Q2(0,(.5-e)*Math.PI)[1]/Math.PI+1)/2},$D=function(e){return Math.max(0,Math.min(1,KX(e)))},zX=function(e){return .5-Q2.invert(0,(2*(1-e)-1)*Math.PI)[1]/Math.PI},pme=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([$D(t),$D(n)]).range([1,0]).clamp(!0),o=function(f){return s($D(r(f)))},a=e.array,l=0,c=a.length;l<c;l+=2)a[l+1]=o(a[l+1]);e.needsUpdate=!0},VX=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,KX(a))));var l=Math.floor(a*s);return[o,l]},JD=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:zX(w/l)*l;var R=w+1===l?w+1:zX((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},Ame=6,mme=7,gme=3,_me=90,uh=new WeakMap,kp=new WeakMap,YD=new WeakMap,K3=new WeakMap,rc=new WeakMap,tE=new WeakMap,W_=new WeakMap,sm=new WeakMap,Q3=new WeakSet,QX=(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 nme(this,e),n=tme(this,e),ime(n,Q3),Bp(n,uh,void 0),Bp(n,kp,void 0),Bp(n,YD,void 0),Bp(n,K3,void 0),Bp(n,rc,{}),Bp(n,tE,void 0),Bp(n,W_,void 0),Bp(n,sm,void 0),H_(n,"minLevel",void 0),H_(n,"maxLevel",void 0),H_(n,"thresholds",jX(new Array(30)).map(function(p,x){return 8/Math.pow(2,x)})),H_(n,"curvatureResolution",5),H_(n,"tileMargin",0),H_(n,"clearTiles",function(){Object.values(ti(rc,n)).forEach(function(p){p.forEach(function(x){x.obj&&(n.remove(x.obj),QD(x.obj),delete x.obj)})}),Up(rc,n,{})}),Up(uh,n,t),n.tileUrl=s,Up(kp,n,f),n.minLevel=a,n.maxLevel=c,n.level=0,n.add(Up(sm,n,new Gn(new Aa(ti(uh,n)*.99,180,90),new as({color:0})))),ti(sm,n).visible=!1,ti(sm,n).material.polygonOffset=!0,ti(sm,n).material.polygonOffsetUnits=3,ti(sm,n).material.polygonOffsetFactor=1,n}return ome(e,i),sme(e,[{key:"tileUrl",get:function(){return ti(YD,this)},set:function(n){Up(YD,this,n),this.updatePov(ti(W_,this))}},{key:"level",get:function(){return ti(K3,this)},set:function(n){var r,s=this;ti(rc,this)[n]||J2(Q3,this,xme).call(this,n);var o=ti(K3,this);if(Up(K3,this,n),!(n===o||o===void 0)){if(ti(sm,this).visible=n>0,ti(rc,this)[n].forEach(function(l){return l.obj&&(l.obj.material.depthWrite=!0)}),o<n&&((r=ti(rc,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(rc,this)[a]&&ti(rc,this)[a].forEach(function(l){l.obj&&(s.remove(l.obj),QD(l.obj),delete l.obj)});J2(Q3,this,qX).call(this)}}},{key:"updatePov",value:function(n){var r=this;if(!(!n||!(n instanceof Pf))){Up(W_,this,n);var s;if(Up(tE,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=J3(R,2),L=C[0],D=C[1];return ZX(L,D,ti(uh,r))}).map(function(R){var C=R.x,L=R.y,D=R.z;return new ie(C,L,D)})}return s||(s=new Kl,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(uh,this))/ti(uh,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)),J2(Q3,this,qX).call(this)}}}}])})(Xr);function xme(i){var e=this;if(i>mme){ti(rc,this)[i]=[];return}var t=ti(rc,this)[i]=JD(i,ti(kp,this));t.forEach(function(n){return n.centroid=ZX(n.lat,n.lng,ti(uh,e))}),t.octree=N2().x(function(n){return n.centroid.x}).y(function(n){return n.centroid.y}).z(function(n){return n.centroid.z}).addAll(t)}function qX(){var i=this;if(!(!this.tileUrl||this.level===void 0||!ti(rc,this).hasOwnProperty(this.level))&&!(!ti(tE,this)&&this.level>Ame)){var e=ti(rc,this)[this.level];if(ti(W_,this)){var t=this.worldToLocal(ti(W_,this).position.clone());if(e.octree){var n,r=this.worldToLocal(ti(W_,this).position.clone()),s=(r.length()-ti(uh,this))*gme;e=(n=e.octree).findAllWithinRadius.apply(n,jX(r).concat([s]))}else{var o=dme(t),a=(o.r/ti(uh,this)-1)*_me,l=a/Math.cos(rm(o.lat)),c=[o.lng-l,o.lng+l],u=[o.lat+a,o.lat-a],f=VX(this.level,ti(kp,this),c[0],u[0]),p=J3(f,2),x=p[0],v=p[1],w=VX(this.level,ti(kp,this),c[1],u[1]),S=J3(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=JD(this.level,ti(kp,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]=JD(this.level,ti(kp,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(tE,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=rm(V),ae=rm(-H),ce=new Gn(new Aa(ti(uh,i),Math.ceil(j/i.curvatureResolution),Math.ceil(K/i.curvatureResolution),rm(90-j/2)+ee,rm(j),rm(90-K/2)+ae,rm(K)),new ma);if(ti(kp,i)){var de=[H+Z/2,H-Z/2].map(function(Ue){return .5-Ue/180}),ve=J3(de,2),Ie=ve[0],Qe=ve[1];pme(ce.geometry.attributes.uv,Ie,Qe)}N.obj=ce}N.loading||(N.loading=!0,new Ql().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 iv=new Set,e6=!1;function a6(i,e,t=2){let n=e&&e.length,r=n?e[0]*t:i.length;iv.size&&iv.clear();let s=n$(i,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a=0,l=0,c=0;if(n&&(s=Sme(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 t6(s,o,a,l,c),o}function n$(i,e,t,n,r){let s=null;if(r===Bme(i,e,t,n)>0)for(let o=e;o<t;o+=n)s=t$(o/n|0,i[o],i[o+1],s);else for(let o=t-n;o>=e;o-=n)s=t$(o/n|0,i[o],i[o+1],s);return s&&rv(s,s.next)&&(ov(s),s=s.next),s}function am(i,e=i){let t=e===i,n=i,r;do r=!1,n!==n.next&&(iv.size===0||!iv.has(n))&&(rv(n,n.next)||Es(n.prev,n,n.next)===0)?((t||n===e)&&(e=n.prev),e6=!0,ov(n),n=n.prev,r=!0):(t||n!==e)&&(n=n.next,r=!t);while(r||n!==e);return e}function t6(i,e,t,n,r){r&&Ime(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?vme(i,t,n,r):yme(i))){e.push(a.i,i.i,l.i),ov(i),i=l,s=l;continue}if(i=l,i===s){if(e6=!1,i=am(i),e6){s=i;continue}if(!o){i=bme(i,e),s=i,o=!0;continue}wme(i,e,t,n,r);break}}}function yme(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)&&sE(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 vme(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=s6(x,v,e,t,n),P=s6(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)&&sE(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)&&sE(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 bme(i,e){let t=i,n=!1;do{let r=t.prev,s=t.next.next;s$(r,t,t.next,s,!1)&&sv(r,s)&&sv(s,r)&&(e.push(r.i,t.i,s.i),ov(t),ov(t.next),t=i=s,n=!0),t=t.next}while(t!==i);return n?am(t):t}function wme(i,e,t,n,r){let s=i;do{let o=s.next.next;for(;o!==s.prev;){if(s.i!==o.i&&Dme(s,o)){let a=o$(s,o);s=am(s,s.next),a=am(a,a.next),t6(s,e,t,n,r),t6(a,e,t,n,r);return}o=o.next}s=s.next}while(s!==i)}var n6=!1;function Sme(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=n$(i,a,l,n,!1);c===c.next&&iv.add(c),r.push(Lme(c))}r.sort(Tme),Mme(i.length/n,e.length),r$(t,t),n6=!0;for(let s=0;s<r.length;s++)t=Eme(r[s],t);return n6=!1,am(t)}function Tme(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 Eme(i,e){let t=Rme(i,e);if(!t)return e;let n=o$(t,i),r=n.next;return r$(t,r.next),am(n,n.next),am(t,t.next)}var i$=16,Qr=new Float64Array(0),rE=0,i6=[],r6=[];function Mme(i,e){let t=Math.ceil((i+2*e)/i$)+e+2;Qr.length<t*4&&(Qr=new Float64Array(t*4)),rE=0}function r$(i,e){let t=i;do{let n=rE++;i6[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<i$&&t!==e);r6[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 Cme(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 JX(i){let e=r6[i];for(;e.prev.next!==e;)e=e.next;return r6[i]=e,e}function e$(i){let e=i6[i];for(;e.prev.next!==e;)e=e.next;return i6[i]=e,e}function Rme(i,e){let t=e,n=i.x,r=i.y,s=-1/0,o;if(rv(i,t))return t;for(let p=0,x=0;p<rE;p++,x+=4){if(r<Qr[x+1]||r>Qr[x+3]||Qr[x]>n||Qr[x+2]<=s)continue;let v=JX(p);t=e$(p);do{if(t.prev.next===t){if(rv(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<rE;p++,x+=4){if(Qr[x+2]<a||Qr[x]>n||Qr[x+3]<c||Qr[x+1]>u)continue;let v=JX(p);t=e$(p);do{if(t.prev.next===t&&n>=t.x&&t.x>=a&&n!==t.x&&sE(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);(sv(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&&Pme(o,t)))&&(o=t,f=w)}t=t.next}while(t!==v)}return o}function Pme(i,e){return Es(i.prev,i,e.prev)<0&&Es(e.next,i,i.next)<0}var sc=[],ev=[],om=new Uint32Array(0),tv=new Uint32Array(0),nv=new Uint32Array(256);function Ime(i,e,t,n){let r=i,s=0;do r.z=s6(r.x,r.y,e,t,n),sc[s++]=r,r=r.next;while(r!==i);Nme(s);let o=null;for(let a=0;a<s;a++){let l=sc[a];l.prevZ=o,o&&(o.nextZ=l),o=l}o.nextZ=null}function Nme(i){if(i<=32){for(let e=1;e<i;e++){let t=sc[e],n=t.z,r=e-1;for(;r>=0&&sc[r].z>n;)sc[r+1]=sc[r],r--;sc[r+1]=t}return}om.length<i&&(om=new Uint32Array(i),tv=new Uint32Array(i),ev=new Array(i));for(let e=0;e<i;e++)om[e]=sc[e].z;nE(i,sc,om,ev,tv,0),nE(i,ev,tv,sc,om,8),nE(i,sc,om,ev,tv,16),nE(i,ev,tv,sc,om,24)}function nE(i,e,t,n,r,s){nv.fill(0);for(let a=0;a<i;a++)nv[t[a]>>>s&255]++;let o=0;for(let a=0;a<256;a++){let l=nv[a];nv[a]=o,o+=l}for(let a=0;a<i;a++){let l=t[a],c=nv[l>>>s&255]++;n[c]=e[a],r[c]=l}}function s6(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 Lme(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 sE(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 Dme(i,e){let t=rv(i,e)&&Es(i.prev,i,i.next)>0&&Es(e.prev,e,e.next)>0;return i.next.i!==e.i&&(t||sv(i,e)&&sv(e,i)&&(Es(i.prev,i,e.prev)!==0||Es(i,e.prev,e)!==0))&&!Fme(i,e)&&(t||Ome(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 rv(i,e){return i.x===e.x&&i.y===e.y}function s$(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&&iE(i,t,e)||o===0&&iE(i,n,e)||a===0&&iE(t,i,n)||l===0&&iE(t,e,n)):!1}function iE(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 Fme(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&&s$(o,a,i,e))return!0;o=a}while(o!==i);return!1}function sv(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 Ome(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 o$(i,e){let t=o6(i.i,i.x,i.y),n=o6(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 t$(i,e,t,n){let r=o6(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 ov(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),n6&&Cme(i.prev,i.next)}function o6(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function Bme(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 j_(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 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 Ume(i){if(Array.isArray(i))return i}function kme(i){if(Array.isArray(i))return c6(i)}function Gme(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function zme(i,e,t){return e=oE(e),Zme(i,c$()?Reflect.construct(e,[],oE(i).constructor):e.apply(i,t))}function Vme(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function qme(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function Hme(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=f6(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 oE(i){return oE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},oE(i)}function Wme(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 c$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(c$=function(){return!!i})()}function jme(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function Xme(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 $me(){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 Yme(){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 Zme(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 Gme(i)}function u6(i,e){return u6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},u6(i,e)}function av(i,e){return Ume(i)||Xme(i,e)||f6(i,e)||$me()}function Kme(i){return kme(i)||jme(i)||f6(i)||Yme()}function f6(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(){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=im(r,s),l=r.length>2||s.length>2?ah(r[2]||0,s[2]||0):null,c=l?function(p){return[].concat(Kme(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},h6=typeof window<"u"&&window.THREE?window.THREE:{BufferGeometry:Wn,Float32BufferAttribute:In},Qme=new h6.BufferGeometry().setAttribute?"setAttribute":"addAttribute",d6=(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;Vme(this,e),n=zme(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;lv({indices:a,vertices:l},S),n.addGroup(T,a.length-T,c++)}),a.length&&n.setIndex(a),l.length&&n[Qme]("position",new h6.Float32BufferAttribute(l,3));function u(S,T){var P=l6(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=av(R,1),L=C[0];lv(P,L)}),[P]}function p(S,T){for(var P=a$(S,s).map(function(N){var B=av(N,3),z=B[0],V=B[1],H=B[2],Z=H===void 0?0:H;return l6(V,z,T+Z)}),R=j_([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=av(R,1),L=C[0];lv(P,L)}),[P]}function v(S,T){for(var P=S.map(function(j){return a$(j,s).map(function(K){var ee=av(K,3),ae=ee[0],ce=ee[1],de=ee[2],ve=de===void 0?0:de;return l6(ce,ae,T+ve)})}),R=j_(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=av(L,2),F=D[0],N=D[1];lv(P,F),N&&lv(R,N)});var C=[P];return R.vertices.length&&C.push(R),C}return n}return Wme(e,i),qme(e)})(h6.BufferGeometry);function lv(i,e){var t=Math.round(i.vertices.length/3);l$(i.vertices,e.vertices),l$(i.indices,e.indices.map(function(n){return n+t}))}function l$(i,e){var t=Hme(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 l6(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 cv={};Nse(cv,{computeMikkTSpaceTangents:()=>Jme,computeMorphedAttributes:()=>age,deepCloneAttribute:()=>tge,deinterleaveAttribute:()=>aE,deinterleaveGeometry:()=>ige,estimateBytesUsed:()=>rge,interleaveAttributes:()=>nge,mergeAttributes:()=>p6,mergeGeometries:()=>ege,mergeGroups:()=>lge,mergeVertices:()=>sge,toCreasedNormals:()=>cge,toTrianglesDrawMode:()=>oge});function Jme(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 Ni(s,4)),i!==r&&i.copy(r),i}function ege(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 Wn,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=p6(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=p6(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 p6(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 Ni(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 tge(i){return i.isInstancedInterleavedBufferAttribute||i.isInterleavedBufferAttribute?aE(i):i.isInstancedBufferAttribute?new ml().copy(i):new Ni().copy(i)}function nge(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 Cf(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 go(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 aE(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 Ni(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 ige(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,aE(s)),e[r]=n.get(s))}for(let r in t){let s=t[r];s.isInterleavedBufferAttribute&&(n.has(s)||n.set(s,aE(s)),t[r]=n.get(s))}}function rge(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 sge(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 oge(i,e){if(e===JN)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),i;if(e===$T||e===eL){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===$T)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 age(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 In(j,3),ae=new In(K,3);return{positionAttribute:T,normalAttribute:C,morphedPositionAttribute:ee,morphedNormalAttribute:ae}}function lge(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 cge(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 Ni(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 lE(i){"@babel/helpers - typeof";return lE=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},lE(i)}var uge=/^\s+/,hge=/\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=fge(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=m$(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=h$(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=h$(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=u$(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=u$(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 f$(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return mge(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:Cge[f$(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var t="#"+d$(this._r,this._g,this._b,this._a),n=t,r=this._gradientType?"GradientType = 1, ":"";if(e){var s=dn(e);n="#"+d$(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(yge,arguments)},brighten:function(){return this._applyModification(vge,arguments)},darken:function(){return this._applyModification(bge,arguments)},desaturate:function(){return this._applyModification(gge,arguments)},saturate:function(){return this._applyModification(_ge,arguments)},greyscale:function(){return this._applyModification(xge,arguments)},spin:function(){return this._applyModification(wge,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(Ege,arguments)},complement:function(){return this._applyCombination(Sge,arguments)},monochromatic:function(){return this._applyCombination(Mge,arguments)},splitcomplement:function(){return this._applyCombination(Tge,arguments)},triad:function(){return this._applyCombination(p$,[3])},tetrad:function(){return this._applyCombination(p$,[4])}};dn.fromRatio=function(i,e){if(lE(i)=="object"){var t={};for(var n in i)i.hasOwnProperty(n)&&(n==="a"?t[n]=i[n]:t[n]=uv(i[n]));i=t}return dn(i,e)};function fge(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=Nge(i)),lE(i)=="object"&&(Gf(i.r)&&Gf(i.g)&&Gf(i.b)?(e=dge(i.r,i.g,i.b),o=!0,a=String(i.r).substr(-1)==="%"?"prgb":"rgb"):Gf(i.h)&&Gf(i.s)&&Gf(i.v)?(n=uv(i.s),r=uv(i.v),e=Age(i.h,n,r),o=!0,a="hsv"):Gf(i.h)&&Gf(i.s)&&Gf(i.l)&&(n=uv(i.s),s=uv(i.l),e=pge(i.h,n,s),o=!0,a="hsl"),i.hasOwnProperty("a")&&(t=i.a)),t=m$(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 dge(i,e,t){return{r:br(i,255)*255,g:br(e,255)*255,b:br(t,255)*255}}function u$(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 pge(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 h$(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 Age(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 f$(i,e,t,n){var r=[Kc(Math.round(i).toString(16)),Kc(Math.round(e).toString(16)),Kc(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 mge(i,e,t,n,r){var s=[Kc(Math.round(i).toString(16)),Kc(Math.round(e).toString(16)),Kc(Math.round(t).toString(16)),Kc(g$(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 d$(i,e,t,n){var r=[Kc(g$(n)),Kc(Math.round(i).toString(16)),Kc(Math.round(e).toString(16)),Kc(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 gge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.s-=e/100,t.s=cE(t.s),dn(t)}function _ge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.s+=e/100,t.s=cE(t.s),dn(t)}function xge(i){return dn(i).desaturate(100)}function yge(i,e){e=e===0?0:e||10;var t=dn(i).toHsl();return t.l+=e/100,t.l=cE(t.l),dn(t)}function vge(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=cE(t.l),dn(t)}function wge(i,e){var t=dn(i).toHsl(),n=(t.h+e)%360;return t.h=n<0?360+n:n,dn(t)}function Sge(i){var e=dn(i).toHsl();return e.h=(e.h+180)%360,dn(e)}function p$(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 Tge(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 Ege(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 Mge(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=Lge(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 A6=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"},Cge=dn.hexNames=Rge(A6);function Rge(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function m$(i){return i=parseFloat(i),(isNaN(i)||i<0||i>1)&&(i=1),i}function br(i,e){Pge(i)&&(i="100%");var t=Ige(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 cE(i){return Math.min(1,Math.max(0,i))}function bl(i){return parseInt(i,16)}function Pge(i){return typeof i=="string"&&i.indexOf(".")!=-1&&parseFloat(i)===1}function Ige(i){return typeof i=="string"&&i.indexOf("%")!=-1}function Kc(i){return i.length==1?"0"+i:""+i}function uv(i){return i<=1&&(i=i*100+"%"),i}function g$(i){return Math.round(parseFloat(i)*255).toString(16)}function A$(i){return bl(i)/255}var Zc=(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 Gf(i){return!!Zc.CSS_UNIT.exec(i)}function Nge(i){i=i.replace(uge,"").replace(hge,"").toLowerCase();var e=!1;if(A6[i])i=A6[i],e=!0;else if(i=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Zc.rgb.exec(i))?{r:t[1],g:t[2],b:t[3]}:(t=Zc.rgba.exec(i))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Zc.hsl.exec(i))?{h:t[1],s:t[2],l:t[3]}:(t=Zc.hsla.exec(i))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Zc.hsv.exec(i))?{h:t[1],s:t[2],v:t[3]}:(t=Zc.hsva.exec(i))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Zc.hex8.exec(i))?{r:bl(t[1]),g:bl(t[2]),b:bl(t[3]),a:A$(t[4]),format:e?"name":"hex8"}:(t=Zc.hex6.exec(i))?{r:bl(t[1]),g:bl(t[2]),b:bl(t[3]),format:e?"name":"hex"}:(t=Zc.hex4.exec(i))?{r:bl(t[1]+""+t[1]),g:bl(t[2]+""+t[2]),b:bl(t[3]+""+t[3]),a:A$(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Zc.hex3.exec(i))?{r:bl(t[1]+""+t[1]),g:bl(t[2]+""+t[2]),b:bl(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function Lge(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 x6(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 Dge(i){if(Array.isArray(i))return i}function Fge(i){if(Array.isArray(i))return x6(i)}function _$(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 Oge(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Bge(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function jo(i,e){return i.get(_$(i,e))}function X_(i,e,t){Oge(i,e),e.set(i,t)}function uE(i,e,t){return i.set(_$(i,e),t),t}function Uge(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,Xge(n.key),n)}}function kge(i,e,t){return e&&Uge(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function Gge(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function zge(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 Vge(){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 qge(){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 Hge(i,e){return Dge(i)||zge(i,e)||x$(i,e)||Vge()}function Wge(i){return Fge(i)||Gge(i)||x$(i)||qge()}function jge(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 Xge(i){var e=jge(i,"string");return typeof e=="symbol"?e:e+""}function x$(i,e){if(i){if(typeof i=="string")return x6(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)?x6(i,e):void 0}}var $_=new WeakMap,hv=new WeakMap,Y_=new WeakMap,m6=new WeakMap,g6=new WeakMap,_6=new WeakMap,y$=(function(){function i(){Bge(this,i),X_(this,$_,new Map),X_(this,hv,new Map),X_(this,Y_,function(e){return e}),X_(this,m6,function(){return{}}),X_(this,g6,function(){}),X_(this,_6,function(){})}return kge(i,[{key:"getObj",value:function(t){return jo($_,this).get(jo(Y_,this).call(this,t))}},{key:"getData",value:function(t){return jo(hv,this).get(t)}},{key:"entries",value:function(){return Wge(jo(hv,this).entries()).map(function(t){var n=Hge(t,2),r=n[0],s=n[1];return[s,r]})}},{key:"id",value:function(t){return uE(Y_,this,rt(t)),this}},{key:"onCreateObj",value:function(t){return uE(m6,this,t),this}},{key:"onUpdateObj",value:function(t){return uE(g6,this,t),this}},{key:"onRemoveObj",value:function(t){return uE(_6,this,t),this}},{key:"digest",value:function(t){var n=this;t.filter(function(s){return!jo($_,n).has(jo(Y_,n).call(n,s))}).forEach(function(s){var o=jo(m6,n).call(n,s);jo($_,n).set(jo(Y_,n).call(n,s),o),jo(hv,n).set(o,s)});var r=new Map(t.map(function(s){return[jo(Y_,n).call(n,s),s]}));return jo($_,this).forEach(function(s,o){r.has(o)?jo(g6,n).call(n,s,r.get(o)):(jo(_6,n).call(n,s,o),jo($_,n).delete(o),jo(hv,n).delete(s))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])})();var jm=Dse(v$(),1);var yi=11102230246251565e-32,Ms=134217729,dv=(3+8*yi)*yi;function lm(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 pv(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 $ge=(3+16*yi)*yi,Yge=(2+12*yi)*yi,Zge=(9+64*yi)*yi*yi,Z_=ut(4),b$=ut(8),w$=ut(12),S$=ut(16),ba=ut(4);function Kge(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,Z_[0]=L-(T+f)+(f-F),P=C+T,f=P-C,R=C-(P-f)+(T-f),T=R-D,f=R-T,Z_[1]=R-(T+f)+(f-D),N=P+T,f=N-P,Z_[2]=P-(N-f)+(T-f),Z_[3]=N;let Z=pv(4,Z_),J=Yge*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=Zge*o+dv*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=lm(4,Z_,4,ba,b$);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=lm(j,b$,4,ba,w$);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=lm(K,w$,4,ba,S$);return S$[ee-1]}function Gp(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)>=$ge*c?l:-Kge(i,e,t,n,r,s,c)}var oZe=(7+56*yi)*yi,aZe=(3+28*yi)*yi,lZe=(26+288*yi)*yi*yi,cZe=ut(4),uZe=ut(4),hZe=ut(4),fZe=ut(4),dZe=ut(4),pZe=ut(4),AZe=ut(4),mZe=ut(4),gZe=ut(4),_Ze=ut(8),xZe=ut(8),yZe=ut(8),vZe=ut(4),bZe=ut(8),wZe=ut(8),SZe=ut(16),TZe=ut(12),EZe=ut(192),MZe=ut(192);var PZe=(10+96*yi)*yi,IZe=(4+48*yi)*yi,NZe=(44+576*yi)*yi*yi,LZe=ut(4),DZe=ut(4),FZe=ut(4),OZe=ut(4),BZe=ut(4),UZe=ut(4),kZe=ut(4),GZe=ut(4),zZe=ut(8),VZe=ut(8),qZe=ut(8),HZe=ut(8),WZe=ut(8),jZe=ut(8),XZe=ut(8),$Ze=ut(8),YZe=ut(8),ZZe=ut(4),KZe=ut(4),QZe=ut(4),JZe=ut(8),eKe=ut(16),tKe=ut(16),nKe=ut(16),iKe=ut(32),rKe=ut(32),sKe=ut(48),oKe=ut(64),aKe=ut(1152),lKe=ut(1152);var fKe=(16+224*yi)*yi,dKe=(5+72*yi)*yi,pKe=(71+1408*yi)*yi*yi,AKe=ut(4),mKe=ut(4),gKe=ut(4),_Ke=ut(4),xKe=ut(4),yKe=ut(4),vKe=ut(4),bKe=ut(4),wKe=ut(4),SKe=ut(4),TKe=ut(24),EKe=ut(24),MKe=ut(24),CKe=ut(24),RKe=ut(24),PKe=ut(24),IKe=ut(24),NKe=ut(24),LKe=ut(24),DKe=ut(24),FKe=ut(1152),OKe=ut(1152),BKe=ut(1152),UKe=ut(1152),kKe=ut(1152),GKe=ut(2304),zKe=ut(2304),VKe=ut(3456),qKe=ut(5760),HKe=ut(8),WKe=ut(8),jKe=ut(8),XKe=ut(16),$Ke=ut(24),YKe=ut(48),ZKe=ut(48),KKe=ut(96),QKe=ut(192),JKe=ut(384),eQe=ut(384),tQe=ut(384),nQe=ut(768);var iQe=ut(96),rQe=ut(96),sQe=ut(96),oQe=ut(1152);var E$=Math.pow(2,-52),hE=new Uint32Array(512),zp=class i{static from(e,t=i_e,n=r_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=v6(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=v6(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=t_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];K_(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(Gp(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=n_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]=v6(e[2*B],e[2*B+1],F.x,F.y);K_(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)<=E$&&Math.abs(J-V)<=E$||(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],Gp(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],Gp(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],Gp(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(Jge(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=hE[--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(e_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<hE.length&&(hE[s++]=P)}else{if(s===0)break;e=hE[--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 Jge(i,e){let t=i/(Math.abs(i)+Math.abs(e));return(e>0?3-t:1+t)/4}function v6(i,e,t,n){let r=i-t,s=e-n;return r*r+s*s}function e_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 t_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 n_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 K_(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;Av(i,r,s),e[i[t]]>e[i[n]]&&Av(i,t,n),e[i[s]]>e[i[n]]&&Av(i,s,n),e[i[t]]>e[i[s]]&&Av(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;Av(i,s,o)}i[t+1]=i[o],i[o]=a,n-s+1>=o-t?(K_(i,e,s,n),K_(i,e,t,o-1)):(K_(i,e,t,o-1),K_(i,e,s,n))}}function Av(i,e,t){let n=i[e];i[e]=i[t],i[t]=n}function i_e(i){return i[0]}function r_e(i){return i[1]}function M$(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=Gp(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 C$(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 R$(i){return i.type==="Feature"?i.geometry:i}function s_e(i,e,t={}){if(!i)throw new Error("point is required");if(!e)throw new Error("polygon is required");let n=C$(i),r=R$(e),s=r.type,o=e.bbox,a=r.coordinates;if(o&&o_e(n,o)===!1)return!1;s==="Polygon"&&(a=[a]);let l=!1;for(var c=0;c<a.length;++c){let u=M$(n,a[c]);if(u===0)return!t.ignoreBoundary;u&&(l=!0)}return l}function o_e(i,e){return e[0]<=i[0]&&e[1]<=i[1]&&e[2]>=i[0]&&e[3]>=i[1]}var P$=s_e;var oc=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 Vp=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 mv=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 oc: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 oc: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 oc: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 Vp;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 a_e=2*Math.PI,Q_=Math.pow;function l_e(i){return i[0]}function c_e(i){return i[1]}function u_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 h_e(i,e,t){return[i+Math.sin(i+e)*t,e+Math.cos(i-e)*t]}var J_=class i{static from(e,t=l_e,n=c_e,r){return new i("length"in e?f_e(e,t,n,r):Float64Array.from(d_e(e,t,n,r)))}constructor(e){this._delaunator=new zp(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&&u_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=h_e(t[2*p],t[2*p+1],f);t[2*p]=v[0],t[2*p+1]=v[1]}this._delaunator=new zp(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 mv(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=Q_(t-c[e*2],2)+Q_(n-c[e*2+1],2),p=r[e],x=p;do{let v=l[x],w=Q_(t-c[v*2],2)+Q_(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&&Q_(t-c[x*2],2)+Q_(n-c[x*2+1],2)<f)return x;break}}while(x!==p);return u}render(e){let t=e==null?e=new oc: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 oc: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,a_e)}return n&&n.value()}renderHull(e){let t=e==null?e=new oc: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 Vp;return this.renderHull(e),e.value()}renderTriangle(e,t){let n=t==null?t=new oc: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 Vp;return this.renderTriangle(e,t),t.value()}};function f_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*d_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 gv=Math.PI,I$=gv/2,GQe=gv/4,zQe=gv*2,b6=180/gv,w6=gv/180;var S6=Math.atan2,fE=Math.cos;var N$=Math.max,L$=Math.min;var dE=Math.sin,D$=Math.sign||function(i){return i>0?1:i<0?-1:0},pE=Math.sqrt;function T6(i){return i>1?I$:i<-1?-I$:Math.asin(i)}function E6(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 _v(i,e){return[i[0]+e[0],i[1]+e[1],i[2]+e[2]]}function xv(i){var e=pE(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]);return[i[0]/e,i[1]/e,i[2]/e]}function M6(i){return[S6(i[1],i[0])*b6,T6(N$(-1,L$(1,i[2])))*b6]}function hh(i){let e=i[0]*w6,t=i[1]*w6,n=fE(t);return[n*fE(e),n*dE(e),dE(t)]}function AE(i){return i=i.map(e=>hh(e)),E6(i[0],Ka(i[2],i[1]))}function O$(i){let e=A_e(i),t=g_e(e),n=m_e(t,i),r=x_e(t,i.length),s=p_e(r,i),o=__e(t,i),{polygons:a,centers:l}=y_e(o,t,i),c=v_e(a),u=w_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 p_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=hh([r,s]);do a=o,o=null,l=t(u,hh(e[a])),i[a].forEach(f=>{let p=t(u,hh(e[f]));if(p<l){l=p,o=f,c=f;return}});while(o!==null);return c}}function A_e(i){if(i.length<2)return{};let e=0;for(;isNaN(i[e][0]+i[e][1])&&e++<i.length;);let t=RD(i[e]),n=XD().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*pE(s);r.forEach(p=>i[p]=[o,0]),i.push([0,o]),i.push([-o,0]),i.push([0,-o]);let a=J_.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 m_e(i,e){let t=new Set;return e.length===2?[[0,1]]:(i.forEach(n=>{if(n[0]!==n[1]&&!(AE(n.map(r=>e[r]))<0))for(let r=0,s;r<3;r++)s=(r+1)%3,t.add(Lp([n[r],n[s]]).join("-"))}),Array.from(t,n=>n.split("-").map(Number)))}function g_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 __e(i,e){return i.map(t=>{let n=t.map(s=>e[s]).map(hh),r=_v(_v(Ka(n[1],n[0]),Ka(n[2],n[1])),Ka(n[0],n[2]));return M6(xv(r))})}function x_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 y_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=hh(t[0]),l=hh(t[1]),c=xv(_v(a,l)),u=xv(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(M6).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=F$(t[a[0][3][0]],t[a[0][3][1]],r[l[0]]),f=F$(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 F$(i,e,t){i=hh(i),e=hh(e),t=hh(t);let n=D$(E6(Ka(e,i),t));return M6(xv(_v(i,e)).map(r=>n*r))}function v_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=Lp([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 w_e(i,e){let t=new Set,n=[];i.map(a=>{if(!(AE(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 C6(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=O$(e.points)}return e};return e._vx=function(t){if(typeof t=="object"&&"type"in t)return k3(t)[0];if(0 in t)return t[0]},e._vy=function(t){if(typeof t=="object"&&"type"in t)return k3(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=>AE(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 P6(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 S_e(i){if(Array.isArray(i))return i}function T_e(i){if(Array.isArray(i))return P6(i)}function E_e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function M_e(i,e,t){return e=gE(e),F_e(i,U$()?Reflect.construct(e,[],gE(i).constructor):e.apply(i,t))}function C_e(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function R_e(i,e,t){return Object.defineProperty(i,"prototype",{writable:!1}),i}function gE(i){return gE=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},gE(i)}function P_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&&I6(i,e)}function U$(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(U$=function(){return!!i})()}function I_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 L_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 D_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 F_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 E_e(i)}function I6(i,e){return I6=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},I6(i,e)}function fh(i,e){return S_e(i)||N_e(i,e)||k$(i,e)||L_e()}function R6(i){return T_e(i)||I_e(i)||k$(i)||D_e()}function k$(i,e){if(i){if(typeof i=="string")return P6(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)?P6(i,e):void 0}}function O_e(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=e.resolution,n=t===void 0?1/0:t,r=B_e(i,n),s=sh(r),o=U_e(i,n),a=[].concat(R6(s),R6(o)),l={type:"Polygon",coordinates:i},c=I3(l),u=fh(c,2),f=fh(u[0],2),p=f[0],x=f[1],v=fh(u[1],2),w=v[0],S=v[1],T=p>w||S>=89||x<=-89,P=[];if(T){var R=C6(a).triangles(),C=new Map(a.map(function(ee,ae){var ce=fh(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=fh(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(!N6(ve,l,T))return}(ae=P).push.apply(ae,de)}})}else if(o.length)for(var B=zp.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 d3(ve,function(Ue){return Ue[Qe]})});if(!N6(Ie,l,T))return 1}(ce=P).push.apply(ce,R6(de))},V=0,H=B.triangles.length;V<H;V+=3)z(V);else{var L=j_(r),D=L.vertices,F=L.holes,N=F===void 0?[]:F;P=a6(D,N,2)}var Z=$a(Lp(a,function(ee){return ee[0]}),[0,1]),J=$a(Lp(a,function(ee){return ee[1]}),[0,1]),j=a.map(function(ee){var ae=fh(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 B_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=im(r,s),l=1/Math.ceil(o/e),c=l;c<1;)n.push(a(c)),c+=l}n.push(r=s)}),n})}function U_e(i,e){var t={type:"Polygon",coordinates:i},n=I3(t),r=fh(n,2),s=fh(r[0],2),o=s[0],a=s[1],l=fh(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 k_e(e,{minLng:o,maxLng:c,minLat:a,maxLat:u}).filter(function(p){return N6(p,t,f)})}function k_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 N6(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return t?OD(e,i):P$(i,e)}var mE=window.THREE?window.THREE:{BufferGeometry:Wn,Float32BufferAttribute:In},B$=new mE.BufferGeometry().setAttribute?"setAttribute":"addAttribute",_E=(function(i){function e(t,n,r,s,o,a,l){var c;C_e(this,e),c=M_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=O_e(t,{resolution:l}),f=u.contour,p=u.triangles,x=sh(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[B$]("position",new mE.Float32BufferAttribute(v,3)),c[B$]("uv",new mE.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=fh(V,2),Z=H[0],J=H[1];return G_e(J,Z,N(Z,J))})});return j_(B)}function C(){for(var D=R(f,n),F=D.vertices,N=D.holes,B=R(f,r),z=B.vertices,V=sh([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 P_e(e,i),R_e(e)})(mE.BufferGeometry);function G_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 L6(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 z_e(i){if(Array.isArray(i))return i}function V_e(i){if(Array.isArray(i))return L6(i)}function q_e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function H_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 W_e(){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 j_e(){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 X_e(i,e){if(i==null)return{};var t,n,r=$_e(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 $_e(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 Y_e(i,e){return z_e(i)||H_e(i,e)||G$(i,e)||W_e()}function Z_e(i){return V_e(i)||q_e(i)||G$(i)||j_e()}function K_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 Q_e(i){var e=K_e(i,"string");return typeof e=="symbol"?e:e+""}function G$(i,e){if(i){if(typeof i=="string")return L6(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)?L6(i,e):void 0}}var z$=(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=X_e(S,[x].map(Q_e));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=Y_e(u,2),p=f[0],x=f[1];return a(x,[].concat(Z_e(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 bi=wt(nt);if(bi){It(bi.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:E0("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:E0("invalid type for getValue: "+nt)}return null}var S=!1;function T(Ne,nt){Ne||E0("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 ji={string:function(Qn){var Ii=0;if(Qn!=null&&Qn!==0){var Vb=(Qn.length<<2)+1;Ii=jk(Vb),B(Qn,Ii,Vb)}return Ii},array:function(Qn){var Ii=jk(Qn.length);return V(Qn,Ii),Ii}};function bi(Qn){return nt==="string"?F(Qn):nt==="boolean"?!!Qn:Qn}var ne=P(Ne),Xi=[],Da=0;if(He)for(var Ws=0;Ws<He.length;Ws++){var Ns=ji[It[Ws]];Ns?(Da===0&&(Da=zie()),Xi[Ws]=Ns(He[Ws])):Xi[Ws]=He[Ws]}var is=ne.apply(null,Xi);return is=bi(is),Da!==0&&Gie(Da),is}function C(Ne,nt,It,He){It=It||[];var h=It.every(function(bi){return bi==="number"}),ji=nt!=="string";return ji&&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 ji="";nt<h;){var bi=Ne[nt++];if(!(bi&128)){ji+=String.fromCharCode(bi);continue}var ne=Ne[nt++]&63;if((bi&224)==192){ji+=String.fromCharCode((bi&31)<<6|ne);continue}var Xi=Ne[nt++]&63;if((bi&240)==224?bi=(bi&15)<<12|ne<<6|Xi:bi=(bi&7)<<18|ne<<12|Xi<<6|Ne[nt++]&63,bi<65536)ji+=String.fromCharCode(bi);else{var Da=bi-65536;ji+=String.fromCharCode(55296|Da>>10,56320|Da&1023)}}return ji}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,ji=It+He-1,bi=0;bi<Ne.length;++bi){var ne=Ne.charCodeAt(bi);if(ne>=55296&&ne<=57343){var Xi=Ne.charCodeAt(++bi);ne=65536+((ne&1023)<<10)|Xi&1023}if(ne<=127){if(It>=ji)break;nt[It++]=ne}else if(ne<=2047){if(It+1>=ji)break;nt[It++]=192|ne>>6,nt[It++]=128|ne&63}else if(ne<=65535){if(It+2>=ji)break;nt[It++]=224|ne>>12,nt[It++]=128|ne>>6&63,nt[It++]=128|ne&63}else{if(It+3>=ji)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){E0("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){E0("OOM")}function Rn(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,ji=Math.max(nt,h);ji<Ne;)ji<=536870912?ji=H(2*ji,It):ji=Math.min(H((3*ji+2147483648)/4,It),He);var bi=Rn(ji);return!!bi}var bt=typeof atob=="function"?atob:function(Ne){var nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",It="",He,h,ji,bi,ne,Xi,Da,Ws=0;Ne=Ne.replace(/[^A-Za-z0-9\+\/\=]/g,"");do bi=nt.indexOf(Ne.charAt(Ws++)),ne=nt.indexOf(Ne.charAt(Ws++)),Xi=nt.indexOf(Ne.charAt(Ws++)),Da=nt.indexOf(Ne.charAt(Ws++)),He=bi<<2|ne>>4,h=(ne&15)<<4|Xi>>2,ji=(Xi&3)<<6|Da,It=It+String.fromCharCode(He),Xi!==64&&(It=It+String.fromCharCode(h)),Da!==64&&(It=It+String.fromCharCode(ji));while(Ws<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:E0,b:f,c:p,d:en,e:cn,f:Pt,g:Mt,h:xe,i:yn,j:St,k:qe,l:Rn,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),ji=new Ne.Uint8Array(It),bi=new Ne.Float32Array(It),ne=new Ne.Float64Array(It),Xi=nt.o|0,Da=nt.p|0,Ws=Ne.Math.floor,Ns=Ne.Math.abs,is=Ne.Math.sqrt,Qn=Ne.Math.cos,Ii=Ne.Math.sin,Vb=Ne.Math.tan,Vie=Ne.Math.acos,tx=Ne.Math.asin,Zk=Ne.Math.atan,ia=Ne.Math.atan2,Km=Ne.Math.ceil,Fa=Ne.Math.imul,l4=Ne.Math.min,qie=Ne.Math.max,Xh=Ne.Math.clz32,Hie=nt.a,Dn=nt.b,Q=nt.c,li=nt.d,Kk=nt.e,Wie=nt.f,jie=nt.g,Xie=nt.h,$ie=nt.i,Y=28416;function Yie(d){return He=new Int8Array(d),ji=new Uint8Array(d),h=new Int32Array(d),bi=new Float32Array(d),ne=new Float64Array(d),It=d,!0}function Zie(d){d=d|0;var A=0;return A=Y,Y=Y+d|0,Y=Y+15&-16,A|0}function Kie(){return Y|0}function Qie(d){d=d|0,Y=d}function Jie(d,A){d=d|0,A=A|0,Y=d}function ere(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=jb(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 Qk(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,Jk(d,A,m,_,0)|0}function Jk(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,!(e9(d,A,m,_,g)|0))return _=0,Y=M,_|0;do if((m|0)>=0){if((m|0)>13780509){if(y=jb(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(ad(_|0,0,b<<3|0)|0,g|0){ad(g|0,0,b<<2|0)|0,y=du(d,A,m,_,g,b,E,0)|0;break}y=ra(b,4)|0,y?(I=du(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 e9(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),Ui(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,Ui(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,Ui(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,Ui(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,Ui(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 du(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=$h(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=od(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=du(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=du(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=du(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=du(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=du(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=du(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($=(Ul(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=M0($|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(r9(E,h[7696+(O*28|0)>>2]|0)|0){d=y4(d,A)|0,b=1,A=Q()|0;break}else li(27634,26928,533,26936);switch(M|0){case 3:{d=M0(d,A)|0,A=Q()|0,h[_>>2]=(h[_>>2]|0)+1,b=0;break t}case 5:{d=y4(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=x4(d,A)|0,A=Q()|0,y=y+1|0;while((y|0)!=(m|0))}if((O|0)!=(E|0)){if(!(c4(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=M0(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 tre(d,A,m,_){return d=d|0,A=A|0,m=m|0,_=_|0,t9(d,A,m,_)|0?(ad(_|0,0,m*48|0)|0,_=nre(d,A,m,_)|0,_|0):(_=0,_|0)}function t9(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(Ui(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,Ui(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,!(Ui(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,Ui(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 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,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=jb(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=du(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 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;for(E=Y,Y=Y+16|0,y=E,b=E+8|0,g=(Ui(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 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;if(E=Y,Y=Y+48|0,g=E+16|0,y=E+8|0,b=E,m=cx(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,b9(y,g),m=l9(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 n9(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,mi=0,ao=0,Un=0,gi=0,sa=0;if(mi=Y,Y=Y+64|0,Ot=mi+48|0,at=mi+32|0,dt=mi+24|0,Fe=mi+8|0,Ze=mi,M=h[d>>2]|0,(M|0)<=0)return ci=0,Y=mi,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=_re(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,gi=+(M>>>0)+4294967296*+(Q()|0),ao=+(_e>>>0)+4294967296*+(re|0),ne[Fe>>3]=Un*(sa*gi)+Un*(+ne[at>>3]*ao),ne[We>>3]=Un*(+ne[ye>>3]*gi)+Un*(+ne[At>>3]*ao),M=v4(Fe,_,Ze)|0,M|0){E=M;break}ue=Ze,oe=h[ue>>2]|0,ue=h[ue+4>>2]|0,q=$h(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=od(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=mi,E|0):0}function rre(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,mi=0,ao=0,Un=0,gi=0;if(gi=Y,Y=Y+112|0,ci=gi+80|0,M=gi+72|0,mi=gi,ao=gi+56|0,g=cx(m)|0,g|0)return Un=g,Y=gi,Un|0;if(I=d+8|0,Un=lr((h[I>>2]<<5)+32|0)|0,!Un)return Un=13,Y=gi,Un|0;if(C4(d,Un),g=cx(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,b9(M,ci),g=l9(ci,A,mi)|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=mi,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=mi,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=mi,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=gi,Un|0;if(E=ra(at,8)|0,!E)return _t(Un),_t(m),Un=13,Y=gi,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=n9(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=n9((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&&ad(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=mi,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,e9(I,A,1,mi,0)|0){E=mi,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&&(du(I,A,1,mi,E,7,0,0)|0,_t(E))}for(oe=0;;){$=mi+(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=$h(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=od(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}eg(W,$,ao)|0,R4(d,Un,ao)|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=gi,Un|0}}return _t(Un),Un=g,Y=gi,Un|0}function sre(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=yre(d,A,((A|0)<0)<<31>>31,b)|0,d|0)return b=d,Y=E,b|0;if(y=tse(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 Bl(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=+Ii(+E)*+Ii(+g),_=+ne[y+(d<<4)+8>>3]-+ne[y+8>>3],m=+ia(+(+Ii(+_)*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,_=+Ii(+I)*+Ii(+M),E=+ne[y+(G<<4)+8>>3]-+ne[y+(O<<4)+8>>3],m=+ia(+(+Ii(+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 ore(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=C0(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],Bl(_,m)|0,y=0,Y=b,y|0)}function are(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=C0(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],Bl(_,m)|0,ne[m>>3]=+ne[m>>3]*4058973249931477e-8,y=0,Y=b,y|0)}function lre(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=C0(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],Bl(_,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 c4(d){return d=d|0,(d|0)==4|(d|0)==117|0}function i9(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 cre(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 ure(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 hre(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 r9(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 u4(d,A){return d=d|0,A=A|0,h[848+(d*28|0)+(A<<2)>>2]|0}function h4(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 fre(){return 122}function dre(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 pre(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 Are(d){return d=d|0,+ne[d+16>>3]<+ne[d+24>>3]|0}function mre(d){return d=d|0,+(+ne[d>>3]-+ne[d+8>>3])}function s9(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 f4(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 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;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 o9(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 a9(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));yc(d|0,_|0,168)|0,Y=g}function l9(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=w4(A,I)|0,A|0?(W=A,Y=$,W|0):(M=I,I=h[M>>2]|0,M=h[M+4>>2]|0,eg(I,M,O)|0,C0(I,M,G)|0,b=+ox(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=+ox(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=+F9(+y,+_),ue=+Km(+(g*g/+Jb(+(ue/+Jb(+y,+_)),3)/(b*(b*2.59807621135)*.8))),ne[Xi>>3]=ue,q=~~ue>>>0,W=+Ns(ue)>=1?ue>0?~~+l4(+Ws(ue/4294967296),4294967295)>>>0:~~+Km((ue-+(~~ue>>>0))/4294967296)>>>0:0,(h[Xi+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 _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,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=w4(m,M)|0,m|0?(_=m,Y=I,_|0):(m=M,g=h[m>>2]|0,m=h[m+4>>2]|0,eg(g,m,b)|0,C0(g,m,E)|0,O=+ox(b,E+8|0),O=+Km(+(+ox(d,A)/(O*2))),ne[Xi>>3]=O,m=~~O>>>0,g=+Ns(O)>=1?O>0?~~+l4(+Ws(O/4294967296),4294967295)>>>0:~~+Km((O-+(~~O>>>0))/4294967296)>>>0:0,(h[Xi+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 xre(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 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(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=m4(h[g>>2]|0,h[g+4>>2]|0)|0,b=0,E=0;;){if(y=d+(b<<3)|0,at=y,!(Wb(h[at>>2]|0,h[at+4>>2]|0)|0)){g=5,We=159;break}if(at=y,at=(m4(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(yc(b|0,d|0,g|0)|0,Yb(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=((Ui(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,d4(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=$h(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,d4(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=$h(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=od(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,u9(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=$h(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=od(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=Hb(E)|0,ye=Hb(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(nx(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=vse($,W<<4)|0,!y){We=75;break}ue=Hb(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],Bl(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);Yb(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],Bl(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],Bl(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],Bl(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],Bl(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],Bl(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],Bl(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],Bl(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],Bl(At,re+168|0)|0,Yb(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(Yb(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 vre(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 Hb(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=Hb(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 wre(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 Sre(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){_4(d,A,y,O)|0,_4(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&&Ui(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 Qk(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 Tre(d,A,m,_,g){return d=d|0,A=A|0,m=m|0,_=_|0,g=g|0,m=qb(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 Ere(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 Mre(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 c9(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&(Ui(d,m)|0)!=0?(m=0,m|0):(m=Wb(d,m)|0,m|0)}function Cre(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 d4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0;return g=(Ui(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 nx(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,_=_se(d,y,_&7)|0,(_|0)==-1?(h[m>>2]=0,y=6,Y=b,y|0):(Jm(d,y,g)|0&&li(27634,27035,282,27050),A=et(d|0,A|0,52)|0,Q()|0,A=A&15,Ui(d,y)|0?p4(g,A,_,2,m):A4(g,A,_,2,m),y=0,Y=b,y|0)):(y=6,Y=b,y|0)}function u9(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=qb(_,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 Rre(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=+Vie(+(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,_=+sx(me-+sx(+ia(+(O*(be*b-re*oe)+($*(_e*oe-be*ue)+_*(re*ue-_e*b))),+(ue*O+(b*$+oe*_))))),Ul(A)|0?b=+sx(_+-.3334731722518321):b=_,_=+Vb(+y)*2.618033988749896,(A|0)>0){d=0;do _=_*2.6457513110645907,d=d+1|0;while((d|0)!=(A|0))}M=+Qn(+b)*_,b=+Ii(+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 Pre(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,ix(g,h[d>>2]|0,A,0,m),Y=_}function ix(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=+gse(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=(Ul(m)|0)==0,y=+Zk(+((m?E:E*.37796447300922725)*.381966011250105))):(y=+Zk(+(y*.381966011250105)),Ul(m)|0&&(b=+sx(b+.3334731722518321))),G=+sx(+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=+Ii(+G),ue=+Qn(+y),$=+Ii(+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 p4(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,mi=0,ao=0,Un=0,gi=0,sa=0,As=0,qr=0,ms=0,rs=0,Ba=0,js=0,Xs=0,Gl=0,lo=0,wi=0,R0=0;if(Ba=Y,Y=Y+256|0,y=Ba+240|0,ci=Ba+224|0,qr=Ba,ms=Ba+208|0,rs=Ba+192|0,mi=Ba+168|0,ao=Ba+152|0,Un=Ba+136|0,gi=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],h9(ci,y,qr),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=mi+8|0,At=16928+(me<<2)|0,We=ao+8|0,Ot=Un+8|0,at=gi+8|0,dt=rs+8|0,W=mi+8|0,oe=mi+16|0,$=As+8|0,ue=As+16|0,q=m,_=0,b=0,E=0,M=0;e:for(;;){G=qr+(((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((Qm(ms,me,0,1)|0)==2);if((q|0)>(m|0)&(Ul(A)|0)!=0){if(G=h[ms>>2]|0,d=h[be>>2]|0,I=h[_e>>2]|0,y=h[re>>2]|0,js=+(E-M|0),ne[rs>>3]=+(b-M|0)-js*.5,ne[Fe>>3]=js*.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 lo=y+d|0,wi=(lo|0)<0,I=_+d-(wi?lo:0)|0,Gl=(I|0)<0,Xs=y+_-(wi?lo:0)-(Gl?I:0)|0,y=(Xs|0)<0,d=(wi?0:lo)-(Gl?I:0)-(y?Xs:0)|0,_=(Gl?0:I)-(y?Xs:0)|0,Xs=y?0:Xs,y=(_|0)<(d|0)?_:d,y=(Xs|0)<(y|0)?Xs:y,I=(y|0)>0,d=d-(I?y:0)|0,_=_-(I?y:0)|0,y=Xs-(I?y:0)|0,b=b+1|0;while((b|0)<(E|0))}else _=I;switch(wi=(h[Ee>>2]|0)*3|0,Xs=(Fa(wi,h[18608+(G*80|0)+(M*20|0)+4>>2]|0)|0)+d|0,I=(Fa(wi,h[18608+(G*80|0)+(M*20|0)+8>>2]|0)|0)+_|0,wi=(Fa(wi,h[18608+(G*80|0)+(M*20|0)+12>>2]|0)|0)+y|0,M=(Xs|0)<0,I=I-(M?Xs:0)|0,Gl=(I|0)<0,wi=wi+(M?0-Xs|0:0)+(Gl?0-I|0:0)|0,lo=(wi|0)<0,Xs=(M?0:Xs)-(Gl?I:0)-(lo?wi:0)|0,I=(Gl?0:I)-(lo?wi:0)|0,wi=lo?0:wi,lo=(I|0)<(Xs|0)?I:Xs,lo=(wi|0)<(lo|0)?wi:lo,Gl=(lo|0)>0,wi=wi-(Gl?lo:0)|0,js=+(I-(Gl?lo:0)-wi|0),ne[mi>>3]=+(Xs-(Gl?lo:0)-wi|0)-js*.5,ne[ye>>3]=js*.8660254037844386,js=+(h[At>>2]|0),ne[ao>>3]=js*3,ne[We>>3]=0,R0=js*-1.5,ne[Un>>3]=R0,ne[Ot>>3]=js*2.598076211353316,ne[gi>>3]=R0,ne[at>>3]=js*-2.598076211353316,h[17008+(O*80|0)+(G<<2)>>2]|0){case 1:{d=Un,_=ao;break}case 3:{d=gi,_=Un;break}case 2:{d=ao,_=gi;break}default:{d=12;break e}}T9(rs,mi,_,d,sa),ix(sa,O,me,1,As),wi=h[g>>2]|0,js=+tx(+ +ne[ue>>3]),R0=+ia(+ +ne[$>>3],+ +ne[As>>3]),ne[g+8+(wi<<4)>>3]=js,ne[g+8+(wi<<4)+8>>3]=R0,h[g>>2]=(h[g>>2]|0)+1}if((q|0)<(Ze|0)&&(wi=h[re>>2]|0,js=+((h[_e>>2]|0)-wi|0),ne[rs>>3]=+((h[be>>2]|0)-wi|0)-js*.5,ne[dt>>3]=js*.8660254037844386,ix(rs,h[ms>>2]|0,me,1,mi),wi=h[g>>2]|0,js=+tx(+ +ne[oe>>3]),R0=+ia(+ +ne[W>>3],+ +ne[mi>>3]),ne[g+8+(wi<<4)>>3]=js,ne[g+8+(wi<<4)+8>>3]=R0,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 h9(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=(Ul(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-_),Ul(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 Qm(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 Ire(d,A){d=d|0,A=A|0;var m=0;do m=Qm(d,A,0,1)|0;while((m|0)==2);return m|0}function A4(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,mi=0,ao=0,Un=0,gi=0,sa=0,As=0,qr=0,ms=0,rs=0;if(As=Y,Y=Y+272|0,y=As+256|0,b=As+240|0,Un=As,gi=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,mi=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],f9(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=gi+4|0,W=gi+8|0,$=gi+12|0,ue=sa+8|0,M=We+8|0,O=We+16|0,I=mi+8|0,G=mi+16|0,b=0,E=m,_=-1;e:for(;;){if(y=(E|0)%6|0,d=Un+(y<<4)|0,h[gi>>2]=h[d>>2],h[gi+4>>2]=h[d+4>>2],h[gi+8>>2]=h[d+8>>2],h[gi+12>>2]=h[d+12>>2],d=b,b=Qm(gi,_e,0,1)|0,(E|0)>(m|0)&(Ul(A)|0)!=0&&(ao=h[gi>>2]|0,(d|0)!=1&(ao|0)!=(_|0))){switch(rs=(y+5|0)%6|0,d=h[Un+(rs<<4)+12>>2]|0,qr=+((h[Un+(rs<<4)+8>>2]|0)-d|0),ne[sa>>3]=+((h[Un+(rs<<4)+4>>2]|0)-d|0)-qr*.5,ne[be>>3]=qr*.8660254037844386,d=h[Un+(y<<4)+12>>2]|0,qr=+((h[Un+(y<<4)+8>>2]|0)-d|0),ne[We>>3]=+((h[Un+(y<<4)+4>>2]|0)-d|0)-qr*.5,ne[me>>3]=qr*.8660254037844386,qr=+(h[Fe>>2]|0),ne[Ot>>3]=qr*3,ne[Ze>>3]=0,ms=qr*-1.5,ne[at>>3]=ms,ne[Ee>>3]=qr*2.598076211353316,ne[dt>>3]=ms,ne[ye>>3]=qr*-2.598076211353316,h[17008+(oe*80|0)+(((_|0)==(oe|0)?ao:_)<<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}}T9(sa,We,_,d,ci),!(E9(sa,ci)|0)&&!(E9(We,ci)|0)&&(ix(ci,oe,_e,1,mi),rs=h[g>>2]|0,qr=+tx(+ +ne[G>>3]),ms=+ia(+ +ne[I>>3],+ +ne[mi>>3]),ne[g+8+(rs<<4)>>3]=qr,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,qr=+((h[W>>2]|0)-rs|0),ne[sa>>3]=+((h[q>>2]|0)-rs|0)-qr*.5,ne[ue>>3]=qr*.8660254037844386,ix(sa,h[gi>>2]|0,_e,1,We),rs=h[g>>2]|0,qr=+tx(+ +ne[O>>3]),ms=+ia(+ +ne[M>>3],+ +ne[We>>3]),ne[g+8+(rs<<4)>>3]=qr,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[gi>>2]|0}if((d|0)==3){Y=As;return}else(d|0)==8&&li(27157,27120,766,27202)}function f9(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=(Ul(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-_),Ul(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 m4(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,52)|0,Q()|0,A&15|0}function d9(d,A){return d=d|0,A=A|0,A=et(d|0,A|0,45)|0,Q()|0,A&127|0}function Nre(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 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;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 Wb(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=N4(d|0,A|0,0)|0,Q()|0,((63-b|0)%3|0|0)!=0|0))}function Dre(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=N4(d|0,m|0,0)|0,Q()|0,(63-b|0)%3|0|0))||c9(d,A)|0?(b=1,b|0):(b=(M9(d,A)|0)!=0&1,b|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;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 _4(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 rx(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=rd(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=rd(7,0,g,((g|0)<0)<<31>>31)|0,g=Q()|0;break e}while(!1);m=rd(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=sd(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 Ui(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 Fre(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,S4(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,T4(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 p9(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 A9(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 Ore(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(yc(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=$h(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=od(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=sd(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;$=$h(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,$=od(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(ad(Ot|0,0,We|0)|0,yc(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&&(yc(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 Bre(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(S4($,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,T4($),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 Ure(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=(rx(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 kre(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 x4(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 M0(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 Gre(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 y4(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 zre(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(i9(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=pu(+((d*3|0)-_|0)*.14285714285714285)|0,h[re>>2]=y,d=pu(+((_<<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=pu(+((d<<1)+_|0)*.14285714285714285)|0,h[re>>2]=E,g=pu(+((_*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(_=i9(be)|0,d=ht(_|0,0,45)|0,A=d|A,d=Q()|0|m&-1040385,M=cre(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(r9(_,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=x4(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 Ul(d){return d=d|0,(d|0)%2|0|0}function v4(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[Xi>>3]=y,(h[Xi+4>>2]&2146435072|0)==2146435072||(_=+ne[d+8>>3],ne[Xi>>3]=_,(h[Xi+4>>2]&2146435072|0)==2146435072))return I=3,Y=O,I|0;g=+Qn(+y),G=g*+Qn(+_),g=g*+Ii(+_),_=+Ii(+y),ne[I>>3]=G,ne[I+8>>3]=g,ne[I+16>>3]=_,ne[Xi>>3]=G;do if((h[Xi+4>>2]&2146435072|0)!=2146435072&&(ne[Xi>>3]=_,d=h[Xi+4>>2]|0,ne[Xi>>3]=g,!((h[Xi+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],Rre(E,A,M),M=zre(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 b4(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 Jm(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],!(b4(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(!(Qm(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((Qm(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=pu(+((_<<1)+d|0)*.14285714285714285)|0,h[W>>2]=A,_=pu(+((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 eg(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=Jm(d,A,_)|0,y?(Y=b,y|0):(y=et(d|0,A|0,52)|0,Q()|0,Pre(_,y&15,g),M=+tx(+ +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 C0(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,_=Jm(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 p4(y,g,0,5,m),E=0,Y=b,E|0}while(!1);return A4(y,g,0,6,m),E=0,Y=b,E|0}function Vre(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(_=Jm(d,A,y)|0,!_){g?(h9(y,I,O),M=5):(f9(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);ad(m|0,-1,d<<2|0)|0;e:do if(g)for(y=0;;){if(b=O+(y<<4)|0,Ire(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,Qm(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 qre(){return 12}function w4(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 Hre(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=rd(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=sd(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=rd(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 rx(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 Wre(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(rx(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=rd(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=sd(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),_=sd(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=sd(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,$=rd(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=sd(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 S4(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=p9(A,m,g+1|0,_)|0,b=(Q()|0)&-15728641,m=ht(_|0,0,52)|0,m=A|m,b=b|(Q()|0),A=(Ui(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 g9(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=p9(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,Ui(g,y)|0){h[d>>2]=m;return}else{h[d>>2]=-1;return}}function T4(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 sx(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 jre(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=+Ii(+((g-_)*.5)),m=+Ii(+((+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 ox(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=+Ii(+((g-_)*.5)),m=+Ii(+((+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 Xre(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=+Ii(+((g-_)*.5)),m=+Ii(+((+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 _9(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 $re(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 Yre(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 Zre(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 jb(d,A){d=d|0,A=A|0;var m=0;return d>>>0>15?(A=4,A|0):(m=rd(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 Kre(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=nx(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=+Ii(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ii(+((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 Qre(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=nx(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=+Ii(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ii(+((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 Jre(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=nx(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=+Ii(+((_-I)*.5)),M=g,g=+ne[b+8+(d<<4)+8>>3],M=+Ii(+((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 ese(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 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,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}L4(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}L4(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 ax(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=h4(M,I)|0,(b|0)==7)return ue=1,Y=_e,ue|0;E=h4(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=Gre(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=y4(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(b4(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,Ul(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(b4(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 x9(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=u4(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,Ul(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=pu(+(M-W|0)*.14285714285714285)|0,O=pu(+(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=pu(+(M+W|0)*.14285714285714285)|0,O=pu(+(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=u4(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=u4(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=M0(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=M0(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=h4(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=M0(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=c4(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=x4(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=M0(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 nse(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=ax(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 ise(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-_),_=x9(d,A,O,g)|0),O=_,Y=G,O|0)}function E4(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=ax(d,A,d,A,b)|0,y|0?(E=y,Y=M,E|0):(d=ax(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 rse(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=E4(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 sse(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=E4(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=y9(d,A,m,_,y,b,g,0,0,1,0)|0,E?(g=(y9(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 y9(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,ax(d,A,d,A,G)|0&&li(27634,27315,696,27575),ax(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,_=~~+ew(+at),G=~~+ew(+W),m=~~+ew(+$),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=x9(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 rd(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=D9(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 M4(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=eg(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 xre(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 ose(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,g4(b,0,0,0),M=h[b>>2]|0,b=h[b+4>>2]|0;do if(m>>>0<=15){if(g=cx(_)|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){C4(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);Xb(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 Xb(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=v9(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=eg(m,_,W)|0,g|0){ue=15;break t}if(R4(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],s9(26896,W)|0)){if(v4(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=C0(m,_,W)|0,g|0){ue=32;break}if(M4(m,_,$,0)|0){ue=36;break}if(b&&w9(h[be>>2]|0,h[q>>2]|0,W,$)|0){ue=42;break}if(M&&S9(h[be>>2]|0,h[q>>2]|0,W,$)|0){ue=42;break}}if(G){if(A=M4(m,_,W,1)|0,g=h[q>>2]|0,A|0){ue=45;break}if(f4(g,W)|0){if(a9($,W),o9(W,h[q>>2]|0)|0){ue=53;break}if(R4(h[be>>2]|0,h[q>>2]|0,E)|0){ue=53;break}if(S9(h[be>>2]|0,h[q>>2]|0,$,W)|0){ue=53;break}}}}do if((y|0)<(h[oe>>2]|0)){if(A=M4(m,_,W,1)|0,g=h[q>>2]|0,A|0){ue=58;break t}if(!(f4(g,W)|0)){ue=73;break}if(o9(h[q>>2]|0,W)|0&&(a9($,W),w9(h[be>>2]|0,h[q>>2]|0,$,W)|0)){ue=65;break t}if(m=A9(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=v9(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 v9(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&(Ui(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):(g4(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 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,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,ose(G,d,A,m),I=G,S4(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,T4(q),d=q,A=h[d>>2]|0,d=h[d+4>>2]|0,(A|0)==0&(d|0)==0){if(Xb(m),A=m,d=h[A>>2]|0,A=h[A+4>>2]|0,(d|0)==0&(A|0)==0){$=10;break}g9(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,g9(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 lse(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;g4(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=cx(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}C4(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=+mre(m),q=q*+pre(m),y=+Ns(+ +ne[m>>3]),y=q/+Qn(+ +Jb(+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(_9(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(Xb(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 rx(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,Xb(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 lx(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(!(s9(A,m)|0)||(A=Are(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 b9(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 cx(d){return d=d|0,(d>>>0<4?0:15)|0}function C4(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 R4(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if(!(lx(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,lx((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 w9(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,!(lx(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,lx((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($b(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(lx(E,_,h[g+(b<<3)+4>>2]|0)|0){g=0;break e}if(g=b+1|0,$b((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 $b(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,!(f4(A,_)|0))return d=0,Y=Ze,d|0;if(gre(A,_,re,g),yc(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 S9(d,A,m,_){d=d|0,A=A|0,m=m|0,_=_|0;var g=0,y=0,b=0;if($b(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,$b((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 cse(){return 8}function use(){return 16}function hse(){return 168}function fse(){return 8}function dse(){return 16}function pse(){return 12}function Ase(){return 8}function mse(d){return d=d|0,+(+((h[d>>2]|0)>>>0)+4294967296*+(h[d+4>>2]|0))}function gse(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 T9(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 E9(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 _se(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,_=Ui(d,A)|0,(m+-1|0)>>>0>5||(_=(_|0)!=0,(m|0)==1&_))return g=-1,Y=y,g|0;do if(ux(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 ux(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,_=Jm(d,A,E)|0,_|0)return m=_,Y=O,m|0;y=d9(d,A)|0,I=Oa(d,A)|0,ure(y,M),_=hre(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=c4(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 kl(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=(Ui(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=(Ui(d,A)|0)!=0,((g?4:5)|0)<(m|0)||ux(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=Ui(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),ux(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(Ui(M,I)|0?y=qb(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=Ui(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(ux(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=(Ui(I,E)|0)!=0,M?d=qb(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=Ui(I,E)|0,(d+-1|0)>>>0<=5&&(_e=(g|0)!=0,!((d|0)==1&_e)))do if(ux(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 xse(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;return y=(Ui(d,A)|0)==0,_=kl(d,A,0,m)|0,g=(_|0)==0,y?!g||(_=kl(d,A,1,m+8|0)|0,_|0)||(_=kl(d,A,2,m+16|0)|0,_|0)||(_=kl(d,A,3,m+24|0)|0,_|0)||(_=kl(d,A,4,m+32|0)|0,_)?(y=_,y|0):kl(d,A,5,m+40|0)|0:!g||(_=kl(d,A,1,m+8|0)|0,_|0)||(_=kl(d,A,2,m+16|0)|0,_|0)||(_=kl(d,A,3,m+24|0)|0,_|0)||(_=kl(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 yse(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,_=Jm(d,E,y)|0,_|0?(E=_,Y=M,E|0):(A=et(d|0,A|0,52)|0,Q()|0,A=A&15,Ui(d,E)|0?p4(y,A,b,1,g):A4(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 M9(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,!(Wb(d,_)|0))?(_=0,Y=g,_|0):(y=et(d|0,A|0,56)|0,Q()|0,y=(kl(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 C9(){return 27680}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,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?P4(d,m,_,g,M):Kb(d,m,_,I,g,0,M),(g|0)==1){Qb(I,1),g=0;break}else{Qb(I,A),g=1;break}else P4(d,m,_,g,M),Zb(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(Kb(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:(Qb(I,2),q=g+-2|0,h[I>>2]=h[I>>2]^7,Zb(I,1),Kb(d+(0-(h[M+(q<<2)>>2]|0))+E|0,m,_,I,g+-1|0,1,M),Qb(I,1),A=h[I>>2]|1,h[I>>2]=A,d=d+E|0,Kb(d,m,_,I,q,1,M),g=q);(O|0)==19&&(O=0,A=R9(I)|0,Zb(I,A),d=d+E|0,g=A+g|0,A=h[I>>2]|0)}}while(!1);Y=G}function P4(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,(cd[m&3](b,d)|0)>-1&&(cd[m&3](b,E)|0)>-1||(b=O+(_<<2)|0,(cd[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);I9(A,O,_),Y=G}function Zb(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 Kb(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,(cd[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,(cd[m&3](y,M)|0)>-1){E=10;break e}if((cd[m&3](y+(0-E)|0,M)|0)>-1){E=10;break e}}if(y=_+1|0,h[q+(_<<2)>>2]=M,$=R9(G)|0,Zb(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,(cd[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&&(I9(A,q,_),P4(d,A,m,g,b)),Y=W}function Qb(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 R9(d){d=d|0;var A=0;return A=P9((h[d>>2]|0)+-1|0)|0,A?A|0:(A=P9(h[d+4>>2]|0)|0,((A|0)==0?0:A+32|0)|0)}function P9(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 I9(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,yc(_|0,h[A>>2]|0,g|0)|0,_=0;do E=A+(_<<2)|0,_=_+1|0,yc(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 pu(d){return d=+d,~~+O9(+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=ld(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=ld(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=ld(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((ld(d|0)|0)==-1){ld(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=ld(I|0)|0,$=ld(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=C9()|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)||ad(d|0,0,m|0)|0,d|0}function vse(d,A){d=d|0,A=A|0;var m=0,_=0;return d?A>>>0>4294967231?(A=C9()|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,yc(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,N9(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,N9(E,I),d|0)}function N9(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 L9(d){return d=d|0,(d?31-(Xh(d^d-1)|0)|0:32)|0}function I4(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=(Xh(E|0)|0)-(Xh(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=(Xh(b|0)|0)+33-(Xh(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):($=L9(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>>>((L9(E|0)|0)>>>0),Dn(W|0),$|0;if(y=(Xh(E|0)|0)-(Xh(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 sd(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((I4(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 wse(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=wse(g,y)|0,d=Q()|0,Dn((Fa(A,y)|0)+(Fa(_,g)|0)+d|d&0|0),m|0|0|0}function od(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,I4(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 $h(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,I4(d,A,m,_,g)|0,Y=y,Dn(h[g+4>>2]|0),h[g>>2]|0|0}function D9(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 N4(d,A,m){return d=d|0,A=A|0,m=m|0,A=Xh(A)|0,(A|0)==32&&(A=A+(Xh(d)|0)|0),Dn(0),A|0}function F9(d,A){return d=+d,A=+A,d!=d?+A:A!=A?+d:+qie(+d,+A)}function Jb(d,A){return d=+d,A=+A,d!=d?+A:A!=A?+d:+l4(+d,+A)}function ew(d){return d=+d,d>=0?+Ws(d+.5):+Km(d-.5)}function yc(d,A,m){d=d|0,A=A|0,m=m|0;var _=0,g=0,y=0;if((m|0)>=8192)return jie(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 L4(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 yc(d,A,m)|0;return d|0}function ad(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 O9(d){return d=+d,d>=0?+Ws(d+.5):+Km(d-.5)}function ld(d){d=d|0;var A=0,m=0,_=0;return _=Wie()|0,m=h[Da>>2]|0,A=m+d|0,(d|0)>0&(A|0)<(m|0)|(A|0)<0?($ie(A|0)|0,Kk(12),-1):(A|0)>(_|0)&&!(Xie(A|0)|0)?(Kk(12),-1):(h[Da>>2]=A,m|0)}function Sse(d,A,m){return d=d|0,A=A|0,m=m|0,cd[d&3](A|0,m|0)|0}function Tse(d,A){return d=d|0,A=A|0,Hie(0),0}var cd=[Tse,vre,bre,wre];return{___divdi3:sd,___muldi3:cr,___remdi3:od,___uremdi3:$h,_areNeighborCells:Sre,_bitshift64Ashr:D9,_bitshift64Lshr:et,_bitshift64Shl:ht,_calloc:ra,_cellAreaKm2:are,_cellAreaM2:lre,_cellAreaRads2:ore,_cellToBoundary:C0,_cellToCenterChild:A9,_cellToChildPos:Hre,_cellToChildren:Fre,_cellToChildrenSize:rx,_cellToLatLng:eg,_cellToLocalIj:nse,_cellToParent:_4,_cellToVertex:kl,_cellToVertexes:xse,_cellsToDirectedEdge:Tre,_cellsToLinkedMultiPolygon:sre,_childPosToCell:Wre,_compactCells:Ore,_constructCell:Lre,_destroyLinkedMultiPolygon:ese,_directedEdgeToBoundary:nx,_directedEdgeToCells:Cre,_edgeLengthKm:Qre,_edgeLengthM:Jre,_edgeLengthRads:Kre,_emscripten_replace_memory:Yie,_free:_t,_getBaseCellNumber:d9,_getDirectedEdgeDestination:Mre,_getDirectedEdgeOrigin:Ere,_getHexagonAreaAvgKm2:_9,_getHexagonAreaAvgM2:$re,_getHexagonEdgeLengthAvgKm:Yre,_getHexagonEdgeLengthAvgM:Zre,_getIcosahedronFaces:m9,_getIndexDigit:Nre,_getNumCells:jb,_getPentagons:w4,_getRes0Cells:dre,_getResolution:m4,_greatCircleDistanceKm:ox,_greatCircleDistanceM:Xre,_greatCircleDistanceRads:jre,_gridDisk:Qk,_gridDiskDistances:Jk,_gridDistance:E4,_gridPathCells:sse,_gridPathCellsSize:rse,_gridRing:tre,_gridRingUnsafe:t9,_i64Add:pt,_i64Subtract:Ds,_isPentagon:Ui,_isResClassIII:kre,_isValidCell:Wb,_isValidDirectedEdge:c9,_isValidIndex:Dre,_isValidVertex:M9,_latLngToCell:v4,_llvm_ctlz_i64:N4,_llvm_maxnum_f64:F9,_llvm_minnum_f64:Jb,_llvm_round_f64:ew,_localIjToCell:ise,_malloc:lr,_maxFaceCount:Vre,_maxGridDiskSize:ere,_maxPolygonToCellsSize:ire,_maxPolygonToCellsSizeExperimental:lse,_memcpy:yc,_memmove:L4,_memset:ad,_originToDirectedEdges:d4,_pentagonCount:qre,_polygonToCells:rre,_polygonToCellsExperimental:ase,_readInt64AsDoubleFromPointer:mse,_res0CellCount:fre,_reverseDirectedEdge:u9,_round:O9,_sbrk:ld,_sizeOfCellBoundary:hse,_sizeOfCoordIJ:Ase,_sizeOfGeoLoop:fse,_sizeOfGeoPolygon:dse,_sizeOfH3Index:cse,_sizeOfLatLng:use,_sizeOfLinkedGeoPolygon:pse,_uncompactCells:Bre,_uncompactCellsSize:Ure,_vertexToLatLng:yse,dynCall_iii:Sse,establishStackSpace:Jie,stackAlloc:Zie,stackRestore:Qie,stackSave:Kie}})(Dt,ct,Z),jt=e.___divdi3=Ce.___divdi3,qi=e.___muldi3=Ce.___muldi3,Nn=e.___remdi3=Ce.___remdi3,Gr=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,fu=e._cellToBoundary=Ce._cellToBoundary,Gb=e._cellToCenterChild=Ce._cellToCenterChild,e4=e._cellToChildPos=Ce._cellToChildPos,t4=e._cellToChildren=Ce._cellToChildren,J1=e._cellToChildrenSize=Ce._cellToChildrenSize,n4=e._cellToLatLng=Ce._cellToLatLng,ex=e._cellToLocalIj=Ce._cellToLocalIj,i4=e._cellToParent=Ce._cellToParent,r4=e._cellToVertex=Ce._cellToVertex,Vk=e._cellToVertexes=Ce._cellToVertexes,qk=e._cellsToDirectedEdge=Ce._cellsToDirectedEdge,Hk=e._cellsToLinkedMultiPolygon=Ce._cellsToLinkedMultiPolygon,Wk=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,Bi=e._getHexagonAreaAvgKm2=Ce._getHexagonAreaAvgKm2,zr=e._getHexagonAreaAvgM2=Ce._getHexagonAreaAvgM2,Mr=e._getHexagonEdgeLengthAvgKm=Ce._getHexagonEdgeLengthAvgKm,Hi=e._getHexagonEdgeLengthAvgM=Ce._getHexagonEdgeLengthAvgM,oo=e._getIcosahedronFaces=Ce._getIcosahedronFaces,Xt=e._getIndexDigit=Ce._getIndexDigit,La=e._getNumCells=Ce._getNumCells,Ai=e._getPentagons=Ce._getPentagons,al=e._getRes0Cells=Ce._getRes0Cells,xc=e._getResolution=Ce._getResolution,Hh=e._greatCircleDistanceKm=Ce._greatCircleDistanceKm,S0=e._greatCircleDistanceM=Ce._greatCircleDistanceM,Wi=e._greatCircleDistanceRads=Ce._greatCircleDistanceRads,Vr=e._gridDisk=Ce._gridDisk,Wh=e._gridDiskDistances=Ce._gridDiskDistances,er=e._gridDistance=Ce._gridDistance,jh=e._gridPathCells=Ce._gridPathCells,T0=e._gridPathCellsSize=Ce._gridPathCellsSize,s4=e._gridRing=Ce._gridRing,m4e=e._gridRingUnsafe=Ce._gridRingUnsafe,g4e=e._i64Add=Ce._i64Add,_4e=e._i64Subtract=Ce._i64Subtract,x4e=e._isPentagon=Ce._isPentagon,y4e=e._isResClassIII=Ce._isResClassIII,v4e=e._isValidCell=Ce._isValidCell,b4e=e._isValidDirectedEdge=Ce._isValidDirectedEdge,w4e=e._isValidIndex=Ce._isValidIndex,S4e=e._isValidVertex=Ce._isValidVertex,T4e=e._latLngToCell=Ce._latLngToCell,E4e=e._llvm_ctlz_i64=Ce._llvm_ctlz_i64,M4e=e._llvm_maxnum_f64=Ce._llvm_maxnum_f64,C4e=e._llvm_minnum_f64=Ce._llvm_minnum_f64,R4e=e._llvm_round_f64=Ce._llvm_round_f64,P4e=e._localIjToCell=Ce._localIjToCell,I4e=e._malloc=Ce._malloc,N4e=e._maxFaceCount=Ce._maxFaceCount,L4e=e._maxGridDiskSize=Ce._maxGridDiskSize,D4e=e._maxPolygonToCellsSize=Ce._maxPolygonToCellsSize,F4e=e._maxPolygonToCellsSizeExperimental=Ce._maxPolygonToCellsSizeExperimental,O4e=e._memcpy=Ce._memcpy,B4e=e._memmove=Ce._memmove,U4e=e._memset=Ce._memset,k4e=e._originToDirectedEdges=Ce._originToDirectedEdges,G4e=e._pentagonCount=Ce._pentagonCount,z4e=e._polygonToCells=Ce._polygonToCells,V4e=e._polygonToCellsExperimental=Ce._polygonToCellsExperimental,q4e=e._readInt64AsDoubleFromPointer=Ce._readInt64AsDoubleFromPointer,H4e=e._res0CellCount=Ce._res0CellCount,W4e=e._reverseDirectedEdge=Ce._reverseDirectedEdge,j4e=e._round=Ce._round,X4e=e._sbrk=Ce._sbrk,$4e=e._sizeOfCellBoundary=Ce._sizeOfCellBoundary,Y4e=e._sizeOfCoordIJ=Ce._sizeOfCoordIJ,Z4e=e._sizeOfGeoLoop=Ce._sizeOfGeoLoop,K4e=e._sizeOfGeoPolygon=Ce._sizeOfGeoPolygon,Q4e=e._sizeOfH3Index=Ce._sizeOfH3Index,J4e=e._sizeOfLatLng=Ce._sizeOfLatLng,ePe=e._sizeOfLinkedGeoPolygon=Ce._sizeOfLinkedGeoPolygon,tPe=e._uncompactCells=Ce._uncompactCells,nPe=e._uncompactCellsSize=Ce._uncompactCellsSize,iPe=e._vertexToLatLng=Ce._vertexToLatLng,rPe=e.establishStackSpace=Ce.establishStackSpace,jk=e.stackAlloc=Ce.stackAlloc,Gie=e.stackRestore=Ce.stackRestore,zie=e.stackSave=Ce.stackSave,sPe=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 o4=function(Ne){Ne.byteLength&&(Ne=new Uint8Array(Ne)),j.set(Ne,x),e.memoryInitializerRequest&&delete e.memoryInitializerRequest.response,Bn("memory initializer")},Xk=function(){a(le,o4,function(){throw"could not load memory initializer "+le})},$k=wt(le);if($k)o4($k.buffer);else if(e.memoryInitializerRequest){var Yk=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),Xk();return}}o4(nt)};e.memoryInitializerRequest.response?setTimeout(Yk,0):e.memoryInitializerRequest.addEventListener("load",Yk)}else Xk()}}var zb;ge=function Ne(){zb||a4(),zb||(ge=Ne)};function a4(Ne){if(Ne=Ne||r,Qt>0||(Ct(),Qt>0))return;function nt(){zb||(zb=!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=a4;function E0(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=E0,e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return a4(),i})(typeof hi=="object"?hi:{}),wn="number",vn=wn,e1=wn,Tn=wn,En=wn,no=wn,qt=wn,J_e=[["sizeOfH3Index",wn],["sizeOfLatLng",wn],["sizeOfCellBoundary",wn],["sizeOfGeoLoop",wn],["sizeOfGeoPolygon",wn],["sizeOfLinkedGeoPolygon",wn],["sizeOfCoordIJ",wn],["readInt64AsDoubleFromPointer",wn],["isValidCell",e1,[Tn,En]],["isValidIndex",e1,[Tn,En]],["latLngToCell",vn,[wn,wn,no,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,no,wn,qt]],["polygonToCells",vn,[qt,no,wn,qt]],["maxPolygonToCellsSizeExperimental",vn,[qt,no,wn,qt]],["polygonToCellsExperimental",vn,[qt,no,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,no]],["uncompactCellsSize",vn,[qt,wn,wn,no,qt]],["isPentagon",e1,[Tn,En]],["isResClassIII",e1,[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,no,qt]],["cellToChildren",vn,[Tn,En,no,qt]],["cellToCenterChild",vn,[Tn,En,no,qt]],["cellToChildrenSize",vn,[Tn,En,no,qt]],["cellToChildPos",vn,[Tn,En,no,qt]],["childPosToCell",vn,[wn,wn,Tn,En,no,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",e1,[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,[no,qt]],["getHexagonAreaAvgKm2",vn,[no,qt]],["getHexagonEdgeLengthAvgM",vn,[no,qt]],["getHexagonEdgeLengthAvgKm",vn,[no,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,[no,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",e1,[Tn,En]]],e1e=0,t1e=1,n1e=2,i1e=3,H$=4,r1e=5,s1e=6,o1e=7,a1e=8,l1e=9,c1e=10,u1e=11,h1e=12,f1e=13,d1e=14,p1e=15,A1e=16,m1e=17,g1e=18,_1e=19,us={};us[e1e]="Success";us[t1e]="The operation failed but a more specific error is not available";us[n1e]="Argument was outside of acceptable range";us[i1e]="Latitude or longitude arguments were outside of acceptable range";us[H$]="Resolution argument was outside of acceptable range";us[r1e]="Cell argument was not valid";us[s1e]="Directed edge argument was not valid";us[o1e]="Undirected edge argument was not valid";us[a1e]="Vertex argument was not valid";us[l1e]="Pentagon distortion was encountered";us[c1e]="Duplicate input";us[u1e]="Cell arguments were not neighbors";us[h1e]="Cell arguments had incompatible resolutions";us[f1e]="Memory allocation failed";us[d1e]="Bounds of provided memory were insufficient";us[p1e]="Mode or flags argument was not valid";us[A1e]="Index argument was not valid";us[m1e]="Base cell number was outside of acceptable range";us[g1e]="Child indexing digits invalid";us[_1e]="Child indexing digits refer to a deleted subsequence";var x1e=1e3,W$=1001,j$=1002,vE={};vE[x1e]="Unknown unit";vE[W$]="Array length out of bounds";vE[j$]="Got unexpected null value for H3 index";var y1e="Unknown error";function X$(i,e,t){var n=t&&"value"in t,r=new Error((i[e]||y1e)+" (code: "+e+(n?", value: "+t.value:"")+")");return r.code=e,r}function $$(i,e){var t=arguments.length===2?{value:e}:{};return X$(us,i,t)}function Y$(i,e){var t=arguments.length===2?{value:e}:{};return X$(vE,i,t)}function vv(i){if(i!==0)throw $$(i)}var Qa={};J_e.forEach(function(e){Qa[e[0]]=hi.cwrap.apply(hi,e)});var t1=16;var bv=4;var n1=8,v1e=8,xE=Qa.sizeOfH3Index(),D6=Qa.sizeOfLatLng(),b1e=Qa.sizeOfCellBoundary(),w1e=Qa.sizeOfGeoPolygon(),yv=Qa.sizeOfGeoLoop(),fJe=Qa.sizeOfLinkedGeoPolygon(),dJe=Qa.sizeOfCoordIJ();function S1e(i){if(typeof i!="number"||i<0||i>15||Math.floor(i)!==i)throw $$(H$,i);return i}function T1e(i){if(!i)throw Y$(j$);return i}var E1e=Math.pow(2,32)-1,pJe=Math.pow(2,31)-1;function M1e(i){if(i>E1e)throw Y$(W$,i);return i}var C1e=/[^0-9a-fA-F]/;function Z$(i){if(Array.isArray(i)&&i.length===2&&Number.isInteger(i[0])&&Number.isInteger(i[1]))return i;if(typeof i!="string"||C1e.test(i))return[0,0];var e=parseInt(i.substring(0,i.length-8),t1),t=parseInt(i.substring(i.length-8),t1);return[t,e]}function V$(i){if(i>=0)return i.toString(t1);i=i&2147483647;var e=K$(8,i.toString(t1)),t=(parseInt(e[0],t1)+8).toString(t1);return e=t+e.substring(1),e}function R1e(i,e){return V$(e)+K$(8,V$(i))}function K$(i,e){for(var t=i-e.length,n="",r=0;r<t;r++)n+="0";return n=n+e,n}var AJe=Math.pow(2,32);function q$(i,e,t){for(var n=i.length,r=hi._calloc(n,D6),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(tY),r/n1+a);return hi.HEAPU32.set([n,r],e/bv),e}function P1e(i,e){var t=i.length-1,n=hi._calloc(w1e),r=0,s=r+yv,o=s+bv;q$(i[0],n+r,e);var a;if(t>0){a=hi._calloc(t,yv);for(var l=0;l<t;l++)q$(i[l+1],a+yv*l,e)}return hi.setValue(n+s,t,"i32"),hi.setValue(n+o,a,"i32"),n}function I1e(i){var e=0,t=e+yv,n=t+bv,r=bv;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+yv*a+r,"i8*"));hi._free(o)}hi._free(i)}function Q$(i,e){e===void 0&&(e=0);var t=hi.getValue(i+xE*e,"i32"),n=hi.getValue(i+xE*e+bv,"i32");return n?R1e(t,n):null}function N1e(i){return Qa.readInt64AsDoubleFromPointer(i)}function L1e(i,e){for(var t=[],n=0;n<e;n++){var r=Q$(i,n);r!==null&&t.push(r)}return t}function yE(i){return O1e(hi.getValue(i,"double"))}function J$(i){return[yE(i),yE(i+n1)]}function D1e(i){return[yE(i+n1),yE(i)]}function F1e(i,e,t){for(var n=hi.getValue(i,"i32"),r=i+n1,s=[],o=e?D1e:J$,a=0;a<n*2;a+=2)s.push(o(r+n1*a));return t&&s.push(s[0]),s}function eY(i,e,t){var n=hi._malloc(D6);hi.HEAPF64.set([i,e].map(tY),n/n1);var r=hi._malloc(xE);try{return vv(Qa.latLngToCell(n,t,r)),T1e(Q$(r))}finally{hi._free(r),hi._free(n)}}function F6(i){var e=hi._malloc(D6),t=Z$(i),n=t[0],r=t[1];try{return vv(Qa.cellToLatLng(n,r,e)),J$(e)}finally{hi._free(e)}}function O6(i,e){var t=hi._malloc(b1e),n=Z$(i),r=n[0],s=n[1];try{return vv(Qa.cellToBoundary(r,s,t)),F1e(t,e,e)}finally{hi._free(t)}}function B6(i,e,t){if(S1e(e),t=!!t,i.length===0||i[0].length===0)return[];var n=typeof i[0][0]=="number"?[i]:i,r=P1e(n,t),s=hi._malloc(v1e);try{vv(Qa.maxPolygonToCellsSize(r,e,0,s));var o=M1e(N1e(s)),a=hi._calloc(o,xE);try{return vv(Qa.polygonToCells(r,e,0,a)),L1e(a,o)}finally{hi._free(a)}}finally{hi._free(s),I1e(r)}}function tY(i){return i*Math.PI/180}function O1e(i){return i*180/Math.PI}function U6(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 B1e=["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"],nY=new WeakMap,iY=new WeakMap,rY=new WeakMap,w8=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=B1e,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=rY.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}},rY.set(e,t)),t}getMaterialData(e){let t=iY.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)}iY.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=nY.get(e);return n===void 0&&(n={renderId:-1,lightsData:[]},nY.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}},U1e=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];function k1e(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&&!U1e.some(n=>n.test(t.file)))}var Br=class{constructor(e=null){this.isStackTrace=!0,this.stack=k1e(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 o7(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 F1=i=>o7(i),gb=i=>o7(i),zv=(...i)=>o7(i),L1e=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),tY=new WeakMap;function wZ(i){return L1e.get(i)}function lM(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 SZ(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 Fr)}function D1e(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 Fr)}function F1e(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 Fr)}function Qp(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 a7(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 w_(...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"?B1e(e[0]):null}function TZ(i){let e=tY.get(i);return e===void 0&&(e={},tY.set(i,e)),e}function O1e(i){let e="",t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function B1e(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var p1={VERTEX:"vertex",FRAGMENT:"fragment"},_n={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},U1e={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},So={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},EZ=["fragment","vertex"],nM=["setup","analyze","generate"],iM=[...EZ,"compute"],Om=["x","y","z","w"],k1e={analyze:"setup",generate:"analyze"},G1e=0,$t=class i extends Go{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=G1e++,this.stackTrace=null,i.captureStackTrace===!0&&(this.stackTrace=new Fr)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Wc.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(F1(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=zv(gb(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=k1e[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 $f=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} ]`}},cM=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)}},dr=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)}},v8=class extends dr{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)}},z1e=Om.join(""),uM=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(Om.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===z1e.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}},b8=class extends dr{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=Om[p];x===n[0]?(f.push(l),p+=n.length-1):f.push(c+"."+x)}return`${e.getType(s)}( ${f.join(", ")} )`}},w8=class extends dr{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=Om[f];p===t[u]?(c.push("1.0 - "+(a+"."+p)),u++):c.push(a+"."+p)}return`${e.getType(r)}( ${c.join(", ")} )`}},Zv=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?Qp(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=Qp(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=O1e(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?a7(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.")}},nY=/float|u?int/,dc=class extends Zv{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 nY.test(n)&&nY.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},S8=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}},n0=null,T8=new Map;function Be(i,e){if(T8.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`);T8.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 V1e=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),iY=i=>V1e(i).split("").sort().join("");$t.prototype.assign=function(...i){if(this.isStackNode!==!0)return n0!==null?n0.assign(this,...i):Ge("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new Fr),this;{let e=T8.get("assign");return this.addToStack(e(...i))}};$t.prototype.toVarIntent=function(){return this};$t.prototype.get=function(i){return new S8(this,i)};var Vv={};function xE(i,e,t){Vv[i]=Vv[e]=Vv[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new uM(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=iY(i);return new b8(this,a,Vt(o))},$t.prototype["flip"+n]=$t.prototype["flip"+r]=$t.prototype["flip"+s]=function(){let o=iY(i);return new w8(this,o)}}var fh=["x","y","z","w"],dh=["r","g","b","a"],ph=["s","t","p","q"];for(let i=0;i<4;i++){let e=fh[i],t=dh[i],n=ph[i];xE(e,t,n);for(let r=0;r<4;r++){e=fh[i]+fh[r],t=dh[i]+dh[r],n=ph[i]+ph[r],xE(e,t,n);for(let s=0;s<4;s++){e=fh[i]+fh[r]+fh[s],t=dh[i]+dh[r]+dh[s],n=ph[i]+ph[r]+ph[s],xE(e,t,n);for(let o=0;o<4;o++)e=fh[i]+fh[r]+fh[s]+fh[o],t=dh[i]+dh[r]+dh[s]+dh[o],n=ph[i]+ph[r]+ph[s]+ph[o],xE(e,t,n)}}}for(let i=0;i<32;i++)Vv[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new $f(this,new dc(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(Vt(e))}};Object.defineProperties($t.prototype,Vv);var q1e=function(i,e=null){let t=Qp(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Vt(C8(i,e)):t==="shader"?i.isFn?i:Ae(i):i},H1e=function(i,e=null){for(let t in i)i[t]=Vt(i[t],e);return i},W1e=function(i,e=null){let t=i.length;for(let n=0;n<t;n++)i[n]=Vt(i[n],e);return i},MZ=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 Fr),u.concat(new Array(a-u.length).fill(0))):l!==void 0&&u.length>l?(Ge(`TSL: "${f}" parameter length exceeds limit.`,new Fr),u.slice(0,l)):u}return e===null?s=(...u)=>r(new i(...ym(c(u)))):t!==null?(t=Vt(t),s=(...u)=>r(new i(e,...ym(c(u)),t))):s=(...u)=>r(new i(e,...ym(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},j1e=function(i,...e){return new i(...ym(e))},E8=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(CZ(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?X1e(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?$1e(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 CZ(i){return i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)}function X1e(i){let e;return wC(i),CZ(i)?e=[...i]:e=i[0],e}function $1e(i){let e=0;return wC(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 M8=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 E8(this,e)}setup(){return this.call()}},Y1e=[!1,!0],Z1e=[0,1,2,3],K1e=[-1,-2],RZ=[.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],l7=new Map;for(let i of Y1e)l7.set(i,new dc(i));var c7=new Map;for(let i of Z1e)c7.set(i,new dc(i,"uint"));var u7=new Map([...c7].map(i=>new dc(i.value,"int")));for(let i of K1e)u7.set(i,new dc(i,"int"));var vC=new Map([...u7].map(i=>new dc(i.value)));for(let i of RZ)vC.set(i,new dc(i));for(let i of RZ)vC.set(-i,new dc(-i));var bC={bool:l7,uint:c7,ints:u7,float:vC},rY=new Map([...l7,...vC]),C8=(i,e)=>rY.has(i)?rY.get(i):i.isNode===!0?i:new dc(i,e),Cs=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 Fr),new dc(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=[a7(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return kv(e.get(t[0]));if(t.length===1){let r=C8(t[0],i);return r.nodeType===i?kv(r):kv(new cM(r,i))}let n=t.map(r=>C8(r));return kv(new v8(n,i))}};function T1(i){return i&&i.isNode&&i.traverse(e=>{e.isConstNode&&(i=e.value)}),!!i}var PZ=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function g1(i,e){return new M8(i,e)}var Vt=(i,e=null)=>q1e(i,e),kv=(i,e=null)=>Vt(i,e).toVarIntent(),wC=(i,e=null)=>new H1e(i,e),ym=(i,e=null)=>new W1e(i,e),Vn=(i,e=null,t=null,n=null)=>new MZ(i,e,t,n),xt=(i,...e)=>new j1e(i,...e),lt=(i,e=null,t=null,n={})=>new MZ(i,e,t,{...n,intent:!0}),h7=(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)}}),Q1e=0,R8=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 Fr),t=null)),this.shaderNode=new g1(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"+Q1e++,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 R8(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 Kv=i=>{n0=i},f7=()=>n0,Wt=(...i)=>n0.If(...i),J1e=(...i)=>n0.Switch(...i);function SC(i){return n0&&n0.addToStack(i),i}Be("toStack",SC);var IZ=new Cs("color"),se=new Cs("float",bC.float),fe=new Cs("int",bC.ints),it=new Cs("uint",bC.uint),Pl=new Cs("bool",bC.bool),ft=new Cs("vec2"),vr=new Cs("ivec2"),d7=new Cs("uvec2"),NZ=new Cs("bvec2"),pe=new Cs("vec3"),p7=new Cs("ivec3"),Bm=new Cs("uvec3"),A7=new Cs("bvec3"),Lt=new Cs("vec4"),m7=new Cs("ivec4"),g7=new Cs("uvec4"),LZ=new Cs("bvec4"),TC=new Cs("mat2"),io=new Cs("mat3"),e0=new Cs("mat4");Be("toColor",IZ);Be("toFloat",se);Be("toInt",fe);Be("toUint",it);Be("toBool",Pl);Be("toVec2",ft);Be("toIVec2",vr);Be("toUVec2",d7);Be("toBVec2",NZ);Be("toVec3",pe);Be("toIVec3",p7);Be("toUVec3",Bm);Be("toBVec3",A7);Be("toVec4",Lt);Be("toIVec4",m7);Be("toUVec4",g7);Be("toBVec4",LZ);Be("toMat2",TC);Be("toMat3",io);Be("toMat4",e0);var DZ=Vn($f).setParameterLength(2),FZ=(i,e)=>new cM(Vt(i),e),exe=(i,e)=>new uM(Vt(i),e);Be("element",DZ);Be("convert",FZ);var txe=i=>(je("TSL: append() has been renamed to Stack().",new Fr),SC(i));Be("append",i=>(je("TSL: .append() has been renamed to .toStack().",new Fr),SC(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 F1(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)}},Kf=(i,e,t=null)=>new fi(i,e,!1,t),Um=(i,e,t=null)=>new fi(i,e,!0,t),Mi=xt(fi,"vec4","DiffuseColor"),pm=xt(fi,"vec3","DiffuseContribution"),P8=xt(fi,"vec3","EmissiveColor"),vh=xt(fi,"float","Roughness"),Xf=xt(fi,"float","Metalness"),hM=xt(fi,"float","Clearcoat"),x1=xt(fi,"float","ClearcoatRoughness"),El=xt(fi,"vec3","Sheen"),Xp=xt(fi,"float","SheenRoughness"),EC=xt(fi,"float","Iridescence"),fM=xt(fi,"float","IridescenceIOR"),dM=xt(fi,"float","IridescenceThickness"),pM=xt(fi,"float","AlphaT"),jp=xt(fi,"float","Anisotropy"),qv=xt(fi,"vec3","AnisotropyT"),vm=xt(fi,"vec3","AnisotropyB"),i0=xt(fi,"color","SpecularColor"),mm=xt(fi,"color","SpecularColorBlended"),gm=xt(fi,"float","SpecularF90"),AM=xt(fi,"float","Shininess"),y1=xt(fi,"output","Output"),bm=xt(fi,"float","dashSize"),Qv=xt(fi,"float","gapSize"),nxe=xt(fi,"float","pointWidth"),Hv=xt(fi,"float","IOR"),mM=xt(fi,"float","Transmission"),_7=xt(fi,"float","Thickness"),x7=xt(fi,"float","AttenuationDistance"),y7=xt(fi,"color","AttenuationColor"),v7=xt(fi,"float","Dispersion"),I8=xt(fi,"float","AmbientOcclusion",!1,1),gM=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}},OZ=(i,e=1,t=null)=>new gM(i,!1,e,t),MC=(i,e=0,t=null)=>new gM(i,!0,e,t),ixe=MC("frame",0,_n.FRAME),Zt=MC("render",0,_n.RENDER),BZ=OZ("object",1,_n.OBJECT),Mm=class extends Zv{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=BZ}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.',new Fr),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=PZ(e||i);if(t===i&&(i=a7(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new Mm(i,t)},_M=class extends dr{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)}},UZ=(...i)=>{let e;if(i.length===1){let t=i[0];e=new _M(null,t.length,t)}else{let t=i[0],n=i[1];e=new _M(t,n)}return Vt(e)};Be("toArray",(i,e)=>UZ(Array(e).fill(i)));var N8=class extends dr{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 Om.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)}},kZ=Vn(N8).setParameterLength(2);Be("assign",kZ);var L8=class extends dr{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(", ")} )`}},GZ=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?ym(e):wC(e[0]),new L8(Vt(i),e));Be("call",GZ);var rxe={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},Or=class i extends dr{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(rxe[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===po;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}},us=lt(Or,"+").setParameterLength(2,1/0).setName("add"),ni=lt(Or,"-").setParameterLength(2,1/0).setName("sub"),bn=lt(Or,"*").setParameterLength(2,1/0).setName("mul"),Il=lt(Or,"/").setParameterLength(2,1/0).setName("div"),CC=lt(Or,"%").setParameterLength(2).setName("mod"),zZ=lt(Or,"==").setParameterLength(2).setName("equal"),VZ=lt(Or,"!=").setParameterLength(2).setName("notEqual"),qZ=lt(Or,"<").setParameterLength(2).setName("lessThan"),b7=lt(Or,">").setParameterLength(2).setName("greaterThan"),HZ=lt(Or,"<=").setParameterLength(2).setName("lessThanEqual"),WZ=lt(Or,">=").setParameterLength(2).setName("greaterThanEqual"),jZ=lt(Or,"&&").setParameterLength(2,1/0).setName("and"),XZ=lt(Or,"||").setParameterLength(2,1/0).setName("or"),$Z=lt(Or,"!").setParameterLength(1).setName("not"),YZ=lt(Or,"^^").setParameterLength(2).setName("xor"),ZZ=lt(Or,"&").setParameterLength(2).setName("bitAnd"),KZ=lt(Or,"~").setParameterLength(1).setName("bitNot"),QZ=lt(Or,"|").setParameterLength(2).setName("bitOr"),JZ=lt(Or,"^").setParameterLength(2).setName("bitXor"),eK=lt(Or,"<<").setParameterLength(2).setName("shiftLeft"),tK=lt(Or,">>").setParameterLength(2).setName("shiftRight"),nK=Ae(([i])=>(i.addAssign(1),i)),iK=Ae(([i])=>(i.subAssign(1),i)),rK=Ae(([i])=>{let e=fe(i).toConst();return i.addAssign(1),e}),sK=Ae(([i])=>{let e=fe(i).toConst();return i.subAssign(1),e});Be("add",us);Be("sub",ni);Be("mul",bn);Be("div",Il);Be("mod",CC);Be("equal",zZ);Be("notEqual",VZ);Be("lessThan",qZ);Be("greaterThan",b7);Be("lessThanEqual",HZ);Be("greaterThanEqual",WZ);Be("and",jZ);Be("or",XZ);Be("not",$Z);Be("xor",YZ);Be("bitAnd",ZZ);Be("bitNot",KZ);Be("bitOr",QZ);Be("bitXor",JZ);Be("shiftLeft",eK);Be("shiftRight",tK);Be("incrementBefore",nK);Be("decrementBefore",iK);Be("increment",rK);Be("decrement",sK);var Re=class i extends dr{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=Il(1,t);else if(r===i.DIFFERENCE)s=Qi(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=Qo(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===po&&r===i.STEP?f.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):u===po&&(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===qa&&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 RC=se(1e-6),sxe=se(1e6),xM=se(Math.PI),oxe=se(Math.PI*2),axe=se(Math.PI*2),lxe=se(Math.PI*.5),oK=lt(Re,Re.ALL).setParameterLength(1),aK=lt(Re,Re.ANY).setParameterLength(1),lK=lt(Re,Re.RADIANS).setParameterLength(1),cK=lt(Re,Re.DEGREES).setParameterLength(1),w7=lt(Re,Re.EXP).setParameterLength(1),E1=lt(Re,Re.EXP2).setParameterLength(1),PC=lt(Re,Re.LOG).setParameterLength(1),wh=lt(Re,Re.LOG2).setParameterLength(1),Ma=lt(Re,Re.SQRT).setParameterLength(1),S7=lt(Re,Re.INVERSE_SQRT).setParameterLength(1),Sh=lt(Re,Re.FLOOR).setParameterLength(1),IC=lt(Re,Re.CEIL).setParameterLength(1),Qo=lt(Re,Re.NORMALIZE).setParameterLength(1),iu=lt(Re,Re.FRACT).setParameterLength(1),Sa=lt(Re,Re.SIN).setParameterLength(1),uK=lt(Re,Re.SINH).setParameterLength(1),Jc=lt(Re,Re.COS).setParameterLength(1),hK=lt(Re,Re.COSH).setParameterLength(1),fK=lt(Re,Re.TAN).setParameterLength(1),dK=lt(Re,Re.TANH).setParameterLength(1),pK=lt(Re,Re.ASIN).setParameterLength(1),AK=lt(Re,Re.ASINH).setParameterLength(1),T7=lt(Re,Re.ACOS).setParameterLength(1),mK=lt(Re,Re.ACOSH).setParameterLength(1),E7=lt(Re,Re.ATAN).setParameterLength(1,2),gK=lt(Re,Re.ATANH).setParameterLength(1),Qi=lt(Re,Re.ABS).setParameterLength(1),M7=lt(Re,Re.SIGN).setParameterLength(1),Th=lt(Re,Re.LENGTH).setParameterLength(1),C7=lt(Re,Re.NEGATE).setParameterLength(1),_K=lt(Re,Re.ONE_MINUS).setParameterLength(1),R7=lt(Re,Re.DFDX).setParameterLength(1),P7=lt(Re,Re.DFDY).setParameterLength(1),xK=lt(Re,Re.ROUND).setParameterLength(1),yK=lt(Re,Re.RECIPROCAL).setParameterLength(1),I7=lt(Re,Re.TRUNC).setParameterLength(1),N7=lt(Re,Re.FWIDTH).setParameterLength(1),vK=lt(Re,Re.TRANSPOSE).setParameterLength(1),bK=lt(Re,Re.DETERMINANT).setParameterLength(1),wK=lt(Re,Re.INVERSE).setParameterLength(1),Qa=lt(Re,Re.MIN).setParameterLength(2,1/0),br=lt(Re,Re.MAX).setParameterLength(2,1/0),Cm=lt(Re,Re.STEP).setParameterLength(2),SK=lt(Re,Re.REFLECT).setParameterLength(2),TK=lt(Re,Re.DISTANCE).setParameterLength(2),EK=lt(Re,Re.DIFFERENCE).setParameterLength(2),pc=lt(Re,Re.DOT).setParameterLength(2),Yf=lt(Re,Re.CROSS).setParameterLength(2),uc=lt(Re,Re.POW).setParameterLength(2),L7=i=>bn(i,i),MK=i=>bn(i,i,i),D7=i=>bn(i,i,i,i),CK=lt(Re,Re.TRANSFORM_DIRECTION).setParameterLength(2),RK=(i,e)=>Qo(bn(e,Lt(pe(i),0)).xyz),PK=(i,e)=>Qo(Lt(pe(i),0).mul(e).xyz),IK=i=>bn(M7(i),uc(Qi(i),1/3)),F7=i=>pc(i,i),jn=lt(Re,Re.MIX).setParameterLength(3),ru=(i,e=0,t=1)=>new Re(Re.CLAMP,Vt(i),Vt(e),Vt(t)),NC=i=>ru(i),O7=lt(Re,Re.REFRACT).setParameterLength(3),Nl=lt(Re,Re.SMOOTHSTEP).setParameterLength(3),B7=lt(Re,Re.FACEFORWARD).setParameterLength(3),NK=Ae(([i])=>{let n=43758.5453,r=pc(i.xy,ft(12.9898,78.233)),s=CC(r,xM);return iu(Sa(s).mul(n))}),LK=(i,e,t)=>jn(e,t,i),DK=(i,e,t)=>Nl(e,t,i),FK=(i,e)=>Cm(e,i),cxe=B7,uxe=S7;Be("all",oK);Be("any",aK);Be("radians",lK);Be("degrees",cK);Be("exp",w7);Be("exp2",E1);Be("log",PC);Be("log2",wh);Be("sqrt",Ma);Be("inverseSqrt",S7);Be("floor",Sh);Be("ceil",IC);Be("normalize",Qo);Be("fract",iu);Be("sin",Sa);Be("sinh",uK);Be("cos",Jc);Be("cosh",hK);Be("tan",fK);Be("tanh",dK);Be("asin",pK);Be("asinh",AK);Be("acos",T7);Be("acosh",mK);Be("atan",E7);Be("atanh",gK);Be("abs",Qi);Be("sign",M7);Be("length",Th);Be("lengthSq",F7);Be("negate",C7);Be("oneMinus",_K);Be("dFdx",R7);Be("dFdy",P7);Be("round",xK);Be("reciprocal",yK);Be("trunc",I7);Be("fwidth",N7);Be("min",Qa);Be("max",br);Be("step",FK);Be("reflect",SK);Be("distance",TK);Be("dot",pc);Be("cross",Yf);Be("pow",uc);Be("pow2",L7);Be("pow3",MK);Be("pow4",D7);Be("transformDirection",CK);Be("transformNormalByViewMatrix",RK);Be("transformNormalByInverseViewMatrix",PK);Be("mix",LK);Be("clamp",ru);Be("refract",O7);Be("smoothstep",DK);Be("faceForward",B7);Be("difference",EK);Be("saturate",NC);Be("cbrt",IK);Be("transpose",vK);Be("determinant",bK);Be("inverse",wK);Be("rand",NK);var D8=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?Kf(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 c7(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 B1=i=>c7(i),xb=i=>c7(i),qv=(...i)=>c7(i),G1e=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),sY=new WeakMap;function MZ(i){return G1e.get(i)}function hM(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 CZ(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 Br)}function z1e(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 Br)}function V1e(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 Br)}function e0(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 u7(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 T_(...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"?H1e(e[0]):null}function RZ(i){let e=sY.get(i);return e===void 0&&(e={},sY.set(i,e)),e}function q1e(i){let e="",t=new Uint8Array(i);for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function H1e(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0)).buffer}var m1={VERTEX:"vertex",FRAGMENT:"fragment"},_n={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},W1e={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},To={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},PZ=["fragment","vertex"],sM=["setup","analyze","generate"],oM=[...PZ,"compute"],Um=["x","y","z","w"],j1e={analyze:"setup",generate:"analyze"},X1e=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=X1e++,this.stackTrace=null,i.captureStackTrace===!0&&(this.stackTrace=new Br)}set needsUpdate(e){e===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=jc.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(B1(r.slice(0,-4)),s.getCacheKey(e,t));this._cacheKey=qv(xb(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=j1e[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 Yf=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} ]`}},fM=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)}},S8=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)}},$1e=Um.join(""),dM=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(Um.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===$1e.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}},T8=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=Um[p];x===n[0]?(f.push(l),p+=n.length-1):f.push(c+"."+x)}return`${e.getType(s)}( ${f.join(", ")} )`}},E8=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=Um[f];p===t[u]?(c.push("1.0 - "+(a+"."+p)),u++):c.push(a+"."+p)}return`${e.getType(r)}( ${c.join(", ")} )`}},Qv=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?e0(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=e0(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=q1e(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?u7(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.")}},oY=/float|u?int/,Ac=class extends Qv{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 oY.test(n)&&oY.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),n,t)}},M8=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}},r0=null,C8=new Map;function Be(i,e){if(C8.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`);C8.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 Y1e=i=>i.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),aY=i=>Y1e(i).split("").sort().join("");$t.prototype.assign=function(...i){if(this.isStackNode!==!0)return r0!==null?r0.assign(this,...i):Ge("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new Br),this;{let e=C8.get("assign");return this.addToStack(e(...i))}};$t.prototype.toVarIntent=function(){return this};$t.prototype.get=function(i){return new M8(this,i)};var Hv={};function bE(i,e,t){Hv[i]=Hv[e]=Hv[t]={get(){this._cache=this._cache||{};let o=this._cache[i];return o===void 0&&(o=new dM(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=aY(i);return new T8(this,a,Vt(o))},$t.prototype["flip"+n]=$t.prototype["flip"+r]=$t.prototype["flip"+s]=function(){let o=aY(i);return new E8(this,o)}}var dh=["x","y","z","w"],ph=["r","g","b","a"],Ah=["s","t","p","q"];for(let i=0;i<4;i++){let e=dh[i],t=ph[i],n=Ah[i];bE(e,t,n);for(let r=0;r<4;r++){e=dh[i]+dh[r],t=ph[i]+ph[r],n=Ah[i]+Ah[r],bE(e,t,n);for(let s=0;s<4;s++){e=dh[i]+dh[r]+dh[s],t=ph[i]+ph[r]+ph[s],n=Ah[i]+Ah[r]+Ah[s],bE(e,t,n);for(let o=0;o<4;o++)e=dh[i]+dh[r]+dh[s]+dh[o],t=ph[i]+ph[r]+ph[s]+ph[o],n=Ah[i]+Ah[r]+Ah[s]+Ah[o],bE(e,t,n)}}}for(let i=0;i<32;i++)Hv[i]={get(){this._cache=this._cache||{};let e=this._cache[i];return e===void 0&&(e=new Yf(this,new Ac(i,"uint")),this._cache[i]=e),e},set(e){this[i].assign(Vt(e))}};Object.defineProperties($t.prototype,Hv);var Z1e=function(i,e=null){let t=e0(i);return t==="node"?i:e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string"?Vt(I8(i,e)):t==="shader"?i.isFn?i:Ae(i):i},K1e=function(i,e=null){for(let t in i)i[t]=Vt(i[t],e);return i},Q1e=function(i,e=null){let t=i.length;for(let n=0;n<t;n++)i[n]=Vt(i[n],e);return i},IZ=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 Br),u.concat(new Array(a-u.length).fill(0))):l!==void 0&&u.length>l?(Ge(`TSL: "${f}" parameter length exceeds limit.`,new Br),u.slice(0,l)):u}return e===null?s=(...u)=>r(new i(...bm(c(u)))):t!==null?(t=Vt(t),s=(...u)=>r(new i(e,...bm(c(u)),t))):s=(...u)=>r(new i(e,...bm(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},J1e=function(i,...e){return new i(...bm(e))},R8=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(NZ(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?exe(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?txe(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 NZ(i){return i[0]&&(i[0].isNode||Object.getPrototypeOf(i[0])!==Object.prototype)}function exe(i){let e;return EC(i),NZ(i)?e=[...i]:e=i[0],e}function txe(i){let e=0;return EC(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 P8=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 R8(this,e)}setup(){return this.call()}},nxe=[!1,!0],ixe=[0,1,2,3],rxe=[-1,-2],LZ=[.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],h7=new Map;for(let i of nxe)h7.set(i,new Ac(i));var f7=new Map;for(let i of ixe)f7.set(i,new Ac(i,"uint"));var d7=new Map([...f7].map(i=>new Ac(i.value,"int")));for(let i of rxe)d7.set(i,new Ac(i,"int"));var SC=new Map([...d7].map(i=>new Ac(i.value)));for(let i of LZ)SC.set(i,new Ac(i));for(let i of LZ)SC.set(-i,new Ac(-i));var TC={bool:h7,uint:f7,ints:d7,float:SC},lY=new Map([...h7,...SC]),I8=(i,e)=>lY.has(i)?lY.get(i):i.isNode===!0?i:new Ac(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 Br),new Ac(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=[u7(i,...t)]),t.length===1&&e!==null&&e.has(t[0]))return zv(e.get(t[0]));if(t.length===1){let r=I8(t[0],i);return r.nodeType===i?zv(r):zv(new fM(r,i))}let n=t.map(r=>I8(r));return zv(new S8(n,i))}};function M1(i){return i&&i.isNode&&i.traverse(e=>{e.isConstNode&&(i=e.value)}),!!i}var DZ=i=>i!=null?i.nodeType||i.convertTo||(typeof i=="string"?i:null):null;function x1(i,e){return new P8(i,e)}var Vt=(i,e=null)=>Z1e(i,e),zv=(i,e=null)=>Vt(i,e).toVarIntent(),EC=(i,e=null)=>new K1e(i,e),bm=(i,e=null)=>new Q1e(i,e),qn=(i,e=null,t=null,n=null)=>new IZ(i,e,t,n),xt=(i,...e)=>new J1e(i,...e),lt=(i,e=null,t=null,n={})=>new IZ(i,e,t,{...n,intent:!0}),p7=(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)}}),sxe=0,N8=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 Br),t=null)),this.shaderNode=new x1(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"+sxe++,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 N8(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 Jv=i=>{r0=i},A7=()=>r0,Wt=(...i)=>r0.If(...i),oxe=(...i)=>r0.Switch(...i);function MC(i){return r0&&r0.addToStack(i),i}Be("toStack",MC);var FZ=new Rs("color"),se=new Rs("float",TC.float),fe=new Rs("int",TC.ints),it=new Rs("uint",TC.uint),Il=new Rs("bool",TC.bool),ft=new Rs("vec2"),wr=new Rs("ivec2"),m7=new Rs("uvec2"),OZ=new Rs("bvec2"),pe=new Rs("vec3"),g7=new Rs("ivec3"),km=new Rs("uvec3"),_7=new Rs("bvec3"),Lt=new Rs("vec4"),x7=new Rs("ivec4"),y7=new Rs("uvec4"),BZ=new Rs("bvec4"),CC=new Rs("mat2"),ro=new Rs("mat3"),n0=new Rs("mat4");Be("toColor",FZ);Be("toFloat",se);Be("toInt",fe);Be("toUint",it);Be("toBool",Il);Be("toVec2",ft);Be("toIVec2",wr);Be("toUVec2",m7);Be("toBVec2",OZ);Be("toVec3",pe);Be("toIVec3",g7);Be("toUVec3",km);Be("toBVec3",_7);Be("toVec4",Lt);Be("toIVec4",x7);Be("toUVec4",y7);Be("toBVec4",BZ);Be("toMat2",CC);Be("toMat3",ro);Be("toMat4",n0);var UZ=qn(Yf).setParameterLength(2),kZ=(i,e)=>new fM(Vt(i),e),axe=(i,e)=>new dM(Vt(i),e);Be("element",UZ);Be("convert",kZ);var lxe=i=>(je("TSL: append() has been renamed to Stack().",new Br),MC(i));Be("append",i=>(je("TSL: .append() has been renamed to .toStack().",new Br),MC(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 B1(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)}},Qf=(i,e,t=null)=>new fi(i,e,!1,t),Gm=(i,e,t=null)=>new fi(i,e,!0,t),Mi=xt(fi,"vec4","DiffuseColor"),mm=xt(fi,"vec3","DiffuseContribution"),L8=xt(fi,"vec3","EmissiveColor"),bh=xt(fi,"float","Roughness"),$f=xt(fi,"float","Metalness"),pM=xt(fi,"float","Clearcoat"),v1=xt(fi,"float","ClearcoatRoughness"),Ml=xt(fi,"vec3","Sheen"),Yp=xt(fi,"float","SheenRoughness"),RC=xt(fi,"float","Iridescence"),AM=xt(fi,"float","IridescenceIOR"),mM=xt(fi,"float","IridescenceThickness"),gM=xt(fi,"float","AlphaT"),$p=xt(fi,"float","Anisotropy"),Wv=xt(fi,"vec3","AnisotropyT"),wm=xt(fi,"vec3","AnisotropyB"),s0=xt(fi,"color","SpecularColor"),_m=xt(fi,"color","SpecularColorBlended"),xm=xt(fi,"float","SpecularF90"),_M=xt(fi,"float","Shininess"),b1=xt(fi,"output","Output"),Sm=xt(fi,"float","dashSize"),eb=xt(fi,"float","gapSize"),cxe=xt(fi,"float","pointWidth"),jv=xt(fi,"float","IOR"),xM=xt(fi,"float","Transmission"),v7=xt(fi,"float","Thickness"),b7=xt(fi,"float","AttenuationDistance"),w7=xt(fi,"color","AttenuationColor"),S7=xt(fi,"float","Dispersion"),D8=xt(fi,"float","AmbientOcclusion",!1,1),yM=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}},GZ=(i,e=1,t=null)=>new yM(i,!1,e,t),PC=(i,e=0,t=null)=>new yM(i,!0,e,t),uxe=PC("frame",0,_n.FRAME),Zt=PC("render",0,_n.RENDER),zZ=GZ("object",1,_n.OBJECT),Rm=class extends Qv{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=zZ}setName(e){return this.name=e,this}label(e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.',new Br),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=DZ(e||i);if(t===i&&(i=u7(t)),i&&i.isNode===!0){let n=i.value;i.traverse(r=>{r.isConstNode===!0&&(n=r.value)}),i=n}return new Rm(i,t)},vM=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)}},VZ=(...i)=>{let e;if(i.length===1){let t=i[0];e=new vM(null,t.length,t)}else{let t=i[0],n=i[1];e=new vM(t,n)}return Vt(e)};Be("toArray",(i,e)=>VZ(Array(e).fill(i)));var F8=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 Um.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)}},qZ=qn(F8).setParameterLength(2);Be("assign",qZ);var O8=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(", ")} )`}},HZ=(i,...e)=>(e=e.length>1||e[0]&&e[0].isNode===!0?bm(e):EC(e[0]),new O8(Vt(i),e));Be("call",HZ);var hxe={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},Ur=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(hxe[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===Ao;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(Ur,"+").setParameterLength(2,1/0).setName("add"),ni=lt(Ur,"-").setParameterLength(2,1/0).setName("sub"),bn=lt(Ur,"*").setParameterLength(2,1/0).setName("mul"),Nl=lt(Ur,"/").setParameterLength(2,1/0).setName("div"),IC=lt(Ur,"%").setParameterLength(2).setName("mod"),WZ=lt(Ur,"==").setParameterLength(2).setName("equal"),jZ=lt(Ur,"!=").setParameterLength(2).setName("notEqual"),XZ=lt(Ur,"<").setParameterLength(2).setName("lessThan"),T7=lt(Ur,">").setParameterLength(2).setName("greaterThan"),$Z=lt(Ur,"<=").setParameterLength(2).setName("lessThanEqual"),YZ=lt(Ur,">=").setParameterLength(2).setName("greaterThanEqual"),ZZ=lt(Ur,"&&").setParameterLength(2,1/0).setName("and"),KZ=lt(Ur,"||").setParameterLength(2,1/0).setName("or"),QZ=lt(Ur,"!").setParameterLength(1).setName("not"),JZ=lt(Ur,"^^").setParameterLength(2).setName("xor"),eK=lt(Ur,"&").setParameterLength(2).setName("bitAnd"),tK=lt(Ur,"~").setParameterLength(1).setName("bitNot"),nK=lt(Ur,"|").setParameterLength(2).setName("bitOr"),iK=lt(Ur,"^").setParameterLength(2).setName("bitXor"),rK=lt(Ur,"<<").setParameterLength(2).setName("shiftLeft"),sK=lt(Ur,">>").setParameterLength(2).setName("shiftRight"),oK=Ae(([i])=>(i.addAssign(1),i)),aK=Ae(([i])=>(i.subAssign(1),i)),lK=Ae(([i])=>{let e=fe(i).toConst();return i.addAssign(1),e}),cK=Ae(([i])=>{let e=fe(i).toConst();return i.subAssign(1),e});Be("add",fs);Be("sub",ni);Be("mul",bn);Be("div",Nl);Be("mod",IC);Be("equal",WZ);Be("notEqual",jZ);Be("lessThan",XZ);Be("greaterThan",T7);Be("lessThanEqual",$Z);Be("greaterThanEqual",YZ);Be("and",ZZ);Be("or",KZ);Be("not",QZ);Be("xor",JZ);Be("bitAnd",eK);Be("bitNot",tK);Be("bitOr",nK);Be("bitXor",iK);Be("shiftLeft",rK);Be("shiftRight",sK);Be("incrementBefore",oK);Be("decrementBefore",aK);Be("increment",lK);Be("decrement",cK);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=Nl(1,t);else if(r===i.DIFFERENCE)s=Qi(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===Ao&&r===i.STEP?f.push(a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":o),l.build(e,o)):u===Ao&&(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 NC=se(1e-6),fxe=se(1e6),bM=se(Math.PI),dxe=se(Math.PI*2),pxe=se(Math.PI*2),Axe=se(Math.PI*.5),uK=lt(Re,Re.ALL).setParameterLength(1),hK=lt(Re,Re.ANY).setParameterLength(1),fK=lt(Re,Re.RADIANS).setParameterLength(1),dK=lt(Re,Re.DEGREES).setParameterLength(1),E7=lt(Re,Re.EXP).setParameterLength(1),C1=lt(Re,Re.EXP2).setParameterLength(1),LC=lt(Re,Re.LOG).setParameterLength(1),Sh=lt(Re,Re.LOG2).setParameterLength(1),Ca=lt(Re,Re.SQRT).setParameterLength(1),M7=lt(Re,Re.INVERSE_SQRT).setParameterLength(1),Th=lt(Re,Re.FLOOR).setParameterLength(1),DC=lt(Re,Re.CEIL).setParameterLength(1),Jo=lt(Re,Re.NORMALIZE).setParameterLength(1),ru=lt(Re,Re.FRACT).setParameterLength(1),Ta=lt(Re,Re.SIN).setParameterLength(1),pK=lt(Re,Re.SINH).setParameterLength(1),eu=lt(Re,Re.COS).setParameterLength(1),AK=lt(Re,Re.COSH).setParameterLength(1),mK=lt(Re,Re.TAN).setParameterLength(1),gK=lt(Re,Re.TANH).setParameterLength(1),_K=lt(Re,Re.ASIN).setParameterLength(1),xK=lt(Re,Re.ASINH).setParameterLength(1),C7=lt(Re,Re.ACOS).setParameterLength(1),yK=lt(Re,Re.ACOSH).setParameterLength(1),R7=lt(Re,Re.ATAN).setParameterLength(1,2),vK=lt(Re,Re.ATANH).setParameterLength(1),Qi=lt(Re,Re.ABS).setParameterLength(1),P7=lt(Re,Re.SIGN).setParameterLength(1),Eh=lt(Re,Re.LENGTH).setParameterLength(1),I7=lt(Re,Re.NEGATE).setParameterLength(1),bK=lt(Re,Re.ONE_MINUS).setParameterLength(1),N7=lt(Re,Re.DFDX).setParameterLength(1),L7=lt(Re,Re.DFDY).setParameterLength(1),wK=lt(Re,Re.ROUND).setParameterLength(1),SK=lt(Re,Re.RECIPROCAL).setParameterLength(1),D7=lt(Re,Re.TRUNC).setParameterLength(1),F7=lt(Re,Re.FWIDTH).setParameterLength(1),TK=lt(Re,Re.TRANSPOSE).setParameterLength(1),EK=lt(Re,Re.DETERMINANT).setParameterLength(1),MK=lt(Re,Re.INVERSE).setParameterLength(1),Ja=lt(Re,Re.MIN).setParameterLength(2,1/0),Sr=lt(Re,Re.MAX).setParameterLength(2,1/0),Pm=lt(Re,Re.STEP).setParameterLength(2),CK=lt(Re,Re.REFLECT).setParameterLength(2),RK=lt(Re,Re.DISTANCE).setParameterLength(2),PK=lt(Re,Re.DIFFERENCE).setParameterLength(2),mc=lt(Re,Re.DOT).setParameterLength(2),Zf=lt(Re,Re.CROSS).setParameterLength(2),fc=lt(Re,Re.POW).setParameterLength(2),O7=i=>bn(i,i),IK=i=>bn(i,i,i),B7=i=>bn(i,i,i,i),NK=lt(Re,Re.TRANSFORM_DIRECTION).setParameterLength(2),LK=(i,e)=>Jo(bn(e,Lt(pe(i),0)).xyz),DK=(i,e)=>Jo(Lt(pe(i),0).mul(e).xyz),FK=i=>bn(P7(i),fc(Qi(i),1/3)),U7=i=>mc(i,i),Xn=lt(Re,Re.MIX).setParameterLength(3),su=(i,e=0,t=1)=>new Re(Re.CLAMP,Vt(i),Vt(e),Vt(t)),FC=i=>su(i),k7=lt(Re,Re.REFRACT).setParameterLength(3),Ll=lt(Re,Re.SMOOTHSTEP).setParameterLength(3),G7=lt(Re,Re.FACEFORWARD).setParameterLength(3),OK=Ae(([i])=>{let n=43758.5453,r=mc(i.xy,ft(12.9898,78.233)),s=IC(r,bM);return ru(Ta(s).mul(n))}),BK=(i,e,t)=>Xn(e,t,i),UK=(i,e,t)=>Ll(e,t,i),kK=(i,e)=>Pm(e,i),mxe=G7,gxe=M7;Be("all",uK);Be("any",hK);Be("radians",fK);Be("degrees",dK);Be("exp",E7);Be("exp2",C1);Be("log",LC);Be("log2",Sh);Be("sqrt",Ca);Be("inverseSqrt",M7);Be("floor",Th);Be("ceil",DC);Be("normalize",Jo);Be("fract",ru);Be("sin",Ta);Be("sinh",pK);Be("cos",eu);Be("cosh",AK);Be("tan",mK);Be("tanh",gK);Be("asin",_K);Be("asinh",xK);Be("acos",C7);Be("acosh",yK);Be("atan",R7);Be("atanh",vK);Be("abs",Qi);Be("sign",P7);Be("length",Eh);Be("lengthSq",U7);Be("negate",I7);Be("oneMinus",bK);Be("dFdx",N7);Be("dFdy",L7);Be("round",wK);Be("reciprocal",SK);Be("trunc",D7);Be("fwidth",F7);Be("min",Ja);Be("max",Sr);Be("step",kK);Be("reflect",CK);Be("distance",RK);Be("dot",mc);Be("cross",Zf);Be("pow",fc);Be("pow2",O7);Be("pow3",IK);Be("pow4",B7);Be("transformDirection",NK);Be("transformNormalByViewMatrix",LK);Be("transformNormalByInverseViewMatrix",DK);Be("mix",BK);Be("clamp",su);Be("refract",k7);Be("smoothstep",UK);Be("faceForward",G7);Be("difference",PK);Be("saturate",FC);Be("cbrt",FK);Be("transpose",TK);Be("determinant",EK);Be("inverse",MK);Be("rand",OK);var B8=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?Qf(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)}},Ko=Vn(D8).setParameterLength(2,3);Be("select",Ko);var Jv=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}},Qf=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new Jv(t,e)},OK=i=>Qf(i,{uniformFlow:!0}),U7=(i,e)=>Qf(i,{nodeName:e});function BK(i,e,t=null){return Qf(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function UK(i,e=null){return Qf(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function kK(i,e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.'),U7(i,e)}Be("context",Qf);Be("label",kK);Be("uniformFlow",OK);Be("setName",U7);Be("builtinShadowContext",(i,e,t)=>BK(e,t,i));Be("builtinAOContext",(i,e)=>UK(e,i));var v1=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}},k7=Vn(v1),GK=(i,e=null)=>k7(i,e).toStack(),zK=(i,e=null)=>k7(i,e,!0).toStack(),VK=i=>k7(i).setIntent(!0).toStack();Be("toVar",GK);Be("toConst",zK);Be("toVarIntent",VK);var F8=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}},wm=(i,e,t=null)=>new F8(Vt(i),e,t),O8=class extends $t{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=wm(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=wm(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(p1.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(p1.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,p1.VERTEX);if(e.shaderStage===p1.VERTEX){let a=n.node.build(e,s);e.addLineFlowCode(`${o} = ${a}`,this)}else e.flowNodeFromShaderStage(p1.VERTEX,n.node,s,o);n[t]=o}return e.getPropertyName(r)}},a0=Vn(O8).setParameterLength(1,2),qK=i=>a0(i);Be("toVarying",a0);Be("toVertexStage",qK);var HK=Ae(([i])=>{let e=i.mul(.9478672986).add(.0521327014).pow(2.4),t=i.mul(.0773993808),n=i.lessThanEqual(.04045);return jn(e,t,n)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),WK=Ae(([i])=>{let e=i.pow(.41666).mul(1.055).sub(.055),t=i.mul(12.92),n=i.lessThanEqual(.0031308);return jn(e,t,n)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),G7="WorkingColorSpace",hxe="OutputColorSpace",eb=class extends dr{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===G7?sn.workingColorSpace:t===hxe?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(HK(s.rgb),s.a)),sn.getPrimaries(n)!==sn.getPrimaries(r)&&(s=Lt(io(sn._getMatrix(new Sn,n,r)).mul(s.rgb),s.a)),sn.getTransfer(r)===Bt&&(s=Lt(WK(s.rgb),s.a))),s}},jK=(i,e)=>new eb(Vt(i),G7,e),LC=(i,e)=>new eb(Vt(i),e,G7),fxe=(i,e,t)=>new eb(Vt(i),e,t);Be("workingToColorSpace",jK);Be("colorSpaceToWorking",LC);var dxe=class extends $f{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)}},yM=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 dxe(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}},pxe=(i,e,t)=>new yM(i,e,t),B8=class extends yM{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}},XK=(i,e,t=null)=>new B8(i,e,t),U8=class extends dr{static get type(){return"ToneMappingNode"}constructor(e,t=YK,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return zv(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===ks)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}},$K=(i,e,t)=>new U8(i,Vt(e),Vt(t)),YK=XK("toneMappingExposure","float");Be("toneMapping",(i,e,t)=>$K(e,t,i));var sY=new WeakMap;function oY(i,e){let t=sY.get(i);return t===void 0&&(t=new Mf(i,e),sY.set(i,t)),t}var yh=class extends Zv{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=Vd,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=oY(r.array,s):a=oY(r,s);let l=new mo(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=a0(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 DC(i,e=null,t=0,n=0,r=Vd,s=!1){return e==="mat3"||e===null&&i.itemSize===9?io(new yh(i,"vec3",9,0).setUsage(r).setInstanced(s),new yh(i,"vec3",9,3).setUsage(r).setInstanced(s),new yh(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?e0(new yh(i,"vec4",16,0).setUsage(r).setInstanced(s),new yh(i,"vec4",16,4).setUsage(r).setInstanced(s),new yh(i,"vec4",16,8).setUsage(r).setInstanced(s),new yh(i,"vec4",16,12).setUsage(r).setInstanced(s)):new yh(i,e,t,n).setUsage(r)}var z7=(i,e=null,t=0,n=0)=>DC(i,e,t,n),Axe=(i,e=null,t=0,n=0)=>DC(i,e,t,n,GA),FC=(i,e=null,t=0,n=0)=>DC(i,e,t,n,Vd,!0),V7=(i,e=null,t=0,n=0)=>DC(i,e,t,n,GA,!0);Be("toAttribute",i=>z7(i.value));var Ms=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=a0(this).build(e,t),s}};Ms.VERTEX="vertex";Ms.INSTANCE="instance";Ms.SUBGROUP="subgroup";Ms.INVOCATION_LOCAL="invocationLocal";Ms.INVOCATION_SUBGROUP="invocationSubgroup";Ms.DRAW="draw";var ZK=xt(Ms,Ms.VERTEX),nu=xt(Ms,Ms.INSTANCE),mxe=xt(Ms,Ms.SUBGROUP),gxe=xt(Ms,Ms.INVOCATION_SUBGROUP),_xe=xt(Ms,Ms.INVOCATION_LOCAL),KK=xt(Ms,Ms.DRAW),k8=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 Fr),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=nu.build(e,"uint");e.flow.code=`${e.tab}if ( ${o} >= ${s} ) { return; }4145+`);return e.format(u,n,t)}},Qo=qn(B8).setParameterLength(2,3);Be("select",Qo);var tb=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}},Jf=(i=null,e={})=>{let t=i;return(t===null||t.isNode!==!0)&&(e=t||e,t=null),new tb(t,e)},GK=i=>Jf(i,{uniformFlow:!0}),z7=(i,e)=>Jf(i,{nodeName:e});function zK(i,e,t=null){return Jf(t,{getShadow:({light:n,shadowColorNode:r})=>e===n?r.mul(i):r})}function VK(i,e=null){return Jf(e,{getAO:(t,{material:n})=>n.transparent===!0?t:t!==null?t.mul(i):i})}function qK(i,e){return je('TSL: "label()" has been deprecated. Use "setName()" instead.'),z7(i,e)}Be("context",Jf);Be("label",qK);Be("uniformFlow",GK);Be("setName",z7);Be("builtinShadowContext",(i,e,t)=>zK(e,t,i));Be("builtinAOContext",(i,e)=>VK(e,i));var w1=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}},V7=qn(w1),HK=(i,e=null)=>V7(i,e).toStack(),WK=(i,e=null)=>V7(i,e,!0).toStack(),jK=i=>V7(i).setIntent(!0).toStack();Be("toVar",HK);Be("toConst",WK);Be("toVarIntent",jK);var U8=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}},Tm=(i,e,t=null)=>new U8(Vt(i),e,t),k8=class extends $t{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=Tm(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=Tm(this.node,"VERTEX")}return n.needsInterpolation||(n.needsInterpolation=e.shaderStage==="fragment"),n}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(m1.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(m1.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,m1.VERTEX);if(e.shaderStage===m1.VERTEX){let a=n.node.build(e,s);e.addLineFlowCode(`${o} = ${a}`,this)}else e.flowNodeFromShaderStage(m1.VERTEX,n.node,s,o);n[t]=o}return e.getPropertyName(r)}},c0=qn(k8).setParameterLength(1,2),XK=i=>c0(i);Be("toVarying",c0);Be("toVertexStage",XK);var $K=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"}]}),YK=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"}]}),q7="WorkingColorSpace",_xe="OutputColorSpace",nb=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===q7?sn.workingColorSpace:t===_xe?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($K(s.rgb),s.a)),sn.getPrimaries(n)!==sn.getPrimaries(r)&&(s=Lt(ro(sn._getMatrix(new Sn,n,r)).mul(s.rgb),s.a)),sn.getTransfer(r)===Bt&&(s=Lt(YK(s.rgb),s.a))),s}},ZK=(i,e)=>new nb(Vt(i),q7,e),OC=(i,e)=>new nb(Vt(i),e,q7),xxe=(i,e,t)=>new nb(Vt(i),e,t);Be("workingToColorSpace",ZK);Be("colorSpaceToWorking",OC);var yxe=class extends Yf{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)}},wM=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 yxe(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}},vxe=(i,e,t)=>new wM(i,e,t),G8=class extends wM{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}},KK=(i,e,t=null)=>new G8(i,e,t),z8=class extends pr{static get type(){return"ToneMappingNode"}constructor(e,t=JK,n=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=n}customCacheKey(){return qv(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===Gs)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}},QK=(i,e,t)=>new z8(i,Vt(e),Vt(t)),JK=KK("toneMappingExposure","float");Be("toneMapping",(i,e,t)=>QK(e,t,i));var cY=new WeakMap;function uY(i,e){let t=cY.get(i);return t===void 0&&(t=new Cf(i,e),cY.set(i,t)),t}var vh=class extends Qv{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=Hd,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=uY(r.array,s):a=uY(r,s);let l=new go(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=c0(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 BC(i,e=null,t=0,n=0,r=Hd,s=!1){return e==="mat3"||e===null&&i.itemSize===9?ro(new vh(i,"vec3",9,0).setUsage(r).setInstanced(s),new vh(i,"vec3",9,3).setUsage(r).setInstanced(s),new vh(i,"vec3",9,6).setUsage(r).setInstanced(s)):e==="mat4"||e===null&&i.itemSize===16?n0(new vh(i,"vec4",16,0).setUsage(r).setInstanced(s),new vh(i,"vec4",16,4).setUsage(r).setInstanced(s),new vh(i,"vec4",16,8).setUsage(r).setInstanced(s),new vh(i,"vec4",16,12).setUsage(r).setInstanced(s)):new vh(i,e,t,n).setUsage(r)}var H7=(i,e=null,t=0,n=0)=>BC(i,e,t,n),bxe=(i,e=null,t=0,n=0)=>BC(i,e,t,n,VA),UC=(i,e=null,t=0,n=0)=>BC(i,e,t,n,Hd,!0),W7=(i,e=null,t=0,n=0)=>BC(i,e,t,n,VA,!0);Be("toAttribute",i=>H7(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=c0(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 eQ=xt(Cs,Cs.VERTEX),iu=xt(Cs,Cs.INSTANCE),wxe=xt(Cs,Cs.SUBGROUP),Sxe=xt(Cs,Cs.INVOCATION_SUBGROUP),Txe=xt(Cs,Cs.INVOCATION_LOCAL),tQ=xt(Cs,Cs.DRAW),V8=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 Br),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=iu.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 Fr);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 Fr)}for(;e.length<3;)e.push(1);return new k8(Vt(i),e)},QK=(i,e,t)=>{let n=q7(i,t);return typeof e=="number"?n.count=e:n.dispatchSize=e,n};Be("compute",QK);Be("computeKernel",q7);var G8=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}},b1=i=>new G8(Vt(i));function JK(i,e=!0){return je('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),b1(i).setParent(e)}Be("cache",JK);Be("isolate",b1);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)}},eQ=Vn(z8).setParameterLength(2);Be("bypass",eQ);var H7=Ae(([i,e,t,n=se(0),r=se(1),s=Pl(!1)])=>{let o=i.sub(e).div(t.sub(e));return T1(s)&&(o=o.clamp()),o.mul(r.sub(n)).add(n)});function tQ(i,e,t,n=se(0),r=se(1)){return H7(i,e,t,n,r,!0)}Be("remap",H7);Be("remapClamp",tQ);var w1=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)}},Cl=Vn(w1).setParameterLength(1,2),nQ=i=>(i?Ko(i,Cl("discard")):Cl("discard")).toStack(),xxe=()=>Cl("return").toStack();Be("discard",nQ);var W7=Ae(([i])=>Lt(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),iQ=Ae(([i])=>i.a.equal(0).select(Lt(0),Lt(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"}),V8=class extends dr{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=iQ(t);let n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||ks,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||Vo;return n!==ks&&(t=t.toneMapping(n)),r!==Vo&&r!==sn.workingColorSpace&&(t=t.workingToColorSpace(r)),t=W7(t),t}},j7=(i,e=null,t=null)=>new V8(Vt(i),e,t);Be("renderOutput",j7);var q8=class extends dr{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)}}},j7=(i,e=[64])=>{(e.length===0||e.length>3)&&Ge("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new Br);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 Br)}for(;e.length<3;)e.push(1);return new V8(Vt(i),e)},nQ=(i,e,t)=>{let n=j7(i,t);return typeof e=="number"?n.count=e:n.dispatchSize=e,n};Be("compute",nQ);Be("computeKernel",j7);var q8=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}},S1=i=>new q8(Vt(i));function iQ(i,e=!0){return je('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),S1(i).setParent(e)}Be("cache",iQ);Be("isolate",S1);var H8=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)}},rQ=qn(H8).setParameterLength(2);Be("bypass",rQ);var X7=Ae(([i,e,t,n=se(0),r=se(1),s=Il(!1)])=>{let o=i.sub(e).div(t.sub(e));return M1(s)&&(o=o.clamp()),o.mul(r.sub(n)).add(n)});function sQ(i,e,t,n=se(0),r=se(1)){return X7(i,e,t,n,r,!0)}Be("remap",X7);Be("remapClamp",sQ);var T1=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)}},Rl=qn(T1).setParameterLength(1,2),oQ=i=>(i?Qo(i,Rl("discard")):Rl("discard")).toStack(),Exe=()=>Rl("return").toStack();Be("discard",oQ);var $7=Ae(([i])=>Lt(i.rgb.mul(i.a),i.a),{color:"vec4",return:"vec4"}),aQ=Ae(([i])=>i.a.equal(0).select(Lt(0),Lt(i.rgb.div(i.a),i.a)),{color:"vec4",return:"vec4"}),W8=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=aQ(t);let n=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||Gs,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||qo;return n!==Gs&&(t=t.toneMapping(n)),r!==qo&&r!==sn.workingColorSpace&&(t=t.workingToColorSpace(r)),t=$7(t),t}},Y7=(i,e=null,t=null)=>new W8(Vt(i),e,t);Be("renderOutput",Y7);var j8=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-`,AA(o)}return n}},rQ=(i,e=null)=>new q8(Vt(i),e).toStack();Be("debug",rQ);var vM=class extends Go{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(){}},H8=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!==vM&&Zn('TSL: ".toInspector()" is only available with WebGPU.'),t}};function sQ(i,e="",t=null){return i=Vt(i),i.before(new H8(i,e,t))}Be("toInspector",sQ);function yxe(i){je("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}var bM=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):a0(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}},Rl=(i,e=null)=>new bM(i,e),Ri=(i=0)=>Rl("uv"+(i>0?i:""),"vec2"),W8=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)}},Rm=Vn(W8).setParameterLength(1,2),j8=class extends Mm{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))}}},X7=Vn(j8).setParameterLength(1),wM=class extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}},$7=new bs,Ac=class extends Mm{static get type(){return"TextureNode"}constructor(e=$7,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===Ir?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Ri(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(Rm(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 wM("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(Df.TEXTURE_COMPARE))o=this.compareNode;else{let l=n.compareFunction;l===null||l===T_||l===th||l===kA||l===Hc?a=this.compareNode:(o=this.compareNode,Zn('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===kA||K===Hc?j=Cm(Cl(j,a),Cl(N,"float")).build(e,a):j=Cm(Cl(N,"float"),Cl(j,a)).build(e,a)}e.addLineFlowCode(`${l} = ${j}`,this),o.snippet=j,o.propertyName=l}let c=l;return e.needsToWorkingColorSpace(n)&&(c=LC(Cl(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(X7(t)),t.referenceNode=this.getBase();let n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===xi||n.magFilter===xi)&&(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 Rm(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}},vxe=Vn(Ac).setParameterLength(1,4).setName("texture"),ai=(i=$7,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=vxe(i,e,t,n),r},bxe=(i=$7)=>ai(i),Jr=(...i)=>ai(...i).setSampler(!1),wxe=(i,e,t)=>ai(i,e).level(t),Sxe=i=>(i.isNode===!0?i:ai(i)).convert("sampler"),Txe=i=>(i.isNode===!0?i:ai(i)).convert("samplerComparison"),tb=class extends Mm{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"}},O1=(i,e,t)=>new tb(i,e,t),X8=class extends $f{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)}},$8=class extends tb{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?Qp(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 X8(this,Vt(e))}},wo=(i,e)=>new $8(i,e),Y8=class extends $t{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},Jf=Vn(Y8).setParameterLength(1),vv,bv,To=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?bv.copy(t.viewport):(e.getViewport(bv),bv.multiplyScalar(e.getPixelRatio())):this.scope===i.DPR?this._output.value=e.getPixelRatio():t!==null?(vv.width=t.width,vv.height=t.height):e.getDrawingBufferSize(vv)}setup(){let e=this.scope,t=null;return e===i.SIZE?t=Ht(vv||(vv=new Oe)):e===i.VIEWPORT?t=Ht(bv||(bv=new gn)):e===i.DPR?t=Ht(1):t=ft(km.div(Pm)),this._output=t,t}generate(e){if(this.scope===i.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let n=e.getNodeProperties(Pm).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}};To.COORDINATE="coordinate";To.VIEWPORT="viewport";To.SIZE="size";To.UV="uv";To.DPR="dpr";var Y7=xt(To,To.DPR),tu=xt(To,To.UV),Pm=xt(To,To.SIZE),km=xt(To,To.COORDINATE),S1=xt(To,To.VIEWPORT),Z7=S1.zw,oQ=km.sub(S1.xy),Exe=oQ.div(Z7),Mxe=Ae(()=>(je('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new Fr),Pm),"vec2").once()(),O6=null,yE=null,B6=null,vE=null,U6=null,bE=null,k6=null,wE=null,G6=null,SE=null,z6=null,TE=null,V6=null,EE=null,l0=Ht(0,"uint").setName("u_cameraIndex").setGroup(MC("cameraIndex")).toVarying("v_cameraIndex"),$p=Ht("float").setName("cameraNear").setGroup(Zt).onRenderUpdate(({camera:i})=>i.near),Yp=Ht("float").setName("cameraFar").setGroup(Zt).onRenderUpdate(({camera:i})=>i.far),Ea=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrix);yE===null?yE=wo(t).setGroup(Zt).setName("cameraProjectionMatrices"):yE.array=t,e=yE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else O6===null&&(O6=Ht(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=O6;return e}).once()(),aQ=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrixInverse);vE===null?vE=wo(t).setGroup(Zt).setName("cameraProjectionMatricesInverse"):vE.array=t,e=vE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else B6===null&&(B6=Ht(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Zt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=B6;return e}).once()(),c0=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorldInverse);bE===null?bE=wo(t).setGroup(Zt).setName("cameraViewMatrices"):bE.array=t,e=bE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else U6===null&&(U6=Ht(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=U6;return e}).once()(),_b=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorld);wE===null?wE=wo(t).setGroup(Zt).setName("cameraWorldMatrices"):wE.array=t,e=wE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else k6===null&&(k6=Ht(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=k6;return e}).once()(),Cxe=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.normalMatrix);SE===null?SE=wo(t).setGroup(Zt).setName("cameraNormalMatrices"):SE.array=t,e=SE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}else G6===null&&(G6=Ht(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=G6;return e}).once()(),lQ=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);TE===null?TE=wo(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)}):TE.array=t,e=TE.element(i.isMultiViewCamera?Jf("gl_ViewID_OVR"):l0)}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()(),Rxe=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.viewport);EE===null?EE=wo(t,"vec4").setGroup(Zt).setName("cameraViewports"):EE.array=t,e=EE.element(l0)}else V6===null&&(V6=Lt(0,0,Pm.x,Pm.y).toConst("cameraViewport")),e=V6;return e}).once()(),aY=new Ha,hs=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 Mm(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(),aY.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=aY.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}};hs.WORLD_MATRIX="worldMatrix";hs.POSITION="position";hs.SCALE="scale";hs.VIEW_POSITION="viewPosition";hs.DIRECTION="direction";hs.RADIUS="radius";var Pxe=Vn(hs,hs.DIRECTION).setParameterLength(1),Ixe=Vn(hs,hs.WORLD_MATRIX).setParameterLength(1),Nxe=Vn(hs,hs.POSITION).setParameterLength(1),Lxe=Vn(hs,hs.SCALE).setParameterLength(1),Dxe=Vn(hs,hs.VIEW_POSITION).setParameterLength(1),Fxe=Vn(hs,hs.RADIUS).setParameterLength(1),Ja=class extends hs{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},Oxe=xt(Ja,Ja.DIRECTION),hc=xt(Ja,Ja.WORLD_MATRIX),Bxe=xt(Ja,Ja.POSITION),Uxe=xt(Ja,Ja.SCALE),kxe=xt(Ja,Ja.VIEW_POSITION),Gxe=xt(Ja,Ja.RADIUS),cQ=Ht(new Sn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),zxe=Ht(new on).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),Rh=Ae(i=>i.context.modelViewMatrix||uQ).once()().toVar("modelViewMatrix"),uQ=c0.mul(hc),Z8=Ae(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Ht("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),K8=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"),hQ=Ae(i=>i.shaderStage!=="fragment"?(Zn("TSL: `clipSpace` is only available in fragment stage."),Lt()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),Yo=Rl("position","vec3"),hr=Yo.toVarying("positionLocal"),Im=Yo.toVarying("positionPrevious"),Eh=Ae(i=>hc.mul(hr).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),K7=Ae(()=>hr.transformDirection(hc).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),es=Ae(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){let e=aQ.mul(hQ);return e.xyz.div(e.w).toVar("positionView")}return i.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),zi=Ae(i=>{let e;return i.camera.isOrthographicCamera?e=pe(0,0,1):e=es.negate().toVarying("v_positionViewDirection").normalize(),e.toVar("positionViewDirection")},"vec3").once(["POSITION"])(),Q8=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()}},fQ=xt(Q8),Q7=se(fQ).mul(2).sub(1),Gm=Ae(([i],{material:e})=>{let t=e.side;return t===ui?i=i.mul(-1):t===ir&&(i=i.mul(Q7)),i}),Vxe=i=>(Zn('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),Gm(i)),OC=Rl("normal","vec3"),ea=Ae(i=>i.geometry.hasAttribute("normal")===!1?(je('TSL: Vertex attribute "normal" not found on geometry.'),pe(0,1,0)):OC,"vec3").once()().toVar("normalLocal"),dQ=es.dFdx().cross(es.dFdy()).normalize().toVar("normalFlat"),M1=Ae(i=>{let e;return i.isFlatShading()?e=dQ:e=eU(ea).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),pQ=Ae(i=>{let e=M1.transformNormalByInverseViewMatrix(c0);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=M1,i.isFlatShading()!==!0&&(e=Gm(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),u0=oi.transformNormalByInverseViewMatrix(c0).toVar("normalWorld"),Zp=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"),J7=Ae(([i,e=hc])=>io(e).inverse().transpose().mul(i).normalize());Be("transformNormal",J7);var eU=Ae(([i],e)=>{let t=e.context.modelNormalViewMatrix;return t?i.transformNormalByViewMatrix(t):cQ.mul(i).transformNormalByViewMatrix(c0)}),qxe=Ae(()=>(je('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),oi)).once(["NORMAL","VERTEX"])(),Hxe=Ae(()=>(je('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),u0)).once(["NORMAL","VERTEX"])(),Wxe=Ae(()=>(je('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),Zp)).once(["NORMAL","VERTEX"])(),q6=new on,AQ=Ht(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),rM=Ht(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),SM=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}),mQ=zi.negate().reflect(oi),gQ=zi.negate().refract(oi,AQ),_Q=mQ.transformDirection(_b).toVar("reflectVector"),xQ=gQ.transformDirection(_b).toVar("refractVector"),yQ=new Uu,J8=class extends Ac{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===gl?_Q:e.mapping===Ql?xQ:(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===qa?pe(t.x,t.y.negate(),t.z):t:(t=SM.mul(t),(e.renderer.coordinateSystem===qa||!n.isRenderTargetTexture)&&(t=pe(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?"vec3":"ivec3")}},tU=Vn(J8).setParameterLength(1,4).setName("cubeTexture"),Ta=(i=yQ,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=tU(i,e,t,n),r},jxe=(i=yQ)=>tU(i),eF=class extends $f{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)}},C1=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 eF(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=O1(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=wo(null,e),t.updateType=_n.OBJECT):e==="texture"?t=ai(null):e==="cubeTexture"?t=Ta(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}},tr=(i,e,t)=>new C1(i,e,t),vQ=(i,e,t,n)=>new C1(i,e,n,t),tF=class extends C1{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}},Wf=(i,e,t=null)=>new tF(i,e,t),bQ=Ri(),Xxe=es.dFdx(),$xe=es.dFdy(),wQ=bQ.dFdx(),SQ=bQ.dFdy(),TQ=oi,EQ=$xe.cross(TQ),MQ=TQ.cross(Xxe),nF=EQ.mul(wQ.x).add(MQ.mul(SQ.x)),iF=EQ.mul(wQ.y).add(MQ.mul(SQ.y)),lY=nF.dot(nF).max(iF.dot(iF)),CQ=lY.equal(0).select(0,lY.inverseSqrt()),Yxe=nF.mul(CQ).toVar("tangentViewFrame"),Zxe=iF.mul(CQ).toVar("bitangentViewFrame"),BC=Rl("tangent","vec4"),r0=BC.xyz.toVar("tangentLocal"),UC=Ae(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=Rh.mul(Lt(r0,0)).xyz.toVarying("v_tangentView").normalize():e=Yxe,i.isFlatShading()!==!0&&(e=Gm(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),RQ=UC.transformDirection(_b).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),kC=Ae(([i,e],t)=>{let n=i.mul(BC.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),Kxe=kC(OC.cross(BC),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),Qxe=kC(ea.cross(r0),"v_bitangentLocal").normalize().toVar("bitangentLocal"),PQ=Ae(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=kC(oi.cross(UC),"v_bitangentView").normalize():e=Zxe,i.isFlatShading()!==!0&&(e=Gm(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),Jxe=kC(u0.cross(RQ),"v_bitangentWorld").normalize().toVar("bitangentWorld"),_m=io(UC,PQ,oi).toVar("TBNViewMatrix"),IQ=zi.mul(_m),eye=(i,e)=>i.sub(IQ.mul(e)),NQ=Ae(()=>{let i=vm.cross(zi);return i=i.cross(vm).normalize(),i=jn(i,oi,jp.mul(vh.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),nU=i=>Vt(i).mul(.5).add(.5),LQ=i=>Vt(i).mul(2).sub(1),rF=i=>pe(i,Ma(NC(se(1).sub(pc(i,i))))),tye=i=>(Zn('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),nU(i)),nye=i=>(Zn('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),LQ(i)),sF=class extends dr{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=_l,this.unpackNormalMode=g2}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,s=this.node.mul(2).sub(1);if(t===_l?r===XT?s=rF(s.xy):r===QN?s=rF(s.yw):r!==g2&&Ge(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==g2&&Ge(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${r}'`),n!==null){let a=n;e.isFlatShading()===!0&&(a=Gm(a)),s=pe(s.xy.mul(a),s.z)}let o=null;return t===jT?o=eU(s):t===_l?o=_m.mul(s).normalize():(Ge(`NodeMaterial: Unsupported normal map type: ${t}`),o=oi),o}},oF=Vn(sF).setParameterLength(1,2),iye=Ae(({textureNode:i,bumpScale:e})=>{let t=r=>i.isolate().context({getUV:s=>r(s.uvNode||Ri()),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)}),rye=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(Q7),u=c.sign().mul(n.x.mul(a).add(n.y.mul(l)));return c.abs().mul(t).sub(u).normalize()}),aF=class extends dr{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=iye({textureNode:this.textureNode,bumpScale:t});return rye({surf_pos:es,surf_norm:oi,dHdxy:n})}},iU=Vn(aF).setParameterLength(1,2),cY=new Map,ot=class i extends $t{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=cY.get(e);return n===void 0&&(n=Wf(e,t),cY.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=oF(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==Ss||t.normalMap.format==eh||t.normalMap.format==Ju)&&(r.unpackNormalMode=XT)):t.bumpMap?r=iU(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=oF(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=TC(A1.x,A1.y,A1.y.negate(),A1.x).mul(s.rg.mul(2).sub(ft(1)).normalize().mul(s.b))}else r=A1;else if(n===i.IRIDESCENCE_THICKNESS){let s=tr("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){let o=tr("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 DQ=xt(ot,ot.ALPHA_TEST),FQ=xt(ot,ot.COLOR),OQ=xt(ot,ot.SHININESS),BQ=xt(ot,ot.EMISSIVE),rU=xt(ot,ot.OPACITY),UQ=xt(ot,ot.SPECULAR),lF=xt(ot,ot.SPECULAR_INTENSITY),kQ=xt(ot,ot.SPECULAR_COLOR),Wv=xt(ot,ot.SPECULAR_STRENGTH),sM=xt(ot,ot.REFLECTIVITY),GQ=xt(ot,ot.ROUGHNESS),zQ=xt(ot,ot.METALNESS),VQ=xt(ot,ot.NORMAL),qQ=xt(ot,ot.CLEARCOAT),HQ=xt(ot,ot.CLEARCOAT_ROUGHNESS),WQ=xt(ot,ot.CLEARCOAT_NORMAL),jQ=xt(ot,ot.ROTATION),XQ=xt(ot,ot.SHEEN),$Q=xt(ot,ot.SHEEN_ROUGHNESS),YQ=xt(ot,ot.ANISOTROPY),ZQ=xt(ot,ot.IRIDESCENCE),KQ=xt(ot,ot.IRIDESCENCE_IOR),QQ=xt(ot,ot.IRIDESCENCE_THICKNESS),JQ=xt(ot,ot.TRANSMISSION),eJ=xt(ot,ot.THICKNESS),tJ=xt(ot,ot.IOR),nJ=xt(ot,ot.ATTENUATION_DISTANCE),iJ=xt(ot,ot.ATTENUATION_COLOR),sU=xt(ot,ot.LINE_SCALE),oU=xt(ot,ot.LINE_DASH_SIZE),aU=xt(ot,ot.LINE_GAP_SIZE),TM=xt(ot,ot.LINE_WIDTH),lU=xt(ot,ot.LINE_DASH_OFFSET),rJ=xt(ot,ot.POINT_SIZE),sJ=xt(ot,ot.DISPERSION),cU=xt(ot,ot.LIGHT_MAP),oJ=xt(ot,ot.AO),A1=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))}),aJ=Ae(i=>i.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection"),Ca=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)}};Ca.OBJECT="object";Ca.MATERIAL="material";Ca.FRAME="frame";Ca.BEFORE_OBJECT="beforeObject";Ca.BEFORE_MATERIAL="beforeMaterial";Ca.BEFORE_FRAME="beforeFrame";var B1=(i,e)=>new Ca(i,e).toStack(),xb=i=>B1(Ca.OBJECT,i),sye=i=>B1(Ca.MATERIAL,i),lJ=i=>B1(Ca.FRAME,i),oye=i=>B1(Ca.BEFORE_OBJECT,i),aye=i=>B1(Ca.BEFORE_MATERIAL,i),lye=i=>B1(Ca.BEFORE_FRAME,i),cF=class extends $f{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}},cye=Vn(cF).setParameterLength(2),uF=class extends tb{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=wZ(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=So.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 cye(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(So.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=a0(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}},t0=(i,e=null,t=0)=>new uF(i,e,t),hF=new WeakMap,uY=new WeakMap,fF=new WeakMap;function cJ(i,e){let t,n=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=t0(e,"mat4",n).element(nu);else if(n*16*4<=i.getUniformBufferLimit())t=O1(e.array,"mat4",n).element(nu);else{let o=hF.get(e);o||(o=new Gu(e.array,16,1),hF.set(e,o));let a=e.usage===GA?V7:FC,l=[a(o,"vec4",16,0),a(o,"vec4",16,4),a(o,"vec4",16,8),a(o,"vec4",16,12)];t=e0(...l)}return t}function uye(i,e,t){let n=fF.get(i);if(n===void 0){let r=e.clone();n={previousInstanceMatrix:r,node:cJ(t,r)},fF.set(i,n)}return n.node}var uU=Um("vec3","vInstanceColor"),uJ=Ae(([i,e=null],t)=>{let n=i.isStorageInstancedBufferAttribute===!0,r=e&&e.isStorageInstancedBufferAttribute===!0,s=cJ(t,i),o=null;n||Math.max(i.count,1)*16*4>t.getUniformBufferLimit()&&(o=hF.get(i));let a=null,l=null;if(e)if(r)a=t0(e,"vec3",Math.max(e.count,1)).element(nu);else{let u=uY.get(e);u||(u=new Al(e.array,3),uY.set(e,u)),l=u;let f=e.usage===GA?V7:FC;a=pe(f(u,"vec3",3,0))}(o!==null||l!==null)&&lJ(()=>{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(hr).xyz;if(hr.assign(c),t.needsPreviousData()){let u=t.object;xb(({object:p})=>{fF.get(p).previousInstanceMatrix.array.set(i.array)});let f=uye(u,i,t);Im.assign(f.mul(Im).xyz)}if(t.hasGeometryAttribute("normal")){let u=J7(ea,s);ea.assign(u)}a!==null&&uU.assign(a)},"void"),hJ=Ae(([i])=>{let{instanceMatrix:e,instanceColor:t}=i;uJ(e,t)},"void"),hye=Ae(([i,e])=>{let t=fe(Rm(Jr(i),0).x).toConst(),n=fe(e),r=n.mod(t).toConst(),s=n.div(t).toConst();return Jr(i,vr(r,s))}),fye=Ae(([i,e])=>{let t=fe(Rm(Jr(i),0).x).toConst(),n=fe(e).mod(t).toConst(),r=fe(e).div(t).toConst();return Jr(i,vr(n,r)).x}),hU=Um("vec4","vBatchColor"),fJ=Ae(([i],e)=>{let t=e.getDrawIndex()===null?nu:KK,n=fye(i._indirectTexture,fe(t)),r=i._matricesTexture,s=fe(Rm(Jr(r),0).x).toConst(),o=se(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),c=e0(Jr(r,vr(a,l)),Jr(r,vr(a.add(1),l)),Jr(r,vr(a.add(2),l)),Jr(r,vr(a.add(3),l))),u=i._colorsTexture;if(u!==null){let v=hye(u,n);hU.assign(v)}let f=io(c);hr.assign(c.mul(hr));let p=ea.div(pe(f[0].dot(f[0]),f[1].dot(f[1]),f[2].dot(f[2]))),x=f.mul(p).xyz;ea.assign(x),e.hasGeometryAttribute("tangent")&&r0.mulAssign(f)},"void"),EM=new WeakMap,MM=new WeakMap;function fU(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=us(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 dJ(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=us(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=MM.get(s);if(o===void 0){s.update();let a=new Float32Array(s.boneMatrices);o={previousBoneMatrices:a,node:O1(a,"mat4",s.bones.length)},MM.set(s,o)}return fU(o.node,Im,e,t,n,r)}var AJ=Ae(([i],e)=>{let t=Rl("skinIndex","uvec4"),n=Rl("skinWeight","vec4"),r=tr("bindMatrix","mat4"),s=tr("bindMatrixInverse","mat4"),o=vQ("skeleton.boneMatrices","mat4",i.skeleton.bones.length);if(xb(({object:l,frameId:c})=>{let u=l.skeleton;if(EM.get(u)!==c){EM.set(u,c);let f=MM.get(u);f!==void 0&&f.previousBoneMatrices.set(u.boneMatrices),u.update()}}),e.needsPreviousData()){let l=pJ(i,r,s,t,n);Im.assign(l)}let a=fU(o,hr,r,s,t,n);if(hr.assign(a),e.hasGeometryAttribute("normal")){let{skinNormal:l,skinTangent:c}=dJ(o,ea,r0,r,s,t,n);ea.assign(l),e.hasGeometryAttribute("tangent")&&r0.assign(c)}},"void"),dye=Ae(([i,e=null],t)=>{let n=t0(new Al(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(nu).toVar(),r=t0(new Al(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(nu).toVar(),s=t0(new Al(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(nu).toVar(),o=Ht(i.bindMatrix,"mat4"),a=Ht(i.bindMatrixInverse,"mat4"),l=O1(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),c=i.skeleton;if(xb(({frameId:f})=>{if(EM.get(c)!==f){EM.set(c,f);let p=MM.get(c);p!==void 0&&p.previousBoneMatrices.set(c.boneMatrices),c.update()}}),t.needsPreviousData()){let f=pJ(i,o,a,r,s);Im.assign(f)}let u=fU(l,n,o,a,r,s);if(e!==null&&e.assign(u),t.hasGeometryAttribute("normal")){let{skinNormal:f,skinTangent:p}=dJ(l,ea,r0,o,a,r,s);ea.assign(f),t.hasGeometryAttribute("tangent")&&r0.assign(p)}return u}),dF=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]=Cl(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+`,gA(o)}return n}},lQ=(i,e=null)=>new j8(Vt(i),e).toStack();Be("debug",lQ);var SM=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(){}},X8=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!==SM&&Kn('TSL: ".toInspector()" is only available with WebGPU.'),t}};function cQ(i,e="",t=null){return i=Vt(i),i.before(new X8(i,e,t))}Be("toInspector",cQ);function Mxe(i){je("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",i)}var TM=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):c0(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}},Pl=(i,e=null)=>new TM(i,e),Ri=(i=0)=>Pl("uv"+(i>0?i:""),"vec2"),$8=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)}},Im=qn($8).setParameterLength(1,2),Y8=class extends Rm{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))}}},Z7=qn(Y8).setParameterLength(1),EM=class extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}},K7=new ws,gc=class extends Rm{static get type(){return"TextureNode"}constructor(e=K7,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===Lr?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return Ri(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(Im(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 EM("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(Ff.TEXTURE_COMPARE))o=this.compareNode;else{let l=n.compareFunction;l===null||l===M_||l===nh||l===zA||l===Wc?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===zA||K===Wc?j=Pm(Rl(j,a),Rl(N,"float")).build(e,a):j=Pm(Rl(N,"float"),Rl(j,a)).build(e,a)}e.addLineFlowCode(`${l} = ${j}`,this),o.snippet=j,o.propertyName=l}let c=l;return e.needsToWorkingColorSpace(n)&&(c=OC(Rl(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(Z7(t)),t.referenceNode=this.getBase();let n=t.value;return t.generateMipmaps===!1&&(n&&n.generateMipmaps===!1||n.minFilter===xi||n.magFilter===xi)&&(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 Im(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}},Cxe=qn(gc).setParameterLength(1,4).setName("texture"),ai=(i=K7,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=Cxe(i,e,t,n),r},Rxe=(i=K7)=>ai(i),es=(...i)=>ai(...i).setSampler(!1),Pxe=(i,e,t)=>ai(i,e).level(t),Ixe=i=>(i.isNode===!0?i:ai(i)).convert("sampler"),Nxe=i=>(i.isNode===!0?i:ai(i)).convert("samplerComparison"),ib=class extends Rm{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"}},U1=(i,e,t)=>new ib(i,e,t),Z8=class extends Yf{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)}},K8=class extends ib{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?e0(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 Z8(this,Vt(e))}},So=(i,e)=>new K8(i,e),Q8=class extends $t{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},ed=qn(Q8).setParameterLength(1),wv,Sv,Eo=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?Sv.copy(t.viewport):(e.getViewport(Sv),Sv.multiplyScalar(e.getPixelRatio())):this.scope===i.DPR?this._output.value=e.getPixelRatio():t!==null?(wv.width=t.width,wv.height=t.height):e.getDrawingBufferSize(wv)}setup(){let e=this.scope,t=null;return e===i.SIZE?t=Ht(wv||(wv=new Oe)):e===i.VIEWPORT?t=Ht(Sv||(Sv=new gn)):e===i.DPR?t=Ht(1):t=ft(zm.div(Nm)),this._output=t,t}generate(e){if(this.scope===i.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let n=e.getNodeProperties(Nm).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${n}.y - ${t}.y )`}return t}return super.generate(e)}};Eo.COORDINATE="coordinate";Eo.VIEWPORT="viewport";Eo.SIZE="size";Eo.UV="uv";Eo.DPR="dpr";var Q7=xt(Eo,Eo.DPR),nu=xt(Eo,Eo.UV),Nm=xt(Eo,Eo.SIZE),zm=xt(Eo,Eo.COORDINATE),E1=xt(Eo,Eo.VIEWPORT),J7=E1.zw,uQ=zm.sub(E1.xy),Lxe=uQ.div(J7),Dxe=Ae(()=>(je('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new Br),Nm),"vec2").once()(),k6=null,wE=null,G6=null,SE=null,z6=null,TE=null,V6=null,EE=null,q6=null,ME=null,H6=null,CE=null,W6=null,RE=null,u0=Ht(0,"uint").setName("u_cameraIndex").setGroup(PC("cameraIndex")).toVarying("v_cameraIndex"),Zp=Ht("float").setName("cameraNear").setGroup(Zt).onRenderUpdate(({camera:i})=>i.near),Kp=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);wE===null?wE=So(t).setGroup(Zt).setName("cameraProjectionMatrices"):wE.array=t,e=wE.element(i.isMultiViewCamera?ed("gl_ViewID_OVR"):u0)}else k6===null&&(k6=Ht(i.projectionMatrix).setName("cameraProjectionMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.projectionMatrix)),e=k6;return e}).once()(),hQ=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.projectionMatrixInverse);SE===null?SE=So(t).setGroup(Zt).setName("cameraProjectionMatricesInverse"):SE.array=t,e=SE.element(i.isMultiViewCamera?ed("gl_ViewID_OVR"):u0)}else G6===null&&(G6=Ht(i.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(Zt).onRenderUpdate(({camera:t})=>t.projectionMatrixInverse)),e=G6;return e}).once()(),h0=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorldInverse);TE===null?TE=So(t).setGroup(Zt).setName("cameraViewMatrices"):TE.array=t,e=TE.element(i.isMultiViewCamera?ed("gl_ViewID_OVR"):u0)}else z6===null&&(z6=Ht(i.matrixWorldInverse).setName("cameraViewMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse)),e=z6;return e}).once()(),yb=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.matrixWorld);EE===null?EE=So(t).setGroup(Zt).setName("cameraWorldMatrices"):EE.array=t,e=EE.element(i.isMultiViewCamera?ed("gl_ViewID_OVR"):u0)}else V6===null&&(V6=Ht(i.matrixWorld).setName("cameraWorldMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.matrixWorld)),e=V6;return e}).once()(),Fxe=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.normalMatrix);ME===null?ME=So(t).setGroup(Zt).setName("cameraNormalMatrices"):ME.array=t,e=ME.element(i.isMultiViewCamera?ed("gl_ViewID_OVR"):u0)}else q6===null&&(q6=Ht(i.normalMatrix).setName("cameraNormalMatrix").setGroup(Zt).onRenderUpdate(({camera:t})=>t.normalMatrix)),e=q6;return e}).once()(),fQ=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);CE===null?CE=So(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)}):CE.array=t,e=CE.element(i.isMultiViewCamera?ed("gl_ViewID_OVR"):u0)}else H6===null&&(H6=Ht(new ie).setName("cameraPosition").setGroup(Zt).onRenderUpdate(({camera:t},n)=>n.value.setFromMatrixPosition(t.matrixWorld))),e=H6;return e}).once()(),Oxe=Ae(({camera:i})=>{let e;if(i.isArrayCamera&&i.cameras.length>0){let t=[];for(let n of i.cameras)t.push(n.viewport);RE===null?RE=So(t,"vec4").setGroup(Zt).setName("cameraViewports"):RE.array=t,e=RE.element(u0)}else W6===null&&(W6=Lt(0,0,Nm.x,Nm.y).toConst("cameraViewport")),e=W6;return e}).once()(),hY=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 Rm(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(),hY.copy(s.boundingSphere).applyMatrix4(t.matrixWorld),n.value=hY.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 Bxe=qn(ds,ds.DIRECTION).setParameterLength(1),Uxe=qn(ds,ds.WORLD_MATRIX).setParameterLength(1),kxe=qn(ds,ds.POSITION).setParameterLength(1),Gxe=qn(ds,ds.SCALE).setParameterLength(1),zxe=qn(ds,ds.VIEW_POSITION).setParameterLength(1),Vxe=qn(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)}},qxe=xt(el,el.DIRECTION),dc=xt(el,el.WORLD_MATRIX),Hxe=xt(el,el.POSITION),Wxe=xt(el,el.SCALE),jxe=xt(el,el.VIEW_POSITION),Xxe=xt(el,el.RADIUS),dQ=Ht(new Sn).onObjectUpdate(({object:i},e)=>e.value.getNormalMatrix(i.matrixWorld)),$xe=Ht(new on).onObjectUpdate(({object:i},e)=>e.value.copy(i.matrixWorld).invert()),Ph=Ae(i=>i.context.modelViewMatrix||pQ).once()().toVar("modelViewMatrix"),pQ=h0.mul(dc),J8=Ae(i=>(i.context.isHighPrecisionModelViewMatrix=!0,Ht("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),eF=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"),AQ=Ae(i=>i.shaderStage!=="fragment"?(Kn("TSL: `clipSpace` is only available in fragment stage."),Lt()):i.context.clipSpace.toVarying("v_clipSpace")).once()(),Zo=Pl("position","vec3"),fr=Zo.toVarying("positionLocal"),Lm=Zo.toVarying("positionPrevious"),Mh=Ae(i=>dc.mul(fr).xyz.toVarying(i.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),eU=Ae(()=>fr.transformDirection(dc).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),ts=Ae(i=>{if(i.shaderStage==="fragment"&&i.material.vertexNode){let e=hQ.mul(AQ);return e.xyz.div(e.w).toVar("positionView")}return i.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),zi=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"])(),tF=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()}},mQ=xt(tF),tU=se(mQ).mul(2).sub(1),Vm=Ae(([i],{material:e})=>{let t=e.side;return t===ui?i=i.mul(-1):t===ir&&(i=i.mul(tU)),i}),Yxe=i=>(Kn('TSL: "directionToFaceDirection()" has been renamed to "negateOnBackSide()".'),Vm(i)),kC=Pl("normal","vec3"),ta=Ae(i=>i.geometry.hasAttribute("normal")===!1?(je('TSL: Vertex attribute "normal" not found on geometry.'),pe(0,1,0)):kC,"vec3").once()().toVar("normalLocal"),gQ=ts.dFdx().cross(ts.dFdy()).normalize().toVar("normalFlat"),R1=Ae(i=>{let e;return i.isFlatShading()?e=gQ:e=iU(ta).toVarying("v_normalViewGeometry").normalize(),e},"vec3").once()().toVar("normalViewGeometry"),_Q=Ae(i=>{let e=R1.transformNormalByInverseViewMatrix(h0);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=R1,i.isFlatShading()!==!0&&(e=Vm(e))):e=i.context.setupNormal().context({getUV:null,getTextureLevel:null}),e},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),f0=oi.transformNormalByInverseViewMatrix(h0).toVar("normalWorld"),Qp=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"),nU=Ae(([i,e=dc])=>ro(e).inverse().transpose().mul(i).normalize());Be("transformNormal",nU);var iU=Ae(([i],e)=>{let t=e.context.modelNormalViewMatrix;return t?i.transformNormalByViewMatrix(t):dQ.mul(i).transformNormalByViewMatrix(h0)}),Zxe=Ae(()=>(je('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),oi)).once(["NORMAL","VERTEX"])(),Kxe=Ae(()=>(je('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),f0)).once(["NORMAL","VERTEX"])(),Qxe=Ae(()=>(je('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),Qp)).once(["NORMAL","VERTEX"])(),j6=new on,xQ=Ht(0).onReference(({material:i})=>i).onObjectUpdate(({material:i})=>i.refractionRatio),aM=Ht(1).onReference(({material:i})=>i).onObjectUpdate(function({material:i,scene:e}){return i.envMap?i.envMapIntensity:e.environmentIntensity}),MM=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?j6.makeRotationFromEuler(n).transpose():j6.identity(),j6}),yQ=zi.negate().reflect(oi),vQ=zi.negate().refract(oi,xQ),bQ=yQ.transformDirection(yb).toVar("reflectVector"),wQ=vQ.transformDirection(yb).toVar("refractVector"),SQ=new ku,nF=class extends gc{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===_l?bQ:e.mapping===ec?wQ:(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=MM.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")}},rU=qn(nF).setParameterLength(1,4).setName("cubeTexture"),Ea=(i=SQ,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=rU(i,e,t,n),r},Jxe=(i=SQ)=>rU(i),iF=class extends Yf{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)}},P1=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 iF(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=U1(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=So(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}},tr=(i,e,t)=>new P1(i,e,t),TQ=(i,e,t,n)=>new P1(i,e,n,t),rF=class extends P1{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}},jf=(i,e,t=null)=>new rF(i,e,t),EQ=Ri(),eye=ts.dFdx(),tye=ts.dFdy(),MQ=EQ.dFdx(),CQ=EQ.dFdy(),RQ=oi,PQ=tye.cross(RQ),IQ=RQ.cross(eye),sF=PQ.mul(MQ.x).add(IQ.mul(CQ.x)),oF=PQ.mul(MQ.y).add(IQ.mul(CQ.y)),fY=sF.dot(sF).max(oF.dot(oF)),NQ=fY.equal(0).select(0,fY.inverseSqrt()),nye=sF.mul(NQ).toVar("tangentViewFrame"),iye=oF.mul(NQ).toVar("bitangentViewFrame"),GC=Pl("tangent","vec4"),o0=GC.xyz.toVar("tangentLocal"),zC=Ae(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=Ph.mul(Lt(o0,0)).xyz.toVarying("v_tangentView").normalize():e=nye,i.isFlatShading()!==!0&&(e=Vm(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),LQ=zC.transformDirection(yb).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),VC=Ae(([i,e],t)=>{let n=i.mul(GC.w).xyz;return t.subBuildFn==="NORMAL"&&t.isFlatShading()!==!0&&(n=n.toVarying(e)),n}).once(["NORMAL"]),rye=VC(kC.cross(GC),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),sye=VC(ta.cross(o0),"v_bitangentLocal").normalize().toVar("bitangentLocal"),DQ=Ae(i=>{let e;return i.subBuildFn==="VERTEX"||i.geometry.hasAttribute("tangent")?e=VC(oi.cross(zC),"v_bitangentView").normalize():e=iye,i.isFlatShading()!==!0&&(e=Vm(e)),e},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),oye=VC(f0.cross(LQ),"v_bitangentWorld").normalize().toVar("bitangentWorld"),ym=ro(zC,DQ,oi).toVar("TBNViewMatrix"),FQ=zi.mul(ym),aye=(i,e)=>i.sub(FQ.mul(e)),OQ=Ae(()=>{let i=wm.cross(zi);return i=i.cross(wm).normalize(),i=Xn(i,oi,$p.mul(bh.oneMinus()).oneMinus().pow2().pow2()).normalize(),i}).once()(),sU=i=>Vt(i).mul(.5).add(.5),BQ=i=>Vt(i).mul(2).sub(1),aF=i=>pe(i,Ca(FC(se(1).sub(mc(i,i))))),lye=i=>(Kn('TSL: "directionToColor()" has been renamed to "packNormalToRGB()".'),sU(i)),cye=i=>(Kn('TSL: "colorToDirection()" has been renamed to "unpackRGBToNormal()".'),BQ(i)),lF=class extends pr{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=xl,this.unpackNormalMode=x2}setup(e){let{normalMapType:t,scaleNode:n,unpackNormalMode:r}=this,s=this.node.mul(2).sub(1);if(t===xl?r===ZT?s=aF(s.xy):r===tL?s=aF(s.yw):r!==x2&&Ge(`THREE.NodeMaterial: Unexpected unpack normal mode: ${r}`):r!==x2&&Ge(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${r}'`),n!==null){let a=n;e.isFlatShading()===!0&&(a=Vm(a)),s=pe(s.xy.mul(a),s.z)}let o=null;return t===YT?o=iU(s):t===xl?o=ym.mul(s).normalize():(Ge(`NodeMaterial: Unsupported normal map type: ${t}`),o=oi),o}},cF=qn(lF).setParameterLength(1,2),uye=Ae(({textureNode:i,bumpScale:e})=>{let t=r=>i.isolate().context({getUV:s=>r(s.uvNode||Ri()),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)}),hye=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(tU),u=c.sign().mul(n.x.mul(a).add(n.y.mul(l)));return c.abs().mul(t).sub(u).normalize()}),uF=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=uye({textureNode:this.textureNode,bumpScale:t});return hye({surf_pos:ts,surf_norm:oi,dHdxy:n})}},oU=qn(uF).setParameterLength(1,2),dY=new Map,ot=class i extends $t{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let n=dY.get(e);return n===void 0&&(n=jf(e,t),dY.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=cF(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType,(t.normalMap.format==Ts||t.normalMap.format==th||t.normalMap.format==eh)&&(r.unpackNormalMode=ZT)):t.bumpMap?r=oU(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=cF(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=CC(g1.x,g1.y,g1.y.negate(),g1.x).mul(s.rg.mul(2).sub(ft(1)).normalize().mul(s.b))}else r=g1;else if(n===i.IRIDESCENCE_THICKNESS){let s=tr("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){let o=tr("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 UQ=xt(ot,ot.ALPHA_TEST),kQ=xt(ot,ot.COLOR),GQ=xt(ot,ot.SHININESS),zQ=xt(ot,ot.EMISSIVE),aU=xt(ot,ot.OPACITY),VQ=xt(ot,ot.SPECULAR),hF=xt(ot,ot.SPECULAR_INTENSITY),qQ=xt(ot,ot.SPECULAR_COLOR),Xv=xt(ot,ot.SPECULAR_STRENGTH),lM=xt(ot,ot.REFLECTIVITY),HQ=xt(ot,ot.ROUGHNESS),WQ=xt(ot,ot.METALNESS),jQ=xt(ot,ot.NORMAL),XQ=xt(ot,ot.CLEARCOAT),$Q=xt(ot,ot.CLEARCOAT_ROUGHNESS),YQ=xt(ot,ot.CLEARCOAT_NORMAL),ZQ=xt(ot,ot.ROTATION),KQ=xt(ot,ot.SHEEN),QQ=xt(ot,ot.SHEEN_ROUGHNESS),JQ=xt(ot,ot.ANISOTROPY),eJ=xt(ot,ot.IRIDESCENCE),tJ=xt(ot,ot.IRIDESCENCE_IOR),nJ=xt(ot,ot.IRIDESCENCE_THICKNESS),iJ=xt(ot,ot.TRANSMISSION),rJ=xt(ot,ot.THICKNESS),sJ=xt(ot,ot.IOR),oJ=xt(ot,ot.ATTENUATION_DISTANCE),aJ=xt(ot,ot.ATTENUATION_COLOR),lU=xt(ot,ot.LINE_SCALE),cU=xt(ot,ot.LINE_DASH_SIZE),uU=xt(ot,ot.LINE_GAP_SIZE),CM=xt(ot,ot.LINE_WIDTH),hU=xt(ot,ot.LINE_DASH_OFFSET),lJ=xt(ot,ot.POINT_SIZE),cJ=xt(ot,ot.DISPERSION),fU=xt(ot,ot.LIGHT_MAP),uJ=xt(ot,ot.AO),g1=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))}),hJ=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 k1=(i,e)=>new Ra(i,e).toStack(),vb=i=>k1(Ra.OBJECT,i),fye=i=>k1(Ra.MATERIAL,i),fJ=i=>k1(Ra.FRAME,i),dye=i=>k1(Ra.BEFORE_OBJECT,i),pye=i=>k1(Ra.BEFORE_MATERIAL,i),Aye=i=>k1(Ra.BEFORE_FRAME,i),fF=class extends Yf{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}},mye=qn(fF).setParameterLength(2),dF=class extends ib{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=MZ(e.itemSize),n=e.count):r=t,super(e,r,n),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=To.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 mye(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(To.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=H7(this.value),this._varying=c0(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}},i0=(i,e=null,t=0)=>new dF(i,e,t),pF=new WeakMap,pY=new WeakMap,AF=new WeakMap;function dJ(i,e){let t,n=Math.max(e.count,1);if(e.isStorageInstancedBufferAttribute===!0)t=i0(e,"mat4",n).element(iu);else if(n*16*4<=i.getUniformBufferLimit())t=U1(e.array,"mat4",n).element(iu);else{let o=pF.get(e);o||(o=new zu(e.array,16,1),pF.set(e,o));let a=e.usage===VA?W7:UC,l=[a(o,"vec4",16,0),a(o,"vec4",16,4),a(o,"vec4",16,8),a(o,"vec4",16,12)];t=n0(...l)}return t}function gye(i,e,t){let n=AF.get(i);if(n===void 0){let r=e.clone();n={previousInstanceMatrix:r,node:dJ(t,r)},AF.set(i,n)}return n.node}var dU=Gm("vec3","vInstanceColor"),pJ=Ae(([i,e=null],t)=>{let n=i.isStorageInstancedBufferAttribute===!0,r=e&&e.isStorageInstancedBufferAttribute===!0,s=dJ(t,i),o=null;n||Math.max(i.count,1)*16*4>t.getUniformBufferLimit()&&(o=pF.get(i));let a=null,l=null;if(e)if(r)a=i0(e,"vec3",Math.max(e.count,1)).element(iu);else{let u=pY.get(e);u||(u=new ml(e.array,3),pY.set(e,u)),l=u;let f=e.usage===VA?W7:UC;a=pe(f(u,"vec3",3,0))}(o!==null||l!==null)&&fJ(()=>{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;vb(({object:p})=>{AF.get(p).previousInstanceMatrix.array.set(i.array)});let f=gye(u,i,t);Lm.assign(f.mul(Lm).xyz)}if(t.hasGeometryAttribute("normal")){let u=nU(ta,s);ta.assign(u)}a!==null&&dU.assign(a)},"void"),AJ=Ae(([i])=>{let{instanceMatrix:e,instanceColor:t}=i;pJ(e,t)},"void"),_ye=Ae(([i,e])=>{let t=fe(Im(es(i),0).x).toConst(),n=fe(e),r=n.mod(t).toConst(),s=n.div(t).toConst();return es(i,wr(r,s))}),xye=Ae(([i,e])=>{let t=fe(Im(es(i),0).x).toConst(),n=fe(e).mod(t).toConst(),r=fe(e).div(t).toConst();return es(i,wr(n,r)).x}),pU=Gm("vec4","vBatchColor"),mJ=Ae(([i],e)=>{let t=e.getDrawIndex()===null?iu:tQ,n=xye(i._indirectTexture,fe(t)),r=i._matricesTexture,s=fe(Im(es(r),0).x).toConst(),o=se(n).mul(4).toInt().toConst(),a=o.mod(s).toConst(),l=o.div(s).toConst(),c=n0(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=_ye(u,n);pU.assign(v)}let f=ro(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")&&o0.mulAssign(f)},"void"),RM=new WeakMap,PM=new WeakMap;function AU(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 gJ(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 _J(i,e,t,n,r){let s=i.skeleton,o=PM.get(s);if(o===void 0){s.update();let a=new Float32Array(s.boneMatrices);o={previousBoneMatrices:a,node:U1(a,"mat4",s.bones.length)},PM.set(s,o)}return AU(o.node,Lm,e,t,n,r)}var xJ=Ae(([i],e)=>{let t=Pl("skinIndex","uvec4"),n=Pl("skinWeight","vec4"),r=tr("bindMatrix","mat4"),s=tr("bindMatrixInverse","mat4"),o=TQ("skeleton.boneMatrices","mat4",i.skeleton.bones.length);if(vb(({object:l,frameId:c})=>{let u=l.skeleton;if(RM.get(u)!==c){RM.set(u,c);let f=PM.get(u);f!==void 0&&f.previousBoneMatrices.set(u.boneMatrices),u.update()}}),e.needsPreviousData()){let l=_J(i,r,s,t,n);Lm.assign(l)}let a=AU(o,fr,r,s,t,n);if(fr.assign(a),e.hasGeometryAttribute("normal")){let{skinNormal:l,skinTangent:c}=gJ(o,ta,o0,r,s,t,n);ta.assign(l),e.hasGeometryAttribute("tangent")&&o0.assign(c)}},"void"),yye=Ae(([i,e=null],t)=>{let n=i0(new ml(i.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(iu).toVar(),r=i0(new ml(new Uint32Array(i.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(iu).toVar(),s=i0(new ml(i.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(iu).toVar(),o=Ht(i.bindMatrix,"mat4"),a=Ht(i.bindMatrixInverse,"mat4"),l=U1(i.skeleton.boneMatrices,"mat4",i.skeleton.bones.length),c=i.skeleton;if(vb(({frameId:f})=>{if(RM.get(c)!==f){RM.set(c,f);let p=PM.get(c);p!==void 0&&p.previousBoneMatrices.set(c.boneMatrices),c.update()}}),t.needsPreviousData()){let f=_J(i,o,a,r,s);Lm.assign(f)}let u=AU(l,n,o,a,r,s);if(e!==null&&e.assign(u),t.hasGeometryAttribute("normal")){let{skinNormal:f,skinTangent:p}=gJ(l,ta,o0,o,a,r,s);ta.assign(f),t.hasGeometryAttribute("tangent")&&o0.assign(p)}return u}),mF=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]=Rl(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()}},Ci=(...i)=>new dF(ym(i,"int")).toStack(),pye=()=>Cl("continue").toStack(),mJ=()=>Cl("break").toStack(),H6=new WeakMap,bl=new gn,hY=new WeakMap,fY=Ae(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{let o=fe(ZK).mul(t).add(s),a=o.div(n),l=o.sub(a.mul(n));return Jr(i,vr(l,a)).depth(r).xyz.mul(e)});function Aye(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=H6.get(i);if(o===void 0||o.count!==s){let T=function(){w.dispose(),H6.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 mA(v,f,p,s);w.type=Yi,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&&(bl.fromBufferAttribute(R,F),v[D+N+0]=bl.x,v[D+N+1]=bl.y,v[D+N+2]=bl.z,v[D+N+3]=0),t===!0&&(bl.fromBufferAttribute(C,F),v[D+N+4]=bl.x,v[D+N+5]=bl.y,v[D+N+6]=bl.z,v[D+N+7]=0),n===!0&&(bl.fromBufferAttribute(L,F),v[D+N+8]=bl.x,v[D+N+9]=bl.y,v[D+N+10]=bl.z,v[D+N+11]=L.itemSize===4?bl.w:1)}}o={count:s,texture:w,stride:u,size:new Oe(f,p)},H6.set(i,o),i.addEventListener("dispose",T)}return o}var gJ=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=hY.get(i);(o===void 0||o.count!==s)&&(o={base:Ht(1),influences:i.morphTargetInfluences?wo(i.morphTargetInfluences,"float"):null,count:s},hY.set(i,o));let{base:a,influences:l}=o,{texture:c,stride:u,size:f}=Aye(e);t===!0&&hr.mulAssign(a),n===!0&&ea.mulAssign(a);let p=fe(f.width);Ci(s,({i:x})=>{let v=se(0).toVar();i.count>1&&i.morphTexture!==null&&i.morphTexture!==void 0?v.assign(Jr(i.morphTexture,vr(fe(x).add(1),fe(nu))).r):v.assign(l.element(x).toVar()),Wt(v.notEqual(0),()=>{t===!0&&hr.addAssign(fY({bufferMap:c,influence:v,stride:u,width:p,depth:x,offset:fe(0)})),n===!0&&ea.addAssign(fY({bufferMap:c,influence:v,stride:u,width:p,depth:x,offset:fe(1)}))})}),xb(({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"),s0=class extends $t{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}},pF=class extends s0{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},AF=class extends Jv{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)}},_J=Vn(AF),mF=class extends s0{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},am=new Oe,R1=class extends Ac{static get type(){return"ViewportTextureNode"}constructor(e=tu,t=null,n=null){let r=null;n===null?(r=new yA,r.minFilter=go,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(am):s.getDrawingBufferSize?s.getDrawingBufferSize(am):am.set(s.width,s.height);let o=this.getTextureForReference(s);(o.image.width!==am.width||o.image.height!==am.height)&&(o.image.width=am.width,o.image.height=am.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}},mye=Vn(R1).setParameterLength(0,3),dU=Vn(R1,null,null,{generateMipmaps:!0}).setParameterLength(0,3),gye=dU(),xJ=(i=tu,e=null)=>gye.sample(i,e),W6=null,gF=class extends R1{static get type(){return"ViewportDepthTextureNode"}constructor(e=tu,t=null,n=null){n===null&&(W6===null&&(W6=new os),n=W6),super(e,t,n)}},pU=Vn(gF).setParameterLength(0,3),su=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=bJ().assign(n));else if(t===i.DEPTH)e.isPerspectiveCamera?r=AU(es.z,$p,Yp):r=Sm(es.z,$p,Yp);else if(t===i.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){let s=GC(n,$p,Yp);r=Sm(s,$p,Yp)}else r=n;else r=Sm(es.z,$p,Yp);return r}};su.DEPTH_BASE="depthBase";su.DEPTH="depth";su.LINEAR_DEPTH="linearDepth";var Sm=(i,e,t)=>i.add(e).div(e.sub(t)),_ye=(i,e,t)=>i.add(t).div(t.sub(e)),yJ=Ae(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?t.sub(e).mul(i).sub(t):e.sub(t).mul(i).sub(e)),AU=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),vJ=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),GC=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))),zC=(i,e,t)=>{e=e.max(1e-6).toVar();let n=wh(i.negate().div(e)),r=wh(t.div(e));return n.div(r)},xye=(i,e,t)=>{let n=i.mul(PC(t.div(e)));return se(Math.E).pow(n).mul(e).negate()},bJ=Vn(su,su.DEPTH_BASE),mU=xt(su,su.DEPTH),CM=Vn(su,su.LINEAR_DEPTH).setParameterLength(0,1),yye=CM(pU());mU.assign=i=>bJ(i);var Ph=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=wo(t).setGroup(Zt);Ci(o,({i:c})=>{let u=l.element(c);n.assign(es.dot(u.xyz).negate().add(u.w)),r.assign(n.fwidth().div(2)),s.mulAssign(Nl(r.negate(),r,n))})}let a=e.length;if(a>0){let l=wo(e).setGroup(Zt),c=se(1).toVar("intersectionClipOpacity");Ci(a,({i:u})=>{let f=l.element(u);n.assign(es.dot(f.xyz).negate().add(f.w)),r.assign(n.fwidth().div(2)),c.mulAssign(Nl(r.negate(),r,n).oneMinus())}),s.mulAssign(c.oneMinus())}Mi.a.mulAssign(s),Mi.a.equal(0).discard()})()}setupDefault(e,t){return Ae(()=>{let n=t.length;if(this.hardwareClipping===!1&&n>0){let s=wo(t).setGroup(Zt);Ci(n,({i:o})=>{let a=s.element(o);es.dot(a.xyz).greaterThan(a.w).discard()})}let r=e.length;if(r>0){let s=wo(e).setGroup(Zt),o=Pl(!0).toVar("clipped");Ci(r,({i:a})=>{let l=s.element(a);o.assign(es.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){let n=e.length;return t.enableHardwareClipping(n),Ae(()=>{let r=wo(e).setGroup(Zt),s=Jf(t.getClipDistance());Ci(n,({i:o})=>{let a=r.element(o),l=es.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}};Ph.ALPHA_TO_COVERAGE="alphaToCoverage";Ph.DEFAULT="default";Ph.HARDWARE="hardware";var vye=()=>new Ph,bye=()=>new Ph(Ph.ALPHA_TO_COVERAGE),wye=()=>new Ph(Ph.HARDWARE),Sye=.05,dY=Ae(([i])=>iu(bn(1e4,Sa(bn(17,i.x).add(bn(.1,i.y)))).mul(us(.1,Qi(Sa(bn(13,i.y).add(i.x))))))),pY=Ae(([i])=>dY(ft(dY(i.xy),i.z))),Tye=Ae(([i])=>{let e=br(Th(R7(i.xyz)),Th(P7(i.xyz))),t=se(1).div(se(Sye).mul(e)).toVar("pixScale"),n=ft(E1(Sh(wh(t))),E1(IC(wh(t)))),r=ft(pY(Sh(n.x.mul(i.xyz))),pY(Sh(n.y.mul(i.xyz)))),s=iu(wh(t)),o=us(bn(s.oneMinus(),r.x),bn(s,r.y)),a=Qa(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 ru(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]}),_F=class extends bM{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}},wJ=(i=0)=>new _F(i),pr=class extends ws{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){let e=[];for(let t of Object.getOwnPropertyNames(this)){if(t.startsWith("_")===!0)continue;let n=this[t];n&&n.isNode===!0&&e.push({property:t,childNode:n})}return e}customProgramCacheKey(){let e=[];for(let{property:t,childNode:n}of this._getNodeChildren())e.push(F1(t.slice(0,-4)),n.getCacheKey());return this.type+gb(e)}build(e){this.setup(e)}setupObserver(e){return new y8(e)}setup(e){e.context.setupNormal=()=>wm(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=wm(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,Mi.a).max(0);o=this.setupOutput(e,c),y1.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&&y1.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=bye():e.stack.addToStack(vye())}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=zC(es.z,$p,Yp):r=Sm(es.z,$p,Yp))}r!==null&&mU.assign(r).toStack()}setupPositionView(){return Rh.mul(hr).xyz}setupModelViewProjection(){return Ea.mul(es)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),aJ}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&gJ(t),t.isSkinnedMesh===!0&&AJ(t),this.displacementMap){let r=Wf("displacementMap","texture"),s=Wf("displacementScale","float"),o=Wf("displacementBias","float");hr.addAssign(ea.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&fJ(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&hJ(t),this.positionNode!==null&&hr.assign(wm(this.positionNode,"POSITION","vec3")),hr}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&Pl(this.maskNode).not().discard();let r=this.colorNode?Lt(this.colorNode):FQ;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul(wJ())),t.instanceColor&&(r=uU.mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=hU.mul(r)),Mi.assign(r);let s=this.opacityNode?se(this.opacityNode):rU;Mi.a.assign(Mi.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?se(this.alphaTestNode):DQ,this.alphaToCoverage===!0?(Mi.a=Nl(o,o.add(N7(Mi.a)),Mi.a),Mi.a.lessThanEqual(0).discard()):Mi.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Mi.a.lessThan(Tye(hr)).discard(),e.isOpaque()&&Mi.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?pe(0):Mi.rgb}setupNormal(){return this.normalNode?pe(this.normalNode):VQ}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?Wf("envMap","cubeTexture"):Wf("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new mF(cU)),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=oJ),e.context.getAO&&(t=e.context.getAO(t,e)),t!==null&&(I8.assign(t),e.context.ambientOcclusion=I8)}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=_J(l,u,a,n,r)}else n!==null&&(c=pe(r!==null?jn(c,n,r):n));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(P8.assign(pe(s||BQ)),c=c.add(P8)),c}setupFog(e,t){let n=e.fogNode;return n&&(y1.assign(t),t=Lt(n.toVar())),t}setupPremultipliedAlpha(e,t){return W7(t)}setupOutput(e,t){return this.fog===!0&&(t=this.setupFog(e,t)),this.premultipliedAlpha===!0&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(let n in e){let r=e[n];this[n]===void 0&&(this[n]=r,r&&r.clone&&(this[n]=r.clone()))}let t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(let n in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,n)===void 0&&t[n].get!==void 0&&Object.defineProperty(this.constructor.prototype,n,t[n])}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});let n=ws.prototype.toJSON.call(this,e);n.inputNodes={};for(let{property:s,childNode:o}of this._getNodeChildren())n.inputNodes[s]=o.toJSON(e).uuid;function r(s){let o=[];for(let a in s){let l=s[a];delete l.metadata,o.push(l)}return o}if(t){let s=r(e.textures),o=r(e.images),a=r(e.nodes);s.length>0&&(n.textures=s),o.length>0&&(n.images=o),a.length>0&&(n.nodes=a)}return n}copy(e){let t=Object.getOwnPropertyDescriptors(this.constructor.prototype);for(let n in t)if(t[n].set!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}for(let n in this)if(!/^(?:is[A-Z]|_)|^(?:id|uuid|version|type|userData|clippingPlanes)$/.test(n)&&this[n]!==void 0&&e[n]!==void 0){let r=e[n];this[n]&&this[n].copy!==void 0?this[n].copy(r):this[n]=r}return this.clippingPlanes=e.clippingPlanes?e.clippingPlanes.map(n=>n.clone()):null,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},Eye=new kc,xF=class extends pr{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(Eye),this.setValues(e)}},Mye=new ky,yF=class extends pr{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(Mye),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):lU,t=this.dashScaleNode?se(this.dashScaleNode):sU,n=this.dashSizeNode?se(this.dashSizeNode):oU,r=this.gapSizeNode?se(this.gapSizeNode):aU;bm.assign(n),Qv.assign(r);let s=a0(Rl("lineDistance").mul(t));(e?s.add(e):s).mod(bm.add(Qv)).greaterThan(bm).discard()}};var oM=Um("vec3","worldStart"),vF=Um("vec3","worldEnd"),SJ=Um("float","lineDistance"),dm=Um("vec4","worldPos"),AY=Ae(({start:i,end:e})=>{let t=Ea.element(2).element(2),n=Ea.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"}),Cye=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"}),fJe=Ae(({material:i})=>{let e=i._useDash,t=i._useWorldUnits,n=Rl("instanceStart"),r=Rl("instanceEnd"),s=Lt(Rh.mul(Lt(n,1))).toVar("start"),o=Lt(Rh.mul(Lt(r,1))).toVar("end"),a,l;e&&(a=se(Rl("instanceDistanceStart")).toVar("distanceStart"),l=se(Rl("instanceDistanceEnd")).toVar("distanceEnd")),t&&(oM.assign(s.xyz),vF.assign(o.xyz));let c=S1.z.div(S1.w),u=Ea.element(2).element(3).equal(-1);if(Wt(u,()=>{Wt(s.z.lessThan(0).and(o.z.greaterThan(0)),()=>{let T=AY({start:s,end:o});o.assign(Lt(jn(s.xyz,o.xyz,T),o.w)),e&&l.assign(jn(a,l,T))}).ElseIf(o.z.lessThan(0).and(s.z.greaterThanEqual(0)),()=>{let T=AY({start:o,end:s});s.assign(Lt(jn(o.xyz,s.xyz,T),s.w)),e&&a.assign(jn(l,a,T))})}),e){let T=i.dashScaleNode?se(i.dashScaleNode):sU,P=i.offsetNode?se(i.offsetNode):lU,R=Yo.y.lessThan(.5).select(T.mul(a),T.mul(l));R=R.add(P),SJ.assign(R)}let f=Ea.mul(s),p=Ea.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=jn(s.xyz,o.xyz,.5).normalize(),R=T.cross(P).normalize(),C=T.cross(R);dm.assign(Yo.y.lessThan(.5).select(s,o));let L=TM.mul(.5);dm.addAssign(Lt(Yo.x.lessThan(0).select(R.mul(L),R.mul(L).negate()),0)),e||(dm.addAssign(Lt(Yo.y.lessThan(.5).select(T.mul(L).negate(),T.mul(L)),0)),dm.addAssign(Lt(C.mul(L),0)),Wt(Yo.y.greaterThan(1).or(Yo.y.lessThan(0)),()=>{dm.subAssign(Lt(C.mul(2).mul(L),0))})),S.assign(Ea.mul(dm));let D=pe().toVar();D.assign(Yo.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(Yo.x.lessThan(0).select(T.negate(),T)),Wt(Yo.y.lessThan(0),()=>{T.assign(T.sub(w))}).ElseIf(Yo.y.greaterThan(1),()=>{T.assign(T.add(w))}),T.assign(T.mul(TM)),T.assign(T.div(S1.w.div(Y7))),S.assign(Yo.y.lessThan(.5).select(f,p)),T.assign(T.mul(S.w)),S.assign(S.add(Lt(T,0,0)))}return S})(),dJe=Ae(({material:i,renderer:e})=>{let t=i._useAlphaToCoverage,n=i._useDash,r=i._useWorldUnits,s=Ri();if(n){let a=i.dashSizeNode?se(i.dashSizeNode):oU,l=i.gapSizeNode?se(i.gapSizeNode):aU;bm.assign(a),Qv.assign(l),s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),SJ.mod(bm.add(Qv)).greaterThan(bm).discard()}let o=se(1).toVar("alpha");if(r){let a=dm.xyz.normalize().mul(1e5),l=vF.sub(oM),c=Cye({p1:oM,p2:vF,p3:pe(0,0,0),p4:a}),u=oM.add(l.mul(c.x)),f=a.mul(c.y),v=u.sub(f).length().div(TM);if(!n)if(t&&e.currentSamples>0){let w=v.fwidth();o.assign(Nl(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(Nl(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 Rye=new By,bF=class extends pr{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(Rye),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?se(this.opacityNode):rU;Mi.assign(LC(Lt(nU(oi),e),jr))}},gU=Ae(([i=K7])=>{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)}),wF=Ae(([i=Ri()])=>{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)}),RM=class extends ca{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 Uu(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 Gc(5,5,5),o=gU(K7),a=new pr;a.colorNode=ai(t,o,0),a.side=ui,a.blending=$r;let l=new Hn(s,a),c=new Hd;c.add(l),t.minFilter===go&&(t.minFilter=vi);let u=new y_(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)}},jv=new WeakMap,SF=class extends dr{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Ta(null);let t=new Uu;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===ep||o===tp){if(jv.has(s)){let a=jv.get(s);mY(a,s.mapping),this._cubeTexture=a}else{let a=s.image;if(Pye(a)){let l=new RM(a.height);l.fromEquirectangularTexture(t,s),mY(l.texture,s.mapping),this._cubeTexture=l.texture,jv.set(s,l.texture),s.addEventListener("dispose",TJ)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function Pye(i){return i==null?!1:i.height>0}function TJ(i){let e=i.target;e.removeEventListener("dispose",TJ);let t=jv.get(e);t!==void 0&&(jv.delete(e),t.dispose())}function mY(i,e){e===ep?i.mapping=gl:e===tp&&(i.mapping=Ql)}var EJ=Vn(SF).setParameterLength(1),nb=class extends s0{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=EJ(this.envNode)}},TF=class extends s0{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)}},P1=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},PM=class extends P1{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(Mi.rgb)}finish(e){let{material:t,context:n}=e,r=n.outgoingLight,s=e.context.environment;if(s)switch(t.combine){case PA:r.rgb.assign(jn(r.rgb,r.rgb.mul(s.rgb),Wv.mul(sM)));break;case qT:r.rgb.assign(jn(r.rgb,s.rgb,Wv.mul(sM)));break;case HT:r.rgb.addAssign(s.rgb.mul(Wv.mul(sM)));break;default:je("BasicLightingModel: Unsupported .combine value:",t.combine);break}}},Iye=new Us,EF=class extends pr{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Iye),this.setValues(e)}setupNormal(){return Gm(M1)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new nb(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new TF(cU)),t}setupOutgoingLight(){return Mi.rgb}setupLightingModel(){return new PM}},I1=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))}),Nm=Ae(i=>i.diffuseColor.mul(1/Math.PI)),Nye=()=>se(.25),Lye=Ae(({dotNH:i})=>AM.mul(se(.5)).add(1).mul(se(1/Math.PI)).mul(i.pow(AM))),Dye=Ae(({lightDirection:i})=>{let e=i.add(zi).normalize(),t=oi.dot(e).clamp(),n=zi.dot(e).clamp(),r=I1({f0:i0,f90:1,dotVH:n}),s=Nye(),o=Lye({dotNH:t});return r.mul(s).mul(o)}),IM=class extends PM{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(Nm({diffuseColor:Mi.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(Dye({lightDirection:e})).mul(Wv))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Nm({diffuseColor:Mi}))),r.indirectDiffuse.mulAssign(t)}},Fye=new Aa,MF=class extends pr{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Fye),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new nb(t):null}setupLightingModel(){return new IM(!1)}},Oye=new TA,CF=class extends pr{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(Oye),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new nb(t):null}setupLightingModel(){return new IM}setupVariants(){let e=(this.shininessNode?se(this.shininessNode):OQ).max(1e-4);AM.assign(e);let t=this.specularNode||UQ;i0.assign(t)}},MJ=Ae(i=>{if(i.geometry.hasAttribute("normal")===!1)return se(0);let e=M1.dFdx().abs().max(M1.dFdy().abs());return e.x.max(e.y).max(e.z)}),_U=Ae(i=>{let{roughness:e}=i,t=MJ(),n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),CJ=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 Il(.5,r.add(s).max(RC))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),Bye=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 Il(.5,l.add(c).max(RC))}).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"}]}),RJ=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"}]}),Uye=se(1/Math.PI),kye=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 Uye.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"}]}),xU=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(zi).normalize(),u=s.dot(i).clamp(),f=s.dot(zi).clamp(),p=s.dot(c).clamp(),x=zi.dot(c).clamp(),v=I1({f0:e,f90:t,dotVH:x}),w,S;if(T1(o)&&(v=EC.mix(v,r)),T1(a)){let T=qv.dot(i),P=qv.dot(zi),R=qv.dot(c),C=vm.dot(i),L=vm.dot(zi),D=vm.dot(c);w=Bye({alphaT:pM,alphaB:l,dotTV:P,dotBV:L,dotTL:T,dotBL:C,dotNV:f,dotNL:u}),S=kye({alphaT:pM,alphaB:l,dotNH:p,dotTH:R,dotBH:D})}else w=CJ({alpha:l,dotNL:u,dotNV:f}),S=RJ({alpha:l,dotNH:p});return v.mul(w).mul(S)}),Gye=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]),Ah=null,ib=Ae(({roughness:i,dotNV:e})=>{Ah===null&&(Ah=new xA(Gye,16,16,Ss,Li),Ah.name="DFG_LUT",Ah.minFilter=vi,Ah.magFilter=vi,Ah.wrapS=ko,Ah.wrapT=ko,Ah.generateMipmaps=!1,Ah.needsUpdate=!0);let t=ft(i,e);return ai(Ah,t).rg}),zye=Ae(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let a=xU({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o}),l=oi.dot(i).clamp(),c=oi.dot(zi).clamp(),u=ib({roughness:n,dotNV:c}),f=ib({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(RC)),C=S.mul(T),L=R.mul(C);return a.add(L)}),PJ=Ae(i=>{let{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=ib({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),RF=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"}]}),Vye=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"}]}),qye=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"}]}),Hye=Ae(({lightDirection:i})=>{let e=i.add(zi).normalize(),t=oi.dot(i).clamp(),n=oi.dot(zi).clamp(),r=oi.dot(e).clamp(),s=Vye({roughness:Xp,dotNH:r}),o=qye({dotNV:n,dotNL:t});return El.mul(s).mul(o)}),gY=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"}]}),Wye=Ae(({f:i})=>{let e=i.length();return br(e.mul(e).add(i.z).div(e.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),ME=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,br(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"}]}),j6=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(io(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(ME({v1:w,v2:S})),R.addAssign(ME({v1:S,v2:T})),R.addAssign(ME({v1:T,v2:P})),R.addAssign(ME({v1:P,v2:w})),f.assign(pe(Wye({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 VC=1/6,IJ=i=>bn(VC,bn(i,bn(i,i.negate().add(3)).sub(3)).add(1)),PF=i=>bn(VC,bn(i,bn(i,bn(3,i).sub(6))).add(4)),NJ=i=>bn(VC,bn(i,bn(i,bn(-3,i).add(3)).add(3)).add(1)),IF=i=>bn(VC,uc(i,3)),_Y=i=>IJ(i).add(PF(i)),xY=i=>NJ(i).add(IF(i)),yY=i=>us(-1,PF(i).div(IJ(i).add(PF(i)))),vY=i=>us(1,IF(i).div(NJ(i).add(IF(i)))),bY=(i,e,t)=>{let n=i.uvNode,r=bn(n,e.zw).add(.5),s=Sh(r),o=iu(r),a=_Y(o.x),l=xY(o.x),c=yY(o.x),u=vY(o.x),f=yY(o.y),p=vY(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=_Y(o.y).mul(us(a.mul(i.sample(x).level(t)),l.mul(i.sample(v).level(t)))),P=xY(o.y).mul(us(a.mul(i.sample(w).level(t)),l.mul(i.sample(S).level(t))));return T.add(P)},yU=Ae(([i,e])=>{let t=ft(i.size(fe(e))),n=ft(i.size(fe(e.add(1)))),r=Il(1,t),s=Il(1,n),o=bY(i,Lt(r,t),Sh(e)),a=bY(i,Lt(s,n),IC(e));return iu(e).mix(o,a)}),jye=Ae(([i,e])=>{let t=e.mul(X7(i));return yU(i,t)}),wY=Ae(([i,e,t,n,r])=>{let s=pe(O7(e.negate(),Qo(i),Il(1,n))),o=pe(Th(r[0].xyz),Th(r[1].xyz),Th(r[2].xyz));return Qo(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"}]}),Xye=Ae(([i,e])=>i.mul(ru(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),$ye=dU(),Yye=xJ(),SY=Ae(([i,e,t],{material:n})=>{let s=(n.side===ui?$ye:Yye).sample(i),o=wh(Pm.x).mul(Xye(e,t));return yU(s,o)}),TY=Ae(([i,e,t])=>(Wt(t.notEqual(0),()=>{let n=PC(e).negate().div(t);return w7(n.negate().mul(i))}),pe(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),Zye=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));Ci({start:0,end:3},({i:F})=>{let N=D.element(F),B=wY(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=SY(H,t,N);w.element(F).assign(Z.element(F)),w.a.addAssign(Z.a),S.element(F).assign(n.element(F).mul(TY(Th(B),p,x).element(F)))}),w.a.divAssign(3)}else{let L=wY(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=SY(N,t,u),S=n.mul(TY(Th(L),p,x))}let T=S.rgb.mul(w.rgb),P=i.dot(e).clamp(),R=pe(PJ({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())}),Kye=io(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),Qye=i=>{let e=i.sqrt();return pe(1).add(e).div(pe(1).sub(e))},EY=(i,e)=>i.sub(e).div(i.add(e)).pow2(),Jye=(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),Kye.mul(a)},MY=Ae(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{let s=jn(i,e,Nl(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();Wt(a.lessThan(0),()=>pe(1));let l=a.sqrt(),c=EY(s,i),u=I1({f0:c,f90:1,dotVH:t}),f=u.oneMinus(),p=s.lessThan(i).select(Math.PI,0),x=se(Math.PI).sub(p),v=Qye(r.clamp(0,.9999)),w=EY(v,s.toVec3()),S=I1({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 Ci({start:1,end:2,condition:"<=",name:"m"},({m:z})=>{B.mulAssign(L);let V=Jye(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"}]}),wv=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()}),Sv=pe(.04),CE=se(1),NM=class extends P1{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(zi).clamp(),n=MY({outsideIOR:se(1),eta2:fM,cosTheta1:t,thinFilmThickness:dM,baseF0:i0}),r=MY({outsideIOR:se(1),eta2:fM,cosTheta1:t,thinFilmThickness:dM,baseF0:Mi.rgb});this.iridescenceFresnel=jn(n,r,Xf),this.iridescenceF0Dielectric=RF({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=RF({f:r,f90:1,dotVH:t}),this.iridescenceF0=jn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,Xf)}if(this.transmission===!0){let t=Eh,n=lQ.sub(Eh).normalize(),r=u0,s=e.context;s.backdrop=Zye(r,n,vh,pm,mm,gm,t,hc,c0,Ea,Hv,_7,y7,x7,this.dispersion?v7:null),s.backdropAlpha=mM,Mi.a.mulAssign(jn(1,s.backdrop.a,mM))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){let o=oi.dot(zi).clamp(),a=ib({roughness:vh,dotNV:o}),l=s?EC.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(Hye({lightDirection:e})));let o=wv({normal:oi,viewDir:zi,roughness:Xp}),a=wv({normal:oi,viewDir:e,roughness:Xp}),l=El.r.max(El.g).max(El.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){let a=Zp.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(xU({lightDirection:e,f0:Sv,f90:CE,roughness:x1,normalView:Zp})))}n.directDiffuse.addAssign(s.mul(Nm({diffuseColor:pm}))),n.directSpecular.addAssign(s.mul(zye({lightDirection:e,f0:mm,f90:1,roughness:vh,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=zi,v=es.toVar(),w=gY({N:p,V:x,roughness:vh}),S=o.sample(w).toVar(),T=a.sample(w).toVar(),P=io(pe(S.x,0,S.y),pe(0,1,0),pe(S.z,0,S.w)).toVar(),R=mm.mul(T.x).add(gm.sub(mm).mul(T.y)).toVar();if(s.directSpecular.addAssign(e.mul(R).mul(j6({N:p,V:x,P:v,mInv:P,p0:l,p1:c,p2:u,p3:f}))),s.directDiffuse.addAssign(e.mul(pm).mul(j6({N:p,V:x,P:v,mInv:io(1,0,0,0,1,0,0,0,1),p0:l,p1:c,p2:u,p3:f}))),this.clearcoat===!0){let C=Zp,L=gY({N:C,V:x,roughness:x1}),D=o.sample(L),F=a.sample(L),N=io(pe(D.x,0,D.y),pe(0,1,0),pe(D.z,0,D.w)),B=Sv.mul(F.x).add(CE.sub(Sv).mul(F.y));this.clearcoatSpecularDirect.addAssign(e.mul(B).mul(j6({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(Nm({diffuseColor:pm})).toVar();if(this.sheen===!0){let s=wv({normal:oi,viewDir:zi,roughness:Xp}),o=El.r.max(El.g).max(El.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(El,wv({normal:oi,viewDir:zi,roughness:Xp}))),this.clearcoat===!0){let S=Zp.dot(zi).clamp(),T=PJ({dotNV:S,specularColor:Sv,specularF90:CE,roughness:x1});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,gm,i0,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,gm,Mi.rgb,this.iridescenceF0Metallic);let c=jn(s,a,Xf),u=jn(o,l,Xf),f=s.add(o),p=pm.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=wv({normal:oi,viewDir:zi,roughness:Xp}),T=El.r.max(El.g).max(El.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(zi).clamp().add(t),o=vh.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=Zp.dot(zi).clamp(),r=I1({dotVH:n,f0:Sv,f90:CE}),s=t.mul(hM.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(hM));t.assign(s)}if(this.sheen===!0){let n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}},CY=se(1),NF=se(-2),RE=se(.8),X6=se(-1),PE=se(.4),$6=se(2),IE=se(.305),Y6=se(3),RY=se(.21),e2e=se(4),PY=se(4),t2e=se(16),n2e=Ae(([i])=>{let e=pe(Qi(i)).toVar(),t=se(-1).toVar();return Wt(e.x.greaterThan(e.z),()=>{Wt(e.x.greaterThan(e.y),()=>{t.assign(Ko(i.x.greaterThan(0),0,3))}).Else(()=>{t.assign(Ko(i.y.greaterThan(0),1,4))})}).Else(()=>{Wt(e.z.greaterThan(e.y),()=>{t.assign(Ko(i.z.greaterThan(0),2,5))}).Else(()=>{t.assign(Ko(i.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),i2e=Ae(([i,e])=>{let t=ft().toVar();return Wt(e.equal(0),()=>{t.assign(ft(i.z,i.y).div(Qi(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(ft(i.x.negate(),i.z.negate()).div(Qi(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(ft(i.x.negate(),i.y).div(Qi(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(ft(i.z.negate(),i.y).div(Qi(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(ft(i.x.negate(),i.z).div(Qi(i.y)))}).Else(()=>{t.assign(ft(i.x,i.y).div(Qi(i.z)))}),bn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),r2e=Ae(([i])=>{let e=se(0).toVar();return Wt(i.greaterThanEqual(RE),()=>{e.assign(CY.sub(i).mul(X6.sub(NF)).div(CY.sub(RE)).add(NF))}).ElseIf(i.greaterThanEqual(PE),()=>{e.assign(RE.sub(i).mul($6.sub(X6)).div(RE.sub(PE)).add(X6))}).ElseIf(i.greaterThanEqual(IE),()=>{e.assign(PE.sub(i).mul(Y6.sub($6)).div(PE.sub(IE)).add($6))}).ElseIf(i.greaterThanEqual(RY),()=>{e.assign(IE.sub(i).mul(e2e.sub(Y6)).div(IE.sub(RY)).add(Y6))}).Else(()=>{e.assign(se(-2).mul(wh(bn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),LJ=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"}]}),DJ=Ae(([i,e,t,n,r,s])=>{let o=se(t),a=pe(e),l=ru(r2e(o),NF,s),c=iu(l),u=Sh(l),f=pe(rb(i,a,u,n,r,s)).toVar();return Wt(c.notEqual(0),()=>{let p=pe(rb(i,a,u.add(1),n,r,s)).toVar();f.assign(jn(f,p,c))}),f}),rb=Ae(([i,e,t,n,r,s])=>{let o=se(t).toVar(),a=pe(e),l=se(n2e(a)).toVar(),c=se(br(PY.sub(o),0)).toVar();o.assign(br(o,PY));let u=se(E1(o)).toVar(),f=ft(i2e(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,t2e))),f.y.addAssign(bn(4,E1(s).sub(u))),f.x.mulAssign(n),f.y.mulAssign(r),i.sample(f).grad(ft(),ft())}),Z6=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=Jc(n),c=t.mul(l).add(r.cross(t).mul(Sa(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return rb(i,c,e,s,o,a)}),FJ=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(Ko(e,t,Yf(t,n))).toVar();Wt(p.equal(pe(0)),()=>{p.assign(pe(n.z,0,n.x.negate()))}),p.assign(Qo(p));let x=pe().toVar();return x.addAssign(r.element(0).mul(Z6({theta:0,axis:p,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),Ci({start:fe(1),end:i},({i:v})=>{Wt(v.greaterThanEqual(s),()=>{mJ()});let w=se(o.mul(se(v))).toVar();x.addAssign(r.element(v).mul(Z6({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(Z6({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)}),s2e=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)}),o2e=Ae(([i,e])=>ft(se(i).div(se(e)),s2e(i))),a2e=Ae(([i,e,t])=>{let n=t.mul(t).toConst(),r=pe(1,0,0).toConst(),s=Yf(e,r).toConst(),o=Ma(i.x).toConst(),a=bn(2,3.14159265359).mul(i.y).toConst(),l=o.mul(Jc(a)).toConst(),c=o.mul(Sa(a)).toVar(),u=bn(.5,e.z.add(1)).toConst();c.assign(u.oneMinus().mul(Ma(l.mul(l).oneMinus())).add(u.mul(c)));let f=r.mul(l).add(s.mul(c)).add(e.mul(Ma(br(0,l.mul(l).add(c.mul(c)).oneMinus()))));return Qo(pe(n.mul(f.x),n.mul(f.y),br(0,f.z)))}),OJ=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(rb(t,l,e,s,o,a))}).Else(()=>{let f=Ko(Qi(l.z).lessThan(.999),pe(0,0,1),pe(1,0,0)),p=Qo(Yf(f,l)).toVar(),x=Yf(l,p).toVar();Ci({start:it(0),end:r},({i:v})=>{let w=o2e(v,r),S=a2e(w,pe(0,0,1),i),T=Qo(p.mul(S.x).add(x.mul(S.y)).add(l.mul(S.z))),P=Qo(T.mul(pc(l,T).mul(2)).sub(l)),R=br(pc(l,P),0);Wt(R.greaterThan(0),()=>{let C=rb(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)}),Jp=4,IY=[.125,.215,.35,.446,.526,.582],Am=20,l2e=512,Tv=new Vc(-1,1,1,-1,0,1),c2e=new Rr(90,1),NY=new Ut,K6=null,Q6=0,J6=0,u2e=new ie,LM=new WeakMap,h2e=[3,1,5,0,4,2],e8=LJ(Ri(),Rl("faceIndex")).normalize(),qC=pe(e8.x,e8.y,e8.z),LF=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=u2e,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.');K6=this._renderer.getRenderTarget(),Q6=this._renderer.getActiveCubeFace(),J6=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 Zn('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 Zn('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 Zn('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=DY(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=FY(),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===gl||e.mapping===Ql?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(K6,Q6,J6),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),K6=this._renderer.getRenderTarget(),Q6=this._renderer.getActiveCubeFace(),J6=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 LY(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=LY(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=f2e(t)),this._blurMaterial=d2e(t,e.width,e.height),this._ggxMaterial=p2e(t,e.width,e.height)}}async _compileMaterial(e){let t=new Hn(new Kn,e);await this._renderer.compile(t,Tv)}_sceneToCubeUV(e,t,n,r,s){let o=c2e;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(NY),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Hn(new Gc,new Us({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(NY),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===gl||e.mapping===Ql;r?this._cubemapMaterial===null&&(this._cubemapMaterial=DY(e)):this._equirectMaterial===null&&(this._equirectMaterial=FY(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,Tv)}_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=LM.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-Jp?n-v+Jp: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,Tv),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,Tv)}_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=LM.get(c),x=this._sizeLods[n]-1,v=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*Am-1),w=s/v,S=isFinite(s)?1+Math.floor(u*w):Am;S>Am&&je(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${Am}`);let T=[],P=0;for(let F=0;F<Am;++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-Jp?r-R+Jp:0),D=4*(this._cubeSize-C);this._setViewport(t,L,D,3*C,2*C),l.setRenderTarget(t),l.render(f,Tv)}_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 f2e(i){let e=[],t=[],n=[],r=i,s=i-Jp+1+IY.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-Jp?l=IY[o-i+Jp-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=h2e[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 Kn;L.setAttribute("position",new Ni(P,w)),L.setAttribute("uv",new Ni(R,S)),L.setAttribute("faceIndex",new Ni(C,T)),n.push(new Hn(L,null)),r>Jp&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function LY(i,e,t){let n={magFilter:vi,minFilter:vi,generateMipmaps:!1,type:Li,format:xr,colorSpace:Gd,depthBuffer:t},r=new ca(i,e,n);return r.texture.mapping=Hu,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function HC(i){let e=new pr;return e.depthTest=!1,e.depthWrite=!1,e.blending=$r,e.name=`PMREM_${i}`,e}function d2e(i,e,t){let n=wo(new Array(Am).fill(0)),r=Ht(new ie(0,1,0)),s=Ht(0),o=se(Am),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:qC,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:f,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:x},w=HC("blur");return w.fragmentNode=FJ({...v,latitudinal:a.equal(1)}),LM.set(w,v),w}function p2e(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=HC("ggx");return u.fragmentNode=OJ({...c,N_immutable:qC,GGX_SAMPLES:it(l2e)}),LM.set(u,c),u}function DY(i){let e=HC("cubemap");return e.fragmentNode=Ta(i,qC),e}function FY(i){let e=HC("equirect");return e.fragmentNode=ai(i,gU(qC),0),e}var OY=new WeakMap;function A2e(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 m2e(i,e,t){let n=g2e(e),r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){let o=i.image;if(i.isCubeTexture)if(_2e(o))r=t.fromCubemap(i,r);else return null;else if(x2e(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 g2e(i){let e=OY.get(i);return e===void 0&&(e=new WeakMap,OY.set(i,e)),e}var DF=class extends dr{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 bs;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=A2e(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===Hu?t=r:t=m2e(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new LF(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?SM.mul(pe(t.x,t.y.negate(),t.z)):SM.mul(t);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),DJ(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function _2e(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 x2e(i){return i==null?!1:i.height>0}var vU=Vn(DF).setParameterLength(1,3),BY=new WeakMap,FF=class extends s0{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=vU(f),p.set(f,x)),n=x}let s=t.useAnisotropy===!0||t.anisotropy>0?NQ:oi,o=n.context(UY(vh,s)).mul(rM),a=n.context(y2e(u0)).mul(Math.PI).mul(rM),l=b1(o),c=b1(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(c);let u=e.context.lightingModel.clearcoatRadiance;if(u){let f=n.context(UY(x1,Zp)).mul(rM),p=b1(f);u.addAssign(p)}}_getPMREMNodeCache(e){let t=BY.get(e);return t===void 0&&(t=new WeakMap,BY.set(e,t)),t}},UY=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=zi.negate().reflect(e),t=D7(i).mix(t,e).normalize(),t=t.transformDirection(_b)),t),getTextureLevel:()=>i}},y2e=i=>({getUV:()=>i,getTextureLevel:()=>se(1)}),v2e=new x_,DM=class extends pr{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(v2e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new FF(t):null}setupLightingModel(){return new NM}setupSpecular(){let e=jn(pe(.04),Mi.rgb,Xf);i0.assign(pe(.04)),mm.assign(e),gm.assign(1)}setupVariants(){let e=this.metalnessNode?se(this.metalnessNode):zQ;Xf.assign(e);let t=this.roughnessNode?se(this.roughnessNode):GQ;t=_U({roughness:t}),vh.assign(t),this.setupSpecular(),pm.assign(Mi.rgb.mul(e.oneMinus()))}},b2e=new Fy,OF=class extends DM{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(b2e),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):tJ;Hv.assign(e),i0.assign(Qa(L7(Hv.sub(1).div(Hv.add(1))).mul(kQ),pe(1)).mul(lF)),mm.assign(jn(i0,Mi.rgb,Xf)),gm.assign(jn(lF,1,Xf))}setupLightingModel(){return new NM(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):qQ,n=this.clearcoatRoughnessNode?se(this.clearcoatRoughnessNode):HQ;hM.assign(t),x1.assign(_U({roughness:n}))}if(this.useSheen){let t=this.sheenNode?pe(this.sheenNode):XQ,n=this.sheenRoughnessNode?se(this.sheenRoughnessNode):$Q;El.assign(t),Xp.assign(n)}if(this.useIridescence){let t=this.iridescenceNode?se(this.iridescenceNode):ZQ,n=this.iridescenceIORNode?se(this.iridescenceIORNode):KQ,r=this.iridescenceThicknessNode?se(this.iridescenceThicknessNode):QQ;EC.assign(t),fM.assign(n),dM.assign(r)}if(this.useAnisotropy){let t=(this.anisotropyNode?ft(this.anisotropyNode):YQ).toVar();jp.assign(t.length()),Wt(jp.equal(0),()=>{t.assign(ft(1,0))}).Else(()=>{t.divAssign(ft(jp)),jp.assign(jp.saturate())}),pM.assign(jp.pow2().mix(vh.pow2(),1)),qv.assign(_m[0].mul(t.x).add(_m[1].mul(t.y))),vm.assign(_m[1].mul(t.x).sub(_m[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?se(this.transmissionNode):JQ,n=this.thicknessNode?se(this.thicknessNode):eJ,r=this.attenuationDistanceNode?se(this.attenuationDistanceNode):nJ,s=this.attenuationColorNode?pe(this.attenuationColorNode):iJ;if(mM.assign(t),_7.assign(n),x7.assign(r),y7.assign(s),this.useDispersion){let o=this.dispersionNode?se(this.dispersionNode):sJ;v7.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pe(this.clearcoatNormalNode):WQ}setup(e){e.context.setupClearcoatNormal=()=>wm(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=Wf("gradientMap","texture").context({getUV:()=>r});return pe(s.r)}else{let s=r.fwidth().mul(.5);return jn(pe(.7),pe(1),Nl(se(.7).sub(s.x),se(.7).add(s.x),r.x))}}),BF=class extends P1{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){let s=w2e({normal:OC,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(Nm({diffuseColor:Mi.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Nm({diffuseColor:Mi}))),r.indirectDiffuse.mulAssign(t)}},S2e=new Oy,UF=class extends pr{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(S2e),this.setValues(e)}setupLightingModel(){return new BF}},BJ=Ae(()=>{let i=pe(zi.z,0,zi.x.negate()).normalize(),e=zi.cross(i);return ft(i.dot(oi),e.dot(oi)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),T2e=new Uy,kF=class extends pr{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(T2e),this.setValues(e)}setupVariants(e){let t=BJ,n;e.material.matcap?n=Wf("matcap","texture").context({getUV:()=>t}):n=pe(jn(.2,.8,t.y)),Mi.rgb.mulAssign(n.rgb)}},GF=class extends dr{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 TC(s,o,o.negate(),s).mul(n)}else{let s=t,o=e0(Lt(1,0,0,0),Lt(0,Jc(s.x),Sa(s.x).negate(),0),Lt(0,Sa(s.x),Jc(s.x),0),Lt(0,0,0,1)),a=e0(Lt(Jc(s.y),0,Sa(s.y),0),Lt(0,1,0,0),Lt(Sa(s.y).negate(),0,Jc(s.y),0),Lt(0,0,0,1)),l=e0(Lt(Jc(s.z),Sa(s.z).negate(),0,0),Lt(Sa(s.z),Jc(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}}},yb=Vn(GF).setParameterLength(2),E2e=new Wd,FM=class extends pr{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(E2e),this.setValues(e)}setupPositionView(e){let{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=Rh.mul(pe(r||0)),c=ft(hc[0].xyz.length(),hc[1].xyz.length());o!==null&&(c=c.mul(ft(o))),n.isPerspectiveCamera&&a===!1&&(c=c.mul(l.z.negate()));let u=Yo.xy;if(t.center&&t.center.isVector2===!0){let x=pxe("center","vec2",t);u=u.sub(x.sub(.5))}u=u.mul(c);let f=se(s||jQ),p=yb(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)}},M2e=new Xd,C2e=new Oe,zF=class extends FM{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(M2e),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return Rh.mul(pe(e||hr)).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):rJ;c=c.mul(Y7),n.isPerspectiveCamera&&a===!0&&(c=c.mul(R2e.div(es.z.negate()))),s&&s.isNode&&(c=c.mul(ft(s)));let u=Yo.xy;if(r&&r.isNode){let f=se(r);u=yb(u,f)}return u=u.mul(c),u=u.div(Z7.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)}},R2e=Ht(1).onFrameUpdate(function({renderer:i}){let e=i.getSize(C2e);this.value=.5*e.y}),VF=class extends P1{constructor(){super(),this.shadowNode=se(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Mi.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Mi.rgb)}},P2e=new Dy,qF=class extends pr{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(P2e),this.setValues(e)}setupLightingModel(){return new VF}},pJe=Kf("vec3"),AJe=Kf("vec3"),mJe=Kf("vec3");var HF=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()}},Ih=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])}},I2e=0,kY=new WeakMap;function N2e(i){let e=Object.keys(i),t=kY.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)}kY.set(i.constructor,t)}for(let n=0;n<t.length;n++)e.push(t[n]);return e}var WF=class{constructor(e,t,n,r,s,o,a,l,c,u){this.id=I2e++,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 N2e(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+",",F1(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=zv(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=zv(e,1)),e=zv(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()}},mh=[],jF=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);mh[0]=e,mh[1]=t,mh[2]=o,mh[3]=s;let u=c.get(mh);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),c.set(mh,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)),mh[0]=null,mh[1]=null,mh[2]=null,mh[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Ih)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,c,u,f){let p=this.getChainMap(f),x=new WF(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}},Nh=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}},fc={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},Kp=16,L2e=211,D2e=212,XF=class extends Nh{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===fc.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===fc.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===fc.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===fc.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===GA)&&(this.backend.updateAttribute(e),n.version=r.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}};function UJ(i){return i.index!==null?i.index.version:i.attributes.position.version}function kJ(i){return i.index!==null?i.index.id:i.attributes.position.id}function GY(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?_A:gA)(e,1);return r.version=UJ(i),r.__id=kJ(i),r}var $F=class extends Nh{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,fc.STORAGE):this.updateAttribute(s,fc.VERTEX);let n=this.getIndex(e);n!==null&&this.updateAttribute(n,fc.INDEX);let r=e.geometry.indirect;r!==null&&this.updateAttribute(r,fc.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=GY(t),s.set(t,o)):(o.version!==UJ(t)||o.__id!==kJ(t))&&(this.attributes.delete(o),o=GY(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()}},YF=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===Wu||e.type===Gi?t=1:e.type===ju||e.type===Wa||e.type===Li?t=2:(e.type===Ir||e.type===pi||e.type===Yi)&&(t=4);let n=4;e.format===S_||e.format===Lf||e.format===Xu||e.format===ys||e.format===Qs?n=1:e.format===Ss||e.format===$u?n=2:(e.format===Nf||e.format===m2)&&(n=3);let r=t*n;e.type===IA||e.type===NA?r=2:(e.type===zo||e.type===LA||e.type===DA)&&(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}},OM=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},ZF=class extends OM{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}},KF=class extends OM{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},F2e=0,Xv=class{constructor(e,t,n,r=null,s=null){this.id=F2e++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}},QF=class extends Nh{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 Xv(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 Xv(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 Xv(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 KF(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 ZF(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)}},JF=class extends Nh{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?fc.INDIRECT:fc.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?fc.INDIRECT:fc.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)}},O2e=Object.freeze([]);function B2e(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 zY(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 VY(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===ir&&i.forceSinglePass===!1}var eO=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?(VY(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?(VY(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||B2e),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||zY),this.transparent.length>1&&this.transparent.sort(t||zY),n&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:O2e);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}},t1=[],tO=class{constructor(e){this.lighting=e,this.lists=new Ih}get(e,t){let n=this.lists;t1[0]=e,t1[1]=t;let r=n.get(t1);return r===void 0&&(r=new eO(this.lighting,e,t),n.set(t1,r)),t1[0]=null,t1[1]=null,r}dispose(){this.lists=new Ih}},U2e=0,nO=class{constructor(){this.id=U2e++,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 GJ(this)}};function GJ(i){let{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(let s of e)r.push(s.id);return gb(r)}var iO=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 nO,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={}}},k2e=new ie,rO=class extends Nh{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 os,u.format=e.stencilBuffer?Qs:ys,u.type=e.stencilBuffer?zo: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=Gi}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=k2e){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)}}},sb=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)}},BM=class extends Jv{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 zJ(i,e=null,t=null){if(e&&e.isNode){let n=e;e=()=>n}return new BM(new Map([[i,e]]),t)}Be("overrideNode",(i,e,t)=>zJ(e,t,i));function VJ(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 BM(t,e)}Be("overrideNodes",(i,e)=>VJ(e,i));var UM=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 Fr),s="float"),s}getHash(){return String(this.id)}generate(){return this.name}},G2e=(i,e)=>new UM(i,e),sO=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 Fr),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 g1(t);return this._currentCond=Ko(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=new g1(t),r=Ko(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new g1(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 Fr);let n=e[e.length-1],r=new g1(n),s=t[0];for(let a=1;a<t.length;a++)s=s.or(t[a]);let o=Ko(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=f7(),r=e.buildStage;Kv(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 Kv(n),e.removeActiveStack(this),s}},aM=Vn(sO).setParameterLength(0,1);function z2e(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 oO=class extends $t{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=z2e(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let n of this.membersLayout){let r=n.type,s=D1e(r),o=F1e(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)}},aO=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}},V2e=(i,e=null)=>{let t=new oO(i,e);return h7((...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 aO(t,s)},t)},kM=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}},q2e=Vn(kM),GM=class{constructor(e=ss){this.blending=e,this.blendSrc=Ud,this.blendDst=kd,this.blendEquation=Bs,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)}},H2e=new GM($r),W2e=new GM(Ky);function qJ(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}var lO=class extends kM{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:W2e},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||H2e}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=HJ(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=qJ(s,o);if(a===-1)continue;let l=e.getOutputType(a);r[a]=t[o].convert(l)}return this.members=r,super.setup(e)}},HJ=Vn(lO),Lm=class extends dr{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)} )`}},WJ=lt(Lm).setParameterLength(2),j2e=i=>new Lm(i,"int","float"),jJ=i=>new Lm(i,"uint","float"),X2e=i=>new Lm(i,"float","int"),$2e=i=>new Lm(i,"float","uint"),NE={},ou=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(WJ(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return it;case"int":return fe;case"uvec2":return d7;case"uvec3":return Bm;case"uvec4":return g7;case"ivec2":return vr;case"ivec3":return p7;case"ivec4":return m7}}_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(C7(o))),c=jJ(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=NE[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}}NE[l]=u}let f=NE[c];return f===void 0&&(f=this._createMainLayout(c,s,a,u),NE[c]=f),Ae(()=>f(n))()}};ou.COUNT_TRAILING_ZEROS="countTrailingZeros";ou.COUNT_LEADING_ZEROS="countLeadingZeros";ou.COUNT_ONE_BITS="countOneBits";var Y2e=lt(ou,ou.COUNT_TRAILING_ZEROS).setParameterLength(1),Z2e=lt(ou,ou.COUNT_LEADING_ZEROS).setParameterLength(1),K2e=lt(ou,ou.COUNT_ONE_BITS).setParameterLength(1),Q2e=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)}),cO=(i,e)=>uc(bn(4,i.mul(ni(1,i))),e),J2e=(i,e)=>i.lessThan(.5)?cO(i.mul(2),e).div(2):ni(1,cO(bn(ni(1,i),2),e).div(2)),eve=(i,e,t)=>uc(Il(uc(i,e),us(uc(i,e),uc(ni(1,i),t))),1/e),tve=(i,e)=>Sa(xM.mul(e.mul(i).sub(1))).div(xM.mul(e.mul(i).sub(1))),ob=class extends dr{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)})`}},nve=lt(ob,"snorm").setParameterLength(1),ive=lt(ob,"unorm").setParameterLength(1),rve=lt(ob,"float16").setParameterLength(1),ab=class extends dr{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)})`}},sve=lt(ab,"snorm").setParameterLength(1),ove=lt(ab,"unorm").setParameterLength(1),ave=lt(ab,"float16").setParameterLength(1),Hf=Ae(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),lve=Ae(([i])=>pe(Hf(i.z.add(Hf(i.y.mul(1)))),Hf(i.z.add(Hf(i.x.mul(1)))),Hf(i.y.add(Hf(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),cve=Ae(([i,e,t])=>{let n=pe(i).toVar(),r=se(1.4).toVar(),s=se(0).toVar(),o=pe(n).toVar();return Ci({start:se(0),end:se(3),type:"float",condition:"<="},()=>{let a=pe(lve(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(Hf(n.z.add(Hf(n.x.add(Hf(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"}]}),uO=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)}},uve=Vn(uO),Eo=i=>(...e)=>uve(i,...e),U1=Ht(0).setGroup(Zt).onRenderUpdate(i=>i.time),hve=Ht(0).setGroup(Zt).onRenderUpdate(i=>i.deltaTime),XJ=Ht(0,"uint").setGroup(Zt).onRenderUpdate(i=>i.frameId),fve=(i=U1)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),dve=(i=U1)=>i.fract().round(),pve=(i=U1)=>i.add(.5).fract().mul(2).sub(1).abs(),Ave=(i=U1)=>i.fract();function mve(i,e=null){return Qf(e,{getUV:typeof i=="function"?i:()=>i})}var gve=Ae(([i,e,t=ft(.5)])=>yb(i.sub(t),e).add(t)),_ve=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))}),xve=Ae(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=hc.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=hc;let r=c0.mul(n);return T1(e)&&(r[0][0]=hc[0].length(),r[0][1]=0,r[0][2]=0),T1(t)&&(r[1][0]=0,r[1][1]=hc[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Ea.mul(r).mul(hr)}),yve=Ae(([i=null])=>{let e=CM();return CM(pU(i)).sub(e).lessThan(0).select(tu,i)}),vve=Ae(([i,e=Ri(),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)}),$J=Ae(([i,e=null,t=null,n=se(1),r=hr,s=ea])=>{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 us(x,v,w)}),bve=(...i)=>$J(...i),n1=new aa,lm=new ie,i1=new ie,t8=new ie,Ev=new on,LE=new ie(0,0,-1),gh=new gn,Mv=new ie,DE=new ie,Cv=new gn,FE=new Oe,zM=new ca,wve=tu.flipX();zM.depthTexture=new os(1,1);var OE=!1,hO=class i extends Ac{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||zM.texture,wve),this._reflectorBaseNode=e.reflector||new fO(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:zM.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()}},fO=class extends $t{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();let{target:n=new $i,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&&(Zn('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(FE),e.setSize(Math.round(FE.width*n),Math.round(FE.height*n))}setup(e){return this._updateResolution(zM,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 ca(0,0,{type:Li,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=YN,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new os),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&OE)return!1;OE=!0;let{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(FE),this._updateResolution(l,r),i1.setFromMatrixPosition(o.matrixWorld),t8.setFromMatrixPosition(n.matrixWorld),Ev.extractRotation(o.matrixWorld),lm.set(0,0,1),lm.applyMatrix4(Ev),Mv.subVectors(i1,t8);let c=Mv.dot(lm)>0,u=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){OE=!1;return}u=!0}Mv.reflect(lm).negate(),Mv.add(i1),Ev.extractRotation(n.matrixWorld),LE.set(0,0,-1),LE.applyMatrix4(Ev),LE.add(t8),DE.subVectors(i1,LE),DE.reflect(lm).negate(),DE.add(i1),a.coordinateSystem=n.coordinateSystem,a.position.copy(Mv),a.up.set(0,1,0),a.up.applyMatrix4(Ev),a.up.reflect(lm),a.lookAt(DE),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),n1.setFromNormalAndCoplanarPoint(lm,i1),n1.applyMatrix4(a.matrixWorldInverse),gh.set(n1.normal.x,n1.normal.y,n1.normal.z,n1.constant);let f=a.projectionMatrix;Cv.x=(Math.sign(gh.x)+f.elements[8])/f.elements[0],Cv.y=(Math.sign(gh.y)+f.elements[9])/f.elements[5],Cv.z=-1,Cv.w=(1+f.elements[10])/f.elements[14],gh.multiplyScalar(1/gh.dot(Cv));let p=0;f.elements[2]=gh.x,f.elements[6]=gh.y,f.elements[10]=r.coordinateSystem===qa?gh.z-p:gh.z+1-p,f.elements[14]=gh.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,OE=!1,this.forceUpdate=!1}get resolution(){return Zn('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){Zn('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}},Sve=i=>new hO(i),n8=new Vc(-1,1,1,-1,0,1),dO=class extends Kn{constructor(e=!1){super();let t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new kn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new kn(t,2))}},Tve=new dO,lb=class extends Hn{constructor(e=null){super(Tve,e),this.camera=n8,this.isQuadMesh=!0}async renderAsync(e){Zn('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,n8)}render(e){e.render(this,n8)}},Eve=new Oe,pO=class extends Ac{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Li}){let s=new ca(t,n,r);super(s.texture,Ri()),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 lb(new pr),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(Eve),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 Ac(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},YJ=(i,...e)=>new pO(Vt(i),...e),Mve=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():YJ(i,...e),m1=Ae(([i,e,t],n)=>{let r;n.renderer.coordinateSystem===qa?(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)}),Cve=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())}),Rve=Ae(([i,e,t])=>{let n=Rm(Jr(e)),r=vr(i.mul(n)).toVar(),s=Jr(e,r).toVar(),o=Jr(e,r.sub(vr(2,0))).toVar(),a=Jr(e,r.sub(vr(1,0))).toVar(),l=Jr(e,r.add(vr(1,0))).toVar(),c=Jr(e,r.add(vr(2,0))).toVar(),u=Jr(e,r.add(vr(0,2))).toVar(),f=Jr(e,r.add(vr(0,1))).toVar(),p=Jr(e,r.sub(vr(0,1))).toVar(),x=Jr(e,r.sub(vr(0,2))).toVar(),v=Qi(ni(se(2).mul(a).sub(o),s)).toVar(),w=Qi(ni(se(2).mul(l).sub(c),s)).toVar(),S=Qi(ni(se(2).mul(f).sub(u),s)).toVar(),T=Qi(ni(se(2).mul(p).sub(x),s)).toVar(),P=m1(i,s,t).toVar(),R=v.lessThan(w).select(P.sub(m1(i.sub(ft(se(1).div(n.x),0)),a,t)),P.negate().add(m1(i.add(ft(se(1).div(n.x),0)),l,t))),C=S.lessThan(T).select(P.sub(m1(i.add(ft(0,se(1).div(n.y))),f,t)),P.negate().add(m1(i.sub(ft(0,se(1).div(n.y))),p,t)));return Qo(Yf(R,C))}),bU=Ae(([i])=>iu(se(52.9829189).mul(iu(pc(i,ft(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),eu=Ae(([i,e,t])=>{let n=se(2.399963229728653),r=Ma(se(i).add(.5).div(se(e))),s=se(i).mul(n).add(t);return ft(Jc(s),Sa(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]}),AO=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(Ri())}sample(e){return this.callback(e)}},Pve=(i,e=null)=>new AO(i,Vt(e)),Dm=class extends Al{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},mO=class extends Ni{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},Ive=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=lM("float")):(t=SZ(e),n=lM(e));let r=new mO(i,t,n);return t0(r,e,i)},Nve=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=lM("float")):(t=SZ(e),n=lM(e));let r=new Dm(i,t,n);return t0(r,e,r.count)},gO=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 )"}},Lve=xt(gO),i8=new on,ZJ=Ht(0).setGroup(Zt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),_O=Ht(1).setGroup(Zt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),KJ=Ht(new on).setGroup(Zt).onRenderUpdate(({scene:i})=>{let e=i.background;return e!==null&&e.isTexture&&e.mapping!==p2||i.backgroundNode&&i.backgroundNode.isNode?i8.makeRotationFromEuler(i.backgroundRotation).transpose():i8.identity(),i8}),VM=class extends Ac{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=So.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(So.READ_WRITE)}toReadOnly(){return this.setAccess(So.READ_ONLY)}toWriteOnly(){return this.setAccess(So.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}},QJ=Vn(VM).setParameterLength(1,3),Dve=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?n=i.store(e,t):(n=QJ(i,e,t),t!==null&&n.toStack()),n},xO=class extends VM{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")}},Fve=Vn(xO).setParameterLength(1,3),Ove=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()}),yO=class extends Ac{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 Ove({texture:this,uv:e})}},wU=Vn(yO).setParameterLength(1,3),Bve=(...i)=>wU(...i).setSampler(!1),Uve=(i,e,t)=>wU(i,e).level(t),vO=class extends C1{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}},kve=(i,e,t)=>new vO(i,e,t),qY=new WeakMap,bO=class extends dr{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=HY(n);this.previousModelWorldMatrix.value.copy(r);let s=JJ(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}){HY(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?Ea:Ht(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(Rh).mul(hr),r=this.previousProjectionMatrix.mul(t).mul(Im),s=n.xy.div(n.w),o=r.xy.div(r.w);return ni(s,o)}};function JJ(i){let e=qY.get(i);return e===void 0&&(e={},qY.set(i,e)),e}function HY(i,e=0){let t=JJ(i),n=t[e];return n===void 0&&(t[e]=n=new on,t[e].copy(i.matrixWorld)),n}var Gve=xt(bO),zve=Ae(([i,e])=>Qa(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Vve=Ae(([i,e])=>Qa(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),qve=Ae(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Hve=Ae(([i,e])=>jn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),Cm(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Wve=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"}]}),jve=Ae(([i])=>SU(i.rgb)),Xve=Ae(([i,e=se(1)])=>e.mix(SU(i.rgb),i.rgb).max(0)),$ve=Ae(([i,e=se(0)])=>{let t=us(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 jn(i.rgb,n,r).max(0)}),Yve=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(pc(t,i.rgb).mul(n.oneMinus()))))).max(0)}),SU=(i,e=pe(sn.getLuminanceCoefficients(new ie)))=>pc(i,e),Zve=Ae(([i,e=pe(1),t=pe(0),n=pe(1),r=se(1),s=pe(sn.getLuminanceCoefficients(new ie,Gd))])=>{let o=i.rgb.dot(pe(s)),a=br(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)}),Kve=Ae(([i,e])=>i.mul(e).floor().div(e)),BE=null,wO=class extends R1{static get type(){return"ViewportSharedTextureNode"}constructor(e=tu,t=null){BE===null&&(BE=new yA),super(e,t,BE)}getTextureForReference(){return BE}updateReference(){return this}},Qve=Vn(wO).setParameterLength(0,2),UE=new Oe,qM=class extends Ac{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)}},HM=class extends qM{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}},Lh=class i extends dr{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 ca(this._width,this._height,{type:Li,...r});s.texture.name="output";let o=null;(this.scope===i.DEPTH||r.depthBuffer!==!1)&&(o=new os,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 HM(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 HM(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=GC(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=Sm(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=Yi),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),UE.set(s.width,s.height)):(r=this.camera,t.getDrawingBufferSize(UE)),this.setSize(UE.width,UE.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:Qf({...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()}};Lh.COLOR="color";Lh.DEPTH="depth";var Jve=(i,e,t)=>new Lh(Lh.COLOR,i,e,t),ebe=(i,e)=>new qM(i,e),tbe=(i,e,t)=>new Lh(Lh.DEPTH,i,e,t),SO=class extends Lh{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Lh.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 pr;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=ui;let t=ea.negate(),n=Ea.mul(Rh),r=se(1),s=n.mul(Lt(hr,1)),o=n.mul(Lt(hr.add(t),1)),a=Qo(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}},nbe=(i,e,t=new Ut(0,0,0),n=.003,r=1)=>new SO(i,e,Vt(t),Vt(n),Vt(r)),eee=Ae(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),tee=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"}]}),nee=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"}]}),ibe=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)}),iee=Ae(([i,e])=>{let t=io(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=io(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=ibe(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),rbe=io(pe(1.6605,-.1246,-.0182),pe(-.5876,1.1329,-.1006),pe(-.0728,-.0083,1.1187)),sbe=io(pe(.6274,.0691,.0164),pe(.3293,.9195,.088),pe(.0433,.0113,.8956)),obe=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))))}),ree=Ae(([i,e])=>{let t=pe(i).toVar(),n=io(pe(.856627153315983,.137318972929847,.11189821299995),pe(.0951212405381588,.761241990602591,.0767994186031903),pe(.0482516061458583,.101439036467562,.811302368396859)),r=io(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(sbe.mul(t)),t.assign(n.mul(t)),t.assign(br(t,1e-10)),t.assign(wh(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(ru(t,0,1)),t.assign(obe(t)),t.assign(r.mul(t)),t.assign(uc(br(pe(0),t),pe(2.2))),t.assign(rbe.mul(t)),t.assign(ru(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),see=Ae(([i,e])=>{let t=se(.76),n=se(.15);i=i.mul(e);let r=Qa(i.r,Qa(i.g,i.b)),s=Ko(r.lessThan(.08),r.sub(bn(6.25,r.mul(r))),.04);i.subAssign(s);let o=br(i.r,br(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,Il(1,n.mul(o.sub(l)).add(1)));return jn(i,pe(l),c)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Ki=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}},WC=Vn(Ki).setParameterLength(1,3),abe=(i,e)=>WC(i,e,"js"),lbe=(i,e)=>WC(i,e,"wgsl"),cbe=(i,e)=>WC(i,e,"glsl"),WM=class extends Ki{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)}},oee=(i,e=[],t="")=>{let n=new WM(i,e,t);return h7((...s)=>n.call(...s),n)},ube=(i,e)=>oee(i,e,"glsl"),hbe=(i,e)=>oee(i,e,"wgsl");function TU(i){let e,t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||es.z).negate()}var aee=Ae(([i,e],t)=>{let n=TU(t);return Nl(i,e,n)}),lee=Ae(([i],e)=>{let t=TU(e);return i.mul(i,t,t).negate().exp().oneMinus()}),fbe=Ae(([i,e],t)=>{let n=TU(t),s=e.sub(Eh.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),TO=Ae(([i,e])=>Lt(e.toFloat().mix(y1.rgb,i.toVec3()),y1.a)),cm=null,um=null,EO=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(Qp(t.value)),s=e.getTypeLength(Qp(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 wM('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(Qp(o)),c=e.getTypeLength(Qp(a));cm=cm||new gn,um=um||new gn,cm.setScalar(0),um.setScalar(0),l===1?cm.setScalar(o):o.isColor?cm.set(o.r,o.g,o.b,1):cm.set(o.x,o.y,o.z||0,o.w||0),c===1?um.setScalar(a):a.isColor?um.set(a.r,a.g,a.b,1):um.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=cm.getComponent(S),P=um.getComponent(S);p[w]=Wc.lerp(T,P,Math.random())}let x=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=O1(p,"vec4",t.count).element(nu).convert(x);else{let w=new Al(p,4);e.geometry.setAttribute("__range"+this.id,w),n=FC(w).convert(x)}}else n=se(0);return n}},dbe=Vn(EO).setParameterLength(2),MO=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}},vb=(i,e)=>new MO(i,e),pbe=vb("numWorkgroups","uvec3"),Abe=vb("workgroupId","uvec3"),mbe=vb("globalId","uvec3"),gbe=vb("localId","uvec3"),_be=vb("subgroupSize","uint"),CO=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)}},EU=Vn(CO),xbe=()=>EU("workgroup").toStack(),ybe=()=>EU("storage").toStack(),vbe=()=>EU("texture").toStack(),RO=class extends $f{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}},PO=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 Fr),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new RO(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)}},bbe=(i,e)=>new PO("Workgroup",i,e),fs=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=Cl(u,s).toConst()),t.constNode.build(e)}};fs.ATOMIC_LOAD="atomicLoad";fs.ATOMIC_STORE="atomicStore";fs.ATOMIC_ADD="atomicAdd";fs.ATOMIC_SUB="atomicSub";fs.ATOMIC_MAX="atomicMax";fs.ATOMIC_MIN="atomicMin";fs.ATOMIC_AND="atomicAnd";fs.ATOMIC_OR="atomicOr";fs.ATOMIC_XOR="atomicXor";var wbe=Vn(fs),Fh=(i,e,t)=>wbe(i,e,t).toStack(),Sbe=i=>Fh(fs.ATOMIC_LOAD,i,null),Tbe=(i,e)=>Fh(fs.ATOMIC_STORE,i,e),Ebe=(i,e)=>Fh(fs.ATOMIC_ADD,i,e),Mbe=(i,e)=>Fh(fs.ATOMIC_SUB,i,e),Cbe=(i,e)=>Fh(fs.ATOMIC_MAX,i,e),Rbe=(i,e)=>Fh(fs.ATOMIC_MIN,i,e),Pbe=(i,e)=>Fh(fs.ATOMIC_AND,i,e),Ibe=(i,e)=>Fh(fs.ATOMIC_OR,i,e),Nbe=(i,e)=>Fh(fs.ATOMIC_XOR,i,e),Ft=class i extends dr{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 Lbe=lt(Ft,Ft.SUBGROUP_ELECT).setParameterLength(0),Dbe=lt(Ft,Ft.SUBGROUP_BALLOT).setParameterLength(1),Fbe=lt(Ft,Ft.SUBGROUP_ADD).setParameterLength(1),Obe=lt(Ft,Ft.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),Bbe=lt(Ft,Ft.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),Ube=lt(Ft,Ft.SUBGROUP_MUL).setParameterLength(1),kbe=lt(Ft,Ft.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),Gbe=lt(Ft,Ft.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),zbe=lt(Ft,Ft.SUBGROUP_AND).setParameterLength(1),Vbe=lt(Ft,Ft.SUBGROUP_OR).setParameterLength(1),qbe=lt(Ft,Ft.SUBGROUP_XOR).setParameterLength(1),Hbe=lt(Ft,Ft.SUBGROUP_MIN).setParameterLength(1),Wbe=lt(Ft,Ft.SUBGROUP_MAX).setParameterLength(1),jbe=lt(Ft,Ft.SUBGROUP_ALL).setParameterLength(0),Xbe=lt(Ft,Ft.SUBGROUP_ANY).setParameterLength(0),$be=lt(Ft,Ft.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),Ybe=lt(Ft,Ft.QUAD_SWAP_X).setParameterLength(1),Zbe=lt(Ft,Ft.QUAD_SWAP_Y).setParameterLength(1),Kbe=lt(Ft,Ft.QUAD_SWAP_DIAGONAL).setParameterLength(1),Qbe=lt(Ft,Ft.SUBGROUP_BROADCAST).setParameterLength(2),Jbe=lt(Ft,Ft.SUBGROUP_SHUFFLE).setParameterLength(2),ewe=lt(Ft,Ft.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),twe=lt(Ft,Ft.SUBGROUP_SHUFFLE_UP).setParameterLength(2),nwe=lt(Ft,Ft.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),iwe=lt(Ft,Ft.QUAD_BROADCAST).setParameterLength(1),kE;function jC(i){kE=kE||new WeakMap;let e=kE.get(i);return e===void 0&&kE.set(i,e={}),e}function XC(i){let e=jC(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 cee(i,e=Eh){let t=XC(i).mul(e);return t.xyz.div(t.w)}function MU(i){let e=jC(i);return e.position||(e.position=Ht(new ie).setGroup(Zt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function uee(i){let e=jC(i);return e.targetPosition||(e.targetPosition=Ht(new ie).setGroup(Zt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function CU(i){let e=jC(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 RU=i=>c0.transformDirection(MU(i).sub(uee(i))),rwe=Kf("vec3","totalDiffuse"),swe=Kf("vec3","totalSpecular"),owe=Kf("vec3","outgoingLight"),awe=i=>i.sort((e,t)=>e.id-t.id),lwe=(i,e)=>{for(let t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},r8=new WeakMap,Rv=[],cb=class extends $t{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=rwe,this.totalSpecularNode=swe,this.outgoingLightNode=owe,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let n=0;n<e.length;n++){let r=e[n];if(Rv.push(r.id),Rv.push(r.castShadow?1:0),r.isSpotLight===!0){let s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;Rv.push(s,o)}}let t=gb(Rv);return Rv.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=awe([...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=lwe(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}r8.has(l)===!1&&r8.set(l,new u(l)),c=r8.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}},cwe=(i=[])=>new cb().setLights(i),IO=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}){PU.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||Eh)}},PU=Kf("vec3","shadowPositionWorld");function uwe(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 hwe(i,e){return e=uwe(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function fwe(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 dwe(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function pwe(i,e){return e=dwe(i,e),i.background=null,i.backgroundNode=null,i.overrideMaterial=null,e}function Awe(i,e){i.background=e.background,i.backgroundNode=e.backgroundNode,i.overrideMaterial=e.overrideMaterial}function mwe(i,e,t){return t=hwe(i,t),t=pwe(e,t),t}function gwe(i,e,t){fwe(i,t),Awe(e,t)}var jM=new WeakMap,hee=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)}),fee=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=tr("mapSize","vec2",t).setGroup(Zt),o=tr("radius","float",t).setGroup(Zt),a=ft(1).div(s),l=o.mul(a.x),c=bU(km.xy).mul(6.28318530718);return us(r(e.xy.add(eu(0,5,c).mul(l)),e.z),r(e.xy.add(eu(1,5,c).mul(l)),e.z),r(e.xy.add(eu(2,5,c).mul(l)),e.z),r(e.xy.add(eu(3,5,c).mul(l)),e.z),r(e.xy.add(eu(4,5,c).mul(l)),e.z)).mul(1/5)}),dee=Ae(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=tr("mapSize","vec2",t).setGroup(Zt),s=ft(1).div(r),o=e.xy,a=iu(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(vr(-1,1)).toConst(),u=l(vr(1,1)).toConst(),f=l(vr(-1,-1)).toConst(),p=l(vr(1,-1)).toConst();return us(jn(c.x,u.y,a.x).add(c.y).add(u.x).mul(a.y),jn(c.w,u.z,a.x).add(c.z).add(u.w),jn(f.x,p.y,a.x).add(f.y).add(p.x),jn(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=ai(i).sample(e.xy);i.isArrayTexture&&(r=r.depth(t)),r=r.rg;let s=r.x,o=br(1e-7,r.y.mul(r.y)),a=n.renderer.reversedDepthBuffer?Cm(s,e.z):Cm(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=ru(ni(u,.3).div(.65)),l.assign(br(a,u))}),l}),Aee=i=>{let e=jM.get(i);return e===void 0&&(e=new pr,e.colorNode=Lt(0,0,0,1),e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.blending=$r,e.fog=!1,jM.set(i,e)),e},mee=i=>{let e=jM.get(i);e!==void 0&&(e.dispose(),jM.delete(i))},WY=new Ih,r1=[],gee=(i,e,t,n)=>{r1[0]=i,r1[1]=e;let r=WY.get(r1);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===Kl)&&(n&&(TZ(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,WY.set(r1,r)),r1[0]=null,r1[1]=null,r},_we=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));Ci({start:fe(0),end:fe(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(se(u).mul(a)),p=n.sample(us(km.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=Ma(o.sub(s.mul(s)).max(0));return ft(s,c)}),xwe=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));Ci({start:fe(0),end:fe(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(se(u).mul(a)),p=n.sample(us(km.xy,ft(f,0).mul(e)).div(t));n.value.isArrayTexture&&(p=p.depth(r)),s.addAssign(p.x),o.addAssign(us(p.y.mul(p.y),p.x.mul(p.x)))}),s.divAssign(i),o.divAssign(i);let c=Ma(o.sub(s.mul(s)).max(0));return ft(s,c)}),ywe=[hee,fee,dee,pee],s8,GE=new lb,XM=class extends IO{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||tr("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=tr("near","float",n.camera).setGroup(Zt),u=tr("far","float",n.camera).setGroup(Zt);a=zC(l.negate(),c,u)}return o=pe(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return ywe[e]}setupRenderTarget(e,t){let n=new os(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Hc:th;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(Df.TEXTURE_COMPARE);if((l===Jd||l===GT)&&c?(o.minFilter=vi,o.magFilter=vi):(o.minFilter=xi,o.magFilter=xi),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===Kl&&s.isPointLightShadow!==!0){o.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ss,type:Li,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:Ss,type:Li,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:Ss,type:Li,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ss,type:Li,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=tr("blurSamples","float",s).setGroup(Zt),B=tr("radius","float",s).setGroup(Zt),z=tr("mapSize","vec2",s).setGroup(Zt),V=this.vsmMaterialVertical||(this.vsmMaterialVertical=new pr);V.fragmentNode=_we({samples:N,radius:B,size:z,shadowPass:D,depthLayer:this.depthLayer}).context(e.getSharedContext()),V.name="VSMVertical",V=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new pr),V.fragmentNode=xwe({samples:N,radius:B,size:z,shadowPass:F,depthLayer:this.depthLayer}).context(e.getSharedContext()),V.name="VSMHorizontal"}let u=tr("intensity","float",s).setGroup(Zt),f=tr("normalBias","float",s).setGroup(Zt),p=XC(r),x=u0.mul(f),v;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?v=p.mul(PU.add(x)):v=Ht("mat4").onObjectUpdate(({object:F},N)=>N.value.multiplyMatrices(p.value,F.matrixWorld)).mul(hr).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===Kl&&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=Ta(a.texture,w.xyz):(R=ai(a.texture,w),o.isArrayTexture&&(R=R.depth(this.depthLayer))));let C;R?C=jn(1,P.rgb.mix(R,1),u.mul(R.a)).toVar():C=jn(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?Ta(this.shadowMap.texture,wF()):ai(this.shadowMap.texture)),C.toInspector(`${L} / Depth`,()=>{let D=tr("near","float",this.shadow.camera),F=tr("far","float",this.shadow.camera),N;this.shadowMap.texture.isCubeTexture?N=Ta(this.shadowMap.depthTexture,wF()).r:N=ai(this.shadowMap.depthTexture).r;let B;return this.shadow.camera.isPerspectiveCamera?B=GC(N,D,F):B=yJ(N,D,F),B=Sm(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;s8=mwe(s,o,s8),o.overrideMaterial=Aee(n),s.setRenderObjectFunction(gee(s,r,l,x)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(f),l===Kl&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=u,gwe(s,o,s8)}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),GE.material=this.vsmMaterialVertical,GE.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),GE.material=this.vsmMaterialHorizontal,GE.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,mee(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))}},_ee=(i,e)=>new XM(i,e),vwe=new Ut,jY=new on,Pv=new ie,o8=new ie,bwe=[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)],Swe=[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)],Twe=[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)],xee=Ae(({depthTexture:i,bd3D:e,dp:t})=>Ta(i,e).compare(t)),yee=Ae(({depthTexture:i,bd3D:e,dp:t,shadow:n})=>{let r=tr("radius","float",n).setGroup(Zt),s=tr("mapSize","vec2",n).setGroup(Zt),o=r.div(s.x),a=Qi(e),l=Qo(Yf(e,a.x.greaterThan(a.z).select(pe(0,1,0),pe(1,0,0)))),c=Yf(e,l),u=bU(km.xy).mul(6.28318530718),f=eu(0,5,u),p=eu(1,5,u),x=eu(2,5,u),v=eu(3,5,u),w=eu(4,5,u);return Ta(i,e.add(l.mul(f.x).add(c.mul(f.y)).mul(o))).compare(t).add(Ta(i,e.add(l.mul(p.x).add(c.mul(p.y)).mul(o))).compare(t)).add(Ta(i,e.add(l.mul(x.x).add(c.mul(x.y)).mul(o))).compare(t)).add(Ta(i,e.add(l.mul(v.x).add(c.mul(v.y)).mul(o))).compare(t)).add(Ta(i,e.add(l.mul(w.x).add(c.mul(w.y)).mul(o))).compare(t)).mul(1/5)}),Ewe=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=tr("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=vJ(a.negate(),l,c),p.subAssign(u)):r.renderer.logarithmicDepthBuffer?(p=zC(a.negate(),l,c),p.addAssign(u)):(p=AU(a.negate(),l,c),p.addAssign(u));let x=s.normalize();f.assign(i({depthTexture:e,bd3D:x,dp:p,shadow:n}))}),f}),NO=class extends XM{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===XN?xee:yee}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return Ewe({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){let n=new p_(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Hc:th;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===qa,u=c?bwe:Swe,f=c?wwe:Twe;n.setSize(t.mapSize.width,t.mapSize.width);let p=s.autoClear,x=s.getClearColor(vwe),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()),Pv.setFromMatrixPosition(r.matrixWorld),a.position.copy(Pv),o8.copy(a.position),o8.add(u[w]),a.up.copy(f[w]),a.lookAt(o8),a.updateMatrixWorld(),l.makeTranslation(-Pv.x,-Pv.y,-Pv.z),jY.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(jY,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)}},vee=(i,e)=>new NO(i,e),Zf=class extends s0{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 CU(this.light).sub(e.context.positionView||es)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return _ee(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)}},IU=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)}),bee=({color:i,lightVector:e,cutoffDistance:t,decayExponent:n})=>{let r=e.normalize(),s=e.length(),o=IU({lightDistance:s,cutoffDistance:t,decayExponent:n}),a=i.mul(o);return{lightDirection:r,lightColor:a}},LO=class extends Zf{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 vee(this.light)}setupDirect(e){return bee({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},Mwe=Ae(([i=Ri()])=>{let e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),Cwe=Ae(([i=Ri()],{renderer:e,material:t})=>{let n=F7(i.mul(2).sub(1)),r;if(t.alphaToCoverage&&e.currentSamples>0){let s=se(n.fwidth()).toVar();r=Nl(s.oneMinus(),s.add(1),n).oneMinus()}else r=Ko(n.greaterThan(1),0,1);return r}),$v=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=Pl(i).toVar();return Ko(s,r,n).uniformFlow()}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),$M=Ae(([i,e])=>{let t=Pl(e).toVar(),n=se(i).toVar();return Ko(t,n.negate(),n).uniformFlow()}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),cs=Ae(([i])=>{let e=se(i).toVar();return fe(Sh(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),fr=Ae(([i,e])=>{let t=se(i).toVar();return e.assign(cs(t)),t.sub(se(e))}),Rwe=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"}]}),Pwe=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"}]}),wee=Eo([Rwe,Pwe]),Iwe=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"}]}),Nwe=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"}]}),See=Eo([Iwe,Nwe]),Lwe=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($v(o.lessThan(it(4)),r,n)).toVar(),l=se(bn(2,$v(o.lessThan(it(4)),n,r))).toVar();return $M(a,Pl(o.bitAnd(it(1)))).add($M(l,Pl(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"}]}),Dwe=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($v(l.lessThan(it(8)),o,s)).toVar(),u=se($v(l.lessThan(it(4)),s,$v(l.equal(it(12)).or(l.equal(it(14))),o,r))).toVar();return $M(c,Pl(l.bitAnd(it(1)))).add($M(u,Pl(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"}]}),no=Eo([Lwe,Dwe]),Fwe=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=Bm(i).toVar();return pe(no(s.x,r,n),no(s.y,r,n),no(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"}]}),Owe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=se(e).toVar(),a=Bm(i).toVar();return pe(no(a.x,o,s,r),no(a.y,o,s,r),no(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"}]}),lc=Eo([Fwe,Owe]),Bwe=Ae(([i])=>{let e=se(i).toVar();return bn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Uwe=Ae(([i])=>{let e=se(i).toVar();return bn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),kwe=Ae(([i])=>{let e=pe(i).toVar();return bn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Tee=Eo([Bwe,kwe]),Gwe=Ae(([i])=>{let e=pe(i).toVar();return bn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Eee=Eo([Uwe,Gwe]),Ml=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"}]}),Mee=Ae(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(Ml(t,fe(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Ml(i,fe(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Ml(e,fe(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(Ml(t,fe(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Ml(i,fe(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Ml(e,fe(4))),e.addAssign(i)}),bb=Ae(([i,e,t])=>{let n=it(t).toVar(),r=it(e).toVar(),s=it(i).toVar();return n.bitXorAssign(r),n.subAssign(Ml(r,fe(14))),s.bitXorAssign(n),s.subAssign(Ml(n,fe(11))),r.bitXorAssign(s),r.subAssign(Ml(s,fe(25))),n.bitXorAssign(r),n.subAssign(Ml(r,fe(16))),s.bitXorAssign(n),s.subAssign(Ml(n,fe(4))),r.bitXorAssign(s),r.subAssign(Ml(s,fe(14))),n.bitXorAssign(r),n.subAssign(Ml(r,fe(24))),n}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),Jo=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"}]}),Mh=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"}]}),zwe=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 bb(n.add(it(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),Vwe=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)),bb(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),qwe=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)),bb(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),Hwe=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)),Mee(c,u,f),c.addAssign(it(r)),bb(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"}]}),Wwe=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)),Mee(f,p,x),f.addAssign(it(o)),p.addAssign(it(s)),bb(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"}]}),Fi=Eo([zwe,Vwe,qwe,Hwe,Wwe]),jwe=Ae(([i,e])=>{let t=fe(e).toVar(),n=fe(i).toVar(),r=it(Fi(n,t)).toVar(),s=Bm().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"}]}),Xwe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=fe(e).toVar(),s=fe(i).toVar(),o=it(Fi(s,r,n)).toVar(),a=Bm().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"}]}),cc=Eo([jwe,Xwe]),$we=Ae(([i])=>{let e=ft(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=se(fr(e.x,t)).toVar(),s=se(fr(e.y,n)).toVar(),o=se(Mh(r)).toVar(),a=se(Mh(s)).toVar(),l=se(wee(no(Fi(t,n),r,s),no(Fi(t.add(fe(1)),n),r.sub(1),s),no(Fi(t,n.add(fe(1))),r,s.sub(1)),no(Fi(t.add(fe(1)),n.add(fe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return Tee(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),Ywe=Ae(([i])=>{let e=pe(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=fe().toVar(),s=se(fr(e.x,t)).toVar(),o=se(fr(e.y,n)).toVar(),a=se(fr(e.z,r)).toVar(),l=se(Mh(s)).toVar(),c=se(Mh(o)).toVar(),u=se(Mh(a)).toVar(),f=se(See(no(Fi(t,n,r),s,o,a),no(Fi(t.add(fe(1)),n,r),s.sub(1),o,a),no(Fi(t,n.add(fe(1)),r),s,o.sub(1),a),no(Fi(t.add(fe(1)),n.add(fe(1)),r),s.sub(1),o.sub(1),a),no(Fi(t,n,r.add(fe(1))),s,o,a.sub(1)),no(Fi(t.add(fe(1)),n,r.add(fe(1))),s.sub(1),o,a.sub(1)),no(Fi(t,n.add(fe(1)),r.add(fe(1))),s,o.sub(1),a.sub(1)),no(Fi(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 Eee(f)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),NU=Eo([$we,Ywe]),Zwe=Ae(([i])=>{let e=ft(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=se(fr(e.x,t)).toVar(),s=se(fr(e.y,n)).toVar(),o=se(Mh(r)).toVar(),a=se(Mh(s)).toVar(),l=pe(wee(lc(cc(t,n),r,s),lc(cc(t.add(fe(1)),n),r.sub(1),s),lc(cc(t,n.add(fe(1))),r,s.sub(1)),lc(cc(t.add(fe(1)),n.add(fe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return Tee(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),Kwe=Ae(([i])=>{let e=pe(i).toVar(),t=fe().toVar(),n=fe().toVar(),r=fe().toVar(),s=se(fr(e.x,t)).toVar(),o=se(fr(e.y,n)).toVar(),a=se(fr(e.z,r)).toVar(),l=se(Mh(s)).toVar(),c=se(Mh(o)).toVar(),u=se(Mh(a)).toVar(),f=pe(See(lc(cc(t,n,r),s,o,a),lc(cc(t.add(fe(1)),n,r),s.sub(1),o,a),lc(cc(t,n.add(fe(1)),r),s,o.sub(1),a),lc(cc(t.add(fe(1)),n.add(fe(1)),r),s.sub(1),o.sub(1),a),lc(cc(t,n,r.add(fe(1))),s,o,a.sub(1)),lc(cc(t.add(fe(1)),n,r.add(fe(1))),s.sub(1),o,a.sub(1)),lc(cc(t,n.add(fe(1)),r.add(fe(1))),s,o.sub(1),a.sub(1)),lc(cc(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 Eee(f)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),wb=Eo([Zwe,Kwe]),Qwe=Ae(([i])=>{let e=se(i).toVar(),t=fe(cs(e)).toVar();return Jo(Fi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),Jwe=Ae(([i])=>{let e=ft(i).toVar(),t=fe(cs(e.x)).toVar(),n=fe(cs(e.y)).toVar();return Jo(Fi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),eSe=Ae(([i])=>{let e=pe(i).toVar(),t=fe(cs(e.x)).toVar(),n=fe(cs(e.y)).toVar(),r=fe(cs(e.z)).toVar();return Jo(Fi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),tSe=Ae(([i])=>{let e=Lt(i).toVar(),t=fe(cs(e.x)).toVar(),n=fe(cs(e.y)).toVar(),r=fe(cs(e.z)).toVar(),s=fe(cs(e.w)).toVar();return Jo(Fi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),nSe=Eo([Qwe,Jwe,eSe,tSe]),iSe=Ae(([i])=>{let e=se(i).toVar(),t=fe(cs(e)).toVar();return pe(Jo(Fi(t,fe(0))),Jo(Fi(t,fe(1))),Jo(Fi(t,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),rSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe(cs(e.x)).toVar(),n=fe(cs(e.y)).toVar();return pe(Jo(Fi(t,n,fe(0))),Jo(Fi(t,n,fe(1))),Jo(Fi(t,n,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),sSe=Ae(([i])=>{let e=pe(i).toVar(),t=fe(cs(e.x)).toVar(),n=fe(cs(e.y)).toVar(),r=fe(cs(e.z)).toVar();return pe(Jo(Fi(t,n,r,fe(0))),Jo(Fi(t,n,r,fe(1))),Jo(Fi(t,n,r,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),oSe=Ae(([i])=>{let e=Lt(i).toVar(),t=fe(cs(e.x)).toVar(),n=fe(cs(e.y)).toVar(),r=fe(cs(e.z)).toVar(),s=fe(cs(e.w)).toVar();return pe(Jo(Fi(t,n,r,s,fe(0))),Jo(Fi(t,n,r,s,fe(1))),Jo(Fi(t,n,r,s,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),$C=Eo([iSe,rSe,sSe,oSe]),YM=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 Ci(o,()=>{l.addAssign(c.mul(NU(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"}]}),YC=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 Ci(o,()=>{l.addAssign(c.mul(wb(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"}]}),aSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar();return ft(YM(a,o,s,r),YM(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"}]}),lSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar(),l=pe(YC(a,o,s,r)).toVar(),c=se(YM(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"}]}),cSe=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($C(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)),()=>Qi(T.x).add(Qi(T.y))),Wt(a.equal(fe(3)),()=>br(Qi(T.x),Qi(T.y))),pc(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"}]}),uSe=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($C(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)),()=>Qi(C.x).add(Qi(C.y)).add(Qi(C.z))),Wt(c.equal(fe(3)),()=>br(Qi(C.x),Qi(C.y),Qi(C.z))),pc(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"}]}),k1=Eo([cSe,uSe]),hSe=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(fr(s.x,o),fr(s.y,a)).toVar(),c=se(1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(k1(l,u,f,o,a,r,n)).toVar();c.assign(Qa(c,p))})}),Wt(n.equal(fe(0)),()=>{c.assign(Ma(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",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(fr(s.x,o),fr(s.y,a)).toVar(),c=ft(1e6,1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(k1(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(Ma(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",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(fr(s.x,o),fr(s.y,a)).toVar(),c=pe(1e6,1e6,1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(k1(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(Ma(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),pSe=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(fr(s.x,o),fr(s.y,a),fr(s.z,l)).toVar(),u=se(1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ci({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(k1(c,f,p,x,o,a,l,r,n)).toVar();u.assign(Qa(u,v))})})}),Wt(n.equal(fe(0)),()=>{u.assign(Ma(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),ASe=Eo([hSe,pSe]),mSe=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(fr(s.x,o),fr(s.y,a),fr(s.z,l)).toVar(),u=ft(1e6,1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ci({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(k1(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(Ma(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),gSe=Eo([fSe,mSe]),_Se=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(fr(s.x,o),fr(s.y,a),fr(s.z,l)).toVar(),u=pe(1e6,1e6,1e6).toVar();return Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ci({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(k1(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(Ma(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),LU=Eo([dSe,_Se]),xSe=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=Pl(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(wb(D))}),Wt(f.equal(fe(1)),()=>{F.assign($C(D))}),Wt(f.equal(fe(2)),()=>{F.assign(LU(D,w,fe(0)))}),Wt(f.equal(fe(3)),()=>{F.assign(YC(pe(D,0),R,C,L))}),F.assign(F.mul(T.sub(S)).add(S)),Wt(P,()=>{F.assign(ru(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"}]}),ySe=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=Pl(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(wb(D))}),Wt(f.equal(fe(1)),()=>{F.assign($C(D))}),Wt(f.equal(fe(2)),()=>{F.assign(LU(D,w,fe(0)))}),Wt(f.equal(fe(3)),()=>{F.assign(YC(D,R,C,L))}),F.assign(F.mul(T.sub(S)).add(S)),Wt(P,()=>{F.assign(ru(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"}]}),vSe=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(Sh(r)).mul(6).toVar();let s=fe(I7(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"}]}),bSe=Ae(([i])=>{let e=pe(i).toVar(),t=se(e.x).toVar(),n=se(e.y).toVar(),r=se(e.z).toVar(),s=se(Qa(t,Qa(n,r))).toVar(),o=se(br(t,br(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(us(2,r.sub(t).div(a)))}).Else(()=>{l.assign(us(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=A7(b7(e,pe(.04045))).toVar(),n=pe(e.div(12.92)).toVar(),r=pe(uc(br(e.add(pe(.055)),pe(0)).div(1.055),pe(2.4))).toVar();return jn(n,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),Cee=(i,e)=>{i=se(i),e=se(e);let t=ft(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return Nl(i.sub(t),i.add(t),e)},Ree=(i,e,t,n)=>jn(i,e,t[n].clamp()),SSe=(i,e,t=Ri())=>Ree(i,e,t,"x"),TSe=(i,e,t=Ri())=>Ree(i,e,t,"y"),ESe=(i,e,t,n,r=Ri())=>{let s=r.x.clamp(),o=r.y.clamp(),a=jn(i,e,s),l=jn(t,n,s);return jn(a,l,o)},Pee=(i,e,t,n,r)=>jn(i,e,Cee(t,n[r])),MSe=(i,e,t,n=Ri())=>Pee(i,e,t,n,"x"),CSe=(i,e,t,n=Ri())=>Pee(i,e,t,n,"y"),RSe=(i=1,e=0,t=Ri())=>t.mul(i).add(e),PSe=(i,e=1)=>(i=se(i),i.abs().pow(e).mul(i.sign())),ISe=(i,e=1,t=.5)=>se(i).sub(t).mul(e).add(t),NSe=(i=Ri(),e=1,t=0)=>NU(i.convert("vec2|vec3")).mul(e).add(t),LSe=(i=Ri(),e=1,t=0)=>wb(i.convert("vec2|vec3")).mul(e).add(t),DSe=(i=Ri(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Lt(wb(i),NU(i.add(ft(19,73)))).mul(e).add(t)),FSe=(i,e=Ri(),t=ft(1,1),n=ft(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>xSe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),OSe=(i,e=Ri(),t=ft(1,1),n=ft(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>ySe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),BSe=(i=Ri(),e=1)=>ASe(i.convert("vec2|vec3"),e,fe(1)),USe=(i=Ri(),e=1)=>gSe(i.convert("vec2|vec3"),e,fe(1)),kSe=(i=Ri(),e=1)=>LU(i.convert("vec2|vec3"),e,fe(1)),GSe=(i=Ri())=>nSe(i.convert("vec2|vec3")),zSe=(i=Ri(),e=3,t=2,n=.5,r=1)=>YM(i,fe(e),t,n).mul(r),VSe=(i=Ri(),e=3,t=2,n=.5,r=1)=>aSe(i,fe(e),t,n).mul(r),qSe=(i=Ri(),e=3,t=2,n=.5,r=1)=>YC(i,fe(e),t,n).mul(r),HSe=(i=Ri(),e=3,t=2,n=.5,r=1)=>lSe(i,fe(e),t,n).mul(r),WSe=(i,e=se(0))=>us(i,e),jSe=(i,e=se(0))=>ni(i,e),XSe=(i,e=se(1))=>bn(i,e),$Se=(i,e=se(1))=>Il(i,e),YSe=(i,e=se(1))=>CC(i,e),ZSe=(i,e=se(1))=>uc(i,e),KSe=(i=se(0),e=se(1))=>E7(i,e),QSe=()=>U1,JSe=()=>XJ,eTe=(i,e=se(1))=>ni(e,i),tTe=(i,e,t,n)=>i.greaterThan(e).mix(t,n),nTe=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),iTe=(i,e,t,n)=>i.equal(e).mix(t,n),rTe=(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},sTe=(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},oTe=(i,e)=>{i=ft(i),e=se(e);let t=e.mul(Math.PI/180);return yb(i,t)},aTe=(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))},lTe=(i,e)=>(i=pe(i),e=se(e),iU(i,e)),cTe=Ae(([i,e,t])=>{let n=Qo(i).toVar(),r=ni(se(.5).mul(e.sub(t)),Eh).div(n).toVar(),s=ni(se(-.5).mul(e.sub(t)),Eh).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=Qa(o.x,o.y,o.z).toVar();return Eh.add(n.mul(a)).toVar().sub(t)}),Iee=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:xU,BRDF_Lambert:Nm,BasicPointShadowFilter:xee,BasicShadowFilter:hee,Break:mJ,Const:zK,Continue:pye,DFGLUT:ib,D_GGX:RJ,Discard:nQ,EPSILON:RC,F_Schlick:I1,Fn:Ae,HALF_PI:lxe,INFINITY:sxe,If:Wt,Loop:Ci,NodeAccess:So,NodeShaderStage:p1,NodeType:U1e,NodeUpdateType:_n,OnBeforeFrameUpdate:lye,OnBeforeMaterialUpdate:aye,OnBeforeObjectUpdate:oye,OnFrameUpdate:lJ,OnMaterialUpdate:sye,OnObjectUpdate:xb,PCFShadowFilter:fee,PCFSoftShadowFilter:dee,PI:xM,PI2:oxe,PointShadowFilter:yee,Return:xxe,Schlick_to_F0:RF,ShaderNode:g1,Stack:SC,Switch:J1e,TBNViewMatrix:_m,TWO_PI:axe,VSMShadowFilter:pee,V_GGX_SmithCorrelated:CJ,Var:GK,VarIntent:VK,abs:Qi,acesFilmicToneMapping:iee,acos:T7,acosh:mK,add:us,addMethodChaining:Be,addNodeElement:yxe,agxToneMapping:ree,all:oK,alphaT:pM,ambientOcclusion:I8,and:jZ,anisotropy:jp,anisotropyB:vm,anisotropyT:qv,any:aK,append:txe,array:UZ,asin:pK,asinh:AK,assign:kZ,atan:E7,atanh:gK,atomicAdd:Ebe,atomicAnd:Pbe,atomicFunc:Fh,atomicLoad:Sbe,atomicMax:Cbe,atomicMin:Rbe,atomicOr:Ibe,atomicStore:Tbe,atomicSub:Mbe,atomicXor:Nbe,attenuationColor:y7,attenuationDistance:x7,attribute:Rl,attributeArray:Ive,backgroundBlurriness:ZJ,backgroundIntensity:_O,backgroundRotation:KJ,batch:fJ,batchColor:hU,bentNormalView:NQ,billboarding:xve,bitAnd:ZZ,bitNot:KZ,bitOr:QZ,bitXor:JZ,bitangentGeometry:Kxe,bitangentLocal:Qxe,bitangentView:PQ,bitangentWorld:Jxe,bitcast:WJ,blendBurn:zve,blendColor:Wve,blendDodge:Vve,blendOverlay:Hve,blendScreen:qve,blur:FJ,bool:Pl,buffer:O1,bufferAttribute:z7,builtin:Jf,builtinAOContext:UK,builtinShadowContext:BK,bumpMap:iU,bvec2:NZ,bvec3:A7,bvec4:LZ,bypass:eQ,cache:JK,call:GZ,cameraFar:Yp,cameraIndex:l0,cameraNear:$p,cameraNormalMatrix:Cxe,cameraPosition:lQ,cameraProjectionMatrix:Ea,cameraProjectionMatrixInverse:aQ,cameraViewMatrix:c0,cameraViewport:Rxe,cameraWorldMatrix:_b,cbrt:IK,cdl:Zve,ceil:IC,checker:Mwe,cineonToneMapping:nee,clamp:ru,clearcoat:hM,clearcoatNormalView:Zp,clearcoatRoughness:x1,clipSpace:hQ,code:WC,color:IZ,colorSpaceToWorking:LC,colorToDirection:nye,compute:QK,computeKernel:q7,computeSkinning:dye,context:Qf,convert:FZ,convertColorSpace:fxe,convertToTexture:Mve,cos:Jc,cosh:hK,countLeadingZeros:Z2e,countOneBits:K2e,countTrailingZeros:Y2e,cross:Yf,cubeTexture:Ta,cubeTextureBase:tU,dFdx:R7,dFdy:P7,dashSize:bm,debug:rQ,decrement:sK,decrementBefore:iK,defaultBuildStages:nM,defaultShaderStages:EZ,defined:T1,degrees:cK,deltaTime:hve,densityFogFactor:lee,depth:mU,depthPass:tbe,determinant:bK,difference:EK,diffuseColor:Mi,diffuseContribution:pm,directPointLight:bee,directionToColor:tye,directionToFaceDirection:Vxe,dispersion:v7,disposeShadowMaterial:mee,distance:TK,div:Il,dot:pc,drawIndex:KK,dynamicBufferAttribute:Axe,element:DZ,emissive:P8,equal:zZ,equirectDirection:wF,equirectUV:gU,exp:w7,exp2:E1,exponentialHeightFogFactor:fbe,expression:Cl,faceDirection:Q7,faceForward:B7,faceforward:cxe,float:se,floatBitsToInt:j2e,floatBitsToUint:jJ,floor:Sh,fog:TO,fract:iu,frameGroup:ixe,frameId:XJ,frontFacing:fQ,fwidth:N7,gain:J2e,gapSize:Qv,getConstNodeType:PZ,getCurrentStack:f7,getDirection:LJ,getDistanceAttenuation:IU,getGeometryRoughness:MJ,getNormalFromDepth:Rve,getParallaxCorrectNormal:cTe,getRoughness:_U,getScreenPosition:Cve,getShIrradianceAt:Iee,getShadowMaterial:Aee,getShadowRenderObjectFunction:gee,getTextureIndex:qJ,getViewPosition:m1,ggxConvolution:OJ,globalId:mbe,glsl:cbe,glslFn:ube,grayscale:jve,greaterThan:b7,greaterThanEqual:WZ,hash:Q2e,highpModelNormalViewMatrix:K8,highpModelViewMatrix:Z8,hue:Yve,increment:rK,incrementBefore:nK,inspector:sQ,instance:uJ,instanceColor:uU,instanceIndex:nu,instancedArray:Nve,instancedBufferAttribute:FC,instancedDynamicBufferAttribute:V7,instancedMesh:hJ,int:fe,intBitsToFloat:X2e,interleavedGradientNoise:bU,inverse:wK,inverseSqrt:S7,inversesqrt:uxe,invocationLocalIndex:_xe,invocationSubgroupIndex:gxe,ior:Hv,iridescence:EC,iridescenceIOR:fM,iridescenceThickness:dM,isolate:b1,ivec2:vr,ivec3:p7,ivec4:m7,js:abe,label:kK,length:Th,lengthSq:F7,lessThan:qZ,lessThanEqual:HZ,lightPosition:MU,lightProjectionUV:cee,lightShadowMatrix:XC,lightTargetDirection:RU,lightTargetPosition:uee,lightViewPosition:CU,lightingContext:_J,lights:cwe,linearDepth:CM,linearToneMapping:eee,localId:gbe,log:PC,log2:wh,logarithmicDepthToViewZ:xye,luminance:SU,mat2:TC,mat3:io,mat4:e0,matcapUV:BJ,materialAO:oJ,materialAlphaTest:DQ,materialAnisotropy:YQ,materialAnisotropyVector:A1,materialAttenuationColor:iJ,materialAttenuationDistance:nJ,materialClearcoat:qQ,materialClearcoatNormal:WQ,materialClearcoatRoughness:HQ,materialColor:FQ,materialDispersion:sJ,materialEmissive:BQ,materialEnvIntensity:rM,materialEnvRotation:SM,materialIOR:tJ,materialIridescence:ZQ,materialIridescenceIOR:KQ,materialIridescenceThickness:QQ,materialLightMap:cU,materialLineDashOffset:lU,materialLineDashSize:oU,materialLineGapSize:aU,materialLineScale:sU,materialLineWidth:TM,materialMetalness:zQ,materialNormal:VQ,materialOpacity:rU,materialPointSize:rJ,materialReference:Wf,materialReflectivity:sM,materialRefractionRatio:AQ,materialRotation:jQ,materialRoughness:GQ,materialSheen:XQ,materialSheenRoughness:$Q,materialShininess:OQ,materialSpecular:UQ,materialSpecularColor:kQ,materialSpecularIntensity:lF,materialSpecularStrength:Wv,materialThickness:eJ,materialTransmission:JQ,max:br,maxMipLevel:X7,mediumpModelViewMatrix:uQ,metalness:Xf,min:Qa,mix:jn,mixElement:LK,mod:CC,modelDirection:Oxe,modelNormalMatrix:cQ,modelPosition:Bxe,modelRadius:Gxe,modelScale:Uxe,modelViewMatrix:Rh,modelViewPosition:kxe,modelViewProjection:aJ,modelWorldMatrix:hc,modelWorldMatrixInverse:zxe,morphReference:gJ,mrt:HJ,mul:bn,mx_aastep:Cee,mx_add:WSe,mx_atan2:KSe,mx_cell_noise_float:GSe,mx_contrast:ISe,mx_divide:$Se,mx_fractal_noise_float:zSe,mx_fractal_noise_vec2:VSe,mx_fractal_noise_vec3:qSe,mx_fractal_noise_vec4:HSe,mx_frame:JSe,mx_heighttonormal:lTe,mx_hsvtorgb:vSe,mx_ifequal:iTe,mx_ifgreater:tTe,mx_ifgreatereq:nTe,mx_invert:eTe,mx_modulo:YSe,mx_multiply:XSe,mx_noise_float:NSe,mx_noise_vec3:LSe,mx_noise_vec4:DSe,mx_place2d:sTe,mx_power:ZSe,mx_ramp4:ESe,mx_ramplr:SSe,mx_ramptb:TSe,mx_rgbtohsv:bSe,mx_rotate2d:oTe,mx_rotate3d:aTe,mx_safepower:PSe,mx_separate:rTe,mx_splitlr:MSe,mx_splittb:CSe,mx_srgb_texture_to_lin_rec709:wSe,mx_subtract:jSe,mx_timer:QSe,mx_transform_uv:RSe,mx_unifiednoise2d:FSe,mx_unifiednoise3d:OSe,mx_worley_noise_float:BSe,mx_worley_noise_vec2:USe,mx_worley_noise_vec3:kSe,negate:C7,negateOnBackSide:Gm,neutralToneMapping:see,nodeArray:ym,nodeImmutable:xt,nodeObject:Vt,nodeObjectIntent:kv,nodeObjects:wC,nodeProxy:Vn,nodeProxyConstructor:h7,nodeProxyIntent:lt,normalFlat:dQ,normalGeometry:OC,normalLocal:ea,normalMap:oF,normalView:oi,normalViewGeometry:M1,normalWorld:u0,normalWorldGeometry:pQ,normalize:Qo,not:$Z,notEqual:VZ,numWorkgroups:pbe,objectDirection:Pxe,objectGroup:BZ,objectPosition:Nxe,objectRadius:Fxe,objectScale:Lxe,objectViewPosition:Dxe,objectWorldMatrix:Ixe,oneMinus:_K,or:XZ,orthographicDepthToViewZ:yJ,oscSawtooth:Ave,oscSine:fve,oscSquare:dve,oscTriangle:pve,output:y1,outputStruct:q2e,overloadingFn:Eo,overrideNode:zJ,overrideNodes:VJ,packHalf2x16:rve,packNormalToRGB:nU,packSnorm2x16:nve,packUnorm2x16:ive,parabola:cO,parallaxDirection:IQ,parallaxUV:eye,parameter:G2e,pass:Jve,passTexture:ebe,pcurve:eve,perspectiveDepthToViewZ:GC,pmremTexture:vU,pointShadow:vee,pointUV:Lve,pointWidth:nxe,positionGeometry:Yo,positionLocal:hr,positionPrevious:Im,positionView:es,positionViewDirection:zi,positionWorld:Eh,positionWorldDirection:K7,posterize:Kve,pow:uc,pow2:L7,pow3:MK,pow4:D7,premultiplyAlpha:W7,property:Kf,quadBroadcast:iwe,quadSwapDiagonal:Kbe,quadSwapX:Ybe,quadSwapY:Zbe,radians:lK,rand:NK,range:dbe,rangeFogFactor:aee,reciprocal:yK,reference:tr,referenceBuffer:vQ,reflect:SK,reflectVector:_Q,reflectView:mQ,reflector:Sve,refract:O7,refractVector:xQ,refractView:gQ,reinhardToneMapping:tee,remap:H7,remapClamp:tQ,renderGroup:Zt,renderOutput:j7,rendererReference:XK,replaceDefaultUV:mve,rotate:yb,rotateUV:gve,roughness:vh,round:xK,rtt:YJ,sRGBTransferEOTF:HK,sRGBTransferOETF:WK,sample:Pve,sampler:Sxe,samplerComparison:Txe,saturate:NC,saturation:Xve,screenCoordinate:km,screenDPR:Y7,screenSize:Pm,screenUV:tu,select:Ko,setCurrentStack:Kv,setName:U7,shaderStages:iM,shadow:_ee,shadowPositionWorld:PU,shapeCircle:Cwe,sharedUniformGroup:MC,sheen:El,sheenRoughness:Xp,shiftLeft:eK,shiftRight:tK,shininess:AM,sign:M7,sin:Sa,sinc:tve,sinh:uK,skinning:AJ,smoothstep:Nl,smoothstepElement:DK,specularColor:i0,specularColorBlended:mm,specularF90:gm,spherizeUV:_ve,split:exe,spritesheetUV:vve,sqrt:Ma,stack:aM,step:Cm,stepElement:FK,storage:t0,storageBarrier:ybe,storageTexture:QJ,storageTexture3D:Fve,struct:V2e,sub:ni,subBuild:wm,subgroupAdd:Fbe,subgroupAll:jbe,subgroupAnd:zbe,subgroupAny:Xbe,subgroupBallot:Dbe,subgroupBroadcast:Qbe,subgroupBroadcastFirst:$be,subgroupElect:Lbe,subgroupExclusiveAdd:Bbe,subgroupExclusiveMul:Gbe,subgroupInclusiveAdd:Obe,subgroupInclusiveMul:kbe,subgroupIndex:mxe,subgroupMax:Wbe,subgroupMin:Hbe,subgroupMul:Ube,subgroupOr:Vbe,subgroupShuffle:Jbe,subgroupShuffleDown:nwe,subgroupShuffleUp:twe,subgroupShuffleXor:ewe,subgroupSize:_be,subgroupXor:qbe,tan:fK,tangentGeometry:BC,tangentLocal:r0,tangentView:UC,tangentWorld:RQ,tanh:dK,texture:ai,texture3D:wU,texture3DLevel:Uve,texture3DLoad:Bve,textureBarrier:vbe,textureBicubic:jye,textureBicubicLevel:yU,textureCubeUV:DJ,textureLevel:wxe,textureLoad:Jr,textureSize:Rm,textureStore:Dve,thickness:_7,time:U1,toneMapping:$K,toneMappingExposure:YK,toonOutlinePass:nbe,transformDirection:CK,transformNormal:J7,transformNormalByInverseViewMatrix:PK,transformNormalByViewMatrix:RK,transformNormalToView:eU,transformedClearcoatNormalView:Wxe,transformedNormalView:qxe,transformedNormalWorld:Hxe,transmission:mM,transpose:vK,triNoise3D:cve,triplanarTexture:bve,triplanarTextures:$J,trunc:I7,uint:it,uintBitsToFloat:$2e,uniform:Ht,uniformArray:wo,uniformCubeTexture:jxe,uniformFlow:OK,uniformGroup:OZ,uniformTexture:bxe,unpackHalf2x16:ave,unpackNormal:rF,unpackRGBToNormal:LQ,unpackSnorm2x16:sve,unpackUnorm2x16:ove,unpremultiplyAlpha:iQ,userData:kve,uv:Ri,uvec2:d7,uvec3:Bm,uvec4:g7,varying:a0,varyingProperty:Um,vec2:ft,vec3:pe,vec4:Lt,vectorComponents:Om,velocity:Gve,vertexColor:wJ,vertexIndex:ZK,vertexStage:qK,vibrance:$ve,viewZToLogarithmicDepth:zC,viewZToOrthographicDepth:Sm,viewZToPerspectiveDepth:AU,viewZToReversedOrthographicDepth:_ye,viewZToReversedPerspectiveDepth:vJ,viewport:S1,viewportCoordinate:oQ,viewportDepthTexture:pU,viewportLinearDepth:yye,viewportMipTexture:dU,viewportOpaqueMipTexture:xJ,viewportResolution:Mxe,viewportSafeUV:yve,viewportSharedTexture:Qve,viewportSize:Z7,viewportTexture:mye,viewportUV:Exe,vogelDiskSample:eu,wgsl:lbe,wgslFn:hbe,workgroupArray:bbe,workgroupBarrier:xbe,workgroupId:Abe,workingToColorSpace:jK,xor:YZ}),Kc=new sb,DO=class extends Nh{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(Kc),Kc.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(Kc),Kc.a=1,o=!0;else if(s.isNode===!0){let l=this.get(e),c=s;Kc.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(_O).context({getUV:()=>KJ.mul(pQ),getTextureLevel:()=>ZJ}),x=Ea.element(3).element(3).equal(1),v=Il(1,Ea.element(1).element(1)).mul(3),w=x.select(hr.mul(v),hr),S=Rh.mul(Lt(w,0)),T=Ea.mul(Lt(S.xyz,1));T=T.setZ(T.w);let P=new pr;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 Hn(new pa(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(_O),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"?Kc.set(0,0,0,1):a==="alpha-blend"&&Kc.set(0,0,0,0),r.autoClear===!0||o===!0){let l=n.clearColorValue;l.r=Kc.r,l.g=Kc.g,l.b=Kc.b,l.a=Kc.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}},uTe=0,ub=class{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=uTe++}},FO=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 ub(t.name,[]);e.push(r);for(let s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}},ZM=class{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}},OO=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}},KM=class{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}},BO=class extends KM{constructor(e,t,n=null,r=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=r}},UO=class{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}},hTe=0,Yv=class{constructor(e=null){this.id=hTe++,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)}},kO=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},Dh=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}},GO=class extends Dh{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},zO=class extends Dh{constructor(e,t=new Oe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},VO=class extends Dh{constructor(e,t=new ie){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},qO=class extends Dh{constructor(e,t=new gn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},HO=class extends Dh{constructor(e,t=new Ut){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},WO=class extends Dh{constructor(e,t=new w_){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},jO=class extends Dh{constructor(e,t=new Sn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},XO=class extends Dh{constructor(e,t=new on){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},$O=class extends GO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},YO=class extends zO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},ZO=class extends VO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},KO=class extends qO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},QO=class extends HO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},JO=class extends WO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},eB=class extends jO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},tB=class extends XO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},fTe=0,XY=new WeakMap,$Y=new WeakMap,dTe=new WeakMap,pTe=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),zE=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0")),Nee=i=>{if(i.writeUsageCount>0)return!0;if(i.subBuildsCache!==void 0){for(let e in i.subBuildsCache)if(Nee(i.subBuildsCache[e]))return!0}return!1},QM=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 Yv,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:fTe++})}isFlatShading(){return this.material.flatShading===!0||this.geometry.hasAttribute("normal")===!1}isOpaque(){let e=this.material;return e.transparent===!1&&e.blending===ss&&e.alphaToCoverage===!1}createRenderTarget(e,t,n){return new ca(e,t,n)}createCubeRenderTarget(e,t){return new RM(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===Ir?o="ivec":r===pi&&(o="uvec"),s===Lf||s===Xu?r===Ir?t="int":r===pi?t="uint":t="float":s===Ss||s===$u?t=`${o}2`:s===Nf||s===m2?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=XY.get(a);l===void 0&&(l=new Map,XY.set(a,l));let c=F1(o);s=l.get(c),s===void 0&&(s=new ub(e,t),l.set(c,s))}else s=new ub(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 iM)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===vi||e.magFilter===np||e.magFilter===Jl||e.magFilter===go||e.minFilter===vi||e.minFilter===np||e.minFilter===Jl||e.minFilter===go}getUniformBufferLimit(){return this.renderer.backend.capabilities.getUniformBufferLimit()}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error("THREE.NodeBuilder: Invalid node chaining!")}getMethod(e){return e}getTernary(){return null}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}addContext(e){let t=this.getContext();return this.setContext({...this.context,...e}),t}getSharedContext(){let e={...this.context};return delete e.material,delete e.getUV,delete e.getOutput,delete e.getTextureLevel,delete e.getAO,delete e.getShadow,e}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){let n=this.getDataFromNode(e);return n.cache===void 0&&(n.cache=new Yv(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(Nee(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 zE(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")}( ${zE(t.r)}, ${zE(t.g)}, ${zE(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 ZM(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===Ir?"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=wZ(e),r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return pTe.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 f_)&&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=f7();return this.stacks.push(e),Kv(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,Kv(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 ZM(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 kO(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 OO(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 KM(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 BO(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 UO("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=$Y.get(t);n===void 0&&(n=new WeakMap,$Y.set(t,n));let r=n.get(e);if(r===void 0){r=new WM;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 UM(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 Yv,this.stack=aM();for(let u of nM)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()}},Ci=(...i)=>new mF(bm(i,"int")).toStack(),vye=()=>Rl("continue").toStack(),yJ=()=>Rl("break").toStack(),X6=new WeakMap,wl=new gn,AY=new WeakMap,mY=Ae(({bufferMap:i,influence:e,stride:t,width:n,depth:r,offset:s})=>{let o=fe(eQ).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 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=X6.get(i);if(o===void 0||o.count!==s){let T=function(){w.dispose(),X6.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 _A(v,f,p,s);w.type=Yi,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&&(wl.fromBufferAttribute(R,F),v[D+N+0]=wl.x,v[D+N+1]=wl.y,v[D+N+2]=wl.z,v[D+N+3]=0),t===!0&&(wl.fromBufferAttribute(C,F),v[D+N+4]=wl.x,v[D+N+5]=wl.y,v[D+N+6]=wl.z,v[D+N+7]=0),n===!0&&(wl.fromBufferAttribute(L,F),v[D+N+8]=wl.x,v[D+N+9]=wl.y,v[D+N+10]=wl.z,v[D+N+11]=L.itemSize===4?wl.w:1)}}o={count:s,texture:w,stride:u,size:new Oe(f,p)},X6.set(i,o),i.addEventListener("dispose",T)}return o}var vJ=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=AY.get(i);(o===void 0||o.count!==s)&&(o={base:Ht(1),influences:i.morphTargetInfluences?So(i.morphTargetInfluences,"float"):null,count:s},AY.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);Ci(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(iu))).r):v.assign(l.element(x).toVar()),Wt(v.notEqual(0),()=>{t===!0&&fr.addAssign(mY({bufferMap:c,influence:v,stride:u,width:p,depth:x,offset:fe(0)})),n===!0&&ta.addAssign(mY({bufferMap:c,influence:v,stride:u,width:p,depth:x,offset:fe(1)}))})}),vb(({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"),a0=class extends $t{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}},gF=class extends a0{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},_F=class extends tb{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)}},bJ=qn(_F),xF=class extends a0{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},cm=new Oe,I1=class extends gc{static get type(){return"ViewportTextureNode"}constructor(e=nu,t=null,n=null){let r=null;n===null?(r=new bA,r.minFilter=_o,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(cm):s.getDrawingBufferSize?s.getDrawingBufferSize(cm):cm.set(s.width,s.height);let o=this.getTextureForReference(s);(o.image.width!==cm.width||o.image.height!==cm.height)&&(o.image.width=cm.width,o.image.height=cm.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}},wye=qn(I1).setParameterLength(0,3),mU=qn(I1,null,null,{generateMipmaps:!0}).setParameterLength(0,3),Sye=mU(),wJ=(i=nu,e=null)=>Sye.sample(i,e),$6=null,yF=class extends I1{static get type(){return"ViewportDepthTextureNode"}constructor(e=nu,t=null,n=null){n===null&&($6===null&&($6=new ls),n=$6),super(e,t,n)}},gU=qn(yF).setParameterLength(0,3),ou=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=EJ().assign(n));else if(t===i.DEPTH)e.isPerspectiveCamera?r=_U(ts.z,Zp,Kp):r=Em(ts.z,Zp,Kp);else if(t===i.LINEAR_DEPTH)if(n!==null)if(e.isPerspectiveCamera){let s=qC(n,Zp,Kp);r=Em(s,Zp,Kp)}else r=n;else r=Em(ts.z,Zp,Kp);return r}};ou.DEPTH_BASE="depthBase";ou.DEPTH="depth";ou.LINEAR_DEPTH="linearDepth";var Em=(i,e,t)=>i.add(e).div(e.sub(t)),Tye=(i,e,t)=>i.add(t).div(t.sub(e)),SJ=Ae(([i,e,t],n)=>n.renderer.reversedDepthBuffer===!0?t.sub(e).mul(i).sub(t):e.sub(t).mul(i).sub(e)),_U=(i,e,t)=>e.add(i).mul(t).div(t.sub(e).mul(i)),TJ=(i,e,t)=>e.mul(i.add(t)).div(i.mul(e.sub(t))),qC=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))),HC=(i,e,t)=>{e=e.max(1e-6).toVar();let n=Sh(i.negate().div(e)),r=Sh(t.div(e));return n.div(r)},Eye=(i,e,t)=>{let n=i.mul(LC(t.div(e)));return se(Math.E).pow(n).mul(e).negate()},EJ=qn(ou,ou.DEPTH_BASE),xU=xt(ou,ou.DEPTH),IM=qn(ou,ou.LINEAR_DEPTH).setParameterLength(0,1),Mye=IM(gU());xU.assign=i=>EJ(i);var Ih=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=So(t).setGroup(Zt);Ci(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(Ll(r.negate(),r,n))})}let a=e.length;if(a>0){let l=So(e).setGroup(Zt),c=se(1).toVar("intersectionClipOpacity");Ci(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(Ll(r.negate(),r,n).oneMinus())}),s.mulAssign(c.oneMinus())}Mi.a.mulAssign(s),Mi.a.equal(0).discard()})()}setupDefault(e,t){return Ae(()=>{let n=t.length;if(this.hardwareClipping===!1&&n>0){let s=So(t).setGroup(Zt);Ci(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=So(e).setGroup(Zt),o=Il(!0).toVar("clipped");Ci(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=So(e).setGroup(Zt),s=ed(t.getClipDistance());Ci(n,({i:o})=>{let a=r.element(o),l=ts.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}};Ih.ALPHA_TO_COVERAGE="alphaToCoverage";Ih.DEFAULT="default";Ih.HARDWARE="hardware";var Cye=()=>new Ih,Rye=()=>new Ih(Ih.ALPHA_TO_COVERAGE),Pye=()=>new Ih(Ih.HARDWARE),Iye=.05,gY=Ae(([i])=>ru(bn(1e4,Ta(bn(17,i.x).add(bn(.1,i.y)))).mul(fs(.1,Qi(Ta(bn(13,i.y).add(i.x))))))),_Y=Ae(([i])=>gY(ft(gY(i.xy),i.z))),Nye=Ae(([i])=>{let e=Sr(Eh(N7(i.xyz)),Eh(L7(i.xyz))),t=se(1).div(se(Iye).mul(e)).toVar("pixScale"),n=ft(C1(Th(Sh(t))),C1(DC(Sh(t)))),r=ft(_Y(Th(n.x.mul(i.xyz))),_Y(Th(n.y.mul(i.xyz)))),s=ru(Sh(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 su(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]}),vF=class extends TM{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}},MJ=(i=0)=>new vF(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(B1(t.slice(0,-4)),n.getCacheKey());return this.type+xb(e)}build(e){this.setup(e)}setupObserver(e){return new w8(e)}setup(e){e.context.setupNormal=()=>Tm(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=Tm(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,Mi.a).max(0);o=this.setupOutput(e,c),b1.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&&b1.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=Rye():e.stack.addToStack(Cye())}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(Pye()),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=HC(ts.z,Zp,Kp):r=Em(ts.z,Zp,Kp))}r!==null&&xU.assign(r).toStack()}setupPositionView(){return Ph.mul(fr).xyz}setupModelViewProjection(){return Ma.mul(ts)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),hJ}setupPosition(e){let{object:t,geometry:n}=e;if((n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color)&&vJ(t),t.isSkinnedMesh===!0&&xJ(t),this.displacementMap){let r=jf("displacementMap","texture"),s=jf("displacementScale","float"),o=jf("displacementBias","float");fr.addAssign(ta.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&mJ(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&AJ(t),this.positionNode!==null&&fr.assign(Tm(this.positionNode,"POSITION","vec3")),fr}setupDiffuseColor(e){let{object:t,geometry:n}=e;this.maskNode!==null&&Il(this.maskNode).not().discard();let r=this.colorNode?Lt(this.colorNode):kQ;this.vertexColors===!0&&n.hasAttribute("color")&&(r=r.mul(MJ())),t.instanceColor&&(r=dU.mul(r)),t.isBatchedMesh&&t._colorsTexture&&(r=pU.mul(r)),Mi.assign(r);let s=this.opacityNode?se(this.opacityNode):aU;Mi.a.assign(Mi.a.mul(s));let o=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(o=this.alphaTestNode!==null?se(this.alphaTestNode):UQ,this.alphaToCoverage===!0?(Mi.a=Ll(o,o.add(F7(Mi.a)),Mi.a),Mi.a.lessThanEqual(0).discard()):Mi.a.lessThanEqual(o).discard()),this.alphaHash===!0&&Mi.a.lessThan(Nye(fr)).discard(),e.isOpaque()&&Mi.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?pe(0):Mi.rgb}setupNormal(){return this.normalNode?pe(this.normalNode):jQ}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?jf("envMap","cubeTexture"):jf("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new xF(fU)),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 gF(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=uJ),e.context.getAO&&(t=e.context.getAO(t,e)),t!==null&&(D8.assign(t),e.context.ambientOcclusion=D8)}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=bJ(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)&&(L8.assign(pe(s||zQ)),c=c.add(L8)),c}setupFog(e,t){let n=e.fogNode;return n&&(b1.assign(t),t=Lt(n.toVar())),t}setupPremultipliedAlpha(e,t){return $7(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}},Lye=new zc,bF=class extends Ar{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(Lye),this.setValues(e)}},Dye=new zy,wF=class extends Ar{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(Dye),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):hU,t=this.dashScaleNode?se(this.dashScaleNode):lU,n=this.dashSizeNode?se(this.dashSizeNode):cU,r=this.gapSizeNode?se(this.gapSizeNode):uU;Sm.assign(n),eb.assign(r);let s=c0(Pl("lineDistance").mul(t));(e?s.add(e):s).mod(Sm.add(eb)).greaterThan(Sm).discard()}};var cM=Gm("vec3","worldStart"),SF=Gm("vec3","worldEnd"),CJ=Gm("float","lineDistance"),Am=Gm("vec4","worldPos"),xY=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"}),Fye=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"}),bJe=Ae(({material:i})=>{let e=i._useDash,t=i._useWorldUnits,n=Pl("instanceStart"),r=Pl("instanceEnd"),s=Lt(Ph.mul(Lt(n,1))).toVar("start"),o=Lt(Ph.mul(Lt(r,1))).toVar("end"),a,l;e&&(a=se(Pl("instanceDistanceStart")).toVar("distanceStart"),l=se(Pl("instanceDistanceEnd")).toVar("distanceEnd")),t&&(cM.assign(s.xyz),SF.assign(o.xyz));let c=E1.z.div(E1.w),u=Ma.element(2).element(3).equal(-1);if(Wt(u,()=>{Wt(s.z.lessThan(0).and(o.z.greaterThan(0)),()=>{let T=xY({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=xY({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):lU,P=i.offsetNode?se(i.offsetNode):hU,R=Zo.y.lessThan(.5).select(T.mul(a),T.mul(l));R=R.add(P),CJ.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);Am.assign(Zo.y.lessThan(.5).select(s,o));let L=CM.mul(.5);Am.addAssign(Lt(Zo.x.lessThan(0).select(R.mul(L),R.mul(L).negate()),0)),e||(Am.addAssign(Lt(Zo.y.lessThan(.5).select(T.mul(L).negate(),T.mul(L)),0)),Am.addAssign(Lt(C.mul(L),0)),Wt(Zo.y.greaterThan(1).or(Zo.y.lessThan(0)),()=>{Am.subAssign(Lt(C.mul(2).mul(L),0))})),S.assign(Ma.mul(Am));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(CM)),T.assign(T.div(E1.w.div(Q7))),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})(),wJe=Ae(({material:i,renderer:e})=>{let t=i._useAlphaToCoverage,n=i._useDash,r=i._useWorldUnits,s=Ri();if(n){let a=i.dashSizeNode?se(i.dashSizeNode):cU,l=i.gapSizeNode?se(i.gapSizeNode):uU;Sm.assign(a),eb.assign(l),s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),CJ.mod(Sm.add(eb)).greaterThan(Sm).discard()}let o=se(1).toVar("alpha");if(r){let a=Am.xyz.normalize().mul(1e5),l=SF.sub(cM),c=Fye({p1:cM,p2:SF,p3:pe(0,0,0),p4:a}),u=cM.add(l.mul(c.x)),f=a.mul(c.y),v=u.sub(f).length().div(CM);if(!n)if(t&&e.currentSamples>0){let w=v.fwidth();o.assign(Ll(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(Ll(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 Oye=new ky,TF=class extends Ar{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(Oye),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?se(this.opacityNode):aU;Mi.assign(OC(Lt(sU(oi),e),yr))}},yU=Ae(([i=eU])=>{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)}),EF=Ae(([i=Ri()])=>{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)}),NM=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 ku(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 Vc(5,5,5),o=yU(eU),a=new Ar;a.colorNode=ai(t,o,0),a.side=ui,a.blending=Yr;let l=new Gn(s,a),c=new jd;c.add(l),t.minFilter===_o&&(t.minFilter=vi);let u=new b_(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)}},$v=new WeakMap,MF=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 ku;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===np||o===ip){if($v.has(s)){let a=$v.get(s);yY(a,s.mapping),this._cubeTexture=a}else{let a=s.image;if(Bye(a)){let l=new NM(a.height);l.fromEquirectangularTexture(t,s),yY(l.texture,s.mapping),this._cubeTexture=l.texture,$v.set(s,l.texture),s.addEventListener("dispose",RJ)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function Bye(i){return i==null?!1:i.height>0}function RJ(i){let e=i.target;e.removeEventListener("dispose",RJ);let t=$v.get(e);t!==void 0&&($v.delete(e),t.dispose())}function yY(i,e){e===np?i.mapping=_l:e===ip&&(i.mapping=ec)}var PJ=qn(MF).setParameterLength(1),rb=class extends a0{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=PJ(this.envNode)}},CF=class extends a0{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)}},N1=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},LM=class extends N1{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(Mi.rgb)}finish(e){let{material:t,context:n}=e,r=n.outgoingLight,s=e.context.environment;if(s)switch(t.combine){case NA:r.rgb.assign(Xn(r.rgb,r.rgb.mul(s.rgb),Xv.mul(lM)));break;case jT:r.rgb.assign(Xn(r.rgb,s.rgb,Xv.mul(lM)));break;case XT:r.rgb.addAssign(s.rgb.mul(Xv.mul(lM)));break;default:je("BasicLightingModel: Unsupported .combine value:",t.combine);break}}},Uye=new as,RF=class extends Ar{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Uye),this.setValues(e)}setupNormal(){return Vm(R1)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new rb(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new CF(fU)),t}setupOutgoingLight(){return Mi.rgb}setupLightingModel(){return new LM}},L1=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))}),Dm=Ae(i=>i.diffuseColor.mul(1/Math.PI)),kye=()=>se(.25),Gye=Ae(({dotNH:i})=>_M.mul(se(.5)).add(1).mul(se(1/Math.PI)).mul(i.pow(_M))),zye=Ae(({lightDirection:i})=>{let e=i.add(zi).normalize(),t=oi.dot(e).clamp(),n=zi.dot(e).clamp(),r=L1({f0:s0,f90:1,dotVH:n}),s=kye(),o=Gye({dotNH:t});return r.mul(s).mul(o)}),DM=class extends LM{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(Dm({diffuseColor:Mi.rgb}))),this.specular===!0&&n.directSpecular.addAssign(s.mul(zye({lightDirection:e})).mul(Xv))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Dm({diffuseColor:Mi}))),r.indirectDiffuse.mulAssign(t)}},Vye=new ma,PF=class extends Ar{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(Vye),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new rb(t):null}setupLightingModel(){return new DM(!1)}},qye=new MA,IF=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(qye),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new rb(t):null}setupLightingModel(){return new DM}setupVariants(){let e=(this.shininessNode?se(this.shininessNode):GQ).max(1e-4);_M.assign(e);let t=this.specularNode||VQ;s0.assign(t)}},IJ=Ae(i=>{if(i.geometry.hasAttribute("normal")===!1)return se(0);let e=R1.dFdx().abs().max(R1.dFdy().abs());return e.x.max(e.y).max(e.z)}),vU=Ae(i=>{let{roughness:e}=i,t=IJ(),n=e.max(.0525);return n=n.add(t),n=n.min(1),n}),NJ=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 Nl(.5,r.add(s).max(NC))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),Hye=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 Nl(.5,l.add(c).max(NC))}).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"}]}),LJ=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"}]}),Wye=se(1/Math.PI),jye=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 Wye.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"}]}),bU=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(zi).normalize(),u=s.dot(i).clamp(),f=s.dot(zi).clamp(),p=s.dot(c).clamp(),x=zi.dot(c).clamp(),v=L1({f0:e,f90:t,dotVH:x}),w,S;if(M1(o)&&(v=RC.mix(v,r)),M1(a)){let T=Wv.dot(i),P=Wv.dot(zi),R=Wv.dot(c),C=wm.dot(i),L=wm.dot(zi),D=wm.dot(c);w=Hye({alphaT:gM,alphaB:l,dotTV:P,dotBV:L,dotTL:T,dotBL:C,dotNV:f,dotNL:u}),S=jye({alphaT:gM,alphaB:l,dotNH:p,dotTH:R,dotBH:D})}else w=NJ({alpha:l,dotNL:u,dotNV:f}),S=LJ({alpha:l,dotNH:p});return v.mul(w).mul(S)}),Xye=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]),mh=null,sb=Ae(({roughness:i,dotNV:e})=>{mh===null&&(mh=new vA(Xye,16,16,Ts,Li),mh.name="DFG_LUT",mh.minFilter=vi,mh.magFilter=vi,mh.wrapS=Go,mh.wrapT=Go,mh.generateMipmaps=!1,mh.needsUpdate=!0);let t=ft(i,e);return ai(mh,t).rg}),$ye=Ae(({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let a=bU({lightDirection:i,f0:e,f90:t,roughness:n,f:r,USE_IRIDESCENCE:s,USE_ANISOTROPY:o}),l=oi.dot(i).clamp(),c=oi.dot(zi).clamp(),u=sb({roughness:n,dotNV:c}),f=sb({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(NC)),C=S.mul(T),L=R.mul(C);return a.add(L)}),DJ=Ae(i=>{let{dotNV:e,specularColor:t,specularF90:n,roughness:r}=i,s=sb({dotNV:e,roughness:r});return t.mul(s.x).add(n.mul(s.y))}),NF=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"}]}),Yye=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"}]}),Zye=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"}]}),Kye=Ae(({lightDirection:i})=>{let e=i.add(zi).normalize(),t=oi.dot(i).clamp(),n=oi.dot(zi).clamp(),r=oi.dot(e).clamp(),s=Yye({roughness:Yp,dotNH:r}),o=Zye({dotNV:n,dotNL:t});return Ml.mul(s).mul(o)}),vY=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"}]}),Qye=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"}]}),PE=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"}]}),Y6=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(ro(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(PE({v1:w,v2:S})),R.addAssign(PE({v1:S,v2:T})),R.addAssign(PE({v1:T,v2:P})),R.addAssign(PE({v1:P,v2:w})),f.assign(pe(Qye({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 WC=1/6,FJ=i=>bn(WC,bn(i,bn(i,i.negate().add(3)).sub(3)).add(1)),LF=i=>bn(WC,bn(i,bn(i,bn(3,i).sub(6))).add(4)),OJ=i=>bn(WC,bn(i,bn(i,bn(-3,i).add(3)).add(3)).add(1)),DF=i=>bn(WC,fc(i,3)),bY=i=>FJ(i).add(LF(i)),wY=i=>OJ(i).add(DF(i)),SY=i=>fs(-1,LF(i).div(FJ(i).add(LF(i)))),TY=i=>fs(1,DF(i).div(OJ(i).add(DF(i)))),EY=(i,e,t)=>{let n=i.uvNode,r=bn(n,e.zw).add(.5),s=Th(r),o=ru(r),a=bY(o.x),l=wY(o.x),c=SY(o.x),u=TY(o.x),f=SY(o.y),p=TY(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=bY(o.y).mul(fs(a.mul(i.sample(x).level(t)),l.mul(i.sample(v).level(t)))),P=wY(o.y).mul(fs(a.mul(i.sample(w).level(t)),l.mul(i.sample(S).level(t))));return T.add(P)},wU=Ae(([i,e])=>{let t=ft(i.size(fe(e))),n=ft(i.size(fe(e.add(1)))),r=Nl(1,t),s=Nl(1,n),o=EY(i,Lt(r,t),Th(e)),a=EY(i,Lt(s,n),DC(e));return ru(e).mix(o,a)}),Jye=Ae(([i,e])=>{let t=e.mul(Z7(i));return wU(i,t)}),MY=Ae(([i,e,t,n,r])=>{let s=pe(k7(e.negate(),Jo(i),Nl(1,n))),o=pe(Eh(r[0].xyz),Eh(r[1].xyz),Eh(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"}]}),e2e=Ae(([i,e])=>i.mul(su(e.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),t2e=mU(),n2e=wJ(),CY=Ae(([i,e,t],{material:n})=>{let s=(n.side===ui?t2e:n2e).sample(i),o=Sh(Nm.x).mul(e2e(e,t));return wU(s,o)}),RY=Ae(([i,e,t])=>(Wt(t.notEqual(0),()=>{let n=LC(e).negate().div(t);return E7(n.negate().mul(i))}),pe(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),i2e=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));Ci({start:0,end:3},({i:F})=>{let N=D.element(F),B=MY(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=CY(H,t,N);w.element(F).assign(Z.element(F)),w.a.addAssign(Z.a),S.element(F).assign(n.element(F).mul(RY(Eh(B),p,x).element(F)))}),w.a.divAssign(3)}else{let L=MY(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=CY(N,t,u),S=n.mul(RY(Eh(L),p,x))}let T=S.rgb.mul(w.rgb),P=i.dot(e).clamp(),R=pe(DJ({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())}),r2e=ro(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),s2e=i=>{let e=i.sqrt();return pe(1).add(e).div(pe(1).sub(e))},PY=(i,e)=>i.sub(e).div(i.add(e)).pow2(),o2e=(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),r2e.mul(a)},IY=Ae(({outsideIOR:i,eta2:e,cosTheta1:t,thinFilmThickness:n,baseF0:r})=>{let s=Xn(i,e,Ll(0,.03,n)),a=i.div(s).pow2().mul(t.pow2().oneMinus()).oneMinus();Wt(a.lessThan(0),()=>pe(1));let l=a.sqrt(),c=PY(s,i),u=L1({f0:c,f90:1,dotVH:t}),f=u.oneMinus(),p=s.lessThan(i).select(Math.PI,0),x=se(Math.PI).sub(p),v=s2e(r.clamp(0,.9999)),w=PY(v,s.toVec3()),S=L1({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 Ci({start:1,end:2,condition:"<=",name:"m"},({m:z})=>{B.mulAssign(L);let V=o2e(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"}]}),Tv=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()}),Ev=pe(.04),IE=se(1),FM=class extends N1{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(zi).clamp(),n=IY({outsideIOR:se(1),eta2:AM,cosTheta1:t,thinFilmThickness:mM,baseF0:s0}),r=IY({outsideIOR:se(1),eta2:AM,cosTheta1:t,thinFilmThickness:mM,baseF0:Mi.rgb});this.iridescenceFresnel=Xn(n,r,$f),this.iridescenceF0Dielectric=NF({f:n,f90:1,dotVH:t}),this.iridescenceF0Metallic=NF({f:r,f90:1,dotVH:t}),this.iridescenceF0=Xn(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,$f)}if(this.transmission===!0){let t=Mh,n=fQ.sub(Mh).normalize(),r=f0,s=e.context;s.backdrop=i2e(r,n,bh,mm,_m,xm,t,dc,h0,Ma,jv,v7,w7,b7,this.dispersion?S7:null),s.backdropAlpha=xM,Mi.a.mulAssign(Xn(1,s.backdrop.a,xM))}super.start(e)}computeMultiscattering(e,t,n,r,s=null){let o=oi.dot(zi).clamp(),a=sb({roughness:bh,dotNV:o}),l=s?RC.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(Kye({lightDirection:e})));let o=Tv({normal:oi,viewDir:zi,roughness:Yp}),a=Tv({normal:oi,viewDir:e,roughness:Yp}),l=Ml.r.max(Ml.g).max(Ml.b).mul(o.max(a)).oneMinus();s.mulAssign(l)}if(this.clearcoat===!0){let a=Qp.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(a.mul(bU({lightDirection:e,f0:Ev,f90:IE,roughness:v1,normalView:Qp})))}n.directDiffuse.addAssign(s.mul(Dm({diffuseColor:mm}))),n.directSpecular.addAssign(s.mul($ye({lightDirection:e,f0:_m,f90:1,roughness:bh,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=zi,v=ts.toVar(),w=vY({N:p,V:x,roughness:bh}),S=o.sample(w).toVar(),T=a.sample(w).toVar(),P=ro(pe(S.x,0,S.y),pe(0,1,0),pe(S.z,0,S.w)).toVar(),R=_m.mul(T.x).add(xm.sub(_m).mul(T.y)).toVar();if(s.directSpecular.addAssign(e.mul(R).mul(Y6({N:p,V:x,P:v,mInv:P,p0:l,p1:c,p2:u,p3:f}))),s.directDiffuse.addAssign(e.mul(mm).mul(Y6({N:p,V:x,P:v,mInv:ro(1,0,0,0,1,0,0,0,1),p0:l,p1:c,p2:u,p3:f}))),this.clearcoat===!0){let C=Qp,L=vY({N:C,V:x,roughness:v1}),D=o.sample(L),F=a.sample(L),N=ro(pe(D.x,0,D.y),pe(0,1,0),pe(D.z,0,D.w)),B=Ev.mul(F.x).add(IE.sub(Ev).mul(F.y));this.clearcoatSpecularDirect.addAssign(e.mul(B).mul(Y6({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(Dm({diffuseColor:mm})).toVar();if(this.sheen===!0){let s=Tv({normal:oi,viewDir:zi,roughness:Yp}),o=Ml.r.max(Ml.g).max(Ml.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(Ml,Tv({normal:oi,viewDir:zi,roughness:Yp}))),this.clearcoat===!0){let S=Qp.dot(zi).clamp(),T=DJ({dotNV:S,specularColor:Ev,specularF90:IE,roughness:v1});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,xm,s0,this.iridescenceF0Dielectric),this.computeMultiscattering(a,l,xm,Mi.rgb,this.iridescenceF0Metallic);let c=Xn(s,a,$f),u=Xn(o,l,$f),f=s.add(o),p=mm.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=Tv({normal:oi,viewDir:zi,roughness:Yp}),T=Ml.r.max(Ml.g).max(Ml.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(zi).clamp().add(t),o=bh.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=Qp.dot(zi).clamp(),r=L1({dotVH:n,f0:Ev,f90:IE}),s=t.mul(pM.mul(r).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(pM));t.assign(s)}if(this.sheen===!0){let n=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(n)}}},NY=se(1),FF=se(-2),NE=se(.8),Z6=se(-1),LE=se(.4),K6=se(2),DE=se(.305),Q6=se(3),LY=se(.21),a2e=se(4),DY=se(4),l2e=se(16),c2e=Ae(([i])=>{let e=pe(Qi(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"}]}),u2e=Ae(([i,e])=>{let t=ft().toVar();return Wt(e.equal(0),()=>{t.assign(ft(i.z,i.y).div(Qi(i.x)))}).ElseIf(e.equal(1),()=>{t.assign(ft(i.x.negate(),i.z.negate()).div(Qi(i.y)))}).ElseIf(e.equal(2),()=>{t.assign(ft(i.x.negate(),i.y).div(Qi(i.z)))}).ElseIf(e.equal(3),()=>{t.assign(ft(i.z.negate(),i.y).div(Qi(i.x)))}).ElseIf(e.equal(4),()=>{t.assign(ft(i.x.negate(),i.z).div(Qi(i.y)))}).Else(()=>{t.assign(ft(i.x,i.y).div(Qi(i.z)))}),bn(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),h2e=Ae(([i])=>{let e=se(0).toVar();return Wt(i.greaterThanEqual(NE),()=>{e.assign(NY.sub(i).mul(Z6.sub(FF)).div(NY.sub(NE)).add(FF))}).ElseIf(i.greaterThanEqual(LE),()=>{e.assign(NE.sub(i).mul(K6.sub(Z6)).div(NE.sub(LE)).add(Z6))}).ElseIf(i.greaterThanEqual(DE),()=>{e.assign(LE.sub(i).mul(Q6.sub(K6)).div(LE.sub(DE)).add(K6))}).ElseIf(i.greaterThanEqual(LY),()=>{e.assign(DE.sub(i).mul(a2e.sub(Q6)).div(DE.sub(LY)).add(Q6))}).Else(()=>{e.assign(se(-2).mul(Sh(bn(1.16,i))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),BJ=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"}]}),UJ=Ae(([i,e,t,n,r,s])=>{let o=se(t),a=pe(e),l=su(h2e(o),FF,s),c=ru(l),u=Th(l),f=pe(ob(i,a,u,n,r,s)).toVar();return Wt(c.notEqual(0),()=>{let p=pe(ob(i,a,u.add(1),n,r,s)).toVar();f.assign(Xn(f,p,c))}),f}),ob=Ae(([i,e,t,n,r,s])=>{let o=se(t).toVar(),a=pe(e),l=se(c2e(a)).toVar(),c=se(Sr(DY.sub(o),0)).toVar();o.assign(Sr(o,DY));let u=se(C1(o)).toVar(),f=ft(u2e(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,l2e))),f.y.addAssign(bn(4,C1(s).sub(u))),f.x.mulAssign(n),f.y.mulAssign(r),i.sample(f).grad(ft(),ft())}),J6=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=eu(n),c=t.mul(l).add(r.cross(t).mul(Ta(n))).add(r.mul(r.dot(t).mul(l.oneMinus())));return ob(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,Zf(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(J6({theta:0,axis:p,outputDirection:n,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:f}))),Ci({start:fe(1),end:i},({i:v})=>{Wt(v.greaterThanEqual(s),()=>{yJ()});let w=se(o.mul(se(v))).toVar();x.addAssign(r.element(v).mul(J6({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(J6({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)}),f2e=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)}),d2e=Ae(([i,e])=>ft(se(i).div(se(e)),f2e(i))),p2e=Ae(([i,e,t])=>{let n=t.mul(t).toConst(),r=pe(1,0,0).toConst(),s=Zf(e,r).toConst(),o=Ca(i.x).toConst(),a=bn(2,3.14159265359).mul(i.y).toConst(),l=o.mul(eu(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)))}),GJ=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(ob(t,l,e,s,o,a))}).Else(()=>{let f=Qo(Qi(l.z).lessThan(.999),pe(0,0,1),pe(1,0,0)),p=Jo(Zf(f,l)).toVar(),x=Zf(l,p).toVar();Ci({start:it(0),end:r},({i:v})=>{let w=d2e(v,r),S=p2e(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(mc(l,T).mul(2)).sub(l)),R=Sr(mc(l,P),0);Wt(R.greaterThan(0),()=>{let C=ob(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)}),t0=4,FY=[.125,.215,.35,.446,.526,.582],gm=20,A2e=512,Mv=new qc(-1,1,1,-1,0,1),m2e=new Ir(90,1),OY=new Ut,e8=null,t8=0,n8=0,g2e=new ie,OM=new WeakMap,_2e=[3,1,5,0,4,2],i8=BJ(Ri(),Pl("faceIndex")).normalize(),jC=pe(i8.x,i8.y,i8.z),OF=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=g2e,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.');e8=this._renderer.getRenderTarget(),t8=this._renderer.getActiveCubeFace(),n8=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=UY(),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===_l||e.mapping===ec?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(e8,t8,n8),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),e8=this._renderer.getRenderTarget(),t8=this._renderer.getActiveCubeFace(),n8=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 BY(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=BY(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=x2e(t)),this._blurMaterial=y2e(t,e.width,e.height),this._ggxMaterial=v2e(t,e.width,e.height)}}async _compileMaterial(e){let t=new Gn(new Wn,e);await this._renderer.compile(t,Mv)}_sceneToCubeUV(e,t,n,r,s){let o=m2e;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(OY),c.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Gn(new Vc,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(OY),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===_l||e.mapping===ec;r?this._cubemapMaterial===null&&(this._cubemapMaterial=UY(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,Mv)}_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=OM.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-t0?n-v+t0: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,Mv),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,Mv)}_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=OM.get(c),x=this._sizeLods[n]-1,v=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*gm-1),w=s/v,S=isFinite(s)?1+Math.floor(u*w):gm;S>gm&&je(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${gm}`);let T=[],P=0;for(let F=0;F<gm;++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-t0?r-R+t0:0),D=4*(this._cubeSize-C);this._setViewport(t,L,D,3*C,2*C),l.setRenderTarget(t),l.render(f,Mv)}_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 x2e(i){let e=[],t=[],n=[],r=i,s=i-t0+1+FY.length;for(let o=0;o<s;o++){let a=Math.pow(2,r);e.push(a);let l=1/a;o>i-t0?l=FY[o-i+t0-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=_2e[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 Wn;L.setAttribute("position",new Ni(P,w)),L.setAttribute("uv",new Ni(R,S)),L.setAttribute("faceIndex",new Ni(C,T)),n.push(new Gn(L,null)),r>t0&&r--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function BY(i,e,t){let n={magFilter:vi,minFilter:vi,generateMipmaps:!1,type:Li,format:vr,colorSpace:Vd,depthBuffer:t},r=new ua(i,e,n);return r.texture.mapping=Wu,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function XC(i){let e=new Ar;return e.depthTest=!1,e.depthWrite=!1,e.blending=Yr,e.name=`PMREM_${i}`,e}function y2e(i,e,t){let n=So(new Array(gm).fill(0)),r=Ht(new ie(0,1,0)),s=Ht(0),o=se(gm),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:jC,dTheta:s,samples:l,envMap:c,mipInt:u,CUBEUV_TEXEL_WIDTH:f,CUBEUV_TEXEL_HEIGHT:p,CUBEUV_MAX_MIP:x},w=XC("blur");return w.fragmentNode=kJ({...v,latitudinal:a.equal(1)}),OM.set(w,v),w}function v2e(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=XC("ggx");return u.fragmentNode=GJ({...c,N_immutable:jC,GGX_SAMPLES:it(A2e)}),OM.set(u,c),u}function UY(i){let e=XC("cubemap");return e.fragmentNode=Ea(i,jC),e}function kY(i){let e=XC("equirect");return e.fragmentNode=ai(i,yU(jC),0),e}var GY=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 w2e(i,e,t){let n=S2e(e),r=n.get(i);if((r!==void 0?r.pmremVersion:-1)!==i.pmremVersion){let o=i.image;if(i.isCubeTexture)if(T2e(o))r=t.fromCubemap(i,r);else return null;else if(E2e(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 S2e(i){let e=GY.get(i);return e===void 0&&(e=new WeakMap,GY.set(i,e)),e}var BF=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=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===Wu?t=r:t=w2e(r,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new OF(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?MM.mul(pe(t.x,t.y.negate(),t.z)):MM.mul(t);let n=this.levelNode;return n===null&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this)),UJ(this._texture,t,n,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function T2e(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 E2e(i){return i==null?!1:i.height>0}var SU=qn(BF).setParameterLength(1,3),zY=new WeakMap,UF=class extends a0{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=SU(f),p.set(f,x)),n=x}let s=t.useAnisotropy===!0||t.anisotropy>0?OQ:oi,o=n.context(VY(bh,s)).mul(aM),a=n.context(M2e(f0)).mul(Math.PI).mul(aM),l=S1(o),c=S1(a);e.context.radiance.addAssign(l),e.context.iblIrradiance.addAssign(c);let u=e.context.lightingModel.clearcoatRadiance;if(u){let f=n.context(VY(v1,Qp)).mul(aM),p=S1(f);u.addAssign(p)}}_getPMREMNodeCache(e){let t=zY.get(e);return t===void 0&&(t=new WeakMap,zY.set(e,t)),t}},VY=(i,e)=>{let t=null;return{getUV:()=>(t===null&&(t=zi.negate().reflect(e),t=B7(i).mix(t,e).normalize(),t=t.transformDirection(yb)),t),getTextureLevel:()=>i}},M2e=i=>({getUV:()=>i,getTextureLevel:()=>se(1)}),C2e=new v_,BM=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(C2e),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new UF(t):null}setupLightingModel(){return new FM}setupSpecular(){let e=Xn(pe(.04),Mi.rgb,$f);s0.assign(pe(.04)),_m.assign(e),xm.assign(1)}setupVariants(){let e=this.metalnessNode?se(this.metalnessNode):WQ;$f.assign(e);let t=this.roughnessNode?se(this.roughnessNode):HQ;t=vU({roughness:t}),bh.assign(t),this.setupSpecular(),mm.assign(Mi.rgb.mul(e.oneMinus()))}},R2e=new By,kF=class extends BM{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(R2e),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):sJ;jv.assign(e),s0.assign(Ja(O7(jv.sub(1).div(jv.add(1))).mul(qQ),pe(1)).mul(hF)),_m.assign(Xn(s0,Mi.rgb,$f)),xm.assign(Xn(hF,1,$f))}setupLightingModel(){return new FM(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):XQ,n=this.clearcoatRoughnessNode?se(this.clearcoatRoughnessNode):$Q;pM.assign(t),v1.assign(vU({roughness:n}))}if(this.useSheen){let t=this.sheenNode?pe(this.sheenNode):KQ,n=this.sheenRoughnessNode?se(this.sheenRoughnessNode):QQ;Ml.assign(t),Yp.assign(n)}if(this.useIridescence){let t=this.iridescenceNode?se(this.iridescenceNode):eJ,n=this.iridescenceIORNode?se(this.iridescenceIORNode):tJ,r=this.iridescenceThicknessNode?se(this.iridescenceThicknessNode):nJ;RC.assign(t),AM.assign(n),mM.assign(r)}if(this.useAnisotropy){let t=(this.anisotropyNode?ft(this.anisotropyNode):JQ).toVar();$p.assign(t.length()),Wt($p.equal(0),()=>{t.assign(ft(1,0))}).Else(()=>{t.divAssign(ft($p)),$p.assign($p.saturate())}),gM.assign($p.pow2().mix(bh.pow2(),1)),Wv.assign(ym[0].mul(t.x).add(ym[1].mul(t.y))),wm.assign(ym[1].mul(t.x).sub(ym[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?se(this.transmissionNode):iJ,n=this.thicknessNode?se(this.thicknessNode):rJ,r=this.attenuationDistanceNode?se(this.attenuationDistanceNode):oJ,s=this.attenuationColorNode?pe(this.attenuationColorNode):aJ;if(xM.assign(t),v7.assign(n),b7.assign(r),w7.assign(s),this.useDispersion){let o=this.dispersionNode?se(this.dispersionNode):cJ;S7.assign(o)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pe(this.clearcoatNormalNode):YQ}setup(e){e.context.setupClearcoatNormal=()=>Tm(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}};var P2e=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=jf("gradientMap","texture").context({getUV:()=>r});return pe(s.r)}else{let s=r.fwidth().mul(.5);return Xn(pe(.7),pe(1),Ll(se(.7).sub(s.x),se(.7).add(s.x),r.x))}}),GF=class extends N1{direct({lightDirection:e,lightColor:t,reflectedLight:n},r){let s=P2e({normal:kC,lightDirection:e,builder:r}).mul(t);n.directDiffuse.addAssign(s.mul(Dm({diffuseColor:Mi.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:n,reflectedLight:r}=e.context;r.indirectDiffuse.addAssign(n.mul(Dm({diffuseColor:Mi}))),r.indirectDiffuse.mulAssign(t)}},I2e=new Uy,zF=class extends Ar{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(I2e),this.setValues(e)}setupLightingModel(){return new GF}},zJ=Ae(()=>{let i=pe(zi.z,0,zi.x.negate()).normalize(),e=zi.cross(i);return ft(i.dot(oi),e.dot(oi)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),N2e=new Gy,VF=class extends Ar{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(N2e),this.setValues(e)}setupVariants(e){let t=zJ,n;e.material.matcap?n=jf("matcap","texture").context({getUV:()=>t}):n=pe(Xn(.2,.8,t.y)),Mi.rgb.mulAssign(n.rgb)}},qF=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 CC(s,o,o.negate(),s).mul(n)}else{let s=t,o=n0(Lt(1,0,0,0),Lt(0,eu(s.x),Ta(s.x).negate(),0),Lt(0,Ta(s.x),eu(s.x),0),Lt(0,0,0,1)),a=n0(Lt(eu(s.y),0,Ta(s.y),0),Lt(0,1,0,0),Lt(Ta(s.y).negate(),0,eu(s.y),0),Lt(0,0,0,1)),l=n0(Lt(eu(s.z),Ta(s.z).negate(),0,0),Lt(Ta(s.z),eu(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}}},bb=qn(qF).setParameterLength(2),L2e=new Xd,UM=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(L2e),this.setValues(e)}setupPositionView(e){let{object:t,camera:n}=e,{positionNode:r,rotationNode:s,scaleNode:o,sizeAttenuation:a}=this,l=Ph.mul(pe(r||0)),c=ft(dc[0].xyz.length(),dc[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=vxe("center","vec2",t);u=u.sub(x.sub(.5))}u=u.mul(c);let f=se(s||ZQ),p=bb(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)}},D2e=new Yd,F2e=new Oe,HF=class extends UM{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(D2e),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return Ph.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):lJ;c=c.mul(Q7),n.isPerspectiveCamera&&a===!0&&(c=c.mul(O2e.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=bb(u,f)}return u=u.mul(c),u=u.div(J7.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)}},O2e=Ht(1).onFrameUpdate(function({renderer:i}){let e=i.getSize(F2e);this.value=.5*e.y}),WF=class extends N1{constructor(){super(),this.shadowNode=se(1).toVar("shadowMask")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Mi.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Mi.rgb)}},B2e=new Oy,jF=class extends Ar{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(B2e),this.setValues(e)}setupLightingModel(){return new WF}},SJe=Qf("vec3"),TJe=Qf("vec3"),EJe=Qf("vec3");var XF=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()}},Nh=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])}},U2e=0,qY=new WeakMap;function k2e(i){let e=Object.keys(i),t=qY.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)}qY.set(i.constructor,t)}for(let n=0;n<t.length;n++)e.push(t[n]);return e}var $F=class{constructor(e,t,n,r,s,o,a,l,c,u){this.id=U2e++,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 k2e(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+",",B1(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=qv(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=qv(e,1)),e=qv(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()}},gh=[],YF=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);gh[0]=e,gh[1]=t,gh[2]=o,gh[3]=s;let u=c.get(gh);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,n,r,s,o,a,l),c.set(gh,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)),gh[0]=null,gh[1]=null,gh[2]=null,gh[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new Nh)}dispose(){this.chainMaps={}}createRenderObject(e,t,n,r,s,o,a,l,c,u,f){let p=this.getChainMap(f),x=new $F(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}},Lh=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}},pc={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},Jp=16,G2e=211,z2e=212,ZF=class extends Lh{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===pc.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===pc.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===pc.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===pc.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===VA)&&(this.backend.updateAttribute(e),n.version=r.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}};function VJ(i){return i.index!==null?i.index.version:i.attributes.position.version}function qJ(i){return i.index!==null?i.index.id:i.attributes.position.id}function HY(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?yA:xA)(e,1);return r.version=VJ(i),r.__id=qJ(i),r}var KF=class extends Lh{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,pc.STORAGE):this.updateAttribute(s,pc.VERTEX);let n=this.getIndex(e);n!==null&&this.updateAttribute(n,pc.INDEX);let r=e.geometry.indirect;r!==null&&this.updateAttribute(r,pc.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=HY(t),s.set(t,o)):(o.version!==VJ(t)||o.__id!==qJ(t))&&(this.attributes.delete(o),o=HY(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()}},QF=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===ju||e.type===Gi?t=1:e.type===Xu||e.type===ja||e.type===Li?t=2:(e.type===Lr||e.type===pi||e.type===Yi)&&(t=4);let n=4;e.format===E_||e.format===Df||e.format===$u||e.format===vs||e.format===Js?n=1:e.format===Ts||e.format===Yu?n=2:(e.format===Lf||e.format===_2)&&(n=3);let r=t*n;e.type===LA||e.type===DA?r=2:(e.type===Vo||e.type===FA||e.type===OA)&&(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}},kM=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},JF=class extends kM{constructor(e,t,n){super(e),this.vertexProgram=t,this.fragmentProgram=n}},eO=class extends kM{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},V2e=0,Yv=class{constructor(e,t,n,r=null,s=null){this.id=V2e++,this.code=e,this.stage=t,this.name=n,this.transforms=r,this.attributes=s,this.usedTimes=0}},tO=class extends Lh{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 Yv(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 Yv(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 Yv(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 eO(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 JF(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)}},nO=class extends Lh{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?pc.INDIRECT:pc.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?pc.INDIRECT:pc.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)}},q2e=Object.freeze([]);function H2e(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 WY(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 jY(i){return(i.transmission>0||i.transmissionNode&&i.transmissionNode.isNode)&&i.side===ir&&i.forceSinglePass===!1}var iO=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?(jY(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?(jY(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||H2e),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||WY),this.transparent.length>1&&this.transparent.sort(t||WY),n&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:q2e);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}},i1=[],rO=class{constructor(e){this.lighting=e,this.lists=new Nh}get(e,t){let n=this.lists;i1[0]=e,i1[1]=t;let r=n.get(i1);return r===void 0&&(r=new iO(this.lighting,e,t),n.set(i1,r)),i1[0]=null,i1[1]=null,r}dispose(){this.lists=new Nh}},W2e=0,sO=class{constructor(){this.id=W2e++,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 HJ(this)}};function HJ(i){let{textures:e,activeCubeFace:t,activeMipmapLevel:n}=i,r=[t,n];for(let s of e)r.push(s.id);return xb(r)}var oO=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 sO,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={}}},j2e=new ie,aO=class extends Lh{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?Js: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=Gi}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=j2e){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)}}},ab=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)}},GM=class extends tb{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 WJ(i,e=null,t=null){if(e&&e.isNode){let n=e;e=()=>n}return new GM(new Map([[i,e]]),t)}Be("overrideNode",(i,e,t)=>WJ(e,t,i));function jJ(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 GM(t,e)}Be("overrideNodes",(i,e)=>jJ(e,i));var zM=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 Br),s="float"),s}getHash(){return String(this.id)}generate(){return this.name}},X2e=(i,e)=>new zM(i,e),lO=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 Br),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 x1(t);return this._currentCond=Qo(e,n),this.addToStack(this._currentCond)}ElseIf(e,t){let n=new x1(t),r=Qo(e,n);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new x1(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 Br);let n=e[e.length-1],r=new x1(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=A7(),r=e.buildStage;Jv(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 Jv(n),e.removeActiveStack(this),s}},uM=qn(lO).setParameterLength(0,1);function $2e(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 cO=class extends $t{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=$2e(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let n of this.membersLayout){let r=n.type,s=z1e(r),o=V1e(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)}},uO=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}},Y2e=(i,e=null)=>{let t=new cO(i,e);return p7((...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 uO(t,s)},t)},VM=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}},Z2e=qn(VM),qM=class{constructor(e=os){this.blending=e,this.blendSrc=Gd,this.blendDst=zd,this.blendEquation=ks,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)}},K2e=new qM(Yr),Q2e=new qM(Jy);function XJ(i,e){for(let t=0;t<i.length;t++)if(i[t].name===e)return t;return-1}var hO=class extends VM{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:Q2e},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||K2e}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=$J(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=XJ(s,o);if(a===-1)continue;let l=e.getOutputType(a);r[a]=t[o].convert(l)}return this.members=r,super.setup(e)}},$J=qn(hO),Fm=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)} )`}},YJ=lt(Fm).setParameterLength(2),J2e=i=>new Fm(i,"int","float"),ZJ=i=>new Fm(i,"uint","float"),eve=i=>new Fm(i,"float","int"),tve=i=>new Fm(i,"float","uint"),FE={},au=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(YJ(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return it;case"int":return fe;case"uvec2":return m7;case"uvec3":return km;case"uvec4":return y7;case"ivec2":return wr;case"ivec3":return g7;case"ivec4":return x7}}_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(I7(o))),c=ZJ(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=FE[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}}FE[l]=u}let f=FE[c];return f===void 0&&(f=this._createMainLayout(c,s,a,u),FE[c]=f),Ae(()=>f(n))()}};au.COUNT_TRAILING_ZEROS="countTrailingZeros";au.COUNT_LEADING_ZEROS="countLeadingZeros";au.COUNT_ONE_BITS="countOneBits";var nve=lt(au,au.COUNT_TRAILING_ZEROS).setParameterLength(1),ive=lt(au,au.COUNT_LEADING_ZEROS).setParameterLength(1),rve=lt(au,au.COUNT_ONE_BITS).setParameterLength(1),sve=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)}),fO=(i,e)=>fc(bn(4,i.mul(ni(1,i))),e),ove=(i,e)=>i.lessThan(.5)?fO(i.mul(2),e).div(2):ni(1,fO(bn(ni(1,i),2),e).div(2)),ave=(i,e,t)=>fc(Nl(fc(i,e),fs(fc(i,e),fc(ni(1,i),t))),1/e),lve=(i,e)=>Ta(bM.mul(e.mul(i).sub(1))).div(bM.mul(e.mul(i).sub(1))),lb=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)})`}},cve=lt(lb,"snorm").setParameterLength(1),uve=lt(lb,"unorm").setParameterLength(1),hve=lt(lb,"float16").setParameterLength(1),cb=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)})`}},fve=lt(cb,"snorm").setParameterLength(1),dve=lt(cb,"unorm").setParameterLength(1),pve=lt(cb,"float16").setParameterLength(1),Wf=Ae(([i])=>i.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),Ave=Ae(([i])=>pe(Wf(i.z.add(Wf(i.y.mul(1)))),Wf(i.z.add(Wf(i.x.mul(1)))),Wf(i.y.add(Wf(i.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),mve=Ae(([i,e,t])=>{let n=pe(i).toVar(),r=se(1.4).toVar(),s=se(0).toVar(),o=pe(n).toVar();return Ci({start:se(0),end:se(3),type:"float",condition:"<="},()=>{let a=pe(Ave(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(Wf(n.z.add(Wf(n.x.add(Wf(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"}]}),dO=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)}},gve=qn(dO),Mo=i=>(...e)=>gve(i,...e),G1=Ht(0).setGroup(Zt).onRenderUpdate(i=>i.time),_ve=Ht(0).setGroup(Zt).onRenderUpdate(i=>i.deltaTime),KJ=Ht(0,"uint").setGroup(Zt).onRenderUpdate(i=>i.frameId),xve=(i=G1)=>i.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),yve=(i=G1)=>i.fract().round(),vve=(i=G1)=>i.add(.5).fract().mul(2).sub(1).abs(),bve=(i=G1)=>i.fract();function wve(i,e=null){return Jf(e,{getUV:typeof i=="function"?i:()=>i})}var Sve=Ae(([i,e,t=ft(.5)])=>bb(i.sub(t),e).add(t)),Tve=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))}),Eve=Ae(({position:i=null,horizontal:e=!0,vertical:t=!1})=>{let n;i!==null?(n=dc.toVar(),n[3][0]=i.x,n[3][1]=i.y,n[3][2]=i.z):n=dc;let r=h0.mul(n);return M1(e)&&(r[0][0]=dc[0].length(),r[0][1]=0,r[0][2]=0),M1(t)&&(r[1][0]=0,r[1][1]=dc[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Ma.mul(r).mul(fr)}),Mve=Ae(([i=null])=>{let e=IM();return IM(gU(i)).sub(e).lessThan(0).select(nu,i)}),Cve=Ae(([i,e=Ri(),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)}),QJ=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)}),Rve=(...i)=>QJ(...i),r1=new la,um=new ie,s1=new ie,r8=new ie,Cv=new on,OE=new ie(0,0,-1),_h=new gn,Rv=new ie,BE=new ie,Pv=new gn,UE=new Oe,HM=new ua,Pve=nu.flipX();HM.depthTexture=new ls(1,1);var kE=!1,pO=class i extends gc{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||HM.texture,Pve),this._reflectorBaseNode=e.reflector||new AO(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:HM.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()}},AO=class extends $t{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();let{target:n=new $i,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(UE),e.setSize(Math.round(UE.width*n),Math.round(UE.height*n))}setup(e){return this._updateResolution(HM,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:Li,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=QN,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new ls),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&kE)return!1;kE=!0;let{scene:t,camera:n,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(n),l=this.getRenderTarget(a);r.getDrawingBufferSize(UE),this._updateResolution(l,r),s1.setFromMatrixPosition(o.matrixWorld),r8.setFromMatrixPosition(n.matrixWorld),Cv.extractRotation(o.matrixWorld),um.set(0,0,1),um.applyMatrix4(Cv),Rv.subVectors(s1,r8);let c=Rv.dot(um)>0,u=!1;if(c===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){kE=!1;return}u=!0}Rv.reflect(um).negate(),Rv.add(s1),Cv.extractRotation(n.matrixWorld),OE.set(0,0,-1),OE.applyMatrix4(Cv),OE.add(r8),BE.subVectors(s1,OE),BE.reflect(um).negate(),BE.add(s1),a.coordinateSystem=n.coordinateSystem,a.position.copy(Rv),a.up.set(0,1,0),a.up.applyMatrix4(Cv),a.up.reflect(um),a.lookAt(BE),a.near=n.near,a.far=n.far,a.updateMatrixWorld(),a.projectionMatrix.copy(n.projectionMatrix),r1.setFromNormalAndCoplanarPoint(um,s1),r1.applyMatrix4(a.matrixWorldInverse),_h.set(r1.normal.x,r1.normal.y,r1.normal.z,r1.constant);let f=a.projectionMatrix;Pv.x=(Math.sign(_h.x)+f.elements[8])/f.elements[0],Pv.y=(Math.sign(_h.y)+f.elements[9])/f.elements[5],Pv.z=-1,Pv.w=(1+f.elements[10])/f.elements[14],_h.multiplyScalar(1/_h.dot(Pv));let p=0;f.elements[2]=_h.x,f.elements[6]=_h.y,f.elements[10]=r.coordinateSystem===Ha?_h.z-p:_h.z+1-p,f.elements[14]=_h.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,kE=!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}},Ive=i=>new pO(i),s8=new qc(-1,1,1,-1,0,1),mO=class extends Wn{constructor(e=!1){super();let t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new In([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new In(t,2))}},Nve=new mO,ub=class extends Gn{constructor(e=null){super(Nve,e),this.camera=s8,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,s8)}render(e){e.render(this,s8)}},Lve=new Oe,gO=class extends gc{static get type(){return"RTTNode"}constructor(e,t=null,n=null,r={type:Li}){let s=new ua(t,n,r);super(s.texture,Ri()),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 ub(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(Lve),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 gc(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},JJ=(i,...e)=>new gO(Vt(i),...e),Dve=(i,...e)=>i.isSampleNode||i.isTextureNode?i:i.isPassNode?i.getTextureNode():JJ(i,...e),_1=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)}),Fve=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())}),Ove=Ae(([i,e,t])=>{let n=Im(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=Qi(ni(se(2).mul(a).sub(o),s)).toVar(),w=Qi(ni(se(2).mul(l).sub(c),s)).toVar(),S=Qi(ni(se(2).mul(f).sub(u),s)).toVar(),T=Qi(ni(se(2).mul(p).sub(x),s)).toVar(),P=_1(i,s,t).toVar(),R=v.lessThan(w).select(P.sub(_1(i.sub(ft(se(1).div(n.x),0)),a,t)),P.negate().add(_1(i.add(ft(se(1).div(n.x),0)),l,t))),C=S.lessThan(T).select(P.sub(_1(i.add(ft(0,se(1).div(n.y))),f,t)),P.negate().add(_1(i.sub(ft(0,se(1).div(n.y))),p,t)));return Jo(Zf(R,C))}),TU=Ae(([i])=>ru(se(52.9829189).mul(ru(mc(i,ft(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),tu=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(eu(s),Ta(s)).mul(r)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]}),_O=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(Ri())}sample(e){return this.callback(e)}},Bve=(i,e=null)=>new _O(i,Vt(e)),Om=class extends ml{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}},xO=class extends Ni{constructor(e,t,n=Float32Array){let r=ArrayBuffer.isView(e)?e:new n(e*t);super(r,t),this.isStorageBufferAttribute=!0}},Uve=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=hM("float")):(t=CZ(e),n=hM(e));let r=new xO(i,t,n);return i0(r,e,i)},kve=(i,e="float")=>{let t,n;e.isStructTypeNode===!0?(t=e.getLength(),n=hM("float")):(t=CZ(e),n=hM(e));let r=new Om(i,t,n);return i0(r,e,r.count)},yO=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 )"}},Gve=xt(yO),o8=new on,eee=Ht(0).setGroup(Zt).onRenderUpdate(({scene:i})=>i.backgroundBlurriness),vO=Ht(1).setGroup(Zt).onRenderUpdate(({scene:i})=>i.backgroundIntensity),tee=Ht(new on).setGroup(Zt).onRenderUpdate(({scene:i})=>{let e=i.background;return e!==null&&e.isTexture&&e.mapping!==m2||i.backgroundNode&&i.backgroundNode.isNode?o8.makeRotationFromEuler(i.backgroundRotation).transpose():o8.identity(),o8}),WM=class extends gc{static get type(){return"StorageTextureNode"}constructor(e,t,n=null){super(e,t),this.storeNode=n,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=To.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(To.READ_WRITE)}toReadOnly(){return this.setAccess(To.READ_ONLY)}toWriteOnly(){return this.setAccess(To.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}},nee=qn(WM).setParameterLength(1,3),zve=(i,e,t)=>{let n;return i.isStorageTextureNode===!0?n=i.store(e,t):(n=nee(i,e,t),t!==null&&n.toStack()),n},bO=class extends WM{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")}},Vve=qn(bO).setParameterLength(1,3),qve=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()}),wO=class extends gc{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 qve({texture:this,uv:e})}},EU=qn(wO).setParameterLength(1,3),Hve=(...i)=>EU(...i).setSampler(!1),Wve=(i,e,t)=>EU(i,e).level(t),SO=class extends P1{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}},jve=(i,e,t)=>new SO(i,e,t),XY=new WeakMap,TO=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=$Y(n);this.previousModelWorldMatrix.value.copy(r);let s=iee(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}){$Y(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?Ma:Ht(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),n=e.mul(Ph).mul(fr),r=this.previousProjectionMatrix.mul(t).mul(Lm),s=n.xy.div(n.w),o=r.xy.div(r.w);return ni(s,o)}};function iee(i){let e=XY.get(i);return e===void 0&&(e={},XY.set(i,e)),e}function $Y(i,e=0){let t=iee(i),n=t[e];return n===void 0&&(t[e]=n=new on,t[e].copy(i.matrixWorld)),n}var Xve=xt(TO),$ve=Ae(([i,e])=>Ja(1,i.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Yve=Ae(([i,e])=>Ja(i.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Zve=Ae(([i,e])=>i.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Kve=Ae(([i,e])=>Xn(i.mul(2).mul(e),i.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),Pm(.5,i))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),Qve=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"}]}),Jve=Ae(([i])=>MU(i.rgb)),ebe=Ae(([i,e=se(1)])=>e.mix(MU(i.rgb),i.rgb).max(0)),tbe=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)}),nbe=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(mc(t,i.rgb).mul(n.oneMinus()))))).max(0)}),MU=(i,e=pe(sn.getLuminanceCoefficients(new ie)))=>mc(i,e),ibe=Ae(([i,e=pe(1),t=pe(0),n=pe(1),r=se(1),s=pe(sn.getLuminanceCoefficients(new ie,Vd))])=>{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)}),rbe=Ae(([i,e])=>i.mul(e).floor().div(e)),GE=null,EO=class extends I1{static get type(){return"ViewportSharedTextureNode"}constructor(e=nu,t=null){GE===null&&(GE=new bA),super(e,t,GE)}getTextureForReference(){return GE}updateReference(){return this}},sbe=qn(EO).setParameterLength(0,2),zE=new Oe,jM=class extends gc{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)}},XM=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}},Dh=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:Li,...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 XM(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 XM(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=qC(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=Em(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=Yi),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),zE.set(s.width,s.height)):(r=this.camera,t.getDrawingBufferSize(zE)),this.setSize(zE.width,zE.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:Jf({...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()}};Dh.COLOR="color";Dh.DEPTH="depth";var obe=(i,e,t)=>new Dh(Dh.COLOR,i,e,t),abe=(i,e)=>new jM(i,e),lbe=(i,e,t)=>new Dh(Dh.DEPTH,i,e,t),MO=class extends Dh{static get type(){return"ToonOutlinePassNode"}constructor(e,t,n,r,s){super(Dh.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(Ph),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}},cbe=(i,e,t=new Ut(0,0,0),n=.003,r=1)=>new MO(i,e,Vt(t),Vt(n),Vt(r)),ree=Ae(([i,e])=>i.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),see=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"}]}),oee=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"}]}),ube=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)}),aee=Ae(([i,e])=>{let t=ro(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),n=ro(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return i=i.mul(e).div(.6),i=t.mul(i),i=ube(i),i=n.mul(i),i.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),hbe=ro(pe(1.6605,-.1246,-.0182),pe(-.5876,1.1329,-.1006),pe(-.0728,-.0083,1.1187)),fbe=ro(pe(.6274,.0691,.0164),pe(.3293,.9195,.088),pe(.0433,.0113,.8956)),dbe=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))))}),lee=Ae(([i,e])=>{let t=pe(i).toVar(),n=ro(pe(.856627153315983,.137318972929847,.11189821299995),pe(.0951212405381588,.761241990602591,.0767994186031903),pe(.0482516061458583,.101439036467562,.811302368396859)),r=ro(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(fbe.mul(t)),t.assign(n.mul(t)),t.assign(Sr(t,1e-10)),t.assign(Sh(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(su(t,0,1)),t.assign(dbe(t)),t.assign(r.mul(t)),t.assign(fc(Sr(pe(0),t),pe(2.2))),t.assign(hbe.mul(t)),t.assign(su(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),cee=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,Nl(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"}]}),Ki=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}},$C=qn(Ki).setParameterLength(1,3),pbe=(i,e)=>$C(i,e,"js"),Abe=(i,e)=>$C(i,e,"wgsl"),mbe=(i,e)=>$C(i,e,"glsl"),$M=class extends Ki{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)}},uee=(i,e=[],t="")=>{let n=new $M(i,e,t);return p7((...s)=>n.call(...s),n)},gbe=(i,e)=>uee(i,e,"glsl"),_be=(i,e)=>uee(i,e,"wgsl");function CU(i){let e,t=i.context.getViewZ;return t!==void 0&&(e=t(this)),(e||ts.z).negate()}var hee=Ae(([i,e],t)=>{let n=CU(t);return Ll(i,e,n)}),fee=Ae(([i],e)=>{let t=CU(e);return i.mul(i,t,t).negate().exp().oneMinus()}),xbe=Ae(([i,e],t)=>{let n=CU(t),s=e.sub(Mh.y).max(0).toConst().mul(n).toConst();return i.mul(i,s,s).negate().exp().oneMinus()}),CO=Ae(([i,e])=>Lt(e.toFloat().mix(b1.rgb,i.toVec3()),b1.a)),hm=null,fm=null,RO=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(e0(t.value)),s=e.getTypeLength(e0(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 EM('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(e0(o)),c=e.getTypeLength(e0(a));hm=hm||new gn,fm=fm||new gn,hm.setScalar(0),fm.setScalar(0),l===1?hm.setScalar(o):o.isColor?hm.set(o.r,o.g,o.b,1):hm.set(o.x,o.y,o.z||0,o.w||0),c===1?fm.setScalar(a):a.isColor?fm.set(a.r,a.g,a.b,1):fm.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=hm.getComponent(S),P=fm.getComponent(S);p[w]=jc.lerp(T,P,Math.random())}let x=this.getNodeType(e);if(t.count*4*4<=e.getUniformBufferLimit())n=U1(p,"vec4",t.count).element(iu).convert(x);else{let w=new ml(p,4);e.geometry.setAttribute("__range"+this.id,w),n=UC(w).convert(x)}}else n=se(0);return n}},ybe=qn(RO).setParameterLength(2),PO=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}},wb=(i,e)=>new PO(i,e),vbe=wb("numWorkgroups","uvec3"),bbe=wb("workgroupId","uvec3"),wbe=wb("globalId","uvec3"),Sbe=wb("localId","uvec3"),Tbe=wb("subgroupSize","uint"),IO=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)}},RU=qn(IO),Ebe=()=>RU("workgroup").toStack(),Mbe=()=>RU("storage").toStack(),Cbe=()=>RU("texture").toStack(),NO=class extends Yf{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}},LO=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 Br),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new NO(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)}},Rbe=(i,e)=>new LO("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=Rl(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 Pbe=qn(ps),Oh=(i,e,t)=>Pbe(i,e,t).toStack(),Ibe=i=>Oh(ps.ATOMIC_LOAD,i,null),Nbe=(i,e)=>Oh(ps.ATOMIC_STORE,i,e),Lbe=(i,e)=>Oh(ps.ATOMIC_ADD,i,e),Dbe=(i,e)=>Oh(ps.ATOMIC_SUB,i,e),Fbe=(i,e)=>Oh(ps.ATOMIC_MAX,i,e),Obe=(i,e)=>Oh(ps.ATOMIC_MIN,i,e),Bbe=(i,e)=>Oh(ps.ATOMIC_AND,i,e),Ube=(i,e)=>Oh(ps.ATOMIC_OR,i,e),kbe=(i,e)=>Oh(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 Gbe=lt(Ft,Ft.SUBGROUP_ELECT).setParameterLength(0),zbe=lt(Ft,Ft.SUBGROUP_BALLOT).setParameterLength(1),Vbe=lt(Ft,Ft.SUBGROUP_ADD).setParameterLength(1),qbe=lt(Ft,Ft.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),Hbe=lt(Ft,Ft.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),Wbe=lt(Ft,Ft.SUBGROUP_MUL).setParameterLength(1),jbe=lt(Ft,Ft.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),Xbe=lt(Ft,Ft.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),$be=lt(Ft,Ft.SUBGROUP_AND).setParameterLength(1),Ybe=lt(Ft,Ft.SUBGROUP_OR).setParameterLength(1),Zbe=lt(Ft,Ft.SUBGROUP_XOR).setParameterLength(1),Kbe=lt(Ft,Ft.SUBGROUP_MIN).setParameterLength(1),Qbe=lt(Ft,Ft.SUBGROUP_MAX).setParameterLength(1),Jbe=lt(Ft,Ft.SUBGROUP_ALL).setParameterLength(0),ewe=lt(Ft,Ft.SUBGROUP_ANY).setParameterLength(0),twe=lt(Ft,Ft.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),nwe=lt(Ft,Ft.QUAD_SWAP_X).setParameterLength(1),iwe=lt(Ft,Ft.QUAD_SWAP_Y).setParameterLength(1),rwe=lt(Ft,Ft.QUAD_SWAP_DIAGONAL).setParameterLength(1),swe=lt(Ft,Ft.SUBGROUP_BROADCAST).setParameterLength(2),owe=lt(Ft,Ft.SUBGROUP_SHUFFLE).setParameterLength(2),awe=lt(Ft,Ft.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),lwe=lt(Ft,Ft.SUBGROUP_SHUFFLE_UP).setParameterLength(2),cwe=lt(Ft,Ft.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),uwe=lt(Ft,Ft.QUAD_BROADCAST).setParameterLength(1),VE;function YC(i){VE=VE||new WeakMap;let e=VE.get(i);return e===void 0&&VE.set(i,e={}),e}function ZC(i){let e=YC(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 dee(i,e=Mh){let t=ZC(i).mul(e);return t.xyz.div(t.w)}function PU(i){let e=YC(i);return e.position||(e.position=Ht(new ie).setGroup(Zt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.matrixWorld)))}function pee(i){let e=YC(i);return e.targetPosition||(e.targetPosition=Ht(new ie).setGroup(Zt).onRenderUpdate((t,n)=>n.value.setFromMatrixPosition(i.target.matrixWorld)))}function IU(i){let e=YC(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 NU=i=>h0.transformDirection(PU(i).sub(pee(i))),hwe=Qf("vec3","totalDiffuse"),fwe=Qf("vec3","totalSpecular"),dwe=Qf("vec3","outgoingLight"),pwe=i=>i.sort((e,t)=>e.id-t.id),Awe=(i,e)=>{for(let t of e)if(t.isAnalyticLightNode&&t.light.id===i)return t;return null},a8=new WeakMap,Iv=[],hb=class extends $t{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=hwe,this.totalSpecularNode=fwe,this.outgoingLightNode=dwe,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let n=0;n<e.length;n++){let r=e[n];if(Iv.push(r.id),Iv.push(r.castShadow?1:0),r.isSpotLight===!0){let s=r.map!==null?r.map.id:-1,o=r.colorNode?r.colorNode.getCacheKey():-1;Iv.push(s,o)}}let t=xb(Iv);return Iv.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=pwe([...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=Awe(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}a8.has(l)===!1&&a8.set(l,new u(l)),c=a8.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}},mwe=(i=[])=>new hb().setLights(i),DO=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}){LU.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||Mh)}},LU=Qf("vec3","shadowPositionWorld");function gwe(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 _we(i,e){return e=gwe(i,e),i.setMRT(null),i.setRenderObjectFunction(null),i.setClearColor(0,1),i.autoClear=!0,e}function xwe(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 ywe(i,e={}){return e.background=i.background,e.backgroundNode=i.backgroundNode,e.overrideMaterial=i.overrideMaterial,e}function vwe(i,e){return e=ywe(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 wwe(i,e,t){return t=_we(i,t),t=vwe(e,t),t}function Swe(i,e,t){xwe(i,t),bwe(e,t)}var YM=new WeakMap,Aee=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)}),mee=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=tr("mapSize","vec2",t).setGroup(Zt),o=tr("radius","float",t).setGroup(Zt),a=ft(1).div(s),l=o.mul(a.x),c=TU(zm.xy).mul(6.28318530718);return fs(r(e.xy.add(tu(0,5,c).mul(l)),e.z),r(e.xy.add(tu(1,5,c).mul(l)),e.z),r(e.xy.add(tu(2,5,c).mul(l)),e.z),r(e.xy.add(tu(3,5,c).mul(l)),e.z),r(e.xy.add(tu(4,5,c).mul(l)),e.z)).mul(1/5)}),gee=Ae(({depthTexture:i,shadowCoord:e,shadow:t,depthLayer:n})=>{let r=tr("mapSize","vec2",t).setGroup(Zt),s=ft(1).div(r),o=e.xy,a=ru(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)}),_ee=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?Pm(s,e.z):Pm(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=su(ni(u,.3).div(.65)),l.assign(Sr(a,u))}),l}),xee=i=>{let e=YM.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,YM.set(i,e)),e},yee=i=>{let e=YM.get(i);e!==void 0&&(e.dispose(),YM.delete(i))},YY=new Nh,o1=[],vee=(i,e,t,n)=>{o1[0]=i,o1[1]=e;let r=YY.get(o1);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===Jl)&&(n&&(RZ(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,YY.set(o1,r)),o1[0]=null,o1[1]=null,r},Twe=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));Ci({start:fe(0),end:fe(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(se(u).mul(a)),p=n.sample(fs(zm.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)}),Ewe=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));Ci({start:fe(0),end:fe(i),type:"int",condition:"<"},({i:u})=>{let f=l.add(se(u).mul(a)),p=n.sample(fs(zm.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)}),Mwe=[Aee,mee,gee,_ee],l8,qE=new ub,ZM=class extends DO{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||tr("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=tr("near","float",n.camera).setGroup(Zt),u=tr("far","float",n.camera).setGroup(Zt);a=HC(l.negate(),c,u)}return o=pe(o.x,o.y.oneMinus(),r.reversedDepthBuffer?a.sub(s):a.add(s)),o}getShadowFilterFn(e){return Mwe[e]}setupRenderTarget(e,t){let n=new ls(e.mapSize.width,e.mapSize.height);n.name="ShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Wc:nh;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(Ff.TEXTURE_COMPARE);if((l===tp||l===qT)&&c?(o.minFilter=vi,o.magFilter=vi):(o.minFilter=xi,o.magFilter=xi),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),l===Jl&&s.isPointLightShadow!==!0){o.compareFunction=null,a.depth>1?(a._vsmShadowMapVertical||(a._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ts,type:Li,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:Li,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:Li,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:Ts,type:Li,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=tr("blurSamples","float",s).setGroup(Zt),B=tr("radius","float",s).setGroup(Zt),z=tr("mapSize","vec2",s).setGroup(Zt),V=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Ar);V.fragmentNode=Twe({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=Ewe({samples:N,radius:B,size:z,shadowPass:F,depthLayer:this.depthLayer}).context(e.getSharedContext()),V.name="VSMHorizontal"}let u=tr("intensity","float",s).setGroup(Zt),f=tr("normalBias","float",s).setGroup(Zt),p=ZC(r),x=f0.mul(f),v;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?v=p.mul(LU.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===Jl&&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,EF()):ai(this.shadowMap.texture)),C.toInspector(`${L} / Depth`,()=>{let D=tr("near","float",this.shadow.camera),F=tr("far","float",this.shadow.camera),N;this.shadowMap.texture.isCubeTexture?N=Ea(this.shadowMap.depthTexture,EF()).r:N=ai(this.shadowMap.depthTexture).r;let B;return this.shadow.camera.isPerspectiveCamera?B=qC(N,D,F):B=SJ(N,D,F),B=Em(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;l8=wwe(s,o,l8),o.overrideMaterial=xee(n),s.setRenderObjectFunction(vee(s,r,l,x)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(f),l===Jl&&r.isPointLightShadow!==!0&&this.vsmPass(s),r.camera.layers.mask=u,Swe(s,o,l8)}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),qE.material=this.vsmMaterialVertical,qE.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),qE.material=this.vsmMaterialHorizontal,qE.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,yee(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))}},bee=(i,e)=>new ZM(i,e),Cwe=new Ut,ZY=new on,Nv=new ie,c8=new ie,Rwe=[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)],Pwe=[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)],Iwe=[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)],Nwe=[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)],wee=Ae(({depthTexture:i,bd3D:e,dp:t})=>Ea(i,e).compare(t)),See=Ae(({depthTexture:i,bd3D:e,dp:t,shadow:n})=>{let r=tr("radius","float",n).setGroup(Zt),s=tr("mapSize","vec2",n).setGroup(Zt),o=r.div(s.x),a=Qi(e),l=Jo(Zf(e,a.x.greaterThan(a.z).select(pe(0,1,0),pe(1,0,0)))),c=Zf(e,l),u=TU(zm.xy).mul(6.28318530718),f=tu(0,5,u),p=tu(1,5,u),x=tu(2,5,u),v=tu(3,5,u),w=tu(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)}),Lwe=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=tr("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=TJ(a.negate(),l,c),p.subAssign(u)):r.renderer.logarithmicDepthBuffer?(p=HC(a.negate(),l,c),p.addAssign(u)):(p=_U(a.negate(),l,c),p.addAssign(u));let x=s.normalize();f.assign(i({depthTexture:e,bd3D:x,dp:p,shadow:n}))}),f}),FO=class extends ZM{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===ZN?wee:See}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:n,shadowCoord:r,shadow:s}){return Lwe({filterFn:t,depthTexture:n,shadowCoord:r,shadow:s})}setupRenderTarget(e,t){let n=new m_(e.mapSize.width);n.name="PointShadowDepthTexture",n.compareFunction=t.renderer.reversedDepthBuffer?Wc:nh;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?Rwe:Iwe,f=c?Pwe:Nwe;n.setSize(t.mapSize.width,t.mapSize.width);let p=s.autoClear,x=s.getClearColor(Cwe),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()),Nv.setFromMatrixPosition(r.matrixWorld),a.position.copy(Nv),c8.copy(a.position),c8.add(u[w]),a.up.copy(f[w]),a.lookAt(c8),a.updateMatrixWorld(),l.makeTranslation(-Nv.x,-Nv.y,-Nv.z),ZY.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),t._frustum.setFromProjectionMatrix(ZY,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)}},Tee=(i,e)=>new FO(i,e),Kf=class extends a0{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 IU(this.light).sub(e.context.positionView||ts)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return bee(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)}},DU=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)}),Eee=({color:i,lightVector:e,cutoffDistance:t,decayExponent:n})=>{let r=e.normalize(),s=e.length(),o=DU({lightDistance:s,cutoffDistance:t,decayExponent:n}),a=i.mul(o);return{lightDirection:r,lightColor:a}},OO=class extends Kf{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 Tee(this.light)}setupDirect(e){return Eee({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},Dwe=Ae(([i=Ri()])=>{let e=i.mul(2),t=e.x.floor(),n=e.y.floor();return t.add(n).mod(2).sign()}),Fwe=Ae(([i=Ri()],{renderer:e,material:t})=>{let n=U7(i.mul(2).sub(1)),r;if(t.alphaToCoverage&&e.currentSamples>0){let s=se(n.fwidth()).toVar();r=Ll(s.oneMinus(),s.add(1),n).oneMinus()}else r=Qo(n.greaterThan(1),0,1);return r}),Zv=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=Il(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"}]}),KM=Ae(([i,e])=>{let t=Il(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(Th(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))}),Owe=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"}]}),Bwe=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"}]}),Mee=Mo([Owe,Bwe]),Uwe=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"}]}),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=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"}]}),Cee=Mo([Uwe,kwe]),Gwe=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(Zv(o.lessThan(it(4)),r,n)).toVar(),l=se(bn(2,Zv(o.lessThan(it(4)),n,r))).toVar();return KM(a,Il(o.bitAnd(it(1)))).add(KM(l,Il(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"}]}),zwe=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(Zv(l.lessThan(it(8)),o,s)).toVar(),u=se(Zv(l.lessThan(it(4)),s,Zv(l.equal(it(12)).or(l.equal(it(14))),o,r))).toVar();return KM(c,Il(l.bitAnd(it(1)))).add(KM(u,Il(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"}]}),io=Mo([Gwe,zwe]),Vwe=Ae(([i,e,t])=>{let n=se(t).toVar(),r=se(e).toVar(),s=km(i).toVar();return pe(io(s.x,r,n),io(s.y,r,n),io(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"}]}),qwe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=se(e).toVar(),a=km(i).toVar();return pe(io(a.x,o,s,r),io(a.y,o,s,r),io(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"}]}),uc=Mo([Vwe,qwe]),Hwe=Ae(([i])=>{let e=se(i).toVar();return bn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Wwe=Ae(([i])=>{let e=se(i).toVar();return bn(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),jwe=Ae(([i])=>{let e=pe(i).toVar();return bn(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Ree=Mo([Hwe,jwe]),Xwe=Ae(([i])=>{let e=pe(i).toVar();return bn(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),Pee=Mo([Wwe,Xwe]),Cl=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"}]}),Iee=Ae(([i,e,t])=>{i.subAssign(t),i.bitXorAssign(Cl(t,fe(4))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Cl(i,fe(6))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Cl(e,fe(8))),e.addAssign(i),i.subAssign(t),i.bitXorAssign(Cl(t,fe(16))),t.addAssign(e),e.subAssign(i),e.bitXorAssign(Cl(i,fe(19))),i.addAssign(t),t.subAssign(e),t.bitXorAssign(Cl(e,fe(4))),e.addAssign(i)}),Sb=Ae(([i,e,t])=>{let n=it(t).toVar(),r=it(e).toVar(),s=it(i).toVar();return n.bitXorAssign(r),n.subAssign(Cl(r,fe(14))),s.bitXorAssign(n),s.subAssign(Cl(n,fe(11))),r.bitXorAssign(s),r.subAssign(Cl(s,fe(25))),n.bitXorAssign(r),n.subAssign(Cl(r,fe(16))),s.bitXorAssign(n),s.subAssign(Cl(n,fe(4))),r.bitXorAssign(s),r.subAssign(Cl(s,fe(14))),n.bitXorAssign(r),n.subAssign(Cl(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"}]}),Ch=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"}]}),$we=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 Sb(n.add(it(e)),n,n)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),Ywe=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)),Sb(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),Zwe=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)),Sb(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),Kwe=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)),Iee(c,u,f),c.addAssign(it(r)),Sb(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"}]}),Qwe=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)),Iee(f,p,x),f.addAssign(it(o)),p.addAssign(it(s)),Sb(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"}]}),Fi=Mo([$we,Ywe,Zwe,Kwe,Qwe]),Jwe=Ae(([i,e])=>{let t=fe(e).toVar(),n=fe(i).toVar(),r=it(Fi(n,t)).toVar(),s=km().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"}]}),eSe=Ae(([i,e,t])=>{let n=fe(t).toVar(),r=fe(e).toVar(),s=fe(i).toVar(),o=it(Fi(s,r,n)).toVar(),a=km().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"}]}),hc=Mo([Jwe,eSe]),tSe=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(Ch(r)).toVar(),a=se(Ch(s)).toVar(),l=se(Mee(io(Fi(t,n),r,s),io(Fi(t.add(fe(1)),n),r.sub(1),s),io(Fi(t,n.add(fe(1))),r,s.sub(1)),io(Fi(t.add(fe(1)),n.add(fe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return Ree(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),nSe=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(Ch(s)).toVar(),c=se(Ch(o)).toVar(),u=se(Ch(a)).toVar(),f=se(Cee(io(Fi(t,n,r),s,o,a),io(Fi(t.add(fe(1)),n,r),s.sub(1),o,a),io(Fi(t,n.add(fe(1)),r),s,o.sub(1),a),io(Fi(t.add(fe(1)),n.add(fe(1)),r),s.sub(1),o.sub(1),a),io(Fi(t,n,r.add(fe(1))),s,o,a.sub(1)),io(Fi(t.add(fe(1)),n,r.add(fe(1))),s.sub(1),o,a.sub(1)),io(Fi(t,n.add(fe(1)),r.add(fe(1))),s,o.sub(1),a.sub(1)),io(Fi(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 Pee(f)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),FU=Mo([tSe,nSe]),iSe=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(Ch(r)).toVar(),a=se(Ch(s)).toVar(),l=pe(Mee(uc(hc(t,n),r,s),uc(hc(t.add(fe(1)),n),r.sub(1),s),uc(hc(t,n.add(fe(1))),r,s.sub(1)),uc(hc(t.add(fe(1)),n.add(fe(1))),r.sub(1),s.sub(1)),o,a)).toVar();return Ree(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),rSe=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(Ch(s)).toVar(),c=se(Ch(o)).toVar(),u=se(Ch(a)).toVar(),f=pe(Cee(uc(hc(t,n,r),s,o,a),uc(hc(t.add(fe(1)),n,r),s.sub(1),o,a),uc(hc(t,n.add(fe(1)),r),s,o.sub(1),a),uc(hc(t.add(fe(1)),n.add(fe(1)),r),s.sub(1),o.sub(1),a),uc(hc(t,n,r.add(fe(1))),s,o,a.sub(1)),uc(hc(t.add(fe(1)),n,r.add(fe(1))),s.sub(1),o,a.sub(1)),uc(hc(t,n.add(fe(1)),r.add(fe(1))),s,o.sub(1),a.sub(1)),uc(hc(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 Pee(f)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Tb=Mo([iSe,rSe]),sSe=Ae(([i])=>{let e=se(i).toVar(),t=fe(hs(e)).toVar();return ea(Fi(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),oSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe(hs(e.x)).toVar(),n=fe(hs(e.y)).toVar();return ea(Fi(t,n))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),aSe=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(Fi(t,n,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),lSe=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(Fi(t,n,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),cSe=Mo([sSe,oSe,aSe,lSe]),uSe=Ae(([i])=>{let e=se(i).toVar(),t=fe(hs(e)).toVar();return pe(ea(Fi(t,fe(0))),ea(Fi(t,fe(1))),ea(Fi(t,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),hSe=Ae(([i])=>{let e=ft(i).toVar(),t=fe(hs(e.x)).toVar(),n=fe(hs(e.y)).toVar();return pe(ea(Fi(t,n,fe(0))),ea(Fi(t,n,fe(1))),ea(Fi(t,n,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),fSe=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(Fi(t,n,r,fe(0))),ea(Fi(t,n,r,fe(1))),ea(Fi(t,n,r,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),dSe=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(Fi(t,n,r,s,fe(0))),ea(Fi(t,n,r,s,fe(1))),ea(Fi(t,n,r,s,fe(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),KC=Mo([uSe,hSe,fSe,dSe]),QM=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 Ci(o,()=>{l.addAssign(c.mul(FU(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"}]}),QC=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 Ci(o,()=>{l.addAssign(c.mul(Tb(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"}]}),pSe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar();return ft(QM(a,o,s,r),QM(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"}]}),ASe=Ae(([i,e,t,n])=>{let r=se(n).toVar(),s=se(t).toVar(),o=fe(e).toVar(),a=pe(i).toVar(),l=pe(QC(a,o,s,r)).toVar(),c=se(QM(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"}]}),mSe=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(KC(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)),()=>Qi(T.x).add(Qi(T.y))),Wt(a.equal(fe(3)),()=>Sr(Qi(T.x),Qi(T.y))),mc(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"}]}),gSe=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(KC(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)),()=>Qi(C.x).add(Qi(C.y)).add(Qi(C.z))),Wt(c.equal(fe(3)),()=>Sr(Qi(C.x),Qi(C.y),Qi(C.z))),mc(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"}]}),z1=Mo([mSe,gSe]),_Se=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 Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(z1(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"}]}),xSe=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 Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(z1(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"}]}),ySe=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 Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:u})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:f})=>{let p=se(z1(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"}]}),vSe=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 Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ci({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(z1(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"}]}),bSe=Mo([_Se,vSe]),wSe=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 Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ci({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(z1(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"}]}),SSe=Mo([xSe,wSe]),TSe=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 Ci({start:-1,end:fe(1),name:"x",condition:"<="},({x:f})=>{Ci({start:-1,end:fe(1),name:"y",condition:"<="},({y:p})=>{Ci({start:-1,end:fe(1),name:"z",condition:"<="},({z:x})=>{let v=se(z1(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"}]}),OU=Mo([ySe,TSe]),ESe=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=Il(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(Tb(D))}),Wt(f.equal(fe(1)),()=>{F.assign(KC(D))}),Wt(f.equal(fe(2)),()=>{F.assign(OU(D,w,fe(0)))}),Wt(f.equal(fe(3)),()=>{F.assign(QC(pe(D,0),R,C,L))}),F.assign(F.mul(T.sub(S)).add(S)),Wt(P,()=>{F.assign(su(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"}]}),MSe=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=Il(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(Tb(D))}),Wt(f.equal(fe(1)),()=>{F.assign(KC(D))}),Wt(f.equal(fe(2)),()=>{F.assign(OU(D,w,fe(0)))}),Wt(f.equal(fe(3)),()=>{F.assign(QC(D,R,C,L))}),F.assign(F.mul(T.sub(S)).add(S)),Wt(P,()=>{F.assign(su(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"}]}),CSe=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(Th(r)).mul(6).toVar();let s=fe(D7(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"}]}),RSe=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"}]}),PSe=Ae(([i])=>{let e=pe(i).toVar(),t=_7(T7(e,pe(.04045))).toVar(),n=pe(e.div(12.92)).toVar(),r=pe(fc(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"}]}),Nee=(i,e)=>{i=se(i),e=se(e);let t=ft(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return Ll(i.sub(t),i.add(t),e)},Lee=(i,e,t,n)=>Xn(i,e,t[n].clamp()),ISe=(i,e,t=Ri())=>Lee(i,e,t,"x"),NSe=(i,e,t=Ri())=>Lee(i,e,t,"y"),LSe=(i,e,t,n,r=Ri())=>{let s=r.x.clamp(),o=r.y.clamp(),a=Xn(i,e,s),l=Xn(t,n,s);return Xn(a,l,o)},Dee=(i,e,t,n,r)=>Xn(i,e,Nee(t,n[r])),DSe=(i,e,t,n=Ri())=>Dee(i,e,t,n,"x"),FSe=(i,e,t,n=Ri())=>Dee(i,e,t,n,"y"),OSe=(i=1,e=0,t=Ri())=>t.mul(i).add(e),BSe=(i,e=1)=>(i=se(i),i.abs().pow(e).mul(i.sign())),USe=(i,e=1,t=.5)=>se(i).sub(t).mul(e).add(t),kSe=(i=Ri(),e=1,t=0)=>FU(i.convert("vec2|vec3")).mul(e).add(t),GSe=(i=Ri(),e=1,t=0)=>Tb(i.convert("vec2|vec3")).mul(e).add(t),zSe=(i=Ri(),e=1,t=0)=>(i=i.convert("vec2|vec3"),Lt(Tb(i),FU(i.add(ft(19,73)))).mul(e).add(t)),VSe=(i,e=Ri(),t=ft(1,1),n=ft(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>ESe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),qSe=(i,e=Ri(),t=ft(1,1),n=ft(0,0),r=1,s=0,o=1,a=!1,l=1,c=2,u=.5)=>MSe(i,e.convert("vec2|vec3"),t,n,r,s,o,a,l,c,u),HSe=(i=Ri(),e=1)=>bSe(i.convert("vec2|vec3"),e,fe(1)),WSe=(i=Ri(),e=1)=>SSe(i.convert("vec2|vec3"),e,fe(1)),jSe=(i=Ri(),e=1)=>OU(i.convert("vec2|vec3"),e,fe(1)),XSe=(i=Ri())=>cSe(i.convert("vec2|vec3")),$Se=(i=Ri(),e=3,t=2,n=.5,r=1)=>QM(i,fe(e),t,n).mul(r),YSe=(i=Ri(),e=3,t=2,n=.5,r=1)=>pSe(i,fe(e),t,n).mul(r),ZSe=(i=Ri(),e=3,t=2,n=.5,r=1)=>QC(i,fe(e),t,n).mul(r),KSe=(i=Ri(),e=3,t=2,n=.5,r=1)=>ASe(i,fe(e),t,n).mul(r),QSe=(i,e=se(0))=>fs(i,e),JSe=(i,e=se(0))=>ni(i,e),eTe=(i,e=se(1))=>bn(i,e),tTe=(i,e=se(1))=>Nl(i,e),nTe=(i,e=se(1))=>IC(i,e),iTe=(i,e=se(1))=>fc(i,e),rTe=(i=se(0),e=se(1))=>R7(i,e),sTe=()=>G1,oTe=()=>KJ,aTe=(i,e=se(1))=>ni(e,i),lTe=(i,e,t,n)=>i.greaterThan(e).mix(t,n),cTe=(i,e,t,n)=>i.greaterThanEqual(e).mix(t,n),uTe=(i,e,t,n)=>i.equal(e).mix(t,n),hTe=(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},fTe=(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},dTe=(i,e)=>{i=ft(i),e=se(e);let t=e.mul(Math.PI/180);return bb(i,t)},pTe=(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))},ATe=(i,e)=>(i=pe(i),e=se(e),oU(i,e)),mTe=Ae(([i,e,t])=>{let n=Jo(i).toVar(),r=ni(se(.5).mul(e.sub(t)),Mh).div(n).toVar(),s=ni(se(-.5).mul(e.sub(t)),Mh).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 Mh.add(n.mul(a)).toVar().sub(t)}),Fee=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:bU,BRDF_Lambert:Dm,BasicPointShadowFilter:wee,BasicShadowFilter:Aee,Break:yJ,Const:WK,Continue:vye,DFGLUT:sb,D_GGX:LJ,Discard:oQ,EPSILON:NC,F_Schlick:L1,Fn:Ae,HALF_PI:Axe,INFINITY:fxe,If:Wt,Loop:Ci,NodeAccess:To,NodeShaderStage:m1,NodeType:W1e,NodeUpdateType:_n,OnBeforeFrameUpdate:Aye,OnBeforeMaterialUpdate:pye,OnBeforeObjectUpdate:dye,OnFrameUpdate:fJ,OnMaterialUpdate:fye,OnObjectUpdate:vb,PCFShadowFilter:mee,PCFSoftShadowFilter:gee,PI:bM,PI2:dxe,PointShadowFilter:See,Return:Exe,Schlick_to_F0:NF,ShaderNode:x1,Stack:MC,Switch:oxe,TBNViewMatrix:ym,TWO_PI:pxe,VSMShadowFilter:_ee,V_GGX_SmithCorrelated:NJ,Var:HK,VarIntent:jK,abs:Qi,acesFilmicToneMapping:aee,acos:C7,acosh:yK,add:fs,addMethodChaining:Be,addNodeElement:Mxe,agxToneMapping:lee,all:uK,alphaT:gM,ambientOcclusion:D8,and:ZZ,anisotropy:$p,anisotropyB:wm,anisotropyT:Wv,any:hK,append:lxe,array:VZ,asin:_K,asinh:xK,assign:qZ,atan:R7,atanh:vK,atomicAdd:Lbe,atomicAnd:Bbe,atomicFunc:Oh,atomicLoad:Ibe,atomicMax:Fbe,atomicMin:Obe,atomicOr:Ube,atomicStore:Nbe,atomicSub:Dbe,atomicXor:kbe,attenuationColor:w7,attenuationDistance:b7,attribute:Pl,attributeArray:Uve,backgroundBlurriness:eee,backgroundIntensity:vO,backgroundRotation:tee,batch:mJ,batchColor:pU,bentNormalView:OQ,billboarding:Eve,bitAnd:eK,bitNot:tK,bitOr:nK,bitXor:iK,bitangentGeometry:rye,bitangentLocal:sye,bitangentView:DQ,bitangentWorld:oye,bitcast:YJ,blendBurn:$ve,blendColor:Qve,blendDodge:Yve,blendOverlay:Kve,blendScreen:Zve,blur:kJ,bool:Il,buffer:U1,bufferAttribute:H7,builtin:ed,builtinAOContext:VK,builtinShadowContext:zK,bumpMap:oU,bvec2:OZ,bvec3:_7,bvec4:BZ,bypass:rQ,cache:iQ,call:HZ,cameraFar:Kp,cameraIndex:u0,cameraNear:Zp,cameraNormalMatrix:Fxe,cameraPosition:fQ,cameraProjectionMatrix:Ma,cameraProjectionMatrixInverse:hQ,cameraViewMatrix:h0,cameraViewport:Oxe,cameraWorldMatrix:yb,cbrt:FK,cdl:ibe,ceil:DC,checker:Dwe,cineonToneMapping:oee,clamp:su,clearcoat:pM,clearcoatNormalView:Qp,clearcoatRoughness:v1,clipSpace:AQ,code:$C,color:FZ,colorSpaceToWorking:OC,colorToDirection:cye,compute:nQ,computeKernel:j7,computeSkinning:yye,context:Jf,convert:kZ,convertColorSpace:xxe,convertToTexture:Dve,cos:eu,cosh:AK,countLeadingZeros:ive,countOneBits:rve,countTrailingZeros:nve,cross:Zf,cubeTexture:Ea,cubeTextureBase:rU,dFdx:N7,dFdy:L7,dashSize:Sm,debug:lQ,decrement:cK,decrementBefore:aK,defaultBuildStages:sM,defaultShaderStages:PZ,defined:M1,degrees:dK,deltaTime:_ve,densityFogFactor:fee,depth:xU,depthPass:lbe,determinant:EK,difference:PK,diffuseColor:Mi,diffuseContribution:mm,directPointLight:Eee,directionToColor:lye,directionToFaceDirection:Yxe,dispersion:S7,disposeShadowMaterial:yee,distance:RK,div:Nl,dot:mc,drawIndex:tQ,dynamicBufferAttribute:bxe,element:UZ,emissive:L8,equal:WZ,equirectDirection:EF,equirectUV:yU,exp:E7,exp2:C1,exponentialHeightFogFactor:xbe,expression:Rl,faceDirection:tU,faceForward:G7,faceforward:mxe,float:se,floatBitsToInt:J2e,floatBitsToUint:ZJ,floor:Th,fog:CO,fract:ru,frameGroup:uxe,frameId:KJ,frontFacing:mQ,fwidth:F7,gain:ove,gapSize:eb,getConstNodeType:DZ,getCurrentStack:A7,getDirection:BJ,getDistanceAttenuation:DU,getGeometryRoughness:IJ,getNormalFromDepth:Ove,getParallaxCorrectNormal:mTe,getRoughness:vU,getScreenPosition:Fve,getShIrradianceAt:Fee,getShadowMaterial:xee,getShadowRenderObjectFunction:vee,getTextureIndex:XJ,getViewPosition:_1,ggxConvolution:GJ,globalId:wbe,glsl:mbe,glslFn:gbe,grayscale:Jve,greaterThan:T7,greaterThanEqual:YZ,hash:sve,highpModelNormalViewMatrix:eF,highpModelViewMatrix:J8,hue:nbe,increment:lK,incrementBefore:oK,inspector:cQ,instance:pJ,instanceColor:dU,instanceIndex:iu,instancedArray:kve,instancedBufferAttribute:UC,instancedDynamicBufferAttribute:W7,instancedMesh:AJ,int:fe,intBitsToFloat:eve,interleavedGradientNoise:TU,inverse:MK,inverseSqrt:M7,inversesqrt:gxe,invocationLocalIndex:Txe,invocationSubgroupIndex:Sxe,ior:jv,iridescence:RC,iridescenceIOR:AM,iridescenceThickness:mM,isolate:S1,ivec2:wr,ivec3:g7,ivec4:x7,js:pbe,label:qK,length:Eh,lengthSq:U7,lessThan:XZ,lessThanEqual:$Z,lightPosition:PU,lightProjectionUV:dee,lightShadowMatrix:ZC,lightTargetDirection:NU,lightTargetPosition:pee,lightViewPosition:IU,lightingContext:bJ,lights:mwe,linearDepth:IM,linearToneMapping:ree,localId:Sbe,log:LC,log2:Sh,logarithmicDepthToViewZ:Eye,luminance:MU,mat2:CC,mat3:ro,mat4:n0,matcapUV:zJ,materialAO:uJ,materialAlphaTest:UQ,materialAnisotropy:JQ,materialAnisotropyVector:g1,materialAttenuationColor:aJ,materialAttenuationDistance:oJ,materialClearcoat:XQ,materialClearcoatNormal:YQ,materialClearcoatRoughness:$Q,materialColor:kQ,materialDispersion:cJ,materialEmissive:zQ,materialEnvIntensity:aM,materialEnvRotation:MM,materialIOR:sJ,materialIridescence:eJ,materialIridescenceIOR:tJ,materialIridescenceThickness:nJ,materialLightMap:fU,materialLineDashOffset:hU,materialLineDashSize:cU,materialLineGapSize:uU,materialLineScale:lU,materialLineWidth:CM,materialMetalness:WQ,materialNormal:jQ,materialOpacity:aU,materialPointSize:lJ,materialReference:jf,materialReflectivity:lM,materialRefractionRatio:xQ,materialRotation:ZQ,materialRoughness:HQ,materialSheen:KQ,materialSheenRoughness:QQ,materialShininess:GQ,materialSpecular:VQ,materialSpecularColor:qQ,materialSpecularIntensity:hF,materialSpecularStrength:Xv,materialThickness:rJ,materialTransmission:iJ,max:Sr,maxMipLevel:Z7,mediumpModelViewMatrix:pQ,metalness:$f,min:Ja,mix:Xn,mixElement:BK,mod:IC,modelDirection:qxe,modelNormalMatrix:dQ,modelPosition:Hxe,modelRadius:Xxe,modelScale:Wxe,modelViewMatrix:Ph,modelViewPosition:jxe,modelViewProjection:hJ,modelWorldMatrix:dc,modelWorldMatrixInverse:$xe,morphReference:vJ,mrt:$J,mul:bn,mx_aastep:Nee,mx_add:QSe,mx_atan2:rTe,mx_cell_noise_float:XSe,mx_contrast:USe,mx_divide:tTe,mx_fractal_noise_float:$Se,mx_fractal_noise_vec2:YSe,mx_fractal_noise_vec3:ZSe,mx_fractal_noise_vec4:KSe,mx_frame:oTe,mx_heighttonormal:ATe,mx_hsvtorgb:CSe,mx_ifequal:uTe,mx_ifgreater:lTe,mx_ifgreatereq:cTe,mx_invert:aTe,mx_modulo:nTe,mx_multiply:eTe,mx_noise_float:kSe,mx_noise_vec3:GSe,mx_noise_vec4:zSe,mx_place2d:fTe,mx_power:iTe,mx_ramp4:LSe,mx_ramplr:ISe,mx_ramptb:NSe,mx_rgbtohsv:RSe,mx_rotate2d:dTe,mx_rotate3d:pTe,mx_safepower:BSe,mx_separate:hTe,mx_splitlr:DSe,mx_splittb:FSe,mx_srgb_texture_to_lin_rec709:PSe,mx_subtract:JSe,mx_timer:sTe,mx_transform_uv:OSe,mx_unifiednoise2d:VSe,mx_unifiednoise3d:qSe,mx_worley_noise_float:HSe,mx_worley_noise_vec2:WSe,mx_worley_noise_vec3:jSe,negate:I7,negateOnBackSide:Vm,neutralToneMapping:cee,nodeArray:bm,nodeImmutable:xt,nodeObject:Vt,nodeObjectIntent:zv,nodeObjects:EC,nodeProxy:qn,nodeProxyConstructor:p7,nodeProxyIntent:lt,normalFlat:gQ,normalGeometry:kC,normalLocal:ta,normalMap:cF,normalView:oi,normalViewGeometry:R1,normalWorld:f0,normalWorldGeometry:_Q,normalize:Jo,not:QZ,notEqual:jZ,numWorkgroups:vbe,objectDirection:Bxe,objectGroup:zZ,objectPosition:kxe,objectRadius:Vxe,objectScale:Gxe,objectViewPosition:zxe,objectWorldMatrix:Uxe,oneMinus:bK,or:KZ,orthographicDepthToViewZ:SJ,oscSawtooth:bve,oscSine:xve,oscSquare:yve,oscTriangle:vve,output:b1,outputStruct:Z2e,overloadingFn:Mo,overrideNode:WJ,overrideNodes:jJ,packHalf2x16:hve,packNormalToRGB:sU,packSnorm2x16:cve,packUnorm2x16:uve,parabola:fO,parallaxDirection:FQ,parallaxUV:aye,parameter:X2e,pass:obe,passTexture:abe,pcurve:ave,perspectiveDepthToViewZ:qC,pmremTexture:SU,pointShadow:Tee,pointUV:Gve,pointWidth:cxe,positionGeometry:Zo,positionLocal:fr,positionPrevious:Lm,positionView:ts,positionViewDirection:zi,positionWorld:Mh,positionWorldDirection:eU,posterize:rbe,pow:fc,pow2:O7,pow3:IK,pow4:B7,premultiplyAlpha:$7,property:Qf,quadBroadcast:uwe,quadSwapDiagonal:rwe,quadSwapX:nwe,quadSwapY:iwe,radians:fK,rand:OK,range:ybe,rangeFogFactor:hee,reciprocal:SK,reference:tr,referenceBuffer:TQ,reflect:CK,reflectVector:bQ,reflectView:yQ,reflector:Ive,refract:k7,refractVector:wQ,refractView:vQ,reinhardToneMapping:see,remap:X7,remapClamp:sQ,renderGroup:Zt,renderOutput:Y7,rendererReference:KK,replaceDefaultUV:wve,rotate:bb,rotateUV:Sve,roughness:bh,round:wK,rtt:JJ,sRGBTransferEOTF:$K,sRGBTransferOETF:YK,sample:Bve,sampler:Ixe,samplerComparison:Nxe,saturate:FC,saturation:ebe,screenCoordinate:zm,screenDPR:Q7,screenSize:Nm,screenUV:nu,select:Qo,setCurrentStack:Jv,setName:z7,shaderStages:oM,shadow:bee,shadowPositionWorld:LU,shapeCircle:Fwe,sharedUniformGroup:PC,sheen:Ml,sheenRoughness:Yp,shiftLeft:rK,shiftRight:sK,shininess:_M,sign:P7,sin:Ta,sinc:lve,sinh:pK,skinning:xJ,smoothstep:Ll,smoothstepElement:UK,specularColor:s0,specularColorBlended:_m,specularF90:xm,spherizeUV:Tve,split:axe,spritesheetUV:Cve,sqrt:Ca,stack:uM,step:Pm,stepElement:kK,storage:i0,storageBarrier:Mbe,storageTexture:nee,storageTexture3D:Vve,struct:Y2e,sub:ni,subBuild:Tm,subgroupAdd:Vbe,subgroupAll:Jbe,subgroupAnd:$be,subgroupAny:ewe,subgroupBallot:zbe,subgroupBroadcast:swe,subgroupBroadcastFirst:twe,subgroupElect:Gbe,subgroupExclusiveAdd:Hbe,subgroupExclusiveMul:Xbe,subgroupInclusiveAdd:qbe,subgroupInclusiveMul:jbe,subgroupIndex:wxe,subgroupMax:Qbe,subgroupMin:Kbe,subgroupMul:Wbe,subgroupOr:Ybe,subgroupShuffle:owe,subgroupShuffleDown:cwe,subgroupShuffleUp:lwe,subgroupShuffleXor:awe,subgroupSize:Tbe,subgroupXor:Zbe,tan:mK,tangentGeometry:GC,tangentLocal:o0,tangentView:zC,tangentWorld:LQ,tanh:gK,texture:ai,texture3D:EU,texture3DLevel:Wve,texture3DLoad:Hve,textureBarrier:Cbe,textureBicubic:Jye,textureBicubicLevel:wU,textureCubeUV:UJ,textureLevel:Pxe,textureLoad:es,textureSize:Im,textureStore:zve,thickness:v7,time:G1,toneMapping:QK,toneMappingExposure:JK,toonOutlinePass:cbe,transformDirection:NK,transformNormal:nU,transformNormalByInverseViewMatrix:DK,transformNormalByViewMatrix:LK,transformNormalToView:iU,transformedClearcoatNormalView:Qxe,transformedNormalView:Zxe,transformedNormalWorld:Kxe,transmission:xM,transpose:TK,triNoise3D:mve,triplanarTexture:Rve,triplanarTextures:QJ,trunc:D7,uint:it,uintBitsToFloat:tve,uniform:Ht,uniformArray:So,uniformCubeTexture:Jxe,uniformFlow:GK,uniformGroup:GZ,uniformTexture:Rxe,unpackHalf2x16:pve,unpackNormal:aF,unpackRGBToNormal:BQ,unpackSnorm2x16:fve,unpackUnorm2x16:dve,unpremultiplyAlpha:aQ,userData:jve,uv:Ri,uvec2:m7,uvec3:km,uvec4:y7,varying:c0,varyingProperty:Gm,vec2:ft,vec3:pe,vec4:Lt,vectorComponents:Um,velocity:Xve,vertexColor:MJ,vertexIndex:eQ,vertexStage:XK,vibrance:tbe,viewZToLogarithmicDepth:HC,viewZToOrthographicDepth:Em,viewZToPerspectiveDepth:_U,viewZToReversedOrthographicDepth:Tye,viewZToReversedPerspectiveDepth:TJ,viewport:E1,viewportCoordinate:uQ,viewportDepthTexture:gU,viewportLinearDepth:Mye,viewportMipTexture:mU,viewportOpaqueMipTexture:wJ,viewportResolution:Dxe,viewportSafeUV:Mve,viewportSharedTexture:sbe,viewportSize:J7,viewportTexture:wye,viewportUV:Lxe,vogelDiskSample:tu,wgsl:Abe,wgslFn:_be,workgroupArray:Rbe,workgroupBarrier:Ebe,workgroupId:bbe,workingToColorSpace:ZK,xor:JZ}),Qc=new ab,BO=class extends Lh{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(Qc),Qc.a=r._clearColor.a;else if(s.isColor===!0)s.getRGB(Qc),Qc.a=1,o=!0;else if(s.isNode===!0){let l=this.get(e),c=s;Qc.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(vO).context({getUV:()=>tee.mul(_Q),getTextureLevel:()=>eee}),x=Ma.element(3).element(3).equal(1),v=Nl(1,Ma.element(1).element(1)).mul(3),w=x.select(fr.mul(v),fr),S=Ph.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(vO),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"?Qc.set(0,0,0,1):a==="alpha-blend"&&Qc.set(0,0,0,0),r.autoClear===!0||o===!0){let l=n.clearColorValue;l.r=Qc.r,l.g=Qc.g,l.b=Qc.b,l.a=Qc.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}},gTe=0,fb=class{constructor(e="",t=[]){this.name=e,this.bindings=t,this.id=gTe++}},UO=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 fb(t.name,[]);e.push(r);for(let s of t.bindings)r.bindings.push(s.clone())}else e.push(t);return e}},JM=class{constructor(e,t,n=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=n}},kO=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}},eC=class{constructor(e,t,n=!1,r=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=n,this.count=r}},GO=class extends eC{constructor(e,t,n=null,r=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=n,this.interpolationSampling=r}},zO=class{constructor(e,t,n=""){this.name=e,this.type=t,this.code=n,Object.defineProperty(this,"isNodeCode",{value:!0})}},_Te=0,Kv=class{constructor(e=null){this.id=_Te++,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)}},VO=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},Fh=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}},qO=class extends Fh{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},HO=class extends Fh{constructor(e,t=new Oe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},WO=class extends Fh{constructor(e,t=new ie){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},jO=class extends Fh{constructor(e,t=new gn){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},XO=class extends Fh{constructor(e,t=new Ut){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},$O=class extends Fh{constructor(e,t=new T_){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},YO=class extends Fh{constructor(e,t=new Sn){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},ZO=class extends Fh{constructor(e,t=new on){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},KO=class extends qO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},QO=class extends HO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},JO=class extends WO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},eB=class extends jO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},tB=class extends XO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},nB=class extends $O{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},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}},xTe=0,KY=new WeakMap,QY=new WeakMap,yTe=new WeakMap,vTe=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),HE=i=>/e/g.test(i)?String(i).replace(/\+/g,""):(i=Number(i),i+(i%1?"":".0")),Oee=i=>{if(i.writeUsageCount>0)return!0;if(i.subBuildsCache!==void 0){for(let e in i.subBuildsCache)if(Oee(i.subBuildsCache[e]))return!0}return!1},tC=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=uM(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new Kv,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:xTe++})}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 NM(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===Lr?o="ivec":r===pi&&(o="uvec"),s===Df||s===$u?r===Lr?t="int":r===pi?t="uint":t="float":s===Ts||s===Yu?t=`${o}2`:s===Lf||s===_2?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=KY.get(a);l===void 0&&(l=new Map,KY.set(a,l));let c=B1(o);s=l.get(c),s===void 0&&(s=new fb(e,t),l.set(c,s))}else s=new fb(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 oM)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===vi||e.magFilter===rp||e.magFilter===tc||e.magFilter===_o||e.minFilter===vi||e.minFilter===rp||e.minFilter===tc||e.minFilter===_o}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 Kv(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(Oee(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 HE(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")}( ${HE(t.r)}, ${HE(t.g)}, ${HE(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 JM(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===Lr?"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=MZ(e),r=t==="float"?"":t[0];return/mat2/.test(t)===!0&&(n=n.replace("vec","mat")),r+n}getTypeFromArray(e){return vTe.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 p_)&&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=uM(this.stack);let e=A7();return this.stacks.push(e),Jv(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,Jv(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 JM(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 VO(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 kO(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 eC(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 GO(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 zO("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=QY.get(t);n===void 0&&(n=new WeakMap,QY.set(t,n));let r=n.get(e);if(r===void 0){r=new $M;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 zM(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 Kv,this.stack=uM();for(let u of sM)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 pr),r.build(this)}else this.addFlow("compute",e)}build(){this.prebuild();for(let e of nM){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of iM){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 nM){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of iM){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=dTe.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 $O(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new YO(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new ZO(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new KO(e);else if(t==="color")r=new QO(e);else if(t==="mat2")r=new JO(e);else if(t==="mat3")r=new eB(e);else if(t==="mat4")r=new tB(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")||TZ(this.object).useVelocity===!0}},JM=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}},hb=class{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}};hb.isNodeFunctionInput=!0;var nB=class extends Zf{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},iB=class extends Zf{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:RU(this.light),lightColor:e}}},rB=class extends Zf{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=MU(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=u0.dot(r).mul(.5).add(.5),a=jn(n,t,o);e.context.irradiance.addAssign(a)}},fb=class extends Zf{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 Nl(n,r,t)}getLightCoord(e){let t=e.getNodeProperties(this),n=t.projectionUV;return n===void 0&&(n=cee(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(RU(s)),c=this.getSpotAttenuation(e,l),u=o.length(),f=IU({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}}},sB=class extends fb{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)}},oB=class extends Zf{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=wo(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=Iee(u0,this.lightProbe);e.context.irradiance.addAssign(t)}},ATe=Ae(([i,e])=>{let t=i.abs().sub(e);return Th(br(t,0)).add(Qa(br(t.x,t.y),0))}),aB=class extends fb{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=XC(this.light).mul(e.context.positionWorld||Eh);return Wt(r.w.greaterThan(0),()=>{let s=r.xyz.div(r.w),o=ATe(s.xy.sub(ft(.5)),ft(.5)),a=Il(-1,ni(1,T7(n)).sub(1));t.assign(NC(o.mul(-2).mul(a)))}),t}},a8=new on,VE=new on,Iv=null,lB=class extends Zf{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;VE.identity(),a8.copy(t.matrixWorld),a8.premultiply(n),VE.extractRotation(a8),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(VE),this.halfHeight.value.applyMatrix4(VE)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=ai(Iv.LTC_FLOAT_1),n=ai(Iv.LTC_FLOAT_2)):(t=ai(Iv.LTC_HALF_1),n=ai(Iv.LTC_HALF_2));let{colorNode:r,light:s}=this,o=CU(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){Iv=e}},eC=class{parseFunction(){je("Abstract function.")}},db=class{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){je("Abstract function.")}};db.isNodeFunction=!0;var mTe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,gTe=/[a-z_0-9]+/ig,YY="#pragma main",_Te=i=>{i=i.trim();let e=i.indexOf(YY),t=e!==-1?i.slice(e+YY.length):i,n=t.match(mTe);if(n!==null&&n.length===5){let r=n[4],s=[],o=null;for(;(o=gTe.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 hb(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.")},cB=class extends db{constructor(e){let{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=_Te(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}},uB=class extends eC{parseFunction(e){return new cB(e)}},sc=[],Gf=[],ZY=Ht(0,"int").setGroup(Zt),hB=class extends Nh{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new JM,this.nodeBuilderCache=new Map,this.callHashCache=new Ih,this.groupsData=new Ih,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===_n.OBJECT)return!0;sc[0]=t,sc[1]=e;let n=this.groupsData.get(sc);return n===void 0&&this.groupsData.set(sc,n={}),sc[0]=null,sc[1]=null,n.version!==t.version?(n.version=t.version,!0):!1}getForRenderCacheKey(e){return e.initialCacheKey}_createNodeBuilder(e,t){let n=this.backend.createNodeBuilder(e.object,this.renderer);return n.scene=e.scene,n.material=t,n.camera=e.camera,n.context.material=t,n.lightsNode=e.lightsNode,n.environmentNode=this.getEnvironmentNode(e.scene),n.fogNode=this.getFogNode(e.scene),n.clippingContext=e.clippingContext,this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview&&n.enableMultiview(),n}getForRender(e,t=!1){let n=this.get(e),r=n.nodeBuilderState;if(r===void 0){let{nodeBuilderCache:s}=this,o=this.getForRenderCacheKey(e);if(r=s.get(o),r===void 0){let a=async()=>{let l=this._createNodeBuilder(e,e.material);try{t?await l.buildAsync():l.build()}catch(c){l=this._createNodeBuilder(e,new pr),t?await l.buildAsync():l.build(),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 pr),l.build();let u=c.stackTrace;!u&&c.stack&&(u=new Fr(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 FO(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){sc[0]=e,sc[1]=t;let n=this.renderer.info.calls,r=this.callHashCache.get(sc)||{};if(r.callId!==n){if(Gf.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Gf.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){Gf.push(t.getCacheKey(!0)),Gf.push(this.renderer.shadowMap.enabled?1:0),Gf.push(this.renderer.shadowMap.type);let o=this.getEnvironmentNode(e);o&&Gf.push(o.getCacheKey())}let s=this.getFogNode(e);s&&Gf.push(s.getCacheKey()),r.callId=n,r.cacheKey=gb(Gf),this.callHashCache.set(sc,r),Gf.length=0}return sc[0]=null,sc[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===ep||n.mapping===tp||n.mapping===Hu){if(e.backgroundBlurriness>0||n.mapping===Hu)return vU(n);{let o;return n.isCubeTexture===!0?o=Ta(n):o=ai(n),EJ(o)}}else{if(n.isTexture===!0)return ai(n,tu.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=tr("color","color",n).setGroup(Zt),o=tr("density","float",n).setGroup(Zt);return TO(s,lee(o))}else if(n.isFog){let s=tr("color","color",n).setGroup(Zt),o=tr("near","float",n).setGroup(Zt),a=tr("far","float",n).setGroup(Zt);return TO(s,aee(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 Ta(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,tu).depth(Jf("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):n=ai(e,tu).depth(ZY).renderOutput(t.toneMapping,t.currentColorSpace):n=ai(e,tu).renderOutput(t.toneMapping,t.currentColorSpace),n}setOutputLayerIndex(e){ZY.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 JM,this.nodeBuilderCache=new Map,this.cacheLib={}}},l8=new aa,tC=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++){l8.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let o=t[n+s],a=l8.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=l8.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}},fB=class{constructor(e,t,n){this.bundleGroup=e,this.camera=t,this.renderContext=n}},zp=[],dB=class{constructor(){this.bundles=new Ih}get(e,t,n){let r=this.bundles;zp[0]=e,zp[1]=t,zp[2]=n;let s=r.get(zp);return s===void 0&&(s=new fB(e,t,n),r.set(zp,s)),zp[0]=null,zp[1]=null,zp[2]=null,s}dispose(){this.bundles=new Ih}},nC=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)}},xTe=new cb,KY=new WeakMap,pB=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new cb().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return xTe;let t=KY.get(e);return t===void 0&&(t=this.createNode(),KY.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},xm=class extends ca{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}},QY=new ie,JY=new ie,eZ=new WeakMap,AB=class extends Go{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new Rr,this._cameraL.viewport=new gn,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new Rr,this._cameraR.viewport=new gn,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new v_,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=TTe.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Oe,this._onSessionEvent=bTe.bind(this),this._onSessionEnd=wTe.bind(this),this._onInputSourcesChange=STe.bind(this),this._onAnimationFrame=ETe.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){Zn(`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&&(Zn("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 ca(n.textureWidth,n.textureHeight,{depth:2,minFilter:vi,magFilter:vi,depthBuffer:!0,multiview:!1,useArrayDepthTexture:!0,samples:0}),this._xrRenderTarget.texture.isArrayTexture=!0,this._useMultiviewIfPossible===!0&&Zn("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 SA(e,t),u=new xm(s,o,{format:xr,type:Gi,depthTexture:new os(s,o,l.stencil?zo:pi,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?Qs:ys),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let f=new Us({color:16777215,side:Ao});f.map=u.texture,f.map.offset.y=1,f.map.repeat.y=-1;let p=new Hn(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 Us({color:16777215,side:Ao}),x.plane.material.blending=If,x.plane.material.blendEquation=Bs,x.plane.material.blendSrc=qc,x.plane.material.blendDst=qc,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 vA(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),f=new xm(o,a,{format:xr,type:Gi,depthTexture:new os(o,a,c.stencil?zo:pi,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?Qs:ys),stencilBuffer:c.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});f._autoAllocateDepthBuffer=!0;let p=new Us({color:16777215,side:ui});p.map=f.texture,p.map.offset.y=1,p.map.repeat.y=-1;let x=new Hn(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 Us({color:16777215,side:ui}),v.plane.material.blending=If,v.plane.material.blendEquation=Bs,v.plane.material.blendSrc=qc,v.plane.material.blendDst=qc,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 vs,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=eZ.get(l),c===void 0&&(c=l.context({getOutput:f=>j7(f,n.toneMapping,n.outputColorSpace)}),eZ.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?Qs:ys,s=t.stencil?zo: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 os(c.textureWidth,c.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,r,f);if(this._xrRenderTarget=new xm(c.textureWidth,c.textureHeight,{format:xr,type:Gi,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 Us({color:16777215,side:x.type==="cylinder"?ui:Ao}),x.plane.material.blending=If,x.plane.material.blendEquation=Bs,x.plane.material.blendSrc=qc,x.plane.material.blendDst=qc,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 xm(s.framebufferWidth,s.framebufferHeight,{format:xr,type:Gi,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;tZ(s,l);for(let u=0;u<c.length;u++)tZ(c[u],l);c.length===2?yTe(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),vTe(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new qd,this._controllers[e]=t),t}};function yTe(i,e,t){QY.setFromMatrixPosition(e.matrixWorld),JY.setFromMatrixPosition(t.matrixWorld);let n=QY.distanceTo(JY),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 tZ(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function vTe(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=Ef*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function bTe(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 xm(t.pixelwidth,t.pixelheight,{format:xr,type:Gi,depthTexture:new os(t.pixelwidth,t.pixelheight,t.stencilBuffer?zo:pi,void 0,void 0,void 0,void 0,void 0,void 0,t.stencilBuffer?Qs:ys),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 STe(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 TTe(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 ETe(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 Rr,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 mB=class extends Go{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 yA,this.depthTexture=new os}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"})}},nZ=new Hd,s1=new Oe,c8=new gn,qE=new Zl,HE=new xy,o1=new on,zf=new gn,MTe={[Ao]:ui,[ui]:Ao,[ir]:ir},gB=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=Li,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=jr,this.toneMapping=ks,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new YF,this.contextNode=Qf(),this.library=new nC,this.lighting=new pB,this._samples=c||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new mB(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new vM,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 sb(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:Jd},this.xr=new AB(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 hB(this,n),this._animation=new HF(this,this._nodes,this.info),this._attributes=new XF(n,this.info),this._background=new DO(this,this._nodes),this._geometries=new $F(this._attributes,this.info),this._textures=new rO(this,n,this.info),this._pipelines=new QF(n,this._nodes,this.info),this._bindings=new JF(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new jF(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new tO(this.lighting),this._bundles=new dB,this._renderContexts=new iO(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:nZ,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 tC),x.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,p);let S=t.isArrayCamera?HE:qE;t.isArrayCamera?S.setFromArrayCamera(t):(o1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix(o1,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){Zn('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=Z8,t.modelNormalViewMatrix=K8):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===Z8&&e.modelNormalViewMatrix===K8}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return Zn('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 sM){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of oM){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 sM){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position);for(let t of oM){this.setShaderStage(t);let n=this.flowNodes[t];for(let r of n)e==="generate"?this.flowNode(r):r.build(this);await gL()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=yTe.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 KO(e);else if(t==="vec2"||t==="ivec2"||t==="uvec2")r=new QO(e);else if(t==="vec3"||t==="ivec3"||t==="uvec3")r=new JO(e);else if(t==="vec4"||t==="ivec4"||t==="uvec4")r=new eB(e);else if(t==="color")r=new tB(e);else if(t==="mat2")r=new nB(e);else if(t==="mat3")r=new iB(e);else if(t==="mat4")r=new rB(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")||RZ(this.object).useVelocity===!0}},nC=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}},db=class{constructor(e,t,n=null,r="",s=!1){this.type=e,this.name=t,this.count=n,this.qualifier=r,this.isConst=s}};db.isNodeFunctionInput=!0;var sB=class extends Kf{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},oB=class extends Kf{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:NU(this.light),lightColor:e}}},aB=class extends Kf{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=PU(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=f0.dot(r).mul(.5).add(.5),a=Xn(n,t,o);e.context.irradiance.addAssign(a)}},pb=class extends Kf{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 Ll(n,r,t)}getLightCoord(e){let t=e.getNodeProperties(this),n=t.projectionUV;return n===void 0&&(n=dee(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(NU(s)),c=this.getSpotAttenuation(e,l),u=o.length(),f=DU({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}}},lB=class extends pb{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)}},cB=class extends Kf{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=So(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=Fee(f0,this.lightProbe);e.context.irradiance.addAssign(t)}},bTe=Ae(([i,e])=>{let t=i.abs().sub(e);return Eh(Sr(t,0)).add(Ja(Sr(t.x,t.y),0))}),uB=class extends pb{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=ZC(this.light).mul(e.context.positionWorld||Mh);return Wt(r.w.greaterThan(0),()=>{let s=r.xyz.div(r.w),o=bTe(s.xy.sub(ft(.5)),ft(.5)),a=Nl(-1,ni(1,C7(n)).sub(1));t.assign(FC(o.mul(-2).mul(a)))}),t}},u8=new on,WE=new on,Lv=null,hB=class extends Kf{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;WE.identity(),u8.copy(t.matrixWorld),u8.premultiply(n),WE.extractRotation(u8),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(WE),this.halfHeight.value.applyMatrix4(WE)}setupDirectRectArea(e){let t,n;e.isAvailable("float32Filterable")?(t=ai(Lv.LTC_FLOAT_1),n=ai(Lv.LTC_FLOAT_2)):(t=ai(Lv.LTC_HALF_1),n=ai(Lv.LTC_HALF_2));let{colorNode:r,light:s}=this,o=IU(s);return{lightColor:r,lightPosition:o,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:n}}static setLTC(e){Lv=e}},iC=class{parseFunction(){je("Abstract function.")}},Ab=class{constructor(e,t,n="",r=""){this.type=e,this.inputs=t,this.name=n,this.precision=r}getCode(){je("Abstract function.")}};Ab.isNodeFunction=!0;var wTe=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,STe=/[a-z_0-9]+/ig,JY="#pragma main",TTe=i=>{i=i.trim();let e=i.indexOf(JY),t=e!==-1?i.slice(e+JY.length):i,n=t.match(wTe);if(n!==null&&n.length===5){let r=n[4],s=[],o=null;for(;(o=STe.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 db(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.")},fB=class extends Ab{constructor(e){let{type:t,inputs:n,name:r,precision:s,inputsCode:o,blockCode:a,headerCode:l}=TTe(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}},dB=class extends iC{parseFunction(e){return new fB(e)}},ac=[],zf=[],eZ=Ht(0,"int").setGroup(Zt),pB=class extends Lh{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new nC,this.nodeBuilderCache=new Map,this.callHashCache=new Nh,this.groupsData=new Nh,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===_n.OBJECT)return!0;ac[0]=t,ac[1]=e;let n=this.groupsData.get(ac);return n===void 0&&this.groupsData.set(ac,n={}),ac[0]=null,ac[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 Br(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 UO(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){ac[0]=e,ac[1]=t;let n=this.renderer.info.calls,r=this.callHashCache.get(ac)||{};if(r.callId!==n){if(zf.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),zf.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){zf.push(t.getCacheKey(!0)),zf.push(this.renderer.shadowMap.enabled?1:0),zf.push(this.renderer.shadowMap.type);let o=this.getEnvironmentNode(e);o&&zf.push(o.getCacheKey())}let s=this.getFogNode(e);s&&zf.push(s.getCacheKey()),r.callId=n,r.cacheKey=xb(zf),this.callHashCache.set(ac,r),zf.length=0}return ac[0]=null,ac[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===np||n.mapping===ip||n.mapping===Wu){if(e.backgroundBlurriness>0||n.mapping===Wu)return SU(n);{let o;return n.isCubeTexture===!0?o=Ea(n):o=ai(n),PJ(o)}}else{if(n.isTexture===!0)return ai(n,nu.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=tr("color","color",n).setGroup(Zt),o=tr("density","float",n).setGroup(Zt);return CO(s,fee(o))}else if(n.isFog){let s=tr("color","color",n).setGroup(Zt),o=tr("near","float",n).setGroup(Zt),a=tr("far","float",n).setGroup(Zt);return CO(s,hee(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,nu).depth(ed("gl_ViewID_OVR")).renderOutput(t.toneMapping,t.currentColorSpace):n=ai(e,nu).depth(eZ).renderOutput(t.toneMapping,t.currentColorSpace):n=ai(e,nu).renderOutput(t.toneMapping,t.currentColorSpace),n}setOutputLayerIndex(e){eZ.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 nC,this.nodeBuilderCache=new Map,this.cacheLib={}}},h8=new la,rC=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++){h8.copy(e[s]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let o=t[n+s],a=h8.normal;o.x=-a.x,o.y=-a.y,o.z=-a.z,o.w=h8.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}},AB=class{constructor(e,t,n){this.bundleGroup=e,this.camera=t,this.renderContext=n}},qp=[],mB=class{constructor(){this.bundles=new Nh}get(e,t,n){let r=this.bundles;qp[0]=e,qp[1]=t,qp[2]=n;let s=r.get(qp);return s===void 0&&(s=new AB(e,t,n),r.set(qp,s)),qp[0]=null,qp[1]=null,qp[2]=null,s}dispose(){this.bundles=new Nh}},sC=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)}},ETe=new hb,tZ=new WeakMap,gB=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new hb().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return ETe;let t=tZ.get(e);return t===void 0&&(t=this.createNode(),tZ.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},vm=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}},nZ=new ie,iZ=new ie,rZ=new WeakMap,_B=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 w_,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=NTe.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new Oe,this._onSessionEvent=RTe.bind(this),this._onSessionEnd=PTe.bind(this),this._onInputSourcesChange=ITe.bind(this),this._onAnimationFrame=LTe.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:vi,magFilter:vi,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 EA(e,t),u=new vm(s,o,{format:vr,type:Gi,depthTexture:new ls(s,o,l.stencil?Vo:pi,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?Js:vs),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let f=new as({color:16777215,side:mo});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:mo}),x.plane.material.blending=Nf,x.plane.material.blendEquation=ks,x.plane.material.blendSrc=Hc,x.plane.material.blendDst=Hc,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 wA(e,e,e*t/n,64,64,!0,Math.PI-t/2,t),f=new vm(o,a,{format:vr,type:Gi,depthTexture:new ls(o,a,c.stencil?Vo:pi,void 0,void 0,void 0,void 0,void 0,void 0,c.stencil?Js: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=Nf,v.plane.material.blendEquation=ks,v.plane.material.blendSrc=Hc,v.plane.material.blendDst=Hc,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=rZ.get(l),c===void 0&&(c=l.context({getOutput:f=>Y7(f,n.toneMapping,n.outputColorSpace)}),rZ.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?Js: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 vm(c.textureWidth,c.textureHeight,{format:vr,type:Gi,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:mo}),x.plane.material.blending=Nf,x.plane.material.blendEquation=ks,x.plane.material.blendSrc=Hc,x.plane.material.blendDst=Hc,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 vm(s.framebufferWidth,s.framebufferHeight,{format:vr,type:Gi,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;sZ(s,l);for(let u=0;u<c.length;u++)sZ(c[u],l);c.length===2?MTe(s,o,a):s.projectionMatrix.copy(o.projectionMatrix),CTe(e,s,l)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new Wd,this._controllers[e]=t),t}};function MTe(i,e,t){nZ.setFromMatrixPosition(e.matrixWorld),iZ.setFromMatrixPosition(t.matrixWorld);let n=nZ.distanceTo(iZ),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 sZ(i,e){e===null?i.matrixWorld.copy(i.matrix):i.matrixWorld.multiplyMatrices(e.matrixWorld,i.matrix),i.matrixWorldInverse.copy(i.matrixWorld).invert()}function CTe(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=Mf*2*Math.atan(1/i.projectionMatrix.elements[5]),i.zoom=1)}function RTe(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 PTe(){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 vm(t.pixelwidth,t.pixelheight,{format:vr,type:Gi,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?Js: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 ITe(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 NTe(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 LTe(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 xB=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 bA,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"})}},oZ=new jd,a1=new Oe,f8=new gn,jE=new Kl,XE=new vy,l1=new on,Vf=new gn,DTe={[mo]:ui,[ui]:mo,[ir]:ir},yB=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=Li,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=Gs,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=o,this.stencil=a,this.info=new QF,this.contextNode=Jf(),this.library=new sC,this.lighting=new gB,this._samples=c||l===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new xB(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new SM,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 ab(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:tp},this.xr=new _B(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 pB(this,n),this._animation=new XF(this,this._nodes,this.info),this._attributes=new ZF(n,this.info),this._background=new BO(this,this._nodes),this._geometries=new KF(this._attributes,this.info),this._textures=new aO(this,n,this.info),this._pipelines=new tO(n,this._nodes,this.info),this._bindings=new nO(n,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new YF(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new rO(this.lighting),this._bundles=new mB,this._renderContexts=new oO(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:oZ,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 rC),x.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,p);let S=t.isArrayCamera?XE:jE;t.isArrayCamera?S.setFromArrayCamera(t):(l1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix(l1,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 gL()}}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=J8,t.modelNormalViewMatrix=eF):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===J8&&e.modelNormalViewMatrix===eF}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!==ks,r=t!==sn.workingColorSpace;if(n===!1&&r===!1)return null;let{width:s,height:o}=this.getDrawingBufferSize(s1),{depth:a,stencil:l}=this,c=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(c);if(u===void 0){u=new ca(s,o,{depthBuffer:a,stencilBuffer:l,type:this._outputBufferType,format:xr,colorSpace:sn.workingColorSpace,generateMipmaps:!1,minFilter:vi,magFilter:vi,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:nZ,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(s1),c8.set(0,0,s1.width,s1.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(c8)===!1,w.scissorValue.copy(P).multiplyScalar(R).floor(),w.scissor=S._scissorTest&&w.scissorValue.equals(c8)===!1,w.scissorValue.width>>=x,w.scissorValue.height>>=x,w.clippingContext||(w.clippingContext=new tC),w.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,v);let D=t.isArrayCamera?HE:qE;t.isArrayCamera?D.setFromArrayCamera(t):(o1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix(o1,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=s1.width,w.height=s1.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(zf.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 lb(new pr),r.name="Output Color Transform",r.material.name="outputColorTransform",r.material.fragmentNode=this._nodes.getOutputNode(e.texture),n={quad:r,cacheKey:t},this._quadCache.set(e.texture,n);let a=()=>{r.material.dispose(),this._quadCache.delete(e.texture),e.texture.removeEventListener("dispose",a)};e.texture.addEventListener("dispose",a)}else r=n.quad,n.cacheKey!==t&&(r.material.fragmentNode=this._nodes.getOutputNode(e.texture),r.material.needsUpdate=!0,n.cacheKey=t);let s=this.autoClear,o=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderOutputLayers(r,e),this.autoClear=s,this.xr.enabled=o}getMaxAnisotropy(){return this.backend.capabilities.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){this._initialized===!1&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e,t=null,n=0,r=-1){if(t!==null&&t.isReadbackBuffer&&this.info.memoryMap.has(t)===!1){this.info.createReadbackBuffer(t);let s=()=>{t.removeEventListener("dispose",s),this.info.destroyReadbackBuffer(t)};t.addEventListener("dispose",s)}if(n%4!==0||r>0&&r%4!==0)throw new Error('THREE.Renderer: "getArrayBufferAsync()" offset and count must be a multiple of 4.');return await this.backend.getArrayBufferAsync(e,t,n,r)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,n){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,n)}setSize(e,t,n=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,n)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,n,r){this._canvasTarget.setScissor(e,t,n,r)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,n,r,s=0,o=1){this._canvasTarget.setViewport(e,t,n,r,s,o)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this.reversedDepthBuffer===!0?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){let t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,n=!0){if(this._initialized===!1)throw new Error('THREE.Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before using this method.');let r=this._renderTarget||this._getFrameBufferTarget(),s=null;if(r!==null){this._textures.updateRenderTarget(r);let o=this._textures.get(r);s=this._renderContexts.get(r,null,-1),s.textures=o.textures,s.depthTexture=o.depthTexture,s.width=o.width,s.height=o.height,s.renderTarget=r,s.depth=r.depthBuffer,s.stencil=r.stencilBuffer;let a=this.backend.getClearColor();s.clearColorValue.r=a.r,s.clearColorValue.g=a.g,s.clearColorValue.b=a.b,s.clearColorValue.a=a.a,s.clearDepthValue=this.getClearDepth(),s.clearStencilValue=this.getClearStencil(),s.activeCubeFace=this.getActiveCubeFace(),s.activeMipmapLevel=this.getActiveMipmapLevel(),r.depthBuffer===!0&&(o.depthInitialized=!0)}this.backend.clear(e,t,n,s),r!==null&&this._renderTarget===null&&this._renderOutput(r)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,n=!0){Zn('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(){Zn('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){Zn('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){Zn('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!==ks,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:ks}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 Zn('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){Zn('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=zf.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=zf.copy(t).floor();else{Ge("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=zf.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?HE:qE;if(!e.frustumCulled||l.intersectsSprite(e)){this.sortObjects===!0&&zf.setFromMatrixPosition(e.matrixWorld).applyMatrix4(o1);let{geometry:c,material:u}=e;u.visible&&r.push(e,c,u,n,zf.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?HE:qE;if(!e.frustumCulled||l.intersectsObject(e)){let{geometry:c,material:u}=e;if(this.sortObjects===!0&&(c.boundingSphere===null&&c.computeBoundingSphere(),zf.copy(c.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(o1)),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,zf.z,v,s)}}else u.visible&&r.push(e,c,u,n,zf.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=Ao;this._renderObjects(e,n,r,s);for(let{material:o}of t)o.side=ir}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&&Zn("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(f=pe(0),p=se(1)),r&&(p=p.mul(tr("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===Kl?R.side=s.shadowSide!==null?s.shadowSide:s.side:R.side=s.shadowSide!==null?s.shadowSide:MTe[s.side],C!==null&&(R.colorNode=C),L!==null&&(R.depthNode=L),D!==null&&(R.positionNode=D)}s=R}s.transparent===!0&&s.side===ir&&s.forceSinglePass===!1?(s.side=ui,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=Ao,this._handleObjectFunction(e,s,t,n,a,o,l,c),s.side=ir):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}},iC=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 Lee(i){return i+(Kp-i%Kp)%Kp}var rC=class extends iC{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 Lee(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},sC=class extends rC{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},CTe=0,oC=class extends sC{constructor(e,t){super("UniformBuffer_"+CTe++,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 Lee(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},_B=class extends sC{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%Kp,c=l%o,u=l+c;t+=c,u!==0&&Kp-u<a&&(t+=Kp-u),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/Kp)*Kp}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 PTe(n,r,s)===!1&&(this.buffer.set(r,s),RTe(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 RTe(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function PTe(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}var ITe=0,aC=class extends _B{constructor(e,t){super(e),this.id=ITe++,this.groupNode=t,this.isNodeUniformsGroup=!0}},lC=class extends iC{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}},NTe=0,xB=class extends lC{constructor(e,t){super(e,t),this.id=NTe++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},N1=class extends xB{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()}},cC=class extends N1{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}},pb=class extends N1{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}},iZ={bitcast_int_uint:new Ki("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new Ki("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }"),textureGather:new Ki(`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!==Gs,r=t!==sn.workingColorSpace;if(n===!1&&r===!1)return null;let{width:s,height:o}=this.getDrawingBufferSize(a1),{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:vi,magFilter:vi,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:oZ,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(a1),f8.set(0,0,a1.width,a1.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(f8)===!1,w.scissorValue.copy(P).multiplyScalar(R).floor(),w.scissor=S._scissorTest&&w.scissorValue.equals(f8)===!1,w.scissorValue.width>>=x,w.scissorValue.height>>=x,w.clippingContext||(w.clippingContext=new rC),w.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,v);let D=t.isArrayCamera?XE:jE;t.isArrayCamera?D.setFromArrayCamera(t):(l1.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),D.setFromProjectionMatrix(l1,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=a1.width,w.height=a1.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(Vf.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 ub(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!==Gs,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:Gs}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=Vf.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=Vf.copy(t).floor();else{Ge("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=Vf.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?XE:jE;if(!e.frustumCulled||l.intersectsSprite(e)){this.sortObjects===!0&&Vf.setFromMatrixPosition(e.matrixWorld).applyMatrix4(l1);let{geometry:c,material:u}=e;u.visible&&r.push(e,c,u,n,Vf.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?XE:jE;if(!e.frustumCulled||l.intersectsObject(e)){let{geometry:c,material:u}=e;if(this.sortObjects===!0&&(c.boundingSphere===null&&c.computeBoundingSphere(),Vf.copy(c.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(l1)),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,Vf.z,v,s)}}else u.visible&&r.push(e,c,u,n,Vf.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=mo;this._renderObjects(e,n,r,s);for(let{material:o}of t)o.side=ir}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(tr("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===Jl?R.side=s.shadowSide!==null?s.shadowSide:s.side:R.side=s.shadowSide!==null?s.shadowSide:DTe[s.side],C!==null&&(R.colorNode=C),L!==null&&(R.depthNode=L),D!==null&&(R.positionNode=D)}s=R}s.transparent===!0&&s.side===ir&&s.forceSinglePass===!1?(s.side=ui,this._handleObjectFunction(e,s,t,n,a,o,l,"backSide"),s.side=mo,this._handleObjectFunction(e,s,t,n,a,o,l,c),s.side=ir):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}},oC=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 Bee(i){return i+(Jp-i%Jp)%Jp}var aC=class extends oC{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 Bee(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},lC=class extends aC{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},FTe=0,cC=class extends lC{constructor(e,t){super("UniformBuffer_"+FTe++,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 Bee(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},vB=class extends lC{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%Jp,c=l%o,u=l+c;t+=c,u!==0&&Jp-u<a&&(t+=Jp-u),s.offset=t/e,s.index=n,t+=a}return Math.ceil(t/Jp)*Jp}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 BTe(n,r,s)===!1&&(this.buffer.set(r,s),OTe(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 OTe(i,e,t){for(let n=0,r=e.length;n<r;n++)i[t+n]=e[n]}function BTe(i,e,t){for(let n=0,r=e.length;n<r;n++)if(i[t+n]!==e[n])return!1;return!0}var UTe=0,uC=class extends vB{constructor(e,t){super(e),this.id=UTe++,this.groupNode=t,this.isNodeUniformsGroup=!0}},hC=class extends oC{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}},kTe=0,bB=class extends hC{constructor(e,t){super(e,t),this.id=kTe++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},D1=class extends bB{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()}},fC=class extends D1{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledCubeTexture=!0}},mb=class extends D1{constructor(e,t,n,r=null){super(e,t,n,r),this.isSampledTexture3D=!0}},aZ={bitcast_int_uint:new Ki("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new Ki("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }"),textureGather:new Ki(`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-`)},LTe={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"},rZ={low:"lowp",medium:"mediump",high:"highp"},sZ={swizzleAssign:!0,storageBuffer:!1},oZ={perspective:"smooth",linear:"noperspective"},aZ={centroid:"centroid"},lZ=`4224+`)},GTe={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"},lZ={low:"lowp",medium:"mediump",high:"highp"},cZ={swizzleAssign:!0,storageBuffer:!1},uZ={perspective:"smooth",linear:"noperspective"},hZ={centroid:"centroid"},fZ=`42254225 precision highp float;42264226 precision highp int;42274227 precision highp sampler2D;@@ -4242,20 +4242,20 @@ precision highp isampler2DArray;
42424242 precision highp sampler2DShadow;42434243 precision highp sampler2DArrayShadow;42444244 precision highp samplerCubeShadow;4245-`,yB=class extends QM{constructor(e,t){super(e,t,new uB),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==Vo}_include(e){let t=iZ[e];return t.build(this),this.addInclude(t),t}getMethod(e){return iZ[e]!==void 0&&this._include(e),LTe[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+`,wB=class extends tC{constructor(e,t){super(e,t,new dB),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==qo}_include(e){let t=aZ[e];return t.build(this),this.addInclude(t),t}getMethod(e){return aZ[e]!==void 0&&this._include(e),GTe[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?Xu:Lf;s===2?a=o?$u:Ss:s===3?a=o?m2:Nf:s===4&&(a=o?ip:xr);let l={Float32Array:Yi,Uint8Array:Gi,Uint16Array:Wa,Uint32Array:pi,Int8Array:Wu,Int16Array:ju,Int32Array:Ir,Uint8ClampedArray:Gi},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 xA(t.array,c,u,a,l[t.array.constructor.name]||Yi);x.needsUpdate=!0,x.isPBOTexture=!0;let v=new Ac(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="."+Om.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===Ir&&(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===Ir&&(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?$u:Df;s===2?a=o?Yu:Ts:s===3?a=o?_2:Lf:s===4&&(a=o?sp:vr);let l={Float32Array:Yi,Uint8Array:Gi,Uint16Array:ja,Uint32Array:pi,Int8Array:ju,Int16Array:Xu,Int32Array:Lr,Uint8ClampedArray:Gi},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 vA(t.array,c,u,a,l[t.array.constructor.name]||Yi);x.needsUpdate=!0,x.isPBOTexture=!0;let v=new gc(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="."+Um.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===Lr&&(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===Lr&&(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=rZ[w]+" "+S),f.push(" "+S)}r[c]=f}}l=!0}if(!l){let c=o.node.precision;c!==null&&(a=rZ[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=lZ[w]+" "+S),f.push(" "+S)}r[c]=f}}l=!0}if(!l){let c=o.node.precision;c!==null&&(a=lZ[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(`4258-`),s}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==Ir){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};4258+`),s}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==Lr){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};42594259 `}return t}getStructMembers(e){let t=[];for(let n of e.members)t.push(` ${n.type} ${n.name};`);return t.join(`42604260 `)}getStructs(e){let t=[],n=this.structs[e],r=[];for(let s of n)if(s.output)for(let o of s.members)r.push(`layout( location = ${o.index} ) out ${o.type} ${o.name};`);else{let o="struct "+s.name+` {42614261 `;o+=this.getStructMembers(s),o+=`@@ -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=oZ[r.interpolationType]||r.interpolationType,a=aZ[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=uZ[r.interpolationType]||r.interpolationType,a=hZ[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=oZ[r.interpolationType]||r.interpolationType,a=aZ[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=uZ[r.interpolationType]||r.interpolationType,a=hZ[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=sZ[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)}sZ[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=cZ[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)}cZ[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-${lZ}4287+${fZ}42884288 42894289 // structs42904290 ${e.structs}@@ -4323,7 +4323,7 @@ ${this.getSignature()}
43234323 ${e.extensions}43244324 43254325 // precision4326-${lZ}4326+${fZ}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 N1(s.name,s.node,l),u.push(a);else if(t==="cubeTexture"||t==="cubeDepthTexture")a=new cC(s.name,s.node,l),u.push(a);else if(t==="texture3D")a=new pb(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 oC(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}},u8=null,a1=null,uC=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[ec.RENDER]:null,[ec.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:")?ec.COMPUTE:ec.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){Zn("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 u8=u8||new Oe,this.renderer.getDrawingBufferSize(u8)}setScissorTest(){}getClearColor(){let e=this.renderer;return a1=a1||new sb,e.getClearColor(a1),a1.getRGB(a1),a1}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:$T(),"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(){}},DTe=0,vB=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}},bB=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===Ir,id:DTe++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let p=this._createBuffer(r,t,s,o);f=new vB(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}},Nv,Vf,wB=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;Nv={[Bs]:e.FUNC_ADD,[Qy]:e.FUNC_SUBTRACT,[Jy]:e.FUNC_REVERSE_SUBTRACT},Vf={[qc]:e.ZERO,[e2]:e.ONE,[t2]:e.SRC_COLOR,[Ud]:e.SRC_ALPHA,[a2]:e.SRC_ALPHA_SATURATE,[s2]:e.DST_COLOR,[i2]:e.DST_ALPHA,[n2]:e.ONE_MINUS_SRC_COLOR,[kd]:e.ONE_MINUS_SRC_ALPHA,[o2]:e.ONE_MINUS_DST_COLOR,[r2]: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!==UT?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===Zy?t.cullFace(t.BACK):e===kT?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){Zn("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===Ky?l=n:c.blending!==$r&&(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===If){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,Nv[l],Nv[p]),r.blendFuncSeparateiOES(e,Vf[o],Vf[a],Vf[u],Vf[f])}else if(r.blendEquationSeparateiOES(e,n.FUNC_ADD,n.FUNC_ADD),c)switch(s){case ss:r.blendFuncSeparateiOES(e,n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case zu:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case Vu:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case qu: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 ss:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case zu:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Vu:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case qu: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===$r){this.currentBlendingEnabled===!0&&(this.disable(c.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(c.BLEND),this.currentBlendingEnabled=!0),e!==If){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==Bs||this.currentBlendEquationAlpha!==Bs)&&(c.blendEquation(c.FUNC_ADD),this.currentBlendEquation=Bs,this.currentBlendEquationAlpha=Bs),l)switch(e){case ss:c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case zu:c.blendFunc(c.ONE,c.ONE);break;case Vu:c.blendFuncSeparate(c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ZERO,c.ONE);break;case qu: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 ss:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case zu:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE,c.ONE,c.ONE);break;case Vu:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case qu: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(Nv[t],Nv[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(c.blendFuncSeparate(Vf[n],Vf[r],Vf[o],Vf[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=b2[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case lA:t.depthFunc(t.NEVER);break;case cA:t.depthFunc(t.ALWAYS);break;case uA:t.depthFunc(t.LESS);break;case Bu:t.depthFunc(t.LEQUAL);break;case hA:t.depthFunc(t.EQUAL);break;case fA:t.depthFunc(t.GEQUAL);break;case dA:t.depthFunc(t.GREATER);break;case pA: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===ir?this.disable(r.CULL_FACE):this.enable(r.CULL_FACE);let s=e.side===ui;t&&(s=!s),this.setFlipSided(s),e.blending===ss&&e.transparent===!1?this.setBlending($r):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)}},SB=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=Vo){let{gl:n,extensions:r}=this,s,o=sn.getTransfer(t);if(e===Gi)return n.UNSIGNED_BYTE;if(e===IA)return n.UNSIGNED_SHORT_4_4_4_4;if(e===NA)return n.UNSIGNED_SHORT_5_5_5_1;if(e===LA)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===DA)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===Wu)return n.BYTE;if(e===ju)return n.SHORT;if(e===Wa)return n.UNSIGNED_SHORT;if(e===Ir)return n.INT;if(e===pi)return n.UNSIGNED_INT;if(e===Yi)return n.FLOAT;if(e===Li)return n.HALF_FLOAT;if(e===S_)return n.ALPHA;if(e===Nf)return n.RGB;if(e===xr)return n.RGBA;if(e===ys)return n.DEPTH_COMPONENT;if(e===Qs)return n.DEPTH_STENCIL;if(e===Lf)return n.RED;if(e===Xu)return n.RED_INTEGER;if(e===Ss)return n.RG;if(e===$u)return n.RG_INTEGER;if(e===ip)return n.RGBA_INTEGER;if(e===Yu||e===Zu||e===Ku||e===Qu)if(o===Bt)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===Yu)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Zu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===Ku)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===Qu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===Yu)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Zu)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Ku)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Qu)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===FA||e===OA||e===BA||e===UA)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===FA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===OA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===BA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===UA)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===rp||e===sp||e===op||e===ap||e===lp||e===Ju||e===cp)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===rp||e===sp)return o===Bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===op)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===ap)return s.COMPRESSED_R11_EAC;if(e===lp)return s.COMPRESSED_SIGNED_R11_EAC;if(e===Ju)return s.COMPRESSED_RG11_EAC;if(e===cp)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===up||e===hp||e===fp||e===dp||e===pp||e===Ap||e===mp||e===gp||e===_p||e===xp||e===yp||e===vp||e===bp||e===wp)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===up)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===hp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===fp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===dp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===Ap)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===gp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===_p)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===xp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===yp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===vp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===bp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===wp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===Sp||e===Tp||e===Ep)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===Sp)return o===Bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===Tp)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===Ep)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===Mp||e===Cp||e===eh||e===Rp)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===Mp)return s.COMPRESSED_RED_RGTC1_EXT;if(e===Cp)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===eh)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===Rp)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===zo?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()})}},cZ=!1,WE,h8,uZ,TB=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,cZ===!1&&(this._init(),cZ=!0)}_init(){let e=this.gl;WE={[Sf]:e.REPEAT,[ko]:e.CLAMP_TO_EDGE,[Tf]:e.MIRRORED_REPEAT},h8={[xi]:e.NEAREST,[A2]:e.NEAREST_MIPMAP_NEAREST,[Jl]:e.NEAREST_MIPMAP_LINEAR,[vi]:e.LINEAR,[np]:e.LINEAR_MIPMAP_NEAREST,[go]:e.LINEAR_MIPMAP_LINEAR},uZ={[_2]:e.NEVER,[v2]:e.ALWAYS,[T_]:e.LESS,[th]:e.LEQUAL,[x2]:e.EQUAL,[Hc]:e.GEQUAL,[kA]:e.GREATER,[y2]: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===Vo?null:sn.getPrimaries(t.colorSpace),c=t.colorSpace===Vo||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,WE[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,WE[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,WE[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,h8[t.magFilter]);let u=t.mipmaps!==void 0&&t.mipmaps.length>0,f=t.minFilter===vi&&u?go:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,h8[f]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,uZ[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===xi||t.minFilter!==Jl&&t.minFilter!==go||t.type===Yi&&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=jE(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=jE(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=w2(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=jE(v);n.texSubImage2D(a,p,0,0,v.width,v.height,l,c,w)}else{let p=jE(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 jE(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 EB=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)}},MB=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}},hZ={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"},CB=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)}}},hC=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(){}},RB=class extends hC{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 Zn(`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}}},fC=class extends uC{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 EB(this),this.capabilities=new MB(this),this.attributeUtils=new bB(this),this.textureUtils=new TB(this),this.bufferRenderer=new CB(this),this.state=new wB(this),this.utils=new SB(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 po}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 RB(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(ec.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(ec.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(ec.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)?(Zn("WebGLBackend.compute(): The count parameter must be a single number, not an array."),s=s[0]):s&&typeof s=="object"&&s.isIndirectStorageBufferAttribute&&(Zn("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(ec.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 yB(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 D1(s.name,s.node,l),u.push(a);else if(t==="cubeTexture"||t==="cubeDepthTexture")a=new fC(s.name,s.node,l),u.push(a);else if(t==="texture3D")a=new mb(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 cC(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 uC(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}},d8=null,c1=null,dC=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[nc.RENDER]:null,[nc.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:")?nc.COMPUTE:nc.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 d8=d8||new Oe,this.renderer.getDrawingBufferSize(d8)}setScissorTest(){}getClearColor(){let e=this.renderer;return c1=c1||new ab,e.getClearColor(c1),c1.getRGB(c1),c1}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:KT(),"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(){}},zTe=0,SB=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}},TB=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===Lr,id:zTe++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let p=this._createBuffer(r,t,s,o);f=new SB(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}},Dv,qf,EB=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;Dv={[ks]:e.FUNC_ADD,[e2]:e.FUNC_SUBTRACT,[t2]:e.FUNC_REVERSE_SUBTRACT},qf={[Hc]:e.ZERO,[n2]:e.ONE,[i2]:e.SRC_COLOR,[Gd]:e.SRC_ALPHA,[c2]:e.SRC_ALPHA_SATURATE,[a2]:e.DST_COLOR,[s2]:e.DST_ALPHA,[r2]:e.ONE_MINUS_SRC_COLOR,[zd]:e.ONE_MINUS_SRC_ALPHA,[l2]:e.ONE_MINUS_DST_COLOR,[o2]: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!==zT?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===Qy?t.cullFace(t.BACK):e===VT?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===Jy?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===Nf){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,Dv[l],Dv[p]),r.blendFuncSeparateiOES(e,qf[o],qf[a],qf[u],qf[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 Vu:r.blendFuncSeparateiOES(e,n.ONE,n.ONE,n.ONE,n.ONE);break;case qu:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Hu: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 Vu:r.blendFuncSeparateiOES(e,n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case qu:r.blendFuncSeparateiOES(e,n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Hu: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!==Nf){if(e!==this.currentBlending||l!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==ks||this.currentBlendEquationAlpha!==ks)&&(c.blendEquation(c.FUNC_ADD),this.currentBlendEquation=ks,this.currentBlendEquationAlpha=ks),l)switch(e){case os:c.blendFuncSeparate(c.ONE,c.ONE_MINUS_SRC_ALPHA,c.ONE,c.ONE_MINUS_SRC_ALPHA);break;case Vu:c.blendFunc(c.ONE,c.ONE);break;case qu:c.blendFuncSeparate(c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ZERO,c.ONE);break;case Hu: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 Vu:c.blendFuncSeparate(c.SRC_ALPHA,c.ONE,c.ONE,c.ONE);break;case qu:Ge("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Hu: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(Dv[t],Dv[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(n!==this.currentBlendSrc||r!==this.currentBlendDst||o!==this.currentBlendSrcAlpha||a!==this.currentBlendDstAlpha)&&(c.blendFuncSeparate(qf[n],qf[r],qf[o],qf[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=S2[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case uA:t.depthFunc(t.NEVER);break;case hA:t.depthFunc(t.ALWAYS);break;case fA:t.depthFunc(t.LESS);break;case Uu:t.depthFunc(t.LEQUAL);break;case dA:t.depthFunc(t.EQUAL);break;case pA:t.depthFunc(t.GEQUAL);break;case AA:t.depthFunc(t.GREATER);break;case mA: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===ir?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)}},MB=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===Gi)return n.UNSIGNED_BYTE;if(e===LA)return n.UNSIGNED_SHORT_4_4_4_4;if(e===DA)return n.UNSIGNED_SHORT_5_5_5_1;if(e===FA)return n.UNSIGNED_INT_5_9_9_9_REV;if(e===OA)return n.UNSIGNED_INT_10F_11F_11F_REV;if(e===ju)return n.BYTE;if(e===Xu)return n.SHORT;if(e===ja)return n.UNSIGNED_SHORT;if(e===Lr)return n.INT;if(e===pi)return n.UNSIGNED_INT;if(e===Yi)return n.FLOAT;if(e===Li)return n.HALF_FLOAT;if(e===E_)return n.ALPHA;if(e===Lf)return n.RGB;if(e===vr)return n.RGBA;if(e===vs)return n.DEPTH_COMPONENT;if(e===Js)return n.DEPTH_STENCIL;if(e===Df)return n.RED;if(e===$u)return n.RED_INTEGER;if(e===Ts)return n.RG;if(e===Yu)return n.RG_INTEGER;if(e===sp)return n.RGBA_INTEGER;if(e===Zu||e===Ku||e===Qu||e===Ju)if(o===Bt)if(s=r.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(e===Zu)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Ku)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===Qu)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===Ju)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=r.get("WEBGL_compressed_texture_s3tc"),s!==null){if(e===Zu)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Ku)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Qu)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Ju)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===BA||e===UA||e===kA||e===GA)if(s=r.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(e===BA)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===UA)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===kA)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===GA)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===op||e===ap||e===lp||e===cp||e===up||e===eh||e===hp)if(s=r.get("WEBGL_compressed_texture_etc"),s!==null){if(e===op||e===ap)return o===Bt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===lp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===cp)return s.COMPRESSED_R11_EAC;if(e===up)return s.COMPRESSED_SIGNED_R11_EAC;if(e===eh)return s.COMPRESSED_RG11_EAC;if(e===hp)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===fp||e===dp||e===pp||e===Ap||e===mp||e===gp||e===_p||e===xp||e===yp||e===vp||e===bp||e===wp||e===Sp||e===Tp)if(s=r.get("WEBGL_compressed_texture_astc"),s!==null){if(e===fp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===dp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===pp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===Ap)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===mp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===gp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===_p)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===xp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===yp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===vp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===bp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===wp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===Sp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===Tp)return o===Bt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===Ep||e===Mp||e===Cp)if(s=r.get("EXT_texture_compression_bptc"),s!==null){if(e===Ep)return o===Bt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===Mp)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===Cp)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===Rp||e===Pp||e===th||e===Ip)if(s=r.get("EXT_texture_compression_rgtc"),s!==null){if(e===Rp)return s.COMPRESSED_RED_RGTC1_EXT;if(e===Pp)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===th)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===Ip)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()})}},dZ=!1,$E,p8,pZ,CB=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,dZ===!1&&(this._init(),dZ=!0)}_init(){let e=this.gl;$E={[Tf]:e.REPEAT,[Go]:e.CLAMP_TO_EDGE,[Ef]:e.MIRRORED_REPEAT},p8={[xi]:e.NEAREST,[g2]:e.NEAREST_MIPMAP_NEAREST,[tc]:e.NEAREST_MIPMAP_LINEAR,[vi]:e.LINEAR,[rp]:e.LINEAR_MIPMAP_NEAREST,[_o]:e.LINEAR_MIPMAP_LINEAR},pZ={[y2]:e.NEVER,[w2]:e.ALWAYS,[M_]:e.LESS,[nh]:e.LEQUAL,[v2]:e.EQUAL,[Wc]:e.GEQUAL,[zA]:e.GREATER,[b2]: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?qd: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?qd: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,$E[t.wrapS]),n.texParameteri(e,n.TEXTURE_WRAP_T,$E[t.wrapT]),(e===n.TEXTURE_3D||e===n.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||n.texParameteri(e,n.TEXTURE_WRAP_R,$E[t.wrapR])),n.texParameteri(e,n.TEXTURE_MAG_FILTER,p8[t.magFilter]);let u=t.mipmaps!==void 0&&t.mipmaps.length>0,f=t.minFilter===vi&&u?_o:t.minFilter;if(n.texParameteri(e,n.TEXTURE_MIN_FILTER,p8[f]),t.compareFunction&&(n.texParameteri(e,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(e,n.TEXTURE_COMPARE_FUNC,pZ[t.compareFunction])),r.has("EXT_texture_filter_anisotropic")===!0){if(t.magFilter===xi||t.minFilter!==tc&&t.minFilter!==_o||t.type===Yi&&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=YE(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=YE(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=T2(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=YE(v);n.texSubImage2D(a,p,0,0,v.width,v.height,l,c,w)}else{let p=YE(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 YE(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 RB=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)}},PB=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}},AZ={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"},IB=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)}}},pC=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(){}},NB=class extends pC{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}}},AC=class extends dC{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 RB(this),this.capabilities=new PB(this),this.attributeUtils=new TB(this),this.textureUtils=new CB(this),this.bufferRenderer=new IB(this),this.state=new EB(this),this.utils=new MB(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 Ao}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 NB(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(nc.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(nc.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(nc.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(nc.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 wB(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=E_(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=E_(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(hZ).filter(r=>hZ[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===Df.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=GJ(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)}},Gv={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},Ch=typeof self<"u"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},vo={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},wa={Store:"store"},Ei={Load:"load",Clear:"clear"},fZ={CCW:"ccw",CW:"cw"},dZ={None:"none",Back:"back"},dC={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"},f8={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},ac={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"},hm={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},pZ={None:0,All:15},Vp={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},d8={Storage:"storage",ReadOnlyStorage:"read-only-storage"},p8={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},AZ={NonFiltering:"non-filtering",Comparison:"comparison"},fm={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},mZ={TwoD:"2d",ThreeD:"3d"},bo={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},FTe={All:"all"},XE={Vertex:"vertex",Instance:"instance"},pC={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"},gZ={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"},PB=class extends lC{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()}},IB=class extends rC{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},OTe=0,NB=class extends IB{constructor(e,t){super("StorageBuffer_"+OTe++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:So.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},A8=[null],LB=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 Gv.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return Gv.LineList;if(e.isLine)return Gv.LineStrip;if(e.isMesh)return Gv.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===Gi)return he.BGRA8Unorm;if(t===Li)return he.RGBA16Float;throw new Error("THREE.WebGPUUtils: Unsupported output buffer type.")}};function bh(i,e){A8[0]=e,i.queue.submit(A8),A8[0]=null}var AC=class{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}},o0=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}},Fm=class{constructor(){this.label=""}reset(){this.label=""}},mC=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}},Tm=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}},Em=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}},gC=class{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new DB,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},DB=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},_C=class{constructor(){this.label="",this.code="",this.compilationHints=[]}reset(){this.label="",this.code="",this.compilationHints.length=0}},Ab=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}},mb=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"}},qp=new AC,Hp=new o0,$E=new Fm,m8=new mC,g8=new Em,l1=new gC,Lv=new Tm,YE=new _C,c1=new Ab,Qr=new mb,FB=class extends Nh{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=C_(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=C_(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(AZ).filter(r=>AZ[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===Ff.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=HJ(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)}},Vv={PointList:"point-list",LineList:"line-list",LineStrip:"line-strip",TriangleList:"triangle-list"},Rh=typeof self<"u"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},bo={Never:"never",Less:"less",Equal:"equal",LessEqual:"less-equal",Greater:"greater",NotEqual:"not-equal",GreaterEqual:"greater-equal",Always:"always"},Sa={Store:"store"},Ei={Load:"load",Clear:"clear"},mZ={CCW:"ccw",CW:"cw"},gZ={None:"none",Back:"back"},mC={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"},A8={ClampToEdge:"clamp-to-edge",Repeat:"repeat",MirrorRepeat:"mirror-repeat"},cc={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"},dm={Add:"add",Subtract:"subtract",ReverseSubtract:"reverse-subtract",Min:"min",Max:"max"},_Z={None:0,All:15},Hp={Keep:"keep",Zero:"zero",Replace:"replace",Invert:"invert",IncrementClamp:"increment-clamp",DecrementClamp:"decrement-clamp",IncrementWrap:"increment-wrap",DecrementWrap:"decrement-wrap"},m8={Storage:"storage",ReadOnlyStorage:"read-only-storage"},g8={WriteOnly:"write-only",ReadOnly:"read-only",ReadWrite:"read-write"},xZ={NonFiltering:"non-filtering",Comparison:"comparison"},pm={Float:"float",UnfilterableFloat:"unfilterable-float",Depth:"depth",SInt:"sint",UInt:"uint"},yZ={TwoD:"2d",ThreeD:"3d"},wo={TwoD:"2d",TwoDArray:"2d-array",Cube:"cube",ThreeD:"3d"},VTe={All:"all"},ZE={Vertex:"vertex",Instance:"instance"},gC={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"},vZ={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"},LB=class extends hC{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()}},DB=class extends aC{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},qTe=0,FB=class extends DB{constructor(e,t){super("StorageBuffer_"+qTe++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:To.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},_8=[null],OB=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 Vv.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return Vv.LineList;if(e.isLine)return Vv.LineStrip;if(e.isMesh)return Vv.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===Gi)return he.BGRA8Unorm;if(t===Li)return he.RGBA16Float;throw new Error("THREE.WebGPUUtils: Unsupported output buffer type.")}};function wh(i,e){_8[0]=e,i.queue.submit(_8),_8[0]=null}var _C=class{constructor(){this.label="",this.layout=null,this.entries=[]}reset(){this.label="",this.layout=null,this.entries.length=0}},l0=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}},Bm=class{constructor(){this.label=""}reset(){this.label=""}},xC=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}},Mm=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}},Cm=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}},yC=class{constructor(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new BB,this.fragment=null}reset(){this.label="",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},BB=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},vC=class{constructor(){this.label="",this.code="",this.compilationHints=[]}reset(){this.label="",this.code="",this.compilationHints.length=0}},gb=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}},_b=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"}},Wp=new _C,jp=new l0,KE=new Bm,x8=new xC,y8=new Cm,u1=new yC,Fv=new Mm,QE=new vC,h1=new gb,Jr=new _b,UB=class extends Lh{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:ac.Linear}),this.flipYSampler=e.createSampler({minFilter:ac.Nearest}),Hp.size=4,Hp.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(Hp),Hp.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),Hp.size=4,Hp.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(Hp),Hp.reset(),this.transferPipelines={},YE.label="mipmap",YE.code=t,this.mipmapShaderModule=e.createShaderModule(YE),YE.reset()}getTransferPipeline(e,t){t=t||"2d-array";let n=`${e}-${t}`,r=this.transferPipelines[n];return r===void 0&&(l1.label=`mipmap-${e}-${t}`,l1.vertex={module:this.mipmapShaderModule},l1.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},l1.layout="auto",r=this.device.createRenderPipeline(l1),l1.reset(),this.transferPipelines[n]=r),r}flipY(e,t,n=0){let r=t.format,{width:s,height:o}=t.size;c1.size.width=s,c1.size.height=o,c1.format=r,c1.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let a=this.device.createTexture(c1);c1.reset();let l=this.getTransferPipeline(r,e.textureBindingViewDimension),c=this.getTransferPipeline(r,a.textureBindingViewDimension),u=this.device.createCommandEncoder($E),f=(p,x,v,w,S,T)=>{let P=p.getBindGroupLayout(0);Qr.dimension=x.textureBindingViewDimension||"2d-array",Qr.mipLevelCount=1;let R=x.createView(Qr);Qr.reset(),qp.layout=P,qp.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(qp);qp.reset(),Qr.dimension="2d",Qr.mipLevelCount=1,Qr.baseArrayLayer=S,Qr.arrayLayerCount=1;let L=w.createView(Qr);Qr.reset(),Lv.view=L,Lv.loadOp=Ei.Clear,Lv.storeOp=wa.Store,g8.colorAttachments.push(Lv);let D=u.beginRenderPass(g8);g8.reset(),Lv.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),bh(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&&($E.label="mipmapEncoder",s=this.device.createCommandEncoder($E),$E.reset()),this._mipmapRunBundles(s,r),t===null&&bh(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++){Qr.dimension=t,Qr.baseMipLevel=o-1,Qr.mipLevelCount=1;let l=e.createView(Qr);Qr.reset(),qp.layout=r,qp.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:l},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let c=this.device.createBindGroup(qp);qp.reset(),Qr.dimension="2d",Qr.baseMipLevel=o,Qr.mipLevelCount=1,Qr.baseArrayLayer=a,Qr.arrayLayerCount=1;let u=e.createView(Qr);Qr.reset();let f=new Tm;f.view=u,f.loadOp=Ei.Clear,f.storeOp=wa.Store;let p=new Em;p.colorAttachments.push(f),m8.colorFormats=[e.format];let x=this.device.createRenderBundleEncoder(m8);m8.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()}}},OB=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}},L1=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"}},BB=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}},UB=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}},kB=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}},GB=class extends L1{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}},xC=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},ZE=new o0,BTe=new Fm,jo=new OB,Zo=new L1,KE=new BB,jf=new UB,QE=new kB,u1=new GB,Wp=new Ab,$o=new xC,UTe={[_2]:"never",[T_]:"less",[x2]:"equal",[th]:"less-equal",[kA]:"greater",[Hc]:"greater-equal",[v2]:"always",[y2]:"not-equal"},kTe=[0,1,3,2,4,5];function _Z(i,e,t,n,r,s,o,a,l,c){Zo.texture=e,Zo.mipLevel=t,Zo.origin.z=n,jf.offset=n*s,jf.bytesPerRow=o,jf.rowsPerImage=a,$o.width=l,$o.height=c,i.queue.writeTexture(Zo,r.data,jf,$o),Zo.reset(),jf.reset(),$o.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){jo.addressModeU=this._convertAddressMode(n.wrapS),jo.addressModeV=this._convertAddressMode(n.wrapT),jo.addressModeW=this._convertAddressMode(n.wrapR),jo.magFilter=this._convertFilterMode(n.magFilter),jo.minFilter=this._convertFilterMode(n.minFilter),jo.mipmapFilter=this._convertMipmapFilterMode(n.minFilter),n.isDepthTexture&&(n.compareFunction===null||r.compareNode===null)&&(jo.magFilter=ac.Nearest,jo.minFilter=ac.Nearest,jo.mipmapFilter=ac.Nearest),jo.magFilter===ac.Linear&&jo.minFilter===ac.Linear&&jo.mipmapFilter===ac.Linear&&(jo.maxAnisotropy=n.anisotropy),n.isDepthTexture&&n.compareFunction!==null&&r.compareNode!==null&&t.hasCompatibility(Df.TEXTURE_COMPARE)&&(jo.compare=UTe[n.compareFunction]);let l=t.device.createSampler(jo);jo.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=VB(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||VB(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 Ab;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=bo.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(),Wp.label="colorBuffer",Wp.size.width=n,Wp.size.height=r,Wp.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),Wp.format=e.utils.getPreferredCanvasFormat(),Wp.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,l=e.device.createTexture(Wp),Wp.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=Qs,f=n.renderer.reversedDepthBuffer===!0?Yi:zo):e&&(u=ys,f=n.renderer.reversedDepthBuffer===!0?Yi: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,ZE.size=(s-1)*p+r*f,ZE.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let x=a.createBuffer(ZE);ZE.reset();let v=a.createCommandEncoder(BTe);Zo.texture=c,Zo.origin.x=t,Zo.origin.y=n,Zo.origin.z=o,KE.buffer=x,KE.bytesPerRow=p,$o.width=r,$o.height=s,v.copyTextureToBuffer(Zo,KE,$o),Zo.reset(),KE.reset(),$o.reset();let w=this._getTypedArrayType(u);bh(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 bs;n.minFilter=xi,n.magFilter=xi,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 Uu;n.minFilter=xi,n.magFilter=xi,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?kTe[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;QE.source=e,QE.flipY=s,u1.texture=t,u1.mipLevel=a,u1.origin.z=r,u1.premultipliedAlpha=o,$o.width=c,$o.height=u;try{l.queue.copyExternalImageToTexture(QE,u1,$o)}catch{}finally{QE.reset(),u1.reset(),$o.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new FB(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;Zo.texture=t,Zo.mipLevel=a,Zo.origin.z=r,jf.offset=e.width*e.height*u*o,jf.bytesPerRow=f,$o.width=e.width,$o.height=e.height,l.queue.writeTexture(Zo,c,jf,$o),Zo.reset(),jf.reset(),$o.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)_Z(s,t,c,R,u,S,v,w,T,P);else for(let R=0;R<x;R++)_Z(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=f8.ClampToEdge;return e===Sf?t=f8.Repeat:e===Tf&&(t=f8.MirrorRepeat),t}_convertFilterMode(e){let t=ac.Linear;return(e===xi||e===A2||e===Jl)&&(t=ac.Nearest),t}_convertMipmapFilterMode(e){return e===Jl||e===go?ac.Linear:ac.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=mZ.ThreeD:t=mZ.TwoD,t}};function VB(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(pC.TextureFormatsTier1),l===!1&&je("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case Yu:case Zu:a=o===Bt?he.BC1RGBAUnormSRGB:he.BC1RGBAUnorm;break;case Ku:a=o===Bt?he.BC2RGBAUnormSRGB:he.BC2RGBAUnorm;break;case Qu:a=o===Bt?he.BC3RGBAUnormSRGB:he.BC3RGBAUnorm;break;case Mp:a=he.BC4RUnorm;break;case Cp:a=he.BC4RSnorm;break;case eh:a=he.BC5RGUnorm;break;case Rp:a=he.BC5RGSnorm;break;case Sp:a=o===Bt?he.BC7RGBAUnormSRGB:he.BC7RGBAUnorm;break;case Tp:a=he.BC6HRGBFloat;break;case Ep:a=he.BC6HRGBUFloat;break;case sp:case rp:a=o===Bt?he.ETC2RGB8UnormSRGB:he.ETC2RGB8Unorm;break;case op:a=o===Bt?he.ETC2RGBA8UnormSRGB:he.ETC2RGBA8Unorm;break;case ap:a=he.EACR11Unorm;break;case lp:a=he.EACR11Snorm;break;case Ju:a=he.EACRG11Unorm;break;case cp:a=he.EACRG11Snorm;break;case up:a=o===Bt?he.ASTC4x4UnormSRGB:he.ASTC4x4Unorm;break;case hp:a=o===Bt?he.ASTC5x4UnormSRGB:he.ASTC5x4Unorm;break;case fp:a=o===Bt?he.ASTC5x5UnormSRGB:he.ASTC5x5Unorm;break;case dp:a=o===Bt?he.ASTC6x5UnormSRGB:he.ASTC6x5Unorm;break;case pp:a=o===Bt?he.ASTC6x6UnormSRGB:he.ASTC6x6Unorm;break;case Ap:a=o===Bt?he.ASTC8x5UnormSRGB:he.ASTC8x5Unorm;break;case mp:a=o===Bt?he.ASTC8x6UnormSRGB:he.ASTC8x6Unorm;break;case gp:a=o===Bt?he.ASTC8x8UnormSRGB:he.ASTC8x8Unorm;break;case _p:a=o===Bt?he.ASTC10x5UnormSRGB:he.ASTC10x5Unorm;break;case xp:a=o===Bt?he.ASTC10x6UnormSRGB:he.ASTC10x6Unorm;break;case yp:a=o===Bt?he.ASTC10x8UnormSRGB:he.ASTC10x8Unorm;break;case vp:a=o===Bt?he.ASTC10x10UnormSRGB:he.ASTC10x10Unorm;break;case bp:a=o===Bt?he.ASTC12x10UnormSRGB:he.ASTC12x10Unorm;break;case wp:a=o===Bt?he.ASTC12x12UnormSRGB:he.ASTC12x12Unorm;break;case xr:a=o===Bt?he.RGBA8UnormSRGB:he.RGBA8Unorm;break;default:Ge("WebGPURenderer: Unsupported texture format.",t)}else switch(t){case xr:switch(n){case Wu:a=he.RGBA8Snorm;break;case ju:a=l?he.RGBA16Snorm:he.RGBA16Sint;break;case Wa:a=l?he.RGBA16Unorm:he.RGBA16Uint;break;case pi:a=he.RGBA32Uint;break;case Ir:a=he.RGBA32Sint;break;case Gi:a=o===Bt?he.RGBA8UnormSRGB:he.RGBA8Unorm;break;case Li:a=he.RGBA16Float;break;case Yi:a=he.RGBA32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case Nf:switch(n){case LA:a=he.RGB9E5UFloat;break;case DA:a=he.RG11B10UFloat;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Lf:switch(n){case Wu:a=he.R8Snorm;break;case ju:a=l?he.R16Snorm:he.R16Sint;break;case Wa:a=l?he.R16Unorm:he.R16Uint;break;case pi:a=he.R32Uint;break;case Ir:a=he.R32Sint;break;case Gi:a=he.R8Unorm;break;case Li:a=he.R16Float;break;case Yi:a=he.R32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case Ss:switch(n){case Wu:a=he.RG8Snorm;break;case ju:a=l?he.RG16Snorm:he.RG16Sint;break;case Wa:a=l?he.RG16Unorm:he.RG16Uint;break;case pi:a=he.RG32Uint;break;case Ir:a=he.RG32Sint;break;case Gi:a=he.RG8Unorm;break;case Li:a=he.RG16Float;break;case Yi:a=he.RG32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case ys:switch(n){case Wa:a=he.Depth16Unorm;break;case pi:a=he.Depth24Plus;break;case Yi:a=he.Depth32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case Qs:switch(n){case zo:a=he.Depth24PlusStencil8;break;case Yi:e&&e.features.has(pC.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 Xu:switch(n){case Ir:a=he.R32Sint;break;case pi:a=he.R32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case $u:switch(n){case Ir:a=he.RG32Sint;break;case pi:a=he.RG32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case ip:switch(n){case Ir: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 GTe=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,zTe=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,xZ={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"},VTe=i=>{i=i.trim();let e=i.match(GTe);if(e!==null&&e.length===4){let t=e[2],n=[],r=null;for(;(r=zTe.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=xZ[x]),s.push(new hb(x,f))}let o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:xZ[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 db{constructor(e){let{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=VTe(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}},HB=class extends eC{parseFunction(e){return new qB(e)}},qTe={[So.READ_ONLY]:"read",[So.WRITE_ONLY]:"write",[So.READ_WRITE]:"read_write"},yZ={[Sf]:"repeat",[ko]:"clamp",[Tf]:"mirror"},_8={vertex:Ch.VERTEX,fragment:Ch.FRAGMENT,compute:Ch.COMPUTE},vZ={instance:!0,swizzleAssign:!1,storageBuffer:!0},HTe={"^^":"tsl_xor"},WTe={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>"},bZ={},Dv={tsl_xor:new Ki("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new Ki("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new Ki("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new Ki("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new Ki("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new Ki("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new Ki("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new Ki("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 Ki("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 Ki("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new Ki("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 Ki("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),inverse_mat2:new Ki(`4443+`;this.mipmapSampler=e.createSampler({minFilter:cc.Linear}),this.flipYSampler=e.createSampler({minFilter:cc.Nearest}),jp.size=4,jp.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(jp),jp.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),jp.size=4,jp.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(jp),jp.reset(),this.transferPipelines={},QE.label="mipmap",QE.code=t,this.mipmapShaderModule=e.createShaderModule(QE),QE.reset()}getTransferPipeline(e,t){t=t||"2d-array";let n=`${e}-${t}`,r=this.transferPipelines[n];return r===void 0&&(u1.label=`mipmap-${e}-${t}`,u1.vertex={module:this.mipmapShaderModule},u1.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},u1.layout="auto",r=this.device.createRenderPipeline(u1),u1.reset(),this.transferPipelines[n]=r),r}flipY(e,t,n=0){let r=t.format,{width:s,height:o}=t.size;h1.size.width=s,h1.size.height=o,h1.format=r,h1.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let a=this.device.createTexture(h1);h1.reset();let l=this.getTransferPipeline(r,e.textureBindingViewDimension),c=this.getTransferPipeline(r,a.textureBindingViewDimension),u=this.device.createCommandEncoder(KE),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(),Wp.layout=P,Wp.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(Wp);Wp.reset(),Jr.dimension="2d",Jr.mipLevelCount=1,Jr.baseArrayLayer=S,Jr.arrayLayerCount=1;let L=w.createView(Jr);Jr.reset(),Fv.view=L,Fv.loadOp=Ei.Clear,Fv.storeOp=Sa.Store,y8.colorAttachments.push(Fv);let D=u.beginRenderPass(y8);y8.reset(),Fv.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),wh(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&&(KE.label="mipmapEncoder",s=this.device.createCommandEncoder(KE),KE.reset()),this._mipmapRunBundles(s,r),t===null&&wh(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(),Wp.layout=r,Wp.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:l},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let c=this.device.createBindGroup(Wp);Wp.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 Mm;f.view=u,f.loadOp=Ei.Clear,f.storeOp=Sa.Store;let p=new Cm;p.colorAttachments.push(f),x8.colorFormats=[e.format];let x=this.device.createRenderBundleEncoder(x8);x8.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()}}},kB=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}},F1=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"}},GB=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}},zB=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}},VB=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}},qB=class extends F1{constructor(){super(),this.colorSpace="srgb",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace="srgb",this.premultipliedAlpha=!1}},bC=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},JE=new l0,HTe=new Bm,Xo=new kB,Ko=new F1,eM=new GB,Xf=new zB,tM=new VB,f1=new qB,Xp=new gb,Yo=new bC,WTe={[y2]:"never",[M_]:"less",[v2]:"equal",[nh]:"less-equal",[zA]:"greater",[Wc]:"greater-equal",[w2]:"always",[b2]:"not-equal"},jTe=[0,1,3,2,4,5];function bZ(i,e,t,n,r,s,o,a,l,c){Ko.texture=e,Ko.mipLevel=t,Ko.origin.z=n,Xf.offset=n*s,Xf.bytesPerRow=o,Xf.rowsPerImage=a,Yo.width=l,Yo.height=c,i.queue.writeTexture(Ko,r.data,Xf,Yo),Ko.reset(),Xf.reset(),Yo.reset()}var HB=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=cc.Nearest,Xo.minFilter=cc.Nearest,Xo.mipmapFilter=cc.Nearest),Xo.magFilter===cc.Linear&&Xo.minFilter===cc.Linear&&Xo.mipmapFilter===cc.Linear&&(Xo.maxAnisotropy=n.anisotropy),n.isDepthTexture&&n.compareFunction!==null&&r.compareNode!==null&&t.hasCompatibility(Ff.TEXTURE_COMPARE)&&(Xo.compare=WTe[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=WB(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||WB(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 gb;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=wo.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(),Xp.label="colorBuffer",Xp.size.width=n,Xp.size.height=r,Xp.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),Xp.format=e.utils.getPreferredCanvasFormat(),Xp.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,l=e.device.createTexture(Xp),Xp.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=Js,f=n.renderer.reversedDepthBuffer===!0?Yi:Vo):e&&(u=vs,f=n.renderer.reversedDepthBuffer===!0?Yi: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,JE.size=(s-1)*p+r*f,JE.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let x=a.createBuffer(JE);JE.reset();let v=a.createCommandEncoder(HTe);Ko.texture=c,Ko.origin.x=t,Ko.origin.y=n,Ko.origin.z=o,eM.buffer=x,eM.bytesPerRow=p,Yo.width=r,Yo.height=s,v.copyTextureToBuffer(Ko,eM,Yo),Ko.reset(),eM.reset(),Yo.reset();let w=this._getTypedArrayType(u);wh(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=xi,n.magFilter=xi,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 ku;n.minFilter=xi,n.magFilter=xi,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?jTe[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;tM.source=e,tM.flipY=s,f1.texture=t,f1.mipLevel=a,f1.origin.z=r,f1.premultipliedAlpha=o,Yo.width=c,Yo.height=u;try{l.queue.copyExternalImageToTexture(tM,f1,Yo)}catch{}finally{tM.reset(),f1.reset(),Yo.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new UB(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,Xf.offset=e.width*e.height*u*o,Xf.bytesPerRow=f,Yo.width=e.width,Yo.height=e.height,l.queue.writeTexture(Ko,c,Xf,Yo),Ko.reset(),Xf.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)bZ(s,t,c,R,u,S,v,w,T,P);else for(let R=0;R<x;R++)bZ(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=A8.ClampToEdge;return e===Tf?t=A8.Repeat:e===Ef&&(t=A8.MirrorRepeat),t}_convertFilterMode(e){let t=cc.Linear;return(e===xi||e===g2||e===tc)&&(t=cc.Nearest),t}_convertMipmapFilterMode(e){return e===tc||e===_o?cc.Linear:cc.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=yZ.ThreeD:t=yZ.TwoD,t}};function WB(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(gC.TextureFormatsTier1),l===!1&&je("WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.")),i.isCompressedTexture===!0||i.isCompressedArrayTexture===!0)switch(t){case Zu:case Ku:a=o===Bt?he.BC1RGBAUnormSRGB:he.BC1RGBAUnorm;break;case Qu:a=o===Bt?he.BC2RGBAUnormSRGB:he.BC2RGBAUnorm;break;case Ju:a=o===Bt?he.BC3RGBAUnormSRGB:he.BC3RGBAUnorm;break;case Rp:a=he.BC4RUnorm;break;case Pp:a=he.BC4RSnorm;break;case th:a=he.BC5RGUnorm;break;case Ip:a=he.BC5RGSnorm;break;case Ep:a=o===Bt?he.BC7RGBAUnormSRGB:he.BC7RGBAUnorm;break;case Mp:a=he.BC6HRGBFloat;break;case Cp:a=he.BC6HRGBUFloat;break;case ap:case op:a=o===Bt?he.ETC2RGB8UnormSRGB:he.ETC2RGB8Unorm;break;case lp:a=o===Bt?he.ETC2RGBA8UnormSRGB:he.ETC2RGBA8Unorm;break;case cp:a=he.EACR11Unorm;break;case up:a=he.EACR11Snorm;break;case eh:a=he.EACRG11Unorm;break;case hp:a=he.EACRG11Snorm;break;case fp:a=o===Bt?he.ASTC4x4UnormSRGB:he.ASTC4x4Unorm;break;case dp:a=o===Bt?he.ASTC5x4UnormSRGB:he.ASTC5x4Unorm;break;case pp:a=o===Bt?he.ASTC5x5UnormSRGB:he.ASTC5x5Unorm;break;case Ap:a=o===Bt?he.ASTC6x5UnormSRGB:he.ASTC6x5Unorm;break;case mp:a=o===Bt?he.ASTC6x6UnormSRGB:he.ASTC6x6Unorm;break;case gp:a=o===Bt?he.ASTC8x5UnormSRGB:he.ASTC8x5Unorm;break;case _p:a=o===Bt?he.ASTC8x6UnormSRGB:he.ASTC8x6Unorm;break;case xp:a=o===Bt?he.ASTC8x8UnormSRGB:he.ASTC8x8Unorm;break;case yp:a=o===Bt?he.ASTC10x5UnormSRGB:he.ASTC10x5Unorm;break;case vp:a=o===Bt?he.ASTC10x6UnormSRGB:he.ASTC10x6Unorm;break;case bp:a=o===Bt?he.ASTC10x8UnormSRGB:he.ASTC10x8Unorm;break;case wp:a=o===Bt?he.ASTC10x10UnormSRGB:he.ASTC10x10Unorm;break;case Sp:a=o===Bt?he.ASTC12x10UnormSRGB:he.ASTC12x10Unorm;break;case Tp: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 ju:a=he.RGBA8Snorm;break;case Xu:a=l?he.RGBA16Snorm:he.RGBA16Sint;break;case ja:a=l?he.RGBA16Unorm:he.RGBA16Uint;break;case pi:a=he.RGBA32Uint;break;case Lr:a=he.RGBA32Sint;break;case Gi:a=o===Bt?he.RGBA8UnormSRGB:he.RGBA8Unorm;break;case Li:a=he.RGBA16Float;break;case Yi:a=he.RGBA32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case Lf:switch(n){case FA:a=he.RGB9E5UFloat;break;case OA:a=he.RG11B10UFloat;break;default:Ge("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case Df:switch(n){case ju:a=he.R8Snorm;break;case Xu:a=l?he.R16Snorm:he.R16Sint;break;case ja:a=l?he.R16Unorm:he.R16Uint;break;case pi:a=he.R32Uint;break;case Lr:a=he.R32Sint;break;case Gi:a=he.R8Unorm;break;case Li:a=he.R16Float;break;case Yi:a=he.R32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case Ts:switch(n){case ju:a=he.RG8Snorm;break;case Xu:a=l?he.RG16Snorm:he.RG16Sint;break;case ja:a=l?he.RG16Unorm:he.RG16Uint;break;case pi:a=he.RG32Uint;break;case Lr:a=he.RG32Sint;break;case Gi:a=he.RG8Unorm;break;case Li:a=he.RG16Float;break;case Yi: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 Yi:a=he.Depth32Float;break;default:Ge("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case Js:switch(n){case Vo:a=he.Depth24PlusStencil8;break;case Yi:e&&e.features.has(gC.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 $u:switch(n){case Lr:a=he.R32Sint;break;case pi:a=he.R32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case Yu:switch(n){case Lr:a=he.RG32Sint;break;case pi:a=he.RG32Uint;break;default:Ge("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case sp:switch(n){case Lr: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 XTe=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,$Te=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,wZ={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"},YTe=i=>{i=i.trim();let e=i.match(XTe);if(e!==null&&e.length===4){let t=e[2],n=[],r=null;for(;(r=$Te.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=wZ[x]),s.push(new db(x,f))}let o=i.substring(e[0].length),a=e[3]||"void",l=e[1]!==void 0?e[1]:"";return{type:wZ[a]||a,inputs:s,name:l,inputsCode:t,blockCode:o,outputType:a}}else throw new Error("THREE.WGSLNodeFunction: Function is not a WGSL code.")},jB=class extends Ab{constructor(e){let{type:t,inputs:n,name:r,inputsCode:s,blockCode:o,outputType:a}=YTe(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}},XB=class extends iC{parseFunction(e){return new jB(e)}},ZTe={[To.READ_ONLY]:"read",[To.WRITE_ONLY]:"write",[To.READ_WRITE]:"read_write"},SZ={[Tf]:"repeat",[Go]:"clamp",[Ef]:"mirror"},v8={vertex:Rh.VERTEX,fragment:Rh.FRAGMENT,compute:Rh.COMPUTE},TZ={instance:!0,swizzleAssign:!1,storageBuffer:!0},KTe={"^^":"tsl_xor"},QTe={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>"},EZ={},Ov={tsl_xor:new Ki("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new Ki("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new Ki("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new Ki("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new Ki("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new Ki("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new Ki("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new Ki("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 Ki("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 Ki("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new Ki("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 Ki("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),inverse_mat2:new Ki(`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-`)},jTe={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"},Dee="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(Dee+=`diagnostic( off, derivative_uniformity );4562-`);var WB=class extends QM{constructor(e,t){super(e,t,new HB),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_${yZ[e.wrapS]}S_${yZ[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}`,n=bZ[t];if(n===void 0){let r=[],s=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f",o=`fn ${t}( coord : ${s} ) -> ${s} {4561+`)},JTe={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"},Uee="";(typeof navigator<"u"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(Uee+=`diagnostic( off, derivative_uniformity );4562+`);var $B=class extends tC{constructor(e,t){super(e,t,new XB),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_${SZ[e.wrapS]}S_${SZ[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}`,n=EZ[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===Sf?(r.push(Dv.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${c} )`):l===ko?(r.push(Dv.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${c} )`):l===Tf?(r.push(Dv.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===Tf?(r.push(Ov.repeatWrapping_float),o+=` tsl_repeatWrapping_float( coord.${c} )`):l===Go?(r.push(Ov.clampWrapping_float),o+=` tsl_clampWrapping_float( coord.${c} )`):l===Ef?(r.push(Ov.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-`,bZ[t]=n=new Ki(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 v1(new w1(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new v1(new w1(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new v1(new w1("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(Df.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.type===Yi||this.isSampleCompare(e)===!1&&e.minFilter===xi&&e.magFilter===xi||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=HTe[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."),So.READ_WRITE):So.READ_ONLY:e.access}getStorageAccess(e,t){return qTe[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 pb(s.name,s.node,l,p):f=new N1(s.name,s.node,l,p):t==="cubeTexture"||t==="cubeDepthTexture"?f=new cC(s.name,s.node,l,p):t==="texture3D"&&(f=new pb(s.name,s.node,l,p)),f.store=e.isStorageTextureNode===!0,f.mipLevel=f.store?e.mipLevel:0,f.setVisibility(_8[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&f.store===!1||e.gatherNode!==null){let v=new PB(`${s.name}_sampler`,s.node,l);v.setVisibility(_8[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"?oC:NB;p=new x(e,l),f.buffer=p}p.setVisibility(p.getVisibility()|_8[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(Ch.VERTEX|Ch.FRAGMENT|Ch.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+`,EZ[t]=n=new Ki(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 w1(new T1(`textureDimensions( ${o} )`,a)),r.dimensionsSnippet[n]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(r.arrayLayerCount=new w1(new T1(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(r.cubeFaceCount=new w1(new T1("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(Ff.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!=="float"||!this.isAvailable("float32Filterable")&&e.type===Yi||this.isSampleCompare(e)===!1&&e.minFilter===xi&&e.magFilter===xi||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=KTe[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."),To.READ_WRITE):To.READ_ONLY:e.access}getStorageAccess(e,t){return ZTe[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 mb(s.name,s.node,l,p):f=new D1(s.name,s.node,l,p):t==="cubeTexture"||t==="cubeDepthTexture"?f=new fC(s.name,s.node,l,p):t==="texture3D"&&(f=new mb(s.name,s.node,l,p)),f.store=e.isStorageTextureNode===!0,f.mipLevel=f.store?e.mipLevel:0,f.setVisibility(v8[n]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&f.store===!1||e.gatherNode!==null){let v=new LB(`${s.name}_sampler`,s.node,l);v.setVisibility(v8[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"?cC:FB;p=new x(e,l),f.buffer=p}p.setVisibility(p.getVisibility()|v8[n]),u.push(p),a=p,s.name=r||"NodeBuffer_"+s.id}else{let f=this.uniformGroups[c];f===void 0&&(f=new uC(c,l),f.setVisibility(Rh.VERTEX|Rh.FRAGMENT|Rh.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=VB(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=WB(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 WTe[e]||e}isAvailable(e){let t=vZ[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),vZ[e]=t),t}_getWGSLMethod(e){return Dv[e]!==void 0&&this._include(e),jTe[e]}_include(e){let t=Dv[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 QTe[e]||e}isAvailable(e){let t=TZ[e];return t===void 0&&(e==="float32Filterable"?t=this.renderer.hasFeature("float32-filterable"):e==="clipDistance"&&(t=this.renderer.hasFeature("clip-distances")),TZ[e]=t),t}_getWGSLMethod(e){return Ov[e]!==void 0&&this._include(e),JTe[e]}_include(e){let t=Ov[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-${Dee}4637+${Uee}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};`}},Xo=new o0,x8=new Fm,Fee=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"&&Fee.set(Float16Array,["float16"]);var XTe=new Map([[f_,["float16"]]]),$Te=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]),jB=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;Xo.label=n.name,Xo.size=f,Xo.usage=t,Xo.mappedAtCreation=!0,o=a.createBuffer(Xo),Xo.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=E_(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?XE.Instance:XE.Vertex):(f=s.itemSize*o,p=s.isInstancedBufferAttribute?XE.Instance:XE.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){Xo.label=`${t.name}_readback`,Xo.size=t.maxByteLength,Xo.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(Xo),Xo.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 Xo.label=`${e.name}_readback`,Xo.size=c,Xo.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,u=o.createBuffer(Xo),Xo.reset();x8.label=`readback_encoder_${e.name}`;let f=o.createCommandEncoder(x8);x8.reset(),f.copyBufferToBuffer(l,n,u,0,c);let p=f.finish();if(bh(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=$Te.get(r);else{let l=(XTe.get(s)||Fee.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}},wl=new AC,Fv=new o0,h1=new mb,XB=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},$B=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=F1(JSON.stringify(s)),a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new XB(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=E_(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];Fv.label="bindingCameraIndex_"+o,Fv.size=16,Fv.usage=s;let a=r.createBuffer(Fv);Fv.reset(),r.queue.writeBuffer(a,0,e,0),wl.label="bindGroupCameraIndex_"+o,wl.layout=t,wl.entries.push({binding:0,resource:{buffer:a}});let l=r.createBindGroup(wl);return wl.reset(),l}createBindGroup(e,t){let n=this.backend,r=n.device,s=0;wl.label="bindGroup_"+e.name,wl.layout=t;for(let a of e.bindings){if(a.isUniformBuffer){let l=n.get(a);wl.entries.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){let l=n.get(a.attribute).buffer;wl.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=FTe.All,v;a.isSampledCubeTexture?v=bo.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?v=bo.TwoDArray:a.isSampledTexture3D?v=bo.ThreeD:v=bo.TwoD,h1.aspect=x,h1.dimension=v,h1.mipLevelCount=u,h1.baseMipLevel=f,c=l[p]=l.texture.createView(h1),h1.reset()}}wl.entries.push({binding:s,resource:c})}else if(a.isSampler){let l=n.get(a);wl.entries.push({binding:s,resource:l.sampler})}s++}let o=r.createBindGroup(wl);return wl.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&Ch.COMPUTE&&(r.access===So.READ_WRITE||r.access===So.WRITE_ONLY)?a.type=d8.Storage:a.type=d8.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===So.READ_WRITE?a.access=p8.ReadWrite:l===So.WRITE_ONLY?a.access=p8.WriteOnly:a.access=p8.ReadOnly,r.texture.isArrayTexture?a.viewDimension=bo.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=bo.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=fm.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=fm.UnfilterableFloat:a.sampleType=fm.Depth;else{let c=r.texture.type;c===Ir?a.sampleType=fm.SInt:c===pi?a.sampleType=fm.UInt:c===Yi&&(this.backend.hasFeature("float32-filterable")?a.sampleType=fm.Float:a.sampleType=fm.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=bo.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=bo.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=bo.ThreeD),o.texture=a}else if(r.isSampler){let a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&r.textureNode.compareNode!==null&&s.hasCompatibility(Df.TEXTURE_COMPARE)?a.type=AZ.Comparison:a.type=AZ.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()}},YB=class{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}},ZB=class{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}},KB=class{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}},Ov=new ZB,f1=new KB,d1=new mC,Sl=new gC,QB=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!==$r&&(r.blending!==ss||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===Ky?de=w:ve.blending!==$r&&(de=this._getBlending(ve))}else Zn("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);f1.bindGroupLayouts=x;let B=u.createPipelineLayout(f1);f1.reset(),Sl.label=`renderPipeline_${r.name||r.type}_${r.id}`,Sl.vertex=Object.assign({},R,{buffers:v}),Sl.fragment=Object.assign({},C,{targets:P}),Sl.primitive=L,Sl.multisample.count=N,Sl.multisample.alphaToCoverageEnabled=r.alphaToCoverage&&N>1,Sl.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===Gv.TriangleList&&(z.depthBias=r.polygonOffsetUnits,z.depthBiasSlopeScale=r.polygonOffsetFactor,z.depthBiasClamp=0),Sl.depthStencil=z),u.pushErrorScope("validation");let Z=[{program:a,module:R.module},{program:l,module:C.module}],J=Sl.label;if(t===null)p.pipeline=u.createRenderPipeline(Sl),Sl.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(Sl)}catch(de){ee=de}if(Sl.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);d1.label=t,d1.colorFormats=a,d1.depthStencilFormat=o,d1.sampleCount=l;let c=s.createRenderBundleEncoder(d1);return d1.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"),f1.bindGroupLayouts=a;let u=r.createPipelineLayout(f1);f1.reset(),Ov.label=c,Ov.compute=s,Ov.layout=u,o.pipeline=r.createComputePipeline(Ov),Ov.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 l0,b8=new Bm,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 e3e=new Map([[p_,["float16"]]]),t3e=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]),YB=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=C_(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?ZE.Instance:ZE.Vertex):(f=s.itemSize*o,p=s.isInstancedBufferAttribute?ZE.Instance:ZE.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();b8.label=`readback_encoder_${e.name}`;let f=o.createCommandEncoder(b8);b8.reset(),f.copyBufferToBuffer(l,n,u,0,c);let p=f.finish();if(wh(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=t3e.get(r);else{let l=(e3e.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}},Sl=new _C,Bv=new l0,d1=new _b,ZB=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},KB=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=B1(JSON.stringify(s)),a=this._bindGroupLayoutCache.get(o);return a===void 0&&(a=new ZB(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=C_(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];Bv.label="bindingCameraIndex_"+o,Bv.size=16,Bv.usage=s;let a=r.createBuffer(Bv);Bv.reset(),r.queue.writeBuffer(a,0,e,0),Sl.label="bindGroupCameraIndex_"+o,Sl.layout=t,Sl.entries.push({binding:0,resource:{buffer:a}});let l=r.createBindGroup(Sl);return Sl.reset(),l}createBindGroup(e,t){let n=this.backend,r=n.device,s=0;Sl.label="bindGroup_"+e.name,Sl.layout=t;for(let a of e.bindings){if(a.isUniformBuffer){let l=n.get(a);Sl.entries.push({binding:s,resource:{buffer:l.buffer}})}else if(a.isStorageBuffer){let l=n.get(a.attribute).buffer;Sl.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=VTe.All,v;a.isSampledCubeTexture?v=wo.Cube:a.texture.isArrayTexture||a.texture.isDataArrayTexture||a.texture.isCompressedArrayTexture?v=wo.TwoDArray:a.isSampledTexture3D?v=wo.ThreeD:v=wo.TwoD,d1.aspect=x,d1.dimension=v,d1.mipLevelCount=u,d1.baseMipLevel=f,c=l[p]=l.texture.createView(d1),d1.reset()}}Sl.entries.push({binding:s,resource:c})}else if(a.isSampler){let l=n.get(a);Sl.entries.push({binding:s,resource:l.sampler})}s++}let o=r.createBindGroup(Sl);return Sl.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&Rh.COMPUTE&&(r.access===To.READ_WRITE||r.access===To.WRITE_ONLY)?a.type=m8.Storage:a.type=m8.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===To.READ_WRITE?a.access=g8.ReadWrite:l===To.WRITE_ONLY?a.access=g8.WriteOnly:a.access=g8.ReadOnly,r.texture.isArrayTexture?a.viewDimension=wo.TwoDArray:r.texture.is3DTexture&&(a.viewDimension=wo.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=pm.UnfilterableFloat)),r.texture.isDepthTexture)s.compatibilityMode&&r.texture.compareFunction===null?a.sampleType=pm.UnfilterableFloat:a.sampleType=pm.Depth;else{let c=r.texture.type;c===Lr?a.sampleType=pm.SInt:c===pi?a.sampleType=pm.UInt:c===Yi&&(this.backend.hasFeature("float32-filterable")?a.sampleType=pm.Float:a.sampleType=pm.UnfilterableFloat)}r.isSampledCubeTexture?a.viewDimension=wo.Cube:r.texture.isArrayTexture||r.texture.isDataArrayTexture||r.texture.isCompressedArrayTexture?a.viewDimension=wo.TwoDArray:r.isSampledTexture3D&&(a.viewDimension=wo.ThreeD),o.texture=a}else if(r.isSampler){let a={};r.texture.isDepthTexture&&(r.texture.compareFunction!==null&&r.textureNode.compareNode!==null&&s.hasCompatibility(Ff.TEXTURE_COMPARE)?a.type=xZ.Comparison:a.type=xZ.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()}},QB=class{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}},JB=class{constructor(){this.label="",this.layout=null,this.compute=null}reset(){this.label="",this.layout=null,this.compute=null}},e7=class{constructor(){this.label="",this.bindGroupLayouts=null}reset(){this.label="",this.bindGroupLayouts=null}},Uv=new JB,p1=new e7,A1=new xC,Tl=new yC,t7=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===Jy?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);p1.bindGroupLayouts=x;let B=u.createPipelineLayout(p1);p1.reset(),Tl.label=`renderPipeline_${r.name||r.type}_${r.id}`,Tl.vertex=Object.assign({},R,{buffers:v}),Tl.fragment=Object.assign({},C,{targets:P}),Tl.primitive=L,Tl.multisample.count=N,Tl.multisample.alphaToCoverageEnabled=r.alphaToCoverage&&N>1,Tl.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===Vv.TriangleList&&(z.depthBias=r.polygonOffsetUnits,z.depthBiasSlopeScale=r.polygonOffsetFactor,z.depthBiasClamp=0),Tl.depthStencil=z),u.pushErrorScope("validation");let Z=[{program:a,module:R.module},{program:l,module:C.module}],J=Tl.label;if(t===null)p.pipeline=u.createRenderPipeline(Tl),Tl.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(Tl)}catch(de){ee=de}if(Tl.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);A1.label=t,A1.colorFormats=a,A1.depthStencilFormat=o,A1.sampleCount=l;let c=s.createRenderBundleEncoder(A1);return A1.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"),p1.bindGroupLayouts=a;let u=r.createPipelineLayout(p1);p1.reset(),Uv.label=c,Uv.compute=s,Uv.layout=u,o.pipeline=r.createComputePipeline(Uv),Uv.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===If){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:hm.Add},n={srcFactor:p,dstFactor:x,operation:hm.Add}};if(l)switch(r){case ss:c(si.One,si.OneMinusSrcAlpha,si.One,si.OneMinusSrcAlpha);break;case zu:c(si.One,si.One,si.One,si.One);break;case Vu:c(si.Zero,si.OneMinusSrc,si.Zero,si.One);break;case qu:c(si.Dst,si.OneMinusSrcAlpha,si.Zero,si.One);break}else switch(r){case ss:c(si.SrcAlpha,si.OneMinusSrcAlpha,si.One,si.OneMinusSrcAlpha);break;case zu:c(si.SrcAlpha,si.One,si.One,si.One);break;case Vu:Ge(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case qu: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 qc:t=si.Zero;break;case e2:t=si.One;break;case t2:t=si.Src;break;case n2:t=si.OneMinusSrc;break;case Ud:t=si.SrcAlpha;break;case kd:t=si.OneMinusSrcAlpha;break;case s2:t=si.Dst;break;case o2:t=si.OneMinusDst;break;case i2:t=si.DstAlpha;break;case r2:t=si.OneMinusDstAlpha;break;case a2:t=si.SrcAlphaSaturated;break;case L2e:t=si.Constant;break;case D2e:t=si.OneMinusConstant;break;default:Ge("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,n=e.stencilFunc;switch(n){case oL:t=vo.Never;break;case gy:t=vo.Always;break;case aL:t=vo.Less;break;case cL:t=vo.LessEqual;break;case lL:t=vo.Equal;break;case fL:t=vo.GreaterEqual;break;case uL:t=vo.Greater;break;case hL:t=vo.NotEqual;break;default:Ge("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case yf:t=Vp.Keep;break;case JN:t=Vp.Zero;break;case eL:t=Vp.Replace;break;case sL:t=Vp.Invert;break;case tL:t=Vp.IncrementClamp;break;case nL:t=Vp.DecrementClamp;break;case iL:t=Vp.IncrementWrap;break;case rL:t=Vp.DecrementWrap;break;default:Ge("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case Bs:t=hm.Add;break;case Qy:t=hm.Subtract;break;case Jy:t=hm.ReverseSubtract;break;case zT:t=hm.Min;break;case VT:t=hm.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?dC.Uint16:dC.Uint32);let o=n.side===ui;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(o=!o),r.frontFace=o===!0?fZ.CW:fZ.CCW,r.cullMode=n.side===ir?dZ.None:dZ.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?pZ.All:pZ.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=vo.Always;else{let n=this.backend.parameters.reversedDepthBuffer?b2[e.depthFunc]:e.depthFunc;switch(n){case lA:t=vo.Never;break;case cA:t=vo.Always;break;case uA:t=vo.Less;break;case Bu:t=vo.LessEqual;break;case hA:t=vo.Equal;break;case fA:t=vo.GreaterEqual;break;case dA:t=vo.Greater;break;case pA:t=vo.NotEqual;break;default:Ge("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}},yC=class{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}},_h=new o0,YTe=new Fm,Bv=new yC,JB=class extends hC{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,Bv.label=`queryset_global_timestamp_${t}`,Bv.type="timestamp",Bv.count=this.maxQueries,this.querySet=this.device.createQuerySet(Bv),Bv.reset();let r=this.maxQueries*8;_h.label=`buffer_timestamp_resolve_${t}`,_h.size=r,_h.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(_h),_h.reset(),_h.label=`buffer_timestamp_result_${t}`,_h.size=r,_h.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(_h),_h.reset()}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return Zn(`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(YTe);r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);let s=r.finish();if(bh(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}}},e7=class{constructor(){this.label="",this.timestampWrites=void 0}reset(){this.label="",this.timestampWrites=void 0}},_1=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}},t7=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}},Qc={r:0,g:0,b:0,a:1},Tl=new o0,ba=new Fm,JE=new e7,Uv=new yC,eM=new _C,tM=new t7,oc=new L1,xh=new L1,ur=new mb,qf=new xC,n7=class extends uC{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 LB(this),this.attributeUtils=new jB(this),this.bindingUtils=new $B(this),this.capabilities=new YB(this),this.pipelineUtils=new QB(this),this.textureUtils=new zB(this),this.occludedResolveCache=new Map;let t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[Df.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(pC),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(pC.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===Li?"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 qa}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 Em,s.colorAttachments.push(new Tm),e.depth===!0||e.stencil===!0){let l=new _1;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:bo.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(ur.label=`colorAttachment_${w}`,ur.baseMipLevel=e.activeMipmapLevel,ur.mipLevelCount=1,ur.baseArrayLayer=e.activeCubeFace,ur.arrayLayerCount=1,ur.dimension=bo.TwoD,n.isRenderTarget3D)p=e.activeCubeFace,ur.baseArrayLayer=0,ur.dimension=bo.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++){ur.baseArrayLayer=P,ur.arrayLayerCount=1,ur.dimension=bo.TwoD;let R=S.texture.createView(ur);f.push({view:R,resolveTarget:void 0,depthSlice:void 0})}}else ur.dimension=bo.TwoDArray;if(x!==!0){let T=S.texture.createView(ur),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})}ur.reset()}let v=[];for(let w=0;w<f.length;w++){let S=f[w],T=new Tm;T.view=S.view,T.depthSlice=S.depthSlice,T.resolveTarget=S.resolveTarget,v.push(T)}if(l={textureViews:f,colorAttachments:v,descriptor:new Em},e.depth){let w=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(ur.dimension=bo.TwoD,ur.arrayLayerCount=1,ur.baseArrayLayer=e.activeCubeFace);let S=new _1;S.view=w.texture.createView(ur),l.depthStencilAttachment=S,ur.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||Ei.Load,f.storeOp=t.storeOp||wa.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,Uv.label=`occlusionQuerySet_${e.id}`,Uv.type="occlusion",Uv.count=r,s=n.createQuerySet(Uv),Uv.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:Ei.Load}),this.initTimestampQuery(ec.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:(Qc.r=0,Qc.g=0,Qc.b=0,Qc.a=1,f.clearValue=Qc),f.loadOp=Ei.Clear):f.loadOp=Ei.Load,f.storeOp=wa.Store}}else{let c=o.colorAttachments[0];e.clearColor?(c.clearValue=e.clearColorValue,c.loadOp=Ei.Clear):c.loadOp=Ei.Load,c.storeOp=wa.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Ei.Clear):a.depthLoadOp=Ei.Load,a.depthStoreOp=wa.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Ei.Clear):a.stencilLoadOp=Ei.Load,a.stencilStoreOp=wa.Store),ba.label="renderContext_"+e.id;let l=n.createCommandEncoder(ba);if(ba.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 Tm;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 Em;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]||(ur.dimension=bo.TwoD,ur.baseArrayLayer=a,ur.arrayLayerCount=1,o.viewCache[f]=o.texture.createView(ur),ur.reset());let p=new _1;p.view=o.viewCache[f],p.depthLoadOp=s.depthLoadOp||Ei.Clear,p.depthStoreOp=s.depthStoreOp||wa.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 _1;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=Ei.Clear):o.depthLoadOp=Ei.Load),e.stencil&&(e.clearStencil?(o.stencilClearValue=e.clearStencilValue,o.stencilLoadOp=Ei.Clear):o.stencilLoadOp=Ei.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&&(Tl.size=s,Tl.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,o=this.device.createBuffer(Tl),Tl.reset(),this.occludedResolveCache.set(s,o)),Tl.size=s,Tl.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let a=this.device.createBuffer(Tl);Tl.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(bh(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();Qc.r=x.r,Qc.g=x.g,Qc.b=x.b,Qc.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=Qc,v.loadOp=Ei.Clear,v.storeOp=wa.Store}(c||u)&&(l=x.depthStencilAttachment)}else{c=r.depth,u=r.stencil;let x={loadOp:e?Ei.Clear:Ei.Load,clearValue:e?Qc:void 0};c&&(x.depthLoadOp=t?Ei.Clear:Ei.Load,x.depthClearValue=t?o.getClearDepth():void 0,x.depthStoreOp=wa.Store),u&&(x.stencilLoadOp=n?Ei.Clear:Ei.Load,x.stencilClearValue=n?o.getClearStencil():void 0,x.stencilStoreOp=wa.Store);let v=this._getRenderPassDescriptor(r,x);a=v.colorAttachments,l=v.depthStencilAttachment}c&&l&&(t?(l.depthLoadOp=Ei.Clear,l.depthClearValue=o.getClearDepth(),l.depthStoreOp=wa.Store):(l.depthLoadOp=Ei.Load,l.depthStoreOp=wa.Store)),u&&l&&(n?(l.stencilLoadOp=Ei.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=wa.Store):(l.stencilLoadOp=Ei.Load,l.stencilStoreOp=wa.Store)),ba.label="clear";let f=s.createCommandEncoder(ba);ba.reset(),f.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),bh(s,f.finish())}beginCompute(e){let t=this.get(e),n="computeGroup_"+e.id;JE.label=n,ba.label=n,this.initTimestampQuery(ec.COMPUTE,this.getTimestampUID(e),JE),t.cmdEncoderGPU=this.device.createCommandEncoder(ba),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(JE),t.currentPipeline=null,ba.reset(),JE.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(),bh(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?dC.Uint16:dC.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 JB(this.device,e,2048));let r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);tM.querySet=r.querySet,tM.beginningOfPassWriteIndex=s,tM.endOfPassWriteIndex=s+1,n.timestampWrites=tM}createNodeBuilder(e,t){return new WB(e,t)}createProgram(e){let t=this.get(e);eM.label=e.stage+(e.name!==""?`_${e.name}`:""),eM.code=e.code,t.module={module:this.device.createShaderModule(eM),entryPoint:"main"},eM.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&Ch.VERTEX&&s.push("vertex"),e.visibility&Ch.FRAGMENT&&s.push("fragment"),e.visibility&Ch.COMPUTE&&s.push("compute");let o=`(${s.join(",")})`;Tl.label=`bindingBuffer${e.id}_${e.name}_${o}`,Tl.size=n,Tl.usage=r;let a=this.device.createBuffer(Tl);Tl.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 gZ[e]!==void 0&&(e=gZ[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),ba.label="copyTextureToTexture_"+e.id+"_"+t.id;let S=this.device.createCommandEncoder(ba);ba.reset();let T=this.get(e).texture,P=this.get(t).texture;oc.texture=T,oc.mipLevel=s,oc.origin.x=u,oc.origin.y=f,oc.origin.z=p,xh.texture=P,xh.mipLevel=o,xh.origin.x=a,xh.origin.y=l,xh.origin.z=c,qf.width=x,qf.height=v,qf.depthOrArrayLayers=w,S.copyTextureToTexture(oc,xh,qf),oc.reset(),xh.reset(),qf.reset(),bh(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):(ba.label="copyFramebufferToTexture_"+e.id,a=this.device.createCommandEncoder(ba),ba.reset()),oc.texture=s,oc.origin.x=n.x,oc.origin.y=n.y,xh.texture=o,qf.width=n.z,qf.height=n.w,a.copyTextureToTexture(oc,xh,qf),oc.reset(),xh.reset(),qf.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=Ei.Load;t.depth&&(l.depthStencilAttachment.depthLoadOp=Ei.Load),t.stencil&&(l.depthStencilAttachment.stencilLoadOp=Ei.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 bh(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()}},i7=class extends EA{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}},r7=class extends EA{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}},s7=class extends nC{constructor(){super(),this.addMaterial(CF,"MeshPhongMaterial"),this.addMaterial(DM,"MeshStandardMaterial"),this.addMaterial(OF,"MeshPhysicalMaterial"),this.addMaterial(UF,"MeshToonMaterial"),this.addMaterial(EF,"MeshBasicMaterial"),this.addMaterial(MF,"MeshLambertMaterial"),this.addMaterial(bF,"MeshNormalMaterial"),this.addMaterial(kF,"MeshMatcapMaterial"),this.addMaterial(xF,"LineBasicMaterial"),this.addMaterial(yF,"LineDashedMaterial"),this.addMaterial(zF,"PointsMaterial"),this.addMaterial(FM,"SpriteMaterial"),this.addMaterial(qF,"ShadowMaterial"),this.addLight(LO,qy),this.addLight(iB,MA),this.addLight(lB,Hy),this.addLight(fb,EA),this.addLight(nB,CA),this.addLight(rB,zy),this.addLight(oB,Wy),this.addLight(sB,i7),this.addLight(aB,r7),this.addToneMapping(eee,l2),this.addToneMapping(tee,c2),this.addToneMapping(nee,u2),this.addToneMapping(iee,h2),this.addToneMapping(ree,f2),this.addToneMapping(see,d2)}},D1=class extends gB{constructor(e={}){let t;e.forceWebGL?t=fC:(t=n7,e.getFallback=()=>(je("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new fC(e)));let n=new t(e);super(n,e),this.library=new s7,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};var xJe=k.BRDF_GGX,yJe=k.BRDF_Lambert,vJe=k.BasicPointShadowFilter,bJe=k.BasicShadowFilter,wJe=k.Break,SJe=k.Const,TJe=k.Continue,EJe=k.DFGLUT,MJe=k.D_GGX,CJe=k.Discard,RJe=k.EPSILON,PJe=k.F_Schlick,Oee=k.Fn,IJe=k.INFINITY,Bee=k.If,Uee=k.Loop,NJe=k.NodeAccess,LJe=k.NodeShaderStage,DJe=k.NodeType,FJe=k.NodeUpdateType,OJe=k.PCFShadowFilter,BJe=k.PCFSoftShadowFilter,UJe=k.PI,kJe=k.PI2,GJe=k.TWO_PI,zJe=k.HALF_PI,VJe=k.PointShadowFilter,qJe=k.Return,HJe=k.Schlick_to_F0,WJe=k.ShaderNode,jJe=k.Stack,XJe=k.Switch,$Je=k.TBNViewMatrix,YJe=k.VSMShadowFilter,ZJe=k.V_GGX_SmithCorrelated,KJe=k.Var,QJe=k.VarIntent,JJe=k.abs,eet=k.acesFilmicToneMapping,tet=k.acos,net=k.acosh,iet=k.add,ret=k.addMethodChaining,set=k.addNodeElement,oet=k.agxToneMapping,aet=k.all,cet=k.alphaT,uet=k.ambientOcclusion,het=k.and,fet=k.anisotropy,det=k.anisotropyB,pet=k.anisotropyT,Aet=k.any,met=k.append,get=k.array,kee=k.asin,_et=k.asinh,xet=k.assign,yet=k.atan,vet=k.atanh,bet=k.atomicAdd,wet=k.atomicAnd,Tet=k.atomicFunc,Eet=k.atomicLoad,Met=k.atomicMax,Cet=k.atomicMin,Ret=k.atomicOr,Pet=k.atomicStore,Iet=k.atomicSub,Net=k.atomicXor,Let=k.attenuationColor,Det=k.attenuationDistance,Fet=k.attribute,Oet=k.attributeArray,Bet=k.backgroundBlurriness,Uet=k.backgroundIntensity,ket=k.backgroundRotation,Get=k.batch,zet=k.bentNormalView,Vet=k.billboarding,qet=k.bitAnd,Het=k.bitNot,Wet=k.bitOr,jet=k.bitXor,Xet=k.bitangentGeometry,$et=k.bitangentLocal,Yet=k.bitangentView,Zet=k.bitangentWorld,Ket=k.bitcast,Qet=k.blendBurn,Jet=k.blendColor,ett=k.blendDodge,ttt=k.blendOverlay,ntt=k.blendScreen,itt=k.blur,rtt=k.bool,stt=k.buffer,ott=k.bufferAttribute,att=k.bumpMap,ltt=k.builtin,ctt=k.builtinAOContext,utt=k.builtinShadowContext,htt=k.bvec2,ftt=k.bvec3,dtt=k.bvec4,ptt=k.bypass,Att=k.cache,mtt=k.call,gtt=k.cameraFar,_tt=k.cameraIndex,xtt=k.cameraNear,ytt=k.cameraNormalMatrix,vtt=k.cameraPosition,btt=k.cameraProjectionMatrix,wtt=k.cameraProjectionMatrixInverse,Stt=k.cameraViewMatrix,Ttt=k.cameraViewport,Ett=k.cameraWorldMatrix,Mtt=k.cbrt,Ctt=k.cdl,Rtt=k.ceil,Ptt=k.checker,Itt=k.cineonToneMapping,Ntt=k.clamp,Ltt=k.clearcoat,Dtt=k.clearcoatNormalView,Ftt=k.clearcoatRoughness,Ott=k.clipSpace,Btt=k.code,Utt=k.color,ktt=k.colorSpaceToWorking,Gtt=k.colorToDirection,ztt=k.compute,Vtt=k.computeKernel,qtt=k.computeSkinning,Htt=k.context,Wtt=k.convert,jtt=k.convertColorSpace,Xtt=k.convertToTexture,$tt=k.countLeadingZeros,Ytt=k.countOneBits,Ztt=k.countTrailingZeros,Gee=k.cos,Ktt=k.cosh,Qtt=k.cross,Jtt=k.cubeTexture,ent=k.cubeTextureBase,tnt=k.dFdx,nnt=k.dFdy,int=k.dashSize,rnt=k.debug,snt=k.decrement,ont=k.decrementBefore,ant=k.defaultBuildStages,lnt=k.defaultShaderStages,cnt=k.defined,unt=k.degrees,hnt=k.deltaTime,fnt=k.densityFog,dnt=k.densityFogFactor,pnt=k.depth,Ant=k.depthPass,mnt=k.determinant,gnt=k.difference,_nt=k.diffuseColor,xnt=k.directPointLight,ynt=k.directionToColor,vnt=k.directionToFaceDirection,bnt=k.dispersion,wnt=k.distance,Snt=k.div,Tnt=k.dot,Ent=k.drawIndex,Mnt=k.dynamicBufferAttribute,Cnt=k.element,Rnt=k.emissive,Pnt=k.equal,Int=k.equirectDirection,Nnt=k.equirectUV,zee=k.exp,Lnt=k.exp2,Dnt=k.exponentialHeightFogFactor,Fnt=k.expression,Ont=k.faceDirection,Bnt=k.faceForward,Unt=k.faceforward,Vee=k.float,knt=k.floatBitsToInt,Gnt=k.floatBitsToUint,znt=k.floor,Vnt=k.fog,qnt=k.fract,Hnt=k.frameGroup,Wnt=k.frameId,jnt=k.frontFacing,Xnt=k.fwidth,$nt=k.gain,Ynt=k.gapSize,Znt=k.getConstNodeType,Knt=k.getCurrentStack,Qnt=k.getDirection,Jnt=k.getDistanceAttenuation,eit=k.getGeometryRoughness,tit=k.getNormalFromDepth,nit=k.interleavedGradientNoise,iit=k.vogelDiskSample,rit=k.getParallaxCorrectNormal,sit=k.getRoughness,oit=k.getScreenPosition,ait=k.getShIrradianceAt,lit=k.getShadowMaterial,cit=k.getShadowRenderObjectFunction,uit=k.getTextureIndex,hit=k.getViewPosition,fit=k.globalId,dit=k.glsl,pit=k.glslFn,Ait=k.grayscale,mit=k.greaterThan,git=k.greaterThanEqual,_it=k.hash,xit=k.highpModelNormalViewMatrix,yit=k.highpModelViewMatrix,vit=k.hue,bit=k.increment,wit=k.incrementBefore,Sit=k.instance,qee=k.instanceIndex,Tit=k.instancedArray,Eit=k.instancedBufferAttribute,Mit=k.instancedDynamicBufferAttribute,Cit=k.instancedMesh,Rit=k.int,Pit=k.intBitsToFloat,Iit=k.inverse,Nit=k.inverseSqrt,Lit=k.inversesqrt,Dit=k.invocationLocalIndex,Fit=k.invocationSubgroupIndex,Oit=k.ior,Bit=k.iridescence,Uit=k.iridescenceIOR,kit=k.iridescenceThickness,Git=k.ivec2,zit=k.ivec3,Vit=k.ivec4,qit=k.js,Hit=k.label,Wit=k.length,jit=k.lengthSq,Xit=k.lessThan,$it=k.lessThanEqual,Yit=k.lightPosition,Zit=k.lightProjectionUV,Kit=k.lightShadowMatrix,Qit=k.lightTargetDirection,Jit=k.lightTargetPosition,ert=k.lightViewPosition,trt=k.lightingContext,nrt=k.lights,irt=k.linearDepth,rrt=k.linearToneMapping,srt=k.localId,ort=k.log,art=k.log2,lrt=k.logarithmicDepthToViewZ,crt=k.luminance,urt=k.mat2,hrt=k.mat3,frt=k.mat4,drt=k.matcapUV,prt=k.materialAO,Art=k.materialAlphaTest,mrt=k.materialAnisotropy,grt=k.materialAnisotropyVector,_rt=k.materialAttenuationColor,xrt=k.materialAttenuationDistance,yrt=k.materialClearcoat,vrt=k.materialClearcoatNormal,brt=k.materialClearcoatRoughness,wrt=k.materialColor,Srt=k.materialDispersion,Trt=k.materialEmissive,Ert=k.materialEnvIntensity,Mrt=k.materialEnvRotation,Crt=k.materialIOR,Rrt=k.materialIridescence,Prt=k.materialIridescenceIOR,Irt=k.materialIridescenceThickness,Nrt=k.materialLightMap,Lrt=k.materialLineDashOffset,Drt=k.materialLineDashSize,Frt=k.materialLineGapSize,Ort=k.materialLineScale,Brt=k.materialLineWidth,Urt=k.materialMetalness,krt=k.materialNormal,Grt=k.materialOpacity,zrt=k.materialPointSize,Vrt=k.materialReference,qrt=k.materialReflectivity,Hrt=k.materialRefractionRatio,Wrt=k.materialRotation,jrt=k.materialRoughness,Xrt=k.materialSheen,$rt=k.materialSheenRoughness,Yrt=k.materialShininess,Zrt=k.materialSpecular,Krt=k.materialSpecularColor,Qrt=k.materialSpecularIntensity,Jrt=k.materialSpecularStrength,est=k.materialThickness,tst=k.materialTransmission,nst=k.max,ist=k.maxMipLevel,rst=k.mediumpModelViewMatrix,sst=k.metalness,ost=k.min,ast=k.mix,lst=k.mixElement,cst=k.mod,ust=k.modelDirection,hst=k.modelNormalMatrix,fst=k.modelPosition,dst=k.modelRadius,pst=k.modelScale,Ast=k.modelViewMatrix,mst=k.modelViewPosition,gst=k.modelViewProjection,_st=k.modelWorldMatrix,xst=k.modelWorldMatrixInverse,yst=k.morphReference,vst=k.mrt,bst=k.mul,wst=k.mx_aastep,Sst=k.mx_add,Tst=k.mx_atan2,Est=k.mx_cell_noise_float,Mst=k.mx_contrast,Cst=k.mx_divide,Rst=k.mx_fractal_noise_float,Pst=k.mx_fractal_noise_vec2,Ist=k.mx_fractal_noise_vec3,Nst=k.mx_fractal_noise_vec4,Lst=k.mx_frame,Dst=k.mx_heighttonormal,Fst=k.mx_hsvtorgb,Ost=k.mx_ifequal,Bst=k.mx_ifgreater,Ust=k.mx_ifgreatereq,kst=k.mx_invert,Gst=k.mx_modulo,zst=k.mx_multiply,Vst=k.mx_noise_float,qst=k.mx_noise_vec3,Hst=k.mx_noise_vec4,Wst=k.mx_place2d,jst=k.mx_power,Xst=k.mx_ramp4,$st=k.mx_ramplr,Yst=k.mx_ramptb,Zst=k.mx_rgbtohsv,Kst=k.mx_rotate2d,Qst=k.mx_rotate3d,Jst=k.mx_safepower,eot=k.mx_separate,tot=k.mx_splitlr,not=k.mx_splittb,iot=k.mx_srgb_texture_to_lin_rec709,rot=k.mx_subtract,sot=k.mx_timer,oot=k.mx_transform_uv,aot=k.mx_unifiednoise2d,lot=k.mx_unifiednoise3d,cot=k.mx_worley_noise_float,uot=k.mx_worley_noise_vec2,hot=k.mx_worley_noise_vec3,Hee=k.negate,fot=k.negateOnBackSide,dot=k.neutralToneMapping,pot=k.nodeArray,Aot=k.nodeImmutable,mot=k.nodeObject,got=k.nodeObjectIntent,_ot=k.nodeObjects,xot=k.nodeProxy,yot=k.nodeProxyIntent,vot=k.normalFlat,bot=k.normalGeometry,wot=k.normalLocal,Sot=k.normalMap,Tot=k.normalView,Eot=k.normalViewGeometry,Mot=k.normalWorld,Cot=k.normalWorldGeometry,Rot=k.normalize,Pot=k.not,Iot=k.notEqual,Not=k.numWorkgroups,Lot=k.objectDirection,Dot=k.objectGroup,Fot=k.objectPosition,Oot=k.objectRadius,Bot=k.objectScale,Uot=k.objectViewPosition,kot=k.objectWorldMatrix,Got=k.OnBeforeObjectUpdate,zot=k.OnBeforeMaterialUpdate,Vot=k.OnObjectUpdate,qot=k.OnMaterialUpdate,Hot=k.oneMinus,Wot=k.or,jot=k.orthographicDepthToViewZ,Xot=k.oscSawtooth,$ot=k.oscSine,Yot=k.oscSquare,Zot=k.oscTriangle,Kot=k.output,Qot=k.outputStruct,Jot=k.overloadingFn,eat=k.overrideNode,tat=k.overrideNodes,nat=k.packHalf2x16,iat=k.packSnorm2x16,rat=k.packUnorm2x16,sat=k.packNormalToRGB,oat=k.parabola,aat=k.parallaxDirection,lat=k.parallaxUV,cat=k.parameter,uat=k.pass,hat=k.passTexture,fat=k.pcurve,dat=k.perspectiveDepthToViewZ,pat=k.pmremTexture,Aat=k.pointShadow,mat=k.pointUV,gat=k.pointWidth,_at=k.positionGeometry,xat=k.positionLocal,yat=k.positionPrevious,vat=k.positionView,bat=k.positionViewDirection,wat=k.positionWorld,Sat=k.positionWorldDirection,Tat=k.posterize,Eat=k.pow,Mat=k.pow2,Cat=k.pow3,Rat=k.pow4,Pat=k.premultiplyAlpha,Iat=k.property,Nat=k.radians,Lat=k.rand,Dat=k.range,Fat=k.rangeFog,Oat=k.rangeFogFactor,Bat=k.reciprocal,Uat=k.reference,kat=k.referenceBuffer,Gat=k.reflect,zat=k.reflectVector,Vat=k.reflectView,qat=k.reflector,Hat=k.refract,Wat=k.refractVector,jat=k.refractView,Xat=k.reinhardToneMapping,$at=k.remap,Yat=k.remapClamp,Zat=k.renderGroup,Kat=k.renderOutput,Qat=k.rendererReference,Jat=k.replaceDefaultUV,elt=k.rotate,tlt=k.rotateUV,nlt=k.roughness,ilt=k.round,rlt=k.rtt,slt=k.sRGBTransferEOTF,olt=k.sRGBTransferOETF,alt=k.sample,llt=k.sampler,clt=k.samplerComparison,ult=k.saturate,hlt=k.saturation,flt=k.screen,dlt=k.screenCoordinate,plt=k.screenDPR,Alt=k.screenSize,mlt=k.screenUV,glt=k.select,_lt=k.setCurrentStack,xlt=k.setName,ylt=k.shaderStages,vlt=k.shadow,blt=k.shadowPositionWorld,wlt=k.shapeCircle,Slt=k.sharedUniformGroup,Tlt=k.sheen,Elt=k.sheenRoughness,Mlt=k.shiftLeft,Clt=k.shiftRight,Rlt=k.shininess,Plt=k.sign,Wee=k.sin,Ilt=k.sinh,Nlt=k.sinc,Llt=k.skinning,Dlt=k.smoothstep,Flt=k.smoothstepElement,Olt=k.specularColor,Blt=k.specularF90,Ult=k.spherizeUV,klt=k.split,Glt=k.spritesheetUV,jee=k.sqrt,zlt=k.stack,Vlt=k.step,qlt=k.stepElement,Xee=k.storage,Hlt=k.storageBarrier,Wlt=k.storageTexture,jlt=k.storageTexture3D,Xlt=k.struct,$lt=k.sub,Ylt=k.subgroupAdd,Zlt=k.subgroupAll,Klt=k.subgroupAnd,Qlt=k.subgroupAny,Jlt=k.subgroupBallot,ect=k.subgroupBroadcast,tct=k.subgroupBroadcastFirst,nct=k.subBuild,ict=k.subgroupElect,rct=k.subgroupExclusiveAdd,sct=k.subgroupExclusiveMul,oct=k.subgroupInclusiveAdd,act=k.subgroupInclusiveMul,lct=k.subgroupIndex,cct=k.subgroupMax,uct=k.subgroupMin,hct=k.subgroupMul,fct=k.subgroupOr,dct=k.subgroupShuffle,pct=k.subgroupShuffleDown,Act=k.subgroupShuffleUp,mct=k.subgroupShuffleXor,gct=k.subgroupSize,_ct=k.subgroupXor,xct=k.tan,yct=k.tanh,vct=k.tangentGeometry,bct=k.tangentLocal,wct=k.tangentView,Sct=k.tangentWorld,Tct=k.texture,Ect=k.texture3D,Mct=k.textureBarrier,Cct=k.textureBicubic,Rct=k.textureBicubicLevel,Pct=k.textureCubeUV,Ict=k.textureLoad,Nct=k.textureSize,Lct=k.textureLevel,Dct=k.textureStore,Fct=k.thickness,Oct=k.time,Bct=k.toneMapping,Uct=k.toneMappingExposure,kct=k.toonOutlinePass,Gct=k.transformDirection,zct=k.transformNormal,Vct=k.transformNormalByInverseViewMatrix,qct=k.transformNormalByViewMatrix,Hct=k.transformNormalToView,Wct=k.transformedClearcoatNormalView,jct=k.transformedNormalView,Xct=k.transformedNormalWorld,$ct=k.transmission,Yct=k.transpose,Zct=k.triNoise3D,Kct=k.triplanarTexture,Qct=k.triplanarTextures,Jct=k.trunc,eut=k.uint,tut=k.uintBitsToFloat,$ee=k.uniform,nut=k.uniformArray,iut=k.uniformCubeTexture,rut=k.uniformGroup,sut=k.uniformFlow,out=k.uniformTexture,aut=k.unpackHalf2x16,lut=k.unpackSnorm2x16,cut=k.unpackUnorm2x16,uut=k.unpackRGBToNormal,hut=k.unpremultiplyAlpha,fut=k.userData,dut=k.uv,put=k.uvec2,Aut=k.uvec3,mut=k.uvec4,gut=k.varying,_ut=k.varyingProperty,xut=k.vec2,yut=k.vec3,vut=k.vec4,but=k.vectorComponents,wut=k.velocity,Sut=k.vertexColor,Tut=k.vertexIndex,Eut=k.vertexStage,Mut=k.vibrance,Cut=k.viewZToLogarithmicDepth,Rut=k.viewZToOrthographicDepth,Put=k.viewZToPerspectiveDepth,Iut=k.viewZToReversedOrthographicDepth,Nut=k.viewZToReversedPerspectiveDepth,Lut=k.viewport,Dut=k.viewportCoordinate,Fut=k.viewportDepthTexture,Out=k.viewportLinearDepth,But=k.viewportMipTexture,Uut=k.viewportOpaqueMipTexture,kut=k.viewportResolution,Gut=k.viewportSafeUV,zut=k.viewportSharedTexture,Vut=k.viewportSize,qut=k.viewportTexture,Hut=k.viewportUV,Wut=k.wgsl,jut=k.wgslFn,Xut=k.workgroupArray,$ut=k.workgroupBarrier,Yut=k.workgroupId,Zut=k.workingToColorSpace,Kut=k.xor;var Yee=new fa,ZC=new ie,G1=class extends jy{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 kn(e,3)),this.setAttribute("uv",new kn(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 Gu(t,6,1);return this.setAttribute("instanceStart",new mo(n,3,0)),this.setAttribute("instanceEnd",new mo(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 Gu(t,6,1);return this.setAttribute("instanceColorStart",new mo(n,3,0)),this.setAttribute("instanceColorEnd",new mo(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 Ly(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new fa);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Yee.setFromBufferAttribute(t),this.boundingBox.union(Yee))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ha),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++)ZC.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(ZC)),ZC.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(ZC));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}};ga.line={uniforms:VA.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===Nf){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:dm.Add},n={srcFactor:p,dstFactor:x,operation:dm.Add}};if(l)switch(r){case os:c(si.One,si.OneMinusSrcAlpha,si.One,si.OneMinusSrcAlpha);break;case Vu:c(si.One,si.One,si.One,si.One);break;case qu:c(si.Zero,si.OneMinusSrc,si.Zero,si.One);break;case Hu: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 Vu:c(si.SrcAlpha,si.One,si.One,si.One);break;case qu:Ge(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case Hu: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 Hc:t=si.Zero;break;case n2:t=si.One;break;case i2:t=si.Src;break;case r2:t=si.OneMinusSrc;break;case Gd:t=si.SrcAlpha;break;case zd:t=si.OneMinusSrcAlpha;break;case a2:t=si.Dst;break;case l2:t=si.OneMinusDst;break;case s2:t=si.DstAlpha;break;case o2:t=si.OneMinusDstAlpha;break;case c2:t=si.SrcAlphaSaturated;break;case G2e:t=si.Constant;break;case z2e:t=si.OneMinusConstant;break;default:Ge("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,n=e.stencilFunc;switch(n){case cL:t=bo.Never;break;case xy:t=bo.Always;break;case uL:t=bo.Less;break;case fL:t=bo.LessEqual;break;case hL:t=bo.Equal;break;case AL:t=bo.GreaterEqual;break;case dL:t=bo.Greater;break;case pL:t=bo.NotEqual;break;default:Ge("WebGPURenderer: Invalid stencil function.",n)}return t}_getStencilOperation(e){let t;switch(e){case vf:t=Hp.Keep;break;case nL:t=Hp.Zero;break;case iL:t=Hp.Replace;break;case lL:t=Hp.Invert;break;case rL:t=Hp.IncrementClamp;break;case sL:t=Hp.DecrementClamp;break;case oL:t=Hp.IncrementWrap;break;case aL:t=Hp.DecrementWrap;break;default:Ge("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case ks:t=dm.Add;break;case e2:t=dm.Subtract;break;case t2:t=dm.ReverseSubtract;break;case HT:t=dm.Min;break;case WT:t=dm.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?mC.Uint16:mC.Uint32);let o=n.side===ui;return e.isMesh&&e.matrixWorld.determinantAffine()<0&&(o=!o),r.frontFace=o===!0?mZ.CW:mZ.CCW,r.cullMode=n.side===ir?gZ.None:gZ.Back,r}_getColorWriteMask(e){return e.colorWrite===!0?_Z.All:_Z.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=bo.Always;else{let n=this.backend.parameters.reversedDepthBuffer?S2[e.depthFunc]:e.depthFunc;switch(n){case uA:t=bo.Never;break;case hA:t=bo.Always;break;case fA:t=bo.Less;break;case Uu:t=bo.LessEqual;break;case dA:t=bo.Equal;break;case pA:t=bo.GreaterEqual;break;case AA:t=bo.Greater;break;case mA:t=bo.NotEqual;break;default:Ge("WebGPUPipelineUtils: Invalid depth function.",n)}}return t}},wC=class{constructor(){this.label="",this.type=void 0,this.count=0}reset(){this.label="",this.type=void 0,this.count=0}},xh=new l0,n3e=new Bm,kv=new wC,n7=class extends pC{constructor(e,t,n=2048){super(n),this.device=e,this.type=t,kv.label=`queryset_global_timestamp_${t}`,kv.type="timestamp",kv.count=this.maxQueries,this.querySet=this.device.createQuerySet(kv),kv.reset();let r=this.maxQueries*8;xh.label=`buffer_timestamp_resolve_${t}`,xh.size=r,xh.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(xh),xh.reset(),xh.label=`buffer_timestamp_result_${t}`,xh.size=r,xh.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(xh),xh.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(n3e);r.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),r.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,n);let s=r.finish();if(wh(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}}},i7=class{constructor(){this.label="",this.timestampWrites=void 0}reset(){this.label="",this.timestampWrites=void 0}},y1=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}},r7=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}},Jc={r:0,g:0,b:0,a:1},El=new l0,wa=new Bm,nM=new i7,Gv=new wC,iM=new vC,rM=new r7,lc=new F1,yh=new F1,hr=new _b,Hf=new bC,s7=class extends dC{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 OB(this),this.attributeUtils=new YB(this),this.bindingUtils=new KB(this),this.capabilities=new QB(this),this.pipelineUtils=new t7(this),this.textureUtils=new HB(this),this.occludedResolveCache=new Map;let t=typeof navigator>"u"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[Ff.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(gC),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(gC.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===Li?"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 Cm,s.colorAttachments.push(new Mm),e.depth===!0||e.stencil===!0){let l=new y1;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:wo.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=wo.TwoD,n.isRenderTarget3D)p=e.activeCubeFace,hr.baseArrayLayer=0,hr.dimension=wo.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=wo.TwoD;let R=S.texture.createView(hr);f.push({view:R,resolveTarget:void 0,depthSlice:void 0})}}else hr.dimension=wo.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 Mm;T.view=S.view,T.depthSlice=S.depthSlice,T.resolveTarget=S.resolveTarget,v.push(T)}if(l={textureViews:f,colorAttachments:v,descriptor:new Cm},e.depth){let w=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(hr.dimension=wo.TwoD,hr.arrayLayerCount=1,hr.baseArrayLayer=e.activeCubeFace);let S=new y1;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||Ei.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,Gv.label=`occlusionQuerySet_${e.id}`,Gv.type="occlusion",Gv.count=r,s=n.createQuerySet(Gv),Gv.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:Ei.Load}),this.initTimestampQuery(nc.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:(Jc.r=0,Jc.g=0,Jc.b=0,Jc.a=1,f.clearValue=Jc),f.loadOp=Ei.Clear):f.loadOp=Ei.Load,f.storeOp=Sa.Store}}else{let c=o.colorAttachments[0];e.clearColor?(c.clearValue=e.clearColorValue,c.loadOp=Ei.Clear):c.loadOp=Ei.Load,c.storeOp=Sa.Store}e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Ei.Clear):a.depthLoadOp=Ei.Load,a.depthStoreOp=Sa.Store),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Ei.Clear):a.stencilLoadOp=Ei.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 Mm;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 Cm;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=wo.TwoD,hr.baseArrayLayer=a,hr.arrayLayerCount=1,o.viewCache[f]=o.texture.createView(hr),hr.reset());let p=new y1;p.view=o.viewCache[f],p.depthLoadOp=s.depthLoadOp||Ei.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 y1;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=Ei.Clear):o.depthLoadOp=Ei.Load),e.stencil&&(e.clearStencil?(o.stencilClearValue=e.clearStencilValue,o.stencilLoadOp=Ei.Clear):o.stencilLoadOp=Ei.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&&(El.size=s,El.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,o=this.device.createBuffer(El),El.reset(),this.occludedResolveCache.set(s,o)),El.size=s,El.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let a=this.device.createBuffer(El);El.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(wh(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();Jc.r=x.r,Jc.g=x.g,Jc.b=x.b,Jc.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=Jc,v.loadOp=Ei.Clear,v.storeOp=Sa.Store}(c||u)&&(l=x.depthStencilAttachment)}else{c=r.depth,u=r.stencil;let x={loadOp:e?Ei.Clear:Ei.Load,clearValue:e?Jc:void 0};c&&(x.depthLoadOp=t?Ei.Clear:Ei.Load,x.depthClearValue=t?o.getClearDepth():void 0,x.depthStoreOp=Sa.Store),u&&(x.stencilLoadOp=n?Ei.Clear:Ei.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=Ei.Clear,l.depthClearValue=o.getClearDepth(),l.depthStoreOp=Sa.Store):(l.depthLoadOp=Ei.Load,l.depthStoreOp=Sa.Store)),u&&l&&(n?(l.stencilLoadOp=Ei.Clear,l.stencilClearValue=o.getClearStencil(),l.stencilStoreOp=Sa.Store):(l.stencilLoadOp=Ei.Load,l.stencilStoreOp=Sa.Store)),wa.label="clear";let f=s.createCommandEncoder(wa);wa.reset(),f.beginRenderPass({colorAttachments:a,depthStencilAttachment:l}).end(),wh(s,f.finish())}beginCompute(e){let t=this.get(e),n="computeGroup_"+e.id;nM.label=n,wa.label=n,this.initTimestampQuery(nc.COMPUTE,this.getTimestampUID(e),nM),t.cmdEncoderGPU=this.device.createCommandEncoder(wa),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(nM),t.currentPipeline=null,wa.reset(),nM.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(),wh(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?mC.Uint16:mC.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 n7(this.device,e,2048));let r=this.timestampQueryPool[e],s=r.allocateQueriesForContext(t);rM.querySet=r.querySet,rM.beginningOfPassWriteIndex=s,rM.endOfPassWriteIndex=s+1,n.timestampWrites=rM}createNodeBuilder(e,t){return new $B(e,t)}createProgram(e){let t=this.get(e);iM.label=e.stage+(e.name!==""?`_${e.name}`:""),iM.code=e.code,t.module={module:this.device.createShaderModule(iM),entryPoint:"main"},iM.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&Rh.VERTEX&&s.push("vertex"),e.visibility&Rh.FRAGMENT&&s.push("fragment"),e.visibility&Rh.COMPUTE&&s.push("compute");let o=`(${s.join(",")})`;El.label=`bindingBuffer${e.id}_${e.name}_${o}`,El.size=n,El.usage=r;let a=this.device.createBuffer(El);El.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 vZ[e]!==void 0&&(e=vZ[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;lc.texture=T,lc.mipLevel=s,lc.origin.x=u,lc.origin.y=f,lc.origin.z=p,yh.texture=P,yh.mipLevel=o,yh.origin.x=a,yh.origin.y=l,yh.origin.z=c,Hf.width=x,Hf.height=v,Hf.depthOrArrayLayers=w,S.copyTextureToTexture(lc,yh,Hf),lc.reset(),yh.reset(),Hf.reset(),wh(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()),lc.texture=s,lc.origin.x=n.x,lc.origin.y=n.y,yh.texture=o,Hf.width=n.z,Hf.height=n.w,a.copyTextureToTexture(lc,yh,Hf),lc.reset(),yh.reset(),Hf.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=Ei.Load;t.depth&&(l.depthStencilAttachment.depthLoadOp=Ei.Load),t.stencil&&(l.depthStencilAttachment.stencilLoadOp=Ei.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 wh(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()}},o7=class extends CA{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}},a7=class extends CA{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}},l7=class extends sC{constructor(){super(),this.addMaterial(IF,"MeshPhongMaterial"),this.addMaterial(BM,"MeshStandardMaterial"),this.addMaterial(kF,"MeshPhysicalMaterial"),this.addMaterial(zF,"MeshToonMaterial"),this.addMaterial(RF,"MeshBasicMaterial"),this.addMaterial(PF,"MeshLambertMaterial"),this.addMaterial(TF,"MeshNormalMaterial"),this.addMaterial(VF,"MeshMatcapMaterial"),this.addMaterial(bF,"LineBasicMaterial"),this.addMaterial(wF,"LineDashedMaterial"),this.addMaterial(HF,"PointsMaterial"),this.addMaterial(UM,"SpriteMaterial"),this.addMaterial(jF,"ShadowMaterial"),this.addLight(OO,Wy),this.addLight(oB,RA),this.addLight(hB,jy),this.addLight(pb,CA),this.addLight(sB,PA),this.addLight(aB,qy),this.addLight(cB,Xy),this.addLight(lB,o7),this.addLight(uB,a7),this.addToneMapping(ree,u2),this.addToneMapping(see,h2),this.addToneMapping(oee,f2),this.addToneMapping(aee,d2),this.addToneMapping(lee,p2),this.addToneMapping(cee,A2)}},O1=class extends yB{constructor(e={}){let t;e.forceWebGL?t=AC:(t=s7,e.getFallback=()=>(je("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new AC(e)));let n=new t(e);super(n,e),this.library=new l7,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}};var RJe=k.BRDF_GGX,PJe=k.BRDF_Lambert,IJe=k.BasicPointShadowFilter,NJe=k.BasicShadowFilter,LJe=k.Break,DJe=k.Const,FJe=k.Continue,OJe=k.DFGLUT,BJe=k.D_GGX,UJe=k.Discard,kJe=k.EPSILON,GJe=k.F_Schlick,Gee=k.Fn,zJe=k.INFINITY,zee=k.If,Vee=k.Loop,VJe=k.NodeAccess,qJe=k.NodeShaderStage,HJe=k.NodeType,WJe=k.NodeUpdateType,jJe=k.PCFShadowFilter,XJe=k.PCFSoftShadowFilter,$Je=k.PI,YJe=k.PI2,ZJe=k.TWO_PI,KJe=k.HALF_PI,QJe=k.PointShadowFilter,JJe=k.Return,eet=k.Schlick_to_F0,tet=k.ShaderNode,net=k.Stack,iet=k.Switch,ret=k.TBNViewMatrix,set=k.VSMShadowFilter,oet=k.V_GGX_SmithCorrelated,aet=k.Var,cet=k.VarIntent,uet=k.abs,het=k.acesFilmicToneMapping,fet=k.acos,det=k.acosh,pet=k.add,Aet=k.addMethodChaining,met=k.addNodeElement,get=k.agxToneMapping,_et=k.all,xet=k.alphaT,yet=k.ambientOcclusion,vet=k.and,bet=k.anisotropy,wet=k.anisotropyB,Tet=k.anisotropyT,Eet=k.any,Met=k.append,Cet=k.array,qee=k.asin,Ret=k.asinh,Pet=k.assign,Iet=k.atan,Net=k.atanh,Let=k.atomicAdd,Det=k.atomicAnd,Fet=k.atomicFunc,Oet=k.atomicLoad,Bet=k.atomicMax,Uet=k.atomicMin,ket=k.atomicOr,Get=k.atomicStore,zet=k.atomicSub,Vet=k.atomicXor,qet=k.attenuationColor,Het=k.attenuationDistance,Wet=k.attribute,jet=k.attributeArray,Xet=k.backgroundBlurriness,$et=k.backgroundIntensity,Yet=k.backgroundRotation,Zet=k.batch,Ket=k.bentNormalView,Qet=k.billboarding,Jet=k.bitAnd,ett=k.bitNot,ttt=k.bitOr,ntt=k.bitXor,itt=k.bitangentGeometry,rtt=k.bitangentLocal,stt=k.bitangentView,ott=k.bitangentWorld,att=k.bitcast,ltt=k.blendBurn,ctt=k.blendColor,utt=k.blendDodge,htt=k.blendOverlay,ftt=k.blendScreen,dtt=k.blur,ptt=k.bool,Att=k.buffer,mtt=k.bufferAttribute,gtt=k.bumpMap,_tt=k.builtin,xtt=k.builtinAOContext,ytt=k.builtinShadowContext,vtt=k.bvec2,btt=k.bvec3,wtt=k.bvec4,Stt=k.bypass,Ttt=k.cache,Ett=k.call,Mtt=k.cameraFar,Ctt=k.cameraIndex,Rtt=k.cameraNear,Ptt=k.cameraNormalMatrix,Itt=k.cameraPosition,Ntt=k.cameraProjectionMatrix,Ltt=k.cameraProjectionMatrixInverse,Dtt=k.cameraViewMatrix,Ftt=k.cameraViewport,Ott=k.cameraWorldMatrix,Btt=k.cbrt,Utt=k.cdl,ktt=k.ceil,Gtt=k.checker,ztt=k.cineonToneMapping,Vtt=k.clamp,qtt=k.clearcoat,Htt=k.clearcoatNormalView,Wtt=k.clearcoatRoughness,jtt=k.clipSpace,Xtt=k.code,$tt=k.color,Ytt=k.colorSpaceToWorking,Ztt=k.colorToDirection,Ktt=k.compute,Qtt=k.computeKernel,Jtt=k.computeSkinning,ent=k.context,tnt=k.convert,nnt=k.convertColorSpace,int=k.convertToTexture,rnt=k.countLeadingZeros,snt=k.countOneBits,ont=k.countTrailingZeros,Hee=k.cos,ant=k.cosh,lnt=k.cross,cnt=k.cubeTexture,unt=k.cubeTextureBase,hnt=k.dFdx,fnt=k.dFdy,dnt=k.dashSize,pnt=k.debug,Ant=k.decrement,mnt=k.decrementBefore,gnt=k.defaultBuildStages,_nt=k.defaultShaderStages,xnt=k.defined,ynt=k.degrees,vnt=k.deltaTime,bnt=k.densityFog,wnt=k.densityFogFactor,Snt=k.depth,Tnt=k.depthPass,Ent=k.determinant,Mnt=k.difference,Cnt=k.diffuseColor,Rnt=k.directPointLight,Pnt=k.directionToColor,Int=k.directionToFaceDirection,Nnt=k.dispersion,Lnt=k.distance,Dnt=k.div,Fnt=k.dot,Ont=k.drawIndex,Bnt=k.dynamicBufferAttribute,Unt=k.element,knt=k.emissive,Gnt=k.equal,znt=k.equirectDirection,Vnt=k.equirectUV,Wee=k.exp,qnt=k.exp2,Hnt=k.exponentialHeightFogFactor,Wnt=k.expression,jnt=k.faceDirection,Xnt=k.faceForward,$nt=k.faceforward,jee=k.float,Ynt=k.floatBitsToInt,Znt=k.floatBitsToUint,Knt=k.floor,Qnt=k.fog,Jnt=k.fract,eit=k.frameGroup,tit=k.frameId,nit=k.frontFacing,iit=k.fwidth,rit=k.gain,sit=k.gapSize,oit=k.getConstNodeType,ait=k.getCurrentStack,lit=k.getDirection,cit=k.getDistanceAttenuation,uit=k.getGeometryRoughness,hit=k.getNormalFromDepth,fit=k.interleavedGradientNoise,dit=k.vogelDiskSample,pit=k.getParallaxCorrectNormal,Ait=k.getRoughness,mit=k.getScreenPosition,git=k.getShIrradianceAt,_it=k.getShadowMaterial,xit=k.getShadowRenderObjectFunction,yit=k.getTextureIndex,vit=k.getViewPosition,bit=k.globalId,wit=k.glsl,Sit=k.glslFn,Tit=k.grayscale,Eit=k.greaterThan,Mit=k.greaterThanEqual,Cit=k.hash,Rit=k.highpModelNormalViewMatrix,Pit=k.highpModelViewMatrix,Iit=k.hue,Nit=k.increment,Lit=k.incrementBefore,Dit=k.instance,Xee=k.instanceIndex,Fit=k.instancedArray,Oit=k.instancedBufferAttribute,Bit=k.instancedDynamicBufferAttribute,Uit=k.instancedMesh,kit=k.int,Git=k.intBitsToFloat,zit=k.inverse,Vit=k.inverseSqrt,qit=k.inversesqrt,Hit=k.invocationLocalIndex,Wit=k.invocationSubgroupIndex,jit=k.ior,Xit=k.iridescence,$it=k.iridescenceIOR,Yit=k.iridescenceThickness,Zit=k.ivec2,Kit=k.ivec3,Qit=k.ivec4,Jit=k.js,ert=k.label,trt=k.length,nrt=k.lengthSq,irt=k.lessThan,rrt=k.lessThanEqual,srt=k.lightPosition,ort=k.lightProjectionUV,art=k.lightShadowMatrix,lrt=k.lightTargetDirection,crt=k.lightTargetPosition,urt=k.lightViewPosition,hrt=k.lightingContext,frt=k.lights,drt=k.linearDepth,prt=k.linearToneMapping,Art=k.localId,mrt=k.log,grt=k.log2,_rt=k.logarithmicDepthToViewZ,xrt=k.luminance,yrt=k.mat2,vrt=k.mat3,brt=k.mat4,wrt=k.matcapUV,Srt=k.materialAO,Trt=k.materialAlphaTest,Ert=k.materialAnisotropy,Mrt=k.materialAnisotropyVector,Crt=k.materialAttenuationColor,Rrt=k.materialAttenuationDistance,Prt=k.materialClearcoat,Irt=k.materialClearcoatNormal,Nrt=k.materialClearcoatRoughness,Lrt=k.materialColor,Drt=k.materialDispersion,Frt=k.materialEmissive,Ort=k.materialEnvIntensity,Brt=k.materialEnvRotation,Urt=k.materialIOR,krt=k.materialIridescence,Grt=k.materialIridescenceIOR,zrt=k.materialIridescenceThickness,Vrt=k.materialLightMap,qrt=k.materialLineDashOffset,Hrt=k.materialLineDashSize,Wrt=k.materialLineGapSize,jrt=k.materialLineScale,Xrt=k.materialLineWidth,$rt=k.materialMetalness,Yrt=k.materialNormal,Zrt=k.materialOpacity,Krt=k.materialPointSize,Qrt=k.materialReference,Jrt=k.materialReflectivity,est=k.materialRefractionRatio,tst=k.materialRotation,nst=k.materialRoughness,ist=k.materialSheen,rst=k.materialSheenRoughness,sst=k.materialShininess,ost=k.materialSpecular,ast=k.materialSpecularColor,lst=k.materialSpecularIntensity,cst=k.materialSpecularStrength,ust=k.materialThickness,hst=k.materialTransmission,fst=k.max,dst=k.maxMipLevel,pst=k.mediumpModelViewMatrix,Ast=k.metalness,mst=k.min,gst=k.mix,_st=k.mixElement,xst=k.mod,yst=k.modelDirection,vst=k.modelNormalMatrix,bst=k.modelPosition,wst=k.modelRadius,Sst=k.modelScale,Tst=k.modelViewMatrix,Est=k.modelViewPosition,Mst=k.modelViewProjection,Cst=k.modelWorldMatrix,Rst=k.modelWorldMatrixInverse,Pst=k.morphReference,Ist=k.mrt,Nst=k.mul,Lst=k.mx_aastep,Dst=k.mx_add,Fst=k.mx_atan2,Ost=k.mx_cell_noise_float,Bst=k.mx_contrast,Ust=k.mx_divide,kst=k.mx_fractal_noise_float,Gst=k.mx_fractal_noise_vec2,zst=k.mx_fractal_noise_vec3,Vst=k.mx_fractal_noise_vec4,qst=k.mx_frame,Hst=k.mx_heighttonormal,Wst=k.mx_hsvtorgb,jst=k.mx_ifequal,Xst=k.mx_ifgreater,$st=k.mx_ifgreatereq,Yst=k.mx_invert,Zst=k.mx_modulo,Kst=k.mx_multiply,Qst=k.mx_noise_float,Jst=k.mx_noise_vec3,eot=k.mx_noise_vec4,tot=k.mx_place2d,not=k.mx_power,iot=k.mx_ramp4,rot=k.mx_ramplr,sot=k.mx_ramptb,oot=k.mx_rgbtohsv,aot=k.mx_rotate2d,lot=k.mx_rotate3d,cot=k.mx_safepower,uot=k.mx_separate,hot=k.mx_splitlr,fot=k.mx_splittb,dot=k.mx_srgb_texture_to_lin_rec709,pot=k.mx_subtract,Aot=k.mx_timer,mot=k.mx_transform_uv,got=k.mx_unifiednoise2d,_ot=k.mx_unifiednoise3d,xot=k.mx_worley_noise_float,yot=k.mx_worley_noise_vec2,vot=k.mx_worley_noise_vec3,$ee=k.negate,bot=k.negateOnBackSide,wot=k.neutralToneMapping,Sot=k.nodeArray,Tot=k.nodeImmutable,Eot=k.nodeObject,Mot=k.nodeObjectIntent,Cot=k.nodeObjects,Rot=k.nodeProxy,Pot=k.nodeProxyIntent,Iot=k.normalFlat,Not=k.normalGeometry,Lot=k.normalLocal,Dot=k.normalMap,Fot=k.normalView,Oot=k.normalViewGeometry,Bot=k.normalWorld,Uot=k.normalWorldGeometry,kot=k.normalize,Got=k.not,zot=k.notEqual,Vot=k.numWorkgroups,qot=k.objectDirection,Hot=k.objectGroup,Wot=k.objectPosition,jot=k.objectRadius,Xot=k.objectScale,$ot=k.objectViewPosition,Yot=k.objectWorldMatrix,Zot=k.OnBeforeObjectUpdate,Kot=k.OnBeforeMaterialUpdate,Qot=k.OnObjectUpdate,Jot=k.OnMaterialUpdate,eat=k.oneMinus,tat=k.or,nat=k.orthographicDepthToViewZ,iat=k.oscSawtooth,rat=k.oscSine,sat=k.oscSquare,oat=k.oscTriangle,aat=k.output,lat=k.outputStruct,cat=k.overloadingFn,uat=k.overrideNode,hat=k.overrideNodes,fat=k.packHalf2x16,dat=k.packSnorm2x16,pat=k.packUnorm2x16,Aat=k.packNormalToRGB,mat=k.parabola,gat=k.parallaxDirection,_at=k.parallaxUV,xat=k.parameter,yat=k.pass,vat=k.passTexture,bat=k.pcurve,wat=k.perspectiveDepthToViewZ,Sat=k.pmremTexture,Tat=k.pointShadow,Eat=k.pointUV,Mat=k.pointWidth,Cat=k.positionGeometry,Rat=k.positionLocal,Pat=k.positionPrevious,Iat=k.positionView,Nat=k.positionViewDirection,Lat=k.positionWorld,Dat=k.positionWorldDirection,Fat=k.posterize,Oat=k.pow,Bat=k.pow2,Uat=k.pow3,kat=k.pow4,Gat=k.premultiplyAlpha,zat=k.property,Vat=k.radians,qat=k.rand,Hat=k.range,Wat=k.rangeFog,jat=k.rangeFogFactor,Xat=k.reciprocal,$at=k.reference,Yat=k.referenceBuffer,Zat=k.reflect,Kat=k.reflectVector,Qat=k.reflectView,Jat=k.reflector,elt=k.refract,tlt=k.refractVector,nlt=k.refractView,ilt=k.reinhardToneMapping,rlt=k.remap,slt=k.remapClamp,olt=k.renderGroup,alt=k.renderOutput,llt=k.rendererReference,clt=k.replaceDefaultUV,ult=k.rotate,hlt=k.rotateUV,flt=k.roughness,dlt=k.round,plt=k.rtt,Alt=k.sRGBTransferEOTF,mlt=k.sRGBTransferOETF,glt=k.sample,_lt=k.sampler,xlt=k.samplerComparison,ylt=k.saturate,vlt=k.saturation,blt=k.screen,wlt=k.screenCoordinate,Slt=k.screenDPR,Tlt=k.screenSize,Elt=k.screenUV,Mlt=k.select,Clt=k.setCurrentStack,Rlt=k.setName,Plt=k.shaderStages,Ilt=k.shadow,Nlt=k.shadowPositionWorld,Llt=k.shapeCircle,Dlt=k.sharedUniformGroup,Flt=k.sheen,Olt=k.sheenRoughness,Blt=k.shiftLeft,Ult=k.shiftRight,klt=k.shininess,Glt=k.sign,Yee=k.sin,zlt=k.sinh,Vlt=k.sinc,qlt=k.skinning,Hlt=k.smoothstep,Wlt=k.smoothstepElement,jlt=k.specularColor,Xlt=k.specularF90,$lt=k.spherizeUV,Ylt=k.split,Zlt=k.spritesheetUV,Zee=k.sqrt,Klt=k.stack,Qlt=k.step,Jlt=k.stepElement,Kee=k.storage,ect=k.storageBarrier,tct=k.storageTexture,nct=k.storageTexture3D,ict=k.struct,rct=k.sub,sct=k.subgroupAdd,oct=k.subgroupAll,act=k.subgroupAnd,lct=k.subgroupAny,cct=k.subgroupBallot,uct=k.subgroupBroadcast,hct=k.subgroupBroadcastFirst,fct=k.subBuild,dct=k.subgroupElect,pct=k.subgroupExclusiveAdd,Act=k.subgroupExclusiveMul,mct=k.subgroupInclusiveAdd,gct=k.subgroupInclusiveMul,_ct=k.subgroupIndex,xct=k.subgroupMax,yct=k.subgroupMin,vct=k.subgroupMul,bct=k.subgroupOr,wct=k.subgroupShuffle,Sct=k.subgroupShuffleDown,Tct=k.subgroupShuffleUp,Ect=k.subgroupShuffleXor,Mct=k.subgroupSize,Cct=k.subgroupXor,Rct=k.tan,Pct=k.tanh,Ict=k.tangentGeometry,Nct=k.tangentLocal,Lct=k.tangentView,Dct=k.tangentWorld,Fct=k.texture,Oct=k.texture3D,Bct=k.textureBarrier,Uct=k.textureBicubic,kct=k.textureBicubicLevel,Gct=k.textureCubeUV,zct=k.textureLoad,Vct=k.textureSize,qct=k.textureLevel,Hct=k.textureStore,Wct=k.thickness,jct=k.time,Xct=k.toneMapping,$ct=k.toneMappingExposure,Yct=k.toonOutlinePass,Zct=k.transformDirection,Kct=k.transformNormal,Qct=k.transformNormalByInverseViewMatrix,Jct=k.transformNormalByViewMatrix,eut=k.transformNormalToView,tut=k.transformedClearcoatNormalView,nut=k.transformedNormalView,iut=k.transformedNormalWorld,rut=k.transmission,sut=k.transpose,out=k.triNoise3D,aut=k.triplanarTexture,lut=k.triplanarTextures,cut=k.trunc,uut=k.uint,hut=k.uintBitsToFloat,Qee=k.uniform,fut=k.uniformArray,dut=k.uniformCubeTexture,put=k.uniformGroup,Aut=k.uniformFlow,mut=k.uniformTexture,gut=k.unpackHalf2x16,_ut=k.unpackSnorm2x16,xut=k.unpackUnorm2x16,yut=k.unpackRGBToNormal,vut=k.unpremultiplyAlpha,but=k.userData,wut=k.uv,Sut=k.uvec2,Tut=k.uvec3,Eut=k.uvec4,Mut=k.varying,Cut=k.varyingProperty,Rut=k.vec2,Put=k.vec3,Iut=k.vec4,Nut=k.vectorComponents,Lut=k.velocity,Dut=k.vertexColor,Fut=k.vertexIndex,Out=k.vertexStage,But=k.vibrance,Uut=k.viewZToLogarithmicDepth,kut=k.viewZToOrthographicDepth,Gut=k.viewZToPerspectiveDepth,zut=k.viewZToReversedOrthographicDepth,Vut=k.viewZToReversedPerspectiveDepth,qut=k.viewport,Hut=k.viewportCoordinate,Wut=k.viewportDepthTexture,jut=k.viewportLinearDepth,Xut=k.viewportMipTexture,$ut=k.viewportOpaqueMipTexture,Yut=k.viewportResolution,Zut=k.viewportSafeUV,Kut=k.viewportSharedTexture,Qut=k.viewportSize,Jut=k.viewportTexture,eht=k.viewportUV,tht=k.wgsl,nht=k.wgslFn,iht=k.workgroupArray,rht=k.workgroupBarrier,sht=k.workgroupId,oht=k.workingToColorSpace,aht=k.xor;var Jee=new da,JC=new ie,V1=class extends $y{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 In(e,3)),this.setAttribute("uv",new In(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 zu(t,6,1);return this.setAttribute("instanceStart",new go(n,3,0)),this.setAttribute("instanceEnd",new go(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 zu(t,6,1);return this.setAttribute("instanceColorStart",new go(n,3,0)),this.setAttribute("instanceColorEnd",new go(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 Fy(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),Jee.setFromBufferAttribute(t),this.boundingBox.union(Jee))}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++)JC.fromBufferAttribute(e,s),r=Math.max(r,n.distanceToSquared(JC)),JC.fromBufferAttribute(t,s),r=Math.max(r,n.distanceToSquared(JC));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:HA.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};`}},Xo=new o0,x8=new Fm,Fee=new Map([[Int8Array,["sint8","
50925092 #include <premultiplied_alpha_fragment>50935093 50945094 }5095- `};var h0=class extends Xr{constructor(e){super({type:"LineMaterial",uniforms:VA.clone(ga.line.uniforms),vertexShader:ga.line.vertexShader,fragmentShader:ga.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 DU=new gn,Zee=new ie,Kee=new ie,Mo=new gn,Co=new gn,Oh=new gn,FU=new ie,OU=new on,Ro=new $y,Qee=new ie,KC=new fa,QC=new Ha,Bh=new gn,Uh,zm;function Jee(i,e,t){return Bh.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),Bh.multiplyScalar(1/Bh.w),Bh.x=zm/t.width,Bh.y=zm/t.height,Bh.applyMatrix4(i.projectionMatrixInverse),Bh.multiplyScalar(1/Bh.w),Math.abs(Math.max(Bh.x,Bh.y))}function KTe(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++){Ro.start.fromBufferAttribute(r,a),Ro.end.fromBufferAttribute(s,a),Ro.applyMatrix4(t);let c=new ie,u=new ie;Uh.distanceSqToSegment(Ro.start,Ro.end,u,c),u.distanceTo(c)<zm*.5&&e.push({point:u,pointOnLine:c,distance:Uh.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function QTe(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;Uh.at(1,Oh),Oh.w=1,Oh.applyMatrix4(e.matrixWorldInverse),Oh.applyMatrix4(n),Oh.multiplyScalar(1/Oh.w),Oh.x*=s.x/2,Oh.y*=s.y/2,Oh.z=0,FU.copy(Oh),OU.multiplyMatrices(e.matrixWorldInverse,o);for(let p=0,x=u;p<x;p++){if(Mo.fromBufferAttribute(l,p),Co.fromBufferAttribute(c,p),Mo.w=1,Co.w=1,Mo.applyMatrix4(OU),Co.applyMatrix4(OU),Mo.z>f&&Co.z>f)continue;if(Mo.z>f){let R=Mo.z-Co.z,C=(Mo.z-f)/R;Mo.lerp(Co,C)}else if(Co.z>f){let R=Co.z-Mo.z,C=(Co.z-f)/R;Co.lerp(Mo,C)}Mo.applyMatrix4(n),Co.applyMatrix4(n),Mo.multiplyScalar(1/Mo.w),Co.multiplyScalar(1/Co.w),Mo.x*=s.x/2,Mo.y*=s.y/2,Co.x*=s.x/2,Co.y*=s.y/2,Ro.start.copy(Mo),Ro.start.z=0,Ro.end.copy(Co),Ro.end.z=0;let w=Ro.closestPointToPointParameter(FU,!0);Ro.at(w,Qee);let S=Wc.lerp(Mo.z,Co.z,w),T=S>=-1&&S<=1,P=FU.distanceTo(Qee)<zm*.5;if(T&&P){Ro.start.fromBufferAttribute(l,p),Ro.end.fromBufferAttribute(c,p),Ro.start.applyMatrix4(o),Ro.end.applyMatrix4(o);let R=new ie,C=new ie;Uh.distanceSqToSegment(Ro.start,Ro.end,C,R),t.push({point:C,pointOnLine:R,distance:Uh.origin.distanceTo(C),object:i,face:null,faceIndex:p,uv:null,uv1:null})}}}var JC=class extends Hn{constructor(e=new G1,t=new h0({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)Zee.fromBufferAttribute(t,o),Kee.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+Zee.distanceTo(Kee);let s=new Gu(r,2,1);return e.setAttribute("instanceDistanceStart",new mo(s,1,0)),e.setAttribute("instanceDistanceEnd",new mo(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;Uh=e.ray;let o=this.matrixWorld,a=this.geometry,l=this.material;zm=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),QC.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=zm*.5;else{let f=Math.max(r.near,QC.distanceToPoint(Uh.origin));c=Jee(r,f,l.resolution)}if(QC.radius+=c,Uh.intersectsSphere(QC)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),KC.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=zm*.5;else{let f=Math.max(r.near,KC.distanceToPoint(Uh.origin));u=Jee(r,f,l.resolution)}KC.expandByScalar(u),Uh.intersectsBox(KC)!==!1&&(n?KTe(this,t):QTe(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(DU),this.material.uniforms.resolution.value.set(DU.z,DU.w))}};var z1=class extends G1{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 eR=class extends JC{constructor(e=new z1,t=new h0({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}};var V1=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){let r=[],s=JTe(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}};function JTe(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=e3e(f,s,l,c,t);n=="tb"?(l=0,c+=t.ascender*s):l+=p.offsetX,a.push(p.path)}}return a}function e3e(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 Yy,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 Sb=class i extends Iy{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 V1(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 t3e(i){if(Array.isArray(i))return i}function n3e(i){if(Array.isArray(i))return zU(i)}function hte(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 i3e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function ete(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 r3e(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){ete(s,n,r,o,a,"next",l)}function a(l){ete(s,n,r,o,a,"throw",l)}o(void 0)})}}function aR(i,e,t){return e=j1(e),d3e(i,XU()?Reflect.construct(e,t||[],j1(i).constructor):e.apply(i,t))}function s3e(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function lR(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Tb(i,e){return i.get(hte(i,e))}function BU(i,e,t){s3e(i,e),e.set(i,t)}function UU(i,e,t){return i.set(hte(i,e),t),t}function jU(i,e,t){if(XU())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 o3e(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,fte(n.key),n)}}function cR(i,e,t){return e&&o3e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function ro(i,e,t){return(e=fte(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function VU(){return VU=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=p3e(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},VU.apply(null,arguments)}function j1(i){return j1=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},j1(i)}function uR(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&&HU(i,e)}function XU(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(XU=function(){return!!i})()}function a3e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function l3e(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 c3e(){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 u3e(){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 tte(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 Oi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?tte(Object(t),!0).forEach(function(n){ro(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):tte(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function h3e(i,e){if(i==null)return{};var t,n,r=f3e(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 f3e(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 d3e(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 i3e(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 Ll(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]())):(Ll(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,Ll(x,r,"GeneratorFunction")),x.prototype=Object.create(f),x}return l.prototype=c,Ll(f,"constructor",c),Ll(c,"constructor",l),l.displayName="GeneratorFunction",Ll(c,r,"GeneratorFunction"),Ll(f),Ll(f,r,"Generator"),Ll(f,n,function(){return this}),Ll(f,"toString",function(){return"[object Generator]"}),(qU=function(){return{w:s,m:p}})()}function Ll(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}Ll=function(s,o,a,l){function c(u,f){Ll(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))},Ll(i,e,t,n)}function HU(i,e){return HU=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},HU(i,e)}function Ar(i,e){return t3e(i)||l3e(i,e)||dte(i,e)||c3e()}function p3e(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=j1(i))!==null;);return i}function kU(i,e,t,n){var r=VU(j1(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function Vi(i){return n3e(i)||a3e(i)||dte(i)||u3e()}function A3e(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 fte(i){var e=A3e(i,"string");return typeof e=="symbol"?e:e+""}function dte(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 pte=function(e){e instanceof Array?e.forEach(pte):(e.map&&e.map.dispose(),e.dispose())},p0=function(e){e.geometry&&e.geometry.dispose(),e.material&&pte(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(p0)},Br=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),p0(t)}};function Ra(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 rr=100;function nte(){return rr}function mc(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=rr*(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 Ate(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/rr-1}}function qm(i){return i*Math.PI/180}var Mb=window.THREE?window.THREE:{BackSide:ui,BufferAttribute:Ni,Color:Ut,Mesh:Hn,ShaderMaterial:Xr},m3e=`5095+ `};var d0=class extends $r{constructor(e){super({type:"LineMaterial",uniforms:HA.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 BU=new gn,ete=new ie,tte=new ie,Co=new gn,Ro=new gn,Bh=new gn,UU=new ie,kU=new on,Po=new Zy,nte=new ie,eR=new da,tR=new Wa,Uh=new gn,kh,qm;function ite(i,e,t){return Uh.set(0,0,-e,1).applyMatrix4(i.projectionMatrix),Uh.multiplyScalar(1/Uh.w),Uh.x=qm/t.width,Uh.y=qm/t.height,Uh.applyMatrix4(i.projectionMatrixInverse),Uh.multiplyScalar(1/Uh.w),Math.abs(Math.max(Uh.x,Uh.y))}function r3e(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++){Po.start.fromBufferAttribute(r,a),Po.end.fromBufferAttribute(s,a),Po.applyMatrix4(t);let c=new ie,u=new ie;kh.distanceSqToSegment(Po.start,Po.end,u,c),u.distanceTo(c)<qm*.5&&e.push({point:u,pointOnLine:c,distance:kh.origin.distanceTo(u),object:i,face:null,faceIndex:a,uv:null,uv1:null})}}function s3e(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;kh.at(1,Bh),Bh.w=1,Bh.applyMatrix4(e.matrixWorldInverse),Bh.applyMatrix4(n),Bh.multiplyScalar(1/Bh.w),Bh.x*=s.x/2,Bh.y*=s.y/2,Bh.z=0,UU.copy(Bh),kU.multiplyMatrices(e.matrixWorldInverse,o);for(let p=0,x=u;p<x;p++){if(Co.fromBufferAttribute(l,p),Ro.fromBufferAttribute(c,p),Co.w=1,Ro.w=1,Co.applyMatrix4(kU),Ro.applyMatrix4(kU),Co.z>f&&Ro.z>f)continue;if(Co.z>f){let R=Co.z-Ro.z,C=(Co.z-f)/R;Co.lerp(Ro,C)}else if(Ro.z>f){let R=Ro.z-Co.z,C=(Ro.z-f)/R;Ro.lerp(Co,C)}Co.applyMatrix4(n),Ro.applyMatrix4(n),Co.multiplyScalar(1/Co.w),Ro.multiplyScalar(1/Ro.w),Co.x*=s.x/2,Co.y*=s.y/2,Ro.x*=s.x/2,Ro.y*=s.y/2,Po.start.copy(Co),Po.start.z=0,Po.end.copy(Ro),Po.end.z=0;let w=Po.closestPointToPointParameter(UU,!0);Po.at(w,nte);let S=jc.lerp(Co.z,Ro.z,w),T=S>=-1&&S<=1,P=UU.distanceTo(nte)<qm*.5;if(T&&P){Po.start.fromBufferAttribute(l,p),Po.end.fromBufferAttribute(c,p),Po.start.applyMatrix4(o),Po.end.applyMatrix4(o);let R=new ie,C=new ie;kh.distanceSqToSegment(Po.start,Po.end,C,R),t.push({point:C,pointOnLine:R,distance:kh.origin.distanceTo(C),object:i,face:null,faceIndex:p,uv:null,uv1:null})}}}var nR=class extends Gn{constructor(e=new V1,t=new d0({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)ete.fromBufferAttribute(t,o),tte.fromBufferAttribute(n,o),r[a]=a===0?0:r[a-1],r[a+1]=r[a]+ete.distanceTo(tte);let s=new zu(r,2,1);return e.setAttribute("instanceDistanceStart",new go(s,1,0)),e.setAttribute("instanceDistanceEnd",new go(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;kh=e.ray;let o=this.matrixWorld,a=this.geometry,l=this.material;qm=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),tR.copy(a.boundingSphere).applyMatrix4(o);let c;if(n)c=qm*.5;else{let f=Math.max(r.near,tR.distanceToPoint(kh.origin));c=ite(r,f,l.resolution)}if(tR.radius+=c,kh.intersectsSphere(tR)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),eR.copy(a.boundingBox).applyMatrix4(o);let u;if(n)u=qm*.5;else{let f=Math.max(r.near,eR.distanceToPoint(kh.origin));u=ite(r,f,l.resolution)}eR.expandByScalar(u),kh.intersectsBox(eR)!==!1&&(n?r3e(this,t):s3e(this,r,t))}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(BU),this.material.uniforms.resolution.value.set(BU.z,BU.w))}};var q1=class extends V1{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 iR=class extends nR{constructor(e=new q1,t=new d0({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}};var H1=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100,n="ltr"){let r=[],s=o3e(e,t,this.data,n);for(let o=0,a=s.length;o<a;o++)r.push(...s[o].toShapes());return r}};function o3e(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=a3e(f,s,l,c,t);n=="tb"?(l=0,c+=t.ascender*s):l+=p.offsetX,a.push(p.path)}}return a}function a3e(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 Ky,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 Eb=class i extends Ly{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 H1(t.font.data),new i(t.text,t)}};function HU(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 l3e(i){if(Array.isArray(i))return i}function c3e(i){if(Array.isArray(i))return HU(i)}function Ate(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 u3e(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function rte(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 h3e(i){return function(){var e=this,t=arguments;return new Promise(function(n,r){var s=i.apply(e,t);function o(l){rte(s,n,r,o,a,"next",l)}function a(l){rte(s,n,r,o,a,"throw",l)}o(void 0)})}}function uR(i,e,t){return e=$1(e),y3e(i,ZU()?Reflect.construct(e,t||[],$1(i).constructor):e.apply(i,t))}function f3e(i,e){if(e.has(i))throw new TypeError("Cannot initialize the same private elements twice on an object")}function hR(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Mb(i,e){return i.get(Ate(i,e))}function GU(i,e,t){f3e(i,e),e.set(i,t)}function zU(i,e,t){return i.set(Ate(i,e),t),t}function YU(i,e,t){if(ZU())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 d3e(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,mte(n.key),n)}}function fR(i,e,t){return e&&d3e(i.prototype,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function so(i,e,t){return(e=mte(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function WU(){return WU=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,e,t){var n=v3e(i,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(arguments.length<3?i:t):r.value}},WU.apply(null,arguments)}function $1(i){return $1=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},$1(i)}function dR(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&&XU(i,e)}function ZU(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ZU=function(){return!!i})()}function p3e(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function A3e(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 m3e(){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 g3e(){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 ste(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 Oi(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ste(Object(t),!0).forEach(function(n){so(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):ste(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function _3e(i,e){if(i==null)return{};var t,n,r=x3e(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 x3e(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 y3e(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 u3e(i)}function jU(){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 Dl(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]())):(Dl(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,Dl(x,r,"GeneratorFunction")),x.prototype=Object.create(f),x}return l.prototype=c,Dl(f,"constructor",c),Dl(c,"constructor",l),l.displayName="GeneratorFunction",Dl(c,r,"GeneratorFunction"),Dl(f),Dl(f,r,"Generator"),Dl(f,n,function(){return this}),Dl(f,"toString",function(){return"[object Generator]"}),(jU=function(){return{w:s,m:p}})()}function Dl(i,e,t,n){var r=Object.defineProperty;try{r({},"",{})}catch{r=0}Dl=function(s,o,a,l){function c(u,f){Dl(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))},Dl(i,e,t,n)}function XU(i,e){return XU=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},XU(i,e)}function mr(i,e){return l3e(i)||A3e(i,e)||gte(i,e)||m3e()}function v3e(i,e){for(;!{}.hasOwnProperty.call(i,e)&&(i=$1(i))!==null;);return i}function VU(i,e,t,n){var r=WU($1(i.prototype),e,t);return typeof r=="function"?function(s){return r.apply(t,s)}:r}function Vi(i){return c3e(i)||p3e(i)||gte(i)||g3e()}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 mte(i){var e=b3e(i,"string");return typeof e=="symbol"?e:e+""}function gte(i,e){if(i){if(typeof i=="string")return HU(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)?HU(i,e):void 0}}var _te=function(e){e instanceof Array?e.forEach(_te):(e.map&&e.map.dispose(),e.dispose())},m0=function(e){e.geometry&&e.geometry.dispose(),e.material&&_te(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(m0)},kr=function(e){if(e&&e.children)for(;e.children.length;){var t=e.children[0];e.remove(t),m0(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 rr=100;function ote(){return rr}function _c(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=rr*(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 xte(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/rr-1}}function Wm(i){return i*Math.PI/180}var Rb=window.THREE?window.THREE:{BackSide:ui,BufferAttribute:Ni,Color:Ut,Mesh:Gn,ShaderMaterial:$r},w3e=`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-}`,g3e=`5118+}`,S3e=`51195119 uniform vec3 color;51205120 uniform float coefficient;51215121 uniform float power;@@ -5138,9 +5138,9 @@ void main() {
51385138 power51395139 );51405140 gl_FragColor = vec4(color, intensity);5141-}`;function _3e(i,e,t,n){return new Mb.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:m3e,fragmentShader:g3e,uniforms:{coefficient:{value:i},color:{value:new Mb.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function x3e(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 Mb.BufferAttribute(n,3)),t}var y3e=(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;lR(this,e),n=aR(this,e);var T=x3e(t,l),P=_3e(u,o,p,v);return S&&(P.side=Mb.BackSide),n.geometry=T,n.material=P,n}return uR(e,i),cR(e)})(Mb.Mesh),kh=window.THREE?window.THREE:{Color:Ut,Group:xs,LineBasicMaterial:kc,LineSegments:d_,Mesh:Hn,MeshPhongMaterial:TA,SphereGeometry:pa,SRGBColorSpace:jr,TextureLoader:zc},mte=Nr({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){p0(e.globeObj),p0(e.tileEngine),p0(e.graticulesObj)}},stateInit:function(){var e=new kh.MeshPhongMaterial({color:0}),t=new kh.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new $X(rr),r=new kh.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new kh.LineSegments(new u6(FD(),rr,2),new kh.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){Br(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 kh.SphereGeometry(rr,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new kh.TextureLoader().load(e.globeImageUrl,function(a){var l;a.colorSpace=kh.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 kh.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new kh.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),p0(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new y3e(e.globeObj.geometry,{color:e.atmosphereColor,size:rr*e.atmosphereAltitude,hollowRadius:rr,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())}}),Gh=function(e){return isNaN(e)?parseInt(dn(e).toHex(),16):e},uu=function(e){return e&&isNaN(e)?Xc(e).opacity:1},A0=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=Ar(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(Vi(x),[s]):x};function v3e(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var ite=window.THREE?window.THREE:{BufferAttribute:Ni};function zh(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 ite.BufferAttribute(new t(i),e);for(var n=new ite.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function b3e(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 GU=new WeakMap,tR=new WeakMap,nR=new WeakMap,el=(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 lR(this,e),n=aR(this,e),ro(n,"scene",void 0),BU(n,GU,void 0),BU(n,tR,void 0),BU(n,nR,void 0),n.scene=t,UU(GU,n,o),UU(tR,n,l),UU(nR,n,u),n.onRemoveObj(function(){}),n}return uR(e,i),cR(e,[{key:"onCreateObj",value:function(n){var r=this;return kU(e,"onCreateObj",this)([function(s){var o=n(s);return s[Tb(tR,r)]=o,o[Tb(GU,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return kU(e,"onRemoveObj",this)([function(s,o){var a=kU(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),p0(s),delete a[Tb(tR,r)]};Tb(nR,r)?setTimeout(l,Tb(nR,r)):l()}]),this}}])})(m$),au=window.THREE?window.THREE:{BufferGeometry:Kn,CylinderGeometry:vA,Matrix4:on,Mesh:Hn,MeshLambertMaterial:Aa,Object3D:$i,Vector3:ie},rte=Object.assign({},av),ste=rte.BufferGeometryUtils||rte,gte=Nr({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;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new el(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 au.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new au.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new au.Matrix4().makeTranslation(0,0,-.5));var c=2*Math.PI*rr/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&Br(e.scene),e.dataMapper.scene=e.pointsMerge?new au.Object3D:e.scene,e.dataMapper.onCreateObj(x).onUpdateObj(v).digest(e.pointsData),e.pointsMerge){var f=e.pointsData.length?(ste.mergeGeometries||ste.mergeBufferGeometries)(e.pointsData.map(function(w){var S=e.dataMapper.getObj(w),T=S.geometry.clone();S.updateMatrix(),T.applyMatrix4(S.matrix);var P=A0(a(w));return T.setAttribute("color",zh(Array(T.getAttribute("position").count).fill(P),4)),T})):new au.BufferGeometry,p=new au.Mesh(f,new au.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));p.__globeObjType="points",p.__data=e.pointsData,e.dataMapper.clear(),Br(e.scene),e.scene.add(p)}function x(){var w=new au.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,mc(H,Z));var J=e.pointsMerge?new au.Vector3(0,0,0):e.scene.localToWorld(new au.Vector3(0,0,0));w.lookAt(J),w.scale.x=w.scale.y=Math.min(30,z)*c,w.scale.z=Math.max(V*rr,.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 Vs(R).to(P,e.pointsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(T).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var C=a(S),L=C?uu(C):0,D=!!L;w.visible=D,D&&(u.hasOwnProperty(C)||(u[C]=new au.MeshLambertMaterial({color:Gh(C),transparent:L<1,opacity:L})),w.material=u[C])}}}}),_te=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:`5142- `.concat(Fn.common,`5143- `).concat(Fn.logdepthbuf_pars_vertex,`5141+}`;function T3e(i,e,t,n){return new Rb.ShaderMaterial({depthWrite:!1,transparent:!0,vertexShader:w3e,fragmentShader:S3e,uniforms:{coefficient:{value:i},color:{value:new Rb.Color(e)},power:{value:t},hollowRadius:{value:n}}})}function E3e(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 Rb.BufferAttribute(n,3)),t}var M3e=(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;hR(this,e),n=uR(this,e);var T=E3e(t,l),P=T3e(u,o,p,v);return S&&(P.side=Rb.BackSide),n.geometry=T,n.material=P,n}return dR(e,i),fR(e)})(Rb.Mesh),Gh=window.THREE?window.THREE:{Color:Ut,Group:Xr,LineBasicMaterial:zc,LineSegments:A_,Mesh:Gn,MeshPhongMaterial:MA,SphereGeometry:Aa,SRGBColorSpace:yr,TextureLoader:Ql},yte=Dr({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){m0(e.globeObj),m0(e.tileEngine),m0(e.graticulesObj)}},stateInit:function(){var e=new Gh.MeshPhongMaterial({color:0}),t=new Gh.Mesh(void 0,e);t.rotation.y=-Math.PI/2;var n=new QX(rr),r=new Gh.Group;r.__globeObjType="globe",r.add(t),r.add(n);var s=new Gh.LineSegments(new d6(UD(),rr,2),new Gh.LineBasicMaterial({color:"lightgrey",transparent:!0,opacity:.1}));return{globeGroup:r,globeObj:t,graticulesObj:s,defaultGlobeMaterial:e,tileEngine:n}},init:function(e,t){kr(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 Gh.SphereGeometry(rr,s,s/2),e.tileEngine.curvatureResolution=e.globeCurvatureResolution}if(t.hasOwnProperty("globeImageUrl")&&(e.globeImageUrl?new Gh.TextureLoader().load(e.globeImageUrl,function(a){var l;a.colorSpace=Gh.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 Gh.Color(0))),t.hasOwnProperty("bumpImageUrl")&&(e.bumpImageUrl?e.bumpImageUrl&&new Gh.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),m0(e.atmosphereObj)),e.atmosphereColor&&e.atmosphereAltitude)){var o=e.atmosphereObj=new M3e(e.globeObj.geometry,{color:e.atmosphereColor,size:rr*e.atmosphereAltitude,hollowRadius:rr,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())}}),zh=function(e){return isNaN(e)?parseInt(dn(e).toHex(),16):e},hu=function(e){return e&&isNaN(e)?$c(e).opacity:1},g0=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(Vi(x),[s]):x};function C3e(i,e,t){return i.opacity=e,i.transparent=e<1,i.depthWrite=e>=1,i}var ate=window.THREE?window.THREE:{BufferAttribute:Ni};function Vh(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 ate.BufferAttribute(new t(i),e);for(var n=new ate.BufferAttribute(new t(i.length*e),e),r=0,s=i.length;r<s;r++)n.set(i[r],r*e);return n}function R3e(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 qU=new WeakMap,rR=new WeakMap,sR=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 hR(this,e),n=uR(this,e),so(n,"scene",void 0),GU(n,qU,void 0),GU(n,rR,void 0),GU(n,sR,void 0),n.scene=t,zU(qU,n,o),zU(rR,n,l),zU(sR,n,u),n.onRemoveObj(function(){}),n}return dR(e,i),fR(e,[{key:"onCreateObj",value:function(n){var r=this;return VU(e,"onCreateObj",this)([function(s){var o=n(s);return s[Mb(rR,r)]=o,o[Mb(qU,r)]=s,r.scene.add(o),o}]),this}},{key:"onRemoveObj",value:function(n){var r=this;return VU(e,"onRemoveObj",this)([function(s,o){var a=VU(e,"getData",r)([s]);n(s,o);var l=function(){r.scene.remove(s),m0(s),delete a[Mb(rR,r)]};Mb(sR,r)?setTimeout(l,Mb(sR,r)):l()}]),this}}])})(y$),lu=window.THREE?window.THREE:{BufferGeometry:Wn,CylinderGeometry:wA,Matrix4:on,Mesh:Gn,MeshLambertMaterial:ma,Object3D:$i,Vector3:ie},lte=Object.assign({},cv),cte=lte.BufferGeometryUtils||lte,vte=Dr({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;kr(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 lu.CylinderGeometry(1,1,1,e.pointResolution);l.applyMatrix4(new lu.Matrix4().makeRotationX(Math.PI/2)),l.applyMatrix4(new lu.Matrix4().makeTranslation(0,0,-.5));var c=2*Math.PI*rr/360,u={};if(!e.pointsMerge&&t.hasOwnProperty("pointsMerge")&&kr(e.scene),e.dataMapper.scene=e.pointsMerge?new lu.Object3D:e.scene,e.dataMapper.onCreateObj(x).onUpdateObj(v).digest(e.pointsData),e.pointsMerge){var f=e.pointsData.length?(cte.mergeGeometries||cte.mergeBufferGeometries)(e.pointsData.map(function(w){var S=e.dataMapper.getObj(w),T=S.geometry.clone();S.updateMatrix(),T.applyMatrix4(S.matrix);var P=g0(a(w));return T.setAttribute("color",Vh(Array(T.getAttribute("position").count).fill(P),4)),T})):new lu.BufferGeometry,p=new lu.Mesh(f,new lu.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0}));p.__globeObjType="points",p.__data=e.pointsData,e.dataMapper.clear(),kr(e.scene),e.scene.add(p)}function x(){var w=new lu.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,_c(H,Z));var J=e.pointsMerge?new lu.Vector3(0,0,0):e.scene.localToWorld(new lu.Vector3(0,0,0));w.lookAt(J),w.scale.x=w.scale.y=Math.min(30,z)*c,w.scale.z=Math.max(V*rr,.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 qs(R).to(P,e.pointsTransitionDuration).easing(Fr.Quadratic.InOut).onUpdate(T).onComplete(function(){e.tweenGroup.remove(this)}).start())),!e.pointsMerge){var C=a(S),L=C?hu(C):0,D=!!L;w.visible=D,D&&(u.hasOwnProperty(C)||(u[C]=new lu.MeshLambertMaterial({color:zh(C),transparent:L<1,opacity:L})),w.material=u[C])}}}}),bte=function(){return{uniforms:{dashOffset:{value:0},dashSize:{value:1},gapSize:{value:0},dashTranslate:{value:0}},vertexShader:`5142+ `.concat(On.common,`5143+ `).concat(On.logdepthbuf_pars_vertex,`51445144 51455145 uniform float dashTranslate; 51465146 @@ -5156,10 +5156,10 @@ void main() {
51565156 vRelDistance = relDistance + dashTranslate;51575157 gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);51585158 5159- `).concat(Fn.logdepthbuf_vertex,`5159+ `).concat(On.logdepthbuf_vertex,`51605160 }51615161 `),fragmentShader:`5162- `.concat(Fn.logdepthbuf_pars_fragment,`5162+ `.concat(On.logdepthbuf_pars_fragment,`51635163 51645164 uniform float dashOffset; 51655165 uniform float dashSize;@@ -5176,9 +5176,9 @@ void main() {
51765176 // set px color: [r, g, b, a], interpolated between vertices 51775177 gl_FragColor = vColor; 51785178 5179- `).concat(Fn.logdepthbuf_fragment,`5179+ `).concat(On.logdepthbuf_fragment,`51805180 }5181- `)}},WU=function(e){return e.uniforms.uSurfaceRadius={type:"float",value:0},e.vertexShader=(`attribute float surfaceRadius;5181+ `)}},$U=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},w3e=function(e){return e.vertexShader=`5189+`)),e},P3e=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},$U=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},S3e=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)}}},T3e=["stroke"],lu=window.THREE?window.THREE:{BufferGeometry:Kn,CubicBezierCurve3:g_,Curve:da,Group:xs,Line:jd,Mesh:Hn,NormalBlending:ss,ShaderMaterial:Xr,TubeGeometry:Ny,Vector3:ie},E3e=Hm.default.default||Hm.default,xte=Nr({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 E3e,sharedMaterial:new lu.ShaderMaterial(Oi(Oi({},_te()),{},{transparent:!0,blending:lu.NormalBlending}))}},init:function(e,t){Br(e),t.scene=e,t.dataMapper=new el(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new lu.Group;return n.__globeObjType="arc",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Ar(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")){Br(R);var F=D?new lu.Mesh:new lu.Line(new lu.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=h3e(ee,T3e),de=S(ce);D?(N.geometry&&N.geometry.dispose(),N.geometry=new lu.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 Vs(J).to(Z,e.arcsTransitionDuration).easing(Lr.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=Ar(Me,3),$e=ze[0],Et=ze[1],Tt=ze[2],Ct=mc(Et,$e,Tt),un=Ct.x,Gt=Ct.y,Xe=Ct.z;return new lu.Vector3(un,Gt,Xe)},Z=[F,D],J=[z,B],j=C;if(j==null&&(j=Ya(Z,J)/2*L+Math.max(N,V)),j||N||V){var K=tm(Z,J),ee=function(Me,ze){return ze+(ze-Me)*(Me<ze?.5:.25)},ae=[.25,.75].map(function(mt){return[].concat(Vi(K(mt)),[ee(mt<.5?N:V,j)])}),ce=Ar(ae,2),de=ce[0],ve=ce[1],Ie=jU(lu.CubicBezierCurve3,Vi([[].concat(Z,[N]),de,ve,[].concat(J,[V])].map(H)));return Ie}else{var Qe=.001;return Ue.apply(void 0,Vi([[].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 lu.Vector3().addVectors(mt.clone().multiplyScalar(Math.sin((1-Tt)*ze)),Me.clone().multiplyScalar(Math.sin(Tt*ze))).divideScalar(Math.sin(ze))},Et=new lu.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?Xa().domain(R.map(function(j,K){return K/(R.length-1)})).range(R):R;F=function(K){return A0(N(K),!0,!0)}}else{var B=A0(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 zh(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(),zh(F,1)}}}),f0=window.THREE?window.THREE:{BufferGeometry:Kn,DoubleSide:ir,Mesh:Hn,MeshLambertMaterial:Aa,Object3D:$i},ote=Object.assign({},av),ate=ote.BufferGeometryUtils||ote,yte=Nr({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;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new el(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=B$(e.hexBinPointsData.map(function(P){return Oi(Oi({},P),{},{h3Idx:Z$(n(P),r(P),e.hexBinResolution)})}),"h3Idx"),f=Object.entries(u).map(function(P){var R=Ar(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")&&Br(e.scene),e.dataMapper.scene=e.hexBinMerge?new f0.Object3D:e.scene,e.dataMapper.id(function(P){return P.h3Idx}).onCreateObj(S).onUpdateObj(T).digest(f),e.hexBinMerge){var x=f.length?(ate.mergeGeometries||ate.mergeBufferGeometries)(f.map(function(P){var R=e.dataMapper.getObj(P),C=R.geometry.toNonIndexed();R.updateMatrix(),C.applyMatrix4(R.matrix);var L=A0(a(P)),D=A0(l(P)),F=C.getAttribute("position").count,N=C.groups[0].count;return C.setAttribute("color",zh(Vi(new Array(F)).map(function(B,z){return z>=N?L:D}),4)),C})):new f0.BufferGeometry,v=new f0.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:f0.DoubleSide});v.onBeforeCompile=function(P){v.userData.shader=WU(P)};var w=new f0.Mesh(x,v);w.__globeObjType="hexBinPoints",w.__data=f,e.dataMapper.clear(),Br(e.scene),e.scene.add(w)}function S(P){var R=new f0.Mesh;R.__hexCenter=N6(P.h3Idx),R.__hexGeoJson=L6(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=Ar(P.__hexCenter,2),F=D[0],N=D[1],B=L===0?P.__hexGeoJson:P.__hexGeoJson.map(function(K){var ee=Ar(K,2),ae=ee[0],ce=ee[1];return[[ae,N],[ce,F]].map(function(de){var ve=Ar(de,2),Ie=ve[0],Qe=ve[1];return C(Ie,Qe,L)})}),z=e.hexTopCurvatureResolution;P.geometry&&P.geometry.dispose(),P.geometry=new AE([B],0,rr,!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=rr/(ce+1);P.geometry.setAttribute("surfaceRadius",zh(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 Vs(Z).to(V,e.hexTransitionDuration).easing(Lr.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=uu(K);p[K]=$U(new f0.MeshLambertMaterial({color:Gh(K),transparent:ee<1,opacity:ee,side:f0.DoubleSide}),WU)}}),P.material=[J,j].map(function(K){return p[K]})}}}}),vte=function(e){return e*e},ed=function(e){return e*Math.PI/180};function M3e(i,e){var t=Math.sqrt,n=Math.cos,r=function(u){return vte(Math.sin(u/2))},s=ed(i[1]),o=ed(e[1]),a=ed(i[0]),l=ed(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var C3e=Math.sqrt(2*Math.PI);function R3e(i,e){return Math.exp(-vte(i/e)/2)/(e*C3e)}var P3e=function(e){var t=Ar(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 h3(s.map(function(S){var T=p(S);if(!T)return 0;var P=M3e(v,[l(S),u(S)]);return R3e(P,w)*T}))},I3e=(function(){var i=r3e(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 P3e(un,r,{lngAccessor:a,latAccessor:c,weightAccessor:f,bandwidth:p})}));case 1:return x=4,v=Oee,w=Bee,S=$ee,T=Xee,P=Vee,R=qee,C=Uee,L=jee,D=Wee,F=Gee,N=kee,B=zee,z=Hee,V=T(new Dm(new Float32Array(t.flat().map(ed)),2),"vec2",t.length),H=T(new Dm(new Float32Array(r.map(function(un){return[ed(a(un)),ed(c(un)),f(un)]}).flat()),3),"vec3",r.length),Z=new Dm(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(ed(p)),Ie=S(ed(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 D1,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)}})(),iR=window.THREE?window.THREE:{Mesh:Hn,MeshLambertMaterial:Aa,SphereGeometry:pa},N3e=3.5,L3e=.1,lte=100,D3e=function(e){var t=Xc(F6(e));return t.opacity=Math.cbrt(e),t.formatRgb()},bte=Nr({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 D3e}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new el(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new iR.Mesh(new iR.SphereGeometry(rr),$U(new iR.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=mc(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(L3e,x/N3e),C=Math.ceil(360/(R||-1));f.geometry.parameters.widthSegments!==C&&(f.geometry.dispose(),f.geometry=new iR.SphereGeometry(rr,C,C/2));var L=b3e(f.geometry.getAttribute("position")),D=L.map(function(F){var N=Ar(F,3),B=N[0],z=N[1],V=N[2],H=Ate({x:B,y:z,z:V}),Z=H.lng,J=H.lat;return[Z,J]});I3e(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=Vi(new Array(lte)).map(function(H,Z){return A0(v(Z/(lte-1)))}),B=function(Z){var J=f.__currentTargetD=Z,j=J.kdeVals,K=J.topAlt,ee=J.saturation,ae=c3(j.map(Math.abs))||1e-15,ce=U2([0,ae/ee],N);f.geometry.setAttribute("color",zh(j.map(function(ve){return ce(Math.abs(ve))}),4));var de=Xa([0,ae],[rr*(1+S),rr*(1+(K||S))]);f.geometry.setAttribute("r",zh(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 Vs(V).to(z,e.heatmapsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(B).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),d0=window.THREE?window.THREE:{DoubleSide:ir,Group:xs,LineBasicMaterial:kc,LineSegments:d_,Mesh:Hn,MeshBasicMaterial:Us},wte=Nr({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;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new el(e,{objBindAttr:"__threeObjPolygon"}).id(function(s){return s.id}).onCreateObj(function(){var s=new d0.Group;return s.__defaultSideMaterial=$U(new d0.MeshBasicMaterial({side:d0.DoubleSide,depthWrite:!0}),WU),s.__defaultCapMaterial=new d0.MeshBasicMaterial({side:d0.DoubleSide,depthWrite:!0}),s.add(new d0.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new d0.LineSegments(void 0,new d0.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(Oi({id:"".concat(v,"_0"),coords:x.coordinates},p)):x.type==="MultiPolygon"?u.push.apply(u,Vi(x.coordinates.map(function(w,S){return Oi({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=Ar(f.children,2),D=L[0],F=L[1],N=!!P;F.visible=N;var B=!!(v||w),z=!!(S||T);F3e(D.geometry.parameters||{},{polygonGeoJson:x,curvatureResolution:C,closedTop:B,includeSides:z})||(D.geometry&&D.geometry.dispose(),D.geometry=new AE(x,0,rr,!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 u6({type:"Polygon",coordinates:x},rr,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=Ar(ae,2),de=ce[0],ve=ce[1];if(!(!de||ve<0)){var Ie=D.material[ve],Qe=uu(de);Ie.color.set(Gh(de)),Ie.transparent=Qe<1,Ie.opacity=Qe}}),N){var Z=F.material,J=uu(P);Z.color.set(Gh(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),S3e(f.__defaultSideMaterial,function(Ie){return Ie.uSurfaceRadius.value=rr/(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 Vs(ee).to(j,e.polygonsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(K).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(u)}});function F3e(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=Ar(n,2),s=r[0],o=r[1];return i.hasOwnProperty(s)&&t(s)(i[s],o)})}var q1=window.THREE?window.THREE:{BufferGeometry:Kn,DoubleSide:ir,Mesh:Hn,MeshLambertMaterial:Aa,Vector3:ie},cte=Object.assign({},av),ute=cte.BufferGeometryUtils||cte,Ste=Nr({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;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new el(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new q1.Mesh(void 0,new q1.MeshLambertMaterial({side:q1.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=uu(R);u.material.color.set(Gh(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"?D6(p.coordinates,x,!0).forEach(function(H){return B.push(H)}):p.type==="MultiPolygon"?p.coordinates.forEach(function(H){return D6(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=N6(H),J=L6(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?(ute.mergeGeometries||ute.mergeBufferGeometries)(z.map(function(ae){var ce=Ar(ae.hexCenter,2),de=ce[0],ve=ce[1];if(S){var Ie=mc(de,ve,j),Qe=mc(ae.hexGeoJson[0][1],ae.hexGeoJson[0][0],j),Ue=.85*(1-K)*new q1.Vector3(Ie.x,Ie.y,Ie.z).distanceTo(new q1.Vector3(Qe.x,Qe.y,Qe.z)),mt=new A_(Ue,P);return mt.rotateX(qm(-de)),mt.rotateY(qm(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=Ar($e,2),Tt=Et[0],Ct=Et[1];return[[Tt,ve],[Ct,de]].map(function(un){var Gt=Ar(un,2),Xe=Gt[0],st=Gt[1];return Me(Xe,st,K)})});return new AE([ze],rr,rr*(1+j),!1,!0,!1,ee)}})):new q1.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?V(L):e.tweenGroup.add(new Vs(F).to(L,e.hexPolygonsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(V).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),O3e=window.THREE?window.THREE:{Vector3:ie};function B3e(i,e){var t=function(o,a){var l=o[o.length-1];return[].concat(Vi(o),Vi(Array(a-o.length).fill(l)))},n=Math.max(i.length,e.length),r=ZL.apply(void 0,Vi([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=Ar(o,3),l=a[0],c=a[1],u=a[2];return new O3e.Vector3(l,c,u)})}}var Vm=window.THREE?window.THREE:{BufferGeometry:Kn,Color:Ut,Group:xs,Line:jd,NormalBlending:ss,ShaderMaterial:Xr,Vector3:ie},U3e=Hm.default.default||Hm.default,Tte=Nr({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 U3e,sharedMaterial:new Vm.ShaderMaterial(Oi(Oi({},_te()),{},{transparent:!0,blending:Vm.NormalBlending}))}},init:function(e,t){Br(e),t.scene=e,t.dataMapper=new el(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new Vm.Group;return n.__globeObjType="path",n}),t.ticker.onTick.add(function(n,r){t.dataMapper.entries().map(function(s){var o=Ar(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")){Br(S);var C=R?new eR(new z1,new h0):new Vm.Line(new Vm.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=uu(j);L.material.color=new Vm.Color(Gh(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=B3e(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,Vi(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 Vs(de).to(ce,e.pathTransitionDuration).easing(Lr.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=Ar(B,3),V=z[0],H=z[1],Z=z[2],J=mc(V,H,Z),j=J.x,K=J.y,ee=J.z;return new Vm.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?Xa().domain(S.map(function(Z,J){return J/(S.length-1)})).range(S):S;L=function(J){return A0(D(J),R,!0)}}else{var F=A0(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 zh(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(),zh(C,1)}}}),rR=window.THREE?window.THREE:{Euler:ha,Mesh:Hn,MeshLambertMaterial:Aa,SphereGeometry:pa},Ete=Nr({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 rR.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new el(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new rR.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=H1(L),z=H1(-C);u.geometry&&u.geometry.dispose(),u.geometry=new rR.SphereGeometry(rr*(1+D),Math.ceil(F/(x||-1)),Math.ceil(N/(x||-1)),H1(90-F/2)+(p?B:0),H1(F),H1(90-N/2)+(p?z:0),H1(N)),p||u.setRotationFromEuler(new rR.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 Vs(S).to(w,e.tilesTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(v).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),H1=function(e){return e*Math.PI/180},Eb=window.THREE?window.THREE:{BufferGeometry:Kn,Color:Ut,Points:yy,PointsMaterial:Xd},Mte=Nr({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){Br(e),t.scene=e,t.dataMapper=new el(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new Eb.Points(new Eb.BufferGeometry,new Eb.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",zh(s(r).map(function(c){return Object.values(mc(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=Ar(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 Eb.Color(16777215),u.material.transparent=!1,u.material.alphaTest=.5,u.material.map=o(c);else{var f=n(c),p=uu(f);u.material.color=new Eb.Color(Gh(f)),u.material.transparent=p<1,u.material.opacity=p,u.material.alphaTest=0}})}}),k3e=window.THREE?window.THREE:{BufferGeometry:Kn},G3e=(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;lR(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 uR(e,i),cR(e)})(k3e.BufferGeometry),W1=window.THREE?window.THREE:{Color:Ut,Group:xs,Line:jd,LineBasicMaterial:kc,Vector3:ie},z3e=Hm.default.default||Hm.default,Cte=Nr({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;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new el(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new W1.Group;return s.__globeObjType="ring",s}),t.ticker=new z3e,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=Ar(f,2),x=p[1];return x}).forEach(function(f){var p=Ar(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 W1.Line(new G3e(1,t.ringResolution),new W1.LineBasicMaterial),T=o(x),P=T instanceof Array||T instanceof Function,R;P?T instanceof Array?(R=Xa().domain(T.map(function(V,H){return H/(T.length-1)})).range(T),S.material.transparent=T.some(function(V){return uu(V)<1})):(R=T,S.material.transparent=!0):(S.material.color=new W1.Color(Gh(T)),v3e(S.material,uu(T)));var C=rr*(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 W1.Color(Gh(j)),S.material.transparent&&(S.material.opacity=uu(j))}};if(F===0)B({t:0}),v.add(S);else{var z=Math.abs(L/F)*1e3;t.tweenGroup.add(new Vs({t:0}).to({t:1},z).onUpdate(B).onStart(function(){return v.add(S)}).onComplete(function(){t.tweenGroup.remove(this),v.remove(S),p0(S)}).start())}}})}})},update:function(e){var t=rt(e.ringLat),n=rt(e.ringLng),r=rt(e.ringAltitude),s=e.scene.localToWorld(new W1.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),c=n(a),u=r(a);Object.assign(o.position,mc(l,c,u)),o.lookAt(s)}).digest(e.ringsData)}}),V3e={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 "}},q3e="normal",H3e=1189,W3e=-100,j3e="normal",X3e={yMin:-334,xMin:-111,yMax:1189,xMax:1672},$3e=1e3,Y3e={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},KU=function(e,t){return e.onBeforeCompile=function(n){e.userData.shader=t(n)},e},I3e=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)}}},N3e=["stroke"],cu=window.THREE?window.THREE:{BufferGeometry:Wn,CubicBezierCurve3:x_,Curve:pa,Group:Xr,Line:$d,Mesh:Gn,NormalBlending:os,ShaderMaterial:$r,TubeGeometry:Dy,Vector3:ie},L3e=jm.default.default||jm.default,wte=Dr({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 L3e,sharedMaterial:new cu.ShaderMaterial(Oi(Oi({},bte()),{},{transparent:!0,blending:cu.NormalBlending}))}},init:function(e,t){kr(e),t.scene=e,t.dataMapper=new tl(e,{objBindAttr:"__threeObjArc"}).onCreateObj(function(){var n=new cu.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")){kr(R);var F=D?new cu.Mesh:new cu.Line(new cu.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=_3e(ee,N3e),de=S(ce);D?(N.geometry&&N.geometry.dispose(),N.geometry=new cu.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 qs(J).to(Z,e.arcsTransitionDuration).easing(Fr.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=_c(Et,$e,Tt),un=Ct.x,Gt=Ct.y,Xe=Ct.z;return new cu.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=im(Z,J),ee=function(Me,ze){return ze+(ze-Me)*(Me<ze?.5:.25)},ae=[.25,.75].map(function(mt){return[].concat(Vi(K(mt)),[ee(mt<.5?N:V,j)])}),ce=mr(ae,2),de=ce[0],ve=ce[1],Ie=YU(cu.CubicBezierCurve3,Vi([[].concat(Z,[N]),de,ve,[].concat(J,[V])].map(H)));return Ie}else{var Qe=.001;return Ue.apply(void 0,Vi([[].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 cu.Vector3().addVectors(mt.clone().multiplyScalar(Math.sin((1-Tt)*ze)),Me.clone().multiplyScalar(Math.sin(Tt*ze))).divideScalar(Math.sin(ze))},Et=new cu.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 g0(N(K),!0,!0)}}else{var B=g0(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 Vh(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(),Vh(F,1)}}}),p0=window.THREE?window.THREE:{BufferGeometry:Wn,DoubleSide:ir,Mesh:Gn,MeshLambertMaterial:ma,Object3D:$i},ute=Object.assign({},cv),hte=ute.BufferGeometryUtils||ute,Ste=Dr({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;kr(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=z$(e.hexBinPointsData.map(function(P){return Oi(Oi({},P),{},{h3Idx:eY(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")&&kr(e.scene),e.dataMapper.scene=e.hexBinMerge?new p0.Object3D:e.scene,e.dataMapper.id(function(P){return P.h3Idx}).onCreateObj(S).onUpdateObj(T).digest(f),e.hexBinMerge){var x=f.length?(hte.mergeGeometries||hte.mergeBufferGeometries)(f.map(function(P){var R=e.dataMapper.getObj(P),C=R.geometry.toNonIndexed();R.updateMatrix(),C.applyMatrix4(R.matrix);var L=g0(a(P)),D=g0(l(P)),F=C.getAttribute("position").count,N=C.groups[0].count;return C.setAttribute("color",Vh(Vi(new Array(F)).map(function(B,z){return z>=N?L:D}),4)),C})):new p0.BufferGeometry,v=new p0.MeshLambertMaterial({color:16777215,transparent:!0,vertexColors:!0,side:p0.DoubleSide});v.onBeforeCompile=function(P){v.userData.shader=$U(P)};var w=new p0.Mesh(x,v);w.__globeObjType="hexBinPoints",w.__data=f,e.dataMapper.clear(),kr(e.scene),e.scene.add(w)}function S(P){var R=new p0.Mesh;R.__hexCenter=F6(P.h3Idx),R.__hexGeoJson=O6(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 _E([B],0,rr,!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=rr/(ce+1);P.geometry.setAttribute("surfaceRadius",Vh(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 qs(Z).to(V,e.hexTransitionDuration).easing(Fr.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=hu(K);p[K]=KU(new p0.MeshLambertMaterial({color:zh(K),transparent:ee<1,opacity:ee,side:p0.DoubleSide}),$U)}}),P.material=[J,j].map(function(K){return p[K]})}}}}),Tte=function(e){return e*e},td=function(e){return e*Math.PI/180};function D3e(i,e){var t=Math.sqrt,n=Math.cos,r=function(u){return Tte(Math.sin(u/2))},s=td(i[1]),o=td(e[1]),a=td(i[0]),l=td(e[0]);return 2*Math.asin(t(r(o-s)+n(s)*n(o)*r(l-a)))}var F3e=Math.sqrt(2*Math.PI);function O3e(i,e){return Math.exp(-Tte(i/e)/2)/(e*F3e)}var B3e=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 p3(s.map(function(S){var T=p(S);if(!T)return 0;var P=D3e(v,[l(S),u(S)]);return O3e(P,w)*T}))},U3e=(function(){var i=h3e(jU().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 jU().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 B3e(un,r,{lngAccessor:a,latAccessor:c,weightAccessor:f,bandwidth:p})}));case 1:return x=4,v=Gee,w=zee,S=Qee,T=Kee,P=jee,R=Xee,C=Vee,L=Zee,D=Yee,F=Hee,N=qee,B=Wee,z=$ee,V=T(new Om(new Float32Array(t.flat().map(td)),2),"vec2",t.length),H=T(new Om(new Float32Array(r.map(function(un){return[td(a(un)),td(c(un)),f(un)]}).flat()),3),"vec3",r.length),Z=new Om(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(td(p)),Ie=S(td(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 O1,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)}})(),oR=window.THREE?window.THREE:{Mesh:Gn,MeshLambertMaterial:ma,SphereGeometry:Aa},k3e=3.5,G3e=.1,fte=100,z3e=function(e){var t=$c(U6(e));return t.opacity=Math.cbrt(e),t.formatRgb()},Ete=Dr({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 z3e}},heatmapColorSaturation:{default:1.5},heatmapBaseAltitude:{default:.01},heatmapTopAltitude:{},heatmapsTransitionDuration:{default:0,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;kr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new tl(e,{objBindAttr:"__threeObjHeatmap"}).onCreateObj(function(){var s=new oR.Mesh(new oR.SphereGeometry(rr),KU(new oR.MeshLambertMaterial({vertexColors:!0,transparent:!0}),P3e));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=_c(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(G3e,x/k3e),C=Math.ceil(360/(R||-1));f.geometry.parameters.widthSegments!==C&&(f.geometry.dispose(),f.geometry=new oR.SphereGeometry(rr,C,C/2));var L=R3e(f.geometry.getAttribute("position")),D=L.map(function(F){var N=mr(F,3),B=N[0],z=N[1],V=N[2],H=xte({x:B,y:z,z:V}),Z=H.lng,J=H.lat;return[Z,J]});U3e(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=Vi(new Array(fte)).map(function(H,Z){return g0(v(Z/(fte-1)))}),B=function(Z){var J=f.__currentTargetD=Z,j=J.kdeVals,K=J.topAlt,ee=J.saturation,ae=f3(j.map(Math.abs))||1e-15,ce=G2([0,ae/ee],N);f.geometry.setAttribute("color",Vh(j.map(function(ve){return ce(Math.abs(ve))}),4));var de=$a([0,ae],[rr*(1+S),rr*(1+(K||S))]);f.geometry.setAttribute("r",Vh(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 qs(V).to(z,e.heatmapsTransitionDuration).easing(Fr.Quadratic.InOut).onUpdate(B).onComplete(function(){e.tweenGroup.remove(this)}).start()))})}).digest(e.heatmapsData)}}),A0=window.THREE?window.THREE:{DoubleSide:ir,Group:Xr,LineBasicMaterial:zc,LineSegments:A_,Mesh:Gn,MeshBasicMaterial:as},Mte=Dr({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;kr(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 A0.Group;return s.__defaultSideMaterial=KU(new A0.MeshBasicMaterial({side:A0.DoubleSide,depthWrite:!0}),$U),s.__defaultCapMaterial=new A0.MeshBasicMaterial({side:A0.DoubleSide,depthWrite:!0}),s.add(new A0.Mesh(void 0,[s.__defaultSideMaterial,s.__defaultCapMaterial])),s.add(new A0.LineSegments(void 0,new A0.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(Oi({id:"".concat(v,"_0"),coords:x.coordinates},p)):x.type==="MultiPolygon"?u.push.apply(u,Vi(x.coordinates.map(function(w,S){return Oi({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);V3e(D.geometry.parameters||{},{polygonGeoJson:x,curvatureResolution:C,closedTop:B,includeSides:z})||(D.geometry&&D.geometry.dispose(),D.geometry=new _E(x,0,rr,!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 d6({type:"Polygon",coordinates:x},rr,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=hu(de);Ie.color.set(zh(de)),Ie.transparent=Qe<1,Ie.opacity=Qe}}),N){var Z=F.material,J=hu(P);Z.color.set(zh(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),I3e(f.__defaultSideMaterial,function(Ie){return Ie.uSurfaceRadius.value=rr/(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 qs(ee).to(j,e.polygonsTransitionDuration).easing(Fr.Quadratic.InOut).onUpdate(K).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(u)}});function V3e(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 W1=window.THREE?window.THREE:{BufferGeometry:Wn,DoubleSide:ir,Mesh:Gn,MeshLambertMaterial:ma,Vector3:ie},dte=Object.assign({},cv),pte=dte.BufferGeometryUtils||dte,Cte=Dr({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;kr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new tl(e,{objBindAttr:"__threeObjHexPolygon"}).onCreateObj(function(){var s=new W1.Mesh(void 0,new W1.MeshLambertMaterial({side:W1.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=hu(R);u.material.color.set(zh(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"?B6(p.coordinates,x,!0).forEach(function(H){return B.push(H)}):p.type==="MultiPolygon"?p.coordinates.forEach(function(H){return B6(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=F6(H),J=O6(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?(pte.mergeGeometries||pte.mergeBufferGeometries)(z.map(function(ae){var ce=mr(ae.hexCenter,2),de=ce[0],ve=ce[1];if(S){var Ie=_c(de,ve,j),Qe=_c(ae.hexGeoJson[0][1],ae.hexGeoJson[0][0],j),Ue=.85*(1-K)*new W1.Vector3(Ie.x,Ie.y,Ie.z).distanceTo(new W1.Vector3(Qe.x,Qe.y,Qe.z)),mt=new g_(Ue,P);return mt.rotateX(Wm(-de)),mt.rotateY(Wm(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 _E([ze],rr,rr*(1+j),!1,!0,!1,ee)}})):new W1.BufferGeometry};!e.hexPolygonsTransitionDuration||e.hexPolygonsTransitionDuration<0?V(L):e.tweenGroup.add(new qs(F).to(L,e.hexPolygonsTransitionDuration).easing(Fr.Quadratic.InOut).onUpdate(V).onComplete(function(){e.tweenGroup.remove(this)}).start())}}).digest(e.hexPolygonsData)}}),q3e=window.THREE?window.THREE:{Vector3:ie};function H3e(i,e){var t=function(o,a){var l=o[o.length-1];return[].concat(Vi(o),Vi(Array(a-o.length).fill(l)))},n=Math.max(i.length,e.length),r=JL.apply(void 0,Vi([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 q3e.Vector3(l,c,u)})}}var Hm=window.THREE?window.THREE:{BufferGeometry:Wn,Color:Ut,Group:Xr,Line:$d,NormalBlending:os,ShaderMaterial:$r,Vector3:ie},W3e=jm.default.default||jm.default,Rte=Dr({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 W3e,sharedMaterial:new Hm.ShaderMaterial(Oi(Oi({},bte()),{},{transparent:!0,blending:Hm.NormalBlending}))}},init:function(e,t){kr(e),t.scene=e,t.dataMapper=new tl(e,{objBindAttr:"__threeObjPath"}).onCreateObj(function(){var n=new Hm.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")){kr(S);var C=R?new iR(new q1,new d0):new Hm.Line(new Hm.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=hu(j);L.material.color=new Hm.Color(zh(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=H3e(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,Vi(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 qs(de).to(ce,e.pathTransitionDuration).easing(Fr.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=_c(V,H,Z),j=J.x,K=J.y,ee=J.z;return new Hm.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 g0(D(J),R,!0)}}else{var F=g0(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 Vh(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(),Vh(C,1)}}}),aR=window.THREE?window.THREE:{Euler:fa,Mesh:Gn,MeshLambertMaterial:ma,SphereGeometry:Aa},Pte=Dr({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 aR.MeshLambertMaterial({color:"#ffbb88",opacity:.4,transparent:!0})}},tileCurvatureResolution:{default:5},tilesTransitionDuration:{default:1e3,triggerUpdate:!1}},init:function(e,t,n){var r=n.tweenGroup;kr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new tl(e,{objBindAttr:"__threeObjTile"}).onCreateObj(function(){var s=new aR.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=j1(L),z=j1(-C);u.geometry&&u.geometry.dispose(),u.geometry=new aR.SphereGeometry(rr*(1+D),Math.ceil(F/(x||-1)),Math.ceil(N/(x||-1)),j1(90-F/2)+(p?B:0),j1(F),j1(90-N/2)+(p?z:0),j1(N)),p||u.setRotationFromEuler(new aR.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 qs(S).to(w,e.tilesTransitionDuration).easing(Fr.Quadratic.InOut).onUpdate(v).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.tilesData)}}),j1=function(e){return e*Math.PI/180},Cb=window.THREE?window.THREE:{BufferGeometry:Wn,Color:Ut,Points:by,PointsMaterial:Yd},Ite=Dr({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){kr(e),t.scene=e,t.dataMapper=new tl(e,{objBindAttr:"__threeObjParticles"}).onCreateObj(function(){var n=new Cb.Points(new Cb.BufferGeometry,new Cb.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",Vh(s(r).map(function(c){return Object.values(_c(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 Cb.Color(16777215),u.material.transparent=!1,u.material.alphaTest=.5,u.material.map=o(c);else{var f=n(c),p=hu(f);u.material.color=new Cb.Color(zh(f)),u.material.transparent=p<1,u.material.opacity=p,u.material.alphaTest=0}})}}),j3e=window.THREE?window.THREE:{BufferGeometry:Wn},X3e=(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;hR(this,e),t=uR(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 dR(e,i),fR(e)})(j3e.BufferGeometry),X1=window.THREE?window.THREE:{Color:Ut,Group:Xr,Line:$d,LineBasicMaterial:zc,Vector3:ie},$3e=jm.default.default||jm.default,Nte=Dr({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;kr(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new tl(e,{objBindAttr:"__threeObjRing",removeDelay:3e4}).onCreateObj(function(){var s=new X1.Group;return s.__globeObjType="ring",s}),t.ticker=new $3e,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 X1.Line(new X3e(1,t.ringResolution),new X1.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 hu(V)<1})):(R=T,S.material.transparent=!0):(S.material.color=new X1.Color(zh(T)),C3e(S.material,hu(T)));var C=rr*(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 X1.Color(zh(j)),S.material.transparent&&(S.material.opacity=hu(j))}};if(F===0)B({t:0}),v.add(S);else{var z=Math.abs(L/F)*1e3;t.tweenGroup.add(new qs({t:0}).to({t:1},z).onUpdate(B).onStart(function(){return v.add(S)}).onComplete(function(){t.tweenGroup.remove(this),v.remove(S),m0(S)}).start())}}})}})},update:function(e){var t=rt(e.ringLat),n=rt(e.ringLng),r=rt(e.ringAltitude),s=e.scene.localToWorld(new X1.Vector3(0,0,0));e.dataMapper.onUpdateObj(function(o,a){var l=t(a),c=n(a),u=r(a);Object.assign(o.position,_c(l,c,u)),o.lookAt(s)}).digest(e.ringsData)}}),Y3e={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 "}},Z3e="normal",K3e=1189,Q3e=-100,J3e="normal",eEe={yMin:-334,xMin:-111,yMax:1189,xMax:1672},tEe=1e3,nEe={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"},Z3e=-334,K3e="Helvetiker",Q3e=1522,J3e=50,eEe={glyphs:V3e,cssFontWeight:q3e,ascender:H3e,underlinePosition:W3e,cssFontStyle:j3e,boundingBox:X3e,resolution:$3e,original_font_information:Y3e,descender:Z3e,familyName:K3e,lineHeight:Q3e,underlineThickness:J3e},cu=Oi(Oi({},window.THREE?window.THREE:{BoxGeometry:Gc,CircleGeometry:A_,DoubleSide:ir,Group:xs,Mesh:Hn,MeshLambertMaterial:Aa,TextGeometry:Sb,Vector3:ie}),{},{Font:V1,TextGeometry:Sb}),Rte=Nr({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:eEe,onChange:function(e,t){t.font=new cu.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;Br(e),t.scene=e,t.tweenGroup=r;var s=new cu.CircleGeometry(1,32);t.dataMapper=new el(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new cu.MeshLambertMaterial;o.side=ir;var a=new cu.Group;a.add(new cu.Mesh(s,o));var l=new cu.Mesh(void 0,o);a.add(l);var c=new cu.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*rr/360;e.dataMapper.onUpdateObj(function(v,w){var S=Ar(v.children,2),T=S[0],P=S[1],R=Ar(P.children,1),C=R[0],L=l(w),D=uu(L);P.material.color.set(Gh(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 cu.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=jU(cu.BoxGeometry,Vi(new cu.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,mc(ae,ce,de)),v.lookAt(e.scene.localToWorld(new cu.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 Vs(J).to(Z,e.labelsTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),tEe=Oi(Oi({},window.THREE?window.THREE:{}),{},{CSS2DObject:n3}),Pte=Nr({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=Ar(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;Br(e),t.scene=e,t.tweenGroup=r,t.dataMapper=new el(e,{objBindAttr:"__threeObjHtml"}).onCreateObj(function(s){var o=rt(t.htmlElement)(s),a=new tEe.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,mc(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 Vs(a.__currentTargetD).to(u,e.htmlTransitionDuration).easing(Lr.Quadratic.InOut).onUpdate(c).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),sR=window.THREE?window.THREE:{Group:xs,Mesh:Hn,MeshLambertMaterial:Aa,SphereGeometry:pa},Ite=Nr({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new sR.Mesh(new sR.SphereGeometry(1,16,8),new sR.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){Br(e),t.scene=e,t.dataMapper=new el(e,{objBindAttr:"__threeObjObject"}).onCreateObj(function(n){var r=rt(t.objectThreeObject)(n);t.objectThreeObject===r&&(r=r.clone());var s=new sR.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,mc(u,f,p)),o(c)?l.setRotationFromEuler(new ha(qm(-u),qm(f),0,"YXZ")):l.rotation.set(0,0,0);var x=l.children[0],v=a(c);v&&x.setRotationFromEuler(new ha(qm(v.x||0),qm(v.y||0),qm(v.z||0)))}).digest(e.objectsData)}}),Nte=Nr({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){Br(e),t.scene=e,t.dataMapper=new el(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=rt(t.customThreeObject)(n,rr);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||Br(e.scene);var n=rt(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,rr)}).digest(e.customLayerData)}}),oR=window.THREE?window.THREE:{Camera:Rf,Group:xs,Vector2:Oe,Vector3:ie},nEe=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],Lte=Ra("globeLayer",mte),iEe=Object.assign.apply(Object,Vi(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return ro({},i,Lte.linkProp(i))}))),rEe=Object.assign.apply(Object,Vi(["globeMaterial","globeTileEngineClearCache"].map(function(i){return ro({},i,Lte.linkMethod(i))}))),sEe=Ra("pointsLayer",gte),oEe=Object.assign.apply(Object,Vi(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return ro({},i,sEe.linkProp(i))}))),aEe=Ra("arcsLayer",xte),lEe=Object.assign.apply(Object,Vi(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return ro({},i,aEe.linkProp(i))}))),cEe=Ra("hexBinLayer",yte),uEe=Object.assign.apply(Object,Vi(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return ro({},i,cEe.linkProp(i))}))),hEe=Ra("heatmapsLayer",bte),fEe=Object.assign.apply(Object,Vi(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return ro({},i,hEe.linkProp(i))}))),dEe=Ra("hexedPolygonsLayer",Ste),pEe=Object.assign.apply(Object,Vi(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return ro({},i,dEe.linkProp(i))}))),AEe=Ra("polygonsLayer",wte),mEe=Object.assign.apply(Object,Vi(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return ro({},i,AEe.linkProp(i))}))),gEe=Ra("pathsLayer",Tte),_Ee=Object.assign.apply(Object,Vi(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return ro({},i,gEe.linkProp(i))}))),xEe=Ra("tilesLayer",Ete),yEe=Object.assign.apply(Object,Vi(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return ro({},i,xEe.linkProp(i))}))),vEe=Ra("particlesLayer",Mte),bEe=Object.assign.apply(Object,Vi(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return ro({},i,vEe.linkProp(i))}))),wEe=Ra("ringsLayer",Cte),SEe=Object.assign.apply(Object,Vi(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return ro({},i,wEe.linkProp(i))}))),TEe=Ra("labelsLayer",Rte),EEe=Object.assign.apply(Object,Vi(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return ro({},i,TEe.linkProp(i))}))),MEe=Ra("htmlElementsLayer",Pte),CEe=Object.assign.apply(Object,Vi(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return ro({},i,MEe.linkProp(i))}))),REe=Ra("objectsLayer",Ite),PEe=Object.assign.apply(Object,Vi(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return ro({},i,REe.linkProp(i))}))),IEe=Ra("customLayer",Nte),NEe=Object.assign.apply(Object,Vi(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return ro({},i,IEe.linkProp(i))}))),LEe=Nr({props:Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new oR.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},iEe),oEe),lEe),uEe),fEe),mEe),pEe),_Ee),yEe),bEe),SEe),EEe),CEe),PEe),NEe),methods:Oi({getGlobeRadius:nte,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 mc.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 Ate.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof oR.Camera?t.position:t,r=nte(),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()})}},rEe),stateInit:function(){var e=new WA,t={tweenGroup:e},n={globeLayer:mte(t),pointsLayer:gte(t),arcsLayer:xte(t),hexBinLayer:yte(t),heatmapsLayer:bte(t),polygonsLayer:wte(t),hexedPolygonsLayer:Ste(t),pathsLayer:Tte(t),tilesLayer:Ete(t),particlesLayer:Mte(t),ringsLayer:Cte(t),labelsLayer:Rte(t),htmlElementsLayer:Pte(t),objectsLayer:Ite(t),customLayer:Nte(t)};return Oi(Oi({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;Br(e),t.scene=e,t.scene.visible=!1,nEe.forEach(function(c){var u=new oR.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 Vs({k:1e-6}).to({k:1},600).easing(Lr.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 oR.Vector3(0,1,0);t.tweenGroup.add(new Vs({rot:Math.PI*2}).to({rot:0},1200).easing(Lr.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 DEe(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;lR(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=jU(i,[].concat(Vi(t?[o]:[]),l)),o}return uR(s,r),cR(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 FEe=window.THREE?window.THREE:{Group:xs},YU=DEe(LEe,FEe.Group,!0);var ZU={type:"change"},JU={type:"start"},ek={type:"end"},Dte=1e-6,Pi={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},hR=new Oe,m0=new Oe,OEe=new ie,fR=new ie,KU=new ie,X1=new vs,Fte=new ie,dR=new ie,QU=new ie,pR=new ie,AR=class extends Pf{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:ma.ROTATE,MIDDLE:ma.DOLLY,RIGHT:ma.PAN},this.target=new ie,this.state=Pi.NONE,this.keyState=Pi.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=UEe.bind(this),this._onPointerDown=BEe.bind(this),this._onPointerUp=kEe.bind(this),this._onPointerCancel=GEe.bind(this),this._onContextMenu=XEe.bind(this),this._onMouseWheel=jEe.bind(this),this._onKeyDown=VEe.bind(this),this._onKeyUp=zEe.bind(this),this._onTouchStart=$Ee.bind(this),this._onTouchMove=YEe.bind(this),this._onTouchEnd=ZEe.bind(this),this._onMouseDown=qEe.bind(this),this._onMouseMove=HEe.bind(this),this._onMouseUp=WEe.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)>Dte&&(this.dispatchEvent(ZU),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>Dte||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(ZU),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=Pi.NONE,this.keyState=Pi.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(ZU),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(m0.copy(this._panEnd).sub(this._panStart),m0.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;m0.x*=e,m0.y*=t}m0.multiplyScalar(this._eye.length()*this.panSpeed),fR.copy(this._eye).cross(this.object.up).setLength(m0.x),fR.add(OEe.copy(this.object.up).setLength(m0.y)),this.object.position.add(fR),this.target.add(fR),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(m0.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){pR.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=pR.length();e?(this._eye.copy(this.object.position).sub(this.target),Fte.copy(this._eye).normalize(),dR.copy(this.object.up).normalize(),QU.crossVectors(dR,Fte).normalize(),dR.setLength(this._moveCurr.y-this._movePrev.y),QU.setLength(this._moveCurr.x-this._movePrev.x),pR.copy(dR.add(QU)),KU.crossVectors(pR,this._eye).normalize(),e*=this.rotateSpeed,X1.setFromAxisAngle(KU,e),this._eye.applyQuaternion(X1),this.object.up.applyQuaternion(X1),this._lastAxis.copy(KU),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),X1.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(X1),this.object.up.applyQuaternion(X1)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===Pi.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=Wc.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=Wc.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 hR.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),hR}_getMouseOnCircle(e,t){return hR.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),hR}_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 BEe(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 UEe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function kEe(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 GEe(i){this._removePointer(i)}function zEe(){this.enabled!==!1&&(this.keyState=Pi.NONE,window.addEventListener("keydown",this._onKeyDown))}function VEe(i){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===Pi.NONE&&(i.code===this.keys[Pi.ROTATE]&&!this.noRotate?this.keyState=Pi.ROTATE:i.code===this.keys[Pi.ZOOM]&&!this.noZoom?this.keyState=Pi.ZOOM:i.code===this.keys[Pi.PAN]&&!this.noPan&&(this.keyState=Pi.PAN)))}function qEe(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 ma.DOLLY:this.state=Pi.ZOOM;break;case ma.ROTATE:this.state=Pi.ROTATE;break;case ma.PAN:this.state=Pi.PAN;break;default:this.state=Pi.NONE}let t=this.keyState!==Pi.NONE?this.keyState:this.state;t===Pi.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr)):t===Pi.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._zoomEnd.copy(this._zoomStart)):t===Pi.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent(JU)}function HEe(i){let e=this.keyState!==Pi.NONE?this.keyState:this.state;e===Pi.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY))):e===Pi.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY)):e===Pi.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY))}function WEe(){this.state=Pi.NONE,this.dispatchEvent(ek)}function jEe(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(JU),this.dispatchEvent(ek)}}function XEe(i){this.enabled!==!1&&i.preventDefault()}function $Ee(i){if(this._trackPointer(i),this._pointers.length===1)this.state=Pi.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);else{this.state=Pi.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(JU)}function YEe(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 ZEe(i){switch(this._pointers.length){case 0:this.state=Pi.NONE;break;case 1:this.state=Pi.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=Pi.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(ek)}var Ote={type:"change"},nk={type:"start"},Ute={type:"end"},mR=new Cf,Bte=new aa,KEe=Math.cos(70*Wc.DEG2RAD),qs=new ie,tl=2*Math.PI,Ji={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},tk=1e-6,gR=class extends Pf{constructor(e,t=null){super(e,t),this.state=Ji.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:ma.ROTATE,MIDDLE:ma.DOLLY,RIGHT:ma.PAN},this.touches={ONE:Qd.ROTATE,TWO:Qd.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 vs,this._lastTargetPosition=new ie,this._quat=new vs().setFromUnitVectors(e.up,new ie(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new b_,this._sphericalDelta=new b_,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=JEe.bind(this),this._onPointerDown=QEe.bind(this),this._onPointerUp=eMe.bind(this),this._onContextMenu=aMe.bind(this),this._onMouseWheel=iMe.bind(this),this._onKeyDown=rMe.bind(this),this._onTouchStart=sMe.bind(this),this._onTouchMove=oMe.bind(this),this._onMouseDown=tMe.bind(this),this._onMouseMove=nMe.bind(this),this._interceptControlDown=lMe.bind(this),this._interceptControlUp=cMe.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(Ote),this.update(),this.state=Ji.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;qs.copy(t).sub(this.target),qs.applyQuaternion(this._quat),this._spherical.setFromVector3(qs),this.autoRotate&&this.state===Ji.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+=tl:n>Math.PI&&(n-=tl),r<-Math.PI?r+=tl:r>Math.PI&&(r-=tl),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(qs.setFromSpherical(this._spherical),qs.applyQuaternion(this._quatInverse),t.copy(this.target).add(qs),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=qs.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=qs.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):(mR.origin.copy(this.object.position),mR.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(mR.direction))<KEe?this.object.lookAt(this.target):(Bte.setFromNormalAndCoplanarPoint(this.object.up,this.target),mR.intersectPlane(Bte,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)>tk||8*(1-this._lastQuaternion.dot(this.object.quaternion))>tk||this._lastTargetPosition.distanceToSquared(this.target)>tk?(this.dispatchEvent(Ote),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?tl/60*this.autoRotateSpeed*e:tl/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){qs.setFromMatrixColumn(t,0),qs.multiplyScalar(-e),this._panOffset.add(qs)}_panUp(e,t){this.screenSpacePanning===!0?qs.setFromMatrixColumn(t,1):(qs.setFromMatrixColumn(t,0),qs.crossVectors(this.object.up,qs)),qs.multiplyScalar(e),this._panOffset.add(qs)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;qs.copy(r).sub(this.target);let s=qs.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(tl*this._rotateDelta.x/t.clientHeight),this._rotateUp(tl*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(tl*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(-tl*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(tl*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(-tl*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(tl*this._rotateDelta.x/t.clientHeight),this._rotateUp(tl*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 QEe(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 JEe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function eMe(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(Ute),this.state=Ji.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 tMe(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 ma.DOLLY:if(this.enableZoom===!1)return;this._handleMouseDownDolly(i),this.state=Ji.DOLLY;break;case ma.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Ji.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Ji.ROTATE}break;case ma.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Ji.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Ji.PAN}break;default:this.state=Ji.NONE}this.state!==Ji.NONE&&this.dispatchEvent(nk)}function nMe(i){switch(this.state){case Ji.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case Ji.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case Ji.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function iMe(i){this.enabled===!1||this.enableZoom===!1||this.state!==Ji.NONE||(i.preventDefault(),this.dispatchEvent(nk),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(Ute))}function rMe(i){this.enabled!==!1&&this._handleKeyDown(i)}function sMe(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case Qd.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=Ji.TOUCH_ROTATE;break;case Qd.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=Ji.TOUCH_PAN;break;default:this.state=Ji.NONE}break;case 2:switch(this.touches.TWO){case Qd.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=Ji.TOUCH_DOLLY_PAN;break;case Qd.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=Ji.TOUCH_DOLLY_ROTATE;break;default:this.state=Ji.NONE}break;default:this.state=Ji.NONE}this.state!==Ji.NONE&&this.dispatchEvent(nk)}function oMe(i){switch(this._trackPointer(i),this.state){case Ji.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case Ji.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case Ji.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case Ji.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=Ji.NONE}}function aMe(i){this.enabled!==!1&&i.preventDefault()}function lMe(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function cMe(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var uMe={type:"change"},kte=1e-6,Gte=new vs,_R=class extends Pf{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 vs,this._lastPosition=new ie,this._status=0,this._onKeyDown=hMe.bind(this),this._onKeyUp=fMe.bind(this),this._onPointerMove=pMe.bind(this),this._onPointerDown=dMe.bind(this),this._onPointerUp=AMe.bind(this),this._onPointerCancel=mMe.bind(this),this._onContextMenu=gMe.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),Gte.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(Gte),(this._lastPosition.distanceToSquared(t.position)>kte||8*(1-this._lastQuaternion.dot(t.quaternion))>kte)&&(this.dispatchEvent(uMe),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 hMe(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 fMe(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 dMe(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 pMe(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 AMe(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 mMe(){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 gMe(i){this.enabled!==!1&&i.preventDefault()}var zte={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"},iEe=-334,rEe="Helvetiker",sEe=1522,oEe=50,aEe={glyphs:Y3e,cssFontWeight:Z3e,ascender:K3e,underlinePosition:Q3e,cssFontStyle:J3e,boundingBox:eEe,resolution:tEe,original_font_information:nEe,descender:iEe,familyName:rEe,lineHeight:sEe,underlineThickness:oEe},uu=Oi(Oi({},window.THREE?window.THREE:{BoxGeometry:Vc,CircleGeometry:g_,DoubleSide:ir,Group:Xr,Mesh:Gn,MeshLambertMaterial:ma,TextGeometry:Eb,Vector3:ie}),{},{Font:H1,TextGeometry:Eb}),Lte=Dr({props:{labelsData:{default:[]},labelLat:{default:"lat"},labelLng:{default:"lng"},labelAltitude:{default:.002},labelText:{default:"text"},labelSize:{default:.5},labelTypeFace:{default:aEe,onChange:function(e,t){t.font=new uu.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;kr(e),t.scene=e,t.tweenGroup=r;var s=new uu.CircleGeometry(1,32);t.dataMapper=new tl(e,{objBindAttr:"__threeObjLabel"}).onCreateObj(function(){var o=new uu.MeshLambertMaterial;o.side=ir;var a=new uu.Group;a.add(new uu.Mesh(s,o));var l=new uu.Mesh(void 0,o);a.add(l);var c=new uu.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*rr/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=hu(L);P.material.color.set(zh(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 uu.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=YU(uu.BoxGeometry,Vi(new uu.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,_c(ae,ce,de)),v.lookAt(e.scene.localToWorld(new uu.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 qs(J).to(Z,e.labelsTransitionDuration).easing(Fr.Quadratic.InOut).onUpdate(H).onComplete(function(){e.tweenGroup.remove(this)}).start()))}).digest(e.labelsData)}}),lEe=Oi(Oi({},window.THREE?window.THREE:{}),{},{CSS2DObject:s3}),Dte=Dr({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;kr(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 lEe.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,_c(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 qs(a.__currentTargetD).to(u,e.htmlTransitionDuration).easing(Fr.Quadratic.InOut).onUpdate(c).onComplete(function(){e.tweenGroup.remove(this)}).start())}).digest(e.htmlElementsData)}}),lR=window.THREE?window.THREE:{Group:Xr,Mesh:Gn,MeshLambertMaterial:ma,SphereGeometry:Aa},Fte=Dr({props:{objectsData:{default:[]},objectLat:{default:"lat"},objectLng:{default:"lng"},objectAltitude:{default:.01},objectFacesSurface:{default:!0},objectRotation:{},objectThreeObject:{default:new lR.Mesh(new lR.SphereGeometry(1,16,8),new lR.MeshLambertMaterial({color:"#ffffaa",transparent:!0,opacity:.7}))}},init:function(e,t){kr(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 lR.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,_c(u,f,p)),o(c)?l.setRotationFromEuler(new fa(Wm(-u),Wm(f),0,"YXZ")):l.rotation.set(0,0,0);var x=l.children[0],v=a(c);v&&x.setRotationFromEuler(new fa(Wm(v.x||0),Wm(v.y||0),Wm(v.z||0)))}).digest(e.objectsData)}}),Ote=Dr({props:{customLayerData:{default:[]},customThreeObject:{},customThreeObjectUpdate:{triggerUpdate:!1}},init:function(e,t){kr(e),t.scene=e,t.dataMapper=new tl(e,{objBindAttr:"__threeObjCustom"}).onCreateObj(function(n){var r=rt(t.customThreeObject)(n,rr);return r&&(t.customThreeObject===r&&(r=r.clone()),r.__globeObjType="custom"),r})},update:function(e,t){e.customThreeObjectUpdate||kr(e.scene);var n=rt(e.customThreeObjectUpdate);t.hasOwnProperty("customThreeObject")&&e.dataMapper.clear(),e.dataMapper.onUpdateObj(function(r,s){return n(r,s,rr)}).digest(e.customLayerData)}}),cR=window.THREE?window.THREE:{Camera:Pf,Group:Xr,Vector2:Oe,Vector3:ie},cEe=["globeLayer","pointsLayer","arcsLayer","hexBinLayer","heatmapsLayer","polygonsLayer","hexedPolygonsLayer","pathsLayer","tilesLayer","particlesLayer","ringsLayer","labelsLayer","htmlElementsLayer","objectsLayer","customLayer"],Bte=Pa("globeLayer",yte),uEe=Object.assign.apply(Object,Vi(["globeImageUrl","bumpImageUrl","globeCurvatureResolution","globeTileEngineUrl","globeTileEngineMaxLevel","showGlobe","showGraticules","showAtmosphere","atmosphereColor","atmosphereAltitude"].map(function(i){return so({},i,Bte.linkProp(i))}))),hEe=Object.assign.apply(Object,Vi(["globeMaterial","globeTileEngineClearCache"].map(function(i){return so({},i,Bte.linkMethod(i))}))),fEe=Pa("pointsLayer",vte),dEe=Object.assign.apply(Object,Vi(["pointsData","pointLat","pointLng","pointColor","pointAltitude","pointRadius","pointResolution","pointsMerge","pointsTransitionDuration"].map(function(i){return so({},i,fEe.linkProp(i))}))),pEe=Pa("arcsLayer",wte),AEe=Object.assign.apply(Object,Vi(["arcsData","arcStartLat","arcStartLng","arcStartAltitude","arcEndLat","arcEndLng","arcEndAltitude","arcColor","arcAltitude","arcAltitudeAutoScale","arcStroke","arcCurveResolution","arcCircularResolution","arcDashLength","arcDashGap","arcDashInitialGap","arcDashAnimateTime","arcsTransitionDuration"].map(function(i){return so({},i,pEe.linkProp(i))}))),mEe=Pa("hexBinLayer",Ste),gEe=Object.assign.apply(Object,Vi(["hexBinPointsData","hexBinPointLat","hexBinPointLng","hexBinPointWeight","hexBinResolution","hexMargin","hexTopCurvatureResolution","hexTopColor","hexSideColor","hexAltitude","hexBinMerge","hexTransitionDuration"].map(function(i){return so({},i,mEe.linkProp(i))}))),_Ee=Pa("heatmapsLayer",Ete),xEe=Object.assign.apply(Object,Vi(["heatmapsData","heatmapPoints","heatmapPointLat","heatmapPointLng","heatmapPointWeight","heatmapBandwidth","heatmapColorFn","heatmapColorSaturation","heatmapBaseAltitude","heatmapTopAltitude","heatmapsTransitionDuration"].map(function(i){return so({},i,_Ee.linkProp(i))}))),yEe=Pa("hexedPolygonsLayer",Cte),vEe=Object.assign.apply(Object,Vi(["hexPolygonsData","hexPolygonGeoJsonGeometry","hexPolygonColor","hexPolygonAltitude","hexPolygonResolution","hexPolygonMargin","hexPolygonUseDots","hexPolygonCurvatureResolution","hexPolygonDotResolution","hexPolygonsTransitionDuration"].map(function(i){return so({},i,yEe.linkProp(i))}))),bEe=Pa("polygonsLayer",Mte),wEe=Object.assign.apply(Object,Vi(["polygonsData","polygonGeoJsonGeometry","polygonCapColor","polygonCapMaterial","polygonSideColor","polygonSideMaterial","polygonStrokeColor","polygonAltitude","polygonCapCurvatureResolution","polygonsTransitionDuration"].map(function(i){return so({},i,bEe.linkProp(i))}))),SEe=Pa("pathsLayer",Rte),TEe=Object.assign.apply(Object,Vi(["pathsData","pathPoints","pathPointLat","pathPointLng","pathPointAlt","pathResolution","pathColor","pathStroke","pathDashLength","pathDashGap","pathDashInitialGap","pathDashAnimateTime","pathTransitionDuration"].map(function(i){return so({},i,SEe.linkProp(i))}))),EEe=Pa("tilesLayer",Pte),MEe=Object.assign.apply(Object,Vi(["tilesData","tileLat","tileLng","tileAltitude","tileWidth","tileHeight","tileUseGlobeProjection","tileMaterial","tileCurvatureResolution","tilesTransitionDuration"].map(function(i){return so({},i,EEe.linkProp(i))}))),CEe=Pa("particlesLayer",Ite),REe=Object.assign.apply(Object,Vi(["particlesData","particlesList","particleLat","particleLng","particleAltitude","particlesSize","particlesSizeAttenuation","particlesColor","particlesTexture"].map(function(i){return so({},i,CEe.linkProp(i))}))),PEe=Pa("ringsLayer",Nte),IEe=Object.assign.apply(Object,Vi(["ringsData","ringLat","ringLng","ringAltitude","ringColor","ringResolution","ringMaxRadius","ringPropagationSpeed","ringRepeatPeriod"].map(function(i){return so({},i,PEe.linkProp(i))}))),NEe=Pa("labelsLayer",Lte),LEe=Object.assign.apply(Object,Vi(["labelsData","labelLat","labelLng","labelAltitude","labelRotation","labelText","labelSize","labelTypeFace","labelColor","labelResolution","labelIncludeDot","labelDotRadius","labelDotOrientation","labelsTransitionDuration"].map(function(i){return so({},i,NEe.linkProp(i))}))),DEe=Pa("htmlElementsLayer",Dte),FEe=Object.assign.apply(Object,Vi(["htmlElementsData","htmlLat","htmlLng","htmlAltitude","htmlElement","htmlElementVisibilityModifier","htmlTransitionDuration"].map(function(i){return so({},i,DEe.linkProp(i))}))),OEe=Pa("objectsLayer",Fte),BEe=Object.assign.apply(Object,Vi(["objectsData","objectLat","objectLng","objectAltitude","objectRotation","objectFacesSurface","objectThreeObject"].map(function(i){return so({},i,OEe.linkProp(i))}))),UEe=Pa("customLayer",Ote),kEe=Object.assign.apply(Object,Vi(["customLayerData","customThreeObject","customThreeObjectUpdate"].map(function(i){return so({},i,UEe.linkProp(i))}))),GEe=Dr({props:Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi(Oi({onGlobeReady:{triggerUpdate:!1},rendererSize:{default:new cR.Vector2(window.innerWidth,window.innerHeight),onChange:function(e,t){t.pathsLayer.rendererSize(e)},triggerUpdate:!1}},uEe),dEe),AEe),gEe),xEe),wEe),vEe),TEe),MEe),REe),IEe),LEe),FEe),BEe),kEe),methods:Oi({getGlobeRadius:ote,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 _c.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 xte.apply(void 0,n)},setPointOfView:function(e,t){var n=t instanceof cR.Camera?t.position:t,r=ote(),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()})}},hEe),stateInit:function(){var e=new XA,t={tweenGroup:e},n={globeLayer:yte(t),pointsLayer:vte(t),arcsLayer:wte(t),hexBinLayer:Ste(t),heatmapsLayer:Ete(t),polygonsLayer:Mte(t),hexedPolygonsLayer:Cte(t),pathsLayer:Rte(t),tilesLayer:Pte(t),particlesLayer:Ite(t),ringsLayer:Nte(t),labelsLayer:Lte(t),htmlElementsLayer:Dte(t),objectsLayer:Fte(t),customLayer:Ote(t)};return Oi(Oi({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;kr(e),t.scene=e,t.scene.visible=!1,cEe.forEach(function(c){var u=new cR.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 qs({k:1e-6}).to({k:1},600).easing(Fr.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 cR.Vector3(0,1,0);t.tweenGroup.add(new qs({rot:Math.PI*2}).to({rot:0},1200).easing(Fr.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 zEe(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;hR(this,s);for(var a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];return o=uR(this,s,[].concat(l)),o.__kapsuleInstance=YU(i,[].concat(Vi(t?[o]:[]),l)),o}return dR(s,r),fR(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 VEe=window.THREE?window.THREE:{Group:Xr},QU=zEe(GEe,VEe.Group,!0);var JU={type:"change"},nk={type:"start"},ik={type:"end"},Ute=1e-6,Pi={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},pR=new Oe,_0=new Oe,qEe=new ie,AR=new ie,ek=new ie,Y1=new bs,kte=new ie,mR=new ie,tk=new ie,gR=new ie,_R=class extends If{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=Pi.NONE,this.keyState=Pi.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=WEe.bind(this),this._onPointerDown=HEe.bind(this),this._onPointerUp=jEe.bind(this),this._onPointerCancel=XEe.bind(this),this._onContextMenu=eMe.bind(this),this._onMouseWheel=JEe.bind(this),this._onKeyDown=YEe.bind(this),this._onKeyUp=$Ee.bind(this),this._onTouchStart=tMe.bind(this),this._onTouchMove=nMe.bind(this),this._onTouchEnd=iMe.bind(this),this._onMouseDown=ZEe.bind(this),this._onMouseMove=KEe.bind(this),this._onMouseUp=QEe.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)>Ute&&(this.dispatchEvent(JU),this._lastPosition.copy(this.object.position))):this.object.isOrthographicCamera?(this.object.lookAt(this.target),(this._lastPosition.distanceToSquared(this.object.position)>Ute||this._lastZoom!==this.object.zoom)&&(this.dispatchEvent(JU),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom)):console.warn("THREE.TrackballControls: Unsupported camera type.")}reset(){this.state=Pi.NONE,this.keyState=Pi.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(JU),this._lastPosition.copy(this.object.position),this._lastZoom=this.object.zoom}_panCamera(){if(_0.copy(this._panEnd).sub(this._panStart),_0.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;_0.x*=e,_0.y*=t}_0.multiplyScalar(this._eye.length()*this.panSpeed),AR.copy(this._eye).cross(this.object.up).setLength(_0.x),AR.add(qEe.copy(this.object.up).setLength(_0.y)),this.object.position.add(AR),this.target.add(AR),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(_0.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor))}}_rotateCamera(){gR.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0);let e=gR.length();e?(this._eye.copy(this.object.position).sub(this.target),kte.copy(this._eye).normalize(),mR.copy(this.object.up).normalize(),tk.crossVectors(mR,kte).normalize(),mR.setLength(this._moveCurr.y-this._movePrev.y),tk.setLength(this._moveCurr.x-this._movePrev.x),gR.copy(mR.add(tk)),ek.crossVectors(gR,this._eye).normalize(),e*=this.rotateSpeed,Y1.setFromAxisAngle(ek,e),this._eye.applyQuaternion(Y1),this.object.up.applyQuaternion(Y1),this._lastAxis.copy(ek),this._lastAngle=e):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),Y1.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(Y1),this.object.up.applyQuaternion(Y1)),this._movePrev.copy(this._moveCurr)}_zoomCamera(){let e;this.state===Pi.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=jc.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=jc.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 pR.set((e-this.screen.left)/this.screen.width,(t-this.screen.top)/this.screen.height),pR}_getMouseOnCircle(e,t){return pR.set((e-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-t))/this.screen.width),pR}_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 HEe(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 WEe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function jEe(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 XEe(i){this._removePointer(i)}function $Ee(){this.enabled!==!1&&(this.keyState=Pi.NONE,window.addEventListener("keydown",this._onKeyDown))}function YEe(i){this.enabled!==!1&&(window.removeEventListener("keydown",this._onKeyDown),this.keyState===Pi.NONE&&(i.code===this.keys[Pi.ROTATE]&&!this.noRotate?this.keyState=Pi.ROTATE:i.code===this.keys[Pi.ZOOM]&&!this.noZoom?this.keyState=Pi.ZOOM:i.code===this.keys[Pi.PAN]&&!this.noPan&&(this.keyState=Pi.PAN)))}function ZEe(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=Pi.ZOOM;break;case ga.ROTATE:this.state=Pi.ROTATE;break;case ga.PAN:this.state=Pi.PAN;break;default:this.state=Pi.NONE}let t=this.keyState!==Pi.NONE?this.keyState:this.state;t===Pi.ROTATE&&!this.noRotate?(this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr)):t===Pi.ZOOM&&!this.noZoom?(this._zoomStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._zoomEnd.copy(this._zoomStart)):t===Pi.PAN&&!this.noPan&&(this._panStart.copy(this._getMouseOnScreen(i.pageX,i.pageY)),this._panEnd.copy(this._panStart)),this.dispatchEvent(nk)}function KEe(i){let e=this.keyState!==Pi.NONE?this.keyState:this.state;e===Pi.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY))):e===Pi.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY)):e===Pi.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(i.pageX,i.pageY))}function QEe(){this.state=Pi.NONE,this.dispatchEvent(ik)}function JEe(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(nk),this.dispatchEvent(ik)}}function eMe(i){this.enabled!==!1&&i.preventDefault()}function tMe(i){if(this._trackPointer(i),this._pointers.length===1)this.state=Pi.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(this._pointers[0].pageX,this._pointers[0].pageY)),this._movePrev.copy(this._moveCurr);else{this.state=Pi.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(nk)}function nMe(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 iMe(i){switch(this._pointers.length){case 0:this.state=Pi.NONE;break;case 1:this.state=Pi.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(i.pageX,i.pageY)),this._movePrev.copy(this._moveCurr);break;case 2:this.state=Pi.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(ik)}var Gte={type:"change"},sk={type:"start"},Vte={type:"end"},xR=new Rf,zte=new la,rMe=Math.cos(70*jc.DEG2RAD),Hs=new ie,nl=2*Math.PI,Ji={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},rk=1e-6,yR=class extends If{constructor(e,t=null){super(e,t),this.state=Ji.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:ep.ROTATE,TWO:ep.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 S_,this._sphericalDelta=new S_,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=oMe.bind(this),this._onPointerDown=sMe.bind(this),this._onPointerUp=aMe.bind(this),this._onContextMenu=pMe.bind(this),this._onMouseWheel=uMe.bind(this),this._onKeyDown=hMe.bind(this),this._onTouchStart=fMe.bind(this),this._onTouchMove=dMe.bind(this),this._onMouseDown=lMe.bind(this),this._onMouseMove=cMe.bind(this),this._interceptControlDown=AMe.bind(this),this._interceptControlUp=mMe.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(Gte),this.update(),this.state=Ji.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;Hs.copy(t).sub(this.target),Hs.applyQuaternion(this._quat),this._spherical.setFromVector3(Hs),this.autoRotate&&this.state===Ji.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(Hs.setFromSpherical(this._spherical),Hs.applyQuaternion(this._quatInverse),t.copy(this.target).add(Hs),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=Hs.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=Hs.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):(xR.origin.copy(this.object.position),xR.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(xR.direction))<rMe?this.object.lookAt(this.target):(zte.setFromNormalAndCoplanarPoint(this.object.up,this.target),xR.intersectPlane(zte,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)>rk||8*(1-this._lastQuaternion.dot(this.object.quaternion))>rk||this._lastTargetPosition.distanceToSquared(this.target)>rk?(this.dispatchEvent(Gte),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){Hs.setFromMatrixColumn(t,0),Hs.multiplyScalar(-e),this._panOffset.add(Hs)}_panUp(e,t){this.screenSpacePanning===!0?Hs.setFromMatrixColumn(t,1):(Hs.setFromMatrixColumn(t,0),Hs.crossVectors(this.object.up,Hs)),Hs.multiplyScalar(e),this._panOffset.add(Hs)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;Hs.copy(r).sub(this.target);let s=Hs.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 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._isTrackingPointer(i)&&(this._addPointer(i),i.pointerType==="touch"?this._onTouchStart(i):this._onMouseDown(i),this._cursorStyle==="grab"&&(this.domElement.style.cursor="grabbing")))}function oMe(i){this.enabled!==!1&&(i.pointerType==="touch"?this._onTouchMove(i):this._onMouseMove(i))}function aMe(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(Vte),this.state=Ji.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 lMe(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=Ji.DOLLY;break;case ga.ROTATE:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Ji.PAN}else{if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Ji.ROTATE}break;case ga.PAN:if(i.ctrlKey||i.metaKey||i.shiftKey){if(this.enableRotate===!1)return;this._handleMouseDownRotate(i),this.state=Ji.ROTATE}else{if(this.enablePan===!1)return;this._handleMouseDownPan(i),this.state=Ji.PAN}break;default:this.state=Ji.NONE}this.state!==Ji.NONE&&this.dispatchEvent(sk)}function cMe(i){switch(this.state){case Ji.ROTATE:if(this.enableRotate===!1)return;this._handleMouseMoveRotate(i);break;case Ji.DOLLY:if(this.enableZoom===!1)return;this._handleMouseMoveDolly(i);break;case Ji.PAN:if(this.enablePan===!1)return;this._handleMouseMovePan(i);break}}function uMe(i){this.enabled===!1||this.enableZoom===!1||this.state!==Ji.NONE||(i.preventDefault(),this.dispatchEvent(sk),this._handleMouseWheel(this._customWheelEvent(i)),this.dispatchEvent(Vte))}function hMe(i){this.enabled!==!1&&this._handleKeyDown(i)}function fMe(i){switch(this._trackPointer(i),this._pointers.length){case 1:switch(this.touches.ONE){case ep.ROTATE:if(this.enableRotate===!1)return;this._handleTouchStartRotate(i),this.state=Ji.TOUCH_ROTATE;break;case ep.PAN:if(this.enablePan===!1)return;this._handleTouchStartPan(i),this.state=Ji.TOUCH_PAN;break;default:this.state=Ji.NONE}break;case 2:switch(this.touches.TWO){case ep.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchStartDollyPan(i),this.state=Ji.TOUCH_DOLLY_PAN;break;case ep.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchStartDollyRotate(i),this.state=Ji.TOUCH_DOLLY_ROTATE;break;default:this.state=Ji.NONE}break;default:this.state=Ji.NONE}this.state!==Ji.NONE&&this.dispatchEvent(sk)}function dMe(i){switch(this._trackPointer(i),this.state){case Ji.TOUCH_ROTATE:if(this.enableRotate===!1)return;this._handleTouchMoveRotate(i),this.update();break;case Ji.TOUCH_PAN:if(this.enablePan===!1)return;this._handleTouchMovePan(i),this.update();break;case Ji.TOUCH_DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this._handleTouchMoveDollyPan(i),this.update();break;case Ji.TOUCH_DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this._handleTouchMoveDollyRotate(i),this.update();break;default:this.state=Ji.NONE}}function pMe(i){this.enabled!==!1&&i.preventDefault()}function AMe(i){i.key==="Control"&&(this._controlActive=!0,this.domElement.getRootNode().addEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}function mMe(i){i.key==="Control"&&(this._controlActive=!1,this.domElement.getRootNode().removeEventListener("keyup",this._interceptControlUp,{passive:!0,capture:!0}))}var gMe={type:"change"},qte=1e-6,Hte=new bs,vR=class extends If{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=_Me.bind(this),this._onKeyUp=xMe.bind(this),this._onPointerMove=vMe.bind(this),this._onPointerDown=yMe.bind(this),this._onPointerUp=bMe.bind(this),this._onPointerCancel=wMe.bind(this),this._onContextMenu=SMe.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),Hte.set(this._rotationVector.x*r,this._rotationVector.y*r,this._rotationVector.z*r,1).normalize(),t.quaternion.multiply(Hte),(this._lastPosition.distanceToSquared(t.position)>qte||8*(1-this._lastQuaternion.dot(t.quaternion))>qte)&&(this.dispatchEvent(gMe),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 _Me(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 xMe(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 yMe(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 vMe(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 wMe(){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 SMe(i){this.enabled!==!1&&i.preventDefault()}var Wte={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 td=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(){}},_Me=new Vc(-1,1,1,-1,0,1),ik=class extends Kn{constructor(){super(),this.setAttribute("position",new kn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new kn([0,2,0,0,2,0],2))}},xMe=new ik,xR=class{constructor(e){this._mesh=new Hn(xMe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,_Me)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};var yR=class extends td{constructor(e,t="tDiffuse"){super(),this.textureID=t,this.uniforms=null,this.material=null,e instanceof Xr?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=VA.clone(e.uniforms),this.material=new Xr({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 xR(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 Cb=class extends td{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)}},vR=class extends td{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}};var bR=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 ua(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Li}),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 yR(zte),this.copyPass.material.blending=$r,this.timer=new RA}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()}Cb!==void 0&&(o instanceof Cb?n=!0:o instanceof vR&&(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 wR=class extends td{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 Pa(){return Pa=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},Pa.apply(null,arguments)}function Vte(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function g0(i,e){return g0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},g0(i,e)}function qte(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,g0(i,e)}function SR(i){return SR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},SR(i)}function Hte(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function rk(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rk=function(){return!!i})()}function Wte(i,e,t){if(rk())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&g0(r,t.prototype),r}function TR(i){var e=typeof Map=="function"?new Map:void 0;return TR=function(n){if(n===null||!Hte(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 Wte(n,arguments,SR(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),g0(r,n)},TR(i)}var nl=(function(i){qte(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 Vte(n)}return e})(TR(Error));function jte(i,e){return i.substr(-e.length)===e}var yMe=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function Xte(i){if(typeof i!="string")return i;var e=i.match(yMe);return e?parseFloat(i):i}var vMe=function(e){return function(t,n){n===void 0&&(n="16px");var r=t,s=n;if(typeof t=="string"){if(!jte(t,"px"))throw new nl(69,e,t);r=Xte(t)}if(typeof n=="string"){if(!jte(n,"px"))throw new nl(70,e,n);s=Xte(n)}if(typeof r=="string")throw new nl(71,t,e);if(typeof s=="string")throw new nl(72,n,e);return""+r/s+e}},Yte=vMe,Lft=Yte("em");var Dft=Yte("rem");function sk(i){return Math.round(i*255)}function bMe(i,e,t){return sk(i)+","+sk(e)+","+sk(t)}function Rb(i,e,t,n){if(n===void 0&&(n=bMe),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 $te={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 $te[e]?"#"+$te[e]:i}var SMe=/^#[a-fA-F0-9]{6}$/,TMe=/^#[a-fA-F0-9]{8}$/,EMe=/^#[a-fA-F0-9]{3}$/,MMe=/^#[a-fA-F0-9]{4}$/,ok=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,CMe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,RMe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,PMe=/^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 _0(i){if(typeof i!="string")throw new nl(3);var e=wMe(i);if(e.match(SMe))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(TMe)){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(EMe))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(MMe)){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=ok.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=CMe.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=RMe.exec(e);if(o){var a=parseInt(""+o[1],10),l=parseInt(""+o[2],10)/100,c=parseInt(""+o[3],10)/100,u="rgb("+Rb(a,l,c)+")",f=ok.exec(u);if(!f)throw new nl(4,e,u);return{red:parseInt(""+f[1],10),green:parseInt(""+f[2],10),blue:parseInt(""+f[3],10)}}var p=PMe.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("+Rb(x,v,w)+")",T=ok.exec(S);if(!T)throw new nl(4,e,S);return{red:parseInt(""+T[1],10),green:parseInt(""+T[2],10),blue:parseInt(""+T[3],10),alpha:parseFloat(""+p[4])>1?parseFloat(""+p[4])/100:parseFloat(""+p[4])}}throw new nl(5)}function IMe(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 x0(i){return IMe(_0(i))}var NMe=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},lk=NMe;function Wm(i){var e=i.toString(16);return e.length===1?"0"+e:e}function ak(i){return Wm(Math.round(i*255))}function LMe(i,e,t){return lk("#"+ak(i)+ak(e)+ak(t))}function ER(i,e,t){return Rb(i,e,t,LMe)}function DMe(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return ER(i,e,t);if(typeof i=="object"&&e===void 0&&t===void 0)return ER(i.hue,i.saturation,i.lightness);throw new nl(1)}function FMe(i,e,t,n){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?ER(i,e,t):"rgba("+Rb(i,e,t)+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?ER(i.hue,i.saturation,i.lightness):"rgba("+Rb(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new nl(2)}function ck(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return lk("#"+Wm(i)+Wm(e)+Wm(t));if(typeof i=="object"&&e===void 0&&t===void 0)return lk("#"+Wm(i.red)+Wm(i.green)+Wm(i.blue));throw new nl(6)}function MR(i,e,t,n){if(typeof i=="string"&&typeof e=="number"){var r=_0(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?ck(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?ck(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")"}throw new nl(7)}var OMe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},BMe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},UMe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},kMe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function y0(i){if(typeof i!="object")throw new nl(8);if(BMe(i))return MR(i);if(OMe(i))return ck(i);if(kMe(i))return FMe(i);if(UMe(i))return DMe(i);throw new nl(8)}function Zte(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):Zte(i,e,r)}}function Dl(i){return Zte(i,i.length,[])}function GMe(i,e){if(e==="transparent")return e;var t=x0(e);return y0(Pa({},t,{hue:t.hue+parseFloat(i)}))}var Fft=Dl(GMe);function $1(i,e,t){return Math.max(i,Math.min(e,t))}function zMe(i,e){if(e==="transparent")return e;var t=x0(e);return y0(Pa({},t,{lightness:$1(0,1,t.lightness-parseFloat(i))}))}var Oft=Dl(zMe);function VMe(i,e){if(e==="transparent")return e;var t=x0(e);return y0(Pa({},t,{saturation:$1(0,1,t.saturation-parseFloat(i))}))}var Bft=Dl(VMe);function qMe(i,e){if(e==="transparent")return e;var t=x0(e);return y0(Pa({},t,{lightness:$1(0,1,t.lightness+parseFloat(i))}))}var Uft=Dl(qMe);function HMe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=_0(e),r=Pa({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=_0(t),o=Pa({},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 MR(x)}var WMe=Dl(HMe),Kte=WMe;function jMe(i,e){if(e==="transparent")return e;var t=_0(e),n=typeof t.alpha=="number"?t.alpha:1,r=Pa({},t,{alpha:$1(0,1,(n*100+parseFloat(i)*100)/100)});return MR(r)}var XMe=Dl(jMe),Qte=XMe;function $Me(i,e){if(e==="transparent")return e;var t=x0(e);return y0(Pa({},t,{saturation:$1(0,1,t.saturation+parseFloat(i))}))}var kft=Dl($Me);function YMe(i,e){return e==="transparent"?e:y0(Pa({},x0(e),{hue:parseFloat(i)}))}var Gft=Dl(YMe);function ZMe(i,e){return e==="transparent"?e:y0(Pa({},x0(e),{lightness:parseFloat(i)}))}var zft=Dl(ZMe);function KMe(i,e){return e==="transparent"?e:y0(Pa({},x0(e),{saturation:parseFloat(i)}))}var Vft=Dl(KMe);function QMe(i,e){return e==="transparent"?e:Kte(parseFloat(i),"rgb(0, 0, 0)",e)}var qft=Dl(QMe);function JMe(i,e){return e==="transparent"?e:Kte(parseFloat(i),"rgb(255, 255, 255)",e)}var Hft=Dl(JMe);function eCe(i,e){if(e==="transparent")return e;var t=_0(e),n=typeof t.alpha=="number"?t.alpha:1,r=Pa({},t,{alpha:$1(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return MR(r)}var Wft=Dl(eCe);var CR="http://www.w3.org/1999/xhtml",uk={svg:"http://www.w3.org/2000/svg",xhtml:CR,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function RR(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),uk.hasOwnProperty(e)?{space:uk[e],local:i}:i}function tCe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===CR&&e.documentElement.namespaceURI===CR?e.createElement(i):e.createElementNS(t,i)}}function nCe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function PR(i){var e=RR(i);return(e.local?nCe:tCe)(e)}function iCe(){}function IR(i){return i==null?iCe:function(){return this.querySelector(i)}}function Jte(i){typeof i!="function"&&(i=IR(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 ts(n,this._parents)}function hk(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function rCe(){return[]}function ene(i){return i==null?rCe:function(){return this.querySelectorAll(i)}}function sCe(i){return function(){return hk(i.apply(this,arguments))}}function tne(i){typeof i=="function"?i=sCe(i):i=ene(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 ts(n,r)}function nne(i){return function(){return this.matches(i)}}function NR(i){return function(e){return e.matches(i)}}var oCe=Array.prototype.find;function aCe(i){return function(){return oCe.call(this.children,i)}}function lCe(){return this.firstElementChild}function ine(i){return this.select(i==null?lCe:aCe(typeof i=="function"?i:NR(i)))}var cCe=Array.prototype.filter;function uCe(){return Array.from(this.children)}function hCe(i){return function(){return cCe.call(this.children,i)}}function rne(i){return this.selectAll(i==null?uCe:hCe(typeof i=="function"?i:NR(i)))}function sne(i){typeof i!="function"&&(i=nne(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 ts(n,this._parents)}function LR(i){return new Array(i.length)}function one(){return new ts(this._enter||this._groups.map(LR),this._parents)}function Pb(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}Pb.prototype={constructor:Pb,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 ane(i){return function(){return i}}function fCe(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 Pb(i,s[o]);for(;o<l;++o)(a=e[o])&&(r[o]=a)}function dCe(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 Pb(i,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(p[a])===l&&(r[a]=l)}function pCe(i){return i.__data__}function lne(i,e){if(!arguments.length)return Array.from(this,pCe);var t=e?dCe:fCe,n=this._parents,r=this._groups;typeof i!="function"&&(i=ane(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=ACe(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 ts(o,n),o._enter=a,o._exit=l,o}function ACe(i){return typeof i=="object"&&"length"in i?i:Array.from(i)}function cne(){return new ts(this._exit||this._groups.map(LR),this._parents)}function une(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 hne(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 ts(a,this._parents)}function fne(){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 dne(i){i||(i=mCe);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 ts(r,this._parents).order()}function mCe(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 Ane(){return Array.from(this)}function mne(){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 gne(){let i=0;for(let e of this)++i;return i}function _ne(){return!this.node()}function xne(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 gCe(i){return function(){this.removeAttribute(i)}}function _Ce(i){return function(){this.removeAttributeNS(i.space,i.local)}}function xCe(i,e){return function(){this.setAttribute(i,e)}}function yCe(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function vCe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function bCe(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 yne(i,e){var t=RR(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?_Ce:gCe:typeof e=="function"?t.local?bCe:vCe:t.local?yCe:xCe)(t,e))}function DR(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function wCe(i){return function(){this.style.removeProperty(i)}}function SCe(i,e,t){return function(){this.style.setProperty(i,e,t)}}function TCe(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function vne(i,e,t){return arguments.length>1?this.each((e==null?wCe:typeof e=="function"?TCe:SCe)(i,e,t??"")):ECe(this.node(),i)}function ECe(i,e){return i.style.getPropertyValue(e)||DR(i).getComputedStyle(i,null).getPropertyValue(e)}function MCe(i){return function(){delete this[i]}}function CCe(i,e){return function(){this[i]=e}}function RCe(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function bne(i,e){return arguments.length>1?this.each((e==null?MCe:typeof e=="function"?RCe:CCe)(i,e)):this.node()[i]}function wne(i){return i.trim().split(/^|\s+/)}function fk(i){return i.classList||new Sne(i)}function Sne(i){this._node=i,this._names=wne(i.getAttribute("class")||"")}Sne.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 Tne(i,e){for(var t=fk(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function Ene(i,e){for(var t=fk(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function PCe(i){return function(){Tne(this,i)}}function ICe(i){return function(){Ene(this,i)}}function NCe(i,e){return function(){(e.apply(this,arguments)?Tne:Ene)(this,i)}}function Mne(i,e){var t=wne(i+"");if(arguments.length<2){for(var n=fk(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?NCe:e?PCe:ICe)(t,e))}function LCe(){this.textContent=""}function DCe(i){return function(){this.textContent=i}}function FCe(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function Cne(i){return arguments.length?this.each(i==null?LCe:(typeof i=="function"?FCe:DCe)(i)):this.node().textContent}function OCe(){this.innerHTML=""}function BCe(i){return function(){this.innerHTML=i}}function UCe(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function Rne(i){return arguments.length?this.each(i==null?OCe:(typeof i=="function"?UCe:BCe)(i)):this.node().innerHTML}function kCe(){this.nextSibling&&this.parentNode.appendChild(this)}function Pne(){return this.each(kCe)}function GCe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ine(){return this.each(GCe)}function Nne(i){var e=typeof i=="function"?i:PR(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function zCe(){return null}function Lne(i,e){var t=typeof i=="function"?i:PR(i),n=e==null?zCe:typeof e=="function"?e:IR(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function VCe(){var i=this.parentNode;i&&i.removeChild(this)}function Dne(){return this.each(VCe)}function qCe(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function HCe(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function Fne(i){return this.select(i?HCe:qCe)}function One(i){return arguments.length?this.property("__data__",i):this.node().__data__}function WCe(i){return function(e){i.call(this,e,this.__data__)}}function jCe(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 XCe(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 $Ce(i,e,t){return function(){var n=this.__on,r,s=WCe(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 Bne(i,e,t){var n=jCe(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?$Ce:XCe,r=0;r<s;++r)this.each(a(n[r],e,t));return this}function Une(i,e,t){var n=DR(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 YCe(i,e){return function(){return Une(this,i,e)}}function ZCe(i,e){return function(){return Une(this,i,e.apply(this,arguments))}}function kne(i,e){return this.each((typeof e=="function"?ZCe:YCe)(i,e))}function*Gne(){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 dk=[null];function ts(i,e){this._groups=i,this._parents=e}function KCe(){return new ts([[document.documentElement]],dk)}function QCe(){return this}ts.prototype=KCe.prototype={constructor:ts,select:Jte,selectAll:tne,selectChild:ine,selectChildren:rne,filter:sne,data:lne,enter:one,exit:cne,join:une,merge:hne,selection:QCe,order:fne,sort:dne,call:pne,nodes:Ane,node:mne,size:gne,empty:_ne,each:xne,attr:yne,style:vne,property:bne,classed:Mne,text:Cne,html:Rne,raise:Pne,lower:Ine,append:Nne,insert:Lne,remove:Dne,clone:Fne,datum:One,on:Bne,dispatch:kne,[Symbol.iterator]:Gne};function pk(i){return typeof i=="string"?new ts([[document.querySelector(i)]],[document.documentElement]):new ts([[i]],dk)}function zne(i){let e;for(;e=i.sourceEvent;)i=e;return i}function Ak(i,e){if(i=zne(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 Lb,wr,jne,xk,v0,Vne,Xne,$ne,mk,OR,Ib,Yne,yk,gk,_k,JCe,UR={},kR=[],eRe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,zR=Array.isArray;function Vh(i,e){for(var t in e)i[t]=e[t];return i}function vk(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function tRe(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?Lb.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 Nb(i,o,n,r,null)}function Nb(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??++jne,__i:-1,__u:0};return r==null&&wr.vnode!=null&&wr.vnode(s),s}function VR(i){return i.children}function BR(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 nRe(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=Vh({},e);s.__v=e.__v+1,wr.vnode&&wr.vnode(s),bk(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,eie(n,s,r),e.__e=e.__=null,s.__e!=t&&Zne(s)}}function Zne(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}),Zne(i)}function qne(i){(!i.__d&&(i.__d=!0)&&v0.push(i)&&!GR.__r++||Vne!=wr.debounceRendering)&&((Vne=wr.debounceRendering)||Xne)(GR)}function GR(){try{for(var i,e=1;v0.length;)v0.length>e&&v0.sort($ne),i=v0.shift(),e=v0.length,nRe(i)}finally{v0.length=GR.__r=0}}function Kne(i,e,t,n,r,s,o,a,l,c,u){var f,p,x,v,w,S,T=n&&n.__k||kR,P=e.length;for(l=iRe(t,e,T,l,P),f=0;f<P;f++)(x=t.__k[f])!=null&&(p=x.__i!=-1&&T[x.__i]||UR,x.__i=f,S=bk(i,x,p,r,s,o,a,l,c,u),v=x.__e,x.ref&&p.ref!=x.ref&&(p.ref&&wk(p.ref,null,x),u.push(x.ref,x.__c||v,x)),w==null&&v!=null&&(w=v),4&x.__u?(l=Qne(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 iRe(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]=Nb(null,o,null,null,null):zR(o)?o=i.__k[s]=Nb(VR,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[s]=Nb(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=rRe(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)),nie(a,a));return n}function Qne(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=Qne(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 rRe(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 Hne(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||eRe.test(e)?t:t+"px"}function FR(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||Hne(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||Hne(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Yne,"$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[Ib]=n[Ib]:(t[Ib]=yk,i.addEventListener(e,s?_k:gk,s)):i.removeEventListener(e,s?_k:gk,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 Wne(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[OR]==null)e[OR]=yk++;else if(e[OR]<t[Ib])return;return t(wr.event?wr.event(e):e)}}}function bk(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=wr.__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 BR(P,L),p.constructor=z,p.render=oRe),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=Vh({},p.__s)),Vh(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)}),kR.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=wr.__r,F=0,R)p.state=p.__s,p.__d=!1,D&&D(e),u=p.render(p.props,p.state,p.context),kR.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=Vh(Vh({},n),p.getChildContext())),R&&!x&&p.getSnapshotBeforeUpdate!=null&&(S=p.getSnapshotBeforeUpdate(v,w)),N=u!=null&&u.type===VR&&u.key==null?tie(u.props.children):u,a=Kne(i,zR(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--;)vk(s[B])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),V.then||Jne(e),wr.__e(V,e,t)}}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=sRe(t.__e,e,t,n,r,s,o,l,c);return(u=wr.diffed)&&u(e),128&e.__u?void 0:a}function Jne(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(Jne))}function eie(i,e,t){for(var n=0;n<t.length;n++)wk(t[n],t[++n],t[++n]);wr.__c&&wr.__c(e,i),i.some(function(r){try{i=r.__h,r.__h=[],i.some(function(s){s.call(r)})}catch(s){wr.__e(s,r.__v)}})}function tie(i){return typeof i!="object"||i==null||i.__b>0?i:zR(i)?i.map(tie):i.constructor!==void 0?null:Vh({},i)}function sRe(i,e,t,n,r,s,o,a,l){var c,u,f,p,x,v,w,S=t.props||UR,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&&(wr.__m&&wr.__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&&Lb.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||FR(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||FR(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=""),Kne(e.type=="template"?i.content:i,zR(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--;)vk(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])&&FR(i,c,v,S[c],r),c="checked",w!=null&&w!=i[c]&&FR(i,c,w,S[c],r))}return i}function wk(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){wr.__e(r,t)}}function nie(i,e,t){var n,r;if(wr.unmount&&wr.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||wk(n,null,e)),(n=i.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){wr.__e(s,e)}n.base=n.__P=n.__n=null}if(n=i.__k)for(r=0;r<n.length;r++)n[r]&&nie(n[r],e,t||typeof i.type!="function");t||vk(i.__e),i.__c=i.__=i.__e=void 0}function oRe(i,e,t){return this.constructor(i,t)}function iie(i,e,t){var n,r,s,o;e==document&&(e=document.documentElement),wr.__&&wr.__(i,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,s=[],o=[],bk(e,i=(!n&&t||e).__k=tRe(VR,null,[i]),r||UR,UR,e.namespaceURI,!n&&t?[t]:r?null:e.firstChild?Lb.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n,o),eie(s,i,o),i.props.children=null}function Sk(i,e,t){var n,r,s,o,a=Vh({},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?Lb.call(arguments,2):t),Nb(i.type,a,n||i.key,r||i.ref,null)}Lb=kR.slice,wr={__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}},jne=0,xk=function(i){return i!=null&&i.constructor===void 0},BR.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Vh({},this.state),typeof i=="function"&&(i=i(Vh({},t),this.props)),i&&Vh(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),qne(this))},BR.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),qne(this))},BR.prototype.render=VR,v0=[],Xne=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,$ne=function(i,e){return i.__v.__b-e.__v.__b},GR.__r=0,mk=Math.random().toString(8),OR="__d"+mk,Ib="__a"+mk,Yne=/(PointerCapture)$|Capture$/i,yk=0,gk=Wne(!1),_k=Wne(!0),JCe=0;function rie(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 aRe(i){if(Array.isArray(i))return i}function lRe(i,e,t){return(e=pRe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function cRe(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 uRe(){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 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 hRe(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){lRe(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 fRe(i,e){return aRe(i)||cRe(i,e)||ARe(i,e)||uRe()}function dRe(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 pRe(i){var e=dRe(i,"string");return typeof e=="symbol"?e:e+""}function qR(i){"@babel/helpers - typeof";return qR=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},qR(i)}function ARe(i,e){if(i){if(typeof i=="string")return rie(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)?rie(i,e):void 0}}var Tk=function(e){if(qR(e)!=="object")return e;var t=Sk(e);if(t.props){var n;t.props=hRe({},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(Tk):Tk(t.props.children))}return t},mRe=function(e){return xk(Sk(e))},gRe=function(e,t){delete t.__k,iie(Tk(e),t)};function _Re(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 xRe=`.float-tooltip-kap {5257+ }`};var nd=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(){}},TMe=new qc(-1,1,1,-1,0,1),ok=class extends Wn{constructor(){super(),this.setAttribute("position",new In([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new In([0,2,0,0,2,0],2))}},EMe=new ok,bR=class{constructor(e){this._mesh=new Gn(EMe,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,TMe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}};var wR=class extends nd{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=HA.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 bR(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 Pb=class extends nd{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)}},SR=class extends nd{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}};var TR=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:Li}),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 wR(Wte),this.copyPass.material.blending=Yr,this.timer=new IA}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()}Pb!==void 0&&(o instanceof Pb?n=!0:o instanceof SR&&(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 ER=class extends nd{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 jte(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function x0(i,e){return x0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},x0(i,e)}function Xte(i,e){i.prototype=Object.create(e.prototype),i.prototype.constructor=i,x0(i,e)}function MR(i){return MR=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},MR(i)}function $te(i){try{return Function.toString.call(i).indexOf("[native code]")!==-1}catch{return typeof i=="function"}}function ak(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ak=function(){return!!i})()}function Yte(i,e,t){if(ak())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var r=new(i.bind.apply(i,n));return t&&x0(r,t.prototype),r}function CR(i){var e=typeof Map=="function"?new Map:void 0;return CR=function(n){if(n===null||!$te(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 Yte(n,arguments,MR(this).constructor)}return r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),x0(r,n)},CR(i)}var il=(function(i){Xte(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 jte(n)}return e})(CR(Error));function Zte(i,e){return i.substr(-e.length)===e}var MMe=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;function Kte(i){if(typeof i!="string")return i;var e=i.match(MMe);return e?parseFloat(i):i}var CMe=function(e){return function(t,n){n===void 0&&(n="16px");var r=t,s=n;if(typeof t=="string"){if(!Zte(t,"px"))throw new il(69,e,t);r=Kte(t)}if(typeof n=="string"){if(!Zte(n,"px"))throw new il(70,e,n);s=Kte(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}},Jte=CMe,qft=Jte("em");var Hft=Jte("rem");function lk(i){return Math.round(i*255)}function RMe(i,e,t){return lk(i)+","+lk(e)+","+lk(t)}function Ib(i,e,t,n){if(n===void 0&&(n=RMe),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 Qte={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 PMe(i){if(typeof i!="string")return i;var e=i.toLowerCase();return Qte[e]?"#"+Qte[e]:i}var IMe=/^#[a-fA-F0-9]{6}$/,NMe=/^#[a-fA-F0-9]{8}$/,LMe=/^#[a-fA-F0-9]{3}$/,DMe=/^#[a-fA-F0-9]{4}$/,ck=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,FMe=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,OMe=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,BMe=/^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 y0(i){if(typeof i!="string")throw new il(3);var e=PMe(i);if(e.match(IMe))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(NMe)){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(LMe))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(DMe)){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=ck.exec(e);if(r)return{red:parseInt(""+r[1],10),green:parseInt(""+r[2],10),blue:parseInt(""+r[3],10)};var s=FMe.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=OMe.exec(e);if(o){var a=parseInt(""+o[1],10),l=parseInt(""+o[2],10)/100,c=parseInt(""+o[3],10)/100,u="rgb("+Ib(a,l,c)+")",f=ck.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=BMe.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("+Ib(x,v,w)+")",T=ck.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 UMe(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 v0(i){return UMe(y0(i))}var kMe=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},hk=kMe;function Xm(i){var e=i.toString(16);return e.length===1?"0"+e:e}function uk(i){return Xm(Math.round(i*255))}function GMe(i,e,t){return hk("#"+uk(i)+uk(e)+uk(t))}function RR(i,e,t){return Ib(i,e,t,GMe)}function zMe(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return RR(i,e,t);if(typeof i=="object"&&e===void 0&&t===void 0)return RR(i.hue,i.saturation,i.lightness);throw new il(1)}function VMe(i,e,t,n){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number"&&typeof n=="number")return n>=1?RR(i,e,t):"rgba("+Ib(i,e,t)+","+n+")";if(typeof i=="object"&&e===void 0&&t===void 0&&n===void 0)return i.alpha>=1?RR(i.hue,i.saturation,i.lightness):"rgba("+Ib(i.hue,i.saturation,i.lightness)+","+i.alpha+")";throw new il(2)}function fk(i,e,t){if(typeof i=="number"&&typeof e=="number"&&typeof t=="number")return hk("#"+Xm(i)+Xm(e)+Xm(t));if(typeof i=="object"&&e===void 0&&t===void 0)return hk("#"+Xm(i.red)+Xm(i.green)+Xm(i.blue));throw new il(6)}function PR(i,e,t,n){if(typeof i=="string"&&typeof e=="number"){var r=y0(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?fk(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?fk(i.red,i.green,i.blue):"rgba("+i.red+","+i.green+","+i.blue+","+i.alpha+")"}throw new il(7)}var qMe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},HMe=function(e){return typeof e.red=="number"&&typeof e.green=="number"&&typeof e.blue=="number"&&typeof e.alpha=="number"},WMe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&(typeof e.alpha!="number"||typeof e.alpha>"u")},jMe=function(e){return typeof e.hue=="number"&&typeof e.saturation=="number"&&typeof e.lightness=="number"&&typeof e.alpha=="number"};function b0(i){if(typeof i!="object")throw new il(8);if(HMe(i))return PR(i);if(qMe(i))return fk(i);if(jMe(i))return VMe(i);if(WMe(i))return zMe(i);throw new il(8)}function ene(i,e,t){return function(){var r=t.concat(Array.prototype.slice.call(arguments));return r.length>=e?i.apply(this,r):ene(i,e,r)}}function Fl(i){return ene(i,i.length,[])}function XMe(i,e){if(e==="transparent")return e;var t=v0(e);return b0(Ia({},t,{hue:t.hue+parseFloat(i)}))}var Wft=Fl(XMe);function Z1(i,e,t){return Math.max(i,Math.min(e,t))}function $Me(i,e){if(e==="transparent")return e;var t=v0(e);return b0(Ia({},t,{lightness:Z1(0,1,t.lightness-parseFloat(i))}))}var jft=Fl($Me);function YMe(i,e){if(e==="transparent")return e;var t=v0(e);return b0(Ia({},t,{saturation:Z1(0,1,t.saturation-parseFloat(i))}))}var Xft=Fl(YMe);function ZMe(i,e){if(e==="transparent")return e;var t=v0(e);return b0(Ia({},t,{lightness:Z1(0,1,t.lightness+parseFloat(i))}))}var $ft=Fl(ZMe);function KMe(i,e,t){if(e==="transparent")return t;if(t==="transparent")return e;if(i===0)return t;var n=y0(e),r=Ia({},n,{alpha:typeof n.alpha=="number"?n.alpha:1}),s=y0(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 PR(x)}var QMe=Fl(KMe),tne=QMe;function JMe(i,e){if(e==="transparent")return e;var t=y0(e),n=typeof t.alpha=="number"?t.alpha:1,r=Ia({},t,{alpha:Z1(0,1,(n*100+parseFloat(i)*100)/100)});return PR(r)}var eCe=Fl(JMe),nne=eCe;function tCe(i,e){if(e==="transparent")return e;var t=v0(e);return b0(Ia({},t,{saturation:Z1(0,1,t.saturation+parseFloat(i))}))}var Yft=Fl(tCe);function nCe(i,e){return e==="transparent"?e:b0(Ia({},v0(e),{hue:parseFloat(i)}))}var Zft=Fl(nCe);function iCe(i,e){return e==="transparent"?e:b0(Ia({},v0(e),{lightness:parseFloat(i)}))}var Kft=Fl(iCe);function rCe(i,e){return e==="transparent"?e:b0(Ia({},v0(e),{saturation:parseFloat(i)}))}var Qft=Fl(rCe);function sCe(i,e){return e==="transparent"?e:tne(parseFloat(i),"rgb(0, 0, 0)",e)}var Jft=Fl(sCe);function oCe(i,e){return e==="transparent"?e:tne(parseFloat(i),"rgb(255, 255, 255)",e)}var edt=Fl(oCe);function aCe(i,e){if(e==="transparent")return e;var t=y0(e),n=typeof t.alpha=="number"?t.alpha:1,r=Ia({},t,{alpha:Z1(0,1,+(n*100-parseFloat(i)*100).toFixed(2)/100)});return PR(r)}var tdt=Fl(aCe);var IR="http://www.w3.org/1999/xhtml",dk={svg:"http://www.w3.org/2000/svg",xhtml:IR,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function NR(i){var e=i+="",t=e.indexOf(":");return t>=0&&(e=i.slice(0,t))!=="xmlns"&&(i=i.slice(t+1)),dk.hasOwnProperty(e)?{space:dk[e],local:i}:i}function lCe(i){return function(){var e=this.ownerDocument,t=this.namespaceURI;return t===IR&&e.documentElement.namespaceURI===IR?e.createElement(i):e.createElementNS(t,i)}}function cCe(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function LR(i){var e=NR(i);return(e.local?cCe:lCe)(e)}function uCe(){}function DR(i){return i==null?uCe:function(){return this.querySelector(i)}}function ine(i){typeof i!="function"&&(i=DR(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 pk(i){return i==null?[]:Array.isArray(i)?i:Array.from(i)}function hCe(){return[]}function rne(i){return i==null?hCe:function(){return this.querySelectorAll(i)}}function fCe(i){return function(){return pk(i.apply(this,arguments))}}function sne(i){typeof i=="function"?i=fCe(i):i=rne(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 one(i){return function(){return this.matches(i)}}function FR(i){return function(e){return e.matches(i)}}var dCe=Array.prototype.find;function pCe(i){return function(){return dCe.call(this.children,i)}}function ACe(){return this.firstElementChild}function ane(i){return this.select(i==null?ACe:pCe(typeof i=="function"?i:FR(i)))}var mCe=Array.prototype.filter;function gCe(){return Array.from(this.children)}function _Ce(i){return function(){return mCe.call(this.children,i)}}function lne(i){return this.selectAll(i==null?gCe:_Ce(typeof i=="function"?i:FR(i)))}function cne(i){typeof i!="function"&&(i=one(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 OR(i){return new Array(i.length)}function une(){return new ns(this._enter||this._groups.map(OR),this._parents)}function Nb(i,e){this.ownerDocument=i.ownerDocument,this.namespaceURI=i.namespaceURI,this._next=null,this._parent=i,this.__data__=e}Nb.prototype={constructor:Nb,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 hne(i){return function(){return i}}function xCe(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 Nb(i,s[o]);for(;o<l;++o)(a=e[o])&&(r[o]=a)}function yCe(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 Nb(i,s[a]);for(a=0;a<u;++a)(l=e[a])&&c.get(p[a])===l&&(r[a]=l)}function vCe(i){return i.__data__}function fne(i,e){if(!arguments.length)return Array.from(this,vCe);var t=e?yCe:xCe,n=this._parents,r=this._groups;typeof i!="function"&&(i=hne(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 dne(){return new ns(this._exit||this._groups.map(OR),this._parents)}function pne(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 Ane(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 mne(){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 gne(i){i||(i=wCe);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 wCe(i,e){return i<e?-1:i>e?1:i>=e?0:NaN}function _ne(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function xne(){return Array.from(this)}function yne(){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 vne(){let i=0;for(let e of this)++i;return i}function bne(){return!this.node()}function wne(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 SCe(i){return function(){this.removeAttribute(i)}}function TCe(i){return function(){this.removeAttributeNS(i.space,i.local)}}function ECe(i,e){return function(){this.setAttribute(i,e)}}function MCe(i,e){return function(){this.setAttributeNS(i.space,i.local,e)}}function CCe(i,e){return function(){var t=e.apply(this,arguments);t==null?this.removeAttribute(i):this.setAttribute(i,t)}}function RCe(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 Sne(i,e){var t=NR(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?TCe:SCe:typeof e=="function"?t.local?RCe:CCe:t.local?MCe:ECe)(t,e))}function BR(i){return i.ownerDocument&&i.ownerDocument.defaultView||i.document&&i||i.defaultView}function PCe(i){return function(){this.style.removeProperty(i)}}function ICe(i,e,t){return function(){this.style.setProperty(i,e,t)}}function NCe(i,e,t){return function(){var n=e.apply(this,arguments);n==null?this.style.removeProperty(i):this.style.setProperty(i,n,t)}}function Tne(i,e,t){return arguments.length>1?this.each((e==null?PCe:typeof e=="function"?NCe:ICe)(i,e,t??"")):LCe(this.node(),i)}function LCe(i,e){return i.style.getPropertyValue(e)||BR(i).getComputedStyle(i,null).getPropertyValue(e)}function DCe(i){return function(){delete this[i]}}function FCe(i,e){return function(){this[i]=e}}function OCe(i,e){return function(){var t=e.apply(this,arguments);t==null?delete this[i]:this[i]=t}}function Ene(i,e){return arguments.length>1?this.each((e==null?DCe:typeof e=="function"?OCe:FCe)(i,e)):this.node()[i]}function Mne(i){return i.trim().split(/^|\s+/)}function Ak(i){return i.classList||new Cne(i)}function Cne(i){this._node=i,this._names=Mne(i.getAttribute("class")||"")}Cne.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 Rne(i,e){for(var t=Ak(i),n=-1,r=e.length;++n<r;)t.add(e[n])}function Pne(i,e){for(var t=Ak(i),n=-1,r=e.length;++n<r;)t.remove(e[n])}function BCe(i){return function(){Rne(this,i)}}function UCe(i){return function(){Pne(this,i)}}function kCe(i,e){return function(){(e.apply(this,arguments)?Rne:Pne)(this,i)}}function Ine(i,e){var t=Mne(i+"");if(arguments.length<2){for(var n=Ak(this.node()),r=-1,s=t.length;++r<s;)if(!n.contains(t[r]))return!1;return!0}return this.each((typeof e=="function"?kCe:e?BCe:UCe)(t,e))}function GCe(){this.textContent=""}function zCe(i){return function(){this.textContent=i}}function VCe(i){return function(){var e=i.apply(this,arguments);this.textContent=e??""}}function Nne(i){return arguments.length?this.each(i==null?GCe:(typeof i=="function"?VCe:zCe)(i)):this.node().textContent}function qCe(){this.innerHTML=""}function HCe(i){return function(){this.innerHTML=i}}function WCe(i){return function(){var e=i.apply(this,arguments);this.innerHTML=e??""}}function Lne(i){return arguments.length?this.each(i==null?qCe:(typeof i=="function"?WCe:HCe)(i)):this.node().innerHTML}function jCe(){this.nextSibling&&this.parentNode.appendChild(this)}function Dne(){return this.each(jCe)}function XCe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Fne(){return this.each(XCe)}function One(i){var e=typeof i=="function"?i:LR(i);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function $Ce(){return null}function Bne(i,e){var t=typeof i=="function"?i:LR(i),n=e==null?$Ce:typeof e=="function"?e:DR(e);return this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})}function YCe(){var i=this.parentNode;i&&i.removeChild(this)}function Une(){return this.each(YCe)}function ZCe(){var i=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function KCe(){var i=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(i,this.nextSibling):i}function kne(i){return this.select(i?KCe:ZCe)}function Gne(i){return arguments.length?this.property("__data__",i):this.node().__data__}function QCe(i){return function(e){i.call(this,e,this.__data__)}}function JCe(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 eRe(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 tRe(i,e,t){return function(){var n=this.__on,r,s=QCe(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 zne(i,e,t){var n=JCe(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?tRe:eRe,r=0;r<s;++r)this.each(a(n[r],e,t));return this}function Vne(i,e,t){var n=BR(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 nRe(i,e){return function(){return Vne(this,i,e)}}function iRe(i,e){return function(){return Vne(this,i,e.apply(this,arguments))}}function qne(i,e){return this.each((typeof e=="function"?iRe:nRe)(i,e))}function*Hne(){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 mk=[null];function ns(i,e){this._groups=i,this._parents=e}function rRe(){return new ns([[document.documentElement]],mk)}function sRe(){return this}ns.prototype=rRe.prototype={constructor:ns,select:ine,selectAll:sne,selectChild:ane,selectChildren:lne,filter:cne,data:fne,enter:une,exit:dne,join:pne,merge:Ane,selection:sRe,order:mne,sort:gne,call:_ne,nodes:xne,node:yne,size:vne,empty:bne,each:wne,attr:Sne,style:Tne,property:Ene,classed:Ine,text:Nne,html:Lne,raise:Dne,lower:Fne,append:One,insert:Bne,remove:Une,clone:kne,datum:Gne,on:zne,dispatch:qne,[Symbol.iterator]:Hne};function gk(i){return typeof i=="string"?new ns([[document.querySelector(i)]],[document.documentElement]):new ns([[i]],mk)}function Wne(i){let e;for(;e=i.sourceEvent;)i=e;return i}function _k(i,e){if(i=Wne(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 Fb,Tr,Zne,bk,w0,jne,Kne,Qne,xk,kR,Lb,Jne,wk,yk,vk,oRe,zR={},VR=[],aRe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,HR=Array.isArray;function qh(i,e){for(var t in e)i[t]=e[t];return i}function Sk(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function lRe(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?Fb.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 Db(i,o,n,r,null)}function Db(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??++Zne,__i:-1,__u:0};return r==null&&Tr.vnode!=null&&Tr.vnode(s),s}function WR(i){return i.children}function GR(i,e){this.props=i,this.context=e}function $m(i,e){if(e==null)return i.__?$m(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"?$m(i):null}function cRe(i){if(i.__P&&i.__d){var e=i.__v,t=e.__e,n=[],r=[],s=qh({},e);s.__v=e.__v+1,Tr.vnode&&Tr.vnode(s),Tk(i.__P,s,e,i.__n,i.__P.namespaceURI,32&e.__u?[t]:null,n,t??$m(e),!!(32&e.__u),r),s.__v=e.__v,s.__.__k[s.__i]=s,rie(n,s,r),e.__e=e.__=null,s.__e!=t&&eie(s)}}function eie(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}),eie(i)}function Xne(i){(!i.__d&&(i.__d=!0)&&w0.push(i)&&!qR.__r++||jne!=Tr.debounceRendering)&&((jne=Tr.debounceRendering)||Kne)(qR)}function qR(){try{for(var i,e=1;w0.length;)w0.length>e&&w0.sort(Qne),i=w0.shift(),e=w0.length,cRe(i)}finally{w0.length=qR.__r=0}}function tie(i,e,t,n,r,s,o,a,l,c,u){var f,p,x,v,w,S,T=n&&n.__k||VR,P=e.length;for(l=uRe(t,e,T,l,P),f=0;f<P;f++)(x=t.__k[f])!=null&&(p=x.__i!=-1&&T[x.__i]||zR,x.__i=f,S=Tk(i,x,p,r,s,o,a,l,c,u),v=x.__e,x.ref&&p.ref!=x.ref&&(p.ref&&Ek(p.ref,null,x),u.push(x.ref,x.__c||v,x)),w==null&&v!=null&&(w=v),4&x.__u?(l=nie(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 uRe(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]=Db(null,o,null,null,null):HR(o)?o=i.__k[s]=Db(WR,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=i.__k[s]=Db(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=hRe(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=$m(a)),oie(a,a));return n}function nie(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=nie(n[r],e,t));return e}i.__e!=e&&(e&&i.type&&!e.parentNode&&(e=$m(i)),e=t.insertBefore(i.__e,e||null));do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function hRe(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 $ne(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||aRe.test(e)?t:t+"px"}function UR(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||$ne(i.style,e,"");if(t)for(e in t)n&&t[e]==n[e]||$ne(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")s=e!=(e=e.replace(Jne,"$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[Lb]=n[Lb]:(t[Lb]=wk,i.addEventListener(e,s?vk:yk,s)):i.removeEventListener(e,s?vk:yk,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 Yne(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e[kR]==null)e[kR]=wk++;else if(e[kR]<t[Lb])return;return t(Tr.event?Tr.event(e):e)}}}function Tk(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 GR(P,L),p.constructor=z,p.render=dRe),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=qh({},p.__s)),qh(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)}),VR.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&o.push(p),a=$m(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),VR.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=qh(qh({},n),p.getChildContext())),R&&!x&&p.getSnapshotBeforeUpdate!=null&&(S=p.getSnapshotBeforeUpdate(v,w)),N=u!=null&&u.type===WR&&u.key==null?sie(u.props.children):u,a=tie(i,HR(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--;)Sk(s[B])}else e.__e=t.__e;e.__k==null&&(e.__k=t.__k||[]),V.then||iie(e),Tr.__e(V,e,t)}}else s==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=fRe(t.__e,e,t,n,r,s,o,l,c);return(u=Tr.diffed)&&u(e),128&e.__u?void 0:a}function iie(i){i&&(i.__c&&(i.__c.__e=!0),i.__k&&i.__k.some(iie))}function rie(i,e,t){for(var n=0;n<t.length;n++)Ek(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 sie(i){return typeof i!="object"||i==null||i.__b>0?i:HR(i)?i.map(sie):i.constructor!==void 0?null:qh({},i)}function fRe(i,e,t,n,r,s,o,a,l){var c,u,f,p,x,v,w,S=t.props||zR,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&&Fb.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||UR(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||UR(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=""),tie(e.type=="template"?i.content:i,HR(p)?p:[p],e,t,n,P=="foreignObject"?"http://www.w3.org/1999/xhtml":r,s,o,s?s[0]:t.__k&&$m(t,0),a,l),s!=null)for(c=s.length;c--;)Sk(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])&&UR(i,c,v,S[c],r),c="checked",w!=null&&w!=i[c]&&UR(i,c,w,S[c],r))}return i}function Ek(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 oie(i,e,t){var n,r;if(Tr.unmount&&Tr.unmount(i),(n=i.ref)&&(n.current&&n.current!=i.__e||Ek(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]&&oie(n[r],e,t||typeof i.type!="function");t||Sk(i.__e),i.__c=i.__=i.__e=void 0}function dRe(i,e,t){return this.constructor(i,t)}function aie(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=[],Tk(e,i=(!n&&t||e).__k=lRe(WR,null,[i]),r||zR,zR,e.namespaceURI,!n&&t?[t]:r?null:e.firstChild?Fb.call(e.childNodes):null,s,!n&&t?t:r?r.__e:e.firstChild,n,o),rie(s,i,o),i.props.children=null}function Mk(i,e,t){var n,r,s,o,a=qh({},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?Fb.call(arguments,2):t),Db(i.type,a,n||i.key,r||i.ref,null)}Fb=VR.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}},Zne=0,bk=function(i){return i!=null&&i.constructor===void 0},GR.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=qh({},this.state),typeof i=="function"&&(i=i(qh({},t),this.props)),i&&qh(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),Xne(this))},GR.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),Xne(this))},GR.prototype.render=WR,w0=[],Kne=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Qne=function(i,e){return i.__v.__b-e.__v.__b},qR.__r=0,xk=Math.random().toString(8),kR="__d"+xk,Lb="__a"+xk,Jne=/(PointerCapture)$|Capture$/i,wk=0,yk=Yne(!1),vk=Yne(!0),oRe=0;function lie(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 pRe(i){if(Array.isArray(i))return i}function ARe(i,e,t){return(e=vRe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function mRe(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 gRe(){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 cie(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 _Re(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?cie(Object(t),!0).forEach(function(n){ARe(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):cie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function xRe(i,e){return pRe(i)||mRe(i,e)||bRe(i,e)||gRe()}function yRe(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 vRe(i){var e=yRe(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 lie(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)?lie(i,e):void 0}}var Ck=function(e){if(jR(e)!=="object")return e;var t=Mk(e);if(t.props){var n;t.props=_Re({},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(Ck):Ck(t.props.children))}return t},wRe=function(e){return bk(Mk(e))},SRe=function(e,t){delete t.__k,aie(Ck(e),t)};function TRe(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 ERe=`.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-`;_Re(xRe);var oie=Nr({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&&qR(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=fRe(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=Ak(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):mRe(e.content)?(e.tooltipEl.text(""),gRe(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 yRe(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 vRe=`.scene-nav-info {5269+`;TRe(ERe);var uie=Dr({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=gk(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=xRe(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=_k(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):wRe(e.content)?(e.tooltipEl.text(""),SRe(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 MRe(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 CRe=`.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-}`;yRe(vRe);function Ek(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 bRe(i){if(Array.isArray(i))return i}function wRe(i){if(Array.isArray(i))return Ek(i)}function SRe(i,e,t){return(e=IRe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function TRe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function ERe(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 MRe(){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 CRe(){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 RRe(i,e){return bRe(i)||ERe(i,e)||aie(i,e)||MRe()}function Xm(i){return wRe(i)||TRe(i)||aie(i)||CRe()}function PRe(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 IRe(i){var e=PRe(i,"string");return typeof e=="symbol"?e:e+""}function aie(i,e){if(i){if(typeof i=="string")return Ek(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)?Ek(i,e):void 0}}var lie=function(e){e instanceof Array?e.forEach(lie):(e.map&&e.map.dispose(),e.dispose())},cie=function(e){e.geometry&&e.geometry.dispose(),e.material&&lie(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(cie)},NRe=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),cie(t)}},Sr=window.THREE?window.THREE:{WebGLRenderer:JT,Scene:Hd,PerspectiveCamera:Rr,Raycaster:Xy,SRGBColorSpace:jr,TextureLoader:zc,Vector2:Oe,Vector3:ie,Box3:fa,Color:Ut,Mesh:Hn,SphereGeometry:pa,MeshBasicMaterial:Us,BackSide:ui,Timer:RA},Mk=Nr({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 Vs(u).to(l,r).easing(Lr.Quadratic.Out).onUpdate(p).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new Vs(f).to(c,r/3).easing(Lr.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 Sr.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 Sr.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 Sr.Vector3(0,0,0),a=Math.max.apply(Math,Xm(Object.entries(t).map(function(x){var v=RRe(x,2),w=v[0],S=v[1];return Math.max.apply(Math,Xm(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 Sr.Box3(new Sr.Vector3(0,0,0),new Sr.Vector3(0,0,0)),r=e.objects.filter(t);return r.length?(r.forEach(function(s){return n.expandByObject(s)}),Object.assign.apply(Object,Xm(["x","y","z"].map(function(s){return SRe({},s,[n.min[s],n.max[s]])})))):null},getScreenCoords:function(e,t,n,r){var s=new Sr.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 Sr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),o=new Sr.Raycaster;return o.setFromCamera(s,e.camera),Object.assign({},o.ray.at(r,new Sr.Vector3))},intersectingObjects:function(e,t,n){var r=new Sr.Vector2(t/e.width*2-1,-(n/e.height)*2+1),s=new Sr.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;NRe(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 Sr.Scene,camera:new Sr.PerspectiveCamera,timer:new Sr.Timer,tweenGroup:new WA,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 oie(t.container),t.pointerPos=new Sr.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?D1:Sr.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 bR(t.renderer),t.postProcessingComposer.addPass(new wR(t.scene,t.camera)),t.controls=new{trackball:AR,orbit:gR,fly:_R}[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(Xm(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 Sr.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(Xm(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(Xm(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(Xm(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 Sr.SphereGeometry(e.skyRadius)),t.hasOwnProperty("backgroundColor")){var f=_0(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Sr.Color(Qte(1,e.backgroundColor)),f)}t.hasOwnProperty("backgroundImageUrl")&&(e.backgroundImageUrl?new Sr.TextureLoader().load(e.backgroundImageUrl,function(x){x.colorSpace=Sr.SRGBColorSpace,e.skysphere.material=new Sr.MeshBasicMaterial({map:x,side:Sr.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 LRe(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 DRe=`.scene-container .clickable {5284+}`;MRe(CRe);function Rk(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){if(Array.isArray(i))return Rk(i)}function IRe(i,e,t){return(e=URe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function NRe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function LRe(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 DRe(){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 FRe(){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 ORe(i,e){return RRe(i)||LRe(i,e)||hie(i,e)||DRe()}function Ym(i){return PRe(i)||NRe(i)||hie(i)||FRe()}function BRe(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 URe(i){var e=BRe(i,"string");return typeof e=="symbol"?e:e+""}function hie(i,e){if(i){if(typeof i=="string")return Rk(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)?Rk(i,e):void 0}}var fie=function(e){e instanceof Array?e.forEach(fie):(e.map&&e.map.dispose(),e.dispose())},die=function(e){e.geometry&&e.geometry.dispose(),e.material&&fie(e.material),e.texture&&e.texture.dispose(),e.children&&e.children.forEach(die)},kRe=function(e){for(;e.children.length;){var t=e.children[0];e.remove(t),die(t)}},Er=window.THREE?window.THREE:{WebGLRenderer:n3,Scene:jd,PerspectiveCamera:Ir,Raycaster:Yy,SRGBColorSpace:yr,TextureLoader:Ql,Vector2:Oe,Vector3:ie,Box3:da,Color:Ut,Mesh:Gn,SphereGeometry:Aa,MeshBasicMaterial:as,BackSide:ui,Timer:IA},Pk=Dr({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 qs(u).to(l,r).easing(Fr.Quadratic.Out).onUpdate(p).onComplete(function(){e.povPosTween=void 0,e.tweenGroup.remove(this)}).start()),e.tweenGroup.add(e.povTgtTween=new qs(f).to(c,r/3).easing(Fr.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,Ym(Object.entries(t).map(function(x){var v=ORe(x,2),w=v[0],S=v[1];return Math.max.apply(Math,Ym(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,Ym(["x","y","z"].map(function(s){return IRe({},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;kRe(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 XA,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 uie(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?O1: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 TR(t.renderer),t.postProcessingComposer.addPass(new ER(t.scene,t.camera)),t.controls=new{trackball:_R,orbit:yR,fly:vR}[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(Ym(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(Ym(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(Ym(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(Ym(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=y0(e.backgroundColor).alpha;f===void 0&&(f=1),e.renderer.setClearColor(new Er.Color(nne(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 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-container .clickable {52875287 cursor: pointer;5288-}`;LRe(DRe);function Ck(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=Array(e);t<e;t++)n[t]=i[t];return n}function FRe(i){if(Array.isArray(i))return Ck(i)}function Fb(i,e,t){return(e=zRe(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ORe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function BRe(){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 uie(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 $m(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?uie(Object(t),!0).forEach(function(n){Fb(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):uie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function URe(i,e){if(i==null)return{};var t,n,r=kRe(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 kRe(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 HR(i){return FRe(i)||ORe(i)||VRe(i)||BRe()}function GRe(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 zRe(i){var e=GRe(i,"string");return typeof e=="symbol"?e:e+""}function VRe(i,e){if(i){if(typeof i=="string")return Ck(i,e);var t={}.toString.call(i).slice(8,-1);return t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set"?Array.from(i):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ck(i,e):void 0}}function hie(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 qRe=["rendererConfig","waitForGlobeReady"],Db=$m($m({},window.THREE?window.THREE:{AmbientLight:CA,DirectionalLight:MA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:i3}),fie=hie("globe",YU),HRe=Object.assign.apply(Object,HR(["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 Fb({},i,fie.linkProp(i))}))),WRe=Object.assign.apply(Object,HR(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return Fb({},i,fie.linkMethod(i))}))),die=hie("renderObjs",Mk),jRe=Object.assign.apply(Object,HR(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return Fb({},i,die.linkProp(i))}))),XRe=Object.assign.apply(Object,HR(["lights","postProcessingComposer"].map(function(i){return Fb({},i,die.linkMethod(i))}))),pie=Nr({props:$m($m({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}))}}},HRe),jRe),methods:$m($m({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 Vs(r).to(o,n).easing(Lr.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()}},WRe),XRe),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=URe(e,qRe),o=new YU($m({waitForGlobeReady:r},s));return{globe:o,renderObjs:Mk({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new Db.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new Db.AmbientLight(13421772,Math.PI),new Db.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new WA}},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 Db.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}};Db.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 $Re=4,Ur=null,WR="",Aie=null,XR=new Map,Pk=new Map,mie=new Map;function _ie(){let i=Pz(U.map)==="sphere"&&j0(U.map)!==null;we.globeToggle.hidden=!i,yie(),!i&&Ur&&(Ur._destructor(),Ur=null,WR="",we.globe.replaceChildren())}function Ik(){U.globeActive?yie():wie()}var xie=2.5,jR=2;function YRe(i){return No(xie/2**(i-jR),.08,4)}function ZRe(i){let e=(U.variant?.maxZoom??jR)+2;return No(jR+Math.log2(xie/i),0,e)}function yie(){let i=j0(U.map),e=U.engine?.getView();if(Ur&&U.globeActive&&i&&e){let t=Ur.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(ZRe(t.altitude))}U.globeActive=!1,we.globe.hidden=!0,we.globeToggle.setAttribute("aria-pressed","false"),we.viewport.hidden=!1,U.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function vie(){if(!Ur||!U.globeActive)return null;let i=Ur.pointOfView();return{lat:i.lat,lng:i.lng}}function bie(i,e,t){if(!Ur)return;let n=Ur.pointOfView().altitude;Ur.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function wie(){let i=j0(U.map);if(!i)return;U.globeActive=!0,we.viewport.hidden=!0,we.globe.hidden=!1,we.globeToggle.setAttribute("aria-pressed","true"),U.overviewKey="",Ur||(Ur=pie({animateIn:!1})(we.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(s=>s.lat).objectLng(s=>s.lng).objectAltitude(s=>s.pin===U.selectedPin?.03:.014).objectThreeObject(s=>QRe(s.pin)).objectLabel(s=>s.pin.location.title).onObjectClick(s=>Ex(s.pin)).onObjectHover(s=>{we.globe.style.cursor=s?"pointer":""}).onZoom(()=>document.dispatchEvent(new Event("atlas:globe-camera"))),document.addEventListener("atlas:selection",KRe),document.addEventListener("atlas:filters",gie)),Nk();let e=U.engine?.getView(),t=e?.getCenter();if(t){let[s,o]=i.toLatLng(t[0],-t[1]);Ur.pointOfView({lat:s,lng:o,altitude:YRe(e.getZoom()??jR)})}let n=U.variant||U.map.variants[0],r=`${U.game.stamp}:${U.map.slug}:${n.tiles}`;if(WR!==r){WR=r;let s=await e4e(n);s&&WR===r&&Ur.globeImageUrl(s)}Aie!==U.pins&&(Aie=U.pins,XR.clear(),Pk.clear(),Ur.objectsData(JRe(i))),gie(),Sie(),document.dispatchEvent(new Event("atlas:globe-camera"))}function Sie(){if(Ur){for(let[i,e]of XR){let t=i===U.selectedPin;e.material=Tie(i.category,t);let n=t?9:5;e.scale.set(n,n,1)}Ur.objectAltitude(i=>i.pin===U.selectedPin?.03:.014)}}function KRe(){if(!Ur||!U.globeActive)return;Sie();let i=Pk.get(U.selectedPin);if(i){let e=Ur.pointOfView().altitude;Ur.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function gie(){if(!(!Ur||!U.globeActive))for(let[i,e]of XR)e.visible=!i.filteredHidden&&!U.hiddenCategories.has(i.category.id)}function QRe(i){let e=new _y(Tie(i.category,i===U.selectedPin)),t=i===U.selectedPin?9:5;return e.scale.set(t,t,1),e.visible=!i.filteredHidden&&!U.hiddenCategories.has(i.category.id),XR.set(i,e),e}function Tie(i,e){let t=`${Ox(i)}:${e?"ringed":"plain"}`,n=mie.get(t);if(n)return n;n=new Wd({depthWrite:!1}),mie.set(t,n);let r=U.markerIcons.get(Ox(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=H0(),l.strokeText(Pc(i.title),40,41),l.fillStyle=W0(i),l.fillText(Pc(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 zc().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 Eie(){U.globeActive&&wie()}function Nk(){!Ur||we.globe.hidden||Ur.width(we.globe.clientWidth).height(we.globe.clientHeight)}function JRe(i){let e=[];for(let t of U.pins){let[n,r]=Cg(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),Pk.set(t,{lat:s,lng:o})}return e}async function e4e(i){let e=Math.min($Re,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(t4e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function t4e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function Mie(){let i=U.variant,e=we.overviewCanvas,t=e.getContext("2d"),n=Su(),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||!YR(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}`}Y1()}function Y1(){let i=vie();if(i){let w=j0(U.map);if(!w||!U.variant)return;let S=Su(),[T,P]=w.toWorld(i.lat,i.lng),R=we.overviewCanvas,C=No((T-S[0])/(S[2]-S[0]),0,1),L=No((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=Su(),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=No((n[0]-t[0])/r,0,1),f=No((n[2]-t[0])/r,0,1),p=No((t[3]-n[3])/s,0,1),x=No((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 $R(i,e=!0){U.overviewDocked=i,i&&U.overviewPointer!==null&&(U.overviewPointer=null,Z1()),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&&Cc()}function Lk(i,e){let t=we.overviewCanvas.getBoundingClientRect(),n=Su(),r=(a,l,c)=>No((a-l)/(c-l),0,1);if(U.globeActive){let a=j0(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);bie(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 Fl(i){return new Yq({updateWhileAnimating:!0,...i})}function Cie(){let i=U.game.tileGrid.size,e=[0,-i,i,0];U.projection=new ud({code:"ATLAS:PIXELS",units:"pixels",extent:e}),U.sources={grid:new pf({wrapX:!1}),gridContext:new pf({wrapX:!1}),zoneScrim:new pf({wrapX:!1}),zones:new pf({wrapX:!1}),zoneTitles:new pf({wrapX:!1}),text:new pf({wrapX:!1}),pins:new pf({wrapX:!1}),priority:new pf({wrapX:!1})},U.layers={raster:new I5({zIndex:0}),rasterDetail:new I5({zIndex:1}),grid:Fl({source:U.sources.grid,style:dI,renderOrder:jl,renderBuffer:40,zIndex:5}),zoneScrim:Fl({source:U.sources.zoneScrim,style:rV,zIndex:6}),zones:Fl({source:U.sources.zones,style:sV,renderBuffer:32,zIndex:10}),zoneTitles:Fl({source:U.sources.zoneTitles,style:oV,renderOrder:jl,renderBuffer:160,zIndex:20}),zoneTitleDetail:Fl({source:U.sources.zoneTitles,style:aV,renderOrder:jl,renderBuffer:160,zIndex:44}),text:Fl({source:U.sources.text,style:Qz,renderOrder:jl,renderBuffer:220,zIndex:30}),textDetail:Fl({source:U.sources.text,style:Jz,renderOrder:jl,renderBuffer:220,zIndex:45}),zoneText:Fl({source:U.sources.text,style:eV,renderOrder:jl,renderBuffer:220,zIndex:41}),pins:Fl({source:U.sources.pins,style:Yz,renderOrder:jl,renderBuffer:48,zIndex:40}),zonePins:Fl({source:U.sources.pins,style:Zz,renderOrder:jl,renderBuffer:48,zIndex:42}),pinLabels:Fl({source:U.sources.pins,style:Kz,renderOrder:jl,renderBuffer:180,zIndex:45}),gridContext:Fl({source:U.sources.gridContext,style:dI,renderOrder:jl,renderBuffer:40,zIndex:48}),priority:Fl({source:U.sources.priority,style:tV,renderOrder:jl,renderBuffer:220,zIndex:50})},U.engine=new vq({target:we.viewport,layers:Object.values(U.layers),controls:rS({attribution:!1,rotate:!1,zoom:!1}),interactions:uS({onFocusOnly:!1}),view:Dk(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&&Z1()}),U.engine.on("postrender",Y1),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){Tx(r.hash);return}}let n=U.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>ZR(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:ZR});n&&Ex(n)}),U.engine.on("pointermove",t=>{if(t.dragging){Rg(null);return}let n=U.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>ZR(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:ZR}),r=n&&Tu(n.category)==="text"?null:n;Rg(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",()=>Rg(null))}function ZR(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 Dk(i){let e=U.game.tileGrid.size;return new ul({projection:U.projection,center:[e/2,-e/2],resolutions:Fk(i),minZoom:0,maxZoom:i,extent:[0,-e,e,0],constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function Fk(i){let e=U.game.tileGrid.size/U.game.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function of(i,e){U.game=U.catalog.games.find(r=>r.slug===i)||U.catalog.games[0],U.engine||Cie(),!e&&!U.restore&&(U.restore=xg(U.game.slug)),we.game.value=U.game.slug,R0(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 Ok((n||U.game.maps[0]).slug)}async function Ok(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 SV(e)}catch{U.mapRun===t&&(we.loading.hidden=!0,K0());return}if(U.mapRun!==t)return;U.settling=!0,U.map=n,document.documentElement.style.setProperty("--icon-outset-color",H0()),we.map.value=U.map.slug,R0(we.variant,U.map.variants,"name"),we.variantField.hidden=U.map.variants.length<2,U.styleCache.clear(),Rg(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)),$R(!!U.restore?.overviewDocked,!1),zw(U.restore?!!U.restore.dockFolded:!0,!1),U.dockDismissed=!!U.restore?.dockDismissed,U.search="",we.search.value="",we.dock.hidden=!1,Rc(),yV(),mI(),_V(),Bk(r?No(r.variant,0,U.map.variants.length-1):0,!0),_ie(),U.restore=null,we.sidebar.classList.remove("is-open"),we.mobileLegend.setAttribute("aria-expanded","false"),iz(),U.settling=!1,Cc()}function Bk(i,e=!1){let t=U.variant;U.variant=U.map.variants[i]||U.map.variants[0];let n=U.variant,r=e?null:r4e(t,n),s=wu(n);we.variant.value=String(U.map.variants.indexOf(U.variant)),e?U.engine.setView(Dk(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 tz({projection:U.projection,tileGrid:new gx({extent:[0,-U.game.tileGrid.size,U.game.tileGrid.size,0],origin:[0,0],resolutions:Fk(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)=>YR(n,w,S,T)),p=U.layers.raster.getSource();U.layers.raster.setSource(f),U.layers.raster.setExtent(Su()),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&&YR(n,w,S,T))),U.layers.rasterDetail.setExtent(Su()),U.layers.rasterDetail.setVisible(!0)):U.layers.rasterDetail.setVisible(!1),x?.clear(),Bw(),U.gridEnabled&&(bu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()),U.overviewKey="",Mie();let v=e&&U.restore?.map===U.map.slug?U.restore:null;if(U.renderedShard!==(n.shard||0)&&(mI(),Hl()),v?.center&&Number.isFinite(v.zoom)){let w=U.engine.getView();w.setCenter(v.center),w.setZoom(v.zoom),U.fitZoom=v.zoom,Z0()}else e?requestAnimationFrame(s4e):(r&&U.engine.getView().animate({center:r,duration:200}),Z0());Cc()}function YR(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 wu(i){return i.maxZoom+2}function Z1(){Z0(),Cc()}function r4e(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+No(r,0,1)*e.bounds.width,-(e.bounds.y+No(s,0,1)*e.bounds.height)]}function Rie(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");we.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>U.engine?.updateSize())}function Su(){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 s4e(){if(!U.engine||!U.variant)return;let i=U.engine.getView();i.fit(Su(),{size:U.engine.getSize(),padding:[36,36,36,36],maxZoom:U.variant.maxZoom,duration:0}),U.fitZoom=i.getZoom()||0,Z0()}function Ob(i){let e=U.engine.getView(),t=e.getZoom()||0;e.animate({zoom:No(t+i,U.variant.minZoom,wu(U.variant)),duration:140})}function Z0(){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(Xl(n))continue;let[r,s]=n.coordinate;r>=e[0]&&r<=e[2]&&s>=e[1]&&s<=e[3]&&t++}we.visibleCount.textContent=`${Ic(U.eligibleLocations)} enabled \xB7 ${Ic(t)} in view`}function Pie(){we.game.addEventListener("change",()=>{of(we.game.value)}),we.map.addEventListener("change",()=>{Ok(we.map.value)}),we.addBundles.addEventListener("click",()=>{bI()}),we.emptyOpen.addEventListener("click",()=>{bI()}),we.variant.addEventListener("change",()=>{Bk(Number(we.variant.value)),Eie()}),we.globeToggle.addEventListener("click",()=>Ik()),we.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){bV(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),Hl(),yd()});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(),wV(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),tS()}),we.soloChip.addEventListener("click",()=>Ux(!0)),nn("#expand-all").addEventListener("click",()=>yI(!1)),nn("#collapse-all").addEventListener("click",()=>yI(!0)),nn("#show-all").addEventListener("click",()=>Ux(!0)),nn("#hide-all").addEventListener("click",()=>Ux(!1)),we.zoneToggle.addEventListener("change",()=>{Jw(we.zoneToggle.checked)}),we.zoneIndex.addEventListener("click",n=>{let r=n.target.closest("[data-zone]");r&&AV(Number(r.dataset.zone))}),we.zoneIndex.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),mV(Number(r.dataset.zone)))}),we.search.addEventListener("input",()=>{U.search=we.search.value.trim().toLocaleLowerCase(),Hl(),U.search&&Gw()}),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&&HP(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&&HP(s)}),nn("#close-detail").addEventListener("click",Rc),nn("#zoom-in").addEventListener("click",()=>Ob(1)),nn("#zoom-out").addEventListener("click",()=>Ob(-1)),we.gridBack.addEventListener("click",GP),we.gridInput.addEventListener("input",()=>{let n=q0(),r=[...we.gridInput.value.toLocaleLowerCase()].filter(s=>Gl.includes(s)).slice(0,n).join("");we.gridInput.value=r,Tx(r)}),we.subgridToggle.addEventListener("click",()=>{Sx(!U.subgridVisible),we.viewport.focus({preventScroll:!0})}),we.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Sx(!U.subgridVisible);return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),we.viewport.focus({preventScroll:!0}))}),we.viewport.addEventListener("keydown",n=>{if(!kw(n.target)){if(n.key==="+"||n.key==="=")Ob(1);else if(n.key==="-")Ob(-1);else if(n.key==="Escape")Rc();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{kw(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if(!kw(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){we.globeToggle.hidden||(n.preventDefault(),Ik());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(),Rie();return}bz(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||eS(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&eS(!1)}),window.addEventListener("blur",()=>eS(!1)),window.addEventListener("hashchange",()=>{let n=yg();n.game===U.game?.slug&&n.map===U.map?.slug||(U.restore=null,of(n.game||U.catalog.games[0].slug,n.map))}),window.addEventListener("resize",()=>{U.engine?.updateSize(),Y1(),Nk()}),document.addEventListener("atlas:globe-camera",()=>Y1()),we.overview.addEventListener("pointerdown",n=>{U.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),we.overview.setPointerCapture(n.pointerId),U.overviewPointer=n.pointerId,Lk(n,!0))}),we.overview.addEventListener("pointermove",n=>{U.overviewPointer===n.pointerId&&(n.preventDefault(),Lk(n,!1))});let t=n=>{U.overviewPointer===n.pointerId&&(U.overviewPointer=null,Z1())};we.overview.addEventListener("pointerup",t),we.overview.addEventListener("pointercancel",t),we.overviewDock.addEventListener("click",()=>{$R(!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 Iie(){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?wu(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:q0(),extent:U.gridEnabled?bg():null,cells:[...U.sources.grid.getFeatures(),...U.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:U.gridPrefix?U.pins.filter(e=>!e.filteredHidden&&wg(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>U.layers[e]?.setVisible(t),refreshCatalog:K0},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 Nie(){Pie();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(),R0(we.game,U.catalog.games,"title"),vI(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{K0()}),U.catalog.games.length){let e=yg(),t=xg(),n=t&&(!e.game||e.game===t.game&&e.map===t.map);U.restore=n?t:null,await of(e.game||t?.game||U.catalog.games[0].slug,e.map||t?.map),U.restore=null}else we.loading.hidden=!0;Iie(),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}}Nie();})();5288+}`;GRe(zRe);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 VRe(i){if(Array.isArray(i))return Ik(i)}function Bb(i,e,t){return(e=$Re(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function qRe(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function HRe(){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 pie(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 Zm(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pie(Object(t),!0).forEach(function(n){Bb(i,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):pie(Object(t)).forEach(function(n){Object.defineProperty(i,n,Object.getOwnPropertyDescriptor(t,n))})}return i}function WRe(i,e){if(i==null)return{};var t,n,r=jRe(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 jRe(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 XR(i){return VRe(i)||qRe(i)||YRe(i)||HRe()}function XRe(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 $Re(i){var e=XRe(i,"string");return typeof e=="symbol"?e:e+""}function YRe(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}}function Aie(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 ZRe=["rendererConfig","waitForGlobeReady"],Ob=Zm(Zm({},window.THREE?window.THREE:{AmbientLight:PA,DirectionalLight:RA,Vector2:Oe,REVISION:"185"}),{},{CSS2DRenderer:o3}),mie=Aie("globe",QU),KRe=Object.assign.apply(Object,XR(["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 Bb({},i,mie.linkProp(i))}))),QRe=Object.assign.apply(Object,XR(["globeMaterial","globeTileEngineClearCache","getGlobeRadius","getCoords","toGeoCoords"].map(function(i){return Bb({},i,mie.linkMethod(i))}))),gie=Aie("renderObjs",Pk),JRe=Object.assign.apply(Object,XR(["width","height","backgroundColor","backgroundImageUrl","enablePointerInteraction"].map(function(i){return Bb({},i,gie.linkProp(i))}))),e4e=Object.assign.apply(Object,XR(["lights","postProcessingComposer"].map(function(i){return Bb({},i,gie.linkMethod(i))}))),_ie=Dr({props:Zm(Zm({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}))}}},KRe),JRe),methods:Zm(Zm({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 qs(r).to(o,n).easing(Fr.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()}},QRe),e4e),stateInit:function(e){var t=e.rendererConfig,n=e.waitForGlobeReady,r=n===void 0?!0:n,s=WRe(e,ZRe),o=new QU(Zm({waitForGlobeReady:r},s));return{globe:o,renderObjs:Pk({controlType:"orbit",rendererConfig:t,waitForLoadComplete:r,extraRenderers:[new Ob.CSS2DRenderer]}).skyRadius(o.getGlobeRadius()*500).showNavInfo(!1).objects([o]).lights([new Ob.AmbientLight(13421772,Math.PI),new Ob.DirectionalLight(16777215,.6*Math.PI)]),tweenGroup:new XA}},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 Ob.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}};Ob.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 bie=4,t4e=100,n4e=t4e+.2,id=8,i4e=96;function r4e(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 sr=null,$R="",Ps={group:null,tiles:new Map,key:"",variant:""},Nk=null,ZR=new Map,Dk=new Map,xie=new Map;function wie(){let i=Dz(U.map)==="sphere"&&$0(U.map)!==null;we.globeToggle.hidden=!i,Eie(),!i&&sr&&(Ub(),Ps.group=null,sr._destructor(),sr=null,$R="",Nk=null,we.globe.replaceChildren())}function Fk(){U.globeActive?Eie():Rie()}var Sie=2.5,YR=2;function s4e(i){return Lo(Sie/2**(i-YR),.08,4)}function Tie(i){let e=(U.variant?.maxZoom??YR)+2;return Lo(YR+Math.log2(Sie/i),0,e)}function Eie(){let i=$0(U.map),e=U.engine?.getView();if(sr&&U.globeActive&&i&&e){let t=sr.pointOfView(),[n,r]=i.toWorld(t.lat,t.lng);e.cancelAnimations(),e.setCenter([n,-r]),e.setZoom(Tie(t.altitude))}U.globeActive=!1,we.globe.hidden=!0,we.globeToggle.setAttribute("aria-pressed","false"),we.viewport.hidden=!1,Ub(),U.overviewKey="",document.dispatchEvent(new Event("atlas:globe-camera"))}function Mie(){if(!sr||!U.globeActive)return null;let i=sr.pointOfView();return{lat:i.lat,lng:i.lng}}function Cie(i,e,t){if(!sr)return;let n=sr.pointOfView().altitude;sr.pointOfView({lat:i,lng:e,altitude:n},t?180:0)}async function Rie(){let i=$0(U.map);if(!i)return;U.globeActive=!0,we.viewport.hidden=!0,we.globe.hidden=!1,we.globeToggle.setAttribute("aria-pressed","true"),U.overviewKey="",sr||(sr=_ie({animateIn:!1})(we.globe).backgroundColor("#0b0e12").showAtmosphere(!0).atmosphereColor("#8a6f5b").atmosphereAltitude(.12).objectLat(s=>s.lat).objectLng(s=>s.lng).objectAltitude(s=>s.pin===U.selectedPin?.03:.014).objectThreeObject(s=>l4e(s.pin)).objectLabel(s=>s.pin.location.title).onObjectClick(s=>Cx(s.pin)).onObjectHover(s=>{we.globe.style.cursor=s?"pointer":""}).onZoom(()=>{document.dispatchEvent(new Event("atlas:globe-camera")),yie()}),document.addEventListener("atlas:selection",a4e),document.addEventListener("atlas:filters",vie),Ps.group=new Xr,sr.scene().add(Ps.group)),Ok();let e=U.engine?.getView(),t=e?.getCenter();if(t){let[s,o]=i.toLatLng(t[0],-t[1]);sr.pointOfView({lat:s,lng:o,altitude:s4e(e.getZoom()??YR)})}let n=U.variant||U.map.variants[0],r=`${U.game.stamp}:${U.map.slug}:${n.tiles}`;if($R!==r){$R=r;let s=await u4e(n);s&&$R===r&&sr.globeImageUrl(s)}Nk!==U.pins&&(Nk=U.pins,ZR.clear(),Dk.clear(),sr.objectsData(c4e(i))),vie(),Iie(),yie(),document.dispatchEvent(new Event("atlas:globe-camera"))}function yie(){if(!sr||!Ps.group)return;let i=U.globeActive?U.variant||U.map.variants[0]:null;if(!i){Ub();return}Ps.variant!==i.tiles&&(Ub(),Ps.variant=i.tiles);let e=sr.pointOfView(),t=Math.min(Math.round(Tie(e.altitude))+1,i.maxZoom);if(t<=bie||!i.formats[t]){Ub(),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>i4e&&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),Pie(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=o4e(i,x,v,w);Ps.tiles.set(p,S),Ps.group.add(S)}}}function o4e(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<=id;w++){let S=o-w/id*r;for(let T=0;T<=id;T++){let P=s+T/id*r;a.push(...r4e(S,P,n4e)),l.push(T/id,1-w/id)}}let u=id+1;for(let w=0;w<id;w++)for(let S=0;S<id;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 Wn;f.setAttribute("position",new In(a,3)),f.setAttribute("uv",new In(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 Ql().load(v,w=>{w.colorSpace=yr,p.map=w,p.needsUpdate=!0,x.visible=!0}),x}function Ub(){if(Ps.group){for(let i of Ps.tiles.values())Ps.group.remove(i),Pie(i);Ps.tiles.clear(),Ps.key=""}}function Pie(i){i.geometry.dispose(),i.material.map?.dispose(),i.material.dispose()}function Iie(){if(sr){for(let[i,e]of ZR){let t=i===U.selectedPin;e.material=Nie(i.category,t);let n=t?9:5;e.scale.set(n,n,1)}sr.objectAltitude(i=>i.pin===U.selectedPin?.03:.014)}}function a4e(){if(!sr||!U.globeActive)return;Iie();let i=Dk.get(U.selectedPin);if(i){let e=sr.pointOfView().altitude;sr.pointOfView({lat:i.lat,lng:i.lng,altitude:e},600)}}function vie(){if(!(!sr||!U.globeActive))for(let[i,e]of ZR)e.visible=!i.filteredHidden&&!U.hiddenCategories.has(i.category.id)}function l4e(i){let e=new yy(Nie(i.category,i===U.selectedPin)),t=i===U.selectedPin?9:5;return e.scale.set(t,t,1),e.visible=!i.filteredHidden&&!U.hiddenCategories.has(i.category.id),ZR.set(i,e),e}function Nie(i,e){let t=`${Ux(i)}:${e?"ringed":"plain"}`,n=xie.get(t);if(n)return n;n=new Xd({depthWrite:!1}),xie.set(t,n);let r=U.markerIcons.get(Ux(i)),s=o=>{let a=document.createElement("canvas");a.width=80,a.height=80;let l=a.getContext("2d");o?l.drawImage(o,8,8,64,64):(l.font="900 26px Inter, system-ui, sans-serif",l.textAlign="center",l.textBaseline="middle",l.lineWidth=6,l.strokeStyle=j0(),l.strokeText(Nc(i.title),40,41),l.fillStyle=X0(i),l.fillText(Nc(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 Ql().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 Lie(){U.globeActive&&Rie()}function Ok(){!sr||we.globe.hidden||sr.width(we.globe.clientWidth).height(we.globe.clientHeight)}function c4e(i){let e=[];for(let t of U.pins){let[n,r]=Pg(t.location.lat,t.location.lng),[s,o]=i.toLatLng(n,-r);e.push({lat:s,lng:o,pin:t}),Dk.set(t,{lat:s,lng:o})}return e}async function u4e(i){let e=Math.min(bie,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(h4e(u).then(f=>{f&&o.drawImage(f,c*256,l*256,256,256)}))}return await Promise.all(a),s.toDataURL("image/jpeg",.92)}function h4e(i){return new Promise(e=>{let t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=i})}function Die(){let i=U.variant,e=we.overviewCanvas,t=e.getContext("2d"),n=Tu(),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||!QR(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}`}K1()}function K1(){let i=Mie();if(i){let w=$0(U.map);if(!w||!U.variant)return;let S=Tu(),[T,P]=w.toWorld(i.lat,i.lng),R=we.overviewCanvas,C=Lo((T-S[0])/(S[2]-S[0]),0,1),L=Lo((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=Tu(),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=Lo((n[0]-t[0])/r,0,1),f=Lo((n[2]-t[0])/r,0,1),p=Lo((t[3]-n[3])/s,0,1),x=Lo((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 KR(i,e=!0){U.overviewDocked=i,i&&U.overviewPointer!==null&&(U.overviewPointer=null,Q1()),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&&Pc()}function Bk(i,e){let t=we.overviewCanvas.getBoundingClientRect(),n=Tu(),r=(a,l,c)=>Lo((a-l)/(c-l),0,1);if(U.globeActive){let a=$0(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);Cie(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 Ol(i){return new Jq({updateWhileAnimating:!0,...i})}function Fie(){let i=U.game.tileGrid.size,e=[0,-i,i,0];U.projection=new fd({code:"ATLAS:PIXELS",units:"pixels",extent:e}),U.sources={grid:new Af({wrapX:!1}),gridContext:new Af({wrapX:!1}),zoneScrim:new Af({wrapX:!1}),zones:new Af({wrapX:!1}),zoneTitles:new Af({wrapX:!1}),text:new Af({wrapX:!1}),pins:new Af({wrapX:!1}),priority:new Af({wrapX:!1})},U.layers={raster:new D5({zIndex:0}),rasterDetail:new D5({zIndex:1}),grid:Ol({source:U.sources.grid,style:mI,renderOrder:Xl,renderBuffer:40,zIndex:5}),zoneScrim:Ol({source:U.sources.zoneScrim,style:lV,zIndex:6}),zones:Ol({source:U.sources.zones,style:cV,renderBuffer:32,zIndex:10}),zoneTitles:Ol({source:U.sources.zoneTitles,style:uV,renderOrder:Xl,renderBuffer:160,zIndex:20}),zoneTitleDetail:Ol({source:U.sources.zoneTitles,style:hV,renderOrder:Xl,renderBuffer:160,zIndex:44}),text:Ol({source:U.sources.text,style:nV,renderOrder:Xl,renderBuffer:220,zIndex:30}),textDetail:Ol({source:U.sources.text,style:iV,renderOrder:Xl,renderBuffer:220,zIndex:45}),zoneText:Ol({source:U.sources.text,style:rV,renderOrder:Xl,renderBuffer:220,zIndex:41}),pins:Ol({source:U.sources.pins,style:Jz,renderOrder:Xl,renderBuffer:48,zIndex:40}),zonePins:Ol({source:U.sources.pins,style:eV,renderOrder:Xl,renderBuffer:48,zIndex:42}),pinLabels:Ol({source:U.sources.pins,style:tV,renderOrder:Xl,renderBuffer:180,zIndex:45}),gridContext:Ol({source:U.sources.gridContext,style:mI,renderOrder:Xl,renderBuffer:40,zIndex:48}),priority:Ol({source:U.sources.priority,style:sV,renderOrder:Xl,renderBuffer:220,zIndex:50})},U.engine=new Tq({target:we.viewport,layers:Object.values(U.layers),controls:aS({attribution:!1,rotate:!1,zoom:!1}),interactions:dS({onFocusOnly:!1}),view:Uk(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&&Q1()}),U.engine.on("postrender",K1),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){Mx(r.hash);return}}let n=U.engine.forEachFeatureAtPixel(t.pixel,(r,s)=>JR(s)&&r.get("pin")||null,{hitTolerance:5,layerFilter:JR});n&&Cx(n)}),U.engine.on("pointermove",t=>{if(t.dragging){Ig(null);return}let n=U.engine.forEachFeatureAtPixel(t.pixel,(o,a)=>JR(a)&&o.get("pin")||null,{hitTolerance:4,layerFilter:JR}),r=n&&Eu(n.category)==="text"?null:n;Ig(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",()=>Ig(null))}function JR(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 Uk(i){let e=U.game.tileGrid.size;return new hl({projection:U.projection,center:[e/2,-e/2],resolutions:kk(i),minZoom:0,maxZoom:i,extent:[0,-e,e,0],constrainResolution:!1,smoothResolutionConstraint:!1,showFullExtent:!0,zoom:0})}function kk(i){let e=U.game.tileGrid.size/U.game.tileGrid.tileSize;return Array.from({length:i+1},(t,n)=>e/2**n)}async function af(i,e){U.game=U.catalog.games.find(r=>r.slug===i)||U.catalog.games[0],U.engine||Fie(),!e&&!U.restore&&(U.restore=vg(U.game.slug)),we.game.value=U.game.slug,I0(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 Gk((n||U.game.maps[0]).slug)}async function Gk(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 CV(e)}catch{U.mapRun===t&&(we.loading.hidden=!0,J0());return}if(U.mapRun!==t)return;U.settling=!0,U.map=n,document.documentElement.style.setProperty("--icon-outset-color",j0()),we.map.value=U.map.slug,I0(we.variant,U.map.variants,"name"),we.variantField.hidden=U.map.variants.length<2,U.styleCache.clear(),Ig(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)),KR(!!U.restore?.overviewDocked,!1),Hw(U.restore?!!U.restore.dockFolded:!0,!1),U.dockDismissed=!!U.restore?.dockDismissed,U.search="",we.search.value="",we.dock.hidden=!1,Ic(),SV(),xI(),bV(),zk(r?Lo(r.variant,0,U.map.variants.length-1):0,!0),wie(),U.restore=null,we.sidebar.classList.remove("is-open"),we.mobileLegend.setAttribute("aria-expanded","false"),az(),U.settling=!1,Pc()}function zk(i,e=!1){let t=U.variant;U.variant=U.map.variants[i]||U.map.variants[0];let n=U.variant,r=e?null:p4e(t,n),s=Su(n);we.variant.value=String(U.map.variants.indexOf(U.variant)),e?U.engine.setView(Uk(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 sz({projection:U.projection,tileGrid:new xx({extent:[0,-U.game.tileGrid.size,U.game.tileGrid.size,0],origin:[0,0],resolutions:kk(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)=>QR(n,w,S,T)),p=U.layers.raster.getSource();U.layers.raster.setSource(f),U.layers.raster.setExtent(Tu()),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&&QR(n,w,S,T))),U.layers.rasterDetail.setExtent(Tu()),U.layers.rasterDetail.setVisible(!0)):U.layers.rasterDetail.setVisible(!1),x?.clear(),Gw(),U.gridEnabled&&(wu(),U.layers.pins.changed(),U.layers.text.changed(),U.layers.priority.changed()),U.overviewKey="",Die();let v=e&&U.restore?.map===U.map.slug?U.restore:null;if(U.renderedShard!==(n.shard||0)&&(xI(),Wl()),v?.center&&Number.isFinite(v.zoom)){let w=U.engine.getView();w.setCenter(v.center),w.setZoom(v.zoom),U.fitZoom=v.zoom,Q0()}else e?requestAnimationFrame(A4e):(r&&U.engine.getView().animate({center:r,duration:200}),Q0());Pc()}function QR(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=d4e(i,e,r),l=o*r.w+s;return(a[l>>3]&1<<(l&7))!==0}function d4e(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 Su(i){return i.maxZoom+2}function Q1(){Q0(),Pc()}function p4e(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+Lo(r,0,1)*e.bounds.width,-(e.bounds.y+Lo(s,0,1)*e.bounds.height)]}function Oie(){let e=document.querySelector(".app-shell").classList.toggle("sidebar-collapsed");we.mobileLegend.setAttribute("aria-expanded",String(!e)),requestAnimationFrame(()=>U.engine?.updateSize())}function Tu(){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 A4e(){if(!U.engine||!U.variant)return;let i=U.engine.getView();i.fit(Tu(),{size:U.engine.getSize(),padding:[36,36,36,36],maxZoom:U.variant.maxZoom,duration:0}),U.fitZoom=i.getZoom()||0,Q0()}function kb(i){let e=U.engine.getView(),t=e.getZoom()||0;e.animate({zoom:Lo(t+i,U.variant.minZoom,Su(U.variant)),duration:140})}function Q0(){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($l(n))continue;let[r,s]=n.coordinate;r>=e[0]&&r<=e[2]&&s>=e[1]&&s<=e[3]&&t++}we.visibleCount.textContent=`${Lc(U.eligibleLocations)} enabled \xB7 ${Lc(t)} in view`}function Bie(){we.game.addEventListener("change",()=>{af(we.game.value)}),we.map.addEventListener("change",()=>{Gk(we.map.value)}),we.addBundles.addEventListener("click",()=>{TI()}),we.emptyOpen.addEventListener("click",()=>{TI()}),we.variant.addEventListener("change",()=>{zk(Number(we.variant.value)),Lie()}),we.globeToggle.addEventListener("click",()=>Fk()),we.legend.addEventListener("change",n=>{let r=n.target;if(r.dataset.sectionToggle){EV(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),Wl(),bd()});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(),MV(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),rS()}),we.soloChip.addEventListener("click",()=>Gx(!0)),nn("#expand-all").addEventListener("click",()=>wI(!1)),nn("#collapse-all").addEventListener("click",()=>wI(!0)),nn("#show-all").addEventListener("click",()=>Gx(!0)),nn("#hide-all").addEventListener("click",()=>Gx(!1)),we.zoneToggle.addEventListener("change",()=>{nS(we.zoneToggle.checked)}),we.zoneIndex.addEventListener("click",n=>{let r=n.target.closest("[data-zone]");r&&xV(Number(r.dataset.zone))}),we.zoneIndex.addEventListener("contextmenu",n=>{let r=n.target.closest("[data-zone]");r&&(n.preventDefault(),yV(Number(r.dataset.zone)))}),we.search.addEventListener("input",()=>{U.search=we.search.value.trim().toLocaleLowerCase(),Wl(),U.search&&qw()}),we.dockFold.addEventListener("click",()=>{jP(!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&&XP(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&&XP(s)}),nn("#close-detail").addEventListener("click",Ic),nn("#zoom-in").addEventListener("click",()=>kb(1)),nn("#zoom-out").addEventListener("click",()=>kb(-1)),we.gridBack.addEventListener("click",qP),we.gridInput.addEventListener("input",()=>{let n=W0(),r=[...we.gridInput.value.toLocaleLowerCase()].filter(s=>zl.includes(s)).slice(0,n).join("");we.gridInput.value=r,Mx(r)}),we.subgridToggle.addEventListener("click",()=>{Ex(!U.subgridVisible),we.viewport.focus({preventScroll:!0})}),we.gridInput.addEventListener("keydown",n=>{if(n.key===" "){n.preventDefault(),Ex(!U.subgridVisible);return}n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),we.viewport.focus({preventScroll:!0}))}),we.viewport.addEventListener("keydown",n=>{if(!Vw(n.target)){if(n.key==="+"||n.key==="=")kb(1);else if(n.key==="-")kb(-1);else if(n.key==="Escape")Ic();else return;n.preventDefault()}}),window.addEventListener("contextmenu",n=>{Vw(n.target)||n.preventDefault()}),window.addEventListener("keydown",n=>{if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="r"){n.preventDefault(),location.reload();return}if(!Vw(n.target)){if(n.key==="`"&&!n.metaKey&&!n.ctrlKey&&!n.altKey){we.globeToggle.hidden||(n.preventDefault(),Fk());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||jP(!U.dockFolded);return}if((n.metaKey||n.ctrlKey)&&n.key.toLocaleLowerCase()==="b"){n.preventDefault(),Oie();return}Ez(n)||n.key.toLocaleLowerCase()==="z"&&(n.preventDefault(),n.repeat||iS(!0))}}),window.addEventListener("keyup",n=>{n.key.toLocaleLowerCase()==="z"&&iS(!1)}),window.addEventListener("blur",()=>iS(!1)),window.addEventListener("hashchange",()=>{let n=bg();n.game===U.game?.slug&&n.map===U.map?.slug||(U.restore=null,af(n.game||U.catalog.games[0].slug,n.map))}),window.addEventListener("resize",()=>{U.engine?.updateSize(),K1(),Ok()}),document.addEventListener("atlas:globe-camera",()=>K1()),we.overview.addEventListener("pointerdown",n=>{U.overviewDocked||n.pointerType==="mouse"&&n.button!==0||(n.preventDefault(),we.overview.setPointerCapture(n.pointerId),U.overviewPointer=n.pointerId,Bk(n,!0))}),we.overview.addEventListener("pointermove",n=>{U.overviewPointer===n.pointerId&&(n.preventDefault(),Bk(n,!1))});let t=n=>{U.overviewPointer===n.pointerId&&(U.overviewPointer=null,Q1())};we.overview.addEventListener("pointerup",t),we.overview.addEventListener("pointercancel",t),we.overviewDock.addEventListener("click",()=>{KR(!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 Uie(){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?Su(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:W0(),extent:U.gridEnabled?Sg():null,cells:[...U.sources.grid.getFeatures(),...U.sources.gridContext.getFeatures()].map(e=>e.get("gridCell")),priorityPins:U.gridPrefix?U.pins.filter(e=>!e.filteredHidden&&Tg(e)).length:0}});window.__atlasDebug={snapshot:i,setLayerVisible:(e,t)=>U.layers[e]?.setVisible(t),refreshCatalog:J0},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 kie(){Bie();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(),I0(we.game,U.catalog.games,"title"),SI(),window.runtime?.EventsOn?.("atlas:catalog-changed",()=>{J0()}),U.catalog.games.length){let e=bg(),t=vg(),n=t&&(!e.game||e.game===t.game&&e.map===t.map);U.restore=n?t:null,await af(e.game||t?.game||U.catalog.games[0].slug,e.map||t?.map),U.restore=null}else we.loading.hidden=!0;Uie(),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}}kie();})();@@ -10,7 +10,17 @@
1010 // the same card it opens on the chart. The chart never goes away: this is a1111 // second way of seeing the same bundle, a toggle apart.1212 import Globe from "globe.gl";13-import { Sprite, SpriteMaterial, TextureLoader } from "three";13+import {14+ BufferGeometry,15+ Float32BufferAttribute,16+ Group,17+ Mesh,18+ MeshBasicMaterial,19+ Sprite,20+ SpriteMaterial,21+ SRGBColorSpace,22+ TextureLoader,23+} from "three";1424 1525 import { overzoomLevels } from "./constants.js";1626 import { showPin } from "./detail.js";@@ -22,13 +32,36 @@ import { categoryColor, iconOutsetColor, initials } from "./theme.js";
2232 import { clamp } from "./util.js";2333 import { project } from "./zones.js";2434 25-// textureZoom picks the pyramid level the sphere wears: deep enough to read,26-// shallow enough that one canvas holds it everywhere (level 4 is a27-// 4096x2048 texture).35+// textureZoom picks the pyramid level the sphere wears everywhere: deep36+// enough to read from orbit, shallow enough that one canvas holds the whole37+// planet (level 4 is a 4096x2048 texture). Closer than that, the detail38+// layer below takes over with the pyramid's own tiles.2839 const textureZoom = 4;2940 41+// The sphere three-globe draws has radius 100, and its objects place a42+// latitude and longitude with this exact spelling; the detail tiles use the43+// same one, so they land on the pixel the base skin and the pins already44+// agree on. Tiles float just off the skin, well under the pins.45+const globeRadius = 100;46+const detailRadius = globeRadius + 0.2;47+const detailSegments = 8;48+const detailTileBudget = 96;49+50+function surfacePoint(lat, lng, radius) {51+ const phi = ((90 - lat) * Math.PI) / 180;52+ const theta = ((90 - lng) * Math.PI) / 180;53+ return [54+ radius * Math.sin(phi) * Math.cos(theta),55+ radius * Math.cos(phi),56+ radius * Math.sin(phi) * Math.sin(theta),57+ ];58+}59+3060 let globe = null;3161 let texturedFor = "";62+// The detail layer: pyramid tiles standing just off the base skin wherever63+// the camera is close enough to want them, keyed by level/column/row.64+const detail = { group: null, tiles: new Map(), key: "", variant: "" };3265 // The pins the standing sprites were built from. The renderer creates3366 // sprites lazily on its own tick, so nothing here may assume they exist3467 // the moment the data is handed over -- each sprite is born already@@ -50,9 +83,12 @@ export function syncGlobe() {
5083 elements.globeToggle.hidden = !offered;5184 leaveGlobe();5285 if (!offered && globe) {86+ clearDetailTiles();87+ detail.group = null;5388 globe._destructor();5489 globe = null;5590 texturedFor = "";91+ pinsBuilt = null;5692 elements.globe.replaceChildren();5793 }5894 }@@ -97,6 +133,9 @@ function leaveGlobe() {
97133 elements.globe.hidden = true;98134 elements.globeToggle.setAttribute("aria-pressed", "false");99135 elements.viewport.hidden = false;136+ // The neighborhood of tiles under the camera goes back to the pyramid;137+ // the base skin is all a put-away globe keeps.138+ clearDetailTiles();100139 // The overview goes back to marking the chart's window; the memo that101140 // spares it redundant work must not spare it this change.102141 state.overviewKey = "";@@ -142,9 +181,14 @@ async function enterGlobe() {
142181 .onObjectHover((point) => {143182 elements.globe.style.cursor = point ? "pointer" : "";144183 })145- .onZoom(() => document.dispatchEvent(new Event("atlas:globe-camera")));184+ .onZoom(() => {185+ document.dispatchEvent(new Event("atlas:globe-camera"));186+ updateDetailTiles();187+ });146188 document.addEventListener("atlas:selection", syncSelection);147189 document.addEventListener("atlas:filters", syncFilters);190+ detail.group = new Group();191+ globe.scene().add(detail.group);148192 }149193 resizeGlobe();150194 @@ -174,9 +218,138 @@ async function enterGlobe() {
174218 }175219 syncFilters();176220 restyleSelection();221+ updateDetailTiles();177222 document.dispatchEvent(new Event("atlas:globe-camera"));178223 }179224 225+// updateDetailTiles keeps the pyramid under the camera: past the base226+// skin's depth, the level the altitude asks for is fetched tile by tile227+// around the point being faced -- the same tiles the chart reads, each one228+// a perfect square of latitude and longitude draped at its place. Away229+// from the camera the base skin carries on; this layer only ever holds the230+// neighborhood being looked at.231+function updateDetailTiles() {232+ if (!globe || !detail.group) return;233+ const variant = state.globeActive ? state.variant || state.map.variants[0] : null;234+ if (!variant) {235+ clearDetailTiles();236+ return;237+ }238+ if (detail.variant !== variant.tiles) {239+ clearDetailTiles();240+ detail.variant = variant.tiles;241+ }242+ const pov = globe.pointOfView();243+ const zoom = Math.min(244+ Math.round(zoomForAltitude(pov.altitude)) + 1,245+ variant.maxZoom,246+ );247+ if (zoom <= textureZoom || !variant.formats[zoom]) {248+ clearDetailTiles();249+ detail.key = "";250+ return;251+ }252+253+ const columns = 2 ** zoom;254+ const rows = columns / 2;255+ const span = 360 / columns;256+ // How much ground the camera can possibly see: the horizon angle at this257+ // altitude, padded a little so tiles arrive before their ground does.258+ const horizon = (Math.acos(1 / (1 + pov.altitude)) * 180) / Math.PI + span;259+ const centerColumn = Math.floor((((pov.lng + 180) % 360) + 360) % 360 / span);260+ const centerRow = Math.floor((90 - pov.lat) / span);261+ let reach = Math.ceil(horizon / span);262+ while ((2 * reach + 1) ** 2 > detailTileBudget && reach > 1) reach--;263+264+ const wanted = new Set();265+ for (let dr = -reach; dr <= reach; dr++) {266+ const row = centerRow + dr;267+ if (row < 0 || row >= rows) continue;268+ for (let dc = -reach; dc <= reach; dc++) {269+ const column = (((centerColumn + dc) % columns) + columns) % columns;270+ wanted.add(`${zoom}/${column}/${row}`);271+ }272+ }273+ const key = `${variant.tiles}:${[...wanted].sort().join(",")}`;274+ if (key === detail.key) return;275+ detail.key = key;276+277+ for (const [name, mesh] of detail.tiles) {278+ if (wanted.has(name)) continue;279+ detail.group.remove(mesh);280+ disposeTile(mesh);281+ detail.tiles.delete(name);282+ }283+ for (const name of wanted) {284+ if (detail.tiles.has(name)) continue;285+ const [z, column, row] = name.split("/").map(Number);286+ const mesh = tileMesh(variant, z, column, row);287+ detail.tiles.set(name, mesh);288+ detail.group.add(mesh);289+ }290+}291+292+// tileMesh drapes one pyramid tile at its place on the sphere: a grid of293+// points through the same latitude-longitude spelling the pins stand by,294+// wearing the tile image once it arrives.295+function tileMesh(variant, zoom, column, row) {296+ const span = 360 / 2 ** zoom;297+ const west = -180 + column * span;298+ const north = 90 - row * span;299+ const positions = [];300+ const uvs = [];301+ const indices = [];302+ for (let i = 0; i <= detailSegments; i++) {303+ const lat = north - (i / detailSegments) * span;304+ for (let j = 0; j <= detailSegments; j++) {305+ const lng = west + (j / detailSegments) * span;306+ positions.push(...surfacePoint(lat, lng, detailRadius));307+ uvs.push(j / detailSegments, 1 - i / detailSegments);308+ }309+ }310+ const stride = detailSegments + 1;311+ for (let i = 0; i < detailSegments; i++) {312+ for (let j = 0; j < detailSegments; j++) {313+ const corner = i * stride + j;314+ indices.push(corner, corner + stride, corner + 1);315+ indices.push(corner + 1, corner + stride, corner + stride + 1);316+ }317+ }318+ const geometry = new BufferGeometry();319+ geometry.setAttribute("position", new Float32BufferAttribute(positions, 3));320+ geometry.setAttribute("uv", new Float32BufferAttribute(uvs, 2));321+ geometry.setIndex(indices);322+323+ const material = new MeshBasicMaterial();324+ const mesh = new Mesh(geometry, material);325+ // Invisible until its picture arrives: a black square teaches nothing.326+ mesh.visible = false;327+ const url = `${state.game.base}/tiles/${variant.tiles}/${zoom}/${column}/${row}.${variant.formats[zoom]}`;328+ new TextureLoader().load(url, (texture) => {329+ texture.colorSpace = SRGBColorSpace;330+ material.map = texture;331+ material.needsUpdate = true;332+ mesh.visible = true;333+ });334+ return mesh;335+}336+337+function clearDetailTiles() {338+ if (!detail.group) return;339+ for (const mesh of detail.tiles.values()) {340+ detail.group.remove(mesh);341+ disposeTile(mesh);342+ }343+ detail.tiles.clear();344+ detail.key = "";345+}346+347+function disposeTile(mesh) {348+ mesh.geometry.dispose();349+ mesh.material.map?.dispose();350+ mesh.material.dispose();351+}352+180353 // restyleSelection dresses the standing sprites for the current selection:181354 // the chosen pin grows, takes its ring, lifts a little higher off the182355 // ground; the one it replaced settles back among the rest.