grimoire3d 0.0.0-dev.ef50bb6 → 0.0.0-dev.f7e9e26
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.
- package/README.md +28 -124
- package/cli/cli.js +348 -0
- package/cli/content.js +382 -0
- package/cli/cover-options.d.ts +15 -0
- package/cli/cover-options.js +105 -0
- package/cli/markdown.js +139 -0
- package/cli/markup.d.ts +3 -0
- package/cli/markup.js +60 -0
- package/cli/routes.d.ts +6 -0
- package/cli/routes.js +19 -0
- package/cli/static-pages.js +467 -0
- package/cli/video-url.d.ts +5 -0
- package/cli/video-url.js +51 -0
- package/dist/BookViewer-CwCn-LTn.js +332 -0
- package/dist/components/BookModel.d.ts +20 -0
- package/dist/components/BookViewer.d.ts +17 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +5 -0
- package/dist/grimoire3d.css +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +4 -0
- package/dist/main.d.ts +1 -0
- package/dist/site/assets/BookReader-BxKrexRZ.js +2 -0
- package/dist/site/assets/BookScene-DN1_Kxe3.js +4045 -0
- package/dist/site/assets/MermaidDiagram-Dma3Cwvn.js +312 -0
- package/dist/site/assets/PageMarkdown-C-gI_dXg.js +37 -0
- package/dist/site/assets/abnfDiagram-S7VZAUFO-BIA2ezcb.js +1 -0
- package/dist/site/assets/alcove-cyX4Tv3E.avif +0 -0
- package/dist/site/assets/architectureDiagram-YGSQEFNW-DMB5UtEZ.js +36 -0
- package/dist/site/assets/blockDiagram-APKKGZFW-CeBSUSaW.js +140 -0
- package/dist/site/assets/bpmnIcons-APHXDYXF-ByGoYv9M.js +1 -0
- package/dist/site/assets/c4Diagram-KJ2TOQU5-BmBo2PHu.js +38 -0
- package/dist/site/assets/catalog-07-UR91A.avif +0 -0
- package/dist/site/assets/chunk-2Q5K7J3B-BDgDFVbx.js +1 -0
- package/dist/site/assets/chunk-5VM5RSS4-CCNs5Q1j.js +15 -0
- package/dist/site/assets/chunk-HFQBQIA3-B8uXoLoT.js +1 -0
- package/dist/site/assets/chunk-JWPE2WC7-BiKy7CcD.js +1 -0
- package/dist/site/assets/chunk-KQLB2F66-D_kpUTKA.js +2 -0
- package/dist/site/assets/chunk-KS47KZWR-C_s_qnHf.js +1 -0
- package/dist/site/assets/chunk-OY52VR5R-D8f7gl4W.js +88 -0
- package/dist/site/assets/chunk-TU62E6Q5-Bm44Znlj.js +1 -0
- package/dist/site/assets/chunk-XXDRQBXY-ChLLr56_.js +1 -0
- package/dist/site/assets/classDiagram-v2-L25IHNXF-DwKi-r2i.js +217 -0
- package/dist/site/assets/cose-bilkent-JH36ORCC-8N6YUm1i.js +1 -0
- package/dist/site/assets/cover-blue-Bh8Xp4T5.avif +0 -0
- package/dist/site/assets/cover-blue-mobile-YcuYIg0I.avif +0 -0
- package/dist/site/assets/cover-green-By13JjUx.avif +0 -0
- package/dist/site/assets/cover-green-mobile-BNTgNt7v.avif +0 -0
- package/dist/site/assets/cover-red-mobile-DHOCz3wI.avif +0 -0
- package/dist/site/assets/cover-red-qvZEk3PI.avif +0 -0
- package/dist/site/assets/cynefin-EF2NZ3EQ-Df5ATUPb.js +141 -0
- package/dist/site/assets/cynefinDiagram-L36ESFBY-DmAbfxAU.js +62 -0
- package/dist/site/assets/cytoscape.esm-BHa1VTXv.js +321 -0
- package/dist/site/assets/d3-scale-4DPf7zan.js +1 -0
- package/dist/site/assets/dagre-SPEB5RXH-B_2grAE7.js +4 -0
- package/dist/site/assets/diagram-3B7GL73J-C9FXwDlf.js +200 -0
- package/dist/site/assets/diagram-DNEMPZML-DflAT3gr.js +24 -0
- package/dist/site/assets/diagram-L3MUGCDN-B04gjrM_.js +41 -0
- package/dist/site/assets/diagram-LA4NIPWU-cfWJg8HX.js +24 -0
- package/dist/site/assets/diagram-MHCOC4E2-jRbOs2Df.js +3 -0
- package/dist/site/assets/diagram-XPFHEONP-yR45xV59.js +30 -0
- package/dist/site/assets/ebnfDiagram-UZSYDL2S-DlmNJUx4.js +1 -0
- package/dist/site/assets/elk-XV6XMXQE-cHLdRN7u.js +27 -0
- package/dist/site/assets/erDiagram-EYBAPDEH-7HsRsmBI.js +99 -0
- package/dist/site/assets/es-DoLiZPBX.js +2 -0
- package/dist/site/assets/favicon-C9YRygge.png +0 -0
- package/dist/site/assets/flowDiagram-MALGAFMO-DoJjw4RA.js +213 -0
- package/dist/site/assets/ganttDiagram-23REXITY-D2uZtX_8.js +292 -0
- package/dist/site/assets/gitGraphDiagram-STJD7YCW-CjftfLRK.js +106 -0
- package/dist/site/assets/graph-D8UmR1vK.js +1 -0
- package/dist/site/assets/index-CqcyU6rA.js +1 -0
- package/dist/site/assets/index-DWW-KDWe.css +1 -0
- package/dist/site/assets/infoDiagram-KBXO4MBG-HN-1tqq1.js +2 -0
- package/dist/site/assets/ishikawaDiagram-M35NCXHK-DcnRwsO0.js +70 -0
- package/dist/site/assets/journeyDiagram-OPLOXDXO-CMZGp8mG.js +139 -0
- package/dist/site/assets/kanban-definition-BZKZHSQY-C9vGS-EW.js +89 -0
- package/dist/site/assets/katex-DLSO0Xi6.js +257 -0
- package/dist/site/assets/mindmap-definition-I2QAS2VK-R2SGME7R.js +98 -0
- package/dist/site/assets/mobile-cabinet-BUr9vtlo.avif +0 -0
- package/dist/site/assets/mobile-cabinet-sm-pauJUfRH.avif +0 -0
- package/dist/site/assets/mobile-paper-DF0CuLes.avif +0 -0
- package/dist/site/assets/mobile-paper-sm-77eJHX6h.avif +0 -0
- package/dist/site/assets/open-nWGD2hyb.glb +0 -0
- package/dist/site/assets/pegDiagram-FD4XPPHP-eDMY4Hpd.js +1 -0
- package/dist/site/assets/pieDiagram-J4AKIIQI-DoHNiqwi.js +39 -0
- package/dist/site/assets/quadrantDiagram-XTYBLID2-Bz5idec8.js +7 -0
- package/dist/site/assets/railroadDiagram-MRQ6NCDL-DHJisW8P.js +1 -0
- package/dist/site/assets/requirementDiagram-Y7LWUY3S-5aETRIZz.js +84 -0
- package/dist/site/assets/resting-amber-BSjsErIg.avif +0 -0
- package/dist/site/assets/resting-black-DDQ4XMJI.avif +0 -0
- package/dist/site/assets/resting-blue-DDOT8IQ8.avif +0 -0
- package/dist/site/assets/resting-green-DkRrV8eX.avif +0 -0
- package/dist/site/assets/resting-ivory-CEqoG5yI.avif +0 -0
- package/dist/site/assets/resting-plum-B-8tkSmP.avif +0 -0
- package/dist/site/assets/resting-red-D0hLpMpz.avif +0 -0
- package/dist/site/assets/resting-slate-CH8Z_Rky.avif +0 -0
- package/dist/site/assets/resting-teal-CGt6jFmT.avif +0 -0
- package/dist/site/assets/resting-walnut-t3WgHgUO.avif +0 -0
- package/dist/site/assets/sankeyDiagram-WGJFYUXA-C7O4v9rg.js +40 -0
- package/dist/site/assets/search-stage-B8cH1AE_.avif +0 -0
- package/dist/site/assets/search-stage-mobile-BZ58ew4F.avif +0 -0
- package/dist/site/assets/sequenceDiagram-5NDRBG5M-D4sVU6s6.js +169 -0
- package/dist/site/assets/sizeCapture-INFHLROL-Bi2DkFS3.js +1 -0
- package/dist/site/assets/stateDiagram-v2-FJ4FJNEA-WqXK7YOd.js +291 -0
- package/dist/site/assets/swimlanes-UMQ2AFYF-Czo9WyoV.js +1 -0
- package/dist/site/assets/swimlanesDiagram-OMPLPG4O-BH5aEx0X.js +8 -0
- package/dist/site/assets/three-core-Dkab0Vtn.js +40 -0
- package/dist/site/assets/timeline-definition-SEUHKTQE-KGKDZW_q.js +120 -0
- package/dist/site/assets/usecaseDiagram-AFA6YXN4-S0_9S22K.js +370 -0
- package/dist/site/assets/vennDiagram-NNMJR3RB-DJOjLlbA.js +34 -0
- package/dist/site/assets/wardleyDiagram-S7YFUSEH-BnzYzY-n.js +78 -0
- package/dist/site/assets/xychartDiagram-GGNKY7IX-CKOVznoa.js +7 -0
- package/dist/site/index.html +14 -0
- package/dist/types/index.d.ts +163 -0
- package/package.json +27 -11
- package/dist/grimoire3d.js +0 -54501
- package/dist/grimoire3d.umd.cjs +0 -4212
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const ur="182",dr=0,pr=1,fr=2,mr=1,yr=2,gr=3,xr=0,br=1,Mr=2,_r=0,wr=1,Sr=2,Ar=3,Tr=4,Fr=5,Cr=100,zr=101,Br=102,vr=103,kr=104,Rr=200,Ir=201,Er=202,Nr=203,Dr=204,Pr=205,Or=206,Vr=207,Lr=208,Ur=209,Wr=210,Gr=211,jr=212,qr=213,Xr=214,Jr=0,Yr=1,Hr=2,Zr=3,$r=4,Qr=5,Kr=6,ta=7,ea=0,ia=1,sa=2,na=0,ra=1,aa=2,oa=3,ha=4,la=5,ca=6,ua=7,Di="attached",Es="detached";const da=301,pa=302,fa=303,ma=304,ya=306,ga=1e3,xa=1001,ba=1002,Ma=1003,_a=1004,wa=1005,Sa=1006,Aa=1007,Ta=1008,Fa=1009,Ca=1010,za=1011,Ba=1012,va=1013,ka=1014,Ra=1015,Ia=1016,Ea=1017,Na=1018,Da=1020,Pa=35902,Oa=35899,Va=1021,La=1022,Ua=1023,Wa=1026,Ga=1027,ja=1028,qa=1029,Xa=1030,Ja=1031,Ya=1033,Ha=33776,Za=33777,$a=33778,Qa=33779,Ka=35840,to=35841,eo=35842,io=35843,so=36196,no=37492,ro=37496,ao=37488,oo=37489,ho=37490,lo=37491,co=37808,uo=37809,po=37810,fo=37811,mo=37812,yo=37813,go=37814,xo=37815,bo=37816,Mo=37817,_o=37818,wo=37819,So=37820,Ao=37821,To=36492,Fo=36494,Co=36495,zo=36283,Bo=36284,vo=36285,ko=36286,Ro=2300,Io=2301;const Eo=0,No=1,Do=2;const Po=0,Oo=1,Vo="",et="srgb",Pi="srgb-linear",Oi="linear",ei="srgb";const Lo=512,Uo=513,Wo=514,Go=515,jo=516,qo=517,Xo=518,Jo=519;const Yo="300 es",Ho=2e3;function Ns(c){for(let t=c.length-1;t>=0;--t)if(c[t]>=65535)return!0;return!1}function Ds(c){return ArrayBuffer.isView(c)&&!(c instanceof DataView)}function je(c){return document.createElementNS("http://www.w3.org/1999/xhtml",c)}function Zo(){const c=je("canvas");return c.style.display="block",c}const Vi={};function Li(...c){const t="THREE."+c.shift();console.log(t,...c)}function B(...c){const t="THREE."+c.shift();console.warn(t,...c)}function k(...c){const t="THREE."+c.shift();console.error(t,...c)}function Ui(...c){const t=c.join(" ");t in Vi||(Vi[t]=!0,B(...c))}function $o(c,t,e){return new Promise(function(i,s){function n(){switch(c.clientWaitSync(t,c.SYNC_FLUSH_COMMANDS_BIT,0)){case c.WAIT_FAILED:s();break;case c.TIMEOUT_EXPIRED:setTimeout(n,e);break;default:i()}}setTimeout(n,e)})}class ye{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[t]===void 0&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)}hasEventListener(t,e){const i=this._listeners;return i===void 0?!1:i[t]!==void 0&&i[t].indexOf(e)!==-1}removeEventListener(t,e){const i=this._listeners;if(i===void 0)return;const s=i[t];if(s!==void 0){const n=s.indexOf(e);n!==-1&&s.splice(n,1)}}dispatchEvent(t){const e=this._listeners;if(e===void 0)return;const i=e[t.type];if(i!==void 0){t.target=this;const s=i.slice(0);for(let n=0,r=s.length;n<r;n++)s[n].call(this,t);t.target=null}}}const W=["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 Wi=1234567;const pe=Math.PI/180,me=180/Math.PI;function nt(){const c=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(W[c&255]+W[c>>8&255]+W[c>>16&255]+W[c>>24&255]+"-"+W[t&255]+W[t>>8&255]+"-"+W[t>>16&15|64]+W[t>>24&255]+"-"+W[e&63|128]+W[e>>8&255]+"-"+W[e>>16&255]+W[e>>24&255]+W[i&255]+W[i>>8&255]+W[i>>16&255]+W[i>>24&255]).toLowerCase()}function F(c,t,e){return Math.max(t,Math.min(e,c))}function Bi(c,t){return(c%t+t)%t}function Ps(c,t,e,i,s){return i+(c-t)*(s-i)/(e-t)}function Os(c,t,e){return c!==t?(e-c)/(t-c):0}function fe(c,t,e){return(1-e)*c+e*t}function Vs(c,t,e,i){return fe(c,t,1-Math.exp(-e*i))}function Ls(c,t=1){return t-Math.abs(Bi(c,t*2)-t)}function Us(c,t,e){return c<=t?0:c>=e?1:(c=(c-t)/(e-t),c*c*(3-2*c))}function Ws(c,t,e){return c<=t?0:c>=e?1:(c=(c-t)/(e-t),c*c*c*(c*(c*6-15)+10))}function Gs(c,t){return c+Math.floor(Math.random()*(t-c+1))}function js(c,t){return c+Math.random()*(t-c)}function qs(c){return c*(.5-Math.random())}function Xs(c){c!==void 0&&(Wi=c);let t=Wi+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Js(c){return c*pe}function Ys(c){return c*me}function Hs(c){return(c&c-1)===0&&c!==0}function Zs(c){return Math.pow(2,Math.ceil(Math.log(c)/Math.LN2))}function $s(c){return Math.pow(2,Math.floor(Math.log(c)/Math.LN2))}function Qs(c,t,e,i,s){const n=Math.cos,r=Math.sin,a=n(e/2),h=r(e/2),o=n((t+i)/2),l=r((t+i)/2),u=n((t-i)/2),d=r((t-i)/2),p=n((i-t)/2),f=r((i-t)/2);switch(s){case"XYX":c.set(a*l,h*u,h*d,a*o);break;case"YZY":c.set(h*d,a*l,h*u,a*o);break;case"ZXZ":c.set(h*u,h*d,a*l,a*o);break;case"XZX":c.set(a*l,h*f,h*p,a*o);break;case"YXY":c.set(h*p,a*l,h*f,a*o);break;case"ZYZ":c.set(h*f,h*p,a*l,a*o);break;default:B("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function it(c,t){switch(t.constructor){case Float32Array:return c;case Uint32Array:return c/4294967295;case Uint16Array:return c/65535;case Uint8Array:return c/255;case Int32Array:return Math.max(c/2147483647,-1);case Int16Array:return Math.max(c/32767,-1);case Int8Array:return Math.max(c/127,-1);default:throw new Error("Invalid component type.")}}function z(c,t){switch(t.constructor){case Float32Array:return c;case Uint32Array:return Math.round(c*4294967295);case Uint16Array:return Math.round(c*65535);case Uint8Array:return Math.round(c*255);case Int32Array:return Math.round(c*2147483647);case Int16Array:return Math.round(c*32767);case Int8Array:return Math.round(c*127);default:throw new Error("Invalid component type.")}}const Qo={DEG2RAD:pe,RAD2DEG:me,generateUUID:nt,clamp:F,euclideanModulo:Bi,mapLinear:Ps,inverseLerp:Os,lerp:fe,damp:Vs,pingpong:Ls,smoothstep:Us,smootherstep:Ws,randInt:Gs,randFloat:js,randFloatSpread:qs,seededRandom:Xs,degToRad:Js,radToDeg:Ys,isPowerOfTwo:Hs,ceilPowerOfTwo:Zs,floorPowerOfTwo:$s,setQuaternionFromProperEuler:Qs,normalize:z,denormalize:it};class V{constructor(t=0,e=0){V.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,i=this.y,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[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=F(this.x,t.x,e.x),this.y=F(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=F(this.x,t,e),this.y=F(this.y,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(F(i,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(e===0)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(F(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}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,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,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 i=Math.cos(e),s=Math.sin(e),n=this.x-t.x,r=this.y-t.y;return this.x=n*i-r*s+t.x,this.y=n*s+r*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class se{constructor(t=0,e=0,i=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=s}static slerpFlat(t,e,i,s,n,r,a){let h=i[s+0],o=i[s+1],l=i[s+2],u=i[s+3],d=n[r+0],p=n[r+1],f=n[r+2],m=n[r+3];if(a<=0){t[e+0]=h,t[e+1]=o,t[e+2]=l,t[e+3]=u;return}if(a>=1){t[e+0]=d,t[e+1]=p,t[e+2]=f,t[e+3]=m;return}if(u!==m||h!==d||o!==p||l!==f){let g=h*d+o*p+l*f+u*m;g<0&&(d=-d,p=-p,f=-f,m=-m,g=-g);let y=1-a;if(g<.9995){const b=Math.acos(g),M=Math.sin(b);y=Math.sin(y*b)/M,a=Math.sin(a*b)/M,h=h*y+d*a,o=o*y+p*a,l=l*y+f*a,u=u*y+m*a}else{h=h*y+d*a,o=o*y+p*a,l=l*y+f*a,u=u*y+m*a;const b=1/Math.sqrt(h*h+o*o+l*l+u*u);h*=b,o*=b,l*=b,u*=b}}t[e]=h,t[e+1]=o,t[e+2]=l,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,s,n,r){const a=i[s],h=i[s+1],o=i[s+2],l=i[s+3],u=n[r],d=n[r+1],p=n[r+2],f=n[r+3];return t[e]=a*f+l*u+h*p-o*d,t[e+1]=h*f+l*d+o*u-a*p,t[e+2]=o*f+l*p+a*d-h*u,t[e+3]=l*f-a*u-h*d-o*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,i,s){return this._x=t,this._y=e,this._z=i,this._w=s,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 i=t._x,s=t._y,n=t._z,r=t._order,a=Math.cos,h=Math.sin,o=a(i/2),l=a(s/2),u=a(n/2),d=h(i/2),p=h(s/2),f=h(n/2);switch(r){case"XYZ":this._x=d*l*u+o*p*f,this._y=o*p*u-d*l*f,this._z=o*l*f+d*p*u,this._w=o*l*u-d*p*f;break;case"YXZ":this._x=d*l*u+o*p*f,this._y=o*p*u-d*l*f,this._z=o*l*f-d*p*u,this._w=o*l*u+d*p*f;break;case"ZXY":this._x=d*l*u-o*p*f,this._y=o*p*u+d*l*f,this._z=o*l*f+d*p*u,this._w=o*l*u-d*p*f;break;case"ZYX":this._x=d*l*u-o*p*f,this._y=o*p*u+d*l*f,this._z=o*l*f-d*p*u,this._w=o*l*u+d*p*f;break;case"YZX":this._x=d*l*u+o*p*f,this._y=o*p*u+d*l*f,this._z=o*l*f-d*p*u,this._w=o*l*u-d*p*f;break;case"XZY":this._x=d*l*u-o*p*f,this._y=o*p*u-d*l*f,this._z=o*l*f+d*p*u,this._w=o*l*u+d*p*f;break;default:B("Quaternion: .setFromEuler() encountered an unknown order: "+r)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,s=Math.sin(i);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],s=e[4],n=e[8],r=e[1],a=e[5],h=e[9],o=e[2],l=e[6],u=e[10],d=i+a+u;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(l-h)*p,this._y=(n-o)*p,this._z=(r-s)*p}else if(i>a&&i>u){const p=2*Math.sqrt(1+i-a-u);this._w=(l-h)/p,this._x=.25*p,this._y=(s+r)/p,this._z=(n+o)/p}else if(a>u){const p=2*Math.sqrt(1+a-i-u);this._w=(n-o)/p,this._x=(s+r)/p,this._y=.25*p,this._z=(h+l)/p}else{const p=2*Math.sqrt(1+u-i-a);this._w=(r-s)/p,this._x=(n+o)/p,this._y=(h+l)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(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=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(F(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(i===0)return this;const s=Math.min(1,e/i);return this.slerp(t,s),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 t===0?(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 i=t._x,s=t._y,n=t._z,r=t._w,a=e._x,h=e._y,o=e._z,l=e._w;return this._x=i*l+r*a+s*o-n*h,this._y=s*l+r*h+n*a-i*o,this._z=n*l+r*o+i*h-s*a,this._w=r*l-i*a-s*h-n*o,this._onChangeCallback(),this}slerp(t,e){if(e<=0)return this;if(e>=1)return this.copy(t);let i=t._x,s=t._y,n=t._z,r=t._w,a=this.dot(t);a<0&&(i=-i,s=-s,n=-n,r=-r,a=-a);let h=1-e;if(a<.9995){const o=Math.acos(a),l=Math.sin(o);h=Math.sin(h*o)/l,e=Math.sin(e*o)/l,this._x=this._x*h+i*e,this._y=this._y*h+s*e,this._z=this._z*h+n*e,this._w=this._w*h+r*e,this._onChangeCallback()}else this._x=this._x*h+i*e,this._y=this._y*h+s*e,this._z=this._z*h+n*e,this._w=this._w*h+r*e,this.normalize();return this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),n=Math.sqrt(i);return this.set(s*Math.sin(t),s*Math.cos(t),n*Math.sin(e),n*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 x{constructor(t=0,e=0,i=0){x.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,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(Gi.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Gi.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,s=this.z,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6]*s,this.y=n[1]*e+n[4]*i+n[7]*s,this.z=n[2]*e+n[5]*i+n[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,s=this.z,n=t.elements,r=1/(n[3]*e+n[7]*i+n[11]*s+n[15]);return this.x=(n[0]*e+n[4]*i+n[8]*s+n[12])*r,this.y=(n[1]*e+n[5]*i+n[9]*s+n[13])*r,this.z=(n[2]*e+n[6]*i+n[10]*s+n[14])*r,this}applyQuaternion(t){const e=this.x,i=this.y,s=this.z,n=t.x,r=t.y,a=t.z,h=t.w,o=2*(r*s-a*i),l=2*(a*e-n*s),u=2*(n*i-r*e);return this.x=e+h*o+r*u-a*l,this.y=i+h*l+a*o-n*u,this.z=s+h*u+n*l-r*o,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,i=this.y,s=this.z,n=t.elements;return this.x=n[0]*e+n[4]*i+n[8]*s,this.y=n[1]*e+n[5]*i+n[9]*s,this.z=n[2]*e+n[6]*i+n[10]*s,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=F(this.x,t.x,e.x),this.y=F(this.y,t.y,e.y),this.z=F(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=F(this.x,t,e),this.y=F(this.y,t,e),this.z=F(this.z,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(F(i,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,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,s=t.y,n=t.z,r=e.x,a=e.y,h=e.z;return this.x=s*h-n*a,this.y=n*r-i*h,this.z=i*a-s*r,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return ii.copy(this).projectOnVector(t),this.sub(ii)}reflect(t){return this.sub(ii.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(F(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return e*e+i*i+s*s}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,i){const s=Math.sin(e)*t;return this.x=s*Math.sin(i),this.y=Math.cos(e)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,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(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}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=Math.random()*2-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const ii=new x,Gi=new se;class Mt{constructor(t,e,i,s,n,r,a,h,o){Mt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,i,s,n,r,a,h,o)}set(t,e,i,s,n,r,a,h,o){const l=this.elements;return l[0]=t,l[1]=s,l[2]=a,l[3]=e,l[4]=n,l[5]=h,l[6]=i,l[7]=r,l[8]=o,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.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 i=t.elements,s=e.elements,n=this.elements,r=i[0],a=i[3],h=i[6],o=i[1],l=i[4],u=i[7],d=i[2],p=i[5],f=i[8],m=s[0],g=s[3],y=s[6],b=s[1],M=s[4],_=s[7],w=s[2],T=s[5],S=s[8];return n[0]=r*m+a*b+h*w,n[3]=r*g+a*M+h*T,n[6]=r*y+a*_+h*S,n[1]=o*m+l*b+u*w,n[4]=o*g+l*M+u*T,n[7]=o*y+l*_+u*S,n[2]=d*m+p*b+f*w,n[5]=d*g+p*M+f*T,n[8]=d*y+p*_+f*S,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],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],h=t[6],o=t[7],l=t[8];return e*r*l-e*a*o-i*n*l+i*a*h+s*n*o-s*r*h}invert(){const t=this.elements,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],h=t[6],o=t[7],l=t[8],u=l*r-a*o,d=a*h-l*n,p=o*n-r*h,f=e*u+i*d+s*p;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/f;return t[0]=u*m,t[1]=(s*o-l*i)*m,t[2]=(a*i-s*r)*m,t[3]=d*m,t[4]=(l*e-s*h)*m,t[5]=(s*n-a*e)*m,t[6]=p*m,t[7]=(i*h-o*e)*m,t[8]=(r*e-i*n)*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,i,s,n,r,a){const h=Math.cos(n),o=Math.sin(n);return this.set(i*h,i*o,-i*(h*r+o*a)+r+t,-s*o,s*h,-s*(-o*r+h*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(si.makeScale(t,e)),this}rotate(t){return this.premultiply(si.makeRotation(-t)),this}translate(t,e){return this.premultiply(si.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),i=Math.sin(t);return this.set(e,-i,0,i,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,i=t.elements;for(let s=0;s<9;s++)if(e[s]!==i[s])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}}const si=new Mt,ji=new Mt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),qi=new Mt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Ks(){const c={enabled:!0,workingColorSpace:Pi,spaces:{},convert:function(s,n,r){return this.enabled===!1||n===r||!n||!r||(this.spaces[n].transfer===ei&&(s.r=xt(s.r),s.g=xt(s.g),s.b=xt(s.b)),this.spaces[n].primaries!==this.spaces[r].primaries&&(s.applyMatrix3(this.spaces[n].toXYZ),s.applyMatrix3(this.spaces[r].fromXYZ)),this.spaces[r].transfer===ei&&(s.r=ie(s.r),s.g=ie(s.g),s.b=ie(s.b))),s},workingToColorSpace:function(s,n){return this.convert(s,this.workingColorSpace,n)},colorSpaceToWorking:function(s,n){return this.convert(s,n,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===""?Oi:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(s,n=this.workingColorSpace){return s.fromArray(this.spaces[n].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,n,r){return s.copy(this.spaces[n].toXYZ).multiply(this.spaces[r].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,n){return Ui("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),c.workingToColorSpace(s,n)},toWorkingColorSpace:function(s,n){return Ui("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),c.colorSpaceToWorking(s,n)}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],i=[.3127,.329];return c.define({[Pi]:{primaries:t,whitePoint:i,transfer:Oi,toXYZ:ji,fromXYZ:qi,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:et},outputColorSpaceConfig:{drawingBufferColorSpace:et}},[et]:{primaries:t,whitePoint:i,transfer:ei,toXYZ:ji,fromXYZ:qi,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:et}}}),c}const $=Ks();function xt(c){return c<.04045?c*.0773993808:Math.pow(c*.9478672986+.0521327014,2.4)}function ie(c){return c<.0031308?c*12.92:1.055*Math.pow(c,.41666)-.055}let Ut;class tn{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{Ut===void 0&&(Ut=je("canvas")),Ut.width=t.width,Ut.height=t.height;const s=Ut.getContext("2d");t instanceof ImageData?s.putImageData(t,0,0):s.drawImage(t,0,0,t.width,t.height),i=Ut}return i.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const e=je("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const s=i.getImageData(0,0,t.width,t.height),n=s.data;for(let r=0;r<n.length;r++)n[r]=xt(n[r]/255)*255;return i.putImageData(s,0,0),e}else if(t.data){const e=t.data.slice(0);for(let i=0;i<e.length;i++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[i]=Math.floor(xt(e[i]/255)*255):e[i]=xt(e[i]);return{data:e,width:t.width,height:t.height}}else return B("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let en=0;class vi{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:en++}),this.uuid=nt(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){const e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?t.set(e.displayHeight,e.displayWidth,0):e!==null?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];const i={uuid:this.uuid,url:""},s=this.data;if(s!==null){let n;if(Array.isArray(s)){n=[];for(let r=0,a=s.length;r<a;r++)s[r].isDataTexture?n.push(ni(s[r].image)):n.push(ni(s[r]))}else n=ni(s);i.url=n}return e||(t.images[this.uuid]=i),i}}function ni(c){return typeof HTMLImageElement<"u"&&c instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&c instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&c instanceof ImageBitmap?tn.getDataURL(c):c.data?{data:Array.from(c.data),width:c.width,height:c.height,type:c.data.constructor.name}:(B("Texture: Unable to serialize Texture."),{})}let sn=0;const ri=new x;class j extends ye{constructor(t=j.DEFAULT_IMAGE,e=j.DEFAULT_MAPPING,i=1001,s=1001,n=1006,r=1008,a=1023,h=1009,o=j.DEFAULT_ANISOTROPY,l=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:sn++}),this.uuid=nt(),this.name="",this.source=new vi(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=n,this.minFilter=r,this.anisotropy=o,this.format=a,this.internalFormat=null,this.type=h,this.offset=new V(0,0),this.repeat=new V(1,1),this.center=new V(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Mt,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(ri).x}get height(){return this.source.getSize(ri).y}get depth(){return this.source.getSize(ri).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 i=t[e];if(i===void 0){B(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}const s=this[e];if(s===void 0){B(`Texture.setValues(): property '${e}' does not exist.`);continue}s&&i&&s.isVector2&&i.isVector2||s&&i&&s.isVector3&&i.isVector3||s&&i&&s.isMatrix3&&i.isMatrix3?s.copy(i):this[e]=i}}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];const i={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&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==300)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}j.DEFAULT_IMAGE=null;j.DEFAULT_MAPPING=300;j.DEFAULT_ANISOTROPY=1;class rt{constructor(t=0,e=0,i=0,s=1){rt.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=s}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,i,s){return this.x=t,this.y=e,this.z=i,this.w=s,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=t.w!==void 0?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,i=this.y,s=this.z,n=this.w,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*s+r[12]*n,this.y=r[1]*e+r[5]*i+r[9]*s+r[13]*n,this.z=r[2]*e+r[6]*i+r[10]*s+r[14]*n,this.w=r[3]*e+r[7]*i+r[11]*s+r[15]*n,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,i,s,n;const h=t.elements,o=h[0],l=h[4],u=h[8],d=h[1],p=h[5],f=h[9],m=h[2],g=h[6],y=h[10];if(Math.abs(l-d)<.01&&Math.abs(u-m)<.01&&Math.abs(f-g)<.01){if(Math.abs(l+d)<.1&&Math.abs(u+m)<.1&&Math.abs(f+g)<.1&&Math.abs(o+p+y-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const M=(o+1)/2,_=(p+1)/2,w=(y+1)/2,T=(l+d)/4,S=(u+m)/4,A=(f+g)/4;return M>_&&M>w?M<.01?(i=0,s=.707106781,n=.707106781):(i=Math.sqrt(M),s=T/i,n=S/i):_>w?_<.01?(i=.707106781,s=0,n=.707106781):(s=Math.sqrt(_),i=T/s,n=A/s):w<.01?(i=.707106781,s=.707106781,n=0):(n=Math.sqrt(w),i=S/n,s=A/n),this.set(i,s,n,e),this}let b=Math.sqrt((g-f)*(g-f)+(u-m)*(u-m)+(d-l)*(d-l));return Math.abs(b)<.001&&(b=1),this.x=(g-f)/b,this.y=(u-m)/b,this.z=(d-l)/b,this.w=Math.acos((o+p+y-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=F(this.x,t.x,e.x),this.y=F(this.y,t.y,e.y),this.z=F(this.z,t.z,e.z),this.w=F(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=F(this.x,t,e),this.y=F(this.y,t,e),this.z=F(this.z,t,e),this.w=F(this.w,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(F(i,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,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,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 nn extends ye{constructor(t=1,e=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=i.depth,this.scissor=new rt(0,0,t,e),this.scissorTest=!1,this.viewport=new rt(0,0,t,e);const s={width:t,height:e,depth:i.depth},n=new j(s);this.textures=[];const r=i.count;for(let a=0;a<r;a++)this.textures[a]=n.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(t={}){const e={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};t.mapping!==void 0&&(e.mapping=t.mapping),t.wrapS!==void 0&&(e.wrapS=t.wrapS),t.wrapT!==void 0&&(e.wrapT=t.wrapT),t.wrapR!==void 0&&(e.wrapR=t.wrapR),t.magFilter!==void 0&&(e.magFilter=t.magFilter),t.minFilter!==void 0&&(e.minFilter=t.minFilter),t.format!==void 0&&(e.format=t.format),t.type!==void 0&&(e.type=t.type),t.anisotropy!==void 0&&(e.anisotropy=t.anisotropy),t.colorSpace!==void 0&&(e.colorSpace=t.colorSpace),t.flipY!==void 0&&(e.flipY=t.flipY),t.generateMipmaps!==void 0&&(e.generateMipmaps=t.generateMipmaps),t.internalFormat!==void 0&&(e.internalFormat=t.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(e)}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),t!==null&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let s=0,n=this.textures.length;s<n;s++)this.textures[s].image.width=t,this.textures[s].image.height=e,this.textures[s].image.depth=i,this.textures[s].isData3DTexture!==!0&&(this.textures[s].isArrayTexture=this.textures[s].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,i=t.textures.length;e<i;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 vi(s)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class rn extends nn{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}}class Ko extends j{constructor(t=null,e=1,i=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:s},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class th extends j{constructor(t=null,e=1,i=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:s},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class kt{constructor(t=new x(1/0,1/0,1/0),e=new x(-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,i=t.length;e<i;e+=3)this.expandByPoint(Q.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(Q.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Q.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),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 i=t.geometry;if(i!==void 0){const n=i.getAttribute("position");if(e===!0&&n!==void 0&&t.isInstancedMesh!==!0)for(let r=0,a=n.count;r<a;r++)t.isMesh===!0?t.getVertexPosition(r,Q):Q.fromBufferAttribute(n,r),Q.applyMatrix4(t.matrixWorld),this.expandByPoint(Q);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),be.copy(t.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),be.copy(i.boundingBox)),be.applyMatrix4(t.matrixWorld),this.union(be)}const s=t.children;for(let n=0,r=s.length;n<r;n++)this.expandByObject(s[n],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,Q),Q.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(ae),Me.subVectors(this.max,ae),Wt.subVectors(t.a,ae),Gt.subVectors(t.b,ae),jt.subVectors(t.c,ae),St.subVectors(Gt,Wt),At.subVectors(jt,Gt),It.subVectors(Wt,jt);let e=[0,-St.z,St.y,0,-At.z,At.y,0,-It.z,It.y,St.z,0,-St.x,At.z,0,-At.x,It.z,0,-It.x,-St.y,St.x,0,-At.y,At.x,0,-It.y,It.x,0];return!ai(e,Wt,Gt,jt,Me)||(e=[1,0,0,0,1,0,0,0,1],!ai(e,Wt,Gt,jt,Me))?!1:(_e.crossVectors(St,At),e=[_e.x,_e.y,_e.z],ai(e,Wt,Gt,jt,Me))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Q).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Q).length()*.5),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()?this:(ct[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ct[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ct[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ct[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ct[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ct[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ct[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ct[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ct),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 ct=[new x,new x,new x,new x,new x,new x,new x,new x],Q=new x,be=new kt,Wt=new x,Gt=new x,jt=new x,St=new x,At=new x,It=new x,ae=new x,Me=new x,_e=new x,Et=new x;function ai(c,t,e,i,s){for(let n=0,r=c.length-3;n<=r;n+=3){Et.fromArray(c,n);const a=s.x*Math.abs(Et.x)+s.y*Math.abs(Et.y)+s.z*Math.abs(Et.z),h=t.dot(Et),o=e.dot(Et),l=i.dot(Et);if(Math.max(-Math.max(h,o,l),Math.min(h,o,l))>a)return!1}return!0}const an=new kt,oe=new x,oi=new x;class _t{constructor(t=new x,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 i=this.center;e!==void 0?i.copy(e):an.setFromPoints(t).getCenter(i);let s=0;for(let n=0,r=t.length;n<r;n++)s=Math.max(s,i.distanceToSquared(t[n]));return this.radius=Math.sqrt(s),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 i=this.center.distanceToSquared(t);return e.copy(t),i>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;oe.subVectors(t,this.center);const e=oe.lengthSq();if(e>this.radius*this.radius){const i=Math.sqrt(e),s=(i-this.radius)*.5;this.center.addScaledVector(oe,s/i),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(oi.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(oe.copy(t.center).add(oi)),this.expandByPoint(oe.copy(t.center).sub(oi))),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 ut=new x,hi=new x,we=new x,Tt=new x,li=new x,Se=new x,ci=new x;class He{constructor(t=new x,e=new x(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,ut)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=ut.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ut.copy(this.origin).addScaledVector(this.direction,e),ut.distanceToSquared(t))}distanceSqToSegment(t,e,i,s){hi.copy(t).add(e).multiplyScalar(.5),we.copy(e).sub(t).normalize(),Tt.copy(this.origin).sub(hi);const n=t.distanceTo(e)*.5,r=-this.direction.dot(we),a=Tt.dot(this.direction),h=-Tt.dot(we),o=Tt.lengthSq(),l=Math.abs(1-r*r);let u,d,p,f;if(l>0)if(u=r*h-a,d=r*a-h,f=n*l,u>=0)if(d>=-f)if(d<=f){const m=1/l;u*=m,d*=m,p=u*(u+r*d+2*a)+d*(r*u+d+2*h)+o}else d=n,u=Math.max(0,-(r*d+a)),p=-u*u+d*(d+2*h)+o;else d=-n,u=Math.max(0,-(r*d+a)),p=-u*u+d*(d+2*h)+o;else d<=-f?(u=Math.max(0,-(-r*n+a)),d=u>0?-n:Math.min(Math.max(-n,-h),n),p=-u*u+d*(d+2*h)+o):d<=f?(u=0,d=Math.min(Math.max(-n,-h),n),p=d*(d+2*h)+o):(u=Math.max(0,-(r*n+a)),d=u>0?n:Math.min(Math.max(-n,-h),n),p=-u*u+d*(d+2*h)+o);else d=r>0?-n:n,u=Math.max(0,-(r*d+a)),p=-u*u+d*(d+2*h)+o;return i&&i.copy(this.origin).addScaledVector(this.direction,u),s&&s.copy(hi).addScaledVector(we,d),p}intersectSphere(t,e){ut.subVectors(t.center,this.origin);const i=ut.dot(this.direction),s=ut.dot(ut)-i*i,n=t.radius*t.radius;if(s>n)return null;const r=Math.sqrt(n-s),a=i-r,h=i+r;return h<0?null:a<0?this.at(h,e):this.at(a,e)}intersectsSphere(t){return t.radius<0?!1:this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return i===null?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,s,n,r,a,h;const o=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return o>=0?(i=(t.min.x-d.x)*o,s=(t.max.x-d.x)*o):(i=(t.max.x-d.x)*o,s=(t.min.x-d.x)*o),l>=0?(n=(t.min.y-d.y)*l,r=(t.max.y-d.y)*l):(n=(t.max.y-d.y)*l,r=(t.min.y-d.y)*l),i>r||n>s||((n>i||isNaN(i))&&(i=n),(r<s||isNaN(s))&&(s=r),u>=0?(a=(t.min.z-d.z)*u,h=(t.max.z-d.z)*u):(a=(t.max.z-d.z)*u,h=(t.min.z-d.z)*u),i>h||a>s)||((a>i||i!==i)&&(i=a),(h<s||s!==s)&&(s=h),s<0)?null:this.at(i>=0?i:s,e)}intersectsBox(t){return this.intersectBox(t,ut)!==null}intersectTriangle(t,e,i,s,n){li.subVectors(e,t),Se.subVectors(i,t),ci.crossVectors(li,Se);let r=this.direction.dot(ci),a;if(r>0){if(s)return null;a=1}else if(r<0)a=-1,r=-r;else return null;Tt.subVectors(this.origin,t);const h=a*this.direction.dot(Se.crossVectors(Tt,Se));if(h<0)return null;const o=a*this.direction.dot(li.cross(Tt));if(o<0||h+o>r)return null;const l=-a*Tt.dot(ci);return l<0?null:this.at(l/r,n)}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 C{constructor(t,e,i,s,n,r,a,h,o,l,u,d,p,f,m,g){C.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,i,s,n,r,a,h,o,l,u,d,p,f,m,g)}set(t,e,i,s,n,r,a,h,o,l,u,d,p,f,m,g){const y=this.elements;return y[0]=t,y[4]=e,y[8]=i,y[12]=s,y[1]=n,y[5]=r,y[9]=a,y[13]=h,y[2]=o,y[6]=l,y[10]=u,y[14]=d,y[3]=p,y[7]=f,y[11]=m,y[15]=g,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 C().fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[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,i){return this.determinant()===0?(t.set(1,0,0),e.set(0,1,0),i.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){if(t.determinant()===0)return this.identity();const e=this.elements,i=t.elements,s=1/qt.setFromMatrixColumn(t,0).length(),n=1/qt.setFromMatrixColumn(t,1).length(),r=1/qt.setFromMatrixColumn(t,2).length();return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=0,e[4]=i[4]*n,e[5]=i[5]*n,e[6]=i[6]*n,e[7]=0,e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,s=t.y,n=t.z,r=Math.cos(i),a=Math.sin(i),h=Math.cos(s),o=Math.sin(s),l=Math.cos(n),u=Math.sin(n);if(t.order==="XYZ"){const d=r*l,p=r*u,f=a*l,m=a*u;e[0]=h*l,e[4]=-h*u,e[8]=o,e[1]=p+f*o,e[5]=d-m*o,e[9]=-a*h,e[2]=m-d*o,e[6]=f+p*o,e[10]=r*h}else if(t.order==="YXZ"){const d=h*l,p=h*u,f=o*l,m=o*u;e[0]=d+m*a,e[4]=f*a-p,e[8]=r*o,e[1]=r*u,e[5]=r*l,e[9]=-a,e[2]=p*a-f,e[6]=m+d*a,e[10]=r*h}else if(t.order==="ZXY"){const d=h*l,p=h*u,f=o*l,m=o*u;e[0]=d-m*a,e[4]=-r*u,e[8]=f+p*a,e[1]=p+f*a,e[5]=r*l,e[9]=m-d*a,e[2]=-r*o,e[6]=a,e[10]=r*h}else if(t.order==="ZYX"){const d=r*l,p=r*u,f=a*l,m=a*u;e[0]=h*l,e[4]=f*o-p,e[8]=d*o+m,e[1]=h*u,e[5]=m*o+d,e[9]=p*o-f,e[2]=-o,e[6]=a*h,e[10]=r*h}else if(t.order==="YZX"){const d=r*h,p=r*o,f=a*h,m=a*o;e[0]=h*l,e[4]=m-d*u,e[8]=f*u+p,e[1]=u,e[5]=r*l,e[9]=-a*l,e[2]=-o*l,e[6]=p*u+f,e[10]=d-m*u}else if(t.order==="XZY"){const d=r*h,p=r*o,f=a*h,m=a*o;e[0]=h*l,e[4]=-u,e[8]=o*l,e[1]=d*u+m,e[5]=r*l,e[9]=p*u-f,e[2]=f*u-p,e[6]=a*l,e[10]=m*u+d}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(on,t,hn)}lookAt(t,e,i){const s=this.elements;return J.subVectors(t,e),J.lengthSq()===0&&(J.z=1),J.normalize(),Ft.crossVectors(i,J),Ft.lengthSq()===0&&(Math.abs(i.z)===1?J.x+=1e-4:J.z+=1e-4,J.normalize(),Ft.crossVectors(i,J)),Ft.normalize(),Ae.crossVectors(J,Ft),s[0]=Ft.x,s[4]=Ae.x,s[8]=J.x,s[1]=Ft.y,s[5]=Ae.y,s[9]=J.y,s[2]=Ft.z,s[6]=Ae.z,s[10]=J.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,s=e.elements,n=this.elements,r=i[0],a=i[4],h=i[8],o=i[12],l=i[1],u=i[5],d=i[9],p=i[13],f=i[2],m=i[6],g=i[10],y=i[14],b=i[3],M=i[7],_=i[11],w=i[15],T=s[0],S=s[4],A=s[8],E=s[12],N=s[1],D=s[5],ot=s[9],P=s[13],ht=s[2],lt=s[6],Vt=s[10],Rt=s[14],wt=s[3],L=s[7],U=s[11],X=s[15];return n[0]=r*T+a*N+h*ht+o*wt,n[4]=r*S+a*D+h*lt+o*L,n[8]=r*A+a*ot+h*Vt+o*U,n[12]=r*E+a*P+h*Rt+o*X,n[1]=l*T+u*N+d*ht+p*wt,n[5]=l*S+u*D+d*lt+p*L,n[9]=l*A+u*ot+d*Vt+p*U,n[13]=l*E+u*P+d*Rt+p*X,n[2]=f*T+m*N+g*ht+y*wt,n[6]=f*S+m*D+g*lt+y*L,n[10]=f*A+m*ot+g*Vt+y*U,n[14]=f*E+m*P+g*Rt+y*X,n[3]=b*T+M*N+_*ht+w*wt,n[7]=b*S+M*D+_*lt+w*L,n[11]=b*A+M*ot+_*Vt+w*U,n[15]=b*E+M*P+_*Rt+w*X,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],i=t[4],s=t[8],n=t[12],r=t[1],a=t[5],h=t[9],o=t[13],l=t[2],u=t[6],d=t[10],p=t[14],f=t[3],m=t[7],g=t[11],y=t[15],b=h*p-o*d,M=a*p-o*u,_=a*d-h*u,w=r*p-o*l,T=r*d-h*l,S=r*u-a*l;return e*(m*b-g*M+y*_)-i*(f*b-g*w+y*T)+s*(f*M-m*w+y*S)-n*(f*_-m*T+g*S)}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,i){const s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],h=t[6],o=t[7],l=t[8],u=t[9],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],y=t[15],b=u*g*o-m*d*o+m*h*p-a*g*p-u*h*y+a*d*y,M=f*d*o-l*g*o-f*h*p+r*g*p+l*h*y-r*d*y,_=l*m*o-f*u*o+f*a*p-r*m*p-l*a*y+r*u*y,w=f*u*h-l*m*h-f*a*d+r*m*d+l*a*g-r*u*g,T=e*b+i*M+s*_+n*w;if(T===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const S=1/T;return t[0]=b*S,t[1]=(m*d*n-u*g*n-m*s*p+i*g*p+u*s*y-i*d*y)*S,t[2]=(a*g*n-m*h*n+m*s*o-i*g*o-a*s*y+i*h*y)*S,t[3]=(u*h*n-a*d*n-u*s*o+i*d*o+a*s*p-i*h*p)*S,t[4]=M*S,t[5]=(l*g*n-f*d*n+f*s*p-e*g*p-l*s*y+e*d*y)*S,t[6]=(f*h*n-r*g*n-f*s*o+e*g*o+r*s*y-e*h*y)*S,t[7]=(r*d*n-l*h*n+l*s*o-e*d*o-r*s*p+e*h*p)*S,t[8]=_*S,t[9]=(f*u*n-l*m*n-f*i*p+e*m*p+l*i*y-e*u*y)*S,t[10]=(r*m*n-f*a*n+f*i*o-e*m*o-r*i*y+e*a*y)*S,t[11]=(l*a*n-r*u*n-l*i*o+e*u*o+r*i*p-e*a*p)*S,t[12]=w*S,t[13]=(l*m*s-f*u*s+f*i*d-e*m*d-l*i*g+e*u*g)*S,t[14]=(f*a*s-r*m*s-f*i*h+e*m*h+r*i*g-e*a*g)*S,t[15]=(r*u*s-l*a*s+l*i*h-e*u*h-r*i*d+e*a*d)*S,this}scale(t){const e=this.elements,i=t.x,s=t.y,n=t.z;return e[0]*=i,e[4]*=s,e[8]*=n,e[1]*=i,e[5]*=s,e[9]*=n,e[2]*=i,e[6]*=s,e[10]*=n,e[3]*=i,e[7]*=s,e[11]*=n,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,s))}makeTranslation(t,e,i){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,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),s=Math.sin(e),n=1-i,r=t.x,a=t.y,h=t.z,o=n*r,l=n*a;return this.set(o*r+i,o*a-s*h,o*h+s*a,0,o*a+s*h,l*a+i,l*h-s*r,0,o*h-s*a,l*h+s*r,n*h*h+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,s,n,r){return this.set(1,i,n,0,t,1,r,0,e,s,1,0,0,0,0,1),this}compose(t,e,i){const s=this.elements,n=e._x,r=e._y,a=e._z,h=e._w,o=n+n,l=r+r,u=a+a,d=n*o,p=n*l,f=n*u,m=r*l,g=r*u,y=a*u,b=h*o,M=h*l,_=h*u,w=i.x,T=i.y,S=i.z;return s[0]=(1-(m+y))*w,s[1]=(p+_)*w,s[2]=(f-M)*w,s[3]=0,s[4]=(p-_)*T,s[5]=(1-(d+y))*T,s[6]=(g+b)*T,s[7]=0,s[8]=(f+M)*S,s[9]=(g-b)*S,s[10]=(1-(d+m))*S,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,i){const s=this.elements;if(t.x=s[12],t.y=s[13],t.z=s[14],this.determinant()===0)return i.set(1,1,1),e.identity(),this;let n=qt.set(s[0],s[1],s[2]).length();const r=qt.set(s[4],s[5],s[6]).length(),a=qt.set(s[8],s[9],s[10]).length();this.determinant()<0&&(n=-n),K.copy(this);const o=1/n,l=1/r,u=1/a;return K.elements[0]*=o,K.elements[1]*=o,K.elements[2]*=o,K.elements[4]*=l,K.elements[5]*=l,K.elements[6]*=l,K.elements[8]*=u,K.elements[9]*=u,K.elements[10]*=u,e.setFromRotationMatrix(K),i.x=n,i.y=r,i.z=a,this}makePerspective(t,e,i,s,n,r,a=2e3,h=!1){const o=this.elements,l=2*n/(e-t),u=2*n/(i-s),d=(e+t)/(e-t),p=(i+s)/(i-s);let f,m;if(h)f=n/(r-n),m=r*n/(r-n);else if(a===2e3)f=-(r+n)/(r-n),m=-2*r*n/(r-n);else if(a===2001)f=-r/(r-n),m=-r*n/(r-n);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return o[0]=l,o[4]=0,o[8]=d,o[12]=0,o[1]=0,o[5]=u,o[9]=p,o[13]=0,o[2]=0,o[6]=0,o[10]=f,o[14]=m,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,i,s,n,r,a=2e3,h=!1){const o=this.elements,l=2/(e-t),u=2/(i-s),d=-(e+t)/(e-t),p=-(i+s)/(i-s);let f,m;if(h)f=1/(r-n),m=r/(r-n);else if(a===2e3)f=-2/(r-n),m=-(r+n)/(r-n);else if(a===2001)f=-1/(r-n),m=-n/(r-n);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return o[0]=l,o[4]=0,o[8]=0,o[12]=d,o[1]=0,o[5]=u,o[9]=0,o[13]=p,o[2]=0,o[6]=0,o[10]=f,o[14]=m,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let s=0;s<16;s++)if(e[s]!==i[s])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}const qt=new x,K=new C,on=new x(0,0,0),hn=new x(1,1,1),Ft=new x,Ae=new x,J=new x,Xi=new C,Ji=new se;class vt{constructor(t=0,e=0,i=0,s=vt.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=s}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,i,s=this._order){return this._x=t,this._y=e,this._z=i,this._order=s,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,i=!0){const s=t.elements,n=s[0],r=s[4],a=s[8],h=s[1],o=s[5],l=s[9],u=s[2],d=s[6],p=s[10];switch(e){case"XYZ":this._y=Math.asin(F(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,p),this._z=Math.atan2(-r,n)):(this._x=Math.atan2(d,o),this._z=0);break;case"YXZ":this._x=Math.asin(-F(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(h,o)):(this._y=Math.atan2(-u,n),this._z=0);break;case"ZXY":this._x=Math.asin(F(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,p),this._z=Math.atan2(-r,o)):(this._y=0,this._z=Math.atan2(h,n));break;case"ZYX":this._y=Math.asin(-F(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(h,n)):(this._x=0,this._z=Math.atan2(-r,o));break;case"YZX":this._z=Math.asin(F(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-l,o),this._y=Math.atan2(-u,n)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-F(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(d,o),this._y=Math.atan2(a,n)):(this._x=Math.atan2(-l,p),this._y=0);break;default:B("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return Xi.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Xi,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Ji.setFromEuler(this),this.setFromQuaternion(Ji,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],t[3]!==void 0&&(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}}vt.DEFAULT_ORDER="XYZ";class ln{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}}let cn=0;const Yi=new x,Xt=new se,dt=new C,Te=new x,he=new x,un=new x,dn=new se,Hi=new x(1,0,0),Zi=new x(0,1,0),$i=new x(0,0,1),Qi={type:"added"},pn={type:"removed"},Jt={type:"childadded",child:null},ui={type:"childremoved",child:null};class R extends ye{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:cn++}),this.uuid=nt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=R.DEFAULT_UP.clone();const t=new x,e=new vt,i=new se,s=new x(1,1,1);function n(){i.setFromEuler(e,!1)}function r(){e.setFromQuaternion(i,void 0,!1)}e._onChange(n),i._onChange(r),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new C},normalMatrix:{value:new Mt}}),this.matrix=new C,this.matrixWorld=new C,this.matrixAutoUpdate=R.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=R.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ln,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 Xt.setFromAxisAngle(t,e),this.quaternion.multiply(Xt),this}rotateOnWorldAxis(t,e){return Xt.setFromAxisAngle(t,e),this.quaternion.premultiply(Xt),this}rotateX(t){return this.rotateOnAxis(Hi,t)}rotateY(t){return this.rotateOnAxis(Zi,t)}rotateZ(t){return this.rotateOnAxis($i,t)}translateOnAxis(t,e){return Yi.copy(t).applyQuaternion(this.quaternion),this.position.add(Yi.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Hi,t)}translateY(t){return this.translateOnAxis(Zi,t)}translateZ(t){return this.translateOnAxis($i,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(dt.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?Te.copy(t):Te.set(t,e,i);const s=this.parent;this.updateWorldMatrix(!0,!1),he.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?dt.lookAt(he,Te,this.up):dt.lookAt(Te,he,this.up),this.quaternion.setFromRotationMatrix(dt),s&&(dt.extractRotation(s.matrixWorld),Xt.setFromRotationMatrix(dt),this.quaternion.premultiply(Xt.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(k("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(Qi),Jt.child=t,this.dispatchEvent(Jt),Jt.child=null):k("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(pn),ui.child=t,this.dispatchEvent(ui),ui.child=null),this}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),dt.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),dt.multiply(t.parent.matrixWorld)),t.applyMatrix4(dt),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Qi),Jt.child=t,this.dispatchEvent(Jt),Jt.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 i=0,s=this.children.length;i<s;i++){const r=this.children[i].getObjectByProperty(t,e);if(r!==void 0)return r}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);const s=this.children;for(let n=0,r=s.length;n<r;n++)s[n].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(he,t,un),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(he,dn,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 i=0,s=e.length;i<s;i++)e[i].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);const e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;e!==null&&(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)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].updateMatrixWorld(t)}updateWorldMatrix(t,e){const i=this.parent;if(t===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){const s=this.children;for(let n=0,r=s.length;n<r;n++)s[n].updateWorldMatrix(!1,!0)}}toJSON(t){const e=t===void 0||typeof t=="string",i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const s={};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(a=>({...a})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(t),s.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(s.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(s.boundingBox=this.boundingBox.toJSON()));function n(a,h){return a[h.uuid]===void 0&&(a[h.uuid]=h.toJSON(t)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=n(t.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const h=a.shapes;if(Array.isArray(h))for(let o=0,l=h.length;o<l;o++){const u=h[o];n(t.shapes,u)}else n(t.shapes,h)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(n(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let h=0,o=this.material.length;h<o;h++)a.push(n(t.materials,this.material[h]));s.material=a}else s.material=n(t.materials,this.material);if(this.children.length>0){s.children=[];for(let a=0;a<this.children.length;a++)s.children.push(this.children[a].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let a=0;a<this.animations.length;a++){const h=this.animations[a];s.animations.push(n(t.animations,h))}}if(e){const a=r(t.geometries),h=r(t.materials),o=r(t.textures),l=r(t.images),u=r(t.shapes),d=r(t.skeletons),p=r(t.animations),f=r(t.nodes);a.length>0&&(i.geometries=a),h.length>0&&(i.materials=h),o.length>0&&(i.textures=o),l.length>0&&(i.images=l),u.length>0&&(i.shapes=u),d.length>0&&(i.skeletons=d),p.length>0&&(i.animations=p),f.length>0&&(i.nodes=f)}return i.object=s,i;function r(a){const h=[];for(const o in a){const l=a[o];delete l.metadata,h.push(l)}return h}}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)),e===!0)for(let i=0;i<t.children.length;i++){const s=t.children[i];this.add(s.clone())}return this}}R.DEFAULT_UP=new x(0,1,0);R.DEFAULT_MATRIX_AUTO_UPDATE=!0;R.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const tt=new x,pt=new x,di=new x,ft=new x,Yt=new x,Ht=new x,Ki=new x,pi=new x,fi=new x,mi=new x,yi=new rt,gi=new rt,xi=new rt;class st{constructor(t=new x,e=new x,i=new x){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,s){s.subVectors(i,e),tt.subVectors(t,e),s.cross(tt);const n=s.lengthSq();return n>0?s.multiplyScalar(1/Math.sqrt(n)):s.set(0,0,0)}static getBarycoord(t,e,i,s,n){tt.subVectors(s,e),pt.subVectors(i,e),di.subVectors(t,e);const r=tt.dot(tt),a=tt.dot(pt),h=tt.dot(di),o=pt.dot(pt),l=pt.dot(di),u=r*o-a*a;if(u===0)return n.set(0,0,0),null;const d=1/u,p=(o*h-a*l)*d,f=(r*l-a*h)*d;return n.set(1-p-f,f,p)}static containsPoint(t,e,i,s){return this.getBarycoord(t,e,i,s,ft)===null?!1:ft.x>=0&&ft.y>=0&&ft.x+ft.y<=1}static getInterpolation(t,e,i,s,n,r,a,h){return this.getBarycoord(t,e,i,s,ft)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(n,ft.x),h.addScaledVector(r,ft.y),h.addScaledVector(a,ft.z),h)}static getInterpolatedAttribute(t,e,i,s,n,r){return yi.setScalar(0),gi.setScalar(0),xi.setScalar(0),yi.fromBufferAttribute(t,e),gi.fromBufferAttribute(t,i),xi.fromBufferAttribute(t,s),r.setScalar(0),r.addScaledVector(yi,n.x),r.addScaledVector(gi,n.y),r.addScaledVector(xi,n.z),r}static isFrontFacing(t,e,i,s){return tt.subVectors(i,e),pt.subVectors(t,e),tt.cross(pt).dot(s)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,s){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,i,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,s),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 tt.subVectors(this.c,this.b),pt.subVectors(this.a,this.b),tt.cross(pt).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return st.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return st.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,s,n){return st.getInterpolation(t,this.a,this.b,this.c,e,i,s,n)}containsPoint(t){return st.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return st.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,s=this.b,n=this.c;let r,a;Yt.subVectors(s,i),Ht.subVectors(n,i),pi.subVectors(t,i);const h=Yt.dot(pi),o=Ht.dot(pi);if(h<=0&&o<=0)return e.copy(i);fi.subVectors(t,s);const l=Yt.dot(fi),u=Ht.dot(fi);if(l>=0&&u<=l)return e.copy(s);const d=h*u-l*o;if(d<=0&&h>=0&&l<=0)return r=h/(h-l),e.copy(i).addScaledVector(Yt,r);mi.subVectors(t,n);const p=Yt.dot(mi),f=Ht.dot(mi);if(f>=0&&p<=f)return e.copy(n);const m=p*o-h*f;if(m<=0&&o>=0&&f<=0)return a=o/(o-f),e.copy(i).addScaledVector(Ht,a);const g=l*f-p*u;if(g<=0&&u-l>=0&&p-f>=0)return Ki.subVectors(n,s),a=(u-l)/(u-l+(p-f)),e.copy(s).addScaledVector(Ki,a);const y=1/(g+m+d);return r=m*y,a=d*y,e.copy(i).addScaledVector(Yt,r).addScaledVector(Ht,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const Ss={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},Ct={h:0,s:0,l:0},Fe={h:0,s:0,l:0};function bi(c,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?c+(t-c)*6*e:e<1/2?t:e<2/3?c+(t-c)*6*(2/3-e):c}class H{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(e===void 0&&i===void 0){const s=t;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=et){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,$.colorSpaceToWorking(this,e),this}setRGB(t,e,i,s=$.workingColorSpace){return this.r=t,this.g=e,this.b=i,$.colorSpaceToWorking(this,s),this}setHSL(t,e,i,s=$.workingColorSpace){if(t=Bi(t,1),e=F(e,0,1),i=F(i,0,1),e===0)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=bi(r,n,t+1/3),this.g=bi(r,n,t),this.b=bi(r,n,t-1/3)}return $.colorSpaceToWorking(this,s),this}setStyle(t,e=et){function i(n){n!==void 0&&parseFloat(n)<1&&B("Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let n;const r=s[1],a=s[2];switch(r){case"rgb":case"rgba":if(n=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(n[4]),this.setRGB(Math.min(255,parseInt(n[1],10))/255,Math.min(255,parseInt(n[2],10))/255,Math.min(255,parseInt(n[3],10))/255,e);if(n=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(n[4]),this.setRGB(Math.min(100,parseInt(n[1],10))/100,Math.min(100,parseInt(n[2],10))/100,Math.min(100,parseInt(n[3],10))/100,e);break;case"hsl":case"hsla":if(n=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(n[4]),this.setHSL(parseFloat(n[1])/360,parseFloat(n[2])/100,parseFloat(n[3])/100,e);break;default:B("Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){const n=s[1],r=n.length;if(r===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,e);if(r===6)return this.setHex(parseInt(n,16),e);B("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=et){const i=Ss[t.toLowerCase()];return i!==void 0?this.setHex(i,e):B("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=xt(t.r),this.g=xt(t.g),this.b=xt(t.b),this}copyLinearToSRGB(t){return this.r=ie(t.r),this.g=ie(t.g),this.b=ie(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=et){return $.workingToColorSpace(G.copy(this),t),Math.round(F(G.r*255,0,255))*65536+Math.round(F(G.g*255,0,255))*256+Math.round(F(G.b*255,0,255))}getHexString(t=et){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=$.workingColorSpace){$.workingToColorSpace(G.copy(this),e);const i=G.r,s=G.g,n=G.b,r=Math.max(i,s,n),a=Math.min(i,s,n);let h,o;const l=(a+r)/2;if(a===r)h=0,o=0;else{const u=r-a;switch(o=l<=.5?u/(r+a):u/(2-r-a),r){case i:h=(s-n)/u+(s<n?6:0);break;case s:h=(n-i)/u+2;break;case n:h=(i-s)/u+4;break}h/=6}return t.h=h,t.s=o,t.l=l,t}getRGB(t,e=$.workingColorSpace){return $.workingToColorSpace(G.copy(this),e),t.r=G.r,t.g=G.g,t.b=G.b,t}getStyle(t=et){$.workingToColorSpace(G.copy(this),t);const e=G.r,i=G.g,s=G.b;return t!==et?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(i*255)},${Math.round(s*255)})`}offsetHSL(t,e,i){return this.getHSL(Ct),this.setHSL(Ct.h+t,Ct.s+e,Ct.l+i)}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,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Ct),t.getHSL(Fe);const i=fe(Ct.h,Fe.h,e),s=fe(Ct.s,Fe.s,e),n=fe(Ct.l,Fe.l,e);return this.setHSL(i,s,n),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,s=this.b,n=t.elements;return this.r=n[0]*e+n[3]*i+n[6]*s,this.g=n[1]*e+n[4]*i+n[7]*s,this.b=n[2]*e+n[5]*i+n[8]*s,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 G=new H;H.NAMES=Ss;let fn=0;class Pt extends ye{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:fn++}),this.uuid=nt(),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 H(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(const e in t){const i=t[e];if(i===void 0){B(`Material: parameter '${e}' has value of undefined.`);continue}const s=this[e];if(s===void 0){B(`Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[e]=i}}toJSON(t){const e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(i.blending=this.blending),this.side!==0&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==204&&(i.blendSrc=this.blendSrc),this.blendDst!==205&&(i.blendDst=this.blendDst),this.blendEquation!==100&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(i.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function s(n){const r=[];for(const a in n){const h=n[a];delete h.metadata,r.push(h)}return r}if(e){const n=s(t.textures),r=s(t.images);n.length>0&&(i.textures=n),r.length>0&&(i.images=r)}return i}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 i=null;if(e!==null){const s=e.length;i=new Array(s);for(let n=0;n!==s;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,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){t===!0&&this.version++}}class mn extends Pt{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new H(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 vt,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 I=new x,Ce=new V;let yn=0;class Bt{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:yn++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&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,i){t*=this.itemSize,i*=e.itemSize;for(let s=0,n=this.itemSize;s<n;s++)this.array[t+s]=e.array[i+s];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,i=this.count;e<i;e++)Ce.fromBufferAttribute(this,e),Ce.applyMatrix3(t),this.setXY(e,Ce.x,Ce.y);else if(this.itemSize===3)for(let e=0,i=this.count;e<i;e++)I.fromBufferAttribute(this,e),I.applyMatrix3(t),this.setXYZ(e,I.x,I.y,I.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)I.fromBufferAttribute(this,e),I.applyMatrix4(t),this.setXYZ(e,I.x,I.y,I.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)I.fromBufferAttribute(this,e),I.applyNormalMatrix(t),this.setXYZ(e,I.x,I.y,I.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)I.fromBufferAttribute(this,e),I.transformDirection(t),this.setXYZ(e,I.x,I.y,I.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=it(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=z(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=it(e,this.array)),e}setX(t,e){return this.normalized&&(e=z(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=it(e,this.array)),e}setY(t,e){return this.normalized&&(e=z(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=it(e,this.array)),e}setZ(t,e){return this.normalized&&(e=z(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=it(e,this.array)),e}setW(t,e){return this.normalized&&(e=z(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=z(e,this.array),i=z(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,s){return t*=this.itemSize,this.normalized&&(e=z(e,this.array),i=z(i,this.array),s=z(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this}setXYZW(t,e,i,s,n){return t*=this.itemSize,this.normalized&&(e=z(e,this.array),i=z(i,this.array),s=z(s,this.array),n=z(n,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this.array[t+3]=n,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!==35044&&(t.usage=this.usage),t}}class gn extends Bt{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class xn extends Bt{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class bt extends Bt{constructor(t,e,i){super(new Float32Array(t),e,i)}}let bn=0;const Z=new C,Mi=new R,Zt=new x,Y=new kt,le=new kt,O=new x;class Ot extends ye{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:bn++}),this.uuid=nt(),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(Ns(t)?xn:gn)(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 this.attributes[t]!==void 0}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const n=new Mt().getNormalMatrix(t);i.applyNormalMatrix(n),i.needsUpdate=!0}const s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(t),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return Z.makeRotationFromQuaternion(t),this.applyMatrix4(Z),this}rotateX(t){return Z.makeRotationX(t),this.applyMatrix4(Z),this}rotateY(t){return Z.makeRotationY(t),this.applyMatrix4(Z),this}rotateZ(t){return Z.makeRotationZ(t),this.applyMatrix4(Z),this}translate(t,e,i){return Z.makeTranslation(t,e,i),this.applyMatrix4(Z),this}scale(t,e,i){return Z.makeScale(t,e,i),this.applyMatrix4(Z),this}lookAt(t){return Mi.lookAt(t),Mi.updateMatrix(),this.applyMatrix4(Mi.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Zt).negate(),this.translate(Zt.x,Zt.y,Zt.z),this}setFromPoints(t){const e=this.getAttribute("position");if(e===void 0){const i=[];for(let s=0,n=t.length;s<n;s++){const r=t[s];i.push(r.x,r.y,r.z||0)}this.setAttribute("position",new bt(i,3))}else{const i=Math.min(t.length,e.count);for(let s=0;s<i;s++){const n=t[s];e.setXYZ(s,n.x,n.y,n.z||0)}t.length>e.count&&B("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new kt);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){k("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new x(-1/0,-1/0,-1/0),new x(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let i=0,s=e.length;i<s;i++){const n=e[i];Y.setFromBufferAttribute(n),this.morphTargetsRelative?(O.addVectors(this.boundingBox.min,Y.min),this.boundingBox.expandByPoint(O),O.addVectors(this.boundingBox.max,Y.max),this.boundingBox.expandByPoint(O)):(this.boundingBox.expandByPoint(Y.min),this.boundingBox.expandByPoint(Y.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&k('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new _t);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){k("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new x,1/0);return}if(t){const i=this.boundingSphere.center;if(Y.setFromBufferAttribute(t),e)for(let n=0,r=e.length;n<r;n++){const a=e[n];le.setFromBufferAttribute(a),this.morphTargetsRelative?(O.addVectors(Y.min,le.min),Y.expandByPoint(O),O.addVectors(Y.max,le.max),Y.expandByPoint(O)):(Y.expandByPoint(le.min),Y.expandByPoint(le.max))}Y.getCenter(i);let s=0;for(let n=0,r=t.count;n<r;n++)O.fromBufferAttribute(t,n),s=Math.max(s,i.distanceToSquared(O));if(e)for(let n=0,r=e.length;n<r;n++){const a=e[n],h=this.morphTargetsRelative;for(let o=0,l=a.count;o<l;o++)O.fromBufferAttribute(a,o),h&&(Zt.fromBufferAttribute(t,o),O.add(Zt)),s=Math.max(s,i.distanceToSquared(O))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&k('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(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){k("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=e.position,s=e.normal,n=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Bt(new Float32Array(4*i.count),4));const r=this.getAttribute("tangent"),a=[],h=[];for(let A=0;A<i.count;A++)a[A]=new x,h[A]=new x;const o=new x,l=new x,u=new x,d=new V,p=new V,f=new V,m=new x,g=new x;function y(A,E,N){o.fromBufferAttribute(i,A),l.fromBufferAttribute(i,E),u.fromBufferAttribute(i,N),d.fromBufferAttribute(n,A),p.fromBufferAttribute(n,E),f.fromBufferAttribute(n,N),l.sub(o),u.sub(o),p.sub(d),f.sub(d);const D=1/(p.x*f.y-f.x*p.y);isFinite(D)&&(m.copy(l).multiplyScalar(f.y).addScaledVector(u,-p.y).multiplyScalar(D),g.copy(u).multiplyScalar(p.x).addScaledVector(l,-f.x).multiplyScalar(D),a[A].add(m),a[E].add(m),a[N].add(m),h[A].add(g),h[E].add(g),h[N].add(g))}let b=this.groups;b.length===0&&(b=[{start:0,count:t.count}]);for(let A=0,E=b.length;A<E;++A){const N=b[A],D=N.start,ot=N.count;for(let P=D,ht=D+ot;P<ht;P+=3)y(t.getX(P+0),t.getX(P+1),t.getX(P+2))}const M=new x,_=new x,w=new x,T=new x;function S(A){w.fromBufferAttribute(s,A),T.copy(w);const E=a[A];M.copy(E),M.sub(w.multiplyScalar(w.dot(E))).normalize(),_.crossVectors(T,E);const D=_.dot(h[A])<0?-1:1;r.setXYZW(A,M.x,M.y,M.z,D)}for(let A=0,E=b.length;A<E;++A){const N=b[A],D=N.start,ot=N.count;for(let P=D,ht=D+ot;P<ht;P+=3)S(t.getX(P+0)),S(t.getX(P+1)),S(t.getX(P+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(e!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Bt(new Float32Array(e.count*3),3),this.setAttribute("normal",i);else for(let d=0,p=i.count;d<p;d++)i.setXYZ(d,0,0,0);const s=new x,n=new x,r=new x,a=new x,h=new x,o=new x,l=new x,u=new x;if(t)for(let d=0,p=t.count;d<p;d+=3){const f=t.getX(d+0),m=t.getX(d+1),g=t.getX(d+2);s.fromBufferAttribute(e,f),n.fromBufferAttribute(e,m),r.fromBufferAttribute(e,g),l.subVectors(r,n),u.subVectors(s,n),l.cross(u),a.fromBufferAttribute(i,f),h.fromBufferAttribute(i,m),o.fromBufferAttribute(i,g),a.add(l),h.add(l),o.add(l),i.setXYZ(f,a.x,a.y,a.z),i.setXYZ(m,h.x,h.y,h.z),i.setXYZ(g,o.x,o.y,o.z)}else for(let d=0,p=e.count;d<p;d+=3)s.fromBufferAttribute(e,d+0),n.fromBufferAttribute(e,d+1),r.fromBufferAttribute(e,d+2),l.subVectors(r,n),u.subVectors(s,n),l.cross(u),i.setXYZ(d+0,l.x,l.y,l.z),i.setXYZ(d+1,l.x,l.y,l.z),i.setXYZ(d+2,l.x,l.y,l.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)O.fromBufferAttribute(t,e),O.normalize(),t.setXYZ(e,O.x,O.y,O.z)}toNonIndexed(){function t(a,h){const o=a.array,l=a.itemSize,u=a.normalized,d=new o.constructor(h.length*l);let p=0,f=0;for(let m=0,g=h.length;m<g;m++){a.isInterleavedBufferAttribute?p=h[m]*a.data.stride+a.offset:p=h[m]*l;for(let y=0;y<l;y++)d[f++]=o[p++]}return new Bt(d,l,u)}if(this.index===null)return B("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Ot,i=this.index.array,s=this.attributes;for(const a in s){const h=s[a],o=t(h,i);e.setAttribute(a,o)}const n=this.morphAttributes;for(const a in n){const h=[],o=n[a];for(let l=0,u=o.length;l<u;l++){const d=o[l],p=t(d,i);h.push(p)}e.morphAttributes[a]=h}e.morphTargetsRelative=this.morphTargetsRelative;const r=this.groups;for(let a=0,h=r.length;a<h;a++){const o=r[a];e.addGroup(o.start,o.count,o.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),this.parameters!==void 0){const h=this.parameters;for(const o in h)h[o]!==void 0&&(t[o]=h[o]);return t}t.data={attributes:{}};const e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const h in i){const o=i[h];t.data.attributes[h]=o.toJSON(t.data)}const s={};let n=!1;for(const h in this.morphAttributes){const o=this.morphAttributes[h],l=[];for(let u=0,d=o.length;u<d;u++){const p=o[u];l.push(p.toJSON(t.data))}l.length>0&&(s[h]=l,n=!0)}n&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(t.data.groups=JSON.parse(JSON.stringify(r)));const a=this.boundingSphere;return a!==null&&(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 i=t.index;i!==null&&this.setIndex(i.clone());const s=t.attributes;for(const o in s){const l=s[o];this.setAttribute(o,l.clone(e))}const n=t.morphAttributes;for(const o in n){const l=[],u=n[o];for(let d=0,p=u.length;d<p;d++)l.push(u[d].clone(e));this.morphAttributes[o]=l}this.morphTargetsRelative=t.morphTargetsRelative;const r=t.groups;for(let o=0,l=r.length;o<l;o++){const u=r[o];this.addGroup(u.start,u.count,u.materialIndex)}const a=t.boundingBox;a!==null&&(this.boundingBox=a.clone());const h=t.boundingSphere;return h!==null&&(this.boundingSphere=h.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const ts=new C,Nt=new He,ze=new _t,es=new x,Be=new x,ve=new x,ke=new x,_i=new x,Re=new x,is=new x,Ie=new x;class Ze extends R{constructor(t=new Ot,e=new mn){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),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,i=Object.keys(e);if(i.length>0){const s=e[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let n=0,r=s.length;n<r;n++){const a=s[n].name||String(n);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=n}}}}getVertexPosition(t,e){const i=this.geometry,s=i.attributes.position,n=i.morphAttributes.position,r=i.morphTargetsRelative;e.fromBufferAttribute(s,t);const a=this.morphTargetInfluences;if(n&&a){Re.set(0,0,0);for(let h=0,o=n.length;h<o;h++){const l=a[h],u=n[h];l!==0&&(_i.fromBufferAttribute(u,t),r?Re.addScaledVector(_i,l):Re.addScaledVector(_i.sub(e),l))}e.add(Re)}return e}raycast(t,e){const i=this.geometry,s=this.material,n=this.matrixWorld;s!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),ze.copy(i.boundingSphere),ze.applyMatrix4(n),Nt.copy(t.ray).recast(t.near),!(ze.containsPoint(Nt.origin)===!1&&(Nt.intersectSphere(ze,es)===null||Nt.origin.distanceToSquared(es)>(t.far-t.near)**2))&&(ts.copy(n).invert(),Nt.copy(t.ray).applyMatrix4(ts),!(i.boundingBox!==null&&Nt.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(t,e,Nt)))}_computeIntersections(t,e,i){let s;const n=this.geometry,r=this.material,a=n.index,h=n.attributes.position,o=n.attributes.uv,l=n.attributes.uv1,u=n.attributes.normal,d=n.groups,p=n.drawRange;if(a!==null)if(Array.isArray(r))for(let f=0,m=d.length;f<m;f++){const g=d[f],y=r[g.materialIndex],b=Math.max(g.start,p.start),M=Math.min(a.count,Math.min(g.start+g.count,p.start+p.count));for(let _=b,w=M;_<w;_+=3){const T=a.getX(_),S=a.getX(_+1),A=a.getX(_+2);s=Ee(this,y,t,i,o,l,u,T,S,A),s&&(s.faceIndex=Math.floor(_/3),s.face.materialIndex=g.materialIndex,e.push(s))}}else{const f=Math.max(0,p.start),m=Math.min(a.count,p.start+p.count);for(let g=f,y=m;g<y;g+=3){const b=a.getX(g),M=a.getX(g+1),_=a.getX(g+2);s=Ee(this,r,t,i,o,l,u,b,M,_),s&&(s.faceIndex=Math.floor(g/3),e.push(s))}}else if(h!==void 0)if(Array.isArray(r))for(let f=0,m=d.length;f<m;f++){const g=d[f],y=r[g.materialIndex],b=Math.max(g.start,p.start),M=Math.min(h.count,Math.min(g.start+g.count,p.start+p.count));for(let _=b,w=M;_<w;_+=3){const T=_,S=_+1,A=_+2;s=Ee(this,y,t,i,o,l,u,T,S,A),s&&(s.faceIndex=Math.floor(_/3),s.face.materialIndex=g.materialIndex,e.push(s))}}else{const f=Math.max(0,p.start),m=Math.min(h.count,p.start+p.count);for(let g=f,y=m;g<y;g+=3){const b=g,M=g+1,_=g+2;s=Ee(this,r,t,i,o,l,u,b,M,_),s&&(s.faceIndex=Math.floor(g/3),e.push(s))}}}}function Mn(c,t,e,i,s,n,r,a){let h;if(t.side===1?h=i.intersectTriangle(r,n,s,!0,a):h=i.intersectTriangle(s,n,r,t.side===0,a),h===null)return null;Ie.copy(a),Ie.applyMatrix4(c.matrixWorld);const o=e.ray.origin.distanceTo(Ie);return o<e.near||o>e.far?null:{distance:o,point:Ie.clone(),object:c}}function Ee(c,t,e,i,s,n,r,a,h,o){c.getVertexPosition(a,Be),c.getVertexPosition(h,ve),c.getVertexPosition(o,ke);const l=Mn(c,t,e,i,Be,ve,ke,is);if(l){const u=new x;st.getBarycoord(is,Be,ve,ke,u),s&&(l.uv=st.getInterpolatedAttribute(s,a,h,o,u,new V)),n&&(l.uv1=st.getInterpolatedAttribute(n,a,h,o,u,new V)),r&&(l.normal=st.getInterpolatedAttribute(r,a,h,o,u,new x),l.normal.dot(i.direction)>0&&l.normal.multiplyScalar(-1));const d={a,b:h,c:o,normal:new x,materialIndex:0};st.getNormal(Be,ve,ke,d.normal),l.face=d,l.barycoord=u}return l}class ki extends Ot{constructor(t=1,e=1,i=1,s=1,n=1,r=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:s,heightSegments:n,depthSegments:r};const a=this;s=Math.floor(s),n=Math.floor(n),r=Math.floor(r);const h=[],o=[],l=[],u=[];let d=0,p=0;f("z","y","x",-1,-1,i,e,t,r,n,0),f("z","y","x",1,-1,i,e,-t,r,n,1),f("x","z","y",1,1,t,i,e,s,r,2),f("x","z","y",1,-1,t,i,-e,s,r,3),f("x","y","z",1,-1,t,e,i,s,n,4),f("x","y","z",-1,-1,t,e,-i,s,n,5),this.setIndex(h),this.setAttribute("position",new bt(o,3)),this.setAttribute("normal",new bt(l,3)),this.setAttribute("uv",new bt(u,2));function f(m,g,y,b,M,_,w,T,S,A,E){const N=_/S,D=w/A,ot=_/2,P=w/2,ht=T/2,lt=S+1,Vt=A+1;let Rt=0,wt=0;const L=new x;for(let U=0;U<Vt;U++){const X=U*D-P;for(let Lt=0;Lt<lt;Lt++){const xe=Lt*N-ot;L[m]=xe*b,L[g]=X*M,L[y]=ht,o.push(L.x,L.y,L.z),L[m]=0,L[g]=0,L[y]=T>0?1:-1,l.push(L.x,L.y,L.z),u.push(Lt/S),u.push(1-U/A),Rt+=1}}for(let U=0;U<A;U++)for(let X=0;X<S;X++){const Lt=d+X+lt*U,xe=d+X+lt*(U+1),Is=d+(X+1)+lt*(U+1),Ni=d+(X+1)+lt*U;h.push(Lt,xe,Ni),h.push(xe,Is,Ni),wt+=6}a.addGroup(p,wt,E),p+=wt,d+=Rt}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ki(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function $e(c){const t={};for(const e in c){t[e]={};for(const i in c[e]){const s=c[e][i];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(B("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][i]=null):t[e][i]=s.clone():Array.isArray(s)?t[e][i]=s.slice():t[e][i]=s}}return t}function _n(c){const t={};for(let e=0;e<c.length;e++){const i=$e(c[e]);for(const s in i)t[s]=i[s]}return t}function wn(c){const t=[];for(let e=0;e<c.length;e++)t.push(c[e].clone());return t}function eh(c){const t=c.getRenderTarget();return t===null?c.outputColorSpace:t.isXRRenderTarget===!0?t.texture.colorSpace:$.workingColorSpace}const ih={clone:$e,merge:_n};var Sn=`void main() {
|
|
2
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
3
|
+
}`,An=`void main() {
|
|
4
|
+
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
5
|
+
}`;class As extends Pt{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Sn,this.fragmentShader=An,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,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=$e(t.uniforms),this.uniformsGroups=wn(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 r=this.uniforms[s].value;r&&r.isTexture?e.uniforms[s]={type:"t",value:r.toJSON(t).uuid}:r&&r.isColor?e.uniforms[s]={type:"c",value:r.getHex()}:r&&r.isVector2?e.uniforms[s]={type:"v2",value:r.toArray()}:r&&r.isVector3?e.uniforms[s]={type:"v3",value:r.toArray()}:r&&r.isVector4?e.uniforms[s]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?e.uniforms[s]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?e.uniforms[s]={type:"m4",value:r.toArray()}:e.uniforms[s]={value:r}}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 i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class Ts extends R{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new C,this.projectionMatrix=new C,this.projectionMatrixInverse=new C,this.coordinateSystem=2e3,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 zt=new x,ss=new V,ns=new V;class yt extends Ts{constructor(t=50,e=1,i=.1,s=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=s,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=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=me*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(pe*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return me*2*Math.atan(Math.tan(pe*.5*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,i){zt.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(zt.x,zt.y).multiplyScalar(-t/zt.z),zt.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(zt.x,zt.y).multiplyScalar(-t/zt.z)}getViewSize(t,e){return this.getViewBounds(t,ss,ns),e.subVectors(ns,ss)}setViewOffset(t,e,i,s,n,r){this.aspect=t/e,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=n,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(pe*.5*this.fov)/this.zoom,i=2*e,s=this.aspect*i,n=-.5*s;const r=this.view;if(this.view!==null&&this.view.enabled){const h=r.fullWidth,o=r.fullHeight;n+=r.offsetX*s/h,e-=r.offsetY*i/o,s*=r.width/h,i*=r.height/o}const a=this.filmOffset;a!==0&&(n+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(n,n+s,e,e-i,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,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const $t=-90,Qt=1;class Tn extends R{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const s=new yt($t,Qt,t,e);s.layers=this.layers,this.add(s);const n=new yt($t,Qt,t,e);n.layers=this.layers,this.add(n);const r=new yt($t,Qt,t,e);r.layers=this.layers,this.add(r);const a=new yt($t,Qt,t,e);a.layers=this.layers,this.add(a);const h=new yt($t,Qt,t,e);h.layers=this.layers,this.add(h);const o=new yt($t,Qt,t,e);o.layers=this.layers,this.add(o)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[i,s,n,r,a,h]=e;for(const o of e)this.remove(o);if(t===2e3)i.up.set(0,1,0),i.lookAt(1,0,0),s.up.set(0,1,0),s.lookAt(-1,0,0),n.up.set(0,0,-1),n.lookAt(0,1,0),r.up.set(0,0,1),r.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(t===2001)i.up.set(0,-1,0),i.lookAt(-1,0,0),s.up.set(0,-1,0),s.lookAt(1,0,0),n.up.set(0,0,1),n.lookAt(0,1,0),r.up.set(0,0,-1),r.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(const o of e)this.add(o),o.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:s}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[n,r,a,h,o,l]=this.children,u=t.getRenderTarget(),d=t.getActiveCubeFace(),p=t.getActiveMipmapLevel(),f=t.xr.enabled;t.xr.enabled=!1;const m=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0,s),t.render(e,n),t.setRenderTarget(i,1,s),t.render(e,r),t.setRenderTarget(i,2,s),t.render(e,a),t.setRenderTarget(i,3,s),t.render(e,h),t.setRenderTarget(i,4,s),t.render(e,o),i.texture.generateMipmaps=m,t.setRenderTarget(i,5,s),t.render(e,l),t.setRenderTarget(u,d,p),t.xr.enabled=f,i.texture.needsPMREMUpdate=!0}}class Fn extends j{constructor(t=[],e=301,i,s,n,r,a,h,o,l){super(t,e,i,s,n,r,a,h,o,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class sh extends rn{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const i={width:t,height:t,depth:1},s=[i,i,i,i,i,i];this.texture=new Fn(s),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 i={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
6
|
+
|
|
7
|
+
varying vec3 vWorldDirection;
|
|
8
|
+
|
|
9
|
+
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
|
|
10
|
+
|
|
11
|
+
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
void main() {
|
|
16
|
+
|
|
17
|
+
vWorldDirection = transformDirection( position, modelMatrix );
|
|
18
|
+
|
|
19
|
+
#include <begin_vertex>
|
|
20
|
+
#include <project_vertex>
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
`,fragmentShader:`
|
|
24
|
+
|
|
25
|
+
uniform sampler2D tEquirect;
|
|
26
|
+
|
|
27
|
+
varying vec3 vWorldDirection;
|
|
28
|
+
|
|
29
|
+
#include <common>
|
|
30
|
+
|
|
31
|
+
void main() {
|
|
32
|
+
|
|
33
|
+
vec3 direction = normalize( vWorldDirection );
|
|
34
|
+
|
|
35
|
+
vec2 sampleUV = equirectUv( direction );
|
|
36
|
+
|
|
37
|
+
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
`},s=new ki(5,5,5),n=new As({name:"CubemapFromEquirect",uniforms:$e(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});n.uniforms.tEquirect.value=e;const r=new Ze(s,n),a=e.minFilter;return e.minFilter===1008&&(e.minFilter=1006),new Tn(1,10,this).update(t,r),e.minFilter=a,r.geometry.dispose(),r.material.dispose(),this}clear(t,e=!0,i=!0,s=!0){const n=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,s);t.setRenderTarget(n)}}class Ne extends R{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Cn={type:"move"};class nh{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ne,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Ne,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new x,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new x),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ne,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new x,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new x),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,i){let s=null,n=null,r=null;const a=this._targetRay,h=this._grip,o=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(o&&t.hand){r=!0;for(const m of t.hand.values()){const g=e.getJointPose(m,i),y=this._getHandJoint(o,m);g!==null&&(y.matrix.fromArray(g.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.matrixWorldNeedsUpdate=!0,y.jointRadius=g.radius),y.visible=g!==null}const l=o.joints["index-finger-tip"],u=o.joints["thumb-tip"],d=l.position.distanceTo(u.position),p=.02,f=.005;o.inputState.pinching&&d>p+f?(o.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!o.inputState.pinching&&d<=p-f&&(o.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else h!==null&&t.gripSpace&&(n=e.getPose(t.gripSpace,i),n!==null&&(h.matrix.fromArray(n.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,n.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(n.linearVelocity)):h.hasLinearVelocity=!1,n.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(n.angularVelocity)):h.hasAngularVelocity=!1));a!==null&&(s=e.getPose(t.targetRaySpace,i),s===null&&n!==null&&(s=n),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Cn)))}return a!==null&&(a.visible=s!==null),h!==null&&(h.visible=n!==null),o!==null&&(o.visible=r!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){const i=new Ne;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}class rh extends R{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 vt,this.environmentIntensity=1,this.environmentRotation=new vt,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(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),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class ah{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=nt()}onUploadCallback(){}set needsUpdate(t){t===!0&&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,i){t*=this.stride,i*=e.stride;for(let s=0,n=this.stride;s<n;s++)this.array[t+s]=e.array[i+s];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=nt()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=nt()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(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 q=new x;class Fs{constructor(t,e,i,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=s}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,i=this.data.count;e<i;e++)q.fromBufferAttribute(this,e),q.applyMatrix4(t),this.setXYZ(e,q.x,q.y,q.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)q.fromBufferAttribute(this,e),q.applyNormalMatrix(t),this.setXYZ(e,q.x,q.y,q.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)q.fromBufferAttribute(this,e),q.transformDirection(t),this.setXYZ(e,q.x,q.y,q.z);return this}getComponent(t,e){let i=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(i=it(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=z(i,this.array)),this.data.array[t*this.data.stride+this.offset+e]=i,this}setX(t,e){return this.normalized&&(e=z(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=z(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=z(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=z(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=it(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=it(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=it(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=it(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=z(e,this.array),i=z(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this}setXYZ(t,e,i,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=z(e,this.array),i=z(i,this.array),s=z(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=s,this}setXYZW(t,e,i,s,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=z(e,this.array),i=z(i,this.array),s=z(s,this.array),n=z(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=s,this.data.array[t+3]=n,this}clone(t){if(t===void 0){Li("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let i=0;i<this.count;i++){const s=i*this.data.stride+this.offset;for(let n=0;n<this.itemSize;n++)e.push(this.data.array[s+n])}return new Bt(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Fs(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){Li("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let i=0;i<this.count;i++){const s=i*this.data.stride+this.offset;for(let n=0;n<this.itemSize;n++)e.push(this.data.array[s+n])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(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 rs=new x,as=new rt,os=new rt,zn=new x,hs=new C,De=new x,wi=new _t,ls=new C,Si=new He;class oh extends Ze{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Di,this.bindMatrix=new C,this.bindMatrixInverse=new C,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;this.boundingBox===null&&(this.boundingBox=new kt),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let i=0;i<e.count;i++)this.getVertexPosition(i,De),this.boundingBox.expandByPoint(De)}computeBoundingSphere(){const t=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new _t),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let i=0;i<e.count;i++)this.getVertexPosition(i,De),this.boundingSphere.expandByPoint(De)}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,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const i=this.material,s=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),wi.copy(this.boundingSphere),wi.applyMatrix4(s),t.ray.intersectsSphere(wi)!==!1&&(ls.copy(s).invert(),Si.copy(t.ray).applyMatrix4(ls),!(this.boundingBox!==null&&Si.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(t,e,Si)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,e===void 0&&(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 rt,e=this.geometry.attributes.skinWeight;for(let i=0,s=e.count;i<s;i++){t.fromBufferAttribute(e,i);const n=1/t.manhattanLength();n!==1/0?t.multiplyScalar(n):t.set(1,0,0,0),e.setXYZW(i,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===Di?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===Es?this.bindMatrixInverse.copy(this.bindMatrix).invert():B("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){const i=this.skeleton,s=this.geometry;as.fromBufferAttribute(s.attributes.skinIndex,t),os.fromBufferAttribute(s.attributes.skinWeight,t),rs.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let n=0;n<4;n++){const r=os.getComponent(n);if(r!==0){const a=as.getComponent(n);hs.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),e.addScaledVector(zn.copy(rs).applyMatrix4(hs),r)}}return e.applyMatrix4(this.bindMatrixInverse)}}class Bn extends R{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Cs extends j{constructor(t=null,e=1,i=1,s,n,r,a,h,o=1003,l=1003,u,d){super(null,r,a,h,o,l,s,n,u,d),this.isDataTexture=!0,this.image={data:t,width:e,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const cs=new C,vn=new C;class zs{constructor(t=[],e=[]){this.uuid=nt(),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(t.length*16),e.length===0)this.calculateInverses();else if(t.length!==e.length){B("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,s=this.bones.length;i<s;i++)this.boneInverses.push(new C)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const i=new C;this.bones[t]&&i.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const i=this.bones[t];i&&i.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const i=this.bones[t];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const t=this.bones,e=this.boneInverses,i=this.boneMatrices,s=this.boneTexture;for(let n=0,r=t.length;n<r;n++){const a=t[n]?t[n].matrixWorld:vn;cs.multiplyMatrices(a,e[n]),cs.toArray(i,n*16)}s!==null&&(s.needsUpdate=!0)}clone(){return new zs(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(this.bones.length*4);t=Math.ceil(t/4)*4,t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const i=new Cs(e,t,t,1023,1015);return i.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=i,this}getBoneByName(t){for(let e=0,i=this.bones.length;e<i;e++){const s=this.bones[e];if(s.name===t)return s}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let i=0,s=t.bones.length;i<s;i++){const n=t.bones[i];let r=e[n];r===void 0&&(B("Skeleton: No bone found with UUID:",n),r=new Bn),this.bones.push(r),this.boneInverses.push(new C().fromArray(t.boneInverses[i]))}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,i=this.boneInverses;for(let s=0,n=e.length;s<n;s++){const r=e[s];t.bones.push(r.uuid);const a=i[s];t.boneInverses.push(a.toArray())}return t}}class us extends Bt{constructor(t,e,i,s=1){super(t,e,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=s}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 Kt=new C,ds=new C,Pe=[],ps=new kt,kn=new C,ce=new Ze,ue=new _t;class hh extends Ze{constructor(t,e,i){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new us(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let s=0;s<i;s++)this.setMatrixAt(s,kn)}computeBoundingBox(){const t=this.geometry,e=this.count;this.boundingBox===null&&(this.boundingBox=new kt),t.boundingBox===null&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,Kt),ps.copy(t.boundingBox).applyMatrix4(Kt),this.boundingBox.union(ps)}computeBoundingSphere(){const t=this.geometry,e=this.count;this.boundingSphere===null&&(this.boundingSphere=new _t),t.boundingSphere===null&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,Kt),ue.copy(t.boundingSphere).applyMatrix4(Kt),this.boundingSphere.union(ue)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),t.morphTexture!==null&&(this.morphTexture=t.morphTexture.clone()),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone()),t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,t*3)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,t*16)}getMorphAt(t,e){const i=e.morphTargetInfluences,s=this.morphTexture.source.data.data,n=i.length+1,r=t*n+1;for(let a=0;a<i.length;a++)i[a]=s[r+a]}raycast(t,e){const i=this.matrixWorld,s=this.count;if(ce.geometry=this.geometry,ce.material=this.material,ce.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),ue.copy(this.boundingSphere),ue.applyMatrix4(i),t.ray.intersectsSphere(ue)!==!1))for(let n=0;n<s;n++){this.getMatrixAt(n,Kt),ds.multiplyMatrices(i,Kt),ce.matrixWorld=ds,ce.raycast(t,Pe);for(let r=0,a=Pe.length;r<a;r++){const h=Pe[r];h.instanceId=n,h.object=this,e.push(h)}Pe.length=0}}setColorAt(t,e){this.instanceColor===null&&(this.instanceColor=new us(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),e.toArray(this.instanceColor.array,t*3)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,t*16)}setMorphAt(t,e){const i=e.morphTargetInfluences,s=i.length+1;this.morphTexture===null&&(this.morphTexture=new Cs(new Float32Array(s*this.count),s,this.count,1028,1015));const n=this.morphTexture.source.data.data;let r=0;for(let o=0;o<i.length;o++)r+=i[o];const a=this.geometry.morphTargetsRelative?1:1-r,h=s*t;n[h]=a,n.set(i,h+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Ai=new x,Rn=new x,In=new Mt;class te{constructor(t=new x(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,i,s){return this.normal.set(t,e,i),this.constant=s,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const s=Ai.subVectors(i,e).cross(Rn.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(s,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 i=t.delta(Ai),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;const n=-(t.start.dot(this.normal)+this.constant)/s;return n<0||n>1?null:e.copy(t.start).addScaledVector(i,n)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<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 i=e||In.getNormalMatrix(t),s=this.coplanarPoint(Ai).applyMatrix4(t),n=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(n),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 Dt=new _t,En=new V(.5,.5),Oe=new x;class Nn{constructor(t=new te,e=new te,i=new te,s=new te,n=new te,r=new te){this.planes=[t,e,i,s,n,r]}set(t,e,i,s,n,r){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(s),a[4].copy(n),a[5].copy(r),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=2e3,i=!1){const s=this.planes,n=t.elements,r=n[0],a=n[1],h=n[2],o=n[3],l=n[4],u=n[5],d=n[6],p=n[7],f=n[8],m=n[9],g=n[10],y=n[11],b=n[12],M=n[13],_=n[14],w=n[15];if(s[0].setComponents(o-r,p-l,y-f,w-b).normalize(),s[1].setComponents(o+r,p+l,y+f,w+b).normalize(),s[2].setComponents(o+a,p+u,y+m,w+M).normalize(),s[3].setComponents(o-a,p-u,y-m,w-M).normalize(),i)s[4].setComponents(h,d,g,_).normalize(),s[5].setComponents(o-h,p-d,y-g,w-_).normalize();else if(s[4].setComponents(o-h,p-d,y-g,w-_).normalize(),e===2e3)s[5].setComponents(o+h,p+d,y+g,w+_).normalize();else if(e===2001)s[5].setComponents(h,d,g,_).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),Dt.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),Dt.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Dt)}intersectsSprite(t){Dt.center.set(0,0,0);const e=En.distanceTo(t.center);return Dt.radius=.7071067811865476+e,Dt.applyMatrix4(t.matrixWorld),this.intersectsSphere(Dt)}intersectsSphere(t){const e=this.planes,i=t.center,s=-t.radius;for(let n=0;n<6;n++)if(e[n].distanceToPoint(i)<s)return!1;return!0}intersectsBox(t){const e=this.planes;for(let i=0;i<6;i++){const s=e[i];if(Oe.x=s.normal.x>0?t.max.x:t.min.x,Oe.y=s.normal.y>0?t.max.y:t.min.y,Oe.z=s.normal.z>0?t.max.z:t.min.z,s.distanceToPoint(Oe)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class Dn extends Pt{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new H(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 qe=new x,Xe=new x,fs=new C,de=new He,Ve=new _t,Ti=new x,ms=new x;class Bs extends R{constructor(t=new Ot,e=new Dn){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(t.index===null){const e=t.attributes.position,i=[0];for(let s=1,n=e.count;s<n;s++)qe.fromBufferAttribute(e,s-1),Xe.fromBufferAttribute(e,s),i[s]=i[s-1],i[s]+=qe.distanceTo(Xe);t.setAttribute("lineDistance",new bt(i,1))}else B("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const i=this.geometry,s=this.matrixWorld,n=t.params.Line.threshold,r=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Ve.copy(i.boundingSphere),Ve.applyMatrix4(s),Ve.radius+=n,t.ray.intersectsSphere(Ve)===!1)return;fs.copy(s).invert(),de.copy(t.ray).applyMatrix4(fs);const a=n/((this.scale.x+this.scale.y+this.scale.z)/3),h=a*a,o=this.isLineSegments?2:1,l=i.index,d=i.attributes.position;if(l!==null){const p=Math.max(0,r.start),f=Math.min(l.count,r.start+r.count);for(let m=p,g=f-1;m<g;m+=o){const y=l.getX(m),b=l.getX(m+1),M=Le(this,t,de,h,y,b,m);M&&e.push(M)}if(this.isLineLoop){const m=l.getX(f-1),g=l.getX(p),y=Le(this,t,de,h,m,g,f-1);y&&e.push(y)}}else{const p=Math.max(0,r.start),f=Math.min(d.count,r.start+r.count);for(let m=p,g=f-1;m<g;m+=o){const y=Le(this,t,de,h,m,m+1,m);y&&e.push(y)}if(this.isLineLoop){const m=Le(this,t,de,h,f-1,p,f-1);m&&e.push(m)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,i=Object.keys(e);if(i.length>0){const s=e[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let n=0,r=s.length;n<r;n++){const a=s[n].name||String(n);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=n}}}}}function Le(c,t,e,i,s,n,r){const a=c.geometry.attributes.position;if(qe.fromBufferAttribute(a,s),Xe.fromBufferAttribute(a,n),e.distanceSqToSegment(qe,Xe,Ti,ms)>i)return;Ti.applyMatrix4(c.matrixWorld);const o=t.ray.origin.distanceTo(Ti);if(!(o<t.near||o>t.far))return{distance:o,point:ms.clone().applyMatrix4(c.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:c}}const ys=new x,gs=new x;class lh extends Bs{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.index===null){const e=t.attributes.position,i=[];for(let s=0,n=e.count;s<n;s+=2)ys.fromBufferAttribute(e,s),gs.fromBufferAttribute(e,s+1),i[s]=s===0?0:i[s-1],i[s+1]=i[s]+ys.distanceTo(gs);t.setAttribute("lineDistance",new bt(i,1))}else B("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class ch extends Bs{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class Pn extends Pt{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new H(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 xs=new C,zi=new He,Ue=new _t,We=new x;class uh extends R{constructor(t=new Ot,e=new Pn){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 i=this.geometry,s=this.matrixWorld,n=t.params.Points.threshold,r=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Ue.copy(i.boundingSphere),Ue.applyMatrix4(s),Ue.radius+=n,t.ray.intersectsSphere(Ue)===!1)return;xs.copy(s).invert(),zi.copy(t.ray).applyMatrix4(xs);const a=n/((this.scale.x+this.scale.y+this.scale.z)/3),h=a*a,o=i.index,u=i.attributes.position;if(o!==null){const d=Math.max(0,r.start),p=Math.min(o.count,r.start+r.count);for(let f=d,m=p;f<m;f++){const g=o.getX(f);We.fromBufferAttribute(u,g),bs(We,g,h,s,t,e,this)}}else{const d=Math.max(0,r.start),p=Math.min(u.count,r.start+r.count);for(let f=d,m=p;f<m;f++)We.fromBufferAttribute(u,f),bs(We,f,h,s,t,e,this)}}updateMorphTargets(){const e=this.geometry.morphAttributes,i=Object.keys(e);if(i.length>0){const s=e[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let n=0,r=s.length;n<r;n++){const a=s[n].name||String(n);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=n}}}}}function bs(c,t,e,i,s,n,r){const a=zi.distanceSqToPoint(c);if(a<e){const h=new x;zi.closestPointToPoint(c,h),h.applyMatrix4(i);const o=s.ray.origin.distanceTo(h);if(o<s.near||o>s.far)return;n.push({distance:o,distanceToRay:Math.sqrt(a),point:h,index:t,face:null,faceIndex:null,barycoord:null,object:r})}}class dh extends j{constructor(t,e,i,s,n,r,a,h,o){super(t,e,i,s,n,r,a,h,o),this.isCanvasTexture=!0,this.needsUpdate=!0}}class On extends j{constructor(t,e,i=1014,s,n,r,a=1003,h=1003,o,l=1026,u=1){if(l!==1026&&l!==1027)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const d={width:t,height:e,depth:u};super(d,s,n,r,a,h,l,i,o),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new vi(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}}class ph extends On{constructor(t,e=1014,i=301,s,n,r=1003,a=1003,h,o=1026){const l={width:t,height:t,depth:1},u=[l,l,l,l,l,l];super(t,t,e,i,s,n,r,a,h,o),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}}class fh extends j{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}}class vs extends Ot{constructor(t=1,e=1,i=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:s};const n=t/2,r=e/2,a=Math.floor(i),h=Math.floor(s),o=a+1,l=h+1,u=t/a,d=e/h,p=[],f=[],m=[],g=[];for(let y=0;y<l;y++){const b=y*d-r;for(let M=0;M<o;M++){const _=M*u-n;f.push(_,-b,0),m.push(0,0,1),g.push(M/a),g.push(1-y/h)}}for(let y=0;y<h;y++)for(let b=0;b<a;b++){const M=b+o*y,_=b+o*(y+1),w=b+1+o*(y+1),T=b+1+o*y;p.push(M,_,T),p.push(_,w,T)}this.setIndex(p),this.setAttribute("position",new bt(f,3)),this.setAttribute("normal",new bt(m,3)),this.setAttribute("uv",new bt(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new vs(t.width,t.height,t.widthSegments,t.heightSegments)}}class mh extends As{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Vn extends Pt{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new H(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 H(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new V(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 vt,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 yh extends Vn{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 V(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return F(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new H(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 H(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new H(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 gh extends Pt{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 xh extends Pt{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 Ge(c,t){return!c||c.constructor===t?c:typeof t.BYTES_PER_ELEMENT=="number"?new t(c):Array.prototype.slice.call(c)}function Ln(c){function t(s,n){return c[s]-c[n]}const e=c.length,i=new Array(e);for(let s=0;s!==e;++s)i[s]=s;return i.sort(t),i}function Ms(c,t,e){const i=c.length,s=new c.constructor(i);for(let n=0,r=0;r!==i;++n){const a=e[n]*t;for(let h=0;h!==t;++h)s[r++]=c[a+h]}return s}function ks(c,t,e,i){let s=1,n=c[0];for(;n!==void 0&&n[i]===void 0;)n=c[s++];if(n===void 0)return;let r=n[i];if(r!==void 0)if(Array.isArray(r))do r=n[i],r!==void 0&&(t.push(n.time),e.push(...r)),n=c[s++];while(n!==void 0);else if(r.toArray!==void 0)do r=n[i],r!==void 0&&(t.push(n.time),r.toArray(e,e.length)),n=c[s++];while(n!==void 0);else do r=n[i],r!==void 0&&(t.push(n.time),e.push(r)),n=c[s++];while(n!==void 0)}class Qe{constructor(t,e,i,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,s=e[i],n=e[i-1];i:{t:{let r;e:{s:if(!(t<s)){for(let a=i+2;;){if(s===void 0){if(t<n)break s;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(n=s,s=e[++i],t<s)break t}r=e.length;break e}if(!(t>=n)){const a=e[1];t<a&&(i=2,n=a);for(let h=i-2;;){if(n===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===h)break;if(s=n,n=e[--i-1],t>=n)break t}r=i,i=0;break e}break i}for(;i<r;){const a=i+r>>>1;t<e[a]?r=a:i=a+1}if(s=e[i],n=e[i-1],n===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,n,s)}return this.interpolate_(i,n,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,s=this.valueSize,n=t*s;for(let r=0;r!==s;++r)e[r]=i[n+r];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Un extends Qe{constructor(t,e,i,s){super(t,e,i,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(t,e,i){const s=this.parameterPositions;let n=t-2,r=t+1,a=s[n],h=s[r];if(a===void 0)switch(this.getSettings_().endingStart){case 2401:n=t,a=2*e-i;break;case 2402:n=s.length-2,a=e+s[n]-s[n+1];break;default:n=t,a=i}if(h===void 0)switch(this.getSettings_().endingEnd){case 2401:r=t,h=2*i-e;break;case 2402:r=1,h=i+s[1]-s[0];break;default:r=t-1,h=e}const o=(i-e)*.5,l=this.valueSize;this._weightPrev=o/(e-a),this._weightNext=o/(h-i),this._offsetPrev=n*l,this._offsetNext=r*l}interpolate_(t,e,i,s){const n=this.resultBuffer,r=this.sampleValues,a=this.valueSize,h=t*a,o=h-a,l=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,p=this._weightNext,f=(i-e)/(s-e),m=f*f,g=m*f,y=-d*g+2*d*m-d*f,b=(1+d)*g+(-1.5-2*d)*m+(-.5+d)*f+1,M=(-1-p)*g+(1.5+p)*m+.5*f,_=p*g-p*m;for(let w=0;w!==a;++w)n[w]=y*r[l+w]+b*r[o+w]+M*r[h+w]+_*r[u+w];return n}}class Wn extends Qe{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){const n=this.resultBuffer,r=this.sampleValues,a=this.valueSize,h=t*a,o=h-a,l=(i-e)/(s-e),u=1-l;for(let d=0;d!==a;++d)n[d]=r[o+d]*u+r[h+d]*l;return n}}class Gn extends Qe{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t){return this.copySampleValue_(t-1)}}class at{constructor(t,e,i,s){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Ge(e,this.TimeBufferType),this.values=Ge(i,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Ge(t.times,Array),values:Ge(t.values,Array)};const s=t.getInterpolation();s!==t.DefaultInterpolation&&(i.interpolation=s)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new Gn(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Wn(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Un(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){const i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return B("KeyframeTrack:",i),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){const e=this.times;for(let i=0,s=e.length;i!==s;++i)e[i]+=t}return this}scale(t){if(t!==1){const e=this.times;for(let i=0,s=e.length;i!==s;++i)e[i]*=t}return this}trim(t,e){const i=this.times,s=i.length;let n=0,r=s-1;for(;n!==s&&i[n]<t;)++n;for(;r!==-1&&i[r]>e;)--r;if(++r,n!==0||r!==s){n>=r&&(r=Math.max(r,1),n=r-1);const a=this.getValueSize();this.times=i.slice(n,r),this.values=this.values.slice(n*a,r*a)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(k("KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,s=this.values,n=i.length;n===0&&(k("KeyframeTrack: Track is empty.",this),t=!1);let r=null;for(let a=0;a!==n;a++){const h=i[a];if(typeof h=="number"&&isNaN(h)){k("KeyframeTrack: Time is not a valid number.",this,a,h),t=!1;break}if(r!==null&&r>h){k("KeyframeTrack: Out of order keys.",this,a,h,r),t=!1;break}r=h}if(s!==void 0&&Ds(s))for(let a=0,h=s.length;a!==h;++a){const o=s[a];if(isNaN(o)){k("KeyframeTrack: Value is not a valid number.",this,a,o),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),s=this.getInterpolation()===2302,n=t.length-1;let r=1;for(let a=1;a<n;++a){let h=!1;const o=t[a],l=t[a+1];if(o!==l&&(a!==1||o!==t[0]))if(s)h=!0;else{const u=a*i,d=u-i,p=u+i;for(let f=0;f!==i;++f){const m=e[u+f];if(m!==e[d+f]||m!==e[p+f]){h=!0;break}}}if(h){if(a!==r){t[r]=t[a];const u=a*i,d=r*i;for(let p=0;p!==i;++p)e[d+p]=e[u+p]}++r}}if(n>0){t[r]=t[n];for(let a=n*i,h=r*i,o=0;o!==i;++o)e[h+o]=e[a+o];++r}return r!==t.length?(this.times=t.slice(0,r),this.values=e.slice(0,r*i)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),i=this.constructor,s=new i(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}}at.prototype.ValueTypeName="";at.prototype.TimeBufferType=Float32Array;at.prototype.ValueBufferType=Float32Array;at.prototype.DefaultInterpolation=2301;class ne extends at{constructor(t,e,i){super(t,e,i)}}ne.prototype.ValueTypeName="bool";ne.prototype.ValueBufferType=Array;ne.prototype.DefaultInterpolation=2300;ne.prototype.InterpolantFactoryMethodLinear=void 0;ne.prototype.InterpolantFactoryMethodSmooth=void 0;class Rs extends at{constructor(t,e,i,s){super(t,e,i,s)}}Rs.prototype.ValueTypeName="color";class Je extends at{constructor(t,e,i,s){super(t,e,i,s)}}Je.prototype.ValueTypeName="number";class jn extends Qe{constructor(t,e,i,s){super(t,e,i,s)}interpolate_(t,e,i,s){const n=this.resultBuffer,r=this.sampleValues,a=this.valueSize,h=(i-e)/(s-e);let o=t*a;for(let l=o+a;o!==l;o+=4)se.slerpFlat(n,0,r,o-a,r,o,h);return n}}class Ke extends at{constructor(t,e,i,s){super(t,e,i,s)}InterpolantFactoryMethodLinear(t){return new jn(this.times,this.values,this.getValueSize(),t)}}Ke.prototype.ValueTypeName="quaternion";Ke.prototype.InterpolantFactoryMethodSmooth=void 0;class re extends at{constructor(t,e,i){super(t,e,i)}}re.prototype.ValueTypeName="string";re.prototype.ValueBufferType=Array;re.prototype.DefaultInterpolation=2300;re.prototype.InterpolantFactoryMethodLinear=void 0;re.prototype.InterpolantFactoryMethodSmooth=void 0;class Ye extends at{constructor(t,e,i,s){super(t,e,i,s)}}Ye.prototype.ValueTypeName="vector";class bh{constructor(t="",e=-1,i=[],s=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=s,this.uuid=nt(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,s=1/(t.fps||1);for(let r=0,a=i.length;r!==a;++r)e.push(Xn(i[r]).scale(s));const n=new this(t.name,t.duration,e,t.blendMode);return n.uuid=t.uuid,n.userData=JSON.parse(t.userData||"{}"),n}static toJSON(t){const e=[],i=t.tracks,s={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let n=0,r=i.length;n!==r;++n)e.push(at.toJSON(i[n]));return s}static CreateFromMorphTargetSequence(t,e,i,s){const n=e.length,r=[];for(let a=0;a<n;a++){let h=[],o=[];h.push((a+n-1)%n,a,(a+1)%n),o.push(0,1,0);const l=Ln(h);h=Ms(h,1,l),o=Ms(o,1,l),!s&&h[0]===0&&(h.push(n),o.push(o[0])),r.push(new Je(".morphTargetInfluences["+e[a].name+"]",h,o).scale(1/i))}return new this(t,-1,r)}static findByName(t,e){let i=t;if(!Array.isArray(t)){const s=t;i=s.geometry&&s.geometry.animations||s.animations}for(let s=0;s<i.length;s++)if(i[s].name===e)return i[s];return null}static CreateClipsFromMorphTargetSequences(t,e,i){const s={},n=/^([\w-]*?)([\d]+)$/;for(let a=0,h=t.length;a<h;a++){const o=t[a],l=o.name.match(n);if(l&&l.length>1){const u=l[1];let d=s[u];d||(s[u]=d=[]),d.push(o)}}const r=[];for(const a in s)r.push(this.CreateFromMorphTargetSequence(a,s[a],e,i));return r}static parseAnimation(t,e){if(B("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return k("AnimationClip: No animation in JSONLoader data."),null;const i=function(u,d,p,f,m){if(p.length!==0){const g=[],y=[];ks(p,g,y,f),g.length!==0&&m.push(new u(d,g,y))}},s=[],n=t.name||"default",r=t.fps||30,a=t.blendMode;let h=t.length||-1;const o=t.hierarchy||[];for(let u=0;u<o.length;u++){const d=o[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const p={};let f;for(f=0;f<d.length;f++)if(d[f].morphTargets)for(let m=0;m<d[f].morphTargets.length;m++)p[d[f].morphTargets[m]]=-1;for(const m in p){const g=[],y=[];for(let b=0;b!==d[f].morphTargets.length;++b){const M=d[f];g.push(M.time),y.push(M.morphTarget===m?1:0)}s.push(new Je(".morphTargetInfluence["+m+"]",g,y))}h=p.length*r}else{const p=".bones["+e[u].name+"]";i(Ye,p+".position",d,"pos",s),i(Ke,p+".quaternion",d,"rot",s),i(Ye,p+".scale",d,"scl",s)}}return s.length===0?null:new this(n,h,s,a)}resetDuration(){const t=this.tracks;let e=0;for(let i=0,s=t.length;i!==s;++i){const n=this.tracks[i];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,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 i=0;i<this.tracks.length;i++)t.push(this.tracks[i].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 qn(c){switch(c.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Je;case"vector":case"vector2":case"vector3":case"vector4":return Ye;case"color":return Rs;case"quaternion":return Ke;case"bool":case"boolean":return ne;case"string":return re}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+c)}function Xn(c){if(c.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=qn(c.type);if(c.times===void 0){const e=[],i=[];ks(c.keys,e,i,"value"),c.times=e,c.values=i}return t.parse!==void 0?t.parse(c):new t(c.name,c.times,c.values,c.interpolation)}const gt={enabled:!1,files:{},add:function(c,t){this.enabled!==!1&&(this.files[c]=t)},get:function(c){if(this.enabled!==!1)return this.files[c]},remove:function(c){delete this.files[c]},clear:function(){this.files={}}};class Jn{constructor(t,e,i){const s=this;let n=!1,r=0,a=0,h;const o=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this._abortController=null,this.itemStart=function(l){a++,n===!1&&s.onStart!==void 0&&s.onStart(l,r,a),n=!0},this.itemEnd=function(l){r++,s.onProgress!==void 0&&s.onProgress(l,r,a),r===a&&(n=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(l){s.onError!==void 0&&s.onError(l)},this.resolveURL=function(l){return h?h(l):l},this.setURLModifier=function(l){return h=l,this},this.addHandler=function(l,u){return o.push(l,u),this},this.removeHandler=function(l){const u=o.indexOf(l);return u!==-1&&o.splice(u,2),this},this.getHandler=function(l){for(let u=0,d=o.length;u<d;u+=2){const p=o[u],f=o[u+1];if(p.global&&(p.lastIndex=0),p.test(l))return f}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 Yn=new Jn;class ge{constructor(t){this.manager=t!==void 0?t:Yn,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const i=this;return new Promise(function(s,n){i.load(t,s,e,n)})}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}}ge.DEFAULT_MATERIAL_NAME="__DEFAULT";const mt={};class Hn extends Error{constructor(t,e){super(t),this.response=e}}class Mh extends ge{constructor(t){super(t),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(t,e,i,s){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const n=gt.get(`file:${t}`);if(n!==void 0)return this.manager.itemStart(t),setTimeout(()=>{e&&e(n),this.manager.itemEnd(t)},0),n;if(mt[t]!==void 0){mt[t].push({onLoad:e,onProgress:i,onError:s});return}mt[t]=[],mt[t].push({onLoad:e,onProgress:i,onError:s});const r=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,h=this.responseType;fetch(r).then(o=>{if(o.status===200||o.status===0){if(o.status===0&&B("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||o.body===void 0||o.body.getReader===void 0)return o;const l=mt[t],u=o.body.getReader(),d=o.headers.get("X-File-Size")||o.headers.get("Content-Length"),p=d?parseInt(d):0,f=p!==0;let m=0;const g=new ReadableStream({start(y){b();function b(){u.read().then(({done:M,value:_})=>{if(M)y.close();else{m+=_.byteLength;const w=new ProgressEvent("progress",{lengthComputable:f,loaded:m,total:p});for(let T=0,S=l.length;T<S;T++){const A=l[T];A.onProgress&&A.onProgress(w)}y.enqueue(_),b()}},M=>{y.error(M)})}}});return new Response(g)}else throw new Hn(`fetch for "${o.url}" responded with ${o.status}: ${o.statusText}`,o)}).then(o=>{switch(h){case"arraybuffer":return o.arrayBuffer();case"blob":return o.blob();case"document":return o.text().then(l=>new DOMParser().parseFromString(l,a));case"json":return o.json();default:if(a==="")return o.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),d=u&&u[1]?u[1].toLowerCase():void 0,p=new TextDecoder(d);return o.arrayBuffer().then(f=>p.decode(f))}}}).then(o=>{gt.add(`file:${t}`,o);const l=mt[t];delete mt[t];for(let u=0,d=l.length;u<d;u++){const p=l[u];p.onLoad&&p.onLoad(o)}}).catch(o=>{const l=mt[t];if(l===void 0)throw this.manager.itemError(t),o;delete mt[t];for(let u=0,d=l.length;u<d;u++){const p=l[u];p.onError&&p.onError(o)}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 ee=new WeakMap;class Zn extends ge{constructor(t){super(t)}load(t,e,i,s){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const n=this,r=gt.get(`image:${t}`);if(r!==void 0){if(r.complete===!0)n.manager.itemStart(t),setTimeout(function(){e&&e(r),n.manager.itemEnd(t)},0);else{let u=ee.get(r);u===void 0&&(u=[],ee.set(r,u)),u.push({onLoad:e,onError:s})}return r}const a=je("img");function h(){l(),e&&e(this);const u=ee.get(this)||[];for(let d=0;d<u.length;d++){const p=u[d];p.onLoad&&p.onLoad(this)}ee.delete(this),n.manager.itemEnd(t)}function o(u){l(),s&&s(u),gt.remove(`image:${t}`);const d=ee.get(this)||[];for(let p=0;p<d.length;p++){const f=d[p];f.onError&&f.onError(u)}ee.delete(this),n.manager.itemError(t),n.manager.itemEnd(t)}function l(){a.removeEventListener("load",h,!1),a.removeEventListener("error",o,!1)}return a.addEventListener("load",h,!1),a.addEventListener("error",o,!1),t.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),gt.add(`image:${t}`,a),n.manager.itemStart(t),a.src=t,a}}class _h extends ge{constructor(t){super(t)}load(t,e,i,s){const n=new j,r=new Zn(this.manager);return r.setCrossOrigin(this.crossOrigin),r.setPath(this.path),r.load(t,function(a){n.image=a,n.needsUpdate=!0,e!==void 0&&e(n)},i,s),n}}class ti extends R{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new H(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}}class wh extends ti{constructor(t,e,i){super(t,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(R.DEFAULT_UP),this.updateMatrix(),this.groundColor=new H(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}toJSON(t){const e=super.toJSON(t);return e.object.groundColor=this.groundColor.getHex(),e}}const Fi=new C,_s=new x,ws=new x;class Ri{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new V(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new C,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Nn,this._frameExtents=new V(1,1),this._viewportCount=1,this._viewports=[new rt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,i=this.matrix;_s.setFromMatrixPosition(t.matrixWorld),e.position.copy(_s),ws.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(ws),e.updateMatrixWorld(),Fi.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Fi,e.coordinateSystem,e.reversedDepth),e.reversedDepth?i.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(Fi)}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 this.intensity!==1&&(t.intensity=this.intensity),this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class $n extends Ri{constructor(){super(new yt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(t){const e=this.camera,i=me*2*t.angle*this.focus,s=this.mapSize.width/this.mapSize.height*this.aspect,n=t.distance||e.far;(i!==e.fov||s!==e.aspect||n!==e.far)&&(e.fov=i,e.aspect=s,e.far=n,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class Sh extends ti{constructor(t,e,i=0,s=Math.PI/3,n=0,r=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(R.DEFAULT_UP),this.updateMatrix(),this.target=new R,this.distance=i,this.angle=s,this.penumbra=n,this.decay=r,this.map=null,this.shadow=new $n}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 Qn extends Ri{constructor(){super(new yt(90,1,.5,500)),this.isPointLightShadow=!0}}class Ah extends ti{constructor(t,e,i=0,s=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=s,this.shadow=new Qn}get power(){return this.intensity*4*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 Kn extends Ts{constructor(t=-1,e=1,i=1,s=-1,n=.1,r=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=s,this.near=n,this.far=r,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=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,i,s,n,r){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=s,this.view.width=n,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let n=i-t,r=i+t,a=s+e,h=s-e;if(this.view!==null&&this.view.enabled){const o=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;n+=o*this.view.offsetX,r=n+o*this.view.width,a-=l*this.view.offsetY,h=a-l*this.view.height}this.projectionMatrix.makeOrthographic(n,r,a,h,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,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}}class tr extends Ri{constructor(){super(new Kn(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Th extends ti{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(R.DEFAULT_UP),this.updateMatrix(),this.target=new R,this.shadow=new tr}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 Fh{static extractUrlBase(t){const e=t.lastIndexOf("/");return e===-1?"./":t.slice(0,e+1)}static resolveURL(t,e){return typeof t!="string"||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 Ci=new WeakMap;class Ch extends ge{constructor(t){super(t),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&B("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&B("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(t){return this.options=t,this}load(t,e,i,s){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const n=this,r=gt.get(`image-bitmap:${t}`);if(r!==void 0){if(n.manager.itemStart(t),r.then){r.then(o=>{if(Ci.has(r)===!0)s&&s(Ci.get(r)),n.manager.itemError(t),n.manager.itemEnd(t);else return e&&e(o),n.manager.itemEnd(t),o});return}return setTimeout(function(){e&&e(r),n.manager.itemEnd(t)},0),r}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,a.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const h=fetch(t,a).then(function(o){return o.blob()}).then(function(o){return createImageBitmap(o,Object.assign(n.options,{colorSpaceConversion:"none"}))}).then(function(o){return gt.add(`image-bitmap:${t}`,o),e&&e(o),n.manager.itemEnd(t),o}).catch(function(o){s&&s(o),Ci.set(h,o),gt.remove(`image-bitmap:${t}`),n.manager.itemError(t),n.manager.itemEnd(t)});gt.add(`image-bitmap:${t}`,h),n.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class zh extends yt{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}const Ii="\\[\\]\\.:\\/",er=new RegExp("["+Ii+"]","g"),Ei="[^"+Ii+"]",ir="[^"+Ii.replace("\\.","")+"]",sr=/((?:WC+[\/:])*)/.source.replace("WC",Ei),nr=/(WCOD+)?/.source.replace("WCOD",ir),rr=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ei),ar=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ei),or=new RegExp("^"+sr+nr+rr+ar+"$"),hr=["material","materials","bones","map"];class lr{constructor(t,e,i){const s=i||v.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,s=this._bindings[i];s!==void 0&&s.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,n=i.length;s!==n;++s)i[s].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}}class v{constructor(t,e,i){this.path=e,this.parsedPath=i||v.parseTrackName(e),this.node=v.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new v.Composite(t,e,i):new v(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(er,"")}static parseTrackName(t){const e=or.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){const n=i.nodeName.substring(s+1);hr.indexOf(n)!==-1&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=n)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(i!==void 0)return i}if(t.children){const i=function(n){for(let r=0;r<n.length;r++){const a=n[r];if(a.name===e||a.uuid===e)return a;const h=i(a.children);if(h)return h}return null},s=i(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const i=this.resolvedProperty;for(let s=0,n=i.length;s!==n;++s)t[e++]=i[s]}_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 i=this.resolvedProperty;for(let s=0,n=i.length;s!==n;++s)i[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const i=this.resolvedProperty;for(let s=0,n=i.length;s!==n;++s)i[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const i=this.resolvedProperty;for(let s=0,n=i.length;s!==n;++s)i[s]=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,i=e.objectName,s=e.propertyName;let n=e.propertyIndex;if(t||(t=v.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){B("PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let o=e.objectIndex;switch(i){case"materials":if(!t.material){k("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){k("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){k("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let l=0;l<t.length;l++)if(t[l].name===o){o=l;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){k("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){k("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[i]===void 0){k("PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[i]}if(o!==void 0){if(t[o]===void 0){k("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[o]}}const r=t[s];if(r===void 0){const o=e.nodeName;k("PropertyBinding: Trying to update property for track: "+o+"."+s+" but it wasn't found.",t);return}let a=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?a=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let h=this.BindingType.Direct;if(n!==void 0){if(s==="morphTargetInfluences"){if(!t.geometry){k("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){k("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[n]!==void 0&&(n=t.morphTargetDictionary[n])}h=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=n}else r.fromArray!==void 0&&r.toArray!==void 0?(h=this.BindingType.HasFromToArray,this.resolvedProperty=r):Array.isArray(r)?(h=this.BindingType.EntireArray,this.resolvedProperty=r):this.propertyName=s;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}v.Composite=lr;v.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};v.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};v.prototype.GetterByBindingType=[v.prototype._getValue_direct,v.prototype._getValue_array,v.prototype._getValue_arrayElement,v.prototype._getValue_toArray];v.prototype.SetterByBindingTypeAndVersioning=[[v.prototype._setValue_direct,v.prototype._setValue_direct_setNeedsUpdate,v.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[v.prototype._setValue_array,v.prototype._setValue_array_setNeedsUpdate,v.prototype._setValue_array_setMatrixWorldNeedsUpdate],[v.prototype._setValue_arrayElement,v.prototype._setValue_arrayElement_setNeedsUpdate,v.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[v.prototype._setValue_fromArray,v.prototype._setValue_fromArray_setNeedsUpdate,v.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];function Bh(c,t,e,i){const s=cr(i);switch(e){case 1021:return c*t;case 1028:return c*t/s.components*s.byteLength;case 1029:return c*t/s.components*s.byteLength;case 1030:return c*t*2/s.components*s.byteLength;case 1031:return c*t*2/s.components*s.byteLength;case 1022:return c*t*3/s.components*s.byteLength;case 1023:return c*t*4/s.components*s.byteLength;case 1033:return c*t*4/s.components*s.byteLength;case 33776:case 33777:return Math.floor((c+3)/4)*Math.floor((t+3)/4)*8;case 33778:case 33779:return Math.floor((c+3)/4)*Math.floor((t+3)/4)*16;case 35841:case 35843:return Math.max(c,16)*Math.max(t,8)/4;case 35840:case 35842:return Math.max(c,8)*Math.max(t,8)/2;case 36196:case 37492:case 37488:case 37489:return Math.floor((c+3)/4)*Math.floor((t+3)/4)*8;case 37496:case 37490:case 37491:return Math.floor((c+3)/4)*Math.floor((t+3)/4)*16;case 37808:return Math.floor((c+3)/4)*Math.floor((t+3)/4)*16;case 37809:return Math.floor((c+4)/5)*Math.floor((t+3)/4)*16;case 37810:return Math.floor((c+4)/5)*Math.floor((t+4)/5)*16;case 37811:return Math.floor((c+5)/6)*Math.floor((t+4)/5)*16;case 37812:return Math.floor((c+5)/6)*Math.floor((t+5)/6)*16;case 37813:return Math.floor((c+7)/8)*Math.floor((t+4)/5)*16;case 37814:return Math.floor((c+7)/8)*Math.floor((t+5)/6)*16;case 37815:return Math.floor((c+7)/8)*Math.floor((t+7)/8)*16;case 37816:return Math.floor((c+9)/10)*Math.floor((t+4)/5)*16;case 37817:return Math.floor((c+9)/10)*Math.floor((t+5)/6)*16;case 37818:return Math.floor((c+9)/10)*Math.floor((t+7)/8)*16;case 37819:return Math.floor((c+9)/10)*Math.floor((t+9)/10)*16;case 37820:return Math.floor((c+11)/12)*Math.floor((t+9)/10)*16;case 37821:return Math.floor((c+11)/12)*Math.floor((t+11)/12)*16;case 36492:case 36494:case 36495:return Math.ceil(c/4)*Math.ceil(t/4)*16;case 36283:case 36284:return Math.ceil(c/4)*Math.ceil(t/4)*8;case 36285:case 36286:return Math.ceil(c/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function cr(c){switch(c){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${c}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"182"}}));typeof window<"u"&&(window.__THREE__?B("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="182");export{jr as $,zh as A,br as B,H as C,Mr as D,ye as E,Nn as F,Xa as G,Ia as H,Sa as I,xa as J,Vo as K,Ta as L,C as M,na as N,Kn as O,yt as P,Zr as Q,ur as R,et as S,Br as T,Fa as U,rt as V,Ho as W,zr as X,Cr as Y,Xr as Z,qr as _,Ui as a,so as a$,Gr as a0,Vr as a1,Ur as a2,Pr as a3,Nr as a4,Or as a5,Lr as a6,Wr as a7,Dr as a8,Er as a9,Ra as aA,sh as aB,ph as aC,Ya as aD,Ja as aE,qa as aF,Ba as aG,Ea as aH,Na as aI,fh as aJ,vs as aK,Pa as aL,Oa as aM,Ca as aN,za as aO,va as aP,Va as aQ,La as aR,ja as aS,Ha as aT,Za as aU,$a as aV,Qa as aW,Ka as aX,to as aY,eo as aZ,io as a_,Ir as aa,Rr as ab,ba as ac,ga as ad,Aa as ae,wa as af,_a as ag,Ma as ah,qo as ai,jo as aj,Xo as ak,Wo as al,Go as am,Uo as an,Jo as ao,Lo as ap,te as aq,Mt as ar,gh as as,xh as at,As as au,Bt as av,mr as aw,yr as ax,_r as ay,gr as az,rn as b,pa as b$,no as b0,ro as b1,ao as b2,oo as b3,ho as b4,lo as b5,co as b6,uo as b7,po as b8,fo as b9,fr as bA,wr as bB,Fr as bC,Tr as bD,Ar as bE,Sr as bF,fa as bG,ma as bH,Ko as bI,ih as bJ,ya as bK,Po as bL,Oo as bM,eh as bN,ki as bO,$e as bP,vt as bQ,la as bR,ua as bS,ca as bT,ha as bU,oa as bV,aa as bW,ra as bX,Bh as bY,Oi as bZ,da as b_,mo as ba,yo as bb,go as bc,xo as bd,bo as be,Mo as bf,_o as bg,wo as bh,So as bi,Ao as bj,To as bk,Fo as bl,Co as bm,zo as bn,Bo as bo,vo as bp,ko as bq,ta as br,Kr as bs,Qr as bt,$r as bu,Hr as bv,Yr as bw,Jr as bx,dr as by,pr as bz,Zo as c,mn as c0,xn as c1,gn as c2,Ns as c3,Yo as c4,_n as c5,ln as c6,Fn as c7,th as c8,je as c9,Vn as cA,v as cB,oh as cC,lh as cD,Bs as cE,ch as cF,uh as cG,Ne as cH,Qo as cI,zs as cJ,bh as cK,Bn as cL,Ro as cM,Io as cN,Fs as cO,Ye as cP,Je as cQ,Ke as cR,Qe as cS,kt as cT,_t as cU,rh as cV,wh as cW,dh as cX,sa as ca,ia as cb,ea as cc,j as cd,vr as ce,kr as cf,Eo as cg,Do as ch,No as ci,ge as cj,Fh as ck,Mh as cl,yh as cm,Sh as cn,Ah as co,Th as cp,hh as cq,se as cr,us as cs,R as ct,_h as cu,Ch as cv,ah as cw,Pn as cx,Pt as cy,Dn as cz,$ as d,k as e,xr as f,x as g,Pi as h,Ot as i,bt as j,mh as k,Li as l,Ze as m,ei as n,V as o,$o as p,nh as q,Ua as r,Ga as s,Wa as t,Da as u,ka as v,B as w,On as x,me as y,Cs as z};
|