t3d-ez.gl 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/core/Addons/RaycasterAide.cjs.js +1 -0
  2. package/dist/core/Addons/RaycasterAide.esm.js +1 -0
  3. package/dist/core/Controls/TTControls/TTControls.cjs.js +1 -1
  4. package/dist/core/Controls/TTControls/TTControls.esm.js +1 -1
  5. package/dist/core/Map/index.cjs.js +1 -1
  6. package/dist/core/Map/index.esm.js +1 -1
  7. package/dist/core/Resource/loaders.cjs.js +1 -1
  8. package/dist/core/Resource/loaders.esm.js +1 -1
  9. package/dist/core/WebGLEngine/index.cjs.js +1 -1
  10. package/dist/core/WebGLEngine/index.esm.js +1 -1
  11. package/dist/helpers/AxesAddHelper.cjs.js +1 -0
  12. package/dist/helpers/AxesAddHelper.esm.js +1 -0
  13. package/dist/helpers/T3DEzViewportGizmo.cjs.js +1 -0
  14. package/dist/helpers/T3DEzViewportGizmo.esm.js +1 -0
  15. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.cjs.js +1 -1
  16. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.core.esm.js +1 -1
  17. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.cjs.js +1 -1
  18. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/build/three.module.esm.js +1 -1
  19. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/Line2.cjs.js +1 -0
  20. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/Line2.esm.js +1 -0
  21. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineGeometry.cjs.js +1 -0
  22. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineGeometry.esm.js +1 -0
  23. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineMaterial.cjs.js +1 -0
  24. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineMaterial.esm.js +1 -0
  25. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineSegments2.cjs.js +1 -0
  26. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineSegments2.esm.js +1 -0
  27. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineSegmentsGeometry.cjs.js +1 -0
  28. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/lines/LineSegmentsGeometry.esm.js +1 -0
  29. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/utils/BufferGeometryUtils.cjs.js +1 -1
  30. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/utils/BufferGeometryUtils.esm.js +1 -1
  31. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/src/math/MathUtils.cjs.js +1 -0
  32. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/src/math/MathUtils.esm.js +1 -0
  33. package/dist/package.json +1 -1
  34. package/dist/t3d-ez.gl.cjs.js +1 -1
  35. package/dist/t3d-ez.gl.esm.js +1 -1
  36. package/dist/types/core/Addons/RaycasterAide.d.ts +12 -0
  37. package/dist/types/core/Addons/index.d.ts +1 -0
  38. package/dist/types/core/PostProcessor/index.d.ts +3 -3
  39. package/dist/types/core/Resource/ResourceManager.d.ts +1 -1
  40. package/dist/types/core/Resource/loaders.d.ts +2 -2
  41. package/dist/types/core/index.d.ts +1 -1
  42. package/dist/types/helpers/AxesAddHelper.d.ts +6 -0
  43. package/dist/types/helpers/T3DEzViewportGizmo.d.ts +271 -0
  44. package/dist/types/helpers/index.d.ts +2 -0
  45. package/package.json +1 -1
  46. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/loaders/RGBELoader.cjs.js +0 -1
  47. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/loaders/RGBELoader.esm.js +0 -1
  48. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/physics/AmmoPhysics.cjs.js +0 -1
  49. package/dist/node_modules/.pnpm/three@0.182.0/node_modules/three/examples/jsm/physics/AmmoPhysics.esm.js +0 -1
  50. package/dist/types/core/Physics/index.d.ts +0 -1
  51. /package/dist/core/Map/{extrudeMap.cjs.js → ExtrudeMap.cjs.js} +0 -0
  52. /package/dist/core/Map/{extrudeMap.esm.js → ExtrudeMap.esm.js} +0 -0
  53. /package/dist/types/core/Map/{extrudeMap.d.ts → ExtrudeMap.d.ts} +0 -0
@@ -1 +1 @@
1
- const t="182",e={ROTATE:0,DOLLY:1,PAN:2},s={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},i=0,r=1,n=2,a=1,o=2,h=3,l=0,c=1,u=2,p=0,d=1,m=2,y=3,f=4,g=5,x=100,b=101,M=102,v=103,w=104,S=200,_=201,z=202,A=203,T=204,C=205,k=206,B=207,O=208,N=209,P=210,I=211,R=212,V=213,L=214,E=0,F=1,D=2,U=3,j=4,W=5,J=6,q=7,X=0,Y=1,Z=2,H=0,G=1,$=2,Q=3,K=4,tt=5,et=6,st=7,it="attached",rt="detached",nt=300,at=301,ot=302,ht=303,lt=304,ct=306,ut=1e3,pt=1001,dt=1002,mt=1003,yt=1004,ft=1005,gt=1006,xt=1007,bt=1008,Mt=1009,vt=1010,wt=1011,St=1012,_t=1013,zt=1014,At=1015,Tt=1016,Ct=1017,kt=1018,Bt=1020,Ot=35902,Nt=35899,Pt=1021,It=1022,Rt=1023,Vt=1026,Lt=1027,Et=1028,Ft=1029,Dt=1030,Ut=1031,jt=1033,Wt=33776,Jt=33777,qt=33778,Xt=33779,Yt=35840,Zt=35841,Ht=35842,Gt=35843,$t=36196,Qt=37492,Kt=37496,te=37488,ee=37489,se=37490,ie=37491,re=37808,ne=37809,ae=37810,oe=37811,he=37812,le=37813,ce=37814,ue=37815,pe=37816,de=37817,me=37818,ye=37819,fe=37820,ge=37821,xe=36492,be=36494,Me=36495,ve=36283,we=36284,Se=36285,_e=36286,ze=2300,Ae=2301,Te=2302,Ce=2400,ke=2401,Be=2402,Oe=2500,Ne=0,Pe=1,Ie=2,Re=3200,Ve=3201,Le=0,Ee=1,Fe="",De="srgb",Ue="srgb-linear",je="linear",We="srgb",Je=7680,qe=519,Xe=512,Ye=513,Ze=514,He=515,Ge=516,$e=517,Qe=518,Ke=519,ts=35044,es="300 es",ss=2e3,is=2001;function rs(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function ns(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function as(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function os(){const t=as("canvas");return t.style.display="block",t}const hs={};function ls(...t){t.shift()}function cs(...t){t.shift()}function us(...t){t.shift()}function ps(...t){const e=t.join(" ");e in hs||(hs[e]=!0,cs(...t))}function ds(t,e,s){return new Promise(function(i,r){setTimeout(function n(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(n,s);break;default:i()}},s)})}class ms{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const s=this._listeners;void 0===s[t]&&(s[t]=[]),-1===s[t].indexOf(e)&&s[t].push(e)}hasEventListener(t,e){const s=this._listeners;return void 0!==s&&(void 0!==s[t]&&-1!==s[t].indexOf(e))}removeEventListener(t,e){const s=this._listeners;if(void 0===s)return;const i=s[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const s=e[t.type];if(void 0!==s){t.target=this;const e=s.slice(0);for(let s=0,i=e.length;s<i;s++)e[s].call(this,t);t.target=null}}}const ys=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let fs=1234567;const gs=Math.PI/180,xs=180/Math.PI;function bs(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,s=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(ys[255&t]+ys[t>>8&255]+ys[t>>16&255]+ys[t>>24&255]+"-"+ys[255&e]+ys[e>>8&255]+"-"+ys[e>>16&15|64]+ys[e>>24&255]+"-"+ys[63&s|128]+ys[s>>8&255]+"-"+ys[s>>16&255]+ys[s>>24&255]+ys[255&i]+ys[i>>8&255]+ys[i>>16&255]+ys[i>>24&255]).toLowerCase()}function Ms(t,e,s){return Math.max(e,Math.min(s,t))}function vs(t,e){return(t%e+e)%e}function ws(t,e,s){return(1-s)*t+s*e}function Ss(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function _s(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const zs={DEG2RAD:gs,RAD2DEG:xs,generateUUID:bs,clamp:Ms,euclideanModulo:vs,mapLinear:function(t,e,s,i,r){return i+(t-e)*(r-i)/(s-e)},inverseLerp:function(t,e,s){return t!==e?(s-t)/(e-t):0},lerp:ws,damp:function(t,e,s,i){return ws(t,e,1-Math.exp(-s*i))},pingpong:function(t,e=1){return e-Math.abs(vs(t,2*e)-e)},smoothstep:function(t,e,s){return t<=e?0:t>=s?1:(t=(t-e)/(s-e))*t*(3-2*t)},smootherstep:function(t,e,s){return t<=e?0:t>=s?1:(t=(t-e)/(s-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(fs=t);let e=fs+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*gs},radToDeg:function(t){return t*xs},isPowerOfTwo:function(t){return!(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,s,i,r){const n=Math.cos,a=Math.sin,o=n(s/2),h=a(s/2),l=n((e+i)/2),c=a((e+i)/2),u=n((e-i)/2),p=a((e-i)/2),d=n((i-e)/2),m=a((i-e)/2);switch(r){case"XYX":t.set(o*c,h*u,h*p,o*l);break;case"YZY":t.set(h*p,o*c,h*u,o*l);break;case"ZXZ":t.set(h*u,h*p,o*c,o*l);break;case"XZX":t.set(o*c,h*m,h*d,o*l);break;case"YXY":t.set(h*d,o*c,h*m,o*l);break;case"ZYZ":t.set(h*m,h*d,o*c,o*l);break;default:cs("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:_s,denormalize:Ss};class As{constructor(t=0,e=0){As.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,s=this.y,i=t.elements;return this.x=i[0]*e+i[3]*s+i[6],this.y=i[1]*e+i[4]*s+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Ms(this.x,t.x,e.x),this.y=Ms(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=Ms(this.x,t,e),this.y=Ms(this.y,t,e),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Ms(s,t,e))}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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(Ms(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y;return e*e+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const s=Math.cos(e),i=Math.sin(e),r=this.x-t.x,n=this.y-t.y;return this.x=r*s-n*i+t.x,this.y=r*i+n*s+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ts{constructor(t=0,e=0,s=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=s,this._w=i}static slerpFlat(t,e,s,i,r,n,a){let o=s[i+0],h=s[i+1],l=s[i+2],c=s[i+3],u=r[n+0],p=r[n+1],d=r[n+2],m=r[n+3];if(a<=0)return t[e+0]=o,t[e+1]=h,t[e+2]=l,void(t[e+3]=c);if(a>=1)return t[e+0]=u,t[e+1]=p,t[e+2]=d,void(t[e+3]=m);if(c!==m||o!==u||h!==p||l!==d){let t=o*u+h*p+l*d+c*m;t<0&&(u=-u,p=-p,d=-d,m=-m,t=-t);let e=1-a;if(t<.9995){const s=Math.acos(t),i=Math.sin(s);e=Math.sin(e*s)/i,o=o*e+u*(a=Math.sin(a*s)/i),h=h*e+p*a,l=l*e+d*a,c=c*e+m*a}else{o=o*e+u*a,h=h*e+p*a,l=l*e+d*a,c=c*e+m*a;const t=1/Math.sqrt(o*o+h*h+l*l+c*c);o*=t,h*=t,l*=t,c*=t}}t[e]=o,t[e+1]=h,t[e+2]=l,t[e+3]=c}static multiplyQuaternionsFlat(t,e,s,i,r,n){const a=s[i],o=s[i+1],h=s[i+2],l=s[i+3],c=r[n],u=r[n+1],p=r[n+2],d=r[n+3];return t[e]=a*d+l*c+o*p-h*u,t[e+1]=o*d+l*u+h*c-a*p,t[e+2]=h*d+l*p+a*u-o*c,t[e+3]=l*d-a*c-o*u-h*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,s,i){return this._x=t,this._y=e,this._z=s,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const s=t._x,i=t._y,r=t._z,n=t._order,a=Math.cos,o=Math.sin,h=a(s/2),l=a(i/2),c=a(r/2),u=o(s/2),p=o(i/2),d=o(r/2);switch(n){case"XYZ":this._x=u*l*c+h*p*d,this._y=h*p*c-u*l*d,this._z=h*l*d+u*p*c,this._w=h*l*c-u*p*d;break;case"YXZ":this._x=u*l*c+h*p*d,this._y=h*p*c-u*l*d,this._z=h*l*d-u*p*c,this._w=h*l*c+u*p*d;break;case"ZXY":this._x=u*l*c-h*p*d,this._y=h*p*c+u*l*d,this._z=h*l*d+u*p*c,this._w=h*l*c-u*p*d;break;case"ZYX":this._x=u*l*c-h*p*d,this._y=h*p*c+u*l*d,this._z=h*l*d-u*p*c,this._w=h*l*c+u*p*d;break;case"YZX":this._x=u*l*c+h*p*d,this._y=h*p*c+u*l*d,this._z=h*l*d-u*p*c,this._w=h*l*c-u*p*d;break;case"XZY":this._x=u*l*c-h*p*d,this._y=h*p*c-u*l*d,this._z=h*l*d+u*p*c,this._w=h*l*c+u*p*d;break;default:cs("Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const s=e/2,i=Math.sin(s);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,s=e[0],i=e[4],r=e[8],n=e[1],a=e[5],o=e[9],h=e[2],l=e[6],c=e[10],u=s+a+c;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(l-o)*t,this._y=(r-h)*t,this._z=(n-i)*t}else if(s>a&&s>c){const t=2*Math.sqrt(1+s-a-c);this._w=(l-o)/t,this._x=.25*t,this._y=(i+n)/t,this._z=(r+h)/t}else if(a>c){const t=2*Math.sqrt(1+a-s-c);this._w=(r-h)/t,this._x=(i+n)/t,this._y=.25*t,this._z=(o+l)/t}else{const t=2*Math.sqrt(1+c-s-a);this._w=(n-i)/t,this._x=(r+h)/t,this._y=(o+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let s=t.dot(e)+1;return s<1e-8?(s=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=s):(this._x=0,this._y=-t.z,this._z=t.y,this._w=s)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=s),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Ms(this.dot(t),-1,1)))}rotateTowards(t,e){const s=this.angleTo(t);if(0===s)return this;const i=Math.min(1,e/s);return this.slerp(t,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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const s=t._x,i=t._y,r=t._z,n=t._w,a=e._x,o=e._y,h=e._z,l=e._w;return this._x=s*l+n*a+i*h-r*o,this._y=i*l+n*o+r*a-s*h,this._z=r*l+n*h+s*o-i*a,this._w=n*l-s*a-i*o-r*h,this._onChangeCallback(),this}slerp(t,e){if(e<=0)return this;if(e>=1)return this.copy(t);let s=t._x,i=t._y,r=t._z,n=t._w,a=this.dot(t);a<0&&(s=-s,i=-i,r=-r,n=-n,a=-a);let o=1-e;if(a<.9995){const t=Math.acos(a),h=Math.sin(t);o=Math.sin(o*t)/h,e=Math.sin(e*t)/h,this._x=this._x*o+s*e,this._y=this._y*o+i*e,this._z=this._z*o+r*e,this._w=this._w*o+n*e,this._onChangeCallback()}else this._x=this._x*o+s*e,this._y=this._y*o+i*e,this._z=this._z*o+r*e,this._w=this._w*o+n*e,this.normalize();return this}slerpQuaternions(t,e,s){return this.copy(t).slerp(e,s)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),s=Math.random(),i=Math.sqrt(1-s),r=Math.sqrt(s);return this.set(i*Math.sin(t),i*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Cs{constructor(t=0,e=0,s=0){Cs.prototype.isVector3=!0,this.x=t,this.y=e,this.z=s}set(t,e,s){return void 0===s&&(s=this.z),this.x=t,this.y=e,this.z=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Bs.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Bs.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,s=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*s+r[6]*i,this.y=r[1]*e+r[4]*s+r[7]*i,this.z=r[2]*e+r[5]*s+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,s=this.y,i=this.z,r=t.elements,n=1/(r[3]*e+r[7]*s+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*s+r[8]*i+r[12])*n,this.y=(r[1]*e+r[5]*s+r[9]*i+r[13])*n,this.z=(r[2]*e+r[6]*s+r[10]*i+r[14])*n,this}applyQuaternion(t){const e=this.x,s=this.y,i=this.z,r=t.x,n=t.y,a=t.z,o=t.w,h=2*(n*i-a*s),l=2*(a*e-r*i),c=2*(r*s-n*e);return this.x=e+o*h+n*c-a*l,this.y=s+o*l+a*h-r*c,this.z=i+o*c+r*l-n*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,s=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*s+r[8]*i,this.y=r[1]*e+r[5]*s+r[9]*i,this.z=r[2]*e+r[6]*s+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Ms(this.x,t.x,e.x),this.y=Ms(this.y,t.y,e.y),this.z=Ms(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=Ms(this.x,t,e),this.y=Ms(this.y,t,e),this.z=Ms(this.z,t,e),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Ms(s,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const s=t.x,i=t.y,r=t.z,n=e.x,a=e.y,o=e.z;return this.x=i*o-r*a,this.y=r*n-s*o,this.z=s*a-i*n,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const s=t.dot(this)/e;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return ks.copy(this).projectOnVector(t),this.sub(ks)}reflect(t){return this.sub(ks.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(Ms(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y,i=this.z-t.z;return e*e+s*s+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,s){const i=Math.sin(e)*t;return this.x=i*Math.sin(s),this.y=Math.cos(e)*t,this.z=i*Math.cos(s),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,s){return this.x=t*Math.sin(e),this.y=s,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),s=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=s,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,s=Math.sqrt(1-e*e);return this.x=s*Math.cos(t),this.y=e,this.z=s*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const ks=new Cs,Bs=new Ts;class Os{constructor(t,e,s,i,r,n,a,o,h){Os.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,s,i,r,n,a,o,h)}set(t,e,s,i,r,n,a,o,h){const l=this.elements;return l[0]=t,l[1]=i,l[2]=a,l[3]=e,l[4]=r,l[5]=o,l[6]=s,l[7]=n,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],this}extractBasis(t,e,s){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,i=e.elements,r=this.elements,n=s[0],a=s[3],o=s[6],h=s[1],l=s[4],c=s[7],u=s[2],p=s[5],d=s[8],m=i[0],y=i[3],f=i[6],g=i[1],x=i[4],b=i[7],M=i[2],v=i[5],w=i[8];return r[0]=n*m+a*g+o*M,r[3]=n*y+a*x+o*v,r[6]=n*f+a*b+o*w,r[1]=h*m+l*g+c*M,r[4]=h*y+l*x+c*v,r[7]=h*f+l*b+c*w,r[2]=u*m+p*g+d*M,r[5]=u*y+p*x+d*v,r[8]=u*f+p*b+d*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],s=t[1],i=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8];return e*n*l-e*a*h-s*r*l+s*a*o+i*r*h-i*n*o}invert(){const t=this.elements,e=t[0],s=t[1],i=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8],c=l*n-a*h,u=a*o-l*r,p=h*r-n*o,d=e*c+s*u+i*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return t[0]=c*m,t[1]=(i*h-l*s)*m,t[2]=(a*s-i*n)*m,t[3]=u*m,t[4]=(l*e-i*o)*m,t[5]=(i*r-a*e)*m,t[6]=p*m,t[7]=(s*o-h*e)*m,t[8]=(n*e-s*r)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,s,i,r,n,a){const o=Math.cos(r),h=Math.sin(r);return this.set(s*o,s*h,-s*(o*n+h*a)+n+t,-i*h,i*o,-i*(-h*n+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(Ns.makeScale(t,e)),this}rotate(t){return this.premultiply(Ns.makeRotation(-t)),this}translate(t,e){return this.premultiply(Ns.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,s,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,s=t.elements;for(let t=0;t<9;t++)if(e[t]!==s[t])return!1;return!0}fromArray(t,e=0){for(let s=0;s<9;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const Ns=new Os,Ps=(new Os).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Is=(new Os).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Rs(){const t={enabled:!0,workingColorSpace:Ue,spaces:{},convert:function(t,e,s){return!1!==this.enabled&&e!==s&&e&&s?(this.spaces[e].transfer===We&&(t.r=Ls(t.r),t.g=Ls(t.g),t.b=Ls(t.b)),this.spaces[e].primaries!==this.spaces[s].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[s].fromXYZ)),this.spaces[s].transfer===We&&(t.r=Es(t.r),t.g=Es(t.g),t.b=Es(t.b)),t):t},workingToColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},colorSpaceToWorking:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?je:this.spaces[t].transfer},getToneMappingMode:function(t){return this.spaces[t].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,s){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[s].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,s){return ps("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(e,s)},toWorkingColorSpace:function(e,s){return ps("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(e,s)}},e=[.64,.33,.3,.6,.15,.06],s=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[Ue]:{primaries:e,whitePoint:i,transfer:je,toXYZ:Ps,fromXYZ:Is,luminanceCoefficients:s,workingColorSpaceConfig:{unpackColorSpace:De},outputColorSpaceConfig:{drawingBufferColorSpace:De}},[De]:{primaries:e,whitePoint:i,transfer:We,toXYZ:Ps,fromXYZ:Is,luminanceCoefficients:s,outputColorSpaceConfig:{drawingBufferColorSpace:De}}}),t}const Vs=Rs();function Ls(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Es(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let Fs;class Ds{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let s;if(t instanceof HTMLCanvasElement)s=t;else{void 0===Fs&&(Fs=as("canvas")),Fs.width=t.width,Fs.height=t.height;const e=Fs.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),s=Fs}return s.toDataURL(e)}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=as("canvas");e.width=t.width,e.height=t.height;const s=e.getContext("2d");s.drawImage(t,0,0,t.width,t.height);const i=s.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t<r.length;t++)r[t]=255*Ls(r[t]/255);return s.putImageData(i,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*Ls(e[t]/255)):e[t]=Ls(e[t]);return{data:e,width:t.width,height:t.height}}return cs("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let Us=0;class js{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Us++}),this.uuid=bs(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){const e=this.data;return"undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?t.set(e.displayHeight,e.displayWidth,0):null!==e?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const s={uuid:this.uuid,url:""},i=this.data;if(null!==i){let t;if(Array.isArray(i)){t=[];for(let e=0,s=i.length;e<s;e++)i[e].isDataTexture?t.push(Ws(i[e].image)):t.push(Ws(i[e]))}else t=Ws(i);s.url=t}return e||(t.images[this.uuid]=s),s}}function Ws(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Ds.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(cs("Texture: Unable to serialize Texture."),{})}let Js=0;const qs=new Cs;class Xs extends ms{constructor(t=Xs.DEFAULT_IMAGE,e=Xs.DEFAULT_MAPPING,s=1001,i=1001,r=1006,n=1008,a=1023,o=1009,h=Xs.DEFAULT_ANISOTROPY,l=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Js++}),this.uuid=bs(),this.name="",this.source=new js(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=s,this.wrapT=i,this.magFilter=r,this.minFilter=n,this.anisotropy=h,this.format=a,this.internalFormat=null,this.type=o,this.offset=new As(0,0),this.repeat=new As(1,1),this.center=new As(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Os,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=l,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(qs).x}get height(){return this.source.getSize(qs).y}get depth(){return this.source.getSize(qs).z}get image(){return this.source.data}set image(t=null){this.source.data=t}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(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(const e in t){const s=t[e];if(void 0===s){cs(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&s&&i.isVector2&&s.isVector2||i&&s&&i.isVector3&&s.isVector3||i&&s&&i.isMatrix3&&s.isMatrix3?i.copy(s):this[e]=s:cs(`Texture.setValues(): property '${e}' does not exist.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const s={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).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&&(s.userData=this.userData),e||(t.textures[this.uuid]=s),s}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case ut:t.x=t.x-Math.floor(t.x);break;case pt:t.x=t.x<0?0:1;break;case dt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case ut:t.y=t.y-Math.floor(t.y);break;case pt:t.y=t.y<0?0:1;break;case dt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}Xs.DEFAULT_IMAGE=null,Xs.DEFAULT_MAPPING=300,Xs.DEFAULT_ANISOTROPY=1;class Ys{constructor(t=0,e=0,s=0,i=1){Ys.prototype.isVector4=!0,this.x=t,this.y=e,this.z=s,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,s,i){return this.x=t,this.y=e,this.z=s,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,s=this.y,i=this.z,r=this.w,n=t.elements;return this.x=n[0]*e+n[4]*s+n[8]*i+n[12]*r,this.y=n[1]*e+n[5]*s+n[9]*i+n[13]*r,this.z=n[2]*e+n[6]*s+n[10]*i+n[14]*r,this.w=n[3]*e+n[7]*s+n[11]*i+n[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,s,i,r;const n=.01,a=.1,o=t.elements,h=o[0],l=o[4],c=o[8],u=o[1],p=o[5],d=o[9],m=o[2],y=o[6],f=o[10];if(Math.abs(l-u)<n&&Math.abs(c-m)<n&&Math.abs(d-y)<n){if(Math.abs(l+u)<a&&Math.abs(c+m)<a&&Math.abs(d+y)<a&&Math.abs(h+p+f-3)<a)return this.set(1,0,0,0),this;e=Math.PI;const t=(h+1)/2,o=(p+1)/2,g=(f+1)/2,x=(l+u)/4,b=(c+m)/4,M=(d+y)/4;return t>o&&t>g?t<n?(s=0,i=.707106781,r=.707106781):(s=Math.sqrt(t),i=x/s,r=b/s):o>g?o<n?(s=.707106781,i=0,r=.707106781):(i=Math.sqrt(o),s=x/i,r=M/i):g<n?(s=.707106781,i=.707106781,r=0):(r=Math.sqrt(g),s=b/r,i=M/r),this.set(s,i,r,e),this}let g=Math.sqrt((y-d)*(y-d)+(c-m)*(c-m)+(u-l)*(u-l));return Math.abs(g)<.001&&(g=1),this.x=(y-d)/g,this.y=(c-m)/g,this.z=(u-l)/g,this.w=Math.acos((h+p+f-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Ms(this.x,t.x,e.x),this.y=Ms(this.y,t.y,e.y),this.z=Ms(this.z,t.z,e.z),this.w=Ms(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=Ms(this.x,t,e),this.y=Ms(this.y,t,e),this.z=Ms(this.z,t,e),this.w=Ms(this.w,t,e),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Ms(s,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this.w=t.w+(e.w-t.w)*s,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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 Zs extends ms{constructor(t=1,e=1,s={}){super(),s=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:gt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},s),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=s.depth,this.scissor=new Ys(0,0,t,e),this.scissorTest=!1,this.viewport=new Ys(0,0,t,e);const i={width:t,height:e,depth:s.depth},r=new Xs(i);this.textures=[];const n=s.count;for(let t=0;t<n;t++)this.textures[t]=r.clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;this._setTextureOptions(s),this.depthBuffer=s.depthBuffer,this.stencilBuffer=s.stencilBuffer,this.resolveDepthBuffer=s.resolveDepthBuffer,this.resolveStencilBuffer=s.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=s.depthTexture,this.samples=s.samples,this.multiview=s.multiview}_setTextureOptions(t={}){const e={minFilter:gt,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==t.mapping&&(e.mapping=t.mapping),void 0!==t.wrapS&&(e.wrapS=t.wrapS),void 0!==t.wrapT&&(e.wrapT=t.wrapT),void 0!==t.wrapR&&(e.wrapR=t.wrapR),void 0!==t.magFilter&&(e.magFilter=t.magFilter),void 0!==t.minFilter&&(e.minFilter=t.minFilter),void 0!==t.format&&(e.format=t.format),void 0!==t.type&&(e.type=t.type),void 0!==t.anisotropy&&(e.anisotropy=t.anisotropy),void 0!==t.colorSpace&&(e.colorSpace=t.colorSpace),void 0!==t.flipY&&(e.flipY=t.flipY),void 0!==t.generateMipmaps&&(e.generateMipmaps=t.generateMipmaps),void 0!==t.internalFormat&&(e.internalFormat=t.internalFormat);for(let t=0;t<this.textures.length;t++){this.textures[t].setValues(e)}}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==t&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,s=1){if(this.width!==t||this.height!==e||this.depth!==s){this.width=t,this.height=e,this.depth=s;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=t,this.textures[i].image.height=e,this.textures[i].image.depth=s,!0!==this.textures[i].isData3DTexture&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,s=t.textures.length;e<s;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const s=Object.assign({},t.textures[e].image);this.textures[e].source=new js(s)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Hs extends Zs{constructor(t=1,e=1,s={}){super(t,e,s),this.isWebGLRenderTarget=!0}}class Gs extends Xs{constructor(t=null,e=1,s=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:s,depth:i},this.magFilter=mt,this.minFilter=mt,this.wrapR=pt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class $s extends Xs{constructor(t=null,e=1,s=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:s,depth:i},this.magFilter=mt,this.minFilter=mt,this.wrapR=pt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Qs{constructor(t=new Cs(1/0,1/0,1/0),e=new Cs(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e+=3)this.expandByPoint(ti.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,s=t.count;e<s;e++)this.expandByPoint(ti.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const s=ti.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(s),this.max.copy(t).add(s),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const s=t.geometry;if(void 0!==s){const i=s.getAttribute("position");if(!0===e&&void 0!==i&&!0!==t.isInstancedMesh)for(let e=0,s=i.count;e<s;e++)!0===t.isMesh?t.getVertexPosition(e,ti):ti.fromBufferAttribute(i,e),ti.applyMatrix4(t.matrixWorld),this.expandByPoint(ti);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),ei.copy(t.boundingBox)):(null===s.boundingBox&&s.computeBoundingBox(),ei.copy(s.boundingBox)),ei.applyMatrix4(t.matrixWorld),this.union(ei)}const i=t.children;for(let t=0,s=i.length;t<s;t++)this.expandByObject(i[t],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,ti),ti.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,s;return t.normal.x>0?(e=t.normal.x*this.min.x,s=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,s=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,s+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,s+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,s+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,s+=t.normal.z*this.min.z),e<=-t.constant&&s>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(hi),li.subVectors(this.max,hi),si.subVectors(t.a,hi),ii.subVectors(t.b,hi),ri.subVectors(t.c,hi),ni.subVectors(ii,si),ai.subVectors(ri,ii),oi.subVectors(si,ri);let e=[0,-ni.z,ni.y,0,-ai.z,ai.y,0,-oi.z,oi.y,ni.z,0,-ni.x,ai.z,0,-ai.x,oi.z,0,-oi.x,-ni.y,ni.x,0,-ai.y,ai.x,0,-oi.y,oi.x,0];return!!pi(e,si,ii,ri,li)&&(e=[1,0,0,0,1,0,0,0,1],!!pi(e,si,ii,ri,li)&&(ci.crossVectors(ni,ai),e=[ci.x,ci.y,ci.z],pi(e,si,ii,ri,li)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ti).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(ti).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Ks[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ks[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ks[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ks[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ks[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ks[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ks[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ks[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ks)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}}const Ks=[new Cs,new Cs,new Cs,new Cs,new Cs,new Cs,new Cs,new Cs],ti=new Cs,ei=new Qs,si=new Cs,ii=new Cs,ri=new Cs,ni=new Cs,ai=new Cs,oi=new Cs,hi=new Cs,li=new Cs,ci=new Cs,ui=new Cs;function pi(t,e,s,i,r){for(let n=0,a=t.length-3;n<=a;n+=3){ui.fromArray(t,n);const a=r.x*Math.abs(ui.x)+r.y*Math.abs(ui.y)+r.z*Math.abs(ui.z),o=e.dot(ui),h=s.dot(ui),l=i.dot(ui);if(Math.max(-Math.max(o,h,l),Math.min(o,h,l))>a)return!1}return!0}const di=new Qs,mi=new Cs,yi=new Cs;class fi{constructor(t=new Cs,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const s=this.center;void 0!==e?s.copy(e):di.setFromPoints(t).getCenter(s);let i=0;for(let e=0,r=t.length;e<r;e++)i=Math.max(i,s.distanceToSquared(t[e]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const s=this.center.distanceToSquared(t);return e.copy(t),s>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;mi.subVectors(t,this.center);const e=mi.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),s=.5*(t-this.radius);this.center.addScaledVector(mi,s/t),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(yi.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(mi.copy(t.center).add(yi)),this.expandByPoint(mi.copy(t.center).sub(yi))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}}const gi=new Cs,xi=new Cs,bi=new Cs,Mi=new Cs,vi=new Cs,wi=new Cs,Si=new Cs;class _i{constructor(t=new Cs,e=new Cs(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,gi)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const s=e.dot(this.direction);return s<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,s)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=gi.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(gi.copy(this.origin).addScaledVector(this.direction,e),gi.distanceToSquared(t))}distanceSqToSegment(t,e,s,i){xi.copy(t).add(e).multiplyScalar(.5),bi.copy(e).sub(t).normalize(),Mi.copy(this.origin).sub(xi);const r=.5*t.distanceTo(e),n=-this.direction.dot(bi),a=Mi.dot(this.direction),o=-Mi.dot(bi),h=Mi.lengthSq(),l=Math.abs(1-n*n);let c,u,p,d;if(l>0)if(c=n*o-a,u=n*a-o,d=r*l,c>=0)if(u>=-d)if(u<=d){const t=1/l;c*=t,u*=t,p=c*(c+n*u+2*a)+u*(n*c+u+2*o)+h}else u=r,c=Math.max(0,-(n*u+a)),p=-c*c+u*(u+2*o)+h;else u=-r,c=Math.max(0,-(n*u+a)),p=-c*c+u*(u+2*o)+h;else u<=-d?(c=Math.max(0,-(-n*r+a)),u=c>0?-r:Math.min(Math.max(-r,-o),r),p=-c*c+u*(u+2*o)+h):u<=d?(c=0,u=Math.min(Math.max(-r,-o),r),p=u*(u+2*o)+h):(c=Math.max(0,-(n*r+a)),u=c>0?r:Math.min(Math.max(-r,-o),r),p=-c*c+u*(u+2*o)+h);else u=n>0?-r:r,c=Math.max(0,-(n*u+a)),p=-c*c+u*(u+2*o)+h;return s&&s.copy(this.origin).addScaledVector(this.direction,c),i&&i.copy(xi).addScaledVector(bi,u),p}intersectSphere(t,e){gi.subVectors(t.center,this.origin);const s=gi.dot(this.direction),i=gi.dot(gi)-s*s,r=t.radius*t.radius;if(i>r)return null;const n=Math.sqrt(r-i),a=s-n,o=s+n;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return!(t.radius<0)&&this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const s=-(this.origin.dot(t.normal)+t.constant)/e;return s>=0?s:null}intersectPlane(t,e){const s=this.distanceToPlane(t);return null===s?null:this.at(s,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let s,i,r,n,a,o;const h=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,u=this.origin;return h>=0?(s=(t.min.x-u.x)*h,i=(t.max.x-u.x)*h):(s=(t.max.x-u.x)*h,i=(t.min.x-u.x)*h),l>=0?(r=(t.min.y-u.y)*l,n=(t.max.y-u.y)*l):(r=(t.max.y-u.y)*l,n=(t.min.y-u.y)*l),s>n||r>i?null:((r>s||isNaN(s))&&(s=r),(n<i||isNaN(i))&&(i=n),c>=0?(a=(t.min.z-u.z)*c,o=(t.max.z-u.z)*c):(a=(t.max.z-u.z)*c,o=(t.min.z-u.z)*c),s>o||a>i?null:((a>s||s!=s)&&(s=a),(o<i||i!=i)&&(i=o),i<0?null:this.at(s>=0?s:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,gi)}intersectTriangle(t,e,s,i,r){vi.subVectors(e,t),wi.subVectors(s,t),Si.crossVectors(vi,wi);let n,a=this.direction.dot(Si);if(a>0){if(i)return null;n=1}else{if(!(a<0))return null;n=-1,a=-a}Mi.subVectors(this.origin,t);const o=n*this.direction.dot(wi.crossVectors(Mi,wi));if(o<0)return null;const h=n*this.direction.dot(vi.cross(Mi));if(h<0)return null;if(o+h>a)return null;const l=-n*Mi.dot(Si);return l<0?null:this.at(l/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class zi{constructor(t,e,s,i,r,n,a,o,h,l,c,u,p,d,m,y){zi.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,s,i,r,n,a,o,h,l,c,u,p,d,m,y)}set(t,e,s,i,r,n,a,o,h,l,c,u,p,d,m,y){const f=this.elements;return f[0]=t,f[4]=e,f[8]=s,f[12]=i,f[1]=r,f[5]=n,f[9]=a,f[13]=o,f[2]=h,f[6]=l,f[10]=c,f[14]=u,f[3]=p,f[7]=d,f[11]=m,f[15]=y,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 zi).fromArray(this.elements)}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],e[9]=s[9],e[10]=s[10],e[11]=s[11],e[12]=s[12],e[13]=s[13],e[14]=s[14],e[15]=s[15],this}copyPosition(t){const e=this.elements,s=t.elements;return e[12]=s[12],e[13]=s[13],e[14]=s[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,s){return 0===this.determinant()?(t.set(1,0,0),e.set(0,1,0),s.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this)}makeBasis(t,e,s){return this.set(t.x,e.x,s.x,0,t.y,e.y,s.y,0,t.z,e.z,s.z,0,0,0,0,1),this}extractRotation(t){if(0===t.determinant())return this.identity();const e=this.elements,s=t.elements,i=1/Ai.setFromMatrixColumn(t,0).length(),r=1/Ai.setFromMatrixColumn(t,1).length(),n=1/Ai.setFromMatrixColumn(t,2).length();return e[0]=s[0]*i,e[1]=s[1]*i,e[2]=s[2]*i,e[3]=0,e[4]=s[4]*r,e[5]=s[5]*r,e[6]=s[6]*r,e[7]=0,e[8]=s[8]*n,e[9]=s[9]*n,e[10]=s[10]*n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,s=t.x,i=t.y,r=t.z,n=Math.cos(s),a=Math.sin(s),o=Math.cos(i),h=Math.sin(i),l=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){const t=n*l,s=n*c,i=a*l,r=a*c;e[0]=o*l,e[4]=-o*c,e[8]=h,e[1]=s+i*h,e[5]=t-r*h,e[9]=-a*o,e[2]=r-t*h,e[6]=i+s*h,e[10]=n*o}else if("YXZ"===t.order){const t=o*l,s=o*c,i=h*l,r=h*c;e[0]=t+r*a,e[4]=i*a-s,e[8]=n*h,e[1]=n*c,e[5]=n*l,e[9]=-a,e[2]=s*a-i,e[6]=r+t*a,e[10]=n*o}else if("ZXY"===t.order){const t=o*l,s=o*c,i=h*l,r=h*c;e[0]=t-r*a,e[4]=-n*c,e[8]=i+s*a,e[1]=s+i*a,e[5]=n*l,e[9]=r-t*a,e[2]=-n*h,e[6]=a,e[10]=n*o}else if("ZYX"===t.order){const t=n*l,s=n*c,i=a*l,r=a*c;e[0]=o*l,e[4]=i*h-s,e[8]=t*h+r,e[1]=o*c,e[5]=r*h+t,e[9]=s*h-i,e[2]=-h,e[6]=a*o,e[10]=n*o}else if("YZX"===t.order){const t=n*o,s=n*h,i=a*o,r=a*h;e[0]=o*l,e[4]=r-t*c,e[8]=i*c+s,e[1]=c,e[5]=n*l,e[9]=-a*l,e[2]=-h*l,e[6]=s*c+i,e[10]=t-r*c}else if("XZY"===t.order){const t=n*o,s=n*h,i=a*o,r=a*h;e[0]=o*l,e[4]=-c,e[8]=h*l,e[1]=t*c+r,e[5]=n*l,e[9]=s*c-i,e[2]=i*c-s,e[6]=a*l,e[10]=r*c+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Ci,t,ki)}lookAt(t,e,s){const i=this.elements;return Ni.subVectors(t,e),0===Ni.lengthSq()&&(Ni.z=1),Ni.normalize(),Bi.crossVectors(s,Ni),0===Bi.lengthSq()&&(1===Math.abs(s.z)?Ni.x+=1e-4:Ni.z+=1e-4,Ni.normalize(),Bi.crossVectors(s,Ni)),Bi.normalize(),Oi.crossVectors(Ni,Bi),i[0]=Bi.x,i[4]=Oi.x,i[8]=Ni.x,i[1]=Bi.y,i[5]=Oi.y,i[9]=Ni.y,i[2]=Bi.z,i[6]=Oi.z,i[10]=Ni.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,i=e.elements,r=this.elements,n=s[0],a=s[4],o=s[8],h=s[12],l=s[1],c=s[5],u=s[9],p=s[13],d=s[2],m=s[6],y=s[10],f=s[14],g=s[3],x=s[7],b=s[11],M=s[15],v=i[0],w=i[4],S=i[8],_=i[12],z=i[1],A=i[5],T=i[9],C=i[13],k=i[2],B=i[6],O=i[10],N=i[14],P=i[3],I=i[7],R=i[11],V=i[15];return r[0]=n*v+a*z+o*k+h*P,r[4]=n*w+a*A+o*B+h*I,r[8]=n*S+a*T+o*O+h*R,r[12]=n*_+a*C+o*N+h*V,r[1]=l*v+c*z+u*k+p*P,r[5]=l*w+c*A+u*B+p*I,r[9]=l*S+c*T+u*O+p*R,r[13]=l*_+c*C+u*N+p*V,r[2]=d*v+m*z+y*k+f*P,r[6]=d*w+m*A+y*B+f*I,r[10]=d*S+m*T+y*O+f*R,r[14]=d*_+m*C+y*N+f*V,r[3]=g*v+x*z+b*k+M*P,r[7]=g*w+x*A+b*B+M*I,r[11]=g*S+x*T+b*O+M*R,r[15]=g*_+x*C+b*N+M*V,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],s=t[4],i=t[8],r=t[12],n=t[1],a=t[5],o=t[9],h=t[13],l=t[2],c=t[6],u=t[10],p=t[14],d=t[3],m=t[7],y=t[11],f=t[15],g=o*p-h*u,x=a*p-h*c,b=a*u-o*c,M=n*p-h*l,v=n*u-o*l,w=n*c-a*l;return e*(m*g-y*x+f*b)-s*(d*g-y*M+f*v)+i*(d*x-m*M+f*w)-r*(d*b-m*v+y*w)}transpose(){const t=this.elements;let e;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(t,e,s){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=s),this}invert(){const t=this.elements,e=t[0],s=t[1],i=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8],c=t[9],u=t[10],p=t[11],d=t[12],m=t[13],y=t[14],f=t[15],g=c*y*h-m*u*h+m*o*p-a*y*p-c*o*f+a*u*f,x=d*u*h-l*y*h-d*o*p+n*y*p+l*o*f-n*u*f,b=l*m*h-d*c*h+d*a*p-n*m*p-l*a*f+n*c*f,M=d*c*o-l*m*o-d*a*u+n*m*u+l*a*y-n*c*y,v=e*g+s*x+i*b+r*M;if(0===v)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/v;return t[0]=g*w,t[1]=(m*u*r-c*y*r-m*i*p+s*y*p+c*i*f-s*u*f)*w,t[2]=(a*y*r-m*o*r+m*i*h-s*y*h-a*i*f+s*o*f)*w,t[3]=(c*o*r-a*u*r-c*i*h+s*u*h+a*i*p-s*o*p)*w,t[4]=x*w,t[5]=(l*y*r-d*u*r+d*i*p-e*y*p-l*i*f+e*u*f)*w,t[6]=(d*o*r-n*y*r-d*i*h+e*y*h+n*i*f-e*o*f)*w,t[7]=(n*u*r-l*o*r+l*i*h-e*u*h-n*i*p+e*o*p)*w,t[8]=b*w,t[9]=(d*c*r-l*m*r-d*s*p+e*m*p+l*s*f-e*c*f)*w,t[10]=(n*m*r-d*a*r+d*s*h-e*m*h-n*s*f+e*a*f)*w,t[11]=(l*a*r-n*c*r-l*s*h+e*c*h+n*s*p-e*a*p)*w,t[12]=M*w,t[13]=(l*m*i-d*c*i+d*s*u-e*m*u-l*s*y+e*c*y)*w,t[14]=(d*a*i-n*m*i-d*s*o+e*m*o+n*s*y-e*a*y)*w,t[15]=(n*c*i-l*a*i+l*s*o-e*c*o-n*s*u+e*a*u)*w,this}scale(t){const e=this.elements,s=t.x,i=t.y,r=t.z;return e[0]*=s,e[4]*=i,e[8]*=r,e[1]*=s,e[5]*=i,e[9]*=r,e[2]*=s,e[6]*=i,e[10]*=r,e[3]*=s,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],s=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,s,i))}makeTranslation(t,e,s){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,s,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),s=Math.sin(t);return this.set(1,0,0,0,0,e,-s,0,0,s,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,0,s,0,0,1,0,0,-s,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,0,s,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const s=Math.cos(e),i=Math.sin(e),r=1-s,n=t.x,a=t.y,o=t.z,h=r*n,l=r*a;return this.set(h*n+s,h*a-i*o,h*o+i*a,0,h*a+i*o,l*a+s,l*o-i*n,0,h*o-i*a,l*o+i*n,r*o*o+s,0,0,0,0,1),this}makeScale(t,e,s){return this.set(t,0,0,0,0,e,0,0,0,0,s,0,0,0,0,1),this}makeShear(t,e,s,i,r,n){return this.set(1,s,r,0,t,1,n,0,e,i,1,0,0,0,0,1),this}compose(t,e,s){const i=this.elements,r=e._x,n=e._y,a=e._z,o=e._w,h=r+r,l=n+n,c=a+a,u=r*h,p=r*l,d=r*c,m=n*l,y=n*c,f=a*c,g=o*h,x=o*l,b=o*c,M=s.x,v=s.y,w=s.z;return i[0]=(1-(m+f))*M,i[1]=(p+b)*M,i[2]=(d-x)*M,i[3]=0,i[4]=(p-b)*v,i[5]=(1-(u+f))*v,i[6]=(y+g)*v,i[7]=0,i[8]=(d+x)*w,i[9]=(y-g)*w,i[10]=(1-(u+m))*w,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,s){const i=this.elements;if(t.x=i[12],t.y=i[13],t.z=i[14],0===this.determinant())return s.set(1,1,1),e.identity(),this;let r=Ai.set(i[0],i[1],i[2]).length();const n=Ai.set(i[4],i[5],i[6]).length(),a=Ai.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),Ti.copy(this);const o=1/r,h=1/n,l=1/a;return Ti.elements[0]*=o,Ti.elements[1]*=o,Ti.elements[2]*=o,Ti.elements[4]*=h,Ti.elements[5]*=h,Ti.elements[6]*=h,Ti.elements[8]*=l,Ti.elements[9]*=l,Ti.elements[10]*=l,e.setFromRotationMatrix(Ti),s.x=r,s.y=n,s.z=a,this}makePerspective(t,e,s,i,r,n,a=2e3,o=!1){const h=this.elements,l=2*r/(e-t),c=2*r/(s-i),u=(e+t)/(e-t),p=(s+i)/(s-i);let d,m;if(o)d=r/(n-r),m=n*r/(n-r);else if(a===ss)d=-(n+r)/(n-r),m=-2*n*r/(n-r);else{if(a!==is)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);d=-n/(n-r),m=-n*r/(n-r)}return h[0]=l,h[4]=0,h[8]=u,h[12]=0,h[1]=0,h[5]=c,h[9]=p,h[13]=0,h[2]=0,h[6]=0,h[10]=d,h[14]=m,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(t,e,s,i,r,n,a=2e3,o=!1){const h=this.elements,l=2/(e-t),c=2/(s-i),u=-(e+t)/(e-t),p=-(s+i)/(s-i);let d,m;if(o)d=1/(n-r),m=n/(n-r);else if(a===ss)d=-2/(n-r),m=-(n+r)/(n-r);else{if(a!==is)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);d=-1/(n-r),m=-r/(n-r)}return h[0]=l,h[4]=0,h[8]=0,h[12]=u,h[1]=0,h[5]=c,h[9]=0,h[13]=p,h[2]=0,h[6]=0,h[10]=d,h[14]=m,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(t){const e=this.elements,s=t.elements;for(let t=0;t<16;t++)if(e[t]!==s[t])return!1;return!0}fromArray(t,e=0){for(let s=0;s<16;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t[e+9]=s[9],t[e+10]=s[10],t[e+11]=s[11],t[e+12]=s[12],t[e+13]=s[13],t[e+14]=s[14],t[e+15]=s[15],t}}const Ai=new Cs,Ti=new zi,Ci=new Cs(0,0,0),ki=new Cs(1,1,1),Bi=new Cs,Oi=new Cs,Ni=new Cs,Pi=new zi,Ii=new Ts;class Ri{constructor(t=0,e=0,s=0,i=Ri.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=s,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,s,i=this._order){return this._x=t,this._y=e,this._z=s,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,s=!0){const i=t.elements,r=i[0],n=i[4],a=i[8],o=i[1],h=i[5],l=i[9],c=i[2],u=i[6],p=i[10];switch(e){case"XYZ":this._y=Math.asin(Ms(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,p),this._z=Math.atan2(-n,r)):(this._x=Math.atan2(u,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Ms(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(o,h)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(Ms(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-c,p),this._z=Math.atan2(-n,h)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-Ms(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(u,p),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-n,h));break;case"YZX":this._z=Math.asin(Ms(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-Ms(n,-1,1)),Math.abs(n)<.9999999?(this._x=Math.atan2(u,h),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-l,p),this._y=0);break;default:cs("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===s&&this._onChangeCallback(),this}setFromQuaternion(t,e,s){return Pi.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Pi,e,s)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Ii.setFromEuler(this),this.setFromQuaternion(Ii,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Ri.DEFAULT_ORDER="XYZ";class Vi{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return 0!==(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let Li=0;const Ei=new Cs,Fi=new Ts,Di=new zi,Ui=new Cs,ji=new Cs,Wi=new Cs,Ji=new Ts,qi=new Cs(1,0,0),Xi=new Cs(0,1,0),Yi=new Cs(0,0,1),Zi={type:"added"},Hi={type:"removed"},Gi={type:"childadded",child:null},$i={type:"childremoved",child:null};class Qi extends ms{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Li++}),this.uuid=bs(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Qi.DEFAULT_UP.clone();const t=new Cs,e=new Ri,s=new Ts,i=new Cs(1,1,1);e._onChange(function(){s.setFromEuler(e,!1)}),s._onChange(function(){e.setFromQuaternion(s,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:s},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new zi},normalMatrix:{value:new Os}}),this.matrix=new zi,this.matrixWorld=new zi,this.matrixAutoUpdate=Qi.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Qi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Vi,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.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Fi.setFromAxisAngle(t,e),this.quaternion.multiply(Fi),this}rotateOnWorldAxis(t,e){return Fi.setFromAxisAngle(t,e),this.quaternion.premultiply(Fi),this}rotateX(t){return this.rotateOnAxis(qi,t)}rotateY(t){return this.rotateOnAxis(Xi,t)}rotateZ(t){return this.rotateOnAxis(Yi,t)}translateOnAxis(t,e){return Ei.copy(t).applyQuaternion(this.quaternion),this.position.add(Ei.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(qi,t)}translateY(t){return this.translateOnAxis(Xi,t)}translateZ(t){return this.translateOnAxis(Yi,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Di.copy(this.matrixWorld).invert())}lookAt(t,e,s){t.isVector3?Ui.copy(t):Ui.set(t,e,s);const i=this.parent;this.updateWorldMatrix(!0,!1),ji.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Di.lookAt(ji,Ui,this.up):Di.lookAt(Ui,ji,this.up),this.quaternion.setFromRotationMatrix(Di),i&&(Di.extractRotation(i.matrixWorld),Fi.setFromRotationMatrix(Di),this.quaternion.premultiply(Fi.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(us("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Zi),Gi.child=t,this.dispatchEvent(Gi),Gi.child=null):us("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Hi),$i.child=t,this.dispatchEvent($i),$i.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Di.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Di.multiply(t.parent.matrixWorld)),t.applyMatrix4(Di),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Zi),Gi.child=t,this.dispatchEvent(Gi),Gi.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let s=0,i=this.children.length;s<i;s++){const i=this.children[s].getObjectByProperty(t,e);if(void 0!==i)return i}}getObjectsByProperty(t,e,s=[]){this[t]===e&&s.push(this);const i=this.children;for(let r=0,n=i.length;r<n;r++)i[r].getObjectsByProperty(t,e,s);return s}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ji,t,Wi),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ji,Ji,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let s=0,i=e.length;s<i;s++)e[s].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let s=0,i=e.length;s<i;s++)e[s].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let s=0,i=e.length;s<i;s++){e[s].updateMatrixWorld(t)}}updateWorldMatrix(t,e){const s=this.parent;if(!0===t&&null!==s&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,s=t.length;e<s;e++){t[e].updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"==typeof t,s={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},s.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};function r(e,s){return void 0===e[s.uuid]&&(e[s.uuid]=s.toJSON(t)),s.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),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(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),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(t=>({...t,boundingBox:t.boundingBox?t.boundingBox.toJSON():void 0,boundingSphere:t.boundingSphere?t.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(t=>({...t})),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(t),i.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(t)),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(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const s=e.shapes;if(Array.isArray(s))for(let e=0,i=s.length;e<i;e++){const i=s[e];r(t.shapes,i)}else r(t.shapes,s)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let s=0,i=this.material.length;s<i;s++)e.push(r(t.materials,this.material[s]));i.material=e}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let e=0;e<this.children.length;e++)i.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let e=0;e<this.animations.length;e++){const s=this.animations[e];i.animations.push(r(t.animations,s))}}if(e){const e=n(t.geometries),i=n(t.materials),r=n(t.textures),a=n(t.images),o=n(t.shapes),h=n(t.skeletons),l=n(t.animations),c=n(t.nodes);e.length>0&&(s.geometries=e),i.length>0&&(s.materials=i),r.length>0&&(s.textures=r),a.length>0&&(s.images=a),o.length>0&&(s.shapes=o),h.length>0&&(s.skeletons=h),l.length>0&&(s.animations=l),c.length>0&&(s.nodes=c)}return s.object=i,s;function n(t){const e=[];for(const s in t){const i=t[s];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const s=t.children[e];this.add(s.clone())}return this}}Qi.DEFAULT_UP=new Cs(0,1,0),Qi.DEFAULT_MATRIX_AUTO_UPDATE=!0,Qi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ki=new Cs,tr=new Cs,er=new Cs,sr=new Cs,ir=new Cs,rr=new Cs,nr=new Cs,ar=new Cs,or=new Cs,hr=new Cs,lr=new Ys,cr=new Ys,ur=new Ys;class pr{constructor(t=new Cs,e=new Cs,s=new Cs){this.a=t,this.b=e,this.c=s}static getNormal(t,e,s,i){i.subVectors(s,e),Ki.subVectors(t,e),i.cross(Ki);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,s,i,r){Ki.subVectors(i,e),tr.subVectors(s,e),er.subVectors(t,e);const n=Ki.dot(Ki),a=Ki.dot(tr),o=Ki.dot(er),h=tr.dot(tr),l=tr.dot(er),c=n*h-a*a;if(0===c)return r.set(0,0,0),null;const u=1/c,p=(h*o-a*l)*u,d=(n*l-a*o)*u;return r.set(1-p-d,d,p)}static containsPoint(t,e,s,i){return null!==this.getBarycoord(t,e,s,i,sr)&&(sr.x>=0&&sr.y>=0&&sr.x+sr.y<=1)}static getInterpolation(t,e,s,i,r,n,a,o){return null===this.getBarycoord(t,e,s,i,sr)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,sr.x),o.addScaledVector(n,sr.y),o.addScaledVector(a,sr.z),o)}static getInterpolatedAttribute(t,e,s,i,r,n){return lr.setScalar(0),cr.setScalar(0),ur.setScalar(0),lr.fromBufferAttribute(t,e),cr.fromBufferAttribute(t,s),ur.fromBufferAttribute(t,i),n.setScalar(0),n.addScaledVector(lr,r.x),n.addScaledVector(cr,r.y),n.addScaledVector(ur,r.z),n}static isFrontFacing(t,e,s,i){return Ki.subVectors(s,e),tr.subVectors(t,e),Ki.cross(tr).dot(i)<0}set(t,e,s){return this.a.copy(t),this.b.copy(e),this.c.copy(s),this}setFromPointsAndIndices(t,e,s,i){return this.a.copy(t[e]),this.b.copy(t[s]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,s,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,s),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Ki.subVectors(this.c,this.b),tr.subVectors(this.a,this.b),.5*Ki.cross(tr).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return pr.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return pr.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,s,i,r){return pr.getInterpolation(t,this.a,this.b,this.c,e,s,i,r)}containsPoint(t){return pr.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return pr.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const s=this.a,i=this.b,r=this.c;let n,a;ir.subVectors(i,s),rr.subVectors(r,s),ar.subVectors(t,s);const o=ir.dot(ar),h=rr.dot(ar);if(o<=0&&h<=0)return e.copy(s);or.subVectors(t,i);const l=ir.dot(or),c=rr.dot(or);if(l>=0&&c<=l)return e.copy(i);const u=o*c-l*h;if(u<=0&&o>=0&&l<=0)return n=o/(o-l),e.copy(s).addScaledVector(ir,n);hr.subVectors(t,r);const p=ir.dot(hr),d=rr.dot(hr);if(d>=0&&p<=d)return e.copy(r);const m=p*h-o*d;if(m<=0&&h>=0&&d<=0)return a=h/(h-d),e.copy(s).addScaledVector(rr,a);const y=l*d-p*c;if(y<=0&&c-l>=0&&p-d>=0)return nr.subVectors(r,i),a=(c-l)/(c-l+(p-d)),e.copy(i).addScaledVector(nr,a);const f=1/(y+m+u);return n=m*f,a=u*f,e.copy(s).addScaledVector(ir,n).addScaledVector(rr,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const dr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},mr={h:0,s:0,l:0},yr={h:0,s:0,l:0};function fr(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+6*(e-t)*(2/3-s):t}class gr{constructor(t,e,s){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,s)}set(t,e,s){if(void 0===e&&void 0===s){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,s);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=De){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Vs.colorSpaceToWorking(this,e),this}setRGB(t,e,s,i=Vs.workingColorSpace){return this.r=t,this.g=e,this.b=s,Vs.colorSpaceToWorking(this,i),this}setHSL(t,e,s,i=Vs.workingColorSpace){if(t=vs(t,1),e=Ms(e,0,1),s=Ms(s,0,1),0===e)this.r=this.g=this.b=s;else{const i=s<=.5?s*(1+e):s+e-s*e,r=2*s-i;this.r=fr(r,i,t+1/3),this.g=fr(r,i,t),this.b=fr(r,i,t-1/3)}return Vs.colorSpaceToWorking(this,i),this}setStyle(t,e=De){function s(e){void 0!==e&&parseFloat(e)<1&&cs("Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const n=i[1],a=i[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:cs("Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const s=i[1],r=s.length;if(3===r)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(s,16),e);cs("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=De){const s=dr[t.toLowerCase()];return void 0!==s?this.setHex(s,e):cs("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Ls(t.r),this.g=Ls(t.g),this.b=Ls(t.b),this}copyLinearToSRGB(t){return this.r=Es(t.r),this.g=Es(t.g),this.b=Es(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=De){return Vs.workingToColorSpace(xr.copy(this),t),65536*Math.round(Ms(255*xr.r,0,255))+256*Math.round(Ms(255*xr.g,0,255))+Math.round(Ms(255*xr.b,0,255))}getHexString(t=De){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Vs.workingColorSpace){Vs.workingToColorSpace(xr.copy(this),e);const s=xr.r,i=xr.g,r=xr.b,n=Math.max(s,i,r),a=Math.min(s,i,r);let o,h;const l=(a+n)/2;if(a===n)o=0,h=0;else{const t=n-a;switch(h=l<=.5?t/(n+a):t/(2-n-a),n){case s:o=(i-r)/t+(i<r?6:0);break;case i:o=(r-s)/t+2;break;case r:o=(s-i)/t+4}o/=6}return t.h=o,t.s=h,t.l=l,t}getRGB(t,e=Vs.workingColorSpace){return Vs.workingToColorSpace(xr.copy(this),e),t.r=xr.r,t.g=xr.g,t.b=xr.b,t}getStyle(t=De){Vs.workingToColorSpace(xr.copy(this),t);const e=xr.r,s=xr.g,i=xr.b;return t!==De?`color(${t} ${e.toFixed(3)} ${s.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*s)},${Math.round(255*i)})`}offsetHSL(t,e,s){return this.getHSL(mr),this.setHSL(mr.h+t,mr.s+e,mr.l+s)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,s){return this.r=t.r+(e.r-t.r)*s,this.g=t.g+(e.g-t.g)*s,this.b=t.b+(e.b-t.b)*s,this}lerpHSL(t,e){this.getHSL(mr),t.getHSL(yr);const s=ws(mr.h,yr.h,e),i=ws(mr.s,yr.s,e),r=ws(mr.l,yr.l,e);return this.setHSL(s,i,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,s=this.g,i=this.b,r=t.elements;return this.r=r[0]*e+r[3]*s+r[6]*i,this.g=r[1]*e+r[4]*s+r[7]*i,this.b=r[2]*e+r[5]*s+r[8]*i,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const xr=new gr;gr.NAMES=dr;let br=0;class Mr extends ms{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:br++}),this.uuid=bs(),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 gr(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=Je,this.stencilZFail=Je,this.stencilZPass=Je,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(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const s=t[e];if(void 0===s){cs(`Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(s):i&&i.isVector3&&s&&s.isVector3?i.copy(s):this[e]=s:cs(`Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const s={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const s in t){const i=t[s];delete i.metadata,e.push(i)}return e}if(s.uuid=this.uuid,s.type=this.type,""!==this.name&&(s.name=this.name),this.color&&this.color.isColor&&(s.color=this.color.getHex()),void 0!==this.roughness&&(s.roughness=this.roughness),void 0!==this.metalness&&(s.metalness=this.metalness),void 0!==this.sheen&&(s.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(s.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(s.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(s.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(s.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(s.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(s.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(s.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(s.shininess=this.shininess),void 0!==this.clearcoat&&(s.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(s.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(s.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(s.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(s.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,s.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(s.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(s.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),void 0!==this.dispersion&&(s.dispersion=this.dispersion),void 0!==this.iridescence&&(s.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(s.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(s.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(s.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(s.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(s.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(s.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(s.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(s.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(s.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(s.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(s.lightMap=this.lightMap.toJSON(t).uuid,s.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(s.aoMap=this.aoMap.toJSON(t).uuid,s.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(s.bumpMap=this.bumpMap.toJSON(t).uuid,s.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(s.normalMap=this.normalMap.toJSON(t).uuid,s.normalMapType=this.normalMapType,s.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(s.displacementMap=this.displacementMap.toJSON(t).uuid,s.displacementScale=this.displacementScale,s.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(s.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(s.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(s.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(s.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(s.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(s.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(s.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(s.combine=this.combine)),void 0!==this.envMapRotation&&(s.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(s.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(s.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(s.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(s.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(s.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(s.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(s.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(s.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(s.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(s.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(s.size=this.size),null!==this.shadowSide&&(s.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(s.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(s.blending=this.blending),0!==this.side&&(s.side=this.side),!0===this.vertexColors&&(s.vertexColors=!0),this.opacity<1&&(s.opacity=this.opacity),!0===this.transparent&&(s.transparent=!0),204!==this.blendSrc&&(s.blendSrc=this.blendSrc),205!==this.blendDst&&(s.blendDst=this.blendDst),100!==this.blendEquation&&(s.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(s.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(s.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(s.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(s.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(s.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(s.depthFunc=this.depthFunc),!1===this.depthTest&&(s.depthTest=this.depthTest),!1===this.depthWrite&&(s.depthWrite=this.depthWrite),!1===this.colorWrite&&(s.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(s.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(s.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(s.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(s.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Je&&(s.stencilFail=this.stencilFail),this.stencilZFail!==Je&&(s.stencilZFail=this.stencilZFail),this.stencilZPass!==Je&&(s.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(s.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(s.rotation=this.rotation),!0===this.polygonOffset&&(s.polygonOffset=!0),0!==this.polygonOffsetFactor&&(s.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(s.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(s.linewidth=this.linewidth),void 0!==this.dashSize&&(s.dashSize=this.dashSize),void 0!==this.gapSize&&(s.gapSize=this.gapSize),void 0!==this.scale&&(s.scale=this.scale),!0===this.dithering&&(s.dithering=!0),this.alphaTest>0&&(s.alphaTest=this.alphaTest),!0===this.alphaHash&&(s.alphaHash=!0),!0===this.alphaToCoverage&&(s.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(s.premultipliedAlpha=!0),!0===this.forceSinglePass&&(s.forceSinglePass=!0),!1===this.allowOverride&&(s.allowOverride=!1),!0===this.wireframe&&(s.wireframe=!0),this.wireframeLinewidth>1&&(s.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(s.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(s.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(s.flatShading=!0),!1===this.visible&&(s.visible=!1),!1===this.toneMapped&&(s.toneMapped=!1),!1===this.fog&&(s.fog=!1),Object.keys(this.userData).length>0&&(s.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(s.textures=e),r.length>0&&(s.images=r)}return s}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let s=null;if(null!==e){const t=e.length;s=new Array(t);for(let i=0;i!==t;++i)s[i]=e[i].clone()}return this.clippingPlanes=s,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class vr extends Mr{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new gr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ri,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const wr=Sr();function Sr(){const t=new ArrayBuffer(4),e=new Float32Array(t),s=new Uint32Array(t),i=new Uint32Array(512),r=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(i[t]=0,i[256|t]=32768,r[t]=24,r[256|t]=24):e<-14?(i[t]=1024>>-e-14,i[256|t]=1024>>-e-14|32768,r[t]=-e-1,r[256|t]=-e-1):e<=15?(i[t]=e+15<<10,i[256|t]=e+15<<10|32768,r[t]=13,r[256|t]=13):e<128?(i[t]=31744,i[256|t]=64512,r[t]=24,r[256|t]=24):(i[t]=31744,i[256|t]=64512,r[t]=13,r[256|t]=13)}const n=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,s=0;for(;!(8388608&e);)e<<=1,s-=8388608;e&=-8388609,s+=947912704,n[t]=e|s}for(let t=1024;t<2048;++t)n[t]=939524096+(t-1024<<13);for(let t=1;t<31;++t)a[t]=t<<23;a[31]=1199570944,a[32]=2147483648;for(let t=33;t<63;++t)a[t]=2147483648+(t-32<<23);a[63]=3347054592;for(let t=1;t<64;++t)32!==t&&(o[t]=1024);return{floatView:e,uint32View:s,baseTable:i,shiftTable:r,mantissaTable:n,exponentTable:a,offsetTable:o}}class _r{static toHalfFloat(t){return function(t){Math.abs(t)>65504&&cs("DataUtils.toHalfFloat(): Value out of range."),t=Ms(t,-65504,65504),wr.floatView[0]=t;const e=wr.uint32View[0],s=e>>23&511;return wr.baseTable[s]+((8388607&e)>>wr.shiftTable[s])}(t)}static fromHalfFloat(t){return function(t){const e=t>>10;return wr.uint32View[0]=wr.mantissaTable[wr.offsetTable[e]+(1023&t)]+wr.exponentTable[e],wr.floatView[0]}(t)}}const zr=new Cs,Ar=new As;let Tr=0;class Cr{constructor(t,e,s=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Tr++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=s,this.usage=ts,this.updateRanges=[],this.gpuType=At,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,s){t*=this.itemSize,s*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[s+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,s=this.count;e<s;e++)Ar.fromBufferAttribute(this,e),Ar.applyMatrix3(t),this.setXY(e,Ar.x,Ar.y);else if(3===this.itemSize)for(let e=0,s=this.count;e<s;e++)zr.fromBufferAttribute(this,e),zr.applyMatrix3(t),this.setXYZ(e,zr.x,zr.y,zr.z);return this}applyMatrix4(t){for(let e=0,s=this.count;e<s;e++)zr.fromBufferAttribute(this,e),zr.applyMatrix4(t),this.setXYZ(e,zr.x,zr.y,zr.z);return this}applyNormalMatrix(t){for(let e=0,s=this.count;e<s;e++)zr.fromBufferAttribute(this,e),zr.applyNormalMatrix(t),this.setXYZ(e,zr.x,zr.y,zr.z);return this}transformDirection(t){for(let e=0,s=this.count;e<s;e++)zr.fromBufferAttribute(this,e),zr.transformDirection(t),this.setXYZ(e,zr.x,zr.y,zr.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let s=this.array[t*this.itemSize+e];return this.normalized&&(s=Ss(s,this.array)),s}setComponent(t,e,s){return this.normalized&&(s=_s(s,this.array)),this.array[t*this.itemSize+e]=s,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Ss(e,this.array)),e}setX(t,e){return this.normalized&&(e=_s(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Ss(e,this.array)),e}setY(t,e){return this.normalized&&(e=_s(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Ss(e,this.array)),e}setZ(t,e){return this.normalized&&(e=_s(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Ss(e,this.array)),e}setW(t,e){return this.normalized&&(e=_s(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,s){return t*=this.itemSize,this.normalized&&(e=_s(e,this.array),s=_s(s,this.array)),this.array[t+0]=e,this.array[t+1]=s,this}setXYZ(t,e,s,i){return t*=this.itemSize,this.normalized&&(e=_s(e,this.array),s=_s(s,this.array),i=_s(i,this.array)),this.array[t+0]=e,this.array[t+1]=s,this.array[t+2]=i,this}setXYZW(t,e,s,i,r){return t*=this.itemSize,this.normalized&&(e=_s(e,this.array),s=_s(s,this.array),i=_s(i,this.array),r=_s(r,this.array)),this.array[t+0]=e,this.array[t+1]=s,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==ts&&(t.usage=this.usage),t}}class kr extends Cr{constructor(t,e,s){super(new Uint16Array(t),e,s)}}class Br extends Cr{constructor(t,e,s){super(new Uint32Array(t),e,s)}}class Or extends Cr{constructor(t,e,s){super(new Float32Array(t),e,s)}}let Nr=0;const Pr=new zi,Ir=new Qi,Rr=new Cs,Vr=new Qs,Lr=new Qs,Er=new Cs;class Fr extends ms{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Nr++}),this.uuid=bs(),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(t){return Array.isArray(t)?this.index=new(rs(t)?Br:kr)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,s=0){this.groups.push({start:t,count:e,materialIndex:s})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const s=this.attributes.normal;if(void 0!==s){const e=(new Os).getNormalMatrix(t);s.applyNormalMatrix(e),s.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Pr.makeRotationFromQuaternion(t),this.applyMatrix4(Pr),this}rotateX(t){return Pr.makeRotationX(t),this.applyMatrix4(Pr),this}rotateY(t){return Pr.makeRotationY(t),this.applyMatrix4(Pr),this}rotateZ(t){return Pr.makeRotationZ(t),this.applyMatrix4(Pr),this}translate(t,e,s){return Pr.makeTranslation(t,e,s),this.applyMatrix4(Pr),this}scale(t,e,s){return Pr.makeScale(t,e,s),this.applyMatrix4(Pr),this}lookAt(t){return Ir.lookAt(t),Ir.updateMatrix(),this.applyMatrix4(Ir.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Rr).negate(),this.translate(Rr.x,Rr.y,Rr.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let s=0,i=t.length;s<i;s++){const i=t[s];e.push(i.x,i.y,i.z||0)}this.setAttribute("position",new Or(e,3))}else{const s=Math.min(t.length,e.count);for(let i=0;i<s;i++){const s=t[i];e.setXYZ(i,s.x,s.y,s.z||0)}t.length>e.count&&cs("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Qs);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return us("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Cs(-1/0,-1/0,-1/0),new Cs(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,s=e.length;t<s;t++){const s=e[t];Vr.setFromBufferAttribute(s),this.morphTargetsRelative?(Er.addVectors(this.boundingBox.min,Vr.min),this.boundingBox.expandByPoint(Er),Er.addVectors(this.boundingBox.max,Vr.max),this.boundingBox.expandByPoint(Er)):(this.boundingBox.expandByPoint(Vr.min),this.boundingBox.expandByPoint(Vr.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&us('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 fi);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return us("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new Cs,1/0);if(t){const s=this.boundingSphere.center;if(Vr.setFromBufferAttribute(t),e)for(let t=0,s=e.length;t<s;t++){const s=e[t];Lr.setFromBufferAttribute(s),this.morphTargetsRelative?(Er.addVectors(Vr.min,Lr.min),Vr.expandByPoint(Er),Er.addVectors(Vr.max,Lr.max),Vr.expandByPoint(Er)):(Vr.expandByPoint(Lr.min),Vr.expandByPoint(Lr.max))}Vr.getCenter(s);let i=0;for(let e=0,r=t.count;e<r;e++)Er.fromBufferAttribute(t,e),i=Math.max(i,s.distanceToSquared(Er));if(e)for(let r=0,n=e.length;r<n;r++){const n=e[r],a=this.morphTargetsRelative;for(let e=0,r=n.count;e<r;e++)Er.fromBufferAttribute(n,e),a&&(Rr.fromBufferAttribute(t,e),Er.add(Rr)),i=Math.max(i,s.distanceToSquared(Er))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&us('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void us("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const s=e.position,i=e.normal,r=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Cr(new Float32Array(4*s.count),4));const n=this.getAttribute("tangent"),a=[],o=[];for(let t=0;t<s.count;t++)a[t]=new Cs,o[t]=new Cs;const h=new Cs,l=new Cs,c=new Cs,u=new As,p=new As,d=new As,m=new Cs,y=new Cs;function f(t,e,i){h.fromBufferAttribute(s,t),l.fromBufferAttribute(s,e),c.fromBufferAttribute(s,i),u.fromBufferAttribute(r,t),p.fromBufferAttribute(r,e),d.fromBufferAttribute(r,i),l.sub(h),c.sub(h),p.sub(u),d.sub(u);const n=1/(p.x*d.y-d.x*p.y);isFinite(n)&&(m.copy(l).multiplyScalar(d.y).addScaledVector(c,-p.y).multiplyScalar(n),y.copy(c).multiplyScalar(p.x).addScaledVector(l,-d.x).multiplyScalar(n),a[t].add(m),a[e].add(m),a[i].add(m),o[t].add(y),o[e].add(y),o[i].add(y))}let g=this.groups;0===g.length&&(g=[{start:0,count:t.count}]);for(let e=0,s=g.length;e<s;++e){const s=g[e],i=s.start;for(let e=i,r=i+s.count;e<r;e+=3)f(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const x=new Cs,b=new Cs,M=new Cs,v=new Cs;function w(t){M.fromBufferAttribute(i,t),v.copy(M);const e=a[t];x.copy(e),x.sub(M.multiplyScalar(M.dot(e))).normalize(),b.crossVectors(v,e);const s=b.dot(o[t])<0?-1:1;n.setXYZW(t,x.x,x.y,x.z,s)}for(let e=0,s=g.length;e<s;++e){const s=g[e],i=s.start;for(let e=i,r=i+s.count;e<r;e+=3)w(t.getX(e+0)),w(t.getX(e+1)),w(t.getX(e+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let s=this.getAttribute("normal");if(void 0===s)s=new Cr(new Float32Array(3*e.count),3),this.setAttribute("normal",s);else for(let t=0,e=s.count;t<e;t++)s.setXYZ(t,0,0,0);const i=new Cs,r=new Cs,n=new Cs,a=new Cs,o=new Cs,h=new Cs,l=new Cs,c=new Cs;if(t)for(let u=0,p=t.count;u<p;u+=3){const p=t.getX(u+0),d=t.getX(u+1),m=t.getX(u+2);i.fromBufferAttribute(e,p),r.fromBufferAttribute(e,d),n.fromBufferAttribute(e,m),l.subVectors(n,r),c.subVectors(i,r),l.cross(c),a.fromBufferAttribute(s,p),o.fromBufferAttribute(s,d),h.fromBufferAttribute(s,m),a.add(l),o.add(l),h.add(l),s.setXYZ(p,a.x,a.y,a.z),s.setXYZ(d,o.x,o.y,o.z),s.setXYZ(m,h.x,h.y,h.z)}else for(let t=0,a=e.count;t<a;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),n.fromBufferAttribute(e,t+2),l.subVectors(n,r),c.subVectors(i,r),l.cross(c),s.setXYZ(t+0,l.x,l.y,l.z),s.setXYZ(t+1,l.x,l.y,l.z),s.setXYZ(t+2,l.x,l.y,l.z);this.normalizeNormals(),s.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,s=t.count;e<s;e++)Er.fromBufferAttribute(t,e),Er.normalize(),t.setXYZ(e,Er.x,Er.y,Er.z)}toNonIndexed(){function t(t,e){const s=t.array,i=t.itemSize,r=t.normalized,n=new s.constructor(e.length*i);let a=0,o=0;for(let r=0,h=e.length;r<h;r++){a=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*i;for(let t=0;t<i;t++)n[o++]=s[a++]}return new Cr(n,i,r)}if(null===this.index)return cs("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Fr,s=this.index.array,i=this.attributes;for(const r in i){const n=t(i[r],s);e.setAttribute(r,n)}const r=this.morphAttributes;for(const i in r){const n=[],a=r[i];for(let e=0,i=a.length;e<i;e++){const i=t(a[e],s);n.push(i)}e.morphAttributes[i]=n}e.morphTargetsRelative=this.morphTargetsRelative;const n=this.groups;for(let t=0,s=n.length;t<s;t++){const s=n[t];e.addGroup(s.start,s.count,s.materialIndex)}return e}toJSON(){const t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const s in e)void 0!==e[s]&&(t[s]=e[s]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const s=this.attributes;for(const e in s){const i=s[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const s=this.morphAttributes[e],n=[];for(let e=0,i=s.length;e<i;e++){const i=s[e];n.push(i.toJSON(t.data))}n.length>0&&(i[e]=n,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const n=this.groups;n.length>0&&(t.data.groups=JSON.parse(JSON.stringify(n)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere=a.toJSON()),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const s=t.index;null!==s&&this.setIndex(s.clone());const i=t.attributes;for(const t in i){const s=i[t];this.setAttribute(t,s.clone(e))}const r=t.morphAttributes;for(const t in r){const s=[],i=r[t];for(let t=0,r=i.length;t<r;t++)s.push(i[t].clone(e));this.morphAttributes[t]=s}this.morphTargetsRelative=t.morphTargetsRelative;const n=t.groups;for(let t=0,e=n.length;t<e;t++){const e=n[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Dr=new zi,Ur=new _i,jr=new fi,Wr=new Cs,Jr=new Cs,qr=new Cs,Xr=new Cs,Yr=new Cs,Zr=new Cs,Hr=new Cs,Gr=new Cs;class $r extends Qi{constructor(t=new Fr,e=new vr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const s=t[e[0]];if(void 0!==s){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=s.length;t<e;t++){const e=s[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){const s=this.geometry,i=s.attributes.position,r=s.morphAttributes.position,n=s.morphTargetsRelative;e.fromBufferAttribute(i,t);const a=this.morphTargetInfluences;if(r&&a){Zr.set(0,0,0);for(let s=0,i=r.length;s<i;s++){const i=a[s],o=r[s];0!==i&&(Yr.fromBufferAttribute(o,t),n?Zr.addScaledVector(Yr,i):Zr.addScaledVector(Yr.sub(e),i))}e.add(Zr)}return e}raycast(t,e){const s=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===s.boundingSphere&&s.computeBoundingSphere(),jr.copy(s.boundingSphere),jr.applyMatrix4(r),Ur.copy(t.ray).recast(t.near),!1===jr.containsPoint(Ur.origin)){if(null===Ur.intersectSphere(jr,Wr))return;if(Ur.origin.distanceToSquared(Wr)>(t.far-t.near)**2)return}Dr.copy(r).invert(),Ur.copy(t.ray).applyMatrix4(Dr),null!==s.boundingBox&&!1===Ur.intersectsBox(s.boundingBox)||this._computeIntersections(t,e,Ur)}}_computeIntersections(t,e,s){let i;const r=this.geometry,n=this.material,a=r.index,o=r.attributes.position,h=r.attributes.uv,l=r.attributes.uv1,c=r.attributes.normal,u=r.groups,p=r.drawRange;if(null!==a)if(Array.isArray(n))for(let r=0,o=u.length;r<o;r++){const o=u[r],d=n[o.materialIndex];for(let r=Math.max(o.start,p.start),n=Math.min(a.count,Math.min(o.start+o.count,p.start+p.count));r<n;r+=3){i=Qr(this,d,t,s,h,l,c,a.getX(r),a.getX(r+1),a.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,e.push(i))}}else{for(let r=Math.max(0,p.start),o=Math.min(a.count,p.start+p.count);r<o;r+=3){i=Qr(this,n,t,s,h,l,c,a.getX(r),a.getX(r+1),a.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),e.push(i))}}else if(void 0!==o)if(Array.isArray(n))for(let r=0,a=u.length;r<a;r++){const a=u[r],d=n[a.materialIndex];for(let r=Math.max(a.start,p.start),n=Math.min(o.count,Math.min(a.start+a.count,p.start+p.count));r<n;r+=3){i=Qr(this,d,t,s,h,l,c,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=a.materialIndex,e.push(i))}}else{for(let r=Math.max(0,p.start),a=Math.min(o.count,p.start+p.count);r<a;r+=3){i=Qr(this,n,t,s,h,l,c,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),e.push(i))}}}}function Qr(t,e,s,i,r,n,a,o,h,l){t.getVertexPosition(o,Jr),t.getVertexPosition(h,qr),t.getVertexPosition(l,Xr);const c=function(t,e,s,i,r,n,a,o){let h;if(h=1===e.side?i.intersectTriangle(a,n,r,!0,o):i.intersectTriangle(r,n,a,0===e.side,o),null===h)return null;Gr.copy(o),Gr.applyMatrix4(t.matrixWorld);const l=s.ray.origin.distanceTo(Gr);return l<s.near||l>s.far?null:{distance:l,point:Gr.clone(),object:t}}(t,e,s,i,Jr,qr,Xr,Hr);if(c){const t=new Cs;pr.getBarycoord(Hr,Jr,qr,Xr,t),r&&(c.uv=pr.getInterpolatedAttribute(r,o,h,l,t,new As)),n&&(c.uv1=pr.getInterpolatedAttribute(n,o,h,l,t,new As)),a&&(c.normal=pr.getInterpolatedAttribute(a,o,h,l,t,new Cs),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));const e={a:o,b:h,c:l,normal:new Cs,materialIndex:0};pr.getNormal(Jr,qr,Xr,e.normal),c.face=e,c.barycoord=t}return c}class Kr extends Fr{constructor(t=1,e=1,s=1,i=1,r=1,n=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:s,widthSegments:i,heightSegments:r,depthSegments:n};const a=this;i=Math.floor(i),r=Math.floor(r),n=Math.floor(n);const o=[],h=[],l=[],c=[];let u=0,p=0;function d(t,e,s,i,r,n,d,m,y,f,g){const x=n/y,b=d/f,M=n/2,v=d/2,w=m/2,S=y+1,_=f+1;let z=0,A=0;const T=new Cs;for(let n=0;n<_;n++){const a=n*b-v;for(let o=0;o<S;o++){const u=o*x-M;T[t]=u*i,T[e]=a*r,T[s]=w,h.push(T.x,T.y,T.z),T[t]=0,T[e]=0,T[s]=m>0?1:-1,l.push(T.x,T.y,T.z),c.push(o/y),c.push(1-n/f),z+=1}}for(let t=0;t<f;t++)for(let e=0;e<y;e++){const s=u+e+S*t,i=u+e+S*(t+1),r=u+(e+1)+S*(t+1),n=u+(e+1)+S*t;o.push(s,i,n),o.push(i,r,n),A+=6}a.addGroup(p,A,g),p+=A,u+=z}d("z","y","x",-1,-1,s,e,t,n,r,0),d("z","y","x",1,-1,s,e,-t,n,r,1),d("x","z","y",1,1,t,s,e,i,n,2),d("x","z","y",1,-1,t,s,-e,i,n,3),d("x","y","z",1,-1,t,e,s,i,r,4),d("x","y","z",-1,-1,t,e,-s,i,r,5),this.setIndex(o),this.setAttribute("position",new Or(h,3)),this.setAttribute("normal",new Or(l,3)),this.setAttribute("uv",new Or(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Kr(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function tn(t){const e={};for(const s in t){e[s]={};for(const i in t[s]){const r=t[s][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(cs("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[s][i]=null):e[s][i]=r.clone():Array.isArray(r)?e[s][i]=r.slice():e[s][i]=r}}return e}function en(t){const e={};for(let s=0;s<t.length;s++){const i=tn(t[s]);for(const t in i)e[t]=i[t]}return e}function sn(t){const e=t.getRenderTarget();return null===e?t.outputColorSpace:!0===e.isXRRenderTarget?e.texture.colorSpace:Vs.workingColorSpace}const rn={clone:tn,merge:en};class nn extends Mr{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_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!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=tn(t.uniforms),this.uniformsGroups=function(t){const e=[];for(let s=0;s<t.length;s++)e.push(t[s].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this.defaultAttributeValues=Object.assign({},t.defaultAttributeValues),this.index0AttributeName=t.index0AttributeName,this.uniformsNeedUpdate=t.uniformsNeedUpdate,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const s in this.uniforms){const i=this.uniforms[s].value;i&&i.isTexture?e.uniforms[s]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[s]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[s]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[s]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[s]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[s]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[s]={type:"m4",value:i.toArray()}:e.uniforms[s]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const s={};for(const t in this.extensions)!0===this.extensions[t]&&(s[t]=!0);return Object.keys(s).length>0&&(e.extensions=s),e}}class an extends Qi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new zi,this.projectionMatrix=new zi,this.projectionMatrixInverse=new zi,this.coordinateSystem=ss,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const on=new Cs,hn=new As,ln=new As;class cn extends an{constructor(t=50,e=1,s=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=s,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*xs*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*gs*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*xs*Math.atan(Math.tan(.5*gs*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,s){on.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(on.x,on.y).multiplyScalar(-t/on.z),on.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),s.set(on.x,on.y).multiplyScalar(-t/on.z)}getViewSize(t,e){return this.getViewBounds(t,hn,ln),e.subVectors(ln,hn)}setViewOffset(t,e,s,i,r,n){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=s,this.view.offsetY=i,this.view.width=r,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*gs*this.fov)/this.zoom,s=2*e,i=this.aspect*s,r=-.5*i;const n=this.view;if(null!==this.view&&this.view.enabled){const t=n.fullWidth,a=n.fullHeight;r+=n.offsetX*i/t,e-=n.offsetY*s/a,i*=n.width/t,s*=n.height/a}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-s,t,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const un=-90;class pn extends Qi{constructor(t,e,s){super(),this.type="CubeCamera",this.renderTarget=s,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new cn(un,1,t,e);i.layers=this.layers,this.add(i);const r=new cn(un,1,t,e);r.layers=this.layers,this.add(r);const n=new cn(un,1,t,e);n.layers=this.layers,this.add(n);const a=new cn(un,1,t,e);a.layers=this.layers,this.add(a);const o=new cn(un,1,t,e);o.layers=this.layers,this.add(o);const h=new cn(un,1,t,e);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[s,i,r,n,a,o]=e;for(const t of e)this.remove(t);if(t===ss)s.up.set(0,1,0),s.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),n.up.set(0,0,1),n.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(t!==is)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);s.up.set(0,-1,0),s.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),n.up.set(0,0,-1),n.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:s,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,n,a,o,h,l]=this.children,c=t.getRenderTarget(),u=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),d=t.xr.enabled;t.xr.enabled=!1;const m=s.texture.generateMipmaps;s.texture.generateMipmaps=!1,t.setRenderTarget(s,0,i),t.render(e,r),t.setRenderTarget(s,1,i),t.render(e,n),t.setRenderTarget(s,2,i),t.render(e,a),t.setRenderTarget(s,3,i),t.render(e,o),t.setRenderTarget(s,4,i),t.render(e,h),s.texture.generateMipmaps=m,t.setRenderTarget(s,5,i),t.render(e,l),t.setRenderTarget(c,u,p),t.xr.enabled=d,s.texture.needsPMREMUpdate=!0}}class dn extends Xs{constructor(t=[],e=301,s,i,r,n,a,o,h,l){super(t,e,s,i,r,n,a,o,h,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class mn extends Hs{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const s={width:t,height:t,depth:1},i=[s,s,s,s,s,s];this.texture=new dn(i),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const s={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new Kr(5,5,5),r=new nn({name:"CubemapFromEquirect",uniforms:tn(s.uniforms),vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const n=new $r(i,r),a=e.minFilter;e.minFilter===bt&&(e.minFilter=gt);return new pn(1,10,this).update(t,n),e.minFilter=a,n.geometry.dispose(),n.material.dispose(),this}clear(t,e=!0,s=!0,i=!0){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,s,i);t.setRenderTarget(r)}}class yn extends Qi{constructor(){super(),this.isGroup=!0,this.type="Group"}}const fn={type:"move"};class gn{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new yn,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 yn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Cs,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Cs),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new yn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Cs,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Cs),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const s of t.hand.values())this._getHandJoint(e,s)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,s){let i=null,r=null,n=null;const a=this._targetRay,o=this._grip,h=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(h&&t.hand){n=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,s),r=this._getHandJoint(h,i);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}const i=h.joints["index-finger-tip"],r=h.joints["thumb-tip"],a=i.position.distanceTo(r.position),o=.02,l=.005;h.inputState.pinching&&a>o+l?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!h.inputState.pinching&&a<=o-l&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,s),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(i=e.getPose(t.targetRaySpace,s),null===i&&null!==r&&(i=r),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(fn)))}return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==h&&(h.visible=null!==n),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const s=new yn;s.matrixAutoUpdate=!1,s.visible=!1,t.joints[e.jointName]=s,t.add(s)}return t.joints[e.jointName]}}class xn extends Qi{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 Ri,this.environmentIntensity=1,this.environmentRotation=new Ri,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class bn{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=ts,this.updateRanges=[],this.version=0,this.uuid=bs()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,s){t*=this.stride,s*=e.stride;for(let i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[s+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=bs()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),s=new this.constructor(e,this.stride);return s.setUsage(this.usage),s}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=bs()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.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}}}const Mn=new Cs;class vn{constructor(t,e,s,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=s,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,s=this.data.count;e<s;e++)Mn.fromBufferAttribute(this,e),Mn.applyMatrix4(t),this.setXYZ(e,Mn.x,Mn.y,Mn.z);return this}applyNormalMatrix(t){for(let e=0,s=this.count;e<s;e++)Mn.fromBufferAttribute(this,e),Mn.applyNormalMatrix(t),this.setXYZ(e,Mn.x,Mn.y,Mn.z);return this}transformDirection(t){for(let e=0,s=this.count;e<s;e++)Mn.fromBufferAttribute(this,e),Mn.transformDirection(t),this.setXYZ(e,Mn.x,Mn.y,Mn.z);return this}getComponent(t,e){let s=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(s=Ss(s,this.array)),s}setComponent(t,e,s){return this.normalized&&(s=_s(s,this.array)),this.data.array[t*this.data.stride+this.offset+e]=s,this}setX(t,e){return this.normalized&&(e=_s(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=_s(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=_s(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=_s(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Ss(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Ss(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Ss(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Ss(e,this.array)),e}setXY(t,e,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=_s(e,this.array),s=_s(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=s,this}setXYZ(t,e,s,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=_s(e,this.array),s=_s(s,this.array),i=_s(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=s,this.data.array[t+2]=i,this}setXYZW(t,e,s,i,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=_s(e,this.array),s=_s(s,this.array),i=_s(i,this.array),r=_s(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=s,this.data.array[t+2]=i,this.data.array[t+3]=r,this}clone(t){if(void 0===t){ls("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const s=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[s+e])}return new Cr(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new vn(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){ls("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const s=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[s+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}const wn=new Cs,Sn=new Ys,_n=new Ys,zn=new Cs,An=new zi,Tn=new Cs,Cn=new fi,kn=new zi,Bn=new _i;class On extends $r{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=it,this.bindMatrix=new zi,this.bindMatrixInverse=new zi,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new Qs),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,Tn),this.boundingBox.expandByPoint(Tn)}computeBoundingSphere(){const t=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new fi),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,Tn),this.boundingSphere.expandByPoint(Tn)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const s=this.material,i=this.matrixWorld;void 0!==s&&(null===this.boundingSphere&&this.computeBoundingSphere(),Cn.copy(this.boundingSphere),Cn.applyMatrix4(i),!1!==t.ray.intersectsSphere(Cn)&&(kn.copy(i).invert(),Bn.copy(t.ray).applyMatrix4(kn),null!==this.boundingBox&&!1===Bn.intersectsBox(this.boundingBox)||this._computeIntersections(t,e,Bn)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new Ys,e=this.geometry.attributes.skinWeight;for(let s=0,i=e.count;s<i;s++){t.fromBufferAttribute(e,s);const i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(s,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===it?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===rt?this.bindMatrixInverse.copy(this.bindMatrix).invert():cs("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){const s=this.skeleton,i=this.geometry;Sn.fromBufferAttribute(i.attributes.skinIndex,t),_n.fromBufferAttribute(i.attributes.skinWeight,t),wn.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const i=_n.getComponent(t);if(0!==i){const r=Sn.getComponent(t);An.multiplyMatrices(s.bones[r].matrixWorld,s.boneInverses[r]),e.addScaledVector(zn.copy(wn).applyMatrix4(An),i)}}return e.applyMatrix4(this.bindMatrixInverse)}}class Nn extends Qi{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Pn extends Xs{constructor(t=null,e=1,s=1,i,r,n,a,o,h=1003,l=1003,c,u){super(null,n,a,o,h,l,i,r,c,u),this.isDataTexture=!0,this.image={data:t,width:e,height:s},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const In=new zi,Rn=new zi;class Vn{constructor(t=[],e=[]){this.uuid=bs(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){cs("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new zi)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new zi;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,s=this.boneMatrices,i=this.boneTexture;for(let i=0,r=t.length;i<r;i++){const r=t[i]?t[i].matrixWorld:Rn;In.multiplyMatrices(r,e[i]),In.toArray(s,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new Vn(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const s=new Pn(e,t,t,Rt,At);return s.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=s,this}getBoneByName(t){for(let e=0,s=this.bones.length;e<s;e++){const s=this.bones[e];if(s.name===t)return s}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let s=0,i=t.bones.length;s<i;s++){const i=t.bones[s];let r=e[i];void 0===r&&(cs("Skeleton: No bone found with UUID:",i),r=new Nn),this.bones.push(r),this.boneInverses.push((new zi).fromArray(t.boneInverses[s]))}return this.init(),this}toJSON(){const t={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,s=this.boneInverses;for(let i=0,r=e.length;i<r;i++){const r=e[i];t.bones.push(r.uuid);const n=s[i];t.boneInverses.push(n.toArray())}return t}}class Ln extends Cr{constructor(t,e,s,i=1){super(t,e,s),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const En=new zi,Fn=new zi,Dn=[],Un=new Qs,jn=new zi,Wn=new $r,Jn=new fi;class qn extends $r{constructor(t,e,s){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new Ln(new Float32Array(16*s),16),this.instanceColor=null,this.morphTexture=null,this.count=s,this.boundingBox=null,this.boundingSphere=null;for(let t=0;t<s;t++)this.setMatrixAt(t,jn)}computeBoundingBox(){const t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new Qs),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let s=0;s<e;s++)this.getMatrixAt(s,En),Un.copy(t.boundingBox).applyMatrix4(En),this.boundingBox.union(Un)}computeBoundingSphere(){const t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new fi),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let s=0;s<e;s++)this.getMatrixAt(s,En),Jn.copy(t.boundingSphere).applyMatrix4(En),this.boundingSphere.union(Jn)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.morphTexture&&(this.morphTexture=t.morphTexture.clone()),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){const s=e.morphTargetInfluences,i=this.morphTexture.source.data.data,r=t*(s.length+1)+1;for(let t=0;t<s.length;t++)s[t]=i[r+t]}raycast(t,e){const s=this.matrixWorld,i=this.count;if(Wn.geometry=this.geometry,Wn.material=this.material,void 0!==Wn.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),Jn.copy(this.boundingSphere),Jn.applyMatrix4(s),!1!==t.ray.intersectsSphere(Jn)))for(let r=0;r<i;r++){this.getMatrixAt(r,En),Fn.multiplyMatrices(s,En),Wn.matrixWorld=Fn,Wn.raycast(t,Dn);for(let t=0,s=Dn.length;t<s;t++){const s=Dn[t];s.instanceId=r,s.object=this,e.push(s)}Dn.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new Ln(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}setMorphAt(t,e){const s=e.morphTargetInfluences,i=s.length+1;null===this.morphTexture&&(this.morphTexture=new Pn(new Float32Array(i*this.count),i,this.count,Et,At));const r=this.morphTexture.source.data.data;let n=0;for(let t=0;t<s.length;t++)n+=s[t];const a=this.geometry.morphTargetsRelative?1:1-n,o=i*t;r[o]=a,r.set(s,o+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Xn=new Cs,Yn=new Cs,Zn=new Os;class Hn{constructor(t=new Cs(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,s,i){return this.normal.set(t,e,s),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,s){const i=Xn.subVectors(s,e).cross(Yn.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const s=t.delta(Xn),i=this.normal.dot(s);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(t.start).addScaledVector(s,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),s=this.distanceToPoint(t.end);return e<0&&s>0||s<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const s=e||Zn.getNormalMatrix(t),i=this.coplanarPoint(Xn).applyMatrix4(t),r=this.normal.applyMatrix3(s).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const Gn=new fi,$n=new As(.5,.5),Qn=new Cs;class Kn{constructor(t=new Hn,e=new Hn,s=new Hn,i=new Hn,r=new Hn,n=new Hn){this.planes=[t,e,s,i,r,n]}set(t,e,s,i,r,n){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(s),a[3].copy(i),a[4].copy(r),a[5].copy(n),this}copy(t){const e=this.planes;for(let s=0;s<6;s++)e[s].copy(t.planes[s]);return this}setFromProjectionMatrix(t,e=2e3,s=!1){const i=this.planes,r=t.elements,n=r[0],a=r[1],o=r[2],h=r[3],l=r[4],c=r[5],u=r[6],p=r[7],d=r[8],m=r[9],y=r[10],f=r[11],g=r[12],x=r[13],b=r[14],M=r[15];if(i[0].setComponents(h-n,p-l,f-d,M-g).normalize(),i[1].setComponents(h+n,p+l,f+d,M+g).normalize(),i[2].setComponents(h+a,p+c,f+m,M+x).normalize(),i[3].setComponents(h-a,p-c,f-m,M-x).normalize(),s)i[4].setComponents(o,u,y,b).normalize(),i[5].setComponents(h-o,p-u,f-y,M-b).normalize();else if(i[4].setComponents(h-o,p-u,f-y,M-b).normalize(),e===ss)i[5].setComponents(h+o,p+u,f+y,M+b).normalize();else{if(e!==is)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);i[5].setComponents(o,u,y,b).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),Gn.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),Gn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Gn)}intersectsSprite(t){Gn.center.set(0,0,0);const e=$n.distanceTo(t.center);return Gn.radius=.7071067811865476+e,Gn.applyMatrix4(t.matrixWorld),this.intersectsSphere(Gn)}intersectsSphere(t){const e=this.planes,s=t.center,i=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(s)<i)return!1}return!0}intersectsBox(t){const e=this.planes;for(let s=0;s<6;s++){const i=e[s];if(Qn.x=i.normal.x>0?t.max.x:t.min.x,Qn.y=i.normal.y>0?t.max.y:t.min.y,Qn.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Qn)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let s=0;s<6;s++)if(e[s].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}class ta extends Mr{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new gr(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const ea=new Cs,sa=new Cs,ia=new zi,ra=new _i,na=new fi,aa=new Cs,oa=new Cs;class ha extends Qi{constructor(t=new Fr,e=new ta){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,s=[0];for(let t=1,i=e.count;t<i;t++)ea.fromBufferAttribute(e,t-1),sa.fromBufferAttribute(e,t),s[t]=s[t-1],s[t]+=ea.distanceTo(sa);t.setAttribute("lineDistance",new Or(s,1))}else cs("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const s=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,n=s.drawRange;if(null===s.boundingSphere&&s.computeBoundingSphere(),na.copy(s.boundingSphere),na.applyMatrix4(i),na.radius+=r,!1===t.ray.intersectsSphere(na))return;ia.copy(i).invert(),ra.copy(t.ray).applyMatrix4(ia);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,h=this.isLineSegments?2:1,l=s.index,c=s.attributes.position;if(null!==l){const s=Math.max(0,n.start),i=Math.min(l.count,n.start+n.count);for(let r=s,n=i-1;r<n;r+=h){const s=l.getX(r),i=l.getX(r+1),n=la(this,t,ra,o,s,i,r);n&&e.push(n)}if(this.isLineLoop){const r=l.getX(i-1),n=l.getX(s),a=la(this,t,ra,o,r,n,i-1);a&&e.push(a)}}else{const s=Math.max(0,n.start),i=Math.min(c.count,n.start+n.count);for(let r=s,n=i-1;r<n;r+=h){const s=la(this,t,ra,o,r,r+1,r);s&&e.push(s)}if(this.isLineLoop){const r=la(this,t,ra,o,i-1,s,i-1);r&&e.push(r)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const s=t[e[0]];if(void 0!==s){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=s.length;t<e;t++){const e=s[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function la(t,e,s,i,r,n,a){const o=t.geometry.attributes.position;ea.fromBufferAttribute(o,r),sa.fromBufferAttribute(o,n);if(s.distanceSqToSegment(ea,sa,aa,oa)>i)return;aa.applyMatrix4(t.matrixWorld);const h=e.ray.origin.distanceTo(aa);return h<e.near||h>e.far?void 0:{distance:h,point:oa.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}const ca=new Cs,ua=new Cs;class pa extends ha{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,s=[];for(let t=0,i=e.count;t<i;t+=2)ca.fromBufferAttribute(e,t),ua.fromBufferAttribute(e,t+1),s[t]=0===t?0:s[t-1],s[t+1]=s[t]+ca.distanceTo(ua);t.setAttribute("lineDistance",new Or(s,1))}else cs("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class da extends ha{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class ma extends Mr{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new gr(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const ya=new zi,fa=new _i,ga=new fi,xa=new Cs;class ba extends Qi{constructor(t=new Fr,e=new ma){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){const s=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold,n=s.drawRange;if(null===s.boundingSphere&&s.computeBoundingSphere(),ga.copy(s.boundingSphere),ga.applyMatrix4(i),ga.radius+=r,!1===t.ray.intersectsSphere(ga))return;ya.copy(i).invert(),fa.copy(t.ray).applyMatrix4(ya);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,h=s.index,l=s.attributes.position;if(null!==h){for(let s=Math.max(0,n.start),r=Math.min(h.count,n.start+n.count);s<r;s++){const r=h.getX(s);xa.fromBufferAttribute(l,r),Ma(xa,r,o,i,t,e,this)}}else{for(let s=Math.max(0,n.start),r=Math.min(l.count,n.start+n.count);s<r;s++)xa.fromBufferAttribute(l,s),Ma(xa,s,o,i,t,e,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const s=t[e[0]];if(void 0!==s){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=s.length;t<e;t++){const e=s[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function Ma(t,e,s,i,r,n,a){const o=fa.distanceSqToPoint(t);if(o<s){const s=new Cs;fa.closestPointToPoint(t,s),s.applyMatrix4(i);const h=r.ray.origin.distanceTo(s);if(h<r.near||h>r.far)return;n.push({distance:h,distanceToRay:Math.sqrt(o),point:s,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class va extends Xs{constructor(t,e,s=1014,i,r,n,a=1003,o=1003,h,l=1026,c=1){if(l!==Vt&&1027!==l)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:t,height:e,depth:c},i,r,n,a,o,l,s,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new js(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class wa extends va{constructor(t,e=1014,s=301,i,r,n=1003,a=1003,o,h=1026){const l={width:t,height:t,depth:1},c=[l,l,l,l,l,l];super(t,t,e,s,i,r,n,a,o,h),this.image=c,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}}class Sa extends Xs{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}}class _a extends Fr{constructor(t=1,e=1,s=4,i=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radius:t,height:e,capSegments:s,radialSegments:i,heightSegments:r},e=Math.max(0,e),s=Math.max(1,Math.floor(s)),i=Math.max(3,Math.floor(i)),r=Math.max(1,Math.floor(r));const n=[],a=[],o=[],h=[],l=e/2,c=Math.PI/2*t,u=e,p=2*c+u,d=2*s+r,m=i+1,y=new Cs,f=new Cs;for(let g=0;g<=d;g++){let x=0,b=0,M=0,v=0;if(g<=s){const e=g/s,i=e*Math.PI/2;b=-l-t*Math.cos(i),M=t*Math.sin(i),v=-t*Math.cos(i),x=e*c}else if(g<=s+r){const i=(g-s)/r;b=i*e-l,M=t,v=0,x=c+i*u}else{const e=(g-s-r)/s,i=e*Math.PI/2;b=l+t*Math.sin(i),M=t*Math.cos(i),v=t*Math.sin(i),x=c+u+e*c}const w=Math.max(0,Math.min(1,x/p));let S=0;0===g?S=.5/i:g===d&&(S=-.5/i);for(let t=0;t<=i;t++){const e=t/i,s=e*Math.PI*2,r=Math.sin(s),n=Math.cos(s);f.x=-M*n,f.y=b,f.z=M*r,a.push(f.x,f.y,f.z),y.set(-M*n,v,M*r),y.normalize(),o.push(y.x,y.y,y.z),h.push(e+S,w)}if(g>0){const t=(g-1)*m;for(let e=0;e<i;e++){const s=t+e,i=t+e+1,r=g*m+e,a=g*m+e+1;n.push(s,i,r),n.push(i,a,r)}}}this.setIndex(n),this.setAttribute("position",new Or(a,3)),this.setAttribute("normal",new Or(o,3)),this.setAttribute("uv",new Or(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new _a(t.radius,t.height,t.capSegments,t.radialSegments,t.heightSegments)}}class za extends Fr{constructor(t=1,e=1,s=1,i=32,r=1,n=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:s,radialSegments:i,heightSegments:r,openEnded:n,thetaStart:a,thetaLength:o};const h=this;i=Math.floor(i),r=Math.floor(r);const l=[],c=[],u=[],p=[];let d=0;const m=[],y=s/2;let f=0;function g(s){const r=d,n=new As,m=new Cs;let g=0;const x=!0===s?t:e,b=!0===s?1:-1;for(let t=1;t<=i;t++)c.push(0,y*b,0),u.push(0,b,0),p.push(.5,.5),d++;const M=d;for(let t=0;t<=i;t++){const e=t/i*o+a,s=Math.cos(e),r=Math.sin(e);m.x=x*r,m.y=y*b,m.z=x*s,c.push(m.x,m.y,m.z),u.push(0,b,0),n.x=.5*s+.5,n.y=.5*r*b+.5,p.push(n.x,n.y),d++}for(let t=0;t<i;t++){const e=r+t,i=M+t;!0===s?l.push(i,i+1,e):l.push(i+1,i,e),g+=3}h.addGroup(f,g,!0===s?1:2),f+=g}!function(){const n=new Cs,g=new Cs;let x=0;const b=(e-t)/s;for(let h=0;h<=r;h++){const l=[],f=h/r,x=f*(e-t)+t;for(let t=0;t<=i;t++){const e=t/i,r=e*o+a,h=Math.sin(r),m=Math.cos(r);g.x=x*h,g.y=-f*s+y,g.z=x*m,c.push(g.x,g.y,g.z),n.set(h,b,m).normalize(),u.push(n.x,n.y,n.z),p.push(e,1-f),l.push(d++)}m.push(l)}for(let s=0;s<i;s++)for(let i=0;i<r;i++){const n=m[i][s],a=m[i+1][s],o=m[i+1][s+1],h=m[i][s+1];(t>0||0!==i)&&(l.push(n,a,h),x+=3),(e>0||i!==r-1)&&(l.push(a,o,h),x+=3)}h.addGroup(f,x,0),f+=x}(),!1===n&&(t>0&&g(!0),e>0&&g(!1)),this.setIndex(l),this.setAttribute("position",new Or(c,3)),this.setAttribute("normal",new Or(u,3)),this.setAttribute("uv",new Or(p,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new za(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Aa extends Fr{constructor(t=[],e=[],s=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:s,detail:i};const r=[],n=[];function a(t,e,s,i){const r=i+1,n=[];for(let i=0;i<=r;i++){n[i]=[];const a=t.clone().lerp(s,i/r),o=e.clone().lerp(s,i/r),h=r-i;for(let t=0;t<=h;t++)n[i][t]=0===t&&i===r?a:a.clone().lerp(o,t/h)}for(let t=0;t<r;t++)for(let e=0;e<2*(r-t)-1;e++){const s=Math.floor(e/2);e%2==0?(o(n[t][s+1]),o(n[t+1][s]),o(n[t][s])):(o(n[t][s+1]),o(n[t+1][s+1]),o(n[t+1][s]))}}function o(t){r.push(t.x,t.y,t.z)}function h(e,s){const i=3*e;s.x=t[i+0],s.y=t[i+1],s.z=t[i+2]}function l(t,e,s,i){i<0&&1===t.x&&(n[e]=t.x-1),0===s.x&&0===s.z&&(n[e]=i/2/Math.PI+.5)}function c(t){return Math.atan2(t.z,-t.x)}function u(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}!function(t){const s=new Cs,i=new Cs,r=new Cs;for(let n=0;n<e.length;n+=3)h(e[n+0],s),h(e[n+1],i),h(e[n+2],r),a(s,i,r,t)}(i),function(t){const e=new Cs;for(let s=0;s<r.length;s+=3)e.x=r[s+0],e.y=r[s+1],e.z=r[s+2],e.normalize().multiplyScalar(t),r[s+0]=e.x,r[s+1]=e.y,r[s+2]=e.z}(s),function(){const t=new Cs;for(let e=0;e<r.length;e+=3){t.x=r[e+0],t.y=r[e+1],t.z=r[e+2];const s=c(t)/2/Math.PI+.5,i=u(t)/Math.PI+.5;n.push(s,1-i)}(function(){const t=new Cs,e=new Cs,s=new Cs,i=new Cs,a=new As,o=new As,h=new As;for(let u=0,p=0;u<r.length;u+=9,p+=6){t.set(r[u+0],r[u+1],r[u+2]),e.set(r[u+3],r[u+4],r[u+5]),s.set(r[u+6],r[u+7],r[u+8]),a.set(n[p+0],n[p+1]),o.set(n[p+2],n[p+3]),h.set(n[p+4],n[p+5]),i.copy(t).add(e).add(s).divideScalar(3);const d=c(i);l(a,p+0,t,d),l(o,p+2,e,d),l(h,p+4,s,d)}})(),function(){for(let t=0;t<n.length;t+=6){const e=n[t+0],s=n[t+2],i=n[t+4],r=Math.max(e,s,i),a=Math.min(e,s,i);r>.9&&a<.1&&(e<.2&&(n[t+0]+=1),s<.2&&(n[t+2]+=1),i<.2&&(n[t+4]+=1))}}()}(),this.setAttribute("position",new Or(r,3)),this.setAttribute("normal",new Or(r.slice(),3)),this.setAttribute("uv",new Or(n,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Aa(t.vertices,t.indices,t.radius,t.detail)}}class Ta{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){cs("Curve: .getPoint() not implemented.")}getPointAt(t,e){const s=this.getUtoTmapping(t);return this.getPoint(s,e)}getPoints(t=5){const e=[];for(let s=0;s<=t;s++)e.push(this.getPoint(s/t));return e}getSpacedPoints(t=5){const e=[];for(let s=0;s<=t;s++)e.push(this.getPointAt(s/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let s,i=this.getPoint(0),r=0;e.push(0);for(let n=1;n<=t;n++)s=this.getPoint(n/t),r+=s.distanceTo(i),e.push(r),i=s;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){const s=this.getLengths();let i=0;const r=s.length;let n;n=e||t*s[r-1];let a,o=0,h=r-1;for(;o<=h;)if(i=Math.floor(o+(h-o)/2),a=s[i]-n,a<0)o=i+1;else{if(!(a>0)){h=i;break}h=i-1}if(i=h,s[i]===n)return i/(r-1);const l=s[i];return(i+(n-l)/(s[i+1]-l))/(r-1)}getTangent(t,e){const s=1e-4;let i=t-s,r=t+s;i<0&&(i=0),r>1&&(r=1);const n=this.getPoint(i),a=this.getPoint(r),o=e||(n.isVector2?new As:new Cs);return o.copy(a).sub(n).normalize(),o}getTangentAt(t,e){const s=this.getUtoTmapping(t);return this.getTangent(s,e)}computeFrenetFrames(t,e=!1){const s=new Cs,i=[],r=[],n=[],a=new Cs,o=new zi;for(let e=0;e<=t;e++){const s=e/t;i[e]=this.getTangentAt(s,new Cs)}r[0]=new Cs,n[0]=new Cs;let h=Number.MAX_VALUE;const l=Math.abs(i[0].x),c=Math.abs(i[0].y),u=Math.abs(i[0].z);l<=h&&(h=l,s.set(1,0,0)),c<=h&&(h=c,s.set(0,1,0)),u<=h&&s.set(0,0,1),a.crossVectors(i[0],s).normalize(),r[0].crossVectors(i[0],a),n[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),n[e]=n[e-1].clone(),a.crossVectors(i[e-1],i[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(Ms(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}n[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(Ms(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let s=1;s<=t;s++)r[s].applyMatrix4(o.makeRotationAxis(i[s],e*s)),n[s].crossVectors(i[s],r[s])}return{tangents:i,normals:r,binormals:n}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Ca extends Ta{constructor(t=0,e=0,s=1,i=1,r=0,n=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=s,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=n,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new As){const s=e,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const n=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=n?0:i),!0!==this.aClockwise||n||(r===i?r=-i:r-=i);const a=this.aStartAngle+t*r;let o=this.aX+this.xRadius*Math.cos(a),h=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),s=o-this.aX,i=h-this.aY;o=s*t-i*e+this.aX,h=s*e+i*t+this.aY}return s.set(o,h)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class ka extends Ca{constructor(t,e,s,i,r,n){super(t,e,s,s,i,r,n),this.isArcCurve=!0,this.type="ArcCurve"}}function Ba(){let t=0,e=0,s=0,i=0;function r(r,n,a,o){t=r,e=a,s=-3*r+3*n-2*a-o,i=2*r-2*n+a+o}return{initCatmullRom:function(t,e,s,i,n){r(e,s,n*(s-t),n*(i-e))},initNonuniformCatmullRom:function(t,e,s,i,n,a,o){let h=(e-t)/n-(s-t)/(n+a)+(s-e)/a,l=(s-e)/a-(i-e)/(a+o)+(i-s)/o;h*=a,l*=a,r(e,s,h,l)},calc:function(r){const n=r*r;return t+e*r+s*n+i*(n*r)}}}const Oa=new Cs,Na=new Ba,Pa=new Ba,Ia=new Ba;class Ra extends Ta{constructor(t=[],e=!1,s="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=s,this.tension=i}getPoint(t,e=new Cs){const s=e,i=this.points,r=i.length,n=(r-(this.closed?0:1))*t;let a,o,h=Math.floor(n),l=n-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/r)+1)*r:0===l&&h===r-1&&(h=r-2,l=1),this.closed||h>0?a=i[(h-1)%r]:(Oa.subVectors(i[0],i[1]).add(i[0]),a=Oa);const c=i[h%r],u=i[(h+1)%r];if(this.closed||h+2<r?o=i[(h+2)%r]:(Oa.subVectors(i[r-1],i[r-2]).add(i[r-1]),o=Oa),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(a.distanceToSquared(c),t),s=Math.pow(c.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(o),t);s<1e-4&&(s=1),e<1e-4&&(e=s),i<1e-4&&(i=s),Na.initNonuniformCatmullRom(a.x,c.x,u.x,o.x,e,s,i),Pa.initNonuniformCatmullRom(a.y,c.y,u.y,o.y,e,s,i),Ia.initNonuniformCatmullRom(a.z,c.z,u.z,o.z,e,s,i)}else"catmullrom"===this.curveType&&(Na.initCatmullRom(a.x,c.x,u.x,o.x,this.tension),Pa.initCatmullRom(a.y,c.y,u.y,o.y,this.tension),Ia.initCatmullRom(a.z,c.z,u.z,o.z,this.tension));return s.set(Na.calc(l),Pa.calc(l),Ia.calc(l)),s}copy(t){super.copy(t),this.points=[];for(let e=0,s=t.points.length;e<s;e++){const s=t.points[e];this.points.push(s.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,s=this.points.length;e<s;e++){const s=this.points[e];t.points.push(s.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,s=t.points.length;e<s;e++){const s=t.points[e];this.points.push((new Cs).fromArray(s))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Va(t,e,s,i,r){const n=.5*(i-e),a=.5*(r-s),o=t*t;return(2*s-2*i+n+a)*(t*o)+(-3*s+3*i-2*n-a)*o+n*t+s}function La(t,e,s,i){return function(t,e){const s=1-t;return s*s*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,s)+function(t,e){return t*t*e}(t,i)}function Ea(t,e,s,i,r){return function(t,e){const s=1-t;return s*s*s*e}(t,e)+function(t,e){const s=1-t;return 3*s*s*t*e}(t,s)+function(t,e){return 3*(1-t)*t*t*e}(t,i)+function(t,e){return t*t*t*e}(t,r)}class Fa extends Ta{constructor(t=new As,e=new As,s=new As,i=new As){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=s,this.v3=i}getPoint(t,e=new As){const s=e,i=this.v0,r=this.v1,n=this.v2,a=this.v3;return s.set(Ea(t,i.x,r.x,n.x,a.x),Ea(t,i.y,r.y,n.y,a.y)),s}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class Da extends Ta{constructor(t=new Cs,e=new Cs,s=new Cs,i=new Cs){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=s,this.v3=i}getPoint(t,e=new Cs){const s=e,i=this.v0,r=this.v1,n=this.v2,a=this.v3;return s.set(Ea(t,i.x,r.x,n.x,a.x),Ea(t,i.y,r.y,n.y,a.y),Ea(t,i.z,r.z,n.z,a.z)),s}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class Ua extends Ta{constructor(t=new As,e=new As){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new As){const s=e;return 1===t?s.copy(this.v2):(s.copy(this.v2).sub(this.v1),s.multiplyScalar(t).add(this.v1)),s}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new As){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class ja extends Ta{constructor(t=new Cs,e=new Cs){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new Cs){const s=e;return 1===t?s.copy(this.v2):(s.copy(this.v2).sub(this.v1),s.multiplyScalar(t).add(this.v1)),s}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Cs){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Wa extends Ta{constructor(t=new As,e=new As,s=new As){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=s}getPoint(t,e=new As){const s=e,i=this.v0,r=this.v1,n=this.v2;return s.set(La(t,i.x,r.x,n.x),La(t,i.y,r.y,n.y)),s}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Ja extends Ta{constructor(t=new Cs,e=new Cs,s=new Cs){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=s}getPoint(t,e=new Cs){const s=e,i=this.v0,r=this.v1,n=this.v2;return s.set(La(t,i.x,r.x,n.x),La(t,i.y,r.y,n.y),La(t,i.z,r.z,n.z)),s}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class qa extends Ta{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new As){const s=e,i=this.points,r=(i.length-1)*t,n=Math.floor(r),a=r-n,o=i[0===n?n:n-1],h=i[n],l=i[n>i.length-2?i.length-1:n+1],c=i[n>i.length-3?i.length-1:n+2];return s.set(Va(a,o.x,h.x,l.x,c.x),Va(a,o.y,h.y,l.y,c.y)),s}copy(t){super.copy(t),this.points=[];for(let e=0,s=t.points.length;e<s;e++){const s=t.points[e];this.points.push(s.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,s=this.points.length;e<s;e++){const s=this.points[e];t.points.push(s.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,s=t.points.length;e<s;e++){const s=t.points[e];this.points.push((new As).fromArray(s))}return this}}var Xa=Object.freeze({__proto__:null,ArcCurve:ka,CatmullRomCurve3:Ra,CubicBezierCurve:Fa,CubicBezierCurve3:Da,EllipseCurve:Ca,LineCurve:Ua,LineCurve3:ja,QuadraticBezierCurve:Wa,QuadraticBezierCurve3:Ja,SplineCurve:qa});class Ya extends Ta{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const s=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new Xa[s](e,t))}return this}getPoint(t,e){const s=t*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=s){const t=i[r]-s,n=this.curves[r],a=n.getLength(),o=0===a?0:1-t/a;return n.getPointAt(o,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let s=0,i=this.curves.length;s<i;s++)e+=this.curves[s].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let s=0;s<=t;s++)e.push(this.getPoint(s/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let s;for(let i=0,r=this.curves;i<r.length;i++){const n=r[i],a=n.isEllipseCurve?2*t:n.isLineCurve||n.isLineCurve3?1:n.isSplineCurve?t*n.points.length:t,o=n.getPoints(a);for(let t=0;t<o.length;t++){const i=o[t];s&&s.equals(i)||(e.push(i),s=i)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,s=t.curves.length;e<s;e++){const s=t.curves[e];this.curves.push(s.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,s=this.curves.length;e<s;e++){const s=this.curves[e];t.curves.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,s=t.curves.length;e<s;e++){const s=t.curves[e];this.curves.push((new Xa[s.type]).fromJSON(s))}return this}}class Za extends Ya{constructor(t){super(),this.type="Path",this.currentPoint=new As,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,s=t.length;e<s;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const s=new Ua(this.currentPoint.clone(),new As(t,e));return this.curves.push(s),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,s,i){const r=new Wa(this.currentPoint.clone(),new As(t,e),new As(s,i));return this.curves.push(r),this.currentPoint.set(s,i),this}bezierCurveTo(t,e,s,i,r,n){const a=new Fa(this.currentPoint.clone(),new As(t,e),new As(s,i),new As(r,n));return this.curves.push(a),this.currentPoint.set(r,n),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),s=new qa(e);return this.curves.push(s),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,s,i,r,n){const a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,s,i,r,n),this}absarc(t,e,s,i,r,n){return this.absellipse(t,e,s,s,i,r,n),this}ellipse(t,e,s,i,r,n,a,o){const h=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+h,e+l,s,i,r,n,a,o),this}absellipse(t,e,s,i,r,n,a,o){const h=new Ca(t,e,s,i,r,n,a,o);if(this.curves.length>0){const t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);const l=h.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class Ha extends Za{constructor(t){super(t),this.uuid=bs(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let s=0,i=this.holes.length;s<i;s++)e[s]=this.holes[s].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,s=t.holes.length;e<s;e++){const s=t.holes[e];this.holes.push(s.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,s=this.holes.length;e<s;e++){const s=this.holes[e];t.holes.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,s=t.holes.length;e<s;e++){const s=t.holes[e];this.holes.push((new Za).fromJSON(s))}return this}}function Ga(t,e,s=2){const i=e&&e.length,r=i?e[0]*s:t.length;let n=$a(t,0,r,s,!0);const a=[];if(!n||n.next===n.prev)return a;let o,h,l;if(i&&(n=function(t,e,s,i){const r=[];for(let s=0,n=e.length;s<n;s++){const a=$a(t,e[s]*i,s<n-1?e[s+1]*i:t.length,i,!1);a===a.next&&(a.steiner=!0),r.push(ho(a))}r.sort(ro);for(let t=0;t<r.length;t++)s=no(r[t],s);return s}(t,e,n,s)),t.length>80*s){o=t[0],h=t[1];let e=o,i=h;for(let n=s;n<r;n+=s){const s=t[n],r=t[n+1];s<o&&(o=s),r<h&&(h=r),s>e&&(e=s),r>i&&(i=r)}l=Math.max(e-o,i-h),l=0!==l?32767/l:0}return Ka(n,a,s,o,h,l,0),a}function $a(t,e,s,i,r){let n;if(r===function(t,e,s,i){let r=0;for(let n=e,a=s-i;n<s;n+=i)r+=(t[a]-t[n])*(t[n+1]+t[a+1]),a=n;return r}(t,e,s,i)>0)for(let r=e;r<s;r+=i)n=Mo(r/i|0,t[r],t[r+1],n);else for(let r=s-i;r>=e;r-=i)n=Mo(r/i|0,t[r],t[r+1],n);return n&&mo(n,n.next)&&(vo(n),n=n.next),n}function Qa(t,e){if(!t)return t;e||(e=t);let s,i=t;do{if(s=!1,i.steiner||!mo(i,i.next)&&0!==po(i.prev,i,i.next))i=i.next;else{if(vo(i),i=e=i.prev,i===i.next)break;s=!0}}while(s||i!==e);return e}function Ka(t,e,s,i,r,n,a){if(!t)return;!a&&n&&function(t,e,s,i){let r=t;do{0===r.z&&(r.z=oo(r.x,r.y,e,s,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,s=1;do{let i,r=t;t=null;let n=null;for(e=0;r;){e++;let a=r,o=0;for(let t=0;t<s&&(o++,a=a.nextZ,a);t++);let h=s;for(;o>0||h>0&&a;)0!==o&&(0===h||!a||r.z<=a.z)?(i=r,r=r.nextZ,o--):(i=a,a=a.nextZ,h--),n?n.nextZ=i:t=i,i.prevZ=n,n=i;r=a}n.nextZ=null,s*=2}while(e>1)}(r)}(t,i,r,n);let o=t;for(;t.prev!==t.next;){const h=t.prev,l=t.next;if(n?eo(t,i,r,n):to(t))e.push(h.i,t.i,l.i),vo(t),t=l.next,o=l.next;else if((t=l)===o){a?1===a?Ka(t=so(Qa(t),e),e,s,i,r,n,2):2===a&&io(t,e,s,i,r,n):Ka(Qa(t),e,s,i,r,n,1);break}}}function to(t){const e=t.prev,s=t,i=t.next;if(po(e,s,i)>=0)return!1;const r=e.x,n=s.x,a=i.x,o=e.y,h=s.y,l=i.y,c=Math.min(r,n,a),u=Math.min(o,h,l),p=Math.max(r,n,a),d=Math.max(o,h,l);let m=i.next;for(;m!==e;){if(m.x>=c&&m.x<=p&&m.y>=u&&m.y<=d&&co(r,o,n,h,a,l,m.x,m.y)&&po(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function eo(t,e,s,i){const r=t.prev,n=t,a=t.next;if(po(r,n,a)>=0)return!1;const o=r.x,h=n.x,l=a.x,c=r.y,u=n.y,p=a.y,d=Math.min(o,h,l),m=Math.min(c,u,p),y=Math.max(o,h,l),f=Math.max(c,u,p),g=oo(d,m,e,s,i),x=oo(y,f,e,s,i);let b=t.prevZ,M=t.nextZ;for(;b&&b.z>=g&&M&&M.z<=x;){if(b.x>=d&&b.x<=y&&b.y>=m&&b.y<=f&&b!==r&&b!==a&&co(o,c,h,u,l,p,b.x,b.y)&&po(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,M.x>=d&&M.x<=y&&M.y>=m&&M.y<=f&&M!==r&&M!==a&&co(o,c,h,u,l,p,M.x,M.y)&&po(M.prev,M,M.next)>=0)return!1;M=M.nextZ}for(;b&&b.z>=g;){if(b.x>=d&&b.x<=y&&b.y>=m&&b.y<=f&&b!==r&&b!==a&&co(o,c,h,u,l,p,b.x,b.y)&&po(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;M&&M.z<=x;){if(M.x>=d&&M.x<=y&&M.y>=m&&M.y<=f&&M!==r&&M!==a&&co(o,c,h,u,l,p,M.x,M.y)&&po(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function so(t,e){let s=t;do{const i=s.prev,r=s.next.next;!mo(i,r)&&yo(i,s,s.next,r)&&xo(i,r)&&xo(r,i)&&(e.push(i.i,s.i,r.i),vo(s),vo(s.next),s=t=r),s=s.next}while(s!==t);return Qa(s)}function io(t,e,s,i,r,n){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&uo(a,t)){let o=bo(a,t);return a=Qa(a,a.next),o=Qa(o,o.next),Ka(a,e,s,i,r,n,0),void Ka(o,e,s,i,r,n,0)}t=t.next}a=a.next}while(a!==t)}function ro(t,e){let s=t.x-e.x;if(0===s&&(s=t.y-e.y,0===s)){s=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return s}function no(t,e){const s=function(t,e){let s=e;const i=t.x,r=t.y;let n,a=-1/0;if(mo(t,s))return s;do{if(mo(t,s.next))return s.next;if(r<=s.y&&r>=s.next.y&&s.next.y!==s.y){const t=s.x+(r-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(t<=i&&t>a&&(a=t,n=s.x<s.next.x?s:s.next,t===i))return n}s=s.next}while(s!==e);if(!n)return null;const o=n,h=n.x,l=n.y;let c=1/0;s=n;do{if(i>=s.x&&s.x>=h&&i!==s.x&&lo(r<l?i:a,r,h,l,r<l?a:i,r,s.x,s.y)){const e=Math.abs(r-s.y)/(i-s.x);xo(s,t)&&(e<c||e===c&&(s.x>n.x||s.x===n.x&&ao(n,s)))&&(n=s,c=e)}s=s.next}while(s!==o);return n}(t,e);if(!s)return e;const i=bo(s,t);return Qa(i,i.next),Qa(s,s.next)}function ao(t,e){return po(t.prev,t,e.prev)<0&&po(e.next,t,t.next)<0}function oo(t,e,s,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ho(t){let e=t,s=t;do{(e.x<s.x||e.x===s.x&&e.y<s.y)&&(s=e),e=e.next}while(e!==t);return s}function lo(t,e,s,i,r,n,a,o){return(r-a)*(e-o)>=(t-a)*(n-o)&&(t-a)*(i-o)>=(s-a)*(e-o)&&(s-a)*(n-o)>=(r-a)*(i-o)}function co(t,e,s,i,r,n,a,o){return!(t===a&&e===o)&&lo(t,e,s,i,r,n,a,o)}function uo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let s=t;do{if(s.i!==t.i&&s.next.i!==t.i&&s.i!==e.i&&s.next.i!==e.i&&yo(s,s.next,t,e))return!0;s=s.next}while(s!==t);return!1}(t,e)&&(xo(t,e)&&xo(e,t)&&function(t,e){let s=t,i=!1;const r=(t.x+e.x)/2,n=(t.y+e.y)/2;do{s.y>n!=s.next.y>n&&s.next.y!==s.y&&r<(s.next.x-s.x)*(n-s.y)/(s.next.y-s.y)+s.x&&(i=!i),s=s.next}while(s!==t);return i}(t,e)&&(po(t.prev,t,e.prev)||po(t,e.prev,e))||mo(t,e)&&po(t.prev,t,t.next)>0&&po(e.prev,e,e.next)>0)}function po(t,e,s){return(e.y-t.y)*(s.x-e.x)-(e.x-t.x)*(s.y-e.y)}function mo(t,e){return t.x===e.x&&t.y===e.y}function yo(t,e,s,i){const r=go(po(t,e,s)),n=go(po(t,e,i)),a=go(po(s,i,t)),o=go(po(s,i,e));return r!==n&&a!==o||(!(0!==r||!fo(t,s,e))||(!(0!==n||!fo(t,i,e))||(!(0!==a||!fo(s,t,i))||!(0!==o||!fo(s,e,i)))))}function fo(t,e,s){return e.x<=Math.max(t.x,s.x)&&e.x>=Math.min(t.x,s.x)&&e.y<=Math.max(t.y,s.y)&&e.y>=Math.min(t.y,s.y)}function go(t){return t>0?1:t<0?-1:0}function xo(t,e){return po(t.prev,t,t.next)<0?po(t,e,t.next)>=0&&po(t,t.prev,e)>=0:po(t,e,t.prev)<0||po(t,t.next,e)<0}function bo(t,e){const s=wo(t.i,t.x,t.y),i=wo(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,s.next=r,r.prev=s,i.next=s,s.prev=i,n.next=i,i.prev=n,i}function Mo(t,e,s,i){const r=wo(t,e,s);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function vo(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function wo(t,e,s){return{i:t,x:e,y:s,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class So{static triangulate(t,e,s=2){return Ga(t,e,s)}}class _o{static area(t){const e=t.length;let s=0;for(let i=e-1,r=0;r<e;i=r++)s+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*s}static isClockWise(t){return _o.area(t)<0}static triangulateShape(t,e){const s=[],i=[],r=[];zo(t),Ao(s,t);let n=t.length;e.forEach(zo);for(let t=0;t<e.length;t++)i.push(n),n+=e[t].length,Ao(s,e[t]);const a=So.triangulate(s,i);for(let t=0;t<a.length;t+=3)r.push(a.slice(t,t+3));return r}}function zo(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Ao(t,e){for(let s=0;s<e.length;s++)t.push(e[s].x),t.push(e[s].y)}class To extends Fr{constructor(t=new Ha([new As(.5,.5),new As(-.5,.5),new As(-.5,-.5),new As(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const s=this,i=[],r=[];for(let e=0,s=t.length;e<s;e++){n(t[e])}function n(t){const n=[],a=void 0!==e.curveSegments?e.curveSegments:12,o=void 0!==e.steps?e.steps:1,h=void 0!==e.depth?e.depth:1;let l=void 0===e.bevelEnabled||e.bevelEnabled,c=void 0!==e.bevelThickness?e.bevelThickness:.2,u=void 0!==e.bevelSize?e.bevelSize:c-.1,p=void 0!==e.bevelOffset?e.bevelOffset:0,d=void 0!==e.bevelSegments?e.bevelSegments:3;const m=e.extrudePath,y=void 0!==e.UVGenerator?e.UVGenerator:Co;let f,g,x,b,M,v=!1;if(m){f=m.getSpacedPoints(o),v=!0,l=!1;const t=!!m.isCatmullRomCurve3&&m.closed;g=m.computeFrenetFrames(o,t),x=new Cs,b=new Cs,M=new Cs}l||(d=0,c=0,u=0,p=0);const w=t.extractPoints(a);let S=w.shape;const _=w.holes;if(!_o.isClockWise(S)){S=S.reverse();for(let t=0,e=_.length;t<e;t++){const e=_[t];_o.isClockWise(e)&&(_[t]=e.reverse())}}function z(t){const e=1e-10*1e-10;let s=t[0];for(let i=1;i<=t.length;i++){const r=i%t.length,n=t[r],a=n.x-s.x,o=n.y-s.y,h=a*a+o*o,l=Math.max(Math.abs(n.x),Math.abs(n.y),Math.abs(s.x),Math.abs(s.y));h<=e*l*l?(t.splice(r,1),i--):s=n}}z(S),_.forEach(z);const A=_.length,T=S;for(let t=0;t<A;t++){const e=_[t];S=S.concat(e)}function C(t,e,s){return e||us("ExtrudeGeometry: vec does not exist"),t.clone().addScaledVector(e,s)}const k=S.length;function B(t,e,s){let i,r,n;const a=t.x-e.x,o=t.y-e.y,h=s.x-t.x,l=s.y-t.y,c=a*a+o*o,u=a*l-o*h;if(Math.abs(u)>Number.EPSILON){const u=Math.sqrt(c),p=Math.sqrt(h*h+l*l),d=e.x-o/u,m=e.y+a/u,y=((s.x-l/p-d)*l-(s.y+h/p-m)*h)/(a*l-o*h);i=d+a*y-t.x,r=m+o*y-t.y;const f=i*i+r*r;if(f<=2)return new As(i,r);n=Math.sqrt(f/2)}else{let t=!1;a>Number.EPSILON?h>Number.EPSILON&&(t=!0):a<-Number.EPSILON?h<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(l)&&(t=!0),t?(i=-o,r=a,n=Math.sqrt(c)):(i=a,r=o,n=Math.sqrt(c/2))}return new As(i/n,r/n)}const O=[];for(let t=0,e=T.length,s=e-1,i=t+1;t<e;t++,s++,i++)s===e&&(s=0),i===e&&(i=0),O[t]=B(T[t],T[s],T[i]);const N=[];let P,I,R=O.concat();for(let t=0,e=A;t<e;t++){const e=_[t];P=[];for(let t=0,s=e.length,i=s-1,r=t+1;t<s;t++,i++,r++)i===s&&(i=0),r===s&&(r=0),P[t]=B(e[t],e[i],e[r]);N.push(P),R=R.concat(P)}if(0===d)I=_o.triangulateShape(T,_);else{const t=[],e=[];for(let s=0;s<d;s++){const i=s/d,r=c*Math.cos(i*Math.PI/2),n=u*Math.sin(i*Math.PI/2)+p;for(let e=0,s=T.length;e<s;e++){const s=C(T[e],O[e],n);F(s.x,s.y,-r),0===i&&t.push(s)}for(let t=0,s=A;t<s;t++){const s=_[t];P=N[t];const a=[];for(let t=0,e=s.length;t<e;t++){const e=C(s[t],P[t],n);F(e.x,e.y,-r),0===i&&a.push(e)}0===i&&e.push(a)}}I=_o.triangulateShape(t,e)}const V=I.length,L=u+p;for(let t=0;t<k;t++){const e=l?C(S[t],R[t],L):S[t];v?(b.copy(g.normals[0]).multiplyScalar(e.x),x.copy(g.binormals[0]).multiplyScalar(e.y),M.copy(f[0]).add(b).add(x),F(M.x,M.y,M.z)):F(e.x,e.y,0)}for(let t=1;t<=o;t++)for(let e=0;e<k;e++){const s=l?C(S[e],R[e],L):S[e];v?(b.copy(g.normals[t]).multiplyScalar(s.x),x.copy(g.binormals[t]).multiplyScalar(s.y),M.copy(f[t]).add(b).add(x),F(M.x,M.y,M.z)):F(s.x,s.y,h/o*t)}for(let t=d-1;t>=0;t--){const e=t/d,s=c*Math.cos(e*Math.PI/2),i=u*Math.sin(e*Math.PI/2)+p;for(let t=0,e=T.length;t<e;t++){const e=C(T[t],O[t],i);F(e.x,e.y,h+s)}for(let t=0,e=_.length;t<e;t++){const e=_[t];P=N[t];for(let t=0,r=e.length;t<r;t++){const r=C(e[t],P[t],i);v?F(r.x,r.y+f[o-1].y,f[o-1].x+s):F(r.x,r.y,h+s)}}}function E(t,e){let s=t.length;for(;--s>=0;){const i=s;let r=s-1;r<0&&(r=t.length-1);for(let t=0,s=o+2*d;t<s;t++){const s=k*t,n=k*(t+1);U(e+i+s,e+r+s,e+r+n,e+i+n)}}}function F(t,e,s){n.push(t),n.push(e),n.push(s)}function D(t,e,r){j(t),j(e),j(r);const n=i.length/3,a=y.generateTopUV(s,i,n-3,n-2,n-1);W(a[0]),W(a[1]),W(a[2])}function U(t,e,r,n){j(t),j(e),j(n),j(e),j(r),j(n);const a=i.length/3,o=y.generateSideWallUV(s,i,a-6,a-3,a-2,a-1);W(o[0]),W(o[1]),W(o[3]),W(o[1]),W(o[2]),W(o[3])}function j(t){i.push(n[3*t+0]),i.push(n[3*t+1]),i.push(n[3*t+2])}function W(t){r.push(t.x),r.push(t.y)}!function(){const t=i.length/3;if(l){let t=0,e=k*t;for(let t=0;t<V;t++){const s=I[t];D(s[2]+e,s[1]+e,s[0]+e)}t=o+2*d,e=k*t;for(let t=0;t<V;t++){const s=I[t];D(s[0]+e,s[1]+e,s[2]+e)}}else{for(let t=0;t<V;t++){const e=I[t];D(e[2],e[1],e[0])}for(let t=0;t<V;t++){const e=I[t];D(e[0]+k*o,e[1]+k*o,e[2]+k*o)}}s.addGroup(t,i.length/3-t,0)}(),function(){const t=i.length/3;let e=0;E(T,e),e+=T.length;for(let t=0,s=_.length;t<s;t++){const s=_[t];E(s,e),e+=s.length}s.addGroup(t,i.length/3-t,1)}()}this.setAttribute("position",new Or(i,3)),this.setAttribute("uv",new Or(r,2)),this.computeVertexNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e,s){if(s.shapes=[],Array.isArray(t))for(let e=0,i=t.length;e<i;e++){const i=t[e];s.shapes.push(i.uuid)}else s.shapes.push(t.uuid);s.options=Object.assign({},e),void 0!==e.extrudePath&&(s.options.extrudePath=e.extrudePath.toJSON());return s}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const s=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];s.push(r)}const i=t.options.extrudePath;return void 0!==i&&(t.options.extrudePath=(new Xa[i.type]).fromJSON(i)),new To(s,t.options)}}const Co={generateTopUV:function(t,e,s,i,r){const n=e[3*s],a=e[3*s+1],o=e[3*i],h=e[3*i+1],l=e[3*r],c=e[3*r+1];return[new As(n,a),new As(o,h),new As(l,c)]},generateSideWallUV:function(t,e,s,i,r,n){const a=e[3*s],o=e[3*s+1],h=e[3*s+2],l=e[3*i],c=e[3*i+1],u=e[3*i+2],p=e[3*r],d=e[3*r+1],m=e[3*r+2],y=e[3*n],f=e[3*n+1],g=e[3*n+2];return Math.abs(o-c)<Math.abs(a-l)?[new As(a,1-h),new As(l,1-u),new As(p,1-m),new As(y,1-g)]:[new As(o,1-h),new As(c,1-u),new As(d,1-m),new As(f,1-g)]}};class ko extends Aa{constructor(t=1,e=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],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new ko(t.radius,t.detail)}}class Bo extends Fr{constructor(t=1,e=1,s=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:s,heightSegments:i};const r=t/2,n=e/2,a=Math.floor(s),o=Math.floor(i),h=a+1,l=o+1,c=t/a,u=e/o,p=[],d=[],m=[],y=[];for(let t=0;t<l;t++){const e=t*u-n;for(let s=0;s<h;s++){const i=s*c-r;d.push(i,-e,0),m.push(0,0,1),y.push(s/a),y.push(1-t/o)}}for(let t=0;t<o;t++)for(let e=0;e<a;e++){const s=e+h*t,i=e+h*(t+1),r=e+1+h*(t+1),n=e+1+h*t;p.push(s,i,n),p.push(i,r,n)}this.setIndex(p),this.setAttribute("position",new Or(d,3)),this.setAttribute("normal",new Or(m,3)),this.setAttribute("uv",new Or(y,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Bo(t.width,t.height,t.widthSegments,t.heightSegments)}}class Oo extends Fr{constructor(t=1,e=32,s=16,i=0,r=2*Math.PI,n=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:s,phiStart:i,phiLength:r,thetaStart:n,thetaLength:a},e=Math.max(3,Math.floor(e)),s=Math.max(2,Math.floor(s));const o=Math.min(n+a,Math.PI);let h=0;const l=[],c=new Cs,u=new Cs,p=[],d=[],m=[],y=[];for(let p=0;p<=s;p++){const f=[],g=p/s;let x=0;0===p&&0===n?x=.5/e:p===s&&o===Math.PI&&(x=-.5/e);for(let s=0;s<=e;s++){const o=s/e;c.x=-t*Math.cos(i+o*r)*Math.sin(n+g*a),c.y=t*Math.cos(n+g*a),c.z=t*Math.sin(i+o*r)*Math.sin(n+g*a),d.push(c.x,c.y,c.z),u.copy(c).normalize(),m.push(u.x,u.y,u.z),y.push(o+x,1-g),f.push(h++)}l.push(f)}for(let t=0;t<s;t++)for(let i=0;i<e;i++){const e=l[t][i+1],r=l[t][i],a=l[t+1][i],h=l[t+1][i+1];(0!==t||n>0)&&p.push(e,r,h),(t!==s-1||o<Math.PI)&&p.push(r,a,h)}this.setIndex(p),this.setAttribute("position",new Or(d,3)),this.setAttribute("normal",new Or(m,3)),this.setAttribute("uv",new Or(y,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Oo(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class No extends Fr{constructor(t=1,e=.4,s=12,i=48,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:s,tubularSegments:i,arc:r},s=Math.floor(s),i=Math.floor(i);const n=[],a=[],o=[],h=[],l=new Cs,c=new Cs,u=new Cs;for(let n=0;n<=s;n++)for(let p=0;p<=i;p++){const d=p/i*r,m=n/s*Math.PI*2;c.x=(t+e*Math.cos(m))*Math.cos(d),c.y=(t+e*Math.cos(m))*Math.sin(d),c.z=e*Math.sin(m),a.push(c.x,c.y,c.z),l.x=t*Math.cos(d),l.y=t*Math.sin(d),u.subVectors(c,l).normalize(),o.push(u.x,u.y,u.z),h.push(p/i),h.push(n/s)}for(let t=1;t<=s;t++)for(let e=1;e<=i;e++){const s=(i+1)*t+e-1,r=(i+1)*(t-1)+e-1,a=(i+1)*(t-1)+e,o=(i+1)*t+e;n.push(s,r,o),n.push(r,a,o)}this.setIndex(n),this.setAttribute("position",new Or(a,3)),this.setAttribute("normal",new Or(o,3)),this.setAttribute("uv",new Or(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new No(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class Po extends nn{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Io extends Mr{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new gr(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new As(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 Ri,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Ro extends Io{constructor(t){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 As(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ms(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new gr(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 gr(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new gr(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(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class Vo extends Mr{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new gr(16777215),this.specular=new gr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new As(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ri,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Lo extends Mr{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new As(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class Eo extends Mr{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new gr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new As(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ri,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class Fo extends Mr{constructor(t){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(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class Do extends Mr{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function Uo(t,e){return t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function jo(t){const e=t.length,s=new Array(e);for(let t=0;t!==e;++t)s[t]=t;return s.sort(function(e,s){return t[e]-t[s]}),s}function Wo(t,e,s){const i=t.length,r=new t.constructor(i);for(let n=0,a=0;a!==i;++n){const i=s[n]*e;for(let s=0;s!==e;++s)r[a++]=t[i+s]}return r}function Jo(t,e,s,i){let r=1,n=t[0];for(;void 0!==n&&void 0===n[i];)n=t[r++];if(void 0===n)return;let a=n[i];if(void 0!==a)if(Array.isArray(a))do{a=n[i],void 0!==a&&(e.push(n.time),s.push(...a)),n=t[r++]}while(void 0!==n);else if(void 0!==a.toArray)do{a=n[i],void 0!==a&&(e.push(n.time),a.toArray(s,s.length)),n=t[r++]}while(void 0!==n);else do{a=n[i],void 0!==a&&(e.push(n.time),s.push(a)),n=t[r++]}while(void 0!==n)}class qo{constructor(t,e,s,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(s),this.sampleValues=e,this.valueSize=s,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let s=this._cachedIndex,i=e[s],r=e[s-1];t:{e:{let n;s:{i:if(!(t<i)){for(let n=s+2;;){if(void 0===i){if(t<r)break i;return s=e.length,this._cachedIndex=s,this.copySampleValue_(s-1)}if(s===n)break;if(r=i,i=e[++s],t<i)break e}n=e.length;break s}if(!(t>=r)){const a=e[1];t<a&&(s=2,r=a);for(let n=s-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(s===n)break;if(i=r,r=e[--s-1],t>=r)break e}n=s,s=0;break s}break t}for(;s<n;){const i=s+n>>>1;t<e[i]?n=i:s=i+1}if(i=e[s],r=e[s-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return s=e.length,this._cachedIndex=s,this.copySampleValue_(s-1)}this._cachedIndex=s,this.intervalChanged_(s,r,i)}return this.interpolate_(s,r,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,s=this.sampleValues,i=this.valueSize,r=t*i;for(let t=0;t!==i;++t)e[t]=s[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Xo extends qo{constructor(t,e,s,i){super(t,e,s,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ce,endingEnd:Ce}}intervalChanged_(t,e,s){const i=this.parameterPositions;let r=t-2,n=t+1,a=i[r],o=i[n];if(void 0===a)switch(this.getSettings_().endingStart){case ke:r=t,a=2*e-s;break;case Be:r=i.length-2,a=e+i[r]-i[r+1];break;default:r=t,a=s}if(void 0===o)switch(this.getSettings_().endingEnd){case ke:n=t,o=2*s-e;break;case Be:n=1,o=s+i[1]-i[0];break;default:n=t-1,o=e}const h=.5*(s-e),l=this.valueSize;this._weightPrev=h/(e-a),this._weightNext=h/(o-s),this._offsetPrev=r*l,this._offsetNext=n*l}interpolate_(t,e,s,i){const r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=t*a,h=o-a,l=this._offsetPrev,c=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(s-e)/(i-e),m=d*d,y=m*d,f=-u*y+2*u*m-u*d,g=(1+u)*y+(-1.5-2*u)*m+(-.5+u)*d+1,x=(-1-p)*y+(1.5+p)*m+.5*d,b=p*y-p*m;for(let t=0;t!==a;++t)r[t]=f*n[l+t]+g*n[h+t]+x*n[o+t]+b*n[c+t];return r}}class Yo extends qo{constructor(t,e,s,i){super(t,e,s,i)}interpolate_(t,e,s,i){const r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=t*a,h=o-a,l=(s-e)/(i-e),c=1-l;for(let t=0;t!==a;++t)r[t]=n[h+t]*c+n[o+t]*l;return r}}class Zo extends qo{constructor(t,e,s,i){super(t,e,s,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class Ho{constructor(t,e,s,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Uo(e,this.TimeBufferType),this.values=Uo(s,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let s;if(e.toJSON!==this.toJSON)s=e.toJSON(t);else{s={name:t.name,times:Uo(t.times,Array),values:Uo(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(s.interpolation=e)}return s.type=t.ValueTypeName,s}InterpolantFactoryMethodDiscrete(t){return new Zo(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Yo(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Xo(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case ze:e=this.InterpolantFactoryMethodDiscrete;break;case Ae:e=this.InterpolantFactoryMethodLinear;break;case Te:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return cs("KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ze;case this.InterpolantFactoryMethodLinear:return Ae;case this.InterpolantFactoryMethodSmooth:return Te}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let s=0,i=e.length;s!==i;++s)e[s]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let s=0,i=e.length;s!==i;++s)e[s]*=t}return this}trim(t,e){const s=this.times,i=s.length;let r=0,n=i-1;for(;r!==i&&s[r]<t;)++r;for(;-1!==n&&s[n]>e;)--n;if(++n,0!==r||n!==i){r>=n&&(n=Math.max(n,1),r=n-1);const t=this.getValueSize();this.times=s.slice(r,n),this.values=this.values.slice(r*t,n*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(us("KeyframeTrack: Invalid value size in track.",this),t=!1);const s=this.times,i=this.values,r=s.length;0===r&&(us("KeyframeTrack: Track is empty.",this),t=!1);let n=null;for(let e=0;e!==r;e++){const i=s[e];if("number"==typeof i&&isNaN(i)){us("KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==n&&n>i){us("KeyframeTrack: Out of order keys.",this,e,i,n),t=!1;break}n=i}if(void 0!==i&&ns(i))for(let e=0,s=i.length;e!==s;++e){const s=i[e];if(isNaN(s)){us("KeyframeTrack: Value is not a valid number.",this,e,s),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),s=this.getValueSize(),i=this.getInterpolation()===Te,r=t.length-1;let n=1;for(let a=1;a<r;++a){let r=!1;const o=t[a];if(o!==t[a+1]&&(1!==a||o!==t[0]))if(i)r=!0;else{const t=a*s,i=t-s,n=t+s;for(let a=0;a!==s;++a){const s=e[t+a];if(s!==e[i+a]||s!==e[n+a]){r=!0;break}}}if(r){if(a!==n){t[n]=t[a];const i=a*s,r=n*s;for(let t=0;t!==s;++t)e[r+t]=e[i+t]}++n}}if(r>0){t[n]=t[r];for(let t=r*s,i=n*s,a=0;a!==s;++a)e[i+a]=e[t+a];++n}return n!==t.length?(this.times=t.slice(0,n),this.values=e.slice(0,n*s)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),s=new(0,this.constructor)(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}}Ho.prototype.ValueTypeName="",Ho.prototype.TimeBufferType=Float32Array,Ho.prototype.ValueBufferType=Float32Array,Ho.prototype.DefaultInterpolation=Ae;class Go extends Ho{constructor(t,e,s){super(t,e,s)}}Go.prototype.ValueTypeName="bool",Go.prototype.ValueBufferType=Array,Go.prototype.DefaultInterpolation=ze,Go.prototype.InterpolantFactoryMethodLinear=void 0,Go.prototype.InterpolantFactoryMethodSmooth=void 0;class $o extends Ho{constructor(t,e,s,i){super(t,e,s,i)}}$o.prototype.ValueTypeName="color";class Qo extends Ho{constructor(t,e,s,i){super(t,e,s,i)}}Qo.prototype.ValueTypeName="number";class Ko extends qo{constructor(t,e,s,i){super(t,e,s,i)}interpolate_(t,e,s,i){const r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=(s-e)/(i-e);let h=t*a;for(let t=h+a;h!==t;h+=4)Ts.slerpFlat(r,0,n,h-a,n,h,o);return r}}class th extends Ho{constructor(t,e,s,i){super(t,e,s,i)}InterpolantFactoryMethodLinear(t){return new Ko(this.times,this.values,this.getValueSize(),t)}}th.prototype.ValueTypeName="quaternion",th.prototype.InterpolantFactoryMethodSmooth=void 0;class eh extends Ho{constructor(t,e,s){super(t,e,s)}}eh.prototype.ValueTypeName="string",eh.prototype.ValueBufferType=Array,eh.prototype.DefaultInterpolation=ze,eh.prototype.InterpolantFactoryMethodLinear=void 0,eh.prototype.InterpolantFactoryMethodSmooth=void 0;class sh extends Ho{constructor(t,e,s,i){super(t,e,s,i)}}sh.prototype.ValueTypeName="vector";class ih{constructor(t="",e=-1,s=[],i=2500){this.name=t,this.tracks=s,this.duration=e,this.blendMode=i,this.uuid=bs(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){const e=[],s=t.tracks,i=1/(t.fps||1);for(let t=0,r=s.length;t!==r;++t)e.push(rh(s[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||"{}"),r}static toJSON(t){const e=[],s=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let t=0,i=s.length;t!==i;++t)e.push(Ho.toJSON(s[t]));return i}static CreateFromMorphTargetSequence(t,e,s,i){const r=e.length,n=[];for(let t=0;t<r;t++){let a=[],o=[];a.push((t+r-1)%r,t,(t+1)%r),o.push(0,1,0);const h=jo(a);a=Wo(a,1,h),o=Wo(o,1,h),i||0!==a[0]||(a.push(r),o.push(o[0])),n.push(new Qo(".morphTargetInfluences["+e[t].name+"]",a,o).scale(1/s))}return new this(t,-1,n)}static findByName(t,e){let s=t;if(!Array.isArray(t)){const e=t;s=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<s.length;t++)if(s[t].name===e)return s[t];return null}static CreateClipsFromMorphTargetSequences(t,e,s){const i={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,s=t.length;e<s;e++){const s=t[e],n=s.name.match(r);if(n&&n.length>1){const t=n[1];let e=i[t];e||(i[t]=e=[]),e.push(s)}}const n=[];for(const t in i)n.push(this.CreateFromMorphTargetSequence(t,i[t],e,s));return n}static parseAnimation(t,e){if(cs("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return us("AnimationClip: No animation in JSONLoader data."),null;const s=function(t,e,s,i,r){if(0!==s.length){const n=[],a=[];Jo(s,n,a,i),0!==n.length&&r.push(new t(e,n,a))}},i=[],r=t.name||"default",n=t.fps||30,a=t.blendMode;let o=t.length||-1;const h=t.hierarchy||[];for(let t=0;t<h.length;t++){const r=h[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let s=0;s<r[e].morphTargets.length;s++)t[r[e].morphTargets[s]]=-1;for(const s in t){const t=[],n=[];for(let i=0;i!==r[e].morphTargets.length;++i){const i=r[e];t.push(i.time),n.push(i.morphTarget===s?1:0)}i.push(new Qo(".morphTargetInfluence["+s+"]",t,n))}o=t.length*n}else{const n=".bones["+e[t].name+"]";s(sh,n+".position",r,"pos",i),s(th,n+".quaternion",r,"rot",i),s(sh,n+".scale",r,"scl",i)}}if(0===i.length)return null;return new this(r,o,i,a)}resetDuration(){let t=0;for(let e=0,s=this.tracks.length;e!==s;++e){const s=this.tracks[e];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());const e=new this.constructor(this.name,this.duration,t,this.blendMode);return e.userData=JSON.parse(JSON.stringify(this.userData)),e}toJSON(){return this.constructor.toJSON(this)}}function rh(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Qo;case"vector":case"vector2":case"vector3":case"vector4":return sh;case"color":return $o;case"quaternion":return th;case"bool":case"boolean":return Go;case"string":return eh}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],s=[];Jo(t.keys,e,s,"value"),t.times=e,t.values=s}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const nh={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class ah{constructor(t,e,s){const i=this;let r,n=!1,a=0,o=0;const h=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=s,this._abortController=null,this.itemStart=function(t){o++,!1===n&&void 0!==i.onStart&&i.onStart(t,a,o),n=!0},this.itemEnd=function(t){a++,void 0!==i.onProgress&&i.onProgress(t,a,o),a===o&&(n=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return h.push(t,e),this},this.removeHandler=function(t){const e=h.indexOf(t);return-1!==e&&h.splice(e,2),this},this.getHandler=function(t){for(let e=0,s=h.length;e<s;e+=2){const s=h[e],i=h[e+1];if(s.global&&(s.lastIndex=0),s.test(t))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}}const oh=new ah;class hh{constructor(t){this.manager=void 0!==t?t:oh,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const s=this;return new Promise(function(i,r){s.load(t,i,e,r)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}}hh.DEFAULT_MATERIAL_NAME="__DEFAULT";const lh={};class ch extends Error{constructor(t,e){super(t),this.response=e}}class uh extends hh{constructor(t){super(t),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(t,e,s,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=nh.get(`file:${t}`);if(void 0!==r)return this.manager.itemStart(t),setTimeout(()=>{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==lh[t])return void lh[t].push({onLoad:e,onProgress:s,onError:i});lh[t]=[],lh[t].push({onLoad:e,onProgress:s,onError:i});const n=new Request(t,{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}),a=this.mimeType,o=this.responseType;fetch(n).then(e=>{if(200===e.status||0===e.status){if(0===e.status&&cs("FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const s=lh[t],i=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),n=r?parseInt(r):0,a=0!==n;let o=0;const h=new ReadableStream({start(t){!function e(){i.read().then(({done:i,value:r})=>{if(i)t.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:n});for(let t=0,e=s.length;t<e;t++){const e=s[t];e.onProgress&&e.onProgress(i)}t.enqueue(r),e()}},e=>{t.error(e)})}()}});return new Response(h)}throw new ch(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)}).then(t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>(new DOMParser).parseFromString(t,a));case"json":return t.json();default:if(""===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),s=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(s);return t.arrayBuffer().then(t=>i.decode(t))}}}).then(e=>{nh.add(`file:${t}`,e);const s=lh[t];delete lh[t];for(let t=0,i=s.length;t<i;t++){const i=s[t];i.onLoad&&i.onLoad(e)}}).catch(e=>{const s=lh[t];if(void 0===s)throw this.manager.itemError(t),e;delete lh[t];for(let t=0,i=s.length;t<i;t++){const i=s[t];i.onError&&i.onError(e)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const ph=new WeakMap;class dh extends hh{constructor(t){super(t)}load(t,e,s,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,n=nh.get(`image:${t}`);if(void 0!==n){if(!0===n.complete)r.manager.itemStart(t),setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0);else{let t=ph.get(n);void 0===t&&(t=[],ph.set(n,t)),t.push({onLoad:e,onError:i})}return n}const a=as("img");function o(){l(),e&&e(this);const s=ph.get(this)||[];for(let t=0;t<s.length;t++){const e=s[t];e.onLoad&&e.onLoad(this)}ph.delete(this),r.manager.itemEnd(t)}function h(e){l(),i&&i(e),nh.remove(`image:${t}`);const s=ph.get(this)||[];for(let t=0;t<s.length;t++){const i=s[t];i.onError&&i.onError(e)}ph.delete(this),r.manager.itemError(t),r.manager.itemEnd(t)}function l(){a.removeEventListener("load",o,!1),a.removeEventListener("error",h,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",h,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),nh.add(`image:${t}`,a),r.manager.itemStart(t),a.src=t,a}}class mh extends hh{constructor(t){super(t)}load(t,e,s,i){const r=this,n=new Pn,a=new uh(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(t,function(t){let s;try{s=r.parse(t)}catch(t){if(void 0===i)return void t(t);i(t)}void 0!==s.image?n.image=s.image:void 0!==s.data&&(n.image.width=s.width,n.image.height=s.height,n.image.data=s.data),n.wrapS=void 0!==s.wrapS?s.wrapS:pt,n.wrapT=void 0!==s.wrapT?s.wrapT:pt,n.magFilter=void 0!==s.magFilter?s.magFilter:gt,n.minFilter=void 0!==s.minFilter?s.minFilter:gt,n.anisotropy=void 0!==s.anisotropy?s.anisotropy:1,void 0!==s.colorSpace&&(n.colorSpace=s.colorSpace),void 0!==s.flipY&&(n.flipY=s.flipY),void 0!==s.format&&(n.format=s.format),void 0!==s.type&&(n.type=s.type),void 0!==s.mipmaps&&(n.mipmaps=s.mipmaps,n.minFilter=bt),1===s.mipmapCount&&(n.minFilter=gt),void 0!==s.generateMipmaps&&(n.generateMipmaps=s.generateMipmaps),n.needsUpdate=!0,e&&e(n,s)},s,i),n}}class yh extends hh{constructor(t){super(t)}load(t,e,s,i){const r=new Xs,n=new dh(this.manager);return n.setCrossOrigin(this.crossOrigin),n.setPath(this.path),n.load(t,function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)},s,i),r}}class fh extends Qi{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new gr(t),this.intensity=e}dispose(){this.dispatchEvent({type:"dispose"})}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,e}}const gh=new zi,xh=new Cs,bh=new Cs;class Mh{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new As(512,512),this.mapType=Mt,this.map=null,this.mapPass=null,this.matrix=new zi,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Kn,this._frameExtents=new As(1,1),this._viewportCount=1,this._viewports=[new Ys(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,s=this.matrix;xh.setFromMatrixPosition(t.matrixWorld),e.position.copy(xh),bh.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(bh),e.updateMatrixWorld(),gh.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(gh,e.coordinateSystem,e.reversedDepth),e.reversedDepth?s.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):s.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),s.multiply(gh)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.autoUpdate=t.autoUpdate,this.needsUpdate=t.needsUpdate,this.normalBias=t.normalBias,this.blurSamples=t.blurSamples,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 1!==this.intensity&&(t.intensity=this.intensity),0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class vh extends Mh{constructor(){super(new cn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(t){const e=this.camera,s=2*xs*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=t.distance||e.far;s===e.fov&&i===e.aspect&&r===e.far||(e.fov=s,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class wh extends fh{constructor(t,e,s=0,i=Math.PI/3,r=0,n=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Qi.DEFAULT_UP),this.updateMatrix(),this.target=new Qi,this.distance=s,this.angle=i,this.penumbra=r,this.decay=n,this.map=null,this.shadow=new vh}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.map=t.map,this.shadow=t.shadow.clone(),this}toJSON(t){const e=super.toJSON(t);return e.object.distance=this.distance,e.object.angle=this.angle,e.object.decay=this.decay,e.object.penumbra=this.penumbra,e.object.target=this.target.uuid,this.map&&this.map.isTexture&&(e.object.map=this.map.toJSON(t).uuid),e.object.shadow=this.shadow.toJSON(),e}}class Sh extends Mh{constructor(){super(new cn(90,1,.5,500)),this.isPointLightShadow=!0}}class _h extends fh{constructor(t,e,s=0,i=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=s,this.decay=i,this.shadow=new Sh}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}toJSON(t){const e=super.toJSON(t);return e.object.distance=this.distance,e.object.decay=this.decay,e.object.shadow=this.shadow.toJSON(),e}}class zh extends an{constructor(t=-1,e=1,s=1,i=-1,r=.1,n=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=s,this.bottom=i,this.near=r,this.far=n,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,s,i,r,n){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=t,this.view.fullHeight=e,this.view.offsetX=s,this.view.offsetY=i,this.view.width=r,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),s=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=s-t,n=s+t,a=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,n=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,n,a,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}class Ah extends Mh{constructor(){super(new zh(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Th extends fh{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Qi.DEFAULT_UP),this.updateMatrix(),this.target=new Qi,this.shadow=new Ah}dispose(){super.dispose(),this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){const e=super.toJSON(t);return e.object.shadow=this.shadow.toJSON(),e.object.target=this.target.uuid,e}}class Ch{static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}const kh=new WeakMap;class Bh extends hh{constructor(t){super(t),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&cs("ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&cs("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(t){return this.options=t,this}load(t,e,s,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,n=nh.get(`image-bitmap:${t}`);if(void 0!==n)return r.manager.itemStart(t),n.then?void n.then(s=>{if(!0!==kh.has(n))return e&&e(s),r.manager.itemEnd(t),s;i&&i(kh.get(n)),r.manager.itemError(t),r.manager.itemEnd(t)}):(setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0),n);const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,a.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const o=fetch(t,a).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(s){return nh.add(`image-bitmap:${t}`,s),e&&e(s),r.manager.itemEnd(t),s}).catch(function(e){i&&i(e),kh.set(o,e),nh.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});nh.add(`image-bitmap:${t}`,o),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class Oh extends cn{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class Nh{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}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 t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=performance.now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}const Ph="\\[\\]\\.:\\/",Ih=new RegExp("["+Ph+"]","g"),Rh="[^"+Ph+"]",Vh="[^"+Ph.replace("\\.","")+"]",Lh=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Rh)+/(WCOD+)?/.source.replace("WCOD",Vh)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Rh)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Rh)+"$"),Eh=["material","materials","bones","map"];class Fh{constructor(t,e,s){this.path=e,this.parsedPath=s||Fh.parseTrackName(e),this.node=Fh.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,s){return t&&t.isAnimationObjectGroup?new Fh.Composite(t,e,s):new Fh(t,e,s)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Ih,"")}static parseTrackName(t){const e=Lh.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const s={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=s.nodeName&&s.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=s.nodeName.substring(i+1);-1!==Eh.indexOf(t)&&(s.nodeName=s.nodeName.substring(0,i),s.objectName=t)}if(null===s.propertyName||0===s.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return s}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const s=t.skeleton.getBoneByName(e);if(void 0!==s)return s}if(t.children){const s=function(t){for(let i=0;i<t.length;i++){const r=t[i];if(r.name===e||r.uuid===e)return r;const n=s(r.children);if(n)return n}return null},i=s(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const s=this.resolvedProperty;for(let i=0,r=s.length;i!==r;++i)t[e++]=s[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const s=this.resolvedProperty;for(let i=0,r=s.length;i!==r;++i)s[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const s=this.resolvedProperty;for(let i=0,r=s.length;i!==r;++i)s[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const s=this.resolvedProperty;for(let i=0,r=s.length;i!==r;++i)s[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,s=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=Fh.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void cs("PropertyBinding: No target node found for track: "+this.path+".");if(s){let i=e.objectIndex;switch(s){case"materials":if(!t.material)return void us("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void us("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void us("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===i){i=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void us("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void us("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[s])return void us("PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[s]}if(void 0!==i){if(void 0===t[i])return void us("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[i]}}const n=t[i];if(void 0===n){return void us("PropertyBinding: Trying to update property for track: "+e.nodeName+"."+i+" but it wasn't found.",t)}let a=this.Versioning.None;this.targetObject=t,!0===t.isMaterial?a=this.Versioning.NeedsUpdate:!0===t.isObject3D&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return void us("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void us("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=n,this.propertyIndex=r}else void 0!==n.fromArray&&void 0!==n.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=n):Array.isArray(n)?(o=this.BindingType.EntireArray,this.resolvedProperty=n):this.propertyName=i;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Fh.Composite=class{constructor(t,e,s){const i=s||Fh.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const s=this._targetGroup.nCachedObjects_,i=this._bindings[s];void 0!==i&&i.getValue(t,e)}setValue(t,e){const s=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=s.length;i!==r;++i)s[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,s=t.length;e!==s;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,s=t.length;e!==s;++e)t[e].unbind()}},Fh.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Fh.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Fh.prototype.GetterByBindingType=[Fh.prototype._getValue_direct,Fh.prototype._getValue_array,Fh.prototype._getValue_arrayElement,Fh.prototype._getValue_toArray],Fh.prototype.SetterByBindingTypeAndVersioning=[[Fh.prototype._setValue_direct,Fh.prototype._setValue_direct_setNeedsUpdate,Fh.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Fh.prototype._setValue_array,Fh.prototype._setValue_array_setNeedsUpdate,Fh.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Fh.prototype._setValue_arrayElement,Fh.prototype._setValue_arrayElement_setNeedsUpdate,Fh.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Fh.prototype._setValue_fromArray,Fh.prototype._setValue_fromArray_setNeedsUpdate,Fh.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];const Dh=new zi;class Uh{constructor(t,e,s=0,i=1/0){this.ray=new _i(t,e),this.near=s,this.far=i,this.camera=null,this.layers=new Vi,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):us("Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return Dh.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Dh),this}intersectObject(t,e=!0,s=[]){return Wh(t,this,s,e),s.sort(jh),s}intersectObjects(t,e=!0,s=[]){for(let i=0,r=t.length;i<r;i++)Wh(t[i],this,s,e);return s.sort(jh),s}}function jh(t,e){return t.distance-e.distance}function Wh(t,e,s,i){let r=!0;if(t.layers.test(e.layers)){!1===t.raycast(e,s)&&(r=!1)}if(!0===r&&!0===i){const i=t.children;for(let t=0,r=i.length;t<r;t++)Wh(i[t],e,s,!0)}}class Jh{constructor(t=1,e=0,s=0){this.radius=t,this.phi=e,this.theta=s}set(t,e,s){return this.radius=t,this.phi=e,this.theta=s,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){const t=1e-6;return this.phi=Ms(this.phi,t,Math.PI-t),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,s){return this.radius=Math.sqrt(t*t+e*e+s*s),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,s),this.phi=Math.acos(Ms(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class qh extends ms{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(t){void 0!==t?(null!==this.domElement&&this.disconnect(),this.domElement=t):cs("Controls: connect() now requires an element.")}disconnect(){}dispose(){}update(){}}function Xh(t,e,s,i){const r=function(t){switch(t){case Mt:case vt:return{byteLength:1,components:1};case St:case wt:case Tt:return{byteLength:2,components:1};case Ct:case kt:return{byteLength:2,components:4};case zt:case _t:case At:return{byteLength:4,components:1};case Ot:case Nt:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}(i);switch(s){case 1021:return t*e;case Et:case 1029:return t*e/r.components*r.byteLength;case 1030:case 1031:return t*e*2/r.components*r.byteLength;case 1022:return t*e*3/r.components*r.byteLength;case Rt:case 1033:return t*e*4/r.components*r.byteLength;case 33776:case 33777:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case 33778:case 33779:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case 35841:case 35843:return Math.max(t,16)*Math.max(e,8)/4;case 35840:case 35842:return Math.max(t,8)*Math.max(e,8)/2;case 36196:case 37492:case 37488:case 37489:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case 37496:case 37490:case 37491:case 37808:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case 37809:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case 37810:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case 37811:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case 37812:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case 37813:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case 37814:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case 37815:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case 37816:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case 37817:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case 37818:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case 37819:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case 37820:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case 37821:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case 36492:case 36494:case 36495:return Math.ceil(t/4)*Math.ceil(e/4)*16;case 36283:case 36284:return Math.ceil(t/4)*Math.ceil(e/4)*8;case 36285:case 36286:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${s} format.`)}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:t}})),"undefined"!=typeof window&&(window.__THREE__?cs("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=t);export{K as ACESFilmicToneMapping,x as AddEquation,Z as AddOperation,m as AdditiveBlending,et as AgXToneMapping,Pt as AlphaFormat,Ke as AlwaysCompare,F as AlwaysDepth,qe as AlwaysStencilFunc,ih as AnimationClip,ka as ArcCurve,Oh as ArrayCamera,it as AttachedBindMode,c as BackSide,Re as BasicDepthPacking,Nn as Bone,Go as BooleanKeyframeTrack,Qs as Box3,Kr as BoxGeometry,Cr as BufferAttribute,Fr as BufferGeometry,vt as ByteType,nh as Cache,an as Camera,_a as CapsuleGeometry,Ra as CatmullRomCurve3,Q as CineonToneMapping,pt as ClampToEdgeWrapping,Nh as Clock,gr as Color,$o as ColorKeyframeTrack,Vs as ColorManagement,V as ConstantAlphaFactor,I as ConstantColorFactor,qh as Controls,pn as CubeCamera,wa as CubeDepthTexture,at as CubeReflectionMapping,ot as CubeRefractionMapping,dn as CubeTexture,ct as CubeUVReflectionMapping,Fa as CubicBezierCurve,Da as CubicBezierCurve3,Xo as CubicInterpolant,r as CullFaceBack,n as CullFaceFront,i as CullFaceNone,Ta as Curve,Ya as CurvePath,g as CustomBlending,tt as CustomToneMapping,za as CylinderGeometry,$s as Data3DTexture,Gs as DataArrayTexture,Pn as DataTexture,mh as DataTextureLoader,_r as DataUtils,oh as DefaultLoadingManager,Vt as DepthFormat,Lt as DepthStencilFormat,va as DepthTexture,rt as DetachedBindMode,Th as DirectionalLight,Zo as DiscreteInterpolant,u as DoubleSide,k as DstAlphaFactor,O as DstColorFactor,Ca as EllipseCurve,Ze as EqualCompare,j as EqualDepth,ht as EquirectangularReflectionMapping,lt as EquirectangularRefractionMapping,Ri as Euler,ms as EventDispatcher,Sa as ExternalTexture,To as ExtrudeGeometry,uh as FileLoader,Or as Float32BufferAttribute,At as FloatType,l as FrontSide,Kn as Frustum,es as GLSL3,Ge as GreaterCompare,J as GreaterDepth,Qe as GreaterEqualCompare,W as GreaterEqualDepth,yn as Group,Tt as HalfFloatType,Bh as ImageBitmapLoader,dh as ImageLoader,Ds as ImageUtils,Ln as InstancedBufferAttribute,qn as InstancedMesh,_t as IntType,bn as InterleavedBuffer,vn as InterleavedBufferAttribute,qo as Interpolant,ze as InterpolateDiscrete,Ae as InterpolateLinear,Te as InterpolateSmooth,Je as KeepStencilOp,Ho as KeyframeTrack,Vi as Layers,Ye as LessCompare,D as LessDepth,He as LessEqualCompare,U as LessEqualDepth,fh as Light,ha as Line,ta as LineBasicMaterial,Ua as LineCurve,ja as LineCurve3,da as LineLoop,pa as LineSegments,gt as LinearFilter,Yo as LinearInterpolant,bt as LinearMipmapLinearFilter,xt as LinearMipmapNearestFilter,Ue as LinearSRGBColorSpace,G as LinearToneMapping,je as LinearTransfer,hh as Loader,Ch as LoaderUtils,ah as LoadingManager,e as MOUSE,Mr as Material,zs as MathUtils,Os as Matrix3,zi as Matrix4,w as MaxEquation,$r as Mesh,vr as MeshBasicMaterial,Fo as MeshDepthMaterial,Do as MeshDistanceMaterial,Eo as MeshLambertMaterial,Lo as MeshNormalMaterial,Vo as MeshPhongMaterial,Ro as MeshPhysicalMaterial,Io as MeshStandardMaterial,v as MinEquation,dt as MirroredRepeatWrapping,Y as MixOperation,f as MultiplyBlending,X as MultiplyOperation,mt as NearestFilter,ft as NearestMipmapLinearFilter,yt as NearestMipmapNearestFilter,st as NeutralToneMapping,Xe as NeverCompare,E as NeverDepth,p as NoBlending,Fe as NoColorSpace,H as NoToneMapping,Oe as NormalAnimationBlendMode,d as NormalBlending,$e as NotEqualCompare,q as NotEqualDepth,Qo as NumberKeyframeTrack,Qi as Object3D,Ee as ObjectSpaceNormalMap,ko as OctahedronGeometry,_ as OneFactor,L as OneMinusConstantAlphaFactor,R as OneMinusConstantColorFactor,B as OneMinusDstAlphaFactor,N as OneMinusDstColorFactor,C as OneMinusSrcAlphaFactor,A as OneMinusSrcColorFactor,zh as OrthographicCamera,a as PCFShadowMap,o as PCFSoftShadowMap,Za as Path,cn as PerspectiveCamera,Hn as Plane,Bo as PlaneGeometry,_h as PointLight,ba as Points,ma as PointsMaterial,Aa as PolyhedronGeometry,Fh as PropertyBinding,Wa as QuadraticBezierCurve,Ja as QuadraticBezierCurve3,Ts as Quaternion,th as QuaternionKeyframeTrack,Ko as QuaternionLinearInterpolant,te as R11_EAC_Format,xs as RAD2DEG,Se as RED_GREEN_RGTC2_Format,ve as RED_RGTC1_Format,t as REVISION,se as RG11_EAC_Format,Ve as RGBADepthPacking,Rt as RGBAFormat,jt as RGBAIntegerFormat,ye as RGBA_ASTC_10x10_Format,pe as RGBA_ASTC_10x5_Format,de as RGBA_ASTC_10x6_Format,me as RGBA_ASTC_10x8_Format,fe as RGBA_ASTC_12x10_Format,ge as RGBA_ASTC_12x12_Format,re as RGBA_ASTC_4x4_Format,ne as RGBA_ASTC_5x4_Format,ae as RGBA_ASTC_5x5_Format,oe as RGBA_ASTC_6x5_Format,he as RGBA_ASTC_6x6_Format,le as RGBA_ASTC_8x5_Format,ce as RGBA_ASTC_8x6_Format,ue as RGBA_ASTC_8x8_Format,xe as RGBA_BPTC_Format,Kt as RGBA_ETC2_EAC_Format,Gt as RGBA_PVRTC_2BPPV1_Format,Ht as RGBA_PVRTC_4BPPV1_Format,Jt as RGBA_S3TC_DXT1_Format,qt as RGBA_S3TC_DXT3_Format,Xt as RGBA_S3TC_DXT5_Format,It as RGBFormat,be as RGB_BPTC_SIGNED_Format,Me as RGB_BPTC_UNSIGNED_Format,$t as RGB_ETC1_Format,Qt as RGB_ETC2_Format,Zt as RGB_PVRTC_2BPPV1_Format,Yt as RGB_PVRTC_4BPPV1_Format,Wt as RGB_S3TC_DXT1_Format,Dt as RGFormat,Ut as RGIntegerFormat,Po as RawShaderMaterial,_i as Ray,Uh as Raycaster,Et as RedFormat,Ft as RedIntegerFormat,$ as ReinhardToneMapping,Zs as RenderTarget,ut as RepeatWrapping,M as ReverseSubtractEquation,ee as SIGNED_R11_EAC_Format,_e as SIGNED_RED_GREEN_RGTC2_Format,we as SIGNED_RED_RGTC1_Format,ie as SIGNED_RG11_EAC_Format,De as SRGBColorSpace,We as SRGBTransfer,xn as Scene,nn as ShaderMaterial,Ha as Shape,_o as ShapeUtils,wt as ShortType,Vn as Skeleton,On as SkinnedMesh,js as Source,fi as Sphere,Oo as SphereGeometry,Jh as Spherical,qa as SplineCurve,wh as SpotLight,T as SrcAlphaFactor,P as SrcAlphaSaturateFactor,z as SrcColorFactor,ts as StaticDrawUsage,eh as StringKeyframeTrack,b as SubtractEquation,y as SubtractiveBlending,s as TOUCH,Le as TangentSpaceNormalMap,Xs as Texture,yh as TextureLoader,No as TorusGeometry,pr as Triangle,Ie as TriangleFanDrawMode,Pe as TriangleStripDrawMode,Ne as TrianglesDrawMode,nt as UVMapping,kr as Uint16BufferAttribute,Br as Uint32BufferAttribute,rn as UniformsUtils,Mt as UnsignedByteType,Nt as UnsignedInt101111Type,Bt as UnsignedInt248Type,Ot as UnsignedInt5999Type,zt as UnsignedIntType,Ct as UnsignedShort4444Type,kt as UnsignedShort5551Type,St as UnsignedShortType,h as VSMShadowMap,As as Vector2,Cs as Vector3,Ys as Vector4,sh as VectorKeyframeTrack,ss as WebGLCoordinateSystem,mn as WebGLCubeRenderTarget,Hs as WebGLRenderTarget,is as WebGPUCoordinateSystem,gn as WebXRController,Be as WrapAroundEnding,Ce as ZeroCurvatureEnding,S as ZeroFactor,ke as ZeroSlopeEnding,rs as arrayNeedsUint32,tn as cloneUniforms,os as createCanvasElement,as as createElementNS,us as error,Xh as getByteLength,sn as getUnlitUniformColorSpace,ns as isTypedArray,ls as log,en as mergeUniforms,ds as probeAsync,cs as warn,ps as warnOnce};
1
+ const t="182",e={ROTATE:0,DOLLY:1,PAN:2},s={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},i=0,r=1,n=2,a=1,o=2,h=3,l=0,c=1,u=2,p=0,d=1,m=2,y=3,f=4,g=5,x=100,b=101,M=102,w=103,v=104,S=200,_=201,A=202,z=203,T=204,C=205,k=206,B=207,O=208,P=209,N=210,I=211,V=212,R=213,L=214,E=0,F=1,D=2,U=3,j=4,W=5,J=6,q=7,X=0,Y=1,Z=2,H=0,G=1,$=2,Q=3,K=4,tt=5,et=6,st=7,it="attached",rt="detached",nt=300,at=301,ot=302,ht=303,lt=304,ct=306,ut=1e3,pt=1001,dt=1002,mt=1003,yt=1004,ft=1005,gt=1006,xt=1007,bt=1008,Mt=1009,wt=1010,vt=1011,St=1012,_t=1013,At=1014,zt=1015,Tt=1016,Ct=1017,kt=1018,Bt=1020,Ot=35902,Pt=35899,Nt=1021,It=1022,Vt=1023,Rt=1026,Lt=1027,Et=1028,Ft=1029,Dt=1030,Ut=1031,jt=1033,Wt=33776,Jt=33777,qt=33778,Xt=33779,Yt=35840,Zt=35841,Ht=35842,Gt=35843,$t=36196,Qt=37492,Kt=37496,te=37488,ee=37489,se=37490,ie=37491,re=37808,ne=37809,ae=37810,oe=37811,he=37812,le=37813,ce=37814,ue=37815,pe=37816,de=37817,me=37818,ye=37819,fe=37820,ge=37821,xe=36492,be=36494,Me=36495,we=36283,ve=36284,Se=36285,_e=36286,Ae=2300,ze=2301,Te=2302,Ce=2400,ke=2401,Be=2402,Oe=2500,Pe=0,Ne=1,Ie=2,Ve=3200,Re=3201,Le=0,Ee=1,Fe="",De="srgb",Ue="srgb-linear",je="linear",We="srgb",Je=7680,qe=519,Xe=512,Ye=513,Ze=514,He=515,Ge=516,$e=517,Qe=518,Ke=519,ts=35044,es="300 es",ss=2e3,is=2001;function rs(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function ns(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function as(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function os(){const t=as("canvas");return t.style.display="block",t}const hs={};function ls(...t){t.shift()}function cs(...t){t.shift()}function us(...t){t.shift()}function ps(...t){const e=t.join(" ");e in hs||(hs[e]=!0,cs(...t))}function ds(t,e,s){return new Promise(function(i,r){setTimeout(function n(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(n,s);break;default:i()}},s)})}class ms{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const s=this._listeners;void 0===s[t]&&(s[t]=[]),-1===s[t].indexOf(e)&&s[t].push(e)}hasEventListener(t,e){const s=this._listeners;return void 0!==s&&(void 0!==s[t]&&-1!==s[t].indexOf(e))}removeEventListener(t,e){const s=this._listeners;if(void 0===s)return;const i=s[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const s=e[t.type];if(void 0!==s){t.target=this;const e=s.slice(0);for(let s=0,i=e.length;s<i;s++)e[s].call(this,t);t.target=null}}}const ys=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let fs=1234567;const gs=Math.PI/180,xs=180/Math.PI;function bs(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,s=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(ys[255&t]+ys[t>>8&255]+ys[t>>16&255]+ys[t>>24&255]+"-"+ys[255&e]+ys[e>>8&255]+"-"+ys[e>>16&15|64]+ys[e>>24&255]+"-"+ys[63&s|128]+ys[s>>8&255]+"-"+ys[s>>16&255]+ys[s>>24&255]+ys[255&i]+ys[i>>8&255]+ys[i>>16&255]+ys[i>>24&255]).toLowerCase()}function Ms(t,e,s){return Math.max(e,Math.min(s,t))}function ws(t,e){return(t%e+e)%e}function vs(t,e,s){return(1-s)*t+s*e}function Ss(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function _s(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const As={DEG2RAD:gs,RAD2DEG:xs,generateUUID:bs,clamp:Ms,euclideanModulo:ws,mapLinear:function(t,e,s,i,r){return i+(t-e)*(r-i)/(s-e)},inverseLerp:function(t,e,s){return t!==e?(s-t)/(e-t):0},lerp:vs,damp:function(t,e,s,i){return vs(t,e,1-Math.exp(-s*i))},pingpong:function(t,e=1){return e-Math.abs(ws(t,2*e)-e)},smoothstep:function(t,e,s){return t<=e?0:t>=s?1:(t=(t-e)/(s-e))*t*(3-2*t)},smootherstep:function(t,e,s){return t<=e?0:t>=s?1:(t=(t-e)/(s-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(fs=t);let e=fs+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*gs},radToDeg:function(t){return t*xs},isPowerOfTwo:function(t){return!(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,s,i,r){const n=Math.cos,a=Math.sin,o=n(s/2),h=a(s/2),l=n((e+i)/2),c=a((e+i)/2),u=n((e-i)/2),p=a((e-i)/2),d=n((i-e)/2),m=a((i-e)/2);switch(r){case"XYX":t.set(o*c,h*u,h*p,o*l);break;case"YZY":t.set(h*p,o*c,h*u,o*l);break;case"ZXZ":t.set(h*u,h*p,o*c,o*l);break;case"XZX":t.set(o*c,h*m,h*d,o*l);break;case"YXY":t.set(h*d,o*c,h*m,o*l);break;case"ZYZ":t.set(h*m,h*d,o*c,o*l);break;default:cs("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:_s,denormalize:Ss};class zs{constructor(t=0,e=0){zs.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,s=this.y,i=t.elements;return this.x=i[0]*e+i[3]*s+i[6],this.y=i[1]*e+i[4]*s+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Ms(this.x,t.x,e.x),this.y=Ms(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=Ms(this.x,t,e),this.y=Ms(this.y,t,e),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Ms(s,t,e))}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(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(Ms(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y;return e*e+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const s=Math.cos(e),i=Math.sin(e),r=this.x-t.x,n=this.y-t.y;return this.x=r*s-n*i+t.x,this.y=r*i+n*s+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ts{constructor(t=0,e=0,s=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=s,this._w=i}static slerpFlat(t,e,s,i,r,n,a){let o=s[i+0],h=s[i+1],l=s[i+2],c=s[i+3],u=r[n+0],p=r[n+1],d=r[n+2],m=r[n+3];if(a<=0)return t[e+0]=o,t[e+1]=h,t[e+2]=l,void(t[e+3]=c);if(a>=1)return t[e+0]=u,t[e+1]=p,t[e+2]=d,void(t[e+3]=m);if(c!==m||o!==u||h!==p||l!==d){let t=o*u+h*p+l*d+c*m;t<0&&(u=-u,p=-p,d=-d,m=-m,t=-t);let e=1-a;if(t<.9995){const s=Math.acos(t),i=Math.sin(s);e=Math.sin(e*s)/i,o=o*e+u*(a=Math.sin(a*s)/i),h=h*e+p*a,l=l*e+d*a,c=c*e+m*a}else{o=o*e+u*a,h=h*e+p*a,l=l*e+d*a,c=c*e+m*a;const t=1/Math.sqrt(o*o+h*h+l*l+c*c);o*=t,h*=t,l*=t,c*=t}}t[e]=o,t[e+1]=h,t[e+2]=l,t[e+3]=c}static multiplyQuaternionsFlat(t,e,s,i,r,n){const a=s[i],o=s[i+1],h=s[i+2],l=s[i+3],c=r[n],u=r[n+1],p=r[n+2],d=r[n+3];return t[e]=a*d+l*c+o*p-h*u,t[e+1]=o*d+l*u+h*c-a*p,t[e+2]=h*d+l*p+a*u-o*c,t[e+3]=l*d-a*c-o*u-h*p,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,s,i){return this._x=t,this._y=e,this._z=s,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const s=t._x,i=t._y,r=t._z,n=t._order,a=Math.cos,o=Math.sin,h=a(s/2),l=a(i/2),c=a(r/2),u=o(s/2),p=o(i/2),d=o(r/2);switch(n){case"XYZ":this._x=u*l*c+h*p*d,this._y=h*p*c-u*l*d,this._z=h*l*d+u*p*c,this._w=h*l*c-u*p*d;break;case"YXZ":this._x=u*l*c+h*p*d,this._y=h*p*c-u*l*d,this._z=h*l*d-u*p*c,this._w=h*l*c+u*p*d;break;case"ZXY":this._x=u*l*c-h*p*d,this._y=h*p*c+u*l*d,this._z=h*l*d+u*p*c,this._w=h*l*c-u*p*d;break;case"ZYX":this._x=u*l*c-h*p*d,this._y=h*p*c+u*l*d,this._z=h*l*d-u*p*c,this._w=h*l*c+u*p*d;break;case"YZX":this._x=u*l*c+h*p*d,this._y=h*p*c+u*l*d,this._z=h*l*d-u*p*c,this._w=h*l*c-u*p*d;break;case"XZY":this._x=u*l*c-h*p*d,this._y=h*p*c-u*l*d,this._z=h*l*d+u*p*c,this._w=h*l*c+u*p*d;break;default:cs("Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const s=e/2,i=Math.sin(s);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,s=e[0],i=e[4],r=e[8],n=e[1],a=e[5],o=e[9],h=e[2],l=e[6],c=e[10],u=s+a+c;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(l-o)*t,this._y=(r-h)*t,this._z=(n-i)*t}else if(s>a&&s>c){const t=2*Math.sqrt(1+s-a-c);this._w=(l-o)/t,this._x=.25*t,this._y=(i+n)/t,this._z=(r+h)/t}else if(a>c){const t=2*Math.sqrt(1+a-s-c);this._w=(r-h)/t,this._x=(i+n)/t,this._y=.25*t,this._z=(o+l)/t}else{const t=2*Math.sqrt(1+c-s-a);this._w=(n-i)/t,this._x=(r+h)/t,this._y=(o+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let s=t.dot(e)+1;return s<1e-8?(s=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=s):(this._x=0,this._y=-t.z,this._z=t.y,this._w=s)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=s),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Ms(this.dot(t),-1,1)))}rotateTowards(t,e){const s=this.angleTo(t);if(0===s)return this;const i=Math.min(1,e/s);return this.slerp(t,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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const s=t._x,i=t._y,r=t._z,n=t._w,a=e._x,o=e._y,h=e._z,l=e._w;return this._x=s*l+n*a+i*h-r*o,this._y=i*l+n*o+r*a-s*h,this._z=r*l+n*h+s*o-i*a,this._w=n*l-s*a-i*o-r*h,this._onChangeCallback(),this}slerp(t,e){if(e<=0)return this;if(e>=1)return this.copy(t);let s=t._x,i=t._y,r=t._z,n=t._w,a=this.dot(t);a<0&&(s=-s,i=-i,r=-r,n=-n,a=-a);let o=1-e;if(a<.9995){const t=Math.acos(a),h=Math.sin(t);o=Math.sin(o*t)/h,e=Math.sin(e*t)/h,this._x=this._x*o+s*e,this._y=this._y*o+i*e,this._z=this._z*o+r*e,this._w=this._w*o+n*e,this._onChangeCallback()}else this._x=this._x*o+s*e,this._y=this._y*o+i*e,this._z=this._z*o+r*e,this._w=this._w*o+n*e,this.normalize();return this}slerpQuaternions(t,e,s){return this.copy(t).slerp(e,s)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),s=Math.random(),i=Math.sqrt(1-s),r=Math.sqrt(s);return this.set(i*Math.sin(t),i*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Cs{constructor(t=0,e=0,s=0){Cs.prototype.isVector3=!0,this.x=t,this.y=e,this.z=s}set(t,e,s){return void 0===s&&(s=this.z),this.x=t,this.y=e,this.z=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Bs.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Bs.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,s=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*s+r[6]*i,this.y=r[1]*e+r[4]*s+r[7]*i,this.z=r[2]*e+r[5]*s+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,s=this.y,i=this.z,r=t.elements,n=1/(r[3]*e+r[7]*s+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*s+r[8]*i+r[12])*n,this.y=(r[1]*e+r[5]*s+r[9]*i+r[13])*n,this.z=(r[2]*e+r[6]*s+r[10]*i+r[14])*n,this}applyQuaternion(t){const e=this.x,s=this.y,i=this.z,r=t.x,n=t.y,a=t.z,o=t.w,h=2*(n*i-a*s),l=2*(a*e-r*i),c=2*(r*s-n*e);return this.x=e+o*h+n*c-a*l,this.y=s+o*l+a*h-r*c,this.z=i+o*c+r*l-n*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,s=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*s+r[8]*i,this.y=r[1]*e+r[5]*s+r[9]*i,this.z=r[2]*e+r[6]*s+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Ms(this.x,t.x,e.x),this.y=Ms(this.y,t.y,e.y),this.z=Ms(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=Ms(this.x,t,e),this.y=Ms(this.y,t,e),this.z=Ms(this.z,t,e),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Ms(s,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const s=t.x,i=t.y,r=t.z,n=e.x,a=e.y,o=e.z;return this.x=i*o-r*a,this.y=r*n-s*o,this.z=s*a-i*n,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const s=t.dot(this)/e;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return ks.copy(this).projectOnVector(t),this.sub(ks)}reflect(t){return this.sub(ks.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(Ms(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y,i=this.z-t.z;return e*e+s*s+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,s){const i=Math.sin(e)*t;return this.x=i*Math.sin(s),this.y=Math.cos(e)*t,this.z=i*Math.cos(s),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,s){return this.x=t*Math.sin(e),this.y=s,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),s=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=s,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,s=Math.sqrt(1-e*e);return this.x=s*Math.cos(t),this.y=e,this.z=s*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const ks=new Cs,Bs=new Ts;class Os{constructor(t,e,s,i,r,n,a,o,h){Os.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,s,i,r,n,a,o,h)}set(t,e,s,i,r,n,a,o,h){const l=this.elements;return l[0]=t,l[1]=i,l[2]=a,l[3]=e,l[4]=r,l[5]=o,l[6]=s,l[7]=n,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],this}extractBasis(t,e,s){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,i=e.elements,r=this.elements,n=s[0],a=s[3],o=s[6],h=s[1],l=s[4],c=s[7],u=s[2],p=s[5],d=s[8],m=i[0],y=i[3],f=i[6],g=i[1],x=i[4],b=i[7],M=i[2],w=i[5],v=i[8];return r[0]=n*m+a*g+o*M,r[3]=n*y+a*x+o*w,r[6]=n*f+a*b+o*v,r[1]=h*m+l*g+c*M,r[4]=h*y+l*x+c*w,r[7]=h*f+l*b+c*v,r[2]=u*m+p*g+d*M,r[5]=u*y+p*x+d*w,r[8]=u*f+p*b+d*v,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],s=t[1],i=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8];return e*n*l-e*a*h-s*r*l+s*a*o+i*r*h-i*n*o}invert(){const t=this.elements,e=t[0],s=t[1],i=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8],c=l*n-a*h,u=a*o-l*r,p=h*r-n*o,d=e*c+s*u+i*p;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return t[0]=c*m,t[1]=(i*h-l*s)*m,t[2]=(a*s-i*n)*m,t[3]=u*m,t[4]=(l*e-i*o)*m,t[5]=(i*r-a*e)*m,t[6]=p*m,t[7]=(s*o-h*e)*m,t[8]=(n*e-s*r)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,s,i,r,n,a){const o=Math.cos(r),h=Math.sin(r);return this.set(s*o,s*h,-s*(o*n+h*a)+n+t,-i*h,i*o,-i*(-h*n+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(Ps.makeScale(t,e)),this}rotate(t){return this.premultiply(Ps.makeRotation(-t)),this}translate(t,e){return this.premultiply(Ps.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,s,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,s=t.elements;for(let t=0;t<9;t++)if(e[t]!==s[t])return!1;return!0}fromArray(t,e=0){for(let s=0;s<9;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const Ps=new Os,Ns=(new Os).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Is=(new Os).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Vs(){const t={enabled:!0,workingColorSpace:Ue,spaces:{},convert:function(t,e,s){return!1!==this.enabled&&e!==s&&e&&s?(this.spaces[e].transfer===We&&(t.r=Ls(t.r),t.g=Ls(t.g),t.b=Ls(t.b)),this.spaces[e].primaries!==this.spaces[s].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[s].fromXYZ)),this.spaces[s].transfer===We&&(t.r=Es(t.r),t.g=Es(t.g),t.b=Es(t.b)),t):t},workingToColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},colorSpaceToWorking:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?je:this.spaces[t].transfer},getToneMappingMode:function(t){return this.spaces[t].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,s){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[s].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,s){return ps("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(e,s)},toWorkingColorSpace:function(e,s){return ps("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(e,s)}},e=[.64,.33,.3,.6,.15,.06],s=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[Ue]:{primaries:e,whitePoint:i,transfer:je,toXYZ:Ns,fromXYZ:Is,luminanceCoefficients:s,workingColorSpaceConfig:{unpackColorSpace:De},outputColorSpaceConfig:{drawingBufferColorSpace:De}},[De]:{primaries:e,whitePoint:i,transfer:We,toXYZ:Ns,fromXYZ:Is,luminanceCoefficients:s,outputColorSpaceConfig:{drawingBufferColorSpace:De}}}),t}const Rs=Vs();function Ls(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Es(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let Fs;class Ds{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let s;if(t instanceof HTMLCanvasElement)s=t;else{void 0===Fs&&(Fs=as("canvas")),Fs.width=t.width,Fs.height=t.height;const e=Fs.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),s=Fs}return s.toDataURL(e)}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=as("canvas");e.width=t.width,e.height=t.height;const s=e.getContext("2d");s.drawImage(t,0,0,t.width,t.height);const i=s.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t<r.length;t++)r[t]=255*Ls(r[t]/255);return s.putImageData(i,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*Ls(e[t]/255)):e[t]=Ls(e[t]);return{data:e,width:t.width,height:t.height}}return cs("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let Us=0;class js{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Us++}),this.uuid=bs(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){const e=this.data;return"undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?t.set(e.displayHeight,e.displayWidth,0):null!==e?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const s={uuid:this.uuid,url:""},i=this.data;if(null!==i){let t;if(Array.isArray(i)){t=[];for(let e=0,s=i.length;e<s;e++)i[e].isDataTexture?t.push(Ws(i[e].image)):t.push(Ws(i[e]))}else t=Ws(i);s.url=t}return e||(t.images[this.uuid]=s),s}}function Ws(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Ds.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(cs("Texture: Unable to serialize Texture."),{})}let Js=0;const qs=new Cs;class Xs extends ms{constructor(t=Xs.DEFAULT_IMAGE,e=Xs.DEFAULT_MAPPING,s=1001,i=1001,r=1006,n=1008,a=1023,o=1009,h=Xs.DEFAULT_ANISOTROPY,l=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Js++}),this.uuid=bs(),this.name="",this.source=new js(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=s,this.wrapT=i,this.magFilter=r,this.minFilter=n,this.anisotropy=h,this.format=a,this.internalFormat=null,this.type=o,this.offset=new zs(0,0),this.repeat=new zs(1,1),this.center=new zs(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Os,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=l,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(qs).x}get height(){return this.source.getSize(qs).y}get depth(){return this.source.getSize(qs).z}get image(){return this.source.data}set image(t=null){this.source.data=t}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(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(const e in t){const s=t[e];if(void 0===s){cs(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&s&&i.isVector2&&s.isVector2||i&&s&&i.isVector3&&s.isVector3||i&&s&&i.isMatrix3&&s.isMatrix3?i.copy(s):this[e]=s:cs(`Texture.setValues(): property '${e}' does not exist.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const s={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).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&&(s.userData=this.userData),e||(t.textures[this.uuid]=s),s}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case ut:t.x=t.x-Math.floor(t.x);break;case pt:t.x=t.x<0?0:1;break;case dt:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case ut:t.y=t.y-Math.floor(t.y);break;case pt:t.y=t.y<0?0:1;break;case dt:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}Xs.DEFAULT_IMAGE=null,Xs.DEFAULT_MAPPING=300,Xs.DEFAULT_ANISOTROPY=1;class Ys{constructor(t=0,e=0,s=0,i=1){Ys.prototype.isVector4=!0,this.x=t,this.y=e,this.z=s,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,s,i){return this.x=t,this.y=e,this.z=s,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,s=this.y,i=this.z,r=this.w,n=t.elements;return this.x=n[0]*e+n[4]*s+n[8]*i+n[12]*r,this.y=n[1]*e+n[5]*s+n[9]*i+n[13]*r,this.z=n[2]*e+n[6]*s+n[10]*i+n[14]*r,this.w=n[3]*e+n[7]*s+n[11]*i+n[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,s,i,r;const n=.01,a=.1,o=t.elements,h=o[0],l=o[4],c=o[8],u=o[1],p=o[5],d=o[9],m=o[2],y=o[6],f=o[10];if(Math.abs(l-u)<n&&Math.abs(c-m)<n&&Math.abs(d-y)<n){if(Math.abs(l+u)<a&&Math.abs(c+m)<a&&Math.abs(d+y)<a&&Math.abs(h+p+f-3)<a)return this.set(1,0,0,0),this;e=Math.PI;const t=(h+1)/2,o=(p+1)/2,g=(f+1)/2,x=(l+u)/4,b=(c+m)/4,M=(d+y)/4;return t>o&&t>g?t<n?(s=0,i=.707106781,r=.707106781):(s=Math.sqrt(t),i=x/s,r=b/s):o>g?o<n?(s=.707106781,i=0,r=.707106781):(i=Math.sqrt(o),s=x/i,r=M/i):g<n?(s=.707106781,i=.707106781,r=0):(r=Math.sqrt(g),s=b/r,i=M/r),this.set(s,i,r,e),this}let g=Math.sqrt((y-d)*(y-d)+(c-m)*(c-m)+(u-l)*(u-l));return Math.abs(g)<.001&&(g=1),this.x=(y-d)/g,this.y=(c-m)/g,this.z=(u-l)/g,this.w=Math.acos((h+p+f-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Ms(this.x,t.x,e.x),this.y=Ms(this.y,t.y,e.y),this.z=Ms(this.z,t.z,e.z),this.w=Ms(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=Ms(this.x,t,e),this.y=Ms(this.y,t,e),this.z=Ms(this.z,t,e),this.w=Ms(this.w,t,e),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Ms(s,t,e))}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(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this.w=t.w+(e.w-t.w)*s,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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 Zs extends ms{constructor(t=1,e=1,s={}){super(),s=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:gt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},s),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=s.depth,this.scissor=new Ys(0,0,t,e),this.scissorTest=!1,this.viewport=new Ys(0,0,t,e);const i={width:t,height:e,depth:s.depth},r=new Xs(i);this.textures=[];const n=s.count;for(let t=0;t<n;t++)this.textures[t]=r.clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;this._setTextureOptions(s),this.depthBuffer=s.depthBuffer,this.stencilBuffer=s.stencilBuffer,this.resolveDepthBuffer=s.resolveDepthBuffer,this.resolveStencilBuffer=s.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=s.depthTexture,this.samples=s.samples,this.multiview=s.multiview}_setTextureOptions(t={}){const e={minFilter:gt,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==t.mapping&&(e.mapping=t.mapping),void 0!==t.wrapS&&(e.wrapS=t.wrapS),void 0!==t.wrapT&&(e.wrapT=t.wrapT),void 0!==t.wrapR&&(e.wrapR=t.wrapR),void 0!==t.magFilter&&(e.magFilter=t.magFilter),void 0!==t.minFilter&&(e.minFilter=t.minFilter),void 0!==t.format&&(e.format=t.format),void 0!==t.type&&(e.type=t.type),void 0!==t.anisotropy&&(e.anisotropy=t.anisotropy),void 0!==t.colorSpace&&(e.colorSpace=t.colorSpace),void 0!==t.flipY&&(e.flipY=t.flipY),void 0!==t.generateMipmaps&&(e.generateMipmaps=t.generateMipmaps),void 0!==t.internalFormat&&(e.internalFormat=t.internalFormat);for(let t=0;t<this.textures.length;t++){this.textures[t].setValues(e)}}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==t&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,s=1){if(this.width!==t||this.height!==e||this.depth!==s){this.width=t,this.height=e,this.depth=s;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=t,this.textures[i].image.height=e,this.textures[i].image.depth=s,!0!==this.textures[i].isData3DTexture&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,s=t.textures.length;e<s;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const s=Object.assign({},t.textures[e].image);this.textures[e].source=new js(s)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Hs extends Zs{constructor(t=1,e=1,s={}){super(t,e,s),this.isWebGLRenderTarget=!0}}class Gs extends Xs{constructor(t=null,e=1,s=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:s,depth:i},this.magFilter=mt,this.minFilter=mt,this.wrapR=pt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class $s extends Xs{constructor(t=null,e=1,s=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:s,depth:i},this.magFilter=mt,this.minFilter=mt,this.wrapR=pt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Qs{constructor(t=new Cs(1/0,1/0,1/0),e=new Cs(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e+=3)this.expandByPoint(ti.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,s=t.count;e<s;e++)this.expandByPoint(ti.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const s=ti.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(s),this.max.copy(t).add(s),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const s=t.geometry;if(void 0!==s){const i=s.getAttribute("position");if(!0===e&&void 0!==i&&!0!==t.isInstancedMesh)for(let e=0,s=i.count;e<s;e++)!0===t.isMesh?t.getVertexPosition(e,ti):ti.fromBufferAttribute(i,e),ti.applyMatrix4(t.matrixWorld),this.expandByPoint(ti);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),ei.copy(t.boundingBox)):(null===s.boundingBox&&s.computeBoundingBox(),ei.copy(s.boundingBox)),ei.applyMatrix4(t.matrixWorld),this.union(ei)}const i=t.children;for(let t=0,s=i.length;t<s;t++)this.expandByObject(i[t],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,ti),ti.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,s;return t.normal.x>0?(e=t.normal.x*this.min.x,s=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,s=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,s+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,s+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,s+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,s+=t.normal.z*this.min.z),e<=-t.constant&&s>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(hi),li.subVectors(this.max,hi),si.subVectors(t.a,hi),ii.subVectors(t.b,hi),ri.subVectors(t.c,hi),ni.subVectors(ii,si),ai.subVectors(ri,ii),oi.subVectors(si,ri);let e=[0,-ni.z,ni.y,0,-ai.z,ai.y,0,-oi.z,oi.y,ni.z,0,-ni.x,ai.z,0,-ai.x,oi.z,0,-oi.x,-ni.y,ni.x,0,-ai.y,ai.x,0,-oi.y,oi.x,0];return!!pi(e,si,ii,ri,li)&&(e=[1,0,0,0,1,0,0,0,1],!!pi(e,si,ii,ri,li)&&(ci.crossVectors(ni,ai),e=[ci.x,ci.y,ci.z],pi(e,si,ii,ri,li)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ti).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(ti).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Ks[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ks[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ks[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ks[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ks[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ks[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ks[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ks[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ks)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}}const Ks=[new Cs,new Cs,new Cs,new Cs,new Cs,new Cs,new Cs,new Cs],ti=new Cs,ei=new Qs,si=new Cs,ii=new Cs,ri=new Cs,ni=new Cs,ai=new Cs,oi=new Cs,hi=new Cs,li=new Cs,ci=new Cs,ui=new Cs;function pi(t,e,s,i,r){for(let n=0,a=t.length-3;n<=a;n+=3){ui.fromArray(t,n);const a=r.x*Math.abs(ui.x)+r.y*Math.abs(ui.y)+r.z*Math.abs(ui.z),o=e.dot(ui),h=s.dot(ui),l=i.dot(ui);if(Math.max(-Math.max(o,h,l),Math.min(o,h,l))>a)return!1}return!0}const di=new Qs,mi=new Cs,yi=new Cs;class fi{constructor(t=new Cs,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const s=this.center;void 0!==e?s.copy(e):di.setFromPoints(t).getCenter(s);let i=0;for(let e=0,r=t.length;e<r;e++)i=Math.max(i,s.distanceToSquared(t[e]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const s=this.center.distanceToSquared(t);return e.copy(t),s>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;mi.subVectors(t,this.center);const e=mi.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),s=.5*(t-this.radius);this.center.addScaledVector(mi,s/t),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(yi.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(mi.copy(t.center).add(yi)),this.expandByPoint(mi.copy(t.center).sub(yi))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}}const gi=new Cs,xi=new Cs,bi=new Cs,Mi=new Cs,wi=new Cs,vi=new Cs,Si=new Cs;class _i{constructor(t=new Cs,e=new Cs(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,gi)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const s=e.dot(this.direction);return s<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,s)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=gi.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(gi.copy(this.origin).addScaledVector(this.direction,e),gi.distanceToSquared(t))}distanceSqToSegment(t,e,s,i){xi.copy(t).add(e).multiplyScalar(.5),bi.copy(e).sub(t).normalize(),Mi.copy(this.origin).sub(xi);const r=.5*t.distanceTo(e),n=-this.direction.dot(bi),a=Mi.dot(this.direction),o=-Mi.dot(bi),h=Mi.lengthSq(),l=Math.abs(1-n*n);let c,u,p,d;if(l>0)if(c=n*o-a,u=n*a-o,d=r*l,c>=0)if(u>=-d)if(u<=d){const t=1/l;c*=t,u*=t,p=c*(c+n*u+2*a)+u*(n*c+u+2*o)+h}else u=r,c=Math.max(0,-(n*u+a)),p=-c*c+u*(u+2*o)+h;else u=-r,c=Math.max(0,-(n*u+a)),p=-c*c+u*(u+2*o)+h;else u<=-d?(c=Math.max(0,-(-n*r+a)),u=c>0?-r:Math.min(Math.max(-r,-o),r),p=-c*c+u*(u+2*o)+h):u<=d?(c=0,u=Math.min(Math.max(-r,-o),r),p=u*(u+2*o)+h):(c=Math.max(0,-(n*r+a)),u=c>0?r:Math.min(Math.max(-r,-o),r),p=-c*c+u*(u+2*o)+h);else u=n>0?-r:r,c=Math.max(0,-(n*u+a)),p=-c*c+u*(u+2*o)+h;return s&&s.copy(this.origin).addScaledVector(this.direction,c),i&&i.copy(xi).addScaledVector(bi,u),p}intersectSphere(t,e){gi.subVectors(t.center,this.origin);const s=gi.dot(this.direction),i=gi.dot(gi)-s*s,r=t.radius*t.radius;if(i>r)return null;const n=Math.sqrt(r-i),a=s-n,o=s+n;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return!(t.radius<0)&&this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const s=-(this.origin.dot(t.normal)+t.constant)/e;return s>=0?s:null}intersectPlane(t,e){const s=this.distanceToPlane(t);return null===s?null:this.at(s,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let s,i,r,n,a,o;const h=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,u=this.origin;return h>=0?(s=(t.min.x-u.x)*h,i=(t.max.x-u.x)*h):(s=(t.max.x-u.x)*h,i=(t.min.x-u.x)*h),l>=0?(r=(t.min.y-u.y)*l,n=(t.max.y-u.y)*l):(r=(t.max.y-u.y)*l,n=(t.min.y-u.y)*l),s>n||r>i?null:((r>s||isNaN(s))&&(s=r),(n<i||isNaN(i))&&(i=n),c>=0?(a=(t.min.z-u.z)*c,o=(t.max.z-u.z)*c):(a=(t.max.z-u.z)*c,o=(t.min.z-u.z)*c),s>o||a>i?null:((a>s||s!=s)&&(s=a),(o<i||i!=i)&&(i=o),i<0?null:this.at(s>=0?s:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,gi)}intersectTriangle(t,e,s,i,r){wi.subVectors(e,t),vi.subVectors(s,t),Si.crossVectors(wi,vi);let n,a=this.direction.dot(Si);if(a>0){if(i)return null;n=1}else{if(!(a<0))return null;n=-1,a=-a}Mi.subVectors(this.origin,t);const o=n*this.direction.dot(vi.crossVectors(Mi,vi));if(o<0)return null;const h=n*this.direction.dot(wi.cross(Mi));if(h<0)return null;if(o+h>a)return null;const l=-n*Mi.dot(Si);return l<0?null:this.at(l/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Ai{constructor(t,e,s,i,r,n,a,o,h,l,c,u,p,d,m,y){Ai.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,s,i,r,n,a,o,h,l,c,u,p,d,m,y)}set(t,e,s,i,r,n,a,o,h,l,c,u,p,d,m,y){const f=this.elements;return f[0]=t,f[4]=e,f[8]=s,f[12]=i,f[1]=r,f[5]=n,f[9]=a,f[13]=o,f[2]=h,f[6]=l,f[10]=c,f[14]=u,f[3]=p,f[7]=d,f[11]=m,f[15]=y,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 Ai).fromArray(this.elements)}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],e[9]=s[9],e[10]=s[10],e[11]=s[11],e[12]=s[12],e[13]=s[13],e[14]=s[14],e[15]=s[15],this}copyPosition(t){const e=this.elements,s=t.elements;return e[12]=s[12],e[13]=s[13],e[14]=s[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,s){return 0===this.determinant()?(t.set(1,0,0),e.set(0,1,0),s.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this)}makeBasis(t,e,s){return this.set(t.x,e.x,s.x,0,t.y,e.y,s.y,0,t.z,e.z,s.z,0,0,0,0,1),this}extractRotation(t){if(0===t.determinant())return this.identity();const e=this.elements,s=t.elements,i=1/zi.setFromMatrixColumn(t,0).length(),r=1/zi.setFromMatrixColumn(t,1).length(),n=1/zi.setFromMatrixColumn(t,2).length();return e[0]=s[0]*i,e[1]=s[1]*i,e[2]=s[2]*i,e[3]=0,e[4]=s[4]*r,e[5]=s[5]*r,e[6]=s[6]*r,e[7]=0,e[8]=s[8]*n,e[9]=s[9]*n,e[10]=s[10]*n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,s=t.x,i=t.y,r=t.z,n=Math.cos(s),a=Math.sin(s),o=Math.cos(i),h=Math.sin(i),l=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){const t=n*l,s=n*c,i=a*l,r=a*c;e[0]=o*l,e[4]=-o*c,e[8]=h,e[1]=s+i*h,e[5]=t-r*h,e[9]=-a*o,e[2]=r-t*h,e[6]=i+s*h,e[10]=n*o}else if("YXZ"===t.order){const t=o*l,s=o*c,i=h*l,r=h*c;e[0]=t+r*a,e[4]=i*a-s,e[8]=n*h,e[1]=n*c,e[5]=n*l,e[9]=-a,e[2]=s*a-i,e[6]=r+t*a,e[10]=n*o}else if("ZXY"===t.order){const t=o*l,s=o*c,i=h*l,r=h*c;e[0]=t-r*a,e[4]=-n*c,e[8]=i+s*a,e[1]=s+i*a,e[5]=n*l,e[9]=r-t*a,e[2]=-n*h,e[6]=a,e[10]=n*o}else if("ZYX"===t.order){const t=n*l,s=n*c,i=a*l,r=a*c;e[0]=o*l,e[4]=i*h-s,e[8]=t*h+r,e[1]=o*c,e[5]=r*h+t,e[9]=s*h-i,e[2]=-h,e[6]=a*o,e[10]=n*o}else if("YZX"===t.order){const t=n*o,s=n*h,i=a*o,r=a*h;e[0]=o*l,e[4]=r-t*c,e[8]=i*c+s,e[1]=c,e[5]=n*l,e[9]=-a*l,e[2]=-h*l,e[6]=s*c+i,e[10]=t-r*c}else if("XZY"===t.order){const t=n*o,s=n*h,i=a*o,r=a*h;e[0]=o*l,e[4]=-c,e[8]=h*l,e[1]=t*c+r,e[5]=n*l,e[9]=s*c-i,e[2]=i*c-s,e[6]=a*l,e[10]=r*c+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Ci,t,ki)}lookAt(t,e,s){const i=this.elements;return Pi.subVectors(t,e),0===Pi.lengthSq()&&(Pi.z=1),Pi.normalize(),Bi.crossVectors(s,Pi),0===Bi.lengthSq()&&(1===Math.abs(s.z)?Pi.x+=1e-4:Pi.z+=1e-4,Pi.normalize(),Bi.crossVectors(s,Pi)),Bi.normalize(),Oi.crossVectors(Pi,Bi),i[0]=Bi.x,i[4]=Oi.x,i[8]=Pi.x,i[1]=Bi.y,i[5]=Oi.y,i[9]=Pi.y,i[2]=Bi.z,i[6]=Oi.z,i[10]=Pi.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,i=e.elements,r=this.elements,n=s[0],a=s[4],o=s[8],h=s[12],l=s[1],c=s[5],u=s[9],p=s[13],d=s[2],m=s[6],y=s[10],f=s[14],g=s[3],x=s[7],b=s[11],M=s[15],w=i[0],v=i[4],S=i[8],_=i[12],A=i[1],z=i[5],T=i[9],C=i[13],k=i[2],B=i[6],O=i[10],P=i[14],N=i[3],I=i[7],V=i[11],R=i[15];return r[0]=n*w+a*A+o*k+h*N,r[4]=n*v+a*z+o*B+h*I,r[8]=n*S+a*T+o*O+h*V,r[12]=n*_+a*C+o*P+h*R,r[1]=l*w+c*A+u*k+p*N,r[5]=l*v+c*z+u*B+p*I,r[9]=l*S+c*T+u*O+p*V,r[13]=l*_+c*C+u*P+p*R,r[2]=d*w+m*A+y*k+f*N,r[6]=d*v+m*z+y*B+f*I,r[10]=d*S+m*T+y*O+f*V,r[14]=d*_+m*C+y*P+f*R,r[3]=g*w+x*A+b*k+M*N,r[7]=g*v+x*z+b*B+M*I,r[11]=g*S+x*T+b*O+M*V,r[15]=g*_+x*C+b*P+M*R,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],s=t[4],i=t[8],r=t[12],n=t[1],a=t[5],o=t[9],h=t[13],l=t[2],c=t[6],u=t[10],p=t[14],d=t[3],m=t[7],y=t[11],f=t[15],g=o*p-h*u,x=a*p-h*c,b=a*u-o*c,M=n*p-h*l,w=n*u-o*l,v=n*c-a*l;return e*(m*g-y*x+f*b)-s*(d*g-y*M+f*w)+i*(d*x-m*M+f*v)-r*(d*b-m*w+y*v)}transpose(){const t=this.elements;let e;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(t,e,s){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=s),this}invert(){const t=this.elements,e=t[0],s=t[1],i=t[2],r=t[3],n=t[4],a=t[5],o=t[6],h=t[7],l=t[8],c=t[9],u=t[10],p=t[11],d=t[12],m=t[13],y=t[14],f=t[15],g=c*y*h-m*u*h+m*o*p-a*y*p-c*o*f+a*u*f,x=d*u*h-l*y*h-d*o*p+n*y*p+l*o*f-n*u*f,b=l*m*h-d*c*h+d*a*p-n*m*p-l*a*f+n*c*f,M=d*c*o-l*m*o-d*a*u+n*m*u+l*a*y-n*c*y,w=e*g+s*x+i*b+r*M;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const v=1/w;return t[0]=g*v,t[1]=(m*u*r-c*y*r-m*i*p+s*y*p+c*i*f-s*u*f)*v,t[2]=(a*y*r-m*o*r+m*i*h-s*y*h-a*i*f+s*o*f)*v,t[3]=(c*o*r-a*u*r-c*i*h+s*u*h+a*i*p-s*o*p)*v,t[4]=x*v,t[5]=(l*y*r-d*u*r+d*i*p-e*y*p-l*i*f+e*u*f)*v,t[6]=(d*o*r-n*y*r-d*i*h+e*y*h+n*i*f-e*o*f)*v,t[7]=(n*u*r-l*o*r+l*i*h-e*u*h-n*i*p+e*o*p)*v,t[8]=b*v,t[9]=(d*c*r-l*m*r-d*s*p+e*m*p+l*s*f-e*c*f)*v,t[10]=(n*m*r-d*a*r+d*s*h-e*m*h-n*s*f+e*a*f)*v,t[11]=(l*a*r-n*c*r-l*s*h+e*c*h+n*s*p-e*a*p)*v,t[12]=M*v,t[13]=(l*m*i-d*c*i+d*s*u-e*m*u-l*s*y+e*c*y)*v,t[14]=(d*a*i-n*m*i-d*s*o+e*m*o+n*s*y-e*a*y)*v,t[15]=(n*c*i-l*a*i+l*s*o-e*c*o-n*s*u+e*a*u)*v,this}scale(t){const e=this.elements,s=t.x,i=t.y,r=t.z;return e[0]*=s,e[4]*=i,e[8]*=r,e[1]*=s,e[5]*=i,e[9]*=r,e[2]*=s,e[6]*=i,e[10]*=r,e[3]*=s,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],s=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,s,i))}makeTranslation(t,e,s){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,s,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),s=Math.sin(t);return this.set(1,0,0,0,0,e,-s,0,0,s,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,0,s,0,0,1,0,0,-s,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,0,s,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const s=Math.cos(e),i=Math.sin(e),r=1-s,n=t.x,a=t.y,o=t.z,h=r*n,l=r*a;return this.set(h*n+s,h*a-i*o,h*o+i*a,0,h*a+i*o,l*a+s,l*o-i*n,0,h*o-i*a,l*o+i*n,r*o*o+s,0,0,0,0,1),this}makeScale(t,e,s){return this.set(t,0,0,0,0,e,0,0,0,0,s,0,0,0,0,1),this}makeShear(t,e,s,i,r,n){return this.set(1,s,r,0,t,1,n,0,e,i,1,0,0,0,0,1),this}compose(t,e,s){const i=this.elements,r=e._x,n=e._y,a=e._z,o=e._w,h=r+r,l=n+n,c=a+a,u=r*h,p=r*l,d=r*c,m=n*l,y=n*c,f=a*c,g=o*h,x=o*l,b=o*c,M=s.x,w=s.y,v=s.z;return i[0]=(1-(m+f))*M,i[1]=(p+b)*M,i[2]=(d-x)*M,i[3]=0,i[4]=(p-b)*w,i[5]=(1-(u+f))*w,i[6]=(y+g)*w,i[7]=0,i[8]=(d+x)*v,i[9]=(y-g)*v,i[10]=(1-(u+m))*v,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,s){const i=this.elements;if(t.x=i[12],t.y=i[13],t.z=i[14],0===this.determinant())return s.set(1,1,1),e.identity(),this;let r=zi.set(i[0],i[1],i[2]).length();const n=zi.set(i[4],i[5],i[6]).length(),a=zi.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),Ti.copy(this);const o=1/r,h=1/n,l=1/a;return Ti.elements[0]*=o,Ti.elements[1]*=o,Ti.elements[2]*=o,Ti.elements[4]*=h,Ti.elements[5]*=h,Ti.elements[6]*=h,Ti.elements[8]*=l,Ti.elements[9]*=l,Ti.elements[10]*=l,e.setFromRotationMatrix(Ti),s.x=r,s.y=n,s.z=a,this}makePerspective(t,e,s,i,r,n,a=2e3,o=!1){const h=this.elements,l=2*r/(e-t),c=2*r/(s-i),u=(e+t)/(e-t),p=(s+i)/(s-i);let d,m;if(o)d=r/(n-r),m=n*r/(n-r);else if(a===ss)d=-(n+r)/(n-r),m=-2*n*r/(n-r);else{if(a!==is)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);d=-n/(n-r),m=-n*r/(n-r)}return h[0]=l,h[4]=0,h[8]=u,h[12]=0,h[1]=0,h[5]=c,h[9]=p,h[13]=0,h[2]=0,h[6]=0,h[10]=d,h[14]=m,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(t,e,s,i,r,n,a=2e3,o=!1){const h=this.elements,l=2/(e-t),c=2/(s-i),u=-(e+t)/(e-t),p=-(s+i)/(s-i);let d,m;if(o)d=1/(n-r),m=n/(n-r);else if(a===ss)d=-2/(n-r),m=-(n+r)/(n-r);else{if(a!==is)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);d=-1/(n-r),m=-r/(n-r)}return h[0]=l,h[4]=0,h[8]=0,h[12]=u,h[1]=0,h[5]=c,h[9]=0,h[13]=p,h[2]=0,h[6]=0,h[10]=d,h[14]=m,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(t){const e=this.elements,s=t.elements;for(let t=0;t<16;t++)if(e[t]!==s[t])return!1;return!0}fromArray(t,e=0){for(let s=0;s<16;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t[e+9]=s[9],t[e+10]=s[10],t[e+11]=s[11],t[e+12]=s[12],t[e+13]=s[13],t[e+14]=s[14],t[e+15]=s[15],t}}const zi=new Cs,Ti=new Ai,Ci=new Cs(0,0,0),ki=new Cs(1,1,1),Bi=new Cs,Oi=new Cs,Pi=new Cs,Ni=new Ai,Ii=new Ts;class Vi{constructor(t=0,e=0,s=0,i=Vi.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=s,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,s,i=this._order){return this._x=t,this._y=e,this._z=s,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,s=!0){const i=t.elements,r=i[0],n=i[4],a=i[8],o=i[1],h=i[5],l=i[9],c=i[2],u=i[6],p=i[10];switch(e){case"XYZ":this._y=Math.asin(Ms(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,p),this._z=Math.atan2(-n,r)):(this._x=Math.atan2(u,h),this._z=0);break;case"YXZ":this._x=Math.asin(-Ms(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(o,h)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(Ms(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-c,p),this._z=Math.atan2(-n,h)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-Ms(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(u,p),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-n,h));break;case"YZX":this._z=Math.asin(Ms(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-Ms(n,-1,1)),Math.abs(n)<.9999999?(this._x=Math.atan2(u,h),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-l,p),this._y=0);break;default:cs("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===s&&this._onChangeCallback(),this}setFromQuaternion(t,e,s){return Ni.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Ni,e,s)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Ii.setFromEuler(this),this.setFromQuaternion(Ii,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Vi.DEFAULT_ORDER="XYZ";class Ri{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return 0!==(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let Li=0;const Ei=new Cs,Fi=new Ts,Di=new Ai,Ui=new Cs,ji=new Cs,Wi=new Cs,Ji=new Ts,qi=new Cs(1,0,0),Xi=new Cs(0,1,0),Yi=new Cs(0,0,1),Zi={type:"added"},Hi={type:"removed"},Gi={type:"childadded",child:null},$i={type:"childremoved",child:null};class Qi extends ms{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Li++}),this.uuid=bs(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Qi.DEFAULT_UP.clone();const t=new Cs,e=new Vi,s=new Ts,i=new Cs(1,1,1);e._onChange(function(){s.setFromEuler(e,!1)}),s._onChange(function(){e.setFromQuaternion(s,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:s},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Ai},normalMatrix:{value:new Os}}),this.matrix=new Ai,this.matrixWorld=new Ai,this.matrixAutoUpdate=Qi.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Qi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ri,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.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Fi.setFromAxisAngle(t,e),this.quaternion.multiply(Fi),this}rotateOnWorldAxis(t,e){return Fi.setFromAxisAngle(t,e),this.quaternion.premultiply(Fi),this}rotateX(t){return this.rotateOnAxis(qi,t)}rotateY(t){return this.rotateOnAxis(Xi,t)}rotateZ(t){return this.rotateOnAxis(Yi,t)}translateOnAxis(t,e){return Ei.copy(t).applyQuaternion(this.quaternion),this.position.add(Ei.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(qi,t)}translateY(t){return this.translateOnAxis(Xi,t)}translateZ(t){return this.translateOnAxis(Yi,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Di.copy(this.matrixWorld).invert())}lookAt(t,e,s){t.isVector3?Ui.copy(t):Ui.set(t,e,s);const i=this.parent;this.updateWorldMatrix(!0,!1),ji.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Di.lookAt(ji,Ui,this.up):Di.lookAt(Ui,ji,this.up),this.quaternion.setFromRotationMatrix(Di),i&&(Di.extractRotation(i.matrixWorld),Fi.setFromRotationMatrix(Di),this.quaternion.premultiply(Fi.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(us("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Zi),Gi.child=t,this.dispatchEvent(Gi),Gi.child=null):us("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Hi),$i.child=t,this.dispatchEvent($i),$i.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Di.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Di.multiply(t.parent.matrixWorld)),t.applyMatrix4(Di),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Zi),Gi.child=t,this.dispatchEvent(Gi),Gi.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let s=0,i=this.children.length;s<i;s++){const i=this.children[s].getObjectByProperty(t,e);if(void 0!==i)return i}}getObjectsByProperty(t,e,s=[]){this[t]===e&&s.push(this);const i=this.children;for(let r=0,n=i.length;r<n;r++)i[r].getObjectsByProperty(t,e,s);return s}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ji,t,Wi),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ji,Ji,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let s=0,i=e.length;s<i;s++)e[s].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let s=0,i=e.length;s<i;s++)e[s].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let s=0,i=e.length;s<i;s++){e[s].updateMatrixWorld(t)}}updateWorldMatrix(t,e){const s=this.parent;if(!0===t&&null!==s&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,s=t.length;e<s;e++){t[e].updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"==typeof t,s={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},s.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};function r(e,s){return void 0===e[s.uuid]&&(e[s.uuid]=s.toJSON(t)),s.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),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(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),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(t=>({...t,boundingBox:t.boundingBox?t.boundingBox.toJSON():void 0,boundingSphere:t.boundingSphere?t.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(t=>({...t})),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(t),i.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(t)),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(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const s=e.shapes;if(Array.isArray(s))for(let e=0,i=s.length;e<i;e++){const i=s[e];r(t.shapes,i)}else r(t.shapes,s)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let s=0,i=this.material.length;s<i;s++)e.push(r(t.materials,this.material[s]));i.material=e}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let e=0;e<this.children.length;e++)i.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let e=0;e<this.animations.length;e++){const s=this.animations[e];i.animations.push(r(t.animations,s))}}if(e){const e=n(t.geometries),i=n(t.materials),r=n(t.textures),a=n(t.images),o=n(t.shapes),h=n(t.skeletons),l=n(t.animations),c=n(t.nodes);e.length>0&&(s.geometries=e),i.length>0&&(s.materials=i),r.length>0&&(s.textures=r),a.length>0&&(s.images=a),o.length>0&&(s.shapes=o),h.length>0&&(s.skeletons=h),l.length>0&&(s.animations=l),c.length>0&&(s.nodes=c)}return s.object=i,s;function n(t){const e=[];for(const s in t){const i=t[s];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const s=t.children[e];this.add(s.clone())}return this}}Qi.DEFAULT_UP=new Cs(0,1,0),Qi.DEFAULT_MATRIX_AUTO_UPDATE=!0,Qi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Ki=new Cs,tr=new Cs,er=new Cs,sr=new Cs,ir=new Cs,rr=new Cs,nr=new Cs,ar=new Cs,or=new Cs,hr=new Cs,lr=new Ys,cr=new Ys,ur=new Ys;class pr{constructor(t=new Cs,e=new Cs,s=new Cs){this.a=t,this.b=e,this.c=s}static getNormal(t,e,s,i){i.subVectors(s,e),Ki.subVectors(t,e),i.cross(Ki);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,s,i,r){Ki.subVectors(i,e),tr.subVectors(s,e),er.subVectors(t,e);const n=Ki.dot(Ki),a=Ki.dot(tr),o=Ki.dot(er),h=tr.dot(tr),l=tr.dot(er),c=n*h-a*a;if(0===c)return r.set(0,0,0),null;const u=1/c,p=(h*o-a*l)*u,d=(n*l-a*o)*u;return r.set(1-p-d,d,p)}static containsPoint(t,e,s,i){return null!==this.getBarycoord(t,e,s,i,sr)&&(sr.x>=0&&sr.y>=0&&sr.x+sr.y<=1)}static getInterpolation(t,e,s,i,r,n,a,o){return null===this.getBarycoord(t,e,s,i,sr)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,sr.x),o.addScaledVector(n,sr.y),o.addScaledVector(a,sr.z),o)}static getInterpolatedAttribute(t,e,s,i,r,n){return lr.setScalar(0),cr.setScalar(0),ur.setScalar(0),lr.fromBufferAttribute(t,e),cr.fromBufferAttribute(t,s),ur.fromBufferAttribute(t,i),n.setScalar(0),n.addScaledVector(lr,r.x),n.addScaledVector(cr,r.y),n.addScaledVector(ur,r.z),n}static isFrontFacing(t,e,s,i){return Ki.subVectors(s,e),tr.subVectors(t,e),Ki.cross(tr).dot(i)<0}set(t,e,s){return this.a.copy(t),this.b.copy(e),this.c.copy(s),this}setFromPointsAndIndices(t,e,s,i){return this.a.copy(t[e]),this.b.copy(t[s]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,s,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,s),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Ki.subVectors(this.c,this.b),tr.subVectors(this.a,this.b),.5*Ki.cross(tr).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return pr.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return pr.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,s,i,r){return pr.getInterpolation(t,this.a,this.b,this.c,e,s,i,r)}containsPoint(t){return pr.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return pr.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const s=this.a,i=this.b,r=this.c;let n,a;ir.subVectors(i,s),rr.subVectors(r,s),ar.subVectors(t,s);const o=ir.dot(ar),h=rr.dot(ar);if(o<=0&&h<=0)return e.copy(s);or.subVectors(t,i);const l=ir.dot(or),c=rr.dot(or);if(l>=0&&c<=l)return e.copy(i);const u=o*c-l*h;if(u<=0&&o>=0&&l<=0)return n=o/(o-l),e.copy(s).addScaledVector(ir,n);hr.subVectors(t,r);const p=ir.dot(hr),d=rr.dot(hr);if(d>=0&&p<=d)return e.copy(r);const m=p*h-o*d;if(m<=0&&h>=0&&d<=0)return a=h/(h-d),e.copy(s).addScaledVector(rr,a);const y=l*d-p*c;if(y<=0&&c-l>=0&&p-d>=0)return nr.subVectors(r,i),a=(c-l)/(c-l+(p-d)),e.copy(i).addScaledVector(nr,a);const f=1/(y+m+u);return n=m*f,a=u*f,e.copy(s).addScaledVector(ir,n).addScaledVector(rr,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const dr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},mr={h:0,s:0,l:0},yr={h:0,s:0,l:0};function fr(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+6*(e-t)*(2/3-s):t}class gr{constructor(t,e,s){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,s)}set(t,e,s){if(void 0===e&&void 0===s){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,s);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=De){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Rs.colorSpaceToWorking(this,e),this}setRGB(t,e,s,i=Rs.workingColorSpace){return this.r=t,this.g=e,this.b=s,Rs.colorSpaceToWorking(this,i),this}setHSL(t,e,s,i=Rs.workingColorSpace){if(t=ws(t,1),e=Ms(e,0,1),s=Ms(s,0,1),0===e)this.r=this.g=this.b=s;else{const i=s<=.5?s*(1+e):s+e-s*e,r=2*s-i;this.r=fr(r,i,t+1/3),this.g=fr(r,i,t),this.b=fr(r,i,t-1/3)}return Rs.colorSpaceToWorking(this,i),this}setStyle(t,e=De){function s(e){void 0!==e&&parseFloat(e)<1&&cs("Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const n=i[1],a=i[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return s(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:cs("Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const s=i[1],r=s.length;if(3===r)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(s,16),e);cs("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=De){const s=dr[t.toLowerCase()];return void 0!==s?this.setHex(s,e):cs("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Ls(t.r),this.g=Ls(t.g),this.b=Ls(t.b),this}copyLinearToSRGB(t){return this.r=Es(t.r),this.g=Es(t.g),this.b=Es(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=De){return Rs.workingToColorSpace(xr.copy(this),t),65536*Math.round(Ms(255*xr.r,0,255))+256*Math.round(Ms(255*xr.g,0,255))+Math.round(Ms(255*xr.b,0,255))}getHexString(t=De){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Rs.workingColorSpace){Rs.workingToColorSpace(xr.copy(this),e);const s=xr.r,i=xr.g,r=xr.b,n=Math.max(s,i,r),a=Math.min(s,i,r);let o,h;const l=(a+n)/2;if(a===n)o=0,h=0;else{const t=n-a;switch(h=l<=.5?t/(n+a):t/(2-n-a),n){case s:o=(i-r)/t+(i<r?6:0);break;case i:o=(r-s)/t+2;break;case r:o=(s-i)/t+4}o/=6}return t.h=o,t.s=h,t.l=l,t}getRGB(t,e=Rs.workingColorSpace){return Rs.workingToColorSpace(xr.copy(this),e),t.r=xr.r,t.g=xr.g,t.b=xr.b,t}getStyle(t=De){Rs.workingToColorSpace(xr.copy(this),t);const e=xr.r,s=xr.g,i=xr.b;return t!==De?`color(${t} ${e.toFixed(3)} ${s.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*s)},${Math.round(255*i)})`}offsetHSL(t,e,s){return this.getHSL(mr),this.setHSL(mr.h+t,mr.s+e,mr.l+s)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,s){return this.r=t.r+(e.r-t.r)*s,this.g=t.g+(e.g-t.g)*s,this.b=t.b+(e.b-t.b)*s,this}lerpHSL(t,e){this.getHSL(mr),t.getHSL(yr);const s=vs(mr.h,yr.h,e),i=vs(mr.s,yr.s,e),r=vs(mr.l,yr.l,e);return this.setHSL(s,i,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,s=this.g,i=this.b,r=t.elements;return this.r=r[0]*e+r[3]*s+r[6]*i,this.g=r[1]*e+r[4]*s+r[7]*i,this.b=r[2]*e+r[5]*s+r[8]*i,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const xr=new gr;gr.NAMES=dr;let br=0;class Mr extends ms{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:br++}),this.uuid=bs(),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 gr(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=Je,this.stencilZFail=Je,this.stencilZPass=Je,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(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const s=t[e];if(void 0===s){cs(`Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(s):i&&i.isVector3&&s&&s.isVector3?i.copy(s):this[e]=s:cs(`Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const s={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const s in t){const i=t[s];delete i.metadata,e.push(i)}return e}if(s.uuid=this.uuid,s.type=this.type,""!==this.name&&(s.name=this.name),this.color&&this.color.isColor&&(s.color=this.color.getHex()),void 0!==this.roughness&&(s.roughness=this.roughness),void 0!==this.metalness&&(s.metalness=this.metalness),void 0!==this.sheen&&(s.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(s.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(s.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(s.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(s.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(s.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(s.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(s.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(s.shininess=this.shininess),void 0!==this.clearcoat&&(s.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(s.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(s.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(s.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(s.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,s.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(s.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(s.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),void 0!==this.dispersion&&(s.dispersion=this.dispersion),void 0!==this.iridescence&&(s.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(s.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(s.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(s.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(s.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(s.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(s.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(s.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(s.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(s.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(s.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(s.lightMap=this.lightMap.toJSON(t).uuid,s.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(s.aoMap=this.aoMap.toJSON(t).uuid,s.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(s.bumpMap=this.bumpMap.toJSON(t).uuid,s.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(s.normalMap=this.normalMap.toJSON(t).uuid,s.normalMapType=this.normalMapType,s.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(s.displacementMap=this.displacementMap.toJSON(t).uuid,s.displacementScale=this.displacementScale,s.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(s.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(s.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(s.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(s.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(s.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(s.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(s.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(s.combine=this.combine)),void 0!==this.envMapRotation&&(s.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(s.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(s.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(s.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(s.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(s.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(s.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(s.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(s.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(s.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(s.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(s.size=this.size),null!==this.shadowSide&&(s.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(s.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(s.blending=this.blending),0!==this.side&&(s.side=this.side),!0===this.vertexColors&&(s.vertexColors=!0),this.opacity<1&&(s.opacity=this.opacity),!0===this.transparent&&(s.transparent=!0),204!==this.blendSrc&&(s.blendSrc=this.blendSrc),205!==this.blendDst&&(s.blendDst=this.blendDst),100!==this.blendEquation&&(s.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(s.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(s.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(s.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(s.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(s.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(s.depthFunc=this.depthFunc),!1===this.depthTest&&(s.depthTest=this.depthTest),!1===this.depthWrite&&(s.depthWrite=this.depthWrite),!1===this.colorWrite&&(s.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(s.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(s.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(s.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(s.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Je&&(s.stencilFail=this.stencilFail),this.stencilZFail!==Je&&(s.stencilZFail=this.stencilZFail),this.stencilZPass!==Je&&(s.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(s.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(s.rotation=this.rotation),!0===this.polygonOffset&&(s.polygonOffset=!0),0!==this.polygonOffsetFactor&&(s.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(s.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(s.linewidth=this.linewidth),void 0!==this.dashSize&&(s.dashSize=this.dashSize),void 0!==this.gapSize&&(s.gapSize=this.gapSize),void 0!==this.scale&&(s.scale=this.scale),!0===this.dithering&&(s.dithering=!0),this.alphaTest>0&&(s.alphaTest=this.alphaTest),!0===this.alphaHash&&(s.alphaHash=!0),!0===this.alphaToCoverage&&(s.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(s.premultipliedAlpha=!0),!0===this.forceSinglePass&&(s.forceSinglePass=!0),!1===this.allowOverride&&(s.allowOverride=!1),!0===this.wireframe&&(s.wireframe=!0),this.wireframeLinewidth>1&&(s.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(s.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(s.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(s.flatShading=!0),!1===this.visible&&(s.visible=!1),!1===this.toneMapped&&(s.toneMapped=!1),!1===this.fog&&(s.fog=!1),Object.keys(this.userData).length>0&&(s.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(s.textures=e),r.length>0&&(s.images=r)}return s}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let s=null;if(null!==e){const t=e.length;s=new Array(t);for(let i=0;i!==t;++i)s[i]=e[i].clone()}return this.clippingPlanes=s,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class wr extends Mr{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new gr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Vi,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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const vr=Sr();function Sr(){const t=new ArrayBuffer(4),e=new Float32Array(t),s=new Uint32Array(t),i=new Uint32Array(512),r=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(i[t]=0,i[256|t]=32768,r[t]=24,r[256|t]=24):e<-14?(i[t]=1024>>-e-14,i[256|t]=1024>>-e-14|32768,r[t]=-e-1,r[256|t]=-e-1):e<=15?(i[t]=e+15<<10,i[256|t]=e+15<<10|32768,r[t]=13,r[256|t]=13):e<128?(i[t]=31744,i[256|t]=64512,r[t]=24,r[256|t]=24):(i[t]=31744,i[256|t]=64512,r[t]=13,r[256|t]=13)}const n=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,s=0;for(;!(8388608&e);)e<<=1,s-=8388608;e&=-8388609,s+=947912704,n[t]=e|s}for(let t=1024;t<2048;++t)n[t]=939524096+(t-1024<<13);for(let t=1;t<31;++t)a[t]=t<<23;a[31]=1199570944,a[32]=2147483648;for(let t=33;t<63;++t)a[t]=2147483648+(t-32<<23);a[63]=3347054592;for(let t=1;t<64;++t)32!==t&&(o[t]=1024);return{floatView:e,uint32View:s,baseTable:i,shiftTable:r,mantissaTable:n,exponentTable:a,offsetTable:o}}class _r{static toHalfFloat(t){return function(t){Math.abs(t)>65504&&cs("DataUtils.toHalfFloat(): Value out of range."),t=Ms(t,-65504,65504),vr.floatView[0]=t;const e=vr.uint32View[0],s=e>>23&511;return vr.baseTable[s]+((8388607&e)>>vr.shiftTable[s])}(t)}static fromHalfFloat(t){return function(t){const e=t>>10;return vr.uint32View[0]=vr.mantissaTable[vr.offsetTable[e]+(1023&t)]+vr.exponentTable[e],vr.floatView[0]}(t)}}const Ar=new Cs,zr=new zs;let Tr=0;class Cr{constructor(t,e,s=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Tr++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=s,this.usage=ts,this.updateRanges=[],this.gpuType=zt,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,s){t*=this.itemSize,s*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[s+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,s=this.count;e<s;e++)zr.fromBufferAttribute(this,e),zr.applyMatrix3(t),this.setXY(e,zr.x,zr.y);else if(3===this.itemSize)for(let e=0,s=this.count;e<s;e++)Ar.fromBufferAttribute(this,e),Ar.applyMatrix3(t),this.setXYZ(e,Ar.x,Ar.y,Ar.z);return this}applyMatrix4(t){for(let e=0,s=this.count;e<s;e++)Ar.fromBufferAttribute(this,e),Ar.applyMatrix4(t),this.setXYZ(e,Ar.x,Ar.y,Ar.z);return this}applyNormalMatrix(t){for(let e=0,s=this.count;e<s;e++)Ar.fromBufferAttribute(this,e),Ar.applyNormalMatrix(t),this.setXYZ(e,Ar.x,Ar.y,Ar.z);return this}transformDirection(t){for(let e=0,s=this.count;e<s;e++)Ar.fromBufferAttribute(this,e),Ar.transformDirection(t),this.setXYZ(e,Ar.x,Ar.y,Ar.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let s=this.array[t*this.itemSize+e];return this.normalized&&(s=Ss(s,this.array)),s}setComponent(t,e,s){return this.normalized&&(s=_s(s,this.array)),this.array[t*this.itemSize+e]=s,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Ss(e,this.array)),e}setX(t,e){return this.normalized&&(e=_s(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Ss(e,this.array)),e}setY(t,e){return this.normalized&&(e=_s(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Ss(e,this.array)),e}setZ(t,e){return this.normalized&&(e=_s(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Ss(e,this.array)),e}setW(t,e){return this.normalized&&(e=_s(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,s){return t*=this.itemSize,this.normalized&&(e=_s(e,this.array),s=_s(s,this.array)),this.array[t+0]=e,this.array[t+1]=s,this}setXYZ(t,e,s,i){return t*=this.itemSize,this.normalized&&(e=_s(e,this.array),s=_s(s,this.array),i=_s(i,this.array)),this.array[t+0]=e,this.array[t+1]=s,this.array[t+2]=i,this}setXYZW(t,e,s,i,r){return t*=this.itemSize,this.normalized&&(e=_s(e,this.array),s=_s(s,this.array),i=_s(i,this.array),r=_s(r,this.array)),this.array[t+0]=e,this.array[t+1]=s,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==ts&&(t.usage=this.usage),t}}class kr extends Cr{constructor(t,e,s){super(new Uint16Array(t),e,s)}}class Br extends Cr{constructor(t,e,s){super(new Uint32Array(t),e,s)}}class Or extends Cr{constructor(t,e,s){super(new Float32Array(t),e,s)}}let Pr=0;const Nr=new Ai,Ir=new Qi,Vr=new Cs,Rr=new Qs,Lr=new Qs,Er=new Cs;class Fr extends ms{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Pr++}),this.uuid=bs(),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(t){return Array.isArray(t)?this.index=new(rs(t)?Br:kr)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,s=0){this.groups.push({start:t,count:e,materialIndex:s})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const s=this.attributes.normal;if(void 0!==s){const e=(new Os).getNormalMatrix(t);s.applyNormalMatrix(e),s.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Nr.makeRotationFromQuaternion(t),this.applyMatrix4(Nr),this}rotateX(t){return Nr.makeRotationX(t),this.applyMatrix4(Nr),this}rotateY(t){return Nr.makeRotationY(t),this.applyMatrix4(Nr),this}rotateZ(t){return Nr.makeRotationZ(t),this.applyMatrix4(Nr),this}translate(t,e,s){return Nr.makeTranslation(t,e,s),this.applyMatrix4(Nr),this}scale(t,e,s){return Nr.makeScale(t,e,s),this.applyMatrix4(Nr),this}lookAt(t){return Ir.lookAt(t),Ir.updateMatrix(),this.applyMatrix4(Ir.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Vr).negate(),this.translate(Vr.x,Vr.y,Vr.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let s=0,i=t.length;s<i;s++){const i=t[s];e.push(i.x,i.y,i.z||0)}this.setAttribute("position",new Or(e,3))}else{const s=Math.min(t.length,e.count);for(let i=0;i<s;i++){const s=t[i];e.setXYZ(i,s.x,s.y,s.z||0)}t.length>e.count&&cs("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Qs);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return us("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Cs(-1/0,-1/0,-1/0),new Cs(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,s=e.length;t<s;t++){const s=e[t];Rr.setFromBufferAttribute(s),this.morphTargetsRelative?(Er.addVectors(this.boundingBox.min,Rr.min),this.boundingBox.expandByPoint(Er),Er.addVectors(this.boundingBox.max,Rr.max),this.boundingBox.expandByPoint(Er)):(this.boundingBox.expandByPoint(Rr.min),this.boundingBox.expandByPoint(Rr.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&us('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 fi);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return us("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new Cs,1/0);if(t){const s=this.boundingSphere.center;if(Rr.setFromBufferAttribute(t),e)for(let t=0,s=e.length;t<s;t++){const s=e[t];Lr.setFromBufferAttribute(s),this.morphTargetsRelative?(Er.addVectors(Rr.min,Lr.min),Rr.expandByPoint(Er),Er.addVectors(Rr.max,Lr.max),Rr.expandByPoint(Er)):(Rr.expandByPoint(Lr.min),Rr.expandByPoint(Lr.max))}Rr.getCenter(s);let i=0;for(let e=0,r=t.count;e<r;e++)Er.fromBufferAttribute(t,e),i=Math.max(i,s.distanceToSquared(Er));if(e)for(let r=0,n=e.length;r<n;r++){const n=e[r],a=this.morphTargetsRelative;for(let e=0,r=n.count;e<r;e++)Er.fromBufferAttribute(n,e),a&&(Vr.fromBufferAttribute(t,e),Er.add(Vr)),i=Math.max(i,s.distanceToSquared(Er))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&us('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void us("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const s=e.position,i=e.normal,r=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Cr(new Float32Array(4*s.count),4));const n=this.getAttribute("tangent"),a=[],o=[];for(let t=0;t<s.count;t++)a[t]=new Cs,o[t]=new Cs;const h=new Cs,l=new Cs,c=new Cs,u=new zs,p=new zs,d=new zs,m=new Cs,y=new Cs;function f(t,e,i){h.fromBufferAttribute(s,t),l.fromBufferAttribute(s,e),c.fromBufferAttribute(s,i),u.fromBufferAttribute(r,t),p.fromBufferAttribute(r,e),d.fromBufferAttribute(r,i),l.sub(h),c.sub(h),p.sub(u),d.sub(u);const n=1/(p.x*d.y-d.x*p.y);isFinite(n)&&(m.copy(l).multiplyScalar(d.y).addScaledVector(c,-p.y).multiplyScalar(n),y.copy(c).multiplyScalar(p.x).addScaledVector(l,-d.x).multiplyScalar(n),a[t].add(m),a[e].add(m),a[i].add(m),o[t].add(y),o[e].add(y),o[i].add(y))}let g=this.groups;0===g.length&&(g=[{start:0,count:t.count}]);for(let e=0,s=g.length;e<s;++e){const s=g[e],i=s.start;for(let e=i,r=i+s.count;e<r;e+=3)f(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const x=new Cs,b=new Cs,M=new Cs,w=new Cs;function v(t){M.fromBufferAttribute(i,t),w.copy(M);const e=a[t];x.copy(e),x.sub(M.multiplyScalar(M.dot(e))).normalize(),b.crossVectors(w,e);const s=b.dot(o[t])<0?-1:1;n.setXYZW(t,x.x,x.y,x.z,s)}for(let e=0,s=g.length;e<s;++e){const s=g[e],i=s.start;for(let e=i,r=i+s.count;e<r;e+=3)v(t.getX(e+0)),v(t.getX(e+1)),v(t.getX(e+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let s=this.getAttribute("normal");if(void 0===s)s=new Cr(new Float32Array(3*e.count),3),this.setAttribute("normal",s);else for(let t=0,e=s.count;t<e;t++)s.setXYZ(t,0,0,0);const i=new Cs,r=new Cs,n=new Cs,a=new Cs,o=new Cs,h=new Cs,l=new Cs,c=new Cs;if(t)for(let u=0,p=t.count;u<p;u+=3){const p=t.getX(u+0),d=t.getX(u+1),m=t.getX(u+2);i.fromBufferAttribute(e,p),r.fromBufferAttribute(e,d),n.fromBufferAttribute(e,m),l.subVectors(n,r),c.subVectors(i,r),l.cross(c),a.fromBufferAttribute(s,p),o.fromBufferAttribute(s,d),h.fromBufferAttribute(s,m),a.add(l),o.add(l),h.add(l),s.setXYZ(p,a.x,a.y,a.z),s.setXYZ(d,o.x,o.y,o.z),s.setXYZ(m,h.x,h.y,h.z)}else for(let t=0,a=e.count;t<a;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),n.fromBufferAttribute(e,t+2),l.subVectors(n,r),c.subVectors(i,r),l.cross(c),s.setXYZ(t+0,l.x,l.y,l.z),s.setXYZ(t+1,l.x,l.y,l.z),s.setXYZ(t+2,l.x,l.y,l.z);this.normalizeNormals(),s.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,s=t.count;e<s;e++)Er.fromBufferAttribute(t,e),Er.normalize(),t.setXYZ(e,Er.x,Er.y,Er.z)}toNonIndexed(){function t(t,e){const s=t.array,i=t.itemSize,r=t.normalized,n=new s.constructor(e.length*i);let a=0,o=0;for(let r=0,h=e.length;r<h;r++){a=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*i;for(let t=0;t<i;t++)n[o++]=s[a++]}return new Cr(n,i,r)}if(null===this.index)return cs("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Fr,s=this.index.array,i=this.attributes;for(const r in i){const n=t(i[r],s);e.setAttribute(r,n)}const r=this.morphAttributes;for(const i in r){const n=[],a=r[i];for(let e=0,i=a.length;e<i;e++){const i=t(a[e],s);n.push(i)}e.morphAttributes[i]=n}e.morphTargetsRelative=this.morphTargetsRelative;const n=this.groups;for(let t=0,s=n.length;t<s;t++){const s=n[t];e.addGroup(s.start,s.count,s.materialIndex)}return e}toJSON(){const t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const s in e)void 0!==e[s]&&(t[s]=e[s]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const s=this.attributes;for(const e in s){const i=s[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const s=this.morphAttributes[e],n=[];for(let e=0,i=s.length;e<i;e++){const i=s[e];n.push(i.toJSON(t.data))}n.length>0&&(i[e]=n,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const n=this.groups;n.length>0&&(t.data.groups=JSON.parse(JSON.stringify(n)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere=a.toJSON()),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const s=t.index;null!==s&&this.setIndex(s.clone());const i=t.attributes;for(const t in i){const s=i[t];this.setAttribute(t,s.clone(e))}const r=t.morphAttributes;for(const t in r){const s=[],i=r[t];for(let t=0,r=i.length;t<r;t++)s.push(i[t].clone(e));this.morphAttributes[t]=s}this.morphTargetsRelative=t.morphTargetsRelative;const n=t.groups;for(let t=0,e=n.length;t<e;t++){const e=n[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Dr=new Ai,Ur=new _i,jr=new fi,Wr=new Cs,Jr=new Cs,qr=new Cs,Xr=new Cs,Yr=new Cs,Zr=new Cs,Hr=new Cs,Gr=new Cs;class $r extends Qi{constructor(t=new Fr,e=new wr){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const s=t[e[0]];if(void 0!==s){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=s.length;t<e;t++){const e=s[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){const s=this.geometry,i=s.attributes.position,r=s.morphAttributes.position,n=s.morphTargetsRelative;e.fromBufferAttribute(i,t);const a=this.morphTargetInfluences;if(r&&a){Zr.set(0,0,0);for(let s=0,i=r.length;s<i;s++){const i=a[s],o=r[s];0!==i&&(Yr.fromBufferAttribute(o,t),n?Zr.addScaledVector(Yr,i):Zr.addScaledVector(Yr.sub(e),i))}e.add(Zr)}return e}raycast(t,e){const s=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===s.boundingSphere&&s.computeBoundingSphere(),jr.copy(s.boundingSphere),jr.applyMatrix4(r),Ur.copy(t.ray).recast(t.near),!1===jr.containsPoint(Ur.origin)){if(null===Ur.intersectSphere(jr,Wr))return;if(Ur.origin.distanceToSquared(Wr)>(t.far-t.near)**2)return}Dr.copy(r).invert(),Ur.copy(t.ray).applyMatrix4(Dr),null!==s.boundingBox&&!1===Ur.intersectsBox(s.boundingBox)||this._computeIntersections(t,e,Ur)}}_computeIntersections(t,e,s){let i;const r=this.geometry,n=this.material,a=r.index,o=r.attributes.position,h=r.attributes.uv,l=r.attributes.uv1,c=r.attributes.normal,u=r.groups,p=r.drawRange;if(null!==a)if(Array.isArray(n))for(let r=0,o=u.length;r<o;r++){const o=u[r],d=n[o.materialIndex];for(let r=Math.max(o.start,p.start),n=Math.min(a.count,Math.min(o.start+o.count,p.start+p.count));r<n;r+=3){i=Qr(this,d,t,s,h,l,c,a.getX(r),a.getX(r+1),a.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,e.push(i))}}else{for(let r=Math.max(0,p.start),o=Math.min(a.count,p.start+p.count);r<o;r+=3){i=Qr(this,n,t,s,h,l,c,a.getX(r),a.getX(r+1),a.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),e.push(i))}}else if(void 0!==o)if(Array.isArray(n))for(let r=0,a=u.length;r<a;r++){const a=u[r],d=n[a.materialIndex];for(let r=Math.max(a.start,p.start),n=Math.min(o.count,Math.min(a.start+a.count,p.start+p.count));r<n;r+=3){i=Qr(this,d,t,s,h,l,c,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=a.materialIndex,e.push(i))}}else{for(let r=Math.max(0,p.start),a=Math.min(o.count,p.start+p.count);r<a;r+=3){i=Qr(this,n,t,s,h,l,c,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),e.push(i))}}}}function Qr(t,e,s,i,r,n,a,o,h,l){t.getVertexPosition(o,Jr),t.getVertexPosition(h,qr),t.getVertexPosition(l,Xr);const c=function(t,e,s,i,r,n,a,o){let h;if(h=1===e.side?i.intersectTriangle(a,n,r,!0,o):i.intersectTriangle(r,n,a,0===e.side,o),null===h)return null;Gr.copy(o),Gr.applyMatrix4(t.matrixWorld);const l=s.ray.origin.distanceTo(Gr);return l<s.near||l>s.far?null:{distance:l,point:Gr.clone(),object:t}}(t,e,s,i,Jr,qr,Xr,Hr);if(c){const t=new Cs;pr.getBarycoord(Hr,Jr,qr,Xr,t),r&&(c.uv=pr.getInterpolatedAttribute(r,o,h,l,t,new zs)),n&&(c.uv1=pr.getInterpolatedAttribute(n,o,h,l,t,new zs)),a&&(c.normal=pr.getInterpolatedAttribute(a,o,h,l,t,new Cs),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));const e={a:o,b:h,c:l,normal:new Cs,materialIndex:0};pr.getNormal(Jr,qr,Xr,e.normal),c.face=e,c.barycoord=t}return c}class Kr extends Fr{constructor(t=1,e=1,s=1,i=1,r=1,n=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:s,widthSegments:i,heightSegments:r,depthSegments:n};const a=this;i=Math.floor(i),r=Math.floor(r),n=Math.floor(n);const o=[],h=[],l=[],c=[];let u=0,p=0;function d(t,e,s,i,r,n,d,m,y,f,g){const x=n/y,b=d/f,M=n/2,w=d/2,v=m/2,S=y+1,_=f+1;let A=0,z=0;const T=new Cs;for(let n=0;n<_;n++){const a=n*b-w;for(let o=0;o<S;o++){const u=o*x-M;T[t]=u*i,T[e]=a*r,T[s]=v,h.push(T.x,T.y,T.z),T[t]=0,T[e]=0,T[s]=m>0?1:-1,l.push(T.x,T.y,T.z),c.push(o/y),c.push(1-n/f),A+=1}}for(let t=0;t<f;t++)for(let e=0;e<y;e++){const s=u+e+S*t,i=u+e+S*(t+1),r=u+(e+1)+S*(t+1),n=u+(e+1)+S*t;o.push(s,i,n),o.push(i,r,n),z+=6}a.addGroup(p,z,g),p+=z,u+=A}d("z","y","x",-1,-1,s,e,t,n,r,0),d("z","y","x",1,-1,s,e,-t,n,r,1),d("x","z","y",1,1,t,s,e,i,n,2),d("x","z","y",1,-1,t,s,-e,i,n,3),d("x","y","z",1,-1,t,e,s,i,r,4),d("x","y","z",-1,-1,t,e,-s,i,r,5),this.setIndex(o),this.setAttribute("position",new Or(h,3)),this.setAttribute("normal",new Or(l,3)),this.setAttribute("uv",new Or(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Kr(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function tn(t){const e={};for(const s in t){e[s]={};for(const i in t[s]){const r=t[s][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(cs("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[s][i]=null):e[s][i]=r.clone():Array.isArray(r)?e[s][i]=r.slice():e[s][i]=r}}return e}function en(t){const e={};for(let s=0;s<t.length;s++){const i=tn(t[s]);for(const t in i)e[t]=i[t]}return e}function sn(t){const e=t.getRenderTarget();return null===e?t.outputColorSpace:!0===e.isXRRenderTarget?e.texture.colorSpace:Rs.workingColorSpace}const rn={clone:tn,merge:en};class nn extends Mr{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_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!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=tn(t.uniforms),this.uniformsGroups=function(t){const e=[];for(let s=0;s<t.length;s++)e.push(t[s].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this.defaultAttributeValues=Object.assign({},t.defaultAttributeValues),this.index0AttributeName=t.index0AttributeName,this.uniformsNeedUpdate=t.uniformsNeedUpdate,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const s in this.uniforms){const i=this.uniforms[s].value;i&&i.isTexture?e.uniforms[s]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[s]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[s]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[s]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[s]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[s]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[s]={type:"m4",value:i.toArray()}:e.uniforms[s]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const s={};for(const t in this.extensions)!0===this.extensions[t]&&(s[t]=!0);return Object.keys(s).length>0&&(e.extensions=s),e}}class an extends Qi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ai,this.projectionMatrix=new Ai,this.projectionMatrixInverse=new Ai,this.coordinateSystem=ss,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const on=new Cs,hn=new zs,ln=new zs;class cn extends an{constructor(t=50,e=1,s=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=s,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*xs*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*gs*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*xs*Math.atan(Math.tan(.5*gs*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,s){on.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(on.x,on.y).multiplyScalar(-t/on.z),on.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),s.set(on.x,on.y).multiplyScalar(-t/on.z)}getViewSize(t,e){return this.getViewBounds(t,hn,ln),e.subVectors(ln,hn)}setViewOffset(t,e,s,i,r,n){this.aspect=t/e,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=t,this.view.fullHeight=e,this.view.offsetX=s,this.view.offsetY=i,this.view.width=r,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*gs*this.fov)/this.zoom,s=2*e,i=this.aspect*s,r=-.5*i;const n=this.view;if(null!==this.view&&this.view.enabled){const t=n.fullWidth,a=n.fullHeight;r+=n.offsetX*i/t,e-=n.offsetY*s/a,i*=n.width/t,s*=n.height/a}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-s,t,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const un=-90;class pn extends Qi{constructor(t,e,s){super(),this.type="CubeCamera",this.renderTarget=s,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new cn(un,1,t,e);i.layers=this.layers,this.add(i);const r=new cn(un,1,t,e);r.layers=this.layers,this.add(r);const n=new cn(un,1,t,e);n.layers=this.layers,this.add(n);const a=new cn(un,1,t,e);a.layers=this.layers,this.add(a);const o=new cn(un,1,t,e);o.layers=this.layers,this.add(o);const h=new cn(un,1,t,e);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[s,i,r,n,a,o]=e;for(const t of e)this.remove(t);if(t===ss)s.up.set(0,1,0),s.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),n.up.set(0,0,1),n.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(t!==is)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);s.up.set(0,-1,0),s.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),n.up.set(0,0,-1),n.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:s,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,n,a,o,h,l]=this.children,c=t.getRenderTarget(),u=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),d=t.xr.enabled;t.xr.enabled=!1;const m=s.texture.generateMipmaps;s.texture.generateMipmaps=!1,t.setRenderTarget(s,0,i),t.render(e,r),t.setRenderTarget(s,1,i),t.render(e,n),t.setRenderTarget(s,2,i),t.render(e,a),t.setRenderTarget(s,3,i),t.render(e,o),t.setRenderTarget(s,4,i),t.render(e,h),s.texture.generateMipmaps=m,t.setRenderTarget(s,5,i),t.render(e,l),t.setRenderTarget(c,u,p),t.xr.enabled=d,s.texture.needsPMREMUpdate=!0}}class dn extends Xs{constructor(t=[],e=301,s,i,r,n,a,o,h,l){super(t,e,s,i,r,n,a,o,h,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class mn extends Hs{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const s={width:t,height:t,depth:1},i=[s,s,s,s,s,s];this.texture=new dn(i),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const s={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new Kr(5,5,5),r=new nn({name:"CubemapFromEquirect",uniforms:tn(s.uniforms),vertexShader:s.vertexShader,fragmentShader:s.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const n=new $r(i,r),a=e.minFilter;e.minFilter===bt&&(e.minFilter=gt);return new pn(1,10,this).update(t,n),e.minFilter=a,n.geometry.dispose(),n.material.dispose(),this}clear(t,e=!0,s=!0,i=!0){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,s,i);t.setRenderTarget(r)}}class yn extends Qi{constructor(){super(),this.isGroup=!0,this.type="Group"}}const fn={type:"move"};class gn{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new yn,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 yn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Cs,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Cs),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new yn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Cs,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Cs),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const s of t.hand.values())this._getHandJoint(e,s)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,s){let i=null,r=null,n=null;const a=this._targetRay,o=this._grip,h=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(h&&t.hand){n=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,s),r=this._getHandJoint(h,i);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}const i=h.joints["index-finger-tip"],r=h.joints["thumb-tip"],a=i.position.distanceTo(r.position),o=.02,l=.005;h.inputState.pinching&&a>o+l?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!h.inputState.pinching&&a<=o-l&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,s),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(i=e.getPose(t.targetRaySpace,s),null===i&&null!==r&&(i=r),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(fn)))}return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==h&&(h.visible=null!==n),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const s=new yn;s.matrixAutoUpdate=!1,s.visible=!1,t.joints[e.jointName]=s,t.add(s)}return t.joints[e.jointName]}}class xn extends Qi{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 Vi,this.environmentIntensity=1,this.environmentRotation=new Vi,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class bn{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=ts,this.updateRanges=[],this.version=0,this.uuid=bs()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,s){t*=this.stride,s*=e.stride;for(let i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[s+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=bs()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),s=new this.constructor(e,this.stride);return s.setUsage(this.usage),s}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=bs()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.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}}}const Mn=new Cs;class wn{constructor(t,e,s,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=s,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,s=this.data.count;e<s;e++)Mn.fromBufferAttribute(this,e),Mn.applyMatrix4(t),this.setXYZ(e,Mn.x,Mn.y,Mn.z);return this}applyNormalMatrix(t){for(let e=0,s=this.count;e<s;e++)Mn.fromBufferAttribute(this,e),Mn.applyNormalMatrix(t),this.setXYZ(e,Mn.x,Mn.y,Mn.z);return this}transformDirection(t){for(let e=0,s=this.count;e<s;e++)Mn.fromBufferAttribute(this,e),Mn.transformDirection(t),this.setXYZ(e,Mn.x,Mn.y,Mn.z);return this}getComponent(t,e){let s=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(s=Ss(s,this.array)),s}setComponent(t,e,s){return this.normalized&&(s=_s(s,this.array)),this.data.array[t*this.data.stride+this.offset+e]=s,this}setX(t,e){return this.normalized&&(e=_s(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=_s(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=_s(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=_s(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Ss(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Ss(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Ss(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Ss(e,this.array)),e}setXY(t,e,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=_s(e,this.array),s=_s(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=s,this}setXYZ(t,e,s,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=_s(e,this.array),s=_s(s,this.array),i=_s(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=s,this.data.array[t+2]=i,this}setXYZW(t,e,s,i,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=_s(e,this.array),s=_s(s,this.array),i=_s(i,this.array),r=_s(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=s,this.data.array[t+2]=i,this.data.array[t+3]=r,this}clone(t){if(void 0===t){ls("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const s=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[s+e])}return new Cr(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new wn(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){ls("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const s=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[s+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class vn extends Mr{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new gr(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}let Sn;const _n=new Cs,An=new Cs,zn=new Cs,Tn=new zs,Cn=new zs,kn=new Ai,Bn=new Cs,On=new Cs,Pn=new Cs,Nn=new zs,In=new zs,Vn=new zs;class Rn extends Qi{constructor(t=new vn){if(super(),this.isSprite=!0,this.type="Sprite",void 0===Sn){Sn=new Fr;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new bn(t,5);Sn.setIndex([0,1,2,0,2,3]),Sn.setAttribute("position",new wn(e,3,0,!1)),Sn.setAttribute("uv",new wn(e,2,3,!1))}this.geometry=Sn,this.material=t,this.center=new zs(.5,.5),this.count=1}raycast(t,e){null===t.camera&&us('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),An.setFromMatrixScale(this.matrixWorld),kn.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),zn.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&An.multiplyScalar(-zn.z);const s=this.material.rotation;let i,r;0!==s&&(r=Math.cos(s),i=Math.sin(s));const n=this.center;Ln(Bn.set(-.5,-.5,0),zn,n,An,i,r),Ln(On.set(.5,-.5,0),zn,n,An,i,r),Ln(Pn.set(.5,.5,0),zn,n,An,i,r),Nn.set(0,0),In.set(1,0),Vn.set(1,1);let a=t.ray.intersectTriangle(Bn,On,Pn,!1,_n);if(null===a&&(Ln(On.set(-.5,.5,0),zn,n,An,i,r),In.set(0,1),a=t.ray.intersectTriangle(Bn,Pn,On,!1,_n),null===a))return;const o=t.ray.origin.distanceTo(_n);o<t.near||o>t.far||e.push({distance:o,point:_n.clone(),uv:pr.getInterpolation(_n,Bn,On,Pn,Nn,In,Vn,new zs),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function Ln(t,e,s,i,r,n){Tn.subVectors(t,s).addScalar(.5).multiply(i),void 0!==r?(Cn.x=n*Tn.x-r*Tn.y,Cn.y=r*Tn.x+n*Tn.y):Cn.copy(Tn),t.copy(e),t.x+=Cn.x,t.y+=Cn.y,t.applyMatrix4(kn)}const En=new Cs,Fn=new Ys,Dn=new Ys,Un=new Cs,jn=new Ai,Wn=new Cs,Jn=new fi,qn=new Ai,Xn=new _i;class Yn extends $r{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=it,this.bindMatrix=new Ai,this.bindMatrixInverse=new Ai,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new Qs),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,Wn),this.boundingBox.expandByPoint(Wn)}computeBoundingSphere(){const t=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new fi),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,Wn),this.boundingSphere.expandByPoint(Wn)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const s=this.material,i=this.matrixWorld;void 0!==s&&(null===this.boundingSphere&&this.computeBoundingSphere(),Jn.copy(this.boundingSphere),Jn.applyMatrix4(i),!1!==t.ray.intersectsSphere(Jn)&&(qn.copy(i).invert(),Xn.copy(t.ray).applyMatrix4(qn),null!==this.boundingBox&&!1===Xn.intersectsBox(this.boundingBox)||this._computeIntersections(t,e,Xn)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new Ys,e=this.geometry.attributes.skinWeight;for(let s=0,i=e.count;s<i;s++){t.fromBufferAttribute(e,s);const i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(s,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===it?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===rt?this.bindMatrixInverse.copy(this.bindMatrix).invert():cs("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){const s=this.skeleton,i=this.geometry;Fn.fromBufferAttribute(i.attributes.skinIndex,t),Dn.fromBufferAttribute(i.attributes.skinWeight,t),En.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const i=Dn.getComponent(t);if(0!==i){const r=Fn.getComponent(t);jn.multiplyMatrices(s.bones[r].matrixWorld,s.boneInverses[r]),e.addScaledVector(Un.copy(En).applyMatrix4(jn),i)}}return e.applyMatrix4(this.bindMatrixInverse)}}class Zn extends Qi{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Hn extends Xs{constructor(t=null,e=1,s=1,i,r,n,a,o,h=1003,l=1003,c,u){super(null,n,a,o,h,l,i,r,c,u),this.isDataTexture=!0,this.image={data:t,width:e,height:s},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Gn=new Ai,$n=new Ai;class Qn{constructor(t=[],e=[]){this.uuid=bs(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){cs("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new Ai)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new Ai;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,s=this.boneMatrices,i=this.boneTexture;for(let i=0,r=t.length;i<r;i++){const r=t[i]?t[i].matrixWorld:$n;Gn.multiplyMatrices(r,e[i]),Gn.toArray(s,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new Qn(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const s=new Hn(e,t,t,Vt,zt);return s.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=s,this}getBoneByName(t){for(let e=0,s=this.bones.length;e<s;e++){const s=this.bones[e];if(s.name===t)return s}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let s=0,i=t.bones.length;s<i;s++){const i=t.bones[s];let r=e[i];void 0===r&&(cs("Skeleton: No bone found with UUID:",i),r=new Zn),this.bones.push(r),this.boneInverses.push((new Ai).fromArray(t.boneInverses[s]))}return this.init(),this}toJSON(){const t={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,s=this.boneInverses;for(let i=0,r=e.length;i<r;i++){const r=e[i];t.bones.push(r.uuid);const n=s[i];t.boneInverses.push(n.toArray())}return t}}class Kn extends Cr{constructor(t,e,s,i=1){super(t,e,s),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const ta=new Ai,ea=new Ai,sa=[],ia=new Qs,ra=new Ai,na=new $r,aa=new fi;class oa extends $r{constructor(t,e,s){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new Kn(new Float32Array(16*s),16),this.instanceColor=null,this.morphTexture=null,this.count=s,this.boundingBox=null,this.boundingSphere=null;for(let t=0;t<s;t++)this.setMatrixAt(t,ra)}computeBoundingBox(){const t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new Qs),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let s=0;s<e;s++)this.getMatrixAt(s,ta),ia.copy(t.boundingBox).applyMatrix4(ta),this.boundingBox.union(ia)}computeBoundingSphere(){const t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new fi),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let s=0;s<e;s++)this.getMatrixAt(s,ta),aa.copy(t.boundingSphere).applyMatrix4(ta),this.boundingSphere.union(aa)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.morphTexture&&(this.morphTexture=t.morphTexture.clone()),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){const s=e.morphTargetInfluences,i=this.morphTexture.source.data.data,r=t*(s.length+1)+1;for(let t=0;t<s.length;t++)s[t]=i[r+t]}raycast(t,e){const s=this.matrixWorld,i=this.count;if(na.geometry=this.geometry,na.material=this.material,void 0!==na.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),aa.copy(this.boundingSphere),aa.applyMatrix4(s),!1!==t.ray.intersectsSphere(aa)))for(let r=0;r<i;r++){this.getMatrixAt(r,ta),ea.multiplyMatrices(s,ta),na.matrixWorld=ea,na.raycast(t,sa);for(let t=0,s=sa.length;t<s;t++){const s=sa[t];s.instanceId=r,s.object=this,e.push(s)}sa.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new Kn(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}setMorphAt(t,e){const s=e.morphTargetInfluences,i=s.length+1;null===this.morphTexture&&(this.morphTexture=new Hn(new Float32Array(i*this.count),i,this.count,Et,zt));const r=this.morphTexture.source.data.data;let n=0;for(let t=0;t<s.length;t++)n+=s[t];const a=this.geometry.morphTargetsRelative?1:1-n,o=i*t;r[o]=a,r.set(s,o+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null)}}const ha=new Cs,la=new Cs,ca=new Os;class ua{constructor(t=new Cs(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,s,i){return this.normal.set(t,e,s),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,s){const i=ha.subVectors(s,e).cross(la.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const s=t.delta(ha),i=this.normal.dot(s);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(t.start).addScaledVector(s,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),s=this.distanceToPoint(t.end);return e<0&&s>0||s<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const s=e||ca.getNormalMatrix(t),i=this.coplanarPoint(ha).applyMatrix4(t),r=this.normal.applyMatrix3(s).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const pa=new fi,da=new zs(.5,.5),ma=new Cs;class ya{constructor(t=new ua,e=new ua,s=new ua,i=new ua,r=new ua,n=new ua){this.planes=[t,e,s,i,r,n]}set(t,e,s,i,r,n){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(s),a[3].copy(i),a[4].copy(r),a[5].copy(n),this}copy(t){const e=this.planes;for(let s=0;s<6;s++)e[s].copy(t.planes[s]);return this}setFromProjectionMatrix(t,e=2e3,s=!1){const i=this.planes,r=t.elements,n=r[0],a=r[1],o=r[2],h=r[3],l=r[4],c=r[5],u=r[6],p=r[7],d=r[8],m=r[9],y=r[10],f=r[11],g=r[12],x=r[13],b=r[14],M=r[15];if(i[0].setComponents(h-n,p-l,f-d,M-g).normalize(),i[1].setComponents(h+n,p+l,f+d,M+g).normalize(),i[2].setComponents(h+a,p+c,f+m,M+x).normalize(),i[3].setComponents(h-a,p-c,f-m,M-x).normalize(),s)i[4].setComponents(o,u,y,b).normalize(),i[5].setComponents(h-o,p-u,f-y,M-b).normalize();else if(i[4].setComponents(h-o,p-u,f-y,M-b).normalize(),e===ss)i[5].setComponents(h+o,p+u,f+y,M+b).normalize();else{if(e!==is)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);i[5].setComponents(o,u,y,b).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),pa.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),pa.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(pa)}intersectsSprite(t){pa.center.set(0,0,0);const e=da.distanceTo(t.center);return pa.radius=.7071067811865476+e,pa.applyMatrix4(t.matrixWorld),this.intersectsSphere(pa)}intersectsSphere(t){const e=this.planes,s=t.center,i=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(s)<i)return!1}return!0}intersectsBox(t){const e=this.planes;for(let s=0;s<6;s++){const i=e[s];if(ma.x=i.normal.x>0?t.max.x:t.min.x,ma.y=i.normal.y>0?t.max.y:t.min.y,ma.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(ma)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let s=0;s<6;s++)if(e[s].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}class fa extends Mr{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new gr(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const ga=new Cs,xa=new Cs,ba=new Ai,Ma=new _i,wa=new fi,va=new Cs,Sa=new Cs;class _a extends Qi{constructor(t=new Fr,e=new fa){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,s=[0];for(let t=1,i=e.count;t<i;t++)ga.fromBufferAttribute(e,t-1),xa.fromBufferAttribute(e,t),s[t]=s[t-1],s[t]+=ga.distanceTo(xa);t.setAttribute("lineDistance",new Or(s,1))}else cs("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const s=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,n=s.drawRange;if(null===s.boundingSphere&&s.computeBoundingSphere(),wa.copy(s.boundingSphere),wa.applyMatrix4(i),wa.radius+=r,!1===t.ray.intersectsSphere(wa))return;ba.copy(i).invert(),Ma.copy(t.ray).applyMatrix4(ba);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,h=this.isLineSegments?2:1,l=s.index,c=s.attributes.position;if(null!==l){const s=Math.max(0,n.start),i=Math.min(l.count,n.start+n.count);for(let r=s,n=i-1;r<n;r+=h){const s=l.getX(r),i=l.getX(r+1),n=Aa(this,t,Ma,o,s,i,r);n&&e.push(n)}if(this.isLineLoop){const r=l.getX(i-1),n=l.getX(s),a=Aa(this,t,Ma,o,r,n,i-1);a&&e.push(a)}}else{const s=Math.max(0,n.start),i=Math.min(c.count,n.start+n.count);for(let r=s,n=i-1;r<n;r+=h){const s=Aa(this,t,Ma,o,r,r+1,r);s&&e.push(s)}if(this.isLineLoop){const r=Aa(this,t,Ma,o,i-1,s,i-1);r&&e.push(r)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const s=t[e[0]];if(void 0!==s){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=s.length;t<e;t++){const e=s[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function Aa(t,e,s,i,r,n,a){const o=t.geometry.attributes.position;ga.fromBufferAttribute(o,r),xa.fromBufferAttribute(o,n);if(s.distanceSqToSegment(ga,xa,va,Sa)>i)return;va.applyMatrix4(t.matrixWorld);const h=e.ray.origin.distanceTo(va);return h<e.near||h>e.far?void 0:{distance:h,point:Sa.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}const za=new Cs,Ta=new Cs;class Ca extends _a{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,s=[];for(let t=0,i=e.count;t<i;t+=2)za.fromBufferAttribute(e,t),Ta.fromBufferAttribute(e,t+1),s[t]=0===t?0:s[t-1],s[t+1]=s[t]+za.distanceTo(Ta);t.setAttribute("lineDistance",new Or(s,1))}else cs("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class ka extends _a{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class Ba extends Mr{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new gr(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const Oa=new Ai,Pa=new _i,Na=new fi,Ia=new Cs;class Va extends Qi{constructor(t=new Fr,e=new Ba){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){const s=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold,n=s.drawRange;if(null===s.boundingSphere&&s.computeBoundingSphere(),Na.copy(s.boundingSphere),Na.applyMatrix4(i),Na.radius+=r,!1===t.ray.intersectsSphere(Na))return;Oa.copy(i).invert(),Pa.copy(t.ray).applyMatrix4(Oa);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,h=s.index,l=s.attributes.position;if(null!==h){for(let s=Math.max(0,n.start),r=Math.min(h.count,n.start+n.count);s<r;s++){const r=h.getX(s);Ia.fromBufferAttribute(l,r),Ra(Ia,r,o,i,t,e,this)}}else{for(let s=Math.max(0,n.start),r=Math.min(l.count,n.start+n.count);s<r;s++)Ia.fromBufferAttribute(l,s),Ra(Ia,s,o,i,t,e,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const s=t[e[0]];if(void 0!==s){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=s.length;t<e;t++){const e=s[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function Ra(t,e,s,i,r,n,a){const o=Pa.distanceSqToPoint(t);if(o<s){const s=new Cs;Pa.closestPointToPoint(t,s),s.applyMatrix4(i);const h=r.ray.origin.distanceTo(s);if(h<r.near||h>r.far)return;n.push({distance:h,distanceToRay:Math.sqrt(o),point:s,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class La extends Xs{constructor(t,e,s,i,r,n,a,o,h){super(t,e,s,i,r,n,a,o,h),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Ea extends Xs{constructor(t,e,s=1014,i,r,n,a=1003,o=1003,h,l=1026,c=1){if(l!==Rt&&1027!==l)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:t,height:e,depth:c},i,r,n,a,o,l,s,h),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new js(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class Fa extends Ea{constructor(t,e=1014,s=301,i,r,n=1003,a=1003,o,h=1026){const l={width:t,height:t,depth:1},c=[l,l,l,l,l,l];super(t,t,e,s,i,r,n,a,o,h),this.image=c,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}}class Da extends Xs{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}}class Ua extends Fr{constructor(t=1,e=1,s=4,i=8,r=1){super(),this.type="CapsuleGeometry",this.parameters={radius:t,height:e,capSegments:s,radialSegments:i,heightSegments:r},e=Math.max(0,e),s=Math.max(1,Math.floor(s)),i=Math.max(3,Math.floor(i)),r=Math.max(1,Math.floor(r));const n=[],a=[],o=[],h=[],l=e/2,c=Math.PI/2*t,u=e,p=2*c+u,d=2*s+r,m=i+1,y=new Cs,f=new Cs;for(let g=0;g<=d;g++){let x=0,b=0,M=0,w=0;if(g<=s){const e=g/s,i=e*Math.PI/2;b=-l-t*Math.cos(i),M=t*Math.sin(i),w=-t*Math.cos(i),x=e*c}else if(g<=s+r){const i=(g-s)/r;b=i*e-l,M=t,w=0,x=c+i*u}else{const e=(g-s-r)/s,i=e*Math.PI/2;b=l+t*Math.sin(i),M=t*Math.cos(i),w=t*Math.sin(i),x=c+u+e*c}const v=Math.max(0,Math.min(1,x/p));let S=0;0===g?S=.5/i:g===d&&(S=-.5/i);for(let t=0;t<=i;t++){const e=t/i,s=e*Math.PI*2,r=Math.sin(s),n=Math.cos(s);f.x=-M*n,f.y=b,f.z=M*r,a.push(f.x,f.y,f.z),y.set(-M*n,w,M*r),y.normalize(),o.push(y.x,y.y,y.z),h.push(e+S,v)}if(g>0){const t=(g-1)*m;for(let e=0;e<i;e++){const s=t+e,i=t+e+1,r=g*m+e,a=g*m+e+1;n.push(s,i,r),n.push(i,a,r)}}}this.setIndex(n),this.setAttribute("position",new Or(a,3)),this.setAttribute("normal",new Or(o,3)),this.setAttribute("uv",new Or(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Ua(t.radius,t.height,t.capSegments,t.radialSegments,t.heightSegments)}}class ja extends Fr{constructor(t=1,e=1,s=1,i=32,r=1,n=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:s,radialSegments:i,heightSegments:r,openEnded:n,thetaStart:a,thetaLength:o};const h=this;i=Math.floor(i),r=Math.floor(r);const l=[],c=[],u=[],p=[];let d=0;const m=[],y=s/2;let f=0;function g(s){const r=d,n=new zs,m=new Cs;let g=0;const x=!0===s?t:e,b=!0===s?1:-1;for(let t=1;t<=i;t++)c.push(0,y*b,0),u.push(0,b,0),p.push(.5,.5),d++;const M=d;for(let t=0;t<=i;t++){const e=t/i*o+a,s=Math.cos(e),r=Math.sin(e);m.x=x*r,m.y=y*b,m.z=x*s,c.push(m.x,m.y,m.z),u.push(0,b,0),n.x=.5*s+.5,n.y=.5*r*b+.5,p.push(n.x,n.y),d++}for(let t=0;t<i;t++){const e=r+t,i=M+t;!0===s?l.push(i,i+1,e):l.push(i+1,i,e),g+=3}h.addGroup(f,g,!0===s?1:2),f+=g}!function(){const n=new Cs,g=new Cs;let x=0;const b=(e-t)/s;for(let h=0;h<=r;h++){const l=[],f=h/r,x=f*(e-t)+t;for(let t=0;t<=i;t++){const e=t/i,r=e*o+a,h=Math.sin(r),m=Math.cos(r);g.x=x*h,g.y=-f*s+y,g.z=x*m,c.push(g.x,g.y,g.z),n.set(h,b,m).normalize(),u.push(n.x,n.y,n.z),p.push(e,1-f),l.push(d++)}m.push(l)}for(let s=0;s<i;s++)for(let i=0;i<r;i++){const n=m[i][s],a=m[i+1][s],o=m[i+1][s+1],h=m[i][s+1];(t>0||0!==i)&&(l.push(n,a,h),x+=3),(e>0||i!==r-1)&&(l.push(a,o,h),x+=3)}h.addGroup(f,x,0),f+=x}(),!1===n&&(t>0&&g(!0),e>0&&g(!1)),this.setIndex(l),this.setAttribute("position",new Or(c,3)),this.setAttribute("normal",new Or(u,3)),this.setAttribute("uv",new Or(p,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ja(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Wa extends Fr{constructor(t=[],e=[],s=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:s,detail:i};const r=[],n=[];function a(t,e,s,i){const r=i+1,n=[];for(let i=0;i<=r;i++){n[i]=[];const a=t.clone().lerp(s,i/r),o=e.clone().lerp(s,i/r),h=r-i;for(let t=0;t<=h;t++)n[i][t]=0===t&&i===r?a:a.clone().lerp(o,t/h)}for(let t=0;t<r;t++)for(let e=0;e<2*(r-t)-1;e++){const s=Math.floor(e/2);e%2==0?(o(n[t][s+1]),o(n[t+1][s]),o(n[t][s])):(o(n[t][s+1]),o(n[t+1][s+1]),o(n[t+1][s]))}}function o(t){r.push(t.x,t.y,t.z)}function h(e,s){const i=3*e;s.x=t[i+0],s.y=t[i+1],s.z=t[i+2]}function l(t,e,s,i){i<0&&1===t.x&&(n[e]=t.x-1),0===s.x&&0===s.z&&(n[e]=i/2/Math.PI+.5)}function c(t){return Math.atan2(t.z,-t.x)}function u(t){return Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))}!function(t){const s=new Cs,i=new Cs,r=new Cs;for(let n=0;n<e.length;n+=3)h(e[n+0],s),h(e[n+1],i),h(e[n+2],r),a(s,i,r,t)}(i),function(t){const e=new Cs;for(let s=0;s<r.length;s+=3)e.x=r[s+0],e.y=r[s+1],e.z=r[s+2],e.normalize().multiplyScalar(t),r[s+0]=e.x,r[s+1]=e.y,r[s+2]=e.z}(s),function(){const t=new Cs;for(let e=0;e<r.length;e+=3){t.x=r[e+0],t.y=r[e+1],t.z=r[e+2];const s=c(t)/2/Math.PI+.5,i=u(t)/Math.PI+.5;n.push(s,1-i)}(function(){const t=new Cs,e=new Cs,s=new Cs,i=new Cs,a=new zs,o=new zs,h=new zs;for(let u=0,p=0;u<r.length;u+=9,p+=6){t.set(r[u+0],r[u+1],r[u+2]),e.set(r[u+3],r[u+4],r[u+5]),s.set(r[u+6],r[u+7],r[u+8]),a.set(n[p+0],n[p+1]),o.set(n[p+2],n[p+3]),h.set(n[p+4],n[p+5]),i.copy(t).add(e).add(s).divideScalar(3);const d=c(i);l(a,p+0,t,d),l(o,p+2,e,d),l(h,p+4,s,d)}})(),function(){for(let t=0;t<n.length;t+=6){const e=n[t+0],s=n[t+2],i=n[t+4],r=Math.max(e,s,i),a=Math.min(e,s,i);r>.9&&a<.1&&(e<.2&&(n[t+0]+=1),s<.2&&(n[t+2]+=1),i<.2&&(n[t+4]+=1))}}()}(),this.setAttribute("position",new Or(r,3)),this.setAttribute("normal",new Or(r.slice(),3)),this.setAttribute("uv",new Or(n,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Wa(t.vertices,t.indices,t.radius,t.detail)}}class Ja{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){cs("Curve: .getPoint() not implemented.")}getPointAt(t,e){const s=this.getUtoTmapping(t);return this.getPoint(s,e)}getPoints(t=5){const e=[];for(let s=0;s<=t;s++)e.push(this.getPoint(s/t));return e}getSpacedPoints(t=5){const e=[];for(let s=0;s<=t;s++)e.push(this.getPointAt(s/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let s,i=this.getPoint(0),r=0;e.push(0);for(let n=1;n<=t;n++)s=this.getPoint(n/t),r+=s.distanceTo(i),e.push(r),i=s;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){const s=this.getLengths();let i=0;const r=s.length;let n;n=e||t*s[r-1];let a,o=0,h=r-1;for(;o<=h;)if(i=Math.floor(o+(h-o)/2),a=s[i]-n,a<0)o=i+1;else{if(!(a>0)){h=i;break}h=i-1}if(i=h,s[i]===n)return i/(r-1);const l=s[i];return(i+(n-l)/(s[i+1]-l))/(r-1)}getTangent(t,e){const s=1e-4;let i=t-s,r=t+s;i<0&&(i=0),r>1&&(r=1);const n=this.getPoint(i),a=this.getPoint(r),o=e||(n.isVector2?new zs:new Cs);return o.copy(a).sub(n).normalize(),o}getTangentAt(t,e){const s=this.getUtoTmapping(t);return this.getTangent(s,e)}computeFrenetFrames(t,e=!1){const s=new Cs,i=[],r=[],n=[],a=new Cs,o=new Ai;for(let e=0;e<=t;e++){const s=e/t;i[e]=this.getTangentAt(s,new Cs)}r[0]=new Cs,n[0]=new Cs;let h=Number.MAX_VALUE;const l=Math.abs(i[0].x),c=Math.abs(i[0].y),u=Math.abs(i[0].z);l<=h&&(h=l,s.set(1,0,0)),c<=h&&(h=c,s.set(0,1,0)),u<=h&&s.set(0,0,1),a.crossVectors(i[0],s).normalize(),r[0].crossVectors(i[0],a),n[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),n[e]=n[e-1].clone(),a.crossVectors(i[e-1],i[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(Ms(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}n[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(Ms(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let s=1;s<=t;s++)r[s].applyMatrix4(o.makeRotationAxis(i[s],e*s)),n[s].crossVectors(i[s],r[s])}return{tangents:i,normals:r,binormals:n}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class qa extends Ja{constructor(t=0,e=0,s=1,i=1,r=0,n=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=s,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=n,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new zs){const s=e,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const n=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=n?0:i),!0!==this.aClockwise||n||(r===i?r=-i:r-=i);const a=this.aStartAngle+t*r;let o=this.aX+this.xRadius*Math.cos(a),h=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),s=o-this.aX,i=h-this.aY;o=s*t-i*e+this.aX,h=s*e+i*t+this.aY}return s.set(o,h)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class Xa extends qa{constructor(t,e,s,i,r,n){super(t,e,s,s,i,r,n),this.isArcCurve=!0,this.type="ArcCurve"}}function Ya(){let t=0,e=0,s=0,i=0;function r(r,n,a,o){t=r,e=a,s=-3*r+3*n-2*a-o,i=2*r-2*n+a+o}return{initCatmullRom:function(t,e,s,i,n){r(e,s,n*(s-t),n*(i-e))},initNonuniformCatmullRom:function(t,e,s,i,n,a,o){let h=(e-t)/n-(s-t)/(n+a)+(s-e)/a,l=(s-e)/a-(i-e)/(a+o)+(i-s)/o;h*=a,l*=a,r(e,s,h,l)},calc:function(r){const n=r*r;return t+e*r+s*n+i*(n*r)}}}const Za=new Cs,Ha=new Ya,Ga=new Ya,$a=new Ya;class Qa extends Ja{constructor(t=[],e=!1,s="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=s,this.tension=i}getPoint(t,e=new Cs){const s=e,i=this.points,r=i.length,n=(r-(this.closed?0:1))*t;let a,o,h=Math.floor(n),l=n-h;this.closed?h+=h>0?0:(Math.floor(Math.abs(h)/r)+1)*r:0===l&&h===r-1&&(h=r-2,l=1),this.closed||h>0?a=i[(h-1)%r]:(Za.subVectors(i[0],i[1]).add(i[0]),a=Za);const c=i[h%r],u=i[(h+1)%r];if(this.closed||h+2<r?o=i[(h+2)%r]:(Za.subVectors(i[r-1],i[r-2]).add(i[r-1]),o=Za),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(a.distanceToSquared(c),t),s=Math.pow(c.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(o),t);s<1e-4&&(s=1),e<1e-4&&(e=s),i<1e-4&&(i=s),Ha.initNonuniformCatmullRom(a.x,c.x,u.x,o.x,e,s,i),Ga.initNonuniformCatmullRom(a.y,c.y,u.y,o.y,e,s,i),$a.initNonuniformCatmullRom(a.z,c.z,u.z,o.z,e,s,i)}else"catmullrom"===this.curveType&&(Ha.initCatmullRom(a.x,c.x,u.x,o.x,this.tension),Ga.initCatmullRom(a.y,c.y,u.y,o.y,this.tension),$a.initCatmullRom(a.z,c.z,u.z,o.z,this.tension));return s.set(Ha.calc(l),Ga.calc(l),$a.calc(l)),s}copy(t){super.copy(t),this.points=[];for(let e=0,s=t.points.length;e<s;e++){const s=t.points[e];this.points.push(s.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,s=this.points.length;e<s;e++){const s=this.points[e];t.points.push(s.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,s=t.points.length;e<s;e++){const s=t.points[e];this.points.push((new Cs).fromArray(s))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Ka(t,e,s,i,r){const n=.5*(i-e),a=.5*(r-s),o=t*t;return(2*s-2*i+n+a)*(t*o)+(-3*s+3*i-2*n-a)*o+n*t+s}function to(t,e,s,i){return function(t,e){const s=1-t;return s*s*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,s)+function(t,e){return t*t*e}(t,i)}function eo(t,e,s,i,r){return function(t,e){const s=1-t;return s*s*s*e}(t,e)+function(t,e){const s=1-t;return 3*s*s*t*e}(t,s)+function(t,e){return 3*(1-t)*t*t*e}(t,i)+function(t,e){return t*t*t*e}(t,r)}class so extends Ja{constructor(t=new zs,e=new zs,s=new zs,i=new zs){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=s,this.v3=i}getPoint(t,e=new zs){const s=e,i=this.v0,r=this.v1,n=this.v2,a=this.v3;return s.set(eo(t,i.x,r.x,n.x,a.x),eo(t,i.y,r.y,n.y,a.y)),s}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class io extends Ja{constructor(t=new Cs,e=new Cs,s=new Cs,i=new Cs){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=s,this.v3=i}getPoint(t,e=new Cs){const s=e,i=this.v0,r=this.v1,n=this.v2,a=this.v3;return s.set(eo(t,i.x,r.x,n.x,a.x),eo(t,i.y,r.y,n.y,a.y),eo(t,i.z,r.z,n.z,a.z)),s}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class ro extends Ja{constructor(t=new zs,e=new zs){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new zs){const s=e;return 1===t?s.copy(this.v2):(s.copy(this.v2).sub(this.v1),s.multiplyScalar(t).add(this.v1)),s}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new zs){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class no extends Ja{constructor(t=new Cs,e=new Cs){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new Cs){const s=e;return 1===t?s.copy(this.v2):(s.copy(this.v2).sub(this.v1),s.multiplyScalar(t).add(this.v1)),s}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Cs){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class ao extends Ja{constructor(t=new zs,e=new zs,s=new zs){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=s}getPoint(t,e=new zs){const s=e,i=this.v0,r=this.v1,n=this.v2;return s.set(to(t,i.x,r.x,n.x),to(t,i.y,r.y,n.y)),s}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class oo extends Ja{constructor(t=new Cs,e=new Cs,s=new Cs){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=s}getPoint(t,e=new Cs){const s=e,i=this.v0,r=this.v1,n=this.v2;return s.set(to(t,i.x,r.x,n.x),to(t,i.y,r.y,n.y),to(t,i.z,r.z,n.z)),s}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class ho extends Ja{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new zs){const s=e,i=this.points,r=(i.length-1)*t,n=Math.floor(r),a=r-n,o=i[0===n?n:n-1],h=i[n],l=i[n>i.length-2?i.length-1:n+1],c=i[n>i.length-3?i.length-1:n+2];return s.set(Ka(a,o.x,h.x,l.x,c.x),Ka(a,o.y,h.y,l.y,c.y)),s}copy(t){super.copy(t),this.points=[];for(let e=0,s=t.points.length;e<s;e++){const s=t.points[e];this.points.push(s.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,s=this.points.length;e<s;e++){const s=this.points[e];t.points.push(s.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,s=t.points.length;e<s;e++){const s=t.points[e];this.points.push((new zs).fromArray(s))}return this}}var lo=Object.freeze({__proto__:null,ArcCurve:Xa,CatmullRomCurve3:Qa,CubicBezierCurve:so,CubicBezierCurve3:io,EllipseCurve:qa,LineCurve:ro,LineCurve3:no,QuadraticBezierCurve:ao,QuadraticBezierCurve3:oo,SplineCurve:ho});class co extends Ja{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const s=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new lo[s](e,t))}return this}getPoint(t,e){const s=t*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=s){const t=i[r]-s,n=this.curves[r],a=n.getLength(),o=0===a?0:1-t/a;return n.getPointAt(o,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let s=0,i=this.curves.length;s<i;s++)e+=this.curves[s].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let s=0;s<=t;s++)e.push(this.getPoint(s/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let s;for(let i=0,r=this.curves;i<r.length;i++){const n=r[i],a=n.isEllipseCurve?2*t:n.isLineCurve||n.isLineCurve3?1:n.isSplineCurve?t*n.points.length:t,o=n.getPoints(a);for(let t=0;t<o.length;t++){const i=o[t];s&&s.equals(i)||(e.push(i),s=i)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,s=t.curves.length;e<s;e++){const s=t.curves[e];this.curves.push(s.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,s=this.curves.length;e<s;e++){const s=this.curves[e];t.curves.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,s=t.curves.length;e<s;e++){const s=t.curves[e];this.curves.push((new lo[s.type]).fromJSON(s))}return this}}class uo extends co{constructor(t){super(),this.type="Path",this.currentPoint=new zs,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,s=t.length;e<s;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const s=new ro(this.currentPoint.clone(),new zs(t,e));return this.curves.push(s),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,s,i){const r=new ao(this.currentPoint.clone(),new zs(t,e),new zs(s,i));return this.curves.push(r),this.currentPoint.set(s,i),this}bezierCurveTo(t,e,s,i,r,n){const a=new so(this.currentPoint.clone(),new zs(t,e),new zs(s,i),new zs(r,n));return this.curves.push(a),this.currentPoint.set(r,n),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),s=new ho(e);return this.curves.push(s),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,s,i,r,n){const a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,s,i,r,n),this}absarc(t,e,s,i,r,n){return this.absellipse(t,e,s,s,i,r,n),this}ellipse(t,e,s,i,r,n,a,o){const h=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(t+h,e+l,s,i,r,n,a,o),this}absellipse(t,e,s,i,r,n,a,o){const h=new qa(t,e,s,i,r,n,a,o);if(this.curves.length>0){const t=h.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(h);const l=h.getPoint(1);return this.currentPoint.copy(l),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class po extends uo{constructor(t){super(t),this.uuid=bs(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let s=0,i=this.holes.length;s<i;s++)e[s]=this.holes[s].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,s=t.holes.length;e<s;e++){const s=t.holes[e];this.holes.push(s.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,s=this.holes.length;e<s;e++){const s=this.holes[e];t.holes.push(s.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,s=t.holes.length;e<s;e++){const s=t.holes[e];this.holes.push((new uo).fromJSON(s))}return this}}function mo(t,e,s=2){const i=e&&e.length,r=i?e[0]*s:t.length;let n=yo(t,0,r,s,!0);const a=[];if(!n||n.next===n.prev)return a;let o,h,l;if(i&&(n=function(t,e,s,i){const r=[];for(let s=0,n=e.length;s<n;s++){const a=yo(t,e[s]*i,s<n-1?e[s+1]*i:t.length,i,!1);a===a.next&&(a.steiner=!0),r.push(zo(a))}r.sort(vo);for(let t=0;t<r.length;t++)s=So(r[t],s);return s}(t,e,n,s)),t.length>80*s){o=t[0],h=t[1];let e=o,i=h;for(let n=s;n<r;n+=s){const s=t[n],r=t[n+1];s<o&&(o=s),r<h&&(h=r),s>e&&(e=s),r>i&&(i=r)}l=Math.max(e-o,i-h),l=0!==l?32767/l:0}return go(n,a,s,o,h,l,0),a}function yo(t,e,s,i,r){let n;if(r===function(t,e,s,i){let r=0;for(let n=e,a=s-i;n<s;n+=i)r+=(t[a]-t[n])*(t[n+1]+t[a+1]),a=n;return r}(t,e,s,i)>0)for(let r=e;r<s;r+=i)n=Lo(r/i|0,t[r],t[r+1],n);else for(let r=s-i;r>=e;r-=i)n=Lo(r/i|0,t[r],t[r+1],n);return n&&Oo(n,n.next)&&(Eo(n),n=n.next),n}function fo(t,e){if(!t)return t;e||(e=t);let s,i=t;do{if(s=!1,i.steiner||!Oo(i,i.next)&&0!==Bo(i.prev,i,i.next))i=i.next;else{if(Eo(i),i=e=i.prev,i===i.next)break;s=!0}}while(s||i!==e);return e}function go(t,e,s,i,r,n,a){if(!t)return;!a&&n&&function(t,e,s,i){let r=t;do{0===r.z&&(r.z=Ao(r.x,r.y,e,s,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,s=1;do{let i,r=t;t=null;let n=null;for(e=0;r;){e++;let a=r,o=0;for(let t=0;t<s&&(o++,a=a.nextZ,a);t++);let h=s;for(;o>0||h>0&&a;)0!==o&&(0===h||!a||r.z<=a.z)?(i=r,r=r.nextZ,o--):(i=a,a=a.nextZ,h--),n?n.nextZ=i:t=i,i.prevZ=n,n=i;r=a}n.nextZ=null,s*=2}while(e>1)}(r)}(t,i,r,n);let o=t;for(;t.prev!==t.next;){const h=t.prev,l=t.next;if(n?bo(t,i,r,n):xo(t))e.push(h.i,t.i,l.i),Eo(t),t=l.next,o=l.next;else if((t=l)===o){a?1===a?go(t=Mo(fo(t),e),e,s,i,r,n,2):2===a&&wo(t,e,s,i,r,n):go(fo(t),e,s,i,r,n,1);break}}}function xo(t){const e=t.prev,s=t,i=t.next;if(Bo(e,s,i)>=0)return!1;const r=e.x,n=s.x,a=i.x,o=e.y,h=s.y,l=i.y,c=Math.min(r,n,a),u=Math.min(o,h,l),p=Math.max(r,n,a),d=Math.max(o,h,l);let m=i.next;for(;m!==e;){if(m.x>=c&&m.x<=p&&m.y>=u&&m.y<=d&&Co(r,o,n,h,a,l,m.x,m.y)&&Bo(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function bo(t,e,s,i){const r=t.prev,n=t,a=t.next;if(Bo(r,n,a)>=0)return!1;const o=r.x,h=n.x,l=a.x,c=r.y,u=n.y,p=a.y,d=Math.min(o,h,l),m=Math.min(c,u,p),y=Math.max(o,h,l),f=Math.max(c,u,p),g=Ao(d,m,e,s,i),x=Ao(y,f,e,s,i);let b=t.prevZ,M=t.nextZ;for(;b&&b.z>=g&&M&&M.z<=x;){if(b.x>=d&&b.x<=y&&b.y>=m&&b.y<=f&&b!==r&&b!==a&&Co(o,c,h,u,l,p,b.x,b.y)&&Bo(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,M.x>=d&&M.x<=y&&M.y>=m&&M.y<=f&&M!==r&&M!==a&&Co(o,c,h,u,l,p,M.x,M.y)&&Bo(M.prev,M,M.next)>=0)return!1;M=M.nextZ}for(;b&&b.z>=g;){if(b.x>=d&&b.x<=y&&b.y>=m&&b.y<=f&&b!==r&&b!==a&&Co(o,c,h,u,l,p,b.x,b.y)&&Bo(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;M&&M.z<=x;){if(M.x>=d&&M.x<=y&&M.y>=m&&M.y<=f&&M!==r&&M!==a&&Co(o,c,h,u,l,p,M.x,M.y)&&Bo(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function Mo(t,e){let s=t;do{const i=s.prev,r=s.next.next;!Oo(i,r)&&Po(i,s,s.next,r)&&Vo(i,r)&&Vo(r,i)&&(e.push(i.i,s.i,r.i),Eo(s),Eo(s.next),s=t=r),s=s.next}while(s!==t);return fo(s)}function wo(t,e,s,i,r,n){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&ko(a,t)){let o=Ro(a,t);return a=fo(a,a.next),o=fo(o,o.next),go(a,e,s,i,r,n,0),void go(o,e,s,i,r,n,0)}t=t.next}a=a.next}while(a!==t)}function vo(t,e){let s=t.x-e.x;if(0===s&&(s=t.y-e.y,0===s)){s=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return s}function So(t,e){const s=function(t,e){let s=e;const i=t.x,r=t.y;let n,a=-1/0;if(Oo(t,s))return s;do{if(Oo(t,s.next))return s.next;if(r<=s.y&&r>=s.next.y&&s.next.y!==s.y){const t=s.x+(r-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(t<=i&&t>a&&(a=t,n=s.x<s.next.x?s:s.next,t===i))return n}s=s.next}while(s!==e);if(!n)return null;const o=n,h=n.x,l=n.y;let c=1/0;s=n;do{if(i>=s.x&&s.x>=h&&i!==s.x&&To(r<l?i:a,r,h,l,r<l?a:i,r,s.x,s.y)){const e=Math.abs(r-s.y)/(i-s.x);Vo(s,t)&&(e<c||e===c&&(s.x>n.x||s.x===n.x&&_o(n,s)))&&(n=s,c=e)}s=s.next}while(s!==o);return n}(t,e);if(!s)return e;const i=Ro(s,t);return fo(i,i.next),fo(s,s.next)}function _o(t,e){return Bo(t.prev,t,e.prev)<0&&Bo(e.next,t,t.next)<0}function Ao(t,e,s,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-s)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function zo(t){let e=t,s=t;do{(e.x<s.x||e.x===s.x&&e.y<s.y)&&(s=e),e=e.next}while(e!==t);return s}function To(t,e,s,i,r,n,a,o){return(r-a)*(e-o)>=(t-a)*(n-o)&&(t-a)*(i-o)>=(s-a)*(e-o)&&(s-a)*(n-o)>=(r-a)*(i-o)}function Co(t,e,s,i,r,n,a,o){return!(t===a&&e===o)&&To(t,e,s,i,r,n,a,o)}function ko(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let s=t;do{if(s.i!==t.i&&s.next.i!==t.i&&s.i!==e.i&&s.next.i!==e.i&&Po(s,s.next,t,e))return!0;s=s.next}while(s!==t);return!1}(t,e)&&(Vo(t,e)&&Vo(e,t)&&function(t,e){let s=t,i=!1;const r=(t.x+e.x)/2,n=(t.y+e.y)/2;do{s.y>n!=s.next.y>n&&s.next.y!==s.y&&r<(s.next.x-s.x)*(n-s.y)/(s.next.y-s.y)+s.x&&(i=!i),s=s.next}while(s!==t);return i}(t,e)&&(Bo(t.prev,t,e.prev)||Bo(t,e.prev,e))||Oo(t,e)&&Bo(t.prev,t,t.next)>0&&Bo(e.prev,e,e.next)>0)}function Bo(t,e,s){return(e.y-t.y)*(s.x-e.x)-(e.x-t.x)*(s.y-e.y)}function Oo(t,e){return t.x===e.x&&t.y===e.y}function Po(t,e,s,i){const r=Io(Bo(t,e,s)),n=Io(Bo(t,e,i)),a=Io(Bo(s,i,t)),o=Io(Bo(s,i,e));return r!==n&&a!==o||(!(0!==r||!No(t,s,e))||(!(0!==n||!No(t,i,e))||(!(0!==a||!No(s,t,i))||!(0!==o||!No(s,e,i)))))}function No(t,e,s){return e.x<=Math.max(t.x,s.x)&&e.x>=Math.min(t.x,s.x)&&e.y<=Math.max(t.y,s.y)&&e.y>=Math.min(t.y,s.y)}function Io(t){return t>0?1:t<0?-1:0}function Vo(t,e){return Bo(t.prev,t,t.next)<0?Bo(t,e,t.next)>=0&&Bo(t,t.prev,e)>=0:Bo(t,e,t.prev)<0||Bo(t,t.next,e)<0}function Ro(t,e){const s=Fo(t.i,t.x,t.y),i=Fo(e.i,e.x,e.y),r=t.next,n=e.prev;return t.next=e,e.prev=t,s.next=r,r.prev=s,i.next=s,s.prev=i,n.next=i,i.prev=n,i}function Lo(t,e,s,i){const r=Fo(t,e,s);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Eo(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Fo(t,e,s){return{i:t,x:e,y:s,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Do{static triangulate(t,e,s=2){return mo(t,e,s)}}class Uo{static area(t){const e=t.length;let s=0;for(let i=e-1,r=0;r<e;i=r++)s+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*s}static isClockWise(t){return Uo.area(t)<0}static triangulateShape(t,e){const s=[],i=[],r=[];jo(t),Wo(s,t);let n=t.length;e.forEach(jo);for(let t=0;t<e.length;t++)i.push(n),n+=e[t].length,Wo(s,e[t]);const a=Do.triangulate(s,i);for(let t=0;t<a.length;t+=3)r.push(a.slice(t,t+3));return r}}function jo(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Wo(t,e){for(let s=0;s<e.length;s++)t.push(e[s].x),t.push(e[s].y)}class Jo extends Fr{constructor(t=new po([new zs(.5,.5),new zs(-.5,.5),new zs(-.5,-.5),new zs(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const s=this,i=[],r=[];for(let e=0,s=t.length;e<s;e++){n(t[e])}function n(t){const n=[],a=void 0!==e.curveSegments?e.curveSegments:12,o=void 0!==e.steps?e.steps:1,h=void 0!==e.depth?e.depth:1;let l=void 0===e.bevelEnabled||e.bevelEnabled,c=void 0!==e.bevelThickness?e.bevelThickness:.2,u=void 0!==e.bevelSize?e.bevelSize:c-.1,p=void 0!==e.bevelOffset?e.bevelOffset:0,d=void 0!==e.bevelSegments?e.bevelSegments:3;const m=e.extrudePath,y=void 0!==e.UVGenerator?e.UVGenerator:qo;let f,g,x,b,M,w=!1;if(m){f=m.getSpacedPoints(o),w=!0,l=!1;const t=!!m.isCatmullRomCurve3&&m.closed;g=m.computeFrenetFrames(o,t),x=new Cs,b=new Cs,M=new Cs}l||(d=0,c=0,u=0,p=0);const v=t.extractPoints(a);let S=v.shape;const _=v.holes;if(!Uo.isClockWise(S)){S=S.reverse();for(let t=0,e=_.length;t<e;t++){const e=_[t];Uo.isClockWise(e)&&(_[t]=e.reverse())}}function A(t){const e=1e-10*1e-10;let s=t[0];for(let i=1;i<=t.length;i++){const r=i%t.length,n=t[r],a=n.x-s.x,o=n.y-s.y,h=a*a+o*o,l=Math.max(Math.abs(n.x),Math.abs(n.y),Math.abs(s.x),Math.abs(s.y));h<=e*l*l?(t.splice(r,1),i--):s=n}}A(S),_.forEach(A);const z=_.length,T=S;for(let t=0;t<z;t++){const e=_[t];S=S.concat(e)}function C(t,e,s){return e||us("ExtrudeGeometry: vec does not exist"),t.clone().addScaledVector(e,s)}const k=S.length;function B(t,e,s){let i,r,n;const a=t.x-e.x,o=t.y-e.y,h=s.x-t.x,l=s.y-t.y,c=a*a+o*o,u=a*l-o*h;if(Math.abs(u)>Number.EPSILON){const u=Math.sqrt(c),p=Math.sqrt(h*h+l*l),d=e.x-o/u,m=e.y+a/u,y=((s.x-l/p-d)*l-(s.y+h/p-m)*h)/(a*l-o*h);i=d+a*y-t.x,r=m+o*y-t.y;const f=i*i+r*r;if(f<=2)return new zs(i,r);n=Math.sqrt(f/2)}else{let t=!1;a>Number.EPSILON?h>Number.EPSILON&&(t=!0):a<-Number.EPSILON?h<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(l)&&(t=!0),t?(i=-o,r=a,n=Math.sqrt(c)):(i=a,r=o,n=Math.sqrt(c/2))}return new zs(i/n,r/n)}const O=[];for(let t=0,e=T.length,s=e-1,i=t+1;t<e;t++,s++,i++)s===e&&(s=0),i===e&&(i=0),O[t]=B(T[t],T[s],T[i]);const P=[];let N,I,V=O.concat();for(let t=0,e=z;t<e;t++){const e=_[t];N=[];for(let t=0,s=e.length,i=s-1,r=t+1;t<s;t++,i++,r++)i===s&&(i=0),r===s&&(r=0),N[t]=B(e[t],e[i],e[r]);P.push(N),V=V.concat(N)}if(0===d)I=Uo.triangulateShape(T,_);else{const t=[],e=[];for(let s=0;s<d;s++){const i=s/d,r=c*Math.cos(i*Math.PI/2),n=u*Math.sin(i*Math.PI/2)+p;for(let e=0,s=T.length;e<s;e++){const s=C(T[e],O[e],n);F(s.x,s.y,-r),0===i&&t.push(s)}for(let t=0,s=z;t<s;t++){const s=_[t];N=P[t];const a=[];for(let t=0,e=s.length;t<e;t++){const e=C(s[t],N[t],n);F(e.x,e.y,-r),0===i&&a.push(e)}0===i&&e.push(a)}}I=Uo.triangulateShape(t,e)}const R=I.length,L=u+p;for(let t=0;t<k;t++){const e=l?C(S[t],V[t],L):S[t];w?(b.copy(g.normals[0]).multiplyScalar(e.x),x.copy(g.binormals[0]).multiplyScalar(e.y),M.copy(f[0]).add(b).add(x),F(M.x,M.y,M.z)):F(e.x,e.y,0)}for(let t=1;t<=o;t++)for(let e=0;e<k;e++){const s=l?C(S[e],V[e],L):S[e];w?(b.copy(g.normals[t]).multiplyScalar(s.x),x.copy(g.binormals[t]).multiplyScalar(s.y),M.copy(f[t]).add(b).add(x),F(M.x,M.y,M.z)):F(s.x,s.y,h/o*t)}for(let t=d-1;t>=0;t--){const e=t/d,s=c*Math.cos(e*Math.PI/2),i=u*Math.sin(e*Math.PI/2)+p;for(let t=0,e=T.length;t<e;t++){const e=C(T[t],O[t],i);F(e.x,e.y,h+s)}for(let t=0,e=_.length;t<e;t++){const e=_[t];N=P[t];for(let t=0,r=e.length;t<r;t++){const r=C(e[t],N[t],i);w?F(r.x,r.y+f[o-1].y,f[o-1].x+s):F(r.x,r.y,h+s)}}}function E(t,e){let s=t.length;for(;--s>=0;){const i=s;let r=s-1;r<0&&(r=t.length-1);for(let t=0,s=o+2*d;t<s;t++){const s=k*t,n=k*(t+1);U(e+i+s,e+r+s,e+r+n,e+i+n)}}}function F(t,e,s){n.push(t),n.push(e),n.push(s)}function D(t,e,r){j(t),j(e),j(r);const n=i.length/3,a=y.generateTopUV(s,i,n-3,n-2,n-1);W(a[0]),W(a[1]),W(a[2])}function U(t,e,r,n){j(t),j(e),j(n),j(e),j(r),j(n);const a=i.length/3,o=y.generateSideWallUV(s,i,a-6,a-3,a-2,a-1);W(o[0]),W(o[1]),W(o[3]),W(o[1]),W(o[2]),W(o[3])}function j(t){i.push(n[3*t+0]),i.push(n[3*t+1]),i.push(n[3*t+2])}function W(t){r.push(t.x),r.push(t.y)}!function(){const t=i.length/3;if(l){let t=0,e=k*t;for(let t=0;t<R;t++){const s=I[t];D(s[2]+e,s[1]+e,s[0]+e)}t=o+2*d,e=k*t;for(let t=0;t<R;t++){const s=I[t];D(s[0]+e,s[1]+e,s[2]+e)}}else{for(let t=0;t<R;t++){const e=I[t];D(e[2],e[1],e[0])}for(let t=0;t<R;t++){const e=I[t];D(e[0]+k*o,e[1]+k*o,e[2]+k*o)}}s.addGroup(t,i.length/3-t,0)}(),function(){const t=i.length/3;let e=0;E(T,e),e+=T.length;for(let t=0,s=_.length;t<s;t++){const s=_[t];E(s,e),e+=s.length}s.addGroup(t,i.length/3-t,1)}()}this.setAttribute("position",new Or(i,3)),this.setAttribute("uv",new Or(r,2)),this.computeVertexNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e,s){if(s.shapes=[],Array.isArray(t))for(let e=0,i=t.length;e<i;e++){const i=t[e];s.shapes.push(i.uuid)}else s.shapes.push(t.uuid);s.options=Object.assign({},e),void 0!==e.extrudePath&&(s.options.extrudePath=e.extrudePath.toJSON());return s}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const s=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];s.push(r)}const i=t.options.extrudePath;return void 0!==i&&(t.options.extrudePath=(new lo[i.type]).fromJSON(i)),new Jo(s,t.options)}}const qo={generateTopUV:function(t,e,s,i,r){const n=e[3*s],a=e[3*s+1],o=e[3*i],h=e[3*i+1],l=e[3*r],c=e[3*r+1];return[new zs(n,a),new zs(o,h),new zs(l,c)]},generateSideWallUV:function(t,e,s,i,r,n){const a=e[3*s],o=e[3*s+1],h=e[3*s+2],l=e[3*i],c=e[3*i+1],u=e[3*i+2],p=e[3*r],d=e[3*r+1],m=e[3*r+2],y=e[3*n],f=e[3*n+1],g=e[3*n+2];return Math.abs(o-c)<Math.abs(a-l)?[new zs(a,1-h),new zs(l,1-u),new zs(p,1-m),new zs(y,1-g)]:[new zs(o,1-h),new zs(c,1-u),new zs(d,1-m),new zs(f,1-g)]}};class Xo extends Wa{constructor(t=1,e=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],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Xo(t.radius,t.detail)}}class Yo extends Fr{constructor(t=1,e=1,s=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:s,heightSegments:i};const r=t/2,n=e/2,a=Math.floor(s),o=Math.floor(i),h=a+1,l=o+1,c=t/a,u=e/o,p=[],d=[],m=[],y=[];for(let t=0;t<l;t++){const e=t*u-n;for(let s=0;s<h;s++){const i=s*c-r;d.push(i,-e,0),m.push(0,0,1),y.push(s/a),y.push(1-t/o)}}for(let t=0;t<o;t++)for(let e=0;e<a;e++){const s=e+h*t,i=e+h*(t+1),r=e+1+h*(t+1),n=e+1+h*t;p.push(s,i,n),p.push(i,r,n)}this.setIndex(p),this.setAttribute("position",new Or(d,3)),this.setAttribute("normal",new Or(m,3)),this.setAttribute("uv",new Or(y,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Yo(t.width,t.height,t.widthSegments,t.heightSegments)}}class Zo extends Fr{constructor(t=1,e=32,s=16,i=0,r=2*Math.PI,n=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:s,phiStart:i,phiLength:r,thetaStart:n,thetaLength:a},e=Math.max(3,Math.floor(e)),s=Math.max(2,Math.floor(s));const o=Math.min(n+a,Math.PI);let h=0;const l=[],c=new Cs,u=new Cs,p=[],d=[],m=[],y=[];for(let p=0;p<=s;p++){const f=[],g=p/s;let x=0;0===p&&0===n?x=.5/e:p===s&&o===Math.PI&&(x=-.5/e);for(let s=0;s<=e;s++){const o=s/e;c.x=-t*Math.cos(i+o*r)*Math.sin(n+g*a),c.y=t*Math.cos(n+g*a),c.z=t*Math.sin(i+o*r)*Math.sin(n+g*a),d.push(c.x,c.y,c.z),u.copy(c).normalize(),m.push(u.x,u.y,u.z),y.push(o+x,1-g),f.push(h++)}l.push(f)}for(let t=0;t<s;t++)for(let i=0;i<e;i++){const e=l[t][i+1],r=l[t][i],a=l[t+1][i],h=l[t+1][i+1];(0!==t||n>0)&&p.push(e,r,h),(t!==s-1||o<Math.PI)&&p.push(r,a,h)}this.setIndex(p),this.setAttribute("position",new Or(d,3)),this.setAttribute("normal",new Or(m,3)),this.setAttribute("uv",new Or(y,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Zo(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class Ho extends Fr{constructor(t=1,e=.4,s=12,i=48,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:s,tubularSegments:i,arc:r},s=Math.floor(s),i=Math.floor(i);const n=[],a=[],o=[],h=[],l=new Cs,c=new Cs,u=new Cs;for(let n=0;n<=s;n++)for(let p=0;p<=i;p++){const d=p/i*r,m=n/s*Math.PI*2;c.x=(t+e*Math.cos(m))*Math.cos(d),c.y=(t+e*Math.cos(m))*Math.sin(d),c.z=e*Math.sin(m),a.push(c.x,c.y,c.z),l.x=t*Math.cos(d),l.y=t*Math.sin(d),u.subVectors(c,l).normalize(),o.push(u.x,u.y,u.z),h.push(p/i),h.push(n/s)}for(let t=1;t<=s;t++)for(let e=1;e<=i;e++){const s=(i+1)*t+e-1,r=(i+1)*(t-1)+e-1,a=(i+1)*(t-1)+e,o=(i+1)*t+e;n.push(s,r,o),n.push(r,a,o)}this.setIndex(n),this.setAttribute("position",new Or(a,3)),this.setAttribute("normal",new Or(o,3)),this.setAttribute("uv",new Or(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Ho(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class Go extends Fr{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},null!==t){const e=[],s=new Set,i=new Cs,r=new Cs;if(null!==t.index){const n=t.attributes.position,a=t.index;let o=t.groups;0===o.length&&(o=[{start:0,count:a.count,materialIndex:0}]);for(let t=0,h=o.length;t<h;++t){const h=o[t],l=h.start;for(let t=l,o=l+h.count;t<o;t+=3)for(let o=0;o<3;o++){const h=a.getX(t+o),l=a.getX(t+(o+1)%3);i.fromBufferAttribute(n,h),r.fromBufferAttribute(n,l),!0===$o(i,r,s)&&(e.push(i.x,i.y,i.z),e.push(r.x,r.y,r.z))}}}else{const n=t.attributes.position;for(let t=0,a=n.count/3;t<a;t++)for(let a=0;a<3;a++){const o=3*t+a,h=3*t+(a+1)%3;i.fromBufferAttribute(n,o),r.fromBufferAttribute(n,h),!0===$o(i,r,s)&&(e.push(i.x,i.y,i.z),e.push(r.x,r.y,r.z))}}this.setAttribute("position",new Or(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}function $o(t,e,s){const i=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return!0!==s.has(i)&&!0!==s.has(r)&&(s.add(i),s.add(r),!0)}class Qo extends nn{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Ko extends Mr{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new gr(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new zs(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 Vi,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class th extends Ko{constructor(t){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 zs(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ms(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new gr(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 gr(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new gr(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(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class eh extends Mr{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new gr(16777215),this.specular=new gr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new zs(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Vi,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class sh extends Mr{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new zs(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class ih extends Mr{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new gr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new zs(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Vi,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class rh extends Mr{constructor(t){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(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class nh extends Mr{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function ah(t,e){return t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function oh(t){const e=t.length,s=new Array(e);for(let t=0;t!==e;++t)s[t]=t;return s.sort(function(e,s){return t[e]-t[s]}),s}function hh(t,e,s){const i=t.length,r=new t.constructor(i);for(let n=0,a=0;a!==i;++n){const i=s[n]*e;for(let s=0;s!==e;++s)r[a++]=t[i+s]}return r}function lh(t,e,s,i){let r=1,n=t[0];for(;void 0!==n&&void 0===n[i];)n=t[r++];if(void 0===n)return;let a=n[i];if(void 0!==a)if(Array.isArray(a))do{a=n[i],void 0!==a&&(e.push(n.time),s.push(...a)),n=t[r++]}while(void 0!==n);else if(void 0!==a.toArray)do{a=n[i],void 0!==a&&(e.push(n.time),a.toArray(s,s.length)),n=t[r++]}while(void 0!==n);else do{a=n[i],void 0!==a&&(e.push(n.time),s.push(a)),n=t[r++]}while(void 0!==n)}class ch{constructor(t,e,s,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(s),this.sampleValues=e,this.valueSize=s,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let s=this._cachedIndex,i=e[s],r=e[s-1];t:{e:{let n;s:{i:if(!(t<i)){for(let n=s+2;;){if(void 0===i){if(t<r)break i;return s=e.length,this._cachedIndex=s,this.copySampleValue_(s-1)}if(s===n)break;if(r=i,i=e[++s],t<i)break e}n=e.length;break s}if(!(t>=r)){const a=e[1];t<a&&(s=2,r=a);for(let n=s-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(s===n)break;if(i=r,r=e[--s-1],t>=r)break e}n=s,s=0;break s}break t}for(;s<n;){const i=s+n>>>1;t<e[i]?n=i:s=i+1}if(i=e[s],r=e[s-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return s=e.length,this._cachedIndex=s,this.copySampleValue_(s-1)}this._cachedIndex=s,this.intervalChanged_(s,r,i)}return this.interpolate_(s,r,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,s=this.sampleValues,i=this.valueSize,r=t*i;for(let t=0;t!==i;++t)e[t]=s[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class uh extends ch{constructor(t,e,s,i){super(t,e,s,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ce,endingEnd:Ce}}intervalChanged_(t,e,s){const i=this.parameterPositions;let r=t-2,n=t+1,a=i[r],o=i[n];if(void 0===a)switch(this.getSettings_().endingStart){case ke:r=t,a=2*e-s;break;case Be:r=i.length-2,a=e+i[r]-i[r+1];break;default:r=t,a=s}if(void 0===o)switch(this.getSettings_().endingEnd){case ke:n=t,o=2*s-e;break;case Be:n=1,o=s+i[1]-i[0];break;default:n=t-1,o=e}const h=.5*(s-e),l=this.valueSize;this._weightPrev=h/(e-a),this._weightNext=h/(o-s),this._offsetPrev=r*l,this._offsetNext=n*l}interpolate_(t,e,s,i){const r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=t*a,h=o-a,l=this._offsetPrev,c=this._offsetNext,u=this._weightPrev,p=this._weightNext,d=(s-e)/(i-e),m=d*d,y=m*d,f=-u*y+2*u*m-u*d,g=(1+u)*y+(-1.5-2*u)*m+(-.5+u)*d+1,x=(-1-p)*y+(1.5+p)*m+.5*d,b=p*y-p*m;for(let t=0;t!==a;++t)r[t]=f*n[l+t]+g*n[h+t]+x*n[o+t]+b*n[c+t];return r}}class ph extends ch{constructor(t,e,s,i){super(t,e,s,i)}interpolate_(t,e,s,i){const r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=t*a,h=o-a,l=(s-e)/(i-e),c=1-l;for(let t=0;t!==a;++t)r[t]=n[h+t]*c+n[o+t]*l;return r}}class dh extends ch{constructor(t,e,s,i){super(t,e,s,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class mh{constructor(t,e,s,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=ah(e,this.TimeBufferType),this.values=ah(s,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let s;if(e.toJSON!==this.toJSON)s=e.toJSON(t);else{s={name:t.name,times:ah(t.times,Array),values:ah(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(s.interpolation=e)}return s.type=t.ValueTypeName,s}InterpolantFactoryMethodDiscrete(t){return new dh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new ph(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new uh(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Ae:e=this.InterpolantFactoryMethodDiscrete;break;case ze:e=this.InterpolantFactoryMethodLinear;break;case Te:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return cs("KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ae;case this.InterpolantFactoryMethodLinear:return ze;case this.InterpolantFactoryMethodSmooth:return Te}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let s=0,i=e.length;s!==i;++s)e[s]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let s=0,i=e.length;s!==i;++s)e[s]*=t}return this}trim(t,e){const s=this.times,i=s.length;let r=0,n=i-1;for(;r!==i&&s[r]<t;)++r;for(;-1!==n&&s[n]>e;)--n;if(++n,0!==r||n!==i){r>=n&&(n=Math.max(n,1),r=n-1);const t=this.getValueSize();this.times=s.slice(r,n),this.values=this.values.slice(r*t,n*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(us("KeyframeTrack: Invalid value size in track.",this),t=!1);const s=this.times,i=this.values,r=s.length;0===r&&(us("KeyframeTrack: Track is empty.",this),t=!1);let n=null;for(let e=0;e!==r;e++){const i=s[e];if("number"==typeof i&&isNaN(i)){us("KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==n&&n>i){us("KeyframeTrack: Out of order keys.",this,e,i,n),t=!1;break}n=i}if(void 0!==i&&ns(i))for(let e=0,s=i.length;e!==s;++e){const s=i[e];if(isNaN(s)){us("KeyframeTrack: Value is not a valid number.",this,e,s),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),s=this.getValueSize(),i=this.getInterpolation()===Te,r=t.length-1;let n=1;for(let a=1;a<r;++a){let r=!1;const o=t[a];if(o!==t[a+1]&&(1!==a||o!==t[0]))if(i)r=!0;else{const t=a*s,i=t-s,n=t+s;for(let a=0;a!==s;++a){const s=e[t+a];if(s!==e[i+a]||s!==e[n+a]){r=!0;break}}}if(r){if(a!==n){t[n]=t[a];const i=a*s,r=n*s;for(let t=0;t!==s;++t)e[r+t]=e[i+t]}++n}}if(r>0){t[n]=t[r];for(let t=r*s,i=n*s,a=0;a!==s;++a)e[i+a]=e[t+a];++n}return n!==t.length?(this.times=t.slice(0,n),this.values=e.slice(0,n*s)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),s=new(0,this.constructor)(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}}mh.prototype.ValueTypeName="",mh.prototype.TimeBufferType=Float32Array,mh.prototype.ValueBufferType=Float32Array,mh.prototype.DefaultInterpolation=ze;class yh extends mh{constructor(t,e,s){super(t,e,s)}}yh.prototype.ValueTypeName="bool",yh.prototype.ValueBufferType=Array,yh.prototype.DefaultInterpolation=Ae,yh.prototype.InterpolantFactoryMethodLinear=void 0,yh.prototype.InterpolantFactoryMethodSmooth=void 0;class fh extends mh{constructor(t,e,s,i){super(t,e,s,i)}}fh.prototype.ValueTypeName="color";class gh extends mh{constructor(t,e,s,i){super(t,e,s,i)}}gh.prototype.ValueTypeName="number";class xh extends ch{constructor(t,e,s,i){super(t,e,s,i)}interpolate_(t,e,s,i){const r=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=(s-e)/(i-e);let h=t*a;for(let t=h+a;h!==t;h+=4)Ts.slerpFlat(r,0,n,h-a,n,h,o);return r}}class bh extends mh{constructor(t,e,s,i){super(t,e,s,i)}InterpolantFactoryMethodLinear(t){return new xh(this.times,this.values,this.getValueSize(),t)}}bh.prototype.ValueTypeName="quaternion",bh.prototype.InterpolantFactoryMethodSmooth=void 0;class Mh extends mh{constructor(t,e,s){super(t,e,s)}}Mh.prototype.ValueTypeName="string",Mh.prototype.ValueBufferType=Array,Mh.prototype.DefaultInterpolation=Ae,Mh.prototype.InterpolantFactoryMethodLinear=void 0,Mh.prototype.InterpolantFactoryMethodSmooth=void 0;class wh extends mh{constructor(t,e,s,i){super(t,e,s,i)}}wh.prototype.ValueTypeName="vector";class vh{constructor(t="",e=-1,s=[],i=2500){this.name=t,this.tracks=s,this.duration=e,this.blendMode=i,this.uuid=bs(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){const e=[],s=t.tracks,i=1/(t.fps||1);for(let t=0,r=s.length;t!==r;++t)e.push(Sh(s[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||"{}"),r}static toJSON(t){const e=[],s=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let t=0,i=s.length;t!==i;++t)e.push(mh.toJSON(s[t]));return i}static CreateFromMorphTargetSequence(t,e,s,i){const r=e.length,n=[];for(let t=0;t<r;t++){let a=[],o=[];a.push((t+r-1)%r,t,(t+1)%r),o.push(0,1,0);const h=oh(a);a=hh(a,1,h),o=hh(o,1,h),i||0!==a[0]||(a.push(r),o.push(o[0])),n.push(new gh(".morphTargetInfluences["+e[t].name+"]",a,o).scale(1/s))}return new this(t,-1,n)}static findByName(t,e){let s=t;if(!Array.isArray(t)){const e=t;s=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<s.length;t++)if(s[t].name===e)return s[t];return null}static CreateClipsFromMorphTargetSequences(t,e,s){const i={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,s=t.length;e<s;e++){const s=t[e],n=s.name.match(r);if(n&&n.length>1){const t=n[1];let e=i[t];e||(i[t]=e=[]),e.push(s)}}const n=[];for(const t in i)n.push(this.CreateFromMorphTargetSequence(t,i[t],e,s));return n}static parseAnimation(t,e){if(cs("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return us("AnimationClip: No animation in JSONLoader data."),null;const s=function(t,e,s,i,r){if(0!==s.length){const n=[],a=[];lh(s,n,a,i),0!==n.length&&r.push(new t(e,n,a))}},i=[],r=t.name||"default",n=t.fps||30,a=t.blendMode;let o=t.length||-1;const h=t.hierarchy||[];for(let t=0;t<h.length;t++){const r=h[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let s=0;s<r[e].morphTargets.length;s++)t[r[e].morphTargets[s]]=-1;for(const s in t){const t=[],n=[];for(let i=0;i!==r[e].morphTargets.length;++i){const i=r[e];t.push(i.time),n.push(i.morphTarget===s?1:0)}i.push(new gh(".morphTargetInfluence["+s+"]",t,n))}o=t.length*n}else{const n=".bones["+e[t].name+"]";s(wh,n+".position",r,"pos",i),s(bh,n+".quaternion",r,"rot",i),s(wh,n+".scale",r,"scl",i)}}if(0===i.length)return null;return new this(r,o,i,a)}resetDuration(){let t=0;for(let e=0,s=this.tracks.length;e!==s;++e){const s=this.tracks[e];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());const e=new this.constructor(this.name,this.duration,t,this.blendMode);return e.userData=JSON.parse(JSON.stringify(this.userData)),e}toJSON(){return this.constructor.toJSON(this)}}function Sh(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return gh;case"vector":case"vector2":case"vector3":case"vector4":return wh;case"color":return fh;case"quaternion":return bh;case"bool":case"boolean":return yh;case"string":return Mh}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],s=[];lh(t.keys,e,s,"value"),t.times=e,t.values=s}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const _h={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Ah{constructor(t,e,s){const i=this;let r,n=!1,a=0,o=0;const h=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=s,this._abortController=null,this.itemStart=function(t){o++,!1===n&&void 0!==i.onStart&&i.onStart(t,a,o),n=!0},this.itemEnd=function(t){a++,void 0!==i.onProgress&&i.onProgress(t,a,o),a===o&&(n=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return h.push(t,e),this},this.removeHandler=function(t){const e=h.indexOf(t);return-1!==e&&h.splice(e,2),this},this.getHandler=function(t){for(let e=0,s=h.length;e<s;e+=2){const s=h[e],i=h[e+1];if(s.global&&(s.lastIndex=0),s.test(t))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}}const zh=new Ah;class Th{constructor(t){this.manager=void 0!==t?t:zh,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const s=this;return new Promise(function(i,r){s.load(t,i,e,r)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}}Th.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ch={};class kh extends Error{constructor(t,e){super(t),this.response=e}}class Bh extends Th{constructor(t){super(t),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(t,e,s,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=_h.get(`file:${t}`);if(void 0!==r)return this.manager.itemStart(t),setTimeout(()=>{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==Ch[t])return void Ch[t].push({onLoad:e,onProgress:s,onError:i});Ch[t]=[],Ch[t].push({onLoad:e,onProgress:s,onError:i});const n=new Request(t,{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}),a=this.mimeType,o=this.responseType;fetch(n).then(e=>{if(200===e.status||0===e.status){if(0===e.status&&cs("FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const s=Ch[t],i=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),n=r?parseInt(r):0,a=0!==n;let o=0;const h=new ReadableStream({start(t){!function e(){i.read().then(({done:i,value:r})=>{if(i)t.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:n});for(let t=0,e=s.length;t<e;t++){const e=s[t];e.onProgress&&e.onProgress(i)}t.enqueue(r),e()}},e=>{t.error(e)})}()}});return new Response(h)}throw new kh(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)}).then(t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>(new DOMParser).parseFromString(t,a));case"json":return t.json();default:if(""===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),s=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(s);return t.arrayBuffer().then(t=>i.decode(t))}}}).then(e=>{_h.add(`file:${t}`,e);const s=Ch[t];delete Ch[t];for(let t=0,i=s.length;t<i;t++){const i=s[t];i.onLoad&&i.onLoad(e)}}).catch(e=>{const s=Ch[t];if(void 0===s)throw this.manager.itemError(t),e;delete Ch[t];for(let t=0,i=s.length;t<i;t++){const i=s[t];i.onError&&i.onError(e)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const Oh=new WeakMap;class Ph extends Th{constructor(t){super(t)}load(t,e,s,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,n=_h.get(`image:${t}`);if(void 0!==n){if(!0===n.complete)r.manager.itemStart(t),setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0);else{let t=Oh.get(n);void 0===t&&(t=[],Oh.set(n,t)),t.push({onLoad:e,onError:i})}return n}const a=as("img");function o(){l(),e&&e(this);const s=Oh.get(this)||[];for(let t=0;t<s.length;t++){const e=s[t];e.onLoad&&e.onLoad(this)}Oh.delete(this),r.manager.itemEnd(t)}function h(e){l(),i&&i(e),_h.remove(`image:${t}`);const s=Oh.get(this)||[];for(let t=0;t<s.length;t++){const i=s[t];i.onError&&i.onError(e)}Oh.delete(this),r.manager.itemError(t),r.manager.itemEnd(t)}function l(){a.removeEventListener("load",o,!1),a.removeEventListener("error",h,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",h,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),_h.add(`image:${t}`,a),r.manager.itemStart(t),a.src=t,a}}class Nh extends Th{constructor(t){super(t)}load(t,e,s,i){const r=this,n=new Hn,a=new Bh(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(t,function(t){let s;try{s=r.parse(t)}catch(t){if(void 0===i)return void t(t);i(t)}void 0!==s.image?n.image=s.image:void 0!==s.data&&(n.image.width=s.width,n.image.height=s.height,n.image.data=s.data),n.wrapS=void 0!==s.wrapS?s.wrapS:pt,n.wrapT=void 0!==s.wrapT?s.wrapT:pt,n.magFilter=void 0!==s.magFilter?s.magFilter:gt,n.minFilter=void 0!==s.minFilter?s.minFilter:gt,n.anisotropy=void 0!==s.anisotropy?s.anisotropy:1,void 0!==s.colorSpace&&(n.colorSpace=s.colorSpace),void 0!==s.flipY&&(n.flipY=s.flipY),void 0!==s.format&&(n.format=s.format),void 0!==s.type&&(n.type=s.type),void 0!==s.mipmaps&&(n.mipmaps=s.mipmaps,n.minFilter=bt),1===s.mipmapCount&&(n.minFilter=gt),void 0!==s.generateMipmaps&&(n.generateMipmaps=s.generateMipmaps),n.needsUpdate=!0,e&&e(n,s)},s,i),n}}class Ih extends Th{constructor(t){super(t)}load(t,e,s,i){const r=new Xs,n=new Ph(this.manager);return n.setCrossOrigin(this.crossOrigin),n.setPath(this.path),n.load(t,function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)},s,i),r}}class Vh extends Qi{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new gr(t),this.intensity=e}dispose(){this.dispatchEvent({type:"dispose"})}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,e}}const Rh=new Ai,Lh=new Cs,Eh=new Cs;class Fh{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new zs(512,512),this.mapType=Mt,this.map=null,this.mapPass=null,this.matrix=new Ai,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ya,this._frameExtents=new zs(1,1),this._viewportCount=1,this._viewports=[new Ys(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,s=this.matrix;Lh.setFromMatrixPosition(t.matrixWorld),e.position.copy(Lh),Eh.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Eh),e.updateMatrixWorld(),Rh.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Rh,e.coordinateSystem,e.reversedDepth),e.reversedDepth?s.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):s.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),s.multiply(Rh)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.autoUpdate=t.autoUpdate,this.needsUpdate=t.needsUpdate,this.normalBias=t.normalBias,this.blurSamples=t.blurSamples,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 1!==this.intensity&&(t.intensity=this.intensity),0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Dh extends Fh{constructor(){super(new cn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(t){const e=this.camera,s=2*xs*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=t.distance||e.far;s===e.fov&&i===e.aspect&&r===e.far||(e.fov=s,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class Uh extends Vh{constructor(t,e,s=0,i=Math.PI/3,r=0,n=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Qi.DEFAULT_UP),this.updateMatrix(),this.target=new Qi,this.distance=s,this.angle=i,this.penumbra=r,this.decay=n,this.map=null,this.shadow=new Dh}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.map=t.map,this.shadow=t.shadow.clone(),this}toJSON(t){const e=super.toJSON(t);return e.object.distance=this.distance,e.object.angle=this.angle,e.object.decay=this.decay,e.object.penumbra=this.penumbra,e.object.target=this.target.uuid,this.map&&this.map.isTexture&&(e.object.map=this.map.toJSON(t).uuid),e.object.shadow=this.shadow.toJSON(),e}}class jh extends Fh{constructor(){super(new cn(90,1,.5,500)),this.isPointLightShadow=!0}}class Wh extends Vh{constructor(t,e,s=0,i=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=s,this.decay=i,this.shadow=new jh}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}toJSON(t){const e=super.toJSON(t);return e.object.distance=this.distance,e.object.decay=this.decay,e.object.shadow=this.shadow.toJSON(),e}}class Jh extends an{constructor(t=-1,e=1,s=1,i=-1,r=.1,n=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=s,this.bottom=i,this.near=r,this.far=n,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,s,i,r,n){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=t,this.view.fullHeight=e,this.view.offsetX=s,this.view.offsetY=i,this.view.width=r,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),s=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=s-t,n=s+t,a=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,n=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,n,a,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}class qh extends Fh{constructor(){super(new Jh(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Xh extends Vh{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Qi.DEFAULT_UP),this.updateMatrix(),this.target=new Qi,this.shadow=new qh}dispose(){super.dispose(),this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){const e=super.toJSON(t);return e.object.shadow=this.shadow.toJSON(),e.object.target=this.target.uuid,e}}class Yh{static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class Zh extends Fr{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){const t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}const Hh=new WeakMap;class Gh extends Th{constructor(t){super(t),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&cs("ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&cs("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(t){return this.options=t,this}load(t,e,s,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,n=_h.get(`image-bitmap:${t}`);if(void 0!==n)return r.manager.itemStart(t),n.then?void n.then(s=>{if(!0!==Hh.has(n))return e&&e(s),r.manager.itemEnd(t),s;i&&i(Hh.get(n)),r.manager.itemError(t),r.manager.itemEnd(t)}):(setTimeout(function(){e&&e(n),r.manager.itemEnd(t)},0),n);const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,a.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const o=fetch(t,a).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(s){return _h.add(`image-bitmap:${t}`,s),e&&e(s),r.manager.itemEnd(t),s}).catch(function(e){i&&i(e),Hh.set(o,e),_h.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});_h.add(`image-bitmap:${t}`,o),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class $h extends cn{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class Qh{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}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 t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=performance.now();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}const Kh="\\[\\]\\.:\\/",tl=new RegExp("["+Kh+"]","g"),el="[^"+Kh+"]",sl="[^"+Kh.replace("\\.","")+"]",il=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",el)+/(WCOD+)?/.source.replace("WCOD",sl)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",el)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",el)+"$"),rl=["material","materials","bones","map"];class nl{constructor(t,e,s){this.path=e,this.parsedPath=s||nl.parseTrackName(e),this.node=nl.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,s){return t&&t.isAnimationObjectGroup?new nl.Composite(t,e,s):new nl(t,e,s)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(tl,"")}static parseTrackName(t){const e=il.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const s={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=s.nodeName&&s.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=s.nodeName.substring(i+1);-1!==rl.indexOf(t)&&(s.nodeName=s.nodeName.substring(0,i),s.objectName=t)}if(null===s.propertyName||0===s.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return s}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const s=t.skeleton.getBoneByName(e);if(void 0!==s)return s}if(t.children){const s=function(t){for(let i=0;i<t.length;i++){const r=t[i];if(r.name===e||r.uuid===e)return r;const n=s(r.children);if(n)return n}return null},i=s(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const s=this.resolvedProperty;for(let i=0,r=s.length;i!==r;++i)t[e++]=s[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const s=this.resolvedProperty;for(let i=0,r=s.length;i!==r;++i)s[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const s=this.resolvedProperty;for(let i=0,r=s.length;i!==r;++i)s[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const s=this.resolvedProperty;for(let i=0,r=s.length;i!==r;++i)s[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,s=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=nl.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void cs("PropertyBinding: No target node found for track: "+this.path+".");if(s){let i=e.objectIndex;switch(s){case"materials":if(!t.material)return void us("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void us("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void us("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===i){i=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void us("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void us("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[s])return void us("PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[s]}if(void 0!==i){if(void 0===t[i])return void us("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[i]}}const n=t[i];if(void 0===n){return void us("PropertyBinding: Trying to update property for track: "+e.nodeName+"."+i+" but it wasn't found.",t)}let a=this.Versioning.None;this.targetObject=t,!0===t.isMaterial?a=this.Versioning.NeedsUpdate:!0===t.isObject3D&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return void us("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void us("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=n,this.propertyIndex=r}else void 0!==n.fromArray&&void 0!==n.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=n):Array.isArray(n)?(o=this.BindingType.EntireArray,this.resolvedProperty=n):this.propertyName=i;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}nl.Composite=class{constructor(t,e,s){const i=s||nl.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const s=this._targetGroup.nCachedObjects_,i=this._bindings[s];void 0!==i&&i.getValue(t,e)}setValue(t,e){const s=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=s.length;i!==r;++i)s[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,s=t.length;e!==s;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,s=t.length;e!==s;++e)t[e].unbind()}},nl.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},nl.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},nl.prototype.GetterByBindingType=[nl.prototype._getValue_direct,nl.prototype._getValue_array,nl.prototype._getValue_arrayElement,nl.prototype._getValue_toArray],nl.prototype.SetterByBindingTypeAndVersioning=[[nl.prototype._setValue_direct,nl.prototype._setValue_direct_setNeedsUpdate,nl.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[nl.prototype._setValue_array,nl.prototype._setValue_array_setNeedsUpdate,nl.prototype._setValue_array_setMatrixWorldNeedsUpdate],[nl.prototype._setValue_arrayElement,nl.prototype._setValue_arrayElement_setNeedsUpdate,nl.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[nl.prototype._setValue_fromArray,nl.prototype._setValue_fromArray_setNeedsUpdate,nl.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class al extends bn{constructor(t,e,s=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=s}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}const ol=new Ai;class hl{constructor(t,e,s=0,i=1/0){this.ray=new _i(t,e),this.near=s,this.far=i,this.camera=null,this.layers=new Ri,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):us("Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return ol.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(ol),this}intersectObject(t,e=!0,s=[]){return cl(t,this,s,e),s.sort(ll),s}intersectObjects(t,e=!0,s=[]){for(let i=0,r=t.length;i<r;i++)cl(t[i],this,s,e);return s.sort(ll),s}}function ll(t,e){return t.distance-e.distance}function cl(t,e,s,i){let r=!0;if(t.layers.test(e.layers)){!1===t.raycast(e,s)&&(r=!1)}if(!0===r&&!0===i){const i=t.children;for(let t=0,r=i.length;t<r;t++)cl(i[t],e,s,!0)}}class ul{constructor(t=1,e=0,s=0){this.radius=t,this.phi=e,this.theta=s}set(t,e,s){return this.radius=t,this.phi=e,this.theta=s,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){const t=1e-6;return this.phi=Ms(this.phi,t,Math.PI-t),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,s){return this.radius=Math.sqrt(t*t+e*e+s*s),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,s),this.phi=Math.acos(Ms(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}const pl=new Cs,dl=new Cs,ml=new Cs,yl=new Cs,fl=new Cs,gl=new Cs,xl=new Cs;class bl{constructor(t=new Cs,e=new Cs){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){pl.subVectors(t,this.start),dl.subVectors(this.end,this.start);const s=dl.dot(dl);let i=dl.dot(pl)/s;return e&&(i=Ms(i,0,1)),i}closestPointToPoint(t,e,s){const i=this.closestPointToPointParameter(t,e);return this.delta(s).multiplyScalar(i).add(this.start)}distanceSqToLine3(t,e=gl,s=xl){const i=1e-8*1e-8;let r,n;const a=this.start,o=t.start,h=this.end,l=t.end;ml.subVectors(h,a),yl.subVectors(l,o),fl.subVectors(a,o);const c=ml.dot(ml),u=yl.dot(yl),p=yl.dot(fl);if(c<=i&&u<=i)return e.copy(a),s.copy(o),e.sub(s),e.dot(e);if(c<=i)r=0,n=p/u,n=Ms(n,0,1);else{const t=ml.dot(fl);if(u<=i)n=0,r=Ms(-t/c,0,1);else{const e=ml.dot(yl),s=c*u-e*e;r=0!==s?Ms((e*p-t*u)/s,0,1):0,n=(e*r+p)/u,n<0?(n=0,r=Ms(-t/c,0,1)):n>1&&(n=1,r=Ms((e-t)/c,0,1))}}return e.copy(a).add(ml.multiplyScalar(r)),s.copy(o).add(yl.multiplyScalar(n)),e.sub(s),e.dot(e)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}class Ml extends Ca{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],s=new Fr;s.setAttribute("position",new Or(e,3)),s.setAttribute("color",new Or([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(s,new fa({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,s){const i=new gr,r=this.geometry.attributes.color.array;return i.set(t),i.toArray(r,0),i.toArray(r,3),i.set(e),i.toArray(r,6),i.toArray(r,9),i.set(s),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class wl extends ms{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(t){void 0!==t?(null!==this.domElement&&this.disconnect(),this.domElement=t):cs("Controls: connect() now requires an element.")}disconnect(){}dispose(){}update(){}}function vl(t,e,s,i){const r=function(t){switch(t){case Mt:case wt:return{byteLength:1,components:1};case St:case vt:case Tt:return{byteLength:2,components:1};case Ct:case kt:return{byteLength:2,components:4};case At:case _t:case zt:return{byteLength:4,components:1};case Ot:case Pt:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}(i);switch(s){case 1021:return t*e;case Et:case 1029:return t*e/r.components*r.byteLength;case 1030:case 1031:return t*e*2/r.components*r.byteLength;case 1022:return t*e*3/r.components*r.byteLength;case Vt:case 1033:return t*e*4/r.components*r.byteLength;case 33776:case 33777:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case 33778:case 33779:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case 35841:case 35843:return Math.max(t,16)*Math.max(e,8)/4;case 35840:case 35842:return Math.max(t,8)*Math.max(e,8)/2;case 36196:case 37492:case 37488:case 37489:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case 37496:case 37490:case 37491:case 37808:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case 37809:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case 37810:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case 37811:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case 37812:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case 37813:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case 37814:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case 37815:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case 37816:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case 37817:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case 37818:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case 37819:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case 37820:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case 37821:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case 36492:case 36494:case 36495:return Math.ceil(t/4)*Math.ceil(e/4)*16;case 36283:case 36284:return Math.ceil(t/4)*Math.ceil(e/4)*8;case 36285:case 36286:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${s} format.`)}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:t}})),"undefined"!=typeof window&&(window.__THREE__?cs("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=t);export{K as ACESFilmicToneMapping,x as AddEquation,Z as AddOperation,m as AdditiveBlending,et as AgXToneMapping,Nt as AlphaFormat,Ke as AlwaysCompare,F as AlwaysDepth,qe as AlwaysStencilFunc,vh as AnimationClip,Xa as ArcCurve,$h as ArrayCamera,it as AttachedBindMode,Ml as AxesHelper,c as BackSide,Ve as BasicDepthPacking,Zn as Bone,yh as BooleanKeyframeTrack,Qs as Box3,Kr as BoxGeometry,Cr as BufferAttribute,Fr as BufferGeometry,wt as ByteType,_h as Cache,an as Camera,La as CanvasTexture,Ua as CapsuleGeometry,Qa as CatmullRomCurve3,Q as CineonToneMapping,pt as ClampToEdgeWrapping,Qh as Clock,gr as Color,fh as ColorKeyframeTrack,Rs as ColorManagement,R as ConstantAlphaFactor,I as ConstantColorFactor,wl as Controls,pn as CubeCamera,Fa as CubeDepthTexture,at as CubeReflectionMapping,ot as CubeRefractionMapping,dn as CubeTexture,ct as CubeUVReflectionMapping,so as CubicBezierCurve,io as CubicBezierCurve3,uh as CubicInterpolant,r as CullFaceBack,n as CullFaceFront,i as CullFaceNone,Ja as Curve,co as CurvePath,g as CustomBlending,tt as CustomToneMapping,ja as CylinderGeometry,$s as Data3DTexture,Gs as DataArrayTexture,Hn as DataTexture,Nh as DataTextureLoader,_r as DataUtils,zh as DefaultLoadingManager,Rt as DepthFormat,Lt as DepthStencilFormat,Ea as DepthTexture,rt as DetachedBindMode,Xh as DirectionalLight,dh as DiscreteInterpolant,u as DoubleSide,k as DstAlphaFactor,O as DstColorFactor,qa as EllipseCurve,Ze as EqualCompare,j as EqualDepth,ht as EquirectangularReflectionMapping,lt as EquirectangularRefractionMapping,Vi as Euler,ms as EventDispatcher,Da as ExternalTexture,Jo as ExtrudeGeometry,Bh as FileLoader,Or as Float32BufferAttribute,zt as FloatType,l as FrontSide,ya as Frustum,es as GLSL3,Ge as GreaterCompare,J as GreaterDepth,Qe as GreaterEqualCompare,W as GreaterEqualDepth,yn as Group,Tt as HalfFloatType,Gh as ImageBitmapLoader,Ph as ImageLoader,Ds as ImageUtils,Kn as InstancedBufferAttribute,Zh as InstancedBufferGeometry,al as InstancedInterleavedBuffer,oa as InstancedMesh,_t as IntType,bn as InterleavedBuffer,wn as InterleavedBufferAttribute,ch as Interpolant,Ae as InterpolateDiscrete,ze as InterpolateLinear,Te as InterpolateSmooth,Je as KeepStencilOp,mh as KeyframeTrack,Ri as Layers,Ye as LessCompare,D as LessDepth,He as LessEqualCompare,U as LessEqualDepth,Vh as Light,_a as Line,bl as Line3,fa as LineBasicMaterial,ro as LineCurve,no as LineCurve3,ka as LineLoop,Ca as LineSegments,gt as LinearFilter,ph as LinearInterpolant,bt as LinearMipmapLinearFilter,xt as LinearMipmapNearestFilter,Ue as LinearSRGBColorSpace,G as LinearToneMapping,je as LinearTransfer,Th as Loader,Yh as LoaderUtils,Ah as LoadingManager,e as MOUSE,Mr as Material,As as MathUtils,Os as Matrix3,Ai as Matrix4,v as MaxEquation,$r as Mesh,wr as MeshBasicMaterial,rh as MeshDepthMaterial,nh as MeshDistanceMaterial,ih as MeshLambertMaterial,sh as MeshNormalMaterial,eh as MeshPhongMaterial,th as MeshPhysicalMaterial,Ko as MeshStandardMaterial,w as MinEquation,dt as MirroredRepeatWrapping,Y as MixOperation,f as MultiplyBlending,X as MultiplyOperation,mt as NearestFilter,ft as NearestMipmapLinearFilter,yt as NearestMipmapNearestFilter,st as NeutralToneMapping,Xe as NeverCompare,E as NeverDepth,p as NoBlending,Fe as NoColorSpace,H as NoToneMapping,Oe as NormalAnimationBlendMode,d as NormalBlending,$e as NotEqualCompare,q as NotEqualDepth,gh as NumberKeyframeTrack,Qi as Object3D,Ee as ObjectSpaceNormalMap,Xo as OctahedronGeometry,_ as OneFactor,L as OneMinusConstantAlphaFactor,V as OneMinusConstantColorFactor,B as OneMinusDstAlphaFactor,P as OneMinusDstColorFactor,C as OneMinusSrcAlphaFactor,z as OneMinusSrcColorFactor,Jh as OrthographicCamera,a as PCFShadowMap,o as PCFSoftShadowMap,uo as Path,cn as PerspectiveCamera,ua as Plane,Yo as PlaneGeometry,Wh as PointLight,Va as Points,Ba as PointsMaterial,Wa as PolyhedronGeometry,nl as PropertyBinding,ao as QuadraticBezierCurve,oo as QuadraticBezierCurve3,Ts as Quaternion,bh as QuaternionKeyframeTrack,xh as QuaternionLinearInterpolant,te as R11_EAC_Format,xs as RAD2DEG,Se as RED_GREEN_RGTC2_Format,we as RED_RGTC1_Format,t as REVISION,se as RG11_EAC_Format,Re as RGBADepthPacking,Vt as RGBAFormat,jt as RGBAIntegerFormat,ye as RGBA_ASTC_10x10_Format,pe as RGBA_ASTC_10x5_Format,de as RGBA_ASTC_10x6_Format,me as RGBA_ASTC_10x8_Format,fe as RGBA_ASTC_12x10_Format,ge as RGBA_ASTC_12x12_Format,re as RGBA_ASTC_4x4_Format,ne as RGBA_ASTC_5x4_Format,ae as RGBA_ASTC_5x5_Format,oe as RGBA_ASTC_6x5_Format,he as RGBA_ASTC_6x6_Format,le as RGBA_ASTC_8x5_Format,ce as RGBA_ASTC_8x6_Format,ue as RGBA_ASTC_8x8_Format,xe as RGBA_BPTC_Format,Kt as RGBA_ETC2_EAC_Format,Gt as RGBA_PVRTC_2BPPV1_Format,Ht as RGBA_PVRTC_4BPPV1_Format,Jt as RGBA_S3TC_DXT1_Format,qt as RGBA_S3TC_DXT3_Format,Xt as RGBA_S3TC_DXT5_Format,It as RGBFormat,be as RGB_BPTC_SIGNED_Format,Me as RGB_BPTC_UNSIGNED_Format,$t as RGB_ETC1_Format,Qt as RGB_ETC2_Format,Zt as RGB_PVRTC_2BPPV1_Format,Yt as RGB_PVRTC_4BPPV1_Format,Wt as RGB_S3TC_DXT1_Format,Dt as RGFormat,Ut as RGIntegerFormat,Qo as RawShaderMaterial,_i as Ray,hl as Raycaster,Et as RedFormat,Ft as RedIntegerFormat,$ as ReinhardToneMapping,Zs as RenderTarget,ut as RepeatWrapping,M as ReverseSubtractEquation,ee as SIGNED_R11_EAC_Format,_e as SIGNED_RED_GREEN_RGTC2_Format,ve as SIGNED_RED_RGTC1_Format,ie as SIGNED_RG11_EAC_Format,De as SRGBColorSpace,We as SRGBTransfer,xn as Scene,nn as ShaderMaterial,po as Shape,Uo as ShapeUtils,vt as ShortType,Qn as Skeleton,Yn as SkinnedMesh,js as Source,fi as Sphere,Zo as SphereGeometry,ul as Spherical,ho as SplineCurve,Uh as SpotLight,Rn as Sprite,vn as SpriteMaterial,T as SrcAlphaFactor,N as SrcAlphaSaturateFactor,A as SrcColorFactor,ts as StaticDrawUsage,Mh as StringKeyframeTrack,b as SubtractEquation,y as SubtractiveBlending,s as TOUCH,Le as TangentSpaceNormalMap,Xs as Texture,Ih as TextureLoader,Ho as TorusGeometry,pr as Triangle,Ie as TriangleFanDrawMode,Ne as TriangleStripDrawMode,Pe as TrianglesDrawMode,nt as UVMapping,kr as Uint16BufferAttribute,Br as Uint32BufferAttribute,rn as UniformsUtils,Mt as UnsignedByteType,Pt as UnsignedInt101111Type,Bt as UnsignedInt248Type,Ot as UnsignedInt5999Type,At as UnsignedIntType,Ct as UnsignedShort4444Type,kt as UnsignedShort5551Type,St as UnsignedShortType,h as VSMShadowMap,zs as Vector2,Cs as Vector3,Ys as Vector4,wh as VectorKeyframeTrack,ss as WebGLCoordinateSystem,mn as WebGLCubeRenderTarget,Hs as WebGLRenderTarget,is as WebGPUCoordinateSystem,gn as WebXRController,Go as WireframeGeometry,Be as WrapAroundEnding,Ce as ZeroCurvatureEnding,S as ZeroFactor,ke as ZeroSlopeEnding,rs as arrayNeedsUint32,tn as cloneUniforms,os as createCanvasElement,as as createElementNS,us as error,vl as getByteLength,sn as getUnlitUniformColorSpace,ns as isTypedArray,ls as log,en as mergeUniforms,ds as probeAsync,cs as warn,ps as warnOnce};