diff --git a/README.md b/README.md deleted file mode 100644 index 67c2343..0000000 --- a/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# 👑 CASTAROOK: A Strategic Saga - -# [🎮 PLAY CASTAROOK NOW!](https://fezcode.com/castarook/) - -**Castarook** is an immersive 3D chess game that blends standard chess strategy with D&D-inspired RPG elements. Set in a living, breathing valley featuring dynamic weather, procedural terrain, and a beautiful interface. - -![Banner](./banner.png) - -## 📜 The Core Mechanics - -Unlike regular chess, pieces in this saga don't always perish in a single strike. Every capture attempt initiates a **Battle Phase**. - -### 🎲 Combat System & Dice -When one piece attacks another, combat is determined by the fate of the dice. -* **Piece-Specific Dice:** Each unit rolls a unique die based on its power: - * **Pawn:** D6 - * **Knight:** D10 - * **Bishop:** D12 - * **Rook:** D15 - * **Queen:** D18 - * **King:** D20 -* **Veteran Attributes (Max +5):** - * **Attacker Total:** `Die Roll + Veteran Kills` - * **Defender Total:** `Die Roll + Walls Defended - Penalty` -* **Opportunity Attack (Vulnerability):** Any unit that has just moved becomes **Vulnerable (-2 Defense)** until the start of its next turn. This rewards aggressive counter-play. -* **Damage Calculation:** The difference between the two totals is dealt as damage to the loser's health. -* **Health Points (HP):** - * **Pawn:** 10 HP - * **Knight / Bishop:** 20 HP - * **Rook:** 30 HP - * **Queen:** 40 HP - * **King:** 15 HP -* **Survival:** If a unit takes damage but remains above 0 HP, it stays on its square. A capture only occurs when a unit's health is fully depleted. - -### 🤖 Singleplayer (Player vs AI) -* **Greedy AI:** You can challenge a custom-built AI opponent in the main menu. The AI calculates "Expected Value" based on piece values, current HP, and combat probability (accounting for dice sides and stat bonuses) to execute ruthless—though sometimes unpredictable—attacks. - -### 👑 Special Rules -* **Siege Weapons (Onagers):** Each player has a one-time use Onager stationed behind their base. - * **Area of Effect:** Attacks the first 4 rows in front of the base (Rows 1-4 for White, 8-5 for Black). - * **Damage:** Deals a massive **12-16 DMG** to all units in the targeted zone. - * **Strategic Use:** Can clear a crowded board or severely weaken high-HP units, but use it wisely—it's a single-use tactical strike. -* **Pawn Promotion:** Pawns reaching the far edge are automatically promoted to **Queens**, gaining full HP and range. -* **Castling:** Perform a strategic swap between your King and Rook if neither has moved and the path is clear. -* **Victory:** There is no "Checkmate" logic here—you must **execute the enemy King** by depleting his HP to win the campaign. - -## 🌲 Immersive Environment - -The battlefield is situated in a rich, low-poly procedural world: -* **The Stone Plaza:** A deep-foundation, tiered stone stage where the battle takes place. -* **Procedural Scenery:** Varied elevations, including rolling hills, the "Western Mound," the "Eastern Plateau," and a grand Stone Bridge spanning a carving river. -* **Living World:** Grounded, animated trees, swaying grass, and wandering rabbits react to a global wind system. -* **Day/Night Cycle:** Toggle between a bright "Sunrise" and a flickering "Twilight" mode featuring firecamps and dynamic lighting. - -## 🎨 Aesthetic & UI -* **Cinematic HUD:** Features gold-etched borders, a "War Chronicles" log, interactive battle pop-ups, and a dynamic Game Mode indicator. -* **Camera Controls:** Freely observe the board (Left Click = Orbit, Right Click = Pan, Scroll = Zoom, 'R' or Middle Click = Reset View). -* **3D Animations:** Units perform lunging strikes during combat and physically fall over/sink into the dirt upon death. -* **Customization:** Change board styles (Wood, Stone, Marble) and customize your army's colors via the Strategic Menu. - -## 🚀 Getting Started - -### Prerequisites -* [Node.js](https://nodejs.org/) (v18 or higher recommended) - -### Installation -1. Clone the repository. -2. Navigate to the client directory: - ```bash - cd client - ``` -3. Install dependencies: - ```bash - npm install - ``` -4. Launch the campaign: - ```bash - npm run dev - ``` - -## 🛠️ Built With -* **React** - UI Framework -* **Three.js** - 3D Engine -* **React Three Fiber** - React renderer for Three.js -* **Drei** - Specialized helpers for 3D environments -* **Vite** - Build Tool - ---- -Created by Fezcode. Roll for Initiative! \ No newline at end of file diff --git a/assets/index-ByWuAmpB.css b/assets/index-ByWuAmpB.css new file mode 100644 index 0000000..404b147 --- /dev/null +++ b/assets/index-ByWuAmpB.css @@ -0,0 +1 @@ +body,html{margin:0;padding:0;width:100vw;height:100vh;overflow:hidden;background-color:#1a1a1a;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif}#root{width:100%;height:100%} diff --git a/assets/index-DdY23Pjj.js b/assets/index-DdY23Pjj.js new file mode 100644 index 0000000..16e7483 --- /dev/null +++ b/assets/index-DdY23Pjj.js @@ -0,0 +1,4615 @@ +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const a of i)if(a.type==="childList")for(const c of a.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&n(c)}).observe(document,{childList:!0,subtree:!0});function t(i){const a={};return i.integrity&&(a.integrity=i.integrity),i.referrerPolicy&&(a.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?a.credentials="include":i.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(i){if(i.ep)return;i.ep=!0;const a=t(i);fetch(i.href,a)}})();function Sb(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var O1={exports:{}},pm={};var fM;function cC(){if(fM)return pm;fM=1;var s=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,i,a){var c=null;if(a!==void 0&&(c=""+a),i.key!==void 0&&(c=""+i.key),"key"in i){a={};for(var f in i)f!=="key"&&(a[f]=i[f])}else a=i;return i=a.ref,{$$typeof:s,type:n,key:c,ref:i!==void 0?i:null,props:a}}return pm.Fragment=e,pm.jsx=t,pm.jsxs=t,pm}var hM;function uC(){return hM||(hM=1,O1.exports=cC()),O1.exports}var A=uC(),P1={exports:{}},xn={};var dM;function fC(){if(dM)return xn;dM=1;var s=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),x=Symbol.iterator;function _(G){return G===null||typeof G!="object"?null:(G=x&&G[x]||G["@@iterator"],typeof G=="function"?G:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,T={};function E(G,Z,oe){this.props=G,this.context=Z,this.refs=T,this.updater=oe||S}E.prototype.isReactComponent={},E.prototype.setState=function(G,Z){if(typeof G!="object"&&typeof G!="function"&&G!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,G,Z,"setState")},E.prototype.forceUpdate=function(G){this.updater.enqueueForceUpdate(this,G,"forceUpdate")};function R(){}R.prototype=E.prototype;function I(G,Z,oe){this.props=G,this.context=Z,this.refs=T,this.updater=oe||S}var L=I.prototype=new R;L.constructor=I,C(L,E.prototype),L.isPureReactComponent=!0;var F=Array.isArray;function P(){}var z={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function O(G,Z,oe){var he=oe.ref;return{$$typeof:s,type:G,key:Z,ref:he!==void 0?he:null,props:oe}}function W(G,Z){return O(G.type,Z,G.props)}function q(G){return typeof G=="object"&&G!==null&&G.$$typeof===s}function Y(G){var Z={"=":"=0",":":"=2"};return"$"+G.replace(/[=:]/g,function(oe){return Z[oe]})}var K=/\/+/g;function $(G,Z){return typeof G=="object"&&G!==null&&G.key!=null?Y(""+G.key):Z.toString(36)}function ie(G){switch(G.status){case"fulfilled":return G.value;case"rejected":throw G.reason;default:switch(typeof G.status=="string"?G.then(P,P):(G.status="pending",G.then(function(Z){G.status==="pending"&&(G.status="fulfilled",G.value=Z)},function(Z){G.status==="pending"&&(G.status="rejected",G.reason=Z)})),G.status){case"fulfilled":return G.value;case"rejected":throw G.reason}}throw G}function X(G,Z,oe,he,xe){var ae=typeof G;(ae==="undefined"||ae==="boolean")&&(G=null);var de=!1;if(G===null)de=!0;else switch(ae){case"bigint":case"string":case"number":de=!0;break;case"object":switch(G.$$typeof){case s:case e:de=!0;break;case m:return de=G._init,X(de(G._payload),Z,oe,he,xe)}}if(de)return xe=xe(G),de=he===""?"."+$(G,0):he,F(xe)?(oe="",de!=null&&(oe=de.replace(K,"$&/")+"/"),X(xe,Z,oe,"",function(ct){return ct})):xe!=null&&(q(xe)&&(xe=W(xe,oe+(xe.key==null||G&&G.key===xe.key?"":(""+xe.key).replace(K,"$&/")+"/")+de)),Z.push(xe)),1;de=0;var me=he===""?".":he+":";if(F(G))for(var Ge=0;Ge>>1,fe=X[ce];if(0>>1;cei(oe,ge))hei(xe,oe)?(X[ce]=xe,X[he]=ge,ce=he):(X[ce]=oe,X[Z]=ge,ce=Z);else if(hei(xe,ge))X[ce]=xe,X[he]=ge,ce=he;else break e}}return te}function i(X,te){var ge=X.sortIndex-te.sortIndex;return ge!==0?ge:X.id-te.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;s.unstable_now=function(){return a.now()}}else{var c=Date,f=c.now();s.unstable_now=function(){return c.now()-f}}var h=[],p=[],m=1,y=null,x=3,_=!1,S=!1,C=!1,T=!1,E=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function L(X){for(var te=t(p);te!==null;){if(te.callback===null)n(p);else if(te.startTime<=X)n(p),te.sortIndex=te.expirationTime,e(h,te);else break;te=t(p)}}function F(X){if(C=!1,L(X),!S)if(t(h)!==null)S=!0,P||(P=!0,Y());else{var te=t(p);te!==null&&ie(F,te.startTime-X)}}var P=!1,z=-1,U=5,O=-1;function W(){return T?!0:!(s.unstable_now()-OX&&W());){var ce=y.callback;if(typeof ce=="function"){y.callback=null,x=y.priorityLevel;var fe=ce(y.expirationTime<=X);if(X=s.unstable_now(),typeof fe=="function"){y.callback=fe,L(X),te=!0;break t}y===t(h)&&n(h),L(X)}else n(h);y=t(h)}if(y!==null)te=!0;else{var G=t(p);G!==null&&ie(F,G.startTime-X),te=!1}}break e}finally{y=null,x=ge,_=!1}te=void 0}}finally{te?Y():P=!1}}}var Y;if(typeof I=="function")Y=function(){I(q)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,$=K.port2;K.port1.onmessage=q,Y=function(){$.postMessage(null)}}else Y=function(){E(q,0)};function ie(X,te){z=E(function(){X(s.unstable_now())},te)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(X){X.callback=null},s.unstable_forceFrameRate=function(X){0>X||125ce?(X.sortIndex=ge,e(p,X),t(h)===null&&X===t(p)&&(C?(R(z),z=-1):C=!0,ie(F,ge-ce))):(X.sortIndex=fe,e(h,X),S||_||(S=!0,P||(P=!0,Y()))),X},s.unstable_shouldYield=W,s.unstable_wrapCallback=function(X){var te=x;return function(){var ge=x;x=te;try{return X.apply(this,arguments)}finally{x=ge}}}})(B1)),B1}var gM;function GT(){return gM||(gM=1,z1.exports=hC()),z1.exports}var k1={exports:{}},ga={};var vM;function dC(){if(vM)return ga;vM=1;var s=v0();function e(h){var p="https://react.dev/errors/"+h;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(e){console.error(e)}}return s(),k1.exports=dC(),k1.exports}var xM;function mC(){if(xM)return mm;xM=1;var s=GT(),e=v0(),t=pC();function n(r){var o="https://react.dev/errors/"+r;if(1fe||(r.current=ce[fe],ce[fe]=null,fe--)}function oe(r,o){fe++,ce[fe]=r.current,r.current=o}var he=G(null),xe=G(null),ae=G(null),de=G(null);function me(r,o){switch(oe(ae,o),oe(xe,r),oe(he,null),o.nodeType){case 9:case 11:r=(r=o.documentElement)&&(r=r.namespaceURI)?NS(r):0;break;default:if(r=o.tagName,o=o.namespaceURI)o=NS(o),r=OS(o,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}Z(he),oe(he,r)}function Ge(){Z(he),Z(xe),Z(ae)}function ct(r){r.memoizedState!==null&&oe(de,r);var o=he.current,d=OS(o,r.type);o!==d&&(oe(xe,r),oe(he,d))}function Qe(r){xe.current===r&&(Z(he),Z(xe)),de.current===r&&(Z(de),um._currentValue=ge)}var $e,bt;function Oe(r){if($e===void 0)try{throw Error()}catch(d){var o=d.stack.trim().match(/\n( *(at )?)/);$e=o&&o[1]||"",bt=-1)":-1M||_e[g]!==Ze[M]){var dt=` +`+_e[g].replace(" at new "," at ");return r.displayName&&dt.includes("")&&(dt=dt.replace("",r.displayName)),dt}while(1<=g&&0<=M);break}}}finally{Ve=!1,Error.prepareStackTrace=d}return(d=r?r.displayName||r.name:"")?Oe(d):""}function it(r,o){switch(r.tag){case 26:case 27:case 5:return Oe(r.type);case 16:return Oe("Lazy");case 13:return r.child!==o&&o!==null?Oe("Suspense Fallback"):Oe("Suspense");case 19:return Oe("SuspenseList");case 0:case 15:return Pe(r.type,!1);case 11:return Pe(r.type.render,!1);case 1:return Pe(r.type,!0);case 31:return Oe("Activity");default:return""}}function Q(r){try{var o="",d=null;do o+=it(r,d),d=r,r=r.return;while(r);return o}catch(g){return` +Error generating stack: `+g.message+` +`+g.stack}}var ut=Object.prototype.hasOwnProperty,qe=s.unstable_scheduleCallback,Ne=s.unstable_cancelCallback,je=s.unstable_shouldYield,j=s.unstable_requestPaint,B=s.unstable_now,ue=s.unstable_getCurrentPriorityLevel,ze=s.unstable_ImmediatePriority,we=s.unstable_UserBlockingPriority,Ae=s.unstable_NormalPriority,Le=s.unstable_LowPriority,lt=s.unstable_IdlePriority,Tt=s.log,Rt=s.unstable_setDisableYieldValue,Xe=null,He=null;function rt(r){if(typeof Tt=="function"&&Rt(r),He&&typeof He.setStrictMode=="function")try{He.setStrictMode(Xe,r)}catch{}}var le=Math.clz32?Math.clz32:re,Ie=Math.log,De=Math.LN2;function re(r){return r>>>=0,r===0?32:31-(Ie(r)/De|0)|0}var pe=256,Fe=262144,et=4194304;function Re(r){var o=r&42;if(o!==0)return o;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function Me(r,o,d){var g=r.pendingLanes;if(g===0)return 0;var M=0,w=r.suspendedLanes,k=r.pingedLanes;r=r.warmLanes;var ee=g&134217727;return ee!==0?(g=ee&~w,g!==0?M=Re(g):(k&=ee,k!==0?M=Re(k):d||(d=ee&~r,d!==0&&(M=Re(d))))):(ee=g&~w,ee!==0?M=Re(ee):k!==0?M=Re(k):d||(d=g&~r,d!==0&&(M=Re(d)))),M===0?0:o!==0&&o!==M&&(o&w)===0&&(w=M&-M,d=o&-o,w>=d||w===32&&(d&4194048)!==0)?o:M}function ht(r,o){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&o)===0}function St(r,o){switch(r){case 1:case 2:case 4:case 8:case 64:return o+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function It(){var r=et;return et<<=1,(et&62914560)===0&&(et=4194304),r}function Gt(r){for(var o=[],d=0;31>d;d++)o.push(r);return o}function un(r,o){r.pendingLanes|=o,o!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function tn(r,o,d,g,M,w){var k=r.pendingLanes;r.pendingLanes=d,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=d,r.entangledLanes&=d,r.errorRecoveryDisabledLanes&=d,r.shellSuspendCounter=0;var ee=r.entanglements,_e=r.expirationTimes,Ze=r.hiddenUpdates;for(d=k&~d;0"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var fn=/[\n"\\]/g;function Nt(r){return r.replace(fn,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function Kn(r,o,d,g,M,w,k,ee){r.name="",k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?r.type=k:r.removeAttribute("type"),o!=null?k==="number"?(o===0&&r.value===""||r.value!=o)&&(r.value=""+qt(o)):r.value!==""+qt(o)&&(r.value=""+qt(o)):k!=="submit"&&k!=="reset"||r.removeAttribute("value"),o!=null?Rn(r,k,qt(o)):d!=null?Rn(r,k,qt(d)):g!=null&&r.removeAttribute("value"),M==null&&w!=null&&(r.defaultChecked=!!w),M!=null&&(r.checked=M&&typeof M!="function"&&typeof M!="symbol"),ee!=null&&typeof ee!="function"&&typeof ee!="symbol"&&typeof ee!="boolean"?r.name=""+qt(ee):r.removeAttribute("name")}function li(r,o,d,g,M,w,k,ee){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(r.type=w),o!=null||d!=null){if(!(w!=="submit"&&w!=="reset"||o!=null)){en(r);return}d=d!=null?""+qt(d):"",o=o!=null?""+qt(o):d,ee||o===r.value||(r.value=o),r.defaultValue=o}g=g??M,g=typeof g!="function"&&typeof g!="symbol"&&!!g,r.checked=ee?r.checked:!!g,r.defaultChecked=!!g,k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"&&(r.name=k),en(r)}function Rn(r,o,d){o==="number"&&Mt(r.ownerDocument)===r||r.defaultValue===""+d||(r.defaultValue=""+d)}function ci(r,o,d,g){if(r=r.options,o){o={};for(var M=0;M"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Wr=!1;if(Ta)try{var Us={};Object.defineProperty(Us,"passive",{get:function(){Wr=!0}}),window.addEventListener("test",Us,Us),window.removeEventListener("test",Us,Us)}catch{Wr=!1}var Ir=null,zl=null,ds=null;function Vo(){if(ds)return ds;var r,o=zl,d=o.length,g,M="value"in Ir?Ir.value:Ir.textContent,w=M.length;for(r=0;r=Ac),H0=" ",Pu=!1;function sh(r,o){switch(r){case"keyup":return G0.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ep(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Vl=!1;function V0(r,o){switch(r){case"compositionend":return ep(o);case"keypress":return o.which!==32?null:(Pu=!0,H0);case"textInput":return r=o.data,r===H0&&Pu?null:r;default:return null}}function tp(r,o){if(Vl)return r==="compositionend"||!Hl&&sh(r,o)?(r=Vo(),ds=zl=Ir=null,Vl=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1=o)return{node:d,offset:o-r};r=g}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Bu(d)}}function gi(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?gi(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function Y0(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var o=Mt(r.document);o instanceof r.HTMLIFrameElement;){try{var d=typeof o.contentWindow.location.href=="string"}catch{d=!1}if(d)r=o.contentWindow;else break;o=Mt(r.document)}return o}function cp(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}var Z0=Ta&&"documentMode"in document&&11>=document.documentMode,Ps=null,Fs=null,Uc=null,lh=!1;function Ic(r,o,d){var g=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;lh||Ps==null||Ps!==Mt(g)||(g=Ps,"selectionStart"in g&&cp(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),Uc&&Rc(Uc,g)||(Uc=g,g=Yg(Fs,"onSelect"),0>=k,M-=k,Ui=1<<32-le(o)+M|d<Dn?(Yn=Qt,Qt=null):Yn=Qt.sibling;var ri=Je(Be,Qt,Ye[Dn],mt);if(ri===null){Qt===null&&(Qt=Yn);break}r&&Qt&&ri.alternate===null&&o(Be,Qt),Ue=w(ri,Ue,Dn),ii===null?rn=ri:ii.sibling=ri,ii=ri,Qt=Yn}if(Dn===Ye.length)return d(Be,Qt),kn&&Bs(Be,Dn),rn;if(Qt===null){for(;DnDn?(Yn=Qt,Qt=null):Yn=Qt.sibling;var cu=Je(Be,Qt,ri.value,mt);if(cu===null){Qt===null&&(Qt=Yn);break}r&&Qt&&cu.alternate===null&&o(Be,Qt),Ue=w(cu,Ue,Dn),ii===null?rn=cu:ii.sibling=cu,ii=cu,Qt=Yn}if(ri.done)return d(Be,Qt),kn&&Bs(Be,Dn),rn;if(Qt===null){for(;!ri.done;Dn++,ri=Ye.next())ri=gt(Be,ri.value,mt),ri!==null&&(Ue=w(ri,Ue,Dn),ii===null?rn=ri:ii.sibling=ri,ii=ri);return kn&&Bs(Be,Dn),rn}for(Qt=g(Qt);!ri.done;Dn++,ri=Ye.next())ri=ot(Qt,Be,Dn,ri.value,mt),ri!==null&&(r&&ri.alternate!==null&&Qt.delete(ri.key===null?Dn:ri.key),Ue=w(ri,Ue,Dn),ii===null?rn=ri:ii.sibling=ri,ii=ri);return r&&Qt.forEach(function(lC){return o(Be,lC)}),kn&&Bs(Be,Dn),rn}function _i(Be,Ue,Ye,mt){if(typeof Ye=="object"&&Ye!==null&&Ye.type===C&&Ye.key===null&&(Ye=Ye.props.children),typeof Ye=="object"&&Ye!==null){switch(Ye.$$typeof){case _:e:{for(var rn=Ye.key;Ue!==null;){if(Ue.key===rn){if(rn=Ye.type,rn===C){if(Ue.tag===7){d(Be,Ue.sibling),mt=M(Ue,Ye.props.children),mt.return=Be,Be=mt;break e}}else if(Ue.elementType===rn||typeof rn=="object"&&rn!==null&&rn.$$typeof===U&&Yl(rn)===Ue.type){d(Be,Ue.sibling),mt=M(Ue,Ye.props),Ja(mt,Ye),mt.return=Be,Be=mt;break e}d(Be,Ue);break}else o(Be,Ue);Ue=Ue.sibling}Ye.type===C?(mt=Jo(Ye.props.children,Be.mode,mt,Ye.key),mt.return=Be,Be=mt):(mt=zs(Ye.type,Ye.key,Ye.props,null,Be.mode,mt),Ja(mt,Ye),mt.return=Be,Be=mt)}return k(Be);case S:e:{for(rn=Ye.key;Ue!==null;){if(Ue.key===rn)if(Ue.tag===4&&Ue.stateNode.containerInfo===Ye.containerInfo&&Ue.stateNode.implementation===Ye.implementation){d(Be,Ue.sibling),mt=M(Ue,Ye.children||[]),mt.return=Be,Be=mt;break e}else{d(Be,Ue);break}else o(Be,Ue);Ue=Ue.sibling}mt=dh(Ye,Be.mode,mt),mt.return=Be,Be=mt}return k(Be);case U:return Ye=Yl(Ye),_i(Be,Ue,Ye,mt)}if(ie(Ye))return Yt(Be,Ue,Ye,mt);if(Y(Ye)){if(rn=Y(Ye),typeof rn!="function")throw Error(n(150));return Ye=rn.call(Ye),ln(Be,Ue,Ye,mt)}if(typeof Ye.then=="function")return _i(Be,Ue,Zu(Ye),mt);if(Ye.$$typeof===I)return _i(Be,Ue,kc(Be,Ye),mt);Gc(Be,Ye)}return typeof Ye=="string"&&Ye!==""||typeof Ye=="number"||typeof Ye=="bigint"?(Ye=""+Ye,Ue!==null&&Ue.tag===6?(d(Be,Ue.sibling),mt=M(Ue,Ye),mt.return=Be,Be=mt):(d(Be,Ue),mt=hh(Ye,Be.mode,mt),mt.return=Be,Be=mt),k(Be)):d(Be,Ue)}return function(Be,Ue,Ye,mt){try{Jl=0;var rn=_i(Be,Ue,Ye,mt);return Ql=null,rn}catch(Qt){if(Qt===ql||Qt===Mn)throw Qt;var ii=Di(29,Qt,null,Be.mode);return ii.lanes=mt,ii.return=Be,ii}}}var yo=Mh(!0),Eh=Mh(!1),Yr=!1;function Ku(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xp(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function xo(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function al(r,o,d){var g=r.updateQueue;if(g===null)return null;if(g=g.shared,(Jt&2)!==0){var M=g.pending;return M===null?o.next=o:(o.next=M.next,M.next=o),g.pending=o,o=Ka(r),Ko(r,null,d),o}return vr(r,g,o,d),Ka(r)}function sl(r,o,d){if(o=o.updateQueue,o!==null&&(o=o.shared,(d&4194048)!==0)){var g=o.lanes;g&=r.pendingLanes,d|=g,o.lanes=d,Hn(r,d)}}function nn(r,o){var d=r.updateQueue,g=r.alternate;if(g!==null&&(g=g.updateQueue,d===g)){var M=null,w=null;if(d=d.firstBaseUpdate,d!==null){do{var k={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};w===null?M=w=k:w=w.next=k,d=d.next}while(d!==null);w===null?M=w=o:w=w.next=o}else M=w=o;d={baseState:g.baseState,firstBaseUpdate:M,lastBaseUpdate:w,shared:g.shared,callbacks:g.callbacks},r.updateQueue=d;return}r=d.lastBaseUpdate,r===null?d.firstBaseUpdate=o:r.next=o,d.lastBaseUpdate=o}var _p=!1;function Qu(){if(_p){var r=Qa;if(r!==null)throw r}}function Hc(r,o,d,g){_p=!1;var M=r.updateQueue;Yr=!1;var w=M.firstBaseUpdate,k=M.lastBaseUpdate,ee=M.shared.pending;if(ee!==null){M.shared.pending=null;var _e=ee,Ze=_e.next;_e.next=null,k===null?w=Ze:k.next=Ze,k=_e;var dt=r.alternate;dt!==null&&(dt=dt.updateQueue,ee=dt.lastBaseUpdate,ee!==k&&(ee===null?dt.firstBaseUpdate=Ze:ee.next=Ze,dt.lastBaseUpdate=_e))}if(w!==null){var gt=M.baseState;k=0,dt=Ze=_e=null,ee=w;do{var Je=ee.lane&-536870913,ot=Je!==ee.lane;if(ot?(Sn&Je)===Je:(g&Je)===Je){Je!==0&&Je===vo&&(_p=!0),dt!==null&&(dt=dt.next={lane:0,tag:ee.tag,payload:ee.payload,callback:null,next:null});e:{var Yt=r,ln=ee;Je=o;var _i=d;switch(ln.tag){case 1:if(Yt=ln.payload,typeof Yt=="function"){gt=Yt.call(_i,gt,Je);break e}gt=Yt;break e;case 3:Yt.flags=Yt.flags&-65537|128;case 0:if(Yt=ln.payload,Je=typeof Yt=="function"?Yt.call(_i,gt,Je):Yt,Je==null)break e;gt=y({},gt,Je);break e;case 2:Yr=!0}}Je=ee.callback,Je!==null&&(r.flags|=64,ot&&(r.flags|=8192),ot=M.callbacks,ot===null?M.callbacks=[Je]:ot.push(Je))}else ot={lane:Je,tag:ee.tag,payload:ee.payload,callback:ee.callback,next:null},dt===null?(Ze=dt=ot,_e=gt):dt=dt.next=ot,k|=Je;if(ee=ee.next,ee===null){if(ee=M.shared.pending,ee===null)break;ot=ee,ee=ot.next,ot.next=null,M.lastBaseUpdate=ot,M.shared.pending=null}}while(!0);dt===null&&(_e=gt),M.baseState=_e,M.firstBaseUpdate=Ze,M.lastBaseUpdate=dt,w===null&&(M.shared.lanes=0),$s|=k,r.lanes=k,r.memoizedState=gt}}function Vc(r,o){if(typeof r!="function")throw Error(n(191,r));r.call(o)}function rg(r,o){var d=r.callbacks;if(d!==null)for(r.callbacks=null,r=0;rw?w:8;var k=X.T,ee={};X.T=ee,Vp(r,!1,o,d);try{var _e=M(),Ze=X.S;if(Ze!==null&&Ze(ee,_e),_e!==null&&typeof _e=="object"&&typeof _e.then=="function"){var dt=vp(_e,g);tf(r,o,dt,Oa(r))}else tf(r,o,g,Oa(r))}catch(gt){tf(r,o,{then:function(){},status:"rejected",reason:gt},Oa())}finally{te.p=w,k!==null&&ee.types!==null&&(k.types=ee.types),X.T=k}}function l1(){}function Gp(r,o,d,g){if(r.tag!==5)throw Error(n(476));var M=Ug(r).queue;Dg(r,M,o,ge,d===null?l1:function(){return Ig(r),d(g)})}function Ug(r){var o=r.memoizedState;if(o!==null)return o;o={memoizedState:ge,baseState:ge,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bo,lastRenderedState:ge},next:null};var d={};return o.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bo,lastRenderedState:d},next:null},r.memoizedState=o,r=r.alternate,r!==null&&(r.memoizedState=o),o}function Ig(r){var o=Ug(r);o.next===null&&(o=r.alternate.memoizedState),tf(r,o.next.queue,{},Oa())}function Hp(){return cn(um)}function Lg(){return Wi().memoizedState}function Ng(){return Wi().memoizedState}function c1(r){for(var o=r.return;o!==null;){switch(o.tag){case 24:case 3:var d=Oa();r=xo(d);var g=al(o,r,d);g!==null&&(Tn(g,o,d),sl(g,o,d)),o={cache:pp()},r.payload=o;return}o=o.return}}function u1(r,o,d){var g=Oa();d={lane:g,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Lh(r)?Pg(o,d):(d=uh(r,o,d,g),d!==null&&(Tn(d,r,g),Fg(d,o,g)))}function Og(r,o,d){var g=Oa();tf(r,o,d,g)}function tf(r,o,d,g){var M={lane:g,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(Lh(r))Pg(o,M);else{var w=r.alternate;if(r.lanes===0&&(w===null||w.lanes===0)&&(w=o.lastRenderedReducer,w!==null))try{var k=o.lastRenderedState,ee=w(k,d);if(M.hasEagerState=!0,M.eagerState=ee,Xr(ee,k))return vr(r,o,M,0),pn===null&&ju(),!1}catch{}if(d=uh(r,o,M,g),d!==null)return Tn(d,r,g),Fg(d,o,g),!0}return!1}function Vp(r,o,d,g){if(g={lane:2,revertLane:nt(),gesture:null,action:g,hasEagerState:!1,eagerState:null,next:null},Lh(r)){if(o)throw Error(n(479))}else o=uh(r,d,g,2),o!==null&&Tn(o,r,2)}function Lh(r){var o=r.alternate;return r===vn||o!==null&&o===vn}function Pg(r,o){Wc=$a=!0;var d=r.pending;d===null?o.next=o:(o.next=d.next,d.next=o),r.pending=o}function Fg(r,o,d){if((d&4194048)!==0){var g=o.lanes;g&=r.pendingLanes,d|=g,o.lanes=d,Hn(r,d)}}var qc={readContext:cn,use:ol,useCallback:Ii,useContext:Ii,useEffect:Ii,useImperativeHandle:Ii,useLayoutEffect:Ii,useInsertionEffect:Ii,useMemo:Ii,useReducer:Ii,useRef:Ii,useState:Ii,useDebugValue:Ii,useDeferredValue:Ii,useTransition:Ii,useSyncExternalStore:Ii,useId:Ii,useHostTransitionStatus:Ii,useFormState:Ii,useActionState:Ii,useOptimistic:Ii,useMemoCache:Ii,useCacheRefresh:Ii};qc.useEffectEvent=Ii;var zg={readContext:cn,use:ol,useCallback:function(r,o){return or().memoizedState=[r,o===void 0?null:o],r},useContext:cn,useEffect:_g,useImperativeHandle:function(r,o,d){d=d!=null?d.concat([r]):null,Uh(4194308,4,Tg.bind(null,o,r),d)},useLayoutEffect:function(r,o){return Uh(4194308,4,r,o)},useInsertionEffect:function(r,o){Uh(4,2,r,o)},useMemo:function(r,o){var d=or();o=o===void 0?null:o;var g=r();if($l){rt(!0);try{r()}finally{rt(!1)}}return d.memoizedState=[g,o],g},useReducer:function(r,o,d){var g=or();if(d!==void 0){var M=d(o);if($l){rt(!0);try{d(o)}finally{rt(!1)}}}else M=o;return g.memoizedState=g.baseState=M,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:M},g.queue=r,r=r.dispatch=u1.bind(null,vn,r),[g.memoizedState,r]},useRef:function(r){var o=or();return r={current:r},o.memoizedState=r},useState:function(r){r=Up(r);var o=r.queue,d=Og.bind(null,vn,o);return o.dispatch=d,[r.memoizedState,d]},useDebugValue:Bp,useDeferredValue:function(r,o){var d=or();return kp(d,r,o)},useTransition:function(){var r=Up(!1);return r=Dg.bind(null,vn,r.queue,!0,!1),or().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,o,d){var g=vn,M=or();if(kn){if(d===void 0)throw Error(n(407));d=d()}else{if(d=o(),pn===null)throw Error(n(349));(Sn&127)!==0||cg(g,o,d)}M.memoizedState=d;var w={value:d,getSnapshot:o};return M.queue=w,_g(fg.bind(null,g,w,r),[r]),g.flags|=2048,ll(9,{destroy:void 0},ug.bind(null,g,w,d,o),null),d},useId:function(){var r=or(),o=pn.identifierPrefix;if(kn){var d=gs,g=Ui;d=(g&~(1<<32-le(g)-1)).toString(32)+d,o="_"+o+"R_"+d,d=wh++,0<\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof g.is=="string"?k.createElement("select",{is:g.is}):k.createElement("select"),g.multiple?w.multiple=!0:g.size&&(w.size=g.size);break;default:w=typeof g.is=="string"?k.createElement(M,{is:g.is}):k.createElement(M)}}w[zn]=o,w[V]=g;e:for(k=o.child;k!==null;){if(k.tag===5||k.tag===6)w.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===o)break e;for(;k.sibling===null;){if(k.return===null||k.return===o)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}o.stateNode=w;e:switch(ea(w,M,g),M){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}g&&Ys(o)}}return fi(o),sf(o,o.type,r===null?null:r.memoizedProps,o.pendingProps,d),null;case 6:if(r&&o.stateNode!=null)r.memoizedProps!==g&&Ys(o);else{if(typeof g!="string"&&o.stateNode===null)throw Error(n(166));if(r=ae.current,zc(o)){if(r=o.stateNode,d=o.memoizedProps,g=null,M=zi,M!==null)switch(M.tag){case 27:case 5:g=M.memoizedProps}r[zn]=o,r=!!(r.nodeValue===d||g!==null&&g.suppressHydrationWarning===!0||IS(r.nodeValue,d)),r||Gs(o,!0)}else r=Zg(r).createTextNode(g),r[zn]=o,o.stateNode=r}return fi(o),null;case 31:if(d=o.memoizedState,r===null||r.memoizedState!==null){if(g=zc(o),d!==null){if(r===null){if(!g)throw Error(n(318));if(r=o.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(557));r[zn]=o}else tl(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;fi(o),r=!1}else d=gh(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=d),r=!0;if(!r)return o.flags&256?(ji(o),o):(ji(o),null);if((o.flags&128)!==0)throw Error(n(558))}return fi(o),null;case 13:if(g=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(M=zc(o),g!==null&&g.dehydrated!==null){if(r===null){if(!M)throw Error(n(318));if(M=o.memoizedState,M=M!==null?M.dehydrated:null,!M)throw Error(n(317));M[zn]=o}else tl(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;fi(o),M=!1}else M=gh(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=M),M=!0;if(!M)return o.flags&256?(ji(o),o):(ji(o),null)}return ji(o),(o.flags&128)!==0?(o.lanes=d,o):(d=g!==null,r=r!==null&&r.memoizedState!==null,d&&(g=o.child,M=null,g.alternate!==null&&g.alternate.memoizedState!==null&&g.alternate.memoizedState.cachePool!==null&&(M=g.alternate.memoizedState.cachePool.pool),w=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(w=g.memoizedState.cachePool.pool),w!==M&&(g.flags|=2048)),d!==r&&d&&(o.child.flags|=8192),So(o,o.updateQueue),fi(o),null);case 4:return Ge(),r===null&&m1(o.stateNode.containerInfo),fi(o),null;case 10:return js(o.type),fi(o),null;case 19:if(Z(Gn),g=o.memoizedState,g===null)return fi(o),null;if(M=(o.flags&128)!==0,w=g.rendering,w===null)if(M)Zs(g,!1);else{if(Li!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(w=Da(r),w!==null){for(o.flags|=128,Zs(g,!1),r=w.updateQueue,o.updateQueue=r,So(o,r),o.subtreeFlags=0,r=d,d=o.child;d!==null;)Lc(d,r),d=d.sibling;return oe(Gn,Gn.current&1|2),kn&&Bs(o,g.treeForkCount),o.child}r=r.sibling}g.tail!==null&&B()>qi&&(o.flags|=128,M=!0,Zs(g,!1),o.lanes=4194304)}else{if(!M)if(r=Da(w),r!==null){if(o.flags|=128,M=!0,r=r.updateQueue,o.updateQueue=r,So(o,r),Zs(g,!0),g.tail===null&&g.tailMode==="hidden"&&!w.alternate&&!kn)return fi(o),null}else 2*B()-g.renderingStartTime>qi&&d!==536870912&&(o.flags|=128,M=!0,Zs(g,!1),o.lanes=4194304);g.isBackwards?(w.sibling=o.child,o.child=w):(r=g.last,r!==null?r.sibling=w:o.child=w,g.last=w)}return g.tail!==null?(r=g.tail,g.rendering=r,g.tail=r.sibling,g.renderingStartTime=B(),r.sibling=null,d=Gn.current,oe(Gn,M?d&1|2:d&1),kn&&Bs(o,g.treeForkCount),r):(fi(o),null);case 22:case 23:return ji(o),Ju(),g=o.memoizedState!==null,r!==null?r.memoizedState!==null!==g&&(o.flags|=8192):g&&(o.flags|=8192),g?(d&536870912)!==0&&(o.flags&128)===0&&(fi(o),o.subtreeFlags&6&&(o.flags|=8192)):fi(o),d=o.updateQueue,d!==null&&So(o,d.retryQueue),d=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(d=r.memoizedState.cachePool.pool),g=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(g=o.memoizedState.cachePool.pool),g!==d&&(o.flags|=2048),r!==null&&Z(rl),null;case 24:return d=null,r!==null&&(d=r.memoizedState.cache),o.memoizedState.cache!==d&&(o.flags|=2048),js(er),fi(o),null;case 25:return null;case 30:return null}throw Error(n(156,o.tag))}function ts(r,o){switch(ph(o),o.tag){case 1:return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return js(er),Ge(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 26:case 27:case 5:return Qe(o),null;case 31:if(o.memoizedState!==null){if(ji(o),o.alternate===null)throw Error(n(340));tl()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 13:if(ji(o),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));tl()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return Z(Gn),null;case 4:return Ge(),null;case 10:return js(o.type),null;case 22:case 23:return ji(o),Ju(),r!==null&&Z(rl),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 24:return js(er),null;case 25:return null;default:return null}}function Ua(r,o){switch(ph(o),o.tag){case 3:js(er),Ge();break;case 26:case 27:case 5:Qe(o);break;case 4:Ge();break;case 31:o.memoizedState!==null&&ji(o);break;case 13:ji(o);break;case 19:Z(Gn);break;case 10:js(o.type);break;case 22:case 23:ji(o),Ju(),r!==null&&Z(rl);break;case 24:js(er)}}function ns(r,o){try{var d=o.updateQueue,g=d!==null?d.lastEffect:null;if(g!==null){var M=g.next;d=M;do{if((d.tag&r)===r){g=void 0;var w=d.create,k=d.inst;g=w(),k.destroy=g}d=d.next}while(d!==M)}}catch(ee){Qn(o,o.return,ee)}}function Tr(r,o,d){try{var g=o.updateQueue,M=g!==null?g.lastEffect:null;if(M!==null){var w=M.next;g=w;do{if((g.tag&r)===r){var k=g.inst,ee=k.destroy;if(ee!==void 0){k.destroy=void 0,M=o;var _e=d,Ze=ee;try{Ze()}catch(dt){Qn(M,_e,dt)}}}g=g.next}while(g!==w)}}catch(dt){Qn(o,o.return,dt)}}function vs(r){var o=r.updateQueue;if(o!==null){var d=r.stateNode;try{rg(o,d)}catch(g){Qn(r,r.return,g)}}}function xr(r,o,d){d.props=cl(r.type,r.memoizedProps),d.state=r.memoizedState;try{d.componentWillUnmount()}catch(g){Qn(r,o,g)}}function Mo(r,o){try{var d=r.ref;if(d!==null){switch(r.tag){case 26:case 27:case 5:var g=r.stateNode;break;case 30:g=r.stateNode;break;default:g=r.stateNode}typeof d=="function"?r.refCleanup=d(g):d.current=g}}catch(M){Qn(r,o,M)}}function wr(r,o){var d=r.ref,g=r.refCleanup;if(d!==null)if(typeof g=="function")try{g()}catch(M){Qn(r,o,M)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(M){Qn(r,o,M)}else d.current=null}function lf(r){var o=r.type,d=r.memoizedProps,g=r.stateNode;try{e:switch(o){case"button":case"input":case"select":case"textarea":d.autoFocus&&g.focus();break e;case"img":d.src?g.src=d.src:d.srcSet&&(g.srcset=d.srcSet)}}catch(M){Qn(r,r.return,M)}}function cr(r,o,d){try{var g=r.stateNode;I3(g,r.type,d,o),g[V]=o}catch(M){Qn(r,r.return,M)}}function Ci(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&ru(r.type)||r.tag===4}function Pn(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Ci(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&ru(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Ks(r,o,d){var g=r.tag;if(g===5||g===6)r=r.stateNode,o?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(r,o):(o=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,o.appendChild(r),d=d._reactRootContainer,d!=null||o.onclick!==null||(o.onclick=Ur));else if(g!==4&&(g===27&&ru(r.type)&&(d=r.stateNode,o=null),r=r.child,r!==null))for(Ks(r,o,d),r=r.sibling;r!==null;)Ks(r,o,d),r=r.sibling}function Kr(r,o,d){var g=r.tag;if(g===5||g===6)r=r.stateNode,o?d.insertBefore(r,o):d.appendChild(r);else if(g!==4&&(g===27&&ru(r.type)&&(d=r.stateNode),r=r.child,r!==null))for(Kr(r,o,d),r=r.sibling;r!==null;)Kr(r,o,d),r=r.sibling}function Wh(r){var o=r.stateNode,d=r.memoizedProps;try{for(var g=r.type,M=o.attributes;M.length;)o.removeAttributeNode(M[0]);ea(o,g,d),o[zn]=r,o[V]=d}catch(w){Qn(r,r.return,w)}}var is=!1,yi=!1,ys=!1,Xg=typeof WeakSet=="function"?WeakSet:Set,_r=null;function h1(r,o){if(r=r.containerInfo,y1=nv,r=Y0(r),cp(r)){if("selectionStart"in r)var d={start:r.selectionStart,end:r.selectionEnd};else e:{d=(d=r.ownerDocument)&&d.defaultView||window;var g=d.getSelection&&d.getSelection();if(g&&g.rangeCount!==0){d=g.anchorNode;var M=g.anchorOffset,w=g.focusNode;g=g.focusOffset;try{d.nodeType,w.nodeType}catch{d=null;break e}var k=0,ee=-1,_e=-1,Ze=0,dt=0,gt=r,Je=null;t:for(;;){for(var ot;gt!==d||M!==0&>.nodeType!==3||(ee=k+M),gt!==w||g!==0&>.nodeType!==3||(_e=k+g),gt.nodeType===3&&(k+=gt.nodeValue.length),(ot=gt.firstChild)!==null;)Je=gt,gt=ot;for(;;){if(gt===r)break t;if(Je===d&&++Ze===M&&(ee=k),Je===w&&++dt===g&&(_e=k),(ot=gt.nextSibling)!==null)break;gt=Je,Je=gt.parentNode}gt=ot}d=ee===-1||_e===-1?null:{start:ee,end:_e}}else d=null}d=d||{start:0,end:0}}else d=null;for(x1={focusedElem:r,selectionRange:d},nv=!1,_r=o;_r!==null;)if(o=_r,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,_r=r;else for(;_r!==null;){switch(o=_r,w=o.alternate,r=o.flags,o.tag){case 0:if((r&4)!==0&&(r=o.updateQueue,r=r!==null?r.events:null,r!==null))for(d=0;d title"))),ea(w,g,d),w[zn]=r,ve(w),g=w;break e;case"link":var k=ZS("link","href",M).get(g+(d.href||""));if(k){for(var ee=0;ee_i&&(k=_i,_i=ln,ln=k);var Be=Dc(ee,ln),Ue=Dc(ee,_i);if(Be&&Ue&&(ot.rangeCount!==1||ot.anchorNode!==Be.node||ot.anchorOffset!==Be.offset||ot.focusNode!==Ue.node||ot.focusOffset!==Ue.offset)){var Ye=gt.createRange();Ye.setStart(Be.node,Be.offset),ot.removeAllRanges(),ln>_i?(ot.addRange(Ye),ot.extend(Ue.node,Ue.offset)):(Ye.setEnd(Ue.node,Ue.offset),ot.addRange(Ye))}}}}for(gt=[],ot=ee;ot=ot.parentNode;)ot.nodeType===1&>.push({element:ot,left:ot.scrollLeft,top:ot.scrollTop});for(typeof ee.focus=="function"&&ee.focus(),ee=0;eed?32:d,X.T=null,d=$c,$c=null;var w=Na,k=ls;if(si=0,Qc=Na=null,ls=0,(Jt&6)!==0)throw Error(n(331));var ee=Jt;if(Jt|=4,da(w.current),nm(w,w.current,k,d),Jt=ee,Vt(0,!1),He&&typeof He.onPostCommitFiberRoot=="function")try{He.onPostCommitFiberRoot(Xe,w)}catch{}return!0}finally{te.p=M,X.T=g,to(r,o)}}function am(r,o,d){o=Aa(d,o),o=Zp(r.stateNode,o,2),r=al(r,o,2),r!==null&&(un(r,2),At(r))}function Qn(r,o,d){if(r.tag===3)am(r,r,d);else for(;o!==null;){if(o.tag===3){am(o,r,d);break}else if(o.tag===1){var g=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Yi===null||!Yi.has(g))){r=Aa(d,r),d=Kp(2),g=al(o,d,2),g!==null&&(Gg(d,g,o,r),un(g,2),At(g));break}}o=o.return}}function mf(r,o,d){var g=r.pingCache;if(g===null){g=r.pingCache=new yn;var M=new Set;g.set(o,M)}else M=g.get(o),M===void 0&&(M=new Set,g.set(o,M));M.has(d)||(im=!0,M.add(d),r=l.bind(null,r,o,d),o.then(r,r))}function l(r,o,d){var g=r.pingCache;g!==null&&g.delete(o),r.pingedLanes|=r.suspendedLanes&d,r.warmLanes&=~d,pn===r&&(Sn&d)===d&&(Li===4||Li===3&&(Sn&62914560)===Sn&&300>B()-Kc?(Jt&2)===0&&vl(r,0):uf|=d,Mi===Sn&&(Mi=0)),At(r)}function u(r,o){o===0&&(o=It()),r=qr(r,o),r!==null&&(un(r,o),At(r))}function v(r){var o=r.memoizedState,d=0;o!==null&&(d=o.retryLane),u(r,d)}function b(r,o){var d=0;switch(r.tag){case 31:case 13:var g=r.stateNode,M=r.memoizedState;M!==null&&(d=M.retryLane);break;case 19:g=r.stateNode;break;case 22:g=r.stateNode._retryCache;break;default:throw Error(n(314))}g!==null&&g.delete(o),u(r,d)}function D(r,o){return qe(r,o)}var N=null,J=null,be=!1,st=!1,Et=!1,Pt=0;function At(r){r!==J&&r.next===null&&(J===null?N=J=r:J=J.next=r),st=!0,be||(be=!0,ke())}function Vt(r,o){if(!Et&&st){Et=!0;do for(var d=!1,g=N;g!==null;){if(r!==0){var M=g.pendingLanes;if(M===0)var w=0;else{var k=g.suspendedLanes,ee=g.pingedLanes;w=(1<<31-le(42|r)+1)-1,w&=M&~(k&~ee),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(d=!0,Ke(g,w))}else w=Sn,w=Me(g,g===pn?w:0,g.cancelPendingCommit!==null||g.timeoutHandle!==-1),(w&3)===0||ht(g,w)||(d=!0,Ke(g,w));g=g.next}while(d);Et=!1}}function mn(){Zi()}function Zi(){st=be=!1;var r=0;Pt!==0&&N3()&&(r=Pt);for(var o=B(),d=null,g=N;g!==null;){var M=g.next,w=iu(g,o);w===0?(g.next=null,d===null?N=M:d.next=M,M===null&&(J=d)):(d=g,(r!==0||(w&3)!==0)&&(st=!0)),g=M}si!==0&&si!==5||Vt(r),Pt!==0&&(Pt=0)}function iu(r,o){for(var d=r.suspendedLanes,g=r.pingedLanes,M=r.expirationTimes,w=r.pendingLanes&-62914561;0ee)break;var dt=_e.transferSize,gt=_e.initiatorType;dt&&LS(gt)&&(_e=_e.responseEnd,k+=dt*(_e"u"?null:document;function WS(r,o,d){var g=Qh;if(g&&typeof o=="string"&&o){var M=Nt(o);M='link[rel="'+r+'"][href="'+M+'"]',typeof d=="string"&&(M+='[crossorigin="'+d+'"]'),jS.has(M)||(jS.add(M),r={rel:r,crossOrigin:d,href:o},g.querySelector(M)===null&&(o=g.createElement("link"),ea(o,"link",r),ve(o),g.head.appendChild(o)))}}function V3(r){dc.D(r),WS("dns-prefetch",r,null)}function j3(r,o){dc.C(r,o),WS("preconnect",r,o)}function W3(r,o,d){dc.L(r,o,d);var g=Qh;if(g&&r&&o){var M='link[rel="preload"][as="'+Nt(o)+'"]';o==="image"&&d&&d.imageSrcSet?(M+='[imagesrcset="'+Nt(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(M+='[imagesizes="'+Nt(d.imageSizes)+'"]')):M+='[href="'+Nt(r)+'"]';var w=M;switch(o){case"style":w=Jh(r);break;case"script":w=$h(r)}io.has(w)||(r=y({rel:"preload",href:o==="image"&&d&&d.imageSrcSet?void 0:r,as:o},d),io.set(w,r),g.querySelector(M)!==null||o==="style"&&g.querySelector(lm(w))||o==="script"&&g.querySelector(cm(w))||(o=g.createElement("link"),ea(o,"link",r),ve(o),g.head.appendChild(o)))}}function X3(r,o){dc.m(r,o);var d=Qh;if(d&&r){var g=o&&typeof o.as=="string"?o.as:"script",M='link[rel="modulepreload"][as="'+Nt(g)+'"][href="'+Nt(r)+'"]',w=M;switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=$h(r)}if(!io.has(w)&&(r=y({rel:"modulepreload",href:r},o),io.set(w,r),d.querySelector(M)===null)){switch(g){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(cm(w)))return}g=d.createElement("link"),ea(g,"link",r),ve(g),d.head.appendChild(g)}}}function q3(r,o,d){dc.S(r,o,d);var g=Qh;if(g&&r){var M=H(g).hoistableStyles,w=Jh(r);o=o||"default";var k=M.get(w);if(!k){var ee={loading:0,preload:null};if(k=g.querySelector(lm(w)))ee.loading=5;else{r=y({rel:"stylesheet",href:r,"data-precedence":o},d),(d=io.get(w))&&w1(r,d);var _e=k=g.createElement("link");ve(_e),ea(_e,"link",r),_e._p=new Promise(function(Ze,dt){_e.onload=Ze,_e.onerror=dt}),_e.addEventListener("load",function(){ee.loading|=1}),_e.addEventListener("error",function(){ee.loading|=2}),ee.loading|=4,Qg(k,o,g)}k={type:"stylesheet",instance:k,count:1,state:ee},M.set(w,k)}}}function Y3(r,o){dc.X(r,o);var d=Qh;if(d&&r){var g=H(d).hoistableScripts,M=$h(r),w=g.get(M);w||(w=d.querySelector(cm(M)),w||(r=y({src:r,async:!0},o),(o=io.get(M))&&A1(r,o),w=d.createElement("script"),ve(w),ea(w,"link",r),d.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(M,w))}}function Z3(r,o){dc.M(r,o);var d=Qh;if(d&&r){var g=H(d).hoistableScripts,M=$h(r),w=g.get(M);w||(w=d.querySelector(cm(M)),w||(r=y({src:r,async:!0,type:"module"},o),(o=io.get(M))&&A1(r,o),w=d.createElement("script"),ve(w),ea(w,"link",r),d.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},g.set(M,w))}}function XS(r,o,d,g){var M=(M=ae.current)?Kg(M):null;if(!M)throw Error(n(446));switch(r){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(o=Jh(d.href),d=H(M).hoistableStyles,g=d.get(o),g||(g={type:"style",instance:null,count:0,state:null},d.set(o,g)),g):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){r=Jh(d.href);var w=H(M).hoistableStyles,k=w.get(r);if(k||(M=M.ownerDocument||M,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(r,k),(w=M.querySelector(lm(r)))&&!w._p&&(k.instance=w,k.state.loading=5),io.has(r)||(d={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},io.set(r,d),w||K3(M,r,d,k.state))),o&&g===null)throw Error(n(528,""));return k}if(o&&g!==null)throw Error(n(529,""));return null;case"script":return o=d.async,d=d.src,typeof d=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(o=$h(d),d=H(M).hoistableScripts,g=d.get(o),g||(g={type:"script",instance:null,count:0,state:null},d.set(o,g)),g):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,r))}}function Jh(r){return'href="'+Nt(r)+'"'}function lm(r){return'link[rel="stylesheet"]['+r+"]"}function qS(r){return y({},r,{"data-precedence":r.precedence,precedence:null})}function K3(r,o,d,g){r.querySelector('link[rel="preload"][as="style"]['+o+"]")?g.loading=1:(o=r.createElement("link"),g.preload=o,o.addEventListener("load",function(){return g.loading|=1}),o.addEventListener("error",function(){return g.loading|=2}),ea(o,"link",d),ve(o),r.head.appendChild(o))}function $h(r){return'[src="'+Nt(r)+'"]'}function cm(r){return"script[async]"+r}function YS(r,o,d){if(o.count++,o.instance===null)switch(o.type){case"style":var g=r.querySelector('style[data-href~="'+Nt(d.href)+'"]');if(g)return o.instance=g,ve(g),g;var M=y({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return g=(r.ownerDocument||r).createElement("style"),ve(g),ea(g,"style",M),Qg(g,d.precedence,r),o.instance=g;case"stylesheet":M=Jh(d.href);var w=r.querySelector(lm(M));if(w)return o.state.loading|=4,o.instance=w,ve(w),w;g=qS(d),(M=io.get(M))&&w1(g,M),w=(r.ownerDocument||r).createElement("link"),ve(w);var k=w;return k._p=new Promise(function(ee,_e){k.onload=ee,k.onerror=_e}),ea(w,"link",g),o.state.loading|=4,Qg(w,d.precedence,r),o.instance=w;case"script":return w=$h(d.src),(M=r.querySelector(cm(w)))?(o.instance=M,ve(M),M):(g=d,(M=io.get(w))&&(g=y({},d),A1(g,M)),r=r.ownerDocument||r,M=r.createElement("script"),ve(M),ea(M,"link",g),r.head.appendChild(M),o.instance=M);case"void":return null;default:throw Error(n(443,o.type))}else o.type==="stylesheet"&&(o.state.loading&4)===0&&(g=o.instance,o.state.loading|=4,Qg(g,d.precedence,r));return o.instance}function Qg(r,o,d){for(var g=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),M=g.length?g[g.length-1]:null,w=M,k=0;k title"):null)}function Q3(r,o,d){if(d===1||o.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof o.precedence!="string"||typeof o.href!="string"||o.href==="")break;return!0;case"link":if(typeof o.rel!="string"||typeof o.href!="string"||o.href===""||o.onLoad||o.onError)break;return o.rel==="stylesheet"?(r=o.disabled,typeof o.precedence=="string"&&r==null):!0;case"script":if(o.async&&typeof o.async!="function"&&typeof o.async!="symbol"&&!o.onLoad&&!o.onError&&o.src&&typeof o.src=="string")return!0}return!1}function QS(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function J3(r,o,d,g){if(d.type==="stylesheet"&&(typeof g.media!="string"||matchMedia(g.media).matches!==!1)&&(d.state.loading&4)===0){if(d.instance===null){var M=Jh(g.href),w=o.querySelector(lm(M));if(w){o=w._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(r.count++,r=$g.bind(r),o.then(r,r)),d.state.loading|=4,d.instance=w,ve(w);return}w=o.ownerDocument||o,g=qS(g),(M=io.get(M))&&w1(g,M),w=w.createElement("link"),ve(w);var k=w;k._p=new Promise(function(ee,_e){k.onload=ee,k.onerror=_e}),ea(w,"link",g),d.instance=w}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(d,o),(o=d.state.preload)&&(d.state.loading&3)===0&&(r.count++,d=$g.bind(r),o.addEventListener("load",d),o.addEventListener("error",d))}}var C1=0;function $3(r,o){return r.stylesheets&&r.count===0&&tv(r,r.stylesheets),0C1?50:800)+o);return r.unsuspend=d,function(){r.unsuspend=null,clearTimeout(g),clearTimeout(M)}}:null}function $g(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)tv(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var ev=null;function tv(r,o){r.stylesheets=null,r.unsuspend!==null&&(r.count++,ev=new Map,o.forEach(eC,r),ev=null,$g.call(r))}function eC(r,o){if(!(o.state.loading&4)){var d=ev.get(r);if(d)var g=d.get(null);else{d=new Map,ev.set(r,d);for(var M=r.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(e){console.error(e)}}return s(),F1.exports=mC(),F1.exports}var vC=gC();const Vd="183",Uf={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},If={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},HT=0,X_=1,VT=2,yC=3,jT=0,Rd=1,Fm=2,Of=3,Ec=0,ba=1,Ki=2,Po=0,Gf=1,gy=2,q_=3,Y_=4,WT=5,xC=6,_u=100,XT=101,qT=102,YT=103,ZT=104,KT=200,QT=201,JT=202,$T=203,vy=204,yy=205,ew=206,tw=207,nw=208,iw=209,rw=210,aw=211,sw=212,ow=213,lw=214,xy=0,_y=1,by=2,Wf=3,Sy=4,My=5,Ey=6,Ty=7,y0=0,cw=1,uw=2,oo=0,Mb=1,Eb=2,Tb=3,mx=4,wb=5,Ab=6,Cb=7,Z_="attached",fw="detached",Tu=300,Fo=301,wu=302,Dd=303,zm=304,jd=306,Jm=1e3,ar=1001,$m=1002,pr=1003,Rb=1004,_C=1004,wd=1005,bC=1005,Wn=1006,Bm=1007,SC=1007,Al=1008,K_=1008,Br=1009,gx=1010,vx=1011,Ld=1012,x0=1013,ws=1014,Vi=1015,sr=1016,yx=1017,xx=1018,Nd=1020,Db=35902,Ub=35899,Ib=1021,Lb=1022,mr=1023,Ul=1026,bu=1027,_0=1028,b0=1029,Xf=1030,_x=1031,MC=1032,bx=1033,km=33776,Gm=33777,Hm=33778,Vm=33779,wy=35840,Ay=35841,Cy=35842,Ry=35843,Dy=36196,Uy=37492,Iy=37496,Ly=37488,Ny=37489,Oy=37490,Py=37491,Fy=37808,zy=37809,By=37810,ky=37811,Gy=37812,Hy=37813,Vy=37814,jy=37815,Wy=37816,Xy=37817,qy=37818,Yy=37819,Zy=37820,Ky=37821,Qy=36492,Jy=36494,$y=36495,ex=36283,tx=36284,nx=36285,ix=36286,hw=2200,dw=2201,pw=2202,e0=2300,rx=2301,uy=2302,Q_=2303,Pf=2400,Ff=2401,t0=2402,Sx=2500,Nb=2501,EC=0,TC=1,wC=2,mw=3200,gw=3201,AC=3202,CC=3203,Du=0,vw=1,bc="",ia="srgb",zo="srgb-linear",n0="linear",hi="srgb",RC="",DC="rg",UC="ga",IC=0,Lf=7680,LC=7681,NC=7682,OC=7683,PC=34055,FC=34056,zC=5386,BC=512,kC=513,GC=514,HC=515,VC=516,jC=517,WC=518,J_=519,yw=512,xw=513,_w=514,Mx=515,bw=516,Sw=517,Ex=518,Mw=519,i0=35044,XC=35048,qC=35040,YC=35045,ZC=35049,KC=35041,QC=35046,JC=35050,$C=35042,eR="100",$_="300 es",Ms=2e3,qf=2001,tR={COMPUTE:"compute",RENDER:"render"},nR={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},iR={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},rR={TEXTURE_COMPARE:"depthTextureCompare"};function aR(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}const sR={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Ad(s,e){return new sR[s](e)}function Ew(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function r0(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function Tw(){const s=r0("canvas");return s.style.display="block",s}const bM={};let Au=null;function oR(s){Au=s}function lR(){return Au}function a0(...s){const e="THREE."+s.shift();Au?Au("log",e,...s):console.log(e,...s)}function ww(s){const e=s[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=s[1];t&&t.isStackTrace?s[0]+=" "+t.getLocation():s[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return s}function Bt(...s){s=ww(s);const e="THREE."+s.shift();if(Au)Au("warn",e,...s);else{const t=s[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...s)}}function $t(...s){s=ww(s);const e="THREE."+s.shift();if(Au)Au("error",e,...s);else{const t=s[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...s)}}function s0(...s){const e=s.join(" ");e in bM||(bM[e]=!0,Bt(...s))}function cR(s,e,t){return new Promise(function(n,i){function a(){switch(s.clientWaitSync(e,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(a,t);break;default:n()}}setTimeout(a,t)})}const uR={[xy]:_y,[by]:Ey,[Sy]:Ty,[Wf]:My,[_y]:xy,[Ey]:by,[Ty]:Sy,[My]:Wf};let Il=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const a=i.indexOf(t);a!==-1&&i.splice(a,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let a=0,c=i.length;a>8&255]+va[s>>16&255]+va[s>>24&255]+"-"+va[e&255]+va[e>>8&255]+"-"+va[e>>16&15|64]+va[e>>24&255]+"-"+va[t&63|128]+va[t>>8&255]+"-"+va[t>>16&255]+va[t>>24&255]+va[n&255]+va[n>>8&255]+va[n>>16&255]+va[n>>24&255]).toLowerCase()}function hn(s,e,t){return Math.max(e,Math.min(t,s))}function Ob(s,e){return(s%e+e)%e}function fR(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function hR(s,e,t){return s!==e?(t-s)/(e-s):0}function jm(s,e,t){return(1-t)*s+t*e}function dR(s,e,t,n){return jm(s,e,1-Math.exp(-t*n))}function pR(s,e=1){return e-Math.abs(Ob(s,e*2)-e)}function mR(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function gR(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function vR(s,e){return s+Math.floor(Math.random()*(e-s+1))}function yR(s,e){return s+Math.random()*(e-s)}function xR(s){return s*(.5-Math.random())}function _R(s){s!==void 0&&(SM=s);let e=SM+=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 bR(s){return s*Hf}function SR(s){return s*Od}function MR(s){return(s&s-1)===0&&s!==0}function ER(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function TR(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function wR(s,e,t,n,i){const a=Math.cos,c=Math.sin,f=a(t/2),h=c(t/2),p=a((e+n)/2),m=c((e+n)/2),y=a((e-n)/2),x=c((e-n)/2),_=a((n-e)/2),S=c((n-e)/2);switch(i){case"XYX":s.set(f*m,h*y,h*x,f*p);break;case"YZY":s.set(h*x,f*m,h*y,f*p);break;case"ZXZ":s.set(h*y,h*x,f*m,f*p);break;case"XZX":s.set(f*m,h*S,h*_,f*p);break;case"YXY":s.set(h*_,f*m,h*S,f*p);break;case"ZYZ":s.set(h*S,h*_,f*m,f*p);break;default:Bt("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ba(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function An(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}const so={DEG2RAD:Hf,RAD2DEG:Od,generateUUID:Es,clamp:hn,euclideanModulo:Ob,mapLinear:fR,inverseLerp:hR,lerp:jm,damp:dR,pingpong:pR,smoothstep:mR,smootherstep:gR,randInt:vR,randFloat:yR,randFloatSpread:xR,seededRandom:_R,degToRad:bR,radToDeg:SR,isPowerOfTwo:MR,ceilPowerOfTwo:ER,floorPowerOfTwo:TR,setQuaternionFromProperEuler:wR,normalize:An,denormalize:Ba};class pt{constructor(e=0,t=0){pt.prototype.isVector2=!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("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("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){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[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=hn(this.x,e.x,t.x),this.y=hn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=hn(this.x,e,t),this.y=hn(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(hn(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){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(hn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const 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){const n=Math.cos(t),i=Math.sin(t),a=this.x-e.x,c=this.y-e.y;return this.x=a*n-c*i+e.x,this.y=a*i+c*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class kr{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,a,c,f){let h=n[i+0],p=n[i+1],m=n[i+2],y=n[i+3],x=a[c+0],_=a[c+1],S=a[c+2],C=a[c+3];if(y!==C||h!==x||p!==_||m!==S){let T=h*x+p*_+m*S+y*C;T<0&&(x=-x,_=-_,S=-S,C=-C,T=-T);let E=1-f;if(T<.9995){const R=Math.acos(T),I=Math.sin(R);E=Math.sin(E*R)/I,f=Math.sin(f*R)/I,h=h*E+x*f,p=p*E+_*f,m=m*E+S*f,y=y*E+C*f}else{h=h*E+x*f,p=p*E+_*f,m=m*E+S*f,y=y*E+C*f;const R=1/Math.sqrt(h*h+p*p+m*m+y*y);h*=R,p*=R,m*=R,y*=R}}e[t]=h,e[t+1]=p,e[t+2]=m,e[t+3]=y}static multiplyQuaternionsFlat(e,t,n,i,a,c){const f=n[i],h=n[i+1],p=n[i+2],m=n[i+3],y=a[c],x=a[c+1],_=a[c+2],S=a[c+3];return e[t]=f*S+m*y+h*_-p*x,e[t+1]=h*S+m*x+p*y-f*_,e[t+2]=p*S+m*_+f*x-h*y,e[t+3]=m*S-f*y-h*x-p*_,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,i){return this._x=e,this._y=t,this._z=n,this._w=i,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){const n=e._x,i=e._y,a=e._z,c=e._order,f=Math.cos,h=Math.sin,p=f(n/2),m=f(i/2),y=f(a/2),x=h(n/2),_=h(i/2),S=h(a/2);switch(c){case"XYZ":this._x=x*m*y+p*_*S,this._y=p*_*y-x*m*S,this._z=p*m*S+x*_*y,this._w=p*m*y-x*_*S;break;case"YXZ":this._x=x*m*y+p*_*S,this._y=p*_*y-x*m*S,this._z=p*m*S-x*_*y,this._w=p*m*y+x*_*S;break;case"ZXY":this._x=x*m*y-p*_*S,this._y=p*_*y+x*m*S,this._z=p*m*S+x*_*y,this._w=p*m*y-x*_*S;break;case"ZYX":this._x=x*m*y-p*_*S,this._y=p*_*y+x*m*S,this._z=p*m*S-x*_*y,this._w=p*m*y+x*_*S;break;case"YZX":this._x=x*m*y+p*_*S,this._y=p*_*y+x*m*S,this._z=p*m*S-x*_*y,this._w=p*m*y-x*_*S;break;case"XZY":this._x=x*m*y-p*_*S,this._y=p*_*y-x*m*S,this._z=p*m*S+x*_*y,this._w=p*m*y+x*_*S;break;default:Bt("Quaternion: .setFromEuler() encountered an unknown order: "+c)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],a=t[8],c=t[1],f=t[5],h=t[9],p=t[2],m=t[6],y=t[10],x=n+f+y;if(x>0){const _=.5/Math.sqrt(x+1);this._w=.25/_,this._x=(m-h)*_,this._y=(a-p)*_,this._z=(c-i)*_}else if(n>f&&n>y){const _=2*Math.sqrt(1+n-f-y);this._w=(m-h)/_,this._x=.25*_,this._y=(i+c)/_,this._z=(a+p)/_}else if(f>y){const _=2*Math.sqrt(1+f-n-y);this._w=(a-p)/_,this._x=(i+c)/_,this._y=.25*_,this._z=(h+m)/_}else{const _=2*Math.sqrt(1+y-n-f);this._w=(c-i)/_,this._x=(a+p)/_,this._y=(h+m)/_,this._z=.25*_}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(hn(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),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){const n=e._x,i=e._y,a=e._z,c=e._w,f=t._x,h=t._y,p=t._z,m=t._w;return this._x=n*m+c*f+i*p-a*h,this._y=i*m+c*h+a*f-n*p,this._z=a*m+c*p+n*h-i*f,this._w=c*m-n*f-i*h-a*p,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,a=e._z,c=e._w,f=this.dot(e);f<0&&(n=-n,i=-i,a=-a,c=-c,f=-f);let h=1-t;if(f<.9995){const p=Math.acos(f),m=Math.sin(p);h=Math.sin(h*p)/m,t=Math.sin(t*p)/m,this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+a*t,this._w=this._w*h+c*t,this._onChangeCallback()}else this._x=this._x*h+n*t,this._y=this._y*h+i*t,this._z=this._z*h+a*t,this._w=this._w*h+c*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),a=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),a*Math.sin(t),a*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}}class se{constructor(e=0,t=0,n=0){se.prototype.isVector3=!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("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("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(MM.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(MM.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,a=e.elements;return this.x=a[0]*t+a[3]*n+a[6]*i,this.y=a[1]*t+a[4]*n+a[7]*i,this.z=a[2]*t+a[5]*n+a[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,a=e.elements,c=1/(a[3]*t+a[7]*n+a[11]*i+a[15]);return this.x=(a[0]*t+a[4]*n+a[8]*i+a[12])*c,this.y=(a[1]*t+a[5]*n+a[9]*i+a[13])*c,this.z=(a[2]*t+a[6]*n+a[10]*i+a[14])*c,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,a=e.x,c=e.y,f=e.z,h=e.w,p=2*(c*i-f*n),m=2*(f*t-a*i),y=2*(a*n-c*t);return this.x=t+h*p+c*y-f*m,this.y=n+h*m+f*p-a*y,this.z=i+h*y+a*m-c*p,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i,this.y=a[1]*t+a[5]*n+a[9]*i,this.z=a[2]*t+a[6]*n+a[10]*i,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=hn(this.x,e.x,t.x),this.y=hn(this.y,e.y,t.y),this.z=hn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=hn(this.x,e,t),this.y=hn(this.y,e,t),this.z=hn(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(hn(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){const n=e.x,i=e.y,a=e.z,c=t.x,f=t.y,h=t.z;return this.x=i*h-a*f,this.y=a*c-n*h,this.z=n*f-i*c,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return G1.copy(this).projectOnVector(e),this.sub(G1)}reflect(e){return this.sub(G1.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(hn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}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){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*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){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,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(){const 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}}const G1=new se,MM=new kr;class _n{constructor(e,t,n,i,a,c,f,h,p){_n.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,a,c,f,h,p)}set(e,t,n,i,a,c,f,h,p){const m=this.elements;return m[0]=e,m[1]=i,m[2]=f,m[3]=t,m[4]=a,m[5]=h,m[6]=n,m[7]=c,m[8]=p,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const 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){const 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){const n=e.elements,i=t.elements,a=this.elements,c=n[0],f=n[3],h=n[6],p=n[1],m=n[4],y=n[7],x=n[2],_=n[5],S=n[8],C=i[0],T=i[3],E=i[6],R=i[1],I=i[4],L=i[7],F=i[2],P=i[5],z=i[8];return a[0]=c*C+f*R+h*F,a[3]=c*T+f*I+h*P,a[6]=c*E+f*L+h*z,a[1]=p*C+m*R+y*F,a[4]=p*T+m*I+y*P,a[7]=p*E+m*L+y*z,a[2]=x*C+_*R+S*F,a[5]=x*T+_*I+S*P,a[8]=x*E+_*L+S*z,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],n=e[1],i=e[2],a=e[3],c=e[4],f=e[5],h=e[6],p=e[7],m=e[8];return t*c*m-t*f*p-n*a*m+n*f*h+i*a*p-i*c*h}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],a=e[3],c=e[4],f=e[5],h=e[6],p=e[7],m=e[8],y=m*c-f*p,x=f*h-m*a,_=p*a-c*h,S=t*y+n*x+i*_;if(S===0)return this.set(0,0,0,0,0,0,0,0,0);const C=1/S;return e[0]=y*C,e[1]=(i*p-m*n)*C,e[2]=(f*n-i*c)*C,e[3]=x*C,e[4]=(m*t-i*h)*C,e[5]=(i*a-f*t)*C,e[6]=_*C,e[7]=(n*h-p*t)*C,e[8]=(c*t-n*a)*C,this}transpose(){let e;const 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){const 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,i,a,c,f){const h=Math.cos(a),p=Math.sin(a);return this.set(n*h,n*p,-n*(h*c+p*f)+c+e,-i*p,i*h,-i*(-p*c+h*f)+f+t,0,0,1),this}scale(e,t){return this.premultiply(H1.makeScale(e,t)),this}rotate(e){return this.premultiply(H1.makeRotation(-e)),this}translate(e,t){return this.premultiply(H1.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){const 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){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])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){const 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)}}const H1=new _n,EM=new _n().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),TM=new _n().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function AR(){const s={enabled:!0,workingColorSpace:zo,spaces:{},convert:function(i,a,c){return this.enabled===!1||a===c||!a||!c||(this.spaces[a].transfer===hi&&(i.r=Mc(i.r),i.g=Mc(i.g),i.b=Mc(i.b)),this.spaces[a].primaries!==this.spaces[c].primaries&&(i.applyMatrix3(this.spaces[a].toXYZ),i.applyMatrix3(this.spaces[c].fromXYZ)),this.spaces[c].transfer===hi&&(i.r=Ud(i.r),i.g=Ud(i.g),i.b=Ud(i.b))),i},workingToColorSpace:function(i,a){return this.convert(i,this.workingColorSpace,a)},colorSpaceToWorking:function(i,a){return this.convert(i,a,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===bc?n0:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,a=this.workingColorSpace){return i.fromArray(this.spaces[a].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,a,c){return i.copy(this.spaces[a].toXYZ).multiply(this.spaces[c].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,a){return s0("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),s.workingToColorSpace(i,a)},toWorkingColorSpace:function(i,a){return s0("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),s.colorSpaceToWorking(i,a)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return s.define({[zo]:{primaries:e,whitePoint:n,transfer:n0,toXYZ:EM,fromXYZ:TM,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:ia},outputColorSpaceConfig:{drawingBufferColorSpace:ia}},[ia]:{primaries:e,whitePoint:n,transfer:hi,toXYZ:EM,fromXYZ:TM,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:ia}}}),s}const Zn=AR();function Mc(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function Ud(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}let td;class Aw{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{td===void 0&&(td=r0("canvas")),td.width=e.width,td.height=e.height;const i=td.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=td}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){const t=r0("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),a=i.data;for(let c=0;c1),this.pmremVersion=0}get width(){return this.source.getSize(j1).x}get height(){return this.source.getSize(j1).y}get depth(){return this.source.getSize(j1).z}get image(){return this.source.data}set image(e=null){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.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(const t in e){const n=e[t];if(n===void 0){Bt(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Bt(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const 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,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!==Tu)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Jm:e.x=e.x-Math.floor(e.x);break;case ar:e.x=e.x<0?0:1;break;case $m: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 Jm:e.y=e.y-Math.floor(e.y);break;case ar:e.y=e.y<0?0:1;break;case $m: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++}}mi.DEFAULT_IMAGE=null;mi.DEFAULT_MAPPING=Tu;mi.DEFAULT_ANISOTROPY=1;class di{constructor(e=0,t=0,n=0,i=1){di.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}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,i){return this.x=e,this.y=t,this.z=n,this.w=i,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("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("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){const t=this.x,n=this.y,i=this.z,a=this.w,c=e.elements;return this.x=c[0]*t+c[4]*n+c[8]*i+c[12]*a,this.y=c[1]*t+c[5]*n+c[9]*i+c[13]*a,this.z=c[2]*t+c[6]*n+c[10]*i+c[14]*a,this.w=c[3]*t+c[7]*n+c[11]*i+c[15]*a,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);const 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,i,a;const h=e.elements,p=h[0],m=h[4],y=h[8],x=h[1],_=h[5],S=h[9],C=h[2],T=h[6],E=h[10];if(Math.abs(m-x)<.01&&Math.abs(y-C)<.01&&Math.abs(S-T)<.01){if(Math.abs(m+x)<.1&&Math.abs(y+C)<.1&&Math.abs(S+T)<.1&&Math.abs(p+_+E-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const I=(p+1)/2,L=(_+1)/2,F=(E+1)/2,P=(m+x)/4,z=(y+C)/4,U=(S+T)/4;return I>L&&I>F?I<.01?(n=0,i=.707106781,a=.707106781):(n=Math.sqrt(I),i=P/n,a=z/n):L>F?L<.01?(n=.707106781,i=0,a=.707106781):(i=Math.sqrt(L),n=P/i,a=U/i):F<.01?(n=.707106781,i=.707106781,a=0):(a=Math.sqrt(F),n=z/a,i=U/a),this.set(n,i,a,t),this}let R=Math.sqrt((T-S)*(T-S)+(y-C)*(y-C)+(x-m)*(x-m));return Math.abs(R)<.001&&(R=1),this.x=(T-S)/R,this.y=(y-C)/R,this.z=(x-m)/R,this.w=Math.acos((p+_+E-1)/2),this}setFromMatrixPosition(e){const 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=hn(this.x,e.x,t.x),this.y=hn(this.y,e.y,t.y),this.z=hn(this.z,e.z,t.z),this.w=hn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=hn(this.x,e,t),this.y=hn(this.y,e,t),this.z=hn(this.z,e,t),this.w=hn(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(hn(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}}class Pb extends Il{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Wn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new di(0,0,e,t),this.scissorTest=!1,this.viewport=new di(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},a=new mi(i),c=n.count;for(let f=0;f1);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>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(f=>({...f,boundingBox:f.boundingBox?f.boundingBox.toJSON():void 0,boundingSphere:f.boundingSphere?f.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(f=>({...f})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function a(f,h){return f[h.uuid]===void 0&&(f[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=a(e.geometries,this.geometry);const f=this.geometry.parameters;if(f!==void 0&&f.shapes!==void 0){const h=f.shapes;if(Array.isArray(h))for(let p=0,m=h.length;p0){i.children=[];for(let f=0;f0){i.animations=[];for(let f=0;f0&&(n.geometries=f),h.length>0&&(n.materials=h),p.length>0&&(n.textures=p),m.length>0&&(n.images=m),y.length>0&&(n.shapes=y),x.length>0&&(n.skeletons=x),_.length>0&&(n.animations=_),S.length>0&&(n.nodes=S)}return n.object=i,n;function c(f){const h=[];for(const p in f){const m=f[p];delete m.metadata,h.push(m)}return h}}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),e.pivot!==null&&(this.pivot=e.pivot.clone()),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_+S?(p.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!p.inputState.pinching&&x<=_-S&&(p.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else h!==null&&e.gripSpace&&(a=t.getPose(e.gripSpace,n),a!==null&&(h.matrix.fromArray(a.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,a.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(a.linearVelocity)):h.hasLinearVelocity=!1,a.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(a.angularVelocity)):h.hasAngularVelocity=!1));f!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&a!==null&&(i=a),i!==null&&(f.matrix.fromArray(i.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,i.linearVelocity?(f.hasLinearVelocity=!0,f.linearVelocity.copy(i.linearVelocity)):f.hasLinearVelocity=!1,i.angularVelocity?(f.hasAngularVelocity=!0,f.angularVelocity.copy(i.angularVelocity)):f.hasAngularVelocity=!1,this.dispatchEvent(zR)))}return f!==null&&(f.visible=i!==null),h!==null&&(h.visible=a!==null),p!==null&&(p.visible=c!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Cd;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const Cw={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},fu={h:0,s:0,l:0},fv={h:0,s:0,l:0};function X1(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}class kt{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){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ia){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Zn.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=Zn.workingColorSpace){return this.r=e,this.g=t,this.b=n,Zn.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=Zn.workingColorSpace){if(e=Ob(e,1),t=hn(t,0,1),n=hn(n,0,1),t===0)this.r=this.g=this.b=n;else{const a=n<=.5?n*(1+t):n+t-n*t,c=2*n-a;this.r=X1(c,a,e+1/3),this.g=X1(c,a,e),this.b=X1(c,a,e-1/3)}return Zn.colorSpaceToWorking(this,i),this}setStyle(e,t=ia){function n(a){a!==void 0&&parseFloat(a)<1&&Bt("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let a;const c=i[1],f=i[2];switch(c){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return n(a[4]),this.setRGB(Math.min(255,parseInt(a[1],10))/255,Math.min(255,parseInt(a[2],10))/255,Math.min(255,parseInt(a[3],10))/255,t);if(a=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return n(a[4]),this.setRGB(Math.min(100,parseInt(a[1],10))/100,Math.min(100,parseInt(a[2],10))/100,Math.min(100,parseInt(a[3],10))/100,t);break;case"hsl":case"hsla":if(a=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return n(a[4]),this.setHSL(parseFloat(a[1])/360,parseFloat(a[2])/100,parseFloat(a[3])/100,t);break;default:Bt("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const a=i[1],c=a.length;if(c===3)return this.setRGB(parseInt(a.charAt(0),16)/15,parseInt(a.charAt(1),16)/15,parseInt(a.charAt(2),16)/15,t);if(c===6)return this.setHex(parseInt(a,16),t);Bt("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=ia){const n=Cw[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Bt("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=Mc(e.r),this.g=Mc(e.g),this.b=Mc(e.b),this}copyLinearToSRGB(e){return this.r=Ud(e.r),this.g=Ud(e.g),this.b=Ud(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ia){return Zn.workingToColorSpace(ya.copy(this),e),Math.round(hn(ya.r*255,0,255))*65536+Math.round(hn(ya.g*255,0,255))*256+Math.round(hn(ya.b*255,0,255))}getHexString(e=ia){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Zn.workingColorSpace){Zn.workingToColorSpace(ya.copy(this),t);const n=ya.r,i=ya.g,a=ya.b,c=Math.max(n,i,a),f=Math.min(n,i,a);let h,p;const m=(f+c)/2;if(f===c)h=0,p=0;else{const y=c-f;switch(p=m<=.5?y/(c+f):y/(2-c-f),c){case n:h=(i-a)/y+(i0&&(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}}const Do=new se,mc=new se,q1=new se,gc=new se,ad=new se,sd=new se,LM=new se,Y1=new se,Z1=new se,K1=new se,Q1=new di,J1=new di,$1=new di;class hs{constructor(e=new se,t=new se,n=new se){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Do.subVectors(e,t),i.cross(Do);const a=i.lengthSq();return a>0?i.multiplyScalar(1/Math.sqrt(a)):i.set(0,0,0)}static getBarycoord(e,t,n,i,a){Do.subVectors(i,t),mc.subVectors(n,t),q1.subVectors(e,t);const c=Do.dot(Do),f=Do.dot(mc),h=Do.dot(q1),p=mc.dot(mc),m=mc.dot(q1),y=c*p-f*f;if(y===0)return a.set(0,0,0),null;const x=1/y,_=(p*h-f*m)*x,S=(c*m-f*h)*x;return a.set(1-_-S,S,_)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,gc)===null?!1:gc.x>=0&&gc.y>=0&&gc.x+gc.y<=1}static getInterpolation(e,t,n,i,a,c,f,h){return this.getBarycoord(e,t,n,i,gc)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(a,gc.x),h.addScaledVector(c,gc.y),h.addScaledVector(f,gc.z),h)}static getInterpolatedAttribute(e,t,n,i,a,c){return Q1.setScalar(0),J1.setScalar(0),$1.setScalar(0),Q1.fromBufferAttribute(e,t),J1.fromBufferAttribute(e,n),$1.fromBufferAttribute(e,i),c.setScalar(0),c.addScaledVector(Q1,a.x),c.addScaledVector(J1,a.y),c.addScaledVector($1,a.z),c}static isFrontFacing(e,t,n,i){return Do.subVectors(n,t),mc.subVectors(e,t),Do.cross(mc).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),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 Do.subVectors(this.c,this.b),mc.subVectors(this.a,this.b),Do.cross(mc).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return hs.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return hs.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,a){return hs.getInterpolation(e,this.a,this.b,this.c,t,n,i,a)}containsPoint(e){return hs.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return hs.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,a=this.c;let c,f;ad.subVectors(i,n),sd.subVectors(a,n),Y1.subVectors(e,n);const h=ad.dot(Y1),p=sd.dot(Y1);if(h<=0&&p<=0)return t.copy(n);Z1.subVectors(e,i);const m=ad.dot(Z1),y=sd.dot(Z1);if(m>=0&&y<=m)return t.copy(i);const x=h*y-m*p;if(x<=0&&h>=0&&m<=0)return c=h/(h-m),t.copy(n).addScaledVector(ad,c);K1.subVectors(e,a);const _=ad.dot(K1),S=sd.dot(K1);if(S>=0&&_<=S)return t.copy(a);const C=_*p-h*S;if(C<=0&&p>=0&&S<=0)return f=p/(p-S),t.copy(n).addScaledVector(sd,f);const T=m*S-_*y;if(T<=0&&y-m>=0&&_-S>=0)return LM.subVectors(a,i),f=(y-m)/(y-m+(_-S)),t.copy(i).addScaledVector(LM,f);const E=1/(T+C+x);return c=C*E,f=x*E,t.copy(n).addScaledVector(ad,c).addScaledVector(sd,f)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Gr{constructor(e=new se(1/0,1/0,1/0),t=new se(-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=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,Uo),Uo.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(vm),dv.subVectors(this.max,vm),od.subVectors(e.a,vm),ld.subVectors(e.b,vm),cd.subVectors(e.c,vm),hu.subVectors(ld,od),du.subVectors(cd,ld),gf.subVectors(od,cd);let t=[0,-hu.z,hu.y,0,-du.z,du.y,0,-gf.z,gf.y,hu.z,0,-hu.x,du.z,0,-du.x,gf.z,0,-gf.x,-hu.y,hu.x,0,-du.y,du.x,0,-gf.y,gf.x,0];return!e_(t,od,ld,cd,dv)||(t=[1,0,0,0,1,0,0,0,1],!e_(t,od,ld,cd,dv))?!1:(pv.crossVectors(hu,du),t=[pv.x,pv.y,pv.z],e_(t,od,ld,cd,dv))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Uo).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Uo).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:(vc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),vc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),vc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),vc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),vc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),vc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),vc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),vc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(vc),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}}const vc=[new se,new se,new se,new se,new se,new se,new se,new se],Uo=new se,hv=new Gr,od=new se,ld=new se,cd=new se,hu=new se,du=new se,gf=new se,vm=new se,dv=new se,pv=new se,vf=new se;function e_(s,e,t,n,i){for(let a=0,c=s.length-3;a<=c;a+=3){vf.fromArray(s,a);const f=i.x*Math.abs(vf.x)+i.y*Math.abs(vf.y)+i.z*Math.abs(vf.z),h=e.dot(vf),p=t.dot(vf),m=n.dot(vf);if(Math.max(-Math.max(h,p,m),Math.min(h,p,m))>f)return!1}return!0}const Sc=BR();function BR(){const s=new ArrayBuffer(4),e=new Float32Array(s),t=new Uint32Array(s),n=new Uint32Array(512),i=new Uint32Array(512);for(let h=0;h<256;++h){const p=h-127;p<-27?(n[h]=0,n[h|256]=32768,i[h]=24,i[h|256]=24):p<-14?(n[h]=1024>>-p-14,n[h|256]=1024>>-p-14|32768,i[h]=-p-1,i[h|256]=-p-1):p<=15?(n[h]=p+15<<10,n[h|256]=p+15<<10|32768,i[h]=13,i[h|256]=13):p<128?(n[h]=31744,n[h|256]=64512,i[h]=24,i[h|256]=24):(n[h]=31744,n[h|256]=64512,i[h]=13,i[h|256]=13)}const a=new Uint32Array(2048),c=new Uint32Array(64),f=new Uint32Array(64);for(let h=1;h<1024;++h){let p=h<<13,m=0;for(;(p&8388608)===0;)p<<=1,m-=8388608;p&=-8388609,m+=947912704,a[h]=p|m}for(let h=1024;h<2048;++h)a[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)c[h]=h<<23;c[31]=1199570944,c[32]=2147483648;for(let h=33;h<63;++h)c[h]=2147483648+(h-32<<23);c[63]=3347054592;for(let h=1;h<64;++h)h!==32&&(f[h]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:a,exponentTable:c,offsetTable:f}}function fs(s){Math.abs(s)>65504&&Bt("DataUtils.toHalfFloat(): Value out of range."),s=hn(s,-65504,65504),Sc.floatView[0]=s;const e=Sc.uint32View[0],t=e>>23&511;return Sc.baseTable[t]+((e&8388607)>>Sc.shiftTable[t])}function Lm(s){const e=s>>10;return Sc.uint32View[0]=Sc.mantissaTable[Sc.offsetTable[e]+(s&1023)]+Sc.exponentTable[e],Sc.floatView[0]}class zf{static toHalfFloat(e){return fs(e)}static fromHalfFloat(e){return Lm(e)}}const Sr=new se,mv=new pt;let kR=0;class bi{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:kR++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=i0,this.updateRanges=[],this.gpuType=Vi,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 i=0,a=this.itemSize;ithis.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;ym.subVectors(e,this.center);const t=ym.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(ym,i/n),this.radius+=i}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):(t_.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ym.copy(e.center).add(t_)),this.expandByPoint(ym.copy(e.center).sub(t_))),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}}let YR=0;const ro=new dn,n_=new ei,ud=new se,Ss=new Gr,xm=new Gr,zr=new se;class bn extends Il{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:YR++}),this.uuid=Es(),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={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(aR(e)?zb:Fb)(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){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const a=new _n().getNormalMatrix(e);n.applyNormalMatrix(a),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return ro.makeRotationFromQuaternion(e),this.applyMatrix4(ro),this}rotateX(e){return ro.makeRotationX(e),this.applyMatrix4(ro),this}rotateY(e){return ro.makeRotationY(e),this.applyMatrix4(ro),this}rotateZ(e){return ro.makeRotationZ(e),this.applyMatrix4(ro),this}translate(e,t,n){return ro.makeTranslation(e,t,n),this.applyMatrix4(ro),this}scale(e,t,n){return ro.makeScale(e,t,n),this.applyMatrix4(ro),this}lookAt(e){return n_.lookAt(e),n_.updateMatrix(),this.applyMatrix4(n_.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ud).negate(),this.translate(ud.x,ud.y,ud.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,a=e.length;it.count&&Bt("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 Gr);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){$t("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new se(-1/0,-1/0,-1/0),new se(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n0&&(e.userData=this.userData),this.parameters!==void 0){const h=this.parameters;for(const p in h)h[p]!==void 0&&(e[p]=h[p]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const h in n){const p=n[h];e.data.attributes[h]=p.toJSON(e.data)}const i={};let a=!1;for(const h in this.morphAttributes){const p=this.morphAttributes[h],m=[];for(let y=0,x=p.length;y0&&(i[h]=m,a=!0)}a&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const c=this.groups;c.length>0&&(e.data.groups=JSON.parse(JSON.stringify(c)));const f=this.boundingSphere;return f!==null&&(e.data.boundingSphere=f.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;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const p in i){const m=i[p];this.setAttribute(p,m.clone(t))}const a=e.morphAttributes;for(const p in a){const m=[],y=a[p];for(let x=0,_=y.length;x<_;x++)m.push(y[x].clone(t));this.morphAttributes[p]=m}this.morphTargetsRelative=e.morphTargetsRelative;const c=e.groups;for(let p=0,m=c.length;p0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){Bt(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Bt(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const 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!==Gf&&(n.blending=this.blending),this.side!==Ec&&(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!==vy&&(n.blendSrc=this.blendSrc),this.blendDst!==yy&&(n.blendDst=this.blendDst),this.blendEquation!==_u&&(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!==Wf&&(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!==J_&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Lf&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Lf&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Lf&&(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 i(a){const c=[];for(const f in a){const h=a[f];delete h.metadata,c.push(h)}return c}if(t){const a=i(e.textures),c=i(e.images);a.length>0&&(n.textures=a),c.length>0&&(n.images=c)}return n}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;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let a=0;a!==i;++a)n[a]=t[a].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++}}class Bb extends Sa{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new kt(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}}let fd;const _m=new se,hd=new se,dd=new se,pd=new pt,bm=new pt,Rw=new dn,gv=new se,Sm=new se,vv=new se,NM=new pt,i_=new pt,OM=new pt;class Dw extends ei{constructor(e=new Bb){if(super(),this.isSprite=!0,this.type="Sprite",fd===void 0){fd=new bn;const 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 Rx(t,5);fd.setIndex([0,1,2,0,2,3]),fd.setAttribute("position",new Yf(n,3,0,!1)),fd.setAttribute("uv",new Yf(n,2,3,!1))}this.geometry=fd,this.material=e,this.center=new pt(.5,.5),this.count=1}raycast(e,t){e.camera===null&&$t('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),hd.setFromMatrixScale(this.matrixWorld),Rw.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),dd.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&hd.multiplyScalar(-dd.z);const n=this.material.rotation;let i,a;n!==0&&(a=Math.cos(n),i=Math.sin(n));const c=this.center;yv(gv.set(-.5,-.5,0),dd,c,hd,i,a),yv(Sm.set(.5,-.5,0),dd,c,hd,i,a),yv(vv.set(.5,.5,0),dd,c,hd,i,a),NM.set(0,0),i_.set(1,0),OM.set(1,1);let f=e.ray.intersectTriangle(gv,Sm,vv,!1,_m);if(f===null&&(yv(Sm.set(-.5,.5,0),dd,c,hd,i,a),i_.set(0,1),f=e.ray.intersectTriangle(gv,vv,Sm,!1,_m),f===null))return;const h=e.ray.origin.distanceTo(_m);he.far||t.push({distance:h,point:_m.clone(),uv:hs.getInterpolation(_m,gv,Sm,vv,NM,i_,OM,new pt),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 yv(s,e,t,n,i,a){pd.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(bm.x=a*pd.x-i*pd.y,bm.y=i*pd.x+a*pd.y):bm.copy(pd),s.copy(e),s.x+=bm.x,s.y+=bm.y,s.applyMatrix4(Rw)}const xv=new se,PM=new se;class Uw extends ei{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){xv.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(xv);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){xv.setFromMatrixPosition(e.matrixWorld),PM.setFromMatrixPosition(this.matrixWorld);const n=xv.distanceTo(PM)/e.zoom;t[0].object.visible=!0;let i,a;for(i=1,a=t.length;i=c)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i0)if(y=c*h-f,x=c*f-h,S=a*m,y>=0)if(x>=-S)if(x<=S){const C=1/m;y*=C,x*=C,_=y*(y+c*x+2*f)+x*(c*y+x+2*h)+p}else x=a,y=Math.max(0,-(c*x+f)),_=-y*y+x*(x+2*h)+p;else x=-a,y=Math.max(0,-(c*x+f)),_=-y*y+x*(x+2*h)+p;else x<=-S?(y=Math.max(0,-(-c*a+f)),x=y>0?-a:Math.min(Math.max(-a,-h),a),_=-y*y+x*(x+2*h)+p):x<=S?(y=0,x=Math.min(Math.max(-a,-h),a),_=x*(x+2*h)+p):(y=Math.max(0,-(c*a+f)),x=y>0?a:Math.min(Math.max(-a,-h),a),_=-y*y+x*(x+2*h)+p);else x=c>0?-a:a,y=Math.max(0,-(c*x+f)),_=-y*y+x*(x+2*h)+p;return n&&n.copy(this.origin).addScaledVector(this.direction,y),i&&i.copy(r_).addScaledVector(_v,x),_}intersectSphere(e,t){yc.subVectors(e.center,this.origin);const n=yc.dot(this.direction),i=yc.dot(yc)-n*n,a=e.radius*e.radius;if(i>a)return null;const c=Math.sqrt(a-i),f=n-c,h=n+c;return h<0?null:f<0?this.at(h,t):this.at(f,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,a,c,f,h;const p=1/this.direction.x,m=1/this.direction.y,y=1/this.direction.z,x=this.origin;return p>=0?(n=(e.min.x-x.x)*p,i=(e.max.x-x.x)*p):(n=(e.max.x-x.x)*p,i=(e.min.x-x.x)*p),m>=0?(a=(e.min.y-x.y)*m,c=(e.max.y-x.y)*m):(a=(e.max.y-x.y)*m,c=(e.min.y-x.y)*m),n>c||a>i||((a>n||isNaN(n))&&(n=a),(c=0?(f=(e.min.z-x.z)*y,h=(e.max.z-x.z)*y):(f=(e.max.z-x.z)*y,h=(e.min.z-x.z)*y),n>h||f>i)||((f>n||n!==n)&&(n=f),(h=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,yc)!==null}intersectTriangle(e,t,n,i,a){a_.subVectors(t,e),bv.subVectors(n,e),s_.crossVectors(a_,bv);let c=this.direction.dot(s_),f;if(c>0){if(i)return null;f=1}else if(c<0)f=-1,c=-c;else return null;pu.subVectors(this.origin,e);const h=f*this.direction.dot(bv.crossVectors(pu,bv));if(h<0)return null;const p=f*this.direction.dot(a_.cross(pu));if(p<0||h+p>c)return null;const m=-f*pu.dot(s_);return m<0?null:this.at(m/c,a)}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)}}class Ll extends Sa{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new kt(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 As,this.combine=y0,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}}const FM=new dn,yf=new Jf,Sv=new Hr,zM=new se,Mv=new se,Ev=new se,Tv=new se,o_=new se,wv=new se,BM=new se,Av=new se;class Si extends ei{constructor(e=new bn,t=new Ll){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(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,c=i.length;a(e.far-e.near)**2))&&(FM.copy(a).invert(),yf.copy(e.ray).applyMatrix4(FM),!(n.boundingBox!==null&&yf.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,yf)))}_computeIntersections(e,t,n){let i;const a=this.geometry,c=this.material,f=a.index,h=a.attributes.position,p=a.attributes.uv,m=a.attributes.uv1,y=a.attributes.normal,x=a.groups,_=a.drawRange;if(f!==null)if(Array.isArray(c))for(let S=0,C=x.length;St.far?null:{distance:p,point:Av.clone(),object:s}}function Cv(s,e,t,n,i,a,c,f,h,p){s.getVertexPosition(f,Mv),s.getVertexPosition(h,Ev),s.getVertexPosition(p,Tv);const m=KR(s,e,t,n,Mv,Ev,Tv,BM);if(m){const y=new se;hs.getBarycoord(BM,Mv,Ev,Tv,y),i&&(m.uv=hs.getInterpolatedAttribute(i,f,h,p,y,new pt)),a&&(m.uv1=hs.getInterpolatedAttribute(a,f,h,p,y,new pt)),c&&(m.normal=hs.getInterpolatedAttribute(c,f,h,p,y,new se),m.normal.dot(n.direction)>0&&m.normal.multiplyScalar(-1));const x={a:f,b:h,c:p,normal:new se,materialIndex:0};hs.getNormal(Mv,Ev,Tv,x.normal),m.face=x,m.barycoord=y}return m}const kM=new se,GM=new di,HM=new di,QR=new se,VM=new dn,Rv=new se,l_=new Hr,jM=new dn,c_=new Jf;class Iw extends Si{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Z_,this.bindMatrix=new dn,this.bindMatrixInverse=new dn,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Gr),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n1?null:t.copy(e.start).addScaledVector(n,a)}intersectsLine(e){const 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){const n=t||tD.getNormalMatrix(e),i=this.coplanarPoint(u_).applyMatrix4(e),a=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(a),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)}}const xf=new Hr,nD=new pt(.5,.5),Uv=new se;class Wd{constructor(e=new _c,t=new _c,n=new _c,i=new _c,a=new _c,c=new _c){this.planes=[e,t,n,i,a,c]}set(e,t,n,i,a,c){const f=this.planes;return f[0].copy(e),f[1].copy(t),f[2].copy(n),f[3].copy(i),f[4].copy(a),f[5].copy(c),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ms,n=!1){const i=this.planes,a=e.elements,c=a[0],f=a[1],h=a[2],p=a[3],m=a[4],y=a[5],x=a[6],_=a[7],S=a[8],C=a[9],T=a[10],E=a[11],R=a[12],I=a[13],L=a[14],F=a[15];if(i[0].setComponents(p-c,_-m,E-S,F-R).normalize(),i[1].setComponents(p+c,_+m,E+S,F+R).normalize(),i[2].setComponents(p+f,_+y,E+C,F+I).normalize(),i[3].setComponents(p-f,_-y,E-C,F-I).normalize(),n)i[4].setComponents(h,x,T,L).normalize(),i[5].setComponents(p-h,_-x,E-T,F-L).normalize();else if(i[4].setComponents(p-h,_-x,E-T,F-L).normalize(),t===Ms)i[5].setComponents(p+h,_+x,E+T,F+L).normalize();else if(t===qf)i[5].setComponents(h,x,T,L).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(),xf.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),xf.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(xf)}intersectsSprite(e){xf.center.set(0,0,0);const t=nD.distanceTo(e.center);return xf.radius=.7071067811865476+t,xf.applyMatrix4(e.matrixWorld),this.intersectsSphere(xf)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let a=0;a<6;a++)if(t[a].distanceToPoint(n)0?e.max.x:e.min.x,Uv.y=i.normal.y>0?e.max.y:e.min.y,Uv.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Uv)<0)return!1}return!0}containsPoint(e){const 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)}}const bl=new dn,Sl=new Wd;class Ux{constructor(){this.coordinateSystem=Ms}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let n=0;n=a.length&&a.push({start:-1,count:-1,z:-1,index:-1});const f=a[this.index];c.push(f),this.index++,f.start=e,f.count=t,f.z=n,f.index=i}reset(){this.list.length=0,this.index=0}}const us=new dn,sD=new kt(1,1,1),YM=new Wd,oD=new Ux,Iv=new Gr,_f=new Hr,Tm=new se,ZM=new se,lD=new se,h_=new aD,xa=new Si,Lv=[];function cD(s,e,t=0){const n=e.itemSize;if(s.isInterleavedBufferAttribute||s.array.constructor!==e.array.constructor){const i=s.count;for(let a=0;a65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new bi(a,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),a=t.getAttribute(n);if(i.itemSize!==a.itemSize||i.normalized!==a.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Gr);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(f_),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=n):(i=this._instanceInfo.length,this._instanceInfo.push(n));const a=this._matricesTexture;us.identity().toArray(a.image.data,i*16),a.needsUpdate=!0;const c=this._colorsTexture;return c&&(sD.toArray(c.image.data,i*4),c.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},a=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const c=e.getIndex();if(c!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=n===-1?c.count:n),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let h;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(f_),h=this._availableGeometryIds.shift(),a[h]=i):(h=this._geometryCount,this._geometryCount++,a.push(i)),this.setGeometryAt(h,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,a=n.getIndex(),c=t.getIndex(),f=this._geometryInfo[e];if(i&&c.count>f.reservedIndexCount||t.attributes.position.count>f.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const h=f.vertexStart,p=f.reservedVertexCount;f.vertexCount=t.getAttribute("position").count;for(const m in n.attributes){const y=t.getAttribute(m),x=n.getAttribute(m);cD(y,x,h);const _=y.itemSize;for(let S=y.count,C=p;S=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let i=0,a=n.length;if).sort((c,f)=>n[c].vertexStart-n[f].vertexStart),a=this.geometry;for(let c=0,f=n.length;c=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const a=new Gr,c=n.index,f=n.attributes.position;for(let h=i.start,p=i.start+i.count;h=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const a=new Hr;this.getBoundingBoxAt(e,Iv),Iv.getCenter(a.center);const c=n.index,f=n.attributes.position;let h=0;for(let p=i.start,m=i.start+i.count;pf.active);if(Math.max(...n.map(f=>f.vertexStart+f.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(h=>h.indexStart+h.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const a=this.geometry;a.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new bn,this._initializeGeometry(a));const c=this.geometry;a.index&&bf(a.index.array,c.index.array);for(const f in a.attributes)bf(a.attributes[f].array,c.attributes[f].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,a=this.matrixWorld,c=this.geometry;xa.material=this.material,xa.geometry.index=c.index,xa.geometry.attributes=c.attributes,xa.geometry.boundingBox===null&&(xa.geometry.boundingBox=new Gr),xa.geometry.boundingSphere===null&&(xa.geometry.boundingSphere=new Hr);for(let f=0,h=n.length;f({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,a){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const c=i.getIndex();let f=c===null?1:c.array.BYTES_PER_ELEMENT,h=1;a.wireframe&&(h=2,f=i.attributes.position.count>65535?4:2);const p=this._instanceInfo,m=this._multiDrawStarts,y=this._multiDrawCounts,x=this._geometryInfo,_=this.perObjectFrustumCulled,S=this._indirectTexture,C=S.image.data,T=n.isArrayCamera?oD:YM;_&&!n.isArrayCamera&&(us.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),YM.setFromProjectionMatrix(us,n.coordinateSystem,n.reversedDepth));let E=0;if(this.sortObjects){us.copy(this.matrixWorld).invert(),Tm.setFromMatrixPosition(n.matrixWorld).applyMatrix4(us),ZM.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(us);for(let L=0,F=p.length;L0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,c=i.length;an)return;d_.applyMatrix4(s.matrixWorld);const p=e.ray.origin.distanceTo(d_);if(!(pe.far))return{distance:p,point:QM.clone().applyMatrix4(s.matrixWorld),index:c,face:null,faceIndex:null,barycoord:null,object:s}}const JM=new se,$M=new se;class Nl extends Cu{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,a=t.count;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,c=i.length;ai.far)return;a.push({distance:p,distanceToRay:Math.sqrt(f),point:h,index:e,face:null,faceIndex:null,barycoord:null,object:c})}}class Fw extends mi{constructor(e,t,n,i,a=Wn,c=Wn,f,h,p){super(e,t,n,i,a,c,f,h,p),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const m=this;function y(){m.needsUpdate=!0,m._requestVideoFrameCallbackId=e.requestVideoFrameCallback(y)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(y))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class uD extends Fw{constructor(e,t,n,i,a,c,f,h){super({},e,t,n,i,a,c,f,h),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class fD extends mi{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=pr,this.minFilter=pr,this.generateMipmaps=!1,this.needsUpdate=!0}}class Ix extends mi{constructor(e,t,n,i,a,c,f,h,p,m,y,x){super(null,c,f,h,p,m,i,a,y,x),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class hD extends Ix{constructor(e,t,n,i,a,c){super(e,t,n,a,c),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=ar,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class dD extends Ix{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Fo),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class M0 extends mi{constructor(e=[],t=Fo,n,i,a,c,f,h,p,m){super(e,t,n,i,a,c,f,h,p,m),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class pD extends mi{constructor(e,t,n,i,a,c,f,h,p){super(e,t,n,i,a,c,f,h,p),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Fd extends mi{constructor(e,t,n=ws,i,a,c,f=pr,h=pr,p,m=Ul,y=1){if(m!==Ul&&m!==bu)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const x={width:e,height:t,depth:y};super(x,i,a,c,f,h,m,n,p),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Su(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class zw extends Fd{constructor(e,t=ws,n=Fo,i,a,c=pr,f=pr,h,p=Ul){const m={width:e,height:e,depth:1},y=[m,m,m,m,m,m];super(e,e,t,n,i,a,c,f,h,p),this.image=y,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class Hb extends mi{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Uu extends bn{constructor(e=1,t=1,n=1,i=1,a=1,c=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:a,depthSegments:c};const f=this;i=Math.floor(i),a=Math.floor(a),c=Math.floor(c);const h=[],p=[],m=[],y=[];let x=0,_=0;S("z","y","x",-1,-1,n,t,e,c,a,0),S("z","y","x",1,-1,n,t,-e,c,a,1),S("x","z","y",1,1,e,n,t,i,c,2),S("x","z","y",1,-1,e,n,-t,i,c,3),S("x","y","z",1,-1,e,t,n,i,a,4),S("x","y","z",-1,-1,e,t,-n,i,a,5),this.setIndex(h),this.setAttribute("position",new Xt(p,3)),this.setAttribute("normal",new Xt(m,3)),this.setAttribute("uv",new Xt(y,2));function S(C,T,E,R,I,L,F,P,z,U,O){const W=L/z,q=F/U,Y=L/2,K=F/2,$=P/2,ie=z+1,X=U+1;let te=0,ge=0;const ce=new se;for(let fe=0;fe0?1:-1,m.push(ce.x,ce.y,ce.z),y.push(Z/z),y.push(1-fe/U),te+=1}}for(let fe=0;fe0){const O=(R-1)*C;for(let W=0;W0&&I(!0),t>0&&I(!1)),this.setIndex(m),this.setAttribute("position",new Xt(y,3)),this.setAttribute("normal",new Xt(x,3)),this.setAttribute("uv",new Xt(_,2));function R(){const L=new se,F=new se;let P=0;const z=(t-e)/n;for(let U=0;U<=a;U++){const O=[],W=U/a,q=W*(t-e)+e;for(let Y=0;Y<=i;Y++){const K=Y/i,$=K*h+f,ie=Math.sin($),X=Math.cos($);F.x=q*ie,F.y=-W*n+T,F.z=q*X,y.push(F.x,F.y,F.z),L.set(ie,z,X).normalize(),x.push(L.x,L.y,L.z),_.push(K,1-W),O.push(S++)}C.push(O)}for(let U=0;U0||O!==0)&&(m.push(W,q,K),P+=3),(t>0||O!==a-1)&&(m.push(q,Y,K),P+=3)}p.addGroup(E,P,0),E+=P}function I(L){const F=S,P=new pt,z=new se;let U=0;const O=L===!0?e:t,W=L===!0?1:-1;for(let Y=1;Y<=i;Y++)y.push(0,T*W,0),x.push(0,W,0),_.push(.5,.5),S++;const q=S;for(let Y=0;Y<=i;Y++){const $=Y/i*h+f,ie=Math.cos($),X=Math.sin($);z.x=O*X,z.y=T*W,z.z=O*ie,y.push(z.x,z.y,z.z),x.push(0,W,0),P.x=ie*.5+.5,P.y=X*.5*W+.5,_.push(P.x,P.y),S++}for(let Y=0;Y.9&&z<.1&&(I<.2&&(c[R+0]+=1),L<.2&&(c[R+2]+=1),F<.2&&(c[R+4]+=1))}}function x(R){a.push(R.x,R.y,R.z)}function _(R,I){const L=R*3;I.x=e[L+0],I.y=e[L+1],I.z=e[L+2]}function S(){const R=new se,I=new se,L=new se,F=new se,P=new pt,z=new pt,U=new pt;for(let O=0,W=0;O0)h=i-1;else{h=i;break}if(i=h,n[i]===c)return i/(a-1);const m=n[i],x=n[i+1]-m,_=(c-m)/x;return(i+_)/(a-1)}getTangent(e,t){let i=e-1e-4,a=e+1e-4;i<0&&(i=0),a>1&&(a=1);const c=this.getPoint(i),f=this.getPoint(a),h=t||(c.isVector2?new pt:new se);return h.copy(f).sub(c).normalize(),h}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new se,i=[],a=[],c=[],f=new se,h=new dn;for(let _=0;_<=e;_++){const S=_/e;i[_]=this.getTangentAt(S,new se)}a[0]=new se,c[0]=new se;let p=Number.MAX_VALUE;const m=Math.abs(i[0].x),y=Math.abs(i[0].y),x=Math.abs(i[0].z);m<=p&&(p=m,n.set(1,0,0)),y<=p&&(p=y,n.set(0,1,0)),x<=p&&n.set(0,0,1),f.crossVectors(i[0],n).normalize(),a[0].crossVectors(i[0],f),c[0].crossVectors(i[0],a[0]);for(let _=1;_<=e;_++){if(a[_]=a[_-1].clone(),c[_]=c[_-1].clone(),f.crossVectors(i[_-1],i[_]),f.length()>Number.EPSILON){f.normalize();const S=Math.acos(hn(i[_-1].dot(i[_]),-1,1));a[_].applyMatrix4(h.makeRotationAxis(f,S))}c[_].crossVectors(i[_],a[_])}if(t===!0){let _=Math.acos(hn(a[0].dot(a[e]),-1,1));_/=e,i[0].dot(f.crossVectors(a[0],a[e]))>0&&(_=-_);for(let S=1;S<=e;S++)a[S].applyMatrix4(h.makeRotationAxis(i[S],_*S)),c[S].crossVectors(i[S],a[S])}return{tangents:i,normals:a,binormals:c}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const 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 Px extends Bo{constructor(e=0,t=0,n=1,i=1,a=0,c=Math.PI*2,f=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=a,this.aEndAngle=c,this.aClockwise=f,this.aRotation=h}getPoint(e,t=new pt){const n=t,i=Math.PI*2;let a=this.aEndAngle-this.aStartAngle;const c=Math.abs(a)i;)a-=i;a0?0:(Math.floor(Math.abs(f)/a)+1)*a:h===0&&f===a-1&&(f=a-2,h=1);let p,m;this.closed||f>0?p=i[(f-1)%a]:(Gv.subVectors(i[0],i[1]).add(i[0]),p=Gv);const y=i[f%a],x=i[(f+1)%a];if(this.closed||f+2i.length-2?i.length-1:c+1],y=i[c>i.length-3?i.length-1:c+2];return n.set(nE(f,h.x,p.x,m.x,y.x),nE(f,h.y,p.y,m.y,y.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const c=i[a]-n,f=this.curves[a],h=f.getLength(),p=h===0?0:1-c/h;return f.getPointAt(p,t)}a++}return null}getLength(){const 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;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!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;t0){const y=p.getPoint(0);y.equals(this.currentPoint)||this.lineTo(y.x,y.y)}this.curves.push(p);const m=p.getPoint(1);return this.currentPoint.copy(m),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Vf extends lx{constructor(e){super(e),this.uuid=Es(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n80*t){f=s[0],h=s[1];let m=f,y=h;for(let x=t;xm&&(m=_),S>y&&(y=S)}p=Math.max(m-f,y-h),p=p!==0?32767/p:0}return o0(a,c,t,f,h,p,0),c}function Ww(s,e,t,n,i){let a;if(i===zD(s,e,t,n)>0)for(let c=e;c=e;c-=n)a=iE(c/n|0,s[c],s[c+1],a);return a&&zd(a,a.next)&&(c0(a),a=a.next),a}function Kf(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(zd(t,t.next)||Qi(t.prev,t,t.next)===0)){if(c0(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function o0(s,e,t,n,i,a,c){if(!s)return;!c&&a&&ID(s,n,i,a);let f=s;for(;s.prev!==s.next;){const h=s.prev,p=s.next;if(a?ED(s,n,i,a):MD(s)){e.push(h.i,s.i,p.i),c0(s),s=p.next,f=p.next;continue}if(s=p,s===f){c?c===1?(s=TD(Kf(s),e),o0(s,e,t,n,i,a,2)):c===2&&wD(s,e,t,n,i,a):o0(Kf(s),e,t,n,i,a,1);break}}}function MD(s){const e=s.prev,t=s,n=s.next;if(Qi(e,t,n)>=0)return!1;const i=e.x,a=t.x,c=n.x,f=e.y,h=t.y,p=n.y,m=Math.min(i,a,c),y=Math.min(f,h,p),x=Math.max(i,a,c),_=Math.max(f,h,p);let S=n.next;for(;S!==e;){if(S.x>=m&&S.x<=x&&S.y>=y&&S.y<=_&&Nm(i,f,a,h,c,p,S.x,S.y)&&Qi(S.prev,S,S.next)>=0)return!1;S=S.next}return!0}function ED(s,e,t,n){const i=s.prev,a=s,c=s.next;if(Qi(i,a,c)>=0)return!1;const f=i.x,h=a.x,p=c.x,m=i.y,y=a.y,x=c.y,_=Math.min(f,h,p),S=Math.min(m,y,x),C=Math.max(f,h,p),T=Math.max(m,y,x),E=tb(_,S,e,t,n),R=tb(C,T,e,t,n);let I=s.prevZ,L=s.nextZ;for(;I&&I.z>=E&&L&&L.z<=R;){if(I.x>=_&&I.x<=C&&I.y>=S&&I.y<=T&&I!==i&&I!==c&&Nm(f,m,h,y,p,x,I.x,I.y)&&Qi(I.prev,I,I.next)>=0||(I=I.prevZ,L.x>=_&&L.x<=C&&L.y>=S&&L.y<=T&&L!==i&&L!==c&&Nm(f,m,h,y,p,x,L.x,L.y)&&Qi(L.prev,L,L.next)>=0))return!1;L=L.nextZ}for(;I&&I.z>=E;){if(I.x>=_&&I.x<=C&&I.y>=S&&I.y<=T&&I!==i&&I!==c&&Nm(f,m,h,y,p,x,I.x,I.y)&&Qi(I.prev,I,I.next)>=0)return!1;I=I.prevZ}for(;L&&L.z<=R;){if(L.x>=_&&L.x<=C&&L.y>=S&&L.y<=T&&L!==i&&L!==c&&Nm(f,m,h,y,p,x,L.x,L.y)&&Qi(L.prev,L,L.next)>=0)return!1;L=L.nextZ}return!0}function TD(s,e){let t=s;do{const n=t.prev,i=t.next.next;!zd(n,i)&&qw(n,t,t.next,i)&&l0(n,i)&&l0(i,n)&&(e.push(n.i,t.i,i.i),c0(t),c0(t.next),t=s=i),t=t.next}while(t!==s);return Kf(t)}function wD(s,e,t,n,i,a){let c=s;do{let f=c.next.next;for(;f!==c.prev;){if(c.i!==f.i&&OD(c,f)){let h=Yw(c,f);c=Kf(c,c.next),h=Kf(h,h.next),o0(c,e,t,n,i,a,0),o0(h,e,t,n,i,a,0);return}f=f.next}c=c.next}while(c!==s)}function AD(s,e,t,n){const i=[];for(let a=0,c=e.length;a=t.next.y&&t.next.y!==t.y){const y=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(y<=n&&y>a&&(a=y,c=t.x=t.x&&t.x>=h&&n!==t.x&&Xw(ic.x||t.x===c.x&&UD(c,t)))&&(c=t,m=y)}t=t.next}while(t!==f);return c}function UD(s,e){return Qi(s.prev,s,e.prev)<0&&Qi(e.next,s,s.next)<0}function ID(s,e,t,n){let i=s;do i.z===0&&(i.z=tb(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,LD(i)}function LD(s){let e,t=1;do{let n=s,i;s=null;let a=null;for(e=0;n;){e++;let c=n,f=0;for(let p=0;p0||h>0&&c;)f!==0&&(h===0||!c||n.z<=c.z)?(i=n,n=n.nextZ,f--):(i=c,c=c.nextZ,h--),a?a.nextZ=i:s=i,i.prevZ=a,a=i;n=c}a.nextZ=null,t*=2}while(e>1);return s}function tb(s,e,t,n,i){return s=(s-t)*i|0,e=(e-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function ND(s){let e=s,t=s;do(e.x=(s-c)*(a-f)&&(s-c)*(n-f)>=(t-c)*(e-f)&&(t-c)*(a-f)>=(i-c)*(n-f)}function Nm(s,e,t,n,i,a,c,f){return!(s===c&&e===f)&&Xw(s,e,t,n,i,a,c,f)}function OD(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!PD(s,e)&&(l0(s,e)&&l0(e,s)&&FD(s,e)&&(Qi(s.prev,s,e.prev)||Qi(s,e.prev,e))||zd(s,e)&&Qi(s.prev,s,s.next)>0&&Qi(e.prev,e,e.next)>0)}function Qi(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function zd(s,e){return s.x===e.x&&s.y===e.y}function qw(s,e,t,n){const i=Vv(Qi(s,e,t)),a=Vv(Qi(s,e,n)),c=Vv(Qi(t,n,s)),f=Vv(Qi(t,n,e));return!!(i!==a&&c!==f||i===0&&Hv(s,t,e)||a===0&&Hv(s,n,e)||c===0&&Hv(t,s,n)||f===0&&Hv(t,e,n))}function Hv(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function Vv(s){return s>0?1:s<0?-1:0}function PD(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&qw(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function l0(s,e){return Qi(s.prev,s,s.next)<0?Qi(s,e,s.next)>=0&&Qi(s,s.prev,e)>=0:Qi(s,e,s.prev)<0||Qi(s,s.next,e)<0}function FD(s,e){let t=s,n=!1;const i=(s.x+e.x)/2,a=(s.y+e.y)/2;do t.y>a!=t.next.y>a&&t.next.y!==t.y&&i<(t.next.x-t.x)*(a-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function Yw(s,e){const t=nb(s.i,s.x,s.y),n=nb(e.i,e.x,e.y),i=s.next,a=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,a.next=n,n.prev=a,n}function iE(s,e,t,n){const i=nb(s,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function c0(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function nb(s,e,t){return{i:s,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function zD(s,e,t,n){let i=0;for(let a=e,c=t-n;a2&&s[e-1].equals(s[0])&&s.pop()}function aE(s,e){for(let t=0;tNumber.EPSILON){const ze=Math.sqrt(B),we=Math.sqrt(je*je+j*j),Ae=Ve.x-Ne/ze,Le=Ve.y+qe/ze,lt=Pe.x-j/we,Tt=Pe.y+je/we,Rt=((lt-Ae)*j-(Tt-Le)*je)/(qe*j-Ne*je);it=Ae+qe*Rt-Oe.x,Q=Le+Ne*Rt-Oe.y;const Xe=it*it+Q*Q;if(Xe<=2)return new pt(it,Q);ut=Math.sqrt(Xe/2)}else{let ze=!1;qe>Number.EPSILON?je>Number.EPSILON&&(ze=!0):qe<-Number.EPSILON?je<-Number.EPSILON&&(ze=!0):Math.sign(Ne)===Math.sign(j)&&(ze=!0),ze?(it=-Ne,Q=qe,ut=Math.sqrt(B)):(it=qe,Q=Ne,ut=Math.sqrt(B/2))}return new pt(it/ut,Q/ut)}const ce=[];for(let Oe=0,Ve=ie.length,Pe=Ve-1,it=Oe+1;Oe=0;Oe--){const Ve=Oe/T,Pe=_*Math.cos(Ve*Math.PI/2),it=S*Math.sin(Ve*Math.PI/2)+C;for(let Q=0,ut=ie.length;Q=0;){const it=Pe;let Q=Pe-1;Q<0&&(Q=Oe.length-1);for(let ut=0,qe=m+T*2;ut0)&&_.push(I,L,P),(E!==n-1||h0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Zb extends Vr{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Kb extends Sa{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new kt(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 kt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Du,this.normalScale=new pt(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 As,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}}class Jw extends Kb{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 pt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return hn(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 kt(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 kt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new kt(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}}class $w extends Sa{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new kt(16777215),this.specular=new kt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new kt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Du,this.normalScale=new pt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new As,this.combine=y0,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}}class eA extends Sa{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new kt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new kt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Du,this.normalScale=new pt(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}}class tA extends Sa{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Du,this.normalScale=new pt(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}}class nA extends Sa{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new kt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new kt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Du,this.normalScale=new pt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new As,this.combine=y0,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}}class Xx extends Sa{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=mw,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}}class qx extends Sa{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}}class iA extends Sa{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new kt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Du,this.normalScale=new pt(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}}class rA extends Ga{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 Bf(s,e){return!s||s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function aA(s){function e(i,a){return s[i]-s[a]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function ib(s,e,t){const n=s.length,i=new s.constructor(n);for(let a=0,c=0;c!==n;++a){const f=t[a]*e;for(let h=0;h!==e;++h)i[c++]=s[f+h]}return i}function Qb(s,e,t,n){let i=1,a=s[0];for(;a!==void 0&&a[n]===void 0;)a=s[i++];if(a===void 0)return;let c=a[n];if(c!==void 0)if(Array.isArray(c))do c=a[n],c!==void 0&&(e.push(a.time),t.push(...c)),a=s[i++];while(a!==void 0);else if(c.toArray!==void 0)do c=a[n],c!==void 0&&(e.push(a.time),c.toArray(t,t.length)),a=s[i++];while(a!==void 0);else do c=a[n],c!==void 0&&(e.push(a.time),t.push(c)),a=s[i++];while(a!==void 0)}function XD(s,e,t,n,i=30){const a=s.clone();a.name=e;const c=[];for(let h=0;h=n)){y.push(p.times[_]);for(let C=0;Ca.tracks[h].times[0]&&(f=a.tracks[h].times[0]);for(let h=0;h=f.times[S]){const E=S*y+m,R=E+y-m;C=f.values.slice(E,R)}else{const E=f.createInterpolant(),R=m,I=y-m;E.evaluate(a),C=E.resultBuffer.slice(R,I)}h==="quaternion"&&new kr().fromArray(C).normalize().conjugate().toArray(C);const T=p.times.length;for(let E=0;E=a)){const f=t[1];e=a)break t}c=n,n=0;break n}break e}for(;n>>1;et;)--c;if(++c,a!==0||c!==i){a>=c&&(c=Math.max(c,1),a=c-1);const f=this.getValueSize();this.times=n.slice(a,c),this.values=this.values.slice(a*f,c*f)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&($t("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,a=n.length;a===0&&($t("KeyframeTrack: Track is empty.",this),e=!1);let c=null;for(let f=0;f!==a;f++){const h=n[f];if(typeof h=="number"&&isNaN(h)){$t("KeyframeTrack: Time is not a valid number.",this,f,h),e=!1;break}if(c!==null&&c>h){$t("KeyframeTrack: Out of order keys.",this,f,h,c),e=!1;break}c=h}if(i!==void 0&&Ew(i))for(let f=0,h=i.length;f!==h;++f){const p=i[f];if(isNaN(p)){$t("KeyframeTrack: Value is not a valid number.",this,f,p),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===uy,a=e.length-1;let c=1;for(let f=1;f0){e[c]=e[a];for(let f=a*n,h=c*n,p=0;p!==n;++p)t[h+p]=t[f+p];++c}return c!==e.length?(this.times=e.slice(0,c),this.values=t.slice(0,c*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}co.prototype.ValueTypeName="";co.prototype.TimeBufferType=Float32Array;co.prototype.ValueBufferType=Float32Array;co.prototype.DefaultInterpolation=rx;class $f extends co{constructor(e,t,n){super(e,t,n)}}$f.prototype.ValueTypeName="bool";$f.prototype.ValueBufferType=Array;$f.prototype.DefaultInterpolation=e0;$f.prototype.InterpolantFactoryMethodLinear=void 0;$f.prototype.InterpolantFactoryMethodSmooth=void 0;class $b extends co{constructor(e,t,n,i){super(e,t,n,i)}}$b.prototype.ValueTypeName="color";class u0 extends co{constructor(e,t,n,i){super(e,t,n,i)}}u0.prototype.ValueTypeName="number";class cA extends Xd{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const a=this.resultBuffer,c=this.sampleValues,f=this.valueSize,h=(n-t)/(i-t);let p=e*f;for(let m=p+f;p!==m;p+=4)kr.slerpFlat(a,0,c,p-f,c,p,h);return a}}class R0 extends co{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new cA(this.times,this.values,this.getValueSize(),e)}}R0.prototype.ValueTypeName="quaternion";R0.prototype.InterpolantFactoryMethodSmooth=void 0;class eh extends co{constructor(e,t,n){super(e,t,n)}}eh.prototype.ValueTypeName="string";eh.prototype.ValueBufferType=Array;eh.prototype.DefaultInterpolation=e0;eh.prototype.InterpolantFactoryMethodLinear=void 0;eh.prototype.InterpolantFactoryMethodSmooth=void 0;class f0 extends co{constructor(e,t,n,i){super(e,t,n,i)}}f0.prototype.ValueTypeName="vector";class h0{constructor(e="",t=-1,n=[],i=Sx){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Es(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let c=0,f=n.length;c!==f;++c)t.push(KD(n[c]).scale(i));const a=new this(e.name,e.duration,t,e.blendMode);return a.uuid=e.uuid,a.userData=JSON.parse(e.userData||"{}"),a}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let a=0,c=n.length;a!==c;++a)t.push(co.toJSON(n[a]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const a=t.length,c=[];for(let f=0;f1){const y=m[1];let x=i[y];x||(i[y]=x=[]),x.push(p)}}const c=[];for(const f in i)c.push(this.CreateFromMorphTargetSequence(f,i[f],t,n));return c}static parseAnimation(e,t){if(Bt("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return $t("AnimationClip: No animation in JSONLoader data."),null;const n=function(y,x,_,S,C){if(_.length!==0){const T=[],E=[];Qb(_,T,E,S),T.length!==0&&C.push(new y(x,T,E))}},i=[],a=e.name||"default",c=e.fps||30,f=e.blendMode;let h=e.length||-1;const p=e.hierarchy||[];for(let y=0;y{t&&t(a),this.manager.itemEnd(e)},0),a;if(xc[e]!==void 0){xc[e].push({onLoad:t,onProgress:n,onError:i});return}xc[e]=[],xc[e].push({onLoad:t,onProgress:n,onError:i});const c=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),f=this.mimeType,h=this.responseType;fetch(c).then(p=>{if(p.status===200||p.status===0){if(p.status===0&&Bt("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||p.body===void 0||p.body.getReader===void 0)return p;const m=xc[e],y=p.body.getReader(),x=p.headers.get("X-File-Size")||p.headers.get("Content-Length"),_=x?parseInt(x):0,S=_!==0;let C=0;const T=new ReadableStream({start(E){R();function R(){y.read().then(({done:I,value:L})=>{if(I)E.close();else{C+=L.byteLength;const F=new ProgressEvent("progress",{lengthComputable:S,loaded:C,total:_});for(let P=0,z=m.length;P{E.error(I)})}}});return new Response(T)}else throw new QD(`fetch for "${p.url}" responded with ${p.status}: ${p.statusText}`,p)}).then(p=>{switch(h){case"arraybuffer":return p.arrayBuffer();case"blob":return p.blob();case"document":return p.text().then(m=>new DOMParser().parseFromString(m,f));case"json":return p.json();default:if(f==="")return p.text();{const y=/charset="?([^;"\s]*)"?/i.exec(f),x=y&&y[1]?y[1].toLowerCase():void 0,_=new TextDecoder(x);return p.arrayBuffer().then(S=>_.decode(S))}}}).then(p=>{Cl.add(`file:${e}`,p);const m=xc[e];delete xc[e];for(let y=0,x=m.length;y{const m=xc[e];if(m===void 0)throw this.manager.itemError(e),p;delete xc[e];for(let y=0,x=m.length;y{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class JD extends Ha{constructor(e){super(e)}load(e,t,n,i){const a=this,c=new Ts(this.manager);c.setPath(this.path),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(f){try{t(a.parse(JSON.parse(f)))}catch(h){i?i(h):$t(h),a.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const a in e.uniforms){const c=e.uniforms[a];switch(i.uniforms[a]={},c.type){case"t":i.uniforms[a].value=n(c.value);break;case"c":i.uniforms[a].value=new kt().setHex(c.value);break;case"v2":i.uniforms[a].value=new pt().fromArray(c.value);break;case"v3":i.uniforms[a].value=new se().fromArray(c.value);break;case"v4":i.uniforms[a].value=new di().fromArray(c.value);break;case"m3":i.uniforms[a].value=new _n().fromArray(c.value);break;case"m4":i.uniforms[a].value=new dn().fromArray(c.value);break;default:i.uniforms[a].value=c.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const a in e.extensions)i.extensions[a]=e.extensions[a];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let a=e.normalScale;Array.isArray(a)===!1&&(a=[a,a]),i.normalScale=new pt().fromArray(a)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new pt().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Kx.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:Kw,SpriteMaterial:Bb,RawShaderMaterial:Zb,ShaderMaterial:Vr,PointsMaterial:Gb,MeshPhysicalMaterial:Jw,MeshStandardMaterial:Kb,MeshPhongMaterial:$w,MeshToonMaterial:eA,MeshNormalMaterial:tA,MeshLambertMaterial:nA,MeshDepthMaterial:Xx,MeshDistanceMaterial:qx,MeshBasicMaterial:Ll,MeshMatcapMaterial:iA,LineDashedMaterial:rA,LineBasicMaterial:Ga,Material:Sa};return new t[e]}}class rb{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class iS extends bn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class xA extends Ha{constructor(e){super(e)}load(e,t,n,i){const a=this,c=new Ts(a.manager);c.setPath(a.path),c.setRequestHeader(a.requestHeader),c.setWithCredentials(a.withCredentials),c.load(e,function(f){try{t(a.parse(JSON.parse(f)))}catch(h){i?i(h):$t(h),a.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(_,S){if(t[S]!==void 0)return t[S];const T=_.interleavedBuffers[S],E=a(_,T.buffer),R=Ad(T.type,E),I=new Rx(R,T.stride);return I.uuid=T.uuid,t[S]=I,I}function a(_,S){if(n[S]!==void 0)return n[S];const T=_.arrayBuffers[S],E=new Uint32Array(T).buffer;return n[S]=E,E}const c=e.isInstancedBufferGeometry?new iS:new bn,f=e.data.index;if(f!==void 0){const _=Ad(f.type,f.array);c.setIndex(new bi(_,1))}const h=e.data.attributes;for(const _ in h){const S=h[_];let C;if(S.isInterleavedBufferAttribute){const T=i(e.data,S.data);C=new Yf(T,S.itemSize,S.offset,S.normalized)}else{const T=Ad(S.type,S.array),E=S.isInstancedBufferAttribute?Zf:bi;C=new E(T,S.itemSize,S.normalized)}S.name!==void 0&&(C.name=S.name),S.usage!==void 0&&C.setUsage(S.usage),c.setAttribute(_,C)}const p=e.data.morphAttributes;if(p)for(const _ in p){const S=p[_],C=[];for(let T=0,E=S.length;T0){const h=new Yx(t);a=new d0(h),a.setCrossOrigin(this.crossOrigin);for(let p=0,m=e.length;p0){i=new d0(this.manager),i.setCrossOrigin(this.crossOrigin);for(let c=0,f=e.length;c{let E=null,R=null;return T.boundingBox!==void 0&&(E=new Gr().fromJSON(T.boundingBox)),T.boundingSphere!==void 0&&(R=new Hr().fromJSON(T.boundingSphere)),{...T,boundingBox:E,boundingSphere:R}}),c._instanceInfo=e.instanceInfo,c._availableInstanceIds=e._availableInstanceIds,c._availableGeometryIds=e._availableGeometryIds,c._nextIndexStart=e.nextIndexStart,c._nextVertexStart=e.nextVertexStart,c._geometryCount=e.geometryCount,c._maxInstanceCount=e.maxInstanceCount,c._maxVertexCount=e.maxVertexCount,c._maxIndexCount=e.maxIndexCount,c._geometryInitialized=e.geometryInitialized,c._matricesTexture=p(e.matricesTexture.uuid),c._indirectTexture=p(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(c._colorsTexture=p(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(c.boundingSphere=new Hr().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(c.boundingBox=new Gr().fromJSON(e.boundingBox));break;case"LOD":c=new Uw;break;case"Line":c=new Cu(f(e.geometry),h(e.material));break;case"LineLoop":c=new Ow(f(e.geometry),h(e.material));break;case"LineSegments":c=new Nl(f(e.geometry),h(e.material));break;case"PointCloud":case"Points":c=new Pw(f(e.geometry),h(e.material));break;case"Sprite":c=new Dw(h(e.material));break;case"Group":c=new Cd;break;case"Bone":c=new kb;break;default:c=new ei}if(c.uuid=e.uuid,e.name!==void 0&&(c.name=e.name),e.matrix!==void 0?(c.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(c.matrixAutoUpdate=e.matrixAutoUpdate),c.matrixAutoUpdate&&c.matrix.decompose(c.position,c.quaternion,c.scale)):(e.position!==void 0&&c.position.fromArray(e.position),e.rotation!==void 0&&c.rotation.fromArray(e.rotation),e.quaternion!==void 0&&c.quaternion.fromArray(e.quaternion),e.scale!==void 0&&c.scale.fromArray(e.scale)),e.up!==void 0&&c.up.fromArray(e.up),e.pivot!==void 0&&(c.pivot=new se().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(c.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(c.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(c.castShadow=e.castShadow),e.receiveShadow!==void 0&&(c.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(c.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(c.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(c.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(c.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&c.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(c.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(c.visible=e.visible),e.frustumCulled!==void 0&&(c.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(c.renderOrder=e.renderOrder),e.static!==void 0&&(c.static=e.static),e.userData!==void 0&&(c.userData=e.userData),e.layers!==void 0&&(c.layers.mask=e.layers),e.children!==void 0){const x=e.children;for(let _=0;_"u"&&Bt("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&Bt("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const a=this,c=Cl.get(`image-bitmap:${e}`);if(c!==void 0){if(a.manager.itemStart(e),c.then){c.then(p=>{if(x_.has(c)===!0)i&&i(x_.get(c)),a.manager.itemError(e),a.manager.itemEnd(e);else return t&&t(p),a.manager.itemEnd(e),p});return}return setTimeout(function(){t&&t(c),a.manager.itemEnd(e)},0),c}const f={};f.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",f.headers=this.requestHeader,f.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const h=fetch(e,f).then(function(p){return p.blob()}).then(function(p){return createImageBitmap(p,Object.assign(a.options,{colorSpaceConversion:"none"}))}).then(function(p){return Cl.add(`image-bitmap:${e}`,p),t&&t(p),a.manager.itemEnd(e),p}).catch(function(p){i&&i(p),x_.set(h,p),Cl.remove(`image-bitmap:${e}`),a.manager.itemError(e),a.manager.itemEnd(e)});Cl.add(`image-bitmap:${e}`,h),a.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Xv;class rS{static getContext(){return Xv===void 0&&(Xv=new(window.AudioContext||window.webkitAudioContext)),Xv}static setContext(e){Xv=e}}class oU extends Ha{constructor(e){super(e)}load(e,t,n,i){const a=this,c=new Ts(this.manager);c.setResponseType("arraybuffer"),c.setPath(this.path),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(h){try{const p=h.slice(0);rS.getContext().decodeAudioData(p,function(y){t(y)}).catch(f)}catch(p){f(p)}},n,i);function f(h){i?i(h):$t(h),a.manager.itemError(e)}}}const mE=new dn,gE=new dn,Sf=new dn;class lU{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new dr,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new dr,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Sf.copy(e.projectionMatrix);const i=t.eyeSep/2,a=i*t.near/t.focus,c=t.near*Math.tan(Hf*t.fov*.5)/t.zoom;let f,h;gE.elements[12]=-i,mE.elements[12]=i,f=-c*t.aspect+a,h=c*t.aspect+a,Sf.elements[0]=2*t.near/(h-f),Sf.elements[8]=(h+f)/(h-f),this.cameraL.projectionMatrix.copy(Sf),f=-c*t.aspect-a,h=c*t.aspect-a,Sf.elements[0]=2*t.near/(h-f),Sf.elements[8]=(h+f)/(h-f),this.cameraR.projectionMatrix.copy(Sf)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(gE),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(mE)}}const vd=-90,yd=1;class _A extends ei{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new dr(vd,yd,e,t);i.layers=this.layers,this.add(i);const a=new dr(vd,yd,e,t);a.layers=this.layers,this.add(a);const c=new dr(vd,yd,e,t);c.layers=this.layers,this.add(c);const f=new dr(vd,yd,e,t);f.layers=this.layers,this.add(f);const h=new dr(vd,yd,e,t);h.layers=this.layers,this.add(h);const p=new dr(vd,yd,e,t);p.layers=this.layers,this.add(p)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,a,c,f,h]=t;for(const p of t)this.remove(p);if(e===Ms)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),a.up.set(0,0,-1),a.lookAt(0,1,0),c.up.set(0,0,1),c.lookAt(0,-1,0),f.up.set(0,1,0),f.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(e===qf)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),a.up.set(0,0,1),a.lookAt(0,1,0),c.up.set(0,0,-1),c.lookAt(0,-1,0),f.up.set(0,-1,0),f.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const p of t)this.add(p),p.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[a,c,f,h,p,m]=this.children,y=e.getRenderTarget(),x=e.getActiveCubeFace(),_=e.getActiveMipmapLevel(),S=e.xr.enabled;e.xr.enabled=!1;const C=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let T=!1;e.isWebGLRenderer===!0?T=e.state.buffers.depth.getReversed():T=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),T&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,1,i),T&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,2,i),T&&e.autoClear===!1&&e.clearDepth(),e.render(t,f),e.setRenderTarget(n,3,i),T&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(n,4,i),T&&e.autoClear===!1&&e.clearDepth(),e.render(t,p),n.texture.generateMipmaps=C,e.setRenderTarget(n,5,i),T&&e.autoClear===!1&&e.clearDepth(),e.render(t,m),e.setRenderTarget(y,x,_),e.xr.enabled=S,n.texture.needsPMREMUpdate=!0}}class bA extends dr{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class SA{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=cU.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 cU(){this._document.hidden===!1&&this.reset()}const Mf=new se,__=new kr,uU=new se,Ef=new se,Tf=new se;class fU extends ei{constructor(){super(),this.type="AudioListener",this.context=rS.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new SA}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(Mf,__,uU),Ef.set(0,0,-1).applyQuaternion(__),Tf.set(0,1,0).applyQuaternion(__),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Mf.x,n),t.positionY.linearRampToValueAtTime(Mf.y,n),t.positionZ.linearRampToValueAtTime(Mf.z,n),t.forwardX.linearRampToValueAtTime(Ef.x,n),t.forwardY.linearRampToValueAtTime(Ef.y,n),t.forwardZ.linearRampToValueAtTime(Ef.z,n),t.upX.linearRampToValueAtTime(Tf.x,n),t.upY.linearRampToValueAtTime(Tf.y,n),t.upZ.linearRampToValueAtTime(Tf.z,n)}else t.setPosition(Mf.x,Mf.y,Mf.z),t.setOrientation(Ef.x,Ef.y,Ef.z,Tf.x,Tf.y,Tf.z)}}let MA=class extends ei{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){Bt("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){Bt("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){Bt("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){Bt("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let h=t,p=t+t;h!==p;++h)if(n[h]!==n[h+t]){f.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let a=n,c=i;a!==c;++a)t[a]=t[i+a%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let c=0;c!==a;++c)e[t+c]=e[n+c]}_slerp(e,t,n,i){kr.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,a){const c=this._workIndex*a;kr.multiplyQuaternionsFlat(e,c,e,t,e,n),kr.slerpFlat(e,t,e,t,e,c,i)}_lerp(e,t,n,i,a){const c=1-i;for(let f=0;f!==a;++f){const h=t+f;e[h]=e[h]*c+e[n+f]*i}}_lerpAdditive(e,t,n,i,a){for(let c=0;c!==a;++c){const f=t+c;e[f]=e[f]+e[n+c]*i}}}const aS="\\[\\]\\.:\\/",mU=new RegExp("["+aS+"]","g"),sS="[^"+aS+"]",gU="[^"+aS.replace("\\.","")+"]",vU=/((?:WC+[\/:])*)/.source.replace("WC",sS),yU=/(WCOD+)?/.source.replace("WCOD",gU),xU=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",sS),_U=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",sS),bU=new RegExp("^"+vU+yU+xU+_U+"$"),SU=["material","materials","bones","map"];class MU{constructor(e,t,n){const i=n||$n.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,a=n.length;i!==a;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class $n{constructor(e,t,n){this.path=t,this.parsedPath=n||$n.parseTrackName(t),this.node=$n.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 $n.Composite(e,t,n):new $n(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(mU,"")}static parseTrackName(e){const t=bU.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const a=n.nodeName.substring(i+1);SU.indexOf(a)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=a)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("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){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(a){for(let c=0;c=a){const y=a++,x=e[y];t[x.uuid]=m,e[m]=x,t[p]=y,e[y]=h;for(let _=0,S=i;_!==S;++_){const C=n[_],T=C[y],E=C[m];C[m]=T,C[y]=E}}}this.nCachedObjects_=a}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let a=this.nCachedObjects_,c=e.length;for(let f=0,h=arguments.length;f!==h;++f){const p=arguments[f],m=p.uuid,y=t[m];if(y!==void 0)if(delete t[m],y0&&(t[_.uuid]=y),e[y]=_,e.pop();for(let S=0,C=i;S!==C;++S){const T=n[S];T[y]=T[x],T.pop()}}}this.nCachedObjects_=a}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const a=this._bindings;if(i!==void 0)return a[i];const c=this._paths,f=this._parsedPaths,h=this._objects,p=h.length,m=this.nCachedObjects_,y=new Array(p);i=a.length,n[e]=i,c.push(e),f.push(t),a.push(y);for(let x=m,_=h.length;x!==_;++x){const S=h[x];y[x]=new $n(S,e,t)}return y}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,a=this._parsedPaths,c=this._bindings,f=c.length-1,h=c[f],p=e[f];t[p]=n,c[n]=h,c.pop(),a[n]=a[f],a.pop(),i[n]=i[f],i.pop()}}}class TA{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const a=t.tracks,c=a.length,f=new Array(c),h={endingStart:Pf,endingEnd:Pf};for(let p=0;p!==c;++p){const m=a[p].createInterpolant(null);f[p]=m,m.settings=h}this._interpolantSettings=h,this._interpolants=f,this._propertyBindings=new Array(c),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=dw,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,a=e._clip.duration,c=a/i,f=i/a;e.warp(1,c,t),this.warp(f,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,a=i.time,c=this.timeScale;let f=this._timeScaleInterpolant;f===null&&(f=i._lendControlInterpolant(),this._timeScaleInterpolant=f);const h=f.parameterPositions,p=f.sampleValues;return h[0]=a,h[1]=a+n,p[0]=e/c,p[1]=t/c,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const a=this._startTime;if(a!==null){const h=(e-a)*n;h<0||n===0?t=0:(this._startTime=null,t=n*h)}t*=this._updateTimeScale(e);const c=this._updateTime(t),f=this._updateWeight(e);if(f>0){const h=this._interpolants,p=this._propertyBindings;switch(this.blendMode){case Nb:for(let m=0,y=h.length;m!==y;++m)h[m].evaluate(c),p[m].accumulateAdditive(f);break;case Sx:default:for(let m=0,y=h.length;m!==y;++m)h[m].evaluate(c),p[m].accumulate(i,f)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,a=this._loopCount;const c=n===pw;if(e===0)return a===-1?i:c&&(a&1)===1?t-i:i;if(n===hw){a===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(a===-1&&(e>=0?(a=0,this._setEndings(!0,this.repetitions===0,c)):this._setEndings(this.repetitions===0,!0,c)),i>=t||i<0){const f=Math.floor(i/t);i-=t*f,a+=Math.abs(f);const h=this.repetitions-a;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(h===1){const p=e<0;this._setEndings(p,!p,c)}else this._setEndings(!1,!1,c);this._loopCount=a,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:f})}}else this.time=i;if(c&&(a&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Ff,i.endingEnd=Ff):(e?i.endingStart=this.zeroSlopeAtStart?Ff:Pf:i.endingStart=t0,t?i.endingEnd=this.zeroSlopeAtEnd?Ff:Pf:i.endingEnd=t0)}_scheduleFading(e,t,n){const i=this._mixer,a=i.time;let c=this._weightInterpolant;c===null&&(c=i._lendControlInterpolant(),this._weightInterpolant=c);const f=c.parameterPositions,h=c.sampleValues;return f[0]=a,h[0]=t,f[1]=a+e,h[1]=n,this}}const TU=new Float32Array(1);class wU extends Il{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,a=i.length,c=e._propertyBindings,f=e._interpolants,h=n.uuid,p=this._bindingsByRootAndName;let m=p[h];m===void 0&&(m={},p[h]=m);for(let y=0;y!==a;++y){const x=i[y],_=x.name;let S=m[_];if(S!==void 0)++S.referenceCount,c[y]=S;else{if(S=c[y],S!==void 0){S._cacheIndex===null&&(++S.referenceCount,this._addInactiveBinding(S,h,_));continue}const C=t&&t._propertyBindings[y].binding.parsedPath;S=new EA($n.create(n,_,C),x.ValueTypeName,x.getValueSize()),++S.referenceCount,this._addInactiveBinding(S,h,_),c[y]=S}f[y].resultBuffer=S.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,a=this._actionsByClip[i];this._bindAction(e,a&&a.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const a=t[n];a.useCount++===0&&(this._lendBinding(a),a.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const a=t[n];--a.useCount===0&&(a.restoreOriginalState(),this._takeBackBinding(a))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,a=Math.sign(e),c=this._accuIndex^=1;for(let p=0;p!==n;++p)t[p]._update(i,e,a,c);const f=this._bindings,h=this._nActiveBindings;for(let p=0;p!==h;++p)f[p].apply(c);return this}setTime(e){this.time=0;for(let t=0;t=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,_E).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)}}const bE=new se,qv=new se,xd=new se,_d=new se,b_=new se,NU=new se,OU=new se;class PU{constructor(e=new se,t=new se){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){bE.subVectors(e,this.start),qv.subVectors(this.end,this.start);const n=qv.dot(qv);let a=qv.dot(bE)/n;return t&&(a=hn(a,0,1)),a}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=NU,n=OU){const i=10000000000000001e-32;let a,c;const f=this.start,h=e.start,p=this.end,m=e.end;xd.subVectors(p,f),_d.subVectors(m,h),b_.subVectors(f,h);const y=xd.dot(xd),x=_d.dot(_d),_=_d.dot(b_);if(y<=i&&x<=i)return t.copy(f),n.copy(h),t.sub(n),t.dot(t);if(y<=i)a=0,c=_/x,c=hn(c,0,1);else{const S=xd.dot(b_);if(x<=i)c=0,a=hn(-S/y,0,1);else{const C=xd.dot(_d),T=y*x-C*C;T!==0?a=hn((C*_-S*x)/T,0,1):a=0,c=(C*a+_)/x,c<0?(c=0,a=hn(-S/y,0,1)):c>1&&(c=1,a=hn((C-S)/y,0,1))}}return t.copy(f).addScaledVector(xd,a),n.copy(h).addScaledVector(_d,c),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)}}const SE=new se;class FU extends ei{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new bn,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let c=0,f=1,h=32;c1)for(let y=0;y.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{AE.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(AE,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class KU extends Nl{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new bn;i.setAttribute("position",new Xt(t,3)),i.setAttribute("color",new Xt(n,3));const a=new Ga({vertexColors:!0,toneMapped:!1});super(i,a),this.type="AxesHelper"}setColors(e,t,n){const i=new kt,a=this.geometry.attributes.color.array;return i.set(e),i.toArray(a,0),i.toArray(a,3),i.set(t),i.toArray(a,6),i.toArray(a,9),i.set(n),i.toArray(a,12),i.toArray(a,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class QU{constructor(){this.type="ShapePath",this.color=new kt,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new lx,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,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,a,c){return this.currentPath.bezierCurveTo(e,t,n,i,a,c),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(E){const R=[];for(let I=0,L=E.length;INumber.EPSILON){if(W<0&&(z=R[P],O=-O,U=R[F],W=-W),E.yU.y)continue;if(E.y===z.y){if(E.x===z.x)return!0}else{const q=W*(E.x-z.x)-O*(E.y-z.y);if(q===0)return!0;if(q<0)continue;L=!L}}else{if(E.y!==z.y)continue;if(U.x<=E.x&&E.x<=z.x||z.x<=E.x&&E.x<=U.x)return!0}}return L}const i=Oo.isClockWise,a=this.subPaths;if(a.length===0)return[];let c,f,h;const p=[];if(a.length===1)return f=a[0],h=new Vf,h.curves=f.curves,p.push(h),p;let m=!i(a[0].getPoints());m=e?!m:m;const y=[],x=[];let _=[],S=0,C;x[S]=void 0,_[S]=[];for(let E=0,R=a.length;E1){let E=!1,R=0;for(let I=0,L=x.length;I0&&E===!1&&(_=y)}let T;for(let E=0,R=x.length;Ee?(s.repeat.x=1,s.repeat.y=t/e,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2):(s.repeat.x=e/t,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0),s}function eI(s,e){const t=s.image&&s.image.width?s.image.width/s.image.height:1;return t>e?(s.repeat.x=e/t,s.repeat.y=1,s.offset.x=(1-s.repeat.x)/2,s.offset.y=0):(s.repeat.x=1,s.repeat.y=t/e,s.offset.x=0,s.offset.y=(1-s.repeat.y)/2),s}function tI(s){return s.repeat.x=1,s.repeat.y=1,s.offset.x=0,s.offset.y=0,s}function sb(s,e,t,n){const i=nI(n);switch(t){case Ib:return s*e;case _0:return s*e/i.components*i.byteLength;case b0:return s*e/i.components*i.byteLength;case Xf:return s*e*2/i.components*i.byteLength;case _x:return s*e*2/i.components*i.byteLength;case Lb:return s*e*3/i.components*i.byteLength;case mr:return s*e*4/i.components*i.byteLength;case bx:return s*e*4/i.components*i.byteLength;case km:case Gm:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case Hm:case Vm:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case Ay:case Ry:return Math.max(s,16)*Math.max(e,8)/4;case wy:case Cy:return Math.max(s,8)*Math.max(e,8)/2;case Dy:case Uy:case Ly:case Ny:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*8;case Iy:case Oy:case Py:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case Fy:return Math.floor((s+3)/4)*Math.floor((e+3)/4)*16;case zy:return Math.floor((s+4)/5)*Math.floor((e+3)/4)*16;case By:return Math.floor((s+4)/5)*Math.floor((e+4)/5)*16;case ky:return Math.floor((s+5)/6)*Math.floor((e+4)/5)*16;case Gy:return Math.floor((s+5)/6)*Math.floor((e+5)/6)*16;case Hy:return Math.floor((s+7)/8)*Math.floor((e+4)/5)*16;case Vy:return Math.floor((s+7)/8)*Math.floor((e+5)/6)*16;case jy:return Math.floor((s+7)/8)*Math.floor((e+7)/8)*16;case Wy:return Math.floor((s+9)/10)*Math.floor((e+4)/5)*16;case Xy:return Math.floor((s+9)/10)*Math.floor((e+5)/6)*16;case qy:return Math.floor((s+9)/10)*Math.floor((e+7)/8)*16;case Yy:return Math.floor((s+9)/10)*Math.floor((e+9)/10)*16;case Zy:return Math.floor((s+11)/12)*Math.floor((e+9)/10)*16;case Ky:return Math.floor((s+11)/12)*Math.floor((e+11)/12)*16;case Qy:case Jy:case $y:return Math.ceil(s/4)*Math.ceil(e/4)*16;case ex:case tx:return Math.ceil(s/4)*Math.ceil(e/4)*8;case nx:case ix:return Math.ceil(s/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function nI(s){switch(s){case Br:case gx:return{byteLength:1,components:1};case Ld:case vx:case sr:return{byteLength:2,components:1};case yx:case xx:return{byteLength:2,components:4};case ws:case x0:case Vi:return{byteLength:4,components:1};case Db:case Ub:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${s}.`)}class iI{static contain(e,t){return $U(e,t)}static cover(e,t){return eI(e,t)}static fill(e){return tI(e)}static getByteLength(e,t,n,i){return sb(e,t,n,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Vd}}));typeof window<"u"&&(window.__THREE__?Bt("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Vd);function CA(){let s=null,e=!1,t=null,n=null;function i(a,c){t(a,c),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(a){t=a},setContext:function(a){s=a}}}function rI(s){const e=new WeakMap;function t(f,h){const p=f.array,m=f.usage,y=p.byteLength,x=s.createBuffer();s.bindBuffer(h,x),s.bufferData(h,p,m),f.onUploadCallback();let _;if(p instanceof Float32Array)_=s.FLOAT;else if(typeof Float16Array<"u"&&p instanceof Float16Array)_=s.HALF_FLOAT;else if(p instanceof Uint16Array)f.isFloat16BufferAttribute?_=s.HALF_FLOAT:_=s.UNSIGNED_SHORT;else if(p instanceof Int16Array)_=s.SHORT;else if(p instanceof Uint32Array)_=s.UNSIGNED_INT;else if(p instanceof Int32Array)_=s.INT;else if(p instanceof Int8Array)_=s.BYTE;else if(p instanceof Uint8Array)_=s.UNSIGNED_BYTE;else if(p instanceof Uint8ClampedArray)_=s.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+p);return{buffer:x,type:_,bytesPerElement:p.BYTES_PER_ELEMENT,version:f.version,size:y}}function n(f,h,p){const m=h.array,y=h.updateRanges;if(s.bindBuffer(p,f),y.length===0)s.bufferSubData(p,0,m);else{y.sort((_,S)=>_.start-S.start);let x=0;for(let _=1;_ 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,bI=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,SI=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,MI=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,EI=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#endif`,TI=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#endif`,wI=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec4 vColor; +#endif`,AI=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec4( 1.0 ); +#endif +#ifdef USE_COLOR_ALPHA + vColor *= color; +#elif defined( USE_COLOR ) + vColor.rgb *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.rgb *= instanceColor.rgb; +#endif +#ifdef USE_BATCHING_COLOR + vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) ); +#endif`,CI=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,RI=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,DI=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,UI=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,II=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,LI=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,NI=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,OI="gl_FragColor = linearToOutputTexel( gl_FragColor );",PI=`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + 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 ); +}`,FI=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif + #endif +#endif`,zI=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif +#endif`,BI=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,kI=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,GI=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,HI=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,VI=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,jI=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,WI=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,XI=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,qI=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,YI=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,ZI=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,KI=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,QI=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,JI=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,$I=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,e4=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,t4=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,n4=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +material.metalness = metalnessFactor; +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor; + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = vec3( 0.04 ); + material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,i4=`uniform sampler2D dfgLUT; +struct PhysicalMaterial { + vec3 diffuseColor; + vec3 diffuseContribution; + vec3 specularColor; + vec3 specularColorBlended; + float roughness; + float metalness; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + vec3 iridescenceFresnelDielectric; + vec3 iridescenceFresnelMetallic; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return v; + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColorBlended; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transpose( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float rInv = 1.0 / ( roughness + 0.1 ); + float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv; + float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv; + float DG = exp( a * dotNV + b ); + return saturate( DG ); +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg; + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg; + vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg; + vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y; + vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y; + float Ess_V = dfgV.x + dfgV.y; + float Ess_L = dfgL.x + dfgL.y; + float Ems_V = 1.0 - Ess_V; + float Ems_L = 1.0 - Ess_L; + vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619; + vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON ); + float compensationFactor = Ems_V * Ems_L; + vec3 multiScatter = Fms * compensationFactor; + return singleScatter + multiScatter; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + #ifdef USE_CLEARCOAT + vec3 Ncc = geometryClearcoatNormal; + vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness ); + vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat ); + vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat ); + mat3 mInvClearcoat = mat3( + vec3( t1Clearcoat.x, 0, t1Clearcoat.y ), + vec3( 0, 1, 0 ), + vec3( t1Clearcoat.z, 0, t1Clearcoat.w ) + ); + vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y; + clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords ); + #endif + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + + float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness ); + + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL ); + + irradiance *= sheenEnergyComp; + + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ); + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + diffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectDiffuse += diffuse; +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI; + #endif + vec3 singleScatteringDielectric = vec3( 0.0 ); + vec3 multiScatteringDielectric = vec3( 0.0 ); + vec3 singleScatteringMetallic = vec3( 0.0 ); + vec3 multiScatteringMetallic = vec3( 0.0 ); + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric ); + computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic ); + #endif + vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness ); + vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness ); + vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric; + vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + vec3 indirectSpecular = radiance * singleScattering; + indirectSpecular += multiScattering * cosineWeightedIrradiance; + vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance; + #ifdef USE_SHEEN + float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo; + indirectSpecular *= sheenEnergyComp; + indirectDiffuse *= sheenEnergyComp; + #endif + reflectedLight.indirectSpecular += indirectSpecular; + reflectedLight.indirectDiffuse += indirectDiffuse; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,r4=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor ); + material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,a4=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV ) + #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,s4=`#if defined( RE_IndirectDiffuse ) + #if defined( LAMBERT ) || defined( PHONG ) + irradiance += iblIrradiance; + #endif + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,o4=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,l4=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,c4=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + varying float vFragDepth; + varying float vIsPerspective; +#endif`,u4=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,f4=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,h4=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,d4=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,p4=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,m4=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,g4=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,v4=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,y4=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,x4=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,_4=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,b4=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,S4=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,M4=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,E4=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,T4=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,w4=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,A4=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,C4=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,R4=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,D4=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,U4=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,I4=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,L4=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + + return depth * ( far - near ) - far; + #else + return depth * ( near - far ) - near; + #endif +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + + #ifdef USE_REVERSED_DEPTH_BUFFER + return ( near * far ) / ( ( near - far ) * depth - near ); + #else + return ( near * far ) / ( ( far - near ) * depth - far ); + #endif +}`,N4=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,O4=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,P4=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,F4=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,z4=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,B4=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,k4=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #else + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #else + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #elif defined( SHADOWMAP_TYPE_BASIC ) + uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float interleavedGradientNoise( vec2 position ) { + return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) ); + } + vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) { + const float goldenAngle = 2.399963229728653; + float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) ); + float theta = float( sampleIndex ) * goldenAngle + phi; + return vec2( cos( theta ), sin( theta ) ) * r; + } + #endif + #if defined( SHADOWMAP_TYPE_PCF ) + float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float radius = shadowRadius * texelSize.x; + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + shadow = ( + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) + + texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_VSM ) + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg; + float mean = distribution.x; + float variance = distribution.y * distribution.y; + #ifdef USE_REVERSED_DEPTH_BUFFER + float hard_shadow = step( mean, shadowCoord.z ); + #else + float hard_shadow = step( shadowCoord.z, mean ); + #endif + + if ( hard_shadow == 1.0 ) { + shadow = 1.0; + } else { + variance = max( variance, 0.0000001 ); + float d = shadowCoord.z - mean; + float p_max = variance / ( variance + d * d ); + p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 ); + shadow = max( hard_shadow, p_max ); + } + } + return mix( 1.0, shadow, shadowIntensity ); + } + #else + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadowCoord.z -= shadowBias; + #else + shadowCoord.z += shadowBias; + #endif + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + float depth = texture2D( shadowMap, shadowCoord.xy ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + shadow = step( depth, shadowCoord.z ); + #else + shadow = step( shadowCoord.z, depth ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #if defined( SHADOWMAP_TYPE_PCF ) + float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 bd3D = normalize( lightToPosition ); + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + #ifdef USE_REVERSED_DEPTH_BUFFER + float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp -= shadowBias; + #else + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + #endif + float texelSize = shadowRadius / shadowMapSize.x; + vec3 absDir = abs( bd3D ); + vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 ); + tangent = normalize( cross( bd3D, tangent ) ); + vec3 bitangent = cross( bd3D, tangent ); + float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2; + vec2 sample0 = vogelDiskSample( 0, 5, phi ); + vec2 sample1 = vogelDiskSample( 1, 5, phi ); + vec2 sample2 = vogelDiskSample( 2, 5, phi ); + vec2 sample3 = vogelDiskSample( 3, 5, phi ); + vec2 sample4 = vogelDiskSample( 4, 5, phi ); + shadow = ( + texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) + + texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) ) + ) * 0.2; + } + return mix( 1.0, shadow, shadowIntensity ); + } + #elif defined( SHADOWMAP_TYPE_BASIC ) + float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + vec3 absVec = abs( lightToPosition ); + float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z ); + if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) { + float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) ); + dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + float depth = textureCube( shadowMap, bd3D ).r; + #ifdef USE_REVERSED_DEPTH_BUFFER + depth = 1.0 - depth; + #endif + shadow = step( dp, depth ); + } + return mix( 1.0, shadow, shadowIntensity ); + } + #endif + #endif +#endif`,G4=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,H4=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,V4=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) ) + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,j4=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,W4=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,X4=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,q4=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,Y4=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,Z4=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,K4=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,Q4=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,J4=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,$4=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,eL=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,tL=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,nL=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,iL=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const rL=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,aL=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,sL=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,oL=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,lL=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,cL=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,uL=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,fL=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + #ifdef USE_REVERSED_DEPTH_BUFFER + float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ]; + #else + float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5; + #endif + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,hL=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,dL=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 ); +}`,pL=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,mL=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,gL=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,vL=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,yL=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,xL=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,_L=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,bL=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,SL=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,ML=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,EL=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,TL=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,wL=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,AL=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,CL=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,RL=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + + outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect; + + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,DL=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,UL=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,IL=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,LL=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,NL=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,OL=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include + #include +}`,PL=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,FL=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,wn={alphahash_fragment:aI,alphahash_pars_fragment:sI,alphamap_fragment:oI,alphamap_pars_fragment:lI,alphatest_fragment:cI,alphatest_pars_fragment:uI,aomap_fragment:fI,aomap_pars_fragment:hI,batching_pars_vertex:dI,batching_vertex:pI,begin_vertex:mI,beginnormal_vertex:gI,bsdfs:vI,iridescence_fragment:yI,bumpmap_pars_fragment:xI,clipping_planes_fragment:_I,clipping_planes_pars_fragment:bI,clipping_planes_pars_vertex:SI,clipping_planes_vertex:MI,color_fragment:EI,color_pars_fragment:TI,color_pars_vertex:wI,color_vertex:AI,common:CI,cube_uv_reflection_fragment:RI,defaultnormal_vertex:DI,displacementmap_pars_vertex:UI,displacementmap_vertex:II,emissivemap_fragment:LI,emissivemap_pars_fragment:NI,colorspace_fragment:OI,colorspace_pars_fragment:PI,envmap_fragment:FI,envmap_common_pars_fragment:zI,envmap_pars_fragment:BI,envmap_pars_vertex:kI,envmap_physical_pars_fragment:QI,envmap_vertex:GI,fog_vertex:HI,fog_pars_vertex:VI,fog_fragment:jI,fog_pars_fragment:WI,gradientmap_pars_fragment:XI,lightmap_pars_fragment:qI,lights_lambert_fragment:YI,lights_lambert_pars_fragment:ZI,lights_pars_begin:KI,lights_toon_fragment:JI,lights_toon_pars_fragment:$I,lights_phong_fragment:e4,lights_phong_pars_fragment:t4,lights_physical_fragment:n4,lights_physical_pars_fragment:i4,lights_fragment_begin:r4,lights_fragment_maps:a4,lights_fragment_end:s4,logdepthbuf_fragment:o4,logdepthbuf_pars_fragment:l4,logdepthbuf_pars_vertex:c4,logdepthbuf_vertex:u4,map_fragment:f4,map_pars_fragment:h4,map_particle_fragment:d4,map_particle_pars_fragment:p4,metalnessmap_fragment:m4,metalnessmap_pars_fragment:g4,morphinstance_vertex:v4,morphcolor_vertex:y4,morphnormal_vertex:x4,morphtarget_pars_vertex:_4,morphtarget_vertex:b4,normal_fragment_begin:S4,normal_fragment_maps:M4,normal_pars_fragment:E4,normal_pars_vertex:T4,normal_vertex:w4,normalmap_pars_fragment:A4,clearcoat_normal_fragment_begin:C4,clearcoat_normal_fragment_maps:R4,clearcoat_pars_fragment:D4,iridescence_pars_fragment:U4,opaque_fragment:I4,packing:L4,premultiplied_alpha_fragment:N4,project_vertex:O4,dithering_fragment:P4,dithering_pars_fragment:F4,roughnessmap_fragment:z4,roughnessmap_pars_fragment:B4,shadowmap_pars_fragment:k4,shadowmap_pars_vertex:G4,shadowmap_vertex:H4,shadowmask_pars_fragment:V4,skinbase_vertex:j4,skinning_pars_vertex:W4,skinning_vertex:X4,skinnormal_vertex:q4,specularmap_fragment:Y4,specularmap_pars_fragment:Z4,tonemapping_fragment:K4,tonemapping_pars_fragment:Q4,transmission_fragment:J4,transmission_pars_fragment:$4,uv_pars_fragment:eL,uv_pars_vertex:tL,uv_vertex:nL,worldpos_vertex:iL,background_vert:rL,background_frag:aL,backgroundCube_vert:sL,backgroundCube_frag:oL,cube_vert:lL,cube_frag:cL,depth_vert:uL,depth_frag:fL,distance_vert:hL,distance_frag:dL,equirect_vert:pL,equirect_frag:mL,linedashed_vert:gL,linedashed_frag:vL,meshbasic_vert:yL,meshbasic_frag:xL,meshlambert_vert:_L,meshlambert_frag:bL,meshmatcap_vert:SL,meshmatcap_frag:ML,meshnormal_vert:EL,meshnormal_frag:TL,meshphong_vert:wL,meshphong_frag:AL,meshphysical_vert:CL,meshphysical_frag:RL,meshtoon_vert:DL,meshtoon_frag:UL,points_vert:IL,points_frag:LL,shadow_vert:NL,shadow_frag:OL,sprite_vert:PL,sprite_frag:FL},Ht={common:{diffuse:{value:new kt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new _n},alphaMap:{value:null},alphaMapTransform:{value:new _n},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new _n}},envmap:{envMap:{value:null},envMapRotation:{value:new _n},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new _n}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new _n}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new _n},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new _n},normalScale:{value:new pt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new _n},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new _n}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new _n}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new _n}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new kt(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}},points:{diffuse:{value:new kt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new _n},alphaTest:{value:0},uvTransform:{value:new _n}},sprite:{diffuse:{value:new kt(16777215)},opacity:{value:1},center:{value:new pt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new _n},alphaMap:{value:null},alphaMapTransform:{value:new _n},alphaTest:{value:0}}},No={basic:{uniforms:Fa([Ht.common,Ht.specularmap,Ht.envmap,Ht.aomap,Ht.lightmap,Ht.fog]),vertexShader:wn.meshbasic_vert,fragmentShader:wn.meshbasic_frag},lambert:{uniforms:Fa([Ht.common,Ht.specularmap,Ht.envmap,Ht.aomap,Ht.lightmap,Ht.emissivemap,Ht.bumpmap,Ht.normalmap,Ht.displacementmap,Ht.fog,Ht.lights,{emissive:{value:new kt(0)},envMapIntensity:{value:1}}]),vertexShader:wn.meshlambert_vert,fragmentShader:wn.meshlambert_frag},phong:{uniforms:Fa([Ht.common,Ht.specularmap,Ht.envmap,Ht.aomap,Ht.lightmap,Ht.emissivemap,Ht.bumpmap,Ht.normalmap,Ht.displacementmap,Ht.fog,Ht.lights,{emissive:{value:new kt(0)},specular:{value:new kt(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:wn.meshphong_vert,fragmentShader:wn.meshphong_frag},standard:{uniforms:Fa([Ht.common,Ht.envmap,Ht.aomap,Ht.lightmap,Ht.emissivemap,Ht.bumpmap,Ht.normalmap,Ht.displacementmap,Ht.roughnessmap,Ht.metalnessmap,Ht.fog,Ht.lights,{emissive:{value:new kt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:wn.meshphysical_vert,fragmentShader:wn.meshphysical_frag},toon:{uniforms:Fa([Ht.common,Ht.aomap,Ht.lightmap,Ht.emissivemap,Ht.bumpmap,Ht.normalmap,Ht.displacementmap,Ht.gradientmap,Ht.fog,Ht.lights,{emissive:{value:new kt(0)}}]),vertexShader:wn.meshtoon_vert,fragmentShader:wn.meshtoon_frag},matcap:{uniforms:Fa([Ht.common,Ht.bumpmap,Ht.normalmap,Ht.displacementmap,Ht.fog,{matcap:{value:null}}]),vertexShader:wn.meshmatcap_vert,fragmentShader:wn.meshmatcap_frag},points:{uniforms:Fa([Ht.points,Ht.fog]),vertexShader:wn.points_vert,fragmentShader:wn.points_frag},dashed:{uniforms:Fa([Ht.common,Ht.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:wn.linedashed_vert,fragmentShader:wn.linedashed_frag},depth:{uniforms:Fa([Ht.common,Ht.displacementmap]),vertexShader:wn.depth_vert,fragmentShader:wn.depth_frag},normal:{uniforms:Fa([Ht.common,Ht.bumpmap,Ht.normalmap,Ht.displacementmap,{opacity:{value:1}}]),vertexShader:wn.meshnormal_vert,fragmentShader:wn.meshnormal_frag},sprite:{uniforms:Fa([Ht.sprite,Ht.fog]),vertexShader:wn.sprite_vert,fragmentShader:wn.sprite_frag},background:{uniforms:{uvTransform:{value:new _n},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:wn.background_vert,fragmentShader:wn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new _n}},vertexShader:wn.backgroundCube_vert,fragmentShader:wn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:wn.cube_vert,fragmentShader:wn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:wn.equirect_vert,fragmentShader:wn.equirect_frag},distance:{uniforms:Fa([Ht.common,Ht.displacementmap,{referencePosition:{value:new se},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:wn.distance_vert,fragmentShader:wn.distance_frag},shadow:{uniforms:Fa([Ht.lights,Ht.fog,{color:{value:new kt(0)},opacity:{value:1}}]),vertexShader:wn.shadow_vert,fragmentShader:wn.shadow_frag}};No.physical={uniforms:Fa([No.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new _n},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new _n},clearcoatNormalScale:{value:new pt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new _n},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new _n},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new _n},sheen:{value:0},sheenColor:{value:new kt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new _n},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new _n},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new _n},transmissionSamplerSize:{value:new pt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new _n},attenuationDistance:{value:0},attenuationColor:{value:new kt(0)},specularColor:{value:new kt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new _n},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new _n},anisotropyVector:{value:new pt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new _n}}]),vertexShader:wn.meshphysical_vert,fragmentShader:wn.meshphysical_frag};const $v={r:0,b:0,g:0},Cf=new As,zL=new dn;function BL(s,e,t,n,i,a){const c=new kt(0);let f=i===!0?0:1,h,p,m=null,y=0,x=null;function _(R){let I=R.isScene===!0?R.background:null;if(I&&I.isTexture){const L=R.backgroundBlurriness>0;I=e.get(I,L)}return I}function S(R){let I=!1;const L=_(R);L===null?T(c,f):L&&L.isColor&&(T(L,1),I=!0);const F=s.xr.getEnvironmentBlendMode();F==="additive"?t.buffers.color.setClear(0,0,0,1,a):F==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,a),(s.autoClear||I)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil))}function C(R,I){const L=_(I);L&&(L.isCubeTexture||L.mapping===jd)?(p===void 0&&(p=new Si(new Uu(1,1,1),new Vr({name:"BackgroundCubeMaterial",uniforms:Bd(No.backgroundCube.uniforms),vertexShader:No.backgroundCube.vertexShader,fragmentShader:No.backgroundCube.fragmentShader,side:ba,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),p.geometry.deleteAttribute("normal"),p.geometry.deleteAttribute("uv"),p.onBeforeRender=function(F,P,z){this.matrixWorld.copyPosition(z.matrixWorld)},Object.defineProperty(p.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(p)),Cf.copy(I.backgroundRotation),Cf.x*=-1,Cf.y*=-1,Cf.z*=-1,L.isCubeTexture&&L.isRenderTargetTexture===!1&&(Cf.y*=-1,Cf.z*=-1),p.material.uniforms.envMap.value=L,p.material.uniforms.flipEnvMap.value=L.isCubeTexture&&L.isRenderTargetTexture===!1?-1:1,p.material.uniforms.backgroundBlurriness.value=I.backgroundBlurriness,p.material.uniforms.backgroundIntensity.value=I.backgroundIntensity,p.material.uniforms.backgroundRotation.value.setFromMatrix4(zL.makeRotationFromEuler(Cf)),p.material.toneMapped=Zn.getTransfer(L.colorSpace)!==hi,(m!==L||y!==L.version||x!==s.toneMapping)&&(p.material.needsUpdate=!0,m=L,y=L.version,x=s.toneMapping),p.layers.enableAll(),R.unshift(p,p.geometry,p.material,0,0,null)):L&&L.isTexture&&(h===void 0&&(h=new Si(new Cs(2,2),new Vr({name:"BackgroundMaterial",uniforms:Bd(No.background.uniforms),vertexShader:No.background.vertexShader,fragmentShader:No.background.fragmentShader,side:Ec,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(h)),h.material.uniforms.t2D.value=L,h.material.uniforms.backgroundIntensity.value=I.backgroundIntensity,h.material.toneMapped=Zn.getTransfer(L.colorSpace)!==hi,L.matrixAutoUpdate===!0&&L.updateMatrix(),h.material.uniforms.uvTransform.value.copy(L.matrix),(m!==L||y!==L.version||x!==s.toneMapping)&&(h.material.needsUpdate=!0,m=L,y=L.version,x=s.toneMapping),h.layers.enableAll(),R.unshift(h,h.geometry,h.material,0,0,null))}function T(R,I){R.getRGB($v,Qw(s)),t.buffers.color.setClear($v.r,$v.g,$v.b,I,a)}function E(){p!==void 0&&(p.geometry.dispose(),p.material.dispose(),p=void 0),h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}return{getClearColor:function(){return c},setClearColor:function(R,I=1){c.set(R),f=I,T(c,f)},getClearAlpha:function(){return f},setClearAlpha:function(R){f=R,T(c,f)},render:S,addToRenderList:C,dispose:E}}function kL(s,e){const t=s.getParameter(s.MAX_VERTEX_ATTRIBS),n={},i=x(null);let a=i,c=!1;function f(q,Y,K,$,ie){let X=!1;const te=y(q,$,K,Y);a!==te&&(a=te,p(a.object)),X=_(q,$,K,ie),X&&S(q,$,K,ie),ie!==null&&e.update(ie,s.ELEMENT_ARRAY_BUFFER),(X||c)&&(c=!1,L(q,Y,K,$),ie!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e.get(ie).buffer))}function h(){return s.createVertexArray()}function p(q){return s.bindVertexArray(q)}function m(q){return s.deleteVertexArray(q)}function y(q,Y,K,$){const ie=$.wireframe===!0;let X=n[Y.id];X===void 0&&(X={},n[Y.id]=X);const te=q.isInstancedMesh===!0?q.id:0;let ge=X[te];ge===void 0&&(ge={},X[te]=ge);let ce=ge[K.id];ce===void 0&&(ce={},ge[K.id]=ce);let fe=ce[ie];return fe===void 0&&(fe=x(h()),ce[ie]=fe),fe}function x(q){const Y=[],K=[],$=[];for(let ie=0;ie=0){const G=ie[ce];let Z=X[ce];if(Z===void 0&&(ce==="instanceMatrix"&&q.instanceMatrix&&(Z=q.instanceMatrix),ce==="instanceColor"&&q.instanceColor&&(Z=q.instanceColor)),G===void 0||G.attribute!==Z||Z&&G.data!==Z.data)return!0;te++}return a.attributesNum!==te||a.index!==$}function S(q,Y,K,$){const ie={},X=Y.attributes;let te=0;const ge=K.getAttributes();for(const ce in ge)if(ge[ce].location>=0){let G=X[ce];G===void 0&&(ce==="instanceMatrix"&&q.instanceMatrix&&(G=q.instanceMatrix),ce==="instanceColor"&&q.instanceColor&&(G=q.instanceColor));const Z={};Z.attribute=G,G&&G.data&&(Z.data=G.data),ie[ce]=Z,te++}a.attributes=ie,a.attributesNum=te,a.index=$}function C(){const q=a.newAttributes;for(let Y=0,K=q.length;Y=0){let fe=ie[ge];if(fe===void 0&&(ge==="instanceMatrix"&&q.instanceMatrix&&(fe=q.instanceMatrix),ge==="instanceColor"&&q.instanceColor&&(fe=q.instanceColor)),fe!==void 0){const G=fe.normalized,Z=fe.itemSize,oe=e.get(fe);if(oe===void 0)continue;const he=oe.buffer,xe=oe.type,ae=oe.bytesPerElement,de=xe===s.INT||xe===s.UNSIGNED_INT||fe.gpuType===x0;if(fe.isInterleavedBufferAttribute){const me=fe.data,Ge=me.stride,ct=fe.offset;if(me.isInstancedInterleavedBuffer){for(let Qe=0;Qe0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return"highp";z="mediump"}return z==="mediump"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let p=t.precision!==void 0?t.precision:"highp";const m=h(p);m!==p&&(Bt("WebGLRenderer:",p,"not supported, using",m,"instead."),p=m);const y=t.logarithmicDepthBuffer===!0,x=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),_=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),S=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),C=s.getParameter(s.MAX_TEXTURE_SIZE),T=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),E=s.getParameter(s.MAX_VERTEX_ATTRIBS),R=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),I=s.getParameter(s.MAX_VARYING_VECTORS),L=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),F=s.getParameter(s.MAX_SAMPLES),P=s.getParameter(s.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:h,textureFormatReadable:c,textureTypeReadable:f,precision:p,logarithmicDepthBuffer:y,reversedDepthBuffer:x,maxTextures:_,maxVertexTextures:S,maxTextureSize:C,maxCubemapSize:T,maxAttributes:E,maxVertexUniforms:R,maxVaryings:I,maxFragmentUniforms:L,maxSamples:F,samples:P}}function VL(s){const e=this;let t=null,n=0,i=!1,a=!1;const c=new _c,f=new _n,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(y,x){const _=y.length!==0||x||n!==0||i;return i=x,n=y.length,_},this.beginShadows=function(){a=!0,m(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(y,x){t=m(y,x,0)},this.setState=function(y,x,_){const S=y.clippingPlanes,C=y.clipIntersection,T=y.clipShadows,E=s.get(y);if(!i||S===null||S.length===0||a&&!T)a?m(null):p();else{const R=a?0:n,I=R*4;let L=E.clippingState||null;h.value=L,L=m(S,x,I,_);for(let F=0;F!==I;++F)L[F]=t[F];E.clippingState=L,this.numIntersection=C?this.numPlanes:0,this.numPlanes+=R}};function p(){h.value!==t&&(h.value=t,h.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function m(y,x,_,S){const C=y!==null?y.length:0;let T=null;if(C!==0){if(T=h.value,S!==!0||T===null){const E=_+C*4,R=x.matrixWorldInverse;f.getNormalMatrix(R),(T===null||T.length0&&this._blur(h,0,0,t),this._applyPMREM(h),this._cleanup(h),h}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=IE(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=UE(),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;e2?F:0,F,F),y.setRenderTarget(i),E&&y.render(C,h),y.render(e,h)}y.toneMapping=_,y.autoClear=x,e.background=R}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Fo||e.mapping===wu;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=IE()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=UE());const a=i?this._cubemapMaterial:this._equirectMaterial,c=this._lodMeshes[0];c.material=a;const f=a.uniforms;f.envMap.value=e;const h=this._cubeSize;bd(t,0,0,3*h,2*h),n.setRenderTarget(t),n.render(c,Am)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let a=1;aS-Mu?n-S+Mu:0),E=4*(this._cubeSize-C);h.envMap.value=e.texture,h.roughness.value=_,h.mipInt.value=S-t,bd(a,T,E,3*C,2*C),i.setRenderTarget(a),i.render(f,Am),h.envMap.value=a.texture,h.roughness.value=0,h.mipInt.value=S-n,bd(e,T,E,3*C,2*C),i.setRenderTarget(e),i.render(f,Am)}_blur(e,t,n,i,a){const c=this._pingPongRenderTarget;this._halfBlur(e,c,t,n,i,"latitudinal",a),this._halfBlur(c,e,n,n,i,"longitudinal",a)}_halfBlur(e,t,n,i,a,c,f){const h=this._renderer,p=this._blurMaterial;c!=="latitudinal"&&c!=="longitudinal"&&$t("blur direction must be either latitudinal or longitudinal!");const m=3,y=this._lodMeshes[i];y.material=p;const x=p.uniforms,_=this._sizeLods[n]-1,S=isFinite(a)?Math.PI/(2*_):2*Math.PI/(2*Nf-1),C=a/S,T=isFinite(a)?1+Math.floor(m*C):Nf;T>Nf&&Bt(`sigmaRadians, ${a}, is too large and will clip, as it requested ${T} samples when the maximum is set to ${Nf}`);const E=[];let R=0;for(let z=0;zI-Mu?i-I+Mu:0),P=4*(this._cubeSize-L);bd(t,F,P,3*L,2*L),h.setRenderTarget(t),h.render(y,Am)}}function XL(s){const e=[],t=[],n=[];let i=s;const a=s-Mu+1+CE.length;for(let c=0;cs-Mu?h=CE[c-s+Mu-1]:c===0&&(h=0),t.push(h);const p=1/(f-2),m=-p,y=1+p,x=[m,m,y,m,y,y,m,m,y,y,m,y],_=6,S=6,C=3,T=2,E=1,R=new Float32Array(C*S*_),I=new Float32Array(T*S*_),L=new Float32Array(E*S*_);for(let P=0;P<_;P++){const z=P%3*2/3-1,U=P>2?0:-1,O=[z,U,0,z+2/3,U,0,z+2/3,U+1,0,z,U,0,z+2/3,U+1,0,z,U+1,0];R.set(O,C*S*P),I.set(x,T*S*P);const W=[P,P,P,P,P,P];L.set(W,E*S*P)}const F=new bn;F.setAttribute("position",new bi(R,C)),F.setAttribute("uv",new bi(I,T)),F.setAttribute("faceIndex",new bi(L,E)),n.push(new Si(F,null)),i>Mu&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function DE(s,e,t){const n=new ka(s,e,t);return n.texture.mapping=jd,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function bd(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function qL(s,e,t){return new Vr({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:jL,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Qx(),fragmentShader:` + + precision highp float; + precision highp int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform float roughness; + uniform float mipInt; + + #define ENVMAP_TYPE_CUBE_UV + #include + + #define PI 3.14159265359 + + // Van der Corput radical inverse + float radicalInverse_VdC(uint bits) { + bits = (bits << 16u) | (bits >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + return float(bits) * 2.3283064365386963e-10; // / 0x100000000 + } + + // Hammersley sequence + vec2 hammersley(uint i, uint N) { + return vec2(float(i) / float(N), radicalInverse_VdC(i)); + } + + // GGX VNDF importance sampling (Eric Heitz 2018) + // "Sampling the GGX Distribution of Visible Normals" + // https://jcgt.org/published/0007/04/01/ + vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { + float alpha = roughness * roughness; + + // Section 4.1: Orthonormal basis + vec3 T1 = vec3(1.0, 0.0, 0.0); + vec3 T2 = cross(V, T1); + + // Section 4.2: Parameterization of projected area + float r = sqrt(Xi.x); + float phi = 2.0 * PI * Xi.y; + float t1 = r * cos(phi); + float t2 = r * sin(phi); + float s = 0.5 * (1.0 + V.z); + t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; + + // Section 4.3: Reprojection onto hemisphere + vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; + + // Section 3.4: Transform back to ellipsoid configuration + return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); + } + + void main() { + vec3 N = normalize(vOutputDirection); + vec3 V = N; // Assume view direction equals normal for pre-filtering + + vec3 prefilteredColor = vec3(0.0); + float totalWeight = 0.0; + + // For very low roughness, just sample the environment directly + if (roughness < 0.001) { + gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); + return; + } + + // Tangent space basis for VNDF sampling + vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangent = normalize(cross(up, N)); + vec3 bitangent = cross(N, tangent); + + for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { + vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); + + // For PMREM, V = N, so in tangent space V is always (0, 0, 1) + vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); + + // Transform H back to world space + vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); + vec3 L = normalize(2.0 * dot(V, H) * H - V); + + float NdotL = max(dot(N, L), 0.0); + + if(NdotL > 0.0) { + // Sample environment at fixed mip level + // VNDF importance sampling handles the distribution filtering + vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); + + // Weight by NdotL for the split-sum approximation + // VNDF PDF naturally accounts for the visible microfacet distribution + prefilteredColor += sampleColor * NdotL; + totalWeight += NdotL; + } + } + + if (totalWeight > 0.0) { + prefilteredColor = prefilteredColor / totalWeight; + } + + gl_FragColor = vec4(prefilteredColor, 1.0); + } + `,blending:Po,depthTest:!1,depthWrite:!1})}function YL(s,e,t){const n=new Float32Array(Nf),i=new se(0,1,0);return new Vr({name:"SphericalGaussianBlur",defines:{n:Nf,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:Qx(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:Po,depthTest:!1,depthWrite:!1})}function UE(){return new Vr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Qx(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:Po,depthTest:!1,depthWrite:!1})}function IE(){return new Vr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Qx(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:Po,depthTest:!1,depthWrite:!1})}function Qx(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}class Jx extends ka{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new M0(i),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;const n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},i=new Uu(5,5,5),a=new Vr({name:"CubemapFromEquirect",uniforms:Bd(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:ba,blending:Po});a.uniforms.tEquirect.value=t;const c=new Si(i,a),f=t.minFilter;return t.minFilter===Al&&(t.minFilter=Wn),new _A(1,10,this).update(e,c),t.minFilter=f,c.geometry.dispose(),c.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const a=e.getRenderTarget();for(let c=0;c<6;c++)e.setRenderTarget(this,c),e.clear(t,n,i);e.setRenderTarget(a)}}function ZL(s){let e=new WeakMap,t=new WeakMap,n=null;function i(x,_=!1){return x==null?null:_?c(x):a(x)}function a(x){if(x&&x.isTexture){const _=x.mapping;if(_===Dd||_===zm)if(e.has(x)){const S=e.get(x).texture;return f(S,x.mapping)}else{const S=x.image;if(S&&S.height>0){const C=new Jx(S.height);return C.fromEquirectangularTexture(s,x),e.set(x,C),x.addEventListener("dispose",p),f(C.texture,x.mapping)}else return null}}return x}function c(x){if(x&&x.isTexture){const _=x.mapping,S=_===Dd||_===zm,C=_===Fo||_===wu;if(S||C){let T=t.get(x);const E=T!==void 0?T.texture.pmremVersion:0;if(x.isRenderTargetTexture&&x.pmremVersion!==E)return n===null&&(n=new ob(s)),T=S?n.fromEquirectangular(x,T):n.fromCubemap(x,T),T.texture.pmremVersion=x.pmremVersion,t.set(x,T),T.texture;if(T!==void 0)return T.texture;{const R=x.image;return S&&R&&R.height>0||C&&R&&h(R)?(n===null&&(n=new ob(s)),T=S?n.fromEquirectangular(x):n.fromCubemap(x),T.texture.pmremVersion=x.pmremVersion,t.set(x,T),x.addEventListener("dispose",m),T.texture):null}}}return x}function f(x,_){return _===Dd?x.mapping=Fo:_===zm&&(x.mapping=wu),x}function h(x){let _=0;const S=6;for(let C=0;C=65535?zb:Fb)(x,1);T.version=C;const E=a.get(y);E&&e.remove(E),a.set(y,T)}function m(y){const x=a.get(y);if(x){const _=y.index;_!==null&&x.version<_.version&&p(y)}else p(y);return a.get(y)}return{get:f,update:h,getWireframeAttribute:m}}function JL(s,e,t){let n;function i(x){n=x}let a,c;function f(x){a=x.type,c=x.bytesPerElement}function h(x,_){s.drawElements(n,_,a,x*c),t.update(_,n,1)}function p(x,_,S){S!==0&&(s.drawElementsInstanced(n,_,a,x*c,S),t.update(_,n,S))}function m(x,_,S){if(S===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,_,0,a,x,0,S);let T=0;for(let E=0;Ee.maxTextureSize&&(P=Math.ceil(F/e.maxTextureSize),F=e.maxTextureSize);const z=new Float32Array(F*P*4*y),U=new Tx(z,F,P,y);U.type=Vi,U.needsUpdate=!0;const O=L*4;for(let q=0;q + #include + + void main() { + gl_FragColor = texture2D( tDiffuse, vUv ); + + #ifdef LINEAR_TONE_MAPPING + gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); + #elif defined( REINHARD_TONE_MAPPING ) + gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); + #elif defined( CINEON_TONE_MAPPING ) + gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); + #elif defined( ACES_FILMIC_TONE_MAPPING ) + gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); + #elif defined( AGX_TONE_MAPPING ) + gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); + #elif defined( NEUTRAL_TONE_MAPPING ) + gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); + #elif defined( CUSTOM_TONE_MAPPING ) + gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); + #endif + + #ifdef SRGB_TRANSFER + gl_FragColor = sRGBTransferOETF( gl_FragColor ); + #endif + }`,depthTest:!1,depthWrite:!1}),p=new Si(f,h),m=new Rl(-1,1,1,-1,0,1);let y=null,x=null,_=!1,S,C=null,T=[],E=!1;this.setSize=function(R,I){a.setSize(R,I),c.setSize(R,I);for(let L=0;L0&&T[0].isRenderPass===!0;const I=a.width,L=a.height;for(let F=0;F0)return s;const i=e*t;let a=LE[i];if(a===void 0&&(a=new Float32Array(i),LE[i]=a),e!==0){n.toArray(a,0);for(let c=1,f=0;c!==e;++c)f+=t,s[c].toArray(a,f)}return a}function Rr(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t0&&(this.seq=i.concat(a))}setValue(e,t,n,i){const a=this.map[t];a!==void 0&&a.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let a=0,c=t.length;a!==c;++a){const f=t[a],h=n[f.id];h.needsUpdate!==!1&&f.setValue(e,h.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,a=e.length;i!==a;++i){const c=e[i];c.id in t&&n.push(c)}return n}}function BE(s,e,t){const n=s.createShader(e);return s.shaderSource(n,t),s.compileShader(n),n}const YN=37297;let ZN=0;function KN(s,e){const t=s.split(` +`),n=[],i=Math.max(e-6,0),a=Math.min(e+6,t.length);for(let c=i;c":" "} ${f}: ${t[c]}`)}return n.join(` +`)}const kE=new _n;function QN(s){Zn._getMatrix(kE,Zn.workingColorSpace,s);const e=`mat3( ${kE.elements.map(t=>t.toFixed(4))} )`;switch(Zn.getTransfer(s)){case n0:return[e,"LinearTransferOETF"];case hi:return[e,"sRGBTransferOETF"];default:return Bt("WebGLProgram: Unsupported color space: ",s),[e,"LinearTransferOETF"]}}function GE(s,e,t){const n=s.getShaderParameter(e,s.COMPILE_STATUS),a=(s.getShaderInfoLog(e)||"").trim();if(n&&a==="")return"";const c=/ERROR: 0:(\d+)/.exec(a);if(c){const f=parseInt(c[1]);return t.toUpperCase()+` + +`+a+` + +`+KN(s.getShaderSource(e),f)}else return a}function JN(s,e){const t=QN(e);return[`vec4 ${s}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` +`)}const $N={[Mb]:"Linear",[Eb]:"Reinhard",[Tb]:"Cineon",[mx]:"ACESFilmic",[Ab]:"AgX",[Cb]:"Neutral",[wb]:"Custom"};function eO(s,e){const t=$N[e];return t===void 0?(Bt("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+s+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const ey=new se;function tO(){Zn.getLuminanceCoefficients(ey);const s=ey.x.toFixed(4),e=ey.y.toFixed(4),t=ey.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${s}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` +`)}function nO(s){return[s.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",s.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Om).join(` +`)}function iO(s){const e=[];for(const t in s){const n=s[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` +`)}function rO(s,e){const t={},n=s.getProgramParameter(e,s.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function cb(s){return s.replace(aO,oO)}const sO=new Map;function oO(s,e){let t=wn[e];if(t===void 0){const n=sO.get(e);if(n!==void 0)t=wn[n],Bt('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return cb(t)}const lO=/#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 jE(s){return s.replace(lO,cO)}function cO(s,e,t,n){let i="";for(let a=parseInt(e);a0&&(T+=` +`),E=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S].filter(Om).join(` +`),E.length>0&&(E+=` +`)):(T=[WE(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S,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 "+m:"",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.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 "+h:"",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",` +`].filter(Om).join(` +`),E=[WE(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,S,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 "+p:"",t.envMap?"#define "+m:"",t.envMap?"#define "+y:"",x?"#define CUBEUV_TEXEL_WIDTH "+x.texelWidth:"",x?"#define CUBEUV_TEXEL_HEIGHT "+x.texelHeight:"",x?"#define CUBEUV_MAX_MIP "+x.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.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 "+h:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",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!==oo?"#define TONE_MAPPING":"",t.toneMapping!==oo?wn.tonemapping_pars_fragment:"",t.toneMapping!==oo?eO("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",wn.colorspace_pars_fragment,JN("linearToOutputTexel",t.outputColorSpace),tO(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Om).join(` +`)),c=cb(c),c=HE(c,t),c=VE(c,t),f=cb(f),f=HE(f,t),f=VE(f,t),c=jE(c),f=jE(f),t.isRawShaderMaterial!==!0&&(R=`#version 300 es +`,T=[_,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+T,E=["#define varying in",t.glslVersion===$_?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===$_?"":"#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(` +`)+` +`+E);const I=R+T+c,L=R+E+f,F=BE(i,i.VERTEX_SHADER,I),P=BE(i,i.FRAGMENT_SHADER,L);i.attachShader(C,F),i.attachShader(C,P),t.index0AttributeName!==void 0?i.bindAttribLocation(C,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(C,0,"position"),i.linkProgram(C);function z(q){if(s.debug.checkShaderErrors){const Y=i.getProgramInfoLog(C)||"",K=i.getShaderInfoLog(F)||"",$=i.getShaderInfoLog(P)||"",ie=Y.trim(),X=K.trim(),te=$.trim();let ge=!0,ce=!0;if(i.getProgramParameter(C,i.LINK_STATUS)===!1)if(ge=!1,typeof s.debug.onShaderError=="function")s.debug.onShaderError(i,C,F,P);else{const fe=GE(i,F,"vertex"),G=GE(i,P,"fragment");$t("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(C,i.VALIDATE_STATUS)+` + +Material Name: `+q.name+` +Material Type: `+q.type+` + +Program Info Log: `+ie+` +`+fe+` +`+G)}else ie!==""?Bt("WebGLProgram: Program Info Log:",ie):(X===""||te==="")&&(ce=!1);ce&&(q.diagnostics={runnable:ge,programLog:ie,vertexShader:{log:X,prefix:T},fragmentShader:{log:te,prefix:E}})}i.deleteShader(F),i.deleteShader(P),U=new hy(i,C),O=rO(i,C)}let U;this.getUniforms=function(){return U===void 0&&z(this),U};let O;this.getAttributes=function(){return O===void 0&&z(this),O};let W=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return W===!1&&(W=i.getProgramParameter(C,YN)),W},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(C),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=ZN++,this.cacheKey=e,this.usedTimes=1,this.program=C,this.vertexShader=F,this.fragmentShader=P,this}let _O=0;class bO{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),a=this._getShaderStage(n),c=this._getShaderCacheForMaterial(e);return c.has(i)===!1&&(c.add(i),i.usedTimes++),c.has(a)===!1&&(c.add(a),a.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new SO(e),t.set(e,n)),n}}class SO{constructor(e){this.id=_O++,this.code=e,this.usedTimes=0}}function MO(s,e,t,n,i,a){const c=new Pd,f=new bO,h=new Set,p=[],m=new Map,y=n.logarithmicDepthBuffer;let x=n.precision;const _={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 S(U){return h.add(U),U===0?"uv":`uv${U}`}function C(U,O,W,q,Y){const K=q.fog,$=Y.geometry,ie=U.isMeshStandardMaterial||U.isMeshLambertMaterial||U.isMeshPhongMaterial?q.environment:null,X=U.isMeshStandardMaterial||U.isMeshLambertMaterial&&!U.envMap||U.isMeshPhongMaterial&&!U.envMap,te=e.get(U.envMap||ie,X),ge=te&&te.mapping===jd?te.image.height:null,ce=_[U.type];U.precision!==null&&(x=n.getMaxPrecision(U.precision),x!==U.precision&&Bt("WebGLProgram.getParameters:",U.precision,"not supported, using",x,"instead."));const fe=$.morphAttributes.position||$.morphAttributes.normal||$.morphAttributes.color,G=fe!==void 0?fe.length:0;let Z=0;$.morphAttributes.position!==void 0&&(Z=1),$.morphAttributes.normal!==void 0&&(Z=2),$.morphAttributes.color!==void 0&&(Z=3);let oe,he,xe,ae;if(ce){const Gt=No[ce];oe=Gt.vertexShader,he=Gt.fragmentShader}else oe=U.vertexShader,he=U.fragmentShader,f.update(U),xe=f.getVertexShaderID(U),ae=f.getFragmentShaderID(U);const de=s.getRenderTarget(),me=s.state.buffers.depth.getReversed(),Ge=Y.isInstancedMesh===!0,ct=Y.isBatchedMesh===!0,Qe=!!U.map,$e=!!U.matcap,bt=!!te,Oe=!!U.aoMap,Ve=!!U.lightMap,Pe=!!U.bumpMap,it=!!U.normalMap,Q=!!U.displacementMap,ut=!!U.emissiveMap,qe=!!U.metalnessMap,Ne=!!U.roughnessMap,je=U.anisotropy>0,j=U.clearcoat>0,B=U.dispersion>0,ue=U.iridescence>0,ze=U.sheen>0,we=U.transmission>0,Ae=je&&!!U.anisotropyMap,Le=j&&!!U.clearcoatMap,lt=j&&!!U.clearcoatNormalMap,Tt=j&&!!U.clearcoatRoughnessMap,Rt=ue&&!!U.iridescenceMap,Xe=ue&&!!U.iridescenceThicknessMap,He=ze&&!!U.sheenColorMap,rt=ze&&!!U.sheenRoughnessMap,le=!!U.specularMap,Ie=!!U.specularColorMap,De=!!U.specularIntensityMap,re=we&&!!U.transmissionMap,pe=we&&!!U.thicknessMap,Fe=!!U.gradientMap,et=!!U.alphaMap,Re=U.alphaTest>0,Me=!!U.alphaHash,ht=!!U.extensions;let St=oo;U.toneMapped&&(de===null||de.isXRRenderTarget===!0)&&(St=s.toneMapping);const It={shaderID:ce,shaderType:U.type,shaderName:U.name,vertexShader:oe,fragmentShader:he,defines:U.defines,customVertexShaderID:xe,customFragmentShaderID:ae,isRawShaderMaterial:U.isRawShaderMaterial===!0,glslVersion:U.glslVersion,precision:x,batching:ct,batchingColor:ct&&Y._colorsTexture!==null,instancing:Ge,instancingColor:Ge&&Y.instanceColor!==null,instancingMorph:Ge&&Y.morphTexture!==null,outputColorSpace:de===null?s.outputColorSpace:de.isXRRenderTarget===!0?de.texture.colorSpace:zo,alphaToCoverage:!!U.alphaToCoverage,map:Qe,matcap:$e,envMap:bt,envMapMode:bt&&te.mapping,envMapCubeUVHeight:ge,aoMap:Oe,lightMap:Ve,bumpMap:Pe,normalMap:it,displacementMap:Q,emissiveMap:ut,normalMapObjectSpace:it&&U.normalMapType===vw,normalMapTangentSpace:it&&U.normalMapType===Du,metalnessMap:qe,roughnessMap:Ne,anisotropy:je,anisotropyMap:Ae,clearcoat:j,clearcoatMap:Le,clearcoatNormalMap:lt,clearcoatRoughnessMap:Tt,dispersion:B,iridescence:ue,iridescenceMap:Rt,iridescenceThicknessMap:Xe,sheen:ze,sheenColorMap:He,sheenRoughnessMap:rt,specularMap:le,specularColorMap:Ie,specularIntensityMap:De,transmission:we,transmissionMap:re,thicknessMap:pe,gradientMap:Fe,opaque:U.transparent===!1&&U.blending===Gf&&U.alphaToCoverage===!1,alphaMap:et,alphaTest:Re,alphaHash:Me,combine:U.combine,mapUv:Qe&&S(U.map.channel),aoMapUv:Oe&&S(U.aoMap.channel),lightMapUv:Ve&&S(U.lightMap.channel),bumpMapUv:Pe&&S(U.bumpMap.channel),normalMapUv:it&&S(U.normalMap.channel),displacementMapUv:Q&&S(U.displacementMap.channel),emissiveMapUv:ut&&S(U.emissiveMap.channel),metalnessMapUv:qe&&S(U.metalnessMap.channel),roughnessMapUv:Ne&&S(U.roughnessMap.channel),anisotropyMapUv:Ae&&S(U.anisotropyMap.channel),clearcoatMapUv:Le&&S(U.clearcoatMap.channel),clearcoatNormalMapUv:lt&&S(U.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Tt&&S(U.clearcoatRoughnessMap.channel),iridescenceMapUv:Rt&&S(U.iridescenceMap.channel),iridescenceThicknessMapUv:Xe&&S(U.iridescenceThicknessMap.channel),sheenColorMapUv:He&&S(U.sheenColorMap.channel),sheenRoughnessMapUv:rt&&S(U.sheenRoughnessMap.channel),specularMapUv:le&&S(U.specularMap.channel),specularColorMapUv:Ie&&S(U.specularColorMap.channel),specularIntensityMapUv:De&&S(U.specularIntensityMap.channel),transmissionMapUv:re&&S(U.transmissionMap.channel),thicknessMapUv:pe&&S(U.thicknessMap.channel),alphaMapUv:et&&S(U.alphaMap.channel),vertexTangents:!!$.attributes.tangent&&(it||je),vertexColors:U.vertexColors,vertexAlphas:U.vertexColors===!0&&!!$.attributes.color&&$.attributes.color.itemSize===4,pointsUvs:Y.isPoints===!0&&!!$.attributes.uv&&(Qe||et),fog:!!K,useFog:U.fog===!0,fogExp2:!!K&&K.isFogExp2,flatShading:U.wireframe===!1&&(U.flatShading===!0||$.attributes.normal===void 0&&it===!1&&(U.isMeshLambertMaterial||U.isMeshPhongMaterial||U.isMeshStandardMaterial||U.isMeshPhysicalMaterial)),sizeAttenuation:U.sizeAttenuation===!0,logarithmicDepthBuffer:y,reversedDepthBuffer:me,skinning:Y.isSkinnedMesh===!0,morphTargets:$.morphAttributes.position!==void 0,morphNormals:$.morphAttributes.normal!==void 0,morphColors:$.morphAttributes.color!==void 0,morphTargetsCount:G,morphTextureStride:Z,numDirLights:O.directional.length,numPointLights:O.point.length,numSpotLights:O.spot.length,numSpotLightMaps:O.spotLightMap.length,numRectAreaLights:O.rectArea.length,numHemiLights:O.hemi.length,numDirLightShadows:O.directionalShadowMap.length,numPointLightShadows:O.pointShadowMap.length,numSpotLightShadows:O.spotShadowMap.length,numSpotLightShadowsWithMaps:O.numSpotLightShadowsWithMaps,numLightProbes:O.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:U.dithering,shadowMapEnabled:s.shadowMap.enabled&&W.length>0,shadowMapType:s.shadowMap.type,toneMapping:St,decodeVideoTexture:Qe&&U.map.isVideoTexture===!0&&Zn.getTransfer(U.map.colorSpace)===hi,decodeVideoTextureEmissive:ut&&U.emissiveMap.isVideoTexture===!0&&Zn.getTransfer(U.emissiveMap.colorSpace)===hi,premultipliedAlpha:U.premultipliedAlpha,doubleSided:U.side===Ki,flipSided:U.side===ba,useDepthPacking:U.depthPacking>=0,depthPacking:U.depthPacking||0,index0AttributeName:U.index0AttributeName,extensionClipCullDistance:ht&&U.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ht&&U.extensions.multiDraw===!0||ct)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:U.customProgramCacheKey()};return It.vertexUv1s=h.has(1),It.vertexUv2s=h.has(2),It.vertexUv3s=h.has(3),h.clear(),It}function T(U){const O=[];if(U.shaderID?O.push(U.shaderID):(O.push(U.customVertexShaderID),O.push(U.customFragmentShaderID)),U.defines!==void 0)for(const W in U.defines)O.push(W),O.push(U.defines[W]);return U.isRawShaderMaterial===!1&&(E(O,U),R(O,U),O.push(s.outputColorSpace)),O.push(U.customProgramCacheKey),O.join()}function E(U,O){U.push(O.precision),U.push(O.outputColorSpace),U.push(O.envMapMode),U.push(O.envMapCubeUVHeight),U.push(O.mapUv),U.push(O.alphaMapUv),U.push(O.lightMapUv),U.push(O.aoMapUv),U.push(O.bumpMapUv),U.push(O.normalMapUv),U.push(O.displacementMapUv),U.push(O.emissiveMapUv),U.push(O.metalnessMapUv),U.push(O.roughnessMapUv),U.push(O.anisotropyMapUv),U.push(O.clearcoatMapUv),U.push(O.clearcoatNormalMapUv),U.push(O.clearcoatRoughnessMapUv),U.push(O.iridescenceMapUv),U.push(O.iridescenceThicknessMapUv),U.push(O.sheenColorMapUv),U.push(O.sheenRoughnessMapUv),U.push(O.specularMapUv),U.push(O.specularColorMapUv),U.push(O.specularIntensityMapUv),U.push(O.transmissionMapUv),U.push(O.thicknessMapUv),U.push(O.combine),U.push(O.fogExp2),U.push(O.sizeAttenuation),U.push(O.morphTargetsCount),U.push(O.morphAttributeCount),U.push(O.numDirLights),U.push(O.numPointLights),U.push(O.numSpotLights),U.push(O.numSpotLightMaps),U.push(O.numHemiLights),U.push(O.numRectAreaLights),U.push(O.numDirLightShadows),U.push(O.numPointLightShadows),U.push(O.numSpotLightShadows),U.push(O.numSpotLightShadowsWithMaps),U.push(O.numLightProbes),U.push(O.shadowMapType),U.push(O.toneMapping),U.push(O.numClippingPlanes),U.push(O.numClipIntersection),U.push(O.depthPacking)}function R(U,O){c.disableAll(),O.instancing&&c.enable(0),O.instancingColor&&c.enable(1),O.instancingMorph&&c.enable(2),O.matcap&&c.enable(3),O.envMap&&c.enable(4),O.normalMapObjectSpace&&c.enable(5),O.normalMapTangentSpace&&c.enable(6),O.clearcoat&&c.enable(7),O.iridescence&&c.enable(8),O.alphaTest&&c.enable(9),O.vertexColors&&c.enable(10),O.vertexAlphas&&c.enable(11),O.vertexUv1s&&c.enable(12),O.vertexUv2s&&c.enable(13),O.vertexUv3s&&c.enable(14),O.vertexTangents&&c.enable(15),O.anisotropy&&c.enable(16),O.alphaHash&&c.enable(17),O.batching&&c.enable(18),O.dispersion&&c.enable(19),O.batchingColor&&c.enable(20),O.gradientMap&&c.enable(21),U.push(c.mask),c.disableAll(),O.fog&&c.enable(0),O.useFog&&c.enable(1),O.flatShading&&c.enable(2),O.logarithmicDepthBuffer&&c.enable(3),O.reversedDepthBuffer&&c.enable(4),O.skinning&&c.enable(5),O.morphTargets&&c.enable(6),O.morphNormals&&c.enable(7),O.morphColors&&c.enable(8),O.premultipliedAlpha&&c.enable(9),O.shadowMapEnabled&&c.enable(10),O.doubleSided&&c.enable(11),O.flipSided&&c.enable(12),O.useDepthPacking&&c.enable(13),O.dithering&&c.enable(14),O.transmission&&c.enable(15),O.sheen&&c.enable(16),O.opaque&&c.enable(17),O.pointsUvs&&c.enable(18),O.decodeVideoTexture&&c.enable(19),O.decodeVideoTextureEmissive&&c.enable(20),O.alphaToCoverage&&c.enable(21),U.push(c.mask)}function I(U){const O=_[U.type];let W;if(O){const q=No[O];W=Wx.clone(q.uniforms)}else W=U.uniforms;return W}function L(U,O){let W=m.get(O);return W!==void 0?++W.usedTimes:(W=new xO(s,O,U,i),p.push(W),m.set(O,W)),W}function F(U){if(--U.usedTimes===0){const O=p.indexOf(U);p[O]=p[p.length-1],p.pop(),m.delete(U.cacheKey),U.destroy()}}function P(U){f.remove(U)}function z(){f.dispose()}return{getParameters:C,getProgramCacheKey:T,getUniforms:I,acquireProgram:L,releaseProgram:F,releaseShaderCache:P,programs:p,dispose:z}}function EO(){let s=new WeakMap;function e(c){return s.has(c)}function t(c){let f=s.get(c);return f===void 0&&(f={},s.set(c,f)),f}function n(c){s.delete(c)}function i(c,f,h){s.get(c)[f]=h}function a(){s=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:a}}function TO(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.material.id!==e.material.id?s.material.id-e.material.id:s.materialVariant!==e.materialVariant?s.materialVariant-e.materialVariant:s.z!==e.z?s.z-e.z:s.id-e.id}function XE(s,e){return s.groupOrder!==e.groupOrder?s.groupOrder-e.groupOrder:s.renderOrder!==e.renderOrder?s.renderOrder-e.renderOrder:s.z!==e.z?e.z-s.z:s.id-e.id}function qE(){const s=[];let e=0;const t=[],n=[],i=[];function a(){e=0,t.length=0,n.length=0,i.length=0}function c(x){let _=0;return x.isInstancedMesh&&(_+=2),x.isSkinnedMesh&&(_+=1),_}function f(x,_,S,C,T,E){let R=s[e];return R===void 0?(R={id:x.id,object:x,geometry:_,material:S,materialVariant:c(x),groupOrder:C,renderOrder:x.renderOrder,z:T,group:E},s[e]=R):(R.id=x.id,R.object=x,R.geometry=_,R.material=S,R.materialVariant=c(x),R.groupOrder=C,R.renderOrder=x.renderOrder,R.z=T,R.group=E),e++,R}function h(x,_,S,C,T,E){const R=f(x,_,S,C,T,E);S.transmission>0?n.push(R):S.transparent===!0?i.push(R):t.push(R)}function p(x,_,S,C,T,E){const R=f(x,_,S,C,T,E);S.transmission>0?n.unshift(R):S.transparent===!0?i.unshift(R):t.unshift(R)}function m(x,_){t.length>1&&t.sort(x||TO),n.length>1&&n.sort(_||XE),i.length>1&&i.sort(_||XE)}function y(){for(let x=e,_=s.length;x<_;x++){const S=s[x];if(S.id===null)break;S.id=null,S.object=null,S.geometry=null,S.material=null,S.group=null}}return{opaque:t,transmissive:n,transparent:i,init:a,push:h,unshift:p,finish:y,sort:m}}function wO(){let s=new WeakMap;function e(n,i){const a=s.get(n);let c;return a===void 0?(c=new qE,s.set(n,[c])):i>=a.length?(c=new qE,a.push(c)):c=a[i],c}function t(){s=new WeakMap}return{get:e,dispose:t}}function AO(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new se,color:new kt};break;case"SpotLight":t={position:new se,direction:new se,color:new kt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new se,color:new kt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new se,skyColor:new kt,groundColor:new kt};break;case"RectAreaLight":t={color:new kt,position:new se,halfWidth:new se,halfHeight:new se};break}return s[e.id]=t,t}}}function CO(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pt};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pt};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pt,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}let RO=0;function DO(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function UO(s){const e=new AO,t=CO(),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 p=0;p<9;p++)n.probe.push(new se);const i=new se,a=new dn,c=new dn;function f(p){let m=0,y=0,x=0;for(let O=0;O<9;O++)n.probe[O].set(0,0,0);let _=0,S=0,C=0,T=0,E=0,R=0,I=0,L=0,F=0,P=0,z=0;p.sort(DO);for(let O=0,W=p.length;O0&&(s.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ht.LTC_FLOAT_1,n.rectAreaLTC2=Ht.LTC_FLOAT_2):(n.rectAreaLTC1=Ht.LTC_HALF_1,n.rectAreaLTC2=Ht.LTC_HALF_2)),n.ambient[0]=m,n.ambient[1]=y,n.ambient[2]=x;const U=n.hash;(U.directionalLength!==_||U.pointLength!==S||U.spotLength!==C||U.rectAreaLength!==T||U.hemiLength!==E||U.numDirectionalShadows!==R||U.numPointShadows!==I||U.numSpotShadows!==L||U.numSpotMaps!==F||U.numLightProbes!==z)&&(n.directional.length=_,n.spot.length=C,n.rectArea.length=T,n.point.length=S,n.hemi.length=E,n.directionalShadow.length=R,n.directionalShadowMap.length=R,n.pointShadow.length=I,n.pointShadowMap.length=I,n.spotShadow.length=L,n.spotShadowMap.length=L,n.directionalShadowMatrix.length=R,n.pointShadowMatrix.length=I,n.spotLightMatrix.length=L+F-P,n.spotLightMap.length=F,n.numSpotLightShadowsWithMaps=P,n.numLightProbes=z,U.directionalLength=_,U.pointLength=S,U.spotLength=C,U.rectAreaLength=T,U.hemiLength=E,U.numDirectionalShadows=R,U.numPointShadows=I,U.numSpotShadows=L,U.numSpotMaps=F,U.numLightProbes=z,n.version=RO++)}function h(p,m){let y=0,x=0,_=0,S=0,C=0;const T=m.matrixWorldInverse;for(let E=0,R=p.length;E=c.length?(f=new YE(s),c.push(f)):f=c[a],f}function n(){e=new WeakMap}return{get:t,dispose:n}}const LO=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,NO=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg; + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r; + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) ); + gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 ); +}`,OO=[new se(1,0,0),new se(-1,0,0),new se(0,1,0),new se(0,-1,0),new se(0,0,1),new se(0,0,-1)],PO=[new se(0,-1,0),new se(0,-1,0),new se(0,0,1),new se(0,0,-1),new se(0,-1,0),new se(0,-1,0)],ZE=new dn,Cm=new se,R_=new se;function FO(s,e,t){let n=new Wd;const i=new pt,a=new pt,c=new di,f=new Xx,h=new qx,p={},m=t.maxTextureSize,y={[Ec]:ba,[ba]:Ec,[Ki]:Ki},x=new Vr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new pt},radius:{value:4}},vertexShader:LO,fragmentShader:NO}),_=x.clone();_.defines.HORIZONTAL_PASS=1;const S=new bn;S.setAttribute("position",new bi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const C=new Si(S,x),T=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Rd;let E=this.type;this.render=function(P,z,U){if(T.enabled===!1||T.autoUpdate===!1&&T.needsUpdate===!1||P.length===0)return;this.type===Fm&&(Bt("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Rd);const O=s.getRenderTarget(),W=s.getActiveCubeFace(),q=s.getActiveMipmapLevel(),Y=s.state;Y.setBlending(Po),Y.buffers.depth.getReversed()===!0?Y.buffers.color.setClear(0,0,0,0):Y.buffers.color.setClear(1,1,1,1),Y.buffers.depth.setTest(!0),Y.setScissorTest(!1);const K=E!==this.type;K&&z.traverse(function($){$.material&&(Array.isArray($.material)?$.material.forEach(ie=>ie.needsUpdate=!0):$.material.needsUpdate=!0)});for(let $=0,ie=P.length;$m||i.y>m)&&(i.x>m&&(a.x=Math.floor(m/ge.x),i.x=a.x*ge.x,te.mapSize.x=a.x),i.y>m&&(a.y=Math.floor(m/ge.y),i.y=a.y*ge.y,te.mapSize.y=a.y));const ce=s.state.buffers.depth.getReversed();if(te.camera._reversedDepth=ce,te.map===null||K===!0){if(te.map!==null&&(te.map.depthTexture!==null&&(te.map.depthTexture.dispose(),te.map.depthTexture=null),te.map.dispose()),this.type===Of){if(X.isPointLight){Bt("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}te.map=new ka(i.x,i.y,{format:Xf,type:sr,minFilter:Wn,magFilter:Wn,generateMipmaps:!1}),te.map.texture.name=X.name+".shadowMap",te.map.depthTexture=new Fd(i.x,i.y,Vi),te.map.depthTexture.name=X.name+".shadowMapDepth",te.map.depthTexture.format=Ul,te.map.depthTexture.compareFunction=null,te.map.depthTexture.minFilter=pr,te.map.depthTexture.magFilter=pr}else X.isPointLight?(te.map=new Jx(i.x),te.map.depthTexture=new zw(i.x,ws)):(te.map=new ka(i.x,i.y),te.map.depthTexture=new Fd(i.x,i.y,ws)),te.map.depthTexture.name=X.name+".shadowMap",te.map.depthTexture.format=Ul,this.type===Rd?(te.map.depthTexture.compareFunction=ce?Ex:Mx,te.map.depthTexture.minFilter=Wn,te.map.depthTexture.magFilter=Wn):(te.map.depthTexture.compareFunction=null,te.map.depthTexture.minFilter=pr,te.map.depthTexture.magFilter=pr);te.camera.updateProjectionMatrix()}const fe=te.map.isWebGLCubeRenderTarget?6:1;for(let G=0;G0||z.map&&z.alphaTest>0||z.alphaToCoverage===!0){const Y=W.uuid,K=z.uuid;let $=p[Y];$===void 0&&($={},p[Y]=$);let ie=$[K];ie===void 0&&(ie=W.clone(),$[K]=ie,z.addEventListener("dispose",F)),W=ie}if(W.visible=z.visible,W.wireframe=z.wireframe,O===Of?W.side=z.shadowSide!==null?z.shadowSide:z.side:W.side=z.shadowSide!==null?z.shadowSide:y[z.side],W.alphaMap=z.alphaMap,W.alphaTest=z.alphaToCoverage===!0?.5:z.alphaTest,W.map=z.map,W.clipShadows=z.clipShadows,W.clippingPlanes=z.clippingPlanes,W.clipIntersection=z.clipIntersection,W.displacementMap=z.displacementMap,W.displacementScale=z.displacementScale,W.displacementBias=z.displacementBias,W.wireframeLinewidth=z.wireframeLinewidth,W.linewidth=z.linewidth,U.isPointLight===!0&&W.isMeshDistanceMaterial===!0){const Y=s.properties.get(W);Y.light=U}return W}function L(P,z,U,O,W){if(P.visible===!1)return;if(P.layers.test(z.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&W===Of)&&(!P.frustumCulled||n.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(U.matrixWorldInverse,P.matrixWorld);const K=e.update(P),$=P.material;if(Array.isArray($)){const ie=K.groups;for(let X=0,te=ie.length;X=1):ge.indexOf("OpenGL ES")!==-1&&(te=parseFloat(/^OpenGL ES (\d)/.exec(ge)[1]),X=te>=2);let ce=null,fe={};const G=s.getParameter(s.SCISSOR_BOX),Z=s.getParameter(s.VIEWPORT),oe=new di().fromArray(G),he=new di().fromArray(Z);function xe(re,pe,Fe,et){const Re=new Uint8Array(4),Me=s.createTexture();s.bindTexture(re,Me),s.texParameteri(re,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(re,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let ht=0;ht"u"?!1:/OculusBrowser/g.test(navigator.userAgent),p=new pt,m=new WeakMap;let y;const x=new WeakMap;let _=!1;try{_=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function S(j,B){return _?new OffscreenCanvas(j,B):r0("canvas")}function C(j,B,ue){let ze=1;const we=je(j);if((we.width>ue||we.height>ue)&&(ze=ue/Math.max(we.width,we.height)),ze<1)if(typeof HTMLImageElement<"u"&&j instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&j instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&j instanceof ImageBitmap||typeof VideoFrame<"u"&&j instanceof VideoFrame){const Ae=Math.floor(ze*we.width),Le=Math.floor(ze*we.height);y===void 0&&(y=S(Ae,Le));const lt=B?S(Ae,Le):y;return lt.width=Ae,lt.height=Le,lt.getContext("2d").drawImage(j,0,0,Ae,Le),Bt("WebGLRenderer: Texture has been resized from ("+we.width+"x"+we.height+") to ("+Ae+"x"+Le+")."),lt}else return"data"in j&&Bt("WebGLRenderer: Image in DataTexture is too big ("+we.width+"x"+we.height+")."),j;return j}function T(j){return j.generateMipmaps}function E(j){s.generateMipmap(j)}function R(j){return j.isWebGLCubeRenderTarget?s.TEXTURE_CUBE_MAP:j.isWebGL3DRenderTarget?s.TEXTURE_3D:j.isWebGLArrayRenderTarget||j.isCompressedArrayTexture?s.TEXTURE_2D_ARRAY:s.TEXTURE_2D}function I(j,B,ue,ze,we=!1){if(j!==null){if(s[j]!==void 0)return s[j];Bt("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+j+"'")}let Ae=B;if(B===s.RED&&(ue===s.FLOAT&&(Ae=s.R32F),ue===s.HALF_FLOAT&&(Ae=s.R16F),ue===s.UNSIGNED_BYTE&&(Ae=s.R8)),B===s.RED_INTEGER&&(ue===s.UNSIGNED_BYTE&&(Ae=s.R8UI),ue===s.UNSIGNED_SHORT&&(Ae=s.R16UI),ue===s.UNSIGNED_INT&&(Ae=s.R32UI),ue===s.BYTE&&(Ae=s.R8I),ue===s.SHORT&&(Ae=s.R16I),ue===s.INT&&(Ae=s.R32I)),B===s.RG&&(ue===s.FLOAT&&(Ae=s.RG32F),ue===s.HALF_FLOAT&&(Ae=s.RG16F),ue===s.UNSIGNED_BYTE&&(Ae=s.RG8)),B===s.RG_INTEGER&&(ue===s.UNSIGNED_BYTE&&(Ae=s.RG8UI),ue===s.UNSIGNED_SHORT&&(Ae=s.RG16UI),ue===s.UNSIGNED_INT&&(Ae=s.RG32UI),ue===s.BYTE&&(Ae=s.RG8I),ue===s.SHORT&&(Ae=s.RG16I),ue===s.INT&&(Ae=s.RG32I)),B===s.RGB_INTEGER&&(ue===s.UNSIGNED_BYTE&&(Ae=s.RGB8UI),ue===s.UNSIGNED_SHORT&&(Ae=s.RGB16UI),ue===s.UNSIGNED_INT&&(Ae=s.RGB32UI),ue===s.BYTE&&(Ae=s.RGB8I),ue===s.SHORT&&(Ae=s.RGB16I),ue===s.INT&&(Ae=s.RGB32I)),B===s.RGBA_INTEGER&&(ue===s.UNSIGNED_BYTE&&(Ae=s.RGBA8UI),ue===s.UNSIGNED_SHORT&&(Ae=s.RGBA16UI),ue===s.UNSIGNED_INT&&(Ae=s.RGBA32UI),ue===s.BYTE&&(Ae=s.RGBA8I),ue===s.SHORT&&(Ae=s.RGBA16I),ue===s.INT&&(Ae=s.RGBA32I)),B===s.RGB&&(ue===s.UNSIGNED_INT_5_9_9_9_REV&&(Ae=s.RGB9_E5),ue===s.UNSIGNED_INT_10F_11F_11F_REV&&(Ae=s.R11F_G11F_B10F)),B===s.RGBA){const Le=we?n0:Zn.getTransfer(ze);ue===s.FLOAT&&(Ae=s.RGBA32F),ue===s.HALF_FLOAT&&(Ae=s.RGBA16F),ue===s.UNSIGNED_BYTE&&(Ae=Le===hi?s.SRGB8_ALPHA8:s.RGBA8),ue===s.UNSIGNED_SHORT_4_4_4_4&&(Ae=s.RGBA4),ue===s.UNSIGNED_SHORT_5_5_5_1&&(Ae=s.RGB5_A1)}return(Ae===s.R16F||Ae===s.R32F||Ae===s.RG16F||Ae===s.RG32F||Ae===s.RGBA16F||Ae===s.RGBA32F)&&e.get("EXT_color_buffer_float"),Ae}function L(j,B){let ue;return j?B===null||B===ws||B===Nd?ue=s.DEPTH24_STENCIL8:B===Vi?ue=s.DEPTH32F_STENCIL8:B===Ld&&(ue=s.DEPTH24_STENCIL8,Bt("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):B===null||B===ws||B===Nd?ue=s.DEPTH_COMPONENT24:B===Vi?ue=s.DEPTH_COMPONENT32F:B===Ld&&(ue=s.DEPTH_COMPONENT16),ue}function F(j,B){return T(j)===!0||j.isFramebufferTexture&&j.minFilter!==pr&&j.minFilter!==Wn?Math.log2(Math.max(B.width,B.height))+1:j.mipmaps!==void 0&&j.mipmaps.length>0?j.mipmaps.length:j.isCompressedTexture&&Array.isArray(j.image)?B.mipmaps.length:1}function P(j){const B=j.target;B.removeEventListener("dispose",P),U(B),B.isVideoTexture&&m.delete(B)}function z(j){const B=j.target;B.removeEventListener("dispose",z),W(B)}function U(j){const B=n.get(j);if(B.__webglInit===void 0)return;const ue=j.source,ze=x.get(ue);if(ze){const we=ze[B.__cacheKey];we.usedTimes--,we.usedTimes===0&&O(j),Object.keys(ze).length===0&&x.delete(ue)}n.remove(j)}function O(j){const B=n.get(j);s.deleteTexture(B.__webglTexture);const ue=j.source,ze=x.get(ue);delete ze[B.__cacheKey],c.memory.textures--}function W(j){const B=n.get(j);if(j.depthTexture&&(j.depthTexture.dispose(),n.remove(j.depthTexture)),j.isWebGLCubeRenderTarget)for(let ze=0;ze<6;ze++){if(Array.isArray(B.__webglFramebuffer[ze]))for(let we=0;we=i.maxTextures&&Bt("WebGLTextures: Trying to use "+j+" texture units while this GPU supports only "+i.maxTextures),q+=1,j}function $(j){const B=[];return B.push(j.wrapS),B.push(j.wrapT),B.push(j.wrapR||0),B.push(j.magFilter),B.push(j.minFilter),B.push(j.anisotropy),B.push(j.internalFormat),B.push(j.format),B.push(j.type),B.push(j.generateMipmaps),B.push(j.premultiplyAlpha),B.push(j.flipY),B.push(j.unpackAlignment),B.push(j.colorSpace),B.join()}function ie(j,B){const ue=n.get(j);if(j.isVideoTexture&&qe(j),j.isRenderTargetTexture===!1&&j.isExternalTexture!==!0&&j.version>0&&ue.__version!==j.version){const ze=j.image;if(ze===null)Bt("WebGLRenderer: Texture marked for update but no image data found.");else if(ze.complete===!1)Bt("WebGLRenderer: Texture marked for update but image is incomplete");else{ae(ue,j,B);return}}else j.isExternalTexture&&(ue.__webglTexture=j.sourceTexture?j.sourceTexture:null);t.bindTexture(s.TEXTURE_2D,ue.__webglTexture,s.TEXTURE0+B)}function X(j,B){const ue=n.get(j);if(j.isRenderTargetTexture===!1&&j.version>0&&ue.__version!==j.version){ae(ue,j,B);return}else j.isExternalTexture&&(ue.__webglTexture=j.sourceTexture?j.sourceTexture:null);t.bindTexture(s.TEXTURE_2D_ARRAY,ue.__webglTexture,s.TEXTURE0+B)}function te(j,B){const ue=n.get(j);if(j.isRenderTargetTexture===!1&&j.version>0&&ue.__version!==j.version){ae(ue,j,B);return}t.bindTexture(s.TEXTURE_3D,ue.__webglTexture,s.TEXTURE0+B)}function ge(j,B){const ue=n.get(j);if(j.isCubeDepthTexture!==!0&&j.version>0&&ue.__version!==j.version){de(ue,j,B);return}t.bindTexture(s.TEXTURE_CUBE_MAP,ue.__webglTexture,s.TEXTURE0+B)}const ce={[Jm]:s.REPEAT,[ar]:s.CLAMP_TO_EDGE,[$m]:s.MIRRORED_REPEAT},fe={[pr]:s.NEAREST,[Rb]:s.NEAREST_MIPMAP_NEAREST,[wd]:s.NEAREST_MIPMAP_LINEAR,[Wn]:s.LINEAR,[Bm]:s.LINEAR_MIPMAP_NEAREST,[Al]:s.LINEAR_MIPMAP_LINEAR},G={[yw]:s.NEVER,[Mw]:s.ALWAYS,[xw]:s.LESS,[Mx]:s.LEQUAL,[_w]:s.EQUAL,[Ex]:s.GEQUAL,[bw]:s.GREATER,[Sw]:s.NOTEQUAL};function Z(j,B){if(B.type===Vi&&e.has("OES_texture_float_linear")===!1&&(B.magFilter===Wn||B.magFilter===Bm||B.magFilter===wd||B.magFilter===Al||B.minFilter===Wn||B.minFilter===Bm||B.minFilter===wd||B.minFilter===Al)&&Bt("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),s.texParameteri(j,s.TEXTURE_WRAP_S,ce[B.wrapS]),s.texParameteri(j,s.TEXTURE_WRAP_T,ce[B.wrapT]),(j===s.TEXTURE_3D||j===s.TEXTURE_2D_ARRAY)&&s.texParameteri(j,s.TEXTURE_WRAP_R,ce[B.wrapR]),s.texParameteri(j,s.TEXTURE_MAG_FILTER,fe[B.magFilter]),s.texParameteri(j,s.TEXTURE_MIN_FILTER,fe[B.minFilter]),B.compareFunction&&(s.texParameteri(j,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(j,s.TEXTURE_COMPARE_FUNC,G[B.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(B.magFilter===pr||B.minFilter!==wd&&B.minFilter!==Al||B.type===Vi&&e.has("OES_texture_float_linear")===!1)return;if(B.anisotropy>1||n.get(B).__currentAnisotropy){const ue=e.get("EXT_texture_filter_anisotropic");s.texParameterf(j,ue.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(B.anisotropy,i.getMaxAnisotropy())),n.get(B).__currentAnisotropy=B.anisotropy}}}function oe(j,B){let ue=!1;j.__webglInit===void 0&&(j.__webglInit=!0,B.addEventListener("dispose",P));const ze=B.source;let we=x.get(ze);we===void 0&&(we={},x.set(ze,we));const Ae=$(B);if(Ae!==j.__cacheKey){we[Ae]===void 0&&(we[Ae]={texture:s.createTexture(),usedTimes:0},c.memory.textures++,ue=!0),we[Ae].usedTimes++;const Le=we[j.__cacheKey];Le!==void 0&&(we[j.__cacheKey].usedTimes--,Le.usedTimes===0&&O(B)),j.__cacheKey=Ae,j.__webglTexture=we[Ae].texture}return ue}function he(j,B,ue){return Math.floor(Math.floor(j/ue)/B)}function xe(j,B,ue,ze){const Ae=j.updateRanges;if(Ae.length===0)t.texSubImage2D(s.TEXTURE_2D,0,0,0,B.width,B.height,ue,ze,B.data);else{Ae.sort((Xe,He)=>Xe.start-He.start);let Le=0;for(let Xe=1;Xe0){re&&pe&&t.texStorage2D(s.TEXTURE_2D,et,le,De[0].width,De[0].height);for(let Re=0,Me=De.length;Re0){const ht=sb(Ie.width,Ie.height,B.format,B.type);for(const St of B.layerUpdates){const It=Ie.data.subarray(St*ht/Ie.data.BYTES_PER_ELEMENT,(St+1)*ht/Ie.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,Re,0,0,St,Ie.width,Ie.height,1,He,It)}B.clearLayerUpdates()}else t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,Re,0,0,0,Ie.width,Ie.height,Xe.depth,He,Ie.data)}else t.compressedTexImage3D(s.TEXTURE_2D_ARRAY,Re,le,Ie.width,Ie.height,Xe.depth,0,Ie.data,0,0);else Bt("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else re?Fe&&t.texSubImage3D(s.TEXTURE_2D_ARRAY,Re,0,0,0,Ie.width,Ie.height,Xe.depth,He,rt,Ie.data):t.texImage3D(s.TEXTURE_2D_ARRAY,Re,le,Ie.width,Ie.height,Xe.depth,0,He,rt,Ie.data)}else{re&&pe&&t.texStorage2D(s.TEXTURE_2D,et,le,De[0].width,De[0].height);for(let Re=0,Me=De.length;Re0){const Re=sb(Xe.width,Xe.height,B.format,B.type);for(const Me of B.layerUpdates){const ht=Xe.data.subarray(Me*Re/Xe.data.BYTES_PER_ELEMENT,(Me+1)*Re/Xe.data.BYTES_PER_ELEMENT);t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,Me,Xe.width,Xe.height,1,He,rt,ht)}B.clearLayerUpdates()}else t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,Xe.width,Xe.height,Xe.depth,He,rt,Xe.data)}else t.texImage3D(s.TEXTURE_2D_ARRAY,0,le,Xe.width,Xe.height,Xe.depth,0,He,rt,Xe.data);else if(B.isData3DTexture)re?(pe&&t.texStorage3D(s.TEXTURE_3D,et,le,Xe.width,Xe.height,Xe.depth),Fe&&t.texSubImage3D(s.TEXTURE_3D,0,0,0,0,Xe.width,Xe.height,Xe.depth,He,rt,Xe.data)):t.texImage3D(s.TEXTURE_3D,0,le,Xe.width,Xe.height,Xe.depth,0,He,rt,Xe.data);else if(B.isFramebufferTexture){if(pe)if(re)t.texStorage2D(s.TEXTURE_2D,et,le,Xe.width,Xe.height);else{let Re=Xe.width,Me=Xe.height;for(let ht=0;ht>=1,Me>>=1}}else if(De.length>0){if(re&&pe){const Re=je(De[0]);t.texStorage2D(s.TEXTURE_2D,et,le,Re.width,Re.height)}for(let Re=0,Me=De.length;Re0&&et++;const Me=je(He[0]);t.texStorage2D(s.TEXTURE_CUBE_MAP,et,De,Me.width,Me.height)}for(let Me=0;Me<6;Me++)if(Xe){re?Fe&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Me,0,0,0,He[Me].width,He[Me].height,le,Ie,He[Me].data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+Me,0,De,He[Me].width,He[Me].height,0,le,Ie,He[Me].data);for(let ht=0;ht>Ae),rt=Math.max(1,B.height>>Ae);we===s.TEXTURE_3D||we===s.TEXTURE_2D_ARRAY?t.texImage3D(we,Ae,Tt,He,rt,B.depth,0,Le,lt,null):t.texImage2D(we,Ae,Tt,He,rt,0,Le,lt,null)}t.bindFramebuffer(s.FRAMEBUFFER,j),ut(B)?f.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,ze,we,Xe.__webglTexture,0,Q(B)):(we===s.TEXTURE_2D||we>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&we<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,ze,we,Xe.__webglTexture,Ae),t.bindFramebuffer(s.FRAMEBUFFER,null)}function Ge(j,B,ue){if(s.bindRenderbuffer(s.RENDERBUFFER,j),B.depthBuffer){const ze=B.depthTexture,we=ze&&ze.isDepthTexture?ze.type:null,Ae=L(B.stencilBuffer,we),Le=B.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT;ut(B)?f.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,Q(B),Ae,B.width,B.height):ue?s.renderbufferStorageMultisample(s.RENDERBUFFER,Q(B),Ae,B.width,B.height):s.renderbufferStorage(s.RENDERBUFFER,Ae,B.width,B.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,Le,s.RENDERBUFFER,j)}else{const ze=B.textures;for(let we=0;we{delete B.__boundDepthTexture,delete B.__depthDisposeCallback,ze.removeEventListener("dispose",we)};ze.addEventListener("dispose",we),B.__depthDisposeCallback=we}B.__boundDepthTexture=ze}if(j.depthTexture&&!B.__autoAllocateDepthBuffer)if(ue)for(let ze=0;ze<6;ze++)ct(B.__webglFramebuffer[ze],j,ze);else{const ze=j.texture.mipmaps;ze&&ze.length>0?ct(B.__webglFramebuffer[0],j,0):ct(B.__webglFramebuffer,j,0)}else if(ue){B.__webglDepthbuffer=[];for(let ze=0;ze<6;ze++)if(t.bindFramebuffer(s.FRAMEBUFFER,B.__webglFramebuffer[ze]),B.__webglDepthbuffer[ze]===void 0)B.__webglDepthbuffer[ze]=s.createRenderbuffer(),Ge(B.__webglDepthbuffer[ze],j,!1);else{const we=j.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Ae=B.__webglDepthbuffer[ze];s.bindRenderbuffer(s.RENDERBUFFER,Ae),s.framebufferRenderbuffer(s.FRAMEBUFFER,we,s.RENDERBUFFER,Ae)}}else{const ze=j.texture.mipmaps;if(ze&&ze.length>0?t.bindFramebuffer(s.FRAMEBUFFER,B.__webglFramebuffer[0]):t.bindFramebuffer(s.FRAMEBUFFER,B.__webglFramebuffer),B.__webglDepthbuffer===void 0)B.__webglDepthbuffer=s.createRenderbuffer(),Ge(B.__webglDepthbuffer,j,!1);else{const we=j.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Ae=B.__webglDepthbuffer;s.bindRenderbuffer(s.RENDERBUFFER,Ae),s.framebufferRenderbuffer(s.FRAMEBUFFER,we,s.RENDERBUFFER,Ae)}}t.bindFramebuffer(s.FRAMEBUFFER,null)}function $e(j,B,ue){const ze=n.get(j);B!==void 0&&me(ze.__webglFramebuffer,j,j.texture,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,0),ue!==void 0&&Qe(j)}function bt(j){const B=j.texture,ue=n.get(j),ze=n.get(B);j.addEventListener("dispose",z);const we=j.textures,Ae=j.isWebGLCubeRenderTarget===!0,Le=we.length>1;if(Le||(ze.__webglTexture===void 0&&(ze.__webglTexture=s.createTexture()),ze.__version=B.version,c.memory.textures++),Ae){ue.__webglFramebuffer=[];for(let lt=0;lt<6;lt++)if(B.mipmaps&&B.mipmaps.length>0){ue.__webglFramebuffer[lt]=[];for(let Tt=0;Tt0){ue.__webglFramebuffer=[];for(let lt=0;lt0&&ut(j)===!1){ue.__webglMultisampledFramebuffer=s.createFramebuffer(),ue.__webglColorRenderbuffer=[],t.bindFramebuffer(s.FRAMEBUFFER,ue.__webglMultisampledFramebuffer);for(let lt=0;lt0)for(let Tt=0;Tt0)for(let Tt=0;Tt0){if(ut(j)===!1){const B=j.textures,ue=j.width,ze=j.height;let we=s.COLOR_BUFFER_BIT;const Ae=j.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Le=n.get(j),lt=B.length>1;if(lt)for(let Rt=0;Rt0?t.bindFramebuffer(s.DRAW_FRAMEBUFFER,Le.__webglFramebuffer[0]):t.bindFramebuffer(s.DRAW_FRAMEBUFFER,Le.__webglFramebuffer);for(let Rt=0;Rt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&B.__useRenderToTexture!==!1}function qe(j){const B=c.render.frame;m.get(j)!==B&&(m.set(j,B),j.update())}function Ne(j,B){const ue=j.colorSpace,ze=j.format,we=j.type;return j.isCompressedTexture===!0||j.isVideoTexture===!0||ue!==zo&&ue!==bc&&(Zn.getTransfer(ue)===hi?(ze!==mr||we!==Br)&&Bt("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):$t("WebGLTextures: Unsupported texture color space:",ue)),B}function je(j){return typeof HTMLImageElement<"u"&&j instanceof HTMLImageElement?(p.width=j.naturalWidth||j.width,p.height=j.naturalHeight||j.height):typeof VideoFrame<"u"&&j instanceof VideoFrame?(p.width=j.displayWidth,p.height=j.displayHeight):(p.width=j.width,p.height=j.height),p}this.allocateTextureUnit=K,this.resetTextureUnits=Y,this.setTexture2D=ie,this.setTexture2DArray=X,this.setTexture3D=te,this.setTextureCube=ge,this.rebindTextures=$e,this.setupRenderTarget=bt,this.updateRenderTargetMipmap=Oe,this.updateMultisampleRenderTarget=it,this.setupDepthRenderbuffer=Qe,this.setupFrameBufferTexture=me,this.useMultisampledRTT=ut,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function LA(s,e){function t(n,i=bc){let a;const c=Zn.getTransfer(i);if(n===Br)return s.UNSIGNED_BYTE;if(n===yx)return s.UNSIGNED_SHORT_4_4_4_4;if(n===xx)return s.UNSIGNED_SHORT_5_5_5_1;if(n===Db)return s.UNSIGNED_INT_5_9_9_9_REV;if(n===Ub)return s.UNSIGNED_INT_10F_11F_11F_REV;if(n===gx)return s.BYTE;if(n===vx)return s.SHORT;if(n===Ld)return s.UNSIGNED_SHORT;if(n===x0)return s.INT;if(n===ws)return s.UNSIGNED_INT;if(n===Vi)return s.FLOAT;if(n===sr)return s.HALF_FLOAT;if(n===Ib)return s.ALPHA;if(n===Lb)return s.RGB;if(n===mr)return s.RGBA;if(n===Ul)return s.DEPTH_COMPONENT;if(n===bu)return s.DEPTH_STENCIL;if(n===_0)return s.RED;if(n===b0)return s.RED_INTEGER;if(n===Xf)return s.RG;if(n===_x)return s.RG_INTEGER;if(n===bx)return s.RGBA_INTEGER;if(n===km||n===Gm||n===Hm||n===Vm)if(c===hi)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(n===km)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Gm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Hm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Vm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(n===km)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Gm)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Hm)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Vm)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===wy||n===Ay||n===Cy||n===Ry)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(n===wy)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Ay)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Cy)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Ry)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===Dy||n===Uy||n===Iy||n===Ly||n===Ny||n===Oy||n===Py)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(n===Dy||n===Uy)return c===hi?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(n===Iy)return c===hi?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC;if(n===Ly)return a.COMPRESSED_R11_EAC;if(n===Ny)return a.COMPRESSED_SIGNED_R11_EAC;if(n===Oy)return a.COMPRESSED_RG11_EAC;if(n===Py)return a.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Fy||n===zy||n===By||n===ky||n===Gy||n===Hy||n===Vy||n===jy||n===Wy||n===Xy||n===qy||n===Yy||n===Zy||n===Ky)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(n===Fy)return c===hi?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===zy)return c===hi?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===By)return c===hi?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===ky)return c===hi?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Gy)return c===hi?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Hy)return c===hi?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Vy)return c===hi?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===jy)return c===hi?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Wy)return c===hi?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Xy)return c===hi?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===qy)return c===hi?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Yy)return c===hi?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Zy)return c===hi?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Ky)return c===hi?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Qy||n===Jy||n===$y)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(n===Qy)return c===hi?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Jy)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===$y)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===ex||n===tx||n===nx||n===ix)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(n===ex)return a.COMPRESSED_RED_RGTC1_EXT;if(n===tx)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===nx)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===ix)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Nd?s.UNSIGNED_INT_24_8:s[n]!==void 0?s[n]:null}return{convert:t}}const kO=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,GO=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class HO{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new Hb(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){const t=e.cameras[0].viewport,n=new Vr({vertexShader:kO,fragmentShader:GO,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Si(new Cs(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class VO extends Il{constructor(e,t){super();const n=this;let i=null,a=1,c=null,f="local-floor",h=1,p=null,m=null,y=null,x=null,_=null,S=null;const C=typeof XRWebGLBinding<"u",T=new HO,E={},R=t.getContextAttributes();let I=null,L=null;const F=[],P=[],z=new pt;let U=null;const O=new dr;O.viewport=new di;const W=new dr;W.viewport=new di;const q=[O,W],Y=new bA;let K=null,$=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ae){let de=F[ae];return de===void 0&&(de=new fy,F[ae]=de),de.getTargetRaySpace()},this.getControllerGrip=function(ae){let de=F[ae];return de===void 0&&(de=new fy,F[ae]=de),de.getGripSpace()},this.getHand=function(ae){let de=F[ae];return de===void 0&&(de=new fy,F[ae]=de),de.getHandSpace()};function ie(ae){const de=P.indexOf(ae.inputSource);if(de===-1)return;const me=F[de];me!==void 0&&(me.update(ae.inputSource,ae.frame,p||c),me.dispatchEvent({type:ae.type,data:ae.inputSource}))}function X(){i.removeEventListener("select",ie),i.removeEventListener("selectstart",ie),i.removeEventListener("selectend",ie),i.removeEventListener("squeeze",ie),i.removeEventListener("squeezestart",ie),i.removeEventListener("squeezeend",ie),i.removeEventListener("end",X),i.removeEventListener("inputsourceschange",te);for(let ae=0;ae=0&&(P[Ge]=null,F[Ge].disconnect(me))}for(let de=0;de=P.length){P.push(me),Ge=Qe;break}else if(P[Qe]===null){P[Qe]=me,Ge=Qe;break}if(Ge===-1)break}const ct=F[Ge];ct&&ct.connect(me)}}const ge=new se,ce=new se;function fe(ae,de,me){ge.setFromMatrixPosition(de.matrixWorld),ce.setFromMatrixPosition(me.matrixWorld);const Ge=ge.distanceTo(ce),ct=de.projectionMatrix.elements,Qe=me.projectionMatrix.elements,$e=ct[14]/(ct[10]-1),bt=ct[14]/(ct[10]+1),Oe=(ct[9]+1)/ct[5],Ve=(ct[9]-1)/ct[5],Pe=(ct[8]-1)/ct[0],it=(Qe[8]+1)/Qe[0],Q=$e*Pe,ut=$e*it,qe=Ge/(-Pe+it),Ne=qe*-Pe;if(de.matrixWorld.decompose(ae.position,ae.quaternion,ae.scale),ae.translateX(Ne),ae.translateZ(qe),ae.matrixWorld.compose(ae.position,ae.quaternion,ae.scale),ae.matrixWorldInverse.copy(ae.matrixWorld).invert(),ct[10]===-1)ae.projectionMatrix.copy(de.projectionMatrix),ae.projectionMatrixInverse.copy(de.projectionMatrixInverse);else{const je=$e+qe,j=bt+qe,B=Q-Ne,ue=ut+(Ge-Ne),ze=Oe*bt/j*je,we=Ve*bt/j*je;ae.projectionMatrix.makePerspective(B,ue,ze,we,je,j),ae.projectionMatrixInverse.copy(ae.projectionMatrix).invert()}}function G(ae,de){de===null?ae.matrixWorld.copy(ae.matrix):ae.matrixWorld.multiplyMatrices(de.matrixWorld,ae.matrix),ae.matrixWorldInverse.copy(ae.matrixWorld).invert()}this.updateCamera=function(ae){if(i===null)return;let de=ae.near,me=ae.far;T.texture!==null&&(T.depthNear>0&&(de=T.depthNear),T.depthFar>0&&(me=T.depthFar)),Y.near=W.near=O.near=de,Y.far=W.far=O.far=me,(K!==Y.near||$!==Y.far)&&(i.updateRenderState({depthNear:Y.near,depthFar:Y.far}),K=Y.near,$=Y.far),Y.layers.mask=ae.layers.mask|6,O.layers.mask=Y.layers.mask&-5,W.layers.mask=Y.layers.mask&-3;const Ge=ae.parent,ct=Y.cameras;G(Y,Ge);for(let Qe=0;Qe0&&(T.alphaTest.value=E.alphaTest);const R=e.get(E),I=R.envMap,L=R.envMapRotation;I&&(T.envMap.value=I,Rf.copy(L),Rf.x*=-1,Rf.y*=-1,Rf.z*=-1,I.isCubeTexture&&I.isRenderTargetTexture===!1&&(Rf.y*=-1,Rf.z*=-1),T.envMapRotation.value.setFromMatrix4(jO.makeRotationFromEuler(Rf)),T.flipEnvMap.value=I.isCubeTexture&&I.isRenderTargetTexture===!1?-1:1,T.reflectivity.value=E.reflectivity,T.ior.value=E.ior,T.refractionRatio.value=E.refractionRatio),E.lightMap&&(T.lightMap.value=E.lightMap,T.lightMapIntensity.value=E.lightMapIntensity,t(E.lightMap,T.lightMapTransform)),E.aoMap&&(T.aoMap.value=E.aoMap,T.aoMapIntensity.value=E.aoMapIntensity,t(E.aoMap,T.aoMapTransform))}function c(T,E){T.diffuse.value.copy(E.color),T.opacity.value=E.opacity,E.map&&(T.map.value=E.map,t(E.map,T.mapTransform))}function f(T,E){T.dashSize.value=E.dashSize,T.totalSize.value=E.dashSize+E.gapSize,T.scale.value=E.scale}function h(T,E,R,I){T.diffuse.value.copy(E.color),T.opacity.value=E.opacity,T.size.value=E.size*R,T.scale.value=I*.5,E.map&&(T.map.value=E.map,t(E.map,T.uvTransform)),E.alphaMap&&(T.alphaMap.value=E.alphaMap,t(E.alphaMap,T.alphaMapTransform)),E.alphaTest>0&&(T.alphaTest.value=E.alphaTest)}function p(T,E){T.diffuse.value.copy(E.color),T.opacity.value=E.opacity,T.rotation.value=E.rotation,E.map&&(T.map.value=E.map,t(E.map,T.mapTransform)),E.alphaMap&&(T.alphaMap.value=E.alphaMap,t(E.alphaMap,T.alphaMapTransform)),E.alphaTest>0&&(T.alphaTest.value=E.alphaTest)}function m(T,E){T.specular.value.copy(E.specular),T.shininess.value=Math.max(E.shininess,1e-4)}function y(T,E){E.gradientMap&&(T.gradientMap.value=E.gradientMap)}function x(T,E){T.metalness.value=E.metalness,E.metalnessMap&&(T.metalnessMap.value=E.metalnessMap,t(E.metalnessMap,T.metalnessMapTransform)),T.roughness.value=E.roughness,E.roughnessMap&&(T.roughnessMap.value=E.roughnessMap,t(E.roughnessMap,T.roughnessMapTransform)),E.envMap&&(T.envMapIntensity.value=E.envMapIntensity)}function _(T,E,R){T.ior.value=E.ior,E.sheen>0&&(T.sheenColor.value.copy(E.sheenColor).multiplyScalar(E.sheen),T.sheenRoughness.value=E.sheenRoughness,E.sheenColorMap&&(T.sheenColorMap.value=E.sheenColorMap,t(E.sheenColorMap,T.sheenColorMapTransform)),E.sheenRoughnessMap&&(T.sheenRoughnessMap.value=E.sheenRoughnessMap,t(E.sheenRoughnessMap,T.sheenRoughnessMapTransform))),E.clearcoat>0&&(T.clearcoat.value=E.clearcoat,T.clearcoatRoughness.value=E.clearcoatRoughness,E.clearcoatMap&&(T.clearcoatMap.value=E.clearcoatMap,t(E.clearcoatMap,T.clearcoatMapTransform)),E.clearcoatRoughnessMap&&(T.clearcoatRoughnessMap.value=E.clearcoatRoughnessMap,t(E.clearcoatRoughnessMap,T.clearcoatRoughnessMapTransform)),E.clearcoatNormalMap&&(T.clearcoatNormalMap.value=E.clearcoatNormalMap,t(E.clearcoatNormalMap,T.clearcoatNormalMapTransform),T.clearcoatNormalScale.value.copy(E.clearcoatNormalScale),E.side===ba&&T.clearcoatNormalScale.value.negate())),E.dispersion>0&&(T.dispersion.value=E.dispersion),E.iridescence>0&&(T.iridescence.value=E.iridescence,T.iridescenceIOR.value=E.iridescenceIOR,T.iridescenceThicknessMinimum.value=E.iridescenceThicknessRange[0],T.iridescenceThicknessMaximum.value=E.iridescenceThicknessRange[1],E.iridescenceMap&&(T.iridescenceMap.value=E.iridescenceMap,t(E.iridescenceMap,T.iridescenceMapTransform)),E.iridescenceThicknessMap&&(T.iridescenceThicknessMap.value=E.iridescenceThicknessMap,t(E.iridescenceThicknessMap,T.iridescenceThicknessMapTransform))),E.transmission>0&&(T.transmission.value=E.transmission,T.transmissionSamplerMap.value=R.texture,T.transmissionSamplerSize.value.set(R.width,R.height),E.transmissionMap&&(T.transmissionMap.value=E.transmissionMap,t(E.transmissionMap,T.transmissionMapTransform)),T.thickness.value=E.thickness,E.thicknessMap&&(T.thicknessMap.value=E.thicknessMap,t(E.thicknessMap,T.thicknessMapTransform)),T.attenuationDistance.value=E.attenuationDistance,T.attenuationColor.value.copy(E.attenuationColor)),E.anisotropy>0&&(T.anisotropyVector.value.set(E.anisotropy*Math.cos(E.anisotropyRotation),E.anisotropy*Math.sin(E.anisotropyRotation)),E.anisotropyMap&&(T.anisotropyMap.value=E.anisotropyMap,t(E.anisotropyMap,T.anisotropyMapTransform))),T.specularIntensity.value=E.specularIntensity,T.specularColor.value.copy(E.specularColor),E.specularColorMap&&(T.specularColorMap.value=E.specularColorMap,t(E.specularColorMap,T.specularColorMapTransform)),E.specularIntensityMap&&(T.specularIntensityMap.value=E.specularIntensityMap,t(E.specularIntensityMap,T.specularIntensityMapTransform))}function S(T,E){E.matcap&&(T.matcap.value=E.matcap)}function C(T,E){const R=e.get(E).light;T.referencePosition.value.setFromMatrixPosition(R.matrixWorld),T.nearDistance.value=R.shadow.camera.near,T.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function XO(s,e,t,n){let i={},a={},c=[];const f=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function h(R,I){const L=I.program;n.uniformBlockBinding(R,L)}function p(R,I){let L=i[R.id];L===void 0&&(S(R),L=m(R),i[R.id]=L,R.addEventListener("dispose",T));const F=I.program;n.updateUBOMapping(R,F);const P=e.render.frame;a[R.id]!==P&&(x(R),a[R.id]=P)}function m(R){const I=y();R.__bindingPointIndex=I;const L=s.createBuffer(),F=R.__size,P=R.usage;return s.bindBuffer(s.UNIFORM_BUFFER,L),s.bufferData(s.UNIFORM_BUFFER,F,P),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,I,L),L}function y(){for(let R=0;R0&&(L+=F-P),R.__size=L,R.__cache={},this}function C(R){const I={boundary:0,storage:0};return typeof R=="number"||typeof R=="boolean"?(I.boundary=4,I.storage=4):R.isVector2?(I.boundary=8,I.storage=8):R.isVector3||R.isColor?(I.boundary=16,I.storage=12):R.isVector4?(I.boundary=16,I.storage=16):R.isMatrix3?(I.boundary=48,I.storage=48):R.isMatrix4?(I.boundary=64,I.storage=64):R.isTexture?Bt("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Bt("WebGLRenderer: Unsupported uniform value type.",R),I}function T(R){const I=R.target;I.removeEventListener("dispose",T);const L=c.indexOf(I.__bindingPointIndex);c.splice(L,1),s.deleteBuffer(i[I.id]),delete i[I.id],delete a[I.id]}function E(){for(const R in i)s.deleteBuffer(i[R]);c=[],i={},a={}}return{bind:h,update:p,dispose:E}}const qO=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]);let El=null;function YO(){return El===null&&(El=new lo(qO,16,16,Xf,sr),El.name="DFG_LUT",El.minFilter=Wn,El.magFilter=Wn,El.wrapS=ar,El.wrapT=ar,El.generateMipmaps=!1,El.needsUpdate=!0),El}class uS{constructor(e={}){const{canvas:t=Tw(),context:n=null,depth:i=!0,stencil:a=!1,alpha:c=!1,antialias:f=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:p=!1,powerPreference:m="default",failIfMajorPerformanceCaveat:y=!1,reversedDepthBuffer:x=!1,outputBufferType:_=Br}=e;this.isWebGLRenderer=!0;let S;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");S=n.getContextAttributes().alpha}else S=c;const C=_,T=new Set([bx,_x,b0]),E=new Set([Br,ws,Ld,Nd,yx,xx]),R=new Uint32Array(4),I=new Int32Array(4);let L=null,F=null;const P=[],z=[];let U=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=oo,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const O=this;let W=!1;this._outputColorSpace=ia;let q=0,Y=0,K=null,$=-1,ie=null;const X=new di,te=new di;let ge=null;const ce=new kt(0);let fe=0,G=t.width,Z=t.height,oe=1,he=null,xe=null;const ae=new di(0,0,G,Z),de=new di(0,0,G,Z);let me=!1;const Ge=new Wd;let ct=!1,Qe=!1;const $e=new dn,bt=new se,Oe=new di,Ve={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Pe=!1;function it(){return K===null?oe:1}let Q=n;function ut(H,ve){return t.getContext(H,ve)}try{const H={alpha:!0,depth:i,stencil:a,antialias:f,premultipliedAlpha:h,preserveDrawingBuffer:p,powerPreference:m,failIfMajorPerformanceCaveat:y};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Vd}`),t.addEventListener("webglcontextlost",ht,!1),t.addEventListener("webglcontextrestored",St,!1),t.addEventListener("webglcontextcreationerror",It,!1),Q===null){const ve="webgl2";if(Q=ut(ve,H),Q===null)throw ut(ve)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(H){throw $t("WebGLRenderer: "+H.message),H}let qe,Ne,je,j,B,ue,ze,we,Ae,Le,lt,Tt,Rt,Xe,He,rt,le,Ie,De,re,pe,Fe,et;function Re(){qe=new KL(Q),qe.init(),pe=new LA(Q,qe),Ne=new HL(Q,qe,e,pe),je=new zO(Q,qe),Ne.reversedDepthBuffer&&x&&je.buffers.depth.setReversed(!0),j=new $L(Q),B=new EO,ue=new BO(Q,qe,je,B,Ne,pe,j),ze=new ZL(O),we=new rI(Q),Fe=new kL(Q,we),Ae=new QL(Q,we,j,Fe),Le=new tN(Q,Ae,we,Fe,j),Ie=new eN(Q,Ne,ue),He=new VL(B),lt=new MO(O,ze,qe,Ne,Fe,He),Tt=new WO(O,B),Rt=new wO,Xe=new IO(qe),le=new BL(O,ze,je,Le,S,h),rt=new FO(O,Le,Ne),et=new XO(Q,j,Ne,je),De=new GL(Q,qe,j),re=new JL(Q,qe,j),j.programs=lt.programs,O.capabilities=Ne,O.extensions=qe,O.properties=B,O.renderLists=Rt,O.shadowMap=rt,O.state=je,O.info=j}Re(),C!==Br&&(U=new iN(C,t.width,t.height,i,a));const Me=new VO(O,Q);this.xr=Me,this.getContext=function(){return Q},this.getContextAttributes=function(){return Q.getContextAttributes()},this.forceContextLoss=function(){const H=qe.get("WEBGL_lose_context");H&&H.loseContext()},this.forceContextRestore=function(){const H=qe.get("WEBGL_lose_context");H&&H.restoreContext()},this.getPixelRatio=function(){return oe},this.setPixelRatio=function(H){H!==void 0&&(oe=H,this.setSize(G,Z,!1))},this.getSize=function(H){return H.set(G,Z)},this.setSize=function(H,ve,Te=!0){if(Me.isPresenting){Bt("WebGLRenderer: Can't change size while VR device is presenting.");return}G=H,Z=ve,t.width=Math.floor(H*oe),t.height=Math.floor(ve*oe),Te===!0&&(t.style.width=H+"px",t.style.height=ve+"px"),U!==null&&U.setSize(t.width,t.height),this.setViewport(0,0,H,ve)},this.getDrawingBufferSize=function(H){return H.set(G*oe,Z*oe).floor()},this.setDrawingBufferSize=function(H,ve,Te){G=H,Z=ve,oe=Te,t.width=Math.floor(H*Te),t.height=Math.floor(ve*Te),this.setViewport(0,0,H,ve)},this.setEffects=function(H){if(C===Br){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(H){for(let ve=0;ve{function ft(){if(Se.forEach(function(vt){B.get(vt).currentProgram.isReady()&&Se.delete(vt)}),Se.size===0){Ee(H);return}setTimeout(ft,10)}qe.get("KHR_parallel_shader_compile")!==null?ft():setTimeout(ft,10)})};let Hn=null;function ti(H){Hn&&Hn(H)}function ni(){Zt.stop()}function Ln(){Zt.start()}const Zt=new CA;Zt.setAnimationLoop(ti),typeof self<"u"&&Zt.setContext(self),this.setAnimationLoop=function(H){Hn=H,Me.setAnimationLoop(H),H===null?Zt.stop():Zt.start()},Me.addEventListener("sessionstart",ni),Me.addEventListener("sessionend",Ln),this.render=function(H,ve){if(ve!==void 0&&ve.isCamera!==!0){$t("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(W===!0)return;const Te=Me.enabled===!0&&Me.isPresenting===!0,Se=U!==null&&(K===null||Te)&&U.begin(O,K);if(H.matrixWorldAutoUpdate===!0&&H.updateMatrixWorld(),ve.parent===null&&ve.matrixWorldAutoUpdate===!0&&ve.updateMatrixWorld(),Me.enabled===!0&&Me.isPresenting===!0&&(U===null||U.isCompositing()===!1)&&(Me.cameraAutoUpdate===!0&&Me.updateCamera(ve),ve=Me.getCamera()),H.isScene===!0&&H.onBeforeRender(O,H,ve,K),F=Xe.get(H,z.length),F.init(ve),z.push(F),$e.multiplyMatrices(ve.projectionMatrix,ve.matrixWorldInverse),Ge.setFromProjectionMatrix($e,Ms,ve.reversedDepth),Qe=this.localClippingEnabled,ct=He.init(this.clippingPlanes,Qe),L=Rt.get(H,P.length),L.init(),P.push(L),Me.enabled===!0&&Me.isPresenting===!0){const vt=O.xr.getDepthSensingMesh();vt!==null&&jt(vt,ve,-1/0,O.sortObjects)}jt(H,ve,0,O.sortObjects),L.finish(),O.sortObjects===!0&&L.sort(he,xe),Pe=Me.enabled===!1||Me.isPresenting===!1||Me.hasDepthSensing()===!1,Pe&&le.addToRenderList(L,H),this.info.render.frame++,ct===!0&&He.beginShadows();const Ee=F.state.shadowsArray;if(rt.render(Ee,H,ve),ct===!0&&He.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Se&&U.hasRenderPass())===!1){const vt=L.opaque,yt=L.transmissive;if(F.setupLights(),ve.isArrayCamera){const xt=ve.cameras;if(yt.length>0)for(let zt=0,Ft=xt.length;zt0&&zn(vt,yt,H,ve),Pe&&le.render(H),Xn(L,H,ve)}K!==null&&Y===0&&(ue.updateMultisampleRenderTarget(K),ue.updateRenderTargetMipmap(K)),Se&&U.end(O),H.isScene===!0&&H.onAfterRender(O,H,ve),Fe.resetDefaultState(),$=-1,ie=null,z.pop(),z.length>0?(F=z[z.length-1],ct===!0&&He.setGlobalState(O.clippingPlanes,F.state.camera)):F=null,P.pop(),P.length>0?L=P[P.length-1]:L=null};function jt(H,ve,Te,Se){if(H.visible===!1)return;if(H.layers.test(ve.layers)){if(H.isGroup)Te=H.renderOrder;else if(H.isLOD)H.autoUpdate===!0&&H.update(ve);else if(H.isLight)F.pushLight(H),H.castShadow&&F.pushShadow(H);else if(H.isSprite){if(!H.frustumCulled||Ge.intersectsSprite(H)){Se&&Oe.setFromMatrixPosition(H.matrixWorld).applyMatrix4($e);const vt=Le.update(H),yt=H.material;yt.visible&&L.push(H,vt,yt,Te,Oe.z,null)}}else if((H.isMesh||H.isLine||H.isPoints)&&(!H.frustumCulled||Ge.intersectsObject(H))){const vt=Le.update(H),yt=H.material;if(Se&&(H.boundingSphere!==void 0?(H.boundingSphere===null&&H.computeBoundingSphere(),Oe.copy(H.boundingSphere.center)):(vt.boundingSphere===null&&vt.computeBoundingSphere(),Oe.copy(vt.boundingSphere.center)),Oe.applyMatrix4(H.matrixWorld).applyMatrix4($e)),Array.isArray(yt)){const xt=vt.groups;for(let zt=0,Ft=xt.length;zt0&&V(Ee,ve,Te),ft.length>0&&V(ft,ve,Te),vt.length>0&&V(vt,ve,Te),je.buffers.depth.setTest(!0),je.buffers.depth.setMask(!0),je.buffers.color.setMask(!0),je.setPolygonOffset(!1)}function zn(H,ve,Te,Se){if((Te.isScene===!0?Te.overrideMaterial:null)!==null)return;if(F.state.transmissionRenderTarget[Se.id]===void 0){const Ct=qe.has("EXT_color_buffer_half_float")||qe.has("EXT_color_buffer_float");F.state.transmissionRenderTarget[Se.id]=new ka(1,1,{generateMipmaps:!0,type:Ct?sr:Br,minFilter:Al,samples:Ne.samples,stencilBuffer:a,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Zn.workingColorSpace})}const ft=F.state.transmissionRenderTarget[Se.id],vt=Se.viewport||X;ft.setSize(vt.z*O.transmissionResolutionScale,vt.w*O.transmissionResolutionScale);const yt=O.getRenderTarget(),xt=O.getActiveCubeFace(),zt=O.getActiveMipmapLevel();O.setRenderTarget(ft),O.getClearColor(ce),fe=O.getClearAlpha(),fe<1&&O.setClearColor(16777215,.5),O.clear(),Pe&&le.render(Te);const Ft=O.toneMapping;O.toneMapping=oo;const Kt=Se.viewport;if(Se.viewport!==void 0&&(Se.viewport=void 0),F.setupLightsView(Se),ct===!0&&He.setGlobalState(O.clippingPlanes,Se),V(H,Te,Se),ue.updateMultisampleRenderTarget(ft),ue.updateRenderTargetMipmap(ft),qe.has("WEBGL_multisampled_render_to_texture")===!1){let Ct=!1;for(let qt=0,gn=ve.length;qt0),Ct=!!Te.morphAttributes.position,qt=!!Te.morphAttributes.normal,gn=!!Te.morphAttributes.color;let Bn=oo;Se.toneMapped&&(K===null||K.isXRRenderTarget===!0)&&(Bn=O.toneMapping);const en=Te.morphAttributes.position||Te.morphAttributes.normal||Te.morphAttributes.color,Wt=en!==void 0?en.length:0,Mt=B.get(Se),fn=F.state.lights;if(ct===!0&&(Qe===!0||H!==ie)){const Ei=H===ie&&Se.id===$;He.setState(Se,H,Ei)}let Nt=!1;Se.version===Mt.__version?(Mt.needsLights&&Mt.lightsStateVersion!==fn.state.version||Mt.outputColorSpace!==yt||Ee.isBatchedMesh&&Mt.batching===!1||!Ee.isBatchedMesh&&Mt.batching===!0||Ee.isBatchedMesh&&Mt.batchingColor===!0&&Ee.colorTexture===null||Ee.isBatchedMesh&&Mt.batchingColor===!1&&Ee.colorTexture!==null||Ee.isInstancedMesh&&Mt.instancing===!1||!Ee.isInstancedMesh&&Mt.instancing===!0||Ee.isSkinnedMesh&&Mt.skinning===!1||!Ee.isSkinnedMesh&&Mt.skinning===!0||Ee.isInstancedMesh&&Mt.instancingColor===!0&&Ee.instanceColor===null||Ee.isInstancedMesh&&Mt.instancingColor===!1&&Ee.instanceColor!==null||Ee.isInstancedMesh&&Mt.instancingMorph===!0&&Ee.morphTexture===null||Ee.isInstancedMesh&&Mt.instancingMorph===!1&&Ee.morphTexture!==null||Mt.envMap!==zt||Se.fog===!0&&Mt.fog!==ft||Mt.numClippingPlanes!==void 0&&(Mt.numClippingPlanes!==He.numPlanes||Mt.numIntersection!==He.numIntersection)||Mt.vertexAlphas!==Ft||Mt.vertexTangents!==Kt||Mt.morphTargets!==Ct||Mt.morphNormals!==qt||Mt.morphColors!==gn||Mt.toneMapping!==Bn||Mt.morphTargetsCount!==Wt)&&(Nt=!0):(Nt=!0,Mt.__version=Se.version);let Kn=Mt.currentProgram;Nt===!0&&(Kn=ye(Se,ve,Ee));let li=!1,Rn=!1,ci=!1;const Nn=Kn.getUniforms(),pi=Mt.uniforms;if(je.useProgram(Kn.program)&&(li=!0,Rn=!0,ci=!0),Se.id!==$&&($=Se.id,Rn=!0),li||ie!==H){je.buffers.depth.getReversed()&&H.reversedDepth!==!0&&(H._reversedDepth=!0,H.updateProjectionMatrix()),Nn.setValue(Q,"projectionMatrix",H.projectionMatrix),Nn.setValue(Q,"viewMatrix",H.matrixWorldInverse);const jr=Nn.map.cameraPosition;jr!==void 0&&jr.setValue(Q,bt.setFromMatrixPosition(H.matrixWorld)),Ne.logarithmicDepthBuffer&&Nn.setValue(Q,"logDepthBufFC",2/(Math.log(H.far+1)/Math.LN2)),(Se.isMeshPhongMaterial||Se.isMeshToonMaterial||Se.isMeshLambertMaterial||Se.isMeshBasicMaterial||Se.isMeshStandardMaterial||Se.isShaderMaterial)&&Nn.setValue(Q,"isOrthographic",H.isOrthographicCamera===!0),ie!==H&&(ie=H,Rn=!0,ci=!0)}if(Mt.needsLights&&(fn.state.directionalShadowMap.length>0&&Nn.setValue(Q,"directionalShadowMap",fn.state.directionalShadowMap,ue),fn.state.spotShadowMap.length>0&&Nn.setValue(Q,"spotShadowMap",fn.state.spotShadowMap,ue),fn.state.pointShadowMap.length>0&&Nn.setValue(Q,"pointShadowMap",fn.state.pointShadowMap,ue)),Ee.isSkinnedMesh){Nn.setOptional(Q,Ee,"bindMatrix"),Nn.setOptional(Q,Ee,"bindMatrixInverse");const Ei=Ee.skeleton;Ei&&(Ei.boneTexture===null&&Ei.computeBoneTexture(),Nn.setValue(Q,"boneTexture",Ei.boneTexture,ue))}Ee.isBatchedMesh&&(Nn.setOptional(Q,Ee,"batchingTexture"),Nn.setValue(Q,"batchingTexture",Ee._matricesTexture,ue),Nn.setOptional(Q,Ee,"batchingIdTexture"),Nn.setValue(Q,"batchingIdTexture",Ee._indirectTexture,ue),Nn.setOptional(Q,Ee,"batchingColorTexture"),Ee._colorsTexture!==null&&Nn.setValue(Q,"batchingColorTexture",Ee._colorsTexture,ue));const Ji=Te.morphAttributes;if((Ji.position!==void 0||Ji.normal!==void 0||Ji.color!==void 0)&&Ie.update(Ee,Te,Kn),(Rn||Mt.receiveShadow!==Ee.receiveShadow)&&(Mt.receiveShadow=Ee.receiveShadow,Nn.setValue(Q,"receiveShadow",Ee.receiveShadow)),(Se.isMeshStandardMaterial||Se.isMeshLambertMaterial||Se.isMeshPhongMaterial)&&Se.envMap===null&&ve.environment!==null&&(pi.envMapIntensity.value=ve.environmentIntensity),pi.dfgLUT!==void 0&&(pi.dfgLUT.value=YO()),Rn&&(Nn.setValue(Q,"toneMappingExposure",O.toneMappingExposure),Mt.needsLights&&wt(pi,ci),ft&&Se.fog===!0&&Tt.refreshFogUniforms(pi,ft),Tt.refreshMaterialUniforms(pi,Se,oe,Z,F.state.transmissionRenderTarget[H.id]),hy.upload(Q,We(Mt),pi,ue)),Se.isShaderMaterial&&Se.uniformsNeedUpdate===!0&&(hy.upload(Q,We(Mt),pi,ue),Se.uniformsNeedUpdate=!1),Se.isSpriteMaterial&&Nn.setValue(Q,"center",Ee.center),Nn.setValue(Q,"modelViewMatrix",Ee.modelViewMatrix),Nn.setValue(Q,"normalMatrix",Ee.normalMatrix),Nn.setValue(Q,"modelMatrix",Ee.matrixWorld),Se.isShaderMaterial||Se.isRawShaderMaterial){const Ei=Se.uniformsGroups;for(let jr=0,aa=Ei.length;jr0&&ue.useMultisampledRTT(H)===!1?Se=B.get(H).__webglMultisampledFramebuffer:Array.isArray(zt)?Se=zt[Te]:Se=zt,X.copy(H.viewport),te.copy(H.scissor),ge=H.scissorTest}else X.copy(ae).multiplyScalar(oe).floor(),te.copy(de).multiplyScalar(oe).floor(),ge=me;if(Te!==0&&(Se=Dt),je.bindFramebuffer(Q.FRAMEBUFFER,Se)&&je.drawBuffers(H,Se),je.viewport(X),je.scissor(te),je.setScissorTest(ge),Ee){const yt=B.get(H.texture);Q.framebufferTexture2D(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Q.TEXTURE_CUBE_MAP_POSITIVE_X+ve,yt.__webglTexture,Te)}else if(ft){const yt=ve;for(let xt=0;xt1&&Q.readBuffer(Q.COLOR_ATTACHMENT0+yt),!Ne.textureFormatReadable(Ft)){$t("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ne.textureTypeReadable(Kt)){$t("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ve>=0&&ve<=H.width-Se&&Te>=0&&Te<=H.height-Ee&&Q.readPixels(ve,Te,Se,Ee,pe.convert(Ft),pe.convert(Kt),ft)}finally{const zt=K!==null?B.get(K).__webglFramebuffer:null;je.bindFramebuffer(Q.FRAMEBUFFER,zt)}}},this.readRenderTargetPixelsAsync=async function(H,ve,Te,Se,Ee,ft,vt,yt=0){if(!(H&&H.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let xt=B.get(H).__webglFramebuffer;if(H.isWebGLCubeRenderTarget&&vt!==void 0&&(xt=xt[vt]),xt)if(ve>=0&&ve<=H.width-Se&&Te>=0&&Te<=H.height-Ee){je.bindFramebuffer(Q.FRAMEBUFFER,xt);const zt=H.textures[yt],Ft=zt.format,Kt=zt.type;if(H.textures.length>1&&Q.readBuffer(Q.COLOR_ATTACHMENT0+yt),!Ne.textureFormatReadable(Ft))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ne.textureTypeReadable(Kt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ct=Q.createBuffer();Q.bindBuffer(Q.PIXEL_PACK_BUFFER,Ct),Q.bufferData(Q.PIXEL_PACK_BUFFER,ft.byteLength,Q.STREAM_READ),Q.readPixels(ve,Te,Se,Ee,pe.convert(Ft),pe.convert(Kt),0);const qt=K!==null?B.get(K).__webglFramebuffer:null;je.bindFramebuffer(Q.FRAMEBUFFER,qt);const gn=Q.fenceSync(Q.SYNC_GPU_COMMANDS_COMPLETE,0);return Q.flush(),await cR(Q,gn,4),Q.bindBuffer(Q.PIXEL_PACK_BUFFER,Ct),Q.getBufferSubData(Q.PIXEL_PACK_BUFFER,0,ft),Q.deleteBuffer(Ct),Q.deleteSync(gn),ft}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(H,ve=null,Te=0){const Se=Math.pow(2,-Te),Ee=Math.floor(H.image.width*Se),ft=Math.floor(H.image.height*Se),vt=ve!==null?ve.x:0,yt=ve!==null?ve.y:0;ue.setTexture2D(H,0),Q.copyTexSubImage2D(Q.TEXTURE_2D,Te,0,0,vt,yt,Ee,ft),je.unbindTexture()};const Ut=Q.createFramebuffer(),Lt=Q.createFramebuffer();this.copyTextureToTexture=function(H,ve,Te=null,Se=null,Ee=0,ft=0){let vt,yt,xt,zt,Ft,Kt,Ct,qt,gn;const Bn=H.isCompressedTexture?H.mipmaps[ft]:H.image;if(Te!==null)vt=Te.max.x-Te.min.x,yt=Te.max.y-Te.min.y,xt=Te.isBox3?Te.max.z-Te.min.z:1,zt=Te.min.x,Ft=Te.min.y,Kt=Te.isBox3?Te.min.z:0;else{const pi=Math.pow(2,-Ee);vt=Math.floor(Bn.width*pi),yt=Math.floor(Bn.height*pi),H.isDataArrayTexture?xt=Bn.depth:H.isData3DTexture?xt=Math.floor(Bn.depth*pi):xt=1,zt=0,Ft=0,Kt=0}Se!==null?(Ct=Se.x,qt=Se.y,gn=Se.z):(Ct=0,qt=0,gn=0);const en=pe.convert(ve.format),Wt=pe.convert(ve.type);let Mt;ve.isData3DTexture?(ue.setTexture3D(ve,0),Mt=Q.TEXTURE_3D):ve.isDataArrayTexture||ve.isCompressedArrayTexture?(ue.setTexture2DArray(ve,0),Mt=Q.TEXTURE_2D_ARRAY):(ue.setTexture2D(ve,0),Mt=Q.TEXTURE_2D),Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL,ve.flipY),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ve.premultiplyAlpha),Q.pixelStorei(Q.UNPACK_ALIGNMENT,ve.unpackAlignment);const fn=Q.getParameter(Q.UNPACK_ROW_LENGTH),Nt=Q.getParameter(Q.UNPACK_IMAGE_HEIGHT),Kn=Q.getParameter(Q.UNPACK_SKIP_PIXELS),li=Q.getParameter(Q.UNPACK_SKIP_ROWS),Rn=Q.getParameter(Q.UNPACK_SKIP_IMAGES);Q.pixelStorei(Q.UNPACK_ROW_LENGTH,Bn.width),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,Bn.height),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,zt),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,Ft),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,Kt);const ci=H.isDataArrayTexture||H.isData3DTexture,Nn=ve.isDataArrayTexture||ve.isData3DTexture;if(H.isDepthTexture){const pi=B.get(H),Ji=B.get(ve),Ei=B.get(pi.__renderTarget),jr=B.get(Ji.__renderTarget);je.bindFramebuffer(Q.READ_FRAMEBUFFER,Ei.__webglFramebuffer),je.bindFramebuffer(Q.DRAW_FRAMEBUFFER,jr.__webglFramebuffer);for(let aa=0;aa"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:f;return L_.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:m,L_}var QE;function QO(){return QE||(QE=1,I_.exports=KO()),I_.exports}var JE;function JO(){if(JE)return U_;JE=1;var s=v0(),e=QO();function t(p,m){return p===m&&(p!==0||1/p===1/m)||p!==p&&m!==m}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,a=s.useRef,c=s.useEffect,f=s.useMemo,h=s.useDebugValue;return U_.useSyncExternalStoreWithSelector=function(p,m,y,x,_){var S=a(null);if(S.current===null){var C={hasValue:!1,value:null};S.current=C}else C=S.current;S=f(function(){function E(P){if(!R){if(R=!0,I=P,P=x(P),_!==void 0&&C.hasValue){var z=C.value;if(_(z,P))return L=z}return L=P}if(z=L,n(I,P))return z;var U=x(P);return _!==void 0&&_(z,U)?(I=P,z):(I=P,L=U)}var R=!1,I,L,F=y===void 0?null:y;return[function(){return E(m())},F===null?void 0:function(){return E(F())}]},[m,y,x,_]);var T=i(p,S[0],S[1]);return c(function(){C.hasValue=!0,C.value=T},[T]),h(T),T},U_}var $E;function $O(){return $E||($E=1,D_.exports=JO()),D_.exports}var eP=$O();const tP=Sb(eP),eT=s=>{let e;const t=new Set,n=(p,m)=>{const y=typeof p=="function"?p(e):p;if(!Object.is(y,e)){const x=e;e=m??(typeof y!="object"||y===null)?y:Object.assign({},e,y),t.forEach(_=>_(e,x))}},i=()=>e,f={setState:n,getState:i,getInitialState:()=>h,subscribe:p=>(t.add(p),()=>t.delete(p))},h=e=s(n,i,f);return f},nP=(s=>s?eT(s):eT),{useSyncExternalStoreWithSelector:iP}=tP,rP=s=>s;function aP(s,e=rP,t){const n=iP(s.subscribe,s.getState,s.getInitialState,e,t);return Tl.useDebugValue(n),n}const tT=(s,e)=>{const t=nP(s),n=(i,a=e)=>aP(t,i,a);return Object.assign(n,t),n},NA=((s,e)=>s?tT(s,e):tT),sP=s=>typeof s=="object"&&typeof s.then=="function",kf=[];function OA(s,e,t=(n,i)=>n===i){if(s===e)return!0;if(!s||!e)return!1;const n=s.length;if(e.length!==n)return!1;for(let i=0;i0&&(a.timeout&&clearTimeout(a.timeout),a.timeout=setTimeout(a.remove,n.lifespan)),a.response;if(!t)throw a.promise}const i={keys:e,equal:n.equal,remove:()=>{const a=kf.indexOf(i);a!==-1&&kf.splice(a,1)},promise:(sP(s)?s:s(...e)).then(a=>{i.response=a,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(a=>i.error=a)};if(kf.push(i),!t)throw i.promise}const FA=(s,e,t)=>PA(s,e,!1,t),oP=(s,e,t)=>{PA(s,e,!0,t)},lP=s=>{if(s===void 0||s.length===0)kf.splice(0,kf.length);else{const e=kf.find(t=>OA(s,t.keys,t.equal));e&&e.remove()}};var ub=GT();const cP=Sb(ub);function fS(s,e,t){if(!s)return;if(t(s)===!0)return s;let n=e?s.return:s.child;for(;n;){const i=fS(n,e,t);if(i)return i;n=e?null:n.sibling}}function zA(s){try{return Object.defineProperties(s,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return s}}const hS=zA(Ce.createContext(null));class BA extends Ce.Component{render(){return Ce.createElement(hS.Provider,{value:this._reactInternals},this.props.children)}}function kA(){const s=Ce.useContext(hS);if(s===null)throw new Error("its-fine: useFiber must be called within a !");const e=Ce.useId();return Ce.useMemo(()=>{for(const t of[s,s?.alternate]){if(!t)continue;const n=fS(t,!1,i=>{let a=i.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(n)return n}},[s,e])}const uP=Symbol.for("react.context"),fP=s=>s!==null&&typeof s=="object"&&"$$typeof"in s&&s.$$typeof===uP;function hP(){const s=kA(),[e]=Ce.useState(()=>new Map);e.clear();let t=s;for(;t;){const n=t.type;fP(n)&&n!==hS&&!e.has(n)&&e.set(n,Ce.use(zA(n))),t=t.return}return e}function dP(){const s=hP();return Ce.useMemo(()=>Array.from(s.keys()).reduce((e,t)=>n=>Ce.createElement(e,null,Ce.createElement(t.Provider,{...n,value:s.get(t)})),e=>Ce.createElement(BA,{...e})),[s])}function GA(s){let e=s.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const HA=s=>s&&s.isOrthographicCamera,pP=s=>s&&s.hasOwnProperty("current"),mP=s=>s!=null&&(typeof s=="string"||typeof s=="number"||s.isColor),D0=((s,e)=>typeof window<"u"&&(((s=window.document)==null?void 0:s.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?Ce.useLayoutEffect:Ce.useEffect;function dS(s){const e=Ce.useRef(s);return D0(()=>{e.current=s},[s]),e}function gP(){const s=kA(),e=dP();return Ce.useMemo(()=>({children:t})=>{const i=!!fS(s,!0,a=>a.type===Ce.StrictMode)?Ce.StrictMode:Ce.Fragment;return A.jsx(i,{children:A.jsx(e,{children:t})})},[s,e])}function vP({set:s}){return D0(()=>(s(new Promise(()=>null)),()=>s(!1)),[s]),null}const yP=(s=>(s=class extends Ce.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},s.getDerivedStateFromError=()=>({error:!0}),s))();function VA(s){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(s)?Math.min(Math.max(s[0],t),s[1]):s}function Sd(s){var e;return(e=s.__r3f)==null?void 0:e.root.getState()}const Hi={obj:s=>s===Object(s)&&!Hi.arr(s)&&typeof s!="function",fun:s=>typeof s=="function",str:s=>typeof s=="string",num:s=>typeof s=="number",boo:s=>typeof s=="boolean",und:s=>s===void 0,nul:s=>s===null,arr:s=>Array.isArray(s),equ(s,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof s!=typeof e||!!s!=!!e)return!1;if(Hi.str(s)||Hi.num(s)||Hi.boo(s))return s===e;const a=Hi.obj(s);if(a&&n==="reference")return s===e;const c=Hi.arr(s);if(c&&t==="reference")return s===e;if((c||a)&&s===e)return!0;let f;for(f in s)if(!(f in e))return!1;if(a&&t==="shallow"&&n==="shallow"){for(f in i?e:s)if(!Hi.equ(s[f],e[f],{strict:i,objects:"reference"}))return!1}else for(f in i?e:s)if(s[f]!==e[f])return!1;if(Hi.und(f)){if(c&&s.length===0&&e.length===0||a&&Object.keys(s).length===0&&Object.keys(e).length===0)return!0;if(s!==e)return!1}return!0}};function xP(s){const e={nodes:{},materials:{},meshes:{}};return s&&s.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material),t.isMesh&&!e.meshes[t.name]&&(e.meshes[t.name]=t)}),e}function _P(s){s.type!=="Scene"&&(s.dispose==null||s.dispose());for(const e in s){const t=s[e];t?.type!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const jA=["children","key","ref"];function bP(s){const e={};for(const t in s)jA.includes(t)||(e[t]=s[t]);return e}function ux(s,e,t,n){const i=s;let a=i?.__r3f;return a||(a={root:e,type:t,parent:null,children:[],props:bP(n),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=a)),a}function p0(s,e){if(!e.includes("-"))return{root:s,key:e,target:s[e]};if(e in s)return{root:s,key:e,target:s[e]};let t=s;const n=e.split("-");for(const i of n){if(typeof t!="object"||t===null){if(t!==void 0){const a=n.slice(n.indexOf(i)).join("-");return{root:t,key:a,target:void 0}}return{root:s,key:e,target:void 0}}e=i,s=t,t=t[e]}return{root:s,key:e,target:t}}const nT=/-\d+$/;function fx(s,e){if(Hi.str(e.props.attach)){if(nT.test(e.props.attach)){const i=e.props.attach.replace(nT,""),{root:a,key:c}=p0(s.object,i);Array.isArray(a[c])||(a[c]=[])}const{root:t,key:n}=p0(s.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else Hi.fun(e.props.attach)&&(e.previousAttach=e.props.attach(s.object,e.object))}function hx(s,e){if(Hi.str(e.props.attach)){const{root:t,key:n}=p0(s.object,e.props.attach),i=e.previousAttach;i===void 0?delete t[n]:t[n]=i}else e.previousAttach==null||e.previousAttach(s.object,e.object);delete e.previousAttach}const fb=[...jA,"args","dispose","attach","object","onUpdate","dispose"],iT=new Map;function SP(s){let e=iT.get(s.constructor);try{e||(e=new s.constructor,iT.set(s.constructor,e))}catch{}return e}function MP(s,e){const t={};for(const n in e)if(!fb.includes(n)&&!Hi.equ(e[n],s.props[n])){t[n]=e[n];for(const i in e)i.startsWith(`${n}-`)&&(t[i]=e[i])}for(const n in s.props){if(fb.includes(n)||e.hasOwnProperty(n))continue;const{root:i,key:a}=p0(s.object,n);if(i.constructor&&i.constructor.length===0){const c=SP(i);Hi.und(c)||(t[a]=c[a])}else t[a]=0}return t}const EP=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],TP=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function wl(s,e){var t;const n=s.__r3f,i=n&&GA(n).getState(),a=n?.eventCount;for(const f in e){let h=e[f];if(fb.includes(f))continue;if(n&&TP.test(f)){typeof h=="function"?n.handlers[f]=h:delete n.handlers[f],n.eventCount=Object.keys(n.handlers).length;continue}if(h===void 0)continue;let{root:p,key:m,target:y}=p0(s,f);if(y===void 0&&(typeof p!="object"||p===null))throw Error(`R3F: Cannot set "${f}". Ensure it is an object before setting "${m}".`);if(y instanceof Pd&&h instanceof Pd)y.mask=h.mask;else if(y instanceof kt&&mP(h))y.set(h);else if(y!==null&&typeof y=="object"&&typeof y.set=="function"&&typeof y.copy=="function"&&h!=null&&h.constructor&&y.constructor===h.constructor)y.copy(h);else if(y!==null&&typeof y=="object"&&typeof y.set=="function"&&Array.isArray(h))typeof y.fromArray=="function"?y.fromArray(h):y.set(...h);else if(y!==null&&typeof y=="object"&&typeof y.set=="function"&&typeof h=="number")typeof y.setScalar=="function"?y.setScalar(h):y.set(h);else{var c;p[m]=h,i&&!i.linear&&EP.includes(m)&&(c=p[m])!=null&&c.isTexture&&p[m].format===mr&&p[m].type===Br&&(p[m].colorSpace=ia)}}if(n!=null&&n.parent&&i!=null&&i.internal&&(t=n.object)!=null&&t.isObject3D&&a!==n.eventCount){const f=n.object,h=i.internal.interaction.indexOf(f);h>-1&&i.internal.interaction.splice(h,1),n.eventCount&&f.raycast!==null&&i.internal.interaction.push(f)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&Yd(n),s}function Yd(s){var e;if(!s.parent)return;s.props.onUpdate==null||s.props.onUpdate(s.object);const t=(e=s.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function WA(s,e){s.manual||(HA(s)?(s.left=e.width/-2,s.right=e.width/2,s.top=e.height/2,s.bottom=e.height/-2):s.aspect=e.width/e.height,s.updateProjectionMatrix())}const za=s=>s?.isObject3D;function ty(s){return(s.eventObject||s.object).uuid+"/"+s.index+s.instanceId}function XA(s,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(s.delete(n),i.target.releasePointerCapture(n)))}function wP(s,e){const{internal:t}=s.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{XA(t.capturedMap,e,n,i)})}function AP(s){function e(h){const{internal:p}=s.getState(),m=h.offsetX-p.initialClick[0],y=h.offsetY-p.initialClick[1];return Math.round(Math.sqrt(m*m+y*y))}function t(h){return h.filter(p=>["Move","Over","Enter","Out","Leave"].some(m=>{var y;return(y=p.__r3f)==null?void 0:y.handlers["onPointer"+m]}))}function n(h,p){const m=s.getState(),y=new Set,x=[],_=p?p(m.internal.interaction):m.internal.interaction;for(let E=0;E<_.length;E++){const R=Sd(_[E]);R&&(R.raycaster.camera=void 0)}m.previousRoot||m.events.compute==null||m.events.compute(h,m);function S(E){const R=Sd(E);if(!R||!R.events.enabled||R.raycaster.camera===null)return[];if(R.raycaster.camera===void 0){var I;R.events.compute==null||R.events.compute(h,R,(I=R.previousRoot)==null?void 0:I.getState()),R.raycaster.camera===void 0&&(R.raycaster.camera=null)}return R.raycaster.camera?R.raycaster.intersectObject(E,!0):[]}let C=_.flatMap(S).sort((E,R)=>{const I=Sd(E.object),L=Sd(R.object);return!I||!L?E.distance-R.distance:L.events.priority-I.events.priority||E.distance-R.distance}).filter(E=>{const R=ty(E);return y.has(R)?!1:(y.add(R),!0)});m.events.filter&&(C=m.events.filter(C,m));for(const E of C){let R=E.object;for(;R;){var T;(T=R.__r3f)!=null&&T.eventCount&&x.push({...E,eventObject:R}),R=R.parent}}if("pointerId"in h&&m.internal.capturedMap.has(h.pointerId))for(let E of m.internal.capturedMap.get(h.pointerId).values())y.has(ty(E.intersection))||x.push(E.intersection);return x}function i(h,p,m,y){if(h.length){const x={stopped:!1};for(const _ of h){let S=Sd(_.object);if(S||_.object.traverseAncestors(C=>{const T=Sd(C);if(T)return S=T,!1}),S){const{raycaster:C,pointer:T,camera:E,internal:R}=S,I=new se(T.x,T.y,0).unproject(E),L=O=>{var W,q;return(W=(q=R.capturedMap.get(O))==null?void 0:q.has(_.eventObject))!=null?W:!1},F=O=>{const W={intersection:_,target:p.target};R.capturedMap.has(O)?R.capturedMap.get(O).set(_.eventObject,W):R.capturedMap.set(O,new Map([[_.eventObject,W]])),p.target.setPointerCapture(O)},P=O=>{const W=R.capturedMap.get(O);W&&XA(R.capturedMap,_.eventObject,W,O)};let z={};for(let O in p){let W=p[O];typeof W!="function"&&(z[O]=W)}let U={..._,...z,pointer:T,intersections:h,stopped:x.stopped,delta:m,unprojectedPoint:I,ray:C.ray,camera:E,stopPropagation(){const O="pointerId"in p&&R.capturedMap.get(p.pointerId);if((!O||O.has(_.eventObject))&&(U.stopped=x.stopped=!0,R.hovered.size&&Array.from(R.hovered.values()).find(W=>W.eventObject===_.eventObject))){const W=h.slice(0,h.indexOf(_));a([...W,_])}},target:{hasPointerCapture:L,setPointerCapture:F,releasePointerCapture:P},currentTarget:{hasPointerCapture:L,setPointerCapture:F,releasePointerCapture:P},nativeEvent:p};if(y(U),x.stopped===!0)break}}}return h}function a(h){const{internal:p}=s.getState();for(const m of p.hovered.values())if(!h.length||!h.find(y=>y.object===m.object&&y.index===m.index&&y.instanceId===m.instanceId)){const x=m.eventObject.__r3f;if(p.hovered.delete(ty(m)),x!=null&&x.eventCount){const _=x.handlers,S={...m,intersections:h};_.onPointerOut==null||_.onPointerOut(S),_.onPointerLeave==null||_.onPointerLeave(S)}}}function c(h,p){for(let m=0;ma([]);case"onLostPointerCapture":return p=>{const{internal:m}=s.getState();"pointerId"in p&&m.capturedMap.has(p.pointerId)&&requestAnimationFrame(()=>{m.capturedMap.has(p.pointerId)&&(m.capturedMap.delete(p.pointerId),a([]))})}}return function(m){const{onPointerMissed:y,internal:x}=s.getState();x.lastEvent.current=m;const _=h==="onPointerMove",S=h==="onClick"||h==="onContextMenu"||h==="onDoubleClick",T=n(m,_?t:void 0),E=S?e(m):0;h==="onPointerDown"&&(x.initialClick=[m.offsetX,m.offsetY],x.initialHits=T.map(I=>I.eventObject)),S&&!T.length&&E<=2&&(c(m,x.interaction),y&&y(m)),_&&a(T);function R(I){const L=I.eventObject,F=L.__r3f;if(!(F!=null&&F.eventCount))return;const P=F.handlers;if(_){if(P.onPointerOver||P.onPointerEnter||P.onPointerOut||P.onPointerLeave){const z=ty(I),U=x.hovered.get(z);U?U.stopped&&I.stopPropagation():(x.hovered.set(z,I),P.onPointerOver==null||P.onPointerOver(I),P.onPointerEnter==null||P.onPointerEnter(I))}P.onPointerMove==null||P.onPointerMove(I)}else{const z=P[h];z?(!S||x.initialHits.includes(L))&&(c(m,x.interaction.filter(U=>!x.initialHits.includes(U))),z(I)):S&&x.initialHits.includes(L)&&c(m,x.interaction.filter(U=>!x.initialHits.includes(U)))}}i(T,m,E,R)}}return{handlePointer:f}}const rT=s=>!!(s!=null&&s.render),pS=Ce.createContext(null),CP=(s,e)=>{const t=NA((f,h)=>{const p=new se,m=new se,y=new se;function x(E=h().camera,R=m,I=h().size){const{width:L,height:F,top:P,left:z}=I,U=L/F;R.isVector3?y.copy(R):y.set(...R);const O=E.getWorldPosition(p).distanceTo(y);if(HA(E))return{width:L/E.zoom,height:F/E.zoom,top:P,left:z,factor:1,distance:O,aspect:U};{const W=E.fov*Math.PI/180,q=2*Math.tan(W/2)*O,Y=q*(L/F);return{width:Y,height:q,top:P,left:z,factor:L/Y,distance:O,aspect:U}}}let _;const S=E=>f(R=>({performance:{...R.performance,current:E}})),C=new pt;return{set:f,get:h,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(E=1)=>s(h(),E),advance:(E,R)=>e(E,R,h()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new wA,pointer:C,mouse:C,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const E=h();_&&clearTimeout(_),E.performance.current!==E.performance.min&&S(E.performance.min),_=setTimeout(()=>S(h().performance.max),E.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:x},setEvents:E=>f(R=>({...R,events:{...R.events,...E}})),setSize:(E,R,I=0,L=0)=>{const F=h().camera,P={width:E,height:R,top:I,left:L};f(z=>({size:P,viewport:{...z.viewport,...x(F,m,P)}}))},setDpr:E=>f(R=>{const I=VA(E);return{viewport:{...R.viewport,dpr:I,initialDpr:R.viewport.initialDpr||I}}}),setFrameloop:(E="always")=>{const R=h().clock;R.stop(),R.elapsedTime=0,E!=="never"&&(R.start(),R.elapsedTime=0),f(()=>({frameloop:E}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:Ce.createRef(),active:!1,frames:0,priority:0,subscribe:(E,R,I)=>{const L=h().internal;return L.priority=L.priority+(R>0?1:0),L.subscribers.push({ref:E,priority:R,store:I}),L.subscribers=L.subscribers.sort((F,P)=>F.priority-P.priority),()=>{const F=h().internal;F!=null&&F.subscribers&&(F.priority=F.priority-(R>0?1:0),F.subscribers=F.subscribers.filter(P=>P.ref!==E))}}}}}),n=t.getState();let i=n.size,a=n.viewport.dpr,c=n.camera;return t.subscribe(()=>{const{camera:f,size:h,viewport:p,gl:m,set:y}=t.getState();if(h.width!==i.width||h.height!==i.height||p.dpr!==a){i=h,a=p.dpr,WA(f,h),p.dpr>0&&m.setPixelRatio(p.dpr);const x=typeof HTMLCanvasElement<"u"&&m.domElement instanceof HTMLCanvasElement;m.setSize(h.width,h.height,x)}f!==c&&(c=f,y(x=>({viewport:{...x.viewport,...x.viewport.getCurrentViewport(f)}})))}),t.subscribe(f=>s(f)),t};function mS(){const s=Ce.useContext(pS);if(!s)throw new Error("R3F: Hooks can only be used within the Canvas component!");return s}function _a(s=t=>t,e){return mS()(s,e)}function ra(s,e=0){const t=mS(),n=t.getState().internal.subscribe,i=dS(s);return D0(()=>n(i,e,t),[e,n,t]),null}const aT=new WeakMap,RP=s=>{var e;return typeof s=="function"&&(s==null||(e=s.prototype)==null?void 0:e.constructor)===s};function qA(s,e){return function(t,...n){let i;return RP(t)?(i=aT.get(t),i||(i=new t,aT.set(t,i))):i=t,s&&s(i),Promise.all(n.map(a=>new Promise((c,f)=>i.load(a,h=>{za(h?.scene)&&Object.assign(h,xP(h.scene)),c(h)},e,h=>f(new Error(`Could not load ${a}: ${h?.message}`))))))}}function kd(s,e,t,n){const i=Array.isArray(e)?e:[e],a=FA(qA(t,n),[s,...i],{equal:Hi.equ});return Array.isArray(e)?a:a[0]}kd.preload=function(s,e,t){const n=Array.isArray(e)?e:[e];return oP(qA(t),[s,...n])};kd.clear=function(s,e){const t=Array.isArray(e)?e:[e];return lP([s,...t])};const DP=1,UP=8,IP=32,LP=2;var NP={version:"9.5.0"};function OP(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var sT={exports:{}},oT={exports:{}},lT;function PP(){return lT||(lT=1,(function(s){s.exports=function(e){function t(l,u,v,b){return new pp(l,u,v,b)}function n(){}function i(l){var u="https://react.dev/errors/"+l;if(1ic||(l.current=Fh[ic],Fh[ic]=null,ic--)}function S(l,u){ic++,Fh[ic]=l.current,l.current=u}function C(l){return l>>>=0,l===0?32:31-(zh(l)/Hg|0)|0}function T(l){var u=l&42;if(u!==0)return u;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function E(l,u,v){var b=l.pendingLanes;if(b===0)return 0;var D=0,N=l.suspendedLanes,J=l.pingedLanes;l=l.warmLanes;var be=b&134217727;return be!==0?(b=be&~N,b!==0?D=T(b):(J&=be,J!==0?D=T(J):v||(v=be&~l,v!==0&&(D=T(v))))):(be=b&~N,be!==0?D=T(be):J!==0?D=T(J):v||(v=b&~l,v!==0&&(D=T(v)))),D===0?0:u!==0&&u!==D&&(u&N)===0&&(N=D&-D,v=u&-u,N>=v||N===32&&(v&4194048)!==0)?u:D}function R(l,u){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&u)===0}function I(l,u){switch(l){case 1:case 2:case 4:case 8:case 64:return u+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function L(){var l=Yc;return Yc<<=1,(Yc&62914560)===0&&(Yc=4194304),l}function F(l){for(var u=[],v=0;31>v;v++)u.push(l);return u}function P(l,u){l.pendingLanes|=u,u!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function z(l,u,v,b,D,N){var J=l.pendingLanes;l.pendingLanes=v,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=v,l.entangledLanes&=v,l.errorRecoveryDisabledLanes&=v,l.shellSuspendCounter=0;var be=l.entanglements,st=l.expirationTimes,Et=l.hiddenUpdates;for(v=J&~v;0)":-1D||st[b]!==Et[D]){var Pt=` +`+st[b].replace(" at new "," at ");return l.displayName&&Pt.includes("")&&(Pt=Pt.replace("",l.displayName)),Pt}while(1<=b&&0<=D);break}}}finally{sf=!1,Error.prepareStackTrace=v}return(v=l?l.displayName||l.name:"")?ie(v):""}function te(l,u){switch(l.tag){case 26:case 27:case 5:return ie(l.type);case 16:return ie("Lazy");case 13:return l.child!==u&&u!==null?ie("Suspense Fallback"):ie("Suspense");case 19:return ie("SuspenseList");case 0:case 15:return X(l.type,!1);case 11:return X(l.type.render,!1);case 1:return X(l.type,!0);case 31:return ie("Activity");default:return""}}function ge(l){try{var u="",v=null;do u+=te(l,v),v=l,l=l.return;while(l);return u}catch(b){return` +Error generating stack: `+b.message+` +`+b.stack}}function ce(l,u){if(typeof l=="object"&&l!==null){var v=em.get(l);return v!==void 0?v:(u={value:l,source:u,stack:ge(u)},em.set(l,u),u)}return{value:l,source:u,stack:ge(u)}}function fe(l,u){So[Zs++]=of,So[Zs++]=fi,fi=l,of=u}function G(l,u,v){ts[Ua++]=Tr,ts[Ua++]=vs,ts[Ua++]=ns,ns=l;var b=Tr;l=vs;var D=32-fa(b)-1;b&=~(1<>=J,D-=J,Tr=1<<32-fa(u)+D|v<qn?(br=sn,sn=null):br=sn.sibling;var Jn=Vt(Ke,sn,nt[qn],Ot);if(Jn===null){sn===null&&(sn=br);break}l&&sn&&Jn.alternate===null&&u(Ke,sn),ke=N(Jn,ke,qn),Pi===null?an=Jn:Pi.sibling=Jn,Pi=Jn,sn=br}if(qn===nt.length)return v(Ke,sn),Pn&&fe(Ke,qn),an;if(sn===null){for(;qnqn?(br=sn,sn=null):br=sn.sibling;var cs=Vt(Ke,sn,Jn.value,Ot);if(cs===null){sn===null&&(sn=br);break}l&&sn&&cs.alternate===null&&u(Ke,sn),ke=N(cs,ke,qn),Pi===null?an=cs:Pi.sibling=cs,Pi=cs,sn=br}if(Jn.done)return v(Ke,sn),Pn&&fe(Ke,qn),an;if(sn===null){for(;!Jn.done;qn++,Jn=nt.next())Jn=At(Ke,Jn.value,Ot),Jn!==null&&(ke=N(Jn,ke,qn),Pi===null?an=Jn:Pi.sibling=Jn,Pi=Jn);return Pn&&fe(Ke,qn),an}for(sn=b(sn);!Jn.done;qn++,Jn=nt.next())Jn=mn(sn,Ke,qn,Jn.value,Ot),Jn!==null&&(l&&Jn.alternate!==null&&sn.delete(Jn.key===null?qn:Jn.key),ke=N(Jn,ke,qn),Pi===null?an=Jn:Pi.sibling=Jn,Pi=Jn);return l&&sn.forEach(function(d1){return u(Ke,d1)}),Pn&&fe(Ke,qn),an}function _l(Ke,ke,nt,Ot){if(typeof nt=="object"&&nt!==null&&nt.type===Kl&&nt.key===null&&(nt=nt.props.children),typeof nt=="object"&&nt!==null){switch(nt.$$typeof){case Xs:e:{for(var an=nt.key;ke!==null;){if(ke.key===an){if(an=nt.type,an===Kl){if(ke.tag===7){v(Ke,ke.sibling),Ot=D(ke,nt.props.children),Ot.return=Ke,Ke=Ot;break e}}else if(ke.elementType===an||typeof an=="object"&&an!==null&&an.$$typeof===Yr&&It(an)===ke.type){v(Ke,ke.sibling),Ot=D(ke,nt.props),Cn(Ot,nt),Ot.return=Ke,Ke=Ot;break e}v(Ke,ke);break}else u(Ke,ke);ke=ke.sibling}nt.type===Kl?(Ot=Qa(nt.props.children,Ke.mode,Ot,nt.key),Ot.return=Ke,Ke=Ot):(Ot=vo(nt.type,nt.key,nt.props,null,Ke.mode,Ot),Cn(Ot,nt),Ot.return=Ke,Ke=Ot)}return J(Ke);case Zl:e:{for(an=nt.key;ke!==null;){if(ke.key===an)if(ke.tag===4&&ke.stateNode.containerInfo===nt.containerInfo&&ke.stateNode.implementation===nt.implementation){v(Ke,ke.sibling),Ot=D(ke,nt.children||[]),Ot.return=Ke,Ke=Ot;break e}else{v(Ke,ke);break}else u(Ke,ke);ke=ke.sibling}Ot=vp(nt,Ke.mode,Ot),Ot.return=Ke,Ke=Ot}return J(Ke);case Yr:return nt=It(nt),_l(Ke,ke,nt,Ot)}if(sl(nt))return Zi(Ke,ke,nt,Ot);if(m(nt)){if(an=m(nt),typeof an!="function")throw Error(i(150));return nt=an.call(nt),iu(Ke,ke,nt,Ot)}if(typeof nt.then=="function")return _l(Ke,ke,tn(nt),Ot);if(nt.$$typeof===Ja)return _l(Ke,ke,B(Ke,nt),Ot);Hn(Ke,nt)}return typeof nt=="string"&&nt!==""||typeof nt=="number"||typeof nt=="bigint"?(nt=""+nt,ke!==null&&ke.tag===6?(v(Ke,ke.sibling),Ot=D(ke,nt),Ot.return=Ke,Ke=Ot):(v(Ke,ke),Ot=mp(nt,Ke.mode,Ot),Ot.return=Ke,Ke=Ot),J(Ke)):v(Ke,ke)}return function(Ke,ke,nt,Ot){try{sc=0;var an=_l(Ke,ke,nt,Ot);return hl=null,an}catch(sn){if(sn===fr||sn===ss)throw sn;var Pi=t(29,sn,null,Ke.mode);return Pi.lanes=Ot,Pi.return=Ke,Pi}}}function ni(){for(var l=Js,u=oc=Js=0;uN?N:8);var J=nn.T,be={};nn.T=be,th(l,!1,u,v);try{var st=D(),Et=nn.S;if(Et!==null&&Et(be,st),st!==null&&typeof st=="object"&&typeof st.then=="function"){var Pt=pe(st,b);Yo(l,u,Pt,wi(l))}else Yo(l,u,b,wi(l))}catch(At){Yo(l,u,{then:function(){},status:"rejected",reason:At},wi())}finally{On(N),J!==null&&be.types!==null&&(J.types=be.types),nn.T=J}}function kl(l){var u=l.memoizedState;if(u!==null)return u;u={memoizedState:ec,baseState:ec,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rn,lastRenderedState:ec},next:null};var v={};return u.next={memoizedState:v,baseState:v,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Rn,lastRenderedState:v},next:null},l.memoizedState=u,l=l.alternate,l!==null&&(l.memoizedState=u),u}function Tc(){return j(tc)}function wc(){return Mt().memoizedState}function Mr(){return Mt().memoizedState}function wa(l){for(var u=l.return;u!==null;){switch(u.tag){case 24:case 3:var v=wi();l=ye(v);var b=We(u,l,v);b!==null&&(Ui(b,u,v),tt(b,u,v)),u={cache:ze()},l.payload=u;return}u=u.return}}function Lr(l,u,v){var b=wi();v={lane:b,revertLane:0,gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},nh(l)?L0(u,v):(v=Zt(l,u,v,b),v!==null&&(Ui(v,l,b),N0(v,u,b)))}function ms(l,u,v){var b=wi();Yo(l,u,v,b)}function Yo(l,u,v,b){var D={lane:b,revertLane:0,gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null};if(nh(l))L0(u,D);else{var N=l.alternate;if(l.lanes===0&&(N===null||N.lanes===0)&&(N=u.lastRenderedReducer,N!==null))try{var J=u.lastRenderedState,be=N(J,v);if(D.hasEagerState=!0,D.eagerState=be,Xi(be,J))return Ln(l,u,D,0),Tn===null&&ni(),!1}catch{}if(v=Zt(l,u,D,b),v!==null)return Ui(v,l,b),N0(v,u,b),!0}return!1}function th(l,u,v,b){if(b={lane:2,revertLane:Ie(),gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null},nh(l)){if(u)throw Error(i(479))}else u=Zt(l,v,b,2),u!==null&&Ui(u,l,2)}function nh(l){var u=l.alternate;return l===yn||u!==null&&u===yn}function L0(l,u){Sn=En=!0;var v=l.pending;v===null?u.next=u:(u.next=v.next,v.next=u),l.pending=u}function N0(l,u,v){if((v&4194048)!==0){var b=u.lanes;b&=l.pendingLanes,v|=b,u.lanes=v,O(l,v)}}function Kd(l,u,v,b){u=l.memoizedState,v=v(b,u),v=v==null?u:Sh({},u,v),l.memoizedState=v,l.lanes===0&&(l.updateQueue.baseState=v)}function ih(l,u,v,b,D,N,J){return l=l.stateNode,typeof l.shouldComponentUpdate=="function"?l.shouldComponentUpdate(b,N,J):u.prototype&&u.prototype.isPureReactComponent?!Me(v,b)||!Me(D,N):!0}function O0(l,u,v,b){l=u.state,typeof u.componentWillReceiveProps=="function"&&u.componentWillReceiveProps(v,b),typeof u.UNSAFE_componentWillReceiveProps=="function"&&u.UNSAFE_componentWillReceiveProps(v,b),u.state!==l&&uf.enqueueReplaceState(u,u.state,null)}function Gl(l,u){var v=u;if("ref"in u){v={};for(var b in u)b!=="ref"&&(v[b]=u[b])}if(l=l.defaultProps){v===u&&(v=Sh({},v));for(var D in l)v[D]===void 0&&(v[D]=l[D])}return v}function rh(l,u){try{var v=l.onUncaughtError;v(u.value,{componentStack:u.stack})}catch(b){setTimeout(function(){throw b})}}function Qd(l,u,v){try{var b=l.onCaughtError;b(v.value,{componentStack:v.stack,errorBoundary:u.tag===1?u.stateNode:null})}catch(D){setTimeout(function(){throw D})}}function Jd(l,u,v){return v=ye(v),v.tag=3,v.payload={element:null},v.callback=function(){rh(l,u)},v}function P0(l){return l=ye(l),l.tag=3,l}function F0(l,u,v,b){var D=v.type.getDerivedStateFromError;if(typeof D=="function"){var N=b.value;l.payload=function(){return D(N)},l.callback=function(){Qd(u,v,b)}}var J=v.stateNode;J!==null&&typeof J.componentDidCatch=="function"&&(l.callback=function(){Qd(u,v,b),typeof D!="function"&&(Ao===null?Ao=new Set([this]):Ao.add(this));var be=b.stack;this.componentDidCatch(b.value,{componentStack:be!==null?be:""})})}function i1(l,u,v,b,D){if(v.flags|=32768,b!==null&&typeof b=="object"&&typeof b.then=="function"){if(u=v.alternate,u!==null&&qe(u,v,D,!0),v=da.current,v!==null){switch(v.tag){case 31:case 13:return pa===null?Fc():v.alternate===null&&Oi===0&&(Oi=3),v.flags&=-257,v.flags|=65536,v.lanes=D,b===Qs?v.flags|=16384:(u=v.updateQueue,u===null?v.updateQueue=new Set([b]):u.add(b),kc(l,b,D)),!1;case 22:return v.flags|=65536,b===Qs?v.flags|=16384:(u=v.updateQueue,u===null?(u={transitions:null,markerInstances:null,retryQueue:new Set([b])},v.updateQueue=u):(v=u.retryQueue,v===null?u.retryQueue=new Set([b]):v.add(b)),kc(l,b,D)),!1}throw Error(i(435,v.tag))}return kc(l,b,D),Fc(),!1}if(Pn)return u=da.current,u!==null?((u.flags&65536)===0&&(u.flags|=256),u.flags|=65536,u.lanes=D,b!==Wh&&(l=Error(i(422),{cause:b}),Ve(ce(l,v)))):(b!==Wh&&(u=Error(i(423),{cause:b}),Ve(ce(u,v))),l=l.current.alternate,l.flags|=65536,D&=-D,l.lanes|=D,b=ce(b,v),D=Jd(l.stateNode,b,D),at(l,D),Oi!==4&&(Oi=2)),!1;var N=Error(i(520),{cause:b});if(N=ce(N,v),hf===null?hf=[N]:hf.push(N),Oi!==4&&(Oi=2),u===null)return!0;b=ce(b,v),v=u;do{switch(v.tag){case 3:return v.flags|=65536,l=D&-D,v.lanes|=l,l=Jd(v.stateNode,b,l),at(v,l),!1;case 1:if(u=v.type,N=v.stateNode,(v.flags&128)===0&&(typeof u.getDerivedStateFromError=="function"||N!==null&&typeof N.componentDidCatch=="function"&&(Ao===null||!Ao.has(N))))return v.flags|=65536,D&=-D,v.lanes|=D,D=P0(D),F0(D,l,v,b),at(v,D),!1}v=v.return}while(v!==null);return!1}function Er(l,u,v,b){u.child=l===null?nm(u,null,v,b):Ar(u,l.child,v,b)}function z0(l,u,v,b,D){v=v.render;var N=u.ref;if("ref"in b){var J={};for(var be in b)be!=="ref"&&(J[be]=b[be])}else J=b;return je(u),b=Ft(l,u,v,J,N,D),be=gn(),l!==null&&!Mi?(Bn(l,u,D),Os(l,u,D)):(Pn&&be&&Z(u),u.flags|=1,Er(l,u,b,D),u.child)}function B0(l,u,v,b,D){if(l===null){var N=v.type;return typeof N=="function"&&!Xl(N)&&N.defaultProps===void 0&&v.compare===null?(u.tag=15,u.type=N,k0(l,u,N,b,D)):(l=vo(v.type,null,b,u,u.mode,D),l.ref=u.ref,l.return=u,u.child=l)}if(N=l.child,!Fu(l,D)){var J=N.memoizedProps;if(v=v.compare,v=v!==null?v:Me,v(J,b)&&l.ref===u.ref)return Os(l,u,D)}return u.flags|=1,l=Ra(N,b),l.ref=u.ref,l.return=u,u.child=l}function k0(l,u,v,b,D){if(l!==null){var N=l.memoizedProps;if(Me(N,b)&&l.ref===u.ref)if(Mi=!1,u.pendingProps=b=N,Fu(l,D))(l.flags&131072)!==0&&(Mi=!0);else return u.lanes=l.lanes,Os(l,u,D)}return sh(l,u,v,b,D)}function G0(l,u,v,b){var D=b.children,N=l!==null?l.memoizedState:null;if(l===null&&u.stateNode===null&&(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),b.mode==="hidden"){if((u.flags&128)!==0){if(N=N!==null?N.baseLanes|v:v,l!==null){for(b=u.child=l.child,D=0;b!==null;)D=D|b.lanes|b.childLanes,b=b.sibling;b=D&~N}else b=0,u.child=null;return Ac(l,u,N,v,b)}if((v&536870912)!==0)u.memoizedState={baseLanes:0,cachePool:null},l!==null&&et(u,N!==null?N.cachePool:null),N!==null?Lt(u,N):H(),Ee(u);else return b=u.lanes=536870912,Ac(l,u,N!==null?N.baseLanes|v:v,v,b)}else N!==null?(et(u,N.cachePool),Lt(u,N),ft(),u.memoizedState=null):(l!==null&&et(u,null),H(),ft());return Er(l,u,D,v),u.child}function Hl(l,u){return l!==null&&l.tag===22||u.stateNode!==null||(u.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.sibling}function Ac(l,u,v,b,D){var N=Fe();return N=N===null?null:{parent:ji?Ri._currentValue:Ri._currentValue2,pool:N},u.memoizedState={baseLanes:v,cachePool:N},l!==null&&et(u,null),H(),Ee(u),l!==null&&qe(l,u,b,!0),u.childLanes=D,null}function ah(l,u){return u=Zo({mode:u.mode,children:u.children},l.mode),u.ref=l.ref,l.child=u,u.return=l,u}function $d(l,u,v){return Ar(u,l.child,null,v),l=ah(u,u.pendingProps),l.flags|=2,vt(u),u.memoizedState=null,l}function H0(l,u,v){var b=u.pendingProps,D=(u.flags&128)!==0;if(u.flags&=-129,l===null){if(Pn){if(b.mode==="hidden")return l=ah(u,b),u.lanes=536870912,Hl(null,l);if(Se(u),(l=Ci)?(l=kp(l,Kr),l!==null&&(u.memoizedState={dehydrated:l,treeContext:ns!==null?{id:Tr,overflow:vs}:null,retryLane:536870912,hydrationErrors:null},v=gp(l),v.return=u,u.child=v,cr=u,Ci=null)):l=null,l===null)throw Ge(u);return u.lanes=536870912,null}return ah(u,b)}var N=l.memoizedState;if(N!==null){var J=N.dehydrated;if(Se(u),D)if(u.flags&256)u.flags&=-257,u=$d(l,u,v);else if(u.memoizedState!==null)u.child=l.child,u.flags|=128,u=null;else throw Error(i(558));else if(Mi||qe(l,u,v,!1),D=(v&l.childLanes)!==0,Mi||D){if(b=Tn,b!==null&&(J=W(b,v),J!==0&&J!==N.retryLane))throw N.retryLane=J,jt(l,J),Ui(b,l,J),Jr;Fc(),u=$d(l,u,v)}else l=N.treeContext,Ai&&(Ci=Tg(J),cr=u,Pn=!0,Ks=null,Kr=!1,l!==null&&he(u,l)),u=ah(u,b),u.flags|=4096;return u}return l=Ra(l.child,{mode:b.mode,children:b.children}),l.ref=u.ref,u.child=l,l.return=u,l}function Pu(l,u){var v=u.ref;if(v===null)l!==null&&l.ref!==null&&(u.flags|=4194816);else{if(typeof v!="function"&&typeof v!="object")throw Error(i(284));(l===null||l.ref!==v)&&(u.flags|=4194816)}}function sh(l,u,v,b,D){return je(u),v=Ft(l,u,v,b,void 0,D),b=gn(),l!==null&&!Mi?(Bn(l,u,D),Os(l,u,D)):(Pn&&b&&Z(u),u.flags|=1,Er(l,u,v,D),u.child)}function ep(l,u,v,b,D,N){return je(u),u.updateQueue=null,v=Ct(u,b,v,D),Kt(l),b=gn(),l!==null&&!Mi?(Bn(l,u,N),Os(l,u,N)):(Pn&&b&&Z(u),u.flags|=1,Er(l,u,v,N),u.child)}function Vl(l,u,v,b,D){if(je(u),u.stateNode===null){var N=qs,J=v.contextType;typeof J=="object"&&J!==null&&(N=j(J)),N=new v(b,N),u.memoizedState=N.state!==null&&N.state!==void 0?N.state:null,N.updater=uf,u.stateNode=N,N._reactInternals=u,N=u.stateNode,N.props=b,N.state=u.memoizedState,N.refs={},V(u),J=v.contextType,N.context=typeof J=="object"&&J!==null?j(J):qs,N.state=u.memoizedState,J=v.getDerivedStateFromProps,typeof J=="function"&&(Kd(u,v,J,b),N.state=u.memoizedState),typeof v.getDerivedStateFromProps=="function"||typeof N.getSnapshotBeforeUpdate=="function"||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(J=N.state,typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount(),J!==N.state&&uf.enqueueReplaceState(N,N.state,null),_t(u,b,N,D),wt(),N.state=u.memoizedState),typeof N.componentDidMount=="function"&&(u.flags|=4194308),b=!0}else if(l===null){N=u.stateNode;var be=u.memoizedProps,st=Gl(v,be);N.props=st;var Et=N.context,Pt=v.contextType;J=qs,typeof Pt=="object"&&Pt!==null&&(J=j(Pt));var At=v.getDerivedStateFromProps;Pt=typeof At=="function"||typeof N.getSnapshotBeforeUpdate=="function",be=u.pendingProps!==be,Pt||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(be||Et!==J)&&O0(u,N,b,J),Ia=!1;var Vt=u.memoizedState;N.state=Vt,_t(u,b,N,D),wt(),Et=u.memoizedState,be||Vt!==Et||Ia?(typeof At=="function"&&(Kd(u,v,At,b),Et=u.memoizedState),(st=Ia||ih(u,v,st,b,Vt,Et,J))?(Pt||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount()),typeof N.componentDidMount=="function"&&(u.flags|=4194308)):(typeof N.componentDidMount=="function"&&(u.flags|=4194308),u.memoizedProps=b,u.memoizedState=Et),N.props=b,N.state=Et,N.context=J,b=st):(typeof N.componentDidMount=="function"&&(u.flags|=4194308),b=!1)}else{N=u.stateNode,ne(l,u),J=u.memoizedProps,Pt=Gl(v,J),N.props=Pt,At=u.pendingProps,Vt=N.context,Et=v.contextType,st=qs,typeof Et=="object"&&Et!==null&&(st=j(Et)),be=v.getDerivedStateFromProps,(Et=typeof be=="function"||typeof N.getSnapshotBeforeUpdate=="function")||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(J!==At||Vt!==st)&&O0(u,N,b,st),Ia=!1,Vt=u.memoizedState,N.state=Vt,_t(u,b,N,D),wt();var mn=u.memoizedState;J!==At||Vt!==mn||Ia||l!==null&&l.dependencies!==null&&Ne(l.dependencies)?(typeof be=="function"&&(Kd(u,v,be,b),mn=u.memoizedState),(Pt=Ia||ih(u,v,Pt,b,Vt,mn,st)||l!==null&&l.dependencies!==null&&Ne(l.dependencies))?(Et||typeof N.UNSAFE_componentWillUpdate!="function"&&typeof N.componentWillUpdate!="function"||(typeof N.componentWillUpdate=="function"&&N.componentWillUpdate(b,mn,st),typeof N.UNSAFE_componentWillUpdate=="function"&&N.UNSAFE_componentWillUpdate(b,mn,st)),typeof N.componentDidUpdate=="function"&&(u.flags|=4),typeof N.getSnapshotBeforeUpdate=="function"&&(u.flags|=1024)):(typeof N.componentDidUpdate!="function"||J===l.memoizedProps&&Vt===l.memoizedState||(u.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||J===l.memoizedProps&&Vt===l.memoizedState||(u.flags|=1024),u.memoizedProps=b,u.memoizedState=mn),N.props=b,N.state=mn,N.context=st,b=Pt):(typeof N.componentDidUpdate!="function"||J===l.memoizedProps&&Vt===l.memoizedState||(u.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||J===l.memoizedProps&&Vt===l.memoizedState||(u.flags|=1024),b=!1)}return N=b,Pu(l,u),b=(u.flags&128)!==0,N||b?(N=u.stateNode,v=b&&typeof v.getDerivedStateFromError!="function"?null:N.render(),u.flags|=1,l!==null&&b?(u.child=Ar(u,l.child,null,D),u.child=Ar(u,null,v,D)):Er(l,u,v,D),u.memoizedState=N.state,l=u.child):l=Os(l,u,D),l}function V0(l,u,v,b){return bt(),u.flags|=256,Er(l,u,v,b),u.child}function tp(l){return{baseLanes:l,cachePool:Re()}}function np(l,u,v){return l=l!==null?l.childLanes&~v:0,u&&(l|=$r),l}function ip(l,u,v){var b=u.pendingProps,D=!1,N=(u.flags&128)!==0,J;if((J=N)||(J=l!==null&&l.memoizedState===null?!1:(Bi.current&2)!==0),J&&(D=!0,u.flags&=-129),J=(u.flags&32)!==0,u.flags&=-33,l===null){if(Pn){if(D?Te(u):ft(),(l=Ci)?(l=Rg(l,Kr),l!==null&&(u.memoizedState={dehydrated:l,treeContext:ns!==null?{id:Tr,overflow:vs}:null,retryLane:536870912,hydrationErrors:null},v=gp(l),v.return=u,u.child=v,cr=u,Ci=null)):l=null,l===null)throw Ge(u);return Dh(l)?u.lanes=32:u.lanes=536870912,null}var be=b.children;return b=b.fallback,D?(ft(),D=u.mode,be=Zo({mode:"hidden",children:be},D),b=Qa(b,D,v,null),be.return=u,b.return=u,be.sibling=b,u.child=be,b=u.child,b.memoizedState=tp(v),b.childLanes=np(l,J,v),u.memoizedState=cc,Hl(null,b)):(Te(u),oh(u,be))}var st=l.memoizedState;if(st!==null&&(be=st.dehydrated,be!==null)){if(N)u.flags&256?(Te(u),u.flags&=-257,u=jl(l,u,v)):u.memoizedState!==null?(ft(),u.child=l.child,u.flags|=128,u=null):(ft(),be=b.fallback,D=u.mode,b=Zo({mode:"visible",children:b.children},D),be=Qa(be,D,v,null),be.flags|=2,b.return=u,be.return=u,b.sibling=be,u.child=b,Ar(u,l.child,null,v),b=u.child,b.memoizedState=tp(v),b.childLanes=np(l,J,v),u.memoizedState=cc,u=Hl(null,b));else if(Te(u),Dh(be))J=Uh(be).digest,b=Error(i(419)),b.stack="",b.digest=J,Ve({value:b,source:null,stack:null}),u=jl(l,u,v);else if(Mi||qe(l,u,v,!1),J=(v&l.childLanes)!==0,Mi||J){if(J=Tn,J!==null&&(b=W(J,v),b!==0&&b!==st.retryLane))throw st.retryLane=b,jt(l,b),Ui(J,l,b),Jr;ll(be)||Fc(),u=jl(l,u,v)}else ll(be)?(u.flags|=192,u.child=l.child,u=null):(l=st.treeContext,Ai&&(Ci=wg(be),cr=u,Pn=!0,Ks=null,Kr=!1,l!==null&&he(u,l)),u=oh(u,b.children),u.flags|=4096);return u}return D?(ft(),be=b.fallback,D=u.mode,st=l.child,N=st.sibling,b=Ra(st,{mode:"hidden",children:b.children}),b.subtreeFlags=st.subtreeFlags&65011712,N!==null?be=Ra(N,be):(be=Qa(be,D,v,null),be.flags|=2),be.return=u,b.return=u,b.sibling=be,u.child=b,Hl(null,b),b=u.child,be=l.child.memoizedState,be===null?be=tp(v):(D=be.cachePool,D!==null?(st=ji?Ri._currentValue:Ri._currentValue2,D=D.parent!==st?{parent:st,pool:st}:D):D=Re(),be={baseLanes:be.baseLanes|v,cachePool:D}),b.memoizedState=be,b.childLanes=np(l,J,v),u.memoizedState=cc,Hl(l.child,b)):(Te(u),v=l.child,l=v.sibling,v=Ra(v,{mode:"visible",children:b.children}),v.return=u,v.sibling=null,l!==null&&(J=u.deletions,J===null?(u.deletions=[l],u.flags|=16):J.push(l)),u.child=v,u.memoizedState=null,v)}function oh(l,u){return u=Zo({mode:"visible",children:u},l.mode),u.return=l,l.child=u}function Zo(l,u){return l=t(22,l,null,u),l.lanes=0,l}function jl(l,u,v){return Ar(u,l.child,null,v),l=oh(u,u.pendingProps.children),l.flags|=2,u.memoizedState=null,l}function j0(l,u,v){l.lanes|=u;var b=l.alternate;b!==null&&(b.lanes|=u),Q(l.return,u,v)}function Cc(l,u,v,b,D,N){var J=l.memoizedState;J===null?l.memoizedState={isBackwards:u,rendering:null,renderingStartTime:0,last:b,tail:v,tailMode:D,treeForkCount:N}:(J.isBackwards=u,J.rendering=null,J.renderingStartTime=0,J.last=b,J.tail=v,J.tailMode=D,J.treeForkCount=N)}function rp(l,u,v){var b=u.pendingProps,D=b.revealOrder,N=b.tail;b=b.children;var J=Bi.current,be=(J&2)!==0;if(be?(J=J&1|2,u.flags|=128):J&=1,S(Bi,J),Er(l,u,b,v),b=Pn?of:0,!be&&l!==null&&(l.flags&128)!==0)e:for(l=u.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&j0(l,v,u);else if(l.tag===19)j0(l,v,u);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===u)break e;for(;l.sibling===null;){if(l.return===null||l.return===u)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}switch(D){case"forwards":for(v=u.child,D=null;v!==null;)l=v.alternate,l!==null&&yt(l)===null&&(D=v),v=v.sibling;v=D,v===null?(D=u.child,u.child=null):(D=v.sibling,v.sibling=null),Cc(u,!1,D,v,N,b);break;case"backwards":case"unstable_legacy-backwards":for(v=null,D=u.child,u.child=null;D!==null;){if(l=D.alternate,l!==null&&yt(l)===null){u.child=D;break}l=D.sibling,D.sibling=v,v=D,D=l}Cc(u,!0,v,null,N,b);break;case"together":Cc(u,!1,null,null,void 0,b);break;default:u.memoizedState=null}return u.child}function Os(l,u,v){if(l!==null&&(u.dependencies=l.dependencies),wo|=u.lanes,(v&u.childLanes)===0)if(l!==null){if(qe(l,u,v,!1),(v&u.childLanes)===0)return null}else return null;if(l!==null&&u.child!==l.child)throw Error(i(153));if(u.child!==null){for(l=u.child,v=Ra(l,l.pendingProps),u.child=v,v.return=u;l.sibling!==null;)l=l.sibling,v=v.sibling=Ra(l,l.pendingProps),v.return=u;v.sibling=null}return u.child}function Fu(l,u){return(l.lanes&u)!==0?!0:(l=l.dependencies,!!(l!==null&&Ne(l)))}function ap(l,u,v){switch(u.tag){case 3:xe(u,u.stateNode.containerInfo),Pe(u,Ri,l.memoizedState.cache),bt();break;case 27:case 5:de(u);break;case 4:xe(u,u.stateNode.containerInfo);break;case 10:Pe(u,u.type,u.memoizedProps.value);break;case 31:if(u.memoizedState!==null)return u.flags|=128,Se(u),null;break;case 13:var b=u.memoizedState;if(b!==null)return b.dehydrated!==null?(Te(u),u.flags|=128,null):(v&u.child.childLanes)!==0?ip(l,u,v):(Te(u),l=Os(l,u,v),l!==null?l.sibling:null);Te(u);break;case 19:var D=(l.flags&128)!==0;if(b=(v&u.childLanes)!==0,b||(qe(l,u,v,!1),b=(v&u.childLanes)!==0),D){if(b)return rp(l,u,v);u.flags|=128}if(D=u.memoizedState,D!==null&&(D.rendering=null,D.tail=null,D.lastEffect=null),S(Bi,Bi.current),b)break;return null;case 22:return u.lanes=0,G0(l,u,v,u.pendingProps);case 24:Pe(u,Ri,l.memoizedState.cache)}return Os(l,u,v)}function sp(l,u,v){if(l!==null)if(l.memoizedProps!==u.pendingProps)Mi=!0;else{if(!Fu(l,v)&&(u.flags&128)===0)return Mi=!1,ap(l,u,v);Mi=(l.flags&131072)!==0}else Mi=!1,Pn&&(u.flags&1048576)!==0&&G(u,of,u.index);switch(u.lanes=0,u.tag){case 16:e:{var b=u.pendingProps;if(l=It(u.elementType),u.type=l,typeof l=="function")Xl(l)?(b=Gl(l,b),u.tag=1,u=Vl(null,u,l,b,v)):(u.tag=0,u=sh(null,u,l,b,v));else{if(l!=null){var D=l.$$typeof;if(D===Gc){u.tag=11,u=z0(null,u,l,b,v);break e}else if(D===Eh){u.tag=14,u=B0(null,u,l,b,v);break e}}throw u=y(l)||l,Error(i(306,u,""))}}return u;case 0:return sh(l,u,u.type,u.pendingProps,v);case 1:return b=u.type,D=Gl(b,u.pendingProps),Vl(l,u,b,D,v);case 3:e:{if(xe(u,u.stateNode.containerInfo),l===null)throw Error(i(387));var N=u.pendingProps;D=u.memoizedState,b=D.element,ne(l,u),_t(u,N,null,v);var J=u.memoizedState;if(N=J.cache,Pe(u,Ri,N),N!==D.cache&&ut(u,[Ri],v,!0),wt(),N=J.element,Ai&&D.isDehydrated)if(D={element:N,isDehydrated:!1,cache:J.cache},u.updateQueue.baseState=D,u.memoizedState=D,u.flags&256){u=V0(l,u,N,v);break e}else if(N!==b){b=ce(Error(i(424)),u),Ve(b),u=V0(l,u,N,v);break e}else for(Ai&&(Ci=Eg(u.stateNode.containerInfo),cr=u,Pn=!0,Ks=null,Kr=!0),v=nm(u,null,N,v),u.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(bt(),N===b){u=Os(l,u,v);break e}Er(l,u,N,v)}u=u.child}return u;case 26:if(es)return Pu(l,u),l===null?(v=Wp(u.type,null,u.pendingProps,null))?u.memoizedState=v:Pn||(u.stateNode=Oh(u.type,u.pendingProps,wr.current,u)):u.memoizedState=Wp(u.type,l.memoizedProps,u.pendingProps,l.memoizedState),null;case 27:if(lr)return de(u),l===null&&lr&&Pn&&(b=u.stateNode=Ph(u.type,u.pendingProps,wr.current,xr.current,!1),cr=u,Kr=!0,Ci=Bp(u.type,b,Ci)),Er(l,u,u.pendingProps.children,v),Pu(l,u),l===null&&(u.flags|=4194304),u.child;case 5:return l===null&&Pn&&(zg(u.type,u.pendingProps,xr.current),(D=b=Ci)&&(b=Ag(b,u.type,u.pendingProps,Kr),b!==null?(u.stateNode=b,cr=u,Ci=Mg(b),Kr=!1,D=!0):D=!1),D||Ge(u)),de(u),D=u.type,N=u.pendingProps,J=l!==null?l.memoizedProps:null,b=N.children,Zr(D,N)?b=null:J!==null&&Zr(D,J)&&(u.flags|=32),u.memoizedState!==null&&(D=Ft(l,u,qt,null,null,v),ji?tc._currentValue=D:tc._currentValue2=D),Pu(l,u),Er(l,u,b,v),u.child;case 6:return l===null&&Pn&&(jp(u.pendingProps,xr.current),(l=v=Ci)&&(v=Cg(v,u.pendingProps,Kr),v!==null?(u.stateNode=v,cr=u,Ci=null,l=!0):l=!1),l||Ge(u)),null;case 13:return ip(l,u,v);case 4:return xe(u,u.stateNode.containerInfo),b=u.pendingProps,l===null?u.child=Ar(u,null,b,v):Er(l,u,b,v),u.child;case 11:return z0(l,u,u.type,u.pendingProps,v);case 7:return Er(l,u,u.pendingProps,v),u.child;case 8:return Er(l,u,u.pendingProps.children,v),u.child;case 12:return Er(l,u,u.pendingProps.children,v),u.child;case 10:return b=u.pendingProps,Pe(u,u.type,b.value),Er(l,u,b.children,v),u.child;case 9:return D=u.type._context,b=u.pendingProps.children,je(u),D=j(D),b=b(D),u.flags|=1,Er(l,u,b,v),u.child;case 14:return B0(l,u,u.type,u.pendingProps,v);case 15:return k0(l,u,u.type,u.pendingProps,v);case 19:return rp(l,u,v);case 31:return H0(l,u,v);case 22:return G0(l,u,v,u.pendingProps);case 24:return je(u),b=j(Ri),l===null?(D=Fe(),D===null&&(D=Tn,N=ze(),D.pooledCache=N,N.refCount++,N!==null&&(D.pooledCacheLanes|=v),D=N),u.memoizedState={parent:b,cache:D},V(u),Pe(u,Ri,D)):((l.lanes&v)!==0&&(ne(l,u),_t(u,null,null,v),wt()),D=l.memoizedState,N=u.memoizedState,D.parent!==b?(D={parent:b,cache:b},u.memoizedState=D,u.lanes===0&&(u.memoizedState=u.updateQueue.baseState=D),Pe(u,Ri,b)):(b=N.cache,Pe(u,Ri,b),b!==D.cache&&ut(u,[Ri],v,!0))),Er(l,u,u.pendingProps.children,v),u.child;case 29:throw u.pendingProps}throw Error(i(156,u.tag))}function Xa(l){l.flags|=4}function zu(l){Da&&(l.flags|=8)}function W0(l,u){if(l!==null&&l.child===u.child)return!1;if((u.flags&16)!==0)return!0;for(l=u.child;l!==null;){if((l.flags&8218)!==0||(l.subtreeFlags&8218)!==0)return!0;l=l.sibling}return!1}function op(l,u,v,b){if(Gn)for(v=u.child;v!==null;){if(v.tag===5||v.tag===6)Ju(l,v.stateNode);else if(!(v.tag===4||lr&&v.tag===27)&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===u)break;for(;v.sibling===null;){if(v.return===null||v.return===u)return;v=v.return}v.sibling.return=v.return,v=v.sibling}else if(Da)for(var D=u.child;D!==null;){if(D.tag===5){var N=D.stateNode;v&&b&&(N=xg(N,D.type,D.memoizedProps)),Ju(l,N)}else if(D.tag===6)N=D.stateNode,v&&b&&(N=Fp(N,D.memoizedProps)),Ju(l,N);else if(D.tag!==4){if(D.tag===22&&D.memoizedState!==null)N=D.child,N!==null&&(N.return=D),op(l,D,!0,!0);else if(D.child!==null){D.child.return=D,D=D.child;continue}}if(D===u)break;for(;D.sibling===null;){if(D.return===null||D.return===u)return;D=D.return}D.sibling.return=D.return,D=D.sibling}}function X0(l,u,v,b){var D=!1;if(Da)for(var N=u.child;N!==null;){if(N.tag===5){var J=N.stateNode;v&&b&&(J=xg(J,N.type,N.memoizedProps)),Op(l,J)}else if(N.tag===6)J=N.stateNode,v&&b&&(J=Fp(J,N.memoizedProps)),Op(l,J);else if(N.tag!==4){if(N.tag===22&&N.memoizedState!==null)D=N.child,D!==null&&(D.return=N),X0(l,N,!0,!0),D=!0;else if(N.child!==null){N.child.return=N,N=N.child;continue}}if(N===u)break;for(;N.sibling===null;){if(N.return===null||N.return===u)return D;N=N.return}N.sibling.return=N.return,N=N.sibling}return D}function q0(l,u){if(Da&&W0(l,u)){l=u.stateNode;var v=l.containerInfo,b=Np();X0(b,u,!1,!1),l.pendingChildren=b,Xa(u),yg(v,b)}}function lp(l,u,v,b){if(Gn)l.memoizedProps!==b&&Xa(u);else if(Da){var D=l.stateNode,N=l.memoizedProps;if((l=W0(l,u))||N!==b){var J=xr.current;N=vg(D,v,N,b,!l,null),N===D?u.stateNode=D:(zu(u),ca(N,v,b,J)&&Xa(u),u.stateNode=N,l&&op(N,u,!1,!1))}else u.stateNode=D}}function Xr(l,u,v,b,D){if((l.mode&32)!==0&&(v===null?$u(u,b):Xc(u,v,b))){if(l.flags|=16777216,(D&335544128)===D||Mp(u,b))if(Ii(l.stateNode,u,b))l.flags|=8192;else if(kn())l.flags|=8192;else throw Qr=Qs,qh}else l.flags&=-16777217}function Rc(l,u){if(Zp(u)){if(l.flags|=16777216,!Kp(u))if(kn())l.flags|=8192;else throw Qr=Qs,qh}else l.flags&=-16777217}function Bu(l,u){u!==null&&(l.flags|=4),l.flags&16384&&(u=l.tag!==22?L():536870912,l.lanes|=u,tu|=u)}function Dc(l,u){if(!Pn)switch(l.tailMode){case"hidden":u=l.tail;for(var v=null;u!==null;)u.alternate!==null&&(v=u),u=u.sibling;v===null?l.tail=null:v.sibling=null;break;case"collapsed":v=l.tail;for(var b=null;v!==null;)v.alternate!==null&&(b=v),v=v.sibling;b===null?u||l.tail===null?l.tail=null:l.tail.sibling=null:b.sibling=null}}function gi(l){var u=l.alternate!==null&&l.alternate.child===l.child,v=0,b=0;if(u)for(var D=l.child;D!==null;)v|=D.lanes|D.childLanes,b|=D.subtreeFlags&65011712,b|=D.flags&65011712,D.return=l,D=D.sibling;else for(D=l.child;D!==null;)v|=D.lanes|D.childLanes,b|=D.subtreeFlags,b|=D.flags,D.return=l,D=D.sibling;return l.subtreeFlags|=b,l.childLanes=v,u}function Y0(l,u,v){var b=u.pendingProps;switch(oe(u),u.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gi(u),null;case 1:return gi(u),null;case 3:return v=u.stateNode,b=null,l!==null&&(b=l.memoizedState.cache),u.memoizedState.cache!==b&&(u.flags|=2048),it(Ri),ae(),v.pendingContext&&(v.context=v.pendingContext,v.pendingContext=null),(l===null||l.child===null)&&($e(u)?Xa(u):l===null||l.memoizedState.isDehydrated&&(u.flags&256)===0||(u.flags|=1024,Oe())),q0(l,u),gi(u),null;case 26:if(es){var D=u.type,N=u.memoizedState;return l===null?(Xa(u),N!==null?(gi(u),Rc(u,N)):(gi(u),Xr(u,D,null,b,v))):N?N!==l.memoizedState?(Xa(u),gi(u),Rc(u,N)):(gi(u),u.flags&=-16777217):(N=l.memoizedProps,Gn?N!==b&&Xa(u):lp(l,u,D,b),gi(u),Xr(u,D,N,b,v)),null}case 27:if(lr){if(me(u),v=wr.current,D=u.type,l!==null&&u.stateNode!=null)Gn?l.memoizedProps!==b&&Xa(u):lp(l,u,D,b);else{if(!b){if(u.stateNode===null)throw Error(i(166));return gi(u),null}l=xr.current,$e(u)?ct(u,l):(l=Ph(D,b,v,l,!0),u.stateNode=l,Xa(u))}return gi(u),null}case 5:if(me(u),D=u.type,l!==null&&u.stateNode!=null)lp(l,u,D,b);else{if(!b){if(u.stateNode===null)throw Error(i(166));return gi(u),null}if(N=xr.current,$e(u))ct(u,N),Og(u.stateNode,D,b,N)&&(u.flags|=64);else{var J=bp(D,b,wr.current,N,u);zu(u),op(J,u,!1,!1),u.stateNode=J,ca(J,D,b,N)&&Xa(u)}}return gi(u),Xr(u,u.type,l===null?null:l.memoizedProps,u.pendingProps,v),null;case 6:if(l&&u.stateNode!=null)v=l.memoizedProps,Gn?v!==b&&Xa(u):Da&&(v!==b?(l=wr.current,v=xr.current,zu(u),u.stateNode=_o(b,l,v,u)):u.stateNode=l.stateNode);else{if(typeof b!="string"&&u.stateNode===null)throw Error(i(166));if(l=wr.current,v=xr.current,$e(u)){if(!Ai)throw Error(i(176));if(l=u.stateNode,v=u.memoizedProps,b=null,D=cr,D!==null)switch(D.tag){case 27:case 5:b=D.memoizedProps}l1(l,v,u,b)||Ge(u,!0)}else zu(u),u.stateNode=_o(b,l,v,u)}return gi(u),null;case 31:if(v=u.memoizedState,l===null||l.memoizedState!==null){if(b=$e(u),v!==null){if(l===null){if(!b)throw Error(i(318));if(!Ai)throw Error(i(556));if(l=u.memoizedState,l=l!==null?l.dehydrated:null,!l)throw Error(i(557));Gp(l,u)}else bt(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;gi(u),l=!1}else v=Oe(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=v),l=!0;if(!l)return u.flags&256?(vt(u),u):(vt(u),null);if((u.flags&128)!==0)throw Error(i(558))}return gi(u),null;case 13:if(b=u.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(D=$e(u),b!==null&&b.dehydrated!==null){if(l===null){if(!D)throw Error(i(318));if(!Ai)throw Error(i(344));if(D=u.memoizedState,D=D!==null?D.dehydrated:null,!D)throw Error(i(317));Ug(D,u)}else bt(),(u.flags&128)===0&&(u.memoizedState=null),u.flags|=4;gi(u),D=!1}else D=Oe(),l!==null&&l.memoizedState!==null&&(l.memoizedState.hydrationErrors=D),D=!0;if(!D)return u.flags&256?(vt(u),u):(vt(u),null)}return vt(u),(u.flags&128)!==0?(u.lanes=v,u):(v=b!==null,l=l!==null&&l.memoizedState!==null,v&&(b=u.child,D=null,b.alternate!==null&&b.alternate.memoizedState!==null&&b.alternate.memoizedState.cachePool!==null&&(D=b.alternate.memoizedState.cachePool.pool),N=null,b.memoizedState!==null&&b.memoizedState.cachePool!==null&&(N=b.memoizedState.cachePool.pool),N!==D&&(b.flags|=2048)),v!==l&&v&&(u.child.flags|=8192),Bu(u,u.updateQueue),gi(u),null);case 4:return ae(),q0(l,u),l===null&&ui(u.stateNode.containerInfo),gi(u),null;case 10:return it(u.type),gi(u),null;case 19:if(_(Bi),b=u.memoizedState,b===null)return gi(u),null;if(D=(u.flags&128)!==0,N=b.rendering,N===null)if(D)Dc(b,!1);else{if(Oi!==0||l!==null&&(l.flags&128)!==0)for(l=u.child;l!==null;){if(N=yt(l),N!==null){for(u.flags|=128,Dc(b,!1),l=N.updateQueue,u.updateQueue=l,Bu(u,l),u.subtreeFlags=0,l=v,v=u.child;v!==null;)xh(v,l),v=v.sibling;return S(Bi,Bi.current&1|2),Pn&&fe(u,b.treeForkCount),u.child}l=l.sibling}b.tail!==null&&Or()>xl&&(u.flags|=128,D=!0,Dc(b,!1),u.lanes=4194304)}else{if(!D)if(l=yt(N),l!==null){if(u.flags|=128,D=!0,l=l.updateQueue,u.updateQueue=l,Bu(u,l),Dc(b,!0),b.tail===null&&b.tailMode==="hidden"&&!N.alternate&&!Pn)return gi(u),null}else 2*Or()-b.renderingStartTime>xl&&v!==536870912&&(u.flags|=128,D=!0,Dc(b,!1),u.lanes=4194304);b.isBackwards?(N.sibling=u.child,u.child=N):(l=b.last,l!==null?l.sibling=N:u.child=N,b.last=N)}return b.tail!==null?(l=b.tail,b.rendering=l,b.tail=l.sibling,b.renderingStartTime=Or(),l.sibling=null,v=Bi.current,S(Bi,D?v&1|2:v&1),Pn&&fe(u,b.treeForkCount),l):(gi(u),null);case 22:case 23:return vt(u),ve(),b=u.memoizedState!==null,l!==null?l.memoizedState!==null!==b&&(u.flags|=8192):b&&(u.flags|=8192),b?(v&536870912)!==0&&(u.flags&128)===0&&(gi(u),u.subtreeFlags&6&&(u.flags|=8192)):gi(u),v=u.updateQueue,v!==null&&Bu(u,v.retryQueue),v=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(v=l.memoizedState.cachePool.pool),b=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(b=u.memoizedState.cachePool.pool),b!==v&&(u.flags|=2048),l!==null&&_(fl),null;case 24:return v=null,l!==null&&(v=l.memoizedState.cache),u.memoizedState.cache!==v&&(u.flags|=2048),it(Ri),gi(u),null;case 25:return null;case 30:return null}throw Error(i(156,u.tag))}function cp(l,u){switch(oe(u),u.tag){case 1:return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 3:return it(Ri),ae(),l=u.flags,(l&65536)!==0&&(l&128)===0?(u.flags=l&-65537|128,u):null;case 26:case 27:case 5:return me(u),null;case 31:if(u.memoizedState!==null){if(vt(u),u.alternate===null)throw Error(i(340));bt()}return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 13:if(vt(u),l=u.memoizedState,l!==null&&l.dehydrated!==null){if(u.alternate===null)throw Error(i(340));bt()}return l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 19:return _(Bi),null;case 4:return ae(),null;case 10:return it(u.type),null;case 22:case 23:return vt(u),ve(),l!==null&&_(fl),l=u.flags,l&65536?(u.flags=l&-65537|128,u):null;case 24:return it(Ri),null;case 25:return null;default:return null}}function Z0(l,u){switch(oe(u),u.tag){case 3:it(Ri),ae();break;case 26:case 27:case 5:me(u);break;case 4:ae();break;case 31:u.memoizedState!==null&&vt(u);break;case 13:vt(u);break;case 19:_(Bi);break;case 10:it(u.type);break;case 22:case 23:vt(u),ve(),l!==null&&_(fl);break;case 24:it(Ri)}}function Ps(l,u){try{var v=u.updateQueue,b=v!==null?v.lastEffect:null;if(b!==null){var D=b.next;v=D;do{if((v.tag&l)===l){b=void 0;var N=v.create,J=v.inst;b=N(),J.destroy=b}v=v.next}while(v!==D)}}catch(be){cn(u,u.return,be)}}function Fs(l,u,v){try{var b=u.updateQueue,D=b!==null?b.lastEffect:null;if(D!==null){var N=D.next;b=N;do{if((b.tag&l)===l){var J=b.inst,be=J.destroy;if(be!==void 0){J.destroy=void 0,D=u;var st=v,Et=be;try{Et()}catch(Pt){cn(D,st,Pt)}}}b=b.next}while(b!==N)}}catch(Pt){cn(u,u.return,Pt)}}function Uc(l){var u=l.updateQueue;if(u!==null){var v=l.stateNode;try{Ut(u,v)}catch(b){cn(l,l.return,b)}}}function lh(l,u,v){v.props=Gl(l.type,l.memoizedProps),v.state=l.memoizedState;try{v.componentWillUnmount()}catch(b){cn(l,u,b)}}function Ic(l,u){try{var v=l.ref;if(v!==null){switch(l.tag){case 26:case 27:case 5:var b=Vc(l.stateNode);break;case 30:b=l.stateNode;break;default:b=l.stateNode}typeof v=="function"?l.refCleanup=v(b):v.current=b}}catch(D){cn(l,u,D)}}function Nr(l,u){var v=l.ref,b=l.refCleanup;if(v!==null)if(typeof b=="function")try{b()}catch(D){cn(l,u,D)}finally{l.refCleanup=null,l=l.alternate,l!=null&&(l.refCleanup=null)}else if(typeof v=="function")try{v(null)}catch(D){cn(l,u,D)}else v.current=null}function Wl(l){var u=l.type,v=l.memoizedProps,b=l.stateNode;try{cg(b,u,v,l)}catch(D){cn(l,l.return,D)}}function ku(l,u,v){try{ug(l.stateNode,l.type,v,u,l)}catch(b){cn(l,l.return,b)}}function up(l){return l.tag===5||l.tag===3||(es?l.tag===26:!1)||(lr?l.tag===27&&nc(l.type):!1)||l.tag===4}function fo(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||up(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==18;){if(lr&&l.tag===27&&nc(l.type)||l.flags&2||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(l.flags&2))return l.stateNode}}function ch(l,u,v){var b=l.tag;if(b===5||b===6)l=l.stateNode,u?hg(v,l,u):Dp(v,l);else if(b!==4&&(lr&&b===27&&nc(l.type)&&(v=l.stateNode,u=null),l=l.child,l!==null))for(ch(l,u,v),l=l.sibling;l!==null;)ch(l,u,v),l=l.sibling}function Gu(l,u,v){var b=l.tag;if(b===5||b===6)l=l.stateNode,u?fg(v,l,u):Rp(v,l);else if(b!==4&&(lr&&b===27&&nc(l.type)&&(v=l.stateNode),l=l.child,l!==null))for(Gu(l,u,v),l=l.sibling;l!==null;)Gu(l,u,v),l=l.sibling}function fp(l,u,v){l=l.containerInfo;try{Pp(l,v)}catch(b){cn(u,u.return,b)}}function K0(l){var u=l.stateNode,v=l.memoizedProps;try{tr(l.type,v,u,l)}catch(b){cn(l,l.return,b)}}function r1(l,u){for(Th(l.containerInfo),qi=u;qi!==null;)if(l=qi,u=l.child,(l.subtreeFlags&1028)!==0&&u!==null)u.return=l,qi=u;else for(;qi!==null;){l=qi;var v=l.alternate;switch(u=l.flags,l.tag){case 0:if((u&4)!==0&&(u=l.updateQueue,u=u!==null?u.events:null,u!==null))for(var b=0;b";case Jc:return":has("+(Oc(l)||"")+")";case $c:return'[role="'+l.value+'"]';case ml:return'"'+l.value+'"';case ff:return'[data-testname="'+l.value+'"]';default:throw Error(i(365))}}function Pc(l,u){var v=[];l=[l,0];for(var b=0;bv?32:v;v=nn.T;var D=$a();try{On(b),nn.T=null,b=Kh,Kh=null;var N=Co,J=to;if(ir=0,hc=Co=null,to=0,(Un&6)!==0)throw Error(i(331));var be=Un;if(Un|=4,dh(N.current),fh(N,N.current,J,b),Un=be,lt(0,!1),ha&&typeof ha.onPostCommitFiberRoot=="function")try{ha.onPostCommitFiberRoot(ac,N)}catch{}return!0}finally{On(D),nn.T=v,yh(l,u)}}function il(l,u,v){u=ce(v,u),u=Jd(l.stateNode,u,2),l=We(l,u,2),l!==null&&(P(l,2),Le(l))}function cn(l,u,v){if(l.tag===3)il(l,l,v);else for(;u!==null;){if(u.tag===3){il(u,l,v);break}else if(u.tag===1){var b=u.stateNode;if(typeof u.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(Ao===null||!Ao.has(b))){l=ce(v,l),v=P0(2),b=We(u,v,2),b!==null&&(F0(v,b,u,l),P(b,2),Le(b));break}}u=u.return}}function kc(l,u,v){var b=l.pingCache;if(b===null){b=l.pingCache=new Oa;var D=new Set;b.set(u,D)}else D=b.get(u),D===void 0&&(D=new Set,b.set(u,D));D.has(v)||(vl=!0,D.add(v),l=tg.bind(null,l,u,v),u.then(l,l))}function tg(l,u,v){var b=l.pingCache;b!==null&&b.delete(u),l.pingedLanes|=l.suspendedLanes&v,l.warmLanes&=~v,Tn===l&&(Fn&v)===v&&(Oi===4||Oi===3&&(Fn&62914560)===Fn&&300>Or()-df?(Un&2)===0&&zi(l,0):eu|=v,tu===Fn&&(tu=0)),Le(l)}function ng(l,u){u===0&&(u=L()),l=jt(l,u),l!==null&&(P(l,u),Le(l))}function a1(l){var u=l.memoizedState,v=0;u!==null&&(v=u.retryLane),ng(l,v)}function s1(l,u){var v=0;switch(l.tag){case 31:case 13:var b=l.stateNode,D=l.memoizedState;D!==null&&(v=D.retryLane);break;case 19:b=l.stateNode;break;case 22:b=l.stateNode._retryCache;break;default:throw Error(i(314))}b!==null&&b.delete(u),ng(l,v)}function er(l,u){return rf(l,u)}function pp(l,u,v,b){this.tag=l,this.key=v,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=u,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Xl(l){return l=l.prototype,!(!l||!l.isReactComponent)}function Ra(l,u){var v=l.alternate;return v===null?(v=t(l.tag,u,l.key,l.mode),v.elementType=l.elementType,v.type=l.type,v.stateNode=l.stateNode,v.alternate=l,l.alternate=v):(v.pendingProps=u,v.type=l.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=l.flags&65011712,v.childLanes=l.childLanes,v.lanes=l.lanes,v.child=l.child,v.memoizedProps=l.memoizedProps,v.memoizedState=l.memoizedState,v.updateQueue=l.updateQueue,u=l.dependencies,v.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext},v.sibling=l.sibling,v.index=l.index,v.ref=l.ref,v.refCleanup=l.refCleanup,v}function xh(l,u){l.flags&=65011714;var v=l.alternate;return v===null?(l.childLanes=0,l.lanes=u,l.child=null,l.subtreeFlags=0,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=v.childLanes,l.lanes=v.lanes,l.child=v.child,l.subtreeFlags=0,l.deletions=null,l.memoizedProps=v.memoizedProps,l.memoizedState=v.memoizedState,l.updateQueue=v.updateQueue,l.type=v.type,u=v.dependencies,l.dependencies=u===null?null:{lanes:u.lanes,firstContext:u.firstContext}),l}function vo(l,u,v,b,D,N){var J=0;if(b=l,typeof l=="function")Xl(l)&&(J=1);else if(typeof l=="string")J=es&&lr?Nh(l,v,xr.current)?26:Qp(l)?27:5:es?Nh(l,v,xr.current)?26:5:lr&&Qp(l)?27:5;else e:switch(l){case Ku:return l=t(31,v,u,D),l.elementType=Ku,l.lanes=N,l;case Kl:return Qa(v.children,D,N,u);case Ql:J=8,D|=24;break;case Jl:return l=t(12,v,u,D|2),l.elementType=Jl,l.lanes=N,l;case Mh:return l=t(13,v,u,D),l.elementType=Mh,l.lanes=N,l;case yo:return l=t(19,v,u,D),l.elementType=yo,l.lanes=N,l;default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case Ja:J=10;break e;case Zu:J=9;break e;case Gc:J=11;break e;case Eh:J=14;break e;case Yr:J=16,b=null;break e}J=29,v=Error(i(130,l===null?"null":typeof l,"")),b=null}return u=t(J,v,u,D),u.elementType=l,u.type=b,u.lanes=N,u}function Qa(l,u,v,b){return l=t(7,l,b,u),l.lanes=v,l}function mp(l,u,v){return l=t(6,l,null,u),l.lanes=v,l}function gp(l){var u=t(18,null,null,0);return u.stateNode=l,u}function vp(l,u,v){return u=t(4,l.children!==null?l.children:[],l.key,u),u.lanes=v,u.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},u}function ig(l,u,v,b,D,N,J,be,st){this.tag=1,this.containerInfo=l,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ua,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=F(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=F(0),this.hiddenUpdates=F(null),this.identifierPrefix=b,this.onUncaughtError=D,this.onCaughtError=N,this.onRecoverableError=J,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=st,this.incompleteTransitions=new Map}function rl(l,u,v,b,D,N,J,be,st,Et,Pt,At){return l=new ig(l,u,v,J,st,Et,Pt,At,be),u=1,N===!0&&(u|=24),N=t(3,null,null,u),l.current=N,N.stateNode=l,u=ze(),u.refCount++,l.pooledCache=u,u.refCount++,N.memoizedState={element:b,isDehydrated:v,cache:u},V(N),l}function _h(l){return l?(l=qs,l):qs}function qu(l){var u=l._reactInternals;if(u===void 0)throw typeof l.render=="function"?Error(i(188)):(l=Object.keys(l).join(","),Error(i(268,l)));return l=f(u),l=l!==null?h(l):null,l===null?null:Vc(l.stateNode)}function yp(l,u,v,b,D,N){D=_h(D),b.context===null?b.context=D:b.pendingContext=D,b=ye(u),b.payload={element:v},N=N===void 0?null:N,N!==null&&(b.callback=N),v=We(l,b,u),v!==null&&(Ui(v,l,u),tt(v,l,u))}function ql(l,u){if(l=l.memoizedState,l!==null&&l.dehydrated!==null){var v=l.retryLane;l.retryLane=v!==0&&v=Et&&N>=At&&D<=Pt&&J<=Vt){l.splice(u,1);break}else if(b!==Et||v.width!==st.width||VtJ){if(!(N!==At||v.height!==st.height||PtD)){Et>b&&(st.width+=Et-b,st.x=b),PtN&&(st.height+=At-N,st.y=N),Vtv&&(v=be)),be ")+` + +No matching component was found for: + `)+l.join(" > ")}return null},Mn.getPublicRootInstance=function(l){if(l=l.current,!l.child)return null;switch(l.child.tag){case 27:case 5:return Vc(l.child.stateNode);default:return l.child.stateNode}},Mn.injectIntoDevTools=function(){var l={bundleType:0,version:_p,rendererPackageName:Qu,currentDispatcherRef:nn,reconcilerVersion:"19.2.0"};if(Hc!==null&&(l.rendererConfig=Hc),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")l=!1;else{var u=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(u.isDisabled||!u.supportsFiber)l=!0;else{try{ac=u.inject(l),ha=u}catch{}l=!!u.checkDCE}}return l},Mn.isAlreadyRendering=function(){return(Un&6)!==0},Mn.observeVisibleRects=function(l,u,v,b){if(!or)throw Error(i(363));l=oa(l,u);var D=Rh(l,v,b).disconnect;return{disconnect:function(){D()}}},Mn.shouldError=function(){return null},Mn.shouldSuspend=function(){return!1},Mn.startHostTransition=function(l,u,v,b){if(l.tag!==5)throw Error(i(476));var D=kl(l).queue;Bl(l,D,u,ec,v===null?n:function(){var N=kl(l);return N.next===null&&(N=l.alternate.memoizedState),Yo(l,N.next.queue,{},wi()),v(b)})},Mn.updateContainer=function(l,u,v,b){var D=u.current,N=wi();return yp(D,N,l,u,v,b),N},Mn.updateContainerSync=function(l,u,v,b){return yp(u.current,2,l,u,v,b),2},Mn},s.exports.default=s.exports,Object.defineProperty(s.exports,"__esModule",{value:!0})})(oT)),oT.exports}var cT;function FP(){return cT||(cT=1,sT.exports=PP()),sT.exports}var zP=FP();const BP=OP(zP);function kP(s){const e=BP(s);return e.injectIntoDevTools(),e}const YA=0,Gd={},GP=/^three(?=[A-Z])/,e1=s=>`${s[0].toUpperCase()}${s.slice(1)}`;let HP=0;const VP=s=>typeof s=="function";function gS(s){if(VP(s)){const e=`${HP++}`;return Gd[e]=s,e}else Object.assign(Gd,s)}function ZA(s,e){const t=e1(s),n=Gd[t];if(s!=="primitive"&&!n)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(s==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function jP(s,e,t){var n;return s=e1(s)in Gd?s:s.replace(GP,""),ZA(s,e),s==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,ux(e.object,t,s,e)}function WP(s){if(!s.isHidden){var e;s.props.attach&&(e=s.parent)!=null&&e.object?hx(s.parent,s):za(s.object)&&(s.object.visible=!1),s.isHidden=!0,Yd(s)}}function KA(s){if(s.isHidden){var e;s.props.attach&&(e=s.parent)!=null&&e.object?fx(s.parent,s):za(s.object)&&s.props.visible!==!1&&(s.object.visible=!0),s.isHidden=!1,Yd(s)}}function vS(s,e,t){const n=e.root.getState();if(!(!s.parent&&s.object!==n.scene)){if(!e.object){var i,a;const c=Gd[e1(e.type)];e.object=(i=e.props.object)!=null?i:new c(...(a=e.props.args)!=null?a:[]),e.object.__r3f=e}if(wl(e.object,e.props),e.props.attach)fx(s,e);else if(za(e.object)&&za(s.object)){const c=s.object.children.indexOf(t?.object);if(t&&c!==-1){const f=s.object.children.indexOf(e.object);if(f!==-1){s.object.children.splice(f,1);const h=f{try{s.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():ub.unstable_scheduleCallback(ub.unstable_IdlePriority,e)}}function hb(s,e,t){if(!e)return;e.parent=null;const n=s.children.indexOf(e);n!==-1&&s.children.splice(n,1),e.props.attach?hx(s,e):za(e.object)&&za(s.object)&&(s.object.remove(e.object),wP(GA(e),e.object));const i=e.props.dispose!==null&&t!==!1;for(let a=e.children.length-1;a>=0;a--){const c=e.children[a];hb(e,c,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&QA(e.object),t===void 0&&Yd(e)}function XP(s,e){for(const t of[s,s.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const dy=[];function qP(){for(const[t]of dy){const n=t.parent;if(n){t.props.attach?hx(n,t):za(t.object)&&za(n.object)&&n.object.remove(t.object);for(const i of t.children)i.props.attach?hx(t,i):za(i.object)&&za(t.object)&&t.object.remove(i.object)}t.isHidden&&KA(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&QA(t.object)}for(const[t,n,i]of dy){t.props=n;const a=t.parent;if(a){var s,e;const c=Gd[e1(t.type)];t.object=(s=t.props.object)!=null?s:new c(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,XP(i,t.object),wl(t.object,t.props),t.props.attach?fx(a,t):za(t.object)&&za(a.object)&&a.object.add(t.object);for(const f of t.children)f.props.attach?fx(t,f):za(f.object)&&za(t.object)&&t.object.add(f.object);Yd(t)}}dy.length=0}const O_=()=>{},fT={};let ny=YA;const YP=0,ZP=4,dx=kP({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:jP,removeChild:hb,appendChild:N_,appendInitialChild:N_,insertBefore:uT,appendChildToContainer(s,e){const t=s.getState().scene.__r3f;!e||!t||N_(t,e)},removeChildFromContainer(s,e){const t=s.getState().scene.__r3f;!e||!t||hb(t,e)},insertInContainerBefore(s,e,t){const n=s.getState().scene.__r3f;!e||!t||!n||uT(n,e,t)},getRootHostContext:()=>fT,getChildHostContext:()=>fT,commitUpdate(s,e,t,n,i){var a,c,f;ZA(e,n);let h=!1;if((s.type==="primitive"&&t.object!==n.object||((a=n.args)==null?void 0:a.length)!==((c=t.args)==null?void 0:c.length)||(f=n.args)!=null&&f.some((m,y)=>{var x;return m!==((x=t.args)==null?void 0:x[y])}))&&(h=!0),h)dy.push([s,{...n},i]);else{const m=MP(s,n);Object.keys(m).length&&(Object.assign(s.props,m),wl(s.object,m))}(i.sibling===null||(i.flags&ZP)===YP)&&qP()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:s=>s?.object,prepareForCommit:()=>null,preparePortalMount:s=>ux(s.getState().scene,s,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:WP,unhideInstance:KA,createTextInstance:O_,hideTextInstance:O_,unhideTextInstance:O_,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:Ce.createContext(null),setCurrentUpdatePriority(s){ny=s},getCurrentUpdatePriority(){return ny},resolveUpdatePriority(){var s;if(ny!==YA)return ny;switch(typeof window<"u"&&((s=window.event)==null?void 0:s.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return LP;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return UP;default:return IP}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:NP.version,applyViewTransitionName(s,e,t){},restoreViewTransitionName(s,e){},cancelViewTransitionName(s,e,t){},cancelRootViewTransitionName(s){},restoreRootViewTransitionName(s){},InstanceMeasurement:null,measureInstance:s=>null,wasInstanceInViewport:s=>!0,hasInstanceChanged:(s,e)=>!1,hasInstanceAffectedParent:(s,e)=>!1,suspendOnActiveViewTransition(s,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(s){},createViewTransitionInstance:s=>null,getCurrentGestureOffset(s){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(s,e){return s},cloneMutableTextInstance(s){return s},cloneRootViewTransitionContainer(s){throw new Error("Not implemented.")},removeRootViewTransitionClone(s,e){throw new Error("Not implemented.")},createFragmentInstance:s=>null,updateFragmentInstanceFiber(s,e){},commitNewChildToFragmentInstance(s,e){},deleteChildFromFragmentInstance(s,e){},measureClonedInstance:s=>null,maySuspendCommitOnUpdate:(s,e,t)=>!1,maySuspendCommitInSyncRender:(s,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(s,e)=>null}),Qf=new Map,Md={objects:"shallow",strict:!1};function KP(s,e){if(!e&&typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement&&s.parentElement){const{width:t,height:n,top:i,left:a}=s.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:a}}else if(!e&&typeof OffscreenCanvas<"u"&&s instanceof OffscreenCanvas)return{width:s.width,height:s.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function QP(s){const e=Qf.get(s),t=e?.fiber,n=e?.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,a=n||CP(mb,dT),c=t||dx.createContainer(a,DP,null,!1,null,"",i,i,i,null);e||Qf.set(s,{fiber:c,store:a});let f,h,p=!1,m=null;return{async configure(y={}){let x;m=new Promise(G=>x=G);let{gl:_,size:S,scene:C,events:T,onCreated:E,shadows:R=!1,linear:I=!1,flat:L=!1,legacy:F=!1,orthographic:P=!1,frameloop:z="always",dpr:U=[1,2],performance:O,raycaster:W,camera:q,onPointerMissed:Y}=y,K=a.getState(),$=K.gl;if(!K.gl){const G={canvas:s,powerPreference:"high-performance",antialias:!0,alpha:!0},Z=typeof _=="function"?await _(G):_;rT(Z)?$=Z:$=new uS({...G,..._}),K.set({gl:$})}let ie=K.raycaster;ie||K.set({raycaster:ie=new lS});const{params:X,...te}=W||{};if(Hi.equ(te,ie,Md)||wl(ie,{...te}),Hi.equ(X,ie.params,Md)||wl(ie,{params:{...ie.params,...X}}),!K.camera||K.camera===h&&!Hi.equ(h,q,Md)){h=q;const G=q?.isCamera,Z=G?q:P?new Rl(0,0,0,0,.1,1e3):new dr(75,0,.1,1e3);G||(Z.position.z=5,q&&(wl(Z,q),Z.manual||("aspect"in q||"left"in q||"right"in q||"bottom"in q||"top"in q)&&(Z.manual=!0,Z.updateProjectionMatrix())),!K.camera&&!(q!=null&&q.rotation)&&Z.lookAt(0,0,0)),K.set({camera:Z}),ie.camera=Z}if(!K.scene){let G;C!=null&&C.isScene?(G=C,ux(G,a,"",{})):(G=new S0,ux(G,a,"",{}),C&&wl(G,C)),K.set({scene:G})}T&&!K.events.handlers&&K.set({events:T(a)});const ge=KP(s,S);if(Hi.equ(ge,K.size,Md)||K.setSize(ge.width,ge.height,ge.top,ge.left),U&&K.viewport.dpr!==VA(U)&&K.setDpr(U),K.frameloop!==z&&K.setFrameloop(z),K.onPointerMissed||K.set({onPointerMissed:Y}),O&&!Hi.equ(O,K.performance,Md)&&K.set(G=>({performance:{...G.performance,...O}})),!K.xr){var ce;const G=(he,xe)=>{const ae=a.getState();ae.frameloop!=="never"&&dT(he,!0,ae,xe)},Z=()=>{const he=a.getState();he.gl.xr.enabled=he.gl.xr.isPresenting,he.gl.xr.setAnimationLoop(he.gl.xr.isPresenting?G:null),he.gl.xr.isPresenting||mb(he)},oe={connect(){const he=a.getState().gl;he.xr.addEventListener("sessionstart",Z),he.xr.addEventListener("sessionend",Z)},disconnect(){const he=a.getState().gl;he.xr.removeEventListener("sessionstart",Z),he.xr.removeEventListener("sessionend",Z)}};typeof((ce=$.xr)==null?void 0:ce.addEventListener)=="function"&&oe.connect(),K.set({xr:oe})}if($.shadowMap){const G=$.shadowMap.enabled,Z=$.shadowMap.type;if($.shadowMap.enabled=!!R,Hi.boo(R))$.shadowMap.type=Fm;else if(Hi.str(R)){var fe;const oe={basic:jT,percentage:Rd,soft:Fm,variance:Of};$.shadowMap.type=(fe=oe[R])!=null?fe:Fm}else Hi.obj(R)&&Object.assign($.shadowMap,R);(G!==$.shadowMap.enabled||Z!==$.shadowMap.type)&&($.shadowMap.needsUpdate=!0)}return Zn.enabled=!F,p||($.outputColorSpace=I?zo:ia,$.toneMapping=L?oo:mx),K.legacy!==F&&K.set(()=>({legacy:F})),K.linear!==I&&K.set(()=>({linear:I})),K.flat!==L&&K.set(()=>({flat:L})),_&&!Hi.fun(_)&&!rT(_)&&!Hi.equ(_,$,Md)&&wl($,_),f=E,p=!0,x(),this},render(y){return!p&&!m&&this.configure(),m.then(()=>{dx.updateContainer(A.jsx(JP,{store:a,children:y,onCreated:f,rootElement:s}),c,null,()=>{})}),a},unmount(){JA(s)}}}function JP({store:s,children:e,onCreated:t,rootElement:n}){return D0(()=>{const i=s.getState();i.set(a=>({internal:{...a.internal,active:!0}})),t&&t(i),s.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),A.jsx(pS.Provider,{value:s,children:e})}function JA(s,e){const t=Qf.get(s),n=t?.fiber;if(n){const i=t?.store.getState();i&&(i.internal.active=!1),dx.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var a,c,f,h;i.events.disconnect==null||i.events.disconnect(),(a=i.gl)==null||(c=a.renderLists)==null||c.dispose==null||c.dispose(),(f=i.gl)==null||f.forceContextLoss==null||f.forceContextLoss(),(h=i.gl)!=null&&h.xr&&i.xr.disconnect(),_P(i.scene),Qf.delete(s)}catch{}},500)})}}function $P(s,e,t){return A.jsx(e5,{children:s,container:e,state:t})}function e5({state:s={},children:e,container:t}){const{events:n,size:i,...a}=s,c=mS(),[f]=Ce.useState(()=>new lS),[h]=Ce.useState(()=>new pt),p=dS((y,x)=>{let _;if(x.camera&&i){const S=x.camera;_=y.viewport.getCurrentViewport(S,new se,i),S!==y.camera&&WA(S,i)}return{...y,...x,scene:t,raycaster:f,pointer:h,mouse:h,previousRoot:c,events:{...y.events,...x.events,...n},size:{...y.size,...i},viewport:{...y.viewport,..._},setEvents:S=>x.set(C=>({...C,events:{...C.events,...S}}))}}),m=Ce.useMemo(()=>{const y=NA((_,S)=>({...a,set:_,get:S})),x=_=>y.setState(S=>p.current(_,S));return x(c.getState()),c.subscribe(x),y},[c,t]);return A.jsx(A.Fragment,{children:dx.createPortal(A.jsx(pS.Provider,{value:m,children:e}),m,null)})}const t5=new Set,n5=new Set,i5=new Set;function P_(s,e){if(s.size)for(const{callback:t}of s.values())t(e)}function qm(s,e){switch(s){case"before":return P_(t5,e);case"after":return P_(n5,e);case"tail":return P_(i5,e)}}let F_,z_;function db(s,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof s=="number"&&(n=s-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=s),F_=e.internal.subscribers;for(let i=0;i0)&&!((e=Ed.gl.xr)!=null&&e.isPresenting)&&(B_+=db(s,Ed))}if(pb=!1,qm("after",s),B_===0)return qm("tail",s),px=!1,cancelAnimationFrame(hT)}function mb(s,e=1){var t;if(!s)return Qf.forEach(n=>mb(n.store.getState(),e));(t=s.gl.xr)!=null&&t.isPresenting||!s.internal.active||s.frameloop==="never"||(e>1?s.internal.frames=Math.min(60,s.internal.frames+e):pb?s.internal.frames=2:s.internal.frames=1,px||(px=!0,requestAnimationFrame($A)))}function dT(s,e=!0,t,n){if(e&&qm("before",s),t)db(s,t,n);else for(const i of Qf.values())db(s,i.store.getState());e&&qm("after",s)}const k_={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function r5(s){const{handlePointer:e}=AP(s);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(k_).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=s.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{const{set:n,events:i}=s.getState();if(i.disconnect==null||i.disconnect(),n(a=>({events:{...a.events,connected:t}})),i.handlers)for(const a in i.handlers){const c=i.handlers[a],[f,h]=k_[a];t.addEventListener(f,c,{passive:h})}},disconnect:()=>{const{set:t,events:n}=s.getState();if(n.connected){if(n.handlers)for(const i in n.handlers){const a=n.handlers[i],[c]=k_[i];n.connected.removeEventListener(c,a)}t(i=>({events:{...i.events,connected:void 0}}))}}}}function pT(s,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>s(...n),e)}}function a5({debounce:s,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[a,c]=Ce.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),f=Ce.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:a,orientationHandler:null}),h=s?typeof s=="number"?s:s.scroll:null,p=s?typeof s=="number"?s:s.resize:null,m=Ce.useRef(!1);Ce.useEffect(()=>(m.current=!0,()=>{m.current=!1}));const[y,x,_]=Ce.useMemo(()=>{const E=()=>{if(!f.current.element)return;const{left:R,top:I,width:L,height:F,bottom:P,right:z,x:U,y:O}=f.current.element.getBoundingClientRect(),W={left:R,top:I,width:L,height:F,bottom:P,right:z,x:U,y:O};f.current.element instanceof HTMLElement&&n&&(W.height=f.current.element.offsetHeight,W.width=f.current.element.offsetWidth),Object.freeze(W),m.current&&!c5(f.current.lastBounds,W)&&c(f.current.lastBounds=W)};return[E,p?pT(E,p):E,h?pT(E,h):E]},[c,n,h,p]);function S(){f.current.scrollContainers&&(f.current.scrollContainers.forEach(E=>E.removeEventListener("scroll",_,!0)),f.current.scrollContainers=null),f.current.resizeObserver&&(f.current.resizeObserver.disconnect(),f.current.resizeObserver=null),f.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",f.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",f.current.orientationHandler))}function C(){f.current.element&&(f.current.resizeObserver=new i(_),f.current.resizeObserver.observe(f.current.element),e&&f.current.scrollContainers&&f.current.scrollContainers.forEach(E=>E.addEventListener("scroll",_,{capture:!0,passive:!0})),f.current.orientationHandler=()=>{_()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",f.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",f.current.orientationHandler))}const T=E=>{!E||E===f.current.element||(S(),f.current.element=E,f.current.scrollContainers=e3(E),C())};return o5(_,!!e),s5(x),Ce.useEffect(()=>{S(),C()},[e,_,x]),Ce.useEffect(()=>S,[]),[T,a,y]}function s5(s){Ce.useEffect(()=>{const e=s;return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}},[s])}function o5(s,e){Ce.useEffect(()=>{if(e){const t=s;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[s,e])}function e3(s){const e=[];if(!s||s===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(s);return[t,n,i].some(a=>a==="auto"||a==="scroll")&&e.push(s),[...e,...e3(s.parentElement)]}const l5=["x","y","top","bottom","left","right","width","height"],c5=(s,e)=>l5.every(t=>s[t]===e[t]);function u5({ref:s,children:e,fallback:t,resize:n,style:i,gl:a,events:c=r5,eventSource:f,eventPrefix:h,shadows:p,linear:m,flat:y,legacy:x,orthographic:_,frameloop:S,dpr:C,performance:T,raycaster:E,camera:R,scene:I,onPointerMissed:L,onCreated:F,...P}){Ce.useMemo(()=>gS(ZO),[]);const z=gP(),[U,O]=a5({scroll:!0,debounce:{scroll:50,resize:0},...n}),W=Ce.useRef(null),q=Ce.useRef(null);Ce.useImperativeHandle(s,()=>W.current);const Y=dS(L),[K,$]=Ce.useState(!1),[ie,X]=Ce.useState(!1);if(K)throw K;if(ie)throw ie;const te=Ce.useRef(null);D0(()=>{const ce=W.current;if(O.width>0&&O.height>0&&ce){te.current||(te.current=QP(ce));async function fe(){await te.current.configure({gl:a,scene:I,events:c,shadows:p,linear:m,flat:y,legacy:x,orthographic:_,frameloop:S,dpr:C,performance:T,raycaster:E,camera:R,size:O,onPointerMissed:(...G)=>Y.current==null?void 0:Y.current(...G),onCreated:G=>{G.events.connect==null||G.events.connect(f?pP(f)?f.current:f:q.current),h&&G.setEvents({compute:(Z,oe)=>{const he=Z[h+"X"],xe=Z[h+"Y"];oe.pointer.set(he/oe.size.width*2-1,-(xe/oe.size.height)*2+1),oe.raycaster.setFromCamera(oe.pointer,oe.camera)}}),F?.(G)}}),te.current.render(A.jsx(z,{children:A.jsx(yP,{set:X,children:A.jsx(Ce.Suspense,{fallback:A.jsx(vP,{set:$}),children:e??null})})}))}fe()}}),Ce.useEffect(()=>{const ce=W.current;if(ce)return()=>JA(ce)},[]);const ge=f?"none":"auto";return A.jsx("div",{ref:q,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:ge,...i},...P,children:A.jsx("div",{ref:U,style:{width:"100%",height:"100%"},children:A.jsx("canvas",{ref:W,style:{display:"block"},children:t})})})}function f5(s){return A.jsx(BA,{children:A.jsx(u5,{...s})})}function Ru(){return Ru=Object.assign?Object.assign.bind():function(s){for(var e=1;e{if(s)return n.style.cursor=e,()=>{n.style.cursor=t}},[s])}const yS=parseInt(Vd.replace(/\D+/g,""));var ao=Uint8Array,Eu=Uint16Array,gb=Uint32Array,t3=new ao([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),n3=new ao([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),h5=new ao([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),i3=function(s,e){for(var t=new Eu(31),n=0;n<31;++n)t[n]=e+=1<>>1|(Fi&21845)<<1;vu=(vu&52428)>>>2|(vu&13107)<<2,vu=(vu&61680)>>>4|(vu&3855)<<4,vb[Fi]=((vu&65280)>>>8|(vu&255)<<8)>>>1}var Ym=(function(s,e,t){for(var n=s.length,i=0,a=new Eu(e);i>>h]=p}else for(f=new Eu(n),i=0;i>>15-s[i]);return f}),I0=new ao(288);for(var Fi=0;Fi<144;++Fi)I0[Fi]=8;for(var Fi=144;Fi<256;++Fi)I0[Fi]=9;for(var Fi=256;Fi<280;++Fi)I0[Fi]=7;for(var Fi=280;Fi<288;++Fi)I0[Fi]=8;var s3=new ao(32);for(var Fi=0;Fi<32;++Fi)s3[Fi]=5;var g5=Ym(I0,9,1),v5=Ym(s3,5,1),G_=function(s){for(var e=s[0],t=1;te&&(e=s[t]);return e},Io=function(s,e,t){var n=e/8|0;return(s[n]|s[n+1]<<8)>>(e&7)&t},H_=function(s,e){var t=e/8|0;return(s[t]|s[t+1]<<8|s[t+2]<<16)>>(e&7)},y5=function(s){return(s/8|0)+(s&7&&1)},x5=function(s,e,t){(t==null||t>s.length)&&(t=s.length);var n=new(s instanceof Eu?Eu:s instanceof gb?gb:ao)(t-e);return n.set(s.subarray(e,t)),n},_5=function(s,e,t){var n=s.length;if(!n||t&&!t.l&&n<5)return e||new ao(0);var i=!e||t,a=!t||t.i;t||(t={}),e||(e=new ao(n*3));var c=function(ae){var de=e.length;if(ae>de){var me=new ao(Math.max(de*2,ae));me.set(e),e=me}},f=t.f||0,h=t.p||0,p=t.b||0,m=t.l,y=t.d,x=t.m,_=t.n,S=n*8;do{if(!m){t.f=f=Io(s,h,1);var C=Io(s,h+1,3);if(h+=3,C)if(C==1)m=g5,y=v5,x=9,_=5;else if(C==2){var I=Io(s,h,31)+257,L=Io(s,h+10,15)+4,F=I+Io(s,h+5,31)+1;h+=14;for(var P=new ao(F),z=new ao(19),U=0;U>>4;if(T<16)P[U++]=T;else{var K=0,$=0;for(T==16?($=3+Io(s,h,3),h+=2,K=P[U-1]):T==17?($=3+Io(s,h,7),h+=3):T==18&&($=11+Io(s,h,127),h+=7);$--;)P[U++]=K}}var ie=P.subarray(0,I),X=P.subarray(I);x=G_(ie),_=G_(X),m=Ym(ie,x,1),y=Ym(X,_,1)}else throw"invalid block type";else{var T=y5(h)+4,E=s[T-4]|s[T-3]<<8,R=T+E;if(R>n){if(a)throw"unexpected EOF";break}i&&c(p+E),e.set(s.subarray(T,R),p),t.b=p+=E,t.p=h=R*8;continue}if(h>S){if(a)throw"unexpected EOF";break}}i&&c(p+131072);for(var te=(1<>>4;if(h+=K&15,h>S){if(a)throw"unexpected EOF";break}if(!K)throw"invalid length/literal";if(fe<256)e[p++]=fe;else if(fe==256){ce=h,m=null;break}else{var G=fe-254;if(fe>264){var U=fe-257,Z=t3[U];G=Io(s,h,(1<>>4;if(!oe)throw"invalid distance";h+=oe&15;var X=m5[he];if(he>3){var Z=n3[he];X+=H_(s,h)&(1<S){if(a)throw"unexpected EOF";break}i&&c(p+131072);for(var xe=p+G;p>>4>7||(s[0]<<8|s[1])%31)throw"invalid zlib data";if(s[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function iy(s,e){return _5((S5(s),s.subarray(2,-4)),e)}var M5=typeof TextDecoder<"u"&&new TextDecoder,E5=0;try{M5.decode(b5,{stream:!0}),E5=1}catch{}var T5=Object.defineProperty,w5=(s,e,t)=>e in s?T5(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,mT=(s,e,t)=>(w5(s,typeof e!="symbol"?e+"":e,t),t);const A5=(()=>{const s={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new se},up:{value:new se(0,1,0)}},vertexShader:` + uniform vec3 sunPosition; + uniform float rayleigh; + uniform float turbidity; + uniform float mieCoefficient; + uniform vec3 up; + + varying vec3 vWorldPosition; + varying vec3 vSunDirection; + varying float vSunfade; + varying vec3 vBetaR; + varying vec3 vBetaM; + varying float vSunE; + + // constants for atmospheric scattering + const float e = 2.71828182845904523536028747135266249775724709369995957; + const float pi = 3.141592653589793238462643383279502884197169; + + // wavelength of used primaries, according to preetham + const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 ); + // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function: + // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn)) + const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 ); + + // mie stuff + // K coefficient for the primaries + const float v = 4.0; + const vec3 K = vec3( 0.686, 0.678, 0.666 ); + // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K + const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 ); + + // earth shadow hack + // cutoffAngle = pi / 1.95; + const float cutoffAngle = 1.6110731556870734; + const float steepness = 1.5; + const float EE = 1000.0; + + float sunIntensity( float zenithAngleCos ) { + zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 ); + return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) ); + } + + vec3 totalMie( float T ) { + float c = ( 0.2 * T ) * 10E-18; + return 0.434 * c * MieConst; + } + + void main() { + + vec4 worldPosition = modelMatrix * vec4( position, 1.0 ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + gl_Position.z = gl_Position.w; // set z to camera.far + + vSunDirection = normalize( sunPosition ); + + vSunE = sunIntensity( dot( vSunDirection, up ) ); + + vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 ); + + float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) ); + + // extinction (absorbtion + out scattering) + // rayleigh coefficients + vBetaR = totalRayleigh * rayleighCoefficient; + + // mie coefficients + vBetaM = totalMie( turbidity ) * mieCoefficient; + + } + `,fragmentShader:` + varying vec3 vWorldPosition; + varying vec3 vSunDirection; + varying float vSunfade; + varying vec3 vBetaR; + varying vec3 vBetaM; + varying float vSunE; + + uniform float mieDirectionalG; + uniform vec3 up; + + const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 ); + + // constants for atmospheric scattering + const float pi = 3.141592653589793238462643383279502884197169; + + const float n = 1.0003; // refractive index of air + const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius) + + // optical length at zenith for molecules + const float rayleighZenithLength = 8.4E3; + const float mieZenithLength = 1.25E3; + // 66 arc seconds -> degrees, and the cosine of that + const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324; + + // 3.0 / ( 16.0 * pi ) + const float THREE_OVER_SIXTEENPI = 0.05968310365946075; + // 1.0 / ( 4.0 * pi ) + const float ONE_OVER_FOURPI = 0.07957747154594767; + + float rayleighPhase( float cosTheta ) { + return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) ); + } + + float hgPhase( float cosTheta, float g ) { + float g2 = pow( g, 2.0 ); + float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 ); + return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse ); + } + + void main() { + + vec3 direction = normalize( vWorldPosition - cameraPos ); + + // optical length + // cutoff angle at 90 to avoid singularity in next formula. + float zenithAngle = acos( max( 0.0, dot( up, direction ) ) ); + float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) ); + float sR = rayleighZenithLength * inverse; + float sM = mieZenithLength * inverse; + + // combined extinction factor + vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) ); + + // in scattering + float cosTheta = dot( direction, vSunDirection ); + + float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 ); + vec3 betaRTheta = vBetaR * rPhase; + + float mPhase = hgPhase( cosTheta, mieDirectionalG ); + vec3 betaMTheta = vBetaM * mPhase; + + vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) ); + Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) ); + + // nightsky + float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2] + float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2] + vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 ); + vec3 L0 = vec3( 0.1 ) * Fex; + + // composition + solar disc + float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta ); + L0 += ( vSunE * 19000.0 * Fex ) * sundisk; + + vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 ); + + vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) ); + + gl_FragColor = vec4( retColor, 1.0 ); + + #include + #include <${yS>=154?"colorspace_fragment":"encodings_fragment"}> + + } + `},e=new Vr({name:"SkyShader",fragmentShader:s.fragmentShader,vertexShader:s.vertexShader,uniforms:Wx.clone(s.uniforms),side:ba,depthWrite:!1});class t extends Si{constructor(){super(new Uu(1,1,1),e)}}return mT(t,"SkyShader",s),mT(t,"material",e),t})(),C5=s=>s&&s.isCubeTexture;class R5 extends Si{constructor(e,t){var n,i;const a=C5(e),f=((i=a?(n=e.image[0])==null?void 0:n.width:e.image.width)!=null?i:1024)/4,h=Math.floor(Math.log2(f)),p=Math.pow(2,h),m=3*Math.max(p,112),y=4*p,x=[a?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/m}`,`#define CUBEUV_TEXEL_HEIGHT ${1/y}`,`#define CUBEUV_MAX_MIP ${h}.0`],_=` + varying vec3 vWorldPosition; + void main() + { + vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + } + `,S=x.join(` +`)+` + #define ENVMAP_TYPE_CUBE_UV + varying vec3 vWorldPosition; + uniform float radius; + uniform float height; + uniform float angle; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube map; + #else + uniform sampler2D map; + #endif + // From: https://www.shadertoy.com/view/4tsBD7 + float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) + { + float d = dot ( rd, n ); + + if( d > 0.0 ) { return 1e6; } + + vec3 o = ro - c; + float t = - dot( n, o ) / d; + vec3 q = o + rd * t; + + return ( dot( q, q ) < r * r ) ? t : 1e6; + } + // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm + float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) + { + vec3 oc = ro - ce; + float b = dot( oc, rd ); + float c = dot( oc, oc ) - ra * ra; + float h = b * b - c; + + if( h < 0.0 ) { return -1.0; } + + h = sqrt( h ); + + return - b + h; + } + vec3 project() + { + vec3 p = normalize( vWorldPosition ); + vec3 camPos = cameraPosition; + camPos.y -= height; + float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); + if( intersection > 0.0 ) { + + vec3 h = vec3( 0.0, - height, 0.0 ); + float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); + p = ( camPos + min( intersection, intersection2 ) * p ) / radius; + } else { + p = vec3( 0.0, 1.0, 0.0 ); + } + return p; + } + #include + #include + void main() + { + vec3 projectedWorldPosition = project(); + + #ifdef ENVMAP_TYPE_CUBE + vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; + #else + vec3 direction = normalize( projectedWorldPosition ); + vec2 uv = equirectUv( direction ); + vec3 outcolor = texture2D( map, uv ).rgb; + #endif + gl_FragColor = vec4( outcolor, 1.0 ); + #include + #include <${yS>=154?"colorspace_fragment":"encodings_fragment"}> + } + `,C={map:{value:e},height:{value:t?.height||15},radius:{value:t?.radius||100}},T=new w0(1,16),E=new Vr({uniforms:C,fragmentShader:S,vertexShader:_,side:Ki});super(T,E)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}var D5=Object.defineProperty,U5=(s,e,t)=>e in s?D5(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,I5=(s,e,t)=>(U5(s,e+"",t),t);class L5{constructor(){I5(this,"_listeners")}addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const a=i.indexOf(t);a!==-1&&i.splice(a,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let a=0,c=i.length;ae in s?N5(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,on=(s,e,t)=>(O5(s,typeof e!="symbol"?e+"":e,t),t);const ry=new Jf,gT=new _c,P5=Math.cos(70*(Math.PI/180)),vT=(s,e)=>(s%e+e)%e;let F5=class extends L5{constructor(e,t){super(),on(this,"object"),on(this,"domElement"),on(this,"enabled",!0),on(this,"target",new se),on(this,"minDistance",0),on(this,"maxDistance",1/0),on(this,"minZoom",0),on(this,"maxZoom",1/0),on(this,"minPolarAngle",0),on(this,"maxPolarAngle",Math.PI),on(this,"minAzimuthAngle",-1/0),on(this,"maxAzimuthAngle",1/0),on(this,"enableDamping",!1),on(this,"dampingFactor",.05),on(this,"enableZoom",!0),on(this,"zoomSpeed",1),on(this,"enableRotate",!0),on(this,"rotateSpeed",1),on(this,"enablePan",!0),on(this,"panSpeed",1),on(this,"screenSpacePanning",!0),on(this,"keyPanSpeed",7),on(this,"zoomToCursor",!1),on(this,"autoRotate",!1),on(this,"autoRotateSpeed",2),on(this,"reverseOrbit",!1),on(this,"reverseHorizontalOrbit",!1),on(this,"reverseVerticalOrbit",!1),on(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),on(this,"mouseButtons",{LEFT:Uf.ROTATE,MIDDLE:Uf.DOLLY,RIGHT:Uf.PAN}),on(this,"touches",{ONE:If.ROTATE,TWO:If.DOLLY_PAN}),on(this,"target0"),on(this,"position0"),on(this,"zoom0"),on(this,"_domElementKeyEvents",null),on(this,"getPolarAngle"),on(this,"getAzimuthalAngle"),on(this,"setPolarAngle"),on(this,"setAzimuthalAngle"),on(this,"getDistance"),on(this,"getZoomScale"),on(this,"listenToKeyEvents"),on(this,"stopListenToKeyEvents"),on(this,"saveState"),on(this,"reset"),on(this,"update"),on(this,"connect"),on(this,"dispose"),on(this,"dollyIn"),on(this,"dollyOut"),on(this,"getScale"),on(this,"setScale"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>m.phi,this.getAzimuthalAngle=()=>m.theta,this.setPolarAngle=le=>{let Ie=vT(le,2*Math.PI),De=m.phi;De<0&&(De+=2*Math.PI),Ie<0&&(Ie+=2*Math.PI);let re=Math.abs(Ie-De);2*Math.PI-re{let Ie=vT(le,2*Math.PI),De=m.theta;De<0&&(De+=2*Math.PI),Ie<0&&(Ie+=2*Math.PI);let re=Math.abs(Ie-De);2*Math.PI-ren.object.position.distanceTo(n.target),this.listenToKeyEvents=le=>{le.addEventListener("keydown",Ae),this._domElementKeyEvents=le},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",Ae),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),h=f.NONE},this.update=(()=>{const le=new se,Ie=new se(0,1,0),De=new kr().setFromUnitVectors(e.up,Ie),re=De.clone().invert(),pe=new se,Fe=new kr,et=2*Math.PI;return function(){const Me=n.object.position;De.setFromUnitVectors(e.up,Ie),re.copy(De).invert(),le.copy(Me).sub(n.target),le.applyQuaternion(De),m.setFromVector3(le),n.autoRotate&&h===f.NONE&&$(Y()),n.enableDamping?(m.theta+=y.theta*n.dampingFactor,m.phi+=y.phi*n.dampingFactor):(m.theta+=y.theta,m.phi+=y.phi);let ht=n.minAzimuthAngle,St=n.maxAzimuthAngle;isFinite(ht)&&isFinite(St)&&(ht<-Math.PI?ht+=et:ht>Math.PI&&(ht-=et),St<-Math.PI?St+=et:St>Math.PI&&(St-=et),ht<=St?m.theta=Math.max(ht,Math.min(St,m.theta)):m.theta=m.theta>(ht+St)/2?Math.max(ht,m.theta):Math.min(St,m.theta)),m.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,m.phi)),m.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(_,n.dampingFactor):n.target.add(_),n.zoomToCursor&&O||n.object.isOrthographicCamera?m.radius=oe(m.radius):m.radius=oe(m.radius*x),le.setFromSpherical(m),le.applyQuaternion(re),Me.copy(n.target).add(le),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(y.theta*=1-n.dampingFactor,y.phi*=1-n.dampingFactor,_.multiplyScalar(1-n.dampingFactor)):(y.set(0,0,0),_.set(0,0,0));let It=!1;if(n.zoomToCursor&&O){let Gt=null;if(n.object instanceof dr&&n.object.isPerspectiveCamera){const un=le.length();Gt=oe(un*x);const tn=un-Gt;n.object.position.addScaledVector(z,tn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const un=new se(U.x,U.y,0);un.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/x)),n.object.updateProjectionMatrix(),It=!0;const tn=new se(U.x,U.y,0);tn.unproject(n.object),n.object.position.sub(tn).add(un),n.object.updateMatrixWorld(),Gt=le.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Gt!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Gt).add(n.object.position):(ry.origin.copy(n.object.position),ry.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(ry.direction))p||8*(1-Fe.dot(n.object.quaternion))>p?(n.dispatchEvent(i),pe.copy(n.object.position),Fe.copy(n.object.quaternion),It=!1,!0):!1}})(),this.connect=le=>{n.domElement=le,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Tt),n.domElement.addEventListener("pointerdown",je),n.domElement.addEventListener("pointercancel",B),n.domElement.addEventListener("wheel",we)},this.dispose=()=>{var le,Ie,De,re,pe,Fe;n.domElement&&(n.domElement.style.touchAction="auto"),(le=n.domElement)==null||le.removeEventListener("contextmenu",Tt),(Ie=n.domElement)==null||Ie.removeEventListener("pointerdown",je),(De=n.domElement)==null||De.removeEventListener("pointercancel",B),(re=n.domElement)==null||re.removeEventListener("wheel",we),(pe=n.domElement)==null||pe.ownerDocument.removeEventListener("pointermove",j),(Fe=n.domElement)==null||Fe.ownerDocument.removeEventListener("pointerup",B),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",Ae)};const n=this,i={type:"change"},a={type:"start"},c={type:"end"},f={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let h=f.NONE;const p=1e-6,m=new cx,y=new cx;let x=1;const _=new se,S=new pt,C=new pt,T=new pt,E=new pt,R=new pt,I=new pt,L=new pt,F=new pt,P=new pt,z=new se,U=new pt;let O=!1;const W=[],q={};function Y(){return 2*Math.PI/60/60*n.autoRotateSpeed}function K(){return Math.pow(.95,n.zoomSpeed)}function $(le){n.reverseOrbit||n.reverseHorizontalOrbit?y.theta+=le:y.theta-=le}function ie(le){n.reverseOrbit||n.reverseVerticalOrbit?y.phi+=le:y.phi-=le}const X=(()=>{const le=new se;return function(De,re){le.setFromMatrixColumn(re,0),le.multiplyScalar(-De),_.add(le)}})(),te=(()=>{const le=new se;return function(De,re){n.screenSpacePanning===!0?le.setFromMatrixColumn(re,1):(le.setFromMatrixColumn(re,0),le.crossVectors(n.object.up,le)),le.multiplyScalar(De),_.add(le)}})(),ge=(()=>{const le=new se;return function(De,re){const pe=n.domElement;if(pe&&n.object instanceof dr&&n.object.isPerspectiveCamera){const Fe=n.object.position;le.copy(Fe).sub(n.target);let et=le.length();et*=Math.tan(n.object.fov/2*Math.PI/180),X(2*De*et/pe.clientHeight,n.object.matrix),te(2*re*et/pe.clientHeight,n.object.matrix)}else pe&&n.object instanceof Rl&&n.object.isOrthographicCamera?(X(De*(n.object.right-n.object.left)/n.object.zoom/pe.clientWidth,n.object.matrix),te(re*(n.object.top-n.object.bottom)/n.object.zoom/pe.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ce(le){n.object instanceof dr&&n.object.isPerspectiveCamera||n.object instanceof Rl&&n.object.isOrthographicCamera?x=le:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function fe(le){ce(x/le)}function G(le){ce(x*le)}function Z(le){if(!n.zoomToCursor||!n.domElement)return;O=!0;const Ie=n.domElement.getBoundingClientRect(),De=le.clientX-Ie.left,re=le.clientY-Ie.top,pe=Ie.width,Fe=Ie.height;U.x=De/pe*2-1,U.y=-(re/Fe)*2+1,z.set(U.x,U.y,1).unproject(n.object).sub(n.object.position).normalize()}function oe(le){return Math.max(n.minDistance,Math.min(n.maxDistance,le))}function he(le){S.set(le.clientX,le.clientY)}function xe(le){Z(le),L.set(le.clientX,le.clientY)}function ae(le){E.set(le.clientX,le.clientY)}function de(le){C.set(le.clientX,le.clientY),T.subVectors(C,S).multiplyScalar(n.rotateSpeed);const Ie=n.domElement;Ie&&($(2*Math.PI*T.x/Ie.clientHeight),ie(2*Math.PI*T.y/Ie.clientHeight)),S.copy(C),n.update()}function me(le){F.set(le.clientX,le.clientY),P.subVectors(F,L),P.y>0?fe(K()):P.y<0&&G(K()),L.copy(F),n.update()}function Ge(le){R.set(le.clientX,le.clientY),I.subVectors(R,E).multiplyScalar(n.panSpeed),ge(I.x,I.y),E.copy(R),n.update()}function ct(le){Z(le),le.deltaY<0?G(K()):le.deltaY>0&&fe(K()),n.update()}function Qe(le){let Ie=!1;switch(le.code){case n.keys.UP:ge(0,n.keyPanSpeed),Ie=!0;break;case n.keys.BOTTOM:ge(0,-n.keyPanSpeed),Ie=!0;break;case n.keys.LEFT:ge(n.keyPanSpeed,0),Ie=!0;break;case n.keys.RIGHT:ge(-n.keyPanSpeed,0),Ie=!0;break}Ie&&(le.preventDefault(),n.update())}function $e(){if(W.length==1)S.set(W[0].pageX,W[0].pageY);else{const le=.5*(W[0].pageX+W[1].pageX),Ie=.5*(W[0].pageY+W[1].pageY);S.set(le,Ie)}}function bt(){if(W.length==1)E.set(W[0].pageX,W[0].pageY);else{const le=.5*(W[0].pageX+W[1].pageX),Ie=.5*(W[0].pageY+W[1].pageY);E.set(le,Ie)}}function Oe(){const le=W[0].pageX-W[1].pageX,Ie=W[0].pageY-W[1].pageY,De=Math.sqrt(le*le+Ie*Ie);L.set(0,De)}function Ve(){n.enableZoom&&Oe(),n.enablePan&&bt()}function Pe(){n.enableZoom&&Oe(),n.enableRotate&&$e()}function it(le){if(W.length==1)C.set(le.pageX,le.pageY);else{const De=rt(le),re=.5*(le.pageX+De.x),pe=.5*(le.pageY+De.y);C.set(re,pe)}T.subVectors(C,S).multiplyScalar(n.rotateSpeed);const Ie=n.domElement;Ie&&($(2*Math.PI*T.x/Ie.clientHeight),ie(2*Math.PI*T.y/Ie.clientHeight)),S.copy(C)}function Q(le){if(W.length==1)R.set(le.pageX,le.pageY);else{const Ie=rt(le),De=.5*(le.pageX+Ie.x),re=.5*(le.pageY+Ie.y);R.set(De,re)}I.subVectors(R,E).multiplyScalar(n.panSpeed),ge(I.x,I.y),E.copy(R)}function ut(le){const Ie=rt(le),De=le.pageX-Ie.x,re=le.pageY-Ie.y,pe=Math.sqrt(De*De+re*re);F.set(0,pe),P.set(0,Math.pow(F.y/L.y,n.zoomSpeed)),fe(P.y),L.copy(F)}function qe(le){n.enableZoom&&ut(le),n.enablePan&&Q(le)}function Ne(le){n.enableZoom&&ut(le),n.enableRotate&&it(le)}function je(le){var Ie,De;n.enabled!==!1&&(W.length===0&&((Ie=n.domElement)==null||Ie.ownerDocument.addEventListener("pointermove",j),(De=n.domElement)==null||De.ownerDocument.addEventListener("pointerup",B)),Rt(le),le.pointerType==="touch"?Le(le):ue(le))}function j(le){n.enabled!==!1&&(le.pointerType==="touch"?lt(le):ze(le))}function B(le){var Ie,De,re;Xe(le),W.length===0&&((Ie=n.domElement)==null||Ie.releasePointerCapture(le.pointerId),(De=n.domElement)==null||De.ownerDocument.removeEventListener("pointermove",j),(re=n.domElement)==null||re.ownerDocument.removeEventListener("pointerup",B)),n.dispatchEvent(c),h=f.NONE}function ue(le){let Ie;switch(le.button){case 0:Ie=n.mouseButtons.LEFT;break;case 1:Ie=n.mouseButtons.MIDDLE;break;case 2:Ie=n.mouseButtons.RIGHT;break;default:Ie=-1}switch(Ie){case Uf.DOLLY:if(n.enableZoom===!1)return;xe(le),h=f.DOLLY;break;case Uf.ROTATE:if(le.ctrlKey||le.metaKey||le.shiftKey){if(n.enablePan===!1)return;ae(le),h=f.PAN}else{if(n.enableRotate===!1)return;he(le),h=f.ROTATE}break;case Uf.PAN:if(le.ctrlKey||le.metaKey||le.shiftKey){if(n.enableRotate===!1)return;he(le),h=f.ROTATE}else{if(n.enablePan===!1)return;ae(le),h=f.PAN}break;default:h=f.NONE}h!==f.NONE&&n.dispatchEvent(a)}function ze(le){if(n.enabled!==!1)switch(h){case f.ROTATE:if(n.enableRotate===!1)return;de(le);break;case f.DOLLY:if(n.enableZoom===!1)return;me(le);break;case f.PAN:if(n.enablePan===!1)return;Ge(le);break}}function we(le){n.enabled===!1||n.enableZoom===!1||h!==f.NONE&&h!==f.ROTATE||(le.preventDefault(),n.dispatchEvent(a),ct(le),n.dispatchEvent(c))}function Ae(le){n.enabled===!1||n.enablePan===!1||Qe(le)}function Le(le){switch(He(le),W.length){case 1:switch(n.touches.ONE){case If.ROTATE:if(n.enableRotate===!1)return;$e(),h=f.TOUCH_ROTATE;break;case If.PAN:if(n.enablePan===!1)return;bt(),h=f.TOUCH_PAN;break;default:h=f.NONE}break;case 2:switch(n.touches.TWO){case If.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ve(),h=f.TOUCH_DOLLY_PAN;break;case If.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Pe(),h=f.TOUCH_DOLLY_ROTATE;break;default:h=f.NONE}break;default:h=f.NONE}h!==f.NONE&&n.dispatchEvent(a)}function lt(le){switch(He(le),h){case f.TOUCH_ROTATE:if(n.enableRotate===!1)return;it(le),n.update();break;case f.TOUCH_PAN:if(n.enablePan===!1)return;Q(le),n.update();break;case f.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;qe(le),n.update();break;case f.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Ne(le),n.update();break;default:h=f.NONE}}function Tt(le){n.enabled!==!1&&le.preventDefault()}function Rt(le){W.push(le)}function Xe(le){delete q[le.pointerId];for(let Ie=0;Ie{G(le),n.update()},this.dollyOut=(le=K())=>{fe(le),n.update()},this.getScale=()=>x,this.setScale=le=>{ce(le),n.update()},this.getZoomScale=()=>K(),t!==void 0&&this.connect(t),this.update()}};class z5 extends eS{constructor(e){super(e),this.type=sr}parse(e){const c=function(U,O){switch(U){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(O||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(O||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(O||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(O||""))}},y=function(U,O,W){O=O||1024;let Y=U.pos,K=-1,$=0,ie="",X=String.fromCharCode.apply(null,new Uint16Array(U.subarray(Y,Y+128)));for(;0>(K=X.indexOf(` +`))&&$=U.byteLength||!(ie=y(U)))&&c(1,"no header found"),(X=ie.match(O))||c(3,"bad initial token"),$.valid|=1,$.programtype=X[1],$.string+=ie+` +`;ie=y(U),ie!==!1;){if($.string+=ie+` +`,ie.charAt(0)==="#"){$.comments+=ie+` +`;continue}if((X=ie.match(W))&&($.gamma=parseFloat(X[1])),(X=ie.match(q))&&($.exposure=parseFloat(X[1])),(X=ie.match(Y))&&($.valid|=2,$.format=X[1]),(X=ie.match(K))&&($.valid|=4,$.height=parseInt(X[1],10),$.width=parseInt(X[2],10)),$.valid&2&&$.valid&4)break}return $.valid&2||c(3,"missing format specifier"),$.valid&4||c(3,"missing image size specifier"),$},_=function(U,O,W){const q=O;if(q<8||q>32767||U[0]!==2||U[1]!==2||U[2]&128)return new Uint8Array(U);q!==(U[2]<<8|U[3])&&c(3,"wrong scanline width");const Y=new Uint8Array(4*O*W);Y.length||c(4,"unable to allocate buffer space");let K=0,$=0;const ie=4*q,X=new Uint8Array(4),te=new Uint8Array(ie);let ge=W;for(;ge>0&&$U.byteLength&&c(1),X[0]=U[$++],X[1]=U[$++],X[2]=U[$++],X[3]=U[$++],(X[0]!=2||X[1]!=2||(X[2]<<8|X[3])!=q)&&c(3,"bad rgbe scanline format");let ce=0,fe;for(;ce128;if(Z&&(fe-=128),(fe===0||ce+fe>ie)&&c(3,"bad scanline data"),Z){const oe=U[$++];for(let he=0;he=152;class B5 extends eS{constructor(e){super(e),this.type=sr}parse(e){const O=Math.pow(2.7182818,2.2);function W(V,ne){for(var ye=0,We=0;We<65536;++We)(We==0||V[We>>3]&1<<(We&7))&&(ne[ye++]=We);for(var tt=ye-1;ye<65536;)ne[ye++]=0;return tt}function q(V){for(var ne=0;ne<16384;ne++)V[ne]={},V[ne].len=0,V[ne].lit=0,V[ne].p=null}const Y={l:0,c:0,lc:0};function K(V,ne,ye,We,tt){for(;ye>ye&(1<0;--ne){var We=ye+$[ne]>>1;$[ne]=ye,ye=We}for(var ne=0;ne<65537;++ne){var tt=V[ne];tt>0&&(V[ne]=tt|$[tt]++<<6)}}function X(V,ne,ye,We,tt,at,wt){for(var _t=ye,Dt=0,Ut=0;tt<=at;tt++){if(_t.value-ye.value>We)return!1;K(6,Dt,Ut,V,_t);var Lt=Y.l;if(Dt=Y.c,Ut=Y.lc,wt[tt]=Lt,Lt==63){if(_t.value-ye.value>We)throw"Something wrong with hufUnpackEncTable";K(8,Dt,Ut,V,_t);var H=Y.l+6;if(Dt=Y.c,Ut=Y.lc,tt+H>at+1)throw"Something wrong with hufUnpackEncTable";for(;H--;)wt[tt++]=0;tt--}else if(Lt>=59){var H=Lt-59+2;if(tt+H>at+1)throw"Something wrong with hufUnpackEncTable";for(;H--;)wt[tt++]=0;tt--}}ie(wt)}function te(V){return V&63}function ge(V){return V>>6}function ce(V,ne,ye,We){for(;ne<=ye;ne++){var tt=ge(V[ne]),at=te(V[ne]);if(tt>>at)throw"Invalid table entry";if(at>14){var wt=We[tt>>at-14];if(wt.len)throw"Invalid table entry";if(wt.lit++,wt.p){var _t=wt.p;wt.p=new Array(wt.lit);for(var Dt=0;Dt0;Dt--){var wt=We[(tt<<14-at)+Ut];if(wt.len||wt.p)throw"Invalid table entry";wt.len=at,wt.lit=ne,Ut++}}return!0}const fe={c:0,lc:0};function G(V,ne,ye,We){V=V<<8|rt(ye,We),ne+=8,fe.c=V,fe.lc=ne}const Z={c:0,lc:0};function oe(V,ne,ye,We,tt,at,wt,_t,Dt,Ut){if(V==ne){We<8&&(G(ye,We,tt,wt),ye=fe.c,We=fe.lc),We-=8;var Lt=ye>>We,Lt=new Uint8Array([Lt])[0];if(Dt.value+Lt>Ut)return!1;for(var H=_t[Dt.value-1];Lt-- >0;)_t[Dt.value++]=H}else if(Dt.value32767?ne-65536:ne}const ae={a:0,b:0};function de(V,ne){var ye=xe(V),We=xe(ne),tt=We,at=ye+(tt&1)+(tt>>1),wt=at,_t=at-tt;ae.a=wt,ae.b=_t}function me(V,ne){var ye=he(V),We=he(ne),tt=ye-(We>>1)&65535,at=We+tt-32768&65535;ae.a=at,ae.b=tt}function Ge(V,ne,ye,We,tt,at,wt){for(var _t=wt<16384,Dt=ye>tt?tt:ye,Ut=1,Lt;Ut<=Dt;)Ut<<=1;for(Ut>>=1,Lt=Ut,Ut>>=1;Ut>=1;){for(var H=0,ve=H+at*(tt-Lt),Te=at*Ut,Se=at*Lt,Ee=We*Ut,ft=We*Lt,vt,yt,xt,zt;H<=ve;H+=Se){for(var Ft=H,Kt=H+We*(ye-Lt);Ft<=Kt;Ft+=ft){var Ct=Ft+Ee,qt=Ft+Te,gn=qt+Ee;_t?(de(V[Ft+ne],V[qt+ne]),vt=ae.a,xt=ae.b,de(V[Ct+ne],V[gn+ne]),yt=ae.a,zt=ae.b,de(vt,yt),V[Ft+ne]=ae.a,V[Ct+ne]=ae.b,de(xt,zt),V[qt+ne]=ae.a,V[gn+ne]=ae.b):(me(V[Ft+ne],V[qt+ne]),vt=ae.a,xt=ae.b,me(V[Ct+ne],V[gn+ne]),yt=ae.a,zt=ae.b,me(vt,yt),V[Ft+ne]=ae.a,V[Ct+ne]=ae.b,me(xt,zt),V[qt+ne]=ae.a,V[gn+ne]=ae.b)}if(ye&Ut){var qt=Ft+Te;_t?de(V[Ft+ne],V[qt+ne]):me(V[Ft+ne],V[qt+ne]),vt=ae.a,V[qt+ne]=ae.b,V[Ft+ne]=vt}}if(tt&Ut)for(var Ft=H,Kt=H+We*(ye-Lt);Ft<=Kt;Ft+=ft){var Ct=Ft+Ee;_t?de(V[Ft+ne],V[Ct+ne]):me(V[Ft+ne],V[Ct+ne]),vt=ae.a,V[Ct+ne]=ae.b,V[Ft+ne]=vt}Lt=Ut,Ut>>=1}return H}function ct(V,ne,ye,We,tt,at,wt,_t,Dt,Ut){for(var Lt=0,H=0,ve=_t,Te=Math.trunc(tt.value+(at+7)/8);tt.value=14;){var Se=Lt>>H-14&16383,Ee=ne[Se];if(Ee.len)H-=Ee.len,oe(Ee.lit,wt,Lt,H,ye,We,tt,Dt,Ut,ve),Lt=Z.c,H=Z.lc;else{if(!Ee.p)throw"hufDecode issues";var ft;for(ft=0;ft=vt&&ge(V[Ee.p[ft]])==(Lt>>H-vt&(1<>=yt,H-=yt;H>0;){var Ee=ne[Lt<<14-H&16383];if(Ee.len)H-=Ee.len,oe(Ee.lit,wt,Lt,H,ye,We,tt,Dt,Ut,ve),Lt=Z.c,H=Z.lc;else throw"hufDecode issues"}return!0}function Qe(V,ne,ye,We,tt,at){var wt={value:0},_t=ye.value,Dt=He(ne,ye),Ut=He(ne,ye);ye.value+=4;var Lt=He(ne,ye);if(ye.value+=4,Dt<0||Dt>=65537||Ut<0||Ut>=65537)throw"Something wrong with HUF_ENCSIZE";var H=new Array(65537),ve=new Array(16384);q(ve);var Te=We-(ye.value-_t);if(X(V,ne,ye,Te,Dt,Ut,H),Lt>8*(We-(ye.value-_t)))throw"Something wrong with hufUncompress";ce(H,Dt,Ut,ve),ct(H,ve,V,ne,ye,Lt,Ut,at,tt,wt)}function $e(V,ne,ye){for(var We=0;Weat||(ne[tt++]=V[ye++],tt>at));)ne[tt++]=V[We++]}function Ve(V){for(var ne=V.byteLength,ye=new Array,We=0,tt=new DataView(V);ne>0;){var at=tt.getInt8(We++);if(at<0){var wt=-at;ne-=wt+1;for(var _t=0;_t>8==255?tt+=We&255:(ye[tt]=We,tt++),V.value++}function Q(V,ne){ne[0]=pe(V[0]),ne[1]=pe(V[1]),ne[2]=pe(V[5]),ne[3]=pe(V[6]),ne[4]=pe(V[14]),ne[5]=pe(V[15]),ne[6]=pe(V[27]),ne[7]=pe(V[28]),ne[8]=pe(V[2]),ne[9]=pe(V[4]),ne[10]=pe(V[7]),ne[11]=pe(V[13]),ne[12]=pe(V[16]),ne[13]=pe(V[26]),ne[14]=pe(V[29]),ne[15]=pe(V[42]),ne[16]=pe(V[3]),ne[17]=pe(V[8]),ne[18]=pe(V[12]),ne[19]=pe(V[17]),ne[20]=pe(V[25]),ne[21]=pe(V[30]),ne[22]=pe(V[41]),ne[23]=pe(V[43]),ne[24]=pe(V[9]),ne[25]=pe(V[11]),ne[26]=pe(V[18]),ne[27]=pe(V[24]),ne[28]=pe(V[31]),ne[29]=pe(V[40]),ne[30]=pe(V[44]),ne[31]=pe(V[53]),ne[32]=pe(V[10]),ne[33]=pe(V[19]),ne[34]=pe(V[23]),ne[35]=pe(V[32]),ne[36]=pe(V[39]),ne[37]=pe(V[45]),ne[38]=pe(V[52]),ne[39]=pe(V[54]),ne[40]=pe(V[20]),ne[41]=pe(V[22]),ne[42]=pe(V[33]),ne[43]=pe(V[38]),ne[44]=pe(V[46]),ne[45]=pe(V[51]),ne[46]=pe(V[55]),ne[47]=pe(V[60]),ne[48]=pe(V[21]),ne[49]=pe(V[34]),ne[50]=pe(V[37]),ne[51]=pe(V[47]),ne[52]=pe(V[50]),ne[53]=pe(V[56]),ne[54]=pe(V[59]),ne[55]=pe(V[61]),ne[56]=pe(V[35]),ne[57]=pe(V[36]),ne[58]=pe(V[48]),ne[59]=pe(V[49]),ne[60]=pe(V[57]),ne[61]=pe(V[58]),ne[62]=pe(V[62]),ne[63]=pe(V[63])}function ut(V){const ne=.5*Math.cos(.7853975),ye=.5*Math.cos(3.14159/16),We=.5*Math.cos(3.14159/8),tt=.5*Math.cos(3*3.14159/16),at=.5*Math.cos(5*3.14159/16),wt=.5*Math.cos(3*3.14159/8),_t=.5*Math.cos(7*3.14159/16);for(var Dt=new Array(4),Ut=new Array(4),Lt=new Array(4),H=new Array(4),ve=0;ve<8;++ve){var Te=ve*8;Dt[0]=We*V[Te+2],Dt[1]=wt*V[Te+2],Dt[2]=We*V[Te+6],Dt[3]=wt*V[Te+6],Ut[0]=ye*V[Te+1]+tt*V[Te+3]+at*V[Te+5]+_t*V[Te+7],Ut[1]=tt*V[Te+1]-_t*V[Te+3]-ye*V[Te+5]-at*V[Te+7],Ut[2]=at*V[Te+1]-ye*V[Te+3]+_t*V[Te+5]+tt*V[Te+7],Ut[3]=_t*V[Te+1]-at*V[Te+3]+tt*V[Te+5]-ye*V[Te+7],Lt[0]=ne*(V[Te+0]+V[Te+4]),Lt[3]=ne*(V[Te+0]-V[Te+4]),Lt[1]=Dt[0]+Dt[3],Lt[2]=Dt[1]-Dt[2],H[0]=Lt[0]+Lt[1],H[1]=Lt[3]+Lt[2],H[2]=Lt[3]-Lt[2],H[3]=Lt[0]-Lt[1],V[Te+0]=H[0]+Ut[0],V[Te+1]=H[1]+Ut[1],V[Te+2]=H[2]+Ut[2],V[Te+3]=H[3]+Ut[3],V[Te+4]=H[3]-Ut[3],V[Te+5]=H[2]-Ut[2],V[Te+6]=H[1]-Ut[1],V[Te+7]=H[0]-Ut[0]}for(var Se=0;Se<8;++Se)Dt[0]=We*V[16+Se],Dt[1]=wt*V[16+Se],Dt[2]=We*V[48+Se],Dt[3]=wt*V[48+Se],Ut[0]=ye*V[8+Se]+tt*V[24+Se]+at*V[40+Se]+_t*V[56+Se],Ut[1]=tt*V[8+Se]-_t*V[24+Se]-ye*V[40+Se]-at*V[56+Se],Ut[2]=at*V[8+Se]-ye*V[24+Se]+_t*V[40+Se]+tt*V[56+Se],Ut[3]=_t*V[8+Se]-at*V[24+Se]+tt*V[40+Se]-ye*V[56+Se],Lt[0]=ne*(V[Se]+V[32+Se]),Lt[3]=ne*(V[Se]-V[32+Se]),Lt[1]=Dt[0]+Dt[3],Lt[2]=Dt[1]-Dt[2],H[0]=Lt[0]+Lt[1],H[1]=Lt[3]+Lt[2],H[2]=Lt[3]-Lt[2],H[3]=Lt[0]-Lt[1],V[0+Se]=H[0]+Ut[0],V[8+Se]=H[1]+Ut[1],V[16+Se]=H[2]+Ut[2],V[24+Se]=H[3]+Ut[3],V[32+Se]=H[3]-Ut[3],V[40+Se]=H[2]-Ut[2],V[48+Se]=H[1]-Ut[1],V[56+Se]=H[0]-Ut[0]}function qe(V){for(var ne=0;ne<64;++ne){var ye=V[0][ne],We=V[1][ne],tt=V[2][ne];V[0][ne]=ye+1.5747*tt,V[1][ne]=ye-.1873*We-.4682*tt,V[2][ne]=ye+1.8556*We}}function Ne(V,ne,ye){for(var We=0;We<64;++We)ne[ye+We]=zf.toHalfFloat(je(V[We]))}function je(V){return V<=1?Math.sign(V)*Math.pow(Math.abs(V),2.2):Math.sign(V)*Math.pow(O,Math.abs(V)-1)}function j(V){return new DataView(V.array.buffer,V.offset.value,V.size)}function B(V){var ne=V.viewer.buffer.slice(V.offset.value,V.offset.value+V.size),ye=new Uint8Array(Ve(ne)),We=new Uint8Array(ye.length);return bt(ye),Oe(ye,We),new DataView(We.buffer)}function ue(V){var ne=V.array.slice(V.offset.value,V.offset.value+V.size),ye=iy(ne),We=new Uint8Array(ye.length);return bt(ye),Oe(ye,We),new DataView(We.buffer)}function ze(V){for(var ne=V.viewer,ye={value:V.offset.value},We=new Uint16Array(V.width*V.scanlineBlockSize*(V.channels*V.type)),tt=new Uint8Array(8192),at=0,wt=new Array(V.channels),_t=0;_t=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(Dt<=Ut)for(var _t=0;_t0;){var _t=Le(ne.buffer,ye),Dt=le(ne,ye),Ut=Dt>>2&3,Lt=(Dt>>4)-1,H=new Int8Array([Lt])[0],ve=le(ne,ye);at.push({name:_t,index:H,type:ve,compression:Ut}),wt-=_t.length+3}for(var Te=Zt.channels,Se=new Array(V.channels),Ee=0;Ee=0&&(yt.idx[zt.index]=xt),ft.offset=xt)}if(tt.acCompressedSize>0)switch(tt.acCompression){case 0:var Ct=new Uint16Array(tt.totalAcUncompressedCount);Qe(V.array,ne,ye,tt.acCompressedSize,Ct,tt.totalAcUncompressedCount);break;case 1:var Ft=V.array.slice(ye.value,ye.value+tt.totalAcUncompressedCount),Kt=iy(Ft),Ct=new Uint16Array(Kt.buffer);ye.value+=tt.totalAcUncompressedCount;break}if(tt.dcCompressedSize>0){var qt={array:V.array,offset:ye,size:tt.dcCompressedSize},gn=new Uint16Array(ue(qt).buffer);ye.value+=tt.dcCompressedSize}if(tt.rleRawSize>0){var Ft=V.array.slice(ye.value,ye.value+tt.rleCompressedSize),Kt=iy(Ft),Bn=Ve(Kt.buffer);ye.value+=tt.rleCompressedSize}for(var en=0,Wt=new Array(Se.length),Ee=0;Ee>10,ye=V&1023;return(V>>15?-1:1)*(ne?ne===31?ye?NaN:1/0:Math.pow(2,ne-15)*(1+ye/1024):6103515625e-14*(ye/1024))}function Fe(V,ne){var ye=V.getUint16(ne.value,!0);return ne.value+=2,ye}function et(V,ne){return pe(Fe(V,ne))}function Re(V,ne,ye,We){for(var tt=ye.value,at=[];ye.valuejt.height?jt.height-ne:jt.scanlineBlockSize;const We=jt.size=jt.height)break;for(let wt=0;wt{if(!t||!p.current)return;const x=h.current.rotation.clone();p.current.updateMatrix(),p.current.updateWorldMatrix(!1,!1),p.current.getWorldQuaternion(m),y.getWorldQuaternion(h.current.quaternion).premultiply(m.invert()),n&&(h.current.rotation.x=x.x),i&&(h.current.rotation.y=x.y),a&&(h.current.rotation.z=x.z)}),Ce.useImperativeHandle(f,()=>p.current,[]),Ce.createElement("group",Ru({ref:p},c),Ce.createElement("group",{ref:h},e))});function k5(){var s=Object.create(null);function e(i,a){var c=i.id,f=i.name,h=i.dependencies;h===void 0&&(h=[]);var p=i.init;p===void 0&&(p=function(){});var m=i.getTransferables;if(m===void 0&&(m=null),!s[c])try{h=h.map(function(x){return x&&x.isWorkerModule&&(e(x,function(_){if(_ instanceof Error)throw _}),x=s[x.id].value),x}),p=n("<"+f+">.init",p),m&&(m=n("<"+f+">.getTransferables",m));var y=null;typeof p=="function"?y=p.apply(void 0,h):console.error("worker module init function failed to rehydrate"),s[c]={id:c,value:y,getTransferables:m},a(y)}catch(x){x&&x.noLog||console.error(x),a(x)}}function t(i,a){var c,f=i.id,h=i.args;(!s[f]||typeof s[f].value!="function")&&a(new Error("Worker module "+f+": not found or its 'init' did not return a function"));try{var p=(c=s[f]).value.apply(c,h);p&&typeof p.then=="function"?p.then(m,function(y){return a(y instanceof Error?y:new Error(""+y))}):m(p)}catch(y){a(y)}function m(y){try{var x=s[f].getTransferables&&s[f].getTransferables(y);(!x||!Array.isArray(x)||!x.length)&&(x=void 0),a(y,x)}catch(_){console.error(_),a(_)}}}function n(i,a){var c=void 0;self.troikaDefine=function(h){return c=h};var f=URL.createObjectURL(new Blob(["/** "+i.replace(/\*/g,"")+` **/ + +troikaDefine( +`+a+` +)`],{type:"application/javascript"}));try{importScripts(f)}catch(h){console.error(h)}return URL.revokeObjectURL(f),delete self.troikaDefine,c}self.addEventListener("message",function(i){var a=i.data,c=a.messageId,f=a.action,h=a.data;try{f==="registerModule"&&e(h,function(p){p instanceof Error?postMessage({messageId:c,success:!1,error:p.message}):postMessage({messageId:c,success:!0,result:{isCallable:typeof p=="function"}})}),f==="callModule"&&t(h,function(p,m){p instanceof Error?postMessage({messageId:c,success:!1,error:p.message}):postMessage({messageId:c,success:!0,result:p},m||void 0)})}catch(p){postMessage({messageId:c,success:!1,error:p.stack})}})}function G5(s){var e=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e._getInitResult().then(function(i){if(typeof i=="function")return i.apply(void 0,t);throw new Error("Worker module function was called but `init` did not return a callable function")})};return e._getInitResult=function(){var t=s.dependencies,n=s.init;t=Array.isArray(t)?t.map(function(a){return a&&(a=a.onMainThread||a,a._getInitResult&&(a=a._getInitResult())),a}):[];var i=Promise.all(t).then(function(a){return n.apply(null,a)});return e._getInitResult=function(){return i},i},e}var o3=function(){var s=!1;if(typeof window<"u"&&typeof window.document<"u")try{var e=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));e.terminate(),s=!0}catch(t){console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+t.message+"]")}return o3=function(){return s},s},H5=0,V5=0,V_=!1,Zm=Object.create(null),Km=Object.create(null),yb=Object.create(null);function Zd(s){if((!s||typeof s.init!="function")&&!V_)throw new Error("requires `options.init` function");var e=s.dependencies,t=s.init,n=s.getTransferables,i=s.workerId,a=G5(s);i==null&&(i="#default");var c="workerModule"+ ++H5,f=s.name||c,h=null;e=e&&e.map(function(m){return typeof m=="function"&&!m.workerModuleData&&(V_=!0,m=Zd({workerId:i,name:"<"+f+"> function dependency: "+m.name,init:`function(){return ( +`+py(m)+` +)}`}),V_=!1),m&&m.workerModuleData&&(m=m.workerModuleData),m});function p(){for(var m=[],y=arguments.length;y--;)m[y]=arguments[y];if(!o3())return a.apply(void 0,m);if(!h){h=yT(i,"registerModule",p.workerModuleData);var x=function(){h=null,Km[i].delete(x)};(Km[i]||(Km[i]=new Set)).add(x)}return h.then(function(_){var S=_.isCallable;if(S)return yT(i,"callModule",{id:c,args:m});throw new Error("Worker module function was called but `init` did not return a callable function")})}return p.workerModuleData={isWorkerModule:!0,id:c,name:f,dependencies:e,init:py(t),getTransferables:n&&py(n)},p.onMainThread=a,p}function j5(s){Km[s]&&Km[s].forEach(function(e){e()}),Zm[s]&&(Zm[s].terminate(),delete Zm[s])}function py(s){var e=s.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function W5(s){var e=Zm[s];if(!e){var t=py(k5);e=Zm[s]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+s.replace(/\*/g,"")+` **/ + +;(`+t+")()"],{type:"application/javascript"}))),e.onmessage=function(n){var i=n.data,a=i.messageId,c=yb[a];if(!c)throw new Error("WorkerModule response with empty or unknown messageId");delete yb[a],c(i)}}return e}function yT(s,e,t){return new Promise(function(n,i){var a=++V5;yb[a]=function(c){c.success?n(c.result):i(new Error("Error in worker "+e+" call: "+c.error))},W5(s).postMessage({messageId:a,action:e,data:t})})}function l3(){var s=(function(e){function t(ce,fe,G,Z,oe,he,xe,ae){var de=1-xe;ae.x=de*de*ce+2*de*xe*G+xe*xe*oe,ae.y=de*de*fe+2*de*xe*Z+xe*xe*he}function n(ce,fe,G,Z,oe,he,xe,ae,de,me){var Ge=1-de;me.x=Ge*Ge*Ge*ce+3*Ge*Ge*de*G+3*Ge*de*de*oe+de*de*de*xe,me.y=Ge*Ge*Ge*fe+3*Ge*Ge*de*Z+3*Ge*de*de*he+de*de*de*ae}function i(ce,fe){for(var G=/([MLQCZ])([^MLQCZ]*)/g,Z,oe,he,xe,ae;Z=G.exec(ce);){var de=Z[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(me){return parseFloat(me)});switch(Z[1]){case"M":xe=oe=de[0],ae=he=de[1];break;case"L":(de[0]!==xe||de[1]!==ae)&&fe("L",xe,ae,xe=de[0],ae=de[1]);break;case"Q":{fe("Q",xe,ae,xe=de[2],ae=de[3],de[0],de[1]);break}case"C":{fe("C",xe,ae,xe=de[4],ae=de[5],de[0],de[1],de[2],de[3]);break}case"Z":(xe!==oe||ae!==he)&&fe("L",xe,ae,oe,he);break}}}function a(ce,fe,G){G===void 0&&(G=16);var Z={x:0,y:0};i(ce,function(oe,he,xe,ae,de,me,Ge,ct,Qe){switch(oe){case"L":fe(he,xe,ae,de);break;case"Q":{for(var $e=he,bt=xe,Oe=1;Oe0;)Xe[He]=arguments[He+2];var rt=ze[Rt]||(ze[Rt]=G.getUniformLocation(we,Rt));G["uniform"+Tt].apply(G,[rt].concat(Xe))},setAttribute:function(Tt,Rt,Xe,He,rt){var le=ue[Tt];le||(le=ue[Tt]={buf:G.createBuffer(),loc:G.getAttribLocation(we,Tt),data:null}),G.bindBuffer(G.ARRAY_BUFFER,le.buf),G.vertexAttribPointer(le.loc,Rt,G.FLOAT,!1,0,0),G.enableVertexAttribArray(le.loc),oe?G.vertexAttribDivisor(le.loc,He):Ve("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(le.loc,He),rt!==le.data&&(G.bufferData(G.ARRAY_BUFFER,rt,Xe),le.data=rt)}})}}}xe[Ne].transaction(B)},Q=function(Ne,je){de++;try{G.activeTexture(G.TEXTURE0+de);var j=ae[Ne];j||(j=ae[Ne]=G.createTexture(),G.bindTexture(G.TEXTURE_2D,j),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MIN_FILTER,G.NEAREST),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MAG_FILTER,G.NEAREST)),G.bindTexture(G.TEXTURE_2D,j),je(j,de)}finally{de--}},ut=function(Ne,je,j){var B=G.createFramebuffer();me.push(B),G.bindFramebuffer(G.FRAMEBUFFER,B),G.activeTexture(G.TEXTURE0+je),G.bindTexture(G.TEXTURE_2D,Ne),G.framebufferTexture2D(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_2D,Ne,0);try{j(B)}finally{G.deleteFramebuffer(B),G.bindFramebuffer(G.FRAMEBUFFER,me[--me.length-1]||null)}},qe=function(){he={},xe={},ae={},de=-1,me.length=0};var Ge=Ve,ct=Pe,Qe=it,$e=Q,bt=ut,Oe=qe,oe=typeof WebGL2RenderingContext<"u"&&G instanceof WebGL2RenderingContext,he={},xe={},ae={},de=-1,me=[];G.canvas.addEventListener("webglcontextlost",function(Ne){qe(),Ne.preventDefault()},!1),h.set(G,Z={gl:G,isWebGL2:oe,getExtension:Ve,withProgram:it,withTexture:Q,withTextureFramebuffer:ut,handleContextLoss:qe})}fe(Z)}function y(ce,fe,G,Z,oe,he,xe,ae){xe===void 0&&(xe=15),ae===void 0&&(ae=null),m(ce,function(de){var me=de.gl,Ge=de.withProgram,ct=de.withTexture;ct("copy",function(Qe,$e){me.texImage2D(me.TEXTURE_2D,0,me.RGBA,oe,he,0,me.RGBA,me.UNSIGNED_BYTE,fe),Ge("copy",c,f,function(bt){var Oe=bt.setUniform,Ve=bt.setAttribute;Ve("aUV",2,me.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),Oe("1i","image",$e),me.bindFramebuffer(me.FRAMEBUFFER,ae||null),me.disable(me.BLEND),me.colorMask(xe&8,xe&4,xe&2,xe&1),me.viewport(G,Z,oe,he),me.scissor(G,Z,oe,he),me.drawArrays(me.TRIANGLES,0,3)})})})}function x(ce,fe,G){var Z=ce.width,oe=ce.height;m(ce,function(he){var xe=he.gl,ae=new Uint8Array(Z*oe*4);xe.readPixels(0,0,Z,oe,xe.RGBA,xe.UNSIGNED_BYTE,ae),ce.width=fe,ce.height=G,y(xe,ae,0,0,Z,oe)})}var _=Object.freeze({__proto__:null,withWebGLContext:m,renderImageData:y,resizeWebGLCanvasWithoutClearing:x});function S(ce,fe,G,Z,oe,he){he===void 0&&(he=1);var xe=new Uint8Array(ce*fe),ae=Z[2]-Z[0],de=Z[3]-Z[1],me=[];a(G,function(Ve,Pe,it,Q){me.push({x1:Ve,y1:Pe,x2:it,y2:Q,minX:Math.min(Ve,it),minY:Math.min(Pe,Q),maxX:Math.max(Ve,it),maxY:Math.max(Pe,Q)})}),me.sort(function(Ve,Pe){return Ve.maxX-Pe.maxX});for(var Ge=0;Geqe.minX&&Pe-Qqe.minY){var Ne=E(Ve,Pe,qe.x1,qe.y1,qe.x2,qe.y2);NePe!=ut.y2>Pe&&Ve<(ut.x2-ut.x1)*(Pe-ut.y1)/(ut.y2-ut.y1)+ut.x1;qe&&(it+=ut.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function C(Q,ut){var qe=36,Ne=0,je=new Map,j=ut&&new Map,B;return Q.split(",").forEach(function ue(ze){if(ze.indexOf("+")!==-1)for(var we=+ze;we--;)ue(B);else{B=ze;var Ae=ze.split(">"),Le=Ae[0],lt=Ae[1];Le=String.fromCodePoint(Ne+=parseInt(Le,qe)),lt=String.fromCodePoint(Ne+=parseInt(lt,qe)),je.set(Le,lt),ut&&j.set(lt,Le)}}),{map:je,reverseMap:j}}var T,E,R;function I(){if(!T){var Q=C(S.pairs,!0),ut=Q.map,qe=Q.reverseMap;T=ut,E=qe,R=C(S.canonical,!1).map}}function L(Q){return I(),T.get(Q)||null}function F(Q){return I(),E.get(Q)||null}function P(Q){return I(),R.get(Q)||null}var z=n.L,U=n.R,O=n.EN,W=n.ES,q=n.ET,Y=n.AN,K=n.CS,$=n.B,ie=n.S,X=n.ON,te=n.BN,ge=n.NSM,ce=n.AL,fe=n.LRO,G=n.RLO,Z=n.LRE,oe=n.RLE,he=n.PDF,xe=n.LRI,ae=n.RLI,de=n.FSI,me=n.PDI;function Ge(Q,ut){for(var qe=125,Ne=new Uint32Array(Q.length),je=0;je0)le--;else if(De>0){for(Ie=0;!He[He.length-1]._isolate;)He.pop();var Me=He[He.length-1]._isolInitIndex;Me!=null&&(ze.set(Me,re),ze.set(re,Me)),He.pop(),De--}rt=He[He.length-1],ue[re]=rt._level,rt._override&&B(re,rt._override)}else pe&he?(le===0&&(Ie>0?Ie--:!rt._isolate&&He.length>1&&(He.pop(),rt=He[He.length-1])),ue[re]=rt._level):pe&$&&(ue[re]=Ae.level);else ue[re]=rt._level,rt._override&&pe!==te&&B(re,rt._override)}for(var ht=[],St=null,It=Ae.start;It<=Ae.end;It++){var Gt=Ne[It];if(!(Gt&h)){var un=ue[It],tn=Gt&a,Cn=Gt===me;St&&un===St._level?(St._end=It,St._endsWithIsolInit=tn):ht.push(St={_start:It,_end:It,_level:un,_startsWithPDI:Cn,_endsWithIsolInit:tn})}}for(var Hn=[],ti=0;ti=0;tt--)if(!(Ne[tt]&h)){We=ue[tt];break}var at=Xn[Xn.length-1],wt=ue[at],_t=Ae.level;if(!(Ne[at]&a)){for(var Dt=at+1;Dt<=Ae.end;Dt++)if(!(Ne[Dt]&h)){_t=ue[Dt];break}}Hn.push({_seqIndices:Xn,_sosType:Math.max(We,ye)%2?U:z,_eosType:Math.max(_t,wt)%2?U:z})}}for(var Ut=0;Ut=0;yt--)if(!(Ne[H[yt]]&h)){vt=Ne[H[yt]];break}B(ft,vt&(a|me)?X:vt)}}if(j.get(O))for(var xt=0;xt=-1;Ft--){var Kt=Ft===-1?ve:Ne[H[Ft]];if(Kt&c){Kt===ce&&B(zt,Y);break}}}if(j.get(ce))for(var Ct=0;Ct=0&&(en=Ne[H[Mt]],!!(en&h));Mt--);for(var fn=gn+1;fn=0&&Ne[H[li]]&(q|h);li--)B(H[li],O);for(Nt++;Nt=0&&Ne[H[Nn]]&h;Nn--)B(H[Nn],X);for(var pi=Rn+1;pi=0;Ea--){var ja=Va[Ea].char;if(ja===Ol||ja===F(P(Rs))||L(P(ja))===Rs){Go.push([Va[Ea].seqIndex,Ur]),Va.length=Ea;break}}}Go.sort(function(Mr,wa){return Mr[0]-wa[0]})}for(var Pl=0;Pl=0;ds--){var Vo=H[ds];if(Ne[Vo]&Nu){var jo=Ne[Vo]&Ma?U:z;jo!==Se?Wr=jo:Wr=Se;break}}}if(Wr){if(Ne[H[Ho]]=Ne[H[Ds]]=Wr,Wr!==Se){for(var Wa=Ho+1;Wa=0;Xo--)if(Ne[H[Xo]]&h)ps=Xo;else{Is=Ne[H[Xo]]&Ma?U:z;break}for(var qo=Te,Ls=Ti+1;Ls=0&&x(Q[kl])&p;kl--)ue[kl]=Ae.level}}return{levels:ue,paragraphs:we};function Tc(Mr,wa){for(var Lr=Mr;Lr=ue&&x(Q[Ae])&p;Ae--)we[Ae]=B.level;for(var Le=B.level,lt=1/0,Tt=0;TtLe&&(Le=Rt),Rt=lt;Xe--)for(var He=0;He=Xe){for(var rt=He;He+1=Xe;)He++;He>rt&&j.push([rt+ue,He+ue])}}}),j}function Pe(Q,ut,qe,Ne){var je=it(Q,ut,qe,Ne),j=[].concat(Q);return je.forEach(function(B,ue){j[ue]=(ut.levels[B]&1?bt(Q[B]):null)||Q[B]}),j.join("")}function it(Q,ut,qe,Ne){for(var je=Ve(Q,ut,qe,Ne),j=[],B=0;B/gm;function t(n,i){let a=wn[i];return a?xb(a):n}return s.replace(e,t)}const ta=[];for(let s=0;s<256;s++)ta[s]=(s<16?"0":"")+s.toString(16);function q5(){const s=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(ta[s&255]+ta[s>>8&255]+ta[s>>16&255]+ta[s>>24&255]+"-"+ta[e&255]+ta[e>>8&255]+"-"+ta[e>>16&15|64]+ta[e>>24&255]+"-"+ta[t&63|128]+ta[t>>8&255]+"-"+ta[t>>16&255]+ta[t>>24&255]+ta[n&255]+ta[n>>8&255]+ta[n>>16&255]+ta[n>>24&255]).toUpperCase()}const Df=Object.assign||function(){let s=arguments[0];for(let e=1,t=arguments.length;es.type,set:p=>{s.type=p}},isDerivedFrom:{writable:!0,configurable:!0,value:function(p){const m=this.baseMaterial;return p===m||m.isDerivedMaterial&&m.isDerivedFrom(p)||!1}},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return s.customProgramCacheKey()+"|"+t}},onBeforeCompile:{get(){return a},set(p){this[i]=p}},copy:{writable:!0,configurable:!0,value:function(p){return s.copy.call(this,p),!s.isShaderMaterial&&!s.isDerivedMaterial&&(Df(this.extensions,p.extensions),Df(this.defines,p.defines),Df(this.uniforms,Wx.clone(p.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){const p=new s.constructor;return f(p).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let p=this._depthMaterial;return p||(p=this._depthMaterial=_b(s.isDerivedMaterial?s.getDepthMaterial():new Xx({depthPacking:gw}),e),p.defines.IS_DEPTH_MATERIAL="",p.uniforms=this.uniforms),p}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let p=this._distanceMaterial;return p||(p=this._distanceMaterial=_b(s.isDerivedMaterial?s.getDistanceMaterial():new qx,e),p.defines.IS_DISTANCE_MATERIAL="",p.uniforms=this.uniforms),p}},dispose:{writable:!0,configurable:!0,value(){const{_depthMaterial:p,_distanceMaterial:m}=this;p&&p.dispose(),m&&m.dispose(),s.dispose.call(this)}}};return n[t]=c,new c}function K5(s,{vertexShader:e,fragmentShader:t},n,i){let{vertexDefs:a,vertexMainIntro:c,vertexMainOutro:f,vertexTransform:h,fragmentDefs:p,fragmentMainIntro:m,fragmentMainOutro:y,fragmentColorTransform:x,customRewriter:_,timeUniform:S}=n;if(a=a||"",c=c||"",f=f||"",p=p||"",m=m||"",y=y||"",(h||_)&&(e=xb(e)),(x||_)&&(t=t.replace(/^[ \t]*#include <((?:tonemapping|encodings|colorspace|fog|premultiplied_alpha|dithering)_fragment)>/gm,` +//!BEGIN_POST_CHUNK $1 +$& +//!END_POST_CHUNK +`),t=xb(t)),_){let C=_({vertexShader:e,fragmentShader:t});e=C.vertexShader,t=C.fragmentShader}if(x){let C=[];t=t.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,T=>(C.push(T),"")),y=`${x} +${C.join(` +`)} +${y}`}if(S){const C=` +uniform float ${S}; +`;a=C+a,p=C+p}return h&&(e=`vec3 troika_position_${i}; +vec3 troika_normal_${i}; +vec2 troika_uv_${i}; +${e} +`,a=`${a} +void troikaVertexTransform${i}(inout vec3 position, inout vec3 normal, inout vec2 uv) { + ${h} +} +`,c=` +troika_position_${i} = vec3(position); +troika_normal_${i} = vec3(normal); +troika_uv_${i} = vec2(uv); +troikaVertexTransform${i}(troika_position_${i}, troika_normal_${i}, troika_uv_${i}); +${c} +`,e=e.replace(/\b(position|normal|uv)\b/g,(C,T,E,R)=>/\battribute\s+vec[23]\s+$/.test(R.substr(0,E))?T:`troika_${T}_${i}`),s.map&&s.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${i}`))),e=bT(e,i,a,c,f),t=bT(t,i,p,m,y),{vertexShader:e,fragmentShader:t}}function bT(s,e,t,n,i){return(n||i||t)&&(s=s.replace(c3,` +${t} +void troikaOrigMain${e}() {`),s+=` +void main() { + ${n} + troikaOrigMain${e}(); + ${i} +}`),s}function Q5(s,e){return s==="uniforms"?void 0:typeof e=="function"?e.toString():e}let J5=0;const ST=new Map;function $5(s){const e=JSON.stringify(s,Q5);let t=ST.get(e);return t==null&&ST.set(e,t=++J5),t}function eF(){return typeof window>"u"&&(self.window=self),(function(s){var e={parse:function(i){var a=e._bin,c=new Uint8Array(i);if(a.readASCII(c,0,4)=="ttcf"){var f=4;a.readUshort(c,f),f+=2,a.readUshort(c,f),f+=2;var h=a.readUint(c,f);f+=4;for(var p=[],m=0;m>>c&1)!=0&&a++;return a},e._lctf.readClassDef=function(i,a){var c=e._bin,f=[],h=c.readUshort(i,a);if(a+=2,h==1){var p=c.readUshort(i,a);a+=2;var m=c.readUshort(i,a);a+=2;for(var y=0;y0&&(h.featureParams=f+p);var m=c.readUshort(i,a);a+=2,h.tab=[];for(var y=0;y0&&(h.default=e._lctf.readLangSysTable(i,f+p));var m=c.readUshort(i,a);a+=2;for(var y=0;y255?-1:e.CFF.glyphByUnicode(i,e.CFF.tableSE[a])},e.CFF.readEncoding=function(i,a,c){e._bin;var f=[".notdef"],h=i[a];if(a++,h!=0)throw"error: unknown encoding format: "+h;var p=i[a];a++;for(var m=0;m>4,R=15&T;if(E!=15&&C.push(E),R!=15&&C.push(R),R==15)break}for(var I="",L=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],F=0;F=p.xMax||p.yMin>=p.yMax)return null;if(p.noc>0){p.endPts=[];for(var m=0;m=1&&m.fmt<=2){x=h.readUshort(i,c),c+=2;var _=h.readUshort(i,c);c+=2;var S=e._lctf.numOfOnes(x),C=e._lctf.numOfOnes(_);if(m.fmt==1){m.pairsets=[];var T=h.readUshort(i,c);c+=2;for(var E=0;E=1&&m.fmt<=2){if(m.fmt==1)m.delta=h.readShort(i,c),c+=2;else if(m.fmt==2){var x=h.readUshort(i,c);c+=2,m.newg=h.readUshorts(i,c,x),c+=2*m.newg.length}}else if(a==2&&m.fmt==1){x=h.readUshort(i,c),c+=2,m.seqs=[];for(var _=0;_>>8;if((S&=15)!=0)throw"unknown kern table format: "+S;a=e.kern.readFormat0(i,a,y)}return y},e.kern.parseV1=function(i,a,c,f){var h=e._bin;h.readFixed(i,a),a+=4;var p=h.readUint(i,a);a+=4;for(var m={glyph1:[],rval:[]},y=0;y>>8;if((_&=15)!=0)throw"unknown kern table format: "+_;a=e.kern.readFormat0(i,a,m)}return m},e.kern.readFormat0=function(i,a,c){var f=e._bin,h=-1,p=f.readUshort(i,a);a+=2,f.readUshort(i,a),a+=2,f.readUshort(i,a),a+=2,f.readUshort(i,a),a+=2;for(var m=0;m=h.map.length?0:h.map[a];if(h.format==4){for(var p=-1,m=0;ma?0:65535&(h.idRangeOffset[p]!=0?h.glyphIdArray[a-h.startCount[p]+(h.idRangeOffset[p]>>1)-(h.idRangeOffset.length-p)]:a+h.idDelta[p])}if(h.format==12){if(a>h.groups[h.groups.length-1][1])return 0;for(m=0;m-1?e.U._simpleGlyph(f,c):e.U._compoGlyph(f,a,c))},e.U._simpleGlyph=function(i,a){for(var c=0;ch)){for(var T=!0,E=0,R=0;Rh)){for(T=!0,R=0;R>1,p.length=0,y=!0;else if(Y=="o3"||Y=="o23")p.length%2!=0&&!y&&(x=p.shift()+f.nominalWidthX),m+=p.length>>1,p.length=0,y=!0;else if(Y=="o4")p.length>1&&!y&&(x=p.shift()+f.nominalWidthX,y=!0),_&&e.U.P.closePath(h),T+=p.pop(),e.U.P.moveTo(h,C,T),_=!0;else if(Y=="o5")for(;p.length>0;)C+=p.shift(),T+=p.shift(),e.U.P.lineTo(h,C,T);else if(Y=="o6"||Y=="o7")for(var K=p.length,$=Y=="o6",ie=0;ieMath.abs(U-T)?C=z+p.shift():T=U+p.shift(),e.U.P.curveTo(h,E,R,I,L,O,W),e.U.P.curveTo(h,F,P,z,U,C,T));else if(Y=="o14"){if(p.length>0&&!y&&(x=p.shift()+c.nominalWidthX,y=!0),p.length==4){var ge=p.shift(),ce=p.shift(),fe=p.shift(),G=p.shift(),Z=e.CFF.glyphBySE(c,fe),oe=e.CFF.glyphBySE(c,G);e.U._drawCFF(c.CharStrings[Z],a,c,f,h),a.x=ge,a.y=ce,e.U._drawCFF(c.CharStrings[oe],a,c,f,h)}_&&(e.U.P.closePath(h),_=!1)}else if(Y=="o19"||Y=="o20")p.length%2!=0&&!y&&(x=p.shift()+f.nominalWidthX),m+=p.length>>1,p.length=0,y=!0,S+=m+7>>3;else if(Y=="o21")p.length>2&&!y&&(x=p.shift()+f.nominalWidthX,y=!0),T+=p.pop(),C+=p.pop(),_&&e.U.P.closePath(h),e.U.P.moveTo(h,C,T),_=!0;else if(Y=="o22")p.length>1&&!y&&(x=p.shift()+f.nominalWidthX,y=!0),C+=p.pop(),_&&e.U.P.closePath(h),e.U.P.moveTo(h,C,T),_=!0;else if(Y=="o25"){for(;p.length>6;)C+=p.shift(),T+=p.shift(),e.U.P.lineTo(h,C,T);E=C+p.shift(),R=T+p.shift(),I=E+p.shift(),L=R+p.shift(),C=I+p.shift(),T=L+p.shift(),e.U.P.curveTo(h,E,R,I,L,C,T)}else if(Y=="o26")for(p.length%2&&(C+=p.shift());p.length>0;)E=C,R=T+p.shift(),C=I=E+p.shift(),T=(L=R+p.shift())+p.shift(),e.U.P.curveTo(h,E,R,I,L,C,T);else if(Y=="o27")for(p.length%2&&(T+=p.shift());p.length>0;)R=T,I=(E=C+p.shift())+p.shift(),L=R+p.shift(),C=I+p.shift(),T=L,e.U.P.curveTo(h,E,R,I,L,C,T);else if(Y=="o10"||Y=="o29"){var he=Y=="o10"?f:c;if(p.length==0)console.debug("error: empty stack");else{var xe=p.pop(),ae=he.Subrs[xe+he.Bias];a.x=C,a.y=T,a.nStems=m,a.haveWidth=y,a.width=x,a.open=_,e.U._drawCFF(ae,a,c,f,h),C=a.x,T=a.y,m=a.nStems,y=a.haveWidth,x=a.width,_=a.open}}else if(Y=="o30"||Y=="o31"){var de=p.length,me=(te=0,Y=="o31");for(te+=de-(K=-3&de);te>>1|(21845&_)<<1;S=(61680&(S=(52428&S)>>>2|(13107&S)<<2))>>>4|(3855&S)<<4,x[_]=((65280&S)>>>8|(255&S)<<8)>>>1}var C=function(Y,K,$){for(var ie=Y.length,X=0,te=new t(K);X>>fe]=G}return ge},T=new e(288);for(_=0;_<144;++_)T[_]=8;for(_=144;_<256;++_)T[_]=9;for(_=256;_<280;++_)T[_]=7;for(_=280;_<288;++_)T[_]=8;var E=new e(32);for(_=0;_<32;++_)E[_]=5;var R=C(T,9),I=C(E,5),L=function(Y){for(var K=Y[0],$=1;$K&&(K=Y[$]);return K},F=function(Y,K,$){var ie=K/8|0;return(Y[ie]|Y[ie+1]<<8)>>(7&K)&$},P=function(Y,K){var $=K/8|0;return(Y[$]|Y[$+1]<<8|Y[$+2]<<16)>>(7&K)},z=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],U=function(Y,K,$){var ie=new Error(K||z[Y]);if(ie.code=Y,Error.captureStackTrace&&Error.captureStackTrace(ie,U),!$)throw ie;return ie},O=function(Y,K,$){var ie=Y.length;if(!ie||$&&!$.l&&ie<5)return K||new e(0);var X=!K||$,te=!$||$.i;$||($={}),K||(K=new e(3*ie));var ge,ce=function(rt){var le=K.length;if(rt>le){var Ie=new e(Math.max(2*le,rt));Ie.set(K),K=Ie}},fe=$.f||0,G=$.p||0,Z=$.b||0,oe=$.l,he=$.d,xe=$.m,ae=$.n,de=8*ie;do{if(!oe){$.f=fe=F(Y,G,1);var me=F(Y,G+1,3);if(G+=3,!me){var Ge=Y[(qe=((ge=G)/8|0)+(7&ge&&1)+4)-4]|Y[qe-3]<<8,ct=qe+Ge;if(ct>ie){te&&U(0);break}X&&ce(Z+Ge),K.set(Y.subarray(qe,ct),Z),$.b=Z+=Ge,$.p=G=8*ct;continue}if(me==1)oe=R,he=I,xe=9,ae=5;else if(me==2){var Qe=F(Y,G,31)+257,$e=F(Y,G+10,15)+4,bt=Qe+F(Y,G+5,31)+1;G+=14;for(var Oe=new e(bt),Ve=new e(19),Pe=0;Pe<$e;++Pe)Ve[c[Pe]]=F(Y,G+3*Pe,7);G+=3*$e;var it=L(Ve),Q=(1<>>4)<16)Oe[Pe++]=qe;else{var je=0,j=0;for(qe==16?(j=3+F(Y,G,3),G+=2,je=Oe[Pe-1]):qe==17?(j=3+F(Y,G,7),G+=3):qe==18&&(j=11+F(Y,G,127),G+=7);j--;)Oe[Pe++]=je}}var B=Oe.subarray(0,Qe),ue=Oe.subarray(Qe);xe=L(B),ae=L(ue),oe=C(B,xe),he=C(ue,ae)}else U(1);if(G>de){te&&U(0);break}}X&&ce(Z+131072);for(var ze=(1<>>4;if((G+=15&je)>de){te&&U(0);break}if(je||U(2),Le<256)K[Z++]=Le;else{if(Le==256){Ae=G,oe=null;break}var lt=Le-254;if(Le>264){var Tt=i[Pe=Le-257];lt=F(Y,G,(1<>>4;if(Rt||U(3),G+=15&Rt,ue=y[Xe],Xe>3&&(Tt=a[Xe],ue+=P(Y,G)&(1<de){te&&U(0);break}X&&ce(Z+131072);for(var He=Z+lt;Zrt.length)&&(Ie=rt.length);var De=new(rt instanceof t?t:rt instanceof n?n:e)(Ie-le);return De.set(rt.subarray(le,Ie)),De})(K,0,Z)},W=new e(0),q=typeof TextDecoder<"u"&&new TextDecoder;try{q.decode(W,{stream:!0})}catch{}return s.convert_streams=function(Y){var K=new DataView(Y),$=0;function ie(){var Qe=K.getUint16($);return $+=2,Qe}function X(){var Qe=K.getUint32($);return $+=4,Qe}function te(Qe){Ge.setUint16(ct,Qe),ct+=2}function ge(Qe){Ge.setUint32(ct,Qe),ct+=4}for(var ce={signature:X(),flavor:X(),length:X(),numTables:ie(),reserved:ie(),totalSfntSize:X(),majorVersion:ie(),minorVersion:ie(),metaOffset:X(),metaLength:X(),metaOrigLength:X(),privOffset:X(),privLength:X()},fe=0;Math.pow(2,fe)<=ce.numTables;)fe++;fe--;for(var G=16*Math.pow(2,fe),Z=16*ce.numTables-G,oe=12,he=[],xe=0;xe{let[Y,K]=q.split("+");Y=parseInt(Y,36),K=K?parseInt(K,36):0,m.set(W+=Y,U[O]);for(let $=K;$--;)m.set(++W,U[O])})}}return m.get(z)||p}const x=1,_=2,S=3,C=4,T=[null,"isol","init","fina","medi"];function E(z){const U=new Uint8Array(z.length);let O=p,W=x,q=-1;for(let Y=0;Y65535&&Y++)}return U}function R(z,U){const O=[];for(let q=0;q65535&&q++,O.push(s.U.codeToGlyph(z,Y))}const W=z.GSUB;if(W){const{lookupList:q,featureList:Y}=W;let K;const $=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,ie=[];Y.forEach(X=>{if($.test(X.tag))for(let te=0;te=0;ie--)if(U[ie]!==-1&&(!$||$(U[ie])))return ie;return-1}function Y($){return L(z,$)===1}function K($,ie){for(let X=0;X<3;X++)O[ie*3+X]+=$[X]||0}}function L(z,U){const O=z.GDEF&&z.GDEF.glyphClassDef;return O?s.U._getGlyphClass(U,O):0}function F(...z){for(let U=0;U0},forEachGlyph($,ie,X,te){let ge=0;const ce=1/K.unitsPerEm*ie,fe=R(z,$);let G=0;const Z=I(z,fe);return fe.forEach((oe,he)=>{if(oe!==-1){let xe=U[oe];if(!xe){const{cmds:ae,crds:de}=s.U.glyphToPath(z,oe);let me="",Ge=0;for(let Oe=0,Ve=ae.length;Oe1?",":"")+de[Ge++]}let ct,Qe,$e,bt;if(de.length){ct=Qe=1/0,$e=bt=-1/0;for(let Oe=0,Ve=de.length;Oe$e&&($e=Pe),it>bt&&(bt=it)}}else ct=$e=Qe=bt=0;xe=U[oe]={index:oe,advanceWidth:z.hmtx.aWidth[oe],xMin:ct,yMin:Qe,xMax:$e,yMax:bt,path:me}}te.call(null,xe,ge+Z[he*3]*ce,Z[he*3+1]*ce,G),ge+=Z[he*3+2]*ce,X&&(ge+=X*ie)}G+=$.codePointAt(G)>65535?2:1}),ge}};return K}return function(U){const O=new Uint8Array(U,0,4),W=s._bin.readASCII(O,0,4);if(W==="wOFF")U=e(U);else if(W==="wOF2")throw new Error("woff2 fonts not supported");return P(s.parse(U)[0])}}const iF=Zd({name:"Typr Font Parser",dependencies:[eF,tF,nF],init(s,e,t){const n=s(),i=e();return t(n,i)}});function rF(){return(function(s){var e=function(){this.buckets=new Map};e.prototype.add=function(I){var L=I>>5;this.buckets.set(L,(this.buckets.get(L)||0)|1<<(31&I))},e.prototype.has=function(I){var L=this.buckets.get(I>>5);return L!==void 0&&(L&1<<(31&I))!=0},e.prototype.serialize=function(){var I=[];return this.buckets.forEach((function(L,F){I.push((+F).toString(36)+":"+L.toString(36))})),I.join(",")},e.prototype.deserialize=function(I){var L=this;this.buckets.clear(),I.split(",").forEach((function(F){var P=F.split(":");L.buckets.set(parseInt(P[0],36),parseInt(P[1],36))}))};var t=Math.pow(2,8),n=t-1,i=~n;function a(I){var L=(function(P){return P&i})(I).toString(16),F=(function(P){return(P&i)+t-1})(I).toString(16);return"codepoint-index/plane"+(I>>16)+"/"+L+"-"+F+".json"}function c(I,L){var F=I&n,P=L.codePointAt(F/6|0);return((P=(P||48)-48)&1<65535&&(G++,fe=G)},fe=0;fe65535&&(oe++,Z=oe)},Z=0;Z65535&&(oe++,Y[oe]=Y[oe-1])}return{fontUrls:Array.from(q.keys()),chars:Y}}))},Object.defineProperty(s,"__esModule",{value:!0}),s})({})}function aF(s,e){const t=Object.create(null),n=Object.create(null);function i(c,f){const h=p=>{console.error(`Failure loading font ${c}`,p)};try{const p=new XMLHttpRequest;p.open("get",c,!0),p.responseType="arraybuffer",p.onload=function(){if(p.status>=400)h(new Error(p.statusText));else if(p.status>0)try{const m=s(p.response);m.src=c,f(m)}catch(m){h(m)}},p.onerror=h,p.send()}catch(p){h(p)}}function a(c,f){let h=t[c];h?f(h):n[c]?n[c].push(f):(n[c]=[f],i(c,p=>{p.src=c,t[c]=p,n[c].forEach(m=>m(p)),delete n[c]}))}return function(c,f,{lang:h,fonts:p=[],style:m="normal",weight:y="normal",unicodeFontsURL:x}={}){const _=new Uint8Array(c.length),S=[];c.length||R();const C=new Map,T=[];if(m!=="italic"&&(m="normal"),typeof y!="number"&&(y=y==="bold"?700:400),p&&!Array.isArray(p)&&(p=[p]),p=p.slice().filter(L=>!L.lang||L.lang.test(h)).reverse(),p.length){let z=0;(function U(O=0){for(let W=O,q=c.length;W0&&/\s/.test(c[W]))_[W]=_[W-1],z===2&&(T[T.length-1][1]=W);else for(let K=_[W],$=p.length;K<=$;K++)if(K===$){const ie=z===2?T[T.length-1]:T[T.length]=[W,W];ie[1]=W,z=2}else{_[W]=K;const{src:ie,unicodeRange:X}=p[K];if(!X||I(Y,X)){const te=t[ie];if(!te){a(ie,()=>{U(W)});return}if(te.supportsCodePoint(Y)){let ge=C.get(te);typeof ge!="number"&&(ge=S.length,S.push(te),C.set(te,ge)),_[W]=ge,z=1;break}}}Y>65535&&W+1c.substring(F[0],F[1]+1)).join(` +`);e.getFontsForString(L,{lang:h||void 0,style:m,weight:y,dataUrl:x}).then(({fontUrls:F,chars:P})=>{const z=S.length;let U=0;T.forEach(W=>{for(let q=0,Y=W[1]-W[0];q<=Y;q++)_[W[0]+q]=P[U++]+z;U++});let O=0;F.forEach((W,q)=>{a(W,Y=>{S[q+z]=Y,++O===F.length&&R()})})})}else R()}function R(){f({chars:_,fonts:S})}function I(L,F){for(let P=0;P{let O,W;const q=[];for(let Y=0;Y-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),S=S.replace(/\r\n/g,` +`).replace(/\r/g,` +`)),R=+R,F=+F,z=+z,P=P||"normal",W=+W,c({text:S,lang:T,style:L,weight:I,fonts:typeof C=="string"?[{src:C}]:C,unicodeFontsURL:X,preResolvedFonts:te},he=>{oe.fontLoad=y()-Z;const xe=isFinite(z);let ae=null,de=null,me=null,Ge=null,ct=null,Qe=null,$e=null,bt=null,Oe=0,Ve=0,Pe=q!=="nowrap";const it=new Map,Q=y();let ut=W,qe=0,Ne=new x;const je=[Ne];he.forEach(we=>{const{fontObj:Ae}=we,{ascender:Le,descender:lt,unitsPerEm:Tt,lineGap:Rt,capHeight:Xe,xHeight:He}=Ae;let rt=it.get(Ae);if(!rt){const pe=R/Tt,Fe=P==="normal"?(Le-lt+Rt)*pe:P*R,et=(Fe-(Le-lt)*pe)/2,Re=Math.min(Fe,(Le-lt)*pe),Me=(Le+lt)/2*pe+Re/2;rt={index:it.size,src:Ae.src,fontObj:Ae,fontSizeMult:pe,unitsPerEm:Tt,ascender:Le*pe,descender:lt*pe,capHeight:Xe*pe,xHeight:He*pe,lineHeight:Fe,baseline:-et-Le*pe,caretTop:Me,caretBottom:Me-Re},it.set(Ae,rt)}const{fontSizeMult:le}=rt,Ie=S.slice(we.start,we.end+1);let De,re;Ae.forEachGlyph(Ie,R,F,(pe,Fe,et,Re)=>{Fe+=qe,Re+=we.start,De=Fe,re=pe;const Me=S.charAt(Re),ht=pe.advanceWidth*le,St=Ne.count;let It;if("isEmpty"in pe||(pe.isWhitespace=!!Me&&new RegExp(i).test(Me),pe.canBreakAfter=!!Me&&a.test(Me),pe.isEmpty=pe.xMin===pe.xMax||pe.yMin===pe.yMax||n.test(Me)),!pe.isWhitespace&&!pe.isEmpty&&Ve++,Pe&&xe&&!pe.isWhitespace&&Fe+ht+ut>z&&St){if(Ne.glyphAt(St-1).glyphObj.canBreakAfter)It=new x,ut=-Fe;else for(let un=St;un--;)if(un===0&&Y==="break-word"){It=new x,ut=-Fe;break}else if(Ne.glyphAt(un).glyphObj.canBreakAfter){It=Ne.splitAt(un+1);const tn=It.glyphAt(0).x;ut-=tn;for(let Cn=It.count;Cn--;)It.glyphAt(Cn).x-=tn;break}It&&(Ne.isSoftWrapped=!0,Ne=It,je.push(Ne),Oe=z)}let Gt=Ne.glyphAt(Ne.count);Gt.glyphObj=pe,Gt.x=Fe+ut,Gt.y=et,Gt.width=ht,Gt.charIndex=Re,Gt.fontData=rt,Me===` +`&&(Ne=new x,je.push(Ne),ut=-(Fe+ht+F*R)+W)}),qe=De+re.advanceWidth*le+F*R});let j=0;je.forEach(we=>{let Ae=!0;for(let Le=we.count;Le--;){const lt=we.glyphAt(Le);Ae&&!lt.glyphObj.isWhitespace&&(we.width=lt.x+lt.width,we.width>Oe&&(Oe=we.width),Ae=!1);let{lineHeight:Tt,capHeight:Rt,xHeight:Xe,baseline:He}=lt.fontData;Tt>we.lineHeight&&(we.lineHeight=Tt);const rt=He-we.baseline;rt<0&&(we.baseline+=rt,we.cap+=rt,we.ex+=rt),we.cap=Math.max(we.cap,we.baseline+Rt),we.ex=Math.max(we.ex,we.baseline+Xe)}we.baseline-=j,we.cap-=j,we.ex-=j,j+=we.lineHeight});let B=0,ue=0;if(K&&(typeof K=="number"?B=-K:typeof K=="string"&&(B=-Oe*(K==="left"?0:K==="center"?.5:K==="right"?1:p(K)))),$&&(typeof $=="number"?ue=-$:typeof $=="string"&&(ue=$==="top"?0:$==="top-baseline"?-je[0].baseline:$==="top-cap"?-je[0].cap:$==="top-ex"?-je[0].ex:$==="middle"?j/2:$==="bottom"?j:$==="bottom-baseline"?-je[je.length-1].baseline:p($)*j)),!ie){const we=e.getEmbeddingLevels(S,U);ae=new Uint16Array(Ve),de=new Uint8Array(Ve),me=new Float32Array(Ve*2),Ge={},$e=[1/0,1/0,-1/0,-1/0],bt=[],ge&&(Qe=new Float32Array(S.length*4)),fe&&(ct=new Uint8Array(Ve*3));let Ae=0,Le=-1,lt=-1,Tt,Rt;if(je.forEach((Xe,He)=>{let{count:rt,width:le}=Xe;if(rt>0){let Ie=0;for(let Re=rt;Re--&&Xe.glyphAt(Re).glyphObj.isWhitespace;)Ie++;let De=0,re=0;if(O==="center")De=(Oe-le)/2;else if(O==="right")De=Oe-le;else if(O==="justify"&&Xe.isSoftWrapped){let Re=0;for(let Me=rt-Ie;Me--;)Xe.glyphAt(Me).glyphObj.isWhitespace&&Re++;re=(Oe-le)/Re}if(re||De){let Re=0;for(let Me=0;Me=Me){let un=Gt,tn=Gt;for(;tnht)break;tnFe=Re;for(let Re=0;Re1&&m(Qe,Le,Cn),Le=It}if(fe){const{charIndex:It}=Me;for(;It>lt;)lt++,fe.hasOwnProperty(lt)&&(Rt=fe[lt])}if(!Fe.isWhitespace&&!Fe.isEmpty){const It=Ae++,{fontSizeMult:Gt,src:un,index:tn}=Me.fontData,Cn=Ge[un]||(Ge[un]={});Cn[ht]||(Cn[ht]={path:Fe.path,pathBounds:[Fe.xMin,Fe.yMin,Fe.xMax,Fe.yMax]});const Hn=Me.x+B,ti=Me.y+Xe.baseline+ue;me[It*2]=Hn,me[It*2+1]=ti;const ni=Hn+Fe.xMin*Gt,Ln=ti+Fe.yMin*Gt,Zt=Hn+Fe.xMax*Gt,jt=ti+Fe.yMax*Gt;ni<$e[0]&&($e[0]=ni),Ln<$e[1]&&($e[1]=Ln),Zt>$e[2]&&($e[2]=Zt),jt>$e[3]&&($e[3]=jt),It%ce===0&&(Tt={start:It,end:It,rect:[1/0,1/0,-1/0,-1/0]},bt.push(Tt)),Tt.end++;const Xn=Tt.rect;if(niXn[2]&&(Xn[2]=Zt),jt>Xn[3]&&(Xn[3]=jt),ae[It]=ht,de[It]=tn,fe){const zn=It*3;ct[zn]=Rt>>16&255,ct[zn+1]=Rt>>8&255,ct[zn+2]=Rt&255}}}}}),Qe){const Xe=S.length-Le;Xe>1&&m(Qe,Le,Xe)}}const ze=[];it.forEach(({index:we,src:Ae,unitsPerEm:Le,ascender:lt,descender:Tt,lineHeight:Rt,capHeight:Xe,xHeight:He})=>{ze[we]={src:Ae,unitsPerEm:Le,ascender:lt,descender:Tt,lineHeight:Rt,capHeight:Xe,xHeight:He}}),oe.typesetting=y()-Q,G({glyphIds:ae,glyphFontIndices:de,glyphPositions:me,glyphData:Ge,fontData:ze,caretPositions:Qe,glyphColors:ct,chunkedBounds:bt,fontSize:R,topBaseline:ue+je[0].baseline,blockBounds:[B,ue-j,B+Oe,ue],visibleBounds:$e,timings:oe})})}function h(S,C){f({...S,metricsOnly:!0},T=>{const[E,R,I,L]=T.blockBounds;C({width:I-E,height:L-R})})}function p(S){let C=S.match(/^([\d.]+)%$/),T=C?parseFloat(C[1]):NaN;return isNaN(T)?0:T/100}function m(S,C,T){const E=S[C*4],R=S[C*4+1],I=S[C*4+2],L=S[C*4+3],F=(R-E)/T;for(let P=0;P(Object.defineProperty(S,C,{get(){return this.data[this.index*_.length+T]},set(R){this.data[this.index*_.length+T]=R}}),S),{data:null,index:0}),{typeset:f,measure:h}}const jf=()=>(self.performance||Date).now(),t1=l3();let MT;function lF(s,e,t,n,i,a,c,f,h,p,m=!0){return m?uF(s,e,t,n,i,a,c,f,h,p).then(null,y=>(MT||(console.warn("WebGL SDF generation failed, falling back to JS",y),MT=!0),TT(s,e,t,n,i,a,c,f,h,p))):TT(s,e,t,n,i,a,c,f,h,p)}const my=[],cF=5;let bb=0;function u3(){const s=jf();for(;my.length&&jf()-snew Promise((e,t)=>{my.push(()=>{const n=jf();try{t1.webgl.generateIntoCanvas(...s),e({timing:jf()-n})}catch(i){t(i)}}),bb||(bb=setTimeout(u3,0))}),fF=4,hF=2e3,ET={};let dF=0;function TT(s,e,t,n,i,a,c,f,h,p){const m="TroikaTextSDFGenerator_JS_"+dF++%fF;let y=ET[m];return y||(y=ET[m]={workerModule:Zd({name:m,workerId:m,dependencies:[l3,jf],init(x,_){const S=x().javascript.generate;return function(...C){const T=_();return{textureData:S(...C),timing:_()-T}}},getTransferables(x){return[x.textureData.buffer]}}),requests:0,idleTimer:null}),y.requests++,clearTimeout(y.idleTimer),y.workerModule(s,e,t,n,i,a).then(({textureData:x,timing:_})=>{const S=jf(),C=new Uint8Array(x.length*4);for(let T=0;T{j5(m)},hF)),{timing:_}})}function pF(s){s._warm||(t1.webgl.isSupported(s),s._warm=!0)}const mF=t1.webglUtils.resizeWebGLCanvasWithoutClearing,Pm={unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},gF=new kt;function Td(){return(self.performance||Date).now()}const wT=Object.create(null);function f3(s,e){s=xF({},s);const t=Td(),n=[];if(s.font&&n.push({label:"user",src:_F(s.font)}),s.font=n,s.text=""+s.text,s.sdfGlyphSize=s.sdfGlyphSize||Pm.sdfGlyphSize,s.unicodeFontsURL=s.unicodeFontsURL||Pm.unicodeFontsURL,s.colorRanges!=null){let x={};for(let _ in s.colorRanges)if(s.colorRanges.hasOwnProperty(_)){let S=s.colorRanges[_];typeof S!="number"&&(S=gF.set(S).getHex()),x[_]=S}s.colorRanges=x}Object.freeze(s);const{textureWidth:i,sdfExponent:a}=Pm,{sdfGlyphSize:c}=s,f=i/c*4;let h=wT[c];if(!h){const x=document.createElement("canvas");x.width=i,x.height=c*256/f,h=wT[c]={glyphCount:0,sdfGlyphSize:c,sdfCanvas:x,sdfTexture:new mi(x,void 0,void 0,void 0,Wn,Wn),contextLost:!1,glyphsByFont:new Map},h.sdfTexture.generateMipmaps=!1,vF(h)}const{sdfTexture:p,sdfCanvas:m}=h;p3(s).then(x=>{const{glyphIds:_,glyphFontIndices:S,fontData:C,glyphPositions:T,fontSize:E,timings:R}=x,I=[],L=new Float32Array(_.length*4);let F=0,P=0;const z=Td(),U=C.map(K=>{let $=h.glyphsByFont.get(K.src);return $||h.glyphsByFont.set(K.src,$=new Map),$});_.forEach((K,$)=>{const ie=S[$],{src:X,unitsPerEm:te}=C[ie];let ge=U[ie].get(K);if(!ge){const{path:oe,pathBounds:he}=x.glyphData[X][K],xe=Math.max(he[2]-he[0],he[3]-he[1])/c*(Pm.sdfMargin*c+.5),ae=h.glyphCount++,de=[he[0]-xe,he[1]-xe,he[2]+xe,he[3]+xe];U[ie].set(K,ge={path:oe,atlasIndex:ae,sdfViewBox:de}),I.push(ge)}const{sdfViewBox:ce}=ge,fe=T[P++],G=T[P++],Z=E/te;L[F++]=fe+ce[0]*Z,L[F++]=G+ce[1]*Z,L[F++]=fe+ce[2]*Z,L[F++]=G+ce[3]*Z,_[$]=ge.atlasIndex}),R.quads=(R.quads||0)+(Td()-z);const O=Td();R.sdf={};const W=m.height,q=Math.ceil(h.glyphCount/f),Y=Math.pow(2,Math.ceil(Math.log2(q*c)));Y>W&&(console.info(`Increasing SDF texture size ${W}->${Y}`),mF(m,i,Y),p.dispose()),Promise.all(I.map(K=>h3(K,h,s.gpuAccelerateSDF).then(({timing:$})=>{R.sdf[K.atlasIndex]=$}))).then(()=>{I.length&&!h.contextLost&&(d3(h),p.needsUpdate=!0),R.sdfTotal=Td()-O,R.total=Td()-t,e(Object.freeze({parameters:s,sdfTexture:p,sdfGlyphSize:c,sdfExponent:a,glyphBounds:L,glyphAtlasIndices:_,glyphColors:x.glyphColors,caretPositions:x.caretPositions,chunkedBounds:x.chunkedBounds,ascender:x.ascender,descender:x.descender,lineHeight:x.lineHeight,capHeight:x.capHeight,xHeight:x.xHeight,topBaseline:x.topBaseline,blockBounds:x.blockBounds,visibleBounds:x.visibleBounds,timings:x.timings}))})}),Promise.resolve().then(()=>{h.contextLost||pF(m)})}function h3({path:s,atlasIndex:e,sdfViewBox:t},{sdfGlyphSize:n,sdfCanvas:i,contextLost:a},c){if(a)return Promise.resolve({timing:-1});const{textureWidth:f,sdfExponent:h}=Pm,p=Math.max(t[2]-t[0],t[3]-t[1]),m=Math.floor(e/4),y=m%(f/n)*n,x=Math.floor(m/(f/n))*n,_=e%4;return lF(n,n,s,t,p,h,i,y,x,_,c)}function vF(s){const e=s.sdfCanvas;e.addEventListener("webglcontextlost",t=>{console.log("Context Lost",t),t.preventDefault(),s.contextLost=!0}),e.addEventListener("webglcontextrestored",t=>{console.log("Context Restored",t),s.contextLost=!1;const n=[];s.glyphsByFont.forEach(i=>{i.forEach(a=>{n.push(h3(a,s,!0))})}),Promise.all(n).then(()=>{d3(s),s.sdfTexture.needsUpdate=!0})})}function yF({font:s,characters:e,sdfGlyphSize:t},n){let i=Array.isArray(e)?e.join(` +`):""+e;f3({font:s,sdfGlyphSize:t,text:i},n)}function xF(s,e){for(let t in e)e.hasOwnProperty(t)&&(s[t]=e[t]);return s}let ay;function _F(s){return ay||(ay=typeof document>"u"?{}:document.createElement("a")),ay.href=s,ay.href}function d3(s){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:t}=s,{width:n,height:i}=e,a=s.sdfCanvas.getContext("webgl");let c=t.image.data;(!c||c.length!==n*i*4)&&(c=new Uint8Array(n*i*4),t.image={width:n,height:i,data:c},t.flipY=!1,t.isDataTexture=!0),a.readPixels(0,0,n,i,a.RGBA,a.UNSIGNED_BYTE,c)}}const bF=Zd({name:"Typesetter",dependencies:[oF,sF,X5],init(s,e,t){return s(e,t())}}),p3=Zd({name:"Typesetter",dependencies:[bF],init(s){return function(e){return new Promise(t=>{s.typeset(e,t)})}},getTransferables(s){const e=[];for(let t in s)s[t]&&s[t].buffer&&e.push(s[t].buffer);return e}});p3.onMainThread;const AT={};function SF(s){let e=AT[s];return e||(e=AT[s]=new Cs(1,1,s,s).translate(.5,.5,0)),e}const MF="aTroikaGlyphBounds",CT="aTroikaGlyphIndex",EF="aTroikaGlyphColor";class TF extends iS{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new Hr,this.boundingBox=new Gr}computeBoundingSphere(){}computeBoundingBox(){}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let t=SF(e);["position","normal","uv"].forEach(n=>{this.attributes[n]=t.attributes[n].clone()}),this.setIndex(t.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,t,n,i,a){this.updateAttributeData(MF,e,4),this.updateAttributeData(CT,t,1),this.updateAttributeData(EF,a,3),this._blockBounds=n,this._chunkedBounds=i,this.instanceCount=t.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:t,boundingBox:n}=this;if(t){const{PI:i,floor:a,min:c,max:f,sin:h,cos:p}=Math,m=i/2,y=i*2,x=Math.abs(t),_=e[0]/x,S=e[2]/x,C=a((_+m)/y)!==a((S+m)/y)?-x:c(h(_)*x,h(S)*x),T=a((_-m)/y)!==a((S-m)/y)?x:f(h(_)*x,h(S)*x),E=a((_+i)/y)!==a((S+i)/y)?x*2:f(x-p(_)*x,x-p(S)*x);n.min.set(C,e[1],t<0?-E:0),n.max.set(T,e[3],t<0?0:E)}else n.min.set(e[0],e[1],0),n.max.set(e[2],e[3],0);n.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let t=this.getAttribute(CT).count,n=this._chunkedBounds;if(n)for(let i=n.length;i--;){t=n[i].end;let a=n[i].rect;if(a[1]e.y&&a[0]e.x)break}this.instanceCount=t}updateAttributeData(e,t,n){const i=this.getAttribute(e);t?i&&i.array.length===t.length?(i.array.set(t),i.needsUpdate=!0):(this.setAttribute(e,new Zf(t,n)),delete this._maxInstanceCount,this.dispose()):i&&this.deleteAttribute(e)}}const wF=` +uniform vec2 uTroikaSDFTextureSize; +uniform float uTroikaSDFGlyphSize; +uniform vec4 uTroikaTotalBounds; +uniform vec4 uTroikaClipRect; +uniform mat3 uTroikaOrient; +uniform bool uTroikaUseGlyphColors; +uniform float uTroikaEdgeOffset; +uniform float uTroikaBlurRadius; +uniform vec2 uTroikaPositionOffset; +uniform float uTroikaCurveRadius; +attribute vec4 aTroikaGlyphBounds; +attribute float aTroikaGlyphIndex; +attribute vec3 aTroikaGlyphColor; +varying vec2 vTroikaGlyphUV; +varying vec4 vTroikaTextureUVBounds; +varying float vTroikaTextureChannel; +varying vec3 vTroikaGlyphColor; +varying vec2 vTroikaGlyphDimensions; +`,AF=` +vec4 bounds = aTroikaGlyphBounds; +bounds.xz += uTroikaPositionOffset.x; +bounds.yw -= uTroikaPositionOffset.y; + +vec4 outlineBounds = vec4( + bounds.xy - uTroikaEdgeOffset - uTroikaBlurRadius, + bounds.zw + uTroikaEdgeOffset + uTroikaBlurRadius +); +vec4 clippedBounds = vec4( + clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw), + clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw) +); + +vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy); + +position.xy = mix(bounds.xy, bounds.zw, clippedXY); + +uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy); + +float rad = uTroikaCurveRadius; +if (rad != 0.0) { + float angle = position.x / rad; + position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad); + normal.xz = vec2(sin(angle), cos(angle)); +} + +position = uTroikaOrient * position; +normal = uTroikaOrient * normal; + +vTroikaGlyphUV = clippedXY.xy; +vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]); + + +float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize; +vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize; +vec2 txStartUV = txUvPerSquare * vec2( + mod(floor(aTroikaGlyphIndex / 4.0), txCols), + floor(floor(aTroikaGlyphIndex / 4.0) / txCols) +); +vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare); +vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0); +`,CF=` +uniform sampler2D uTroikaSDFTexture; +uniform vec2 uTroikaSDFTextureSize; +uniform float uTroikaSDFGlyphSize; +uniform float uTroikaSDFExponent; +uniform float uTroikaEdgeOffset; +uniform float uTroikaFillOpacity; +uniform float uTroikaBlurRadius; +uniform vec3 uTroikaStrokeColor; +uniform float uTroikaStrokeWidth; +uniform float uTroikaStrokeOpacity; +uniform bool uTroikaSDFDebug; +varying vec2 vTroikaGlyphUV; +varying vec4 vTroikaTextureUVBounds; +varying float vTroikaTextureChannel; +varying vec2 vTroikaGlyphDimensions; + +float troikaSdfValueToSignedDistance(float alpha) { + // Inverse of exponential encoding in webgl-sdf-generator + + float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y); + float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension; + float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0); + return signedDist; +} + +float troikaGlyphUvToSdfValue(vec2 glyphUV) { + vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV); + vec4 rgba = texture2D(uTroikaSDFTexture, textureUV); + float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1 + return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a; +} + +float troikaGlyphUvToDistance(vec2 uv) { + return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv)); +} + +float troikaGetAADist() { + + #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300 + return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5; + #else + return vTroikaGlyphDimensions.x / 64.0; + #endif +} + +float troikaGetFragDistValue() { + vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize); + float distance = troikaGlyphUvToDistance(clampedGlyphUV); + + // Extrapolate distance when outside bounds: + distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : + length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions); + + + + return distance; +} + +float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) { + #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL) + float alpha = step(-distanceOffset, -distance); + #else + + float alpha = smoothstep( + distanceOffset + aaDist, + distanceOffset - aaDist, + distance + ); + #endif + + return alpha; +} +`,RF=` +float aaDist = troikaGetAADist(); +float fragDistance = troikaGetFragDistValue(); +float edgeAlpha = uTroikaSDFDebug ? + troikaGlyphUvToSdfValue(vTroikaGlyphUV) : + troikaGetEdgeAlpha(fragDistance, uTroikaEdgeOffset, max(aaDist, uTroikaBlurRadius)); + +#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL) +vec4 fillRGBA = gl_FragColor; +fillRGBA.a *= uTroikaFillOpacity; +vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity); +if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb; +gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep( + -uTroikaStrokeWidth - aaDist, + -uTroikaStrokeWidth + aaDist, + fragDistance +)); +gl_FragColor.a *= edgeAlpha; +#endif + +if (edgeAlpha == 0.0) { + discard; +} +`;function DF(s){const e=_b(s,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new pt},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new di(0,0,0,0)},uTroikaClipRect:{value:new di(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new pt},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new kt},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new _n},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:wF,vertexTransform:AF,fragmentDefs:CF,fragmentColorTransform:RF,customRewriter({vertexShader:t,fragmentShader:n}){let i=/\buniform\s+vec3\s+diffuse\b/;return i.test(n)&&(n=n.replace(i,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),i.test(t)||(t=t.replace(c3,`uniform vec3 diffuse; +$& +vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse; +`))),{vertexShader:t,fragmentShader:n}}});return e.transparent=!0,e.forceSinglePass=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const xS=new Ll({color:16777215,side:Ki,transparent:!0}),RT=8421504,DT=new dn,sy=new se,j_=new se,Dm=[],UF=new se,W_="+x+y";function UT(s){return Array.isArray(s)?s[0]:s}let m3=()=>{const s=new Si(new Cs(1,1),xS);return m3=()=>s,s},g3=()=>{const s=new Si(new Cs(1,1,32,1),xS);return g3=()=>s,s};const IF={type:"syncstart"},LF={type:"synccomplete"},v3=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],NF=v3.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let y3=class extends Si{constructor(){const e=new TF;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=RT,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=W_,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(IF),f3({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const n=this._queuedSyncs;n&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{n.forEach(i=>i&&i())})),this.dispatchEvent(LF),e&&e()})))}onBeforeRender(e,t,n,i,a,c){this.sync(),a.isTroikaTextMaterial&&this._prepareForRender(a)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){return DF(e)}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=xS.clone());if((!e||!e.isDerivedFrom(t))&&(e=this._derivedMaterial=this.createDerivedMaterial(t),t.addEventListener("dispose",function n(){t.removeEventListener("dispose",n),e.dispose()})),this.hasOutline()){let n=e._outlineMtl;return n||(n=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),n.isTextOutlineMaterial=!0,n.depthWrite=!1,n.map=null,e.addEventListener("dispose",function i(){e.removeEventListener("dispose",i),n.dispose()})),[n,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return UT(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return UT(this.material).getDistanceMaterial()}set customDistanceMaterial(e){}_prepareForRender(e){const t=e.isTextOutlineMaterial,n=e.uniforms,i=this.textRenderInfo;if(i){const{sdfTexture:f,blockBounds:h}=i;n.uTroikaSDFTexture.value=f,n.uTroikaSDFTextureSize.value.set(f.image.width,f.image.height),n.uTroikaSDFGlyphSize.value=i.sdfGlyphSize,n.uTroikaSDFExponent.value=i.sdfExponent,n.uTroikaTotalBounds.value.fromArray(h),n.uTroikaUseGlyphColors.value=!t&&!!i.glyphColors;let p=0,m=0,y=0,x,_,S,C=0,T=0;if(t){let{outlineWidth:R,outlineOffsetX:I,outlineOffsetY:L,outlineBlur:F,outlineOpacity:P}=this;p=this._parsePercent(R)||0,m=Math.max(0,this._parsePercent(F)||0),x=P,C=this._parsePercent(I)||0,T=this._parsePercent(L)||0}else y=Math.max(0,this._parsePercent(this.strokeWidth)||0),y&&(S=this.strokeColor,n.uTroikaStrokeColor.value.set(S??RT),_=this.strokeOpacity,_==null&&(_=1)),x=this.fillOpacity;n.uTroikaEdgeOffset.value=p,n.uTroikaPositionOffset.value.set(C,T),n.uTroikaBlurRadius.value=m,n.uTroikaStrokeWidth.value=y,n.uTroikaStrokeOpacity.value=_,n.uTroikaFillOpacity.value=x??1,n.uTroikaCurveRadius.value=this.curveRadius||0;let E=this.clipRect;if(E&&Array.isArray(E)&&E.length===4)n.uTroikaClipRect.value.fromArray(E);else{const R=(this.fontSize||.1)*100;n.uTroikaClipRect.value.set(h[0]-R,h[1]-R,h[2]+R,h[3]+R)}this.geometry.applyClipRect(n.uTroikaClipRect.value)}n.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const a=t?this.outlineColor||0:this.color;if(a==null)delete e.color;else{const f=e.hasOwnProperty("color")?e.color:e.color=new kt;(a!==f._input||typeof a=="object")&&f.set(f._input=a)}let c=this.orientation||W_;if(c!==e._orientation){let f=n.uTroikaOrient.value;c=c.replace(/[^-+xyz]/g,"");let h=c!==W_&&c.match(/^([-+])([xyz])([-+])([xyz])$/);if(h){let[,p,m,y,x]=h;sy.set(0,0,0)[m]=p==="-"?1:-1,j_.set(0,0,0)[x]=y==="-"?-1:1,DT.lookAt(UF,sy.cross(j_),j_),f.setFromMatrix4(DT)}else f.identity();e._orientation=c}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),n=t?parseFloat(t[1]):NaN;e=(isNaN(n)?0:n/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new pt){t.copy(e);const n=this.curveRadius;return n&&(t.x=Math.atan2(e.x,Math.abs(n)-Math.abs(e.z))*Math.abs(n)),t}worldPositionToTextCoords(e,t=new pt){return sy.copy(e),this.localPositionToTextCoords(this.worldToLocal(sy),t)}raycast(e,t){const{textRenderInfo:n,curveRadius:i}=this;if(n){const a=n.blockBounds,c=i?g3():m3(),f=c.geometry,{position:h,uv:p}=f.attributes;for(let m=0;m{this[n]=e[n]}),this}clone(){return new this.constructor().copy(this)}};v3.forEach(s=>{const e="_private_"+s;Object.defineProperty(y3.prototype,s,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})});new Gr;new kt;const na=Ce.forwardRef(({sdfGlyphSize:s=64,anchorX:e="center",anchorY:t="middle",font:n,fontSize:i=1,children:a,characters:c,onSync:f,...h},p)=>{const m=_a(({invalidate:S})=>S),[y]=Ce.useState(()=>new y3),[x,_]=Ce.useMemo(()=>{const S=[];let C="";return Ce.Children.forEach(a,T=>{typeof T=="string"||typeof T=="number"?C+=T:S.push(T)}),[S,C]},[a]);return FA(()=>new Promise(S=>yF({font:n,characters:c},S)),["troika-text",n,c]),Ce.useLayoutEffect(()=>{y.sync(()=>{m(),f&&f(y)})}),Ce.useEffect(()=>()=>y.dispose(),[y]),Ce.createElement("primitive",Ru({object:y,ref:p,font:n,text:_,anchorX:e,anchorY:t,fontSize:i,sdfGlyphSize:s},h),x)}),OF=()=>parseInt(Vd.replace(/\D+/g,"")),x3=OF(),PF=Ce.forwardRef(({makeDefault:s,camera:e,regress:t,domElement:n,enableDamping:i=!0,keyEvents:a=!1,onChange:c,onStart:f,onEnd:h,...p},m)=>{const y=_a(P=>P.invalidate),x=_a(P=>P.camera),_=_a(P=>P.gl),S=_a(P=>P.events),C=_a(P=>P.setEvents),T=_a(P=>P.set),E=_a(P=>P.get),R=_a(P=>P.performance),I=e||x,L=n||S.connected||_.domElement,F=Ce.useMemo(()=>new F5(I),[I]);return ra(()=>{F.enabled&&F.update()},-1),Ce.useEffect(()=>(a&&F.connect(a===!0?L:a),F.connect(L),()=>{F.dispose()}),[a,L,t,F,y]),Ce.useEffect(()=>{const P=O=>{y(),t&&R.regress(),c&&c(O)},z=O=>{f&&f(O)},U=O=>{h&&h(O)};return F.addEventListener("change",P),F.addEventListener("start",z),F.addEventListener("end",U),()=>{F.removeEventListener("start",z),F.removeEventListener("end",U),F.removeEventListener("change",P)}},[c,f,h,F,y,C]),Ce.useEffect(()=>{if(s){const P=E().controls;return T({controls:F}),()=>T({controls:P})}},[s,F]),Ce.createElement("primitive",Ru({ref:m,object:F,enableDamping:i},p))}),_S=Ce.forwardRef(({children:s,enabled:e=!0,speed:t=1,rotationIntensity:n=1,floatIntensity:i=1,floatingRange:a=[-.1,.1],autoInvalidate:c=!1,...f},h)=>{const p=Ce.useRef(null);Ce.useImperativeHandle(h,()=>p.current,[]);const m=Ce.useRef(Math.random()*1e4);return ra(y=>{var x,_;if(!e||t===0)return;c&&y.invalidate();const S=m.current+y.clock.elapsedTime;p.current.rotation.x=Math.cos(S/4*t)/8*n,p.current.rotation.y=Math.sin(S/4*t)/8*n,p.current.rotation.z=Math.sin(S/4*t)/20*n;let C=Math.sin(S/4*t)/10;C=so.mapLinear(C,-.1,.1,(x=a?.[0])!==null&&x!==void 0?x:-.1,(_=a?.[1])!==null&&_!==void 0?_:.1),p.current.position.y=C*i,p.current.updateMatrix()}),Ce.createElement("group",f,Ce.createElement("group",{ref:p,matrixAutoUpdate:!1},s))}),_3=(s,e,t)=>{let n;switch(s){case Br:n=new Uint8ClampedArray(e*t*4);break;case sr:n=new Uint16Array(e*t*4);break;case ws:n=new Uint32Array(e*t*4);break;case gx:n=new Int8Array(e*t*4);break;case vx:n=new Int16Array(e*t*4);break;case x0:n=new Int32Array(e*t*4);break;case Vi:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let oy;const FF=(s,e,t,n)=>{if(oy!==void 0)return oy;const i=new ka(1,1,n);e.setRenderTarget(i);const a=new Si(new Cs,new Ll({color:16777215}));e.render(a,t),e.setRenderTarget(null);const c=_3(s,i.width,i.height);return e.readRenderTargetPixels(i,0,0,i.width,i.height,c),i.dispose(),a.geometry.dispose(),a.material.dispose(),oy=c[0]!==0,oy};class bS{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:mr,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:e.renderTargetOptions?.anisotropy!==void 0?e.renderTargetOptions?.anisotropy:1,generateMipmaps:e.renderTargetOptions?.generateMipmaps!==void 0?e.renderTargetOptions?.generateMipmaps:!1,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:Wn,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:Wn,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:ar,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:ar};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=bS.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new S0,this._camera=new Rl,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!FF(this._type,this._renderer,this._camera,t)){let n;this._type===sr&&(n=this._renderer.extensions.has("EXT_color_buffer_float")?Vi:void 0),n!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${Vi}`),this._type=n):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new Si(new Cs,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new ka(this.width,this.height,t),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:Tu}static instantiateRenderer(){const e=new uS;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=_3(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new lo(this.toArray(),this.width,this.height,mr,this._type,e?.mapping||Tu,e?.wrapS||ar,e?.wrapT||ar,e?.magFilter||Wn,e?.minFilter||Wn,e?.anisotropy||1,zo);return t.generateMipmaps=e?.generateMipmaps!==void 0?e?.generateMipmaps:!1,t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof Vr&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof mi&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof mi&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class b3 extends Error{}class S3 extends Error{}const Um=(s,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(s);if(n)return n[1];const i=new RegExp(`<${e}[^>]*>([\\s\\S]*?)`,"i").exec(s);if(i){const a=i[1].match(/([^<]*)<\/rdf:li>/g);return a&&a.length===3?a.map(c=>c.replace(/<\/?rdf:li>/g,"")):i[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},zF=s=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(s):e=s.toString();let t=e.indexOf("",t),i=e.slice(t,n+10);try{const a=Um(i,"hdrgm:GainMapMin","0"),c=Um(i,"hdrgm:GainMapMax"),f=Um(i,"hdrgm:Gamma","1"),h=Um(i,"hdrgm:OffsetSDR","0.015625"),p=Um(i,"hdrgm:OffsetHDR","0.015625"),m=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(i),y=m?m[1]:"0",x=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(i);if(!x)throw new Error("Incomplete gainmap metadata");const _=x[1];return{gainMapMin:Array.isArray(a)?a.map(S=>parseFloat(S)):[parseFloat(a),parseFloat(a),parseFloat(a)],gainMapMax:Array.isArray(c)?c.map(S=>parseFloat(S)):[parseFloat(c),parseFloat(c),parseFloat(c)],gamma:Array.isArray(f)?f.map(S=>parseFloat(S)):[parseFloat(f),parseFloat(f),parseFloat(f)],offsetSdr:Array.isArray(h)?h.map(S=>parseFloat(S)):[parseFloat(h),parseFloat(h),parseFloat(h)],offsetHdr:Array.isArray(p)?p.map(S=>parseFloat(S)):[parseFloat(p),parseFloat(p),parseFloat(p)],hdrCapacityMin:parseFloat(y),hdrCapacityMax:parseFloat(_)}}catch{}t=e.indexOf("{const i=this.options.debug,a=new DataView(e.buffer);if(a.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const c=a.byteLength;let f=2,h=0,p;for(;f250){n(new Error(`Found no marker after ${h} loops 😵`));return}if(a.getUint8(f)!==255){n(new Error(`Not a valid marker at offset 0x${f.toString(16)}, found: 0x${a.getUint8(f).toString(16)}`));return}if(p=a.getUint8(f+1),i&&console.log(`Marker: ${p.toString(16)}`),p===226){i&&console.log("Found APP2 marker (0xffe2)");const m=f+4;if(a.getUint32(m)===1297106432){const y=m+4;let x;if(a.getUint16(y)===18761)x=!1;else if(a.getUint16(y)===19789)x=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(a.getUint16(y+2,!x)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const _=a.getUint32(y+4,!x);if(_<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const S=y+_,C=a.getUint16(S,!x),T=S+2;let E=0;for(let F=T;F{const e=zF(s);if(!e)throw new S3("Gain map XMP metadata not found");const n=await new BF({extractFII:!0,extractNonFII:!0}).extract(s);if(n.length!==2)throw new b3("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},IT=s=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=i=>{t(i)},n.src=URL.createObjectURL(s)});class GF extends Ha{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new Yx}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new mi,sdr:new mi});return this._config.createQuadRenderer({width:16,height:16,type:sr,colorSpace:zo,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,n){const i=t?new Blob([t],{type:"image/jpeg"}):void 0,a=new Blob([e],{type:"image/jpeg"});let c,f,h=!1;if(typeof createImageBitmap>"u"){const p=await Promise.all([i?IT(i):Promise.resolve(void 0),IT(a)]);f=p[0],c=p[1],h=n==="flipY"}else{const p=await Promise.all([i?createImageBitmap(i,{imageOrientation:n||"flipY"}):Promise.resolve(void 0),createImageBitmap(a,{imageOrientation:n||"flipY"})]);f=p[0],c=p[1]}return{sdrImage:c,gainMapImage:f,needsFlip:h}}createTextures(e,t,n){const i=new mi(t||new ImageData(2,2),Tu,ar,ar,Wn,K_,mr,Br,1,zo);i.flipY=n,i.needsUpdate=!0;const a=new mi(e,Tu,ar,ar,Wn,K_,mr,Br,1,ia);return a.flipY=n,a.needsUpdate=!0,{gainMap:i,sdr:a}}updateQuadRenderer(e,t,n,i,a){e.width=t.width,e.height=t.height,e.material.gainMap=n,e.material.sdr=i,e.material.gainMapMin=a.gainMapMin,e.material.gainMapMax=a.gainMapMax,e.material.offsetHdr=a.offsetHdr,e.material.offsetSdr=a.offsetSdr,e.material.gamma=a.gamma,e.material.hdrCapacityMin=a.hdrCapacityMin,e.material.hdrCapacityMax=a.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,a.hdrCapacityMax),e.material.needsUpdate=!0}}const HF=` +varying vec2 vUv; + +void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); +} +`,VF=` +// min half float value +#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) +// max half float value +#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) + +uniform sampler2D sdr; +uniform sampler2D gainMap; +uniform vec3 gamma; +uniform vec3 offsetHdr; +uniform vec3 offsetSdr; +uniform vec3 gainMapMin; +uniform vec3 gainMapMax; +uniform float weightFactor; + +varying vec2 vUv; + +void main() { + vec3 rgb = texture2D( sdr, vUv ).rgb; + vec3 recovery = texture2D( gainMap, vUv ).rgb; + vec3 logRecovery = pow( recovery, gamma ); + vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; + vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; + vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); + gl_FragColor = vec4( clampedHdrColor , 1.0 ); +} +`;class jF extends Vr{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:n,gainMapMin:i,gainMapMax:a,maxDisplayBoost:c,hdrCapacityMin:f,hdrCapacityMax:h,sdr:p,gainMap:m}){super({name:"GainMapDecoderMaterial",vertexShader:HF,fragmentShader:VF,uniforms:{sdr:{value:p},gainMap:{value:m},gamma:{value:new se(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new se().fromArray(t)},offsetSdr:{value:new se().fromArray(n)},gainMapMin:{value:new se().fromArray(i)},gainMapMax:{value:new se().fromArray(a)},weightFactor:{value:(Math.log2(c)-f)/(h-f)}},blending:Po,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=c,this._hdrCapacityMin=f,this._hdrCapacityMax=h,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class M3 extends GF{constructor(e,t){super({renderer:e,createMaterial:n=>new jF(n),createQuadRenderer:n=>new bS(n)},t)}async render(e,t,n,i){const{sdrImage:a,gainMapImage:c,needsFlip:f}=await this.processImages(n,i,"flipY"),{gainMap:h,sdr:p}=this.createTextures(a,c,f);this.updateQuadRenderer(e,a,h,p,t),e.render()}}class WF extends M3{load([e,t,n],i,a,c){const f=this.prepareQuadRenderer();let h,p,m;const y=async()=>{if(h&&p&&m){try{await this.render(f,m,h,p)}catch(O){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(n),typeof c=="function"&&c(O),f.disposeOnDemandRenderer();return}typeof i=="function"&&i(f),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(n),f.disposeOnDemandRenderer()}};let x=!0,_=0,S=0,C=!0,T=0,E=0,R=!0,I=0,L=0;const F=()=>{if(typeof a=="function"){const O=_+T+I,W=S+E+L,q=x&&C&&R;a(new ProgressEvent("progress",{lengthComputable:q,loaded:W,total:O}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(n);const P=new Ts(this._internalLoadingManager);P.setResponseType("arraybuffer"),P.setRequestHeader(this.requestHeader),P.setPath(this.path),P.setWithCredentials(this.withCredentials),P.load(e,async O=>{if(typeof O=="string")throw new Error("Invalid sdr buffer");h=O,await y()},O=>{x=O.lengthComputable,S=O.loaded,_=O.total,F()},O=>{this.manager.itemError(e),typeof c=="function"&&c(O)});const z=new Ts(this._internalLoadingManager);z.setResponseType("arraybuffer"),z.setRequestHeader(this.requestHeader),z.setPath(this.path),z.setWithCredentials(this.withCredentials),z.load(t,async O=>{if(typeof O=="string")throw new Error("Invalid gainmap buffer");p=O,await y()},O=>{C=O.lengthComputable,E=O.loaded,T=O.total,F()},O=>{this.manager.itemError(t),typeof c=="function"&&c(O)});const U=new Ts(this._internalLoadingManager);return U.setRequestHeader(this.requestHeader),U.setPath(this.path),U.setWithCredentials(this.withCredentials),U.load(n,async O=>{if(typeof O!="string")throw new Error("Invalid metadata string");m=JSON.parse(O),await y()},O=>{R=O.lengthComputable,L=O.loaded,I=O.total,F()},O=>{this.manager.itemError(n),typeof c=="function"&&c(O)}),f}}class XF extends M3{load(e,t,n,i){const a=this.prepareQuadRenderer(),c=new Ts(this._internalLoadingManager);return c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setPath(this.path),c.setWithCredentials(this.withCredentials),this.manager.itemStart(e),c.load(e,async f=>{if(typeof f=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const h=new Uint8Array(f);let p,m,y;try{const x=await kF(h);p=x.sdr,m=x.gainMap,y=x.metadata}catch(x){if(x instanceof S3||x instanceof b3)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),y={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},p=h;else throw x}try{await this.render(a,y,p.buffer,m?.buffer)}catch(x){this.manager.itemError(e),typeof i=="function"&&i(x),a.disposeOnDemandRenderer();return}typeof t=="function"&&t(a),this.manager.itemEnd(e),a.disposeOnDemandRenderer()},n,f=>{this.manager.itemError(e),typeof i=="function"&&i(f)}),a}}const m0={apartment:"lebombo_1k.hdr",city:"potsdamer_platz_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",forest:"forest_slope_1k.hdr",lobby:"st_fagans_interior_1k.hdr",night:"dikhololo_night_1k.hdr",park:"rooitou_park_1k.hdr",studio:"studio_small_03_1k.hdr",sunset:"venice_sunset_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr"},E3="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",Id=s=>Array.isArray(s),SS=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function n1({files:s=SS,path:e="",preset:t=void 0,colorSpace:n=void 0,extensions:i}={}){t&&(MS(t),s=m0[t],e=E3);const a=Id(s),{extension:c,isCubemap:f}=ES(s),h=TS(c);if(!h)throw new Error("useEnvironment: Unrecognized file extension: "+s);const p=_a(_=>_.gl);Ce.useLayoutEffect(()=>{if(c!=="webp"&&c!=="jpg"&&c!=="jpeg")return;function _(){kd.clear(h,a?[s]:s)}p.domElement.addEventListener("webglcontextlost",_,{once:!0})},[s,p.domElement]);const m=kd(h,a?[s]:s,_=>{(c==="webp"||c==="jpg"||c==="jpeg")&&_.setRenderer(p),_.setPath==null||_.setPath(e),i&&i(_)});let y=a?m[0]:m;if(c==="jpg"||c==="jpeg"||c==="webp"){var x;y=(x=y.renderTarget)==null?void 0:x.texture}return y.mapping=f?Fo:Dd,y.colorSpace=n??(f?"srgb":"srgb-linear"),y}const qF={files:SS,path:"",preset:void 0,extensions:void 0};n1.preload=s=>{const e={...qF,...s};let{files:t,path:n=""}=e;const{preset:i,extensions:a}=e;i&&(MS(i),t=m0[i],n=E3);const{extension:c}=ES(t);if(c==="webp"||c==="jpg"||c==="jpeg")throw new Error("useEnvironment: Preloading gainmaps is not supported");const f=TS(c);if(!f)throw new Error("useEnvironment: Unrecognized file extension: "+t);kd.preload(f,Id(t)?[t]:t,h=>{h.setPath==null||h.setPath(n),a&&a(h)})};const YF={files:SS,preset:void 0};n1.clear=s=>{const e={...YF,...s};let{files:t}=e;const{preset:n}=e;n&&(MS(n),t=m0[n]);const{extension:i}=ES(t),a=TS(i);if(!a)throw new Error("useEnvironment: Unrecognized file extension: "+t);kd.clear(a,Id(t)?[t]:t)};function MS(s){if(!(s in m0))throw new Error("Preset must be one of: "+Object.keys(m0).join(", "))}function ES(s){var e;const t=Id(s)&&s.length===6,n=Id(s)&&s.length===3&&s.some(c=>c.endsWith("json")),i=Id(s)?s[0]:s;return{extension:t?"cube":n?"webp":i.startsWith("data:application/exr")?"exr":i.startsWith("data:application/hdr")?"hdr":i.startsWith("data:image/jpeg")?"jpg":(e=i.split(".").pop())==null||(e=e.split("?"))==null||(e=e.shift())==null?void 0:e.toLowerCase(),isCubemap:t,isGainmap:n}}function TS(s){return s==="cube"?fA:s==="hdr"?z5:s==="exr"?B5:s==="jpg"||s==="jpeg"?XF:s==="webp"?WF:null}const ZF=s=>s.current&&s.current.isScene,KF=s=>ZF(s)?s.current:s;function wS(s,e,t,n,i={}){var a,c,f,h;i={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...i};const p=KF(e||t),m=p.background,y=p.environment,x={backgroundBlurriness:p.backgroundBlurriness,backgroundIntensity:p.backgroundIntensity,backgroundRotation:(a=(c=p.backgroundRotation)==null||c.clone==null?void 0:c.clone())!==null&&a!==void 0?a:[0,0,0],environmentIntensity:p.environmentIntensity,environmentRotation:(f=(h=p.environmentRotation)==null||h.clone==null?void 0:h.clone())!==null&&f!==void 0?f:[0,0,0]};return s!=="only"&&(p.environment=n),s&&(p.background=n),wl(p,i),()=>{s!=="only"&&(p.environment=y),s&&(p.background=m),wl(p,x)}}function AS({scene:s,background:e=!1,map:t,...n}){const i=_a(a=>a.scene);return Ce.useLayoutEffect(()=>{if(t)return wS(e,s,i,t,n)}),null}function T3({background:s=!1,scene:e,blur:t,backgroundBlurriness:n,backgroundIntensity:i,backgroundRotation:a,environmentIntensity:c,environmentRotation:f,...h}){const p=n1(h),m=_a(y=>y.scene);return Ce.useLayoutEffect(()=>wS(s,e,m,p,{backgroundBlurriness:t??n,backgroundIntensity:i,backgroundRotation:a,environmentIntensity:c,environmentRotation:f})),Ce.useEffect(()=>()=>{p.dispose()},[p]),null}function QF({children:s,near:e=.1,far:t=1e3,resolution:n=256,frames:i=1,map:a,background:c=!1,blur:f,backgroundBlurriness:h,backgroundIntensity:p,backgroundRotation:m,environmentIntensity:y,environmentRotation:x,scene:_,files:S,path:C,preset:T=void 0,extensions:E}){const R=_a(U=>U.gl),I=_a(U=>U.scene),L=Ce.useRef(null),[F]=Ce.useState(()=>new S0),P=Ce.useMemo(()=>{const U=new Jx(n);return U.texture.type=sr,U},[n]);Ce.useEffect(()=>()=>{P.dispose()},[P]),Ce.useLayoutEffect(()=>{if(i===1){const U=R.autoClear;R.autoClear=!0,L.current.update(R,F),R.autoClear=U}return wS(c,_,I,P.texture,{backgroundBlurriness:f??h,backgroundIntensity:p,backgroundRotation:m,environmentIntensity:y,environmentRotation:x})},[s,F,P.texture,_,I,c,i,R]);let z=1;return ra(()=>{if(i===1/0||zgS({GroundProjectedEnvImpl:R5}),[]),Ce.useEffect(()=>()=>{a.dispose()},[a]);const f=Ce.useMemo(()=>[c],[c]),h=(e=s.ground)==null?void 0:e.height,p=(t=s.ground)==null?void 0:t.radius,m=(n=(i=s.ground)==null?void 0:i.scale)!==null&&n!==void 0?n:1e3;return Ce.createElement(Ce.Fragment,null,Ce.createElement(AS,Ru({},s,{map:c})),Ce.createElement("groundProjectedEnvImpl",{args:f,scale:m,height:h,radius:p}))}function $F(s){return s.ground?Ce.createElement(JF,s):s.map?Ce.createElement(AS,s):s.children?Ce.createElement(QF,s):Ce.createElement(T3,s)}function e2(s,e,t=new se){const n=Math.PI*(s-.5),i=2*Math.PI*(e-.5);return t.x=Math.cos(i),t.y=Math.sin(n),t.z=Math.sin(i),t}const LT=Ce.forwardRef(({inclination:s=.6,azimuth:e=.1,distance:t=1e3,mieCoefficient:n=.005,mieDirectionalG:i=.8,rayleigh:a=.5,turbidity:c=10,sunPosition:f=e2(s,e),...h},p)=>{const m=Ce.useMemo(()=>new se().setScalar(t),[t]),[y]=Ce.useState(()=>new A5);return Ce.createElement("primitive",Ru({object:y,ref:p,"material-uniforms-mieCoefficient-value":n,"material-uniforms-mieDirectionalG-value":i,"material-uniforms-rayleigh-value":a,"material-uniforms-sunPosition-value":f,"material-uniforms-turbidity-value":c,scale:m},h))});class t2 extends Vr{constructor(){super({uniforms:{time:{value:0},fade:{value:1}},vertexShader:` + uniform float time; + attribute float size; + varying vec3 vColor; + void main() { + vColor = color; + vec4 mvPosition = modelViewMatrix * vec4(position, 0.5); + gl_PointSize = size * (30.0 / -mvPosition.z) * (3.0 + sin(time + 100.0)); + gl_Position = projectionMatrix * mvPosition; + }`,fragmentShader:` + uniform sampler2D pointTexture; + uniform float fade; + varying vec3 vColor; + void main() { + float opacity = 1.0; + if (fade == 1.0) { + float d = distance(gl_PointCoord, vec2(0.5, 0.5)); + opacity = 1.0 / (1.0 + exp(16.0 * (d - 0.25))); + } + gl_FragColor = vec4(vColor, opacity); + + #include + #include <${x3>=154?"colorspace_fragment":"encodings_fragment"}> + }`})}}const n2=s=>new se().setFromSpherical(new cx(s,Math.acos(1-Math.random()*2),Math.random()*2*Math.PI)),i2=Ce.forwardRef(({radius:s=100,depth:e=50,count:t=5e3,saturation:n=0,factor:i=4,fade:a=!1,speed:c=1},f)=>{const h=Ce.useRef(null),[p,m,y]=Ce.useMemo(()=>{const _=[],S=[],C=Array.from({length:t},()=>(.5+.5*Math.random())*i),T=new kt;let E=s+e;const R=e/t;for(let I=0;Ih.current&&(h.current.uniforms.time.value=_.clock.elapsedTime*c));const[x]=Ce.useState(()=>new t2);return Ce.createElement("points",{ref:f},Ce.createElement("bufferGeometry",null,Ce.createElement("bufferAttribute",{attach:"attributes-position",args:[p,3]}),Ce.createElement("bufferAttribute",{attach:"attributes-color",args:[m,3]}),Ce.createElement("bufferAttribute",{attach:"attributes-size",args:[y,1]})),Ce.createElement("primitive",{ref:h,object:x,attach:"material",blending:gy,"uniforms-fade-value":a,depthWrite:!1,transparent:!0,vertexColors:!0}))});class r2 extends Vr{constructor(){super({uniforms:{time:{value:0},pixelRatio:{value:1}},vertexShader:` + uniform float pixelRatio; + uniform float time; + attribute float size; + attribute float speed; + attribute float opacity; + attribute vec3 noise; + attribute vec3 color; + varying vec3 vColor; + varying float vOpacity; + + void main() { + vec4 modelPosition = modelMatrix * vec4(position, 1.0); + modelPosition.y += sin(time * speed + modelPosition.x * noise.x * 100.0) * 0.2; + modelPosition.z += cos(time * speed + modelPosition.x * noise.y * 100.0) * 0.2; + modelPosition.x += cos(time * speed + modelPosition.x * noise.z * 100.0) * 0.2; + vec4 viewPosition = viewMatrix * modelPosition; + vec4 projectionPostion = projectionMatrix * viewPosition; + gl_Position = projectionPostion; + gl_PointSize = size * 25. * pixelRatio; + gl_PointSize *= (1.0 / - viewPosition.z); + vColor = color; + vOpacity = opacity; + } + `,fragmentShader:` + varying vec3 vColor; + varying float vOpacity; + void main() { + float distanceToCenter = distance(gl_PointCoord, vec2(0.5)); + float strength = 0.05 / distanceToCenter - 0.1; + gl_FragColor = vec4(vColor, strength * vOpacity); + #include + #include <${x3>=154?"colorspace_fragment":"encodings_fragment"}> + } + `})}get time(){return this.uniforms.time.value}set time(e){this.uniforms.time.value=e}get pixelRatio(){return this.uniforms.pixelRatio.value}set pixelRatio(e){this.uniforms.pixelRatio.value=e}}const w3=s=>s&&s.constructor===Float32Array,a2=s=>[s.r,s.g,s.b],A3=s=>s instanceof pt||s instanceof se||s instanceof di,C3=s=>Array.isArray(s)?s:A3(s)?s.toArray():[s,s,s];function Im(s,e,t){return Ce.useMemo(()=>{if(e!==void 0){if(w3(e))return e;if(e instanceof kt){const n=Array.from({length:s*3},()=>a2(e)).flat();return Float32Array.from(n)}else if(A3(e)||Array.isArray(e)){const n=Array.from({length:s*3},()=>C3(e)).flat();return Float32Array.from(n)}return Float32Array.from({length:s},()=>e)}return Float32Array.from({length:s},t)},[e])}const Dl=Ce.forwardRef(({noise:s=1,count:e=100,speed:t=1,opacity:n=1,scale:i=1,size:a,color:c,children:f,...h},p)=>{Ce.useMemo(()=>gS({SparklesImplMaterial:r2}),[]);const m=Ce.useRef(null),y=_a(I=>I.viewport.dpr),x=C3(i),_=Ce.useMemo(()=>Float32Array.from(Array.from({length:e},()=>x.map(so.randFloatSpread)).flat()),[e,...x]),S=Im(e,a,Math.random),C=Im(e,n),T=Im(e,t),E=Im(e*3,s),R=Im(c===void 0?e*3:e,w3(c)?c:new kt(c),()=>1);return ra(I=>{m.current&&m.current.material&&(m.current.material.time=I.clock.elapsedTime)}),Ce.useImperativeHandle(p,()=>m.current,[]),Ce.createElement("points",Ru({key:`particle-${e}-${JSON.stringify(i)}`},h,{ref:m}),Ce.createElement("bufferGeometry",null,Ce.createElement("bufferAttribute",{attach:"attributes-position",args:[_,3]}),Ce.createElement("bufferAttribute",{attach:"attributes-size",args:[S,1]}),Ce.createElement("bufferAttribute",{attach:"attributes-opacity",args:[C,1]}),Ce.createElement("bufferAttribute",{attach:"attributes-speed",args:[T,1]}),Ce.createElement("bufferAttribute",{attach:"attributes-color",args:[R,3]}),Ce.createElement("bufferAttribute",{attach:"attributes-noise",args:[E,3]})),f||Ce.createElement("sparklesImplMaterial",{transparent:!0,pixelRatio:y,depthWrite:!1}))}),NT=()=>{const s=[],e=i=>{switch(i){case"pawn":return 10;case"knight":return 20;case"bishop":return 20;case"rook":return 30;case"queen":return 40;case"king":return 15;default:return 10}},t=(i,a,c,f)=>{const h=e(i),p=a==="white"?"#d4af37":"#ff5252";return{id:`${i}-${a}-${c}-${f}-${Math.random().toString(36).substr(2,9)}`,type:i,color:a,secondaryColor:p,x:c,y:f,kills:0,defends:0,hp:h,maxHp:h,hasMoved:!1,status:"idle"}};for(let i=0;i<8;i++)s.push(t("pawn","white",i,1)),s.push(t("pawn","black",i,6));return["rook","knight","bishop","queen","king","bishop","knight","rook"].forEach((i,a)=>{s.push(t(i,"white",a,0)),s.push(t(i,"black",a,7))}),s},yu=(s,e,t)=>s.find(n=>n.x===e&&n.y===t),Qm=(s,e)=>{const t=[],{x:n,y:i,color:a,type:c}=s,f=(p,m,y=!0,x=!1)=>{if(p<0||p>7||m<0||m>7)return!1;const _=yu(e,p,m);return!_&&!x?(t.push({x:p,y:m}),!0):(_&&_.color!==a&&y&&t.push({x:p,y:m}),!1)},h=(p,m)=>{for(let y=1;y<8&&f(n+p*y,i+m*y);y++);};switch(c){case"pawn":{const p=a==="white"?1:-1,m=a==="white"?1:6;yu(e,n,i+p)||(f(n,i+p,!1),i===m&&!yu(e,n,i+p*2)&&f(n,i+p*2,!1)),f(n-1,i+p,!0,!0),f(n+1,i+p,!0,!0);break}case"knight":{[[-2,-1],[-2,1],[-1,-2],[-1,2],[1,-2],[1,2],[2,-1],[2,1]].forEach(([m,y])=>f(n+m,i+y));break}case"rook":{h(0,1),h(0,-1),h(1,0),h(-1,0);break}case"bishop":{h(1,1),h(1,-1),h(-1,1),h(-1,-1);break}case"queen":{h(0,1),h(0,-1),h(1,0),h(-1,0),h(1,1),h(1,-1),h(-1,1),h(-1,-1);break}case"king":{if([[0,1],[0,-1],[1,0],[-1,0],[1,1],[1,-1],[-1,1],[-1,-1]].forEach(([m,y])=>f(n+m,i+y)),!s.hasMoved){const m=a==="white"?0:7,y=e.find(_=>_.type==="rook"&&_.color===a&&_.x===7&&_.y===m);y&&!y.hasMoved&&!yu(e,5,m)&&!yu(e,6,m)&&t.push({x:6,y:m});const x=e.find(_=>_.type==="rook"&&_.color===a&&_.x===0&&_.y===m);x&&!x.hasMoved&&!yu(e,1,m)&&!yu(e,2,m)&&!yu(e,3,m)&&t.push({x:2,y:m})}break}}return t},g0=s=>{switch(s){case"pawn":return 6;case"knight":return 10;case"bishop":return 12;case"rook":return 15;case"queen":return 18;case"king":return 20;default:return 20}},OT=s=>{const e=g0(s);return Math.floor(Math.random()*e)+1},s2=s=>{switch(s){case"pawn":return 10;case"knight":return 30;case"bishop":return 30;case"rook":return 50;case"queen":return 90;case"king":return 1e3;default:return 0}},ly=s=>{const e=s2(s.type),t=s.hp/s.maxHp,n=s.kills*2+s.defends*2;return e*t+n},o2=(s,e,t,n,i)=>{const a=s.filter(S=>S.color===e&&S.hp>0),c=s.filter(S=>S.color!==e&&S.hp>0),f=a.find(S=>S.type==="king"),h=e==="black"?[4,5,6,7]:[0,1,2,3],p=new Set;c.forEach(S=>{Qm(S,s).forEach(T=>p.add(`${T.x},${T.y}`))});const m=f&&p.has(`${f.x},${f.y}`);let y=null,x=-1/0;if(!t){const S=c.filter(C=>h.includes(C.y));for(const C of S){let E=0;C.hp<=14?(E=ly(C)*3,C.type==="king"&&(E+=1e4)):E=28,m&&(E+=1e3),E>x&&(x=E,y={piece:{id:"onager"},target:{x:C.x,y:C.y},score:E,isSiege:!0})}}if(!n){const S=c.filter(C=>h.includes(C.y)&&C.type!=="king"&&C.type!=="queen");for(const C of S){let T=ly(C)*2.5;T>x&&(x=T,y={piece:{id:"monk"},target:{x:C.x,y:C.y},score:T,isMonk:!0})}}if(!i){const S=a.filter(C=>h.includes(C.y)&&C.hpx&&(x=R,y={piece:{id:"healer"},target:{x:C.x,y:C.y},score:R,isHealer:!0})}}const _=[...a].sort(()=>Math.random()-.5);for(const S of _){const C=Qm(S,s);for(const T of C){let E=0;const R=s.find(I=>I.x===T.x&&I.y===T.y);if(R&&R.color!==e){const I=ly(S),L=ly(R),F=g0(S.type),P=g0(R.type),z=F/2+S.kills,U=P/2+R.defends-(R.isDebuffed?2:0);if(z>=U-1){if(E+=L*3,R.type==="king"&&(E+=5e3),R.isDebuffed&&(E+=40),m){const O=Qm(R,s);f&&O.some(W=>W.x===f.x&&W.y===f.y)&&(E+=2e3)}}else E-=I*.5}else{const I=e==="black"?S.y-T.y:T.y-S.y;E+=I*2;const L=Math.abs(3.5-T.x)+Math.abs(3.5-T.y);if(E-=L*.5,S.type==="pawn"&&(T.y===0||T.y===7)&&(E+=150),f){S.type==="king"&&m&&(p.has(`${T.x},${T.y}`)||(E+=3e3));const F=Math.abs(T.x-f.x)+Math.abs(T.y-f.y);if(S.type!=="king"&&(F<=2&&(E+=5),m)){const P=Math.abs(S.x-f.x)+Math.abs(S.y-f.y);Fx&&(x=E,y={piece:S,target:{x:T.x,y:T.y},score:E})}}return y},l2=s=>{const[e,t]=Ce.useState(NT()),[n,i]=Ce.useState("white"),[a,c]=Ce.useState(null),[f,h]=Ce.useState(null),[p,m]=Ce.useState(null),[y,x]=Ce.useState(!1),[_,S]=Ce.useState(!1),[C,T]=Ce.useState(null),[E,R]=Ce.useState(!1),[I,L]=Ce.useState(!1),[F,P]=Ce.useState(!1),[z,U]=Ce.useState("white"),[O,W]=Ce.useState(1),[q,Y]=Ce.useState(null),[K,$]=Ce.useState(10),[ie,X]=Ce.useState(80),[te,ge]=Ce.useState([]),[ce,fe]=Ce.useState("wood"),[G,Z]=Ce.useState(1),[oe,he]=Ce.useState("#f0d9b5"),[xe,ae]=Ce.useState("#4a4a4a"),[de,me]=Ce.useState(!1),Ge=(De,re)=>{const pe={id:Math.random().toString(36).substr(2,9),message:De,type:re,timestamp:Date.now()};ge(Fe=>[pe,...Fe].slice(0,50))},[ct,Qe]=Ce.useState(!1),[$e,bt]=Ce.useState(!1),[Oe,Ve]=Ce.useState(null),[Pe,it]=Ce.useState(!1),[Q,ut]=Ce.useState(!1),[qe,Ne]=Ce.useState(null),[je,j]=Ce.useState(!1),[B,ue]=Ce.useState(!1),[ze,we]=Ce.useState(null),Ae=(De,re,pe)=>{if(De==="white"&&ct||De==="black"&&$e||n!==De||y||_||C||!I)return;const Fe=e.find(et=>et.x===re&&et.y===pe);Fe&&(Ve(De),De==="white"?Qe(!0):bt(!0),s("siege"),Ge(`${De.toUpperCase()} FIRED THE ONAGER at ${Fe.color} ${Fe.type}!`,"siege"),setTimeout(()=>{const et=Math.floor(Math.random()*5)+12;m({attackerRoll:et,attackerTotal:et,attackerStats:0,attackerDice:16,attackerColor:De,defenderRoll:Fe.hp,defenderTotal:Math.max(0,Fe.hp-et),defenderStats:0,defenderDice:0,defenderDebuff:0,isSiege:!0,success:et>=Fe.hp,targetX:re,targetY:pe}),t(Re=>Re.map(Me=>{if(Me.id===Fe.id){const ht=Math.max(0,Me.hp-et);return ht===0?(Me.type==="king"&&T(De),{...Me,hp:0,status:"dying"}):{...Me,hp:ht}}return Me})),setTimeout(()=>{t(Re=>Re.filter(Me=>Me.hp>0||Me.status!=="dying")),Ve(null),Xe(De)},1e3)},1500))},Le=(De,re,pe)=>{if(De==="white"&&Pe||De==="black"&&Q||n!==De||y||_||C||!I)return;const Fe=e.find(ht=>ht.x===re&&ht.y===pe);if(!Fe||Fe.color===De||Fe.type==="king"||Fe.type==="queen")return;De==="white"?it(!0):ut(!0),s("select"),Ge(`${De.toUpperCase()} MONK attempts to convert ${Fe.color} ${Fe.type}!`,"conversion"),x(!0);const et=Math.floor(Math.random()*20)+1;let Re=21;Fe.type==="pawn"?Re=16:Fe.type==="knight"||Fe.type==="bishop"?Re=18:Fe.type==="rook"&&(Re=19);const Me=et>Re;m({attackerRoll:et,attackerTotal:et,attackerStats:0,attackerDice:20,attackerColor:De,defenderRoll:Re+1,defenderTotal:Re+1,defenderStats:0,defenderDice:0,defenderDebuff:0,isMonk:!0,success:Me,targetX:re,targetY:pe}),setTimeout(()=>{x(!1),Me?(s("promotion"),Ge(`${De.toUpperCase()} MONK successfully converted the ${Fe.type}!`,"promotion"),t(ht=>ht.map(St=>St.id===Fe.id?{...St,color:De,hasMoved:!0}:St))):(s("defeat"),Ge(`${De.toUpperCase()} MONK failed the conversion (Rolled ${et}).`,"conversion")),setTimeout(()=>{Xe(De)},1e3)},1500)},lt=(De,re,pe)=>{if(De==="white"&&je||De==="black"&&B||n!==De||y||_||C||!I)return;const Fe=e.find(ht=>ht.x===re&&ht.y===pe);if(!Fe||Fe.color!==De)return;De==="white"?j(!0):ue(!0),s("select"),Ge(`${De.toUpperCase()} HEALER attempts to heal ${Fe.type}!`,"heal"),x(!0);const et=Math.floor(Math.random()*16)+1;let Re=0;et>10&&et<=12?Re=5:et===13?Re=6:et===14?Re=7:et===15?Re=8:et===16&&(Re=10);const Me=Re>0;m({attackerRoll:et,attackerTotal:Re,attackerStats:0,attackerDice:16,attackerColor:De,defenderRoll:Fe.hp,defenderTotal:Math.min(Fe.maxHp,Fe.hp+Re),defenderStats:0,defenderDice:0,defenderDebuff:0,isHealer:!0,success:Me,targetX:re,targetY:pe}),setTimeout(()=>{x(!1),Me?(s("castle"),Ge(`${De.toUpperCase()} HEALER restored ${Re} HP to the ${Fe.type}!`,"heal"),t(ht=>ht.map(St=>St.id===Fe.id?{...St,hp:Math.min(St.maxHp,St.hp+Re)}:St))):(s("defeat"),Ge(`${De.toUpperCase()} HEALER failed to restore HP (Rolled ${et}).`,"heal")),setTimeout(()=>{Xe(De)},1e3)},1500)},Tt=()=>{t(NT()),i("white"),W(1),c(null),m(null),x(!1),S(!1),T(null),L(!1),ge([]),Qe(!1),bt(!1),Ve(null),it(!1),ut(!1),Ne(null),j(!1),ue(!1),we(null)},Rt=(De,re)=>e.find(pe=>pe.x===De&&pe.y===re),Xe=De=>{const re=De==="white"?"black":"white";i(re),re==="white"&&W(pe=>pe+1),t(pe=>pe.map(Fe=>Fe.color===re?{...Fe,isDebuffed:!1}:Fe))},He=De=>{y||_||C||!I||n!==De||De==="white"&&ct||De==="black"&&$e||(s("select"),h(De),c(null),Ne(null),we(null))},rt=De=>{y||_||C||!I||n!==De||De==="white"&&Pe||De==="black"&&Q||(s("select"),Ne(De),c(null),h(null),we(null))},le=De=>{y||_||C||!I||n!==De||De==="white"&&je||De==="black"&&B||(s("select"),we(De),c(null),h(null),Ne(null))},Ie=(De,re,pe=!1)=>{if(y||_||C||!I||F&&n===(z==="white"?"black":"white")&&!pe)return;if(p&&!y&&m(null),f){const Me=Rt(De,re),ht=f==="white"?re<=3:re>=4;if(Me&&Me.color!==f&&ht){Ae(f,De,re),h(null);return}h(null)}if(qe){const Me=Rt(De,re),ht=qe==="white"?re<=3:re>=4;if(Me&&Me.color!==qe&&Me.type!=="king"&&Me.type!=="queen"&&ht){Le(qe,De,re),Ne(null);return}Ne(null)}if(ze){const Me=Rt(De,re),ht=ze==="white"?re<=3:re>=4;if(Me&&Me.color===ze&&ht){lt(ze,De,re),we(null);return}we(null)}const et=Rt(De,re),Re=e.find(Me=>Me.id===a);if(Re&&Qm(Re,e).some(St=>St.x===De&&St.y===re)){if(et&&et.color!==Re.color){s("attack");const St=OT(Re.type),It=OT(et.type),Gt=Math.max(0,St+Math.min(Re.kills,5)),un=et.isDebuffed?2:0,tn=Math.max(0,It+Math.min(et.defends,5)-un),Cn=Gt>tn,Hn=Math.abs(Gt-tn);x(!0),m({attackerRoll:St,attackerTotal:Gt,attackerStats:Math.min(Re.kills,5),attackerDice:g0(Re.type),attackerColor:Re.color,defenderRoll:It,defenderTotal:tn,defenderStats:Math.min(et.defends,5),defenderDice:g0(et.type),defenderDebuff:un,isSiege:!1,success:Cn,targetX:De,targetY:re}),setTimeout(()=>{if(x(!1),Cn){s("victory");const ti=et.hp-Hn;ti<=0?(et.type==="king"?(T(Re.color),Ge(`${Re.color.toUpperCase()} SLAUGHTERED THE KING!`,"kill")):Ge(`${Re.color} ${Re.type} killed ${et.color} ${et.type}`,"kill"),t(Ln=>Ln.map(Zt=>Zt.id===Re.id?{...Zt,status:"attacking"}:Zt.id===et.id?{...Zt,status:"dying",hp:0}:Zt)),setTimeout(()=>{const Ln=Re.type==="pawn"&&(re===0||re===7);Ln&&Ge(`${Re.color} Pawn promoted to Queen!`,"promotion"),t(Zt=>Zt.map(jt=>{if(jt.id===Re.id){let Xn=jt.type,zn=jt.maxHp,V=jt.hp;return Ln&&(Xn="queen",zn=40,V=40),{...jt,x:De,y:re,type:Xn,hp:V,maxHp:zn,kills:Math.min(jt.kills+1,5),hasMoved:!0,status:"idle"}}return jt}).filter(jt=>jt.id!==et.id))},1e3)):(Ge(`${Re.color} ${Re.type} dealt ${Hn} dmg to ${et.color} ${et.type}`,"attack"),t(Ln=>Ln.map(Zt=>Zt.id===et.id?{...Zt,hp:ti}:Zt.id===Re.id?{...Zt,hasMoved:!0}:Zt)))}else{s("defeat");const ti=Re.hp-(Hn===0?1:Hn);ti<=0?(Ge(`${et.color} ${et.type} counter-killed ${Re.color} ${Re.type}`,"kill"),Re.type==="king"&&(T(et.color),Ge(`${et.color.toUpperCase()} DEFENDED THE THRONE!`,"kill")),t(Ln=>Ln.map(Zt=>Zt.id===et.id?{...Zt,status:"attacking"}:Zt.id===Re.id?{...Zt,status:"dying",hp:0}:Zt)),setTimeout(()=>{t(Ln=>Ln.map(Zt=>Zt.id===et.id?{...Zt,defends:Math.min(Zt.defends+1,5),status:"idle"}:Zt).filter(Zt=>Zt.id!==Re.id))},1e3)):(Ge(`${et.color} ${et.type} repelled attack (${Hn===0?1:Hn} dmg to attacker)`,"attack"),t(Ln=>Ln.map(Zt=>Zt.id===Re.id?{...Zt,hp:ti,hasMoved:!0}:Zt.id===et.id?{...Zt,defends:Math.min(Zt.defends+1,5)}:Zt)))}Xe(n),c(null)},2e3);return}else if(!et){let St=`${Re.color} ${Re.type} moved to ${String.fromCharCode(97+De)}${re+1}`,It="move";if(Re.type==="pawn"&&(re===0||re===7))St=`${Re.color} Pawn promoted to Queen!`,It="promotion";else if(Re.type==="king"&&Math.abs(De-Re.x)===2){const Gt=De>Re.x;St=`${Re.color} Castled ${Gt?"Kingside":"Queenside"}`,It="castle"}Ge(St,It),s("move"),t(Gt=>{let un=Gt.map(tn=>{if(tn.id===Re.id){let Cn=tn.type,Hn=tn.maxHp,ti=tn.hp;return tn.type==="pawn"&&(re===0||re===7)&&(Cn="queen",Hn=40,ti=40),{...tn,x:De,y:re,type:Cn,hp:ti,maxHp:Hn,hasMoved:!0,isDebuffed:!0}}return tn});if(Re.type==="king"&&Math.abs(De-Re.x)===2){const tn=De>Re.x,Cn=Re.color==="white"?0:7,Hn=tn?7:0,ti=tn?5:3;un=un.map(ni=>ni.type==="rook"&&ni.color===Re.color&&ni.x===Hn&&ni.y===Cn?{...ni,x:ti,hasMoved:!0,isDebuffed:!0}:ni)}return un}),Xe(n),c(null);return}}et&&et.color===n?(s("select"),c(et.id)):c(null)};return Ce.useEffect(()=>{const De=z==="white"?"black":"white";if(F&&n===De&&!y&&!_&&!C&&I&&!q&&!p&&!Oe){const re=setTimeout(()=>{const Re=o2(e,De,De==="white"?ct:$e,De==="white"?Pe:Q,De==="white"?je:B);if(Re){let Me="move",ht=Re.piece.x,St=Re.piece.y;Re.isSiege?(Me="siege",ht=-1):Re.isMonk?(Me="monk",ht=-2):Re.isHealer&&(Me="healer",ht=-3),Y({step:1,move:{startX:ht,startY:St,targetX:Re.target.x,targetY:Re.target.y},aiColor:De,actionType:Me})}},800);return()=>clearTimeout(re)}},[e,n,F,z,y,_,C,I,q,p,ct,$e,Pe,Q,je,B,Oe]),Ce.useEffect(()=>{if(q&&!_&&!C){const De=q.aiColor||(z==="white"?"black":"white"),re=q.actionType||"move";if(q.step===1){const pe=setTimeout(()=>{re==="siege"?He(De):re==="monk"?rt(De):re==="healer"?le(De):Ie(q.move.startX,q.move.startY,!0),Y(Fe=>Fe?{...Fe,step:2}:null)},300);return()=>clearTimeout(pe)}else if(q.step===2){const pe=setTimeout(()=>{Ie(q.move.targetX,q.move.targetY,!0),Y(null)},500);return()=>clearTimeout(pe)}}},[q,_,C,Ie,He,rt,le,z]),{pieces:e,turn:n,selectedPieceId:a,battleResult:p,isRolling:y,isPaused:_,winner:C,isNight:E,hasStarted:I,fogNear:K,fogFar:ie,logs:te,boardStyle:ce,windStrength:G,whiteColor:oe,blackColor:xe,showCoordinates:de,setBoardStyle:fe,setWindStrength:Z,setWhiteColor:he,setBlackColor:ae,setShowCoordinates:me,setFogNear:$,setFogFar:X,setHasStarted:L,setIsNight:R,setIsPaused:S,resetGame:Tt,handleSquareClick:Ie,handleOnagerClick:He,setBattleResult:m,isVsAI:F,setIsVsAI:P,playerColor:z,setPlayerColor:U,turnCount:O,whiteSiegeUsed:ct,blackSiegeUsed:$e,isSiegeFiring:Oe,fireSiege:Ae,selectedOnagerColor:f,whiteMonkUsed:Pe,blackMonkUsed:Q,selectedMonkColor:qe,handleMonkClick:rt,whiteHealerUsed:je,blackHealerUsed:B,selectedHealerColor:ze,handleHealerClick:le}},Lo="/castarook/",c2={select:`${Lo}sounds/button-16a.mp3`,move:`${Lo}sounds/marching.mp3`,attack:`${Lo}sounds/clong-2.mp3`,victory:`${Lo}sounds/button-21.mp3`,defeat:`${Lo}sounds/button-19.mp3`,siege:`${Lo}sounds/bomb-falling-and-exploding-01.mp3`,menu:`${Lo}sounds/page-flip-03.mp3`},u2={wood:`${Lo}sounds/wood-chop-axe-hit-02.mp3`,wind:`${Lo}sounds/wind-howl-01.mp3`,shovel:`${Lo}sounds/shovel-into-snow-1.mp3`},f2=`${Lo}sounds/fire-1.mp3`,h2=()=>{const[s,e]=Ce.useState(.5),[t,n]=Ce.useState(!1),i=Ce.useRef(null),[a,c]=Ce.useState(!1),f=Ce.useMemo(()=>{const y={};return Object.entries(c2).forEach(([x,_])=>{const S=new Audio(_);S.preload="auto",y[x]=S}),y},[]),h=Ce.useMemo(()=>{const y={};return Object.entries(u2).forEach(([x,_])=>{const S=new Audio(_);S.preload="auto",y[x]=S}),y},[]);return Ce.useEffect(()=>(i.current=new Audio(f2),i.current.loop=!0,i.current.volume=s,()=>{i.current&&(i.current.pause(),i.current=null)}),[]),Ce.useEffect(()=>{if(!a||t){Object.values(h).forEach(_=>{_.pause(),_.currentTime=0});return}const y=()=>{if(t)return;const _=Object.keys(h),S=_[Math.floor(Math.random()*_.length)],C=h[S];C&&(C.currentTime=0,C.volume=s*.6,C.play().catch(()=>{}));const T=15e3+Math.random()*3e4;return setTimeout(y,T)},x=setTimeout(y,1e4);return()=>clearTimeout(x)},[a,t,h]),Ce.useEffect(()=>{const y=t?0:s;i.current&&(i.current.volume=y),Object.values(f).forEach(x=>{x.volume=y}),Object.values(h).forEach(x=>{x.volume=y*.6})},[s,t,f,h]),{volume:s,setVolume:e,isMuted:t,setIsMuted:n,playSound:y=>{if(t)return;const x=f[y];x&&(x.currentTime=0,x.play().catch(()=>{}))},startMusic:()=>{i.current&&i.current.paused&&i.current.play().then(()=>{c(!0)}).catch(y=>console.log("BGM play blocked by browser policy"))}}},d2=({x:s,y:e,color:t,isHighlight:n,highlightColor:i,onClick:a})=>{const[c,f]=Tl.useState(!1);U0(c);const h=n?i||"#ffeb3b":c?"#c8e6c9":t;return A.jsxs("mesh",{position:[s-3.5,.01,e-3.5],rotation:[-Math.PI/2,0,0],onClick:p=>{p.stopPropagation(),a()},onPointerOver:p=>{p.stopPropagation(),f(!0)},onPointerOut:()=>f(!1),receiveShadow:!0,children:[A.jsx("planeGeometry",{args:[1,1]}),A.jsx("meshStandardMaterial",{color:h,emissive:n?i||"#fbc02d":"#000",emissiveIntensity:n?.5:0})]})},p2=({validMoves:s,highlightSquares:e=[],highlightColor:t,onSquareClick:n,boardStyle:i,showCoordinates:a})=>{const c=[],h=(()=>{switch(i){case"stone":return{light:"#999",dark:"#444",base:"#222"};case"marble":return{light:"#fff",dark:"#71d5e4",base:"#004d40"};default:return{light:"#f0d9b5",dark:"#b58863",base:"#4a3b2c"}}})();for(let m=0;m<8;m++)for(let y=0;y<8;y++){const _=(m+y)%2===1?h.dark:h.light,S=s.some(R=>R.x===m&&R.y===y),C=e.some(R=>R.x===m&&R.y===y),T=S||C,E=C?t:void 0;c.push(A.jsx(d2,{x:m,y,color:_,isHighlight:T,highlightColor:E,onClick:()=>n(m,y)},`${m}-${y}`))}const p=()=>{if(!a)return null;const m=[],y=i==="stone"?"#fff":"#d4af37";for(let x=0;x<8;x++)m.push(A.jsx(na,{position:[x-3.5,.51,4.3],rotation:[-Math.PI/2,0,0],fontSize:.3,color:y,children:String.fromCharCode(65+x)},`label-x-${x}`)),m.push(A.jsx(na,{position:[-4.3,.51,x-3.5],rotation:[-Math.PI/2,0,Math.PI/2],fontSize:.3,color:y,children:x+1},`label-y-${x}`));return m};return A.jsxs("group",{children:[A.jsxs("mesh",{position:[0,-.5,0],receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[8.4,1,8.4]}),A.jsx("meshStandardMaterial",{color:h.base})]}),p(),c]})},Hd=(s,e)=>{const t=Math.sqrt(s*s+e*e);let n=Math.sin(s*.08)*Math.cos(e*.08)*2.5+Math.sin(s*.04)*2;const i=Math.sin(s*.25)*Math.cos(e*.25)*2.2;t>20&&(n+=i*Math.min(1,(t-20)/10));const a=Math.sqrt(Math.pow(s+40,2)+Math.pow(e+40,2));a<25&&(n+=Math.pow(Math.cos(a/25*Math.PI/2),2)*7);const c=Math.sqrt(Math.pow(s-45,2)+Math.pow(e-35,2));c<30&&(n+=Math.pow(Math.cos(c/30*Math.PI/2),.5)*4.5),e>40&&(n+=Math.sin(s*.2)*2*Math.min(1,(e-40)/20));const f=18,h=32;if(t{const t=Math.sqrt(s*s+e*e);return t<10.5?-.3:t<12?-.45:Hd(s,e)-.05},m2=({position:s,windStrength:e=1,seed:t=Math.random()})=>{const n=Ce.useRef(null),{height:i,width:a,leafColor:c,treeType:f}=Ce.useMemo(()=>{const h=["pine","round","bushy"];return{height:1.5+t*2,width:1+t*.8,leafColor:new kt(2972199).lerp(new kt(5077558),t),treeType:h[Math.floor(t*h.length)]}},[t]);return ra(h=>{if(n.current){const p=h.clock.getElapsedTime(),m=Math.sin(p*1.2+t*10)*.15*e,y=Math.cos(p*.8+t*7)*.15*e;n.current.rotation.x=m,n.current.rotation.z=y}}),A.jsxs("group",{position:[s[0],ko(s[0],s[2]),s[2]],children:[A.jsxs("mesh",{position:[0,i*.3,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.15,.25,i*.6,8]}),A.jsx("meshStandardMaterial",{color:"#4d2c19",roughness:.9})]}),A.jsx("group",{ref:n,position:[0,i*.5,0],children:f==="pine"?A.jsxs(A.Fragment,{children:[A.jsxs("mesh",{position:[0,.5,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("coneGeometry",{args:[a,2,8]}),A.jsx("meshStandardMaterial",{color:c,roughness:.8})]}),A.jsxs("mesh",{position:[0,1.2,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("coneGeometry",{args:[a*.8,1.5,8]}),A.jsx("meshStandardMaterial",{color:c.clone().multiplyScalar(1.1),roughness:.8})]}),A.jsxs("mesh",{position:[0,1.8,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("coneGeometry",{args:[a*.5,1,8]}),A.jsx("meshStandardMaterial",{color:c.clone().multiplyScalar(1.2),roughness:.8})]})]}):f==="round"?A.jsxs("mesh",{position:[0,1,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("sphereGeometry",{args:[a,12,12]}),A.jsx("meshStandardMaterial",{color:c,roughness:.8})]}):A.jsxs("group",{position:[0,.5,0],children:[A.jsxs("mesh",{position:[0,0,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("sphereGeometry",{args:[a*.7,8,8]}),A.jsx("meshStandardMaterial",{color:c,roughness:.8})]}),A.jsxs("mesh",{position:[a*.4,.5,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("sphereGeometry",{args:[a*.5,8,8]}),A.jsx("meshStandardMaterial",{color:c.clone().multiplyScalar(1.1),roughness:.8})]}),A.jsxs("mesh",{position:[-a*.4,.5,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("sphereGeometry",{args:[a*.5,8,8]}),A.jsx("meshStandardMaterial",{color:c.clone().multiplyScalar(.9),roughness:.8})]})]})})]})},g2=({position:s,scale:e=1})=>A.jsxs("group",{position:[s[0],ko(s[0],s[2]),s[2]],scale:e,children:[A.jsxs("mesh",{position:[0,.3,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("sphereGeometry",{args:[.5,8,8]}),A.jsx("meshStandardMaterial",{color:"#2e7d32",roughness:.9})]}),A.jsxs("mesh",{position:[.3,.2,.2],castShadow:!0,receiveShadow:!0,children:[A.jsx("sphereGeometry",{args:[.4,8,8]}),A.jsx("meshStandardMaterial",{color:"#1b5e20",roughness:.9})]}),A.jsxs("mesh",{position:[-.3,.2,-.2],castShadow:!0,receiveShadow:!0,children:[A.jsx("sphereGeometry",{args:[.4,8,8]}),A.jsx("meshStandardMaterial",{color:"#388e3c",roughness:.9})]})]}),v2=({position:s,seed:e=Math.random()})=>{const t=Ce.useRef(null);return ra(n=>{if(t.current){const i=n.clock.getElapsedTime();t.current.rotation.x=Math.sin(i*3+e*5)*.3,t.current.rotation.z=Math.cos(i*2.5+e*3)*.3}}),A.jsxs("group",{position:[s[0],ko(s[0],s[2]),s[2]],ref:t,children:[A.jsxs("mesh",{position:[0,.1,0],rotation:[0,e*Math.PI,0],children:[A.jsx("planeGeometry",{args:[.2,.4]}),A.jsx("meshStandardMaterial",{color:"#4d7a36",side:Ki,transparent:!0,alphaTest:.5})]}),A.jsxs("mesh",{position:[0,.1,0],rotation:[0,e*Math.PI+Math.PI/2,0],children:[A.jsx("planeGeometry",{args:[.2,.4]}),A.jsx("meshStandardMaterial",{color:"#4d7a36",side:Ki,transparent:!0,alphaTest:.5})]})]})},y2=({position:s,color:e="red"})=>A.jsxs("group",{position:[s[0],ko(s[0],s[2]),s[2]],children:[A.jsxs("mesh",{position:[0,.1,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.02,.02,.3]}),A.jsx("meshStandardMaterial",{color:"#4caf50"})]}),A.jsxs("mesh",{position:[0,.25,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("sphereGeometry",{args:[.08,8,8]}),A.jsx("meshStandardMaterial",{color:e,emissive:e,emissiveIntensity:.2})]})]}),x2=({position:s,seed:e=Math.random()})=>{const t=Ce.useRef(null),n=s[0],i=s[2];return ra(a=>{if(t.current){const c=a.clock.getElapsedTime()+e*100,f=Math.max(0,Math.sin(c*4)*.5),h=n+Math.sin(c*.5)*2,p=i+Math.cos(c*.5)*2;t.current.position.set(h,ko(h,p)+f,p),t.current.rotation.y=c*.5+Math.PI/2}}),A.jsxs("group",{ref:t,position:s,scale:.3,children:[A.jsxs("mesh",{position:[0,.4,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[.6,.4,1]}),A.jsx("meshStandardMaterial",{color:"#e0e0e0"})]}),A.jsxs("mesh",{position:[0,.7,.4],castShadow:!0,receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[.4,.4,.4]}),A.jsx("meshStandardMaterial",{color:"#e0e0e0"})]}),A.jsxs("mesh",{position:[.1,1,.4],castShadow:!0,receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[.1,.4,.1]}),A.jsx("meshStandardMaterial",{color:"#ffcdd2"})]}),A.jsxs("mesh",{position:[-.1,1,.4],castShadow:!0,receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[.1,.4,.1]}),A.jsx("meshStandardMaterial",{color:"#ffcdd2"})]})]})},PT=({position:s,rotationY:e=0,length:t=5})=>{const n=[];for(let i=0;iA.jsxs("mesh",{position:[s[0],ko(s[0],s[2])+e[1]*.4,s[2]],scale:e,castShadow:!0,receiveShadow:!0,children:[A.jsx("icosahedronGeometry",{args:[1,1]}),A.jsx("meshStandardMaterial",{color:t,roughness:.9,flatShading:!0})]}),b2=({position:s,rotationY:e=0})=>A.jsxs("group",{position:[s[0],ko(s[0],s[2]),s[2]],rotation:[0,e,0],children:[A.jsxs("mesh",{position:[0,1,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[3,2,2.5]}),A.jsx("meshStandardMaterial",{color:"#8d6e63",roughness:.8})]}),A.jsxs("mesh",{position:[0,2.5,0],rotation:[0,Math.PI/4,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("coneGeometry",{args:[2.5,1.5,4]}),A.jsx("meshStandardMaterial",{color:"#5d4037",roughness:.7})]}),A.jsxs("mesh",{position:[0,.6,1.26],children:[A.jsx("planeGeometry",{args:[.6,1]}),A.jsx("meshStandardMaterial",{color:"#3e2723"})]}),A.jsxs("mesh",{position:[1,1.2,1.26],children:[A.jsx("planeGeometry",{args:[.4,.4]}),A.jsx("meshStandardMaterial",{color:"#81d4fa",emissive:"#81d4fa",emissiveIntensity:.2})]}),A.jsxs("mesh",{position:[-1,1.2,1.26],children:[A.jsx("planeGeometry",{args:[.4,.4]}),A.jsx("meshStandardMaterial",{color:"#81d4fa",emissive:"#81d4fa",emissiveIntensity:.2})]})]}),S2=({position:s,rotationY:e=0,scale:t=1})=>A.jsxs("group",{position:[s[0],ko(s[0],s[2]),s[2]],rotation:[0,e,0],scale:t,children:[A.jsxs("mesh",{position:[0,3,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[6,6,6]}),A.jsx("meshStandardMaterial",{color:"#78909c",roughness:.6})]}),[[-3,4,-3],[3,4,-3],[-3,4,3],[3,4,3]].map((n,i)=>A.jsxs("group",{position:n,children:[A.jsxs("mesh",{castShadow:!0,receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[1.2,1.2,8,8]}),A.jsx("meshStandardMaterial",{color:"#546e7a",roughness:.6})]}),A.jsxs("mesh",{position:[0,4.5,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("coneGeometry",{args:[1.5,2,8]}),A.jsx("meshStandardMaterial",{color:"#b71c1c",roughness:.7})]})]},i)),A.jsxs("mesh",{position:[0,6.2,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[5.5,.5,5.5]}),A.jsx("meshStandardMaterial",{color:"#455a64"})]})]}),M2=({isNight:s})=>{const e=Ce.useMemo(()=>{const i=new Cs(160,160,60,60),a=i.attributes.position;for(let c=0;c{const e=Ce.useRef(null),t=Ce.useMemo(()=>{const c=new Cs(15,200,1,100),f=c.attributes.position;for(let h=0;h{if(e.current){const i=n.clock.getElapsedTime();e.current.position.y=-.55+Math.sin(i*.5)*.02*s}}),A.jsx("mesh",{geometry:t,ref:e,rotation:[-Math.PI/2,0,0],position:[45,-.55,0],receiveShadow:!0,children:A.jsx("meshStandardMaterial",{color:"#0288d1",transparent:!0,opacity:.7,roughness:.1,metalness:.9,emissive:"#01579b",emissiveIntensity:.5})})},FT=({color:s="#8d6e63",scale:e=1,animate:t=!0})=>{const n=Ce.useRef(null),i=Ce.useRef(null);return ra(a=>{if(t){const c=a.clock.getElapsedTime();n.current&&(n.current.rotation.x=Math.sin(c*.5)*.1),i.current&&(i.current.rotation.z=Math.sin(c*2)*.2)}}),A.jsxs("group",{scale:e,children:[A.jsxs("mesh",{position:[0,.6,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[.4,.5,1]}),A.jsx("meshStandardMaterial",{color:s})]}),A.jsxs("mesh",{position:[0,1,.4],rotation:[-.6,0,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.15,.2,.7,8]}),A.jsx("meshStandardMaterial",{color:s})]}),A.jsxs("mesh",{ref:n,position:[0,1.35,.65],rotation:[.2,0,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[.25,.25,.5]}),A.jsx("meshStandardMaterial",{color:s})]}),[[.15,.3,.35],[-.15,.3,.35],[.15,.3,-.35],[-.15,.3,-.35]].map((a,c)=>A.jsxs("mesh",{position:a,castShadow:!0,receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.06,.08,.6,8]}),A.jsx("meshStandardMaterial",{color:s})]},c)),A.jsxs("mesh",{ref:i,position:[0,.7,-.55],rotation:[.5,0,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.04,.02,.5,8]}),A.jsx("meshStandardMaterial",{color:"#444"})]})]})},T2=({color:s,stripeColor:e,scale:t=1})=>A.jsxs("group",{scale:t,children:[A.jsxs("mesh",{position:[0,.3,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.3,.4,.6,16]}),A.jsx("meshStandardMaterial",{color:s})]}),A.jsxs("mesh",{position:[0,.3,0],children:[A.jsx("cylinderGeometry",{args:[.36,.36,.05,16]}),A.jsx("meshStandardMaterial",{color:e})]}),A.jsxs("mesh",{position:[0,.8,0],rotation:[-.3,0,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.2,.35,.8,8]}),A.jsx("meshStandardMaterial",{color:s})]}),A.jsxs("mesh",{position:[0,.9,-.1],rotation:[-.3,0,0],children:[A.jsx("boxGeometry",{args:[.1,.6,.2]}),A.jsx("meshStandardMaterial",{color:e})]}),A.jsxs("group",{position:[0,1.2,.2],rotation:[.4,0,0],children:[A.jsxs("mesh",{castShadow:!0,receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[.3,.35,.6]}),A.jsx("meshStandardMaterial",{color:s})]}),A.jsxs("mesh",{position:[.1,.25,-.1],children:[A.jsx("coneGeometry",{args:[.05,.2,4]}),A.jsx("meshStandardMaterial",{color:s})]}),A.jsxs("mesh",{position:[-.1,.25,-.1],children:[A.jsx("coneGeometry",{args:[.05,.2,4]}),A.jsx("meshStandardMaterial",{color:s})]})]})]}),cy=({position:s,color:e="red"})=>{const t=Ce.useRef(null);return ra(n=>{if(t.current){const i=n.clock.getElapsedTime();t.current.rotation.y=Math.sin(i*3)*.3,t.current.rotation.x=Math.cos(i*2)*.15}}),A.jsxs("group",{position:[s[0],Hd(s[0],s[2]),s[2]],children:[A.jsxs("mesh",{position:[0,2,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.05,.05,4,8]}),A.jsx("meshStandardMaterial",{color:"#4d2c19"})]}),A.jsxs("mesh",{ref:t,position:[.6,3.2,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("planeGeometry",{args:[1.2,.8,10,10]}),A.jsx("meshStandardMaterial",{color:e,side:Ki})]})]})},w2=({position:s,rotationY:e})=>{const t=ko(s[0],s[2]);return A.jsxs("group",{position:[s[0],t,s[2]],rotation:[0,e,0],children:[A.jsxs("group",{position:[.5,.1,.2],rotation:[Math.PI/2,.2,0],children:[A.jsxs("mesh",{castShadow:!0,position:[0,.4,0],children:[A.jsx("boxGeometry",{args:[.08,.8,.02]}),A.jsx("meshStandardMaterial",{color:"#e0e0e0",metalness:.9,roughness:.1})]}),A.jsxs("mesh",{castShadow:!0,position:[0,0,0],children:[A.jsx("boxGeometry",{args:[.3,.04,.04]}),A.jsx("meshStandardMaterial",{color:"#d4af37",metalness:.8})]}),A.jsxs("mesh",{castShadow:!0,position:[0,-.15,0],children:[A.jsx("cylinderGeometry",{args:[.03,.03,.2,8]}),A.jsx("meshStandardMaterial",{color:"#4d2c19"})]}),A.jsxs("mesh",{castShadow:!0,position:[0,-.25,0],children:[A.jsx("sphereGeometry",{args:[.05,8,8]}),A.jsx("meshStandardMaterial",{color:"#d4af37",metalness:.8})]})]}),A.jsxs("group",{position:[-.5,.05,-.2],rotation:[Math.PI/2.2,0,.5],children:[A.jsxs("mesh",{castShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.5,.5,.05,16]}),A.jsx("meshStandardMaterial",{color:"#1976d2",metalness:.5,roughness:.3})]}),A.jsxs("mesh",{position:[0,.05,0],children:[A.jsx("sphereGeometry",{args:[.12,16,16,0,Math.PI*2,0,Math.PI/2]}),A.jsx("meshStandardMaterial",{color:"#d4af37",metalness:.8})]}),A.jsxs("mesh",{position:[0,0,0],rotation:[Math.PI/2,0,0],children:[A.jsx("torusGeometry",{args:[.5,.02,8,32]}),A.jsx("meshStandardMaterial",{color:"#d4af37",metalness:.8})]})]})]})},A2=({position:s})=>{const e=Ce.useRef(null);ra(n=>{e.current&&(e.current.intensity=2+Math.sin(n.clock.getElapsedTime()*10)*.5)});const t=ko(s[0],s[2]);return A.jsxs("group",{position:[s[0],t,s[2]],children:[A.jsxs("mesh",{rotation:[0,0,Math.PI/2],position:[0,.1,.2],castShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.05,.05,.6,6]}),A.jsx("meshStandardMaterial",{color:"#331a00"})]}),A.jsxs("mesh",{rotation:[0,Math.PI/3,Math.PI/2],position:[0,.1,-.2],castShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.05,.05,.6,6]}),A.jsx("meshStandardMaterial",{color:"#331a00"})]}),A.jsxs("group",{position:[0,.3,0],children:[A.jsx("pointLight",{ref:e,color:"#ff5722",distance:10,decay:2,castShadow:!0}),A.jsx(Dl,{count:20,scale:.5,size:4,speed:2,color:"#ff9800"}),A.jsx(_S,{speed:4,rotationIntensity:.5,floatIntensity:.5,children:A.jsxs("mesh",{children:[A.jsx("sphereGeometry",{args:[.1,8,8]}),A.jsx("meshStandardMaterial",{color:"#ff5722",emissive:"#ff5722",emissiveIntensity:2,transparent:!0,opacity:.6})]})})]})]})},C2=()=>A.jsxs("group",{children:[A.jsx(Dl,{count:150,scale:[40,10,40],size:3,speed:4,color:"#8d6e63",opacity:.4}),A.jsx(Dl,{count:100,scale:[50,15,50],size:2,speed:6,color:"#bcaaa4",opacity:.3})]}),R2=({isNight:s})=>{const e=s?"#1a1a1a":"#4a4a4a",t=s?"#111":"#333",n={polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1},i=Ce.useMemo(()=>Array.from({length:16}).map((a,c)=>{const f=c/16*Math.PI*2+Math.random()*.2,h=13.5+Math.random()*2.5,p=.5+Math.random()*1.5,m=Math.cos(f)*h,y=Math.sin(f)*h,x=Hd(m,y)+.75;return{id:c,position:[m,x,y],rotation:[-Math.PI/2,0,f],scale:[p,p,1.5]}}),[]);return A.jsxs("group",{position:[0,-.55,0],children:[A.jsxs("mesh",{position:[0,-.5,0],receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[12,13,1.2,32]}),A.jsx("meshStandardMaterial",{color:e,roughness:.9,...n})]}),A.jsxs("mesh",{position:[0,.15,0],receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[10.5,11,.2,32]}),A.jsx("meshStandardMaterial",{color:e,roughness:.8,...n})]}),A.jsxs("mesh",{position:[0,.15,0],receiveShadow:!0,rotation:[Math.PI/2,0,0],children:[A.jsx("torusGeometry",{args:[11,.1,8,48]}),A.jsx("meshStandardMaterial",{color:t,metalness:.2,roughness:.6,...n})]}),[0,Math.PI/2,Math.PI,Math.PI*1.5].map((a,c)=>A.jsxs("group",{position:[Math.cos(a)*11.5,.3,Math.sin(a)*11.5],rotation:[0,-a,0],children:[A.jsxs("mesh",{castShadow:!0,receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[1.5,.8,1.5]}),A.jsx("meshStandardMaterial",{color:e,roughness:.7,...n})]}),A.jsxs("mesh",{position:[0,.5,0],castShadow:!0,children:[A.jsx("sphereGeometry",{args:[.3,8,8]}),A.jsx("meshStandardMaterial",{color:"#d4af37",metalness:.8,roughness:.2})]})]},c)),i.map(a=>A.jsxs("mesh",{position:a.position,rotation:a.rotation,scale:a.scale,receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[1,1,.1]}),A.jsx("meshStandardMaterial",{color:e,roughness:.9,...n})]},`slab-${a.id}`)),[0,Math.PI].map((a,c)=>A.jsxs("group",{rotation:[0,a+Math.PI/2,0],children:[A.jsxs("mesh",{position:[0,.15,11.5],receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[4,.1,2]}),A.jsx("meshStandardMaterial",{color:e,...n})]}),A.jsxs("mesh",{position:[0,.05,13],receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[5,.1,2]}),A.jsx("meshStandardMaterial",{color:e,...n})]})]},`steps-${c}`))]})},D2=({position:s,rotationY:e=0,length:t=22})=>A.jsxs("group",{position:s,rotation:[0,e,0],children:[A.jsxs("mesh",{receiveShadow:!0,castShadow:!0,children:[A.jsx("boxGeometry",{args:[t,1.2,8]}),A.jsx("meshStandardMaterial",{color:"#555",roughness:.8})]}),A.jsxs("mesh",{position:[0,1,3.8],receiveShadow:!0,castShadow:!0,children:[A.jsx("boxGeometry",{args:[t,.8,.5]}),A.jsx("meshStandardMaterial",{color:"#444"})]}),A.jsxs("mesh",{position:[0,1,-3.8],receiveShadow:!0,castShadow:!0,children:[A.jsx("boxGeometry",{args:[t,.8,.5]}),A.jsx("meshStandardMaterial",{color:"#444"})]}),[-.3,.3].map((n,i)=>A.jsxs("mesh",{position:[t*n,-2,0],receiveShadow:!0,castShadow:!0,children:[A.jsx("boxGeometry",{args:[4,6,7.8]}),A.jsx("meshStandardMaterial",{color:"#333"})]},i))]}),zT=({position:s,rotationY:e=0,isNight:t,isUsed:n,isSelected:i,color:a,onClick:c})=>{const f=t?"#1a1510":"#4d2c19",h="#333",[p,m]=Ce.useState(!1);return U0(p&&!n),A.jsxs("group",{position:s,rotation:[0,e,0],onClick:y=>{y.stopPropagation(),c()},onPointerOver:()=>m(!0),onPointerOut:()=>m(!1),children:[i&&A.jsxs("group",{children:[A.jsxs("mesh",{position:[0,.1,0],rotation:[-Math.PI/2,0,0],children:[A.jsx("ringGeometry",{args:[1.2,1.4,32]}),A.jsx("meshBasicMaterial",{color:a,transparent:!0,opacity:.4,side:Ki})]}),A.jsx(_S,{speed:5,rotationIntensity:.2,floatIntensity:.5,children:A.jsxs("mesh",{position:[0,.5,0],rotation:[-Math.PI/2,0,0],children:[A.jsx("ringGeometry",{args:[1.1,1.15,32]}),A.jsx("meshBasicMaterial",{color:a,transparent:!0,opacity:.6,side:Ki})]})}),A.jsx(Dl,{count:20,scale:2,size:3,speed:2,color:a})]}),A.jsxs("group",{scale:.5,children:[A.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[.6,.4,0],children:[A.jsx("boxGeometry",{args:[.3,.4,5]}),A.jsx("meshStandardMaterial",{color:f,emissive:i?a:"#000",emissiveIntensity:i?.2:0})]}),A.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[-.6,.4,0],children:[A.jsx("boxGeometry",{args:[.3,.4,5]}),A.jsx("meshStandardMaterial",{color:f,emissive:i?a:"#000",emissiveIntensity:i?.2:0})]}),[-2,-.5,.5,2].map(y=>A.jsxs("group",{position:[0,.4,y],children:[A.jsxs("mesh",{castShadow:!0,receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[1.8,.35,.3]}),A.jsx("meshStandardMaterial",{color:f})]}),A.jsxs("mesh",{position:[.6,.2,0],children:[A.jsx("sphereGeometry",{args:[.08,8,8]}),A.jsx("meshStandardMaterial",{color:h})]}),A.jsxs("mesh",{position:[-.6,.2,0],children:[A.jsx("sphereGeometry",{args:[.08,8,8]}),A.jsx("meshStandardMaterial",{color:h})]})]},y)),[-1,1].map(y=>[-2,2].map(x=>A.jsxs("group",{position:[y,.4,x],children:[A.jsxs("mesh",{rotation:[0,0,Math.PI/2],castShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.5,.5,.25,24]}),A.jsx("meshStandardMaterial",{color:"#111",metalness:.8})]}),A.jsxs("mesh",{rotation:[0,0,Math.PI/2],scale:[.9,1,.9],children:[A.jsx("cylinderGeometry",{args:[.45,.45,.2,16]}),A.jsx("meshStandardMaterial",{color:f})]}),A.jsxs("mesh",{rotation:[0,0,Math.PI/2],position:[y>0?.1:-.1,0,0],children:[A.jsx("cylinderGeometry",{args:[.15,.15,.4,12]}),A.jsx("meshStandardMaterial",{color:h,metalness:.9})]})]},`${y}-${x}`))),[-.7,.7].map(y=>A.jsxs("group",{position:[y,1.5,0],children:[A.jsxs("mesh",{castShadow:!0,receiveShadow:!0,rotation:[.5,0,0],position:[0,0,-.6],children:[A.jsx("boxGeometry",{args:[.2,2.5,.2]}),A.jsx("meshStandardMaterial",{color:f})]}),A.jsxs("mesh",{castShadow:!0,receiveShadow:!0,rotation:[-.5,0,0],position:[0,0,.6],children:[A.jsx("boxGeometry",{args:[.2,2.5,.2]}),A.jsx("meshStandardMaterial",{color:f})]}),A.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,.8,0],rotation:[Math.PI/2,0,0],children:[A.jsx("cylinderGeometry",{args:[.15,.15,1.4,12]}),A.jsx("meshStandardMaterial",{color:h,metalness:.7})]})]},y)),A.jsxs("group",{position:[0,2.2,0],rotation:[n?-Math.PI/4:Math.PI/3,0,0],children:[A.jsxs("mesh",{castShadow:!0,receiveShadow:!0,position:[0,1.8,0],children:[A.jsx("boxGeometry",{args:[.25,4.5,.25]}),A.jsx("meshStandardMaterial",{color:f,emissive:i?a:"#000",emissiveIntensity:i?.3:0})]}),A.jsxs("mesh",{position:[0,1.8,.13],children:[A.jsx("boxGeometry",{args:[.15,3,.02]}),A.jsx("meshStandardMaterial",{color:a,emissive:a,emissiveIntensity:.8})]}),A.jsxs("group",{position:[0,4.2,0],children:[A.jsxs("mesh",{castShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.6,.4,.8,16]}),A.jsx("meshStandardMaterial",{color:h,metalness:.7,roughness:.3})]}),A.jsxs("mesh",{position:[0,.2,0],rotation:[0,0,0],children:[A.jsx("torusGeometry",{args:[.55,.03,8,24]}),A.jsx("meshStandardMaterial",{color:"#222",metalness:1})]}),!n&&A.jsxs("mesh",{position:[0,.5,0],castShadow:!0,children:[A.jsx("icosahedronGeometry",{args:[.45,1]}),A.jsx("meshStandardMaterial",{color:"#444",roughness:1,flatShading:!0})]})]}),A.jsxs("group",{position:[0,-.5,0],children:[A.jsxs("mesh",{castShadow:!0,children:[A.jsx("boxGeometry",{args:[1.2,1.2,1.2]}),A.jsx("meshStandardMaterial",{color:f})]}),A.jsxs("mesh",{position:[0,0,0],children:[A.jsx("boxGeometry",{args:[1.25,.1,1.25]}),A.jsx("meshStandardMaterial",{color:h})]})]})]}),!n&&A.jsxs("group",{position:[0,.6,2],children:[A.jsxs("mesh",{rotation:[0,0,Math.PI/2],children:[A.jsx("cylinderGeometry",{args:[.2,.2,1.4,12]}),A.jsx("meshStandardMaterial",{color:f})]}),A.jsxs("mesh",{position:[0,.2,-.5],rotation:[.6,0,0],children:[A.jsx("cylinderGeometry",{args:[.03,.03,4,6]}),A.jsx("meshStandardMaterial",{color:"#8d6e63"})]})]})]})]})},BT=({position:s,rotationY:e=0,isUsed:t,isSelected:n,color:i,onClick:a})=>{const[c,f]=Ce.useState(!1);return U0(c&&!t),A.jsxs("group",{position:s,rotation:[0,e,0],onClick:h=>{h.stopPropagation(),a()},onPointerOver:()=>f(!0),onPointerOut:()=>f(!1),children:[n&&A.jsxs("group",{children:[A.jsxs("mesh",{position:[0,.1,0],rotation:[-Math.PI/2,0,0],children:[A.jsx("ringGeometry",{args:[.6,.8,32]}),A.jsx("meshBasicMaterial",{color:i,transparent:!0,opacity:.4,side:Ki})]}),A.jsx(Dl,{count:15,scale:1,size:2,speed:1.5,color:i})]}),A.jsxs("group",{scale:.45,position:[0,0,0],rotation:t?[.3,0,0]:[0,0,0],children:[A.jsxs("mesh",{castShadow:!0,position:[0,t?.6:1,0],children:[A.jsx("cylinderGeometry",{args:[.6,.9,t?1.2:2,16]}),A.jsx("meshStandardMaterial",{color:t?"#333":"#4a332c"})]}),A.jsxs("mesh",{position:[0,t?.6:1,.45],children:[A.jsx("planeGeometry",{args:[.4,t?1:1.8]}),A.jsx("meshStandardMaterial",{color:t?"#555":"#d4af37"})]}),A.jsxs("mesh",{castShadow:!0,position:[0,t?1.3:2,0],children:[A.jsx("cylinderGeometry",{args:[.7,.7,t?.3:.5,16]}),A.jsx("meshStandardMaterial",{color:t?"#222":"#3e2723"})]}),A.jsxs("group",{position:[0,t?1.7:2.7,0],children:[A.jsxs("mesh",{castShadow:!0,children:[A.jsx("sphereGeometry",{args:[.35,16,16]}),A.jsx("meshStandardMaterial",{color:"#f5cba7"})]}),A.jsxs("mesh",{castShadow:!0,position:[0,.1,-.1],rotation:[.2,0,0],children:[A.jsx("sphereGeometry",{args:[.42,16,16,0,Math.PI*2,0,Math.PI/1.5]}),A.jsx("meshStandardMaterial",{color:t?"#222":"#4a332c",side:Ki})]})]}),A.jsxs("group",{position:[.8,t?.2:1.6,.3],rotation:t?[Math.PI/2,0,.5]:[.4,0,.1],children:[A.jsxs("mesh",{castShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.04,.06,2.2,8]}),A.jsx("meshStandardMaterial",{color:"#2a1a0a"})]}),[.5,-.5].map(h=>A.jsxs("mesh",{position:[0,h,0],children:[A.jsx("torusGeometry",{args:[.07,.02,8,16]}),A.jsx("meshStandardMaterial",{color:t?"#555":"#d4af37",metalness:1})]},h)),A.jsxs("group",{position:[0,1.2,0],children:[A.jsxs("mesh",{castShadow:!0,children:[A.jsx("boxGeometry",{args:[.25,.4,.25]}),A.jsx("meshStandardMaterial",{color:t?"#444":"#d4af37",metalness:.8})]}),A.jsxs("mesh",{position:[0,.3,0],children:[A.jsx("sphereGeometry",{args:[.2,12,12]}),A.jsx("meshStandardMaterial",{color:t?"#222":i,emissive:t?"#000":i,emissiveIntensity:n?3:1})]}),!t&&A.jsx(Dl,{count:5,scale:.5,size:2,color:i})]})]}),!t&&A.jsx(_S,{speed:3,rotationIntensity:.1,floatIntensity:.2,children:A.jsxs("mesh",{position:[0,3.6,0],rotation:[Math.PI/2,0,0],children:[A.jsx("torusGeometry",{args:[.4,.03,8,32]}),A.jsx("meshStandardMaterial",{color:"#ffd700",emissive:"#ffd700",emissiveIntensity:2})]})})]})]})},kT=({position:s,rotationY:e=0,isUsed:t,isSelected:n,color:i,onClick:a})=>{const[c,f]=Ce.useState(!1);return U0(c&&!t),A.jsxs("group",{position:s,rotation:[0,e,0],onClick:h=>{h.stopPropagation(),a()},onPointerOver:()=>f(!0),onPointerOut:()=>f(!1),children:[n&&A.jsxs("group",{children:[A.jsxs("mesh",{position:[0,.1,0],rotation:[-Math.PI/2,0,0],children:[A.jsx("ringGeometry",{args:[.6,.8,32]}),A.jsx("meshBasicMaterial",{color:i,transparent:!0,opacity:.4,side:Ki})]}),A.jsx(Dl,{count:15,scale:1,size:2,speed:1.5,color:i})]}),A.jsxs("group",{scale:.45,position:[0,0,0],rotation:t?[.3,0,0]:[0,0,0],children:[A.jsxs("mesh",{castShadow:!0,position:[0,t?.7:1.1,0],children:[A.jsx("boxGeometry",{args:[1,t?1.4:2.2,.7]}),A.jsx("meshStandardMaterial",{color:t?"#333":"#ffffff"})]}),A.jsxs("mesh",{position:[0,t?.4:.6,.36],children:[A.jsx("planeGeometry",{args:[.1,t?.8:1.2]}),A.jsx("meshStandardMaterial",{color:"#ddd"})]}),[-.6,.6].map(h=>A.jsxs("mesh",{castShadow:!0,position:[h,t?.8:1.4,t?.2:0],children:[A.jsx("boxGeometry",{args:[.25,t?.8:1.2,.3]}),A.jsx("meshStandardMaterial",{color:t?"#222":"#ffffff"})]},h)),A.jsxs("group",{position:[0,t?1.7:2.6,0],children:[A.jsxs("mesh",{castShadow:!0,children:[A.jsx("sphereGeometry",{args:[.38,16,16]}),A.jsx("meshStandardMaterial",{color:"#f5cba7"})]}),A.jsxs("mesh",{position:[0,.3,0],children:[A.jsx("cylinderGeometry",{args:[.4,.4,.2,16]}),A.jsx("meshStandardMaterial",{color:t?"#222":"#f0f0f0"})]}),A.jsxs("mesh",{position:[0,.3,.41],children:[A.jsx("boxGeometry",{args:[.15,.04,.02]}),A.jsx("meshStandardMaterial",{color:"#f44336"})]}),A.jsxs("mesh",{position:[0,.3,.41],children:[A.jsx("boxGeometry",{args:[.04,.15,.02]}),A.jsx("meshStandardMaterial",{color:"#f44336"})]})]}),A.jsxs("group",{position:[.8,t?.2:.6,.3],rotation:t?[0,-.5,0]:[0,-.2,0],children:[A.jsxs("mesh",{castShadow:!0,children:[A.jsx("boxGeometry",{args:[.7,.6,.4]}),A.jsx("meshStandardMaterial",{color:t?"#444":"#eee",roughness:.3,metalness:.2})]}),A.jsxs("mesh",{position:[0,.4,0],children:[A.jsx("torusGeometry",{args:[.15,.04,8,16,Math.PI]}),A.jsx("meshStandardMaterial",{color:t?"#222":"#333"})]}),A.jsxs("mesh",{position:[0,0,.21],children:[A.jsx("boxGeometry",{args:[.4,.1,.02]}),A.jsx("meshStandardMaterial",{color:t?"#666":"#f44336"})]}),A.jsxs("mesh",{position:[0,0,.21],children:[A.jsx("boxGeometry",{args:[.1,.4,.02]}),A.jsx("meshStandardMaterial",{color:t?"#666":"#f44336"})]}),[-.2,.2].map(h=>A.jsxs("mesh",{position:[h,.1,.2],children:[A.jsx("boxGeometry",{args:[.1,.15,.05]}),A.jsx("meshStandardMaterial",{color:t?"#222":"#999",metalness:1})]},h))]}),A.jsxs("mesh",{position:[0,t?1.2:2,.4],rotation:[Math.PI/2,0,0],children:[A.jsx("torusGeometry",{args:[.4,.02,8,32,Math.PI]}),A.jsx("meshStandardMaterial",{color:t?"#222":"#333"})]})]})]})},U2=({isNight:s,windStrength:e=1,whiteSiegeUsed:t,blackSiegeUsed:n,selectedOnagerColor:i,whiteColor:a,blackColor:c,onOnagerClick:f,whiteMonkUsed:h,blackMonkUsed:p,selectedMonkColor:m,onMonkClick:y,whiteHealerUsed:x,blackHealerUsed:_,selectedHealerColor:S,onHealerClick:C})=>{const T=Ce.useMemo(()=>{const U=[];for(let O=0;O<45;O++){const W=Math.random()*Math.PI*2,q=22+Math.random()*35;U.push({pos:[Math.cos(W)*q,0,Math.sin(W)*q],seed:Math.random()})}return U},[]),E=Ce.useMemo(()=>{const U=[];for(let O=0;O<100;O++){const W=Math.random()*Math.PI*2,q=8+Math.random()*40;U.push({pos:[Math.cos(W)*q,-.5,Math.sin(W)*q],seed:Math.random()})}return U},[]),R=Ce.useMemo(()=>{const U=[],O=["#f44336","#e91e63","#9c27b0","#ffeb3b"];for(let W=0;W<40;W++){const q=Math.random()*Math.PI*2,Y=10+Math.random()*25;U.push({pos:[Math.cos(q)*Y,-.5,Math.sin(q)*Y],color:O[Math.floor(Math.random()*O.length)]})}return U},[]),I=Ce.useMemo(()=>{const U=[];for(let O=0;O<6;O++){const W=Math.random()*Math.PI*2,q=12+Math.random()*15;U.push({pos:[Math.cos(W)*q,-.5,Math.sin(W)*q],seed:Math.random()})}return U},[]),L=Ce.useMemo(()=>[{pos:[-60,0,-60],scale:[40,50,40],color:"#3a3a3a"},{pos:[60,0,60],scale:[45,60,45],color:"#4a4a4a"},{pos:[-60,0,60],scale:[40,55,40],color:"#2a2a2a"},{pos:[60,0,-60],scale:[50,70,50],color:"#333333"},{pos:[0,-5,-80],scale:[70,40,40],color:"#222222"},{pos:[80,-5,0],scale:[40,45,70],color:"#444444"}],[]),F=Ce.useMemo(()=>[{pos:[-5,0,-2],rot:.5},{pos:[6,0,5],rot:2.1},{pos:[-3,0,8],rot:4.5}],[]),P=Ce.useMemo(()=>[{pos:[-12,-.5,-5],scale:1},{pos:[10,-.5,8],scale:1.2},{pos:[-5,-.5,12],scale:.8},{pos:[15,-.5,-10],scale:1.1},{pos:[0,-.5,-20],scale:1.3}],[]),z=[[-6,0,-6],[6,0,6],[-6,0,6],[6,0,-6],[-15,0,0],[15,0,0],[0,0,15],[0,0,-15]];return A.jsxs("group",{children:[A.jsx(M2,{isNight:s}),A.jsx(E2,{windStrength:e}),A.jsx(R2,{isNight:s}),A.jsx(D2,{position:[45,-.2,0],rotationY:Math.PI/8,length:28}),L.map((U,O)=>A.jsx(_2,{position:U.pos,scale:U.scale,color:U.color},`mtn-${O}`)),A.jsx(b2,{position:[-18,-.5,-18],rotationY:Math.PI/4}),A.jsx(S2,{position:[0,-.5,35],scale:2,rotationY:Math.PI}),A.jsx(PT,{position:[-10,-.5,-12],rotationY:.5,length:8}),A.jsx(PT,{position:[8,-.5,15],rotationY:-.8,length:10}),A.jsx("group",{position:[-10,Hd(-10,-8),-8],rotation:[0,Math.PI/4,0],children:A.jsx(FT,{color:"#5d4037",scale:.8})}),A.jsx("group",{position:[12,Hd(12,5),5],rotation:[0,-Math.PI/3,0],children:A.jsx(FT,{color:"#795548",scale:.9})}),A.jsx(C2,{}),T.map((U,O)=>A.jsx(m2,{position:U.pos,seed:U.seed,windStrength:e},`tree-${O}`)),P.map((U,O)=>A.jsx(g2,{position:U.pos,scale:U.scale},`bush-${O}`)),E.map((U,O)=>A.jsx(v2,{position:U.pos,seed:U.seed},`grass-${O}`)),R.map((U,O)=>A.jsx(y2,{position:U.pos,color:U.color},`flower-${O}`)),I.map((U,O)=>A.jsx(x2,{position:U.pos,seed:U.seed},`rabbit-${O}`)),A.jsx(cy,{position:[-2,-.5,-30],color:"#d32f2f"}),A.jsx(cy,{position:[2,-.5,-30],color:"#d32f2f"}),A.jsx(cy,{position:[-2,-.5,30],color:"#1976d2"}),A.jsx(cy,{position:[2,-.5,30],color:"#1976d2"}),A.jsx(zT,{position:[0,-.15,-6.5],rotationY:Math.PI,isNight:s,isUsed:t,isSelected:i==="white",color:a,onClick:()=>f("white")}),A.jsx(BT,{position:[-2.5,-.15,-6.5],rotationY:0,isUsed:h,isSelected:m==="white",color:a,onClick:()=>y("white")}),A.jsx(kT,{position:[2.5,-.15,-6.5],rotationY:0,isUsed:x,isSelected:S==="white",color:a,onClick:()=>C("white")}),A.jsx(zT,{position:[0,-.15,6.5],rotationY:0,isNight:s,isUsed:n,isSelected:i==="black",color:c,onClick:()=>f("black")}),A.jsx(BT,{position:[2.5,-.15,6.5],rotationY:Math.PI,isUsed:p,isSelected:m==="black",color:c,onClick:()=>y("black")}),A.jsx(kT,{position:[-2.5,-.15,6.5],rotationY:Math.PI,isUsed:_,isSelected:S==="black",color:c,onClick:()=>C("black")}),F.map(U=>A.jsx(w2,{position:U.pos,rotationY:U.rot},`deco-${U.pos[0]}-${U.pos[2]}`)),s&&z.map((U,O)=>A.jsx(A2,{position:U},`fire-${O}`))]})},I2=({piece:s,isSelected:e,onClick:t,customWhiteColor:n,customBlackColor:i})=>{const a=Ce.useRef(null),[c,f]=Ce.useState(!1);U0(c);const h=s.x-3.5,p=s.y-3.5,m=s.color==="white"?n||"#f0d9b5":i||"#4a4a4a",y=e?"#ffeb3b":c?"#81c784":m,x=s.secondaryColor||(s.color==="white"?"#d4af37":"#ff5252"),_=Ce.useRef(null);ra(C=>{if(!a.current)return;const T=C.clock.getElapsedTime();if(_.current&&s.isDebuffed){const E=.1+Math.sin(T*5)*.15;_.current.position.y=E,_.current.traverse(R=>{if(R instanceof Si&&R.material){const I=R.material,L=R.geometry.type==="CircleGeometry",F=R.geometry.type==="RingGeometry"&&I.emissive.getHex()===13938487,P=L?.8:F?.5:.7;I.opacity=P+Math.sin(T*5)*.2}})}if(s.status==="attacking"){const E=Math.sin(T*15)*.5;a.current.position.y=.01+Math.abs(E*.5);const R=s.color==="white"?1:-1;a.current.position.z=p+E*.8*R}else s.status==="dying"?(a.current.rotation.x=so.lerp(a.current.rotation.x,Math.PI/2.2,.1),a.current.position.y=so.lerp(a.current.position.y,-.5,.05)):(a.current.position.x=h,a.current.position.y=.01,a.current.position.z=p,a.current.rotation.x=0)});const S=()=>{switch(s.type){case"pawn":return A.jsxs("group",{children:[A.jsxs("mesh",{position:[0,.75,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("sphereGeometry",{args:[.25,16,16]}),A.jsx("meshStandardMaterial",{color:y})]}),A.jsxs("mesh",{position:[0,.3,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.2,.3,.6,16]}),A.jsx("meshStandardMaterial",{color:y})]}),A.jsxs("mesh",{position:[0,.3,0],children:[A.jsx("cylinderGeometry",{args:[.26,.26,.05,16]}),A.jsx("meshStandardMaterial",{color:x})]})]});case"rook":return A.jsxs("group",{children:[A.jsxs("mesh",{position:[0,.9,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.35,.35,.6,16]}),A.jsx("meshStandardMaterial",{color:y})]}),A.jsxs("mesh",{position:[0,.3,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.3,.4,.6,16]}),A.jsx("meshStandardMaterial",{color:y})]}),A.jsxs("mesh",{position:[0,.2,0],children:[A.jsx("cylinderGeometry",{args:[.41,.41,.05,16]}),A.jsx("meshStandardMaterial",{color:x})]}),A.jsxs("mesh",{position:[0,.7,0],children:[A.jsx("cylinderGeometry",{args:[.36,.36,.05,16]}),A.jsx("meshStandardMaterial",{color:x})]})]});case"knight":return A.jsx("group",{rotation:[0,s.color==="white"?0:Math.PI,0],children:A.jsx(T2,{color:y,stripeColor:x,scale:1.1})});case"bishop":return A.jsxs("group",{children:[A.jsxs("mesh",{position:[0,1.3,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("coneGeometry",{args:[.2,.6,16]}),A.jsx("meshStandardMaterial",{color:y})]}),A.jsxs("mesh",{position:[0,.5,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.2,.35,1,16]}),A.jsx("meshStandardMaterial",{color:y})]}),A.jsxs("mesh",{position:[0,.5,0],children:[A.jsx("cylinderGeometry",{args:[.3,.3,.05,16]}),A.jsx("meshStandardMaterial",{color:x})]})]});case"queen":return A.jsxs("group",{children:[A.jsxs("mesh",{position:[0,1.7,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("torusGeometry",{args:[.15,.05,16,32]}),A.jsx("meshStandardMaterial",{color:y})]}),A.jsxs("mesh",{position:[0,.8,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.2,.4,1.6,16]}),A.jsx("meshStandardMaterial",{color:y})]}),A.jsxs("mesh",{position:[0,.5,0],children:[A.jsx("cylinderGeometry",{args:[.32,.32,.05,16]}),A.jsx("meshStandardMaterial",{color:x})]}),A.jsxs("mesh",{position:[0,1.2,0],children:[A.jsx("cylinderGeometry",{args:[.25,.25,.05,16]}),A.jsx("meshStandardMaterial",{color:x})]})]});case"king":return A.jsxs("group",{children:[A.jsxs("mesh",{position:[0,2,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[.1,.4,.1]}),A.jsx("meshStandardMaterial",{color:y})]}),A.jsxs("mesh",{position:[0,2,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("boxGeometry",{args:[.4,.1,.1]}),A.jsx("meshStandardMaterial",{color:y})]}),A.jsxs("mesh",{position:[0,.9,0],castShadow:!0,receiveShadow:!0,children:[A.jsx("cylinderGeometry",{args:[.25,.4,1.8,16]}),A.jsx("meshStandardMaterial",{color:y})]}),A.jsxs("mesh",{position:[0,.5,0],children:[A.jsx("cylinderGeometry",{args:[.35,.32,.05,16]}),A.jsx("meshStandardMaterial",{color:x})]}),A.jsxs("mesh",{position:[0,1.4,0],children:[A.jsx("cylinderGeometry",{args:[.28,.28,.05,16]}),A.jsx("meshStandardMaterial",{color:x})]})]});default:return A.jsx("mesh",{position:[0,.3,0],children:A.jsx("boxGeometry",{args:[.6,.6,.6]})})}};return A.jsxs("group",{ref:a,onClick:C=>{C.stopPropagation(),t()},onPointerOver:C=>{C.stopPropagation(),f(!0)},onPointerOut:()=>f(!1),children:[S(),s.isDebuffed&&A.jsxs("group",{ref:_,position:[0,.1,0],children:[A.jsxs("mesh",{rotation:[-Math.PI/2,0,0],children:[A.jsx("ringGeometry",{args:[.55,.65,32]}),A.jsx("meshStandardMaterial",{color:"#ff0000",emissive:"#ff0000",emissiveIntensity:2,transparent:!0,opacity:.8,side:Ki})]}),A.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,.01,0],children:[A.jsx("ringGeometry",{args:[.35,.45,32]}),A.jsx("meshStandardMaterial",{color:"#ffffff",emissive:"#d4af37",emissiveIntensity:1.5,transparent:!0,opacity:.6,side:Ki})]}),A.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,.02,0],children:[A.jsx("circleGeometry",{args:[.15,16]}),A.jsx("meshStandardMaterial",{color:"#ff0000",emissive:"#ff0000",emissiveIntensity:1,transparent:!0,opacity:.9,side:Ki})]})]}),A.jsx(xu,{position:[0,2.5,0],follow:!0,children:A.jsxs("group",{children:[A.jsxs("mesh",{position:[0,0,-.02],raycast:()=>null,children:[A.jsx("planeGeometry",{args:[.64,.14]}),A.jsx("meshBasicMaterial",{color:"black"})]}),A.jsxs("mesh",{position:[0,0,-.01],raycast:()=>null,children:[A.jsx("planeGeometry",{args:[.6,.1]}),A.jsx("meshBasicMaterial",{color:"#333"})]}),A.jsxs("mesh",{position:[(s.hp/s.maxHp-1)*.3,0,0],raycast:()=>null,children:[A.jsx("planeGeometry",{args:[Math.max(.01,.6*(s.hp/s.maxHp)),.1]}),A.jsx("meshBasicMaterial",{color:s.hp/s.maxHp>.5?"#4caf50":s.hp/s.maxHp>.2?"#ffeb3b":"#f44336"})]}),A.jsxs(na,{position:[0,0,.05],fontSize:.12,color:"white",outlineWidth:.015,outlineColor:"black",fontWeight:"bold",raycast:()=>null,children:[Math.ceil(s.hp)," / ",s.maxHp]})]})}),(s.kills>0||s.defends>0)&&A.jsxs(xu,{position:[0,3,0],follow:!0,children:[s.kills>0&&A.jsxs(na,{position:[0,.2,0],fontSize:.25,color:"#ff8a80",outlineWidth:.02,outlineColor:"black",raycast:()=>null,children:["⚔️",s.kills]}),s.defends>0&&A.jsxs(na,{position:[0,-.2,0],fontSize:.25,color:"#82b1ff",outlineWidth:.02,outlineColor:"black",raycast:()=>null,children:["🛡️",s.defends]})]})]})},L2="0.6.0",N2={version:L2},O2=({turn:s,selectedPiece:e,battleResult:t,pieces:n,isPaused:i,winner:a,isNight:c,hasStarted:f,fogNear:h,fogFar:p,logs:m,boardStyle:y,windStrength:x,whiteColor:_,blackColor:S,showCoordinates:C,setBoardStyle:T,setWindStrength:E,setWhiteColor:R,setBlackColor:I,setShowCoordinates:L,setFogNear:F,setFogFar:P,setHasStarted:z,setIsNight:U,setIsPaused:O,resetGame:W,setBattleResult:q,isVsAI:Y,setIsVsAI:K,playerColor:$,setPlayerColor:ie,turnCount:X,whiteSiegeUsed:te,blackSiegeUsed:ge,whiteMonkUsed:ce,blackMonkUsed:fe,whiteHealerUsed:G,blackHealerUsed:Z,volume:oe,setVolume:he,isMuted:xe,setIsMuted:ae,startMusic:de,playSound:me})=>{const[Ge,ct]=Tl.useState(!1),[Qe,$e]=Tl.useState(!1),[bt,Oe]=Tl.useState(!1),[Ve,Pe]=Tl.useState(!1),[it,Q]=Tl.useState(!1),[ut,qe]=Tl.useState([]);Tl.useEffect(()=>{fetch("/castarook/changelog.json").then(Le=>Le.json()).then(Le=>qe(Le)).catch(Le=>console.error("Failed to load changelog:",Le))},[]);const Ne=Le=>{switch(Le){case"move":return"#ccc";case"attack":return"#ffa726";case"kill":return"#f44336";case"promotion":return"#d4af37";case"castle":return"#29b6f6";default:return"#fff"}},je=Le=>{switch(Le){case"move":return"👣";case"attack":return"⚔️";case"kill":return"💀";case"promotion":return"👑";case"castle":return"🏰";default:return"•"}},j=n.filter(Le=>Le.color==="white"),B=n.filter(Le=>Le.color==="black"),ue=j.reduce((Le,lt)=>Le+lt.kills,0),ze=B.reduce((Le,lt)=>Le+lt.kills,0),we={display:"block",width:"100%",padding:"12px",marginBottom:"12px",fontSize:"18px",cursor:"pointer",background:"linear-gradient(to bottom, #444, #222)",color:"#d4af37",border:"1px solid #d4af37",borderRadius:"4px",fontFamily:"serif",textTransform:"uppercase",transition:"all 0.2s"},Ae={background:"rgba(20, 15, 10, 0.9)",border:"2px solid #d4af37",boxShadow:"inset 0 0 15px rgba(212, 175, 55, 0.2), 0 4px 15px rgba(0,0,0,0.8)",color:"#f0d9b5",fontFamily:"serif"};return A.jsxs("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",padding:"20px",boxSizing:"border-box",display:"flex",flexDirection:"column",justifyContent:"space-between",fontFamily:"serif"},children:[!f&&A.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"radial-gradient(circle, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.8) 100%)",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",pointerEvents:"auto",zIndex:40,backdropFilter:"blur(4px)"},children:A.jsxs("div",{style:{textAlign:"center",animation:"popIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275)"},children:[A.jsx("img",{src:"/castarook/favicon.svg",alt:"Crown Logo",style:{width:"80px",height:"80px",marginBottom:"10px",filter:"drop-shadow(0px 4px 6px rgba(0,0,0,0.5))"}}),A.jsx("div",{style:{width:"100px",height:"2px",background:"#d4af37",margin:"0 auto 20px auto",boxShadow:"0 0 10px #d4af37"}}),A.jsx("h2",{style:{color:"#d4af37",fontSize:"24px",margin:0,textTransform:"uppercase",letterSpacing:"6px",opacity:.8},children:"A Strategic Saga"}),A.jsxs("h1",{style:{color:"#fff",fontSize:"100px",margin:"5px 0 0 0",textTransform:"uppercase",letterSpacing:"12px",fontWeight:"bold",textShadow:"0 0 20px rgba(212, 175, 55, 0.5), 2px 2px 0px #000"},children:["CASTA",A.jsx("span",{style:{color:"#d4af37"},children:"ROOK"})]}),A.jsxs("div",{style:{color:"#d4af37",fontSize:"16px",fontWeight:"bold",marginBottom:"30px",letterSpacing:"3px",textShadow:"1px 1px 0px #000"},children:["v",N2.version]}),A.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px",width:"320px",margin:"0 auto"},children:[A.jsx("button",{onClick:()=>{K(!1),z(!0),de()},style:{...we,background:"linear-gradient(to bottom, #d4af37, #aa8a2e)",color:"#000",border:"2px solid #fff",fontSize:"20px",fontWeight:"bold",padding:"15px"},children:"Player vs Player"}),A.jsx("div",{children:Ve?A.jsxs("div",{style:{display:"flex",gap:"10px",marginBottom:"5px"},children:[A.jsx("button",{onClick:()=>{ie("white"),K(!0),z(!0),de()},style:{...we,background:"#f0d9b5",color:"#000",flex:1,padding:"15px",fontWeight:"bold"},children:"Play White"}),A.jsx("button",{onClick:()=>{ie("black"),K(!0),z(!0),de()},style:{...we,background:"#1a1510",color:"#d4af37",flex:1,padding:"15px",fontWeight:"bold"},children:"Play Black"})]}):A.jsxs(A.Fragment,{children:[A.jsx("button",{onClick:()=>Pe(!0),style:{...we,background:"linear-gradient(to bottom, #546e7a, #37474f)",color:"#fff",border:"2px solid #b0bec5",fontSize:"20px",fontWeight:"bold",padding:"15px",marginBottom:"5px"},children:"Player vs AI (Beta)"}),A.jsx("div",{style:{color:"#ffb74d",fontSize:"12px",fontStyle:"italic",letterSpacing:"1px",lineHeight:"1.4"},children:"Warning: The AI uses a greedy algorithm and may behave unpredictably or foolishly."})]})}),A.jsx("button",{onClick:()=>ct(!0),style:{...we,background:"rgba(0,0,0,0.6)",color:"#d4af37"},children:"Learn the Rules"}),A.jsx("button",{onClick:()=>{Oe(!0),me("menu")},style:{...we,background:"rgba(0,0,0,0.6)",color:"#d4af37"},children:"Changelog"}),A.jsx("button",{onClick:()=>$e(!0),style:{...we,background:"rgba(0,0,0,0.6)",color:"#d4af37"},children:"Credits"})]}),A.jsx("div",{style:{width:"200px",height:"1px",background:"rgba(212, 175, 55, 0.3)",margin:"40px auto 20px auto"}}),A.jsx("button",{onClick:()=>window.open("https://fezcode.com","_blank"),style:{background:"none",border:"1px solid #d4af37",color:"#d4af37",padding:"8px 16px",fontSize:"12px",cursor:"pointer",fontFamily:"serif",textTransform:"uppercase",letterSpacing:"2px",borderRadius:"4px",transition:"all 0.2s",pointerEvents:"auto"},onMouseOver:Le=>{Le.currentTarget.style.background="rgba(212, 175, 55, 0.1)"},onMouseOut:Le=>{Le.currentTarget.style.background="none"},children:"Created by Fezcode"})]})}),A.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[A.jsxs("div",{style:{...Ae,padding:"15px",borderRadius:"4px",minWidth:"180px"},children:[A.jsx("h3",{style:{margin:"0 0 10px 0",borderBottom:"1px solid #d4af37",paddingBottom:"5px",color:"#d4af37",textTransform:"uppercase",letterSpacing:"1px"},children:"Army Strength"}),A.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"5px"},children:[A.jsx("span",{children:"White:"}),A.jsxs("span",{style:{fontWeight:"bold"},children:[j.length," Units (",ue," Kills)"]})]}),A.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"10px"},children:[A.jsx("span",{children:"Black:"}),A.jsxs("span",{style:{fontWeight:"bold"},children:[B.length," Units (",ze," Kills)"]})]}),A.jsxs("div",{style:{fontSize:"11px",color:"#aaa",borderTop:"1px solid rgba(212, 175, 55, 0.2)",paddingTop:"8px"},children:[A.jsx("div",{style:{marginBottom:"8px",borderBottom:"1px solid rgba(212, 175, 55, 0.1)",paddingBottom:"4px",color:"#f0d9b5"},children:"WHITE SUPPORT"}),A.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[A.jsx("span",{children:"Onager:"}),A.jsx("span",{style:{color:te?"#f44336":"#4caf50"},children:te?"DEPLETED":"READY"})]}),A.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[A.jsx("span",{children:"Monk:"}),A.jsx("span",{style:{color:ce?"#f44336":"#4caf50"},children:ce?"DEPLETED":"READY"})]}),A.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"8px"},children:[A.jsx("span",{children:"Healer:"}),A.jsx("span",{style:{color:G?"#f44336":"#4caf50"},children:G?"DEPLETED":"READY"})]}),A.jsx("div",{style:{marginBottom:"8px",borderBottom:"1px solid rgba(212, 175, 55, 0.1)",paddingBottom:"4px",color:"#f0d9b5"},children:"BLACK SUPPORT"}),A.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[A.jsx("span",{children:"Onager:"}),A.jsx("span",{style:{color:ge?"#f44336":"#4caf50"},children:ge?"DEPLETED":"READY"})]}),A.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:"4px"},children:[A.jsx("span",{children:"Monk:"}),A.jsx("span",{style:{color:fe?"#f44336":"#4caf50"},children:fe?"DEPLETED":"READY"})]}),A.jsxs("div",{style:{display:"flex",justifyContent:"space-between"},children:[A.jsx("span",{children:"Healer:"}),A.jsx("span",{style:{color:Z?"#f44336":"#4caf50"},children:Z?"DEPLETED":"READY"})]})]})]}),A.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center"},children:[A.jsxs("div",{style:{...Ae,background:s==="white"?"#f0d9b5":"#1a1510",color:s==="white"?"#2a1a0a":"#d4af37",padding:"12px 40px",borderRadius:"4px",fontSize:"28px",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"3px",border:"3px double #d4af37",transition:"all 0.4s cubic-bezier(0.4, 0, 0.2, 1)"},children:[s,"'s Command ",Y&&s===$&&A.jsx("span",{style:{fontSize:"12px",opacity:.7},children:"(YOU)"})]}),A.jsx("div",{style:{marginTop:"8px",background:"rgba(20, 15, 10, 0.8)",border:"1px solid #d4af37",color:"#d4af37",padding:"4px 16px",borderRadius:"12px",fontSize:"12px",textTransform:"uppercase",letterSpacing:"2px",boxShadow:"0 2px 4px rgba(0,0,0,0.5)"},children:Y?"Player vs AI":"Player vs Player"}),A.jsxs("div",{style:{marginTop:"4px",color:"#aaa",fontSize:"11px",textTransform:"uppercase",letterSpacing:"1px",textShadow:"1px 1px 2px rgba(0,0,0,0.8)"},children:["Turn ",X]})]}),A.jsx("div",{style:{minWidth:"180px",display:"flex",justifyContent:"flex-end"},children:A.jsx("button",{onClick:()=>{O(!0),me("menu")},disabled:!!a&&!it,style:{...we,width:"auto",padding:"10px 25px",fontSize:"16px",margin:0,opacity:a&&!it?.5:1,pointerEvents:"auto"},children:"📜 Strategic Menu"})})]}),Ge&&A.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.9)",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",pointerEvents:"auto",zIndex:50},children:A.jsxs("div",{style:{...Ae,padding:"40px",borderRadius:"8px",maxWidth:"650px",textAlign:"center",border:"4px double #d4af37"},children:[A.jsx("h1",{style:{color:"#d4af37",marginTop:0,fontSize:"36px",textTransform:"uppercase"},children:"Chronicles of Battle"}),A.jsxs("div",{style:{textAlign:"left",lineHeight:"1.8",fontSize:"18px"},children:[A.jsx("p",{children:"Command your pieces across the valley. Unlike regular chess, combat is determined by the fate of the dice."}),A.jsxs("ul",{style:{listStyleType:"square"},children:[A.jsxs("li",{children:[A.jsx("strong",{children:"Skirmishes:"})," Every unit has a unique die (Pawn: D6, Knight: D10, Bishop: D12, Rook: D15, Queen: D18, King: D20)."]}),A.jsxs("li",{children:[A.jsx("strong",{children:"Valor & Health:"})," Totals include battle-hardened stats (max +5). Damage is dealt based on the roll difference. Units perish only at 0 HP."]}),A.jsxs("li",{children:[A.jsx("strong",{children:"Opportunity Attack:"})," Any unit that has just moved becomes ",A.jsx("strong",{children:"Vulnerable (-2 Defense)"})," until the start of its next turn."]}),A.jsxs("li",{children:[A.jsx("strong",{children:"Support Units (One-time use, 4-row range):"}),A.jsxs("ul",{style:{color:"#d4af37"},children:[A.jsxs("li",{children:[A.jsx("strong",{children:"Monk:"})," Roll D20 to convert enemies (Target: Pawn 17+, Knight/Elephant 19+, Rook 20). Kings and Queens are immune."]}),A.jsxs("li",{children:[A.jsx("strong",{children:"Healer:"})," Roll D16 to restore HP (Roll 11-12: +5 HP, 13: +6 HP, 14: +7 HP, 15: +8 HP, 16: +10 HP)."]}),A.jsxs("li",{children:[A.jsx("strong",{children:"Onager:"})," Rain destruction from the shadows (12-16 DMG)."]})]})]}),A.jsxs("li",{children:[A.jsx("strong",{children:"Observation:"}),A.jsxs("ul",{style:{color:"#d4af37"},children:[A.jsx("li",{children:"Orbit: Left Click + Drag"}),A.jsx("li",{children:"Pan: Right Click + Drag"}),A.jsx("li",{children:"Zoom: Scroll Wheel"}),A.jsx("li",{children:"Reset View: Press 'R' or Middle Click"})]})]}),A.jsxs("li",{children:[A.jsx("strong",{children:"Victory Conditions:"})," No checkmate exists in this saga. You must execute the enemy King!"]})]})]}),A.jsx("button",{onClick:()=>{ct(!1),me("menu")},style:{...we,background:"linear-gradient(to bottom, #d4af37, #aa8a2e)",color:"#000",marginTop:"30px",fontWeight:"bold"},children:"Back to the Front"})]})}),bt&&A.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.9)",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",pointerEvents:"auto",zIndex:50},children:A.jsxs("div",{style:{...Ae,padding:"40px",borderRadius:"8px",maxWidth:"600px",width:"90%",textAlign:"center",border:"4px double #d4af37",display:"flex",flexDirection:"column",maxHeight:"85vh"},children:[A.jsx("h1",{style:{color:"#d4af37",marginTop:0,fontSize:"36px",textTransform:"uppercase"},children:"War Room Updates"}),A.jsxs("div",{style:{flex:1,overflowY:"auto",textAlign:"left",paddingRight:"20px",marginBottom:"20px",scrollbarWidth:"thin",scrollbarColor:"#d4af37 rgba(0,0,0,0.2)"},children:[ut.map((Le,lt)=>A.jsxs("div",{style:{marginBottom:"25px"},children:[A.jsxs("h2",{style:{color:"#fff",borderBottom:"1px solid #d4af37",paddingBottom:"5px",fontSize:"20px"},children:["v",Le.version," - ",Le.title,A.jsx("span",{style:{float:"right",fontSize:"12px",color:"#aaa",marginTop:"8px"},children:Le.date})]}),A.jsx("ul",{style:{color:"#f0d9b5",lineHeight:"1.6",fontSize:"16px"},children:Le.changes.map((Tt,Rt)=>A.jsx("li",{children:Tt},Rt))})]},lt)),ut.length===0&&A.jsx("div",{style:{textAlign:"center",color:"#aaa",marginTop:"50px"},children:"Loading chronicles..."})]}),A.jsx("button",{onClick:()=>{Oe(!1),me("menu")},style:{...we,background:"linear-gradient(to bottom, #d4af37, #aa8a2e)",color:"#000",fontWeight:"bold"},children:"Back to Command"})]})}),Qe&&A.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.9)",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",pointerEvents:"auto",zIndex:50},children:A.jsxs("div",{style:{...Ae,padding:"40px",borderRadius:"8px",minWidth:"400px",textAlign:"center",border:"4px double #d4af37"},children:[A.jsx("h1",{style:{color:"#d4af37",marginTop:0,fontSize:"36px",textTransform:"uppercase"},children:"Architects of the Saga"}),A.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"20px",margin:"30px 0"},children:[A.jsx("div",{onClick:()=>window.open("https://fezcode.com","_blank"),style:{fontSize:"24px",cursor:"pointer",color:"#f0d9b5",transition:"color 0.2s"},onMouseOver:Le=>Le.currentTarget.style.color="#d4af37",onMouseOut:Le=>Le.currentTarget.style.color="#f0d9b5",children:"Samil Bulbul (@fezcode)"}),A.jsx("div",{onClick:()=>window.open("https://github.com/TheLastRoadRunner","_blank"),style:{fontSize:"24px",cursor:"pointer",color:"#f0d9b5",transition:"color 0.2s"},onMouseOver:Le=>Le.currentTarget.style.color="#d4af37",onMouseOut:Le=>Le.currentTarget.style.color="#f0d9b5",children:"Sabri Bulbul (@thelastroadrunner)"})]}),A.jsx("button",{onClick:()=>{$e(!1),me("menu")},style:{...we,background:"linear-gradient(to bottom, #d4af37, #aa8a2e)",color:"#000",marginTop:"10px",fontWeight:"bold"},children:"Return to Menu"})]})}),a&&!i&&!it&&A.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.85)",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",pointerEvents:"auto",zIndex:20},children:A.jsxs("div",{style:{...Ae,background:a==="white"?"linear-gradient(135deg, #f0d9b5, #d4af37)":"linear-gradient(135deg, #2a1a0a, #000)",color:a==="white"?"#2a1a0a":"#d4af37",padding:"60px 100px",borderRadius:"8px",textAlign:"center",border:"5px double #d4af37",animation:"popInScale 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275)"},children:[A.jsxs("h1",{style:{fontSize:"64px",margin:"0 0 10px 0",textTransform:"uppercase",letterSpacing:"4px"},children:[a," Victory!"]}),A.jsxs("p",{style:{fontSize:"24px",margin:"0 0 40px 0",opacity:.8,fontStyle:"italic"},children:["The saga concludes. The ",a," throne stands supreme."]}),A.jsxs("div",{style:{display:"flex",gap:"20px",justifyContent:"center"},children:[A.jsx("button",{onClick:()=>{Q(!0),me("menu")},style:{...we,background:"rgba(0,0,0,0.5)",color:a==="white"?"#2a1a0a":"#d4af37",padding:"15px 30px",fontSize:"20px",fontWeight:"bold"},children:"View Scene"}),A.jsx("button",{onClick:()=>{Q(!1),W(),me("menu")},style:{...we,background:"#2a1a0a",color:"#d4af37",padding:"15px 30px",fontSize:"20px",fontWeight:"bold"},children:"Begin a New Chapter"})]})]})}),i&&A.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.7)",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",pointerEvents:"auto",zIndex:10},children:A.jsxs("div",{style:{...Ae,padding:"40px",borderRadius:"8px",textAlign:"center",minWidth:"350px",border:"3px double #d4af37"},children:[A.jsx("h1",{style:{color:"#d4af37",marginTop:0,marginBottom:"30px",textTransform:"uppercase"},children:"Battle Paused"}),A.jsx("button",{onClick:()=>{O(!1),me("menu")},style:we,children:"Resume Campaign"}),A.jsx("button",{onClick:()=>{ct(!0),O(!1),me("menu")},style:we,children:"The Art of War (Help)"}),A.jsx("button",{onClick:()=>{Q(!1),W(),me("menu")},style:{...we,color:"#ff5252"},children:a?"Begin a New Chapter":"Abandon Match"}),A.jsxs("button",{onClick:()=>{U(!c),me("menu")},style:{...we,background:c?"#2a1a0a":"#d4af37",color:c?"#d4af37":"#000"},children:["Set to ",c?"Sunrise":"Twilight"]}),A.jsxs("div",{style:{background:"rgba(0,0,0,0.4)",padding:"15px",borderRadius:"4px",marginBottom:"15px",border:"1px solid #d4af37",textAlign:"left"},children:[A.jsx("div",{style:{color:"#d4af37",marginBottom:"10px",fontSize:"14px",textTransform:"uppercase",textAlign:"center"},children:"Customization"}),A.jsxs("div",{style:{marginBottom:"15px"},children:[A.jsx("div",{style:{color:"#f0d9b5",fontSize:"12px",marginBottom:"5px"},children:"Board Style"}),A.jsx("div",{style:{display:"flex",gap:"5px"},children:["wood","stone","marble"].map(Le=>A.jsx("button",{onClick:()=>T(Le),style:{flex:1,padding:"5px",fontSize:"12px",background:y===Le?"#d4af37":"#222",color:y===Le?"#000":"#d4af37",border:"1px solid #d4af37",cursor:"pointer",textTransform:"capitalize"},children:Le},Le))})]}),A.jsx("div",{style:{marginBottom:"15px"},children:A.jsx("button",{onClick:()=>{L(!C),me("menu")},style:{width:"100%",padding:"8px",fontSize:"12px",background:C?"#d4af37":"#222",color:C?"#000":"#d4af37",border:"1px solid #d4af37",cursor:"pointer",pointerEvents:"auto"},children:C?"📍 Coordinates: Visible":"📍 Coordinates: Hidden"})}),A.jsxs("div",{style:{marginBottom:"15px"},children:[A.jsx("div",{style:{color:"#f0d9b5",fontSize:"12px",marginBottom:"5px"},children:"Team Colors"}),A.jsxs("div",{style:{display:"flex",gap:"10px",alignItems:"center"},children:[A.jsxs("div",{style:{flex:1},children:[A.jsx("div",{style:{fontSize:"10px",color:"#aaa"},children:"White"}),A.jsx("input",{type:"color",value:_,onChange:Le=>R(Le.target.value),style:{width:"100%",height:"30px",border:"1px solid #d4af37",background:"none",cursor:"pointer",pointerEvents:"auto"}})]}),A.jsxs("div",{style:{flex:1},children:[A.jsx("div",{style:{fontSize:"10px",color:"#aaa"},children:"Black"}),A.jsx("input",{type:"color",value:S,onChange:Le=>I(Le.target.value),style:{width:"100%",height:"30px",border:"1px solid #d4af37",background:"none",cursor:"pointer",pointerEvents:"auto"}})]})]})]}),A.jsxs("div",{style:{marginBottom:"15px"},children:[A.jsxs("div",{style:{color:"#f0d9b5",fontSize:"12px",marginBottom:"5px"},children:["Wind Power: ",x.toFixed(1),"x"]}),A.jsx("input",{type:"range",min:"0.1",max:"3.0",step:"0.1",value:x,onChange:Le=>E(parseFloat(Le.target.value)),style:{width:"100%",pointerEvents:"auto"}})]}),A.jsxs("div",{style:{borderTop:"1px solid rgba(212, 175, 55, 0.3)",paddingTop:"10px",marginTop:"10px"},children:[A.jsx("div",{style:{color:"#d4af37",marginBottom:"10px",fontSize:"14px",textTransform:"uppercase",textAlign:"center"},children:"Audio Chronicles"}),A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px",marginBottom:"10px"},children:[A.jsx("button",{onClick:()=>ae(!xe),style:{background:xe?"#f44336":"#4caf50",color:"#fff",border:"1px solid #fff",borderRadius:"4px",padding:"4px 8px",cursor:"pointer",fontSize:"12px",pointerEvents:"auto"},children:xe?"🔇 Muted":"🔊 Active"}),A.jsx("div",{style:{flex:1,display:"flex",alignItems:"center"},children:A.jsx("input",{type:"range",min:"0",max:"1",step:"0.05",value:oe,onChange:Le=>he(parseFloat(Le.target.value)),style:{width:"100%",pointerEvents:"auto"}})})]})]}),A.jsxs("div",{style:{borderTop:"1px solid rgba(212, 175, 55, 0.3)",paddingTop:"10px",marginTop:"10px"},children:[A.jsx("div",{style:{color:"#d4af37",marginBottom:"10px",fontSize:"14px",textTransform:"uppercase",textAlign:"center"},children:"Mist Density"}),A.jsxs("div",{style:{display:"flex",alignItems:"center",color:"#f0d9b5",fontSize:"14px"},children:[A.jsxs("span",{style:{width:"80px"},children:["Near: ",h]}),A.jsx("input",{type:"range",min:"0",max:"50",step:"1",value:h,onChange:Le=>F(parseInt(Le.target.value)),style:{flex:1,pointerEvents:"auto"}})]}),A.jsxs("div",{style:{display:"flex",alignItems:"center",color:"#f0d9b5",fontSize:"14px",marginTop:"5px"},children:[A.jsxs("span",{style:{width:"80px"},children:["Far: ",p]}),A.jsx("input",{type:"range",min:"10",max:"200",step:"1",value:p,onChange:Le=>P(parseInt(Le.target.value)),style:{flex:1,pointerEvents:"auto"}})]})]})]})]})}),t&&A.jsxs("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",...Ae,borderWidth:"4px",borderColor:t.success?"#4caf50":"#f44336",borderRadius:"16px",padding:"30px 50px",textAlign:"center",animation:"popInScale 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275)",zIndex:5,minWidth:"450px",pointerEvents:"auto"},children:[A.jsx("h1",{style:{fontSize:"48px",margin:"0 0 20px 0",color:t.success?"#4caf50":"#f44336",textShadow:"2px 2px 0px #000",textTransform:"uppercase"},children:t.success?`${t.attackerColor}'s Victory`:`${t.attackerColor==="white"?"black":"white"}'s Victory`}),A.jsx("div",{style:{marginBottom:"25px",padding:"20px",background:"rgba(0,0,0,0.5)",borderRadius:"8px",border:"1px solid #d4af37"},children:t.isSiege?A.jsxs("div",{style:{fontSize:"22px",color:"#ff5722"},children:["Siege Onslaught: ",A.jsxs("strong",{children:[t.attackerTotal," DMG"]})," dealt to defender!"]}):t.isMonk?A.jsxs("div",{style:{fontSize:"22px",color:t.success?"#d4af37":"#f44336"},children:["Monk Ritual: Rolled ",A.jsx("strong",{children:t.attackerRoll})," (Target: ",t.defenderRoll,"+)",A.jsx("br",{}),t.success?"CONVERSION SUCCESSFUL!":"CONVERSION FAILED!"]}):t.isHealer?A.jsx("div",{style:{fontSize:"22px",color:t.success?"#4caf50":"#f44336"},children:t.success?A.jsxs(A.Fragment,{children:["Healer Blessing: Restored ",A.jsxs("strong",{children:[t.attackerTotal," HP"]}),A.jsx("br",{}),"Target HP: ",t.defenderRoll," ➜ ",t.defenderTotal]}):A.jsxs(A.Fragment,{children:["Heal Failed: Rolled ",A.jsx("strong",{children:t.attackerRoll}),A.jsx("br",{}),"(Needs 11+ to restore HP)"]})}):A.jsxs(A.Fragment,{children:[A.jsxs("div",{style:{fontSize:"22px",marginBottom:"12px",color:"#d4af37"},children:["Attacker (D",t.attackerDice,"): ",t.attackerRoll," + ",t.attackerStats," = ",A.jsx("strong",{children:t.attackerTotal})]}),A.jsxs("div",{style:{fontSize:"22px",color:"#f0d9b5"},children:["Defender (D",t.defenderDice,"): ",t.defenderRoll," + ",t.defenderStats," ",t.defenderDebuff>0?`- ${t.defenderDebuff} (Vulnerable)`:""," = ",A.jsx("strong",{children:t.defenderTotal})]})]})}),A.jsx("h2",{style:{fontSize:"24px",margin:"0 0 25px 0",opacity:.9,fontStyle:"italic"},children:t.isSiege?"Brute force from the shadows!":t.isMonk?t.success?"The soul has been swayed!":"Their faith remained unshaken!":t.isHealer?"The wounds begin to close!":t.success?"The objective is secured!":"The onslaught was resisted!"}),A.jsx("button",{onClick:()=>{q(null),me("menu")},style:{...we,width:"180px",margin:"0 auto",background:"rgba(212, 175, 55, 0.2)",fontSize:"16px",padding:"10px"},children:"Continue Saga"})]}),A.jsx("div",{style:{position:"absolute",bottom:"20px",left:"20px"},children:e&&A.jsxs("div",{style:{...Ae,padding:"20px",borderRadius:"8px",border:"3px double #d4af37",minWidth:"220px"},children:[A.jsx("div",{style:{color:"#d4af37",fontSize:"14px",textTransform:"uppercase",letterSpacing:"1px",marginBottom:"5px"},children:"Unit Selected"}),A.jsxs("h3",{style:{margin:"0 0 15px 0",textTransform:"capitalize",fontSize:"24px",borderBottom:"1px solid rgba(212, 175, 55, 0.3)",paddingBottom:"5px"},children:[e.color," ",e.type]}),A.jsxs("div",{style:{fontSize:"18px",display:"flex",flexDirection:"column",gap:"8px"},children:[A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[A.jsx("span",{style:{fontSize:"24px"},children:"🎲"})," ",A.jsxs("span",{children:["Dice: ",A.jsxs("strong",{children:["D",e.type==="pawn"?6:e.type==="knight"?10:e.type==="bishop"?12:e.type==="rook"?15:e.type==="queen"?18:20]})]})]}),A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[A.jsx("span",{style:{fontSize:"24px"},children:"⚔️"})," ",A.jsxs("span",{children:["Veteran Kills: ",A.jsx("strong",{children:e.kills})," ",e.kills>=5&&A.jsx("small",{style:{color:"#4caf50",fontSize:"12px"},children:"(MAX)"})]})]}),A.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[A.jsx("span",{style:{fontSize:"24px"},children:"🛡️"})," ",A.jsxs("span",{children:["Walls Defended: ",A.jsx("strong",{children:e.defends})," ",e.defends>=5&&A.jsx("small",{style:{color:"#4caf50",fontSize:"12px"},children:"(MAX)"})]})]}),e.isDebuffed&&A.jsxs("div",{style:{marginTop:"5px",color:"#ff5252",fontSize:"14px",fontWeight:"bold",display:"flex",alignItems:"center",gap:"5px"},children:[A.jsx("span",{style:{fontSize:"18px"},children:"⚠️"})," VULNERABLE (-2 DEF)"]})]})]})}),A.jsxs("div",{style:{position:"absolute",bottom:"20px",right:"20px",width:"380px",height:"240px",...Ae,borderRadius:"8px",display:"flex",flexDirection:"column",pointerEvents:"auto",overflow:"hidden"},children:[A.jsxs("div",{style:{background:"#2a1a0a",padding:"10px 20px",fontSize:"16px",fontWeight:"bold",color:"#d4af37",textTransform:"uppercase",borderBottom:"2px solid #d4af37",display:"flex",justifyContent:"space-between",letterSpacing:"1px"},children:[A.jsx("span",{children:"📜 War Chronicles"}),A.jsxs("span",{style:{opacity:.6,fontSize:"12px"},children:[m.length," Deeds"]})]}),A.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"15px",fontSize:"14px",display:"flex",flexDirection:"column-reverse",gap:"8px",scrollbarWidth:"thin"},children:[m.map(Le=>A.jsxs("div",{style:{color:Ne(Le.type),padding:"6px 10px",background:"rgba(212, 175, 55, 0.05)",borderRadius:"2px",borderLeft:`4px solid ${Ne(Le.type)}`},children:[A.jsxs("span",{style:{opacity:.5,marginRight:"10px",fontSize:"11px"},children:["[",new Date(Le.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),"]"]}),A.jsx("strong",{children:je(Le.type)})," ",Le.message]},Le.id)),m.length===0&&A.jsx("div",{style:{color:"#666",textAlign:"center",marginTop:"70px",fontStyle:"italic"},children:"The history is yet to be written..."})]})]}),A.jsx("style",{children:` + @keyframes popIn { + 0% { transform: scale(0.8); opacity: 0; } + 100% { transform: scale(1); opacity: 1; } + } + @keyframes popInScale { + 0% { transform: translate(-50%, -50%) scale(0.7); opacity: 0; } + 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } + } + ::-webkit-scrollbar { width: 6px; } + ::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); } + ::-webkit-scrollbar-thumb { background: #d4af37; border-radius: 3px; } + `})]})},P2=({attackerRoll:s,attackerStats:e,attackerDice:t,defenderRoll:n,defenderStats:i,defenderDice:a,defenderDebuff:c,isSiege:f,isMonk:h,isHealer:p,isRolling:m})=>{const y=Ce.useRef(null),x=Ce.useRef(null),[_,S]=Ce.useState("?"),[C,T]=Ce.useState("?");Ce.useEffect(()=>{if(m){S("?"),T("?");const I=setTimeout(()=>{S(s.toString()),T(n.toString())},1500);return()=>clearTimeout(I)}else S(s.toString()),T(n.toString())},[m,s,n]),ra((I,L)=>{m?(y.current&&(y.current.rotation.x+=L*15,y.current.rotation.y+=L*20),x.current&&!f&&!p&&(x.current.rotation.x-=L*18,x.current.rotation.y-=L*22)):(y.current&&(y.current.rotation.x=so.lerp(y.current.rotation.x,0,L*10),y.current.rotation.y=so.lerp(y.current.rotation.y,0,L*10)),x.current&&(x.current.rotation.x=so.lerp(x.current.rotation.x,0,L*10),x.current.rotation.y=so.lerp(x.current.rotation.y,0,L*10)))});const E=()=>f?"Onager DMG":h?"Monk Roll":p?"Healer Roll":"Attacker",R=()=>h?"Threshold":p?"Current HP":"Defender";return A.jsxs("group",{position:[0,5,0],children:[A.jsxs("group",{position:f?[0,0,0]:[-2,0,0],children:[A.jsx("group",{ref:y,children:A.jsxs("mesh",{castShadow:!0,children:[A.jsx("icosahedronGeometry",{args:[1,0]}),A.jsx("meshStandardMaterial",{color:h||p?"#4caf50":"#d32f2f",roughness:.3,metalness:.1,flatShading:!0})]})}),A.jsxs(xu,{follow:!0,children:[t>0&&!f&&A.jsxs(na,{position:[0,1.2,0],fontSize:.4,color:"white",outlineWidth:.05,outlineColor:"black",children:["D",t]}),A.jsx(xu,{follow:!0,children:A.jsx(na,{position:[0,0,1.1],fontSize:.6,color:"white",anchorX:"center",anchorY:"middle",outlineWidth:.05,outlineColor:"black",children:_})}),A.jsx(na,{position:[0,-1.8,1.1],fontSize:.5,color:h?"#d4af37":p?"#4caf50":"#ff8a80",outlineWidth:.05,outlineColor:"black",children:E()}),!f&&!h&&!p&&A.jsxs(na,{position:[0,-2.5,1.1],fontSize:.6,color:"#ffeb3b",outlineWidth:.08,outlineColor:"black",fontWeight:"bold",children:["+",e," Kills"]})]})]}),!f&&A.jsx(xu,{follow:!0,children:A.jsx(na,{position:[0,0,0],fontSize:.8,color:"white",outlineWidth:.05,outlineColor:"black",children:p?"➜":"VS"})}),!f&&!h&&!p&&A.jsxs("group",{position:[2,0,0],children:[A.jsx("group",{ref:x,children:A.jsxs("mesh",{castShadow:!0,children:[A.jsx("icosahedronGeometry",{args:[1,0]}),A.jsx("meshStandardMaterial",{color:p?"#81c784":"#1976d2",roughness:.3,metalness:.1,flatShading:!0})]})}),A.jsxs(xu,{follow:!0,children:[a>0&&A.jsxs(na,{position:[0,1.2,0],fontSize:.4,color:"white",outlineWidth:.05,outlineColor:"black",children:["D",a]}),A.jsxs(xu,{follow:!0,children:[A.jsx(na,{position:[0,0,1.1],fontSize:.6,color:"#82b1ff",anchorX:"center",anchorY:"middle",outlineWidth:.05,outlineColor:"black",children:C})," "]}),A.jsx(na,{position:[0,-1.8,1.1],fontSize:.5,color:p?"#81c784":"#82b1ff",outlineWidth:.05,outlineColor:"black",children:R()}),!h&&!p&&A.jsxs(na,{position:[0,-2.5,1.1],fontSize:.6,color:"#ffeb3b",outlineWidth:.08,outlineColor:"black",fontWeight:"bold",children:["+",i," Defends"]}),c>0&&!h&&!p&&A.jsxs(na,{position:[0,-3.2,1.1],fontSize:.4,color:"#ff5252",outlineWidth:.05,outlineColor:"black",fontWeight:"bold",children:["- ",c," VULNERABLE"]})]})]}),(h||p)&&A.jsx("group",{position:[2,0,0],children:A.jsxs(xu,{follow:!0,children:[A.jsx(na,{position:[0,0,1.1],fontSize:1.2,color:"#82b1ff",anchorX:"center",anchorY:"middle",outlineWidth:.08,outlineColor:"black",children:h?`${n}+`:C}),A.jsx(na,{position:[0,-1.8,1.1],fontSize:.5,color:p?"#81c784":"#d4af37",outlineWidth:.05,outlineColor:"black",children:R()})]})})]})},F2=({index:s,color:e,direction:t})=>{const n=Ce.useRef(null),i=(Math.random()-.5)*8,a=15,c=t===1?-15:15,f=(Math.random()-.5)*8,h=0,p=t===1?-3.5+Math.random()*3:3.5-Math.random()*3;return ra(m=>{if(n.current){const y=(m.clock.getElapsedTime()*1.5+s*.1)%2;y<1?(n.current.position.x=so.lerp(i,f,y),n.current.position.y=so.lerp(a,h,Math.pow(y,2)),n.current.position.z=so.lerp(c,p,y),n.current.rotation.x+=.1,n.current.visible=!0):n.current.visible=!1}}),A.jsxs("mesh",{ref:n,castShadow:!0,children:[A.jsx("icosahedronGeometry",{args:[.4,0]}),A.jsx("meshStandardMaterial",{color:e,emissive:e,emissiveIntensity:1})]})},z2=({battleResult:s,isRolling:e,isSiegeFiring:t})=>{const n=Ce.useRef(null);return ra(i=>{if(e&&n.current){const a=i.clock.getElapsedTime();n.current.rotation.z=Math.sin(a*30)*.3,n.current.rotation.y=a*2,n.current.position.y=1+Math.sin(a*15)*.1}}),A.jsxs(A.Fragment,{children:[t&&A.jsxs("group",{children:[Array.from({length:12}).map((i,a)=>A.jsx(F2,{index:a,color:"#ff5722",direction:t==="white"?1:-1},a)),A.jsx("group",{position:[0,.5,t==="white"?-2:2],children:A.jsx(Dl,{count:100,scale:[8,1,4],size:10,speed:5,color:"#ff9800"})})]}),s&&A.jsx("group",{position:[s.targetX-3.5,.5,s.targetY-3.5],children:e&&A.jsxs("group",{children:[A.jsx(Dl,{count:60,scale:2,size:6,speed:3,opacity:.8,color:"#ffeb3b"}),A.jsx(Dl,{count:40,scale:1.5,size:8,speed:4,opacity:.8,color:"#ff5722"}),A.jsxs("group",{ref:n,position:[0,1,0],children:[A.jsxs("mesh",{position:[-.3,.2,0],rotation:[0,0,-Math.PI/4],children:[A.jsx("cylinderGeometry",{args:[.04,.04,1.2,8]}),A.jsx("meshStandardMaterial",{color:"#e0e0e0",metalness:.9,roughness:.1})]}),A.jsxs("mesh",{position:[-.3,-.4,0],rotation:[0,0,-Math.PI/4],children:[A.jsx("boxGeometry",{args:[.3,.05,.05]}),A.jsx("meshStandardMaterial",{color:"#d32f2f"})]}),A.jsxs("mesh",{position:[.3,.2,0],rotation:[0,0,Math.PI/4],children:[A.jsx("cylinderGeometry",{args:[.04,.04,1.2,8]}),A.jsx("meshStandardMaterial",{color:"#e0e0e0",metalness:.9,roughness:.1})]}),A.jsxs("mesh",{position:[.3,-.4,0],rotation:[0,0,Math.PI/4],children:[A.jsx("boxGeometry",{args:[.3,.05,.05]}),A.jsx("meshStandardMaterial",{color:"#1976d2"})]})]})]})})]})},B2=({controlsRef:s})=>{const{camera:e}=_a(),t=()=>{s.current&&(e.position.set(0,8,-10),s.current.target.set(0,0,0),s.current.update())};return Ce.useEffect(()=>{const n=a=>{a.key.toLowerCase()==="r"&&t()},i=a=>{a.button===1&&t()};return window.addEventListener("keydown",n),window.addEventListener("mousedown",i),()=>{window.removeEventListener("keydown",n),window.removeEventListener("mousedown",i)}},[e,s]),null};function k2(){const s=Ce.useRef(null),{volume:e,setVolume:t,isMuted:n,setIsMuted:i,playSound:a,startMusic:c}=h2(),{pieces:f,turn:h,selectedPieceId:p,battleResult:m,isRolling:y,isPaused:x,winner:_,isNight:S,hasStarted:C,fogNear:T,fogFar:E,logs:R,boardStyle:I,windStrength:L,whiteColor:F,blackColor:P,showCoordinates:z,setBoardStyle:U,setWindStrength:O,setWhiteColor:W,setBlackColor:q,setShowCoordinates:Y,setHasStarted:K,setIsNight:$,setIsPaused:ie,setFogNear:X,setFogFar:te,resetGame:ge,handleSquareClick:ce,handleOnagerClick:fe,setBattleResult:G,isVsAI:Z,setIsVsAI:oe,playerColor:he,setPlayerColor:xe,turnCount:ae,whiteSiegeUsed:de,blackSiegeUsed:me,isSiegeFiring:Ge,fireSiege:ct,selectedOnagerColor:Qe,whiteMonkUsed:$e,blackMonkUsed:bt,selectedMonkColor:Oe,handleMonkClick:Ve,whiteHealerUsed:Pe,blackHealerUsed:it,selectedHealerColor:Q,handleHealerClick:ut}=l2(a),qe=Ce.useMemo(()=>f.find(j=>j.id===p)||null,[f,p]),Ne=Ce.useMemo(()=>qe?Qm(qe,f):[],[qe,f]),je=S?"#050505":"#e0c3a0";return A.jsxs("div",{style:{width:"100vw",height:"100vh",position:"relative"},children:[A.jsxs(f5,{shadows:!0,camera:{position:[0,8,-10],fov:50},children:[A.jsx("color",{attach:"background",args:[je]}),A.jsx("fog",{attach:"fog",args:[je,T,E]}),A.jsx("ambientLight",{intensity:S?.2:.6}),A.jsx("directionalLight",{castShadow:!0,position:[10,20,10],intensity:S?.3:1.5,"shadow-mapSize":[1024,1024]}),S?A.jsx(LT,{sunPosition:[0,-1,-10],turbidity:10,rayleigh:.5}):A.jsx(LT,{sunPosition:[10,20,10],turbidity:.1,rayleigh:.5}),A.jsx(i2,{radius:100,depth:50,count:S?5e3:1e3,factor:4,saturation:0,fade:!0,speed:1}),A.jsx($F,{preset:S?"night":"sunset"}),A.jsx(B2,{controlsRef:s}),A.jsxs("group",{children:[A.jsx(U2,{isNight:S,windStrength:L,whiteSiegeUsed:de,blackSiegeUsed:me,selectedOnagerColor:Qe,whiteColor:F,blackColor:P,onOnagerClick:fe,whiteMonkUsed:$e,blackMonkUsed:bt,selectedMonkColor:Oe,onMonkClick:Ve,whiteHealerUsed:Pe,blackHealerUsed:it,selectedHealerColor:Q,onHealerClick:ut}),A.jsx(p2,{pieces:f,selectedPieceId:p,validMoves:Ne,highlightSquares:Qe?f.filter(j=>j.color!==Qe&&(Qe==="white"?j.y<=3:j.y>=4)).map(j=>({x:j.x,y:j.y})):Oe?f.filter(j=>j.color!==Oe&&j.type!=="king"&&j.type!=="queen"&&(Oe==="white"?j.y<=3:j.y>=4)).map(j=>({x:j.x,y:j.y})):Q?f.filter(j=>j.color===Q&&(Q==="white"?j.y<=3:j.y>=4)).map(j=>({x:j.x,y:j.y})):[],highlightColor:Qe?"#f44336":Oe?"#d4af37":Q?"#4caf50":void 0,onSquareClick:ce,boardStyle:I,showCoordinates:z}),f.map(j=>A.jsx(I2,{piece:j,isSelected:j.id===p,onClick:()=>ce(j.x,j.y),customWhiteColor:F,customBlackColor:P},j.id))]}),A.jsx(z2,{battleResult:m,isRolling:y,isSiegeFiring:Ge}),(y||m)&&m&&A.jsx(P2,{attackerRoll:m.attackerRoll,attackerStats:m.attackerStats,attackerDice:m.attackerDice,defenderRoll:m.defenderRoll,defenderStats:m.defenderStats,defenderDice:m.defenderDice,defenderDebuff:m.defenderDebuff,isSiege:m.isSiege,isMonk:m.isMonk,isHealer:m.isHealer,isRolling:y}),A.jsx(PF,{ref:s,target:[0,0,0],maxPolarAngle:Math.PI/2.2,minDistance:5,maxDistance:40,enabled:!x&&C})]}),A.jsx(O2,{turn:h,selectedPiece:qe,battleResult:y?null:m,pieces:f,isPaused:x,winner:_,isNight:S,hasStarted:C,fogNear:T,fogFar:E,logs:R,boardStyle:I,windStrength:L,whiteColor:F,blackColor:P,showCoordinates:z,setBoardStyle:U,setWindStrength:O,setWhiteColor:W,setBlackColor:q,setShowCoordinates:Y,setFogNear:X,setFogFar:te,setHasStarted:K,setIsNight:$,setIsPaused:ie,resetGame:ge,setBattleResult:G,isVsAI:Z,setIsVsAI:oe,playerColor:he,setPlayerColor:xe,turnCount:ae,whiteSiegeUsed:de,blackSiegeUsed:me,whiteMonkUsed:$e,blackMonkUsed:bt,whiteHealerUsed:Pe,blackHealerUsed:it,selectedOnagerColor:Qe,selectedMonkColor:Oe,selectedHealerColor:Q,fireSiege:ct,volume:e,setVolume:t,isMuted:n,setIsMuted:i,startMusic:c,playSound:a})]})}vC.createRoot(document.getElementById("root")).render(A.jsx(Ce.StrictMode,{children:A.jsx(k2,{})})); diff --git a/banner.png b/banner.png deleted file mode 100644 index 9f0ffb5..0000000 Binary files a/banner.png and /dev/null differ diff --git a/client/public/changelog.json b/changelog.json similarity index 61% rename from client/public/changelog.json rename to changelog.json index 7b08127..ccbd5c7 100644 --- a/client/public/changelog.json +++ b/changelog.json @@ -1,4 +1,30 @@ [ + { + "version": "0.6.0", + "title": "The Faith & Healing Update", + "date": "2026-03-08", + "changes": [ + "New Support Unit: Monk. Deploy from the sidelines to convert non-Royalty units to your side (D20 roll).", + "New Support Unit: Healer. Deploy to restore health to your own units (D16 roll).", + "Model Overhaul: High-detail 3D models for all sideline support units (Monks, Healers, Onagers).", + "AI Wisdom: The AI now strategically employs Monks and Healers to pressure or sustain the frontlines.", + "Green Dice: New dedicated dice color for support actions (Monk/Healer).", + "Support Range: Monks and Healers, like Onagers, are restricted to the nearest 4 rows.", + "Combat Refinement: Support units roll against static thresholds for faster feedback.", + "Tutorial Update: Rules for the new support units have been added to the Chronicles of Battle." + ] + }, + { + "version": "0.5.3", + "title": "Tactical Freedom", + "date": "2026-03-02", + "changes": [ + "Strategic View: Gain the ability to 'View Scene' after winning to inspect the final battlefield.", + "Battle Command: Choose your side (White or Black) when challenging the AI.", + "AI Discipline: Fixed a bug where the AI could fire its catapult and move a piece in the same turn.", + "Operational Fix: 'Abandon Match' now functions correctly from the Pause Menu even after the match concludes." + ] + }, { "version": "0.5.2", "title": "Tactical Insight", diff --git a/client/README.md b/client/README.md deleted file mode 100644 index fa5d357..0000000 --- a/client/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# Castarook - A Strategic Saga - -Castarook is a 3D strategic board game heavily inspired by chess, but with a unique RPG twist. Instead of guaranteed captures, combat is determined by the fate of the dice (D6 to D20) and veteran stats, set within a beautiful, procedural low-poly environment. - -## Features - -- **RPG Combat System:** Every unit has a unique die. Health and damage are persistent. -- **Dynamic 3D Environment:** Procedurally generated terrain, day/night cycle, dynamic lighting, and weather effects. -- **Siege Warfare:** Utilize the powerful Onager once per match to rain destruction on enemy lines. -- **Veterancy:** Units gain kills and defense stats that improve their future dice rolls. -- **AI Opponent:** Play against a strategic AI (Beta) or challenge a friend in local PvP. - -## Tech Stack - -- **Framework:** React 19 + TypeScript -- **Build Tool:** Vite -- **3D Rendering:** Three.js + React Three Fiber (`@react-three/fiber`, `@react-three/drei`) - -## Development Setup - -1. **Install Dependencies** - ```bash - npm install - ``` - -2. **Run the Development Server** - ```bash - npm run dev - ``` - This will start the local server, typically on `http://localhost:5173/`. - -3. **Build for Production** - ```bash - npm run build - ``` - -## Deployment - -This project is configured to be hosted on GitHub Pages. To deploy the latest version: - -```bash -npm run deploy -``` - -*Note: Ensure you have `gh-pages` installed and your `vite.config.ts` base path matches your repository name.* diff --git a/client/eslint.config.js b/client/eslint.config.js deleted file mode 100644 index 5e6b472..0000000 --- a/client/eslint.config.js +++ /dev/null @@ -1,23 +0,0 @@ -import js from '@eslint/js' -import globals from 'globals' -import reactHooks from 'eslint-plugin-react-hooks' -import reactRefresh from 'eslint-plugin-react-refresh' -import tseslint from 'typescript-eslint' -import { defineConfig, globalIgnores } from 'eslint/config' - -export default defineConfig([ - globalIgnores(['dist']), - { - files: ['**/*.{ts,tsx}'], - extends: [ - js.configs.recommended, - tseslint.configs.recommended, - reactHooks.configs.flat.recommended, - reactRefresh.configs.vite, - ], - languageOptions: { - ecmaVersion: 2020, - globals: globals.browser, - }, - }, -]) diff --git a/client/index.html b/client/index.html deleted file mode 100644 index 64fdfdb..0000000 --- a/client/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - Castarook - - -
- - - diff --git a/client/package-lock.json b/client/package-lock.json deleted file mode 100644 index 1e034aa..0000000 --- a/client/package-lock.json +++ /dev/null @@ -1,4485 +0,0 @@ -{ - "name": "client", - "version": "0.5.2", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "client", - "version": "0.5.2", - "dependencies": { - "@react-three/drei": "^10.7.7", - "@react-three/fiber": "^9.5.0", - "react": "^19.2.0", - "react-dom": "^19.2.0", - "three": "^0.183.1" - }, - "devDependencies": { - "@eslint/js": "^9.39.1", - "@types/node": "^24.10.1", - "@types/react": "^19.2.7", - "@types/react-dom": "^19.2.3", - "@types/three": "^0.183.1", - "@vitejs/plugin-react": "^5.1.1", - "eslint": "^9.39.1", - "eslint-plugin-react-hooks": "^7.0.1", - "eslint-plugin-react-refresh": "^0.4.24", - "gh-pages": "^6.3.0", - "globals": "^16.5.0", - "typescript": "~5.9.3", - "typescript-eslint": "^8.48.0", - "vite": "^7.3.1" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", - "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.28.5", - "js-tokens": "^4.0.0", - "picocolors": "^1.1.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.0.tgz", - "integrity": "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz", - "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.29.0", - "@babel/generator": "^7.29.0", - "@babel/helper-compilation-targets": "^7.28.6", - "@babel/helper-module-transforms": "^7.28.6", - "@babel/helpers": "^7.28.6", - "@babel/parser": "^7.29.0", - "@babel/template": "^7.28.6", - "@babel/traverse": "^7.29.0", - "@babel/types": "^7.29.0", - "@jridgewell/remapping": "^2.3.5", - "convert-source-map": "^2.0.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.3", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/generator": { - "version": "7.29.1", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.1.tgz", - "integrity": "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.29.0", - "@babel/types": "^7.29.0", - "@jridgewell/gen-mapping": "^0.3.12", - "@jridgewell/trace-mapping": "^0.3.28", - "jsesc": "^3.0.2" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz", - "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.28.6", - "@babel/helper-validator-option": "^7.27.1", - "browserslist": "^4.24.0", - "lru-cache": "^5.1.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-globals": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", - "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz", - "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.28.6", - "@babel/types": "^7.28.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz", - "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-imports": "^7.28.6", - "@babel/helper-validator-identifier": "^7.28.5", - "@babel/traverse": "^7.28.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.28.6.tgz", - "integrity": "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", - "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.6.tgz", - "integrity": "sha512-xOBvwq86HHdB7WUDTfKfT/Vuxh7gElQ+Sfti2Cy6yIWNW05P8iUslOVcZ4/sKbE+/jQaukQAdz/gf3724kYdqw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.28.6", - "@babel/types": "^7.28.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.0.tgz", - "integrity": "sha512-IyDgFV5GeDUVX4YdF/3CPULtVGSXXMLh1xVIgdCgxApktqnQV0r7/8Nqthg+8YLGaAtdyIlo2qIdZrbCv4+7ww==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.29.0" - }, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx-self": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.27.1.tgz", - "integrity": "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx-source": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.27.1.tgz", - "integrity": "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/runtime": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.6.tgz", - "integrity": "sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA==", - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/template": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz", - "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.28.6", - "@babel/parser": "^7.28.6", - "@babel/types": "^7.28.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.0.tgz", - "integrity": "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.29.0", - "@babel/generator": "^7.29.0", - "@babel/helper-globals": "^7.28.0", - "@babel/parser": "^7.29.0", - "@babel/template": "^7.28.6", - "@babel/types": "^7.29.0", - "debug": "^4.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/types": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", - "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@dimforge/rapier3d-compat": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/@dimforge/rapier3d-compat/-/rapier3d-compat-0.12.0.tgz", - "integrity": "sha512-uekIGetywIgopfD97oDL5PfeezkFpNhwlzlaEYNOA0N6ghdsOvh/HYjSMek5Q2O1PYvRSDFcqFVJl4r4ZBwOow==", - "license": "Apache-2.0" - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", - "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", - "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", - "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", - "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", - "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", - "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", - "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", - "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", - "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", - "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", - "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", - "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", - "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", - "cpu": [ - "mips64el" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", - "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", - "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", - "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", - "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", - "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", - "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", - "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", - "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", - "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", - "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", - "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", - "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", - "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@eslint-community/eslint-utils": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz", - "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "eslint-visitor-keys": "^3.4.3" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" - } - }, - "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", - "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint-community/regexpp": { - "version": "4.12.2", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", - "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.0.0 || ^14.0.0 || >=16.0.0" - } - }, - "node_modules/@eslint/config-array": { - "version": "0.21.1", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz", - "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@eslint/object-schema": "^2.1.7", - "debug": "^4.3.1", - "minimatch": "^3.1.2" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/config-helpers": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", - "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@eslint/core": "^0.17.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/core": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", - "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@types/json-schema": "^7.0.15" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.4.tgz", - "integrity": "sha512-4h4MVF8pmBsncB60r0wSJiIeUKTSD4m7FmTFThG8RHlsg9ajqckLm9OraguFGZE4vVdpiI1Q4+hFnisopmG6gQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.14.0", - "debug": "^4.3.2", - "espree": "^10.0.1", - "globals": "^14.0.0", - "ignore": "^5.2.0", - "import-fresh": "^3.2.1", - "js-yaml": "^4.1.1", - "minimatch": "^3.1.3", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", - "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@eslint/js": { - "version": "9.39.3", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.3.tgz", - "integrity": "sha512-1B1VkCq6FuUNlQvlBYb+1jDu/gV297TIs/OeiaSR9l1H27SVW55ONE1e1Vp16NqP683+xEGzxYtv4XCiDPaQiw==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://eslint.org/donate" - } - }, - "node_modules/@eslint/object-schema": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz", - "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@eslint/plugin-kit": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz", - "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@eslint/core": "^0.17.0", - "levn": "^0.4.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/@humanfs/core": { - "version": "0.19.1", - "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", - "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/@humanfs/node": { - "version": "0.16.7", - "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz", - "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@humanfs/core": "^0.19.1", - "@humanwhocodes/retry": "^0.4.0" - }, - "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/@humanwhocodes/module-importer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", - "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=12.22" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@humanwhocodes/retry": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", - "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=18.18" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.13", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", - "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/remapping": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", - "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", - "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", - "dev": true, - "license": "MIT" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.31", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", - "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@mediapipe/tasks-vision": { - "version": "0.10.17", - "resolved": "https://registry.npmjs.org/@mediapipe/tasks-vision/-/tasks-vision-0.10.17.tgz", - "integrity": "sha512-CZWV/q6TTe8ta61cZXjfnnHsfWIdFhms03M9T7Cnd5y2mdpylJM0rF1qRq+wsQVRMLz1OYPVEBU9ph2Bx8cxrg==", - "license": "Apache-2.0" - }, - "node_modules/@monogrid/gainmap-js": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/@monogrid/gainmap-js/-/gainmap-js-3.4.0.tgz", - "integrity": "sha512-2Z0FATFHaoYJ8b+Y4y4Hgfn3FRFwuU5zRrk+9dFWp4uGAdHGqVEdP7HP+gLA3X469KXHmfupJaUbKo1b/aDKIg==", - "license": "MIT", - "dependencies": { - "promise-worker-transferable": "^1.0.4" - }, - "peerDependencies": { - "three": ">= 0.159.0" - } - }, - "node_modules/@nodelib/fs.scandir": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", - "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "2.0.5", - "run-parallel": "^1.1.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.stat": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, - "node_modules/@nodelib/fs.walk": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", - "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.scandir": "2.1.5", - "fastq": "^1.6.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@react-three/drei": { - "version": "10.7.7", - "resolved": "https://registry.npmjs.org/@react-three/drei/-/drei-10.7.7.tgz", - "integrity": "sha512-ff+J5iloR0k4tC++QtD/j9u3w5fzfgFAWDtAGQah9pF2B1YgOq/5JxqY0/aVoQG5r3xSZz0cv5tk2YuBob4xEQ==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.26.0", - "@mediapipe/tasks-vision": "0.10.17", - "@monogrid/gainmap-js": "^3.0.6", - "@use-gesture/react": "^10.3.1", - "camera-controls": "^3.1.0", - "cross-env": "^7.0.3", - "detect-gpu": "^5.0.56", - "glsl-noise": "^0.0.0", - "hls.js": "^1.5.17", - "maath": "^0.10.8", - "meshline": "^3.3.1", - "stats-gl": "^2.2.8", - "stats.js": "^0.17.0", - "suspend-react": "^0.1.3", - "three-mesh-bvh": "^0.8.3", - "three-stdlib": "^2.35.6", - "troika-three-text": "^0.52.4", - "tunnel-rat": "^0.1.2", - "use-sync-external-store": "^1.4.0", - "utility-types": "^3.11.0", - "zustand": "^5.0.1" - }, - "peerDependencies": { - "@react-three/fiber": "^9.0.0", - "react": "^19", - "react-dom": "^19", - "three": ">=0.159" - }, - "peerDependenciesMeta": { - "react-dom": { - "optional": true - } - } - }, - "node_modules/@react-three/fiber": { - "version": "9.5.0", - "resolved": "https://registry.npmjs.org/@react-three/fiber/-/fiber-9.5.0.tgz", - "integrity": "sha512-FiUzfYW4wB1+PpmsE47UM+mCads7j2+giRBltfwH7SNhah95rqJs3ltEs9V3pP8rYdS0QlNne+9Aj8dS/SiaIA==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.17.8", - "@types/webxr": "*", - "base64-js": "^1.5.1", - "buffer": "^6.0.3", - "its-fine": "^2.0.0", - "react-use-measure": "^2.1.7", - "scheduler": "^0.27.0", - "suspend-react": "^0.1.3", - "use-sync-external-store": "^1.4.0", - "zustand": "^5.0.3" - }, - "peerDependencies": { - "expo": ">=43.0", - "expo-asset": ">=8.4", - "expo-file-system": ">=11.0", - "expo-gl": ">=11.0", - "react": ">=19 <19.3", - "react-dom": ">=19 <19.3", - "react-native": ">=0.78", - "three": ">=0.156" - }, - "peerDependenciesMeta": { - "expo": { - "optional": true - }, - "expo-asset": { - "optional": true - }, - "expo-file-system": { - "optional": true - }, - "expo-gl": { - "optional": true - }, - "react-dom": { - "optional": true - }, - "react-native": { - "optional": true - } - } - }, - "node_modules/@rolldown/pluginutils": { - "version": "1.0.0-rc.3", - "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.3.tgz", - "integrity": "sha512-eybk3TjzzzV97Dlj5c+XrBFW57eTNhzod66y9HrBlzJ6NsCrWCp/2kaPS3K9wJmurBC0Tdw4yPjXKZqlznim3Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz", - "integrity": "sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.59.0.tgz", - "integrity": "sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.59.0.tgz", - "integrity": "sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.59.0.tgz", - "integrity": "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.59.0.tgz", - "integrity": "sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.59.0.tgz", - "integrity": "sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.59.0.tgz", - "integrity": "sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.59.0.tgz", - "integrity": "sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.59.0.tgz", - "integrity": "sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.59.0.tgz", - "integrity": "sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.59.0.tgz", - "integrity": "sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.59.0.tgz", - "integrity": "sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.59.0.tgz", - "integrity": "sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.59.0.tgz", - "integrity": "sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.59.0.tgz", - "integrity": "sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.59.0.tgz", - "integrity": "sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.59.0.tgz", - "integrity": "sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.59.0.tgz", - "integrity": "sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.59.0.tgz", - "integrity": "sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.59.0.tgz", - "integrity": "sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ] - }, - "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.59.0.tgz", - "integrity": "sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.59.0.tgz", - "integrity": "sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.59.0.tgz", - "integrity": "sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.59.0.tgz", - "integrity": "sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.59.0.tgz", - "integrity": "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@tweenjs/tween.js": { - "version": "23.1.3", - "resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-23.1.3.tgz", - "integrity": "sha512-vJmvvwFxYuGnF2axRtPYocag6Clbb5YS7kLL+SO/TeVFzHqDIWrNKYtcsPMibjDx9O+bu+psAy9NKfWklassUA==", - "license": "MIT" - }, - "node_modules/@types/babel__core": { - "version": "7.20.5", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", - "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "node_modules/@types/babel__generator": { - "version": "7.27.0", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", - "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__template": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", - "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__traverse": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", - "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.28.2" - } - }, - "node_modules/@types/draco3d": { - "version": "1.4.10", - "resolved": "https://registry.npmjs.org/@types/draco3d/-/draco3d-1.4.10.tgz", - "integrity": "sha512-AX22jp8Y7wwaBgAixaSvkoG4M/+PlAcm3Qs4OW8yT9DM4xUpWKeFhLueTAyZF39pviAdcDdeJoACapiAceqNcw==", - "license": "MIT" - }, - "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/node": { - "version": "24.10.15", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.15.tgz", - "integrity": "sha512-BgjLoRuSr0MTI5wA6gMw9Xy0sFudAaUuvrnjgGx9wZ522fYYLA5SYJ+1Y30vTcJEG+DRCyDHx/gzQVfofYzSdg==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~7.16.0" - } - }, - "node_modules/@types/offscreencanvas": { - "version": "2019.7.3", - "resolved": "https://registry.npmjs.org/@types/offscreencanvas/-/offscreencanvas-2019.7.3.tgz", - "integrity": "sha512-ieXiYmgSRXUDeOntE1InxjWyvEelZGP63M+cGuquuRLuIKKT1osnkXjxev9B7d1nXSug5vpunx+gNlbVxMlC9A==", - "license": "MIT" - }, - "node_modules/@types/react": { - "version": "19.2.14", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz", - "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==", - "license": "MIT", - "dependencies": { - "csstype": "^3.2.2" - } - }, - "node_modules/@types/react-dom": { - "version": "19.2.3", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", - "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "@types/react": "^19.2.0" - } - }, - "node_modules/@types/react-reconciler": { - "version": "0.28.9", - "resolved": "https://registry.npmjs.org/@types/react-reconciler/-/react-reconciler-0.28.9.tgz", - "integrity": "sha512-HHM3nxyUZ3zAylX8ZEyrDNd2XZOnQ0D5XfunJF5FLQnZbHHYq4UWvW1QfelQNXv1ICNkwYhfxjwfnqivYB6bFg==", - "license": "MIT", - "peerDependencies": { - "@types/react": "*" - } - }, - "node_modules/@types/stats.js": { - "version": "0.17.4", - "resolved": "https://registry.npmjs.org/@types/stats.js/-/stats.js-0.17.4.tgz", - "integrity": "sha512-jIBvWWShCvlBqBNIZt0KAshWpvSjhkwkEu4ZUcASoAvhmrgAUI2t1dXrjSL4xXVLB4FznPrIsX3nKXFl/Dt4vA==", - "license": "MIT" - }, - "node_modules/@types/three": { - "version": "0.183.1", - "resolved": "https://registry.npmjs.org/@types/three/-/three-0.183.1.tgz", - "integrity": "sha512-f2Pu5Hrepfgavttdye3PsH5RWyY/AvdZQwIVhrc4uNtvF7nOWJacQKcoVJn0S4f0yYbmAE6AR+ve7xDcuYtMGw==", - "license": "MIT", - "dependencies": { - "@dimforge/rapier3d-compat": "~0.12.0", - "@tweenjs/tween.js": "~23.1.3", - "@types/stats.js": "*", - "@types/webxr": ">=0.5.17", - "@webgpu/types": "*", - "fflate": "~0.8.2", - "meshoptimizer": "~1.0.1" - } - }, - "node_modules/@types/webxr": { - "version": "0.5.24", - "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.24.tgz", - "integrity": "sha512-h8fgEd/DpoS9CBrjEQXR+dIDraopAEfu4wYVNY2tEPwk60stPWhvZMf4Foo5FakuQ7HFZoa8WceaWFervK2Ovg==", - "license": "MIT" - }, - "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.56.1.tgz", - "integrity": "sha512-Jz9ZztpB37dNC+HU2HI28Bs9QXpzCz+y/twHOwhyrIRdbuVDxSytJNDl6z/aAKlaRIwC7y8wJdkBv7FxYGgi0A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/regexpp": "^4.12.2", - "@typescript-eslint/scope-manager": "8.56.1", - "@typescript-eslint/type-utils": "8.56.1", - "@typescript-eslint/utils": "8.56.1", - "@typescript-eslint/visitor-keys": "8.56.1", - "ignore": "^7.0.5", - "natural-compare": "^1.4.0", - "ts-api-utils": "^2.4.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "@typescript-eslint/parser": "^8.56.1", - "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", - "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/@typescript-eslint/parser": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.56.1.tgz", - "integrity": "sha512-klQbnPAAiGYFyI02+znpBRLyjL4/BrBd0nyWkdC0s/6xFLkXYQ8OoRrSkqacS1ddVxf/LDyODIKbQ5TgKAf/Fg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/scope-manager": "8.56.1", - "@typescript-eslint/types": "8.56.1", - "@typescript-eslint/typescript-estree": "8.56.1", - "@typescript-eslint/visitor-keys": "8.56.1", - "debug": "^4.4.3" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/project-service": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.56.1.tgz", - "integrity": "sha512-TAdqQTzHNNvlVFfR+hu2PDJrURiwKsUvxFn1M0h95BB8ah5jejas08jUWG4dBA68jDMI988IvtfdAI53JzEHOQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.56.1", - "@typescript-eslint/types": "^8.56.1", - "debug": "^4.4.3" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/scope-manager": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.56.1.tgz", - "integrity": "sha512-YAi4VDKcIZp0O4tz/haYKhmIDZFEUPOreKbfdAN3SzUDMcPhJ8QI99xQXqX+HoUVq8cs85eRKnD+rne2UAnj2w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "8.56.1", - "@typescript-eslint/visitor-keys": "8.56.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.56.1.tgz", - "integrity": "sha512-qOtCYzKEeyr3aR9f28mPJqBty7+DBqsdd63eO0yyDwc6vgThj2UjWfJIcsFeSucYydqcuudMOprZ+x1SpF3ZuQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/type-utils": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.56.1.tgz", - "integrity": "sha512-yB/7dxi7MgTtGhZdaHCemf7PuwrHMenHjmzgUW1aJpO+bBU43OycnM3Wn+DdvDO/8zzA9HlhaJ0AUGuvri4oGg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "8.56.1", - "@typescript-eslint/typescript-estree": "8.56.1", - "@typescript-eslint/utils": "8.56.1", - "debug": "^4.4.3", - "ts-api-utils": "^2.4.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/types": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.56.1.tgz", - "integrity": "sha512-dbMkdIUkIkchgGDIv7KLUpa0Mda4IYjo4IAMJUZ+3xNoUXxMsk9YtKpTHSChRS85o+H9ftm51gsK1dZReY9CVw==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.56.1.tgz", - "integrity": "sha512-qzUL1qgalIvKWAf9C1HpvBjif+Vm6rcT5wZd4VoMb9+Km3iS3Cv9DY6dMRMDtPnwRAFyAi7YXJpTIEXLvdfPxg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/project-service": "8.56.1", - "@typescript-eslint/tsconfig-utils": "8.56.1", - "@typescript-eslint/types": "8.56.1", - "@typescript-eslint/visitor-keys": "8.56.1", - "debug": "^4.4.3", - "minimatch": "^10.2.2", - "semver": "^7.7.3", - "tinyglobby": "^0.2.15", - "ts-api-utils": "^2.4.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/balanced-match": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", - "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "18 || 20 || >=22" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.3.tgz", - "integrity": "sha512-fy6KJm2RawA5RcHkLa1z/ScpBeA762UF9KmZQxwIbDtRJrgLzM10depAiEQ+CXYcoiqW1/m96OAAoke2nE9EeA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^4.0.2" - }, - "engines": { - "node": "18 || 20 || >=22" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { - "version": "10.2.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", - "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "brace-expansion": "^5.0.2" - }, - "engines": { - "node": "18 || 20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", - "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@typescript-eslint/utils": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.56.1.tgz", - "integrity": "sha512-HPAVNIME3tABJ61siYlHzSWCGtOoeP2RTIaHXFMPqjrQKCGB9OgUVdiNgH7TJS2JNIQ5qQ4RsAUDuGaGme/KOA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/eslint-utils": "^4.9.1", - "@typescript-eslint/scope-manager": "8.56.1", - "@typescript-eslint/types": "8.56.1", - "@typescript-eslint/typescript-estree": "8.56.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.56.1.tgz", - "integrity": "sha512-KiROIzYdEV85YygXw6BI/Dx4fnBlFQu6Mq4QE4MOH9fFnhohw6wX/OAvDY2/C+ut0I3RSPKenvZJIVYqJNkhEw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "8.56.1", - "eslint-visitor-keys": "^5.0.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", - "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^20.19.0 || ^22.13.0 || >=24" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/@use-gesture/core": { - "version": "10.3.1", - "resolved": "https://registry.npmjs.org/@use-gesture/core/-/core-10.3.1.tgz", - "integrity": "sha512-WcINiDt8WjqBdUXye25anHiNxPc0VOrlT8F6LLkU6cycrOGUDyY/yyFmsg3k8i5OLvv25llc0QC45GhR/C8llw==", - "license": "MIT" - }, - "node_modules/@use-gesture/react": { - "version": "10.3.1", - "resolved": "https://registry.npmjs.org/@use-gesture/react/-/react-10.3.1.tgz", - "integrity": "sha512-Yy19y6O2GJq8f7CHf7L0nxL8bf4PZCPaVOCgJrusOeFHY1LvHgYXnmnXg6N5iwAnbgbZCDjo60SiM6IPJi9C5g==", - "license": "MIT", - "dependencies": { - "@use-gesture/core": "10.3.1" - }, - "peerDependencies": { - "react": ">= 16.8.0" - } - }, - "node_modules/@vitejs/plugin-react": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-5.1.4.tgz", - "integrity": "sha512-VIcFLdRi/VYRU8OL/puL7QXMYafHmqOnwTZY50U1JPlCNj30PxCMx65c494b1K9be9hX83KVt0+gTEwTWLqToA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.29.0", - "@babel/plugin-transform-react-jsx-self": "^7.27.1", - "@babel/plugin-transform-react-jsx-source": "^7.27.1", - "@rolldown/pluginutils": "1.0.0-rc.3", - "@types/babel__core": "^7.20.5", - "react-refresh": "^0.18.0" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "peerDependencies": { - "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" - } - }, - "node_modules/@webgpu/types": { - "version": "0.1.69", - "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.69.tgz", - "integrity": "sha512-RPmm6kgRbI8e98zSD3RVACvnuktIja5+yLgDAkTmxLr90BEwdTXRQWNLF3ETTTyH/8mKhznZuN5AveXYFEsMGQ==", - "license": "BSD-3-Clause" - }, - "node_modules/acorn": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", - "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", - "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/ajv": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.14.0.tgz", - "integrity": "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true, - "license": "Python-2.0" - }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/async": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", - "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", - "dev": true, - "license": "MIT" - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/baseline-browser-mapping": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.0.tgz", - "integrity": "sha512-lIyg0szRfYbiy67j9KN8IyeD7q7hcmqnJ1ddWmNt19ItGpNN64mnllmxUNFIOdOm6by97jlL6wfpTTJrmnjWAA==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "baseline-browser-mapping": "dist/cli.cjs" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/bidi-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.0.3.tgz", - "integrity": "sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==", - "license": "MIT", - "dependencies": { - "require-from-string": "^2.0.2" - } - }, - "node_modules/brace-expansion": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", - "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "license": "MIT", - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/browserslist": { - "version": "4.28.1", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz", - "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "baseline-browser-mapping": "^2.9.0", - "caniuse-lite": "^1.0.30001759", - "electron-to-chromium": "^1.5.263", - "node-releases": "^2.0.27", - "update-browserslist-db": "^1.2.0" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/camera-controls": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/camera-controls/-/camera-controls-3.1.2.tgz", - "integrity": "sha512-xkxfpG2ECZ6Ww5/9+kf4mfg1VEYAoe9aDSY+IwF0UEs7qEzwy0aVRfs2grImIECs/PoBtWFrh7RXsQkwG922JA==", - "license": "MIT", - "engines": { - "node": ">=22.0.0", - "npm": ">=10.5.1" - }, - "peerDependencies": { - "three": ">=0.126.1" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001774", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001774.tgz", - "integrity": "sha512-DDdwPGz99nmIEv216hKSgLD+D4ikHQHjBC/seF98N9CPqRX4M5mSxT9eTV6oyisnJcuzxtZy4n17yKKQYmYQOA==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "CC-BY-4.0" - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, - "node_modules/commander": { - "version": "13.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz", - "integrity": "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "node_modules/commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", - "dev": true, - "license": "MIT" - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true, - "license": "MIT" - }, - "node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true, - "license": "MIT" - }, - "node_modules/cross-env": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", - "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", - "license": "MIT", - "dependencies": { - "cross-spawn": "^7.0.1" - }, - "bin": { - "cross-env": "src/bin/cross-env.js", - "cross-env-shell": "src/bin/cross-env-shell.js" - }, - "engines": { - "node": ">=10.14", - "npm": ">=6", - "yarn": ">=1" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/csstype": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", - "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", - "license": "MIT" - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/deep-is": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/detect-gpu": { - "version": "5.0.70", - "resolved": "https://registry.npmjs.org/detect-gpu/-/detect-gpu-5.0.70.tgz", - "integrity": "sha512-bqerEP1Ese6nt3rFkwPnGbsUF9a4q+gMmpTVVOEzoCyeCc+y7/RvJnQZJx1JwhgQI5Ntg0Kgat8Uu7XpBqnz1w==", - "license": "MIT", - "dependencies": { - "webgl-constants": "^1.1.1" - } - }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/draco3d": { - "version": "1.5.7", - "resolved": "https://registry.npmjs.org/draco3d/-/draco3d-1.5.7.tgz", - "integrity": "sha512-m6WCKt/erDXcw+70IJXnG7M3awwQPAsZvJGX5zY7beBqpELw6RDGkYVU0W43AFxye4pDZ5i2Lbyc/NNGqwjUVQ==", - "license": "Apache-2.0" - }, - "node_modules/electron-to-chromium": { - "version": "1.5.302", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.302.tgz", - "integrity": "sha512-sM6HAN2LyK82IyPBpznDRqlTQAtuSaO+ShzFiWTvoMJLHyZ+Y39r8VMfHzwbU8MVBzQ4Wdn85+wlZl2TLGIlwg==", - "dev": true, - "license": "ISC" - }, - "node_modules/email-addresses": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/email-addresses/-/email-addresses-5.0.0.tgz", - "integrity": "sha512-4OIPYlA6JXqtVn8zpHpGiI7vE6EQOAg16aGnDMIAlZVinnoZ8208tW1hAbjWydgN/4PLTT9q+O1K6AH/vALJGw==", - "dev": true, - "license": "MIT" - }, - "node_modules/esbuild": { - "version": "0.27.3", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", - "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.3", - "@esbuild/android-arm": "0.27.3", - "@esbuild/android-arm64": "0.27.3", - "@esbuild/android-x64": "0.27.3", - "@esbuild/darwin-arm64": "0.27.3", - "@esbuild/darwin-x64": "0.27.3", - "@esbuild/freebsd-arm64": "0.27.3", - "@esbuild/freebsd-x64": "0.27.3", - "@esbuild/linux-arm": "0.27.3", - "@esbuild/linux-arm64": "0.27.3", - "@esbuild/linux-ia32": "0.27.3", - "@esbuild/linux-loong64": "0.27.3", - "@esbuild/linux-mips64el": "0.27.3", - "@esbuild/linux-ppc64": "0.27.3", - "@esbuild/linux-riscv64": "0.27.3", - "@esbuild/linux-s390x": "0.27.3", - "@esbuild/linux-x64": "0.27.3", - "@esbuild/netbsd-arm64": "0.27.3", - "@esbuild/netbsd-x64": "0.27.3", - "@esbuild/openbsd-arm64": "0.27.3", - "@esbuild/openbsd-x64": "0.27.3", - "@esbuild/openharmony-arm64": "0.27.3", - "@esbuild/sunos-x64": "0.27.3", - "@esbuild/win32-arm64": "0.27.3", - "@esbuild/win32-ia32": "0.27.3", - "@esbuild/win32-x64": "0.27.3" - } - }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint": { - "version": "9.39.3", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.3.tgz", - "integrity": "sha512-VmQ+sifHUbI/IcSopBCF/HO3YiHQx/AVd3UVyYL6weuwW+HvON9VYn5l6Zl1WZzPWXPNZrSQpxwkkZ/VuvJZzg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/eslint-utils": "^4.8.0", - "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.21.1", - "@eslint/config-helpers": "^0.4.2", - "@eslint/core": "^0.17.0", - "@eslint/eslintrc": "^3.3.1", - "@eslint/js": "9.39.3", - "@eslint/plugin-kit": "^0.4.1", - "@humanfs/node": "^0.16.6", - "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.4.2", - "@types/estree": "^1.0.6", - "ajv": "^6.12.4", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.6", - "debug": "^4.3.2", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^8.4.0", - "eslint-visitor-keys": "^4.2.1", - "espree": "^10.4.0", - "esquery": "^1.5.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^8.0.0", - "find-up": "^5.0.0", - "glob-parent": "^6.0.2", - "ignore": "^5.2.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "json-stable-stringify-without-jsonify": "^1.0.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.1.2", - "natural-compare": "^1.4.0", - "optionator": "^0.9.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://eslint.org/donate" - }, - "peerDependencies": { - "jiti": "*" - }, - "peerDependenciesMeta": { - "jiti": { - "optional": true - } - } - }, - "node_modules/eslint-plugin-react-hooks": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.0.1.tgz", - "integrity": "sha512-O0d0m04evaNzEPoSW+59Mezf8Qt0InfgGIBJnpC0h3NH/WjUAR7BIKUfysC6todmtiZ/A0oUVS8Gce0WhBrHsA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.24.4", - "@babel/parser": "^7.24.4", - "hermes-parser": "^0.25.1", - "zod": "^3.25.0 || ^4.0.0", - "zod-validation-error": "^3.5.0 || ^4.0.0" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0" - } - }, - "node_modules/eslint-plugin-react-refresh": { - "version": "0.4.26", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.26.tgz", - "integrity": "sha512-1RETEylht2O6FM/MvgnyvT+8K21wLqDNg4qD51Zj3guhjt433XbnnkVttHMyaVyAFD03QSV4LPS5iE3VQmO7XQ==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "eslint": ">=8.40" - } - }, - "node_modules/eslint-scope": { - "version": "8.4.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", - "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-visitor-keys": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", - "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/espree": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", - "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "acorn": "^8.15.0", - "acorn-jsx": "^5.3.2", - "eslint-visitor-keys": "^4.2.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/esquery": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", - "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-glob": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", - "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.8" - }, - "engines": { - "node": ">=8.6.0" - } - }, - "node_modules/fast-glob/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", - "dev": true, - "license": "MIT" - }, - "node_modules/fastq": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", - "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", - "dev": true, - "license": "ISC", - "dependencies": { - "reusify": "^1.0.4" - } - }, - "node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/fflate": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", - "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", - "license": "MIT" - }, - "node_modules/file-entry-cache": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", - "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "flat-cache": "^4.0.0" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/filename-reserved-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", - "integrity": "sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/filenamify": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-4.3.0.tgz", - "integrity": "sha512-hcFKyUG57yWGAzu1CMt/dPzYZuv+jAJUT85bL8mrXvNe6hWj6yEHEc4EdcgiA6Z3oi1/9wXJdZPXF2dZNgwgOg==", - "dev": true, - "license": "MIT", - "dependencies": { - "filename-reserved-regex": "^2.0.0", - "strip-outer": "^1.0.1", - "trim-repeated": "^1.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, - "license": "MIT", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-cache-dir": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", - "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", - "dev": true, - "license": "MIT", - "dependencies": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/avajs/find-cache-dir?sponsor=1" - } - }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/flat-cache": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", - "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", - "dev": true, - "license": "MIT", - "dependencies": { - "flatted": "^3.2.9", - "keyv": "^4.5.4" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/flatted": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", - "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", - "dev": true, - "license": "ISC" - }, - "node_modules/fs-extra": { - "version": "11.3.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.3.tgz", - "integrity": "sha512-VWSRii4t0AFm6ixFFmLLx1t7wS1gh+ckoa84aOeapGum0h+EZd1EhEumSB+ZdDLnEPuucsVB9oB7cxJHap6Afg==", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=14.14" - } - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/gh-pages": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/gh-pages/-/gh-pages-6.3.0.tgz", - "integrity": "sha512-Ot5lU6jK0Eb+sszG8pciXdjMXdBJ5wODvgjR+imihTqsUWF2K6dJ9HST55lgqcs8wWcw6o6wAsUzfcYRhJPXbA==", - "dev": true, - "license": "MIT", - "dependencies": { - "async": "^3.2.4", - "commander": "^13.0.0", - "email-addresses": "^5.0.0", - "filenamify": "^4.3.0", - "find-cache-dir": "^3.3.1", - "fs-extra": "^11.1.1", - "globby": "^11.1.0" - }, - "bin": { - "gh-pages": "bin/gh-pages.js", - "gh-pages-clean": "bin/gh-pages-clean.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/glob-parent": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", - "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.3" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/globals": { - "version": "16.5.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz", - "integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "license": "MIT", - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/glsl-noise": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/glsl-noise/-/glsl-noise-0.0.0.tgz", - "integrity": "sha512-b/ZCF6amfAUb7dJM/MxRs7AetQEahYzJ8PtgfrmEdtw6uyGOr+ZSGtgjFm6mfsBkxJ4d2W7kg+Nlqzqvn3Bc0w==", - "license": "MIT" - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/hermes-estree": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.25.1.tgz", - "integrity": "sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==", - "dev": true, - "license": "MIT" - }, - "node_modules/hermes-parser": { - "version": "0.25.1", - "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.25.1.tgz", - "integrity": "sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==", - "dev": true, - "license": "MIT", - "dependencies": { - "hermes-estree": "0.25.1" - } - }, - "node_modules/hls.js": { - "version": "1.6.15", - "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.6.15.tgz", - "integrity": "sha512-E3a5VwgXimGHwpRGV+WxRTKeSp2DW5DI5MWv34ulL3t5UNmyJWCQ1KmLEHbYzcfThfXG8amBL+fCYPneGHC4VA==", - "license": "Apache-2.0" - }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "BSD-3-Clause" - }, - "node_modules/ignore": { - "version": "5.3.2", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", - "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/immediate": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", - "license": "MIT" - }, - "node_modules/import-fresh": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", - "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-promise": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", - "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==", - "license": "MIT" - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "license": "ISC" - }, - "node_modules/its-fine": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/its-fine/-/its-fine-2.0.0.tgz", - "integrity": "sha512-KLViCmWx94zOvpLwSlsx6yOCeMhZYaxrJV87Po5k/FoZzcPSahvK5qJ7fYhS61sZi5ikmh2S3Hz55A2l3U69ng==", - "license": "MIT", - "dependencies": { - "@types/react-reconciler": "^0.28.9" - }, - "peerDependencies": { - "react": "^19.0.0" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", - "dev": true, - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/jsesc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", - "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", - "dev": true, - "license": "MIT", - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true, - "license": "MIT" - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "license": "MIT", - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jsonfile": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", - "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", - "dev": true, - "license": "MIT", - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/keyv": { - "version": "4.5.4", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", - "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", - "dev": true, - "license": "MIT", - "dependencies": { - "json-buffer": "3.0.1" - } - }, - "node_modules/levn": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", - "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/lie": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", - "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", - "license": "MIT", - "dependencies": { - "immediate": "~3.0.5" - } - }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/maath": { - "version": "0.10.8", - "resolved": "https://registry.npmjs.org/maath/-/maath-0.10.8.tgz", - "integrity": "sha512-tRvbDF0Pgqz+9XUa4jjfgAQ8/aPKmQdWXilFu2tMy4GWj4NOsx99HlULO4IeREfbO3a0sA145DZYyvXPkybm0g==", - "license": "MIT", - "peerDependencies": { - "@types/three": ">=0.134.0", - "three": ">=0.134.0" - } - }, - "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "license": "MIT", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, - "node_modules/meshline": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/meshline/-/meshline-3.3.1.tgz", - "integrity": "sha512-/TQj+JdZkeSUOl5Mk2J7eLcYTLiQm2IDzmlSvYm7ov15anEcDJ92GHqqazxTSreeNgfnYu24kiEvvv0WlbCdFQ==", - "license": "MIT", - "peerDependencies": { - "three": ">=0.137" - } - }, - "node_modules/meshoptimizer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/meshoptimizer/-/meshoptimizer-1.0.1.tgz", - "integrity": "sha512-Vix+QlA1YYT3FwmBBZ+49cE5y/b+pRrcXKqGpS5ouh33d3lSp2PoTpCw19E0cKDFWalembrHnIaZetf27a+W2g==", - "license": "MIT" - }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "dev": true, - "license": "MIT", - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/micromatch/node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/minimatch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", - "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, - "node_modules/nanoid": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true, - "license": "MIT" - }, - "node_modules/node-releases": { - "version": "2.0.27", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", - "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", - "dev": true, - "license": "MIT" - }, - "node_modules/optionator": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", - "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", - "dev": true, - "license": "MIT", - "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.5" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "license": "MIT", - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true, - "license": "ISC" - }, - "node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pkg-dir/node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pkg-dir/node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pkg-dir/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/pkg-dir/node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/postcss": { - "version": "8.5.6", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", - "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "nanoid": "^3.3.11", - "picocolors": "^1.1.1", - "source-map-js": "^1.2.1" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/potpack": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/potpack/-/potpack-1.0.2.tgz", - "integrity": "sha512-choctRBIV9EMT9WGAZHn3V7t0Z2pMQyl0EZE6pFc/6ml3ssw7Dlf/oAOvFwjm1HVsqfQN8GfeFyJ+d8tRzqueQ==", - "license": "ISC" - }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", - "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/promise-worker-transferable": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/promise-worker-transferable/-/promise-worker-transferable-1.0.4.tgz", - "integrity": "sha512-bN+0ehEnrXfxV2ZQvU2PetO0n4gqBD4ulq3MI1WOPLgr7/Mg9yRQkX5+0v1vagr74ZTsl7XtzlaYDo2EuCeYJw==", - "license": "Apache-2.0", - "dependencies": { - "is-promise": "^2.1.0", - "lie": "^3.0.2" - } - }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/react": { - "version": "19.2.4", - "resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz", - "integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-dom": { - "version": "19.2.4", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz", - "integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==", - "license": "MIT", - "dependencies": { - "scheduler": "^0.27.0" - }, - "peerDependencies": { - "react": "^19.2.4" - } - }, - "node_modules/react-refresh": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.18.0.tgz", - "integrity": "sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-use-measure": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/react-use-measure/-/react-use-measure-2.1.7.tgz", - "integrity": "sha512-KrvcAo13I/60HpwGO5jpW7E9DfusKyLPLvuHlUyP5zqnmAPhNc6qTRjUQrdTADl0lpPpDVU2/Gg51UlOGHXbdg==", - "license": "MIT", - "peerDependencies": { - "react": ">=16.13", - "react-dom": ">=16.13" - }, - "peerDependenciesMeta": { - "react-dom": { - "optional": true - } - } - }, - "node_modules/require-from-string": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/reusify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", - "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", - "dev": true, - "license": "MIT", - "engines": { - "iojs": ">=1.0.0", - "node": ">=0.10.0" - } - }, - "node_modules/rollup": { - "version": "4.59.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz", - "integrity": "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "1.0.8" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.59.0", - "@rollup/rollup-android-arm64": "4.59.0", - "@rollup/rollup-darwin-arm64": "4.59.0", - "@rollup/rollup-darwin-x64": "4.59.0", - "@rollup/rollup-freebsd-arm64": "4.59.0", - "@rollup/rollup-freebsd-x64": "4.59.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.59.0", - "@rollup/rollup-linux-arm-musleabihf": "4.59.0", - "@rollup/rollup-linux-arm64-gnu": "4.59.0", - "@rollup/rollup-linux-arm64-musl": "4.59.0", - "@rollup/rollup-linux-loong64-gnu": "4.59.0", - "@rollup/rollup-linux-loong64-musl": "4.59.0", - "@rollup/rollup-linux-ppc64-gnu": "4.59.0", - "@rollup/rollup-linux-ppc64-musl": "4.59.0", - "@rollup/rollup-linux-riscv64-gnu": "4.59.0", - "@rollup/rollup-linux-riscv64-musl": "4.59.0", - "@rollup/rollup-linux-s390x-gnu": "4.59.0", - "@rollup/rollup-linux-x64-gnu": "4.59.0", - "@rollup/rollup-linux-x64-musl": "4.59.0", - "@rollup/rollup-openbsd-x64": "4.59.0", - "@rollup/rollup-openharmony-arm64": "4.59.0", - "@rollup/rollup-win32-arm64-msvc": "4.59.0", - "@rollup/rollup-win32-ia32-msvc": "4.59.0", - "@rollup/rollup-win32-x64-gnu": "4.59.0", - "@rollup/rollup-win32-x64-msvc": "4.59.0", - "fsevents": "~2.3.2" - } - }, - "node_modules/run-parallel": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", - "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, - "node_modules/scheduler": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", - "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", - "license": "MIT" - }, - "node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/stats-gl": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/stats-gl/-/stats-gl-2.4.2.tgz", - "integrity": "sha512-g5O9B0hm9CvnM36+v7SFl39T7hmAlv541tU81ME8YeSb3i1CIP5/QdDeSB3A0la0bKNHpxpwxOVRo2wFTYEosQ==", - "license": "MIT", - "dependencies": { - "@types/three": "*", - "three": "^0.170.0" - }, - "peerDependencies": { - "@types/three": "*", - "three": "*" - } - }, - "node_modules/stats-gl/node_modules/three": { - "version": "0.170.0", - "resolved": "https://registry.npmjs.org/three/-/three-0.170.0.tgz", - "integrity": "sha512-FQK+LEpYc0fBD+J8g6oSEyyNzjp+Q7Ks1C568WWaoMRLW+TkNNWmenWeGgJjV105Gd+p/2ql1ZcjYvNiPZBhuQ==", - "license": "MIT" - }, - "node_modules/stats.js": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/stats.js/-/stats.js-0.17.0.tgz", - "integrity": "sha512-hNKz8phvYLPEcRkeG1rsGmV5ChMjKDAWU7/OJJdDErPBNChQXxCo3WZurGpnWc6gZhAzEPFad1aVgyOANH1sMw==", - "license": "MIT" - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/strip-outer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", - "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", - "dev": true, - "license": "MIT", - "dependencies": { - "escape-string-regexp": "^1.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strip-outer/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/suspend-react": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/suspend-react/-/suspend-react-0.1.3.tgz", - "integrity": "sha512-aqldKgX9aZqpoDp3e8/BZ8Dm7x1pJl+qI3ZKxDN0i/IQTWUwBx/ManmlVJ3wowqbno6c2bmiIfs+Um6LbsjJyQ==", - "license": "MIT", - "peerDependencies": { - "react": ">=17.0" - } - }, - "node_modules/three": { - "version": "0.183.1", - "resolved": "https://registry.npmjs.org/three/-/three-0.183.1.tgz", - "integrity": "sha512-Psv6bbd3d/M/01MT2zZ+VmD0Vj2dbWTNhfe4CuSg7w5TuW96M3NOyCVuh9SZQ05CpGmD7NEcJhZw4GVjhCYxfQ==", - "license": "MIT" - }, - "node_modules/three-mesh-bvh": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/three-mesh-bvh/-/three-mesh-bvh-0.8.3.tgz", - "integrity": "sha512-4G5lBaF+g2auKX3P0yqx+MJC6oVt6sB5k+CchS6Ob0qvH0YIhuUk1eYr7ktsIpY+albCqE80/FVQGV190PmiAg==", - "license": "MIT", - "peerDependencies": { - "three": ">= 0.159.0" - } - }, - "node_modules/three-stdlib": { - "version": "2.36.1", - "resolved": "https://registry.npmjs.org/three-stdlib/-/three-stdlib-2.36.1.tgz", - "integrity": "sha512-XyGQrFmNQ5O/IoKm556ftwKsBg11TIb301MB5dWNicziQBEs2g3gtOYIf7pFiLa0zI2gUwhtCjv9fmjnxKZ1Cg==", - "license": "MIT", - "dependencies": { - "@types/draco3d": "^1.4.0", - "@types/offscreencanvas": "^2019.6.4", - "@types/webxr": "^0.5.2", - "draco3d": "^1.4.1", - "fflate": "^0.6.9", - "potpack": "^1.0.1" - }, - "peerDependencies": { - "three": ">=0.128.0" - } - }, - "node_modules/three-stdlib/node_modules/fflate": { - "version": "0.6.10", - "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.6.10.tgz", - "integrity": "sha512-IQrh3lEPM93wVCEczc9SaAOvkmcoQn/G8Bo1e8ZPlY3X3bnAxWaBdvTdvM1hP62iZp0BXWDy4vTAy4fF0+Dlpg==", - "license": "MIT" - }, - "node_modules/tinyglobby": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", - "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "fdir": "^6.5.0", - "picomatch": "^4.0.3" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/SuperchupuDev" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/trim-repeated": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", - "integrity": "sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==", - "dev": true, - "license": "MIT", - "dependencies": { - "escape-string-regexp": "^1.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/trim-repeated/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/troika-three-text": { - "version": "0.52.4", - "resolved": "https://registry.npmjs.org/troika-three-text/-/troika-three-text-0.52.4.tgz", - "integrity": "sha512-V50EwcYGruV5rUZ9F4aNsrytGdKcXKALjEtQXIOBfhVoZU9VAqZNIoGQ3TMiooVqFAbR1w15T+f+8gkzoFzawg==", - "license": "MIT", - "dependencies": { - "bidi-js": "^1.0.2", - "troika-three-utils": "^0.52.4", - "troika-worker-utils": "^0.52.0", - "webgl-sdf-generator": "1.1.1" - }, - "peerDependencies": { - "three": ">=0.125.0" - } - }, - "node_modules/troika-three-utils": { - "version": "0.52.4", - "resolved": "https://registry.npmjs.org/troika-three-utils/-/troika-three-utils-0.52.4.tgz", - "integrity": "sha512-NORAStSVa/BDiG52Mfudk4j1FG4jC4ILutB3foPnfGbOeIs9+G5vZLa0pnmnaftZUGm4UwSoqEpWdqvC7zms3A==", - "license": "MIT", - "peerDependencies": { - "three": ">=0.125.0" - } - }, - "node_modules/troika-worker-utils": { - "version": "0.52.0", - "resolved": "https://registry.npmjs.org/troika-worker-utils/-/troika-worker-utils-0.52.0.tgz", - "integrity": "sha512-W1CpvTHykaPH5brv5VHLfQo9D1OYuo0cSBEUQFFT/nBUzM8iD6Lq2/tgG/f1OelbAS1WtaTPQzE5uM49egnngw==", - "license": "MIT" - }, - "node_modules/ts-api-utils": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.4.0.tgz", - "integrity": "sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18.12" - }, - "peerDependencies": { - "typescript": ">=4.8.4" - } - }, - "node_modules/tunnel-rat": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/tunnel-rat/-/tunnel-rat-0.1.2.tgz", - "integrity": "sha512-lR5VHmkPhzdhrM092lI2nACsLO4QubF0/yoOhzX7c+wIpbN1GjHNzCc91QlpxBi+cnx8vVJ+Ur6vL5cEoQPFpQ==", - "license": "MIT", - "dependencies": { - "zustand": "^4.3.2" - } - }, - "node_modules/tunnel-rat/node_modules/zustand": { - "version": "4.5.7", - "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.5.7.tgz", - "integrity": "sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw==", - "license": "MIT", - "dependencies": { - "use-sync-external-store": "^1.2.2" - }, - "engines": { - "node": ">=12.7.0" - }, - "peerDependencies": { - "@types/react": ">=16.8", - "immer": ">=9.0.6", - "react": ">=16.8" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "immer": { - "optional": true - }, - "react": { - "optional": true - } - } - }, - "node_modules/type-check": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", - "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/typescript-eslint": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.56.1.tgz", - "integrity": "sha512-U4lM6pjmBX7J5wk4szltF7I1cGBHXZopnAXCMXb3+fZ3B/0Z3hq3wS/CCUB2NZBNAExK92mCU2tEohWuwVMsDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/eslint-plugin": "8.56.1", - "@typescript-eslint/parser": "8.56.1", - "@typescript-eslint/typescript-estree": "8.56.1", - "@typescript-eslint/utils": "8.56.1" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/undici-types": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", - "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", - "dev": true, - "license": "MIT" - }, - "node_modules/universalify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", - "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/update-browserslist-db": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", - "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "escalade": "^3.2.0", - "picocolors": "^1.1.1" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/use-sync-external-store": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz", - "integrity": "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==", - "license": "MIT", - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" - } - }, - "node_modules/utility-types": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/utility-types/-/utility-types-3.11.0.tgz", - "integrity": "sha512-6Z7Ma2aVEWisaL6TvBCy7P8rm2LQoPv6dJ7ecIaIixHcwfbJ0x7mWdbcwlIM5IGQxPZSFYeqRCqlOOeKoJYMkw==", - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/vite": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.1.tgz", - "integrity": "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==", - "dev": true, - "license": "MIT", - "dependencies": { - "esbuild": "^0.27.0", - "fdir": "^6.5.0", - "picomatch": "^4.0.3", - "postcss": "^8.5.6", - "rollup": "^4.43.0", - "tinyglobby": "^0.2.15" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - }, - "peerDependencies": { - "@types/node": "^20.19.0 || >=22.12.0", - "jiti": ">=1.21.0", - "less": "^4.0.0", - "lightningcss": "^1.21.0", - "sass": "^1.70.0", - "sass-embedded": "^1.70.0", - "stylus": ">=0.54.8", - "sugarss": "^5.0.0", - "terser": "^5.16.0", - "tsx": "^4.8.1", - "yaml": "^2.4.2" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "jiti": { - "optional": true - }, - "less": { - "optional": true - }, - "lightningcss": { - "optional": true - }, - "sass": { - "optional": true - }, - "sass-embedded": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true - } - } - }, - "node_modules/webgl-constants": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/webgl-constants/-/webgl-constants-1.1.1.tgz", - "integrity": "sha512-LkBXKjU5r9vAW7Gcu3T5u+5cvSvh5WwINdr0C+9jpzVB41cjQAP5ePArDtk/WHYdVj0GefCgM73BA7FlIiNtdg==" - }, - "node_modules/webgl-sdf-generator": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/webgl-sdf-generator/-/webgl-sdf-generator-1.1.1.tgz", - "integrity": "sha512-9Z0JcMTFxeE+b2x1LJTdnaT8rT8aEp7MVxkNwoycNmJWwPdzoXzMh0BjJSh/AEFP+KPYZUli814h8bJZFIZ2jA==", - "license": "MIT" - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/word-wrap": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", - "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true, - "license": "ISC" - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/zod": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz", - "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - }, - "node_modules/zod-validation-error": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-4.0.2.tgz", - "integrity": "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18.0.0" - }, - "peerDependencies": { - "zod": "^3.25.0 || ^4.0.0" - } - }, - "node_modules/zustand": { - "version": "5.0.11", - "resolved": "https://registry.npmjs.org/zustand/-/zustand-5.0.11.tgz", - "integrity": "sha512-fdZY+dk7zn/vbWNCYmzZULHRrss0jx5pPFiOuMZ/5HJN6Yv3u+1Wswy/4MpZEkEGhtNH+pwxZB8OKgUBPzYAGg==", - "license": "MIT", - "engines": { - "node": ">=12.20.0" - }, - "peerDependencies": { - "@types/react": ">=18.0.0", - "immer": ">=9.0.6", - "react": ">=18.0.0", - "use-sync-external-store": ">=1.2.0" - }, - "peerDependenciesMeta": { - "@types/react": { - "optional": true - }, - "immer": { - "optional": true - }, - "react": { - "optional": true - }, - "use-sync-external-store": { - "optional": true - } - } - } - } -} diff --git a/client/package.json b/client/package.json deleted file mode 100644 index b66d9ad..0000000 --- a/client/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "client", - "private": true, - "version": "0.5.2", - "type": "module", - "scripts": { - "dev": "vite", - "build": "tsc -b && vite build", - "lint": "eslint .", - "preview": "vite preview", - "predeploy": "npm run build", - "deploy": "gh-pages -d dist" - }, - "dependencies": { - "@react-three/drei": "^10.7.7", - "@react-three/fiber": "^9.5.0", - "react": "^19.2.0", - "react-dom": "^19.2.0", - "three": "^0.183.1" - }, - "devDependencies": { - "@eslint/js": "^9.39.1", - "@types/node": "^24.10.1", - "@types/react": "^19.2.7", - "@types/react-dom": "^19.2.3", - "@types/three": "^0.183.1", - "@vitejs/plugin-react": "^5.1.1", - "eslint": "^9.39.1", - "eslint-plugin-react-hooks": "^7.0.1", - "eslint-plugin-react-refresh": "^0.4.24", - "gh-pages": "^6.3.0", - "globals": "^16.5.0", - "typescript": "~5.9.3", - "typescript-eslint": "^8.48.0", - "vite": "^7.3.1" - } -} diff --git a/client/src/App.css b/client/src/App.css deleted file mode 100644 index b9d355d..0000000 --- a/client/src/App.css +++ /dev/null @@ -1,42 +0,0 @@ -#root { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; -} - -.logo { - height: 6em; - padding: 1.5em; - will-change: filter; - transition: filter 300ms; -} -.logo:hover { - filter: drop-shadow(0 0 2em #646cffaa); -} -.logo.react:hover { - filter: drop-shadow(0 0 2em #61dafbaa); -} - -@keyframes logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} - -@media (prefers-reduced-motion: no-preference) { - a:nth-of-type(2) .logo { - animation: logo-spin infinite 20s linear; - } -} - -.card { - padding: 2em; -} - -.read-the-docs { - color: #888; -} diff --git a/client/src/App.tsx b/client/src/App.tsx deleted file mode 100644 index 4d0dc48..0000000 --- a/client/src/App.tsx +++ /dev/null @@ -1,215 +0,0 @@ -import { useMemo, useEffect, useRef } from 'react'; -import { Canvas, useThree } from '@react-three/fiber'; -import { OrbitControls, Sky, Stars, Environment } from '@react-three/drei'; -import type { OrbitControls as OrbitControlsImpl } from 'three-stdlib'; -import { useChessGame } from './game/useChessGame'; -import { useAudio } from './game/useAudio'; -import { getValidMoves } from './game/ChessLogic'; -import { ChessBoard } from './components/ChessBoard'; -import { ChessPiece } from './components/ChessPiece'; -import { GameUI } from './components/GameUI'; -import { DiceRoll } from './components/DiceRoll'; -import { CombatEffect } from './components/CombatEffect'; -import { Scenery } from './components/Scenery'; - -// Component to handle camera reset logic -const CameraHandler = ({ controlsRef }: { controlsRef: React.RefObject }) => { - const { camera } = useThree(); - - const resetCamera = () => { - if (controlsRef.current) { - camera.position.set(0, 8, -10); - controlsRef.current.target.set(0, 0, 0); - controlsRef.current.update(); - } - }; - - useEffect(() => { - const handleKeyDown = (e: KeyboardEvent) => { - if (e.key.toLowerCase() === 'r') { - resetCamera(); - } - }; - - const handleMouseDown = (e: MouseEvent) => { - if (e.button === 1) { - resetCamera(); - } - }; - - window.addEventListener('keydown', handleKeyDown); - window.addEventListener('mousedown', handleMouseDown); - return () => { - window.removeEventListener('keydown', handleKeyDown); - window.removeEventListener('mousedown', handleMouseDown); - }; - }, [camera, controlsRef]); - - return null; -}; - -function App() { - const controlsRef = useRef(null); - const { - volume, setVolume, isMuted, setIsMuted, playSound, startMusic - } = useAudio(); - - const { - pieces, turn, selectedPieceId, battleResult, isRolling, isPaused, winner, - isNight, hasStarted, fogNear, fogFar, logs, - boardStyle, windStrength, whiteColor, blackColor, showCoordinates, - setBoardStyle, setWindStrength, setWhiteColor, setBlackColor, setShowCoordinates, - setHasStarted, setIsNight, setIsPaused, setFogNear, setFogFar, - resetGame, handleSquareClick, handleOnagerClick, setBattleResult, isVsAI, setIsVsAI, playerColor, setPlayerColor, turnCount, - whiteSiegeUsed, blackSiegeUsed, isSiegeFiring, fireSiege, selectedOnagerColor - } = useChessGame(playSound); - - const selectedPiece = useMemo(() => - pieces.find(p => p.id === selectedPieceId) || null, - [pieces, selectedPieceId]); - - const validMoves = useMemo(() => - selectedPiece ? getValidMoves(selectedPiece, pieces) : [], - [selectedPiece, pieces]); - - const sceneBackground = isNight ? '#050505' : '#e0c3a0'; - - return ( -
- - - - - {/* Lighting & Environment */} - - - - {!isNight ? ( - - ) : ( - - )} - - - - - - - - p.color !== selectedOnagerColor && (selectedOnagerColor === 'white' ? p.y <= 3 : p.y >= 4)).map(p => ({ x: p.x, y: p.y })) - : [] - } - highlightColor={selectedOnagerColor ? "#f44336" : undefined} - onSquareClick={handleSquareClick} - boardStyle={boardStyle} - showCoordinates={showCoordinates} - /> - {pieces.map(piece => ( - handleSquareClick(piece.x, piece.y)} - customWhiteColor={whiteColor} - customBlackColor={blackColor} - /> - ))} - - - - - {(isRolling || battleResult) && battleResult && ( - - )} - - - - - -
- ); -} - -export default App; diff --git a/client/src/assets/react.svg b/client/src/assets/react.svg deleted file mode 100644 index 6c87de9..0000000 --- a/client/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/client/src/components/ChessBoard.tsx b/client/src/components/ChessBoard.tsx deleted file mode 100644 index 34875e3..0000000 --- a/client/src/components/ChessBoard.tsx +++ /dev/null @@ -1,136 +0,0 @@ -import React from 'react'; -import { useCursor, Text } from '@react-three/drei'; -import type { Piece, Position } from '../types'; - -interface SquareProps { - x: number; - y: number; - color: string; - isHighlight: boolean; - highlightColor?: string; - onClick: () => void; -} - -const Square: React.FC = ({ x, y, color, isHighlight, highlightColor, onClick }) => { - const [hovered, setHovered] = React.useState(false); - useCursor(hovered); - - const displayColor = isHighlight ? (highlightColor || '#ffeb3b') : (hovered ? '#c8e6c9' : color); - - return ( - { e.stopPropagation(); onClick(); }} - onPointerOver={(e) => { e.stopPropagation(); setHovered(true); }} - onPointerOut={() => setHovered(false)} - receiveShadow - > - - - - ); -}; - -interface BoardProps { - pieces: Piece[]; - selectedPieceId: string | null; - validMoves: Position[]; - highlightSquares?: Position[]; - highlightColor?: string; - onSquareClick: (x: number, y: number) => void; - boardStyle: 'wood' | 'stone' | 'marble'; - showCoordinates?: boolean; -} - -export const ChessBoard: React.FC = ({ validMoves, highlightSquares = [], highlightColor, onSquareClick, boardStyle, showCoordinates }) => { - const squares = []; - - const getStyleColors = () => { - switch (boardStyle) { - case 'stone': return { light: '#999', dark: '#444', base: '#222' }; - case 'marble': return { light: '#fff', dark: '#71d5e4', base: '#004d40' }; - default: return { light: '#f0d9b5', dark: '#b58863', base: '#4a3b2c' }; - } - }; - - const styleColors = getStyleColors(); - - for (let x = 0; x < 8; x++) { - for (let y = 0; y < 8; y++) { - const isBlack = (x + y) % 2 === 1; - const color = isBlack ? styleColors.dark : styleColors.light; - - const isMoveHighlight = validMoves.some(m => m.x === x && m.y === y); - const isExtraHighlight = highlightSquares.some(m => m.x === x && m.y === y); - const isHighlight = isMoveHighlight || isExtraHighlight; - const squareHighlightColor = isExtraHighlight ? highlightColor : undefined; - - squares.push( - onSquareClick(x, y)} - /> - ); - } - } - - const renderCoordinates = () => { - if (!showCoordinates) return null; - const labels = []; - const textColor = boardStyle === 'stone' ? '#fff' : '#d4af37'; - - for (let i = 0; i < 8; i++) { - // A-H (X-axis) - labels.push( - - {String.fromCharCode(65 + i)} - - ); - // 1-8 (Y-axis) - labels.push( - - {i + 1} - - ); - } - return labels; - }; - - return ( - - {/* Board Base */} - - - - - - {/* Coordinates */} - {renderCoordinates()} - - {/* Squares */} - {squares} - - ); -}; diff --git a/client/src/components/ChessPiece.tsx b/client/src/components/ChessPiece.tsx deleted file mode 100644 index 9d7c153..0000000 --- a/client/src/components/ChessPiece.tsx +++ /dev/null @@ -1,287 +0,0 @@ -import React, { useRef, useState } from 'react'; -import { useFrame } from '@react-three/fiber'; -import { useCursor, Billboard, Text } from '@react-three/drei'; -import * as THREE from 'three'; -import type { Piece } from '../types'; -import { KnightPieceModel } from './Scenery'; - -interface Props { - piece: Piece; - isSelected: boolean; - onClick: () => void; - customWhiteColor?: string; - customBlackColor?: string; -} - -export const ChessPiece: React.FC = ({ piece, isSelected, onClick, customWhiteColor, customBlackColor }) => { - const groupRef = useRef(null); - const [hovered, setHovered] = useState(false); - useCursor(hovered); - - const posX = piece.x - 3.5; - const posZ = piece.y - 3.5; - - const teamBaseColor = piece.color === 'white' ? (customWhiteColor || '#f0d9b5') : (customBlackColor || '#4a4a4a'); - const highlightColor = isSelected ? '#ffeb3b' : hovered ? '#81c784' : teamBaseColor; - const stripeColor = piece.secondaryColor || (piece.color === 'white' ? '#d4af37' : '#ff5252'); - - const ringRef = useRef(null); - - useFrame((state) => { - if (!groupRef.current) return; - - const t = state.clock.getElapsedTime(); - - // Pulse vulnerability ring - if (ringRef.current && piece.isDebuffed) { - const pulseVertical = 0.1 + Math.sin(t * 5) * 0.15; // Vertical "slider" movement - - ringRef.current.position.y = pulseVertical; - - // Update opacity for all meshes in the group - ringRef.current.traverse((child) => { - if (child instanceof THREE.Mesh && child.material) { - const mat = child.material as THREE.MeshStandardMaterial; - // Determine base opacity by geometry type/index - // Inner circle or outer rings - const isCenter = child.geometry.type === 'CircleGeometry'; - const isMiddle = child.geometry.type === 'RingGeometry' && mat.emissive.getHex() === 0xd4af37; - - // Use a higher minimum opacity (0.4) to ensure it's never invisible - const baseOpacity = isCenter ? 0.8 : isMiddle ? 0.5 : 0.7; - mat.opacity = baseOpacity + Math.sin(t * 5) * 0.2; - } - }); - } - - if (piece.status === 'attacking') { - // Lunge animation - const lunge = Math.sin(t * 15) * 0.5; - groupRef.current.position.y = 0.01 + Math.abs(lunge * 0.5); - // Move slightly forward based on color - const dir = piece.color === 'white' ? 1 : -1; - groupRef.current.position.z = posZ + lunge * 0.8 * dir; - } else if (piece.status === 'dying') { - // Death animation: Fall over and sink - groupRef.current.rotation.x = THREE.MathUtils.lerp(groupRef.current.rotation.x, Math.PI / 2.2, 0.1); - groupRef.current.position.y = THREE.MathUtils.lerp(groupRef.current.position.y, -0.5, 0.05); - } else { - // Idle / Normal position - groupRef.current.position.x = posX; - groupRef.current.position.y = 0.01; - groupRef.current.position.z = posZ; - groupRef.current.rotation.x = 0; - } - }); - - const getGeometry = () => { - switch (piece.type) { - case 'pawn': - return ( - - - - - - - - - - - - - - - ); - case 'rook': - return ( - - - - - - - - - - - - - - - - - - - ); - case 'knight': - return ( - - - - ); - case 'bishop': - return ( - - - - - - - - - - - - - - - ); - case 'queen': - return ( - - - - - - - - - - - - - - - - - - - ); - case 'king': - return ( - - - - - - - - - - - - - - - - - - - - - - - ); - default: - return ; - } - }; - - return ( - { e.stopPropagation(); onClick(); }} - onPointerOver={(e) => { e.stopPropagation(); setHovered(true); }} - onPointerOut={() => setHovered(false)} - > - {getGeometry()} - - {/* Vulnerability Halo (Bullseye Energy Field) */} - {piece.isDebuffed && ( - - {/* Outer Ring - Bright Red */} - - - - - {/* Middle Ring - White/Gold Glow */} - - - - - {/* Inner Bullseye - Solid Red */} - - - - - - )} - - {/* Health Bar Billboard */} - - - null}> - - - - null}> - - - - null}> - - 0.5 ? "#4caf50" : piece.hp / piece.maxHp > 0.2 ? "#ffeb3b" : "#f44336"} /> - - null} - > - {Math.ceil(piece.hp)} / {piece.maxHp} - - - - - {(piece.kills > 0 || piece.defends > 0) && ( - - {piece.kills > 0 && ( - null}> - ⚔️{piece.kills} - - )} - {piece.defends > 0 && ( - null}> - 🛡️{piece.defends} - - )} - - )} - - ); -}; diff --git a/client/src/components/CombatEffect.tsx b/client/src/components/CombatEffect.tsx deleted file mode 100644 index 590117e..0000000 --- a/client/src/components/CombatEffect.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import React, { useRef } from 'react'; -import { useFrame } from '@react-three/fiber'; -import { Sparkles } from '@react-three/drei'; -import * as THREE from 'three'; -import type { BattleResult } from '../types'; - -interface Props { - battleResult: BattleResult | null; - isRolling: boolean; - isSiegeFiring: 'white' | 'black' | null; -} - -const Projectile = ({ index, color, direction }: { index: number, color: string, direction: 1 | -1 }) => { - const ref = useRef(null); - const startX = (Math.random() - 0.5) * 8; - const startY = 15; - const startZ = direction === 1 ? -15 : 15; - - const targetX = (Math.random() - 0.5) * 8; - const targetY = 0; - // White hits 0-3 (z: -3.5 to -0.5). Black hits 7-4 (z: 3.5 to 0.5) - const targetZ = direction === 1 ? -3.5 + Math.random() * 3 : 3.5 - Math.random() * 3; - - useFrame((state) => { - if (ref.current) { - const t = (state.clock.getElapsedTime() * 1.5 + (index * 0.1)) % 2; - if (t < 1) { - ref.current.position.x = THREE.MathUtils.lerp(startX, targetX, t); - ref.current.position.y = THREE.MathUtils.lerp(startY, targetY, Math.pow(t, 2)); - ref.current.position.z = THREE.MathUtils.lerp(startZ, targetZ, t); - ref.current.rotation.x += 0.1; - ref.current.visible = true; - } else { - ref.current.visible = false; - } - } - }); - - return ( - - - - - ); -}; - -export const CombatEffect: React.FC = ({ battleResult, isRolling, isSiegeFiring }) => { - const swordsRef = useRef(null); - - useFrame((state) => { - if (isRolling && swordsRef.current) { - const time = state.clock.getElapsedTime(); - swordsRef.current.rotation.z = Math.sin(time * 30) * 0.3; - swordsRef.current.rotation.y = time * 2; - swordsRef.current.position.y = 1 + Math.sin(time * 15) * 0.1; - } - }); - - return ( - <> - {isSiegeFiring && ( - - {Array.from({ length: 12 }).map((_, i) => ( - - ))} - {/* Landing Smoke/Fire Sparkles */} - - - - - )} - - {battleResult && ( - - {isRolling && ( - - - - - - - - - - - - - - - - - - - - - - - - - )} - - )} - - ); -}; diff --git a/client/src/components/DiceRoll.tsx b/client/src/components/DiceRoll.tsx deleted file mode 100644 index 435dd4d..0000000 --- a/client/src/components/DiceRoll.tsx +++ /dev/null @@ -1,147 +0,0 @@ -import React, { useRef, useState, useEffect } from 'react'; -import { useFrame } from '@react-three/fiber'; -import { Text, Billboard } from '@react-three/drei'; -import * as THREE from 'three'; - -interface Props { - attackerRoll: number; - attackerStats: number; - attackerDice: number; - defenderRoll: number; - defenderStats: number; - defenderDice: number; - defenderDebuff: number; - isSiege?: boolean; // Added isSiege prop - isRolling: boolean; -} - -export const DiceRoll: React.FC = ({ - attackerRoll, attackerStats, attackerDice, - defenderRoll, defenderStats, defenderDice, defenderDebuff, - isSiege, isRolling -}) => { - const attackerGroupRef = useRef(null); - const defenderGroupRef = useRef(null); - - const [displayAttacker, setDisplayAttacker] = useState('?'); - const [displayDefender, setDisplayDefender] = useState('?'); - - useEffect(() => { - if (isRolling) { - setDisplayAttacker('?'); - setDisplayDefender('?'); - const timeout = setTimeout(() => { - setDisplayAttacker(attackerRoll.toString()); - setDisplayDefender(defenderRoll.toString()); - }, 1500); - return () => clearTimeout(timeout); - } else { - setDisplayAttacker(attackerRoll.toString()); - setDisplayDefender(defenderRoll.toString()); - } - }, [isRolling, attackerRoll, defenderRoll]); - - useFrame((_, delta) => { - // Animate the dice meshes spinning - if (isRolling) { - if (attackerGroupRef.current) { - attackerGroupRef.current.rotation.x += delta * 15; - attackerGroupRef.current.rotation.y += delta * 20; - } - if (defenderGroupRef.current && !isSiege) { - defenderGroupRef.current.rotation.x -= delta * 18; - defenderGroupRef.current.rotation.y -= delta * 22; - } - } else { - // Return dice to neutral rotation - if (attackerGroupRef.current) { - attackerGroupRef.current.rotation.x = THREE.MathUtils.lerp(attackerGroupRef.current.rotation.x, 0, delta * 10); - attackerGroupRef.current.rotation.y = THREE.MathUtils.lerp(attackerGroupRef.current.rotation.y, 0, delta * 10); - } - if (defenderGroupRef.current) { - defenderGroupRef.current.rotation.x = THREE.MathUtils.lerp(defenderGroupRef.current.rotation.x, 0, delta * 10); - defenderGroupRef.current.rotation.y = THREE.MathUtils.lerp(defenderGroupRef.current.rotation.y, 0, delta * 10); - } - } - }); - - return ( - - {/* Attacker / Siege */} - - {/* The Spinning Mesh */} - - - - - - - {/* The Billboard Text */} - - {attackerDice > 0 && !isSiege && ( - - D{attackerDice} - - )} - - {displayAttacker} - - {!isSiege && ( - <> - - Attacker - - - +{attackerStats} Kills - - - )} - - - - {/* VS Text - Hide if Siege */} - {!isSiege && ( - - - VS - - - )} - - {/* Defender - Hide if Siege */} - {!isSiege && ( - - {/* The Spinning Mesh */} - - - - - - - {/* The Billboard Text */} - - {defenderDice > 0 && ( - - D{defenderDice} - - )} - - {displayDefender} - - - Defender - - - +{defenderStats} Defends - - {defenderDebuff > 0 && ( - - - {defenderDebuff} VULNERABLE - - )} - - - )} - - ); -}; diff --git a/client/src/components/GameUI.tsx b/client/src/components/GameUI.tsx deleted file mode 100644 index 2db09d5..0000000 --- a/client/src/components/GameUI.tsx +++ /dev/null @@ -1,762 +0,0 @@ -import React from 'react'; -import type { Piece, BattleResult, LogEntry } from '../types'; -import packageJson from '../../package.json'; - -interface Props { - turn: string; - selectedPiece: Piece | null; - battleResult: BattleResult | null; - pieces: Piece[]; - isPaused: boolean; - winner: 'white' | 'black' | null; - isNight: boolean; - hasStarted: boolean; - fogNear: number; - fogFar: number; - logs: LogEntry[]; - boardStyle: 'wood' | 'stone' | 'marble'; - windStrength: number; - whiteColor: string; - blackColor: string; - showCoordinates: boolean; - setBoardStyle: (style: 'wood' | 'stone' | 'marble') => void; - setWindStrength: (val: number) => void; - setWhiteColor: (color: string) => void; - setBlackColor: (color: string) => void; - setShowCoordinates: (show: boolean) => void; - setFogNear: (val: number) => void; - setFogFar: (val: number) => void; - setHasStarted: (started: boolean) => void; - setIsNight: (night: boolean) => void; - setIsPaused: (paused: boolean) => void; - resetGame: () => void; - setBattleResult: (result: BattleResult | null) => void; - isVsAI: boolean; - setIsVsAI: (vsAI: boolean) => void; - playerColor: 'white' | 'black'; - setPlayerColor: (color: 'white' | 'black') => void; - turnCount: number; - whiteSiegeUsed: boolean; - blackSiegeUsed: boolean; - fireSiege: (color: 'white' | 'black', targetX: number, targetY: number) => void; - volume: number; - setVolume: (v: number) => void; - isMuted: boolean; - setIsMuted: (m: boolean) => void; - startMusic: () => void; - playSound: (name: any) => void; - } - - export const GameUI: React.FC = ({ - turn, selectedPiece, battleResult, pieces, isPaused, winner, isNight, hasStarted, - fogNear, fogFar, logs, - boardStyle, windStrength, whiteColor, blackColor, showCoordinates, - setBoardStyle, setWindStrength, setWhiteColor, setBlackColor, setShowCoordinates, - setFogNear, setFogFar, - setHasStarted, setIsNight, setIsPaused, resetGame, setBattleResult, - isVsAI, setIsVsAI, playerColor, setPlayerColor, turnCount, whiteSiegeUsed, blackSiegeUsed, - volume, setVolume, isMuted, setIsMuted, startMusic, playSound - }) => { - const [isTutorialOpen, setIsTutorialOpen] = React.useState(false); - const [isCreditsOpen, setIsCreditsOpen] = React.useState(false); - const [isChangelogOpen, setIsChangelogOpen] = React.useState(false); - const [showAiColorSelect, setShowAiColorSelect] = React.useState(false); - const [hideWinnerModal, setHideWinnerModal] = React.useState(false); - const [changelogData, setChangelogData] = React.useState([]); - - React.useEffect(() => { - fetch(`${import.meta.env.BASE_URL}changelog.json`) - .then(res => res.json()) - .then(data => setChangelogData(data)) - .catch(err => console.error("Failed to load changelog:", err)); - }, []); - - const getLogColor = (type: LogEntry['type']) => { - switch (type) { - case 'move': return '#ccc'; - case 'attack': return '#ffa726'; - case 'kill': return '#f44336'; - case 'promotion': return '#d4af37'; - case 'castle': return '#29b6f6'; - default: return '#fff'; - } - }; - - const getLogIcon = (type: LogEntry['type']) => { - switch (type) { - case 'move': return '👣'; - case 'attack': return '⚔️'; - case 'kill': return '💀'; - case 'promotion': return '👑'; - case 'castle': return '🏰'; - default: return '•'; - } - }; - - const whitePieces = pieces.filter(p => p.color === 'white'); - const blackPieces = pieces.filter(p => p.color === 'black'); - - const whiteKills = whitePieces.reduce((sum, p) => sum + p.kills, 0); - const blackKills = blackPieces.reduce((sum, p) => sum + p.kills, 0); - - const menuButtonStyle = { - display: 'block', - width: '100%', - padding: '12px', - marginBottom: '12px', - fontSize: '18px', - cursor: 'pointer', - background: 'linear-gradient(to bottom, #444, #222)', - color: '#d4af37', - border: '1px solid #d4af37', - borderRadius: '4px', - fontFamily: 'serif', - textTransform: 'uppercase' as const, - transition: 'all 0.2s' - }; - - const aoeBoxStyle = { - background: 'rgba(20, 15, 10, 0.9)', - border: '2px solid #d4af37', - boxShadow: 'inset 0 0 15px rgba(212, 175, 55, 0.2), 0 4px 15px rgba(0,0,0,0.8)', - color: '#f0d9b5', - fontFamily: 'serif' - }; - - return ( -
- - {/* Start Game Overlay */} - {!hasStarted && ( -
-
- Crown Logo -
-

A Strategic Saga

-

- CASTAROOK -

-
v{packageJson.version}
-
- - -
- {!showAiColorSelect ? ( - <> - -
Warning: The AI uses a greedy algorithm and may behave unpredictably or foolishly.
- - ) : ( -
- - -
- )} -
- - - - -
-
- -
-
- )} - -
- {/* Top Left: Score Board */} -
-

Army Strength

-
- White: - {whitePieces.length} Units ({whiteKills} Kills) -
-
- Black: - {blackPieces.length} Units ({blackKills} Kills) -
-
-
- Onager (White): - {whiteSiegeUsed ? 'DEPLETED' : 'READY'} -
-
- Onager (Black): - {blackSiegeUsed ? 'DEPLETED' : 'READY'} -
-
-
- - {/* Top Center: Turn Indicator */} -
-
- {turn}'s Command -
-
- {isVsAI ? 'Player vs AI' : 'Player vs Player'} -
-
- Turn {turnCount} -
-
- - {/* Top Right: Menu Button */} -
- -
-
- - {/* Tutorial Overlay */} - {isTutorialOpen && ( -
-
-

Chronicles of Battle

-
-

Command your pieces across the valley. Unlike regular chess, combat is determined by the fate of the dice.

-
    -
  • Skirmishes: Every unit has a unique die (Pawn: D6, Knight: D10, Bishop: D12, Rook: D15, Queen: D18, King: D20).
  • -
  • Valor & Health: Totals include battle-hardened stats (max +5). Damage is dealt based on the roll difference. Units perish only at 0 HP.
  • -
  • Opportunity Attack: Any unit that has just moved becomes Vulnerable (-2 Defense) until the start of its next turn.
  • -
  • Advanced Maneuvers: -
      -
    • Promotion: Reach the end to crown a Queen.
    • -
    • Castling: King and Rook may pivot if unmoved.
    • -
    • Siege Engine: Fire your Onager once per match to rain destruction on the nearest 4 rows (12-16 DMG).
    • -
    -
  • -
  • Observation: -
      -
    • Orbit: Left Click + Drag
    • -
    • Pan: Right Click + Drag
    • -
    • Zoom: Scroll Wheel
    • -
    • Reset View: Press 'R' or Middle Click
    • -
    -
  • -
  • Victory Conditions: No checkmate exists in this saga. You must execute the enemy King!
  • -
-
- -
-
- )} - - {/* Changelog Overlay */} - {isChangelogOpen && ( -
-
-

War Room Updates

- -
- {changelogData.map((entry, idx) => ( -
-

- v{entry.version} - {entry.title} - {entry.date} -

-
    - {entry.changes.map((change: string, cIdx: number) => ( -
  • {change}
  • - ))} -
-
- ))} - {changelogData.length === 0 && ( -
Loading chronicles...
- )} -
- - -
-
- )} - - {/* Credits Overlay */} - {isCreditsOpen && ( -
-
-

Architects of the Saga

-
-
window.open('https://fezcode.com', '_blank')} - style={{ fontSize: '24px', cursor: 'pointer', color: '#f0d9b5', transition: 'color 0.2s' }} - onMouseOver={(e) => e.currentTarget.style.color = '#d4af37'} - onMouseOut={(e) => e.currentTarget.style.color = '#f0d9b5'} - > - Samil Bulbul (@fezcode) -
-
window.open('https://github.com/TheLastRoadRunner', '_blank')} - style={{ fontSize: '24px', cursor: 'pointer', color: '#f0d9b5', transition: 'color 0.2s' }} - onMouseOver={(e) => e.currentTarget.style.color = '#d4af37'} - onMouseOut={(e) => e.currentTarget.style.color = '#f0d9b5'} - > - Sabri Bulbul (@thelastroadrunner) -
-
- -
-
- )} - - {/* Game Over Overlay */} - {winner && !isPaused && !hideWinnerModal && ( -
-
-

- {winner} Victory! -

-

- The saga concludes. The {winner} throne stands supreme. -

-
- - -
-
-
- )} - - {/* Pause Menu Overlay */} - {isPaused && ( -
-
-

Battle Paused

- - - - - - -
-
Customization
- -
-
Board Style
-
- {(['wood', 'stone', 'marble'] as const).map(s => ( - - ))} -
-
- -
- -
- -
-
Team Colors
-
-
-
White
- setWhiteColor(e.target.value)} style={{ width: '100%', height: '30px', border: '1px solid #d4af37', background: 'none', cursor: 'pointer', pointerEvents: 'auto' }} /> -
-
-
Black
- setBlackColor(e.target.value)} style={{ width: '100%', height: '30px', border: '1px solid #d4af37', background: 'none', cursor: 'pointer', pointerEvents: 'auto' }} /> -
-
-
- -
-
Wind Power: {windStrength.toFixed(1)}x
- setWindStrength(parseFloat(e.target.value))} style={{ width: '100%', pointerEvents: 'auto' }} /> -
- -
-
Audio Chronicles
-
- -
- setVolume(parseFloat(e.target.value))} - style={{ width: '100%', pointerEvents: 'auto' }} - /> -
-
-
- -
-
Mist Density
-
- Near: {fogNear} - setFogNear(parseInt(e.target.value))} style={{ flex: 1, pointerEvents: 'auto' }} /> -
-
- Far: {fogFar} - setFogFar(parseInt(e.target.value))} style={{ flex: 1, pointerEvents: 'auto' }} /> -
-
-
-
-
- )} - - {/* Battle Result Pop-up */} - {battleResult && ( -
-

- {battleResult.success - ? `${battleResult.attackerColor}'s Victory` - : `${battleResult.attackerColor === 'white' ? 'black' : 'white'}'s Victory`} -

-
- {battleResult.isSiege ? ( -
- Siege Onslaught: {battleResult.attackerTotal} DMG dealt to defender! -
- ) : ( - <> -
- Attacker (D{battleResult.attackerDice}): {battleResult.attackerRoll} + {battleResult.attackerStats} = {battleResult.attackerTotal} -
-
- Defender (D{battleResult.defenderDice}): {battleResult.defenderRoll} + {battleResult.defenderStats} {battleResult.defenderDebuff > 0 ? `- ${battleResult.defenderDebuff} (Vulnerable)` : ''} = {battleResult.defenderTotal} -
- - )} -
-

- {battleResult.isSiege ? 'Brute force from the shadows!' : (battleResult.success ? 'The objective is secured!' : 'The onslaught was resisted!')} -

- -
- )} - - {/* Bottom Left: Unit Information */} -
- {selectedPiece && ( -
-
Unit Selected
-

- {selectedPiece.color} {selectedPiece.type} -

-
-
- 🎲 Dice: D{ - selectedPiece.type === 'pawn' ? 6 : - selectedPiece.type === 'knight' ? 10 : - selectedPiece.type === 'bishop' ? 12 : - selectedPiece.type === 'rook' ? 15 : - selectedPiece.type === 'queen' ? 18 : 20 - } -
-
- ⚔️ Veteran Kills: {selectedPiece.kills} {selectedPiece.kills >= 5 && (MAX)} -
-
- 🛡️ Walls Defended: {selectedPiece.defends} {selectedPiece.defends >= 5 && (MAX)} -
- {selectedPiece.isDebuffed && ( -
- ⚠️ VULNERABLE (-2 DEF) -
- )} -
-
- )} -
- - {/* Bottom Right: War Chronicles */} -
-
- 📜 War Chronicles - {logs.length} Deeds -
-
- {logs.map(log => ( -
- [{new Date(log.timestamp).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit' })}] - {getLogIcon(log.type)} {log.message} -
- ))} - {logs.length === 0 &&
The history is yet to be written...
} -
-
- - -
- ); -}; diff --git a/client/src/components/Scenery.tsx b/client/src/components/Scenery.tsx deleted file mode 100644 index c3d0094..0000000 --- a/client/src/components/Scenery.tsx +++ /dev/null @@ -1,816 +0,0 @@ -import { useRef, useMemo, useState } from 'react'; -import { useFrame, useThree as _useThree } from '@react-three/fiber'; -import { Sparkles, Float, useCursor } from '@react-three/drei'; -import * as THREE from 'three'; - -const getTerrainHeight = (x: number, z: number) => { - const distFromCenter = Math.sqrt(x*x + z*z); - - // Base rolling hills noise - let y = (Math.sin(x * 0.08) * Math.cos(z * 0.08) * 2.5) + (Math.sin(x * 0.04) * 2); - - // Localized hill clusters around the plaza area - const localHills = (Math.sin(x * 0.25) * Math.cos(z * 0.25) * 2.2); - if (distFromCenter > 20) { - y += localHills * Math.min(1, (distFromCenter - 20) / 10); - } - - // Western Mound - const distToHill1 = Math.sqrt(Math.pow(x + 40, 2) + Math.pow(z + 40, 2)); - if (distToHill1 < 25) { - y += Math.pow(Math.cos((distToHill1 / 25) * Math.PI / 2), 2) * 7; - } - - // Eastern Plateau - const distToPlateau = Math.sqrt(Math.pow(x - 45, 2) + Math.pow(z - 35, 2)); - if (distToPlateau < 30) { - y += Math.pow(Math.cos((distToPlateau / 30) * Math.PI / 2), 0.5) * 4.5; - } - - // Southern Ridges - if (z > 40) { - y += Math.sin(x * 0.2) * 2 * Math.min(1, (z - 40) / 20); - } - - // Flatten the central area for the Plaza - const flatRadius = 18; - const smoothRadius = 32; - if (distFromCenter < smoothRadius) { - const weight = distFromCenter < flatRadius ? 0 : (distFromCenter - flatRadius) / (smoothRadius - flatRadius); - const smoothWeight = weight < 0.5 ? 2 * weight * weight : 1 - Math.pow(-2 * weight + 2, 2) / 2; - y = y * smoothWeight; - } - - // River 1 (Right side) - const river1Center = 45 + Math.sin(z * 0.05) * 12; - const distToRiver1 = Math.abs(x - river1Center); - if (distToRiver1 < 15) { - const riverDepth = (15 - distToRiver1) * 1.5; - const plazaProtector = Math.min(1, Math.max(0, (distFromCenter - 16) / 12)); - y -= riverDepth * plazaProtector; - } - - return y - 0.55; -}; - -// Helper to get the actual surface height including plaza elevation -const getSurfaceHeight = (x: number, z: number) => { - const distFromCenter = Math.sqrt(x*x + z*z); - if (distFromCenter < 10.5) return -0.3; // Top of Main Plaza - if (distFromCenter < 12) return -0.45; // Top of Foundation tier - // Sink vegetation slightly (-0.05) into ground to avoid floating due to mesh discretization - return getTerrainHeight(x, z) - 0.05; -}; - -const Tree = ({ position, windStrength = 1.0, seed = Math.random() }: { position: [number, number, number], windStrength?: number, seed?: number }) => { - const leavesRef = useRef(null); - const { height, width, leafColor, treeType } = useMemo(() => { - const types = ['pine', 'round', 'bushy']; - return { - height: 1.5 + seed * 2, - width: 1 + seed * 0.8, - leafColor: new THREE.Color(0x2d5a27).lerp(new THREE.Color(0x4d7a36), seed), - treeType: types[Math.floor(seed * types.length)] - }; - }, [seed]); - - useFrame((state) => { - if (leavesRef.current) { - const time = state.clock.getElapsedTime(); - const swayX = Math.sin(time * 1.2 + seed * 10) * 0.15 * windStrength; - const swayZ = Math.cos(time * 0.8 + seed * 7) * 0.15 * windStrength; - leavesRef.current.rotation.x = swayX; - leavesRef.current.rotation.z = swayZ; - } - }); - - return ( - - - - - - - {treeType === 'pine' ? ( - <> - - - - - ) : treeType === 'round' ? ( - - - - - ) : ( - - - - - - )} - - - ); -}; - -const Bush = ({ position, scale = 1 }: { position: [number, number, number], scale?: number }) => { - return ( - - - - - - ); -}; - -const Grass = ({ position, seed = Math.random() }: { position: [number, number, number], seed?: number }) => { - const ref = useRef(null); - useFrame((state) => { - if (ref.current) { - const time = state.clock.getElapsedTime(); - ref.current.rotation.x = Math.sin(time * 3 + seed * 5) * 0.3; - ref.current.rotation.z = Math.cos(time * 2.5 + seed * 3) * 0.3; - } - }); - return ( - - - - - ); -}; - -const Flower = ({ position, color = "red" }: { position: [number, number, number], color?: string }) => { - return ( - - - - - - - - - - - ); -}; - -const Rabbit = ({ position, seed = Math.random() }: { position: [number, number, number], seed?: number }) => { - const ref = useRef(null); - const startX = position[0]; - const startZ = position[2]; - - useFrame((state) => { - if (ref.current) { - const t = state.clock.getElapsedTime() + seed * 100; - const hopHeight = Math.max(0, Math.sin(t * 4) * 0.5); - const curX = startX + Math.sin(t * 0.5) * 2; - const curZ = startZ + Math.cos(t * 0.5) * 2; - ref.current.position.set(curX, getSurfaceHeight(curX, curZ) + hopHeight, curZ); - ref.current.rotation.y = t * 0.5 + Math.PI / 2; - } - }); - - return ( - - - - - - - ); -}; - -const Palisade = ({ position, rotationY = 0, length = 5 }: { position: [number, number, number], rotationY?: number, length?: number }) => { - const logs = []; - for (let i = 0; i < length; i++) { - logs.push( - - - - - ); - } - return {logs}; -}; - -const Mountain = ({ position, scale = [15, 20, 15], color = "#4a4a4a" }: { position: [number, number, number], scale?: [number, number, number], color?: string }) => { - return ( - - - - - ); -}; - -const Cottage = ({ position, rotationY = 0 }: { position: [number, number, number], rotationY?: number }) => { - return ( - - - - - - - - ); -}; - -const Castle = ({ position, rotationY = 0, scale = 1 }: { position: [number, number, number], rotationY?: number, scale?: number }) => { - return ( - - - {[ [-3, 4, -3], [3, 4, -3], [-3, 4, 3], [3, 4, 3] ].map((pos, i) => ( - - - - - ))} - - - ); -}; - -const Terrain = ({ isNight }: { isNight: boolean }) => { - const vertices = useMemo(() => { - const size = 160; - const segments = 60; - const geometry = new THREE.PlaneGeometry(size, size, segments, segments); - const pos = geometry.attributes.position; - for (let i = 0; i < pos.count; i++) { - pos.setZ(i, getTerrainHeight(pos.getX(i), pos.getY(i)) + 0.55); - } - geometry.computeVertexNormals(); - return geometry; - }, []); - return ; -}; - -const River = ({ windStrength = 1.0 }: { windStrength?: number }) => { - const meshRef = useRef(null); - const riverGeom = useMemo(() => { - const segments = 100; - const width = 15; - const length = 200; - const geometry = new THREE.PlaneGeometry(width, length, 1, segments); - const pos = geometry.attributes.position; - for (let i = 0; i < pos.count; i++) { - const x = pos.getX(i); - const z = pos.getY(i); - // Synchronize with terrain's riverCenter: 45 + Math.sin(z * 0.05) * 12 - const xOffset = Math.sin(z * 0.05) * 12; - pos.setX(i, x + xOffset); - - // Water surface level should be below the terrain top but above the bed - // World Y will be MeshY + pos.Z. - // We want World Y to be around -1.2 in the deep parts - pos.setZ(i, -0.6 + 0.55); - } - geometry.computeVertexNormals(); - return geometry; - }, []); - - useFrame((state) => { - if (meshRef.current) { - const time = state.clock.getElapsedTime(); - meshRef.current.position.y = -0.55 + Math.sin(time * 0.5) * 0.02 * windStrength; - } - }); - - return ( - - - - ); -}; - -export const HorseModel = ({ color = "#8d6e63", scale = 1, animate = true }: { color?: string, scale?: number, animate?: boolean }) => { - const headRef = useRef(null); - const tailRef = useRef(null); - useFrame((state) => { - if (animate) { - const time = state.clock.getElapsedTime(); - if (headRef.current) headRef.current.rotation.x = Math.sin(time * 0.5) * 0.1; - if (tailRef.current) tailRef.current.rotation.z = Math.sin(time * 2) * 0.2; - } - }); - return ( - - - - - {[ [0.15, 0.3, 0.35], [-0.15, 0.3, 0.35], [0.15, 0.3, -0.35], [-0.15, 0.3, -0.35] ].map((pos, i) => ( - - ))} - - - ); -}; - -export const KnightPieceModel = ({ color, stripeColor, scale = 1 }: { color: string, stripeColor: string, scale?: number }) => { - return ( - - - - - - - - - - - - ); -}; - -const Banner = ({ position, color = "red" }: { position: [number, number, number], color?: string }) => { - const meshRef = useRef(null); - useFrame((state) => { - if (meshRef.current) { - const time = state.clock.getElapsedTime(); - meshRef.current.rotation.y = Math.sin(time * 3) * 0.3; - meshRef.current.rotation.x = Math.cos(time * 2) * 0.15; - } - }); - return ( - - - - - ); -}; - -const DecorativeItems = ({ position, rotationY }: { position: [number, number, number], rotationY: number }) => { - const y = getSurfaceHeight(position[0], position[2]); - return ( - - - - - - - - - - - - - - ); -}; - -const Firecamp = ({ position }: { position: [number, number, number] }) => { - const lightRef = useRef(null); - useFrame((state) => { - if (lightRef.current) lightRef.current.intensity = 2 + Math.sin(state.clock.getElapsedTime() * 10) * 0.5; - }); - const y = getSurfaceHeight(position[0], position[2]); - return ( - - - - - - - - - - - - ); -}; - -const WindParticles = () => { - return ( - - - - - ); -}; - -const StonePlaza = ({ isNight }: { isNight: boolean }) => { - const plazaColor = isNight ? "#1a1a1a" : "#4a4a4a"; - const rimColor = isNight ? "#111" : "#333"; - - // Use polygonOffset to help Three.js resolve depth for overlapping planes - const stoneMaterialProps = { - polygonOffset: true, - polygonOffsetFactor: -1, - polygonOffsetUnits: -1, - }; - - const scatteredStones = useMemo(() => { - return Array.from({ length: 16 }).map((_, i) => { - const angle = (i / 16) * Math.PI * 2 + Math.random() * 0.2; - const dist = 13.5 + Math.random() * 2.5; - const scale = 0.5 + Math.random() * 1.5; - const x = Math.cos(angle) * dist; - const z = Math.sin(angle) * dist; - const y = getTerrainHeight(x, z) + 0.75; - return { id: i, position: [x, y, z] as [number, number, number], rotation: [-Math.PI / 2, 0, angle] as [number, number, number], scale: [scale, scale, 1.5] as [number, number, number] }; - }); - }, []); - - return ( - - {/* Foundation - Tiered stone slabs - Deep foundation to prevent floating */} - - - - - - {/* Main Elevated Plaza */} - - - - - - {/* Decorative Rim */} - - - - - - {/* Corner Pillars/Stones */} - {[0, Math.PI/2, Math.PI, Math.PI*1.5].map((angle, i) => ( - - - - - - - - - - - ))} - - {/* Decorative Stone Tiles/Slabs scattered around */} - {scatteredStones.map(stone => ( - - - - - ))} - - {/* Steps leading up to the board area */} - {[0, Math.PI].map((angle, i) => ( - - - - - - - - - - - ))} - - ); -}; - -const StoneBridge = ({ position, rotationY = 0, length = 22 }: { position: [number, number, number], rotationY?: number, length?: number }) => { - return ( - - {/* Main Path */} - - - - - {/* Side Rails */} - - - - - - - - - {/* Support Pillars */} - {[-0.3, 0.3].map((offset, i) => ( - - - - - ))} - - ); -}; - -const Onager = ({ position, rotationY = 0, isNight, isUsed, isSelected, color, onClick }: { - position: [number, number, number], - rotationY?: number, - isNight: boolean, - isUsed: boolean, - isSelected?: boolean, - color: string, - onClick: () => void -}) => { - const woodColor = isNight ? "#1a1510" : "#4d2c19"; - const metalColor = "#333"; - const [hovered, setHovered] = useState(false); - useCursor(hovered && !isUsed); - - return ( - { e.stopPropagation(); onClick(); }} - onPointerOver={() => setHovered(true)} - onPointerOut={() => setHovered(false)} - > - {/* Selection Glow - Enhanced Energy Field */} - {isSelected && ( - - - - - - - - - - - - - - )} - - {/* Main Chassis - Scaled down to 0.5 for better fit */} - - {/* Longitudinal Beams */} - - - - - - - - - - {/* Cross Beams with Bolts */} - {[ -2, -0.5, 0.5, 2 ].map(z => ( - - - - - - {/* Bolts */} - - - - ))} - - {/* Wheels with detailed hubs and iron rims */} - {[-1, 1].map(x => [ -2, 2 ].map(z => ( - - {/* Outer Rim */} - - - - - {/* Wood Spokes */} - - - - - {/* Metal Hub */} - 0 ? 0.1 : -0.1, 0, 0]}> - - - - - )))} - - {/* Side Frames (A-Frame) - More sturdy */} - {[-0.7, 0.7].map(x => ( - - - - - - - - - - {/* Horizontal axle support */} - - - - - - ))} - - {/* THE ARM - Cocked (bottom) or Fired (top) */} - {/* Facing logic: Cocked leans AWAY from board, Fired leans TOWARDS board */} - - - - - - - {/* Team Color Stripe on Arm */} - - - - - - {/* Bucket/Sling - More detail */} - - - - - - {/* Iron Bands on Bucket */} - - - - - - {/* Projectile (Rock) - Only visible if not used */} - {!isUsed && ( - - - - - )} - - - {/* Counterweight Box */} - - - - - - {/* Metal trim on counterweight */} - - - - - - - - {/* Winch and Rope detail */} - {!isUsed && ( - - - - - - - - - - - )} - - - ); -}; - -export const Scenery = ({ - isNight, - windStrength = 1.0, - whiteSiegeUsed, - blackSiegeUsed, - selectedOnagerColor, - whiteColor, - blackColor, - onOnagerClick -}: { - isNight: boolean, - windStrength?: number, - whiteSiegeUsed: boolean, - blackSiegeUsed: boolean, - selectedOnagerColor: 'white' | 'black' | null, - whiteColor: string, - blackColor: string, - onOnagerClick: (color: 'white' | 'black') => void -}) => { - const trees = useMemo(() => { - const list = []; - // More trees! - for (let i = 0; i < 45; i++) { - const angle = Math.random() * Math.PI * 2; - const radius = 22 + Math.random() * 35; - list.push({ pos: [Math.cos(angle) * radius, 0, Math.sin(angle) * radius] as [number, number, number], seed: Math.random() }); - } - return list; - }, []); - - const grassTufts = useMemo(() => { - const tufts = []; - for (let i = 0; i < 100; i++) { - const angle = Math.random() * Math.PI * 2; - const radius = 8 + Math.random() * 40; - tufts.push({ pos: [Math.cos(angle) * radius, -0.5, Math.sin(angle) * radius] as [number, number, number], seed: Math.random() }); - } - return tufts; - }, []); - - const flowers = useMemo(() => { - const list = []; - const colors = ["#f44336", "#e91e63", "#9c27b0", "#ffeb3b"]; - for (let i = 0; i < 40; i++) { - const angle = Math.random() * Math.PI * 2; - const radius = 10 + Math.random() * 25; - list.push({ pos: [Math.cos(angle) * radius, -0.5, Math.sin(angle) * radius] as [number, number, number], color: colors[Math.floor(Math.random() * colors.length)] }); - } - return list; - }, []); - - const rabbits = useMemo(() => { - const list = []; - for (let i = 0; i < 6; i++) { - const angle = Math.random() * Math.PI * 2; - const radius = 12 + Math.random() * 15; - list.push({ pos: [Math.cos(angle) * radius, -0.5, Math.sin(angle) * radius] as [number, number, number], seed: Math.random() }); - } - return list; - }, []); - - const mountains: { pos: [number, number, number], scale: [number, number, number], color: string }[] = useMemo(() => [ - { pos: [-60, 0, -60], scale: [40, 50, 40], color: "#3a3a3a" }, - { pos: [60, 0, 60], scale: [45, 60, 45], color: "#4a4a4a" }, - { pos: [-60, 0, 60], scale: [40, 55, 40], color: "#2a2a2a" }, - { pos: [60, 0, -60], scale: [50, 70, 50], color: "#333333" }, - { pos: [0, -5, -80], scale: [70, 40, 40], color: "#222222" }, - { pos: [80, -5, 0], scale: [40, 45, 70], color: "#444444" }, - ], []); - - const decoItems = useMemo(() => [ - { pos: [-5, 0, -2], rot: 0.5 }, { pos: [6, 0, 5], rot: 2.1 }, { pos: [-3, 0, 8], rot: 4.5 } - ], []); - - const bushes = useMemo(() => [ - { pos: [-12, -0.5, -5], scale: 1 }, { pos: [10, -0.5, 8], scale: 1.2 }, { pos: [-5, -0.5, 12], scale: 0.8 }, - { pos: [15, -0.5, -10], scale: 1.1 }, { pos: [0, -0.5, -20], scale: 1.3 } - ], []); - - const firecamps: [number, number, number][] = [[-6, 0, -6], [6, 0, 6], [-6, 0, 6], [6, 0, -6], [-15, 0, 0], [15, 0, 0], [0, 0, 15], [0, 0, -15]]; - - return ( - - - - - - - - - {mountains.map((m, i) => )} - - - - - - - - - - - - - {trees.map((tree, i) => )} - {bushes.map((bush, i) => )} - {grassTufts.map((grass, i) => )} - {flowers.map((f, i) => )} - {rabbits.map((r, i) => )} - - - - - {/* Siege Engines */} - onOnagerClick('white')} - /> - onOnagerClick('black')} - /> - - {decoItems.map((item) => )} - - {isNight && firecamps.map((pos, i) => )} - - ); -}; diff --git a/client/src/game/ChessAI.ts b/client/src/game/ChessAI.ts deleted file mode 100644 index 0e29d08..0000000 --- a/client/src/game/ChessAI.ts +++ /dev/null @@ -1,159 +0,0 @@ -import type { Piece, PieceType, PlayerColor, Position } from '../types'; -import { getValidMoves, getDiceSides } from './ChessLogic'; - -const getPieceValue = (type: PieceType): number => { - switch (type) { - case 'pawn': return 10; - case 'knight': return 30; - case 'bishop': return 30; - case 'rook': return 50; - case 'queen': return 90; - case 'king': return 1000; // High value to prioritize killing/saving king - default: return 0; - } -}; - -const evaluatePiece = (piece: Piece): number => { - const baseValue = getPieceValue(piece.type); - const hpPercent = piece.hp / piece.maxHp; - const statsBonus = (piece.kills * 2) + (piece.defends * 2); - return (baseValue * hpPercent) + statsBonus; -}; - -export const calculateBestMove = ( - pieces: Piece[], - color: PlayerColor, - siegeUsed: boolean -): { piece: Piece, target: Position, score: number, isSiege?: boolean } | null => { - const myPieces = pieces.filter(p => p.color === color && p.hp > 0); - const enemyPieces = pieces.filter(p => p.color !== color && p.hp > 0); - const myKing = myPieces.find(p => p.type === 'king'); - - // --- Defensive Analysis --- - // Identify all squares currently threatened by the enemy - const threatenedSquares: Set = new Set(); - enemyPieces.forEach(ep => { - const moves = getValidMoves(ep, pieces); - moves.forEach(m => threatenedSquares.add(`${m.x},${m.y}`)); - }); - - const isKingThreatened = myKing && threatenedSquares.has(`${myKing.x},${myKing.y}`); - - let bestMove: { piece: Piece, target: Position, score: number, isSiege?: boolean } | null = null; - let bestScore = -Infinity; - - // --- Consider Siege Attack --- - if (!siegeUsed) { - const rangeY = color === 'black' ? [4, 5, 6, 7] : [0, 1, 2, 3]; - const targets = enemyPieces.filter(p => rangeY.includes(p.y)); - - for (const target of targets) { - const avgDmg = 14; - let score = 0; - - if (target.hp <= avgDmg) { - score = evaluatePiece(target) * 3; - if (target.type === 'king') score += 10000; - } else { - score = avgDmg * 2; - } - - // If our King is in danger, prioritizing Siege on the biggest threat might help - if (isKingThreatened) score += 1000; - - if (score > bestScore) { - bestScore = score; - bestMove = { - piece: { id: 'onager' } as Piece, - target: { x: target.x, y: target.y }, - score, - isSiege: true - }; - } - } - } - - // --- Consider Normal Moves --- - const shuffledPieces = [...myPieces].sort(() => Math.random() - 0.5); - - for (const piece of shuffledPieces) { - const validMoves = getValidMoves(piece, pieces); - - for (const move of validMoves) { - let score = 0; - const targetPiece = pieces.find(p => p.x === move.x && p.y === move.y); - - // 1. Combat Evaluation - if (targetPiece && targetPiece.color !== color) { - const attackerVal = evaluatePiece(piece); - const defenderVal = evaluatePiece(targetPiece); - const attackerDice = getDiceSides(piece.type); - const defenderDice = getDiceSides(targetPiece.type); - - const expectedAttackerTotal = (attackerDice / 2) + piece.kills; - const expectedDefenderTotal = (defenderDice / 2) + targetPiece.defends - (targetPiece.isDebuffed ? 2 : 0); - - // AI is now more willing to take "even" or slightly risky fights - if (expectedAttackerTotal >= expectedDefenderTotal - 1) { - score += defenderVal * 3; // Increased attack weight - if (targetPiece.type === 'king') score += 5000; - - // HUNTER BONUS: Target vulnerable pieces! - if (targetPiece.isDebuffed) score += 40; - - // Defensive bonus: reward killing a piece that is threatening our King - if (isKingThreatened) { - const enemyThreats = getValidMoves(targetPiece, pieces); - if (myKing && enemyThreats.some(mt => mt.x === myKing.x && mt.y === myKing.y)) { - score += 2000; // Priority: Kill the assassin (Toned down from 8000) - } - } - } else { - score -= attackerVal * 0.5; // Less afraid of losing pieces - } - } else { - // 2. Positional Evaluation - const advanceBonus = color === 'black' ? (piece.y - move.y) : (move.y - piece.y); - score += advanceBonus * 2; // Increased advance weight (from 0.5) - - const centerDist = Math.abs(3.5 - move.x) + Math.abs(3.5 - move.y); - score -= centerDist * 0.5; - - if (piece.type === 'pawn' && (move.y === 0 || move.y === 7)) { - score += 150; // High priority for promotion - } - - // 3. KING SAFETY LOGIC (Toned down to prevent "Coward AI") - if (myKing) { - if (piece.type === 'king' && isKingThreatened) { - if (!threatenedSquares.has(`${move.x},${move.y}`)) { - score += 3000; // Run away if in danger (Toned down from 9000) - } - } - - const distToKingAfter = Math.abs(move.x - myKing.x) + Math.abs(move.y - myKing.y); - if (piece.type !== 'king') { - if (distToKingAfter <= 2) { - score += 5; // Minimal Guardian bonus (Toned down from 15) - } - if (isKingThreatened) { - const distToKingBefore = Math.abs(piece.x - myKing.x) + Math.abs(piece.y - myKing.y); - if (distToKingAfter < distToKingBefore) { - score += 15; // Small hustle to help (Toned down from 40) - } - } - } - } - } - - score += Math.random() * 2; - - if (score > bestScore) { - bestScore = score; - bestMove = { piece, target: { x: move.x, y: move.y }, score }; - } - } - } - - return bestMove; -}; diff --git a/client/src/game/ChessLogic.ts b/client/src/game/ChessLogic.ts deleted file mode 100644 index 03cf8ad..0000000 --- a/client/src/game/ChessLogic.ts +++ /dev/null @@ -1,148 +0,0 @@ -import type { Piece, PieceType, PlayerColor, Position } from '../types'; - -export const setupBoard = (): Piece[] => { - const pieces: Piece[] = []; - - const getInitialHp = (type: PieceType): number => { - switch (type) { - case 'pawn': return 10; - case 'knight': return 20; - case 'bishop': return 20; - case 'rook': return 30; - case 'queen': return 40; - case 'king': return 15; - default: return 10; - } - }; - - const createPiece = (type: PieceType, color: PlayerColor, x: number, y: number): Piece => { - const hp = getInitialHp(type); - const secondaryColor = color === 'white' ? '#d4af37' : '#ff5252'; // Gold for white, Bright red for black - return { - id: `${type}-${color}-${x}-${y}-${Math.random().toString(36).substr(2, 9)}`, - type, color, secondaryColor, x, y, kills: 0, defends: 0, hp, maxHp: hp, - hasMoved: false, - status: 'idle' - }; - }; - - // Pawns - for (let x = 0; x < 8; x++) { - pieces.push(createPiece('pawn', 'white', x, 1)); - pieces.push(createPiece('pawn', 'black', x, 6)); - } - - const backRowTypes: PieceType[] = ['rook', 'knight', 'bishop', 'queen', 'king', 'bishop', 'knight', 'rook']; - backRowTypes.forEach((type, x) => { - pieces.push(createPiece(type, 'white', x, 0)); - pieces.push(createPiece(type, 'black', x, 7)); - }); - - return pieces; -}; - -const getPieceAt = (pieces: Piece[], x: number, y: number) => pieces.find(p => p.x === x && p.y === y); - -export const getValidMoves = (piece: Piece, pieces: Piece[]): Position[] => { - const moves: Position[] = []; - const { x, y, color, type } = piece; - - const addMove = (nx: number, ny: number, allowCapture = true, requireCapture = false) => { - if (nx < 0 || nx > 7 || ny < 0 || ny > 7) return false; - const target = getPieceAt(pieces, nx, ny); - if (!target && !requireCapture) { - moves.push({ x: nx, y: ny }); - return true; // continue scanning - } - if (target) { - if (target.color !== color && allowCapture) { - moves.push({ x: nx, y: ny }); - } - return false; // blocked - } - return false; - }; - - const scanDir = (dx: number, dy: number) => { - for (let i = 1; i < 8; i++) { - if (!addMove(x + dx * i, y + dy * i)) break; - } - }; - - switch (type) { - case 'pawn': { - const dir = color === 'white' ? 1 : -1; - const startRow = color === 'white' ? 1 : 6; - // Forward - if (!getPieceAt(pieces, x, y + dir)) { - addMove(x, y + dir, false); - // Double forward - if (y === startRow && !getPieceAt(pieces, x, y + dir * 2)) { - addMove(x, y + dir * 2, false); - } - } - // Captures - addMove(x - 1, y + dir, true, true); - addMove(x + 1, y + dir, true, true); - break; - } - case 'knight': { - const jumps = [[-2,-1],[-2,1],[-1,-2],[-1,2],[1,-2],[1,2],[2,-1],[2,1]]; - jumps.forEach(([dx, dy]) => addMove(x + dx, y + dy)); - break; - } - case 'rook': { - scanDir(0, 1); scanDir(0, -1); scanDir(1, 0); scanDir(-1, 0); - break; - } - case 'bishop': { - scanDir(1, 1); scanDir(1, -1); scanDir(-1, 1); scanDir(-1, -1); - break; - } - case 'queen': { - scanDir(0, 1); scanDir(0, -1); scanDir(1, 0); scanDir(-1, 0); - scanDir(1, 1); scanDir(1, -1); scanDir(-1, 1); scanDir(-1, -1); - break; - } - case 'king': { - const dirs = [[0,1],[0,-1],[1,0],[-1,0],[1,1],[1,-1],[-1,1],[-1,-1]]; - dirs.forEach(([dx, dy]) => addMove(x + dx, y + dy)); - - // Castling - if (!piece.hasMoved) { - const row = color === 'white' ? 0 : 7; - // Kingside - const rookK = pieces.find(p => p.type === 'rook' && p.color === color && p.x === 7 && p.y === row); - if (rookK && !rookK.hasMoved && !getPieceAt(pieces, 5, row) && !getPieceAt(pieces, 6, row)) { - moves.push({ x: 6, y: row }); - } - // Queenside - const rookQ = pieces.find(p => p.type === 'rook' && p.color === color && p.x === 0 && p.y === row); - if (rookQ && !rookQ.hasMoved && !getPieceAt(pieces, 1, row) && !getPieceAt(pieces, 2, row) && !getPieceAt(pieces, 3, row)) { - moves.push({ x: 2, y: row }); - } - } - break; - } - } - - return moves; -}; - -export const getDiceSides = (type: PieceType): number => { - switch (type) { - case 'pawn': return 6; - case 'knight': return 10; - case 'bishop': return 12; - case 'rook': return 15; - case 'queen': return 18; - case 'king': return 20; - default: return 20; - } -}; - -// Piece-specific dice rolls -export const rollDice = (type: PieceType) => { - const sides = getDiceSides(type); - return Math.floor(Math.random() * sides) + 1; -}; diff --git a/client/src/game/useAudio.ts b/client/src/game/useAudio.ts deleted file mode 100644 index 8d0e20b..0000000 --- a/client/src/game/useAudio.ts +++ /dev/null @@ -1,138 +0,0 @@ -import { useEffect, useRef, useState, useMemo } from 'react'; - -// Using local reliable audio assets from public/sounds -const basePath = import.meta.env.BASE_URL; - -const SOUND_URLS = { - select: `${basePath}sounds/button-16a.mp3`, - move: `${basePath}sounds/marching.mp3`, - attack: `${basePath}sounds/clong-2.mp3`, - victory: `${basePath}sounds/button-21.mp3`, - defeat: `${basePath}sounds/button-19.mp3`, - siege: `${basePath}sounds/bomb-falling-and-exploding-01.mp3`, - menu: `${basePath}sounds/page-flip-03.mp3`, -}; - -const AMBIENT_URLS = { - wood: `${basePath}sounds/wood-chop-axe-hit-02.mp3`, - wind: `${basePath}sounds/wind-howl-01.mp3`, - shovel: `${basePath}sounds/shovel-into-snow-1.mp3`, -}; - -const BGM_URL = `${basePath}sounds/fire-1.mp3`; - -export const useAudio = () => { - const [volume, setVolume] = useState(0.5); - const [isMuted, setIsMuted] = useState(false); - const bgmRef = useRef(null); - const [isMusicStarted, setIsMusicStarted] = useState(false); - - // Pre-load SFX - const sfxObjects = useMemo(() => { - const objs: Record = {}; - Object.entries(SOUND_URLS).forEach(([name, url]) => { - const audio = new Audio(url); - audio.preload = 'auto'; - objs[name] = audio; - }); - return objs; - }, []); - - // Pre-load Ambient sounds - const ambientObjects = useMemo(() => { - const objs: Record = {}; - Object.entries(AMBIENT_URLS).forEach(([name, url]) => { - const audio = new Audio(url); - audio.preload = 'auto'; - objs[name] = audio; - }); - return objs; - }, []); - - useEffect(() => { - bgmRef.current = new Audio(BGM_URL); - bgmRef.current.loop = true; - bgmRef.current.volume = volume; - - return () => { - if (bgmRef.current) { - bgmRef.current.pause(); - bgmRef.current = null; - } - }; - }, []); - - // Ambient sound scheduler - useEffect(() => { - if (!isMusicStarted || isMuted) { - // If muted, stop all active ambient sounds immediately - Object.values(ambientObjects).forEach(amb => { - amb.pause(); - amb.currentTime = 0; - }); - return; - } - - const playRandomAmbient = () => { - if (isMuted) return; - - const keys = Object.keys(ambientObjects); - const randomKey = keys[Math.floor(Math.random() * keys.length)]; - const audio = ambientObjects[randomKey]; - - if (audio) { - audio.currentTime = 0; - audio.volume = volume * 0.6; - audio.play().catch(() => {}); - } - - // Schedule next sound between 15 and 45 seconds - const nextDelay = 15000 + Math.random() * 30000; - return setTimeout(playRandomAmbient, nextDelay); - }; - - const timer = setTimeout(playRandomAmbient, 10000); // Start first one after 10s - return () => clearTimeout(timer); - }, [isMusicStarted, isMuted, ambientObjects]); // Remove volume from deps to avoid restarting timer on volume change - - useEffect(() => { - const currentVol = isMuted ? 0 : volume; - if (bgmRef.current) bgmRef.current.volume = currentVol; - - // Update all SFX volumes - Object.values(sfxObjects).forEach(sfx => { - sfx.volume = currentVol; - }); - - // Update all Ambient volumes - Object.values(ambientObjects).forEach(amb => { - amb.volume = currentVol * 0.6; - }); - }, [volume, isMuted, sfxObjects, ambientObjects]); - - const playSound = (soundName: keyof typeof SOUND_URLS) => { - if (isMuted) return; - const audio = sfxObjects[soundName]; - if (audio) { - audio.currentTime = 0; - audio.play().catch(() => {}); - } - }; - - const startMusic = () => { - if (bgmRef.current && bgmRef.current.paused) { - bgmRef.current.play().then(() => { - setIsMusicStarted(true); - }).catch(_e => console.log("BGM play blocked by browser policy")); - } - }; - - return { - volume, - setVolume, - isMuted, - setIsMuted, - playSound, - startMusic - }; -}; diff --git a/client/src/game/useChessGame.ts b/client/src/game/useChessGame.ts deleted file mode 100644 index 1b40b59..0000000 --- a/client/src/game/useChessGame.ts +++ /dev/null @@ -1,450 +0,0 @@ -import { useState, useEffect } from 'react'; -import type { Piece, BattleResult, LogEntry, Position as _Position } from '../types'; -import { setupBoard, getValidMoves, rollDice, getDiceSides } from './ChessLogic'; -import { calculateBestMove } from './ChessAI'; - -export const useChessGame = (playSound: (name: any) => void) => { - const [pieces, setPieces] = useState(setupBoard()); - const [turn, setTurn] = useState<'white' | 'black'>('white'); - const [selectedPieceId, setSelectedPieceId] = useState(null); - const [selectedOnagerColor, setSelectedOnagerColor] = useState<'white' | 'black' | null>(null); - const [battleResult, setBattleResult] = useState(null); - const [isRolling, setIsRolling] = useState(false); - const [isPaused, setIsPaused] = useState(false); - const [winner, setWinner] = useState<'white' | 'black' | null>(null); - const [isNight, setIsNight] = useState(false); - const [hasStarted, setHasStarted] = useState(false); - const [isVsAI, setIsVsAI] = useState(false); - const [playerColor, setPlayerColor] = useState<'white' | 'black'>('white'); - const [turnCount, setTurnCount] = useState(1); - const [aiMoveSequence, setAiMoveSequence] = useState<{ step: number, move: { startX: number, startY: number, targetX: number, targetY: number } } | null>(null); - const [fogNear, setFogNear] = useState(10); - const [fogFar, setFogFar] = useState(80); - const [logs, setLogs] = useState([]); - const [boardStyle, setBoardStyle] = useState<'wood' | 'stone' | 'marble'>('wood'); - const [windStrength, setWindStrength] = useState(1.0); - const [whiteColor, setWhiteColor] = useState('#f0d9b5'); - const [blackColor, setBlackColor] = useState('#4a4a4a'); - const [showCoordinates, setShowCoordinates] = useState(false); - - const addLog = (message: string, type: LogEntry['type']) => { - const newLog: LogEntry = { - id: Math.random().toString(36).substr(2, 9), - message, - type, - timestamp: Date.now() - }; - setLogs(prev => [newLog, ...prev].slice(0, 50)); // Keep last 50 logs - }; - - const [whiteSiegeUsed, setWhiteSiegeUsed] = useState(false); - const [blackSiegeUsed, setBlackSiegeUsed] = useState(false); - const [isSiegeFiring, setIsSiegeFiring] = useState<'white' | 'black' | null>(null); - - const fireSiege = (color: 'white' | 'black', targetX: number, targetY: number) => { - if (color === 'white' && whiteSiegeUsed) return; - if (color === 'black' && blackSiegeUsed) return; - if (turn !== color || isRolling || isPaused || winner || !hasStarted) return; - - const targetPiece = pieces.find(p => p.x === targetX && p.y === targetY); - if (!targetPiece) return; - - setIsSiegeFiring(color); - if (color === 'white') setWhiteSiegeUsed(true); - else setBlackSiegeUsed(true); - - playSound('siege'); - addLog(`${color.toUpperCase()} FIRED THE ONAGER at ${targetPiece.color} ${targetPiece.type}!`, 'siege'); - - setTimeout(() => { - const dmg = Math.floor(Math.random() * 5) + 12; // 12-16 - - // We'll show a battle result for the siege too! - setBattleResult({ - attackerRoll: dmg, - attackerTotal: dmg, - attackerStats: 0, - attackerDice: 16, - attackerColor: color, - defenderRoll: targetPiece.hp, - defenderTotal: Math.max(0, targetPiece.hp - dmg), - defenderStats: 0, - defenderDice: 0, - defenderDebuff: 0, - isSiege: true, - success: dmg >= targetPiece.hp, - targetX, - targetY - }); - - setPieces(prev => prev.map(p => { - if (p.id === targetPiece.id) { - const newHp = Math.max(0, p.hp - dmg); - if (newHp === 0) { - if (p.type === 'king') setWinner(color); - return { ...p, hp: 0, status: 'dying' as const }; - } - return { ...p, hp: newHp }; - } - return p; - })); - - setTimeout(() => { - setPieces(prev => prev.filter(p => p.hp > 0 || p.status !== 'dying')); - setIsSiegeFiring(null); - nextTurn(color); - }, 1000); - }, 1500); - }; - - const resetGame = () => { - setPieces(setupBoard()); - setTurn('white'); - setTurnCount(1); - setSelectedPieceId(null); - setBattleResult(null); - setIsRolling(false); - setIsPaused(false); - setWinner(null); - setHasStarted(false); // Return to main menu - setLogs([]); - setWhiteSiegeUsed(false); - setBlackSiegeUsed(false); - setIsSiegeFiring(null); - }; - - const getPieceAt = (x: number, y: number) => pieces.find(p => p.x === x && p.y === y); - - const nextTurn = (currentTurn: 'white' | 'black') => { - const nextPlayer = currentTurn === 'white' ? 'black' : 'white'; - setTurn(nextPlayer); - if (nextPlayer === 'white') { - setTurnCount(prev => prev + 1); - } - // Clear debuffs for the player who is about to start their turn - setPieces(prev => prev.map(p => p.color === nextPlayer ? { ...p, isDebuffed: false } : p)); - }; - - const handleOnagerClick = (color: 'white' | 'black') => { - if (isRolling || isPaused || winner || !hasStarted || turn !== color) return; - if (color === 'white' && whiteSiegeUsed) return; - if (color === 'black' && blackSiegeUsed) return; - - playSound('select'); - setSelectedOnagerColor(color); - setSelectedPieceId(null); - }; - - const handleSquareClick = (x: number, y: number, isAiCall: boolean = false) => { - if (isRolling || isPaused || winner || !hasStarted) return; - - // Block HUMAN input if it's the AI's turn - const aiColor = playerColor === 'white' ? 'black' : 'white'; - if (isVsAI && turn === aiColor && !isAiCall) return; - - // Clear battle result on next action if it's already shown - if (battleResult && !isRolling) setBattleResult(null); - - // Case 1: Onager is selected and we click a target - if (selectedOnagerColor) { - const clickedPiece = getPieceAt(x, y); - const isInRange = selectedOnagerColor === 'white' ? (y <= 3) : (y >= 4); - - if (clickedPiece && clickedPiece.color !== selectedOnagerColor && isInRange) { - fireSiege(selectedOnagerColor, x, y); - setSelectedOnagerColor(null); - return; - } - // If we clicked something else, deselect onager - setSelectedOnagerColor(null); - } - - const clickedPiece = getPieceAt(x, y); - const selectedPiece = pieces.find(p => p.id === selectedPieceId); - - // If a piece is selected and a valid move is chosen - if (selectedPiece) { - const validMoves = getValidMoves(selectedPiece, pieces); - const isValidMove = validMoves.some(m => m.x === x && m.y === y); - - if (isValidMove) { - if (clickedPiece && clickedPiece.color !== selectedPiece.color) { - // RPG Battle Phase! - playSound('attack'); - const attackerRoll = rollDice(selectedPiece.type); - const defenderRoll = rollDice(clickedPiece.type); - const attackerTotal = Math.max(0, attackerRoll + Math.min(selectedPiece.kills, 5)); - - // Apply -2 defense penalty if defender is debuffed - const defPenalty = clickedPiece.isDebuffed ? 2 : 0; - const defenderTotal = Math.max(0, defenderRoll + Math.min(clickedPiece.defends, 5) - defPenalty); - - const success = attackerTotal > defenderTotal; - const damage = Math.abs(attackerTotal - defenderTotal); - - setIsRolling(true); - setBattleResult({ - attackerRoll, attackerTotal, attackerStats: Math.min(selectedPiece.kills, 5), - attackerDice: getDiceSides(selectedPiece.type), - attackerColor: selectedPiece.color, - defenderRoll, defenderTotal, defenderStats: Math.min(clickedPiece.defends, 5), - defenderDice: getDiceSides(clickedPiece.type), - defenderDebuff: defPenalty, - isSiege: false, - success, - targetX: x, targetY: y - }); - - setTimeout(() => { - setIsRolling(false); - if (success) { - playSound('victory'); - // Attacker wins - const newHp = clickedPiece.hp - damage; - const defenderKilled = newHp <= 0; - - if (defenderKilled) { - if (clickedPiece.type === 'king') { - setWinner(selectedPiece.color); - addLog(`${selectedPiece.color.toUpperCase()} SLAUGHTERED THE KING!`, 'kill'); - } else { - addLog(`${selectedPiece.color} ${selectedPiece.type} killed ${clickedPiece.color} ${clickedPiece.type}`, 'kill'); - } - - // EXECUTION ANIMATION START - setPieces(prev => prev.map(p => { - if (p.id === selectedPiece.id) return { ...p, status: 'attacking' as const }; - if (p.id === clickedPiece.id) return { ...p, status: 'dying' as const, hp: 0 }; - return p; - })); - - setTimeout(() => { - const isPromotion = selectedPiece.type === 'pawn' && (y === 0 || y === 7); - if (isPromotion) { - addLog(`${selectedPiece.color} Pawn promoted to Queen!`, 'promotion'); - } - - setPieces(prev => prev.map(p => { - if (p.id === selectedPiece.id) { - let type = p.type; - let maxHp = p.maxHp; - let hp = p.hp; - // Promotion - if (isPromotion) { - type = 'queen'; - maxHp = 40; - hp = 40; - } - return { ...p, x, y, type, hp, maxHp, kills: Math.min(p.kills + 1, 5), hasMoved: true, status: 'idle' as const }; - } - return p; - }).filter(p => p.id !== clickedPiece.id)); - }, 1000); // 1s for the killing animation - - } else { - addLog(`${selectedPiece.color} ${selectedPiece.type} dealt ${damage} dmg to ${clickedPiece.color} ${clickedPiece.type}`, 'attack'); - setPieces(prev => prev.map(p => { - if (p.id === clickedPiece.id) return { ...p, hp: newHp }; - if (p.id === selectedPiece.id) return { ...p, hasMoved: true }; - return p; - })); - } - } else { - playSound('defeat'); - // Defender wins (or draw) - const newHp = selectedPiece.hp - (damage === 0 ? 1 : damage); // Draw deals 1 damage to attacker - const attackerKilled = newHp <= 0; - - if (attackerKilled) { - addLog(`${clickedPiece.color} ${clickedPiece.type} counter-killed ${selectedPiece.color} ${selectedPiece.type}`, 'kill'); - if (selectedPiece.type === 'king') { - setWinner(clickedPiece.color); - addLog(`${clickedPiece.color.toUpperCase()} DEFENDED THE THRONE!`, 'kill'); - } - - // EXECUTION ANIMATION START (Counter kill) - setPieces(prev => prev.map(p => { - if (p.id === clickedPiece.id) return { ...p, status: 'attacking' as const }; - if (p.id === selectedPiece.id) return { ...p, status: 'dying' as const, hp: 0 }; - return p; - })); - - setTimeout(() => { - setPieces(prev => prev.map(p => { - if (p.id === clickedPiece.id) return { ...p, defends: Math.min(p.defends + 1, 5), status: 'idle' as const }; - return p; - }).filter(p => p.id !== selectedPiece.id)); - }, 1000); - - } else { - addLog(`${clickedPiece.color} ${clickedPiece.type} repelled attack (${damage === 0 ? 1 : damage} dmg to attacker)`, 'attack'); - setPieces(prev => prev.map(p => { - if (p.id === selectedPiece.id) return { ...p, hp: newHp, hasMoved: true }; - if (p.id === clickedPiece.id) return { ...p, defends: Math.min(p.defends + 1, 5) }; // Integer bonus for survival - return p; - })); - } - } - - // Turn always ends after an attack - nextTurn(turn); - setSelectedPieceId(null); - }, 2000); - - return; - } else if (!clickedPiece) { - // Normal empty square move - let logMsg = `${selectedPiece.color} ${selectedPiece.type} moved to ${String.fromCharCode(97 + x)}${y + 1}`; - let logType: LogEntry['type'] = 'move'; - - if (selectedPiece.type === 'pawn' && (y === 0 || y === 7)) { - logMsg = `${selectedPiece.color} Pawn promoted to Queen!`; - logType = 'promotion'; - } else if (selectedPiece.type === 'king' && Math.abs(x - selectedPiece.x) === 2) { - const isKingside = x > selectedPiece.x; - logMsg = `${selectedPiece.color} Castled ${isKingside ? 'Kingside' : 'Queenside'}`; - logType = 'castle'; - } - - addLog(logMsg, logType); - playSound('move'); - - setPieces(prev => { - let nextPieces = prev.map(p => { - if (p.id === selectedPiece.id) { - let type = p.type; - let maxHp = p.maxHp; - let hp = p.hp; - // Promotion - if (p.type === 'pawn' && (y === 0 || y === 7)) { - type = 'queen'; - maxHp = 40; - hp = 40; - } - return { ...p, x, y, type, hp, maxHp, hasMoved: true, isDebuffed: true }; - } - return p; - }); - - // Castling Move Execution (Rook follows) - if (selectedPiece.type === 'king' && Math.abs(x - selectedPiece.x) === 2) { - const isKingside = x > selectedPiece.x; - const row = selectedPiece.color === 'white' ? 0 : 7; - const rookX = isKingside ? 7 : 0; - const newRookX = isKingside ? 5 : 3; - nextPieces = nextPieces.map(p => { - if (p.type === 'rook' && p.color === selectedPiece.color && p.x === rookX && p.y === row) { - return { ...p, x: newRookX, hasMoved: true, isDebuffed: true }; - } - return p; - }); - } - - return nextPieces; - }); - nextTurn(turn); - setSelectedPieceId(null); - return; - } - } - } - - // Select piece if it belongs to current player - if (clickedPiece && clickedPiece.color === turn) { - playSound('select'); - setSelectedPieceId(clickedPiece.id); - } else { - setSelectedPieceId(null); - } - }; - - // --- AI Logic --- - useEffect(() => { - const aiColor = playerColor === 'white' ? 'black' : 'white'; - if (isVsAI && turn === aiColor && !isRolling && !isPaused && !winner && hasStarted && !aiMoveSequence && !battleResult && !isSiegeFiring) { - // Small delay to simulate "thinking" and let the UI settle - const thinkTimer = setTimeout(() => { - const siegeUsed = aiColor === 'white' ? whiteSiegeUsed : blackSiegeUsed; - const move = calculateBestMove(pieces, aiColor, siegeUsed); - if (move) { - if (move.isSiege) { - setAiMoveSequence({ step: 1, move: { startX: -1, startY: -1, targetX: move.target.x, targetY: move.target.y }, aiColor }); - } else { - setAiMoveSequence({ step: 1, move: { startX: move.piece.x, startY: move.piece.y, targetX: move.target.x, targetY: move.target.y }, aiColor }); - } - } - }, 800); - return () => clearTimeout(thinkTimer); - } - }, [pieces, turn, isVsAI, playerColor, isRolling, isPaused, winner, hasStarted, aiMoveSequence, battleResult, whiteSiegeUsed, blackSiegeUsed, isSiegeFiring]); - - useEffect(() => { - if (aiMoveSequence && !isPaused && !winner) { - const isSiege = aiMoveSequence.move.startX === -1; - const aiColor = aiMoveSequence.aiColor || (playerColor === 'white' ? 'black' : 'white'); - - if (aiMoveSequence.step === 1) { - const timer = setTimeout(() => { - if (isSiege) { - handleOnagerClick(aiColor); - } else { - handleSquareClick(aiMoveSequence.move.startX, aiMoveSequence.move.startY, true); - } - setAiMoveSequence(prev => prev ? { ...prev, step: 2 } : null); - }, 300); - return () => clearTimeout(timer); - } else if (aiMoveSequence.step === 2) { - const timer = setTimeout(() => { - handleSquareClick(aiMoveSequence.move.targetX, aiMoveSequence.move.targetY, true); - setAiMoveSequence(null); - }, 500); - return () => clearTimeout(timer); - } - } - }, [aiMoveSequence, isPaused, winner, handleSquareClick, handleOnagerClick, playerColor]); - // -------------- - - return { - pieces, - turn, - selectedPieceId, - battleResult, - isRolling, - isPaused, - winner, - isNight, - hasStarted, - fogNear, - fogFar, - logs, - boardStyle, - windStrength, - whiteColor, - blackColor, - showCoordinates, - setBoardStyle, - setWindStrength, - setWhiteColor, - setBlackColor, - setShowCoordinates, - setFogNear, - setFogFar, - setHasStarted, - setIsNight, - setIsPaused, - resetGame, - handleSquareClick, - handleOnagerClick, - setBattleResult, - isVsAI, - setIsVsAI, - playerColor, - setPlayerColor, - turnCount, - whiteSiegeUsed, - blackSiegeUsed, - isSiegeFiring, - fireSiege, - selectedOnagerColor - }; -}; diff --git a/client/src/index.css b/client/src/index.css deleted file mode 100644 index a1eba86..0000000 --- a/client/src/index.css +++ /dev/null @@ -1,14 +0,0 @@ -body, html { - margin: 0; - padding: 0; - width: 100vw; - height: 100vh; - overflow: hidden; - background-color: #1a1a1a; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; -} - -#root { - width: 100%; - height: 100%; -} diff --git a/client/src/main.tsx b/client/src/main.tsx deleted file mode 100644 index bef5202..0000000 --- a/client/src/main.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { StrictMode } from 'react' -import { createRoot } from 'react-dom/client' -import './index.css' -import App from './App.tsx' - -createRoot(document.getElementById('root')!).render( - - - , -) diff --git a/client/src/types.ts b/client/src/types.ts deleted file mode 100644 index 0fc62c1..0000000 --- a/client/src/types.ts +++ /dev/null @@ -1,47 +0,0 @@ -export type PieceType = 'pawn' | 'rook' | 'knight' | 'bishop' | 'queen' | 'king'; -export type PlayerColor = 'white' | 'black'; - -export interface Piece { - id: string; - type: PieceType; - color: PlayerColor; - secondaryColor?: string; - x: number; - y: number; - kills: number; - defends: number; - hp: number; - maxHp: number; - hasMoved: boolean; - isDebuffed?: boolean; // -2 Defense debuff after moving - status: 'idle' | 'attacking' | 'dying'; -} - -export interface Position { - x: number; - y: number; -} - -export interface BattleResult { - attackerRoll: number; - attackerTotal: number; - attackerStats: number; - attackerDice: number; - attackerColor: PlayerColor; - defenderRoll: number; - defenderTotal: number; - defenderStats: number; - defenderDice: number; - defenderDebuff: number; - isSiege?: boolean; // New flag for siege attacks - success: boolean; - targetX: number; - targetY: number; -} - -export interface LogEntry { - id: string; - message: string; - type: 'move' | 'attack' | 'kill' | 'promotion' | 'castle' | 'siege'; - timestamp: number; -} diff --git a/client/tsconfig.app.json b/client/tsconfig.app.json deleted file mode 100644 index a9b5a59..0000000 --- a/client/tsconfig.app.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", - "target": "ES2022", - "useDefineForClassFields": true, - "lib": ["ES2022", "DOM", "DOM.Iterable"], - "module": "ESNext", - "types": ["vite/client"], - "skipLibCheck": true, - - /* Bundler mode */ - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "verbatimModuleSyntax": true, - "moduleDetection": "force", - "noEmit": true, - "jsx": "react-jsx", - - /* Linting */ - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "erasableSyntaxOnly": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedSideEffectImports": true - }, - "include": ["src"] -} diff --git a/client/tsconfig.json b/client/tsconfig.json deleted file mode 100644 index 1ffef60..0000000 --- a/client/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "files": [], - "references": [ - { "path": "./tsconfig.app.json" }, - { "path": "./tsconfig.node.json" } - ] -} diff --git a/client/tsconfig.node.json b/client/tsconfig.node.json deleted file mode 100644 index 8a67f62..0000000 --- a/client/tsconfig.node.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "compilerOptions": { - "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", - "target": "ES2023", - "lib": ["ES2023"], - "module": "ESNext", - "types": ["node"], - "skipLibCheck": true, - - /* Bundler mode */ - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "verbatimModuleSyntax": true, - "moduleDetection": "force", - "noEmit": true, - - /* Linting */ - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "erasableSyntaxOnly": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedSideEffectImports": true - }, - "include": ["vite.config.ts"] -} diff --git a/client/vite.config.ts b/client/vite.config.ts deleted file mode 100644 index d4cd1b5..0000000 --- a/client/vite.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' - -// https://vite.dev/config/ -export default defineConfig({ - base: '/castarook/', - plugins: [react()], -}) diff --git a/client/public/favicon.svg b/favicon.svg similarity index 100% rename from client/public/favicon.svg rename to favicon.svg diff --git a/index.html b/index.html new file mode 100644 index 0000000..df87a83 --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ + + + + + + + Castarook + + + + +
+ + diff --git a/client/public/sounds/bomb-falling-and-exploding-01.mp3 b/sounds/bomb-falling-and-exploding-01.mp3 similarity index 100% rename from client/public/sounds/bomb-falling-and-exploding-01.mp3 rename to sounds/bomb-falling-and-exploding-01.mp3 diff --git a/client/public/sounds/button-16a.mp3 b/sounds/button-16a.mp3 similarity index 100% rename from client/public/sounds/button-16a.mp3 rename to sounds/button-16a.mp3 diff --git a/client/public/sounds/button-17.mp3 b/sounds/button-17.mp3 similarity index 100% rename from client/public/sounds/button-17.mp3 rename to sounds/button-17.mp3 diff --git a/client/public/sounds/button-19.mp3 b/sounds/button-19.mp3 similarity index 100% rename from client/public/sounds/button-19.mp3 rename to sounds/button-19.mp3 diff --git a/client/public/sounds/button-21.mp3 b/sounds/button-21.mp3 similarity index 100% rename from client/public/sounds/button-21.mp3 rename to sounds/button-21.mp3 diff --git a/client/public/sounds/clong-2.mp3 b/sounds/clong-2.mp3 similarity index 100% rename from client/public/sounds/clong-2.mp3 rename to sounds/clong-2.mp3 diff --git a/client/public/sounds/creaking-floor-1.mp3 b/sounds/creaking-floor-1.mp3 similarity index 100% rename from client/public/sounds/creaking-floor-1.mp3 rename to sounds/creaking-floor-1.mp3 diff --git a/client/public/sounds/fire-1.mp3 b/sounds/fire-1.mp3 similarity index 100% rename from client/public/sounds/fire-1.mp3 rename to sounds/fire-1.mp3 diff --git a/client/public/sounds/man-scream-03.mp3 b/sounds/man-scream-03.mp3 similarity index 100% rename from client/public/sounds/man-scream-03.mp3 rename to sounds/man-scream-03.mp3 diff --git a/client/public/sounds/marching.mp3 b/sounds/marching.mp3 similarity index 100% rename from client/public/sounds/marching.mp3 rename to sounds/marching.mp3 diff --git a/client/public/sounds/page-flip-03.mp3 b/sounds/page-flip-03.mp3 similarity index 100% rename from client/public/sounds/page-flip-03.mp3 rename to sounds/page-flip-03.mp3 diff --git a/client/public/sounds/river-2.mp3 b/sounds/river-2.mp3 similarity index 100% rename from client/public/sounds/river-2.mp3 rename to sounds/river-2.mp3 diff --git a/client/public/sounds/shovel-into-snow-1.mp3 b/sounds/shovel-into-snow-1.mp3 similarity index 100% rename from client/public/sounds/shovel-into-snow-1.mp3 rename to sounds/shovel-into-snow-1.mp3 diff --git a/client/public/sounds/switch-5.mp3 b/sounds/switch-5.mp3 similarity index 100% rename from client/public/sounds/switch-5.mp3 rename to sounds/switch-5.mp3 diff --git a/client/public/sounds/wind-howl-01.mp3 b/sounds/wind-howl-01.mp3 similarity index 100% rename from client/public/sounds/wind-howl-01.mp3 rename to sounds/wind-howl-01.mp3 diff --git a/client/public/sounds/wood-chop-axe-hit-02.mp3 b/sounds/wood-chop-axe-hit-02.mp3 similarity index 100% rename from client/public/sounds/wood-chop-axe-hit-02.mp3 rename to sounds/wood-chop-axe-hit-02.mp3 diff --git a/client/public/sounds/wood-cracking-1.mp3 b/sounds/wood-cracking-1.mp3 similarity index 100% rename from client/public/sounds/wood-cracking-1.mp3 rename to sounds/wood-cracking-1.mp3