1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,3011,e=>{e.v({background:"page-module__E0kJGG__background",content:"page-module__E0kJGG__content",contentReveal:"page-module__E0kJGG__contentReveal",elsewhere:"page-module__E0kJGG__elsewhere",fadeIn:"page-module__E0kJGG__fadeIn",list:"page-module__E0kJGG__list",page:"page-module__E0kJGG__page"})},94138,(e,t,r)=>{"use strict";function i(e,t){var r=e.length;for(e.push(t);0<r;){var i=r-1>>>1,n=e[i];if(0<s(n,t))e[i]=t,e[r]=n,r=i;else break}}function n(e){return 0===e.length?null:e[0]}function a(e){if(0===e.length)return null;var t=e[0],r=e.pop();if(r!==t){e[0]=r;for(var i=0,n=e.length,a=n>>>1;i<a;){var o=2*(i+1)-1,l=e[o],u=o+1,h=e[u];if(0>s(l,r))u<n&&0>s(h,l)?(e[i]=h,e[u]=r,i=u):(e[i]=l,e[o]=r,i=o);else if(u<n&&0>s(h,r))e[i]=h,e[u]=r,i=u;else break}}return t}function s(e,t){var r=e.sortIndex-t.sortIndex;return 0!==r?r:e.id-t.id}if(r.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o,l=performance;r.unstable_now=function(){return l.now()}}else{var u=Date,h=u.now();r.unstable_now=function(){return u.now()-h}}var d=[],c=[],p=1,f=null,m=3,g=!1,v=!1,y=!1,_=!1,x="function"==typeof setTimeout?setTimeout:null,b="function"==typeof clearTimeout?clearTimeout:null,S="u">typeof setImmediate?setImmediate:null;function T(e){for(var t=n(c);null!==t;){if(null===t.callback)a(c);else if(t.startTime<=e)a(c),t.sortIndex=t.expirationTime,i(d,t);else break;t=n(c)}}function A(e){if(y=!1,T(e),!v)if(null!==n(d))v=!0,M||(M=!0,o());else{var t=n(c);null!==t&&I(A,t.startTime-e)}}var M=!1,E=-1,C=5,w=-1;function R(){return!!_||!(r.unstable_now()-w<C)}function N(){if(_=!1,M){var e=r.unstable_now();w=e;var t=!0;try{e:{v=!1,y&&(y=!1,b(E),E=-1),g=!0;var i=m;try{t:{for(T(e),f=n(d);null!==f&&!(f.expirationTime>e&&R());){var s=f.callback;if("function"==typeof s){f.callback=null,m=f.priorityLevel;var l=s(f.expirationTime<=e);if(e=r.unstable_now(),"function"==typeof l){f.callback=l,T(e),t=!0;break t}f===n(d)&&a(d),T(e)}else a(d);f=n(d)}if(null!==f)t=!0;else{var u=n(c);null!==u&&I(A,u.startTime-e),t=!1}}break e}finally{f=null,m=i,g=!1}}}finally{t?o():M=!1}}}if("function"==typeof S)o=function(){S(N)};else if("u">typeof MessageChannel){var L=new MessageChannel,B=L.port2;L.port1.onmessage=N,o=function(){B.postMessage(null)}}else o=function(){x(N,0)};function I(e,t){E=x(function(){e(r.unstable_now())},t)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(e){e.callback=null},r.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<e?Math.floor(1e3/e):5},r.unstable_getCurrentPriorityLevel=function(){return m},r.unstable_next=function(e){switch(m){case 1:case 2:case 3:var t=3;break;default:t=m}var r=m;m=t;try{return e()}finally{m=r}},r.unstable_requestPaint=function(){_=!0},r.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var r=m;m=e;try{return t()}finally{m=r}},r.unstable_scheduleCallback=function(e,t,a){var s=r.unstable_now();switch(a="object"==typeof a&&null!==a&&"number"==typeof(a=a.delay)&&0<a?s+a:s,e){case 1:var l=-1;break;case 2:l=250;break;case 5:l=0x3fffffff;break;case 4:l=1e4;break;default:l=5e3}return l=a+l,e={id:p++,callback:t,priorityLevel:e,startTime:a,expirationTime:l,sortIndex:-1},a>s?(e.sortIndex=a,i(c,e),null===n(d)&&e===n(c)&&(y?(b(E),E=-1):y=!0,I(A,a-s))):(e.sortIndex=l,i(d,e),v||g||(v=!0,M||(M=!0,o()))),e},r.unstable_shouldYield=R,r.unstable_wrapCallback=function(e){var t=m;return function(){var r=m;m=t;try{return e.apply(this,arguments)}finally{m=r}}}},88440,(e,t,r)=>{"use strict";t.exports=e.r(94138)},69651,30611,9684,33360,47380,62031,10826,34900,98430,e=>{"use strict";let t,r,i,n,a,s,o,l,u,h,d,c,p,f,m,g,v,y,_,x,b,S,T,A;var M,E,C,w,R,N,L=e.i(98134),B=e.i(82637),I=e.i(75201);let P={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},F={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},D="attached",U="detached",O="srgb",G="srgb-linear",k="linear",V="srgb",z="300 es",H={COMPUTE:"compute",RENDER:"render"},W={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},j={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},X={TEXTURE_COMPARE:"depthTextureCompare"},q={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function $(e,t){return new q[e](t)}function J(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function K(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function Y(){let e=K("canvas");return e.style.display="block",e}let Q={},Z=null;function ee(e){Z=e}function et(){return Z}function er(...e){let t="THREE."+e.shift();Z?Z("log",t,...e):console.log(t,...e)}function ei(e){let t=e[0];if("string"==typeof t&&t.startsWith("TSL:")){let t=e[1];t&&t.isStackTrace?e[0]+=" "+t.getLocation():e[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return e}function en(...e){let t="THREE."+(e=ei(e)).shift();if(Z)Z("warn",t,...e);else{let r=e[0];r&&r.isStackTrace?console.warn(r.getError(t)):console.warn(t,...e)}}function ea(...e){let t="THREE."+(e=ei(e)).shift();if(Z)Z("error",t,...e);else{let r=e[0];r&&r.isStackTrace?console.error(r.getError(t)):console.error(t,...e)}}function es(...e){let t=e.join(" ");t in Q||(Q[t]=!0,en(...e))}function eo(e,t,r){return new Promise(function(i,n){setTimeout(function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:n();break;case e.TIMEOUT_EXPIRED:setTimeout(a,r);break;default:i()}},r)})}let el={0:1,2:6,4:7,3:5,1:0,6:2,7:4,5:3};class eu{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){let r=this._listeners;return void 0!==r&&void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){let r=this._listeners;if(void 0===r)return;let i=r[e];if(void 0!==i){let e=i.indexOf(t);-1!==e&&i.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(void 0===t)return;let r=t[e.type];if(void 0!==r){e.target=this;let t=r.slice(0);for(let r=0,i=t.length;r<i;r++)t[r].call(this,e);e.target=null}}}let eh=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","5
15","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],ed=1234567,ec=Math.PI/180,ep=180/Math.PI;function ef(){let e=0xffffffff*Math.random()|0,t=0xffffffff*Math.random()|0,r=0xffffffff*Math.random()|0,i=0xffffffff*Math.random()|0;return(eh[255&e]+eh[e>>8&255]+eh[e>>16&255]+eh[e>>24&255]+"-"+eh[255&t]+eh[t>>8&255]+"-"+eh[t>>16&15|64]+eh[t>>24&255]+"-"+eh[63&r|128]+eh[r>>8&255]+"-"+eh[r>>16&255]+eh[r>>24&255]+eh[255&i]+eh[i>>8&255]+eh[i>>16&255]+eh[i>>24&255]).toLowerCase()}function em(e,t,r){return Math.max(t,Math.min(r,e))}function eg(e,t){return(e%t+t)%t}function ev(e,t,r){return(1-r)*e+r*t}function ey(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/0xffffffff;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/0x7fffffff,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function e_(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(0xffffffff*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(0x7fffffff*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}let ex={DEG2RAD:ec,RAD2DEG:ep,generateUUID:ef,clamp:em,euclideanModulo:eg,mapLinear:function(e,t,r,i,n){return i+(e-t)*(n-i)/(r-t)},inverseLerp:function(e,t,r){return e!==t?(r-e)/(t-e):0},lerp:ev,damp:function(e,t,r,i){return ev(e,t,1-Math.exp(-r*i))},pingpong:function(e,t=1){return t-Math.abs(eg(e,2*t)-t)},smoothstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t))*e*(3-2*e)},smootherstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(ed=e);let t=ed+=0x6d2b79f5;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/0x100000000},degToRad:function(e){return e*ec},radToDeg:function(e){return e*ep},isPowerOfTwo:function(e){return(e&e-1)==0&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,r,i,n){let a=Math.cos,s=Math.sin,o=a(r/2),l=s(r/2),u=a((t+i)/2),h=s((t+i)/2),d=a((t-i)/2),c=s((t-i)/2),p=a((i-t)/2),f=s((i-t)/2);switch(n){case"XYX":e.set(o*h,l*d,l*c,o*u);break;case"YZY":e.set(l*c,o*h,l*d,o*u);break;case"ZXZ":e.set(l*d,l*c,o*h,o*u);break;case"XZX":e.set(o*h,l*f,l*p,o*u);break;case"YXY":e.set(l*p,o*h,l*f,o*u);break;case"ZYZ":e.set(l*f,l*p,o*h,o*u);break;default:en("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+n)}},normalize:e_,denormalize:ey};class eb{constructor(e=0,t=0){eb.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 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 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}
vendor: 5,395 bytes, line 1
1sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+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=em(this.x,e.x,t.x),this.y=em(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=em(this.x,e,t),this.y=em(this.y,e,t),this}clampLength(e,t){let r=this.length();return this.divideScalar(r||1).multiplyScalar(em(r,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(em(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,r=this.y-e.y;return t*t+r*r}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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let r=Math.cos(t),i=Math.sin(t),n=this.x-e.x,a=this.y-e.y;return this.x=n*r-a*i+e.x,this.y=n*i+a*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class eS{constructor(e=0,t=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=i}static slerpFlat(e,t,r,i,n,a,s){let o=r[i+0],l=r[i+1],u=r[i+2],h=r[i+3],d=n[a+0],c=n[a+1],p=n[a+2],f=n[a+3];if(h!==f||o!==d||l!==c||u!==p){let e=o*d+l*c+u*p+h*f;e<0&&(d=-d,c=-c,p=-p,f=-f,e=-e);let t=1-s;if(e<.9995){let r=Math.acos(e),i=Math.sin(r);o=o*(t=Math.sin(t*r)/i)+d*(s=Math.sin(s*r)/i),l=l*t+c*s,u=u*t+p*s,h=h*t+f*s}else{let e=1/Math.sqrt((o=o*t+d*s)*o+(l=l*t+c*s)*l+(u=u*t+p*s)*u+(h=h*t+f*s)*h);o*=e,l*=e,u*=e,h*=e}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,r,i,n,a){let s=r[i],o=r[i+1],l=r[i+2],u=r[i+3],h=n[a],d=n[a+1],c=n[a+2],p=n[a+3];return e[t]=s*p+u*h+o*c-l*d,e[t+1]=o*p+u*d+l*h-s*c,e[t+2]=l*p+u*c+s*d-o*h,e[t+3]=u*p-s*h-o*d-l*c,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,r,i){return this._x=e,this._y=t,this._z=r,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){let r=e._x,i=e._y,n=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(r/2),u=s(i/2),h=s(n/2),d=o(r/2),c=o(i/2),p=o(n/2);switch(a){case"XYZ":this._x=d*u*h+l*c*p,this._y=l*c*h-d*u*p,this._z=l*u*p+d*c*h,this._w=l*u*h-d*c*p;break;case"YXZ":this._x=d*u*h+l*c*p,this._y=l*c*h-d*u*p,this._z=l*u*p-d*c*h,this._w=l*u*h+d*c*p;break;case"ZXY":this._x=d*u*h-l*c*p,this._y=l*c*h+d*u*p,this._z=l*u*p+d*c*h,this._w=l*u*h-d*c*p;break;case"ZYX":this._x=d*u*h-l*c*p,this._y=l*c*h+d*u*p,this._z=l*u*p-d*c*h,this._w=l*u*h+d*c*p;break;case"YZX":this._x=d*u*h+l*c*p,this._y=l*c*h+d*u*p,this._z=l*u*p-d*c*h,this._w=l*u*h-d*c*p;break;case"XZY":this._x=d*u*h-l*c*p,this._y=l*c*h-d*u*p,this._z=l*u*p+d*c*h,this._w=l*u*h+d*c*p;break;default:en("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,r=t[0],i=t[4],n=t[8],a=t[1],s=t[5],o=t[9],l=t[2],u=t[6],h=t[10],d=r+s+h;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(u-o)*e,this._y=(n-l)*e,this._z=(a-i)*e}else if(r>s&&r>h){let e=2*Math.sqrt(1+r-s-h);this._w=(u-o)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(n+l)/e}else if(s>h){let e=2*Math.sqrt(1+s-r-h);this._w=(n-l)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(o+u)/e}else{let e=2*Math.sqrt(1+h-r-s);this._w=(a-i)/e,this._x=(n+l)/e,this._y=(o+u)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<1e-8?(r=0,Math.abs(e.x)>
vendor: 9,965 bytes, line 1
1Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(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=r,this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(em(this.dot(e),-1,1)))}rotateTowards(e,t){let r=this.angleTo(e);if(0===r)return this;let i=Math.min(1,t/r);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 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let r=e._x,i=e._y,n=e._z,a=e._w,s=t._x,o=t._y,l=t._z,u=t._w;return this._x=r*u+a*s+i*l-n*o,this._y=i*u+a*o+n*s-r*l,this._z=n*u+a*l+r*o-i*s,this._w=a*u-r*s-i*o-n*l,this._onChangeCallback(),this}slerp(e,t){let r=e._x,i=e._y,n=e._z,a=e._w,s=this.dot(e);s<0&&(r=-r,i=-i,n=-n,a=-a,s=-s);let o=1-t;if(s<.9995){let e=Math.acos(s),l=Math.sin(e);o=Math.sin(o*e)/l,t=Math.sin(t*e)/l,this._x=this._x*o+r*t,this._y=this._y*o+i*t,this._z=this._z*o+n*t,this._w=this._w*o+a*t,this._onChangeCallback()}else this._x=this._x*o+r*t,this._y=this._y*o+i*t,this._z=this._z*o+n*t,this._w=this._w*o+a*t,this.normalize();return this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),n=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),n*Math.sin(t),n*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 eT{constructor(e=0,t=0,r=0){eT.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return void 0===r&&(r=this.z),this.x=e,this.y=t,this.z=r,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 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 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(eM.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(eM.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6]*i,this.y=n[1]*t+n[4]*r+n[7]*i,this.z=n[2]*t+n[5]*r+n[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,r=this.y,i=this.z,n=e.elements,a=1/(n[3]*t+n[7]*r+n[11]*i+n[15]);return this.x=(n[0]*t+n[4]*r+n[8]*i+n[12])*a,this.y=(n[1]*t+n[5]*r+n[9]*i+n[13])*a,this.z=(n[2]*t+n[6]*r+n[10]*i+n[14])*a,this}applyQuaternion(e){let t=this.x,r=this.y,i=this.z,n=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*i-s*r),u=2*(s*t-n*i),h=2*(n*r-a*t);return this.x=t+o*l+a*h-s*u,this.y=r+o*u+s*l-n*h,this.z=i+o*h+n*u-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i,this.y=n[1]*t+n[5]*r+n[9]*i,this.z=n[2]*t+n[6]*r+n[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=em(this.x,e.x,t.x),this.y=em(this.y,e.y,t.y),this.z=em(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=em(this.x,e,t),this.y=em(this.y,e,t),this.z=em(this.z,e,t),this}clampLength(e,t){let r=this.length();return this.divideScalar(r||1).multiplyScalar(em(r,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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let r=e.x,i=e.y,n=e.z,a=t.x,s=t.y,o=t.z;return this.x=i*o-n*s,this.y=n*a-r*o,this.z=r*s-i*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return eA.copy(this).projectOnVector(e),this.sub(eA)}reflect(e){return this.sub(eA.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(em(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+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,r){let i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=2*Math.random()-1,r=Math.sqrt(1-t*t);return this.x=r*Math.cos(e),this.y=t,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let eA=new eT,eM=new eS;class eE{constructor(e,t,r,i,n,a,s,o,l){eE.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,r,i,n,a,s,o,l)}set(e,t,r,i,n,a,s,o,l){let u=this.elements;return u[0]=e,u[1]=i,u[2]=s,u[3]=t,u[4]=n,u[5]=o,u[6]=r,u[7]=a,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let r=e.elements,i=t.elements,n=this.elements,a=r[0],s=r[3],o=r[6],l=r[1],u=r[4],h=r[7],d=r[2],c=r[5],p=r[8],f=i[0],m=i[3],g=i[6],v=i[1],y=i[4],_=i[7],x=i[2],b=i[5],S=i[8];return n[0]=a*f+s*v+o*x,n[3]=a*m+s*y+o*b,n[6]=a*g+s*_+o*S,n[1]=l*f+u*v+h*x,n[4]=l*m+u*y+h*b,n[7
vendor: 4,250 bytes, line 1
1]=l*g+u*_+h*S,n[2]=d*f+c*v+p*x,n[5]=d*m+c*y+p*b,n[8]=d*g+c*_+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*a*u-t*s*l-r*n*u+r*s*o+i*n*l-i*a*o}invert(){let e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],h=u*a-s*l,d=s*o-u*n,c=l*n-a*o,p=t*h+r*d+i*c;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=h*f,e[1]=(i*l-u*r)*f,e[2]=(s*r-i*a)*f,e[3]=d*f,e[4]=(u*t-i*o)*f,e[5]=(i*n-s*t)*f,e[6]=c*f,e[7]=(r*o-l*t)*f,e[8]=(a*t-r*n)*f,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,i,n,a,s){let o=Math.cos(n),l=Math.sin(n);return this.set(r*o,r*l,-r*(o*a+l*s)+a+e,-i*l,i*o,-i*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(eC.makeScale(e,t)),this}rotate(e){return this.premultiply(eC.makeRotation(-e)),this}translate(e,t){return this.premultiply(eC.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,r=e.elements;for(let e=0;e<9;e++)if(t[e]!==r[e])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){let r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}let eC=new eE,ew=new eE().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),eR=new eE().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715),eN=(y=[.64,.33,.3,.6,.15,.06],_=[.2126,.7152,.0722],x=[.3127,.329],(v={enabled:!0,workingColorSpace:G,spaces:{},convert:function(e,t,r){return!1!==this.enabled&&t!==r&&t&&r&&(this.spaces[t].transfer===V&&(e.r=eL(e.r),e.g=eL(e.g),e.b=eL(e.b)),this.spaces[t].primaries!==this.spaces[r].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[r].fromXYZ)),this.spaces[r].transfer===V&&(e.r=eB(e.r),e.g=eB(e.g),e.b=eB(e.b))),e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return""===e?k:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,r){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[r].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,t){return es("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),v.workingToColorSpace(e,t)},toWorkingColorSpace:function(e,t){return es("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),v.colorSpaceToWorking(e,t)}}).define({[G]:{primaries:y,whitePoint:x,transfer:k,toXYZ:ew,fromXYZ:eR,luminanceCoefficients:_,workingColorSpaceConfig:{unpackColorSpace:O},outputColorSpaceConfig:{drawingBufferColorSpace:O}},[O]:{primaries:y,whitePoint:x,transfer:V,toXYZ:ew,fromXYZ:eR,luminanceCoefficients:_,outputColorSpaceConfig:{drawingBufferColorSpace:O}}}),v);function eL(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}
1function eB(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class eI{static getDataURL(e,r="image/png"){let i;if(/^data:/i.test(e.src)||"u"<typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)i=e;else{void 0===t&&(t=K("canvas")),t.width=e.width,t.height=e.height;let r=t.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=t}return i.toDataURL(r)}static sRGBToLinear(e){if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap){let t=K("canvas");t.width=e.width,t.height=e.height;let r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);let i=r.getImageData(0,0,e.width,e.height),n=i.data;for(let e=0;e<n.length;e++)n[e]=255*eL(n[e]/255);return r.putImageData(i,0,0),t}if(!e.data)return en("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*eL(t[e]/255)):t[e]=eL(t[e]);return{data:t,width:e.width,height:e.height}}}}let eP=0;class eF{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:eP++}),this.uuid=ef(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return"u">typeof HTMLVideoElement&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):"u">typeof VideoFrame&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):null!==t?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let r={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,r=i.length;t<r;t++)i[t].isDataTexture?e.push(eD(i[t].image)):e.push(eD(i[t]))}else e=eD(i);r.url=e}return t||(e.images[this.uuid]=r),r}}function eD(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap?eI.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(en("Texture: Unable to serialize Texture."),{})}let eU=0,eO=new eT;class eG extends eu{constructor(e=eG.DEFAULT_IMAGE,t=eG.DEFAULT_MAPPING,r=1001,i=1001,n=1006,a=1008,s=1023,o=1009,l=eG.DEFAULT_ANISOTROPY,u=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:eU++}),this.uuid=ef(),this.name="",this.source=new eF(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=n,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new eb(0,0),this.repeat=new eb(1,1),this.center=new eb(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new eE,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!e&&!!e.depth&&e.depth>1,this.pmremVersion=0}get width(){return this.source.getSize(eO).x}get height(){return this.source.getSize(eO).y}get depth(){return this.source.getSize(eO).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
1=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let r=e[t];if(void 0===r){en(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let i=this[t];if(void 0===i){en(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&r&&i.isVector2&&r.isVector2||i&&r&&i.isVector3&&r.isVector3||i&&r&&i.isMatrix3&&r.isMatrix3?i.copy(r):this[t]=r}}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let r={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&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}eG.DEFAULT_IMAGE=null,eG.DEFAULT_MAPPING=300,eG.DEFAULT_ANISOTROPY=1;class ek{constructor(e=0,t=0,r=0,i=1){ek.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,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,r,i){return this.x=e,this.y=t,this.z=r,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 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 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=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,r=this.y,i=this.z,n=this.w,a=e.elements;return this.x=a[0]*t+a[4]*r+a[8]*i+a[12]*n,this.y=a[1]*t+a[5]*r+a[9]*i+a[13]*n,this.z=a[2]*t+a[6]*r+a[10]*i+a[14]*n,this.w=a[3]*t+a[7]*r+a[11]*i+a[15]*n,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,r,i,n,a=e.elements,s=a[0],o=a[4],l=a[8],u=a[
11],h=a[5],d=a[9],c=a[2],p=a[6],f=a[10];if(.01>Math.abs(o-u)&&.01>Math.abs(l-c)&&.01>Math.abs(d-p)){if(.1>Math.abs(o+u)&&.1>Math.abs(l+c)&&.1>Math.abs(d+p)&&.1>Math.abs(s+h+f-3))return this.set(1,0,0,0),this;t=Math.PI;let e=(s+1)/2,a=(h+1)/2,m=(f+1)/2,g=(o+u)/4,v=(l+c)/4,y=(d+p)/4;return e>a&&e>m?e<.01?(r=0,i=.707106781,n=.707106781):(i=g/(r=Math.sqrt(e)),n=v/r):a>m?a<.01?(r=.707106781,i=0,n=.707106781):(r=g/(i=Math.sqrt(a)),n=y/i):m<.01?(r=.707106781,i=.707106781,n=0):(r=v/(n=Math.sqrt(m)),i=y/n),this.set(r,i,n,t),this}let m=Math.sqrt((p-d)*(p-d)+(l-c)*(l-c)+(u-o)*(u-o));return .001>Math.abs(m)&&(m=1),this.x=(p-d)/m,this.y=(l-c)/m,this.z=(u-o)/m,this.w=Math.acos((s+h+f-1)/2),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=em(this.x,e.x,t.x),this.y=em(this.y,e.y,t.y),this.z=em(this.z,e.z,t.z),this.w=em(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=em(this.x,e,t),this.y=em(this.y,e,t),this.z=em(this.z,e,t),this.w=em(this.w,e,t),this}clampLength(e,t){let r=this.length();return this.divideScalar(r||1).multiplyScalar(em(r,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,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,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 eV extends eu{constructor(e=1,t=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},r),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=r.depth,this.scissor=new ek(0,0,e,t),this.scissorTest=!1,this.viewport=new ek(0,0,e,t),this.textures=[];const i=new eG({width:e,height:t,depth:r.depth}),n=r.count;for(let e=0;e<n;e++)this.textures[e]=i.clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;this._setTextureOptions(r),this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=r.depthTexture,this.samples=r.samples,this.multiview=r.multiview}_setTextureOptions(e={}){let t={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==e.mapping&&(t.mapping=e.mapping),void 0!==e.wrapS&&(t.wrapS=e.wrapS),void 0!==e.wrapT&&(t.wrapT=e.wrapT),void 0!==e.wrapR&&(t.wrapR=e.wrapR),void 0!==e.magFilter&&(t.magFilter=e.magFilter),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.format&&(t.format=e.format),void 0!==e.type&&(t.type=e.type),void 0!==e.anisotropy&&(t.anisotropy=e.anisotropy),void 0!==e.colorSpace&&(t.colorSpace
1=e.colorSpace),void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.generateMipmaps&&(t.generateMipmaps=e.generateMipmaps),void 0!==e.internalFormat&&(t.internalFormat=e.internalFormat);for(let e=0;e<this.textures.length;e++)this.textures[e].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==e&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,r=1){if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(let i=0,n=this.textures.length;i<n;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=r,!0!==this.textures[i].isData3DTexture&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,r=e.textures.length;t<r;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let r=Object.assign({},e.textures[t].image);this.textures[t].source=new eF(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ez extends eV{constructor(e=1,t=1,r={}){super(e,t,r),this.isWebGLRenderTarget=!0}}class eH extends eG{constructor(e=null,t=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class eW extends ez{constructor(e=1,t=1,r=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new eH(null,e,t,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class ej extends eG{constructor(e=null,t=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class eX extends ez{constructor(e=1,t=1,r=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new ej(null,e,t,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class eq{constructor(e,t,r,i,n,a,s,o,l,u,h,d,c,p,f,m){eq.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,r,i,n,a,s,o,l,u,h,d,c,p,f,m)}set(e,t,r,i,n,a,s,o,l,u,h,d,c,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=r,g[12]=i,g[1]=n,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=u,g[10]=h,g[14]=d,g[3]=c,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new eq().fromArray(this.elements)}copy(e){let t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){let t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,r){return 0===this.determinant()?(e.set(1,0,0),t.set(0,1,0),r.set(0,0,1)):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2)),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){if(0===e.determinant())return this.identity();let t=this.elements,r=e.elements,i=1/e$.setFromMatrixColumn(e,0).length(),n=1/e$.setFromMatrixColumn(e,1).length(),a=1/e$.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*n,t[5]=r[5]*n,t[6]=r[6]*n,t[7]=0,t[8]=r[8]*a,t[9]=r[9]*a,t[10]=r[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,r=e.x,i=e.y,n=e.z,a=Math.cos(r),s=Math.sin(r),o=Math.cos(i),l=Math.sin(i),u=Math.cos(n),h=Math.sin(n);if("XYZ"===e.order){let e=a*u,r=a*h,i=s*u,n=s*h;t[0]=o*u,t[4]=-o*h,t[8]=l,t[1]=r+i*l,t[5]=e-n*l,t[9]=-s*o,t[2]=n-e*l,t[6]=i+r*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*u,r=o*h,i=l*u,n=l*h;t[0]=e+n*s,t[4]=i*s-r,t[8]=a*l,t[1]=a*h,t[5]=a*u,t[9]=-s,t[2]=r*s-i,t[6]=n+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*u,r=o*h,i=l*u,n=l*h;t[0]=e-n*s,t[4]=-a*h,t[8]=i+r*s,t[1]=r+i*s,t[5]=a*u,t[9]=n-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*u,r=a*h,i=s*u,n=s*h;t[0]=o*u,t[4]=i*l-r,t[8]=e*l+n,t[1]=o*h,t[5]=n*l+e,t[9]=r*l-i,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,r=a*l,i=s*o,n=s*l;t[0]=o*u,t[4]=n-e*h,t[8]=i*h+r,t[1]=h,t[5]=a*u,t[9]=-s*u,t[2]=-l*u,t[6]=r*h+i,t[10]=e-n*h}
vendor: 4,847 bytes, line 1
1else if("XZY"===e.order){let e=a*o,r=a*l,i=s*o,n=s*l;t[0]=o*u,t[4]=-h,t[8]=l*u,t[1]=e*h+n,t[5]=a*u,t[9]=r*h-i,t[2]=i*h-r,t[6]=s*u,t[10]=n*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(eK,e,eY)}lookAt(e,t,r){let i=this.elements;return e0.subVectors(e,t),0===e0.lengthSq()&&(e0.z=1),e0.normalize(),eQ.crossVectors(r,e0),0===eQ.lengthSq()&&(1===Math.abs(r.z)?e0.x+=1e-4:e0.z+=1e-4,e0.normalize(),eQ.crossVectors(r,e0)),eQ.normalize(),eZ.crossVectors(e0,eQ),i[0]=eQ.x,i[4]=eZ.x,i[8]=e0.x,i[1]=eQ.y,i[5]=eZ.y,i[9]=e0.y,i[2]=eQ.z,i[6]=eZ.z,i[10]=e0.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let r=e.elements,i=t.elements,n=this.elements,a=r[0],s=r[4],o=r[8],l=r[12],u=r[1],h=r[5],d=r[9],c=r[13],p=r[2],f=r[6],m=r[10],g=r[14],v=r[3],y=r[7],_=r[11],x=r[15],b=i[0],S=i[4],T=i[8],A=i[12],M=i[1],E=i[5],C=i[9],w=i[13],R=i[2],N=i[6],L=i[10],B=i[14],I=i[3],P=i[7],F=i[11],D=i[15];return n[0]=a*b+s*M+o*R+l*I,n[4]=a*S+s*E+o*N+l*P,n[8]=a*T+s*C+o*L+l*F,n[12]=a*A+s*w+o*B+l*D,n[1]=u*b+h*M+d*R+c*I,n[5]=u*S+h*E+d*N+c*P,n[9]=u*T+h*C+d*L+c*F,n[13]=u*A+h*w+d*B+c*D,n[2]=p*b+f*M+m*R+g*I,n[6]=p*S+f*E+m*N+g*P,n[10]=p*T+f*C+m*L+g*F,n[14]=p*A+f*w+m*B+g*D,n[3]=v*b+y*M+_*R+x*I,n[7]=v*S+y*E+_*N+x*P,n[11]=v*T+y*C+_*L+x*F,n[15]=v*A+y*w+_*B+x*D,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],r=e[4],i=e[8],n=e[12],a=e[1],s=e[5],o=e[9],l=e[13],u=e[2],h=e[6],d=e[10],c=e[14],p=e[3],f=e[7],m=e[11],g=e[15],v=o*c-l*d,y=s*c-l*h,_=s*d-o*h,x=a*c-l*u,b=a*d-o*u,S=a*h-s*u;return t*(f*v-m*y+g*_)-r*(p*v-m*x+g*b)+i*(p*y-f*x+g*S)-n*(p*_-f*b+m*S)}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,r){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=r),this}invert(){let e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],h=e[9],d=e[10],c=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=t*s-r*a,y=t*o-i*a,_=t*l-n*a,x=r*o-i*s,b=r*l-n*s,S=i*l-n*o,T=u*f-h*p,A=u*m-d*p,M=u*g-c*p,E=h*m-d*f,C=h*g-c*f,w=d*g-c*m,R=v*w-y*C+_*E+x*M-b*A+S*T;if(0===R)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let N=1/R;return e[0]=(s*w-o*C+l*E)*N,e[1]=(i*C-r*w-n*E)*N,e[2]=(f*S-m*b+g*x)*N,e[3]=(d*b-h*S-c*x)*N,e[4]=(o*M-a*w-l*A)*N,e[5]=(t*w-i*M+n*A)*N,e[6]=(m*_-p*S-g*y)*N,e[7]=(u*S-d*_+c*y)*N,e[8]=(a*C-s*M+l*T)*N,e[9]=(r*M-t*C-n*T)*N,e[10]=(p*b-f*_+g*v)*N,e[11]=(h*_-u*b-c*v)*N,e[12]=(s*A-a*E-o*T)*N,e[13]=(t*E-r*A+i*T)*N,e[14]=(f*y-p*x-m*v)*N,e[15]=(u*x-h*y+d*v)*N,this}scale(e){let t=this.elements,r=e.x,i=e.y,n=e.z;return t[0]*=r,t[4]*=i,t[8]*=n,t[1]*=r,t[5]*=i,t[9]*=n,t[2]*=r,t[6]*=i,t[10]*=n,t[3]*=r,t[7]*=i,t[11]*=n,this}getMaxScaleOnAxis(){let e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))}makeTranslation(e,t,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let r=Math.cos(t),i=Math.sin(t),n=1-r,a=e.x,s=e.y,o=e.z,l=n*a,u=n*s;return this.set(l*a+r,l*s-i*o,l*o+i*s,0,l*s+i*o,u*s+r,u*o-i*a,0,l*o-i*s,u*o+i*a,n*o*o+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,i,n,a){return this.set(1,r,n,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,r){let i=this.elements,n=t._x,a=t._y,s=t._z,o=t._w,l=n+n,u=a+a,h=s+s,d=n*l,c=n*u,p=n*h,f=a*u,m=a*h,g=s*h,v=o*l,y=o*u,_=o*h,x=r.x,b=r.y,S=r.z;return i[0]=(1-(f+g))*x,i[1]=(c+_)*x,i[2]=(p-y)*x,i[3]=0,i[4]=(c-_)*b,i[5]=(1-(d+g))*b,i[6]=(m+v)*b,i[7]=0,i[8]=(p+y)*S,i[9]=(m-v)*S,i[10]=(1-(d+f))*S,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,r){let i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];let n=this.determinant();if(0===n)return r.set(1,1,1),t.identity(),this;let a=e$.set(i[0],i[1],i[2]).length(),s=e$.set(i[4],i[5],i[6]).length(),o=e$.set(i[8],i[9],i[10]).length();n<0&&(a=-a),eJ.copy(this);let l=1/a,u=1/s,h=1/o;return eJ.elements[0]*=l,eJ.elements[1]*=l,eJ.elements[2]*=l,eJ.elements[4]*=u,eJ.elements[5]*=u,eJ.elements[6]*=u,eJ.elements[8]*=h,eJ.elements[9]*=h,eJ.elements[10]*=h,t.setFromRotationMatrix(eJ),r.x=a,r.
1y=s,r.z=o,this}makePerspective(e,t,r,i,n,a,s=2e3,o=!1){let l,u,h=this.elements;if(o)l=n/(a-n),u=a*n/(a-n);else if(2e3===s)l=-(a+n)/(a-n),u=-2*a*n/(a-n);else if(2001===s)l=-a/(a-n),u=-a*n/(a-n);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return h[0]=2*n/(t-e),h[4]=0,h[8]=(t+e)/(t-e),h[12]=0,h[1]=0,h[5]=2*n/(r-i),h[9]=(r+i)/(r-i),h[13]=0,h[2]=0,h[6]=0,h[10]=l,h[14]=u,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(e,t,r,i,n,a,s=2e3,o=!1){let l,u,h=this.elements;if(o)l=1/(a-n),u=a/(a-n);else if(2e3===s)l=-2/(a-n),u=-(a+n)/(a-n);else if(2001===s)l=-1/(a-n),u=-n/(a-n);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return h[0]=2/(t-e),h[4]=0,h[8]=0,h[12]=-(t+e)/(t-e),h[1]=0,h[5]=2/(r-i),h[9]=0,h[13]=-(r+i)/(r-i),h[2]=0,h[6]=0,h[10]=l,h[14]=u,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(e){let t=this.elements,r=e.elements;for(let e=0;e<16;e++)if(t[e]!==r[e])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){let r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}let e$=new eT,eJ=new eq,eK=new eT(0,0,0),eY=new eT(1,1,1),eQ=new eT,eZ=new eT,e0=new eT,e1=new eq,e2=new eS;class e3{constructor(e=0,t=0,r=0,i=e3.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,i=this._order){return this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){let i=e.elements,n=i[0],a=i[4],s=i[8],o=i[1],l=i[5],u=i[9],h=i[2],d=i[6],c=i[10];switch(t){case"XYZ":this._y=Math.asin(em(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-u,c),this._z=Math.atan2(-a,n)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-em(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(s,c),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,n),this._z=0);break;case"ZXY":this._x=Math.asin(em(d,-1,1)),.9999999>Math.abs(d)?(this._y=Math.atan2(-h,c),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,n));break;case"ZYX":this._y=Math.asin(-em(h,-1,1)),.9999999>Math.abs(h)?(this._x=Math.atan2(d,c),this._z=Math.atan2(o,n)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(em(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,n)):(this._x=0,this._y=Math.atan2(s,c));break;case"XZY":this._z=Math.asin(-em(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(d,l),this._y=Math.atan2(s,n)):(this._x=Math.atan2(-u,c),this._y=0);break;default:en("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===r&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return e1.makeRotationFromQuaternion(e),this.setFromRotationMatrix(e1,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return e2.setFromEuler(this),this.setFromQuaternion(e2,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}e3.DEFAULT_ORDER="XYZ";class e4{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&1<<e)!=0}}let e5=0,e8=new eT,e6=new eS,e9=new eq,e7=new eT,te=new eT,tt=new eT,tr=new eS,ti=new eT(1,0,0),tn=new eT(0,1,0),ta=new eT(0,0,1),ts={type:"added"},to={type:"removed"},tl={type:"childadded",child:null},tu={type:"childremoved",child:null};class th extends eu{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:e5++}),this.uuid=ef(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=th.DEFAULT_UP.clone();const e=new eT,t=new e3,r=new eS,i=new eT(1,1,1);t._onChange(function(){r.setFromEuler(t,!1)}),r._onChange(function(){t.setFromQuaternion(r,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new eq},normalMatrix:{value:new eE}}),this.matrix=new eq,this.matrixWorld=new eq,this.matrixAutoUpdate=th.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=th.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new e4,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}
vendor: 4,390 bytes, line 1
1setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return e6.setFromAxisAngle(e,t),this.quaternion.multiply(e6),this}rotateOnWorldAxis(e,t){return e6.setFromAxisAngle(e,t),this.quaternion.premultiply(e6),this}rotateX(e){return this.rotateOnAxis(ti,e)}rotateY(e){return this.rotateOnAxis(tn,e)}rotateZ(e){return this.rotateOnAxis(ta,e)}translateOnAxis(e,t){return e8.copy(e).applyQuaternion(this.quaternion),this.position.add(e8.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ti,e)}translateY(e){return this.translateOnAxis(tn,e)}translateZ(e){return this.translateOnAxis(ta,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(e9.copy(this.matrixWorld).invert())}lookAt(e,t,r){e.isVector3?e7.copy(e):e7.set(e,t,r);let i=this.parent;this.updateWorldMatrix(!0,!1),te.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?e9.lookAt(te,e7,this.up):e9.lookAt(e7,te,this.up),this.quaternion.setFromRotationMatrix(e9),i&&(e9.extractRotation(i.matrixWorld),e6.setFromRotationMatrix(e9),this.quaternion.premultiply(e6.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?ea("Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(ts),tl.child=e,this.dispatchEvent(tl),tl.child=null):ea("Object3D.add: object not an instance of THREE.Object3D.",e),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return -1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(to),tu.child=e,this.dispatchEvent(tu),tu.child=null),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),e9.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),e9.multiply(e.parent.matrixWorld)),e.applyMatrix4(e9),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ts),tl.child=e,this.dispatchEvent(tl),tl.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let r=0,i=this.children.length;r<i;r++){let i=this.children[r].getObjectByProperty(e,t);if(void 0!==i)return i}}getObjectsByProperty(e,t,r=[]){this[e]===t&&r.push(this);let i=this.children;for(let n=0,a=i.length;n<a;n++)i[n].getObjectsByProperty(e,t,r);return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(te,e,tt),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(te,tr,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let r=0,i=t.length;r<i;r++)t[r].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let r=0,i=t.length;r<i;r++)t[r].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(null!==e){let t=e.x,r=e.y,i=e.z,n=this.matrix.elements;n[12]+=t-n[0]*t-n[4]*r-n[8]*i,n[13]+=r-n[1]*t-n[5]*r-n[9]*i,n[14]+=i-n[2]*t-n[6]*r-n[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let r=0,i=t.length;r<i;r++)t[r].updateMatrixWorld(e)}updateWorldMatrix(e,t){let r=this.parent;if(!0===e&&null!==r&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix
1):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===t){let e=this.children;for(let t=0,r=e.length;t<r;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){let t=void 0===e||"string"==typeof e,r={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let i={};function n(t,r){return void 0===t[r.uuid]&&(t[r.uuid]=r.toJSON(e)),r.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),!1!==this.static&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),null!==this.pivot&&(i.pivot=this.pivot.toArray()),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),void 0!==this.morphTargetDictionary&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),void 0!==this.morphTargetInfluences&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(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(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(e=>({...e})),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),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(i.boundingBox=this.boundingBox.toJSON())),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&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=n(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let r=t.shapes;if(Array.isArray(r))for(let t=0,i=r.length;t<i;t++){let i=r[t];n(e.shapes,i)}else n(e.shapes,r)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(n(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){let t=[];for(let r=0,i=this.material.length;r<i;r++)t.push(n(e.materials,this.material[r]));i.material=t}else i.material=n(e.materials,this.material);if(this.children.length>0){i.children=[];for(let t=0;t<this.children.length;t++)i.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let t=0;t<this.animations.length;t++){let r=this.animations[t];i.animations.push(n(e.animations,r))}}if(t){let t=a(e.geometries),i=a(e.materials),n=a(e.textures),s=a(e.images),o=a(e.shapes),l=a(e.skeletons),u=a(e.animations),h=a(e.nodes);t.length>0&&(r.geometries=t),i.length>0&&(r.materials=i),n.length>0&&(r.textures=n),s.length>0&&(r.images=s),o.length>0&&(r.shapes=o),l.length>0&&(r.skeletons=l),u.length>0&&(r.animations=u),h.length>0&&(r.nodes=h)}return r.object=i,r;function a(e){let t=[];for(let r in e){let i=e[r];delete i.metadata,t.push(i)}return t}}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),null!==e.pivot&&(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)),!0===t)for(let t=0;t<e.children.length;t++){let r=e.children[t];this.add(r.clone())}return this}}th.DEFAULT_UP=new eT(0,1,0),th.DEFAULT_MATRIX_AUTO_UPDATE=!0,th.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class td extends th{constructor(){super(),this.isGroup=!0,this.type="Group"}}let tc={type:"move"};class tp{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new td,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new td,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new eT,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new eT),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new td,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new eT,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new eT),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,r){let i=null,n=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let i of(a=!0,e.hand.values())
1){let e=t.getJointPose(i,r),n=this._getHandJoint(l,i);null!==e&&(n.matrix.fromArray(e.transform.matrix),n.matrix.decompose(n.position,n.rotation,n.scale),n.matrixWorldNeedsUpdate=!0,n.jointRadius=e.radius),n.visible=null!==e}let i=l.joints["index-finger-tip"],n=l.joints["thumb-tip"],s=i.position.distanceTo(n.position);l.inputState.pinching&&s>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(n=t.getPose(e.gripSpace,r))&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,n.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(n.linearVelocity)):o.hasLinearVelocity=!1,n.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(n.angularVelocity)):o.hasAngularVelocity=!1);null!==s&&(null===(i=t.getPose(e.targetRaySpace,r))&&null!==n&&(i=n),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(tc)))}return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==n),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let r=new td;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}let tf={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},tm={h:0,s:0,l:0},tg={h:0,s:0,l:0};function tv(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*6*(2/3-r):e}class ty{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){return void 0===t&&void 0===r?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,r),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=O){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,eN.colorSpaceToWorking(this,t),this}setRGB(e,t,r,i=eN.workingColorSpace){return this.r=e,this.g=t,this.b=r,eN.colorSpaceToWorking(this,i),this}
vendor: 14,508 bytes, line 1
1setHSL(e,t,r,i=eN.workingColorSpace){if(e=eg(e,1),t=em(t,0,1),r=em(r,0,1),0===t)this.r=this.g=this.b=r;else{let i=r<=.5?r*(1+t):r+t-r*t,n=2*r-i;this.r=tv(n,i,e+1/3),this.g=tv(n,i,e),this.b=tv(n,i,e-1/3)}return eN.colorSpaceToWorking(this,i),this}setStyle(e,t=O){let r;function i(t){void 0!==t&&1>parseFloat(t)&&en("Color: Alpha component of "+e+" will be ignored.")}if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let n,a=r[1],s=r[2];switch(a){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(n[4]),this.setRGB(Math.min(255,parseInt(n[1],10))/255,Math.min(255,parseInt(n[2],10))/255,Math.min(255,parseInt(n[3],10))/255,t);if(n=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(n[4]),this.setRGB(Math.min(100,parseInt(n[1],10))/100,Math.min(100,parseInt(n[2],10))/100,Math.min(100,parseInt(n[3],10))/100,t);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(n[4]),this.setHSL(parseFloat(n[1])/360,parseFloat(n[2])/100,parseFloat(n[3])/100,t);break;default:en("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let i=r[1],n=i.length;if(3===n)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,t);if(6===n)return this.setHex(parseInt(i,16),t);en("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=O){let r=tf[e.toLowerCase()];return void 0!==r?this.setHex(r,t):en("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=eL(e.r),this.g=eL(e.g),this.b=eL(e.b),this}copyLinearToSRGB(e){return this.r=eB(e.r),this.g=eB(e.g),this.b=eB(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=O){return eN.workingToColorSpace(t_.copy(this),e),65536*Math.round(em(255*t_.r,0,255))+256*Math.round(em(255*t_.g,0,255))+Math.round(em(255*t_.b,0,255))}getHexString(e=O){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=eN.workingColorSpace){let r,i;eN.workingToColorSpace(t_.copy(this),t);let n=t_.r,a=t_.g,s=t_.b,o=Math.max(n,a,s),l=Math.min(n,a,s),u=(l+o)/2;if(l===o)r=0,i=0;else{let e=o-l;switch(i=u<=.5?e/(o+l):e/(2-o-l),o){case n:r=(a-s)/e+6*(a<s);break;case a:r=(s-n)/e+2;break;case s:r=(n-a)/e+4}r/=6}return e.h=r,e.s=i,e.l=u,e}getRGB(e,t=eN.workingColorSpace){return eN.workingToColorSpace(t_.copy(this),t),e.r=t_.r,e.g=t_.g,e.b=t_.b,e}getStyle(e=O){eN.workingToColorSpace(t_.copy(this),e);let t=t_.r,r=t_.g,i=t_.b;return e!==O?`color(${e} ${t.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*r)},${Math.round(255*i)})`}offsetHSL(e,t,r){return this.getHSL(tm),this.setHSL(tm.h+e,tm.s+t,tm.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(tm),e.getHSL(tg);let r=ev(tm.h,tg.h,t),i=ev(tm.s,tg.s,t),n=ev(tm.l,tg.l,t);return this.setHSL(r,i,n),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,r=this.g,i=this.b,n=e.elements;return this.r=n[0]*t+n[3]*r+n[6]*i,this.g=n[1]*t+n[4]*r+n[7]*i,this.b=n[2]*t+n[5]*r+n[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}let t_=new ty;ty.NAMES=tf;class tx{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new ty(e),this.density=t}clone(){return new tx(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class tb{constructor(e,t=1,r=1e3){this.isFog=!0,this.name="",this.color=new ty(e),this.near=t,this.far=r}clone(){return new tb(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class tS extends th{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new e3,this.environmentIntensity=1,this.environmentRotation=new e3,this.overrideMaterial=null,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}let tT=new eT,tA=new eT,tM=new eT,tE=new eT,tC=new eT,tw=new eT,tR=new eT,tN=new eT,tL=new eT,tB=new eT,tI=new ek,tP=new ek,tF=new ek;class tD{constructor(e=new eT,t=new eT,r=new eT){this.a=e,this.b=t,this.c=r}static getNormal(e,t,r,i){i.subVectors(r,t),tT.subVectors(e,t),i.cross(tT);let n=i.lengthSq();return n>0?i.multiplyScalar(1/Math.sqrt(n)):i.set(0,0,0)}static getBarycoord(e,t,r,i,n){tT.subVectors(i,t),tA.subVectors(r,t),tM.subVectors(e,t);let a=tT.dot(tT),s=tT.dot(tA),o=tT.dot(tM),l=tA.dot(tA),u=tA.dot(tM),h=a*l-s*s;if(0===h)return n.set(0,0,0),null;let d=1/h,c=(l*o-s*u)*d,p=(a*u-s*o)*d;return n.set(1-c-p,p,c)}static containsPoint(e,t,r,i){return null!==this.getBarycoord(e,t,r,i,tE)&&tE.x>=0&&tE.y>=0&&tE.x+tE.y<=1}static getInterpolation(e,t,r,i,n,a,s,o){return null===this.getBarycoord(e,t,r,i,tE)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(n,tE.x),o.addScaledVector(a,tE.y),o.addScaledVector(s,tE.z),o)}static getInterpolatedAttribute(e,t,r,i,n,a){return tI.setScalar(0),tP.setScalar(0),tF.setScalar(0),tI.fromBufferAttribute(e,t),tP.fromBufferAttribute(e,r),tF.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(tI,n.x),a.addScaledVector(tP,n.y),a.addScaledVector(tF,n.z),a}static isFrontFacing(e,t,r,i){return tT.subVectors(r,t),tA.subVectors(e,t),0>tT.cross(tA).dot(i)}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,r,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),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 tT.subVectors(this.c,this.b),tA.subVectors(this.a,this.b),.5*tT.cross(tA).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return tD.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return tD.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,r,i,n){return tD.getInterpolation(e,this.a,this.b,this.c,t,r,i,n)}containsPoint(e){return tD.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return tD.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let r,i,n=this.a,a=this.b,s=this.c;tC.subVectors(a,n),tw.subVectors(s,n),tN.subVectors(e,n);let o=tC.dot(tN),l=tw.dot(tN);if(o<=0&&l<=0)return t.copy(n);tL.subVectors(e,a);let u=tC.dot(tL),h=tw.dot(tL);if(u>=0&&h<=u)return t.copy(a);let d=o*h-u*l;if(d<=0&&o>=0&&u<=0)return r=o/(o-u),t.copy(n).addScaledVector(tC,r);tB.subVectors(e,s);let c=tC.dot(tB),p=tw.dot(tB);if(p>=0&&c<=p)return t.copy(s);let f=c*l-o*p;if(f<=0&&l>=0&&p<=0)return i=l/(l-p),t.copy(n).addScaledVector(tw,i);let m=u*p-c*h;if(m<=0&&h-u>=0&&c-p>=0)return tR.subVectors(s,a),i=(h-u)/(h-u+(c-p)),t.copy(a).addScaledVector(tR,i);let g=1/(m+f+d);return r=f*g,i=d*g,t.copy(n).addScaledVector(tC,r).addScaledVector(tw,i)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class tU{constructor(e=new eT(Infinity,Infinity,Infinity),t=new eT(-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,r=e.length;t<r;t+=3)this.expandByPoint(tG.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,r=e.count;t<r;t++)this.expandByPoint(tG.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=tG.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let r=e.geometry;if(void 0!==r){let i=r.getAttribute("position");if(!0===t&&void 0!==i&&!0!==e.isInstancedMesh)for(let t=0,r=i.count;t<r;t++)!0===e.isMesh?e.getVertexPosition(t,tG):tG.fromBufferAttribute(i,t),tG.applyMatrix4(e.matrixWorld),this.expandByPoint(tG);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),tk.copy(e.boundingBox)):(null===r.boundingBox&&r.computeBoundingBox(),tk.copy(r.boundingBox)),tk.applyMatrix4(e.matrixWorld),this.union(tk)}let i=e.children;for(let e=0,r=i.length;e<r;e++)this.expandByObject(i[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,tG),tG.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(tq),t$.subVectors(this.max,tq),tV.subVectors(e.a,tq),tz.subVectors(e.b,tq),tH.subVectors(e.c,tq),tW.subVectors(tz,tV),tj.subVectors(tH,tz),tX.subVectors(tV,tH);let t=[0,-tW.z,tW.y,0,-tj.z,tj.y,0,-tX.z,tX.y,tW.z,0,-tW.x,tj.z,0,-tj.x,tX.z,0,-tX.x,-tW.y,tW.x,0,-tj.y,tj.x,0,-tX.y,tX.x,0];return!!tY(t,tV,tz,tH,t$)&&!!tY(t=[1,0,0,0,1,0,0,0,1],tV,tz,tH,t$)&&(tJ.crossVectors(tW,tj),tY(t=[tJ.x,tJ.y,tJ.z],tV,tz,tH,t$))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,tG).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(tG).length()),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()||(tO[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),tO[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),tO[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),tO[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),tO[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),tO[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),tO[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),tO[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(tO)),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}}let tO=[new eT,new eT,new eT,new eT,new eT,new eT,new eT,new eT],tG=new eT,tk=new tU,tV=new eT,tz=new eT,tH=new eT,tW=new eT,tj=new eT,tX=new eT,tq=new eT,t$=new eT,tJ=new eT,tK=new eT;function tY(e,t,r,i,n){for(let a=0,s=e.length-3;a<=s;a+=3){tK.fromArray(e,a);
vendor: 4,773 bytes, line 1
1let s=n.x*Math.abs(tK.x)+n.y*Math.abs(tK.y)+n.z*Math.abs(tK.z),o=t.dot(tK),l=r.dot(tK),u=i.dot(tK);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>s)return!1}return!0}let tQ=function(){let e=new ArrayBuffer(4),t=new Float32Array(e),r=new Uint32Array(e),i=new Uint32Array(512),n=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(i[e]=0,i[256|e]=32768,n[e]=24,n[256|e]=24):t<-14?(i[e]=1024>>-t-14,i[256|e]=1024>>-t-14|32768,n[e]=-t-1,n[256|e]=-t-1):t<=15?(i[e]=t+15<<10,i[256|e]=t+15<<10|32768,n[e]=13,n[256|e]=13):t<128?(i[e]=31744,i[256|e]=64512,n[e]=24,n[256|e]=24):(i[e]=31744,i[256|e]=64512,n[e]=13,n[256|e]=13)}let a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,r=0;for(;(8388608&t)==0;)t<<=1,r-=8388608;t&=-8388609,r+=0x38800000,a[e]=t|r}for(let e=1024;e<2048;++e)a[e]=0x38000000+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=0x47800000,s[32]=0x80000000;for(let e=33;e<63;++e)s[e]=0x80000000+(e-32<<23);s[63]=0xc7800000;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:r,baseTable:i,shiftTable:n,mantissaTable:a,exponentTable:s,offsetTable:o}}();function tZ(e){Math.abs(e)>65504&&en("DataUtils.toHalfFloat(): Value out of range."),e=em(e,-65504,65504),tQ.floatView[0]=e;let t=tQ.uint32View[0],r=t>>23&511;return tQ.baseTable[r]+((8388607&t)>>tQ.shiftTable[r])}function t0(e){let t=e>>10;return tQ.uint32View[0]=tQ.mantissaTable[tQ.offsetTable[t]+(1023&e)]+tQ.exponentTable[t],tQ.floatView[0]}class t1{static toHalfFloat(e){return tZ(e)}static fromHalfFloat(e){return t0(e)}}let t2=new eT,t3=new eb,t4=0;class t5{constructor(e,t,r=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:t4++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=r,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&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,r){e*=this.itemSize,r*=t.itemSize;for(let i=0,n=this.itemSize;i<n;i++)this.array[e+i]=t.array[r+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,r=this.count;t<r;t++)t3.fromBufferAttribute(this,t),t3.applyMatrix3(e),this.setXY(t,t3.x,t3.y);else if(3===this.itemSize)for(let t=0,r=this.count;t<r;t++)t2.fromBufferAttribute(this,t),t2.applyMatrix3(e),this.setXYZ(t,t2.x,t2.y,t2.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)t2.fromBufferAttribute(this,t),t2.applyMatrix4(e),this.setXYZ(t,t2.x,t2.y,t2.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)t2.fromBufferAttribute(this,t),t2.applyNormalMatrix(e),this.setXYZ(t,t2.x,t2.y,t2.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)t2.fromBufferAttribute(this,t),t2.transformDirection(e),this.setXYZ(t,t2.x,t2.y,t2.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let r=this.array[e*this.itemSize+t];return this.normalized&&(r=ey(r,this.array)),r}setComponent(e,t,r){return this.normalized&&(r=e_(r,this.array)),this.array[e*this.itemSize+t]=r,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ey(t,this.array)),t}setX(e,t){return this.normalized&&(t=e_(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ey(t,this.array)),t}setY(e,t){return this.normalized&&(t=e_(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=ey(t,this.array)),t}setZ(e,t){return this.normalized&&(t=e_(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=ey(t,this.array)),t}setW(e,t){return this.normalized&&(t=e_(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=e_(t,this.array),r=e_(r,this.array)),this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,i){return e*=this.itemSize,this.normalized&&(t=e_(t,this.array),r=e_(r,this.array),i=e_(i,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,t,r,i,n){return e*=this.itemSize,this.normalized&&(t=e_(t,this.array),r=e_(r,this.array),i=e_(i,this.array),n=e_(n,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=n,this}
1onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),e}}class t8 extends t5{constructor(e,t,r){super(new Int8Array(e),t,r)}}class t6 extends t5{constructor(e,t,r){super(new Uint8Array(e),t,r)}}class t9 extends t5{constructor(e,t,r){super(new Uint8ClampedArray(e),t,r)}}class t7 extends t5{constructor(e,t,r){super(new Int16Array(e),t,r)}}class re extends t5{constructor(e,t,r){super(new Uint16Array(e),t,r)}}class rt extends t5{constructor(e,t,r){super(new Int32Array(e),t,r)}}class rr extends t5{constructor(e,t,r){super(new Uint32Array(e),t,r)}}class ri extends t5{constructor(e,t,r){super(new Uint16Array(e),t,r),this.isFloat16BufferAttribute=!0}getX(e){let t=t0(this.array[e*this.itemSize]);return this.normalized&&(t=ey(t,this.array)),t}setX(e,t){return this.normalized&&(t=e_(t,this.array)),this.array[e*this.itemSize]=tZ(t),this}getY(e){let t=t0(this.array[e*this.itemSize+1]);return this.normalized&&(t=ey(t,this.array)),t}setY(e,t){return this.normalized&&(t=e_(t,this.array)),this.array[e*this.itemSize+1]=tZ(t),this}getZ(e){let t=t0(this.array[e*this.itemSize+2]);return this.normalized&&(t=ey(t,this.array)),t}setZ(e,t){return this.normalized&&(t=e_(t,this.array)),this.array[e*this.itemSize+2]=tZ(t),this}getW(e){let t=t0(this.array[e*this.itemSize+3]);return this.normalized&&(t=ey(t,this.array)),t}setW(e,t){return this.normalized&&(t=e_(t,this.array)),this.array[e*this.itemSize+3]=tZ(t),this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=e_(t,this.array),r=e_(r,this.array)),this.array[e+0]=tZ(t),this.array[e+1]=tZ(r),this}setXYZ(e,t,r,i){return e*=this.itemSize,this.normalized&&(t=e_(t,this.array),r=e_(r,this.array),i=e_(i,this.array)),this.array[e+0]=tZ(t),this.array[e+1]=tZ(r),this.array[e+2]=tZ(i),this}setXYZW(e,t,r,i,n){return e*=this.itemSize,this.normalized&&(t=e_(t,this.array),r=e_(r,this.array),i=e_(i,this.array),n=e_(n,this.array)),this.array[e+0]=tZ(t),this.array[e+1]=tZ(r),this.array[e+2]=tZ(i),this.array[e+3]=tZ(n),this}}class rn extends t5{constructor(e,t,r){super(new Float32Array(e),t,r)}}let ra=new tU,rs=new eT,ro=new eT;class rl{constructor(e=new eT,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let r=this.center;void 0!==t?r.copy(t):ra.setFromPoints(e).getCenter(r);let i=0;for(let t=0,n=e.length;t<n;t++)i=Math.max(i,r.distanceToSquared(e[t]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let r=this.center.distanceToSquared(e);return t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.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;rs.subVectors(e,this.center);let t=rs.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),r=(e-this.radius)*.5;this.center.addScaledVector(rs,r/e),this.radius+=r}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(ro.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(rs.copy(e.center).add(ro)),this.expandByPoint(rs.copy(e.center).sub(ro)))),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 ru=0,rh=new eq,rd=new th,rc=new eT,rp=new tU,rf=new tU,rm=new eT;class rg extends eu{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ru++}),this.uuid=ef(),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(!function(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}(e)?re:rr)(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 void 0!==this.attributes[e]}addGroup(e,t,r=0){this.groups.push({start:e,count:t,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let r=this.attributes.normal;if(void 0!==r){let t=new eE().getNormalMatrix(e);r.applyNormalMatrix(t),r.needsUpdate=!0}let i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return rh.makeRotationFromQuaternion(e),this.applyMatrix4(rh),this}rotateX(e){return rh.makeRotationX(e),this.applyMatrix4(rh),this}rotateY(e){return rh.makeRotationY(e),this.applyMatrix4(rh),this}rotateZ(e){return rh.makeRotationZ(e),this.applyMatrix4(rh),this}translate(e,t,r){return rh.makeTranslation(e,t,r),this.applyMatrix4(rh),this}scale(e,t,r){return rh.makeScale(e,t,r),this.applyMatrix4(rh),this}lookAt(e){return rd.lookAt(e),rd.updateMatrix(),this.applyMatrix4(rd.matrix
1),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(rc).negate(),this.translate(rc.x,rc.y,rc.z),this}setFromPoints(e){let t=this.getAttribute("position");if(void 0===t){let t=[];for(let r=0,i=e.length;r<i;r++){let i=e[r];t.push(i.x,i.y,i.z||0)}this.setAttribute("position",new rn(t,3))}else{let r=Math.min(e.length,t.count);for(let i=0;i<r;i++){let r=e[i];t.setXYZ(i,r.x,r.y,r.z||0)}e.length>t.count&&en("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new tU);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ea("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new eT(-1/0,-1/0,-1/0),new eT(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,r=t.length;e<r;e++){let r=t[e];rp.setFromBufferAttribute(r),this.morphTargetsRelative?(rm.addVectors(this.boundingBox.min,rp.min),this.boundingBox.expandByPoint(rm),rm.addVectors(this.boundingBox.max,rp.max),this.boundingBox.expandByPoint(rm)):(this.boundingBox.expandByPoint(rp.min),this.boundingBox.expandByPoint(rp.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&ea('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new rl);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){ea("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new eT,1/0);return}if(e){let r=this.boundingSphere.center;if(rp.setFromBufferAttribute(e),t)for(let e=0,r=t.length;e<r;e++){let r=t[e];rf.setFromBufferAttribute(r),this.morphTargetsRelative?(rm.addVectors(rp.min,rf.min),rp.expandByPoint(rm),rm.addVectors(rp.max,rf.max),rp.expandByPoint(rm)):(rp.expandByPoint(rf.min),rp.expandByPoint(rf.max))}rp.getCenter(r);let i=0;for(let t=0,n=e.count;t<n;t++)rm.fromBufferAttribute(e,t),i=Math.max(i,r.distanceToSquared(rm));if(t)for(let n=0,a=t.length;n<a;n++){let a=t[n],s=this.morphTargetsRelative;for(let t=0,n=a.count;t<n;t++)rm.fromBufferAttribute(a,t),s&&(rc.fromBufferAttribute(e,t),rm.add(rc)),i=Math.max(i,r.distanceToSquared(rm))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&ea('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void ea("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let r=t.position,i=t.normal,n=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new t5(new Float32Array(4*r.count),4));let a=this.getAttribute("tangent"),s=[],o=[];for(let e=0;e<r.count;e++)s[e]=new eT,o[e]=new eT;let l=new eT,u=new eT,h=new eT,d=new eb,c=new eb,p=new eb,f=new eT,m=new eT,g=this.groups;0===g.length&&(g=[{start:0,count:e.count}]);for(let t=0,i=g.length;t<i;++t){let i=g[t],a=i.start,v=i.count;for(let t=a,i=a+v;t<i;t+=3)!function(e,t,i){l.fromBufferAttribute(r,e),u.fromBufferAttribute(r,t),h.fromBufferAttribute(r,i),d.fromBufferAttribute(n,e),c.fromBufferAttribute(n,t),p.fromBufferAttribute(n,i),u.sub(l),h.sub(l),c.sub(d),p.sub(d);let a=1/(c.x*p.y-p.x*c.y);isFinite(a)&&(f.copy(u).multiplyScalar(p.y).addScaledVector(h,-c.y).multiplyScalar(a),m.copy(h).multiplyScalar(c.x).addScaledVector(u,-p.x).multiplyScalar(a),s[e].add(f),s[t].add(f),s[i].add(f),o[e].add(m),o[t].add(m),o[i].add(m))}(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new eT,y=new eT,_=new eT,x=new eT;function b(e){_.fromBufferAttribute(i,e),x.copy(_);let t=s[e];v.copy(t),v.sub(_.multiplyScalar(_.dot(t))).normalize(),y.crossVectors(x,t);let r=y.dot(o[e]);a.setXYZW(e,v.x,v.y,v.z,r<0?-1:1)}for(let t=0,r=g.length;t<r;++t){let r=g[t],i=r.start,n=r.count;for(let t=i,r=i+n;t<r;t+=3)b(e.getX(t+0)),b(e.getX(t+1)),b(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let r=this.getAttribute("normal");if(void 0===r)r=new t5(new Float32Array(3*t.count),3),this.setAttribute("normal",r);else for(let e=0,t=r.count;e<t;e++)r.setXYZ(e,0,0,0);let i=new eT,n=new eT,a=new eT,s=new eT,o=new eT,l=new eT,u=new eT,h=new eT;
vendor: 4,284 bytes, line 1
1if(e)for(let d=0,c=e.count;d<c;d+=3){let c=e.getX(d+0),p=e.getX(d+1),f=e.getX(d+2);i.fromBufferAttribute(t,c),n.fromBufferAttribute(t,p),a.fromBufferAttribute(t,f),u.subVectors(a,n),h.subVectors(i,n),u.cross(h),s.fromBufferAttribute(r,c),o.fromBufferAttribute(r,p),l.fromBufferAttribute(r,f),s.add(u),o.add(u),l.add(u),r.setXYZ(c,s.x,s.y,s.z),r.setXYZ(p,o.x,o.y,o.z),r.setXYZ(f,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)i.fromBufferAttribute(t,e+0),n.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),u.subVectors(a,n),h.subVectors(i,n),u.cross(h),r.setXYZ(e+0,u.x,u.y,u.z),r.setXYZ(e+1,u.x,u.y,u.z),r.setXYZ(e+2,u.x,u.y,u.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,r=e.count;t<r;t++)rm.fromBufferAttribute(e,t),rm.normalize(),e.setXYZ(t,rm.x,rm.y,rm.z)}toNonIndexed(){function e(e,t){let r=e.array,i=e.itemSize,n=e.normalized,a=new r.constructor(t.length*i),s=0,o=0;for(let n=0,l=t.length;n<l;n++){s=e.isInterleavedBufferAttribute?t[n]*e.data.stride+e.offset:t[n]*i;for(let e=0;e<i;e++)a[o++]=r[s++]}return new t5(a,i,n)}if(null===this.index)return en("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new rg,r=this.index.array,i=this.attributes;for(let n in i){let a=e(i[n],r);t.setAttribute(n,a)}let n=this.morphAttributes;for(let i in n){let a=[],s=n[i];for(let t=0,i=s.length;t<i;t++){let i=e(s[t],r);a.push(i)}t.morphAttributes[i]=a}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let e=0,r=a.length;e<r;e++){let r=a[e];t.addGroup(r.start,r.count,r.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let r in t)void 0!==t[r]&&(e[r]=t[r]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let r=this.attributes;for(let t in r){let i=r[t];e.data.attributes[t]=i.toJSON(e.data)}let i={},n=!1;for(let t in this.morphAttributes){let r=this.morphAttributes[t],a=[];for(let t=0,i=r.length;t<i;t++){let i=r[t];a.push(i.toJSON(e.data))}a.length>0&&(i[t]=a,n=!0)}n&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere=s.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let r=e.index;null!==r&&this.setIndex(r.clone());let i=e.attributes;for(let e in i){let r=i[e];this.setAttribute(e,r.clone(t))}let n=e.morphAttributes;for(let e in n){let r=[],i=n[e];for(let e=0,n=i.length;e<n;e++)r.push(i[e].clone(t));this.morphAttributes[e]=r}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());let o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class rv{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=ef()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(let i=0,n=this.stride;i<n;i++)this.array[e+i]=t.array[r+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=ef()
1),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(t,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=ef()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}let ry=new eT;class r_{constructor(e,t,r,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=r,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,r=this.data.count;t<r;t++)ry.fromBufferAttribute(this,t),ry.applyMatrix4(e),this.setXYZ(t,ry.x,ry.y,ry.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)ry.fromBufferAttribute(this,t),ry.applyNormalMatrix(e),this.setXYZ(t,ry.x,ry.y,ry.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)ry.fromBufferAttribute(this,t),ry.transformDirection(e),this.setXYZ(t,ry.x,ry.y,ry.z);return this}getComponent(e,t){let r=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(r=ey(r,this.array)),r}setComponent(e,t,r){return this.normalized&&(r=e_(r,this.array)),this.data.array[e*this.data.stride+this.offset+t]=r,this}setX(e,t){return this.normalized&&(t=e_(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=e_(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=e_(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=e_(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=ey(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=ey(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=ey(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=ey(t,this.array)),t}setXY(e,t,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=e_(t,this.array),r=e_(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this}setXYZ(e,t,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=e_(t,this.array),r=e_(r,this.array),i=e_(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this}setXYZW(e,t,r,i,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=e_(t,this.array),r=e_(r,this.array),i=e_(i,this.array),n=e_(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this.data.array[e+3]=n,this}clone(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new r_(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);{er("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let r=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[r+t])}return new t5(new this.array.constructor(e),this.itemSize,this.normalized)}}toJSON(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized};{er("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let r=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[r+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}}let rx=0;class rb extends eu{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:rx++}),this.uuid=ef(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ty(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let r=e[t];if(void 0===r){en(`Material: parameter '${t}' has value of undefined.`);continue}let i=this[t];if(void 0===i){en(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let r={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function i(e){let t=[];for(let r in e){let i=e[r];delete i.metadata,t.push(i)}return t}
vendor: 5,648 bytes, line 1
1if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),void 0!==this.roughness&&(r.roughness=this.roughness),void 0!==this.metalness&&(r.metalness=this.metalness),void 0!==this.sheen&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),void 0!==this.clearcoat&&(r.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(r.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(r.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(r.dispersion=this.dispersion),void 0!==this.iridescence&&(r.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(r.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(r.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(r.combine=this.combine)),void 0!==this.envMapRotation&&(r.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(r.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(r.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(r.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(r.size=this.size),null!==this.shadowSide&&(r.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(r.blending=this.blending),0!==this.side&&(r.side=this.side),!0===this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),!0===this.transparent&&(r.transparent=!0),204!==this.blendSrc&&(r.blendSrc=this.blendSrc),205!==this.blendDst&&(r.blendDst=this.blendDst),100!==this.blendEquation&&(r.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(r.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&
1(r.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(r.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(r.depthFunc=this.depthFunc),!1===this.depthTest&&(r.depthTest=this.depthTest),!1===this.depthWrite&&(r.depthWrite=this.depthWrite),!1===this.colorWrite&&(r.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(r.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(r.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(r.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(r.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(r.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(r.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(r.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(r.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(r.rotation=this.rotation),!0===this.polygonOffset&&(r.polygonOffset=!0),0!==this.polygonOffsetFactor&&(r.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(r.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(r.linewidth=this.linewidth),void 0!==this.dashSize&&(r.dashSize=this.dashSize),void 0!==this.gapSize&&(r.gapSize=this.gapSize),void 0!==this.scale&&(r.scale=this.scale),!0===this.dithering&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),!0===this.alphaHash&&(r.alphaHash=!0),!0===this.alphaToCoverage&&(r.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(r.premultipliedAlpha=!0),!0===this.forceSinglePass&&(r.forceSinglePass=!0),!1===this.allowOverride&&(r.allowOverride=!1),!0===this.wireframe&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(r.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(r.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(r.flatShading=!0),!1===this.visible&&(r.visible=!1),!1===this.toneMapped&&(r.toneMapped=!1),!1===this.fog&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData),t){let t=i(e.textures),n=i(e.images);t.length>0&&(r.textures=t),n.length>0&&(r.images=n)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,r=null;if(null!==t){let e=t.length;r=Array(e);for(let i=0;i!==e;++i)r[i]=t[i].clone()}return this.clippingPlanes=r,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){!0===e&&this.version++}}class rS extends rb{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ty(0xffffff),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 rT=new eT,rA=new eT,rM=new eT,rE=new eb,rC=new eb,rw=new eq,rR=new eT,rN=new eT,rL=new eT,rB=new eb,rI=new eb,rP=new eb;class rF extends th{constructor(e=new rS){if(super(),this.isSprite=!0,this.type="Sprite",void 0===r){r=new rg;const e=new rv(new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),5);r.setIndex([0,1,2,0,2,3]),r.setAttribute("position",new r_(e,3,0,!1)),r.setAttribute("uv",new r_(e,2,3,!1))}this.geometry=r,this.material=e,this.center=new eb(.5,.5),this.count=1}raycast(e,t){let r,i;null===e.camera&&ea('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),rA.setFromMatrixScale(this.matrixWorld),rw.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),rM.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&rA.multiplyScalar(-rM.z);let n=this.material.rotation;0!==n&&(i=Math.cos(n),r=Math.sin(n));let a=this.center;rD(rR.set(-.5,-.5,0),rM,a,rA,r,i),rD(rN.set(.5,-.5,0),rM,a,rA,r,i),rD(rL.set(.5,.5,0),rM,a,rA,r,i),rB.set(0,0),rI.set(1,0),rP.set(1,1);let s=e.ray.intersectTriangle(rR,rN,rL,!1,rT);if(null===s&&(rD(rN.set(-.5,.5,0),rM,a,rA,r,i),rI.set(0,1),null===(s=e.ray.intersectTriangle(rR,rL,rN,!1,rT))))return;let o=e.ray.origin.distanceTo(rT);o<e.near||o>e.far||t.push({distance:o,point:rT.clone(),uv:tD.getInterpolation(rT,rR,rN,rL,rB,rI,rP,new eb),face:null,object:this})}copy(e,t){return super.copy(e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function rD(e,t,r,i,n,a){rE.subVectors(e,r).addScalar(.5).multiply(i),void 0!==n?(rC.x=a*rE.x-n*rE.y,rC.y=n*rE.x+a*rE.y):rC.copy(rE),e.copy(t),e.x+=rC.x,e.y+=rC.y,e.applyMatrix4(rw)}let rU=new eT,rO=new eT;class rG extends th{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);let t=e.levels;for(let e=0,r=t.length;e<r;e++){let r=t[e];this.addLevel(r.object.clone(),r.distance,r.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,r=0){let i;t=Math.abs(t);let n=this.levels;for(i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,hysteresis:r,object:e}),this.add(e),this}removeLevel(e){let t=this.levels;for(let r=0;r<t.length;r++)if(t[r].distance===e){let e=t.splice(r,1);return this.remove(e[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){let t=this.levels;if(t.length>0){let r,i;for(r=1,i=t.length;r<i;r++){let i=t[r].distance;if(t[r].object.visible&&(i-=i*t[r].hysteresis),e<i)break}return t[r-1].object}return null}raycast(e,t){if(this.levels.length>0){rU.setFromMatrixPosition(this.matrixWorld);let r=e.ray.origin.distanceTo(rU);this.getObjectForDistance(r).raycast(e,t)}}update(e){let t=this.levels;if(t.length>1){let r,i;rU.setFromMatrixPosition(e.matrixWorld),rO.setFromMatrixPosition(this.matrixWorld);let n=rU.distanceTo(rO)/e.zoom;for(r=1,t[0].object.visible=!0,i=t.length;r<i;r++){let e=t[r].distance;if(t[r].object.visible&&(e-=e*t[r].hysteresis),n>=e)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}}toJSON(e){let t=super.toJSON(e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];let r=this.levels;for(let e=0,i=r.length;e<i;e++){let i=r[e];t.object.levels.push({object:i.object.uuid,distance:i.distance,hysteresis:i.hysteresis})}return t}}let rk=new eT,rV=new eT,rz=new eT,rH=new eT,rW=new eT,rj=new eT,rX=new eT;class rq{constructor(e=new eT,t=new eT(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,rk)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=rk.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(rk.copy(this.origin).addScaledVector(this.direction,t),rk.distanceToSquared(e))}
1distanceSqToSegment(e,t,r,i){let n,a,s,o;rV.copy(e).add(t).multiplyScalar(.5),rz.copy(t).sub(e).normalize(),rH.copy(this.origin).sub(rV);let l=.5*e.distanceTo(t),u=-this.direction.dot(rz),h=rH.dot(this.direction),d=-rH.dot(rz),c=rH.lengthSq(),p=Math.abs(1-u*u);if(p>0)if(n=u*d-h,a=u*h-d,o=l*p,n>=0)if(a>=-o)if(a<=o){let e=1/p;n*=e,a*=e,s=n*(n+u*a+2*h)+a*(u*n+a+2*d)+c}else s=-(n=Math.max(0,-(u*(a=l)+h)))*n+a*(a+2*d)+c;else s=-(n=Math.max(0,-(u*(a=-l)+h)))*n+a*(a+2*d)+c;else a<=-o?(a=(n=Math.max(0,-(-u*l+h)))>0?-l:Math.min(Math.max(-l,-d),l),s=-n*n+a*(a+2*d)+c):a<=o?(n=0,s=(a=Math.min(Math.max(-l,-d),l))*(a+2*d)+c):(a=(n=Math.max(0,-(u*l+h)))>0?l:Math.min(Math.max(-l,-d),l),s=-n*n+a*(a+2*d)+c);else a=u>0?-l:l,s=-(n=Math.max(0,-(u*a+h)))*n+a*(a+2*d)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,n),i&&i.copy(rV).addScaledVector(rz,a),s}intersectSphere(e,t){rk.subVectors(e.center,this.origin);let r=rk.dot(this.direction),i=rk.dot(rk)-r*r,n=e.radius*e.radius;if(i>n)return null;let a=Math.sqrt(n-i),s=r-a,o=r+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){let r=this.distanceToPlane(e);return null===r?null:this.at(r,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return!!(0===t||e.normal.dot(this.direction)*t<0)}intersectBox(e,t){let r,i,n,a,s,o,l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return(l>=0?(r=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(r=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),u>=0?(n=(e.min.y-d.y)*u,a=(e.max.y-d.y)*u):(n=(e.max.y-d.y)*u,a=(e.min.y-d.y)*u),r>a||n>i||((n>r||isNaN(r))&&(r=n),(a<i||isNaN(i))&&(i=a),h>=0?(s=(e.min.z-d.z)*h,o=(e.max.z-d.z)*h):(s=(e.max.z-d.z)*h,o=(e.min.z-d.z)*h),r>o||s>i||((s>r||r!=r)&&(r=s),(o<i||i!=i)&&(i=o),i<0)))?null:this.at(r>=0?r:i,t)}intersectsBox(e){return null!==this.intersectBox(e,rk)}intersectTriangle(e,t,r,i,n){let a;rW.subVectors(t,e),rj.subVectors(r,e),rX.crossVectors(rW,rj);let s=this.direction.dot(rX);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}rH.subVectors(this.origin,e);let o=a*this.direction.dot(rj.crossVectors(rH,rj));if(o<0)return null;let l=a*this.direction.dot(rW.cross(rH));if(l<0||o+l>s)return null;let u=-a*rH.dot(rX);return u<0?null:this.at(u/s,n)}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 r$ extends rb{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ty(0xffffff),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 e3,this.combine=0,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}}let rJ=new eq,rK=new rq,rY=new rl,rQ=new eT,rZ=new eT,r0=new eT,r1=new eT,r2=new eT,r3=new eT,r4=new eT,r5=new eT;class r8 extends th{constructor(e=new rg,t=new r$){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),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let r=e[t[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=r.length;e<t;e++){let t=r[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let r=this.geometry,i=r.attributes.position,n=r.morphAttributes.position,a=r.morphTargetsRelative;t.fromBufferAttribute(i,e);let s=this.morphTargetInfluences;if(n&&s){r3.set(0,0,0);for(let r=0,i=n.length;r<i;r++){let i=s[r],o=n[r];0!==i&&(r2.fromBufferAttribute(o,e),a?r3.addScaledVector(r2,i):r3.addScaledVector(r2.sub(t),i))}t.add(r3)}return t}raycast(e,t){let r=this.geometry,i=this.material,n=this.matrixWorld;void 0===i||(null===r.boundingSphere&&r.computeBoundingSphere(),rY.copy(r.boun
1dingSphere),rY.applyMatrix4(n),rK.copy(e.ray).recast(e.near),!1===rY.containsPoint(rK.origin)&&(null===rK.intersectSphere(rY,rQ)||rK.origin.distanceToSquared(rQ)>(e.far-e.near)**2)||(rJ.copy(n).invert(),rK.copy(e.ray).applyMatrix4(rJ),(null===r.boundingBox||!1!==rK.intersectsBox(r.boundingBox))&&this._computeIntersections(e,t,rK)))}_computeIntersections(e,t,r){let i,n=this.geometry,a=this.material,s=n.index,o=n.attributes.position,l=n.attributes.uv,u=n.attributes.uv1,h=n.attributes.normal,d=n.groups,c=n.drawRange;if(null!==s)if(Array.isArray(a))for(let n=0,o=d.length;n<o;n++){let o=d[n],p=a[o.materialIndex],f=Math.max(o.start,c.start),m=Math.min(s.count,Math.min(o.start+o.count,c.start+c.count));for(let n=f;n<m;n+=3)(i=r6(this,p,e,r,l,u,h,s.getX(n),s.getX(n+1),s.getX(n+2)))&&(i.faceIndex=Math.floor(n/3),i.face.materialIndex=o.materialIndex,t.push(i))}else{let n=Math.max(0,c.start),o=Math.min(s.count,c.start+c.count);for(let d=n;d<o;d+=3)(i=r6(this,a,e,r,l,u,h,s.getX(d),s.getX(d+1),s.getX(d+2)))&&(i.faceIndex=Math.floor(d/3),t.push(i))}else if(void 0!==o)if(Array.isArray(a))for(let n=0,s=d.length;n<s;n++){let s=d[n],p=a[s.materialIndex],f=Math.max(s.start,c.start),m=Math.min(o.count,Math.min(s.start+s.count,c.start+c.count));for(let n=f;n<m;n+=3)(i=r6(this,p,e,r,l,u,h,n,n+1,n+2))&&(i.faceIndex=Math.floor(n/3),i.face.materialIndex=s.materialIndex,t.push(i))}else{let n=Math.max(0,c.start),s=Math.min(o.count,c.start+c.count);for(let o=n;o<s;o+=3)(i=r6(this,a,e,r,l,u,h,o,o+1,o+2))&&(i.faceIndex=Math.floor(o/3),t.push(i))}}}function r6(e,t,r,i,n,a,s,o,l,u){e.getVertexPosition(o,rZ),e.getVertexPosition(l,r0),e.getVertexPosition(u,r1);let h=function(e,t,r,i,n,a,s,o){if(null===(1===t.side?i.intersectTriangle(s,a,n,!0,o):i.intersectTriangle(n,a,s,0===t.side,o)))return null;r5.copy(o),r5.applyMatrix4(e.matrixWorld);let l=r.ray.origin.distanceTo(r5);return l<r.near||l>r.far?null:{distance:l,point:r5.clone(),object:e}}(e,t,r,i,rZ,r0,r1,r4);if(h){let e=new eT;tD.getBarycoord(r4,rZ,r0,r1,e),n&&(h.uv=tD.getInterpolatedAttribute(n,o,l,u,e,new eb)),a&&(h.uv1=tD.getInterpolatedAttribute(a,o,l,u,e,new eb)),s&&(h.normal=tD.getInterpolatedAttribute(s,o,l,u,e,new eT),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));let t={a:o,b:l,c:u,normal:new eT,materialIndex:0};tD.getNormal(rZ,r0,r1,t.normal),h.face=t,h.barycoord=e}return h}let r9=new eT,r7=new ek,ie=new ek,it=new eT,ir=new eq,ii=new eT,ia=new rl,is=new eq,io=new rq;class il extends r8{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=D,this.bindMatrix=new eq,this.bindMatrixInverse=new eq,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let e=this.geometry;null===this.boundingBox&&(this.boundingBox=new tU),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,ii),this.boundingBox.expandByPoint(ii)}computeBoundingSphere(){let e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new rl),this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,ii),this.boundingSphere.expandByPoint(ii)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let r=this.material,i=this.matrixWorld;void 0===r||(null===this.boundingSphere&&this.computeBoundingSphere(),ia.copy(this.boundingSphere),ia.applyMatrix4(i),!1===e.ray.intersectsSphere(ia)||(is.copy(i).invert(),io.copy(e.ray).applyMatrix4(is),(null===this.boundingBox||!1!==io.intersectsBox(this.boundingBox))&&this._computeIntersections(e,t,io)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new ek,t=this.geometry.attributes.skinWeight;for(let r=0,i=t.count;r<i;r++){e.fromBufferAttribute(t,r);let i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(r,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===D?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===U?this.bindMatrixInverse.copy(this.bindMatrix).invert():en("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}
1applyBoneTransform(e,t){let r=this.skeleton,i=this.geometry;r7.fromBufferAttribute(i.attributes.skinIndex,e),ie.fromBufferAttribute(i.attributes.skinWeight,e),r9.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){let i=ie.getComponent(e);if(0!==i){let n=r7.getComponent(e);ir.multiplyMatrices(r.bones[n].matrixWorld,r.boneInverses[n]),t.addScaledVector(it.copy(r9).applyMatrix4(ir),i)}}return t.applyMatrix4(this.bindMatrixInverse)}}class iu extends th{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ih extends eG{constructor(e=null,t=1,r=1,i,n,a,s,o,l=1003,u=1003,h,d){super(null,a,s,o,l,u,i,n,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}let id=new eq,ic=new eq;class ip{constructor(e=[],t=[]){this.uuid=ef(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){en("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new eq)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let t=new eq;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){let e=this.bones,t=this.boneInverses,r=this.boneMatrices,i=this.boneTexture;for(let i=0,n=e.length;i<n;i++){let n=e[i]?e[i].matrixWorld:ic;id.multiplyMatrices(n,t[i]),id.toArray(r,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new ip(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length),t=new Float32Array((e=Math.max(e=4*Math.ceil(e/4),4))*e*4);t.set(this.boneMatrices);let r=new ih(t,e,e,1023,1015);return r.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=r,this}getBoneByName(e){for(let t=0,r=this.bones.length;t<r;t++){let r=this.bones[t];if(r.name===e)return r}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let r=0,i=e.bones.length;r<i;r++){let i=e.bones[r],n=t[i];void 0===n&&(en("Skeleton: No bone found with UUID:",i),n=new iu),this.bones.push(n),this.boneInverses.push(new eq().fromArray(e.boneInverses[r]))}return this.init(),this}toJSON(){let e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,r=this.boneInverses;for(let i=0,n=t.length;i<n;i++){let n=t[i];e.bones.push(n.uuid);let a=r[i];e.boneInverses.push(a.toArray())}return e}}class im extends t5{constructor(e,t,r,i=1){super(e,t,r),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}let ig=new eq,iv=new eq,iy=[],i_=new tU,ix=new eq,ib=new r8,iS=new rl;class iT extends r8{constructor(e,t,r){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new im(new Float32Array(16*r),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=r,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<r;e++)this.setMatrixAt(e,ix)}computeBoundingBox(){let e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new tU),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let r=0;r<t;r++)this.getMatrixAt(r,ig),i_.copy(e.boundingBox).applyMatrix4(ig),this.boundingBox.union(i_)}computeBoundingSphere(){let e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new rl),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let r=0;r<t;r++)this.getMatrixAt(r,ig),iS.copy(e.boundingSphere).applyMatrix4(ig),this.boundingSphere.union(iS)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.previousInstanceMatrix&&(this.previousInstanceMatrix=e.previousInstanceMatrix.clone()),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&
1(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){let r=t.morphTargetInfluences,i=this.morphTexture.source.data.data,n=e*(r.length+1)+1;for(let e=0;e<r.length;e++)r[e]=i[n+e]}raycast(e,t){let r=this.matrixWorld,i=this.count;if((ib.geometry=this.geometry,ib.material=this.material,void 0!==ib.material)&&(null===this.boundingSphere&&this.computeBoundingSphere(),iS.copy(this.boundingSphere),iS.applyMatrix4(r),!1!==e.ray.intersectsSphere(iS)))for(let n=0;n<i;n++){this.getMatrixAt(n,ig),iv.multiplyMatrices(r,ig),ib.matrixWorld=iv,ib.raycast(e,iy);for(let e=0,r=iy.length;e<r;e++){let r=iy[e];r.instanceId=n,r.object=this,t.push(r)}iy.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new im(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){let r=t.morphTargetInfluences,i=r.length+1;null===this.morphTexture&&(this.morphTexture=new ih(new Float32Array(i*this.count),i,this.count,1028,1015));let n=this.morphTexture.source.data.data,a=0;for(let e=0;e<r.length;e++)a+=r[e];let s=this.geometry.morphTargetsRelative?1:1-a,o=i*e;n[o]=s,n.set(r,o+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null)}}let iA=new eT,iM=new eT,iE=new eE;class iC{constructor(e=new eT(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){let i=iA.subVectors(r,t).cross(iM.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let r=e.delta(iA),i=this.normal.dot(r);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let n=-(e.start.dot(this.normal)+this.constant)/i;return n<0||n>1?null:t.copy(e.start).addScaledVector(r,n)}intersectsLine(e){let t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let r=t||iE.getNormalMatrix(e),i=this.coplanarPoint(iA).applyMatrix4(e),n=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(n),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)}}let iw=new rl,iR=new eb(.5,.5),iN=new eT;class iL{constructor(e=new iC,t=new iC,r=new iC,i=new iC,n=new iC,a=new iC){this.planes=[e,t,r,i,n,a]}set(e,t,r,i,n,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(r),s[3].copy(i),s[4].copy(n),s[5].copy(a),this}copy(e){let t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,t=2e3,r=!1){let i=this.planes,n=e.elements,a=n[0],s=n[1],o=n[2],l=n[3],u=n[4],h=n[5],d=n[6],c=n[7],p=n[8],f=n[9],m=n[10],g=n[11],v=n[12],y=n[13],_=n[14],x=n[15];if(i[0].setComponents(l-a,c-u,g-p,x-v).normalize(),i[1].setComponents(l+a,c+u,g+p,x+v).normalize(),i[2].setComponents(l+s,c+h,g+f,x+y).normalize(),i[3].setComponents(l-s,c-h,g-f,x-y).normalize(),r)i[4].setComponents(o,d,m,_).normalize(),i[5].setComponents(l-o,c-d,g-m,x-_).normalize();else if(i[4].setComponents(l-o,c-d,g-m,x-_).normalize(),2e3===t)i[5].setComponents(l+o,c+d,g+m,x+_).normalize();else if(2001===t)i[5].setComponents(o,d,m,_).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),iw.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),iw.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(iw)}intersectsSprite(e){return iw.center.set(0,0,0),iw.radius=.7071067811865476+iR.distanceTo(e.center),iw.applyMatrix4(e.matrixWorld),this.intersectsSphere(iw)}intersectsSphere(e){let t=this.planes,r=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){let t=this.planes;for(let r=0;r<6;r++){let i=t[r];
1if(iN.x=i.normal.x>0?e.max.x:e.min.x,iN.y=i.normal.y>0?e.max.y:e.min.y,iN.z=i.normal.z>0?e.max.z:e.min.z,0>i.distanceToPoint(iN))return!1}return!0}containsPoint(e){let t=this.planes;for(let r=0;r<6;r++)if(0>t[r].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}}let iB=new eq,iI=new iL;class iP{constructor(){this.coordinateSystem=2e3}intersectsObject(e,t){if(!t.isArrayCamera||0===t.cameras.length)return!1;for(let r=0;r<t.cameras.length;r++){let i=t.cameras[r];if(iB.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),iI.setFromProjectionMatrix(iB,i.coordinateSystem,i.reversedDepth),iI.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||0===t.cameras.length)return!1;for(let r=0;r<t.cameras.length;r++){let i=t.cameras[r];if(iB.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),iI.setFromProjectionMatrix(iB,i.coordinateSystem,i.reversedDepth),iI.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||0===t.cameras.length)return!1;for(let r=0;r<t.cameras.length;r++){let i=t.cameras[r];if(iB.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),iI.setFromProjectionMatrix(iB,i.coordinateSystem,i.reversedDepth),iI.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||0===t.cameras.length)return!1;for(let r=0;r<t.cameras.length;r++){let i=t.cameras[r];if(iB.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),iI.setFromProjectionMatrix(iB,i.coordinateSystem,i.reversedDepth),iI.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||0===t.cameras.length)return!1;for(let r=0;r<t.cameras.length;r++){let i=t.cameras[r];if(iB.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),iI.setFromProjectionMatrix(iB,i.coordinateSystem,i.reversedDepth),iI.containsPoint(e))return!0}return!1}clone(){return new iP}}function iF(e,t){return e-t}function iD(e,t){return e.z-t.z}function iU(e,t){return t.z-e.z}let iO=new eq,iG=new ty(1,1,1),ik=new iL,iV=new iP,iz=new tU,iH=new rl,iW=new eT,ij=new eT,iX=new eT,iq=new class{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,r,i){let n=this.pool,a=this.list;this.index>=n.length&&n.push({start:-1,count:-1,z:-1,index:-1});let s=n[this.index];a.push(s),this.index++,s.start=e,s.count=t,s.z=r,s.index=i}reset(){this.list.length=0,this.index=0}},i$=new r8,iJ=[];function iK(e,t){if(e.constructor!==t.constructor){let r=Math.min(e.length,t.length);for(let i=0;i<r;i++)t[i]=e[i]}else{let r=Math.min(e.length,t.length);t.set(new e.constructor(e.buffer,0,r))}}class iY extends r8{constructor(e,t,r=2*t,i){super(new rg,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=r,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(4*this._maxInstanceCount),t=new ih(new Float32Array((e=Math.max(e=4*Math.ceil(e/4),4))*e*4),e,e,1023,1015);this._matricesTexture=t}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount),t=new ih(new Uint32Array((e=Math.ceil(e))*e),e,e,1029,1014);this._indirectTexture=t}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount),t=new ih(new Float32Array((e=Math.ceil(e))*e*4).fill(1),e,e,1023,1015);t.colorSpace=eN.workingColorSpace,this._colorsTexture=t}_initializeGeometry(e){let t=this.geometry,r=this._maxVertexCount,i=this._maxIndexCount;if(!1===this._geometryInitialized){for(let i in e.attributes){let{array:n,itemSize:a,normalized:s}=e.getAttribute(i),o=new t5(new n.constructor(r*a),a,s);t.setAttribute(i,o)}if(null!==e.getIndex()){let e=r>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new t5(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){let t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');
1for(let r in t.attributes){if(!e.hasAttribute(r))throw Error(`THREE.BatchedMesh: Added geometry missing "${r}". All geometries must have consistent attributes.`);let i=e.getAttribute(r),n=t.getAttribute(r);if(i.itemSize!==n.itemSize||i.normalized!==n.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){let t=this._instanceInfo;if(e<0||e>=t.length||!1===t[e].active)throw Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){let t=this._geometryInfo;if(e<0||e>=t.length||!1===t[e].active)throw Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new tU);let e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let r=0,i=t.length;r<i;r++){if(!1===t[r].active)continue;let i=t[r].geometryIndex;this.getMatrixAt(r,iO),this.getBoundingBoxAt(i,iz).applyMatrix4(iO),e.union(iz)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new rl);let e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let r=0,i=t.length;r<i;r++){if(!1===t[r].active)continue;let i=t[r].geometryIndex;this.getMatrixAt(r,iO),this.getBoundingSphereAt(i,iH).applyMatrix4(iO),e.union(iH)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw Error("THREE.BatchedMesh: Maximum item count reached.");let t={visible:!0,active:!0,geometryIndex:e},r=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(iF),r=this._availableInstanceIds.shift(),this._instanceInfo[r]=t):(r=this._instanceInfo.length,this._instanceInfo.push(t));let i=this._matricesTexture;iO.identity().toArray(i.image.data,16*r),i.needsUpdate=!0;let n=this._colorsTexture;return n&&(iG.toArray(n.image.data,4*r),n.needsUpdate=!0),this._visibilityChanged=!0,r}addGeometry(e,t=-1,r=-1){let i;this._initializeGeometry(e),this._validateGeometry(e);let n={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;n.vertexStart=this._nextVertexStart,n.reservedVertexCount=-1===t?e.getAttribute("position").count:t;let s=e.getIndex();if(null!==s&&(n.indexStart=this._nextIndexStart,n.reservedIndexCount=-1===r?s.count:r),-1!==n.indexStart&&n.indexStart+n.reservedIndexCount>this._maxIndexCount||n.vertexStart+n.reservedVertexCount>this._maxVertexCount)throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(iF),a[i=this._availableGeometryIds.shift()]=n):(i=this._geometryCount,this._geometryCount++,a.push(n)),this.setGeometryAt(i,e),this._nextIndexStart=n.indexStart+n.reservedIndexCount,this._nextVertexStart=n.vertexStart+n.reservedVertexCount,i}setGeometryAt(e,t){if(e>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);let r=this.geometry,i=null!==r.getIndex(),n=r.getIndex(),a=t.getIndex(),s=this._geometryInfo[e];if(i&&a.count>s.reservedIndexCount||t.attributes.position.count>s.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let o=s.vertexStart,l=s.reservedVertexCount;for(let e in s.vertexCount=t.getAttribute("position").count,r.attributes){let i=t.getAttribute(e),n=r.getAttribute(e);!function(e,t,r=0){let i=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){let n=e.count;for(let a=0;a<n;a++)for(let n=0;n<i;n++)t.setComponent(a+r,n,e.getComponent(a,n))}else t.array.set(e.array,r*i);t.needsUpdate=!0}(i,n,o);let a=i.itemSize;for(let e=i.count;e<l;e++){let t=o+e;for(let e=0;e<a;e++)n.setComponent(t,e,0)}n.needsUpdate=!0,n.addUpdateRange(o*a,l*a)}if(i){let e=s.indexStart,r=s.reservedIndexCount;s.indexCount=t.getIndex().count;for(let t=0;t<a.count;t++)n.setX(e+t,o+a.getX(t));for(let t=a.count;t<r;t++)n.setX(e+t,o);n.needsUpdate=!0,n.addUpdateRange(e,s.reservedIndexCount)}return s.start=i?s.indexStart:s.vertexStart,s.count=i?s.indexCount:s.vertexCount,s.boundingBox=null,null!==t.boundingBox&&
1(s.boundingBox=t.boundingBox.clone()),s.boundingSphere=null,null!==t.boundingSphere&&(s.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){let t=this._geometryInfo;if(e>=t.length||!1===t[e].active)return this;let r=this._instanceInfo;for(let t=0,i=r.length;t<i;t++)r[t].active&&r[t].geometryIndex===e&&this.deleteInstance(t);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0,r=this._geometryInfo,i=r.map((e,t)=>t).sort((e,t)=>r[e].vertexStart-r[t].vertexStart),n=this.geometry;for(let a=0,s=r.length;a<s;a++){let s=r[i[a]];if(!1!==s.active){if(null!==n.index){if(s.indexStart!==t){let{indexStart:r,vertexStart:i,reservedIndexCount:a}=s,o=n.index,l=o.array,u=e-i;for(let e=r;e<r+a;e++)l[e]=l[e]+u;o.array.copyWithin(t,r,r+a),o.addUpdateRange(t,a),o.needsUpdate=!0,s.indexStart=t}t+=s.reservedIndexCount}if(s.vertexStart!==e){let{vertexStart:t,reservedVertexCount:r}=s,i=n.attributes;for(let n in i){let a=i[n],{array:s,itemSize:o}=a;s.copyWithin(e*o,t*o,(t+r)*o),a.addUpdateRange(e*o,r*o),a.needsUpdate=!0}s.vertexStart=e}e+=s.reservedVertexCount,s.start=n.index?s.indexStart:s.vertexStart}}return this._nextIndexStart=t,this._nextVertexStart=e,this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;let r=this.geometry,i=this._geometryInfo[e];if(null===i.boundingBox){let e=new tU,t=r.index,n=r.attributes.position;for(let r=i.start,a=i.start+i.count;r<a;r++){let i=r;t&&(i=t.getX(i)),e.expandByPoint(iW.fromBufferAttribute(n,i))}i.boundingBox=e}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;let r=this.geometry,i=this._geometryInfo[e];if(null===i.boundingSphere){let t=new rl;this.getBoundingBoxAt(e,iz),iz.getCenter(t.center);let n=r.index,a=r.attributes.position,s=0;for(let e=i.start,r=i.start+i.count;e<r;e++){let r=e;n&&(r=n.getX(r)),iW.fromBufferAttribute(a,r),s=Math.max(s,t.center.distanceToSquared(iW))}t.radius=Math.sqrt(s),i.boundingSphere=t}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);let r=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,16*e),r.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,16*e)}setColorAt(e,t){return this.validateInstanceId(e),null===this._colorsTexture&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,4*e),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,4*e)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t||(this._instanceInfo[e].visible=t,this._visibilityChanged=!0),this}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);let r=this._geometryInfo[e];return t.vertexStart=r.vertexStart,t.vertexCount=r.vertexCount,t.reservedVertexCount=r.reservedVertexCount,t.indexStart=r.indexStart,t.indexCount=r.indexCount,t.reservedIndexCount=r.reservedIndexCount,t.start=r.start,t.count=r.count,t}setInstanceCount(e){let t=this._availableInstanceIds,r=this._instanceInfo;for(t.sort(iF);t[t.length-1]===r.length-1;)r.pop(),t.pop();if(e<r.length)throw Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);let i=new Int32Array(e),n=new Int32Array(e);iK(this._multiDrawCounts,i),iK(this._multiDrawStarts,n),this._multiDrawCounts=i,this._multiDrawStarts=n,this._maxInstanceCount=e;let a=this._indirectTexture,s=this._matricesTexture,o=this._colorsTexture;a.dispose(),this._initIndirectTexture(),iK(a.image.data,this._indirectTexture.image.data),s.dispose(),this._initMatricesTexture(),iK(s.image.data,this._matricesTexture.image.data),o&&(o.dispose(),this._initColorsTexture(),iK(o.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){let r=[...this._geometryInfo].filter(e=>e.active);if(Math.max(...r.map(e=>e.vertexStart+e.reservedVertexCount))>e)throw Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...r.map(e=>e.indexStart+e.reservedIndexCount))>t)throw Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);let i=this.geometry;i.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new rg,this._initializeGeometry(i));let n=this.geometry;for(let e in i.index&&iK(i.index.array,n.index.array),i.attributes)iK(i.attributes[e].array,n.attributes[e].array)}raycast(e,t){let r=this._instanceInfo,i=this._geometryInfo,n=this.matrixWorld,a=this.geometry;i$.material=this.material,i$.geometry.index=a.index,i$.geometry.attributes=a.attributes,null===i$.geometry.boundingBox&&
1(i$.geometry.boundingBox=new tU),null===i$.geometry.boundingSphere&&(i$.geometry.boundingSphere=new rl);for(let a=0,s=r.length;a<s;a++){if(!r[a].visible||!r[a].active)continue;let s=r[a].geometryIndex,o=i[s];i$.geometry.setDrawRange(o.start,o.count),this.getMatrixAt(a,i$.matrixWorld).premultiply(n),this.getBoundingBoxAt(s,i$.geometry.boundingBox),this.getBoundingSphereAt(s,i$.geometry.boundingSphere),i$.raycast(e,iJ);for(let e=0,r=iJ.length;e<r;e++){let r=iJ[e];r.object=this,r.batchId=a,t.push(r)}iJ.length=0}i$.material=null,i$.geometry.index=null,i$.geometry.attributes={},i$.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=null!==e.boundingBox?e.boundingBox.clone():null,this.boundingSphere=null!==e.boundingSphere?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(e=>({...e,boundingBox:null!==e.boundingBox?e.boundingBox.clone():null,boundingSphere:null!==e.boundingSphere?e.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(e=>({...e})),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(),null!==this._colorsTexture&&(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,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,r,i,n){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let a=i.getIndex(),s=null===a?1:a.array.BYTES_PER_ELEMENT,o=1;n.wireframe&&(o=2,s=i.attributes.position.count>65535?4:2);let l=this._instanceInfo,u=this._multiDrawStarts,h=this._multiDrawCounts,d=this._geometryInfo,c=this.perObjectFrustumCulled,p=this._indirectTexture,f=p.image.data,m=r.isArrayCamera?iV:ik;c&&!r.isArrayCamera&&(iO.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),ik.setFromProjectionMatrix(iO,r.coordinateSystem,r.reversedDepth));let g=0;if(this.sortObjects){iO.copy(this.matrixWorld).invert(),iW.setFromMatrixPosition(r.matrixWorld).applyMatrix4(iO),ij.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(iO);for(let e=0,t=l.length;e<t;e++)if(l[e].visible&&l[e].active){let t=l[e].geometryIndex;this.getMatrixAt(e,iO),this.getBoundingSphereAt(t,iH).applyMatrix4(iO);let i=!1;if(c&&(i=!m.intersectsSphere(iH,r)),!i){let r=d[t],i=iX.subVectors(iH.center,iW).dot(ij);iq.push(r.start,r.count,i,e)}}let e=iq.list,t=this.customSort;null===t?e.sort(n.transparent?iU:iD):t.call(this,e,r);for(let t=0,r=e.length;t<r;t++){let r=e[t];u[g]=r.start*s*o,h[g]=r.count*o,f[g]=r.index,g++}iq.reset()}else for(let e=0,t=l.length;e<t;e++)if(l[e].visible&&l[e].active){let t=l[e].geometryIndex,i=!1;if(c&&(this.getMatrixAt(e,iO),this.getBoundingSphereAt(t,iH).applyMatrix4(iO),i=!m.intersectsSphere(iH,r)),!i){let r=d[t];u[g]=r.start*s*o,h[g]=r.count*o,f[g]=e,g++}}p.needsUpdate=!0,this._multiDrawCount=g,this._visibilityChanged=!1}onBeforeShadow(e,t,r,i,n,a){this.onBeforeRender(e,null,i,n,a)}}class iQ extends rb{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ty(0xffffff),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}let iZ=new eT,i0=new eT,i1=new eq,i2=new rq,i3=new rl,i4=new eT,i5=new eT;class i8 extends th{constructor(e=new rg,t=new iQ){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,r=[0];for(let e=1,i=t.count;e<i;e++)iZ.fromBufferAttribute(t,e-1),i0.fromBufferAttribute(t,e),r[e]=r[e-1],r[e]+=iZ.distanceTo(i0);e.setAttribute("lineDistance",new rn(r,1))}else en("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let r=this.geometry,i=this.matrixWorld,n=e.params.Line.threshold,a=r.drawRange;if(null===r.boundingSphere&&r.computeBoundingSphere(),i3.copy(r.boun
1dingSphere),i3.applyMatrix4(i),i3.radius+=n,!1===e.ray.intersectsSphere(i3))return;i1.copy(i).invert(),i2.copy(e.ray).applyMatrix4(i1);let s=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=this.isLineSegments?2:1,u=r.index,h=r.attributes.position;if(null!==u){let r=Math.max(0,a.start),i=Math.min(u.count,a.start+a.count);for(let n=r,a=i-1;n<a;n+=l){let r=i6(this,e,i2,o,u.getX(n),u.getX(n+1),n);r&&t.push(r)}if(this.isLineLoop){let n=i6(this,e,i2,o,u.getX(i-1),u.getX(r),i-1);n&&t.push(n)}}else{let r=Math.max(0,a.start),i=Math.min(h.count,a.start+a.count);for(let n=r,a=i-1;n<a;n+=l){let r=i6(this,e,i2,o,n,n+1,n);r&&t.push(r)}if(this.isLineLoop){let n=i6(this,e,i2,o,i-1,r,i-1);n&&t.push(n)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let r=e[t[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=r.length;e<t;e++){let t=r[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function i6(e,t,r,i,n,a,s){let o=e.geometry.attributes.position;if(iZ.fromBufferAttribute(o,n),i0.fromBufferAttribute(o,a),r.distanceSqToSegment(iZ,i0,i4,i5)>i)return;i4.applyMatrix4(e.matrixWorld);let l=t.ray.origin.distanceTo(i4);if(!(l<t.near)&&!(l>t.far))return{distance:l,point:i5.clone().applyMatrix4(e.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:e}}let i9=new eT,i7=new eT;class ne extends i8{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,r=[];for(let e=0,i=t.count;e<i;e+=2)i9.fromBufferAttribute(t,e),i7.fromBufferAttribute(t,e+1),r[e]=0===e?0:r[e-1],r[e+1]=r[e]+i9.distanceTo(i7);e.setAttribute("lineDistance",new rn(r,1))}else en("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class nt extends i8{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class nr extends rb{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ty(0xffffff),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let ni=new eq,nn=new rq,na=new rl,ns=new eT;class no extends th{constructor(e=new rg,t=new nr){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let r=this.geometry,i=this.matrixWorld,n=e.params.Points.threshold,a=r.drawRange;if(null===r.boundingSphere&&r.computeBoundingSphere(),na.copy(r.boundingSphere),na.applyMatrix4(i),na.radius+=n,!1===e.ray.intersectsSphere(na))return;ni.copy(i).invert(),nn.copy(e.ray).applyMatrix4(ni);let s=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=r.index,u=r.attributes.position;if(null!==l){let r=Math.max(0,a.start),n=Math.min(l.count,a.start+a.count);for(let a=r;a<n;a++){let r=l.getX(a);ns.fromBufferAttribute(u,r),nl(ns,r,o,i,e,t,this)}}else{let r=Math.max(0,a.start),n=Math.min(u.count,a.start+a.count);for(let a=r;a<n;a++)ns.fromBufferAttribute(u,a),nl(ns,a,o,i,e,t,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let r=e[t[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=r.length;e<t;e++){let t=r[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function nl(e,t,r,i,n,a,s){let o=nn.distanceSqToPoint(e);if(o<r){let r=new eT;nn.closestPointToPoint(e,r),r.applyMatrix4(i);let l=n.ray.origin.distanceTo(r);if(l<n.near||l>n.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:r,index:t,face:null,faceIndex:null,barycoord:null,object:s})}}class nu extends eG{constructor(e,t,r,i,n=1006,a=1006,s,o,l){super(e,t,r,i,n,a,s,o,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const u=this;"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(function t(){u.needsUpdate=!0,u._requestVideoFrameCallbackId=e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class nh extends nu{constructor(e,t,r,i,n,a,s,o){super({},e,t,r,i,n,a,s,o),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class nd extends eG{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=1003,this.minFilter=1003,this.generateMipmaps=!1,this.needsUpdate=!0}}class nc extends eG{constructor(e,t,r,i,n,a,s,o,l,u,h,d){super(null,a,s,o,l,u,i,n,h,d),this.isCompressedTexture=!0,this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class np extends nc{constructor(e,t,r,i,n,a){super(e,t,r,n,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=1001,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class nf extends nc{constructor(e,t,r){super(void 0,e[0].width,e[0].height,t,r,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class nm extends eG{constructor(e=[],t=301,r,i,n,a,s,o,l,u){super(e,t,r,i,n,a,s,o,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class ng extends eG{constructor(e,t,r,i,n,a,s,o,l){super(e,t,r,i,n,a,s,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class nv extends eG{constructor(e,t,r=1014,i,n,a,s=1003,o=1003,l,u=1026,h=1){if(1026!==u&&1027!==u)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:e,height:t,depth:h},i,n,a,s,o,u,r,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new eF(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class ny extends nv{constructor(e,t=1014,r=301,i,n,a=1003,s=1003,o,l=1026){const u={width:e,height:e,depth:1};super(e,e,t,r,i,n,a,s,o,l),this.image=[u,u,u,u,u,u],this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class n_ extends eG{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class nx extends rg{constructor(e=1,t=1,r=1,i=1,n=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:n,depthSegments:a};const s=this;i=Math.floor(i),n=Math.floor(n);const o=[],l=[],u=[],h=[];let d=0,c=0;function p(e,t,r,i,n,a,p,f,m,g,v){let y=a/m,_=p/g,x=a/2,b=p/2,S=f/2,T=m+1,A=g+1,M=0,E=0,C=new eT;for(let a=0;a<A;a++){let s=a*_-b;for(let o=0;o<T;o++){let d=o*y-x;C[e]=d*i,C[t]=s*n,C[r]=S,l.push(C.x,C.y,C.z),C[e]=0,C[t]=0,C[r]=f>0?1:-1,u.push(C.x,C.y,C.z),h.push(o/m),h.push(1-a/g),M+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){let r=d+t+T*e,i=d+t+T*(e+1),n=d+(t+1)+T*(e+1),a=d+(t+1)+T*e;o.push(r,i,a),o.push(i,n,a),E+=6}s.addGroup(c,E,v),c+=E,d+=M}p("z","y","x",-1,-1,r,t,e,a=Math.floor(a),n,0),p("z","y","x",1,-1,r,t,-e,a,n,1),p("x","z","y",1,1,e,r,t,i,a,2),p("x","z","y",1,-1,e,r,-t,i,a,3),p("x","y","z",1,-1,e,t,r,i,n,4),p("x","y","z",-1,-1,e,t,-r,i,n,5),this.setIndex(o),this.setAttribute("position",new rn(l,3)),this.setAttribute("normal",new rn(u,3)),this.setAttribute("uv",new rn(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nx(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class nb extends rg{constructor(e=1,t=1,r=4,i=8,n=1){super(),this.type="CapsuleGeometry",this.parameters={radiu
1s:e,height:t,capSegments:r,radialSegments:i,heightSegments:n},t=Math.max(0,t),r=Math.max(1,Math.floor(r)),i=Math.max(3,Math.floor(i));const a=[],s=[],o=[],l=[],u=t/2,h=Math.PI/2*e,d=t,c=2*h+d,p=2*r+(n=Math.max(1,Math.floor(n))),f=i+1,m=new eT,g=new eT;for(let v=0;v<=p;v++){let y=0,_=0,x=0,b=0;if(v<=r){const t=v/r,i=t*Math.PI/2;_=-u-e*Math.cos(i),x=e*Math.sin(i),b=-e*Math.cos(i),y=t*h}else if(v<=r+n){const i=(v-r)/n;_=-u+i*t,x=e,b=0,y=h+i*d}else{const t=(v-r-n)/r,i=t*Math.PI/2;_=u+e*Math.sin(i),x=e*Math.cos(i),b=e*Math.sin(i),y=h+d+t*h}const S=Math.max(0,Math.min(1,y/c));let T=0;0===v?T=.5/i:v===p&&(T=-.5/i);for(let e=0;e<=i;e++){const t=e/i,r=t*Math.PI*2,n=Math.sin(r),a=Math.cos(r);g.x=-x*a,g.y=_,g.z=x*n,s.push(g.x,g.y,g.z),m.set(-x*a,b,x*n),m.normalize(),o.push(m.x,m.y,m.z),l.push(t+T,S)}if(v>0){const e=(v-1)*f;for(let t=0;t<i;t++){const r=e+t,i=e+t+1,n=v*f+t,s=v*f+t+1;a.push(r,i,n),a.push(i,s,n)}}}this.setIndex(a),this.setAttribute("position",new rn(s,3)),this.setAttribute("normal",new rn(o,3)),this.setAttribute("uv",new rn(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nb(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class nS extends rg{constructor(e=1,t=32,r=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:i},t=Math.max(3,t);const n=[],a=[],s=[],o=[],l=new eT,u=new eb;a.push(0,0,0),s.push(0,0,1),o.push(.5,.5);for(let n=0,h=3;n<=t;n++,h+=3){const d=r+n/t*i;l.x=e*Math.cos(d),l.y=e*Math.sin(d),a.push(l.x,l.y,l.z),s.push(0,0,1),u.x=(a[h]/e+1)/2,u.y=(a[h+1]/e+1)/2,o.push(u.x,u.y)}for(let e=1;e<=t;e++)n.push(e,e+1,0);this.setIndex(n),this.setAttribute("position",new rn(a,3)),this.setAttribute("normal",new rn(s,3)),this.setAttribute("uv",new rn(o,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nS(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class nT extends rg{constructor(e=1,t=1,r=1,i=32,n=1,a=!1,s=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:i,heightSegments:n,openEnded:a,thetaStart:s,thetaLength:o};const l=this;i=Math.floor(i),n=Math.floor(n);const u=[],h=[],d=[],c=[];let p=0;const f=[],m=r/2;let g=0;function v(r){let n=p,a=new eb,f=new eT,v=0,y=!0===r?e:t,_=!0===r?1:-1;for(let e=1;e<=i;e++)h.push(0,m*_,0),d.push(0,_,0),c.push(.5,.5),p++;let x=p;for(let e=0;e<=i;e++){let t=e/i*o+s,r=Math.cos(t),n=Math.sin(t);f.x=y*n,f.y=m*_,f.z=y*r,h.push(f.x,f.y,f.z),d.push(0,_,0),a.x=.5*r+.5,a.y=.5*n*_+.5,c.push(a.x,a.y),p++}for(let e=0;e<i;e++){let t=n+e,i=x+e;!0===r?u.push(i,i+1,t):u.push(i+1,i,t),v+=3}l.addGroup(g,v,!0===r?1:2),g+=v}(function(){let a=new eT,v=new eT,y=0,_=(t-e)/r;for(let l=0;l<=n;l++){let u=[],g=l/n,y=g*(t-e)+e;for(let e=0;e<=i;e++){let t=e/i,n=t*o+s,l=Math.sin(n),f=Math.cos(n);v.x=y*l,v.y=-g*r+m,v.z=y*f,h.push(v.x,v.y,v.z),a.set(l,_,f).normalize(),d.push(a.x,a.y,a.z),c.push(t,1-g),u.push(p++)}f.push(u)}for(let r=0;r<i;r++)for(let i=0;i<n;i++){let a=f[i][r],s=f[i+1][r],o=f[i+1][r+1],l=f[i][r+1];(e>0||0!==i)&&(u.push(a,s,l),y+=3),(t>0||i!==n-1)&&(u.push(s,o,l),y+=3)}l.addGroup(g,y,0),g+=y})(),!1===a&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(u),this.setAttribute("position",new rn(h,3)),this.setAttribute("normal",new rn(d,3)),this.setAttribute("uv",new rn(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nT(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class nA extends nT{constructor(e=1,t=1,r=32,i=1,n=!1,a=0,s=2*Math.PI){super(0,e,t,r,i,n,a,s),this.type="C
1oneGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:i,openEnded:n,thetaStart:a,thetaLength:s}}static fromJSON(e){return new nA(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class nM extends rg{constructor(e=[],t=[],r=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:i};const n=[],a=[];function s(e){n.push(e.x,e.y,e.z)}function o(t,r){let i=3*t;r.x=e[i+0],r.y=e[i+1],r.z=e[i+2]}function l(e,t,r,i){i<0&&1===e.x&&(a[t]=e.x-1),0===r.x&&0===r.z&&(a[t]=i/2/Math.PI+.5)}function u(e){return Math.atan2(e.z,-e.x)}(function(e){let r=new eT,i=new eT,n=new eT;for(let a=0;a<t.length;a+=3)o(t[a+0],r),o(t[a+1],i),o(t[a+2],n),function(e,t,r,i){let n=i+1,a=[];for(let i=0;i<=n;i++){a[i]=[];let s=e.clone().lerp(r,i/n),o=t.clone().lerp(r,i/n),l=n-i;for(let e=0;e<=l;e++)0===e&&i===n?a[i][e]=s:a[i][e]=s.clone().lerp(o,e/l)}for(let e=0;e<n;e++)for(let t=0;t<2*(n-e)-1;t++){let r=Math.floor(t/2);t%2==0?(s(a[e][r+1]),s(a[e+1][r]),s(a[e][r])):(s(a[e][r+1]),s(a[e+1][r+1]),s(a[e+1][r]))}}(r,i,n,e)})(i),function(e){let t=new eT;for(let r=0;r<n.length;r+=3)t.x=n[r+0],t.y=n[r+1],t.z=n[r+2],t.normalize().multiplyScalar(e),n[r+0]=t.x,n[r+1]=t.y,n[r+2]=t.z}(r),function(){let e=new eT;for(let r=0;r<n.length;r+=3){var t;e.x=n[r+0],e.y=n[r+1],e.z=n[r+2];let i=u(e)/2/Math.PI+.5,s=Math.atan2(-(t=e).y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5;a.push(i,1-s)}(function(){let e=new eT,t=new eT,r=new eT,i=new eT,s=new eb,o=new eb,h=new eb;for(let d=0,c=0;d<n.length;d+=9,c+=6){e.set(n[d+0],n[d+1],n[d+2]),t.set(n[d+3],n[d+4],n[d+5]),r.set(n[d+6],n[d+7],n[d+8]),s.set(a[c+0],a[c+1]),o.set(a[c+2],a[c+3]),h.set(a[c+4],a[c+5]),i.copy(e).add(t).add(r).divideScalar(3);let p=u(i);l(s,c+0,e,p),l(o,c+2,t,p),l(h,c+4,r,p)}})(),function(){for(let e=0;e<a.length;e+=6){let t=a[e+0],r=a[e+2],i=a[e+4],n=Math.max(t,r,i),s=Math.min(t,r,i);n>.9&&s<.1&&(t<.2&&(a[e+0]+=1),r<.2&&(a[e+2]+=1),i<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new rn(n,3)),this.setAttribute("normal",new rn(n.slice(),3)),this.setAttribute("uv",new rn(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nM(e.vertices,e.indices,e.radius,e.detail)}}class nE extends nM{constructor(e=1,t=0){const r=(1+Math.sqrt(5))/2,i=1/r;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
119,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new nE(e.radius,e.detail)}}let nC=new eT,nw=new eT,nR=new eT,nN=new tD;class nL extends rg{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){const r=Math.cos(ec*t),i=e.getIndex(),n=e.getAttribute("position"),a=i?i.count:n.count,s=[0,0,0],o=["a","b","c"],l=[,,,],u={},h=[];for(let e=0;e<a;e+=3){i?(s[0]=i.getX(e),s[1]=i.getX(e+1),s[2]=i.getX(e+2)):(s[0]=e,s[1]=e+1,s[2]=e+2);const{a:t,b:a,c:d}=nN;if(t.fromBufferAttribute(n,s[0]),a.fromBufferAttribute(n,s[1]),d.fromBufferAttribute(n,s[2]),nN.getNormal(nR),l[0]=`${Math.round(1e4*t.x)},${Math.round(1e4*t.y)},${Math.round(1e4*t.z)}`,l[1]=`${Math.round(1e4*a.x)},${Math.round(1e4*a.y)},${Math.round(1e4*a.z)}`,l[2]=`${Math.round(1e4*d.x)},${Math.round(1e4*d.y)},${Math.round(1e4*d.z)}`,l[0]!==l[1]&&l[1]!==l[2]&&l[2]!==l[0])for(let e=0;e<3;e++){const t=(e+1)%3,i=l[e],n=l[t],a=nN[o[e]],d=nN[o[t]],c=`${i}_${n}`,p=`${n}_${i}`;p in u&&u[p]?(nR.dot(u[p].normal)<=r&&(h.push(a.x,a.y,a.z),h.push(d.x,d.y,d.z)),u[p]=null):c in u||(u[c]={index0:s[e],index1:s[t],normal:nR.clone()})}}for(const e in u)if(u[e]){const{index0:t,index1:r}=u[e];nC.fromBufferAttribute(n,t),nw.fromBufferAttribute(n,r),h.push(nC.x,nC.y,nC.z),h.push(nw.x,nw.y,nw.z)}this.setAttribute("position",new rn(h,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class nB{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){en("Curve: .getPoint() not implemented.")}getPointAt(e,t){let r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){let t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){let t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],r,i=this.getPoint(0),n=0;t.push(0);for(let a=1;a<=e;a++)t.push(n+=(r=this.getPoint(a/e)).distanceTo(i)),i=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let r,i=this.getLengths(),n=0,a=i.length;r=t||e*i[a-1];let s=0,o=a-1,l;for(;s<=o;)if((l=i[n=Math.floor(s+(o-s)/2)]-r)<0)s=n+1;else if(l>0)o=n-1;else{o=n;break}if(i[n=o]===r)return n/(a-1);let u=i[n],h=i[n+1];return(n+(r-u)/(h-u))/(a-1)}getTangent(e,t){let r=e-1e-4,i=e+1e-4;r<0&&(r=0),i>1&&(i=1);let n=this.getPoint(r),a=this.getPoint(i),s=t||(n.isVector2?new eb:new eT);return s.copy(a).sub(n).normalize(),s}getTangentAt(e,t){let r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t=!1){let r=new eT,i=[],n=[],a=[],s=new eT,o=new eq;for(let t=0;t<=e;t++){let r=t/e;i[t]=this.getTangentAt(r,new eT)}n[0]=new eT,a[0]=new eT;let l=Number.MAX_VALUE,u=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);u<=l&&(l=u,r.set(1,0,0)),h<=l&&(l=h,r.set(0,1,0)),d<=l&&r.set(0,0,1),s.crossVectors(i[0],r).normalize(),n[0].crossVectors(i[0],s),a[0].crossVectors(i[0],n[0]);for(let t=1;t<=e;t++){if(n[t]=n[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(i[t-1],i[t]),s.length()>Number.EPSILON){s.normalize();let e=Math.acos(em(i[t-1].dot(i[t]),-1,1));n[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(i[t],n[t])}if(!0===t){let t=Math.acos(em(n[0].dot(n[e]),-1,1));t/=e,i[0].dot(s.crossVectors(n[0],n[e]))>0&&(t=-t);for(let r=1;r<=e;r++)n[r].applyMatrix4(o.makeRotationAxis(i[r],t*r)),a[r].crossVectors(i[r],n[r])}return{tangents:i,normals:n,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class nI extends nB{constructor(e=0,t=0,r=1,i=1,n=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(e,t=new eb){let r=2*Math.PI,i=this.aEndAngle-this.aStartAngle,n=Math.abs(i)<Number.EPSILON;for(;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(i=n?0:r),!0!==this.aClockwise||n||(i===r?i=-r:i-=r);let a=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(a),o=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),r=s-this.aX,i=o-this.aY;s=r*e-i*t+this.aX,o=r*t+i*e+this.aY}return t.set(s,o)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class nP extends nI{constructor(e,t,r,i,n,a){super(e,t,r,r,i,n,a),this.isArcCurve=!0,this.type="ArcCurve"}}function nF(){let e=0,t=0,r=0,i=0;function n(n,a,s,o){e=n,t=s,r=-3*n+3*a-2*s-o,i=2*n-2*a+s+o}return{initCatmullRom:function(e,t,r,i,a){n(t,r,a*(r-e),a*(i-t))},initNonuniformCatmullRom:function(e,t,r,i,a,s,o){let l=(t-e)/a-(r-e)/(a+s)+(r-t)/s,u=(r-t)/s-(i-t)/(s+o)+(i-r)/o;n(t,r,l*=s,u*=s)},calc:function(n){let a=n*n;return e+t*n+r*a+a*n*i}}}let nD=new eT,nU=new nF,nO=new nF,nG=new nF;
1class nk extends nB{constructor(e=[],t=!1,r="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=i}getPoint(e,t=new eT){let r,i,n=this.points,a=n.length,s=(a-!this.closed)*e,o=Math.floor(s),l=s-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/a)+1)*a:0===l&&o===a-1&&(o=a-2,l=1),this.closed||o>0?r=n[(o-1)%a]:(nD.subVectors(n[0],n[1]).add(n[0]),r=nD);let u=n[o%a],h=n[(o+1)%a];if(this.closed||o+2<a?i=n[(o+2)%a]:(nD.subVectors(n[a-1],n[a-2]).add(n[a-1]),i=nD),"centripetal"===this.curveType||"chordal"===this.curveType){let e="chordal"===this.curveType?.5:.25,t=Math.pow(r.distanceToSquared(u),e),n=Math.pow(u.distanceToSquared(h),e),a=Math.pow(h.distanceToSquared(i),e);n<1e-4&&(n=1),t<1e-4&&(t=n),a<1e-4&&(a=n),nU.initNonuniformCatmullRom(r.x,u.x,h.x,i.x,t,n,a),nO.initNonuniformCatmullRom(r.y,u.y,h.y,i.y,t,n,a),nG.initNonuniformCatmullRom(r.z,u.z,h.z,i.z,t,n,a)}else"catmullrom"===this.curveType&&(nU.initCatmullRom(r.x,u.x,h.x,i.x,this.tension),nO.initCatmullRom(r.y,u.y,h.y,i.y,this.tension),nG.initCatmullRom(r.z,u.z,h.z,i.z,this.tension));return t.set(nU.calc(l),nO.calc(l),nG.calc(l)),t}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let r=e.points[t];this.points.push(new eT().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function nV(e,t,r,i,n){let a=(i-t)*.5,s=(n-r)*.5,o=e*e;return e*o*(2*r-2*i+a+s)+(-3*r+3*i-2*a-s)*o+a*e+r}function nz(e,t,r,i){let n;return(n=1-e)*n*t+2*(1-e)*e*r+e*e*i}function nH(e,t,r,i,n){let a,s;return(a=1-e)*a*a*t+3*(s=1-e)*s*e*r+3*(1-e)*e*e*i+e*e*e*n}class nW extends nB{constructor(e=new eb,t=new eb,r=new eb,i=new eb){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=i}getPoint(e,t=new eb){let r=this.v0,i=this.v1,n=this.v2,a=this.v3;return t.set(nH(e,r.x,i.x,n.x,a.x),nH(e,r.y,i.y,n.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class nj extends nB{constructor(e=new eT,t=new eT,r=new eT,i=new eT){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=i}getPoint(e,t=new eT){let r=this.v0,i=this.v1,n=this.v2,a=this.v3;return t.set(nH(e,r.x,i.x,n.x,a.x),nH(e,r.y,i.y,n.y,a.y),nH(e,r.z,i.z,n.z,a.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class nX extends nB{constructor(e=new eb,t=new eb){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new eb){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new eb){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class nq extends nB{constructor(e=new eT,t=new eT){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new eT){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}
1getTangent(e,t=new eT){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class n$ extends nB{constructor(e=new eb,t=new eb,r=new eb){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new eb){let r=this.v0,i=this.v1,n=this.v2;return t.set(nz(e,r.x,i.x,n.x),nz(e,r.y,i.y,n.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class nJ extends nB{constructor(e=new eT,t=new eT,r=new eT){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new eT){let r=this.v0,i=this.v1,n=this.v2;return t.set(nz(e,r.x,i.x,n.x),nz(e,r.y,i.y,n.y),nz(e,r.z,i.z,n.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class nK extends nB{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new eb){let r=this.points,i=(r.length-1)*e,n=Math.floor(i),a=i-n,s=r[0===n?n:n-1],o=r[n],l=r[n>r.length-2?r.length-1:n+1],u=r[n>r.length-3?r.length-1:n+2];return t.set(nV(a,s.x,o.x,l.x,u.x),nV(a,s.y,o.y,l.y,u.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let r=e.points[t];this.points.push(new eb().fromArray(r))}return this}}var nY=Object.freeze({__proto__:null,ArcCurve:nP,CatmullRomCurve3:nk,CubicBezierCurve:nW,CubicBezierCurve3:nj,EllipseCurve:nI,LineCurve:nX,LineCurve3:nq,QuadraticBezierCurve:n$,QuadraticBezierCurve3:nJ,SplineCurve:nK});class nQ extends nB{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let r=!0===e.isVector2?"LineCurve":"LineCurve3";this.curves.push(new nY[r](t,e))}return this}getPoint(e,t){let r=e*this.getLength(),i=this.getCurveLengths(),n=0;for(;n<i.length;){if(i[n]>=r){let e=i[n]-r,a=this.curves[n],s=a.getLength(),o=0===s?0:1-e/s;return a.getPointAt(o,t)}n++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let r=0,i=this.curves.length;r<i;r++)e.push(t+=this.curves[r].getLength());return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t,r=[];for(let i=0,n=this.curves;i<n.length;i++){let a=n[i],s=a.isEllipseCurve?2*e:a.isLineCurve||a.isLineCurve3?1:a.isS
1plineCurve?e*a.points.length:e,o=a.getPoints(s);for(let e=0;e<o.length;e++){let i=o[e];t&&t.equals(i)||(r.push(i),t=i)}}return this.autoClose&&r.length>1&&!r[r.length-1].equals(r[0])&&r.push(r[0]),r}copy(e){super.copy(e),this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){let r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,r=this.curves.length;t<r;t++){let r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){let r=e.curves[t];this.curves.push(new nY[r.type]().fromJSON(r))}return this}}class nZ extends nQ{constructor(e){super(),this.type="Path",this.currentPoint=new eb,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let r=new nX(this.currentPoint.clone(),new eb(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,i){let n=new n$(this.currentPoint.clone(),new eb(e,t),new eb(r,i));return this.curves.push(n),this.currentPoint.set(r,i),this}bezierCurveTo(e,t,r,i,n,a){let s=new nW(this.currentPoint.clone(),new eb(e,t),new eb(r,i),new eb(n,a));return this.curves.push(s),this.currentPoint.set(n,a),this}splineThru(e){let t=new nK([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,i,n,a){let s=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(e+s,t+o,r,i,n,a),this}absarc(e,t,r,i,n,a){return this.absellipse(e,t,r,r,i,n,a),this}ellipse(e,t,r,i,n,a,s,o){let l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,r,i,n,a,s,o),this}absellipse(e,t,r,i,n,a,s,o){let l=new nI(e,t,r,i,n,a,s,o);if(this.curves.length>0){let e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);let u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class n0 extends nZ{constructor(e){super(e),this.uuid=ef(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let r=0,i=this.holes.length;r<i;r++)t[r]=this.holes[r].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){let r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,r=this.holes.length;t<r;t++){let r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){let r=e.holes[t];this.holes.push(new nZ().fromJSON(r))}return this}}function n1(e,t,r,i,n){let a;if(n===function(e,t,r,i){let n=0;for(let a=t,s=r-i;a<r;a+=i)n+=(e[s]-e[a])*(e[a+1]+e[s+1]),s=a;return n}(e,t,r,i)>0)for(let n=t;n<r;n+=i)a=an(n/i|0,e[n],e[n+1],a);else for(let n=r-i;n>=t;n-=i)a=an(n/i|0,e[n],e[n+1],a);return a&&n9(a,a.next)&&(aa(a),a=a.next),a}function n2(e,t){if(!e)return e;t||(t=e);let r=e,i;do if(i=!1,!r.steiner&&(n9(r,r.next)||0===n6(r.prev,r,r.next))){if(aa(r),(r=t=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==t)return t}function n3(e,t){let r=e.x-t.x;return 0===r&&0==(r=e.y-t.y)&&(r=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),r}function n4(e,t,r,i,n){return(e=((e=((e=((e=((e=(e-r)*n|0)|e<<8)&0xff00ff)|e<<4)&0xf0f0f0f)|e<<2)&0x33333333)|e<<1)&0x55555555)|(t=((t=((t=((t=((t=(t-i)*n|0)|t<<8)&0xff00ff)|t<<4)&0xf0f0f0f)|t<<2)&0x33333333)|t<<1)&0x55555555)<<1}function n5(e,t,r,i,n,a,s,o){return(n-s)*(t-o)>=(e-s)*(a-o)&&(e-s)*(i-o)>=(r-s)*(t-o)&&(r-s)*(a-o)>=(n-s)*(i-o)}function n8(e,t,r,i,n,a,s,o){return(e!==s||t!==o)&&n5(e,t,r,i,n,a,s,o)}function n6(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function n9(e,t){return e.x===t.x&&e.y===t.y}function n7(e,t,r,i){let n=at(n6(e,t,r)),a=at(n6(e,t,i)),s=at(n6(r,i,e)),o=at(n6(r,i,t));return!!(n!==a&&s!==o||0===n&&ae(e,r,t)||0===a&&ae(e,i,t)||0===s&&ae(r,e,
1i)||0===o&&ae(r,t,i))}function ae(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function at(e){return e>0?1:e<0?-1:0}function ar(e,t){return 0>n6(e.prev,e,e.next)?n6(e,t,e.next)>=0&&n6(e,e.prev,t)>=0:0>n6(e,t,e.prev)||0>n6(e,e.next,t)}function ai(e,t){let r=as(e.i,e.x,e.y),i=as(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function an(e,t,r,i){let n=as(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function aa(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function as(e,t,r){return{i:e,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class ao{static triangulate(e,t,r=2){return function(e,t,r=2){let i,n,a,s=t&&t.length,o=s?t[0]*r:e.length,l=n1(e,0,o,r,!0),u=[];if(!l||l.next===l.prev)return u;if(s&&(l=function(e,t,r,i){let n=[];for(let r=0,a=t.length;r<a;r++){let s=t[r]*i,o=r<a-1?t[r+1]*i:e.length,l=n1(e,s,o,i,!1);l===l.next&&(l.steiner=!0),n.push(function(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e)return r}(l))}n.sort(n3);for(let e=0;e<n.length;e++)r=function(e,t){let r=function(e,t){let r,i=t,n=e.x,a=e.y,s=-1/0;if(n9(e,i))return i;do{if(n9(e,i.next))return i.next;if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){let e=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=n&&e>s&&(s=e,r=i.x<i.next.x?i:i.next,e===n))return r}i=i.next}while(i!==t)if(!r)return null;let o=r,l=r.x,u=r.y,h=1/0;i=r;do{if(n>=i.x&&i.x>=l&&n!==i.x&&n5(a<u?n:s,a,l,u,a<u?s:n,a,i.x,i.y)){var d,c;let t=Math.abs(a-i.y)/(n-i.x);ar(i,e)&&(t<h||t===h&&(i.x>r.x||i.x===r.x&&(d=r,c=i,0>n6(d.prev,d,c.prev)&&0>n6(c.next,d,d.next))))&&(r=i,h=t)}i=i.next}while(i!==o)return r}(e,t);if(!r)return t;let i=ai(r,e);return n2(i,i.next),n2(r,r.next)}(n[e],r);return r}(e,t,l,r)),e.length>80*r){i=e[0],n=e[1];let t=i,s=n;for(let a=r;a<o;a+=r){let r=e[a],o=e[a+1];r<i&&(i=r),o<n&&(n=o),r>t&&(t=r),o>s&&(s=o)}a=0!==(a=Math.max(t-i,s-n))?32767/a:0}return function e(t,r,i,n,a,s,o){if(!t)return;!o&&s&&function(e,t,r,i){let n=e;do 0===n.z&&(n.z=n4(n.x,n.y,t,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==e)n.prevZ.nextZ=null,n.prevZ=null,function(e){let t,r=1;do{let i,n=e;e=null;let a=null;for(t=0;n;){t++;let s=n,o=0;for(let e=0;e<r&&(o++,s=s.nextZ);e++);let l=r;
1for(;o>0||l>0&&s;)0!==o&&(0===l||!s||n.z<=s.z)?(i=n,n=n.nextZ,o--):(i=s,s=s.nextZ,l--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=s}a.nextZ=null,r*=2}while(t>1)}(n)}(t,n,a,s);let l=t;for(;t.prev!==t.next;){let u=t.prev,h=t.next;if(s?function(e,t,r,i){let n=e.prev,a=e.next;if(n6(n,e,a)>=0)return!1;let s=n.x,o=e.x,l=a.x,u=n.y,h=e.y,d=a.y,c=Math.min(s,o,l),p=Math.min(u,h,d),f=Math.max(s,o,l),m=Math.max(u,h,d),g=n4(c,p,t,r,i),v=n4(f,m,t,r,i),y=e.prevZ,_=e.nextZ;for(;y&&y.z>=g&&_&&_.z<=v;){if(y.x>=c&&y.x<=f&&y.y>=p&&y.y<=m&&y!==n&&y!==a&&n8(s,u,o,h,l,d,y.x,y.y)&&n6(y.prev,y,y.next)>=0||(y=y.prevZ,_.x>=c&&_.x<=f&&_.y>=p&&_.y<=m&&_!==n&&_!==a&&n8(s,u,o,h,l,d,_.x,_.y)&&n6(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;y&&y.z>=g;){if(y.x>=c&&y.x<=f&&y.y>=p&&y.y<=m&&y!==n&&y!==a&&n8(s,u,o,h,l,d,y.x,y.y)&&n6(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;_&&_.z<=v;){if(_.x>=c&&_.x<=f&&_.y>=p&&_.y<=m&&_!==n&&_!==a&&n8(s,u,o,h,l,d,_.x,_.y)&&n6(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}(t,n,a,s):function(e){let t=e.prev,r=e.next;if(n6(t,e,r)>=0)return!1;let i=t.x,n=e.x,a=r.x,s=t.y,o=e.y,l=r.y,u=Math.min(i,n,a),h=Math.min(s,o,l),d=Math.max(i,n,a),c=Math.max(s,o,l),p=r.next;for(;p!==t;){if(p.x>=u&&p.x<=d&&p.y>=h&&p.y<=c&&n8(i,s,n,o,a,l,p.x,p.y)&&n6(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}(t)){r.push(u.i,t.i,h.i),aa(t),t=h.next,l=h.next;continue}if((t=h)===l){o?1===o?e(t=function(e,t){let r=e;do{let i=r.prev,n=r.next.next;!n9(i,n)&&n7(i,r,r.next,n)&&ar(i,n)&&ar(n,i)&&(t.push(i.i,r.i,n.i),aa(r),aa(r.next),r=e=n),r=r.next}while(r!==e)return n2(r)}(n2(t),r),r,i,n,a,s,2):2===o&&function(t,r,i,n,a,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){var l,u;if(o.i!==t.i&&(l=o,u=t,l.next.i!==u.i&&l.prev.i!==u.i&&!function(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&n7(r,r.next,e,t))return!0;r=r.next}while(r!==e)return!1}(l,u)&&(ar(l,u)&&ar(u,l)&&function(e,t){let r=e,i=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do r.y>a!=r.next.y>
1a&&r.next.y!==r.y&&n<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==e)return i}(l,u)&&(n6(l.prev,l,u.prev)||n6(l,u.prev,u))||n9(l,u)&&n6(l.prev,l,l.next)>0&&n6(u.prev,u,u.next)>0))){let l=ai(o,t);o=n2(o,o.next),l=n2(l,l.next),e(o,r,i,n,a,s,0),e(l,r,i,n,a,s,0);return}t=t.next}o=o.next}while(o!==t)}(t,r,i,n,a,s):e(n2(t),r,i,n,a,s,1);break}}}(l,u,r,i,n,a,0),u}(e,t,r)}}class al{static area(e){let t=e.length,r=0;for(let i=t-1,n=0;n<t;i=n++)r+=e[i].x*e[n].y-e[n].x*e[i].y;return .5*r}static isClockWise(e){return 0>al.area(e)}static triangulateShape(e,t){let r=[],i=[],n=[];au(e),ah(r,e);let a=e.length;t.forEach(au);for(let e=0;e<t.length;e++)i.push(a),a+=t[e].length,ah(r,t[e]);let s=ao.triangulate(r,i);for(let e=0;e<s.length;e+=3)n.push(s.slice(e,e+3));return n}}function au(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function ah(e,t){for(let r=0;r<t.length;r++)e.push(t[r].x),e.push(t[r].y)}class ad extends rg{constructor(e=new n0([new eb(.5,.5),new eb(-.5,.5),new eb(-.5,-.5),new eb(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const r=this,i=[],n=[];for(let a=0,s=e.length;a<s;a++)!function(e){let a,s,o,l,u,h=[],d=void 0!==t.curveSegments?t.curveSegments:12,c=void 0!==t.steps?t.steps:1,p=void 0!==t.depth?t.depth:1,f=void 0===t.bevelEnabled||t.bevelEnabled,m=void 0!==t.bevelThickness?t.bevelThickness:.2,g=void 0!==t.bevelSize?t.bevelSize:m-.1,v=void 0!==t.bevelOffset?t.bevelOffset:0,y=void 0!==t.bevelSegments?t.bevelSegments:3,_=t.extrudePath,x=void 0!==t.UVGenerator?t.UVGenerator:ac,b,S=!1;if(_){b=_.getSpacedPoints(c),S=!0,f=!1;let e=!!_.isCatmullRomCurve3&&_.closed;a=_.computeFrenetFrames(c,e),s=new eT,o=new eT,l=new eT}f||(y=0,m=0,g=0,v=0);let T=e.extractPoints(d),A=T.shape,M=T.holes;if(!al.isClockWise(A)){A=A.reverse();for(let e=0,t=M.length;e<t;e++){let t=M[e];al.isClockWise(t)&&(M[e]=t.reverse())}}function E(e){let t=1e-10*1e-10,r=e[0];for(let i=1;i<=e.length;i++){let n=i%e.length,a=e[n],s=a.x-r.x,o=a.y-r.y,l=s*s+o*o,u=Math.max(Math.abs(a.x),Math.abs(a.y),Math.abs(r.x),Math.abs(r.y));if(l<=t*u*u){e.splice(n,1),i--;continue}r=a}}E(A),M.forEach(E);let C=M.length,w=A;for(let e=0;e<C;e++){let t=M[e];A=A.concat(t)}function R(e,t,r){return t||ea("ExtrudeGeometry: vec does not exist"),e.clone().addScaledVector(t,r)}let N=A.length;function L(e,t,r){let i,n,a,s=e.x-t.x,o=e.y-t.y,l=r.x-e.x,u=r.y-e.y,h=s*s+o*o;if(Math.abs(s*u-o*l)>Number.EPSILON){let d=Math.sqrt(h),c=Math.sqrt(l*l+u*u),p=t.x-o/d,f=t.y+s/d,m=((r.x-u/c-p)*u-(r.y+l/c-f)*l)/(s*u-o*l),g=(i=p+s*m-e.x)*i+(n=f+o*m-e.y)*n;if(g<=2)return new eb(i,n);a=Math.sqrt(g/2)}else{let e=!1;s>Number.EPSILON?l>Number.EPSILON&&(e=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(u)&&(e=!0),e?(i=-o,n=s,a=Math.sqrt(h)):(i=s,n=o,a=Math.sqrt(h/2))}return new eb(i/a,n/a)}let B=[];for(let e=0,t=w.length,r=t-1,i=e+1;e<t;e++,r++,i++)r===t&&(r=0),i===t&&(i=0),B[e]=L(w[e],w[r],w[i]);let I=[],P,F=B.concat();for(let e=0;e<C;e++){let t=M[e];P=[];for(let e=0,r=t.length,i=r-1,n=e+1;e<r;e++,i++,n++)i===r&&(i=0),n===r&&(n=0),P[e]=L(t[e],t[i],t[n]);I.push(P),F=F.concat(P)}if(0===y)u=al.triangulateShape(w,M);else{let e=[],t=[];for(let r=0;r<y;r++){let i=r/y,n=m*Math.cos(i*Math.PI/2),a=g*Math.sin(i*Math.PI/2)+v;for(let t=0,r=w.length;t<r;t++){let r=R(w[t],B[t],a);G(r.x,r.y,-n),0===i&&e.push(r)}for(let e=0;e<C;e++){let r=M[e];P=I[e];let s=[];for(let e=0,t=r.length;e<t;e++){let t=R(r[e],P[e],a);G(t.x,t.y,-n),0===i&&s.push(t)}0===i&&t.push(s)}}u=al.triangulateShape(e,t)}let D=u.length,U=g+v;for(let e=0;e<N;e++){let t=f?R(A[e],F[e],U):A[e];S?(o.copy(a.normals[0]).multiplyScalar(t.x),s.copy(a.binormals[0]).multiplyScalar(t.y),l.copy(b[0]).add(o).add(s),G(l.x,l.y,l.z)):G(t.x,t.y,0)}for(let e=1;e<=c;e++)for(let t=0;t<N;t++){let r=f?R(A[t],F[t],U):A[t];S?(o.copy(a.normals[e]).multiplyScalar(r.x),s.copy(a.binormals[e]).multiplyScalar(r.y),l.copy(b[e]).add(o).add(s),G(l.x,l.y,l.z)):G(r.x,r.y,p/c*e)}for(let e=y-1;e>=0;e--){let t=e/y,r=m*Math.cos(t*Math.PI/2),i=g*Math.sin(t*Math.PI/2)+v;for(let e=0,t=w.length;e<t;e++){let t=R(w[e],B[e],i);G(t.x,t.y,p+r)}for(let e=0,t=M.length;e<t;e++){let t=M[e];P=I[e];for(let e=0,n=t.length;e<n;e++){let n=R(t[e],P[e],i);S?G(n.x,n.y+b[c-1].y,b[c-1].x+r):G(n.x,n.y,p+r)}
1}}function O(e,t){let n=e.length;for(;--n>=0;){let a=n,s=n-1;s<0&&(s=e.length-1);for(let e=0,n=c+2*y;e<n;e++){let n=N*e,o=N*(e+1);!function(e,t,n,a){V(e),V(t),V(a),V(t),V(n),V(a);let s=i.length/3,o=x.generateSideWallUV(r,i,s-6,s-3,s-2,s-1);z(o[0]),z(o[1]),z(o[3]),z(o[1]),z(o[2]),z(o[3])}(t+a+n,t+s+n,t+s+o,t+a+o)}}}function G(e,t,r){h.push(e),h.push(t),h.push(r)}function k(e,t,n){V(e),V(t),V(n);let a=i.length/3,s=x.generateTopUV(r,i,a-3,a-2,a-1);z(s[0]),z(s[1]),z(s[2])}function V(e){i.push(h[3*e+0]),i.push(h[3*e+1]),i.push(h[3*e+2])}function z(e){n.push(e.x),n.push(e.y)}(function(){let e=i.length/3;if(f){let e=0*N;for(let t=0;t<D;t++){let r=u[t];k(r[2]+e,r[1]+e,r[0]+e)}e=N*(c+2*y);for(let t=0;t<D;t++){let r=u[t];k(r[0]+e,r[1]+e,r[2]+e)}}else{for(let e=0;e<D;e++){let t=u[e];k(t[2],t[1],t[0])}for(let e=0;e<D;e++){let t=u[e];k(t[0]+N*c,t[1]+N*c,t[2]+N*c)}}r.addGroup(e,i.length/3-e,0)})(),function(){let e=i.length/3,t=0;O(w,0),t+=w.length;for(let e=0,r=M.length;e<r;e++){let r=M[e];O(r,t),t+=r.length}r.addGroup(e,i.length/3-e,1)}()}(e[a]);this.setAttribute("position",new rn(i,3)),this.setAttribute("uv",new rn(n,2)),this.computeVertexNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return function(e,t,r){if(r.shapes=[],Array.isArray(e))for(let t=0,i=e.length;t<i;t++){let i=e[t];r.shapes.push(i.uuid)}else r.shapes.push(e.uuid);return r.options=Object.assign({},t),void 0!==t.extrudePath&&(r.options.extrudePath=t.extrudePath.toJSON()),r}(this.parameters.shapes,this.parameters.options,e)}static fromJSON(e,t){let r=[];for(let i=0,n=e.shapes.length;i<n;i++){let n=t[e.shapes[i]];r.push(n)}let i=e.options.extrudePath;return void 0!==i&&(e.options.extrudePath=new nY[i.type]().fromJSON(i)),new ad(r,e.options)}}let ac={generateTopUV:function(e,t,r,i,n){let a=t[3*r],s=t[3*r+1],o=t[3*i],l=t[3*i+1],u=t[3*n],h=t[3*n+1];return[new eb(a,s),new eb(o,l),new eb(u,h)]},generateSideWallUV:function(e,t,r,i,n,a){let s=t[3*r],o=t[3*r+1],l=t[3*r+2],u=t[3*i],h=t[3*i+1],d=t[3*i+2],c=t[3*n],p=t[3*n+1],f=t[3*n+2],m=t[3*a],g=t[3*a+1],v=t[3*a+2];return Math.abs(o-h)<Math.abs(s-u)?[new eb(s,1-l),new eb(u,1-d),new eb(c,1-f),new eb(m,1-v)]:[new eb(o,1-l),new eb(h,1-d),new eb(p,1-f),new eb(g,1-v)]}};class ap extends nM{constructor(e=1,t=0){const r=(1+Math.sqrt(5))/2;super([-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ap(e.radius,e.detail)}}class af extends rg{constructor(e=[new eb(0,-.5),new eb(.5,0),new eb(0,.5)],t=12,r=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:i},t=Math.floor(t),i=em(i,0,2*Math.PI);const n=[],a=[],s=[],o=[],l=[],u=1/t,h=new eT,d=new eb,c=new eT,p=new eT,f=new eT;let m=0,g=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:m=e[t+1].x-e[t].x,c.x=+(g=e[t+1].y-e[t].y),c.y=-m,c.z=0*g,f.copy(c),c.normalize(),o.push(c.x,c.y,c.z);break;case e.length-1:o.push(f.x,f.y,f.z);break;default:m=e[t+1].x-e[t].x,c.x=+(g=e[t+1].y-e[t].y),c.y=-m,c.z=0*g,p.copy(c),c.x+=f.x,c.y+=f.y,c.z+=f.z,c.normalize(),o.push(c.x,c.y,c.z),f.copy(p)}for(let n=0;n<=t;n++){const c=r+n*u*i,p=Math.sin(c),f=Math.cos(c);for(let r=0;r<=e.length-1;r++){h.x=e[r].x*p,h.y=e[r].y,h.z=e[r].x*f,a.push(h.x,h.y,h.z),d.x=n/t,d.y=r/(e.length-1),s.push(d.x,d.y);const i=o[3*r+0]*p,u=o[3*r+1],c=o[3*r+0]*f;l.push(i,u,c)}}for(let r=0;r<t;r++)for(let t=0;t<e.length-1;t++){const i=t+r*e.length,a=i+e.length,s=i+e.length+1,o=i+1;n.push(i,a,o),n.push(s,o,a)}this.setIndex(n),this.setAttribute("position",new rn(a,3)),this.setAttribute("uv",new rn(s,2)),this.setAttribute("normal",new rn(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new af(e.points,e.segments,e.phiStart,e.phiLength)}}class am extends nM{constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radiu
vendor: 8,842 bytes, line 1
1s:e,detail:t}}static fromJSON(e){return new am(e.radius,e.detail)}}class ag extends rg{constructor(e=1,t=1,r=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:i};const n=e/2,a=t/2,s=Math.floor(r),o=Math.floor(i),l=s+1,u=o+1,h=e/s,d=t/o,c=[],p=[],f=[],m=[];for(let e=0;e<u;e++){const t=e*d-a;for(let r=0;r<l;r++){const i=r*h-n;p.push(i,-t,0),f.push(0,0,1),m.push(r/s),m.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<s;t++){const r=t+l*e,i=t+l*(e+1),n=t+1+l*(e+1),a=t+1+l*e;c.push(r,i,a),c.push(i,n,a)}this.setIndex(c),this.setAttribute("position",new rn(p,3)),this.setAttribute("normal",new rn(f,3)),this.setAttribute("uv",new rn(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ag(e.width,e.height,e.widthSegments,e.heightSegments)}}class av extends rg{constructor(e=.5,t=1,r=32,i=1,n=0,a=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:a},r=Math.max(3,r);const s=[],o=[],l=[],u=[];let h=e;const d=(t-e)/(i=Math.max(1,i)),c=new eT,p=new eb;for(let e=0;e<=i;e++){for(let e=0;e<=r;e++){const i=n+e/r*a;c.x=h*Math.cos(i),c.y=h*Math.sin(i),o.push(c.x,c.y,c.z),l.push(0,0,1),p.x=(c.x/t+1)/2,p.y=(c.y/t+1)/2,u.push(p.x,p.y)}h+=d}for(let e=0;e<i;e++){const t=e*(r+1);for(let e=0;e<r;e++){const i=e+t,n=i+r+1,a=i+r+2,o=i+1;s.push(i,n,o),s.push(n,a,o)}}this.setIndex(s),this.setAttribute("position",new rn(o,3)),this.setAttribute("normal",new rn(l,3)),this.setAttribute("uv",new rn(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new av(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class ay extends rg{constructor(e=new n0([new eb(0,.5),new eb(-.5,-.5),new eb(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const r=[],i=[],n=[],a=[];let s=0,o=0;if(!1===Array.isArray(e))l(e);else for(let t=0;t<e.length;t++)l(e[t]),this.addGroup(s,o,t),s+=o,o=0;function l(e){let s=i.length/3,l=e.extractPoints(t),u=l.shape,h=l.holes;!1===al.isClockWise(u)&&(u=u.reverse());for(let e=0,t=h.length;e<t;e++){let t=h[e];!0===al.isClockWise(t)&&(h[e]=t.reverse())}let d=al.triangulateShape(u,h);for(let e=0,t=h.length;e<t;e++){let t=h[e];u=u.concat(t)}for(let e=0,t=u.length;e<t;e++){let t=u[e];i.push(t.x,t.y,0),n.push(0,0,1),a.push(t.x,t.y)}for(let e=0,t=d.length;e<t;e++){let t=d[e],i=t[0]+s,n=t[1]+s,a=t[2]+s;r.push(i,n,a),o+=3}}this.setIndex(r),this.setAttribute("position",new rn(i,3)),this.setAttribute("normal",new rn(n,3)),this.setAttribute("uv",new rn(a,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return function(e,t){if(t.shapes=[],Array.isArray(e))for(let r=0,i=e.length;r<i;r++){let i=e[r];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}static fromJSON(e,t){let r=[];for(let i=0,n=e.shapes.length;i<n;i++){let n=t[e.shapes[i]];r.push(n)}return new ay(r,e.curveSegments)}}class a_ extends rg{constructor(e=1,t=32,r=16,i=0,n=2*Math.PI,a=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:i,phiLength:n,thetaStart:a,thetaLength:s},t=Math.max(3,Math.floor(t)),r=Math.max(2,Math.floor(r));const o=Math.min(a+s,Math.PI);let l=0;const u=[],h=new eT,d=new eT,c=[],p=[],f=[],m=[];for(let c=0;c<=r;c++){const g=[],v=c/r;let y=0;0===c&&0===a?y=.5/t:c===r&&o===Math.PI&&(y=-.5/t);for(let r=0;r<=t;r++){const o=r/t;h.x=-e*Math.cos(i+o*n)*Math.sin(a+v*s),h.y=e*Math.cos(a+v*s),h.z=e*Math.sin(i+o*n)*Math.sin(a+v*s),p.push(h.x,h.y,h.z),d.copy(h).normalize(),f.push(d.x,d.y,d.z),m.push(o+y,1-v),g.push(l++)}u.push(g)}for(let e=0;e<r;e++)for(let i=0;i<t;i++){const t=u[e][i+1],n=u[e][i],s=u[e+1][i],l=u[e+1][i+1];(0!==e||a>0)&&c.push(t,n,l),(e!==r-1||o<Math.PI)&&c.push(n,s,l)}this.setIndex(c),this.setAttribute("position",new rn(p,3)),this.setAttribute("normal",new rn(f,3)),this.setAttribute("uv",new rn(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new a_(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class ax extends nM{constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ax(e.radius,e.detail)}}class ab extends rg{constructor(e=1,t=.4,r=12,i=48,n=2*Math.PI,a=0,s=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:i,arc:n,thetaStart:a,thetaLength:s},r=Math.floor(r),i=Math.floor(i);const o=[],l=[],u=[],h=[],d=new eT,c=new eT,p=new eT;for(let o=0;o<=r;o++){const f=a+o/r*s;for(let a=0;a<=i;a++){const s=a/i*n;c.x=(e+t*Math.cos(f))*Math.cos(s),c.y=(e+t*Math.cos(f))*Math.sin(s),c.z=t*Math.sin(f),l.push(c.x,c.y,c.z),d.x=e*Math.cos(s),d.y=e*Math.sin(s),p.subVectors(c,d).normalize(),u.push(p.x,p.y,p.z),h.push(a/i),h.push(o/r)}}for(let e=1;e<=r;e++)for(let t=1;t<=i;t++){const r=(i+1)*e+t-1,n=(i+1)*(e-1)+t-1,a=(i+1)*(e-1)+t,s=(i+1)*e+t;o.push(r,n,s),o.push(n,a,s)}this.setIndex(o),this.setAttribute("position",new rn(l,3)),this.setAttribute("normal",new rn(u,3)),this.setAttribute("uv",new rn(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ab(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class aS extends rg{constructor(e=1,t=.4,r=64,i=8,n=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:i,p:n,q:a},r=Math.floor(r),i=Math.floor(i);const s=[],o=[],l=[],u=[],h=new eT,d=new eT,c=new eT,p=new eT,f=new eT,m=new eT,g=new eT;for(let s=0;s<=r;++s){const y=s/r*n*Math.PI*2;v(y,n,a,e,c),v(y+.01,n,a,e,p),m.subVectors(p,c),g.addVectors(p,c),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let e=0;e<=i;++e){const n=e/i*Math.PI*2,a=-t*Math.cos(n),p=t*Math.sin(n);h.x=c.x+(a*g.x+p*f.x),h.y=c.y+(a*g.y+p*f.y),h.z=c.z+(a*g.z+p*f.z),o.push(h.x,h.y,h.z),d.subVectors(h,c).normalize(),l.push(d.x,d.y,d.z),u.push(s/r),u.push(e/i)}}for(let e=1;e<=r;e++)for(let t=1;t<=i;t++){const r=(i+1)*(e-1)+(t-1),n=(i+1)*e+(t-1),a=(i+1)*e+t,o=(i+1)*(e-1)+t;s.push(r,n,o),s.push(n,a,o)}function v(e,t,r,i,n){let a=Math.cos(e),s=Math.sin(e),o=r/t*e,l=Math.cos(o);n.x=i*(2+l)*.5*a,n.y=i*(2+l)*s*.5,n.z=i*Math.sin(o)*.5}this.setIndex(s),this.setAttribute("position",new rn(o,3)),this.setAttribute("normal",new rn(l,3)),this.setAttribute("uv",new rn(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new aS(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class aT extends rg{constructor(e=new nJ(new eT(-1,-1,0),new eT(-1,1,0),new eT(1,1,0)),t=64,r=1,i=8,n=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:r,radialSegments:i,closed:n};const a=e.computeFrenetFrames(t,n);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const s=new eT,o=new eT,l=new eb;let u=new eT;const h=[],d=[],c=[],p=[];function f(n){u=e.getPointAt(n/t,u);let l=a.normals[n],c=a.binormals[n];for(let e=0;e<=i;e++){let t=e/i*Math.PI*2,n=Math.sin(t),a=-Math.cos(t);o.x=a*l.x+n*c.x,o.y=a*l.y+n*c.y,o.z=a*l.z+n*c.z,o.normalize(),d.push(o.x,o.y,o.z),s.x=u.x+r*o.x,s.y=u.y+r*o.y,s.z=u.z+r*o.z,h.push(s.x,s.y,s.z)}}(function(){for(let e=0;e<t;e++)f(e);f(!1===n?t:0),function(){for(let e=0;e<=t;e++)for(let r=0;r<=i;r++)l.x=e/t,l.y=r/i,c.push(l.x,l.y)}(),function(){for(let e=1;e<=t;e++)for(let t=1;t<=i;t++){let r=(i+1)*(e-1)+(t-1),n=(i+1)*e+(t-1),a=(i+1)*e+t,s=(i+1)*(e-1)+t;p.push(r,n,s),p.push(n,a,s)}}()})(),this.setIndex(p),this.setAttribute("position",new rn(h,3)),this.setAttribute("normal",new rn(d,3)),this.setAttribute("uv",new rn(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new aT(new nY[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class aA extends rg{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},null!==e){const t=[],r=new Set,i=new eT,n=new eT;if(null!==e.index){const a=e.attributes.position,s=e.index;let o=e.groups;0===o.length&&(o=[{start:0,count:s.count,materialIndex:0}]);for(let e=0,l=o.length;e<l;++e){const l=o[e],u=l.start,h=l.count;for(let e=u,o=u+h;e<o;e+=3)for(let o=0;o<3;o++){const l=s.getX(e+o),u=s.getX(e+(o+1)%3);i.fromBufferAttribute(a,l),n.fromBufferAttribute(a,u),!0===aM(i,n,r)&&(t.push(i.x,i.y,i.z),t.pu
1sh(n.x,n.y,n.z))}}}else{const a=e.attributes.position;for(let e=0,s=a.count/3;e<s;e++)for(let s=0;s<3;s++){const o=3*e+s,l=3*e+(s+1)%3;i.fromBufferAttribute(a,o),n.fromBufferAttribute(a,l),!0===aM(i,n,r)&&(t.push(i.x,i.y,i.z),t.push(n.x,n.y,n.z))}}this.setAttribute("position",new rn(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function aM(e,t,r){let i=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`,n=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;return!0!==r.has(i)&&!0!==r.has(n)&&(r.add(i),r.add(n),!0)}var aE=Object.freeze({__proto__:null,BoxGeometry:nx,CapsuleGeometry:nb,CircleGeometry:nS,ConeGeometry:nA,CylinderGeometry:nT,DodecahedronGeometry:nE,EdgesGeometry:nL,ExtrudeGeometry:ad,IcosahedronGeometry:ap,LatheGeometry:af,OctahedronGeometry:am,PlaneGeometry:ag,PolyhedronGeometry:nM,RingGeometry:av,ShapeGeometry:ay,SphereGeometry:a_,TetrahedronGeometry:ax,TorusGeometry:ab,TorusKnotGeometry:aS,TubeGeometry:aT,WireframeGeometry:aA});class aC extends rb{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new ty(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}function aw(e){let t={};for(let r in e)for(let i in t[r]={},e[r]){let n=e[r][i];n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)?n.isRenderTargetTexture?(en("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[r][i]=null):t[r][i]=n.clone():Array.isArray(n)?t[r][i]=n.slice():t[r][i]=n}return t}function aR(e){let t={};for(let r=0;r<e.length;r++){let i=aw(e[r]);for(let e in i)t[e]=i[e]}return t}function aN(e){let t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:eN.workingColorSpace}let aL={clone:aw,merge:aR};class aB extends rb{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=aw(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let r=0;r<e.length;r++)t.push(e[r].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){let t=super.toJSON(e);for(let r in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let i=this.uniforms[r].value;i&&i.isTexture?t.uniforms[r]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[r]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[r]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[r]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[r]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[r]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[r]={type:"m4",value:i.toArray()}:t.uniforms[r]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let r={};for(let e in this.extensions)!0===this.extensions[e]&&(r[e]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}}class aI extends aB{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class aP extends rb{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new ty(0xffffff),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ty(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eb(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 e3,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 aF extends aP{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 eb(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return em(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new ty(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 ty(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ty(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 aD extends rb{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ty(0xffffff),this.specular=new ty(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ty(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eb(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new e3,this.combine=0,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 aU extends rb{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ty(0xffffff),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ty(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eb(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 aO extends rb{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eb(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 aG extends rb{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ty(0xffffff),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ty(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eb(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new e3,this.combine=0,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 ak extends rb{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,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 aV extends rb{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}}
1class az extends rb{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ty(0xffffff),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eb(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 aH extends iQ{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 aW(e,t){return e&&e.constructor!==t?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function aj(e){let t=e.length,r=Array(t);for(let e=0;e!==t;++e)r[e]=e;return r.sort(function(t,r){return e[t]-e[r]}),r}function aX(e,t,r){let i=e.length,n=new e.constructor(i);for(let a=0,s=0;s!==i;++a){let i=r[a]*t;for(let r=0;r!==t;++r)n[s++]=e[i+r]}return n}function aq(e,t,r,i){let n=1,a=e[0];for(;void 0!==a&&void 0===a[i];)a=e[n++];if(void 0===a)return;let s=a[i];if(void 0!==s)if(Array.isArray(s))do void 0!==(s=a[i])&&(t.push(a.time),r.push(...s)),a=e[n++];while(void 0!==a)else if(void 0!==s.toArray)do void 0!==(s=a[i])&&(t.push(a.time),s.toArray(r,r.length)),a=e[n++];while(void 0!==a)else do void 0!==(s=a[i])&&(t.push(a.time),r.push(s)),a=e[n++];while(void 0!==a)}class a${static convertArray(e,t){return aW(e,t)}static isTypedArray(e){return J(e)}static getKeyframeOrder(e){return aj(e)}static sortedArray(e,t,r){return aX(e,t,r)}static flattenJSON(e,t,r,i){aq(e,t,r,i)}static subclip(e,t,r,i,n=30){return function(e,t,r,i,n=30){let a=e.clone();a.name=t;let s=[];for(let e=0;e<a.tracks.length;++e){let t=a.tracks[e],o=t.getValueSize(),l=[],u=[];for(let e=0;e<t.times.length;++e){let a=t.times[e]*n;if(!(a<r)&&!(a>=i)){l.push(t.times[e]);for(let r=0;r<o;++r)u.push(t.values[e*o+r])}}0!==l.length&&(t.times=aW(l,t.times.constructor),t.values=aW(u,t.values.constructor),s.push(t))}a.tracks=s;let o=1/0;for(let e=0;e<a.tracks.length;++e)o>a.tracks[e].times[0]&&(o=a.tracks[e].times[0]);for(let e=0;e<a.tracks.length;++e)a.tracks[e].shift(-1*o);return a.resetDuration(),a}(e,t,r,i,n)}static makeClipAdditive(e,t=0,r=e,i=30){return function(e,t=0,r=e,i=30){i<=0&&(i=30);let n=r.tracks.length,a=t/i;for(let t=0;t<n;++t){let i,n=r.tracks[t],s=n.ValueTypeName;if("bool"===s||"string"===s)continue;let o=e.tracks.find(function(e){return e.name===n.name&&e.ValueTypeName===s});if(void 0===o)continue;let l=0,u=n.getValueSize();n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(l=u/3);let h=0,d=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=d/3);let c=n.times.length-1;if(a<=n.times[0]){let e=l,t=u-l;i=n.values.slice(e,t)}else if(a>=n.times[c]){let e=c*u+l,t=e+u-l;i=n.values.slice(e,t)}else{let e=n.createInterpolant(),t=l,r=u-l;e.evaluate(a),i=e.resultBuffer.slice(t,r)}"quaternion"===s&&new eS().fromArray(i).normalize().conjugate().toArray(i);let p=o.times.length;for(let e=0;e<p;++e){let t=e*d+h;if("quaternion"===s)eS.multiplyQuaternionsFlat(o.values,t,i,0,o.values,t);else{let e=d-2*h;for(let r=0;r<e;++r)o.values[t+r]-=i[r]}}}return e.blendMode=2501,e}(e,t,r,i)}}
1class aJ{constructor(e,t,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,r=this._cachedIndex,i=t[r],n=t[r-1];r:{i:{let a;n:{a:if(!(e<i)){for(let a=r+2;;){if(void 0===i){if(e<n)break a;return r=t.length,this._cachedIndex=r,this.copySampleValue_(r-1)}if(r===a)break;if(n=i,e<(i=t[++r]))break i}a=t.length;break n}if(!(e>=n)){let s=t[1];e<s&&(r=2,n=s);for(let a=r-2;;){if(void 0===n)return this._cachedIndex=0,this.copySampleValue_(0);if(r===a)break;if(i=n,e>=(n=t[--r-1]))break i}a=r,r=0;break n}break r}for(;r<a;){let i=r+a>>>1;e<t[i]?a=i:r=i+1}if(i=t[r],void 0===(n=t[r-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return r=t.length,this._cachedIndex=r,this.copySampleValue_(r-1)}this._cachedIndex=r,this.intervalChanged_(r,n,i)}return this.interpolate_(r,n,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,n=e*i;for(let e=0;e!==i;++e)t[e]=r[n+e];return t}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}}
vendor: 1,029 bytes, line 1
1class aK extends aJ{constructor(e,t,r,i){super(e,t,r,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,r){let i=this.parameterPositions,n=e-2,a=e+1,s=i[n],o=i[a];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:n=e,s=2*t-r;break;case 2402:n=i.length-2,s=t+i[n]-i[n+1];break;default:n=e,s=r}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:a=e,o=2*r-t;break;case 2402:a=1,o=r+i[1]-i[0];break;default:a=e-1,o=t}let l=(r-t)*.5,u=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-r),this._offsetPrev=n*u,this._offsetNext=a*u}interpolate_(e,t,r,i){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,c=this._weightNext,p=(r-t)/(i-t),f=p*p,m=f*p,g=-d*m+2*d*f-d*p,v=(1+d)*m+(-1.5-2*d)*f+(-.5+d)*p+1,y=(-1-c)*m+(1.5+c)*f+.5*p,_=c*m-c*f;for(let e=0;e!==s;++e)n[e]=g*a[u+e]+v*a[l+e]+y*a[o+e]+_*a[h+e];return n}}
1class aY extends aJ{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,u=(r-t)/(i-t),h=1-u;for(let e=0;e!==s;++e)n[e]=a[l+e]*h+a[o+e]*u;return n}}class aQ extends aJ{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class aZ extends aJ{interpolate_(e,t,r,i){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,u=this.settings||this.DefaultSettings_,h=u.inTangents,d=u.outTangents;if(!h||!d){let e=(r-t)/(i-t),u=1-e;for(let t=0;t!==s;++t)n[t]=a[l+t]*u+a[o+t]*e;return n}let c=2*s,p=e-1;for(let u=0;u!==s;++u){let s,f,m,g,v,y=a[l+u],_=a[o+u],x=p*c+2*u,b=d[x],S=d[x+1],T=e*c+2*u,A=h[T],M=h[T+1],E=(r-t)/(i-t);for(let e=0;e<8;e++){f=(s=E*E)*E;let e=(v=(g=(m=1-E)*m)*m)*t+3*g*E*b+3*m*s*A+f*i-r;if(1e-10>Math.abs(e))break;let n=3*g*(b-t)+6*m*E*(A-b)+3*s*(i-A);if(1e-10>Math.abs(n))break;E-=e/n,E=Math.max(0,Math.min(1,E))}n[u]=v*y+3*g*E*S+3*m*s*M+f*_}return n}}class a0{constructor(e,t,r,i){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=aW(t,this.TimeBufferType),this.values=aW(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t,r=e.constructor;if(r.toJSON!==this.toJSON)t=r.toJSON(e);else{t={name:e.name,times:aW(e.times,Array),values:aW(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(t.interpolation=r)}return t.type=e.ValueTypeName,t}InterpolantFactoryMethodDiscrete(e){return new aQ(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new aY(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new aK(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new aZ(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.settings=this.settings),t}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth;break;case 2303:t=this.InterpolantFactoryMethodBezier}if(void 0===t){let t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t);return en("KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302;case this.InterpolantFactoryMethodBezier:return 2303}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){let t=this.times;for(let r=0,i=t.length;r!==i;++r)t[r]+=e}return this}scale(e){if(1!==e){let t=this.times;for(let r=0,i=t.length;r!==i;++r)t[r]*=e}return this}trim(e,t){let r=this.times,i=r.length,n=0,a=i-1;for(;n!==i&&r[n]<e;)++n;for(;-1!==a&&r[a]>t;)--a;if(++a,0!==n||a!==i){n>=a&&(n=(a=Math.max(a,1))-1);let e=this.getValueSize();this.times=r.slice(n,a),this.values=this.values.slice(n*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(ea("KeyframeTrack: Invalid value size in track.",this),e=!1);let r=this.times,i=this.values,n=r.length;0===n&&(ea("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let t=0;t!==n;t++){let i=r[t];if("number"==typeof i&&isNaN(i)){ea("KeyframeTrack: Time is not a valid number.",this,t,i),e=!1;break}if(null!==a&&a>i){ea("KeyframeTrack: Out of order keys.",this,t,i,a),e=!1;break}a=i}if(void 0!==i&&J(i))for(let t=0,r=i.length;t!==r;++t){let r=i[t];if(isNaN(r)){ea("KeyframeTrack: Value is not a valid number.",this,t,r),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),r=this.getValueSize(),i=2302===this.getInterpolation(),n=e.length-1,a=1;for(let s=1;s<n;++s){let n=!1,o=e[s];if(o!==e[s+1]&&(1!==s||o!==e[0]))if(i)n=!0;else{let e=s*r,i=e-r,a=e+r;for(let s=0;s!==r;++s){let r=t[e+s];if(r!==t[i+s]||r!==t[a+s]){n=!0;break}}}if(n){if(s!==a){e[a]=e[s];let i=s*r,n=a*r;for(let e=0;e!==r;++e)t[n+e]=t[i+e]}++a}}if(n>0){e[a]=e[n];for(let e=n*r,i=a*r,s=0;s!==r;++s)t[i+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*r)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),r=new this.constructor(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}a0.prototype.ValueTypeName="",a0.prototype.TimeBufferType=Float32Array,a0.prototype.ValueBufferType=Float32Array,a0.prototype.DefaultInterpolation=2301;class a1 extends a0{constructor(e,t,r){super(e,t,r)}}a1.prototype.ValueTypeName="bool",a1.prototype.ValueBufferType=Array,a1.prototype.DefaultInterpolation=2300,a1.prototype.InterpolantFactoryMethodLinear=void 0,a1.prototype.InterpolantFactoryMethodSmooth=void 0;
1class a2 extends a0{constructor(e,t,r,i){super(e,t,r,i)}}a2.prototype.ValueTypeName="color";class a3 extends a0{constructor(e,t,r,i){super(e,t,r,i)}}a3.prototype.ValueTypeName="number";class a4 extends aJ{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(r-t)/(i-t),l=e*s;for(let e=l+s;l!==e;l+=4)eS.slerpFlat(n,0,a,l-s,a,l,o);return n}}class a5 extends a0{constructor(e,t,r,i){super(e,t,r,i)}InterpolantFactoryMethodLinear(e){return new a4(this.times,this.values,this.getValueSize(),e)}}a5.prototype.ValueTypeName="quaternion",a5.prototype.InterpolantFactoryMethodSmooth=void 0;class a8 extends a0{constructor(e,t,r){super(e,t,r)}}a8.prototype.ValueTypeName="string",a8.prototype.ValueBufferType=Array,a8.prototype.DefaultInterpolation=2300,a8.prototype.InterpolantFactoryMethodLinear=void 0,a8.prototype.InterpolantFactoryMethodSmooth=void 0;class a6 extends a0{constructor(e,t,r,i){super(e,t,r,i)}}a6.prototype.ValueTypeName="vector";class a9{constructor(e="",t=-1,r=[],i=2500){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=ef(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){let t=[],r=e.tracks,i=1/(e.fps||1);for(let e=0,n=r.length;e!==n;++e)t.push((function(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return a3;case"vector":case"vector2":case"vector3":case"vector4":return a6;case"color":return a2;case"quaternion":return a5;case"bool":case"boolean":return a1;case"string":return a8}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){let t=[],r=[];aq(e.keys,t,r,"value"),e.times=t,e.values=r}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)})(r[e]).scale(i));let n=new this(e.name,e.duration,t,e.blendMode);return n.uuid=e.uuid,n.userData=JSON.parse(e.userData||"{}"),n}static toJSON(e){let t=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let e=0,i=r.length;e!==i;++e)t.push(a0.toJSON(r[e]));return i}static CreateFromMorphTargetSequence(e,t,r,i){let n=t.length,a=[];for(let e=0;e<n;e++){let s=[],o=[];s.push((e+n-1)%n,e,(e+1)%n),o.push(0,1,0);let l=aj(s);s=aX(s,1,l),o=aX(o,1,l),i||0!==s[0]||(s.push(n),o.push(o[0])),a.push(new a3(".morphTargetInfluences["+t[e].name+"]",s,o).scale(1/r))}return new this(e,-1,a)}static findByName(e,t){let r=e;Array.isArray(e)||(r=e.geometry&&e.geometry.animations||e.animations);for(let e=0;e<r.length;e++)if(r[e].name===t)return r[e];return null}static CreateClipsFromMorphTargetSequences(e,t,r){let i={},n=/^([\w-]*?)([\d]+)$/;for(let t=0,r=e.length;t<r;t++){let r=e[t],a=r.name.match(n);if(a&&a.length>1){let e=a[1],t=i[e];t||(i[e]=t=[]),t.push(r)}}let a=[];for(let e in i)a.push(this.CreateFromMorphTargetSequence(e,i[e],t,r));return a}static parseAnimation(e,t){if(en("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return ea("AnimationClip: No animation in JSONLoader data."),null;let r=function(e,t,r,i,n){if(0!==r.length){let a=[],s=[];aq(r,a,s,i),0!==a.length&&n.push(new e(t,a,s))}},i=[],n=e.name||"default",a=e.fps||30,s=e.blendMode,o=e.length||-1,l=e.hierarchy||[];for(let e=0;e<l.length;e++){let n=l[e].keys;if(n&&0!==n.length)if(n[0].morphTargets){let e,t={};for(e=0;e<n.length;e++)if(n[e].morphTargets)for(let r=0;r<n[e].morphTargets.length;r++)t[n[e].morphTargets[r]]=-1;for(let r in t){let t=[],a=[];for(let i=0;i!==n[e].morphTargets.length;++i){let i=n[e];t.push(i.time),a.push(+(i.morphTarget===r))}i.push(new a3(".morphTargetInfluence["+r+"]",t,a))}o=t.length*a}else{let a=".bones["+t[e].name+"]";r(a6,a+".position",n,"pos",i),r(a5,a+".quaternion",n,"rot",i),r(a6,a+".scale",n,"scl",i)}}return 0===i.length?null:new this(n,o,i,s)}resetDuration(){let e=this.tracks,t=0;for(let r=0,i=e.length;r!==i;++r){let e=this.tracks[r];t=Math.max(t,e.times[e.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());let t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}let a7={enabled:!1,files:{},add:function(e,t){!1===this.enabled||se(e)||(this.files[e]=t)},get:function(e){if(!1!==this.enabled&&!se(e))return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};
1function se(e){try{let t=e.slice(e.indexOf(":")+1),r=new URL(t);return"blob:"===r.protocol}catch(e){return!1}}class st{constructor(e,t,r){let i;const n=this;let a=!1,s=0,o=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this._abortController=null,this.itemStart=function(e){o++,!1===a&&void 0!==n.onStart&&n.onStart(e,s,o),a=!0},this.itemEnd=function(e){s++,void 0!==n.onProgress&&n.onProgress(e,s,o),s===o&&(a=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(e){void 0!==n.onError&&n.onError(e)},this.resolveURL=function(e){return i?i(e):e},this.setURLModifier=function(e){return i=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){let t=l.indexOf(e);return -1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,r=l.length;t<r;t+=2){let r=l[t],i=l[t+1];if(r.global&&(r.lastIndex=0),r.test(e))return i}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}let sr=new st;class si{constructor(e){this.manager=void 0!==e?e:sr,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){let r=this;return new Promise(function(i,n){r.load(e,i,t,n)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}si.DEFAULT_MATERIAL_NAME="__DEFAULT";let sn={};class sa extends Error{constructor(e,t){super(e),this.response=t}}class ss extends si{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,r,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let n=a7.get(`file:${e}`);if(void 0!==n)return this.manager.itemStart(e),setTimeout(()=>{t&&t(n),this.manager.itemEnd(e)},0),n;if(void 0!==sn[e])return void sn[e].push({onLoad:t,onProgress:r,onError:i});sn[e]=[],sn[e].push({onLoad:t,onProgress:r,onError:i});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),s=this.mimeType,o=this.responseType;fetch(a).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&en("FileLoader: HTTP Status 0 received."),"u"<typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;let r=sn[e],i=t.body.getReader(),n=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=n?parseInt(n):0,s=0!==a,o=0;return new Response(new ReadableStream({start(e){!function t(){i.read().then(({done:i,value:n})=>{if(i)e.close();else{let i=new ProgressEvent("progress",{lengthComputable:s,loaded:o+=n.byteLength,total:a});for(let e=0,t=r.length;e<t;e++){let t=r[e];t.onProgress&&t.onProgress(i)}e.enqueue(n),t()}},t=>{e.error(t)})}()}}))}throw new sa(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>new DOMParser().parseFromString(e,s));case"json":return e.json();default:if(""===s)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(s),r=new TextDecoder(t&&t[1]?t[1].toLowerCase():void 0);return e.arrayBuffer().then(e=>r.decode(e))}}}).then(t=>{a7.add(`file:${e}`,t);let r=sn[e];delete sn[e];for(let e=0,i=r.length;e<i;e++){let i=r[e];i.onLoad&&i.onLoad(t)}}).catch(t=>{let r=sn[e];if(void 0===r)throw this.manager.itemError(e),t;delete sn[e];for(let e=0,i=r.length;e<i;e++){let i=r[e];i.onError&&i.onError(t)}this.manager.itemError(e)}).finally(()=>{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 so extends si{constructor(e){super(e)}load(e,t,r,i){let n=this,a=new ss(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(r){try{t(n.parse(JSON.parse(r)))}catch(t){i?i(t):ea(t),n.manager.itemError(e)}},r,i)}parse(e){let t=[];for(let r=0;r<e.length;r++){let i=a9.parse(e[r]);t.push(i)}return t}}class sl extends si{constructor(e){super(e)}load(e,t,r,i){let n=this,a=[],s=new nc,o=new ss(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(n.withCredentials);let l=0;if(Array.isArray(e))for(let u=0,h=e.length;u<h;++u)!function(u){o.load(e[u],function(e){let r=n.parse(e,!0);a[u]={width:r.width,height:r.height,format:r.format,mipmaps:r.mipmaps},6===(l+=1)&&(1===r.mipmapCount&&(s.minFilter=1006),s.image=a,s.format=r.format,s.needsUpdate=!0,t&&t(s))},r,i)}(u);else o.load(e,function(e){let r=n.parse(e,!0);if(r.isCubemap){let e=r.mipmaps.length/r.mipmapCount;for(let t=0;t<e;t++){a[t]={mipmaps:[]};for(let e=0;e<r.mipmapCount;e++)a[t].mipmaps.push(r.mipmaps[t*r.mipmapCount+e]),a[t].format=r.format,a[t].width=r.width,a[t].height=r.height}s.image=a}else s.image.width=r.width,s.image.height=r.height,s.mipmaps=r.mipmaps;1===r.mipmapCount&&(s.minFilter=1006),s.format=r.format,s.needsUpdate=!0,t&&t(s)},r,i);return s}}let su=new WeakMap;class sh extends si{constructor(e){super(e)}load(e,t,r,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let n=this,a=a7.get(`image:${e}`);if(void 0!==a){if(!0===a.complete)n.manager.itemStart(e),setTimeout(function(){t&&t(a),n.manager.itemEnd(e)},0);else{let e=su.get(a);void 0===e&&(e=[],su.set(a,e)),e.push({onLoad:t,onError:i})}return a}let s=K("img");function o(){u(),t&&t(this);let r=su.get(this)||[];for(let e=0;e<r.length;e++){let t=r[e];t.onLoad&&t.onLoad(this)}su.delete(this),n.manager.itemEnd(e)}function l(t){u(),i&&i(t),a7.remove(`image:${e}`);let r=su.get(this)||[];for(let e=0;e<r.length;e++){let i=r[e];i.onError&&i.onError(t)}su.delete(this),n.manager.itemError(e),n.manager.itemEnd(e)}function u(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),a7.add(`image:${e}`,s),n.manager.itemStart(e),s.src=e,s}}class sd extends si{constructor(e){super(e)}load(e,t,r,i){let n=new nm;
1n.colorSpace=O;let a=new sh(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let s=0;for(let r=0;r<e.length;++r)!function(r){a.load(e[r],function(e){n.images[r]=e,6==++s&&(n.needsUpdate=!0,t&&t(n))},void 0,i)}(r);return n}}class sc extends si{constructor(e){super(e)}load(e,t,r,i){let n=this,a=new ih,s=new ss(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(n.withCredentials),s.load(e,function(e){let r;try{r=n.parse(e)}catch(e){if(void 0===i)return void e(e);i(e)}void 0!==r.image?a.image=r.image:void 0!==r.data&&(a.image.width=r.width,a.image.height=r.height,a.image.data=r.data),a.wrapS=void 0!==r.wrapS?r.wrapS:1001,a.wrapT=void 0!==r.wrapT?r.wrapT:1001,a.magFilter=void 0!==r.magFilter?r.magFilter:1006,a.minFilter=void 0!==r.minFilter?r.minFilter:1006,a.anisotropy=void 0!==r.anisotropy?r.anisotropy:1,void 0!==r.colorSpace&&(a.colorSpace=r.colorSpace),void 0!==r.flipY&&(a.flipY=r.flipY),void 0!==r.format&&(a.format=r.format),void 0!==r.type&&(a.type=r.type),void 0!==r.mipmaps&&(a.mipmaps=r.mipmaps,a.minFilter=1008),1===r.mipmapCount&&(a.minFilter=1006),void 0!==r.generateMipmaps&&(a.generateMipmaps=r.generateMipmaps),a.needsUpdate=!0,t&&t(a,r)},r,i),a}}class sp extends si{constructor(e){super(e)}load(e,t,r,i){let n=new eG,a=new sh(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){n.image=e,n.needsUpdate=!0,void 0!==t&&t(n)},r,i),n}}class sf extends th{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ty(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class sm extends sf{constructor(e,t,r){super(e,r),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(th.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ty(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}let sg=new eq,sv=new eT,sy=new eT;class s_{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new eb(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new eq,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new iL,this._frameExtents=new eb(1,1),this._viewportCount=1,this._viewports=[new ek(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,r=this.matrix;sv.setFromMatrixPosition(e.matrixWorld),t.position.copy(sv),sy.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(sy),t.updateMatrixWorld(),sg.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(sg,t.coordinateSystem,t.reversedDepth),2001===t.coordinateSystem||t.reversedDepth?r.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(sg)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),(512!==this.mapSize.x||512!==this.mapSize.y)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}let sx=new eT,sb=new eS,sS=new eT;class sT extends th{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new eq,this.projectionMatrix=new eq,this.projectionMatrixInverse=new eq,this.coordinateSystem=2e3,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(sx,sb,sS),1===sS.x&&1===sS.y&&1===sS.z?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(sx,sb,sS.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(sx,sb,sS),1===sS.x&&1===sS.y&&1===sS.z?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(sx,sb,sS.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}let sA=new eT,sM=new eb,sE=new eb;class sC extends sT{constructor(e=50,t=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*ep*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*ec*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,945 bytes, line 1
1getEffectiveFOV(){return 2*ep*Math.atan(Math.tan(.5*ec*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,r){sA.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(sA.x,sA.y).multiplyScalar(-e/sA.z),sA.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(sA.x,sA.y).multiplyScalar(-e/sA.z)}getViewSize(e,t){return this.getViewBounds(e,sM,sE),t.subVectors(sE,sM)}setViewOffset(e,t,r,i,n,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*ec*this.fov)/this.zoom,r=2*t,i=this.aspect*r,n=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;n+=a.offsetX*i/e,t-=a.offsetY*r/s,i*=a.width/e,r*=a.height/s}let s=this.filmOffset;0!==s&&(n+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(n,n+i,t,t-r,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class sw extends s_{constructor(){super(new sC(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,r=2*ep*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,n=e.distance||t.far;(r!==t.fov||i!==t.aspect||n!==t.far)&&(t.fov=r,t.aspect=i,t.far=n,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class sR extends sf{constructor(e,t,r=0,i=Math.PI/3,n=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(th.DEFAULT_UP),this.updateMatrix(),this.target=new th,this.distance=r,this.angle=i,this.penumbra=n,this.decay=a,this.map=null,this.shadow=new sw}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class sN extends s_{constructor(){super(new sC(90,1,.5,500)),this.isPointLightShadow=!0}}class sL extends sf{constructor(e,t,r=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new sN}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class sB extends sT{constructor(e=-1,t=1,r=1,i=-1,n=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=n,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,r,i,n,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2,n=r-e,a=r+e,s=i+t,o=i-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;n+=e*this.view.offsetX,a=n+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}
vendor: 6,642 bytes, line 1
1this.projectionMatrix.makeOrthographic(n,a,s,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}class sI extends s_{constructor(){super(new sB(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class sP extends sf{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(th.DEFAULT_UP),this.updateMatrix(),this.target=new th,this.shadow=new sI}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class sF extends sf{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class sD extends sf{constructor(e,t,r=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=r,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class sU{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new eT)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let r=e.x,i=e.y,n=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*n),t.addScaledVector(a[3],.488603*r),t.addScaledVector(a[4],r*i*1.092548),t.addScaledVector(a[5],i*n*1.092548),t.addScaledVector(a[6],.315392*(3*n*n-1)),t.addScaledVector(a[7],r*n*1.092548),t.addScaledVector(a[8],.546274*(r*r-i*i)),t}getIrradianceAt(e,t){let r=e.x,i=e.y,n=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*i),t.addScaledVector(a[2],1.023328*n),t.addScaledVector(a[3],1.023328*r),t.addScaledVector(a[4],.858086*r*i),t.addScaledVector(a[5],.858086*i*n),t.addScaledVector(a[6],.743125*n*n-.247708),t.addScaledVector(a[7],.858086*r*n),t.addScaledVector(a[8],.429043*(r*r-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let r=this.coefficients;for(let i=0;i<9;i++)r[i].fromArray(e,t+3*i);return this}toArray(e=[],t=0){let r=this.coefficients;for(let i=0;i<9;i++)r[i].toArray(e,t+3*i);return e}static getBasisAt(e,t){let r=e.x,i=e.y,n=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*n,t[3]=.488603*r,t[4]=1.092548*r*i,t[5]=1.092548*i*n,t[6]=.315392*(3*n*n-1),t[7]=1.092548*r*n,t[8]=.546274*(r*r-i*i)}}class sO extends sf{constructor(e=new sU,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class sG extends si{constructor(e){super(e),this.textures={}}load(e,t,r,i){let n=this,a=new ss(n.manager);a.setPath(n.path),a.setRequestHeader(n.requestHeader),a.setWithCredentials(n.withCredentials),a.load(e,function(r){try{t(n.parse(JSON.parse(r)))}catch(t){i?i(t):ea(t),n.manager.itemError(e)}},r,i)}parse(e){let t=this.textures;function r(e){return void 0===t[e]&&en("MaterialLoader: Undefined texture",e),t[e]}let i=this.createMaterialFromType(e.type);if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&void 0!==i.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=e.sheen),void 0!==e.sheenColor&&(i.sheenColor=new ty().setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(i.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==i.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==i.specular&&i.specular.setHex(e.specular),void 0!==e.specularIntensity&&(i.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.dispersion&&(i.dispersion=e.dispersion),void 0!==e.iridescence&&(i.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(i.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(i.transmission=e.transmission),void 0!==e.thickness&&(i.thickness=e.thickness),void 0!==e.attenuationDistance&&(i.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(i.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(i.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.shadowSide&&(i.shadowSide=e.shadowSide),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(i.alphaHash=e.alphaHash),void 0!==e.depthFunc&&(i.depthFunc=e.depthFunc),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.blendSrc&&(i.blendSrc=e.blendSrc),void 0!==e.blendDst&&(i.blendDst=e.blendDst),void 0!==e.blendEquation&&(i.blendEquation=e.blendEquation),void 0!==e.blendSrcAlpha&&(i.blendSrcAlpha=e.blendSrcAlpha),void 0!==e.blendDstAlpha&&
1(i.blendDstAlpha=e.blendDstAlpha),void 0!==e.blendEquationAlpha&&(i.blendEquationAlpha=e.blendEquationAlpha),void 0!==e.blendColor&&void 0!==i.blendColor&&i.blendColor.setHex(e.blendColor),void 0!==e.blendAlpha&&(i.blendAlpha=e.blendAlpha),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),void 0!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.alphaToCoverage&&(i.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(i.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(i.forceSinglePass=e.forceSinglePass),void 0!==e.allowOverride&&(i.allowOverride=e.allowOverride),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(let t in e.uniforms){let n=e.uniforms[t];switch(i.uniforms[t]={},n.type){case"t":i.uniforms[t].value=r(n.value);break;case"c":i.uniforms[t].value=new ty().setHex(n.value);break;case"v2":i.uniforms[t].value=new eb().fromArray(n.value);break;case"v3":i.uniforms[t].value=new eT().fromArray(n.value);break;case"v4":i.uniforms[t].value=new ek().fromArray(n.value);break;case"m3":i.uniforms[t].value=new eE().fromArray(n.value);break;
1case"m4":i.uniforms[t].value=new eq().fromArray(n.value);break;default:i.uniforms[t].value=n.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(i.glslVersion=e.glslVersion),void 0!==e.extensions)for(let t in e.extensions)i.extensions[t]=e.extensions[t];if(void 0!==e.lights&&(i.lights=e.lights),void 0!==e.clipping&&(i.clipping=e.clipping),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=r(e.map)),void 0!==e.matcap&&(i.matcap=r(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=r(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=r(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=r(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),i.normalScale=new eb().fromArray(t)}return void 0!==e.displacementMap&&(i.displacementMap=r(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=r(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=r(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=r(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=r(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=r(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=r(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=r(e.envMap)),void 0!==e.envMapRotation&&i.envMapRotation.fromArray(e.envMapRotation),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=r(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=r(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=r(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=r(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=new eb().fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(i.iridescenceMap=r(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(i.transmissionMap=r(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=r(e.thicknessMap)),void 0!==e.anisotropyMap&&(i.anisotropyMap=r(e.anisotropyMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=r(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return sG.createMaterialFromType(e)}static createMaterialFromType(e){return new({ShadowMaterial:aC,SpriteMaterial:rS,RawShaderMaterial:aI,ShaderMaterial:aB,PointsMaterial:nr,MeshPhysicalMaterial:aF,MeshStandardMaterial:aP,MeshPhongMaterial:aD,MeshToonMaterial:aU,MeshNormalMaterial:aO,MeshLambertMaterial:aG,MeshDepthMaterial:ak,MeshDistanceMaterial:aV,MeshBasicMaterial:r$,MeshMatcapMaterial:az,LineDashedMaterial:aH,LineBasicMaterial:iQ,Material:rb})[e]}}class sk{static extractUrlBase(e){let t=e.lastIndexOf("/");return -1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===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 sV extends rg{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class sz extends si{constructor(e){super(e)}load(e,t,r,i){let n=this,a=new ss(n.manager);a.setPath(n.path),a.setRequestHeader(n.requestHeader),a.setWithCredentials(n.withCredentials),a.load(e,function(r){try{t(n.parse(JSON.parse(r)))}catch(t){i?i(t):ea(t),n.manager.itemError(e)}},r,i)}parse(e){let t={},r={};function i(e,i){if(void 0!==t[i])return t[i];let n=e.interleavedBuffers[i],a=function(e,t){if(void 0!==r[t])return r[t];let i=new Uint32Array(e.arrayBuffers[t]).buffer;return r[t]=i,i}(e,n.buffer),s=new rv($(n.type,a),n.stride);return s.uuid=n.uuid,t[i]=s,s}let n=e.isInstancedBufferGeometry?new sV:new rg,a=e.data.index;if(void 0!==a){let e=$(a.type,a.array);n.setIndex(new t5(e,1))}let s=e.data.attributes;for(let t in s){let r,a=s[t];if(a.isInterleavedBufferAttribute)r=new r_(i(e.data,a.data),a.itemSize,a.offset,a.normalized);else{let e=$(a.type,a.array);r=new(a.isInstancedBufferAttribute?im:t5)(e,a.itemSize,a.normalized)}void 0!==a.name&&(r.name=a.name),void 0!==a.usage&&r.setUsage(a.usage),n.setAttribute(t,r)}let o=e.data.morphAttributes;if(o)for(let t in o){let r=o[t],a=[];for(let t=0,n=r.length;t<n;t++){let n,s=r[t];n=s.isInterleavedBufferAttribute?new r_(i(e.data,s.data),s.itemSize,s.offset,s.normalized):new t5($(s.type,s.array),s.itemSize,s.normalized),void 0!==s.name&&(n.name=s.name),a.push(n)}n.morphAttributes[t]=a}e.data.morphTargetsRelative&&(n.morphTargetsRelative=!0);let l=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==l)for(let e=0,t=l.length;e!==t;++e){let t=l[e];n.addGroup(t.start,t.count,t.materialIndex)}let u=e.data.boundingSphere;return void 0!==u&&(n.boundingSphere=new rl().fromJSON(u)),e.name&&(n.name=e.name),e.userData&&(n.userData=e.userData),n}}class sH extends si{constructor(e){super(e)}load(e,t,r,i){let n=this,a=""===this.path?sk.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;let s=new ss(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,function(r){let a=null;try{a=JSON.parse(r)}catch(t){void 0!==i&&i(t),t("ObjectLoader: Can't parse "+e+".",t.message);return}let s=a.metadata;if(void 0===s||void 0===s.type||"geometry"===s.type.toLowerCase()){void 0!==i&&i(Error("THREE.ObjectLoader: Can't load "+e)),ea("ObjectLoader: Can't load "+e);return}n.parse(a,t)},r,i)}async loadAsync(e,t){let r,i=""===this.path?sk.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;let n=new ss(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials);let a=await n.loadAsync(e,t);try{r=JSON.parse(a)}catch(t){throw Error("ObjectLoader: Can't parse "+e+". "+t.message)}let s=r.metadata;if(void 0===s||void 0===s.type||"geometry"===s.type.toLowerCase())throw Error("THREE.ObjectLoader: Can't load "+e);return await this.parseAsync(r)}parse(e,t){let r=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),n=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,function(){void 0!==t&&t(l)}),s=this.parseTextures(e.textures,a),o=this.parseMaterials(e.materials,s),l=this.parseObject(e.object,n,o,s,r),u=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,u),this.bindLightTargets(l),void 0!==t){let e=!1;for(let t in a)if(a[t].data instanceof HTMLImageElement){e=!0;break}!1===e&&t(l)}return l}async parseAsync(e){let t=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,r),n=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,n),s=this.parseMaterials(e.materials,a),o=this.parseObject(e.object,i,s,a,t),l=this.parseSkeletons(e.skeletons,o);return this.bindSkeletons(o,l),this.bindLightTargets(o),o}parseShapes(e){let t={};if(void 0!==e)for(let r=0,i=e.length;r<i;r++){let i=new n0().fromJSON(e[r]);t[i.uuid]=i}return t}parseSkeletons(e,t){let r={},i={};if(t.traverse(function(e){e.isBone&&(i[e.uuid]=e)}),void 0!==e)for(let t=0,n=e.length;t<n;t++){let n=new ip().fromJSON(e[t],i);r[n.uuid]=n}return r}parseGeometries(e,t){let r={};if(void 0!==e){let i=new sz;for(let n=0,a=e.length;n<a;n++){let a,s=e[n];switch(s.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(s);break;default:s.type in aE?a=aE[s.type].fromJSON(s,t):en(`ObjectLoader: Unsupported geometry type "${s.type}"`)}a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),void 0!==s.userData&&(a.userData=s.userData),r[s.uuid]=a}}return r}parseMaterials(e,t){let r={},i={};if(void 0!==e){let n=new sG;n.setTextures(t);for(let t=0,a=e.length;t<a;t++){let a=e[t];void 0===r[a.uuid]&&(r[a.uuid]=n.parse(a)),i[a.uuid]=r[a.uuid]}}return i}parseAnimations(e){let t={};if(void 0!==e)for(let r=0;r<e.length;r++){let i=e[r],n=a9.parse(i);t[n.uuid]=n}return t}parseImages(e,t){let r,i=this,n={};function a(e){if("string"==typeof e){var t;return t=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:i.resourcePath+e,i.manager.itemStart(t),r.load(t,function(){i.manager.itemEnd(t)},void 0,function(){i.manager.itemError(t),i.manager.itemEnd(t)})}return e.data?{data:$(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){(r=new sh(new st(t))).setCrossOrigin(this.crossOrigin);for(let t=0,r=e.length;t<r;t++){let r=e[t],i=r.url;if(Array.isArray(i)){let e=[];for(let t=0,r=i.length;t<r;t++){let r=a(i[t]);null!==r&&(r instanceof HTMLImageElement?e.push(r):e.push(new ih(r.data,r.width,r.height)))}n[r.uuid]=new eF(e)}else{let e=a(r.url);n[r.uuid]=new eF(e)}}}return n}async parseImagesAsync(e){let t,r=this,i={};async function n(e){if("string"==typeof e){let i=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:r.resourcePath+e;return await t.loadAsync(i)}return e.data?{data:$(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){(t=new sh(this.manager)).setCrossOrigin(this.crossOrigin);for(let t=0,r=e.length;t<r;t++){let r=e[t],a=r.url;if(Array.isArray(a)){let e=[];for(let t=0,r=a.length;t<r;t++){let r=a[t],i=await n(r);null!==i&&(i instanceof HTMLImageElement?e.push(i):e.push(new ih(i.data,i.width,i.height)))}i[r.uuid]=new eF(e)}else{let e=await n(r.url);i[r.uuid]=new eF(e)}}}return i}parseTextures(e,t){function r(e,t){return"number"==typeof e?e:(en("ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}let i={};if(void 0!==e)for(let n=0,a=e.length;n<a;n++){let a,s=e[n];void 0===s.image&&en('ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&en("ObjectLoader: Undefined image",s.image);let o=t[s.image],l=o.data;Array.isArray(l)?(a=new nm,6===l.length&&(a.needsUpdate=!0)):(a=l&&l.data?new ih:new eG,l&&(a.needsUpdate=!0)),a.source=o,a.uuid=s.uuid,void 0!==s.name&&(a.name=s.name),void 0!==s.mapping&&(a.mapping=r(s.mapping,sW)),void 0!==s.channel&&(a.channel=s.channel),void 0!==s.offset&&a.offset.fromArray(s.offset),void 0!==s.repeat&&a.repeat.fromArray(s.repeat),void 0!==s.center&&a.center.fromArray(s.center),void 0!==s.rotation&&(a.rotation=s.rotation),void 0!==s.wrap&&(a.wrapS=r(s.wrap[0],sj),a.wrapT=r(s.wrap[1],sj)),void 0!==s.format&&(a.format=s.format),void 0!==s.internalFormat&&(a.internalFormat=s.internalFormat),void 0!==s.type&&(a.type=s.type),void 0!==s.colorSpace&&(a.colorSpace
1=s.colorSpace),void 0!==s.minFilter&&(a.minFilter=r(s.minFilter,sX)),void 0!==s.magFilter&&(a.magFilter=r(s.magFilter,sX)),void 0!==s.anisotropy&&(a.anisotropy=s.anisotropy),void 0!==s.flipY&&(a.flipY=s.flipY),void 0!==s.generateMipmaps&&(a.generateMipmaps=s.generateMipmaps),void 0!==s.premultiplyAlpha&&(a.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(a.unpackAlignment=s.unpackAlignment),void 0!==s.compareFunction&&(a.compareFunction=s.compareFunction),void 0!==s.userData&&(a.userData=s.userData),i[s.uuid]=a}return i}parseObject(e,t,r,i,n){let a,s,o;function l(e){return void 0===t[e]&&en("ObjectLoader: Undefined geometry",e),t[e]}function u(e){if(void 0!==e){if(Array.isArray(e)){let t=[];for(let i=0,n=e.length;i<n;i++){let n=e[i];void 0===r[n]&&en("ObjectLoader: Undefined material",n),t.push(r[n])}return t}return void 0===r[e]&&en("ObjectLoader: Undefined material",e),r[e]}}function h(e){return void 0===i[e]&&en("ObjectLoader: Undefined texture",e),i[e]}switch(e.type){case"Scene":a=new tS,void 0!==e.background&&(Number.isInteger(e.background)?a.background=new ty(e.background):a.background=h(e.background)),void 0!==e.environment&&(a.environment=h(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?a.fog=new tb(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(a.fog=new tx(e.fog.color,e.fog.density)),""!==e.fog.name&&(a.fog.name=e.fog.name)),void 0!==e.backgroundBlurriness&&(a.backgroundBlurriness=e.backgroundBlurriness),void 0!==e.backgroundIntensity&&(a.backgroundIntensity=e.backgroundIntensity),void 0!==e.backgroundRotation&&a.backgroundRotation.fromArray(e.backgroundRotation),void 0!==e.environmentIntensity&&(a.environmentIntensity=e.environmentIntensity),void 0!==e.environmentRotation&&a.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":a=new sC(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(a.focus=e.focus),void 0!==e.zoom&&(a.zoom=e.zoom),void 0!==e.filmGauge&&(a.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(a.filmOffset=e.filmOffset),void 0!==e.view&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new sB(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(a.zoom=e.zoom),void 0!==e.view&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new sF(e.color,e.intensity);break;case"DirectionalLight":(a=new sP(e.color,e.intensity)).target=e.target||"";break;case"PointLight":a=new sL(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new sD(e.color,e.intensity,e.width,e.height);break;case"SpotLight":(a=new sR(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay)).target=e.target||"";break;case"HemisphereLight":a=new sm(e.color,e.groundColor,e.intensity);break;case"LightProbe":a=new sO(new sU().fromArray(e.sh),e.intensity);break;case"SkinnedMesh":a=new il(s=l(e.geometry),o=u(e.material)),void 0!==e.bindMode&&(a.bindMode=e.bindMode),void 0!==e.bindMatrix&&a.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(a.skeleton=e.skeleton);break;case"Mesh":a=new r8(s=l(e.geometry),o=u(e.material));break;case"InstancedMesh":s=l(e.geometry),o=u(e.material);let d=e.count,c=e.instanceMatrix,p=e.instanceColor;(a=new iT(s,o,d)).instanceMatrix=new im(new Float32Array(c.array),16),void 0!==p&&(a.instanceColor=new im(new Float32Array(p.array),p.itemSize));break;case"BatchedMesh":s=l(e.geometry),o=u(e.material),(a=new iY(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,o)).geometry=s,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._geometryInfo=e.geometryInfo.map(e=>{let t=null,r=null;return void 0!==e.boundingBox&&(t=new tU().fromJSON(e.boundingBox)),void 0!==e.boundingSphere&&(r=new rl().fromJSON(e.boundingSphere)),{...e,boundingBox:t,boundingSphere:r}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=h(e.matricesTexture.uuid),a._indirectTexture=h(e.indirectTexture.uuid),void 0!==e.colorsTexture&&(a._colorsTexture=h(e.colorsTexture.uuid)),void 0!==e.boundingSphere&&(a.boundingSphere=new rl().fromJSON(e.boundingSphere)),void 0!==e.boundingBox&&
1(a.boundingBox=new tU().fromJSON(e.boundingBox));break;case"LOD":a=new rG;break;case"Line":a=new i8(l(e.geometry),u(e.material));break;case"LineLoop":a=new nt(l(e.geometry),u(e.material));break;case"LineSegments":a=new ne(l(e.geometry),u(e.material));break;case"PointCloud":case"Points":a=new no(l(e.geometry),u(e.material));break;case"Sprite":a=new rF(u(e.material));break;case"Group":a=new td;break;case"Bone":a=new iu;break;default:a=new th}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(a.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.up&&a.up.fromArray(e.up),void 0!==e.pivot&&(a.pivot=new eT().fromArray(e.pivot)),void 0!==e.morphTargetDictionary&&(a.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),void 0!==e.morphTargetInfluences&&(a.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.intensity&&(a.shadow.intensity=e.shadow.intensity),void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(a.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.frustumCulled&&(a.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(a.renderOrder=e.renderOrder),void 0!==e.static&&(a.static=e.static),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.layers&&(a.layers.mask=e.layers),void 0!==e.children){let s=e.children;for(let e=0;e<s.length;e++)a.add(this.parseObject(s[e],t,r,i,n))}if(void 0!==e.animations){let t=e.animations;for(let e=0;e<t.length;e++){let r=t[e];a.animations.push(n[r])}}if("LOD"===e.type){void 0!==e.autoUpdate&&(a.autoUpdate=e.autoUpdate);let t=e.levels;for(let e=0;e<t.length;e++){let r=t[e],i=a.getObjectByProperty("uuid",r.object);void 0!==i&&a.addLevel(i,r.distance,r.hysteresis)}}return a}bindSkeletons(e,t){0!==Object.keys(t).length&&e.traverse(function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){let r=t[e.skeleton];void 0===r?en("ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(r,e.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){let r=t.target,i=e.getObjectByProperty("uuid",r);void 0!==i?t.target=i:t.target=new th}})}}let sW={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,CubeUVReflectionMapping:306},sj={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},sX={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008},sq=new WeakMap;class s$ extends si{constructor(e){super(e),this.isImageBitmapLoader=!0,"u"<typeof createImageBitmap&&en("ImageBitmapLoader: createImageBitmap() not supported."),"u"<typeof fetch&&en("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,r,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let n=this,a=a7.get(`image-bitmap:${e}`);if(void 0!==a)return(n.manager.itemStart(e),a.then)?void a.then(r=>{if(!0!==sq.has(a))return t&&t(r),n.manager.itemEnd(e),r;i&&i(sq.get(a)),n.manager.itemError(e),n.manager.itemEnd(e)}):(setTimeout(function(){t&&t(a),n.manager.itemEnd(e)},0),a);let s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,s.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let o=fetch(e,s).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(n.options,{colorSpaceConversion:"none"}))}).then(function(r){return a7.add(`image-bitmap:${e}`,r),t&&t(r),n.manager.itemEnd(e),r}).catch(function(t){i&&i(t),sq.set(o,t),a7.remove(`image-bitmap:${e}`),n.manager.itemError(e),n.manager.itemEnd(e)});a7.add(`image-bitmap:${e}`,o),n.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class sJ{static getContext(){return void 0===i&&(i=new(window.AudioContext||window.webkitAudioContext)),i}static setContext(e){i=e}}class sK extends si{constructor(e){super(e)}load(e,t,r,i){let n=this,a=new ss(this.manager);function s(t){i?i(t):ea(t),n.manager.itemError(e)}
1a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(e){try{let r=e.slice(0);sJ.getContext().decodeAudioData(r,function(e){t(e)}).catch(s)}catch(e){s(e)}},r,i)}}let sY=new eq,sQ=new eq,sZ=new eq;class s0{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new sC,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new sC,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){let 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){let r,i;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,sZ.copy(e.projectionMatrix);let n=t.eyeSep/2,a=n*t.near/t.focus,s=t.near*Math.tan(ec*t.fov*.5)/t.zoom;sQ.elements[12]=-n,sY.elements[12]=n,r=-s*t.aspect+a,i=s*t.aspect+a,sZ.elements[0]=2*t.near/(i-r),sZ.elements[8]=(i+r)/(i-r),this.cameraL.projectionMatrix.copy(sZ),r=-s*t.aspect-a,i=s*t.aspect-a,sZ.elements[0]=2*t.near/(i-r),sZ.elements[8]=(i+r)/(i-r),this.cameraR.projectionMatrix.copy(sZ)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(sQ),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(sY)}}class s1 extends th{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new sC(-90,1,e,t);i.layers=this.layers,this.add(i);const n=new sC(-90,1,e,t);n.layers=this.layers,this.add(n);const a=new sC(-90,1,e,t);a.layers=this.layers,this.add(a);const s=new sC(-90,1,e,t);s.layers=this.layers,this.add(s);const o=new sC(-90,1,e,t);o.layers=this.layers,this.add(o);const l=new sC(-90,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[r,i,n,a,s,o]=t;for(let e of t)this.remove(e);if(2e3===e)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),n.up.set(0,0,-1),n.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===e)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),n.up.set(0,0,1),n.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[n,a,s,o,l,u]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),c=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let f=r.texture.generateMipmaps;r.texture.generateMipmaps=!1;let m=!1;m=!0===e.isWebGLRenderer?e.state.buffers.depth.getReversed():e.reversedDepthBuffer,e.setRenderTarget(r,0,i),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,n),e.setRenderTarget(r,1,i),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,a),e.setRenderTarget(r,2,i),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,s),e.setRenderTarget(r,3,i),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,o),e.setRenderTarget(r,4,i),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,l),r.texture.generateMipmaps=f,e.setRenderTarget(r,5,i),m&&!1===e.autoClear&&e.clearDepth(),e.render(t,u),e.setRenderTarget(h,d,c),e.xr.enabled=p,r.texture.needsPMREMUpdate=!0}}class s2 extends sC{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class s3{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,void 0!==e.hidden&&(this._pageVisibilityHandler=s4.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){null!==this._pageVisibilityHandler&&(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 null!==this._pageVisibilityHandler&&!0===this._document.hidden?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(void 0!==e?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function s4(){!1===this._document.hidden&&this.reset()}let s5=new eT,s8=new eS,s6=new eT,s9=new eT,s7=new eT;class oe extends th{constructor(){super(),this.type="AudioListener",this.context=sJ.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new s3}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(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 null!==this.filter?(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(
1);let t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(s5,s8,s6),s9.set(0,0,-1).applyQuaternion(s8),s7.set(0,1,0).applyQuaternion(s8),t.positionX){let e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(s5.x,e),t.positionY.linearRampToValueAtTime(s5.y,e),t.positionZ.linearRampToValueAtTime(s5.z,e),t.forwardX.linearRampToValueAtTime(s9.x,e),t.forwardY.linearRampToValueAtTime(s9.y,e),t.forwardZ.linearRampToValueAtTime(s9.z,e),t.upX.linearRampToValueAtTime(s7.x,e),t.upY.linearRampToValueAtTime(s7.y,e),t.upZ.linearRampToValueAtTime(s7.z,e)}else t.setPosition(s5.x,s5.y,s5.z),t.setOrientation(s9.x,s9.y,s9.z,s7.x,s7.y,s7.z)}}class ot extends th{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(!0===this.isPlaying)return void en("Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void en("Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+e;let 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(){return!1===this.hasPlaybackControl?void en("Audio: this Audio has no playback control."):(!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this)}stop(e=0){return!1===this.hasPlaybackControl?void en("Audio: this Audio has no playback control."):(this._progress=0,null!==this.source&&(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;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){return!1===this.hasPlaybackControl?void en("Audio: this Audio has no playback control."):(this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this)}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return!1===this.hasPlaybackControl?(en("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){return!1===this.hasPlaybackControl?void en("Audio: this Audio has no playback control."):(this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this)}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return(super.copy(e,t),"buffer"!==e.sourceType)?en("Audio: Audio source type cannot be copied."):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl
1=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice()),this}clone(e){return new this.constructor(this.listener).copy(this,e)}}let or=new eT,oi=new eS,on=new eT,oa=new eT;class os extends ot{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,r){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=r,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(or,oi,on),oa.set(0,0,1).applyQuaternion(oi);let t=this.panner;if(t.positionX){let e=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(or.x,e),t.positionY.linearRampToValueAtTime(or.y,e),t.positionZ.linearRampToValueAtTime(or.z,e),t.orientationX.linearRampToValueAtTime(oa.x,e),t.orientationY.linearRampToValueAtTime(oa.y,e),t.orientationZ.linearRampToValueAtTime(oa.z,e)}else t.setPosition(or.x,or.y,or.z),t.setOrientation(oa.x,oa.y,oa.z)}}class oo{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0,t=this.getFrequencyData();for(let r=0;r<t.length;r++)e+=t[r];return e/t.length}}class ol{constructor(e,t,r){let i,n,a;switch(this.binding=e,this.valueSize=r,t){case"quaternion":i=this._slerp,n=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*r),this._workIndex=5;break;case"string":case"bool":i=this._select,n=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(5*r);break;default:i=this._lerp,n=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*r)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=n,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let r=this.buffer,i=this.valueSize,n=e*i+i,a=this.cumulativeWeight;if(0===a){for(let e=0;e!==i;++e)r[n+e]=r[e];a=t}else{a+=t;let e=t/a;this._mixBufferRegion(r,n,0,e,i)}this.cumulativeWeight=a}accumulateAdditive(e){let t=this.buffer,r=this.valueSize,i=r*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,r=this.buffer,i=e*t+t,n=this.cumulativeWeight,a=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,n<1){let e=t*this._origIndex;this._mixBufferRegion(r,i,e,1-n,t)}a>0&&this._mixBufferRegionAdditive(r,i,this._addIndex*t,1,t);for(let e=t,n=t+t;e!==n;++e)if(r[e]!==r[e+t]){s.setValue(r,i);break}}saveOriginalState(){let e=this.binding,t=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(t,i);for(let e=r;e!==i;++e)t[e]=t[i+e%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r<t;r++)this.buffer[r]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;
1for(let r=0;r<this.valueSize;r++)this.buffer[t+r]=this.buffer[e+r]}_select(e,t,r,i,n){if(i>=.5)for(let i=0;i!==n;++i)e[t+i]=e[r+i]}_slerp(e,t,r,i){eS.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,n){let a=this._workIndex*n;eS.multiplyQuaternionsFlat(e,a,e,t,e,r),eS.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,r,i,n){let a=1-i;for(let s=0;s!==n;++s){let n=t+s;e[n]=e[n]*a+e[r+s]*i}}_lerpAdditive(e,t,r,i,n){for(let a=0;a!==n;++a){let n=t+a;e[n]=e[n]+e[r+a]*i}}}let ou="\\[\\]\\.:\\/",oh=RegExp("["+ou+"]","g"),od="[^"+ou+"]",oc="[^"+ou.replace("\\.","")+"]",op=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",od)+/(WCOD+)?/.source.replace("WCOD",oc)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",od)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",od)+"$"),of=["material","materials","bones","map"];class om{constructor(e,t,r){this.path=t,this.parsedPath=r||om.parseTrackName(t),this.node=om.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new om.Composite(e,t,r):new om(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(oh,"")}static parseTrackName(e){let t=op.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){let e=r.nodeName.substring(i+1);-1!==of.indexOf(e)&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=e)}if(null===r.propertyName||0===r.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let r=e.skeleton.getBoneByName(t);if(void 0!==r)return r}if(e.children){let r=function(e){for(let i=0;i<e.length;i++){let n=e[i];if(n.name===t||n.uuid===t)return n;let a=r(n.children);if(a)return a}return null},i=r(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let r=this.resolvedProperty;for(let i=0,n=r.length;i!==n;++i)e[t++]=r[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let r=this.resolvedProperty;for(let i=0,n=r.length;i!==n;++i)r[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let r=this.resolvedProperty;for(let i=0,n=r.length;i!==n;++i)r[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let r=this.resolvedProperty;for(let i=0,n=r.length;i!==n;++i)r[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,r=t.objectName,i=t.propertyName,n=t.propertyIndex;if(e||(e=om.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void en("PropertyBinding: No target node found for track: "+this.path+".");if(r){let i=t.objectIndex;switch(r){case"materials":if(!e.material)return void ea("PropertyBinding: Can not bind to material as no
1de does not have a material.",this);if(!e.material.materials)return void ea("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void ea("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===i){i=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void ea("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void ea("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[r])return void ea("PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[r]}if(void 0!==i){if(void 0===e[i])return void ea("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[i]}}let a=e[i];if(void 0===a)return void ea("PropertyBinding: Trying to update property for track: "+t.nodeName+"."+i+" but it wasn't found.",e);let s=this.Versioning.None;this.targetObject=e,!0===e.isMaterial?s=this.Versioning.NeedsUpdate:!0===e.isObject3D&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==n){if("morphTargetInfluences"===i){if(!e.geometry)return void ea("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void ea("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[n]&&(n=e.morphTargetDictionary[n])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=n}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}om.Composite=class{constructor(e,t,r){const i=r||om.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let r=this._targetGroup.nCachedObjects_,i=this._bindings[r];void 0!==i&&i.getValue(e,t)}setValue(e,t){let r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,n=r.length;i!==n;++i)r[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}},om.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},om.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},om.prototype.GetterByBindingType=[om.prototype._getValue_direct,om.prototype._getValue_array,om.prototype._getValue_arrayElement,om.prototype._getValue_toArray],om.prototype.SetterByBindingTypeAndVersioning=[[om.prototype._setValue_direct,om.prototype._setValue_direct_setNeedsUpdate,om.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[om.prototype._setValue_array,om.prototype._setValue_array_setNeedsUpdate,om.prototype._setValue_array_setMatrixWorldNeedsUpdate],[om.prototype._setValue_arrayElement,om.prototype._setValue_arrayElement_setNeedsUpdate,om.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[om.prototype._setValue_fromArray,om.prototype._setValue_fromArray_setNeedsUpdate,om.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class og{constructor(){this.isAnimationObjectGroup=!0,this.uuid=ef(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let t=0,r=arguments.length;t!==r;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){let e=this._objects,t=this._indicesByUUID,r=this._paths,i=this._parsedPaths,n=this._bindings,a=n.length,s,o=e.length,l=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){let h=arguments[u],d=h.uuid,c=t[d];if(void 0===c){c=o++,t[d]=c,e.push(h);for(let e=0;e!==a;++e)n[e].push(new om(h,r[e],i[e]))}else if(c<l){s=e[c];let o=--l,u=e[o];t[u.uuid]=c,e[c]=u,t[d]=o,e[o]=h;for(let e=0;e!==a;++e){let t=n[e],a=t[o],s=t[c];t[c]=a,void 0===s&&(s=new om(h,r[e],i[e])),t[o]=s}}else e[c]!==s&&ea("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastru
1cture when reloading scenes.")}this.nCachedObjects_=l}remove(){let e=this._objects,t=this._indicesByUUID,r=this._bindings,i=r.length,n=this.nCachedObjects_;for(let a=0,s=arguments.length;a!==s;++a){let s=arguments[a],o=s.uuid,l=t[o];if(void 0!==l&&l>=n){let a=n++,u=e[a];t[u.uuid]=l,e[l]=u,t[o]=a,e[a]=s;for(let e=0;e!==i;++e){let t=r[e],i=t[a],n=t[l];t[l]=i,t[a]=n}}}this.nCachedObjects_=n}uncache(){let e=this._objects,t=this._indicesByUUID,r=this._bindings,i=r.length,n=this.nCachedObjects_,a=e.length;for(let s=0,o=arguments.length;s!==o;++s){let o=arguments[s],l=o.uuid,u=t[l];if(void 0!==u)if(delete t[l],u<n){let s=--n,o=e[s],l=--a,h=e[l];t[o.uuid]=u,e[u]=o,t[h.uuid]=s,e[s]=h,e.pop();for(let e=0;e!==i;++e){let t=r[e],i=t[s],n=t[l];t[u]=i,t[s]=n,t.pop()}}else{let n=--a,s=e[n];n>0&&(t[s.uuid]=u),e[u]=s,e.pop();for(let e=0;e!==i;++e){let t=r[e];t[u]=t[n],t.pop()}}}this.nCachedObjects_=n}subscribe_(e,t){let r=this._bindingsIndicesByPath,i=r[e],n=this._bindings;if(void 0!==i)return n[i];let a=this._paths,s=this._parsedPaths,o=this._objects,l=o.length,u=this.nCachedObjects_,h=Array(l);i=n.length,r[e]=i,a.push(e),s.push(t),n.push(h);for(let r=u,i=o.length;r!==i;++r){let i=o[r];h[r]=new om(i,e,t)}return h}unsubscribe_(e){let t=this._bindingsIndicesByPath,r=t[e];if(void 0!==r){let i=this._paths,n=this._parsedPaths,a=this._bindings,s=a.length-1,o=a[s];t[e[s]]=r,a[r]=o,a.pop(),n[r]=n[s],n.pop(),i[r]=i[s],i.pop()}}}class ov{constructor(e,t,r=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=i;const n=t.tracks,a=n.length,s=Array(a),o={endingStart:2400,endingEnd:2400};for(let e=0;e!==a;++e){const t=n[e].createInterpolant(null);s[e]=t,t.settings=o}this._interpolantSettings=o,this._interpolants=s,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,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&&0!==this.timeScale&&null===this._startTime&&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,r=!1){if(e.fadeOut(t),this.fadeIn(t),!0===r){let r=this._clip.duration,i=e._clip.duration;e.warp(1,i/r,t),this.warp(r/i,1,t)}return this}crossFadeTo(e,t,r=!1){return e.crossFadeFrom(this,t,r)}stopFading(){let e=this._weightInterpolant;return null!==e&&(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,r){let i=this._mixer,n=i.time,a=this.timeScale,s=this._timeScaleInterpolant;null===s&&(s=i._lendControlInterpolant(),this._timeScaleInterpolant=s);let o=s.parameterPositions,l=s.sampleValues;return o[0]=n,o[1]=n+r,l[0]=e/a,l[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}
1_update(e,t,r,i){if(!this.enabled)return void this._updateWeight(e);let n=this._startTime;if(null!==n){let i=(e-n)*r;i<0||0===r?t=0:(this._startTime=null,t=r*i)}t*=this._updateTimeScale(e);let a=this._updateTime(t),s=this._updateWeight(e);if(s>0){let e=this._interpolants,t=this._propertyBindings;if(2501===this.blendMode)for(let r=0,i=e.length;r!==i;++r)e[r].evaluate(a),t[r].accumulateAdditive(s);else for(let r=0,n=e.length;r!==n;++r)e[r].evaluate(a),t[r].accumulate(i,s)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let r=this._weightInterpolant;if(null!==r){let i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let r=this._timeScaleInterpolant;null!==r&&(t*=r.evaluate(e)[0],e>r.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,r=this.loop,i=this.time+e,n=this._loopCount,a=2202===r;if(0===e)return -1===n?i:a&&(1&n)==1?t-i:i;if(2200===r){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));s:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break s}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(-1===n&&(e>=0?(n=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i>=t||i<0){let r=Math.floor(i/t);i-=t*r,n+=Math.abs(r);let s=this.repetitions-n;if(s<=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(1===s){let t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=n,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:r})}}else this.time=i;if(a&&(1&n)==1)return t-i}return i}_setEndings(e,t,r){let i=this._interpolantSettings;r?(i.endingStart=2401,i.endingEnd=2401):(e?i.endingStart=this.zeroSlopeAtStart?2401:2400:i.endingStart=2402,t?i.endingEnd=this.zeroSlopeAtEnd?2401:2400:i.endingEnd=2402)}_scheduleFading(e,t,r){let i=this._mixer,n=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);let s=a.parameterPositions,o=a.sampleValues;return s[0]=n,o[0]=t,s[1]=n+e,o[1]=r,this}}let oy=new Float32Array(1);class o_ extends eu{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){let r=e._localRoot||this._root,i=e._clip.tracks,n=i.length,a=e._propertyBindings,s=e._interpolants,o=r.uuid,l=this._bindingsByRootAndName,u=l[o];void 0===u&&(u={},l[o]=u);for(let e=0;e!==n;++e){let n=i[e],l=n.name,h=u[l];if(void 0!==h)++h.referenceCount,a[e]=h;else{if(void 0!==(h=a[e])){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,o,l));continue}let i=t&&t._propertyBindings[e].binding.parsedPath;h=new ol(om.create(r,l,i),n.ValueTypeName,n.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,o,l),a[e]=h}s[e].resultBuffer=h.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){let t=(e._localRoot||this._root).uuid,r=e._clip.uuid,i=this._actionsByClip[r];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,r,t)}let t=e._propertyBindings;for(let e=0,r=t.length;e!==r;++e){let r=t[e];0==r.useCount++&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let e=0,r=t.length;e!==r;++e){let r=t[e];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let 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){let t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,r){let i=this._actions,n=this._actionsByClip,a=n[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,n[t]=a;else{let t=a.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[r]=e}_removeInactiveAction(e){let t=this._actions,r=t[t.length-1],i=e._cacheIndex;r._cacheIndex=i,t[i]=r,t.pop(),e._cacheIndex=null;let n=e._clip.uuid,a=this._actionsByClip,s=a[n],o=s.knownActions,l=o[o.length-1],u=e._byClipCacheIndex;l._byClipCacheIndex=u,o[u]=l,o.pop(),e._byClipCacheIndex=null;let h=s.actionByRoot,d=(e._localRoot||this._root).uuid;delete h[d],0===o.length&&delete a[n],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let e=0,r=t.length;e!==r;++e){let r=t[e];0==--r.referenceCount&&this._removeInactiveBinding(r)}}_lendAction(e){let t=this._actions,r=e._cacheIndex,i=this._nActiveActions++,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n}_takeBackAction(e){let t=this._actions,r=e._cacheIndex,i=--this._nActiveActions,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n}_addInactiveBinding(e,t,r){let i=this._bindingsByRootAndName,n=this._bindings,a=i[t];void 0===a&&(a={},i[t]=a),a[r]=e,e._cacheIndex=n.length,n.push(e)}_removeInactiveBinding(e){let t=this._bindings,r=e.binding,i=r.rootNode.uuid,n=r.path,a=this._bindingsByRootAndName,s=a[i],o=t[t.length-1],l=e._cacheIndex;o._cacheIndex=l,t[l]=o,t.pop(),delete s[n],0===Object.keys(s).length&&delete a[i]}_lendBinding(e){let t=this._bindings,r=e._cacheIndex,i=this._nActiveBindings++,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n}_takeBackBinding(e){let t=this._bindings,r=e._cacheIndex,i=--this._nActiveBindings,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return void 0===r&&((r=new aY(new Float32Array(2),new Float32Array(2),1,oy)).__cacheIndex=t,e[t]=r),r}_takeBackControlInterpolant(e){let t=this._controlInterpolants,r=e.__cacheIndex,i=--this._nActiveControlInterpolants,n=t[i];e.__cacheIndex=i,t[i]=e,n.__cacheIndex=r,t[r]=n}clipAction(e,t,r){let i=t||this._root,n=i.uuid,a="string"==typeof e?a9.findByName(i,e):e,s=null!==a?a.uuid:e,o=this._actionsByClip[s],l=null;if(void 0===r&&(r=null!==a?a.blendMode:2500),void 0!==o){let e=o.actionByRoot[n];if(void 0!==e&&e.blendMode===r)return e;l=o.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;let u=new ov(this,a,t,r);return this._bindAction(u,l),this._addInactiveAction(u,s,n),u}existingAction(e,t){let r=t||this._root,i=r.uuid,n="string"==typeof e?a9.findByName(r,e):e,a=n?n.uuid:e,s=this._actionsByClip[a];return void 0!==s&&s.actionByRoot[i]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let r=t-1;r>=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;let t=this._actions,r=this._nActiveActions,i=this.time+=e,n=Math.sign(e),a=this._accuIndex^=1;for(let s=0;s!==r;++s)t[s]._update(i,e,n,a);let s=this._bindings,o=this._nActiveBindings;for(let e=0;e!==o;++e)s[e].apply(a);return this}setTime(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,r=e.uuid,i=this._actionsByClip,n=i[r];if(void 0!==n){let e=n.knownActions;for(let r=0,i=e.length;r!==i;++r){let i=e[r];this._deactivateAction(i);let n=i._cacheIndex,a=t[t.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,a._cacheIndex=n,t[n]=a,t.pop(),this._removeInactiveBindingsForAction(i)}delete i[r]}}uncacheRoot(e){let t=e.uuid,r=this._actionsByClip;for(let e in r){let i=r[e].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}let i=this._bindingsByRootAndName[t];if(void 0!==i)for(let e in i){let t=i[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){let r=this.existingAction(e,t);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}}class ox extends eV{constructor(e=1,t=1,r=1,i={}){super(e,t,i),this.isRenderTarget3D=!0,this.depth=r,this.texture=new ej(null,e,t,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class ob{constructor(e){this.value=e}clone(){return new ob(void 0===this.value.clone?this.value:this.value.clone())}}let oS=0;class oT extends eu{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:oS++}),this.name="",this.usage=35044,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){let t=this.uniforms.indexOf(e);return -1!==t&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;let t=e.uniforms;this.uniforms.length=0;for(let e=0,r=t.length;e<r;e++){let r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0;e<r.length;e++)this.uniforms.push(r[e].clone())}return this}clone(){return new this.constructor().copy(this)}}class oA extends rv{constructor(e,t,r=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class oM{constructor(e,t,r,i,n,a=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=r,this.elementSize=i,this.count=n,this.normalized=a,this.version=0}set needsUpdate(e){!0===e&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}let oE=new eq;class oC{constructor(e,t,r=0,i=1/0){this.ray=new rq(e,t),this.near=r,this.far=i,this.camera=null,this.layers=new e4,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):ea("Raycaster:
1Unsupported camera type: "+t.type)}setFromXRController(e){return oE.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(oE),this}intersectObject(e,t=!0,r=[]){return oR(e,this,r,t),r.sort(ow),r}intersectObjects(e,t=!0,r=[]){for(let i=0,n=e.length;i<n;i++)oR(e[i],this,r,t);return r.sort(ow),r}}function ow(e,t){return e.distance-t.distance}function oR(e,t,r,i){let n=!0;if(e.layers.test(t.layers)&&!1===e.raycast(t,r)&&(n=!1),!0===n&&!0===i){let i=e.children;for(let e=0,n=i.length;e<n;e++)oR(i[e],t,r,!0)}}class oN{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,en("THREE.Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}class oL{constructor(e=1,t=0,r=0){this.radius=e,this.phi=t,this.theta=r}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=em(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(em(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class oB{constructor(e=1,t=0,r=0){this.radius=e,this.theta=t,this.y=r}set(e,t,r){return this.radius=e,this.theta=t,this.y=r,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+r*r),this.theta=Math.atan2(e,r),this.y=t,this}clone(){return new this.constructor().copy(this)}}
1class oI{constructor(e,t,r,i){oI.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==e&&this.set(e,t,r,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let r=0;r<4;r++)this.elements[r]=e[r+t];return this}set(e,t,r,i){let n=this.elements;return n[0]=e,n[2]=t,n[1]=r,n[3]=i,this}}let oP=new eb;class oF{constructor(e=new eb(Infinity,Infinity),t=new eb(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=oP.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=Infinity,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,oP).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)}}let oD=new eT,oU=new eT,oO=new eT,oG=new eT,ok=new eT,oV=new eT,oz=new eT;class oH{constructor(e=new eT,t=new eT){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){oD.subVectors(e,this.start),oU.subVectors(this.end,this.start);let r=oU.dot(oU),i=oU.dot(oD)/r;return t&&(i=em(i,0,1)),i}closestPointToPoint(e,t,r){let i=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=oV,r=oz){let i,n,a=1e-8*1e-8,s=this.start,o=e.start,l=this.end,u=e.end;oO.subVectors(l,s),oG.subVectors(u,o),ok.subVectors(s,o);let h=oO.dot(oO),d=oG.dot(oG),c=oG.dot(ok);if(h<=a&&d<=a)return t.copy(s),r.copy(o),t.sub(r),t.dot(t);if(h<=a)i=0,n=em(n=c/d,0,1);else{let e=oO.dot(ok);if(d<=a)n=0,i=em(-e/h,0,1);else{let t=oO.dot(oG),r=h*d-t*t;i=0!==r?em((t*c-e*d)/r,0,1):0,(n=(t*i+c)/d)<0?(n=0,i=em(-e/h,0,1)):n>1&&(n=1,i=em((t-e)/h,0,1))}}return t.copy(s).addScaledVector(oO,i),r.copy(o).addScaledVector(oG,n),t.distanceToSquared(r)}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)}}let oW=new eT;class oj extends th{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const r=new rg,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 e=0,t=1;e<32;e++,t++){const r=e/32*Math.PI*2,n=t/32*Math.PI*2;i.push(Math.cos(r),Math.sin(r),1,Math.cos(n),Math.sin(n),1)}r.setAttribute("position",new rn(i,3));const n=new iQ({fog:!1,toneMapped:!1});this.cone=new ne(r,n),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),oW.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(oW),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}let oX=new eT,oq=new eq,o$=new eq;class oJ extends ne{constructor(e){const t=function e(t){let r=[];!0===t.isBone&&r.push(t);for(let i=0;i<t.children.length;i++)r.push(...e(t.children[i]));return r}(e),r=new rg,i=[],n=[];for(let e=0;e<t.length;e++){const r=t[e];r.parent&&r.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),n.push(0,0,0),n.push(0,0,0))}r.setAttribute("position",new rn(i,3)),r.setAttribute("color",new rn(n,3)),super(r,new iQ({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;
1const a=new ty(255),s=new ty(65280);this.setColors(a,s)}updateMatrixWorld(e){let t=this.bones,r=this.geometry,i=r.getAttribute("position");o$.copy(this.root.matrixWorld).invert();for(let e=0,r=0;e<t.length;e++){let n=t[e];n.parent&&n.parent.isBone&&(oq.multiplyMatrices(o$,n.matrixWorld),oX.setFromMatrixPosition(oq),i.setXYZ(r,oX.x,oX.y,oX.z),oq.multiplyMatrices(o$,n.parent.matrixWorld),oX.setFromMatrixPosition(oq),i.setXYZ(r+1,oX.x,oX.y,oX.z),r+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){let r=this.geometry.getAttribute("color");for(let i=0;i<r.count;i+=2)r.setXYZ(i,e.r,e.g,e.b),r.setXYZ(i+1,t.r,t.g,t.b);return r.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class oK extends r8{constructor(e,t,r){super(new a_(t,4,2),new r$({wireframe:!0,fog:!1,toneMapped:!1})),this.light=e,this.color=r,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}let oY=new eT,oQ=new ty,oZ=new ty;class o0 extends th{constructor(e,t,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="HemisphereLightHelper";const i=new am(t);i.rotateY(.5*Math.PI),this.material=new r$({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const n=new Float32Array(3*i.getAttribute("position").count);i.setAttribute("color",new t5(n,3)),this.add(new r8(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{let t=e.geometry.getAttribute("color");oQ.copy(this.light.color),oZ.copy(this.light.groundColor);for(let e=0,r=t.count;e<r;e++){let i=e<r/2?oQ:oZ;t.setXYZ(e,i.r,i.g,i.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(oY.setFromMatrixPosition(this.light.matrixWorld).negate())}}class o1 extends ne{constructor(e=10,t=10,r=4473924,i=8947848){r=new ty(r),i=new ty(i);const n=t/2,a=e/t,s=e/2,o=[],l=[];for(let e=0,u=0,h=-s;e<=t;e++,h+=a){o.push(-s,0,h,s,0,h),o.push(h,0,-s,h,0,s);const t=e===n?r:i;t.toArray(l,u),u+=3,t.toArray(l,u),u+=3,t.toArray(l,u),u+=3,t.toArray(l,u),u+=3}const u=new rg;u.setAttribute("position",new rn(o,3)),u.setAttribute("color",new rn(l,3)),super(u,new iQ({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class o2 extends ne{constructor(e=10,t=16,r=8,i=64,n=4473924,a=8947848){n=new ty(n),a=new ty(a);const s=[],o=[];if(t>1)for(let r=0;r<t;r++){const i=r/t*(2*Math.PI),l=Math.sin(i)*e,u=Math.cos(i)*e;s.push(0,0,0),s.push(l,0,u);const h=1&r?n:a;o.push(h.r,h.g,h.b),o.push(h.r,h.g,h.b)}for(let t=0;t<r;t++){const l=1&t?n:a,u=e-e/r*t;for(let e=0;e<i;e++){let t=e/i*(2*Math.PI),r=Math.sin(t)*u,n=Math.cos(t)*u;s.push(r,0,n),o.push(l.r,l.g,l.b),r=Math.sin(t=(e+1)/i*(2*Math.PI))*u,n=Math.cos(t)*u,s.push(r,0,n),o.push(l.r,l.g,l.b)}}const l=new rg;l.setAttribute("position",new rn(s,3)),l.setAttribute("color",new rn(o,3)),super(l,new iQ({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}let o3=new eT,o4=new eT,o5=new eT;class o8 extends th{constructor(e,t,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="DirectionalLightHelper",void 0===t&&(t=1);let i=new rg;i.setAttribute("position",new rn([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const n=new iQ({fog:!1,toneMapped:!1});this.lightPlane=new i8(i,n),this.add(this.lightPlane),(i=new rg).setAttribute("position",new rn([0,0,0,0,0,1],3)),this.targetLine=new i8(i,n),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),o3.setFromMatrixPosition(this.light.matrixWorld),o4.setFromMatrixPosition(this.light.target.matrixWorld),o5.subVectors(o4,o3),this.lightPlane.lookAt(o4),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(o4),this.targetLine.scale.z
1=o5.length()}}let o6=new eT,o9=new sT;class o7 extends ne{constructor(e){const t=new rg,r=new iQ({color:0xffffff,vertexColors:!0,toneMapped:!1}),i=[],n=[],a={};function s(e,t){o(e),o(t)}function o(e){i.push(0,0,0),n.push(0,0,0),void 0===a[e]&&(a[e]=[]),a[e].push(i.length/3-1)}s("n1","n2"),s("n2","n4"),s("n4","n3"),s("n3","n1"),s("f1","f2"),s("f2","f4"),s("f4","f3"),s("f3","f1"),s("n1","f1"),s("n2","f2"),s("n3","f3"),s("n4","f4"),s("p","n1"),s("p","n2"),s("p","n3"),s("p","n4"),s("u1","u2"),s("u2","u3"),s("u3","u1"),s("c","t"),s("p","c"),s("cn1","cn2"),s("cn3","cn4"),s("cf1","cf2"),s("cf3","cf4"),t.setAttribute("position",new rn(i,3)),t.setAttribute("color",new rn(n,3)),super(t,r),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const l=new ty(0xffaa00),u=new ty(0xff0000),h=new ty(43775),d=new ty(0xffffff),c=new ty(3355443);this.setColors(l,u,h,d,c)}setColors(e,t,r,i,n){let a=this.geometry.getAttribute("color");return a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,r.r,r.g,r.b),a.setXYZ(33,r.r,r.g,r.b),a.setXYZ(34,r.r,r.g,r.b),a.setXYZ(35,r.r,r.g,r.b),a.setXYZ(36,r.r,r.g,r.b),a.setXYZ(37,r.r,r.g,r.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,n.r,n.g,n.b),a.setXYZ(41,n.r,n.g,n.b),a.setXYZ(42,n.r,n.g,n.b),a.setXYZ(43,n.r,n.g,n.b),a.setXYZ(44,n.r,n.g,n.b),a.setXYZ(45,n.r,n.g,n.b),a.setXYZ(46,n.r,n.g,n.b),a.setXYZ(47,n.r,n.g,n.b),a.setXYZ(48,n.r,n.g,n.b),a.setXYZ(49,n.r,n.g,n.b),a.needsUpdate=!0,this}update(){let e,t,r=this.geometry,i=this.pointMap;if(o9.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),!0===this.camera.reversedDepth)e=1,t=0;else if(2e3===this.camera.coordinateSystem)e=-1,t=1;else if(2001===this.camera.coordinateSystem)e=0,t=1;else throw Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);le("c",i,r,o9,0,0,e),le("t",i,r,o9,0,0,t),le("n1",i,r,o9,-1,-1,e),le("n2",i,r,o9,1,-1,e),le("n3",i,r,o9,-1,1,e),le("n4",i,r,o9,1,1,e),le("f1",i,r,o9,-1,-1,t),le("f2",i,r,o9,1,-1,t),le("f3",i,r,o9,-1,1,t),le("f4",i,r,o9,1,1,t),le("u1",i,r,o9,.7,1.1,e),le("u2",i,r,o9,-.7,1.1,e),le("u3",i,r,o9,0,2,e),le("cf1",i,r,o9,-1,0,t),le("cf2",i,r,o9,1,0,t),le("cf3",i,r,o9,0,-1,t),le("cf4",i,r,o9,0,1,t),le("cn1",i,r,o9,-1,0,e),le("cn2",i,r,o9,1,0,e),le("cn3",i,r,o9,0,-1,e),le("cn4",i,r,o9,0,1,e),r.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function le(e,t,r,i,n,a,s){o6.set(n,a,s).unproject(i);let o=t[e];if(void 0!==o){let e=r.getAttribute("position");for(let t=0,r=o.length;t<r;t++)e.setXYZ(o[t],o6.x,o6.y,o6.z)}}let lt=new tU;class lr extends ne{constructor(e,t=0xffff00){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),n=new rg;n.setIndex(new t5(r,1)),n.setAttribute("position",new t5(i,3)),super(n,new iQ({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(void 0!==this.object&<.setFromObject(this.object),lt.isEmpty())return;let e=lt.min,t=lt.max,r=this.geometry.attributes.position,i=r.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}
1class li extends ne{constructor(e,t=0xffff00){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new rg;i.setIndex(new t5(r,1)),i.setAttribute("position",new rn([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new iQ({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){let t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class ln extends i8{constructor(e,t=1,r=0xffff00){const i=new rg;i.setAttribute("position",new rn([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere(),super(i,new iQ({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const n=new rg;n.setAttribute("position",new rn([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),n.computeBoundingSphere(),this.add(new r8(n,new r$({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}let la=new eT;class ls extends th{constructor(e=new eT(0,0,1),t=new eT(0,0,0),r=1,i=0xffff00,s=.2*r,o=.2*s){super(),this.type="ArrowHelper",void 0===n&&((n=new rg).setAttribute("position",new rn([0,0,0,0,1,0],3)),(a=new nA(.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new i8(n,new iQ({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new r8(a,new r$({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,s,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{la.set(e.z,0,-e.x).normalize();let t=Math.acos(e.y);this.quaternion.setFromAxisAngle(la,t)}}setLength(e,t=.2*e,r=.2*t){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),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 lo extends ne{constructor(e=1){const t=new rg;t.setAttribute("position",new rn([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],3)),t.setAttribute("color",new rn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(t,new iQ({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,r){let i=new ty,n=this.geometry.attributes.color.array;return i.set(e),i.toArray(n,0),i.toArray(n,3),i.set(t),i.toArray(n,6),i.toArray(n,9),i.set(r),i.toArray(n,12),i.toArray(n,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class ll{constructor(){this.type="ShapePath",this.color=new ty,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new nZ,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,i){return this.currentPath.quadraticCurveTo(e,t,r,i),this}bezierCurveTo(e,t,r,i,n,a){return this.currentPath.bezierCurveTo(e,t,r,i,n,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){let t,r,i,n,a,s=al.isClockWise,o=this.subPaths;if(0===o.length)return[];let l=[];if(1===o.length)return r=o[0],(i=new n0).curves=r.curves,l.push(i),l;let u=!s(o[0].getPoints());u=e?!u:u;let h=[],d=[],c=[],p=0;d[0]=void 0,c[p]=[];for(let i=0,a=o.length;i<a;i++)t=s(n=(r=o[i]).getPoints()),(t=e?!t:t)?(!u&&d[p]&&p++,d[p]={s:new n0,p:n},d[p].s.curves=r.curves,u&&p++,c[p]=[]):c[p].push({h:r,p:n[0]});if(!d[0])return function(e){let t=[];for(let r=0,i=e.length;r<i;r++){let i=e[r],n=new n0;n.curves=i.curves,t.push(n)}return t}(o);if(d.length>1){let e=!1,t=0;for(let e=0,t=d.length;e<t;e++)h[e]=[];for(let r=0,i=d.length;r<i;r++){let i=c[r];for(let n=0;n<i.length;n++){let a=i[n],s=!0;for(let i=0;i<d.length;i++)(function(e,t){let r=t.length,i=!1;for(let n=r-1,a=0;a<r;n=a++){let r=t[n],s=t[a],o=s.x-r.x,l=s.y-r.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(r=t[a],o=-o,s=t[n],l=-l),e.y<r.y||e.y>s.y)continue;if(e.y===r.y){if(e.x===r.x)return!0}else{let t=l*(e.x-r.x)-o*(e.y-r.y);if(0===t)return!0;
1if(t<0)continue;i=!i}}else{if(e.y!==r.y)continue;if(s.x<=e.x&&e.x<=r.x||r.x<=e.x&&e.x<=s.x)return!0}}return i})(a.p,d[i].p)&&(r!==i&&t++,s?(s=!1,h[i].push(a)):e=!0);s&&h[r].push(a)}}t>0&&!1===e&&(c=h)}for(let e=0,t=d.length;e<t;e++){i=d[e].s,l.push(i),a=c[e];for(let e=0,t=a.length;e<t;e++)i.holes.push(a[e].h)}return l}}class lu extends eu{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){void 0===e?en("Controls: connect() now requires an element."):(null!==this.domElement&&this.disconnect(),this.domElement=e)}disconnect(){}dispose(){}update(){}}function lh(e,t,r,i){let n=function(e){switch(e){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw Error(`Unknown texture type ${e}.`)}(i);switch(r){case 1021:return e*t;case 1028:case 1029:return e*t/n.components*n.byteLength;case 1030:case 1031:return e*t*2/n.components*n.byteLength;case 1022:return e*t*3/n.components*n.byteLength;case 1023:case 1033:return e*t*4/n.components*n.byteLength;case 33776:case 33777:case 36196:case 37492:case 37488:case 37489:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case 33778:case 33779:case 37496:case 37490:case 37491:case 37808:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case 35841:case 35843:return Math.max(e,16)*Math.max(t,8)/4;case 35840:case 35842:return Math.max(e,8)*Math.max(t,8)/2;case 37809:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case 37810:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case 37811:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case 37812:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case 37813:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case 37814:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case 37815:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case 37816:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case 37817:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case 37818:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case 37819:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case 37820:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case 37821:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case 36492:case 36494:case 36495:case 36285:case 36286:return Math.ceil(e/4)*Math.ceil(t/4)*16;case 36283:case 36284:return Math.ceil(e/4)*Math.ceil(t/4)*8}throw Error(`Unable to determine texture byte length for ${r} format.`)}class ld{static contain(e,t){let r;return(r=e.image&&e.image.width?e.image.width/e.image.height:1)>t?(e.repeat.x=1,e.repeat.y=r/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/r,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e}static cover(e,t){let r;return(r=e.image&&e.image.width?e.image.width/e.image.height:1)>t?(e.repeat.x=t/r,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=r/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e}static fill(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e}static getByteLength(e,t,r,i){return lh(e,t,r,i)}}function lc(){let e=null,t=!1,r=null,i=null;function n(t,a){r(t,a),i=e.requestAnimationFrame(n)}return{start:function(){!0===t||null!==r&&(i=e.requestAnimationFrame(n),t=!0)},stop:function(){e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){r=e},setContext:function(t){e=t}}}function lp(e){let t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(r){r.isInterleavedBufferAttribute&&(r=r.data);let i=t.get(r);i&&(e.deleteBuffer(i.buffer),t.delete(r))},update:function(r,i){if(r.isInterleavedBufferAttribute&&(r=r.data),r.isGLBufferAttribute){let e=t.get(r);(!e||e.version<r.version)&&t.set(r,{buffer:r.buffer,type:r.type,bytesPerElement:r.elementSize,version:r.version});return}let n=t.get(r);if(void 0===n)t.set(r,function(t,r){let i,n=t.array,a=t.usage,s=n.byteLength,o=e.createBuffer();if(e.bindBuffer(r,o),e.bufferData(r,n,a),t.onUploadCallback(),n instanceof Float32Array)i=e.FLOAT;else if("u">typeof Float16Array&&n instanceof Float16Array)i=e.HALF_FLOAT;else if(n instanceof Uint16Array)i=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(n instanceof Int16Array)i=e.SHORT;else if(n instanceof Uint32Array)i=e.UNSIGNED_INT;else if(n instanceof Int32Array)i=e.INT;else if(n instanceof Int8Array)i=e.BYTE;else if(n instanceof Uint8Array)i=e.UNSIGNED_BYTE;else if(n instanceof Uint8ClampedArray)i=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+n);return{buffer:o,type:i,bytesPerElement:n.BYTES_PER_ELEMENT,version:t.version,size:s}}
1(r,i));else if(n.version<r.version){if(n.size!==r.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(t,r,i){let n=r.array,a=r.updateRanges;if(e.bindBuffer(i,t),0===a.length)e.bufferSubData(i,0,n);else{a.sort((e,t)=>e.start-t.start);let t=0;for(let e=1;e<a.length;e++){let r=a[t],i=a[e];i.start<=r.start+r.count+1?r.count=Math.max(r.count,i.start+i.count-r.start):a[++t]=i}a.length=t+1;for(let t=0,r=a.length;t<r;t++){let r=a[t];e.bufferSubData(i,r.start*n.BYTES_PER_ELEMENT,n,r.start,r.count)}r.clearUpdateRanges()}r.onUploadCallback()}(n.buffer,r,i),n.version=r.version}}}}"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"183"}})),"u">typeof window&&(window.__THREE__?en("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="183"),e.s(["ACESFilmicToneMapping",()=>4,"AddEquation",()=>100,"AddOperation",()=>2,"AdditiveAnimationBlendMode",()=>2501,"AdditiveBlending",()=>2,"AgXToneMapping",()=>6,"AlphaFormat",()=>1021,"AlwaysCompare",()=>519,"AlwaysDepth",()=>1,"AlwaysStencilFunc",()=>519,"AmbientLight",()=>sF,"AnimationAction",()=>ov,"AnimationClip",()=>a9,"AnimationLoader",()=>so,"AnimationMixer",()=>o_,"AnimationObjectGroup",()=>og,"AnimationUtils",()=>a$,"ArcCurve",()=>nP,"ArrayCamera",()=>s2,"ArrowHelper",()=>ls,"AttachedBindMode",()=>D,"Audio",()=>ot,"AudioAnalyser",()=>oo,"AudioContext",()=>sJ,"AudioListener",()=>oe,"AudioLoader",()=>sK,"AxesHelper",()=>lo,"BackSide",()=>1,"BasicDepthPacking",()=>3200,"BasicShadowMap",()=>0,"BatchedMesh",()=>iY,"BezierInterpolant",()=>aZ,"Bone",()=>iu,"BooleanKeyframeTrack",()=>a1,"Box2",()=>oF,"Box3",()=>tU,"Box3Helper",()=>li,"BoxGeometry",()=>nx,"BoxHelper",()=>lr,"BufferAttribute",()=>t5,"BufferGeometry",()=>rg,"BufferGeometryLoader",()=>sz,"ByteType",()=>1010,"Cache",()=>a7,"Camera",()=>sT,"CameraHelper",()=>o7,"CanvasTexture",()=>ng,"CapsuleGeometry",()=>nb,"CatmullRomCurve3",()=>nk,"CineonToneMapping",()=>3,"CircleGeometry",()=>nS,"ClampToEdgeWrapping",()=>1001,"Clock",()=>oN,"Color",()=>ty,"ColorKeyframeTrack",()=>a2,"ColorManagement",()=>eN,"Compatibility",()=>X,"CompressedArrayTexture",()=>np,"CompressedCubeTexture",()=>nf,"CompressedTexture",()=>nc,"CompressedTextureLoader",()=>sl,"ConeGeometry",()=>nA,"ConstantAlphaFactor",()=>213,"ConstantColorFactor",()=>211,"Controls",()=>lu,"CubeCamera",()=>s1,"CubeDepthTexture",()=>ny,"CubeReflectionMapping",()=>301,"CubeRefractionMapping",()=>302,"CubeTexture",()=>nm,"CubeTextureLoader",()=>sd,"CubeUVReflectionMapping",()=>306,"CubicBezierCurve",()=>nW,"CubicBezierCurve3",()=>nj,"CubicInterpolant",()=>aK,"CullFaceBack",()=>1,"CullFaceFront",()=>2,"CullFaceFrontBack",()=>3,"CullFaceNone",()=>0,"Curve",()=>nB,"CurvePath",()=>nQ,"CustomBlending",()=>5,"CustomToneMapping",()=>5,"CylinderGeometry",()=>nT,"Cylindrical",()=>oB,"Data3DTexture",()=>ej,"DataArrayTexture",()=>eH,"DataTexture",()=>ih,"DataTextureLoader",()=>sc,"DataUtils",()=>t1,"DecrementStencilOp",()=>7683,"DecrementWrapStencilOp",()=>34056,"DefaultLoadingManager",()=>sr,"DepthFormat",()=>1026,"DepthStencilFormat",()=>1027,"DepthTexture",()=>nv,"DetachedBindMode",()=>U,"DirectionalLight",()=>sP,"DirectionalLightHelper",()=>o8,"DiscreteInterpolant",()=>aQ,"DodecahedronGeometry",()=>nE,"DoubleSide",()=>2,"DstAlphaFactor",()=>206,"DstColorFactor",()=>208,"DynamicCopyUsage",()=>35050,"DynamicDrawUsage",()=>35048,"DynamicReadUsage",()=>35049,"EdgesGeometry",()=>nL,"EllipseCurve",()=>nI,"EqualCompare",()=>514,"EqualDepth",()=>4,"EqualStencilFunc",()=>514,"EquirectangularReflectionMapping",()=>303,"EquirectangularRefractionMapping",()=>304,"Euler",()=>e3,"EventDispatcher",()=>eu,"ExternalTexture",()=>n_,"ExtrudeGeometry",()=>ad,"FileLoader",()=>ss,"Float16BufferAttribute",()=>ri,"Float32BufferAttribute",()=>rn,"FloatType",()=>1015,"Fog",()=>tb,"FogExp2",()=>tx,"FramebufferTexture",()=>nd,"FrontSide",()=>0,"Frustum",()=>iL,"FrustumArray",()=>iP,"GLBufferAttribute",()=>oM,"GLSL1",()=>"100","GLSL3",()=>z,"GreaterCompare",()=>516,"GreaterDepth",()=>6,"GreaterEqualCompare",()=>518,"GreaterEqualDepth",()=>5,"GreaterEqualStencilFunc",()=>518,"GreaterStencilFunc",()=>516,"GridHelper",()=>o1,"Group",()=>td,"HalfFloatType",()=>1016,"HemisphereLight",()=>sm,"HemisphereLightHelper",()=>o0,"IcosahedronGeometry",()=>ap,"ImageBitmapLoader",()=>s$,"ImageLoader",()=>sh,"ImageUtils",()=>eI,"IncrementStencilOp",()=>7682,"IncrementWrapStencilOp",()=>34055,"InstancedBufferAttribute",()=>im,"InstancedBufferGeometry",()=>sV,"InstancedInterleavedBuffer",()=>oA,"InstancedMesh",()=>iT,"Int16BufferAttribute",()=>t7,"Int32BufferAttribute",()=>rt,"Int8BufferAttribute",()=>t8,"IntType",()=>1013,"InterleavedBuffer",()=>rv,"InterleavedBufferAttribute",()=>r_,"Interpolant",()=>aJ,"InterpolateBezier",()=>2303,"InterpolateDiscrete",()=>2300,"InterpolateLinear",()=>2301,"InterpolateSmooth",()=>2302,"InterpolationSamplingMode",()=>j,"InterpolationSamplingType",()=>W,"InvertStencilOp",()=>5386,"KeepStencilOp",()=>7680,"KeyframeTrack",()=>a0,"LOD",()=>rG,"LatheGeometry",()=>af,"Layers",()=>e4,"LessCompare",()=>513,"LessDepth",()=>2,"LessEqualCompare",()=>515,"LessEqualDepth",()=>3,"LessEqualStencilFunc",()=>515,"LessStencilFunc",()=>513,"Light",()=>sf,"LightProbe",()=>sO,"Line",()=>i8,"Line3",()=>oH,"LineBasicMaterial",()=>iQ,"LineCurve",()=>nX,"LineCurve3",()=>nq,"LineDashedMaterial",()=>aH,"LineLoop",()=>nt,"LineSegments",()=>ne,"LinearFilter",()=>1006,"LinearInterpolant",()=>aY,"LinearMipMapLinearFilter",()=>1008,"LinearMipMapNearestFilter",()=>1007,"LinearMipmapLinearFilter",()=>1008,"LinearMipmapNearestFilter",()=>1007,"LinearSRGBColorSpace",()=>G,"LinearToneMapping",()=>1,"LinearTransfer",()=>k,"Loader",()=>si,"LoaderUtils",()=>sk,"LoadingManager",()=>st,"LoopOnce",()=>2200,"LoopPingPong",()=>2202,"LoopRepeat",()=>2201,"MOUSE",()=>P,"Material",()=>rb,"MaterialBlending",()=>6,"MaterialLoader",()=>sG,"MathUtils",()=>ex,"Matrix2",()=>oI,"Matrix3",()=>eE,"Matrix4",()=>
1eq,"MaxEquation",()=>104,"Mesh",()=>r8,"MeshBasicMaterial",()=>r$,"MeshDepthMaterial",()=>ak,"MeshDistanceMaterial",()=>aV,"MeshLambertMaterial",()=>aG,"MeshMatcapMaterial",()=>az,"MeshNormalMaterial",()=>aO,"MeshPhongMaterial",()=>aD,"MeshPhysicalMaterial",()=>aF,"MeshStandardMaterial",()=>aP,"MeshToonMaterial",()=>aU,"MinEquation",()=>103,"MirroredRepeatWrapping",()=>1002,"MixOperation",()=>1,"MultiplyBlending",()=>4,"MultiplyOperation",()=>0,"NearestFilter",()=>1003,"NearestMipMapLinearFilter",()=>1005,"NearestMipMapNearestFilter",()=>1004,"NearestMipmapLinearFilter",()=>1005,"NearestMipmapNearestFilter",()=>1004,"NeutralToneMapping",()=>7,"NeverCompare",()=>512,"NeverDepth",()=>0,"NeverStencilFunc",()=>512,"NoBlending",()=>0,"NoColorSpace",()=>"","NoNormalPacking",()=>"","NoToneMapping",()=>0,"NormalAnimationBlendMode",()=>2500,"NormalBlending",()=>1,"NormalGAPacking",()=>"ga","NormalRGPacking",()=>"rg","NotEqualCompare",()=>517,"NotEqualDepth",()=>7,"NotEqualStencilFunc",()=>517,"NumberKeyframeTrack",()=>a3,"Object3D",()=>th,"ObjectLoader",()=>sH,"ObjectSpaceNormalMap",()=>1,"OctahedronGeometry",()=>am,"OneFactor",()=>201,"OneMinusConstantAlphaFactor",()=>214,"OneMinusConstantColorFactor",()=>212,"OneMinusDstAlphaFactor",()=>207,"OneMinusDstColorFactor",()=>209,"OneMinusSrcAlphaFactor",()=>205,"OneMinusSrcColorFactor",()=>203,"OrthographicCamera",()=>sB,"PCFShadowMap",()=>1,"PCFSoftShadowMap",()=>2,"Path",()=>nZ,"PerspectiveCamera",()=>sC,"Plane",()=>iC,"PlaneGeometry",()=>ag,"PlaneHelper",()=>ln,"PointLight",()=>sL,"PointLightHelper",()=>oK,"Points",()=>no,"PointsMaterial",()=>nr,"PolarGridHelper",()=>o2,"PolyhedronGeometry",()=>nM,"PositionalAudio",()=>os,"PropertyBinding",()=>om,"PropertyMixer",()=>ol,"QuadraticBezierCurve",()=>n$,"QuadraticBezierCurve3",()=>nJ,"Quaternion",()=>eS,"QuaternionKeyframeTrack",()=>a5,"QuaternionLinearInterpolant",()=>a4,"R11_EAC_Format",()=>37488,"RAD2DEG",()=>ep,"RED_GREEN_RGTC2_Format",()=>36285,"RED_RGTC1_Format",()=>36283,"REVISION",()=>"183","RG11_EAC_Format",()=>37490,"RGBADepthPacking",()=>3201,"RGBAFormat",()=>1023,"RGBAIntegerFormat",()=>1033,"RGBA_ASTC_10x10_Format",()=>37819,"RGBA_ASTC_10x5_Format",()=>37816,"RGBA_ASTC_10x6_Format",()=>37817,"RGBA_ASTC_10x8_Format",()=>37818,"RGBA_ASTC_12x10_Format",()=>37820,"RGBA_ASTC_12x12_Format",()=>37821,"RGBA_ASTC_4x4_Format",()=>37808,"RGBA_ASTC_5x4_Format",()=>37809,"RGBA_ASTC_5x5_Format",()=>37810,"RGBA_ASTC_6x5_Format",()=>37811,"RGBA_ASTC_6x6_Format",()=>37812,"RGBA_ASTC_8x5_Format",()=>37813,"RGBA_ASTC_8x6_Format",()=>37814,"RGBA_ASTC_8x8_Format",()=>37815,"RGBA_BPTC_Format",()=>36492,"RGBA_ETC2_EAC_Format",()=>37496,"RGBA_PVRTC_2BPPV1_Format",()=>35843,"RGBA_PVRTC_4BPPV1_Format",()=>35842,"RGBA_S3TC_DXT1_Format",()=>33777,"RGBA_S3TC_DXT3_Format",()=>33778,"RGBA_S3TC_DXT5_Format",()=>33779,"RGBDepthPacking",()=>3202,"RGBFormat",()=>1022,"RGBIntegerFormat",()=>1032,"RGB_BPTC_SIGNED_Format",()=>36494,"RGB_BPTC_UNSIGNED_Format",()=>36495,"RGB_ETC1_Format",()=>36196,"RGB_ETC2_Format",()=>37492,"RGB_PVRTC_2BPPV1_Format",()=>35841,"RGB_PVRTC_4BPPV1_Format",()=>35840,"RGB_S3TC_DXT1_Format",()=>33776,"RGDepthPacking",()=>3203,"RGFormat",()=>1030,"RGIntegerFormat",()=>1031,"RawShaderMaterial",()=>aI,"Ray",()=>rq,"Raycaster",()=>oC,"RectAreaLight",()=>sD,"RedFormat",()=>1028,"RedIntegerFormat",()=>1029,"ReinhardToneMapping",()=>2,"RenderTarget",()=>eV,"RenderTarget3D",()=>ox,"RepeatWrapping",()=>1e3,"ReplaceStencilOp",()=>7681,"ReverseSubtractEquation",()=>102,"ReversedDepthFuncs",()=>el,"RingGeometry",()=>av,"SIGNED_R11_EAC_Format",()=>37489,"SIGNED_RED_GREEN_RGTC2_Format",()=>36286,"SIGNED_RED_RGTC1_Format",()=>36284,"SIGNED_RG11_EAC_Format",()=>37491,"SRGBColorSpace",()=>O,"SRGBTransfer",()=>V,"Scene",()=>tS,"ShaderMaterial",()=>aB,"ShadowMaterial",()=>aC,"Shape",()=>n0,"ShapeGeometry",()=>ay,"ShapePath",()=>ll,"ShapeUtils",()=>al,"ShortType",()=>1011,"Skeleton",()=>ip,"SkeletonHelper",()=>oJ,"SkinnedMesh",()=>il,"Source",()=>eF,"Sphere",()=>rl,"SphereGeometry",()=>a_,"Spherical",()=>oL,"SphericalHarmonics3",()=>sU,"SplineCurve",()=>nK,"SpotLight",()=>sR,"SpotLightHelper",()=>oj,"Sprite",()=>rF,"SpriteMaterial",()=>rS,"SrcAlphaFactor",()=>204,"SrcAlphaSaturateFactor",()=>210,"SrcColorFactor",()=>202,"StaticCopyUsage",()=>35046,"StaticDrawUsage",()=>35044,"StaticReadUsage",()=>35045,"StereoCamera",()=>s0,"StreamCopyUsage",()=>35042,"StreamDrawUsage",()=>35040,"StreamReadUsage",()=>35041,"StringKeyframeTrack",()=>a8,"SubtractEquation",()=>101,"SubtractiveBlending",()=>3,"TOUCH",()=>F,"TangentSpaceNormalMap",()=>0,"TetrahedronGeometry",()=>ax,"Texture",()=>eG,"TextureLoader",()=>sp,"TextureUtils",()=>ld,"Timer",()=>s3,"TimestampQuery",()=>H,"TorusGeometry",()=>ab,"TorusKnotGeometry",()=>aS,"Triangle",()=>tD,"TriangleFanDrawMode",()=>2,"TriangleStripDrawMode",()=>1,"TrianglesDrawMode",()=>0,"TubeGeometry",()=>aT,"UVMapping",()=>300,"Uint16BufferAttribute",()=>re,"Uint32BufferAttribute",()=>rr,"Uint8BufferAttribute",()=>t6,"Uint8ClampedBufferAttribute",()=>t9,"Uniform",()=>ob,"UniformsGroup",()=>oT,"UniformsUtils",()=>aL,"UnsignedByteType",()=>1009,"UnsignedInt101111Type",()=>35899,"UnsignedInt248Type",()=>1020,"UnsignedInt5999Type",()=>35902,"UnsignedIntType",()=>1014,"UnsignedShort4444Type",()=>1017,"UnsignedShort5551Type",()=>1018,"UnsignedShortType",()=>1012,"VSMShadowMap",()=>3,"Vector2",()=>eb,"Vector3",()=>eT,"Vector4",()=>ek,"VectorKeyframeTrack",()=>a6,"VideoFrameTexture",()=>nh,"VideoTexture",()=>nu,"WebGL3DRenderTarget",()=>eX,"WebGLArrayRenderTarget",()=>eW,"WebGLCoordinateSystem",()=>2e3,"WebGLRenderTarget",()=>ez,"WebGPUCoordinateSystem",()=>2001,"WebXRController",()=>tp,"WireframeGeometry",()=>aA,"WrapAroundEnding",()=>2402,"ZeroCurvatureEnding",()=>2400,"ZeroFactor",()=>200,"ZeroSlopeEnding",()=>2401,"ZeroStencilOp",()=>0,"cloneUniforms",()=>aw,"createCanvasElement",()=>Y,"createElementNS",()=>K,"error",()=>ea,"getByteLength",()=>lh,"getConsoleFunction",()=>et,"getUnlitUniformColorSpace",()=>aN,"isTypedArray",()=>J,"log",()=>er,"mergeUniforms",()=>aR,"probeAsync",()=>eo,"setConsoleFunction",()=>ee,"warn",()=>en,"warnOnce",()=>es],30611);let lf={alphahash_fragment:"#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n #ifdef ALPHA_TO_COVERAGE\n diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n if ( diffuseColor.a < alphaTest ) discard;\n #endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot
1( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n #if ! defined( GL_ANGLE_multi_draw )\n #define gl_DrawID _gl_DrawID\n uniform int _gl_DrawID;\n #endif\n uniform highp sampler2D batchingTexture;\n uniform highp usampler2D batchingIdTexture;\n mat4 getBatchingMatrix( const in float i ) {\n int size = textureSize( batchingTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n float getIndirectIndex( const in int i ) {\n int size = textureSize( batchingIdTexture, 0 ).x;\n int x = i % size;\n int y = i / size;\n return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n }\n#endif\n#ifdef USE_BATCHING_COLOR\n uniform sampler2D batchingColorTexture;\n vec4 getBatchingColor( const in float i ) {\n int size = textureSize( batchingColorTexture, 0 ).x;\n int j = int( i );\n int x = j % size;\n int y = j / size;\n return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );\n }\n#endif",batching_vertex:"#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
1\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec4 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec4( 1.0 );\n#endif\n#ifdef USE_COLOR_ALPHA\n vColor *= color;\n#elif defined( USE_COLOR )\n vColor.rgb *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.rgb *= instanceColor.rgb;\n#endif\n#ifdef USE_BATCHING_COLOR\n vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );
1\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n emissiveColor = sRGBTransferEOTF( emissiveColor );\n #endif\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n 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 );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n 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 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );
1\n reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n }
1 else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid 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 ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }
1\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid 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 ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid 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 ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid 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 ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid 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 ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = vec3( 0.04 );\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;
1\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n vec3 iridescenceFresnelDielectric;\n vec3 iridescenceFresnelMetallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n 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 ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alph
1aB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return v;\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x >
1 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid 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 ) {\n#else\nvoid 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 ) {\n#endif\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
1\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n float Ess_V = dfgV.x + dfgV.y;\n float Ess_L = dfgL.x + dfgL.y;\n float Ems_V = 1.0 - Ess_V;\n float Ems_L = 1.0 - Ess_L;\n vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n float compensationFactor = Ems_V * Ems_L;\n vec3 multiScatter = Fms * compensationFactor;\n return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n 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 ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n #ifdef USE_CLEARCOAT\n vec3 Ncc = geometryClearcoatNormal;\n vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n mat3 mInvClearcoat = mat3(\n vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n vec3( 0, 1, 0 ),\n vec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n );\n vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n #endif\n }\n#endif\nvoid 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 ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid 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 ) {\n vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\n}\nvoid 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) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );
1\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }
1\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n #if defined( LAMBERT ) || defined( PHONG )\n irradiance += iblIrradiance;\n #endif\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );
1\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n if( v <= 0.0 )\n return vec4( 0., 0., 0., 0. );\n if( v >= 1.0 )\n return vec4( 1., 1., 1., 1. );\n float vuf;\n float af = modf( v * PackFactors.a, vuf );\n float bf = modf( vuf * ShiftRight8, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n if( v <= 0.0 )\n return vec3( 0., 0., 0. );\n if( v >= 1.0 )\n return vec3( 1., 1., 1. );\n float vuf;\n float bf = modf( v * PackFactors.b, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n if( v <= 0.0 )\n return vec2( 0., 0. );\n if( v >= 1.0 )\n return vec2( 1., 1. );\n float vuf;\n float gf = modf( v * 256., vuf );\n return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 25
15.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n #ifdef USE_REVERSED_DEPTH_BUFFER\n \n return depth * ( far - near ) - far;\n #else\n return depth * ( near - far ) - near;\n #endif\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n \n #ifdef USE_REVERSED_DEPTH_BUFFER\n return ( near * far ) / ( ( near - far ) * depth - near );\n #else\n return ( near * far ) / ( ( far - near ) * depth - far );\n #endif\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #else\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #else\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #elif defined( SHADOWMAP_TYPE_BASIC )\n uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float interleavedGradientNoise( vec2 position ) {\n return fract( 52.9829189 * fract( dot
1( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n }\n vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n const float goldenAngle = 2.399963229728653;\n float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n float theta = float( sampleIndex ) * goldenAngle + phi;\n return vec2( cos( theta ), sin( theta ) ) * r;\n }\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float radius = shadowRadius * texelSize.x;\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n shadow = (\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_VSM )\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadowCoord.z -= shadowBias;\n #else\n shadowCoord.z += shadowBias;\n #endif\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n float mean = distribution.x;\n float variance = distribution.y * distribution.y;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( mean, shadowCoord.z );\n #else\n float hard_shadow = step( shadowCoord.z, mean );\n #endif\n \n if ( hard_shadow == 1.0 ) {\n shadow = 1.0;\n } else {\n variance = max( variance, 0.0000001 );\n float d = shadowCoord.z - mean;\n float p_max = variance / ( variance + d * d );\n p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n shadow = max( hard_shadow, p_max );\n }\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #else\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadowCoord.z -= shadowBias;\n #else\n shadowCoord.z += shadowBias;\n #endif\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, shadowCoord.z );\n #else\n shadow = step( shadowCoord.z, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1\n dp -= shadowBias;\n #else\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n #endif\n float texelSize = shadowRadius / shadowMapSize.x;\n vec3 absDir = abs( bd3D );\n vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n tangent = normalize( cross( bd3D, tangent ) );\n vec3 bitangent = cross( bd3D, tangent );\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n vec2 sample0 = vogelDiskSample( 0, 5, phi );\n vec2 sample1 = vogelDiskSample( 1, 5, phi );\n vec2 sample2 = vogelDiskSample( 2, 5, phi );\n vec2 sample3 = vogelDiskSample( 3, 5, phi );\n vec2 sample4 = vogelDiskSample( 4, 5, phi );\n shadow = (\n texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_BASIC )\n float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n float depth = textureCube( shadowMap, bd3D ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n depth = 1.0 - depth;\n #endif\n shadow = step( dp, depth );\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }
1\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;
1\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );
1\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n #else\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;
1\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
1\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n 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 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <logdepthbuf_fragment>\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n #else\n float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n #endif\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #elif DEPTH_PACKING == 3202\n gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n #elif DEPTH_PACKING == 3203\n gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n #endif\n}",distance_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_verte
1x>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;
1\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n \n outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
1\n #endif\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix[ 3 ];\n vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}"},lm={common:{diffuse:{value:new ty(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new eE},alphaMap:{value:null},alphaMapTransform:{value:new eE},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new eE}},envmap:{envMap:{value:null},envMapRotation:{value:new eE},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 eE}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new eE}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new eE},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new eE},normalScale:{value:new eb(1,1)}}
vendor: 7,706 bytes, line 1
1,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new eE},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new eE}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new eE}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new eE}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ty(0xffffff)}},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 ty(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new eE},alphaTest:{value:0},uvTransform:{value:new eE}},sprite:{diffuse:{value:new ty(0xffffff)},opacity:{value:1},center:{value:new eb(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new eE},alphaMap:{value:null},alphaMapTransform:{value:new eE},alphaTest:{value:0}}},lg={basic:{uniforms:aR([lm.common,lm.specularmap,lm.envmap,lm.aomap,lm.lightmap,lm.fog]),vertexShader:lf.meshbasic_vert,fragmentShader:lf.meshbasic_frag},lambert:{uniforms:aR([lm.common,lm.specularmap,lm.envmap,lm.aomap,lm.lightmap,lm.emissivemap,lm.bumpmap,lm.normalmap,lm.displacementmap,lm.fog,lm.lights,{emissive:{value:new ty(0)},envMapIntensity:{value:1}}]),vertexShader:lf.meshlambert_vert,fragmentShader:lf.meshlambert_frag},phong:{uniforms:aR([lm.common,lm.specularmap,lm.envmap,lm.aomap,lm.lightmap,lm.emissivemap,lm.bumpmap,lm.normalmap,lm.displacementmap,lm.fog,lm.lights,{emissive:{value:new ty(0)},specular:{value:new ty(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:lf.meshphong_vert,fragmentShader:lf.meshphong_frag},standard:{uniforms:aR([lm.common,lm.envmap,lm.aomap,lm.lightmap,lm.emissivemap,lm.bumpmap,lm.normalmap,lm.displacementmap,lm.roughnessmap,lm.metalnessmap,lm.fog,lm.lights,{emissive:{value:new ty(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:lf.meshphysical_vert,fragmentShader:lf.meshphysical_frag},toon:{uniforms:aR([lm.common,lm.aomap,lm.lightmap,lm.emissivemap,lm.bumpmap,lm.normalmap,lm.displacementmap,lm.gradientmap,lm.fog,lm.lights,{emissive:{value:new ty(0)}}]),vertexShader:lf.meshtoon_vert,fragmentShader:lf.meshtoon_frag},matcap:{uniforms:aR([lm.common,lm.bumpmap,lm.normalmap,lm.displacementmap,lm.fog,{matcap:{value:null}}]),vertexShader:lf.meshmatcap_vert,fragmentShader:lf.meshmatcap_frag},points:{uniforms:aR([lm.points,lm.fog]),vertexShader:lf.points_vert,fragmentShader:lf.points_frag},dashed:{uniforms:aR([lm.common,lm.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:lf.linedashed_vert,fragmentShader:lf.linedashed_frag},depth:{uniforms:aR([lm.common,lm.displacementmap]),vertexShader:lf.depth_vert,fragmentShader:lf.depth_frag},normal:{uniforms:aR([lm.common,lm.bumpmap,lm.normalmap,lm.displacementmap,{opacity:{value:1}}]),vertexShader:lf.meshnormal_vert,fragmentShader:lf.meshnormal_frag},sprite:{uniforms:aR([lm.sprite,lm.fog]),vertexShader:lf.sprite_vert,fragmentShader:lf.sprite_frag},background:{uniforms:{uvTransform:{value:new eE},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:lf.background_vert,fragmentShader:lf.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new eE}},vertexShader:lf.backgroundCube_vert,fragmentShader:lf.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:lf.cube_vert,fragmentShader:lf.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:lf.equirect_vert,fragmentShader:lf.equirect_frag},distance:{uniforms:aR([lm.common,lm.displacementmap,{referencePosition:{value:new eT},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:lf.distance_vert,fragmentShader:lf.distance_frag},shadow:{uniforms:aR([lm.lights,lm.fog,{color:{value:new ty(0)},opacity:{value:1}}]),vertexShader:lf.shadow_vert,fragmentShader:lf.shadow_frag}};lg.physical={uniforms:aR([lg.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new eE},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new eE},clearcoatNormalScale:{value:new eb(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new eE},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new eE},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new eE},sheen:{value:0},sheenColor:{value:new ty(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new eE},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new eE},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new eE},transmissionSamplerSize:{value:new eb},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new eE},attenuationDistance:{value:0},attenuationColor:{value:new ty(0)},specularColor:{value:new ty(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new eE},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new eE},anisotropyVector:{value:new eb},anisotropyMap:{value:null},anisotropyMapTransform:{value:new eE}}]),vertexShader:lf.meshphysical_vert,fragmentShader:lf.meshphysical_frag};let lv={r:0,b:0,g:0},ly=new e3,l_=new eq;function lx(e,t,r,i,n,a){let s,o,l=new ty(0),u=+(!0!==n),h=null,d=0,c=null;function p(e){let r=!0===e.isScene?e.background:null;if(r&&r.isTexture){let i=e.backgroundBlurriness>0;r=t.get(r,i)}return r}function f(t,i){t.getRGB(lv,aN(e)),r.buffers.color.setClear(lv.r,lv.g,lv.b,i,a)}return{getClearColor:function(){return l},setClearColor:function(e,t=1){l.set(e),f(l,u=t)},getClearAlpha:function(){return u},setClearAlpha:function(e){f(l,u=e)},render:function(t){let i=!1,n=p(t);null===n?f(l,u):n&&n.isColor&&(f(n,1),i=!0);let s=e.xr.getEnvironmentBlendMode();"additive"===s?r.buffers.color.setClear(0,0,0,1,a):"alpha-blend"===s&&r.buffers.color.setClear(0,0,0,0,a),(e.autoClear||i)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,r){let n=p(r);n&&(n.isCubeTexture||306===n.mapping)?(void 0===o&&((o=new r8(new nx(1,1,1),new aB({name:"Backgroun
1dCubeMaterial",uniforms:aw(lg.backgroundCube.uniforms),vertexShader:lg.backgroundCube.vertexShader,fragmentShader:lg.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(e,t,r){this.matrixWorld.copyPosition(r.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(o)),ly.copy(r.backgroundRotation),ly.x*=-1,ly.y*=-1,ly.z*=-1,n.isCubeTexture&&!1===n.isRenderTargetTexture&&(ly.y*=-1,ly.z*=-1),o.material.uniforms.envMap.value=n,o.material.uniforms.flipEnvMap.value=n.isCubeTexture&&!1===n.isRenderTargetTexture?-1:1,o.material.uniforms.backgroundBlurriness.value=r.backgroundBlurriness,o.material.uniforms.backgroundIntensity.value=r.backgroundIntensity,o.material.uniforms.backgroundRotation.value.setFromMatrix4(l_.makeRotationFromEuler(ly)),o.material.toneMapped=eN.getTransfer(n.colorSpace)!==V,(h!==n||d!==n.version||c!==e.toneMapping)&&(o.material.needsUpdate=!0,h=n,d=n.version,c=e.toneMapping),o.layers.enableAll(),t.unshift(o,o.geometry,o.material,0,0,null)):n&&n.isTexture&&(void 0===s&&((s=new r8(new ag(2,2),new aB({name:"BackgroundMaterial",uniforms:aw(lg.background.uniforms),vertexShader:lg.background.vertexShader,fragmentShader:lg.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(s)),s.material.uniforms.t2D.value=n,s.material.uniforms.backgroundIntensity.value=r.backgroundIntensity,s.material.toneMapped=eN.getTransfer(n.colorSpace)!==V,!0===n.matrixAutoUpdate&&n.updateMatrix(),s.material.uniforms.uvTransform.value.copy(n.matrix),(h!==n||d!==n.version||c!==e.toneMapping)&&(s.material.needsUpdate=!0,h=n,d=n.version,c=e.toneMapping),s.layers.enableAll(),t.unshift(s,s.geometry,s.material,0,0,null))},dispose:function(){void 0!==o&&(o.geometry.dispose(),o.material.dispose(),o=void 0),void 0!==s&&(s.geometry.dispose(),s.material.dispose(),s=void 0)}}}function lb(e,t){let r=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},n=u(null),a=n,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function u(e){let t=[],i=[],n=[];for(let e=0;e<r;e++)t[e]=0,i[e]=0,n[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:i,attributeDivisors:n,object:e,attributes:{},index:null}}function h(){let e=a.newAttributes;for(let t=0,r=e.length;t<r;t++)e[t]=0}function d(e){c(e,0)}function c(t,r){let i=a.newAttributes,n=a.enabledAttributes,s=a.attributeDivisors;i[t]=1,0===n[t]&&(e.enableVertexAttribArray(t),n[t]=1),s[t]!==r&&(e.vertexAttribDivisor(t,r),s[t]=r)}function p(){let t=a.newAttributes,r=a.enabledAttributes;for(let i=0,n=r.length;i<n;i++)r[i]!==t[i]&&(e.disableVertexAttribArray(i),r[i]=0)}function f(t,r,i,n,a,s,o){!0===o?e.vertexAttribIPointer(t,r,i,a,s):e.vertexAttribPointer(t,r,i,n,a,s)}function m(){g(),s=!0,a!==n&&o((a=n).object)}function g(){n.geometry=null,n.program=null,n.wireframe=!1}return{setup:function(r,n,l,m,g){var v,y,_;let x,b,S,T,A,M,E=!1,C=(v=r,y=m,_=l,x=!0===n.wireframe,void 0===(b=i[y.id])&&(b={},i[y.id]=b),void 0===(T=b[S=!0===v.isInstancedMesh?v.id:0])&&(T={},b[S]=T),void 0===(A=T[_.id])&&(A={},T[_.id]=A),void 0===(M=A[x])&&(M=u(e.createVertexArray()),A[x]=M),M);a!==C&&o((a=C).object),(E=function(e,t,r,i){let n=a.attributes,s=t.attributes,o=0,l=r.getAttributes();for(let t in l)if(l[t].location>=0){let r=n[t],i=s[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===r||r.attribute!==i||i&&r.data!==i.data)return!0;o++}return a.attributesNum!==o||a.index!==i}(r,m,l,g))&&function(e,t,r,i){let n={},s=t.attributes,o=0,l=r.getAttributes();for(let t in l)if(l[t].location>=0){let r=s[t];void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor));let i={};i.attribute=r,r&&r.data&&(i.data=r.data),n[t]=i,o++}a.attributes=n,a.attributesNum=o,a.index=i}(r,m,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(E||s)&&(s=!1,function(r,i,n,a){h();let s=a.attributes,o=n.getAttributes(),l=i.defaultAttributeValues;for(let i in o){let n=o[i];if(n.location>=0){let o=s[i];if(void 0===o&&("instanceMatrix"===i&&r.instanceMatrix&&(o=r.instanceMatrix),"instanceColor"===i&&r.instanceColor&&(o=r.instanceColor)),void 0!==o){let i=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;let u=l.buffer,h=l.type,p=l.bytesPerElement,m=h===e.INT||h===e.UNSIGNED_INT||1013===o.gpuType;if(o.isInterleavedBufferAttribute){let t=o.data,l=t.stride,g=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<n.locationSize;e++)c(n.location+e,t.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<n.locationSize;e++)d(n.location+e);e.bindBuffer(e.ARRAY_BUFFER,u);for(let e=0;e<n.locationSize;e++)f(n.location+e,s/n.locationSize,h,i,l*p,(g+s/n.locationSize*e)*p,m)}else{if(o.isInstancedBufferAttribute){for(let e=0;e<n.locationSize;e++)c(n.location+e,o.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)}
vendor: 1,943 bytes, line 1
1else for(let e=0;e<n.locationSize;e++)d(n.location+e);e.bindBuffer(e.ARRAY_BUFFER,u);for(let e=0;e<n.locationSize;e++)f(n.location+e,s/n.locationSize,h,i,s*p,s/n.locationSize*e*p,m)}}else if(void 0!==l){let t=l[i];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(n.location,t);break;case 3:e.vertexAttrib3fv(n.location,t);break;case 4:e.vertexAttrib4fv(n.location,t);break;default:e.vertexAttrib1fv(n.location,t)}}}}p()}(r,n,l,m),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:m,resetDefaultState:g,dispose:function(){for(let e in m(),i){let t=i[e];for(let e in t){let r=t[e];for(let e in r){let t=r[e];for(let e in t)l(t[e].object),delete t[e];delete r[e]}}delete i[e]}},releaseStatesOfGeometry:function(e){if(void 0===i[e.id])return;let t=i[e.id];for(let e in t){let r=t[e];for(let e in r){let t=r[e];for(let e in t)l(t[e].object),delete t[e];delete r[e]}}delete i[e.id]},releaseStatesOfObject:function(e){for(let t in i){let r=i[t],n=!0===e.isInstancedMesh?e.id:0,a=r[n];if(void 0!==a){for(let e in a){let t=a[e];for(let e in t)l(t[e].object),delete t[e];delete a[e]}delete r[n],0===Object.keys(r).length&&delete i[t]}}},releaseStatesOfProgram:function(e){for(let t in i){let r=i[t];for(let t in r){let i=r[t];if(void 0===i[e.id])continue;let n=i[e.id];for(let e in n)l(n[e].object),delete n[e];delete i[e.id]}}},initAttributes:h,enableAttribute:d,disableUnusedAttributes:p}}function lS(e,t,r){let i;function n(t,n,a){0!==a&&(e.drawArraysInstanced(i,t,n,a),r.update(n,i,a))}this.setMode=function(e){i=e},this.render=function(t,n){e.drawArrays(i,t,n),r.update(n,i,1)},this.renderInstances=n,this.renderMultiDraw=function(e,n,a){if(0===a)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,e,0,n,0,a);let s=0;for(let e=0;e<a;e++)s+=n[e];r.update(s,i,1)},this.renderMultiDrawInstances=function(e,a,s,o){if(0===s)return;let l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)n(e[t],a[t],o[t]);
1else{l.multiDrawArraysInstancedWEBGL(i,e,0,a,0,o,0,s);let t=0;for(let e=0;e<s;e++)t+=a[e]*o[e];r.update(t,i,1)}}}function lT(e,t,r,i){let n;function a(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==r.precision?r.precision:"highp",o=a(s);return o!==s&&(en("WebGLRenderer:",s,"not supported, using",o,"instead."),s=o),{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===t.has("EXT_texture_filter_anisotropic")){let r=t.get("EXT_texture_filter_anisotropic");n=e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:a,textureFormatReadable:function(t){return 1023===t||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(r){let n=1016===r&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return 1009===r||i.convert(r)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||1015===r||!!n},precision:s,logarithmicDepthBuffer:!0===r.logarithmicDepthBuffer,reversedDepthBuffer:!0===r.reversedDepthBuffer&&t.has("EXT_clip_control"),maxTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:e.getParameter(e.MAX_SAMPLES),samples:e.getParameter(e.SAMPLES)}}function lA(e){let t=this,r=null,i=0,n=!1,a=!1,s=new iC,o=new eE,l={value:null,needsUpdate:!1};function u(e,r,i,n){let a=null!==e?e.length:0,u=null;if(0!==a){if(u=l.value,!0!==n||null===u){let t=i+4*a,n=r.matrixWorldInverse;o.getNormalMatrix(n),(null===u||u.length<t)&&(u=new Float32Array(t));for(let t=0,r=i;t!==a;++t,r+=4)s.copy(e[t]).applyMatrix4(n,o),s.normal.toArray(u,r),u[r+3]=s.constant}l.value=u,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,u}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let r=0!==e.length||t||0!==i||n;return n=t,i=e.length,r},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){r=u(e,t,0)},this.setState=function(s,o,h){let d=s.clippingPlanes,c=s.clipIntersection,p=s.clipShadows,f=e.get(s);if(n&&null!==d&&0!==d.length&&(!a||p)){let e=a?0:i,t=4*e,n=f.clippingState||null;l.value=n,n=u(d,o,t,h);for(let e=0;e!==t;++e)n[e]=r[e];f.clippingState=n,this.numIntersection=c?this.numPlanes:0,this.numPlanes+=e}else a?u(null):(l.value!==r&&(l.value=r,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0)}}let lM=[.125,.215,.35,.446,.526,.582],lE=new sB,lC=new ty,lw=null,lR=0,lN=0,lL=!1,lB=new eT;class lI{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,r=.1,i=100,n={}){let{size:a=256,position:s=lB}=n;lw=this._renderer.getRenderTarget(),lR=this._renderer.getActiveCubeFace(),lN=this._renderer.getActiveMipmapLevel(),lL=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(e,r,i,o,s),t>0&&this._blur(o,0,0,t),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=lU(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=lD(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(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(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(lw,lR,lN),this._renderer.xr.enabled=lL,e.scissorTest=!1,lF(e,0,0,e.width,e.height)}_fromTexture(e,t){301===e.mapping||302===e.mapping?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),lw=this._renderer.getRenderTarget(),lR=this._renderer.getActiveCubeFace(),lN=this._renderer.getActiveMipmapLevel(),lL=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let r=t||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,r={magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,colorSpace:G,depthBuffer:!1},i=lP(e,t,r);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){var n,a;null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=lP(e,t,r);let{_lodMax:i}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}
1=function(e){let t=[],r=[],i=[],n=e,a=e-4+1+lM.length;for(let s=0;s<a;s++){let a=Math.pow(2,n);t.push(a);let o=1/a;s>e-4?o=lM[s-e+4-1]:0===s&&(o=0),r.push(o);let l=1/(a-2),u=-l,h=1+l,d=[u,u,h,u,h,h,u,u,h,h,u,h],c=new Float32Array(108),p=new Float32Array(72),f=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,r=e>2?0:-1,i=[t,r,0,t+2/3,r,0,t+2/3,r+1,0,t,r,0,t+2/3,r+1,0,t,r+1,0];c.set(i,18*e),p.set(d,12*e);let n=[e,e,e,e,e,e];f.set(n,6*e)}let m=new rg;m.setAttribute("position",new t5(c,3)),m.setAttribute("uv",new t5(p,2)),m.setAttribute("faceIndex",new t5(f,1)),i.push(new r8(m,null)),n>4&&n--}return{lodMeshes:i,sizeLods:t,sigmas:r}}(i)),this._blurMaterial=(n=i,new aB({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(20)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new eT(0,1,0)}},vertexShader:lO(),fragmentShader:` 2 3 precision mediump float; 4 precision mediump int; 5 6 varying vec3 vOutputDirection; 7 8 uniform sampler2D envMap; 9 uniform int samples; 10 uniform float weights[ n ]; 11 uniform bool latitudinal; 12 uniform float dTheta; 13 uniform float mipInt; 14 uniform vec3 poleAxis; 15 16 #define ENVMAP_TYPE_CUBE_UV 17 #include <cube_uv_reflection_fragment> 18 19 vec3 getSample( float theta, vec3 axis ) { 20 21 float cosTheta = cos( theta ); 22 // Rodrigues' axis-angle rotation 23 vec3 sampleDirection = vOutputDirection * cosTheta 24 + cross( axis, vOutputDirection ) * sin( theta ) 25 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 26 27 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 28 29 } 30 31 void main() { 32 33 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 34 35 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 36 37 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 38 39 } 40 41 axis = normalize( axis ); 42 43 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 44 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 45 46 for ( int i = 1; i < n; i++ ) { 47 48 if ( i >= samples ) { 49 50 break; 51 52 } 53 54 float theta = dTheta * float( i ); 55 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 56 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 57 58 } 59 60 } 61 `,blending:0,depthTest:!1,depthWrite:!1})),this._ggxMaterial=(a=i,new aB({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${a}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:lO(),fragmentShader:` 62 63 precision highp float; 64 precision highp int; 65 66 varying vec3 vOutputDirection; 67 68 uniform sampler2D envMap; 69 uniform float roughness; 70 uniform float mipInt; 71 72 #define ENVMAP_TYPE_CUBE_UV 73 #include <cube_uv_reflection_fragment> 74 75 #define PI 3.14159265359 76 77 // Van der Corput radical inverse 78 float radicalInverse_VdC(uint bits) { 79 bits = (bits << 16u) | (bits >> 16u); 80 bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); 81 bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); 82 bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); 83 bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); 84 return float(bits) * 2.3283064365386963e-10; // / 0x100000000 85 } 86 87 // Hammersley sequence 88 vec2 hammersley(uint i, uint N) { 89 return vec2(float(i) / float(N), radicalInverse_VdC(i)); 90 } 91 92 // GGX VNDF importance sampling (Eric Heitz 2018) 93 // "Sampling the GGX Distribution of Visible Normals" 94 // https://jcgt.org/published/0007/04/01/ 95 vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { 96 float alpha = roughness * roughness; 97 98 // Section 4.1: Orthonormal basis 99 vec3 T1 = vec3(1.0, 0.0, 0.0); 100 vec3 T2 = cross(V, T1); 101 102 // Section 4.2: Parameterization of projected area 103 float r = sqrt(Xi.x); 104 float phi = 2.0 * PI * Xi.y; 105 float t1 = r * cos(phi); 106 float t2 = r * sin(phi); 107 float s = 0.5 * (1.0 + V.z); 108 t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; 109 110 // Section 4.3: Reprojection onto hemisphere 111 vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; 112 113 // Section 3.4: Transform back to ellipsoid configuration 114 return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); 115 } 116 117 void main() { 118 vec3 N = normalize(vOutputDirection); 119 vec3 V = N; // Assume view direction equals normal for pre-filtering 120 121 vec3 prefilteredColor = vec3(0.0); 122 float totalWeight = 0.0; 123 124 // For very low roughness, just sample the environment directly 125 if (roughness < 0.001) { 126 gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); 127 return; 128 } 129 130 // Tangent space basis for VNDF sampling 131 vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); 132 vec3 tangent = normalize(cross(up, N)); 133 vec3 bitangent = cross(N, tangent); 134
135 for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { 136 vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); 137 138 // For PMREM, V = N, so in tangent space V is always (0, 0, 1) 139 vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); 140 141 // Transform H back to world space 142 vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); 143 vec3 L = normalize(2.0 * dot(V, H) * H - V); 144 145 float NdotL = max(dot(N, L), 0.0); 146 147 if(NdotL > 0.0) { 148 // Sample environment at fixed mip level 149 // VNDF importance sampling handles the distribution filtering 150 vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); 151 152 // Weight by NdotL for the split-sum approximation 153 // VNDF PDF naturally accounts for the visible microfacet distribution 154 prefilteredColor += sampleColor * NdotL; 155 totalWeight += NdotL; 156 } 157 } 158 159 if (totalWeight > 0.0) { 160 prefilteredColor = prefilteredColor / totalWeight; 161 } 162 163 gl_FragColor = vec4(prefilteredColor, 1.0); 164 } 165 `,blending:0,depthTest:!1,depthWrite:!1}))}return i}_compileMaterial(e){let t=new r8(new rg,e);this._renderer.compile(t,lE)}_sceneToCubeUV(e,t,r,i,n){let a=new sC(90,1,t,r),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,u=l.autoClear,h=l.toneMapping;l.getClearColor(lC),l.toneMapping=0,l.autoClear=!1,l.state.buffers.depth.getReversed()&&(l.setRenderTarget(i),l.clearDepth(),l.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new r8(new nx,new r$({name:"PMREM.Backgroun
165d",side:1,depthWrite:!1,depthTest:!1})));let d=this._backgroundBox,c=d.material,p=!1,f=e.background;f?f.isColor&&(c.color.copy(f),e.background=null,p=!0):(c.color.copy(lC),p=!0);for(let t=0;t<6;t++){let r=t%3;0===r?(a.up.set(0,s[t],0),a.position.set(n.x,n.y,n.z),a.lookAt(n.x+o[t],n.y,n.z)):1===r?(a.up.set(0,0,s[t]),a.position.set(n.x,n.y,n.z),a.lookAt(n.x,n.y+o[t],n.z)):(a.up.set(0,s[t],0),a.position.set(n.x,n.y,n.z),a.lookAt(n.x,n.y,n.z+o[t]));let u=this._cubeSize;lF(i,r*u,t>2?u:0,u,u),l.setRenderTarget(i),p&&l.render(d,a),l.render(e,a)}l.toneMapping=h,l.autoClear=u,e.background=f}_textureToCubeUV(e,t){let r=this._renderer,i=301===e.mapping||302===e.mapping;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=lU()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=lD());let n=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=n,n.uniforms.envMap.value=e;let s=this._cubeSize;lF(t,0,0,3*s,2*s),r.setRenderTarget(t),r.render(a,lE)}_applyPMREM(e){let t=this._renderer,r=t.autoClear;t.autoClear=!1;let i=this._lodMeshes.length;for(let t=1;t<i;t++)this._applyGGXFilter(e,t-1,t);t.autoClear=r}_applyGGXFilter(e,t,r){let i=this._renderer,n=this._pingPongRenderTarget,a=this._ggxMaterial,s=this._lodMeshes[r];s.material=a;let o=a.uniforms,l=r/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),h=Math.sqrt(l*l-u*u),{_lodMax:d}=this,c=this._sizeLods[r],p=3*c*(r>d-4?r-d+4:0),f=4*(this._cubeSize-c);o.envMap.value=e.texture,o.roughness.value=h*(0+1.25*l),o.mipInt.value=d-t,lF(n,p,f,3*c,2*c),i.setRenderTarget(n),i.render(s,lE),o.envMap.value=n.texture,o.roughness.value=0,o.mipInt.value=d-r,lF(e,p,f,3*c,2*c),i.setRenderTarget(e),i.render(s,lE)}_blur(e,t,r,i,n){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,r,i,"latitudinal",n),this._halfBlur(a,e,r,r,i,"longitudinal",n)}_halfBlur(e,t,r,i,n,a,s){let o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&ea("blur direction must be either latitudinal or longitudinal!");let u=this._lodMeshes[i];u.material=l;let h=l.uniforms,d=this._sizeLods[r]-1,c=isFinite(n)?Math.PI/(2*d):2*Math.PI/39,p=n/c,f=isFinite(n)?1+Math.floor(3*p):20;f>20&&en(`sigmaRadians, ${n}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);let m=[],g=0;for(let e=0;e<20;++e){let t=e/p,r=Math.exp(-t*t/2);m.push(r),0===e?g+=r:e<f&&(g+=2*r)}for(let e=0;e<m.length;e++)m[e]=m[e]/g;h.envMap.value=e.texture,h.samples.value=f,h.weights.value=m,h.latitudinal.value="latitudinal"===a,s&&(h.poleAxis.value=s);let{_lodMax:v}=this;h.dTheta.value=c,h.mipInt.value=v-r;let y=this._sizeLods[i],_=4*(this._cubeSize-y);lF(t,3*y*(i>v-4?i-v+4:0),_,3*y,2*y),o.setRenderTarget(t),o.render(u,lE)}}function lP(e,t,r){let i=new ez(e,t,r);return i.texture.mapping=306,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function lF(e,t,r,i,n){e.viewport.set(t,r,i,n),e.scissor.set(t,r,i,n)}function lD(){return new aB({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:lO(),fragmentShader:` 166 167 precision mediump float; 168 precision mediump int; 169 170 varying vec3 vOutputDirection; 171 172 uniform sampler2D envMap; 173 174 #include <common> 175 176 void main() { 177 178 vec3 outputDirection = normalize( vOutputDirection ); 179 vec2 uv = equirectUv( outputDirection ); 180 181 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 182 183 } 184 `,blending:0,depthTest:!1,depthWrite:!1})}function lU(){return new aB({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:lO(),fragmentShader:` 185 186 precision mediump float; 187 precision mediump int; 188 189 uniform float flipEnvMap; 190 191 varying vec3 vOutputDirection; 192 193 uniform samplerCube envMap; 194 195 void main() { 196 197 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 198 199 } 200 `,blending:0,depthTest:!1,depthWrite:!1})}function lO(){return` 201 202 precision mediump float; 203 precision mediump int; 204 205 attribute float faceIndex; 206 207 varying vec3 vOutputDirection; 208 209 // RH coordinate system; PMREM face-indexing convention 210 vec3 getDirection( vec2 uv, float face ) { 211 212 uv = 2.0 * uv - 1.0; 213 214 vec3 direction = vec3( uv, 1.0 ); 215 216 if ( face == 0.0 ) { 217 218 direction = direction.zyx; // ( 1, v, u ) pos x 219 220 } else if ( face == 1.0 ) { 221 222 direction = direction.xzy; 223 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 224 225 } else if ( face == 2.0 ) { 226 227 direction.x *= -1.0; // ( -u, v, 1 ) pos z 228 229 } else if ( face == 3.0 ) { 230 231 direction = direction.zyx; 232 direction.xz *= -1.0; // ( -1, v, -u ) neg x 233 234 } else if ( face == 4.0 ) { 235 236 direction = direction.xzy; 237 direction.xy *= -1.0; // ( -u, -1, v ) neg y 238 239 } else if ( face == 5.0 ) { 240 241 direction.z *= -1.0; // ( u, v, -1 ) neg z 242 243 } 244 245 return direction; 246 247 } 248 249 void main() { 250 251 vOutputDirection = getDirection( uv, faceIndex ); 252 gl_Position = vec4( position, 1.0 ); 253 254 } 255 `}class lG extends ez{constructor(e=1,t={}
255){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1};this.texture=new nm([r,r,r,r,r,r]),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let r={uniforms:{tEquirect:{value:null}},vertexShader:` 256 257 varying vec3 vWorldDirection; 258 259 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 260 261 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 262 263 } 264 265 void main() { 266 267 vWorldDirection = transformDirection( position, modelMatrix ); 268 269 #include <begin_vertex> 270 #include <project_vertex> 271 272 } 273 `,fragmentShader:` 274 275 uniform sampler2D tEquirect; 276 277 varying vec3 vWorldDirection; 278 279 #include <common> 280 281 void main() { 282 283 vec3 direction = normalize( vWorldDirection ); 284 285 vec2 sampleUV = equirectUv( direction ); 286 287 gl_FragColor = texture2D( tEquirect, sampleUV ); 288 289 } 290 `},i=new nx(5,5,5),n=new aB({name:"CubemapFromEquirect",uniforms:aw(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:1,blending:0});n.uniforms.tEquirect.value=t;let a=new r8(i,n),s=t.minFilter;return 1008===t.minFilter&&(t.minFilter=1006),new s1(1,10,this).update(e,a),t.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,r=!0,i=!0){let n=e.getRenderTarget();for(let n=0;n<6;n++)e.setRenderTarget(this,n),e.clear(t,r,i);e.setRenderTarget(n)}}function lk(e){let t=new WeakMap,r=new WeakMap,i=null;function n(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function a(e){let r=e.target;r.removeEventListener("dispose",a);let i=t.get(r);void 0!==i&&(t.delete(r),i.dispose())}function s(e){let t=e.target;t.removeEventListener("dispose",s);let i=r.get(t);void 0!==i&&(r.delete(t),i.dispose())}return{get:function(o,l=!1){return null==o?null:l?function(t){if(t&&t.isTexture){let n=t.mapping,a=303===n||304===n,o=301===n||302===n;if(a||o){let n=r.get(t),l=void 0!==n?n.texture.pmremVersion:0;if(t.isRenderTargetTexture&&t.pmremVersion!==l)return null===i&&(i=new lI(e)),(n=a?i.fromEquirectangular(t,n):i.fromCubemap(t,n)).texture.pmremVersion=t.pmremVersion,r.set(t,n),n.texture;{if(void 0!==n)return n.texture;let l=t.image;return a&&l&&l.height>0||o&&l&&function(e){let t=0;for(let r=0;r<6;r++)void 0!==e[r]&&t++;return 6===t}(l)?(null===i&&(i=new lI(e)),(n=a?i.fromEquirectangular(t):i.fromCubemap(t)).texture.pmremVersion=t.pmremVersion,r.set(t,n),t.addEventListener("dispose",s),n.texture):null}}}return t}(o):function(r){if(r&&r.isTexture){let i=r.mapping;if(303===i||304===i)if(t.has(r))return n(t.get(r).texture,r.mapping);else{let i=r.image;if(!i||!(i.height>0))return null;{let s=new lG(i.height);return s.fromEquirectangularTexture(e,r),t.set(r,s),r.addEventListener("dispose",a),n(s.texture,r.mapping)}}}return r}(o)},dispose:function(){t=new WeakMap,r=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function lV(e){let t={};function r(r){if(void 0!==t[r])return t[r];let i=e.getExtension(r);return t[r]=i,i}return{has:function(e){return null!==r(e)},init:function(){r("EXT_color_buffer_float"),r("WEBGL_clip_cull_distance"),r("OES_texture_float_linear"),r("EXT_color_buffer_half_float"),r("WEBGL_multisampled_render_to_texture"),r("WEBGL_render_shared_exponent")},get:function(e){let t=r(e);return null===t&&es("WebGLRenderer: "+e+" extension not supported."),t}}}function lz(e,t,r,i){let n={},a=new WeakMap;function s(e){let o=e.target;for(let e in null!==o.index&&t.remove(o.index),o.attributes)t.remove(o.attributes[e]);o.removeEventListener("dispose",s),delete n[o.id];let l=a.get(o);l&&(t.remove(l),a.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,r.memory.geometries--}function o(e){let r=[],i=e.index,n=e.attributes.position,s=0;if(void 0===n)return;if(null!==i){let e=i.array;s=i.version;for(let t=0,i=e.length;t<i;t+=3){let i=e[t+0],n=e[t+1],a=e[t+2];r.push(i,n,n,a,a,i)}}else{let e=n.array;s=n.version;for(let t=0,i=e.length/3-1;t<i;
290t+=3){let e=t+0,i=t+1,n=t+2;r.push(e,i,i,n,n,e)}}let o=new(n.count>=65535?rr:re)(r,1);o.version=s;let l=a.get(e);l&&t.remove(l),a.set(e,o)}return{get:function(e,t){return!0===n[t.id]||(t.addEventListener("dispose",s),n[t.id]=!0,r.memory.geometries++),t},update:function(r){let i=r.attributes;for(let r in i)t.update(i[r],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){let t=a.get(e);if(t){let r=e.index;null!==r&&t.version<r.version&&o(e)}else o(e);return a.get(e)}}}function lH(e,t,r){let i,n,a;function s(t,s,o){0!==o&&(e.drawElementsInstanced(i,s,n,t*a,o),r.update(s,i,o))}this.setMode=function(e){i=e},this.setIndex=function(e){n=e.type,a=e.bytesPerElement},this.render=function(t,s){e.drawElements(i,s,n,t*a),r.update(s,i,1)},this.renderInstances=s,this.renderMultiDraw=function(e,a,s){if(0===s)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,a,0,n,e,0,s);let o=0;for(let e=0;e<s;e++)o+=a[e];r.update(o,i,1)},this.renderMultiDrawInstances=function(e,o,l,u){if(0===l)return;let h=t.get("WEBGL_multi_draw");if(null===h)for(let t=0;t<e.length;t++)s(e[t]/a,o[t],u[t]);else{h.multiDrawElementsInstancedWEBGL(i,o,0,n,e,0,u,0,l);let t=0;for(let e=0;e<l;e++)t+=o[e]*u[e];r.update(t,i,1)}}}function lW(e){let t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(r,i,n){switch(t.calls++,i){case e.TRIANGLES:t.triangles+=r/3*n;break;case e.LINES:t.lines+=r/2*n;break;case e.LINE_STRIP:t.lines+=n*(r-1);break;case e.LINE_LOOP:t.lines+=n*r;break;case e.POINTS:t.points+=n*r;break;default:ea("WebGLInfo: Unknown draw mode:",i)}}}}function lj(e,t,r){let i=new WeakMap,n=new ek;return{update:function(a,s,o){let l=a.morphTargetInfluences,u=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,h=void 0!==u?u.length:0,d=i.get(s);if(void 0===d||d.count!==h){void 0!==d&&d.texture.dispose();let e=void 0!==s.morphAttributes.position,r=void 0!==s.morphAttributes.normal,a=void 0!==s.morphAttributes.color,o=s.morphAttributes.position||[],l=s.morphAttributes.normal||[],u=s.morphAttributes.color||[],c=0;!0===e&&(c=1),!0===r&&(c=2),!0===a&&(c=3);let p=s.attributes.position.count*c,f=1;p>t.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let m=new Float32Array(p*f*4*h),g=new eH(m,p,f,h);g.type=1015,g.needsUpdate=!0;let v=4*c;for(let t=0;t<h;t++){let i=o[t],s=l[t],h=u[t],d=p*f*4*t;for(let t=0;t<i.count;t++){let o=t*v;!0===e&&(n.fromBufferAttribute(i,t),m[d+o+0]=n.x,m[d+o+1]=n.y,m[d+o+2]=n.z,m[d+o+3]=0),!0===r&&(n.fromBufferAttribute(s,t),m[d+o+4]=n.x,m[d+o+5]=n.y,m[d+o+6]=n.z,m[d+o+7]=0),!0===a&&(n.fromBufferAttribute(h,t),m[d+o+8]=n.x,m[d+o+9]=n.y,m[d+o+10]=n.z,m[d+o+11]=4===h.itemSize?n.w:1)}}d={count:h,texture:g,size:new eb(p,f)},i.set(s,d),s.addEventListener("dispose",function e(){g.dispose(),i.delete(s),s.removeEventListener("dispose",e)})}if(!0===a.isInstancedMesh&&null!==a.morphTexture)o.getUniforms().setValue(e,"morphTexture",a.morphTexture,r);else{let t=0;for(let e=0;e<l.length;e++)t+=l[e];let r=s.morphTargetsRelative?1:1-t;o.getUniforms().setValue(e,"morphTargetBaseInfluence",r),o.getUniforms().setValue(e,"morphTargetInfluences",l)}o.getUniforms().setValue(e,"morphTargetsTexture",d.texture,r),o.getUniforms().setValue(e,"morphTargetsTextureSize",d.size)}}}function lX(e,t,r,i,n){let a=new WeakMap;function s(e){let t=e.target;t.removeEventListener("dispose",s),i.releaseStatesOfObject(t),r.remove(t.instanceMatrix),null!==t.instanceColor&&r.remove(t.instanceColor)}return{update:function(i){let o=n.render.frame,l=i.geometry,u=t.get(i,l);if(a.get(u)!==o&&(t.update(u),a.set(u,o)),i.isInstancedMesh&&(!1===i.hasEventListener("dispose",s)&&i.addEventListener("dispose",s),a.get(i)!==o&&(r.update(i.instanceMatrix,e.ARRAY_BUFFER),null!==i.instanceColor&&r.update(i.instanceColor,e.ARRAY_BUFFER),a.set(i,o))),i.isSkinnedMesh){let e=i.skeleton;a.get(e)!==o&&(e.update(),a.set(e,o))}return u},dispose:function(){a=new WeakMap}}}
vendor: 8,086 bytes, lines 290-336
290let lq={1:"LINEAR_TONE_MAPPING",2:"REINHARD_TONE_MAPPING",3:"CINEON_TONE_MAPPING",4:"ACES_FILMIC_TONE_MAPPING",6:"AGX_TONE_MAPPING",7:"NEUTRAL_TONE_MAPPING",5:"CUSTOM_TONE_MAPPING"};function l$(e,t,r,i,n){let a,s=new ez(t,r,{type:e,depthBuffer:i,stencilBuffer:n}),o=new ez(t,r,{type:1016,depthBuffer:!1,stencilBuffer:!1}),l=new rg;l.setAttribute("position",new rn([-1,3,0,-1,-1,0,3,-1,0],3)),l.setAttribute("uv",new rn([0,2,0,0,2,0],2));let u=new aI({uniforms:{tDiffuse:{value:null}},vertexShader:` 291 precision highp float; 292 293 uniform mat4 modelViewMatrix; 294 uniform mat4 projectionMatrix; 295 296 attribute vec3 position; 297 attribute vec2 uv; 298 299 varying vec2 vUv; 300 301 void main() { 302 vUv = uv; 303 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 304 }`,fragmentShader:` 305 precision highp float; 306 307 uniform sampler2D tDiffuse; 308 309 varying vec2 vUv; 310 311 #include <tonemapping_pars_fragment> 312 #include <colorspace_pars_fragment> 313 314 void main() { 315 gl_FragColor = texture2D( tDiffuse, vUv ); 316 317 #ifdef LINEAR_TONE_MAPPING 318 gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); 319 #elif defined( REINHARD_TONE_MAPPING ) 320 gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); 321 #elif defined( CINEON_TONE_MAPPING ) 322 gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); 323 #elif defined( ACES_FILMIC_TONE_MAPPING ) 324 gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); 325 #elif defined( AGX_TONE_MAPPING ) 326 gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); 327 #elif defined( NEUTRAL_TONE_MAPPING ) 328 gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); 329 #elif defined( CUSTOM_TONE_MAPPING ) 330 gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); 331 #endif 332 333 #ifdef SRGB_TRANSFER 334 gl_FragColor = sRGBTransferOETF( gl_FragColor ); 335 #endif 336 }`,depthTest:!1,depthWrite:!1}),h=new r8(l,u),d=new sB(-1,1,1,-1,0,1),c=null,p=null,f=!1,m=null,g=[],v=!1;this.setSize=function(e,t){s.setSize(e,t),o.setSize(e,t);for(let r=0;r<g.length;r++){let i=g[r];i.setSize&&i.setSize(e,t)}},this.setEffects=function(e){v=(g=e).length>0&&!0===g[0].isRenderPass;let t=s.width,r=s.height;for(let e=0;e<g.length;e++){let i=g[e];i.setSize&&i.setSize(t,r)}},this.begin=function(e,t){if(f||0===e.toneMapping&&0===g.length)return!1;if(m=t,null!==t){let e=t.width,r=t.height;(s.width!==e||s.height!==r)&&this.setSize(e,r)}return!1===v&&e.setRenderTarget(s),a=e.toneMapping,e.toneMapping=0,!0},this.hasRenderPass=function(){return v},this.end=function(e,t){e.toneMapping=a,f=!0;let r=s,i=o;for(let n=0;n<g.length;n++){let a=g[n];if(!1!==a.enabled&&(a.render(e,i,r,t),!1!==a.needsSwap)){let e=r;r=i,i=e}}if(c!==e.outputColorSpace||p!==e.toneMapping){c=e.outputColorSpace,p=e.toneMapping,u.defines={},eN.getTransfer(c)===V&&(u.defines.SRGB_TRANSFER="");let t=lq[p];t&&(u.defines[t]=""),u.needsUpdate=!0}u.uniforms.tDiffuse.value=r.texture,e.setRenderTarget(m),e.render(h,d),m=null,f=!1},this.isCompositing=function(){return f},this.dispose=function(){s.dispose(),o.dispose(),l.dispose(),u.dispose()}}let lJ=new eG,lK=new nv(1,1),lY=new eH,lQ=new ej,lZ=new nm,l0=[],l1=[],l2=new Float32Array(16),l3=new Float32Array(9),l4=new Float32Array(4);function l5(e,t,r){let i=e[0];if(i<=0||i>0)return e;let n=t*r,a=l0[n];if(void 0===a&&(a=new Float32Array(n),l0[n]=a),0!==t){i.toArray(a,0);for(let i=1,n=0;i!==t;++i)n+=r,e[i].toArray(a,n)}return a}function l8(e,t){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(e[r]!==t[r])return!1;return!0}function l6(e,t){for(let r=0,i=t.length;r<i;r++)e[r]=t[r]}function l9(e,t){let r=l1[t];void 0===r&&(r=new Int32Array(t),l1[t]=r);for(let i=0;i!==t;++i)r[i]=e.allocateTextureUnit();return r}function l7(e,t){let r=this.cache;r[0]!==t&&(e.uniform1f(this.addr,t),r[0]=t)}function ue(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(l8(r,t))return;e.uniform2fv(this.addr,t),l6(r,t)}}function ut(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else if(void 0!==t.r)(r[0]!==t.r||r[1]!==t.g||r[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),r[0]=t.r,r[1]=t.g,r[2]=t.b);else{if(l8(r,t))return;e.uniform3fv(this.addr,t),l6(r,t)}}function ur(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z||r[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(l8(r,t))return;e.uniform4fv(this.addr,t),l6(r,t)}}function ui(e,t){let r=this.cache,i=t.elements;if(void 0===i){if(l8(r,t))return;e.uniformMatrix2fv(this.addr,!1,t),l6(r,t)}else{if(l8(r,i))return;l4.set(i),e.uniformMatrix2fv(this.addr,!1,l4),l6(r,i)}}function un(e,t){let r=this.cache,i=t.elements;if(void 0===i){if(l8(r,t))return;e.uniformMatrix3fv(this.addr,!1,t),l6(r,t)}else{if(l8(r,i))return;l3.set(i),e.uniformMatrix3fv(this.addr,!1,l3),l6(r,i)}}function ua(e,t){let r=this.cache,i=t.elements;if(void 0===i){if(l8(r,t))return;e.uniformMatrix4fv(this.addr,!1,t),l6(r,t)}else{if(l8(r,i))return;l2.set(i),e.uniformMatrix4fv(this.addr,!1,l2),l6(r,i)}}function us(e,t){let r=this.cache;r[0]!==t&&(e.uniform1i(this.addr,t),r[0]=t)}function uo(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(l8(r,t))return;e.uniform2iv(this.addr,t),l6(r,t)}}function ul(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else{if(l8(r,t))return;e.uniform3iv(this.addr,t),l6(r,t)}}function uu(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z||r[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(l8(r,t))return;e.uniform4iv(this.addr,t),l6(r,t)}}function uh(e,t){let r=this.cache;r[0]!==t&&(e.uniform1ui(this.addr,t),r[0]=t)}function ud(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(l8(r,t))return;e.uniform2uiv(this.addr,t),l6(r,t)}}function uc(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else{if(l8(r,t))return;e.uniform3uiv(this.addr,t),l6(r,t)}}function up(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z||r[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(l8(r,t))return;e.uniform4uiv(this.addr,t),l6(r,t)}}function uf(e,t,r){let i,n=this.cache,a=r.allocateTextureUnit();n[0]!==a&&(e.uniform1i(this.addr,a),n[0]=a),this.type===e.SAMPLER_2D_SHADOW?(lK.compareFunction=r.isReversedDepthBuffer()?518:515,i=lK):i=lJ,r.setTexture2D(t||i,a)}function um(e,t,r){let i=this.cache,n=r.allocateTextureUnit();i[0]!==n&&(e.uniform1i(this.addr,n),i[0]=n),r.setTexture3D(t||lQ,n)}function ug(e,t,r){let i=this.cache,n=r.allocateTextureUnit();i[0]!==n&&(e.uniform1i(this.addr,n),i[0]=n),r.setTextureCube(t||lZ,n)}function uv(e,t,r){let i=this.cache,n=r.allocateTextureUnit();i[0]!==n&&(e.uniform1i(this.addr,n),i[0]=n),r.setTexture2DArray(t||lY,n)}function uy(e,t){e.uniform1fv(this.addr,t)}function u_(e,t){let r=l5(t,this.size,2);e.uniform2fv(this.addr,r)}function ux(e,t){let r=l5(t,this.size,3);e.uniform3fv(this.addr,r)}function ub(e,t){let r=l5(t,this.size,4);e.uniform4fv(this.addr,r)}function uS(e,t){let r=l5(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,r)}function uT(e,t){let r=l5(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,r)}function uA(e,t){let r=l5(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,r)}function uM(e,t){e.uniform1iv(this.addr,t)}function uE(e,t){e.uniform2iv(this.addr,t)}function uC(e,t){e.uniform3iv(this.addr,t)}function uw(e,t){e.uniform4iv(this.addr,t)}function uR(e,t){e.uniform1uiv(this.addr,t)}function uN(e,t){e.uniform2uiv(this.addr,t)}function uL(e,t){e.uniform3uiv(this.addr,t)}function uB(e,t){e.uniform4uiv(this.addr,t)}function uI(e,t,r){let i,n=this.cache,a=t.length,s=l9(r,a);
336l8(n,s)||(e.uniform1iv(this.addr,s),l6(n,s)),i=this.type===e.SAMPLER_2D_SHADOW?lK:lJ;for(let e=0;e!==a;++e)r.setTexture2D(t[e]||i,s[e])}function uP(e,t,r){let i=this.cache,n=t.length,a=l9(r,n);l8(i,a)||(e.uniform1iv(this.addr,a),l6(i,a));for(let e=0;e!==n;++e)r.setTexture3D(t[e]||lQ,a[e])}function uF(e,t,r){let i=this.cache,n=t.length,a=l9(r,n);l8(i,a)||(e.uniform1iv(this.addr,a),l6(i,a));for(let e=0;e!==n;++e)r.setTextureCube(t[e]||lZ,a[e])}function uD(e,t,r){let i=this.cache,n=t.length,a=l9(r,n);l8(i,a)||(e.uniform1iv(this.addr,a),l6(i,a));for(let e=0;e!==n;++e)r.setTexture2DArray(t[e]||lY,a[e])}class uU{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return l7;case 35664:return ue;case 35665:return ut;case 35666:return ur;case 35674:return ui;case 35675:return un;case 35676:return ua;case 5124:case 35670:return us;case 35667:case 35671:return uo;case 35668:case 35672:return ul;case 35669:case 35673:return uu;case 5125:return uh;case 36294:return ud;case 36295:return uc;case 36296:return up;case 35678:case 36198:case 36298:case 36306:case 35682:return uf;case 35679:case 36299:case 36307:return um;case 35680:case 36300:case 36308:case 36293:return ug;case 36289:case 36303:case 36311:case 36292:return uv}}(t.type)}}class uO{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return uy;case 35664:return u_;case 35665:return ux;case 35666:return ub;case 35674:return uS;case 35675:return uT;case 35676:return uA;case 5124:case 35670:return uM;case 35667:case 35671:return uE;case 35668:case 35672:return uC;case 35669:case 35673:return uw;case 5125:return uR;case 36294:return uN;case 36295:return uL;case 36296:return uB;case 35678:case 36198:case 36298:case 36306:case 35682:return uI;case 35679:case 36299:case 36307:return uP;case 35680:case 36300:case 36308:case 36293:return uF;case 36289:case 36303:case 36311:case 36292:return uD}}(t.type)}}class uG{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,r){let i=this.seq;for(let n=0,a=i.length;n!==a;++n){let a=i[n];a.setValue(e,t[a.id],r)}}}let uk=/(\w+)(\])?(\[|\.)?/g;function uV(e,t){e.seq.push(t),e.map[t.id]=t}class uz{constructor(e,t){this.seq=[],this.map={};const r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<r;++i){const r=e.getActiveUniform(t,i),n=e.getUniformLocation(t,r.name);!function(e,t,r){let i=e.name,n=i.length;for(uk.lastIndex=0;;){let a=uk.exec(i),s=uk.lastIndex,o=a[1],l="]"===a[2],u=a[3];if(l&&(o|=0),void 0===u||"["===u&&s+2===n){uV(r,void 0===u?new uU(o,e,t):new uO(o,e,t));break}{let e=r.map[o];void 0===e&&uV(r,e=new uG(o)),r=e}}}(r,n,this)}const i=[],n=[];for(const t of this.seq)t.type===e.SAMPLER_2D_SHADOW||t.type===e.SAMPLER_CUBE_SHADOW||t.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(t):n.push(t);i.length>0&&(this.seq=i.concat(n))}setValue(e,t,r,i){let n=this.map[t];void 0!==n&&n.setValue(e,r,i)}setOptional(e,t,r){let i=t[r];void 0!==i&&this.setValue(e,r,i)}static upload(e,t,r,i){for(let n=0,a=t.length;n!==a;++n){let a=t[n],s=r[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,i)}}static seqWithValue(e,t){let r=[];for(let i=0,n=e.length;i!==n;++i){let n=e[i];n.id in t&&r.push(n)}return r}}function uH(e,t,r){let i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),i}let uW=0,uj=new eE;function uX(e,t,r){let i=e.getShaderParameter(t,e.COMPILE_STATUS),n=(e.getShaderInfoLog(t)||"").trim();if(i&&""===n)return"";let a=/ERROR: 0:(\d+)/.exec(n);if(!a)return n;{let i=parseInt(a[1]);return r.toUpperCase()+"\n\n"+n+"\n\n"+function(e,t){let r=e.split("\n"),i=[],n=Math.max(t-6,0),a=Math.min(t+6,r.length);for(let e=n;e<a;e++){let n=e+1;i.push(`${n===t?">":" "} ${n}: ${r[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}}let uq={1:"Linear",2:"Reinhard",3:"Cineon",4:"ACESFilmic",6:"AgX",7:"Neutral",5:"Custom"},u$=new eT;function uJ(e){return""!==e}function uK(e,t){let r=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_L
336IGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,r).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function uY(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let uQ=/^[ \t]*#include +<([\w\d./]+)>/gm;function uZ(e){return e.replace(uQ,u1)}let u0=new Map;function u1(e,t){let r=lf[t];if(void 0===r){let e=u0.get(t);if(void 0!==e)r=lf[e],en('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e);else throw Error("Can not resolve #include <"+t+">")}return uZ(r)}let u2=/#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 u3(e){return e.replace(u2,u4)}function u4(e,t,r,i){let n="";for(let e=parseInt(t);e<parseInt(r);e++)n+=i.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return n}function u5(e){let t=`precision ${e.precision} float; 337 precision ${e.precision} int; 338 precision ${e.precision} sampler2D; 339 precision ${e.precision} samplerCube; 340 precision ${e.precision} sampler3D; 341 precision ${e.precision} sampler2DArray; 342 precision ${e.precision} sampler2DShadow; 343 precision ${e.precision} samplerCubeShadow; 344 precision ${e.precision} sampler2DArrayShadow; 345 precision ${e.precision} isampler2D; 346 precision ${e.precision} isampler3D; 347 precision ${e.precision} isamplerCube; 348 precision ${e.precision} isampler2DArray; 349 precision ${e.precision} usampler2D; 350 precision ${e.precision} usampler3D; 351 precision ${e.precision} usamplerCube; 352 precision ${e.precision} usampler2DArray; 353 `;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}let u8={1:"SHADOWMAP_TYPE_PCF",3:"SHADOWMAP_TYPE_VSM"},u6={301:"ENVMAP_TYPE_CUBE",302:"ENVMAP_TYPE_CUBE",306:"ENVMAP_TYPE_CUBE_UV"},u9={302:"ENVMAP_MODE_REFRACTION"},u7={0:"ENVMAP_BLENDING_MULTIPLY",1:"ENVMAP_BLENDING_MIX",2:"ENVMAP_BLENDING_ADD"};function he(e,t,r,i){var n,a;let s,o,l,u,h=e.getContext(),d=r.defines,c=r.vertexShader,p=r.fragmentShader,f=u8[r.shadowMapType]||"SHADOWMAP_TYPE_BASIC",m=!1===r.envMap?"ENVMAP_TYPE_CUBE":u6[r.envMapMode]||"ENVMAP_TYPE_CUBE",g=!1===r.envMap?"ENVMAP_MODE_REFLECTION":u9[r.envMapMode]||"ENVMAP_MODE_REFLECTION",v=!1===r.envMap?"ENVMAP_BLENDING_NONE":u7[r.combine]||"ENVMAP_BLENDING_NONE",y=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let r=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,r),112)),texelHeight:1/t,maxMip:r}}(r),_=[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(uJ).join("\n"),x=function(e){let t=[];for(let r in e){let i=e[r];!1!==i&&t.push("#define "+r+" "+i)}return t.join("\n")}(d),b=h.createProgram(),S=r.glslVersion?"#version "+r.glslVersion+"\n":"";if(r.isRawShaderMaterial)(s=["#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,x].filter(uJ).join("\n")).length>0&&(s+="\n"),(o=["#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,x].filter(uJ).join("\n")).length>0&&(o+="\n");else{let e,t,i,l,u;s=[u5(r),"#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,x,r.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",r.batching?"#define USE_BATCHING":"",r.batchingColor?"#define USE_BATCHING_COLOR":"",r.instancing?"#define USE_INSTANCING":"",r.instancingColor?"#define USE_INSTANCING_COLOR":"",r.instancingMorph?"#define USE_INSTANCING_MORPH":"",r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+g:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",r.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",r.displacementMap?"#define USE_DISPLACEMENTMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.anisotropy?"#define USE_ANISOTROPY":"",r.anisotropyMap?"#define USE_ANISOTROPYMAP":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.iridescenceMap?"#define USE_IR
353IDESCENCEMAP":"",r.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",r.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.alphaHash?"#define USE_ALPHAHASH":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",r.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",r.mapUv?"#define MAP_UV "+r.mapUv:"",r.alphaMapUv?"#define ALPHAMAP_UV "+r.alphaMapUv:"",r.lightMapUv?"#define LIGHTMAP_UV "+r.lightMapUv:"",r.aoMapUv?"#define AOMAP_UV "+r.aoMapUv:"",r.emissiveMapUv?"#define EMISSIVEMAP_UV "+r.emissiveMapUv:"",r.bumpMapUv?"#define BUMPMAP_UV "+r.bumpMapUv:"",r.normalMapUv?"#define NORMALMAP_UV "+r.normalMapUv:"",r.displacementMapUv?"#define DISPLACEMENTMAP_UV "+r.displacementMapUv:"",r.metalnessMapUv?"#define METALNESSMAP_UV "+r.metalnessMapUv:"",r.roughnessMapUv?"#define ROUGHNESSMAP_UV "+r.roughnessMapUv:"",r.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+r.anisotropyMapUv:"",r.clearcoatMapUv?"#define CLEARCOATMAP_UV "+r.clearcoatMapUv:"",r.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+r.clearcoatNormalMapUv:"",r.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+r.clearcoatRoughnessMapUv:"",r.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+r.iridescenceMapUv:"",r.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+r.iridescenceThicknessMapUv:"",r.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+r.sheenColorMapUv:"",r.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+r.sheenRoughnessMapUv:"",r.specularMapUv?"#define SPECULARMAP_UV "+r.specularMapUv:"",r.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+r.specularColorMapUv:"",r.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+r.specularIntensityMapUv:"",r.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+r.transmissionMapUv:"",r.thicknessMapUv?"#define THICKNESSMAP_UV "+r.thicknessMapUv:"",r.vertexTangents&&!1===r.flatShading?"#define USE_TANGENT":"",r.vertexColors?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUv1s?"#define USE_UV1":"",r.vertexUv2s?"#define USE_UV2":"",r.vertexUv3s?"#define USE_UV3":"",r.pointsUvs?"#define USE_POINTS_UV":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&!1===r.flatShading?"#define USE_MORPHNORMALS":"",r.morphColors?"#define USE_MORPHCOLORS":"",r.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+r.morphTextureStride:"",r.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+r.morphTargetsCount:"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+f:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.numLightProbes>0?"#define USE_LIGHT_PROBES":"",r.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",r.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","\n"].filter(uJ).join("\n"),o=[u5(r),"#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,x,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",r.map?"#define USE_MAP":"",r.matcap?"#define USE_MATCAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+m:"",r.envMap?"#define "+g:"",r.envMap?"#define "+v:"",
353y?"#define CUBEUV_TEXEL_WIDTH "+y.texelWidth:"",y?"#define CUBEUV_TEXEL_HEIGHT "+y.texelHeight:"",y?"#define CUBEUV_MAX_MIP "+y.maxMip+".0":"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",r.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.anisotropy?"#define USE_ANISOTROPY":"",r.anisotropyMap?"#define USE_ANISOTROPYMAP":"",r.clearcoat?"#define USE_CLEARCOAT":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.dispersion?"#define USE_DISPERSION":"",r.iridescence?"#define USE_IRIDESCENCE":"",r.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",r.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",r.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.alphaTest?"#define USE_ALPHATEST":"",r.alphaHash?"#define USE_ALPHAHASH":"",r.sheen?"#define USE_SHEEN":"",r.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",r.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.vertexTangents&&!1===r.flatShading?"#define USE_TANGENT":"",r.vertexColors||r.instancingColor?"#define USE_COLOR":"",r.vertexAlphas||r.batchingColor?"#define USE_COLOR_ALPHA":"",r.vertexUv1s?"#define USE_UV1":"",r.vertexUv2s?"#define USE_UV2":"",r.vertexUv3s?"#define USE_UV3":"",r.pointsUvs?"#define USE_POINTS_UV":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+f:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.numLightProbes>0?"#define USE_LIGHT_PROBES":"",r.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",r.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",r.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",r.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==r.toneMapping?"#define TONE_MAPPING":"",0!==r.toneMapping?lf.tonemapping_pars_fragment:"",0!==r.toneMapping?(n="toneMapping",void 0===(e=uq[a=r.toneMapping])?(en("WebGLProgram: Unsupported toneMapping:",a),"vec3 "+n+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+n+"( vec3 color ) { return "+e+"ToneMapping( color ); }"):"",r.dithering?"#define DITHERING":"",r.opaque?"#define OPAQUE":"",lf.colorspace_pars_fragment,(t=function(e){eN._getMatrix(uj,eN.workingColorSpace,e);let t=`mat3( ${uj.elements.map(e=>e.toFixed(4))} )`;switch(eN.getTransfer(e)){case k:return[t,"LinearTransferOETF"];case V:return[t,"sRGBTransferOETF"];default:return en("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(r.outputColorSpace),`vec4 linearToOutputTexel( vec4 value ) { 354 return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) ); 355}`),(eN.getLuminanceCoefficients(u$),i=u$.x.toFixed(4),l=u$.y.toFixed(4),u=u$.z.toFixed(4),`float luminance( const in vec3 rgb ) { 356 const vec3 weights = vec3( ${i}, ${l}, ${u} ); 357 return dot( weights, rgb ); 358}`),r.useDepthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(uJ).join("\n")}c=uY(c=uK(c=uZ(c),r),r),p=uY(p=uK(p=uZ(p),r),r),c=u3(c),p=u3(p),!0!==r.isRawShaderMaterial&&(S="#version 300 es\n",s=[_,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+s,o=["#define varying in",r.glslVersion===z?"":"layout(location = 0) out highp vec4 pc_fragColor;",r.glslVersion===z?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+o);let T=S+s+c,A=S+o+p,M=uH(h,h.VERTEX_SHADER,T),E=uH(h,h.FRAGMENT_SHADER,A);
358function C(t){if(e.debug.checkShaderErrors){let r=h.getProgramInfoLog(b)||"",i=h.getShaderInfoLog(M)||"",n=h.getShaderInfoLog(E)||"",a=r.trim(),l=i.trim(),u=n.trim(),d=!0,c=!0;if(!1===h.getProgramParameter(b,h.LINK_STATUS))if(d=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(h,b,M,E);else{let e=uX(h,M,"vertex"),r=uX(h,E,"fragment");ea("THREE.WebGLProgram: Shader Error "+h.getError()+" - VALIDATE_STATUS "+h.getProgramParameter(b,h.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+a+"\n"+e+"\n"+r)}else""!==a?en("WebGLProgram: Program Info Log:",a):(""===l||""===u)&&(c=!1);c&&(t.diagnostics={runnable:d,programLog:a,vertexShader:{log:l,prefix:s},fragmentShader:{log:u,prefix:o}})}h.deleteShader(M),h.deleteShader(E),l=new uz(h,b),u=function(e,t){let r={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let n=0;n<i;n++){let i=e.getActiveAttrib(t,n),a=i.name,s=1;i.type===e.FLOAT_MAT2&&(s=2),i.type===e.FLOAT_MAT3&&(s=3),i.type===e.FLOAT_MAT4&&(s=4),r[a]={type:i.type,location:e.getAttribLocation(t,a),locationSize:s}}return r}(h,b)}h.attachShader(b,M),h.attachShader(b,E),void 0!==r.index0AttributeName?h.bindAttribLocation(b,0,r.index0AttributeName):!0===r.morphTargets&&h.bindAttribLocation(b,0,"position"),h.linkProgram(b),this.getUniforms=function(){return void 0===l&&C(this),l},this.getAttributes=function(){return void 0===u&&C(this),u};let w=!1===r.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===w&&(w=h.getProgramParameter(b,37297)),w},this.destroy=function(){i.releaseStatesOfProgram(this),h.deleteProgram(b),this.program=void 0},this.type=r.shaderType,this.name=r.shaderName,this.id=uW++,this.cacheKey=t,this.usedTimes=1,this.program=b,this.vertexShader=M,this.fragmentShader=E,this}let ht=0;class hr{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(t),n=this._getShaderStage(r),a=this._getShaderCacheForMaterial(e);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(n)&&(a.add(n),n.usedTimes++),this}remove(e){for(let t of this.materialCache.get(e))t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.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){let t=this.materialCache,r=t.get(e);return void 0===r&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){let t=this.shaderCache,r=t.get(e);return void 0===r&&(r=new hi(e),t.set(e,r)),r}}class hi{constructor(e){this.id=ht++,this.code=e,this.usedTimes=0}}function hn(e,t,r,i,n,a){let s=new e4,o=new hr,l=new Set,u=[],h=new Map,d=i.logarithmicDepthBuffer,c=i.precision,p={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 f(e){return(l.add(e),0===e)?"uv":`uv${e}`}return{getParameters:function(n,s,u,h,m){let g,v,y,_,x=h.fog,b=m.geometry,S=n.isMeshStandardMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial?h.environment:null,T=n.isMeshStandardMaterial||n.isMeshLambertMaterial&&!n.envMap||n.isMeshPhongMaterial&&!n.envMap,A=t.get(n.envMap||S,T),M=A&&306===A.mapping?A.image.height:null,E=p[n.type];null!==n.precision&&(c=i.getMaxPrecision(n.precision))!==n.precision&&en("WebGLProgram.getParameters:",n.precision,"not supported, using",c,"instead.");let C=b.morphAttributes.position||b.morphAttributes.normal||b.morphAttributes.color,w=void 0!==C?C.length:0,R=0;if(void 0!==b.morphAttributes.position&&(R=1),void 0!==b.morphAttributes.normal&&(R=2),void 0!==b.morphAttributes.color&&(R=3),E){let e=lg[E];g=e.vertexShader,v=e.fragmentShader}else g=n.vertexShader,v=n.fragmentShader,o.update(n),y=o.getVertexShaderID(n),_=o.getFragmentShaderID(n);let N=e.getRenderTarget(),L=e.state.buffers.depth.getReversed(),B=!0===m.isInstancedMesh,I=!0===m.isBatchedMesh,P=!!n.map,F=!!n.matcap,D=!!A,U=!!n.aoMap,O=!!n.lightMap,k=!!n.bumpMap,z=!!n.normalMap,H=!!n.displacementMap,W=!!n.emissiveMap,j=!!n.metalnessMap,X=!!n.roughnessMap,q=n.anisotropy>0,$=n.clearcoat>0,J=n.dispersion>0,K=n.iridescence>0,Y=n.sheen>0,Q=n.transmission>0,Z=q&&!!n.anisotropyMap,ee=$&&!!n.clearcoatMap,et=$&&!!n.clearcoatNormalMap,er=$&&!!n.clearcoatRoughnessMap,ei=K&&!!n.iridescenceMap,ea=K&&!!n.iridescenceThicknessMap,es=Y&&!!n.sheenColorMap,eo=Y&&!!n.sheenRoughnessMap,el=!!n.specularMap,eu=!!n.specularColorMap,eh=!!n.specularIntensityMap,ed=Q&&!!n.transmissionMap,ec=Q&&!!n.thicknessMap,ep=!!n.gradientMap,ef=!!n.alphaMap,em=n.alphaTest>0,eg=!!n.alphaHash,ev=!!n.extensions,ey=0;n.toneMapped&&(null===N||!0===N.isXRRenderTarget)&&(ey=e.toneMapping);let e_={shaderID:E,shaderType:n.type,shaderName:n.name,vertexShader:g,fragmentShader:v,defines:n.defines,customVertexShaderID:y,customFragmentShaderID:_,isRawShaderMaterial:!0===n.isRawShaderMaterial,glslVersion:n.glslVersion,precision:c,batching:I,batchingColor:I&&null!==m._colorsTexture,instancing:B,instancingColor:B&&null!==m.instanceColor,
358instancingMorph:B&&null!==m.morphTexture,outputColorSpace:null===N?e.outputColorSpace:!0===N.isXRRenderTarget?N.texture.colorSpace:G,alphaToCoverage:!!n.alphaToCoverage,map:P,matcap:F,envMap:D,envMapMode:D&&A.mapping,envMapCubeUVHeight:M,aoMap:U,lightMap:O,bumpMap:k,normalMap:z,displacementMap:H,emissiveMap:W,normalMapObjectSpace:z&&1===n.normalMapType,normalMapTangentSpace:z&&0===n.normalMapType,metalnessMap:j,roughnessMap:X,anisotropy:q,anisotropyMap:Z,clearcoat:$,clearcoatMap:ee,clearcoatNormalMap:et,clearcoatRoughnessMap:er,dispersion:J,iridescence:K,iridescenceMap:ei,iridescenceThicknessMap:ea,sheen:Y,sheenColorMap:es,sheenRoughnessMap:eo,specularMap:el,specularColorMap:eu,specularIntensityMap:eh,transmission:Q,transmissionMap:ed,thicknessMap:ec,gradientMap:ep,opaque:!1===n.transparent&&1===n.blending&&!1===n.alphaToCoverage,alphaMap:ef,alphaTest:em,alphaHash:eg,combine:n.combine,mapUv:P&&f(n.map.channel),aoMapUv:U&&f(n.aoMap.channel),lightMapUv:O&&f(n.lightMap.channel),bumpMapUv:k&&f(n.bumpMap.channel),normalMapUv:z&&f(n.normalMap.channel),displacementMapUv:H&&f(n.displacementMap.channel),emissiveMapUv:W&&f(n.emissiveMap.channel),metalnessMapUv:j&&f(n.metalnessMap.channel),roughnessMapUv:X&&f(n.roughnessMap.channel),anisotropyMapUv:Z&&f(n.anisotropyMap.channel),clearcoatMapUv:ee&&f(n.clearcoatMap.channel),clearcoatNormalMapUv:et&&f(n.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:er&&f(n.clearcoatRoughnessMap.channel),iridescenceMapUv:ei&&f(n.iridescenceMap.channel),iridescenceThicknessMapUv:ea&&f(n.iridescenceThicknessMap.channel),sheenColorMapUv:es&&f(n.sheenColorMap.channel),sheenRoughnessMapUv:eo&&f(n.sheenRoughnessMap.channel),specularMapUv:el&&f(n.specularMap.channel),specularColorMapUv:eu&&f(n.specularColorMap.channel),specularIntensityMapUv:eh&&f(n.specularIntensityMap.channel),transmissionMapUv:ed&&f(n.transmissionMap.channel),thicknessMapUv:ec&&f(n.thicknessMap.channel),alphaMapUv:ef&&f(n.alphaMap.channel),vertexTangents:!!b.attributes.tangent&&(z||q),vertexColors:n.vertexColors,vertexAlphas:!0===n.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,pointsUvs:!0===m.isPoints&&!!b.attributes.uv&&(P||ef),fog:!!x,useFog:!0===n.fog,fogExp2:!!x&&x.isFogExp2,flatShading:!1===n.wireframe&&(!0===n.flatShading||void 0===b.attributes.normal&&!1===z&&(n.isMeshLambertMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isMeshPhysicalMaterial)),sizeAttenuation:!0===n.sizeAttenuation,logarithmicDepthBuffer:d,reversedDepthBuffer:L,skinning:!0===m.isSkinnedMesh,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:w,morphTextureStride:R,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:n.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:ey,decodeVideoTexture:P&&!0===n.map.isVideoTexture&&eN.getTransfer(n.map.colorSpace)===V,decodeVideoTextureEmissive:W&&!0===n.emissiveMap.isVideoTexture&&eN.getTransfer(n.emissiveMap.colorSpace)===V,premultipliedAlpha:n.premultipliedAlpha,doubleSided:2===n.side,flipSided:1===n.side,useDepthPacking:n.depthPacking>=0,depthPacking:n.depthPacking||0,index0AttributeName:n.index0AttributeName,extensionClipCullDistance:ev&&!0===n.extensions.clipCullDistance&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ev&&!0===n.extensions.multiDraw||I)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:n.customProgramCacheKey()};return e_.vertexUv1s=l.has(1),e_.vertexUv2s=l.has(2),e_.vertexUv3s=l.has(3),l.clear(),e_},getProgramCacheKey:function(t){var r,i,n,a;let o=[];if(t.shaderID?o.push(t.shaderID):(o.push(t.customVertexShaderID),o.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)o.push(e),o.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(r=o,i=t,r.push(i.precision),r.push(i.outputColorSpace),r.push(i.envMapMode),r.push(i.envMapCubeUVHeight),r.push(i.mapUv),r.push(i.alphaMapUv),r.push(i.lightMapUv),r.push(i.aoMapUv),r.push(i.bumpMapUv),r.push(i.normalMapUv),r.push(i.displacementMapUv),r.push(i.emissiveMapUv),r.push(i.metalnessMapUv),r.push(i.roughnessMapUv),r.push(i.anisotropyMapUv),r.push(i.clearcoatMapUv),r.push(i.clearcoatNormalMapUv),r.push(i.clearcoatRoughnessMapUv),r.push(i.iridescenceMapUv),r.push(i.iridescenceThicknessMapUv),r.push(i.sheenColorMapUv),r.push(i.sheenRoughnessMapUv),r.push(i.specularMapUv),r.push(i.specularColorMapUv),r.push(i.specularIntensityMapUv),r.push(i.transmissionMapUv),r.push(i.thicknessMapUv),r.push(i.combine),r.push(i.fogExp2),r.push(i.sizeAttenuation),r.push(i.morphTargetsCount),r.push(i.morphAttributeCount),r.push(i.numDirLights),r.push(i.numPointLights),r.push(i.numSpotLights),r.push(i.numSpotLightMaps),r.push(i.numHemiLights),r.push(i.numRectAreaLights),r.push(i.numDirLightShadows),r.push(i.numPointLightShadows),r.push(i.numSpotLightShadows),r.push(i.numSpotLightShadowsWithMaps),r.push(i.numLightProbes),r.push(i.shadowMapType),r.push(i.toneMapping),r.push(i.numClippingPlanes),r.push(i.numClipIntersection),r.push(i.depthPacking),n=o,a=t,s.disableAll(),a.instancing&&s.enable(0),a.instancingColor&&s.enable(1),a.instancingMorph&&s.enable(2),a.matcap&&s.enable(3),a.envMap&&s.enable(4),a.normalMapObjectSpace&&s.enable(5),a.normalMapTangentSpace&&s.enable(6),a.clearcoat&&s.enable(7),a.iridescence&&s.enable(8),a.alphaTest&&s.enable(9),a.vertexColors&&s.enable(10),a.vertexAlphas&&s.enable(11),a.vertexUv1s&&s.enable(12),a.vertexUv2s&&s.enable(13),a.vertexUv3s&&s.enable(14),a.vertexTangents&&s.enable(15),a.anisotropy&&s.enable(16),a.alphaHash&&s.enable(17),a.batching&&s.enable(18),a.dispersion&&s.enable(19),a.batchingColor&&s.enable(20),a.gradientMap&&s.enable(21),n.push(s.mask),s.disableAll(),a.fog&&s.enable(0),a.useFog&&s.enable(1),a.flatShading&&s.enable(2),a.logarithmicDepthBuffer&&s.enable(3),a.reversedDepthBuffer&&s.enable(4),a.skinning&&s.enable(5),a.morphTargets&&s.enable(6),a.morphNormals&&s.enable(7),a.morphColors&&s.enable(8),a.premultipliedAlpha&&s.enable(9),a.shadowMapEnabled&&s.enable(10),a.doubleSided&&s.enable(11),a.flipSided&&s.enable(12),a.useDepthPacking&&s.enable(13),a.dithering&&s.enable(14),a.transmission&&s.enable(15),a.sheen&&s.enable(16),a.opaque&&s.enable(17),a.pointsUvs&&s.enable(18),a.decodeVideoTexture&&s.enable(19),a.decodeVideoTextureEmissive&&s.enable(20),a.alphaToCoverage&&s.enable(21),n.push(s.mask),o.push(e.outputColorSpace)),o.push(t.customProgramCacheKey),o.join()},getUniforms:function(e){let t,r=p[e.type];if(r){let e=lg[r];t=aL.clone(e.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,r){let i=h.get(r);return void 0!==i?++i.usedTimes:(i=new he(e,r,t,n),u.push(i),h.set(r,i)),i},releaseProgram:function(e){if(0==--e.usedTimes){let t=u.indexOf(e);
358u[t]=u[u.length-1],u.pop(),h.delete(e.cacheKey),e.destroy()}},releaseShaderCache:function(e){o.remove(e)},programs:u,dispose:function(){o.dispose()}}}function ha(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let r=e.get(t);return void 0===r&&(r={},e.set(t,r)),r},remove:function(t){e.delete(t)},update:function(t,r,i){e.get(t)[r]=i},dispose:function(){e=new WeakMap}}}function hs(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;if(e.material.id!==t.material.id)return e.material.id-t.material.id;if(e.materialVariant!==t.materialVariant)return e.materialVariant-t.materialVariant;if(e.z!==t.z)return e.z-t.z;else return e.id-t.id}function ho(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function hl(){let e=[],t=0,r=[],i=[],n=[];function a(e){let t=0;return e.isInstancedMesh&&(t+=2),e.isSkinnedMesh&&(t+=1),t}function s(r,i,n,s,o,l){let u=e[t];return void 0===u?(u={id:r.id,object:r,geometry:i,material:n,materialVariant:a(r),groupOrder:s,renderOrder:r.renderOrder,z:o,group:l},e[t]=u):(u.id=r.id,u.object=r,u.geometry=i,u.material=n,u.materialVariant=a(r),u.groupOrder=s,u.renderOrder=r.renderOrder,u.z=o,u.group=l),t++,u}return{opaque:r,transmissive:i,transparent:n,init:function(){t=0,r.length=0,i.length=0,n.length=0},push:function(e,t,a,o,l,u){let h=s(e,t,a,o,l,u);a.transmission>0?i.push(h):!0===a.transparent?n.push(h):r.push(h)},unshift:function(e,t,a,o,l,u){let h=s(e,t,a,o,l,u);a.transmission>0?i.unshift(h):!0===a.transparent?n.unshift(h):r.unshift(h)},finish:function(){for(let r=t,i=e.length;r<i;r++){let t=e[r];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){r.length>1&&r.sort(e||hs),i.length>1&&i.sort(t||ho),n.length>1&&n.sort(t||ho)}}}function hu(){let e=new WeakMap;return{get:function(t,r){let i,n=e.get(t);return void 0===n?(i=new hl,e.set(t,[i])):r>=n.length?(i=new hl,n.push(i)):i=n[r],i},dispose:function(){e=new WeakMap}}}function hh(){let e={};return{get:function(t){let r;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":r={direction:new eT,color:new ty};break;case"SpotLight":r={position:new eT,direction:new eT,color:new ty,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":r={position:new eT,color:new ty,distance:0,decay:0};break;case"HemisphereLight":r={direction:new eT,skyColor:new ty,groundColor:new ty};break;case"RectAreaLight":r={color:new ty,position:new eT,halfWidth:new eT,halfHeight:new eT}}return e[t.id]=r,r}}}let hd=0;function hc(e,t){return 2*!!t.castShadow-2*!!e.castShadow+ +!!t.map-!!e.map}function hp(e){let t,r=new hh,i=(t={},{get:function(e){let r;if(void 0!==t[e.id])return t[e.id];switch(e.type){case"DirectionalLight":case"SpotLight":r={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new eb};break;case"PointLight":r={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new eb,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=r,r}}),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 e=0;e<9;e++)n.probe.push(new eT);let a=new eT,s=new eq,o=new eq;return{setup:function(t){let a=0,s=0,o=0;for(let e=0;e<9;e++)n.probe[e].set(0,0,0);let l=0,u=0,h=0,d=0,c=0,p=0,f=0,m=0,g=0,v=0,y=0;t.sort(hc);for(let e=0,_=t.length;e<_;e++){let _=t[e],x=_.color,b=_.intensity,S=_.distance,T=null;if(_.shadow&&_.shadow.map&&(T=1030===_.shadow.map.texture.format?_.shadow.map.texture:_.shadow.map.depthTexture||_.shadow.map.texture),_.isAmbientLight)a+=x.r*b,s+=x.g*b,o+=x.b*b;else if(_.isLightProbe){for(let e=0;e<9;
vendor: 4,918 bytes, line 358
358e++)n.probe[e].addScaledVector(_.sh.coefficients[e],b);y++}else if(_.isDirectionalLight){let e=r.get(_);if(e.color.copy(_.color).multiplyScalar(_.intensity),_.castShadow){let e=_.shadow,t=i.get(_);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,n.directionalShadow[l]=t,n.directionalShadowMap[l]=T,n.directionalShadowMatrix[l]=_.shadow.matrix,p++}n.directional[l]=e,l++}else if(_.isSpotLight){let e=r.get(_);e.position.setFromMatrixPosition(_.matrixWorld),e.color.copy(x).multiplyScalar(b),e.distance=S,e.coneCos=Math.cos(_.angle),e.penumbraCos=Math.cos(_.angle*(1-_.penumbra)),e.decay=_.decay,n.spot[h]=e;let t=_.shadow;if(_.map&&(n.spotLightMap[g]=_.map,g++,t.updateMatrices(_),_.castShadow&&v++),n.spotLightMatrix[h]=t.matrix,_.castShadow){let e=i.get(_);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,n.spotShadow[h]=e,n.spotShadowMap[h]=T,m++}h++}else if(_.isRectAreaLight){let e=r.get(_);e.color.copy(x).multiplyScalar(b),e.halfWidth.set(.5*_.width,0,0),e.halfHeight.set(0,.5*_.height,0),n.rectArea[d]=e,d++}else if(_.isPointLight){let e=r.get(_);if(e.color.copy(_.color).multiplyScalar(_.intensity),e.distance=_.distance,e.decay=_.decay,_.castShadow){let e=_.shadow,t=i.get(_);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,n.pointShadow[u]=t,n.pointShadowMap[u]=T,n.pointShadowMatrix[u]=_.shadow.matrix,f++}n.point[u]=e,u++}else if(_.isHemisphereLight){let e=r.get(_);e.skyColor.copy(_.color).multiplyScalar(b),e.groundColor.copy(_.groundColor).multiplyScalar(b),n.hemi[c]=e,c++}}d>0&&(!0===e.has("OES_texture_float_linear")?(n.rectAreaLTC1=lm.LTC_FLOAT_1,n.rectAreaLTC2=lm.LTC_FLOAT_2):(n.rectAreaLTC1=lm.LTC_HALF_1,n.rectAreaLTC2=lm.LTC_HALF_2)),n.ambient[0]=a,n.ambient[1]=s,n.ambient[2]=o;let _=n.hash;(_.directionalLength!==l||_.pointLength!==u||_.spotLength!==h||_.rectAreaLength!==d||_.hemiLength!==c||_.numDirectionalShadows!==p||_.numPointShadows!==f||_.numSpotShadows!==m||_.numSpotMaps!==g||_.numLightProbes!==y)&&(n.directional.length=l,n.spot.length=h,n.rectArea.length=d,n.point.length=u,n.hemi.length=c,n.directionalShadow.length=p,n.directionalShadowMap.length=p,n.pointShadow.length=f,n.pointShadowMap.length=f,n.spotShadow.length=m,n.spotShadowMap.length=m,n.directionalShadowMatrix.length=p,n.pointShadowMatrix.length=f,n.spotLightMatrix.length=m+g-v,n.spotLightMap.length=g,n.numSpotLightShadowsWithMaps=v,n.numLightProbes=y,_.directionalLength=l,_.pointLength=u,_.spotLength=h,_.rectAreaLength=d,_.hemiLength=c,_.numDirectionalShadows=p,_.numPointShadows=f,_.numSpotShadows=m,_.numSpotMaps=g,_.numLightProbes=y,n.version=hd++)},setupView:function(e,t){let r=0,i=0,l=0,u=0,h=0,d=t.matrixWorldInverse;for(let t=0,c=e.length;t<c;t++){let c=e[t];if(c.isDirectionalLight){let e=n.directional[r];e.direction.setFromMatrixPosition(c.matrixWorld),a.setFromMatrixPosition(c.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(d),r++}else if(c.isSpotLight){let e=n.spot[l];e.position.setFromMatrixPosition(c.matrixWorld),e.position.applyMatrix4(d),e.direction.setFromMatrixPosition(c.matrixWorld),a.setFromMatrixPosition(c.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(d),l++}else if(c.isRectAreaLight){let e=n.rectArea[u];e.position.setFromMatrixPosition(c.matrixWorld),e.position.applyMatrix4(d),o.identity(),s.copy(c.matrixWorld),s.premultiply(d),o.extractRotation(s),e.halfWidth.set(.5*c.width,0,0),e.halfHeight.set(0,.5*c.height,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),u++}else if(c.isPointLight){let e=n.point[i];e.position.setFromMatrixPosition(c.matrixWorld),e.position.applyMatrix4(d),i++}else if(c.isHemisphereLight){let e=n.hemi[h];e.direction.setFromMatrixPosition(c.matrixWorld),e.direction.transformDirection(d),h++}}},state:n}}function hf(e){let t=new hp(e),r=[],i=[],n={lightsArray:r,shadowsArray:i,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){n.camera=e,r.length=0,i.length=0},state:n,setupLights:function(){t.setup(r)},setupLightsView:function(e){t.setupView(r,e)},pushLight:function(e){r.push(e)},pushShadow:function(e){i.push(e)}}}function hm(e){let t=new WeakMap;return{get:function(r,i=0){let n,a=t.get(r);return void 0===a?(n=new hf(e),t.set(r,[n])):i>=a.length?(n=new hf(e),a.push(n)):n=a[i],n},dispose:function(){t=new WeakMap}}}let hg=[new eT(1,0,0),new eT(-1,0,0),new eT(0,1,0),new eT(0,-1,0),new eT(0,0,1),new eT(0,0,-1)],hv=[new eT(0,-1,0),new eT(0,-1,0),new eT(0,0,1),new eT(0,0,-1),new eT(0,-1,0),new eT(0,-1,0)],hy=new eq,h_=new eT,hx=new eT;function hb(e,t,r){let i=new iL,n=new eb,a=new eb,s=new ek,o=new ak,l=new aV,u={},h=r.maxTextureSize,d={0:1,1:0,2:2}
358,c=new aB({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new eb},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}"}),p=c.clone();p.defines.HORIZONTAL_PASS=1;let f=new rg;f.setAttribute("position",new t5(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new r8(f,c),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let v=this.type;function y(t,r,i,n){let a=null,s=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===i.isPointLight?l:o,e.localClippingEnabled&&!0===r.clipShadows&&Array.isArray(r.clippingPlanes)&&0!==r.clippingPlanes.length||r.displacementMap&&0!==r.displacementScale||r.alphaMap&&r.alphaTest>0||r.map&&r.alphaTest>0||!0===r.alphaToCoverage){let e=a.uuid,t=r.uuid,i=u[e];void 0===i&&(i={},u[e]=i);let n=i[t];void 0===n&&(n=a.clone(),i[t]=n,r.addEventListener("dispose",_)),a=n}return a.visible=r.visible,a.wireframe=r.wireframe,3===n?a.side=null!==r.shadowSide?r.shadowSide:r.side:a.side=null!==r.shadowSide?r.shadowSide:d[r.side],a.alphaMap=r.alphaMap,a.alphaTest=!0===r.alphaToCoverage?.5:r.alphaTest,a.map=r.map,a.clipShadows=r.clipShadows,a.clippingPlanes=r.clippingPlanes,a.clipIntersection=r.clipIntersection,a.displacementMap=r.displacementMap,a.displacementScale=r.displacementScale,a.displacementBias=r.displacementBias,a.wireframeLinewidth=r.wireframeLinewidth,a.linewidth=r.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=i),a}function _(e){for(let t in e.target.removeEventListener("dispose",_),u){let r=u[t],i=e.target.uuid;i in r&&(r[i].dispose(),delete r[i])}}this.render=function(r,o,l){if(!1===g.enabled||!1===g.autoUpdate&&!1===g.needsUpdate||0===r.length)return;2===this.type&&(en("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=1);let u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),_=e.state;_.setBlending(0),!0===_.buffers.depth.getReversed()?_.buffers.color.setClear(0,0,0,0):_.buffers.color.setClear(1,1,1,1),_.buffers.depth.setTest(!0),_.setScissorTest(!1);let x=v!==this.type;x&&o.traverse(function(e){e.material&&(Array.isArray(e.material)?e.material.forEach(e=>e.needsUpdate=!0):e.material.needsUpdate=!0)});for(let u=0,d=r.length;u<d;u++){let d=r[u],f=d.shadow;if(void 0===f){en("WebGLShadowMap:",d,"has no shadow.");continue}if(!1===f.autoUpdate&&!1===f.needsUpdate)continue;n.copy(f.mapSize);let g=f.getFrameExtents();n.multiply(g),a.copy(f.mapSize),(n.x>h||n.y>h)&&(n.x>h&&(a.x=Math.floor(h/g.x),n.x=a.x*g.x,f.mapSize.x=a.x),n.y>h&&(a.y=Math.floor(h/g.y),n.y=a.y*g.y,f.mapSize.y=a.y));let v=e.state.buffers.depth.getReversed();if(f.camera._reversedDepth=v,null===f.map||!0===x){if(null!==f.map&&(null!==f.map.depthTexture&&(f.map.depthTexture.dispose(),f.map.depthTexture=null),f.map.dispose()),3===this.type){if(d.isPointLight){en("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}f.map=new ez(n.x,n.y,{format:1030,type:1016,minFilter:1006,magFilter:1006,generateMipmaps:!1}),f.map.texture.name=d.name+".shadowMap",f.map.depthTexture=new nv(n.x,n.y,1015),f.map.depthTexture.name=d.name+".shadowMapDepth",f.map.depthTexture.format=1026,f.map.depthTexture.compareFunction=null,f.map.depthTexture.minFilter=1003,f.map.depthTexture.magFilter=1003}else d.isPointLight?(f.map=new lG(n.x),f.map.depthTexture=new ny(n.x,1014)):(f.map=new ez(n.x,n.y),f.map.depthTexture=new nv(n.x,n.y,1014)),f.map.depthTexture.name=d.name+".shadowMap",f.map.depthTexture.format=1026,1===this.type?(f.map.depthTexture.compareFunction=v?518:515,f.map.depthTexture.minFilter=1006,f.map.depthTexture.magFilter=1006):(f.map.depthTexture.compareFunction=null,f.map.depthTexture.minFilter=1003,f.map.depthTexture.magFilter=1003);f.camera.updateProjectionMatrix()}
358let b=f.map.isWebGLCubeRenderTarget?6:1;for(let r=0;r<b;r++){if(f.map.isWebGLCubeRenderTarget)e.setRenderTarget(f.map,r),e.clear();else{0===r&&(e.setRenderTarget(f.map),e.clear());let t=f.getViewport(r);s.set(a.x*t.x,a.y*t.y,a.x*t.z,a.y*t.w),_.viewport(s)}if(d.isPointLight){let e=f.camera,t=f.matrix,i=d.distance||e.far;i!==e.far&&(e.far=i,e.updateProjectionMatrix()),h_.setFromMatrixPosition(d.matrixWorld),e.position.copy(h_),hx.copy(e.position),hx.add(hg[r]),e.up.copy(hv[r]),e.lookAt(hx),e.updateMatrixWorld(),t.makeTranslation(-h_.x,-h_.y,-h_.z),hy.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),f._frustum.setFromProjectionMatrix(hy,e.coordinateSystem,e.reversedDepth)}else f.updateMatrices(d);i=f.getFrustum(),function r(n,a,s,o,l){if(!1===n.visible)return;if(n.layers.test(a.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===l)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);let r=t.update(n),i=n.material;if(Array.isArray(i)){let t=r.groups;for(let u=0,h=t.length;u<h;u++){let h=t[u],d=i[h.materialIndex];if(d&&d.visible){let t=y(n,d,o,l);n.onBeforeShadow(e,n,a,s,r,t,h),e.renderBufferDirect(s,null,r,t,n,h),n.onAfterShadow(e,n,a,s,r,t,h)}}}else if(i.visible){let t=y(n,i,o,l);n.onBeforeShadow(e,n,a,s,r,t,null),e.renderBufferDirect(s,null,r,t,n,null),n.onAfterShadow(e,n,a,s,r,t,null)}}let u=n.children;for(let e=0,t=u.length;e<t;e++)r(u[e],a,s,o,l)}(o,l,f.camera,d,this.type)}!0!==f.isPointLightShadow&&3===this.type&&function(r,i){let a=t.update(m);c.defines.VSM_SAMPLES!==r.blurSamples&&(c.defines.VSM_SAMPLES=r.blurSamples,p.defines.VSM_SAMPLES=r.blurSamples,c.needsUpdate=!0,p.needsUpdate=!0),null===r.mapPass&&(r.mapPass=new ez(n.x,n.y,{format:1030,type:1016})),c.uniforms.shadow_pass.value=r.map.depthTexture,c.uniforms.resolution.value=r.mapSize,c.uniforms.radius.value=r.radius,e.setRenderTarget(r.mapPass),e.clear(),e.renderBufferDirect(i,null,a,c,m,null),p.uniforms.shadow_pass.value=r.mapPass.texture,p.uniforms.resolution.value=r.mapSize,p.uniforms.radius.value=r.radius,e.setRenderTarget(r.map),e.clear(),e.renderBufferDirect(i,null,a,p,m,null)}(f,l),f.needsUpdate=!1}v=this.type,g.needsUpdate=!1,e.setRenderTarget(u,d,f)}}function hS(e,t){let r=new function(){let t=!1,r=new ek,i=null,n=new ek(0,0,0,0);return{setMask:function(r){i===r||t||(e.colorMask(r,r,r,r),i=r)},setLocked:function(e){t=e},setClear:function(t,i,a,s,o){!0===o&&(t*=s,i*=s,a*=s),r.set(t,i,a,s),!1===n.equals(r)&&(e.clearColor(t,i,a,s),n.copy(r))},reset:function(){t=!1,i=null,n.set(-1,0,0,0)}}},i=new function(){let r=!1,i=!1,n=null,a=null,s=null;return{setReversed:function(e){if(i!==e){let r=t.get("EXT_clip_control");e?r.clipControlEXT(r.LOWER_LEFT_EXT,r.ZERO_TO_ONE_EXT):r.clipControlEXT(r.LOWER_LEFT_EXT,r.NEGATIVE_ONE_TO_ONE_EXT),i=e;let n=s;s=null,this.setClear(n)}},getReversed:function(){return i},setTest:function(t){t?G(e.DEPTH_TEST):k(e.DEPTH_TEST)},setMask:function(t){n===t||r||(e.depthMask(t),n=t)},setFunc:function(t){if(i&&(t=el[t]),a!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}a=t}},setLocked:function(e){r=e},setClear:function(t){s!==t&&(s=t,i&&(t=1-t),e.clearDepth(t))},reset:function(){r=!1,n=null,a=null,s=null,i=!1}}},n=new function(){let t=!1,r=null,i=null,n=null,a=null,s=null,o=null,l=null,u=null;return{setTest:function(r){t||(r?G(e.STENCIL_TEST):k(e.STENCIL_TEST))},setMask:function(i){r===i||t||(e.stencilMask(i),r=i)},setFunc:function(t,r,s){(i!==t||n!==r||a!==s)&&(e.stencilFunc(t,r,s),i=t,n=r,a=s)},setOp:function(t,r,i){(s!==t||o!==r||l!==i)&&(e.stencilOp(t,r,i),s=t,o=r,l=i)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,r=null,i=null,n=null,a=null,s=null,o=null,l=null,u=null}}},a=new WeakMap,s=new WeakMap,o={},l={},u=new WeakMap,h=[],d=null,c=!1,p=null,f=null,m=null,g=null,v=null,y=null,_=null,x=new ty(0,0,0),b=0,S=!1,T=null,A=null,M=null,E=null,C=null,w=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),R=!1,N=e.getParameter(e.VERSION);-1!==N.indexOf("WebGL")?R=parseFloat(/^WebGL (\d)/.exec(N)[1])>=1:-1!==N.indexOf("OpenGL ES")&&(R=parseFloat(/^OpenGL ES (\d)/.exec(N)[1])>=2);let L=null,B={},I=e.getParameter(e.SCISSOR_BOX),P=e.getParameter(e.VIEWPORT),F=new ek().fromArray(I),D=new ek().fromArray(P);function U(t,r,i,n){let a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;s<i;s++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(r,0,e.RGBA,1,1,n,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(r+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return s}let O={};function G(t){!0!==o[t]&&(e.enable(t),o[t]=!0)}function k(t){!1!==o[t]&&(e.disable(t),o[t]=!1)}O[e.TEXTURE_2D]=U(e.TEXTURE_2D,e.TEXTURE_2D,1),O[e.TEXTURE_CUBE_MAP]=U(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),O[e.TEXTURE_2D_ARRAY]=U(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),O[e.TEXTURE_3D]=U(e.TEXTURE_3D,e.TEXTURE_3D,1,1),r.setClear(0,0,0,1),i.setClear(1),n.setClear(0),G(e.DEPTH_TEST),i.setFunc(3),W(!1),j(1),G(e.CULL_FACE),H(0);let V={100:e.FUNC_ADD,101:e.FUNC_SUBTRACT,102:e.FUNC_REVERSE_SUBTRACT};V[103]=e.MIN,V[104]=e.MAX;let z={200:e.ZERO,201:e.ONE,202:e.SRC_COLOR,204:e.SRC_ALPHA,210:e.SRC_ALPHA_SATURATE,208:e.DST_COLOR,206:e.DST_ALPHA,203:e.ONE_MINUS_SRC_COLOR,205:e.ONE_MINUS_SRC_ALPHA,209:e.ONE_MINUS_DST_COLOR,207:e.ONE_MINUS_DST_ALPHA,211:e.CONSTANT_COLOR,212:e.ONE_MINUS_CONSTANT_COLOR,213:e.CONSTANT_ALPHA,214:e.ONE_MINUS_CONSTANT_ALPHA};function H(t,r,i,n,a,s,o,l,u,h){if(0===t){!0===c&&(k(e.BLEND),c=!1);return}if(!1===c&&(G(e.BLEND),c=!0),5!==t){if(t!==p||h!==S){if((100!==f||100!==v)&&(e.blendEquation(e.FUNC_ADD),f=100,v=100),h)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:ea("WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case 3:ea("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case 4:ea("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ea("WebGLState: Invalid blending: ",t)}m=null,g=null,y=null,_=null,x.set(0,0,0),b=0,p=t,S=h}return}a=a||r,s=s||i,o=o||n,(r!==f||a!==v)&&(e.blendEquationSeparate(V[r],V[a]),f=r,v=a),(i!==m||n!==g||s!==y||o!==_)&&(e.blendFuncSeparate(z[i],z[n],z[s],z[o]),m=i,g=n,y=s,_=o),(!1===l.equals(x)||u!==b)&&(e.blendColor
358(l.r,l.g,l.b,u),x.copy(l),b=u),p=t,S=!1}function W(t){T!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),T=t)}function j(t){0!==t?(G(e.CULL_FACE),t!==A&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):k(e.CULL_FACE),A=t}function X(t,r,n){t?(G(e.POLYGON_OFFSET_FILL),(E!==r||C!==n)&&(E=r,C=n,i.getReversed()&&(r=-r),e.polygonOffset(r,n))):k(e.POLYGON_OFFSET_FILL)}return{buffers:{color:r,depth:i,stencil:n},enable:G,disable:k,bindFramebuffer:function(t,r){return l[t]!==r&&(e.bindFramebuffer(t,r),l[t]=r,t===e.DRAW_FRAMEBUFFER&&(l[e.FRAMEBUFFER]=r),t===e.FRAMEBUFFER&&(l[e.DRAW_FRAMEBUFFER]=r),!0)},drawBuffers:function(t,r){let i=h,n=!1;if(t){void 0===(i=u.get(r))&&(i=[],u.set(r,i));let a=t.textures;if(i.length!==a.length||i[0]!==e.COLOR_ATTACHMENT0){for(let t=0,r=a.length;t<r;t++)i[t]=e.COLOR_ATTACHMENT0+t;i.length=a.length,n=!0}}else i[0]!==e.BACK&&(i[0]=e.BACK,n=!0);n&&e.drawBuffers(i)},useProgram:function(t){return d!==t&&(e.useProgram(t),d=t,!0)},setBlending:H,setMaterial:function(t,a){2===t.side?k(e.CULL_FACE):G(e.CULL_FACE);let s=1===t.side;a&&(s=!s),W(s),1===t.blending&&!1===t.transparent?H(0):H(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),i.setFunc(t.depthFunc),i.setTest(t.depthTest),i.setMask(t.depthWrite),r.setMask(t.colorWrite);let o=t.stencilWrite;n.setTest(o),o&&(n.setMask(t.stencilWriteMask),n.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),n.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),X(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?G(e.SAMPLE_ALPHA_TO_COVERAGE):k(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:W,setCullFace:j,setLineWidth:function(t){t!==M&&(R&&e.lineWidth(t),M=t)},setPolygonOffset:X,setScissorTest:function(t){t?G(e.SCISSOR_TEST):k(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+w-1),L!==t&&(e.activeTexture(t),L=t)},bindTexture:function(t,r,i){void 0===i&&(i=null===L?e.TEXTURE0+w-1:L);let n=B[i];void 0===n&&(n={type:void 0,texture:void 0},B[i]=n),(n.type!==t||n.texture!==r)&&(L!==i&&(e.activeTexture(i),L=i),e.bindTexture(t,r||O[t]),n.type=t,n.texture=r)},unbindTexture:function(){let t=B[L];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D(...arguments)}catch(e){ea("WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D(...arguments)}catch(e){ea("WebGLState:",e)}},texImage2D:function(){try{e.texImage2D(...arguments)}catch(e){ea("WebGLState:",e)}},texImage3D:function(){try{e.texImage3D(...arguments)}catch(e){ea("WebGLState:",e)}},updateUBOMapping:function(t,r){let i=s.get(r);void 0===i&&(i=new WeakMap,s.set(r,i));let n=i.get(t);void 0===n&&(n=e.getUniformBlockIndex(r,t.name),i.set(t,n))},uniformBlockBinding:function(t,r){let i=s.get(r).get(t);a.get(r)!==i&&(e.uniformBlockBinding(r,i,t.__bindingPointIndex),a.set(r,i))},texStorage2D:function(){try{e.texStorage2D(...arguments)}catch(e){ea("WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D(...arguments)}catch(e){ea("WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D(...arguments)}catch(e){ea("WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D(...arguments)}catch(e){ea("WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D(...arguments)}catch(e){ea("WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D(...arguments)}catch(e){ea("WebGLState:",e)}},scissor:function(t){!1===F.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),F.copy(t))},viewport:function(t){!1===D.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),D.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),i.setReversed(!1),e.clearDepth(1),e.stencilMask(0xffffffff),e.stencilFunc(e.ALWAYS,0,0xffffffff),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),o={},L=null,B={},l={},u=new WeakMap,h=[],d=null,c=!1,p=null,f=null,m=null,g=null,v=null,y=null,_=null,x=new ty(0,0,0),b=0,S=!1,T=null,A=null,M=null,E=null,C=null,F.set(0,0,e.canvas.width,e.canvas.height),D.set(0,0,e.canvas.width,e.canvas.height),r.reset(),i.reset(),n.reset()}}}function hT(e,t,r,i,n,a,s){let o,l=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,u="u">typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),h=new eb,d=new WeakMap,c=new WeakMap,p=!1;try{p="u">typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function f(e,t){return p?new OffscreenCanvas(e,t):K("canvas")}function m(e,t,r){let i=1,n=j(e);if((n.width>r||n.height>r)&&(i=r/Math.max(n.width,n.height)),i<1)if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof VideoFrame&&e instanceof VideoFrame){let r=Math.floor(i*n.width),a=Math.floor(i*n.height);void 0===o&&(o=f(r,a));let s=t?f(r,a):o;return s.width=r,s.height=a,s.getContext("2d").drawImage(e,0,0,r,a),en("WebGLRenderer: Texture has been resized from ("+n.width+"x"+n.height+") to ("+r+"x"+a+")."),s}else"data"in e&&en("WebGLRenderer: Image in DataTexture is too big ("+n.width+"x"+n.height+").");return e}function g(e){return e.generateMipmaps}function v(t){e.generateMipmap(t)}function y(r,i,n,a,s=!1){if(null!==r){if(void 0!==e[r])return e[r];en("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+r
358+"'")}let o=i;if(i===e.RED&&(n===e.FLOAT&&(o=e.R32F),n===e.HALF_FLOAT&&(o=e.R16F),n===e.UNSIGNED_BYTE&&(o=e.R8)),i===e.RED_INTEGER&&(n===e.UNSIGNED_BYTE&&(o=e.R8UI),n===e.UNSIGNED_SHORT&&(o=e.R16UI),n===e.UNSIGNED_INT&&(o=e.R32UI),n===e.BYTE&&(o=e.R8I),n===e.SHORT&&(o=e.R16I),n===e.INT&&(o=e.R32I)),i===e.RG&&(n===e.FLOAT&&(o=e.RG32F),n===e.HALF_FLOAT&&(o=e.RG16F),n===e.UNSIGNED_BYTE&&(o=e.RG8)),i===e.RG_INTEGER&&(n===e.UNSIGNED_BYTE&&(o=e.RG8UI),n===e.UNSIGNED_SHORT&&(o=e.RG16UI),n===e.UNSIGNED_INT&&(o=e.RG32UI),n===e.BYTE&&(o=e.RG8I),n===e.SHORT&&(o=e.RG16I),n===e.INT&&(o=e.RG32I)),i===e.RGB_INTEGER&&(n===e.UNSIGNED_BYTE&&(o=e.RGB8UI),n===e.UNSIGNED_SHORT&&(o=e.RGB16UI),n===e.UNSIGNED_INT&&(o=e.RGB32UI),n===e.BYTE&&(o=e.RGB8I),n===e.SHORT&&(o=e.RGB16I),n===e.INT&&(o=e.RGB32I)),i===e.RGBA_INTEGER&&(n===e.UNSIGNED_BYTE&&(o=e.RGBA8UI),n===e.UNSIGNED_SHORT&&(o=e.RGBA16UI),n===e.UNSIGNED_INT&&(o=e.RGBA32UI),n===e.BYTE&&(o=e.RGBA8I),n===e.SHORT&&(o=e.RGBA16I),n===e.INT&&(o=e.RGBA32I)),i===e.RGB&&(n===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),n===e.UNSIGNED_INT_10F_11F_11F_REV&&(o=e.R11F_G11F_B10F)),i===e.RGBA){let t=s?k:eN.getTransfer(a);n===e.FLOAT&&(o=e.RGBA32F),n===e.HALF_FLOAT&&(o=e.RGBA16F),n===e.UNSIGNED_BYTE&&(o=t===V?e.SRGB8_ALPHA8:e.RGBA8),n===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),n===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return(o===e.R16F||o===e.R32F||o===e.RG16F||o===e.RG32F||o===e.RGBA16F||o===e.RGBA32F)&&t.get("EXT_color_buffer_float"),o}function _(t,r){let i;return t?null===r||1014===r||1020===r?i=e.DEPTH24_STENCIL8:1015===r?i=e.DEPTH32F_STENCIL8:1012===r&&(i=e.DEPTH24_STENCIL8,en("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===r||1014===r||1020===r?i=e.DEPTH_COMPONENT24:1015===r?i=e.DEPTH_COMPONENT32F:1012===r&&(i=e.DEPTH_COMPONENT16),i}function x(e,t){return!0===g(e)||e.isFramebufferTexture&&1003!==e.minFilter&&1006!==e.minFilter?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function b(e){let t=e.target;t.removeEventListener("dispose",b),function(e){let t=i.get(e);if(void 0===t.__webglInit)return;let r=e.source,n=c.get(r);if(n){let i=n[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&T(e),0===Object.keys(n).length&&c.delete(r)}i.remove(e)}(t),t.isVideoTexture&&d.delete(t)}function S(t){let r=t.target;r.removeEventListener("dispose",S),function(t){let r=i.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),i.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(r.__webglFramebuffer[t]))for(let i=0;i<r.__webglFramebuffer[t].length;i++)e.deleteFramebuffer(r.__webglFramebuffer[t][i]);else e.deleteFramebuffer(r.__webglFramebuffer[t]);r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[t])}else{if(Array.isArray(r.__webglFramebuffer))for(let t=0;t<r.__webglFramebuffer.length;t++)e.deleteFramebuffer(r.__webglFramebuffer[t]);else e.deleteFramebuffer(r.__webglFramebuffer);if(r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(let t=0;t<r.__webglColorRenderbuffer.length;t++)r.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(r.__webglColorRenderbuffer[t]);r.__webglDepthRenderbuffer&&e.deleteRenderbuffer(r.__webglDepthRenderbuffer)}let n=t.textures;for(let t=0,r=n.length;t<r;t++){let r=i.get(n[t]);r.__webglTexture&&(e.deleteTexture(r.__webglTexture),s.memory.textures--),i.remove(n[t])}i.remove(t)}(r)}function T(t){let r=i.get(t);e.deleteTexture(r.__webglTexture);let n=t.source,a=c.get(n);delete a[r.__cacheKey],s.memory.textures--}let A=0;function M(t,n){var a;let o,l=i.get(t);if(t.isVideoTexture&&(a=t,o=s.render.frame,d.get(a)!==o&&(d.set(a,o),a.update())),!1===t.isRenderTargetTexture&&!0!==t.isExternalTexture&&t.version>0&&l.__version!==t.version){let e=t.image;if(null===e)en("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void B(l,t,n);en("WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(l.__webglTexture=t.sourceTexture?t.sourceTexture:null);r.bindTexture(e.TEXTURE_2D,l.__webglTexture,e.TEXTURE0+n)}let E={1e3:e.REPEAT,1001:e.CLAMP_TO_EDGE,1002:e.MIRRORED_REPEAT},C={1003:e.NEAREST,1004:e.NEAREST_MIPMAP_NEAREST,1005:e.NEAREST_MIPMAP_LINEAR,1006:e.LINEAR,1007:e.LINEAR_MIPMAP_NEAREST,1008:e.LINEAR_MIPMAP_LINEAR},w={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function R(r,a){if((1015===a.type&&!1===t.has("OES_texture_float_linear")&&(1006===a.magFilter||1007===a.magFilter||1005===a.magFilter||1008===a.magFilter||1006===a.minFilter||1007===a.minFilter||1005===a.minFilter||1008===a.minFilter)&&en("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(r,e.TEXTURE_WRAP_S,E[a.wrapS]),e.texParameteri(r,e.TEXTURE_WRAP_T,E[a.wrapT]),(r===e.TEXTURE_3D||r===e.TEXTURE_2D_ARRAY)&&e.texParameteri(r,e.TEXTURE_WRAP_R,E[a.wrapR]),e.texParameteri(r,e.TEXTURE_MAG_FILTER,C[a.magFilter]),e.texParameteri(r,e.TEXTURE_MIN_FILTER,C[a.minFilter]),a.compareFunction&&(e.texParameteri(r,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(r,e.TEXTURE_COMPARE_FUNC,w[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic"))&&1003!==a.magFilter&&(1005===a.minFilter||1008===a.minFilter)&&(1015!==a.type||!1!==t.has("OES_texture_float_linear"))&&(a.anisotropy>1||i.get(a).__currentAnisotropy)){let s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(r,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,n.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy}}function N(t,r){let i,n=!1;void 0===t.__webglInit&&(t.__webglInit=!0,r.addEventListener("dispose",b));let a=r.source,o=c.get(a);void 0===o&&(o={},c.set(a,o));let l=((i=[]).push(r.wrapS),i.push(r.wrapT),i.push(r.wrapR||0),i.push(r.magFilter),i.push(r.minFilter),i.push(r.anisotropy),i.push(r.internalFormat),i.push(r.format),i.push(r.type),i.push(r.generateMipmaps),i.push(r.premultiplyAlpha),i.push(r.flipY),i.push(r.unpackAlignment),i.push(r.colorSpace),i.join());if(l!==t.__cacheKey){void 0===o[l]&&(o[l]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,n=!0),o[l].usedTimes++;let i=o[t.__cacheKey];void 0!==i&&(o[t.__cacheKey].usedTimes--,0===i.usedTimes&&T(r)),t.__cacheKey=l,t.__webglTexture=o[l].texture}return n}function L(e,t,r){return Math.floor(Math.floor(e/r)/t)}function B(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);let u=N(t,s),h=s.source;r.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);let d=i.get(h);if(h.version!==d.__version||!0===u){let t;r.activeTexture(e.TEXTURE0+o);let i=eN.getPrimaries(eN.workingColorSpace),c=""===s.colorSpace?null:eN.getPrimaries(s.colorSpace),p=""===s.colorSpace||i===c?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);let f=m(s.image,!1,n.maxTextureSize);f=W(s,f);let b=a.convert(s.format,s.colorSpace),S=a.convert(s.type),T=y(s.internalFormat,b,S,s.colorSpace,s.isVideoTexture);R(l,s);let A=s.mipmaps,M=!0!==s.isVideoTexture,E=void 0===d.__version||!0===u,C=h.dataReady,w=x(s,f);
358if(s.isDepthTexture)T=_(1027===s.format,s.type),E&&(M?r.texStorage2D(e.TEXTURE_2D,1,T,f.width,f.height):r.texImage2D(e.TEXTURE_2D,0,T,f.width,f.height,0,b,S,null));else if(s.isDataTexture)if(A.length>0){M&&E&&r.texStorage2D(e.TEXTURE_2D,w,T,A[0].width,A[0].height);for(let i=0,n=A.length;i<n;i++)t=A[i],M?C&&r.texSubImage2D(e.TEXTURE_2D,i,0,0,t.width,t.height,b,S,t.data):r.texImage2D(e.TEXTURE_2D,i,T,t.width,t.height,0,b,S,t.data);s.generateMipmaps=!1}else M?(E&&r.texStorage2D(e.TEXTURE_2D,w,T,f.width,f.height),C&&function(t,i,n,a){let s=t.updateRanges;if(0===s.length)r.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,n,a,i.data);else{s.sort((e,t)=>e.start-t.start);let o=0;for(let e=1;e<s.length;e++){let t=s[o],r=s[e],n=t.start+t.count,a=L(r.start,i.width,4),l=L(t.start,i.width,4);r.start<=n+1&&a===l&&L(r.start+r.count-1,i.width,4)===a?t.count=Math.max(t.count,r.start+r.count-t.start):s[++o]=r}s.length=o+1;let l=e.getParameter(e.UNPACK_ROW_LENGTH),u=e.getParameter(e.UNPACK_SKIP_PIXELS),h=e.getParameter(e.UNPACK_SKIP_ROWS);e.pixelStorei(e.UNPACK_ROW_LENGTH,i.width);for(let t=0,o=s.length;t<o;t++){let o=s[t],l=Math.floor(o.start/4),u=Math.ceil(o.count/4),h=l%i.width,d=Math.floor(l/i.width);e.pixelStorei(e.UNPACK_SKIP_PIXELS,h),e.pixelStorei(e.UNPACK_SKIP_ROWS,d),r.texSubImage2D(e.TEXTURE_2D,0,h,d,u,1,n,a,i.data)}t.clearUpdateRanges(),e.pixelStorei(e.UNPACK_ROW_LENGTH,l),e.pixelStorei(e.UNPACK_SKIP_PIXELS,u),e.pixelStorei(e.UNPACK_SKIP_ROWS,h)}}(s,f,b,S)):r.texImage2D(e.TEXTURE_2D,0,T,f.width,f.height,0,b,S,f.data);else if(s.isCompressedTexture)if(s.isCompressedArrayTexture){M&&E&&r.texStorage3D(e.TEXTURE_2D_ARRAY,w,T,A[0].width,A[0].height,f.depth);for(let i=0,n=A.length;i<n;i++)if(t=A[i],1023!==s.format)if(null!==b)if(M){if(C)if(s.layerUpdates.size>0){let n=lh(t.width,t.height,s.format,s.type);for(let a of s.layerUpdates){let s=t.data.subarray(a*n/t.data.BYTES_PER_ELEMENT,(a+1)*n/t.data.BYTES_PER_ELEMENT);r.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,a,t.width,t.height,1,b,s)}s.clearLayerUpdates()}else r.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,0,t.width,t.height,f.depth,b,t.data)}else r.compressedTexImage3D(e.TEXTURE_2D_ARRAY,i,T,t.width,t.height,f.depth,0,t.data,0,0);else en("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else M?C&&r.texSubImage3D(e.TEXTURE_2D_ARRAY,i,0,0,0,t.width,t.height,f.depth,b,S,t.data):r.texImage3D(e.TEXTURE_2D_ARRAY,i,T,t.width,t.height,f.depth,0,b,S,t.data)}else{M&&E&&r.texStorage2D(e.TEXTURE_2D,w,T,A[0].width,A[0].height);for(let i=0,n=A.length;i<n;i++)t=A[i],1023!==s.format?null!==b?M?C&&r.compressedTexSubImage2D(e.TEXTURE_2D,i,0,0,t.width,t.height,b,t.data):r.compressedTexImage2D(e.TEXTURE_2D,i,T,t.width,t.height,0,t.data):en("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?C&&r.texSubImage2D(e.TEXTURE_2D,i,0,0,t.width,t.height,b,S,t.data):r.texImage2D(e.TEXTURE_2D,i,T,t.width,t.height,0,b,S,t.data)}else if(s.isDataArrayTexture)if(M){if(E&&r.texStorage3D(e.TEXTURE_2D_ARRAY,w,T,f.width,f.height,f.depth),C)if(s.layerUpdates.size>0){let t=lh(f.width,f.height,s.format,s.type);for(let i of s.layerUpdates){let n=f.data.subarray(i*t/f.data.BYTES_PER_ELEMENT,(i+1)
358*t/f.data.BYTES_PER_ELEMENT);r.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,i,f.width,f.height,1,b,S,n)}s.clearLayerUpdates()}else r.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,b,S,f.data)}else r.texImage3D(e.TEXTURE_2D_ARRAY,0,T,f.width,f.height,f.depth,0,b,S,f.data);else if(s.isData3DTexture)M?(E&&r.texStorage3D(e.TEXTURE_3D,w,T,f.width,f.height,f.depth),C&&r.texSubImage3D(e.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,b,S,f.data)):r.texImage3D(e.TEXTURE_3D,0,T,f.width,f.height,f.depth,0,b,S,f.data);else if(s.isFramebufferTexture){if(E)if(M)r.texStorage2D(e.TEXTURE_2D,w,T,f.width,f.height);else{let t=f.width,i=f.height;for(let n=0;n<w;n++)r.texImage2D(e.TEXTURE_2D,n,T,t,i,0,b,S,null),t>>=1,i>>=1}}else if(A.length>0){if(M&&E){let t=j(A[0]);r.texStorage2D(e.TEXTURE_2D,w,T,t.width,t.height)}for(let i=0,n=A.length;i<n;i++)t=A[i],M?C&&r.texSubImage2D(e.TEXTURE_2D,i,0,0,b,S,t):r.texImage2D(e.TEXTURE_2D,i,T,b,S,t);s.generateMipmaps=!1}else if(M){if(E){let t=j(f);r.texStorage2D(e.TEXTURE_2D,w,T,t.width,t.height)}C&&r.texSubImage2D(e.TEXTURE_2D,0,0,0,b,S,f)}else r.texImage2D(e.TEXTURE_2D,0,T,b,S,f);g(s)&&v(l),d.__version=h.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}function I(t,n,s,o,u,h){let d=a.convert(s.format,s.colorSpace),c=a.convert(s.type),p=y(s.internalFormat,d,c,s.colorSpace),f=i.get(n),m=i.get(s);if(m.__renderTarget=n,!f.__hasExternalTextures){let t=Math.max(1,n.width>>h),i=Math.max(1,n.height>>h);u===e.TEXTURE_3D||u===e.TEXTURE_2D_ARRAY?r.texImage3D(u,h,p,t,i,n.depth,0,d,c,null):r.texImage2D(u,h,p,t,i,0,d,c,null)}r.bindFramebuffer(e.FRAMEBUFFER,t),H(n)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,o,u,m.__webglTexture,0,z(n)):(u===e.TEXTURE_2D||u>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&u<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,o,u,m.__webglTexture,h),r.bindFramebuffer(e.FRAMEBUFFER,null)}function P(t,r,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),r.depthBuffer){let n=r.depthTexture,a=n&&n.isDepthTexture?n.type:null,s=_(r.stencilBuffer,a),o=r.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;H(r)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,z(r),s,r.width,r.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,z(r),s,r.width,r.height):e.renderbufferStorage(e.RENDERBUFFER,s,r.width,r.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,o,e.RENDERBUFFER,t)}else{let t=r.textures;for(let n=0;n<t.length;n++){let s=t[n],o=a.convert(s.format,s.colorSpace),u=a.convert(s.type),h=y(s.internalFormat,o,u,s.colorSpace);H(r)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,z(r),h,r.width,r.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,z(r),h,r.width,r.height):e.renderbufferStorage(e.RENDERBUFFER,h,r.width,r.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function F(t,n,s){let o=!0===n.isWebGLCubeRenderTarget;if(r.bindFramebuffer(e.FRAMEBUFFER,t),!(n.depthTexture&&n.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let u=i.get(n.depthTexture);if(u.__renderTarget=n,u.__webglTexture&&n.depthTexture.image.width===n.width&&n.depthTexture.image.height===n.height||(n.depthTexture.image.width=n.width,n.depthTexture.image.height=n.height,n.depthTexture.needsUpdate=!0),o){if(void 0===u.__webglInit&&(u.__webglInit=!0,n.depthTexture.addEventListener("dispose",b)),void 0===u.__webglTexture){let t;u.__webglTexture=e.createTexture(),r.bindTexture(e.TEXTURE_CUBE_MAP,u.__webglTexture),R(e.TEXTURE_CUBE_MAP,n.depthTexture);let i=a.convert(n.depthTexture.format),s=a.convert(n.depthTexture.type);1026===n.depthTexture.format?t=e.DEPTH_COMPONENT24:1027===n.depthTexture.format&&(t=e.DEPTH24_STENCIL8);for(let r=0;r<6;r++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,t,n.width,n.height,0,i,s,null)}}else M(n.depthTexture,0);let h=u.__webglTexture,d=z(n),c=o?e.TEXTURE_CUBE_MAP_POSITIVE_X+s:e.TEXTURE_2D,p=1027===n.depthTexture.format?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(1026===n.depthTexture.format)H(n)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,c,h,0,d):e.framebufferTexture2D(e.FRAMEBUFFER,p,c,h,0);else if(1027===n.depthTexture.format)H(n)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,c,h,0,d):e.framebufferTexture2D(e.FRAMEBUFFER,p,c,h,0);else throw Error("Unknown depthTexture format")}
358function D(t){let n=i.get(t),a=!0===t.isWebGLCubeRenderTarget;if(n.__boundDepthTexture!==t.depthTexture){let e=t.depthTexture;if(n.__depthDisposeCallback&&n.__depthDisposeCallback(),e){let t=()=>{delete n.__boundDepthTexture,delete n.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),n.__depthDisposeCallback=t}n.__boundDepthTexture=e}if(t.depthTexture&&!n.__autoAllocateDepthBuffer)if(a)for(let e=0;e<6;e++)F(n.__webglFramebuffer[e],t,e);else{let e=t.texture.mipmaps;e&&e.length>0?F(n.__webglFramebuffer[0],t,0):F(n.__webglFramebuffer,t,0)}else if(a){n.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(r.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[i]),void 0===n.__webglDepthbuffer[i])n.__webglDepthbuffer[i]=e.createRenderbuffer(),P(n.__webglDepthbuffer[i],t,!1);else{let r=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=n.__webglDepthbuffer[i];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,r,e.RENDERBUFFER,a)}}else{let i=t.texture.mipmaps;if(i&&i.length>0?r.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer[0]):r.bindFramebuffer(e.FRAMEBUFFER,n.__webglFramebuffer),void 0===n.__webglDepthbuffer)n.__webglDepthbuffer=e.createRenderbuffer(),P(n.__webglDepthbuffer,t,!1);else{let r=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,i=n.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,r,e.RENDERBUFFER,i)}}r.bindFramebuffer(e.FRAMEBUFFER,null)}let U=[],O=[];function z(e){return Math.min(n.maxSamples,e.samples)}function H(e){let r=i.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==r.__useRenderToTexture}function W(e,t){let r=e.colorSpace,i=e.format,n=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||r!==G&&""!==r&&(eN.getTransfer(r)===V?(1023!==i||1009!==n)&&en("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):ea("WebGLTextures: Unsupported texture color space:",r)),t}function j(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement?(h.width=e.naturalWidth||e.width,h.height=e.naturalHeight||e.height):"u">typeof VideoFrame&&e instanceof VideoFrame?(h.width=e.displayWidth,h.height=e.displayHeight):(h.width=e.width,h.height=e.height),h}this.allocateTextureUnit=function(){let e=A;return e>=n.maxTextures&&en("WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+n.maxTextures),A+=1,e},this.resetTextureUnits=function(){A=0},this.setTexture2D=M,this.setTexture2DArray=function(t,n){let a=i.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?B(a,t,n):(t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null),r.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+n))},this.setTexture3D=function(t,n){let a=i.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?B(a,t,n):r.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+n)},this.setTextureCube=function(t,s){let o=i.get(t);!0!==t.isCubeDepthTexture&&t.version>0&&o.__version!==t.version?function(t,s,o){if(6!==s.image.length)return;let l=N(t,s),u=s.source;r.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);let h=i.get(u);if(u.version!==h.__version||!0===l){let t;r.activeTexture(e.TEXTURE0+o);let i=eN.getPrimaries(eN.workingColorSpace),d=""===s.colorSpace?null:eN.getPrimaries(s.colorSpace),c=""===s.colorSpace||i===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,c);let p=s.isCompressedTexture||s.image[0].isCompressedTexture,f=s.image[0]&&s.image[0].isDataTexture,_=[];for(let e=0;e<6;e++)p||f?_[e]=f?s.image[e].image:s.image[e]:_[e]=m(s.image[e],!0,n.maxCubemapSize),_[e]=W(s,_[e]);let b=_[0],S=a.convert(s.format,s.colorSpace),T=a.convert(s.type),A=y(s.internalFormat,S,T,s.colorSpace),M=!0!==s.isVideoTexture,E=void 0===h.__version||!0===l,C=u.dataReady,w=x(s,b);
vendor: 4,468 bytes, line 358
358if(R(e.TEXTURE_CUBE_MAP,s),p){M&&E&&r.texStorage2D(e.TEXTURE_CUBE_MAP,w,A,b.width,b.height);for(let i=0;i<6;i++){t=_[i].mipmaps;for(let n=0;n<t.length;n++){let a=t[n];1023!==s.format?null!==S?M?C&&r.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,n,0,0,a.width,a.height,S,a.data):r.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,n,A,a.width,a.height,0,a.data):en("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):M?C&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,n,0,0,a.width,a.height,S,T,a.data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,n,A,a.width,a.height,0,S,T,a.data)}}}else{if(t=s.mipmaps,M&&E){t.length>0&&w++;let i=j(_[0]);r.texStorage2D(e.TEXTURE_CUBE_MAP,w,A,i.width,i.height)}for(let i=0;i<6;i++)if(f){M?C&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,0,0,_[i].width,_[i].height,S,T,_[i].data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,A,_[i].width,_[i].height,0,S,T,_[i].data);for(let n=0;n<t.length;n++){let a=t[n].image[i].image;M?C&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,n+1,0,0,a.width,a.height,S,T,a.data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,n+1,A,a.width,a.height,0,S,T,a.data)}}else{M?C&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,0,0,S,T,_[i]):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,A,S,T,_[i]);for(let n=0;n<t.length;n++){let a=t[n];M?C&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,n+1,0,0,S,T,a.image[i]):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+i,n+1,A,S,T,a.image[i])}}}g(s)&&v(e.TEXTURE_CUBE_MAP),h.__version=u.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}(o,t,s):r.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+s)},this.rebindTextures=function(t,r,n){let a=i.get(t);void 0!==r&&I(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==n&&D(t)},this.setupRenderTarget=function(t){let n=t.texture,o=i.get(t),l=i.get(n);t.addEventListener("dispose",S);let u=t.textures,h=!0===t.isWebGLCubeRenderTarget,d=u.length>1;if(!d&&(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=n.version,s.memory.textures++),h){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(n.mipmaps&&n.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let r=0;r<n.mipmaps.length;r++)o.__webglFramebuffer[t][r]=e.createFramebuffer()}else o.__webglFramebuffer[t]=e.createFramebuffer()}else{if(n.mipmaps&&n.mipmaps.length>0){o.__webglFramebuffer=[];for(let t=0;t<n.mipmaps.length;t++)o.__webglFramebuffer[t]=e.createFramebuffer()}else o.__webglFramebuffer=e.createFramebuffer();if(d)for(let t=0,r=u.length;t<r;t++){let r=i.get(u[t]);void 0===r.__webglTexture&&(r.__webglTexture=e.createTexture(),s.memory.textures++)}if(t.samples>0&&!1===H(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],r.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let r=0;r<u.length;r++){let i=u[r];o.__webglColorRenderbuffer[r]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,o.__webglColorRenderbuffer[r]);let n=a.convert(i.format,i.colorSpace),s=a.convert(i.type),l=y(i.internalFormat,n,s,i.colorSpace,!0===t.isXRRenderTarget),h=z(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,h,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+r,e.RENDERBUFFER,o.__webglColorRenderbuffer[r])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(o.__webglDepthRenderbuffer=e.createRenderbuffer(),P(o.__webglDepthRenderbuffer,t,!0)),r.bindFramebuffer(e.FRAMEBUFFER,null)}}if(h){r.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),R(e.TEXTURE_CUBE_MAP,n);for(let r=0;r<6;r++)if(n.mipmaps&&n.mipmaps.length>0)for(let i=0;i<n.mipmaps.length;i++)I(o.__webglFramebuffer[r][i],t,n,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+r,i);else I(o.__webglFramebuffer[r],t,n,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0);g(n)&&v(e.TEXTURE_CUBE_MAP),r.unbindTexture()}else if(d){for(let n=0,a=u.length;n<a;n++){let a=u[n],s=i.get(a),l=e.TEXTURE_2D;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(l=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),r.bindTexture(l,s.__webglTexture),R(l,a),I(o.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+n,l,0),g(a)&&v(l)}r.unbindTexture()}else{let i=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(i=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),r.bindTexture(i,l.__webglTexture),R(i,n),n.mipmaps&&n.mipmaps.length>0)for(let r=0;r<n.mipmaps.length;
358r++)I(o.__webglFramebuffer[r],t,n,e.COLOR_ATTACHMENT0,i,r);else I(o.__webglFramebuffer,t,n,e.COLOR_ATTACHMENT0,i,0);g(n)&&v(i),r.unbindTexture()}t.depthBuffer&&D(t)},this.updateRenderTargetMipmap=function(t){let n=t.textures;for(let a=0,s=n.length;a<s;a++){let s=n[a];if(g(s)){let n=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D,a=i.get(s).__webglTexture;r.bindTexture(n,a),v(n),r.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0){if(!1===H(t)){let n=t.textures,a=t.width,s=t.height,o=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=i.get(t),d=n.length>1;if(d)for(let t=0;t<n.length;t++)r.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),r.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);r.bindFramebuffer(e.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer);let c=t.texture.mipmaps;c&&c.length>0?r.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglFramebuffer[0]):r.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let r=0;r<n.length;r++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(o|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(o|=e.STENCIL_BUFFER_BIT)),d){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,h.__webglColorRenderbuffer[r]);let t=i.get(n[r]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,s,0,0,a,s,o,e.NEAREST),!0===u&&(U.length=0,O.length=0,U.push(e.COLOR_ATTACHMENT0+r),t.depthBuffer&&!1===t.resolveDepthBuffer&&(U.push(l),O.push(l),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,O)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,U))}if(r.bindFramebuffer(e.READ_FRAMEBUFFER,null),r.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),d)for(let t=0;t<n.length;t++){r.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,h.__webglColorRenderbuffer[t]);let a=i.get(n[t]).__webglTexture;r.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}r.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&u){let r=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[r])}}},this.setupDepthRenderbuffer=D,this.setupFrameBufferTexture=I,this.useMultisampledRTT=H,this.isReversedDepthBuffer=function(){return r.buffers.depth.getReversed()}}function hA(e,t){return{convert:function(r,i=""){let n,a=eN.getTransfer(i);if(1009===r)return e.UNSIGNED_BYTE;if(1017===r)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===r)return e.UNSIGNED_SHORT_5_5_5_1;if(35902===r)return e.UNSIGNED_INT_5_9_9_9_REV;if(35899===r)return e.UNSIGNED_INT_10F_11F_11F_REV;if(1010===r)return e.BYTE;if(1011===r)return e.SHORT;if(1012===r)return e.UNSIGNED_SHORT;if(1013===r)return e.INT;if(1014===r)return e.UNSIGNED_INT;if(1015===r)return e.FLOAT;if(1016===r)return e.HALF_FLOAT;if(1021===r)return e.ALPHA;if(1022===r)return e.RGB;if(1023===r)return e.RGBA;if(1026===r)return e.DEPTH_COMPONENT;if(1027===r)return e.DEPTH_STENCIL;if(1028===r)return e.RED;if(1029===r)return e.RED_INTEGER;if(1030===r)return e.RG;if(1031===r)return e.RG_INTEGER;if(1033===r)return e.RGBA_INTEGER;if(33776===r||33777===r||33778===r||33779===r)if(a===V){if(null===(n=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(33776===r)return n.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===r)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===r)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===r)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(n=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===r)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===r)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===r)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===r)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===r||35841===r||35842===r||35843===r){if(null===(n=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===r)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===r)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===r)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===r)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===r||37492===r||37496===r||37488===r||37489===r||37490===r||37491===r){if(null===(n=t.get("WEBGL_compressed_texture_etc")))return null;if(36196===r||37492===r)return a===V?n.COMPRESSED_SRGB8_ETC2:n.COMPRESSED_RGB8_ETC2;if(37496===r)return a===V?n.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:n.COMPRESSED_RGBA8_ETC2_EAC;
358if(37488===r)return n.COMPRESSED_R11_EAC;if(37489===r)return n.COMPRESSED_SIGNED_R11_EAC;if(37490===r)return n.COMPRESSED_RG11_EAC;if(37491===r)return n.COMPRESSED_SIGNED_RG11_EAC}if(37808===r||37809===r||37810===r||37811===r||37812===r||37813===r||37814===r||37815===r||37816===r||37817===r||37818===r||37819===r||37820===r||37821===r){if(null===(n=t.get("WEBGL_compressed_texture_astc")))return null;if(37808===r)return a===V?n.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:n.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===r)return a===V?n.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:n.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===r)return a===V?n.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:n.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===r)return a===V?n.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:n.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===r)return a===V?n.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:n.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===r)return a===V?n.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:n.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===r)return a===V?n.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:n.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===r)return a===V?n.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:n.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===r)return a===V?n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:n.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===r)return a===V?n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:n.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===r)return a===V?n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:n.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===r)return a===V?n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:n.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===r)return a===V?n.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:n.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===r)return a===V?n.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:n.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===r||36494===r||36495===r){if(null===(n=t.get("EXT_texture_compression_bptc")))return null;if(36492===r)return a===V?n.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:n.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===r)return n.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===r)return n.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===r||36284===r||36285===r||36286===r){if(null===(n=t.get("EXT_texture_compression_rgtc")))return null;if(36283===r)return n.COMPRESSED_RED_RGTC1_EXT;if(36284===r)return n.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===r)return n.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===r)return n.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return 1020===r?e.UNSIGNED_INT_24_8:void 0!==e[r]?e[r]:null}}}let hM=` 359void main() { 360 361 gl_Position = vec4( position, 1.0 ); 362 363}`,hE=` 364uniform sampler2DArray depthColor; 365uniform float depthWidth; 366uniform float depthHeight; 367 368void main() { 369 370 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 371 372 if ( coord.x >= 1.0 ) { 373 374 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 375 376 } else { 377 378 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 379 380 } 381 382}`;class hC{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(null===this.texture){let r=new n_(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=r}}getMesh(e){if(null!==this.texture&&null===this.mesh){let t=e.cameras[0].viewport,r=new aB({vertexShader:hM,fragmentShader:hE,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new r8(new ag(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class hw extends eu{constructor(e,t){super();const r=this;let i=null,n=1,a=null,s="local-floor",o=1,l=null,u=null,h=null,d=null,c=null,p=null;const f="u">typeof XRWebGLBinding,m=new hC,g={},v=t.getContextAttributes();let y=null,_=null;const x=[],b=[],S=new eb;let T=null;const A=new sC;A.viewport=new ek;const M=new sC;M.viewport=new ek;const E=[A,M],C=new s2;let w=null,R=null;function N(e){let t=b.indexOf(e.inputSource);if(-1===t)return;let r=x[t];void 0!==r&&(r.update(e.inputSource,e.frame,l||a),r.dispatchEvent({type:e.type,data:e.inputSource}))}function L(){i.removeEventListener("select",N),i.removeEventListener("selectstart",N),i.removeEventListener("selectend",N),i.removeEventListener("squeeze",N),i.removeEventListener("squeezestart",N),i.removeEventListener("squeezeend",N),i.removeEventListener("end",L),i.removeEventListener("inputsourceschange",B);for(let e=0;e<x.length;e++){let t=b[e];null!==t&&(b[e]=null,x[e].disconnect(t))}for(let e in w=null,R=null,m.reset(),g)delete g[e];e.setRenderTarget(y),c=null,d=null,h=null,i=null,_=null,U.stop(),r.isPresenting=!1,e.setPixelRatio(T),e.setSize(S.width,S.height,!1),r.dispatchEvent({type:"sessionend"})}function B(e){for(let t=0;t<e.removed.length;t++){let r=e.removed[t],i=b.indexOf(r);i>=0&&(b[i]=null,x[i].disconnect(r))}for(let t=0;t<e.added.length;t++){let r=e.added[t],i=b.indexOf(r);if(-1===i){for(let e=0;e<x.length;e++)if(e>=b.length){b.push(r),i=e;break}else if(null===b[e]){b[e]=r,i=e;break}if(-1===i)break}let n=x[i];n&&n.connect(r)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=x[e];return void 0===t&&(t=new tp,x[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=x[e];return void 0===t&&(t=new tp,x[e]=t),t.getGripSpace()},this.getHand=function(e){let t=x[e];return void 0===t&&(t=new tp,x[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){n=e,!0===r.isPresenting&&en("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===r.isPresenting&&en("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==d?d:c},this.getBinding=function(){return null===h&&f&&(h=new XRWebGLBinding(i,t)),h},this.getFrame=function(){return p}
382,this.getSession=function(){return i},this.setSession=async function(u){if(null!==(i=u)){if(y=e.getRenderTarget(),i.addEventListener("select",N),i.addEventListener("selectstart",N),i.addEventListener("selectend",N),i.addEventListener("squeeze",N),i.addEventListener("squeezestart",N),i.addEventListener("squeezeend",N),i.addEventListener("end",L),i.addEventListener("inputsourceschange",B),!0!==v.xrCompatible&&await t.makeXRCompatible(),T=e.getPixelRatio(),e.getSize(S),f&&"createProjectionLayer"in XRWebGLBinding.prototype){let r=null,a=null,s=null;v.depth&&(s=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,r=v.stencil?1027:1026,a=v.stencil?1020:1014);let o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:n};d=(h=this.getBinding()).createProjectionLayer(o),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),_=new ez(d.textureWidth,d.textureHeight,{format:1023,type:1009,depthTexture:new nv(d.textureWidth,d.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,r),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:4*!!v.antialias,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}else{let r={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:n};c=new XRWebGLLayer(i,t,r),i.updateRenderState({baseLayer:c}),e.setPixelRatio(1),e.setSize(c.framebufferWidth,c.framebufferHeight,!1),_=new ez(c.framebufferWidth,c.framebufferHeight,{format:1023,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil,resolveDepthBuffer:!1===c.ignoreDepthValues,resolveStencilBuffer:!1===c.ignoreDepthValues})}_.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await i.requestReferenceSpace(s),U.setContext(i),U.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};const I=new eT,P=new eT;function F(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var t,r,n;if(null===i)return;let a=e.near,s=e.far;null!==m.texture&&(m.depthNear>0&&(a=m.depthNear),m.depthFar>0&&(s=m.depthFar)),C.near=M.near=A.near=a,C.far=M.far=A.far=s,(w!==C.near||R!==C.far)&&(i.updateRenderState({depthNear:C.near,depthFar:C.far}),w=C.near,R=C.far),C.layers.mask=6|e.layers.mask,A.layers.mask=-5&C.layers.mask,M.layers.mask=-3&C.layers.mask;let o=e.parent,l=C.cameras;F(C,o);for(let e=0;e<l.length;e++)F(l[e],o);2===l.length?function(e,t,r){I.setFromMatrixPosition(t.matrixWorld),P.setFromMatrixPosition(r.matrixWorld);let i=I.distanceTo(P),n=t.projectionMatrix.elements,a=r.projectionMatrix.elements,s=n[14]/(n[10]-1),o=n[14]/(n[10]+1),l=(n[9]+1)/n[5],u=(n[9]-1)/n[5],h=(n[8]-1)/n[0],d=(a[8]+1)/a[0],c=i/(-h+d),p=-(c*h);if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(p),e.translateZ(c),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===n[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=s+c,r=o+c;e.projectionMatrix.makePerspective(s*h-p,s*d+(i-p),l*o/r*t,u*o/r*t,t,r),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(C,A,M):C.projectionMatrix.copy(A.projectionMatrix),t=e,r=C,null===(n=o)?t.matrix.copy(r.matrixWorld):(t.matrix.copy(n.matrixWorld),t.matrix.invert(),t.matrix.multiply(r.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(r.projectionMatrix),t.projectionMatrixInverse.copy(r.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*ep*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)},this.getCamera=function(){return C},this.getFoveation=function(){if(null!==d||null!==c)return o},this.setFoveation=function(e){o=e,null!==d&&(d.fixedFoveation=e),null!==c&&void 0!==c.fixedFoveation&&(c.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==m.texture},this.getDepthSensingMesh=function(){return m.getMesh(C)},this.getCameraTexture=function(e){return g[e]};let D=null;const U=new lc;U.setAnimationLoop(function(t,n){if(u=n.getViewerPose(l||a),p=n,null!==u){let t=u.views;null!==c&&(e.setRenderTargetFramebuffer(_,c.framebuffer),e.setRenderTarget(_));let n=!1;t.length!==C.cameras.length&&(C.cameras.length=0,n=!0);for(let r=0;r<t.length;r++){let i=t[r],a=null;if(null!==c)a=c.getViewport(i);else{let t=h.getViewSubImage(d,i);a=t.viewport,0===r&&(e.setRenderTargetTextures(_,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(_))}let s=E[r];void 0===s&&((s=new sC).layers.enable(r),s.viewport=new ek,E[r]=s),s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.projectionMatrix.fromArray(i.projectionMatrix),s.projectionMatrixInverse.copy(s.projectionMatrix).invert(),s.viewport.set(a.x,a.y,a.width,a.height),0===r&&(C.matrix.copy(s.matrix
382),C.matrix.decompose(C.position,C.quaternion,C.scale)),!0===n&&C.cameras.push(s)}let a=i.enabledFeatures;if(a&&a.includes("depth-sensing")&&"gpu-optimized"==i.depthUsage&&f){let e=(h=r.getBinding()).getDepthInformation(t[0]);e&&e.isValid&&e.texture&&m.init(e,i.renderState)}if(a&&a.includes("camera-access")&&f){e.state.unbindTexture(),h=r.getBinding();for(let e=0;e<t.length;e++){let r=t[e].camera;if(r){let e=g[r];e||(e=new n_,g[r]=e);let t=h.getCameraImage(r);e.sourceTexture=t}}}}for(let e=0;e<x.length;e++){let t=b[e],r=x[e];null!==t&&void 0!==r&&r.update(t,n,l||a)}D&&D(t,n),n.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:n}),p=null}),this.setAnimationLoop=function(e){D=e},this.dispose=function(){}}}let hR=new e3,hN=new eq;function hL(e,t){function r(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function i(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map,r(i.map,e.mapTransform)),i.alphaMap&&(e.alphaMap.value=i.alphaMap,r(i.alphaMap,e.alphaMapTransform)),i.bumpMap&&(e.bumpMap.value=i.bumpMap,r(i.bumpMap,e.bumpMapTransform),e.bumpScale.value=i.bumpScale,1===i.side&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,r(i.normalMap,e.normalMapTransform),e.normalScale.value.copy(i.normalScale),1===i.side&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,r(i.displacementMap,e.displacementMapTransform),e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap,r(i.emissiveMap,e.emissiveMapTransform)),i.specularMap&&(e.specularMap.value=i.specularMap,r(i.specularMap,e.specularMapTransform)),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest);let n=t.get(i),a=n.envMap,s=n.envMapRotation;a&&(e.envMap.value=a,hR.copy(s),hR.x*=-1,hR.y*=-1,hR.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(hR.y*=-1,hR.z*=-1),e.envMapRotation.value.setFromMatrix4(hN.makeRotationFromEuler(hR)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,r(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,r(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,r){r.color.getRGB(t.fogColor.value,aN(e)),r.isFog?(t.fogNear.value=r.near,t.fogFar.value=r.far):r.isFogExp2&&(t.fogDensity.value=r.density)},refreshMaterialUniforms:function(e,n,a,s,o){var l,u,h,d,c,p,f,m,g,v,y,_,x,b,S,T,A,M,E,C,w,R,N;let L;n.isMeshBasicMaterial?i(e,n):n.isMeshLambertMaterial?(i(e,n),n.envMap&&(e.envMapIntensity.value=n.envMapIntensity)):n.isMeshToonMaterial?(i(e,n),l=e,(u=n).gradientMap&&(l.gradientMap.value=u.gradientMap)):n.isMeshPhongMaterial?(i(e,n),h=e,d=n,h.specular.value.copy(d.specular),h.shininess.value=Math.max(d.shininess,1e-4),n.envMap&&(e.envMapIntensity.value=n.envMapIntensity)):n.isMeshStandardMaterial?(i(e,n),c=e,p=n,c.metalness.value=p.metalness,p.metalnessMap&&(c.metalnessMap.value=p.metalnessMap,r(p.metalnessMap,c.metalnessMapTransform)),c.roughness.value=p.roughness,p.roughnessMap&&(c.roughnessMap.value=p.roughnessMap,r(p.roughnessMap,c.roughnessMapTransform)),p.envMap&&(c.envMapIntensity.value=p.envMapIntensity),n.isMeshPhysicalMaterial&&(f=e,m=n,g=o,f.ior.value=m.ior,m.sheen>0&&(f.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),f.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(f.sheenColorMap.value=m.sheenColorMap,r(m.sheenColorMap,f.sheenColorMapTransform)),m.sheenRoughnessMap&&(f.sheenRoughnessMap.value=m.sheenRoughnessMap,r(m.sheenRoughnessMap,f.sheenRoughnessMapTransform))),m.clearcoat>0&&(f.clearcoat.value=m.clearcoat,f.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(f.clearcoatMap.value=m.clearcoatMap,r(m.clearcoatMap,f.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,r(m.clearcoatRoughnessMap,f.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(f.clearcoatNormalMap.value=m.clearcoatNormalMap,r(m.clearcoatNormalMap,f.clearcoatNormalMapTransform),f.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),1===m.side&&f.clearcoatNormalScale.value.negate())),m.dispersion>
3820&&(f.dispersion.value=m.dispersion),m.iridescence>0&&(f.iridescence.value=m.iridescence,f.iridescenceIOR.value=m.iridescenceIOR,f.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(f.iridescenceMap.value=m.iridescenceMap,r(m.iridescenceMap,f.iridescenceMapTransform)),m.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=m.iridescenceThicknessMap,r(m.iridescenceThicknessMap,f.iridescenceThicknessMapTransform))),m.transmission>0&&(f.transmission.value=m.transmission,f.transmissionSamplerMap.value=g.texture,f.transmissionSamplerSize.value.set(g.width,g.height),m.transmissionMap&&(f.transmissionMap.value=m.transmissionMap,r(m.transmissionMap,f.transmissionMapTransform)),f.thickness.value=m.thickness,m.thicknessMap&&(f.thicknessMap.value=m.thicknessMap,r(m.thicknessMap,f.thicknessMapTransform)),f.attenuationDistance.value=m.attenuationDistance,f.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(f.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(f.anisotropyMap.value=m.anisotropyMap,r(m.anisotropyMap,f.anisotropyMapTransform))),f.specularIntensity.value=m.specularIntensity,f.specularColor.value.copy(m.specularColor),m.specularColorMap&&(f.specularColorMap.value=m.specularColorMap,r(m.specularColorMap,f.specularColorMapTransform)),m.specularIntensityMap&&(f.specularIntensityMap.value=m.specularIntensityMap,r(m.specularIntensityMap,f.specularIntensityMapTransform)))):n.isMeshMatcapMaterial?(i(e,n),v=e,(y=n).matcap&&(v.matcap.value=y.matcap)):n.isMeshDepthMaterial?i(e,n):n.isMeshDistanceMaterial?(i(e,n),_=e,x=n,L=t.get(x).light,_.referencePosition.value.setFromMatrixPosition(L.matrixWorld),_.nearDistance.value=L.shadow.camera.near,_.farDistance.value=L.shadow.camera.far):n.isMeshNormalMaterial?i(e,n):n.isLineBasicMaterial?(b=e,S=n,b.diffuse.value.copy(S.color),b.opacity.value=S.opacity,S.map&&(b.map.value=S.map,r(S.map,b.mapTransform)),n.isLineDashedMaterial&&(T=e,A=n,T.dashSize.value=A.dashSize,T.totalSize.value=A.dashSize
382+A.gapSize,T.scale.value=A.scale)):n.isPointsMaterial?(M=e,E=n,C=a,w=s,M.diffuse.value.copy(E.color),M.opacity.value=E.opacity,M.size.value=E.size*C,M.scale.value=.5*w,E.map&&(M.map.value=E.map,r(E.map,M.uvTransform)),E.alphaMap&&(M.alphaMap.value=E.alphaMap,r(E.alphaMap,M.alphaMapTransform)),E.alphaTest>0&&(M.alphaTest.value=E.alphaTest)):n.isSpriteMaterial?(R=e,N=n,R.diffuse.value.copy(N.color),R.opacity.value=N.opacity,R.rotation.value=N.rotation,N.map&&(R.map.value=N.map,r(N.map,R.mapTransform)),N.alphaMap&&(R.alphaMap.value=N.alphaMap,r(N.alphaMap,R.alphaMapTransform)),N.alphaTest>0&&(R.alphaTest.value=N.alphaTest)):n.isShadowMaterial?(e.color.value.copy(n.color),e.opacity.value=n.opacity):n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)}}}function hB(e,t,r,i){let n={},a={},s=[],o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e){let t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?en("WebGLRenderer: Texture samplers can not be part of an uniforms group."):en("WebGLRenderer: Unsupported uniform value type.",e),t}function u(t){let r=t.target;r.removeEventListener("dispose",u);let i=s.indexOf(r.__bindingPointIndex);s.splice(i,1),e.deleteBuffer(n[r.id]),delete n[r.id],delete a[r.id]}return{bind:function(e,t){let r=t.program;i.uniformBlockBinding(e,r)},update:function(r,h){var d;let c,p,f,m,g=n[r.id];void 0===g&&(function(e){let t=e.uniforms,r=0;for(let e=0,i=t.length;e<i;e++){let i=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=i.length;e<t;e++){let t=i[e],n=Array.isArray(t.value)?t.value:[t.value];for(let e=0,i=n.length;e<i;e++){let i=l(n[e]),a=r%16,s=a%i.boundary,o=a+s;r+=s,0!==o&&16-o<i.storage&&(r+=16-o),t.__data=new Float32Array(i.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=r,r+=i.storage}}}let i=r%16;i>0&&(r+=16-i),e.__size=r,e.__cache={}}(r),(d=r).__bindingPointIndex=c=function(){for(let e=0;e<o;e++)if(-1===s.indexOf(e))return s.push(e),e;return ea("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}(),p=e.createBuffer(),f=d.__size,m=d.usage,e.bindBuffer(e.UNIFORM_BUFFER,p),e.bufferData(e.UNIFORM_BUFFER,f,m),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,c,p),g=p,n[r.id]=g,r.addEventListener("dispose",u));let v=h.program;i.updateUBOMapping(r,v);let y=t.render.frame;a[r.id]!==y&&(function(t){let r=n[t.id],i=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,r);for(let t=0,r=i.length;t<r;t++){let r=Array.isArray(i[t])?i[t]:[i[t]];for(let i=0,n=r.length;i<n;i++){let n=r[i];if(!0===function(e,t,r,i){let n=e.value,a=t+"_"+r;if(void 0===i[a])return"number"==typeof n||"boolean"==typeof n?i[a]=n:i[a]=n.clone(),!0;{let e=i[a];if("number"==typeof n||"boolean"==typeof n){if(e!==n)return i[a]=n,!0}else if(!1===e.equals(n))return e.copy(n),!0}return!1}(n,t,i,a)){let t=n.__offset,r=Array.isArray(n.value)?n.value:[n.value],i=0;for(let a=0;a<r.length;a++){let s=r[a],o=l(s);"number"==typeof s||"boolean"==typeof s?(n.__data[0]=s,e.bufferSubData(e.UNIFORM_BUFFER,t+i,n.__data)):s.isMatrix3?(n.__data[0]=s.elements[0],n.__data[1]=s.elements[1],n.__data[2]=s.elements[2],n.__data[3]=0,n.__data[4]=s.elements[3],n.__data[5]=s.elements[4],n.__data[6]=s.elements[5],n.__data[7]=0,n.__data[8]=s.elements[6],n.__data[9]=s.elements[7],n.__data[10]=s.elements[8],n.__data[11]=0):(s.toArray(n.__data,i),i+=o.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,n.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(r),a[r.id]=y)},dispose:function(){for(let t in n)e.deleteBuffer(n[t]);s=[],n={},a={}}}}let hI=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,10
382751,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]),hP=null;class hF{constructor(e={}){let t,r,i,n,a,s,o,l,u,h,d,c,p,f,m,g,v,y,_,x,b,S,T,A;const{canvas:M=Y(),context:E=null,depth:C=!0,stencil:w=!1,alpha:R=!1,antialias:N=!1,premultipliedAlpha:L=!0,preserveDrawingBuffer:B=!1,powerPreference:I="default",failIfMajorPerformanceCaveat:P=!1,reversedDepthBuffer:F=!1,outputBufferType:D=1009}=e;if(this.isWebGLRenderer=!0,null!==E){if("u">typeof WebGLRenderingContext&&E instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");t=E.getContextAttributes().alpha}else t=R;const U=new Set([1033,1031,1029]),k=new Set([1009,1014,1012,1020,1017,1018]),V=new Uint32Array(4),z=new Int32Array(4);let H=null,W=null;const j=[],X=[];let q=null;this.domElement=M,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=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const $=this;let J=!1;this._outputColorSpace=O;let K=0,Q=0,Z=null,ee=-1,et=null;const ei=new ek,el=new ek;let eu=null;const eh=new ty(0);let ed=0,ec=M.width,ep=M.height,ef=1,em=null,eg=null;const ev=new ek(0,0,ec,ep),ey=new ek(0,0,ec,ep);let e_=!1;const ex=new iL;let eb=!1,eS=!1;const eA=new eq,eM=new eT,eE=new ek,eC={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ew=!1;function eR(){return null===Z?ef:1}let eL=E;function eB(e,t){return M.getContext(e,t)}try{if("setAttribute"in M&&M.setAttribute("data-engine","three.js r183"),M.addEventListener("webglcontextlost",eF,!1),M.addEventListener("webglcontextrestored",eD,!1),M.addEventListener("webglcontextcreationerror",eU,!1),null===eL){const e="webgl2";if(eL=eB(e,{alpha:!0,depth:C,stencil:w,antialias:N,premultipliedAlpha:L,preserveDrawingBuffer:B,powerPreference:I,failIfMajorPerformanceCaveat:P}),null===eL)if(eB(e))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(e){throw ea("WebGLRenderer: "+e.message),e}function eI(){(r=new lV(eL)).init(),S=new hA(eL,r),i=new lT(eL,r,e,S),n=new hS(eL,r),i.reversedDepthBuffer&&F&&n.buffers.depth.setReversed(!0),a=new lW(eL),s=new ha,o=new hT(eL,r,n,s,i,S,a),l=new lk($),u=new lp(eL),T=new lb(eL,u),h=new lz(eL,u,a,T),d=new lX(eL,h,u,T,a),_=new lj(eL,i,o),g=new lA(s),c=new hn($,l,r,i,T,g),p=new hL($,s),f=new hu,m=new hm(r),y=new lx($,l,n,d,t,L),v=new hb($,d,i),A=new hB(eL,a,i,n),x=new lS(eL,r,a),b=new lH(eL,r,a),a.programs=c.programs,$.capabilities=i,$.extensions=r,$.properties=s,$.renderLists=f,$.shadowMap=v,$.state=n,$.info=a}eI(),1009!==D&&(q=new l$(D,M.width,M.height,C,w));const eP=new hw($,eL);function eF(e){e.preventDefault(),er("WebGLRenderer: Context Lost."),J=!0}function eD(){er("WebGLRenderer: Context Restored."),J=!1;let e=a.autoReset,t=v.enabled,r=v.autoUpdate,i=v.needsUpdate,n=v.type;eI(),a.autoReset=e,v.enabled=t,v.autoUpdate=r,v.needsUpdate=i,v.type=n}function eU(e){ea("WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function eO(e){var t,r;let i,n=e.target;n.removeEventListener("dispose",eO),r=t=n,void 0!==(i=s.get(r).programs)&&(i.forEach(function(e){c.releaseProgram(e)}),r.isShaderMaterial&&c.releaseShaderCache(r)),s.remove(t)}function eG(e,t,r){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,eQ(e,t,r),e.side=0,e.needsUpdate=!0,eQ(e,t,r),e.side=2):eQ(e,t,r)}this.xr=eP,this.getContext=function(){return eL},this.getContextAttributes=function(){return eL.getContextAttributes()},this.forceContextLoss=function(){let e=r.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=r.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return ef},this.setPixelRatio=function(e){void 0!==e&&(ef=e,this.setSize(ec,ep,!1))}
382,this.getSize=function(e){return e.set(ec,ep)},this.setSize=function(e,t,r=!0){eP.isPresenting?en("WebGLRenderer: Can't change size while VR device is presenting."):(ec=e,ep=t,M.width=Math.floor(e*ef),M.height=Math.floor(t*ef),!0===r&&(M.style.width=e+"px",M.style.height=t+"px"),null!==q&&q.setSize(M.width,M.height),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(ec*ef,ep*ef).floor()},this.setDrawingBufferSize=function(e,t,r){ec=e,ep=t,ef=r,M.width=Math.floor(e*r),M.height=Math.floor(t*r),this.setViewport(0,0,e,t)},this.setEffects=function(e){if(1009===D)return void console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");if(e){for(let t=0;t<e.length;t++)if(!0===e[t].isOutputPass){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}q.setEffects(e||[])},this.getCurrentViewport=function(e){return e.copy(ei)},this.getViewport=function(e){return e.copy(ev)},this.setViewport=function(e,t,r,i){e.isVector4?ev.set(e.x,e.y,e.z,e.w):ev.set(e,t,r,i),n.viewport(ei.copy(ev).multiplyScalar(ef).round())},this.getScissor=function(e){return e.copy(ey)},this.setScissor=function(e,t,r,i){e.isVector4?ey.set(e.x,e.y,e.z,e.w):ey.set(e,t,r,i),n.scissor(el.copy(ey).multiplyScalar(ef).round())},this.getScissorTest=function(){return e_},this.setScissorTest=function(e){n.setScissorTest(e_=e)},this.setOpaqueSort=function(e){em=e},this.setTransparentSort=function(e){eg=e},this.getClearColor=function(e){return e.copy(y.getClearColor())},this.setClearColor=function(){y.setClearColor(...arguments)},this.getClearAlpha=function(){return y.getClearAlpha()},this.setClearAlpha=function(){y.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,r=!0){let i=0;if(e){let e=!1;if(null!==Z){let t=Z.texture.format;e=U.has(t)}if(e){let e=Z.texture.type,t=k.has(e),r=y.getClearColor(),i=y.getClearAlpha(),n=r.r,a=r.g,s=r.b;t?(V[0]=n,V[1]=a,V[2]=s,V[3]=i,eL.clearBufferuiv(eL.COLOR,0,V)):(z[0]=n,z[1]=a,z[2]=s,z[3]=i,eL.clearBufferiv(eL.COLOR,0,z))}else i|=eL.COLOR_BUFFER_BIT}t&&(i|=eL.DEPTH_BUFFER_BIT),r&&(i|=eL.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(0xffffffff)),0!==i&&eL.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){M.removeEventListener("webglcontextlost",eF,!1),M.removeEventListener("webglcontextrestored",eD,!1),M.removeEventListener("webglcontextcreationerror",eU,!1),y.dispose(),f.dispose(),m.dispose(),s.dispose(),l.dispose(),d.dispose(),T.dispose(),A.dispose(),c.dispose(),eP.dispose(),eP.removeEventListener("sessionstart",eH),eP.removeEventListener("sessionend",eW),ej.stop()},this.renderBufferDirect=function(e,t,a,d,c,f){let m;null===t&&(t=eC);let v=c.isMesh&&0>c.matrixWorld.determinant(),y=function(e,t,r,a,u){var h,d;!0!==t.isScene&&(t=eC),o.resetTextureUnits();let c=t.fog,f=a.isMeshStandardMaterial||a.isMeshLambertMaterial||a.isMeshPhongMaterial?t.environment:null,m=null===Z?$.outputColorSpace:!0===Z.isXRRenderTarget?Z.texture.colorSpace:G,v=a.isMeshStandardMaterial||a.isMeshLambertMaterial&&!a.envMap||a.isMeshPhongMaterial&&!a.envMap,y=l.get(a.envMap||f,v),x=!0===a.vertexColors&&!!r.attributes.color&&4===r.attributes.color.itemSize,b=!!r.attributes.tangent&&(!!a.normalMap||a.anisotropy>0),S=!!r.morphAttributes.position,T=!!r.morphAttributes.normal,M=!!r.morphAttributes.color,E=0;a.toneMapped&&(null===Z||!0===Z.isXRRenderTarget)&&(E=$.toneMapping);let C=r.morphAttributes.position||r.morphAttributes.normal||r.morphAttributes.color,w=void 0!==C?C.length:0,R=s.get(a),N=W.state.lights;if(!0===eb&&(!0===eS||e!==et)){let t=e===et&&a.id===ee;g.setState(a,e,t)}let L=!1;a.version===R.__version?R.needsLights&&R.lightsStateVersion!==N.state.version||R.outputColorSpace!==m||u.isBatchedMesh&&!1===R.batching?L=!0:u.isBatchedMesh||!0!==R.batching?u.isBatchedMesh&&!0===R.batchingColor&&null===u.colorTexture||u.isBatchedMesh&&!1===R.batchingColor&&null!==u.colorTexture||u.isInstancedMesh&&
382!1===R.instancing?L=!0:u.isInstancedMesh||!0!==R.instancing?u.isSkinnedMesh&&!1===R.skinning?L=!0:u.isSkinnedMesh||!0!==R.skinning?u.isInstancedMesh&&!0===R.instancingColor&&null===u.instanceColor||u.isInstancedMesh&&!1===R.instancingColor&&null!==u.instanceColor||u.isInstancedMesh&&!0===R.instancingMorph&&null===u.morphTexture||u.isInstancedMesh&&!1===R.instancingMorph&&null!==u.morphTexture||R.envMap!==y||!0===a.fog&&R.fog!==c||void 0!==R.numClippingPlanes&&(R.numClippingPlanes!==g.numPlanes||R.numIntersection!==g.numIntersection)||R.vertexAlphas!==x||R.vertexTangents!==b||R.morphTargets!==S||R.morphNormals!==T||R.morphColors!==M||R.toneMapping!==E?L=!0:R.morphTargetsCount!==w&&(L=!0):L=!0:L=!0:L=!0:(L=!0,R.__version=a.version);let B=R.currentProgram;!0===L&&(B=eQ(a,t,u));let I=!1,P=!1,F=!1,D=B.getUniforms(),U=R.uniforms;if(n.useProgram(B.program)&&(I=!0,P=!0,F=!0),a.id!==ee&&(ee=a.id,P=!0),I||et!==e){n.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),D.setValue(eL,"projectionMatrix",e.projectionMatrix),D.setValue(eL,"viewMatrix",e.matrixWorldInverse);let t=D.map.cameraPosition;void 0!==t&&t.setValue(eL,eM.setFromMatrixPosition(e.matrixWorld)),i.logarithmicDepthBuffer&&D.setValue(eL,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial)&&D.setValue(eL,"isOrthographic",!0===e.isOrthographicCamera),et!==e&&(et=e,P=!0,F=!0)}if(R.needsLights&&(N.state.directionalShadowMap.length>0&&D.setValue(eL,"directionalShadowMap",N.state.directionalShadowMap,o),N.state.spotShadowMap.length>0&&D.setValue(eL,"spotShadowMap",N.state.spotShadowMap,o),N.state.pointShadowMap.length>0&&D.setValue(eL,"pointShadowMap",N.state.pointShadowMap,o)),u.isSkinnedMesh){D.setOptional(eL,u,"bindMatrix"),D.setOptional(eL,u,"bindMatrixInverse");let e=u.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),D.setValue(eL,"boneTexture",e.boneTexture,o))}u.isBatchedMesh&&(D.setOptional(eL,u,"batchingTexture"),D.setValue(eL,"batchingTexture",u._matricesTexture,o),D.setOptional(eL,u,"batchingIdTexture"),D.setValue(eL,"batchingIdTexture",u._indirectTexture,o),D.setOptional(eL,u,"batchingColorTexture"),null!==u._colorsTexture&&D.setValue(eL,"batchingColorTexture",u._colorsTexture,o));let O=r.morphAttributes;if((void 0!==O.position||void 0!==O.normal||void 0!==O.color)&&_.update(u,r,B),(P||R.receiveShadow!==u.receiveShadow)&&(R.receiveShadow=u.receiveShadow,D.setValue(eL,"receiveShadow",u.receiveShadow)),(a.isMeshStandardMaterial||a.isMeshLambertMaterial||a.isMeshPhongMaterial)&&null===a.envMap&&null!==t.environment&&(U.envMapIntensity.value=t.environmentIntensity),void 0!==U.dfgLUT&&(U.dfgLUT.value=(null===hP&&((hP=new ih(hI,16,16,1030,1016)).name="DFG_LUT",hP.minFilter=1006,hP.magFilter=1006,hP.wrapS=1001,hP.wrapT=1001,hP.generateMipmaps=!1,hP.needsUpdate=!0),hP)),P&&(D.setValue(eL,"toneMappingExposure",$.toneMappingExposure),R.needsLights&&(h=U,d=F,h.ambientLightColor.needsUpdate=d,h.lightProbe.needsUpdate=d,h.directionalLights.needsUpdate=d,h.directionalLightShadows.needsUpdate=d,h.pointLights.needsUpdate=d,h.pointLightShadows.needsUpdate=d,h.spotLights.needsUpdate=d,h.spotLightShadows.needsUpdate=d,h.rectAreaLights.needsUpdate=d,h.hemisphereLights.needsUpdate=d),c&&!0===a.fog&&p.refreshFogUniforms(U,c),p.refreshMaterialUniforms(U,a,ef,ep,W.state.transmissionRenderTarget[e.id]),uz.upload(eL,eZ(R),U,o)),a.isShaderMaterial&&!0===a.uniformsNeedUpdate&&(uz.upload(eL,eZ(R),U,o),a.uniformsNeedUpdate=!1),a.isSpriteMaterial&&D.setValue(eL,"center",u.center),D.setValue(eL,"modelViewMatrix",u.modelViewMatrix),D.setValue(eL,"normalMatrix",u.normalMatrix),D.setValue(eL,"modelMatrix",u.matrixWorld),a.isShaderMaterial||a.isRawShaderMaterial){let e=a.uniformsGroups;for(let t=0,r=e.length;t<r;t++){let r=e[t];A.update(r,B),A.bind(r,B)}}return B}(e,t,a,d,c);n.setMaterial(d,v);let S=a.index,M=1;if(!0===d.wireframe){if(void 0===(S=h.getWireframeAttribute(a)))return;M=2}let E=a.drawRange,C=a.attributes.position,w=E.start*M,R=(E.start+E.count)*M;null!==f&&(w=Math.max(w,f.start*M),R=Math.min(R,(f.start+f.count)*M)),null!==S?(w=Math.max(w,0),R=Math.min(R,S.count)):null!=C&&(w=Math.max(w,0),R=Math.min(R,C.count));let N=R-w;if(N<0||N===1/0)return;
382T.setup(c,d,y,a,S);let L=x;if(null!==S&&(m=u.get(S),(L=b).setIndex(m)),c.isMesh)!0===d.wireframe?(n.setLineWidth(d.wireframeLinewidth*eR()),L.setMode(eL.LINES)):L.setMode(eL.TRIANGLES);else if(c.isLine){let e=d.linewidth;void 0===e&&(e=1),n.setLineWidth(e*eR()),c.isLineSegments?L.setMode(eL.LINES):c.isLineLoop?L.setMode(eL.LINE_LOOP):L.setMode(eL.LINE_STRIP)}else c.isPoints?L.setMode(eL.POINTS):c.isSprite&&L.setMode(eL.TRIANGLES);if(c.isBatchedMesh)if(null!==c._multiDrawInstances)es("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),L.renderMultiDrawInstances(c._multiDrawStarts,c._multiDrawCounts,c._multiDrawCount,c._multiDrawInstances);else if(r.get("WEBGL_multi_draw"))L.renderMultiDraw(c._multiDrawStarts,c._multiDrawCounts,c._multiDrawCount);else{let e=c._multiDrawStarts,t=c._multiDrawCounts,r=c._multiDrawCount,i=S?u.get(S).bytesPerElement:1,n=s.get(d).currentProgram.getUniforms();for(let a=0;a<r;a++)n.setValue(eL,"_gl_DrawID",a),L.render(e[a]/i,t[a])}else if(c.isInstancedMesh)L.renderInstances(w,N,c.count);else if(a.isInstancedBufferGeometry){let e=void 0!==a._maxInstanceCount?a._maxInstanceCount:1/0,t=Math.min(a.instanceCount,e);L.renderInstances(w,N,t)}else L.render(w,N)},this.compile=function(e,t,r=null){null===r&&(r=e),(W=m.get(r)).init(t),X.push(W),r.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(W.pushLight(e),e.castShadow&&W.pushShadow(e))}),e!==r&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(W.pushLight(e),e.castShadow&&W.pushShadow(e))}),W.setupLights();let i=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let t=e.material;if(t)if(Array.isArray(t))for(let n=0;n<t.length;n++){let a=t[n];eG(a,r,e),i.add(a)}else eG(t,r,e),i.add(t)}),W=X.pop(),i},this.compileAsync=function(e,t,i=null){let n=this.compile(e,t,i);return new Promise(t=>{function i(){(n.forEach(function(e){s.get(e).currentProgram.isReady()&&n.delete(e)}),0===n.size)?t(e):setTimeout(i,10)}null!==r.get("KHR_parallel_shader_compile")?i():setTimeout(i,10)})};let eV=null;function eH(){ej.stop()}function eW(){ej.start()}const ej=new lc;function eX(e,t,r,i){if(!1===e.visible)return;if(e.layers.test(t.layers)){if(e.isGroup)r=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)W.pushLight(e),e.castShadow&&W.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ex.intersectsSprite(e)){i&&eE.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eA);let t=d.update(e),n=e.material;n.visible&&H.push(e,t,n,r,eE.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ex.intersectsObject(e))){let t=d.update(e),n=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),eE.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),eE.copy(t.boundingSphere.center)),eE.applyMatrix4(e.matrixWorld).applyMatrix4(eA)),Array.isArray(n)){let i=t.groups;for(let a=0,s=i.length;a<s;a++){let s=i[a],o=n[s.materialIndex];o&&o.visible&&H.push(e,t,o,r,eE.z,s)}}else n.visible&&H.push(e,t,n,r,eE.z,null)}}let n=e.children;for(let e=0,a=n.length;e<a;e++)eX(n[e],t,r,i)}function e$(e,t,r,i){let{opaque:a,transmissive:s,transparent:o}=e;W.setupLightsView(r),!0===eb&&g.setGlobalState($.clippingPlanes,r),i&&n.viewport(ei.copy(i)),a.length>0&&eK(a,t,r),s.length>0&&eK(s,t,r),o.length>0&&eK(o,t,r),n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),n.setPolygonOffset(!1)}function eJ(e,t,n,a){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;if(void 0===W.state.transmissionRenderTarget[a.id]){let e=r.has("EXT_color_buffer_half_float")||r.has("EXT_color_buffer_float");W.state.transmissionRenderTarget[a.id]=new ez(1,1,{generateMipmaps:!0,type:e?1016:1009,minFilter:1008,samples:i.samples,stencilBuffer:w,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:eN.workingColorSpace})}let s=W.state.transmissionRenderTarget[a.id],l=a.viewport||ei;s.setSize(l.z*$.transmissionResolutionScale,l.w*$.transmissionResolutionScale);let u=$.getRenderTarget(),h=$.getActiveCubeFace(),d=$.getActiveMipmapLevel();$.setRenderTarget(s),$.getClearColor(eh),(ed=$.getClearAlpha())<1&&$.setClearColor(0xffffff,.5),$.clear(),ew&&y.render(n);let c=$.toneMapping;$.toneMapping=0;let p=a.viewport;if(void 0!==a.viewport&&(a.viewport=void 0),W.setupLightsView(a),!0===eb&&g.setGlobalState($.clippingPlanes,a),eK(e,n,a),o.updateMultisampleRenderTarget(s),o.updateRenderTargetMipmap(s),!1===r.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let r=0,i=t.length;r<i;r++){let{object:i,geometry:s,material:o,group:l}=t[r];
382if(2===o.side&&i.layers.test(a.layers)){let t=o.side;o.side=1,o.needsUpdate=!0,eY(i,n,a,s,o,l),o.side=t,o.needsUpdate=!0,e=!0}}!0===e&&(o.updateMultisampleRenderTarget(s),o.updateRenderTargetMipmap(s))}$.setRenderTarget(u,h,d),$.setClearColor(eh,ed),void 0!==p&&(a.viewport=p),$.toneMapping=c}function eK(e,t,r){let i=!0===t.isScene?t.overrideMaterial:null;for(let n=0,a=e.length;n<a;n++){let a=e[n],{object:s,geometry:o,group:l}=a,u=a.material;!0===u.allowOverride&&null!==i&&(u=i),s.layers.test(r.layers)&&eY(s,t,r,o,u,l)}}function eY(e,t,r,i,n,a){e.onBeforeRender($,t,r,i,n,a),e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),n.onBeforeRender($,t,r,i,e,a),!0===n.transparent&&2===n.side&&!1===n.forceSinglePass?(n.side=1,n.needsUpdate=!0,$.renderBufferDirect(r,t,i,n,e,a),n.side=0,n.needsUpdate=!0,$.renderBufferDirect(r,t,i,n,e,a),n.side=2):$.renderBufferDirect(r,t,i,n,e,a),e.onAfterRender($,t,r,i,n,a)}function eQ(e,t,r){var i;!0!==t.isScene&&(t=eC);let n=s.get(e),a=W.state.lights,o=W.state.shadowsArray,u=a.state.version,h=c.getParameters(e,a.state,o,t,r),d=c.getProgramCacheKey(h),p=n.programs;n.environment=e.isMeshStandardMaterial||e.isMeshLambertMaterial||e.isMeshPhongMaterial?t.environment:null,n.fog=t.fog;let f=e.isMeshStandardMaterial||e.isMeshLambertMaterial&&!e.envMap||e.isMeshPhongMaterial&&!e.envMap;n.envMap=l.get(e.envMap||n.environment,f),n.envMapRotation=null!==n.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===p&&(e.addEventListener("dispose",eO),n.programs=p=new Map);let m=p.get(d);if(void 0!==m){if(n.currentProgram===m&&n.lightsStateVersion===u)return e0(e,h),m}else h.uniforms=c.getUniforms(e),e.onBeforeCompile(h,$),m=c.acquireProgram(h,d),p.set(d,m),n.uniforms=h.uniforms;let v=n.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(v.clippingPlanes=g.uniform),e0(e,h),n.needsLights=(i=e).isMeshLambertMaterial||i.isMeshToonMaterial||i.isMeshPhongMaterial||i.isMeshStandardMaterial||i.isShadowMaterial||i.isShaderMaterial&&!0===i.lights,n.lightsStateVersion=u,n.needsLights&&(v.ambientLightColor.value=a.state.ambient,v.lightProbe.value=a.state.probe,v.directionalLights.value=a.state.directional,v.directionalLightShadows.value=a.state.directionalShadow,v.spotLights.value=a.state.spot,v.spotLightShadows.value=a.state.spotShadow,v.rectAreaLights.value=a.state.rectArea,v.ltc_1.value=a.state.rectAreaLTC1,v.ltc_2.value=a.state.rectAreaLTC2,v.pointLights.value=a.state.point,v.pointLightShadows.value=a.state.pointShadow,v.hemisphereLights.value=a.state.hemi,v.directionalShadowMatrix.value=a.state.directionalShadowMatrix,v.spotLightMatrix.value=a.state.spotLightMatrix,v.spotLightMap.value=a.state.spotLightMap,v.pointShadowMatrix.value=a.state.pointShadowMatrix),n.currentProgram=m,n.uniformsList=null,m}function eZ(e){if(null===e.uniformsList){let t=e.currentProgram.getUniforms();e.uniformsList=uz.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function e0(e,t){let r=s.get(e);r.outputColorSpace=t.outputColorSpace,r.batching=t.batching,r.batchingColor=t.batchingColor,r.instancing=t.instancing,r.instancingColor=t.instancingColor,r.instancingMorph=t.instancingMorph,r.skinning=t.skinning,r.morphTargets=t.morphTargets,r.morphNormals=t.morphNormals,r.morphColors=t.morphColors,r.morphTargetsCount=t.morphTargetsCount,r.numClippingPlanes=t.numClippingPlanes,r.numIntersection=t.numClipIntersection,r.vertexAlphas=t.vertexAlphas,r.vertexTangents=t.vertexTangents,r.toneMapping=t.toneMapping}ej.setAnimationLoop(function(e){eV&&eV(e)}),"u">typeof self&&ej.setContext(self),this.setAnimationLoop=function(e){eV=e,eP.setAnimationLoop(e),null===e?ej.stop():ej.start()},eP.addEventListener("sessionstart",eH),eP.addEventListener("sessionend",eW),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void ea("WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===J)return;let r=!0===eP.enabled&&!0===eP.isPresenting,i=null!==q&&(null===Z||r)&&q.begin($,Z);if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===eP.enabled&&!0===eP.isPresenting&&(null===q||!1===q.isCompositing(
382))&&(!0===eP.cameraAutoUpdate&&eP.updateCamera(t),t=eP.getCamera()),!0===e.isScene&&e.onBeforeRender($,e,t,Z),(W=m.get(e,X.length)).init(t),X.push(W),eA.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ex.setFromProjectionMatrix(eA,2e3,t.reversedDepth),eS=this.localClippingEnabled,eb=g.init(this.clippingPlanes,eS),(H=f.get(e,j.length)).init(),j.push(H),!0===eP.enabled&&!0===eP.isPresenting){let e=$.xr.getDepthSensingMesh();null!==e&&eX(e,t,-1/0,$.sortObjects)}eX(e,t,0,$.sortObjects),H.finish(),!0===$.sortObjects&&H.sort(em,eg),(ew=!1===eP.enabled||!1===eP.isPresenting||!1===eP.hasDepthSensing())&&y.addToRenderList(H,e),this.info.render.frame++,!0===eb&&g.beginShadows();let n=W.state.shadowsArray;if(v.render(n,e,t),!0===eb&&g.endShadows(),!0===this.info.autoReset&&this.info.reset(),!1===(i&&q.hasRenderPass())){let r=H.opaque,i=H.transmissive;if(W.setupLights(),t.isArrayCamera){let n=t.cameras;if(i.length>0)for(let t=0,a=n.length;t<a;t++)eJ(r,i,e,n[t]);ew&&y.render(e);for(let t=0,r=n.length;t<r;t++){let r=n[t];e$(H,e,r,r.viewport)}}else i.length>0&&eJ(r,i,e,t),ew&&y.render(e),e$(H,e,t)}null!==Z&&0===Q&&(o.updateMultisampleRenderTarget(Z),o.updateRenderTargetMipmap(Z)),i&&q.end($),!0===e.isScene&&e.onAfterRender($,e,t),T.resetDefaultState(),ee=-1,et=null,X.pop(),X.length>0?(W=X[X.length-1],!0===eb&&g.setGlobalState($.clippingPlanes,W.state.camera)):W=null,j.pop(),H=j.length>0?j[j.length-1]:null},this.getActiveCubeFace=function(){return K},this.getActiveMipmapLevel=function(){return Q},this.getRenderTarget=function(){return Z},this.setRenderTargetTextures=function(e,t,r){let i=s.get(e);i.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===i.__autoAllocateDepthBuffer&&(i.__useRenderToTexture=!1),s.get(e.texture).__webglTexture=t,s.get(e.depthTexture).__webglTexture=i.__autoAllocateDepthBuffer?void 0:r,i.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let r=s.get(e);r.__webglFramebuffer=t,r.__useDefaultFramebuffer=void 0===t};const e1=eL.createFramebuffer();this.setRenderTarget=function(e,t=0,r=0){Z=e,K=t,Q=r;let i=null,a=!1,l=!1;if(e){let u=s.get(e);if(void 0!==u.__useDefaultFramebuffer){n.bindFramebuffer(eL.FRAMEBUFFER,u.__webglFramebuffer),ei.copy(e.viewport),el.copy(e.scissor),eu=e.scissorTest,n.viewport(ei),n.scissor(el),n.setScissorTest(eu),ee=-1;return}if(void 0===u.__webglFramebuffer)o.setupRenderTarget(e);else if(u.__hasExternalTextures)o.rebindTextures(e,s.get(e.texture).__webglTexture,s.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(u.__boundDepthTexture!==t){if(null!==t&&s.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");o.setupDepthRenderbuffer(e)}}let h=e.texture;(h.isData3DTexture||h.isDataArrayTexture||h.isCompressedArrayTexture)&&(l=!0);let d=s.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=Array.isArray(d[t])?d[t][r]:d[t],a=!0):i=e.samples>0&&!1===o.useMultisampledRTT(e)?s.get(e).__webglMultisampledFramebuffer:Array.isArray(d)?d[r]:d,ei.copy(e.viewport),el.copy(e.scissor),eu=e.scissorTest}else ei.copy(ev).multiplyScalar(ef).floor(),el.copy(ey).multiplyScalar(ef).floor(),eu=e_;if(0!==r&&(i=e1),n.bindFramebuffer(eL.FRAMEBUFFER,i)&&n.drawBuffers(e,i),n.viewport(ei),n.scissor(el),n.setScissorTest(eu),a){let i=s.get(e.texture);eL.framebufferTexture2D(eL.FRAMEBUFFER,eL.COLOR_ATTACHMENT0,eL.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,r)}else if(l)for(let i=0;i<e.textures.length;i++){let n=s.get(e.textures[i]);eL.framebufferTextureLayer(eL.FRAMEBUFFER,eL.COLOR_ATTACHMENT0+i,n.__webglTexture,r,t)}else if(null!==e&&0!==r){let t=s.get(e.texture);eL.framebufferTexture2D(eL.FRAMEBUFFER,eL.COLOR_ATTACHMENT0,eL.TEXTURE_2D,t.__webglTexture,r)}ee=-1},this.readRenderTargetPixels=function(e,t,r,a,o,l,u,h=0){if(!(e&&e.isWebGLRenderTarget))return void ea("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(d=d[u]),d){n.bindFramebuffer(eL.FRAMEBUFFER,d);try{let n=e.textures[h],s=n.format,u=n.type;if(e.textures.length>1&&eL.readBuffer(eL.COLOR_ATTACHMENT0+h),!i.textureFormatReadable(s))return void ea("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!i.textureTypeReadable(u))return void ea("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-a&&r>=0&&r<=e.height-o&&eL.readPixels(t,r,a,o,S.convert(s),S.convert(u),l)}finally{let e=null!==Z?s.get(Z).__webglFramebuffer:null;n.bindFramebuffer(eL.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,r,a,o,l,u,h=0){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=s.get(e).__webglFramebuffer;
vendor: 5,476 bytes, line 382
382if(e.isWebGLCubeRenderTarget&&void 0!==u&&(d=d[u]),d)if(t>=0&&t<=e.width-a&&r>=0&&r<=e.height-o){n.bindFramebuffer(eL.FRAMEBUFFER,d);let u=e.textures[h],c=u.format,p=u.type;if(e.textures.length>1&&eL.readBuffer(eL.COLOR_ATTACHMENT0+h),!i.textureFormatReadable(c))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!i.textureTypeReadable(p))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let f=eL.createBuffer();eL.bindBuffer(eL.PIXEL_PACK_BUFFER,f),eL.bufferData(eL.PIXEL_PACK_BUFFER,l.byteLength,eL.STREAM_READ),eL.readPixels(t,r,a,o,S.convert(c),S.convert(p),0);let m=null!==Z?s.get(Z).__webglFramebuffer:null;n.bindFramebuffer(eL.FRAMEBUFFER,m);let g=eL.fenceSync(eL.SYNC_GPU_COMMANDS_COMPLETE,0);return eL.flush(),await eo(eL,g,4),eL.bindBuffer(eL.PIXEL_PACK_BUFFER,f),eL.getBufferSubData(eL.PIXEL_PACK_BUFFER,0,l),eL.deleteBuffer(f),eL.deleteSync(g),l}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(e,t=null,r=0){let i=Math.pow(2,-r),a=Math.floor(e.image.width*i),s=Math.floor(e.image.height*i),l=null!==t?t.x:0,u=null!==t?t.y:0;o.setTexture2D(e,0),eL.copyTexSubImage2D(eL.TEXTURE_2D,r,0,0,l,u,a,s),n.unbindTexture()};const e2=eL.createFramebuffer(),e3=eL.createFramebuffer();this.copyTextureToTexture=function(e,t,r=null,i=null,a=0,l=0){let u,h,d,c,p,f,m,g,v,y,_=e.isCompressedTexture?e.mipmaps[l]:e.image;if(null!==r)u=r.max.x-r.min.x,h=r.max.y-r.min.y,d=r.isBox3?r.max.z-r.min.z:1,c=r.min.x,p=r.min.y,f=r.isBox3?r.min.z:0;else{let t=Math.pow(2,-a);u=Math.floor(_.width*t),h=Math.floor(_.height*t),d=e.isDataArrayTexture?_.depth:e.isData3DTexture?Math.floor(_.depth*t):1,c=0,p=0,f=0}null!==i?(m=i.x,g=i.y,v=i.z):(m=0,g=0,v=0);let x=S.convert(t.format),b=S.convert(t.type);t.isData3DTexture?(o.setTexture3D(t,0),y=eL.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(o.setTexture2DArray(t,0),y=eL.TEXTURE_2D_ARRAY):(o.setTexture2D(t,0),y=eL.TEXTURE_2D),eL.pixelStorei(eL.UNPACK_FLIP_Y_WEBGL,t.flipY),eL.pixelStorei(eL.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),eL.pixelStorei(eL.UNPACK_ALIGNMENT,t.unpackAlignment);let T=eL.getParameter(eL.UNPACK_ROW_LENGTH),A=eL.getParameter(eL.UNPACK_IMAGE_HEIGHT),M=eL.getParameter(eL.UNPACK_SKIP_PIXELS),E=eL.getParameter(eL.UNPACK_SKIP_ROWS),C=eL.getParameter(eL.UNPACK_SKIP_IMAGES);eL.pixelStorei(eL.UNPACK_ROW_LENGTH,_.width),eL.pixelStorei(eL.UNPACK_IMAGE_HEIGHT,_.height),eL.pixelStorei(eL.UNPACK_SKIP_PIXELS,c),eL.pixelStorei(eL.UNPACK_SKIP_ROWS,p),eL.pixelStorei(eL.UNPACK_SKIP_IMAGES,f);let w=e.isDataArrayTexture||e.isData3DTexture,R=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let r=s.get(e),i=s.get(t),o=s.get(r.__renderTarget),y=s.get(i.__renderTarget);n.bindFramebuffer(eL.READ_FRAMEBUFFER,o.__webglFramebuffer),n.bindFramebuffer(eL.DRAW_FRAMEBUFFER,y.__webglFramebuffer);for(let r=0;r<d;r++)w&&(eL.framebufferTextureLayer(eL.READ_FRAMEBUFFER,eL.COLOR_ATTACHMENT0,s.get(e).__webglTexture,a,f+r),eL.framebufferTextureLayer(eL.DRAW_FRAMEBUFFER,eL.COLOR_ATTACHMENT0,s.get(t).__webglTexture,l,v+r)),eL.blitFramebuffer(c,p,u,h,m,g,u,h,eL.DEPTH_BUFFER_BIT,eL.NEAREST);n.bindFramebuffer(eL.READ_FRAMEBUFFER,null),n.bindFramebuffer(eL.DRAW_FRAMEBUFFER,null)}else if(0!==a||e.isRenderTargetTexture||s.has(e)){let r=s.get(e),i=s.get(t);n.bindFramebuffer(eL.READ_FRAMEBUFFER,e2),n.bindFramebuffer(eL.DRAW_FRAMEBUFFER,e3);for(let e=0;e<d;e++)w?eL.framebufferTextureLayer(eL.READ_FRAMEBUFFER,eL.COLOR_ATTACHMENT0,r.__webglTexture,a,f+e):eL.framebufferTexture2D(eL.READ_FRAMEBUFFER,eL.COLOR_ATTACHMENT0,eL.TEXTURE_2D,r.__webglTexture,a),R?eL.framebufferTextureLayer(eL.DRAW_FRAMEBUFFER,eL.COLOR_ATTACHMENT0,i.__webglTexture,l,v+e):eL.framebufferTexture2D(eL.DRAW_FRAMEBUFFER,eL.COLOR_ATTACHMENT0,eL.TEXTURE_2D,i.__webglTexture,l),0!==a?eL.blitFramebuffer(c,p,u,h,m,g,u,h,eL.COLOR_BUFFER_BIT,eL.NEAREST):R?eL.copyTexSubImage3D(y,l,m,g,v+e,c,p,u,h):eL.copyTexSubImage2D(y,l,m,g,c,p,u,h);n.bindFramebuffer(eL.READ_FRAMEBUFFER,null),n.bindFramebuffer(eL.DRAW_FRAMEBUFFER,null)}else R?e.isDataTexture||e.isData3DTexture?eL.texSubImage3D(y,l,m,g,v,u,h,d,x,b,_.data):t.isCompressedArrayTexture?eL.compressedTexSubImage3D(y,l,m,g,v,u,h,d,x,_.data):eL.texSubImage3D(y,l,m,g,v,u,h,d,x,b,_):e.isDataTexture?eL.texSubImage2D(eL.TEXTURE_2D,l,m,g,u,h,x,b,_.data):e.isCompressedTexture?eL.compressedTexSubImage2D(eL.TEXTURE_2D,l,m,g,_.width,_.height,x,_.data):eL.texSubImage2D(eL.TEXTURE_2D,l,m,g,u,h,x,b,_);eL.pixelStorei(eL.UNPACK_ROW_LENGTH,T),eL.pixelStorei(eL.UNPACK_IMAGE_HEIGHT,A),eL.pixelStorei(eL.UNPACK_SKIP_PIXELS,M),eL.pixelStorei(eL.UNPACK_SKIP_ROWS,E),eL.pixelStorei(eL.UNPACK_SKIP_IMAGES,C),0===l&&t.generateMipmaps&&eL.generateMipmap(y),n.unbindTexture()},this.initRenderTarget=function(e){void 0===s.get(e).__webglFramebuffer&&o.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?o.setTextureCube(e,0):e.isData3DTexture?o.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?o.setTexture2DArray(e,0):o.setTexture2D(e,0),n.unbindTexture()},this.resetState=function(){K=0,Q=0,Z=null,n.reset(),T.reset()},"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return 2e3}get outputColorSpace(){return this._outputColorSpace}
382set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=eN._getDrawingBufferColorSpace(e),t.unpackColorSpace=eN._getUnpackColorSpace()}}e.s(["PMREMGenerator",()=>lI,"ShaderChunk",()=>lf,"ShaderLib",()=>lg,"UniformsLib",()=>lm,"WebGLCubeRenderTarget",()=>lG,"WebGLRenderer",()=>hF,"WebGLUtils",()=>hA],9684);var hD=e.i(51165);let hU=e=>{let t,r=new Set,i=(e,i)=>{let n="function"==typeof e?e(t):e;if(!Object.is(n,t)){let e=t;t=(null!=i?i:"object"!=typeof n||null===n)?n:Object.assign({},t,n),r.forEach(r=>r(t,e))}},n=()=>t,a={setState:i,getState:n,getInitialState:()=>s,subscribe:e=>(r.add(e),()=>r.delete(e))},s=t=e(i,n,a);return a},{useSyncExternalStoreWithSelector:hO}=hD.default,hG=(e,t)=>{let r=e?hU(e):hU,i=(e,i=t)=>(function(e,t=e=>e,r){let i=hO(e.subscribe,e.getState,e.getInitialState,t,r);return I.default.useDebugValue(i),i})(r,e,i);return Object.assign(i,r),i},hk=(e,t)=>e?hG(e,t):hG,hV=[];function hz(e,t,r=(e,t)=>e===t){if(e===t)return!0;if(!e||!t)return!1;let i=e.length;if(t.length!==i)return!1;for(let n=0;n<i;n++)if(!r(e[n],t[n]))return!1;return!0}function hH(e,t=null,r=!1,i={}){for(let n of(null===t&&(t=[e]),hV))if(hz(t,n.keys,n.equal)){if(r)return;if(Object.prototype.hasOwnProperty.call(n,"error"))throw n.error;if(Object.prototype.hasOwnProperty.call(n,"response"))return i.lifespan&&i.lifespan>0&&(n.timeout&&clearTimeout(n.timeout),n.timeout=setTimeout(n.remove,i.lifespan)),n.response;if(!r)throw n.promise}let n={keys:t,equal:i.equal,remove:()=>{let e=hV.indexOf(n);-1!==e&&hV.splice(e,1)},promise:("object"==typeof e&&"function"==typeof e.then?e:e(...t)).then(e=>{n.response=e,i.lifespan&&i.lifespan>0&&(n.timeout=setTimeout(n.remove,i.lifespan))}).catch(e=>n.error=e)};if(hV.push(n),!r)throw n.promise}var hW=e.i(88440),hj=I;function hX(e,t,r){if(!e)return;if(!0===r(e))return e;let i=t?e.return:e.child;for(;i;){let e=hX(i,t,r);if(e)return e;i=t?null:i.sibling}}function hq(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(t){return e}}"u">typeof window&&((null==(M=window.document)?void 0:M.createElement)||(null==(E=window.navigator)?void 0:E.product)==="ReactNative")?hj.useLayoutEffect:hj.useEffect;let h$=hq(hj.createContext(null));class hJ extends hj.Component{render(){return hj.createElement(h$.Provider,{value:this._reactInternals},this.props.children)}}function hK(){let e=hj.useContext(h$);if(null===e)throw Error("its-fine: useFiber must be called within a <FiberProvider />!");let t=hj.useId();return hj.useMemo(()=>{for(let r of[e,null==e?void 0:e.alternate]){if(!r)continue;let e=hX(r,!1,e=>{let r=e.memoizedState;for(;r;){if(r.memoizedState===t)return!0;r=r.next}});if(e)return e}},[e,t])}let hY=Symbol.for("react.context"),hQ=e=>null!==e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===hY;function hZ(e){let t=e.root;for(;t.getState().previousRoot;)t=t.getState().previousRoot;return t}I.act;let h0=e=>e&&e.hasOwnProperty("current"),h1=e=>null!=e&&("string"==typeof e||"number"==typeof e||e.isColor),h2="u">typeof window&&((null==(b=window.document)?void 0:b.createElement)||(null==(S=window.navigator)?void 0:S.product)==="ReactNative")?I.useLayoutEffect:I.useEffect;function h3(e){let t=I.useRef(e);return h2(()=>void(t.current=e),[e]),t}function h4(){let e,t=hK(),r=(e=function(){let e=hK(),[t]=hj.useState(()=>new Map);t.clear();let r=e;for(;r;){let e=r.type;hQ(e)&&e!==h$&&!t.has(e)&&t.set(e,hj.use(hq(e))),r=r.return}return t}(),hj.useMemo(()=>Array.from(e.keys()).reduce((t,r)=>i=>hj.createElement(t,null,hj.createElement(r.Provider,{...i,value:e.get(r)})),e=>hj.createElement(hJ,{...e})),[e]));return I.useMemo(()=>({children:e})=>{let i=hX(t,!0,e=>e.type===I.StrictMode)?I.StrictMode:I.Fragment;return(0,L.jsx)(i,{children:(0,L.jsx)(r,{children:e})})},[t,r])}function h5({set:e}){return h2(()=>(e(new Promise(()=>null)),()=>e(!1)),[e]),null}let h8=((T=class extends I.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}).getDerivedStateFromError=()=>({error:!0}),T);function h6(e){var t;let r="u">typeof window?null!=(t=window.devicePixelRatio)?t:2:1;return Array.isArray(e)?Math.min(Math.max(e[0],r),e[1]):e}function h9(e){var t;return null==(t=e.__r3f)?void 0:t.root.getState()}let h7={obj:e=>e===Object(e)&&!h7.arr(e)&&"function"!=typeof e,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,boo:e=>"boolean"==typeof e,und:e=>void 0===e,nul:e=>null===e,arr:e=>Array.isArray(e),equ(e,t,{arrays:r="shallow",objects:i="reference",strict:n=!0}={}){let a;if(typeof e!=typeof t||!!e!=!!t)return!1;if(h7.str(e)||h7.num(e)||h7.boo(e))return e===t;let s=h7.obj(e);if(s&&"reference"===i)return e===t;let o=h7.arr(e);if(o&&"reference"===r)return e===t;if((o||s)&&e===t)return!0;for(a in e)if(!(a in t))return!1;if(s&&"shallow"===r&&"shallow"===i){for(a in n?t:e)if(!h7.equ(e[a],t[a],{strict:n,objects:"reference"}))return!1}else for(a in n?t:e)if(e[a]!==t[a])return!1;if(h7.und(a)){if(o&&0===e.length&&0===t.length||s&&0===Object.keys(e).length&&0===Object.keys(t).length)return!0;
382if(e!==t)return!1}return!0}},de=["children","key","ref"];function dt(e,t,r,i){let n=null==e?void 0:e.__r3f;return!n&&(n={root:t,type:r,parent:null,children:[],props:function(e){let t={};for(let r in e)de.includes(r)||(t[r]=e[r]);return t}(i),object:e,eventCount:0,handlers:{},isHidden:!1},e&&(e.__r3f=n)),n}function dr(e,t){if(!t.includes("-")||t in e)return{root:e,key:t,target:e[t]};let r=e,i=t.split("-");for(let n of i){if("object"!=typeof r||null===r){if(void 0!==r)return{root:r,key:i.slice(i.indexOf(n)).join("-"),target:void 0};return{root:e,key:t,target:void 0}}t=n,e=r,r=r[t]}return{root:e,key:t,target:r}}let di=/-\d+$/;function dn(e,t){if(h7.str(t.props.attach)){if(di.test(t.props.attach)){let r=t.props.attach.replace(di,""),{root:i,key:n}=dr(e.object,r);Array.isArray(i[n])||(i[n]=[])}let{root:r,key:i}=dr(e.object,t.props.attach);t.previousAttach=r[i],r[i]=t.object}else h7.fun(t.props.attach)&&(t.previousAttach=t.props.attach(e.object,t.object))}function da(e,t){if(h7.str(t.props.attach)){let{root:r,key:i}=dr(e.object,t.props.attach),n=t.previousAttach;void 0===n?delete r[i]:r[i]=n}else null==t.previousAttach||t.previousAttach(e.object,t.object);delete t.previousAttach}let ds=[...de,"args","dispose","attach","object","onUpdate","dispose"],dl=new Map,du=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],dh=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function dd(e,t){var r,i;let n=e.__r3f,a=n&&hZ(n).getState(),s=null==n?void 0:n.eventCount;for(let r in t){let s=t[r];if(ds.includes(r))continue;if(n&&dh.test(r)){"function"==typeof s?n.handlers[r]=s:delete n.handlers[r],n.eventCount=Object.keys(n.handlers).length;continue}if(void 0===s)continue;let{root:o,key:l,target:u}=dr(e,r);if(void 0===u&&("object"!=typeof o||null===o))throw Error(`R3F: Cannot set "${r}". Ensure it is an object before setting "${l}".`);u instanceof e4&&s instanceof e4?u.mask=s.mask:u instanceof ty&&h1(s)?u.set(s):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"function"==typeof u.copy&&null!=s&&s.constructor&&u.constructor===s.constructor?u.copy(s):null!==u&&"object"==typeof u&&"function"==typeof u.set&&Array.isArray(s)?"function"==typeof u.fromArray?u.fromArray(s):u.set(...s):null!==u&&"object"==typeof u&&"function"==typeof u.set&&"number"==typeof s?"function"==typeof u.setScalar?u.setScalar(s):u.set(s):(o[l]=s,a&&!a.linear&&du.includes(l)&&null!=(i=o[l])&&i.isTexture&&1023===o[l].format&&1009===o[l].type&&(o[l].colorSpace=O))}if(null!=n&&n.parent&&null!=a&&a.internal&&null!=(r=n.object)&&r.isObject3D&&s!==n.eventCount){let e=n.object,t=a.internal.interaction.indexOf(e);t>-1&&a.internal.interaction.splice(t,1),n.eventCount&&null!==e.raycast&&a.internal.interaction.push(e)}return n&&void 0===n.props.attach&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&dc(n),e}function dc(e){var t;if(!e.parent)return;null==e.props.onUpdate||e.props.onUpdate(e.object);let r=null==(t=e.root)||null==t.getState?void 0:t.getState();r&&0===r.internal.frames&&r.invalidate()}function dp(e,t){!e.manual&&(e&&e.isOrthographicCamera?(e.left=-(t.width/2),e.right=t.width/2,e.top=t.height/2,e.bottom=-(t.height/2)):e.aspect=t.width/t.height,e.updateProjectionMatrix())}let df=e=>null==e?void 0:e.isObject3D;function dm(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function dg(e,t,r,i){let n=r.get(t);n&&(r.delete(t),0===r.size&&(e.delete(i),n.target.releasePointerCapture(i)))}let dv=e=>!!(null!=e&&e.render),dy=I.createContext(null);function d_(){let e=I.useContext(dy);if(!e)throw Error("R3F: Hooks can only be used within the Canvas component!");return e}function dx(e=e=>e,t){return d_()(e,t)}function db(e,t=0){let r=d_(),i=r.getState().internal.subscribe,n=h3(e);return h2(()=>i(n,t,r),[t,i,r]),null}let dS=new WeakMap;function dT(e,t){return function(r,...i){var n;let a;return"function"==typeof r&&(null==r||null==(n=r.prototype)?void 0:n.constructor)===r?(a=dS.get(r))||(a=new r,dS.set(r,a)):a=r,e&&e(a),Promise.all(i.map(e=>new Promise((r,i)=>a.load(e,e=>{var t;let i;df(null==e?void 0:e.scene)&&Object.assign(e,(t=e.scene,i={nodes:{},materials:{},meshes:{}},t&&t.traverse(e=>{e.name&&(i.nodes[e.name]=e),e.material&&!i.materials[e.material.name]&&(i.materials[e.material.name]=e.material),e.isMesh&&!i.meshes[e.name]&&(i.meshes[e.name]=e)}),i)),r(e)},t,t=>i(Error(`Could not load ${e}: ${null==t?void 0:t.message}`))))))}}
382function dA(e,t,r,i){let n=Array.isArray(t)?t:[t],a=hH(dT(r,i),[e,...n],!1,{equal:h7.equ});return Array.isArray(t)?a:a[0]}dA.preload=function(e,t,r){let i,n=Array.isArray(t)?t:[t];hH(dT(r),[e,...n],!0,i)},dA.clear=function(e,t){var r=[e,...Array.isArray(t)?t:[t]];if(void 0===r||0===r.length)hV.splice(0,hV.length);else{let e=hV.find(e=>hz(r,e.keys,e.equal));e&&e.remove()}};var dM={exports:{}},dE={exports:{}};dE.exports;let dC=(N||(N=1,R||(R=1,dE.exports=function(e){function t(e,t,r,i){return new iK(e,t,r,i)}function r(){}function i(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do(4098&(t=e).flags)!=0&&(r=t.return),e=t.return;while(e)}return 3===t.tag?r:null}function a(e){if(n(e)!==e)throw Error(i(188))}function s(e){var t=e.alternate;if(!t){if(null===(t=n(e)))throw Error(i(188));return t!==e?null:e}for(var r=e,s=t;;){var o=r.return;if(null===o)break;var l=o.alternate;if(null===l){if(null!==(s=o.return)){r=s;continue}break}if(o.child===l.child){for(l=o.child;l;){if(l===r)return a(o),e;if(l===s)return a(o),t;l=l.sibling}throw Error(i(188))}if(r.return!==s.return)r=o,s=l;else{for(var u=!1,h=o.child;h;){if(h===r){u=!0,r=o,s=l;break}if(h===s){u=!0,s=o,r=l;break}h=h.sibling}if(!u){for(h=l.child;h;){if(h===r){u=!0,r=l,s=o;break}if(h===s){u=!0,s=l,r=o;break}h=h.sibling}if(!u)throw Error(i(189))}}if(r.alternate!==s)throw Error(i(190))}if(3!==r.tag)throw Error(i(188));return r.stateNode.current===r?e:t}function o(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=nx&&e[nx]||e["@@iterator"])?e:null}function l(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===nb?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case nl:return"Fragment";case nh:return"Profiler";case nu:return"StrictMode";case nf:return"Suspense";case nm:return"SuspenseList";case ny:return"Activity"}if("object"==typeof e)switch(e.$$typeof){case no:return"Portal";case nc:return e.displayName||"Context";case nd:return(e._context.displayName||"Context")+".Consumer";case np:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case ng:return null!==(t=e.displayName||null)?t:l(e.type)||"Memo";case nv:t=e._payload,e=e._init;try{return l(e(t))}catch{}}return null}function u(e){return{current:e}}function h(e){0>sA||(e.current=sT[sA],sT[sA]=null,sA--)}function d(e,t){sT[++sA]=e.current,e.current=t}function c(e){var t=42&e;if(0!==t)return t;switch(e&-e){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 261888&e;case 262144:case 524288:case 1048576:case 2097152:return 3932160&e;case 4194304:case 8388608:case 0x1000000:case 0x2000000:return 0x3c00000&e;case 0x4000000:return 0x4000000;case 0x8000000:return 0x8000000;case 0x10000000:return 0x10000000;case 0x20000000:return 0x20000000;case 0x40000000:return 0;default:return e}}function p(e,t,r){var i=e.pendingLanes;if(0===i)return 0;var n=0,a=e.suspendedLanes,s=e.pingedLanes;e=e.warmLanes;var o=0x7ffffff&i;return 0!==o?0!=(i=o&~a)?n=c(i):0!=(s&=o)?n=c(s):r||0!=(r=o&~e)&&(n=c(r)):0!=(o=i&~a)?n=c(o):0!==s?n=c(s):r||0!=(r=i&~e)&&(n=c(r)),0===n?0:0!==t&&t!==n&&(t&a)==0&&((a=n&-n)>=(r=t&-t)||32===a&&(4194048&r)!=0)?t:n}function f(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)==0}function m(){var e=sL;return(0x3c00000&(sL<<=1))==0&&(sL=4194304),e}function g(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function v(e,t){e.pendingLanes|=t,0x10000000!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function y(e,t,r){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-sE(t);e.entangledLanes|=t,e.entanglements[i]=0x40000000|e.entanglements[i]|261930&r}function _(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var i=31-sE(r),n=1<<i;n&t|e[i]&t&&(e[i]|=t),r&=~n}}function x(e,t){var r=t&-t;return((r=(42&r)!=0?1:b(r))&(e.suspendedLanes|t))!=0?0:r}function b(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:case 4194304:case 8388608:case 0x1000000:case 0x2000000:e=128;break;case 0x10000000:e=0x8000000;break;default:e=0}return e}function S(e){return 2<(e&=-e)?8<e?(0x7ffffff&e)!=0?32:0x10000000:8:2}function T(e){if("function"==typeof sV&&sz(e),sW&&"function"==typeof sW.setStrictMode)try{sW.setStrictMode(sH,e)}catch{}}function A(e){if(void 0===a7)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);a7=t&&t[1]||"",se=-1<e.stack.indexOf(` 383 at`)?" (<anonymous>)":-1<e.stack.indexOf("@")?"@unknown:0:0":""}return` 384`+a7+e+se}function M(e,t){if(!e||s$)return"";s$=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var r=function(){throw Error()};if(Object.defineProperty(r.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(r,[])}catch(e){var i=e}Reflect.construct(e,[],r)}else{try{r.call()}catch(e){i=e}e.call(r.prototype)}}else{try{throw Error()}catch(e){i=e}(r=e())&&"function"==typeof r.catch&&r.catch(function(){})}}catch(e){if(e&&i&&"string"==typeof e.stack)return[e.stack,i.stack]}
384return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var a=i.DetermineComponentFrameRoot(),s=a[0],o=a[1];if(s&&o){var l=s.split(` 385`),u=o.split(` 386`);for(n=i=0;i<l.length&&!l[i].includes("DetermineComponentFrameRoot");)i++;for(;n<u.length&&!u[n].includes("DetermineComponentFrameRoot");)n++;if(i===l.length||n===u.length)for(i=l.length-1,n=u.length-1;1<=i&&0<=n&&l[i]!==u[n];)n--;for(;1<=i&&0<=n;i--,n--)if(l[i]!==u[n]){if(1!==i||1!==n)do if(i--,n--,0>n||l[i]!==u[n]){var h=` 387`+l[i].replace(" at new "," at ");return e.displayName&&h.includes("<anonymous>")&&(h=h.replace("<anonymous>",e.displayName)),h}while(1<=i&&0<=n)break}}}finally{s$=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?A(r):""}function E(e){try{var t="",r=null;do t+=function(e,t){switch(e.tag){case 26:case 27:case 5:return A(e.type);case 16:return A("Lazy");case 13:return e.child!==t&&null!==t?A("Suspense Fallback"):A("Suspense");case 19:return A("SuspenseList");case 0:case 15:return M(e.type,!1);case 11:return M(e.type.render,!1);case 1:return M(e.type,!0);case 31:return A("Activity");default:return""}}(e,r),r=e,e=e.return;while(e)return t}catch(e){return` 388Error generating stack: `+e.message+` 389`+e.stack}}function C(e,t){if("object"==typeof e&&null!==e){var r=sJ.get(e);return void 0!==r?r:(t={value:e,source:t,stack:E(t)},sJ.set(e,t),t)}return{value:e,source:t,stack:E(t)}}function w(e,t){sK[sY++]=sZ,sK[sY++]=sQ,sQ=e,sZ=t}function R(e,t,r){s0[s1++]=s3,s0[s1++]=s4,s0[s1++]=s2,s2=e;var i=s3;e=s4;var n=32-sE(i)-1;i&=~(1<<n),r+=1;var a=32-sE(t)+n;if(30<a){var s=n-n%5;a=(i&(1<<s)-1).toString(32),i>>=s,n-=s,s3=1<<32-sE(t)+n|r<<n|i,s4=a+e}else s3=1<<a|r<<n|i,s4=e}function N(e){null!==e.return&&(w(e,1),R(e,1,0))}function L(e){for(;e===sQ;)sQ=sK[--sY],sK[sY]=null,sZ=sK[--sY],sK[sY]=null;for(;e===s2;)s2=s0[--s1],s0[s1]=null,s4=s0[--s1],s0[s1]=null,s3=s0[--s1],s0[s1]=null}function P(e,t){s0[s1++]=s3,s0[s1++]=s4,s0[s1++]=s2,s3=t.id,s4=t.overflow,s2=e}function F(e,t){d(s6,t),d(s8,e),d(s5,null),e=nw(t),h(s5),d(s5,e)}function D(){h(s5),h(s8),h(s6)}function U(e){null!==e.memoizedState&&d(s9,e);var t=s5.current,r=nR(t,e.type);t!==r&&(d(s8,e),d(s5,r))}function O(e){s8.current===e&&(h(s5),h(s8)),s9.current===e&&(h(s9),nk?n5._currentValue=n4:n5._currentValue2=n4)}function G(e){var t=Error(i(418,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?"text":"HTML",""));throw j(C(t,e)),on}function k(e,t){if(!nH)throw Error(i(175));aX(e.stateNode,e.type,e.memoizedProps,t,e)||G(e,!0)}function V(e){for(s7=e.return;s7;)switch(s7.tag){case 5:case 31:case 13:oi=!1;return;case 27:case 3:oi=!0;return;default:s7=s7.return}}function z(e){if(!nH||e!==s7)return!1;if(!ot)return V(e),ot=!0,!1;var t=e.tag;if(sv?3!==t&&27!==t&&(5!==t||a9(e.type)&&!nF(e.type,e.memoizedProps))&&oe&&G(e):3!==t&&(5!==t||a9(e.type)&&!nF(e.type,e.memoizedProps))&&oe&&G(e),V(e),13===t){if(!nH)throw Error(i(316));if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(i(317));oe=aY(e)}else if(31===t){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(i(317));oe=aK(e)}else oe=sv&&27===t?aD(e.type,oe):s7?aF(e.stateNode):null;return!0}function H(){nH&&(oe=s7=null,ot=!1)}function W(){var e=or;return null!==e&&(null===lB?lB=e:lB.push.apply(lB,e),or=null),e}function j(e){null===or?or=[e]:or.push(e)}function X(e,t,r){nk?(d(oa,t._currentValue),t._currentValue=r):(d(oa,t._currentValue2),t._currentValue2=r)}function q(e){var t=oa.current;nk?e._currentValue=t:e._currentValue2=t,h(oa)}function $(e,t,r){for(;null!==e;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==i&&(i.childLanes|=t)):null!==i&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===r)break;e=e.return}}function J(e,t,r,n){var a=e.child;for(null!==a&&(a.return=e);null!==a;){var s=a.dependencies;if(null!==s){var o=a.child;s=s.firstContext;o:for(;null!==s;){var l=s;s=a;for(var u=0;u<t.length;u++)if(l.context===t[u]){s.lanes|=r,null!==(l=s.alternate)&&(l.lanes|=r),$(s.return,r,e),n||(o=null);break o}s=l.next}}else if(18===a.tag){if(null===(o=a.return))throw Error(i(341));o.lanes|=r,null!==(s=o.alternate)&&(s.lanes|=r),$(o,r,e),o=null}else o=a.child;if(null!==o)o.return=a;else for(o=a;null!==o;){if(o===e){o=null;break}if(null!==(a=o.sibling)){a.return=o.return,o=a;break}o=o.return}a=o}}function K(e,t,r,n){e=null;for(var a=t,s=!1;null!==a;){if(!s){if((524288&a.flags)!=0)s=!0;else if((262144&a.flags)!=0)break}if(10===a.tag){var o=a.alternate;if(null===o)throw Error(i(387));if(null!==(o=o.memoizedProps)){var l=a.type;sj(a.pendingProps.value,o.value)||(null!==e?e.push(l):e=[l])}}else if(a===s9.current){if(null===(o=a.alternate))throw Error(i(387));o.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(null!==e?e.push(n5):e=[n5])}a=a.return}null!==e&&J(t,e,r,n),t.flags|=262144}function Y(e){for(e=e.firstContext;null!==e;){var t=e.context;if(!sj(nk?t._currentValue:t._currentValue2,e.memoizedValue))return!0;e=e.next}return!1}
389function Q(e){os=e,oo=null,null!==(e=e.dependencies)&&(e.firstContext=null)}function Z(e){return et(os,e)}function ee(e,t){return null===os&&Q(e),et(e,t)}function et(e,t){var r=nk?t._currentValue:t._currentValue2;if(t={context:t,memoizedValue:r,next:null},null===oo){if(null===e)throw Error(i(308));oo=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else oo=oo.next=t;return r}function er(){return{controller:new ol,data:new Map,refCount:0}}function ei(e){e.refCount--,0===e.refCount&&ou(oh,function(){e.controller.abort()})}function en(){}function ea(e){e!==op&&null===e.next&&(null===op?oc=op=e:op=op.next=e),om=!0,of||(of=!0,n6?n9(function(){(6&lm)!=0?sB(sU,eo):el()}):sB(sU,eo))}function es(e,t){if(!og&&om){og=!0;do for(var r=!1,i=oc;null!==i;){if(!t)if(0!==e){var n=i.pendingLanes;if(0===n)var a=0;else{var s=i.suspendedLanes,o=i.pingedLanes;a=0xc000095&(a=(1<<31-sE(42|e)+1)-1&(n&~(s&~o)))?0xc000095&a|1:a?2|a:0}0!==a&&(r=!0,ed(i,a))}else a=ly,(3&(a=p(i,i===lg?a:0,null!==i.cancelPendingCommit||i.timeoutHandle!==nG)))==0||f(i,a)||(r=!0,ed(i,a));i=i.next}while(r)og=!1}}function eo(){el()}function el(){om=of=!1;var e=0;0!==ov&&nJ()&&(e=ov);for(var t=sD(),r=null,i=oc;null!==i;){var n=i.next,a=eu(i,t);0===a?(i.next=null,null===r?oc=n:r.next=n,null===n&&(op=r)):(r=i,(0!==e||(3&a)!=0)&&(om=!0)),i=n}0!==lG&&5!==lG||es(e,!1),0!==ov&&(ov=0)}function eu(e,t){for(var r=e.suspendedLanes,i=e.pingedLanes,n=e.expirationTimes,a=-0x3c00001&e.pendingLanes;0<a;){var s=31-sE(a),o=1<<s,l=n[s];-1===l?((o&r)==0||(o&i)!=0)&&(n[s]=function(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+5e3;default:return -1}}(o,t)):l<=t&&(e.expiredLanes|=o),a&=~o}if(t=lg,r=ly,r=p(e,e===t?r:0,null!==e.cancelPendingCommit||e.timeoutHandle!==nG),i=e.callbackNode,0===r||e===t&&(2===l_||9===l_)||null!==e.cancelPendingCommit)return null!==i&&null!==i&&sI(i),e.callbackNode=null,e.callbackPriority=0;if((3&r)==0||f(e,r)){if((t=r&-r)===e.callbackPriority)return t;switch(null!==i&&sI(i),S(r)){case 2:case 8:r=sO;break;case 32:default:r=sG;break;case 0x10000000:r=sk}return r=sB(r,i=eh.bind(null,e)),e.callbackPriority=t,e.callbackNode=r,t}return null!==i&&null!==i&&sI(i),e.callbackPriority=2,e.callbackNode=null,2}function eh(e,t){if(0!==lG&&5!==lG)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(iV()&&e.callbackNode!==r)return null;var i=ly;return 0===(i=p(e,e===lg?i:0,null!==e.cancelPendingCommit||e.timeoutHandle!==nG))?null:(i_(e,i,t),eu(e,sD()),null!=e.callbackNode&&e.callbackNode===r?eh.bind(null,e):null)}function ed(e,t){if(iV())return null;i_(e,t,!0)}function ec(){if(0===ov){var e=ox;0===e&&(e=sR,(261888&(sR<<=1))==0&&(sR=256)),ov=e}return ov}function ep(){if(0==--o_&&null!==oy){null!==ob&&(ob.status="fulfilled");var e=oy;oy=null,ox=0,ob=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ef(){var e=oT.current;return null!==e?e:lg.pooledCache}function em(e,t){null===t?d(oT,oT.current):d(oT,t.pool)}function eg(){var e=ef();return null===e?null:{parent:nk?od._currentValue:od._currentValue2,pool:e}}function ev(e,t){if(sj(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(i=0;i<r.length;i++){var n=r[i];if(!sq.call(t,n)||!sj(e[n],t[n]))return!1}return!0}function ey(e){return"fulfilled"===(e=e.status)||"rejected"===e}function e_(e,t,r){switch(void 0===(r=e[r])?e.push(t):r!==t&&(t.then(en,en),t=r),t.status){case"fulfilled":return t.value;case"rejected":throw eS(e=t.reason),e;default:if("string"==typeof t.status)t.then(en,en);else{if(null!==(e=lg)&&100<e.shellSuspendCounter)throw Error(i(482));(e=t).status="pending",e.then(function(e){if("pending"===t.status){var r=t;r.status="fulfilled",r.value=e}},function(e){if("pending"===t.status){var r=t;r.status="rejected",r.reason=e}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw eS(e=t.reason),e}throw ow=t,oA}}function ex(e){try{return(0,e._init)(e._payload)}catch(e){throw null!==e&&"object"==typeof e&&"function"==typeof e.then?(ow=e,oA):e}}function eb(){if(null===ow)throw Error(i(459));var e=ow;return ow=null,e}function eS(e){if(e===oA||e===oE)throw Error(i(483))}function eT(e){var t=oN;return oN+=1,null===oR&&(oR=[]),e_(oR,e,t)}function eA(e,t){e.ref=void 0!==(t=t.props.ref)?t:null}function eM(e,t){throw t.$$typeof===na?Error(i(525)):Error(i(31,"[object Object]"===(e=Object.prototype.toString.call(t))?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function eE(e){function r(t,r){if(e){var i=t.deletions;null===i?(t.deletions=[r],t.flags|=16):i.push(r)}}function n(t,i){if(!e)return null;for(;null!==i;)r(t,i),i=i.sibling;return null}function a(e){for(var t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function s(e,t){return(e=iQ(e,t)).index=0,e.sibling=null,e}function l(t,r,i){return t.index=i,e?null!==(i=t.alternate)?(i=i.index)<r?(t.flags|=0x4000002,r):i:(t.flags|=0x4000002,r):(t.flags|=1048576,r)}function u(t){return e&&null===t.alternate&&(t.flags|=0x4000002),t}function h(e,t,r,i){return null===t||6!==t.tag?(t=i2(r,e.mode,i)).return=e:(t=s(t,r)).return=e,t}function d(e,t,r,i){var n=r.type;return n===nl?p(e,t,r.props.children,i,r.key):(null!==t&&(t.elementType===n||"object"==typeof n&&null!==n&&n.$$typeof===nv&&ex(n)===t.type)?eA(t=s(t,r.props),r):eA(t=i0(r.type,r.key,r.props,null,e.mode,i),r),t.return=e,t)}function c(e,t,r,i){return null===t||4!==t.tag||t.stateNode.containerInfo!==r.containerInfo||t.stateNode.implementation!==r.implementation?(t=i4(r,e.mode,i)).return=e:(t=s(t,r.children||[])).return=e,t}function p(e,t,r,i,n){return null===t||7!==t.tag?(t=i1(r,e.mode,i,n)).return=e:(t=s(t,r)).return=e,t}function f(e,t,r){if("string"==typeof t&&""!==t||"number"==typeof t||"bigint"==typeof t)return(t=i2(""+t,e.mode,r)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case ns:return eA(r=i0(t.type,t.key,t.props,null,e.mode,r),t),r.return=e,r;case no:return(t=i4(t,e.mode,r)).return=e,t;case nv:return f(e,t=ex(t),r)}if(nS(t)||o(t))return(t=i1(t,e.mode,r,null)).return=e,t;if("function"==typeof t.then)return f(e,eT(t),r);if(t.$$typeof===nc)return f(e,ee(e,t),r);eM(e,t)}return null}
vendor: 5,441 bytes, line 389
389function m(e,t,r,i){var n=null!==t?t.key:null;if("string"==typeof r&&""!==r||"number"==typeof r||"bigint"==typeof r)return null!==n?null:h(e,t,""+r,i);if("object"==typeof r&&null!==r){switch(r.$$typeof){case ns:return r.key===n?d(e,t,r,i):null;case no:return r.key===n?c(e,t,r,i):null;case nv:return m(e,t,r=ex(r),i)}if(nS(r)||o(r))return null!==n?null:p(e,t,r,i,null);if("function"==typeof r.then)return m(e,t,eT(r),i);if(r.$$typeof===nc)return m(e,t,ee(e,r),i);eM(e,r)}return null}function g(e,t,r,i,n){if("string"==typeof i&&""!==i||"number"==typeof i||"bigint"==typeof i)return h(t,e=e.get(r)||null,""+i,n);if("object"==typeof i&&null!==i){switch(i.$$typeof){case ns:return d(t,e=e.get(null===i.key?r:i.key)||null,i,n);case no:return c(t,e=e.get(null===i.key?r:i.key)||null,i,n);case nv:return g(e,t,r,i=ex(i),n)}if(nS(i)||o(i))return p(t,e=e.get(r)||null,i,n,null);if("function"==typeof i.then)return g(e,t,r,eT(i),n);if(i.$$typeof===nc)return g(e,t,r,ee(t,i),n);eM(t,i)}return null}return function(h,d,c,p){try{oN=0;var v=function t(h,d,c,p){if("object"==typeof c&&null!==c&&c.type===nl&&null===c.key&&(c=c.props.children),"object"==typeof c&&null!==c){switch(c.$$typeof){case ns:o:{for(var v=c.key;null!==d;){if(d.key===v){if((v=c.type)===nl){if(7===d.tag){n(h,d.sibling),(p=s(d,c.props.children)).return=h,h=p;break o}}else if(d.elementType===v||"object"==typeof v&&null!==v&&v.$$typeof===nv&&ex(v)===d.type){n(h,d.sibling),eA(p=s(d,c.props),c),p.return=h,h=p;break o}n(h,d);break}r(h,d),d=d.sibling}c.type===nl?(p=i1(c.props.children,h.mode,p,c.key)).return=h:(eA(p=i0(c.type,c.key,c.props,null,h.mode,p),c),p.return=h),h=p}return u(h);case no:o:{for(v=c.key;null!==d;){if(d.key===v)if(4===d.tag&&d.stateNode.containerInfo===c.containerInfo&&d.stateNode.implementation===c.implementation){n(h,d.sibling),(p=s(d,c.children||[])).return=h,h=p;break o}else{n(h,d);break}r(h,d),d=d.sibling}(p=i4(c,h.mode,p)).return=h,h=p}return u(h);case nv:return t(h,d,c=ex(c),p)}if(nS(c))return function(t,i,s,o){for(var u=null,h=null,d=i,c=i=0,p=null;null!==d&&c<s.length;c++){d.index>c?(p=d,d=null):p=d.sibling;var v=m(t,d,s[c],o);if(null===v){null===d&&(d=p);break}e&&d&&null===v.alternate&&r(t,d),i=l(v,i,c),null===h?u=v:h.sibling=v,h=v,d=p}if(c===s.length)return n(t,d),ot&&w(t,c),u;if(null===d){for(;c<s.length;c++)null!==(d=f(t,s[c],o))&&(i=l(d,i,c),null===h?u=d:h.sibling=d,h=d);return ot&&w(t,c),u}for(d=a(d);c<s.length;c++)null!==(p=g(d,t,c,s[c],o))&&(e&&null!==p.alternate&&d.delete(null===p.key?c:p.key),i=l(p,i,c),null===h?u=p:h.sibling=p,h=p);return e&&d.forEach(function(e){return r(t,e)}),ot&&w(t,c),u}(h,d,c,p);if(o(c)){if("function"!=typeof(v=o(c)))throw Error(i(150));return function(t,s,o,u){if(null==o)throw Error(i(151));for(var h=null,d=null,c=s,p=s=0,v=null,y=o.next();null!==c&&!y.done;p++,y=o.next()){c.index>p?(v=c,c=null):v=c.sibling;var _=m(t,c,y.value,u);if(null===_){null===c&&(c=v);break}e&&c&&null===_.alternate&&r(t,c),s=l(_,s,p),null===d?h=_:d.sibling=_,d=_,c=v}if(y.done)return n(t,c),ot&&w(t,p),h;if(null===c){for(;!y.done;p++,y=o.next())null!==(y=f(t,y.value,u))&&(s=l(y,s,p),null===d?h=y:d.sibling=y,d=y);return ot&&w(t,p),h}for(c=a(c);!y.done;p++,y=o.next())null!==(y=g(c,t,p,y.value,u))&&(e&&null!==y.alternate&&c.delete(null===y.key?p:y.key),s=l(y,s,p),null===d?h=y:d.sibling=y,d=y);return e&&c.forEach(function(e){return r(t,e)}),ot&&w(t,p),h}(h,d,c=v.call(c),p)}if("function"==typeof c.then)return t(h,d,eT(c),p);if(c.$$typeof===nc)return t(h,d,ee(h,c),p);eM(h,c)}return"string"==typeof c&&""!==c||"number"==typeof c||"bigint"==typeof c?(c=""+c,null!==d&&6===d.tag?(n(h,d.sibling),(p=s(d,c)).return=h):(n(h,d),(p=i2(c,h.mode,p)).return=h),u(h=p)):n(h,d)}(h,d,c,p);return oR=null,v}catch(e){if(e===oA||e===oE)throw e;var y=t(29,e,null,h.mode);return y.lanes=p,y.return=h,y}finally{}}}function eC(){for(var e=oP,t=oF=oP=0;t<e;){var r=oI[t];oI[t++]=null;var i=oI[t];oI[t++]=null;var n=oI[t];oI[t++]=null;var a=oI[t];if(oI[t++]=null,null!==i&&null!==n){var s=i.pending;null===s?n.next=n:(n.next=s.next,s.next=n),i.pending=n}0!==a&&eL(r,n,a)}}function ew(e,t,r,i){oI[oP++]=e,oI[oP++]=t,oI[oP++]=r,oI[oP++]=i,oF|=i,e.lanes|=i,null!==(e=e.alternate)&&(e.lanes|=i)}function eR(e,t,r,i){return ew(e,t,r,i),eB(e)}function eN(e,t){return ew(e,null,null,t),eB(e)}function eL(e,t,r){e.lanes|=r;var i=e.alternate;null!==i&&(i.lanes|=r);for(var n=!1,a=e.return;null!==a;)a.childLanes|=r,null!==(i=a.alternate)&&(i.childLanes|=r),22===a.tag&&(null===(e=a.stateNode)||1&e._visibility||(n=!0)),e=a,a=a.return;return 3===e.tag?(a=e.stateNode,n&&null!==t&&(n=31-sE(r),null===(i=(e=a.hiddenUpdates)[n])?e[n]=[t]:i.push(t),t.lane=0x20000000|r),a):null}function eB(e){if(50<lX)throw lX=0,lq=null,Error(i(185));for(var t=e.return;null!==t;)t=(e=t).return;return 3===e.tag?e.stateNode:null}function eI(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function eP(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function eF(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function eD(e,t,r){var i=e.updateQueue;if(null===i)return null;if(i=i.shared,(2&lm)!=0){var n=i.pending;return null===n?t.next=t:(t.next=n.next,n.next=t),i.pending=t,t=eB(e),eL(e,null,r),t}return ew(e,i,t,r),eB(e)}
389function eU(e,t,r){if(null!==(t=t.updateQueue)&&(t=t.shared,(4194048&r)!=0)){var i=t.lanes;i&=e.pendingLanes,r|=i,t.lanes=r,_(e,r)}}function eO(e,t){var r=e.updateQueue,i=e.alternate;if(null!==i&&r===(i=i.updateQueue)){var n=null,a=null;if(null!==(r=r.firstBaseUpdate)){do{var s={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};null===a?n=a=s:a=a.next=s,r=r.next}while(null!==r)null===a?n=a=t:a=a.next=t}else n=a=t;r={baseState:i.baseState,firstBaseUpdate:n,lastBaseUpdate:a,shared:i.shared,callbacks:i.callbacks},e.updateQueue=r;return}null===(e=r.lastBaseUpdate)?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function eG(){if(oU){var e=ob;if(null!==e)throw e}}function ek(e,t,r,i){oU=!1;var n=e.updateQueue;oD=!1;var a=n.firstBaseUpdate,s=n.lastBaseUpdate,o=n.shared.pending;if(null!==o){n.shared.pending=null;var l=o,u=l.next;l.next=null,null===s?a=u:s.next=u,s=l;var h=e.alternate;null!==h&&(o=(h=h.updateQueue).lastBaseUpdate)!==s&&(null===o?h.firstBaseUpdate=u:o.next=u,h.lastBaseUpdate=l)}if(null!==a){var d=n.baseState;for(s=0,h=u=l=null,o=a;;){var c=-0x20000001&o.lane,p=c!==o.lane;if(p?(ly&c)===c:(i&c)===c){0!==c&&c===ox&&(oU=!0),null!==h&&(h=h.next={lane:0,tag:o.tag,payload:o.payload,callback:null,next:null});o:{var f=e,m=o;switch(c=t,m.tag){case 1:if("function"==typeof(f=m.payload)){d=f.call(r,d,c);break o}d=f;break o;case 3:f.flags=-65537&f.flags|128;case 0:if(null==(c="function"==typeof(f=m.payload)?f.call(r,d,c):f))break o;d=nn({},d,c);break o;case 2:oD=!0}}null!==(c=o.callback)&&(e.flags|=64,p&&(e.flags|=8192),null===(p=n.callbacks)?n.callbacks=[c]:p.push(c))}else p={lane:c,tag:o.tag,payload:o.payload,callback:o.callback,next:null},null===h?(u=h=p,l=d):h=h.next=p,s|=c;if(null===(o=o.next)){if(null===(o=n.shared.pending))break;o=(p=o).next,p.next=null,n.lastBaseUpdate=p,n.shared.pending=null}}null===h&&(l=d),n.baseState=l,n.firstBaseUpdate=u,n.lastBaseUpdate=h,null===a&&(n.shared.lanes=0),lE|=s,e.lanes=s,e.memoizedState=d}}function eV(e,t){if("function"!=typeof e)throw Error(i(191,e));e.call(t)}function ez(e,t){var r=e.callbacks;if(null!==r)for(e.callbacks=null,e=0;e<r.length;e++)eV(r[e],t)}function eH(e,t){d(oG,e=lA),d(oO,t),lA=e|t.baseLanes}function eW(){d(oG,lA),d(oO,oO.current)}function ej(){lA=oG.current,h(oO),h(oG)}function eX(e){var t=e.alternate;d(oz,1&oz.current),d(ok,e),null===oV&&(null===t||null!==oO.current||null!==t.memoizedState)&&(oV=e)}function eq(e){d(oz,oz.current),d(ok,e),null===oV&&(oV=e)}function e$(e){22===e.tag?(d(oz,oz.current),d(ok,e),null===oV&&(oV=e)):eJ()}function eJ(){d(oz,oz.current),d(ok,ok.current)}function eK(e){h(ok),oV===e&&(oV=null),h(oz)}function eY(e){for(var t=e;null!==t;){if(13===t.tag){var r=t.memoizedState;if(null!==r&&(null===(r=r.dehydrated)||aR(r)||aN(r)))return t}else if(19===t.tag&&("forwards"===t.memoizedProps.revealOrder||"backwards"===t.memoizedProps.revealOrder||"unstable_legacy-backwards"===t.memoizedProps.revealOrder||"together"===t.memoizedProps.revealOrder)){if((128&t.flags)!=0)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function eQ(){throw Error(i(321))}function eZ(e,t){if(null===t)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!sj(e[r],t[r]))return!1;return!0}function e0(e,t,r,i,n,a){return oH=a,oW=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,nT.H=null===e||null===e.memoizedState?o1:o2,oJ=!1,a=r(i,n),oJ=!1,o$&&(a=e2(t,r,i,n)),e1(e),a}function e1(e){nT.H=o0;var t=null!==oj&&null!==oj.next;if(oH=0,oX=oj=oW=null,oq=!1,oY=0,oQ=null,t)throw Error(i(300));null===e||o8||null!==(e=e.dependencies)&&Y(e)&&(o8=!0)}function e2(e,t,r,n){oW=e;var a=0;do{if(o$&&(oQ=null),oY=0,o$=!1,25<=a)throw Error(i(301));if(a+=1,oX=oj=null,null!=e.updateQueue){var s=e.updateQueue;s.lastEffect=null,s.events=null,s.stores=null,null!=s.memoCache&&(s.memoCache.index=0)}nT.H=o3,s=t(r,n)}while(o$)return s}function e3(){var e=nT.H,t=e.useState()[0];return t="function"==typeof t.then?te(t):t,e=e.useState()[0],(null!==oj?oj.memoizedState:null)!==e&&(oW.flags|=1024),t}function e4(){var e=0!==oK;return oK=0,e}function e5(e,t,r){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~r}function e8(e){if(oq){for(e=e.memoizedState;null!==e;){var t=e.queue;
389null!==t&&(t.pending=null),e=e.next}oq=!1}oH=0,oX=oj=oW=null,o$=!1,oY=oK=0,oQ=null}function e6(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===oX?oW.memoizedState=oX=e:oX=oX.next=e,oX}function e9(){if(null===oj){var e=oW.alternate;e=null!==e?e.memoizedState:null}else e=oj.next;var t=null===oX?oW.memoizedState:oX.next;if(null!==t)oX=t,oj=e;else{if(null===e)throw null===oW.alternate?Error(i(467)):Error(i(310));e={memoizedState:(oj=e).memoizedState,baseState:oj.baseState,baseQueue:oj.baseQueue,queue:oj.queue,next:null},null===oX?oW.memoizedState=oX=e:oX=oX.next=e}return oX}function e7(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function te(e){var t=oY;return oY+=1,null===oQ&&(oQ=[]),e=e_(oQ,e,t),t=oW,(null===oX?t.memoizedState:oX.next)===null&&(nT.H=null===(t=t.alternate)||null===t.memoizedState?o1:o2),e}function tt(e){if(null!==e&&"object"==typeof e){if("function"==typeof e.then)return te(e);if(e.$$typeof===nc)return Z(e)}throw Error(i(438,String(e)))}function tr(e){var t=null,r=oW.updateQueue;if(null!==r&&(t=r.memoCache),null==t){var i=oW.alternate;null!==i&&null!==(i=i.updateQueue)&&null!=(i=i.memoCache)&&(t={data:i.data.map(function(e){return e.slice()}),index:0})}if(null==t&&(t={data:[],index:0}),null===r&&(r=e7(),oW.updateQueue=r),r.memoCache=t,void 0===(r=t.data[t.index]))for(r=t.data[t.index]=Array(e),i=0;i<e;i++)r[i]=n_;return t.index++,r}function ti(e,t){return"function"==typeof t?t(e):t}function tn(e){return ta(e9(),oj,e)}function ta(e,t,r){var n=e.queue;if(null===n)throw Error(i(311));n.lastRenderedReducer=r;var a=e.baseQueue,s=n.pending;if(null!==s){if(null!==a){var o=a.next;a.next=s.next,s.next=o}t.baseQueue=a=s,n.pending=null}if(s=e.baseState,null===a)e.memoizedState=s;else{t=a.next;var l=o=null,u=null,h=t,d=!1;do{var c=-0x20000001&h.lane;if(c!==h.lane?(ly&c)===c:(oH&c)===c){var p=h.revertLane;if(0===p)null!==u&&(u=u.next={lane:0,revertLane:0,gesture:null,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null}),c===ox&&(d=!0);else if((oH&p)===p){h=h.next,p===ox&&(d=!0);continue}else c={lane:0,revertLane:h.revertLane,gesture:null,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null},null===u?(l=u=c,o=s):u=u.next=c,oW.lanes|=p,lE|=p;c=h.action,oJ&&r(s,c),s=h.hasEagerState?h.eagerState:r(s,c)}else p={lane:c,revertLane:h.revertLane,gesture:h.gesture,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null},null===u?(l=u=p,o=s):u=u.next=p,oW.lanes|=c,lE|=c;h=h.next}while(null!==h&&h!==t)if(null===u?o=s:u.next=l,!sj(s,e.memoizedState)&&(o8=!0,d&&null!==(r=ob)))throw r;e.memoizedState=s,e.baseState=o,e.baseQueue=u,n.lastRenderedState=s}return null===a&&(n.lanes=0),[e.memoizedState,n.dispatch]}function ts(e){var t=e9(),r=t.queue;if(null===r)throw Error(i(311));r.lastRenderedReducer=e;var n=r.dispatch,a=r.pending,s=t.memoizedState;if(null!==a){r.pending=null;var o=a=a.next;do s=e(s,o.action),o=o.next;while(o!==a)sj(s,t.memoizedState)||(o8=!0),t.memoizedState=s,null===t.baseQueue&&(t.baseState=s),r.lastRenderedState=s}return[s,n]}function to(e,t,r){var n=oW,a=e9(),s=ot;if(s){if(void 0===r)throw Error(i(407));r=r()}else r=t();var o=!sj((oj||a).memoizedState,r);if(o&&(a.memoizedState=r,o8=!0),a=a.queue,tB(th.bind(null,n,a,e),[e]),a.getSnapshot!==t||o||null!==oX&&1&oX.memoizedState.tag){if(n.flags|=2048,tC(9,{destroy:void 0},tu.bind(null,n,a,r,t),null),null===lg)throw Error(i(349));s||(127&oH)!=0||tl(n,t,r)}return r}function tl(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},null===(t=oW.updateQueue)?(t=e7(),oW.updateQueue=t,t.stores=[e]):null===(r=t.stores)?t.stores=[e]:r.push(e)}
389function tu(e,t,r,i){t.value=r,t.getSnapshot=i,td(t)&&tc(e)}function th(e,t,r){return r(function(){td(t)&&tc(e)})}function td(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!sj(e,r)}catch{return!0}}function tc(e){var t=eN(e,2);null!==t&&iy(t,e,2)}function tp(e){var t=e6();if("function"==typeof e){var r=e;if(e=r(),oJ){T(!0);try{r()}finally{T(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ti,lastRenderedState:e},t}function tf(e,t,r,i){return e.baseState=r,ta(e,oj,"function"==typeof i?i:ti)}function tm(e,t,r,n,a){if(tZ(e))throw Error(i(485));if(null!==(e=t.action)){var s={payload:a,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(e){s.listeners.push(e)}};null!==nT.T?r(!0):s.isTransition=!1,n(s),null===(r=t.pending)?(s.next=t.pending=s,tg(t,s)):(s.next=r.next,t.pending=r.next=s)}}function tg(e,t){var r=t.action,i=t.payload,n=e.state;if(t.isTransition){var a=nT.T,s={};nT.T=s;try{var o=r(n,i),l=nT.S;null!==l&&l(s,o),tv(e,t,o)}catch(r){t_(e,t,r)}finally{null!==a&&null!==s.types&&(a.types=s.types),nT.T=a}}else try{a=r(n,i),tv(e,t,a)}catch(r){t_(e,t,r)}}function tv(e,t,r){null!==r&&"object"==typeof r&&"function"==typeof r.then?r.then(function(r){ty(e,t,r)},function(r){return t_(e,t,r)}):ty(e,t,r)}function ty(e,t,r){t.status="fulfilled",t.value=r,tx(t),e.state=r,null!==(t=e.pending)&&((r=t.next)===t?e.pending=null:(r=r.next,t.next=r,tg(e,r)))}function t_(e,t,r){var i=e.pending;if(e.pending=null,null!==i){i=i.next;do t.status="rejected",t.reason=r,tx(t),t=t.next;while(t!==i)}e.action=null}function tx(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function tb(e,t){return t}function tS(e,t){if(ot){var r=lg.formState;if(null!==r){o:{var i=oW;if(ot){if(oe){var n=aI(oe,oi);if(n){oe=aF(n),i=aP(n);break o}}G(i)}i=!1}i&&(t=r[0])}}(r=e6()).memoizedState=r.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tb,lastRenderedState:t},r.queue=i,r=tK.bind(null,oW,i),i.dispatch=r,i=tp(!1);var a=tQ.bind(null,oW,!1,i.queue);return i=e6(),n={state:t,dispatch:null,action:e,pending:null},i.queue=n,r=tm.bind(null,oW,n,a,r),n.dispatch=r,i.memoizedState=e,[t,r,!1]}function tT(e){return tA(e9(),oj,e)}function tA(e,t,r){if(t=ta(e,t,tb)[0],e=tn(ti)[0],"object"==typeof t&&null!==t&&"function"==typeof t.then)try{var i=te(t)}catch(e){throw e===oA?oE:e}else i=t;var n=(t=e9()).queue,a=n.dispatch;return r!==t.memoizedState&&(oW.flags|=2048,tC(9,{destroy:void 0},tM.bind(null,n,r),null)),[i,a,e]}function tM(e,t){e.action=t}function tE(e){var t=e9(),r=oj;if(null!==r)return tA(t,r,e);e9(),t=t.memoizedState;var i=(r=e9()).queue.dispatch;return r.memoizedState=e,[t,i,!1]}function tC(e,t,r,i){return e={tag:e,create:r,deps:i,inst:t,next:null},null===(t=oW.updateQueue)&&(t=e7(),oW.updateQueue=t),null===(r=t.lastEffect)?t.lastEffect=e.next=e:(i=r.next,r.next=e,e.next=i,t.lastEffect=e),e}function tw(){return e9().memoizedState}function tR(e,t,r,i){var n=e6();oW.flags|=e,n.memoizedState=tC(1|t,{destroy:void 0},r,void 0===i?null:i)}function tN(e,t,r,i){var n=e9();i=void 0===i?null:i;var a=n.memoizedState.inst;null!==oj&&null!==i&&eZ(i,oj.memoizedState.deps)?n.memoizedState=tC(t,a,r,i):(oW.flags|=e,n.memoizedState=tC(1|t,a,r,i))}function tL(e,t){tR(8390656,8,e,t)}function tB(e,t){tN(2048,8,e,t)}function tI(e){var t=e9().memoizedState;return function(e){oW.flags|=4;var t=oW.updateQueue;if(null===t)t=e7(),oW.updateQueue=t,t.events=[e];else{var r=t.events;null===r?t.events=[e]:r.push(e)}}({ref:t,nextImpl:e}),function(){if((2&lm)!=0)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function tP(e,t){return tN(4,2,e,t)}function tF(e,t){return tN(4,4,e,t)}function tD(e,t){if("function"==typeof t){var r=t(e=e());return function(){"function"==typeof r?r():t(null)}}if(null!=t)return t.current=e=e(),function(){t.current=null}}function tU(e,t,r){r=null!=r?r.concat([e]):null,tN(4,4,tD.bind(null,t,e),r)}function tO(){}function tG(e,t){var r=e9();t=void 0===t?null:t;var i=r.memoizedState;return null!==t&&eZ(t,i[1])?i[0]:(r.memoizedState=[e,t],e)}function tk(e,t){var r=e9();t=void 0===t?null:t;var i=r.memoizedState;if(null!==t&&eZ(t,i[1]))return i[0];if(i=e(),oJ){T(!0);try{e()}finally{T(!1)}}return r.memoizedState=[i,t],i}function tV(e,t,r){return void 0===r||(0x40000000&oH)!=0&&(261930&ly)==0?e.memoizedState=t:(e.memoizedState=r,e=iv(),oW.lanes|=e,lE|=e,r)}
389function tz(e,t,r,i){return sj(r,t)?r:null!==oO.current?(sj(e=tV(e,r,i),t)||(o8=!0),e):(42&oH)==0||(0x40000000&oH)!=0&&(261930&ly)==0?(o8=!0,e.memoizedState=r):(e=iv(),oW.lanes|=e,lE|=e,t)}function tH(e,t,r,i,n){var a=nq();nX(0!==a&&8>a?a:8);var s=nT.T,o={};nT.T=o,tQ(e,!1,t,r);try{var l=n(),u=nT.S;if(null!==u&&u(o,l),null!==l&&"object"==typeof l&&"function"==typeof l.then){var h,d,c=(h=[],d={status:"pending",value:null,reason:null,then:function(e){h.push(e)}},l.then(function(){d.status="fulfilled",d.value=i;for(var e=0;e<h.length;e++)(0,h[e])(i)},function(e){for(d.status="rejected",d.reason=e,e=0;e<h.length;e++)(0,h[e])(void 0)}),d);tY(e,t,c,ig(e))}else tY(e,t,i,ig(e))}catch(r){tY(e,t,{then:function(){},status:"rejected",reason:r},ig())}finally{nX(a),null!==s&&null!==o.types&&(s.types=o.types),nT.T=s}}function tW(e){var t=e.memoizedState;if(null!==t)return t;var r={};return(t={memoizedState:n4,baseState:n4,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ti,lastRenderedState:n4},next:null}).next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ti,lastRenderedState:r},next:null},e.memoizedState=t,null!==(e=e.alternate)&&(e.memoizedState=t),t}function tj(){return Z(n5)}function tX(){return e9().memoizedState}function tq(){return e9().memoizedState}function t$(e){for(var t=e.return;null!==t;){switch(t.tag){case 24:case 3:var r=ig(),i=eD(t,e=eF(r),r);null!==i&&(iy(i,t,r),eU(i,t,r)),t={cache:er()},e.payload=t;return}t=t.return}}function tJ(e,t,r){var i=ig();r={lane:i,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},tZ(e)?t0(t,r):null!==(r=eR(e,t,r,i))&&(iy(r,e,i),t1(r,t,i))}function tK(e,t,r){tY(e,t,r,ig())}function tY(e,t,r,i){var n={lane:i,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(tZ(e))t0(t,n);else{var a=e.alternate;if(0===e.lanes&&(null===a||0===a.lanes)&&null!==(a=t.lastRenderedReducer))try{var s=t.lastRenderedState,o=a(s,r);if(n.hasEagerState=!0,n.eagerState=o,sj(o,s))return ew(e,t,n,0),null===lg&&eC(),!1}catch{}finally{}if(null!==(r=eR(e,t,n,i)))return iy(r,e,i),t1(r,t,i),!0}return!1}function tQ(e,t,r,n){if(n={lane:2,revertLane:ec(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},tZ(e)){if(t)throw Error(i(479))}else null!==(t=eR(e,r,n,2))&&iy(t,e,2)}function tZ(e){var t=e.alternate;return e===oW||null!==t&&t===oW}function t0(e,t){o$=oq=!0;var r=e.pending;null===r?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function t1(e,t,r){if((4194048&r)!=0){var i=t.lanes;i&=e.pendingLanes,t.lanes=r|=i,_(e,r)}}function t2(e,t,r,i){r=null==(r=r(i,t=e.memoizedState))?t:nn({},t,r),e.memoizedState=r,0===e.lanes&&(e.updateQueue.baseState=r)}function t3(e,t,r,i,n,a,s){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(i,a,s):!t.prototype||!t.prototype.isPureReactComponent||!ev(r,i)||!ev(n,a)}function t4(e,t,r,i){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(r,i),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(r,i),t.state!==e&&o4.enqueueReplaceState(t,t.state,null)}function t5(e,t){var r=t;if("ref"in t)for(var i in r={},t)"ref"!==i&&(r[i]=t[i]);if(e=e.defaultProps)for(var n in r===t&&(r=nn({},r)),e)void 0===r[n]&&(r[n]=e[n]);return r}function t8(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function t6(e,t,r){try{(0,e.onCaughtError)(r.value,{componentStack:r.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function t9(e,t,r){return(r=eF(r)).tag=3,r.payload={element:null},r.callback=function(){t8(e,t)},r}function t7(e){return(e=eF(e)).tag=3,e}function re(e,t,r,i){var n=r.type.getDerivedStateFromError;if("function"==typeof n){var a=i.value;e.payload=function(){return n(a)},e.callback=function(){t6(t,r,i)}}var s=r.stateNode;null!==s&&"function"==typeof s.componentDidCatch&&(e.callback=function(){t6(t,r,i),"function"!=typeof n&&(null===lO?lO=new Set([this]):lO.add(this));var e=i.stack;this.componentDidCatch(i.value,{componentStack:null!==e?e:""})})}
389function rt(e,t,r,i){t.child=null===e?oB(t,null,r,i):oL(t,e.child,r,i)}function rr(e,t,r,i,n){r=r.render;var a=t.ref;if("ref"in i){var s={};for(var o in i)"ref"!==o&&(s[o]=i[o])}else s=i;return Q(t),i=e0(e,t,r,s,a,n),o=e4(),null===e||o8?(ot&&o&&N(t),t.flags|=1,rt(e,t,i,n),t.child):(e5(e,t,n),rA(e,t,n))}function ri(e,t,r,i,n){if(null===e){var a=r.type;return"function"!=typeof a||iY(a)||void 0!==a.defaultProps||null!==r.compare?((e=i0(r.type,null,i,t,t.mode,n)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,rn(e,t,a,i,n))}if(a=e.child,!rM(e,n)){var s=a.memoizedProps;if((r=null!==(r=r.compare)?r:ev)(s,i)&&e.ref===t.ref)return rA(e,t,n)}return t.flags|=1,(e=iQ(a,i)).ref=t.ref,e.return=t,t.child=e}function rn(e,t,r,i,n){if(null!==e){var a=e.memoizedProps;if(ev(a,i)&&e.ref===t.ref)if(o8=!1,t.pendingProps=i=a,!rM(e,n))return t.lanes=e.lanes,rA(e,t,n);else(131072&e.flags)!=0&&(o8=!0)}return rd(e,t,r,i,n)}function ra(e,t,r,i){var n=i.children,a=null!==e?e.memoizedState:null;if(null===e&&null===t.stateNode&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),"hidden"===i.mode){if((128&t.flags)!=0){if(a=null!==a?a.baseLanes|r:r,null!==e){for(i=t.child=e.child,n=0;null!==i;)n=n|i.lanes|i.childLanes,i=i.sibling;i=n&~a}else i=0,t.child=null;return ro(e,t,a,r,i)}if((0x20000000&r)==0)return i=t.lanes=0x20000000,ro(e,t,null!==a?a.baseLanes|r:r,r,i);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&em(t,null!==a?a.cachePool:null),null!==a?eH(t,a):eW(),e$(t)}else null!==a?(em(t,a.cachePool),eH(t,a),eJ(),t.memoizedState=null):(null!==e&&em(t,null),eW(),eJ());return rt(e,t,n,r),t.child}function rs(e,t){return null!==e&&22===e.tag||null!==t.stateNode||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ro(e,t,r,i,n){var a=ef();return t.memoizedState={baseLanes:r,cachePool:a=null===a?null:{parent:nk?od._currentValue:od._currentValue2,pool:a}},null!==e&&em(t,null),eW(),e$(t),null!==e&&K(e,t,i,!0),t.childLanes=n,null}function rl(e,t){return(t=r_({mode:t.mode,children:t.children},e.mode)).ref=e.ref,e.child=t,t.return=e,t}function ru(e,t,r){return oL(t,e.child,null,r),e=rl(t,t.pendingProps),e.flags|=2,eK(t),t.memoizedState=null,e}function rh(e,t){var r=t.ref;if(null===r)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!=typeof r&&"object"!=typeof r)throw Error(i(284));(null===e||e.ref!==r)&&(t.flags|=4194816)}}function rd(e,t,r,i,n){return Q(t),r=e0(e,t,r,i,void 0,n),i=e4(),null===e||o8?(ot&&i&&N(t),t.flags|=1,rt(e,t,r,n),t.child):(e5(e,t,n),rA(e,t,n))}function rc(e,t,r,i,n,a){return Q(t),t.updateQueue=null,r=e2(t,i,r,n),e1(e),i=e4(),null===e||o8?(ot&&i&&N(t),t.flags|=1,rt(e,t,r,a),t.child):(e5(e,t,a),rA(e,t,a))}function rp(e,t,r,i,n){if(Q(t),null===t.stateNode){var a=sM,s=r.contextType;"object"==typeof s&&null!==s&&(a=Z(s)),t.memoizedState=null!==(a=new r(i,a)).state&&void 0!==a.state?a.state:null,a.updater=o4,t.stateNode=a,a._reactInternals=t,(a=t.stateNode).props=i,a.state=t.memoizedState,a.refs={},eI(t),s=r.contextType,a.context="object"==typeof s&&null!==s?Z(s):sM,a.state=t.memoizedState,"function"==typeof(s=r.getDerivedStateFromProps)&&(t2(t,r,s,i),a.state=t.memoizedState),"function"==typeof r.getDerivedStateFromProps||"function"==typeof a.getSnapshotBeforeUpdate||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||(s=a.state,"function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount(),s!==a.state&&o4.enqueueReplaceState(a,a.state,null),ek(t,i,a,n),eG(),a.state=t.memoizedState),"function"==typeof a.componentDidMount&&(t.flags|=4194308),i=!0}else if(null===e){a=t.stateNode;var o=t.memoizedProps,l=t5(r,o);a.props=l;var u=a.context,h=r.contextType;s=sM,"object"==typeof h&&null!==h&&(s=Z(h));var d=r.getDerivedStateFromProps;h="function"==typeof d||"function"==typeof a.getSnapshotBeforeUpdate,o=t.pendingProps!==o,h||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(o||u!==s)&&t4(t,a,i,s),oD=!1;var c=t.memoizedState;a.state=c,ek(t,i,a,n),eG(),u=t.memoizedState,o||c!==u||oD?("function"==typeof d&&(t2(t,r,d,i),u=t.memoizedState),(l=oD||t3(t,r,l,i,c,u,s))?(h||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.flags|=4194308)):("function"==typeof a.componentDidMount&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=u),a.props=i,a.state=u,a.context=s,i=l):("function"==typeof a.componentDidMount&&(t.flags|=4194308),i=!1)}else{a=t.stateNode,eP(e,t),h=t5(r,s=t.memoizedProps),a.props=h,d=t.pendingProps,c=a.context,u=r.contextType,l=sM,"object"==typeof u&&null!==u&&(l=Z(u)),(u="function"==typeof(o=r.getDerivedStateFromProps)||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==d||c!==l)&&t4(t,a,i,l),oD=!1,c=t.memoizedState,a.state=c,ek(t,i,a,n),eG();var p=t.memoizedState;
389s!==d||c!==p||oD||null!==e&&null!==e.dependencies&&Y(e.dependencies)?("function"==typeof o&&(t2(t,r,o,i),p=t.memoizedState),(h=oD||t3(t,r,h,i,c,p,l)||null!==e&&null!==e.dependencies&&Y(e.dependencies))?(u||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(i,p,l),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(i,p,l)),"function"==typeof a.componentDidUpdate&&(t.flags|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&c===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&c===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=p),a.props=i,a.state=p,a.context=l,i=h):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&c===e.memoizedState||(t.flags|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&c===e.memoizedState||(t.flags|=1024),i=!1)}return a=i,rh(e,t),i=(128&t.flags)!=0,a||i?(a=t.stateNode,r=i&&"function"!=typeof r.getDerivedStateFromError?null:a.render(),t.flags|=1,null!==e&&i?(t.child=oL(t,e.child,null,n),t.child=oL(t,null,r,n)):rt(e,t,r,n),t.memoizedState=a.state,e=t.child):e=rA(e,t,n),e}function rf(e,t,r,i){return H(),t.flags|=256,rt(e,t,r,i),t.child}function rm(e){return{baseLanes:e,cachePool:eg()}}function rg(e,t,r){return e=null!==e?e.childLanes&~r:0,t&&(e|=lR),e}function rv(e,t,r){var n,a=t.pendingProps,s=!1,o=(128&t.flags)!=0;if((n=o)||(n=(null===e||null!==e.memoizedState)&&(2&oz.current)!=0),n&&(s=!0,t.flags&=-129),n=(32&t.flags)!=0,t.flags&=-33,null===e){if(ot){if(s?eX(t):eJ(),(e=oe)?null!==(e=aj(e,oi))&&(t.memoizedState={dehydrated:e,treeContext:null!==s2?{id:s3,overflow:s4}:null,retryLane:0x20000000,hydrationErrors:null},(r=i3(e)).return=t,t.child=r,s7=t,oe=null):e=null,null===e)throw G(t);return aN(e)?t.lanes=32:t.lanes=0x20000000,null}var l=a.children;return a=a.fallback,s?(eJ(),l=r_({mode:"hidden",children:l},s=t.mode),a=i1(a,s,r,null),l.return=t,a.return=t,l.sibling=a,t.child=l,(a=t.child).memoizedState=rm(r),a.childLanes=rg(e,n,r),t.memoizedState=o6,rs(null,a)):(eX(t),ry(t,l))}var u=e.memoizedState;if(null!==u&&null!==(l=u.dehydrated)){if(o)256&t.flags?(eX(t),t.flags&=-257,t=rx(e,t,r)):null!==t.memoizedState?(eJ(),t.child=e.child,t.flags|=128,t=null):(eJ(),l=a.fallback,s=t.mode,a=r_({mode:"visible",children:a.children},s),l=i1(l,s,r,null),l.flags|=2,a.return=t,l.return=t,a.sibling=l,t.child=a,oL(t,e.child,null,r),(a=t.child).memoizedState=rm(r),a.childLanes=rg(e,n,r),t.memoizedState=o6,t=rs(null,a));else if(eX(t),aN(l))n=aL(l).digest,(a=Error(i(419))).stack="",a.digest=n,j({value:a,source:null,stack:null}),t=rx(e,t,r);else if(o8||K(e,t,r,!1),n=(r&e.childLanes)!=0,o8||n){if(null!==(n=lg)&&0!==(a=x(n,r))&&a!==u.retryLane)throw u.retryLane=a,eN(e,a),iy(n,e,a),o5;aR(l)||iR(),t=rx(e,t,r)}else aR(l)?(t.flags|=192,t.child=e.child,t=null):(e=u.treeContext,nH&&(oe=ak(l),s7=t,ot=!0,or=null,oi=!1,null!==e&&P(t,e)),t=ry(t,a.children),t.flags|=4096);return t}return s?(eJ(),l=a.fallback,s=t.mode,o=(u=e.child).sibling,(a=iQ(u,{mode:"hidden",children:a.children})).subtreeFlags=0x3e00000&u.subtreeFlags,null!==o?l=iQ(o,l):(l=i1(l,s,r,null),l.flags|=2),l.return=t,a.return=t,a.sibling=l,t.child=a,rs(null,a),a=t.child,null===(l=e.child.memoizedState)?l=rm(r):(null!==(s=l.cachePool)?(u=nk?od._currentValue:od._currentValue2,s=s.parent!==u?{parent:u,pool:u}:s):s=eg(),l={baseLanes:l.baseLanes|r,cachePool:s}),a.memoizedState=l,a.childLanes=rg(e,n,r),t.memoizedState=o6,rs(e.child,a)):(eX(t),e=(r=e.child).sibling,(r=iQ(r,{mode:"visible",children:a.children})).return=t,r.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r)}function ry(e,t){return(t=r_({mode:"visible",children:t},e.mode)).return=e,e.child=t}function r_(e,r){return(e=t(22,e,null,r)).lanes=0,e}function rx(e,t,r){return oL(t,e.child,null,r),e=ry(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function rb(e,t,r){e.lanes|=t;var i=e.alternate;null!==i&&(i.lanes|=t),$(e.return,t,r)}function rS(e,t,r,i,n,a){var s=e.memoizedState;null===s?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:r,tailMode:n,treeForkCount:a}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=r,s.tailMode=n,s.treeForkCount=a)}function rT(e,t,r){var i=t.pendingProps,n=i.revealOrder,a=i.tail;i=i.children;var s=oz.current,o=(2&s)!=0;if(o?(s=1&s|2,t.flags|=128):s&=1,d(oz,s),rt(e,t,i,r),i=ot?sZ:0,!o&&null!==e&&(128&e.flags)!=0)o:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&rb(e,r,t);else if(19===e.tag)rb(e,r,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)break o;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(n){case"forwards":for(r=t.child,n=null;null!==r;)null!==(e=r.alternate)&&null===eY(e)&&(n=r),r=r.sibling;null===(r=n)?(n=t.child,t.child=null):(n=r.sibling,r.sibling=null),rS(t,!1,n,r,a,i);break;case"backwards":case"unstable_legacy-backwards":for(r=null,n=t.child,t.child=null;null!==n;){if(null!==(e=n.alternate)&&null===eY(e)){t.child=n;break}e=n.sibling,n.sibling=r,r=n,n=e}rS(t,!0,r,null,a,i);break;case"together":rS(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function rA(e,t,r){if(null!==e&&(t.dependencies=e.dependencies),lE|=t.lanes,(r&t.childLanes)==0){if(null===e)return null;else if(K(e,t,r,!1),(r&t.childLanes)==0)return null}if(null!==e&&t.child!==e.child)throw Error(i(153));if(null!==t.child){for(r=iQ(e=t.child,e.pendingProps),t.child=r,r.return=t;null!==e.sibling;)e=e.sibling,(r=r.sibling=iQ(e,e.pendingProps)).return=t;r.sibling=null}return t.child}
389function rM(e,t){return(e.lanes&t)!=0||!!(null!==(e=e.dependencies)&&Y(e))}function rE(e,t,r){if(null!==e)if(e.memoizedProps!==t.pendingProps)o8=!0;else{if(!rM(e,r)&&(128&t.flags)==0)return o8=!1,function(e,t,r){switch(t.tag){case 3:F(t,t.stateNode.containerInfo),X(t,od,e.memoizedState.cache),H();break;case 27:case 5:U(t);break;case 4:F(t,t.stateNode.containerInfo);break;case 10:X(t,t.type,t.memoizedProps.value);break;case 31:if(null!==t.memoizedState)return t.flags|=128,eq(t),null;break;case 13:var i=t.memoizedState;if(null!==i)return null!==i.dehydrated?(eX(t),t.flags|=128,null):(r&t.child.childLanes)!=0?rv(e,t,r):(eX(t),null!==(e=rA(e,t,r))?e.sibling:null);eX(t);break;case 19:var n=(128&e.flags)!=0;if((i=(r&t.childLanes)!=0)||(K(e,t,r,!1),i=(r&t.childLanes)!=0),n){if(i)return rT(e,t,r);t.flags|=128}if(null!==(n=t.memoizedState)&&(n.rendering=null,n.tail=null,n.lastEffect=null),d(oz,oz.current),i)break;return null;case 22:return t.lanes=0,ra(e,t,r,t.pendingProps);case 24:X(t,od,e.memoizedState.cache)}return rA(e,t,r)}(e,t,r);o8=(131072&e.flags)!=0}else o8=!1,ot&&(1048576&t.flags)!=0&&R(t,sZ,t.index);switch(t.lanes=0,t.tag){case 16:o:{var n=t.pendingProps;if(e=ex(t.elementType),t.type=e,"function"==typeof e)iY(e)?(n=t5(e,n),t.tag=1,t=rp(null,t,e,n,r)):(t.tag=0,t=rd(null,t,e,n,r));else{if(null!=e){var a=e.$$typeof;if(a===np){t.tag=11,t=rr(null,t,e,n,r);break o}if(a===ng){t.tag=14,t=ri(null,t,e,n,r);break o}}throw Error(i(306,t=l(e)||e,""))}}return t;case 0:return rd(e,t,t.type,t.pendingProps,r);case 1:return a=t5(n=t.type,t.pendingProps),rp(e,t,n,a,r);case 3:o:{if(F(t,t.stateNode.containerInfo),null===e)throw Error(i(387));var s=t.pendingProps;n=(a=t.memoizedState).element,eP(e,t),ek(t,s,null,r);var o=t.memoizedState;if(X(t,od,s=o.cache),s!==a.cache&&J(t,[od],r,!0),eG(),s=o.element,nH&&a.isDehydrated)if(a={element:s,isDehydrated:!1,cache:o.cache},t.updateQueue.baseState=a,t.memoizedState=a,256&t.flags){t=rf(e,t,s,r);break o}else if(s!==n){j(n=C(Error(i(424)),t)),t=rf(e,t,s,r);break o}else for(nH&&(oe=aO(t.stateNode.containerInfo),s7=t,ot=!0,or=null,oi=!0),r=oB(t,null,s,r),t.child=r;r;)r.flags=-3&r.flags|4096,r=r.sibling;else{if(H(),s===n){t=rA(e,t,r);break o}rt(e,t,s,r)}t=t.child}return t;case 26:if(si)return rh(e,t),null===e?(r=ss(t.type,null,t.pendingProps,null))?t.memoizedState=r:ot||(t.stateNode=sc(t.type,t.pendingProps,s6.current,t)):t.memoizedState=ss(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:if(sv)return U(t),null===e&&sv&&ot&&(n=t.stateNode=sy(t.type,t.pendingProps,s6.current,s5.current,!1),s7=t,oi=!0,oe=aV(t.type,n,oe)),rt(e,t,t.pendingProps.children,r),rh(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&ot&&(st(t.type,t.pendingProps,s5.current),(a=n=oe)&&(null!==(n=az(n,t.type,t.pendingProps,oi))?(t.stateNode=n,s7=t,oe=aU(n),oi=!1,a=!0):a=!1),a||G(t)),U(t),a=t.type,s=t.pendingProps,o=null!==e?e.memoizedProps:null,n=s.children,nF(a,s)?n=null:null!==o&&nF(a,o)&&(t.flags|=32),null!==t.memoizedState&&(a=e0(e,t,e3,null,null,r),nk?n5._currentValue=a:n5._currentValue2=a),rh(e,t),rt(e,t,n,r),t.child;case 6:return null===e&&ot&&(sr(t.pendingProps,s5.current),(e=r=oe)&&(null!==(r=aH(r,t.pendingProps,oi))?(t.stateNode=r,s7=t,oe=null,e=!0):e=!1),e||G(t)),null;case 13:return rv(e,t,r);case 4:return F(t,t.stateNode.containerInfo),n=t.pendingProps,null===e?t.child=oL(t,null,n,r):rt(e,t,n,r),t.child;case 11:return rr(e,t,t.type,t.pendingProps,r);case 7:return rt(e,t,t.pendingProps,r),t.child;case 8:case 12:return rt(e,t,t.pendingProps.children,r),t.child;case 10:return n=t.pendingProps,X(t,t.type,n.value),rt(e,t,n.children,r),t.child;case 9:return a=t.type._context,n=t.pendingProps.children,Q(t),n=n(a=Z(a)),t.flags|=1,rt(e,t,n,r),t.child;case 14:return ri(e,t,t.type,t.pendingProps,r);case 15:return rn(e,t,t.type,t.pendingProps,r);case 19:return rT(e,t,r);case 31:var u=e,h=t,c=r,p=h.pendingProps,f=(128&h.flags)!=0;if(h.flags&=-129,null===u){if(ot){if("hidden"===p.mode)return u=rl(h,p),h.lanes=0x20000000,rs(null,u);if(eq(h),(u=oe)?null!==(u=aW(u,oi))&&(h.memoizedState={dehydrated:u,treeContext:null!==s2?{id:s3,overflow:s4}:null,retryLane:0x20000000,hydrationErrors:null},(c=i3(u)).return=h,h.child=c,s7=h,oe=null):u=null,null===u)throw G(h);return h.lanes=0x20000000,null}return rl(h,p)}var m=u.memoizedState;if(null!==m){var g=m.dehydrated;
389if(eq(h),f)if(256&h.flags)h.flags&=-257,h=ru(u,h,c);else if(null!==h.memoizedState)h.child=u.child,h.flags|=128,h=null;else throw Error(i(558));else if(o8||K(u,h,c,!1),f=(c&u.childLanes)!=0,o8||f){if(null!==(p=lg)&&0!==(g=x(p,c))&&g!==m.retryLane)throw m.retryLane=g,eN(u,g),iy(p,u,g),o5;iR(),h=ru(u,h,c)}else u=m.treeContext,nH&&(oe=aG(g),s7=h,ot=!0,or=null,oi=!1,null!==u&&P(h,u)),h=rl(h,p),h.flags|=4096;return h}return(u=iQ(u.child,{mode:p.mode,children:p.children})).ref=h.ref,h.child=u,u.return=h,u;case 22:return ra(e,t,r,t.pendingProps);case 24:return Q(t),n=Z(od),null===e?(null===(a=ef())&&(a=lg,s=er(),a.pooledCache=s,s.refCount++,null!==s&&(a.pooledCacheLanes|=r),a=s),t.memoizedState={parent:n,cache:a},eI(t),X(t,od,a)):((e.lanes&r)!=0&&(eP(e,t),ek(t,null,null,r),eG()),a=e.memoizedState,s=t.memoizedState,a.parent!==n?(a={parent:n,cache:n},t.memoizedState=a,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=a),X(t,od,n)):(X(t,od,n=s.cache),n!==a.cache&&J(t,[od],r,!0))),rt(e,t,t.pendingProps.children,r),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function rC(e){e.flags|=4}function rw(e){nz&&(e.flags|=8)}function rR(e,t){if(null!==e&&e.child===t.child)return!1;if((16&t.flags)!=0)return!0;for(e=t.child;null!==e;){if((8218&e.flags)!=0||(8218&e.subtreeFlags)!=0)return!0;e=e.sibling}return!1}function rN(e,t,r,i){if(nV)for(r=t.child;null!==r;){if(5===r.tag||6===r.tag)nI(e,r.stateNode);else if(!(4===r.tag||sv&&27===r.tag)&&null!==r.child){r.child.return=r,r=r.child;continue}if(r===t)break;for(;null===r.sibling;){if(null===r.return||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}else if(nz)for(var n=t.child;null!==n;){if(5===n.tag){var a=n.stateNode;r&&i&&(a=aC(a,n.type,n.memoizedProps)),nI(e,a)}else if(6===n.tag)a=n.stateNode,r&&i&&(a=aw(a,n.memoizedProps)),nI(e,a);else if(4!==n.tag){if(22===n.tag&&null!==n.memoizedState)null!==(a=n.child)&&(a.return=n),rN(e,n,!0,!0);else if(null!==n.child){n.child.return=n,n=n.child;continue}}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}}function rL(e,t){if(nz&&rR(e,t)){var r=(e=t.stateNode).containerInfo,i=aT();(function e(t,r,i,n){var a=!1;if(nz)for(var s=r.child;null!==s;){if(5===s.tag){var o=s.stateNode;i&&n&&(o=aC(o,s.type,s.memoizedProps)),aA(t,o)}else if(6===s.tag)o=s.stateNode,i&&n&&(o=aw(o,s.memoizedProps)),aA(t,o);else if(4!==s.tag){if(22===s.tag&&null!==s.memoizedState)null!==(a=s.child)&&(a.return=s),e(t,s,!0,!0),a=!0;else if(null!==s.child){s.child.return=s,s=s.child;continue}}if(s===r)break;for(;null===s.sibling;){if(null===s.return||s.return===r)return a;s=s.return}s.sibling.return=s.return,s=s.sibling}return a})(i,t,!1,!1),e.pendingChildren=i,rC(t),aM(r,i)}}function rB(e,t,r,i){if(nV)e.memoizedProps!==i&&rC(t);else if(nz){var n=e.stateNode,a=e.memoizedProps;if((e=rR(e,t))||a!==i){var s=s5.current;
389(a=aS(n,r,a,i,!e,null))===n?t.stateNode=n:(rw(t),nP(a,r,i,s)&&rC(t),t.stateNode=a,e&&rN(a,t,!1,!1))}else t.stateNode=n}}function rI(e,t,r,i,n){if((32&e.mode)!=0&&(null===r?nY(t,i):nQ(t,r,i))){if(e.flags|=0x1000000,(0x13ffff40&n)===n||nZ(t,i))if(n0(e.stateNode,t,i))e.flags|=8192;else if(iE())e.flags|=8192;else throw ow=oC,oM}else e.flags&=-0x1000001}function rP(e,t){if(sf(t)){if(e.flags|=0x1000000,!sm(t))if(iE())e.flags|=8192;else throw ow=oC,oM}else e.flags&=-0x1000001}function rF(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?m():0x20000000,e.lanes|=t,lN|=t)}function rD(e,t){if(!ot)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;null!==t;)null!==t.alternate&&(r=t),t=t.sibling;null===r?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var i=null;null!==r;)null!==r.alternate&&(i=r),r=r.sibling;null===i?t||null===e.tail?e.tail=null:e.tail.sibling=null:i.sibling=null}}function rU(e){var t=null!==e.alternate&&e.alternate.child===e.child,r=0,i=0;if(t)for(var n=e.child;null!==n;)r|=n.lanes|n.childLanes,i|=0x3e00000&n.subtreeFlags,i|=0x3e00000&n.flags,n.return=e,n=n.sibling;else for(n=e.child;null!==n;)r|=n.lanes|n.childLanes,i|=n.subtreeFlags,i|=n.flags,n.return=e,n=n.sibling;return e.subtreeFlags|=i,e.childLanes=r,t}function rO(e,t){switch(L(t),t.tag){case 3:q(od),D();break;case 26:case 27:case 5:O(t);break;case 4:D();break;case 31:null!==t.memoizedState&&eK(t);break;case 13:eK(t);break;case 19:h(oz);break;case 10:q(t.type);break;case 22:case 23:eK(t),ej(),null!==e&&h(oT);break;case 24:q(od)}}function rG(e,t){try{var r=t.updateQueue,i=null!==r?r.lastEffect:null;if(null!==i){var n=i.next;r=n;do{if((r.tag&e)===e){i=void 0;var a=r.create;r.inst.destroy=i=a()}r=r.next}while(r!==n)}}catch(e){iW(t,t.return,e)}}function rk(e,t,r){try{var i=t.updateQueue,n=null!==i?i.lastEffect:null;if(null!==n){var a=n.next;i=a;do{if((i.tag&e)===e){var s=i.inst,o=s.destroy;if(void 0!==o){s.destroy=void 0,n=t;try{o()}catch(e){iW(n,r,e)}}}i=i.next}while(i!==a)}}catch(e){iW(t,t.return,e)}}function rV(e){var t=e.updateQueue;if(null!==t){var r=e.stateNode;try{ez(t,r)}catch(t){iW(e,e.return,t)}}}function rz(e,t,r){r.props=t5(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(r){iW(e,t,r)}}function rH(e,t){try{var r=e.ref;if(null!==r){switch(e.tag){case 26:case 27:case 5:var i=nC(e.stateNode);break;default:i=e.stateNode}"function"==typeof r?e.refCleanup=r(i):r.current=i}}catch(r){iW(e,t,r)}}function rW(e,t){var r=e.ref,i=e.refCleanup;if(null!==r)if("function"==typeof i)try{i()}catch(r){iW(e,t,r)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof r)try{r(null)}catch(r){iW(e,t,r)}else r.current=null}function rj(e){var t=e.type,r=e.memoizedProps,i=e.stateNode;try{ah(i,t,r,e)}catch(t){iW(e,e.return,t)}}function rX(e,t,r){try{ad(e.stateNode,e.type,r,t,e)}catch(t){iW(e,e.return,t)}}function rq(e){return 5===e.tag||3===e.tag||!!si&&26===e.tag||!!sv&&27===e.tag&&sS(e.type)||4===e.tag}function r$(e){o:for(;;){for(;null===e.sibling;){if(null===e.return||rq(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(sv&&27===e.tag&&sS(e.type)||2&e.flags||null===e.child||4===e.tag)continue o;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function rJ(e,t,r){var i=e.tag;if(5===i||6===i)e=e.stateNode,t?ac(r,e,t):ao(r,e);else if(4!==i&&(sv&&27===i&&sS(e.type)&&(r=e.stateNode),null!==(e=e.child)))for(rJ(e,t,r),e=e.sibling;null!==e;)rJ(e,t,r),e=e.sibling}function rK(e,t,r){e=e.containerInfo;try{aE(e,r)}catch(e){iW(t,t.return,e)}}function rY(e){var t=e.stateNode,r=e.memoizedProps;try{s_(e.type,r,t,e)}catch(t){iW(e,e.return,t)}}function rQ(e,t,r){var i=r.flags;switch(r.tag){case 0:case 11:case 15:r6(e,r),4&i&&rG(5,r);break;case 1:if(r6(e,r),4&i)if(e=r.stateNode,null===t)try{e.componentDidMount()}catch(e){iW(r,r.return,e)}else{var n=t5(r.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(n,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){iW(r,r.return,e)}}64&i&&rV(r),512&i&&rH(r,r.return);break;case 3:if(r6(e,r),64&i&&null!==(i=r.updateQueue)){if(e=null,null!==r.child)switch(r.child.tag){case 27:case 5:e=nC(r.child.stateNode);break;case 1:e=r.child.stateNode}try{ez(i,e)}catch(e){iW(r,r.return,e)}}break;case 27:sv&&null===t&&4&i&&rY(r);case 26:case 5:if(r6(e,r),null===t){if(4&i)rj(r);else if(64&i){e=r.type,t=r.memoizedProps,n=r.stateNode;try{aQ(n,e,t,r)}catch(e){iW(r,r.return,e)}}}512&i&&rH(r,r.return);break;case 12:default:r6(e,r);break;case 31:r6(e,r),4&i&&r1(e,r);break;case 13:r6(e,r),4&i&&r2(e,r),64&i&&null!==(i=r.memoizedState)&&null!==(i=i.dehydrated)&&aB(i,r=i$.bind(null,r));break;case 22:if(!(i=null!==r.memoizedState||o9)){t=null!==t&&null!==t.memoizedState||o7,n=o9;var a=o7;o9=i,(o7=t)&&!a?function e(t,r,i){for(i=i&&(8772&r.subtreeFlags)!=0,r=r.child;null!==r;){var n=r.alternate,a=t,s=r,o=s.flags;switch(s.tag){case 0:case 11:case 15:e(a,s,i),rG(4,s);break;case 1:if(e(a,s,i),"function"==typeof(a=(n=s).stateNode).componentDidMount)try{a.componentDidMount()}catch(e){iW(n,n.return,e)}if(null!==(a=(n=s).updateQueue)){var l=n.stateNode;try{var u=a.shared.hiddenCallbacks;
389if(null!==u)for(a.shared.hiddenCallbacks=null,a=0;a<u.length;a++)eV(u[a],l)}catch(e){iW(n,n.return,e)}}i&&64&o&&rV(s),rH(s,s.return);break;case 27:sv&&rY(s);case 26:case 5:e(a,s,i),i&&null===n&&4&o&&rj(s),rH(s,s.return);break;case 12:default:e(a,s,i);break;case 31:e(a,s,i),i&&4&o&&r1(a,s);break;case 13:e(a,s,i),i&&4&o&&r2(a,s);break;case 22:null===s.memoizedState&&e(a,s,i),rH(s,s.return);case 30:}r=r.sibling}}(e,r,(8772&r.subtreeFlags)!=0):r6(e,r),o9=n,o7=a}case 30:}}function rZ(e,t,r){for(r=r.child;null!==r;)r0(e,t,r),r=r.sibling}function r0(e,t,r){if(sW&&"function"==typeof sW.onCommitFiberUnmount)try{sW.onCommitFiberUnmount(sH,r)}catch{}switch(r.tag){case 26:if(si){o7||rW(r,t),rZ(e,t,r),r.memoizedState?sl(r.memoizedState):r.stateNode&&sd(r.stateNode);break}case 27:if(sv){o7||rW(r,t);var i=li,n=ln;sS(r.type)&&(li=r.stateNode,ln=!1),rZ(e,t,r),sx(r.stateNode),li=i,ln=n;break}case 5:o7||rW(r,t);case 6:if(nV){if(i=li,n=ln,li=null,rZ(e,t,r),li=i,ln=n,null!==li)if(ln)try{am(li,r.stateNode)}catch(e){iW(r,t,e)}else try{af(li,r.stateNode)}catch(e){iW(r,t,e)}}else rZ(e,t,r);break;case 18:nV&&null!==li&&(ln?a5(li,r.stateNode):a4(li,r.stateNode));break;case 4:nV?(i=li,n=ln,li=r.stateNode.containerInfo,ln=!0,rZ(e,t,r),li=i,ln=n):(nz&&rK(r.stateNode,r,aT()),rZ(e,t,r));break;case 0:case 11:case 14:case 15:rk(2,r,t),o7||rk(4,r,t),rZ(e,t,r);break;case 1:o7||(rW(r,t),"function"==typeof(i=r.stateNode).componentWillUnmount&&rz(r,t,i)),rZ(e,t,r);break;case 21:default:rZ(e,t,r);break;case 22:o7=(i=o7)||null!==r.memoizedState,rZ(e,t,r),o7=i}}function r1(e,t){if(nH&&null===t.memoizedState&&null!==(e=t.alternate)&&null!==(e=e.memoizedState)){e=e.dehydrated;try{a0(e)}catch(e){iW(t,t.return,e)}}}function r2(e,t){if(nH&&null===t.memoizedState&&null!==(e=t.alternate)&&null!==(e=e.memoizedState)&&null!==(e=e.dehydrated))try{a1(e)}catch(e){iW(t,t.return,e)}}function r3(e,t){var r=function(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return null===t&&(t=e.stateNode=new lt),t;case 22:return null===(t=(e=e.stateNode)._retryCache)&&(t=e._retryCache=new lt),t;default:throw Error(i(435,e.tag))}}(e);t.forEach(function(t){if(!r.has(t)){r.add(t);var i=iJ.bind(null,e,t);t.then(i,i)}})}function r4(e,t){var r=t.deletions;if(null!==r)for(var n=0;n<r.length;n++){var a=r[n],s=e,o=t;if(nV){var l=o;o:for(;null!==l;){switch(l.tag){case 27:if(sv){if(sS(l.type)){li=l.stateNode,ln=!1;break o}break}case 5:li=l.stateNode,ln=!1;break o;case 3:case 4:li=l.stateNode.containerInfo,ln=!0;break o}l=l.return}if(null===li)throw Error(i(160));r0(s,o,a),li=null,ln=!1}else r0(s,o,a);null!==(s=a.alternate)&&(s.return=null),a.return=null}if(13886&t.subtreeFlags)for(t=t.child;null!==t;)r5(t,e),t=t.sibling}function r5(e,t){var r=e.alternate,n=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:r4(t,e),r8(e),4&n&&(rk(3,e,e.return),rG(3,e),rk(5,e,e.return));break;case 1:r4(t,e),r8(e),512&n&&(o7||null===r||rW(r,r.return)),64&n&&o9&&null!==(e=e.updateQueue)&&null!==(n=e.callbacks)&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=null===r?n:r.concat(n));break;case 26:if(si){var a=la;if(r4(t,e),r8(e),512&n&&(o7||null===r||rW(r,r.return)),4&n){n=null!==r?r.memoizedState:null;var s=e.memoizedState;null===r?null===s?null===e.stateNode?e.stateNode=su(a,e.type,e.memoizedProps,e):sh(a,e.type,e.stateNode):e.stateNode=so(a,s,e.memoizedProps):n!==s?(null===n?null!==r.stateNode&&sd(r.stateNode):sl(n),null===s?sh(a,e.type,e.stateNode):so(a,s,e.memoizedProps)):null===s&&null!==e.stateNode&&rX(e,e.memoizedProps,r.memoizedProps)}break}case 27:if(sv){r4(t,e),r8(e),512&n&&(o7||null===r||rW(r,r.return)),null!==r&&4&n&&rX(e,e.memoizedProps,r.memoizedProps);break}case 5:if(r4(t,e),r8(e),512&n&&(o7||null===r||rW(r,r.return)),nV){if(32&e.flags){a=e.stateNode;try{ag(a)}catch(t){iW(e,e.return,t)}}4&n&&null!=e.stateNode&&(a=e.memoizedProps,rX(e,a,null!==r?r.memoizedProps:a)),1024&n&&(le=!0)}else nz&&null!==e.alternate&&(e.alternate.stateNode=e.stateNode);break;case 6:if(r4(t,e),r8(e),4&n&&nV){if(null===e.stateNode)throw Error(i(162));n=e.memoizedProps,r=null!==r?r.memoizedProps:n,a=e.stateNode;try{au(a,r,n)}catch(t){iW(e,e.return,t)}}break;case 3:if(si?(sp(),a=la,la=sa(t.containerInfo),r4(t,e),la=a):r4(t,e),r8(e),4&n){if
389(nV&&nH&&null!==r&&r.memoizedState.isDehydrated)try{aZ(t.containerInfo)}catch(t){iW(e,e.return,t)}if(nz){n=t.containerInfo,r=t.pendingChildren;try{aE(n,r)}catch(t){iW(e,e.return,t)}}}le&&(le=!1,function e(t){if(1024&t.subtreeFlags)for(t=t.child;null!==t;){var r=t;e(r),5===r.tag&&1024&r.flags&&n8(r.stateNode),t=t.sibling}}(e));break;case 4:si?(r=la,la=sa(e.stateNode.containerInfo),r4(t,e),r8(e),la=r):(r4(t,e),r8(e)),4&n&&nz&&rK(e.stateNode,e,e.stateNode.pendingChildren);break;case 12:default:r4(t,e),r8(e);break;case 31:case 19:r4(t,e),r8(e),4&n&&null!==(n=e.updateQueue)&&(e.updateQueue=null,r3(e,n));break;case 13:r4(t,e),r8(e),8192&e.child.flags&&null!==e.memoizedState!=(null!==r&&null!==r.memoizedState)&&(lP=sD()),4&n&&null!==(n=e.updateQueue)&&(e.updateQueue=null,r3(e,n));break;case 22:a=null!==e.memoizedState;var o=null!==r&&null!==r.memoizedState,l=o9,u=o7;if(o9=l||a,o7=u||o,r4(t,e),o7=u,o9=l,r8(e),8192&n&&((t=e.stateNode)._visibility=a?-2&t._visibility:1|t._visibility,a&&(null===r||o||o9||o7||function e(t){for(t=t.child;null!==t;){var r=t;switch(r.tag){case 0:case 11:case 14:case 15:rk(4,r,r.return),e(r);break;case 1:rW(r,r.return);var i=r.stateNode;"function"==typeof i.componentWillUnmount&&rz(r,r.return,i),e(r);break;case 27:sv&&sx(r.stateNode);case 26:case 5:rW(r,r.return),e(r);break;case 22:null===r.memoizedState&&e(r);break;default:e(r)}t=t.sibling}}(e)),nV)){o:if(r=null,nV)for(t=e;;){if(5===t.tag||si&&26===t.tag){if(null===r){o=r=t;try{s=o.stateNode,a?av(s):a_(o.stateNode,o.memoizedProps)}catch(e){iW(o,o.return,e)}}}else if(6===t.tag){if(null===r){o=t;try{var h=o.stateNode;a?ay(h):ax(h,o.memoizedProps)}catch(e){iW(o,o.return,e)}}}else if(18===t.tag){if(null===r){o=t;try{var d=o.stateNode;a?a8(d):a6(o.stateNode)}catch(e){iW(o,o.return,e)}}}else if((22!==t.tag&&23!==t.tag||null===t.memoizedState||t===e)&&null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break o;for(;null===t.sibling;){if(null===t.return||t.return===e)break o;r===t&&(r=null),t=t.return}r===t&&(r=null),t.sibling.return=t.return,t=t.sibling}}4&n&&null!==(n=e.updateQueue)&&null!==(r=n.retryQueue)&&(n.retryQueue=null,r3(e,r));case 30:case 21:}}function r8(e){var t=e.flags;if(2&t){try{for(var r,n=e.return;null!==n;){if(rq(n)){r=n;break}n=n.return}if(nV){if(null==r)throw Error(i(160));switch(r.tag){case 27:if(sv){var a=r.stateNode,s=r$(e);rJ(e,s,a);break}case 5:var o=r.stateNode;32&r.flags&&(ag(o),r.flags&=-33);var l=r$(e);rJ(e,l,o);break;case 3:case 4:var u=r.stateNode.containerInfo,h=r$(e);!function e(t,r,i){var n=t.tag;if(5===n||6===n)t=t.stateNode,r?ap(i,t,r):al(i,t);else if(4!==n&&(sv&&27===n&&sS(t.type)&&(i=t.stateNode,r=null),null!==(t=t.child)))for(e(t,r,i),t=t.sibling;null!==t;)e(t,r,i),t=t.sibling}(e,h,u);break;default:throw Error(i(161))}}}catch(t){iW(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function r6(e,t){if(8772&t.subtreeFlags)for(t=t.child;null!==t;)rQ(e,t.alternate,t),t=t.sibling}function r9(e,t){var r=null;null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(r=e.memoizedState.cachePool.pool),e=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(e=t.memoizedState.cachePool.pool),e!==r&&(null!=e&&e.refCount++,null!=r&&ei(r))}function r7(e,t){e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&ei(e))}function ie(e,t,r,i){if(10256&t.subtreeFlags)for(t=t.child;null!==t;)it(e,t,r,i),t=t.sibling}function it(e,t,r,i){var n=t.flags;switch(t.tag){case 0:case 11:case 15:ie(e,t,r,i),2048&n&&rG(9,t);break;case 1:case 31:case 13:default:ie(e,t,r,i);break;case 3:ie(e,t,r,i),2048&n&&(e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&ei(e)));break;case 12:if(2048&n){ie(e,t,r,i),e=t.stateNode;try{var a=t.memoizedProps,s=a.id,o=a.onPostCommit;"function"==typeof o&&o(s,null===t.alternate?"mount":"update",e.passiveEffectDuration,-0)}catch(e){iW(t,t.return,e)}}else ie(e,t,r,i);break;case 23:break;case 22:a=t.stateNode,s=t.alternate,null!==t.memoizedState?2&a._visibility?ie(e,t,r,i
389):ir(e,t):2&a._visibility?ie(e,t,r,i):(a._visibility|=2,function e(t,r,i,n,a){for(a=a&&(10256&r.subtreeFlags)!=0,r=r.child;null!==r;){var s=r,o=s.flags;switch(s.tag){case 0:case 11:case 15:e(t,s,i,n,a),rG(8,s);break;case 23:break;case 22:var l=s.stateNode;null!==s.memoizedState?2&l._visibility?e(t,s,i,n,a):ir(t,s):(l._visibility|=2,e(t,s,i,n,a)),a&&2048&o&&r9(s.alternate,s);break;case 24:e(t,s,i,n,a),a&&2048&o&&r7(s.alternate,s);break;default:e(t,s,i,n,a)}r=r.sibling}}(e,t,r,i,(10256&t.subtreeFlags)!=0)),2048&n&&r9(s,t);break;case 24:ie(e,t,r,i),2048&n&&r7(t.alternate,t)}}function ir(e,t){if(10256&t.subtreeFlags)for(t=t.child;null!==t;){var r=t,i=r.flags;switch(r.tag){case 22:ir(e,r),2048&i&&r9(r.alternate,r);break;case 24:ir(e,r),2048&i&&r7(r.alternate,r);break;default:ir(e,r)}t=t.sibling}}function ii(e,t,r){if(e.subtreeFlags&ls)for(e=e.child;null!==e;)ia(e,t,r),e=e.sibling}function ia(e,t,r){switch(e.tag){case 26:if(ii(e,t,r),e.flags&ls)if(null!==e.memoizedState)sg(r,la,e.memoizedState,e.memoizedProps);else{var i=e.stateNode,n=e.type;e=e.memoizedProps,((0x13ffff40&t)===t||nZ(n,e))&&n2(r,i,n,e)}break;case 5:ii(e,t,r),e.flags&ls&&(i=e.stateNode,n=e.type,e=e.memoizedProps,((0x13ffff40&t)===t||nZ(n,e))&&n2(r,i,n,e));break;case 3:case 4:si?(i=la,la=sa(e.stateNode.containerInfo),ii(e,t,r),la=i):ii(e,t,r);break;case 22:null===e.memoizedState&&(null!==(i=e.alternate)&&null!==i.memoizedState?(i=ls,ls=0x1000000,ii(e,t,r),ls=i):ii(e,t,r));break;default:ii(e,t,r)}}function is(e){var t=e.alternate;if(null!==t&&null!==(e=t.child)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(null!==e)}}function io(e){var t=e.deletions;if((16&e.flags)!=0){if(null!==t)for(var r=0;r<t.length;r++){var i=t[r];lr=i,iu(i,e)}is(e)}if(10256&e.subtreeFlags)for(e=e.child;null!==e;)il(e),e=e.sibling}function il(e){switch(e.tag){case 0:case 11:case 15:io(e),2048&e.flags&&rk(9,e,e.return);break;case 3:case 12:default:io(e);break;case 22:var t=e.stateNode;null!==e.memoizedState&&2&t._visibility&&(null===e.return||13!==e.return.tag)?(t._visibility&=-3,function e(t){var r=t.deletions;if((16&t.flags)!=0){if(null!==r)for(var i=0;i<r.length;i++){var n=r[i];lr=n,iu(n,t)}is(t)}for(t=t.child;null!==t;){switch((r=t).tag){case 0:case 11:case 15:rk(8,r,r.return),e(r);break;case 22:2&(i=r.stateNode)._visibility&&(i._visibility&=-3,e(r));break;default:e(r)}t=t.sibling}}(e)):io(e)}}function iu(e,t){for(;null!==lr;){var r=lr;switch(r.tag){case 0:case 11:case 15:rk(8,r,t);break;case 23:case 22:if(null!==r.memoizedState&&null!==r.memoizedState.cachePool){var i=r.memoizedState.cachePool.pool;null!=i&&i.refCount++}break;case 24:ei(r.memoizedState.cache)}if(null!==(i=r.child))i.return=r,lr=i;else for(r=e;null!==lr;){var n=(i=lr).sibling,a=i.return;if(function e(t){var r=t.alternate;null!==r&&(t.alternate=null,e(r)),t.child=null,t.deletions=null,t.sibling=null,5===t.tag&&null!==(r=t.stateNode)&&nK(r),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}(i),i===r){lr=null;break}if(null!==n){n.return=a,lr=n;break}lr=a}}}function ih(e){var t=nW(e);if(null!=t){if("string"!=typeof t.memoizedProps["data-testname"])throw Error(i(364));return t}if(null===(e=ae(e)))throw Error(i(362));return e.stateNode.current}function id(e,t){var r=e.tag;switch(t.$$typeof){case ll:if(e.type===t.value)return!0;break;case lu:o:{for(t=t.value,e=[e,0],r=0;r<e.length;){var n=e[r++],a=n.tag,s=e[r++],o=t[s];if(5!==a&&26!==a&&27!==a||!ai(n)){for(;null!=o&&id(n,o);)o=t[++s];if(s===t.length){t=!0;break o}for(n=n.child;null!==n;)e.push(n,s),n=n.sibling}}t=!1}return t;case lh:if((5===r||26===r||27===r)&&an(e.stateNode,t.value))return!0;break;case lc:if((5===r||6===r||26===r||27===r)&&null!==(e=ar(e))&&0<=e.indexOf(t.value))return!0;break;case ld:if((5===r||26===r||27===r)&&"string"==typeof(e=e.memoizedProps["data-testname"])&&e.toLowerCase()===t.value.toLowerCase())return!0;break;default:throw Error(i(365))}return!1}function ic(e){switch(e.$$typeof){case ll:return"<"+(l(e.value)||"Unknown")+">";case lu:return":has("+(ic(e)||"")+")";case lh:return'[role="'+e.value+'"]';
389case lc:return'"'+e.value+'"';case ld:return'[data-testname="'+e.value+'"]';default:throw Error(i(365))}}function ip(e,t){var r=[];e=[e,0];for(var i=0;i<e.length;){var n=e[i++],a=n.tag,s=e[i++],o=t[s];if(5!==a&&26!==a&&27!==a||!ai(n)){for(;null!=o&&id(n,o);)o=t[++s];if(s===t.length)r.push(n);else for(n=n.child;null!==n;)e.push(n,s),n=n.sibling}}return r}function im(e,t){if(!n7)throw Error(i(363));e=ip(e=ih(e),t),t=[],e=Array.from(e);for(var r=0;r<e.length;){var n=e[r++],a=n.tag;if(5===a||26===a||27===a)ai(n)||t.push(n.stateNode);else for(n=n.child;null!==n;)e.push(n),n=n.sibling}return t}function ig(){return(2&lm)!=0&&0!==ly?ly&-ly:null!==nT.T?ec():n$()}function iv(){if(0===lR)if((0x20000000&ly)==0||ot){var e=sN;(3932160&(sN<<=1))==0&&(sN=262144),lR=e}else lR=0x20000000;return null!==(e=ok.current)&&(e.flags|=32),lR}function iy(e,t,r){(e===lg&&(2===l_||9===l_)||null!==e.cancelPendingCommit)&&(iA(e,0),ib(e,ly,lR,!1)),v(e,r),((2&lm)==0||e!==lg)&&(e===lg&&((2&lm)==0&&(lC|=r),4===lM&&ib(e,ly,lR,!1)),ea(e))}function i_(e,t,r){if((6&lm)!=0)throw Error(i(327));for(var n=!r&&(127&t)==0&&(t&e.expiredLanes)==0||f(e,t),a=n?function(e,t){var r=lm;lm|=2;var n=iC(),a=iw();lg!==e||ly!==t?(lU=null,lD=sD()+500,iA(e,t)):lS=f(e,t);o:for(;;)try{if(0!==l_&&null!==lv){t=lv;var s=lx;l:switch(l_){case 1:l_=0,lx=null,iI(e,t,s,1);break;case 2:case 9:if(ey(s)){l_=0,lx=null,iB(t);break}t=function(){2!==l_&&9!==l_||lg!==e||(l_=7),ea(e)},s.then(t,t);break o;case 3:l_=7;break o;case 4:l_=5;break o;case 7:ey(s)?(l_=0,lx=null,iB(t)):(l_=0,lx=null,iI(e,t,s,7));break;case 5:var o=null;switch(lv.tag){case 26:o=lv.memoizedState;case 5:case 27:var l=lv,u=l.type,h=l.pendingProps;if(o?sm(o):n0(l.stateNode,u,h)){l_=0,lx=null;var d=l.sibling;if(null!==d)lv=d;else{var c=l.return;null!==c?(lv=c,iP(c)):lv=null}break l}}l_=0,lx=null,iI(e,t,s,5);break;case 6:l_=0,lx=null,iI(e,t,s,6);break;case 8:iT(),lM=6;break o;default:throw Error(i(462))}}for(;null!==lv&&!sP();)iL(lv);break}catch(t){iM(e,t)}return oo=os=null,nT.H=n,nT.A=a,lm=r,null!==lv?0:(lg=null,ly=0,eC(),lM)}(e,t):iN(e,t,!0),s=n;;){if(0===a)lS&&!n&&ib(e,t,0,!1);else{if(r=e.current.alternate,s&&!function(e){for(var t=e;;){var r=t.tag;if((0===r||11===r||15===r)&&16384&t.flags&&null!==(r=t.updateQueue)&&null!==(r=r.stores))for(var i=0;i<r.length;i++){var n=r[i],a=n.getSnapshot;n=n.value;try{if(!sj(a(),n))return!1}catch{return!1}}if(r=t.child,16384&t.subtreeFlags&&null!==r)r.return=t,t=r;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(r)){a=iN(e,t,!1),s=!1;continue}if(2===a){if(s=t,e.errorRecoveryDisabledLanes&s)var o=0;else o=0!=(o=-0x20000001&e.pendingLanes)?o:0x20000000&o?0x20000000:0;if(0!==o){t=o;o:{a=lL;var l=nH&&e.current.memoizedState.isDehydrated;if(l&&(iA(e,o).flags|=256),2!==(o=iN(e,o,!1))){if(lT&&!l){e.errorRecoveryDisabledLanes|=s,lC|=s,a=4;break o}s=lB,lB=a,null!==s&&(null===lB?lB=s:lB.push.apply(lB,s))}a=o}if(s=!1,2!==a)continue}}if(1===a){iA(e,0),ib(e,t,0,!0);break}o:{switch(n=e,s=a){case 0:case 1:throw Error(i(345));case 4:if((4194048&t)!==t)break;case 6:ib(n,t,lR,!lb);break o;case 2:lB=null;break;case 3:case 5:break;default:throw Error(i(329))}if((0x3c00000&t)===t&&10<(a=lP+300-sD())){if(ib(n,t,lR,!lb),0!==p(n,0,!0))break o;lz=t,n.timeoutHandle=nU(ix.bind(null,n,r,lB,lU,lI,t,lR,lC,lN,lb,s,"Throttled",-0,0),a);break o}ix(n,r,lB,lU,lI,t,lR,lC,lN,lb,s,null,-0,0)}}break}ea(e)}function ix(e,t,r,i,n,a,s,o,l,u,h,d,c,p){if(e.timeoutHandle=nG,8192&(d=t.subtreeFlags)||(0x1002000&d)==0x1002000){ia(t,a,d=n1());var f=(0x3c00000&a)===a?lP-sD():(4194048&a)===a?lF-sD():0;if(null!==(f=n3(d,f))){lz=a,e.cancelPendingCommit=f(iD.bind(null,e,t,a,r,i,n,s,o,l,h,d,null,c,p)),ib(e,a,s,!u);return}}iD(e,t,a,r,i,n,s,o,l)}function ib(e,t,r,i){t&=~lw,t&=~lC,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var n=t;0<n;){var a=31-sE(n),s=1<<a;i[a]=-1,n&=~s}0!==r&&y(e,r,t)}function iS(){return(6&lm)!=0||(es(0,!1),!1)}function iT(){if(null!==lv){if(0===l_)var e=lv.return;else e=lv,oo=os=null,e8(e),oR=null,oN=0,e=lv;for(;null!==e;)rO(e.alternate,e),e=e.return;lv=null}}function iA(e,t){var r=e.timeoutHandle;r!==nG&&(e.timeoutHandle=nG,nO(r)),null!==(r=e.cancelPendingCommit)&&(e.cancelPendingCommit=null,r()),lz=0,iT(),lg=e,lv=r=iQ(e.current,null),ly=t,l_=0,lx=null,lb=!1,lS=f(e,t),lT=!1,lN=lR=lw=lC=lE=lM=0,lB=lL=null,lI=!1,(8&t)!=0&&(t|=32&t);var i=e.entangledLanes;if(0!==i)for(e=e.entanglements,i&=t;0<i;){var n=31-sE(i),a=1<<n;t|=e[n],i&=~a}return lA=t,eC(),r}function iM(e,t){oW=null,nT.H=o0,t===oA||t===oE?(t=eb(),l_=3):t===oM?(t=eb(),l_=4):l_=t===o5?8:null!==t&&"object"==typeof t&&"function"==typeof t.then?6:1,lx=t,null===lv&&(lM=1,t8(e,C(t,e.current)))}function iE(){var e=ok.current;return null===e||((4194048&ly)===ly?null===oV:((0x3c00000&ly)===ly||(0x20000000&ly)!=0)&&e===oV)}function iC(){var e=nT.H;return nT.H=o0,null===e?o0:e}function iw(){var e=nT.A;return nT.A=lo,e}function iR(){lM=4,lb||(4194048&ly)!==ly&&null!==ok.current||(lS=!0),(0x7ffffff&lE)==0&&(0x7ffffff&lC)==0||null===lg||ib(lg,ly,lR,!1)}function iN(e,t,r){var i=lm;lm|=2;var n=iC(),a=iw();(lg!==e||ly!==t)&&(lU=null,iA(e,t)),t=!1;var s=lM;o:for(;;)try{if(0!==l_&&null!==lv){var o=lv,l=lx;switch(l_){case 8:iT(),s=6;break o;case 3:case 2:case 9:case 6:null===ok.current&&(t=!0);var u=l_;if(l_=0,lx=null,iI(e,o,l,u),r&&lS){s=0;break o}break;default:u=l_,l_=0,lx=null,iI(e,o,l,u)}}(function(){for(;null!==lv;)iL(lv)})(),s=lM;break}catch(t){iM(e,t)}return t&&e.shellSuspendCounter++,oo=os=null,lm=i,nT.H=n,nT.A=a,null===lv&&(lg=null,ly=0,eC()),s}function iL(e){var t=rE(e.alternate,e,lA);e.memoizedProps=e.pendingProps,null===t?iP(e):lv=t}function iB(e){var t=e,r=t.alternate;switch(t.tag){case 15:case 0:t=rc(r,t,t.pendingProps,t.type,void 0,ly);break;case 11:t=rc(r,t,t.pendingProps,t.type.render,t.ref,ly);break;case 5:e8(t);default:rO(r,t),t=rE(r,t=lv=iZ(t,lA),lA)}e.memoizedProps=e.pendingProps,null===t?iP(e):lv=t}function iI(e,t,r,n){oo=os=null,e8(t),oR=null,oN=0;var a=t.return;try{if(function(e,t,r,n,a){if(r.flags|=32768,null!==n&&"object"==typeof n&&"function"==typeof n.then){if(null!==(t=r.alternate)&&K(t,r,a,!0),null!==(r=ok.current)){switch(r.tag){case 31:case 13:return null===oV?iR():null===r.alternate&&0===lM&&(lM=3),r.flags&=-257,r.flags|=65536,r.lanes=a,n===oC?r.flags|=16384:(null===(t=r.updateQueue)?r.updateQueue=new Set([n]):t.add(n),ij(e,n,a)),!1;case 22:return r.flags|=65536,n===oC?r.flags|=16384:(null===(t=r.updateQueue)?(t={transitions:null,markerInstances:null,retryQueue:new Set([n])},r.updateQueue=t):null===(r=t.retryQueue)?t.retryQueue=new Set([n]):r.add(n),ij(e,n,a)),!1}throw Error(i(435,r.tag))}return ij(e,n,a),iR(),!1}if(ot)return null!==(t=ok.current)?((65536&t.flags)==0&&(t.flags|=256),t.flags|=65536,t.lanes=a,n!==on&&j(C(e=Error(i(422),{cause:n}),r))):(n!==on&&j(C(t=Error(i(423),{cause:n}),r)),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,n=C(n,r),a=t9(e.stateNode,n,a),eO(e,a),4!==lM&&(lM=2)),!1;var s=Error(i(520),{cause:n});if(s=C(s,r),null===lL?lL=[s]:lL.push(s),4!==lM&&(lM=2),null===t)return!0;n=C(n,r),r=t;do{switch(r.tag){case 3:return r.flags|=65536,e=a&-a,r.lanes|=e,e=t9(r.stateNode,n,e),eO(r,e),!1;case 1:if(t=r.type,s=r.stateNode,(128&r.flags)==0&&("function"==typeof t.getDerivedStateFromError||null!==s&&"function"==typeof s.componentDidCatch&&(null===lO||!lO.has(s))))return r.flags|=65536,a&=-a,r.lanes|=a,re(a=t7(a),e,r,n),eO(r,a),!1}r=r.return}while(null!==r)return!1}(e,a,t,r,ly)){lM=1,t8(e,C(r,e.current)),lv=null;return}}catch(t){if(null!==a)throw lv=a,t;lM=1,t8(e,C(r,e.current)),lv=null;return}32768&t.flags?(ot||1===n?e=!0:lS||(0x20000000&ly)!=0?e=!1:(lb=e=!0,(2===n||9===n||3===n||6===n)&&null!==(n=ok.current)&&13===n.tag&&(n.flags|=16384)),iF(t,e)):iP(t)}function iP(e){var t=e;do{if((32768&t.flags)!=0)return void iF(t,lb);e=t.return;var r=function(e,t,r){var n=t.pendingProps;switch(L(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return rU(t),null;case 3:return r=t.stateNode,n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),q(od),D(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(null===e||null===e.child)&&(z(t)?rC(t):null===e||e.memoizedState.isDehydrated&&(256&t.flags)==0||(t.flags|=1024,W())),rL(e,t),rU(t),null;case 26:if(si){var a=t.type,s=t.memoizedState;return null===e?(rC(t),null!==s?(rU(t),rP(t,s)):(rU(t),rI(t,a,null,n,r))):s?s!==e.memoizedState?(rC(t),rU(t),rP(t,s)):(rU(t),t.flags&=-0x1000001):(s=e.memoizedProps,nV?s!==n&&rC(t):rB(e,t,a,n),rU(t),rI(t,a,s,n,r)),null}case 27:if(sv){if(O(t),r=s6.current,a=t.type,null!==e&&null!=t.stateNode)nV?e.memoizedProps!==n&&rC(t):rB(e,t,a,n);else{if(!n){if(null===t.stateNode)throw Error(i(166));return rU(t),null}e=s5.current,z(t)?k(t,e):(t.stateNode=e=sy(a,n,r,e,!0),rC(t))}return rU(t),null}case 5:if(O(t),a=t.type,null!==e&&null!=t.stateNode)rB(e,t,a,n);else{if(!n){if(null===t.stateNode)throw Error(i(166));return rU(t),null}if(s=s5.current,z(t))k(t,s),a2(t.stateNode,a,n,s)&&(t.flags|=64);else{var o=nB(a,n,s6.current,s,t);rw(t),rN(o,t,!1,!1),t.stateNode=o,nP(o,a,n,s)&&rC(t)}}return rU(t),rI(t,t.type,null===e?null:e.memoizedProps,t.pendingProps,r),null;case 6:if(e&&null!=t.stateNode)r=e.memoizedProps,nV?r!==n&&rC(t):nz&&(r!==n?(e=s6.current,r=s5.current,rw(t),t.stateNode=nD(n,e,r,t)):t.stateNode=e.stateNode);else{if("string"!=typeof n&&null===t.stateNode)throw Error(i(166));if(e=s6.current,r=s5.current,z(t)){if(!nH)throw Error(i(176));if(e=t.stateNode,r=t.memoizedProps,n=null,null!==(a=s7))switch(a.tag){case 27:case 5:n=a.memoizedProps}aq(e,r,t,n)||G(t,!0)}else rw(t),t.stateNode=nD(n,e,r,t)}return rU(t),null;case 31:if(r=t.memoizedState,null===e||null!==e.memoizedState){if(n=z(t),null!==r){if(null===e){if(!n)throw Error(i(318));if(!nH)throw Error(i(556));if(!(e=null!==(e=t.memoizedState)?e.dehydrated:null))throw Error(i(557)
389);a$(e,t)}else H(),(128&t.flags)==0&&(t.memoizedState=null),t.flags|=4;rU(t),e=!1}else r=W(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return 256&t.flags?(eK(t),t):(eK(t),null);if((128&t.flags)!=0)throw Error(i(558))}return rU(t),null;case 13:if(n=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(a=z(t),null!==n&&null!==n.dehydrated){if(null===e){if(!a)throw Error(i(318));if(!nH)throw Error(i(344));if(!(a=null!==(a=t.memoizedState)?a.dehydrated:null))throw Error(i(317));aJ(a,t)}else H(),(128&t.flags)==0&&(t.memoizedState=null),t.flags|=4;rU(t),a=!1}else a=W(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return 256&t.flags?(eK(t),t):(eK(t),null)}return eK(t),(128&t.flags)!=0?(t.lanes=r,t):(r=null!==n,e=null!==e&&null!==e.memoizedState,r&&(n=t.child,a=null,null!==n.alternate&&null!==n.alternate.memoizedState&&null!==n.alternate.memoizedState.cachePool&&(a=n.alternate.memoizedState.cachePool.pool),s=null,null!==n.memoizedState&&null!==n.memoizedState.cachePool&&(s=n.memoizedState.cachePool.pool),s!==a&&(n.flags|=2048)),r!==e&&r&&(t.child.flags|=8192),rF(t,t.updateQueue),rU(t),null);case 4:return D(),rL(e,t),null===e&&nj(t.stateNode.containerInfo),rU(t),null;case 10:return q(t.type),rU(t),null;case 19:if(h(oz),null===(n=t.memoizedState))return rU(t),null;if(a=(128&t.flags)!=0,null===(s=n.rendering))if(a)rD(n,!1);else{if(0!==lM||null!==e&&(128&e.flags)!=0)for(e=t.child;null!==e;){if(null!==(s=eY(e))){for(t.flags|=128,rD(n,!1),t.updateQueue=e=s.updateQueue,rF(t,e),t.subtreeFlags=0,e=r,r=t.child;null!==r;)iZ(r,e),r=r.sibling;return d(oz,1&oz.current|2),ot&&w(t,n.treeForkCount),t.child}e=e.sibling}null!==n.tail&&sD()>lD&&(t.flags|=128,a=!0,rD(n,!1),t.lanes=4194304)}else{if(!a)if(null!==(e=eY(s))){if(t.flags|=128,a=!0,t.updateQueue=e=e.updateQueue,rF(t,e),rD(n,!0),null===n.tail&&"hidden"===n.tailMode&&!s.alternate&&!ot)return rU(t),null}else 2*sD()-n.renderingStartTime>lD&&0x20000000!==r&&(t.flags|=128,a=!0,rD(n,!1),t.lanes=4194304);n.isBackwards?(s.sibling=t.child,t.child=s):(null!==(e=n.last)?e.sibling=s:t.child=s,n.last=s)}return null!==n.tail?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=sD(),e.sibling=null,r=oz.current,d(oz,a?1&r|2:1&r),ot&&w(t,n.treeForkCount),e):(rU(t),null);case 22:case 23:return eK(t),ej(),n=null!==t.memoizedState,null!==e?null!==e.memoizedState!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(0x20000000&r)!=0&&(128&t.flags)==0&&(rU(t),6&t.subtreeFlags&&(t.flags|=8192)):rU(t),null!==(r=t.updateQueue)&&rF(t,r.retryQueue),r=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(r=e.memoizedState.cachePool.pool),n=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(n=t.memoizedState.cachePool.pool),n!==r&&(t.flags|=2048),null!==e&&h(oT),null;case 24:return r=null,null!==e&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),q(od),rU(t),null;case 25:case 30:return null}throw Error(i(156,t.tag))}(t.alternate,t,lA);if(null!==r){lv=r;return}if(null!==(t=t.sibling)){lv=t;return}lv=t=e}while(null!==t)0===lM&&(lM=5)}function iF(e,t){do{var r=function(e,t){switch(L(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return q(od),D(),(65536&(e=t.flags))!=0&&(128&e)==0?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return O(t),null;case 31:if(null!==t.memoizedState){if(eK(t),null===t.alternate)throw Error(i(340));H()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 13:if(eK(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(i(340));H()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return h(oz),null;case 4:return D(),null;case 10:return q(t.type),null;case 22:case 23:return eK(t),ej(),null!==e&&h(oT),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return q(od),null;default:return null}}(e.alternate,e);if(null!==r){r.flags&=32767,lv=r;return}if(null!==(r=e.return)&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!t&&null!==(e=e.sibling)){lv=e;return}lv=e=r}while(null!==e)lM=6,lv=null}function iD(e,t,r,n,a,s,o,l,u){e.cancelPendingCommit=null;do iV();while(0!==lG)if((6&lm)!=0)throw Error(i(327));if(null!==t){if(t===e.current)throw Error(i(177));if(function(e,t,r,i,n,a){var s=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var o=e.entanglements,l=e.expirationTimes,u=e.hiddenUpdates;for(r=s&~r;0<r;){var h=31-sE(r),d=1<<h;o[h]=0,l[h]=-1;var c=u[h];if(null!==c)for(u[h]=null,h=0;h<c.length;h++){var p=c[h];null!==p&&(p.lane&=-0x20000001)}r&=~d}0!==i&&y(e,i,0),0!==a&&0===n&&0!==e.tag&&(e.suspendedLanes|=a&~(s&~t))}(e,r,s=t.lanes|t.childLanes|oF,o,l,u),e===lg&&(lv=lg=null,ly=0),lV=t,lk=e,lz=r,lH=s,lW=a,lj=n,(10256&t.subtreeFlags)!=0||(10256&t.flags)!=0?(e.callbackNode=null,e.callbackPriority=0,sB(sG,function(){return iz(),null})):(e.callbackNode=null,e.callbackPriority=0),n=(13878&t.flags)!=0,(13878&t.subtreeFlags)!=0||n){n=nT.T,nT.T=null,a=nq(),nX(2),o=lm,lm|=4;try{!function(e,t){for(nN(e.containerInfo),lr=t;null!==lr;)if(t=(e=lr).child,(1028&e.subtreeFlags)!=0&&null!==t)t.return=e,lr=t;else for(;null!==lr;){var r=(e=lr).alternate;switch(t=e.flags,e.tag){case 0:if((4&t)!=0&&null!==(t=null!==(t=e.updateQueue)?t.events:null))for(var n=0;n<t.length;n++){var a=t[n];a.ref.impl=a.nextImpl}break;case 11:case 15:case 5:case 26:case 27:case 6:case 4:case 17:break;case 1:if((1024&t)!=0&&null!==r){t=void 0,n=e,a=r.memoizedProps,r=r.memoizedState;var s=n.stateNode;try{var o=t5(n.type,a);t=s.getSnapshotBeforeUpdate(o,r),s.__reactInternalSnapshotBeforeUpdate=t}catch(e){iW(n,n.return,e)}}break;case 3:(1024&t)!=0&&nV&&ab(e.stateNode.containerInfo);break;default:if((1024&t)!=0)throw Error(i(163))}if(null!==(t=e.sibling)){t.return=e.return,lr=t;break}lr=e.return}}(e,t,r)}finally{lm=o,nX(a),nT.T=n}}lG=1,iU(),iO(),iG()}}function iU(){if(1===lG){lG=0;var e=lk,t=lV,r=(13878&t.flags)!=0;if((13878&t.subtreeFlags)!=0||r){r=nT.T,nT.T=null;var i=nq();nX(2);var n=lm;lm|=4;try{r5(t,e),nL(e.containerInfo)}finally{lm=n,nX(i),nT.T=r}}e.current=t,lG=2}}function iO(){if(2===lG){lG=0;var e=lk,t=lV,r=(8772&t.flags)!=0;if((8772&t.subtreeFlags)!=0||r){r=nT.T,nT.T=null;var i=nq();nX(2);var n=lm;lm|=4;try{rQ(e,t.alternate,t)}finally{lm=n,nX(i),nT.T=r}}lG=3}}function iG(){if(4===lG||3===lG){lG=0,sF();var e=lk,t=lV,r=lz,i=lj;(10256&t.subtreeFlags)!=0||(10256&t.flags)!=0?lG=5:(lG=0,lV=lk=null,ik(e,e.pendingLanes));var n=e.pendingLanes;if(0===n&&(lO=null),S(r),t=t.stateNode,sW&&"function"==typeof sW.onCommitFiberRoot)try{sW.onCommitFiberRoot(sH,t,void 0,(128&t.current.flags)==128)}catch{}if(null!==i){t=nT.T,n=nq(),nX(2),nT.T=null;try{for(var a=e.onRecoverableError,s=0;s<i.length;s++){var o=i[s];a(o.value,{componentStack:o.stack})}}finally{nT.T=t,nX(n)}}(3&lz)!=0&&iV(),ea(e),n=e.pendingLanes,(261930&r)!=0&&(42&n)!=0?e===lq?lX++:(lX=0,lq=e):lX=0,nH&&a3(),es(0,!1)}}function ik(e,t){0==(e.pooledCacheLanes&=t)&&null!=(t=e.pooledCache)&&(e.pooledCache=null,ei(t))}function iV(){return iU(),iO(),iG(),iz()}function iz(){if(5!==lG)return!1;var e=lk,t=lH;lH=0;var r=S(lz),n=32>r?32:r;r=nT.T;var a=nq();try{nX(n),nT.T=null,n=lW,lW=null;var s=lk,o=lz;if(lG=0,lV=lk=null,lz=0,(6&lm)!=0)throw Error(i(331));var l=lm;if(lm|=4,il(s.current),it(s,s.current,o,n),lm=l,es(0,!1),sW&&"function"==typeof sW.onPostCommitFiberRoot)try{sW.onPostCommitFiberRoot(sH,s)}catch{}return!0}finally{nX(a),nT.T=r,ik(e,t)}}function iH(e,t,r){t=C(r,t),t=t9(e.stateNode,t,2),null!==(e=eD(e,t,2))&&(v(e,2),ea(e))}
389function iW(e,t,r){if(3===e.tag)iH(e,e,r);else for(;null!==t;){if(3===t.tag){iH(t,e,r);break}if(1===t.tag){var i=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof i.componentDidCatch&&(null===lO||!lO.has(i))){e=C(r,e),null!==(i=eD(t,r=t7(2),2))&&(re(r,i,t,e),v(i,2),ea(i));break}}t=t.return}}function ij(e,t,r){var i=e.pingCache;if(null===i){i=e.pingCache=new lf;var n=new Set;i.set(t,n)}else void 0===(n=i.get(t))&&(n=new Set,i.set(t,n));n.has(r)||(lT=!0,n.add(r),e=iX.bind(null,e,t,r),t.then(e,e))}function iX(e,t,r){var i=e.pingCache;null!==i&&i.delete(t),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,lg===e&&(ly&r)===r&&(4===lM||3===lM&&(0x3c00000&ly)===ly&&300>sD()-lP?(2&lm)==0&&iA(e,0):lw|=r,lN===ly&&(lN=0)),ea(e)}function iq(e,t){0===t&&(t=m()),null!==(e=eN(e,t))&&(v(e,t),ea(e))}function i$(e){var t=e.memoizedState,r=0;null!==t&&(r=t.retryLane),iq(e,r)}function iJ(e,t){var r=0;switch(e.tag){case 31:case 13:var n=e.stateNode,a=e.memoizedState;null!==a&&(r=a.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(i(314))}null!==n&&n.delete(t),iq(e,r)}function iK(e,t,r,i){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function iY(e){return!(!(e=e.prototype)||!e.isReactComponent)}function iQ(e,r){var i=e.alternate;return null===i?((i=t(e.tag,r,e.key,e.mode)).elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=r,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=0x3e00000&e.flags,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,r=e.dependencies,i.dependencies=null===r?null:{lanes:r.lanes,firstContext:r.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function iZ(e,t){e.flags&=0x3e00002;var r=e.alternate;return null===r?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,e.dependencies=null===(t=r.dependencies)?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function i0(e,r,n,a,s,o){var l=0;if(a=e,"function"==typeof e)iY(e)&&(l=1);else if("string"==typeof e)l=si&&sv?sn(e,n,s5.current)?26:sb(e)?27:5:si?sn(e,n,s5.current)?26:5:sv&&sb(e)?27:5;else o:switch(e){case ny:return(e=t(31,n,r,s)).elementType=ny,e.lanes=o,e;case nl:return i1(n.children,s,o,r);case nu:l=8,s|=24;break;case nh:return(e=t(12,n,r,2|s)).elementType=nh,e.lanes=o,e;case nf:return(e=t(13,n,r,s)).elementType=nf,e.lanes=o,e;case nm:return(e=t(19,n,r,s)).elementType=nm,e.lanes=o,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case nc:l=10;break o;case nd:l=9;break o;case np:l=11;break o;case ng:l=14;break o;case nv:l=16,a=null;break o}l=29,n=Error(i(130,null===e?"null":typeof e,"")),a=null}return(r=t(l,n,r,s)).elementType=e,r.type=a,r.lanes=o,r}function i1(e,r,i,n){return(e=t(7,e,n,r)).lanes=i,e}function i2(e,r,i){return(e=t(6,e,null,r)).lanes=i,e}function i3(e){var r=t(18,null,null,0);return r.stateNode=e,r}function i4(e,r,i){return(r=t(4,null!==e.children?e.children:[],e.key,r)).lanes=i,r.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},r}function i5(e,t,r,i,n,a,s,o,l){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=nG,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=g(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=g(0),this.hiddenUpdates=g(null),this.identifierPrefix=i,this.onUncaughtError=n,this.onCaughtError=a,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function i8(e,r,i,n,a,s,o,l,u,h,d,c){return e=new i5(e,r,i,o,u,h,d,c,l),r=1,!0===s&&(r|=24),s=t(3,null,null,r),e.current=s,s.stateNode=e,r=er(),r.refCount++,e.pooledCache=r,r.refCount++,s.memoizedState={element:n,isDehydrated:i,cache:r},eI(s),e}function i6(e){var t=e._reactInternals;if(void 0===t)throw"function"==typeof e.render?Error(i(188)):Error(i(268,e=Object.keys(e).join(",")));return null===(e=null!==(e=s(t))?function e(t){var r=t.tag;if(5===r||26===r||27===r||6===r)return t;for(t=t.child;null!==t;){if(null!==(r=e(t)))return r;t=t.sibling}return null}(e):null)?null:nC(e.stateNode)}function i9(e,t,r,i,n,a){n=sM,null===i.context?i.context=n:i.pendingContext=n,(i=eF(t)).payload={element:r},null!==(a=void 0===a?null:a)&&(i.callback=a),null!==(r=eD(e,i,t))&&(iy(r,e,t),eU(r,e,t))}function i7(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var r=e.retryLane;e.retryLane=0!==r&&r<t?r:t}}function ne(e,t){i7(e,t),(e=e.alternate)&&i7(e,t)}var nt={},nr=I.default,ni=hW.default,nn=Object.assign,na=Symbol.for("react.element"),ns=Symbol.for("react.transitional.element"),no=Symbol.for("react.portal"),nl=Symbol.for("react.fragment"),nu=Symbol.for("react.strict_mode"),nh=Symbol.for("react.profiler"),nd=Symbol.for("react.consumer"),nc=Symbol.for("react.context"),np=Symbol.for("react.forward_ref"),nf=Symbol.for("react.suspense"),nm=Symbol.for("react.suspense_list"),ng=Symbol.for("react.memo"),nv=Symbol.for("react.lazy"),ny=Symbol.for("react.activity"),n_=Symbol.for("react.memo_cache_sentinel"),nx=Symbol.iterator,nb=Symbol.for("react.client.reference"),nS=Array.isArray,nT=nr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,nA=e.rendererVersion,nM=e.rendererPackageName,nE=e.extraDevToolsConfig,nC=e.getPublicInstance,nw=e.getRootHostContext,nR=e.getChildHostContext,nN=e.prepareForCommit,nL=e.resetAfterCommit,nB=e.createInstance;e.cloneMutableInstance;var nI=e.appendInitialChild,nP=e.finalizeInitialChildren,nF=e.shouldSetTextContent,nD=e.createTextInstance;e.cloneMutableTextInstance;var nU=e.scheduleTimeout,nO=e.cancelTimeout,nG=e.noTimeout,nk=e.isPrimaryRenderer;e.warnsIfNotActing;var nV=e.supportsMutation,nz=e.supportsPersistence,nH=e.supportsHydration,nW=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var nj=e.preparePortalMount;
389e.prepareScopeUpdate,e.getInstanceFromScope;var nX=e.setCurrentUpdatePriority,nq=e.getCurrentUpdatePriority,n$=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var nJ=e.shouldAttemptEagerTransition,nK=e.detachDeletedInstance;e.requestPostPaintCallback;var nY=e.maySuspendCommit,nQ=e.maySuspendCommitOnUpdate,nZ=e.maySuspendCommitInSyncRender,n0=e.preloadInstance,n1=e.startSuspendingCommit,n2=e.suspendInstance;e.suspendOnActiveViewTransition;var n3=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var n4=e.NotPendingTransition,n5=e.HostTransitionContext,n8=e.resetFormInstance;e.bindToConsole;var n6=e.supportsMicrotasks,n9=e.scheduleMicrotask,n7=e.supportsTestSelectors,ae=e.findFiberRoot,at=e.getBoundingRect,ar=e.getTextContent,ai=e.isHiddenSubtree,an=e.matchAccessibilityRole,aa=e.setFocusIfFocusable,as=e.setupIntersectionObserver,ao=e.appendChild,al=e.appendChildToContainer,au=e.commitTextUpdate,ah=e.commitMount,ad=e.commitUpdate,ac=e.insertBefore,ap=e.insertInContainerBefore,af=e.removeChild,am=e.removeChildFromContainer,ag=e.resetTextContent,av=e.hideInstance,ay=e.hideTextInstance,a_=e.unhideInstance,ax=e.unhideTextInstance;e.cancelViewTransitionName,e.cancelRootViewTransitionName,e.restoreRootViewTransitionName,e.cloneRootViewTransitionContainer,e.removeRootViewTransitionClone,e.measureClonedInstance,e.hasInstanceChanged,e.hasInstanceAffectedParent,e.startViewTransition,e.startGestureTransition,e.stopViewTransition,e.getCurrentGestureOffset,e.createViewTransitionInstance;var ab=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var aS=e.cloneInstance,aT=e.createContainerChildSet,aA=e.appendChildToContainerChildSet,aM=e.finalizeContainerChildren,aE=e.replaceContainerChildren,aC=e.cloneHiddenInstance,aw=e.cloneHiddenTextInstance,aR=e.isSuspenseInstancePending,aN=e.isSuspenseInstanceFallback,aL=e.getSuspenseInstanceFallbackErrorDetails,aB=e.registerSuspenseInstanceRetry,aI=e.canHydrateFormStateMarker,aP=e.isFormStateMarkerMatching,aF=e.getNextHydratableSibling,aD=e.getNextHydratableSiblingAfterSingleton,aU=e.getFirstHydratableChild,aO=e.getFirstHydratableChildWithinContainer,aG=e.getFirstHydratableChildWithinActivityInstance,ak=e.getFirstHydratableChildWithinSuspenseInstance,aV=e.getFirstHydratableChildWithinSingleton,az=e.canHydrateInstance,aH=e.canHydrateTextInstance,aW=e.canHydrateActivityInstance,aj=e.canHydrateSuspenseInstance,aX=e.hydrateInstance,aq=e.hydrateTextInstance,a$=e.hydrateActivityInstance,aJ=e.hydrateSuspenseInstance,aK=e.getNextHydratableInstanceAfterActivityInstance,aY=e.getNextHydratableInstanceAfterSuspenseInstance,aQ=e.commitHydratedInstance,aZ=e.commitHydratedContainer,a0=e.commitHydratedActivityInstance,a1=e.commitHydratedSuspenseInstance,a2=e.finalizeHydratedChildren,a3=e.flushHydrationEvents;e.clearActivityBoundary;var a4=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var a5=e.clearSuspenseBoundaryFromContainer,a8=e.hideDehydratedBoundary,a6=e.unhideDehydratedBoundary,a9=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var a7,se,st=e.validateHydratableInstance,sr=e.validateHydratableTextInstance,si=e.supportsResources,sn=e.isHostHoistableType,sa=e.getHoistableRoot,ss=e.getResource,so=e.acquireResource,sl=e.releaseResource,su=e.hydrateHoistable,sh=e.mountHoistable,sd=e.unmountHoistable,sc=e.createHoistableInstance,sp=e.prepareToCommitHoistables,sf=e.mayResourceSuspendCommit,sm=e.preloadResource,sg=e.suspendResource,sv=e.supportsSingletons,sy=e.resolveSingletonInstance,s_=e.acquireSingletonInstance,sx=e.releaseSingletonInstance,sb=e.isHostSingletonType,sS=e.isSingletonScope,sT=[],sA=-1,sM={},sE=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(sC(e)/sw|0)|0},sC=Math.log,sw=Math.LN2,sR=256,sN=262144,sL=4194304,sB=ni.unstable_scheduleCallback,sI=ni.unstable_cancelCallback,sP=ni.unstable_shouldYield,sF=ni.unstable_requestPaint,sD=ni.unstable_now,sU=ni.unstable_ImmediatePriority,sO=ni.unstable_UserBlockingPriority,sG=ni.unstable_NormalPriority,sk=ni.unstable_IdlePriority,sV=ni.log,sz=ni.unstable_setDisableYieldValue,sH=null,sW=null,sj="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},sX="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof B.default&&"function"==typeof B.default.emit)return void B.default.emit("uncaughtException",e);console.error(e)},sq=Object.prototype.hasOwnProperty,s$=!1,sJ=new WeakMap,sK=[],sY=0,sQ=null,sZ=0,s0=[],s1=0,s2=null,s3=1,s4="",s5=u(null),s8=u(null),s6=u(null),s9=u(null),s7=null,oe=null,ot=!1,or=null,oi=!1,on=Error(i(519)),oa=u(null),os=null,oo=null,ol="u">typeof AbortController?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ou=ni.unstable_scheduleCallback,oh=ni.unstable_NormalPriority,od={$$typeof:nc,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},oc=null,op=null,of=!1,om=!1,og=!1,ov=0,oy=null,o_=0,ox=0,ob=null,oS=nT.S;nT.S=function(e,t){lF=sD(),"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e,t){if(null===oy){var r=oy=[];o_=0,ox=ec(),ob={status:"pending",value:void 0,then:function(e){r.push(e)}}}o_++,t.then(ep,ep)}(0,t),null!==oS&&oS(e,t)};var oT=u(null),oA=Error(i(460)),oM=Error(i(474)),oE=Error(i(542)),oC={then:function(){}},ow=null,oR=null,oN=0,oL=eE(!0),oB=eE(!1),oI=[],oP=0,oF=0,oD=!1,oU=!1,oO=u(null),oG=u(0),ok=u(null),oV=null,oz=u(0),oH=0,oW=null,oj=null,oX=null,oq=!1,o$=!1,oJ=!1,oK=0,oY=0,oQ=null,oZ=0,o0={readContext:Z,use:tt,useCallback:eQ,useContext:eQ,useEffect:eQ,useImperativeHandle:eQ,useLayoutEffect:eQ,useInsertionEffect:eQ,useMemo:eQ,useReducer:eQ,useRef:eQ,useState:eQ,useDebugValue:eQ,useDeferredValue:eQ,useTransition:eQ,useSyncExternalStore:eQ,useId:eQ,useHostTransitionStatus:eQ,useFormState:eQ,useActionState:eQ,useOptimistic:eQ,useMemoCache:eQ,useCacheRefresh:eQ};o0.useEffectEvent=eQ;var o1={readContext:Z,use:tt,useCallback:function(e,t){return e6().memoizedState=[e,void 0===t?null:t],e},useContext:Z,useEffect:tL,useImperativeHandle:function(e,t,r){r=null!=r?r.concat([e]):null,tR(4194308,4,tD.bind(null,t,e),r)},useLayoutEffect:function(e,t){return tR(4194308,4,e,t)},useInsertionEffect:function(e,t){tR(4,2,e,t)},useMemo:function(e,t){var r=e6();t=void 0===t?null:t;var i=e();return r.memoizedState=[i,t],i},useReducer:function(e,t,r){var i=e6();if(void 0!==r)var n=r(t);else n=t;
389return i.memoizedState=i.baseState=n,i.queue=e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},e=e.dispatch=tJ.bind(null,oW,e),[i.memoizedState,e]},useRef:function(e){return e6().memoizedState={current:e}},useState:function(e){var t=(e=tp(e)).queue,r=tK.bind(null,oW,t);return t.dispatch=r,[e.memoizedState,r]},useDebugValue:tO,useDeferredValue:function(e,t){return tV(e6(),e,t)},useTransition:function(){var e=tp(!1);return e=tH.bind(null,oW,e.queue,!0,!1),e6().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,r){var n=oW,a=e6();if(ot){if(void 0===r)throw Error(i(407));r=r()}else{if(r=t(),null===lg)throw Error(i(349));(127&ly)!=0||tl(n,t,r)}a.memoizedState=r;var s={value:r,getSnapshot:t};return a.queue=s,tL(th.bind(null,n,s,e),[e]),n.flags|=2048,tC(9,{destroy:void 0},tu.bind(null,n,s,r,t),null),r},useId:function(){var e=e6(),t=lg.identifierPrefix;if(ot){var r=s4,i=s3;t="_"+t+"R_"+(r=(i&~(1<<32-sE(i)-1)).toString(32)+r),0<(r=oK++)&&(t+="H"+r.toString(32)),t+="_"}else t="_"+t+"r_"+(r=oZ++).toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:tj,useFormState:tS,useActionState:tS,useOptimistic:function(e){var t=e6();t.memoizedState=t.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=r,t=tQ.bind(null,oW,!0,r),r.dispatch=t,[e,t]},useMemoCache:tr,useCacheRefresh:function(){return e6().memoizedState=t$.bind(null,oW)},useEffectEvent:function(e){var t=e6(),r={impl:e};return t.memoizedState=r,function(){if((2&lm)!=0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}},o2={readContext:Z,use:tt,useCallback:tG,useContext:Z,useEffect:tB,useImperativeHandle:tU,useInsertionEffect:tP,useLayoutEffect:tF,useMemo:tk,useReducer:tn,useRef:tw,useState:function(){return tn(ti)},useDebugValue:tO,useDeferredValue:function(e,t){return tz(e9(),oj.memoizedState,e,t)},useTransition:function(){var e=tn(ti)[0],t=e9().memoizedState;return["boolean"==typeof e?e:te(e),t]},useSyncExternalStore:to,useId:tX,useHostTransitionStatus:tj,useFormState:tT,useActionState:tT,useOptimistic:function(e,t){return tf(e9(),oj,e,t)},useMemoCache:tr,useCacheRefresh:tq};o2.useEffectEvent=tI;var o3={readContext:Z,use:tt,useCallback:tG,useContext:Z,useEffect:tB,useImperativeHandle:tU,useInsertionEffect:tP,useLayoutEffect:tF,useMemo:tk,useReducer:ts,useRef:tw,useState:function(){return ts(ti)},useDebugValue:tO,useDeferredValue:function(e,t){var r=e9();return null===oj?tV(r,e,t):tz(r,oj.memoizedState,e,t)},useTransition:function(){var e=ts(ti)[0],t=e9().memoizedState;return["boolean"==typeof e?e:te(e),t]},useSyncExternalStore:to,useId:tX,useHostTransitionStatus:tj,useFormState:tE,useActionState:tE,useOptimistic:function(e,t){var r=e9();return null!==oj?tf(r,oj,e,t):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:tr,useCacheRefresh:tq};o3.useEffectEvent=tI;var o4={enqueueSetState:function(e,t,r){e=e._reactInternals;var i=ig(),n=eF(i);n.payload=t,null!=r&&(n.callback=r),null!==(t=eD(e,n,i))&&(iy(t,e,i),eU(t,e,i))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var i=ig(),n=eF(i);n.tag=1,n.payload=t,null!=r&&(n.callback=r),null!==(t=eD(e,n,i))&&(iy(t,e,i),eU(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=ig(),i=eF(r);i.tag=2,null!=t&&(i.callback=t),null!==(t=eD(e,i,r))&&(iy(t,e,r),eU(t,e,r))}},o5=Error(i(461)),o8=!1,o6={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},o9=!1,o7=!1,le=!1,lt="function"==typeof WeakSet?WeakSet:Set,lr=null,li=null,ln=!1,la=null,ls=8192,lo={getCacheForType:function(e){var t=Z(od),r=t.data.get(e);return void 0===r&&(r=e(),t.data.set(e,r)),r},cacheSignal:function(){return Z(od).controller.signal}},ll=0,lu=1,lh=2,ld=3,lc=4;if("function"==typeof Symbol&&Symbol.for){var lp=Symbol.for;ll=lp("selector.component"),lu=lp("selector.has_pseudo_class"),lh=lp("selector.role"),ld=lp("selector.test_id"),lc=lp("selector.text")}var lf="function"==typeof WeakMap?WeakMap:Map,lm=0,lg=null,lv=null,ly=0,l_=0,lx=null,lb=!1,lS=!1,lT=!1,lA=0,lM=0,lE=0,lC=0,lw=0,lR=0,lN=0,lL=null,lB=null,lI=!1,lP=0,lF=0,lD=1/0,lU=null,lO=null,lG=0,lk=null,lV=null,lz=0,lH=0,lW=null,lj=null,lX=0,lq=null;return nt.attemptContinuousHydration=function(e){if(13===e.tag||31===e.tag){var t=eN(e,0x4000000);null!==t&&iy(t,e,0x4000000),ne(e,0x4000000)}},nt.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag||31===e.tag){var t=ig(),r=eN(e,t=b(t));null!==r&&iy(r,e,t),ne(e,t)}},nt.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if((e=e.stateNode).current.memoizedState.isDehydrated){var t=c(e.pendingLanes);if(0!==t){for(e.pendingLanes|=2,e.entangledLanes|=2;t;){var r=1<<31-sE(t);e.entanglements[1]|=r,t&=~r}ea(e),(6&lm)==0&&(lD=sD()+500,es(0,!1))}}break;case 31:case 13:null!==(t=eN(e,2))&&iy(t,e,2),iS(),ne(e,2)}},nt.batchedUpdates=function(e,t){return e(t)},nt.createComponentSelector=function(e){return{$$typeof:ll,value:e}},nt.createContainer=function(e,t,r,i,n,a,s,o,l,u){return i8(e,t,!1,null,r,i,a,null,s,o,l,u)},nt.createHasPseudoClassSelector=function(e){return{$$typeof:lu,value:e}},nt.createHydrationContainer=function(e,t,r,i,n,a,s,o,l,u,h,d,c,p){var f;return(e=i8(r,i,!0,e,n,a,o,p,l,u,h,d)).context=sM,r=e.current,(n=eF(i=b(i=ig()))).callback=null!=(f=t)?f:null,eD(r,n,i),t=i,e.current.lanes=t,v(e,t),ea(e),e},nt.createPortal=function(e,t,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:no,key:null==i?null:""+i,children:e,containerInfo:t,implementation:r}},nt.createRoleSelector=function(e){return{$$typeof:lh,value:e}},nt.createTestNameSelector=function(e){return{$$typeof:ld,value:e}},nt.createTextSelector=function(e){return{$$typeof:lc,value:e}},nt.defaultOnCaughtError=function(e){console.error(e)},nt.defaultOnRecoverableError=function(e){sX(e)},nt.defaultOnUncaughtError=function(e){sX(e)},nt.deferredUpdates=function(e){var t=nT.T,r=nq();try{return nX(32),nT.T=null,e()}finally{nX(r),nT.T=t}},nt.discreteUpdates=function(e,t,r,i,n){var a=nT.T,s=nq();try{return nX(2),nT.T=null,e(t,r,i,n)}finally{nX(s),nT.T=a,0===lm&&(lD=sD()+500)}},nt.findAllNodes=im,nt.findBoundingRects=function(e,t){if(!n7)throw Error(i(363));t=im(e,t),e=[];for(var r=0;r<t.length;r++)e.push(at(t[r]));for(t=e.length-1;0<t;t--){r=e[t];for(var n=r.x,a=n+r.width,s=r.y,o=s+r.height,l=t-1;0<=l;l--)if(t!==l){var u=e[l],h=u.x,d=h+u.width,c=u.y,p=c+u.height;if(n>=h&&s>=c&&a<=d&&o<=p){e.splice(t,1);break}if(n!==h||r.width!==u.width||p<s||c>o){if(!(s!==c||r.height!==u.height||d<n||h>a)){h>n&&(u.width+=h-n,u.x=n),d<a&&(u.width=a-h),e.splice(t,1);break}}else{c>s&&(u.height+=c-s,u.y=s),p<o&&(u.height=o-c),e.splice(t,1);break}}}return e},nt.findHostInstance=i6,nt.findHostInstanceWithNoPortals=function(e){return null===(e=null!==(e=s(e))?function e(t){var r=t.tag;if(5===r||26===r||27===r||6===r)return t;for(t=t.child;null!==t;){if(4!==t.tag&&null!==(r=e(t)))return r;t=t.sibling}return null}(e):null)?null:nC(e.stateNode)},nt.findHostInstanceWithWarning=function(e){return i6(e)},nt.flushPassiveEffects=iV,nt.flushSyncFromReconciler=function(e){var t=lm;lm|=1;var r=nT.T,i=nq();try{if(nX(2),nT.T=null,e)return e()}finally{nX(i),nT.T=r,(6&(lm=t))==0&&es(0,!1)}},nt.flushSyncWork=iS,nt.focusWithin=function(e,t){if(!n7)throw Error(i(363));for(t=Array.from(t=ip(e=ih(e),t)),e=0;e<t.length;){var r=t[e++],n=r.tag;if(!ai(r)){if((5===n||26===n||27===n)&&aa(r.stateNode))return!0;for(r=r.child;null!==r;)t.push(r),r=r.sibling}}return!1},nt.getFindAllNodesFailureDescription=function(e,t){if(!n7)throw Error(i(363));var r=0,n=[];e=[ih(e),0];for(var a=0;a<e.length;){var s=e[a++],o=s.tag,l=e[a++],u=t[l];if((5!==o&&26!==o&&27!==o||!ai(s))&&(id(s,u)&&(n.push(ic(u)),++l>r&&(r=l)),l<t.length))for(s=s.child;null!==s;)e.push(s,l),s=s.sibling}if(r<t.length){for(e=[];r<t.length;r++)e.push(ic(t[r]));return`findAllNodes was able to match part of the selector: 390 `+n.join(" > ")+` 391 392No matching component was found for: 393 `+e.join(" > ")}return null},nt.getPublicRootInstance=function(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 27:case 5:return nC(e.child.stateNode);default:return e.child.stateNode}},nt.injectIntoDevTools=function(){var e={bundleType:0,version:nA,rendererPackageName:nM,currentDispatcherRef:nT,reconcilerVersion:"19.2.0"};if(null!==nE&&(e.rendererConfig=nE),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;
393if(t.isDisabled||!t.supportsFiber)e=!0;else{try{sH=t.inject(e),sW=t}catch{}e=!!t.checkDCE}}return e},nt.isAlreadyRendering=function(){return(6&lm)!=0},nt.observeVisibleRects=function(e,t,r,n){if(!n7)throw Error(i(363));var a=as(e=im(e,t),r,n).disconnect;return{disconnect:function(){a()}}},nt.shouldError=function(){return null},nt.shouldSuspend=function(){return!1},nt.startHostTransition=function(e,t,n,a){if(5!==e.tag)throw Error(i(476));var s=tW(e).queue;tH(e,s,t,n4,null===n?r:function(){var t=tW(e);return null===t.next&&(t=e.alternate.memoizedState),tY(e,t.next.queue,{},ig()),n(a)})},nt.updateContainer=function(e,t,r,i){var n=t.current,a=ig();return i9(n,a,e,t,r,i),a},nt.updateContainerSync=function(e,t,r,i){return i9(t.current,2,e,t,r,i),2},nt},dE.exports.default=dE.exports,Object.defineProperty(dE.exports,"__esModule",{value:!0})),dM.exports=dE.exports),(C=dM.exports)&&C.__esModule&&Object.prototype.hasOwnProperty.call(C,"default"))?C.default:C,dw={},dR=/^three(?=[A-Z])/,dN=e=>`${e[0].toUpperCase()}${e.slice(1)}`,dL=0;function dB(e){if("function"==typeof e){let t=`${dL++}`;return dw[t]=e,t}Object.assign(dw,e)}function dI(e,t){let r=dN(e),i=dw[r];if("primitive"!==e&&!i)throw Error(`R3F: ${r} 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("primitive"===e&&!t.object)throw Error("R3F: Primitives without 'object' are invalid!");if(void 0!==t.args&&!Array.isArray(t.args))throw Error("R3F: The args prop must be an array!")}function dP(e){if(e.isHidden){var t;e.props.attach&&null!=(t=e.parent)&&t.object?dn(e.parent,e):df(e.object)&&!1!==e.props.visible&&(e.object.visible=!0),e.isHidden=!1,dc(e)}}function dF(e,t,r){let i=t.root.getState();if(e.parent||e.object===i.scene){if(!t.object){var n,a;let e=dw[dN(t.type)];t.object=null!=(n=t.props.object)?n:new e(...null!=(a=t.props.args
393)?a:[]),t.object.__r3f=t}if(dd(t.object,t.props),t.props.attach)dn(e,t);else if(df(t.object)&&df(e.object)){let i=e.object.children.indexOf(null==r?void 0:r.object);if(r&&-1!==i){let r=e.object.children.indexOf(t.object);-1!==r?(e.object.children.splice(r,1),e.object.children.splice(r<i?i-1:i,0,t.object)):(t.object.parent=e.object,e.object.children.splice(i,0,t.object),t.object.dispatchEvent({type:"added"}),e.object.dispatchEvent({type:"childadded",child:t.object}))}else e.object.add(t.object)}for(let e of t.children)dF(t,e);dc(t)}}function dD(e,t){t&&(t.parent=e,e.children.push(t),dF(e,t))}function dU(e,t,r){if(!t||!r)return;t.parent=e;let i=e.children.indexOf(r);-1!==i?e.children.splice(i,0,t):e.children.push(t),dF(e,t,r)}function dO(e){if("function"==typeof e.dispose){let t=()=>{try{e.dispose()}catch{}};"u">typeof IS_REACT_ACT_ENVIRONMENT?t():(0,hW.unstable_scheduleCallback)(hW.unstable_IdlePriority,t)}}function dG(e,t,r){if(!t)return;t.parent=null;let i=e.children.indexOf(t);-1!==i&&e.children.splice(i,1),t.props.attach?da(e,t):df(t.object)&&df(e.object)&&(e.object.remove(t.object),function(e,t){let{internal:r}=e.getState();r.interaction=r.interaction.filter(e=>e!==t),r.initialHits=r.initialHits.filter(e=>e!==t),r.hovered.forEach((e,i)=>{(e.eventObject===t||e.object===t)&&r.hovered.delete(i)}),r.capturedMap.forEach((e,i)=>{dg(r.capturedMap,t,e,i)})}(hZ(t),t.object));let n=null!==t.props.dispose&&!1!==r;for(let e=t.children.length-1;e>=0;e--){let r=t.children[e];dG(t,r,n)}t.children.length=0,delete t.object.__r3f,n&&"primitive"!==t.type&&"Scene"!==t.object.type&&dO(t.object),void 0===r&&dc(t)}let dk=[],dV=()=>{},dz={},dH=0,dW=(w={isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:function(e,t,r){var i;return dI(e=dN(e)in dw?e:e.replace(dR,""),t),"primitive"===e&&null!=(i=t.object)&&i.__r3f&&delete t.object.__r3f,dt(t.object,r,e,t)},removeChild:dG,appendChild:dD,appendInitialChild:dD,insertBefore:dU,appendChildToContainer(e,t){let r=e.getState().scene.__r3f;t&&r&&dD(r,t)},removeChildFromContainer(e,t){let r=e.getState().scene.__r3f;t&&r&&dG(r,t)},insertInContainerBefore(e,t,r){let i=e.getState().scene.__r3f;t&&r&&i&&dU(i,t,r)},getRootHostContext:()=>dz,getChildHostContext:()=>dz,commitUpdate(e,t,r,i,n){var a,s,o;dI(t,i);let l=!1;if("primitive"===e.type&&r.object!==i.object||(null==(a=i.args)?void 0:a.length)!==(null==(s=r.args)?void 0:s.length)?l=!0:null!=(o=i.args)&&o.some((e,t)=>{var i;return e!==(null==(i=r.args)?void 0:i[t])})&&(l=!0),l)dk.push([e,{...i},n]);else{let t=function(e,t){let r={};for(let i in t)if(!ds.includes(i)&&!h7.equ(t[i],e.props[i]))for(let e in r[i]=t[i],t)e.startsWith(`${i}-`)&&(r[e]=t[e]);for(let i in e.props){if(ds.includes(i)||t.hasOwnProperty(i))continue;let{root:n,key:a}=dr(e.object,i);if(n.constructor&&0===n.constructor.length){let e=function(e){let t=dl.get(e.constructor);try{t||(t=new e.constructor,dl.set(e.constructor,t))}catch(e){}return t}(n);h7.und(e)||(r[a]=e[a])}else r[a]=0}return r}(e,i);Object.keys(t).length&&(Object.assign(e.props,t),dd(e.object,t))}(null===n.sibling||(4&n.flags)==0)&&function(){for(let[e]of dk){let t=e.parent;if(t)for(let r of(e.props.attach?da(t,e):df(e.object)&&df(t.object)&&t.object.remove(e.object),e.children))r.props.attach?da(e,r):df(r.object)&&df(e.object)&&e.object.remove(r.object);e.isHidden&&dP(e),e.object.__r3f&&delete e.object.__r3f,"primitive"!==e.type&&dO(e.object)}for(let[i,n,a]of dk){i.props=n;let s=i.parent;if(s){let n=dw[dN(i.type)];i.object=null!=(e=i.props.object)?e:new n(...null!=(t=i.props.args)?t:[]),i.object.__r3f=i;var e,t,r=i.object;for(let e of[a,a.alternate])if(null!==e)if("function"==typeof e.ref){null==e.refCleanup||e.refCleanup();let t=e.ref(r);"function"==typeof t&&(e.refCleanup=t)}else e.ref&&(e.ref.current=r);for(let e of(dd(i.object,i.props),i.props.attach?dn(s,i):df(i.object)&&df(s.object)&&s.object.add(i.object),i.children))e.props.attach?dn(i,e):df(e.object)&&df(i.object)&&i.object.add(e.object);dc(i)}}dk.length=0}()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:e=>null==e?void 0:e.object,prepareForCommit:()=>null,preparePortalMount:e=>dt(e.getState().scene,e,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:function(e){if(!e.isHidden){var t;e.props.attach&&null!=(t=e.parent)&&t.object?da(e.parent,e):df(e.object)&&(e.object.visible=!1),e.isHidden=!0,dc(e)}},unhideInstance:dP,createTextInstance:dV,hideTextInstance:dV,unhideTextInstance:dV,scheduleTimeout:"function"==typeof setTimeout?setTimeout:void 0,cancelTimeout:"function"==typeof clearTimeout?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){}
393,prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:I.createContext(null),setCurrentUpdatePriority(e){dH=e},getCurrentUpdatePriority:()=>dH,resolveUpdatePriority(){var e;if(0!==dH)return dH;switch("u">typeof window&&(null==(e=window.event)?void 0:e.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return 2;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return 8;default:return 32}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:"9.5.0",applyViewTransitionName(e,t,r){},restoreViewTransitionName(e,t){},cancelViewTransitionName(e,t,r){},cancelRootViewTransitionName(e){},restoreRootViewTransitionName(e){},InstanceMeasurement:null,measureInstance:e=>null,wasInstanceInViewport:e=>!0,hasInstanceChanged:(e,t)=>!1,hasInstanceAffectedParent:(e,t)=>!1,suspendOnActiveViewTransition(e,t){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(e){},createViewTransitionInstance:e=>null,getCurrentGestureOffset(e){throw Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance:(e,t)=>e,cloneMutableTextInstance:e=>e,cloneRootViewTransitionContainer(e){throw Error("Not implemented.")},removeRootViewTransitionClone(e,t){throw Error("Not implemented.")},createFragmentInstance:e=>null,updateFragmentInstanceFiber(e,t){},commitNewChildToFragmentInstance(e,t){},deleteChildFromFragmentInstance(e,t){},measureClonedInstance:e=>null,maySuspendCommitOnUpdate:(e,t,r)=>!1,maySuspendCommitInSyncRender:(e,t)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(e,t)=>null},(A=dC(w)).injectIntoDevTools(),A),dj=new Map,dX={objects:"shallow",strict:!1};function dq(e){var t,r;let i,n,a,s,o,l,u,h=dj.get(e),d=null==h?void 0:h.fiber,c=null==h?void 0:h.store;h&&console.warn("R3F.createRoot should only be called once!");let p="function"==typeof reportError?reportError:console.error,f=c||(t=d6,r=d9,o=(s=(a=hk((e,i)=>{let n,a=new eT,s=new eT,o=new eT;function l(e=i().camera,t=s,r=i().size){let{width:n,height:u,top:h,left:d}=r,c=n/u;t.isVector3?o.copy(t):o.set(...t);let p=e.getWorldPosition(a).distanceTo(o);if(e&&e.isOrthographicCamera)return{width:n/e.zoom,height:u/e.zoom,top:h,left:d,factor:1,distance:p,aspect:c};{let t=2*Math.tan(e.fov*Math.PI/180/2)*p,r=n/u*t;return{width:r,height:t,top:h,left:d,factor:n/r,distance:p,aspect:c}}}let u=t=>e(e=>({performance:{...e.performance,current:t}})),h=new eb;return{set:e,get:i,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(e=1)=>t(i(),e),advance:(e,t)=>r(e,t,i()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new oN,pointer:h,mouse:h,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let e=i();n&&clearTimeout(n),e.performance.current!==e.performance.min&&u(e.performance.min),n=setTimeout(()=>u(i().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:l},setEvents:t=>e(e=>({...e,events:{...e.events,...t}})),setSize:(t,r,n=0,a=0)=>{let o=i().camera,u={width:t,height:r,top:n,left:a};e(e=>({size:u,viewport:{...e.viewport,...l(o,s,u)}}))},setDpr:t=>e(e=>{let r=h6(t);return{viewport:{...e.viewport,dpr:r,initialDpr:e.viewport.initialDpr||r}}}),setFrameloop:(t="always")=>{let r=i().clock;r.stop(),r.elapsedTime=0,"never"!==t&&(r.start(),r.elapsedTime=0),e(()=>({frameloop:t}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:I.createRef(),active:!1,frames:0,priority:0,subscribe:(e,t,r)=>{let n=i().internal;return n.priority=n.priority+ +(t>0),n.subscribers.push({ref:e,priority:t,store:r}),n.subscribers=n.subscribers.sort((e,t)=>
393e.priority-t.priority),()=>{let r=i().internal;null!=r&&r.subscribers&&(r.priority=r.priority-(t>0),r.subscribers=r.subscribers.filter(t=>t.ref!==e))}}}}})).getState()).size,l=s.viewport.dpr,u=s.camera,a.subscribe(()=>{let{camera:e,size:t,viewport:r,gl:i,set:n}=a.getState();if(t.width!==o.width||t.height!==o.height||r.dpr!==l){o=t,l=r.dpr,dp(e,t),r.dpr>0&&i.setPixelRatio(r.dpr);let n="u">typeof HTMLCanvasElement&&i.domElement instanceof HTMLCanvasElement;i.setSize(t.width,t.height,n)}e!==u&&(u=e,n(t=>({viewport:{...t.viewport,...t.viewport.getCurrentViewport(e)}})))}),a.subscribe(e=>t(e)),a),m=d||dW.createContainer(f,1,null,!1,null,"",p,p,p,null);h||dj.set(e,{fiber:m,store:f});let g=!1,v=null;return{async configure(t={}){var r,a;let s;v=new Promise(e=>s=e);let{gl:o,size:l,scene:u,events:h,onCreated:d,shadows:c=!1,linear:p=!1,flat:m=!1,legacy:y=!1,orthographic:_=!1,frameloop:x="always",dpr:b=[1,2],performance:S,raycaster:T,camera:A,onPointerMissed:M}=t,E=f.getState(),C=E.gl;if(!E.gl){let t={canvas:e,powerPreference:"high-performance",antialias:!0,alpha:!0},r="function"==typeof o?await o(t):o;C=dv(r)?r:new hF({...t,...o}),E.set({gl:C})}let w=E.raycaster;w||E.set({raycaster:w=new oC});let{params:R,...N}=T||{};if(h7.equ(N,w,dX)||dd(w,{...N}),h7.equ(R,w.params,dX)||dd(w,{params:{...w.params,...R}}),!E.camera||E.camera===n&&!h7.equ(n,A,dX)){n=A;let e=null==A?void 0:A.isCamera,t=e?A:_?new sB(0,0,0,0,.1,1e3):new sC(75,0,.1,1e3);!e&&(t.position.z=5,A&&(dd(t,A),!t.manual&&("aspect"in A||"left"in A||"right"in A||"bottom"in A||"top"in A)&&(t.manual=!0,t.updateProjectionMatrix())),E.camera||null!=A&&A.rotation||t.lookAt(0,0,0)),E.set({camera:t}),w.camera=t}if(!E.scene){let e;null!=u&&u.isScene?dt(e=u,f,"",{}):(dt(e=new tS,f,"",{}),u&&dd(e,u)),E.set({scene:e})}h&&!E.events.handlers&&E.set({events:h(f)});let L=function(e,t){if(!t&&"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&e.parentElement){let{width:t,height:r,top:i,left:n}=e.parentElement.getBoundingClientRect();return{width:t,height:r,top:i,left:n}}return!t&&"u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas?{width:e.width,height:e.height,top:0,left:0}:{width:0,height:0,top:0,left:0,...t}}(e,l);if(h7.equ(L,E.size,dX)||E.setSize(L.width,L.height,L.top,L.left),b&&E.viewport.dpr!==h6(b)&&E.setDpr(b),E.frameloop!==x&&E.setFrameloop(x),E.onPointerMissed||E.set({onPointerMissed:M}),S&&!h7.equ(S,E.performance,dX)&&E.set(e=>({performance:{...e.performance,...S}})),!E.xr){let e=(e,t)=>{let r=f.getState();"never"!==r.frameloop&&d9(e,!0,r,t)},t=()=>{let t=f.getState();t.gl.xr.enabled=t.gl.xr.isPresenting,t.gl.xr.setAnimationLoop(t.gl.xr.isPresenting?e:null),t.gl.xr.isPresenting||d6(t)},i={connect(){let e=f.getState().gl;e.xr.addEventListener("sessionstart",t),e.xr.addEventListener("sessionend",t)},disconnect(){let e=f.getState().gl;e.xr.removeEventListener("sessionstart",t),e.xr.removeEventListener("sessionend",t)}};"function"==typeof(null==(r=C.xr)?void 0:r.addEventListener)&&i.connect(),E.set({xr:i})}if(C.shadowMap){let e=C.shadowMap.enabled,t=C.shadowMap.type;C.shadowMap.enabled=!!c,h7.boo(c)?C.shadowMap.type=2:h7.str(c)?C.shadowMap.type=null!=(a=({basic:0,percentage:1,soft:2,variance:3}
393)[c])?a:2:h7.obj(c)&&Object.assign(C.shadowMap,c),(e!==C.shadowMap.enabled||t!==C.shadowMap.type)&&(C.shadowMap.needsUpdate=!0)}return eN.enabled=!y,g||(C.outputColorSpace=p?G:O,C.toneMapping=4*!m),E.legacy!==y&&E.set(()=>({legacy:y})),E.linear!==p&&E.set(()=>({linear:p})),E.flat!==m&&E.set(()=>({flat:m})),!o||h7.fun(o)||dv(o)||h7.equ(o,C,dX)||dd(C,o),i=d,g=!0,s(),this},render(t){return g||v||this.configure(),v.then(()=>{dW.updateContainer((0,L.jsx)(d$,{store:f,children:t,onCreated:i,rootElement:e}),m,null,()=>void 0)}),f},unmount(){dJ(e)}}}function d$({store:e,children:t,onCreated:r,rootElement:i}){return h2(()=>{let t=e.getState();t.set(e=>({internal:{...e.internal,active:!0}})),r&&r(t),e.getState().events.connected||null==t.events.connect||t.events.connect(i)},[]),(0,L.jsx)(dy.Provider,{value:e,children:t})}function dJ(e,t){let r=dj.get(e),i=null==r?void 0:r.fiber;if(i){let n=null==r?void 0:r.store.getState();n&&(n.internal.active=!1),dW.updateContainer(null,i,null,()=>{n&&setTimeout(()=>{try{null==n.events.disconnect||n.events.disconnect(),null==(r=n.gl)||null==(i=r.renderLists)||null==i.dispose||i.dispose(),null==(a=n.gl)||null==a.forceContextLoss||a.forceContextLoss(),null!=(s=n.gl)&&s.xr&&n.xr.disconnect();var r,i,a,s,o=n.scene;for(let e in"Scene"!==o.type&&(null==o.dispose||o.dispose()),o){let t=o[e];(null==t?void 0:t.type)!=="Scene"&&(null==t||null==t.dispose||t.dispose())}dj.delete(e),t&&t(e)}catch(e){}},500)})}}function dK(e,t,r){return(0,L.jsx)(dY,{children:e,container:t,state:r})}function dY({state:e={},children:t,container:r}){let{events:i,size:n,...a}=e,s=d_(),[o]=I.useState(()=>new oC),[l]=I.useState(()=>new eb),u=h3((e,t)=>{let a;if(t.camera&&n){let r=t.camera;a=e.viewport.getCurrentViewport(r,new eT,n),r!==e.camera&&dp(r,n)}return{...e,...t,scene:r,raycaster:o,pointer:l,mouse:l,previousRoot:s,events:{...e.events,...t.events,...i},size:{...e.size,...n},viewport:{...e.viewport,...a},setEvents:e=>t.set(t=>({...t,events:{...t.events,...e}}))}}),h=I.useMemo(()=>{let e=hk((e,t)=>({...a,set:e,get:t})),t=t=>e.setState(e=>u.current(t,e));return t(s.getState()),s.subscribe(t),e},[s,r]);return(0,L.jsx)(L.Fragment,{children:dW.createPortal((0,L.jsx)(dy.Provider,{value:h,children:t}),h,null)})}let dQ=new Set,dZ=new Set,d0=new Set;function d1(e,t){if(e.size)for(let{callback:r}of e.values())r(t)}function d2(e,t){switch(e){case"before":return d1(dQ,t);case"after":return d1(dZ,t);case"tail":return d1(d0,t)}}function d3(e,t,r){let i=t.clock.getDelta();"never"===t.frameloop&&"number"==typeof e&&(i=e-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=e),s=t.internal.subscribers;for(let e=0;e<s.length;e++)(o=s[e]).ref.current(o.store.getState(),i,r);return!t.internal.priority&&t.gl.render&&t.gl.render(t.scene,t.camera),t.internal.frames=Math.max(0,t.internal.frames-1),"always"===t.frameloop?1:t.internal.frames}let d4=!1,d5=!1;function d8(e){for(let r of(u=requestAnimationFrame(d8),d4=!0,l=0,d2("before",e),d5=!0,dj.values())){var t;(h=r.store.getState()).internal.active&&("always"===h.frameloop||h.internal.frames>0)&&!(null!=(t=h.gl.xr)&&t.isPresenting)&&(l+=d3(e,h))}if(d5=!1,d2("after",e),0===l)return d2("tail",e),d4=!1,cancelAnimationFrame(u)}function d6(e,t=1){var r;if(!e)return dj.forEach(e=>d6(e.store.getState(),t));(null==(r=e.gl.xr)||!r.isPresenting)&&e.internal.active&&"never"!==e.frameloop&&(t>1?e.internal.frames=Math.min(60,e.internal.frames+t):d5?e.internal.frames=2:e.internal.frames=1,d4||(d4=!0,requestAnimationFrame(d8)))}function d9(e,t=!0,r,i){if(t&&d2("before",e),r)d3(e,r,i);else for(let t of dj.values())d3(e,t.store.getState());t&&d2("after",e)}let d7={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 ce(e){let{handlePointer:t}=function(e){function t(e){return e.filter(e=>["Move","Over","Enter","Out","Leave"].some(t=>{var r;return null==(r=e.__r3f)?void 0:r.handlers["onPointer"+t]}))}function r(t){let{internal:r}=e.getState();for(let e of r.hovered.values())if(!t.length||!t.find(t=>t.object===e.object&&t.index===e.index&&t.instanceId===e.instanceId)){let i=e.eventObject.__r3f;
393if(r.hovered.delete(dm(e)),null!=i&&i.eventCount){let r=i.handlers,n={...e,intersections:t};null==r.onPointerOut||r.onPointerOut(n),null==r.onPointerLeave||r.onPointerLeave(n)}}}function i(e,t){for(let r=0;r<t.length;r++){let i=t[r].__r3f;null==i||null==i.handlers.onPointerMissed||i.handlers.onPointerMissed(e)}}return{handlePointer:function(n){switch(n){case"onPointerLeave":case"onPointerCancel":return()=>r([]);case"onLostPointerCapture":return t=>{let{internal:i}=e.getState();"pointerId"in t&&i.capturedMap.has(t.pointerId)&&requestAnimationFrame(()=>{i.capturedMap.has(t.pointerId)&&(i.capturedMap.delete(t.pointerId),r([]))})}}return function(a){let{onPointerMissed:s,internal:o}=e.getState();o.lastEvent.current=a;let l="onPointerMove"===n,u="onClick"===n||"onContextMenu"===n||"onDoubleClick"===n,h=function(t,r){let i=e.getState(),n=new Set,a=[],s=r?r(i.internal.interaction):i.internal.interaction;for(let e=0;e<s.length;e++){let t=h9(s[e]);t&&(t.raycaster.camera=void 0)}i.previousRoot||null==i.events.compute||i.events.compute(t,i);let o=s.flatMap(function(e){let r=h9(e);if(!r||!r.events.enabled||null===r.raycaster.camera)return[];if(void 0===r.raycaster.camera){var i;null==r.events.compute||r.events.compute(t,r,null==(i=r.previousRoot)?void 0:i.getState()),void 0===r.raycaster.camera&&(r.raycaster.camera=null)}return r.raycaster.camera?r.raycaster.intersectObject(e,!0):[]}).sort((e,t)=>{let r=h9(e.object),i=h9(t.object);return r&&i&&i.events.priority-r.events.priority||e.distance-t.distance}).filter(e=>{let t=dm(e);return!n.has(t)&&(n.add(t),!0)});for(let e of(i.events.filter&&(o=i.events.filter(o,i)),o)){let t=e.object;for(;t;){var l;null!=(l=t.__r3f)&&l.eventCount&&a.push({...e,eventObject:t}),t=t.parent}}if("pointerId"in t&&i.internal.capturedMap.has(t.pointerId))for(let e of i.internal.capturedMap.get(t.pointerId).values())n.has(dm(e.intersection))||a.push(e.intersection);return a}(a,l?t:void 0),d=u?function(t){let{internal:r}=e.getState(),i=t.offsetX-r.initialClick[0],n=t.offsetY-r.initialClick[1];return Math.round(Math.sqrt(i*i+n*n))}(a):0;"onPointerDown"===n&&(o.initialClick=[a.offsetX,a.offsetY],o.initialHits=h.map(e=>e.eventObject)),u&&!h.length&&d<=2&&(i(a,o.interaction),s&&s(a)),l&&r(h),!function(e,t,i,n){if(e.length){let a={stopped:!1};for(let s of e){let o=h9(s.object);if(o||s.object.traverseAncestors(e=>{let t=h9(e);if(t)return o=t,!1}),o){let{raycaster:l,pointer:u,camera:h,internal:d}=o,c=new eT(u.x,u.y,0).unproject(h),p=e=>{var t,r;return null!=(t=null==(r=d.capturedMap.get(e))?void 0:r.has(s.eventObject))&&t},f=e=>{let r={intersection:s,target:t.target};d.capturedMap.has(e)?d.capturedMap.get(e).set(s.eventObject,r):d.capturedMap.set(e,new Map([[s.eventObject,r]])),t.target.setPointerCapture(e)},m=e=>{let t=d.capturedMap.get(e);t&&dg(d.capturedMap,s.eventObject,t,e)},g={};for(let e in t){let r=t[e];"function"!=typeof r&&(g[e]=r)}let v={...s,...g,pointer:u,intersections:e,stopped:a.stopped,delta:i,unprojectedPoint:c,ray:l.ray,camera:h,stopPropagation(){let i="pointerId"in t&&d.capturedMap.get(t.pointerId);(!i||i.has(s.eventObject))&&(v.stopped=a.stopped=!0,d.hovered.size&&Array.from(d.hovered.values()).find(e=>e.eventObject===s.eventObject)&&r([...e.slice(0,e.indexOf(s)),s]))},target:{hasPointerCapture:p,setPointerCapture:f,releasePointerCapture:m},currentTarget:{hasPointerCapture:p,setPointerCapture:f,releasePointerCapture:m},nativeEvent:t};if(n(v),!0===a.stopped)break}}}}(h,a,d,function(e){let t=e.eventObject,r=t.__r3f;if(!(null!=r&&r.eventCount))return;let s=r.handlers;if(l){if(s.onPointerOver||s.onPointerEnter||s.onPointerOut||s.onPointerLeave){let t=dm(e),r=o.hovered.get(t);r?r.stopped&&e.stopPropagation():(o.hovered.set(t,e),null==s.onPointerOver||s.onPointerOver(e),null==s.onPointerEnter||s.onPointerEnter(e))}null==s.onPointerMove||s.onPointerMove(e)}else{let r=s[n];r?(!u||o.initialHits.includes(t))&&(i(a,o.interaction.filter(e=>!o.initialHits.includes(e))),r(e)):u&&o.initialHits.includes(t)&&i(a,o.interaction.filter(e=>!o.initialHits.includes(e)))}})}}}}(e);return{priority:1,enabled:!0,compute(e,t,r){t.pointer.set(e.offsetX/t.size.width*2-1,-(2*(e.offsetY/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)},connected:void 0,handlers:Object.keys(d7).reduce((e,r)=>({...e,[r]:t(r)}),{}),update:()=>{var t;let{events:r,internal:i}=e.getState();null!=(t=i.lastEvent)&&t.current&&r.handlers&&r.handlers.onPointerMove(i.lastEvent.current)},connect:t=>
393{let{set:r,events:i}=e.getState();if(null==i.disconnect||i.disconnect(),r(e=>({events:{...e.events,connected:t}})),i.handlers)for(let e in i.handlers){let r=i.handlers[e],[n,a]=d7[e];t.addEventListener(n,r,{passive:a})}},disconnect:()=>{let{set:t,events:r}=e.getState();if(r.connected){if(r.handlers)for(let e in r.handlers){let t=r.handlers[e],[i]=d7[e];r.connected.removeEventListener(i,t)}t(e=>({events:{...e.events,connected:void 0}}))}}}}e.s(["B",()=>h5,"C",()=>dx,"D",()=>db,"E",()=>h8,"G",()=>dA,"a",()=>h3,"b",()=>h2,"c",()=>dq,"d",()=>dJ,"e",()=>dB,"f",()=>ce,"i",()=>h0,"o",()=>dK,"s",()=>dd,"u",()=>h4],33360),e.i(9684),e.s(["ACESFilmicToneMapping",()=>4,"AddEquation",()=>100,"AddOperation",()=>2,"AdditiveAnimationBlendMode",()=>2501,"AdditiveBlending",()=>2,"AgXToneMapping",()=>6,"AlphaFormat",()=>1021,"AlwaysCompare",()=>519,"AlwaysDepth",()=>1,"AlwaysStencilFunc",()=>519,"AmbientLight",()=>sF,"AnimationAction",()=>ov,"AnimationClip",()=>a9,"AnimationLoader",()=>so,"AnimationMixer",()=>o_,"AnimationObjectGroup",()=>og,"AnimationUtils",()=>a$,"ArcCurve",()=>nP,"ArrayCamera",()=>s2,"ArrowHelper",()=>ls,"AttachedBindMode",()=>D,"Audio",()=>ot,"AudioAnalyser",()=>oo,"AudioContext",()=>sJ,"AudioListener",()=>oe,"AudioLoader",()=>sK,"AxesHelper",()=>lo,"BackSide",()=>1,"BasicDepthPacking",()=>3200,"BasicShadowMap",()=>0,"BatchedMesh",()=>iY,"BezierInterpolant",()=>aZ,"Bone",()=>iu,"BooleanKeyframeTrack",()=>a1,"Box2",()=>oF,"Box3",()=>tU,"Box3Helper",()=>li,"BoxGeometry",()=>nx,"BoxHelper",()=>lr,"BufferAttribute",()=>t5,"BufferGeometry",()=>rg,"BufferGeometryLoader",()=>sz,"ByteType",()=>1010,"Cache",()=>a7,"Camera",()=>sT,"CameraHelper",()=>o7,"CanvasTexture",()=>ng,"CapsuleGeometry",()=>nb,"CatmullRomCurve3",()=>nk,"CineonToneMapping",()=>3,"CircleGeometry",()=>nS,"ClampToEdgeWrapping",()=>1001,"Clock",()=>oN,"Color",()=>ty,"ColorKeyframeTrack",()=>a2,"ColorManagement",()=>eN,"Compatibility",()=>X,"CompressedArrayTexture",()=>np,"CompressedCubeTexture",()=>nf,"CompressedTexture",()=>nc,"CompressedTextureLoader",()=>sl,"ConeGeometry",()=>nA,"ConstantAlphaFactor",()=>213,"ConstantColorFactor",()=>211,"Controls",()=>lu,"CubeCamera",()=>s1,"CubeDepthTexture",()=>ny,"CubeReflectionMapping",()=>301,"CubeRefractionMapping",()=>302,"CubeTexture",()=>nm,"CubeTextureLoader",()=>sd,"CubeUVReflectionMapping",()=>306,"CubicBezierCurve",()=>nW,"CubicBezierCurve3",()=>nj,"CubicInterpolant",()=>aK,"CullFaceBack",()=>1,"CullFaceFront",()=>2,"CullFaceFrontBack",()=>3,"CullFaceNone",()=>0,"Curve",()=>nB,"CurvePath",()=>nQ,"CustomBlending",()=>5,"CustomToneMapping",()=>5,"CylinderGeometry",()=>nT,"Cylindrical",()=>oB,"Data3DTexture",()=>ej,"DataArrayTexture",()=>eH,"DataTexture",()=>ih,"DataTextureLoader",()=>sc,"DataUtils",()=>t1,"DecrementStencilOp",()=>7683,"DecrementWrapStencilOp",()=>34056,"DefaultLoadingManager",()=>sr,"DepthFormat",()=>1026,"DepthStencilFormat",()=>1027,"DepthTexture",()=>nv,"DetachedBindMode",()=>U,"DirectionalLight",()=>sP,"DirectionalLightHelper",()=>o8,"DiscreteInterpolant",()=>aQ,"DodecahedronGeometry",()=>nE,"DoubleSide",()=>2,"DstAlphaFactor",()=>206,"DstColorFactor",()=>208,"DynamicCopyUsage",()=>35050,"DynamicDrawUsage",()=>35048,"DynamicReadUsage",()=>35049,"EdgesGeometry",()=>nL,"EllipseCurve",()=>nI,"EqualCompare",()=>514,"EqualDepth",()=>4,"EqualStencilFunc",()=>514,"EquirectangularReflectionMapping",()=>303,"EquirectangularRefractionMapping",()=>304,"Euler",()=>e3,"EventDispatcher",()=>eu,"ExternalTexture",()=>n_,"ExtrudeGeometry",()=>ad,"FileLoader",()=>ss,"Float16BufferAttribute",()=>ri,"Float32BufferAttribute",()=>rn,"FloatType",()=>1015,"Fog",()=>tb,"FogExp2",()=>tx,"FramebufferTexture",()=>nd,"FrontSide",()=>0,"Frustum",()=>iL,"FrustumArray",()=>iP,"GLBufferAttribute",()=>oM,"GLSL1",()=>"100","GLSL3",()=>z,"GreaterCompare",()=>516,"GreaterDepth",()=>6,"GreaterEqualCompare",()=>518,"GreaterEqualDepth",()=>5,"GreaterEqualStencilFunc",()=>518,"GreaterStencilFunc",()=>516,"GridHelper",()=>o1,"Group",()=>td,"HalfFloatType",()=>1016,"HemisphereLight",()=>sm,"HemisphereLightHelper",()=>o0,"IcosahedronGeometry",()=>ap,"ImageBitmapLoader",()=>s$,"ImageLoader",()=>sh,"ImageUtils",()=>eI,"IncrementStencilOp",()=>7682,"IncrementWrapStencilOp",()=>34055,"InstancedBufferAttribute",()=>im,"InstancedBufferGeometry",()=>sV,"InstancedInterleavedBuffer",()=>oA,"InstancedMesh",()=>iT,"Int16BufferAttribute",()=>t7,"Int32BufferAttribute",()=>rt,"Int8BufferAttribute",()=>t8,"IntType",()=>1013,"InterleavedBuffer",()=>rv,"InterleavedBufferAttribute",()=>r_,"Interpolant",()=>aJ,"InterpolateBezier",()=>2303,"InterpolateDiscrete",()=>2300,"InterpolateLinear",()=>2301,"InterpolateSmooth",()=>2302,"InterpolationSamplingMode",()=>j,"InterpolationSamplingType",()=>W,"InvertStencilOp",()=>5386,"KeepStencilOp",()=>7680,"KeyframeTrack",()=>a0,"LOD",()=>rG,"LatheGeometry",()=>af,"Layers",()=>e4,"LessCompare",()=>513,"LessDepth",()=>2,"LessEqualCompare",()=>515,"LessEqualDepth",()=>3,"LessEqualStencilFunc",()=>515,"LessStencilFunc",()=>513,"Light",()=>sf,"LightProbe",()=>sO,"Line",()=>i8,"Line3",()=>oH,"LineBasicMaterial",()=>iQ,"LineCurve",()=>nX,"LineCurve3",()=>nq,"LineDashedMaterial",()=>aH,"LineLoop",()=>nt,"LineSegments",()=>ne,"LinearFilter",()=>1006,"LinearInterpolant",()=>aY,"LinearMipMapLinearFilter",()=>1008,"LinearMipMapNearestFilter",()=>1007,"LinearMipmapLinearFilter",()=>1008,"LinearMipmapNearestFilter",()=>1007,"LinearSRGBColorSpace",()=>G,"LinearToneMapping",()=>1,"LinearTransfer",()=>k,"Loader",()=>si,"LoaderUtils",()=>sk,"LoadingManager",()=>st,"LoopOnce",()=>2200,"LoopPingPong",()=>2202,"LoopRepeat",()=>2201,"MOUSE",()=>P,"Material",()=>rb,"MaterialBlending",()=>6,"MaterialLoader",()=>sG,"MathUtils",()=>ex,"Matrix2",()=>oI,"Matrix3",()=>eE,"Matrix4",()=>
393eq,"MaxEquation",()=>104,"Mesh",()=>r8,"MeshBasicMaterial",()=>r$,"MeshDepthMaterial",()=>ak,"MeshDistanceMaterial",()=>aV,"MeshLambertMaterial",()=>aG,"MeshMatcapMaterial",()=>az,"MeshNormalMaterial",()=>aO,"MeshPhongMaterial",()=>aD,"MeshPhysicalMaterial",()=>aF,"MeshStandardMaterial",()=>aP,"MeshToonMaterial",()=>aU,"MinEquation",()=>103,"MirroredRepeatWrapping",()=>1002,"MixOperation",()=>1,"MultiplyBlending",()=>4,"MultiplyOperation",()=>0,"NearestFilter",()=>1003,"NearestMipMapLinearFilter",()=>1005,"NearestMipMapNearestFilter",()=>1004,"NearestMipmapLinearFilter",()=>1005,"NearestMipmapNearestFilter",()=>1004,"NeutralToneMapping",()=>7,"NeverCompare",()=>512,"NeverDepth",()=>0,"NeverStencilFunc",()=>512,"NoBlending",()=>0,"NoColorSpace",()=>"","NoNormalPacking",()=>"","NoToneMapping",()=>0,"NormalAnimationBlendMode",()=>2500,"NormalBlending",()=>1,"NormalGAPacking",()=>"ga","NormalRGPacking",()=>"rg","NotEqualCompare",()=>517,"NotEqualDepth",()=>7,"NotEqualStencilFunc",()=>517,"NumberKeyframeTrack",()=>a3,"Object3D",()=>th,"ObjectLoader",()=>sH,"ObjectSpaceNormalMap",()=>1,"OctahedronGeometry",()=>am,"OneFactor",()=>201,"OneMinusConstantAlphaFactor",()=>214,"OneMinusConstantColorFactor",()=>212,"OneMinusDstAlphaFactor",()=>207,"OneMinusDstColorFactor",()=>209,"OneMinusSrcAlphaFactor",()=>205,"OneMinusSrcColorFactor",()=>203,"OrthographicCamera",()=>sB,"PCFShadowMap",()=>1,"PCFSoftShadowMap",()=>2,"PMREMGenerator",()=>lI,"Path",()=>nZ,"PerspectiveCamera",()=>sC,"Plane",()=>iC,"PlaneGeometry",()=>ag,"PlaneHelper",()=>ln,"PointLight",()=>sL,"PointLightHelper",()=>oK,"Points",()=>no,"PointsMaterial",()=>nr,"PolarGridHelper",()=>o2,"PolyhedronGeometry",()=>nM,"PositionalAudio",()=>os,"PropertyBinding",()=>om,"PropertyMixer",()=>ol,"QuadraticBezierCurve",()=>n$,"QuadraticBezierCurve3",()=>nJ,"Quaternion",()=>eS,"QuaternionKeyframeTrack",()=>a5,"QuaternionLinearInterpolant",()=>a4,"R11_EAC_Format",()=>37488,"RED_GREEN_RGTC2_Format",()=>36285,"RED_RGTC1_Format",()=>36283,"REVISION",()=>"183","RG11_EAC_Format",()=>37490,"RGBADepthPacking",()=>3201,"RGBAFormat",()=>1023,"RGBAIntegerFormat",()=>1033,"RGBA_ASTC_10x10_Format",()=>37819,"RGBA_ASTC_10x5_Format",()=>37816,"RGBA_ASTC_10x6_Format",()=>37817,"RGBA_ASTC_10x8_Format",()=>37818,"RGBA_ASTC_12x10_Format",()=>37820,"RGBA_ASTC_12x12_Format",()=>37821,"RGBA_ASTC_4x4_Format",()=>37808,"RGBA_ASTC_5x4_Format",()=>37809,"RGBA_ASTC_5x5_Format",()=>37810,"RGBA_ASTC_6x5_Format",()=>37811,"RGBA_ASTC_6x6_Format",()=>37812,"RGBA_ASTC_8x5_Format",()=>37813,"RGBA_ASTC_8x6_Format",()=>37814,"RGBA_ASTC_8x8_Format",()=>37815,"RGBA_BPTC_Format",()=>36492,"RGBA_ETC2_EAC_Format",()=>37496,"RGBA_PVRTC_2BPPV1_Format",()=>35843,"RGBA_PVRTC_4BPPV1_Format",()=>35842,"RGBA_S3TC_DXT1_Format",()=>33777,"RGBA_S3TC_DXT3_Format",()=>33778,"RGBA_S3TC_DXT5_Format",()=>33779,"RGBDepthPacking",()=>3202,"RGBFormat",()=>1022,"RGBIntegerFormat",()=>1032,"RGB_BPTC_SIGNED_Format",()=>36494,"RGB_BPTC_UNSIGNED_Format",()=>36495,"RGB_ETC1_Format",()=>36196,"RGB_ETC2_Format",()=>37492,"RGB_PVRTC_2BPPV1_Format",()=>35841,"RGB_PVRTC_4BPPV1_Format",()=>35840,"RGB_S3TC_DXT1_Format",()=>33776,"RGDepthPacking",()=>3203,"RGFormat",()=>1030,"RGIntegerFormat",()=>1031,"RawShaderMaterial",()=>aI,"Ray",()=>rq,"Raycaster",()=>oC,"RectAreaLight",()=>sD,"RedFormat",()=>1028,"RedIntegerFormat",()=>1029,"ReinhardToneMapping",()=>2,"RenderTarget",()=>eV,"RenderTarget3D",()=>ox,"RepeatWrapping",()=>1e3,"ReplaceStencilOp",()=>7681,"ReverseSubtractEquation",()=>102,"RingGeometry",()=>av,"SIGNED_R11_EAC_Format",()=>37489,"SIGNED_RED_GREEN_RGTC2_Format",()=>36286,"SIGNED_RED_RGTC1_Format",()=>36284,"SIGNED_RG11_EAC_Format",()=>37491,"SRGBColorSpace",()=>O,"SRGBTransfer",()=>V,"Scene",()=>tS,"ShaderChunk",()=>lf,"ShaderLib",()=>lg,"ShaderMaterial",()=>aB,"ShadowMaterial",()=>aC,"Shape",()=>n0,"ShapeGeometry",()=>ay,"ShapePath",()=>ll,"ShapeUtils",()=>al,"ShortType",()=>1011,"Skeleton",()=>ip,"SkeletonHelper",()=>oJ,"SkinnedMesh",()=>il,"Source",()=>eF,"Sphere",()=>rl,"SphereGeometry",()=>a_,"Spherical",()=>oL,"SphericalHarmonics3",()=>sU,"SplineCurve",()=>nK,"SpotLight",()=>sR,"SpotLightHelper",()=>oj,"Sprite",()=>rF,"SpriteMaterial",()=>rS,"SrcAlphaFactor",()=>204,"SrcAlphaSaturateFactor",()=>210,"SrcColorFactor",()=>202,"StaticCopyUsage",()=>35046,"StaticDrawUsage",()=>35044,"StaticReadUsage",()=>35045,"StereoCamera",()=>s0,"StreamCopyUsage",()=>35042,"StreamDrawUsage",()=>35040,"StreamReadUsage",()=>35041,"StringKeyframeTrack",()=>a8,"SubtractEquation",()=>101,"SubtractiveBlending",()=>3,"TOUCH",()=>F,"TangentSpaceNormalMap",()=>0,"TetrahedronGeometry",()=>ax,"Texture",()=>eG,"TextureLoader",()=>sp,"TextureUtils",()=>ld,"Timer",()=>s3,"TimestampQuery",()=>H,"TorusGeometry",()=>ab,"TorusKnotGeometry",()=>aS,"Triangle",()=>tD,"TriangleFanDrawMode",()=>2,"TriangleStripDrawMode",()=>1,"TrianglesDrawMode",()=>0,"TubeGeometry",()=>aT,"UVMapping",()=>300,"Uint16BufferAttribute",()=>re,"Uint32BufferAttribute",()=>rr,"Uint8BufferAttribute",()=>t6,"Uint8ClampedBufferAttribute",()=>t9,"Uniform",()=>ob,"UniformsGroup",()=>oT,"UniformsLib",()=>lm,"UniformsUtils",()=>aL,"UnsignedByteType",()=>1009,"UnsignedInt101111Type",()=>35899,"UnsignedInt248Type",()=>1020,"UnsignedInt5999Type",()=>35902,"UnsignedIntType",()=>1014,"UnsignedShort4444Type",()=>1017,"UnsignedShort5551Type",()=>1018,"UnsignedShortType",()=>1012,"VSMShadowMap",()=>3,"Vector2",()=>eb,"Vector3",()=>eT,"Vector4",()=>ek,"VectorKeyframeTrack",()=>a6,"VideoFrameTexture",()=>nh,"VideoTexture",()=>nu,"WebGL3DRenderTarget",()=>eX,"WebGLArrayRenderTarget",()=>eW,"WebGLCoordinateSystem",()=>
3932e3,"WebGLCubeRenderTarget",()=>lG,"WebGLRenderTarget",()=>ez,"WebGLRenderer",()=>hF,"WebGLUtils",()=>hA,"WebGPUCoordinateSystem",()=>2001,"WebXRController",()=>tp,"WireframeGeometry",()=>aA,"WrapAroundEnding",()=>2402,"ZeroCurvatureEnding",()=>2400,"ZeroFactor",()=>200,"ZeroSlopeEnding",()=>2401,"ZeroStencilOp",()=>0,"createCanvasElement",()=>Y,"error",()=>ea,"getConsoleFunction",()=>et,"log",()=>er,"setConsoleFunction",()=>ee,"warn",()=>en,"warnOnce",()=>es],92439);var ct=e.i(92439);function cr(e,t){let r;return(...i)=>{window.clearTimeout(r),r=window.setTimeout(()=>e(...i),t)}}let ci=["x","y","top","bottom","left","right","width","height"];function cn({ref:e,children:t,fallback:r,resize:i,style:n,gl:a,events:s=ce,eventSource:o,eventPrefix:l,shadows:u,linear:h,flat:d,legacy:c,orthographic:p,frameloop:f,dpr:m,performance:g,raycaster:v,camera:y,scene:_,onPointerMissed:x,onCreated:b,...S}){I.useMemo(()=>dB(ct),[]);let T=h4(),[A,M]=function({debounce:e,scroll:t,polyfill:r,offsetSize:i}={debounce:0,scroll:!1,offsetSize:!1}){var n,a,s;let o=r||("u"<typeof window?class{}:window.ResizeObserver);if(!o)throw Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let[l,u]=(0,I.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),h=(0,I.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:l,orientationHandler:null}),d=e?"number"==typeof e?e:e.scroll:null,c=e?"number"==typeof e?e:e.resize:null,p=(0,I.useRef)(!1);(0,I.useEffect)(()=>(p.current=!0,()=>void(p.current=!1)));let[f,m,g]=(0,I.useMemo)(()=>{let e=()=>{let e,t;if(!h.current.element)return;let{left:r,top:n,width:a,height:s,bottom:o,right:l,x:d,y:c}=h.current.element.getBoundingClientRect(),f={left:r,top:n,width:a,height:s,bottom:o,right:l,x:d,y:c};h.current.element instanceof HTMLElement&&i&&(f.height=h.current.element.offsetHeight,f.width=h.current.element.offsetWidth),Object.freeze(f),p.current&&(e=h.current.lastBounds,t=f,!ci.every(r=>e[r]===t[r]))&&u(h.current.lastBounds=f)};return[e,c?cr(e,c):e,d?cr(e,d):e]},[u,i,d,c]);function v(){h.current.scrollContainers&&(h.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",g,!0)),h.current.scrollContainers=null),h.current.resizeObserver&&(h.current.resizeObserver.disconnect(),h.current.resizeObserver=null),h.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",h.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",h.current.orientationHandler))}function y(){h.current.element&&(h.current.resizeObserver=new o(g),h.current.resizeObserver.observe(h.current.element),t&&h.current.scrollContainers&&h.current.scrollContainers.forEach(e=>e.addEventListener("scroll",g,{capture:!0,passive:!0})),h.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",h.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",h.current.orientationHandler))}return n=g,a=!!t,(0,I.useEffect)(()=>{if(a)return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)},[n,a]),s=m,(0,I.useEffect)(()=>(window.addEventListener("resize",s),()=>void window.removeEventListener("resize",s)),[s]),(0,I.useEffect)(()=>{v(),y()},[t,g,m]),(0,I.useEffect)(()=>v,[]),[e=>{e&&e!==h.current.element&&(v(),h.current.element=e,h.current.scrollContainers=function e(t){let r=[];if(!t||t===document.body)return r;let{overflow:i,overflowX:n,overflowY:a}=window.getComputedStyle(t);return[i,n,a].some(e=>"auto"===e||"scroll"===e)&&r.push(t),[...r,...e(t.parentElement)]}(e),y())},l,f]}({scroll:!0,debounce:{scroll:50,resize:0},...i}),E=I.useRef(null),C=I.useRef(null);I.useImperativeHandle(e,()=>E.current);let w=h3(x),[R,N]=I.useState(!1),[B,P]=I.useState(!1);if(R)throw R;if(B)throw B;let F=I.useRef(null);h2(()=>{let e=E.current;M.width>0&&M.height>0&&e&&(F.current||(F.current=dq(e)),async function(){await F.current.configure({gl:a,scene:_,events:s,shadows:u,linear:h,flat:d,legacy:c,orthographic:p,frameloop:f,dpr:m,performance:g,raycaster:v,camera:y,size:M,onPointerMissed:(...e)=>
393null==w.current?void 0:w.current(...e),onCreated:e=>{null==e.events.connect||e.events.connect(o?h0(o)?o.current:o:C.current),l&&e.setEvents({compute:(e,t)=>{let r=e[l+"X"],i=e[l+"Y"];t.pointer.set(r/t.size.width*2-1,-(2*(i/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),null==b||b(e)}}),F.current.render((0,L.jsx)(T,{children:(0,L.jsx)(h8,{set:P,children:(0,L.jsx)(I.Suspense,{fallback:(0,L.jsx)(h5,{set:N}),children:null!=t?t:null})})}))}())}),I.useEffect(()=>{let e=E.current;if(e)return()=>dJ(e)},[]);let D=o?"none":"auto";return(0,L.jsx)("div",{ref:C,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:D,...n},...S,children:(0,L.jsx)("div",{ref:A,style:{width:"100%",height:"100%"},children:(0,L.jsx)("canvas",{ref:E,style:{display:"block"},children:r})})})}function ca(e){return(0,L.jsx)(hJ,{children:(0,L.jsx)(cn,{...e})})}e.s(["extend",()=>dB],47380);let cs=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","aoMapIntensity","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveIntensity","emissiveMap","envMap","envMapIntensity","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","lightMapIntensity","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"],co=new WeakMap;class cl{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=!0===e.object.isSkinnedMesh,this.refreshUniforms=cs,this.renderId=0}firstInitialization(e){return!1===this.renderObjects.has(e)&&(this.getRenderObjectData(e),!0)}needsVelocity(e){let t=e.getMRT();return null!==t&&t.has("velocity")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(void 0===t){let{geometry:r,material:i,object:n}=e;if(t={material:this.getMaterialData(i),geometry:{id:r.id,attributes:this.getAttributesData(r.attributes),indexId:r.index?r.index.id:null,indexVersion:r.index?r.index.version:null,drawRange:{start:r.drawRange.start,count:r.drawRange.count}},worldMatrix:n.matrixWorld.clone()},n.center&&(t.center=n.center.clone()),n.morphTargetInfluences&&(t.morphTargetInfluences=n.morphTargetInfluences.slice()),null!==e.bundle&&(t.version=e.bundle.version),t.material.transmission>0){let{width:r,height:i}=e.context;t.bufferWidth=r,t.bufferHeight=i}t.lights=this.getLightsData(e.lightsNode.getLights()),this.renderObjects.set(e,t)}return t}getAttributesData(e){let t={};for(let r in e){let i=e[r];t[r]={id:i.id,version:i.version}}return t}containsNode(e){let t=e.material;for(let e in t)if(t[e]&&t[e].isNode)return!0;return!!e.context.modelViewMatrix||!!e.context.modelNormalViewMatrix||!!e.context.getAO||!!e.context.getShadow}getMaterialData(e){let t={};for(let r of this.refreshUniforms){let i=e[r];null!=i&&("object"==typeof i&&void 0!==i.clone?!0===i.isTexture?t[r]={id:i.id,version:i.version}:t[r]=i.clone():t[r]=i)}return t}equals(e,t){let{object:r,material:i,geometry:n}=e,a=this.getRenderObjectData(e);if(!0!==a.worldMatrix.equals(r.matrixWorld))return a.worldMatrix.copy(r.matrixWorld),!1;let s=a.material;for(let e in s){let t=s[e],r=i[e];if(void 0!==t.equals){if(!1===t.equals(r))return t.copy(r),!1}else if(!0===r.isTexture){if(t.id!==r.id||t.version!==r.version)return t.id=r.id,t.version=r.version,!1}else if(t!==r)return s[e]=r,!1}if(s.transmission>0){let{width:t,height:r}=e.context;if(a.bufferWidth!==t||a.bufferHeight!==r)return a.bufferWidth=t,a.bufferHeight=r,!1}let o=a.geometry,l=n.attributes,u=o.attributes,h=Object.keys(u),d=Object.keys(l);if(o.id!==n.id)return o.id=n.id,!1;if(h.length!==d.length)return a.geometry.attributes=this.getAttributesData(l),!1;for(let e of h){let t=u[e],r=l[e];if(void 0===r)return delete u[e],!1;if(t.id!==r.id||t.version!==r.version)return t.id=r.id,t.version=r.version,!1}let c=n.index,p=o.indexId,f=o.indexVersion,m=c?c.id:null,g=c?c.version:null;if(p!==m||f!==g)return o.indexId=m,o.indexVersion=g,!1;if(o.drawRange.start!==n.drawRange.start||o.drawRange.count!==n.drawRange.count)return o.drawRange.start=n.drawRange.start,o.drawRange.count=n.drawRange.count,!1;if(a.morphTargetInfluences){let e=!1;for(let t=0;t<a.morphTargetInfluences.length;t++)a.morphTargetInfluences[t]!==r.morphTargetInfluences[t]&&(a.morphTargetInfluences[t]=r.morphTargetInfluences[t],e=!0);if(e)return!1}if(a.lights){for(let e=0;e<t.length;e++)if(a.lights[e].map!==t[e].map)return!1}return a.center&&!1===a.center.equals(r.center)?a.center.copy(r.center):null!==e.bundle&&(a.version=e.bundle.version),!0}getLightsData(e){let t=[];
393for(let r of e)!0===r.isSpotLight&&null!==r.map&&t.push({map:r.map.version});return t}getLights(e,t){if(co.has(e)){let r=co.get(e);if(r.renderId===t)return r.lightsData}let r=this.getLightsData(e.getLights());return co.set(e,{renderId:t,lightsData:r}),r}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;let{renderId:r}=t;if(this.renderId!==r)return this.renderId=r,!0;let i=!0===e.object.static,n=null!==e.bundle&&!0===e.bundle.static&&this.getRenderObjectData(e).version===e.bundle.version;if(i||n)return!1;let a=this.getLights(e.lightsNode,r);return!0!==this.equals(e,a)}}let cu=[/^StackTrace\.js$/,/^TSLCore\.js$/,/^.*Node\.js$/,/^three\.webgpu.*\.js$/];class ch{constructor(e=null){this.isStackTrace=!0,this.stack=function(e){let t=/(?:at\s+(.+?)\s+\()?(?:(.+?)@)?([^@\s()]+):(\d+):(\d+)/;return e.split("\n").map(e=>{let r=e.match(t);if(!r)return null;let i=r[1]||r[2]||"",n=r[3].split("?")[0],a=parseInt(r[4],10),s=parseInt(r[5],10);return{fn:i,file:n.split("/").pop(),line:a,column:s}}).filter(e=>e&&!cu.some(t=>t.test(e.file)))}(e||Error().stack)}getLocation(){if(0===this.stack.length)return"[Unknown location]";let e=this.stack[0],t=e.fn,r=t?`"${t}()" at `:"";return`${r}"${e.file}:${e.line}"`}getError(e){if(0===this.stack.length)return e;let t=this.stack.map(e=>{let t=`${e.file}:${e.line}:${e.column}`;return e.fn?` at ${e.fn} (${t})`:` at ${t}`}).join("\n");return`${e} 394${t}`}}function cd(e,t=0){let r=0xdeadbeef^t,i=0x41c6ce57^t;if(e instanceof Array)for(let t=0,n;t<e.length;t++)r=Math.imul(r^(n=e[t]),0x9e3779b1),i=Math.imul(i^n,0x5f356495);else for(let t=0,n;t<e.length;t++)r=Math.imul(r^(n=e.charCodeAt(t)),0x9e3779b1),i=Math.imul(i^n,0x5f356495);return r=Math.imul(r^r>>>16,0x85ebca6b)^Math.imul(i^i>>>13,0xc2b2ae35),0x100000000*(2097151&(i=Math.imul(i^i>>>16,0x85ebca6b)^Math.imul(r^r>>>13,0xc2b2ae35)))+(r>>>0)}let cc=e=>cd(e),cp=e=>cd(e),cf=(...e)=>cd(e),cm=new Map([[1,"float"],[2,"vec2"],[3,"vec3"],[4,"vec4"],[9,"mat3"],[16,"mat4"]]),cg=new WeakMap;function cv(e){return cm.get(e)}function cy(e){if(/[iu]?vec\d/.test(e))return e.startsWith("ivec")?Int32Array:e.startsWith("uvec")?Uint32Array:Float32Array;if(/mat\d/.test(e)||/float/.test(e))return Float32Array;if(/uint/.test(e))return Uint32Array;if(/int/.test(e))return Int32Array;throw Error(`THREE.NodeUtils: Unsupported type: ${e}`)}function c_(e){return/float|int|uint/.test(e)?1:/vec2/.test(e)?2:/vec3/.test(e)?3:/vec4/.test(e)||/mat2/.test(e)?4:/mat3/.test(e)?9:/mat4/.test(e)?16:void ea(`TSL: Unsupported type: ${e}`,new ch)}function cx(e){return/float|int|uint/.test(e)?1:/vec2/.test(e)?2:/vec3/.test(e)?3:/vec4/.test(e)||/mat2/.test(e)?4:/mat3/.test(e)?12:/mat4/.test(e)?16:void ea(`TSL: Unsupported type: ${e}`,new ch)}function cb(e){return/float|int|uint/.test(e)?4:/vec2/.test(e)?8:/vec3/.test(e)||/vec4/.test(e)?16:/mat2/.test(e)?8:/mat3/.test(e)||/mat4/.test(e)?16:void ea(`TSL: Unsupported type: ${e}`,new ch)}function cS(e){if(null==e)return null;let t=typeof e;if(!0===e.isNode)return"node";if("number"===t)return"float";if("boolean"===t)return"bool";if("string"===t)return"string";if("function"===t)return"shader";else if(!0===e.isVector2)return"vec2";else if(!0===e.isVector3)return"vec3";else if(!0===e.isVector4)return"vec4";else if(!0===e.isMatrix2)return"mat2";else if(!0===e.isMatrix3)return"mat3";else if(!0===e.isMatrix4)return"mat4";else if(!0===e.isColor)return"color";else if(e instanceof ArrayBuffer)return"ArrayBuffer";return null}function cT(e,...t){let r=e?e.slice(-4):void 0;if(1===t.length&&("vec2"===r?t=[t[0],t[0]]:"vec3"===r?t=[t[0],t[0],t[0]]:"vec4"===r&&(t=[t[0],t[0],t[0],t[0]])),"color"===e)return new ty(...t);if("vec2"===r)return new eb(...t);if("vec3"===r)return new eT(...t);if("vec4"===r)return new ek(...t);if("mat2"===r)return new oI(...t);else if("mat3"===r)return new eE(...t);else if("mat4"===r)return new eq(...t);else if("bool"===e)return t[0]||!1;else if("float"===e||"int"===e||"uint"===e)return t[0]||0;else if("string"===e)return t[0]||"";else if("ArrayBuffer"===e)return cE(t[0]);return null}function cA(e){let t=cg.get(e);return void 0===t&&(t={},cg.set(e,t)),t}function cM(e){let t="",r=new Uint8Array(e);for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return btoa(t)}function cE(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0)).buffer}var cC=Object.freeze({__proto__:null,arrayBufferToBase64:cM,base64ToArrayBuffer:cE,getAlignmentFromType:cb,getDataFromObject:cA,getLengthFromType:c_,getMemoryLengthFromType:cx,getTypeFromLength:cv,getTypedArrayFromType:cy,getValueFromType:cT,getValueType:cS,hash:cf,hashArray:cp,hashString:cc});let cw={VERTEX:"vertex",FRAGMENT:"fragment"},cR={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},cN={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},cL={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},cB=["fragment","vertex"],cI=["setup","analyze","generate"],cP=[...cB,"compute"],cF=["x","y","z","w"],cD={analyze:"setup",generate:"analyze"},cU=0;class cO extends eu{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=cR.NONE,this.updateBeforeType=cR.NONE,this.updateAfterType=cR.NONE,this.uuid=ex.generateUUID(),this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:cU++}),this.stackTrace=null,!0===cO.captureStackTrace&&(this.stackTrace=new ch)}set needsUpdate(e){!0===e&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this),this}onFrameUpdate(e){return this.onUpdate(e,cR.FRAME)}
394onRenderUpdate(e){return this.onUpdate(e,cR.RENDER)}onObjectUpdate(e){return this.onUpdate(e,cR.OBJECT)}onReference(e){return this.updateReference=e.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:e}of this._getChildren())yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){for(let t of(e(this),this.getChildren()))t.traverse(e)}_getChildren(e=new Set){let t=[];for(let r of(e.add(this),Object.getOwnPropertyNames(this))){let i=this[r];if(!(!0===r.startsWith("_")||e.has(i))){if(!0===Array.isArray(i))for(let e=0;e<i.length;e++){let n=i[e];n&&!0===n.isNode&&t.push({property:r,index:e,childNode:n})}else if(i&&!0===i.isNode)t.push({property:r,childNode:i});else if(i&&Object.getPrototypeOf(i)===Object.prototype)for(let e in i){if(!0===e.startsWith("_"))continue;let n=i[e];n&&!0===n.isNode&&t.push({property:r,index:e,childNode:n})}}}return t}getCacheKey(e=!1,t=null){if(!0===(e=e||this.version!==this._cacheKeyVersion)||null===this._cacheKey){null===t&&(t=new Set);let r=[];for(let{property:i,childNode:n}of this._getChildren(t))r.push(cc(i.slice(0,-4)),n.getCacheKey(e,t));this._cacheKey=cf(cp(r),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){let t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return"void"}getNodeType(e){let t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){let t=this.getHash(e);return e.getNodeFromHash(t)||this}getArrayCount(){return null}setup(e){let t=e.getNodeProperties(this),r=0;for(let e of this.getChildren())t["node"+r++]=e;return t.outputNode||null}analyze(e,t=null){let r=e.increaseUsage(this);if(!0===this.parents){let r=e.getDataFromNode(this,"any");r.stages=r.stages||{},r.stages[e.shaderStage]=r.stages[e.shaderStage]||[],r.stages[e.shaderStage].push(t)}if(1===r)for(let t of Object.values(e.getNodeProperties(this)))t&&!0===t.isNode&&t.build(e,this)}generate(e,t){let{outputNode:r}=e.getNodeProperties(this);if(r&&!0===r.isNode)return r.build(e,t)}updateBefore(){en("Abstract function.")}updateAfter(){en("Abstract function.")}update(){en("Abstract function.")}before(e){return null===this._beforeNodes&&(this._beforeNodes=[]),this._beforeNodes.push(e),this}build(e,t=null){let r=this.getShared(e);if(this!==r)return r.build(e,t);if(null!==this._beforeNodes){let r=this._beforeNodes;for(let i of(this._beforeNodes=null,r))i.build(e,t);this._beforeNodes=r}let i=e.getDataFromNode(this);i.buildStages=i.buildStages||{},i.buildStages[e.buildStage]=!0;let n=cD[e.buildStage];if(n&&!0!==i.buildStages[n]){let t=e.getBuildStage();e.setBuildStage(n),this.build(e),e.setBuildStage(t)}e.addChain(this);let a=null,s=e.getBuildStage();if("setup"===s){e.addNode(this),this.updateReference(e);let t=e.getNodeProperties(this);if(!0!==t.initialized){for(let r of(t.initialized=!0,t.outputNode=this.setup(e)||t.outputNode||null,Object.values(t)))if(r&&!0===r.isNode){if(!0===r.parents){let t=e.getNodeProperties(r);t.parents=t.parents||[],t.parents.push(this)}r.build(e)}e.addSequentialNode(this)}a=t.outputNode}else if("analyze"===s)this.analyze(e,t);else if("generate"===s){if(this.generate.length<2){let r=this.getNodeType(e),i=e.getDataFromNode(this);void 0===(a=i.snippet)?void 0===i.generated?(i.generated=!0,i.snippet=a=this.generate(e)||""):(en("Node: Recursion detected.",this),a="/* Recursion detected. */"):void 0!==i.flowCodes&&void 0!==e.context.nodeBlock&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),a=e.format(a,r,t)}else a=this.generate(e,t)||"";""===a&&null!==t&&"void"!==t&&"OutputType"!==t&&(ea(`TSL: Invalid generated code, expected a "${t}".`),a=e.generateConst(t))}return e.removeChain(this),a}getSerializeChildren(){return this._getChildren()}serialize(e){let t=this.getSerializeChildren(),r={};for(let{property:i,index:n,childNode:a}of t)void 0!==n?(void 0===r[i]&&(r[i]=Number.isInteger(n)?[]:{}),r[i][n]=a.toJSON(e.meta).uuid):r[i]=a.toJSON(e.meta).uuid;Object.keys(r).length>0&&(e.inputNodes=r)}deserialize(e){if(void 0!==e.inputNodes){let t=e.meta.nodes;for(let r in e.inputNodes)if(Array.isArray(e.inputNodes[r])){let i=[];for(let n of e.inputNodes[r])i.push(t[n]);this[r]=i}else if("object"==typeof e.inputNodes[r]){let i={};for(let n in e.inputNodes[r]){let a=e.inputNodes[r][n];i[n]=t[a]}this[r]=i}else{let i=e.inputNodes[r];this[r]=t[i]}}}toJSON(e){let{uuid:t,type:r}=this,i=void 0===e||"string"==typeof e;i&&(e={textures:{},images:{},nodes:{}});let n=e.nodes[t];function a(e){let t=[];for(let r in e){let i=e[r];delete i.metadata,t.push(i)}return t}if(void 0===n&&(n={uuid:t,type:r,meta:e,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},!0!==i&&(e.nodes[n.uuid]=n),this.serialize(n),delete n.meta),i){let t=a(e.textures),r=a(e.images),i=a(e.nodes);t.length>0&&(n.textures=t),r.length>0&&(n.images=r),i.length>0&&(n.nodes=i)}return n}}cO.captureStackTrace=!1;class cG extends cO{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){let t=this.indexNode.getNodeType(e),r=this.node.build(e),i=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${r}[ ${i} ]`}}class ck extends cO{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){let t=this.node.getNodeType(e),r=null;for(let i of this.convertTo.split("|"))(null===r||e.getTypeLength(t)===e.getTypeLength(i))&&(r=i);return r}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let r=this.node,i=this.getNodeType(e),n=r.build(e,i);return e.format(n,i,t)}}class cV extends cO{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if("generate"===e.getBuildStage()){let r=e.getVectorType(this.getNodeType(e,t)),i=e.getDataFromNode(this);if(void 0!==i.propertyName)return e.format(i.propertyName,r,t);if("void"!==r&&"void"!==t&&this.hasDependencies(e)){let n=super.build(e,r),a=e.getVarFromNode(this,null,r),s=e.getPropertyName(a);return e.addLineFlowCode(`${s} = ${n}`,this),i.snippet=n,i.propertyName=s,e.format(i.propertyName,r,t)}}return super.build(e,t)}}class cz extends cV{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}
394getNodeType(e){return null!==this.nodeType?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,r)=>t+e.getTypeLength(r.getNodeType(e)),0))}generate(e,t){let r=this.getNodeType(e),i=e.getTypeLength(r),n=this.nodes,a=e.getComponentType(r),s=[],o=0;for(let t of n){let n;if(o>=i){ea(`TSL: Length of parameters exceeds maximum length of function '${r}()' type.`,this.stackTrace);break}let l=t.getNodeType(e),u=e.getTypeLength(l);if(o+u>i&&(ea(`TSL: Length of '${r}()' data exceeds maximum length of output type.`,this.stackTrace),u=i-o,l=e.getTypeFromLength(u)),o+=u,n=t.build(e,l),e.getComponentType(l)!==a){let t=e.getTypeFromLength(u,a);n=e.format(n,l,t)}s.push(n)}let l=`${e.getType(r)}( ${s.join(", ")} )`;return e.format(l,r,t)}}let cH=cF.join("");class cW extends cO{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max(cF.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){let r=this.node,i=e.getTypeLength(r.getNodeType(e)),n=null;if(i>1){let a=null;this.getVectorLength()>=i&&(a=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let s=r.build(e,a);n=this.components.length===i&&this.components===cH.slice(0,this.components.length)?e.format(s,a,t):e.format(`${s}.${this.components}`,this.getNodeType(e),t)}else n=r.build(e,t);return n}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class cj extends cV{static get type(){return"SetNode"}constructor(e,t,r){super(),this.sourceNode=e,this.components=t,this.targetNode=r}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:r,targetNode:i}=this,n=this.getNodeType(e),a=e.getComponentType(i.getNodeType(e)),s=e.getTypeFromLength(r.length,a),o=i.build(e,s),l=t.build(e,n),u=e.getTypeLength(n),h=[];for(let e=0;e<u;e++){let t=cF[e];t===r[0]?(h.push(o),e+=r.length-1):h.push(l+"."+t)}return`${e.getType(n)}( ${h.join(", ")} )`}}class cX extends cV{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:r}=this,i=this.getNodeType(e),n=r.build(e),a=e.getVarFromNode(this),s=e.getPropertyName(a);e.addLineFlowCode(s+" = "+n,this);let o=e.getTypeLength(i),l=[],u=0;for(let e=0;e<o;e++){let r=cF[e];r===t[u]?(l.push("1.0 - "+s+"."+r),u++):l.push(s+"."+r)}return`${e.getType(i)}( ${l.join(", ")} )`}}class cq extends cO{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}getNodeType(){return null===this.nodeType?cS(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=cS(this.value),e.nodeType=this.nodeType,"ArrayBuffer"===e.valueType&&(e.value=cM(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?cT(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){en("Abstract function.")}}let c$=/float|u?int/;class cJ extends cq{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let r=this.getNodeType(e);return c$.test(r)&&c$.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),r,t)}}class cK extends cO{static get type(){return"MemberNode"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return(!this.structNode.isMemberNode||!1!==this.structNode.hasMember(e))&&"void"!==this.structNode.getMemberType(e,this.property)}getNodeType(e){return!1===this.hasMember(e)?"float":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(!1===this.hasMember(e))return"float";let r=this.getNodeType(e);return e.getStructTypeNode(r).getMemberType(e,t)}generate(e){if(!1===this.hasMember(e)){en(`TSL: Member "${this.property}" does not exist in struct.`,this.stackTrace);let t=this.getNodeType(e);return e.generateConst(t)}return this.structNode.build(e)+"."+this.property}}let cY=null,cQ=new Map;function cZ(e,t){if(cQ.has(e))return void en(`TSL: Redefinition of method chaining '${e}'.`);if("function"!=typeof t)throw Error(`THREE.TSL: Node element ${e} is not a function`);cQ.set(e,t),"assign"!==e&&(cO.prototype[e]=function(...e){return this.isStackNode?this.addToStack(t(...e)):t(this,...e)},cO.prototype[e+"Assign"]=function(...e){return this.isStackNode?this.assign(e[0],t(...e)):this.assign(t(this,...e))})}let c0=e=>e.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w").split("").sort().join("");cO.prototype.assign=function(...e){if(!0!==this.isStackNode)return null!==cY?cY.assign(this,...e):ea("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new ch),this;{let t=cQ.get("assign");return this.addToStack(t(...e))}},cO.prototype.toVarIntent=function(){return this},cO.prototype.get=function(e){return new cK(this,e)};let c1={};function c2(e,t,r){c1[e]=c1[t]=c1[r]={get(){this._cache=this._cache||{};let t=this._cache[e];return void 0===t&&(t=new cW(this,e),this._cache[e]=t),t},set(t){this[e].assign(pm(t))}};let i=e.toUpperCase(),n=t.toUpperCase(),a=r.toUpperCase();cO.prototype["set"+i]=cO.prototype["set"+n]=cO.prototype["set"+a]=function(t){return new cj(this,c0(e),pm(t))},cO.prototype["flip"+i]=cO.prototype["flip"+n]=cO.prototype["flip"+a]=function(){return new cX(this,c0(e))}}let c3=["x","y","z","w"],c4=["r","g","b","a"],c5=["s","t","p","q"];for(let e=0;e<4;e++){let t=c3[e],r=c4[e],i=c5[e];c2(t,r,i);for(let n=0;n<4;n++){t=c3[e]+c3[n],c2(t,r=c4[e]+c4[n],i=c5[e]+c5[n]);for(let a=0;a<4;a++){t=c3[e]+c3[n]+c3[a],c2(t,r=c4[e]+c4[n]+c4[a],i=c5[e]+c5[n]+c5[a]);for(let s=0;s<4;s++)t=c3[e]+c3[n]+c3[a]+c3[s],c2(t,r=c4[e]+c4[n]+c4[a]+c4[s],i=c5[e]+c5[n]+c5[a]+c5[s])}}}for(let e=0;e<32;e++)c1[e]={get(){this._cache=this._cache||{};let t=this._cache[e];return void 0===t&&(t=new cG(this,new cJ(e,"uint")),this._cache[e]=t),t},set(t){this[e].assign(pm(t))}};Object.defineProperties(cO.prototype,c1);let c8=new WeakMap,c6=function(e,t=null){let r=cS(e);if("node"===r);else if(null===t&&("float"===r||"boolean"===r)||r&&"shader"!==r&&"string"!==r)return pm(ph(e,t));else if("shader"===r)return e.isFn?e:pA(e);return e},c9=function(e,t=null){for(let r in e)e[r]=pm(e[r],t);return e},c7=function(e,t=null){let r=e.length;for(let i=0;i<r;i++)e[i]=pm(e[i],t);return e},pe=function(e,t=null,r=null,i=null){function n(e){return null!==i?(e=pm(Object.assign(e,i)),!0===i.intent&&(e=e.toVarIntent
394())):e=pm(e),e}let a,s=t,o,l;function u(t){let r;return(r=s?/[a-z]/i.test(s)?s+"()":s:e.type,void 0!==o&&t.length<o)?(ea(`TSL: "${r}" parameter length is less than minimum required.`,new ch),t.concat(Array(o-t.length).fill(0))):void 0!==l&&t.length>l?(ea(`TSL: "${r}" parameter length exceeds limit.`,new ch),t.slice(0,l)):t}return null===t?a=(...t)=>n(new e(...py(u(t)))):null!==r?(r=pm(r),a=(...i)=>n(new e(t,...py(u(i)),r))):a=(...r)=>n(new e(t,...py(u(r)))),a.setParameterLength=(...e)=>(1===e.length?o=l=e[0]:2===e.length&&([o,l]=e),a),a.setName=e=>(s=e,a),a},pt=function(e,...t){return new e(...py(t))};class pr extends cO{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){var t,r;let{shaderNode:i,rawInputs:n}=this,a=e.getNodeProperties(i),s=e.getClosestSubBuild(i.subBuilds)||"",o=s||"default";if(a[o])return a[o];let l=e.subBuildFn,u=e.fnCall;e.subBuildFn=s,e.fnCall=this;let h=null;if(i.layout){let r=c8.get(e.constructor);void 0===r&&(r=new WeakMap,c8.set(e.constructor,r));let a=r.get(i);void 0===a&&(a=pm(e.buildFunctionNode(i)),r.set(i,a)),e.addInclude(a);let s=n?(pv(t=n),t[0]&&(t[0].isNode||Object.getPrototypeOf(t[0])!==Object.prototype)?[...t]:t[0]):null;h=pm(a.call(s))}else{let t,a=new Proxy(e,{get:(e,t,r)=>Symbol.iterator===t?function*(){yield}:Reflect.get(e,t,r)}),s=n?(t=0,pv(r=n),new Proxy(r,{get:(e,i,n)=>{let a;if("length"===i)return r.length;if(Symbol.iterator===i)a=function*(){for(let e of r)yield pm(e)};else{if(r.length>0)if(Object.getPrototypeOf(r[0])===Object.prototype){let e=r[0];a=void 0===e[i]?e[t++]:Reflect.get(e,i,n)}else r[0]instanceof cO&&(a=void 0===r[i]?r[t++]:Reflect.get(r,i,n));else a=Reflect.get(e,i,n);a=pm(a)}return a}})):null,o=Array.isArray(n)?n.length>0:null!==n,l=i.jsFunc;h=pm(o||l.length>1?l(s,a):l(a))}return e.subBuildFn=l,e.fnCall=u,i.once&&(a[o]=h),h}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),r=e.getSubBuildOutput(this);return t[r]=t[r]||this.setupOutput(e),t[r].subBuild=e.getClosestSubBuild(this),t[r]}build(e,t=null){let r=null,i=e.getBuildStage(),n=e.getNodeProperties(this),a=e.getSubBuildOutput(this),s=this.getOutputNode(e),o=e.fnCall;if(e.fnCall=this,"setup"===i){let t=e.getSubBuildProperty("initialized",this);if(!0!==n[t]&&(n[t]=!0,n[a]=this.getOutputNode(e),n[a].build(e),this.shaderNode.subBuilds))for(let t of e.chaining){let r=e.getDataFromNode(t,"any");for(let e of(r.subBuilds=r.subBuilds||new Set,this.shaderNode.subBuilds))r.subBuilds.add(e)}r=n[a]}else"analyze"===i?s.build(e,t):"generate"===i&&(r=s.build(e,t)||"");return e.fnCall=o,r}}class pi extends cO{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new pr(this,e)}setup(){return this.call()}}let pn=[.5,1.5,1/3,1e-6,1e6,Math.PI,2*Math.PI,1/Math.PI,2/Math.PI,1/(2*Math.PI),Math.PI/2],pa=new Map;for(let e of[!1,!0])pa.set(e,new cJ(e));let ps=new Map;for(let e of[0,1,2,3])ps.set(e,new cJ(e,"uint"));let po=new Map([...ps].map(e=>new cJ(e.value,"int")));for(let e of[-1,-2])po.set(e,new cJ(e,"int"));let pl=new Map([...po].map(e=>new cJ(e.value)));for(let e of pn)pl.set(e,new cJ(e));for(let e of pn)pl.set(-e,new cJ(-e));let pu=new Map([...pa,...pl]),ph=(e,t)=>pu.has(e)?pu.get(e):!0===e.isNode?e:new cJ(e,t),pd=function(e,t=null){return(...r)=>{for(let t of r)if(void 0===t)return ea(`TSL: Invalid parameter for the type "${e}".`,new ch),new cJ(0,e);if((0===r.length||!["bool","float","int","uint"].includes(e)&&r.every(e=>{let t=typeof e;return"object"!==t&&"function"!==t}))&&(r=[cT(e,...r)]),1===r.length&&null!==t&&t.has(r[0]))return pg(t.get(r[0]));if(1===r.length){let t=ph(r[0],e);return t.nodeType===e?pg(t):pg(new ck(t,e))}return pg(new cz(r.map(e=>ph(e)),e))}},pc=e=>"object"==typeof e&&null!==e?e.value:e,pp=e=>null!=e?e.nodeType||e.convertTo||("string"==typeof e?e:null):null;function pf(e,t){return new pi(e,t)}let pm=(e,t=null)=>c6(e,t),pg=(e,t=null)=>
394pm(e,t).toVarIntent(),pv=(e,t=null)=>new c9(e,t),py=(e,t=null)=>new c7(e,t),p_=(e,t=null,r=null,i=null)=>new pe(e,t,r,i),px=(e,...t)=>new pt(e,...t),pb=(e,t=null,r=null,i={})=>new pe(e,t,r,{...i,intent:!0}),pS=0;class pT extends cO{constructor(e,t=null){super();let r=null;null!==t&&("object"==typeof t?r=t.return:("string"==typeof t?r=t:ea("TSL: Invalid layout type.",new ch),t=null)),this.shaderNode=new pf(e,r),null!==t&&this.setLayout(t),this.isFn=!0}setLayout(e){let t=this.shaderNode.nodeType;if("object"!=typeof e.inputs){let r={name:"fn"+pS++,type:t,inputs:[]};for(let t in e)"return"!==t&&r.inputs.push({name:t,type:e[t]});e=r}return this.shaderNode.setLayout(e),this}getNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){let t=this.shaderNode.call(e);return"void"===this.shaderNode.nodeType&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){let t=this.getNodeType(e);return ea('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}}function pA(e,t=null){let r=new pT(e,t);return new Proxy(()=>{},{apply:(e,t,i)=>r.call(...i),get:(e,t,i)=>Reflect.get(r,t,i),set:(e,t,i,n)=>Reflect.set(r,t,i,n)})}let pM=e=>{cY=e},pE=()=>cY,pC=(...e)=>cY.If(...e);function pw(e){return cY&&cY.addToStack(e),e}cZ("toStack",pw);let pR=new pd("color"),pN=new pd("float",pl),pL=new pd("int",po),pB=new pd("uint",ps),pI=new pd("bool",pa),pP=new pd("vec2"),pF=new pd("ivec2"),pD=new pd("uvec2"),pU=new pd("bvec2"),pO=new pd("vec3"),pG=new pd("ivec3"),pk=new pd("uvec3"),pV=new pd("bvec3"),pz=new pd("vec4"),pH=new pd("ivec4"),pW=new pd("uvec4"),pj=new pd("bvec4"),pX=new pd("mat2"),pq=new pd("mat3"),p$=new pd("mat4");cZ("toColor",pR),cZ("toFloat",pN),cZ("toInt",pL),cZ("toUint",pB),cZ("toBool",pI),cZ("toVec2",pP),cZ("toIVec2",pF),cZ("toUVec2",pD),cZ("toBVec2",pU),cZ("toVec3",pO),cZ("toIVec3",pG),cZ("toUVec3",pk),cZ("toBVec3",pV),cZ("toVec4",pz),cZ("toIVec4",pH),cZ("toUVec4",pW),cZ("toBVec4",pj),cZ("toMat2",pX),cZ("toMat3",pq),cZ("toMat4",p$);let pJ=p_(cG).setParameterLength(2),pK=(e,t)=>new ck(pm(e),t);cZ("element",pJ),cZ("convert",pK),cZ("append",e=>(en("TSL: .append() has been renamed to .toStack().",new ch),pw(e)));class pY extends cO{static get type(){return"PropertyNode"}constructor(e,t=null,r=!1){super(e),this.name=t,this.varying=r,this.isPropertyNode=!0,this.global=!0}customCacheKey(){return cc(this.type+":"+(this.name||"")+":"+(this.varying?"1":"0"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;return!0===this.varying?(t=e.getVaryingFromNode(this,this.name)).needsInterpolation=!0:t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}let pQ=(e,t)=>new pY(e,t),pZ=(e,t)=>new pY(e,t,!0),p0=px(pY,"vec4","DiffuseColor"),p1=px(pY,"vec3","DiffuseContribution"),p2=px(pY,"vec3","EmissiveColor"),p3=px(pY,"float","Roughness"),p4=px(pY,"float","Metalness"),p5=px(pY,"float","Clearcoat"),p8=px(pY,"float","ClearcoatRoughness"),p6=px(pY,"vec3","Sheen"),p9=px(pY,"float","SheenRoughness"),p7=px(pY,"float","Iridescence"),fe=px(pY,"float","IridescenceIOR"),ft=px(pY,"float","IridescenceThickness"),fr=px(pY,"float","AlphaT"),fi=px(pY,"float","Anisotropy"),fn=px(pY,"vec3","AnisotropyT"),fa=px(pY,"vec3","AnisotropyB"),fs=px(pY,"color","SpecularColor"),fo=px(pY,"color","SpecularColorBlended"),fl=px(pY,"float","SpecularF90"),fu=px(
vendor: 1,183 bytes, line 394
394pY,"float","Shininess"),fh=px(pY,"vec4","Output"),fd=px(pY,"float","dashSize"),fc=px(pY,"float","gapSize"),fp=px(pY,"float","pointWidth"),ff=px(pY,"float","IOR"),fm=px(pY,"float","Transmission"),fg=px(pY,"float","Thickness"),fv=px(pY,"float","AttenuationDistance"),fy=px(pY,"color","AttenuationColor"),f_=px(pY,"float","Dispersion");class fx extends cO{static get type(){return"UniformGroupNode"}constructor(e,t=!1,r=1){super("string"),this.name=e,this.shared=t,this.order=r,this.isUniformGroup=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}let fb=e=>new fx(e),fS=(e,t=0)=>new fx(e,!0,t),fT=fS("frame"),fA=fS("render"),fM=fb("object");class fE extends cq{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=fM}setName(e){return this.name=e,this}label(e){return en('TSL: "label()" has been deprecated. Use "setName()" instead.',new ch),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}
394onUpdate(e,t){return e=e.bind(this),super.onUpdate(t=>{let r=e(t,this);void 0!==r&&(this.value=r)},t)}getInputType(e){let t=super.getInputType(e);return"bool"===t&&(t="uint"),t}generate(e,t){let r=this.getNodeType(e),i=this.getUniformHash(e),n=e.getNodeFromHash(i);void 0===n&&(e.setHashNode(this,i),n=this);let a=n.getInputType(e),s=e.getUniformFromNode(n,a,e.shaderStage,this.name||e.context.nodeName),o=e.getPropertyName(s);void 0!==e.context.nodeName&&delete e.context.nodeName;let l=o;if("bool"===r){let t=e.getDataFromNode(this),i=t.propertyName;if(void 0===i){let n=e.getVarFromNode(this,null,"bool");t.propertyName=i=e.getPropertyName(n),l=e.format(o,a,r),e.addLineFlowCode(`${i} = ${l}`,this)}l=i}return e.format(l,r,t)}}let fC=(e,t)=>{let r=pp(t||e);if(r===e&&(e=cT(r)),e&&!0===e.isNode){let t=e.value;e.traverse(e=>{!0===e.isConstNode&&(t=e.value)}),e=t}return new fE(e,r)};class fw extends cV{static get type(){return"ArrayNode"}constructor(e,t,r=null){super(e),this.count=t,this.values=r,this.isArrayNode=!0}getArrayCount(){return this.count}getNodeType(e){return null===this.nodeType?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return null===this.nodeType?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){let t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}}let fR=(...e)=>{let t;if(1===e.length){let r=e[0];t=new fw(null,r.length,r)}else t=new fw(e[0],e[1]);return pm(t)};cZ("toArray",(e,t)=>fR(Array(t).fill(e)));class fN extends cV{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}getNodeType(e,t){return"void"!==t?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){let{targetNode:t}=this;if(!1===e.isAvailable("swizzleAssign")&&t.isSplitNode&&t.components.length>1){let r=e.getTypeLength(t.node.getNodeType(e));return cF.join("").slice(0,r)!==t.components}return!1}setup(e){let{targetNode:t,sourceNode:r}=this,i=t.getScope();e.getDataFromNode(i).assign=!0;let n=e.getNodeProperties(this);n.sourceNode=r,n.targetNode=t.context({assign:!0})}generate(e,t){let r,{targetNode:i,sourceNode:n}=e.getNodeProperties(this),a=this.needsSplitAssign(e),s=i.build(e),o=i.getNodeType(e),l=n.build(e,o),u=n.getNodeType(e),h=e.getDataFromNode(this);if(!0===h.initialized)"void"!==t&&(r=s);else if(a){let n=e.getVarFromNode(this,null,o),a=e.getPropertyName(n);e.addLineFlowCode(`${a} = ${l}`,this);let u=i.node,h=u.node.context({assign:!0}).build(e);for(let t=0;t<u.components.length;t++){let r=u.components[t];e.addLineFlowCode(`${h}.${r} = ${a}[ ${t} ]`,this)}"void"!==t&&(r=s)}else r=`${s} = ${l}`,("void"===t||"void"===u)&&(e.addLineFlowCode(r,this),"void"!==t&&(r=s));return h.initialized=!0,e.format(r,o,t)}}let fL=p_(fN).setParameterLength(2);cZ("assign",fL);class fB extends cV{static get type(){return"FunctionCallNode"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}getNodeType(e){return this.functionNode.getNodeType(e)}getMemberType(e,t){return this.functionNode.getMemberType(e,t)}generate(e){let t=[],r=this.functionNode,i=r.getInputs(e),n=this.parameters,a=(t,r)=>{let i=r.type;return"pointer"===i?"&"+t.build(e):t.build(e,i)};if(Array.isArray(n)){if(n.length>i.length)ea("TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'."),n.length=i.length;else if(n.length<i.length)for(ea("TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.");n.length<i.length;)n.push(pN(0));for(let e=0;e<n.length;e++)t.push(a(n[e],i[e]))}else for(let e of i){let r=n[e.name];void 0!==r?t.push(a(r,e)):(ea(`TSL: Input '${e.name}' not found in 'Fn()'.`),t.push(a(pN(0),e)))}let s=r.build(e,"property");return`${s}( ${t.join(", ")} )`}}let fI=(e,...t)=>(t=t.length>1||t[0]&&!0===t[0].isNode?py(t):pv(t[0]),new fB(pm(e),t));cZ("call",fI);let fP={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"};class fF extends cV{static get type(){return"OperatorNode"}constructor(e,t,r,...i){if(super(),i.length>0){let n=new fF(e,t,r);for(let t=0;t<i.length-1;t++)n=new fF(e,n,i[t]);t=n,r=i[i.length-1]}this.op=e,this.aNode=t,this.bNode=r,this.isOperatorNode=!0}getOperatorMethod(e,t){return e.getMethod(fP[this.op],t)}getNodeType(e,t=null){let r=this.op,i=this.aNode,n=this.bNode,a=i.getNodeType(e),s=n?n.getNodeType(e):null;if("void"===a||"void"===s)return t||"void";if("%"===r)return a;
394if("~"===r||"&"===r||"|"===r||"^"===r||">>"===r||"<<"===r)return e.getIntegerType(a);if("!"===r||"&&"===r||"||"===r||"^^"===r)return"bool";if("=="===r||"!="===r||"<"===r||">"===r||"<="===r||">="===r){let t=Math.max(e.getTypeLength(a),e.getTypeLength(s));return t>1?`bvec${t}`:"bool"}else{if(e.isMatrix(a)){if("float"===s)return a;else if(e.isVector(s))return e.getVectorFromMatrix(a);else if(e.isMatrix(s))return a}else if(e.isMatrix(s)){if("float"===a)return s;else if(e.isVector(a))return e.getVectorFromMatrix(s)}return e.getTypeLength(s)>e.getTypeLength(a)?s:a}}generate(e,t){let r=this.op,{aNode:i,bNode:n}=this,a=this.getNodeType(e,t),s=null,o=null;"void"!==a?(s=i.getNodeType(e),o=n?n.getNodeType(e):null,"<"===r||">"===r||"<="===r||">="===r||"=="===r||"!="===r?e.isVector(s)?o=s:e.isVector(o)?s=o:s!==o&&(s=o="float"):">>"===r||"<<"===r?(s=a,o=e.changeComponentType(o,"uint")):"%"===r?(s=a,o=e.isInteger(s)&&e.isInteger(o)?o:s):e.isMatrix(s)?"float"===o?o="float":e.isVector(o)?o=e.getVectorFromMatrix(s):e.isMatrix(o)||(s=o=a):s=e.isMatrix(o)?"float"===s?"float":e.isVector(s)?e.getVectorFromMatrix(o):o=a:o=a):s=o=a;let l=i.build(e,s),u=n?n.build(e,o):null,h=e.getFunctionOperator(r);if("void"!==t){let i=2e3===e.renderer.coordinateSystem;if("=="===r||"!="===r||"<"===r||">"===r||"<="===r||">="===r)if(!i)return e.format(`( ${l} ${r} ${u} )`,a,t);else if(e.isVector(s))return e.format(`${this.getOperatorMethod(e,t)}( ${l}, ${u} )`,a,t);else return e.format(`( ${l} ${r} ${u} )`,a,t);if("%"===r)if(e.isInteger(o))return e.format(`( ${l} % ${u} )`,a,t);else return e.format(`${this.getOperatorMethod(e,a)}( ${l}, ${u} )`,a,t);{if("!"===r||"~"===r)return e.format(`(${r}${l})`,s,t);if(h)return e.format(`${h}( ${l}, ${u} )`,a,t);if(e.isMatrix(s)&&"float"===o)return e.format(`( ${u} ${r} ${l} )`,a,t);if("float"===s&&e.isMatrix(o))return e.format(`${l} ${r} ${u}`,a,t);let n=`( ${l} ${r} ${u} )`;return!i&&"bool"===a&&e.isVector(s)&&e.isVector(o)&&(n=`all${n}`),e.format(n,a,t)}}if("void"!==s)if(h)return e.format(`${h}( ${l}, ${u} )`,a,t);else if(e.isMatrix(s)&&"float"===o)return e.format(`${u} ${r} ${l}`,a,t);else return e.format(`${l} ${r} ${u}`,a,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}let fD=pb(fF,"+").setParameterLength(2,1/0).setName("add"),fU=pb(fF,"-").setParameterLength(2,1/0).setName("sub"),fO=pb(fF,"*").setParameterLength(2,1/0).setName("mul"),fG=pb(fF,"/").setParameterLength(2,1/0).setName("div"),fk=pb(fF,"%").setParameterLength(2).setName("mod"),fV=pb(fF,"==").setParameterLength(2).setName("equal"),fz=pb(fF,"!=").setParameterLength(2).setName("notEqual"),fH=pb(fF,"<").setParameterLength(2).setName("lessThan"),fW=pb(fF,">").setParameterLength(2).setName("greaterThan"),fj=pb(fF,"<=").setParameterLength(2).setName("lessThanEqual"),fX=pb(fF,">=").setParameterLength(2).setName("greaterThanEqual"),fq=pb(fF,"&&").setParameterLength(2,1/0).setName("and"),f$=pb(fF,"||").setParameterLength(2,1/0).setName("or"),fJ=pb(fF,"!").setParameterLength(1).setName("not"),fK=pb(fF,"^^").setParameterLength(2).setName("xor"),fY=pb(fF,"&").setParameterLength(2).setName("bitAnd"),fQ=pb(fF,"~").setParameterLength(1).setName("bitNot"),fZ=pb(fF,"|").setParameterLength(2).setName("bitOr"),f0=pb(fF,"^").setParameterLength(2).setName("bitXor"),f1=pb(fF,"<<").setParameterLength(2).setName("shiftLeft"),f2=pb(fF,">>").setParameterLength(2).setName("shiftRight"),f3=pA(([e])=>(e.addAssign(1),e)),f4=pA(([e])=>(e.subAssign(1),e)),f5=pA(([e])=>{let t=pL(e).toConst();return e.addAssign(1),t}),f8=pA(([e])=>{let t=pL(e).toConst();return e.subAssign(1),t});cZ("add",fD),cZ("sub",fU),cZ("mul",fO),cZ("div",fG),cZ("mod",fk),cZ("equal",fV),cZ("notEqual",fz),cZ("lessThan",fH),cZ("greaterThan",fW),cZ("lessThanEqual",fj),cZ("greaterThanEqual",fX),cZ("and",fq),cZ("or",f$),cZ("not",fJ),cZ("xor",fK),cZ("bitAnd",fY),cZ("bitNot",fQ),cZ("bitOr",fZ),cZ("bitXor",f0),cZ("shiftLeft",f1),cZ("shiftRight",f2),cZ("incrementBefore",f3),cZ("decrementBefore",f4),cZ("increment",f5),cZ("decrement",f8);let f6=(e,t)=>(en('TSL: "modInt()" is deprecated. Use "mod( int( ... ) )" instead.',new ch),fk(pL(e),pL(t)));cZ("modInt",f6);class f9 extends cV{static get type(){return"MathNode"}constructor(e,t,r=null,i=null){if(super(),(e===f9.MAX||e===f9.MIN)&&arguments.length>3){let n=new f9(e,t,r);for(let t=2;t<arguments.length-1;t++)n=new f9(e,n,arguments[t]);t=n,r=arguments[arguments.length-1],i=null}this.method=e,this.aNode=t,this.bNode=r,this.cNode=i,this.isMathNode=!0}getInputType(e){let t=this.aNode.getNodeType(e),r=this.bNode?this.bNode.getNodeType(e):null,i=this.cNode?this.cNode.getNodeType(e):null,n=e.isMatrix(t)?0:e.getTypeLength(t),a=e.isMatrix(r)?0:e.getTypeLength(r),s=e.isMatrix(i)?0:e.getTypeLength(i);if(n>a&&n>s);else if(a>s)return r;else if(s>n)return i;return t}
394getNodeType(e){let t=this.method;return t===f9.LENGTH||t===f9.DISTANCE||t===f9.DOT?"float":t===f9.CROSS?"vec3":t===f9.ALL||t===f9.ANY?"bool":t===f9.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):this.getInputType(e)}setup(e){let{aNode:t,bNode:r,method:i}=this,n=null;if(i===f9.ONE_MINUS)n=fU(1,t);else if(i===f9.RECIPROCAL)n=fG(1,t);else if(i===f9.DIFFERENCE)n=mM(fU(t,r));else if(i===f9.TRANSFORM_DIRECTION){let i=t,a=r;e.isMatrix(i.getNodeType(e))?a=pz(pO(a),0):i=pz(pO(i),0),n=mv(fO(i,a).xyz)}return null!==n?n:super.setup(e)}generate(e,t){if(e.getNodeProperties(this).outputNode)return super.generate(e,t);let r=this.method,i=this.getNodeType(e),n=this.getInputType(e),a=this.aNode,s=this.bNode,o=this.cNode,l=e.renderer.coordinateSystem;if(r===f9.NEGATE)return e.format("( - "+a.build(e,n)+" )",i,t);{let u=[];return r===f9.CROSS?u.push(a.build(e,i),s.build(e,i)):2e3===l&&r===f9.STEP?u.push(a.build(e,1===e.getTypeLength(a.getNodeType(e))?"float":n),s.build(e,n)):2e3===l&&(r===f9.MIN||r===f9.MAX)?u.push(a.build(e,n),s.build(e,1===e.getTypeLength(s.getNodeType(e))?"float":n)):r===f9.REFRACT?u.push(a.build(e,n),s.build(e,n),o.build(e,"float")):r===f9.MIX?u.push(a.build(e,n),s.build(e,n),o.build(e,1===e.getTypeLength(o.getNodeType(e))?"float":n)):(2001===l&&r===f9.ATAN&&null!==s&&(r="atan2"),"fragment"!==e.shaderStage&&(r===f9.DFDX||r===f9.DFDY)&&(en(`TSL: '${r}' is not supported in the ${e.shaderStage} stage.`,this.stackTrace),r="/*"+r+"*/"),u.push(a.build(e,n)),null!==s&&u.push(s.build(e,n)),null!==o&&u.push(o.build(e,n))),e.format(`${e.getMethod(r,i)}( ${u.join(", ")} )`,i,t)}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}f9.ALL="all",f9.ANY="any",f9.RADIANS="radians",f9.DEGREES="degrees",f9.EXP="exp",f9.EXP2="exp2",f9.LOG="log",f9.LOG2="log2",f9.SQRT="sqrt",f9.INVERSE_SQRT="inversesqrt",f9.FLOOR="floor",f9.CEIL="ceil",f9.NORMALIZE="normalize",f9.FRACT="fract",f9.SIN="sin",f9.COS="cos",f9.TAN="tan",f9.ASIN="asin",f9.ACOS="acos",f9.ATAN="atan",f9.ABS="abs",f9.SIGN="sign",f9.LENGTH="length",f9.NEGATE="negate",f9.ONE_MINUS="oneMinus",f9.DFDX="dFdx",f9.DFDY="dFdy",f9.ROUND="round",f9.RECIPROCAL="reciprocal",f9.TRUNC="trunc",f9.FWIDTH="fwidth",f9.TRANSPOSE="transpose",f9.DETERMINANT="determinant",f9.INVERSE="inverse",f9.EQUALS="equals",f9.MIN="min",f9.MAX="max",f9.STEP="step",f9.REFLECT="reflect",f9.DISTANCE="distance",f9.DIFFERENCE="difference",f9.DOT="dot",f9.CROSS="cross",f9.POW="pow",f9.TRANSFORM_DIRECTION="transformDirection",f9.MIX="mix",f9.CLAMP="clamp",f9.REFRACT="refract",f9.SMOOTHSTEP="smoothstep",f9.FACEFORWARD="faceforward";let f7=pN(1e-6),me=pN(1e6),mt=pN(Math.PI),mr=pN(2*Math.PI),mi=pN(2*Math.PI),mn=pN(.5*Math.PI),ma=pb(f9,f9.ALL).setParameterLength(1),ms=pb(f9,f9.ANY).setParameterLength(1),mo=pb(f9,f9.RADIANS).setParameterLength(1),ml=pb(f9,f9.DEGREES).setParameterLength(1),mu=pb(f9,f9.EXP).setParameterLength(1),mh=pb(f9,f9.EXP2).setParameterLength(1),md=pb(f9,f9.LOG).setParameterLength(1),mc=pb(f9,f9.LOG2).setParameterLength(1),mp=pb(f9,f9.SQRT).setParameterLength(1),mf=pb(f9,f9.INVERSE_SQRT).setParameterLength(1),mm=pb(f9,f9.FLOOR).setParameterLength(1),mg=pb(f9,f9.CEIL).setParameterLength(1),mv=pb(f9,f9.NORMALIZE).setParameterLength(1),my=pb(f9,f9.FRACT).setParameterLength(1),m_=pb(f9,f9.SIN).setParameterLength(1),mx=pb(f9,f9.COS).setParameterLength(1),mb=pb(f9,f9.TAN).setParameterLength(1),mS=pb(f9,f9.ASIN).setParameterLength(1),mT=pb(f9,f9.ACOS).setParameterLength(1),mA=pb(f9,f9.ATAN).setParameterLength(1,2),mM=pb(f9,f9.ABS).setParameterLength(1),mE=pb(f9,f9.SIGN).setParameterLength(1),mC=pb(f9,f9.LENGTH).setParameterLength(1),mw=pb(f9,f9.NEGATE).setParameterLength(1),mR=pb(f9,f9.ONE_MINUS).setParameterLength(1),mN=pb(f9,f9.DFDX).setParameterLength(1),mL=pb(f9,f9.DFDY).setParameterLength(1),mB=pb(f9,f9.ROUND).setParameterLength(1),mI=pb(f9,f9.RECIPROCAL).setParameterLength(1),mP=pb(f9,f9.TRUNC).setParameterLength(1),mF=pb(f9,f9.FWIDTH).setParameterLength(1),mD=pb(f9,f9.TRANSPOSE).setParameterLength(1),mU=pb(f9,f9.DETERMINANT).setParameterLength(1),mO=pb(f9,f9.INVERSE).setParameterLength(1),mG=pb(f9,f9.MIN).setParameterLength(2,1/0),mk=pb(f9,f9.MAX).setParameterLength(2,1/0),mV=pb(f9,f9.STEP).setParameterLength(2),mz=pb(f9,f9.REFLECT).setParameterLength(2),mH=pb(f9,f9.DISTANCE).setParameterLength(2),mW=pb(f9,f9.DIFFERENCE).setParameterLength(2),mj=pb(f9,f9.DOT).setParameterLength(2),mX=pb(f9,f9.CROSS).setParameterLength(2),mq=pb(f9,f9.POW).setParameterLength(2),m$=e=>fO(e,e),mJ=e=>fO(e,e,e),mK=e=>fO(e,e,e,e),mY=pb(f9,f9.TRANSFORM_DIRECTION).setParameterLength(2),mQ=e=>fO(mE(e),mq(mM(e),1/3)),mZ=e=>mj(e,e),m0=pb(f9,f9.MIX).setParameterLength(3),m1=(e,t=0,r=1)=>new f9(f9.CLAMP,pm(e),pm(t),pm(r)),m2=e=>m1(e),m3=pb(f9,f9.REFRACT).setParameterLength(3),m4=pb(f9,f9.SMOOTHSTEP).setParameterLength(3),m5=pb(f9,f9.FACEFORWARD).setParameterLength(3),m8=pA(([e])=>my(m_(fk(mj(e.xy,pP(12.9898,78.233)),mt)).mul(43758.5453))),m6=(e,t,r)=>m0(t,r,e),m9=(e,t,r)=>m4(t,r,e),m7=(e,t)=>mV(t,e);cZ("all",ma),cZ("any",ms),cZ("radians",mo),cZ("degrees",ml),cZ("exp",mu),cZ("exp2",mh),cZ("log",md),cZ("log2",mc),cZ("sqrt",mp),cZ("inverseSqrt",mf),cZ("floor",mm),cZ("ceil",mg),cZ("normalize",mv),cZ("fract",my),cZ("sin",m_),
vendor: 4,877 bytes, lines 394-397
394cZ("cos",mx),cZ("tan",mb),cZ("asin",mS),cZ("acos",mT),cZ("atan",mA),cZ("abs",mM),cZ("sign",mE),cZ("length",mC),cZ("lengthSq",mZ),cZ("negate",mw),cZ("oneMinus",mR),cZ("dFdx",mN),cZ("dFdy",mL),cZ("round",mB),cZ("reciprocal",mI),cZ("trunc",mP),cZ("fwidth",mF),cZ("min",mG),cZ("max",mk),cZ("step",m7),cZ("reflect",mz),cZ("distance",mH),cZ("dot",mj),cZ("cross",mX),cZ("pow",mq),cZ("pow2",m$),cZ("pow3",mJ),cZ("pow4",mK),cZ("transformDirection",mY),cZ("mix",m6),cZ("clamp",m1),cZ("refract",m3),cZ("smoothstep",m9),cZ("faceForward",m5),cZ("difference",mW),cZ("saturate",m2),cZ("cbrt",mQ),cZ("transpose",mD),cZ("determinant",mU),cZ("inverse",mO),cZ("rand",m8);class ge extends cO{static get type(){return"ConditionalNode"}constructor(e,t,r=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=r}getNodeType(e){let{ifNode:t,elseNode:r}=e.getNodeProperties(this);if(void 0===t)return e.flowBuildStage(this,"setup"),this.getNodeType(e);let i=t.getNodeType(e);if(null!==r){let t=r.getNodeType(e);if(e.getTypeLength(t)>e.getTypeLength(i))return t}return i}setup(e){let t=this.condNode,r=this.ifNode.isolate(),i=this.elseNode?this.elseNode.isolate():null,n=e.context.nodeBlock;e.getDataFromNode(r).parentNodeBlock=n,null!==i&&(e.getDataFromNode(i).parentNodeBlock=n);let a=e.context.uniformFlow,s=e.getNodeProperties(this);s.condNode=t,s.ifNode=a?r:r.context({nodeBlock:r}),s.elseNode=i?a?i:i.context({nodeBlock:i}):null}generate(e,t){let r=this.getNodeType(e),i=e.getDataFromNode(this);if(void 0!==i.nodeProperty)return i.nodeProperty;let{condNode:n,ifNode:a,elseNode:s}=e.getNodeProperties(this),o=e.currentFunctionNode,l="void"!==t,u=l?pQ(r).build(e):"";i.nodeProperty=u;let h=n.build(e,"bool");if(e.context.uniformFlow&&null!==s){let i=a.build(e,r),n=s.build(e,r),o=e.getTernary(h,i,n);return e.format(o,r,t)}e.addFlowCode(` 395${e.tab}if ( ${h} ) { 396 397`).addFlowTab();let d=a.build(e,r);if(d&&(l?d=u+" = "+d+";":(d="return "+d+";",null===o&&(en("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),d="// "+d))),e.removeFlowTab().addFlowCode(e.tab+" "+d+"\n\n"+e.tab+"}"),null!==s){e.addFlowCode(" else {\n\n").addFlowTab();let t=s.build(e,r);t&&(l?t=u+" = "+t+";":(t="return "+t+";",null===o&&(en("TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.",this.stackTrace),t="// "+t))),e.removeFlowTab().addFlowCode(e.tab+" "+t+"\n\n"+e.tab+"}\n\n")}else e.addFlowCode("\n\n");return e.format(u,r,t)}}let gt=p_(ge).setParameterLength(2,3);cZ("select",gt);class gr extends cO{static get type(){return"ContextNode"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}getNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){let e=[];return this.traverse(t=>{!0===t.isContextNode&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){let r=e.addContext(this.value),i=this.node.build(e,t);return e.setContext(r),i}}let gi=(e=null,t={})=>{let r=e;return(null===r||!0!==r.isNode)&&(t=r||t,r=null),new gr(r,t)},gn=e=>gi(e,{uniformFlow:!0}),ga=(e,t)=>gi(e,{nodeName:t});function gs(e,t,r=null){return gi(r,{getShadow:({light:r,shadowColorNode:i})=>t===r?i.mul(e):i})}function go(e,t=null){return gi(t,{getAO:(t,{material:r})=>!0===r.transparent?t:null!==t?t.mul(e):e})}function gl(e,t){return en('TSL: "label()" has been deprecated. Use "setName()" instead.'),ga(e,t)}cZ("context",gi),cZ("label",gl),cZ("uniformFlow",gn),cZ("setName",ga),cZ("builtinShadowContext",(e,t,r)=>gs(t,r,e)),cZ("builtinAOContext",(e,t)=>go(t,e));class gu extends cO{static get type(){return"VarNode"}constructor(e,t=null,r=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=r,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return!0!==e.getDataFromNode(this).forceDeclaration&&this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}getNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){let t=e[0];if(!1===this._hasStack(t)&&"setup"===t.buildStage&&(t.context.nodeLoop||t.context.nodeBlock)){let e=!1;this.node.isShaderCallNodeInternal&&null===this.node.shaderNode.getLayout()&&t.fnCall&&t.fnCall.shaderNode&&t.getDataFromNode(this.node.shaderNode).hasLoop&&(t.getDataFromNode(this).forceDeclaration=!0,e=!0);let r=t.getBaseStack();e?r.addToStackBefore(this):r.addToStack(this)}return this.isIntent(t)&&!0!==this.isAssign(t)?this.node.build(...e):super.build(...e)}
397generate(e){let{node:t,name:r,readOnly:i}=this,{renderer:n}=e,a=!0===n.backend.isWebGPUBackend,s=!1,o=!1;i&&(s=e.isDeterministic(t),o=a?i:s);let l=this.getNodeType(e);if("void"==l)return!0!==this.isIntent(e)&&ea('TSL: ".toVar()" can not be used with void type.',this.stackTrace),t.build(e);let u=e.getVectorType(l),h=t.build(e,u),d=e.getVarFromNode(this,r,u,void 0,o),c=e.getPropertyName(d),p=c;if(o)if(a)p=s?`const ${c}`:`let ${c}`;else{let r=t.getArrayCount(e);p=`const ${e.getVar(d.type,c,r)}`}return e.addLineFlowCode(`${p} = ${h}`,this),c}_hasStack(e){return void 0!==e.getDataFromNode(this).stack}}let gh=p_(gu),gd=(e,t=null)=>gh(e,t).toStack(),gc=(e,t=null)=>gh(e,t,!0).toStack(),gp=e=>gh(e).setIntent(!0).toStack();cZ("toVar",gd),cZ("toConst",gc),cZ("toVarIntent",gp);class gf extends cO{static get type(){return"SubBuild"}constructor(e,t,r=null){super(r),this.node=e,this.name=t,this.isSubBuildNode=!0}getNodeType(e){if(null!==this.nodeType)return this.nodeType;e.addSubBuild(this.name);let t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);let r=this.node.build(e,...t);return e.removeSubBuild(),r}}let gm=(e,t,r=null)=>new gf(pm(e),t,r);class gg extends cO{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=gm(e,"VERTEX"),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}setupVarying(e){let t=e.getNodeProperties(this),r=t.varying;if(void 0===r){let i=this.name,n=this.getNodeType(e),a=this.interpolationType,s=this.interpolationSampling;t.varying=r=e.getVaryingFromNode(this,i,n,a,s),t.node=gm(this.node,"VERTEX")}return r.needsInterpolation||(r.needsInterpolation="fragment"===e.shaderStage),r}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(cw.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(cw.VERTEX,this.node)}generate(e){let t=e.getSubBuildProperty("property",e.currentStack),r=e.getNodeProperties(this),i=this.setupVarying(e);if(void 0===r[t]){let n=this.getNodeType(e),a=e.getPropertyName(i,cw.VERTEX);e.flowNodeFromShaderStage(cw.VERTEX,r.node,n,a),r[t]=a}return e.getPropertyName(i)}}let gv=p_(gg).setParameterLength(1,2),gy=e=>gv(e);cZ("toVarying",gv),cZ("toVertexStage",gy);let g_=pA(([e])=>m0(e.mul(.9478672986).add(.0521327014).pow(2.4),e.mul(.0773993808),e.lessThanEqual(.04045))).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),gx=pA(([e])=>m0(e.pow(.41666).mul(1.055).sub(.055),e.mul(12.92),e.lessThanEqual(.0031308))).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),gb="WorkingColorSpace";class gS extends cV{static get type(){return"ColorSpaceNode"}constructor(e,t,r){super("vec4"),this.colorNode=e,this.source=t,this.target=r}resolveColorSpace(e,t){return t===gb?eN.workingColorSpace:"OutputColorSpace"===t?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){let{colorNode:t}=this,r=this.resolveColorSpace(e,this.source),i=this.resolveColorSpace(e,this.target),n=t;return!1!==eN.enabled&&r!==i&&r&&i&&(eN.getTransfer(r)===V&&(n=pz(g_(n.rgb),n.a)),eN.getPrimaries(r)!==eN.getPrimaries(i)&&(n=pz(pq(eN._getMatrix(new eE,r,i)).mul(n.rgb),n.a)),eN.getTransfer(i)===V&&(n=pz(gx(n.rgb),n.a))),n}}let gT=(e,t)=>new gS(pm(e),gb,t),gA=(e,t)=>new gS(pm(e),t,gb);cZ("workingToColorSpace",gT),cZ("colorSpaceToWorking",gA);let gM=class extends cG{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),r=this.referenceNode.getNodeType(),i=this.getNodeType();return e.format(t,r,i)}};class gE extends cO{static get type(){return"ReferenceBaseNode"}constructor(e,t,r=null,i=null){super(),this.property=e,this.uniformType=t,this.object=r,this.count=i,this.properties=e.split("."),this.reference=r,this.node=null,this.group=null,this.updateType=cR.OBJECT}setGroup(e){return this.group=e,this}element(e){return new gM(this,pm(e))}setNodeType(e){let t=fC(null,e);null!==this.group&&t.setGroup(this.group),this.node=t}getNodeType(e){return null===this.node&&(this.updateReference(e),this.updateV
397alue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,r=e[t[0]];for(let e=1;e<t.length;e++)r=r[t[e]];return r}updateReference(e){return this.reference=null!==this.object?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){null===this.node&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}}class gC extends gE{static get type(){return"RendererReferenceNode"}constructor(e,t,r=null){super(e,t,r),this.renderer=r,this.setGroup(fA)}updateReference(e){return this.reference=null!==this.renderer?this.renderer:e.renderer,this.reference}}let gw=(e,t,r=null)=>new gC(e,t,r);class gR extends cV{static get type(){return"ToneMappingNode"}constructor(e,t=gL,r=null){super("vec3"),this._toneMapping=e,this.exposureNode=t,this.colorNode=r}customCacheKey(){return cf(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){let t=this.colorNode||e.context.color,r=this._toneMapping;if(0===r)return t;let i=null,n=e.renderer.library.getToneMappingFunction(r);return null!==n?i=pz(n(t.rgb,this.exposureNode),t.a):(ea("ToneMappingNode: Unsupported Tone Mapping configuration.",r),i=t),i}}let gN=(e,t,r)=>new gR(e,pm(t),pm(r)),gL=gw("toneMappingExposure","float");cZ("toneMapping",(e,t,r)=>gN(t,r,e));let gB=new WeakMap;function gI(e,t){let r=gB.get(e);return void 0===r&&(r=new rv(e,t),gB.set(e,r)),r}class gP extends cq{static get type(){return"BufferAttributeNode"}constructor(e,t=null,r=0,i=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=r,this.bufferOffset=i,this.usage=35044,this.instanced=!1,this.attribute=null,this.global=!0,e&&!0===e.isBufferAttribute&&e.itemSize<=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){if(0===this.bufferStride&&0===this.bufferOffset){let t=e.globalCache.getData(this.value);return void 0===t&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getNodeType(e){return null===this.bufferType&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){let t;if(null!==this.attribute)return;let r=this.getNodeType(e),i=e.getTypeLength(r),n=this.value,a=this.bufferStride||i,s=this.bufferOffset,o=new r_(t=!0===n.isInterleavedBuffer?n:!0===n.isBufferAttribute?gI(n.array,a):gI(n,a),i,s);t.setUsage(this.usage),this.attribute=o,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){let t=this.getNodeType(e),r=e.getBufferAttributeFromNode(this,t),i=e.getPropertyName(r),n=null;return"vertex"===e.shaderStage||"compute"===e.shaderStage?(this.name=i,n=i):n=gv(this).build(e,t),n}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&!0===this.attribute.isBufferAttribute&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}}function gF(e,t=null,r=0,i=0,n=35044,a=!1){return"mat3"===t||null===t&&9===e.itemSize?pq(new gP(e,"vec3",9,0).setUsage(n).setInstanced(a),new gP(e,"vec3",9,3).setUsage(n).setInstanced(a),new gP(e,"vec3",9,6).setUsage(n).setInstanced(a)):"mat4"===t||null===t&&16===e.itemSize?p$(new gP(e,"vec4",16,0).setUsage(n).setInstanced(a),new gP(e,"vec4",16,4).setUsage(n).setInstanced(a),new gP(e,"vec4",16,8).setUsage(n).setInstanced(a),new gP(e,"vec4",16,12).setUsage(n).setInstanced(a)):new gP(e,t,r,i).setUsage(n)}let gD=(e,t=null,r=0,i=0)=>gF(e,t,r,i),gU=(e,t=null,r=0,i=0)=>gF(e,t,r,i,35044,!0),gO=(e,t=null,r=0,i=0)=>gF(e,t,r,i,35048,!0);cZ("toAttribute",e=>gD(e.value));class gG extends cO{static get type(){return"ComputeNode"}constructor(e,t){super("void"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.version=1,this.name="",this.updateBeforeType=cR.OBJECT,this.onInitFunction=null}setCount(e){return this.count=e,this}getCount(){return this.count}dispose(){this.dispatchEvent({type:"dispose"})}setName(e){return this.name=e,this}label(e){return en('TSL: "label()" has been deprecated. Use "setName()" instead.',new ch),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){let t=this.computeNode.build(e);return t&&(e.getNodeProperties(this).outputComputeNode=t.outputNode,t.outputNode=null),t}generate(e,t){let{shaderStage:r}=e;if("compute"===r){let t=this.computeNode.build(e,"void");""!==t&&e.addLineFlowCode(t,this)}else{let r=e.getNodeProperties(this).outputComputeNode;if(r)return r.build(e,t)}}}let gk=(e,t=[64])=>{(0===t.length||t.length>3)&&ea("TSL: compute() workgroupSize must have 1, 2, or 3 elements",new ch);for(let e=0;e<t.length;e++){let r=t[e];("number"!=typeof r||r<=0||!Number.isInteger(r))&&ea(`TSL: compute() workgroupSize element at index [ ${e} ] must be a positive integer`,new ch)}for(;t.length<3;)t.push(1);return new gG(pm(e),t)},gV=(e,t,r)=>gk(e,r).setCount(t);cZ("compute",gV),cZ("computeKernel",gk);class gz extends cO{static get type(){return"IsolateNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}getNodeType(e){let t=e.getCache(),r=e.getCacheFromNode(this,this.parent);
397e.setCache(r);let i=this.node.getNodeType(e);return e.setCache(t),i}build(e,...t){let r=e.getCache(),i=e.getCacheFromNode(this,this.parent);e.setCache(i);let n=this.node.build(e,...t);return e.setCache(r),n}setParent(e){return this.parent=e,this}getParent(){return this.parent}}let gH=e=>new gz(pm(e));function gW(e,t=!0){return en('TSL: "cache()" has been deprecated. Use "isolate()" instead.'),gH(e).setParent(t)}cZ("cache",gW),cZ("isolate",gH);class gj extends cO{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}getNodeType(e){return this.outputNode.getNodeType(e)}generate(e){let t=this.callNode.build(e,"void");return""!==t&&e.addLineFlowCode(t,this),this.outputNode.build(e)}}let gX=p_(gj).setParameterLength(2);cZ("bypass",gX);class gq extends cO{static get type(){return"RemapNode"}constructor(e,t,r,i=pN(0),n=pN(1)){super(),this.node=e,this.inLowNode=t,this.inHighNode=r,this.outLowNode=i,this.outHighNode=n,this.doClamp=!0}setup(){let{node:e,inLowNode:t,inHighNode:r,outLowNode:i,outHighNode:n,doClamp:a}=this,s=e.sub(t).div(r.sub(t));return!0===a&&(s=s.clamp()),s.mul(n.sub(i)).add(i)}}let g$=p_(gq,null,null,{doClamp:!1}).setParameterLength(3,5),gJ=p_(gq).setParameterLength(3,5);cZ("remap",g$),cZ("remapClamp",gJ);class gK extends cO{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){let r=this.getNodeType(e),i=this.snippet;if("void"!==r)return e.format(i,r,t);e.addLineFlowCode(i,this)}}let gY=p_(gK).setParameterLength(1,2),gQ=e=>(e?gt(e,gY("discard")):gY("discard")).toStack();cZ("discard",gQ);class gZ extends cV{static get type(){return"RenderOutputNode"}constructor(e,t,r){super("vec4"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=r,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color,r=(null!==this._toneMapping?this._toneMapping:e.toneMapping)||0,i=(null!==this.outputColorSpace?this.outputColorSpace:e.outputColorSpace)||"";return 0!==r&&(t=t.toneMapping(r)),""!==i&&i!==eN.workingColorSpace&&(t=t.workingToColorSpace(i)),t}}let g0=(e,t=null,r=null)=>new gZ(pm(e),t,r);cZ("renderOutput",g0);class g1 extends cV{static get type(){return"DebugNode"}constructor(e,t=null){super(),this.node=e,this.callback=t}getNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){let t=this.callback,r=this.node.build(e);if(null!==t)t(e,r);else{let t="--- TSL debug - "+e.shaderStage+" shader ---",i="-".repeat(t.length),n="";er(n+="// #"+t+"#\n"+e.flow.code.replace(/^\t/mg,"")+"\n"+("/* ... */ "+r)+" /* ... */\n"+("// #"+i)+"#\n")}return r}}let g2=(e,t=null)=>new g1(pm(e),t).toStack();cZ("debug",g2);class g3{constructor(){this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}}class g4 extends cO{static get type(){return"InspectorNode"}constructor(e,t="",r=null){super(),this.node=e,this.name=t,this.callback=r,this.updateType=cR.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}getNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;
vendor: 12,490 bytes, line 397
397return!0===e.context.inspector&&null!==this.callback&&(t=this.callback(t)),!0!==e.renderer.backend.isWebGPUBackend&&e.renderer.inspector.constructor!==g3&&es('TSL: ".toInspector()" is only available with WebGPU.'),t}}function g5(e,t="",r=null){return(e=pm(e)).before(new g4(e,t,r))}cZ("toInspector",g5);class g8 extends cO{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}getNodeType(e){let t=this.nodeType;if(null===t){let r=this.getAttributeName(e);if(e.hasGeometryAttribute(r)){let i=e.geometry.getAttribute(r);t=e.getTypeFromAttribute(i)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){let t=this.getAttributeName(e),r=this.getNodeType(e);if(!0!==e.hasGeometryAttribute(t))return en(`AttributeNode: Vertex attribute "${t}" not found on geometry.`),e.generateConst(r);{let i=e.geometry.getAttribute(t),n=e.getTypeFromAttribute(i),a=e.getAttribute(t,n);return"vertex"===e.shaderStage?e.format(a.name,n,r):gv(this).build(e,r)}}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}}let g6=(e,t=null)=>new g8(e,t),g9=(e=0)=>g6("uv"+(e>0?e:""),"vec2");class g7 extends cO{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){let r=this.textureNode.build(e,"property"),i=null===this.levelNode?"0":this.levelNode.build(e,"int");return e.format(`${e.getMethod("textureDimensions")}( ${r}, ${i} )`,this.getNodeType(e),t)}}let ve=p_(g7).setParameterLength(1,2);class vt extends fE{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=cR.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){let e=this.texture,t=e.images,r=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(r&&void 0!==r.width){let{width:e,height:t}=r;this.value=Math.log2(Math.max(e,t))}}}let vr=p_(vt).setParameterLength(1);class vi extends Error{constructor(e,t=null){super(e),this.name="NodeError",this.stackTrace=t}}let vn=new eG;class va extends fE{static get type(){return"TextureNode"}constructor(e=vn,t=null,r=null,i=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=r,this.biasNode=i,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=cR.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(null===t)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}getNodeType(){return!0===this.value.isDepthTexture?"float":1014===this.value.type?"uvec4":1013===this.value.type?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return g9(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return null===this._matrixUniform&&(this._matrixUniform=fC(this.value.matrix)),this._matrixUniform.mul(pO(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(null===this._flipYUniform&&(this._flipYUniform=fC(!1)),t=t.toVar(),t=this.sampler?this._flipYUniform.select(t.flipY(),t):this._flipYUniform.select(t.setY(pL(ve(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){let t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;let r=this.value;if(!r||!0!==r.isTexture)throw new vi("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().",this.stackTrace);let i=pA(()=>{let t=this.uvNode;return(null===t||!0===e.context.forceUVContext)&&e.context.getUV&&(t=e.context.getUV(this,e)),t||(t=this.getDefaultUV()),!0===this.updateMatrix&&(t=this.getTransformedUV(t)),t=this.setupUV(e,t),this.updateType=null!==this._matrixUniform||null!==this._flipYUniform?cR.OBJECT:cR.NONE,t})(),n=this.levelNode;null===n&&e.context.getTextureLevel&&(n=e.context.getTextureLevel(this));let a=null,s=null;null!==this.compareNode&&(e.renderer.hasCompatibility(X.TEXTURE_COMPARE)?a=this.compareNode:null===this.value.compareFunction||513===this.value.compareFunction?s=this.compareNode:(a=this.compareNode,es('TSL: Only "LessCompare" is supported for depth texture comparison fallback.'))),t.uvNode=i,t.levelNode=n,t.biasNode=this.biasNode,t.compareNode=a,t.compareStepNode=s,t.gradNode=this.gradNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,!0===this.sampler?"vec2":"ivec2")}generateOffset(e,t){return t.build(e,"ivec2")}generateSnippet(e,t,r,i,n,a,s,o,l){let u=this.value;return n?e.generateTextureBias(u,t,r,n,a,l):o?e.generateTextureGrad(u,t,r,o,a,l):s?e.generateTextureCompare(u,t,r,s,a,l):!1===this.sampler?e.generateTextureLoad(u,t,r,i,a,l):i?e.generateTextureLevel(u,t,r,i,a,l):e.generateTexture(u,t,r,a,l)}generate(e,t){let r=this.value,i=e.getNodeProperties(this),n=super.generate(e,"property");if(/^sampler/.test(t))return n+"_sampler";{if(e.isReference(t))return n;let a=e.getDataFromNode(this),s=this.getNodeType(e),o=a.propertyName;if(void 0===o){let{uvNode:t,levelNode:r,biasNode:l,compareNode:u,compareStepNode:h,depthNode:d,gradNode:c,offsetNode:p}=i,f=this.generateUV(e,t),m=r?r.build(e,"float"):null,g=l?l.build(e,"float"):null,v=d?d.build(e,"int"):null,y=u?u.build(e,"float"):null,_=h?h.build(e,"float"):null,x=c?[c[0].build(e,"vec2"),c[1].build(e,"vec2")]:null,b=p?this.generateOffset(e,p):null,S=e.getVarFromNode(this);o=e.getPropertyName(S);let T=this.generateSnippet(e,n,f,m,g,v,y,x,b);null!==_&&(T=mV(gY(_,"float"),gY(T,s)).build(e,s)),e.addLineFlowCode(`${o} = ${T}`,this),a.snippet=T,a.propertyName=o}let l=o;return e.needsToWorkingColorSpace(r)&&(l=gA(gY(l,s),r.colorSpace).setup(e).build(e,s)),e.format(l,s,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){let t=this.clone();return t.uvNode=pm(e),t.referenceNode=this.getBase(),pm(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){let t=this.clone();t.biasNode=pm(e).mul(vr(t)),t.referenceNode=this.getBase();let r=t.value;return!1===t.generateMipmaps&&(r&&!1===r.generateMipmaps||1003===r.minFilter||1003===r.magFilter)&&(en("TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture."),t.biasNode=null),pm(t)}level(e){let t=this.clone();return t.levelNode=pm(e),t.referenceNode=this.getBase(),pm(t)}size(e){return ve(this,e)}bias(e){let t=this.clone();return t.biasNode=pm(e),t.referenceNode=this.getBase(),pm(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){let t=this.clone();return t.compareNode=pm(e),t.referenceNode=this.getBase(),pm(t)}grad(e,t){let r=this.clone();return r.gradNode=[pm(e),pm(t)],r.referenceNode=this.getBase(),pm(r)}depth(e){let t=this.clone();return t.depthNode=pm(e),t.referenceNode=this.getBase(),pm(t)}offset(e){let t=this.clone();return t.offsetNode=pm(e),t.referenceNode=this.getBase(),pm(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){let e=this.value,t=this._matrixUniform;null!==t&&(t.value=e.matrix),!0===e.matrixAutoUpdate&&e.updateMatrix();let r=this._flipYUniform;null!==r&&(r.value=e.image instanceof ImageBitmap&&!0===e.flipY||!0===e.isRenderTargetTexture||!0===e.isFramebufferTexture||!0===e.isDepthTexture)}clone(){let e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}let vs=p_(va).setParameterLength(1,4).setName("texture"),vo=(e=vn,t=null,r=null,i=null)=>{let n;return e&&!0===e.isTextureNode?((n=pm(e.clone())).referenceNode=e.getBase(),null!==t&&(n.uvNode=pm(t)),null!==r&&(n.levelNode=pm(r)),null!==i&&(n.biasNode=pm(i))):n=vs(e,t,r,i),n},vl=(...e)=>vo(...e).setSampler(!1);class vu extends fE{static get type(){return"BufferNode"}constructor(e,t,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=r,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}let vh=(e,t,r)=>new vu(e,t,r);class vd extends cG{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){let t=super.generate(e),r=this.getNodeType(),i=this.node.getPaddedType();return e.format(t,i,r)}}class vc extends vu{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=null===t?cS(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=cR.RENDER,this.isArrayBufferNode=!0}getNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){let e=this.elementType,t="vec4";return"mat2"===e?t="mat2":!0===/mat/.test(e)?t="mat4":"i"===e.charAt(0)?t="ivec4":"u"===e.charAt(0)&&(t="uvec4"),t}update(){let{array:e,value:t}=this,r=this.elementType;if("float"===r||"int"===r||"uint"===r)for(let r=0;r<e.length;r++)t[4*r]=e[r];else if("color"===r)for(let r=0;r<e.length;r++){let i=4*r,n=e[r];t[i]=n.r,t[i+1]=n.g,t[i+2]=n.b||0}else if("mat2"===r)for(let r=0;r<e.length;r++){let i=4*r,n=e[r];t[i]=n.elements[0],t[i+1]=n.elements[1],t[i+2]=n.elements[2],t[i+3]=n.elements[3]}else if("mat3"===r)for(let r=0;r<e.length;r++){let i=16*r,n=e[r];t[i]=n.elements[0],t[i+1]=n.elements[1],t[i+2]=n.elements[2],t[i+4]=n.elements[3],t[i+5]=n.elements[4],t[i+6]=n.elements[5],t[i+8]=n.elements[6],t[i+9]=n.elements[7],t[i+10]=n.elements[8],t[i+15]=1}else if("mat4"===r)for(let r=0;r<e.length;r++){let i=16*r,n=e[r];for(let e=0;e<n.elements.length;e++)t[i+e]=n.elements[e]}else for(let r=0;r<e.length;r++){let i=4*r,n=e[r];t[i]=n.x,t[i+1]=n.y,t[i+2]=n.z||0,t[i+3]=n.w||0}}setup(e){let t=this.array.length,r=this.elementType,i=Float32Array,n=this.paddedType,a=e.getTypeLength(n);return"i"===r.charAt(0)&&(i=Int32Array),"u"===r.charAt(0)&&(i=Uint32Array),this.value=new i(t*a),this.bufferCount=t,this.bufferType=n,this.update(),super.setup(e)}element(e){return new vd(this,pm(e))}}let vp=(e,t)=>new vc(e,t);class vf extends cO{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}let vm=p_(vf).setParameterLength(1);class vg extends cO{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this._output=null,this.isViewportNode=!0}getNodeType(){return this.scope===vg.DPR?"float":this.scope===vg.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=cR.NONE;return(this.scope===vg.SIZE||this.scope===vg.VIEWPORT||this.scope===vg.DPR)&&(e=cR.RENDER),this.updateType=e,e}update({renderer:e}){let t=e.getRenderTarget();this.scope===vg.VIEWPORT?null!==t?c.copy(t.viewport):(e.getViewport(c),c.multiplyScalar(e.getPixelRatio())):this.scope===vg.DPR?this._output.value=e.getPixelRatio():null!==t?(d.width=t.width,d.height=t.height):e.getDrawingBufferSize(d)}setup(){let e=this.scope,t=null;return t=e===vg.SIZE?fC(d||(d=new eb)):e===vg.VIEWPORT?fC(c||(c=new ek)):e===vg.DPR?fC(1):pP(vx.div(v_)),this._output=t,t}generate(e){if(this.scope===vg.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){let r=e.getNodeProperties(v_).outputNode.build(e);t=`${e.getType("vec2")}( ${t}.x, ${r}.y - ${t}.y )`}return t}return super.generate(e)}}vg.COORDINATE="coordinate",vg.VIEWPORT="viewport",vg.SIZE="size",vg.UV="uv",vg.DPR="dpr";let vv=px(vg,vg.DPR),vy=px(vg,vg.UV),v_=px(vg,vg.SIZE),vx=px(vg,vg.COORDINATE),vb=px(vg,vg.VIEWPORT),vS=vb.zw,vT=vx.sub(vb.xy),vA=vT.div(vS),vM=pA(()=>(en('TSL: "viewportResolution" is deprecated. Use "screenSize" instead.',new ch),v_),"vec2").once()(),vE=null,vC=null,vw=null,vR=null,vN=null,vL=null,vB=null,vI=null,vP=null,vF=null,vD=null,vU=null,vO=null,vG=null,vk=fC(0,"uint").setName("u_cameraIndex").setGroup(fS("cameraIndex")).toVarying("v_cameraIndex"),vV=fC("float").setName("cameraNear").setGroup(fA).onRenderUpd
vendor: 1,288 bytes, line 397
397ate(({camera:e})=>e.near),vz=fC("float").setName("cameraFar").setGroup(fA).onRenderUpdate(({camera:e})=>e.far),vH=pA(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let r=[];for(let t of e.cameras)r.push(t.projectionMatrix);null===vC?vC=vp(r).setGroup(fA).setName("cameraProjectionMatrices"):vC.array=r,t=vC.element(e.isMultiViewCamera?vm("gl_ViewID_OVR"):vk).toConst("cameraProjectionMatrix")}else null===vE&&(vE=fC(e.projectionMatrix).setName("cameraProjectionMatrix").setGroup(fA).onRenderUpdate(({camera:e})=>e.projectionMatrix)),t=vE;return t}).once()(),vW=pA(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let r=[];for(let t of e.cameras)r.push(t.projectionMatrixInverse);null===vR?vR=vp(r).setGroup(fA).setName("cameraProjectionMatricesInverse"):vR.array=r,t=vR.element(e.isMultiViewCamera?vm("gl_ViewID_OVR"):vk).toConst("cameraProjectionMatrixInverse")}else null===vw&&(vw=fC(e.projectionMatrixInverse).setName("cameraProjectionMatrixInverse").setGroup(fA).onRenderUpdate(({camera:e})=>e.projectionMatrixInverse)),t=vw;return t}).once()(),vj=pA(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let r=[];for(let t of e.cameras)r.push(t.matrixWorldInverse);null===vL?vL=vp(r).setGroup(fA).setName("cameraViewMatrices"):vL.array=r,t=vL.element
vendor: 4,084 bytes, line 397
397(e.isMultiViewCamera?vm("gl_ViewID_OVR"):vk).toConst("cameraViewMatrix")}else null===vN&&(vN=fC(e.matrixWorldInverse).setName("cameraViewMatrix").setGroup(fA).onRenderUpdate(({camera:e})=>e.matrixWorldInverse)),t=vN;return t}).once()(),vX=pA(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let r=[];for(let t of e.cameras)r.push(t.matrixWorld);null===vI?vI=vp(r).setGroup(fA).setName("cameraWorldMatrices"):vI.array=r,t=vI.element(e.isMultiViewCamera?vm("gl_ViewID_OVR"):vk).toConst("cameraWorldMatrix")}else null===vB&&(vB=fC(e.matrixWorld).setName("cameraWorldMatrix").setGroup(fA).onRenderUpdate(({camera:e})=>e.matrixWorld)),t=vB;return t}).once()(),vq=pA(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let r=[];for(let t of e.cameras)r.push(t.normalMatrix);null===vF?vF=vp(r).setGroup(fA).setName("cameraNormalMatrices"):vF.array=r,t=vF.element(e.isMultiViewCamera?vm("gl_ViewID_OVR"):vk).toConst("cameraNormalMatrix")}else null===vP&&(vP=fC(e.normalMatrix).setName("cameraNormalMatrix").setGroup(fA).onRenderUpdate(({camera:e})=>e.normalMatrix)),t=vP;return t}).once()(),v$=pA(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let r=[];for(let t=0,i=e.cameras.length;t<i;t++)r.push(new eT);null===vU?vU=vp(r).setGroup(fA).setName("cameraPositions").onRenderUpdate(({camera:e},t)=>{let r=e.cameras,i=t.array;for(let e=0,t=r.length;e<t;e++)i[e].setFromMatrixPosition(r[e].matrixWorld)}):vU.array=r,t=vU.element(e.isMultiViewCamera?vm("gl_ViewID_OVR"):vk).toConst("cameraPosition")}else null===vD&&(vD=fC(new eT).setName("cameraPosition").setGroup(fA).onRenderUpdate(({camera:e},t)=>t.value.setFromMatrixPosition(e.matrixWorld))),t=vD;return t}).once()(),vJ=pA(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let r=[];for(let t of e.cameras)r.push(t.viewport);null===vG?vG=vp(r,"vec4").setGroup(fA).setName("cameraViewports"):vG.array=r,t=vG.element(vk).toConst("cameraViewport")}else null===vO&&(vO=pz(0,0,v_.x,v_.y).toConst("cameraViewport")),t=vO;return t}).once()(),vK=new rl;class vY extends cO{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=cR.OBJECT,this.uniformNode=new fE(null)}getNodeType(){let e=this.scope;return e===vY.WORLD_MATRIX?"mat4":e===vY.POSITION||e===vY.VIEW_POSITION||e===vY.DIRECTION||e===vY.SCALE?"vec3":e===vY.RADIUS?"float":void 0}update(e){let t=this.object3d,r=this.uniformNode,i=this.scope;if(i===vY.WORLD_MATRIX)r.value=t.matrixWorld;else if(i===vY.POSITION)r.value=r.value||new eT,r.value.setFromMatrixPosition(t.matrixWorld);else if(i===vY.SCALE)r.value=r.value||new eT,r.value.setFromMatrixScale(t.matrixWorld);else if(i===vY.DIRECTION)r.value=r.value||new eT,t.getWorldDirection(r.value);else if(i===vY.VIEW_POSITION){let i=e.camera;r.value=r.value||new eT,r.value.setFromMatrixPosition(t.matrixWorld),r.value.applyMatrix4(i.matrixWorldInverse)}else if(i===vY.RADIUS){let i=e.object.geometry;null===i.boundingSphere&&i.computeBoundingSphere(),vK.copy(i.boundingSphere).applyMatrix4(t.matrixWorld),r.value=vK.radius}}generate(e){let t=this.scope;return t===vY.WORLD_MATRIX?this.uniformNode.nodeType="mat4":t===vY.POSITION||t===vY.VIEW_POSITION||t===vY.DIRECTION||t===vY.SCALE?this.uniformNode.nodeType="vec3":t===vY.RADIUS&&(this.uniformNode.nodeType="float"),this.uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}vY.WORLD_MATRIX="worldMatrix",vY.POSITION="position",vY.SCALE="scale",vY.VIEW_POSITION="viewPosition",vY.DIRECTION="direction",vY.RADIUS="radius";let vQ=p_(vY,vY.DIRECTION).setParameterLength(1),vZ=p_(vY,vY.WORLD_MATRIX).setParameterLength(1),v0=p_(vY,vY.POSITION).setParameterLength(1),v1=p_(vY,vY.SCALE).setParameterLength(1),v2=p_(vY,vY.VIEW_POSITION).setParameterLength(1),v3=p_(vY,vY.RADIUS).setParameterLength(1);class v4 extends vY{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}let v5=px(v4,v4.DIRECTION),v8=px(v4,v4.WORLD_MATRIX),v6=px(v4,v4.POSITION),v9=px(v4,v4.
397SCALE),v7=px(v4,v4.VIEW_POSITION),ye=px(v4,v4.RADIUS),yt=fC(new eE).onObjectUpdate(({object:e},t)=>t.value.getNormalMatrix(e.matrixWorld)),yr=fC(new eq).onObjectUpdate(({object:e},t)=>t.value.copy(e.matrixWorld).invert()),yi=pA(e=>e.context.modelViewMatrix||yn).once()().toVar("modelViewMatrix"),yn=vj.mul(v8),ya=pA(e=>(e.context.isHighPrecisionModelViewMatrix=!0,fC("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),ys=pA(e=>{let t=e.context.isHighPrecisionModelViewMatrix;return fC("mat3").onObjectUpdate(({object:e,camera:r})=>(!0!==t&&e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),yo=pA(e=>"fragment"!==e.shaderStage?(es("TSL: `clipSpace` is only available in fragment stage."),pz()):e.context.clipSpace.toVarying("v_clipSpace")).once()(),yl=g6("position","vec3"),yu=yl.toVarying("positionLocal"),yh=yl.toVarying("positionPrevious"),yd=pA(e=>v8.mul(yu).xyz.toVarying(e.getSubBuildProperty("v_positionWorld")),"vec3").once(["POSITION"])(),yc=pA(()=>yu.transformDirection(v8).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection"),"vec3").once(["POSITION"])(),yp=pA(e=>{if("fragment"===e.shaderStage&&e.material.vertexNode){let e=vW.mul(yo);return e.xyz.div(e.w).toVar("positionView")}return e.context.setupPositionView().toVarying("v_positionView")},"vec3").once(["POSITION","VERTEX"])(),yf=pA(e=>(e.camera.isOrthographicCamera?pO(0,0,1):yp.negate().toVarying("v_positionViewDirection").normalize()).toVar("positionViewDirection"),"vec3").once(["POSITION"])();class ym extends cO{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){if("fragment"!==e.shaderStage)return"true";let{material:t}=e;return 1===t.side?"false":e.getFrontFacing()}}let yg=px(ym),yv=pN(yg).mul(2).sub(1),yy=pA(([e],{material:t})=>{let r=t.side;return 1===r?e=e.mul(-1):2===r&&(e=e.mul(yv)),e}),y_=g6("normal","vec3"),yx=pA(e=>!1===e.geometry.hasAttribute("normal")?(en('TSL: Vertex attribute "normal" not found on geometry.'),pO(0,1,0)):y_,"vec3").once()().toVar("normalLocal"),yb=yp.dFdx().cross(yp.dFdy()).normalize().toVar("normalFlat"),yS=pA(e=>e.isFlatShading()?yb:yw(yx).toVarying("v_normalViewGeometry").normalize(),"vec3").once()().toVar("normalViewGeometry"),yT=pA(e=>{let t=yS.transformDirection(vj);return!0!==e.isFlatShading()&&(t=t.toVarying("v_normalWorldGeometry")),t.normalize().toVar("normalWorldGeometry")},"vec3").once()(),yA=pA(e=>{let t;
397return"NORMAL"===e.subBuildFn||"VERTEX"===e.subBuildFn?(t=yS,!0!==e.isFlatShading()&&(t=yy(t))):t=e.context.setupNormal().context({getUV:null,getTextureLevel:null}),t},"vec3").once(["NORMAL","VERTEX"])().toVar("normalView"),yM=yA.transformDirection(vj).toVar("normalWorld"),yE=pA(({subBuildFn:e,context:t})=>"NORMAL"===e||"VERTEX"===e?yA:t.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),"vec3").once(["NORMAL","VERTEX"])().toVar("clearcoatNormalView"),yC=pA(([e,t=v8])=>{let r=pq(t),i=e.div(pO(r[0].dot(r[0]),r[1].dot(r[1]),r[2].dot(r[2])));return r.mul(i).xyz}),yw=pA(([e],t)=>{let r=t.context.modelNormalViewMatrix;if(r)return r.transformDirection(e);let i=yt.mul(e);return vj.transformDirection(i)}),yR=pA(()=>(en('TSL: "transformedNormalView" is deprecated. Use "normalView" instead.'),yA)).once(["NORMAL","VERTEX"])(),yN=pA(()=>(en('TSL: "transformedNormalWorld" is deprecated. Use "normalWorld" instead.'),yM)).once(["NORMAL","VERTEX"])(),yL=pA(()=>(en('TSL: "transformedClearcoatNormalView" is deprecated. Use "clearcoatNormalView" instead.'),yE)).once(["NORMAL","VERTEX"])(),yB=new e3,yI=new eq,yP=fC(0).onReference(({material:e})=>e).onObjectUpdate(({material:e})=>e.refractionRatio),yF=fC(1).onReference(({material:e})=>e).onObjectUpdate(function({material:e,scene:t}){return e.envMap?e.envMapIntensity:t.environmentIntensity}),yD=fC(new eq).onReference(function(e){return e.material}).onObjectUpdate(function({material:e,scene:t}){let r=null!==t.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation;return r?(yB.copy(r),yI.makeRotationFromEuler(yB)):yI.identity(),yI}),yU=yf.negate().reflect(yA),yO=yf.negate().refract(yA,yP),yG=yU.transformDirection(vj).toVar("reflectVector"),yk=yO.transformDirection(vj).toVar("reflectVector"),yV=new nm;class yz extends va{static get type(){return"CubeTextureNode"}constructor(e,t=null,r=null,i=null){super(e,t,r,i),this.isCubeTextureNode=!0}getInputType(){return!0===this.value.isDepthTexture?"cubeDepthTexture":"cubeTexture"}getDefaultUV(){let e=this.value;return 301===e.mapping?yG:302===e.mapping?yk:(ea('CubeTextureNode: Mapping "%s" not supported.',e.mapping),pO(0,0,0))}setUpdateMatrix(){}setupUV(e,t){let r=this.value;return!0===r.isDepthTexture?2001===e.renderer.coordinateSystem?pO(t.x,t.y.negate(),t.z):t:(2001!==e.renderer.coordinateSystem&&r.isRenderTargetTexture||(t=pO(t.x.negate(),t.yz)),yD.mul(t))}generateUV(e,t){return t.build(e,!0===this.sampler?"vec3":"ivec3")}}let yH=p_(yz).setParameterLength(1,4).setName("cubeTexture"),yW=(e=yV,t=null,r=null,i=null)=>{let n;return e&&!0===e.isCubeTextureNode?((n=pm(e.clone())).referenceNode=e,null!==t&&(n.uvNode=pm(t)),null!==r&&(n.levelNode=pm(r)),null!==i&&(n.biasNode=pm(i))):n=yH(e,t,r,i),n};class yj extends cG{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),r=this.referenceNode.getNodeType(),i=this.getNodeType();return e.format(t,r,i)}}class yX extends cO{static get type(){return"ReferenceNode"}constructor(e,t,r=null,i=null){super(),this.property=e,this.uniformType=t,this.object=r,this.count=i,this.properties=e.split("."),this.reference=r,this.node=null,this.group=null,this.name=null,this.updateType=cR.OBJECT}element(e){return new yj(this,pm(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return en('TSL: "label()" has been deprecated. Use "setName()" instead.'),this.setName(e)}setNodeType(e){let t=null;t=null!==this.count?vh(null,e,this.count):Array.isArray(this.getValueFromReference())?vp(null,e):"texture"===e?vo(null):"cubeTexture"===e?yW(null):fC(null,e),null!==this.group&&t.setGroup(this.group),null!==this.name&&t.setName(this.name),this.node=t}getNodeType(e){return null===this.node&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,r=e[t[0]];for(let e=1;e<t.length;e++)r=r[t[e]];return r}updateReference(e){return this.reference=null!==this.object?this.object:e.object,this.reference}
397setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){null===this.node&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}}let yq=(e,t,r)=>new yX(e,t,r),y$=(e,t,r,i)=>new yX(e,t,i,r);class yJ extends yX{static get type(){return"MaterialReferenceNode"}constructor(e,t,r=null){super(e,t,r),this.material=r,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=null!==this.material?this.material:e.material,this.reference}}let yK=(e,t,r=null)=>new yJ(e,t,r),yY=g9(),yQ=yp.dFdx(),yZ=yp.dFdy(),y0=yY.dFdx(),y1=yY.dFdy(),y2=yZ.cross(yA),y3=yA.cross(yQ),y4=y2.mul(y0.x).add(y3.mul(y1.x)),y5=y2.mul(y0.y).add(y3.mul(y1.y)),y8=y4.dot(y4).max(y5.dot(y5)),y6=y8.equal(0).select(0,y8.inverseSqrt()),y9=y4.mul(y6).toVar("tangentViewFrame"),y7=y5.mul(y6).toVar("bitangentViewFrame"),_e=g6("tangent","vec4"),_t=_e.xyz.toVar("tangentLocal"),_r=pA(e=>{let t;return t="VERTEX"===e.subBuildFn||e.geometry.hasAttribute("tangent")?yi.mul(pz(_t,0)).xyz.toVarying("v_tangentView").normalize():y9,!0!==e.isFlatShading()&&(t=yy(t)),t},"vec3").once(["NORMAL","VERTEX"])().toVar("tangentView"),_i=_r.transformDirection(vj).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),_n=pA(([e,t],r)=>{let i=e.mul(_e.w).xyz;return"NORMAL"===r.subBuildFn&&!0!==r.isFlatShading()&&(i=i.toVarying(t)),i}).once(["NORMAL"]),_a=_n(y_.cross(_e),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),_s=_n(yx.cross(_t),"v_bitangentLocal").normalize().toVar("bitangentLocal"),_o=pA(e=>{let t;return t="VERTEX"===e.subBuildFn||e.geometry.hasAttribute("tangent")?_n(yA.cross(_r),"v_bitangentView").normalize():y7,!0!==e.isFlatShading()&&(t=yy(t)),t},"vec3").once(["NORMAL","VERTEX"])().toVar("bitangentView"),_l=_n(yM.cross(_i),"v_bitangentWorld").normalize().toVar("bitangentWorld"),_u=pq(_r,_o,yA).toVar("TBNViewMatrix"),_h=yf.mul(_u),_d=pA(()=>{let e=fa.cross(yf);return m0(e=e.cross(fa).normalize(),yA,fi.mul(p3.oneMinus()).oneMinus().pow2().pow2()).normalize()}).once()(),_c=e=>pm(e).mul(.5).add(.5),_p=e=>pO(e,mp(m2(pN(1).sub(mj(e,e)))));class _f extends cV{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=0,this.unpackNormalMode=""}setup(e){let{normalMapType:t,scaleNode:r,unpackNormalMode:i}=this,n=this.node.mul(2).sub(1);if(0===t?"rg"===i?n=_p(n.xy):"ga"===i?n=_p(n.yw):""!==i&&console.error(`THREE.NodeMaterial: Unexpected unpack normal mode: ${i}`):""!==i&&console.error(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${i}'`),null!==r){let t=r;!0===e.isFlatShading()&&(t=yy(t)),n=pO(n.xy.mul(t),n.z)}let a=null;return 1===t?a=yw(n):0===t?a=_u.mul(n).normalize():(ea(`NodeMaterial: Unsupported normal map type: ${t}`),a=yA),a}}let _m=p_(_f).setParameterLength(1,2),_g=pA(({textureNode:e,bumpScale:t})=>{let r=t=>e.isolate().context({getUV:e=>t(e.uvNode||g9()),forceUVContext:!0}),i=pN(r(e=>e));return pP(pN(r(e=>e.add(e.dFdx()))).sub(i),pN(r(e=>e.add(e.dFdy()))).sub(i)).mul(t)}),_v=pA(e=>{let{surf_pos:t,surf_norm:r,dHdxy:i}=e,n=t.dFdx().normalize(),a=t.dFdy().normalize().cross(r),s=r.cross(n),o=n.dot(a).mul(yv),l=o.sign().mul(i.x.mul(a).add(i.y.mul(s)));return o.abs().mul(r).sub(l).normalize()});class _y extends cV{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(){let e=null!==this.scaleNode?this.scaleNode:1;return _v({surf_pos:yp,surf_norm:yA,dHdxy:_g({textureNode:this.textureNode,bumpScale:e})})}}let __=p_(_y).setParameterLength(1,2),_x=new Map;class _b extends cO{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let r=_x.get(e);return void 0===r&&(r=yK(e,t),_x.set(e,r)),r}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache("map"===e?"map":e+"Map","texture")}setup(e){let t=e.context.material,r=this.scope,i=null;if(r===_b.COLOR){let e=void 0!==t.color?this.getColor(r):pO();i=t.map&&!0===t.map.isTexture?e.mul(this.getTexture("map")):e}else if(r===_b.OPACITY){let e=this.getFloat(r);i=t.alphaMap&&!0===t.alphaMap.isTexture?e.mul(this.getTexture("alpha")):e}else if(r===_b.SPECULAR_STRENGTH)i=t.specularMap&&!0===t.specularMap.isTexture?this.getTexture("specular").r:pN(1);else if(r===_b.SPECULAR_INTENSITY){let e=this.getFloat(r);i=t.specularIntensityMap&&!0===t.specularIntensityMap.isTexture?e.mul(this.getTexture(r).a):e}else if(r===_b.SPECULAR_COLOR){let e=this.getColor(r);i=t.specularColorMap&&!0===t.specularColorMap.isTexture?e.mul(this.getTexture(r).rgb):e}else if(r===_b.ROUGHNESS){let e=this.getFloat(r);i=t.roughnessMap&&!0===t.roughnessMap.isTexture?e.mul(this.getTexture(r).g):e}else if(r===_b.METALNESS){let e=this.getFloat(r);i=t.metalnessMap&&!0===t.metalnessMap.isTexture?e.mul(this.getTexture(r).b):e}else if(r===_b.EMISSIVE){let e=this.getFloat("emissiveIntensity"),n=this.getColor(r).mul(e);i=t.emissiveMap&&!0===t.emissiveMap.isTexture?n.mul(this.getTexture(r)):n}else if(r===_b.NORMAL)t.normalMap?((i=_m(this.getTexture("normal"),this.getCache("normalScale","vec2"))).normalMapType=t.normalMapType,(1030==t.normalMap.format||36285==t.normalMap.format||37490==t.normalMap.format)&&(i.unpackNormalMode="rg")):i=t.bumpMap?__(this.getTexture("bump").r,this.getFloat("bumpScale")):yA;else if(r===_b.CLEARCOAT){let e=this.getFloat(r);i=t.clearcoatMap&&!0===t.clearcoatMap.isTexture?e.mul(this.getTexture(r).r):e}else if(r===_b.CLEARCOAT_ROUGHNESS){let e=this.getFloat(r);i=t.clearcoatRoughnessMap&&!0===t.clearcoatRoughnessMap.isTexture?e.mul(this.getTexture(r).r):e}else if(r===_b.CLEARCOAT_NORMAL)i=t.clearcoatNormalMap?_m(this.getTexture(r),this.getCache(r+"Scale","vec2")):yA;else if(r===_b.SHEEN){let e=this.getColor("sheenColor").mul(this.getFloat("sheen"));i=t.sheenColorMap&&!0===t.sheenColorMap.isTexture?e.mul(this.getTexture("sheenColor").rgb):e}else if(r===_b.SHEEN_ROUGHNESS){let e=this.getFloat(r);i=(i=t.sheenRoughnessMap&&!0===t.sheenRoughnessMap.isTexture?e.mul(this.getTexture(r).a):e).clamp(1e-4,1)}else if(r===_b.ANISOTROPY)if(t.anisotropyMap&&!0===t.anisotropyMap.isTexture){let e=this.getTexture(r);i=pX(_5.x,_5.y,_5.y.negate(),_5.x).mul(e.rg.mul(2).sub(pP(1)).normalize().mul(e.b))}else i=_5;else if(r===_b.IRIDESCENCE_THICKNESS){let e=yq("1","float",t.iridescenceThicknessRange);
397if(t.iridescenceThicknessMap){let n=yq("0","float",t.iridescenceThicknessRange);i=e.sub(n).mul(this.getTexture(r).g).add(n)}else i=e}else if(r===_b.TRANSMISSION){let e=this.getFloat(r);i=t.transmissionMap?e.mul(this.getTexture(r).r):e}else if(r===_b.THICKNESS){let e=this.getFloat(r);i=t.thicknessMap?e.mul(this.getTexture(r).g):e}else if(r===_b.IOR)i=this.getFloat(r);else if(r===_b.LIGHT_MAP)i=this.getTexture(r).rgb.mul(this.getFloat("lightMapIntensity"));else if(r===_b.AO)i=this.getTexture(r).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else if(r===_b.LINE_DASH_OFFSET)i=t.dashOffset?this.getFloat(r):pN(0);else{let t=this.getNodeType(e);i=this.getCache(r,t)}return i}}_b.ALPHA_TEST="alphaTest",_b.COLOR="color",_b.OPACITY="opacity",_b.SHININESS="shininess",_b.SPECULAR="specular",_b.SPECULAR_STRENGTH="specularStrength",_b.SPECULAR_INTENSITY="specularIntensity",_b.SPECULAR_COLOR="specularColor",_b.REFLECTIVITY="reflectivity",_b.ROUGHNESS="roughness",_b.METALNESS="metalness",_b.NORMAL="normal",_b.CLEARCOAT="clearcoat",_b.CLEARCOAT_ROUGHNESS="clearcoatRoughness",_b.CLEARCOAT_NORMAL="clearcoatNormal",_b.EMISSIVE="emissive",_b.ROTATION="rotation",_b.SHEEN="sheen",_b.SHEEN_ROUGHNESS="sheenRoughness",_b.ANISOTROPY="anisotropy",_b.IRIDESCENCE="iridescence",_b.IRIDESCENCE_IOR="iridescenceIOR",_b.IRIDESCENCE_THICKNESS="iridescenceThickness",_b.IOR="ior",_b.TRANSMISSION="transmission",_b.THICKNESS="thickness",_b.ATTENUATION_DISTANCE="attenuationDistance",_b.ATTENUATION_COLOR="attenuationColor",_b.LINE_SCALE="scale",_b.LINE_DASH_SIZE="dashSize",_b.LINE_GAP_SIZE="gapSize",_b.LINE_WIDTH="linewidth",_b.LINE_DASH_OFFSET="dashOffset",_b.POINT_SIZE="size",_b.DISPERSION="dispersion",_b.LIGHT_MAP="light",_b.AO="ao";let _S=px(_b,_b.ALPHA_TEST),_T=px(_b,_b.COLOR),_A=px(_b,_b.SHININESS),_M=px(_b,_b.EMISSIVE),_E=px(_b,_b.OPACITY),_C=px(_b,_b.SPECULAR),_w=px(_b,_b.SPECULAR_INTENSITY),_R=px(_b,_b.SPECULAR_COLOR),_N=px(_b,_b.SPECULAR_STRENGTH),_L=px(_b,_b.REFLECTIVITY),_B=px(_b,_b.ROUGHNESS),_I=px(_b,_b.METALNESS),_P=px(_b,_b.NORMAL),_F=px(_b,_b.CLEARCOAT),_D=px(_b,_b.CLEARCOAT_ROUGHNESS),_U=px(_b,_b.CLEARCOAT_NORMAL),_O=px(_b,_b.ROTATION),_G=px(_b,_b.SHEEN),_k=px(_b,_b.SHEEN_ROUGHNESS),_V=px(_b,_b.ANISOTROPY),_z=px(_b,_b.IRIDESCENCE),_H=px(_b,_b.IRIDESCENCE_IOR),_W=px(_b,_b.IRIDESCENCE_THICKNESS),_j=px(_b,_b.TRANSMISSION),_X=px(_b,_b.THICKNESS),_q=px(_b,_b.IOR),_$=px(_b,_b.ATTENUATION_DISTANCE),_J=px(_b,_b.ATTENUATION_COLOR),_K=px(_b,_b.LINE_SCALE),_Y=px(_b,_b.LINE_DASH_SIZE),_Q=px(_b,_b.LINE_GAP_SIZE),_Z=px(_b,_b.LINE_WIDTH),_0=px(_b,_b.LINE_DASH_OFFSET),_1=px(_b,_b.POINT_SIZE),_2=px(_b,_b.DISPERSION),_3=px(_b,_b.LIGHT_MAP),_4=px(_b,_b.AO),_5=fC(new eb).onReference(function(e){return e.material}).onRenderUpdate(function({material:e}){this.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation))}),_8=pA(e=>e.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection");class _6 extends cG{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){let r=this.storageBufferNode.structTypeNode;return r?r.getMemberType(e,t):"void"}setup(e){return!1===e.isAvailable("storageBuffer")&&!0===this.node.isPBO&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let r,i=e.context.assign;if(r=!1===e.isAvailable("storageBuffer")?!0===this.node.isPBO&&!0!==i&&(this.node.value.isInstancedBufferAttribute||"compute"!==e.shaderStage)?e.generatePBO(this):this.node.build(e):super.generate(e),!0!==i){let i=this.getNodeType(e);r=e.format(r,i,t)}return r}}let _9=p_(_6).setParameterLength(2);class _7 extends vu{static get type(){return"StorageBufferNode"}constructor(e,t=null,r=0){let i,n=null;t&&t.isStruct?(i="struct",n=t.layout,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(r=e.count)):null===t&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(i=cv(e.itemSize),r=e.count):i=t,super(e,i,r),this.isStorageBufferNode=!0,this.structTypeNode=n,this.access=cL.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,!0!==e.isStorageBufferAttribute&&!0!==e.isStorageInstancedBufferAttribute&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){if(0===this.bufferCount){let t=e.globalCache.getData(this.value);return void 0===t&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return _9(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(cL.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return null===this._attribute&&(this._attribute=gD(this.value),this._varying=gv(this._attribute)),{attribute:this._attribute,varying:this._varying}}getNodeType(e){if(null!==this.structTypeNode)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.getNodeType(e);let{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return null!==this.structTypeNode?this.structTypeNode.getMemberType(e,t):"void"}generate(e){if(null!==this.structTypeNode&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);let{attribute:t,varying:r}=this.getAttributeData(),i=r.build(e);return e.registerTransform(i,t),i}}let xe=(e,t=null,r=0)=>new _7(e,t,r);class xt extends cO{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){let t,r=this.getNodeType(e),i=this.scope;if(i===xt.VERTEX)t=e.getVertexIndex();else if(i===xt.INSTANCE)t=e.getInstanceIndex();else if(i===xt.DRAW)t=e.getDrawIndex();else if(i===xt.INVOCATION_LOCAL)t=e.getInvocationLocalIndex();
397else if(i===xt.INVOCATION_SUBGROUP)t=e.getInvocationSubgroupIndex();else if(i===xt.SUBGROUP)t=e.getSubgroupIndex();else throw Error("THREE.IndexNode: Unknown scope: "+i);return"vertex"===e.shaderStage||"compute"===e.shaderStage?t:gv(this).build(e,r)}}xt.VERTEX="vertex",xt.INSTANCE="instance",xt.SUBGROUP="subgroup",xt.INVOCATION_LOCAL="invocationLocal",xt.INVOCATION_SUBGROUP="invocationSubgroup",xt.DRAW="draw";let xr=px(xt,xt.VERTEX),xi=px(xt,xt.INSTANCE),xn=px(xt,xt.SUBGROUP),xa=px(xt,xt.INVOCATION_SUBGROUP),xs=px(xt,xt.INVOCATION_LOCAL),xo=px(xt,xt.DRAW);class xl extends cO{static get type(){return"InstanceNode"}constructor(e,t,r=null){super("void"),this.count=e,this.instanceMatrix=t,this.instanceColor=r,this.instanceMatrixNode=null,this.instanceColorNode=null,this.updateType=cR.FRAME,this.buffer=null,this.bufferColor=null,this.previousInstanceMatrixNode=null}get isStorageMatrix(){let{instanceMatrix:e}=this;return e&&!0===e.isStorageInstancedBufferAttribute}get isStorageColor(){let{instanceColor:e}=this;return e&&!0===e.isStorageInstancedBufferAttribute}setup(e){let{instanceMatrixNode:t,instanceColorNode:r}=this;null===t&&(t=this._createInstanceMatrixNode(!0,e),this.instanceMatrixNode=t);let{instanceColor:i,isStorageColor:n}=this;if(i&&null===r){if(n)r=xe(i,"vec3",Math.max(i.count,1)).element(xi);else{let e=new im(i.array,3),t=35048===i.usage?gO:gU;this.bufferColor=e,r=pO(t(e,"vec3",3,0))}this.instanceColorNode=r}let a=t.mul(yu).xyz;if(yu.assign(a),e.needsPreviousData()&&yh.assign(this.getPreviousInstancedPosition(e)),e.hasGeometryAttribute("normal")){let e=yC(yx,t);yx.assign(e)}null!==this.instanceColorNode&&pZ("vec3","vInstanceColor").assign(this.instanceColorNode)}update(e){null!==this.buffer&&!0!==this.isStorageMatrix&&(this.buffer.clearUpdateRanges(),this.buffer.updateRanges.push(...this.instanceMatrix.updateRanges),this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version)),this.instanceColor&&null!==this.bufferColor&&!0!==this.isStorageColor&&(this.bufferColor.clearUpdateRanges(),this.bufferColor.updateRanges.push(...this.instanceColor.updateRanges),this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version)),null!==this.previousInstanceMatrixNode&&e.object.previousInstanceMatrix.array.set(this.instanceMatrix.array)}getPreviousInstancedPosition(e){let t=e.object;return null===this.previousInstanceMatrixNode&&(t.previousInstanceMatrix=this.instanceMatrix.clone(),this.previousInstanceMatrixNode=this._createInstanceMatrixNode(!1,e)),this.previousInstanceMatrixNode.mul(yh).xyz}_createInstanceMatrixNode(e,t){let r,{instanceMatrix:i}=this,{count:n}=i;if(this.isStorageMatrix)r=xe(i,"mat4",Math.max(n,1)).element(xi);else if(16*n*4<=t.getUniformBufferLimit())r=vh(i.array,"mat4",Math.max(n,1)).element(xi);else{let t=new oA(i.array,16,1);!0===e&&(this.buffer=t);let n=35048===i.usage?gO:gU;r=p$(n(t,"vec4",16,0),n(t,"vec4",16,4),n(t,"vec4",16,8),n(t,"vec4",16,12))}return r}}let xu=p_(xl).setParameterLength(2,3);class xh extends xl{static get type(){return"InstancedMeshNode"}constructor(e){const{count:t,instanceMatrix:r,instanceColor:i}=e;super(t,r,i),this.instancedMesh=e}}let xd=p_(xh).setParameterLength(1);class xc extends cO{static get type(){return"BatchNode"}constructor(e){super("void"),this.batchMesh=e,this.batchingIdNode=null}setup(e){null===this.batchingIdNode&&(null===e.getDrawIndex()?this.batchingIdNode=xi:this.batchingIdNode=xo);let t=pA(([e])=>{let t=pL(ve(vl(this.batchMesh._indirectTexture),0).x).toConst(),r=pL(e).mod(t).toConst(),i=pL(e).div(t).toConst();return vl(this.batchMesh._indirectTexture,pF(r,i)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]})(pL(this.batchingIdNode)),r=this.batchMesh._matricesTexture,i=pL(ve(vl(r),0).x).toConst(),n=pN(t).mul(4).toInt().toConst(),a=n.mod(i).toConst(),s=n.div(i).toConst(),o=p$(vl(r,pF(a,s)),vl(r,pF(a.add(1),s)),vl(r,pF(a.add(2),s)),vl(r,pF(a.add(3),s))),l=this.batchMesh._colorsTexture;if(null!==l){let e=pA(([e])=>{let t=pL(ve(vl(l),0).x).toConst();return vl(l,pF(e.mod(t).toConst(),e.div(t).toConst())).rgb}
397).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]})(t);pZ("vec3","vBatchColor").assign(e)}let u=pq(o);yu.assign(o.mul(yu));let h=yx.div(pO(u[0].dot(u[0]),u[1].dot(u[1]),u[2].dot(u[2]))),d=u.mul(h).xyz;yx.assign(d),e.hasGeometryAttribute("tangent")&&_t.mulAssign(u)}}let xp=p_(xc).setParameterLength(1),xf=new WeakMap;class xm extends cO{static get type(){return"SkinningNode"}constructor(e){super("void"),this.skinnedMesh=e,this.updateType=cR.OBJECT,this.skinIndexNode=g6("skinIndex","uvec4"),this.skinWeightNode=g6("skinWeight","vec4"),this.bindMatrixNode=yq("bindMatrix","mat4"),this.bindMatrixInverseNode=yq("bindMatrixInverse","mat4"),this.boneMatricesNode=y$("skeleton.boneMatrices","mat4",e.skeleton.bones.length),this.positionNode=yu,this.toPositionNode=yu,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=this.positionNode){let{skinIndexNode:r,skinWeightNode:i,bindMatrixNode:n,bindMatrixInverseNode:a}=this,s=e.element(r.x),o=e.element(r.y),l=e.element(r.z),u=e.element(r.w),h=n.mul(t),d=fD(s.mul(i.x).mul(h),o.mul(i.y).mul(h),l.mul(i.z).mul(h),u.mul(i.w).mul(h));return a.mul(d).xyz}getSkinnedNormalAndTangent(e=this.boneMatricesNode,t=yx,r=_t){let{skinIndexNode:i,skinWeightNode:n,bindMatrixNode:a,bindMatrixInverseNode:s}=this,o=e.element(i.x),l=e.element(i.y),u=e.element(i.z),h=e.element(i.w),d=fD(n.x.mul(o),n.y.mul(l),n.z.mul(u),n.w.mul(h));return{skinNormal:(d=s.mul(d).mul(a)).transformDirection(t).xyz,skinTangent:d.transformDirection(r).xyz}}getPreviousSkinnedPosition(e){let t=e.object;return null===this.previousBoneMatricesNode&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=y$("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,yh)}setup(e){e.needsPreviousData()&&yh.assign(this.getPreviousSkinnedPosition(e));let t=this.getSkinnedPosition();if(this.toPositionNode&&this.toPositionNode.assign(t),e.hasGeometryAttribute("normal")){let{skinNormal:t,skinTangent:r}=this.getSkinnedNormalAndTangent();yx.assign(t),e.hasGeometryAttribute("tangent")&&_t.assign(r)}return t}generate(e,t){if("void"!==t)return super.generate(e,t)}update(e){let t=e.object&&e.object.skeleton?e.object.skeleton:this.skinnedMesh.skeleton;xf.get(t)!==e.frameId&&(xf.set(t,e.frameId),null!==this.previousBoneMatricesNode&&(null===t.previousBoneMatrices&&(t.previousBoneMatrices=new Float32Array(t.boneMatrices)),t.previousBoneMatrices.set(t.boneMatrices)),t.update())}}let xg=e=>new xm(e);class xv extends cO{static get type(){return"LoopNode"}constructor(e=[]){super("void"),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){let t=e.getNodeProperties(this);if(void 0!==t.stackNode)return t;let r={};for(let e=0,t=this.params.length-1;e<t;e++){let t=this.params[e],i=!0!==t.isNode&&t.name||this.getVarName(e),n=!0!==t.isNode&&t.type||"int";r[i]=gY(i,n)}let i=e.addStack(),n=this.params[this.params.length-1](r);t.returnsNode=n.context({nodeLoop:n}),t.stackNode=i;let a=this.params[0];if(!0!==a.isNode&&"function"==typeof a.update){let e=pA(this.params[0].update)(r);t.updateNode=e.context({nodeLoop:e})}return e.removeStack(),t}setup(e){this.getProperties(e),e.fnCall&&(e.getDataFromNode(e.fnCall.shaderNode).hasLoop=!0)}generate(e){let t=this.getProperties(e),r=this.params,i=t.stackNode;for(let i=0,n=r.length-1;i<n;i++){let n,a=r[i],s=!1,o=null,l=null,u=null,h=null,d=null,c=null;if(a.isNode?"bool"===a.getNodeType(e)?(s=!0,h="bool",l=a.build(e,h)):(h="int",u=this.getVarName(i),o="0",l=a.build(e,h),d="<"):(h=a.type||"int",u=a.name||this.getVarName(i),o=a.start,l=a.end,d=a.condition,c=a.update,"number"==typeof o?o=e.generateConst(h,o):o&&o.isNode&&(o=o.build(e,h)),"number"==typeof l?l=e.generateConst(h,l):l&&l.isNode&&(l=l.build(e,h)),void 0!==o&&void 0===l?(o+=" - 1",l="0",d=">="):void 0!==l&&void 0===o&&(o="0",d="<"),void 0===d&&(d=Number(o)>Number(l)?">=":"<")),s)n=`while ( ${l} )`;else{let r,i=o,a=l,s=()=>d.includes("<")?"+=":"-=";if(null!=c)switch(typeof c){case"function":r=e.flowStagesNode(t.updateNode,"void").code.replace(/\t|;/g,"");break;
397case"number":r=u+" "+s()+" "+e.generateConst(h,c);break;case"string":r=u+" "+c;break;default:c.isNode?r=u+" "+s()+" "+c.build(e):(ea("TSL: 'Loop( { update: ... } )' is not a function, string or number.",this.stackTrace),r="break /* invalid update */")}else r=u+" "+(c="int"===h||"uint"===h?d.includes("<")?"++":"--":s()+" 1.");let p=e.getVar(h,u)+" = "+i,f=u+" "+d+" "+a;n=`for ( ${p}; ${f}; ${r} )`}e.addFlowCode((0===i?"\n":"")+e.tab+n+" {\n\n").addFlowTab()}let n=i.build(e,"void");t.returnsNode.build(e,"void"),e.removeFlowTab().addFlowCode("\n"+e.tab+n);for(let t=0,r=this.params.length-1;t<r;t++)e.addFlowCode((0===t?"":e.tab)+"}\n\n").removeFlowTab();e.addFlowTab()}}let xy=(...e)=>new xv(py(e,"int")).toStack(),x_=()=>gY("break").toStack(),xx=new WeakMap,xb=new ek,xS=pA(({bufferMap:e,influence:t,stride:r,width:i,depth:n,offset:a})=>{let s=pL(xr).mul(r).add(a),o=s.div(i);return vl(e,pF(s.sub(o.mul(i)),o)).depth(n).xyz.mul(t)});class xT extends cO{static get type(){return"MorphNode"}constructor(e){super("void"),this.mesh=e,this.morphBaseInfluence=fC(1),this.updateType=cR.OBJECT}setup(e){let{geometry:t}=e,r=void 0!==t.morphAttributes.position,i=t.hasAttribute("normal")&&void 0!==t.morphAttributes.normal,n=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,a=void 0!==n?n.length:0,{texture:s,stride:o,size:l}=function(e){let t=void 0!==e.morphAttributes.position,r=void 0!==e.morphAttributes.normal,i=void 0!==e.morphAttributes.color,n=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,a=void 0!==n?n.length:0,s=xx.get(e);if(void 0===s||s.count!==a){void 0!==s&&s.texture.dispose();let n=e.morphAttributes.position||[],o=e.morphAttributes.normal||[],l=e.morphAttributes.color||[],u=0;!0===t&&(u=1),!0===r&&(u=2),!0===i&&(u=3);let h=e.attributes.position.count*u,d=1;h>4096&&(d=Math.ceil(h/4096),h=4096);let c=new Float32Array(h*d*4*a),p=new eH(c,h,d,a);p.type=1015,p.needsUpdate=!0;let f=4*u;for(let e=0;e<a;e++){let a=n[e],s=o[e],u=l[e],p=h*d*4*e;for(let e=0;e<a.count;e++){let n=e*f;!0===t&&(xb.fromBufferAttribute(a,e),c[p+n+0]=xb.x,c[p+n+1]=xb.y,c[p+n+2]=xb.z,c[p+n+3]=0),!0===r&&(xb.fromBufferAttribute(s,e),c[p+n+4]=xb.x,c[p+n+5]=xb.y,c[p+n+6]=xb.z,c[p+n+7]=0),!0===i&&(xb.fromBufferAttribute(u,e),c[p+n+8]=xb.x,c[p+n+9]=xb.y,c[p+n+10]=xb.z,c[p+n+11]=4===u.itemSize?xb.w:1)}}s={count:a,texture:p,stride:u,size:new eb(h,d)},xx.set(e,s),e.addEventListener("dispose",function t(){p.dispose(),xx.delete(e),e.removeEventListener("dispose",t)})}return s}(t);!0===r&&yu.mulAssign(this.morphBaseInfluence),!0===i&&yx.mulAssign(this.morphBaseInfluence);let u=pL(l.width);xy(a,({i:e})=>{let t=pN(0).toVar();this.mesh.count>1&&null!==this.mesh.morphTexture&&void 0!==this.mesh.morphTexture?t.assign(vl(this.mesh.morphTexture,pF(pL(e).add(1),pL(xi))).r):t.assign(yq("morphTargetInfluences","float").element(e).toVar()),pC(t.notEqual(0),()=>{!0===r&&yu.addAssign(xS({bufferMap:s,influence:t,stride:o,width:u,depth:e,offset:pL(0)})),!0===i&&yx.addAssign(xS({bufferMap:s,influence:t,stride:o,width:u,depth:e,offset:pL(1)}))})})}update(){let e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((e,t)=>e+t,0)}}let xA=p_(xT).setParameterLength(1);class xM extends cO{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class xE extends xM{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class xC extends gr{static get type(){return"LightingContextNode"}constructor(e,t=null,r=null,i=null){super(e),this.lightingModel=t,this.backdropNode=r,this.backdropAlphaNode=i,this._value=null}getContext(){let{backdropNode:e,backdropAlphaNode:t}=this,r=pO().toVar("directDiffuse"),i=pO().toVar("directSpecular"),n=pO().toVar("indirectDiffuse"),a=pO().toVar("indirectSpecular");return{radiance:pO().toVar("radiance"),irradiance:pO().toVar("irradiance"),iblIrradiance:pO().toVar("iblIrradiance"),ambientOcclusion:pN(1).toVar("ambientOcclusion"),reflectedLight:{directDiffuse:r,directSpecular:i,indirectDiffuse:n,indirectSpecular:a},backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}let xw=p_(xC);class xR extends xM{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}
397setup(e){e.context.irradiance.addAssign(this.node)}}let xN=new eb;class xL extends va{static get type(){return"ViewportTextureNode"}constructor(e=vy,t=null,r=null){let i=null;null===r?((i=new nd).minFilter=1008,r=i):i=r,super(r,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=i,this.isOutputTextureNode=!0,this.updateBeforeType=cR.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,r;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,r=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,r=this._cacheTextures),null===e)return t;if(!1===r.has(e)){let i=t.clone();r.set(e,i)}return r.get(e)}updateReference(e){let t=e.renderer.getRenderTarget();return this.value=this.getTextureForReference(t),this.value}updateBefore(e){let t=e.renderer,r=t.getRenderTarget();null===r?t.getDrawingBufferSize(xN):xN.set(r.width,r.height);let i=this.getTextureForReference(r);(i.image.width!==xN.width||i.image.height!==xN.height)&&(i.image.width=xN.width,i.image.height=xN.height,i.needsUpdate=!0);let n=i.generateMipmaps;i.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(i),i.generateMipmaps=n}clone(){let e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}let xB=p_(xL).setParameterLength(0,3),xI=p_(xL,null,null,{generateMipmaps:!0}).setParameterLength(0,3),xP=xI(),xF=(e=vy,t=null)=>xP.sample(e,t),xD=null;class xU extends xL{static get type(){return"ViewportDepthTextureNode"}constructor(e=vy,t=null){null===xD&&(xD=new nv),super(e,t,xD)}getTextureForReference(){return xD}}let xO=p_(xU).setParameterLength(0,2);class xG extends cO{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){let{scope:t}=this;return t===xG.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){let{scope:t}=this,r=this.valueNode,i=null;return t===xG.DEPTH_BASE?null!==r&&(i=xX().assign(r)):t===xG.DEPTH?i=e.isPerspectiveCamera?xz(yp.z,vV,vz):xk(yp.z,vV,vz):t===xG.LINEAR_DEPTH&&(i=null!==r?e.isPerspectiveCamera?xk(xW(r,vV,vz),vV,vz):r:xk(yp.z,vV,vz)),i}}xG.DEPTH_BASE="depthBase",xG.DEPTH="depth",xG.LINEAR_DEPTH="linearDepth";let xk=(e,t,r)=>e.add(t).div(t.sub(r)),xV=pA(([e,t,r],i)=>!0===i.renderer.reversedDepthBuffer?r.sub(t).mul(e).sub(r):t.sub(r).mul(e).sub(t)),xz=(e,t,r)=>t.add(e).mul(r).div(r.sub(t).mul(e)),xH=(e,t,r)=>t.mul(e.add(r)).div(e.mul(t.sub(r))),xW=pA(([e,t,r],i)=>!0===i.renderer.reversedDepthBuffer?t.mul(r).div(t.sub(r).mul(e).sub(t)):t.mul(r).div(r.sub(t).mul(e).sub(r))),xj=(e,t,r)=>{t=t.max(1e-6).toVar();let i=mc(e.negate().div(t)),n=mc(r.div(t));return i.div(n)},xX=p_(xG,xG.DEPTH_BASE),xq=px(xG,xG.DEPTH),x$=p_(xG,xG.LINEAR_DEPTH).setParameterLength(0,1),xJ=x$(xO());xq.assign=e=>xX(e);class xK extends cO{static get type(){return"ClippingNode"}constructor(e=xK.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);let{intersectionPlanes:t,unionPlanes:r}=e.clippingContext;return(this.hardwareClipping=e.material.hardwareClipping,this.scope===xK.ALPHA_TO_COVERAGE)?this.setupAlphaToCoverage(t,r):this.scope===xK.HARDWARE?this.setupHardwareClipping(r,e):this.setupDefault(t,r)}setupAlphaToCoverage(e,t){return pA(()=>{let r=pN().toVar("distanceToPlane"),i=pN().toVar("distanceToGradient"),n=pN(1).toVar("clipOpacity"),a=t.length;if(!1===this.hardwareClipping&&a>0){let e=vp(t).setGroup(fA);xy(a,({i:t})=>{let a=e.element(t);r.assign(yp.dot(a.xyz).negate().add(a.w)),i.assign(r.fwidth().div(2)),n.mulAssign(m4(i.negate(),i,r))})}let s=e.length;if(s>0){let t=vp(e).setGroup(fA),a=pN(1).toVar("intersectionClipOpacity");xy(s,({i:e})=>{let n=t.element(e);r.assign(yp.dot(n.xyz).negate().add(n.w)),i.assign(r.fwidth().div(2)),a.mulAssign(m4(i.negate(),i,r).oneMinus())}),n.mulAssign(a.oneMinus())}p0.a.mulAssign(n),p0.a.equal(0).discard()})()}setupDefault(e,t){return pA(()=>{let r=t.length;if(!1===this.hardwareClipping&&r>0){let e=vp(t).setGroup(fA);xy(r,({i:t})=>{let r=e.element(t);yp.dot(r.xyz).greaterThan(r.w).discard()})}let i=e.length;if(i>0){let t=vp(e).setGroup(fA),r=pI(!0).toVar("clipped");xy(i,({i:e})=>{let i=t.element(e);r.assign(yp.dot(i.xyz).greaterThan(i.w).and(r))}),r.discard()}})()}setupHardwareClipping(e,t){let r=e.length;return t.enableHardwareClipping(r),pA(()=>{let i=vp(e).setGroup(fA),n=vm(t.getClipDistance());xy(r,({i:e})=>
397{let t=i.element(e),r=yp.dot(t.xyz).sub(t.w).negate();n.element(e).assign(r)})})()}}xK.ALPHA_TO_COVERAGE="alphaToCoverage",xK.DEFAULT="default",xK.HARDWARE="hardware";let xY=pA(([e])=>my(fO(1e4,m_(fO(17,e.x).add(fO(.1,e.y)))).mul(fD(.1,mM(m_(fO(13,e.y).add(e.x))))))),xQ=pA(([e])=>xY(pP(xY(e.xy),e.z))),xZ=pA(([e])=>{let t=mk(mC(mN(e.xyz)),mC(mL(e.xyz))),r=pN(1).div(pN(.05).mul(t)).toVar("pixScale"),i=pP(mh(mm(mc(r))),mh(mg(mc(r)))),n=pP(xQ(mm(i.x.mul(e.xyz))),xQ(mm(i.y.mul(e.xyz)))),a=my(mc(r)),s=fD(fO(a.oneMinus(),n.x),fO(a,n.y)),o=mG(a,a.oneMinus()),l=pO(s.mul(s).div(fO(2,o).mul(fU(1,o))),s.sub(fO(.5,o)).div(fU(1,o)),fU(1,fU(1,s).mul(fU(1,s)).div(fO(2,o).mul(fU(1,o)))));return m1(s.lessThan(o.oneMinus()).select(s.lessThan(o).select(l.x,l.y),l.z),1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]});class x0 extends g8{static get type(){return"VertexColorNode"}constructor(e){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){let e=this.index;return"color"+(e>0?e:"")}generate(e){let t=this.getAttributeName(e);return!0===e.hasGeometryAttribute(t)?super.generate(e):e.generateConst(this.nodeType,new ek(1,1,1,1))}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}let x1=(e=0)=>new x0(e),x2=pA(([e,t])=>mG(1,e.oneMinus().div(t)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),x3=pA(([e,t])=>mG(e.div(t.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),x4=pA(([e,t])=>e.oneMinus().mul(t.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),x5=pA(([e,t])=>m0(e.mul(2).mul(t),e.oneMinus().mul(2).mul(t.oneMinus()).oneMinus(),mV(.5,e))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),x8=pA(([e,t])=>{let r=t.a.add(e.a.mul(t.a.oneMinus()));return pz(t.rgb.mul(t.a).add(e.rgb.mul(e.a).mul(t.a.oneMinus())).div(r),r)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),x6=pA(([e])=>pz(e.rgb.mul(e.a),e.a),{color:"vec4",return:"vec4"}),x9=pA(([e])=>(pC(e.a.equal(0),()=>pz(0)),pz(e.rgb.div(e.a),e.a)),{color:"vec4",return:"vec4"});class x7 extends rb{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.hardwareClipping=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){let e=[];for(let t of Object.getOwnPropertyNames(this)){if(!0===t.startsWith("_"))continue;let r=this[t];r&&!0===r.isNode&&e.push({property:t,childNode:r})}return e}customProgramCacheKey(){let e=[];for(let{property:t,childNode:r}of this._getNodeChildren())e.push(cc(t.slice(0,-4)),r.getCacheKey());return this.type+cp(e)}build(e){this.setup(e)}setupObserver(e){return new cl(e)}setup(e){let t;e.context.setupNormal=()=>gm(this.setupNormal(e),"NORMAL","vec3"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);let r=e.renderer,i=r.getRenderTarget();!0===r.contextNode.isContextNode?e.context={...e.context,...r.contextNode.getFlowContextData()}:ea('NodeMaterial: "renderer.contextNode" must be an instance of `context()`.'),null!==this.contextNode&&(!0===this.contextNode.isContextNode?e.context={...e.context,...this.contextNode.getFlowContextData()}:ea('NodeMaterial: "material.contextNode" must be an instance of `context()`.')),e.addStack();let n=this.setupVertex(e),a=gm(this.vertexNode||n,"VERTEX");e.context.clipSpace=a,e.stack.outputNode=a,this.setupHardwareClipping(e),null!==this.geometryNode&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let s=this.setupClipping(e);if((!0===this.depthWrite||!0===this.depthTest)&&(null!==i?!0===i.depthBuffer&&this.setupDepth(e):!0===r.depth&&this.setupDepth(e)),null===this.fragmentNode){this.setupDiffuseColor(e),this.setupVariants(e);let n=this.setupLighting(e);null!==s&&e.stack.addToStack(s);let a=pz(n,p0.a).max(0);t=this.setupOutput(e,a),fh.assign(t);let o=null!==this.outputNode;
397if(o&&(t=this.outputNode),e.context.getOutput&&(t=e.context.getOutput(t,e)),null!==i){let e=r.getMRT(),i=this.mrtNode;null!==e?(o&&fh.assign(t),t=e,null!==i&&(t=e.merge(i))):null!==i&&(t=i)}}else{let r=this.fragmentNode;!0!==r.isOutputStructNode&&(r=pz(r)),t=this.setupOutput(e,r)}e.stack.outputNode=t,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(null===e.clippingContext)return null;let{unionPlanes:t,intersectionPlanes:r}=e.clippingContext,i=null;if(t.length>0||r.length>0){let t=e.renderer.currentSamples;this.alphaToCoverage&&t>1?i=new xK(xK.ALPHA_TO_COVERAGE):e.stack.addToStack(new xK)}return i}setupHardwareClipping(e){if(this.hardwareClipping=!1,null===e.clippingContext)return;let t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.addToStack(new xK(xK.HARDWARE)),this.hardwareClipping=!0)}setupDepth(e){let{renderer:t,camera:r}=e,i=this.depthNode;if(null===i){let e=t.getMRT();e&&e.has("depth")?i=e.get("depth"):!0===t.logarithmicDepthBuffer&&(i=r.isPerspectiveCamera?xj(yp.z,vV,vz):xk(yp.z,vV,vz))}null!==i&&xq.assign(i).toStack()}setupPositionView(){return yi.mul(yu).xyz}setupModelViewProjection(){return vH.mul(yp)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),_8}setupPosition(e){let{object:t,geometry:r}=e;if((r.morphAttributes.position||r.morphAttributes.normal||r.morphAttributes.color)&&xA(t).toStack(),!0===t.isSkinnedMesh&&xg(t).toStack(),this.displacementMap){let e=yK("displacementMap","texture"),t=yK("displacementScale","float"),r=yK("displacementBias","float");yu.addAssign(yx.normalize().mul(e.x.mul(t).add(r)))}return t.isBatchedMesh&&xp(t).toStack(),t.isInstancedMesh&&t.instanceMatrix&&!0===t.instanceMatrix.isInstancedBufferAttribute&&xd(t).toStack(),null!==this.positionNode&&yu.assign(gm(this.positionNode,"POSITION","vec3")),yu}setupDiffuseColor(e){let{object:t,geometry:r}=e;null!==this.maskNode&&pI(this.maskNode).not().discard();let i=this.colorNode?pz(this.colorNode):_T;!0===this.vertexColors&&r.hasAttribute("color")&&(i=i.mul(x1())),t.instanceColor&&(i=pZ("vec3","vInstanceColor").mul(i)),t.isBatchedMesh&&t._colorsTexture&&(i=pZ("vec3","vBatchColor").mul(i)),p0.assign(i);let n=this.opacityNode?pN(this.opacityNode):_E;p0.a.assign(p0.a.mul(n));let a=null;(null!==this.alphaTestNode||this.alphaTest>0)&&(a=null!==this.alphaTestNode?pN(this.alphaTestNode):_S,!0===this.alphaToCoverage?(p0.a=m4(a,a.add(mF(p0.a)),p0.a),p0.a.lessThanEqual(0).discard()):p0.a.lessThanEqual(a).discard()),!0===this.alphaHash&&p0.a.lessThan(xZ(yu)).discard(),e.isOpaque()&&p0.a.assign(1)}setupVariants(){}setupOutgoingLight(){return!0===this.lights?pO(0):p0.rgb}setupNormal(){return this.normalNode?pO(this.normalNode):_P}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?yK("envMap","cubeTexture"):yK("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new xR(_3)),t}setupLights(e){let t=[],r=this.setupEnvironment(e);r&&r.isLightingNode&&t.push(r);let i=this.setupLightMap(e);i&&i.isLightingNode&&t.push(i);let n=this.aoNode;null===n&&e.material.aoMap&&(n=_4),e.context.getAO&&(n=e.context.getAO(n,e)),n&&t.push(new xE(n));let a=this.lightsNode||e.lightsNode;return t.length>0&&(a=e.renderer.lighting.createNode([...a.getLights(),...t])),a}setupLightingModel(){}setupLighting(e){let{material:t}=e,{backdropNode:r,backdropAlphaNode:i,emissiveNode:n}=this,a=!0===this.lights||null!==this.lightsNode?this.setupLights(e):null,s=this.setupOutgoingLight(e);return a&&a.getScope().hasLights?s=xw(a,this.setupLightingModel(e)||null,r,i):null!==r&&(s=pO(null!==i?m0(s,r,i):r)),(n&&!0===n.isNode||t.emissive&&!0===t.emissive.isColor)&&(p2.assign(pO(n||_M)),s=s.add(p2)),s}setupFog(e,t){let r=e.fogNode;return r&&(fh.assign(t),t=pz(r.toVar())),t}setupPremultipliedAlpha(e,t){return x6(t)}setupOutput(e,t){return!0===this.fog&&(t=this.setupFog(e,t)),!0===this.premultipliedAlpha&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(let t in e){let r=e[t];void 0===this[t]&&(this[t]=r,r&&r.clone&&(this[t]=r.clone()))}let t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(let e in t)void 0===Object.getOwnPropertyDescriptor(this.constructor.prototype,e)&&void 0!==t[e].get&&Object.defineProperty(this.constructor.prototype,e,t[e])}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{},nodes:{}});let r=rb.prototype.toJSON.call(this,e);for(let{property:t,childNode:i}of(r.inputNodes={},this._getNodeChildren()))r.inputNodes[t]=i.toJSON(e).uuid;function i(e){let t=[];for(let r in e){let i=e[r];delete i.metadata,t.push(i)}return t}if(t){let t=i(e.textures),n=i(e.images),a=i(e.nodes);t.length>0&&(r.textures=t),n.length>0&&(r.images=n),a.length>0&&(r.nodes=a)}return r}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.aoNode=e.aoNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.maskNode=e.maskNode,this.maskShadowNode=e.maskShadowNode,this.positionNode=e.positionNode,this.geometryNode=e.geometryNode,this.depthNode=e.depthNode,this.receivedShadowPositionNode=e.receivedShadowPositionNode,this.castShadowPositionNode=e.castShadowPositionNode,this.receivedShadowNode=e.receivedShadowNode,this.castShadowNode=e.castShadowNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,this.contextNode=e.contextNode,super.copy(e)}}let be=new iQ;class bt extends x7{static get type(){return"LineBasicNodeMaterial"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(be),this.setValues(e)}}let br=new aH;class bi extends x7{static get type(){return"LineDashedNodeMaterial"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(br),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){let e=this.offsetNode?pN(this.offsetNode):_0,t=this.dashScaleNode?pN(this.dashScaleNode):_K,r
397=this.dashSizeNode?pN(this.dashSizeNode):_Y,i=this.gapSizeNode?pN(this.gapSizeNode):_Q;fd.assign(r),fc.assign(i);let n=gv(g6("lineDistance").mul(t));(e?n.add(e):n).mod(fd.add(fc)).greaterThan(fd).discard()}}let bn=new aH;class ba extends x7{static get type(){return"Line2NodeMaterial"}constructor(e={}){super(),this.isLine2NodeMaterial=!0,this.setDefaultValues(bn),this.vertexColors=e.vertexColors,this.dashOffset=0,this.lineColorNode=null,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.blending=0,this._useDash=e.dashed,this._useAlphaToCoverage=!0,this._useWorldUnits=!1,this.setValues(e)}setup(e){let{renderer:t}=e,r=this._useAlphaToCoverage,i=this.vertexColors,n=this._useDash,a=this._useWorldUnits,s=pA(({start:e,end:t})=>{let r=vH.element(2).element(2),i=vH.element(3).element(2).mul(-.5).div(r).sub(e.z).div(t.z.sub(e.z));return pz(m0(e.xyz,t.xyz,i),t.w)}).setLayout({name:"trimSegment",type:"vec4",inputs:[{name:"start",type:"vec4"},{name:"end",type:"vec4"}]});this.vertexNode=pA(()=>{let e=g6("instanceStart"),t=g6("instanceEnd"),r=pz(yi.mul(pz(e,1))).toVar("start"),i=pz(yi.mul(pz(t,1))).toVar("end");if(n){let e=this.dashScaleNode?pN(this.dashScaleNode):_K,t=this.offsetNode?pN(this.offsetNode):_0,r=g6("instanceDistanceStart"),i=g6("instanceDistanceEnd"),n=yl.y.lessThan(.5).select(e.mul(r),e.mul(i));n=n.add(t),pZ("float","lineDistance").assign(n)}a&&(pZ("vec3","worldStart").assign(r.xyz),pZ("vec3","worldEnd").assign(i.xyz));let o=vb.z.div(vb.w);pC(vH.element(2).element(3).equal(-1),()=>{pC(r.z.lessThan(0).and(i.z.greaterThan(0)),()=>{i.assign(s({start:r,end:i}))}).ElseIf(i.z.lessThan(0).and(r.z.greaterThanEqual(0)),()=>{r.assign(s({start:i,end:r}))})});let l=vH.mul(r),u=vH.mul(i),h=l.xyz.div(l.w),d=u.xyz.div(u.w),c=d.xy.sub(h.xy).toVar();c.x.assign(c.x.mul(o)),c.assign(c.normalize());let p=pz().toVar();if(a){let e=i.xyz.sub(r.xyz).normalize(),t=m0(r.xyz,i.xyz,.5).normalize(),a=e.cross(t).normalize(),s=e.cross(a),o=pZ("vec4","worldPos");o.assign(yl.y.lessThan(.5).select(r,i));let l=_Z.mul(.5);o.addAssign(pz(yl.x.lessThan(0).select(a.mul(l),a.mul(l).negate()),0)),n||(o.addAssign(pz(yl.y.lessThan(.5).select(e.mul(l).negate(),e.mul(l)),0)),o.addAssign(pz(s.mul(l),0)),pC(yl.y.greaterThan(1).or(yl.y.lessThan(0)),()=>{o.subAssign(pz(s.mul(2).mul(l),0))})),p.assign(vH.mul(o));let u=pO().toVar();u.assign(yl.y.lessThan(.5).select(h,d)),p.z.assign(u.z.mul(p.w))}else{let e=pP(c.y,c.x.negate()).toVar("offset");c.x.assign(c.x.div(o)),e.x.assign(e.x.div(o)),e.assign(yl.x.lessThan(0).select(e.negate(),e)),pC(yl.y.lessThan(0),()=>{e.assign(e.sub(c))}).ElseIf(yl.y.greaterThan(1),()=>{e.assign(e.add(c))}),e.assign(e.mul(_Z)),e.assign(e.div(vb.w.div(vv))),p.assign(yl.y.lessThan(.5).select(l,u)),e.assign(e.mul(p.w)),p.assign(p.add(pz(e,0,0)))}return p})();let o=pA(({p1:e,p2:t,p3:r,p4:i})=>{let n=e.sub(r),a=i.sub(r),s=t.sub(e),o=n.dot(a),l=a.dot(s),u=n.dot(s),h=a.dot(a),d=s.dot(s).mul(h).sub(l.mul(l)),c=o.mul(l).sub(u.mul(h)).div(d).clamp(),p=o.add(l.mul(c)).div(h).clamp();return pP(c,p)});if(this.colorNode=pA(()=>{let e,s=g9();if(n){let e=this.dashSizeNode?pN(this.dashSizeNode):_Y,t=this.gapSizeNode?pN(this.gapSizeNode):_Q;fd.assign(e),fc.assign(t);let r=pZ("float","lineDistance");s.y.lessThan(-1).or(s.y.greaterThan(1)).discard(),r.mod(fd.add(fc)).greaterThan(fd).discard()}let l=pN(1).toVar("alpha");if(a){let e=pZ("vec3","worldStart"),i=pZ("vec3","worldEnd"),a=pZ("vec4","worldPos").xyz.normalize().mul(1e5),s=i.sub(e),u=o({p1:e,p2:i,p3:pO(0,0,0),p4:a}),h=e.add(s.mul(u.x)),d=a.mul(u.y),c=h.sub(d).length().div(_Z);if(!n)if(r&&t.currentSamples>0){let e=c.fwidth();l.assign(m4(e.negate().add(.5),e.add(.5),c).oneMinus())}else c.greaterThan(.5).discard()}else if(r&&t.currentSamples>0){let e=s.x,t=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1)),r=e.mul(e).add(t.mul(t)),i=pN(r.fwidth()).toVar("dlen");pC(s.y.abs().greaterThan(1),()=>{l.assign(m4(i.oneMinus(),i.add(1),r).oneMinus())})}else pC(s.y.abs().greaterThan(1),()=>{let e=s.x,t=s.y.greaterThan(0).select(s.y.sub(1),s.y.add(1));e.mul(e).add(t.mul(t)).greaterThan(1).discard()});if(this.lineColorNode)e=this.lineColorNode;else if(i){let t=g6("instanceColorStart"),r=g6("instanceColorEnd");e=yl.y.lessThan(.5).select(t,r).mul(_T)}else e=_T;return pz(e,l)})(),this.transparent){let e=this.opacityNode?pN(this.opacityNode):_E;this.outputNode=pz(this.colorNode.rgb.mul(e).add(xF().rgb.mul(e.oneMinus())),this.colorNode.a)}super.setup(e)}get worldUnits(){return this._useWorldUnits}set worldUnits(e){this._useWorldUnits!==e&&(this._useWorldUnits=e,this.needsUpdate=!0)}get dashed(){return this._useDash}set dashed(e){this._useDash!==e&&(this._useDash=e,this.needsUpdate=!0)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}}let bs=new aO;class bo extends x7{static get type(){return"MeshNormalNodeMaterial"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(bs),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?pN(this.opacityNode):_E;p0.assign(gA(pz(_c(yA),e),O))}}let bl=pA(([e=yc])=>pP(e.z.atan(e.x).mul(1/(2*Math.PI)).add(.5),e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5)));class bu extends eV{constructor(e=1,t={}){super(e,e,t),this.isCubeRenderTarget=!0;const r={width:e,height:e,depth:1};this.texture=new nm([r,r,r,r,r,r]),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){let r=t.minFilter,i=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace
397=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n=new nx(5,5,5),a=bl(yc),s=new x7;s.colorNode=vo(t,a,0),s.side=1,s.blending=0;let o=new r8(n,s),l=new tS;l.add(o),1008===t.minFilter&&(t.minFilter=1006);let u=new s1(1,10,this),h=e.getMRT();return e.setMRT(null),u.update(e,l),e.setMRT(h),t.minFilter=r,t.currentGenerateMipmaps=i,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,r=!0,i=!0){let n=e.getRenderTarget();for(let n=0;n<6;n++)e.setRenderTarget(this,n),e.clear(t,r,i);e.setRenderTarget(n)}}let bh=new WeakMap;class bd extends cV{static get type(){return"CubeMapNode"}constructor(e){super("vec3"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=yW(null);const t=new nm;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=cR.RENDER}updateBefore(e){let{renderer:t,material:r}=e,i=this.envNode;if(i.isTextureNode||i.isMaterialReferenceNode){let e=i.isTextureNode?i.value:r[i.property];if(e&&e.isTexture){let r=e.mapping;if(303===r||304===r){if(bh.has(e)){let t=bh.get(e);bp(t,e.mapping),this._cubeTexture=t}else{var n;let r=e.image;if(null!=(n=r)&&n.height>0){let i=new bu(r.height);i.fromEquirectangularTexture(t,e),bp(i.texture,e.mapping),this._cubeTexture=i.texture,bh.set(e,i.texture),e.addEventListener("dispose",bc)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}}function bc(e){let t=e.target;t.removeEventListener("dispose",bc);let r=bh.get(t);void 0!==r&&(bh.delete(t),r.dispose())}function bp(e,t){303===t?e.mapping=301:304===t&&(e.mapping=302)}let bf=p_(bd).setParameterLength(1);class bm extends xM{static get type(){return"BasicEnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=bf(this.envNode)}}class bg extends xM{static get type(){return"BasicLightMapNode"}constructor(e=null){super(),this.lightMapNode=e}setup(e){let t=pN(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}}class bv{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}}class by extends bv{constructor(){super()}indirect({context:e}){let t=e.ambientOcclusion,r=e.reflectedLight,i=e.irradianceLightMap;r.indirectDiffuse.assign(pz(0)),i?r.indirectDiffuse.addAssign(i):r.indirectDiffuse.addAssign(pz(1,1,1,0)),r.indirectDiffuse.mulAssign(t),r.indirectDiffuse.mulAssign(p0.rgb)}finish(e){let{material:t,context:r}=e,i=r.outgoingLight,n=e.context.environment;if(n)switch(t.combine){case 0:i.rgb.assign(m0(i.rgb,i.rgb.mul(n.rgb),_N.mul(_L)));break;case 1:i.rgb.assign(m0(i.rgb,n.rgb,_N.mul(_L)));break;case 2:i.rgb.addAssign(n.rgb.mul(_N.mul(_L)));break;default:en("BasicLightingModel: Unsupported .combine value:",t.combine)}}}let b_=new r$;class bx extends x7{static get type(){return"MeshBasicNodeMaterial"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(b_),this.setValues(e)}setupNormal(){return yy(yS)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new bm(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new bg(_3)),t}setupOutgoingLight(){return p0.rgb}setupLightingModel(){return new by}}let bb=pA(({f0:e,f90:t,dotVH:r})=>{let i=r.mul(-5.55473).sub(6.98316).mul(r).exp2();return e.mul(i.oneMinus()).add(t.mul(i))}),bS=pA(e=>e.diffuseColor.mul(1/Math.PI)),bT=pA(({dotNH:e})=>fu.mul(pN(.5)).add(1).mul(pN(1/Math.PI)).mul(e.pow(fu))),bA=pA(({lightDirection:e})=>{let t=e.add(yf).normalize(),r=yA.dot(t).clamp(),i=bb({f0:fs,f90:1,dotVH:yf.dot(t).clamp()}),n=pN(.25),a=bT({dotNH:r});return i.mul(n).mul(a)});class bM extends by{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:r}){let i=yA.dot(e).clamp().mul(t);r.directDiffuse.addAssign(i.mul(bS({diffuseColor:p0.rgb}))),!0===this.specular&&r.directSpecular.addAssign(i.mul(bA({lightDirection:e})).mul(_N))}indirect(e){let{ambientOcclusion:t,irradiance:r,reflectedLight:i}=e.context;i.indirectDiffuse.addAssign(r.mul(bS({diffuseColor:p0}))),i.indirectDiffuse.mulAssign(t)}}let bE=new aG;class bC extends x7{static get type(){return"MeshLambertNodeMaterial"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(bE),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new bm(t):null}setupLightingModel(){return new bM(!1)}}let bw=new aD;class bR extends x7{static get type(){return"MeshPhongNodeMaterial"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(bw),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new bm(t):null}setupLightingModel(){return new bM}setupVariants(){let e=(this.shininessNode?pN(this.shininessNode):_A).max(1e-4);fu.assign(e);let t=this.specularNode||_C;fs.assign(t)}copy(e){return this.shininessNode=e.shininessNode,this.specularNode=e.specularNode,super.copy(e)}}let bN=pA(e=>{if(!1===e.geometry.hasAttribute("normal"))return pN(0);let t=yS.dFdx().abs().max(yS.dFdy().abs());return t.x.max(t.y).max(t.z)}),bL=pA(e=>{let{roughness:t}=e,r=bN(),i=t.max(.0525);return(i=i.add(r)).min(1)}),bB=pA(({alpha:e,dotNL:t,dotNV:r})=>{let i=e.pow2(),n=t.mul(i.add(i.oneMinus().mul(r.pow2())).sqrt()),a=r.mul(i.add(i.oneMinus().mul(t.pow2())).sqrt());return fG(.5,n.add(a).max(f7))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),bI=pA(({alphaT:e,alphaB:t,dotTV:r,dotBV:i,dotTL:n,dotBL:a,dotNV:s,dotNL:o})=>{let l=o.mul(pO(e.mul(r),t.mul(i),s).length()),u=s.mul(pO(e.mul(n),t.mul(a),o).length());return fG(.5,l.add(u))}
vendor: 2,730 bytes, line 397
397).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),bP=pA(({alpha:e,dotNH:t})=>{let r=e.pow2(),i=t.pow2().mul(r.oneMinus()).oneMinus();return r.div(i.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),bF=pN(1/Math.PI),bD=pA(({alphaT:e,alphaB:t,dotNH:r,dotTH:i,dotBH:n})=>{let a=e.mul(t),s=pO(t.mul(i),e.mul(n),a.mul(r)),o=s.dot(s),l=a.div(o);return bF.mul(a.mul(l.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),bU=pA(({lightDirection:e,f0:t,f90:r,roughness:i,f:n,normalView:a=yA,USE_IRIDESCENCE:s,USE_ANISOTROPY:o})=>{let l,u,h=i.pow2(),d=e.add(yf).normalize(),c=a.dot(e).clamp(),p=a.dot(yf).clamp(),f=a.dot(d).clamp(),m=bb({f0:t,f90:r,dotVH:yf.dot(d).clamp()});if(pc(s)&&(m=p7.mix(m,n)),pc(o)){let t=fn.dot(e),r=fn.dot(yf),i=fn.dot(d),n=fa.dot(e),a=fa.dot(yf),s=fa.dot(d);l=bI({alphaT:fr,alphaB:h,dotTV:r,dotBV:a,dotTL:t,dotBL:n,dotNV:p,dotNL:c}),u=bD({alphaT:fr,alphaB:h,dotNH:f,dotTH:i,dotBH:s})}else l=bB({alpha:h,dotNL:c,dotNV:p}),u=bP({alpha:h,dotNH:f});return m.mul(l).mul(u)}),bO=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,
vendor: 3,200 bytes, line 397
39714942,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]),bG=null,bk=pA(({roughness:e,dotNV:t})=>{null===bG&&((bG=new ih(bO,16,16,1030,1016)).name="DFG_LUT",bG.minFilter=1006,bG.magFilter=1006,bG.wrapS=1001,bG.wrapT=1001,bG.generateMipmaps=!1,bG.needsUpdate=!0);let r=pP(e,t);return vo(bG,r).rg}),bV=pA(({lightDirection:e,f0:t,f90:r,roughness:i,f:n,USE_IRIDESCENCE:a,USE_ANISOTROPY:s})=>{let o=bU({lightDirection:e,f0:t,f90:r,roughness:i,f:n,USE_IRIDESCENCE:a,USE_ANISOTROPY:s}),l=yA.dot(e).clamp(),u=bk({roughness:i,dotNV:yA.dot(yf).clamp()}),h=bk({roughness:i,dotNV:l}),d=t.mul(u.x).add(r.mul(u.y)),c=t.mul(h.x).add(r.mul(h.y)),p=u.x.add(u.y),f=h.x.add(h.y),m=pN(1).sub(p),g=pN(1).sub(f),v=t.add(t.oneMinus().mul(.047619)),y=d.mul(c).mul(v).div(pN(1).sub(m.mul(g).mul(v).mul(v)).add(f7)),_=m.mul(g),x=y.mul(_);return o.add(x)}),bz=pA(e=>{let{dotNV:t,specularColor:r,specularF90:i,roughness:n}=e,a=bk({dotNV:t,roughness:n});return r.mul(a.x).add(i.mul(a.y))}),bH=pA(({f:e,f90:t,dotVH:r})=>{let i=r.oneMinus().saturate(),n=i.mul(i),a=i.mul(n,n).clamp(0,.9999);return e.sub(pO(t).mul(a)).div(a.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),bW=pA(({roughness:e,dotNH:t})=>{let r=e.pow2(),i=pN(1).div(r),n=t.pow2().oneMinus().max(.0078125);return pN(2).add(i).mul(n.pow(i.mul(.5))).div(2*Math.PI)}
vendor: 4,322 bytes, line 397
397).setLayout({name:"D_Charlie",type:"float",inputs:[{name:"roughness",type:"float"},{name:"dotNH",type:"float"}]}),bj=pA(({dotNV:e,dotNL:t})=>pN(1).div(pN(4).mul(t.add(e).sub(t.mul(e))))).setLayout({name:"V_Neubelt",type:"float",inputs:[{name:"dotNV",type:"float"},{name:"dotNL",type:"float"}]}),bX=pA(({lightDirection:e})=>{let t=e.add(yf).normalize(),r=yA.dot(e).clamp(),i=yA.dot(yf).clamp(),n=bW({roughness:p9,dotNH:yA.dot(t).clamp()}),a=bj({dotNV:i,dotNL:r});return p6.mul(n).mul(a)}),bq=pA(({N:e,V:t,roughness:r})=>{let i=pP(r,e.dot(t).saturate().oneMinus().sqrt());return i.assign(i.mul(.984375).add(.0078125)),i}).setLayout({name:"LTC_Uv",type:"vec2",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"roughness",type:"float"}]}),b$=pA(({f:e})=>{let t=e.length();return mk(t.mul(t).add(e.z).div(t.add(1)),0)}).setLayout({name:"LTC_ClippedSphereFormFactor",type:"float",inputs:[{name:"f",type:"vec3"}]}),bJ=pA(({v1:e,v2:t})=>{let r=e.dot(t),i=r.abs().toVar(),n=i.mul(.0145206).add(.4965155).mul(i).add(.8543985).toVar(),a=i.add(4.1616724).mul(i).add(3.417594).toVar(),s=n.div(a),o=r.greaterThan(0).select(s,mk(r.mul(r).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(s));return e.cross(t).mul(o)}).setLayout({name:"LTC_EdgeVectorFormFactor",type:"vec3",inputs:[{name:"v1",type:"vec3"},{name:"v2",type:"vec3"}]}),bK=pA(({N:e,V:t,P:r,mInv:i,p0:n,p1:a,p2:s,p3:o})=>{let l=a.sub(n).toVar(),u=o.sub(n).toVar(),h=l.cross(u),d=pO().toVar();return pC(h.dot(r.sub(n)).greaterThanEqual(0),()=>{let l=t.sub(e.mul(t.dot(e))).normalize(),u=e.cross(l).negate(),h=i.mul(pq(l,u,e).transpose()).toVar(),c=h.mul(n.sub(r)).normalize().toVar(),p=h.mul(a.sub(r)).normalize().toVar(),f=h.mul(s.sub(r)).normalize().toVar(),m=h.mul(o.sub(r)).normalize().toVar(),g=pO(0).toVar();g.addAssign(bJ({v1:c,v2:p})),g.addAssign(bJ({v1:p,v2:f})),g.addAssign(bJ({v1:f,v2:m})),g.addAssign(bJ({v1:m,v2:c})),d.assign(pO(b$({f:g})))}),d}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"N",type:"vec3"},{name:"V",type:"vec3"},{name:"P",type:"vec3"},{name:"mInv",type:"mat3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),bY=pA(({P:e,p0:t,p1:r,p2:i,p3:n})=>{let a=r.sub(t).toVar(),s=n.sub(t).toVar(),o=a.cross(s),l=pO().toVar();return pC(o.dot(e.sub(t)).greaterThanEqual(0),()=>{let a=t.sub(e).normalize().toVar(),s=r.sub(e).normalize().toVar(),o=i.sub(e).normalize().toVar(),u=n.sub(e).normalize().toVar(),h=pO(0).toVar();h.addAssign(bJ({v1:a,v2:s})),h.addAssign(bJ({v1:s,v2:o})),h.addAssign(bJ({v1:o,v2:u})),h.addAssign(bJ({v1:u,v2:a})),l.assign(pO(b$({f:h.abs()})))}),l}).setLayout({name:"LTC_Evaluate",type:"vec3",inputs:[{name:"P",type:"vec3"},{name:"p0",type:"vec3"},{name:"p1",type:"vec3"},{name:"p2",type:"vec3"},{name:"p3",type:"vec3"}]}),bQ=1/6,bZ=e=>fO(bQ,fO(e,fO(e,e.negate().add(3)).sub(3)).add(1)),b0=e=>fO(bQ,fO(e,fO(e,fO(3,e).sub(6))).add(4)),b1=e=>fO(bQ,fO(e,fO(e,fO(-3,e).add(3)).add(3)).add(1)),b2=e=>fO(bQ,mq(e,3)),b3=e=>bZ(e).add(b0(e)),b4=e=>b1(e).add(b2(e)),b5=e=>fD(-1,b0(e).div(bZ(e).add(b0(e)))),b8=e=>fD(1,b2(e).div(b1(e).add(b2(e)))),b6=(e,t,r)=>{let i=fO(e.uvNode,t.zw).add(.5),n=mm(i),a=my(i),s=b3(a.x),o=b4(a.x),l=b5(a.x),u=b8(a.x),h=b5(a.y),d=b8(a.y),c=pP(n.x.add(l),n.y.add(h)).sub(.5).mul(t.xy),p=pP(n.x.add(u),n.y.add(h)).sub(.5).mul(t.xy),f=pP(n.x.add(l),n.y.add(d)).sub(.5).mul(t.xy),m=pP(n.x.add(u),n.y.add(d)).sub(.5).mul(t.xy),g=b3(a.y).mul(fD(s.mul(e.sample(c).level(r)),o.mul(e.sample(p).level(r)))),v=b4(a.y).mul(fD(s.mul(e.sample(f).level(r)),o.mul(e.sample(m).level(r))));return g.add(v)},b9=pA(([e,t])=>{let r=pP(e.size(pL(t))),i=pP(e.size(pL(t.add(1)))),n=fG(1,r),a=fG(1,i),s=b6(e,pz(n,r),mm(t)),o=b6(e,pz(a,i),mg(t));return my(t).mix(s,o)}),b7=pA(([e,t])=>{let r=t.mul(vr(e));return b9(e,r)}),Se=pA(([e,t,r,i,n])=>{let a=pO(m3(t.negate(),mv(e),fG(1,i))),s=pO(mC(n[0].xyz),mC(n[1].xyz),mC(n[2].xyz));return mv(a).mul(r.mul(s))}).setLayout({name:"getVolumeTransmissionRay",type:"vec3",inputs:[{name:"n",type:"vec3"},{name:"v",type:"vec3"},{name:"thickness",type:"float"},{name:"ior",type:"float"},{name:"modelMatrix",type:"mat4"}]}),St=pA(([e,t])=>e.mul(m1(t.mul(2).sub(2),0,1))).setLayout({name:"applyIorToRoughness",type:"float",inputs:[{name:"roughness",type:"float"},{name:"ior",type:"float"}]}),Sr=xI(),Si=xF(),Sn=pA(([e,t,r],{material:i}
397)=>b9((1===i.side?Sr:Si).sample(e),mc(v_.x).mul(St(t,r)))),Sa=pA(([e,t,r])=>(pC(r.notEqual(0),()=>mu(md(t).negate().div(r).negate().mul(e))),pO(1))).setLayout({name:"volumeAttenuation",type:"vec3",inputs:[{name:"transmissionDistance",type:"float"},{name:"attenuationColor",type:"vec3"},{name:"attenuationDistance",type:"float"}]}),Ss=pA(([e,t,r,i,n,a,s,o,l,u,h,d,c,p,f])=>{let m,g;if(f){m=pz().toVar(),g=pO().toVar();let n=h.sub(1).mul(f.mul(.025)),a=pO(h.sub(n),h,h.add(n));xy({start:0,end:3},({i:n})=>{let h=a.element(n),f=Se(e,t,d,h,o),v=s.add(f),y=u.mul(l.mul(pz(v,1))),_=pP(y.xy.div(y.w)).toVar();_.addAssign(1),_.divAssign(2),_.assign(pP(_.x,_.y.oneMinus()));let x=Sn(_,r,h);m.element(n).assign(x.element(n)),m.a.addAssign(x.a),g.element(n).assign(i.element(n).mul(Sa(mC(f),c,p).element(n)))}),m.a.divAssign(3)}else{let n=Se(e,t,d,h,o),a=s.add(n),f=u.mul(l.mul(pz(a,1))),v=pP(f.xy.div(f.w)).toVar();v.addAssign(1),v.divAssign(2),v.assign(pP(v.x,v.y.oneMinus())),m=Sn(v,r,h),g=i.mul(Sa(mC(n),c,p))}let v=g.rgb.mul(m.rgb),y=pO(bz({dotNV:e.dot(t).clamp(),specularColor:n,specularF90:a,roughness:r})),_=g.r.add(g.g,g.b).div(3);return pz(y.oneMinus().mul(v),m.a.oneMinus().mul(_).oneMinus())}),So=pq(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),Sl=(e,t)=>e.sub(t).div(e.add(t)).pow2(),Su=pA(({outsideIOR:e,eta2:t,cosTheta1:r,thinFilmThickness:i,baseF0:n})=>{let a,s=m0(e,t,m4(0,.03,i)),o=e.div(s).pow2().mul(r.pow2().oneMinus()).oneMinus();pC(o.lessThan(0),()=>pO(1));let l=o.sqrt(),u=bb({f0:Sl(s,e),f90:1,dotVH:r}),h=u.oneMinus(),d=s.lessThan(e).select(Math.PI,0),c=pN(Math.PI).sub(d),p=(a=n.clamp(0,.9999).sqrt(),pO(1).add(a).div(pO(1).sub(a))),f=bb({f0:Sl(p,s.toVec3()),f90:1,dotVH:l}),m=pO(p.x.lessThan(s).select(Math.PI,0),p.y.lessThan(s).select(Math.PI,0),p.z.lessThan(s).select(Math.PI,0)),g=s.mul(i,l,2),v=pO(c).add(m),y=u.mul(f).clamp(1e-5,.9999),_=y.sqrt(),x=h.pow2().mul(f).div(pO(1).sub(y)),b=u.add(x).toVar(),S=x.sub(h).toVar();return xy({start:1,end:2,condition:"<=",name:"m"},({m:e})=>{var t,r;let i,n,a,s,o,l;S.mulAssign(_);let u=(t=pN(e).mul(g),r=pN(e).mul(v),i=t.mul(2*Math.PI*1e-9),n=pO(54856e-17,44201e-17,52481e-17),a=pO(1681e3,1795300,2208400),s=pO(43278e5,93046e5,66121e5),o=pN(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(i.mul(2239900).add(r.x).cos()).mul(i.pow2().mul(-45282e5).exp()),l=pO((l=n.mul(s.mul(2*Math.PI).sqrt()).mul(a.mul(i).add(r).cos()).mul(i.pow2().negate().mul(s).exp())).x.add(o),l.y,l.z).div(10685e-11),So.mul(l)).mul(2);b.addAssign(S.mul(u))}),b.max(pO(0))}).setLayout({name:"evalIridescence",type:"vec3",inputs:[{name:"outsideIOR",type:"float"},{name:"eta2",type:"float"},{name:"cosTheta1",type:"float"},{name:"thinFilmThickness",type:"float"},{name:"baseF0",type:"vec3"}]}),Sh=pA(({normal:e,viewDir:t,roughness:r})=>{let i=e.dot(t).saturate(),n=r.mul(r),a=r.add(.1).reciprocal(),s=pN(-1.9362).add(r.mul(1.0678)).add(n.mul(.4573)).sub(a.mul(.8469)),o=pN(-.6014).add(r.mul(.5538)).sub(n.mul(.467)).sub(a.mul(.1255));return s.mul(i).add(o).exp().saturate()}),Sd=pO(.04),Sc=pN(1);class Sp extends bv{constructor(e=!1,t=!1,r=!1,i=!1,n=!1,a=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=r,this.anisotropy=i,this.transmission=n,this.dispersion=a,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(!0===this.clearcoat&&(this.clearcoatRadiance=pO().toVar("clearcoatRadiance"),this.clearcoatSpecularDirect=pO().toVar("clearcoatSpecularDirect"),this.clearcoatSpecularIndirect=pO().toVar("clearcoatSpecularIndirect")),!0===this.sheen&&(this.sheenSpecularDirect=pO().toVar("sheenSpecularDirect"),this.sheenSpecularIndirect=pO().toVar("sheenSpecularIndirect")),!0===this.iridescence){let e=yA.dot(yf).clamp(),t=Su({outsideIOR:pN(1),eta2:fe,cosTheta1:e,thinFilmThickness:ft,baseF0:fs}),r=Su({outsideIOR:pN(1),eta2:fe,cosTheta1:e,thinFilmThickness:ft,baseF0:p0.rgb});this.iridescenceFresnel=m0(t,r,p4),this.iridescenceF0Dielectric=bH({f:t,f90:1,dotVH:e}),this.iridescenceF0Metallic=bH({f:r,f90:1,dotVH:e}),this.iridescenceF0=m0(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,p4)}
vendor: 9,727 bytes, line 397
397if(!0===this.transmission){let t=v$.sub(yd).normalize(),r=e.context;r.backdrop=Ss(yM,t,p3,p1,fo,fl,yd,v8,vj,vH,ff,fg,fy,fv,this.dispersion?f_:null),r.backdropAlpha=fm,p0.a.mulAssign(m0(1,r.backdrop.a,fm))}super.start(e)}computeMultiscattering(e,t,r,i,n=null){let a=bk({roughness:p3,dotNV:yA.dot(yf).clamp()}),s=n?p7.mix(i,n):i,o=s.mul(a.x).add(r.mul(a.y)),l=a.x.add(a.y).oneMinus(),u=s.add(s.oneMinus().mul(.047619)),h=o.mul(u).div(l.mul(u).oneMinus());e.addAssign(o),t.addAssign(h.mul(l))}direct({lightDirection:e,lightColor:t,reflectedLight:r}){let i=yA.dot(e).clamp().mul(t).toVar();if(!0===this.sheen){this.sheenSpecularDirect.addAssign(i.mul(bX({lightDirection:e})));let t=Sh({normal:yA,viewDir:yf,roughness:p9}),r=Sh({normal:yA,viewDir:e,roughness:p9}),n=p6.r.max(p6.g).max(p6.b).mul(t.max(r)).oneMinus();i.mulAssign(n)}if(!0===this.clearcoat){let r=yE.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(r.mul(bU({lightDirection:e,f0:Sd,f90:Sc,roughness:p8,normalView:yE})))}r.directDiffuse.addAssign(i.mul(bS({diffuseColor:p1}))),r.directSpecular.addAssign(i.mul(bV({lightDirection:e,f0:fo,f90:1,roughness:p3,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:r,halfHeight:i,reflectedLight:n,ltc_1:a,ltc_2:s}){let o=t.add(r).sub(i),l=t.sub(r).sub(i),u=t.sub(r).add(i),h=t.add(r).add(i),d=yp.toVar(),c=bq({N:yA,V:yf,roughness:p3}),p=a.sample(c).toVar(),f=s.sample(c).toVar(),m=pq(pO(p.x,0,p.y),pO(0,1,0),pO(p.z,0,p.w)).toVar(),g=fo.mul(f.x).add(fl.sub(fo).mul(f.y)).toVar();if(n.directSpecular.addAssign(e.mul(g).mul(bK({N:yA,V:yf,P:d,mInv:m,p0:o,p1:l,p2:u,p3:h}))),n.directDiffuse.addAssign(e.mul(p1).mul(bK({N:yA,V:yf,P:d,mInv:pq(1,0,0,0,1,0,0,0,1),p0:o,p1:l,p2:u,p3:h}))),!0===this.clearcoat){let t=bq({N:yE,V:yf,roughness:p8}),r=a.sample(t),i=s.sample(t),n=pq(pO(r.x,0,r.y),pO(0,1,0),pO(r.z,0,r.w)),c=Sd.mul(i.x).add(Sc.sub(Sd).mul(i.y));this.clearcoatSpecularDirect.addAssign(e.mul(c).mul(bK({N:yE,V:yf,P:d,mInv:n,p0:o,p1:l,p2:u,p3:h})))}}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){let{irradiance:t,reflectedLight:r}=e.context,i=t.mul(bS({diffuseColor:p1})).toVar();if(!0===this.sheen){let e=Sh({normal:yA,viewDir:yf,roughness:p9}),t=p6.r.max(p6.g).max(p6.b).mul(e).oneMinus();i.mulAssign(t)}r.indirectDiffuse.addAssign(i)}indirectSpecular(e){let{radiance:t,iblIrradiance:r,reflectedLight:i}=e.context;if(!0===this.sheen&&this.sheenSpecularIndirect.addAssign(r.mul(p6,Sh({normal:yA,viewDir:yf,roughness:p9}))),!0===this.clearcoat){let e=bz({dotNV:yE.dot(yf).clamp(),specularColor:Sd,specularF90:Sc,roughness:p8});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(e))}let n=pO().toVar("singleScatteringDielectric"),a=pO().toVar("multiScatteringDielectric"),s=pO().toVar("singleScatteringMetallic"),o=pO().toVar("multiScatteringMetallic");this.computeMultiscattering(n,a,fl,fs,this.iridescenceF0Dielectric),this.computeMultiscattering(s,o,fl,p0.rgb,this.iridescenceF0Metallic);let l=m0(n,s,p4),u=m0(a,o,p4),h=n.add(a),d=p1.mul(h.oneMinus()),c=r.mul(1/Math.PI),p=t.mul(l).add(u.mul(c)).toVar(),f=d.mul(c).toVar();if(!0===this.sheen){let e=Sh({normal:yA,viewDir:yf,roughness:p9}),t=p6.r.max(p6.g).max(p6.b).mul(e).oneMinus();p.mulAssign(t),f.mulAssign(t)}i.indirectSpecular.addAssign(p),i.indirectDiffuse.addAssign(f)}ambientOcclusion(e){let{ambientOcclusion:t,reflectedLight:r}=e.context,i=yA.dot(yf).clamp().add(t),n=p3.mul(-16).oneMinus().negate().exp2(),a=t.sub(i.pow(n).oneMinus()).clamp();!0===this.clearcoat&&this.clearcoatSpecularIndirect.mulAssign(t),!0===this.sheen&&this.sheenSpecularIndirect.mulAssign(t),r.indirectDiffuse.mulAssign(t),r.indirectSpecular.mulAssign(a)}finish({context:e}){let{outgoingLight:t}=e;if(!0===this.clearcoat){let e=bb({dotVH:yE.dot(yf).clamp(),f0:Sd,f90:Sc}),r=t.mul(p5.mul(e).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(p5));t.assign(r)}if(!0===this.sheen){let e=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(e)}}}let Sf=pN(1),Sm=pN(-2),Sg=pN(.8),Sv=pN(-1),Sy=pN(.4),S_=pN(2),Sx=pN(.305),Sb=pN(3),SS=pN(.21),ST=pN(4),SA=pN(4),SM=pN(16),SE=pA(([e])=>{let t=pO(mM(e)).toVar(),r=pN(-1).toVar();return pC(t.x.greaterThan(t.z),()=>{pC(t.x.greaterThan(t.y),()=>{r.assign(gt(e.x.greaterThan(0),0,3))}).Else(()=>{r.assign(gt(e.y.greaterThan(0),1,4))})}).Else(()=>{pC(t.z.greaterThan(t.y),()=>{r.assign(gt(e.z.greaterThan(0),2,5))}).Else(()=>{r.assign(gt(e.y.greaterThan(0),1,4))})}),r}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),SC=pA(([e,t])=>{let r=pP().toVar();return pC(t.equal(0),()=>{r.assign(pP(e.z,e.y).div(mM(e.x)))}).ElseIf(t.equal(1),()=>{r.assign(pP(e.x.negate(),e.z.negate()).div(mM(e.y)))}).ElseIf(t.equal(2),()=>{r.assign(pP(e.x.negate(),e.y).div(mM(e.z)))}).ElseIf(t.equal(3),()=>{r.assign(pP(e.z.negate(),e.y).div(mM(e.x)))}).ElseIf(t.equal(4),()=>{r.assign(pP(e.x.negate(),e.z).div(mM(e.y)))}).Else(()=>{r.assign(pP(e.x,e.y).div(mM(e.z)))}),fO(.5,r.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),Sw=pA(([e])=>{let t=pN(0).toVar();return pC(e.greaterThanEqual(Sg),()=>{t.assign(Sf.sub(e).mul(Sv.sub(Sm)).div(Sf.sub(Sg)).add(Sm))}).ElseIf(e.greaterThanEqual(Sy),()=>{t.assign(Sg.sub(e).mul(S_.sub(Sv)).div(Sg.sub(Sy)).add(Sv))}).ElseIf(e.greaterThanEqual(Sx),()=>{t.assign(Sy.sub(e).mul(Sb.sub(S_)).div(Sy.sub(Sx)).add(S_))}).ElseIf(e.greaterThanEqual(SS),()=>{t.assign(Sx.sub(e).mul(ST.sub(Sb)).div(Sx.sub(SS)).add(Sb))}).Else(()=>{t.assign(pN(-2).mul(mc(fO(1.16,e))))}),t}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),SR=pA(([e,t])=>{let r=e.toVar();r.assign(fO(2,r).sub(1));let i=pO(r,1).toVar();return pC(t.equal(0),()=>{i.assign(i.zyx)}).ElseIf(t.equal(1),()=>{i.assign(i.xzy),i.xz.mulAssign(-1)}).ElseIf(t.equal(2),()=>{i.x.mulAssign(-1)}).ElseIf(t.equal(3),()=>{i.assign(i.zyx),i.xz.mulAssign(-1)}).ElseIf(t.equal(4),()=>{i.assign(i.xzy),i.xy.mulAssign(-1)}).ElseIf(t.equal(5),()=>{i.z.mulAssign(-1)}),i}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),SN=pA(([e,t,r,i,n,a])=>{let s=pN(r),o=pO(t),l=m1(Sw(s),Sm,a),u=my(l),h=mm(l),d=pO(SL(e,o,h,i,n,a)).toVar();return pC(u.notEqual(0),()=>{let t=pO(SL(e,o,h.add(1),i,n,a)).toVar();d.assign(m0(d,t,u))}),d}),SL=pA(([e,t,r,i,n,a])=>{let s=pN(r).toVar(),o=pO(t),l=pN(SE(o)).toVar(),u=pN(mk(SA.sub(s),0)).toVar();s.assign(mk(s,SA));let h=pN(mh(s)).toVar(),d=pP(SC(o,l).mul(h.sub(2)).add(1)).toVar();return pC(l.greaterThan(2),()=>{d.y.addAssign(h),l.subAssign(3)}),d.x.addAssign(l.mul(h)),d.x.addAssign(u.mul(fO(3,SM))),d.y.addAssign(fO(4,mh(a).sub(h))),d.x.mulAssign(i),d.y.mulAssign(n),e.sample(d).grad(pP(),pP())}),SB=pA(({envMap:e,mipInt:t,outputDirection:r,theta:i,axis:n,CUBEUV_TEXEL_WIDTH:a,CUBEUV_TEXEL_HEIGHT:s,CUBEUV_MAX_MIP:o})=>{let l=mx(i);return SL(e,r.mul(l).add(n.cross(r).mul(m_(i))).add(n.mul(n.dot(r).mul(l.oneMinus()))),t,a,s,o)}),SI=pA(({n:e,latitudinal:t,poleAxis:r,outputDirection:i,weights:n,samples:a,dTheta:s,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:h,CUBEUV_MAX_MIP:d})=>{let c=pO(gt(t,r,mX(r,i))).toVar();pC(c.equal(pO(0)),()=>{c.assign(pO(i.z,0,i.x.negate()))}),c.assign(mv(c));let p=pO().toVar();return p.addAssign(n.element(0).mul(SB({theta:0,axis:c,outputDirection:i,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:h,CUBEUV_MAX_MIP:d}))),xy({start:pL(1),end:e},({i:e})=>{pC(e.greaterThanEqual(a),()=>{x_()});let t=pN(s.mul(pN(e))).toVar();p.addAssign(n.element(e).mul(SB({theta:t.mul(-1),axis:c,outputDirection:i,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:h,CUBEUV_MAX_MIP:d}))),p.addAssign(n.element(e).mul(SB({theta:t,axis:c,outputDirection:i,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:h,CUBEUV_MAX_MIP:d})))}),pz(p,1)}),SP=pA(([e])=>{let t=pB(e).toVar();return t.assign(t.shiftLeft(pB(16)).bitOr(t.shiftRight(pB(16)))),t.assign(t.bitAnd(pB(0x55555555)).shiftLeft(pB(1)).bitOr(t.bitAnd(pB(0xaaaaaaaa)).shiftRight(pB(1)))),t.assign(t.bitAnd(pB(0x33333333)).shiftLeft(pB(2)).bitOr(t.bitAnd(pB(0xcccccccc)).shiftRight(pB(2)))),t.assign(t.bitAnd(pB(0xf0f0f0f)).shiftLeft(pB(4)).bitOr(t.bitAnd(pB(0xf0f0f0f0)).shiftRight(pB(4)))),t.assign(t.bitAnd(pB(0xff00ff)).shiftLeft(pB(8)).bitOr(t.bitAnd(pB(0xff00ff00)).shiftRight(pB(8)))),pN(t).mul(23283064365386963e-26)}),SF=pA(([e,t])=>pP(pN(e).div(pN(t)),SP(e))),SD=pA(([e,t,r])=>{let i=r.mul(r).toConst(),n=pO(1,0,0).toConst(),a=mX(t,n).toConst(),s=mp(e.x).toConst(),o=fO(2,3.14159265359).mul(e.y).toConst(),l=s.mul(mx(o)).toConst(),u=s.mul(m_(o)).toVar(),h=fO(.5,t.z.add(1)).toConst();u.assign(h.oneMinus().mul(mp(l.mul(l).oneMinus())).add(h.mul(u)));let d=n.mul(l).add(a.mul(u)).add(t.mul(mp(mk(0,l.mul(l).add(u.mul(u)).oneMinus()))));return mv(pO(i.mul(d.x),i.mul(d.y),mk(0,d.z)))}),SU=pA(({roughness:e,mipInt:t,envMap:r,N_immutable:i,GGX_SAMPLES:n,CUBEUV_TEXEL_WIDTH:a,CUBEUV_TEXEL_HEIGHT:s,CUBEUV_MAX_MIP:o})=>{let l=pO(i).toVar(),u=pO(0).toVar(),h=pN(0).toVar();return pC(e.lessThan(.001),()=>{u.assign(SL(r,l,t,a,s,o))}).Else(()=>{let i=mv(mX(gt(mM(l.z).lessThan(.999),pO(0,0,1),pO(1,0,0)),l)).toVar(),d=mX(l,i).toVar();xy({start:pB(0),end:n},({i:c})=>{let p=SD(SF(c,n),pO(0,0,1),e),f=mv(i.mul(p.x).add(d.mul(p.y)).add(l.mul(p.z))),m=mv(f.mul(mj(l,f).mul(2)).sub(l)),g=mk(mj(l,m),0);pC(g.greaterThan(0),()=>{let e=SL(r,m,t,a,s,o);u.addAssign(e.mul(g)),h.addAssign(g)})}),pC(h.greaterThan(0),()=>{u.assign(u.div(h))})}),pz(u,1)}),SO=[.125,.215,.35,.446,.526,.582],SG=new sB(-1,1,1,-1,0,1),Sk=new sC(90,1
397),SV=new ty,Sz=null,SH=0,SW=0,Sj=new eT,SX=new WeakMap,Sq=[3,1,5,0,4,2],S$=SR(g9(),g6("faceIndex")).normalize(),SJ=pO(S$.x,S$.y,S$.z);class SK{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,r=.1,i=100,n={}){let{size:a=256,position:s=Sj,renderTarget:o=null}=n;if(this._setSize(a),!1===this._hasInitialized){en('PMREMGenerator: ".fromScene()" called before the backend is initialized. Try using "await renderer.init()" instead.');let a=o||this._allocateTarget();return n.renderTarget=a,this.fromSceneAsync(e,t,r,i,n),a}Sz=this._renderer.getRenderTarget(),SH=this._renderer.getActiveCubeFace(),SW=this._renderer.getActiveMipmapLevel();let l=o||this._allocateTarget();return l.depthBuffer=!0,this._init(l),this._sceneToCubeUV(e,r,i,l,s),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}async fromSceneAsync(e,t=0,r=.1,i=100,n={}){return es('PMREMGenerator: ".fromSceneAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this.fromScene(e,t,r,i,n)}fromEquirectangular(e,t=null){if(!1===this._hasInitialized){en('PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Try using "await renderer.init()" instead.'),this._setSizeFromTexture(e);let r=t||this._allocateTarget();return this.fromEquirectangularAsync(e,r),r}return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return es('PMREMGenerator: ".fromEquirectangularAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(!1===this._hasInitialized){en("PMREMGenerator: .fromCubemap() called before the backend is initialized. Try using .fromCubemapAsync() instead."),this._setSizeFromTexture(e);let r=t||this._allocateTarget();return this.fromCubemapAsync(e,t),r}return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return es('PMREMGenerator: ".fromCubemapAsync()" is deprecated. Use "await renderer.init()" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=S0(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=S1(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){301===e.mapping||302===e.mapping?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Sz,SH,SW),e.scissorTest=!1,SQ(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),Sz=this._renderer.getRenderTarget(),SH=this._renderer.getActiveCubeFace(),SW=this._renderer.getActiveMipmapLevel();let r=t||this._allocateTarget();return this._init(r),this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTarget(){return SY(3*Math.max(this._cubeSize,112),4*this._cubeSize)}_init(e){if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e.width||this._pingPongRenderTarget.height!==e.height){var t,r,i,n,a,s;let o,l,u,h,d,c,p,f,m,g,v,y,_,x,b;null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=SY(e.width,e.height);let{_lodMax:S}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}
397=function(e){let t=[],r=[],i=[],n=e,a=e-4+1+SO.length;for(let s=0;s<a;s++){let a=Math.pow(2,n);t.push(a);let o=1/a;s>e-4?o=SO[s-e+4-1]:0===s&&(o=0),r.push(o);let l=1/(a-2),u=-l,h=1+l,d=[u,u,h,u,h,h,u,u,h,h,u,h],c=new Float32Array(108),p=new Float32Array(72),f=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,r=e>2?0:-1,i=[t,r,0,t+2/3,r,0,t+2/3,r+1,0,t,r,0,t+2/3,r+1,0,t,r+1,0],n=Sq[e];c.set(i,18*n),p.set(d,12*n);let a=[n,n,n,n,n,n];f.set(a,6*n)}let m=new rg;m.setAttribute("position",new t5(c,3)),m.setAttribute("uv",new t5(p,2)),m.setAttribute("faceIndex",new t5(f,1)),i.push(new r8(m,null)),n>4&&n--}return{lodMeshes:i,sizeLods:t,sigmas:r}}(S)),this._blurMaterial=(t=S,r=e.width,i=e.height,o=vp(Array(20).fill(0)),l=fC(new eT(0,1,0)),u=fC(0),h=pN(20),d=fC(0),c=fC(1),p=vo(),f=fC(0),m={n:h,latitudinal:d,weights:o,poleAxis:l,outputDirection:SJ,dTheta:u,samples:c,envMap:p,mipInt:f,CUBEUV_TEXEL_WIDTH:pN(1/r),CUBEUV_TEXEL_HEIGHT:pN(1/i),CUBEUV_MAX_MIP:pN(t)},(g=SZ("blur")).fragmentNode=SI({...m,latitudinal:d.equal(1)}),SX.set(g,m),g),this._ggxMaterial=(n=S,a=e.width,s=e.height,v=vo(),y=fC(0),_=fC(0),x={envMap:v,roughness:y,mipInt:_,CUBEUV_TEXEL_WIDTH:pN(1/a),CUBEUV_TEXEL_HEIGHT:pN(1/s),CUBEUV_MAX_MIP:pN(n)},(b=SZ("ggx")).fragmentNode=SU({...x,N_immutable:SJ,GGX_SAMPLES:pB(512)}),SX.set(b,x),b)}}async _compileMaterial(e){let t=new r8(new rg,e);await this._renderer.compile(t,SG)}_sceneToCubeUV(e,t,r,i,n){Sk.near=t,Sk.far=r;let a=[1,1,1,1,-1,1],s=[1,-1,1,-1,1,-1],o=this._renderer,l=o.autoClear;o.getClearColor(SV),o.autoClear=!1,null===this._backgroundBox&&(this._backgroundBox=new r8(new nx,new r$({name:"PMREM.Backgroun
397d",side:1,depthWrite:!1,depthTest:!1})));let u=this._backgroundBox,h=u.material,d=!1,c=e.background;c?c.isColor&&(h.color.copy(c),e.background=null,d=!0):(h.color.copy(SV),d=!0),o.setRenderTarget(i),o.clear(),d&&o.render(u,Sk);for(let t=0;t<6;t++){let r=t%3;0===r?(Sk.up.set(0,a[t],0),Sk.position.set(n.x,n.y,n.z),Sk.lookAt(n.x+s[t],n.y,n.z)):1===r?(Sk.up.set(0,0,a[t]),Sk.position.set(n.x,n.y,n.z),Sk.lookAt(n.x,n.y+s[t],n.z)):(Sk.up.set(0,a[t],0),Sk.position.set(n.x,n.y,n.z),Sk.lookAt(n.x,n.y,n.z+s[t]));let l=this._cubeSize;SQ(i,r*l,t>2?l:0,l,l),o.render(e,Sk)}o.autoClear=l,e.background=c}_textureToCubeUV(e,t){let r=this._renderer,i=301===e.mapping||302===e.mapping;i?null===this._cubemapMaterial&&(this._cubemapMaterial=S0(e)):null===this._equirectMaterial&&(this._equirectMaterial=S1(e));let n=i?this._cubemapMaterial:this._equirectMaterial;n.fragmentNode.value=e;let a=this._lodMeshes[0];a.material=n;let s=this._cubeSize;SQ(t,0,0,3*s,2*s),r.setRenderTarget(t),r.render(a,SG)}_applyPMREM(e){let t=this._renderer,r=t.autoClear;t.autoClear=!1;let i=this._lodMeshes.length;for(let t=1;t<i;t++)this._applyGGXFilter(e,t-1,t);t.autoClear=r}_applyGGXFilter(e,t,r){let i=this._renderer,n=this._pingPongRenderTarget,a=this._ggxMaterial,s=this._lodMeshes[r];s.material=a;let o=SX.get(a),l=r/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),h=Math.sqrt(l*l-u*u),{_lodMax:d}=this,c=this._sizeLods[r],p=3*c*(r>d-4?r-d+4:0),f=4*(this._cubeSize-c);e.texture.frame=(e.texture.frame||0)+1,o.envMap.value=e.texture,o.roughness.value=h*(0+1.25*l),o.mipInt.value=d-t,SQ(n,p,f,3*c,2*c),i.setRenderTarget(n),i.render(s,SG),n.texture.frame=(n.texture.frame||0)+1,o.envMap.value=n.texture,o.roughness.value=0,o.mipInt.value=d-r,SQ(e,p,f,3*c,2*c),i.setRenderTarget(e),i.render(s,SG)}_blur(e,t,r,i,n){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,r,i,"latitudinal",n),this._halfBlur(a,e,r,r,i,"longitudinal",n)}_halfBlur(e,t,r,i,n,a,s){let o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&ea("blur direction must be either latitudinal or longitudinal!");let u=this._lodMeshes[i];u.material=l;let h=SX.get(l),d=this._sizeLods[r]-1,c=isFinite(n)?Math.PI/(2*d):2*Math.PI/39,p=n/c,f=isFinite(n)?1+Math.floor(3*p):20;f>20&&en(`sigmaRadians, ${n}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);let m=[],g=0;for(let e=0;e<20;++e){let t=e/p,r=Math.exp(-t*t/2);m.push(r),0===e?g+=r:e<f&&(g+=2*r)}for(let e=0;e<m.length;e++)m[e]=m[e]/g;e.texture.frame=(e.texture.frame||0)+1,h.envMap.value=e.texture,h.samples.value=f,h.weights.array=m,h.latitudinal.value=+("latitudinal"===a),s&&(h.poleAxis.value=s);let{_lodMax:v}=this;h.dTheta.value=c,h.mipInt.value=v-r;let y=this._sizeLods[i],_=4*(this._cubeSize-y);SQ(t,3*y*(i>v-4?i-v+4:0),_,3*y,2*y),o.setRenderTarget(t),o.render(u,SG)}}function SY(e,t){let r=new eV(e,t,{magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,colorSpace:G});return r.texture.mapping=306,r.texture.name="PMREM.cubeUv",r.texture.isPMREMTexture=!0,r.scissorTest=!0,r}function SQ(e,t,r,i,n){e.viewport.set(t,r,i,n),e.scissor.set(t,r,i,n)}function SZ(e){let t=new x7;return t.depthTest=!1,t.depthWrite=!1,t.blending=0,t.name=`PMREM_${e}`,t}function S0(e){let t=SZ("cubemap");return t.fragmentNode=yW(e,SJ),t}function S1(e){let t=SZ("equirect");return t.fragmentNode=vo(e,bl(SJ),0),t}let S2=new WeakMap;class S3 extends cV{static get type(){return"PMREMNode"}constructor(e,t=null,r=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=r,this._generator=null;const i=new eG;i.isRenderTargetTexture=!0,this._texture=vo(i),this._width=fC(0),this._height=fC(0),this._maxMip=fC(0),this.updateBeforeType=cR.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){var t;let r,i={texelWidth:1/(3*Math.max(Math.pow(2,r=Math.log2(t=e.image.height)-2),112)),texelHeight:1/t,maxMip:r};this._texture.value=e,this._width.value=i.texelWidth,this._height.value=i.texelHeight,this._maxMip.value=i.maxMip}updateBefore(e){let t=this._pmrem,r=t?t.pmremVersion:-1,i=this._value;r!==i.pmremVersion&&null!==(t=!0===i.isPMREMTexture?i:function(e,t,r){var i,n;let a,s=(i=t,void 0===(a=S2.get(i))&&(a=new WeakMap,S2.set(i,a)),a),o=s.get(e);if((void 0!==o?o.pmremVersion:-1)!==e.pmremVersion){let t=e.image;if(e.isCubeTexture)if(!function(e){if(null==e)return!1;let t=0;for(let r=0;r<6;r++)void 0!==e[r]&&t++;return 6===t}(t))return null;else o=r.fromCubemap(e,o);else{if(!(null!=(n=t)&&n.height>0))return null;o=r.fromEquirectangular(e,o)}o.pmremVersion=e.pmremVersion,s.set(e,o)}return o.texture}(i,e.renderer,this._generator))&&(this._pmrem=t,this.updateFromTexture(t))}setup(e){null===this._generator&&(this._generator=new SK(e.renderer)),this.updateBefore(e);let t=this.uvNode;null===t&&e.context.getUV&&(t=e.context.getUV(this,e)),t=yD.mul(pO(t.x,t.y.negate(),t.z));let r=this.levelNode;return null===r&&e.context.getTextureLevel&&(r=e.context.getTextureLevel(this)),SN(this._texture,t,r,this._width,this._height,this._maxMip)}dispose(){super.dispose(),null!==this._generator&&this._generator.dispose()}}let S4=p_(S3).setParameterLength(1,3),S5=new WeakMap;class S8 extends xM{static get type(){return"EnvironmentNode"}constructor(e=null){super(),this.envNode=e}setup(e){let{material:t}=e,r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){let i=r.isTextureNode?r.value:t[r.property],n=this._getPMREMNodeCache(e.renderer),a=n.get(i);void 0===a&&(a=S4(i),n.set(i,a)),r=a}let i=!0===t.useAnisotropy||t.anisotropy>0?_d:yA,n=r.context(S6(p3,i)).mul(yF),a=r.context(S9(yM)).mul(Math.PI).mul(yF),s=gH(n),o=gH(a);
vendor: 4,993 bytes, line 397
397e.context.radiance.addAssign(s),e.context.iblIrradiance.addAssign(o);let l=e.context.lightingModel.clearcoatRadiance;if(l){let e=gH(r.context(S6(p8,yE)).mul(yF));l.addAssign(e)}}_getPMREMNodeCache(e){let t=S5.get(e);return void 0===t&&(t=new WeakMap,S5.set(e,t)),t}}let S6=(e,t)=>{let r=null;return{getUV:()=>(null===r&&(r=yf.negate().reflect(t),r=(r=mK(e).mix(r,t).normalize()).transformDirection(vj)),r),getTextureLevel:()=>e}},S9=e=>({getUV:()=>e,getTextureLevel:()=>pN(1)}),S7=new aP;class Te extends x7{static get type(){return"MeshStandardNodeMaterial"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(S7),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return null===t&&e.environmentNode&&(t=e.environmentNode),t?new S8(t):null}setupLightingModel(){return new Sp}setupSpecular(){let e=m0(pO(.04),p0.rgb,p4);fs.assign(pO(.04)),fo.assign(e),fl.assign(1)}setupVariants(){let e=this.metalnessNode?pN(this.metalnessNode):_I;p4.assign(e);let t=this.roughnessNode?pN(this.roughnessNode):_B;t=bL({roughness:t}),p3.assign(t),this.setupSpecular(),p1.assign(p0.rgb.mul(e.oneMinus()))}copy(e){return this.emissiveNode=e.emissiveNode,this.metalnessNode=e.metalnessNode,this.roughnessNode=e.roughnessNode,super.copy(e)}}let Tt=new aF;class Tr extends Te{static get type(){return"MeshPhysicalNodeMaterial"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(Tt),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||null!==this.clearcoatNode}get useIridescence(){return this.iridescence>0||null!==this.iridescenceNode}get useSheen(){return this.sheen>0||null!==this.sheenNode}get useAnisotropy(){return this.anisotropy>0||null!==this.anisotropyNode}get useTransmission(){return this.transmission>0||null!==this.transmissionNode}get useDispersion(){return this.dispersion>0||null!==this.dispersionNode}setupSpecular(){let e=this.iorNode?pN(this.iorNode):_q;ff.assign(e),fs.assign(mG(m$(ff.sub(1).div(ff.add(1))).mul(_R),pO(1)).mul(_w)),fo.assign(m0(fs,p0.rgb,p4)),fl.assign(m0(_w,1,p4))}setupLightingModel(){return new Sp(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){let e=this.clearcoatNode?pN(this.clearcoatNode):_F,t=this.clearcoatRoughnessNode?pN(this.clearcoatRoughnessNode):_D;p5.assign(e),p8.assign(bL({roughness:t}))}if(this.useSheen){let e=this.sheenNode?pO(this.sheenNode):_G,t=this.sheenRoughnessNode?pN(this.sheenRoughnessNode):_k;p6.assign(e),p9.assign(t)}if(this.useIridescence){let e=this.iridescenceNode?pN(this.iridescenceNode):_z,t=this.iridescenceIORNode?pN(this.iridescenceIORNode):_H,r=this.iridescenceThicknessNode?pN(this.iridescenceThicknessNode):_W;p7.assign(e),fe.assign(t),ft.assign(r)}if(this.useAnisotropy){let e=(this.anisotropyNode?pP(this.anisotropyNode):_V).toVar();fi.assign(e.length()),pC(fi.equal(0),()=>{e.assign(pP(1,0))}).Else(()=>{e.divAssign(pP(fi)),fi.assign(fi.saturate())}),fr.assign(fi.pow2().mix(p3.pow2(),1)),fn.assign(_u[0].mul(e.x).add(_u[1].mul(e.y))),fa.assign(_u[1].mul(e.x).sub(_u[0].mul(e.y)))}if(this.useTransmission){let e=this.transmissionNode?pN(this.transmissionNode):_j,t=this.thicknessNode?pN(this.thicknessNode):_X,r=this.attenuationDistanceNode?pN(this.attenuationDistanceNode):_$,i=this.attenuationColorNode?pO(this.attenuationColorNode):_J;if(fm.assign(e),fg.assign(t),fv.assign(r),fy.assign(i),this.useDispersion){let e=this.dispersionNode?pN(this.dispersionNode):_2;f_.assign(e)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?pO(this.clearcoatNormalNode):_U}setup(e){e.context.setupClearcoatNormal=()=>gm(this.setupClearcoatNormal(e),"NORMAL","vec3"),super.setup(e)}copy(e){return this.clearcoatNode=e.clearcoatNode,this.clearcoatRoughnessNode=e.clearcoatRoughnessNode,this.clearcoatNormalNode=e.clearcoatNormalNode,this.sheenNode=e.sheenNode,this.sheenRoughnessNode=e.sheenRoughnessNode,this.iridescenceNode=e.iridescenceNode,this.iridescenceIORNode=e.iridescenceIORNode,this.iridescenceThicknessNode=e.iridescenceThicknessNode,this.specularIntensityNode=e.specularIntensityNode,this.specularColorNode=e.specularColorNode,this.iorNode=e.iorNode,this.transmissionNode=e.transmissionNode,this.thicknessNode=e.thicknessNode,this.attenuationDistanceNode=e.attenuationDistanceNode,this.attenuationColorNode=e.attenuationColorNode,this.dispersionNode=e.dis
397persionNode,this.anisotropyNode=e.anisotropyNode,super.copy(e)}}class Ti extends Sp{constructor(e=!1,t=!1,r=!1,i=!1,n=!1,a=!1,s=!1){super(e,t,r,i,n,a),this.useSSS=s}direct({lightDirection:e,lightColor:t,reflectedLight:r},i){if(!0===this.useSSS){let{thicknessColorNode:n,thicknessDistortionNode:a,thicknessAmbientNode:s,thicknessAttenuationNode:o,thicknessPowerNode:l,thicknessScaleNode:u}=i.material,h=e.add(yA.mul(a)).normalize(),d=pO(pN(yf.dot(h.negate()).saturate().pow(l).mul(u)).add(s).mul(n));r.directDiffuse.addAssign(d.mul(o.mul(t)))}super.direct({lightDirection:e,lightColor:t,reflectedLight:r},i)}}class Tn extends Tr{static get type(){return"MeshSSSNodeMaterial"}constructor(e){super(e),this.thicknessColorNode=null,this.thicknessDistortionNode=pN(.1),this.thicknessAmbientNode=pN(0),this.thicknessAttenuationNode=pN(.1),this.thicknessPowerNode=pN(2),this.thicknessScaleNode=pN(10)}get useSSS(){return null!==this.thicknessColorNode}setupLightingModel(){return new Ti(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion,this.useSSS)}copy(e){return this.thicknessColorNode=e.thicknessColorNode,this.thicknessDistortionNode=e.thicknessDistortionNode,this.thicknessAmbientNode=e.thicknessAmbientNode,this.thicknessAttenuationNode=e.thicknessAttenuationNode,this.thicknessPowerNode=e.thicknessPowerNode,this.thicknessScaleNode=e.thicknessScaleNode,super.copy(e)}}let Ta=pA(({normal:e,lightDirection:t,builder:r})=>{let i=pP(e.dot(t).mul(.5).add(.5),0);if(r.material.gradientMap)return pO(yK("gradientMap","texture").context({getUV:()=>i}).r);{let e=i.fwidth().mul(.5);return m0(pO(.7),pO(1),m4(pN(.7).sub(e.x),pN(.7).add(e.x),i.x))}});class Ts extends bv{direct({lightDirection:e,lightColor:t,reflectedLight:r},i){let n=Ta({normal:y_,lightDirection:e,builder:i}).mul(t);r.directDiffuse.addAssign(n.mul(bS({diffuseColor:p0.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:r,reflectedLight:i}=e.context;i.indirectDiffuse.addAssign(r.mul(bS({diffuseColor:p0}))),i.indirectDiffuse.mulAssign(t)}}let To=new aU;class Tl extends x7{static get type(){return"MeshToonNodeMaterial"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(To),this.setValues(e)}setupLightingModel(){return new Ts}}let Tu=pA(()=>{let e=pO(yf.z,0,yf.x.negate()).normalize(),t=yf.cross(e);return pP(e.dot(yA),t.dot(yA)).mul(.495).add(.5)}).once(["NORMAL","VERTEX"])().toVar("matcapUV"),Th=new az;class Td extends x7{static get type(){return"MeshMatcapNodeMaterial"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(Th),this.setValues(e)}setupVariants(e){let t;t=e.material.matcap?yK("matcap","texture").context({getUV:()=>Tu}):pO(m0(.2,.8,Tu.y)),p0.rgb.mulAssign(t.rgb)}}class Tc extends cV{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}getNodeType(e){return this.positionNode.getNodeType(e)}setup(e){let{rotationNode:t,positionNode:r}=this;if("vec2"===this.getNodeType(e)){let e=t.cos(),i=t.sin();return pX(e,i,i.negate(),e).mul(r)}{let e=p$(pz(1,0,0,0),pz(0,mx(t.x),m_(t.x).negate(),0),pz(0,m_(t.x),mx(t.x),0),pz(0,0,0,1)),i=p$(pz(mx(t.y),0,m_(t.y),0),pz(0,1,0,0),pz(m_(t.y).negate(),0,mx(t.y),0),pz(0,0,0,1)),n=p$(pz(mx(t.z),m_(t.z).negate(),0,0),pz(m_(t.z),mx(t.z),0,0),pz(0,0,1,0),pz(0,0,0,1));return e.mul(i).mul(n).mul(pz(r,1)).xyz}}}let Tp=p_(Tc).setParameterLength(2),Tf=new rS;class Tm extends x7{static get type(){return"SpriteNodeMaterial"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(Tf),this.setValues(e)}setupPositionView(e){let{object:t,camera:r}=e,{positionNode:i,rotationNode:n,scaleNode:a,sizeAttenuation:s}=this,o=yi.mul(pO(i||0)),l=pP(v8[0].xyz.length(),v8[1].xyz.length());null!==a&&(l=l.mul(pP(a))),r.isPerspectiveCamera&&!1===s&&(l=l.mul(o.z.negate()));let u=yl.xy;if(t.center&&!0===t.center.isVector2){let e=new gE("center","vec2",t);u=u.sub(e.sub(.5))}let h=Tp(u=u.mul(l),pN(n||_O));return pz(o.xy.add(h),o.zw)}copy(e){return this.positionNode=e.positionNode,this.rotationNode=e.rotationNode,this.scaleNode=e.scaleNode,super.copy(e)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}}let Tg=new nr,Tv=new eb;class Ty extends Tm{static get type(){return"PointsNodeMaterial"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(Tg),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return yi.mul(pO(e||yu)).xyz}setupVertexSprite(e){let{material:t,camera:r}=e,{rotationNode:i,scaleNode:n,sizeNode:a,sizeAttenuation:s}=this,o=super.setupVertex(e);if(!0!==t.isNodeMaterial)return o;let l=null!==a?pP(a):_1;l=l.mul(vv),r.isPerspectiveCamera&&!0===s&&(l=l.mul(T_.div(yp.z.negate()))),n&&n.isNode&&(l=l.mul(pP(n)));let u=yl.xy;return i&&i.isNode&&(u=Tp(u,pN(i))),u=(u=(u=u.mul(l)).div(vS.div(2))).mul(o.w),o=o.add(pz(u,0,0))}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}}let T_=fC(1).onFrameUpdate(function({renderer:e}){let t=e.getSize(Tv);this.value=.5*t.y});class Tx extends bv{constructor(){super(),this.shadowNode=pN(1).toVar("shadowMask")}direct({lightNode:e}){null!==e.shadowNode&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){p0.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(p0.rgb)}}let Tb=new aC;class TS extends x7{static get type(){return"ShadowNodeMaterial"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(Tb),this.setValues(e)}setupLightingModel(){return new Tx}}let TT=pQ("vec3"),TA=pQ("vec3"),TM=pQ("vec3");class TE extends bv{constructor(){super()}start(e){let{material:t}=e,r=pQ("vec3"),i=pQ("vec3");pC(v$.sub(yd).length().greaterThan(ye.mul(2)),()=>{r.assign(v$),i.assign(yd)}).Else(()=>{r.assign(yd),i.assign(v$)});
397let n=i.sub(r),a=fC("int").onRenderUpdate(({material:e})=>e.steps),s=n.length().div(a).toVar(),o=n.normalize().toVar(),l=pN(0).toVar(),u=pO(1).toVar();t.offsetNode&&l.addAssign(t.offsetNode.mul(s)),xy(a,()=>{let i,n=r.add(o.mul(l)),a=vj.mul(pz(n,1)).xyz;null!==t.depthNode&&(TA.assign(x$(xz(a.z,vV,vz))),e.context.sceneDepthNode=x$(t.depthNode).toVar()),e.context.positionWorld=n,e.context.shadowPositionWorld=n,e.context.positionView=a,TT.assign(0),t.scatteringNode&&(i=t.scatteringNode({positionRay:n})),super.start(e),i&&TT.mulAssign(i);let h=TT.mul(.01).negate().mul(s).exp();u.mulAssign(h),l.addAssign(s)}),TM.addAssign(u.saturate().oneMinus())}scatteringLight(e,t){let r=t.context.sceneDepthNode;r?pC(r.greaterThanEqual(TA),()=>{TT.addAssign(e)}):TT.addAssign(e)}direct({lightNode:e,lightColor:t},r){if(void 0===e.light.distance)return;let i=t.xyz.toVar();i.mulAssign(e.shadowNode),this.scatteringLight(i,r)}directRectArea({lightColor:e,lightPosition:t,halfWidth:r,halfHeight:i},n){let a=t.add(r).sub(i),s=t.sub(r).sub(i),o=t.sub(r).add(i),l=t.add(r).add(i),u=n.context.positionView,h=e.xyz.mul(bY({P:u,p0:a,p1:s,p2:o,p3:l})).pow(1.5);this.scatteringLight(h,n)}finish(e){e.context.outgoingLight.assign(TM)}}class TC extends x7{static get type(){return"VolumeNodeMaterial"}constructor(e){super(),this.isVolumeNodeMaterial=!0,this.steps=25,this.offsetNode=null,this.scatteringNode=null,this.lights=!0,this.transparent=!0,this.side=1,this.depthTest=!1,this.depthWrite=!1,this.setValues(e)}setupLightingModel(){return new TE}}class Tw{constructor(e,t,r){this.renderer=e,this.nodes=t,this.info=r,this._context="u">typeof self?self:null,this._animationLoop=null,this._requestId=null}start(){let e=(t,r)=>{this._requestId=this._context.requestAnimationFrame(e),!0===this.info.autoReset&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),null!==this._animationLoop&&this._animationLoop(t,r),this.renderer._inspector.finish()};e()}stop(){this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}}class TR{constructor(){this.weakMaps={}}_getWeakMap(e){let t=e.length,r=this.weakMaps[t];return void 0===r&&(r=new WeakMap,this.weakMaps[t]=r),r}get(e){let t=this._getWeakMap(e);for(let r=0;r<e.length-1;r++)if(void 0===(t=t.get(e[r])))return;return t.get(e[e.length-1])}set(e,t){let r=this._getWeakMap(e);for(let t=0;t<e.length-1;t++){let i=e[t];!1===r.has(i)&&r.set(i,new WeakMap),r=r.get(i)}return r.set(e[e.length-1],t),this}delete(e){let t=this._getWeakMap(e);for(let r=0;r<e.length-1;r++)if(void 0===(t=t.get(e[r])))return!1;return t.delete(e[e.length-1])}}let TN=0;class TL{constructor(e,t,r,i,n,a,s,o,l,u){this.id=TN++,this._nodes=e,this._geometries=t,this.renderer=r,this.object=i,this.material=n,this.scene=a,this.camera=s,this.lightsNode=o,this.context=l,this.geometry=i.geometry,this.version=n.version,this.drawRange=null,this.attributes=null,this.attributesId=null,this.pipeline=null,this.group=null,this.vertexBuffers=null,this.drawParams=null,this.bundle=null,this.clippingContext=u,this.clippingContextCacheKey=null!==u?u.cacheKey:"",this.initialNodesCacheKey=this.getDynamicCacheKey(),this.initialCacheKey=this.getCacheKey(),this._nodeBuilderState=null,this._bindings=null,this._monitor=null,this.onDispose=null,this.isRenderObject=!0,this.onMaterialDispose=()=>{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener("dispose",this.onMaterialDispose),this.geometry.addEventListener("dispose",this.onGeometryDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return null!==this.clippingContext&&this.clippingContext.cacheKey!==this.clippingContextCacheKey&&(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return!0===this.material.hardwareClipping?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(let t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(null!==this.attributes)return this.attributes;let e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,r=[],i=new Set,n={};for(let a of e){let e;if(a.node&&a.node.attribute?e=a.node.attribute:(e=t.getAttribute(a.name),n[a.name]=e.id),void 0===e)continue;r.push(e);let s=e.isInterleavedBufferAttribute?e.data:e;i.add(s)}return this.attributes=r,this.attributesId=n,this.vertexBuffers=Array.from(i.values()),r}getVertexBuffers(){return null===this.vertexBuffers&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){let{object:e,material:t,geometry:r,group:i,drawRange:n}=this,a=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),s=this.getIndex(),o=null!==s,l=1;if(!0===r.isInstancedBufferGeometry?l=r.instanceCount:void 0!==e.count&&(l=Math.max(0,e.count)),0===l)return null;if(a.instanceCount=l,!0===e.isBatchedMesh)return a;let u=1;!0!==t.wireframe||e.isPoints||e.isLineSegments||e.isLine||e.isLineLoop||(u=2);let h=n.start*u,d=(n.start+n.count)*u;null!==i&&(h=Math.max(h,i.start*u),d=Math.min(d,(i.start+i.count)*u));let c=r.attributes.position,p=1/0;o?p=s.count:null!=c&&(p=c.count),h=Math.max(h,0);let f=(d=Math.min(d,p))-h;
397return f<0||f===1/0?null:(a.vertexCount=f,a.firstVertex=h,a)}getGeometryCacheKey(){let{geometry:e}=this,t="";for(let r of Object.keys(e.attributes).sort()){let i=e.attributes[r];t+=r+",",i.data&&(t+=i.data.stride+","),i.offset&&(t+=i.offset+","),i.itemSize&&(t+=i.itemSize+","),i.normalized&&(t+="n,")}for(let r of Object.keys(e.morphAttributes).sort()){let i=e.morphAttributes[r];t+="morph-"+r+",";for(let e=0,r=i.length;e<r;e++)t+=i[e].id+","}return e.index&&(t+="index,"),t}getMaterialCacheKey(){let{object:e,material:t,renderer:r}=this,i=t.customProgramCacheKey();for(let e of function(e){let t=Object.keys(e),r=Object.getPrototypeOf(e);for(;r;){let e=Object.getOwnPropertyDescriptors(r);for(let r in e)if(void 0!==e[r]){let i=e[r];i&&"function"==typeof i.get&&t.push(r)}r=Object.getPrototypeOf(r)}return t}(t)){let n;if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(e))continue;let a=t[e];if(null!==a){let e=typeof a;"number"===e?n=0!==a?"1":"0":"object"===e?(n="{",a.isTexture&&(n+=a.mapping,!0===r.backend.isWebGPUBackend&&(n+=a.magFilter,n+=a.minFilter,n+=a.wrapS,n+=a.wrapT,n+=a.wrapR)),n+="}"):n=String(a)}else n=String(a);i+=n+","}return i+=this.clippingContextCacheKey+",",e.geometry&&(i+=this.getGeometryCacheKey()),e.skeleton&&(i+=e.skeleton.bones.length+","),e.isBatchedMesh&&(i+=e._matricesTexture.uuid+",",null!==e._colorsTexture&&(i+=e._colorsTexture.uuid+",")),(e.isInstancedMesh||e.count>1||Array.isArray(e.morphTargetInfluences))&&(i+=e.uuid+","),i+=this.context.id+",",cc(i+=e.receiveShadow+",")}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(null!==this.attributes){let e=this.attributesId;for(let t in e){let r=this.geometry.getAttribute(t);if(void 0===r||e[t]!==r.id)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return!0!==this.material.isShadowPassMaterial&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=cf(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=cf(e,1)),e=cf(e,this.renderer.contextNode.id,this.renderer.contextNode.version)}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener("dispose",this.onMaterialDispose),this.geometry.removeEventListener("dispose",this.onGeometryDispose),this.onDispose()}}let TB=[];class TI{constructor(e,t,r,i,n,a){this.renderer=e,this.nodes=t,this.geometries=r,this.pipelines=i,this.bindings=n,this.info=a,this.chainMaps={}}get(e,t,r,i,n,a,s,o){let l=this.getChainMap(o);TB[0]=e,TB[1]=t,TB[2]=a,TB[3]=n;let u=l.get(TB);return void 0===u?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,r,i,n,a,s,o),l.set(TB,u)):(u.camera=i,u.updateClipping(s),u.needsGeometryUpdate&&u.setGeometry(e.geometry),(u.version!==t.version||u.needsUpdate)&&(u.initialCacheKey!==u.getCacheKey()?(u.dispose(),u=this.get(e,t,r,i,n,a,s,o)):u.version=t.version)),TB[0]=null,TB[1]=null,TB[2]=null,TB[3]=null,u}getChainMap(e="default"){return this.chainMaps[e]||(this.chainMaps[e]=new TR)}dispose(){this.chainMaps={}}createRenderObject(e,t,r,i,n,a,s,o,l,u,h){let d=this.getChainMap(h),c=new TL(e,t,r,i,n,a,s,o,l,u);return c.onDispose=()=>{this.pipelines.delete(c),this.bindings.deleteForRender(c),this.nodes.delete(c),d.delete(c.getChainArray())},c}}class TP{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return void 0===t&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}}class TF extends TP{constructor(e){super(),this.backend=e}delete(e){let t=super.delete(e);return null!==t&&this.backend.destroyAttribute(e),t}update(e,t){let r=this.get(e);if(void 0===r.version)1===t?this.backend.createAttribute(e):2===t?this.backend.createIndexAttribute(e):3===t?this.backend.createStorageAttribute(e):4===t&&this.backend.createIndirectStorageAttribute(e),r.version=this._getBufferAttribute(e).version;else{let t=this._getBufferAttribute(e);(r.version<t.version||35048===t.usage)&&(this.backend.updateAttribute(e),r.version=t.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}function TD(e){return null!==e.index?e.index.version:e.attributes.position.version}function TU(e){return null!==e.index?e.index.id:e.attributes.position.id}function TO(e){let t=[],r=e.index,i=e.attributes.position;if(null!==r){let e=r.array;for(let r=0,i=e.length;r<i;r+=3){let i=e[r+0],n=e[r+1],a=e[r+2];t.push(i,n,n,a,a,i)}}else{let e=i.array;for(let r=0,i=e.length/3-1;r<i;r+=3){let e=r+0,i=r+1,n=r+2;t.push(e,i,i,n,n,e)}}let n=new(i.count>=65535?rr:re)(t,1);return n.version=TD(e),n.__id=TU(e),n}class TG extends TP{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){let t=e.geometry;return super.has(t)&&!0===this.get(t).initialized}updateForRender(e){!1===this.has(e)&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){let t=e.geometry;this.get(t).initialized=!0,this.info.memory.geometries++;let r=()=>{this.info.memory.geometries--;let i=t.index,n=e.getAttributes();for(let e of(null!==i&&this.attributes.delete(i),n))this.attributes.delete(e);let a=this.wireframes.get(t);void 0!==a&&this.attributes.delete(a),t.removeEventListener("dispose",r),this._geometryDisposeListeners.delete(t)};t.addEventListener("dispose",r),this._geometryDisposeListeners.set(t,r)}updateAttributes(e){for(let t of e.getAttributes())t.isStorageBufferAttribute||t.isStorageInstancedBufferAttribute?this.updateAttribute(t,3):this.updateAttribute(t,1);let t=this.getIndex(e);null!==t&&this.updateAttribute(t,2);let r=e.geometry.indirect;null!==r&&this.updateAttribute(r,4)}updateAttribute(e,t){let r=this.info.render.calls;e.isInterleavedBufferAttribute?void 0===this.attributeCall.get(e)?(this.attributes.update(e,t),this.attributeCall.set(e,r)):this.attributeCall.get(e.data)!==r&&(this.attributes.update(e,t),this.attributeCall.set(e.data,r),this.attributeCall.set(e,r)):this.attributeCall.get(e)!==r&&(this.attributes.update(e,t),this.attributeCall.set(e,r))}getIndirect(e){return e.geometry.indirect}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){let{geometry:t,material:r}=e,i=t.index;if(!0===r.wireframe){let e=this.wireframes,r=e.get(t);void 0===r?(r=TO(t),e.set(t,r)):(r.version!==TD(t)||r.__id!==TU(t))&&(this.attributes.delete(r),r=TO(t),e.set(t,r)),i=r}return i}dispose(){for(let[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener("dispose",t);this._geometryDisposeListeners.clear()}}class Tk{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={geometries:0,textures:0}}update(e,t,r){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=t/3*r:e.isPoints?this.render.points+=r*t:e.isLineSegments?this.render.lines+=t/2*r:e.isLine?this.render.lines+=r*(t-1):ea("WebGPUInfo: Unknown object type.")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0,this.memory.geometries=0,this.memory.textures=0}}class TV{constructor(e){this.cacheKey=e,this.usedTimes=0}}class Tz extends TV{constructor(e,t,r){super(e),this.vertexProgram=t,this.fragmentProgram=r}}class TH extends TV{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}}let TW=0;class Tj{constructor(e,t,r,i=null,n=null){this.id=TW++,this.code=e,this.stage=t,this.name=r,this.transforms=i,this.attributes=n,this.usedTimes=0}}class TX extends TP{constructor(e,t){super(),this.backend=e,this.nodes=t,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){let{backend:r}=this,i=this.get(e);if(this._needsComputeUpdate(e)){let n=i.pipeline;n&&(n.usedTimes--,n.computeProgram.usedTimes--);let a=this.nodes.getForCompute(e),s=this.programs.compute.get(a.computeShader);void 0===s&&(n&&0===n.computeProgram.usedTimes&&this._releaseProgram(n.computeProgram),s=new Tj(a.computeShader,"compute",e.name,a.transforms,a.nodeAttributes),this.programs.compute.set(a.computeShader,s),r.createProgram(s));
397let o=this._getComputeCacheKey(e,s),l=this.caches.get(o);void 0===l&&(n&&0===n.usedTimes&&this._releasePipeline(n),l=this._getComputePipeline(e,s,o,t)),l.usedTimes++,s.usedTimes++,i.version=e.version,i.pipeline=l}return i.pipeline}getForRender(e,t=null){let{backend:r}=this,i=this.get(e);if(this._needsRenderUpdate(e)){let n=i.pipeline;n&&(n.usedTimes--,n.vertexProgram.usedTimes--,n.fragmentProgram.usedTimes--);let a=e.getNodeBuilderState(),s=e.material?e.material.name:"",o=this.programs.vertex.get(a.vertexShader);void 0===o&&(n&&0===n.vertexProgram.usedTimes&&this._releaseProgram(n.vertexProgram),o=new Tj(a.vertexShader,"vertex",s),this.programs.vertex.set(a.vertexShader,o),r.createProgram(o));let l=this.programs.fragment.get(a.fragmentShader);void 0===l&&(n&&0===n.fragmentProgram.usedTimes&&this._releaseProgram(n.fragmentProgram),l=new Tj(a.fragmentShader,"fragment",s),this.programs.fragment.set(a.fragmentShader,l),r.createProgram(l));let u=this._getRenderCacheKey(e,o,l),h=this.caches.get(u);void 0===h?(n&&0===n.usedTimes&&this._releasePipeline(n),h=this._getRenderPipeline(e,o,l,u,t)):e.pipeline=h,h.usedTimes++,o.usedTimes++,l.usedTimes++,i.pipeline=h}return i.pipeline}delete(e){let t=this.get(e).pipeline;return t&&(t.usedTimes--,0===t.usedTimes&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,0===t.computeProgram.usedTimes&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,0===t.vertexProgram.usedTimes&&this._releaseProgram(t.vertexProgram),0===t.fragmentProgram.usedTimes&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,r,i){r=r||this._getComputeCacheKey(e,t);let n=this.caches.get(r);return void 0===n&&(n=new TH(r,t),this.caches.set(r,n),this.backend.createComputePipeline(n,i)),n}_getRenderPipeline(e,t,r,i,n){i=i||this._getRenderCacheKey(e,t,r);let a=this.caches.get(i);return void 0===a&&(a=new Tz(i,t,r),this.caches.set(i,a),e.pipeline=a,this.backend.createRenderPipeline(e,n)),a}_getComputeCacheKey(e,t){return e.id+","+t.id}_getRenderCacheKey(e,t,r){return t.id+","+r.id+","+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){let t=e.code,r=e.stage;this.programs[r].delete(t)}_needsComputeUpdate(e){let t=this.get(e);return void 0===t.pipeline||t.version!==e.version}_needsRenderUpdate(e){return void 0===this.get(e).pipeline||this.backend.needsRenderUpdate(e)}}class Tq extends TP{constructor(e,t,r,i,n,a){super(),this.backend=e,this.textures=r,this.pipelines=n,this.attributes=i,this.nodes=t,this.info=a,this.pipelines.bindings=this}getForRender(e){let t=e.getBindings();for(let e of t){let r=this.get(e);void 0===r.bindGroup&&(this._init(e),this.backend.createBindings(e,t,0),r.bindGroup=e)}return t}getForCompute(e){let t=this.nodes.getForCompute(e).bindings;for(let e of t){let r=this.get(e);void 0===r.bindGroup&&(this._init(e),this.backend.createBindings(e,t,0),r.bindGroup=e)}return t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){for(let t of this.nodes.getForCompute(e).bindings)this.backend.deleteBindGroupData(t),this.delete(t)}deleteForRender(e){for(let t of e.getBindings())this.backend.deleteBindGroupData(t),this.delete(t)}_updateBindings(e){for(let t of e)this._update(t,e)}_init(e){for(let t of e.bindings)if(t.isSampledTexture)this.textures.updateTexture(t.texture);else if(t.isSampler)this.textures.updateSampler(t.texture);else if(t.isStorageBuffer){let e=t.attribute,r=e.isIndirectStorageBufferAttribute?4:3;this.attributes.update(e,r)}}_update(e,t){let{backend:r}=this,i=!1,n=!0,a=0,s=0;for(let t of e.bindings)if(!1!==this.nodes.updateGroup(t)){if(t.isStorageBuffer){let e=t.attribute,n=e.isIndirectStorageBufferAttribute?4:3,a=r.get(t);this.attributes.update(e,n),a.attribute!==e&&(a.attribute=e,i=!0)}
397if(t.isUniformBuffer)t.update()&&r.updateBinding(t);else if(t.isSampledTexture){let o=t.update(),l=t.texture,u=this.textures.get(l);if(o&&(this.textures.updateTexture(l),t.generation!==u.generation&&(t.generation=u.generation,i=!0),u.bindGroups.add(e)),void 0!==r.get(l).externalTexture||u.isDefaultTexture?n=!1:(a=10*a+l.id,s+=l.version),!0===l.isStorageTexture&&!0===l.mipmapsAutoUpdate){let e=this.get(l);!0===t.store?e.needsMipmap=!0:this.textures.needsMipmaps(l)&&!0===e.needsMipmap&&(this.backend.generateMipmaps(l),e.needsMipmap=!1)}}else if(t.isSampler&&t.update()){let e=this.textures.updateSampler(t.texture);t.samplerKey!==e&&(t.samplerKey=e,i=!0)}t.isBuffer&&t.updateRanges.length>0&&t.clearUpdateRanges()}!0===i&&this.backend.updateBindings(e,t,n?a:0,s)}}function T$(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?e.z-t.z:e.id-t.id}function TJ(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function TK(e){return(e.transmission>0||e.transmissionNode&&e.transmissionNode.isNode)&&2===e.side&&!1===e.forceSinglePass}class TY{constructor(e,t,r){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lightsNode=e.getNode(t,r),this.lightsArray=[],this.scene=t,this.camera=r,this.occlusionQueryCount=0}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,r,i,n,a,s){let o=this.renderItems[this.renderItemsIndex];return void 0===o?(o={id:e.id,object:e,geometry:t,material:r,groupOrder:i,renderOrder:e.renderOrder,z:n,group:a,clippingContext:s},this.renderItems[this.renderItemsIndex]=o):(o.id=e.id,o.object=e,o.geometry=t,o.material=r,o.groupOrder=i,o.renderOrder=e.renderOrder,o.z=n,o.group=a,o.clippingContext=s),this.renderItemsIndex++,o}push(e,t,r,i,n,a,s){let o=this.getNextRenderItem(e,t,r,i,n,a,s);!0===e.occlusionTest&&this.occlusionQueryCount++,!0===r.transparent||r.transmission>0||r.transmissionNode&&r.transmissionNode.isNode||r.backdropNode&&r.backdropNode.isNode?(TK(r)&&this.transparentDoublePass.push(o),this.transparent.push(o)):this.opaque.push(o)}unshift(e,t,r,i,n,a,s){let o=this.getNextRenderItem(e,t,r,i,n,a,s);!0===r.transparent||r.transmission>0||r.transmissionNode&&r.transmissionNode.isNode||r.backdropNode&&r.backdropNode.isNode?(TK(r)&&this.transparentDoublePass.unshift(o),this.transparent.unshift(o)):this.opaque.unshift(o)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t){this.opaque.length>1&&this.opaque.sort(e||T$),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||TJ),this.transparent.length>1&&this.transparent.sort(t||TJ)}finish(){this.lightsNode.setLights(this.lightsArray);for(let e=this.renderItemsIndex,t=this.renderItems.length;e<t;e++){let t=this.renderItems[e];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.groupOrder=null,t.renderOrder=null,t.z=null,t.group=null,t.clippingContext=null}}}let TQ=[];class TZ{constructor(e){this.lighting=e,this.lists=new TR}get(e,t){let r=this.lists;TQ[0]=e,TQ[1]=t;let i=r.get(TQ);return void 0===i&&(i=new TY(this.lighting,e,t),r.set(TQ,i)),TQ[0]=null,TQ[1]=null,i}dispose(){this.lists=new TR}}let T0=0;class T1{constructor(){this.id=T0++,this.mrt=null,this.color=!0,this.clearColor=!0,this.clearColorValue={r:0,g:0,b:0,a:1},this.depth=!0,this.clearDepth=!0,this.clearDepthValue=1,this.stencil=!1,this.clearStencil=!0,this.clearStencilValue=1,this.viewport=!1,this.viewportValue=new ek,this.scissor=!1,this.scissorValue=new ek,this.renderTarget=null,this.textures=null,this.depthTexture=null,this.activeCubeFace=0,this.activeMipmapLevel=0,this.sampleCount=1,this.width=0,this.height=0,this.occlusionQueryCount=0,this.clippingContext=null,this.camera=null,this.isRenderContext=!0}getCacheKey(){return T2(this)}}function T2(e){let{textures:t,activeCubeFace:r,activeMipmapLevel:i}=e,n=[r,i];for(let e of t)n.push(e.id);return cp(n)}class T3{constructor(e){this.renderer=e,this._renderContexts={}}get(e=null,t=null,r=0){let i;if(null===e)i="default";else{let t=e.texture.format,r=e.texture.type,n=e.textures.length;i=`${n}:${t}:${r}:${e.samples}:${e.depthBuffer}:${e.stencilBuffer}`}let n=i+"-"+(null!==t?t.id:"default")+"-"+r,a=this._renderContexts[n];return void 0===a&&((a=new T1).mrt=t,this._renderContexts[n]=a),null!==e&&(a.sampleCount=0===e.samples?1:e.samples),a.clearDepthValue=this.renderer.getClearDepth(),a.clearStencilValue=this.renderer.getClearStencil(),a}dispose(){this._renderContexts={}}}let T4=new eT;class T5 extends TP{constructor(e,t,r){super(),this.renderer=e,this.backend=t,this.info=r}updateRenderTarget(e,t=0){let r=this.get(e),i=0===e.samples?1:e.samples,n=r.depthTextureMips||(r.depthTextureMips={}),a=e.textures,s=this.getSize(a[0]),o=s.width>>t,l=s.height>>t,u=e.depthTexture||n[t],h=!0===e.depthBuffer||!0===e.stencilBuffer,d=!1;void 0===u&&h&&((u=new nv).format=e.stencilBuffer?1027:1026,u.type=e.stencilBuffer?1020:1014,u.image.width=o,u.image.height=l,u.image.depth=s.depth,u.renderTarget=e,u.isArrayTexture=!0===e.multiview&&s.depth>
3971,n[t]=u),(r.width!==s.width||s.height!==r.height)&&(d=!0,u&&(u.needsUpdate=!0,u.image.width=o,u.image.height=l,u.image.depth=u.isArrayTexture?u.image.depth:1)),r.width=s.width,r.height=s.height,r.textures=a,r.depthTexture=u||null,r.depth=e.depthBuffer,r.stencil=e.stencilBuffer,r.renderTarget=e,r.sampleCount!==i&&(d=!0,u&&(u.needsUpdate=!0),r.sampleCount=i);let c={sampleCount:i};if(!0!==e.isXRRenderTarget){for(let e=0;e<a.length;e++){let t=a[e];d&&(t.needsUpdate=!0),this.updateTexture(t,c)}u&&this.updateTexture(u,c)}!0!==r.initialized&&(r.initialized=!0,r.onDispose=()=>{this._destroyRenderTarget(e)},e.addEventListener("dispose",r.onDispose))}updateTexture(e,t={}){let r=this.get(e);if(!0===r.initialized&&r.version===e.version)return;let i=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,n=this.backend;if(i&&!0===r.initialized&&n.destroyTexture(e),e.isFramebufferTexture){let t=this.renderer.getRenderTarget();t?e.type=t.texture.type:e.type=1009}let{width:a,height:s,depth:o}=this.getSize(e);if(t.width=a,t.height=s,t.depth=o,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,a,s):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,i||!0===e.isStorageTexture||!0===e.isExternalTexture)n.createTexture(e,t),r.generation=e.version;else if(e.version>0){let i=e.image;if(void 0===i)en("Renderer: Texture marked for update but image is undefined.");else if(!1===i.complete)en("Renderer: Texture marked for update but image is incomplete.");else{if(e.images){let r=[];for(let t of e.images)r.push(t);t.images=r}else t.image=i;(void 0===r.isDefaultTexture||!0===r.isDefaultTexture)&&(n.createTexture(e,t),r.isDefaultTexture=!1,r.generation=e.version),!0===e.source.dataReady&&n.updateTexture(e,t);let a=!0===e.isStorageTexture&&!1===e.mipmapsAutoUpdate;t.needsMipmaps&&0===e.mipmaps.length&&!a&&n.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else n.createDefaultTexture(e),r.isDefaultTexture=!0,r.generation=e.version;!0!==r.initialized&&(r.initialized=!0,r.generation=e.version,r.bindGroups=new Set,this.info.memory.textures++,e.isVideoTexture&&!0===eN.enabled&&eN.getTransfer(e.colorSpace)!==V&&en("WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace."),r.onDispose=()=>{this._destroyTexture(e)},e.addEventListener("dispose",r.onDispose)),r.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=T4){let r=e.images?e.images[0]:e.image;return r?(void 0!==r.image&&(r=r.image),"u">typeof HTMLVideoElement&&r instanceof HTMLVideoElement?(t.width=r.videoWidth||1,t.height=r.videoHeight||1,t.depth=1):"u">typeof VideoFrame&&r instanceof VideoFrame?(t.width=r.displayWidth||1,t.height=r.displayHeight||1,t.depth=1):(t.width=r.width||1,t.height=r.height||1,t.depth=e.isCubeTexture?6:r.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,r){return e.mipmaps.length>0?e.mipmaps.length:!0===e.isCompressedTexture?1:Math.floor(Math.log2(Math.max(t,r)))+1}needsMipmaps(e){return!0===e.generateMipmaps||e.mipmaps.length>0}_destroyRenderTarget(e){if(!0===this.has(e)){let t=this.get(e),r=t.textures,i=t.depthTexture;e.removeEventListener("dispose",t.onDispose);for(let e=0;e<r.length;e++)this._destroyTexture(r[e]);i&&this._destroyTexture(i),this.delete(e),this.backend.delete(e)}}_destroyTexture(e){if(!0===this.has(e)){let t=this.get(e);e.removeEventListener("dispose",t.onDispose);let r=t.isDefaultTexture;if(this.backend.destroyTexture(e,r),t.bindGroups)for(let e of t.bindGroups){let t=this.backend.get(e);t.groups=void 0,t.versions=void 0}this.delete(e),this.info.memory.textures--}}}class T8 extends ty{constructor(e,t,r,i=1){super(e,t,r),this.a=i}set(e,t,r,i=1){return this.a=i,super.set(e,t,r)}copy(e){return void 0!==e.a&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}}class T6 extends pY{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getMemberType(e,t){let r,i=this.getNodeType(e),n=e.getStructTypeNode(i);return null!==n?r=n.getMemberType(e,t):(ea(`TSL: Member "${t}" not found in struct "${i}".`,new ch),r="float"),r}getHash(){return this.uuid}generate(){return this.name}}class T9 extends cO{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this._expressionNode=null,this._currentNode=null,this.isStackNode=!0}getElementType(e){return this.hasOutput(e)?this.outputNode.getElementType(e):"void"}getNodeType(e){return this.hasOutput(e)?this.outputNode.getNodeType(e):"void"}getMemberType(e,t){return this.hasOutput(e)?this.outputNode.getMemberType(e,t):"void"}addToStack(e,t=this.nodes.length){return!0!==e.isNode?ea("TSL: Invalid node added to stack.",new ch):this.nodes.splice(t,0,e),this}addToStackBefore(e){let t=this._currentNode?this.nodes.indexOf(this._currentNode):0;return this.addToStack(e,t)}If(e,t){let r=new pf(t);return this._currentCond=gt(e,r),this.addToStack(this._currentCond)}ElseIf(e,t){let r=gt(e,new pf(t));return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new pf(e),this}Switch(e){return this._expressionNode=pm(e),this}Case(...e){let t=[];if(e.length>=2)for(let r=0;r<e.length-1;r++)t.push(this._expressionNode.equal(pm(e[r])));else ea("TSL: Invalid parameter length. Case() requires at least two parameters.",new ch);let r=new pf(e[e.length-1]),i=t[0];for(let e=1;e<t.length;e++)i=i.or(t[e]);let n=gt(i,r);return null===this._currentCond?(this._currentCond=n,this.addToStack(this._currentCond)):(this._currentCond.elseNode=n,this._currentCond=n,this)}Default(e){return this.Else(e),this}setup(e){let t=e.getNodeProperties(this),r=0;for(let i of this.getChildren())i.isVarNode&&i.isIntent(e)&&!0!==i.isAssign(e)||(t["node"+r++]=i);return t.outputNode||null}hasOutput(e){return this.outputNode&&this.outputNode.isNode&&"void"!==this.outputNode.getNodeType(e)}build(e,...t){let r,i=pE(),n=e.buildStage;pM(this),e.setActiveStack(this);let a=t=>{if(this._currentNode=t,!(t.isVarNode&&t.isIntent(e))||!0===t.isAssign(e)){if("setup"===n)t.build(e);else if("analyze"===n)t.build(e,this);else if("generate"===n){let r=e.getDataFromNode(t,"any").stages,i=r&&r[e.shaderStage];if(t.isVarNode&&i&&1===i.length&&i[0]&&i[0].isStackNode)return;t.build(e,"void")}}},s=[...this.nodes];for(let e of s)a(e);for(let e of(this._currentNode=null,this.nodes.filter(e=>-1===s.indexOf(e))))a(e);return r=this.hasOutput(e)?this.outputNode.build(e,...t):super.build(e,...t),pM(i),e.removeActiveStack(this),r}}let T7=p_(T9).setParameterLength(0,1);class Ae extends cO{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=function(e){return Object.entries(e).map(([e,t])=>"string"==typeof t?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})}
397(e),this.name=t,this.isStructLayoutNode=!0}getLength(){let e=Float32Array.BYTES_PER_ELEMENT,t=1,r=0;for(let i of this.membersLayout){let n=i.type,a=cx(n),s=cb(n)/e,o=r%(t=Math.max(t,s))%s;0!==o&&(r+=s-o),r+=a}return Math.ceil(r/t)*t}getMemberType(e,t){let r=this.membersLayout.find(e=>e.name===t);return r?r.type:"void"}getNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}}class At extends cO{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}getNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){let e=super._getChildren(),t=e.find(e=>e.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){let t=e.getVarFromNode(this),r=t.type,i=e.getPropertyName(t);return e.addLineFlowCode(`${i} = ${e.generateStruct(r,this.structTypeNode.membersLayout,this.values)}`,this),t.name}}class Ar extends cO{static get type(){return"OutputStructNode"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}getNodeType(){return"OutputType"}generate(e){let t=e.getDataFromNode(this);if(void 0===t.membersLayout){let r=this.members,i=[];for(let t=0;t<r.length;t++){let n="m"+t,a=r[t].getNodeType(e);i.push({name:n,type:a,index:t})}t.membersLayout=i,t.structType=e.getOutputStructTypeFromNode(this,t.membersLayout)}let r=e.getOutputStructName(),i=this.members,n=""!==r?r+".":"";for(let t=0;t<i.length;t++){let r=i[t].build(e);e.addLineFlowCode(`${n}m${t} = ${r}`,this)}return r}}let Ai=p_(Ar);class An{constructor(e=1){this.blending=e,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.premultiplyAlpha=!1}copy(e){return this.blending=e.blending,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.premultiplyAlpha=e.premultiplyAlpha,this}clone(){return new this.constructor().copy(this)}}let Aa=new An(0),As=new An(6);function Ao(e,t){for(let r=0;r<e.length;r++)if(e[r].name===t)return r;return -1}class Al extends Ar{static get type(){return"MRTNode"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:As},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||Aa}has(e){return void 0!==this.outputNodes[e]}get(e){return this.outputNodes[e]}merge(e){let t={...this.outputNodes,...e.outputNodes},r={...this.blendModes,...e.blendModes},i=Au(t);return i.blendings=r,i}setup(e){let t=this.outputNodes,r=e.renderer.getRenderTarget(),i=[],n=r.textures;for(let e in t)i[Ao(n,e)]=pz(t[e]);return this.members=i,super.setup(e)}}let Au=p_(Al);class Ah extends cV{static get type(){return"BitcastNode"}constructor(e,t,r=null){super(),this.valueNode=e,this.conversionType=t,this.inputType=r,this.isBitcastNode=!0}getNodeType(e){if(null!==this.inputType){let t=this.valueNode.getNodeType(e),r=e.getTypeLength(t);return e.getTypeFromLength(r,this.conversionType)}return this.conversionType}generate(e){let t=this.getNodeType(e),r="";if(null!==this.inputType){let t=this.valueNode.getNodeType(e);r=1===e.getTypeLength(t)?this.inputType:e.changeComponentType(t,this.inputType)}else r=this.valueNode.getNodeType(e);return`${e.getBitcastMethod(t,r)}( ${this.valueNode.build(e,r)} )`}}let Ad=pb(Ah).setParameterLength(2),Ac=e=>new Ah(e,"uint","float"),Ap={};class Af extends f9{static get type(){return"BitcountNode"}constructor(e,t){super(e,t),this.isBitcountNode=!0}_resolveElementType(e,t,r){"int"===r?t.assign(Ad(e,"uint")):t.assign(e)}_returnDataNode(e){switch(e){case"uint":return pB;case"int":return pL;case"uvec2":return pD;case"uvec3":return pk;case"uvec4":return pW;case"ivec2":return pF;case"ivec3":return pG;case"ivec4":return pH}}_createTrailingZerosBaseLayout(e,t){let r=this._returnDataNode(t);return pA(([e])=>{let i=pB(0);return this._resolveElementType(e,i,t),r(Ac(pN(i.bitAnd(mw(i)))).shiftRight(23).sub(127))}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createLeadingZerosBaseLayout(e,t){let r=this._returnDataNode(t);return pA(([e])=>{pC(e.equal(pB(0)),()=>pB(32));let i=pB(0),n=pB(0);return this._resolveElementType(e,i,t),pC(i.shiftRight(16).equal(0),()=>{n.addAssign(16),i.shiftLeftAssign(16)}),pC(i.shiftRight(24).equal(0),()=>{n.addAssign(8),i.shiftLeftAssign(8)}),pC(i.shiftRight(28).equal(0),()=>{n.addAssign(4),i.shiftLeftAssign(4)}),pC(i.shiftRight(30).equal(0),()=>{n.addAssign(2),i.shiftLeftAssign(2)}),pC(i.shiftRight(31).equal(0),()=>{n.addAssign(1)}),r(n)}
397).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createOneBitsBaseLayout(e,t){let r=this._returnDataNode(t);return pA(([e])=>{let i=pB(0);return this._resolveElementType(e,i,t),i.assign(i.sub(i.shiftRight(pB(1)).bitAnd(pB(0x55555555)))),i.assign(i.bitAnd(pB(0x33333333)).add(i.shiftRight(pB(2)).bitAnd(pB(0x33333333)))),r(i.add(i.shiftRight(pB(4))).bitAnd(pB(0xf0f0f0f)).mul(pB(0x1010101)).shiftRight(pB(24)))}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}_createMainLayout(e,t,r,i){let n=this._returnDataNode(t);return pA(([e])=>{if(1===r)return n(i(e));{let t=n(0),a=["x","y","z","w"];for(let n=0;n<r;n++){let r=a[n];t[r].assign(i(e[r]))}return t}}).setLayout({name:e,type:t,inputs:[{name:"value",type:t}]})}setup(e){let{method:t,aNode:r}=this,{renderer:i}=e;if(i.backend.isWebGPUBackend)return super.setup(e);let n=this.getInputType(e),a=e.getElementType(n),s=e.getTypeLength(n),o=`${t}_base_${a}`,l=`${t}_${n}`,u=Ap[o];if(void 0===u){switch(t){case Af.COUNT_LEADING_ZEROS:u=this._createLeadingZerosBaseLayout(o,a);break;case Af.COUNT_TRAILING_ZEROS:u=this._createTrailingZerosBaseLayout(o,a);break;case Af.COUNT_ONE_BITS:u=this._createOneBitsBaseLayout(o,a)}Ap[o]=u}let h=Ap[l];return void 0===h&&(h=this._createMainLayout(l,n,s,u),Ap[l]=h),pA(()=>h(r))()}}Af.COUNT_TRAILING_ZEROS="countTrailingZeros",Af.COUNT_LEADING_ZEROS="countLeadingZeros",Af.COUNT_ONE_BITS="countOneBits";let Am=pb(Af,Af.COUNT_TRAILING_ZEROS).setParameterLength(1),Ag=pb(Af,Af.COUNT_LEADING_ZEROS).setParameterLength(1),Av=pb(Af,Af.COUNT_ONE_BITS).setParameterLength(1),Ay=pA(([e])=>{let t=e.toUint().mul(0x2c9277b5).add(0xac564b05),r=t.shiftRight(t.shiftRight(28).add(4)).bitXor(t).mul(0x108ef2d9);return r.shiftRight(22).bitXor(r).toFloat().mul(1/0x100000000)}),A_=(e,t)=>mq(fO(4,e.mul(fU(1,e))),t);class Ax extends cV{static get type(){return"PackFloatNode"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}getNodeType(){return"uint"}generate(e){let t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}}let Ab=pb(Ax,"snorm").setParameterLength(1),AS=pb(Ax,"unorm").setParameterLength(1),AT=pb(Ax,"float16").setParameterLength(1);class AA extends cV{static get type(){return"UnpackFloatNode"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}getNodeType(){return"vec2"}generate(e){let t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}}let AM=pb(AA,"snorm").setParameterLength(1),AE=pb(AA,"unorm").setParameterLength(1),AC=pb(AA,"float16").setParameterLength(1),Aw=pA(([e])=>e.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),AR=pA(([e])=>pO(Aw(e.z.add(Aw(e.y.mul(1)))),Aw(e.z.add(Aw(e.x.mul(1)))),Aw(e.y.add(Aw(e.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),AN=pA(([e,t,r])=>{let i=pO(e).toVar(),n=pN(1.4).toVar(),a=pN(0).toVar(),s=pO(i).toVar();return xy({start:pN(0),end:pN(3),type:"float",condition:"<="},()=>{let e=pO(AR(s.mul(2))).toVar();i.addAssign(e.add(r.mul(pN(.1).mul(t)))),s.mulAssign(1.8),n.mulAssign(1.5),i.mulAssign(1.2);let o=pN(Aw(i.z.add(Aw(i.x.add(Aw(i.y)))))).toVar();a.addAssign(o.div(n)),s.addAssign(.14)}),a}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]});class AL extends cO{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}getNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){let t=this.parametersNodes,r=this._candidateFn;if(null===r){let i=null,n=-1;for(let r of this.functionNodes){let a=r.shaderNode.layout;if(null===a)throw Error("FunctionOverloadingNode: FunctionNode must be a layout.");let s=a.inputs;if(t.length===s.length){let a=0;for(let r=0;r<t.length;r++){let i=t[r],n=s[r];i.getNodeType(e)===n.type&&a++}a>n&&(i=r,n=a)}}this._candidateFn=r=i}return r}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}}let AB=p_(AL),AI=e=>(...t)=>
397AB(e,...t),AP=fC(0).setGroup(fA).onRenderUpdate(e=>e.time),AF=fC(0).setGroup(fA).onRenderUpdate(e=>e.deltaTime),AD=fC(0,"uint").setGroup(fA).onRenderUpdate(e=>e.frameId),AU=pA(([e,t,r=pP(.5)])=>Tp(e.sub(r),t).add(r)),AO=pA(([e,t,r=pP(.5)])=>{let i=e.sub(r),n=i.dot(i),a=n.mul(n).mul(t);return e.add(i.mul(a))}),AG=pA(({position:e=null,horizontal:t=!0,vertical:r=!1})=>{let i;null!==e?((i=v8.toVar())[3][0]=e.x,i[3][1]=e.y,i[3][2]=e.z):i=v8;let n=vj.mul(i);return pc(t)&&(n[0][0]=v8[0].length(),n[0][1]=0,n[0][2]=0),pc(r)&&(n[1][0]=0,n[1][1]=v8[1].length(),n[1][2]=0),n[2][0]=0,n[2][1]=0,n[2][2]=1,vH.mul(n).mul(yu)}),Ak=pA(([e=null])=>{let t=x$();return x$(xO(e)).sub(t).lessThan(0).select(vy,e)}),AV=pA(([e,t=g9(),r=pN(0)])=>{let i=e.x,n=e.y,a=r.mod(i.mul(n)).floor(),s=a.mod(i),o=n.sub(a.add(1).div(i).ceil()),l=e.reciprocal(),u=pP(s,o);return t.add(u).mul(l)}),Az=pA(([e,t=null,r=null,i=pN(1),n=yu,a=yx])=>{let s=a.abs().normalize();s=s.div(s.dot(pO(1)));let o=n.yz.mul(i),l=n.zx.mul(i),u=n.xy.mul(i),h=e.value,d=null!==t?t.value:h,c=null!==r?r.value:h;return fD(vo(h,o).mul(s.x),vo(d,l).mul(s.y),vo(c,u).mul(s.z))}),AH=new iC,AW=new eT,Aj=new eT,AX=new eT,Aq=new eq,A$=new eT(0,0,-1),AJ=new ek,AK=new eT,AY=new eT,AQ=new ek,AZ=new eb,A0=new eV,A1=vy.flipX();A0.depthTexture=new nv(1,1);let A2=!1;class A3 extends va{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||A0.texture,A1),this._reflectorBaseNode=e.reflector||new A4(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(null===this._depthNode){if(!0!==this._reflectorBaseNode.depth)throw Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=new A3({defaultTexture:A0.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){let e=new this.constructor(this.reflectorNode);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e._reflectorBaseNode=this._reflectorBaseNode,e}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}}class A4 extends cO{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();const{target:r=new th,resolutionScale:i=1,generateMipmaps:n=!1,bounces:a=!0,depth:s=!1,samples:o=0}=t;this.textureNode=e,this.target=r,this.resolutionScale=i,void 0!==t.resolution&&(es('ReflectorNode: The "resolution" parameter has been renamed to "resolutionScale".'),this.resolutionScale=t.resolution),this.generateMipmaps=n,this.bounces=a,this.depth=s,this.samples=o,this.updateBeforeType=a?cR.RENDER:cR.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){let r=this.resolutionScale;t.getDrawingBufferSize(AZ),e.setSize(Math.round(AZ.width*r),Math.round(AZ.height*r))}setup(e){return this._updateResolution(A0,e.renderer),super.setup(e)}dispose(){for(let e of(super.dispose(),this.renderTargets.values()))e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return void 0===t&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return void 0===t&&(t=new eV(0,0,{type:1016,samples:this.samples}),!0===this.generateMipmaps&&(t.texture.minFilter=1008,t.texture.generateMipmaps=!0),!0===this.depth&&(t.depthTexture=new nv),this.renderTargets.set(e,t)),t}updateBefore(e){if(!1===this.bounces&&A2)return!1;A2=!0;let{scene:t,camera:r,renderer:i,material:n}=e,{target:a}=this,s=this.getVirtualCamera(r),o=this.getRenderTarget(s);i.getDrawingBufferSize(AZ),this._updateResolution(o,i),Aj.setFromMatrixPosition(a.matrixWorld),AX.setFromMatrixPosition(r.matrixWorld),Aq.extractRotation(a.matrixWorld),AW.set(0,0,1),AW.applyMatrix4(Aq),AK.subVectors(Aj,AX);let l=AK.dot(AW)>0,u=!1;if(!0===l&&!1===this.forceUpdate){if(!1===this.hasOutput){A2=!1;return}u=!0}AK.reflect(AW).negate(),AK.add(Aj),Aq.extractRotation(r.matrixWorld),A$.set(0,0,-1),A$.applyM
397atrix4(Aq),A$.add(AX),AY.subVectors(Aj,A$),AY.reflect(AW).negate(),AY.add(Aj),s.coordinateSystem=r.coordinateSystem,s.position.copy(AK),s.up.set(0,1,0),s.up.applyMatrix4(Aq),s.up.reflect(AW),s.lookAt(AY),s.near=r.near,s.far=r.far,s.updateMatrixWorld(),s.projectionMatrix.copy(r.projectionMatrix),AH.setFromNormalAndCoplanarPoint(AW,Aj),AH.applyMatrix4(s.matrixWorldInverse),AJ.set(AH.normal.x,AH.normal.y,AH.normal.z,AH.constant);let h=s.projectionMatrix;AQ.x=(Math.sign(AJ.x)+h.elements[8])/h.elements[0],AQ.y=(Math.sign(AJ.y)+h.elements[9])/h.elements[5],AQ.z=-1,AQ.w=(1+h.elements[10])/h.elements[14],AJ.multiplyScalar(1/AJ.dot(AQ)),h.elements[2]=AJ.x,h.elements[6]=AJ.y,h.elements[10]=2001===i.coordinateSystem?AJ.z-0:AJ.z+1-0,h.elements[14]=AJ.w,this.textureNode.value=o.texture,!0===this.depth&&(this.textureNode.getDepthNode().value=o.depthTexture),n.visible=!1;let d=i.getRenderTarget(),c=i.getMRT(),p=i.autoClear;i.setMRT(null),i.setRenderTarget(o),i.autoClear=!0;let f=t.name;t.name=(t.name||"Scene")+" [ Reflector ]",u?(i.clear(),this.hasOutput=!1):(i.render(t,s),this.hasOutput=!0),t.name=f,i.setMRT(c),i.setRenderTarget(d),i.autoClear=p,n.visible=!0,A2=!1,this.forceUpdate=!1}get resolution(){return es('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale}set resolution(e){es('ReflectorNode: The "resolution" property has been renamed to "resolutionScale".'),this.resolutionScale=e}}let A5=new sB(-1,1,1,-1,0,1),A8=new class extends rg{constructor(e=!1){super(),this.setAttribute("position",new rn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new rn(!1===e?[0,-1,0,1,2,1]:[0,2,0,0,2,0],2))}};class A6 extends r8{constructor(e=null){super(A8,e),this.camera=A5,this.isQuadMesh=!0}async renderAsync(e){es('QuadMesh: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await e.init(),e.render(this,A5)}render(e){e.render(this,A5)}}let A9=new eb;class A7 extends va{static get type(){return"RTTNode"}constructor(e,t=null,r=null,i={type:1016}){const n=new eV(t,r,i);super(n.texture,g9()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=r,this.pixelRatio=1,this.renderTarget=n,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._rttNode=null,this._quadMesh=new A6(new x7),this.updateBeforeType=cR.RENDER}get autoResize(){return null===this.width}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){this.width=e,this.height=t;let r=e*this.pixelRatio,i=t*this.pixelRatio;this.renderTarget.setSize(r,i),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(!1===this.textureNeedsUpdate&&!1===this.autoUpdate)return;if(this.textureNeedsUpdate=!1,!0===this.autoResize){let t=e.getPixelRatio(),r=e.getSize(A9),i=Math.floor(r.width*t),n=Math.floor(r.height*t);(i!==this.renderTarget.width||n!==this.renderTarget.height)&&(this.renderTarget.setSize(i,n),this.textureNeedsUpdate=!0)}let t="RTT";this.node.name&&(t=this.node.name+" [ "+t+" ]"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=t;let r=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(r)}clone(){let e=new va(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}let Me=(e,...t)=>new A7(pm(e),...t),Mt=pA(([e,t,r],i)=>{let n;n=2001===i.renderer.coordinateSystem?pz(pO(e=pP(e.x,e.y.oneMinus()).mul(2).sub(1),t),1):pz(pO(e.x,e.y.oneMinus(),t).mul(2).sub(1),1);let a=pz(r.mul(n));return a.xyz.div(a.w)}),Mr=pA(([e,t])=>{let r=t.mul(pz(e,1)),i=r.xy.div(r.w).mul(.5).add(.5).toVar();return pP(i.x,i.y.oneMinus())}),Mi=pA(([e,t,r])=>{let i=ve(vl(t)),n=pF(e.mul(i)).toVar(),a=vl(t,n).toVar(),s=vl(t,n.sub(pF(2,0))).toVar(),o=vl(t,n.sub(pF(1,0))).toVar(),l=vl(t,n.add(pF(1,0))).toVar(),u=vl(t,n.add(pF(2,0))).toVar(),h=vl(t,n.add(pF(0,2))).toVar(),d=vl(t,n.add(pF(0,1))).toVar(),c=vl(t,n.sub(pF(0,1))).toVar(),p=vl(t,n.sub(pF(0,2))).toVar(),f=mM(fU(pN(2).mul(o).sub(s),a)).toVar(),m=mM(fU(pN(2).mul(l).sub(u),a)).toVar(),g=mM(fU(pN(2).mul(d).sub(h),a)).toVar(),v=mM(fU(pN(2).mul(c).sub(p),a)).toVar(),y=Mt(e,a,r).toVar();return mv(mX(f.lessThan(m).select(y.sub(Mt(e.sub(pP(pN(1).div(i.x),0)),o,r)),y.negate().add(Mt(e.add(pP(pN(1).div(i.x),0)),l,r))),g.lessThan(v).select(y.sub(Mt(e.add(pP(0,pN(1).div(i.y))),d,r)),y.negate().add(Mt(e.sub(pP(0,pN(1).div(i.y))),c,r)))))}),Mn=pA(([e])=>
397my(pN(52.9829189).mul(my(mj(e,pP(.06711056,.00583715)))))).setLayout({name:"interleavedGradientNoise",type:"float",inputs:[{name:"position",type:"vec2"}]}),Ma=pA(([e,t,r])=>{let i=pN(2.399963229728653),n=mp(pN(e).add(.5).div(pN(t))),a=pN(e).mul(i).add(r);return pP(mx(a),m_(a)).mul(n)}).setLayout({name:"vogelDiskSample",type:"vec2",inputs:[{name:"sampleIndex",type:"int"},{name:"samplesCount",type:"int"},{name:"phi",type:"float"}]});class Ms extends cO{static get type(){return"SampleNode"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(g9())}sample(e){return this.callback(e)}}class Mo extends cO{static get type(){return"EventNode"}constructor(e,t){super("void"),this.eventType=e,this.callback=t,e===Mo.OBJECT?this.updateType=cR.OBJECT:e===Mo.MATERIAL?this.updateType=cR.RENDER:e===Mo.BEFORE_OBJECT?this.updateBeforeType=cR.OBJECT:e===Mo.BEFORE_MATERIAL&&(this.updateBeforeType=cR.RENDER)}update(e){this.callback(e)}updateBefore(e){this.callback(e)}}Mo.OBJECT="object",Mo.MATERIAL="material",Mo.BEFORE_OBJECT="beforeObject",Mo.BEFORE_MATERIAL="beforeMaterial";let Ml=(e,t)=>new Mo(e,t).toStack();class Mu extends im{constructor(e,t,r=Float32Array){super(ArrayBuffer.isView(e)?e:new r(e*t),t),this.isStorageInstancedBufferAttribute=!0}}class Mh extends t5{constructor(e,t,r=Float32Array){super(ArrayBuffer.isView(e)?e:new r(e*t),t),this.isStorageBufferAttribute=!0}}class Md extends cO{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}let Mc=px(Md),Mp=new e3,Mf=new eq,Mm=fC(0).setGroup(fA).onRenderUpdate(({scene:e})=>e.backgroundBlurriness),Mg=fC(1).setGroup(fA).onRenderUpdate(({scene:e})=>e.backgroundIntensity),Mv=fC(new eq).setGroup(fA).onRenderUpdate(({scene:e})=>{let t=e.background;return null!==t&&t.isTexture&&300!==t.mapping?(Mp.copy(e.backgroundRotation),Mp.x*=-1,Mp.y*=-1,Mp.z*=-1,Mf.makeRotationFromEuler(Mp)):Mf.identity(),Mf});class My extends va{static get type(){return"StorageTextureNode"}constructor(e,t,r=null){super(e,t),this.storeNode=r,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=cL.WRITE_ONLY}getInputType(){return"storageTexture"}setup(e){super.setup(e);let t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}
397setMipLevel(e){return this.mipLevel=e,this}generate(e,t){return null!==this.storeNode?this.generateStore(e):super.generate(e,t)}generateSnippet(e,t,r,i,n,a,s,o,l){let u=this.value;return e.generateStorageTextureLoad(u,t,r,i,a,l)}toReadWrite(){return this.setAccess(cL.READ_WRITE)}toReadOnly(){return this.setAccess(cL.READ_ONLY)}toWriteOnly(){return this.setAccess(cL.WRITE_ONLY)}generateStore(e){let{uvNode:t,storeNode:r,depthNode:i}=e.getNodeProperties(this),n=super.generate(e,"property"),a=t.build(e,!0===this.value.is3DTexture?"uvec3":"uvec2"),s=r.build(e,"vec4"),o=i?i.build(e,"int"):null,l=e.generateTextureStore(e,n,a,o,s);e.addLineFlowCode(l,this)}clone(){let e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}}let M_=p_(My).setParameterLength(1,3),Mx=pA(({texture:e,uv:t})=>{let r=pO().toVar();return pC(t.x.lessThan(1e-4),()=>{r.assign(pO(1,0,0))}).ElseIf(t.y.lessThan(1e-4),()=>{r.assign(pO(0,1,0))}).ElseIf(t.z.lessThan(1e-4),()=>{r.assign(pO(0,0,1))}).ElseIf(t.x.greaterThan(.9999),()=>{r.assign(pO(-1,0,0))}).ElseIf(t.y.greaterThan(.9999),()=>{r.assign(pO(0,-1,0))}).ElseIf(t.z.greaterThan(.9999),()=>{r.assign(pO(0,0,-1))}).Else(()=>{let i=e.sample(t.add(pO(-.01,0,0))).r.sub(e.sample(t.add(pO(.01,0,0))).r),n=e.sample(t.add(pO(0,-.01,0))).r.sub(e.sample(t.add(pO(0,.01,0))).r),a=e.sample(t.add(pO(0,0,-.01))).r.sub(e.sample(t.add(pO(0,0,.01))).r);r.assign(pO(i,n,a))}),r.normalize()});class Mb extends va{static get type(){return"Texture3DNode"}constructor(e,t=null,r=null){super(e,t,r),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return pO(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,!0===this.sampler?"vec3":"ivec3")}generateOffset(e,t){return t.build(e,"ivec3")}normal(e){return Mx({texture:this,uv:e})}}let MS=p_(Mb).setParameterLength(1,3);class MT extends yX{static get type(){return"UserDataNode"}constructor(e,t,r=null){super(e,t,r),this.userData=r}updateReference(e){return this.reference=null!==this.userData?this.userData:e.object.userData,this.reference}}let MA=new WeakMap;class MM extends cV{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=cR.OBJECT,this.updateAfterType=cR.OBJECT,this.previousModelWorldMatrix=fC(new eq),this.previousProjectionMatrix=fC(new eq).setGroup(fA),this.previousCameraViewMatrix=fC(new eq)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:r}){let i=MC(r);this.previousModelWorldMatrix.value.copy(i);let n=ME(t);n.frameId!==e&&(n.frameId=e,void 0===n.previousProjectionMatrix?(n.previousProjectionMatrix=new eq,n.previousCameraViewMatrix=new eq,n.currentProjectionMatrix=new eq,n.currentCameraViewMatrix=new eq,n.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),n.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(n.previousProjectionMatrix.copy(n.currentProjectionMatrix),n.previousCameraViewMatrix.copy(n.currentCameraViewMatrix)),n.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),n.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(n.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(n.previousCameraViewMatrix))}updateAfter({object:e}){MC(e).copy(e.matrixWorld)}setup(){let e=null===this.projectionMatrix?vH:fC(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),r=e.mul(yi).mul(yu),i=this.previousProjectionMatrix.mul(t).mul(yh);return fU(r.xy.div(r.w),i.xy.div(i.w))}}function ME(e){let t=MA.get(e);return void 0===t&&(t={},MA.set(e,t)),t}function MC(e,t=0){let r=ME(e),i=r[t];return void 0===i&&(r[t]=i=new eq,r[t].copy(e.matrixWorld)),i}let Mw=px(MM),MR=pA(([e])=>MI(e.rgb)),MN=pA(([e,t=pN(1)])=>t.mix(MI(e.rgb),e.rgb)),ML=pA(([e,t=pN(1)])=>{let r=fD(e.r,e.g,e.b).div(3),i=e.r.max(e.g.max(e.b)),n=i.sub(r).mul(t).mul(-3);return m0(e.rgb,i,n)}),MB=pA(([e,t=pN(1)])=>{let r=pO(.57735,.57735,.57735),i=t.cos();return pO(e.rgb.mul(i).add(r.cross(e.rgb).mul(t.sin()).add(r.mul(mj(r,e.rgb).mul(i.oneMinus())))))}),MI=(e,t=pO(eN.getLuminanceCoefficients(new eT)))=>mj(e,t),MP=pA(([e,t=pO(1),r=pO(0),i=pO(1),n=pN(1),a=pO(eN.getLuminanceCoefficients(new eT,G))])=>{let s=e.rgb.dot(pO(a)),o=mk(e.rgb.mul(t).add(r),0).toVar(),l=o.pow(i).toVar();return pC(o.r.greaterThan(0),()=>{o.r.assign(l.r)}),pC(o.g.greaterThan(0),()=>{o.g.assign(l.g)}),pC(o.b.greaterThan(0),()=>{o.b.assign(l.b)}),o.assign(s.add(o.sub(s).mul(n))),pz(o.rgb,e.a)}),MF=pA(([e,t])=>e.mul(t).floor().div(t)),MD=null;class MU extends xL{static get type(){return"ViewportSharedTextureNode"}constructor(e=vy,t=null){null===MD&&(MD=new nd),super(e,t,MD)}getTextureForReference(){return MD}updateReference(){return this}}let MO=p_(MU).setParameterLength(0,2),MG=new eb;class Mk extends va{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){return e.getNodeProperties(this).passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class MV extends Mk{static get type(){return"PassMultipleTextureNode"}constructor(e,t,r=!1){super(e,null),this.textureName=t,this.previousTexture=r,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){let e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.offsetNode=this.offsetNode,e}}class Mz extends cV{static get type(){return"PassNode"}constructor(e,t,r,i={}){super("vec4"),this.scope=e,this.scene=t,this.camera=r,this.options=i,this._pixelRatio=1,this._width=1,this._height=1;const n=new nv;n.isRenderTargetTexture=!0,n.name="depth";const a=new eV(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:1016,...i});a.texture.name="output",a.depthTexture=n,this.renderTarget=a,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:a.texture,depth:n},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=fC(0),this._cameraFar=fC(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=cR.FRAME,this.global=!0}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setResolution(e){return en("PassNode: .setResolution() is deprecated. Use .setRe
397solutionScale() instead."),this.setResolutionScale(e)}getResolution(){return en("PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead."),this.getResolutionScale()}setLayers(e){return this._layers=e,this}getLayers(){return this._layers}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getTexture(e){let t=this._textures[e];return void 0===t&&((t=this.renderTarget.texture.clone()).name=e,this._textures[e]=t,this.renderTarget.textures.push(t)),t}getPreviousTexture(e){let t=this._previousTextures[e];return void 0===t&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){let t=this._previousTextures[e];if(void 0!==t){let r=this._textures[e],i=this.renderTarget.textures.indexOf(r);this.renderTarget.textures[i]=t,this._textures[e]=t,this._previousTextures[e]=r,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return void 0===t&&((t=new MV(this,e)).updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return void 0===t&&(void 0===this._textureNodes[e]&&this.getTextureNode(e),(t=new MV(this,e,!0)).updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(void 0===t){let r=this._cameraNear,i=this._cameraFar;this._viewZNodes[e]=t=xW(this.getTextureNode(e),r,i)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(void 0===t){let r=this._cameraNear,i=this._cameraFar,n=this.getViewZNode(e);this._linearDepthNodes[e]=t=xk(n,r,i)}return t}async compileAsync(e){let t=e.getRenderTarget(),r=e.getMRT();e.setRenderTarget(this.renderTarget),e.setMRT(this._mrt),await e.compileAsync(this.scene,this.camera),e.setRenderTarget(t),e.setMRT(r)}setup({renderer:e}){return this.renderTarget.samples=void 0===this.options.samples?e.samples:this.options.samples,this.renderTarget.texture.type=e.getOutputBufferType(),this.scope===Mz.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){let t,r,{renderer:i}=e,{scene:n}=this,a=i.getOutputRenderTarget();a&&!0===a.isXRRenderTarget?(r=1,t=i.xr.getCamera(),i.xr.updateCamera(t),MG.set(a.width,a.height)):(t=this.camera,r=i.getPixelRatio(),i.getSize(MG)),this._pixelRatio=r,this.setSize(MG.width,MG.height);let s=i.getRenderTarget(),o=i.getMRT(),l=i.autoClear,u=i.transparent,h=i.opaque,d=t.layers.mask,c=i.contextNode,p=n.overrideMaterial;for(let e in this._cameraNear.value=t.near,this._cameraFar.value=t.far,null!==this._layers&&(t.layers.mask=this._layers.mask),this._previousTextures)this.toggleTexture(e);null!==this.overrideMaterial&&(n.overrideMaterial=this.overrideMaterial),i.setRenderTarget(this.renderTarget),i.setMRT(this._mrt),i.autoClear=!0,i.transparent=this.transparent,i.opaque=this.opaque,null!==this.contextNode&&((null===this._contextNodeCache||this._contextNodeCache.version!==this.version)&&(this._contextNodeCache={version:this.version,context:gi({...i.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),i.contextNode=this._contextNodeCache.context);let f=n.name;n.name=this.name?this.name:n.name,i.render(n,t),n.name=f,n.overrideMaterial=p,i.setRenderTarget(s),i.setMRT(o),i.autoClear=l,i.transparent=u,i.opaque=h,i.contextNode=c,t.layers.mask=d}setSize(e,t){this._width=e,this._height=t;let r=Math.floor(this._width*this._pixelRatio*this._resolutionScale),i=Math.floor(this._height*this._pixelRatio*this._resolutionScale);this.renderTarget.setSize(r,i),null!==this._scissor&&this.renderTarget.scissor.copy(this._scissor),null!==this._viewport&&this.renderTarget.viewport.copy(this._viewport)}setScissor(e,t,r,i){null===e?this._scissor=null:(null===this._scissor&&(this._scissor=new ek),e.isVector4?this._scissor.copy(e):this._scissor.set(e,t,r,i),this._scissor.multiplyScalar(this._pixelRatio*this._resolutionScale).floor())}setViewport(e,t,r,i){null===e?this._viewport=null:(null===this._viewport&&(this._viewport=new ek),e.isVector4?this._viewport.copy(e):this._viewport.set(e,t,r,i),this._viewport.multiplyScalar(this._pixelRatio*this._resolutionScale).floor())}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}Mz.COLOR="color",Mz.DEPTH="depth";class MH extends Mz{static get type(){return"ToonOutlinePassNode"}constructor(e,t,r,i,n){super(Mz.COLOR,e,t),this.colorNode=r,this.thicknessNode=i,this.alphaNode=n,this._materialCache=new WeakMap,this.name="Outline Pass"}updateBefore(e){let{renderer:t}=e,r=t.getRenderObjectFunction();t.setRenderObjectFunction((e,r,i,n,a,s,o,l)=>{if((a.isMeshToonMaterial||a.isMeshToonNodeMaterial)&&!1===a.wireframe){let u=this._getOutlineMaterial(a);
vendor: 4,133 bytes, line 397
397t.renderObject(e,r,i,n,u,s,o,l)}t.renderObject(e,r,i,n,a,s,o,l)}),super.updateBefore(e),t.setRenderObjectFunction(r)}_createMaterial(){let e=new x7;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=1;let t=yx.negate(),r=vH.mul(yi),i=pN(1),n=r.mul(pz(yu,1)),a=r.mul(pz(yu.add(t),1)),s=mv(n.sub(a));return e.vertexNode=n.add(s.mul(this.thicknessNode).mul(n.w).mul(i)),e.colorNode=pz(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return void 0===t&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}let MW=pA(([e,t])=>e.mul(t).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Mj=pA(([e,t])=>(e=e.mul(t)).div(e.add(1)).clamp()).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),MX=pA(([e,t])=>{let r=(e=(e=e.mul(t)).sub(.004).max(0)).mul(e.mul(6.2).add(.5)),i=e.mul(e.mul(6.2).add(1.7)).add(.06);return r.div(i).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),Mq=pA(([e])=>{let t=e.mul(e.add(.0245786)).sub(90537e-9),r=e.mul(e.add(.432951).mul(.983729)).add(.238081);return t.div(r)}),M$=pA(([e,t])=>{let r=pq(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),i=pq(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return e=e.mul(t).div(.6),e=Mq(e=r.mul(e)),(e=i.mul(e)).clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),MJ=pq(pO(1.6605,-.1246,-.0182),pO(-.5876,1.1329,-.1006),pO(-.0728,-.0083,1.1187)),MK=pq(pO(.6274,.0691,.0164),pO(.3293,.9195,.088),pO(.0433,.0113,.8956)),MY=pA(([e])=>{let t=pO(e).toVar(),r=pO(t.mul(t)).toVar(),i=pO(r.mul(r)).toVar();return pN(15.5).mul(i.mul(r)).sub(fO(40.14,i.mul(t))).add(fO(31.96,i).sub(fO(6.868,r.mul(t))).add(fO(.4298,r).add(fO(.1191,t).sub(.00232))))}),MQ=pA(([e,t])=>{let r=pO(e).toVar(),i=pq(pO(.856627153315983,.137318972929847,.11189821299995),pO(.0951212405381588,.761241990602591,.0767994186031903),pO(.0482516061458583,.101439036467562,.811302368396859)),n=pq(pO(1.1271005818144368,-.1413297634984383,-.14132976349843826),pO(-.11060664309660323,1.157823702216272,-.11060664309660294),pO(-.016493938717834573,-.016493938717834257,1.2519364065950405)),a=pN(-12.47393),s=pN(4.026069);return r.mulAssign(t),r.assign(MK.mul(r)),r.assign(i.mul(r)),r.assign(mk(r,1e-10)),r.assign(mc(r)),r.assign(r.sub(a).div(s.sub(a))),r.assign(m1(r,0,1)),r.assign(MY(r)),r.assign(n.mul(r)),r.assign(mq(mk(pO(0),r),pO(2.2))),r.assign(MJ.mul(r)),r.assign(m1(r,0,1)),r}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),MZ=pA(([e,t])=>{let r=pN(.76),i=pN(.15),n=mG((e=e.mul(t)).r,mG(e.g,e.b)),a=gt(n.lessThan(.08),n.sub(fO(6.25,n.mul(n))),.04);e.subAssign(a);let s=mk(e.r,mk(e.g,e.b));pC(s.lessThan(r),()=>e);let o=fU(1,r),l=fU(1,o.mul(o).div(s.add(o.sub(r))));e.mulAssign(l.div(s));let u=fU(1,fG(1,i.mul(s.sub(l)).add(1)));return m0(e,pO(l),u)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class M0 extends cO{static get type(){return"CodeNode"}constructor(e="",t=[],r=""){super("code"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=r}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){for(let t of this.getIncludes(e))t.build(e);let t=e.getCodeFromNode(this,this.getNodeType(e));return t.code=this.code,t.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}}let M1=p_(M0).setParameterLength(1,3);class M2 extends M0{static get type(){return"FunctionNode"}constructor(e="",t=[],r=""){super(e,t,r)}getNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){let r=this.getNodeType(e);return e.getStructTypeNode(r).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}
397getNodeFunction(e){let t=e.getDataFromNode(this),r=t.nodeFunction;return void 0===r&&(t.nodeFunction=r=e.parser.parseFunction(this.code)),r}generate(e,t){super.generate(e);let r=this.getNodeFunction(e),i=r.name,n=r.type,a=e.getCodeFromNode(this,n);""!==i&&(a.name=i);let s=e.getPropertyName(a);return(a.code=this.getNodeFunction(e).getCode(s)+"\n","property"===t)?s:e.format(`${s}()`,n,t)}}let M3=(e,t=[],r="")=>{for(let e=0;e<t.length;e++){let r=t[e];"function"==typeof r&&(t[e]=r.functionNode)}let i=new M2(e,t,r),n=(...e)=>i.call(...e);return n.functionNode=i,n};function M4(e){let t,r=e.context.getViewZ;return void 0!==r&&(t=r(this)),(t||yp.z).negate()}let M5=pA(([e,t],r)=>m4(e,t,M4(r))),M8=pA(([e],t)=>{let r=M4(t);return e.mul(e,r,r).negate().exp().oneMinus()}),M6=pA(([e,t],r)=>{let i=M4(r),n=t.sub(yd.y).max(0).toConst().mul(i).toConst();return e.mul(e,n,n).negate().exp().oneMinus()}),M9=pA(([e,t])=>pz(t.toFloat().mix(fh.rgb,e.toVec3()),fh.a)),M7=null,Ee=null;class Et extends cO{static get type(){return"RangeNode"}constructor(e=pN(),t=pN()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){let t=this.getConstNode(this.minNode),r=this.getConstNode(this.maxNode),i=e.getTypeLength(cS(t.value)),n=e.getTypeLength(cS(r.value));return i>n?i:n}getNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}getConstNode(e){let t=null;if(e.traverse(e=>{!0===e.isConstNode&&(t=e)}),null===t)throw new vi('THREE.TSL: No "ConstNode" found in node graph.',this.stackTrace);return t}setup(e){let t=e.object,r=null;if(t.count>1){let i=this.getConstNode(this.minNode),n=this.getConstNode(this.maxNode),a=i.value,s=n.value,o=e.getTypeLength(cS(a)),l=e.getTypeLength(cS(s));M7=M7||new ek,Ee=Ee||new ek,M7.setScalar(0),Ee.setScalar(0),1===o?M7.setScalar(a):a.isColor?M7.set(a.r,a.g,a.b,1):M7.set(a.x,a.y,a.z||0,a.w||0),1===l?Ee.setScalar(s):s.isColor?Ee.set(s.r,s.g,s.b,1):Ee.set(s.x,s.y,s.z||0,s.w||0);let u=4*t.count,h=new Float32Array(u);for(let e=0;e<u;e++){let t=e%4,r=M7.getComponent(t),i=Ee.getComponent(t);h[e]=ex.lerp(r,i,Math.random())}let d=this.getNodeType(e);if(4*t.count*4<=e.getUniformBufferLimit())r=vh(h,"vec4",t.count).element(xi).convert(d);else{let t=new im(h,4);e.geometry.setAttribute("__range"+this.id,t),r=gU(t).convert(d)}}else r=pN(0);return r}}let Er=p_(Et).setParameterLength(2);class Ei extends cO{static get type(){return"ComputeBuiltinNode"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}getNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){return e.hasBuiltin(this._builtinName)}generate(e,t){let r=this.getBuiltinName(e),i=this.getNodeType(e);return"compute"===e.shaderStage?e.format(r,i,t):(en(`ComputeBuiltinNode: Compute built-in value ${r} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(i))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}}let En=(e,t)=>new Ei(e,t),Ea=En("numWorkgroups","uvec3"),Es=En("workgroupId","uvec3"),Eo=En("globalId","uvec3"),El=En("localId","uvec3"),Eu=En("subgroupSize","uint");class Eh extends cO{constructor(e){super(),this.scope=e}generate(e){let{scope:t}=this,{renderer:r}=e;!0===r.backend.isWebGLBackend?e.addFlowCode(` // ${t}Barrier 398`):e.addLineFlowCode(`${t}Barrier()`,this)}}let Ed=p_(Eh);class Ec extends cG{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let r,i=e.context.assign;if(r=super.generate(e),!0!==i){let i=this.getNodeType(e);r=e.format(r,i,t)}return r}}class Ep extends cO{constructor(e,t,r=0){super(t),this.bufferType=t,this.bufferCount=r,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=""}setName(e){return this.name=e,this}label(e){return en('TSL: "label()" has been deprecated. Use "setName()" instead.',new ch),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new Ec(this,e)}generate(e){let t=""!==this.name?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}class Ef extends cO{static get type(){return"AtomicFunctionNode"}constructor(e,t,r){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=r,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){let t=e.getNodeProperties(this),r=t.parents,i=this.method,n=this.getNodeType(e),a=this.getInputType(e),s=this.pointerNode,o=this.valueNode,l=[];l.push(`&${s.build(e,a)}`),null!==o&&l.push(o.build(e,a));let u=`${e.getMethod(i,n)}( ${l.join(", ")} )`;if(!(r&&1===r.length&&!0===r[0].isStackNode))return void 0===t.constNode&&(t.constNode=gY(u,n).toConst()),t.constNode.build(e);e.addLineFlowCode(u,this)}}Ef.ATOMIC_LOAD="atomicLoad",Ef.ATOMIC_STORE="atomicStore",Ef.ATOMIC_ADD="atomicAdd",Ef.ATOMIC_SUB="atomicSub",Ef.ATOMIC_MAX="atomicMax",Ef.ATOMIC_MIN="atomicMin",Ef.ATOMIC_AND="atomicAnd",Ef.ATOMIC_OR="atomicOr",Ef.ATOMIC_XOR="atomicXor";let Em=p_(Ef),Eg=(e,t,r)=>Em(e,t,r).toStack();class Ev extends cV{static get type(){return"SubgroupFunctionNode"}constructor(e,t=null,r=null){super(),this.method=e,this.aNode=t,this.bNode=r}getInputType(e){let t=this.aNode?this.aNode.getNodeType(e):null,r=this.bNode?this.bNode.getNodeType(e):null;return(e.isMatrix(t)?0:e.getTypeLength(t))>(e.isMatrix(r)?0:e.getTypeLength(r))?t:r}getNodeType(e){let t=this.method;return t===Ev.SUBGROUP_ELECT?"bool":t===Ev.SUBGROUP_BALLOT?"uvec4":this.getInputType(e)}generate(e,t){let r=this.method,i=this.getNodeType(e),n=this.getInputType(e),a=this.aNode,s=this.bNode,o=[];if(r===Ev.SUBGROUP_BROADCAST||r===Ev.SUBGROUP_SHUFFLE||r===Ev.QUAD_BROADCAST){let t=s.getNodeType(e);o.push(a.build(e,i),s.build(e,"float"===t?"int":i))}else r===Ev.SUBGROUP_SHUFFLE_XOR||r===Ev.SUBGROUP_SHUFFLE_DOWN||r===Ev.SUBGROUP_SHUFFLE_UP?o.push(a.build(e,i),s.build(e,"uint")):(null!==a&&o.push(a.build(e,n)),null!==s&&o.push(s.build(e,n)));let l=0===o.length?"()":`( ${o.join(", ")} )`;return e.format(`${e.getMethod(r,i)}${l}`,i,t)}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}Ev.SUBGROUP_ELECT="subgroupElect",Ev.SUBGROUP_BALLOT="subgroupBallot",Ev.SUBGROUP_ADD="subgroupAdd",Ev.SUBGROUP_INCLUSIVE_ADD="subgroupInclusiveAdd",Ev.SUBGROUP_EXCLUSIVE_AND="subgroupExclusiveAdd",Ev.SUBGROUP_MUL="subgroupMul",Ev.SUBGROUP_INCLUSIVE_MUL="subgroupInclusiveMul",Ev.SUBGROUP_EXCLUSIVE_MUL="subgroupExclusiveMul",Ev.SUBGROUP_AND="subgroupAnd",Ev.SUBGROUP_OR="subgroupOr",Ev.SUBGROUP_XOR="subgroupXor",Ev.SUBGROUP_MIN="subgroupMin",Ev.SUBGROUP_MAX="subgroupMax",Ev.SUBGROUP_ALL="subgroupAll",Ev.SUBGROUP_ANY="subgroupAny",Ev.SUBGROUP_BROADCAST_FIRST="subgroupBroadcastFirst",Ev.QUAD_SWAP_X="quadSwapX",Ev.QUAD_SWAP_Y="quadSwapY",Ev.QUAD_SWAP_DIAGONAL="quadSwapDiagonal",Ev.SUBGROUP_BROADCAST="subgroupBroadcast",Ev.SUBGROUP_SHUFFLE="subgroupShuffle",Ev.SUBGROUP_SHUFFLE_XOR="subgroupShuffleXor",Ev.SUBGROUP_SHUFFLE_UP="subgroupShuffleUp",Ev.SUBGROUP_SHUFFLE_DOWN="subgroupShuffleDown",Ev.QUAD_BROADCAST="quadBroadcast";let Ey=pb(Ev,Ev.SUBGROUP_ELECT).setParameterLength(0),E_=pb(Ev,Ev.SUBGROUP_BALLOT).setParameterLength(1),Ex=pb(Ev,Ev.SUBGROUP_ADD).setParameterLength(1),Eb=pb(Ev,Ev.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),ES=pb(Ev,Ev.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),ET=pb(Ev,Ev.SUBGROUP_MUL).setParameterLength(1),EA=pb(Ev,Ev.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),EM=pb(Ev,Ev.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),EE=pb(Ev,Ev.SUBGROUP_AND).setParameterLength(1),EC=pb(Ev,Ev.SUBGROUP_OR).setParameterLength(1),Ew=pb(Ev,Ev.SUBGROUP_XOR).setParameterLength(1),ER=pb(Ev,Ev.SUBGROUP_MIN).setParameterLength(1),EN=pb(Ev,Ev.SUBGROUP_MAX).setParameterLength(1),EL=pb(Ev,Ev.SUBGROUP_ALL).setParameterLength(0),EB=pb(Ev,Ev.SUBGROUP_ANY).setParameterLength(0),EI=pb(Ev,Ev.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),EP=pb(Ev,Ev.QUAD_SWAP_X).setParameterLength(1),EF=pb(Ev,Ev.QUAD_SWAP_Y).setParameterLength(1),ED=pb(Ev,Ev.QUAD_SWAP_DIAGONAL).setParameterLength(1),EU=pb(Ev,Ev.SUBGROUP_BROADCAST).setParameterLength(2),EO=pb(Ev,Ev.SUBGROUP_SHUFFLE).setParameterLength(2),EG=pb(Ev,Ev.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),Ek=pb(Ev,Ev.SUBGROUP_SHUFFLE_UP).setParameterLength(2),EV=pb(Ev,Ev.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),Ez=pb(Ev,Ev.QUAD_BROADCAST).setParameterLength(1);function EH(e){let t=(p=p||new WeakMap).get(e);return void 0===t&&p.set(e,t={}),t}function EW(e){let t=EH(e);return t.shadowMatrix||(t.shadowMatrix=fC("mat4").setGroup(fA).onRenderUpd
398ate(t=>((!0!==e.castShadow||!1===t.renderer.shadowMap.enabled)&&(e.shadow.camera.coordinateSystem!==t.camera.coordinateSystem&&(e.shadow.camera.coordinateSystem=t.camera.coordinateSystem,e.shadow.camera.updateProjectionMatrix()),e.shadow.updateMatrices(e)),e.shadow.matrix)))}function Ej(e,t=yd){let r=EW(e).mul(t);return r.xyz.div(r.w)}function EX(e){let t=EH(e);return t.position||(t.position=fC(new eT).setGroup(fA).onRenderUpdate((t,r)=>r.value.setFromMatrixPosition(e.matrixWorld)))}function Eq(e){let t=EH(e);return t.targetPosition||(t.targetPosition=fC(new eT).setGroup(fA).onRenderUpdate((t,r)=>r.value.setFromMatrixPosition(e.target.matrixWorld)))}function E$(e){let t=EH(e);return t.viewPosition||(t.viewPosition=fC(new eT).setGroup(fA).onRenderUpdate(({camera:t},r)=>{r.value=r.value||new eT,r.value.setFromMatrixPosition(e.matrixWorld),r.value.applyMatrix4(t.matrixWorldInverse)}))}let EJ=e=>vj.transformDirection(EX(e).sub(Eq(e))),EK=(e,t)=>{for(let r of t)if(r.isAnalyticLightNode&&r.light.id===e)return r;return null},EY=new WeakMap,EQ=[];class EZ extends cO{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=pQ("vec3","totalDiffuse"),this.totalSpecularNode=pQ("vec3","totalSpecular"),this.outgoingLightNode=pQ("vec3","outgoingLight"),this._lights=[],this._lightNodes=null,this._lightNodesHash=null,this.global=!0}customCacheKey(){let e=this._lights;for(let t=0;t<e.length;t++){let r=e[t];if(EQ.push(r.id),EQ.push(+!!r.castShadow),!0===r.isSpotLight){let e=null!==r.map?r.map.id:-1,t=r.colorNode?r.colorNode.getCacheKey():-1;EQ.push(e,t)}}let t=cp(EQ);return EQ.length=0,t}getHash(e){if(null===this._lightNodesHash){null===this._lightNodes&&this.setupLightsNode(e);let t=[];for(let e of this._lightNodes)t.push(e.getHash());this._lightNodesHash="lights-"+t.join(",")}return this._lightNodesHash}analyze(e){let t=e.getNodeProperties(this);for(let r of t.nodes)r.build(e);t.outputNode.build(e)}setupLightsNode(e){let t=[],r=this._lightNodes,i=this._lights.sort((e,t)=>e.id-t.id),n=e.renderer.library;for(let e of i)if(e.isNode)t.push(pm(e));else{let i=null;if(null!==r&&(i=EK(e.id,r)),null===i){let r=n.getLightNodeClass(e.constructor);if(null===r){en(`LightsNode.setupNodeLights: Light node not found for ${e.constructor.name}`);continue}let i=null;EY.has(e)?i=EY.get(e):(i=new r(e),EY.set(e,i)),t.push(i)}}this._lightNodes=t}setupDirectLight(e,t,r){let{lightingModel:i,reflectedLight:n}=e.context;i.direct({...r,lightNode:t,reflectedLight:n},e)}setupDirectRectAreaLight(e,t,r){let{lightingModel:i,reflectedLight:n}=e.context;i.directRectArea({...r,lightNode:t,reflectedLight:n},e)}setupLights(e,t){for(let r of t)r.build(e)}getLightNodes(e){return null===this._lightNodes&&this.setupLightsNode(e),this._lightNodes}setup(e){let t=e.lightsNode;e.lightsNode=this;let r=this.outgoingLightNode,i=e.context,n=i.lightingModel,a=e.getNodeProperties(this);if(n){let{totalDiffuseNode:t,totalSpecularNode:s}=this;i.outgoingLight=r,a.nodes=e.addStack().nodes,n.start(e);let{backdrop:o,backdropAlpha:l}=i,{directDiffuse:u,directSpecular:h,indirectDiffuse:d,indirectSpecular:c}=i.reflectedLight,p=u.add(d);null!==o&&(p=null!==l?pO(l.mix(p,o)):pO(o)),t.assign(p),s.assign(h.add(c)),r.assign(t.add(s)),n.finish(e),r=r.bypass(e.removeStack())}else a.nodes=[];return e.lightsNode=t,r}setLights(e){return this._lights=e,this._lightNodes=null,this._lightNodesHash=null,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}}class E0 extends cO{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=cR.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){E1.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||yd)}}let E1=pQ("vec3","shadowPositionWorld");function E2(e,t={}){return t.toneMapping=e.toneMapping,t.toneMappingExposure=e.toneMappingExposure,t.outputColorSpace=e.outputColorSpace,t.renderTarget=e.getRenderTarget(),t.activeCubeFace=e.getActiveCubeFace(),t.activeMipmapLevel=e.getActiveMipmapLevel(),t.renderObjectFunction=e.getRenderObjectFunction(),t.pixelRatio=e.getPixelRatio(),t.mrt=e.getMRT(),t.clearColor=e.getClearColor(t.clearColor||new ty),t.clearAlpha=e.getClearAlpha(),t.autoClear=e.autoClear,t.scissorTest=e.getScissorTest(),t}function E3(e,t){return t=E2(e,t),e.setMRT(null),e.setRenderObjectFunction(null),e.setClearColor(0,1),e.autoClear=!0,t}function E4(e,t){e.toneMapping=t.toneMapping,e.toneMappingExposure=t.toneMappingExposure,e.outputColorSpace
398=t.outputColorSpace,e.setRenderTarget(t.renderTarget,t.activeCubeFace,t.activeMipmapLevel),e.setRenderObjectFunction(t.renderObjectFunction),e.setPixelRatio(t.pixelRatio),e.setMRT(t.mrt),e.setClearColor(t.clearColor,t.clearAlpha),e.autoClear=t.autoClear,e.setScissorTest(t.scissorTest)}function E5(e,t={}){return t.background=e.background,t.backgroundNode=e.backgroundNode,t.overrideMaterial=e.overrideMaterial,t}function E8(e,t){return t=E5(e,t),e.background=null,e.backgroundNode=null,e.overrideMaterial=null,t}function E6(e,t){e.background=t.background,e.backgroundNode=t.backgroundNode,e.overrideMaterial=t.overrideMaterial}function E9(e,t,r){return E8(t,r=E3(e,r))}function E7(e,t,r){E4(e,r),E6(t,r)}var Ce=Object.freeze({__proto__:null,resetRendererAndSceneState:E9,resetRendererState:E3,resetSceneState:E8,restoreRendererAndSceneState:E7,restoreRendererState:E4,restoreSceneState:E6,saveRendererAndSceneState:function(e,t,r={}){return E5(t,r=E2(e,r))},saveRendererState:E2,saveSceneState:E5});let Ct=new WeakMap,Cr=pA(({depthTexture:e,shadowCoord:t,depthLayer:r})=>{let i=vo(e,t.xy).setName("t_basic");return e.isArrayTexture&&(i=i.depth(r)),i.compare(t.z)}),Ci=pA(({depthTexture:e,shadowCoord:t,shadow:r,depthLayer:i})=>{let n=(t,r)=>{let n=vo(e,t);return e.isArrayTexture&&(n=n.depth(i)),n.compare(r)},a=yq("mapSize","vec2",r).setGroup(fA),s=yq("radius","float",r).setGroup(fA),o=pP(1).div(a),l=s.mul(o.x),u=Mn(vx.xy).mul(6.28318530718);return fD(n(t.xy.add(Ma(0,5,u).mul(l)),t.z),n(t.xy.add(Ma(1,5,u).mul(l)),t.z),n(t.xy.add(Ma(2,5,u).mul(l)),t.z),n(t.xy.add(Ma(3,5,u).mul(l)),t.z),n(t.xy.add(Ma(4,5,u).mul(l)),t.z)).mul(.2)}),Cn=pA(({depthTexture:e,shadowCoord:t,shadow:r,depthLayer:i})=>{let n=(t,r)=>{let n=vo(e,t);return e.isArrayTexture&&(n=n.depth(i)),n.compare(r)},a=yq("mapSize","vec2",r).setGroup(fA),s=pP(1).div(a),o=s.x,l=s.y,u=t.xy,h=my(u.mul(a).add(.5));return u.subAssign(h.mul(s)),fD(n(u,t.z),n(u.add(pP(o,0)),t.z),n(u.add(pP(0,l)),t.z),n(u.add(s),t.z),m0(n(u.add(pP(o.negate(),0)),t.z),n(u.add(pP(o.mul(2),0)),t.z),h.x),m0(n(u.add(pP(o.negate(),l)),t.z),n(u.add(pP(o.mul(2),l)),t.z),h.x),m0(n(u.add(pP(0,l.negate())),t.z),n(u.add(pP(0,l.mul(2))),t.z),h.y),m0(n(u.add(pP(o,l.negate())),t.z),n(u.add(pP(o,l.mul(2))),t.z),h.y),m0(m0(n(u.add(pP(o.negate(),l.negate())),t.z),n(u.add(pP(o.mul(2),l.negate())),t.z),h.x),m0(n(u.add(pP(o.negate(),l.mul(2))),t.z),n(u.add(pP(o.mul(2),l.mul(2))),t.z),h.x),h.y)).mul(1/9)}),Ca=pA(({depthTexture:e,shadowCoord:t,depthLayer:r},i)=>{let n=vo(e).sample(t.xy);e.isArrayTexture&&(n=n.depth(r));let a=(n=n.rg).x,s=mk(1e-7,n.y.mul(n.y)),o=i.renderer.reversedDepthBuffer?mV(a,t.z):mV(t.z,a),l=pN(1).toVar();return pC(o.notEqual(1),()=>{let e=t.z.sub(a),r=s.div(s.add(e.mul(e)));r=m1(fU(r,.3).div(.65)),l.assign(mk(o,r))}),l}),Cs=e=>{let t=Ct.get(e);return void 0===t&&((t=new x7).colorNode=pz(0,0,0,1),t.isShadowPassMaterial=!0,t.name="ShadowMaterial",t.blending=0,t.fog=!1,Ct.set(e,t)),t},Co=e=>{let t=Ct.get(e);void 0!==t&&(t.dispose(),Ct.delete(e))},Cl=new TR,Cu=[],Ch=(e,t,r,i)=>{Cu[0]=e,Cu[1]=t;let n=Cl.get(Cu);return(void 0===n||n.shadowType!==r||n.useVelocity!==i)&&((n=(n,a,s,o,l,u,...h)=>{(!0===n.castShadow||n.receiveShadow&&3===r)&&(i&&(cA(n).useVelocity=!0),n.onBeforeShadow(e,n,s,t.camera,o,a.overrideMaterial,u),e.renderObject(n,a,s,o,l,u,...h),n.onAfterShadow(e,n,s,t.camera,o,a.overrideMaterial,u))}).shadowType=r,n.useVelocity=i,Cl.set(Cu,n)),Cu[0]=null,Cu[1]=null,n},Cd=pA(({samples:e,radius:t,size:r,shadowPass:i,depthLayer:n})=>{let a=pN(0).toVar("meanVertical"),s=pN(0).toVar("squareMeanVertical"),o=e.lessThanEqual(pN(1)).select(pN(0),pN(2).div(e.sub(1))),l=e.lessThanEqual(pN(1)).select(pN(0),pN(-1));xy({start:pL(0),end:pL(e),type:"int",condition:"<"},({i:e})=>{let u=l.add(pN(e).mul(o)),h=i.sample(fD(vx.xy,pP(0,u).mul(t)).div(r));i.value.isArrayTexture&&(h=h.depth(n)),h=h.x,a.addAssign(h),s.addAssign(h.mul(h))}),a.divAssign(e),s.divAssign(e);let u=mp(s.sub(a.mul(a)).max(0));return pP(a,u)}),Cc=pA(({samples:e,radius:t,size:r,shadowPass:i,depthLayer:n})=>{let a=pN(0).toVar("meanHorizontal"),s=pN(0).toVar("squareMeanHorizontal"),o=e.lessThanEqual(pN(1)).select(pN(0),pN(2).div(e.sub(1))),l=e.lessThanEqual(pN(1)).select(pN(0),pN(-1));xy({start:pL(0),end:pL(e),type:"int",condition:"<"},({i:e})=>{let u=l.add(pN(e).mul(o)),h=i.sample(fD(vx.xy,pP(u,0).mul(t)).div(r));i.value.isArrayTexture&&(h=h.depth(n)),a.addAssign(h.x),s.addAssign(fD(h.y.mul(h.y),h.x.mul(h.x)))}),a.divAssign(e),s.divAssign(e);let u=mp(s.sub(a.mul(a)).max(0));return pP(a,u)}
398),Cp=[Cr,Ci,Cn,Ca],Cf=new A6;class Cm extends E0{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:r,shadowCoord:i,shadow:n,depthLayer:a}){let s=i.x.greaterThanEqual(0).and(i.x.lessThanEqual(1)).and(i.y.greaterThanEqual(0)).and(i.y.lessThanEqual(1)).and(i.z.lessThanEqual(1)),o=t({depthTexture:r,shadowCoord:i,shadow:n,depthLayer:a});return s.select(o,pN(1))}setupShadowCoord(e,t){let r,{shadow:i}=this,{renderer:n}=e,a=i.biasNode||yq("bias","float",i).setGroup(fA),s=t;if(i.camera.isOrthographicCamera||!0!==n.logarithmicDepthBuffer)r=(s=s.xyz.div(s.w)).z;else{let e=s.w;s=s.xy.div(e);let t=yq("near","float",i.camera).setGroup(fA),n=yq("far","float",i.camera).setGroup(fA);r=xj(e.negate(),t,n)}return pO(s.x,s.y.oneMinus(),n.reversedDepthBuffer?r.sub(a):r.add(a))}getShadowFilterFn(e){return Cp[e]}setupRenderTarget(e,t){let r=new nv(e.mapSize.width,e.mapSize.height);r.name="ShadowDepthTexture",r.compareFunction=t.renderer.reversedDepthBuffer?518:515;let i=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return i.texture.name="ShadowMap",i.texture.type=e.mapType,i.depthTexture=r,{shadowMap:i,depthTexture:r}}setupShadow(e){let t,r,{renderer:i,camera:n}=e,{light:a,shadow:s}=this,{depthTexture:o,shadowMap:l}=this.setupRenderTarget(s,e),u=i.shadowMap.type;if(1===u||2===u?(o.minFilter=1006,o.magFilter=1006):(o.minFilter=1003,o.magFilter=1003),s.camera.coordinateSystem=n.coordinateSystem,s.camera.updateProjectionMatrix(),3===u&&!0!==s.isPointLightShadow){o.compareFunction=null,l.depth>1?(l._vsmShadowMapVertical||(l._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:1030,type:1016,depth:l.depth,depthBuffer:!1}),l._vsmShadowMapVertical.texture.name="VSMVertical"),this.vsmShadowMapVertical=l._vsmShadowMapVertical,l._vsmShadowMapHorizontal||(l._vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:1030,type:1016,depth:l.depth,depthBuffer:!1}),l._vsmShadowMapHorizontal.texture.name="VSMHorizontal"),this.vsmShadowMapHorizontal=l._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:1030,type:1016,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:1030,type:1016,depthBuffer:!1}));let t=vo(o);o.isArrayTexture&&(t=t.depth(this.depthLayer));let r=vo(this.vsmShadowMapVertical.texture);o.isArrayTexture&&(r=r.depth(this.depthLayer));let i=yq("blurSamples","float",s).setGroup(fA),n=yq("radius","float",s).setGroup(fA),a=yq("mapSize","vec2",s).setGroup(fA),u=this.vsmMaterialVertical||(this.vsmMaterialVertical=new x7);u.fragmentNode=Cd({samples:i,radius:n,size:a,shadowPass:t,depthLayer:this.depthLayer}).context(e.getSharedContext()),u.name="VSMVertical",(u=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new x7)).fragmentNode=Cc({samples:i,radius:n,size:a,shadowPass:r,depthLayer:this.depthLayer}).context(e.getSharedContext()),u.name="VSMHorizontal"}let h=yq("intensity","float",s).setGroup(fA),d=yq("normalBias","float",s).setGroup(fA),c=EW(a).mul(E1.add(yM.mul(d))),p=this.setupShadowCoord(e,c),f=s.filterNode||this.getShadowFilterFn(i.shadowMap.type)||null;if(null===f)throw Error("THREE.WebGPURenderer: Shadow map type not supported yet.");let m=3===u&&!0!==s.isPointLightShadow?this.vsmShadowMapHorizontal.texture:o,g=this.setupShadowFilter(e,{filterFn:f,shadowTexture:l.texture,depthTexture:m,shadowCoord:p,shadow:s,depthLayer:this.depthLayer});!0===i.shadowMap.transmitted&&(l.texture.isCubeTexture?t=yW(l.texture,p.xyz):(t=vo(l.texture,p),o.isArrayTexture&&(t=t.depth(this.depthLayer)))),r=t?m0(1,g.rgb.mix(t,1),h.mul(t.a)).toVar():m0(1,g,h).toVar(),this.shadowMap=l,this.shadow.map=l;let v=`${this.light.type} Shadow [ ${this.light.name||"ID: "+this.light.id} ]`;return t&&r.toInspector(`${v} / Color`,()=>this.shadowMap.texture.isCubeTexture?yW(this.shadowMap.texture):vo(this.shadowMap.texture)),r.toInspector(`${v} / Depth`,()=>this.shadowMap.texture.isCubeTexture?yW(this.shadowMap.texture).r.oneMinus():vl(this.shadowMap.depthTexture,g9().mul(ve(vo(this.shadowMap.depthTexture)))).r.oneMinus())}setup(e){if(!1!==e.renderer.shadowMap.enabled)return pA(()=>{let t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let r=this._node;return this.setupShadowPosition(e),null===r&&(this._node=r=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(r=e.material.receivedShadowNode(r)),r})()}renderShadow(e){let{shadow:t,shadowMap:r,light:i}=this,{renderer:n,scene:a}=e;t.updateMatrices(i),r.setSize(t.mapSize.width,t.mapSize.height,r.depth);let s=a.name;a.name=`Shadow Map [ ${i.name||"ID: "+i.id} ]`,n.render(a,t.camera),a.name=s}updateShadow(e){let{shadowMap:t,light:r,shadow:i}=this,{renderer:n,scene:a,camera:s}=e,o=n.shadowMap.type,l=t.depthTexture.version;this._depthVersionCached=l;let u=i.camera.layers.mask;(0xfffffffe&i.camera.layers.mask)==0&&(i.camera.layers.mask=s.layers.mask);let h=n.getRenderObjectFunction(),d=n.getMRT(),c=!!d&&d.has("velocity");f=E9(n,a,f),a.overrideMaterial=Cs(r),n.setRenderObjectFunction(Ch(n,i,o,c)),n.setClearColor(0,0),n.setRenderTarget(t),this.renderShadow(e),n.setRenderObjectFunction(h),3===o&&!0!==i.isPointLightShadow&&this.vsmPass(n),i.camera.layers.mask=u,E7(n,a,f)}vsmPass(e){let{shadow:t}=this,r=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,r),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,r),e.setRenderTarget(this.vsmShadowMapVertical),Cf.material=this.vsmMaterialVertical,Cf.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),Cf.material=this.vsmMaterialHorizontal,Cf.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,Co(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),null!==this.vsmShadowMapVertical&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),null!==this.vsmShadowMapHorizontal&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){let{shadow:t}=this,r=t.needsUpdate||t.autoUpdate;r&&(this._cameraFrameId[e.camera]===e.frameId&&(r=!1),this._cameraFrameId[e.camera]=e.frameId),r&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}}let Cg=(e,t)=>
398new Cm(e,t),Cv=new ty,Cy=new eq,C_=new eT,Cx=new eT,Cb=[new eT(1,0,0),new eT(-1,0,0),new eT(0,-1,0),new eT(0,1,0),new eT(0,0,1),new eT(0,0,-1)],CS=[new eT(0,-1,0),new eT(0,-1,0),new eT(0,0,-1),new eT(0,0,1),new eT(0,-1,0),new eT(0,-1,0)],CT=[new eT(1,0,0),new eT(-1,0,0),new eT(0,1,0),new eT(0,-1,0),new eT(0,0,1),new eT(0,0,-1)],CA=[new eT(0,-1,0),new eT(0,-1,0),new eT(0,0,1),new eT(0,0,-1),new eT(0,-1,0),new eT(0,-1,0)],CM=pA(({depthTexture:e,bd3D:t,dp:r})=>yW(e,t).compare(r)),CE=pA(({depthTexture:e,bd3D:t,dp:r,shadow:i})=>{let n=yq("radius","float",i).setGroup(fA),a=yq("mapSize","vec2",i).setGroup(fA),s=n.div(a.x),o=mM(t),l=mv(mX(t,o.x.greaterThan(o.z).select(pO(0,1,0),pO(1,0,0)))),u=mX(t,l),h=Mn(vx.xy).mul(6.28318530718),d=Ma(0,5,h),c=Ma(1,5,h),p=Ma(2,5,h),f=Ma(3,5,h),m=Ma(4,5,h);return yW(e,t.add(l.mul(d.x).add(u.mul(d.y)).mul(s))).compare(r).add(yW(e,t.add(l.mul(c.x).add(u.mul(c.y)).mul(s))).compare(r)).add(yW(e,t.add(l.mul(p.x).add(u.mul(p.y)).mul(s))).compare(r)).add(yW(e,t.add(l.mul(f.x).add(u.mul(f.y)).mul(s))).compare(r)).add(yW(e,t.add(l.mul(m.x).add(u.mul(m.y)).mul(s))).compare(r)).mul(.2)}),CC=pA(({filterFn:e,depthTexture:t,shadowCoord:r,shadow:i},n)=>{let a=r.xyz.toConst(),s=a.abs().toConst(),o=s.x.max(s.y).max(s.z),l=fC("float").setGroup(fA).onRenderUpdate(()=>i.camera.near),u=fC("float").setGroup(fA).onRenderUpdate(()=>i.camera.far),h=yq("bias","float",i).setGroup(fA),d=pN(1).toVar();return pC(o.sub(u).lessThanEqual(0).and(o.sub(l).greaterThanEqual(0)),()=>{let r;n.renderer.reversedDepthBuffer?(r=xH(o.negate(),l,u)).subAssign(h):(r=xz(o.negate(),l,u)).addAssign(h);let s=a.normalize();d.assign(e({depthTexture:t,bd3D:s,dp:r,shadow:i}))}),d});class Cw extends Cm{static get type(){return"PointShadowNode"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return 0===e?CM:CE}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:r,shadowCoord:i,shadow:n}){return CC({filterFn:t,depthTexture:r,shadowCoord:i,shadow:n})}setupRenderTarget(e,t){let r=new ny(e.mapSize.width);r.name="PointShadowDepthTexture",r.compareFunction=t.renderer.reversedDepthBuffer?518:515;let i=t.createCubeRenderTarget(e.mapSize.width);return i.texture.name="PointShadowMap",i.depthTexture=r,{shadowMap:i,depthTexture:r}}renderShadow(e){let{shadow:t,shadowMap:r,light:i}=this,{renderer:n,scene:a}=e,s=t.camera,o=t.matrix,l=2001===n.coordinateSystem,u=l?Cb:CT,h=l?CS:CA;r.setSize(t.mapSize.width,t.mapSize.width);let d=n.autoClear,c=n.getClearColor(Cv),p=n.getClearAlpha();n.autoClear=!1,n.setClearColor(t.clearColor,t.clearAlpha);for(let e=0;e<6;e++){n.setRenderTarget(r,e),n.clear();let l=i.distance||s.far;l!==s.far&&(s.far=l,s.updateProjectionMatrix()),C_.setFromMatrixPosition(i.matrixWorld),s.position.copy(C_),Cx.copy(s.position),Cx.add(u[e]),s.up.copy(h[e]),s.lookAt(Cx),s.updateMatrixWorld(),o.makeTranslation(-C_.x,-C_.y,-C_.z),Cy.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),t._frustum.setFromProjectionMatrix(Cy,s.coordinateSystem,s.reversedDepth);let d=a.name;a.name=`Point Light Shadow [ ${i.name||"ID: "+i.id} ] - Face ${e+1}`,n.render(a,s),a.name=d}n.autoClear=d,n.setClearColor(c,p)}}let CR=(e,t)=>new Cw(e,t);class CN extends xM{static get type(){return"AnalyticLightNode"}constructor(e=null){super(),this.light=e,this.color=new ty,this.colorNode=e&&e.colorNode||fC(this.color).setGroup(fA),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=cR.FRAME,e&&e.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},e.addEventListener("dispose",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener("dispose",this._shadowDisposeListener),super.dispose()}disposeShadow(){null!==this.shadowNode&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,null!==this.baseColorNode&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return E$(this.light).sub(e.context.positionView||yp)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return Cg(this.light)}setupShadow(e){let{renderer:t}=e;if(!1===t.shadowMap.enabled)return;let r=this.shadowColorNode;if(null===r){let e,t=this.light.shadow.shadowNode;e=void 0!==t?pm(t):this.setupShadowNode(),this.shadowNode=e,this.shadowColorNode=r=this.colorNode.mul(e),this.baseColorNode=this.colorNode}e.context.getShadow&&(r=e.context.getShadow(this,e)),this.colorNode=r}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):null!==this.shadowNode&&(this.shadowNode.dis
398pose(),this.shadowNode=null,this.shadowColorNode=null);let t=this.setupDirect(e),r=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),r&&e.lightsNode.setupDirectRectAreaLight(e,this,r)}update(){let{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}}let CL=pA(({lightDistance:e,cutoffDistance:t,decayExponent:r})=>{let i=e.pow(r).max(.01).reciprocal();return t.greaterThan(0).select(i.mul(e.div(t).pow4().oneMinus().clamp().pow2()),i)}),CB=({color:e,lightVector:t,cutoffDistance:r,decayExponent:i})=>{let n=t.normalize(),a=CL({lightDistance:t.length(),cutoffDistance:r,decayExponent:i});return{lightDirection:n,lightColor:e.mul(a)}};class CI extends CN{static get type(){return"PointLightNode"}constructor(e=null){super(e),this.cutoffDistanceNode=fC(0).setGroup(fA),this.decayExponentNode=fC(2).setGroup(fA)}update(e){let{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return CR(this.light)}setupDirect(e){return CB({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}}let CP=pA(([e=g9()])=>{let t=e.mul(2),r=t.x.floor(),i=t.y.floor();return r.add(i).mod(2).sign()}),CF=pA(([e=g9()],{renderer:t,material:r})=>{let i,n=mZ(e.mul(2).sub(1));if(r.alphaToCoverage&&t.currentSamples>0){let e=pN(n.fwidth()).toVar();i=m4(e.oneMinus(),e.add(1),n).oneMinus()}else i=gt(n.greaterThan(1),0,1);return i}),CD=pA(([e,t,r])=>{let i=pN(r).toVar(),n=pN(t).toVar();return gt(pI(e).toVar(),n,i)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),CU=pA(([e,t])=>{let r=pI(t).toVar(),i=pN(e).toVar();return gt(r,i.negate(),i)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),CO=pA(([e])=>pL(mm(pN(e).toVar()))).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),CG=pA(([e,t])=>{let r=pN(e).toVar();return t.assign(CO(r)),r.sub(pN(t))}),Ck=AI([pA(([e,t,r,i,n,a])=>{let s=pN(a).toVar(),o=pN(n).toVar(),l=pN(i).toVar(),u=pN(r).toVar(),h=pN(t).toVar(),d=pN(e).toVar(),c=pN(fU(1,o)).toVar();return fU(1,s).mul(d.mul(c).add(h.mul(o))).add(s.mul(u.mul(c).add(l.mul(o))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),pA(([e,t,r,i,n,a])=>{let s=pN(a).toVar(),o=pN(n).toVar(),l=pO(i).toVar(),u=pO(r).toVar(),h=pO(t).toVar(),d=pO(e).toVar(),c=pN(fU(1,o)).toVar();return fU(1,s).mul(d.mul(c).add(h.mul(o))).add(s.mul(u.mul(c).add(l.mul(o))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]})]),CV=AI([pA(([e,t,r,i,n,a,s,o,l,u,h])=>{let d=pN(h).toVar(),c=pN(u).toVar(),p=pN(l).toVar(),f=pN(o).toVar(),m=pN(s).toVar(),g=pN(a).toVar(),v=pN(n).toVar(),y=pN(i).toVar(),_=pN(r).toVar(),x=pN(t).toVar(),b=pN(e).toVar(),S=pN(fU(1,p)).toVar(),T=pN(fU(1,c)).toVar();return pN(fU(1,d)).toVar().mul(T.mul(b.mul(S).add(x.mul(p))).add(c.mul(_.mul(S).add(y.mul(p))))).add(d.mul(T.mul(v.mul(S).add(g.mul(p))).add(c.mul(m.mul(S).add(f.mul(p))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),pA(([e,t,r,i,n,a,s,o,l,u,h])=>{let d=pN(h).toVar(),c=pN(u).toVar(),p=pN(l).toVar(),f=pO(o).toVar(),m=pO(s).toVar(),g=pO(a).toVar(),v=pO(n).toVar(),y=pO(i).toVar(),_=pO(r).toVar(),x=pO(t).toVar(),b=pO(e).toVar(),S=pN(fU(1,p)).toVar(),T=pN(fU(1,c)).toVar();return pN(fU(1,d)).toVar().mul(T.mul(b.mul(S).add(x.mul(p))).add(c.mul(_.mul(S).add(y.mul(p))))).add(d.mul(T.mul(v.mul(S).add(g.mul(p))).add(c.mul(m.mul(S).add(f.mul(p))))))}
vendor: 4,141 bytes, line 398
398).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]})]),Cz=AI([pA(([e,t,r])=>{let i=pN(r).toVar(),n=pN(t).toVar(),a=pB(e).toVar(),s=pB(a.bitAnd(pB(7))).toVar(),o=pN(CD(s.lessThan(pB(4)),n,i)).toVar(),l=pN(fO(2,CD(s.lessThan(pB(4)),i,n))).toVar();return CU(o,pI(s.bitAnd(pB(1)))).add(CU(l,pI(s.bitAnd(pB(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),pA(([e,t,r,i])=>{let n=pN(i).toVar(),a=pN(r).toVar(),s=pN(t).toVar(),o=pB(e).toVar(),l=pB(o.bitAnd(pB(15))).toVar(),u=pN(CD(l.lessThan(pB(8)),s,a)).toVar(),h=pN(CD(l.lessThan(pB(4)),a,CD(l.equal(pB(12)).or(l.equal(pB(14))),s,n))).toVar();return CU(u,pI(l.bitAnd(pB(1)))).add(CU(h,pI(l.bitAnd(pB(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]})]),CH=AI([pA(([e,t,r])=>{let i=pN(r).toVar(),n=pN(t).toVar(),a=pk(e).toVar();return pO(Cz(a.x,n,i),Cz(a.y,n,i),Cz(a.z,n,i))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),pA(([e,t,r,i])=>{let n=pN(i).toVar(),a=pN(r).toVar(),s=pN(t).toVar(),o=pk(e).toVar();return pO(Cz(o.x,s,a,n),Cz(o.y,s,a,n),Cz(o.z,s,a,n))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]})]),CW=pA(([e])=>fO(.6616,pN(e).toVar())).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),Cj=pA(([e])=>fO(.982,pN(e).toVar())).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),CX=AI([CW,pA(([e])=>fO(.6616,pO(e).toVar())).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]})]),Cq=AI([Cj,pA(([e])=>fO(.982,pO(e).toVar())).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]})]),C$=pA(([e,t])=>{let r=pL(t).toVar(),i=pB(e).toVar();return i.shiftLeft(r).bitOr(i.shiftRight(pL(32).sub(r)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),CJ=pA(([e,t,r])=>{e.subAssign(r),e.bitXorAssign(C$(r,pL(4))),r.addAssign(t),t.subAssign(e),t.bitXorAssign(C$(e,pL(6))),e.addAssign(r),r.subAssign(t),r.bitXorAssign(C$(t,pL(8))),t.addAssign(e),e.subAssign(r),e.bitXorAssign(C$(r,pL(16))),r.addAssign(t),t.subAssign(e),t.bitXorAssign(C$(e,pL(19))),e.addAssign(r),r.subAssign(t),r.bitXorAssign(C$(t,pL(4))),t.addAssign(e)}),CK=pA(([e,t,r])=>{let i=pB(r).toVar(),n=pB(t).toVar(),a=pB(e).toVar();return i.bitXorAssign(n),i.subAssign(C$(n,pL(14))),a.bitXorAssign(i),a.subAssign(C$(i,pL(11))),n.bitXorAssign(a),n.subAssign(C$(a,pL(25))),i.bitXorAssign(n),i.subAssign(C$(n,pL(16))),a.bitXorAssign(i),a.subAssign(C$(i,pL(4))),n.bitXorAssign(a),n.subAssign(C$(a,pL(14))),i.bitXorAssign(n),i.subAssign(C$(n,pL(24))),i}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),CY=pA(([e])=>pN(pB(e).toVar()).div(pN(pB(pL(0xffffffff))))).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),CQ=pA(([e])=>{let t=pN(e).toVar();return t.mul(t).mul(t).mul(t.mul(t.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),CZ=AI([pA(([e])=>{let t=pL(e).toVar(),r=pB(pB(1)).toVar(),i=pB(pB(pL(0xdeadbeef)).add(r.shiftLeft(pB(2))).add(pB(13))).toVar();return CK(i.add(pB(t)),i,i)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),pA(([e,t])=>{let r=pL(t).toVar(),i=pL(e).toVar(),n=pB(pB(2)).toVar(),a=pB().toVar(),s=pB().toVar(),o=pB().toVar();return a.assign(s.assign(o.assign(pB(pL(0xdeadbeef)).add(n.shiftLeft(pB(2))).add(pB(13))))),a.addAssign(pB(i)),s.addAssign(pB(r)),CK(a,s,o)}
398).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),pA(([e,t,r])=>{let i=pL(r).toVar(),n=pL(t).toVar(),a=pL(e).toVar(),s=pB(pB(3)).toVar(),o=pB().toVar(),l=pB().toVar(),u=pB().toVar();return o.assign(l.assign(u.assign(pB(pL(0xdeadbeef)).add(s.shiftLeft(pB(2))).add(pB(13))))),o.addAssign(pB(a)),l.addAssign(pB(n)),u.addAssign(pB(i)),CK(o,l,u)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),pA(([e,t,r,i])=>{let n=pL(i).toVar(),a=pL(r).toVar(),s=pL(t).toVar(),o=pL(e).toVar(),l=pB(pB(4)).toVar(),u=pB().toVar(),h=pB().toVar(),d=pB().toVar();return u.assign(h.assign(d.assign(pB(pL(0xdeadbeef)).add(l.shiftLeft(pB(2))).add(pB(13))))),u.addAssign(pB(o)),h.addAssign(pB(s)),d.addAssign(pB(a)),CJ(u,h,d),u.addAssign(pB(n)),CK(u,h,d)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),pA(([e,t,r,i,n])=>{let a=pL(n).toVar(),s=pL(i).toVar(),o=pL(r).toVar(),l=pL(t).toVar(),u=pL(e).toVar(),h=pB(pB(5)).toVar(),d=pB().toVar(),c=pB().toVar(),p=pB().toVar();return d.assign(c.assign(p.assign(pB(pL(0xdeadbeef)).add(h.shiftLeft(pB(2))).add(pB(13))))),d.addAssign(pB(u)),c.addAssign(pB(l)),p.addAssign(pB(o)),CJ(d,c,p),d.addAssign(pB(s)),c.addAssign(pB(a)),CK(d,c,p)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]})]),C0=AI([pA(([e,t])=>{let r=pL(t).toVar(),i=pB(CZ(pL(e).toVar(),r)).toVar(),n=pk().toVar();return n.x.assign(i.bitAnd(pL(255))),n.y.assign(i.shiftRight(pL(8)).bitAnd(pL(255))),n.z.assign(i.shiftRight(pL(16)).bitAnd(pL(255))),n}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),pA(([e,t,r])=>{let i=pL(r).toVar(),n=pL(t).toVar(),a=pB(CZ(pL(e).toVar(),n,i)).toVar(),s=pk().toVar();return s.x.assign(a.bitAnd(pL(255))),s.y.assign(a.shiftRight(pL(8)).bitAnd(pL(255))),s.z.assign(a.shiftRight(pL(16)).bitAnd(pL(255))),s}
398).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]})]),C1=AI([pA(([e])=>{let t=pP(e).toVar(),r=pL().toVar(),i=pL().toVar(),n=pN(CG(t.x,r)).toVar(),a=pN(CG(t.y,i)).toVar(),s=pN(CQ(n)).toVar(),o=pN(CQ(a)).toVar();return CX(pN(Ck(Cz(CZ(r,i),n,a),Cz(CZ(r.add(pL(1)),i),n.sub(1),a),Cz(CZ(r,i.add(pL(1))),n,a.sub(1)),Cz(CZ(r.add(pL(1)),i.add(pL(1))),n.sub(1),a.sub(1)),s,o)).toVar())}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),pA(([e])=>{let t=pO(e).toVar(),r=pL().toVar(),i=pL().toVar(),n=pL().toVar(),a=pN(CG(t.x,r)).toVar(),s=pN(CG(t.y,i)).toVar(),o=pN(CG(t.z,n)).toVar(),l=pN(CQ(a)).toVar(),u=pN(CQ(s)).toVar(),h=pN(CQ(o)).toVar();return Cq(pN(CV(Cz(CZ(r,i,n),a,s,o),Cz(CZ(r.add(pL(1)),i,n),a.sub(1),s,o),Cz(CZ(r,i.add(pL(1)),n),a,s.sub(1),o),Cz(CZ(r.add(pL(1)),i.add(pL(1)),n),a.sub(1),s.sub(1),o),Cz(CZ(r,i,n.add(pL(1))),a,s,o.sub(1)),Cz(CZ(r.add(pL(1)),i,n.add(pL(1))),a.sub(1),s,o.sub(1)),Cz(CZ(r,i.add(pL(1)),n.add(pL(1))),a,s.sub(1),o.sub(1)),Cz(CZ(r.add(pL(1)),i.add(pL(1)),n.add(pL(1))),a.sub(1),s.sub(1),o.sub(1)),l,u,h)).toVar())}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]})]),C2=AI([pA(([e])=>{let t=pP(e).toVar(),r=pL().toVar(),i=pL().toVar(),n=pN(CG(t.x,r)).toVar(),a=pN(CG(t.y,i)).toVar(),s=pN(CQ(n)).toVar(),o=pN(CQ(a)).toVar();return CX(pO(Ck(CH(C0(r,i),n,a),CH(C0(r.add(pL(1)),i),n.sub(1),a),CH(C0(r,i.add(pL(1))),n,a.sub(1)),CH(C0(r.add(pL(1)),i.add(pL(1))),n.sub(1),a.sub(1)),s,o)).toVar())}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),pA(([e])=>{let t=pO(e).toVar(),r=pL().toVar(),i=pL().toVar(),n=pL().toVar(),a=pN(CG(t.x,r)).toVar(),s=pN(CG(t.y,i)).toVar(),o=pN(CG(t.z,n)).toVar(),l=pN(CQ(a)).toVar(),u=pN(CQ(s)).toVar(),h=pN(CQ(o)).toVar();return Cq(pO(CV(CH(C0(r,i,n),a,s,o),CH(C0(r.add(pL(1)),i,n),a.sub(1),s,o),CH(C0(r,i.add(pL(1)),n),a,s.sub(1),o),CH(C0(r.add(pL(1)),i.add(pL(1)),n),a.sub(1),s.sub(1),o),CH(C0(r,i,n.add(pL(1))),a,s,o.sub(1)),CH(C0(r.add(pL(1)),i,n.add(pL(1))),a.sub(1),s,o.sub(1)),CH(C0(r,i.add(pL(1)),n.add(pL(1))),a,s.sub(1),o.sub(1)),CH(C0(r.add(pL(1)),i.add(pL(1)),n.add(pL(1))),a.sub(1),s.sub(1),o.sub(1)),l,u,h)).toVar())}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]})]),C3=AI([pA(([e])=>CY(CZ(pL(CO(pN(e).toVar())).toVar()))).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),pA(([e])=>{let t=pP(e).toVar();return CY(CZ(pL(CO(t.x)).toVar(),pL(CO(t.y)).toVar()))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),pA(([e])=>{let t=pO(e).toVar();return CY(CZ(pL(CO(t.x)).toVar(),pL(CO(t.y)).toVar(),pL(CO(t.z)).toVar()))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),pA(([e])=>{let t=pz(e).toVar();return CY(CZ(pL(CO(t.x)).toVar(),pL(CO(t.y)).toVar(),pL(CO(t.z)).toVar(),pL(CO(t.w)).toVar()))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]})]),C4=AI([pA(([e])=>{let t=pL(CO(pN(e).toVar())).toVar();
vendor: 10,024 bytes, line 398
398return pO(CY(CZ(t,pL(0))),CY(CZ(t,pL(1))),CY(CZ(t,pL(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),pA(([e])=>{let t=pP(e).toVar(),r=pL(CO(t.x)).toVar(),i=pL(CO(t.y)).toVar();return pO(CY(CZ(r,i,pL(0))),CY(CZ(r,i,pL(1))),CY(CZ(r,i,pL(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),pA(([e])=>{let t=pO(e).toVar(),r=pL(CO(t.x)).toVar(),i=pL(CO(t.y)).toVar(),n=pL(CO(t.z)).toVar();return pO(CY(CZ(r,i,n,pL(0))),CY(CZ(r,i,n,pL(1))),CY(CZ(r,i,n,pL(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),pA(([e])=>{let t=pz(e).toVar(),r=pL(CO(t.x)).toVar(),i=pL(CO(t.y)).toVar(),n=pL(CO(t.z)).toVar(),a=pL(CO(t.w)).toVar();return pO(CY(CZ(r,i,n,a,pL(0))),CY(CZ(r,i,n,a,pL(1))),CY(CZ(r,i,n,a,pL(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]})]),C5=pA(([e,t,r,i])=>{let n=pN(i).toVar(),a=pN(r).toVar(),s=pL(t).toVar(),o=pO(e).toVar(),l=pN(0).toVar(),u=pN(1).toVar();return xy(s,()=>{l.addAssign(u.mul(C1(o))),u.mulAssign(n),o.mulAssign(a)}),l}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),C8=pA(([e,t,r,i])=>{let n=pN(i).toVar(),a=pN(r).toVar(),s=pL(t).toVar(),o=pO(e).toVar(),l=pO(0).toVar(),u=pN(1).toVar();return xy(s,()=>{l.addAssign(u.mul(C2(o))),u.mulAssign(n),o.mulAssign(a)}),l}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),C6=pA(([e,t,r,i])=>{let n=pN(i).toVar(),a=pN(r).toVar(),s=pL(t).toVar(),o=pO(e).toVar();return pP(C5(o,s,a,n),C5(o.add(pO(pL(19),pL(193),pL(17))),s,a,n))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),C9=pA(([e,t,r,i])=>{let n=pN(i).toVar(),a=pN(r).toVar(),s=pL(t).toVar(),o=pO(e).toVar();return pz(pO(C8(o,s,a,n)).toVar(),pN(C5(o.add(pO(pL(19),pL(193),pL(17))),s,a,n)).toVar())}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),C7=AI([pA(([e,t,r,i,n,a,s])=>{let o=pL(s).toVar(),l=pN(a).toVar(),u=pL(n).toVar(),h=pL(i).toVar(),d=pL(r).toVar(),c=pL(t).toVar(),p=pP(e).toVar(),f=pO(C4(pP(c.add(h),d.add(u)))).toVar(),m=pP(f.x,f.y).toVar();m.subAssign(.5),m.mulAssign(l),m.addAssign(.5);let g=pP(pP(pN(c),pN(d)).add(m)).toVar(),v=pP(g.sub(p)).toVar();return pC(o.equal(pL(2)),()=>mM(v.x).add(mM(v.y))),pC(o.equal(pL(3)),()=>mk(mM(v.x),mM(v.y))),mj(v,v)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),pA(([e,t,r,i,n,a,s,o,l])=>{let u=pL(l).toVar(),h=pN(o).toVar(),d=pL(s).toVar(),c=pL(a).toVar(),p=pL(n).toVar(),f=pL(i).toVar(),m=pL(r).toVar(),g=pL(t).toVar(),v=pO(e).toVar(),y=pO(C4(pO(g.add(p),m.add(c),f.add(d)))).toVar();y.subAssign(.5),y.mulAssign(h),y.addAssign(.5);let _=pO(pO(pN(g),pN(m),pN(f)).add(y)).toVar(),x=pO(_.sub(v)).toVar();return pC(u.equal(pL(2)),()=>mM(x.x).add(mM(x.y)).add(mM(x.z))),pC(u.equal(pL(3)),()=>mk(mM(x.x),mM(x.y),mM(x.z))),mj(x,x)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),we=pA(([e,t,r])=>{let i=pL(r).toVar(),n=pN(t).toVar(),a=pP(e).toVar(),s=pL().toVar(),o=pL().toVar(),l=pP(CG(a.x,s),CG(a.y,o)).toVar(),u=pN(1e6).toVar();return xy({start:-1,end:pL(1),name:"x",condition:"<="},({x:e})=>{xy({start:-1,end:pL(1),name:"y",condition:"<="},({y:t})=>{let r=pN(C7(l,e,t,s,o,n,i)).toVar();u.assign(mG(u,r))})}),pC(i.equal(pL(0)),()=>{u.assign(mp(u))}),u}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),wt=pA(([e,t,r])=>{let i=pL(r).toVar(),n=pN(t).toVar(),a=pP(e).toVar(),s=pL().toVar(),o=pL().toVar(),l=pP(CG(a.x,s),CG(a.y,o)).toVar(),u=pP(1e6,1e6).toVar();return xy({start:-1,end:pL(1),name:"x",condition:"<="},({x:e})=>{xy({start:-1,end:pL(1),name:"y",condition:"<="},({y:t})=>{let r=pN(C7(l,e,t,s,o,n,i)).toVar();pC(r.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(r)}).ElseIf(r.lessThan(u.y),()=>{u.y.assign(r)})})}),pC(i.equal(pL(0)),()=>{u.assign(mp(u))}),u}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),wr=pA(([e,t,r])=>{let i=pL(r).toVar(),n=pN(t).toVar(),a=pP(e).toVar(),s=pL().toVar(),o=pL().toVar(),l=pP(CG(a.x,s),CG(a.y,o)).toVar(),u=pO(1e6,1e6,1e6).toVar();return xy({start:-1,end:pL(1),name:"x",condition:"<="},({x:e})=>{xy({start:-1,end:pL(1),name:"y",condition:"<="},({y:t})=>{let r=pN(C7(l,e,t,s,o,n,i)).toVar();pC(r.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(r)}).ElseIf(r.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(r)}).ElseIf(r.lessThan(u.z),()=>{u.z.assign(r)})})}),pC(i.equal(pL(0)),()=>{u.assign(mp(u))}),u}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),wi=AI([we,pA(([e,t,r])=>{let i=pL(r).toVar(),n=pN(t).toVar(),a=pO(e).toVar(),s=pL().toVar(),o=pL().toVar(),l=pL().toVar(),u=pO(CG(a.x,s),CG(a.y,o),CG(a.z,l)).toVar(),h=pN(1e6).toVar();return xy({start:-1,end:pL(1),name:"x",condition:"<="},({x:e})=>{xy({start:-1,end:pL(1),name:"y",condition:"<="},({y:t})=>{xy({start:-1,end:pL(1),name:"z",condition:"<="},({z:r})=>{let a=pN(C7(u,e,t,r,s,o,l,n,i)).toVar();h.assign(mG(h,a))})})}),pC(i.equal(pL(0)),()=>{h.assign(mp(h))}),h}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),wn=AI([wt,pA(([e,t,r])=>{let i=pL(r).toVar(),n=pN(t).toVar(),a=pO(e).toVar(),s=pL().toVar(),o=pL().toVar(),l=pL().toVar(),u=pO(CG(a.x,s),CG(a.y,o),CG(a.z,l)).toVar(),h=pP(1e6,1e6).toVar();return xy({start:-1,end:pL(1),name:"x",condition:"<="},({x:e})=>{xy({start:-1,end:pL(1),name:"y",condition:"<="},({y:t})=>{xy({start:-1,end:pL(1),name:"z",condition:"<="},({z:r})=>{let a=pN(C7(u,e,t,r,s,o,l,n,i)).toVar();pC(a.lessThan(h.x),()=>{h.y.assign(h.x),h.x.assign(a)}).ElseIf(a.lessThan(h.y),()=>{h.y.assign(a)})})})}),pC(i.equal(pL(0)),()=>{h.assign(mp(h))}),h}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),wa=AI([wr,pA(([e,t,r])=>{let i=pL(r).toVar(),n=pN(t).toVar(),a=pO(e).toVar(),s=pL().toVar(),o=pL().toVar(),l=pL().toVar(),u=pO(CG(a.x,s),CG(a.y,o),CG(a.z,l)).toVar(),h=pO(1e6,1e6,1e6).toVar();return xy({start:-1,end:pL(1),name:"x",condition:"<="},({x:e})=>{xy({start:-1,end:pL(1),name:"y",condition:"<="},({y:t})=>{xy({start:-1,end:pL(1),name:"z",condition:"<="},({z:r})=>{let a=pN(C7(u,e,t,r,s,o,l,n,i)).toVar();pC(a.lessThan(h.x),()=>{h.z.assign(h.y),h.y.assign(h.x),h.x.assign(a)}).ElseIf(a.lessThan(h.y),()=>{h.z.assign(h.y),h.y.assign(a)}).ElseIf(a.lessThan(h.z),()=>{h.z.assign(a)})})})}),pC(i.equal(pL(0)),()=>{h.assign(mp(h))}),h}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]})]),ws=pA(([e,t,r,i,n,a,s,o,l,u,h])=>{let d=pL(e).toVar(),c=pP(t).toVar(),p=pP(r).toVar(),f=pP(i).toVar(),m=pN(n).toVar(),g=pN(a).toVar(),v=pN(s).toVar(),y=pI(o).toVar(),_=pL(l).toVar(),x=pN(u).toVar(),b=pN(h).toVar(),S=c.mul(p).add(f),T=pN(0).toVar();return pC(d.equal(pL(0)),()=>{T.assign(C2(S))}),pC(d.equal(pL(1)),()=>{T.assign(C4(S))}),pC(d.equal(pL(2)),()=>{T.assign(wa(S,m,pL(0)))}),pC(d.equal(pL(3)),()=>{T.assign(C8(pO(S,0),_,x,b))}),T.assign(T.mul(v.sub(g)).add(g)),pC(y,()=>{T.assign(m1(T,g,v))}),T}).setLayout({name:"mx_unifiednoise2d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"texcoord",type:"vec2"},{name:"freq",type:"vec2"},{name:"offset",type:"vec2"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),wo=pA(([e,t,r,i,n,a,s,o,l,u,h])=>{let d=pL(e).toVar(),c=pO(t).toVar(),p=pO(r).toVar(),f=pO(i).toVar(),m=pN(n).toVar(),g=pN(a).toVar(),v=pN(s).toVar(),y=pI(o).toVar(),_=pL(l).toVar(),x=pN(u).toVar(),b=pN(h).toVar(),S=c.mul(p).add(f),T=pN(0).toVar();return pC(d.equal(pL(0)),()=>{T.assign(C2(S))}),pC(d.equal(pL(1)),()=>{T.assign(C4(S))}),pC(d.equal(pL(2)),()=>{T.assign(wa(S,m,pL(0)))}),pC(d.equal(pL(3)),()=>{T.assign(C8(S,_,x,b))}),T.assign(T.mul(v.sub(g)).add(g)),pC(y,()=>{T.assign(m1(T,g,v))}),T}).setLayout({name:"mx_unifiednoise3d",type:"float",inputs:[{name:"noiseType",type:"int"},{name:"position",type:"vec3"},{name:"freq",type:"vec3"},{name:"offset",type:"vec3"},{name:"jitter",type:"float"},{name:"outmin",type:"float"},{name:"outmax",type:"float"},{name:"clampoutput",type:"bool"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),wl=pA(([e])=>{let t=e.y,r=e.z,i=pO().toVar();return pC(t.lessThan(1e-4),()=>{i.assign(pO(r,r,r))}).Else(()=>{let n=e.x,a=pL(mP(n=n.sub(mm(n)).mul(6).toVar())),s=n.sub(pN(a)),o=r.mul(t.oneMinus()),l=r.mul(t.mul(s).oneMinus()),u=r.mul(t.mul(s.oneMinus()).oneMinus());pC(a.equal(pL(0)),()=>{i.assign(pO(r,u,o))}).ElseIf(a.equal(pL(1)),()=>{i.assign(pO(l,r,o))}).ElseIf(a.equal(pL(2)),()=>{i.assign(pO(o,r,u))}).ElseIf(a.equal(pL(3)),()=>{i.assign(pO(o,l,r))}).ElseIf(a.equal(pL(4)),()=>{i.assign(pO(u,o,r))}).Else(()=>{i.assign(pO(r,o,l))})}),i}
398).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),wu=pA(([e])=>{let t=pO(e).toVar(),r=pN(t.x).toVar(),i=pN(t.y).toVar(),n=pN(t.z).toVar(),a=pN(mG(r,mG(i,n))).toVar(),s=pN(mk(r,mk(i,n))).toVar(),o=pN(s.sub(a)).toVar(),l=pN().toVar(),u=pN().toVar(),h=pN().toVar();return h.assign(s),pC(s.greaterThan(0),()=>{u.assign(o.div(s))}).Else(()=>{u.assign(0)}),pC(u.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{pC(r.greaterThanEqual(s),()=>{l.assign(i.sub(n).div(o))}).ElseIf(i.greaterThanEqual(s),()=>{l.assign(fD(2,n.sub(r).div(o)))}).Else(()=>{l.assign(fD(4,r.sub(i).div(o)))}),l.mulAssign(1/6),pC(l.lessThan(0),()=>{l.addAssign(1)})}),pO(l,u,h)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),wh=pA(([e])=>{let t=pO(e).toVar(),r=pV(fW(t,pO(.04045))).toVar();return m0(pO(t.div(12.92)).toVar(),pO(mq(mk(t.add(pO(.055)),pO(0)).div(1.055),pO(2.4))).toVar(),r)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),wd=(e,t)=>{e=pN(e);let r=pP((t=pN(t)).dFdx(),t.dFdy()).length().mul(.7071067811865476);return m4(e.sub(r),e.add(r),t)},wc=(e,t,r,i)=>m0(e,t,r[i].clamp()),wp=(e,t,r,i,n)=>m0(e,t,wd(r,i[n])),wf=pA(([e,t,r])=>{let i=mv(e).toVar(),n=fU(pN(.5).mul(t.sub(r)),yd).div(i).toVar(),a=fU(pN(-.5).mul(t.sub(r)),yd).div(i).toVar(),s=pO().toVar();s.x=i.x.greaterThan(pN(0)).select(n.x,a.x),s.y=i.y.greaterThan(pN(0)).select(n.y,a.y),s.z=i.z.greaterThan(pN(0)).select(n.z,a.z);let o=mG(s.x,s.y,s.z).toVar();return yd.add(i.mul(o)).toVar().sub(r)}),wm=pA(([e,t])=>{let r=e.x,i=e.y,n=e.z,a=t.element(0).mul(.886227);return(a=(a=(a=(a=(a=(a=(a=a.add(t.element(1).mul(1.023328).mul(i))).add(t.element(2).mul(1.023328).mul(n))).add(t.element(3).mul(1.023328).mul(r))).add(t.element(4).mul(.858086).mul(r).mul(i))).add(t.element(5).mul(.858086).mul(i).mul(n))).add(t.element(6).mul(n.mul(n).mul(.743125).sub(.247708)))).add(t.element(7).mul(.858086).mul(r).mul(n))).add(t.element(8).mul(.429043).mul(fO(r,r).sub(fO(i,i))))});var wg=Object.freeze({__proto__:null,BRDF_GGX:bU,BRDF_Lambert:bS,BasicPointShadowFilter:CM,BasicShadowFilter:Cr,Break:x_,Const:gc,Continue:()=>gY("continue").toStack(),DFGLUT:bk,D_GGX:bP,Discard:gQ,EPSILON:f7,F_Schlick:bb,Fn:pA,HALF_PI:mn,INFINITY:me,If:pC,Loop:xy,NodeAccess:cL,NodeShaderStage:cw,NodeType:cN,NodeUpdateType:cR,OnBeforeMaterialUpdate:e=>Ml(Mo.BEFORE_MATERIAL,e),OnBeforeObjectUpdate:e=>Ml(Mo.BEFORE_OBJECT,e),OnMaterialUpdate:e=>Ml(Mo.MATERIAL,e),OnObjectUpdate:e=>Ml(Mo.OBJECT,e),PCFShadowFilter:Ci,PCFSoftShadowFilter:Cn,PI:mt,PI2:mr,PointShadowFilter:CE,Return:()=>gY("return").toStack(),Schlick_to_F0:bH,ShaderNode:pf,Stack:pw,Switch:(...e)=>cY.Switch(...e),TBNViewMatrix:_u,TWO_PI:mi,VSMShadowFilter:Ca,V_GGX_SmithCorrelated:bB,Var:gd,VarIntent:gp,abs:mM,acesFilmicToneMapping:M$,acos:mT,add:fD,addMethodChaining:cZ,addNodeElement:function(e){en("TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add",e)},agxToneMapping:MQ,all:ma,alphaT:fr,and:fq,anisotropy:fi,anisotropyB:fa,anisotropyT:fn,any:ms,append:e=>(en("TSL: append() has been renamed to Stack().",new ch),pw(e)),array:fR,arrayBuffer:e=>new cJ(e,"ArrayBuffer"),asin:mS,assign:fL,atan:mA,atomicAdd:(e,t)=>Eg(Ef.ATOMIC_ADD,e,t),atomicAnd:(e,t)=>Eg(Ef.ATOMIC_AND,e,t),atomicFunc:Eg,atomicLoad:e=>Eg(Ef.ATOMIC_LOAD,e,null),atomicMax:(e,t)=>Eg(Ef.ATOMIC_MAX,e,t),atomicMin:(e,t)=>Eg(Ef.ATOMIC_MIN,e,t),atomicOr:(e,t)=>Eg(Ef.ATOMIC_OR,e,t),atomicStore:(e,t)=>Eg(Ef.ATOMIC_STORE,e,t),atomicSub:(e,t)=>Eg(Ef.ATOMIC_SUB,e,t),atomicXor:(e,t)=>Eg(Ef.ATOMIC_XOR,e,t),attenuationColor:fy,attenuationDistance:fv,attribute:g6,attributeArray:(e,t="float")=>{let r,i;return!0===t.isStruct?(r=t.layout.getLength(),i=cy("float")):(r=c_(t),i=cy(t)),xe(new Mh(e,r,i),t,e)},backgroundBlurriness:Mm,backgroundIntensity:Mg,backgroundRotation:Mv,batch:xp,bentNormalView:_d,billboarding:AG,bitAnd:fY,bitNot:fQ,bitOr:fZ,bitXor:f0,bitangentGeometry:_a,bitangentLocal:_s,bitangentView:_o,bitangentWorld:_l,bitcast:Ad,blendBurn:x2,blendColor:x8,blendDodge:x3,blendOverlay:x5,blendScreen:x4,blur:SI,bool:pI,buffer:vh,bufferAttribute:gD,builtin:vm,builtinAOContext:go,builtinShadowContext:gs,bumpMap:__,bvec2:pU,bvec3:pV,bvec4:pj,bypass:gX,cache:gW,call:fI,cameraFar:vz,cameraIndex:vk,c
398ameraNear:vV,cameraNormalMatrix:vq,cameraPosition:v$,cameraProjectionMatrix:vH,cameraProjectionMatrixInverse:vW,cameraViewMatrix:vj,cameraViewport:vJ,cameraWorldMatrix:vX,cbrt:mQ,cdl:MP,ceil:mg,checker:CP,cineonToneMapping:MX,clamp:m1,clearcoat:p5,clearcoatNormalView:yE,clearcoatRoughness:p8,clipSpace:yo,code:M1,color:pR,colorSpaceToWorking:gA,colorToDirection:e=>pm(e).mul(2).sub(1),compute:gV,computeKernel:gk,computeSkinning:(e,t=null)=>{let r=new xm(e);return r.positionNode=xe(new im(e.geometry.getAttribute("position").array,3),"vec3").setPBO(!0).toReadOnly().element(xi).toVar(),r.skinIndexNode=xe(new im(new Uint32Array(e.geometry.getAttribute("skinIndex").array),4),"uvec4").setPBO(!0).toReadOnly().element(xi).toVar(),r.skinWeightNode=xe(new im(e.geometry.getAttribute("skinWeight").array,4),"vec4").setPBO(!0).toReadOnly().element(xi).toVar(),r.bindMatrixNode=fC(e.bindMatrix,"mat4"),r.bindMatrixInverseNode=fC(e.bindMatrixInverse,"mat4"),r.boneMatricesNode=vh(e.skeleton.boneMatrices,"mat4",e.skeleton.bones.length),r.toPositionNode=t,pm(r)},context:gi,convert:pK,convertColorSpace:(e,t,r)=>new gS(pm(e),t,r),convertToTexture:(e,...t)=>e.isSampleNode||e.isTextureNode?e:e.isPassNode?e.getTextureNode():Me(e,...t),cos:mx,countLeadingZeros:Ag,countOneBits:Av,countTrailingZeros:Am,cross:mX,cubeTexture:yW,cubeTextureBase:yH,dFdx:mN,dFdy:mL,dashSize:fd,debug:g2,decrement:f8,decrementBefore:f4,defaultBuildStages:cI,defaultShaderStages:cB,defined:pc,degrees:ml,deltaTime:AF,densityFogFactor:M8,depth:xq,depthPass:(e,t,r)=>new Mz(Mz.DEPTH,e,t,r),determinant:mU,difference:mW,diffuseColor:p0,diffuseContribution:p1,directPointLight:CB,directionToColor:_c,directionToFaceDirection:yy,dispersion:f_,disposeShadowMaterial:Co,distance:mH,div:fG,dot:mj,drawIndex:xo,dynamicBufferAttribute:(e,t=null,r=0,i=0)=>gF(e,t,r,i,35048),element:pJ,emissive:p2,equal:fV,equirectUV:bl,exp:mu,exp2:mh,exponentialHeightFogFactor:M6,expression:gY,faceDirection:yv,faceForward:m5,faceforward:m5,float:pN,floatBitsToInt:e=>new Ah(e,"int","float"),floatBitsToUint:Ac,floor:mm,fog:M9,fract:my,frameGroup:fT,frameId:AD,frontFacing:yg,fwidth:mF,gain:(e,t)=>e.lessThan(.5)?A_(e.mul(2),t).div(2):fU(1,A_(fO(fU(1,e),2),t).div(2)),gapSize:fc,getConstNodeType:pp,getCurrentStack:pE,getDirection:SR,getDistanceAttenuation:CL,getGeometryRoughness:bN,getNormalFromDepth:Mi,getParallaxCorrectNormal:wf,getRoughness:bL,getScreenPosition:Mr,getShIrradianceAt:wm,getShadowMaterial:Cs,getShadowRenderObjectFunction:Ch,getTextureIndex:Ao,getViewPosition:Mt,ggxConvolution:SU,globalId:Eo,glsl:(e,t)=>M1(e,t,"glsl"),glslFn:(e,t)=>M3(e,t,"glsl"),grayscale:MR,greaterThan:fW,greaterThanEqual:fX,hash:Ay,highpModelNormalViewMatrix:ys,highpModelViewMatrix:ya,hue:MB,increment:f5,incrementBefore:f3,inspector:g5,instance:xu,instanceIndex:xi,instancedArray:(e,t="float")=>{let r,i;!0===t.isStruct?(r=t.layout.getLength(),i=cy("float")):(r=c_(t),i=cy(t));let n=new Mu(e,r,i);return xe(n,t,n.count)},instancedBufferAttribute:gU,instancedDynamicBufferAttribute:gO,instancedMesh:xd,int:pL,intBitsToFloat:e=>new Ah(e,"float","int"),interleavedGradientNoise:Mn,inverse:mO,inverseSqrt:mf,inversesqrt:mf,invocationLocalIndex:xs,invocationSubgroupIndex:xa,ior:ff,iridescence:p7,iridescenceIOR:fe,iridescenceThickness:ft,isolate:gH,ivec2:pF,ivec3:pG,ivec4:pH,js:(e,t)=>M1(e,t,"js"),label:gl,length:mC,lengthSq:mZ,lessThan:fH,lessThanEqual:fj,lightPosition:EX,lightProjectionUV:Ej,lightShadowMatrix:EW,lightTargetDirection:EJ,lightTargetPosition:Eq,lightViewPosition:E$,lightingContext:xw,lights:(e=[])=>new EZ().setLights(e),linearDepth:x$,linearToneMapping:MW,localId:El,log:md,log2:mc,logarithmicDepthToViewZ:(e,t,r)=>{let i=e.mul(md(r.div(t)));return pN(Math.E).pow(i).mul(t).negate()},luminance:MI,mat2:pX,mat3:pq,mat4:p$,matcapUV:Tu,materialAO:_4,materialAlphaTest:_S,materialAnisotropy:_V,materialAnisotropyVector:_5,materialAttenuationColor:_J,materialAttenuationDistance:_$,materialClearcoat:_F,materialClearcoatNormal:_U,materialClearcoatRoughness:_D,materialColor:_T,materialDispersion:_2,materialEmissive:_M,materialEnvIntensity:yF,materialEnvRotation:yD,materialIOR:_q,materialIridescence:_z,materialIridescenceIOR:_H,materialIridescenceThickness:_W,materialLightMap:_3,materialLineDashOffset:_0,materialLineDashSize:_Y,materialLineGapSize:_Q,materialLineScale:_K,materialLineWidth:_Z,materialMetalness:_I,materialNormal:_P,materialOpacity:_E,materialPointSize:_1,materialReference:yK,materialReflectivity:_L,materialRefractionRatio:yP,materialRotation:_O,materialRoughness:_B,materialSheen:_G,materialSheenRoughness:_k,materialShininess:_A,materialSpecular:_C,materialSpecularColor:_R,materialSpecularIntensity:_w,materialSpecularStrength:_N,materialThickness:_X,materialTransmission:_j,max:mk,maxMipLevel:vr,mediumpModelViewMatrix:yn,metalness:p4,min:mG,mix:m0,mixElement:m6,mod:fk,modInt:f6,modelDirection:v5,modelNormalMatrix:yt,modelPosition:v6,modelRadius:ye,modelScale:v9,modelViewMatrix:yi,modelViewPosition:v7,modelViewProjection:_8,modelWorldMatrix:v8,modelWorldMatrixInverse:yr,morphReference:xA,mrt:Au,mul:fO,mx_aastep:wd,mx_add:(e,t=pN(0))=>fD(e,t),mx_atan2:(e=pN(0),t=pN(1))=>mA(e,t),mx_cell_noise_float:(e=g9())=>C3(e.convert("vec2|vec3")),mx_contrast:(e,t=1,r=.5)=>pN(e).sub(r).mul(t).add(r),mx_divide:(e,t=pN(1))=>fG(e,t),mx_fractal_noise_float:(e=g9(),t=3,r=2,i=.5,n=1)=>C5(e,pL(t),r,i).mul(n),mx_fractal_noise_vec2:(e=g9(),t=3,r=2,i=.5,n=1)=>C6(e,pL(t),r,i).mul(n),mx_fractal_noise_vec3:(e=g9(),t=3,r=2,i=.5,n=1)=>C8(e,pL(t),r,i).mul(n),mx_fractal_noise_vec4:(e=g9(),t=3,r=2,i=.5,n=1)=>C9(e,pL(t),r,i).mul(n),mx_frame:()=>AD,mx_heighttonormal:(e,t)=>__(e=pO(e),t=pN(t)),mx_hsvtorgb:wl,mx_ifequal:(e,t,r,i)=>e.equal(t).mix(r,i),mx_ifgreater:(e,t,r,i)=>e.greaterThan(t).mix(r,i),mx_ifgreatereq:(e,t,r,i)=>e.greaterThanEqual(t).mix(r,i),mx_invert:(e,t=pN(1))=>fU(t,e),mx_modulo:(e,t=pN(1))=>fk(e,t),mx_multiply:(e,t=pN(1))=>fO(e,t),mx_noise_float:(e=g9(),t=1,r=0)=>C1(e.convert("vec2|vec3")).mul(t).add(r),mx_noise_vec3:(e=g9(),t=1,r=0)=>C2(e.convert("vec2|vec3")).mul(t).add(r),mx_noise_vec4:(e=g9(),t=1,r=0)=>pz(C2(e=e.convert("vec2|vec3")),C1(e.add(pP(19,73)))).mul(t).add(r),mx_place2d:(e,t=pP(.5,.5),r=pP(1,1),i=pN(0),n=pP(0,0))=>{let a=e;if(t&&(a=a.sub(t)),r&&(a=a.mul(r)),i){let e=i.mul(Math.PI/180),t=e.cos(),r=e.sin();a=pP(a.x.mul(t).sub(a.y.mul(r)),a.x.mul(r).add(a.y.mul(t)))}return t&&(a=a.add(t)),n&&(a=a.add(n)),a},mx_power:(e,t=pN(1))=>mq(e,t),mx_ramp4:(e,t,r,i,n=g9())=>{let a=n.x.clamp(),s=n.y.clamp(),o=m0(e,t,a),l=m0(r,i,a);return m0(o,l,s)},mx_ramplr:(e,t,r=g9())=>wc(e,t,r,"x"),mx_ramptb:(e,t,r=g9())=>wc(e,t,r,"y"),mx_rgbtohsv:wu,mx_rotate2d:(e,t)=>
vendor: 6,751 bytes, line 398
398Tp(e=pP(e),(t=pN(t)).mul(Math.PI/180)),mx_rotate3d:(e,t,r)=>{e=pO(e),t=pN(t),r=pO(r);let i=t.mul(Math.PI/180),n=r.normalize(),a=i.cos(),s=i.sin(),o=pN(1).sub(a);return e.mul(a).add(n.cross(e).mul(s)).add(n.mul(n.dot(e)).mul(o))},mx_safepower:(e,t=1)=>(e=pN(e)).abs().pow(t).mul(e.sign()),mx_separate:(e,t=null)=>{if("string"==typeof t){let r={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},i=t.replace(/^out/,"").toLowerCase();if(void 0!==r[i])return e.element(r[i])}if("number"==typeof t)return e.element(t);if("string"==typeof t&&1===t.length){let r={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(void 0!==r[t])return e.element(r[t])}return e},mx_splitlr:(e,t,r,i=g9())=>wp(e,t,r,i,"x"),mx_splittb:(e,t,r,i=g9())=>wp(e,t,r,i,"y"),mx_srgb_texture_to_lin_rec709:wh,mx_subtract:(e,t=pN(0))=>fU(e,t),mx_timer:()=>AP,mx_transform_uv:(e=1,t=0,r=g9())=>r.mul(e).add(t),mx_unifiednoise2d:(e,t=g9(),r=pP(1,1),i=pP(0,0),n=1,a=0,s=1,o=!1,l=1,u=2,h=.5)=>ws(e,t.convert("vec2|vec3"),r,i,n,a,s,o,l,u,h),mx_unifiednoise3d:(e,t=g9(),r=pP(1,1),i=pP(0,0),n=1,a=0,s=1,o=!1,l=1,u=2,h=.5)=>wo(e,t.convert("vec2|vec3"),r,i,n,a,s,o,l,u,h),mx_worley_noise_float:(e=g9(),t=1)=>wi(e.convert("vec2|vec3"),t,pL(1)),mx_worley_noise_vec2:(e=g9(),t=1)=>wn(e.convert("vec2|vec3"),t,pL(1)),mx_worley_noise_vec3:(e=g9(),t=1)=>wa(e.convert("vec2|vec3"),t,pL(1)),negate:mw,neutralToneMapping:MZ,nodeArray:py,nodeImmutable:px,nodeObject:pm,nodeObjectIntent:pg,nodeObjects:pv,nodeProxy:p_,nodeProxyIntent:pb,normalFlat:yb,normalGeometry:y_,normalLocal:yx,normalMap:_m,normalView:yA,normalViewGeometry:yS,normalWorld:yM,normalWorldGeometry:yT,normalize:mv,not:fJ,notEqual:fz,numWorkgroups:Ea,objectDirection:vQ,objectGroup:fM,objectPosition:v0,objectRadius:v3,objectScale:v1,objectViewPosition:v2,objectWorldMatrix:vZ,oneMinus:mR,or:f$,orthographicDepthToViewZ:xV,oscSawtooth:(e=AP)=>e.fract(),oscSine:(e=AP)=>e.add(.75).mul(2*Math.PI).sin().mul(.5).add(.5),oscSquare:(e=AP)=>e.fract().round(),oscTriangle:(e=AP)=>e.add(.5).fract().mul(2).sub(1).abs(),output:fh,outputStruct:Ai,overloadingFn:AI,packHalf2x16:AT,packSnorm2x16:Ab,packUnorm2x16:AS,parabola:A_,parallaxDirection:_h,parallaxUV:(e,t)=>e.sub(_h.mul(t)),parameter:(e,t)=>new T6(e,t),pass:(e,t,r)=>new Mz(Mz.COLOR,e,t,r),passTexture:(e,t)=>new Mk(e,t),pcurve:(e,t,r)=>mq(fG(mq(e,t),fD(mq(e,t),mq(fU(1,e),r))),1/t),perspectiveDepthToViewZ:xW,pmremTexture:S4,pointShadow:CR,pointUV:Mc,pointWidth:fp,positionGeometry:yl,positionLocal:yu,positionPrevious:yh,positionView:yp,positionViewDirection:yf,positionWorld:yd,positionWorldDirection:yc,posterize:MF,pow:mq,pow2:m$,pow3:mJ,pow4:mK,premultiplyAlpha:x6,property:pQ,quadBroadcast:Ez,quadSwapDiagonal:ED,quadSwapX:EP,quadSwapY:EF,radians:mo,rand:m8,range:Er,rangeFogFactor:M5,reciprocal:mI,reference:yq,referenceBuffer:y$,reflect:mz,reflectVector:yG,reflectView:yU,reflector:e=>new A3(e),refract:m3,refractVector:yk,refractView:yO,reinhardToneMapping:Mj,remap:g$,remapClamp:gJ,renderGroup:fA,renderOutput:g0,rendererReference:gw,replaceDefaultUV:function(e,t=null){return gi(t,{getUV:"function"==typeof e?e:()=>e})},rotate:Tp,rotateUV:AU,roughness:p3,round:mB,rtt:Me,sRGBTransferEOTF:g_,sRGBTransferOETF:gx,sample:(e,t=null)=>new Ms(e,pm(t)),sampler:e=>(!0===e.isNode?e:vo(e)).convert("sampler"),samplerComparison:e=>(!0===e.isNode?e:vo(e)).convert("samplerComparison"),saturate:m2,saturation:MN,screenCoordinate:vx,screenDPR:vv,screenSize:v_,screenUV:vy,select:gt,setCurrentStack:pM,setName:ga,shaderStages:cP,shadow:Cg,shadowPositionWorld:E1,shapeCircle:CF,sharedUniformGroup:fS,sheen:p6,sheenRoughness:p9,shiftLeft:f1,shiftRight:f2,shininess:fu,sign:mE,sin:m_,sinc:(e,t)=>m_(mt.mul(t.mul(e).sub(1))).div(mt.mul(t.mul(e).sub(1))),skinning:xg,smoothstep:m4,smoothstepElement:m9,specularColor:fs,specularColorBlended:fo,specularF90:fl,spherizeUV:AO,split:(e,t)=>new cW(pm(e),t),spritesheetUV:AV,sqrt:mp,stack:T7,step:mV,stepElement:m7,storage:xe,storageBarrier:()=>Ed("storage").toStack(),storageTexture:M_,string:(e="")=>new cJ(e,"string"),struct:(e,t=null)=>{let r=new Ae(e,t),i=(...t)=>{let i=null;if(t.length>0)if(t[0].isNode){i={};let r=Object.keys(e);for(let e=0;e<t.length;e++)i[r[e]]=t[e]}else i=t[0];return new At(r,i)};return i.layout=r,i.isStruct=!0,i},sub:fU,subBuild:gm,subgroupAdd:Ex,subgroupAll:EL,subgroupAnd:EE,subgroupAny:EB,subgroupBallot:E_,subgroupBroadcast:EU,subgroupBroadcastFirst:EI,subgroupElect:Ey,subgroupExclusiveAdd:ES,subgroupExclusiveMul:EM,subgroupInclusiveAdd:Eb,subgroupInclusiveMul:EA,subgroupIndex:xn,subgroupMax:EN,subgroupMin:ER,subgroupMul:ET,subgroupOr:EC,subgroupShuffle:EO,subgroupShuffleDown:EV,subgroupShuffleUp:Ek,subgroupShuffleXor:EG,subgroupSize:Eu,subgroupXor:Ew,tan:mb,tangentGeometry:_e,tangentLocal:_t,tangentView:_r,tangentWorld:_i,texture:vo,texture3D:MS,texture3DLevel:(e,t,r)=>MS(e,t).level(r),texture3DLoad:(...e)=>MS(...e).setSampler(!1),textureBarrier:()=>Ed("texture").toStack(),textureBicubic:b7,textureBicubicLevel:b9,textureCubeUV:SN,textureLevel:(e,t,r)=>vo(e,t).level(r),textureLoad:vl,textureSize:ve,textureStore:(e,t,r)=>{let i;return!0===e.isStorageTextureNode?((i=e.clone()).uvNode=t,i.storeNode=r):i=M_(e,t,r),null!==r&&i.toStack(),i},thickness:fg,time:AP,toneMapping:gN,toneMappingExposure:gL,toonOutlinePass:(e,t,r=new ty(0,0,0),i=.003,n=1)=>new MH(e,t,pm(r),pm(i),pm(n)),transformDirection:mY,transformNormal:yC,transformNormalToView:yw,transformedClearcoatNormalView:yL,transformedNormalView:yR,transformedNormalWorld:yN,transmission:fm,transpose:mD,triNoise3D:AN,triplanarTexture:(...e)=>Az(...e),triplanarTextures:Az,trunc:mP,uint:pB,uintBitsToFloat:e=>new Ah(e,"float","uint"),uniform:fC,uniformArray:vp,uniformCubeTexture:(e=yV)=>yH(e),uniformFlow:gn,uniformGroup:fb,uniformTexture:(e=vn)=>vo(e),unpackHalf2x16:AC,unpackNormal:_p,unpackSnorm2x16:AM,unpackUnorm2x16:AE,unpremultiplyAlpha:x9,userData:(e,t,r)=>new MT(e,t,r),uv:g9,uvec2:pD,uvec3:pk,uvec4:pW,varying:gv,varyingProperty:pZ,vec2:pP,vec3:pO,vec4:pz,vectorComponents:cF,velocity:Mw,vertexColor:x1,vertexIndex:xr,vertexStage:gy,vibrance:ML,viewZToLogarithmicDepth:xj,viewZToOrthographicDepth:xk,viewZToPerspectiveDepth:xz,viewZToReversedOrthographicDepth:(e,t,r)=>e.add(r).div(r.sub(t)),viewZToReversedPerspectiveDepth:xH,viewport:vb,viewportCoordinate:vT,viewportDepthTexture:xO,viewportLinearDepth:xJ,viewportMipTexture:xI,viewportOpaqueMipTexture:xF,viewportResolution:vM,viewportSafeUV:Ak,viewportSharedTexture:MO,viewportSize:vS,viewportTexture:xB,viewportUV:vA,vogelDiskSample:Ma,wgsl:(e,t)=>M1(e,t,"wgsl"),wgslFn:(e,t)=>M3(e,t,"wgsl"),workgroupArray:(e,t)=>new Ep("Workgroup",e,t),workgroupBarrier:()=>Ed("workgroup").toStack(),workgroupId:Es,workingToColorSpace:gT,xor:fK});let wv=new T8;class wy extends TP{constructor(e,t){super(),this.renderer=e,this.nodes=t}
398update(e,t,r){let i=this.renderer,n=this.nodes.getBackgroundNode(e)||e.background,a=!1;if(null===n)i._clearColor.getRGB(wv),wv.a=i._clearColor.a;else if(!0===n.isColor)n.getRGB(wv),wv.a=1,a=!0;else if(!0===n.isNode){let r=this.get(e);wv.copy(i._clearColor);let a=r.backgroundMesh;if(void 0===a){let e=pz(n).mul(Mg).context({getUV:()=>Mv.mul(yT),getTextureLevel:()=>Mm}),t=vH.element(3).element(3).equal(1),i=fG(1,vH.element(1).element(1)).mul(3),s=t.select(yu.mul(i),yu),o=yi.mul(pz(s,0)),l=vH.mul(pz(o.xyz,1));l=l.setZ(l.w);let u=new x7;u.name="Background.material",u.side=1,u.depthTest=!1,u.depthWrite=!1,u.allowOverride=!1,u.fog=!1,u.lights=!1,u.vertexNode=l,u.colorNode=e,r.backgroundMeshNode=e,r.backgroundMesh=a=new r8(new a_(1,32,32),u),a.frustumCulled=!1,a.name="Background.mesh",n.addEventListener("dispose",function e(){n.removeEventListener("dispose",e),a.material.dispose(),a.geometry.dispose()})}let s=n.getCacheKey();r.backgroundCacheKey!==s&&(r.backgroundMeshNode.node=pz(n).mul(Mg),r.backgroundMeshNode.needsUpdate=!0,a.material.needsUpdate=!0,r.backgroundCacheKey=s),t.unshift(a,a.geometry,a.material,0,0,null,null)}else ea("Renderer: Unsupported background configuration.",n);let s=i.xr.getEnvironmentBlendMode();if("additive"===s?wv.set(0,0,0,1):"alpha-blend"===s&&wv.set(0,0,0,0),!0===i.autoClear||!0===a){let e=r.clearColorValue;e.r=wv.r,e.g=wv.g,e.b=wv.b,e.a=wv.a,(!0===i.backend.isWebGLBackend||!0===i.alpha)&&(e.r*=e.a,e.g*=e.a,e.b*=e.a),r.depthClearValue=i.getClearDepth(),r.stencilClearValue=i.getClearStencil(),r.clearColor=!0===i.autoClearColor,r.clearDepth=!0===i.autoClearDepth,r.clearStencil=!0===i.autoClearStencil}else r.clearColor=!1,r.clearDepth=!1,r.clearStencil=!1}}let w_=0;class wx{constructor(e="",t=[],r=0){this.name=e,this.bindings=t,this.index=r,this.id=w_++}}class wb{constructor(e,t,r,i,n,a,s,o,l,u=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=r,this.transforms=u,this.nodeAttributes=i,this.bindings=n,this.updateNodes=a,this.updateBeforeNodes=s,this.updateAfterNodes=o,this.observer=l,this.usedTimes=0}createBindings(){let e=[];for(let t of this.bindings)if(!0!==t.bindings[0].groupNode.shared){let r=new wx(t.name,[],t.index);for(let i of(e.push(r),t.bindings))r.bindings.push(i.clone())}else e.push(t);return e}}class wS{constructor(e,t,r=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=r}}class wT{constructor(e,t,r){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=r}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}}class wA{constructor(e,t,r=!1,i=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=r,this.count=i}}class wM extends wA{constructor(e,t,r=null,i=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=r,this.interpolationSampling=i}}class wE{constructor(e,t,r=""){this.name=e,this.type=t,this.code=r,Object.defineProperty(this,"isNodeCode",{value:!0})}}let wC=0;class ww{constructor(e=null){this.id=wC++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return void 0===t&&null!==this.parent&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}}class wR{constructor(e,t){this.name=e,this.members=t,this.output=!1}}class wN{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0,this.index=-1}setValue(e){this.value=e}getValue(){return this.value}}class wL extends wN{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}}class wB extends wN{constructor(e,t=new eb){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}}class wI extends wN{constructor(e,t=new eT){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}}class wP extends wN{constructor(e,t=new ek){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}}class wF extends wN{constructor(e,t=new ty){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}}class wD extends wN{constructor(e,t=new oI){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}}class wU extends wN{constructor(e,t=new eE){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}}class wO extends wN{constructor(e,t=new eq){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}}class wG extends wL{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class wk extends wB{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class wV extends wI{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class wz extends wP{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class wH extends wF{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class wW extends wD{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class wj extends wU{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}class wX extends wO{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}}
398let wq=0,w$=new WeakMap,wJ=new WeakMap,wK=new Map([[Int8Array,"int"],[Int16Array,"int"],[Int32Array,"int"],[Uint8Array,"uint"],[Uint16Array,"uint"],[Uint32Array,"uint"],[Float32Array,"float"]]),wY=e=>/e/g.test(e)?String(e).replace(/\+/g,""):(e=Number(e))+(e%1?"":".0");class wQ{constructor(e,t,r){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=r,this.scene=null,this.camera=null,this.nodes=[],this.sequentialNodes=[],this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:"",fragment:"",compute:""},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:""},this.chaining=[],this.stack=T7(),this.stacks=[],this.tab=" ",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new ww,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,"id",{value:wq++})}isFlatShading(){return!0===this.material.flatShading||!1===this.geometry.hasAttribute("normal")}isOpaque(){let e=this.material;return!1===e.transparent&&1===e.blending&&!1===e.alphaToCoverage}createRenderTarget(e,t,r){return new eV(e,t,r)}createCubeRenderTarget(e,t){return new bu(e,t)}includes(e){return this.nodes.includes(e)}getOutputStructName(){}_getBindGroup(e,t){let r,i=t[0].groupNode,n=i.shared;if(n)for(let e=1;e<t.length;e++)i!==t[e].groupNode&&(n=!1);if(n){let i="";for(let e of t)if(e.isNodeUniformsGroup)for(let t of(e.uniforms.sort((e,t)=>e.nodeUniform.node.id-t.nodeUniform.node.id),e.uniforms))i+=t.nodeUniform.node.id;else i+=e.nodeUniform.id;let n=this.renderer._currentRenderContext||this.renderer,a=w$.get(n);void 0===a&&(a=new Map,w$.set(n,a));let s=cc(i);void 0===(r=a.get(s))&&(r=new wx(e,t,this.bindingsIndexes[e].group),a.set(s,r))}else r=new wx(e,t,this.bindingsIndexes[e].group);return r}getBindGroupArray(e,t){let r=this.bindings[t],i=r[e];return void 0===i&&(void 0===this.bindingsIndexes[e]&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),r[e]=i=[]),i}getBindings(){let e=this.bindGroups;if(null===e){let t={},r=this.bindings;for(let e of cP)for(let i in r[e]){let n=r[e][i],a=t[i]||(t[i]=[]);for(let e of n)!1===a.includes(e)&&a.push(e)}for(let r in e=[],t){let i=t[r],n=this._getBindGroup(r,i);e.push(n)}this.bindGroups=e}return e}sortBindingGroups(){let e=this.getBindings();e.sort((e,t)=>e.bindings[0].groupNode.order-t.bindings[0].groupNode.order);for(let t=0;t<e.length;t++){let r=e[t];this.bindingsIndexes[r.name].group=t,r.index=t}}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){!1===this.nodes.includes(e)&&(this.nodes.push(e),this.setHashNode(e,e.getHash(this)))}addSequentialNode(e){let t=e.getUpdateBeforeType(),r=e.getUpdateAfterType();(t!==cR.NONE||r!==cR.NONE)&&!1===this.sequentialNodes.includes(e)&&this.sequentialNodes.push(e)}buildUpdateNodes(){for(let e of this.nodes)e.getUpdateType()!==cR.NONE&&this.updateNodes.push(e);for(let e of this.sequentialNodes){let t=e.getUpdateBeforeType(),r=e.getUpdateAfterType();t!==cR.NONE&&this.updateBeforeNodes.push(e),r!==cR.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return 1006===e.magFilter||1007===e.magFilter||1005===e.magFilter||1008===e.magFilter||1006===e.minFilter||1007===e.minFilter||1005===e.minFilter||1008===e.minFilter}getUniformBufferLimit(){return 16384}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw Error("NodeBuilder: Invalid node chaining!")}getMethod(e){return e}getTernary(){return null}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}addContext(e){let t=this.getContext();return this.setContext({...this.context,...e}),t}getSharedContext(){let e={...this.context};return delete e.material,delete e.getUV,delete e.getOutput,delete e.getTextureLevel,delete e.getAO,delete e.getShadow,e}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){let r=this.getDataFromNode(e);return void 0===r.cache&&(r.cache=new ww(t?this.getCache():null)),r.cache}isAvailable(){return!1}getVertexIndex(){en("Abstract function.")}getInstanceIndex(){en("Abstract function.")}getDrawIndex(){en("Abstract function.")}getFrontFacing(){en("Abstract function.")}getFragCoord(){en("Abstract function.")}isFlipY(){return!1}increaseUsage(e){let t=this.getDataFromNode(e);return t.usageCount=void 0===t.usageCount?1:t.usageCount+1,t.usageCount}generateTexture(){en("Abstract function.")}generateTextureLod(){en("Abstract function.")}generateArrayDeclaration(e,t){return this.getType(e)+"[ "+t+" ]"}generateArray(e,t,r=null){let i=this.generateArrayDeclaration(e,t)+"( ";for(let n=0;n<t;n++){let a=r?r[n]:null;null!==a?i+=a.build(this,e):i+=this.generateConst(e),n<t-1&&(i+=", ")}return i+" )"}generateStruct(e,t,r=null){let i=[];for(let e of t){let{name:t,type:n}=e;r&&r[t]&&r[t].isNode?i.push(r[t].build(this,n)):i.push(this.generateConst(n))}return e+"( "+i.join(", ")+" )"}generateConst(e,t=null){if(null===t&&("float"===e||"int"===e||"uint"===e?t=0:"bool"===e?t=!1:"color"===e?t=new ty:"vec2"===e||"uvec2"===e||"ivec2"===e?t=new eb:"vec3"===e||"uvec3"===e||"ivec3"===e?t=new eT:("vec4"===e||"uvec4"===e||"ivec4"===e)&&(t=new ek)),"float"===e)return wY(t);if("int"===e)return`${Math.round(t)}`;if("uint"===e)return t>=0?`${Math.round(t)}u`:"0u";if("bool"===e)return t?"true":"false";if("color"===e)return`${this.getType("vec3")}( ${wY(t.r)}, ${wY(t.g)}, ${wY(t.b)} )`;let r=this.getTypeLength(e),i=this.getComponentType(e),n=e=>this.generateConst(i,e);if(2===r)return`${this.getType(e)}( ${n(t.x)}, ${n(t.y)} )`;if(3===r)return`${this.getType(e)}( ${n(t.x)}, ${n(t.y)}, ${n(t.z)} )`;if(4===r&&"mat2"!==e)return`${this.getType(e)}( ${n(t.x)}, ${n(t.y)}, ${n(t.z)}, ${n(t.w)} )`;if(r>=4&&t&&(t.isMatrix2||t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(n).join(", ")} )`;if(r>4)return`${this.getType(e)}()`;throw Error(`NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return"color"===e?"vec3":e}hasGeometryAttribute(e){return this.geometry&&void 0!==this.geometry.getAttribute(e)}getAttribute(e,t){let r=this.attributes;for(let t of r)if(t.name===e)return t;let i=new wS(e,t);return this.registerDeclaration(i),r.push(i),i}getPropertyName(e){return e.name}isVector(e){return/vec\d/.test(e)}isMatrix(e){return/mat\d/.test(e)}isReference(e){return"void"===e||"property"===e||"sampler"===e||"samplerComparison"===e||"texture"===e||"cubeTexture"===e||"storageTexture"===e||"depthTexture"===e||"texture3D"===e}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){let t=e.type;if(e.isDataTexture){if(1013===t)return"int";if(1014===t)return"uint"}return"float"}getElementType(e){return"mat2"===e?"vec2":"mat3"===e?"vec3":"mat4"===e?"vec4":this.getComponentType(e)}getComponentType(e){if("float"===(e=this.getVectorType(e))||"bool"===e||"int"===e||"uint"===e)return e;let t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return null===t?null:"b"===t[1]?"bool":"i"===t[1]?"int":"u"===t[1]?"uint":"float"}getVectorType(e){return"color"===e?"vec3":"texture"===e||"cubeTexture"===e||"storageTexture"===e||"texture3D"===e?"vec4":e}getTypeFromLength(e,t="float"){if(1===e)return t;let r=cv(e),i="float"===t?"":t[0];return!0===/mat2/.test(t)&&(r=r.replace("vec","mat")),i+r}getTypeFromArray(e){return wK.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t,r=e;e.isInterleavedBufferAttribute&&(r=e.data);let i=r.array,n=e.itemSize,a=e.normalized;return e instanceof ri||!0===a||(t=this.getTypeFromArray(i)),this.getTypeFromLength(n,t)}getTypeLength(e){let t=this.getVectorType(e),r=/vec([2-4])/.exec(t);return null!==r?Number(r[1]):"float"===t||"bool"===t||"int"===t||"uint"===t?1:!0===/mat2/.test(e)?4:!0===/mat3/.test(e)?9:16*(!0===/mat4/.test(e))}getVectorFromMatrix(e){return e.replace("mat","vec")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){let t=this.getComponentType(e);return"int"===t||"uint"===t?e:this.changeComponentType(e,"int")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]===e)this.activeStacks.pop();else throw Error("NodeBuilder: Invalid active stack removal.")}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}
398addStack(){this.stack=T7(this.stack);let e=pE();return this.stacks.push(e),pM(this.stack),this.stack}removeStack(){let e=this.stack;for(let t of e.nodes)this.getDataFromNode(t).stack=e;return this.stack=e.parent,pM(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,r=null){let i=(r=null===r?e.isGlobal(this)?this.globalCache:this.cache:r).getData(e);void 0===i&&(i={},r.setData(e,i)),void 0===i[t]&&(i[t]={});let n=i[t],a=i.any?i.any.subBuilds:null,s=this.getClosestSubBuild(a);return s&&(void 0===n.subBuildsCache&&(n.subBuildsCache={}),(n=n.subBuildsCache[s]||(n.subBuildsCache[s]={})).subBuilds=a),n}getNodeProperties(e,t="any"){let r=this.getDataFromNode(e,t);return r.properties||(r.properties={outputNode:null})}getBufferAttributeFromNode(e,t){let r=this.getDataFromNode(e,"vertex"),i=r.bufferAttribute;return void 0===i&&(i=new wS("nodeAttribute"+this.uniforms.index++,t,e),this.bufferAttributes.push(i),r.bufferAttribute=i),i}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,r=null,i=this.shaderStage){let n=this.getDataFromNode(e,i,this.globalCache),a=n.structType;if(void 0===a){let s=this.structs.index++;null===r&&(r="StructType"+s),a=new wR(r,t),this.structs[i].push(a),this.types[i][r]=e,n.structType=a}return a}getOutputStructTypeFromNode(e,t){let r=this.getStructTypeFromNode(e,t,"OutputType","fragment");return r.output=!0,r}getUniformFromNode(e,t,r=this.shaderStage,i=null){let n=this.getDataFromNode(e,r,this.globalCache),a=n.uniform;if(void 0===a){let s=this.uniforms.index++;a=new wT(i||"nodeUniform"+s,t,e),this.uniforms[r].push(a),this.registerDeclaration(a),n.uniform=a}return a}getVarFromNode(e,t=null,r=e.getNodeType(this),i=this.shaderStage,n=!1){let a=this.getDataFromNode(e,i),s=this.getSubBuildProperty("variable",a.subBuilds),o=a[s];if(void 0===o){let l=n?"_const":"_var",u=this.vars[i]||(this.vars[i]=[]),h=this.vars[l]||(this.vars[l]=0);null===t&&(t=(n?"nodeConst":"nodeVar")+h,this.vars[l]++),"variable"!==s&&(t=this.getSubBuildProperty(t,a.subBuilds));let d=e.getArrayCount(this);o=new wA(t,r,n,d),n||u.push(o),this.registerDeclaration(o),a[s]=o}return o}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(!e.bNode||this.isDeterministic(e.bNode))&&(!e.cNode||this.isDeterministic(e.cNode));if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(!e.bNode||this.isDeterministic(e.bNode));if(e.isArrayNode){if(null!==e.values){for(let t of e.values)if(!this.isDeterministic(t))return!1}return!0}return!!e.isConstNode||!1}getVaryingFromNode(e,t=null,r=e.getNodeType(this),i=null,n=null){let a=this.getDataFromNode(e,"any"),s=this.getSubBuildProperty("varying",a.subBuilds),o=a[s];if(void 0===o){let e=this.varyings,l=e.length;null===t&&(t="nodeVarying"+l),"varying"!==s&&(t=this.getSubBuildProperty(t,a.subBuilds)),o=new wM(t,r,i,n),e.push(o),this.registerDeclaration(o),a[s]=o}return o}registerDeclaration(e){let t=this.shaderStage,r=this.declarations[t]||(this.declarations[t]={}),i=this.getPropertyName(e),n=1,a=i;for(;void 0!==r[a];)a=i+"_"+n++;n>1&&(e.name=a,en(`TSL: Declaration name '${i}' of '${e.type}' already in use. Renamed to '${a}'.`)),r[a]=e}getCodeFromNode(e,t,r=this.shaderStage){let i=this.getDataFromNode(e),n=i.code;if(void 0===n){let e=this.codes[r]||(this.codes[r]=[]);n=new wE("nodeCode"+e.length,t),e.push(n),i.code=n}return n}addFlowCodeHierarchy(e,t){let{flowCodes:r,flowCodeBlock:i}=this.getDataFromNode(e),n=!0,a=t;for(;a;){if(!0===i.get(a)){n=!1;break}a=this.getDataFromNode(a).parentNodeBlock}if(n)for(let e of r)this.addLineFlowCode(e)}addLineFlowCodeBlock(e,t,r){let i=this.getDataFromNode(e),n=i.flowCodes||(i.flowCodes=[]),a=i.flowCodeBlock||(i.flowCodeBlock=new WeakMap);n.push(t),a.set(r,!0)}addLineFlowCode(e,t=null){return""===e||(null!==t&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\s*$/.test(e)||(e+=";\n"),this.flow.code+=e),this}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=" ",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){let t=e.getNodeType(this),r=this.flowChildNode(e,t);return this.flowsData.set(e,r),r}addInclude(e){null!==this.currentFunctionNode&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){let t=new M2,r=this.currentFunctionNode;return this.currentFunctionNode=t,t.code=this.buildFunctionCode(e),this.currentFunctionNode=r,t}flowShaderNode(e){let t=e.layout,r={[Symbol.iterator](){let e=0,t=Object.values(this);return{next:()=>({value:t[e],done:e++>=t.length})}}};
398for(let e of t.inputs)r[e.name]=new T6(e.type,e.name);e.layout=null;let i=e.call(r),n=this.flowStagesNode(i,t.type);return e.layout=t,n}flowBuildStage(e,t,r=null){let i=this.getBuildStage();this.setBuildStage(t);let n=e.build(this,r);return this.setBuildStage(i),n}flowStagesNode(e,t=null){let r=this.flow,i=this.vars,n=this.declarations,a=this.cache,s=this.buildStage,o=this.stack,l={code:""};for(let r of(this.flow=l,this.vars={},this.declarations={},this.cache=new ww,this.stack=T7(),cI))this.setBuildStage(r),l.result=e.build(this,t);return l.vars=this.getVars(this.shaderStage),this.flow=r,this.vars=i,this.declarations=n,this.cache=a,this.stack=o,this.setBuildStage(s),l}getFunctionOperator(){return null}buildFunctionCode(){en("Abstract function.")}flowChildNode(e,t=null){let r=this.flow,i={code:""};return this.flow=i,i.result=e.build(this,t),this.flow=r,i}flowNodeFromShaderStage(e,t,r=null,i=null){let n=this.tab,a=this.cache,s=this.shaderStage,o=this.context;this.setShaderStage(e);let l={...this.context};delete l.nodeBlock,this.cache=this.globalCache,this.tab=" ",this.context=l;let u=null;if("generate"===this.buildStage){let n=this.flowChildNode(t,r);null!==i&&(n.code+=`${this.tab+i} = ${n.result}; 399`),this.flowCode[e]=this.flowCode[e]+n.code,u=n}else u=t.build(this);return this.setShaderStage(s),this.cache=a,this.tab=n,this.context=o,u}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){en("Abstract function.")}getVaryings(){en("Abstract function.")}getVar(e,t,r=null){return`${null!==r?this.generateArrayDeclaration(e,r):this.getType(e)} ${t}`}getVars(e){let t="",r=this.vars[e];if(void 0!==r)for(let e of r)t+=`${this.getVar(e.type,e.name)}; `;return t}getUniforms(){en("Abstract function.")}getCodes(e){let t=this.codes[e],r="";if(void 0!==t)for(let e of t)r+=e.code+"\n";return r}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){en("Abstract function.")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(!(t=e&&e.isNode?e.isShaderCallNodeInternal?e.shaderNode.subBuilds:e.isStackNode?[e.subBuild]:this.getDataFromNode(e,"any").subBuilds:e instanceof Set?[...e]:e))return null;let r=this.subBuildLayers;for(let e=t.length-1;e>=0;e--){let i=t[e];if(r.includes(i))return i}return null}getSubBuildOutput(e){return this.getSubBuildProperty("outputNode",e)}getSubBuildProperty(e="",t=null){let r;return(r=null!==t?this.getClosestSubBuild(t):this.subBuildFn)?e?r+"_"+e:r:e}build(){let{object:e,material:t,renderer:r}=this;if(null!==t){let e=r.library.fromMaterial(t);null===e&&(ea(`NodeMaterial: Material "${t.type}" is not compatible.`),e=new x7),e.build(this)}else this.addFlow("compute",e);for(let e of cI)for(let t of(this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage("vertex",this.context.position),cP))for(let r of(this.setShaderStage(t),this.flowNodes[t]))"generate"===e?this.flowNode(r):r.build(this);return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=wJ.get(e);return void 0===t&&(t={}),t}getNodeUniform(e,t){let r=this.getSharedDataFromNode(e),i=r.cache;if(void 0===i){if("float"===t||"int"===t||"uint"===t)i=new wG(e);else if("vec2"===t||"ivec2"===t||"uvec2"===t)i=new wk(e);else if("vec3"===t||"ivec3"===t||"uvec3"===t)i=new wV(e);else if("vec4"===t||"ivec4"===t||"uvec4"===t)i=new wz(e);else if("color"===t)i=new wH(e);else if("mat2"===t)i=new wW(e);else if("mat3"===t)i=new wj(e);else if("mat4"===t)i=new wX(e);else throw Error(`Uniform "${t}" not implemented.`);r.cache=i}return i}format(e,t,r){if(t=this.getVectorType(t),r=this.getVectorType(r),t===r||null===r||this.isReference(r))return e;let i=this.getTypeLength(t),n=this.getTypeLength(r);return 16===i&&9===n?`${this.getType(r)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:9===i&&4===n?`${this.getType(r)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:i>4||n>4||0===n?e:i===n?`${this.getType(r)}( ${e} )`:i>n?(e="bool"===r?`all( ${e} )`:`${e}.${"xyz".slice(0,n)}`,this.format(e,this.getTypeFromLength(n,this.getComponentType(t)),r)):4===n&&i>1?`${this.getType(r)}( ${this.format(e,t,"vec3")}, 1.0 )`:2===i?`${this.getType(r)}( ${this.format(e,t,"vec2")}, 0.0 )`:(1===i&&n>1&&t!==this.getComponentType(r)&&(e=`${this.getType(this.getComponentType(r))}( ${e} )`),`${this.getType(r)}( ${e} )`)}getSignature(){return`// Three.js r183 - Node System 400`}needsPreviousData(){let e=this.renderer.getMRT();return e&&e.has("velocity")||!0===cA(this.object).useVelocity}}class wZ{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let r=e.get(t);return void 0===r&&(r={renderId:0,frameId:0},e.set(t,r)),r}updateBeforeNode(e){let t=e.getUpdateBeforeType(),r=e.updateReference(this);if(t===cR.FRAME){let t=this._getMaps(this.updateBeforeMap,r);if(t.frameId!==this.frameId){let r=t.frameId;t.frameId=this.frameId,!1===e.updateBefore(this)&&(t.frameId=r)}}else if(t===cR.RENDER){let t=this._getMaps(this.updateBeforeMap,r);if(t.renderId!==this.renderId){let r=t.renderId;t.renderId=this.renderId,!1===e.updateBefore(this)&&(t.renderId=r)}}else t===cR.OBJECT&&e.updateBefore(this)}updateAfterNode(e){let t=e.getUpdateAfterType(),r=e.updateReference(this);if(t===cR.FRAME){let t=this._getMaps(this.updateAfterMap,r);
400t.frameId!==this.frameId&&!1!==e.updateAfter(this)&&(t.frameId=this.frameId)}else if(t===cR.RENDER){let t=this._getMaps(this.updateAfterMap,r);t.renderId!==this.renderId&&!1!==e.updateAfter(this)&&(t.renderId=this.renderId)}else t===cR.OBJECT&&e.updateAfter(this)}updateNode(e){let t=e.getUpdateType(),r=e.updateReference(this);if(t===cR.FRAME){let t=this._getMaps(this.updateMap,r);t.frameId!==this.frameId&&!1!==e.update(this)&&(t.frameId=this.frameId)}else if(t===cR.RENDER){let t=this._getMaps(this.updateMap,r);t.renderId!==this.renderId&&!1!==e.update(this)&&(t.renderId=this.renderId)}else t===cR.OBJECT&&e.update(this)}update(){this.frameId++,void 0===this.lastTime&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}}class w0{constructor(e,t,r=null,i="",n=!1){this.type=e,this.name=t,this.count=r,this.qualifier=i,this.isConst=n}}w0.isNodeFunctionInput=!0;class w1 extends CN{static get type(){return"AmbientLightNode"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}}class w2 extends CN{static get type(){return"DirectionalLightNode"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:EJ(this.light),lightColor:e}}}class w3 extends CN{static get type(){return"HemisphereLightNode"}constructor(e=null){super(e),this.lightPositionNode=EX(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=fC(new ty).setGroup(fA)}update(e){let{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){let{colorNode:t,groundColorNode:r,lightDirectionNode:i}=this,n=m0(r,t,yM.dot(i).mul(.5).add(.5));e.context.irradiance.addAssign(n)}}class w4 extends CN{static get type(){return"SpotLightNode"}constructor(e=null){super(e),this.coneCosNode=fC(0).setGroup(fA),this.penumbraCosNode=fC(0).setGroup(fA),this.cutoffDistanceNode=fC(0).setGroup(fA),this.decayExponentNode=fC(0).setGroup(fA),this.colorNode=fC(this.color).setGroup(fA)}update(e){super.update(e);let{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){let{coneCosNode:r,penumbraCosNode:i}=this;return m4(r,i,t)}getLightCoord(e){let t=e.getNodeProperties(this),r=t.projectionUV;return void 0===r&&(t.projectionUV=r=Ej(this.light,e.context.positionWorld)),r}setupDirect(e){let t,r,{colorNode:i,cutoffDistanceNode:n,decayExponentNode:a,light:s}=this,o=this.getLightVector(e),l=o.normalize(),u=l.dot(EJ(s)),h=this.getSpotAttenuation(e,u),d=CL({lightDistance:o.length(),cutoffDistance:n,decayExponent:a}),c=i.mul(h).mul(d);return s.colorNode?(r=this.getLightCoord(e),t=s.colorNode(r)):s.map&&(r=this.getLightCoord(e),t=vo(s.map,r.xy).onRenderUpdate(()=>s.map)),t&&(c=r.mul(2).sub(1).abs().lessThan(1).all().select(c.mul(t),c)),{lightColor:c,lightDirection:l}}}class w5 extends w4{static get type(){return"IESSpotLightNode"}getSpotAttenuation(e,t){let r=this.light.iesMap;return r&&!0===r.isTexture?vo(r,pP(t.acos().mul(1/Math.PI),0),0).r:super.getSpotAttenuation(t)}}class w8 extends CN{static get type(){return"LightProbeNode"}constructor(e=null){super(e);const t=[];for(let e=0;e<9;e++)t.push(new eT);this.lightProbe=vp(t)}update(e){let{light:t}=this;super.update(e);for(let e=0;e<9;e++)this.lightProbe.array[e].copy(t.sh.coefficients[e]).multiplyScalar(t.intensity)}setup(e){let t=wm(yM,this.lightProbe);e.context.irradiance.addAssign(t)}}let w6=pA(([e,t])=>{let r=e.abs().sub(t);return mC(mk(r,0)).add(mG(mk(r.x,r.y),0))});class w9 extends w4{static get type(){return"ProjectorLightNode"}update(e){super.update(e);let t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),null===t.aspect){let e=1;null!==t.map&&(e=t.map.width/t.map.height),t.shadow.aspect=e}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){let t=pN(0),r=this.penumbraCosNode,i=EW(this.light).mul(e.context.positionWorld||yd);return pC(i.w.greaterThan(0),()=>{let e=w6(i.xyz.div(i.w).xy.sub(pP(.5)),pP(.5)),n=fG(-1,fU(1,mT(r)).sub(1));t.assign(m2(e.mul(-2).mul(n)))}),t}}let w7=new eq,Re=new eq,Rt=null;class Rr extends CN{static get type(){return"RectAreaLightNode"}constructor(e=null){super(e),this.halfHeight=fC(new eT).setGroup(fA),this.halfWidth=fC(new eT).setGroup(fA),this.updateType=cR.RENDER}update(e){super.update(e);let{light:t}=this,r=e.camera.matrixWorldInverse;Re.identity(),w7.copy(t.matrixWorld),w7.premultiply(r),Re.extractRotation(w7),this.halfWidth.value.set(.5*t.width,0,0),this.halfHeight.value.set(0,.5*t.height,0),this.halfWidth.value.applyMatrix4(Re),this.halfHeight.value.a
400pplyMatrix4(Re)}setupDirectRectArea(e){let t,r;e.isAvailable("float32Filterable")?(t=vo(Rt.LTC_FLOAT_1),r=vo(Rt.LTC_FLOAT_2)):(t=vo(Rt.LTC_HALF_1),r=vo(Rt.LTC_HALF_2));let{colorNode:i,light:n}=this;return{lightColor:i,lightPosition:E$(n),halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:r}}static setLTC(e){Rt=e}}class Ri{parseFunction(){en("Abstract function.")}}class Rn{constructor(e,t,r="",i=""){this.type=e,this.inputs=t,this.name=r,this.precision=i}getCode(){en("Abstract function.")}}Rn.isNodeFunction=!0;let Ra=/^\s*(highp|mediump|lowp)?\s*([a-z_0-9]+)\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)/i,Rs=/[a-z_0-9]+/ig,Ro="#pragma main";class Rl extends Rn{constructor(e){const{type:t,inputs:r,name:i,precision:n,inputsCode:a,blockCode:s,headerCode:o}=(e=>{let t=(e=e.trim()).indexOf(Ro),r=-1!==t?e.slice(t+Ro.length):e,i=r.match(Ra);if(null!==i&&5===i.length){let n=i[4],a=[],s=null;for(;null!==(s=Rs.exec(n));)a.push(s);let o=[],l=0;for(;l<a.length;){let e="const"===a[l][0];!0===e&&l++;let t=a[l][0];"in"===t||"out"===t||"inout"===t?l++:t="";let r=a[l++][0],i=Number.parseInt(a[l][0]);!1===Number.isNaN(i)?l++:i=null;let n=a[l++][0];o.push(new w0(r,n,i,t,e))}let u=r.substring(i[0].length),h=void 0!==i[3]?i[3]:"",d=i[2];return{type:d,inputs:o,name:h,precision:void 0!==i[1]?i[1]:"",inputsCode:n,blockCode:u,headerCode:-1!==t?e.slice(0,t):""}}throw Error("FunctionNode: Function is not a GLSL code.")})(e);super(t,r,i,n),this.inputsCode=a,this.blockCode=s,this.headerCode=o}getCode(e=this.name){let t,r=this.blockCode;if(""!==r){let{type:i,inputsCode:n,headerCode:a,precision:s}=this,o=`${i} ${e} ( ${n.trim()} )`;""!==s&&(o=`${s} ${o}`),t=a+o+r}else t="";return t}}class Ru extends Ri{parseFunction(e){return new Rl(e)}}let Rh=new WeakMap,Rd=[],Rc=[];class Rp extends TP{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new wZ,this.nodeBuilderCache=new Map,this.callHashCache=new TR,this.groupsData=new TR,this.cacheLib={}}updateGroup(e){let t=e.groupNode,r=t.name;if(r===fM.name)return!0;if(r===fA.name){let t=this.get(e),r=this.nodeFrame.renderId;return t.renderId!==r&&(t.renderId=r,!0)}if(r===fT.name){let t=this.get(e),r=this.nodeFrame.frameId;return t.frameId!==r&&(t.frameId=r,!0)}Rd[0]=t,Rd[1]=e;let i=this.groupsData.get(Rd);return void 0===i&&this.groupsData.set(Rd,i={}),Rd[0]=null,Rd[1]=null,i.version!==t.version&&(i.version=t.version,!0)}getForRenderCacheKey(e){return e.initialCacheKey}getForRender(e){let t=this.get(e),r=t.nodeBuilderState;if(void 0===r){let{nodeBuilderCache:i}=this,n=this.getForRenderCacheKey(e);if(void 0===(r=i.get(n))){let t=t=>{let r=this.backend.createNodeBuilder(e.object,this.renderer);return r.scene=e.scene,r.material=t,r.camera=e.camera,r.context.material=t,r.lightsNode=e.lightsNode,r.environmentNode=this.getEnvironmentNode(e.scene),r.fogNode=this.getFogNode(e.scene),r.clippingContext=e.clippingContext,this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview&&r.enableMultiview(),r},a=t(e.material);try{a.build()}catch(r){(a=t(new x7)).build();let e=r.stackTrace;!e&&r.stack&&(e=new ch(r.stack)),ea("TSL: "+r,e)}r=this._createNodeBuilderState(a),i.set(n,r)}r.usedTimes++,t.nodeBuilderState=r}return r}delete(e){if(e.isRenderObject){let t=this.get(e).nodeBuilderState;t.usedTimes--,0===t.usedTimes&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e))}return super.delete(e)}getForCompute(e){let t=this.get(e),r=t.nodeBuilderState;if(void 0===r){let i=this.backend.createNodeBuilder(e,this.renderer);i.build(),t.nodeBuilderState=r=this._createNodeBuilderState(i)}return r}_createNodeBuilderState(e){return new wb(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.transforms)}getEnvironmentNode(e){this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{let r=this.get(e);r.environmentNode&&(t=r.environmentNode)}return t}
400getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{let r=this.get(e);r.backgroundNode&&(t=r.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){Rd[0]=e,Rd[1]=t;let r=this.renderer.info.calls,i=this.callHashCache.get(Rd)||{};if(i.callId!==r){let n=this.getEnvironmentNode(e),a=this.getFogNode(e);t&&Rc.push(t.getCacheKey(!0)),n&&Rc.push(n.getCacheKey()),a&&Rc.push(a.getCacheKey()),Rc.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Rc.push(+!!this.renderer.shadowMap.enabled),Rc.push(this.renderer.shadowMap.type),i.callId=r,i.cacheKey=cp(Rc),this.callHashCache.set(Rd,i),Rc.length=0}return Rd[0]=null,Rd[1]=null,i.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){let t=this.get(e),r=e.background;if(r){let i=0===e.backgroundBlurriness&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&0===t.backgroundBlurriness;(t.background!==r||i)&&(t.backgroundNode=this.getCacheNode("background",r,()=>{if(!0===r.isCubeTexture||303===r.mapping||304===r.mapping||306===r.mapping)if(e.backgroundBlurriness>0||306===r.mapping)return S4(r);else return bf(!0===r.isCubeTexture?yW(r):vo(r));if(!0===r.isTexture)return vo(r,vy.flipY()).setUpdateMatrix(!0);!0!==r.isColor&&ea("WebGPUNodes: Unsupported background configuration.",r)},i),t.background=r,t.backgroundBlurriness=e.backgroundBlurriness)}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,r,i=!1){let n=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap),a=n.get(t);return(void 0===a||i)&&(a=r(),n.set(t,a)),a}updateFog(e){let t=this.get(e),r=e.fog;r?t.fog!==r&&(t.fogNode=this.getCacheNode("fog",r,()=>r.isFogExp2?M9(yq("color","color",r).setGroup(fA),M8(yq("density","float",r).setGroup(fA))):r.isFog?M9(yq("color","color",r).setGroup(fA),M5(yq("near","float",r).setGroup(fA),yq("far","float",r).setGroup(fA))):void ea("Renderer: Unsupported fog configuration.",r)),t.fog=r):(delete t.fogNode,delete t.fog)}updateEnvironment(e){let t=this.get(e),r=e.environment;r?t.environment!==r&&(t.environmentNode=this.getCacheNode("environment",r,()=>!0===r.isCubeTexture?yW(r):!0===r.isTexture?vo(r):void ea("Nodes: Unsupported environment configuration.",r)),t.environment=r):t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,r=null,i=null,n=null){let a=this.nodeFrame;return a.renderer=e,a.scene=t,a.object=r,a.camera=i,a.material=n,a}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){let e=this.renderer;return e.toneMapping+","+e.currentColorSpace+","+e.xr.isPresenting}hasOutputChange(e){return Rh.get(e)!==this.getOutputCacheKey()}getOutputNode(e){let t=this.renderer,r=this.getOutputCacheKey(),i=e.isArrayTexture?MS(e,pO(vy,vm("gl_ViewID_OVR"))).renderOutput(t.toneMapping,t.currentColorSpace):vo(e,vy).renderOutput(t.toneMapping,t.currentColorSpace);return Rh.set(e,r),i}updateBefore(e){for(let t of e.getNodeBuilderState().updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(t)}updateAfter(e){for(let t of e.getNodeBuilderState().updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(t)}updateForCompute(e){let t=this.getNodeFrame();for(let r of this.getForCompute(e).updateNodes)t.updateNode(r)}updateForRender(e){let t=this.getNodeFrameForRender(e);for(let r of e.getNodeBuilderState().updateNodes)t.updateNode(r)}needsRefresh(e){let t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new wZ,this.nodeBuilderCache=new Map,this.cacheLib={}}}let Rf=new iC;class Rm{constructor(e=null){this.version=0,this.clipIntersection=null,this.cacheKey="",this.shadowPass=!1,this.viewNormalMatrix=new eE,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,null!==e&&(this.viewNormalMatrix=e.viewNormalMatrix,this.clippingGroupContexts=e.clippingGroupContexts,this.shadowPass=e.shadowPass,this.viewMatrix=e.viewMatrix)}projectPlanes(e,t,r){let i=e.length;for(let n=0;n<i;n++){Rf.copy(e[n]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let i=t[r+n],a=Rf.normal;i.x=-a.x,i.y=-a.y,i.z=-a.z,i.w=Rf.constant}}updateGlobal(e,t){this.shadowPass=null!==e.overrideMaterial&&e.overrideMaterial.isShadowPassMaterial,this.viewMatrix=t.matrixWorldInverse,this.viewNormalMatrix.getNormalMatrix(this.viewMatrix)}update(e,t){let r,i,n=!1;e.version!==this.parentVersion&&(this.intersectionPlanes=Array.from(e.intersectionPlanes),this.unionPlanes=Array.from(e.unionPlanes),this.parentVersion=e.version),this.clipIntersection!==t.clipIntersection&&(this.clipIntersection=t.clipIntersection,this.clipIntersection?this.unionPlanes.length=e.unionPlanes.length:this.intersectionPlanes.length=e.intersectionPlanes.length);let a=t.clippingPlanes,s=a.length;if(this.clipIntersection?(r=this.intersectionPlanes,i=e.intersectionPlanes.length):(r=this.unionPlanes,i=e.unionPlanes.length),r.length!==i+s){r.length=i+s;for(let e=0;e<s;e++)r[i+e]=new ek;n=!0}this.projectPlanes(a,r,i),n&&(this.version++,this.cacheKey=`${this.intersectionPlanes.length}:${this.unionPlanes.length}`)}
400getGroupContext(e){if(this.shadowPass&&!e.clipShadows)return this;let t=this.clippingGroupContexts.get(e);return void 0===t&&(t=new Rm(this),this.clippingGroupContexts.set(e,t)),t.update(this,e),t}get unionClippingCount(){return this.unionPlanes.length}}class Rg{constructor(e,t){this.bundleGroup=e,this.camera=t}}let Rv=[];class Ry{constructor(){this.bundles=new TR}get(e,t){let r=this.bundles;Rv[0]=e,Rv[1]=t;let i=r.get(Rv);return void 0===i&&(i=new Rg(e,t),r.set(Rv,i)),Rv[0]=null,Rv[1]=null,i}dispose(){this.bundles=new TR}}class R_{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null,r=this.getMaterialNodeClass(e.type);if(null!==r)for(let i in t=new r,e)t[i]=e[i];return t}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,r){if(r.has(t))return void en(`Redefinition of node ${t}`);if("function"!=typeof e)throw Error(`Node class ${e.name} is not a class.`);if("function"==typeof t||"object"==typeof t)throw Error(`Base class ${t} is not a class.`);r.set(t,e)}addClass(e,t,r){if(r.has(t))return void en(`Redefinition of node ${t.name}`);if("function"!=typeof e)throw Error(`Node class ${e.name} is not a class.`);if("function"!=typeof t)throw Error(`Base class ${t.name} is not a class.`);r.set(t,e)}}let Rx=new EZ,Rb=new WeakMap;class RS{createNode(e=[]){return new EZ().setLights(e)}getNode(e){if(e.isQuadMesh)return Rx;let t=Rb.get(e);return void 0===t&&(t=this.createNode(),Rb.set(e,t)),t}}class RT extends eV{constructor(e=1,t=1,r={}){super(e,t,r),this.isXRRenderTarget=!0,this._hasExternalTextures=!1,this._autoAllocateDepthBuffer=!0,this._isOpaqueFramebuffer=!1}copy(e){return super.copy(e),this._hasExternalTextures=e._hasExternalTextures,this._autoAllocateDepthBuffer=e._autoAllocateDepthBuffer,this._isOpaqueFramebuffer=e._isOpaqueFramebuffer,this}}let RA=new eT,RM=new eT;class RE extends eu{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new sC,this._cameraL.viewport=new ek,this._cameraR=new sC,this._cameraR.viewport=new ek,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new s2,this._currentDepthNear=null,this._currentDepthFar=null,this._controllers=[],this._controllerInputSources=[],this._xrRenderTarget=null,this._layers=[],this._sessionUsesLayers=!1,this._supportsGlBinding="u">typeof XRWebGLBinding,this._frameBufferTargets=null,this._createXRLayer=RL.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSize=new eb,this._onSessionEvent=Rw.bind(this),this._onSessionEnd=RR.bind(this),this._onInputSourcesChange=RN.bind(this),this._onAnimationFrame=RB.bind(this),this._referenceSpace=null,this._referenceSpaceType="local-floor",this._customReferenceSpace=null,this._framebufferScaleFactor=1,this._foveation=1,this._session=null,this._glBaseLayer=null,this._glBinding=null,this._glProjLayer=null,this._xrFrame=null,this._supportsLayers=this._supportsGlBinding&&"createProjectionLayer"in XRWebGLBinding.prototype,this._useMultiviewIfPossible=t,this._useMultiview=!1}getController(e){return this._getController(e).getTargetRaySpace()}getControllerGrip(e){return this._getController(e).getGripSpace()}getHand(e){return this._getController(e).getHandSpace()}getFoveation(){if(null!==this._glProjLayer||null!==this._glBaseLayer)return this._foveation}setFoveation(e){this._foveation=e,null!==this._glProjLayer&&(this._glProjLayer.fixedFoveation=e),null!==this._glBaseLayer&&void 0!==this._glBaseLayer.fixedFoveation&&(this._glBaseLayer.fixedFoveation=e)}getFramebufferScaleFactor(){return this._framebufferScaleFactor}setFramebufferScaleFactor(e){this._framebufferScaleFactor=e,!0===this.isPresenting&&en("XRManager: Cannot change framebuffer scale while presenting.")}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,!0===this.isPresenting&&en("XRManager: Cannot change reference space type while presenting.")}getReferenceSpace(){return this._customReferenceSpace||this._referenceSpace}setReferenceSpace(e){this._customReferenceSpace=e}getCamera(){return this._cameraXR}getEnvironmentBlendMode(){if(null!==this._session)return this._session.environmentBlendMode}getBinding(){return null===this._glBinding&&this._supportsGlBinding&&(this._glBinding=new XRWebGLBinding(this._session,this._gl)),this._glBinding}getFrame(){return this._xrFrame}useMultiview(){return this._useMultiview}createQuadLayer(e,t,r,i,n,a,s,o={}){let l=new ag(e,t),u=new RT(n,a,{format:1023,type:1009,depthTexture:new nv(n,a,o.stencil?1020:1014,void 0,void 0,void 0,void 0,void 0,void 0,o.stencil?1027:1026),stencilBuffer:o.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let h=new r$({color:0xffffff,side:0});h.map=u.texture,h.map.offset.y=1,h.map.repeat.y=-1;let d=new r8(l,h);d.position.copy(r),d.quaternion.copy(i);let c={type:"quad",width:e,height:t,translation:r,quaternion:i,pixelwidth:n,pixelheight:a,plane:d,material:h,rendercall:s,renderTarget:u};if(this._layers.push(c),null!==this._session){c.plane.material=new r$({color:0xffffff,side:0}),c.plane.material.blending=5,c.plane.material.blendEquation=100,c.plane.material.blendSrc=200,c.plane.material.blendDst=200,c.xrlayer=this._createXRLayer(c);let e=this._session.renderState.layers;e.unshift(c.xrlayer),this._session.updateRenderState({layers:e})}else u.isXRRenderTarget=!1;return d}createCylinderLayer(e,t,r,i,n,a,s,o,l={}){let u=new nT(e,e,e*t/r,64,64,!0,Math.PI-t/2,t),h=new RT(a,s,{format:1023,type:1009,depthTexture:new nv(a,s,l.stencil?1020:1014,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?1027:1026),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});h._autoAllocateDepthBuffer=!0;let d=new r$({color:0xffffff,side:1});d.map=h.texture,d.map.offset.y=1,d.map.repeat.y=-1;let c=new r8(u,d);c.position.copy(i),c.quaternion.copy(n);
400let p={type:"cylinder",radius:e,centralAngle:t,aspectratio:r,translation:i,quaternion:n,pixelwidth:a,pixelheight:s,plane:c,material:d,rendercall:o,renderTarget:h};if(this._layers.push(p),null!==this._session){p.plane.material=new r$({color:0xffffff,side:1}),p.plane.material.blending=5,p.plane.material.blendEquation=100,p.plane.material.blendSrc=200,p.plane.material.blendDst=200,p.xrlayer=this._createXRLayer(p);let e=this._session.renderState.layers;e.unshift(p.xrlayer),this._session.updateRenderState({layers:e})}else h.isXRRenderTarget=!1;return c}renderLayers(){let e=new eT,t=new eS,r=this._renderer,i=this.isPresenting,n=r.getOutputRenderTarget(),a=r._frameBufferTarget;this.isPresenting=!1;let s=new eb;r.getSize(s);let o=r._quad;for(let i of this._layers)if(i.renderTarget.isXRRenderTarget=null!==this._session,i.renderTarget._hasExternalTextures=i.renderTarget.isXRRenderTarget,i.renderTarget.isXRRenderTarget&&this._sessionUsesLayers){i.xrlayer.transform=new XRRigidTransform(i.plane.getWorldPosition(e),i.plane.getWorldQuaternion(t));let n=this._glBinding.getSubImage(i.xrlayer,this._xrFrame);r.backend.setXRRenderTargetTextures(i.renderTarget,n.colorTexture,void 0),r._setXRLayerSize(i.renderTarget.width,i.renderTarget.height),r.setOutputRenderTarget(i.renderTarget),r.setRenderTarget(null),r._frameBufferTarget=null,this._frameBufferTargets||(this._frameBufferTargets=new WeakMap);let{frameBufferTarget:a,quad:s}=this._frameBufferTargets.get(i.renderTarget)||{frameBufferTarget:null,quad:null};a?(r._frameBufferTarget=a,r._quad=s):(r._quad=new A6(new x7),this._frameBufferTargets.set(i.renderTarget,{frameBufferTarget:r._getFrameBufferTarget(),quad:r._quad})),i.rendercall(),r._frameBufferTarget=null}else r.setRenderTarget(i.renderTarget),i.rendercall();r.setRenderTarget(null),r.setOutputRenderTarget(n),r._frameBufferTarget=a,r._setXRLayerSize(s.x,s.y),r._quad=o,this.isPresenting=i}getSession(){return this._session}async setSession(e){let t=this._renderer,r=t.backend;this._gl=t.getContext();let i=this._gl,n=i.getContextAttributes();if(this._session=e,null!==e){if(!0===r.isWebGPUBackend)throw Error('THREE.XRManager: XR is currently not supported with a WebGPU backend. Use WebGL by passing "{ forceWebGL: true }" to the constructor of the renderer.');if(e.addEventListener("select",this._onSessionEvent),e.addEventListener("selectstart",this._onSessionEvent),e.addEventListener("selectend",this._onSessionEvent),e.addEventListener("squeeze",this._onSessionEvent),e.addEventListener("squeezestart",this._onSessionEvent),e.addEventListener("squeezeend",this._onSessionEvent),e.addEventListener("end",this._onSessionEnd),e.addEventListener("inputsourceschange",this._onInputSourcesChange),await r.makeXRCompatible(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),!0===this._supportsLayers){let r=null,a=null,s=null;t.depth&&(s=t.stencil?i.DEPTH24_STENCIL8:i.DEPTH_COMPONENT24,r=t.stencil?1027:1026,a=t.stencil?1020:1014);let o={colorFormat:i.RGBA8,depthFormat:s,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature("OVR_multiview2")&&(o.textureType="texture-array",this._useMultiview=!0),this._glBinding=this.getBinding();let l=this._glBinding.createProjectionLayer(o),u=[l];this._glProjLayer=l,t.setPixelRatio(1),t._setXRLayerSize(l.textureWidth,l.textureHeight);let h=this._useMultiview?2:1,d=new nv(l.textureWidth,l.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,r,h);if(this._xrRenderTarget=new RT(l.textureWidth,l.textureHeight,{format:1023,type:1009,colorSpace:t.outputColorSpace,depthTexture:d,stencilBuffer:t.stencil,samples:4*!!n.antialias,resolveDepthBuffer:!1===l.ignoreDepthValues,resolveStencilBuffer:!1===l.ignoreDepthValues,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes("layers"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(let e of this._layers)e.plane.material=new r$({color:0xffffff,side:+("cylinder"===e.type)}),e.plane.material.blending=5,e.plane.material.blendEquation=100,e.plane.material.blendSrc=200,e.plane.material.blendDst=200,e.xrlayer=this._createXRLayer(e),u.unshift(e.xrlayer);e.updateRenderState({layers:u})}else{let r=new XRWebGLLayer(e,i,{antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()});this._glBaseLayer=r,e.updateRenderState({baseLayer:r}),t.setPixelRatio(1),t._setXRLayerSize(r.framebufferWidth,r.framebufferHeight),this._xrRenderTarget=new RT(r.framebufferWidth,r.framebufferHeight,{format:1023,type:1009,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:!1===r.ignoreDepthValues,resolveStencilBuffer:!1===r.ignoreDepthValues}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}this.setFoveation(this.getFoveation()),t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:"sessionstart"})}}updateCamera(e){var t,r,i;let n=this._session;if(null===n)return;let a=e.near,s=e.far,o=this._cameraXR,l=this._cameraL,u=this._cameraR;o.near=u.near=l.near=a,o.far=u.far=l.far=s,o.isMultiViewCamera=this._useMultiview,(this._currentDepthNear!==o.near||this._currentDepthFar!==o.far)&&(n.updateRenderState({depthNear:o.near,depthFar:o.far}),this._currentDepthNear=o.near,this._currentDepthFar=o.far),o.layers.mask=6|e.layers.mask,l.layers.mask=-5&o.layers.mask,u.layers.mask=-3&o.layers.mask;let h=e.parent,d=o.cameras;RC(o,h);for(let e=0;e<d.length;e++)RC(d[e],h);2===d.length?function(e,t,r){RA.setFromMatrixPosition(t.matrixWorld),RM.setFromMatrixPosition(r.matrixWorld);let i=RA.distanceTo(RM),n=t.projectionMatrix.elements,a=r.projectionMatrix.elements,s=n[14]/(n[10]-1),o=n[14]/(n[10]+1),l=(n[9]+1)/n[5],u=(n[9]-1)/n[5],h=(n[8]-1)/n[0],d=(a[8]+1)/a[0],c=i/(-h+d),p=-(c*h);if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(p),e.translateZ(c),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===n[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=s+c,r=o+c;e.projectionMatrix.makePerspective(s*h-p,s*d+(i-p),l*o/r*t,u*o/r*t,t,r),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(o,l,u):o.projectionMatrix.copy(l.projectionMatrix),t=e,r=o,null===(i=h)?t.matrix.copy(r.matrixWorld):(t.matrix.copy(i.matrixWorld),t.matrix.invert(),t.matrix.multiply(r.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(r.projectionMatrix),t.projectionMatrixInverse.copy(r.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*ep*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}_getController(e){let t=this._controllers[e];return void 0===t&&(t=new tp,this._controllers[e]=t),t}}function RC(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}function Rw(e){let t=this._controllerInputSources.indexOf(e.inputSource);if(-1===t)return;let r=this._controllers[t];if(void 0!==r){let t=this.getReferenceSpace();r.update(e.inputSource,e.frame,t),r.dispatchEvent({type:e.type,data:e.inputSource})}}function RR(){let e=this._session,t=this._renderer;e.removeEventListener("select",this._onSessionEvent),e.removeEventListener("selectstart",this._onSessionEvent),e.removeEventListener("selectend",this._onSessionEvent),e.removeEventListener("squeeze",this._onSessionEvent),e.removeEventListener("squeezestart",this._onSessionEvent),e.removeEventListener("squeezeend",this._onSessionEvent),e.removeEventListener("end",this._onSessionEnd),e.removeEventListener("inputsourceschange",this._onInputSourcesChange);for(let e=0;e<this._controllers.length;e++){let t=this._controllerInputSources[e];null!==t&&(this._controllerInputSources[e]=null,this._controllers[e].disconnect(t))}if(this._currentDepthNear=null,this._currentDepthFar=null,t._resetXRState(),this._session=null,this._xrRenderTarget=null,this._glBinding=null,this._glBaseLayer=null,this._glProjLayer=null,!0===this._sessionUsesLayers)for(let e of this._layers)e.renderTarget=new RT(e.pixelwidth,e.pixelheight,{format:1023,type:1009,depthTexture:new nv(e.pixelwidth,e.pixelheight,e.stencilBuffer?1020:1014,void 0,void 0,void 0,void 0,void 0,void 0,e.stencilBuffer?1027:1026),stencilBuffer:e.stencilBuffer,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),e.renderTarget.isXRRenderTarget=!1,e.plane.material=e.material,e.material.map=e.renderTarget.texture,e.material.map.offset.y=1,e.material.map.repeat.y=-1,delete e.xrlayer;this.isPresenting=!1,this._useMultiview=!1,t._animation.stop(),t._animation.setAnimationLoop(this._currentAnimationLoop),t._animation.setContext(this._currentAnimationContext),t._animation.start(),t.setPixelRatio(this._currentPixelRatio),t.setSize(this._currentSize.width,this._currentSize.height,!1),this.dispatchEvent({type:"sessionend"})}function RN(e){let t=this._controllers,r=this._controllerInputSources;for(let i=0;i<e.removed.length;i++){let n=e.removed[i],a=r.indexOf(n);a>=0&&(r[a]=null,t[a].disconnect(n))}for(let i=0;i<e.added.length;i++){let n=e.added[i],a=r.indexOf(n);if(-1===a){for(let e=0;e<t.length;e++)if(e>=r.length){r.push(n),a=e;break}else if(null===r[e]){r[e]=n,a=e;break}if(-1===a)break}let s=t[a];s&&s.connect(n)}}function RL(e){return"quad"===e.type?this._glBinding.createQuadLayer({transform:new XRRigidTransform(e.translation,e.quaternion),width:e.width/2,height:e.height/2,space
400:this._referenceSpace,viewPixelWidth:e.pixelwidth,viewPixelHeight:e.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(e.translation,e.quaternion),radius:e.radius,centralAngle:e.centralAngle,aspectRatio:e.aspectRatio,space:this._referenceSpace,viewPixelWidth:e.pixelwidth,viewPixelHeight:e.pixelheight,clearOnAccess:!1})}function RB(e,t){if(void 0===t)return;let r=this._cameraXR,i=this._renderer,n=i.backend,a=this._glBaseLayer,s=this.getReferenceSpace(),o=t.getViewerPose(s);if(this._xrFrame=t,null!==o){let e=o.views;null!==this._glBaseLayer&&n.setXRTarget(a.framebuffer);let t=!1;e.length!==r.cameras.length&&(r.cameras.length=0,t=!0);for(let i=0;i<e.length;i++){let s,o=e[i];if(!0===this._supportsLayers){let e=this._glBinding.getViewSubImage(this._glProjLayer,o);s=e.viewport,0===i&&n.setXRRenderTargetTextures(this._xrRenderTarget,e.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:e.depthStencilTexture)}else s=a.getViewport(o);let l=this._cameras[i];void 0===l&&((l=new sC).layers.enable(i),l.viewport=new ek,this._cameras[i]=l),l.matrix.fromArray(o.transform.matrix),l.matrix.decompose(l.position,l.quaternion,l.scale),l.projectionMatrix.fromArray(o.projectionMatrix),l.projectionMatrixInverse.copy(l.projectionMatrix).invert(),l.viewport.set(s.x,s.y,s.width,s.height),0===i&&(r.matrix.copy(l.matrix),r.matrix.decompose(r.position,r.quaternion,r.scale)),!0===t&&r.cameras.push(l)}i.setOutputRenderTarget(this._xrRenderTarget)}for(let e=0;e<this._controllers.length;e++){let r=this._controllerInputSources[e],i=this._controllers[e];null!==r&&void 0!==i&&i.update(r,t,s)}this._currentAnimationLoop&&this._currentAnimationLoop(e,t),t.detectedPlanes&&this.dispatchEvent({type:"planesdetected",data:t}),this._xrFrame=null}class RI extends eu{constructor(e){super(),this.domElement=e,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new ek(0,0,this._width,this._height),this._scissor=new ek(0,0,this._width,this._height),this._scissorTest=!1,this.colorTexture=new nd,this.depthTexture=new nv}getPixelRatio(){return this._pixelRatio}getDrawingBufferSize(e){return e.set(this._width*this._pixelRatio,this._height*this._pixelRatio).floor()}getSize(e){return e.set(this._width,this._height)}setPixelRatio(e=1){this._pixelRatio!==e&&(this._pixelRatio=e,this.setSize(this._width,this._height,!1))}setDrawingBufferSize(e,t,r){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this._pixelRatio=r,this.domElement.width=Math.floor(e*r),this.domElement.height=Math.floor(t*r),this.setViewport(0,0,e,t),this._dispatchResize())}setSize(e,t,r=!0){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this.domElement.width=Math.floor(e*this._pixelRatio),this.domElement.height=Math.floor(t*this._pixelRatio),!0===r&&(this.domElement.style.width=e+"px",this.domElement.style.height=t+"px"),this.setViewport(0,0,e,t),this._dispatchResize())}getScissor(e){let t=this._scissor;return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e}setScissor(e,t,r,i){let n=this._scissor;e.isVector4?n.copy(e):n.set(e,t,r,i)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,r,i,n=0,a=1){let s=this._viewport;e.isVector4?s.copy(e):s.set(e,t,r,i),s.minDepth=n,s.maxDepth=a}_dispatchResize(){this.dispatchEvent({type:"resize"})}dispose(){this.dispatchEvent({type:"dispose"})}}let RP=new tS,RF=new eb,RD=new ek,RU=new iL,RO=new iP,RG=new eq,Rk=new ek,RV={0:1,1:0,2:2};class Rz{constructor(e,t={}){this.isRenderer=!0;const{logarithmicDepthBuffer:r=!1,reversedDepthBuffer:i=!1,alpha:n=!0,depth:a=!0,stencil:s=!1,antialias:o=!1,samples:l=0,getFallback:u=null,outputBufferType:h=1016,multiview:d=!1}=t;this.backend=e,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.alpha=n,this.logarithmicDepthBuffer=r,this.reversedDepthBuffer=i,this.outputColorSpace=O,this.toneMapping=0,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=a,this.stencil=s,this.info=new Tk,this.contextNode=gi(),this.library=new R_,this.lighting=new RS,this._samples=l||!0===o?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new RI(e.getDomElement()),this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new g3,this._inspector.setRenderer(this),this._getFallback=u,this._attributes=null,this._geometries=null,this._nodes=null,this._animation=null,this._bindings=null,this._objects=null,this._pipelines=null,this._bundles=null,this._renderLists=null,this._renderContexts=null,this._textures=null,this._background=null,this._quad=new A6(new x7),this._quad.name="Output C
400olor Transform",this._quad.material.name="outputColorTransform",this._currentRenderContext=null,this._opaqueSort=null,this._transparentSort=null,this._frameBufferTarget=null;const c=+(!0!==this.alpha);this._clearColor=new T8(0,0,0,c),this._clearDepth=1,this._clearStencil=0,this._renderTarget=null,this._activeCubeFace=0,this._activeMipmapLevel=0,this._outputRenderTarget=null,this._mrt=null,this._renderObjectFunction=null,this._currentRenderObjectFunction=null,this._currentRenderBundle=null,this._handleObjectFunction=this._renderObjectDirect,this._isDeviceLost=!1,this.onDeviceLost=this._onDeviceLost,this._outputBufferType=h,this._cacheShadowNodes=new WeakMap,this._initialized=!1,this._callDepth=-1,this._initPromise=null,this._compilationPromises=null,this.transparent=!0,this.opaque=!0,this.shadowMap={enabled:!1,transmitted:!1,type:1},this.xr=new RE(this,d),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(e,t,r)=>{await this.compileAsync(e,t);let i=this._renderLists.get(e,t),n=this._renderContexts.get(this._renderTarget,this._mrt),a=e.overrideMaterial||r.material,{fragmentShader:s,vertexShader:o}=this._objects.get(r,a,e,t,i.lightsNode,n,n.clippingContext).getNodeBuilderState();return{fragmentShader:s,vertexShader:o}}}}
400async init(){return null!==this._initPromise||(this._initPromise=new Promise(async(e,t)=>{let r=this.backend;try{await r.init(this)}catch(e){if(null===this._getFallback)return void t(e);try{this.backend=r=this._getFallback(e),await r.init(this)}catch(e){t(e);return}}this._nodes=new Rp(this,r),this._animation=new Tw(this,this._nodes,this.info),this._attributes=new TF(r),this._background=new wy(this,this._nodes),this._geometries=new TG(this._attributes,this.info),this._textures=new T5(this,r,this.info),this._pipelines=new TX(r,this._nodes),this._bindings=new Tq(r,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new TI(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new TZ(this.lighting),this._bundles=new Ry,this._renderContexts=new T3(this),this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)})),this._initPromise}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,r=null){if(!0===this._isDeviceLost)return;!1===this._initialized&&await this.init();let i=this._nodes.nodeFrame,n=i.renderId,a=this._currentRenderContext,s=this._currentRenderObjectFunction,o=this._handleObjectFunction,l=this._compilationPromises,u=!0===e.isScene?e:RP;null===r&&(r=e);let h=this._renderTarget,d=this._renderContexts.get(h,this._mrt),c=this._activeMipmapLevel,p=[];this._currentRenderContext=d,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=p,i.renderId++,i.update(),d.depth=this.depth,d.stencil=this.stencil,d.clippingContext||(d.clippingContext=new Rm),d.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,h);let f=this._renderLists.get(e,t);if(f.begin(),this._projectObject(e,t,0,f,d.clippingContext),r!==e&&r.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&f.pushLight(e)}),f.finish(),null!==h){this._textures.updateRenderTarget(h,c);let e=this._textures.get(h);d.textures=e.textures,d.depthTexture=e.depthTexture}else d.textures=null,d.depthTexture=null;r!==e?this._background.update(r,f,d):this._background.update(u,f,d);let m=f.opaque,g=f.transparent,v=f.transparentDoublePass,y=f.lightsNode;!0===this.opaque&&m.length>0&&this._renderObjects(m,t,u,y),!0===this.transparent&&g.length>0&&this._renderTransparents(g,v,t,u,y),i.renderId=n,this._currentRenderContext=a,this._currentRenderObjectFunction=s,this._handleObjectFunction=o,this._compilationPromises=l,await Promise.all(p)}async renderAsync(e,t){es('Renderer: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){ea("Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.")}set inspector(e){null!==this._inspector&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){let t=this.contextNode.value;!0===e?(t.modelViewMatrix=ya,t.modelNormalViewMatrix=ys):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===ya&&e.modelNormalViewMatrix===ys}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return es('Renderer: ".getColorBufferType()" has been renamed to ".getOutputBufferType()".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost: 401 402Message: ${e.message}`;e.reason&&(t+=` 403Reason: ${e.reason}`),ea(t),this._isDeviceLost=!0}_renderBundle(e,t,r){let{bundleGroup:i,camera:n,renderList:a}=e,s=this._currentRenderContext,o=this._bundles.get(i,n),l=this.backend.get(o);void 0===l.renderContexts&&(l.renderContexts=new Set);let u=i.version!==l.version,h=!1===l.renderContexts.has(s)||u;if(l.renderContexts.add(s),h){this.backend.beginBundle(s),(void 0===l.renderObjects||u)&&(l.renderObjects=[]),this._currentRenderBundle=o;let{transparentDoublePass:e,transparent:h,opaque:d}=a;!0===this.opaque&&d.length>0&&this._renderObjects(d,n,t,r),!0===this.transparent&&h.length>0&&this._renderTransparents(h,e,n,t,r),this._currentRenderBundle=null,this.backend.finishBundle(s,o),l.ver
403sion=i.version}else{let{renderObjects:e}=l;for(let t=0,r=e.length;t<r;t++){let r=e[t];this._nodes.needsRefresh(r)&&(this._nodes.updateBefore(r),this._nodes.updateForRender(r),this._bindings.updateForRender(r),this._nodes.updateAfter(r))}}this.backend.addBundle(s,o)}render(e,t){if(!1===this._initialized)throw Error('Renderer: .render() called before the backend is initialized. Use "await renderer.init();" before rendering.');this._renderScene(e,t)}get initialized(){return this._initialized}_getFrameBufferTarget(){let{currentToneMapping:e,currentColorSpace:t}=this,r=t!==eN.workingColorSpace;if(!1==(0!==e)&&!1===r)return null;let{width:i,height:n}=this.getDrawingBufferSize(RF),{depth:a,stencil:s}=this,o=this._frameBufferTarget;null===o&&((o=new eV(i,n,{depthBuffer:a,stencilBuffer:s,type:this._outputBufferType,format:1023,colorSpace:eN.workingColorSpace,generateMipmaps:!1,minFilter:1006,magFilter:1006,samples:this.samples})).isPostProcessingRenderTarget=!0,this._frameBufferTarget=o);let l=this.getOutputRenderTarget();o.depthBuffer=a,o.stencilBuffer=s,null!==l?o.setSize(l.width,l.height,l.depth):o.setSize(i,n,1);let u=this._canvasTarget;return o.viewport.copy(u._viewport),o.scissor.copy(u._scissor),o.viewport.multiplyScalar(u._pixelRatio),o.scissor.multiplyScalar(u._pixelRatio),o.scissorTest=u._scissorTest,o.multiview=null!==l&&l.multiview,o.resolveDepthBuffer=null===l||l.resolveDepthBuffer,o._autoAllocateDepthBuffer=null!==l&&l._autoAllocateDepthBuffer,o}_renderScene(e,t,r=!0){let i;if(!0===this._isDeviceLost)return;let n=r?this._getFrameBufferTarget():null,a=this._nodes.nodeFrame,s=a.renderId,o=this._currentRenderContext,l=this._currentRenderObjectFunction,u=this._handleObjectFunction;this._callDepth++;let h=!0===e.isScene?e:RP,d=this._renderTarget||this._outputRenderTarget,c=this._activeCubeFace,p=this._activeMipmapLevel;null!==n?(i=n,this.setRenderTarget(i)):i=d;let f=this._renderContexts.get(i,this._mrt,this._callDepth);this._currentRenderContext=f,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,a.renderId=this.info.calls,this.backend.updateTimeStampUID(f),this.inspector.beginRender(this.backend.getTimestampUID(f),e,t,i);let m=this.xr;if(!1===m.isPresenting){let e=!1;if(!0===this.reversedDepthBuffer&&!0!==t.reversedDepth){if(t._reversedDepth=!0,t.isArrayCamera)for(let e of t.cameras)e._reversedDepth=!0;e=!0}let r=this.coordinateSystem;if(t.coordinateSystem!==r){if(t.coordinateSystem=r,t.isArrayCamera)for(let e of t.cameras)e.coordinateSystem=r;e=!0}if(!0===e&&(t.updateProjectionMatrix(),t.isArrayCamera))for(let e of t.cameras)e.updateProjectionMatrix()}!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===m.enabled&&!0===m.isPresenting&&(!0===m.cameraAutoUpdate&&m.updateCamera(t),t=m.getCamera());let g=this._canvasTarget,v=g._viewport,y=g._scissor,_=g._pixelRatio;null!==i&&(v=i.viewport,y=i.scissor,_=1),this.getDrawingBufferSize(RF),RD.set(0,0,RF.width,RF.height);let x=void 0===v.minDepth?0:v.minDepth,b=void 0===v.maxDepth?1:v.maxDepth;f.viewportValue.copy(v).multiplyScalar(_).floor(),f.viewportValue.width>>=p,f.viewportValue.height>>=p,f.viewportValue.minDepth=x,f.viewportValue.maxDepth=b,f.viewport=!1===f.viewportValue.equals(RD),f.scissorValue.copy(y).multiplyScalar(_).floor(),f.scissor=g._scissorTest&&!1===f.scissorValue.equals(RD),f.scissorValue.width>>=p,f.scissorValue.height>>=p,f.clippingContext||(f.clippingContext=new Rm),f.clippingContext.updateGlobal(h,t),h.onBeforeRender(this,e,t,i);let S=t.isArrayCamera?RO:RU;t.isArrayCamera||(RG.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),S.setFromProjectionMatrix(RG,t.coordinateSystem,t.reversedDepth));let T=this._renderLists.get(e,t);if(T.begin(),this._projectObject(e,t,0,T,f.clippingContext),T.finish(),!0===this.sortObjects&&T.sort(this._opaqueSort,this._transparentSort),null!==i){this._textures.updateRenderTarget(i,p);let e=this._textures.get(i);f.textures=e.textures,f.depthTexture=e.depthTexture,f.width=e.width,f.height=e.height,f.renderTarget=i,f.depth=i.depthBuffer,f.stencil=i.stencilBuffer}else f.textures=null,f.depthTexture=null,f.width=RF.width,f.height=RF.height,f.depth=this.depth,f.stencil=this.stencil;f.width>>=p,f.height>>=p,f.activeCubeFace=c,f.activeMipmapLevel=p,f.occlusionQueryCount=T.occlusionQueryCount,f.scissorValue.max(Rk.set(0,0,0,0)),f.scissorValue.x+f.scissorValue.width>f.width&&(f.scissorValue.width=Math.max(f.width-f.scissorValue.x,0)),f.scissorValue.y+f.scissorValue.height>f.height&&(f.scissorValue.height=Math.max(f.height-f.scissorValue.y,0)),this._background.update(h,T,f),f.camera=t,this.backend.beginRender(f);let{bundles:A,lightsNode:M,transparentDoublePass:E,transparent:C,opaque:w}=T;return A.length>0&&this._renderBundles(A,h,M),!0===this.opaque&&w.length>0&&this._renderObjects(w,t,h,M),!0===this.transparent&&C.length>0&&this._renderTransparents(C,E,t,h,M),this.backend.finishRender(f),a.renderId=s,this._currentRenderContext=o,this._currentRenderObjectFunction=l,this._handleObjectFunction=u,this._callDepth--,null!==n&&(this.setRenderTarget(d,c,p),this._renderOutput(i)),h.onAfterRender(this,e,t,i),this.inspector.finishRender(this.backend.getTimestampUID(f)),f}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){let t=this._quad;this._nodes.hasOutputChange(e.texture)&&(t.material.fragmentNode=this._nodes.getOutputNode(e.texture),t.material.needsUpdate=!0);let r=this.autoClear,i=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderScene(t,t.camera,!1),this.autoClear=r,this.xr.enabled=i}getMaxAnisotropy(){return this.backend.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){!1===this._initialized&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e){return await this.backend.getArrayBufferAsync(e)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,r){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,r)}setSize(e,t,r=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,r)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}
403setScissor(e,t,r,i){this._canvasTarget.setScissor(e,t,r,i)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,r,i,n=0,a=1){this._canvasTarget.setViewport(e,t,r,i,n,a)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return!0===this.reversedDepthBuffer?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){let t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,r=!0){if(!1===this._initialized)throw Error('Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before before using this method.');let i=this._renderTarget||this._getFrameBufferTarget(),n=null;if(null!==i){this._textures.updateRenderTarget(i);let e=this._textures.get(i);(n=this._renderContexts.get(i)).textures=e.textures,n.depthTexture=e.depthTexture,n.width=e.width,n.height=e.height,n.renderTarget=i,n.depth=i.depthBuffer,n.stencil=i.stencilBuffer;let t=this.backend.getClearColor();n.clearColorValue.r=t.r,n.clearColorValue.g=t.g,n.clearColorValue.b=t.b,n.clearColorValue.a=t.a,n.clearDepthValue=this.getClearDepth(),n.clearStencilValue=this.getClearStencil(),n.activeCubeFace=this.getActiveCubeFace(),n.activeMipmapLevel=this.getActiveMipmapLevel()}this.backend.clear(e,t,r,n),null!==i&&null===this._renderTarget&&this._renderOutput(i)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,r=!0){es('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,r)}async clearColorAsync(){es('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){es('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){es('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){let e=0!==this.currentToneMapping,t=this.currentColorSpace!==eN.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return null!==this._renderTarget?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:0}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:eN.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||null===this._renderTarget}dispose(){!0===this._initialized&&(this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose(),null!==this._frameBufferTarget&&this._frameBufferTarget.dispose(),Object.values(this.backend.timestampQueryPool).forEach(e=>{null!==e&&e.dispose()})),this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,r=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=r}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}
403_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null),this._frameBufferTarget.dispose(),this._frameBufferTarget=null}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(!0===this._isDeviceLost)return;if(!1===this._initialized)return en("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);let r=this._nodes.nodeFrame,i=r.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,r.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);let n=this.backend,a=this._pipelines,s=this._bindings,o=this._nodes,l=Array.isArray(e)?e:[e];if(void 0===l[0]||!0!==l[0].isComputeNode)throw Error("THREE.Renderer: .compute() expects a ComputeNode.");for(let r of(n.beginCompute(e),l)){if(!1===a.has(r)){let e=()=>{r.removeEventListener("dispose",e),a.delete(r),s.deleteForCompute(r),o.delete(r)};r.addEventListener("dispose",e);let t=r.onInitFunction;null!==t&&t.call(r,{renderer:this})}o.updateForCompute(r),s.updateForCompute(r);let i=s.getForCompute(r),l=a.getForCompute(r,i);n.compute(e,r,i,l,t)}n.finishCompute(e),r.renderId=i,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){!1===this._initialized&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return es('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return!1===this._initialized&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(!1===this._initialized)throw Error('Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){es('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(!1===this._initialized)throw Error('Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(!1===this._initialized)throw Error('Renderer: .initRenderTarget() called before the backend is initialized. Use "await renderer.init();" before before using this method.');this._textures.updateRenderTarget(e);let t=this._textures.get(e),r=this._renderContexts.get(e);r.textures=t.textures,r.depthTexture=t.depthTexture,r.width=t.width,r.height=t.height,r.renderTarget=e,r.depth=e.depthBuffer,r.stencil=e.stencilBuffer,this.backend.initRenderTarget(r)}copyFramebufferToTexture(e,t=null){let r;if(null!==t)if(t.isVector2)t=Rk.set(t.x,t.y,e.image.width,e.image.height).floor();else{if(!t.isVector4)return void ea("Renderer.copyFramebufferToTexture: Invalid rectangle.");t=Rk.copy(t).floor()}else t=Rk.set(0,0,e.image.width,e.image.height);let i=this._currentRenderContext;null!==i?r=i.renderTarget:null!==(r=this._renderTarget||this._getFrameBufferTarget())&&(this._textures.updateRenderTarget(r),i=this._textures.get(r)),this._textures.updateTexture(e,{renderTarget:r}),this.backend.copyFramebufferToTexture(e,i,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,r=null,i=null,n=0,a=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,r,i,n,a),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,r,i,n,a=0,s=0){return this.backend.copyTextureToBuffer(e.textures[a],t,r,i,n,s)}_projectObject(e,t,r,i,n){if(!1===e.visible)return;if(e.layers.test(t.layers)){if(e.isGroup)r=e.renderOrder,e.isClippingGroup&&e.enabled&&(n=n.getGroupContext(e));else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)i.pushLight(e);else if(e.isSprite){let a=t.isArrayCamera?RO:RU;if(!e.frustumCulled||a.intersectsSprite(e,t)){!0===this.sortObjects&&Rk.setFromMatrixPosition(e.matrixWorld).applyMatrix4(RG);let{geometry:t,material:a}=e;a.visible&&i.push(e,t,a,r,Rk.z,null,n)}}else if(e.isLineLoop)ea("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){let a=t.isArrayCamera?RO:RU;if(!e.frustumCulled||a.intersectsObject(e,t)){let{geometry:t,material:a}=e;if(!0===this.sortObjects&&(null===t.boundingSphere&&t.computeBoundingSphere(),Rk.copy(t.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(RG)),Array.isArray(a)){let s=t.groups;for(let o=0,l=s.length;o<l;o++){let l=s[o],u=a[l.materialIndex];u&&u.visible&&i.push(e,t,u,r,Rk.z,l,n)}}else a.visible&&i.push(e,t,a,r,Rk.z,null,n)}}}if(!0===e.isBundleGroup&&void 0!==this.backend.beginBundle){let r=i;(i=this._renderLists.get(e,t)).begin(),r.pushBundle({bundleGroup:e,camera:t,renderList:i}),i.finish()}let a=e.children;for(let e=0,s=a.length;e<s;e++)this._projectObject(a[e],t,r,i,n)}_renderBundles(e,t,r){for(let i of e)this._renderBundle(i,t,r)}_renderTransparents(e,t,r,i,n){if(t.length>0){for(let{material:e}of t)e.side=1;for(let{material:e}of(this._renderObjects(t,r,i,n,"backSide"),t))e.side=0;for(let{material:a}of(this._renderObjects(e,r,i,n),t))a.side=2}else this._renderObjects(e,r,i,n)}_renderObjects(e,t,r,i,n=null){for(let a=0,s=e.length;a<s;a++){let{object:s,geometry:o,material:l,group:u,clippingContext:h}=e[a];this._currentRenderObjectFunction(s,r,t,o,l,u,i,h,n)}}_getShadowNodes(e){let t=e.version,r=this._cacheShadowNodes.get(e);if(void 0===r||r.version!==t){let i=null!==e.map,n=e.colorNode&&e.colorNode.isNode,a=e.castShadowNode&&e.castShadowNode.isNode,s=e.maskShadowNode&&e.maskShadowNode.isNode||e.maskNode&&e.maskNode.isNode,o=null,l=null,u=null;if(i||n||a||s){let t,r;if(a?(t=e.castShadowNode.rgb,r=e.castShadowNode.a,!0!==this.shadowMap.transmitted&&es("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(t=pO(0),r=pN(1)),i&&(r=r.mul(yq("map","texture",e).a)),n&&(r=r.mul(e.colorNode.a)),l=pz(t,r),s){let t=e.maskShadowNode||e.maskNode;l=pA(([e])=>(t.not().discard(),e))(l)}}e.depthNode&&e.depthNode.isNode&&(u=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?o=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(o=e.positionNode),r={version:t,colorNode:l,depthNode:u,positionNode:o},this._cacheShadowNodes.set(e,r)}return r}renderObject(e,t,r,i,n,a,s,o=null,l=null){let u,h,d,c,p=!1;if(e.onBeforeRender(this,t,r,i,n,a),!0===n.allowOverride&&null!==t.overrideMaterial){let e=t.overrideMaterial;if(p=!0,u=e.isNodeMaterial?e.colorNode:null,h=e.isNodeMaterial?e.depthNode:null,d=e.isNodeMaterial?e.positionNode:null,c=t.overrideMaterial.side,n.positionNode&&n.positionNode.isNode&&(e.positionNode=n.positionNode),e.alphaTest=n.alphaTest,e.alphaMap=n.alphaMap,e.transparent=n.transparent||n.transmission>0||n.transmissionNode&&n.transmissionNode.isNode||n.backdropNode&&n.backdropNode.isNode,e.isShadowPassMaterial){let{c
403olorNode:t,depthNode:r,positionNode:i}=this._getShadowNodes(n);3===this.shadowMap.type?e.side=null!==n.shadowSide?n.shadowSide:n.side:e.side=null!==n.shadowSide?n.shadowSide:RV[n.side],null!==t&&(e.colorNode=t),null!==r&&(e.depthNode=r),null!==i&&(e.positionNode=i)}n=e}!0===n.transparent&&2===n.side&&!1===n.forceSinglePass?(n.side=1,this._handleObjectFunction(e,n,t,r,s,a,o,"backSide"),n.side=0,this._handleObjectFunction(e,n,t,r,s,a,o,l),n.side=2):this._handleObjectFunction(e,n,t,r,s,a,o,l),p&&(t.overrideMaterial.colorNode=u,t.overrideMaterial.depthNode=h,t.overrideMaterial.positionNode=d,t.overrideMaterial.side=c),e.onAfterRender(this,t,r,i,n,a)}hasCompatibility(e){return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,r,i,n,a,s,o){let l=this._objects.get(e,t,r,i,n,this._currentRenderContext,s,o);l.drawRange=e.geometry.drawRange,l.group=a,null!==this._currentRenderBundle&&(this.backend.get(this._currentRenderBundle).renderObjects.push(l),l.bundle=this._currentRenderBundle.bundleGroup);let u=this._nodes.needsRefresh(l);u&&(this._nodes.updateBefore(l),this._geometries.updateForRender(l),this._nodes.updateForRender(l),this._bindings.updateForRender(l)),this._pipelines.updateForRender(l),this.backend.draw(l,this.info),u&&this._nodes.updateAfter(l)}_createObjectPipeline(e,t,r,i,n,a,s,o){let l=this._objects.get(e,t,r,i,n,this._currentRenderContext,s,o);l.drawRange=e.geometry.drawRange,l.group=a,this._nodes.updateBefore(l),this._geometries.updateForRender(l),this._nodes.updateForRender(l),this._bindings.updateForRender(l),this._pipelines.getForRender(l,this._compilationPromises),this._nodes.updateAfter(l)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}}class RH{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}}class RW extends RH{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){var e;return(e=this._buffer.byteLength)+(16-e%16)%16}get buffer(){return this._buffer}update(){return!0}}class Rj extends RW{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}}let RX=0;class Rq extends Rj{constructor(e,t){super("UniformBuffer_"+RX++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get buffer(){return this.nodeUniform.value}}class R$ extends Rj{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map}addUniformUpdateRange(e){let t=e.index;if(!0!==this._updateRangeCache.has(t)){let r=this.updateRanges,i={start:e.offset,count:e.itemSize};r.push(i),this._updateRangeCache.set(t,i)}}clearUpdateRanges(){this._updateRangeCache.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){let t=this.uniforms.indexOf(e);return -1!==t&&this.uniforms.splice(t,1),this}get values(){return null===this._values&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;return null===e&&(e=new Float32Array(new ArrayBuffer(this.byteLength)),this._buffer=e),e}get byteLength(){let e=this.bytesPerElement,t=0;for(let r=0,i=this.uniforms.length;r<i;r++){let i=this.uniforms[r],n=i.boundary,a=i.itemSize*e,s=t%16,o=s%n,l=s+o;t+=o,0!==l&&16-l<a&&(t+=16-l),i.offset=t/e,i.index=r,t+=a}return 16*Math.ceil(t/16)}update(){let e=!1;for(let t of this.uniforms)!0===this.updateByType(t)&&(e=!0);return e}updateByType(e){return e.isNumberUniform?this.updateNumber(e):e.isVector2Uniform?this.updateVector2(e):e.isVector3Uniform?this.updateVector3(e):e.isVector4Uniform?this.updateVector4(e):e.isColorUniform?this.updateColor(e):e.isMatrix3Uniform?this.updateMatrix3(e):e.isMatrix4Uniform?this.updateMatrix4(e):void ea("WebGPUUniformsGroup: Unsupported uniform type.",e)}updateNumber(e){let t=!1,r=this.values,i=e.getValue(),n=e.offset,a=e.getType();return r[n]!==i&&(this._getBufferForType(a)[n]=r[n]=i,t=!0,this.addUniformUpdateRange(e)),t}updateVector2(e){let t=!1,r=this.values,i=e.getValue(),n=e.offset,a=e.getType();if(r[n+0]!==i.x||r[n+1]!==i.y){let s=this._getBufferForType(a);s[n+0]=r[n+0]=i.x,s[n+1]=r[n+1]=i.y,t=!0,this.addUniformUpdateRange(e)}return t}updateVector3(e){let t=!1,r=this.values,i=e.getValue(),n=e.offset,a=e.getType();if(r[n+0]!==i.x||r[n+1]!==i.y||r[n+2]!==i.z){let s=this._getBufferForType(a);s[n+0]=r[n+0]=i.x,s[n+1]=r[n+1]=i.y,s[n+2]=r[n+2]=i.z,t=!0,this.addUniformUpdateRange(e)}return t}updateVector4(e){let t=!1,r=this.values,i=e.getValue(),n=e.offset,a=e.getType();if(r[n+0]!==i.x||r[n+1]!==i.y||r[n+2]!==i.z||r[n+4]!==i.w){let s=this._getBufferForType(a);s[n+0]=r[n+0]=i.x,s[n+1]=r[n+1]=i.y,s[n+2]=r[n+2]=i.z,s[n+3]=r[n+3]=i.w,t=!0,this.addUniformUpdateRange(e)}return t}updateColor(e){let t=!1,r=this.values,i=e.getValue(),n=e.offset;if(r[n+0]!==i.r||r[n+1]!==i.g||r[n+2]!==i.b){let a=this.buffer;a[n+0]=r[n+0]=i.r,a[n+1]=r[n+1]=i.g,a[n+2]=r[n+2]=i.b,t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix3(e){let t=!1,r=this.values,i=e.getValue().elements,n=e.offset;if(r[n+0]!==i[0]||r[n+1]!==i[1]||r[n+2]!==i[2]||r[n+4]!==i[3]||r[n+5]!==i[4]||r[n+6]!==i[5
403]||r[n+8]!==i[6]||r[n+9]!==i[7]||r[n+10]!==i[8]){let a=this.buffer;a[n+0]=r[n+0]=i[0],a[n+1]=r[n+1]=i[1],a[n+2]=r[n+2]=i[2],a[n+4]=r[n+4]=i[3],a[n+5]=r[n+5]=i[4],a[n+6]=r[n+6]=i[5],a[n+8]=r[n+8]=i[6],a[n+9]=r[n+9]=i[7],a[n+10]=r[n+10]=i[8],t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix4(e){let t=!1,r=this.values,i=e.getValue().elements,n=e.offset;return!1===function(e,t,r){for(let i=0,n=t.length;i<n;i++)if(e[r+i]!==t[i])return!1;return!0}(r,i,n)&&(this.buffer.set(i,n),function(e,t,r){for(let i=0,n=t.length;i<n;i++)e[r+i]=t[i]}(r,i,n),t=!0,this.addUniformUpdateRange(e)),t}_getBufferForType(e){return"int"===e||"ivec2"===e||"ivec3"===e||"ivec4"===e?new Int32Array(this.buffer.buffer):"uint"===e||"uvec2"===e||"uvec3"===e||"uvec4"===e?new Uint32Array(this.buffer.buffer):this.buffer}}let RJ=0;class RK extends R${constructor(e,t){super(e),this.id=RJ++,this.groupNode=t,this.isNodeUniformsGroup=!0}}class RY extends RH{constructor(e,t){super(e),this._texture=null,this._onTextureDispose=()=>{this.generation=null,this.version=-1},this.texture=t,this.version=t?t.version:-1,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture&&this._texture.removeEventListener("dispose",this._onTextureDispose),this._texture=e,this.generation=null,this.version=-1,this._texture&&this._texture.addEventListener("dispose",this._onTextureDispose))}get texture(){return this._texture}update(){let{texture:e,version:t}=this;return t!==e.version&&(this.version=e.version,!0)}clone(){let e=super.clone();return e._texture=null,e._onTextureDispose=()=>{e.generation=null,e.version=-1},e.texture=this.texture,e}}let RQ=0;class RZ extends RY{constructor(e,t){super(e,t),this.id=RQ++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}}class R0 extends RZ{constructor(e,t,r,i=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=r,this.access=i}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}}class R1 extends R0{constructor(e,t,r,i=null){super(e,t,r,i),this.isSampledCubeTexture=!0}}class R2 extends R0{constructor(e,t,r,i=null){super(e,t,r,i),this.isSampledTexture3D=!0}}let R3={bitcast_int_uint:new M0("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new M0("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }")},R4={textureDimensions:"textureSize",equals:"equal",bitcast_float_int:"floatBitsToInt",bitcast_int_float:"intBitsToFloat",bitcast_uint_float:"uintBitsToFloat",bitcast_float_uint:"floatBitsToUint",bitcast_uint_int:"tsl_bitcast_uint_to_int",bitcast_int_uint:"tsl_bitcast_int_to_uint",floatpack_snorm_2x16:"packSnorm2x16",floatpack_unorm_2x16:"packUnorm2x16",floatpack_float16_2x16:"packHalf2x16",floatunpack_snorm_2x16:"unpackSnorm2x16",floatunpack_unorm_2x16:"unpackUnorm2x16",floatunpack_float16_2x16:"unpackHalf2x16"},R5={low:"lowp",medium:"mediump",high:"highp"},R8={swizzleAssign:!0,storageBuffer:!1},R6={perspective:"smooth",linear:"noperspective"},R9={centroid:"centroid"},R7=` 404precision highp float; 405precision highp int; 406precision highp sampler2D; 407precision highp sampler3D; 408precision highp samplerCube; 409precision highp sampler2DArray; 410 411precision highp usampler2D; 412precision highp usampler3D; 413precision highp usamplerCube; 414precision highp usampler2DArray; 415 416precision highp isampler2D; 417precision highp isampler3D; 418precision highp isamplerCube; 419precision highp isampler2DArray; 420 421precision highp sampler2DShadow; 422precision highp sampler2DArrayShadow; 423precision highp samplerCubeShadow; 424`;class Ne extends wQ{constructor(e,t){super(e,t,new Ru),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return!0===e.isVideoTexture&&""!==e.colorSpace}_include(e){let t=R3[e];return t.build(this),this.addInclude(t),t}getMethod(e){return void 0!==R3[e]&&this._include(e),R4[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,r){return`${e} ? ${t} : ${r}`}getOutputStructName(){return""}buildFunctionCode(e){let t=e.layout,r=this.flowShaderNode(e),i=[];
424for(let e of t.inputs)i.push(this.getType(e.type)+" "+e.name);return`${this.getType(t.type)} ${t.name}( ${i.join(", ")} ) { 425 426 ${r.vars} 427 428${r.code} 429 return ${r.result}; 430 431}`}setupPBO(e){let t=e.value;if(void 0===t.pbo){let e=t.array,r=t.count*t.itemSize,{itemSize:i}=t,n=t.array.constructor.name.toLowerCase().includes("int"),a=n?1029:1028;2===i?a=n?1031:1030:3===i?a=n?1032:1022:4===i&&(a=n?1033:1023);let s=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(r/i)))),o=Math.ceil(r/i/s);s*o*i<r&&o++;let l=s*o*i,u=new e.constructor(l);u.set(e,0),t.array=u;let h=new ih(t.array,s,o,a,{Float32Array:1015,Uint8Array:1009,Uint16Array:1012,Uint32Array:1014,Int8Array:1010,Int16Array:1011,Int32Array:1013,Uint8ClampedArray:1009}[t.array.constructor.name]||1015);h.needsUpdate=!0,h.isPBOTexture=!0;let d=new va(h,null,null);d.setPrecision("high"),t.pboNode=d,t.pbo=d.value,this.getUniformFromNode(t.pboNode,"texture",this.shaderStage,this.context.nodeName)}}getPropertyName(e,t=this.shaderStage){return e.isNodeUniform&&!0!==e.node.isTextureNode&&!0!==e.node.isBufferNode?e.name:super.getPropertyName(e,t)}generatePBO(e){let{node:t,indexNode:r}=e,i=t.value;this.renderer.backend.has(i)&&(this.renderer.backend.get(i).pbo=i.pbo);let n=this.getUniformFromNode(i.pboNode,"texture",this.shaderStage,this.context.nodeName),a=this.getPropertyName(n);this.increaseUsage(r);let s=r.build(this,"uint"),o=this.getDataFromNode(e),l=o.propertyName;if(void 0===l){let r=this.getVarFromNode(e);l=this.getPropertyName(r);let n=this.getDataFromNode(t),u=n.propertySizeName;void 0===u&&(u=l+"Size",this.getVarFromNode(t,u,"uint"),this.addLineFlowCode(`${u} = uint( textureSize( ${a}, 0 ).x )`,e),n.propertySizeName=u);let{itemSize:h}=i,d="."+cF.join("").slice(0,h),c=`ivec2(${s} % ${u}, ${s} / ${u})`,p=this.generateTextureLoad(null,a,c,"0",null,null),f="vec4";1014===i.pbo.type?f="uvec4":1013===i.pbo.type&&(f="ivec4"),this.addLineFlowCode(`${l} = ${f}(${p})${d}`,e),o.propertyName=l}return l}generateTextureLoad(e,t,r,i,n,a){let s;return null===i&&(i="0"),s=n?a?`texelFetchOffset( ${t}, ivec3( ${r}, ${n} ), ${i}, ${a} )`:`texelFetch( ${t}, ivec3( ${r}, ${n} ), ${i} )`:a?`texelFetchOffset( ${t}, ${r}, ${i}, ${a} )`:`texelFetch( ${t}, ${r}, ${i} )`,null!==e&&e.isDepthTexture&&(s+=".x"),s}generateTexture(e,t,r,i,n){return(i&&(r=`vec3( ${r}, ${i} )`),e.isDepthTexture)?n?`textureOffset( ${t}, ${r}, ${n} ).x`:`texture( ${t}, ${r} ).x`:n?`textureOffset( ${t}, ${r}, ${n} )`:`texture( ${t}, ${r} )`}generateTextureLevel(e,t,r,i,n,a){return(n&&(r=`vec3( ${r}, ${n} )`),a)?`textureLodOffset( ${t}, ${r}, ${i}, ${a} )`:`textureLod( ${t}, ${r}, ${i} )`}generateTextureBias(e,t,r,i,n,a){return(n&&(r=`vec3( ${r}, ${n} )`),a)?`textureOffset( ${t}, ${r}, ${a}, ${i} )`:`texture( ${t}, ${r}, ${i} )`}generateTextureGrad(e,t,r,i,n,a){return(n&&(r=`vec3( ${r}, ${n} )`),a)?`textureGradOffset( ${t}, ${r}, ${i[0]}, ${i[1]}, ${a} )`:`textureGrad( ${t}, ${r}, ${i[0]}, ${i[1]} )`}generateTextureCompare(e,t,r,i,n,a,s=this.shaderStage){if("fragment"===s)return e.isCubeTexture?`texture( ${t}, vec4( ${r}, ${i} ) )`:n?a?`textureOffset( ${t}, vec4( ${r}, ${n}, ${i} ), ${a} )`:`texture( ${t}, vec4( ${r}, ${n}, ${i} ) )`:a?`textureOffset( ${t}, vec3( ${r}, ${i} ), ${a} )`:`texture( ${t}, vec3( ${r}, ${i} ) )`;ea(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${s} shader.`)}getVars(e){let t=[],r=this.vars[e];if(void 0!==r)for(let e of r)t.push(`${this.getVar(e.type,e.name,e.count)};`);return t.join("\n ")}getUniforms(e){let t=this.uniforms[e],r=[],i={};for(let e of t){let t=null,n=!1;if("texture"===e.type||"texture3D"===e.type){let r=e.node.value,i="";(!0===r.isDataTexture||!0===r.isData3DTexture)&&(1014===r.type?i="u":1013===r.type&&(i="i")),t="texture3D"===e.type&&!1===r.isArrayTexture?`${i}sampler3D ${e.name};`:r.compareFunction?!0===r.isArrayTexture?`sampler2DArrayShadow ${e.name};`:`sampler2DShadow ${e.name};`:!0===r.isArrayTexture||!0===r.isDataArrayTexture||!0===r.isCompressedArrayTexture?`${i}sampler2DArray ${e.name};`:`${i}sampler2D ${e.name};`}else if("cubeTexture"===e.type)t=`samplerCube ${e.name};`;else if("cubeDepthTexture"===e.type)t=e.node.value.compareFunction?`samplerCubeShadow ${e.name};`:`samplerCube ${e.name};`;else if("buffer"===e.type){let r=e.node,i=this.getType(r.bufferType),n=r.bufferCount,a=n>0?n:"";t=`${r.name} { 432 ${i} ${e.name}[${a}]; 433}; 434`}else{let t=e.groupNode.name;if(void 0===i[t]){let e=this.uniformGroups[t];if(void 0!==e){let r=[];for(let t of e.uniforms){let e=t.getType(),i=this.getVectorType(e),n=t.nodeUniform.node.precision,a=`${i} ${t.name};`;null!==n&&(a=R5[n]+" "+a),r.push(" "+a)}i[t]=r}}n=!0}
434if(!n){let i=e.node.precision;null!==i&&(t=R5[i]+" "+t),t="uniform "+t,r.push(t)}}let n="";for(let e in i){let t=i[e];n+=this._getGLSLUniformStruct(e,t.join("\n"))+"\n"}return n+r.join("\n")}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&1013!==e.gpuType){let r=e;e.isInterleavedBufferAttribute&&(r=e.data);let i=r.array;!1==(i instanceof Uint32Array||i instanceof Int32Array)&&(t=t.slice(1))}return t}getAttributes(e){let t="";if("vertex"===e||"compute"===e){let e=this.getAttributesArray(),r=0;for(let i of e)t+=`layout( location = ${r++} ) in ${i.type} ${i.name}; 435`}return t}getStructMembers(e){let t=[];for(let r of e.members)t.push(` ${r.type} ${r.name};`);return t.join("\n")}getStructs(e){let t=[],r=this.structs[e],i=[];for(let e of r)if(e.output)for(let t of e.members)i.push(`layout( location = ${t.index} ) out ${t.type} ${t.name};`);else{let r="struct "+e.name+" {\n";r+=this.getStructMembers(e),r+="\n};\n",t.push(r)}return 0===i.length&&i.push("layout( location = 0 ) out vec4 fragColor;"),"\n"+i.join("\n")+"\n\n"+t.join("\n")}getVaryings(e){let t="",r=this.varyings;if("vertex"===e||"compute"===e)for(let i of r){"compute"===e&&(i.needsInterpolation=!0);let r=this.getType(i.type);if(i.needsInterpolation)if(i.interpolationType){let e=R6[i.interpolationType]||i.interpolationType,n=R9[i.interpolationSampling]||"";t+=`${e} ${n} out ${r} ${i.name}; 436`}else{let e=r.includes("int")||r.includes("uv")||r.includes("iv")?"flat ":"";t+=`${e}out ${r} ${i.name}; 437`}else t+=`${r} ${i.name}; 438`}else if("fragment"===e){for(let e of r)if(e.needsInterpolation){let r=this.getType(e.type);if(e.interpolationType){let i=R6[e.interpolationType]||e.interpolationType,n=R9[e.interpolationSampling]||"";t+=`${i} ${n} in ${r} ${e.name}; 439`}else{let i=r.includes("int")||r.includes("uv")||r.includes("iv")?"flat ":"";t+=`${i}in ${r} ${e.name}; 440`}}}for(let r of this.builtins[e])t+=`${r}; 441`;return t}getVertexIndex(){return"uint( gl_VertexID )"}getInstanceIndex(){return"uint( gl_InstanceID )"}getInvocationLocalIndex(){let e=this.object.workgroupSize.reduce((e,t)=>e*t,1);return`uint( gl_InstanceID ) % ${e}u`}getSubgroupSize(){ea("GLSLNodeBuilder: WebGLBackend does not support the subgroupSize node")}getInvocationSubgroupIndex(){ea("GLSLNodeBuilder: WebGLBackend does not support the invocationSubgroupIndex node")}getSubgroupIndex(){ea("GLSLNodeBuilder: WebGLBackend does not support the subgroupIndex node")}getDrawIndex(){return this.renderer.backend.extensions.has("WEBGL_multi_draw")?"uint( gl_DrawID )":null}getFrontFacing(){return"gl_FrontFacing"}getFragCoord(){return"gl_FragCoord.xy"}getFragDepth(){return"gl_FragDepth"}enableExtension(e,t,r=this.shaderStage){let i=this.extensions[r]||(this.extensions[r]=new Map);!1===i.has(e)&&i.set(e,{name:e,behavior:t})}getExtensions(e){let t=[];if("vertex"===e){let t=this.renderer.backend.extensions;this.object.isBatchedMesh&&t.has("WEBGL_multi_draw")&&this.enableExtension("GL_ANGLE_multi_draw","require",e)}let r=this.extensions[e];if(void 0!==r)for(let{name:e,behavior:i}of r.values())t.push(`#extension ${e} : ${i}`);return t.join("\n")}getClipDistance(){return"gl_ClipDistance"}isAvailable(e){let t=R8[e];if(void 0===t){let r;switch(t=!1,e){case"float32Filterable":r="OES_texture_float_linear";break;case"clipDistance":r="WEBGL_clip_cull_distance"}if(void 0!==r){let e=this.renderer.backend.extensions;e.has(r)&&(e.get(r),t=!0)}R8[e]=t}return t}isFlipY(){return!0}getUniformBufferLimit(){let e=this.renderer.backend.gl;return e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE)}enableHardwareClipping(e){this.enableExtension("GL_ANGLE_clip_cull_distance","require"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}
441enableMultiview(){this.enableExtension("GL_OVR_multiview2","require","fragment"),this.enableExtension("GL_OVR_multiview2","require","vertex"),this.builtins.vertex.push("layout(num_views = 2) in")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){let e=this.transforms,t="";for(let r=0;r<e.length;r++){let i=e[r],n=this.getPropertyName(i.attributeNode);n&&(t+=`${i.varyingName} = ${n}; 442 `)}return t}_getGLSLUniformStruct(e,t){return` 443layout( std140 ) uniform ${e} { 444${t} 445};`}_getGLSLVertexCode(e){return`#version 300 es 446 447${this.getSignature()} 448 449// extensions 450${e.extensions} 451 452// precision 453${R7} 454 455// uniforms 456${e.uniforms} 457 458// varyings 459${e.varyings} 460 461// attributes 462${e.attributes} 463 464// codes 465${e.codes} 466 467void main() { 468 469 // vars 470 ${e.vars} 471 472 // transforms 473 ${e.transforms} 474 475 // flow 476 ${e.flow} 477 478 gl_PointSize = 1.0; 479 480} 481`}_getGLSLFragmentCode(e){return`#version 300 es 482 483${this.getSignature()} 484 485// extensions 486${e.extensions} 487 488// precision 489${R7} 490 491// structs 492${e.structs} 493 494// uniforms 495${e.uniforms} 496 497// varyings 498${e.varyings} 499 500// codes 501${e.codes} 502 503void main() { 504 505 // vars 506 ${e.vars} 507 508 // flow 509 ${e.flow} 510 511} 512`}buildCode(){let e=null!==this.material?{fragment:{},vertex:{}}:{compute:{}};for(let t in this.sortBindingGroups(),e){let r="// code\n\n";r+=this.flowCode[t];let i=this.flowNodes[t],n=i[i.length-1];for(let e of i){let i=this.getFlowData(e),a=e.name;a&&(r.length>0&&(r+="\n"),r+=` // flow -> ${a} 513 `),r+=`${i.code} 514 `,e===n&&"compute"!==t&&(r+="// result\n ","vertex"===t?(r+="gl_Position = ",r+=`${i.result};`):"fragment"!==t||e.outputNode.isOutputStructNode||(r+="fragColor = ",r+=`${i.result};`))}let a=e[t];a.extensions=this.getExtensions(t),a.uniforms=this.getUniforms(t),a.attributes=this.getAttributes(t),a.varyings=this.getVaryings(t),a.vars=this.getVars(t),a.structs=this.getStructs(t),a.codes=this.getCodes(t),a.transforms=this.getTransforms(t),a.flow=r}null!==this.material?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,r,i=null){let n=super.getUniformFromNode(e,t,r,i),a=this.getDataFromNode(e,r,this.globalCache),s=a.uniformGPU;if(void 0===s){let i=e.groupNode,o=i.name,l=this.getBindGroupArray(o,r);if("texture"===t)s=new R0(n.name,n.node,i),l.push(s);else if("cubeTexture"===t||"cubeDepthTexture"===t)s=new R1(n.name,n.node,i),l.push(s);else if("texture3D"===t)s=new R2(n.name,n.node,i),l.push(s);else if("buffer"===t){n.name=`buffer${e.id}`;let t=this.getSharedDataFromNode(e),r=t.buffer;void 0===r&&(e.name=`NodeBuffer_${e.id}`,(r=new Rq(e,i)).name=e.name,t.buffer=r),l.push(r),s=r}else{let e=this.uniformGroups[o];void 0===e?(e=new RK(o,i),this.uniformGroups[o]=e,l.push(e)):-1===l.indexOf(e)&&l.push(e);let r=(s=this.getNodeUniform(n,t)).name;e.uniforms.some(e=>e.name===r)||e.addUniform(s)}a.uniformGPU=s}return n}}let Nt=null,Nr=null;class Ni{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[H.RENDER]:null,[H.COMPUTE]:null},this.trackTimestamp=!0===e.trackTimestamp}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){let t=this.get(e),r=this.renderer.info.frame;t.timestampUID=(!0===e.isComputeNode?"c:"+this.renderer.info.compute.frameCalls:"r:"+this.renderer.info.render.frameCalls)+":"+e.id+":f"+r}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){let t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){let t=e.startsWith("c:")?H.COMPUTE:H.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}hasTimestamp(e){return this._getQueryPool(e).hasTimestamp(e)}isOccluded(){}async resolveTimestampsAsync(e="render"){if(!this.trackTimestamp)return void es("WebGPURenderer: Timestamp tracking is disabled.");let t=this.timestampQueryPool[e];if(!t)return;let r=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=r,r}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getMaxAnisotropy(){}getDrawingBufferSize(){return Nt=Nt||new eb,this.renderer.getDrawingBufferSize(Nt)}setScissorTest(){}getClearColor(){let e=this.renderer;return Nr=Nr||new T8,e.getClearColor(Nr),Nr.getRGB(Nr),Nr}getDomElement(){let e=this.domElement;return null===e&&("setAttribute"in(e=void 0!==this.parameters.canvas?this.parameters.canvas:Y())&&e.setAttribute("data-engine","three.js r183 webgpu"),this.domElement=e),e}hasCompatibility(){return!1}initRenderTarget(){}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return void 0===t&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}deleteBindGroupData(){}dispose(){}}let Nn=0;class Na{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[1^this.activeBufferIndex]}switchBuffers(){this.activeBufferIndex^=1}}class Ns{constructor(e){this.backend=e}createAttribute(e,t){let r,i=this.backend,{gl:n}=i,a=e.array,s=e.usage||n.STATIC_DRAW,o=e.isInterleavedBufferAttribute?e.data:e,l=i.get(o),u=l.bufferGPU;if(void 0===u&&(l.bufferGPU=u=this._createBuffer(n,t,a,s),l.bufferType=t,l.version=o.version),a instanceof Float32Array)r=n.FLOAT;else if("u">typeof Float16Array&&a instanceof Float16Array)r=n.HALF_FLOAT;else if(a instanceof Uint16Array)r=e.isFloat16BufferAttribute?n.HALF_FLOAT:n.UNSIGNED_SHORT;else if(a instanceof Int16Array)r=n.SHORT;else if(a instanceof Uint32Array)r=n.UNSIGNED_INT;else if(a instanceof Int32Array)r=n.INT;else if(a instanceof Int8Array)r=n.BYTE;else if(a instanceof Uint8Array)r=n.UNSIGNED_BYTE;else if(a instanceof Uint8ClampedArray)r=n.UNSIGNED_BYTE;else throw Error("THREE.WebGLBackend: Unsupported buffer data format: "+a);let h={bufferGPU:u,bufferType:t,type:r,byteLength:a.byteLength,bytesPerElement:a.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:r===n.INT||r===n.UNSIGNED_INT||1013===e.gpuType,id:Nn++};(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(h=new Na(h,this._createBuffer(n,t,a,s))),i.set(e,h)}updateAttribute(e){let t=this.backend,{gl:r}=t,i=e.array,n=e.isInterleavedBufferAttribute?e.data:e,a=t.get(n),s=a.bufferType,o=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(r.bindBuffer(s,a.bufferGPU),0===o.length)r.bufferSubData(s,0,i);else{for(let e=0,t=o.length;e<t;
514e++){let t=o[e];r.bufferSubData(s,t.start*i.BYTES_PER_ELEMENT,i,t.start,t.count)}n.clearUpdateRanges()}r.bindBuffer(s,null),a.version=n.version}destroyAttribute(e){let t=this.backend,{gl:r}=t;e.isInterleavedBufferAttribute&&t.delete(e.data);let i=t.get(e);r.deleteBuffer(i.bufferGPU),t.delete(e)}async getArrayBufferAsync(e){let t=this.backend,{gl:r}=t,i=e.isInterleavedBufferAttribute?e.data:e,{bufferGPU:n}=t.get(i),a=e.array,s=a.byteLength;r.bindBuffer(r.COPY_READ_BUFFER,n);let o=r.createBuffer();r.bindBuffer(r.COPY_WRITE_BUFFER,o),r.bufferData(r.COPY_WRITE_BUFFER,s,r.STREAM_READ),r.copyBufferSubData(r.COPY_READ_BUFFER,r.COPY_WRITE_BUFFER,0,0,s),await t.utils._clientWaitAsync();let l=new e.array.constructor(a.length);return r.bindBuffer(r.COPY_WRITE_BUFFER,o),r.getBufferSubData(r.COPY_WRITE_BUFFER,0,l),r.deleteBuffer(o),r.bindBuffer(r.COPY_READ_BUFFER,null),r.bindBuffer(r.COPY_WRITE_BUFFER,null),l.buffer}_createBuffer(e,t,r,i){let n=e.createBuffer();return e.bindBuffer(t,n),e.bufferData(t,r,i),e.bindBuffer(t,null),n}}class No{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthReversed=!1,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){let e=this.gl;m={100:e.FUNC_ADD,101:e.FUNC_SUBTRACT,102:e.FUNC_REVERSE_SUBTRACT},g={200:e.ZERO,201:e.ONE,202:e.SRC_COLOR,204:e.SRC_ALPHA,210:e.SRC_ALPHA_SATURATE,208:e.DST_COLOR,206:e.DST_ALPHA,203:e.ONE_MINUS_SRC_COLOR,205:e.ONE_MINUS_SRC_ALPHA,209:e.ONE_MINUS_DST_COLOR,207:e.ONE_MINUS_DST_ALPHA};let t=e.getParameter(e.SCISSOR_BOX),r=e.getParameter(e.VIEWPORT);this.currentScissor=new ek().fromArray(t),this.currentViewport=new ek().fromArray(r),this._tempVec4=new ek}enable(e){let{enabled:t}=this;!0!==t[e]&&(this.gl.enable(e),t[e]=!0)}disable(e){let{enabled:t}=this;!1!==t[e]&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){let{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){let{gl:t}=this;0!==e?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(1===e?t.cullFace(t.BACK):2===e?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){let{currentLineWidth:t,gl:r}=this;e!==t&&(r.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e,t,r){let i=this.gl,n=this.backend.drawBuffersIndexedExt;if(!n)return void es("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets.");for(let a=0;a<e.length;a++){let s=e[a],o=null;if(null!==t){let e=t.getBlendMode(s.name);6===e.blending?o=r:0!==e.blending&&(o=e)}else o=r;null!==o?this._setMRTBlendingIndex(a,o):n.blendFuncSeparateiOES(a,i.ONE,i.ZERO,i.ONE,i.ZERO)}}_setMRTBlendingIndex(e,t){let{gl:r}=this,i=this.backend.drawBuffersIndexedExt,n=t.blending,a=t.blendSrc,s=t.blendDst,o=t.blendEquation,l=t.premultipliedAlpha;if(5===n){let r=null!==t.blendSrcAlpha?t.blendSrcAlpha:a,n=null!==t.blendDstAlpha?t.blendDstAlpha:s,l=null!==t.blendEquationAlpha?t.blendEquationAlpha:o;i.blendEquationSeparateiOES(e,m[o],m[l]),i.blendFuncSeparateiOES(e,g[a],g[s],g[r],g[n])}else if(i.blendEquationSeparateiOES(e,r.FUNC_ADD,r.FUNC_ADD),l)switch(n){case 1:default:i.blendFuncSeparateiOES(e,r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case 2:i.blendFuncSeparateiOES(e,r.ONE,r.ONE,r.ONE,r.ONE);break;case 3:i.blendFuncSeparateiOES(e,r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case 4:i.blendFuncSeparateiOES(e,r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE)}else switch(n){case 1:default:i.blendFuncSeparateiOES(e,r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case 2:i.blendFuncSeparateiOES(e,r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case 3:i.blendFuncSeparateiOES(e,r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case 4:i.blendFuncSeparateiOES(e,r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE)}}setBlending(e,t,r,i,n,a,s,o){let{gl:l}=this;if(0===e){!0===this.currentBlendingEnabled&&(this.disable(l.BLEND),this.currentBlendingEnabled=!1);return}if(!1===this.currentBlendingEnabled&&(this.enable(l.BLEND),this.currentBlendingEnabled=!0),5!==e){if(e!==this.currentBlending||o!==this.currentPremultipledAlpha){if((100!==this.currentBlendEquation||100!==this.currentBlendEquationAlpha)&&(l.blendEquation(l.FUNC_ADD),this.currentBlendEquation=100,this.currentBlendEquationAlpha=100),o)switch(e){case 1:l.blendFuncSeparate(l.ONE,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA);break;case 2:l.blendFunc(l.ONE,l.ONE);break;case 3:l.blendFuncSeparate(l.ZERO,l.ONE_MINUS_SRC_COLOR,l.ZERO,l.ONE);break;case 4:l.blendFuncSeparate(l.DST_COLOR,l.ONE_MINUS_SRC_ALPHA,l.ZERO,l.ONE);break;default:ea("WebGLState: Invalid blending: ",e)}else switch(e){case 1:l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA);break;case 2:l.blendFuncSeparate(l.SRC_ALPHA,l.ONE,l.ONE,l.ONE);break;case 3:ea("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case 4:ea("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:ea("WebGLState: Invalid blending: ",e)}this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentBlending=e,this.currentPremultipledAlpha=o}return}n=n||t,a=a||r,s=s||i,(t!==this.currentBlendEquation||n!==this.currentBlendEquationAlpha)&&(l.blendEquationSeparate(m[t],m[n]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=n),(r!==this.currentBlendSrc||i!==this.currentBlendDst||a!==this.currentBlendSrcAlpha||s!==this.currentBlendDstAlpha)&&(l.blendFuncSeparate(g[r],g[i],g[a],g[s]),this.currentBlendSrc=r,this.currentBlendDst=i,this.currentBlendSrcAlpha=a,this.currentBlendDstAlpha=s),this.currentBlending=e,this.currentPremultipledAlpha=!1}setColorMask(e){this.currentColorMask!==e&&(this.gl.colorMask(e,e,e,e),this.currentColorMask=e)}setDepthTest(e){let{gl:t}=this;e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)}setReversedDepth(e){if(this.currentDepthReversed!==e){let t=this.backend.extensions.get("EXT_clip_control");e?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT),this.currentDepthReversed=e}}setDepthMask(e){this.currentDepthMask!==e&&(this.gl.depthMask(e),this.currentDepthMask=e)}setDepthFunc(e){if(this.currentDepthReversed&&(e=el[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:default:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL)}this.currentDepthFunc=e}}
514scissor(e,t,r,i){let n=this._tempVec4.set(e,t,r,i);if(!1===this.currentScissor.equals(n)){let{gl:e}=this;e.scissor(n.x,n.y,n.z,n.w),this.currentScissor.copy(n)}}viewport(e,t,r,i){let n=this._tempVec4.set(e,t,r,i);if(!1===this.currentViewport.equals(n)){let{gl:e}=this;e.viewport(n.x,n.y,n.z,n.w),this.currentViewport.copy(n)}}setScissorTest(e){let t=this.gl;e?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)}setStencilTest(e){let{gl:t}=this;e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)}setStencilMask(e){this.currentStencilMask!==e&&(this.gl.stencilMask(e),this.currentStencilMask=e)}setStencilFunc(e,t,r){(this.currentStencilFunc!==e||this.currentStencilRef!==t||this.currentStencilFuncMask!==r)&&(this.gl.stencilFunc(e,t,r),this.currentStencilFunc=e,this.currentStencilRef=t,this.currentStencilFuncMask=r)}setStencilOp(e,t,r){(this.currentStencilFail!==e||this.currentStencilZFail!==t||this.currentStencilZPass!==r)&&(this.gl.stencilOp(e,t,r),this.currentStencilFail=e,this.currentStencilZFail=t,this.currentStencilZPass=r)}setMaterial(e,t,r){let{gl:i}=this;2===e.side?this.disable(i.CULL_FACE):this.enable(i.CULL_FACE);let n=1===e.side;t&&(n=!n),this.setFlipSided(n),1===e.blending&&!1===e.transparent?this.setBlending(0):this.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),this.setDepthFunc(e.depthFunc),this.setDepthTest(e.depthTest),this.setDepthMask(e.depthWrite),this.setColorMask(e.colorWrite);let a=e.stencilWrite;if(this.setStencilTest(a),a&&(this.setStencilMask(e.stencilWriteMask),this.setStencilFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),this.setStencilOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),this.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage&&this.backend.renderer.currentSamples>0?this.enable(i.SAMPLE_ALPHA_TO_COVERAGE):this.disable(i.SAMPLE_ALPHA_TO_COVERAGE),r>0&&this.currentClippingPlanes!==r)for(let e=0;e<8;e++)e<r?this.enable(12288+e):this.disable(12288+e)}setPolygonOffset(e,t,r){let{gl:i}=this;e?(this.enable(i.POLYGON_OFFSET_FILL),(this.currentPolygonOffsetFactor!==t||this.currentPolygonOffsetUnits!==r)&&(i.polygonOffset(t,r),this.currentPolygonOffsetFactor=t,this.currentPolygonOffsetUnits=r)):this.disable(i.POLYGON_OFFSET_FILL)}useProgram(e){return this.currentProgram!==e&&(this.gl.useProgram(e),this.currentProgram=e,!0)}setVertexState(e,t=null){let r=this.gl;return(this.currentVAO!==e||this.currentIndex!==t)&&(r.bindVertexArray(e),null!==t&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t),this.currentVAO=e,this.currentIndex=t,!0)}resetVertexState(){let e=this.gl;e.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.currentVAO=null,this.currentIndex=null}bindFramebuffer(e,t){let{gl:r,currentBoundFramebuffers:i}=this;return i[e]!==t&&(r.bindFramebuffer(e,t),i[e]=t,e===r.DRAW_FRAMEBUFFER&&(i[r.FRAMEBUFFER]=t),e===r.FRAMEBUFFER&&(i[r.DRAW_FRAMEBUFFER]=t),!0)}drawBuffers(e,t){let{gl:r}=this,i=[],n=!1;if(null!==e.textures){void 0===(i=this.currentDrawbuffers.get(t))&&(i=[],this.currentDrawbuffers.set(t,i));let a=e.textures;if(i.length!==a.length||i[0]!==r.COLOR_ATTACHMENT0){for(let e=0,t=a.length;e<t;e++)i[e]=r.COLOR_ATTACHMENT0+e;i.length=a.length,n=!0}}else i[0]!==r.BACK&&(i[0]=r.BACK,n=!0);n&&r.drawBuffers(i)}activeTexture(e){let{gl:t,currentTextureSlot:r,maxTextures:i}=this;void 0===e&&(e=t.TEXTURE0+i-1),r!==e&&(t.activeTexture(e),this.currentTextureSlot=e)}bindTexture(e,t,r){let{gl:i,currentTextureSlot:n,currentBoundTextures:a,maxTextures:s}=this;void 0===r&&(r=null===n?i.TEXTURE0+s-1:n);let o=a[r];void 0===o&&(o={type:void 0,texture:void 0},a[r]=o),(o.type!==e||o.texture!==t)&&(n!==r&&(i.activeTexture(r),this.currentTextureSlot=r),i.bindTexture(e,t),o.type=e,o.texture=t)}bindBufferBase(e,t,r){let{gl:i}=this,n=`${e}-${t}`;return this.currentBoundBufferBases[n]!==r&&(i.bindBufferBase(e,t,r),this.currentBoundBufferBases[n]=r,!0)}unbindTexture(){let{gl:e,currentTextureSlot:t,currentBoundTextures:r}=this,i=r[t];void 0!==i&&void 0!==i.type&&(e.bindTexture(i.type,null),i.type=void 0,i.texture=void 0)}}class Nl{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=""){let r,{gl:i,extensions:n}=this,a=eN.getTransfer(t);if(1009===e)return i.UNSIGNED_BYTE;if(1017===e)return i.UNSIGNED_SHORT_4_4_4_4;if(1018===e)return i.UNSIGNED_SHORT_5_5_5_1;if(35902===e)return i.UNSIGNED_INT_5_9_9_9_REV;if(35899===e)return i.UNSIGNED_INT_10F_11F_11F_REV;if(1010===e)return i.BYTE;if(1011===e)return i.SHORT;if(1012===e)return i.UNSIGNED_SHORT;if(1013===e)return i.INT;if(1014===e)return i.UNSIGNED_INT;if(1015===e)return i.FLOAT;if(1016===e)return i.HALF_FLOAT;if(1021===e)return i.ALPHA;if(1022===e)return i.RGB;if(1023===e)return i.RGBA;if(1026===e)return i.DEPTH_COMPONENT;if(1027===e)return i.DEPTH_STENCIL;if(1028===e)return i.RED;if(1029===e)return i.RED_INTEGER;if(1030===e)return i.RG;if(1031===e)return i.RG_INTEGER;if(1033===e)return i.RGBA_INTEGER;if(33776===e||33777===e||33778===e||33779===e)if(a===V){if(null===(r=n.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(33776===e)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===e)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===e)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===e)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(r=n.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===e)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===e)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===e)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===e)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===e||35841===e||35842===e||35843===e){if(null===(r=n.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===e)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===e)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===e)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===e)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===e||37492===e||37496===e||37488===e||37489===e||37490===e||37491===e){if(null===(r=n.get("WEBGL_compressed_texture_etc")))return null;if(36196===e||37492===e)return a===V?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(37496===e)return a===V?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;
514if(37488===e)return r.COMPRESSED_R11_EAC;if(37489===e)return r.COMPRESSED_SIGNED_R11_EAC;if(37490===e)return r.COMPRESSED_RG11_EAC;if(37491===e)return r.COMPRESSED_SIGNED_RG11_EAC}if(37808===e||37809===e||37810===e||37811===e||37812===e||37813===e||37814===e||37815===e||37816===e||37817===e||37818===e||37819===e||37820===e||37821===e){if(null===(r=n.get("WEBGL_compressed_texture_astc")))return null;if(37808===e)return a===V?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===e)return a===V?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===e)return a===V?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===e)return a===V?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===e)return a===V?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===e)return a===V?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===e)return a===V?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===e)return a===V?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===e)return a===V?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===e)return a===V?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===e)return a===V?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===e)return a===V?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===e)return a===V?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===e)return a===V?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===e){if(null===(r=n.get("EXT_texture_compression_bptc")))return null;if(36492===e)return a===V?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT}if(36283===e||36284===e||36285===e||36286===e){if(null===(r=n.get("EXT_texture_compression_rgtc")))return null;if(36283===e)return r.COMPRESSED_RED_RGTC1_EXT;if(36284===e)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===e)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===e)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return 1020===e?i.UNSIGNED_INT_24_8:void 0!==i[e]?i[e]:null}_clientWaitAsync(){let{gl:e}=this,t=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),new Promise((r,i)=>{!function n(){let a=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(a===e.WAIT_FAILED){e.deleteSync(t),i();return}a===e.TIMEOUT_EXPIRED?requestAnimationFrame(n):(e.deleteSync(t),r())}()})}}let Nu=!1,Nh,Nd,Nc;class Np{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,!1===Nu&&(this._init(),Nu=!0)}_init(){let e=this.gl;Nh={1e3:e.REPEAT,1001:e.CLAMP_TO_EDGE,1002:e.MIRRORED_REPEAT},Nd={1003:e.NEAREST,1004:e.NEAREST_MIPMAP_NEAREST,1005:e.NEAREST_MIPMAP_LINEAR,1006:e.LINEAR,1007:e.LINEAR_MIPMAP_NEAREST,1008:e.LINEAR_MIPMAP_LINEAR},Nc={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL}}getGLTextureType(e){let{gl:t}=this;return!0===e.isCubeTexture?t.TEXTURE_CUBE_MAP:!0===e.isArrayTexture||!0===e.isDataArrayTexture||!0===e.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:!0===e.isData3DTexture?t.TEXTURE_3D:t.TEXTURE_2D}getInternalFormat(e,t,r,i,n=!1){let{gl:a,extensions:s}=this;if(null!==e){if(void 0!==a[e])return a[e];en("WebGLBackend: Attempt to use non-existing WebGL internal format '"+e+"'")}let o=t;if(t===a.RED&&(r===a.FLOAT&&(o=a.R32F),r===a.HALF_FLOAT&&(o=a.R16F),r===a.UNSIGNED_BYTE&&(o=a.R8),r===a.UNSIGNED_SHORT&&(o=a.R16),r===a.UNSIGNED_INT&&(o=a.R32UI),r===a.BYTE&&(o=a.R8I),r===a.SHORT&&(o=a.R16I),r===a.INT&&(o=a.R32I)),t===a.RED_INTEGER&&(r===a.UNSIGNED_BYTE&&(o=a.R8UI),r===a.UNSIGNED_SHORT&&(o=a.R16UI),r===a.UNSIGNED_INT&&(o=a.R32UI),r===a.BYTE&&(o=a.R8I),r===a.SHORT&&(o=a.R16I),r===a.INT&&(o=a.R32I)),t===a.RG&&(r===a.FLOAT&&(o=a.RG32F),r===a.HALF_FLOAT&&(o=a.RG16F),r===a.UNSIGNED_BYTE&&(o=a.RG8),r===a.UNSIGNED_SHORT&&(o=a.RG16),r===a.UNSIGNED_INT&&(
514o=a.RG32UI),r===a.BYTE&&(o=a.RG8I),r===a.SHORT&&(o=a.RG16I),r===a.INT&&(o=a.RG32I)),t===a.RG_INTEGER&&(r===a.UNSIGNED_BYTE&&(o=a.RG8UI),r===a.UNSIGNED_SHORT&&(o=a.RG16UI),r===a.UNSIGNED_INT&&(o=a.RG32UI),r===a.BYTE&&(o=a.RG8I),r===a.SHORT&&(o=a.RG16I),r===a.INT&&(o=a.RG32I)),t===a.RGB){let e=n?k:eN.getTransfer(i);r===a.FLOAT&&(o=a.RGB32F),r===a.HALF_FLOAT&&(o=a.RGB16F),r===a.UNSIGNED_BYTE&&(o=a.RGB8),r===a.UNSIGNED_SHORT&&(o=a.RGB16),r===a.UNSIGNED_INT&&(o=a.RGB32UI),r===a.BYTE&&(o=a.RGB8I),r===a.SHORT&&(o=a.RGB16I),r===a.INT&&(o=a.RGB32I),r===a.UNSIGNED_BYTE&&(o=e===V?a.SRGB8:a.RGB8),r===a.UNSIGNED_SHORT_5_6_5&&(o=a.RGB565),r===a.UNSIGNED_SHORT_5_5_5_1&&(o=a.RGB5_A1),r===a.UNSIGNED_SHORT_4_4_4_4&&(o=a.RGB4),r===a.UNSIGNED_INT_5_9_9_9_REV&&(o=a.RGB9_E5),r===a.UNSIGNED_INT_10F_11F_11F_REV&&(o=a.R11F_G11F_B10F)}if(t===a.RGB_INTEGER&&(r===a.UNSIGNED_BYTE&&(o=a.RGB8UI),r===a.UNSIGNED_SHORT&&(o=a.RGB16UI),r===a.UNSIGNED_INT&&(o=a.RGB32UI),r===a.BYTE&&(o=a.RGB8I),r===a.SHORT&&(o=a.RGB16I),r===a.INT&&(o=a.RGB32I)),t===a.RGBA){let e=n?k:eN.getTransfer(i);r===a.FLOAT&&(o=a.RGBA32F),r===a.HALF_FLOAT&&(o=a.RGBA16F),r===a.UNSIGNED_BYTE&&(o=a.RGBA8),r===a.UNSIGNED_SHORT&&(o=a.RGBA16),r===a.UNSIGNED_INT&&(o=a.RGBA32UI),r===a.BYTE&&(o=a.RGBA8I),r===a.SHORT&&(o=a.RGBA16I),r===a.INT&&(o=a.RGBA32I),r===a.UNSIGNED_BYTE&&(o=e===V?a.SRGB8_ALPHA8:a.RGBA8),r===a.UNSIGNED_SHORT_4_4_4_4&&(o=a.RGBA4),r===a.UNSIGNED_SHORT_5_5_5_1&&(o=a.RGB5_A1)}return t===a.RGBA_INTEGER&&(r===a.UNSIGNED_BYTE&&(o=a.RGBA8UI),r===a.UNSIGNED_SHORT&&(o=a.RGBA16UI),r===a.UNSIGNED_INT&&(o=a.RGBA32UI),r===a.BYTE&&(o=a.RGBA8I),r===a.SHORT&&(o=a.RGBA16I),r===a.INT&&(o=a.RGBA32I)),t===a.DEPTH_COMPONENT&&(r===a.UNSIGNED_SHORT&&(o=a.DEPTH_COMPONENT16),r===a.UNSIGNED_INT&&(o=a.DEPTH_COMPONENT24),r===a.FLOAT&&(o=a.DEPTH_COMPONENT32F)),t===a.DEPTH_STENCIL&&r===a.UNSIGNED_INT_24_8&&(o=a.DEPTH24_STENCIL8),(o===a.R16F||o===a.R32F||o===a.RG16F||o===a.RG32F||o===a.RGBA16F||o===a.RGBA32F)&&s.get("EXT_color_buffer_float"),o}setTextureParameters(e,t){let{gl:r,extensions:i,backend:n}=this,a=eN.getPrimaries(eN.workingColorSpace),s=""===t.colorSpace?null:eN.getPrimaries(t.colorSpace),o=""===t.colorSpace||a===s?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,t.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,t.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,o),r.texParameteri(e,r.TEXTURE_WRAP_S,Nh[t.wrapS]),r.texParameteri(e,r.TEXTURE_WRAP_T,Nh[t.wrapT]),e!==r.TEXTURE_3D&&e!==r.TEXTURE_2D_ARRAY||t.isArrayTexture||r.texParameteri(e,r.TEXTURE_WRAP_R,Nh[t.wrapR]),r.texParameteri(e,r.TEXTURE_MAG_FILTER,Nd[t.magFilter]);let l=void 0!==t.mipmaps&&t.mipmaps.length>0,u=1006===t.minFilter&&l?1008:t.minFilter;if(r.texParameteri(e,r.TEXTURE_MIN_FILTER,Nd[u]),t.compareFunction&&(r.texParameteri(e,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(e,r.TEXTURE_COMPARE_FUNC,Nc[t.compareFunction])),!0===i.has("EXT_texture_filter_anisotropic")){if(1003===t.magFilter||1005!==t.minFilter&&1008!==t.minFilter||1015===t.type&&!1===i.has("OES_texture_float_linear"))return;if(t.anisotropy>1){let a=i.get("EXT_texture_filter_anisotropic");r.texParameterf(e,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,n.getMaxAnisotropy()))}}}createDefaultTexture(e){let{gl:t,backend:r,defaultTextures:i}=this,n=this.getGLTextureType(e),a=i[n];void 0===a&&(a=t.createTexture(),r.state.bindTexture(n,a),t.texParameteri(n,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(n,t.TEXTURE_MAG_FILTER,t.NEAREST),i[n]=a),r.set(e,{textureGPU:a,glTextureType:n})}createTexture(e,t){let{gl:r,backend:i}=this,{levels:n,width:a,height:s,depth:o}=t,l=i.utils.convert(e.format,e.colorSpace),u=i.utils.convert(e.type),h=this.getInternalFormat(e.internalFormat,l,u,e.colorSpace,e.isVideoTexture),d=r.createTexture(),c=this.getGLTextureType(e);i.state.bindTexture(c,d),this.setTextureParameters(c,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?r.texStorage3D(r.TEXTURE_2D_ARRAY,n,h,a,s,o):e.isData3DTexture?r.texStorage3D(r.TEXTURE_3D,n,h,a,s,o):e.isVideoTexture||r.texStorage2D(c,n,h,a,s),i.set(e,{textureGPU:d,glTextureType:c,glFormat:l,glType:u,glInternalFormat:h})}copyBufferToTexture(e,t){let{gl:r,backend:i}=this,{textureGPU:n,glTextureType:a,glFormat:s,glType:o}=i.get(t),{width:l,height:u}=t.source.data;r.bindBuffer(r.PIXEL_UNPACK_BUFFER,e),i.state.bindTexture(a,n),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.texSubImage2D(a,0,0,0,l,u,s,o,0),r.bindBuffer(r.PIXEL_UNPACK_BUFFER,null),i.state.unbindTexture()}updateTexture(e,t){let{gl:r}=this,{width:i,height:n}=t,{textureGPU:a,glTextureType:s,glFormat:o,glType:l,glInternalFormat:u}=this.backend.get(e);if(!e.isRenderTargetTexture&&void 0!==a)if(this.backend.state.bindTexture(s,a),this.setTextureParameters(s,e),e.isCompressedTexture){let i=e.mipmaps,n=t.image;for(let t=0;t<i.length;t++){let a=i[t];e.isCompressedArrayTexture?e.format!==r.RGBA?null!==o?r.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,t,0,0,0,a.width,a.height,n.depth,o,a.data):en("WebGLBackend: Attempt to load unsupported compressed texture format in .uploadTexture()"):r.texSubImage3D(r.TEXTURE_2D_ARRAY,t,0,0,0,a.width,a.height,n.depth,o,l,a.data):null!==o?r.compressedTexSubImage2D(r.TEXTURE_2D,t,0,0,a.width,a.height,o,a.data):en("WebGLBackend: Unsupported compressed texture format")}}else if(e.isCubeTexture){let a=t.images,s=e.mipmaps;for(let e=0;e<6;e++){let t=Nf(a[e]);r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,i,n,o,l,t);for(let t=0;t<s.length;t++){let i=Nf(s[t].images[e]);r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+e,t+1,0,0,i.width,i.height,o,l,i)}}}else if(e.isDataArrayTexture||e.isArrayTexture){let i=t.image;if(e.layerUpdates.size>0){let t=lh(i.width,i.height,e.format,e.type);for(let n of e.layerUpdates){let e=i.data.subarray(n*t/i.data.BYTES_PER_ELEMENT,(n+1)*t/i.data.BYTES_PER_ELEMENT);r.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,n,i.width,i.height,1,o,l,e)}e.clearLayerUpdates()}else r.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,i.width,i.height,i.depth,o,l,i.data)}else if(e.isData3DTexture){let e=t.image;r.texSubImage3D(r.TEXTURE_3D,0,0,0,0,e.width,e.height,e.depth,o,l,e.data)}
vendor: 7,587 bytes, line 514
514else if(e.isVideoTexture)e.update(),r.texImage2D(s,0,u,o,l,t.image);else{let a=e.mipmaps;if(a.length>0)for(let e=0,t=a.length;e<t;e++){let t=a[e],i=Nf(t);r.texSubImage2D(s,e,0,0,t.width,t.height,o,l,i)}else{let e=Nf(t.image);r.texSubImage2D(s,0,0,0,i,n,o,l,e)}}}generateMipmaps(e){let{gl:t,backend:r}=this,{textureGPU:i,glTextureType:n}=r.get(e);r.state.bindTexture(n,i),t.generateMipmap(n)}deallocateRenderBuffers(e){let{gl:t,backend:r}=this;if(e){let i=r.get(e);if(i.renderBufferStorageSetup=void 0,i.framebuffers){for(let e in i.framebuffers)t.deleteFramebuffer(i.framebuffers[e]);delete i.framebuffers}if(i.depthRenderbuffer&&(t.deleteRenderbuffer(i.depthRenderbuffer),delete i.depthRenderbuffer),i.stencilRenderbuffer&&(t.deleteRenderbuffer(i.stencilRenderbuffer),delete i.stencilRenderbuffer),i.msaaFrameBuffer&&(t.deleteFramebuffer(i.msaaFrameBuffer),delete i.msaaFrameBuffer),i.msaaRenderbuffers){for(let e=0;e<i.msaaRenderbuffers.length;e++)t.deleteRenderbuffer(i.msaaRenderbuffers[e]);delete i.msaaRenderbuffers}}}destroyTexture(e,t=!1){let{gl:r,backend:i}=this,{textureGPU:n,renderTarget:a}=i.get(e);this.deallocateRenderBuffers(a),!1===t&&r.deleteTexture(n),i.delete(e)}copyTextureToTexture(e,t,r=null,i=null,n=0,a=0){let s,o,l,u,h,d,c,p,f,{gl:m,backend:g}=this,{state:v}=this.backend,{textureGPU:y,glTextureType:_,glType:x,glFormat:b}=g.get(t);v.bindTexture(_,y);let S=e.isCompressedTexture?e.mipmaps[a]:e.image;if(null!==r)s=r.max.x-r.min.x,o=r.max.y-r.min.y,l=r.isBox3?r.max.z-r.min.z:1,u=r.min.x,h=r.min.y,d=r.isBox3?r.min.z:0;else{let t=Math.pow(2,-n);s=Math.floor(S.width*t),o=Math.floor(S.height*t),l=e.isDataArrayTexture||e.isArrayTexture?S.depth:e.isData3DTexture?Math.floor(S.depth*t):1,u=0,h=0,d=0}null!==i?(c=i.x,p=i.y,f=i.z):(c=0,p=0,f=0),m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,t.flipY),m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),m.pixelStorei(m.UNPACK_ALIGNMENT,t.unpackAlignment);let T=m.getParameter(m.UNPACK_ROW_LENGTH),A=m.getParameter(m.UNPACK_IMAGE_HEIGHT),M=m.getParameter(m.UNPACK_SKIP_PIXELS),E=m.getParameter(m.UNPACK_SKIP_ROWS),C=m.getParameter(m.UNPACK_SKIP_IMAGES);m.pixelStorei(m.UNPACK_ROW_LENGTH,S.width),m.pixelStorei(m.UNPACK_IMAGE_HEIGHT,S.height),m.pixelStorei(m.UNPACK_SKIP_PIXELS,u),m.pixelStorei(m.UNPACK_SKIP_ROWS,h),m.pixelStorei(m.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture||t.isArrayTexture,R=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isDepthTexture){let r=g.get(e),i=g.get(t),_=g.get(r.renderTarget),x=g.get(i.renderTarget),b=_.framebuffers[r.cacheKey],S=x.framebuffers[i.cacheKey];v.bindFramebuffer(m.READ_FRAMEBUFFER,b),v.bindFramebuffer(m.DRAW_FRAMEBUFFER,S);for(let e=0;e<l;e++)w&&(m.framebufferTextureLayer(m.READ_FRAMEBUFFER,m.COLOR_ATTACHMENT0,r.textureGPU,n,d+e),m.framebufferTextureLayer(m.DRAW_FRAMEBUFFER,m.COLOR_ATTACHMENT0,y,a,f+e)),m.blitFramebuffer(u,h,s,o,c,p,s,o,m.DEPTH_BUFFER_BIT,m.NEAREST);v.bindFramebuffer(m.READ_FRAMEBUFFER,null),v.bindFramebuffer(m.DRAW_FRAMEBUFFER,null)}else if(0!==n||e.isRenderTargetTexture||g.has(e)){let t=g.get(e);null===this._srcFramebuffer&&(this._srcFramebuffer=m.createFramebuffer()),null===this._dstFramebuffer&&(this._dstFramebuffer=m.createFramebuffer()),v.bindFramebuffer(m.READ_FRAMEBUFFER,this._srcFramebuffer),v.bindFramebuffer(m.DRAW_FRAMEBUFFER,this._dstFramebuffer);for(let e=0;e<l;e++)w?m.framebufferTextureLayer(m.READ_FRAMEBUFFER,m.COLOR_ATTACHMENT0,t.textureGPU,n,d+e):m.framebufferTexture2D(m.READ_FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,t.textureGPU,n),R?m.framebufferTextureLayer(m.DRAW_FRAMEBUFFER,m.COLOR_ATTACHMENT0,y,a,f+e):m.framebufferTexture2D(m.DRAW_FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,y,a),0!==n?m.blitFramebuffer(u,h,s,o,c,p,s,o,m.COLOR_BUFFER_BIT,m.NEAREST):R?m.copyTexSubImage3D(_,a,c,p,f+e,u,h,s,o):m.copyTexSubImage2D(_,a,c,p,u,h,s,o);v.bindFramebuffer(m.READ_FRAMEBUFFER,null),v.bindFramebuffer(m.DRAW_FRAMEBUFFER,null)}else R?e.isDataTexture||e.isData3DTexture?m.texSubImage3D(_,a,c,p,f,s,o,l,b,x,S.data):t.isCompressedArrayTexture?m.compressedTexSubImage3D(_,a,c,p,f,s,o,l,b,S.data):m.texSubImage3D(_,a,c,p,f,s,o,l,b,x,S):e.isDataTexture?m.texSubImage2D(m.TEXTURE_2D,a,c,p,s,o,b,x,S.data):e.isCompressedTexture?m.compressedTexSubImage2D(m.TEXTURE_2D,a,c,p,S.width,S.height,b,S.data):m.texSubImage2D(m.TEXTURE_2D,a,c,p,s,o,b,x,S);m.pixelStorei(m.UNPACK_ROW_LENGTH,T),m.pixelStorei(m.UNPACK_IMAGE_HEIGHT,A),m.pixelStorei(m.UNPACK_SKIP_PIXELS,M),m.pixelStorei(m.UNPACK_SKIP_ROWS,E),m.pixelStorei(m.UNPACK_SKIP_IMAGES,C),0===a&&t.generateMipmaps&&m.generateMipmap(_),v.unbindTexture()}copyFramebufferToTexture(e,t,r){let{gl:i}=this,{state:n}=this.backend,{textureGPU:a}=this.backend.get(e),{x:s,y:o,z:l,w:u}=r,h=!0===e.isDepthTexture||t.renderTarget&&t.renderTarget.samples>0,d=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(h){let r,h,c=0!==s||0!==o;if(!0===e.isDepthTexture?(r=i.DEPTH_BUFFER_BIT,h=i.DEPTH_ATTACHMENT,t.stencil&&(r|=i.STENCIL_BUFFER_BIT)):(r=i.COLOR_BUFFER_BIT,h=i.COLOR_ATTACHMENT0),c){let e=this.backend.get(t.renderTarget),h=e.framebuffers[t.getCacheKey()],c=e.msaaFrameBuffer;n.bindFramebuffer(i.DRAW_FRAMEBUFFER,h),n.bindFramebuffer(i.READ_FRAMEBUFFER,c);let p=d-o-u;i.blitFramebuffer(s,p,s+l,p+u,s,p,s+l,p+u,r,i.NEAREST),n.bindFramebuffer(i.READ_FRAMEBUFFER,h),n.bindTexture(i.TEXTURE_2D,a),i.copyTexSubImage2D(i.TEXTURE_2D,0,0,0,s,p,l,u),n.unbindTexture()}else{let e=i.createFramebuffer();n.bindFramebuffer(i.DRAW_FRAMEBUFFER,e),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,h,i.TEXTURE_2D,a,0),i.blitFramebuffer(0,0,l,u,0,0,l,u,r,i.NEAREST),i.deleteFramebuffer(e)}}else n.bindTexture(i.TEXTURE_2D,a),i.copyTexSubImage2D(i.TEXTURE_2D,0,0,0,s,d-u-o,l,u),n.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,r,i=!1){let{gl:n}=this,a=t.renderTarget,{depthTexture:s,depthBuffer:o,stencilBuffer:l,width:u,height:h}=a;if(n.bindRenderbuffer(n.RENDERBUFFER,e),o&&!l){let t=n.DEPTH_COMPONENT24;!0===i?this.extensions.get("WEBGL_multisampled_render_to_texture").renderbufferStorageMultisampleEXT(n.RENDERBUFFER,a.samples,t,u,h):r>0?(s&&s.isDepthTexture&&s.type===n.FLOAT&&(t=n.DEPTH_COMPONENT32F),n.renderbufferStorageMultisample(n.RENDERBUFFER,r,t,u,h)):n.renderbufferStorage(n.RENDERBUFFER,t,u,h),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,e)}else o&&l&&(r>0?n.renderbufferStorageMultisample(n.RENDERBUFFER,r,n.DEPTH24_STENCIL8,u,h):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,u,h),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,e));n.bindRenderbuffer(n.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,r,i,n,a){let{backend:s,gl:o}=this,{textureGPU:l,glFormat:u,glType:h}=this.backend.get(e),d=o.createFramebuffer();s.state.bindFramebuffer(o.READ_FRAMEBUFFER,d);let c=e.isCubeTexture?o.TEXTURE_CUBE_MAP_POSITIVE_X+a:o.TEXTURE_2D;o.framebufferTexture2D(o.READ_FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,l,0);let p=this._getTypedArrayType(h),f=i*n*this._getBytesPerTexel(h,u),m=o.createBuffer();o.bindBuffer(o.PIXEL_PACK_BUFFER,m),o.bufferData(o.PIXEL_PACK_BUFFER,f,o.STREAM_READ),o.readPixels(t,r,i,n,u,h,0),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),await s.utils._clientWaitAsync();let g=new p(f/p.BYTES_PER_ELEMENT);return o.bindBuffer(o.PIXEL_PACK_BUFFER,m),o.getBufferSubData(o.PIXEL_PACK_BUFFER,0,g),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),s.state.bindFramebuffer(o.READ_FRAMEBUFFER,null),o.deleteFramebuffer(d),g}_getTypedArrayType(e){let{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;
514if(e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5||e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw Error(`Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){let{gl:r}=this,i=0;return(e===r.UNSIGNED_BYTE&&(i=1),(e===r.UNSIGNED_SHORT_4_4_4_4||e===r.UNSIGNED_SHORT_5_5_5_1||e===r.UNSIGNED_SHORT_5_6_5||e===r.UNSIGNED_SHORT||e===r.HALF_FLOAT)&&(i=2),(e===r.UNSIGNED_INT||e===r.FLOAT)&&(i=4),t===r.RGBA)?4*i:t===r.RGB?3*i:t===r.ALPHA?i:void 0}dispose(){let{gl:e}=this;null!==this._srcFramebuffer&&e.deleteFramebuffer(this._srcFramebuffer),null!==this._dstFramebuffer&&e.deleteFramebuffer(this._dstFramebuffer)}}function Nf(e){return e.isDataTexture?e.image.data:"u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas?e:e.data}class Nm{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return void 0===t&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}}class Ng{constructor(e){this.backend=e,this.maxAnisotropy=null}getMaxAnisotropy(){if(null!==this.maxAnisotropy)return this.maxAnisotropy;let e=this.backend.gl,t=this.backend.extensions;if(!0===t.has("EXT_texture_filter_anisotropic")){let r=t.get("EXT_texture_filter_anisotropic");this.maxAnisotropy=e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}}let Nv={WEBGL_multi_draw:"WEBGL_multi_draw",WEBGL_compressed_texture_astc:"texture-compression-astc",WEBGL_compressed_texture_etc:"texture-compression-etc2",WEBGL_compressed_texture_etc1:"texture-compression-etc1",WEBGL_compressed_texture_pvrtc:"texture-compression-pvrtc",WEBGL_compressed_texture_s3tc:"texture-compression-s3tc",EXT_texture_compression_bptc:"texture-compression-bc",EXT_disjoint_timer_query_webgl2:"timestamp-query",OVR_multiview2:"OVR_multiview2"};class Ny{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){let{gl:r,mode:i,object:n,type:a,info:s,index:o}=this;0!==o?r.drawElements(i,t,a,e):r.drawArrays(i,e,t),s.update(n,t,1)}renderInstances(e,t,r){let{gl:i,mode:n,type:a,index:s,object:o,info:l}=this;0!==r&&(0!==s?i.drawElementsInstanced(n,t,a,e,r):i.drawArraysInstanced(n,e,t,r),l.update(o,t,r))}renderMultiDraw(e,t,r){let{extensions:i,mode:n,object:a,info:s}=this;if(0===r)return;let o=i.get("WEBGL_multi_draw");if(null===o)for(let i=0;i<r;i++)this.render(e[i],t[i]);else{0!==this.index?o.multiDrawElementsWEBGL(n,t,0,this.type,e,0,r):o.multiDrawArraysWEBGL(n,e,0,t,0,r);let i=0;for(let e=0;e<r;e++)i+=t[e];s.update(a,i,1)}}renderMultiDrawInstances(e,t,r,i){let{extensions:n,mode:a,object:s,info:o}=this;if(0===r)return;let l=n.get("WEBGL_multi_draw");if(null===l)for(let n=0;n<r;n++)this.renderInstances(e[n],t[n],i[n]);else{0!==this.index?l.multiDrawElementsInstancedWEBGL(a,t,0,this.type,e,0,i,0,r):l.multiDrawArraysInstancedWE
vendor: 9,523 bytes, line 514
514BGL(a,e,0,t,0,i,0,r);let n=0;for(let e=0;e<r;e++)n+=t[e]*i[e];o.update(s,n,1)}}}class N_{constructor(e=256){this.trackTimestamp=!0,this.maxQueries=e,this.currentQueryIndex=0,this.queryOffsets=new Map,this.isDisposed=!1,this.lastValue=0,this.frames=[],this.pendingResolve=!1,this.timestamps=new Map}getTimestampFrames(){return this.frames}getTimestamp(e){let t=this.timestamps.get(e);return void 0===t&&(en(`TimestampQueryPool: No timestamp available for uid ${e}.`),t=0),t}hasTimestamp(e){return this.timestamps.has(e)}allocateQueriesForContext(){}async resolveQueriesAsync(){}dispose(){}}class Nx extends N_{constructor(e,t,r=2048){if(super(r),this.gl=e,this.type=t,this.ext=e.getExtension("EXT_disjoint_timer_query_webgl2")||e.getExtension("EXT_disjoint_timer_query"),!this.ext){en("EXT_disjoint_timer_query not supported; timestamps will be disabled."),this.trackTimestamp=!1;return}this.queries=[];for(let t=0;t<this.maxQueries;t++)this.queries.push(e.createQuery());this.activeQuery=null,this.queryStates=new Map}allocateQueriesForContext(e){if(!this.trackTimestamp)return null;if(this.currentQueryIndex+2>this.maxQueries)return es(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,"inactive"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(null==t||null!==this.activeQuery)return;let r=this.queries[t];if(r)try{"inactive"===this.queryStates.get(t)&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,r),this.activeQuery=t,this.queryStates.set(t,"started"))}catch(e){ea("Error in beginQuery:",e),this.activeQuery=null,this.queryStates.set(t,"inactive")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(null!=t&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,"ended"),this.activeQuery=null}catch(e){ea("Error in endQuery:",e),this.queryStates.set(t,"inactive"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{let e=new Map;for(let[t,r]of this.queryOffsets){let i=this.queryStates.get(r);if("ended"===i){let i=this.queries[r];e.set(t,this.resolveQuery(i))}}if(0===e.size)return this.lastValue;let t={},r=[];for(let[i,n]of e){let e=i.match(/^(.*):f(\d+)$/),a=parseInt(e[2]);!1===r.includes(a)&&r.push(a),void 0===t[a]&&(t[a]=0);let s=await n;this.timestamps.set(i,s),t[a]+=s}let i=t[r[r.length-1]];return this.lastValue=i,this.frames=r,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,i}catch(e){return ea("Error resolving queries:",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{let r;if(this.isDisposed)return void t(this.lastValue);let i=!1,n=e=>{i||(i=!0,r&&(clearTimeout(r),r=null),t(e))},a=()=>{if(this.isDisposed)return void n(this.lastValue);try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT))return void n(this.lastValue);if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE)){r=setTimeout(a,1);return}let i=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(i)/1e6)}catch(e){ea("Error checking query:",e),t(this.lastValue)}};a()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,this.trackTimestamp)){for(let e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}}class Nb extends Ni{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer="u">typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);let t=this.parameters,r={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},i=void 0!==t.context?t.context:e.domElement.getContext("webgl2",r);function n(t){t.preventDefault();let r={api:"WebGL",message:t.statusMessage||"Unknown reason",reason:null,originalEvent:t};e.onDeviceLost(r)}this._onContextLost=n,e.domElement.addEventListener("webglcontextlost",n,!1),this.gl=i,this.extensions=new Nm(this),this.capabilities=new Ng(this),this.attributeUtils=new Ns(this),this.textureUtils=new Np(this),this.bufferRenderer=new Ny(this),this.state=new No(this),this.utils=new Nl(this),this.extensions.get("EXT_color_buffer_float"),this.extensions.get("WEBGL_clip_cull_distance"),this.extensions.get("OES_texture_float_linear"),this.extensions.get("EXT_color_buffer_half_float"),this.extensions.get("WEBGL_multisampled_render_to_texture"),this.extensions.get("WEBGL_render_shared_exponent"),this.extensions.get("WEBGL_multi_draw"),this.extensions.get("OVR_multiview2"),this.extensions.get("EXT_clip_control"),this.disjoint=this.extensions.get("EXT_disjoint_timer_query_webgl2"),this.parallel=this.extensions.get("KHR_parallel_shader_compile"),this.drawBuffersIndexedExt=this.extensions.get("OES_draw_buffers_indexed"),!0===t.reversedDepthBuffer&&this.extensions.has("EXT_clip_control")&&this.state.setReversedDepth(!0)}get coordinateSystem(){return 2e3}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}async makeXRCompatible(){!0!==this.gl.getContextAttributes().xrCompatible&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,r=null){let i=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:i.RGBA8}),null!==r){let t=e.stencilBuffer?i.DEPTH24_STENCIL8:i.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:r,glInternalFormat:t}),!0===this.extensions.has("WEBGL_multisampled_render_to_texture")&&!0===e._autoAllocateDepthBuffer&&!1===e.multiview&&en("WebGLBackend: Render-to-texture extension was disabled because an external texture was provided"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new Nx(this.gl,e,2048));let r=this.timestampQueryPool[e];null!==r.allocateQueriesForContext(t)&&r.beginQuery(t)}prepareTimestampBuffer(e,t){this.disjoint&&this.trackTimestamp&&this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){let{state:t}=this,r=this.get(e);if(e.viewport)this.updateViewport(e);else{let{width:e,height:r}=this.getDrawingBufferSize();t.viewport(0,0,e,r)}if(e.scissor)this.updateScissor(e);else{let{width:e,height:r}=this.getDrawingBufferSize();t.scissor(0,0,e,r)}this.initTimestampQuery(H.RENDER,this.getTimestampUID(e)),r.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);let i=e.occlusionQueryCount;i>0&&(r.currentOcclusionQueries=r.occlusionQueries,r.currentOcclusionQueryObjects=r.occlusionQueryObjects,r.lastOcclusionObject=null,r.occlusionQueries=Array(i),r.occlusionQueryObjects=Array(i),r.occlusionQueryIndex=0)}finishRender(e){let{gl:t,state:r}=this,i=this.get(e),n=i.previousContext;r.resetVertexState();let a=e.occlusionQueryCount;a>0&&(a>i.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));let s=e.textures;if(null!==s)for(let e=0;e<s.length;e++){let t=s[e];t.generateMipmaps&&this.generateMipmaps(t)}if(this._currentContext=n,this._resolveRenderTarget(e),null!==n){if(this._setFramebuffer(n),n.viewport)this.updateViewport(n);else{let{width:e,height:t}=this.getDrawingBufferSize();r.viewport(0,0,e,t)}if(n.scissor)this.updateScissor(n);else{let{width:e,height:t}=this.getDrawingBufferSize();r.scissor(0,0,e,t)}}this.prepareTimestampBuffer(H.RENDER,this.getTimestampUID(e))}resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueries:r,currentOcclusionQueryObjects:i}=t;if(r&&i){let e=new WeakSet,{gl:n}=this;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueries=null;let a=()=>{let s=0;for(let t=0;t<r.length;t++){let a=r[t];null!==a&&n.getQueryParameter(a,n.QUERY_RESULT_AVAILABLE)&&(0===n.getQueryParameter(a,n.QUERY_RESULT)&&e.add(i[t]),r[t]=null,n.deleteQuery(a),s++)}s<r.length?requestAnimationFrame(a):t.occluded=e};a()}}isOccluded(e,t){let r=this.get(e);return r.occluded&&r.occluded.has(t)}updateViewport(e){let{state:t}=this,{x:r,y:i,width:n,height:a}=e.viewportValue;t.viewport(r,e.height-a-i,n,a)}updateScissor(e){let{state:t}=this,{x:r,y:i,width:n,height:a}=e.scissorValue;t.scissor(r,e.height-a-i,n,a)}setScissorTest(e){this.state.setScissorTest(e)}getClearColor(){let e=super.getClearColor();return e.r*=e.a,e.g*=e.a,e.b*=e.a,e}clear(e,t,r,i=null,n=!0,a=!0){let{gl:s,renderer:o}=this;null===i&&(i={textures:null,clearColorValue:this.getClearColor()});let l=0;if(e&&(l|=s.COLOR_BUFFER_BIT),t&&(l|=s.DEPTH_BUFFER_BIT),r&&(l|=s.STENCIL_BUFFER_BIT),0!==l){let u;u=i.clearColorValue?i.clearColorValue:this.getClearColor();let h=o.getClearDepth(),d=o.getClearStencil();if(t&&this.state.setDepthMask(!0),null===i.textures)s.clearColor(u.r,u.g,u.b,u.a),s.clear(l);else{if(n&&this._setFramebuffer(i),e)for(let e=0;e<i.textures.length;
514e++)0===e?s.clearBufferfv(s.COLOR,e,[u.r,u.g,u.b,u.a]):s.clearBufferfv(s.COLOR,e,[0,0,0,1]);t&&r?s.clearBufferfi(s.DEPTH_STENCIL,0,h,d):t?s.clearBufferfv(s.DEPTH,0,[h]):r&&s.clearBufferiv(s.STENCIL,0,[d]),n&&a&&this._resolveRenderTarget(i)}}}beginCompute(e){let{state:t,gl:r}=this;t.bindFramebuffer(r.FRAMEBUFFER,null),this.initTimestampQuery(H.COMPUTE,this.getTimestampUID(e))}compute(e,t,r,i,n=null){let{state:a,gl:s}=this;!1===this.discard&&(a.enable(s.RASTERIZER_DISCARD),this.discard=!0);let{programGPU:o,transformBuffers:l,attributes:u}=this.get(i),h=this._getVaoKey(u),d=this.vaoCache[h];void 0===d?this.vaoCache[h]=this._createVao(u):a.setVertexState(d),a.useProgram(o),this._bindUniforms(r);let c=this._getTransformFeedback(l);s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,c),s.beginTransformFeedback(s.POINTS),Array.isArray(n=null!==n?n:t.count)?(es("WebGLBackend.compute(): The count parameter must be a single number, not an array."),n=n[0]):n&&"object"==typeof n&&n.isIndirectStorageBufferAttribute&&(es("WebGLBackend.compute(): The count parameter must be a single number, not IndirectStorageBufferAttribute"),n=t.count),u[0].isStorageInstancedBufferAttribute?s.drawArraysInstanced(s.POINTS,0,1,n):s.drawArrays(s.POINTS,0,n),s.endTransformFeedback(),s.bindTransformFeedback(s.TRANSFORM_FEEDBACK,null);for(let e=0;e<l.length;e++){let t=l[e];t.pbo&&this.has(t.pbo)&&this.textureUtils.copyBufferToTexture(t.transformBuffer,t.pbo),t.switchBuffers()}}finishCompute(e){let{state:t,gl:r}=this;this.discard=!1,t.disable(r.RASTERIZER_DISCARD),this.prepareTimestampBuffer(H.COMPUTE,this.getTimestampUID(e)),this._currentContext&&this._setFramebuffer(this._currentContext)}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.isArrayTexture&&e.camera.isArrayCamera}draw(e){let{object:t,pipeline:r,material:i,context:n,hardwareClippingPlanes:a}=e,{programGPU:s}=this.get(r),{gl:o,state:l}=this,u=this.get(n),h=e.getDrawParameters();if(null===h)return;this._bindUniforms(e.getBindings());let d=t.isMesh&&0>t.matrixWorld.determinant();l.setMaterial(i,d,a),null!==n.mrt&&null!==n.textures&&l.setMRTBlending(n.textures,n.mrt,i),l.useProgram(s);let c=e.getAttributes(),p=this.get(c),f=p.vaoGPU;if(void 0===f){let e=this._getVaoKey(c);void 0===(f=this.vaoCache[e])&&(f=this._createVao(c),this.vaoCache[e]=f,p.vaoGPU=f)}let m=e.getIndex(),g=null!==m?this.get(m).bufferGPU:null;l.setVertexState(f,g);let v=u.lastOcclusionObject;if(v!==t&&void 0!==v){if(null!==v&&!0===v.occlusionTest&&(o.endQuery(o.ANY_SAMPLES_PASSED),u.occlusionQueryIndex++),!0===t.occlusionTest){let e=o.createQuery();o.beginQuery(o.ANY_SAMPLES_PASSED,e),u.occlusionQueries[u.occlusionQueryIndex]=e,u.occlusionQueryObjects[u.occlusionQueryIndex]=t}u.lastOcclusionObject=t}let y=this.bufferRenderer;t.isPoints?y.mode=o.POINTS:t.isLineSegments?y.mode=o.LINES:t.isLine?y.mode=o.LINE_STRIP:t.isLineLoop?y.mode=o.LINE_LOOP:!0===i.wireframe?(l.setLineWidth(i.wireframeLinewidth*this.renderer.getPixelRatio()),y.mode=o.LINES):y.mode=o.TRIANGLES;let{vertexCount:_,instanceCount:x}
514=h,{firstVertex:b}=h;if(y.object=t,null!==m){b*=m.array.BYTES_PER_ELEMENT;let e=this.get(m);y.index=m.count,y.type=e.type}else y.index=0;let S=()=>{t.isBatchedMesh?null!==t._multiDrawInstances?(es("WebGLBackend: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),y.renderMultiDrawInstances(t._multiDrawStarts,t._multiDrawCounts,t._multiDrawCount,t._multiDrawInstances)):this.hasFeature("WEBGL_multi_draw")?y.renderMultiDraw(t._multiDrawStarts,t._multiDrawCounts,t._multiDrawCount):es("WebGLBackend: WEBGL_multi_draw not supported."):x>1?y.renderInstances(b,_,x):y.render(b,_)};if(!0===e.camera.isArrayCamera&&e.camera.cameras.length>0&&!1===e.camera.isMultiViewCamera){let r=this.get(e.camera),i=e.camera.cameras,n=e.getBindingGroup("cameraIndex").bindings[0];if(void 0===r.indexesGPU||r.indexesGPU.length!==i.length){let e=new Uint32Array([0,0,0,0]),t=[];for(let r=0,n=i.length;r<n;r++){let i=o.createBuffer();e[0]=r,o.bindBuffer(o.UNIFORM_BUFFER,i),o.bufferData(o.UNIFORM_BUFFER,e,o.STATIC_DRAW),t.push(i)}r.indexesGPU=t}let a=this.get(n),s=this.renderer.getPixelRatio(),u=this._currentContext.renderTarget,h=this._isRenderCameraDepthArray(this._currentContext),d=this._currentContext.activeCubeFace;if(h){let e=this.get(u.depthTexture);if(e.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){e.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;let{stencilBuffer:t}=u;for(let e=0,r=i.length;e<r;e++)this.renderer._activeCubeFace=e,this._currentContext.activeCubeFace=e,this._setFramebuffer(this._currentContext),this.clear(!1,!0,t,this._currentContext,!1,!1);this.renderer._activeCubeFace=d,this._currentContext.activeCubeFace=d}}for(let n=0,u=i.length;n<u;n++){let u=i[n];if(t.layers.test(u.layers)){h&&(this.renderer._activeCubeFace=n,this._currentContext.activeCubeFace=n,this._setFramebuffer(this._currentContext));let t=u.viewport;if(void 0!==t){let r=t.x*s,i=t.y*s,n=t.width*s,a=t.height*s;l.viewport(Math.floor(r),Math.floor(e.context.height-a-i),Math.floor(n),Math.floor(a))}l.bindBufferBase(o.UNIFORM_BUFFER,a.index,r.indexesGPU[n]),S()}this._currentContext.activeCubeFace=d,this.renderer._activeCubeFace=d}}else S()}needsRenderUpdate(){return!1}getRenderCacheKey(){return""}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,r,i,n,a){return this.textureUtils.copyTextureToBuffer(e,t,r,i,n,a)}updateSampler(){return""}createNodeBuilder(e,t){return new Ne(e,t)}createProgram(e){let t=this.gl,{stage:r,code:i}=e,n="fragment"===r?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(n,i),t.compileShader(n),this.set(e,{shaderGPU:n})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){let r=this.gl,i=e.pipeline,{fragmentProgram:n,vertexProgram:a}=i,s=r.createProgram(),o=this.get(n).shaderGPU,l=this.get(a).shaderGPU;if(r.attachShader(s,o),r.attachShader(s,l),r.linkProgram(s),this.set(i,{programGPU:s,fragmentShader:o,vertexShader:l}),null!==t&&this.parallel){let n=new Promise(t=>{let n=this.parallel,a=()=>{r.getProgramParameter(s,n.COMPLETION_STATUS_KHR)?(this._completeCompile(e,i),t()):requestAnimationFrame(a)};a()});t.push(n);return}this._completeCompile(e,i)}_handleSource(e,t){let r=e.split("\n"),i=[],n=Math.max(t-6,0),a=Math.min(t+6,r.length);for(let e=n;e<a;e++){let n=e+1;i.push(`${n===t?">":" "} ${n}: ${r[e]}`)}return i.join("\n")}_getShaderErrors(e,t,r){let i=e.getShaderParameter(t,e.COMPILE_STATUS),n=(e.getShaderInfoLog(t)||"").trim();if(i&&""===n)return"";let a=/ERROR: 0:(\d+)/.exec(n);if(!a)return n;{let i=parseInt(a[1]);return r.toUpperCase()+"\n\n"+n+"\n\n"+this._handleSource(e.getShaderSource(t),i)}}_logProgramError(e,t,r){if(this.renderer.debug.checkShaderErrors){let i=this.gl,n=(i.getProgramInfoLog(e)||"").trim();if(!1===i.getProgramParameter(e,i.LINK_STATUS))if("function"==typeof this.renderer.debug.onSha
514derError)this.renderer.debug.onShaderError(i,e,r,t);else{let a=this._getShaderErrors(i,r,"vertex"),s=this._getShaderErrors(i,t,"fragment");ea("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(e,i.VALIDATE_STATUS)+"\n\nProgram Info Log: "+n+"\n"+a+"\n"+s)}else""!==n&&en("WebGLProgram: Program Info Log:",n)}}_completeCompile(e,t){let{state:r,gl:i}=this,{programGPU:n,fragmentShader:a,vertexShader:s}=this.get(t);!1===i.getProgramParameter(n,i.LINK_STATUS)&&this._logProgramError(n,a,s),r.useProgram(n);let o=e.getBindings();this._setupBindings(o,n),this.set(t,{programGPU:n})}createComputePipeline(e,t){let{state:r,gl:i}=this,n={stage:"fragment",code:"#version 300 es\nprecision highp float;\nvoid main() {}"};this.createProgram(n);let{computeProgram:a}=e,s=i.createProgram(),o=this.get(n).shaderGPU,l=this.get(a).shaderGPU,u=a.transforms,h=[],d=[];for(let e=0;e<u.length;e++){let t=u[e];h.push(t.varyingName),d.push(t.attributeNode)}i.attachShader(s,o),i.attachShader(s,l),i.transformFeedbackVaryings(s,h,i.SEPARATE_ATTRIBS),i.linkProgram(s),!1===i.getProgramParameter(s,i.LINK_STATUS)&&this._logProgramError(s,o,l),r.useProgram(s),this._setupBindings(t,s);let c=a.attributes,p=[],f=[];for(let e=0;e<c.length;e++){let t=c[e].node.attribute;p.push(t),this.has(t)||this.attributeUtils.createAttribute(t,i.ARRAY_BUFFER)}for(let e=0;e<d.length;e++){let t=d[e].attribute;this.has(t)||this.attributeUtils.createAttribute(t,i.ARRAY_BUFFER);let r=this.get(t);f.push(r)}this.set(e,{programGPU:s,transformBuffers:f,attributes:p})}createBindings(e,t){if(!1===this._knownBindings.has(t)){this._knownBindings.add(t);let e=0,r=0;for(let i of t)for(let t of(this.set(i,{textures:r,uniformBuffers:e}),i.bindings))t.isUniformBuffer&&e++,t.isSampledTexture&&r++}this.updateBindings(e,t)}updateBindings(e){let{gl:t}=this,r=this.get(e),i=r.uniformBuffers,n=r.textures;for(let r of e.bindings){let e=this.get(r);if(r.isUniformsGroup||r.isUniformBuffer){let n=r.buffer,{bufferGPU:a}=this.get(n);void 0===a?(a=t.createBuffer(),t.bindBuffer(t.UNIFORM_BUFFER,a),t.bufferData(t.UNIFORM_BUFFER,n.byteLength,t.DYNAMIC_DRAW),this.set(n,{bufferGPU:a})):t.bindBuffer(t.UNIFORM_BUFFER,a);let s=r.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,a),0===s.length)t.bufferData(t.UNIFORM_BUFFER,n,t.DYNAMIC_DRAW);else{let e=J(n),r=e?1:n.BYTES_PER_ELEMENT;for(let i=0,a=s.length;i<a;i++){let a=s[i],o=a.start*r,l=a.count*r,u=o*(e?n.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,u,n,o,l)}}e.index=i++,e.bufferGPU=a,this.set(r,e)}else if(r.isSampledTexture){let{textureGPU:t,glTextureType:i}=this.get(r.texture);e.index=n++,e.textureGPU=t,e.glTextureType=i,this.set(r,e)}}}updateBinding(e){let t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){let r=this.get(e).bufferGPU,i=e.buffer,n=e.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,r),0===n.length)t.bufferData(t.UNIFORM_BUFFER,i,t.DYNAMIC_DRAW);else{let e=J(i),r=e?1:i.BYTES_PER_ELEMENT;for(let a=0,s=n.length;a<s;a++){let s=n[a],o=s.start*r,l=s.count*r,u=o*(e?i.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,u,i,o,l)}}}}createIndexAttribute(e){let t=this.gl;this.attributeUtils.createAttribute(e,t.ELEMENT_ARRAY_BUFFER)}createAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}createStorageAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}hasFeature(e){let t=Object.keys(Nv).filter(t=>Nv[t]===e),r=this.extensions;for(let e=0;e<t.length;e++)if(r.has(t[e]))return!0;return!1}getMaxAnisotropy(){return this.capabilities.getMaxAnisotropy()}copyTextureToTexture(e,t,r=null,i=null,n=0,a=0){this.textureUtils.copyTextureToTexture(e,t,r,i,n,a)}copyFramebufferToTexture(e,t,r){this.textureUtils.copyFramebufferToTexture(e,t,r)}hasCompatibility(e){return e===X.TEXTURE_COMPARE||super.hasCompatibility(e)}initRenderTarget(e){let{gl:t,state:r}=this;this._setFramebuffer(e),r.bindFramebuffer(t.FRAMEBUFFER,null)}_setFramebuffer(e){let{gl:t,state:r}=this,i=null;if(null!==e.textures){let n,a=e.renderTarget,s=this.get(a),{samples:o,depthBuffer:l,stencilBuffer:u}=a,h=!0===a.isCubeRenderTarget,d=!0===a.isRenderTarget3D,c=a.depth>
vendor: 5,854 bytes, line 514
5141,p=!0===a.isXRRenderTarget,f=!0===p&&!0===a._hasExternalTextures,m=s.msaaFrameBuffer,g=s.depthRenderbuffer,v=this.extensions.get("WEBGL_multisampled_render_to_texture"),y=this.extensions.get("OVR_multiview2"),_=this._useMultisampledExtension(a),x=T2(e);if(h?(s.cubeFramebuffers||(s.cubeFramebuffers={}),n=s.cubeFramebuffers[x]):p&&!1===f?n=this._xrFramebuffer:(s.framebuffers||(s.framebuffers={}),n=s.framebuffers[x]),void 0===n){n=t.createFramebuffer(),r.bindFramebuffer(t.FRAMEBUFFER,n);let i=e.textures,l=[];if(h){s.cubeFramebuffers[x]=n;let{textureGPU:e}=this.get(i[0]),r=this.renderer._activeCubeFace,a=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+r,e,a)}else{s.framebuffers[x]=n;for(let r=0;r<i.length;r++){let n=i[r],s=this.get(n);s.renderTarget=e.renderTarget,s.cacheKey=x;let l=t.COLOR_ATTACHMENT0+r;if(a.multiview)y.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,l,s.textureGPU,0,o,0,2);else if(d||c){let e=this.renderer._activeCubeFace,r=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,l,s.textureGPU,r,e)}else if(_)v.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,l,t.TEXTURE_2D,s.textureGPU,0,o);else{let e=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,l,t.TEXTURE_2D,s.textureGPU,e)}}}let p=u?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(!0===a._autoAllocateDepthBuffer){let r=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage(r,e,0,_),s.xrDepthRenderbuffer=r,l.push(u?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,p,t.RENDERBUFFER,r)}else if(null!==e.depthTexture){l.push(u?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);let r=this.get(e.depthTexture);if(r.renderTarget=e.renderTarget,r.cacheKey=x,a.multiview)y.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,p,r.textureGPU,0,o,0,2);else if(f&&_)v.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,p,t.TEXTURE_2D,r.textureGPU,0,o);else if(e.depthTexture.isArrayTexture){let e=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,p,r.textureGPU,0,e)}else if(e.depthTexture.isCubeTexture){let e=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,p,t.TEXTURE_CUBE_MAP_POSITIVE_X+e,r.textureGPU,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,p,t.TEXTURE_2D,r.textureGPU,0)}s.depthInvalidationArray=l}else{if(this._isRenderCameraDepthArray(e)){r.bindFramebuffer(t.FRAMEBUFFER,n);let i=this.renderer._activeCubeFace,a=this.get(e.depthTexture),s=u?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,s,a.textureGPU,0,i)}if((p||_||a.multiview)&&!0!==a._isOpaqueFramebuffer){r.bindFramebuffer(t.FRAMEBUFFER,n);let i=this.get(e.textures[0]);a.multiview?y.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,i.textureGPU,0,o,0,2):_?v.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i.textureGPU,0,o):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i.textureGPU,0);let l=u?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(!0===a._autoAllocateDepthBuffer){let e=s.xrDepthRenderbuffer;t.bindRenderbuffer(t.RENDERBUFFER,e),t.framebufferRenderbuffer(t.FRAMEBUFFER,l,t.RENDERBUFFER,e)}else{let r=this.get(e.depthTexture);a.multiview?y.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,l,r.textureGPU,0,o,0,2):_?v.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,l,t.TEXTURE_2D,r.textureGPU,0,o):t.framebufferTexture2D(t.FRAMEBUFFER,l,t.TEXTURE_2D,r.textureGPU,0)}}}if(o>0&&!1===_&&!a.multiview){if(void 0===m){let i=[];m=t.createFramebuffer(),r.bindFramebuffer(t.FRAMEBUFFER,m);let n=[],a=e.textures;for(let r=0;r<a.length;r++){n[r]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,n[r]),i.push(t.COLOR_ATTACHMENT0+r);let a=e.textures[r],s=this.get(a);t.renderbufferStorageMultisample(t.RENDERBUFFER,o,s.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+r,t.RENDERBUFFER,n[r])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),s.msaaFrameBuffer=m,s.msaaRenderbuffers=n,l&&void 0===g){g=t.createRenderbuffer(),this.textureUtils.setupRenderBufferStorage(g,e,o),s.depthRenderbuffer=g;let r=u?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;i.push(r)}s.invalidationArray=i}i=s.msaaFrameBuffer}else i=n;r.drawBuffers(e,n)}r.bindFramebuffer(t.FRAMEBUFFER,i)}_getVaoKey(e){let t="";for(let r=0;r<e.length;r++)t+=":"+this.get(e[r]).id;return t}_createVao(e){let{gl:t}=this,r=t.createVertexArray();t.bindVertexArray(r);for(let r=0;r<e.length;r++){let i,n,a=e[r],s=this.get(a);t.bindBuffer(t.ARRAY_BUFFER,s.bufferGPU),t.enableVertexAttribArray(r),!0===a.isInterleavedBufferAttribute?(i=a.data.stride*s.bytesPerElement,n=a.offset*s.bytesPerElement):(i=0,n=0),s.isInteger?t.vertexAttribIPointer(r,a.itemSize,s.type,i,n):t.vertexAttribPointer(r,a.itemSize,s.type,a.normalized,i,n),a.isInstancedBufferAttribute&&!a.isInterleavedBufferAttribute?t.vertexAttribDivisor(r,a.meshPerAttribute):a.isInterleavedBufferAttribute&&a.data.isInstancedInterleavedBuffer&&t.vertexAttribDivisor(r,a.data.meshPerAttribute)}return t.bindBuffer(t.ARRAY_BUFFER,null),r}_getTransformFeedback(e){let t="";for(let r=0;r<e.length;r++)t+=":"+e[r].id;let r=this.transformFeedbackCache[t];if(void 0!==r)return r;let{gl:i}=this;r=i.createTransformFeedback(),i.bindTransformFeedback(i.TRANSFORM_FEEDBACK,r);for(let t=0;t<e.length;t++){let r=e[t];i.bindBufferBase(i.TRANSFORM_FEEDBACK_BUFFER,t,r.transformBuffer)}return i.bindTransformFeedback(i.TRANSFORM_FEEDBACK,null),this.transformFeedbackCache[t]=r,r}_setupBindings(e,t){let r=this.gl;for(let i of e)for(let e of i.bindings){let i=this.get(e).index;if(e.isUniformsGroup||e.isUniformBuffer){let n=r.getUniformBlockIndex(t,e.name);r.uniformBlockBinding(t,n,i)}
514else if(e.isSampledTexture){let n=r.getUniformLocation(t,e.name);r.uniform1i(n,i)}}}_bindUniforms(e){let{gl:t,state:r}=this;for(let i of e)for(let e of i.bindings){let i=this.get(e),n=i.index;e.isUniformsGroup||e.isUniformBuffer?r.bindBufferBase(t.UNIFORM_BUFFER,n,i.bufferGPU):e.isSampledTexture&&r.bindTexture(i.glTextureType,i.textureGPU,t.TEXTURE0+n)}}_resolveRenderTarget(e){let{gl:t,state:r}=this,i=e.renderTarget;if(null!==e.textures&&i){let n=this.get(i);if(i.samples>0&&!1===this._useMultisampledExtension(i)){let a=n.framebuffers[e.getCacheKey()],s=t.COLOR_BUFFER_BIT;i.resolveDepthBuffer&&(i.depthBuffer&&(s|=t.DEPTH_BUFFER_BIT),i.stencilBuffer&&i.resolveStencilBuffer&&(s|=t.STENCIL_BUFFER_BIT));let o=n.msaaFrameBuffer,l=n.msaaRenderbuffers,u=e.textures,h=u.length>1;if(r.bindFramebuffer(t.READ_FRAMEBUFFER,o),r.bindFramebuffer(t.DRAW_FRAMEBUFFER,a),h)for(let e=0;e<u.length;e++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);for(let r=0;r<u.length;r++){if(h){let{textureGPU:e}=this.get(u[r]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,l[r]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}if(e.scissor){let{x:r,y:i,width:n,height:a}=e.scissorValue,o=e.height-a-i;t.blitFramebuffer(r,o,r+n,o+a,r,o,r+n,o+a,s,t.NEAREST)}else t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,s,t.NEAREST)}if(h)for(let e=0;e<u.length;e++){let{textureGPU:r}=this.get(u[e]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,l[e]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,r,0)}!0===this._supportsInvalidateFramebuffer&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,n.invalidationArray)}else if(!1===i.resolveDepthBuffer&&n.framebuffers){let i=n.framebuffers[e.getCacheKey()];r.bindFramebuffer(t.DRAW_FRAMEBUFFER,i),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,n.depthInvalidationArray)}}}_useMultisampledExtension(e){return!0===e.multiview||e.samples>0&&!0===this.extensions.has("WEBGL_multisampled_render_to_texture")&&!1!==e._autoAllocateDepthBuffer}dispose(){null!==this.textureUtils&&this.textureUtils.dispose();let e=this.extensions.get("WEBGL_lose_context");e&&e.loseContext(),this.renderer.domElement.removeEventListener("webglcontextlost",this._onContextLost)}}let NS="u">typeof self&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},NT="never",NA="less",NM="equal",NE="less-equal",NC="greater",Nw="not-equal",NR="greater-equal",NN="always",NL="store",NB="load",NI="clear",NP="uint16",NF="uint32",ND="r8unorm",NU="r8snorm",NO="r8uint",NG="r8sint",Nk="r16uint",NV="r16sint",Nz="r16float",NH="rg8unorm",NW="rg8snorm",Nj="rg8uint",NX="rg8sint",Nq="r32uint",N$="r32sint",NJ="r32float",NK="rg16uint",NY="rg16sint",NQ="rg16float",NZ="rgba8unorm",N0="rgba8unorm-srgb",N1="rgba8snorm",N2="rgba8uint",N3="rgba8sint",N4="bgra8unorm",N5="bgra8unorm-srgb",N8="rgb9e5ufloat",N6="rgb10a2unorm",N9="rg11b10ufloat",N7="rg32uint",Le="rg32sint",Lt="rg32float",Lr="rgba16uint",Li="rgba16sint",Ln="rgba16float",La="rgba32uint",Ls="rgba32sint",Lo="rgba32float",Ll="depth24plus",Lu="depth24plus-stencil8",Lh="depth32float",Ld="depth32float-stencil8",Lc="bc1-rgba-unorm",Lp="bc1-rgba-unorm-srgb",Lf="bc2-rgba-unorm",Lm="bc2-rgba-unorm-srgb",Lg="bc3-rgba-unorm",Lv="bc3-rgba-unorm-srgb",Ly="bc4-r-unorm",L_="bc4-r-snorm",Lx="bc5-rg-unorm",Lb="bc5-rg-snorm",LS="bc7-rgba-unorm",LT="bc7-rgba-unorm-srgb",LA="etc2-rgb8unorm",LM="etc2-rgb8unorm-srgb",LE="etc2-rgba8unorm",LC="etc2-rgba8unorm-srgb",Lw="eac-r11unorm",LR="eac-r11snorm",LN="eac-rg11unorm",LL="eac-rg11snorm",LB="astc-4x4-unorm",LI="astc-4x4-unorm-srgb",LP="astc-5x4-unorm",LF="astc-5x4-unorm-srgb",LD="astc-5x5-unorm",LU="astc-5x5-unorm-srgb",LO="astc-6x5-unorm",LG="astc-6x5-unorm-srgb",Lk="astc-6x6-unorm",LV="astc-6x6-unorm-srgb",Lz="astc-8x5-unorm",LH="astc-8x5-unorm-srgb",LW="astc-8x6-unorm",Lj="astc-8x6-unorm-srgb",LX="astc-8x8-unorm",Lq="astc-8x8-unorm-srgb",L$="astc-10x5-unorm",LJ="astc-10x5-unorm-srgb",LK="astc-10x6-unorm",LY="astc-10x6-unorm-srgb",LQ="astc-10x8-unorm",LZ="astc-10x8-unorm-srgb",L0="astc-10x10-unorm",L1="astc-10x10-unorm-srgb",L2="astc-12x10-unorm",L3="astc-12x10-unorm-srgb",L4="astc-12x12-unorm",L5="astc-12x12-unorm-srgb",L8="linear",L6="nearest",L9="zero",L7="one-minus-src",Be="src-alpha",Bt="one-minus-src-alpha",Br="unfilterable-float",Bi="2d-array",Bn="cube",Ba="vertex",Bs="instance",Bo={CoreFeaturesAndLimits:"core-features-and-limits",DepthClipControl:"depth-clip-control",Depth32FloatStencil8:"depth32float-stencil8",TextureCompressionBC:"texture-compression-bc",TextureCompressionBCSliced3D:"texture-compression-bc-sliced-3d",TextureCompressionETC2:"texture-compression-etc2",TextureCompressionASTC:"texture-compression-astc",TextureCompressionASTCSliced3D:"texture-compression-astc-sliced-3d",TimestampQuery:"timestamp-query",IndirectFirstInstance:"indirect-first-instance",ShaderF16:"shader-f16",RG11B10UFloat:"rg11b10ufloat-renderable",BGRA8UNormStorage:"bgra8unorm-storage",Float32Filterable:"float32-filterable",Float32Blendable:"float32-blendable",ClipDistances:"clip-distances",DualSourceBlending:"dual-source-blending",Subgroups:"subgroups",TextureFormatsTier1:"texture-formats-tier1",TextureFormatsTier2:"texture-formats-tier2"},Bl={"texture-compression-s3tc":"texture-compression-bc","texture-compression-etc1":"texture-compression-etc2"};class Bu extends RY{constructor(e,t,r){super(e,t?t.value:null),this.textureNode=t,this.groupNode=r}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update(
514)}}class Bh extends RW{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}}let Bd=0;class Bc extends Bh{constructor(e,t){super("StorageBuffer_"+Bd++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:cL.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}}class Bp extends TP{constructor(e){super(),this.device=e;const t=` 515struct VarysStruct { 516 @builtin( position ) Position: vec4f, 517 @location( 0 ) vTex : vec2f, 518 @location( 1 ) @interpolate(flat, either) vBaseArrayLayer: u32, 519}; 520 521@group( 0 ) @binding ( 2 ) 522var<uniform> flipY: u32; 523 524@vertex 525fn mainVS( 526 @builtin( vertex_index ) vertexIndex : u32, 527 @builtin( instance_index ) instanceIndex : u32 ) -> VarysStruct { 528 529 var Varys : VarysStruct; 530 531 var pos = array( 532 vec2f( -1, -1 ), 533 vec2f( -1, 3 ), 534 vec2f( 3, -1 ), 535 ); 536 537 let p = pos[ vertexIndex ]; 538 let mult = select( vec2f( 0.5, -0.5 ), vec2f( 0.5, 0.5 ), flipY != 0 ); 539 Varys.vTex = p * mult + vec2f( 0.5 ); 540 Varys.Position = vec4f( p, 0, 1 ); 541 Varys.vBaseArrayLayer = instanceIndex; 542 543 return Varys; 544 545} 546 547@group( 0 ) @binding( 0 ) 548var imgSampler : sampler; 549 550@group( 0 ) @binding( 1 ) 551var img2d : texture_2d<f32>; 552 553@fragment 554fn main_2d( Varys: VarysStruct ) -> @location( 0 ) vec4<f32> { 555 556 return textureSample( img2d, imgSampler, Varys.vTex ); 557 558} 559 560@group( 0 ) @binding( 1 ) 561var img2dArray : texture_2d_array<f32>; 562 563@fragment 564fn main_2d_array( Varys: VarysStruct ) -> @location( 0 ) vec4<f32> { 565 566 return textureSample( img2dArray, imgSampler, Varys.vTex, Varys.vBaseArrayLayer ); 567 568} 569 570const faceMat = array( 571 mat3x3f( 0, 0, -2, 0, -2, 0, 1, 1, 1 ), // pos-x 572 mat3x3f( 0, 0, 2, 0, -2, 0, -1, 1, -1 ), // neg-x 573 mat3x3f( 2, 0, 0, 0, 0, 2, -1, 1, -1 ), // pos-y 574 mat3x3f( 2, 0, 0, 0, 0, -2, -1, -1, 1 ), // neg-y 575 mat3x3f( 2, 0, 0, 0, -2, 0, -1, 1, 1 ), // pos-z 576 mat3x3f( -2, 0, 0, 0, -2, 0, 1, 1, -1 ), // neg-z 577); 578 579@group( 0 ) @binding( 1 ) 580var imgCube : texture_cube<f32>; 581 582@fragment 583fn main_cube( Varys: VarysStruct ) -> @location( 0 ) vec4<f32> { 584 585 return textureSample( imgCube, imgSampler, faceMat[ Varys.vBaseArrayLayer ] * vec3f( fract( Varys.vTex ), 1 ) ); 586 587} 588`;this.mipmapSampler=e.createSampler({minFilter:L8}),this.flipYSampler=e.createSampler({minFilter:L6}),this.flipUniformBuffer=e.createBuffer({size:4,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),this.noFlipUniformBuffer=e.createBuffer({size:4,usage:GPUBufferUsage.UNIFORM}),this.transferPipelines={},this.mipmapShaderModule=e.createShaderModule({label:"mipmap",code:t})}getTransferPipeline(e,t){t=t||"2d-array";let r=`${e}-${t}`,i=this.transferPipelines[r];return void 0===i&&(i=this.device.createRenderPipeline({label:`mipmap-${e}-${t}`,vertex:{module:this.mipmapShaderModule},fragment:{module:this.mipmapShaderModule,entryPoint:`main_${t.replace("-","_")}`,targets:[{format:e}]},layout:"auto"}),this.transferPipelines[r]=i),i}flipY(e,t,r=0){let i=t.format,{width:n,height:a}=t.size,s=this.device.createTexture({size:{width:n,height:a},format:i,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING}),o=this.getTransferPipeline(i,e.textureBindingViewDimension),l=this.getTransferPipeline(i,s.textureBindingViewDimension),u=this.device.createCommandEncoder({}),h=(e,t,r,i,n,a)=>{let s=e.getBindGroupLayout(0),o=this.device.createBindGroup({layout:s,entries:[{binding:0,resource:this.flipYSampler},{binding:1,resource:t.createView({dimension:t.textureBindingViewDimension||"2d-array",baseMipLevel:0,mipLevelCount:1})},{binding:2,resource:{buffer:a?this.flipUniformBuffer:this.noFlipUniformBuffer}}]}),l=u.beginRenderPass({colorAttachments:[{view:i.createView({dimension:"2d",baseMipLevel:0,mipLevelCount:1,baseArrayLayer:n,arrayLayerCount:1}),loadOp:NI,storeOp:NL}]});l.setPipeline(e),l.setBindGroup(0,o),l.draw(3,1,0,r),l.end()};h(o,e,r,s,0,!1),h(l,s,0,e,r,!0),this.device.queue.submit([u.finish()]),s.destroy()}generateMipmaps(e,t=null){let r=this.get(e),i=r.layers||this._mipmapCreateBundles(e),n=t||this.device.createCommandEncoder({label:"mipmapEncoder"});this._mipmapRunBundles(n,i),null===t&&this.device.queue.submit([n.finish()]),r.layers=i}_mipmapCreateBundles(e){let t=e.textureBindingViewDimension||"2d-array",r=this.getTransferPipeline(e.format,t),i=r.getBindGroupLayout(0),n=[];for(let a=1;a<e.mipLevelCount;a++)for(let s=0;s<e.depthOrArrayLayers;s++){let o=this.device.createBindGroup({layout:i,entries:[{binding:0,resource:this.mipmapSampler},{binding:1,resource:e.createView({dimension:t,baseMipLevel:a-1,mipLevelCount:1})},{binding:2,resource:{buffer:this.noFlipUniformBuffer}}]}),l={colorAttachments:[{view:e.createView({dimension:"2d",baseMipLevel:a,mipLevelCount:1,baseArrayLayer:s,arrayLayerCount:1}),loadOp:NI,storeOp:NL}]},u=this.device.createRenderBundleEncoder({colorFormats:[e.format]});u.setPipeline(r),u.setBindGroup(0,o),u.draw(3,1,0,s),n.push({renderBundles:[u.finish()],passDescriptor:l})}return n}_mipmapRunBundles(e,t){let r=t.length;for(let i=0;i<r;i++){let r=t[i],n=e.beginRenderPass(r.passDescriptor);n.executeBundles(r.renderBundles),n.end()}}}let Bf={512:"never",513:"less",514:"equal",515:"less-equal",516:"greater",518:"greater-equal",519:"always",517:"not-equal"},Bm=[0,1,3,2,4,5];class Bg{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this._samplerCache=new Map}updateSampler(e){let t=this.backend,r=e.minFilter+"-"+e.magFilter+"-"+e.wrapS+"-"+e.wrapT+"-"+(e.wrapR||"0")+"-"+e.anisotropy+"-"+(e.compareFunction||0),i=this._samplerCache.get(r);if(void 0===i){let n={addressModeU:this._convertAddressMode(e.wrapS),addressModeV:this._convertAddressMode(e.wrapT),addressModeW:this._convertAddressMode(e.wrapR),magFilter:this._convertFilterMode(e.magFilter),minFilter:this._convertFilterMode(e.minFilter),mipmapFilter:this._convertFilterMode(e.minFilter),maxAnisotropy:1};e.isDepthTexture&&null===e.compareFunction&&(n.magFilter=L6,n.minFilter=L6,n.mipmapFilter=L6),n.magFilter===L8&&n.minFilter===L8&&n.mipmapFilter===L8&&(n.maxAnisotropy=e.anisotropy),e.isDepthTexture&&null!==e.compareFunction&&t.hasCompatibility(X.TEXTURE_COMPARE)&&(n.compare=Bf[e.compareFunction]),i={sampler:t.device.createSampler(n),usedTimes:0},this._samplerCache.set(r,i)}let n=t.get(e);if(n.sampler!==i.sampler){if(void 0!==n.sampler){let e=this._samplerCache.get(n.samplerKey);e.usedTimes--,0===e.usedTimes&&this._samplerCache.delete(n.samplerKey)}n.samplerKey=r,n.sampler=i.sampler,i.usedTimes++}
588return r}createDefaultTexture(e){let t,r=Bv(e);t=e.isCubeTexture?this._getDefaultCubeTextureGPU(r):this._getDefaultTextureGPU(r),this.backend.get(e).texture=t}createTexture(e,t={}){let r=this.backend,i=r.get(e);if(i.initialized)throw Error("WebGPUTextureUtils: Texture already initialized.");if(e.isExternalTexture){i.texture=e.sourceTexture,i.initialized=!0;return}void 0===t.needsMipmaps&&(t.needsMipmaps=!1),void 0===t.levels&&(t.levels=1),void 0===t.depth&&(t.depth=1);let{width:n,height:a,depth:s,levels:o}=t;e.isFramebufferTexture&&(t.renderTarget?t.format=this.backend.utils.getCurrentColorFormat(t.renderTarget):t.format=this.backend.utils.getPreferredCanvasFormat());let l=this._getDimension(e),u=e.internalFormat||t.format||Bv(e,r.device);i.format=u;let{samples:h,primarySamples:d,isMSAA:c}=r.utils.getTextureSampleData(e),p=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;!0===e.isStorageTexture&&(p|=GPUTextureUsage.STORAGE_BINDING),!0!==e.isCompressedTexture&&!0!==e.isCompressedArrayTexture&&u!==N8&&(p|=GPUTextureUsage.RENDER_ATTACHMENT);let f={label:e.name,size:{width:n,height:a,depthOrArrayLayers:s},mipLevelCount:o,sampleCount:d,dimension:l,format:u,usage:p};if(void 0===u){en("WebGPURenderer: Texture format not supported."),this.createDefaultTexture(e);return}e.isCubeTexture&&(f.textureBindingViewDimension=Bn);try{i.texture=r.device.createTexture(f)}catch(t){en("WebGPURenderer: Failed to create texture with descriptor:",f),this.createDefaultTexture(e);return}if(c){let e=Object.assign({},f);e.label=e.label+"-msaa",e.sampleCount=h,e.mipLevelCount=1,i.msaaTexture=r.device.createTexture(e)}i.initialized=!0,i.textureDescriptorGPU=f}destroyTexture(e,t=!1){let r=this.backend,i=r.get(e);void 0!==i.texture&&!1===t&&i.texture.destroy(),void 0!==i.msaaTexture&&i.msaaTexture.destroy(),r.delete(e)}generateMipmaps(e,t=null){let r=this.backend.get(e);this._generateMipmaps(r.texture,t)}getColorBuffer(){let e=this.backend,t=e.renderer.getCanvasTarget(),{width:r,height:i}=e.getDrawingBufferSize(),n=e.renderer.currentSamples,a=t.colorTexture,s=e.get(a);if(a.width===r&&a.height===i&&a.samples===n)return s.texture;let o=s.texture;return o&&o.destroy(),o=e.device.createTexture({label:"colorBuffer",size:{width:r,height:i,depthOrArrayLayers:1},sampleCount:e.utils.getSampleCount(e.renderer.currentSamples),format:e.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC}),a.source.width=r,a.source.height=i,a.samples=n,s.texture=o,o}getDepthBuffer(e=!0,t=!1){let r,i,n=this.backend,a=n.renderer.getCanvasTarget(),{width:s,height:o}=n.getDrawingBufferSize(),l=n.renderer.currentSamples,u=a.depthTexture;if(u.width===s&&u.height===o&&u.samples===l&&u.depth===e&&u.stencil===t)return n.get(u).texture;let h=n.get(u).texture;if(t?(r=1027,i=1020):e&&(r=1026,i=1014),void 0!==h){if(u.image.width===s&&u.image.height===o&&u.format===r&&u.type===i&&u.samples===l)return h;this.destroyTexture(u)}return u.name="depthBuffer",u.format=r,u.type=i,u.image.width=s,u.image.height=o,u.samples=l,this.createTexture(u,{width:s,height:o}),n.get(u).texture}updateTexture(e,t){let r=this.backend.get(e),i=e.mipmaps,{textureDescriptorGPU:n}=r;if(!e.isRenderTargetTexture&&void 0!==n){if(e.isDataTexture)if(i.length>0)for(let t=0,a=i.length;t<a;t++){let a=i[t];this._copyBufferToTexture(a,r.texture,n,0,e.flipY,0,t)}else this._copyBufferToTexture(t.image,r.texture,n,0,e.flipY);else if(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)for(let i=0;i<t.image.depth;i++)this._copyBufferToTexture(t.image,r.texture,n,i,e.flipY,i);else if(e.isCompressedTexture||e.isCompressedArrayTexture)this._copyCompressedBufferToTexture(e.mipmaps,r.texture,n);else if(e.isCubeTexture)this._copyCubeMapToTexture(e,r.texture,n);else if(i.length>0)for(let t=0,a=i.length;t<a;t++){let a=i[t];this._copyImageToTexture(a,r.texture,n,0,e.flipY,e.premultiplyAlpha,t)}else this._copyImageToTexture(t.image,r.texture,n,0,e.flipY,e.premultiplyAlpha);r.version=e.version}}async copyTextureToBuffer(e,t,r,i,n,a){let s=this.backend.device,o=this.backend.get(e),l=o.texture,u=o.textureDescriptorGPU.format,h=this._getBytesPerTexel(u),d=i*h;d=256*Math.ceil(d/256);
588let c=s.createBuffer({size:(n-1)*d+i*h,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),p=s.createCommandEncoder();p.copyTextureToBuffer({texture:l,origin:{x:t,y:r,z:a}},{buffer:c,bytesPerRow:d},{width:i,height:n});let f=this._getTypedArrayType(u);return s.queue.submit([p.finish()]),await c.mapAsync(GPUMapMode.READ),new f(c.getMappedRange())}dispose(){this._samplerCache.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(void 0===t){let r=new eG;r.minFilter=1003,r.magFilter=1003,this.createTexture(r,{width:1,height:1,format:e}),this.defaultTexture[e]=t=r}return this.backend.get(t).texture}_getDefaultCubeTextureGPU(e){let t=this.defaultCubeTexture[e];if(void 0===t){let r=new nm;r.minFilter=1003,r.magFilter=1003,this.createTexture(r,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=r}return this.backend.get(t).texture}_copyCubeMapToTexture(e,t,r){let i=e.images,n=e.mipmaps;for(let a=0;a<6;a++){let s=i[a],o=!0===e.flipY?Bm[a]:a;s.isDataTexture?this._copyBufferToTexture(s.image,t,r,o,e.flipY):this._copyImageToTexture(s,t,r,o,e.flipY,e.premultiplyAlpha);for(let i=0;i<n.length;i++){let s=n[i].images[a];s.isDataTexture?this._copyBufferToTexture(s.image,t,r,o,e.flipY,0,i+1):this._copyImageToTexture(s,t,r,o,e.flipY,e.premultiplyAlpha,i+1)}}}_copyImageToTexture(e,t,r,i,n,a,s=0){let o=this.backend.device,l=s>0?e.width:r.size.width,u=s>0?e.height:r.size.height;try{o.queue.copyExternalImageToTexture({source:e,flipY:n},{texture:t,mipLevel:s,origin:{x:0,y:0,z:i},premultipliedAlpha:a},{width:l,height:u,depthOrArrayLayers:1})}catch(e){}}_getPassUtils(){let e=this._passUtils;return null===e&&(this._passUtils=e=new Bp(this.backend.device)),e}_generateMipmaps(e,t=null){this._getPassUtils().generateMipmaps(e,t)}_flipY(e,t,r=0){this._getPassUtils().flipY(e,t,r)}_copyBufferToTexture(e,t,r,i,n,a=0,s=0){let o=this.backend.device,l=e.data,u=this._getBytesPerTexel(r.format),h=e.width*u;o.queue.writeTexture({texture:t,mipLevel:s,origin:{x:0,y:0,z:i}},l,{offset:e.width*e.height*u*a,bytesPerRow:h},{width:e.width,height:e.height,depthOrArrayLayers:1}),!0===n&&this._flipY(t,r,i)}_copyCompressedBufferToTexture(e,t,r){let i=this.backend.device,n=this._getBlockData(r.format),a=r.size.depthOrArrayLayers>1;for(let s=0;s<e.length;s++){let o=e[s],l=o.width,u=o.height,h=a?r.size.depthOrArrayLayers:1,d=Math.ceil(l/n.width)*n.byteLength,c=d*Math.ceil(u/n.height);for(let e=0;e<h;e++)i.queue.writeTexture({texture:t,mipLevel:s,origin:{x:0,y:0,z:e}},o.data,{offset:e*c,bytesPerRow:d,rowsPerImage:Math.ceil(u/n.height)},{width:Math.ceil(l/n.width)*n.width,height:Math.ceil(u/n.height)*n.height,depthOrArrayLayers:1})}}_getBlockData(e){return e===Lc||e===Lp?{byteLength:8,width:4,height:4}:e===Lf||e===Lm||e===Lg||e===Lv?{byteLength:16,width:4,height:4}:e===Ly||e===L_?{byteLength:8,width:4,height:4}:e===Lx||e===Lb||"bc6h-rgb-ufloat"===e||"bc6h-rgb-float"===e||e===LS||e===LT?{byteLength:16,width:4,height:4}:e===LA||e===LM||"etc2-rgb8a1unorm"===e||"etc2-rgb8a1unorm-srgb"===e?{byteLength:8,width:4,height:4}:e===LE||e===LC?{byteLength:16,width:4,height:4}:e===Lw||e===LR?{byteLength:8,width:4,height:4}:e===LN||e===LL||e===LB||e===LI?{byteLength:16,width:4,height:4}:e===LP||e===LF?{byteLength:16,width:5,height:4}:e===LD||e===LU?{byteLength:16,width:5,height:5}:e===LO||e===LG?{byteLength:16,width:6,height:5}:e===Lk||e===LV?{byteLength:16,width:6,height:6}:e===Lz||e===LH?{byteLength:16,width:8,height:5}:e===LW||e===Lj?{byteLength:16,width:8,height:6}:e===LX||e===Lq?{byteLength:16,width:8,height:8}:e===L$||e===LJ?{byteLength:16,width:10,height:5}:e===LK||e===LY?{byteLength:16,width:10,height:6}:e===LQ||e===LZ?{byteLength:16,width:10,height:8}:e===L0||e===L1?{byteLength:16,width:10,height:10}:e===L2||e===L3?{byteLength:16,width:12,height:10}:e===L4||e===L5?{byteLength:16,width:12,height:12}:void 0}_convertAddressMode(e){let t="clamp-to-edge";return 1e3===e?t="repeat":1002===e&&(t="mirror-repeat"),t}_convertFilterMode(e){let t=L8;return(1003===e||1004===e||1005===e)&&(t=L6),t}_getBytesPerTexel(e){return e===ND||e===NU||e===NO||e===NG?1:e===Nk||e===NV||e===Nz||e===NH||e===NW||e===Nj||e===NX?2:e===Nq||e===N$||e===NJ||e===NK||e===NY||e===NQ||e===NZ||e===N0||e===N1||e===N2||e===N3||e===N4||e===N5||e===N8||e===N6||e===N9||e===Lh||e===Ll||e===Lu||e===Ld?4:e===N7||e===Le||e===Lt||e===Lr||e===Li||e===Ln?8:e===La||e===Ls||e===Lo?16:void 0}_getTypedArrayType(e){return e===NO?Uint8Array:e===NG?Int8Array:e===ND?Uint8Array:e===NU?Int8Array:e===Nj?Uint8Array:e===NX?Int8Array:e===NH?Uint8Array:e===NW?Int8Array:e===N2?Uint8Array:e===N3?Int8Array:e===NZ||e===N0?Uint8Array:e===N1?Int8Array:e===Nk?Uint16Array:e===NV?Int16Array:e===NK?Uint16Array:e===NY?Int16Array:e===Lr?Uint16Array:e===Li?Int16Array:e===Nz||e===NQ||e===Ln?Uint16Array:e===Nq?Uint32Array:e===N$?Int32Array:e===NJ?Float32Array:e===N7?Uint32Array:e===Le?Int32Array:e===Lt?Float32Array:e===La?Uint32Array:e===Ls?Int32Array:e===Lo?Float32Array:e===N4||e===N5?Uint8Array:e===N6||e===N8||e===N9?Uint32Array:e===Lh?Float32Array:e===Ll||e===Lu?Uint32Array:e===Ld?Float32Array:void 0}_getDimension(e){return e.is3DTexture||e.isData3DTexture?"3d":"2d"}}function Bv(e,t=null){let r,i=e.format,n=e.type,a=e.colorSpace,s=eN.getTransfer(a);if(!0===e.isCompressedTexture||!0===e.isCompressedArrayTexture)switch(i){case 33776:case 33777:r=s===V?Lp:Lc;break;case 33778:r=s===V?Lm:Lf;break;case 33779:r=s===V?Lv:Lg;break;case 36283:r=Ly;break;case 36284:r=L_;break;case 36285:r=Lx;break;case 36286:r=Lb;break;case 36492:r=s===V?LT:LS;break;case 37492:case 36196:r=s===V?LM:LA;break;case 37496:r=s===V?LC:LE;break;case 37488:r=Lw;break;case 37489:r=LR;break;case 37490:r=LN;break;case 37491:r=LL;break;case 37808:r=s===V?LI:LB;break;
588case 37809:r=s===V?LF:LP;break;case 37810:r=s===V?LU:LD;break;case 37811:r=s===V?LG:LO;break;case 37812:r=s===V?LV:Lk;break;case 37813:r=s===V?LH:Lz;break;case 37814:r=s===V?Lj:LW;break;case 37815:r=s===V?Lq:LX;break;case 37816:r=s===V?LJ:L$;break;case 37817:r=s===V?LY:LK;break;case 37818:r=s===V?LZ:LQ;break;case 37819:r=s===V?L1:L0;break;case 37820:r=s===V?L3:L2;break;case 37821:r=s===V?L5:L4;break;case 1023:r=s===V?N0:NZ;break;default:ea("WebGPURenderer: Unsupported texture format.",i)}else switch(i){case 1023:switch(n){case 1010:r=N1;break;case 1011:r=Li;break;case 1012:r=Lr;break;case 1014:r=La;break;case 1013:r=Ls;break;case 1009:r=s===V?N0:NZ;break;case 1016:r=Ln;break;case 1015:r=Lo;break;default:ea("WebGPURenderer: Unsupported texture type with RGBAFormat.",n)}break;case 1022:switch(n){case 35902:r=N8;break;case 35899:r=N9;break;default:ea("WebGPURenderer: Unsupported texture type with RGBFormat.",n)}break;case 1028:switch(n){case 1010:r=NU;break;case 1011:r=NV;break;case 1012:r=Nk;break;case 1014:r=Nq;break;case 1013:r=N$;break;case 1009:r=ND;break;case 1016:r=Nz;break;case 1015:r=NJ;break;default:ea("WebGPURenderer: Unsupported texture type with RedFormat.",n)}break;case 1030:switch(n){case 1010:r=NW;break;case 1011:r=NY;break;case 1012:r=NK;break;case 1014:r=N7;break;case 1013:r=Le;break;case 1009:r=NH;break;case 1016:r=NQ;break;case 1015:r=Lt;break;default:ea("WebGPURenderer: Unsupported texture type with RGFormat.",n)}break;case 1026:switch(n){case 1012:r="depth16unorm";break;case 1014:r=Ll;break;case 1015:r=Lh;break;default:ea("WebGPURenderer: Unsupported texture type with DepthFormat.",n)}break;case 1027:switch(n){case 1020:r=Lu;break;case 1015:t&&!1===t.features.has(Bo.Depth32FloatStencil8)&&ea('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the "depth32float-stencil8" GPU feature.'),r=Ld;break;default:ea("WebGPURenderer: Unsupported texture type with DepthStencilFormat.",n)}break;case 1029:switch(n){case 1013:r=N$;break;case 1014:r=Nq;break;default:ea("WebGPURenderer: Unsupported texture type with RedIntegerFormat.",n)}break;case 1031:switch(n){case 1013:r=Le;break;case 1014:r=N7;break;default:ea("WebGPURenderer: Unsupported texture type with RGIntegerFormat.",n)}break;case 1033:switch(n){case 1013:r=Ls;break;case 1014:r=La;break;default:ea("WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.",n)}break;default:ea("WebGPURenderer: Unsupported texture format.",i)}return r}let By=/^[fn]*\s*([a-z_0-9]+)?\s*\(([\s\S]*?)\)\s*[\-\>]*\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/i,B_=/([a-z_0-9]+)\s*:\s*([a-z_0-9]+(?:<[\s\S]+?>)?)/ig,Bx={f32:"float",i32:"int",u32:"uint",bool:"bool","vec2<f32>":"vec2","vec2<i32>":"ivec2","vec2<u32>":"uvec2","vec2<bool>":"bvec2",vec2f:"vec2",vec2i:"ivec2",vec2u:"uvec2",vec2b:"bvec2","vec3<f32>":"vec3","vec3<i32>":"ivec3","vec3<u32>":"uvec3","vec3<bool>":"bvec3",vec3f:"vec3",vec3i:"ivec3",vec3u:"uvec3",vec3b:"bvec3","vec4<f32>":"vec4","vec4<i32>":"ivec4","vec4<u32>":"uvec4","vec4<bool>":"bvec4",vec4f:"vec4",vec4i:"ivec4",vec4u:"uvec4",vec4b:"bvec4","mat2x2<f32>":"mat2",mat2x2f:"mat2","mat3x3<f32>":"mat3",mat3x3f:"mat3","mat4x4<f32>":"mat4",mat4x4f:"mat4",sampler:"sampler",texture_1d:"texture",texture_2d:"texture",texture_2d_array:"texture",texture_multisampled_2d:"cubeTexture",texture_depth_2d:"depthTexture",texture_depth_2d_array:"depthTexture",texture_depth_multisampled_2d:"depthTexture",texture_depth_cube:"depthTexture",texture_depth_cube_array:"depthTexture",texture_3d:"texture3D",texture_cube:"cubeTexture",texture_cube_array:"cubeTexture",texture_storage_1d:"storageTexture",texture_storage_2d:"storageTexture",texture_storage_2d_array:"storageTexture",texture_storage_3d:"storageTexture"};class Bb extends Rn{constructor(e){const{type:t,inputs:r,name:i,inputsCode:n,blockCode:a,outputType:s}=(e=>{let t=(e=e.trim()).match(By);if(null!==t&&4===t.length){let r=t[2],i=[],n=null;for(;null!==(n=B_.exec(r));)i.push({name:n[1],type:n[2]});let a=[];for(let e=0;e<i.length;e++){let{name:t,type:r}=i[e],n=r;n.startsWith("ptr")?n="pointer":(n.startsWith("texture")&&(n=r.split("<")[0]),n=Bx[n]),a.push(new w0(n,t))}let s=e.substring(t[0].length),o=t[3]||"void",l=void 0!==t[1]?t[1]:"";return{type:Bx[o]||o,inputs:a,name:l,inputsCode:r,blockCode:s,outputType:o}}throw Error("FunctionNode: Function is not a WGSL code.")})(e);super(t,r,i),this.inputsCode=n,this.blockCode=a,this.outputType=s}getCode(e=this.name){let t="void"!==this.outputType?"-> "+this.outputType:"";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}}class BS extends Ri{parseFunction(e){return new Bb(e)}}let BT={[cL.READ_ONLY]:"read",[cL.WRITE_ONLY]:"write",[cL.READ_WRITE]:"read_write"},BA={1e3:"repeat",1001:"clamp",1002:"mirror"},BM={vertex:NS.VERTEX,fragment:NS.FRAGMENT,compute:NS.COMPUTE},BE={instance:!0,swizzleAssign:!1,storageBuffer:!0},BC={"^^":"tsl_xor"},Bw={float:"f32",int:"i32",uint:"u32",bool:"bool",color:"vec3<f32>",vec2:"vec2<f32>",ivec2:"vec2<i32>",uvec2:"vec2<u32>",bvec2:"vec2<bool>",vec3:"vec3<f32>",ivec3:"vec3<i32>",uvec3:"vec3<u32>",bvec3:"vec3<bool>",vec4:"vec4<f32>",ivec4:"vec4<i32>",uvec4:"vec4<u32>",bvec4:"vec4<bool>",mat2:"mat2x2<f32>",mat3:"mat3x3<f32>",mat4:"mat4x4<f32>"},BR={},BN={tsl_xor:new M0("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }
588"),mod_float:new M0("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new M0("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new M0("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new M0("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new M0("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new M0("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2<bool> { return vec2<bool>( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new M0("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3<bool> { return vec3<bool>( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new M0("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4<bool> { return vec4<bool>( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new M0("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new M0("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new M0("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),biquadraticTexture:new M0(` 589fn tsl_biquadraticTexture( map : texture_2d<f32>, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f { 590 591 let res = vec2f( iRes ); 592 593 let uvScaled = coord * res; 594 let uvWrapping = ( ( uvScaled % res ) + res ) % res; 595 596 // https://www.shadertoy.com/view/WtyXRy 597 598 let uv = uvWrapping - 0.5; 599 let iuv = floor( uv ); 600 let f = fract( uv ); 601 602 let rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level ); 603 let rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level ); 604 let rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level ); 605 let rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level ); 606 607 return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y ); 608 609} 610`),biquadraticTextureArray:new M0(` 611fn tsl_biquadraticTexture_array( map : texture_2d_array<f32>, coord : vec2f, iRes : vec2u, layer : u32, level : u32 ) -> vec4f { 612 613 let res = vec2f( iRes ); 614 615 let uvScaled = coord * res; 616 let uvWrapping = ( ( uvScaled % res ) + res ) % res; 617 618 // https://www.shadertoy.com/view/WtyXRy 619 620 let uv = uvWrapping - 0.5; 621 let iuv = floor( uv ); 622 let f = fract( uv ); 623 624 let rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, layer, level ); 625 let rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, layer, level ); 626 let rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, layer, level ); 627 let rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, layer, level ); 628 629 return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y ); 630 631} 632`)},BL={dFdx:"dpdx",dFdy:"- dpdy",mod_float:"tsl_mod_float",mod_vec2:"tsl_mod_vec2",mod_vec3:"tsl_mod_vec3",mod_vec4:"tsl_mod_vec4",equals_bool:"tsl_equals_bool",equals_bvec2:"tsl_equals_bvec2",equals_bvec3:"tsl_equals_bvec3",equals_bvec4:"tsl_equals_bvec4",inversesqrt:"inverseSqrt",bitcast:"bitcast<f32>",floatpack_snorm_2x16:"pack2x16snorm",floatpack_unorm_2x16:"pack2x16unorm",floatpack_float16_2x16:"pack2x16float",floatunpack_snorm_2x16:"unpack2x16snorm",floatunpack_unorm_2x16:"unpack2x16unorm",floatunpack_float16_2x16:"unpack2x16float"},BB="";!0!==("u">typeof navigator&&/Firefox|Deno/g.test(navigator.userAgent))&&(BB+="diagnostic( off, derivative_uniformity );\n");class BI extends wQ{constructor(e,t){super(e,t,new BS),this.uniformGroups={},this.uniformGroupsBindings={},this.builtins={},this.directives={},this.scopedArrays=new Map}_generateTextureSample(e,t,r,i,n,a=this.shaderStage){return"fragment"!==a?this.generateTextureSampleLevel(e,t,r,"0",i):i?n?`textureSample( ${t}, ${t}_sampler, ${r}, ${i}, ${n} )`:`textureSample( ${t}, ${t}_sampler, ${r}, ${i} )`:n?`textureSample( ${t}, ${t}_sampler, ${r}, ${n} )`:`textureSample( ${t}, ${t}_sampler, ${r} )`}generateTextureSampleLevel(e,t,r,i,n,a){if(!1===this.isUnfilterable(e))if(n)return a?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${n}, ${i}, ${a} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${n}, ${i} )`;else return a?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${a} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i} )`;return this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,r,a,i,n):this.generateTextureLod(e,t,r,n,a,i)}generateWrapFunction(e){let t=`tsl_coord_${BA[e.wrapS]}S_${BA[e.wrapT]}_${e.is3DTexture||e.isData3DTexture?"3d":"2d"}T`,r=BR[t];if(void 0===r){let i=[],n=e.is3DTexture||e.isData3DTexture?"vec3f":"vec2f",a=`fn ${t}( coord : ${n} ) -> ${n} { 633 634 return ${n}( 635`,s=(e,t)=>{1e3===e?(i.push(BN.repeatWrapping_float),a+=` tsl_repeatWrapping_float( coord.${t}
635 )`):1001===e?(i.push(BN.clampWrapping_float),a+=` tsl_clampWrapping_float( coord.${t} )`):1002===e?(i.push(BN.mirrorWrapping_float),a+=` tsl_mirrorWrapping_float( coord.${t} )`):(a+=` coord.${t}`,en(`WebGPURenderer: Unsupported texture wrap type "${e}" for vertex shader.`))};s(e.wrapS,"x"),a+=",\n",s(e.wrapT,"y"),(e.is3DTexture||e.isData3DTexture)&&(a+=",\n",s(e.wrapR,"z")),a+="\n );\n\n}\n",BR[t]=r=new M0(a,i)}return r.build(this),t}generateArrayDeclaration(e,t){return`array< ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,r){let i=this.getDataFromNode(e,this.shaderStage,this.globalCache);void 0===i.dimensionsSnippet&&(i.dimensionsSnippet={});let n=i.dimensionsSnippet[r];if(void 0===i.dimensionsSnippet[r]){let a,s,{primarySamples:o}=this.renderer.backend.utils.getTextureSampleData(e);s=e.is3DTexture||e.isData3DTexture?"vec3<u32>":"vec2<u32>",a=o>1||e.isStorageTexture?t:`${t}${r?`, u32( ${r} )`:""}`,n=new gu(new gK(`textureDimensions( ${a} )`,s)),i.dimensionsSnippet[r]=n,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(i.arrayLayerCount=new gu(new gK(`textureNumLayers(${t})`,"u32"))),e.isTextureCube&&(i.cubeFaceCount=new gu(new gK("6u","u32")))}return n.build(this)}generateFilteredTexture(e,t,r,i,n="0u",a){let s=this.generateWrapFunction(e),o=this.generateTextureDimension(e,t,n);return(i&&(r=`${r} + vec2<f32>(${i}) / ${o}`),a)?(this._include("biquadraticTextureArray"),`tsl_biquadraticTexture_array( ${t}, ${s}( ${r} ), ${o}, u32( ${a} ), u32( ${n} ) )`):(this._include("biquadraticTexture"),`tsl_biquadraticTexture( ${t}, ${s}( ${r} ), ${o}, u32( ${n} ) )`)}generateTextureLod(e,t,r,i,n,a="0u"){if(!0===e.isCubeTexture){n&&(r=`${r} + vec3<f32>(${n})`);let i=e.isDepthTexture?"u32":"f32";return`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}( ${a} ) )`}let s=this.generateWrapFunction(e),o=this.generateTextureDimension(e,t,a),l=e.is3DTexture||e.isData3DTexture?"vec3":"vec2",u="vec3"===l?"vec3<u32>( 1, 1, 1 )":"vec2<u32>( 1, 1 )";n&&(r=`${r} + ${l}<f32>(${n}) / ${l}<f32>( ${o} )`);let h=`${l}<f32>( 0 )`,d=`${l}<f32>( ${o} - ${u} )`;return r=`${l}<u32>( clamp( floor( ${s}( ${r} ) * ${l}<f32>( ${o} ) ), ${h}, ${d} ) )`,this.generateTextureLoad(e,t,r,a,i,null)}generateStorageTextureLoad(e,t,r,i,n,a){return a&&(r=`${r} + ${a}`),n?`textureLoad( ${t}, ${r}, ${n} )`:`textureLoad( ${t}, ${r} )`}generateTextureLoad(e,t,r,i,n,a){let s;return null===i&&(i="0u"),a&&(r=`${r} + ${a}`),n?s=`textureLoad( ${t}, ${r}, ${n}, u32( ${i} ) )`:(s=`textureLoad( ${t}, ${r}, u32( ${i} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(s+=".x")),s}generateTextureStore(e,t,r,i,n){return i?`textureStore( ${t}, ${r}, ${i}, ${n} )`:`textureStore( ${t}, ${r}, ${n} )`}isSampleCompare(e){return!0===e.isDepthTexture&&null!==e.compareFunction&&this.renderer.hasCompatibility(X.TEXTURE_COMPARE)}isUnfilterable(e){return"float"!==this.getComponentTypeFromTexture(e)||!this.isAvailable("float32Filterable")&&!0===e.isDataTexture&&1015===e.type||!1===this.isSampleCompare(e)&&1003===e.minFilter&&1003===e.magFilter||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,r,i,n,a=this.shaderStage){return this.isUnfilterable(e)?this.generateTextureLod(e,t,r,i,n,"0",a):this._generateTextureSample(e,t,r,i,n,a)}generateTextureGrad(e,t,r,i,n,a,s=this.shaderStage){if("fragment"===s)if(n)return a?`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${n}, ${i[0]}, ${i[1]}, ${a} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${n}, ${i[0]}, ${i[1]} )`;else return a?`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${i[0]}, ${i[1]}, ${a} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${i[0]}, ${i[1]} )`;ea(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${s} shader.`)}generateTextureCompare(e,t,r,i,n,a,s=this.shaderStage){if("fragment"===s)return!0===e.isDepthTexture&&!0===e.isArrayTexture?a?`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${n}, ${i}, ${a} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${n}, ${i} )`:a?`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${i}, ${a} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${i} )`;ea(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${s} shader.`)}generateTextureLevel(e,t,r,i,n,a){if(!1===this.isUnfilterable(e))if(n)return a?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${n}, ${i}, ${a} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${n}, ${i} )`;else return a?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${a} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i} )`;return this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,r,a,i,n):this.generateTextureLod(e,t,r,n,a,i)}generateTextureBias(e,t,r,i,n,a,s=this.shaderStage){if("fragment"===s)if(n)return a?`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${n}, ${i}, ${a} )`:`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${n}, ${i} )`;else return a?`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${i}, ${a} )`:`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${i} )`;ea(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${s} shader.`)}getPropertyName(e,t=this.shaderStage){if(!0===e.isNodeVarying&&!0===e.needsInterpolation){if("vertex"===t)return`varyings.${e.name}`}else if(!0===e.isNodeUniform){let t=e.name,r=e.type;return"texture"===r||"cubeTexture"===r||"cubeDepthTexture"===r||"storageTexture"===r||"texture3D"===r?t:"buffer"!==r&&"storageBuffer"!==r&&"indirectStorageBuffer"!==r?e.groupNode.name+"."+t:this.isCu
vendor: 6,395 bytes, lines 635-642
635stomStruct(e)?t:t+".value"}return super.getPropertyName(e)}getOutputStructName(){return"output"}getFunctionOperator(e){let t=BC[e];return void 0!==t?(this._include(t),t):null}getNodeAccess(e,t){return"compute"!==t?!0===e.isAtomic?(en("WebGPURenderer: Atomic operations are only supported in compute shaders."),cL.READ_WRITE):cL.READ_ONLY:e.access}getStorageAccess(e,t){return BT[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,r,i=null){let n=super.getUniformFromNode(e,t,r,i),a=this.getDataFromNode(e,r,this.globalCache);if(void 0===a.uniformGPU){let s,o=e.groupNode,l=o.name,u=this.getBindGroupArray(l,r);if("texture"===t||"cubeTexture"===t||"cubeDepthTexture"===t||"storageTexture"===t||"texture3D"===t){let i=null,a=this.getNodeAccess(e,r);if("texture"===t||"storageTexture"===t?i=!0===e.value.is3DTexture?new R2(n.name,n.node,o,a):new R0(n.name,n.node,o,a):"cubeTexture"===t||"cubeDepthTexture"===t?i=new R1(n.name,n.node,o,a):"texture3D"===t&&(i=new R2(n.name,n.node,o,a)),i.store=!0===e.isStorageTextureNode,i.mipLevel=i.store?e.mipLevel:0,i.setVisibility(BM[r]),!0===e.value.isCubeTexture||!1===this.isUnfilterable(e.value)&&!1===i.store){let e=new Bu(`${n.name}_sampler`,n.node,o);e.setVisibility(BM[r]),u.push(e,i),s=[e,i]}else u.push(i),s=[i]}else if("buffer"===t||"storageBuffer"===t||"indirectStorageBuffer"===t){let a=this.getSharedDataFromNode(e),l=a.buffer;void 0===l&&(a.buffer=l=new("buffer"===t?Rq:Bc)(e,o)),l.setVisibility(l.getVisibility()|BM[r]),u.push(l),s=l,n.name=i||"NodeBuffer_"+n.id}else{let e=this.uniformGroups[l];void 0===e&&((e=new RK(l,o)).setVisibility(NS.VERTEX|NS.FRAGMENT|NS.COMPUTE),this.uniformGroups[l]=e),-1===u.indexOf(e)&&u.push(e);let r=(s=this.getNodeUniform(n,t)).name;e.uniforms.some(e=>e.name===r)||e.addUniform(s)}a.uniformGPU=s}return n}getBuiltin(e,t,r,i=this.shaderStage){let n=this.builtins[i]||(this.builtins[i]=new Map);return!1===n.has(e)&&n.set(e,{name:e,property:t,type:r}),t}hasBuiltin(e,t=this.shaderStage){return void 0!==this.builtins[t]&&this.builtins[t].has(e)}getVertexIndex(){return"vertex"===this.shaderStage?this.getBuiltin("vertex_index","vertexIndex","u32","attribute"):"vertexIndex"}buildFunctionCode(e){let t=e.layout,r=this.flowShaderNode(e),i=[];for(let e of t.inputs)i.push(e.name+" : "+this.getType(e.type));let n=`fn ${t.name}( ${i.join(", ")} ) -> ${this.getType(t.type)} { 636${r.vars} 637${r.code} 638`;return r.result&&(n+=` return ${r.result}; 639`),n+="\n}\n"}getInstanceIndex(){return"vertex"===this.shaderStage?this.getBuiltin("instance_index","instanceIndex","u32","attribute"):"instanceIndex"}getInvocationLocalIndex(){return this.getBuiltin("local_invocation_index","invocationLocalIndex","u32","attribute")}getSubgroupSize(){return this.enableSubGroups(),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute")}getInvocationSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_invocation_id","invocationSubgroupIndex","u32","attribute")}getSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin("subgroup_id","subgroupIndex","u32","attribute")}getDrawIndex(){return null}getFrontFacing(){return this.getBuiltin("front_facing","isFront","bool")}getFragCoord(){return this.getBuiltin("position","fragCoord","vec4<f32>")+".xy"}getFragDepth(){return"output."+this.getBuiltin("frag_depth","depth","f32","output")}getClipDistance(){return"varyings.hw_clip_distances"}isFlipY(){return!1}enableDirective(e,t=this.shaderStage){(this.directives[t]||(this.directives[t]=new Set)).add(e)}getDirectives(e){let t=[],r=this.directives[e];if(void 0!==r)for(let e of r)t.push(`enable ${e};`);return t.join("\n")}enableSubGroups(){this.enableDirective("subgroups")}enableSubgroupsF16(){this.enableDirective("subgroups-f16")}enableClipDistances(){this.enableDirective("clip_distances")}enableShaderF16(){this.enableDirective("f16")}enableDualSourceBlending(){this.enableDirective("dual_source_blending")}enableHardwareClipping(e){this.enableClipDistances(),this.getBuiltin("clip_distances","hw_clip_distances",`array<f32, ${e} >`,"vertex")}getBuiltins(e){let t=[],r=this.builtins[e];if(void 0!==r)for(let{name:e,property:i,type:n}of r.values())t.push(`@builtin( ${e} ) ${i} : ${n}`);return t.join(",\n ")}getScopedArray(e,t,r,i){return!1===this.scopedArrays.has(e)&&this.scopedArrays.set(e,{name:e,scope:t,bufferType:r,bufferCount:i}),e}getScopedArrays(e){if("compute"!==e)return;let t=[];for(let{name:e,scope:r,bufferType:i,bufferCount:n}of this.scopedArrays.values()){let a=this.getType(i);t.push(`var<${r}> ${e}: array< ${a}, ${n} >;`)}return t.join("\n")}getAttributes(e){let t=[];if("compute"===e&&(this.getBuiltin("global_invocation_id","globalId","vec3<u32>","attribute"),this.getBuiltin("workgroup_id","workgroupId","vec3<u32>","attribute"),this.getBuiltin("local_invocation_id","localId","vec3<u32>","attribute"),this.getBuiltin("num_workgroups","numWorkgroups","vec3<u32>","attribute"),this.renderer.hasFeature("subgroups")&&(this.enableDirective("subgroups",e),this.getBuiltin("subgroup_size","subgroupSize","u32","attribute"))),"vertex"===e||"compute"===e){let e=this.getBuiltins("attribute");e&&t.push(e);let r=this.getAttributesArray();for(let e=0,i=r.length;e<i;e++){let i=r[e],n=i.name,a=this.getType(i.type);t.push(`@location( ${e} ) ${n} : ${a}`)}}return t.join(",\n ")}getStructMembers(e){let t=[];for(let r of e.members){let i=e.output?"@location( "+r.index+" ) ":"",n=this.getType(r.type);r.atomic&&(n="atomic< "+n+" >"),t.push(` ${i+r.name} : ${n}`)}return e.output&&t.push(` ${this.getBuiltins("output")}`),t.join(",\n")}getStructs(e){let t="",r=this.structs[e];if(r.length>0){let e=[];for(let t of r){let r=`struct ${t.name} { 640`;r+=this.getStructMembers(t),r+="\n};",e.push(r)}t="\n"+e.join("\n\n")+"\n"}return t}getVar(e,t,r=null){let i=`var ${t} : `;return null!==r?i+=this.generateArrayDeclaration(e,r):i+=this.getType(e),i}getVars(e){let t=[],r=this.vars[e];if(void 0!==r)for(let e of r)t.push(` ${this.getVar(e.type,e.name,e.count)};`);return` 641${t.join("\n")} 642`}getVaryings(e){let t=[];if("vertex"===e&&this.getBuiltin("position","builtinClipSpace","vec4<f32>","vertex"),"vertex"===e||"fragment"===e){let r=this.varyings,i=this.vars[e];for(let n=0;n<r.length;n++){let a=r[n];if(a.needsInterpolation){let e=`@location( ${n} )`;if(a.interpolationType){let t=null!==a.interpolationSampling?`, ${a.interpolationSampling} )`:" )";e+=` @interpolate( ${a.interpolationType}${t}`}
642else/^(int|uint|ivec|uvec)/.test(a.type)&&(e+=" @interpolate(flat, either)");t.push(`${e} ${a.name} : ${this.getType(a.type)}`)}else"vertex"===e&&!1===i.includes(a)&&i.push(a)}}let r=this.getBuiltins(e);r&&t.push(r);let i=t.join(",\n ");return"vertex"===e?this._getWGSLStruct("VaryingsStruct"," "+i):i}isCustomStruct(e){let t=e.value,r=e.node,i=(t.isBufferAttribute||t.isInstancedBufferAttribute)&&null!==r.structTypeNode,n=r.value&&r.value.array&&"number"==typeof r.value.itemSize&&r.value.array.length>r.value.itemSize;return i&&!n}getUniforms(e){let t=this.uniforms[e],r=[],i=[],n=[],a={};for(let n of t){let t=n.groupNode.name,s=this.bindingsIndexes[t];if("texture"===n.type||"cubeTexture"===n.type||"cubeDepthTexture"===n.type||"storageTexture"===n.type||"texture3D"===n.type){let t,i=n.node.value;(!0===i.isCubeTexture||!1===this.isUnfilterable(i)&&!0!==n.node.isStorageTextureNode)&&(this.isSampleCompare(i)?r.push(`@binding( ${s.binding++} ) @group( ${s.group} ) var ${n.name}_sampler : sampler_comparison;`):r.push(`@binding( ${s.binding++} ) @group( ${s.group} ) var ${n.name}_sampler : sampler;`));let a="",{primarySamples:o}=this.renderer.backend.utils.getTextureSampleData(i);if(o>1&&(a="_multisampled"),!0===i.isCubeTexture&&!0===i.isDepthTexture)t="texture_depth_cube";else if(!0===i.isCubeTexture)t="texture_cube<f32>";else if(!0===i.isDepthTexture)t=this.renderer.backend.compatibilityMode&&null===i.compareFunction?`texture${a}_2d<f32>`:`texture_depth${a}_2d${!0===i.isArrayTexture?"_array":""}`;else if(!0===n.node.isStorageTextureNode){let r=Bv(i),a=this.getStorageAccess(n.node,e),s=n.node.value.is3DTexture,o=n.node.value.isArrayTexture,l=s?"3d":`2d${o?"_array":""}`;t=`texture_storage_${l}<${r}, ${a}>`}else if(!0===i.isArrayTexture||!0===i.isDataArrayTexture||!0===i.isCompressedArrayTexture)t="texture_2d_array<f32>";else if(!0===i.is3DTexture||!0===i.isData3DTexture)t="texture_3d<f32>";else{let e=this.getComponentTypeFromTexture(i).charAt(0);t=`texture${a}_2d<${e}32>`}r.push(`@binding( ${s.binding++} ) @group( ${s.group} ) var ${n.name} : ${t};`)}else if("buffer"===n.type||"storageBuffer"===n.type||"indirectStorageBuffer"===n.type){let t=n.node,r=this.getType(t.getNodeType(this)),a=t.bufferCount,o=a>0&&"buffer"===n.type?", "+a:"",l=t.isStorageBufferNode?`storage, ${this.getStorageAccess(t,e)}`:"uniform";if(this.isCustomStruct(n))i.push(`@binding( ${s.binding++} ) @group( ${s.group} ) var<${l}> ${n.name} : ${r};`);else{let e=t.isAtomic?`atomic<${r}>`:`${r}`,a=` value : array< ${e}${o} >`;i.push(this._getWGSLStructBinding(n.name,a,l,s.binding++,s.group))}}else{let e=n.groupNode.name;if(void 0===a[e]){let t=this.uniformGroups[e];if(void 0!==t){let r=[];for(let e of t.uniforms){let t=e.getType(),i=this.getType(this.getVectorType(t));r.push(` ${e.name} : ${i}`)}let i=this.uniformGroupsBindings[e];void 0===i&&(i={index:s.binding++,id:s.group},this.uniformGroupsBindings[e]=i),a[e]={index:i.index,id:i.id,snippets:r}}}}}for(let e in a){let t=a[e];n.push(this._getWGSLStructBinding(e,t.snippets.join(",\n"),"uniform",t.index,t.id))}return[...r,...i,...n].join("\n")}buildCode(){let e=null!==this.material?{fragment:{},vertex:{}}:{compute:{}};for(let t in this.sortBindingGroups(),e){this.shaderStage=t;let r=e[t];r.uniforms=this.getUniforms(t),r.attributes=this.getAttributes(t),r.varyings=this.getVaryings(t),r.structs=this.getStructs(t),r.vars=this.getVars(t),r.codes=this.getCodes(t),r.directives=this.getDirectives(t),r.scopedArrays=this.getScopedArrays(t);let i="// code\n\n";i+=this.flowCode[t];let n=this.flowNodes[t],a=n[n.length-1],s=a.outputNode,o=void 0!==s&&!0===s.isOutputStructNode;for(let e of n){let n=this.getFlowData(e),l=e.name;if(l&&(i.length>0&&(i+="\n"),i+=` // flow -> ${l} 643`),i+=`${n.code} 644 `,e===a&&"compute"!==t){if(i+="// result\n\n ","vertex"===t)i+=`varyings.builtinClipSpace = ${n.result};`;else if("fragment"===t)if(o)r.returnType=s.getNodeType(this),r.structs+="var<private> output : "+r.returnType+";",i+=`return ${n.result};`;else{let e=" @location(0) color: vec4<f32>",t=this.getBuiltins("output");t&&(e+=",\n "+t),r.returnType="OutputStruct",r.structs+=this._getWGSLStruct("OutputStruct",e),r.structs+="\nvar<private> output : OutputStruct;",i+=`output.color = ${n.result}; 645 646 return output;`}}}r.flow=i}if(this.shaderStage=null,null!==this.material)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{let t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let r;return null!==t&&(r=this._getWGSLMethod(e+"_"+t)),void 0===r&&(r=this._getWGSLMethod(e)),r||e}getBitcastMethod(e){let t=this.getType(e);return`bitcast<${t}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,r){return`select( ${r}, ${t}, ${e} )`}getType(e){return Bw[e]||e}isAvailable(e){let t=BE[e];return void 0===t&&("float32Filterable"===e?t=this.renderer.hasFeature("float32-filterable"):"clipDistance"===e&&(t=this.renderer.hasFeature("clip-distances")),BE[e]=t),t}getUniformBufferLimit(){return this.renderer.backend.device.limits.maxUniformBufferBindingSize}_getWGSLMethod(e){return void 0!==BN[e]&&this._include(e),BL[e]}_include(e){let t=BN[e];return t.build(this),this.addInclude(t),t}
646_getWGSLVertexCode(e){return`${this.getSignature()} 647// directives 648${e.directives} 649 650// structs 651${e.structs} 652 653// uniforms 654${e.uniforms} 655 656// varyings 657${e.varyings} 658var<private> varyings : VaryingsStruct; 659 660// codes 661${e.codes} 662 663@vertex 664fn main( ${e.attributes} ) -> VaryingsStruct { 665 666 // vars 667 ${e.vars} 668 669 // flow 670 ${e.flow} 671 672 return varyings; 673 674} 675`}_getWGSLFragmentCode(e){return`${this.getSignature()} 676// global 677${BB} 678 679// structs 680${e.structs} 681 682// uniforms 683${e.uniforms} 684 685// codes 686${e.codes} 687 688@fragment 689fn main( ${e.varyings} ) -> ${e.returnType} { 690 691 // vars 692 ${e.vars} 693 694 // flow 695 ${e.flow} 696 697} 698`}_getWGSLComputeCode(e,t){let[r,i,n]=t;return`${this.getSignature()} 699// directives 700${e.directives} 701 702// system 703var<private> instanceIndex : u32; 704 705// locals 706${e.scopedArrays} 707 708// structs 709${e.structs} 710 711// uniforms 712${e.uniforms} 713 714// codes 715${e.codes} 716 717@compute @workgroup_size( ${r}, ${i}, ${n} ) 718fn main( ${e.attributes} ) { 719 720 // system 721 instanceIndex = globalId.x 722 + globalId.y * ( ${r} * numWorkgroups.x ) 723 + globalId.z * ( ${r} * numWorkgroups.x ) * ( ${i} * numWorkgroups.y ); 724 725 // vars 726 ${e.vars} 727 728 // flow 729 ${e.flow} 730 731} 732`}_getWGSLStruct(e,t){return` 733struct ${e} { 734${t} 735};`}_getWGSLStructBinding(e,t,r,i=0,n=0){let a=e+"Struct",s=this._getWGSLStruct(a,t);return`${s} 736@binding( ${i} ) @group( ${n} ) 737var<${r}> ${e} : ${a};`}}class BP{constructor(e){this.backend=e}getCurrentDepthStencilFormat(e){let t;return e.depth&&(t=null!==e.depthTexture?this.getTextureFormatGPU(e.depthTexture):e.stencil?Lu:Ll),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){let e=this.backend.renderer,r=e.getRenderTarget();t=r?r.samples:e.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);let r=(t=t||1)>1&&null!==e.renderTarget&&!0!==e.isDepthTexture&&!0!==e.isFramebufferTexture,i=r?1:t;return{samples:t,primarySamples:i,isMSAA:r}}getCurrentColorFormat(e){return null!==e.textures?this.getTextureFormatGPU(e.textures[0]):this.getPreferredCanvasFormat()}getCurrentColorFormats(e){return null!==e.textures?e.textures.map(e=>this.getTextureFormatGPU(e)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return null!==e.textures?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){return e.isPoints?"point-list":e.isLineSegments||e.isMesh&&!0===t.wireframe?"line-list":e.isLine?"line-strip":e.isMesh?"triangle-list":void 0}getSampleCount(e){return e>=4?4:1}
737getSampleCountRenderContext(e){return null!==e.textures?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){let e=this.backend.parameters.outputType;if(void 0===e)return navigator.gpu.getPreferredCanvasFormat();if(1009===e)return N4;if(1016===e)return Ln;throw Error("Unsupported output buffer type.")}}let BF=new Map([[Int8Array,["sint8","snorm8"]],[Uint8Array,["uint8","unorm8"]],[Int16Array,["sint16","snorm16"]],[Uint16Array,["uint16","unorm16"]],[Int32Array,["sint32","snorm32"]],[Uint32Array,["uint32","unorm32"]],[Float32Array,["float32"]]]);"u">typeof Float16Array&&BF.set(Float16Array,["float16"]);let BD=new Map([[ri,["float16"]]]),BU=new Map([[Int32Array,"sint32"],[Int16Array,"sint32"],[Uint32Array,"uint32"],[Uint16Array,"uint32"],[Float32Array,"float32"]]);class BO{constructor(e){this.backend=e}createAttribute(e,t){let r=this._getBufferAttribute(e),i=this.backend,n=i.get(r),a=n.buffer;if(void 0===a){let s=i.device,o=r.array;if(!1===e.normalized){if(o.constructor===Int16Array||o.constructor===Int8Array)o=new Int32Array(o);else if((o.constructor===Uint16Array||o.constructor===Uint8Array)&&(o=new Uint32Array(o),t&GPUBufferUsage.INDEX))for(let e=0;e<o.length;e++)65535===o[e]&&(o[e]=0xffffffff)}if(r.array=o,(r.isStorageBufferAttribute||r.isStorageInstancedBufferAttribute)&&3===r.itemSize){o=new o.constructor(4*r.count);for(let e=0;e<r.count;e++)o.set(r.array.subarray(3*e,3*e+3),4*e);r.itemSize=4,r.array=o,n._force3to4BytesAlignment=!0}let l=o.byteLength;a=s.createBuffer({label:r.name,size:l+(4-l%4)%4,usage:t,mappedAtCreation:!0}),new o.constructor(a.getMappedRange()).set(o),a.unmap(),n.buffer=a}}updateAttribute(e){let t=this._getBufferAttribute(e),r=this.backend,i=r.device,n=r.get(t),a=r.get(t).buffer,s=t.array;if(!0===n._force3to4BytesAlignment){s=new s.constructor(4*t.count);for(let e=0;e<t.count;e++)s.set(t.array.subarray(3*e,3*e+3),4*e);t.array=s}let o=t.updateRanges;if(0===o.length)i.queue.writeBuffer(a,0,s,0);else{let e=J(s),r=e?1:s.BYTES_PER_ELEMENT;for(let t=0,l=o.length;t<l;t++){let l,u,h=o[t];if(!0===n._force3to4BytesAlignment){let e=Math.floor(h.start/3),t=Math.ceil(h.count/3);l=4*e*r,u=4*t*r}else l=h.start*r,u=h.count*r;let d=l*(e?s.BYTES_PER_ELEMENT:1);i.queue.writeBuffer(a,d,s,l,u)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){let t=e.getAttributes(),r=new Map;for(let e=0;e<t.length;e++){let i=t[e],n=i.array.BYTES_PER_ELEMENT,a=this._getBufferAttribute(i),s=r.get(a);if(void 0===s){let e,t;!0===i.isInterleavedBufferAttribute?(e=i.data.stride*n,t=i.data.isInstancedInterleavedBuffer?Bs:Ba):(e=i.itemSize*n,t=i.isInstancedBufferAttribute?Bs:Ba),!1===i.normalized&&(i.array.constructor===Int16Array||i.array.constructor===Uint16Array)&&(e=4),s={arrayStride:e,attributes:[],stepMode:t},r.set(a,s)}let o=this._getVertexFormat(i),l=!0===i.isInterleavedBufferAttribute?i.offset*n:0;s.attributes.push({shaderLocation:e,offset:l,format:o})}return Array.from(r.values())}destroyAttribute(e){let t=this.backend;t.get(this._getBufferAttribute(e)).buffer.destroy(),t.delete(e)}async getArrayBufferAsync(e){let t=this.backend,r=t.device,i=t.get(this._getBufferAttribute(e)).buffer,n=i.size,a=r.createBuffer({label:`${e.name}_readback`,size:n,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),s=r.createCommandEncoder({label:`readback_encoder_${e.name}`});s.copyBufferToBuffer(i,0,a,0,n);let o=s.finish();r.queue.submit([o]),await a.mapAsync(GPUMapMode.READ);let l=a.getMappedRange(),u=new e.array.constructor(l.slice(0));return a.unmap(),u.buffer}_getVertexFormat(e){let t,{itemSize:r,normalized:i}=e,n=e.array.constructor,a=e.constructor;if(1===r)t=BU.get(n);else{let e=(BD.get(a)||BF.get(n))[+!!i];if(e){let i=4*Math.floor((n.BYTES_PER_ELEMENT*r+3)/4)/n.BYTES_PER_ELEMENT;if(i%1)throw Error("THREE.WebGPUAttributeUtils: Bad vertex format item size.");t=`${e}x${i}`}}return t||ea("WebGPUAttributeUtils: Vertex format not supported yet."),t}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}}class BG{constructor(e){this.layoutGPU=e,this.usedTimes=0}}class Bk{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){let t=this.backend,r=t.device,i=t.get(e);if(i.layout)return i.layout.layoutGPU;let n=this._createLayoutEntries(e),a=cc(JSON.stringify(n)),s=this._bindGroupLayoutCache.get(a);return void 0===s&&(s=new BG(r.createBindGroupLayout({entries:n})),this._bindGroupLayoutCache.set(a,s)),s.usedTimes++,i.layout=s,i.layoutKey=a,s.layoutGPU}createBindings(e,t,r,i=0){let n,{backend:a}=this,s=a.get(e),o=this.createBindingsLayout(e);r>0&&(void 0===s.groups&&(s.groups=[],s.versions=[]),s.versions[r]===i&&(n=s.groups[r])),void 0===n&&(n=this.createBindGroup(e,o),r>0&&(s.groups[r]=n,s.versions[r]=i)),s.group=n}updateBinding(e){let t=this.backend,r=t.device,i=e.buffer,n=t.get(e).buffer,a=e.updateRanges;if(0===a.length)r.queue.writeBuffer(n,0,i,0);else{let e=J(i),t=e?1:i.BYTES_PER_ELEMENT;for(let s=0,o=a.length;s<o;s++){let o=a[s],l=o.start*t,u=o.count*t,h=l*(e?i.BYTES_PER_ELEMENT:1);r.queue.writeBuffer(n,h,i,l,u)}}}createBindGroupIndex(e,t){let r=this.backend.device,i=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,n=e[0],a=r.createBuffer({label:"bindingCameraIndex_"+n,size:16,usage:i});r.queue.writeBuffer(a,0,e,0);let s=[{binding:0,resource:{buffer:a}}];return r.createBindGroup({label:"bindGroupCameraIndex_"+n,layout:t,entries:s})}createBindGroup(e,t){let r=this.backend,i=r.device,n=0,a=[];for(let t of e.bindings){if(t.isUniformBuffer){let e=r.get(t);if(void 0===e.buffer){let r=t.byteLength,n=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,a=[];t.visibility&NS.VERTEX&&a.push("vertex"),t.visibility&NS.FRAGMENT&&a.push("fragment"),t.visibility&NS.COMPUTE&&a.push("compute");let s=`(${a.join(",")})`;e.buffer=i.createBuffer({label:`bindingBuffer${t.id}_${t.name}_${s}`,size:r,usage:n})}a.push({binding:n,resource:{buffer:e.buffer}})}else if(t.isStorageBuffer){let e=r.get(t.attribute).buffer;a.push({binding:n,resource:{buffer:e}})}else if(t.isSampledTexture){let e,s=r.get(t.texture);if(void 0!==s.externalTexture)e=i.importExternalTexture({source:s.externalTexture});else{let r=t.store?1:s.texture.mipLevelCount,i=t.store?t.mipLevel:0,n=`view-${s.texture.width}-${s.texture.height}`;if(s.texture.depthOrArrayLayers>1&&(n+=`-${s.texture.depthOrArrayLayers}`),n+=`-${r}-${i}`,void 0===(e=s[n])){let a;a=t.isSampledCubeTexture?Bn:t.isSampledTexture3D?"3d":t.texture.isArrayTexture||t.texture.isDataArrayTexture||t.texture.isCompressedArrayTexture?Bi:"2d",e=s[n]=s.texture.createView({aspect:"all",dimension:a,mipLevelCount:r,baseMipLevel:i})}}a.push({binding:n,resource:e})}else if(t.isSampler){let e=r.get(t.texture);a.push({binding:n,resource:e.sampler})}n++}return i.createBindGroup({label:"bindGroup_"+e.name,layout:t,entries:a})}_createLayoutEntries(e){let t=[],r=0;for(let i of e.bindings){let e=this.backend,n={binding:r,visibility:i.visibility};if(i.isUniformBuffer||i.isStorageBuffer){let e={};i.isStorageBuffer&&(i.visibility&NS.COMPUTE&&(i.access===cL.READ_WRITE||i.access===cL.WRITE_ONLY)?e.type="storage":e.type="read-only-storage"),n.buffer=e}else if(i.isSampledTexture&&i.store){let e={};e.format=this.backend.get(i.texture).texture.format;let t=i.access;t===cL.READ_WRITE?e.access="read-write":t===cL.WRITE_ONLY?e.access="write-only":e.access="read-only",i.texture.isArrayTexture?e.viewDimension=Bi:i.texture.is3DTexture&&(e.viewDimension="3d"),n.storageTexture=e}else if(i.isSampledTexture){let t={},{primarySamples:r}=e.utils.getTextureSampleData(i.texture);if(r>1&&(t.multisampled=!0,i.texture.isDepthTexture||(t.sampleType=Br)),i.texture.isDepthTexture)e.compatibilityMode&&null===i.texture.compareFunction?t.sampleType=Br:t.sampleType="depth";else if(i.texture.isDataTexture||i.texture.isDataArrayTexture||i.texture.isData3DTexture){let e=i.texture.type;1013===e?t.sampleType="sint":1014===e?t.sampleType="uint":1015===e&&(this.backend.hasFeature("float32-filterable")?t.sampleType="float":t.sampleType=Br)}i.isSampledCubeTexture?t.viewDimension=Bn:i.texture.isArrayTexture||i.texture.isDataArrayTexture||i.texture.isCompressedArrayTexture?t.viewDimension=Bi:i.isSampledTexture3D&&(t.viewDimension="3d"),n.texture=t}else if(i.isSampler){let t={};i.texture.isDepthTexture&&(null!==i.texture.compareFunction&&e.hasCompatibility(X.TEXTURE_COMPARE)?t.type="comparison":t.type="non-filtering"),n.sampler=t}else ea(`WebGPUBindingUtils: Unsupported binding "${i}".`);t.push(n),r++}return t}deleteBindGroupData(e){let{backend:t}=this,r=t.get(e);r.layout&&(r.layout.usedTimes--,0===r.layout.usedTimes&&this._bindGroupLayoutCache.delete(r.layoutKey),r.layout=void 0,r.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}}class BV{constructor(e){this.backend=e,this._activePipelines=new WeakMap}setPipeline(e,t){this._activePipelines.get(e)!==t&&(e.setPipeline(t),this._activePipelines.set(e,t))}
737_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){let r,{object:i,material:n,geometry:a,pipeline:s}=e,{vertexProgram:o,fragmentProgram:l}=s,u=this.backend,h=u.device,d=u.utils,c=u.get(s),p=[];for(let t of e.getBindings()){let{layoutGPU:e}=u.get(t).layout;p.push(e)}let f=u.attributeUtils.createShaderVertexBuffers(e);0!==n.blending&&(1!==n.blending||!1!==n.transparent)&&(r=this._getBlending(n));let m={};!0===n.stencilWrite&&(m={compare:this._getStencilCompare(n),failOp:this._getStencilOperation(n.stencilFail),depthFailOp:this._getStencilOperation(n.stencilZFail),passOp:this._getStencilOperation(n.stencilZPass)});let g=this._getColorWriteMask(n),v=[];if(null!==e.context.textures){let t=e.context.textures,i=e.context.mrt;for(let e=0;e<t.length;e++){let n,a=t[e],s=d.getTextureFormatGPU(a);if(null!==i)if(!0!==this.backend.compatibilityMode){let e=i.getBlendMode(a.name);6===e.blending?n=r:0!==e.blending&&(n=this._getBlending(e))}else es("WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets."),n=r;else n=r;v.push({format:s,blend:n,writeMask:g})}}else{let t=d.getCurrentColorFormat(e.context);v.push({format:t,blend:r,writeMask:g})}let y=u.get(o).module,_=u.get(l).module,x=this._getPrimitiveState(i,a,n),b=this._getDepthCompare(n),S=d.getCurrentDepthStencilFormat(e.context),T=this._getSampleCount(e.context),A={label:`renderPipeline_${n.name||n.type}_${n.id}`,vertex:Object.assign({},y,{buffers:f}),fragment:Object.assign({},_,{targets:v}),primitive:x,multisample:{count:T,alphaToCoverageEnabled:n.alphaToCoverage&&T>1},layout:h.createPipelineLayout({bindGroupLayouts:p})},M={},E=e.context.depth,C=e.context.stencil;if((!0===E||!0===C)&&(!0===E&&(M.format=S,M.depthWriteEnabled=n.depthWrite,M.depthCompare=b),!0===C&&(M.stencilFront=m,M.stencilBack=m,M.stencilReadMask=n.stencilFuncMask,M.stencilWriteMask=n.stencilWriteMask),!0===n.polygonOffset&&(M.depthBias=n.polygonOffsetUnits,M.depthBiasSlopeScale=n.polygonOffsetFactor,M.depthBiasClamp=0),A.depthStencil=M),h.pushErrorScope("validation"),null===t)c.pipeline=h.createRenderPipeline(A),h.popErrorScope().then(e=>{null!==e&&(c.error=!0,ea(e.message))});else{let e=new Promise(async e=>{try{c.pipeline=await h.createRenderPipelineAsync(A)}catch(e){}let t=await h.popErrorScope();null!==t&&(c.error=!0,ea(t.message)),e()});t.push(e)}}createBundleEncoder(e,t="renderBundleEncoder"){let{utils:r,device:i}=this.backend,n=r.getCurrentDepthStencilFormat(e),a=r.getCurrentColorFormats(e),s=this._getSampleCount(e);return i.createRenderBundleEncoder({label:t,colorFormats:a,depthStencilFormat:n,sampleCount:s})}createComputePipeline(e,t){let r=this.backend,i=r.device,n=r.get(e.computeProgram).module,a=r.get(e),s=[];for(let e of t){let{layoutGPU:t}=r.get(e).layout;s.push(t)}a.pipeline=i.createComputePipeline({compute:n,layout:i.createPipelineLayout({bindGroupLayouts:s})})}_getBlending(e){let t,r,i=e.blending,n=e.blendSrc,a=e.blendDst,s=e.blendEquation;if(5===i){let i=null!==e.blendSrcAlpha?e.blendSrcAlpha:n,o=null!==e.blendDstAlpha?e.blendDstAlpha:a,l=null!==e.blendEquationAlpha?e.blendEquationAlpha:s;t={srcFactor:this._getBlendFactor(n),dstFactor:this._getBlendFactor(a),operation:this._getBlendOperation(s)},r={srcFactor:this._getBlendFactor(i),dstFactor:this._getBlendFactor(o),operation:this._getBlendOperation(l)}}else{let n=e.premultipliedAlpha,a=(e,i,n,a)=>{t={srcFactor:e,dstFactor:i,operation:"add"},r={srcFactor:n,dstFactor:a,operation:"add"}};if(n)switch(i){case 1:a("one",Bt,"one",Bt);break;case 2:a("one","one","one","one");break;case 3:a(L9,L7,L9,"one");break;case 4:a("dst",Bt,L9,"one")}else switch(i){case 1:a(Be,Bt,"one",Bt);break;case 2:a(Be,"one","one","one");break;case 3:ea(`WebGPURenderer: "SubtractiveBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`);break;case 4:ea(`WebGPURenderer: "MultiplyBlending" requires "${e.isMaterial?"material":"blendMode"}.premultipliedAlpha = true".`)}}if(void 0!==t&&void 0!==r)return{color:t,alpha:r};ea("WebGPURenderer: Invalid blending: ",i)}_getBlendFactor(e){let t;switch(e){case 200:t=L9;break;case 201:t="one";break;case 202:t="src";break;case 203:t=L7;break;case 204:t=Be;break;case 205:t=Bt;break;case 208:t="dst";break;case 209:t="one-minus-dst";break;case 206:t="dst-alpha";break;case 207:t="one-minus-dst-alpha";break;case 210:t="src-alpha-saturated";break;case 211:t="constant";break;case 212:t="one-minus-constant";break;default:ea("WebGPURenderer: Blend factor not supported.",e)}return t}_getStencilCompare(e){let t,r=e.stencilFunc;switch(r){case 512:t=NT;break;case 519:t=NN;break;case 513:t=NA;break;case 515:t=NE;break;case 514:t=NM;break;case 518:t=NR;break;case 516:t=NC;break;case 517:t=Nw;break;default:ea("WebGPURenderer: Invalid stencil function.",r)}return t}_getStencilOperation(e){let t;switch(e){case 7680:t="keep";break;case 0:t="zero";break;case 7681:t="replace";break;case 5386:t="invert";break;case 7682:t="increment-clamp";break;case 7683:t="decrement-clamp";break;case 34055:t="increment-wrap";break;case 34056:t="decrement-wrap";break;default:ea("WebGPURenderer: Invalid stencil operation.",t)}return t}_getBlendOperation(e){let t;switch(e){case 100:t="add";break;case 101:t="subtract";break;case 102:t="reverse-subtract";break;case 103:t="min";break;case 104:t="max";break;default:ea("WebGPUPipelineUtils: Blend equation not supported.",e)}return t}_getPrimitiveState(e,t,r){let i={};i.topology=this.backend.utils.getPrimitiveTopology(e,r),null!==t.index&&!0===e.isLine&&!0!==e.isLineSegments&&(i.stripIndexFormat=t.index.array instanceof Uint16Array?NP:NF);let n=1===r.side;return e.isMesh&&0>e.matrixWorld.determinant()&&(n=!n),i.frontFace=!0===n?"cw":"ccw",i.cullMode=2===r.side?"none":"back",i}
737_getColorWriteMask(e){return 15*(!0===e.colorWrite)}_getDepthCompare(e){let t;if(!1===e.depthTest)t=NN;else{let r=this.backend.parameters.reversedDepthBuffer?el[e.depthFunc]:e.depthFunc;switch(r){case 0:t=NT;break;case 1:t=NN;break;case 2:t=NA;break;case 3:t=NE;break;case 4:t=NM;break;case 5:t=NR;break;case 6:t=NC;break;case 7:t=Nw;break;default:ea("WebGPUPipelineUtils: Invalid depth function.",r)}}return t}}class Bz extends N_{constructor(e,t,r=2048){super(r),this.device=e,this.type=t,this.querySet=this.device.createQuerySet({type:"timestamp",count:this.maxQueries,label:`queryset_global_timestamp_${t}`});const i=8*this.maxQueries;this.resolveBuffer=this.device.createBuffer({label:`buffer_timestamp_resolve_${t}`,size:i,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.resultBuffer=this.device.createBuffer({label:`buffer_timestamp_result_${t}`,size:i,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ})}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return es(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||0===this.currentQueryIndex||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if("unmapped"!==this.resultBuffer.mapState)return this.lastValue;let e=new Map(this.queryOffsets),t=this.currentQueryIndex,r=8*t;this.currentQueryIndex=0,this.queryOffsets.clear();let i=this.device.createCommandEncoder();i.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),i.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,r);let n=i.finish();if(this.device.queue.submit([n]),"unmapped"!==this.resultBuffer.mapState)return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,r),this.isDisposed)return"mapped"===this.resultBuffer.mapState&&this.resultBuffer.unmap(),this.lastValue;let a=new BigUint64Array(this.resultBuffer.getMappedRange(0,r)),s={},o=[];for(let[t,r]of e){let e=t.match(/^(.*):f(\d+)$/),i=parseInt(e[2]);!1===o.includes(i)&&o.push(i),void 0===s[i]&&(s[i]=0);let n=a[r],l=a[r+1],u=Number(l-n)/1e6;this.timestamps.set(t,u),s[i]+=u}let l=s[o[o.length-1]];return this.resultBuffer.unmap(),this.lastValue=l,this.frames=o,l}catch(e){return ea("Error resolving queries:",e),"mapped"===this.resultBuffer.mapState&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){ea("Error waiting for pending resolve:",e)}if(this.resultBuffer&&"mapped"===this.resultBuffer.mapState)try{this.resultBuffer.unmap()}catch(e){ea("Error unmapping buffer:",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}}class BH extends Ni{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=void 0===e.alpha||e.alpha,this.parameters.requiredLimits=void 0===e.requiredLimits?{}:e.requiredLimits,this.compatibilityMode=null,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new BP(this),this.attributeUtils=new BO(this),this.bindingUtils=new Bk(this),this.pipelineUtils=new BV(this),this.textureUtils=new Bg(this),this.occludedResolveCache=new Map;const t="u"<typeof navigator||!1===/Android/.test(navigator.userAgent);this._compatibility={[X.TEXTURE_COMPARE]:t}}async init(e){let t;await super.init(e);let r=this.parameters;if(void 0===r.device){let e={powerPreference:r.powerPreference,featureLevel:"compatibility"},i="u">typeof navigator?await navigator.gpu.requestAdapter(e):null;if(null===i)throw Error("WebGPUBackend: Unable to create WebGPU adapter.");let n=Object.values(Bo),a=[];for(let e of n)i.features.has(e)&&a.push(e);let s={requiredFeatures:a,requiredLimits:r.requiredLimits};t=await i.requestDevice(s)}else t=r.device;this.compatibilityMode=!t.features.has("core-features-and-limits"),this.compatibilityMode&&(e._samples=0),t.lost.then(t=>{if("destroyed"===t.reason)return;let r={api:"WebGPU",message:t.message||"Unknown reason",reason:t.reason||null,originalEvent:t};e.onDeviceLost(r)}),this.device=t,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(Bo.TimestampQuery),this.updateSize()}get context(){let e=this.renderer.getCanvasTarget(),t=this.get(e),r=t.context;if(void 0===r){let i=this.parameters;r=!0===e.isDefaultCanvasTarget&&void 0!==i.context?i.context:e.domElement.getContext("webgpu"),"setAttribute"in e.domElement&&e.domElement.setAttribute("data-engine","three.js r183 webgpu");let n=i.alpha?"premultiplied":"opaque",a=1016===i.outputType?"extended":"standard";r.configure({device:this.device,format:this.utils.getPreferredCanvasF
737ormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:n,toneMapping:{mode:a}}),t.context=r}return r}get coordinateSystem(){return 2001}async getArrayBufferAsync(e){return await this.attributeUtils.getArrayBufferAsync(e)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){let e=this.renderer,t=e.getCanvasTarget(),r=this.get(t),i=e.currentSamples,n=r.descriptor;if(void 0===n||r.samples!==i){n={colorAttachments:[{view:null}]},(!0===e.depth||!0===e.stencil)&&(n.depthStencilAttachment={view:this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView()});let t=n.colorAttachments[0];i>0?t.view=this.textureUtils.getColorBuffer().createView():t.resolveTarget=void 0,r.descriptor=n,r.samples=i}let a=n.colorAttachments[0];return i>0?a.resolveTarget=this.context.getCurrentTexture().createView():a.view=this.context.getCurrentTexture().createView(),n}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.image.depth>1&&e.camera.isArrayCamera}_getRenderPassDescriptor(e,t={}){let r=e.renderTarget,i=this.get(r),n=i.descriptors;(void 0===n||i.width!==r.width||i.height!==r.height||i.samples!==r.samples)&&(i.descriptors=n={});let a=e.getCacheKey(),s=n[a];if(void 0===s){let t,o=e.textures,l=[],u=this._isRenderCameraDepthArray(e);for(let i=0;i<o.length;i++){let n=this.get(o[i]),a={label:`colorAttachment_${i}`,baseMipLevel:e.activeMipmapLevel,mipLevelCount:1,baseArrayLayer:e.activeCubeFace,arrayLayerCount:1,dimension:"2d"};if(r.isRenderTarget3D)t=e.activeCubeFace,a.baseArrayLayer=0,a.dimension="3d",a.depthOrArrayLayers=o[i].image.depth;else if(r.isRenderTarget&&o[i].image.depth>1)if(!0===u){let t=e.camera.cameras;for(let e=0;e<t.length;e++){let t={...a,baseArrayLayer:e,arrayLayerCount:1,dimension:"2d"},r=n.texture.createView(t);l.push({view:r,resolveTarget:void 0,depthSlice:void 0})}}else a.dimension=Bi,a.depthOrArrayLayers=o[i].image.depth;if(!0!==u){let e,r,i=n.texture.createView(a);void 0!==n.msaaTexture?(e=n.msaaTexture.createView(),r=i):(e=i,r=void 0),l.push({view:e,resolveTarget:r,depthSlice:t})}}if(s={textureViews:l},e.depth){let t=this.get(e.depthTexture),r={};(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(r.dimension="2d",r.arrayLayerCount=1,r.baseArrayLayer=e.activeCubeFace),s.depthStencilView=t.texture.createView(r)}n[a]=s,i.width=r.width,i.height=r.height,i.samples=r.samples,i.activeMipmapLevel=e.activeMipmapLevel,i.activeCubeFace=e.activeCubeFace}let o={colorAttachments:[]};for(let e=0;e<s.textureViews.length;e++){let r=s.textureViews[e],i={r:0,g:0,b:0,a:1};0===e&&t.clearValue&&(i=t.clearValue),o.colorAttachments.push({view:r.view,depthSlice:r.depthSlice,resolveTarget:r.resolveTarget,loadOp:t.loadOp||NB,storeOp:t.storeOp||NL,clearValue:i})}return s.depthStencilView&&(o.depthStencilAttachment={view:s.depthStencilView}),o}beginRender(e){let t,r,i=this.get(e),n=this.device,a=e.occlusionQueryCount;a>0&&(i.currentOcclusionQuerySet&&i.currentOcclusionQuerySet.destroy(),i.currentOcclusionQueryBuffer&&i.currentOcclusionQueryBuffer.destroy(),i.currentOcclusionQuerySet=i.occlusionQuerySet,i.currentOcclusionQueryBuffer=i.occlusionQueryBuffer,i.currentOcclusionQueryObjects=i.occlusionQueryObjects,i.occlusionQuerySet=t=n.createQuerySet({type:"occlusion",count:a,label:`occlusionQuerySet_${e.id}`}),i.occlusionQueryIndex=0,i.occlusionQueryObjects=Array(a),i.lastOcclusionObject=null),r=null===e.textures?this._getDefaultRenderPassDescriptor():this._getRenderPassDescriptor(e,{loadOp:NB}),this.initTimestampQuery(H.RENDER,this.getTimestampUID(e),r),r.occlusionQuerySet=t;let s=r.depthStencilAttachment;if(null!==e.textures){let t=r.colorAttachments;for(let r=0;r<t.length;r++){let i=t[r];e.clearColor?(i.clearValue=0===r?e.clearColorValue:{r:0,g:0,b:0,a:1},i.loadOp=NI):i.loadOp=NB,i.storeOp=NL}}else{let t=r.colorAttachments[0];e.clearColor?(t.clearValue=e.clearColorValue,t.loadOp=NI):t.loadOp=NB,t.storeOp=NL}e.depth&&(e.clearDepth?(s.depthClearValue=e.clearDepthValue,s.depthLoadOp=NI):s.depthLoadOp=NB,s.depthStoreOp=NL),e.stencil&&(e.clearStencil?(s.stencilClearValue=e.clearStencilValue,s.stencilLoadOp=NI):s.stencilLoadOp=NB,s.stencilStoreOp=NL);let o=n.createCommandEncoder({label:"renderContext_"+e.id});if(!0===this._isRenderCameraDepthArray(e)){let t=e.camera.cameras;i.layerDescriptors&&i.layerDescriptors.length===t.length?this._updateDepthLayerDescriptors(e,i,t):this._createDepthLayerDescriptors(e,i,r,t),i.bundleEncoders=[],i.bundleSets=[];for(let r=0;r<t.length;r++){let t=this.pipelineUtils.createBundleEncoder(e,"renderBundleArrayCamera_"+r),n={attributes:{},bindingGroups:[],pipeline:null,index:null};i.bundleEncoders.push(t),i.bundleSets.push(n)}i.currentPass=null}else i.currentPass=o.beginRenderPass(r),e.viewport&&this.updateViewport(e),e.scissor&&this.updateScissor(e);i.descriptor=r,i.encoder=o,i.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},i.renderBundles=[]}_createDepthLayerDescriptors(e,t,r,i){let n=r.depthStencilAttachment;t.layerDescriptors=[];let a=this.get(e.depthTexture);a.viewCache||(a.viewCache=[]);for(let s=0;s<i.length;s++){let i={...r,colorAttachments:[{...r.colorAttachments[0],view:r.colorAttachments[s].view}]};if(r.depthStencilAttachment){let t=s;a.viewCache[t]||(a.viewCache[t]=a.texture.createView({dimension:"2d",baseArrayLayer:s,arrayLayerCount:1})),i.depthStencilAttachment={view:a.viewCache[t],depthLoadOp:n.depthLoadOp||NI,depthStoreOp:n.depthStoreOp||NL,depthClearValue:n.depthClearValue||1},e.stencil&&(i.depthStencilAttachment.stencilLoadOp=n.stencilLoadOp,i.depthStencilAttachment.stencilStoreOp=n.stencilStoreOp,i.depthStencilAttachment.stencilClearValue=n.stencilClearValue)}else i.depthStencilAttachment={...n};t.layerDescriptors.push(i)}}_updateDepthLayerDescriptors(e,t,r){for(let i=0;i<r.length;i++){let r=t.layerDescriptors[i];if(r.depthStencilAttachment){let t=r.depthStencilAttachment;e.depth&&(e.clearDepth?(t.depthClearValue=e.clearDepthValue,t.depthLoadOp=NI):t.depthLoadOp=NB),e.stencil&&(e.clearStencil?(t.stencilClearValue=e.clearStencilValue,t.stencilLoadOp=NI):t.stencilLoadOp=NB)}}}finishRender(e){let t=this.get(e),r=e.occlusionQueryCount;t.renderBundles.length>0&&t.currentPass.executeBundles(t.renderBundles),r>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();let i=t.encoder;if(!0===this._isRenderCameraDepthArray(e)){let r=[];for(let e=0;e<t.bundleEncoders.length;e++){let i=t.bundleEncoders[e];r.push(i.finish())}for(let n=0;n<t.layerDescriptors.length;n++)if(n<r.length){let a=t.layerDescriptors[n],s=i.beginRenderPass(a);if(e.viewport){let{x:t,y:r,width:i,height:n,minDepth:a,maxDepth:o}=e.viewportValue;
737s.setViewport(t,r,i,n,a,o)}if(e.scissor){let{x:t,y:r,width:i,height:n}=e.scissorValue;s.setScissorRect(t,r,i,n)}s.executeBundles([r[n]]),s.end()}}else t.currentPass&&t.currentPass.end();if(r>0){let i=8*r,n=this.occludedResolveCache.get(i);void 0===n&&(n=this.device.createBuffer({size:i,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),this.occludedResolveCache.set(i,n));let a=this.device.createBuffer({size:i,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});t.encoder.resolveQuerySet(t.occlusionQuerySet,0,r,n,0),t.encoder.copyBufferToBuffer(n,0,a,0,i),t.occlusionQueryBuffer=a,this.resolveOccludedAsync(e)}if(this.device.queue.submit([t.encoder.finish()]),null!==e.textures){let t=e.textures;for(let e=0;e<t.length;e++){let r=t[e];!0===r.generateMipmaps&&this.textureUtils.generateMipmaps(r)}}}isOccluded(e,t){let r=this.get(e);return r.occluded&&r.occluded.has(t)}async resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueryBuffer:r,currentOcclusionQueryObjects:i}=t;if(r&&i){let e=new WeakSet;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueryBuffer=null,await r.mapAsync(GPUMapMode.READ);let n=new BigUint64Array(r.getMappedRange());for(let t=0;t<i.length;t++)n[t]===BigInt(0)&&e.add(i[t]);r.destroy(),t.occluded=e}}updateViewport(e){let{currentPass:t}=this.get(e),{x:r,y:i,width:n,height:a,minDepth:s,maxDepth:o}=e.viewportValue;t.setViewport(r,i,n,a,s,o)}updateScissor(e){let{currentPass:t}=this.get(e),{x:r,y:i,width:n,height:a}=e.scissorValue;t.setScissorRect(r,i,n,a)}getClearColor(){let e=super.getClearColor();return!0===this.renderer.alpha&&(e.r*=e.a,e.g*=e.a,e.b*=e.a),e}clear(e,t,r,i=null){let n,a,s,o,l=this.device,u=this.renderer,h=[];if(e){let e=this.getClearColor();a={r:e.r,g:e.g,b:e.b,a:e.a}}if(null===i){s=u.depth,o=u.stencil;let t=this._getDefaultRenderPassDescriptor();if(e){let e=(h=t.colorAttachments)[0];e.clearValue=a,e.loadOp=NI,e.storeOp=NL}(s||o)&&(n=t.depthStencilAttachment)}else{s=i.depth,o=i.stencil;let l={loadOp:e?NI:NB,clearValue:e?a:void 0};s&&(l.depthLoadOp=t?NI:NB,l.depthClearValue=t?u.getClearDepth():void 0,l.depthStoreOp=NL),o&&(l.stencilLoadOp=r?NI:NB,l.stencilClearValue=r?u.getClearStencil():void 0,l.stencilStoreOp=NL);let d=this._getRenderPassDescriptor(i,l);h=d.colorAttachments,n=d.depthStencilAttachment}s&&n&&(t?(n.depthLoadOp=NI,n.depthClearValue=u.getClearDepth()):n.depthLoadOp=NB,n.depthStoreOp=NL),o&&n&&(r?(n.stencilLoadOp=NI,n.stencilClearValue=u.getClearStencil()):n.stencilLoadOp=NB,n.stencilStoreOp=NL);let d=l.createCommandEncoder({label:"clear"});d.beginRenderPass({colorAttachments:h,depthStencilAttachment:n}).end(),l.queue.submit([d.finish()])}beginCompute(e){let t=this.get(e),r={label:"computeGroup_"+e.id};this.initTimestampQuery(H.COMPUTE,this.getTimestampUID(e),r),t.cmdEncoderGPU=this.device.createCommandEncoder({label:"computeGroup_"+e.id}),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(r)}compute(e,t,r,i,n=null){let a=this.get(t),{passEncoderGPU:s}=this.get(e),o=this.get(i).pipeline;this.pipelineUtils.setPipeline(s,o);for(let e=0,t=r.length;e<t;e++){let t=r[e],i=this.get(t);s.setBindGroup(e,i.group)}if(null===n&&(n=t.count),n&&"object"==typeof n&&n.isIndirectStorageBufferAttribute){let e=this.get(n).buffer;s.dispatchWorkgroupsIndirect(e,0);return}if("number"==typeof n){let e=n;if(void 0===a.dispatchSize||a.count!==e){a.dispatchSize=[0,1,1],a.count=e;let r=t.workgroupSize,i=r[0];for(let e=1;e<r.length;e++)i*=r[e];let s=Math.ceil(e/i),o=this.device.limits.maxComputeWorkgroupsPerDimension;n=[s,1,1],s>o&&(n[0]=Math.min(s,o),n[1]=Math.ceil(s/o)),a.dispatchSize=n}n=a.dispatchSize}s.dispatchWorkgroups(n[0],n[1]||1,n[2]||1)}finishCompute(e){let t=this.get(e);t.passEncoderGPU.end(),this.device.queue.submit([t.cmdEncoderGPU.finish()])}draw(e,t){let{object:r,material:i,context:n,pipeline:a}=e,s=e.getBindings(),o=this.get(n),l=this.get(a),u=l.pipeline;if(!0===l.error)return;let h=e.getIndex(),d=null!==h,c=e.getDrawParameters();if(null===c)return;let p=(t,r)=>{this.pipelineUtils.setPipeline(t,u),r.pipeline=u;let a=r.bindingGroups;for(let e=0,r=s.length;e<r;e++){let r=s[e],i=this.get(r);a[r.index]!==r.id&&(t.setBindGroup(r.index,i.group),a[r.index]=r.id)}if(!0===d&&r.index!==h){let e=this.get(h).buffer,i=h.array instanceof Uint16Array?NP:NF;t.setIndexBuffer(e,i),r.index=h}let l=e.getVertexBuffers();for(let e=0,i=l.length;e<i;e++){let i=l[e];
737if(r.attributes[e]!==i){let n=this.get(i).buffer;t.setVertexBuffer(e,n),r.attributes[e]=i}}!0===n.stencil&&!0===i.stencilWrite&&o.currentStencilRef!==i.stencilRef&&(t.setStencilReference(i.stencilRef),o.currentStencilRef=i.stencilRef)},f=(n,a)=>{if(p(n,a),!0===r.isBatchedMesh){let e=r._multiDrawStarts,a=r._multiDrawCounts,s=r._multiDrawCount,o=r._multiDrawInstances;null!==o&&es("WebGPUBackend: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.");let l=!0===d?h.array.BYTES_PER_ELEMENT:1;i.wireframe&&(l=r.geometry.attributes.position.count>65535?4:2);for(let i=0;i<s;i++){let s=o?o[i]:1,u=s>1?0:i;!0===d?n.drawIndexed(a[i],s,e[i]/l,0,u):n.draw(a[i],s,e[i],u),t.update(r,a[i],s)}}else if(!0===d){let{vertexCount:i,instanceCount:a,firstVertex:s}=c,o=e.getIndirect();if(null!==o){let t=this.get(o).buffer,r=e.getIndirectOffset(),i=Array.isArray(r)?r:[r];for(let e=0;e<i.length;e++)n.drawIndexedIndirect(t,i[e])}else n.drawIndexed(i,a,s,0,0);t.update(r,i,a)}else{let{vertexCount:i,instanceCount:a,firstVertex:s}=c,o=e.getIndirect();if(null!==o){let t=this.get(o).buffer,r=e.getIndirectOffset(),i=Array.isArray(r)?r:[r];for(let e=0;e<i.length;e++)n.drawIndirect(t,i[e])}else n.draw(i,a,s,0);t.update(r,i,a)}};if(e.camera.isArrayCamera&&e.camera.cameras.length>0){let t=this.get(e.camera),i=e.camera.cameras,a=e.getBindingGroup("cameraIndex");if(void 0===t.indexesGPU||t.indexesGPU.length!==i.length){let e=this.get(a),r=[],n=new Uint32Array([0,0,0,0]);for(let t=0,a=i.length;t<a;t++){n[0]=t;let{layoutGPU:i}=e.layout,a=this.bindingUtils.createBindGroupIndex(n,i);r.push(a)}t.indexesGPU=r}let s=this.renderer.getPixelRatio();for(let e=0,l=i.length;e<l;e++){let l=i[e];if(r.layers.test(l.layers)){let r=l.viewport,i=o.currentPass,u=o.currentSets;if(o.bundleEncoders){let t=o.bundleEncoders[e],r=o.bundleSets[e];i=t,u=r}r&&i.setViewport(Math.floor(r.x*s),Math.floor(r.y*s),Math.floor(r.width*s),Math.floor(r.height*s),n.viewportValue.minDepth,n.viewportValue.maxDepth),a&&t.indexesGPU&&(i.setBindGroup(a.index,t.indexesGPU[e]),u.bindingGroups[a.index]=a.id),f(i,u)}}}else if(o.currentPass){if(void 0!==o.occlusionQuerySet){let e=o.lastOcclusionObject;e!==r&&(null!==e&&!0===e.occlusionTest&&(o.currentPass.endOcclusionQuery(),o.occlusionQueryIndex++),!0===r.occlusionTest&&(o.currentPass.beginOcclusionQuery(o.occlusionQueryIndex),o.occlusionQueryObjects[o.occlusionQueryIndex]=r),o.lastOcclusionObject=r)}f(o.currentPass,o.currentSets)}}needsRenderUpdate(e){let t=this.get(e),{object:r,material:i}=e,n=this.utils,a=n.getSampleCountRenderContext(e.context),s=n.getCurrentColorSpace(e.context),o=n.getCurrentColorFormat(e.context),l=n.getCurrentDepthStencilFormat(e.context),u=n.getPrimitiveTopology(r,i),h=!1;return(t.material!==i||t.materialVersion!==i.version||t.transparent!==i.transparent||t.blending!==i.blending||t.premultipliedAlpha!==i.premultipliedAlpha||t.blendSrc!==i.blendSrc||t.blendDst!==i.blendDst||t.blendEquation!==i.blendEquation||t.blendSrcAlpha!==i.blendSrcAlpha||t.blendDstAlpha!==i.blendDstAlpha||t.blendEquationAlpha!==i.blendEquationAlpha||t.colorWrite!==i.colorWrite||t.depthWrite!==i.depthWrite||t.depthTest!==i.depthTest||t.depthFunc!==i.depthFunc||t.stencilWrite!==i.stencilWrite||t.stencilFunc!==i.stencilFunc||t.stencilFail!==i.stencilFail||t.stencilZFail!==i.stencilZFail||t.stencilZPass!==i.stencilZPass||t.stencilFuncMask!==i.stencilFuncMask||t.stencilWriteMask!==i.stencilWriteMask||t.side!==i.side||t.alphaToCoverage!==i.alphaToCoverage||t.sampleCount!==a||t.colorSpace!==s||t.colorFormat!==o||t.depthStencilFormat!==l||t.primitiveTopology!==u||t.clippingContextCacheKey!==e.clippingContextCacheKey)&&(t.material=i,t.materialVersion=i.version,t.transparent=i.transparent,t.blending=i.blending,t.premultipliedAlpha=i.premultipliedAlpha,t.blendSrc=i.blendSrc,t.blendDst=i.blendDst,t.blendEquation=i.blendEquation,t.blendSrcAlpha=i.blendSrcAlpha,t.blendDstAlpha=i.blendDstAlpha,t.blendEquationAlpha=i.blendEquationAlpha,t.colorWrite=i.colorWrite,t.depthWrite=i.depthWrite,t.depthTest=i.depthTest,t.depthFunc=i.depthFunc,t.stencilWrite=i.stencilWrite,t.stencilFunc=i.stencilFunc,t.stencilFail=i.stencilFail,t.stencilZFail=i.stencilZFail,t.stencilZPass=i.stencilZPass,t.stencilFuncMask=i.stencilFuncMask,t.stencilWriteMask=i.stencilWriteMask,t.side=i.side,t.alphaToCoverage=i.alphaToCoverage,t.sampleC
737ount=a,t.colorSpace=s,t.colorFormat=o,t.depthStencilFormat=l,t.primitiveTopology=u,t.clippingContextCacheKey=e.clippingContextCacheKey,h=!0),h}getRenderCacheKey(e){let{object:t,material:r}=e,i=this.utils,n=e.context,a=t.isMesh&&0>t.matrixWorld.determinant();return[r.transparent,r.blending,r.premultipliedAlpha,r.blendSrc,r.blendDst,r.blendEquation,r.blendSrcAlpha,r.blendDstAlpha,r.blendEquationAlpha,r.colorWrite,r.depthWrite,r.depthTest,r.depthFunc,r.stencilWrite,r.stencilFunc,r.stencilFail,r.stencilZFail,r.stencilZPass,r.stencilFuncMask,r.stencilWriteMask,r.side,a,i.getSampleCountRenderContext(n),i.getCurrentColorSpace(n),i.getCurrentColorFormat(n),i.getCurrentDepthStencilFormat(n),i.getPrimitiveTopology(t,r),e.getGeometryCacheKey(),e.clippingContextCacheKey].join()}updateSampler(e){return this.textureUtils.updateSampler(e)}createDefaultTexture(e){return this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,r,i,n,a){return this.textureUtils.copyTextureToBuffer(e,t,r,i,n,a)}initTimestampQuery(e,t,r){if(!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new Bz(this.device,e,2048));let i=this.timestampQueryPool[e],n=i.allocateQueriesForContext(t);r.timestampWrites={querySet:i.querySet,beginningOfPassWriteIndex:n,endOfPassWriteIndex:n+1}}createNodeBuilder(e,t){return new BI(e,t)}createProgram(e){this.get(e).module={module:this.device.createShaderModule({code:e.code,label:e.stage+(""!==e.name?`_${e.name}`:"")}),entryPoint:"main"}}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){this.pipelineUtils.createRenderPipeline(e,t)}createComputePipeline(e,t){this.pipelineUtils.createComputePipeline(e,t)}beginBundle(e){let t=this.get(e);t._currentPass=t.currentPass,t._currentSets=t.currentSets,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.currentPass=this.pipelineUtils.createBundleEncoder(e)}finishBundle(e,t){let r=this.get(e),i=r.currentPass.finish();this.get(t).bundleGPU=i,r.currentSets=r._currentSets,r.currentPass=r._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createBindings(e,t,r,i){this.bindingUtils.createBindings(e,t,r,i)}updateBindings(e,t,r,i){this.bindingUtils.createBindings(e,t,r,i)}updateBinding(e){this.bindingUtils.updateBinding(e)}deleteBindGroupData(e){this.bindingUtils.deleteBindGroupData(e)}createIndexAttribute(e){let t=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST;(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t|=GPUBufferUsage.STORAGE),this.attributeUtils.createAttribute(e,t)}createAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createIndirectStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}updateSize(){this.delete(this.renderer.getCanvasTarget())}getMaxAnisotropy(){return 16}hasFeature(e){return void 0!==Bl[e]&&(e=Bl[e]),this.device.features.has(e)}copyTextureToTexture(e,t,r=null,i=null,n=0,a=0){let s=0,o=0,l=0,u=0,h=0,d=0,c=e.image.width,p=e.image.height,f=1;null!==r&&(!0===r.isBox3?(u=r.min.x,h=r.min.y,d=r.min.z,c=r.max.x-r.min.x,p=r.max.y-r.min.y,f=r.max.z-r.min.z):(u=r.min.x,h=r.min.y,c=r.max.x-r.min.x,p=r.max.y-r.min.y,f=1)),null!==i&&(s=i.x,o=i.y,l=i.z||0);let m=this.device.createCommandEncoder({label:"copyTextureToTexture_"+e.id+"_"+t.id}),g=this.get(e).texture,v=this.get(t).texture;m.copyTextureToTexture({texture:g,mipLevel:n,origin:{x:u,y:h,z:d}},{texture:v,mipLevel:a,origin:{x:s,y:o,z:l}},[c,p,f]),this.device.queue.submit([m.finish()]),0===a&&t.generateMipmaps&&this.textureUtils.generateMipmaps(t)}copyFramebufferToTexture(e,t,r){let i,n=this.get(t),a=null;a=t.renderTarget?e.isDepthTexture?this.get(t.depthTexture).texture:this.get(t.textures[0]).texture:e.isDepthTexture?this.textureUtils.getDepthBuffer(t.depth,t.stencil):this.context.getCurrentTexture();let s=this.get(e).texture;if(a.format!==s.format)return void ea("WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.",a.format,s.format);if(n.currentPass?(n.currentPass.end(),i=n.encoder):i=this.device.createCommandEncoder({label:"copyFramebufferToTexture_"+e.id}),i.copyTextureToTexture({texture:a,origin:[r.x,r.y,0]},{texture:s},[r.z,r.w]),e.generateMipmaps&&this.textureUtils.generateMipmaps(e,i),n.currentPass){let{descriptor:e}=n;for(let t=0;t<e.colorAttachments.length;t++)e.colorAttachments[t].loadOp=NB;t.depth&&(e.depthStencilAttachment.depthLoadOp=NB),t.stencil&&(e.depthStencilAttachment.stencilLoadOp=NB),n.currentPass=i.beginRenderPass(e),n.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.viewport&&this.updateViewport(t),t.scissor&&this.updateScissor(t)}
737else this.device.queue.submit([i.finish()])}hasCompatibility(e){return void 0!==this._compatibility[X.TEXTURE_COMPARE]?this._compatibility[X.TEXTURE_COMPARE]:super.hasCompatibility(e)}dispose(){if(this.bindingUtils.dispose(),this.textureUtils.dispose(),this.occludedResolveCache){for(let e of this.occludedResolveCache.values())e.destroy();this.occludedResolveCache.clear()}if(this.timestampQueryPool)for(let e of Object.values(this.timestampQueryPool))null!==e&&e.dispose();void 0===this.parameters.device&&null!==this.device&&this.device.destroy()}}class BW extends sR{constructor(e,t,r,i,n,a){super(e,t,r,i,n,a),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}}class Bj extends sR{constructor(e,t,r,i,n,a){super(e,t,r,i,n,a),this.aspect=null}copy(e,t){return super.copy(e,t),this.aspect=e.aspect,this}}class BX extends R_{constructor(){super(),this.addMaterial(bR,"MeshPhongMaterial"),this.addMaterial(Te,"MeshStandardMaterial"),this.addMaterial(Tr,"MeshPhysicalMaterial"),this.addMaterial(Tl,"MeshToonMaterial"),this.addMaterial(bx,"MeshBasicMaterial"),this.addMaterial(bC,"MeshLambertMaterial"),this.addMaterial(bo,"MeshNormalMaterial"),this.addMaterial(Td,"MeshMatcapMaterial"),this.addMaterial(bt,"LineBasicMaterial"),this.addMaterial(bi,"LineDashedMaterial"),this.addMaterial(Ty,"PointsMaterial"),this.addMaterial(Tm,"SpriteMaterial"),this.addMaterial(TS,"ShadowMaterial"),this.addLight(CI,sL),this.addLight(w2,sP),this.addLight(Rr,sD),this.addLight(w4,sR),this.addLight(w1,sF),this.addLight(w3,sm),this.addLight(w8,sO),this.addLight(w5,BW),this.addLight(w9,Bj),this.addToneMapping(MW,1),this.addToneMapping(Mj,2),this.addToneMapping(MX,3),this.addToneMapping(M$,4),this.addToneMapping(MQ,6),this.addToneMapping(MZ,7)}}class Bq extends Rz{constructor(e={}){let t;e.forceWebGL?t=Nb:(t=BH,e.getFallback=()=>(en("WebGPURenderer: WebGPU is not available, running under WebGL2 backend."),new Nb(e))),super(new t(e),e),this.library=new BX,this.isWebGPURenderer=!0,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}}class B$ extends td{constructor(){super(),this.isBundleGroup=!0,this.type="BundleGroup",this.static=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}}class BJ{constructor(e,t=pz(0,0,1,1)){this.renderer=e,this.outputNode=t,this.outputColorTransform=!0,this.needsUpdate=!0;const r=new x7;r.name="RenderPipeline",this._quadMesh=new A6(r),this._quadMesh.name="Render Pipeline",this._context=null}render(){let e=this.renderer;this._update(),null!==this._context.onBeforeRenderPipeline&&this._context.onBeforeRenderPipeline();let t=e.toneMapping,r=e.outputColorSpace;e.toneMapping=0,e.outputColorSpace=eN.workingColorSpace;let i=e.xr.enabled;e.xr.enabled=!1,this._quadMesh.render(e),e.xr.enabled=i,e.toneMapping=t,e.outputColorSpace=r,null!==this._context.onAfterRenderPipeline&&this._context.onAfterRenderPipeline()}get context(){return this._context}dispose(){this._quadMesh.material.dispose()}_update(){if(!0===this.needsUpdate){let e=this.renderer,t=e.toneMapping,r=e.outputColorSpace,i={renderPipeline:this,onBeforeRenderPipeline:null,onAfterRenderPipeline:null},n=this.outputNode;!0===this.outputColorTransform?n=g0(n=n.context(i),t,r):(i.toneMapping=t,i.outputColorSpace=r,n=n.context(i)),this._context=i,this._quadMesh.material.fragmentNode=n,this._quadMesh.material.needsUpdate=!0,this.needsUpdate=!1}}async renderAsync(){es('RenderPipeline: "renderAsync()" has been deprecated. Use "render()" and "await renderer.init();" when creating the renderer.'),await this.renderer.init(),this.render()}}class BK extends BJ{constructor(e,t){es('PostProcessing: "PostProcessing" has been renamed to "RenderPipeline". Please update your code to use "THREE.RenderPipeline" instead.'),super(e,t)}}class BY extends eG{constructor(e=1,t=1){super(),this.image={width:e,height:t},this.magFilter=1006,this.minFilter=1006,this.isStorageTexture=!0,this.mipmapsAutoUpdate=!0}setSize(e,t){(this.image.width!==e||this.image.height!==t)&&(this.image.width=e,this.image.height=t,this.dispose())}}class BQ extends eG{constructor(e=1,t=1,r=1){super(),this.isArrayTexture=!1,this.image={width:e,height:t,depth:r},this.magFilter=1006,this.minFilter=1006,this.wrapR=1001,this.isStorageTexture=!0,this.is3DTexture=!0}setSize(e,t,r){(this.image.width!==e||this.image.height!==t||this.image.depth!==r)&&(this.image.width=e,this.image.height=t,this.image.depth=r,this.dispose())}}class BZ extends eG{constructor(e=1,t=1,r=1){super(),this.isArrayTexture=!0,this.image={width:e,height:t,depth:r},this.magFilter=1006,this.minFilter=1006,this.isStorageTexture=!0}setSize(e,t,r){(this.image.width!==e||this.image.height!==t||this.image.depth!==r)&&(this.image.width=e,this.image.height=t,this.image.depth=r,this.dispose())}}class B0 extends Mh{constructor(e,t){super(e,t,Uint32Array),this.isIndirectStorageBufferAttribute=!0}}class B1 extends si{constructor(e){super(e),this.textures={},this.nodes={}}load(e,t,r,i){let n=new ss(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,r=>{try{t(this.parse(JSON.parse(r)))}catch(t){i?i(t):ea(t),this.manager.itemError(e)}},r,i)}parseNodes(e){let t={};if(void 0!==e){for(let r of e){let{uuid:e,type:i}=r;t[e]=this.createNodeFromType(i),t[e].uuid=e}let r={nodes:t,textures:this.textures};for(let i of e)i.meta=r,t[i.uuid].deserialize(i),delete i.meta}return t}parse(e){let t=this.createNodeFromType(e.type);t.uuid=e.uuid;let r={nodes:this.parseNodes(e.nodes),textures:this.textures};return e.meta=r,t.deserialize(e),delete e.meta,t}setTextures(e){return this.textures=e,this}setNodes(e){return this.nodes=e,this}createNodeFromType(e){return void 0===this.nodes[e]?(ea("NodeLoader: Node type not found:",e),pN()):new this.nodes[e]}}class B2 extends sG{constructor(e){super(e),this.nodes={},this.nodeMaterials={}}parse(e){let t=super.parse(e),r=this.nodes,i=e.inputNodes;for(let e in i){let n=i[e];t[e]=r[n]}return t}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}createMaterialFromType(e){let t=this.nodeMaterials[e];return void 0!==t?new t:super.createMaterialFromType(e)}}class B3 extends sH{constructor(e){super(e),this.nodes={},this.nodeMaterials={},this._nodesJSON=null}setNodes(e){return this.nodes=e,this}setNodeMaterials(e){return this.nodeMaterials=e,this}parse(e,t){this._nodesJSON=e.nodes;let r=super.parse(e,t);return this._nodesJSON=null,r}parseNodes(e,t){if(void 0!==e){let r=new B1;
737return r.setNodes(this.nodes),r.setTextures(t),r.parseNodes(e)}return{}}parseMaterials(e,t){let r={};if(void 0!==e){let i=this.parseNodes(this._nodesJSON,t),n=new B2;n.setTextures(t),n.setNodes(i),n.setNodeMaterials(this.nodeMaterials);for(let t=0,i=e.length;t<i;t++){let i=e[t];r[i.uuid]=n.parse(i)}}return r}}class B4 extends td{constructor(){super(),this.isClippingGroup=!0,this.clippingPlanes=[],this.enabled=!0,this.clipIntersection=!1,this.clipShadows=!1}}e.s(["AONode",()=>xE,"AmbientLightNode",()=>w1,"AnalyticLightNode",()=>CN,"ArrayElementNode",()=>cG,"ArrayNode",()=>fw,"AssignNode",()=>fN,"AtomicFunctionNode",()=>Ef,"AttributeNode",()=>g8,"BarrierNode",()=>Eh,"BasicEnvironmentNode",()=>bm,"BasicLightMapNode",()=>bg,"BatchNode",()=>xc,"BitcastNode",()=>Ah,"BitcountNode",()=>Af,"BlendMode",()=>An,"BufferAttributeNode",()=>gP,"BufferNode",()=>vu,"BuiltinNode",()=>vf,"BumpMapNode",()=>_y,"BundleGroup",()=>B$,"BypassNode",()=>gj,"CanvasTarget",()=>RI,"ClippingGroup",()=>B4,"ClippingNode",()=>xK,"CodeNode",()=>M0,"ColorSpaceNode",()=>gS,"ComputeBuiltinNode",()=>Ei,"ComputeNode",()=>gG,"ConditionalNode",()=>ge,"ConstNode",()=>cJ,"ContextNode",()=>gr,"ConvertNode",()=>ck,"CubeMapNode",()=>bd,"CubeRenderTarget",()=>bu,"CubeTextureNode",()=>yz,"DebugNode",()=>g1,"DirectionalLightNode",()=>w2,"EnvironmentNode",()=>S8,"EventNode",()=>Mo,"ExpressionNode",()=>gK,"FlipNode",()=>cX,"FrontFacingNode",()=>ym,"FunctionCallNode",()=>fB,"FunctionNode",()=>M2,"FunctionOverloadingNode",()=>AL,"GLSLNodeParser",()=>Ru,"HemisphereLightNode",()=>w3,"IESSpotLight",()=>BW,"IESSpotLightNode",()=>w5,"IndexNode",()=>xt,"IndirectStorageBufferAttribute",()=>B0,"InputNode",()=>cq,"InspectorBase",()=>g3,"InspectorNode",()=>g4,"InstanceNode",()=>xl,"InstancedMeshNode",()=>xh,"IrradianceNode",()=>xR,"IsolateNode",()=>gz,"JoinNode",()=>cz,"LightProbeNode",()=>w8,"Lighting",()=>RS,"LightingContextNode",()=>xC,"LightingModel",()=>bv,"LightingNode",()=>xM,"LightsNode",()=>EZ,"Line2NodeMaterial",()=>ba,"LineBasicNodeMaterial",()=>bt,"LineDashedNodeMaterial",()=>bi,"LoopNode",()=>xv,"MRTNode",()=>Al,"MaterialNode",()=>_b,"MaterialReferenceNode",()=>yJ,"MathNode",()=>f9,"MaxMipLevelNode",()=>vt,"MemberNode",()=>cK,"MeshBasicNodeMaterial",()=>bx,"MeshLambertNodeMaterial",()=>bC,"MeshMatcapNodeMaterial",()=>Td,"MeshNormalNodeMaterial",()=>bo,"MeshPhongNodeMaterial",()=>bR,"MeshPhysicalNodeMaterial",()=>Tr,"MeshSSSNodeMaterial",()=>Tn,"MeshStandardNodeMaterial",()=>Te,"MeshToonNodeMaterial",()=>Tl,"ModelNode",()=>v4,"MorphNode",()=>xT,"Node",()=>cO,"NodeAccess",()=>cL,"NodeAttribute",()=>wS,"NodeBuilder",()=>wQ,"NodeCache",()=>ww,"NodeCode",()=>wE,"NodeError",()=>vi,"NodeFrame",()=>wZ,"NodeFunctionInput",()=>w0,"NodeLoader",()=>B1,"NodeMaterial",()=>x7,"NodeMaterialLoader",()=>B2,"NodeMaterialObserver",()=>cl,"NodeObjectLoader",()=>B3,"NodeShaderStage",()=>cw,"NodeType",()=>cN,"NodeUniform",()=>wT,"NodeUpdateType",()=>cR,"NodeUtils",()=>cC,"NodeVar",()=>wA,"NodeVarying",()=>wM,"NormalMapNode",()=>_f,"Object3DNode",()=>vY,"OperatorNode",()=>fF,"OutputStructNode",()=>Ar,"PMREMGenerator",()=>SK,"PMREMNode",()=>S3,"PackFloatNode",()=>Ax,"ParameterNode",()=>T6,"PassNode",()=>Mz,"PhongLightingModel",()=>bM,"PhysicalLightingModel",()=>Sp,"PointLightNode",()=>CI,"PointShadowNode",()=>Cw,"PointUVNode",()=>Md,"PointsNodeMaterial",()=>Ty,"PostProcessing",()=>BK,"ProjectorLight",()=>Bj,"ProjectorLightNode",()=>w9,"PropertyNode",()=>pY,"QuadMesh",()=>A6,"RTTNode",()=>A7,"RangeNode",()=>Et,"RectAreaLightNode",()=>Rr,"ReferenceBaseNode",()=>gE,"ReferenceNode",()=>yX,"ReflectorNode",()=>A3,"RemapNode",()=>gq,"RenderOutputNode",()=>gZ,"RenderPipeline",()=>BJ,"RendererReferenceNode",()=>gC,"RendererUtils",()=>Ce,"RotateNode",()=>Tc,"SampleNode",()=>Ms,"ScreenNode",()=>vg,"SetNode",()=>cj,"ShadowBaseNode",()=>E0,"ShadowNode",()=>Cm,"ShadowNodeMaterial",()=>TS,"SkinningNode",()=>xm,"SplitNode",()=>cW,"SpotLightNode",()=>w4,"SpriteNodeMaterial",()=>Tm,"StackNode",()=>T9,"StackTrace",()=>ch,"Storage3DTexture",()=>BQ,"StorageArrayElementNode",()=>_6,"StorageArrayTexture",()=>BZ,"StorageBufferAttribute",()=>Mh,"StorageBufferNode",()=>_7,"StorageInstancedBufferAttribute",()=>Mu,"StorageTexture",()=>BY,"StorageTextureNode",()=>My,"StructNode",()=>At,"StructTypeNode",()=>Ae,"SubBuildNode",()=>gf,"SubgroupFunctionNode",()=>Ev,"TSL",()=>wg,"TempNode",()=>cV,"Texture3DNode",()=>Mb,"TextureNode",()=>va,"TextureSizeNode",()=>g7,"ToneMappingNode",()=>gR,"ToonOutlinePassNode",()=>MH,"UniformArrayNode",()=>vc,"UniformGroupNode",()=>fx,"UniformNode",()=>fE,"UnpackFloatNode",()=>AA,"UserDataNode",()=>MT,"VarNode",()=>gu,"VaryingNode",()=>gg,"VelocityNode",()=>MM,"VertexColorNode",()=>x0,"ViewportDepthNode",()=>xG,"ViewportDepthTextureNode",()=>xU,"ViewportSharedTextureNode",()=>MU,"ViewportTextureNode",()=>xL,"VolumeNodeMaterial",()=>TC,"WebGPURenderer",()=>Bq,"WorkgroupInfoNode",()=>Ep,"defaultBuildStages",()=>cI,"defaultShaderStages",()=>cB,"shaderStages",()=>cP,"vectorComponents",()=>cF],62031),e.i(62031),e.s(["ACESFilmicToneMapping",()=>4,"AONode",()=>xE,"AddEquation",()=>100,"AddOperation",()=>2,"AdditiveAnimationBlendMode",()=>2501,"AdditiveBlending",()=>2,"AgXToneMapping",()=>6,"AlphaFormat",()=>1021,"AlwaysCompare",()=>519,"AlwaysDepth",()=>1,"AlwaysStencilFunc",()=>519,"AmbientLight",()=>sF,"AmbientLightNode",()=>w1,"AnalyticLightNode",()=>CN,"AnimationAction",()=>ov,"AnimationClip",()=>a9,"AnimationLoader",()=>so,"AnimationMixer",()=>o_,"AnimationObjectGroup",()=>og,"AnimationUtils",()=>a$,"ArcCurve",()=>nP,"ArrayCamera",()=>s2,"ArrayElementNode",()=>cG,"ArrayNode",()=>fw,"ArrowHelper",()=>ls,"AssignNode",()=>fN,"AtomicFunctionNode",()=>Ef,"AttachedBindMode",()=>D,"AttributeNode",()=>g8,"Audio",()=>ot,"AudioAnalyser",()=>oo,"AudioContext",()=>sJ,"AudioListener",()=>oe,"AudioLoader",()=>sK,"AxesHelper",()=>lo,"BackSide",()=>1,"BarrierNode",()=>Eh,"BasicDepthPacking",()=>3200,"BasicEnvironmentNode",()=>bm,"BasicLightMapNode",()=>bg,"BasicShadowMap",()=>0,"BatchNode",()=>xc,"BatchedMesh",()=>iY,"BezierInterpolant",()=>aZ,"BitcastNode",()=>Ah,"BitcountNode",()=>Af,"BlendMode",()=>An,"Bone",()=>iu,"BooleanKeyframeTrack",()=>a1,"Box2",()=>oF,"Box3",()=>tU,"Box3Helper",()=>li,"BoxGeometry",()=>nx,"BoxHelper",()=>lr,"BufferAttribute",()=>t5,"BufferAttributeNode",()=>gP,"BufferGeometry",()=>rg,"BufferGeometryLoader",()=>sz,"BufferNode",()=>vu,"BuiltinNode",()=>vf,"BumpMapNode",()=>_y,"BundleGroup",()=>B$,"BypassNode",()=>gj,"ByteType",()=>1010,"Cache",()=>a7,"Camera",()=>sT,"CameraHelper",()=>o7,"CanvasTarget",()=>RI,"CanvasTexture",()=>ng,"CapsuleGeometry",()=>nb,"CatmullRomCurve3",()=>nk,"CineonToneMapping",()=>3,"CircleGeometry",()=>nS,"ClampToEdgeWrapping",()=>1001,"ClippingGroup",()=>B4,"ClippingNode",()=>xK,"Clock",()=>
737oN,"CodeNode",()=>M0,"Color",()=>ty,"ColorKeyframeTrack",()=>a2,"ColorManagement",()=>eN,"ColorSpaceNode",()=>gS,"Compatibility",()=>X,"CompressedArrayTexture",()=>np,"CompressedCubeTexture",()=>nf,"CompressedTexture",()=>nc,"CompressedTextureLoader",()=>sl,"ComputeBuiltinNode",()=>Ei,"ComputeNode",()=>gG,"ConditionalNode",()=>ge,"ConeGeometry",()=>nA,"ConstNode",()=>cJ,"ConstantAlphaFactor",()=>213,"ConstantColorFactor",()=>211,"ContextNode",()=>gr,"Controls",()=>lu,"ConvertNode",()=>ck,"CubeCamera",()=>s1,"CubeDepthTexture",()=>ny,"CubeMapNode",()=>bd,"CubeReflectionMapping",()=>301,"CubeRefractionMapping",()=>302,"CubeRenderTarget",()=>bu,"CubeTexture",()=>nm,"CubeTextureLoader",()=>sd,"CubeTextureNode",()=>yz,"CubeUVReflectionMapping",()=>306,"CubicBezierCurve",()=>nW,"CubicBezierCurve3",()=>nj,"CubicInterpolant",()=>aK,"CullFaceBack",()=>1,"CullFaceFront",()=>2,"CullFaceFrontBack",()=>3,"CullFaceNone",()=>0,"Curve",()=>nB,"CurvePath",()=>nQ,"CustomBlending",()=>5,"CustomToneMapping",()=>5,"CylinderGeometry",()=>nT,"Cylindrical",()=>oB,"Data3DTexture",()=>ej,"DataArrayTexture",()=>eH,"DataTexture",()=>ih,"DataTextureLoader",()=>sc,"DataUtils",()=>t1,"DebugNode",()=>g1,"DecrementStencilOp",()=>7683,"DecrementWrapStencilOp",()=>34056,"DefaultLoadingManager",()=>sr,"DepthFormat",()=>1026,"DepthStencilFormat",()=>1027,"DepthTexture",()=>nv,"DetachedBindMode",()=>U,"DirectionalLight",()=>sP,"DirectionalLightHelper",()=>o8,"DirectionalLightNode",()=>w2,"DiscreteInterpolant",()=>aQ,"DodecahedronGeometry",()=>nE,"DoubleSide",()=>2,"DstAlphaFactor",()=>206,"DstColorFactor",()=>208,"DynamicCopyUsage",()=>35050,"DynamicDrawUsage",()=>35048,"DynamicReadUsage",()=>35049,"EdgesGeometry",()=>nL,"EllipseCurve",()=>nI,"EnvironmentNode",()=>S8,"EqualCompare",()=>514,"EqualDepth",()=>4,"EqualStencilFunc",()=>514,"EquirectangularReflectionMapping",()=>303,"EquirectangularRefractionMapping",()=>304,"Euler",()=>e3,"EventDispatcher",()=>eu,"EventNode",()=>Mo,"ExpressionNode",()=>gK,"ExternalTexture",()=>n_,"ExtrudeGeometry",()=>ad,"FileLoader",()=>ss,"FlipNode",()=>cX,"Float16BufferAttribute",()=>ri,"Float32BufferAttribute",()=>rn,"FloatType",()=>1015,"Fog",()=>tb,"FogExp2",()=>tx,"FramebufferTexture",()=>nd,"FrontFacingNode",()=>ym,"FrontSide",()=>0,"Frustum",()=>iL,"FrustumArray",()=>iP,"FunctionCallNode",()=>fB,"FunctionNode",()=>M2,"FunctionOverloadingNode",()=>AL,"GLBufferAttribute",()=>oM,"GLSL1",()=>"100","GLSL3",()=>z,"GLSLNodeParser",()=>Ru,"GreaterCompare",()=>516,"GreaterDepth",()=>6,"GreaterEqualCompare",()=>518,"GreaterEqualDepth",()=>5,"GreaterEqualStencilFunc",()=>518,"GreaterStencilFunc",()=>516,"GridHelper",()=>o1,"Group",()=>td,"HalfFloatType",()=>1016,"HemisphereLight",()=>sm,"HemisphereLightHelper",()=>o0,"HemisphereLightNode",()=>w3,"IESSpotLight",()=>BW,"IESSpotLightNode",()=>w5,"IcosahedronGeometry",()=>ap,"ImageBitmapLoader",()=>s$,"ImageLoader",()=>sh,"ImageUtils",()=>eI,"IncrementStencilOp",()=>7682,"IncrementWrapStencilOp",()=>34055,"IndexNode",()=>xt,"IndirectStorageBufferAttribute",()=>B0,"InputNode",()=>cq,"InspectorBase",()=>g3,"InspectorNode",()=>g4,"InstanceNode",()=>xl,"InstancedBufferAttribute",()=>im,"InstancedBufferGeometry",()=>sV,"InstancedInterleavedBuffer",()=>oA,"InstancedMesh",()=>iT,"InstancedMeshNode",()=>xh,"Int16BufferAttribute",()=>t7,"Int32BufferAttribute",()=>rt,"Int8BufferAttribute",()=>t8,"IntType",()=>1013,"InterleavedBuffer",()=>rv,"InterleavedBufferAttribute",()=>r_,"Interpolant",()=>aJ,"InterpolateBezier",()=>2303,"InterpolateDiscrete",()=>2300,"InterpolateLinear",()=>2301,"InterpolateSmooth",()=>2302,"InterpolationSamplingMode",()=>j,"InterpolationSamplingType",()=>W,"InvertStencilOp",()=>5386,"IrradianceNode",()=>xR,"IsolateNode",()=>gz,"JoinNode",()=>cz,"KeepStencilOp",()=>7680,"KeyframeTrack",()=>a0,"LOD",()=>rG,"LatheGeometry",()=>af,"Layers",()=>e4,"LessCompare",()=>513,"LessDepth",()=>2,"LessEqualCompare",()=>515,"LessEqualDepth",()=>3,"LessEqualStencilFunc",()=>515,"LessStencilFunc",()=>513,"Light",()=>sf,"LightProbe",()=>sO,"LightProbeNode",()=>w8,"Lighting",()=>RS,"LightingContextNode",()=>xC,"LightingModel",()=>bv,"LightingNode",()=>xM,"LightsNode",()=>EZ,"Line",()=>i8,"Line2NodeMaterial",()=>ba,"Line3",()=>oH,"LineBasicMaterial",()=>iQ,"LineBasicNodeMaterial",()=>bt,"LineCurve",()=>nX,"LineCurve3",()=>nq,"LineDashedMaterial",()=>aH,"LineDashedNodeMaterial",()=>bi,"LineLoop",()=>nt,"LineSegments",()=>ne,"LinearFilter",()=>1006,"LinearInterpolant",()=>aY,"LinearMipMapLinearFilter",()=>1008,"LinearMipMapNearestFilter",()=>1007,"LinearMipmapLinearFilter",()=>1008,"LinearMipmapNearestFilter",()=>1007,"LinearSRGBColorSpace",()=>G,"LinearToneMapping",()=>1,"LinearTransfer",()=>k,"Loader",()=>si,"LoaderUtils",()=>sk,"LoadingManager",()=>st,"LoopNode",()=>xv,"LoopOnce",()=>2200,"LoopPingPong",()=>2202,"LoopRepeat",()=>2201,"MOUSE",()=>P,"MRTNode",()=>Al,"Material",()=>rb,"MaterialBlending",()=>6,"MaterialLoader",()=>sG,"MaterialNode",()=>_b,"MaterialReferenceNode",()=>yJ,"MathNode",()=>f9,"MathUtils",()=>ex,"Matrix2",()=>oI,"Matrix3",()=>eE,"Matrix4",()=>
737eq,"MaxEquation",()=>104,"MaxMipLevelNode",()=>vt,"MemberNode",()=>cK,"Mesh",()=>r8,"MeshBasicMaterial",()=>r$,"MeshBasicNodeMaterial",()=>bx,"MeshDepthMaterial",()=>ak,"MeshDistanceMaterial",()=>aV,"MeshLambertMaterial",()=>aG,"MeshLambertNodeMaterial",()=>bC,"MeshMatcapMaterial",()=>az,"MeshMatcapNodeMaterial",()=>Td,"MeshNormalMaterial",()=>aO,"MeshNormalNodeMaterial",()=>bo,"MeshPhongMaterial",()=>aD,"MeshPhongNodeMaterial",()=>bR,"MeshPhysicalMaterial",()=>aF,"MeshPhysicalNodeMaterial",()=>Tr,"MeshSSSNodeMaterial",()=>Tn,"MeshStandardMaterial",()=>aP,"MeshStandardNodeMaterial",()=>Te,"MeshToonMaterial",()=>aU,"MeshToonNodeMaterial",()=>Tl,"MinEquation",()=>103,"MirroredRepeatWrapping",()=>1002,"MixOperation",()=>1,"ModelNode",()=>v4,"MorphNode",()=>xT,"MultiplyBlending",()=>4,"MultiplyOperation",()=>0,"NearestFilter",()=>1003,"NearestMipMapLinearFilter",()=>1005,"NearestMipMapNearestFilter",()=>1004,"NearestMipmapLinearFilter",()=>1005,"NearestMipmapNearestFilter",()=>1004,"NeutralToneMapping",()=>7,"NeverCompare",()=>512,"NeverDepth",()=>0,"NeverStencilFunc",()=>512,"NoBlending",()=>0,"NoColorSpace",()=>"","NoNormalPacking",()=>"","NoToneMapping",()=>0,"Node",()=>cO,"NodeAccess",()=>cL,"NodeAttribute",()=>wS,"NodeBuilder",()=>wQ,"NodeCache",()=>ww,"NodeCode",()=>wE,"NodeError",()=>vi,"NodeFrame",()=>wZ,"NodeFunctionInput",()=>w0,"NodeLoader",()=>B1,"NodeMaterial",()=>x7,"NodeMaterialLoader",()=>B2,"NodeMaterialObserver",()=>cl,"NodeObjectLoader",()=>B3,"NodeShaderStage",()=>cw,"NodeType",()=>cN,"NodeUniform",()=>wT,"NodeUpdateType",()=>cR,"NodeUtils",()=>cC,"NodeVar",()=>wA,"NodeVarying",()=>wM,"NormalAnimationBlendMode",()=>2500,"NormalBlending",()=>1,"NormalGAPacking",()=>"ga","NormalMapNode",()=>_f,"NormalRGPacking",()=>"rg","NotEqualCompare",()=>517,"NotEqualDepth",()=>7,"NotEqualStencilFunc",()=>517,"NumberKeyframeTrack",()=>a3,"Object3D",()=>th,"Object3DNode",()=>vY,"ObjectLoader",()=>sH,"ObjectSpaceNormalMap",()=>1,"OctahedronGeometry",()=>am,"OneFactor",()=>201,"OneMinusConstantAlphaFactor",()=>214,"OneMinusConstantColorFactor",()=>212,"OneMinusDstAlphaFactor",()=>207,"OneMinusDstColorFactor",()=>209,"OneMinusSrcAlphaFactor",()=>205,"OneMinusSrcColorFactor",()=>203,"OperatorNode",()=>fF,"OrthographicCamera",()=>sB,"OutputStructNode",()=>Ar,"PCFShadowMap",()=>1,"PCFSoftShadowMap",()=>2,"PMREMGenerator",()=>SK,"PMREMNode",()=>S3,"PackFloatNode",()=>Ax,"ParameterNode",()=>T6,"PassNode",()=>Mz,"Path",()=>nZ,"PerspectiveCamera",()=>sC,"PhongLightingModel",()=>bM,"PhysicalLightingModel",()=>Sp,"Plane",()=>iC,"PlaneGeometry",()=>ag,"PlaneHelper",()=>ln,"PointLight",()=>sL,"PointLightHelper",()=>oK,"PointLightNode",()=>CI,"PointShadowNode",()=>Cw,"PointUVNode",()=>Md,"Points",()=>no,"PointsMaterial",()=>nr,"PointsNodeMaterial",()=>Ty,"PolarGridHelper",()=>o2,"PolyhedronGeometry",()=>nM,"PositionalAudio",()=>os,"PostProcessing",()=>BK,"ProjectorLight",()=>Bj,"ProjectorLightNode",()=>w9,"PropertyBinding",()=>om,"PropertyMixer",()=>ol,"PropertyNode",()=>pY,"QuadMesh",()=>A6,"QuadraticBezierCurve",()=>n$,"QuadraticBezierCurve3",()=>nJ,"Quaternion",()=>eS,"QuaternionKeyframeTrack",()=>a5,"QuaternionLinearInterpolant",()=>a4,"R11_EAC_Format",()=>37488,"RED_GREEN_RGTC2_Format",()=>36285,"RED_RGTC1_Format",()=>36283,"REVISION",()=>"183","RG11_EAC_Format",()=>37490,"RGBADepthPacking",()=>3201,"RGBAFormat",()=>1023,"RGBAIntegerFormat",()=>1033,"RGBA_ASTC_10x10_Format",()=>37819,"RGBA_ASTC_10x5_Format",()=>37816,"RGBA_ASTC_10x6_Format",()=>37817,"RGBA_ASTC_10x8_Format",()=>37818,"RGBA_ASTC_12x10_Format",()=>37820,"RGBA_ASTC_12x12_Format",()=>37821,"RGBA_ASTC_4x4_Format",()=>37808,"RGBA_ASTC_5x4_Format",()=>37809,"RGBA_ASTC_5x5_Format",()=>37810,"RGBA_ASTC_6x5_Format",()=>37811,"RGBA_ASTC_6x6_Format",()=>37812,"RGBA_ASTC_8x5_Format",()=>37813,"RGBA_ASTC_8x6_Format",()=>37814,"RGBA_ASTC_8x8_Format",()=>37815,"RGBA_BPTC_Format",()=>36492,"RGBA_ETC2_EAC_Format",()=>37496,"RGBA_PVRTC_2BPPV1_Format",()=>35843,"RGBA_PVRTC_4BPPV1_Format",()=>35842,"RGBA_S3TC_DXT1_Format",()=>33777,"RGBA_S3TC_DXT3_Format",()=>33778,"RGBA_S3TC_DXT5_Format",()=>33779,"RGBDepthPacking",()=>3202,"RGBFormat",()=>1022,"RGBIntegerFormat",()=>1032,"RGB_BPTC_SIGNED_Format",()=>36494,"RGB_BPTC_UNSIGNED_Format",()=>36495,"RGB_ETC1_Format",()=>36196,"RGB_ETC2_Format",()=>37492,"RGB_PVRTC_2BPPV1_Format",()=>35841,"RGB_PVRTC_4BPPV1_Format",()=>35840,"RGB_S3TC_DXT1_Format",()=>33776,"RGDepthPacking",()=>3203,"RGFormat",()=>1030,"RGIntegerFormat",()=>1031,"RTTNode",()=>A7,"RangeNode",()=>Et,"RawShaderMaterial",()=>aI,"Ray",()=>rq,"Raycaster",()=>oC,"RectAreaLight",()=>sD,"RectAreaLightNode",()=>Rr,"RedFormat",()=>1028,"RedIntegerFormat",()=>1029,"ReferenceBaseNode",()=>gE,"ReferenceNode",()=>yX,"ReflectorNode",()=>A3,"ReinhardToneMapping",()=>2,"RemapNode",()=>gq,"RenderOutputNode",()=>gZ,"RenderPipeline",()=>BJ,"RenderTarget",()=>eV,"RenderTarget3D",()=>ox,"RendererReferenceNode",()=>gC,"RendererUtils",()=>Ce,"RepeatWrapping",()=>1e3,"ReplaceStencilOp",()=>7681,"ReverseSubtractEquation",()=>102,"RingGeometry",()=>av,"RotateNode",()=>Tc,"SIGNED_R11_EAC_Format",()=>37489,"SIGNED_RED_GREEN_RGTC2_Format",()=>
73736286,"SIGNED_RED_RGTC1_Format",()=>36284,"SIGNED_RG11_EAC_Format",()=>37491,"SRGBColorSpace",()=>O,"SRGBTransfer",()=>V,"SampleNode",()=>Ms,"Scene",()=>tS,"ScreenNode",()=>vg,"SetNode",()=>cj,"ShaderMaterial",()=>aB,"ShadowBaseNode",()=>E0,"ShadowMaterial",()=>aC,"ShadowNode",()=>Cm,"ShadowNodeMaterial",()=>TS,"Shape",()=>n0,"ShapeGeometry",()=>ay,"ShapePath",()=>ll,"ShapeUtils",()=>al,"ShortType",()=>1011,"Skeleton",()=>ip,"SkeletonHelper",()=>oJ,"SkinnedMesh",()=>il,"SkinningNode",()=>xm,"Source",()=>eF,"Sphere",()=>rl,"SphereGeometry",()=>a_,"Spherical",()=>oL,"SphericalHarmonics3",()=>sU,"SplineCurve",()=>nK,"SplitNode",()=>cW,"SpotLight",()=>sR,"SpotLightHelper",()=>oj,"SpotLightNode",()=>w4,"Sprite",()=>rF,"SpriteMaterial",()=>rS,"SpriteNodeMaterial",()=>Tm,"SrcAlphaFactor",()=>204,"SrcAlphaSaturateFactor",()=>210,"SrcColorFactor",()=>202,"StackNode",()=>T9,"StackTrace",()=>ch,"StaticCopyUsage",()=>35046,"StaticDrawUsage",()=>35044,"StaticReadUsage",()=>35045,"StereoCamera",()=>s0,"Storage3DTexture",()=>BQ,"StorageArrayElementNode",()=>_6,"StorageArrayTexture",()=>BZ,"StorageBufferAttribute",()=>Mh,"StorageBufferNode",()=>_7,"StorageInstancedBufferAttribute",()=>Mu,"StorageTexture",()=>BY,"StorageTextureNode",()=>My,"StreamCopyUsage",()=>35042,"StreamDrawUsage",()=>35040,"StreamReadUsage",()=>35041,"StringKeyframeTrack",()=>a8,"StructNode",()=>At,"StructTypeNode",()=>Ae,"SubBuildNode",()=>gf,"SubgroupFunctionNode",()=>Ev,"SubtractEquation",()=>101,"SubtractiveBlending",()=>3,"TOUCH",()=>F,"TSL",()=>wg,"TangentSpaceNormalMap",()=>0,"TempNode",()=>cV,"TetrahedronGeometry",()=>ax,"Texture",()=>eG,"Texture3DNode",()=>Mb,"TextureLoader",()=>sp,"TextureNode",()=>va,"TextureSizeNode",()=>g7,"TextureUtils",()=>ld,"Timer",()=>s3,"TimestampQuery",()=>H,"ToneMappingNode",()=>gR,"ToonOutlinePassNode",()=>MH,"TorusGeometry",()=>ab,"TorusKnotGeometry",()=>aS,"Triangle",()=>tD,"TriangleFanDrawMode",()=>2,"TriangleStripDrawMode",()=>1,"TrianglesDrawMode",()=>0,"TubeGeometry",()=>aT,"UVMapping",()=>300,"Uint16BufferAttribute",()=>re,"Uint32BufferAttribute",()=>rr,"Uint8BufferAttribute",()=>t6,"Uint8ClampedBufferAttribute",()=>t9,"Uniform",()=>ob,"UniformArrayNode",()=>vc,"UniformGroupNode",()=>fx,"UniformNode",()=>fE,"UniformsGroup",()=>oT,"UnpackFloatNode",()=>AA,"UnsignedByteType",()=>1009,"UnsignedInt101111Type",()=>35899,"UnsignedInt248Type",()=>1020,"UnsignedInt5999Type",()=>35902,"UnsignedIntType",()=>1014,"UnsignedShort4444Type",()=>1017,"UnsignedShort5551Type",()=>1018,"UnsignedShortType",()=>1012,"UserDataNode",()=>MT,"VSMShadowMap",()=>3,"VarNode",()=>gu,"VaryingNode",()=>gg,"Vector2",()=>eb,"Vector3",()=>eT,"Vector4",()=>ek,"VectorKeyframeTrack",()=>a6,"VelocityNode",()=>MM,"VertexColorNode",()=>x0,"VideoFrameTexture",()=>nh,"VideoTexture",()=>nu,"ViewportDepthNode",()=>xG,"ViewportDepthTextureNode",()=>xU,"ViewportSharedTextureNode",()=>MU,"ViewportTextureNode",()=>xL,"VolumeNodeMaterial",()=>TC,"WebGL3DRenderTarget",()=>eX,"WebGLArrayRenderTarget",()=>eW,"WebGLCoordinateSystem",()=>2e3,"WebGLRenderTarget",()=>ez,"WebGPUCoordinateSystem",()=>2001,"WebGPURenderer",()=>Bq,"WebXRController",()=>tp,"WireframeGeometry",()=>aA,"WorkgroupInfoNode",()=>Ep,"WrapAroundEnding",()=>2402,"ZeroCurvatureEnding",()=>2400,"ZeroFactor",()=>200,"ZeroSlopeEnding",()=>2401,"ZeroStencilOp",()=>0,"createCanvasElement",()=>Y,"defaultBuildStages",()=>cI,"defaultShaderStages",()=>cB,"error",()=>ea,"getConsoleFunction",()=>et,"log",()=>er,"setConsoleFunction",()=>ee,"shaderStages",()=>cP,"vectorComponents",()=>cF,"warn",()=>en,"warnOnce",()=>es],18018);var B5=e.i(18018);async function B8(e){let t=new B5.WebGPURenderer({alpha:!0,...e});return await t.init(),t}function B6(e){return(0,L.jsx)(ca,{gl:B8,...e})}dB(B5),e.s(["Canvas",()=>B6],69651),e.s(["useThree",()=>dx],10826),e.s(["useFrame",()=>db],34900),e.s(["useLoader",()=>dA],98430)},38574,e=>{"use strict";var t=e.i(98134),r=e.i(75201),i=e.i(3011),n=e.i(98430),a=e.i(10826);let s={src:e.i(81312).default,width:1024,height:1024,blurWidth:8,blurHeight:8,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAA5klEQVR42lXKy0oCYQCG4Vmb8/+m02gQ1CaUoJjCahEFjVFNMAuxfrGsNtGBTkiFDMUUtRBxmp2HK/AqxFt7xdmIu4/vfbRYbIZ4XKDrgnnTZCGTQegy+sZNGw8hElGwN9ZQ+zvklhaRMhGhCEg5y2Z2Gf9S0f/zeDxzMZKpaVCwVnkvuTRuqtQvTkkbcxOQShq4W3keDm1+KiUat1esZHMT4DgO9ad7ru1dvipFfp/vCMMQ00yjWdY6tdor3tsLR9t5yoU9Ov9NhsMBSpXR/G+fIGhSPVccH9gU3RM+vQ963TatoMUI34Nu9ijPzvMAAAAASUVORK5CYII="};var o=e.i(69651),l=e.i(30611),u=e.i(34900),h=e.i(62031);h.TSL.BRDF_GGX,h.TSL.BRDF_Lambert,h.TSL.BasicPointShadowFilter,h.TSL.BasicShadowFilter,h.TSL.Break,h.TSL.Const,h.TSL.C
737ontinue,h.TSL.DFGLUT,h.TSL.D_GGX,h.TSL.Discard,h.TSL.EPSILON,h.TSL.F_Schlick;let d=h.TSL.Fn;h.TSL.INFINITY,h.TSL.If,h.TSL.Loop,h.TSL.NodeAccess,h.TSL.NodeShaderStage,h.TSL.NodeType,h.TSL.NodeUpdateType,h.TSL.PCFShadowFilter,h.TSL.PCFSoftShadowFilter,h.TSL.PI,h.TSL.PI2,h.TSL.TWO_PI,h.TSL.HALF_PI,h.TSL.PointShadowFilter,h.TSL.Return,h.TSL.Schlick_to_F0,h.TSL.ShaderNode,h.TSL.Stack,h.TSL.Switch,h.TSL.TBNViewMatrix,h.TSL.VSMShadowFilter,h.TSL.V_GGX_SmithCorrelated,h.TSL.Var,h.TSL.VarIntent,h.TSL.abs,h.TSL.acesFilmicToneMapping,h.TSL.acos,h.TSL.add,h.TSL.addMethodChaining,h.TSL.addNodeElement,h.TSL.agxToneMapping,h.TSL.all,h.TSL.alphaT,h.TSL.and,h.TSL.anisotropy,h.TSL.anisotropyB,h.TSL.anisotropyT,h.TSL.any,h.TSL.append,h.TSL.array,h.TSL.arrayBuffer,h.TSL.asin,h.TSL.assign,h.TSL.atan,h.TSL.atomicAdd,h.TSL.atomicAnd,h.TSL.atomicFunc,h.TSL.atomicLoad,h.TSL.atomicMax,h.TSL.atomicMin,h.TSL.atomicOr,h.TSL.atomicStore,h.TSL.atomicSub,h.TSL.atomicXor,h.TSL.attenuationColor,h.TSL.attenuationDistance,h.TSL.attribute,h.TSL.attributeArray,h.TSL.backgroundBlurriness,h.TSL.backgroundIntensity,h.TSL.backgroundRotation,h.TSL.batch,h.TSL.bentNormalView,h.TSL.billboarding,h.TSL.bitAnd,h.TSL.bitNot,h.TSL.bitOr,h.TSL.bitXor,h.TSL.bitangentGeometry,h.TSL.bitangentLocal,h.TSL.bitangentView,h.TSL.bitangentWorld,h.TSL.bitcast,h.TSL.blendBurn,h.TSL.blendColor,h.TSL.blendDodge,h.TSL.blendOverlay,h.TSL.blendScreen,h.TSL.blur,h.TSL.bool,h.TSL.buffer,h.TSL.bufferAttribute,h.TSL.bumpMap,h.TSL.builtin,h.TSL.builtinAOContext,h.TSL.builtinShadowContext,h.TSL.bvec2,h.TSL.bvec3,h.TSL.bvec4,h.TSL.bypass,h.TSL.cache,h.TSL.call,h.TSL.cameraFar,h.TSL.cameraIndex,h.TSL.cameraNear,h.TSL.cameraNormalMatrix,h.TSL.cameraPosition,h.TSL.cameraProjectionMatrix,h.TSL.cameraProjectionMatrixInverse,h.TSL.cameraViewMatrix,h.TSL.cameraViewport,h.TSL.cameraWorldMatrix,h.TSL.cbrt,h.TSL.cdl,h.TSL.ceil,h.TSL.checker,h.TSL.cineonToneMapping,h.TSL.clamp,h.TSL.clearcoat,h.TSL.clearcoatNormalView,h.TSL.clearcoatRoughness,h.TSL.clipSpace,h.TSL.code,h.TSL.color,h.TSL.colorSpaceToWorking,h.TSL.colorToDirection,h.TSL.compute,h.TSL.computeKernel,h.TSL.computeSkinning,h.TSL.context,h.TSL.convert,h.TSL.convertColorSpace,h.TSL.convertToTexture,h.TSL.countLeadingZeros,h.TSL.countOneBits,h.TSL.countTrailingZeros,h.TSL.cos,h.TSL.cross,h.TSL.cubeTexture,h.TSL.cubeTextureBase,h.TSL.dFdx,h.TSL.dFdy,h.TSL.dashSize,h.TSL.debug,h.TSL.decrement,h.TSL.decrementBefore,h.TSL.defaultBuildStages,h.TSL.defaultShaderStages,h.TSL.defined,h.TSL.degrees,h.TSL.deltaTime,h.TSL.densityFog,h.TSL.densityFogFactor,h.TSL.depth,h.TSL.depthPass,h.TSL.determinant,h.TSL.difference,h.TSL.diffuseColor,h.TSL.directPointLight,h.TSL.directionToColor,h.TSL.directionToFaceDirection,h.TSL.dispersion,h.TSL.distance,h.TSL.div;let c=h.TSL.dot;h.TSL.drawIndex,h.TSL.dynamicBufferAttribute,h.TSL.element,h.TSL.emissive,h.TSL.equal,h.TSL.equirectUV,h.TSL.exp,h.TSL.exp2,h.TSL.exponentialHeightFogFactor,h.TSL.expression,h.TSL.faceDirection,h.TSL.faceForward,h.TSL.faceforward;let p=h.TSL.float;h.TSL.floatBitsToInt,h.TSL.floatBitsToUint;let f=h.TSL.floor;h.TSL.fog;let m=h.TSL.fract;h.TSL.frameGroup,h.TSL.frameId,h.TSL.frontFacing,h.TSL.fwidth,h.TSL.gain,h.TSL.gapSize,h.TSL.getConstNodeType,h.TSL.getCurrentStack,h.TSL.getDirection,h.TSL.getDistanceAttenuation,h.TSL.getGeometryRoughness,h.TSL.getNormalFromDepth,h.TSL.interleavedGradientNoise,h.TSL.vogelDiskSample,h.TSL.getParallaxCorrectNormal,h.TSL.getRoughness,h.TSL.getScreenPosition,h.TSL.getShIrradianceAt,h.TSL.getShadowMaterial,h.TSL.getShadowRenderObjectFunction,h.TSL.getTextureIndex,h.TSL.getViewPosition,h.TSL.globalId,h.TSL.glsl,h.TSL.glslFn,h.TSL.grayscale,h.TSL.greaterThan,h.TSL.greaterThanEqual,h.TSL.hash,h.TSL.highpModelNormalViewMatrix,h.TSL.highpModelViewMatrix,h.TSL.hue,h.TSL.increment,h.TSL.incrementBefore,h.TSL.instance,h.TSL.instanceIndex,h.TSL.instancedArray,h.TSL.instancedBufferAttribute,h.TSL.instancedDynamicBufferAttribute,h.TSL.instancedMesh,h.TSL.int,h.TSL.intBitsToFloat,h.TSL.inverse,h.TSL.inverseSqrt,h.TSL.inversesqrt,h.TSL.invocationLocalIndex,h.TSL.invocationSubgroupIndex,h.TSL.ior,h.TSL.iridescence,h.TSL.iridescenceIOR,h.TSL.iridescenceThickness,h.TSL.ivec2,h.TSL.ivec3,h.TSL.ivec4,h.TSL.js,h.TSL.label;let g=h.TSL.length;h.TSL.lengthSq,h.TSL.lessThan,h.TSL.lessThanEqual,h.TSL.lightPosition,h.TSL.lightProjectionUV,h.TSL.lightShadowMatrix,h.TSL.lightTargetDirection,h.TSL.lightTargetPosition,h.TSL.lightViewPosition,h.TSL.lightingContext,h.TSL.lights,h.TSL.linearDepth,h.TSL.linearToneMapping,h.TSL.localId,h.TSL.log,h.TSL.log2,h.TSL.logarithmicDepthToViewZ,h.TSL.luminance,h.TSL.mat2,h.TSL.mat3,h.TSL.mat4,h.TSL.matcapUV,h.TSL.materialAO,h.TSL.materialAlphaTest,h.TSL.materialAnisotropy,h.TSL.materialAnisotropyVector,h.TSL.materialAttenuationColor,h.TSL.materialAttenuationDistance,h.TSL.materialClearcoat,h.TSL.materialClearcoatNormal,h.TSL.materialClearcoatRoughness,h.TSL.materialColor,h.TSL.materialDispersion,h.TSL.materialEmissive,h.TSL.materialEnvIntensity,h.TSL.materialEnvRotation,h.TSL.materialIOR,h.TSL.materialIridescence,h.TSL.materialIridescenceIOR,h.TSL.materialIridescenceThickness,h.TSL.materialLightMap,h.TSL.materialLineDashOffset,h.TSL.materialLineDashSize,h.TSL.materialLineGapSize,h.TSL.materialLineScale,h.TSL.materialLineWidth,h.TSL.materialMetalness,h.TSL.materialNormal,h.TSL.materialOpacity,h.TSL.materialPointSize,h.TSL.materialReference,h.TSL.materialReflectivity,h.TSL.materialRefractionRatio,h.TSL.materialRotation,h.TSL.materialRoughness,h.TSL.materialSheen,h.TSL.materialSheenRoughness,h.TSL.materialShininess,h.TSL.materialSpecular,h.TSL.materialSpecularColor,h.TSL.materialSpecularIntensity,h.TSL.materialSpecularStrength,h.TSL.materialThickness,h.TSL.materialTransmission,h.TSL.max,h.TSL.maxMipLevel,h.TSL.mediumpModelViewMatrix,h.TSL.metalness,h.TSL.min;let v=h.TSL.mix;h.TSL.mixElement,h.TSL.mod,h.TSL.modInt,h.TSL.modelDirection,h.TSL.modelNormalMatrix,h.TSL.modelPosition,h.TSL.modelRadius,h.TSL.modelScale,h.TSL.modelViewMatrix,h.TSL.modelViewPosition,h.TSL.modelViewProjection,h.TSL.modelWorldMatrix,h.TSL.modelWorldMatrixInverse,h.TSL.morphReference,h.TSL.mrt,h.TSL.mul,h.TSL.mx_aastep,h.TSL.mx_add,h.TSL.mx_atan2,h.TSL.mx_cell_noise_float,h.TSL.mx_contrast,h.TSL.mx_divide,h.TSL.mx_fractal_noise_float,h.TSL.mx_fractal_noise_vec2,h.TSL.mx_fractal_noise_vec3,h.TSL.mx_fractal_noise_vec4,h.TSL.mx_frame,h.TSL.mx_heighttonormal,h.TSL.mx_hsvtorgb,h.TSL.mx_ifequal,h.TSL.mx_ifgreater,h.TSL.mx_ifgreatereq,h.TSL.mx_invert,h.TSL.mx_modulo,h.TSL.mx_multiply,h.TSL.mx_noise_float,h.TSL.mx_noise_vec3,h.TSL.mx_noise_vec4,h.TSL.mx_place2d,h.TSL.mx_power,h.TSL.mx_ramp4,h.TSL.mx_ramplr,h.TSL.mx_ramptb,h.TSL.mx_rgbtohsv,h.TSL.mx_rotate2d,h.TSL.mx_rotate3d,h.TSL.mx_safepower,h.TSL.mx_separate,h.TSL.mx_splitlr,h.TSL.mx_splittb,h.TSL.mx_srgb_texture_to_lin_rec709,h.TSL.mx_subtract,h.TSL.mx_timer,h.TSL.mx_transform_uv,h.TSL.mx_unifiednoise2d,h.TSL.mx_unifiednoise3d,h.TSL.mx_worley_noise_float,h.TSL.mx_worley_noise_vec2,h.TSL.mx_worley_noise_vec3,h.TSL.negate,h.TSL.neutralToneMapping,h.TSL.nodeArray,h.TSL.nodeImmutable,h.TSL.nodeObject,h.TSL.nodeObjectIntent,h.TSL.nodeObjects,h.TSL.nodeProxy,h.TSL.nodeProxyIntent,h.TSL.normalFlat,h.TSL.normalGeometry,h.TSL.normalLocal,h.TSL.normalMap,h.TSL.normalView,h.TSL.normalViewGeometry,h.TSL.normalWorld,h.TSL.normalWorldGeometry,h.TSL.normalize,h.TSL.not,h.TSL.notEqual,h.TSL.numWorkgroups,h.TSL.objectDirection,h.TSL.objectGroup,h.TSL.objectPosition,h.TSL.objectRadius,h.TSL.objectScale,h.TSL.objectViewPosition,h.TSL.objectWorldMatrix,h.TSL.OnBeforeObjectUpdate,h.TSL.OnBeforeMaterialUpdate,h.TSL.OnObjectUpdate,h.TSL.OnMaterialUpdate,h.TSL.oneMinus,h.TSL.or,h.TSL.orthographicDepthToViewZ,h.TSL.oscSawtooth,h.TSL.oscSine,h.TSL.oscSquare,h.TSL.oscTriangle,h.TSL.output,h.TSL.outputStruct,h.TSL.overloadingFn,h.TSL.packHalf2x16,h.TSL.packSnorm2x16,h.TSL.packUnorm2x16,h.TSL.parabola,h.TSL.parallaxDirection,h.TSL.parallaxUV,h.TSL.parameter;let y=h.TSL.pass;h.TSL.passTexture,h.TSL.pcurve,h.TSL.perspectiveDepthToViewZ,h.TSL.pmremTexture,h.TSL.pointShadow,h.TSL.pointUV,h.TSL.pointWidth,h.TSL.positionGeometry,h.TSL.positionLocal,h.TSL.positionPrevious,h.TSL.positionView,h.TSL.positionViewDirection,h.TSL.positionWorld,h.TSL.positionWorldDirection,h.TSL.posterize,h.TSL.pow,h.TSL.pow2,h.TSL.pow3,h.TSL.pow4,h.TSL.premultiplyAlpha,h.TSL.property,h.TSL.radians,h.TSL.rand,h.TSL.range,h.TSL.rangeFog,h.TSL.rangeFogFactor,h.TSL.reciprocal,h.TSL.reference,h.TSL.referenceBuffer,h.TSL.reflect,h.TSL.reflectVector,h.TSL.reflectView,h.TSL.reflector,h.TSL.refract,h.TSL.refractVector,h.TSL.refractView,h.TSL.reinhardToneMapping,h.TSL.remap,h.TSL.remapClamp,h.TSL.renderGroup,h.TSL.renderOutput,h.TSL.rendererReference,h.TSL.replaceDefaultUV,h.TSL.rotate,h.TSL.rotateUV,h.TSL.roughness,h.TSL.round,h.TSL.rtt,h.TSL.sRGBTransferEOTF,h.TSL.sRGBTransferOETF,h.TSL.sample,h.TSL.sampler,h.TSL.samplerComparison,h.TSL.saturate,h.TSL.saturation,h.TSL.screen,h.TSL.screenCoordinate,h.TSL.screenDPR;let _=h.TSL.screenSize;h.TSL.screenUV,h.TSL.select,h.TSL.setCurrentStack,h.TSL.setName,h.TSL.shaderStages,h.TSL.shadow,h.TSL.shadowPositionWorld,h.TSL.shapeCircle,h.TSL.sharedUniformGroup,h.TSL.sheen,h.TSL.sheenRoughness,h.TSL.shiftLeft,h.TSL.shiftRight,h.TSL.shininess,h.TSL.sign;let x=h.TSL.sin;h.TSL.sinc,h.TSL.skinning;let b=h.TSL.smoothstep;h.TSL.smoothstepElement,h.TSL.specularColor,h.TSL.specularF90,h.TSL.spherizeUV,h.TSL.split,h.TSL.spritesheetUV,h.TSL.sqrt,h.TSL.stack,h.TSL.step,h.TSL.stepElement,h.TSL.storage,h.TSL.storageBarrier,h.TSL.storageTexture,h.TSL.string,h.TSL.struct,h.TSL.sub,h.TSL.subgroupAdd,h.TSL.subgroupAll,h.TSL.subgroupAnd,h.TSL.subgroupAny,h.TSL.subgroupBallot,h.TSL.subgroupBroadcast,h.TSL.subgroupBroadcastFirst,h.TSL.subBuild,h.TSL.subgroupElect,h.TSL.subgroupExclusiveAdd,h.TSL.subgroupExclusiveMul,h.TSL.subgroupInclusiveAdd,h.TSL.subgroupInclusiveMul,h.TSL.subgroupIndex,h.TSL.subgroupMax,h.TSL.subgroupMin,h.TSL.subgroupMul,h.TSL.subgroupOr,h.TSL.subgroupShuffle,h.TSL.subgroupShuffleDown,h.TSL.subgroupShuffleUp,h.TSL.subgroupShuffleXor,h.TSL.subgroupSize,h.TSL.subgroupXor,h.TSL.tan,h.TSL.tangentGeometry,h.TSL.tangentLocal,h.TSL.tangentView,h.TSL.tangentWorld;let S=h.TSL.texture;h.TSL.texture3D,h.TSL.textureBarrier,h.TSL.textureBicubic,h.TSL.textureBicubicLevel,h.TSL.textureCubeUV,h.TSL.textureLoad,h.TSL.textureSize,h.TSL.textureLevel,h.TSL.textureStore,h.TSL.thickness,h.TSL.time,h.TSL.toneMapping,h.TSL.toneMappingExposure,h.TSL.toonOutlinePass,h.TSL.transformDirection,h.TSL.transformNormal,h.TSL.transformNormalToView,h.TSL.transformedClearcoatNormalView,h.TSL.transformedNormalView,h.TSL.transformedNormalWorld,h.TSL.transmission,h.TSL.transpose,h.TSL.triNoise3D,h.TSL.triplanarTexture,h.TSL.triplanarTextures,h.TSL.trunc,h.TSL.uint,h.TSL.uintBitsToFloat;let T=h.TSL.uniform;h.TSL.uniformArray,h.TSL.uniformCubeTexture,h.TSL.uniformGroup,h.TSL.uniformFlow,h.TSL.uniformTexture,h.TSL.unpackHalf2x16,h.TSL.unpackSnorm2x16,h.TSL.unpackUnorm2x16,h.TSL.unpremultiplyAlpha,h.TSL.userData;let A=h.TSL.uv;h.TSL.uvec2,h.TSL.uvec3,h.TSL.uvec4,h.TSL.varying,h.TSL.varyingProperty;let M=h.TSL.vec2,E=h.TSL.vec3,C=h.TSL.vec4;h.TSL.vectorComponents,h.TSL.velocity,h.TSL.vertexColor,h.TSL.vertexIndex,h.TSL.vertexStage,h.TSL.vibrance,h.TSL.viewZToLogarithmicDepth,h.TSL.viewZToOrthographicDepth,h.TSL.viewZToPerspectiveDepth,h.TSL.viewZToReversedOrthographicDepth,h.TSL.viewZToReversedPerspectiveDepth,h.TSL.viewport,h.TSL.viewportCoordinate,h.TSL.viewportDepthTexture,h.TSL.viewportLinearDepth,h.TSL.viewportMipTexture,h.TSL.viewportOpaqueMipTexture,h.TSL.viewportResolution,h.TSL.viewportSafeUV,h.TSL.viewportSharedTexture,h.TSL.viewportSize,h.TSL.viewportTexture,h.TSL.viewportUV,h.TSL.wgsl,h.TSL.wgslFn,h.TSL.workgroupArray,h.TSL.workgroupBarrier,h.TSL.workgroupId,h.TSL.workingToColorSpace,h.TSL.xor;let w=1.2+.6;class R extends h.TempNode{inputNode;uniforms;constructor(e,t){super("vec4"),this.inputNode=e,this.uniforms=t}setup(){let e=this.inputNode,t=this.uniforms;return d(()=>{let r=t.size.div(_),i=f(A().div(r)),n=r.mul(i),a=S(e.sample(A()),n),s=c(E(.2126,.7152,.0722),a.rgb),o=t.radius.mul(s.add(.1)),l=g(n.add(r.mul(.5)).sub(t.pointer)),u=v(p(1),p(1.35),t.pointerVelocity),h=t.interactionRadius.mul(u),d=p(1).sub(b(0,h,l)),y=v(p(1),p(2.4),t.pointerVelocity),T=m(x(c(i,M(12.9898,78.233))).mul(43758.5453)),w=T.mul(1.2),R=T.mul(.39999999999999997).add(.2),N=b(w,w.add(R),t.time),L=d.mul(t.interactionStrength).mul(y).mul(t.pointerActive),B=o.mul(N).mul(p(1).add(L)),I=g(m(A().mul(_).div(t.size)).sub(M(.5,.5))),P=b(B.sub(.01),B.add(.01),I),F=p(1).sub(P).mul(N);return v(C(0,0,0,0),a,F)})()}}function N({size:e=10,radius:t=.4,interactionRadius:i=.15,interactionStrength:n=.5}){let s=(0,r.useRef)(null),o=(0,r.useRef)(null),d=(0,r.useRef)(new l.Vector2(.5,.5)),c=(0,r.useRef)(new l.Vector2(.5,.5)),p=(0,r.useRef)(new l.Vector2(.5,.5)),f=(0,r.useRef)(null),m=(0,r.useRef)(0),g=(0,r.useRef)(0),v=(0,r.useRef)(!1),_=(0,r.useRef)(!1),{scene:x,camera:b,gl:S}=(0,a.useThree)(),[A,M]=(0,r.useState)(!1),E=A?.7*e:e,{outputNode:C,uniforms:N}=(0,r.useMemo)(()=>({outputNode:y(x,b).getTextureNode("output"),uniforms:{size:T(E*window.devicePixelRatio),radius:T(t),time:T(0),pointer:T(new l.Vector2(.5,.5)),pointerActive:T(0),pointerVelocity:T(0),interactionRadius:T(i),interactionStrength:T(n)}}),[x,b,E,t,i,n]);return(0,r.useEffect)(()=>{let e=window.matchMedia("(max-width: 768px)"),t=()=>{M(e.matches)};return t(),e.addEventListener("change",t),()=>{e.removeEventListener("change",t)}},[]),(0,r.useEffect)(()=>{let e=window.matchMedia("(pointer: fine)"),t=()=>{_.current=e.matches,e.matches||(v.current=!1,m.current=0)},r=e=>{if(!_.current)return;let t=e.clientX/window.innerWidth,r=e.clientY/window.innerHeight,i=performance.now();if(null!==f.current){let e=(i-f.current)/1e3;e>0&&(g.current=Math.min(Math.hypot(t-p.current.x,r-p.current.y)/e,2.5))}p.current.set(t,r),f.current=i,c.current.set(t,r),v.current=!0},i=()=>{v.current=!1,m.current=0,g.current=0,f.current=null},n=e=>{null===e.relatedTarget&&i()};return t(),e.addEventListener("change",t),window.addEventListener("pointermove",r,{passive:!0}
737),window.addEventListener("pointerout",n),window.addEventListener("blur",i),()=>{e.removeEventListener("change",t),window.removeEventListener("pointermove",r),window.removeEventListener("pointerout",n),window.removeEventListener("blur",i)}},[]),(0,r.useEffect)(()=>{let e=new h.PostProcessing(S);return e.outputNode=C,s.current=e,s.current&&(s.current.needsUpdate=!0,s.current.outputNode=new R(C,N)),()=>{o.current=null,s.current=null}},[S,C,N]),(0,u.useFrame)(({clock:e},t)=>{null===o.current&&(o.current=e.getElapsedTime());let r=Math.min(e.getElapsedTime()-o.current,w);N.time.value=r;let i=Math.min(t,1/30),n=1-Math.exp(-20*i),a=1-Math.exp(-12*i),u=1-Math.exp(-10*i);d.current.lerp(c.current,n),m.current=l.MathUtils.lerp(m.current,v.current?g.current:0,u),N.pointer.value.copy(d.current),N.pointerActive.value=l.MathUtils.lerp(N.pointerActive.value,v.current&&_.current?1:0,a),N.pointerVelocity.value=l.MathUtils.clamp(m.current/2.5,0,1),s.current&&s.current.render()},1),null}function L(){return(0,r.useEffect)(()=>{let e=document.documentElement,t=s.width/s.height,r=()=>{let r=window.visualViewport?.width??window.innerWidth,i=window.visualViewport?.height??window.innerHeight;e.style.setProperty("--background-plane-height",`${r/i>t?i:r/t}px`)};return r(),window.addEventListener("resize",r),window.visualViewport?.addEventListener("resize",r),()=>{window.removeEventListener("resize",r),window.visualViewport?.removeEventListener("resize",r),e.style.removeProperty("--background-plane-height")}},[]),(0,t.jsx)("div",{className:i.default.background,children:(0,t.jsxs)(o.Canvas,{children:[(0,t.jsx)(B,{}),(0,t.jsx)(N,{})]})})}function B(){let{viewport:e}=(0,a.useThree)(),i=(0,n.useLoader)(l.TextureLoader,s.src),{planeWidth:o,planeHeight:u,planeX:h,planeY:d}=(0,r.useMemo)(()=>{let t=e.width/e.height,r=s.width/s.height,i=e.width,n=e.height;t>r?i=(n=e.height)*r:n=(i=e.width)/r;let a=e.width<e.height?(e.height-n)/2:0;return{planeWidth:i,planeHeight:n,planeX:(e.width-i)/2,planeY:a}},[e.width,e.height]);return(0,t.jsxs)("mesh",{position:[h,d,0],children:[(0,t.jsx)("planeGeometry",{args:[o,u]}),(0,t.jsx)("meshBasicMaterial",{color:"white",map:i,"map-colorSpace":l.SRGBColorSpace,"map-wrapS":l.ClampToEdgeWrapping,"map-wrapT":l.ClampToEdgeWrapping})]})}e.s(["default",()=>L],38574)},94216,e=>{e.v({time:"styles-module__BIgmfG__time"})},42026,e=>{"use strict";var t=e.i(98134),r=e.i(75201);let i=new Intl.DateTimeFormat("en-IE",{timeZone:"Europe/Dublin",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,hourCycle:"h23"});var n=e.i(94216);function a(e,t){let r=new Date(t.toLocaleString("en-US",{timeZone:"UTC"}));return(new Date(t.toLocaleString("en-US",{timeZone:e})).getTime()-r.getTime())/6e4}function s({initialTime:e}){let[s,o]=(0,r.useState)(e),l=(0,r.useMemo)(()=>{let e=new Date,t=Intl.DateTimeFormat().resolvedOptions().timeZone,r=a("Europe/Dublin",e),i=(a(t,e)-r)/60;if(0===i)return"It looks like we're on the same timezone";let n=Math.abs(i),s=Number.isInteger(n)?n:n.toFixed(1);return`It looks like you are ${s} hour${1===n?"":"s"} ${i>0?"ahead of":"behind"} me`},[]);return(0,r.useEffect)(()=>{let e,t=()=>{o(function(e=new Date){return i.format(e)}())};t();let r=Date.now(),n=window.setTimeout(()=>{t(),e=window.setInterval(t,1e3)},1e3-r%1e3);return()=>{window.clearTimeout(n),void 0!==e&&window.clearInterval(e)}},[]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("strong",{className:n.default.time,children:s})," — ",l]})}e.s(["default",()=>s],42026)},4038,e=>{e.v({background:"styles-module__mtqQOG__background",evervault:"styles-module__mtqQOG__evervault",scene:"styles-module__mtqQOG__scene",sceneReducedMotion:"styles-module__mtqQOG__sceneReducedMotion",sceneVisible:"styles-module__mtqQOG__sceneVisible",text:"styles-module__mtqQOG__text"})},29501,e=>{"use strict";let t,r;var i=e.i(98134),n=e.i(4038),a=e.i(69651);function s(){return(s=Object.assign.bind()).apply(null,arguments)}var o=e.i(75201),l=e.i(10826),u=e.i(34900),h=e.i(33360),h=h,d=h,c=e.i(47380),p=e.i(30611),f=e.i(9684),m=p;let g=parseInt(p.REVISION.replace(/\D+/g,""));class v extends m.Mesh{constructor(e,t){var r,i;const n=(e=>e&&e.isCubeTexture)(e),a=Math.floor(Math.log2((null!=(i=n?null==(r=e.image[0])?void 0:r.width:e.image.width)?i:1024)/4)),s=Math.pow(2,a),o=3*Math.max(s,112),l=` 738 varying vec3 vWorldPosition; 739 void main() 740 { 741 vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) ); 742 vWorldPosition = worldPosition.xyz; 743 744 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 745 } 746 `,u=[n?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/o}`,`#define CUBEUV_TEXEL_HEIGHT ${1/(4*s)}`,`#define CUBEUV_MAX_MIP ${a}.0`].join("\n")+` 747 #define ENVMAP_TYPE_CUBE_UV 748 varying vec3 vWorldPosition; 749 uniform float radius; 750 uniform float height; 751 uniform float angle; 752 #ifdef ENVMAP_TYPE_CUBE 753 uniform samplerCube map; 754 #else 755 uniform sampler2D map; 756 #endif 757 // From: https://www.shadertoy.com/view/4tsBD7 758 float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) 759 { 760 float d = dot ( rd, n ); 761 762 if( d > 0.0 ) { return 1e6; } 763 764 vec3 o = ro - c; 765 float t = - dot( n, o ) / d; 766 vec3 q = o + rd * t; 767 768 return ( dot( q, q ) < r * r ) ? t : 1e6; 769 } 770 // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm 771 float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) 772 { 773 vec3 oc = ro - ce; 774 float b = dot( oc, rd ); 775 float c = dot( oc, oc ) - ra * ra; 776 float h = b * b - c; 777 778 if( h < 0.0 ) { return -1.0; } 779 780 h = sqrt( h ); 781 782 return - b + h; 783 } 784 vec3 project() 785 { 786 vec3 p = normalize( vWorldPosition ); 787 vec3 camPos = cameraPosition; 788 camPos.y -= height; 789 float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius ); 790 if( intersection > 0.0 ) { 791 792 vec3 h = vec3( 0.0, - height, 0.0 ); 793 float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius ); 794 p = ( camPos + min( intersection, intersection2 ) * p ) / radius; 795 } else { 796 p = vec3( 0.0, 1.0, 0.0 ); 797 } 798 return p; 799 } 800 #include <common> 801 #include <cube_uv_reflection_fragment> 802 void main() 803 { 804 vec3 projectedWorldPosition = project(); 805 806 #ifdef ENVMAP_TYPE_CUBE 807 vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb; 808 #else 809 vec3 direction = normalize( projectedWorldPosition ); 810 vec2 uv = equirectUv( direction ); 811 vec3 outcolor = texture2D( map, uv ).rgb; 812 #endif 813 gl_FragColor = vec4( outcolor, 1.0 ); 814 #include <tonemapping_fragment> 815 #include <${g>=154?"colorspace_fragment":"encodings_fragment"}> 816 } 817 `,h={map:{value:e},height:{value:(null==t?void 0:t.height)||15},radius:{value:(null==t?void 0:t.radius)||100}};super(new m.IcosahedronGeometry(1,16),new m.ShaderMaterial({uniforms:h,fragmentShader:u,vertexShader:l,side:m.DoubleSide}))}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 y=e.i(98430),_=p;class x extends _.DataTextureLoader{constructor(e){super(e),this.type=_.HalfFloatType}parse(e){let t,r,i,n=function(e,t){switch(e){case 1:throw Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw Error("THREE.RGBELoader: Memory Error: "+(t||""))}},a=function(e,t,r){t=t||1024;let i=e.pos,n=-1,a=0,s="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));for(;0>(n=o.indexOf("\n"))&&a<t&&i<e.byteLength;)s+=o,a+=o.length,i+=128,o+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));return -1<n&&(!1!==r&&(e.pos+=a+n+1),s+o.slice(0,n))},s=new Uint8Array(e);s.pos=0;let o=function(e){let t,r,i=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*EXPOSURE\s*=\s
817*(\d+(\.\d+)?)\s*$/,o=/^\s*FORMAT=(\S+)\s*$/,l=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,u={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for(!(e.pos>=e.byteLength)&&(t=a(e))||n(1,"no header found"),(r=t.match(/^#\?(\S+)/))||n(3,"bad initial token"),u.valid|=1,u.programtype=r[1],u.string+=t+"\n";!1!==(t=a(e));){if(u.string+=t+"\n","#"===t.charAt(0)){u.comments+=t+"\n";continue}if((r=t.match(i))&&(u.gamma=parseFloat(r[1])),(r=t.match(s))&&(u.exposure=parseFloat(r[1])),(r=t.match(o))&&(u.valid|=2,u.format=r[1]),(r=t.match(l))&&(u.valid|=4,u.height=parseInt(r[1],10),u.width=parseInt(r[2],10)),2&u.valid&&4&u.valid)break}return 2&u.valid||n(3,"missing format specifier"),4&u.valid||n(3,"missing image size specifier"),u}(s),l=o.width,u=o.height,h=function(e,t,r){if(t<8||t>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);t!==(e[2]<<8|e[3])&&n(3,"wrong scanline width");let i=new Uint8Array(4*t*r);i.length||n(4,"unable to allocate buffer space");let a=0,s=0,o=4*t,l=new Uint8Array(4),u=new Uint8Array(o),h=r;for(;h>0&&s<e.byteLength;){s+4>e.byteLength&&n(1),l[0]=e[s++],l[1]=e[s++],l[2]=e[s++],l[3]=e[s++],(2!=l[0]||2!=l[1]||(l[2]<<8|l[3])!=t)&&n(3,"bad rgbe scanline format");let r=0,d;for(;r<o&&s<e.byteLength;){let t=(d=e[s++])>128;if(t&&(d-=128),(0===d||r+d>o)&&n(3,"bad scanline data"),t){let t=e[s++];for(let e=0;e<d;e++)u[r++]=t}else u.set(e.subarray(s,s+d),r),r+=d,s+=d}for(let e=0;e<t;e++){let r=0;i[a]=u[e+r],r+=t,i[a+1]=u[e+r],r+=t,i[a+2]=u[e+r],r+=t,i[a+3]=u[e+r],a+=4}h--}return i}(s.subarray(s.pos),l,u);switch(this.type){case _.FloatType:let d=new Float32Array(4*(i=h.length/4));for(let e=0;e<i;e++)!function(e,t,r,i){let n=Math.pow(2,e[t+3]-128)/255;r[i+0]=e[t+0]*n,r[i+1]=e[t+1]*n,r[i+2]=e[t+2]*n,r[i+3]=1}(h,4*e,d,4*e);t=d,r=_.FloatType;break;case _.HalfFloatType:let c=new Uint16Array(4*(i=h.length/4));for(let e=0;e<i;e++)!function(e,t,r,i){let n=Math.pow(2,e[t+3]-128)/255;r[i+0]=_.DataUtils.toHalfFloat(Math.min(e[t+0]*n,65504)),r[i+1]=_.DataUtils.toHalfFloat(Math.min(e[t+1]*n,65504)),r[i+2]=_.DataUtils.toHalfFloat(Math.min(e[t+2]*n,65504)),r[i+3]=_.DataUtils.toHalfFloat(1)}(h,4*e,c,4*e);t=c,r=_.HalfFloatType;break;default:throw Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:l,height:u,data:t,header:o.string,gamma:o.gamma,exposure:o.exposure,type:r}}setDataType(e){return this.type=e,this}load(e,t,r,i){return super.load(e,function(e,r){switch(e.type){case _.FloatType:case _.HalfFloatType:"colorSpace"in e?e.colorSpace="srgb-linear":e.encoding=3e3,e.minFilter=_.LinearFilter,e.magFilter=_.LinearFilter,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,r)},r,i)}}var b=p,S={},T=function(e,t,r,i,n){var a=new Worker(S[t]||(S[t]=URL.createObjectURL(new Blob([e],{type:"text/javascript"}))));return a.onerror=function(e){return n(e.error,null)},a.onmessage=function(e){return n(null,e.data)},a.postMessage(r,i),a},A=Uint8Array,M=Uint16Array,E=Uint32Array,C=new A([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]),w=new A([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]),R=new A([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),N=function(e,t){for(var r=new M(31),i=0;i<31;++i)r[i]=t+=1<<e[i-1];for(var n=new E(r[30]),i=1;i<30;++i)for(var a=r[i];a<r[i+1];++a)n[a]=a-r[i]<<5|i;return[r,n]},L=N(C,2),B=L[0],I=L[1];B[28]=258,I[258]=28;for(var P=N(w,0),F=P[0],D=P[1],U=new M(32768),O=0;O<32768;++O){var G=(43690&O)>>>1|(21845&O)<<1;G=(61680&(G=(52428&G)>>>2|(13107&G)<<2))>>>4|(3855&G)<<4,U[O]=((65280&G)>>>8|(255&G)<<8)>>>1}for(var k=function(e,t,r){for(var i,n=e.length,a=0,s=new M(t);a<n;++a)++s[e[a]-1];var o=new M(t);for(a=0;a<t;++a)o[a]=o[a-1]+s[a-1]<<1;if(r){i=new M(1<<t);var l=15-t;for(a=0;a<n;++a)if(e[a])for(var u=a<<4|e[a],h=t-e[a],d=o[e[a]-1]++<<h,c=d|(1<<h)-1;d<=c;++d)i[U[d]>>>l]=u}else for(a=0,i=new M(n);a<n;++a)e[a]&&(i[a]=U[o[e[a]-1]++]>>>15-e[a]);return i},V=new A(288),O=0;O<144;++O)V[O]=8;for(var O=144;O<256;++O)V[O]=9;for(var O=256;O<280;++O)V[O]=7;for(var O=280;O<288;++O)V[O]=8;for(var z=new A(32),O=0;O<32;++O)z[O]=5;
817var H=k(V,9,0),W=k(V,9,1),j=k(z,5,0),X=k(z,5,1),q=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},$=function(e,t,r){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(7&t)&r},J=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&t)},K=function(e){return(e/8|0)+(7&e&&1)},Y=function(e,t,r){(null==t||t<0)&&(t=0),(null==r||r>e.length)&&(r=e.length);var i=new(e instanceof M?M:e instanceof E?E:A)(r-t);return i.set(e.subarray(t,r)),i},Q=function(e,t,r){var i=e.length;if(!i||r&&!r.l&&i<5)return t||new A(0);var n=!t||r,a=!r||r.i;r||(r={}),t||(t=new A(3*i));var s=function(e){var r=t.length;if(e>r){var i=new A(Math.max(2*r,e));i.set(t),t=i}},o=r.f||0,l=r.p||0,u=r.b||0,h=r.l,d=r.d,c=r.m,p=r.n,f=8*i;do{if(!h){r.f=o=$(e,l,1);var m=$(e,l+1,3);if(l+=3,m)if(1==m)h=W,d=X,c=9,p=5;else if(2==m){var g=$(e,l,31)+257,v=$(e,l+10,15)+4,y=g+$(e,l+5,31)+1;l+=14;for(var _=new A(y),x=new A(19),b=0;b<v;++b)x[R[b]]=$(e,l+3*b,7);l+=3*v;for(var S=q(x),T=(1<<S)-1,M=k(x,S,1),b=0;b<y;){var E=M[$(e,l,T)];l+=15&E;var N=E>>>4;if(N<16)_[b++]=N;else{var L=0,I=0;for(16==N?(I=3+$(e,l,3),l+=2,L=_[b-1]):17==N?(I=3+$(e,l,7),l+=3):18==N&&(I=11+$(e,l,127),l+=7);I--;)_[b++]=L}}var P=_.subarray(0,g),D=_.subarray(g);c=q(P),p=q(D),h=k(P,c,1),d=k(D,p,1)}else throw"invalid block type";else{var N=K(l)+4,U=e[N-4]|e[N-3]<<8,O=N+U;if(O>i){if(a)throw"unexpected EOF";break}n&&s(u+U),t.set(e.subarray(N,O),u),r.b=u+=U,r.p=l=8*O;continue}if(l>f){if(a)throw"unexpected EOF";break}}n&&s(u+131072);for(var G=(1<<c)-1,V=(1<<p)-1,z=l;;z=l){var L=h[J(e,l)&G],H=L>>>4;if((l+=15&L)>f){if(a)throw"unexpected EOF";break}if(!L)throw"invalid length/literal";if(H<256)t[u++]=H;else if(256==H){z=l,h=null;break}else{var j=H-254;if(H>264){var b=H-257,Q=C[b];j=$(e,l,(1<<Q)-1)+B[b],l+=Q}var Z=d[J(e,l)&V],ee=Z>>>4;if(!Z)throw"invalid distance";l+=15&Z;var D=F[ee];if(ee>3){var Q=w[ee];D+=J(e,l)&(1<<Q)-1,l+=Q}if(l>f){if(a)throw"unexpected EOF";break}n&&s(u+131072);for(var et=u+j;u<et;u+=4)t[u]=t[u-D],t[u+1]=t[u+1-D],t[u+2]=t[u+2-D],t[u+3]=t[u+3-D];u=et}}r.l=h,r.p=z,r.b=u,h&&(o=1,r.m=c,r.d=d,r.n=p)}while(!o)return u==t.length?t:Y(t,0,u)},Z=function(e,t,r){r<<=7&t;var i=t/8|0;e[i]|=r,e[i+1]|=r>>>8},ee=function(e,t,r){r<<=7&t;var i=t/8|0;e[i]|=r,e[i+1]|=r>>>8,e[i+2]|=r>>>16},et=function(e,t){for(var r=[],i=0;i<e.length;++i)e[i]&&r.push({s:i,f:e[i]});var n=r.length,a=r.slice();if(!n)return[el,0];if(1==n){var s=new A(r[0].s+1);return s[r[0].s]=1,[s,1]}r.sort(function(e,t){return e.f-t.f}),r.push({s:-1,f:25001});var o=r[0],l=r[1],u=0,h=1,d=2;for(r[0]={s:-1,f:o.f+l.f,l:o,r:l};h!=n-1;)o=r[r[u].f<r[d].f?u++:d++],l=r[u!=h&&r[u].f<r[d].f?u++:d++],r[h++]={s:-1,f:o.f+l.f,l:o,r:l};for(var c=a[0].s,i=1;i<n;++i)a[i].s>c&&(c=a[i].s);var p=new M(c+1),f=er(r[h-1],p,0);if(f>t){var i=0,m=0,g=f-t,v=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});i<n;++i){var y=a[i].s;if(p[y]>t)m+=v-(1<<f-p[y]),p[y]=t;else break}for(m>>>=g;m>0;){var _=a[i].s;p[_]<t?m-=1<<t-p[_]++-1:++i}for(;i>=0&&m;--i){var x=a[i].s;p[x]==t&&(--p[x],++m)}f=t}return[new A(p),f]},er=function(e,t,r){return -1==e.s?Math.max(er(e.l,t,r+1),er(e.r,t,r+1)):t[e.s]=r},ei=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new M(++t),i=0,n=e[0],a=1,s=function(e){r[i++]=e},o=1;o<=t;++o)if(e[o]==n&&o!=t)++a;else{if(!n&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(n),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(n);a=1,n=e[o]}return[r.subarray(0,i),t]},en=function(e,t){for(var r=0,i=0;i<t.length;++i)r+=e[i]*t[i];return r},ea=function(e,t,r){var i=r.length,n=K(t+2);e[n]=255&i,e[n+1]=i>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var a=0;a<i;++a)e[n+a+4]=r[a];return(n+4+i)*8},es=function(e,t,r,i,n,a,s,o,l,u,h){Z(t,h++,r),++n[256];for(var d,c,p,f,m=et(n,15),g=m[0],v=m[1],y=et(a,15),_=y[0],x=y[1],b=ei(g),S=b[0],T=b[1],A=ei(_),E=A[0],N=A[1],L=new M(19),B=0;B<S.length;++B)L[31&S[B]]++;for(var B=0;B<E.length;++B)L[31&E[B]]++;for(var I=et(L,7),P=I[0],F=I[1],D=19;D>4&&!P[R[D-1]];--D);var U=u+5<<3,O=en(n,V)+en(a,z)+s,G=en(n,g)+en(a,_)+s+14+3*D+en(L,P)+(2*L[16]+3*L[17]+7*L[18]);if(U<=O&&U<=G)return ea(t,h,e.subarray(l,l+u));if(Z(t,h,1+(G<O)),h+=2,G<O){d=k(g,v,0),c=g,p=k(_,x,0),f=_;var W=k(P,F,0);Z(t,h,T-257),Z(t,h+5,N-1),Z(t,h+10,D-4),h+=14;for(var B=0;B<D;++B)Z(t,h+3*B,P[R[B]]);h+=3*D;for(var X=[S,E],q=0;q<2;++q)for(var $=X[q],B=0;B<$.length;++B){var J=31&$[B];Z(t,h,W[J]),h+=P[J],J>15&&(Z(t,h,$[B]>>>5&127),h+=$[B]>>>12)}}else d=H,c=V,p=j,f=z;for(var B=0;B<o;++B)if(i[B]>255){var J=i[B]>>>18&31;ee(t,h,d[J+257]),h+=c[J+257],J>7&&(Z(t,h,i[B]>>>23&31),h+=C[J]);var K=31&i[B];ee(t,h,p[K]),h+=f[K],K>3&&(ee(t,h,i[B]>>>5&8191),h+=w[K])}else ee(t,h,d[i[B]]),h+=c[i[B]];return ee(t,h,d[256]),h+c[256]},eo=new E([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),el=new A(0),eu=function(e,t,r,i,n,a){var s=e.length,o=new A(i+s+5*(1+Math.ceil(s/7e3))+n),l=o.subarray(i,o.length-n),u=0;if(!t||s<8)for(var h=0;h<=s;h+=65535){var d=h+65535;
817d<s?u=ea(l,u,e.subarray(h,d)):(l[h]=a,u=ea(l,u,e.subarray(h,s)))}else{for(var c=eo[t-1],p=c>>>13,f=8191&c,m=(1<<r)-1,g=new M(32768),v=new M(m+1),y=Math.ceil(r/3),_=2*y,x=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<_)&m},b=new E(25e3),S=new M(288),T=new M(32),R=0,N=0,h=0,L=0,B=0,P=0;h<s;++h){var F=x(h),U=32767&h,O=v[F];if(g[U]=O,v[F]=U,B<=h){var G=s-h;if((R>7e3||L>24576)&&G>423){u=es(e,l,0,b,S,T,N,L,P,h-P,u),L=R=N=0,P=h;for(var k=0;k<286;++k)S[k]=0;for(var k=0;k<30;++k)T[k]=0}var V=2,z=0,H=f,W=U-O&32767;if(G>2&&F==x(h-W))for(var j=Math.min(p,G)-1,X=Math.min(32767,h),q=Math.min(258,G);W<=X&&--H&&U!=O;){if(e[h+V]==e[h+V-W]){for(var $=0;$<q&&e[h+$]==e[h+$-W];++$);if($>V){if(V=$,z=W,$>j)break;for(var J=Math.min(W,$-2),Q=0,k=0;k<J;++k){var Z=h-W+k+32768&32767,ee=g[Z],et=Z-ee+32768&32767;et>Q&&(Q=et,O=Z)}}}O=g[U=O],W+=U-O+32768&32767}if(z){b[L++]=0x10000000|I[V]<<18|D[z];var er=31&I[V],ei=31&D[z];N+=C[er]+w[ei],++S[257+er],++T[ei],B=h+V,++R}else b[L++]=e[h],++S[e[h]]}}u=es(e,l,a,b,S,T,N,L,P,h-P,u),!a&&7&u&&(u=ea(l,u+1,el))}return Y(o,0,i+K(u)+n)},eh=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var r=t,i=9;--i;)r=(1&r&&-0x12477ce0)^r>>>1;e[t]=r}return e}(),ed=function(){var e=-1;return{p:function(t){for(var r=e,i=0;i<t.length;++i)r=eh[255&r^t[i]]^r>>>8;e=r},d:function(){return~e}}},ec=function(){var e=1,t=0;return{p:function(r){for(var i=e,n=t,a=r.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s<o;++s)n+=i+=r[s];i=(65535&i)+15*(i>>16),n=(65535&n)+15*(n>>16)}e=i,t=n},d:function(){return e%=65521,t%=65521,(255&e)<<24|e>>>8<<16|(255&t)<<8|t>>>8}}},ep=function(e,t,r,i,n){return eu(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,r,i,!n)},ef=function(e,t){var r={};for(var i in e)r[i]=e[i];for(var i in t)r[i]=t[i];return r},em=function(e,t,r){for(var i=e(),n=e.toString(),a=n.slice(n.indexOf("[")+1,n.lastIndexOf("]")).replace(/ /g,"").split(","),s=0;s<i.length;++s){var o=i[s],l=a[s];if("function"==typeof o){t+=";"+l+"=";var u=o.toString();if(o.prototype)if(-1!=u.indexOf("[native code]")){var h=u.indexOf(" ",8)+1;t+=u.slice(h,u.indexOf("(",h))}else for(var d in t+=u,o.prototype)t+=";"+l+".prototype."+d+"="+o.prototype[d].toString();else t+=u}else r[l]=o}return[t,r]},eg=[],ev=function(e){var t=[];for(var r in e)(e[r]instanceof A||e[r]instanceof M||e[r]instanceof E)&&t.push((e[r]=new e[r].constructor(e[r])).buffer);return t},ey=function(e,t,r,i){if(!eg[r]){for(var n,a="",s={},o=e.length-1,l=0;l<o;++l)a=(n=em(e[l],a,s))[0],s=n[1];eg[r]=em(e[o],a,s)}var u=ef({},eg[r][1]);return T(eg[r][0]+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",r,u,ev(u),i)},e_=function(){return[A,M,E,C,w,R,B,F,W,X,U,k,q,$,J,K,Y,Q,eH,eT,eA]},ex=function(){return[A,M,E,C,w,R,I,D,H,V,j,z,U,eo,el,k,Z,ee,et,er,ei,en,ea,es,K,Y,eu,ep,ek,eT]},eb=function(){return[eB,eI]},eS=function(){return[eD]},eT=function(e){return postMessage(e,[e.buffer])},eA=function(e){return e&&e.size&&new A(e.size)},eM=function(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){return e.push(t.data[0],t.data[1])}},eE=function(e,t,r,i,n){var a,s=ey(e,i,n,function(e,r){e?(s.terminate(),t.ondata.call(t,e)):(r[1]&&s.terminate(),t.ondata.call(t,e,r[0],r[1]))});s.postMessage(r),t.push=function(e,r){if(a)throw"stream finished";if(!t.ondata)throw"no stream handler";s.postMessage([e,a=r],[e.buffer])},t.terminate=function(){s.terminate()}},eC=function(e,t){return e[t]|e[t+1]<<8},ew=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},eR=function(e,t){return ew(e,t)+0x100000000*ew(e,t+4)},eN=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},eL=function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:2*(9==t.level),e[9]=3,0!=t.mtime&&eN(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var i=0;i<=r.length;++i)e[i+10]=r.charCodeAt(i)}},eB=function(e){if(31!=e[0]||139!=e[1]||8!=e[2])throw"invalid gzip data";var t=e[3],r=10;4&t&&(r+=e[10]|(e[11]<<8)+2);for(var i=(t>>3&1)+(t>>4&1);i>0;i-=!e[r++]);return r+(2&t)},eI=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},eP=function(e){return 10+(e.filename&&e.filename.length+1||0)},eF=function(e,t){var r=t.level,i=0==r?0:r<6?1:9==r?3:2;e[0]=120,e[1]=i<<6|(i?32-2*i:1)},eD=function(e){if((15&e[0])!=8||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(32&e[1])throw"invalid zlib data: preset dictionaries not supported"};function eU(e,t){return t||"function"!=typeof e||(t=e,e={}),this.ondata=t,e}var eO=function(){function e(e,t){t||"function"!=typeof e||(t=e,e={}),this.ondata=t,this.o=e||{}}return e.prototype.p=function(e,t){this.ondata(ep(e,this.o,0,0,!t),t)},e.prototype.push=function(e,t){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";this.d=t,this.p(e,t||!1)},e}(),eG=function(e,t){eE([ex,function(){return[eM,eO]}],this,eU.call(this,e,t),function(e){onmessage=eM(new eO(e.data))},6)};function ek(e,t){return ep(e,t||{},0,0)}var eV=function(){function e(e){this.s={},this.p=new A(0),this.ondata=e}return e.prototype.e=function(e){if(this.d)throw"stream finished";if(!this.ondata)throw"no stream handler";var t=this.p.length,r=new A(t+e.length);r.set(this.p),r.set(e,t),this.p=r},e.prototype.c=function(e){this.d=this.s.i=e||!1;var t=this.s.b,r=Q(this.p,this.o,this.s);this.ondata(Y(r,t,this.s.b),this.d),this.o=Y(r,this.s.b-32768),this.s.b=this.o.length,this.p=Y(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),ez=function(e){this.ondata=e,eE([e_,function(){return[eM,eV]}],this,0,function(){onmessage=eM(new eV)},7)};function eH(e,t){return Q(e,t)}(function(){function e(e,t){this.c=ed(),this.l=0,this.v=1,eO.call(this,e,t)}e.prototype.push=function(e,t){eO.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e),this.l+=e.length;var r=ep(e,this.o,this.v&&eP(this.o),t&&8,!t);this.v&&(eL(r,this.o),this.v=0),t&&(eN(r,r.length-8,this.c.d()),eN(r,r.length-4,this.l)),this.ondata(r,t)}})();var eW=function(){function e(e){this.v=1,eV.call(this,e)}return e.prototype.push=function(e,t){if(eV.prototype.e.call(this,e),this.v){var r=this.p.length>3?eB(this.p):4;if(r>=this.p.length&&!t)return;this.p=this.p.subarray(r),this.v=0}if(t){if(this.p.length<8)throw"invalid gzip stream";this.p=this.p.subarray(0,-8)}eV.prototype.c.call(this,t)},e}(),ej=function(e){this.ondata=e,eE([e_,eb,function(){return[eM,eV,eW]}],this,0,function(){onmessage=eM(new eW)},9)},eX=(function(){function e(e,t){this.c=ec(),this.v=1,eO.call(this,e,t)}e.prototype.push=function(e,t){eO.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){this.c.p(e);var r=ep(e,this.o,this.v&&2,t&&4,!t);this.v&&(eF(r,this.o),this.v=0),t&&eN(r,r.length-4,this.c.d()),this.ondata(r,t)}}(),function(){function e(e){this.v=1,eV.call(this,e)}return e.prototype.push=function(e,t){if(eV.prototype.e.call(this,e),this.v){if(this.p.length<2&&!t)return;this.p=this.p.subarray(2),this.v=0}if(t){if(this.p.length<4)throw"invalid zlib stream";this.p=this.p.subarray(0,-4)}eV.prototype.c.call(this,t)},e}()),eq=function(e){this.ondata=e,eE([e_,eS,function(){return[eM,eV,eX]}],this,0,function(){onmessage=eM(new eX)},11)};function e$(e,t){return Q((eD(e),e.subarray(2,-4)),t)}var eJ=function(){function e(e){this.G=eW,this.I=eV,this.Z=eX,this.ondata=e}return e.prototype.push=function(e,t){if(!this.ondata)throw"no stream handler";if(this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var r=new A(this.p.length+e.length);r.set(this.p),r.set(e,this.p.length)}else this.p=e;if(this.p.length>2){var i=this,n=function(){i.ondata.apply(i,arguments)};this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(n):(15&this.p[0])!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(n):new this.Z(n),this.s.push(this.p,t),this.p=null}}},e}();(function(e){this.G=ej,this.I=ez,this.Z=eq,this.ondata=e}).prototype.push=function(e,t){eJ.prototype.push.call(this,e,t)};var eK="u">typeof TextEncoder&&new TextEncoder,eY="u">typeof TextDecoder&&new TextDecoder,eQ=0;try{eY.decode(el,{stream:!0}),eQ=1}catch(e){}var eZ=function(e){for(var t="",r=0;;){var i=e[r++],n=(i>127)+(i>223)+(i>239);if(r+n>e.length)return[t,Y(e,r-1)];n?3==n?t+=String.fromCharCode(55296|(i=((15&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536)>>10,56320|1023&i):1&n?t+=String.fromCharCode((31&i)<<6|63&e[r++]):t+=String.fromCharCode((1
8175&i)<<12|(63&e[r++])<<6|63&e[r++]):t+=String.fromCharCode(i)}};function e0(e,t){if(t){for(var r=new A(e.length),i=0;i<e.length;++i)r[i]=e.charCodeAt(i);return r}if(eK)return eK.encode(e);for(var n=e.length,a=new A(e.length+(e.length>>1)),s=0,o=function(e){a[s++]=e},i=0;i<n;++i){if(s+5>a.length){var l=new A(s+8+(n-i<<1));l.set(a),a=l}var u=e.charCodeAt(i);u<128||t?o(u):(u<2048?o(192|u>>6):(u>55295&&u<57344?(o(240|(u=65536+(1047552&u)|1023&e.charCodeAt(++i))>>18),o(128|u>>12&63)):o(224|u>>12),o(128|u>>6&63)),o(128|63&u))}return Y(a,0,s)}(function(e){this.ondata=e,eQ?this.t=new TextDecoder:this.p=el}).prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(t=!!t,this.t){if(this.ondata(this.t.decode(e,{stream:!0}),t),t){if(this.t.decode().length)throw"invalid utf-8 data";this.t=null}return}if(!this.p)throw"stream finished";var r=new A(this.p.length+e.length);r.set(this.p),r.set(e,this.p.length);var i=eZ(r),n=i[0],a=i[1];if(t){if(a.length)throw"invalid utf-8 data";this.p=null}else this.p=a;this.ondata(n,t)},(function(e){this.ondata=e}).prototype.push=function(e,t){if(!this.ondata)throw"no callback";if(this.d)throw"stream finished";this.ondata(e0(e),this.d=t||!1)};var e1=function(e){return 1==e?3:e<6?2:+(9==e)},e2=function(e,t){for(;1!=eC(e,t);t+=4+eC(e,t+2));return[eR(e,t+12),eR(e,t+4),eR(e,t+20)]},e3=function(e){var t=0;if(e)for(var r in e){var i=e[r].length;if(i>65535)throw"extra field too long";t+=i+4}return t},e4=function(e,t,r,i,n,a,s,o){var l=i.length,u=r.extra,h=o&&o.length,d=e3(u);eN(e,t,null!=s?0x2014b50:0x4034b50),t+=4,null!=s&&(e[t++]=20,e[t++]=r.os),e[t]=20,t+=2,e[t++]=r.flag<<1|(null==a&&8),e[t++]=n&&8,e[t++]=255&r.compression,e[t++]=r.compression>>8;var c=new Date(null==r.mtime?Date.now():r.mtime),p=c.getFullYear()-1980;if(p<0||p>119)throw"date not in range 1980-2099";if(eN(e,t,p<<25|c.getMonth()+1<<21|c.getDate()<<16|c.getHours()<<11|c.getMinutes()<<5|c.getSeconds()>>>1),t+=4,null!=a&&(eN(e,t,r.crc),eN(e,t+4,a),eN(e,t+8,r.size)),eN(e,t+12,l),eN(e,t+14,d),t+=16,null!=s&&(eN(e,t,h),eN(e,t+6,r.attrs),eN(e,t+10,s),t+=14),e.set(i,t),t+=l,d)for(var f in u){var m=u[f],g=m.length;eN(e,t,+f),eN(e,t+2,g),e.set(m,t+4),t+=4+g}return h&&(e.set(o,t),t+=h),t},e5=function(e,t,r,i,n){eN(e,t,0x6054b50),eN(e,t+8,r),eN(e,t+10,r),eN(e,t+12,i),eN(e,t+16,n)},e8=function(){function e(e){this.filename=e,this.c=ed(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){if(!this.ondata)throw"no callback - add to ZIP archive before pushing";this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}();function e6(e,t){var r=this;t||(t={}),e8.call(this,e),this.d=new eO(t,function(e,t){r.ondata(null,e,t)}),this.compression=8,this.flag=e1(t.level)}function e9(e,t){var r=this;t||(t={}),e8.call(this,e),this.d=new eG(t,function(e,t,i){r.ondata(e,t,i)}),this.compression=8,this.flag=e1(t.level),this.terminate=this.d.terminate}function e7(e){this.ondata=e,this.u=[],this.d=1}e6.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e6.prototype.push=function(e,t){e8.prototype.push.call(this,e,t)},e9.prototype.process=function(e,t){this.d.push(e,t)},e9.prototype.push=function(e,t){e8.prototype.push.call(this,e,t)},e7.prototype.add=function(e){var t=this;if(2&this.d)throw"stream finished";var r=e0(e.filename),i=r.length,n=e.comment,a=n&&e0(n),s=i!=e.filename.length||a&&n.length!=a.length,o=i+e3(e.extra)+30;if(i>65535)throw"filename too long";var l=new A(o);e4(l,0,e,r,s);var u=[l],h=function(){for(var e=0,r=u;e<r.length;e++){var i=r[e];t.ondata(null,i,!1)}u=[]},d=this.d;this.d=0;var c=this.u.length,p=ef(e,{f:r,u:s,o:a,t:function(){e.terminate&&e.terminate()},r:function(){if(h(),d){var e=t.u[c+1];e?e.r():t.d=1}d=1}}),f=0;e.ondata=function(r,i,n){if(r)t.ondata(r,i,n),t.terminate();else if(f+=i.length,u.push(i),n){var a=new A(16);eN(a,0,0x8074b50),eN(a,4,e.crc),eN(a,8,f),eN(a,12,e.size),u.push(a),p.c=f,p.b=o+f+16,p.crc=e.crc,p.size=e.size,d&&p.r(),d=1}else d&&h()},this.u.push(p)},e7.prototype.end=function(){var e=this;if(2&this.d){if(1&this.d)throw"stream finishing";throw"stream finished"}this.d?this.e():this.u.push({r:function(){1&e.d&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e7.prototype.e=function(){for(var e=0,t=0,r=0,i=0,n=this.u;i<n.length;i++){var a=n[i];r+=46+a.f.length+e3(a.extra)+(a.o?a.o.length:0)}for(var s=new A(r+22),o=0,l=this.u;o<l.length;o++){var a=l[o];e4(s,e,a,a.f,a.u,a.c,t,a.o),e+=46+a.f.length+e3(a.extra)+(a.o?a.o.length:0),t+=a.b}
817e5(s,e,this.u.length,r,t),this.ondata(null,s,!0),this.d=2},e7.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2};var te=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}();function tt(){var e=this;this.i=new eV(function(t,r){e.ondata(null,t,r)})}function tr(e,t){var r=this;t<32e4?this.i=new eV(function(e,t){r.ondata(null,e,t)}):(this.i=new ez(function(e,t,i){r.ondata(e,t,i)}),this.terminate=this.i.terminate)}function ti(e){this.onfile=e,this.k=[],this.o={0:te},this.p=el}tt.prototype.push=function(e,t){try{this.i.push(e,t)}catch(r){this.ondata(r,e,t)}},tt.compression=8,tr.prototype.push=function(e,t){this.i.terminate&&(e=Y(e,0)),this.i.push(e,t)},tr.compression=8,ti.prototype.push=function(e,t){var r=this;if(!this.onfile)throw"no callback";if(!this.p)throw"stream finished";if(this.c>0){var i=Math.min(this.c,e.length),n=e.subarray(0,i);if(this.c-=i,this.d?this.d.push(n,!this.c):this.k[0].push(n),(e=e.subarray(i)).length)return this.push(e,t)}else{var a=0,s=0,o=void 0,l=void 0;this.p.length?e.length?((l=new A(this.p.length+e.length)).set(this.p),l.set(e,this.p.length)):l=this.p:l=e;for(var u=l.length,h=this.c,d=h&&this.d,c=this;s<u-4&&"break"!==function(){var e=ew(l,s);if(0x4034b50==e){a=1,o=s,c.d=null,c.c=0;var t=eC(l,s+6),i=eC(l,s+8),n=8&t,d=eC(l,s+26),p=eC(l,s+28);if(u>s+30+d+p){var f,m,g=[];c.k.unshift(g),a=2;var v=ew(l,s+18),y=ew(l,s+22),_=function(e,t){if(t){for(var r="",i=0;i<e.length;i+=16384)r+=String.fromCharCode.apply(null,e.subarray(i,i+16384));return r}if(eY)return eY.decode(e);var n=eZ(e),a=n[0];if(n[1].length)throw"invalid utf-8 data";return a}(l.subarray(s+30,s+=30+d),!(2048&t));0xffffffff==v?(v=(f=n?[-2]:e2(l,s))[0],y=f[1]):n&&(v=-1),s+=p,c.c=v;var x={name:_,compression:i,start:function(){if(!x.ondata)throw"no callback";if(v){var e=r.o[i];if(!e)throw"unknown compression type "+i;(m=v<0?new e(_):new e(_,v,y)).ondata=function(e,t,r){x.ondata(e,t,r)};for(var t=0;t<g.length;t++){var n=g[t];m.push(n,!1)}r.k[0]==g&&r.c?r.d=m:m.push(el,!0)}else x.ondata(null,el,!0)},terminate:function(){m&&m.terminate&&m.terminate()}};v>=0&&(x.size=v,x.originalSize=y),c.onfile(x)}return"break"}if(h){if(0x8074b50==e)return o=s+=12+(-2==h&&8),a=3,c.c=0,"break";else if(0x2014b50==e)return o=s-=4,a=3,c.c=0,"break"}}();++s);if(this.p=el,h<0){var p=a?l.subarray(0,o-12-(-2==h&&8)-(0x8074b50==ew(l,o-16)&&4)):l.subarray(0,s);d?d.push(p,!!a):this.k[+(2==a)].push(p)}if(2&a)return this.push(l.subarray(s),t);this.p=l.subarray(s)}if(t){if(this.c)throw"invalid zip file";this.p=null}},ti.prototype.register=function(e){this.o[e.compression]=e};let tn=g>=152;class ta extends b.DataTextureLoader{constructor(e){super(e),this.type=b.HalfFloatType}parse(e){let t={l:0,c:0,lc:0};function r(e,r,i,n,a){for(;i<e;)r=r<<8|E(n,a),i+=8;t.l=r>>(i-=e)&(1<<e)-1,t.c=r,t.lc=i}let i=Array(59),n={c:0,lc:0};function a(e,t,r,i){e=e<<8|E(r,i),t+=8,n.c=e,n.lc=t}let s={c:0,lc:0};function o(e,t,r,i,o,l,u,h,d,c){if(e==t){i<8&&(a(r,i,o,u),r=n.c,i=n.lc);var p=r>>(i-=8),p=new Uint8Array([p])[0];if(d.value+p>c)return!1;for(var f=h[d.value-1];p-- >0;)h[d.value++]=f}else{if(!(d.value<c))return!1;h[d.value++]=e}s.c=r,s.lc=i}function l(e){var t=65535&e;return t>32767?t-65536:t}let u={a:0,b:0};function h(e,t){var r=l(e),i=l(t),n=r+(1&i)+(i>>1),a=n-i;u.a=n,u.b=a}function d(e,t){var r=65535&t,i=(65535&e)-(r>>1)&65535;u.a=r+i-32768&65535,u.b=i}function c(e,l,u,h,d,c){var p=u.value,f=M(l,u),m=M(l,u);u.value+=4;var g=M(l,u);if(u.value+=4,f<0||f>=65537||m<0||m>=65537)throw"Something wrong with HUF_ENCSIZE";for(var v=Array(65537),y=Array(16384),_=0;_<16384;_++)y[_]={},y[_].len=0,y[_].lit=0,y[_].p=null;var x=h-(u.value-p);if(!function(e,n,a,s,o,l,u){for(var h=0,d=0;o<=l;o++){if(a.value-a.value>s)return!1;r(6,h,d,e,a);var c=t.l;if(h=t.c,d=t.lc,u[o]=c,63==c){if(a.value-a.value>s)throw"Something wrong with hufUnpackEncTable";r(8,h,d,e,a);var p=t.l+6;if(h=t.c,d=t.lc,o+p>l+1)throw"Something wrong with hufUnpackEncTable";for(;p--;)u[o++]=0;o--}else if(c>=59){var p=c-59+2;if(o+p>l+1)throw"Something wrong with hufUnpackEncTable";for(;p--;)u[o++]=0;o--}}!function(e){for(var t=0;t<=58;++t)i[t]=0;for(var t=0;t<65537;++t)i[e[t]]+=1;for(var r=0,t=58;t>0;--t){var n=r+i[t]>>1;i[t]=r,r=n}for(var t=0;t<65537;++t){var a=e[t];a>0&&(e[t]=a|i[a]++<<6)}}(u)}(e,0,u,x,f,m,v),g>8*(h-(u.value-p)))throw"Something wrong with hufUncompress";!function(e,t,r,i){for(;t<=r;t++){var n=e[t]>>6,a=63&e[t];if(n>>a)throw"Invalid table entry";if(a>14){var s=i[n>>a-14];
817if(s.len)throw"Invalid table entry";if(s.lit++,s.p){var o=s.p;s.p=Array(s.lit);for(var l=0;l<s.lit-1;++l)s.p[l]=o[l]}else s.p=[,];s.p[s.lit-1]=t}else if(a)for(var u=0,l=1<<14-a;l>0;l--){var s=i[(n<<14-a)+u];if(s.len||s.p)throw"Invalid table entry";s.len=a,s.lit=t,u++}}}(v,f,m,y),function(e,t,r,i,l,u,h,d,c,p){for(var f=0,m=0,g=Math.trunc(l.value+(u+7)/8);l.value<g;)for(a(f,m,r,l),f=n.c,m=n.lc;m>=14;){var v=t[f>>m-14&16383];if(v.len)m-=v.len,o(v.lit,h,f,m,r,i,l,c,p,d),f=s.c,m=s.lc;else{if(!v.p)throw"hufDecode issues";for(y=0;y<v.lit;y++){for(var y,_=63&e[v.p[y]];m<_&&l.value<g;)a(f,m,r,l),f=n.c,m=n.lc;if(m>=_&&e[v.p[y]]>>6==(f>>m-_&(1<<_)-1)){m-=_,o(v.p[y],h,f,m,r,i,l,c,p,d),f=s.c,m=s.lc;break}}if(y==v.lit)throw"hufDecode issues"}}var x=8-u&7;for(f>>=x,m-=x;m>0;){var v=t[f<<14-m&16383];if(v.len)m-=v.len,o(v.lit,h,f,m,r,i,l,c,p,d),f=s.c,m=s.lc;else throw"hufDecode issues"}}(v,y,e,l,u,g,m,c,d,{value:0})}function p(e){for(var t=1;t<e.length;t++){var r=e[t-1]+e[t]-128;e[t]=r}}function f(e,t){for(var r=0,i=Math.floor((e.length+1)/2),n=0,a=e.length-1;!(n>a)&&(t[n++]=e[r++],!(n>a));){;t[n++]=e[i++]}}function m(e){for(var t=e.byteLength,r=[],i=0,n=new DataView(e);t>0;){var a=n.getInt8(i++);if(a<0){var s=-a;t-=s+1;for(var o=0;o<s;o++)r.push(n.getUint8(i++))}else{var s=a;t-=2;for(var l=n.getUint8(i++),o=0;o<s+1;o++)r.push(l)}}return r}function g(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function v(e){var t=new Uint8Array(m(e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size))),r=new Uint8Array(t.length);return p(t),f(t,r),new DataView(r.buffer)}function y(e){var t=e$(e.array.slice(e.offset.value,e.offset.value+e.size)),r=new Uint8Array(t.length);return p(t),f(t,r),new DataView(r.buffer)}function _(e){for(var t=e.viewer,r={value:e.offset.value},i=new Uint16Array(e.width*e.scanlineBlockSize*(e.channels*e.type)),n=new Uint8Array(8192),a=0,s=Array(e.channels),o=0;o<e.channels;o++)s[o]={},s[o].start=a,s[o].end=s[o].start,s[o].nx=e.width,s[o].ny=e.lines,s[o].size=e.type,a+=s[o].nx*s[o].ny*s[o].size;var l=B(t,r),p=B(t,r);if(p>=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(l<=p)for(var o=0;o<p-l+1;o++)n[o+l]=C(t,r);var f=new Uint16Array(65536),m=function(e,t){for(var r=0,i=0;i<65536;++i)(0==i||e[i>>3]&1<<(7&i))&&(t[r++]=i);for(var n=r-1;r<65536;)t[r++]=0;return n}(n,f),g=M(t,r);c(e.array,t,r,g,i,a);for(var o=0;o<e.channels;++o)for(var v=s[o],y=0;y<s[o].size;++y)!function(e,t,r,i,n,a,s){for(var o=s<16384,l=r>n?n:r,c=1;c<=l;)c<<=1;for(c>>=1,p=c,c>>=1;c>=1;){for(var p,f,m,g,v,y=0,_=0+a*(n-p),x=a*c,b=a*p,S=i*c,T=i*p;y<=_;y+=b){for(var A=y,M=y+i*(r-p);A<=M;A+=T){var E=A+S,C=A+x,w=C+S;o?(h(e[A+t],e[C+t]),f=u.a,g=u.b,h(e[E+t],e[w+t]),m=u.a,v=u.b,h(f,m),e[A+t]=u.a,e[E+t]=u.b,h(g,v)):(d(e[A+t],e[C+t]),f=u.a,g=u.b,d(e[E+t],e[w+t]),m=u.a,v=u.b,d(f,m),e[A+t]=u.a,e[E+t]=u.b,d(g,v)),e[C+t]=u.a,e[w+t]=u.b}if(r&c){var C=A+x;o?h(e[A+t],e[C+t]):d(e[A+t],e[C+t]),f=u.a,e[C+t]=u.b,e[A+t]=f}}if(n&c)for(var A=y,M=y+i*(r-p);A<=M;A+=T){var E=A+S;o?h(e[A+t],e[E+t]):d(e[A+t],e[E+t]),f=u.a,e[E+t]=u.b,e[A+t]=f}p=c,c>>=1}}(i,v.start+y,v.nx,v.size,v.ny,v.nx*v.size,m);for(var _=a,x=0;x<_;++x)i[x]=f[i[x]];for(var b=0,S=new Uint8Array(i.buffer.byteLength),T=0;T<e.lines;T++)for(var A=0;A<e.channels;A++){var v=s[A],E=v.nx*v.size,w=new Uint8Array(i.buffer,2*v.end,2*E);S.set(w,b),b+=2*E,v.end+=E}return new DataView(S.buffer)}function x(e){var t=e$(e.array.slice(e.offset.value,e.offset.value+e.size));let r=e.lines*e.channels*e.width,i=1==e.type?new Uint16Array(r):new Uint32Array(r),n=0,a=0,s=[,,,,];for(let r=0;r<e.lines;r++)for(let r=0;r<e.channels;r++){let r=0;switch(e.type){case 1:s[0]=n,s[1]=s[0]+e.width,n=s[1]+e.width;for(let n=0;n<e.width;++n)r+=t[s[0]++]<<8|t[s[1]++],i[a]=r,a++;break;case 2:s[0]=n,s[1]=s[0]+e.width,s[2]=s[1]+e.width,n=s[2]+e.width;for(let n=0;n<e.width;++n)r+=t[s[0]++]<<24|t[s[1]++]<<16|t[s[2]++]<<8,i[a]=r,a++}}return new DataView(i.buffer)}function S(e){var t=e.viewer,r={value:e.offset.value},i=new Uint8Array(e.width*e.lines*(e.channels*e.type*2)),n={version:w(t,r),unknownUncompressedSize:w(t,r),unknownCompressedSize:w(t,r),acCompressedSize:w(t,r),dcCompressedSize:w(t,r),rleCompressedSize:w(t,r),rleUncompressedSize:w(t,r),rleRawSize:w(t,r),totalAcUncompressedCount:w(t,r),totalDcUncompressedCount:w(t,r),acCompression:w(t,r)};if(n.version<2)throw"EXRLoader.parse: "+U.compression+" version "+n.version+" is unsupported";for(var a=[],s=B(t,r)-2;s>0;){var o=T(t.buffer,r),l=C(t,r),u=l>>2&3,h=new Int8Array([(l>>4)-1])[0],d=C(t,r);a.push({name:o,index:h,type:d,compression:u}),s-=o.length+3}for(var p=U.channels,f=Array(e.channels),g=0;g<e.channels;++g){var v=f[g]={},_=p[g];
817v.name=_.name,v.compression=0,v.decoded=!1,v.type=_.pixelType,v.pLinear=_.pLinear,v.width=e.width,v.height=e.lines}for(var x={idx:[,,,]},S=0;S<e.channels;++S)for(var v=f[S],g=0;g<a.length;++g){var A=a[g];v.name==A.name&&(v.compression=A.compression,A.index>=0&&(x.idx[A.index]=S),v.offset=S)}if(n.acCompressedSize>0)switch(n.acCompression){case 0:var M=new Uint16Array(n.totalAcUncompressedCount);c(e.array,t,r,n.acCompressedSize,M,n.totalAcUncompressedCount);break;case 1:var E=e.array.slice(r.value,r.value+n.totalAcUncompressedCount),R=e$(E),M=new Uint16Array(R.buffer);r.value+=n.totalAcUncompressedCount}if(n.dcCompressedSize>0){var N=new Uint16Array(y({array:e.array,offset:r,size:n.dcCompressedSize}).buffer);r.value+=n.dcCompressedSize}if(n.rleRawSize>0){var E=e.array.slice(r.value,r.value+n.rleCompressedSize),R=e$(E),I=m(R.buffer);r.value+=n.rleCompressedSize}for(var P=0,F=Array(f.length),g=0;g<F.length;++g)F[g]=[];for(var D=0;D<e.lines;++D)for(var O=0;O<f.length;++O)F[O].push(P),P+=f[O].width*e.type*2;!function(e,t,r,i,n,a){var s=new DataView(a.buffer),o=r[e.idx[0]].width,l=r[e.idx[0]].height,u=Math.floor(o/8),h=Math.ceil(o/8),d=Math.ceil(l/8),c=o-(h-1)*8,p=l-(d-1)*8,f={value:0},m=[,,,],g=[,,,],v=[,,,],y=[,,,],_=[,,,];for(let r=0;r<3;++r)_[r]=t[e.idx[r]],m[r]=r<1?0:m[r-1]+h*d,g[r]=new Float32Array(64),v[r]=new Uint16Array(64),y[r]=new Uint16Array(64*h);for(let t=0;t<d;++t){var x,S,T=8;t==d-1&&(T=p);var A=8;for(let e=0;e<h;++e){e==h-1&&(A=c);for(let e=0;e<3;++e){v[e].fill(0),v[e][0]=n[m[e]++],function(e,t,r){for(var i,n=1;n<64;)65280==(i=t[e.value])?n=64:i>>8==255?n+=255&i:(r[n]=i,n++),e.value++}(f,i,v[e]),x=v[e],(S=g[e])[0]=L(x[0]),S[1]=L(x[1]),S[2]=L(x[5]),S[3]=L(x[6]),S[4]=L(x[14]),S[5]=L(x[15]),S[6]=L(x[27]),S[7]=L(x[28]),S[8]=L(x[2]),S[9]=L(x[4]),S[10]=L(x[7]),S[11]=L(x[13]),S[12]=L(x[16]),S[13]=L(x[26]),S[14]=L(x[29]),S[15]=L(x[42]),S[16]=L(x[3]),S[17]=L(x[8]),S[18]=L(x[12]),S[19]=L(x[17]),S[20]=L(x[25]),S[21]=L(x[30]),S[22]=L(x[41]),S[23]=L(x[43]),S[24]=L(x[9]),S[25]=L(x[11]),S[26]=L(x[18]),S[27]=L(x[24]),S[28]=L(x[31]),S[29]=L(x[40]),S[30]=L(x[44]),S[31]=L(x[53]),S[32]=L(x[10]),S[33]=L(x[19]),S[34]=L(x[23]),S[35]=L(x[32]),S[36]=L(x[39]),S[37]=L(x[45]),S[38]=L(x[52]),S[39]=L(x[54]),S[40]=L(x[20]),S[41]=L(x[22]),S[42]=L(x[33]),S[43]=L(x[38]),S[44]=L(x[46]),S[45]=L(x[51]),S[46]=L(x[55]),S[47]=L(x[60]),S[48]=L(x[21]),S[49]=L(x[34]),S[50]=L(x[37]),S[51]=L(x[47]),S[52]=L(x[50]),S[53]=L(x[56]),S[54]=L(x[59]),S[55]=L(x[61]),S[56]=L(x[35]),S[57]=L(x[36]),S[58]=L(x[48]),S[59]=L(x[49]),S[60]=L(x[57]),S[61]=L(x[58]),S[62]=L(x[62]),S[63]=L(x[63]),function(e){let t=.5*Math.cos(3.14159/16),r=.5*Math.cos(3.14159/8),i=.5*Math.cos(3*3.14159/16),n=.5*Math.cos(3*3.14159/8);for(var a=[,,,,],s=[,,,,],o=[,,,,],l=[,,,,],u=0;u<8;++u){var h=8*u;a[0]=r*e[h+2],a[1]=n*e[h+2],a[2]=r*e[h+6],a[3]=n*e[h+6],s[0]=t*e[h+1]+i*e[h+3]+.2777854612564676*e[h+5]+.09754573032714427*e[h+7],s[1]=i*e[h+1]-.09754573032714427*e[h+3]-t*e[h+5]-.2777854612564676*e[h+7],s[2]=.2777854612564676*e[h+1]-t*e[h+3]+.09754573032714427*e[h+5]+i*e[h+7],s[3]=.09754573032714427*e[h+1]-.2777854612564676*e[h+3]+i*e[h+5]-t*e[h+7],o[0]=.35355362513961314*(e[h+0]+e[h+4]),o[3]=.35355362513961314*(e[h+0]-e[h+4]),o[1]=a[0]+a[3],o[2]=a[1]-a[2],l[0]=o[0]+o[1],l[1]=o[3]+o[2],l[2]=o[3]-o[2],l[3]=o[0]-o[1],e[h+0]=l[0]+s[0],e[h+1]=l[1]+s[1],e[h+2]=l[2]+s[2],e[h+3]=l[3]+s[3],e[h+4]=l[3]-s[3],e[h+5]=l[2]-s[2],e[h+6]=l[1]-s[1],e[h+7]=l[0]-s[0]}for(var d=0;d<8;++d)a[0]=r*e[16+d],a[1]=n*e[16+d],a[2]=r*e[48+d],a[3]=n*e[48+d],s[0]=t*e[8+d]+i*e[24+d]+.2777854612564676*e[40+d]+.09754573032714427*e[56+d],s[1]=i*e[8+d]-.09754573032714427*e[24+d]-t*e[40+d]-.2777854612564676*e[56+d],s[2]=.2777854612564676*e[8+d]-t*e[24+d]+.09754573032714427*e[40+d]+i*e[56+d],s[3]=.09754573032714427*e[8+d]-.2777854612564676*e[24+d]+i*e[40+d]-t*e[56+d],o[0]=.35355362513961314*(e[d]+e[32+d]),o[3]=.35355362513961314*(e[d]-e[32+d]),o[1]=a[0]+a[3],o[2]=a[1]-a[2],l[0]=o[0]+o[1],l[1]=o[3]+o[2],l[2]=o[3]-o[2],l[3]=o[0]-o[1],e[0+d]=l[0]+s[0],e[8+d]=l[1]+s[1],e[16+d]=l[2]+s[2],e[24+d]=l[3]+s[3],e[32+d]=l[3]-s[3],e[40+d]=l[2]-s[2],e[48+d]=l[1]-s[1],e[56+d]=l[0]-s[0]}(g[e])}for(var M=g,E=0;E<64;++E){var C=M[0][E],w=M[1][E],R=M[2][E];M[0][E]=C+1.5747*R,M[1][E]=C-.1873*w-.4682*R,M[2][E]=C+1.8556*w}for(let t=0;t<3;++t)!function(e,t,r){for(var i,n=0;n<64;++n){t[r+n]=b.DataUtils.toHalfFloat((i=e[n])<=1?Math.sign(i)*Math.pow(Math.abs(i),2.2):Math.sign(i)*Math.pow(9.025013291561939,Math.abs(i)-1))}}(g[t],y[t],64*e)}let a=0;for(let i=0;i<3;++i){let n=r[e.idx[i]].type;for(let e=8*t;e<8*t+T;++e){a=_[i][e];for(let t=0;t<u;++t){let r=64*t+(7&e)*8;s.setUint16(a+0*n,y[i][r+0],!0),s.setUint16(a+2*n,y[i][r+1],!0),s.setUint16(a+4*n,y[i][r+2],!0),s.setUint16(a+6*n,y[i][r+3],!0),s.setUint16(a+8*n,y[i][r+4],!0),s.setUint16(a+10*n,y[i][r+5],!0),s.setUint16(a+12*n,y[i][r+6],!0),s.setUint16(a+14*n,y[i][r+7],!0),a+=16*n}}if(u!=h)for(let e=8*t;e<8*t+T;++e){let t=_[i][e]+8*u*2*n,r=64*u+(7&e)*8;for(let e=0;e<A;++e)s.setUint16(t+2*e*n,y[i][r+e],!0)}}}for(var N=new Uint16Array(o),s=new DataView(a.buffer),B=0;B<3;
817++B){r[e.idx[B]].decoded=!0;var I=r[e.idx[B]].type;if(2==r[B].type)for(var P=0;P<l;++P){let e=_[B][P];for(var F=0;F<o;++F)N[F]=s.getUint16(e+2*F*I,!0);for(var F=0;F<o;++F)s.setFloat32(e+2*F*I,L(N[F]),!0)}}}(x,F,f,M,N,i);for(var g=0;g<f.length;++g){var v=f[g];if(!v.decoded)if(2===v.compression)for(var G=0,k=0,D=0;D<e.lines;++D){for(var V=F[g][G],z=0;z<v.width;++z){for(var H=0;H<2*v.type;++H)i[V++]=I[k+H*v.width*v.height];k++}G++}else throw"EXRLoader.parse: unsupported channel compression"}return new DataView(i.buffer)}function T(e,t){for(var r=new Uint8Array(e),i=0;0!=r[t.value+i];)i+=1;var n=new TextDecoder().decode(r.slice(t.value,t.value+i));return t.value=t.value+i+1,n}function A(e,t){var r=e.getInt32(t.value,!0);return t.value=t.value+4,r}function M(e,t){var r=e.getUint32(t.value,!0);return t.value=t.value+4,r}function E(e,t){var r=e[t.value];return t.value=t.value+1,r}function C(e,t){var r=e.getUint8(t.value);return t.value=t.value+1,r}let w=function(e,t){let r;return r="getBigInt64"in DataView.prototype?Number(e.getBigInt64(t.value,!0)):e.getUint32(t.value+4,!0)+Number(e.getUint32(t.value,!0)<<32),t.value+=8,r};function R(e,t){var r=e.getFloat32(t.value,!0);return t.value+=4,r}function N(e,t){return b.DataUtils.toHalfFloat(R(e,t))}function L(e){var t=(31744&e)>>10,r=1023&e;return(e>>15?-1:1)*(t?31===t?r?NaN:1/0:Math.pow(2,t-15)*(1+r/1024):r/1024*6103515625e-14)}function B(e,t){var r=e.getUint16(t.value,!0);return t.value+=2,r}function I(e,t){return L(B(e,t))}let P=new DataView(e),F=new Uint8Array(e),D={value:0},U=function(e,t,r){let i={};if(0x1312f76!=e.getUint32(0,!0))throw"THREE.EXRLoader: provided file doesn't appear to be in OpenEXR format.";i.version=e.getUint8(4);let n=e.getUint8(5);i.spec={singleTile:!!(2&n),longName:!!(4&n),deepFormat:!!(8&n),multiPart:!!(16&n)},r.value=8;for(var a=!0;a;){var s=T(t,r);if(0==s)a=!1;else{var o=T(t,r),l=M(e,r),u=function(e,t,r,i,n){var a,s,o,l,u,h,d;if("string"===i||"stringvector"===i||"iccProfile"===i)return a=new TextDecoder().decode(new Uint8Array(t).slice(r.value,r.value+n)),r.value=r.value+n,a;if("chlist"===i)return function(e,t,r,i){for(var n=r.value,a=[];r.value<n+i-1;){var s=T(t,r),o=A(e,r),l=C(e,r);r.value+=3;var u=A(e,r),h=A(e,r);a.push({name:s,pixelType:o,pLinear:l,xSampling:u,ySampling:h})}return r.value+=1,a}(e,t,r,n);if("chromaticities"===i)return s=R(e,r),o=R(e,r),l=R(e,r),u=R(e,r),h=R(e,r),{redX:s,redY:o,greenX:l,greenY:u,blueX:h,blueY:R(e,r),whiteX:R(e,r),whiteY:R(e,r)};if("compression"===i)return["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"][C(e,r)];if("box2i"===i)return d=M(e,r),{xMin:d,yMin:M(e,r),xMax:M(e,r),yMax:M(e,r)};else if("lineOrder"===i)return["INCREASING_Y"][C(e,r)];else if("float"===i)return R(e,r);else if("v2f"===i)return[R(e,r),R(e,r)];else if("v3f"===i)return[R(e,r),R(e,r),R(e,r)];else if("int"===i)return A(e,r);else if("rational"===i)return[A(e,r),M(e,r)];else if("timecode"===i)return[M(e,r),M(e,r)];else return"preview"===i?(r.value+=n,"skipped"):(r.value+=n,void 0)}(e,t,r,o,l);void 0===u?console.warn(`EXRLoader.parse: skipped unknown header attribute type '${o}'.`):i[s]=u}}if((-5&n)!=0)throw console.error("EXRHeader:",i),"THREE.EXRLoader: provided file is currently unsupported.";return i}(P,e,D),O=function(e,t,r,i,n){let a={size:0,viewer:t,array:r,offset:i,width:e.dataWindow.xMax-e.dataWindow.xMin+1,height:e.dataWindow.yMax-e.dataWindow.yMin+1,channels:e.channels.length,bytesPerLine:null,lines:null,inputSize:null,type:e.channels[0].pixelType,uncompress:null,getter:null,format:null,[tn?"colorSpace":"encoding"]:null};switch(e.compression){case"NO_COMPRESSION":a.lines=1,a.uncompress=g;break;case"RLE_COMPRESSION":a.lines=1,a.uncompress=v;break;case"ZIPS_COMPRESSION":a.lines=1,a.uncompress=y;break;case"ZIP_COMPRESSION":a.lines=16,a.uncompress=y;break;case"PIZ_COMPRESSION":a.lines=32,a.uncompress=_;break;case"PXR24_COMPRESSION":a.lines=16,a.uncompress=x;break;case"DWAA_COMPRESSION":a.lines=32,a.uncompress=S;break;case"DWAB_COMPRESSION":a.lines=256,a.uncompress=S;break;default:throw"EXRLoader.parse: "+e.compression+" is unsupported"}if(a.scanlineBlockSize=a.lines,1==a.type)switch(n){case b.FloatType:a.getter=I,a.inputSize=2;break;case b.HalfFloatType:a.getter=B,a.inputSize=2}else if(2==a.type)switch(n){case b.FloatType:a.getter=R,a.inputSize=4;break;case b.HalfFloatType:a.getter=N,a.inputSize=4}else throw"EXRLoader.parse: unsupported pixelType "+a.type+" for "+e.compression+".";a.blockCount=(e.dataWindow.yMax+1)/a.scanlineBlockSize;for(var s=0;s<a.blockCount;s++)w(t,i);a.outputChannels=3==a.channels?4:a.channels;let o=a.width*a.height*a.outputChannels;switch(n){case b.FloatType:a.byteArray=new Float32Array(o),a.channels<a.outputChannels&&a.byteArray.fill(1,0,o);break;case b.HalfFloatType:a.byteArray=new Uint16Array(o),a.channels<a.outputChannels&&a.byteArray.fill(15360,0,o);break;default:console.error("THREE.EXRLoader: unsupported type: ",n)}
817return a.bytesPerLine=a.width*a.inputSize*a.channels,4==a.outputChannels?a.format=b.RGBAFormat:a.format=b.RedFormat,tn?a.colorSpace="srgb-linear":a.encoding=3e3,a}(U,P,F,D,this.type),G={value:0},k={R:0,G:1,B:2,A:3,Y:0};for(let e=0;e<O.height/O.scanlineBlockSize;e++){let t=M(P,D);O.size=M(P,D),O.lines=t+O.scanlineBlockSize>O.height?O.height-t:O.scanlineBlockSize;let r=O.size<O.lines*O.bytesPerLine?O.uncompress(O):g(O);D.value+=O.size;for(let t=0;t<O.scanlineBlockSize;t++){let i=t+e*O.scanlineBlockSize;if(i>=O.height)break;for(let e=0;e<O.channels;e++){let n=k[U.channels[e].name];for(let a=0;a<O.width;a++){G.value=(t*(O.channels*O.width)+e*O.width+a)*O.inputSize;let s=(O.height-1-i)*(O.width*O.outputChannels)+a*O.outputChannels+n;O.byteArray[s]=O.getter(r,G)}}}}return{header:U,width:O.width,height:O.height,data:O.byteArray,format:O.format,[tn?"colorSpace":"encoding"]:O[tn?"colorSpace":"encoding"],type:this.type}}setDataType(e){return this.type=e,this}load(e,t,r,i){return super.load(e,function(e,r){tn?e.colorSpace=r.colorSpace:e.encoding=r.encoding,e.minFilter=b.LinearFilter,e.magFilter=b.LinearFilter,e.generateMipmaps=!1,e.flipY=!1,t&&t(e,r)},r,i)}}let ts=(e,t,r)=>{let i;switch(e){case p.UnsignedByteType:i=new Uint8ClampedArray(t*r*4);break;case p.HalfFloatType:i=new Uint16Array(t*r*4);break;case p.UnsignedIntType:i=new Uint32Array(t*r*4);break;case p.ByteType:i=new Int8Array(t*r*4);break;case p.ShortType:i=new Int16Array(t*r*4);break;case p.IntType:i=new Int32Array(t*r*4);break;case p.FloatType:i=new Float32Array(t*r*4);break;default:throw Error("Unsupported data type")}return i};class to{_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
817=e.colorSpace;const r={format:p.RGBAFormat,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,magFilter:e.renderTargetOptions?.magFilter!==void 0?e.renderTargetOptions?.magFilter:p.LinearFilter,minFilter:e.renderTargetOptions?.minFilter!==void 0?e.renderTargetOptions?.minFilter:p.LinearFilter,samples:e.renderTargetOptions?.samples!==void 0?e.renderTargetOptions?.samples:void 0,wrapS:e.renderTargetOptions?.wrapS!==void 0?e.renderTargetOptions?.wrapS:p.ClampToEdgeWrapping,wrapT:e.renderTargetOptions?.wrapT!==void 0?e.renderTargetOptions?.wrapT:p.ClampToEdgeWrapping};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=to.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new p.Scene,this._camera=new p.OrthographicCamera,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(),!((e,r,i,n)=>{if(void 0!==t)return t;let a=new p.WebGLRenderTarget(1,1,n);r.setRenderTarget(a);let s=new p.Mesh(new p.PlaneGeometry,new p.MeshBasicMaterial({color:0xffffff}));r.render(s,i),r.setRenderTarget(null);let o=ts(e,a.width,a.height);return r.readRenderTargetPixels(a,0,0,a.width,a.height,o),a.dispose(),s.geometry.dispose(),s.material.dispose(),t=0!==o[0]})(this._type,this._renderer,this._camera,r)){let e;this._type===p.HalfFloatType&&(e=this._renderer.extensions.has("EXT_color_buffer_float")?p.FloatType:void 0),void 0!==e?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${p.FloatType}`),this._type=e):(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 p.Mesh(new p.PlaneGeometry,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new p.WebGLRenderTarget(this.width,this.height,r),this._renderTarget.texture.mapping=e.renderTargetOptions?.mapping!==void 0?e.renderTargetOptions?.mapping:p.UVMapping}static instantiateRenderer(){let e=new f.WebGLRenderer;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 Error("Can't read pixels in this browser");let e=ts(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){let t=new p.DataTexture(this.toArray(),this.width,this.height,p.RGBAFormat,this._type,e?.mapping||p.UVMapping,e?.wrapS||p.ClampToEdgeWrapping,e?.wrapT||p.ClampToEdgeWrapping,e?.magFilter||p.LinearFilter,e?.minFilter||p.LinearFilter,e?.anisotropy||1,p.LinearSRGBColorSpace);return t.generateMipmaps=e?.generateMipmaps!==void 0&&e?.generateMipmaps,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 p.ShaderMaterial&&Object.values(this.material.uniforms).forEach(e=>{e.value instanceof p.Texture&&e.value.dispose()}),Object.values(this.material).forEach(e=>{e instanceof p.Texture&&e.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}}var tl=p;
817class tu extends Error{}class th extends Error{}let td=(e,t,r)=>{let i=RegExp(`${t}="([^"]*)"`,"i").exec(e);if(i)return i[1];let n=RegExp(`<${t}[^>]*>([\\s\\S]*?)</${t}>`,"i").exec(e);if(n){let e=n[1].match(/<rdf:li>([^<]*)<\/rdf:li>/g);return e&&3===e.length?e.map(e=>e.replace(/<\/?rdf:li>/g,"")):n[1].trim()}if(void 0!==r)return r;throw Error(`Can't find ${t} in gainmap metadata`)};class tc{options;constructor(e){this.options={debug:!!e&&void 0!==e.debug&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}extract(e){return new Promise((t,r)=>{let i,n=this.options.debug,a=new DataView(e.buffer);if(65496!==a.getUint16(0))return void r(Error("Not a valid jpeg"));let s=a.byteLength,o=2,l=0;for(;o<s;){if(++l>250)return void r(Error(`Found no marker after ${l} loops 😵`));if(255!==a.getUint8(o))return void r(Error(`Not a valid marker at offset 0x${o.toString(16)}, found: 0x${a.getUint8(o).toString(16)}`));if(i=a.getUint8(o+1),n&&console.log(`Marker: ${i.toString(16)}`),226===i){n&&console.log("Found APP2 marker (0xffe2)");let e=o+4;if(0x4d504600===a.getUint32(e)){let i,n=e+4;if(18761===a.getUint16(n))i=!1;else{if(19789!==a.getUint16(n))return void r(Error("No valid endianness marker found in TIFF header"));i=!0}if(42!==a.getUint16(n+2,!i))return void r(Error("Not valid TIFF data! (no 0x002A marker)"));let s=a.getUint32(n+4,!i);if(s<8)return void r(Error("Not valid TIFF data! (First offset less than 8)"));let o=n+s,l=a.getUint16(o,!i),u=o+2,h=0;for(let e=u;e<u+12*l;e+=12)45057===a.getUint16(e,!i)&&(h=a.getUint32(e+8,!i));let d=o+2+12*l+4,c=[];for(let e=d;e<d+16*h;e+=16){let t={MPType:a.getUint32(e,!i),size:a.getUint32(e+4,!i),dataOffset:a.getUint32(e+8,!i),dependantImages:a.getUint32(e+12,!i),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=n+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,c.push(t)}if(this.options.extractNonFII&&c.length){let e=new Blob([a]),r=[];for(let t of c){if(t.isFII&&!this.options.extractFII)continue;let i=e.slice(t.start,t.end+1,"image/jpeg");r.push(i)}t(r)}}}o+=2+a.getUint16(o+2)}})}}let tp=async e=>{let t=(e=>{let t,r=(t="u">typeof TextDecoder?new TextDecoder().decode(e):e.toString()).indexOf("<x:xmpmeta");for(;-1!==r;){let e=t.indexOf("x:xmpmeta>",r),i=t.slice(r,e+10);try{let e=td(i,"hdrgm:GainMapMin","0"),t=td(i,"hdrgm:GainMapMax"),r=td(i,"hdrgm:Gamma","1"),n=td(i,"hdrgm:OffsetSDR","0.015625"),a=td(i,"hdrgm:OffsetHDR","0.015625"),s=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(i),o=s?s[1]:"0",l=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(i);if(!l)throw Error("Incomplete gainmap metadata");let u=l[1];return{gainMapMin:Array.isArray(e)?e.map(e=>parseFloat(e)):[parseFloat(e),parseFloat(e),parseFloat(e)],gainMapMax:Array.isArray(t)?t.map(e=>parseFloat(e)):[parseFloat(t),parseFloat(t),parseFloat(t)],gamma:Array.isArray(r)?r.map(e=>parseFloat(e)):[parseFloat(r),parseFloat(r),parseFloat(r)],offsetSdr:Array.isArray(n)?n.map(e=>parseFloat(e)):[parseFloat(n),parseFloat(n),parseFloat(n)],offsetHdr:Array.isArray(a)?a.map(e=>parseFloat(e)):[parseFloat(a),parseFloat(a),parseFloat(a)],hdrCapacityMin:parseFloat(o),hdrCapacityMax:parseFloat(u)}}catch(e){}r=t.indexOf("<x:xmpmeta",e)}})(e);if(!t)throw new th("Gain map XMP metadata not found");let r=new tc({extractFII:!0,extractNonFII:!0}),i=await r.extract(e);if(2!==i.length)throw new tu("Gain map recovery image not found");return{sdr:new Uint8Array(await i[0].arrayBuffer()),gainMap:new Uint8Array(await i[1].arrayBuffer()),metadata:t}},tf=e=>new Promise((t,r)=>{let i=document.createElement("img");i.onload=()=>{t(i)},i.onerror=e=>{r(e)},i.src=URL.createObjectURL(e)});class tm extends tl.Loader{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new tl.LoadingManager}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 Loa
817der will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");let 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 tl.Texture,sdr:new tl.Texture});return this._config.createQuadRenderer({width:16,height:16,type:tl.HalfFloatType,colorSpace:tl.LinearSRGBColorSpace,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,r){let i,n,a=t?new Blob([t],{type:"image/jpeg"}):void 0,s=new Blob([e],{type:"image/jpeg"}),o=!1;if("u"<typeof createImageBitmap){let e=await Promise.all([a?tf(a):Promise.resolve(void 0),tf(s)]);n=e[0],i=e[1],o="flipY"===r}else{let e=await Promise.all([a?createImageBitmap(a,{imageOrientation:r||"flipY"}):Promise.resolve(void 0),createImageBitmap(s,{imageOrientation:r||"flipY"})]);n=e[0],i=e[1]}return{sdrImage:i,gainMapImage:n,needsFlip:o}}createTextures(e,t,r){let i=new tl.Texture(t||new ImageData(2,2),tl.UVMapping,tl.ClampToEdgeWrapping,tl.ClampToEdgeWrapping,tl.LinearFilter,tl.LinearMipMapLinearFilter,tl.RGBAFormat,tl.UnsignedByteType,1,tl.LinearSRGBColorSpace);i.flipY=r,i.needsUpdate=!0;let n=new tl.Texture(e,tl.UVMapping,tl.ClampToEdgeWrapping,tl.ClampToEdgeWrapping,tl.LinearFilter,tl.LinearMipMapLinearFilter,tl.RGBAFormat,tl.UnsignedByteType,1,tl.SRGBColorSpace);return n.flipY=r,n.needsUpdate=!0,{gainMap:i,sdr:n}}updateQuadRenderer(e,t,r,i,n){e.width=t.width,e.height=t.height,e.material.gainMap=r,e.material.sdr=i,e.material.gainMapMin=n.gainMapMin,e.material.gainMapMax=n.gainMapMax,e.material.offsetHdr=n.offsetHdr,e.material.offsetSdr=n.offsetSdr,e.material.gamma=n.gamma,e.material.hdrCapacityMin=n.hdrCapacityMin,e.material.hdrCapacityMax=n.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,n.hdrCapacityMax),e.material.needsUpdate=!0}}var tg=p;let tv=` 818varying vec2 vUv; 819 820void main() { 821 vUv = uv; 822 gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); 823} 824`,ty=` 825// min half float value 826#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 ) 827// max half float value 828#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 ) 829 830uniform sampler2D sdr; 831uniform sampler2D gainMap; 832uniform vec3 gamma; 833uniform vec3 offsetHdr; 834uniform vec3 offsetSdr; 835uniform vec3 gainMapMin; 836uniform vec3 gainMapMax; 837uniform float weightFactor; 838 839varying vec2 vUv; 840 841void main() { 842 vec3 rgb = texture2D( sdr, vUv ).rgb; 843 vec3 recovery = texture2D( gainMap, vUv ).rgb; 844 vec3 logRecovery = pow( recovery, gamma ); 845 vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery; 846 vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr; 847 vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor )); 848 gl_FragColor = vec4( clampedHdrColor , 1.0 ); 849} 850`;class t_ extends tg.ShaderMaterial{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:r,gainMapMin:i,gainMapMax:n,maxDisplayBoost:a,hdrCapacityMin:s,hdrCapacityMax:o,sdr:l,gainMap:u}){super({name:"GainMapDecoderMaterial",vertexShader:tv,fragmentShader:ty,uniforms:{sdr:{value:l},gainMap:{value:u},gamma:{value:new tg.Vector3(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new tg.Vector3().fromArray(t)},offsetSdr:{value:new tg.Vector3().fromArray(r)},gainMapMin:{value:new tg.Vector3().fromArray(i)},gainMapMax:{value:new tg.Vector3().fromArray(n)},weightFactor:{value:(Math.log2(a)-s)/(o-s)}},blending:tg.NoBlending,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=a,this._hdrCapacityMin=s,this._hdrCapacityMax=o,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(){let e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){let 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(){let e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}f.WebGLRenderer;class tx extends tm{constructor(e,t){super({renderer:e,createMaterial:e=>new t_(e),createQuadRenderer:e=>new to(e)},t)}
850async render(e,t,r,i){let{sdrImage:n,gainMapImage:a,needsFlip:s}=await this.processImages(r,i,"flipY"),{gainMap:o,sdr:l}=this.createTextures(n,a,s);this.updateQuadRenderer(e,n,o,l,t),e.render()}}class tb extends tx{load([e,t,r],i,n,a){let s,o,l,u=this.prepareQuadRenderer(),h=async()=>{if(s&&o&&l){try{await this.render(u,l,s,o)}catch(i){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(r),"function"==typeof a&&a(i),u.disposeOnDemandRenderer();return}"function"==typeof i&&i(u),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(r),u.disposeOnDemandRenderer()}},d=!0,c=0,p=0,f=!0,m=0,g=0,v=!0,y=0,_=0,x=()=>{"function"==typeof n&&n(new ProgressEvent("progress",{lengthComputable:d&&f&&v,loaded:p+g+_,total:c+m+y}))};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(r);let b=new tg.FileLoader(this._internalLoadingManager);b.setResponseType("arraybuffer"),b.setRequestHeader(this.requestHeader),b.setPath(this.path),b.setWithCredentials(this.withCredentials),b.load(e,async e=>{if("string"==typeof e)throw Error("Invalid sdr buffer");s=e,await h()},e=>{d=e.lengthComputable,p=e.loaded,c=e.total,x()},t=>{this.manager.itemError(e),"function"==typeof a&&a(t)});let S=new tg.FileLoader(this._internalLoadingManager);S.setResponseType("arraybuffer"),S.setRequestHeader(this.requestHeader),S.setPath(this.path),S.setWithCredentials(this.withCredentials),S.load(t,async e=>{if("string"==typeof e)throw Error("Invalid gainmap buffer");o=e,await h()},e=>{f=e.lengthComputable,g=e.loaded,m=e.total,x()},e=>{this.manager.itemError(t),"function"==typeof a&&a(e)});let T=new tg.FileLoader(this._internalLoadingManager);return T.setRequestHeader(this.requestHeader),T.setPath(this.path),T.setWithCredentials(this.withCredentials),T.load(r,async e=>{if("string"!=typeof e)throw Error("Invalid metadata string");l=JSON.parse(e),await h()},e=>{v=e.lengthComputable,_=e.loaded,y=e.total,x()},e=>{this.manager.itemError(r),"function"==typeof a&&a(e)}),u}}class tS extends tx{load(e,t,r,i){let n=this.prepareQuadRenderer(),a=new tg.FileLoader(this._internalLoadingManager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(this.withCredentials),this.manager.itemStart(e),a.load(e,async r=>{let a,s,o;if("string"==typeof r)throw Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");let l=new Uint8Array(r);try{let e=await tp(l);a=e.sdr,s=e.gainMap,o=e.metadata}catch(t){if(t instanceof th||t instanceof tu)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),o={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},a=l;else throw t}try{await this.render(n,o,a.buffer,s?.buffer)}catch(t){this.manager.itemError(e),"function"==typeof i&&i(t),n.disposeOnDemandRenderer();return}"function"==typeof t&&t(n),this.manager.itemEnd(e),n.disposeOnDemandRenderer()},r,t=>{this.manager.itemError(e),"function"==typeof i&&i(t)}),n}}let tT={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"},tA="https://raw.githack.com/pmndrs/drei-assets/456060a26bbeb8fdf79326f224b6d99b8bcce736/hdri/",tM=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"];function tE({files:e=tM,path:t="",preset:r,colorSpace:i,extensions:n}={}){r&&(tR(r),e=tT[r],t=tA);let a=Array.isArray(e),{extension:s,isCubemap:u}=tN(e),h=tL(s);if(!h)throw Error("useEnvironment: Unrecognized file extension: "+e);let d=(0,l.useThree)(e=>e.gl);(0,o.useLayoutEffect)(()=>{("webp"===s||"jpg"===s||"jpeg"===s)&&d.domElement.addEventListener("webglcontextlost",function(){y.useLoader.clear(h,a?[e]:e)},{once:!0})},[e,d.domElement]);let c=(0,y.useLoader)(h,a?[e]:e,e=>{("webp"===s||"jpg"===s||"jpeg"===s)&&e.setRenderer(d),null==e.setPath||e.setPath(t),n&&n(e)}),f=a?c[0]:c;if("jpg"===s||"jpeg"===s||"webp"===s){var m;f=null==(m=f.renderTarget)?void 0:m.texture}return f.mapping=u?p.CubeReflectionMapping:p.EquirectangularReflectionMapping,f.colorSpace
850=null!=i?i:u?"srgb":"srgb-linear",f}let tC={files:tM,path:"",preset:void 0,extensions:void 0};tE.preload=e=>{let t={...tC,...e},{files:r,path:i=""}=t,{preset:n,extensions:a}=t;n&&(tR(n),r=tT[n],i=tA);let{extension:s}=tN(r);if("webp"===s||"jpg"===s||"jpeg"===s)throw Error("useEnvironment: Preloading gainmaps is not supported");let o=tL(s);if(!o)throw Error("useEnvironment: Unrecognized file extension: "+r);y.useLoader.preload(o,Array.isArray(r)?[r]:r,e=>{null==e.setPath||e.setPath(i),a&&a(e)})};let tw={files:tM,preset:void 0};function tR(e){if(!(e in tT))throw Error("Preset must be one of: "+Object.keys(tT).join(", "))}function tN(e){var t;let r=Array.isArray(e)&&6===e.length,i=Array.isArray(e)&&3===e.length&&e.some(e=>e.endsWith("json")),n=Array.isArray(e)?e[0]:e;return{extension:r?"cube":i?"webp":n.startsWith("data:application/exr")?"exr":n.startsWith("data:application/hdr")?"hdr":n.startsWith("data:image/jpeg")?"jpg":null==(t=n.split(".").pop())||null==(t=t.split("?"))||null==(t=t.shift())?void 0:t.toLowerCase(),isCubemap:r,isGainmap:i}}function tL(e){return"cube"===e?p.CubeTextureLoader:"hdr"===e?x:"exr"===e?ta:"jpg"===e||"jpeg"===e?tS:"webp"===e?tb:null}function tB(e,t,r,i,n={}){var a,s,o,l,u;let h;n={backgroundBlurriness:0,backgroundIntensity:1,backgroundRotation:[0,0,0],environmentIntensity:1,environmentRotation:[0,0,0],...n};let c=(h=u=t||r).current&&h.current.isScene?u.current:u,p=c.background,f=c.environment,m={backgroundBlurriness:c.backgroundBlurriness,backgroundIntensity:c.backgroundIntensity,backgroundRotation:null!=(a=null==(s=c.backgroundRotation)||null==s.clone?void 0:s.clone())?a:[0,0,0],environmentIntensity:c.environmentIntensity,environmentRotation:null!=(o=null==(l=c.environmentRotation)||null==l.clone?void 0:l.clone())?o:[0,0,0]};return"only"!==e&&(c.environment=i),e&&(c.background=i),(0,d.s)(c,n),()=>{"only"!==e&&(c.environment=f),e&&(c.background=p),(0,d.s)(c,m)}}function tI({scene:e,background:t=!1,map:r,...i}){let n=(0,l.useThree)(e=>e.scene);return o.useLayoutEffect(()=>{if(r)return tB(t,e,n,r,i)}),null}function tP({background:e=!1,scene:t,blur:r,backgroundBlurriness:i,backgroundIntensity:n,backgroundRotation:a,environmentIntensity:s,environmentRotation:u,...h}){let d=tE(h),c=(0,l.useThree)(e=>e.scene);return o.useLayoutEffect(()=>tB(e,t,c,d,{backgroundBlurriness:null!=r?r:i,backgroundIntensity:n,backgroundRotation:a,environmentIntensity:s,environmentRotation:u})),o.useEffect(()=>()=>{d.dispose()},[d]),null}function tF({children:e,near:t=.1,far:r=1e3,resolution:i=256,frames:n=1,map:a,background:s=!1,blur:d,backgroundBlurriness:c,backgroundIntensity:m,backgroundRotation:g,environmentIntensity:v,environmentRotation:y,scene:_,files:x,path:b,preset:S,extensions:T}){let A=(0,l.useThree)(e=>e.gl),M=(0,l.useThree)(e=>e.scene),E=o.useRef(null),[C]=o.useState(()=>new p.Scene),w=o.useMemo(()=>{let e=new f.WebGLCubeRenderTarget(i);return e.texture.type=p.HalfFloatType,e},[i]);o.useEffect(()=>()=>{w.dispose()},[w]),o.useLayoutEffect(()=>{if(1===n){let e=A.autoClear;A.autoClear=!0,E.current.update(A,C),A.autoClear=e}return tB(s,_,M,w.texture,{backgroundBlurriness:null!=d?d:c,backgroundIntensity:m,backgroundRotation:g,environmentIntensity:v,environmentRotation:y})},[e,C,w.texture,_,M,s,n,A]);let R=1;return(0,u.useFrame)(()=>{if(n===1/0||R<n){let e=A.autoClear;A.autoClear=!0,E.current.update(A,C),A.autoClear=e,R++}}),o.createElement(o.Fragment,null,(0,h.o)(o.createElement(o.Fragment,null,e,o.createElement("cubeCamera",{ref:E,args:[t,r,w]}),x||S?o.createElement(tP,{background:!0,files:x,preset:S,path:b,extensions:T}):a?o.createElement(tI,{background:!0,map:a,extensions:T}):null),C))}function tD(e){var t,r,i,n;let a=tE(e),l=e.map||a;o.useMemo(()=>(0,c.extend)({GroundProjectedEnvImpl:v}),[]),o.useEffect(()=>()=>{a.dispose()},[a]);let u=o.useMemo(()=>[l],[l]),h=null==(t=e.ground)?void 0:t.height,d=null==(r=e.ground)?void 0:r.radius,p=null!=(i=null==(n=e.ground)?void 0:n.scale)?i:1e3;return o.createElement(o.Fragment,null,o.createElement(tI,s({},e,{map:l})),o.createElement("groundProjectedEnvImpl",{args:u,scale:p,height:h,radius:d}))}function tU(e){return e.ground?o.createElement(tD,e):e.map?o.createElement(tI,e):e.children?o.createElement(tF,e):o.createElement(tP,e)}tE.clear=e=>{let t={...tw,...e},{files:r}=t,{preset:i}=t;i&&(tR(i),r=tT[i]);let{extension:n}=tN(r),a=tL(n);if(!a)throw Error("useEnvironment: Unrecognized file extension: "+r);
850y.useLoader.clear(a,Array.isArray(r)?[r]:r)};let tO=o.forwardRef(({envMap:e,resolution:t=256,frames:r=1/0,children:i,makeDefault:n,...a},h)=>{let d=(0,l.useThree)(({set:e})=>e),c=(0,l.useThree)(({camera:e})=>e),f=(0,l.useThree)(({size:e})=>e),m=o.useRef(null);o.useImperativeHandle(h,()=>m.current,[]);let g=o.useRef(null),v=function(e,t,r){let i=(0,l.useThree)(e=>e.size),n=(0,l.useThree)(e=>e.viewport),a="number"==typeof e?e:i.width*n.dpr,s=i.height*n.dpr,u=("number"==typeof e?void 0:e)||{},{samples:h=0,depth:d,...c}=u,f=null!=d?d:u.depthBuffer,m=o.useMemo(()=>{let e=new p.WebGLRenderTarget(a,s,{minFilter:p.LinearFilter,magFilter:p.LinearFilter,type:p.HalfFloatType,...c});return f&&(e.depthTexture=new p.DepthTexture(a,s,p.FloatType)),e.samples=h,e},[]);return o.useLayoutEffect(()=>{m.setSize(a,s),h&&(m.samples=h)},[h,m,a,s]),o.useEffect(()=>()=>m.dispose(),[]),m}(t);o.useLayoutEffect(()=>{a.manual||m.current.updateProjectionMatrix()},[f,a]),o.useLayoutEffect(()=>{m.current.updateProjectionMatrix()}),o.useLayoutEffect(()=>{if(n)return d(()=>({camera:m.current})),()=>d(()=>({camera:c}))},[m,n,d]);let y=0,_=null,x="function"==typeof i;return(0,u.useFrame)(t=>{x&&(r===1/0||y<r)&&(g.current.visible=!1,t.gl.setRenderTarget(v),_=t.scene.background,e&&(t.scene.background=e),t.gl.render(t.scene,m.current),t.scene.background=_,t.gl.setRenderTarget(null),g.current.visible=!0,y++)}),o.createElement(o.Fragment,null,o.createElement("orthographicCamera",s({left:-(f.width/2),right:f.width/2,top:f.height/2,bottom:-(f.height/2),ref:m},a),!x&&i),o.createElement("group",{ref:g},x&&i(v.texture)))});var tG=p;function tk(e,t){if(t===p.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t!==p.TriangleFanDrawMode&&t!==p.TriangleStripDrawMode)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let r=e.getIndex();if(null===r){let t=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<i.count;e++)t.push(e);e.setIndex(t),r=e.getIndex()}let i=r.count-2,n=[];if(r)if(t===p.TriangleFanDrawMode)for(let e=1;e<=i;e++)n.push(r.getX(0)),n.push(r.getX(e)),n.push(r.getX(e+1));else for(let e=0;e<i;e++)e%2==0?(n.push(r.getX(e)),n.push(r.getX(e+1)),n.push(r.getX(e+2))):(n.push(r.getX(e+2)),n.push(r.getX(e+1)),n.push(r.getX(e)));n.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let a=e.clone();return a.setIndex(n),a.clearGroups(),a}}function tV(e){if("u">typeof TextDecoder)return new TextDecoder().decode(e);let t="";for(let r=0,i=e.length;r<i;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch(e){return t}}let tz="srgb",tH="srgb-linear";class tW extends tG.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new tK(e)}),this.register(function(e){return new tY(e)}),this.register(function(e){return new t8(e)}),this.register(function(e){return new t6(e)}),this.register(function(e){return new t9(e)}),this.register(function(e){return new tZ(e)}),this.register(function(e){return new t0(e)}),this.register(function(e){return new t1(e)}),this.register(function(e){return new t2(e)}),this.register(function(e){return new tJ(e)}),this.register(function(e){return new t3(e)}),this.register(function(e){return new tQ(e)}),this.register(function(e){return new t5(e)}),this.register(function(e){return new t4(e)}),this.register(function(e){return new tq(e)}),this.register(function(e){return new t7(e)}),this.register(function(e){return new re(e)})}load(e,t,r,i){let n,a=this;if(""!==this.resourcePath)n=this.resourcePath;else if(""!==this.path){let t=tG.LoaderUtils.extractUrlBase(e);n=tG.LoaderUtils.resolveURL(t,this.path)}else n=tG.LoaderUtils.extractUrlBase(e);this.manager.itemStart(e);let s=function(t){i?i(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},o=new tG.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(r){try{a.parse(r,n,function(r){t(r),a.manager.itemEnd(e)},s)}catch(e){s(e)}},r,s)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return -1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return -1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}
850parse(e,t,r,i){let n,a={},s={};if("string"==typeof e)n=JSON.parse(e);else if(e instanceof ArrayBuffer)if(tV(new Uint8Array(e.slice(0,4)))===rt){try{a[tX.KHR_BINARY_GLTF]=new rr(e)}catch(e){i&&i(e);return}n=JSON.parse(a[tX.KHR_BINARY_GLTF].content)}else n=JSON.parse(tV(new Uint8Array(e)));else n=e;if(void 0===n.asset||n.asset.version[0]<2){i&&i(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let o=new rS(n,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});o.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](o);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),s[t.name]=t,a[t.name]=!0}if(n.extensionsUsed)for(let e=0;e<n.extensionsUsed.length;++e){let t=n.extensionsUsed[e],r=n.extensionsRequired||[];switch(t){case tX.KHR_MATERIALS_UNLIT:a[t]=new t$;break;case tX.KHR_DRACO_MESH_COMPRESSION:a[t]=new ri(n,this.dracoLoader);break;case tX.KHR_TEXTURE_TRANSFORM:a[t]=new rn;break;case tX.KHR_MESH_QUANTIZATION:a[t]=new ra;break;default:r.indexOf(t)>=0&&void 0===s[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}o.setExtensions(a),o.setPlugins(s),o.parse(r,i)}parseAsync(e,t){let r=this;return new Promise(function(i,n){r.parse(e,t,i,n)})}}function tj(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let tX={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class tq{constructor(e){this.parser=e,this.name=tX.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let r=0,i=t.length;r<i;r++){let i=t[r];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){let t,r=this.parser,i="light:"+e,n=r.cache.get(i);if(n)return n;let a=r.json,s=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e],o=new tG.Color(0xffffff);void 0!==s.color&&o.setRGB(s.color[0],s.color[1],s.color[2],tH);let l=void 0!==s.range?s.range:0;switch(s.type){case"directional":(t=new tG.DirectionalLight(o)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new tG.PointLight(o)).distance=l;break;case"spot":(t=new tG.SpotLight(o)).distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,t.angle=s.spot.outerConeAngle,t.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return t.position.set(0,0,0),t.decay=2,ry(t,s),void 0!==s.intensity&&(t.intensity=s.intensity),t.name=r.createUniqueName(s.name||"light_"+e),n=Promise.resolve(t),r.cache.add(i,n),n}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){let t=this,r=this.parser,i=r.json.nodes[e],n=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then(function(e){return r._getNodeRef(t.cache,n,e)})}}class t${constructor(){this.name=tX.KHR_MATERIALS_UNLIT}getMaterialType(){return tG.MeshBasicMaterial}extendParams(e,t,r){let i=[];e.color=new tG.Color(1,1,1),e.opacity=1;let n=t.pbrMetallicRoughness;if(n){if(Array.isArray(n.baseColorFactor)){let t=n.baseColorFactor;
850e.color.setRGB(t[0],t[1],t[2],tH),e.opacity=t[3]}void 0!==n.baseColorTexture&&i.push(r.assignTexture(e,"map",n.baseColorTexture,tz))}return Promise.all(i)}}class tJ{constructor(e){this.parser=e,this.name=tX.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){let r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let i=r.extensions[this.name].emissiveStrength;return void 0!==i&&(t.emissiveIntensity=i),Promise.resolve()}}class tK{constructor(e){this.parser=e,this.name=tX.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?tG.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=[],a=i.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&n.push(r.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&n.push(r.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(n.push(r.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){let e=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new tG.Vector2(e,e)}return Promise.all(n)}}class tY{constructor(e){this.parser=e,this.name=tX.KHR_MATERIALS_DISPERSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?tG.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let i=r.extensions[this.name];return t.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class tQ{constructor(e){this.parser=e,this.name=tX.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?tG.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=[],a=i.extensions[this.name];return void 0!==a.iridescenceFactor&&(t.iridescence=a.iridescenceFactor),void 0!==a.iridescenceTexture&&n.push(r.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),void 0!==a.iridescenceIor&&(t.iridescenceIOR=a.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==a.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),void 0!==a.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),void 0!==a.iridescenceThicknessTexture&&n.push(r.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(n)}}class tZ{constructor(e){this.parser=e,this.name=tX.KHR_MATERIALS_SHEEN}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?tG.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=[];t.sheenColor=new tG.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;let a=i.extensions[this.name];if(void 0!==a.sheenColorFactor){let e=a.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],tH)}return void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&n.push(r.assignTexture(t,"sheenColorMap",a.sheenColorTexture,tz)),void 0!==a.sheenRoughnessTexture&&n.push(r.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(n)}}class t0{constructor(e){this.parser=e,this.name=tX.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?tG.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=[],a=i.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(n)}}class t1{constructor(e){this.parser=e,this.name=tX.KHR_MATERIALS_VOLUME}getMaterialType(e){let t=this.parser.json.materials[e];
850return t.extensions&&t.extensions[this.name]?tG.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=[],a=i.extensions[this.name];t.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&n.push(r.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;let s=a.attenuationColor||[1,1,1];return t.attenuationColor=new tG.Color().setRGB(s[0],s[1],s[2],tH),Promise.all(n)}}class t2{constructor(e){this.parser=e,this.name=tX.KHR_MATERIALS_IOR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?tG.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();let i=r.extensions[this.name];return t.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class t3{constructor(e){this.parser=e,this.name=tX.KHR_MATERIALS_SPECULAR}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?tG.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=[],a=i.extensions[this.name];t.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&n.push(r.assignTexture(t,"specularIntensityMap",a.specularTexture));let s=a.specularColorFactor||[1,1,1];return t.specularColor=new tG.Color().setRGB(s[0],s[1],s[2],tH),void 0!==a.specularColorTexture&&n.push(r.assignTexture(t,"specularColorMap",a.specularColorTexture,tz)),Promise.all(n)}}class t4{constructor(e){this.parser=e,this.name=tX.EXT_MATERIALS_BUMP}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?tG.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=[],a=i.extensions[this.name];return t.bumpScale=void 0!==a.bumpFactor?a.bumpFactor:1,void 0!==a.bumpTexture&&n.push(r.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(n)}}class t5{constructor(e){this.parser=e,this.name=tX.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?tG.MeshPhysicalMaterial:null}extendMaterialParams(e,t){let r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=[],a=i.extensions[this.name];return void 0!==a.anisotropyStrength&&(t.anisotropy=a.anisotropyStrength),void 0!==a.anisotropyRotation&&(t.anisotropyRotation=a.anisotropyRotation),void 0!==a.anisotropyTexture&&n.push(r.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(n)}}class t8{constructor(e){this.parser=e,this.name=tX.KHR_TEXTURE_BASISU}loadTexture(e){let t=this.parser,r=t.json,i=r.textures[e];if(!i.extensions||!i.extensions[this.name])return null;let n=i.extensions[this.name],a=t.options.ktx2Loader;if(!a)if(!(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return t.loadTextureImage(e,n.source,a)}}class t6{constructor(e){this.parser=e,this.name=tX.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){let t=this.name,r=this.parser,i=r.json,n=i.textures[e];if(!n.extensions||!n.extensions[t])return null;let a=n.extensions[t],s=i.images[a.source],o=r.textureLoader;if(s.uri){let e=r.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then(function(n){if(n)return r.loadTextureImage(e,a.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class t9{constructor(e){this.parser=e,this.name=tX.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){let t=this.name,r=this.parser,i=r.json,n=i.textures[e];if(!n.extensions||!n.extensions[t])return null;let a=n.extensions[t],s=i.images[a.source],o=r.textureLoader;if(s.uri){let e=r.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then(function(n){if(n)return r.loadTextureImage(e,a.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdj
850FDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class t7{constructor(e){this.name=tX.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,r=t.bufferViews[e];if(!r.extensions||!r.extensions[this.name])return null;{let e=r.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),n=this.parser.options.meshoptDecoder;if(!n||!n.supported)if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return i.then(function(t){let r=e.byteOffset||0,i=e.byteLength||0,a=e.count,s=e.byteStride,o=new Uint8Array(t,r,i);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(a,s,o,e.mode,e.filter).then(function(e){return e.buffer}):n.ready.then(function(){let t=new ArrayBuffer(a*s);return n.decodeGltfBuffer(new Uint8Array(t),a,s,o,e.mode,e.filter),t})})}}}class re{constructor(e){this.name=tX.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;for(let e of t.meshes[r.mesh].primitives)if(e.mode!==ru.TRIANGLES&&e.mode!==ru.TRIANGLE_STRIP&&e.mode!==ru.TRIANGLE_FAN&&void 0!==e.mode)return null;let i=r.extensions[this.name].attributes,n=[],a={};for(let e in i)n.push(this.parser.getDependency("accessor",i[e]).then(t=>(a[e]=t,a[e])));return n.length<1?null:(n.push(this.parser.createNodeMesh(e)),Promise.all(n).then(e=>{let t=e.pop(),r=t.isGroup?t.children:[t],i=e[0].count,n=[];for(let e of r){let t=new tG.Matrix4,r=new tG.Vector3,s=new tG.Quaternion,o=new tG.Vector3(1,1,1),l=new tG.InstancedMesh(e.geometry,e.material,i);for(let e=0;e<i;e++)a.TRANSLATION&&r.fromBufferAttribute(a.TRANSLATION,e),a.ROTATION&&s.fromBufferAttribute(a.ROTATION,e),a.SCALE&&o.fromBufferAttribute(a.SCALE,e),l.setMatrixAt(e,t.compose(r,s,o));for(let t in a)if("_COLOR_0"===t){let e=a[t];l.instanceColor=new tG.InstancedBufferAttribute(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,a[t]);tG.Object3D.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),n.push(l)}return t.isGroup?(t.clear(),t.add(...n),t):n[0]}))}}let rt="glTF";class rr{constructor(e){this.name=tX.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12);if(this.header={magic:tV(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==rt)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-12,i=new DataView(e,12);let n=0;for(;n<r;){const t=i.getUint32(n,!0);n+=4;const r=i.getUint32(n,!0);if(n+=4,0x4e4f534a===r){const r=new Uint8Array(e,12+n,t);this.content=tV(r)}else if(5130562===r){const r=12+n;this.body=e.slice(r,r+t)}n+=t}if(null===this.content)throw Error("THREE.GLTFLoader: JSON content not found.")}}class ri{constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=tX.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){let r=this.json,i=this.dracoLoader,n=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,s={},o={},l={};for(let e in a)s[rf[e]||e.toLowerCase()]=a[e];for(let t in e.attributes){let i=rf[t]||t.toLowerCase();if(void 0!==a[t]){let n=r.accessors[e.attributes[t]],a=rh[n.componentType];l[i]=a.name,o[i]=!0===n.normalized}}return t.getDependency("bufferView",n).then(function(e){return new Promise(function(t,r){i.decodeDracoFile(e,function(e){for(let t in e.attributes){let r=e.attributes[t],i=o[t];void 0!==i&&(r.normalized=i)}t(e)},s,l,tH,r)})})}}class rn{constructor(){this.name=tX.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(void 0===t.texCoord||t.texCoord===e.channel)&&void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}
850class ra{constructor(){this.name=tX.KHR_MESH_QUANTIZATION}}class rs extends tG.Interpolant{constructor(e,t,r,i){super(e,t,r,i)}copySampleValue_(e){let t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,n=e*i*3+i;for(let e=0;e!==i;e++)t[e]=r[n+e];return t}interpolate_(e,t,r,i){let n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,u=i-t,h=(r-t)/u,d=h*h,c=d*h,p=e*l,f=p-l,m=-2*c+3*d,g=c-d,v=1-m,y=g-d+h;for(let e=0;e!==s;e++){let t=a[f+e+s],r=a[f+e+o]*u,i=a[p+e+s],l=a[p+e]*u;n[e]=v*t+y*r+m*i+g*l}return n}}let ro=new tG.Quaternion;class rl extends rs{interpolate_(e,t,r,i){let n=super.interpolate_(e,t,r,i);return ro.fromArray(n).normalize().toArray(n),n}}let ru={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},rh={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},rd={9728:tG.NearestFilter,9729:tG.LinearFilter,9984:tG.NearestMipmapNearestFilter,9985:tG.LinearMipmapNearestFilter,9986:tG.NearestMipmapLinearFilter,9987:tG.LinearMipmapLinearFilter},rc={33071:tG.ClampToEdgeWrapping,33648:tG.MirroredRepeatWrapping,10497:tG.RepeatWrapping},rp={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},rf={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...g>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},rm={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},rg={CUBICSPLINE:void 0,LINEAR:tG.InterpolateLinear,STEP:tG.InterpolateDiscrete};function rv(e,t,r){for(let i in r.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=r.extensions[i])}function ry(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function r_(e){let t="",r=Object.keys(e).sort();for(let i=0,n=r.length;i<n;i++)t+=r[i]+":"+e[r[i]]+";";return t}function rx(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}let rb=new tG.Matrix4;class rS{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new tj,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=!1,n=-1;"u">typeof navigator&&void 0!==navigator.userAgent&&(r=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),n=(i=navigator.userAgent.indexOf("Firefox")>-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"u"<typeof createImageBitmap||r||i&&n<98?this.textureLoader=new tG.TextureLoader(this.options.manager):this.textureLoader=new tG.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new tG.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let r=this,i=this.json,n=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(t){let a={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:r,userData:{}};return rv(n,a,i),ry(a,i),Promise.all(r._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,i=t.length;r<i;r++){let i=t[r].joints;for(let t=0,r=i.length;t<r;t++)e[i[t]].isBone=!0}for(let t=0,i=e.length;t<i;t++){let i=e[t];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(r[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(e.refs[t]<=1)return r;let i=r.clone(),n=(e,t)=>{let r=this.associations.get(e);for(let[i,a]of(null!=r&&this.associations.set(t,r),e.children.entries()))n(a,t.children[i])};return n(r,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){let i=e(t[r]);if(i)return i}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let r=[];for(let i=0;i<t.length;i++){let n=e(t[i]);n&&r.push(n)}return r}getDependency(e,t){let r=e+":"+t,i=this.cache.get(r);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":i=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(!(i=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})))throw Error("Unknown type: "+e)}this.cache.add(r,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){let r=this;t=Promise.all((this.json[e+("mesh"===e?"es":"s")]||[]).map(function(t,i){return r.getDependency(e,i)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");
850if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[tX.KHR_BINARY_GLTF].body);let i=this.options;return new Promise(function(e,n){r.load(tG.LoaderUtils.resolveURL(t.uri,i.path),e,void 0,function(){n(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){let r=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+r)})}loadAccessor(e){let t=this,r=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse){let e=rp[i.type],t=rh[i.componentType],r=!0===i.normalized,n=new t(i.count*e);return Promise.resolve(new tG.BufferAttribute(n,e,r))}let n=[];return void 0!==i.bufferView?n.push(this.getDependency("bufferView",i.bufferView)):n.push(null),void 0!==i.sparse&&(n.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),n.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(n).then(function(e){let n,a,s=e[0],o=rp[i.type],l=rh[i.componentType],u=l.BYTES_PER_ELEMENT,h=u*o,d=i.byteOffset||0,c=void 0!==i.bufferView?r.bufferViews[i.bufferView].byteStride:void 0,p=!0===i.normalized;if(c&&c!==h){let e=Math.floor(d/c),r="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+e+":"+i.count,h=t.cache.get(r);h||(n=new l(s,e*c,i.count*c/u),h=new tG.InterleavedBuffer(n,c/u),t.cache.add(r,h)),a=new tG.InterleavedBufferAttribute(h,o,d%c/u,p)}else n=null===s?new l(i.count*o):new l(s,d,i.count*o),a=new tG.BufferAttribute(n,o,p);if(void 0!==i.sparse){let t=rp.SCALAR,r=rh[i.sparse.indices.componentType],n=i.sparse.indices.byteOffset||0,u=i.sparse.values.byteOffset||0,h=new r(e[1],n,i.sparse.count*t),d=new l(e[2],u,i.sparse.count*o);null!==s&&(a=new tG.BufferAttribute(a.array.slice(),a.itemSize,a.normalized));for(let e=0,t=h.length;e<t;e++){let t=h[e];if(a.setX(t,d[e*o]),o>=2&&a.setY(t,d[e*o+1]),o>=3&&a.setZ(t,d[e*o+2]),o>=4&&a.setW(t,d[e*o+3]),o>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return a})}loadTexture(e){let t=this.json,r=this.options,i=t.textures[e].source,n=t.images[i],a=this.textureLoader;if(n.uri){let e=r.manager.getHandler(n.uri);null!==e&&(a=e)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,r){let i=this,n=this.json,a=n.textures[e],s=n.images[t],o=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[o])return this.textureCache[o];let l=this.loadImageSource(t,r).then(function(t){t.flipY=!1,t.name=a.name||s.name||"",""===t.name&&"string"==typeof s.uri&&!1===s.uri.startsWith("data:image/")&&(t.name=s.uri);let r=(n.samplers||{})[a.sampler]||{};return t.magFilter=rd[r.magFilter]||tG.LinearFilter,t.minFilter=rd[r.minFilter]||tG.LinearMipmapLinearFilter,t.wrapS=rc[r.wrapS]||tG.RepeatWrapping,t.wrapT=rc[r.wrapT]||tG.RepeatWrapping,i.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[o]=l,l}loadImageSource(e,t){let r=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let n=r.images[e],a=self.URL||self.webkitURL,s=n.uri||"",o=!1;if(void 0!==n.bufferView)s=this.getDependency("bufferView",n.bufferView).then(function(e){o=!0;let t=new Blob([e],{type:n.mimeType});return s=a.createObjectURL(t)});else if(void 0===n.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(s).then(function(e){return new Promise(function(r,n){let a=r;!0===t.isImageBitmapLoader&&(a=function(e){let t=new tG.Texture(e);t.needsUpdate=!0,r(t)}),t.load(tG.LoaderUtils.resolveURL(e,i.path),a,void 0,n)})}).then(function(e){var t;return!0===o&&a.revokeObjectURL(s),ry(e,n),e.userData.mimeType=n.mimeType||((t=n.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,r,i){let n=this;return this.getDependency("texture",r.index).then(function(a){if(!a)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((a=a.clone()).channel=r.texCoord),n.extensions[tX.KHR_TEXTURE_TRANSFORM]){let e=void 0!==r.extensions?r.extensions[tX.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=n.associations.get(a);a=n.extensions[tX.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),n.associations.set(a,t)}}return void 0!==i&&("number"==typeof i&&(i=3001===i?tz:tH),"colorSpace"in a?a.colorSpace
850=i:a.encoding=i===tz?3001:3e3),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,r=e.material,i=void 0===t.attributes.tangent,n=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new tG.PointsMaterial,tG.Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,t.sizeAttenuation=!1,this.cache.add(e,t)),r=t}else if(e.isLine){let e="LineBasicMaterial:"+r.uuid,t=this.cache.get(e);t||(t=new tG.LineBasicMaterial,tG.Material.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,this.cache.add(e,t)),r=t}if(i||n||a){let e="ClonedMaterial:"+r.uuid+":";i&&(e+="derivative-tangents:"),n&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),n&&(t.vertexColors=!0),a&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(r))),r=t}e.material=r}getMaterialType(){return tG.MeshStandardMaterial}loadMaterial(e){let t,r=this,i=this.json,n=this.extensions,a=i.materials[e],s={},o=a.extensions||{},l=[];if(o[tX.KHR_MATERIALS_UNLIT]){let e=n[tX.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),l.push(e.extendParams(s,a,r))}else{let i=a.pbrMetallicRoughness||{};if(s.color=new tG.Color(1,1,1),s.opacity=1,Array.isArray(i.baseColorFactor)){let e=i.baseColorFactor;s.color.setRGB(e[0],e[1],e[2],tH),s.opacity=e[3]}void 0!==i.baseColorTexture&&l.push(r.assignTexture(s,"map",i.baseColorTexture,tz)),s.metalness=void 0!==i.metallicFactor?i.metallicFactor:1,s.roughness=void 0!==i.roughnessFactor?i.roughnessFactor:1,void 0!==i.metallicRoughnessTexture&&(l.push(r.assignTexture(s,"metalnessMap",i.metallicRoughnessTexture)),l.push(r.assignTexture(s,"roughnessMap",i.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)})))}!0===a.doubleSided&&(s.side=tG.DoubleSide);let u=a.alphaMode||"OPAQUE";if("BLEND"===u?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,"MASK"===u&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==tG.MeshBasicMaterial&&(l.push(r.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new tG.Vector2(1,1),void 0!==a.normalTexture.scale)){let e=a.normalTexture.scale;s.normalScale.set(e,e)}if(void 0!==a.occlusionTexture&&t!==tG.MeshBasicMaterial&&(l.push(r.assignTexture(s,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==tG.MeshBasicMaterial){let e=a.emissiveFactor;s.emissive=new tG.Color().setRGB(e[0],e[1],e[2],tH)}return void 0!==a.emissiveTexture&&t!==tG.MeshBasicMaterial&&l.push(r.assignTexture(s,"emissiveMap",a.emissiveTexture,tz)),Promise.all(l).then(function(){let i=new t(s);return a.name&&(i.name=a.name),ry(i,a),r.associations.set(i,{materials:e}),a.extensions&&rv(n,i,a),i})}createUniqueName(e){let t=tG.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,r=this.extensions,i=this.primitiveCache,n=[];for(let a=0,s=e.length;a<s;a++){let s=e[a],o=function(e){let t,r=e.extensions&&e.extensions[tX.KHR_DRACO_MESH_COMPRESSION];if(t=r?"draco:"+r.bufferView+":"+r.indices+":"+r_(r.attributes):e.indices+":"+r_(e.attributes)+":"+e.mode,void 0!==e.targets)for(let r=0,i=e.targets.length;r<i;r++)t+=":"+r_(e.targets[r]);return t}(s),l=i[o];if(l)n.push(l.promise);else{let e;e=s.extensions&&s.extensions[tX.KHR_DRACO_MESH_COMPRESSION]?function(e){return r[tX.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(r){return rT(r,e,t)})}(s):rT(new tG.BufferGeometry,s,t),i[o]={primitive:s,promise:e},n.push(e)}}return Promise.all(n)}loadMesh(e){let t=this,r=this.json,i=this.extensions,n=r.meshes[e],a=n.primitives,s=[];for(let e=0,t=a.length;e<t;e++){var o;let t=void 0===a[e].material?(void 0===(o=this.cache).DefaultMaterial&&(o.DefaultMaterial=new tG.MeshStandardMaterial({color:0xffffff,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:tG.FrontSide})),o.DefaultMaterial):this.getDependency("material",a[e].material);s.push(t)}return s.push(t.loadGeometries(a)),Promise.all(s).then(function(r){let s=r.slice(0,r.length-1),o=r[r.length-1],l=[];for(let r=0,u=o.length;r<u;r++){let u,h=o[r],d=a[r],c=s[r];if(d.mode===ru.TRIANGLES||d.mode===ru.TRIANGLE_STRIP||d.mode===ru.TRIANGLE_FAN||void 0===d.mode)!0===(u=!0===n.isSkinnedMesh?new tG.SkinnedMesh(h,c):new tG.Mesh(h,c)).isSkinnedMesh&&u.normalizeSkinWeights(),d.mode===ru.TRIANGLE_STRIP?u.geometry=tk(u.geometry,tG.TriangleStripDrawMode):d.mode===ru.TRIANGLE_FAN&&(u.geometry=tk(u.geometry,tG.TriangleFanDrawMode));else if(d.mode===ru.LINES)u=new tG.LineSegments(h,c);else if(d.mode===ru.LINE_STRIP)u=new tG.Line(h,c);else if(d.mode===ru.LINE_LOOP)u=new tG.LineLoop(h,c);else if(d.mode===ru.POINTS)u=new tG.Points(h,c);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+d.mode);Object.keys(u.geometry.morphAttributes).length>0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,i=t.weights.length;r<i;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){let r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length){e.morphTargetDictionary={};for(let t=0,i=r.length;t<i;t++)e.morphTargetDictionary[r[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}(u,n),u.name=t.createUniqueName(n.name||"mesh_"+e),ry(u,n),d.extensions&&rv(i,u,d),t.assignFinalMaterial(u),l.push(u)}for(let r=0,i=l.length;r<i;r++)t.associations.set(l[r],{meshes:e,primitives:r});if(1===l.length)return n.extensions&&rv(i,l[0],n),l[0];let u=new tG.Group;n.extensions&&rv(i,u,n),t.associations.set(u,{meshes:e});for(let e=0,t=l.length;e<t;e++)u.add(l[e]);return u})}loadCamera(e){let t,r=this.json.cameras[e],i=r[r.type];return i?("perspective"===r.type?t=new tG.PerspectiveCamera(tG.MathUtils.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===r.type&&(t=new tG.Orthogra
850phicCamera(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),ry(t,r),Promise.resolve(t)):void console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){let t=this.json.skins[e],r=[];for(let e=0,i=t.joints.length;e<i;e++)r.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(e){let r=e.pop(),i=[],n=[];for(let a=0,s=e.length;a<s;a++){let s=e[a];if(s){i.push(s);let e=new tG.Matrix4;null!==r&&e.fromArray(r.array,16*a),n.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}return new tG.Skeleton(i,n)})}loadAnimation(e){let t=this.json,r=this,i=t.animations[e],n=i.name?i.name:"animation_"+e,a=[],s=[],o=[],l=[],u=[];for(let e=0,t=i.channels.length;e<t;e++){let t=i.channels[e],r=i.samplers[t.sampler],n=t.target,h=n.node,d=void 0!==i.parameters?i.parameters[r.input]:r.input,c=void 0!==i.parameters?i.parameters[r.output]:r.output;void 0!==n.node&&(a.push(this.getDependency("node",h)),s.push(this.getDependency("accessor",d)),o.push(this.getDependency("accessor",c)),l.push(r),u.push(n))}return Promise.all([Promise.all(a),Promise.all(s),Promise.all(o),Promise.all(l),Promise.all(u)]).then(function(e){let t=e[0],i=e[1],a=e[2],s=e[3],o=e[4],l=[];for(let e=0,n=t.length;e<n;e++){let n=t[e],u=i[e],h=a[e],d=s[e],c=o[e];if(void 0===n)continue;n.updateMatrix&&n.updateMatrix();let p=r._createAnimationTracks(n,u,h,d,c);if(p)for(let e=0;e<p.length;e++)l.push(p[e])}return new tG.AnimationClip(n,void 0,l)})}createNodeMesh(e){let t=this.json,r=this,i=t.nodes[e];return void 0===i.mesh?null:r.getDependency("mesh",i.mesh).then(function(e){let t=r._getNodeRef(r.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,r=i.weights.length;t<r;t++)e.morphTargetInfluences[t]=i.weights[t]}),t})}loadNode(e){let t=this.json.nodes[e],r=this._loadNodeShallow(e),i=[],n=t.children||[];for(let e=0,t=n.length;e<t;e++)i.push(this.getDependency("node",n[e]));let a=void 0===t.skin?Promise.resolve(null):this.getDependency("skin",t.skin);return Promise.all([r,Promise.all(i),a]).then(function(e){let t=e[0],r=e[1],i=e[2];null!==i&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(i,rb)});for(let e=0,i=r.length;e<i;e++)t.add(r[e]);return t})}_loadNodeShallow(e){let t=this.json,r=this.extensions,i=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];let n=t.nodes[e],a=n.name?i.createUniqueName(n.name):"",s=[],o=i._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return o&&s.push(o),void 0!==n.camera&&s.push(i.getDependency("camera",n.camera).then(function(e){return i._getNodeRef(i.cameraCache,n.camera,e)})),i._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){s.push(e)}),this.nodeCache[e]=Promise.all(s).then(function(t){let s;if((s=!0===n.isBone?new tG.Bone:t.length>1?new tG.Group:1===t.length?t[0]:new tG.Object3D)!==t[0])for(let e=0,r=t.length;e<r;e++)s.add(t[e]);if(n.name&&(s.userData.name=n.name,s.name=a),ry(s,n),n.extensions&&rv(r,s,n),void 0!==n.matrix){let e=new tG.Matrix4;e.fromArray(n.matrix),s.applyMatrix4(e)}else void 0!==n.translation&&s.position.fromArray(n.translation),void 0!==n.rotation&&s.quaternion.fromArray(n.rotation),void 0!==n.scale&&s.scale.fromArray(n.scale);return i.associations.has(s)||i.associations.set(s,{}),i.associations.get(s).nodes=e,s}),this.nodeCache[e]}loadScene(e){let t=this.extensions,r=this.json.scenes[e],i=this,n=new tG.Group;r.name&&(n.name=i.createUniqueName(r.name)),ry(n,r),r.extensions&&rv(t,n,r);let a=r.nodes||[],s=[];for(let e=0,t=a.length;e<t;e++)s.push(i.getDependency("node",a[e]));return Promise.all(s).then(function(e){for(let t=0,r=e.length;t<r;t++)n.add(e[t]);return i.associations=(e=>{let t=new Map;for(let[e,r]of i.associations)(e instanceof tG.Material||e instanceof tG.Texture)&&t.set(e,r);return e.traverse(e=>{let r=i.associations.get(e);null!=r&&t.set(e,r)}),t})(n),n})}_createAnimationTracks(e,t,r,i,n){let a,s=[],o=e.name?e.name:e.uuid,l=[];switch(rm[n.path]===rm.weights?e.traverse(function(e){e.morphTargetInfluences&&l.push(e.name?e.name:e.uuid)}):l.push(o),rm[n.path]){case rm.weights:a=tG.NumberKeyframeTrack;break;case rm.rotation:a=tG.QuaternionKeyframeTrack;break;case rm.position:case rm.scale:a=tG.VectorKeyframeTrack;break;default:a=1===r.itemSize?tG.NumberKeyframeTrack:tG.VectorKeyframeTrack}let u=void 0!==i.interpolation?rg[i.interpolation]:tG.InterpolateLinear,h=this._getArrayFromAccessor(r);for(let e=0,r=l.length;e<r;e++){let r=new a(l[e]+"."+rm[n.path],t.array,h,u);
850"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(r),s.push(r)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=rx(t.constructor),r=new Float32Array(t.length);for(let i=0,n=t.length;i<n;i++)r[i]=t[i]*e;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof tG.QuaternionKeyframeTrack?rl:rs)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function rT(e,t,r){let i=t.attributes,n=[];for(let t in i){let a=rf[t]||t.toLowerCase();a in e.attributes||n.push(function(t,i){return r.getDependency("accessor",t).then(function(t){e.setAttribute(i,t)})}(i[t],a))}if(void 0!==t.indices&&!e.index){let i=r.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});n.push(i)}return ry(e,t),!function(e,t,r){let i=t.attributes,n=new tG.Box3;if(void 0===i.POSITION)return;{let e=r.json.accessors[i.POSITION],t=e.min,a=e.max;if(void 0===t||void 0===a)return console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(n.set(new tG.Vector3(t[0],t[1],t[2]),new tG.Vector3(a[0],a[1],a[2])),e.normalized){let t=rx(rh[e.componentType]);n.min.multiplyScalar(t),n.max.multiplyScalar(t)}}let a=t.targets;if(void 0!==a){let e=new tG.Vector3,t=new tG.Vector3;for(let i=0,n=a.length;i<n;i++){let n=a[i];if(void 0!==n.POSITION){let i=r.json.accessors[n.POSITION],a=i.min,s=i.max;if(void 0!==a&&void 0!==s){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(s[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(s[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(s[2]))),i.normalized){let e=rx(rh[i.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(e)}e.boundingBox=n;let s=new tG.Sphere;n.getCenter(s.center),s.radius=n.min.distanceTo(n.max)/2,e.boundingSphere=s}(e,t,r),Promise.all(n).then(function(){return void 0!==t.targets?function(e,t,r){let i=!1,n=!1,a=!1;for(let e=0,r=t.length;e<r;e++){let r=t[e];if(void 0!==r.POSITION&&(i=!0),void 0!==r.NORMAL&&(n=!0),void 0!==r.COLOR_0&&(a=!0),i&&n&&a)break}if(!i&&!n&&!a)return Promise.resolve(e);let s=[],o=[],l=[];for(let u=0,h=t.length;u<h;u++){let h=t[u];if(i){let t=void 0!==h.POSITION?r.getDependency("accessor",h.POSITION):e.attributes.position;s.push(t)}if(n){let t=void 0!==h.NORMAL?r.getDependency("accessor",h.NORMAL):e.attributes.normal;o.push(t)}if(a){let t=void 0!==h.COLOR_0?r.getDependency("accessor",h.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(l)]).then(function(t){let r=t[0],s=t[1],o=t[2];return i&&(e.morphAttributes.position=r),n&&(e.morphAttributes.normal=s),a&&(e.morphAttributes.color=o),e.morphTargetsRelative=!0,e})}(e,t.targets,r):e})}var rA=p;let rM=new WeakMap;class rE extends rA.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,r,i){let n=new rA.FileLoader(this.manager);n.setPath(this.path),n.setResponseType("arraybuffer"),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,e=>{let r={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,r).then(t).catch(i)},r,i)}decodeDracoFile(e,t,r,i){let n={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,n).then(t)}decodeGeometry(e,t){let r;for(let e in t.attributeTypes){let r=t.attributeTypes[e];void 0!==r.BYTES_PER_ELEMENT&&(t.attributeTypes[e]=r.name)}let i=JSON.stringify(t);if(rM.has(e)){let t=rM.get(e);if(t.key===i)return t.promise;if(0===e.byteLength)throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n=this.workerNextTaskID++,a=e.byteLength,s=this._getWorker(n,a).then(i=>(r=i,new Promise((i,a)=>{r._callbacks[n]={resolve:i,reject:a},r.postMessage({type:"decode",id:n,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return s.catch(()=>!0).then(()=>{r&&n&&this._releaseTask(r,n)}),rM.set(e,{key:i,promise:s}),s}_createGeometry(e){let t=new rA.BufferGeometry;e.index&&t.setIndex(new rA.BufferAttribute(e.index.array,1));for(let r=0;r<e.attributes.length;r++){let i=e.attributes[r],n=i.name,a=i.array,s=i.itemSize;t.setAttribute(n,new rA.BufferAttribute(a,s))}return t}_loadLibrary(e,t){let r=new rA.FileLoader(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((t,i)=>{r.load(e,t,void 0,i)})}preload(){return this._initDecoder(),this}
850_initDecoder(){if(this.decoderPending)return this.decoderPending;let e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{let r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let i=rC.toString(),n=["/* draco decoder */",r,"\n/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){let r=t.data;switch(r.type){case"decode":e._callbacks[r.id].resolve(r);break;case"error":e._callbacks[r.id].reject(r);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function rC(){let e,t;onmessage=function(r){let i=r.data;switch(i.type){case"init":e=i.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case"decode":let n=i.buffer,a=i.taskConfig;t.then(e=>{let t=e.draco,r=new t.Decoder,s=new t.DecoderBuffer;s.Init(new Int8Array(n),n.byteLength);try{let e=function(e,t,r,i){var n,a,s;let o,l,u,h,d,c,p=i.attributeIDs,f=i.attributeTypes,m=t.GetEncodedGeometryType(r);if(m===e.TRIANGULAR_MESH)d=new e.Mesh,c=t.DecodeBufferToMesh(r,d);else if(m===e.POINT_CLOUD)d=new e.PointCloud,c=t.DecodeBufferToPointCloud(r,d);else throw Error("THREE.DRACOLoader: Unexpected geometry type.");if(!c.ok()||0===d.ptr)throw Error("THREE.DRACOLoader: Decoding failed: "+c.error_msg());let g={index:null,attributes:[]};for(let r in p){let n,a,s=self[f[r]];if(i.useUniqueIDs)a=p[r],n=t.GetAttributeByUniqueId(d,a);else{if(-1===(a=t.GetAttributeId(d,e[p[r]])))continue;n=t.GetAttribute(d,a)}g.attributes.push(function(e,t,r,i,n,a){let s=a.num_components(),o=r.num_points()*s,l=o*n.BYTES_PER_ELEMENT,u=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,n),h=e._malloc(l);t.GetAttributeDataArrayForAllPoints(r,a,u,l,h);let d=new n(e.HEAPF32.buffer,h,o).slice();return e._free(h),{name:i,array:d,itemSize:s}}(e,t,d,r,s,n))}return m===e.TRIANGULAR_MESH&&(n=e,a=t,s=d,o=3*s.num_faces(),l=4*o,u=n._malloc(l),a.GetTrianglesUInt32Array(s,l,u),h=new Uint32Array(n.HEAPF32.buffer,u,o).slice(),n._free(u),g.index={array:h,itemSize:1}),e.destroy(d),g}(t,r,s,a),n=e.attributes.map(e=>e.array.buffer);e.index&&n.push(e.index.array.buffer),self.postMessage({type:"decode",id:i.id,geometry:e},n)}catch(e){console.error(e),self.postMessage({type:"error",id:i.id,error:e.message})}finally{t.destroy(s),t.destroy(r)}})}}}let rw=function(e){let t=new Map,r=new Map,i=e.clone();return function e(t,r,i){i(t,r);for(let n=0;n<t.children.length;n++)e(t.children[n],r.children[n],i)}(e,i,function(e,i){t.set(i,e),r.set(e,i)}),i.traverse(function(e){if(!e.isSkinnedMesh)return;let i=t.get(e),n=i.skeleton.bones;e.skeleton=i.skeleton.clone(),e.bindMatrix.copy(i.bindMatrix),e.skeleton.bones=n.map(function(e){return r.get(e)}),e.bind(e.skeleton,e.bindMatrix)}),i},rR=o.forwardRef(({isChild:e=!1,object:t,children:r,deep:i,castShadow:n,receiveShadow:a,inject:l,keys:u,...h},d)=>{let c={keys:u,deep:i,inject:l,castShadow:n,receiveShadow:a};if(Array.isArray(t=o.useMemo(()=>
850{if(!1===e&&!Array.isArray(t)){let e=!1;if(t.traverse(t=>{t.isSkinnedMesh&&(e=!0)}),e)return rw(t)}return t},[t,e])))return o.createElement("group",s({},h,{ref:d}),t.map(e=>o.createElement(rR,s({key:e.uuid,object:e},c))),r);let{children:f,...m}=function(e,{keys:t=["near","far","color","distance","decay","penumbra","angle","intensity","skeleton","visible","castShadow","receiveShadow","morphTargetDictionary","morphTargetInfluences","name","geometry","material","position","rotation","scale","up","userData","bindMode","bindMatrix","bindMatrixInverse","skeleton"],deep:r,inject:i,castShadow:n,receiveShadow:a}){let s={};for(let r of t)s[r]=e[r];return r&&(s.geometry&&"materialsOnly"!==r&&(s.geometry=s.geometry.clone()),s.material&&"geometriesOnly"!==r&&(s.material=s.material.clone())),i&&(s="function"==typeof i?{...s,children:i(e)}:o.isValidElement(i)?{...s,children:i}:{...s,...i}),e instanceof p.Mesh&&(n&&(s.castShadow=!0),a&&(s.receiveShadow=!0)),s}(t,c),g=t.type[0].toLowerCase()+t.type.slice(1);return o.createElement(g,s({},m,h,{ref:d}),t.children.map(e=>"Bone"===e.type?o.createElement("primitive",s({key:e.uuid,object:e},c)):o.createElement(rR,s({key:e.uuid,object:e},c,{isChild:!0}))),r,f)}),rN=null,rL="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function rB(e=!0,t=!0,i){return n=>{i&&i(n),e&&(rN||(rN=new rE),rN.setDecoderPath("string"==typeof e?e:rL),n.setDRACOLoader(rN)),t&&n.setMeshoptDecoder((()=>{let e;if(r)return r;let t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),i=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if("object"!=typeof WebAssembly)return{supported:!1};let n="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9
850LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB";
850WebAssembly.validate(t)&&(n="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMG
850XAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB");let a=WebAssembly.instantiate(function(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;++r){let i=e.charCodeAt(r);t[r]=i>96?i-71:i>64?i-65:i>47?i+4:i>46?63:62}let r=0;for(let n=0;n<e.length;++n)t[r++]=t[n]<60?i[t[n]]:(t[n]-60)*64+t[++n];return t.buffer.slice(0,r)}(n),{}).then(t=>{(e=t.instance).exports.__wasm_call_ctors()});function s(t,r,i,n,a,s){let o=e.exports.sbrk,l=i+3&-4,u=o(l*n),h=o(a.length),d=new Uint8Array(e.exports.memory.buffer);d.set(a,h);let c=t(u,i,n,h,a.length);if(0===c&&s&&s(u,l,n),r.set(d.subarray(u,u+i*n)),o(u-o(0)),0!==c)throw Error(`Malformed buffer data: ${c}`)}let o={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},l={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return r={ready:a,supported:!0,decodeVertexBuffer(t,r,i,n,a){s(e.exports.meshopt_decodeVertexBuffer,t,r,i,n,e.exports[o[a]])},decodeIndexBuffer(t,r,i,n){s(e.exports.meshopt_decodeIndexBuffer,t,r,i,n)},decodeIndexSequence(t,r,i,n){s(e.exports.meshopt_decodeIndexSequence,t,r,i,n)},decodeGltfBuffer(t,r,i,n,a,u){s(e.exports[l[a]],t,r,i,n,e.exports[o[u]])}}})())}}let rI=(e,t,r,i)=>(0,y.useLoader)(tW,e,rB(t,r,i));rI.preload=(e,t,r,i)=>y.useLoader.preload(tW,e,rB(t,r,i)),rI.clear=e=>y.useLoader.clear(tW,e),rI.setDecoderPath=e=>{rL=e};var rP=e.i(11194);function rF({isActive:e}){let t=(0,rP.useReducedMotion)();return(0,i.jsx)("div",{className:`${n.default.scene} ${e?n.default.sceneVisible:""} ${t?n.default.sceneReducedMotion:""}`,children:(0,i.jsxs)(a.Canvas,{style:{pointerEvents:"none"}
850,children:[(0,i.jsx)(tU,{preset:"studio"}),(0,i.jsx)(tO,{makeDefault:!0,position:[0,0,2],zoom:70}),(0,i.jsx)(rD,{isActive:e,shouldReduceMotion:t})]})})}function rD({isActive:e,shouldReduceMotion:t}){let{invalidate:r}=(0,l.useThree)(),n=(0,o.useRef)(null),a=(0,o.useRef)(null),s=(0,o.useRef)(null),{nodes:h}=rI("/evervault.gltf"),d=(0,o.useRef)(0),c=(0,o.useRef)(0),p=(0,o.useRef)(0),f=(0,o.useRef)(0),m=(0,o.useRef)(0),g=(0,o.useRef)(0),v=(0,o.useRef)(!1),y=(0,o.useRef)(!1),_=t?1:.82,x=t?0:-.2;function b(){a.current&&(a.current.rotation.y=0),s.current&&(s.current.rotation.y=0),p.current=0,f.current=0,g.current=0}return(0,o.useEffect)(()=>{n.current&&(n.current.scale.setScalar(_),n.current.position.y=x),d.current=0,c.current=0,m.current=0,v.current=!1,y.current=!0,b(),r()},[_,x,r]),(0,u.useFrame)((i,o)=>{if(e&&!v.current&&(m.current=i.clock.getElapsedTime(),y.current=!1,b()),n.current){let i=e?1:_,a=e?0:x;if(t)n.current.scale.setScalar(i),n.current.position.y=a;else{let e=rO(n.current.scale.x,i,d,o,120,14),t=rO(n.current.position.y,a,c,o,90,12);n.current.scale.setScalar(e),n.current.position.y=t}let s=Math.abs(n.current.scale.x-i),l=Math.abs(n.current.position.y-a),u=s<.002&&l<.002&&.01>Math.abs(d.current)&&.01>Math.abs(c.current);if(e||!u||y.current||(y.current=!0,b()),!e){v.current=!1,u||r();return}}let l=(i.clock.getElapsedTime()-m.current)%2.5;if(l<g.current&&b(),g.current=l,a.current){let e=Math.PI/2;a.current.rotation.y=rO(a.current.rotation.y,e,p,o),l>=1.5&&(a.current.rotation.y=e,p.current=0)}if(s.current){let e=-Math.PI/2;s.current.rotation.y=rO(s.current.rotation.y,e,f,o),l>=1.5&&(s.current.rotation.y=e,f.current=0)}v.current=!0,r()}),(0,i.jsx)("group",{ref:n,children:(0,i.jsxs)("group",{rotation:[.4,.85,0],children:[(0,i.jsxs)("mesh",{ref:a,"position-y":.45,children:[(0,i.jsx)("bufferGeometry",{attach:"geometry",...h.logo.geometry}),(0,i.jsx)(rU,{})]}),(0,i.jsxs)("mesh",{ref:s,"position-y":-.45,children:[(0,i.jsx)("bufferGeometry",{attach:"geometry",...h.logo.geometry}),(0,i.jsx)(rU,{})]})]})})}function rU(){return(0,i.jsx)("meshPhysicalNodeMaterial",{roughness:0,metalness:.5,ior:5,color:"#6633ee"})}function rO(e,t,r,i,n=60,a=12){let s=r.current??0;return r.current=s+((t-e)*n+-s*a)*i,e+r.current*i*1.25}var rG=e.i(7187);function rk(){let[e,t]=(0,o.useState)(!1),[r,a]=(0,o.useState)(!1),s=(0,rP.useReducedMotion)();(0,o.useEffect)(()=>{let e=window.matchMedia("(max-width: 768px)"),t=()=>{a(e.matches)};return t(),e.addEventListener("change",t),()=>{e.removeEventListener("change",t)}},[]);let l=!r&&e;return(0,i.jsxs)(rG.motion.a,{href:"https://evervault.com",className:n.default.evervault,initial:!1,animate:l?"hover":"rest",onHoverStart:()=>!r&&t(!0),onHoverEnd:()=>t(!1),onFocus:()=>!r&&t(!0),onBlur:()=>t(!1),children:[(0,i.jsx)("span",{className:n.default.text,children:"Evervault"}),!r&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(rG.motion.span,{className:n.default.background,variants:s?{rest:{opacity:0,scale:1},hover:{opacity:1,scale:1}}:{rest:{opacity:0,scale:.5},hover:{opacity:1,scale:1}},transition:s?{duration:0}:{duration:.6,type:"spring",bounce:.4},style:{transformOrigin:"50% 50%"}}),(0,i.jsx)(rF,{isActive:l})]})]})}e.s(["Evervault",()=>rk],29501)},53864,e=>{e.v({measure:"styles-module__7xPBna__measure",output:"styles-module__7xPBna__output",revealedChar:"styles-module__7xPBna__revealedChar",root:"styles-module__7xPBna__root",trailChar:"styles-module__7xPBna__trailChar"})},48824,e=>{e.v({icon:"styles-module__ikr_dG__icon",item:"styles-module__ikr_dG__item",link:"styles-module__ikr_dG__link",srOnly:"styles-module__ikr_dG__srOnly"})},80757,e=>{"use strict";var t=e.i(98134),r=e.i(75201),i=e.i(11194),n=e.i(30312),a=e.i(53864);let s=1/30,o="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!?/%$#@&*+-",l=0;function u(e,t,r){return Math.min(Math.max(e,t),r)}function h({children:e,delay:h=0,duration:d=.5,className:c}){let p=(0,i.useReducedMotion)(),[f,m]=(0,r.useState)(0),[g]=(0,r.useState)(()=>l+=1),v=h+Math.max(d,0);(0,n.useAnimationFrame)(e=>{if(p)return;let t=Math.min(e/1e3,v);m(e=>e===t?e:t)});let{opacity:y,renderedChars:_}=(0,r.useMemo)(()=>
850{if(p)return{opacity:1,renderedChars:e.split("").map(e=>({char:e,kind:"revealed"}))};if(f<h)return{opacity:0,renderedChars:[]};let t=Math.max(0,f-h),r=d<=0?1:u(t/d,0,1),i=r>=1?e.length:Math.floor(r*e.length),n=Math.floor(t/s);return{opacity:u(t/.22,0,1),renderedChars:function(e,t,r,i){let n=[],a=Math.min(5,e.length-t);for(let r=0;r<t;r+=1)n.push({char:e[r]??"",kind:"revealed"});for(let s=0;s<a;s+=1){let a=t+s,l=e[a]??"";n.push({char:function(e,t,r,i){if(" "===e)return e;let n=0x811c9dc5;for(let a of[e.charCodeAt(0),t+1,r+1,i+1])n^=a,n=Math.imul(n,0x1000193);return o[(n>>>0)%o.length]??"A"}(l,a,r,i),kind:"trail"})}return n}(e,i,n,g)}},[e,h,d,f,g,p]);return(0,t.jsxs)("span",{"aria-hidden":"true",className:function(...e){return e.filter(Boolean).join(" ")}(a.default.root,c),children:[(0,t.jsx)("span",{className:a.default.measure,children:e}),(0,t.jsx)("span",{className:a.default.output,style:{opacity:y},children:_.map((e,r)=>(0,t.jsx)("span",{className:"revealed"===e.kind?a.default.revealedChar:a.default.trailChar,children:e.char},`${r}-${e.kind}-${e.char}`))})]})}var d=e.i(48824);function c({href:e,label:n,delay:a,duration:s=.5,children:o}){let l=(0,i.useReducedMotion)(),[u,c]=(0,r.useState)(0);return(0,t.jsx)("li",{className:d.default.item,children:(0,t.jsxs)("a",{target:"_blank",rel:"noopener noreferrer",className:d.default.link,href:e,onMouseEnter:()=>{l||c(e=>e+1)},children:[(0,t.jsx)("span",{"aria-hidden":"true",className:d.default.icon,children:o}),(0,t.jsx)("span",{className:d.default.srOnly,children:n}),(0,t.jsx)(h,{delay:0===u?a:0,duration:s,children:n},u)]})})}e.s(["default",()=>c],80757)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.