@tresjs/cientos 3.2.1 → 3.3.0-next.0
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/dist/core/abstractions/Text3D.vue.d.ts +21 -21
- package/dist/core/abstractions/index.d.ts +2 -7
- package/dist/core/abstractions/useAnimations.d.ts +3 -2
- package/dist/core/controls/CameraControls.vue.d.ts +133 -116
- package/dist/core/controls/KeyboardControls.vue.d.ts +12 -12
- package/dist/core/controls/MapControls.vue.d.ts +1 -1
- package/dist/core/controls/OrbitControls.vue.d.ts +5 -4
- package/dist/core/controls/PointerLockControls.vue.d.ts +1 -1
- package/dist/core/controls/TransformControls.vue.d.ts +10 -10
- package/dist/core/loaders/SVG/component.vue.d.ts +68 -0
- package/dist/core/loaders/index.d.ts +4 -3
- package/dist/core/loaders/useFBX/index.d.ts +1 -1
- package/dist/core/loaders/useGLTF/index.d.ts +1 -1
- package/dist/core/loaders/useProgress.d.ts +1 -1
- package/dist/core/materials/meshGlassMaterial/material.d.ts +2 -1
- package/dist/core/materials/meshWobbleMaterial/material.d.ts +2 -1
- package/dist/core/misc/Stats.d.ts +1 -0
- package/dist/core/misc/index.d.ts +2 -1
- package/dist/core/shapes/Box.vue.d.ts +7 -7
- package/dist/core/shapes/Circle.vue.d.ts +7 -7
- package/dist/core/shapes/Cone.vue.d.ts +7 -7
- package/dist/core/shapes/Dodecahedron.vue.d.ts +7 -7
- package/dist/core/shapes/Icosahedron.vue.d.ts +7 -7
- package/dist/core/shapes/Octahedron.vue.d.ts +7 -7
- package/dist/core/shapes/Plane.vue.d.ts +7 -7
- package/dist/core/shapes/Ring.vue.d.ts +7 -7
- package/dist/core/shapes/Sphere.vue.d.ts +7 -7
- package/dist/core/shapes/Tetrahedron.vue.d.ts +7 -7
- package/dist/core/shapes/Torus.vue.d.ts +7 -7
- package/dist/core/shapes/TorusKnot.vue.d.ts +7 -7
- package/dist/core/shapes/Tube.vue.d.ts +8 -7
- package/dist/core/staging/Backdrop.vue.d.ts +2 -2
- package/dist/core/{abstractions → staging}/Precipitation.vue.d.ts +33 -33
- package/dist/core/{abstractions → staging}/Smoke.vue.d.ts +21 -21
- package/dist/core/staging/index.d.ts +6 -1
- package/dist/core/{abstractions → staging}/useEnvironment/component.d.ts +1 -1
- package/dist/core/{abstractions → staging}/useEnvironment/const.d.ts +3 -3
- package/dist/core/{abstractions → staging}/useEnvironment/index.d.ts +2 -2
- package/dist/trescientos.js +3873 -2867
- package/dist/trescientos.umd.cjs +14 -14
- package/package.json +20 -20
- package/dist/core/{abstractions → staging}/Stars.vue.d.ts +23 -23
package/dist/trescientos.umd.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/cientos
|
|
3
|
-
* version: v3.
|
|
3
|
+
* version: v3.3.0-next.0
|
|
4
4
|
* (c) 2023
|
|
5
5
|
* description: Collection of useful helpers and fully functional, ready-made abstractions for Tres
|
|
6
6
|
* author: Alvaro Saburido <hola@alvarosaburido.dev> (https://github.com/alvarosabu/)
|
|
7
7
|
*/
|
|
8
|
-
(function(U,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("vue"),require("three"),require("@tresjs/core"),require("tweakpane")):typeof define=="function"&&define.amd?define(["exports","vue","three","@tresjs/core","tweakpane"],u):(U=typeof globalThis<"u"?globalThis:U||self,u(U.trescientos={},U.Vue,U.Three,U.TresjsCore,U.tweakpane))})(this,function(U,u,c,q,nn){"use strict";var la=Object.defineProperty;var ca=(U,u,c)=>u in U?la(U,u,{enumerable:!0,configurable:!0,writable:!0,value:c}):U[u]=c;var re=(U,u,c)=>(ca(U,typeof u!="symbol"?u+"":u,c),c);function ts(l,e){if(e===c.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),l;if(e===c.TriangleFanDrawMode||e===c.TriangleStripDrawMode){let t=l.getIndex();if(t===null){const o=[],r=l.getAttribute("position");if(r!==void 0){for(let a=0;a<r.count;a++)o.push(a);l.setIndex(o),t=l.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),l}const s=t.count-2,n=[];if(t)if(e===c.TriangleFanDrawMode)for(let o=1;o<=s;o++)n.push(t.getX(0)),n.push(t.getX(o)),n.push(t.getX(o+1));else for(let o=0;o<s;o++)o%2===0?(n.push(t.getX(o)),n.push(t.getX(o+1)),n.push(t.getX(o+2))):(n.push(t.getX(o+2)),n.push(t.getX(o+1)),n.push(t.getX(o)));n.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=l.clone();return i.setIndex(n),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),l}var ge=Uint8Array,Ie=Uint16Array,xt=Uint32Array,ss=new ge([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ns=new ge([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),on=new ge([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),is=function(l,e){for(var t=new Ie(31),s=0;s<31;++s)t[s]=e+=1<<l[s-1];for(var n=new xt(t[30]),s=1;s<30;++s)for(var i=t[s];i<t[s+1];++i)n[i]=i-t[s]<<5|s;return[t,n]},os=is(ss,2),rs=os[0],rn=os[1];rs[28]=258,rn[258]=28;for(var an=is(ns,0),ln=an[0],vt=new Ie(32768),ne=0;ne<32768;++ne){var ke=(ne&43690)>>>1|(ne&21845)<<1;ke=(ke&52428)>>>2|(ke&13107)<<2,ke=(ke&61680)>>>4|(ke&3855)<<4,vt[ne]=((ke&65280)>>>8|(ke&255)<<8)>>>1}for(var tt=function(l,e,t){for(var s=l.length,n=0,i=new Ie(e);n<s;++n)++i[l[n]-1];var o=new Ie(e);for(n=0;n<e;++n)o[n]=o[n-1]+i[n-1]<<1;var r;if(t){r=new Ie(1<<e);var a=15-e;for(n=0;n<s;++n)if(l[n])for(var h=n<<4|l[n],p=e-l[n],d=o[l[n]-1]++<<p,m=d|(1<<p)-1;d<=m;++d)r[vt[d]>>>a]=h}else for(r=new Ie(s),n=0;n<s;++n)l[n]&&(r[n]=vt[o[l[n]-1]++]>>>15-l[n]);return r},st=new ge(288),ne=0;ne<144;++ne)st[ne]=8;for(var ne=144;ne<256;++ne)st[ne]=9;for(var ne=256;ne<280;++ne)st[ne]=7;for(var ne=280;ne<288;++ne)st[ne]=8;for(var as=new ge(32),ne=0;ne<32;++ne)as[ne]=5;var cn=tt(st,9,1),hn=tt(as,5,1),At=function(l){for(var e=l[0],t=1;t<l.length;++t)l[t]>e&&(e=l[t]);return e},ve=function(l,e,t){var s=e/8|0;return(l[s]|l[s+1]<<8)>>(e&7)&t},Mt=function(l,e){var t=e/8|0;return(l[t]|l[t+1]<<8|l[t+2]<<16)>>(e&7)},un=function(l){return(l/8|0)+(l&7&&1)},pn=function(l,e,t){(e==null||e<0)&&(e=0),(t==null||t>l.length)&&(t=l.length);var s=new(l instanceof Ie?Ie:l instanceof xt?xt:ge)(t-e);return s.set(l.subarray(e,t)),s},dn=function(l,e,t){var s=l.length;if(!s||t&&!t.l&&s<5)return e||new ge(0);var n=!e||t,i=!t||t.i;t||(t={}),e||(e=new ge(s*3));var o=function(xe){var Se=e.length;if(xe>Se){var Ne=new ge(Math.max(Se*2,xe));Ne.set(e),e=Ne}},r=t.f||0,a=t.p||0,h=t.b||0,p=t.l,d=t.d,m=t.m,f=t.n,w=s*8;do{if(!p){t.f=r=ve(l,a,1);var y=ve(l,a+1,3);if(a+=3,y)if(y==1)p=cn,d=hn,m=9,f=5;else if(y==2){var b=ve(l,a,31)+257,g=ve(l,a+10,15)+4,S=b+ve(l,a+5,31)+1;a+=14;for(var A=new ge(S),_=new ge(19),x=0;x<g;++x)_[on[x]]=ve(l,a+x*3,7);a+=g*3;for(var D=At(_),k=(1<<D)-1,I=tt(_,D,1),x=0;x<S;){var B=I[ve(l,a,k)];a+=B&15;var v=B>>>4;if(v<16)A[x++]=v;else{var R=0,H=0;for(v==16?(H=3+ve(l,a,3),a+=2,R=A[x-1]):v==17?(H=3+ve(l,a,7),a+=3):v==18&&(H=11+ve(l,a,127),a+=7);H--;)A[x++]=R}}var G=A.subarray(0,b),se=A.subarray(b);m=At(G),f=At(se),p=tt(G,m,1),d=tt(se,f,1)}else throw"invalid block type";else{var v=un(a)+4,M=l[v-4]|l[v-3]<<8,L=v+M;if(L>s){if(i)throw"unexpected EOF";break}n&&o(h+M),e.set(l.subarray(v,L),h),t.b=h+=M,t.p=a=L*8;continue}if(a>w){if(i)throw"unexpected EOF";break}}n&&o(h+131072);for(var X=(1<<m)-1,le=(1<<f)-1,oe=a;;oe=a){var R=p[Mt(l,a)&X],$=R>>>4;if(a+=R&15,a>w){if(i)throw"unexpected EOF";break}if(!R)throw"invalid length/literal";if($<256)e[h++]=$;else if($==256){oe=a,p=null;break}else{var Q=$-254;if($>264){var x=$-257,K=ss[x];Q=ve(l,a,(1<<K)-1)+rs[x],a+=K}var he=d[Mt(l,a)&le],C=he>>>4;if(!he)throw"invalid distance";a+=he&15;var se=ln[C];if(C>3){var K=ns[C];se+=Mt(l,a)&(1<<K)-1,a+=K}if(a>w){if(i)throw"unexpected EOF";break}n&&o(h+131072);for(var fe=h+Q;h<fe;h+=4)e[h]=e[h-se],e[h+1]=e[h+1-se],e[h+2]=e[h+2-se],e[h+3]=e[h+3-se];h=fe}}t.l=p,t.p=oe,t.b=h,p&&(r=1,t.m=m,t.d=d,t.n=f)}while(!r);return h==e.length?e:pn(e,0,h)},mn=new ge(0),fn=function(l){if((l[0]&15)!=8||l[0]>>>4>7||(l[0]<<8|l[1])%31)throw"invalid zlib data";if(l[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function gn(l,e){return dn((fn(l),l.subarray(2,-4)),e)}var yn=typeof TextDecoder<"u"&&new TextDecoder,_n=0;try{yn.decode(mn,{stream:!0}),_n=1}catch{}var wn=Object.defineProperty,xn=(l,e,t)=>e in l?wn(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t,O=(l,e,t)=>(xn(l,typeof e!="symbol"?e+"":e,t),t);class vn extends c.Object3D{constructor(e,t){super(),O(this,"isTransformControls",!0),O(this,"visible",!1),O(this,"domElement"),O(this,"raycaster",new c.Raycaster),O(this,"gizmo"),O(this,"plane"),O(this,"tempVector",new c.Vector3),O(this,"tempVector2",new c.Vector3),O(this,"tempQuaternion",new c.Quaternion),O(this,"unit",{X:new c.Vector3(1,0,0),Y:new c.Vector3(0,1,0),Z:new c.Vector3(0,0,1)}),O(this,"pointStart",new c.Vector3),O(this,"pointEnd",new c.Vector3),O(this,"offset",new c.Vector3),O(this,"rotationAxis",new c.Vector3),O(this,"startNorm",new c.Vector3),O(this,"endNorm",new c.Vector3),O(this,"rotationAngle",0),O(this,"cameraPosition",new c.Vector3),O(this,"cameraQuaternion",new c.Quaternion),O(this,"cameraScale",new c.Vector3),O(this,"parentPosition",new c.Vector3),O(this,"parentQuaternion",new c.Quaternion),O(this,"parentQuaternionInv",new c.Quaternion),O(this,"parentScale",new c.Vector3),O(this,"worldPositionStart",new c.Vector3),O(this,"worldQuaternionStart",new c.Quaternion),O(this,"worldScaleStart",new c.Vector3),O(this,"worldPosition",new c.Vector3),O(this,"worldQuaternion",new c.Quaternion),O(this,"worldQuaternionInv",new c.Quaternion),O(this,"worldScale",new c.Vector3),O(this,"eye",new c.Vector3),O(this,"positionStart",new c.Vector3),O(this,"quaternionStart",new c.Quaternion),O(this,"scaleStart",new c.Vector3),O(this,"camera"),O(this,"object"),O(this,"enabled",!0),O(this,"axis",null),O(this,"mode","translate"),O(this,"translationSnap",null),O(this,"rotationSnap",null),O(this,"scaleSnap",null),O(this,"space","world"),O(this,"size",1),O(this,"dragging",!1),O(this,"showX",!0),O(this,"showY",!0),O(this,"showZ",!0),O(this,"changeEvent",{type:"change"}),O(this,"mouseDownEvent",{type:"mouseDown",mode:this.mode}),O(this,"mouseUpEvent",{type:"mouseUp",mode:this.mode}),O(this,"objectChangeEvent",{type:"objectChange"}),O(this,"intersectObjectWithRay",(n,i,o)=>{const r=i.intersectObject(n,!0);for(let a=0;a<r.length;a++)if(r[a].object.visible||o)return r[a];return!1}),O(this,"attach",n=>(this.object=n,this.visible=!0,this)),O(this,"detach",()=>(this.object=void 0,this.visible=!1,this.axis=null,this)),O(this,"reset",()=>this.enabled?(this.dragging&&this.object!==void 0&&(this.object.position.copy(this.positionStart),this.object.quaternion.copy(this.quaternionStart),this.object.scale.copy(this.scaleStart),this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent),this.pointStart.copy(this.pointEnd)),this):this),O(this,"updateMatrixWorld",()=>{this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this.parentPosition,this.parentQuaternion,this.parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this.worldScale),this.parentQuaternionInv.copy(this.parentQuaternion).invert(),this.worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this.cameraScale),this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld()}),O(this,"pointerHover",n=>{if(this.object===void 0||this.dragging===!0)return;this.raycaster.setFromCamera(n,this.camera);const i=this.intersectObjectWithRay(this.gizmo.picker[this.mode],this.raycaster);i?this.axis=i.object.name:this.axis=null}),O(this,"pointerDown",n=>{if(!(this.object===void 0||this.dragging===!0||n.button!==0)&&this.axis!==null){this.raycaster.setFromCamera(n,this.camera);const i=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(i){let o=this.space;if(this.mode==="scale"?o="local":(this.axis==="E"||this.axis==="XYZE"||this.axis==="XYZ")&&(o="world"),o==="local"&&this.mode==="rotate"){const r=this.rotationSnap;this.axis==="X"&&r&&(this.object.rotation.x=Math.round(this.object.rotation.x/r)*r),this.axis==="Y"&&r&&(this.object.rotation.y=Math.round(this.object.rotation.y/r)*r),this.axis==="Z"&&r&&(this.object.rotation.z=Math.round(this.object.rotation.z/r)*r)}this.object.updateMatrixWorld(),this.object.parent&&this.object.parent.updateMatrixWorld(),this.positionStart.copy(this.object.position),this.quaternionStart.copy(this.object.quaternion),this.scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this.worldScaleStart),this.pointStart.copy(i.point).sub(this.worldPositionStart)}this.dragging=!0,this.mouseDownEvent.mode=this.mode,this.dispatchEvent(this.mouseDownEvent)}}),O(this,"pointerMove",n=>{const i=this.axis,o=this.mode,r=this.object;let a=this.space;if(o==="scale"?a="local":(i==="E"||i==="XYZE"||i==="XYZ")&&(a="world"),r===void 0||i===null||this.dragging===!1||n.button!==-1)return;this.raycaster.setFromCamera(n,this.camera);const h=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(h){if(this.pointEnd.copy(h.point).sub(this.worldPositionStart),o==="translate")this.offset.copy(this.pointEnd).sub(this.pointStart),a==="local"&&i!=="XYZ"&&this.offset.applyQuaternion(this.worldQuaternionInv),i.indexOf("X")===-1&&(this.offset.x=0),i.indexOf("Y")===-1&&(this.offset.y=0),i.indexOf("Z")===-1&&(this.offset.z=0),a==="local"&&i!=="XYZ"?this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale):this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale),r.position.copy(this.offset).add(this.positionStart),this.translationSnap&&(a==="local"&&(r.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert()),i.search("X")!==-1&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),i.search("Y")!==-1&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),i.search("Z")!==-1&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.position.applyQuaternion(this.quaternionStart)),a==="world"&&(r.parent&&r.position.add(this.tempVector.setFromMatrixPosition(r.parent.matrixWorld)),i.search("X")!==-1&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),i.search("Y")!==-1&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),i.search("Z")!==-1&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.parent&&r.position.sub(this.tempVector.setFromMatrixPosition(r.parent.matrixWorld))));else if(o==="scale"){if(i.search("XYZ")!==-1){let p=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(p*=-1),this.tempVector2.set(p,p,p)}else this.tempVector.copy(this.pointStart),this.tempVector2.copy(this.pointEnd),this.tempVector.applyQuaternion(this.worldQuaternionInv),this.tempVector2.applyQuaternion(this.worldQuaternionInv),this.tempVector2.divide(this.tempVector),i.search("X")===-1&&(this.tempVector2.x=1),i.search("Y")===-1&&(this.tempVector2.y=1),i.search("Z")===-1&&(this.tempVector2.z=1);r.scale.copy(this.scaleStart).multiply(this.tempVector2),this.scaleSnap&&this.object&&(i.search("X")!==-1&&(this.object.scale.x=Math.round(r.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),i.search("Y")!==-1&&(r.scale.y=Math.round(r.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),i.search("Z")!==-1&&(r.scale.z=Math.round(r.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(o==="rotate"){this.offset.copy(this.pointEnd).sub(this.pointStart);const p=20/this.worldPosition.distanceTo(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));i==="E"?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this.startNorm.copy(this.pointStart).normalize(),this.endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this.endNorm.cross(this.startNorm).dot(this.eye)<0?1:-1):i==="XYZE"?(this.rotationAxis.copy(this.offset).cross(this.eye).normalize(),this.rotationAngle=this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye))*p):(i==="X"||i==="Y"||i==="Z")&&(this.rotationAxis.copy(this.unit[i]),this.tempVector.copy(this.unit[i]),a==="local"&&this.tempVector.applyQuaternion(this.worldQuaternion),this.rotationAngle=this.offset.dot(this.tempVector.cross(this.eye).normalize())*p),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),a==="local"&&i!=="E"&&i!=="XYZE"?(r.quaternion.copy(this.quaternionStart),r.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this.parentQuaternionInv),r.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),r.quaternion.multiply(this.quaternionStart).normalize())}this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent)}}),O(this,"pointerUp",n=>{n.button===0&&(this.dragging&&this.axis!==null&&(this.mouseUpEvent.mode=this.mode,this.dispatchEvent(this.mouseUpEvent)),this.dragging=!1,this.axis=null)}),O(this,"getPointer",n=>{var i,o;if(this.domElement&&((i=this.domElement.ownerDocument)!=null&&i.pointerLockElement))return{x:0,y:0,button:n.button};{const r=n.changedTouches?n.changedTouches[0]:n,a=(o=this.domElement)==null?void 0:o.getBoundingClientRect();return{x:(r.clientX-a.left)/a.width*2-1,y:-(r.clientY-a.top)/a.height*2+1,button:n.button}}}),O(this,"onPointerHover",n=>{if(this.enabled)switch(n.pointerType){case"mouse":case"pen":this.pointerHover(this.getPointer(n));break}}),O(this,"onPointerDown",n=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="none",this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.pointerHover(this.getPointer(n)),this.pointerDown(this.getPointer(n)))}),O(this,"onPointerMove",n=>{this.enabled&&this.pointerMove(this.getPointer(n))}),O(this,"onPointerUp",n=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="",this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.pointerUp(this.getPointer(n)))}),O(this,"getMode",()=>this.mode),O(this,"setMode",n=>{this.mode=n}),O(this,"setTranslationSnap",n=>{this.translationSnap=n}),O(this,"setRotationSnap",n=>{this.rotationSnap=n}),O(this,"setScaleSnap",n=>{this.scaleSnap=n}),O(this,"setSize",n=>{this.size=n}),O(this,"setSpace",n=>{this.space=n}),O(this,"update",()=>{console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}),O(this,"connect",n=>{n===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.domElement=n,this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointermove",this.onPointerHover),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)}),O(this,"dispose",()=>{var n,i,o,r,a,h;(n=this.domElement)==null||n.removeEventListener("pointerdown",this.onPointerDown),(i=this.domElement)==null||i.removeEventListener("pointermove",this.onPointerHover),(r=(o=this.domElement)==null?void 0:o.ownerDocument)==null||r.removeEventListener("pointermove",this.onPointerMove),(h=(a=this.domElement)==null?void 0:a.ownerDocument)==null||h.removeEventListener("pointerup",this.onPointerUp),this.traverse(p=>{const d=p;d.geometry&&d.geometry.dispose(),d.material&&d.material.dispose()})}),this.domElement=t,this.camera=e,this.gizmo=new An,this.add(this.gizmo),this.plane=new Mn,this.add(this.plane);const s=(n,i)=>{let o=i;Object.defineProperty(this,n,{get:function(){return o!==void 0?o:i},set:function(r){o!==r&&(o=r,this.plane[n]=r,this.gizmo[n]=r,this.dispatchEvent({type:n+"-changed",value:r}),this.dispatchEvent(this.changeEvent))}}),this[n]=i,this.plane[n]=i,this.gizmo[n]=i};s("camera",this.camera),s("object",this.object),s("enabled",this.enabled),s("axis",this.axis),s("mode",this.mode),s("translationSnap",this.translationSnap),s("rotationSnap",this.rotationSnap),s("scaleSnap",this.scaleSnap),s("space",this.space),s("size",this.size),s("dragging",this.dragging),s("showX",this.showX),s("showY",this.showY),s("showZ",this.showZ),s("worldPosition",this.worldPosition),s("worldPositionStart",this.worldPositionStart),s("worldQuaternion",this.worldQuaternion),s("worldQuaternionStart",this.worldQuaternionStart),s("cameraPosition",this.cameraPosition),s("cameraQuaternion",this.cameraQuaternion),s("pointStart",this.pointStart),s("pointEnd",this.pointEnd),s("rotationAxis",this.rotationAxis),s("rotationAngle",this.rotationAngle),s("eye",this.eye),t!==void 0&&this.connect(t)}}class An extends c.Object3D{constructor(){super(),O(this,"isTransformControlsGizmo",!0),O(this,"type","TransformControlsGizmo"),O(this,"tempVector",new c.Vector3(0,0,0)),O(this,"tempEuler",new c.Euler),O(this,"alignVector",new c.Vector3(0,1,0)),O(this,"zeroVector",new c.Vector3(0,0,0)),O(this,"lookAtMatrix",new c.Matrix4),O(this,"tempQuaternion",new c.Quaternion),O(this,"tempQuaternion2",new c.Quaternion),O(this,"identityQuaternion",new c.Quaternion),O(this,"unitX",new c.Vector3(1,0,0)),O(this,"unitY",new c.Vector3(0,1,0)),O(this,"unitZ",new c.Vector3(0,0,1)),O(this,"gizmo"),O(this,"picker"),O(this,"helper"),O(this,"rotationAxis",new c.Vector3),O(this,"cameraPosition",new c.Vector3),O(this,"worldPositionStart",new c.Vector3),O(this,"worldQuaternionStart",new c.Quaternion),O(this,"worldPosition",new c.Vector3),O(this,"worldQuaternion",new c.Quaternion),O(this,"eye",new c.Vector3),O(this,"camera",null),O(this,"enabled",!0),O(this,"axis",null),O(this,"mode","translate"),O(this,"space","world"),O(this,"size",1),O(this,"dragging",!1),O(this,"showX",!0),O(this,"showY",!0),O(this,"showZ",!0),O(this,"updateMatrixWorld",()=>{let $=this.space;this.mode==="scale"&&($="local");const Q=$==="local"?this.worldQuaternion:this.identityQuaternion;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let K=[];K=K.concat(this.picker[this.mode].children),K=K.concat(this.gizmo[this.mode].children),K=K.concat(this.helper[this.mode].children);for(let he=0;he<K.length;he++){const C=K[he];C.visible=!0,C.rotation.set(0,0,0),C.position.copy(this.worldPosition);let fe;if(this.camera.isOrthographicCamera?fe=(this.camera.top-this.camera.bottom)/this.camera.zoom:fe=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),C.scale.set(1,1,1).multiplyScalar(fe*this.size/7),C.tag==="helper"){C.visible=!1,C.name==="AXIS"?(C.position.copy(this.worldPositionStart),C.visible=!!this.axis,this.axis==="X"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,0)),C.quaternion.copy(Q).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(Q).dot(this.eye))>.9&&(C.visible=!1)),this.axis==="Y"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,Math.PI/2)),C.quaternion.copy(Q).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(Q).dot(this.eye))>.9&&(C.visible=!1)),this.axis==="Z"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),C.quaternion.copy(Q).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(Q).dot(this.eye))>.9&&(C.visible=!1)),this.axis==="XYZE"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),this.alignVector.copy(this.rotationAxis),C.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector,this.alignVector,this.unitY)),C.quaternion.multiply(this.tempQuaternion),C.visible=this.dragging),this.axis==="E"&&(C.visible=!1)):C.name==="START"?(C.position.copy(this.worldPositionStart),C.visible=this.dragging):C.name==="END"?(C.position.copy(this.worldPosition),C.visible=this.dragging):C.name==="DELTA"?(C.position.copy(this.worldPositionStart),C.quaternion.copy(this.worldQuaternionStart),this.tempVector.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),this.tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert()),C.scale.copy(this.tempVector),C.visible=this.dragging):(C.quaternion.copy(Q),this.dragging?C.position.copy(this.worldPositionStart):C.position.copy(this.worldPosition),this.axis&&(C.visible=this.axis.search(C.name)!==-1));continue}C.quaternion.copy(Q),this.mode==="translate"||this.mode==="scale"?((C.name==="X"||C.name==="XYZX")&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(Q).dot(this.eye))>.99&&(C.scale.set(1e-10,1e-10,1e-10),C.visible=!1),(C.name==="Y"||C.name==="XYZY")&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(Q).dot(this.eye))>.99&&(C.scale.set(1e-10,1e-10,1e-10),C.visible=!1),(C.name==="Z"||C.name==="XYZZ")&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(Q).dot(this.eye))>.99&&(C.scale.set(1e-10,1e-10,1e-10),C.visible=!1),C.name==="XY"&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(Q).dot(this.eye))<.2&&(C.scale.set(1e-10,1e-10,1e-10),C.visible=!1),C.name==="YZ"&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(Q).dot(this.eye))<.2&&(C.scale.set(1e-10,1e-10,1e-10),C.visible=!1),C.name==="XZ"&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(Q).dot(this.eye))<.2&&(C.scale.set(1e-10,1e-10,1e-10),C.visible=!1),C.name.search("X")!==-1&&(this.alignVector.copy(this.unitX).applyQuaternion(Q).dot(this.eye)<0?C.tag==="fwd"?C.visible=!1:C.scale.x*=-1:C.tag==="bwd"&&(C.visible=!1)),C.name.search("Y")!==-1&&(this.alignVector.copy(this.unitY).applyQuaternion(Q).dot(this.eye)<0?C.tag==="fwd"?C.visible=!1:C.scale.y*=-1:C.tag==="bwd"&&(C.visible=!1)),C.name.search("Z")!==-1&&(this.alignVector.copy(this.unitZ).applyQuaternion(Q).dot(this.eye)<0?C.tag==="fwd"?C.visible=!1:C.scale.z*=-1:C.tag==="bwd"&&(C.visible=!1))):this.mode==="rotate"&&(this.tempQuaternion2.copy(Q),this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(Q).invert()),C.name.search("E")!==-1&&C.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye,this.zeroVector,this.unitY)),C.name==="X"&&(this.tempQuaternion.setFromAxisAngle(this.unitX,Math.atan2(-this.alignVector.y,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),C.quaternion.copy(this.tempQuaternion)),C.name==="Y"&&(this.tempQuaternion.setFromAxisAngle(this.unitY,Math.atan2(this.alignVector.x,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),C.quaternion.copy(this.tempQuaternion)),C.name==="Z"&&(this.tempQuaternion.setFromAxisAngle(this.unitZ,Math.atan2(this.alignVector.y,this.alignVector.x)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),C.quaternion.copy(this.tempQuaternion))),C.visible=C.visible&&(C.name.indexOf("X")===-1||this.showX),C.visible=C.visible&&(C.name.indexOf("Y")===-1||this.showY),C.visible=C.visible&&(C.name.indexOf("Z")===-1||this.showZ),C.visible=C.visible&&(C.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),C.material.tempOpacity=C.material.tempOpacity||C.material.opacity,C.material.tempColor=C.material.tempColor||C.material.color.clone(),C.material.color.copy(C.material.tempColor),C.material.opacity=C.material.tempOpacity,this.enabled?this.axis&&(C.name===this.axis?(C.material.opacity=1,C.material.color.lerp(new c.Color(1,1,1),.5)):this.axis.split("").some(function(xe){return C.name===xe})?(C.material.opacity=1,C.material.color.lerp(new c.Color(1,1,1),.5)):(C.material.opacity*=.25,C.material.color.lerp(new c.Color(1,1,1),.5))):(C.material.opacity*=.5,C.material.color.lerp(new c.Color(1,1,1),.5))}super.updateMatrixWorld()});const e=new c.MeshBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,side:c.DoubleSide,fog:!1,toneMapped:!1}),t=new c.LineBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:1,fog:!1,toneMapped:!1}),s=e.clone();s.opacity=.15;const n=e.clone();n.opacity=.33;const i=e.clone();i.color.set(16711680);const o=e.clone();o.color.set(65280);const r=e.clone();r.color.set(255);const a=e.clone();a.opacity=.25;const h=a.clone();h.color.set(16776960);const p=a.clone();p.color.set(65535);const d=a.clone();d.color.set(16711935),e.clone().color.set(16776960);const f=t.clone();f.color.set(16711680);const w=t.clone();w.color.set(65280);const y=t.clone();y.color.set(255);const v=t.clone();v.color.set(65535);const M=t.clone();M.color.set(16711935);const L=t.clone();L.color.set(16776960);const b=t.clone();b.color.set(7895160);const g=L.clone();g.opacity=.25;const S=new c.CylinderGeometry(0,.05,.2,12,1,!1),A=new c.BoxGeometry(.125,.125,.125),_=new c.BufferGeometry;_.setAttribute("position",new c.Float32BufferAttribute([0,0,0,1,0,0],3));const x=($,Q)=>{const K=new c.BufferGeometry,he=[];for(let C=0;C<=64*Q;++C)he.push(0,Math.cos(C/32*Math.PI)*$,Math.sin(C/32*Math.PI)*$);return K.setAttribute("position",new c.Float32BufferAttribute(he,3)),K},D=()=>{const $=new c.BufferGeometry;return $.setAttribute("position",new c.Float32BufferAttribute([0,0,0,1,1,1],3)),$},k={X:[[new c.Mesh(S,i),[1,0,0],[0,0,-Math.PI/2],null,"fwd"],[new c.Mesh(S,i),[1,0,0],[0,0,Math.PI/2],null,"bwd"],[new c.Line(_,f)]],Y:[[new c.Mesh(S,o),[0,1,0],null,null,"fwd"],[new c.Mesh(S,o),[0,1,0],[Math.PI,0,0],null,"bwd"],[new c.Line(_,w),null,[0,0,Math.PI/2]]],Z:[[new c.Mesh(S,r),[0,0,1],[Math.PI/2,0,0],null,"fwd"],[new c.Mesh(S,r),[0,0,1],[-Math.PI/2,0,0],null,"bwd"],[new c.Line(_,y),null,[0,-Math.PI/2,0]]],XYZ:[[new c.Mesh(new c.OctahedronGeometry(.1,0),a.clone()),[0,0,0],[0,0,0]]],XY:[[new c.Mesh(new c.PlaneGeometry(.295,.295),h.clone()),[.15,.15,0]],[new c.Line(_,L),[.18,.3,0],null,[.125,1,1]],[new c.Line(_,L),[.3,.18,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new c.Mesh(new c.PlaneGeometry(.295,.295),p.clone()),[0,.15,.15],[0,Math.PI/2,0]],[new c.Line(_,v),[0,.18,.3],[0,0,Math.PI/2],[.125,1,1]],[new c.Line(_,v),[0,.3,.18],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new c.Mesh(new c.PlaneGeometry(.295,.295),d.clone()),[.15,0,.15],[-Math.PI/2,0,0]],[new c.Line(_,M),[.18,0,.3],null,[.125,1,1]],[new c.Line(_,M),[.3,0,.18],[0,-Math.PI/2,0],[.125,1,1]]]},I={X:[[new c.Mesh(new c.CylinderGeometry(.2,0,1,4,1,!1),s),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new c.Mesh(new c.CylinderGeometry(.2,0,1,4,1,!1),s),[0,.6,0]]],Z:[[new c.Mesh(new c.CylinderGeometry(.2,0,1,4,1,!1),s),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new c.Mesh(new c.OctahedronGeometry(.2,0),s)]],XY:[[new c.Mesh(new c.PlaneGeometry(.4,.4),s),[.2,.2,0]]],YZ:[[new c.Mesh(new c.PlaneGeometry(.4,.4),s),[0,.2,.2],[0,Math.PI/2,0]]],XZ:[[new c.Mesh(new c.PlaneGeometry(.4,.4),s),[.2,0,.2],[-Math.PI/2,0,0]]]},B={START:[[new c.Mesh(new c.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],END:[[new c.Mesh(new c.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],DELTA:[[new c.Line(D(),n),null,null,null,"helper"]],X:[[new c.Line(_,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new c.Line(_,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new c.Line(_,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},R={X:[[new c.Line(x(1,.5),f)],[new c.Mesh(new c.OctahedronGeometry(.04,0),i),[0,0,.99],null,[1,3,1]]],Y:[[new c.Line(x(1,.5),w),null,[0,0,-Math.PI/2]],[new c.Mesh(new c.OctahedronGeometry(.04,0),o),[0,0,.99],null,[3,1,1]]],Z:[[new c.Line(x(1,.5),y),null,[0,Math.PI/2,0]],[new c.Mesh(new c.OctahedronGeometry(.04,0),r),[.99,0,0],null,[1,3,1]]],E:[[new c.Line(x(1.25,1),g),null,[0,Math.PI/2,0]],[new c.Mesh(new c.CylinderGeometry(.03,0,.15,4,1,!1),g),[1.17,0,0],[0,0,-Math.PI/2],[1,1,.001]],[new c.Mesh(new c.CylinderGeometry(.03,0,.15,4,1,!1),g),[-1.17,0,0],[0,0,Math.PI/2],[1,1,.001]],[new c.Mesh(new c.CylinderGeometry(.03,0,.15,4,1,!1),g),[0,-1.17,0],[Math.PI,0,0],[1,1,.001]],[new c.Mesh(new c.CylinderGeometry(.03,0,.15,4,1,!1),g),[0,1.17,0],[0,0,0],[1,1,.001]]],XYZE:[[new c.Line(x(1,1),b),null,[0,Math.PI/2,0]]]},H={AXIS:[[new c.Line(_,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},G={X:[[new c.Mesh(new c.TorusGeometry(1,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new c.Mesh(new c.TorusGeometry(1,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new c.Mesh(new c.TorusGeometry(1,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]],E:[[new c.Mesh(new c.TorusGeometry(1.25,.1,2,24),s)]],XYZE:[[new c.Mesh(new c.SphereGeometry(.7,10,8),s)]]},se={X:[[new c.Mesh(A,i),[.8,0,0],[0,0,-Math.PI/2]],[new c.Line(_,f),null,null,[.8,1,1]]],Y:[[new c.Mesh(A,o),[0,.8,0]],[new c.Line(_,w),null,[0,0,Math.PI/2],[.8,1,1]]],Z:[[new c.Mesh(A,r),[0,0,.8],[Math.PI/2,0,0]],[new c.Line(_,y),null,[0,-Math.PI/2,0],[.8,1,1]]],XY:[[new c.Mesh(A,h),[.85,.85,0],null,[2,2,.2]],[new c.Line(_,L),[.855,.98,0],null,[.125,1,1]],[new c.Line(_,L),[.98,.855,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new c.Mesh(A,p),[0,.85,.85],null,[.2,2,2]],[new c.Line(_,v),[0,.855,.98],[0,0,Math.PI/2],[.125,1,1]],[new c.Line(_,v),[0,.98,.855],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new c.Mesh(A,d),[.85,0,.85],null,[2,.2,2]],[new c.Line(_,M),[.855,0,.98],null,[.125,1,1]],[new c.Line(_,M),[.98,0,.855],[0,-Math.PI/2,0],[.125,1,1]]],XYZX:[[new c.Mesh(new c.BoxGeometry(.125,.125,.125),a.clone()),[1.1,0,0]]],XYZY:[[new c.Mesh(new c.BoxGeometry(.125,.125,.125),a.clone()),[0,1.1,0]]],XYZZ:[[new c.Mesh(new c.BoxGeometry(.125,.125,.125),a.clone()),[0,0,1.1]]]},X={X:[[new c.Mesh(new c.CylinderGeometry(.2,0,.8,4,1,!1),s),[.5,0,0],[0,0,-Math.PI/2]]],Y:[[new c.Mesh(new c.CylinderGeometry(.2,0,.8,4,1,!1),s),[0,.5,0]]],Z:[[new c.Mesh(new c.CylinderGeometry(.2,0,.8,4,1,!1),s),[0,0,.5],[Math.PI/2,0,0]]],XY:[[new c.Mesh(A,s),[.85,.85,0],null,[3,3,.2]]],YZ:[[new c.Mesh(A,s),[0,.85,.85],null,[.2,3,3]]],XZ:[[new c.Mesh(A,s),[.85,0,.85],null,[3,.2,3]]],XYZX:[[new c.Mesh(new c.BoxGeometry(.2,.2,.2),s),[1.1,0,0]]],XYZY:[[new c.Mesh(new c.BoxGeometry(.2,.2,.2),s),[0,1.1,0]]],XYZZ:[[new c.Mesh(new c.BoxGeometry(.2,.2,.2),s),[0,0,1.1]]]},le={X:[[new c.Line(_,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new c.Line(_,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new c.Line(_,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},oe=$=>{const Q=new c.Object3D;for(let K in $)for(let he=$[K].length;he--;){const C=$[K][he][0].clone(),fe=$[K][he][1],xe=$[K][he][2],Se=$[K][he][3],Ne=$[K][he][4];C.name=K,C.tag=Ne,fe&&C.position.set(fe[0],fe[1],fe[2]),xe&&C.rotation.set(xe[0],xe[1],xe[2]),Se&&C.scale.set(Se[0],Se[1],Se[2]),C.updateMatrix();const ut=C.geometry.clone();ut.applyMatrix4(C.matrix),C.geometry=ut,C.renderOrder=1/0,C.position.set(0,0,0),C.rotation.set(0,0,0),C.scale.set(1,1,1),Q.add(C)}return Q};this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=oe(k)),this.add(this.gizmo.rotate=oe(R)),this.add(this.gizmo.scale=oe(se)),this.add(this.picker.translate=oe(I)),this.add(this.picker.rotate=oe(G)),this.add(this.picker.scale=oe(X)),this.add(this.helper.translate=oe(B)),this.add(this.helper.rotate=oe(H)),this.add(this.helper.scale=oe(le)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}}class Mn extends c.Mesh{constructor(){super(new c.PlaneGeometry(1e5,1e5,2,2),new c.MeshBasicMaterial({visible:!1,wireframe:!0,side:c.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),O(this,"isTransformControlsPlane",!0),O(this,"type","TransformControlsPlane"),O(this,"unitX",new c.Vector3(1,0,0)),O(this,"unitY",new c.Vector3(0,1,0)),O(this,"unitZ",new c.Vector3(0,0,1)),O(this,"tempVector",new c.Vector3),O(this,"dirVector",new c.Vector3),O(this,"alignVector",new c.Vector3),O(this,"tempMatrix",new c.Matrix4),O(this,"identityQuaternion",new c.Quaternion),O(this,"cameraQuaternion",new c.Quaternion),O(this,"worldPosition",new c.Vector3),O(this,"worldQuaternion",new c.Quaternion),O(this,"eye",new c.Vector3),O(this,"axis",null),O(this,"mode","translate"),O(this,"space","world"),O(this,"updateMatrixWorld",()=>{let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),this.unitX.set(1,0,0).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.unitY.set(0,1,0).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.unitZ.set(0,0,1).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.alignVector.copy(this.unitY),this.mode){case"translate":case"scale":switch(this.axis){case"X":this.alignVector.copy(this.eye).cross(this.unitX),this.dirVector.copy(this.unitX).cross(this.alignVector);break;case"Y":this.alignVector.copy(this.eye).cross(this.unitY),this.dirVector.copy(this.unitY).cross(this.alignVector);break;case"Z":this.alignVector.copy(this.eye).cross(this.unitZ),this.dirVector.copy(this.unitZ).cross(this.alignVector);break;case"XY":this.dirVector.copy(this.unitZ);break;case"YZ":this.dirVector.copy(this.unitX);break;case"XZ":this.alignVector.copy(this.unitZ),this.dirVector.copy(this.unitY);break;case"XYZ":case"E":this.dirVector.set(0,0,0);break}break;case"rotate":default:this.dirVector.set(0,0,0)}this.dirVector.length()===0?this.quaternion.copy(this.cameraQuaternion):(this.tempMatrix.lookAt(this.tempVector.set(0,0,0),this.dirVector,this.alignVector),this.quaternion.setFromRotationMatrix(this.tempMatrix)),super.updateMatrixWorld()})}}var bn=Object.defineProperty,Sn=(l,e,t)=>e in l?bn(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t,ce=(l,e,t)=>(Sn(l,typeof e!="symbol"?e+"":e,t),t);const Qe=new c.Euler(0,0,0,"YXZ"),Ke=new c.Vector3,Tn={type:"change"},Ln={type:"lock"},Cn={type:"unlock"},ls=Math.PI/2;class bt extends c.EventDispatcher{constructor(e,t){super(),ce(this,"camera"),ce(this,"domElement"),ce(this,"isLocked"),ce(this,"minPolarAngle"),ce(this,"maxPolarAngle"),ce(this,"pointerSpeed"),ce(this,"onMouseMove",s=>{if(!this.domElement||this.isLocked===!1)return;const n=s.movementX||s.mozMovementX||s.webkitMovementX||0,i=s.movementY||s.mozMovementY||s.webkitMovementY||0;Qe.setFromQuaternion(this.camera.quaternion),Qe.y-=n*.002*this.pointerSpeed,Qe.x-=i*.002*this.pointerSpeed,Qe.x=Math.max(ls-this.maxPolarAngle,Math.min(ls-this.minPolarAngle,Qe.x)),this.camera.quaternion.setFromEuler(Qe),this.dispatchEvent(Tn)}),ce(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(Ln),this.isLocked=!0):(this.dispatchEvent(Cn),this.isLocked=!1))}),ce(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),ce(this,"connect",s=>{this.domElement=s||this.domElement,this.domElement&&(this.domElement.ownerDocument.addEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError))}),ce(this,"disconnect",()=>{this.domElement&&(this.domElement.ownerDocument.removeEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError))}),ce(this,"dispose",()=>{this.disconnect()}),ce(this,"getObject",()=>this.camera),ce(this,"direction",new c.Vector3(0,0,-1)),ce(this,"getDirection",s=>s.copy(this.direction).applyQuaternion(this.camera.quaternion)),ce(this,"moveForward",s=>{Ke.setFromMatrixColumn(this.camera.matrix,0),Ke.crossVectors(this.camera.up,Ke),this.camera.position.addScaledVector(Ke,s)}),ce(this,"moveRight",s=>{Ke.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(Ke,s)}),ce(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),ce(this,"unlock",()=>{this.domElement&&this.domElement.ownerDocument.exitPointerLock()}),this.camera=e,this.domElement=t,this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,t&&this.connect(t)}}var On=Object.defineProperty,Pn=(l,e,t)=>e in l?On(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t,E=(l,e,t)=>(Pn(l,typeof e!="symbol"?e+"":e,t),t);const cs=(l,e)=>(l%e+e)%e;class hs extends c.EventDispatcher{constructor(e,t){super(),E(this,"object"),E(this,"domElement"),E(this,"enabled",!0),E(this,"target",new c.Vector3),E(this,"minDistance",0),E(this,"maxDistance",1/0),E(this,"minZoom",0),E(this,"maxZoom",1/0),E(this,"minPolarAngle",0),E(this,"maxPolarAngle",Math.PI),E(this,"minAzimuthAngle",-1/0),E(this,"maxAzimuthAngle",1/0),E(this,"enableDamping",!1),E(this,"dampingFactor",.05),E(this,"enableZoom",!0),E(this,"zoomSpeed",1),E(this,"enableRotate",!0),E(this,"rotateSpeed",1),E(this,"enablePan",!0),E(this,"panSpeed",1),E(this,"screenSpacePanning",!0),E(this,"keyPanSpeed",7),E(this,"autoRotate",!1),E(this,"autoRotateSpeed",2),E(this,"reverseOrbit",!1),E(this,"reverseHorizontalOrbit",!1),E(this,"reverseVerticalOrbit",!1),E(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),E(this,"mouseButtons",{LEFT:c.MOUSE.ROTATE,MIDDLE:c.MOUSE.DOLLY,RIGHT:c.MOUSE.PAN}),E(this,"touches",{ONE:c.TOUCH.ROTATE,TWO:c.TOUCH.DOLLY_PAN}),E(this,"target0"),E(this,"position0"),E(this,"zoom0"),E(this,"_domElementKeyEvents",null),E(this,"getPolarAngle"),E(this,"getAzimuthalAngle"),E(this,"setPolarAngle"),E(this,"setAzimuthalAngle"),E(this,"getDistance"),E(this,"listenToKeyEvents"),E(this,"stopListenToKeyEvents"),E(this,"saveState"),E(this,"reset"),E(this,"update"),E(this,"connect"),E(this,"dispose"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>p.phi,this.getAzimuthalAngle=()=>p.theta,this.setPolarAngle=T=>{let F=cs(T,2*Math.PI),z=p.phi;z<0&&(z+=2*Math.PI),F<0&&(F+=2*Math.PI);let ee=Math.abs(F-z);2*Math.PI-ee<ee&&(F<z?F+=2*Math.PI:z+=2*Math.PI),d.phi=F-z,s.update()},this.setAzimuthalAngle=T=>{let F=cs(T,2*Math.PI),z=p.theta;z<0&&(z+=2*Math.PI),F<0&&(F+=2*Math.PI);let ee=Math.abs(F-z);2*Math.PI-ee<ee&&(F<z?F+=2*Math.PI:z+=2*Math.PI),d.theta=F-z,s.update()},this.getDistance=()=>s.object.position.distanceTo(s.target),this.listenToKeyEvents=T=>{T.addEventListener("keydown",$t),this._domElementKeyEvents=T},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",$t),this._domElementKeyEvents=null},this.saveState=()=>{s.target0.copy(s.target),s.position0.copy(s.object.position),s.zoom0=s.object.zoom},this.reset=()=>{s.target.copy(s.target0),s.object.position.copy(s.position0),s.object.zoom=s.zoom0,s.object.updateProjectionMatrix(),s.dispatchEvent(n),s.update(),a=r.NONE},this.update=(()=>{const T=new c.Vector3,F=new c.Vector3(0,1,0),z=new c.Quaternion().setFromUnitVectors(e.up,F),ee=z.clone().invert(),pe=new c.Vector3,Ze=new c.Quaternion,Ve=2*Math.PI;return function(){const sn=s.object.position;z.setFromUnitVectors(e.up,F),ee.copy(z).invert(),T.copy(sn).sub(s.target),T.applyQuaternion(z),p.setFromVector3(T),s.autoRotate&&a===r.NONE&&B(k()),s.enableDamping?(p.theta+=d.theta*s.dampingFactor,p.phi+=d.phi*s.dampingFactor):(p.theta+=d.theta,p.phi+=d.phi);let Pe=s.minAzimuthAngle,De=s.maxAzimuthAngle;return isFinite(Pe)&&isFinite(De)&&(Pe<-Math.PI?Pe+=Ve:Pe>Math.PI&&(Pe-=Ve),De<-Math.PI?De+=Ve:De>Math.PI&&(De-=Ve),Pe<=De?p.theta=Math.max(Pe,Math.min(De,p.theta)):p.theta=p.theta>(Pe+De)/2?Math.max(Pe,p.theta):Math.min(De,p.theta)),p.phi=Math.max(s.minPolarAngle,Math.min(s.maxPolarAngle,p.phi)),p.makeSafe(),p.radius*=m,p.radius=Math.max(s.minDistance,Math.min(s.maxDistance,p.radius)),s.enableDamping===!0?s.target.addScaledVector(f,s.dampingFactor):s.target.add(f),T.setFromSpherical(p),T.applyQuaternion(ee),sn.copy(s.target).add(T),s.object.lookAt(s.target),s.enableDamping===!0?(d.theta*=1-s.dampingFactor,d.phi*=1-s.dampingFactor,f.multiplyScalar(1-s.dampingFactor)):(d.set(0,0,0),f.set(0,0,0)),m=1,w||pe.distanceToSquared(s.object.position)>h||8*(1-Ze.dot(s.object.quaternion))>h?(s.dispatchEvent(n),pe.copy(s.object.position),Ze.copy(s.object.quaternion),w=!1,!0):!1}})(),this.connect=T=>{T===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),s.domElement=T,s.domElement.style.touchAction="none",s.domElement.addEventListener("contextmenu",$s),s.domElement.addEventListener("pointerdown",qs),s.domElement.addEventListener("pointercancel",Js),s.domElement.addEventListener("wheel",Hs)},this.dispose=()=>{var T,F,z,ee,pe,Ze;(T=s.domElement)==null||T.removeEventListener("contextmenu",$s),(F=s.domElement)==null||F.removeEventListener("pointerdown",qs),(z=s.domElement)==null||z.removeEventListener("pointercancel",Js),(ee=s.domElement)==null||ee.removeEventListener("wheel",Hs),(pe=s.domElement)==null||pe.ownerDocument.removeEventListener("pointermove",Jt),(Ze=s.domElement)==null||Ze.ownerDocument.removeEventListener("pointerup",Ht),s._domElementKeyEvents!==null&&s._domElementKeyEvents.removeEventListener("keydown",$t)};const s=this,n={type:"change"},i={type:"start"},o={type:"end"},r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let a=r.NONE;const h=1e-6,p=new c.Spherical,d=new c.Spherical;let m=1;const f=new c.Vector3;let w=!1;const y=new c.Vector2,v=new c.Vector2,M=new c.Vector2,L=new c.Vector2,b=new c.Vector2,g=new c.Vector2,S=new c.Vector2,A=new c.Vector2,_=new c.Vector2,x=[],D={};function k(){return 2*Math.PI/60/60*s.autoRotateSpeed}function I(){return Math.pow(.95,s.zoomSpeed)}function B(T){s.reverseOrbit||s.reverseHorizontalOrbit?d.theta+=T:d.theta-=T}function R(T){s.reverseOrbit||s.reverseVerticalOrbit?d.phi+=T:d.phi-=T}const H=(()=>{const T=new c.Vector3;return function(z,ee){T.setFromMatrixColumn(ee,0),T.multiplyScalar(-z),f.add(T)}})(),G=(()=>{const T=new c.Vector3;return function(z,ee){s.screenSpacePanning===!0?T.setFromMatrixColumn(ee,1):(T.setFromMatrixColumn(ee,0),T.crossVectors(s.object.up,T)),T.multiplyScalar(z),f.add(T)}})(),se=(()=>{const T=new c.Vector3;return function(z,ee){const pe=s.domElement;if(pe&&s.object instanceof c.PerspectiveCamera&&s.object.isPerspectiveCamera){const Ze=s.object.position;T.copy(Ze).sub(s.target);let Ve=T.length();Ve*=Math.tan(s.object.fov/2*Math.PI/180),H(2*z*Ve/pe.clientHeight,s.object.matrix),G(2*ee*Ve/pe.clientHeight,s.object.matrix)}else pe&&s.object instanceof c.OrthographicCamera&&s.object.isOrthographicCamera?(H(z*(s.object.right-s.object.left)/s.object.zoom/pe.clientWidth,s.object.matrix),G(ee*(s.object.top-s.object.bottom)/s.object.zoom/pe.clientHeight,s.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),s.enablePan=!1)}})();function X(T){s.object instanceof c.PerspectiveCamera&&s.object.isPerspectiveCamera?m/=T:s.object instanceof c.OrthographicCamera&&s.object.isOrthographicCamera?(s.object.zoom=Math.max(s.minZoom,Math.min(s.maxZoom,s.object.zoom*T)),s.object.updateProjectionMatrix(),w=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),s.enableZoom=!1)}function le(T){s.object instanceof c.PerspectiveCamera&&s.object.isPerspectiveCamera?m*=T:s.object instanceof c.OrthographicCamera&&s.object.isOrthographicCamera?(s.object.zoom=Math.max(s.minZoom,Math.min(s.maxZoom,s.object.zoom/T)),s.object.updateProjectionMatrix(),w=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),s.enableZoom=!1)}function oe(T){y.set(T.clientX,T.clientY)}function $(T){S.set(T.clientX,T.clientY)}function Q(T){L.set(T.clientX,T.clientY)}function K(T){v.set(T.clientX,T.clientY),M.subVectors(v,y).multiplyScalar(s.rotateSpeed);const F=s.domElement;F&&(B(2*Math.PI*M.x/F.clientHeight),R(2*Math.PI*M.y/F.clientHeight)),y.copy(v),s.update()}function he(T){A.set(T.clientX,T.clientY),_.subVectors(A,S),_.y>0?X(I()):_.y<0&&le(I()),S.copy(A),s.update()}function C(T){b.set(T.clientX,T.clientY),g.subVectors(b,L).multiplyScalar(s.panSpeed),se(g.x,g.y),L.copy(b),s.update()}function fe(T){T.deltaY<0?le(I()):T.deltaY>0&&X(I()),s.update()}function xe(T){let F=!1;switch(T.code){case s.keys.UP:se(0,s.keyPanSpeed),F=!0;break;case s.keys.BOTTOM:se(0,-s.keyPanSpeed),F=!0;break;case s.keys.LEFT:se(s.keyPanSpeed,0),F=!0;break;case s.keys.RIGHT:se(-s.keyPanSpeed,0),F=!0;break}F&&(T.preventDefault(),s.update())}function Se(){if(x.length==1)y.set(x[0].pageX,x[0].pageY);else{const T=.5*(x[0].pageX+x[1].pageX),F=.5*(x[0].pageY+x[1].pageY);y.set(T,F)}}function Ne(){if(x.length==1)L.set(x[0].pageX,x[0].pageY);else{const T=.5*(x[0].pageX+x[1].pageX),F=.5*(x[0].pageY+x[1].pageY);L.set(T,F)}}function ut(){const T=x[0].pageX-x[1].pageX,F=x[0].pageY-x[1].pageY,z=Math.sqrt(T*T+F*F);S.set(0,z)}function $r(){s.enableZoom&&ut(),s.enablePan&&Ne()}function ea(){s.enableZoom&&ut(),s.enableRotate&&Se()}function Qs(T){if(x.length==1)v.set(T.pageX,T.pageY);else{const z=es(T),ee=.5*(T.pageX+z.x),pe=.5*(T.pageY+z.y);v.set(ee,pe)}M.subVectors(v,y).multiplyScalar(s.rotateSpeed);const F=s.domElement;F&&(B(2*Math.PI*M.x/F.clientHeight),R(2*Math.PI*M.y/F.clientHeight)),y.copy(v)}function Ks(T){if(x.length==1)b.set(T.pageX,T.pageY);else{const F=es(T),z=.5*(T.pageX+F.x),ee=.5*(T.pageY+F.y);b.set(z,ee)}g.subVectors(b,L).multiplyScalar(s.panSpeed),se(g.x,g.y),L.copy(b)}function Ws(T){const F=es(T),z=T.pageX-F.x,ee=T.pageY-F.y,pe=Math.sqrt(z*z+ee*ee);A.set(0,pe),_.set(0,Math.pow(A.y/S.y,s.zoomSpeed)),X(_.y),S.copy(A)}function ta(T){s.enableZoom&&Ws(T),s.enablePan&&Ks(T)}function sa(T){s.enableZoom&&Ws(T),s.enableRotate&&Qs(T)}function qs(T){var F,z;s.enabled!==!1&&(x.length===0&&((F=s.domElement)==null||F.ownerDocument.addEventListener("pointermove",Jt),(z=s.domElement)==null||z.ownerDocument.addEventListener("pointerup",Ht)),aa(T),T.pointerType==="touch"?oa(T):na(T))}function Jt(T){s.enabled!==!1&&(T.pointerType==="touch"?ra(T):ia(T))}function Ht(T){var F,z,ee;en(T),x.length===0&&((F=s.domElement)==null||F.releasePointerCapture(T.pointerId),(z=s.domElement)==null||z.ownerDocument.removeEventListener("pointermove",Jt),(ee=s.domElement)==null||ee.ownerDocument.removeEventListener("pointerup",Ht)),s.dispatchEvent(o),a=r.NONE}function Js(T){en(T)}function na(T){let F;switch(T.button){case 0:F=s.mouseButtons.LEFT;break;case 1:F=s.mouseButtons.MIDDLE;break;case 2:F=s.mouseButtons.RIGHT;break;default:F=-1}switch(F){case c.MOUSE.DOLLY:if(s.enableZoom===!1)return;$(T),a=r.DOLLY;break;case c.MOUSE.ROTATE:if(T.ctrlKey||T.metaKey||T.shiftKey){if(s.enablePan===!1)return;Q(T),a=r.PAN}else{if(s.enableRotate===!1)return;oe(T),a=r.ROTATE}break;case c.MOUSE.PAN:if(T.ctrlKey||T.metaKey||T.shiftKey){if(s.enableRotate===!1)return;oe(T),a=r.ROTATE}else{if(s.enablePan===!1)return;Q(T),a=r.PAN}break;default:a=r.NONE}a!==r.NONE&&s.dispatchEvent(i)}function ia(T){if(s.enabled!==!1)switch(a){case r.ROTATE:if(s.enableRotate===!1)return;K(T);break;case r.DOLLY:if(s.enableZoom===!1)return;he(T);break;case r.PAN:if(s.enablePan===!1)return;C(T);break}}function Hs(T){s.enabled===!1||s.enableZoom===!1||a!==r.NONE&&a!==r.ROTATE||(T.preventDefault(),s.dispatchEvent(i),fe(T),s.dispatchEvent(o))}function $t(T){s.enabled===!1||s.enablePan===!1||xe(T)}function oa(T){switch(tn(T),x.length){case 1:switch(s.touches.ONE){case c.TOUCH.ROTATE:if(s.enableRotate===!1)return;Se(),a=r.TOUCH_ROTATE;break;case c.TOUCH.PAN:if(s.enablePan===!1)return;Ne(),a=r.TOUCH_PAN;break;default:a=r.NONE}break;case 2:switch(s.touches.TWO){case c.TOUCH.DOLLY_PAN:if(s.enableZoom===!1&&s.enablePan===!1)return;$r(),a=r.TOUCH_DOLLY_PAN;break;case c.TOUCH.DOLLY_ROTATE:if(s.enableZoom===!1&&s.enableRotate===!1)return;ea(),a=r.TOUCH_DOLLY_ROTATE;break;default:a=r.NONE}break;default:a=r.NONE}a!==r.NONE&&s.dispatchEvent(i)}function ra(T){switch(tn(T),a){case r.TOUCH_ROTATE:if(s.enableRotate===!1)return;Qs(T),s.update();break;case r.TOUCH_PAN:if(s.enablePan===!1)return;Ks(T),s.update();break;case r.TOUCH_DOLLY_PAN:if(s.enableZoom===!1&&s.enablePan===!1)return;ta(T),s.update();break;case r.TOUCH_DOLLY_ROTATE:if(s.enableZoom===!1&&s.enableRotate===!1)return;sa(T),s.update();break;default:a=r.NONE}}function $s(T){s.enabled!==!1&&T.preventDefault()}function aa(T){x.push(T)}function en(T){delete D[T.pointerId];for(let F=0;F<x.length;F++)if(x[F].pointerId==T.pointerId){x.splice(F,1);return}}function tn(T){let F=D[T.pointerId];F===void 0&&(F=new c.Vector2,D[T.pointerId]=F),F.set(T.pageX,T.pageY)}function es(T){const F=T.pointerId===x[0].pointerId?x[1]:x[0];return D[F.pointerId]}t!==void 0&&this.connect(t),this.update()}}class Dn extends hs{constructor(e,t){super(e,t),this.screenSpacePanning=!1,this.mouseButtons.LEFT=c.MOUSE.PAN,this.mouseButtons.RIGHT=c.MOUSE.ROTATE,this.touches.ONE=c.TOUCH.PAN,this.touches.TWO=c.TOUCH.DOLLY_ROTATE}}class In extends c.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Nn(t)}),this.register(function(t){return new Xn(t)}),this.register(function(t){return new Zn(t)}),this.register(function(t){return new Qn(t)}),this.register(function(t){return new En(t)}),this.register(function(t){return new zn(t)}),this.register(function(t){return new Rn(t)}),this.register(function(t){return new Gn(t)}),this.register(function(t){return new Un(t)}),this.register(function(t){return new Yn(t)}),this.register(function(t){return new Vn(t)}),this.register(function(t){return new jn(t)}),this.register(function(t){return new Fn(t)}),this.register(function(t){return new Kn(t)}),this.register(function(t){return new Wn(t)})}load(e,t,s,n){const i=this;let o;this.resourcePath!==""?o=this.resourcePath:this.path!==""?o=this.path:o=c.LoaderUtils.extractUrlBase(e),this.manager.itemStart(e);const r=function(h){n?n(h):console.error(h),i.manager.itemError(e),i.manager.itemEnd(e)},a=new c.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(h){try{i.parse(h,o,function(p){t(p),i.manager.itemEnd(e)},r)}catch(p){r(p)}},s,r)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s,n){let i;const o={},r={};if(typeof e=="string")i=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4)))===us){try{o[Z.KHR_BINARY_GLTF]=new qn(e)}catch(p){n&&n(p);return}i=JSON.parse(o[Z.KHR_BINARY_GLTF].content)}else i=JSON.parse(c.LoaderUtils.decodeText(new Uint8Array(e)));else i=e;if(i.asset===void 0||i.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const a=new ci(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});a.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const p=this.pluginCallbacks[h](a);r[p.name]=p,o[p.name]=!0}if(i.extensionsUsed)for(let h=0;h<i.extensionsUsed.length;++h){const p=i.extensionsUsed[h],d=i.extensionsRequired||[];switch(p){case Z.KHR_MATERIALS_UNLIT:o[p]=new Bn;break;case Z.KHR_DRACO_MESH_COMPRESSION:o[p]=new Jn(i,this.dracoLoader);break;case Z.KHR_TEXTURE_TRANSFORM:o[p]=new Hn;break;case Z.KHR_MESH_QUANTIZATION:o[p]=new $n;break;default:d.indexOf(p)>=0&&r[p]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+p+'".')}}a.setExtensions(o),a.setPlugins(r),a.parse(s,n)}parseAsync(e,t){const s=this;return new Promise(function(n,i){s.parse(e,t,n,i)})}}function kn(){let l={};return{get:function(e){return l[e]},add:function(e,t){l[e]=t},remove:function(e){delete l[e]},removeAll:function(){l={}}}}const Z={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Fn{constructor(e){this.parser=e,this.name=Z.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,n=t.length;s<n;s++){const i=t[s];i.extensions&&i.extensions[this.name]&&i.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,s="light:"+e;let n=t.cache.get(s);if(n)return n;const i=t.json,a=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e];let h;const p=new c.Color(16777215);a.color!==void 0&&p.fromArray(a.color);const d=a.range!==void 0?a.range:0;switch(a.type){case"directional":h=new c.DirectionalLight(p),h.target.position.set(0,0,-1),h.add(h.target);break;case"point":h=new c.PointLight(p),h.distance=d;break;case"spot":h=new c.SpotLight(p),h.distance=d,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle!==void 0?a.spot.innerConeAngle:0,a.spot.outerConeAngle=a.spot.outerConeAngle!==void 0?a.spot.outerConeAngle:Math.PI/4,h.angle=a.spot.outerConeAngle,h.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,h.target.position.set(0,0,-1),h.add(h.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return h.position.set(0,0,0),h.decay=2,Be(h,a),a.intensity!==void 0&&(h.intensity=a.intensity),h.name=t.createUniqueName(a.name||"light_"+e),n=Promise.resolve(h),t.cache.add(s,n),n}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,i=s.json.nodes[e],r=(i.extensions&&i.extensions[this.name]||{}).light;return r===void 0?null:this._loadLight(r).then(function(a){return s._getNodeRef(t.cache,r,a)})}}class Bn{constructor(){this.name=Z.KHR_MATERIALS_UNLIT}getMaterialType(){return c.MeshBasicMaterial}extendParams(e,t,s){const n=[];e.color=new c.Color(1,1,1),e.opacity=1;const i=t.pbrMetallicRoughness;if(i){if(Array.isArray(i.baseColorFactor)){const o=i.baseColorFactor;e.color.fromArray(o),e.opacity=o[3]}i.baseColorTexture!==void 0&&n.push(s.assignTexture(e,"map",i.baseColorTexture,3001))}return Promise.all(n)}}class Un{constructor(e){this.parser=e,this.name=Z.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return i!==void 0&&(t.emissiveIntensity=i),Promise.resolve()}}class Nn{constructor(e){this.parser=e,this.name=Z.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&i.push(s.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&i.push(s.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(i.push(s.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const r=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new c.Vector2(r,r)}return Promise.all(i)}}class Vn{constructor(e){this.parser=e,this.name=Z.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&i.push(s.assignTexture(t,"iridescenceMap",o.iridescenceTexture)),o.iridescenceIor!==void 0&&(t.iridescenceIOR=o.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),o.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=o.iridescenceThicknessMinimum),o.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=o.iridescenceThicknessMaximum),o.iridescenceThicknessTexture!==void 0&&i.push(s.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(i)}}class En{constructor(e){this.parser=e,this.name=Z.KHR_MATERIALS_SHEEN}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[];t.sheenColor=new c.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=n.extensions[this.name];return o.sheenColorFactor!==void 0&&t.sheenColor.fromArray(o.sheenColorFactor),o.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=o.sheenRoughnessFactor),o.sheenColorTexture!==void 0&&i.push(s.assignTexture(t,"sheenColorMap",o.sheenColorTexture,3001)),o.sheenRoughnessTexture!==void 0&&i.push(s.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(i)}}class zn{constructor(e){this.parser=e,this.name=Z.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&i.push(s.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(i)}}class Rn{constructor(e){this.parser=e,this.name=Z.KHR_MATERIALS_VOLUME}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&i.push(s.assignTexture(t,"thicknessMap",o.thicknessTexture)),t.attenuationDistance=o.attenuationDistance||1/0;const r=o.attenuationColor||[1,1,1];return t.attenuationColor=new c.Color(r[0],r[1],r[2]),Promise.all(i)}}class Gn{constructor(e){this.parser=e,this.name=Z.KHR_MATERIALS_IOR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.ior=i.ior!==void 0?i.ior:1.5,Promise.resolve()}}class Yn{constructor(e){this.parser=e,this.name=Z.KHR_MATERIALS_SPECULAR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&i.push(s.assignTexture(t,"specularIntensityMap",o.specularTexture));const r=o.specularColorFactor||[1,1,1];return t.specularColor=new c.Color(r[0],r[1],r[2]),o.specularColorTexture!==void 0&&i.push(s.assignTexture(t,"specularColorMap",o.specularColorTexture,3001)),Promise.all(i)}}class jn{constructor(e){this.parser=e,this.name=Z.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=[],o=n.extensions[this.name];return o.anisotropyStrength!==void 0&&(t.anisotropy=o.anisotropyStrength),o.anisotropyRotation!==void 0&&(t.anisotropyRotation=o.anisotropyRotation),o.anisotropyTexture!==void 0&&i.push(s.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(i)}}class Xn{constructor(e){this.parser=e,this.name=Z.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,n=s.textures[e];if(!n.extensions||!n.extensions[this.name])return null;const i=n.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,i.source,o)}}class Zn{constructor(e){this.parser=e,this.name=Z.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,n=s.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;const o=i.extensions[t],r=n.images[o.source];let a=s.textureLoader;if(r.uri){const h=s.options.manager.getHandler(r.uri);h!==null&&(a=h)}return this.detectSupport().then(function(h){if(h)return s.loadTextureImage(e,o.source,a);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Qn{constructor(e){this.parser=e,this.name=Z.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,n=s.json,i=n.textures[e];if(!i.extensions||!i.extensions[t])return null;const o=i.extensions[t],r=n.images[o.source];let a=s.textureLoader;if(r.uri){const h=s.options.manager.getHandler(r.uri);h!==null&&(a=h)}return this.detectSupport().then(function(h){if(h)return s.loadTextureImage(e,o.source,a);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Kn{constructor(e){this.name=Z.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const n=s.extensions[this.name],i=this.parser.getDependency("buffer",n.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(r){const a=n.byteOffset||0,h=n.byteLength||0,p=n.count,d=n.byteStride,m=new Uint8Array(r,a,h);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(p,d,m,n.mode,n.filter).then(function(f){return f.buffer}):o.ready.then(function(){const f=new ArrayBuffer(p*d);return o.decodeGltfBuffer(new Uint8Array(f),p,d,m,n.mode,n.filter),f})})}else return null}}class Wn{constructor(e){this.name=Z.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const n=t.meshes[s.mesh];for(const h of n.primitives)if(h.mode!==ye.TRIANGLES&&h.mode!==ye.TRIANGLE_STRIP&&h.mode!==ye.TRIANGLE_FAN&&h.mode!==void 0)return null;const o=s.extensions[this.name].attributes,r=[],a={};for(const h in o)r.push(this.parser.getDependency("accessor",o[h]).then(p=>(a[h]=p,a[h])));return r.length<1?null:(r.push(this.parser.createNodeMesh(e)),Promise.all(r).then(h=>{const p=h.pop(),d=p.isGroup?p.children:[p],m=h[0].count,f=[];for(const w of d){const y=new c.Matrix4,v=new c.Vector3,M=new c.Quaternion,L=new c.Vector3(1,1,1),b=new c.InstancedMesh(w.geometry,w.material,m);for(let g=0;g<m;g++)a.TRANSLATION&&v.fromBufferAttribute(a.TRANSLATION,g),a.ROTATION&&M.fromBufferAttribute(a.ROTATION,g),a.SCALE&&L.fromBufferAttribute(a.SCALE,g),b.setMatrixAt(g,y.compose(v,M,L));for(const g in a)g!=="TRANSLATION"&&g!=="ROTATION"&&g!=="SCALE"&&w.geometry.setAttribute(g,a[g]);c.Object3D.prototype.copy.call(b,w),this.parser.assignFinalMaterial(b),f.push(b)}return p.isGroup?(p.clear(),p.add(...f),p):f[0]}))}}const us="glTF",nt=12,ps={JSON:1313821514,BIN:5130562};class qn{constructor(e){this.name=Z.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,nt);if(this.header={magic:c.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==us)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-nt,n=new DataView(e,nt);let i=0;for(;i<s;){const o=n.getUint32(i,!0);i+=4;const r=n.getUint32(i,!0);if(i+=4,r===ps.JSON){const a=new Uint8Array(e,nt+i,o);this.content=c.LoaderUtils.decodeText(a)}else if(r===ps.BIN){const a=nt+i;this.body=e.slice(a,a+o)}i+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Jn{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Z.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const s=this.json,n=this.dracoLoader,i=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,r={},a={},h={};for(const p in o){const d=Tt[p]||p.toLowerCase();r[d]=o[p]}for(const p in e.attributes){const d=Tt[p]||p.toLowerCase();if(o[p]!==void 0){const m=s.accessors[e.attributes[p]],f=We[m.componentType];h[d]=f.name,a[d]=m.normalized===!0}}return t.getDependency("bufferView",i).then(function(p){return new Promise(function(d){n.decodeDracoFile(p,function(m){for(const f in m.attributes){const w=m.attributes[f],y=a[f];y!==void 0&&(w.normalized=y)}d(m)},r,h)})})}}class Hn{constructor(){this.name=Z.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class $n{constructor(){this.name=Z.KHR_MESH_QUANTIZATION}}class ds extends c.Interpolant{constructor(e,t,s,n){super(e,t,s,n)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,n=this.valueSize,i=e*n*3+n;for(let o=0;o!==n;o++)t[o]=s[i+o];return t}interpolate_(e,t,s,n){const i=this.resultBuffer,o=this.sampleValues,r=this.valueSize,a=r*2,h=r*3,p=n-t,d=(s-t)/p,m=d*d,f=m*d,w=e*h,y=w-h,v=-2*f+3*m,M=f-m,L=1-v,b=M-m+d;for(let g=0;g!==r;g++){const S=o[y+g+r],A=o[y+g+a]*p,_=o[w+g+r],x=o[w+g]*p;i[g]=L*S+b*A+v*_+M*x}return i}}const ei=new c.Quaternion;class ti extends ds{interpolate_(e,t,s,n){const i=super.interpolate_(e,t,s,n);return ei.fromArray(i).normalize().toArray(i),i}}const ye={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},We={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ms={9728:c.NearestFilter,9729:c.LinearFilter,9984:c.NearestMipmapNearestFilter,9985:c.LinearMipmapNearestFilter,9986:c.NearestMipmapLinearFilter,9987:c.LinearMipmapLinearFilter},fs={33071:c.ClampToEdgeWrapping,33648:c.MirroredRepeatWrapping,10497:c.RepeatWrapping},St={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Tt={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...c.REVISION.replace(/\D+/g,"")>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Fe={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},si={CUBICSPLINE:void 0,LINEAR:c.InterpolateLinear,STEP:c.InterpolateDiscrete},Lt={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function ni(l){return l.DefaultMaterial===void 0&&(l.DefaultMaterial=new c.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:c.FrontSide})),l.DefaultMaterial}function Ee(l,e,t){for(const s in t.extensions)l[s]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[s]=t.extensions[s])}function Be(l,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(l.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function ii(l,e,t){let s=!1,n=!1,i=!1;for(let h=0,p=e.length;h<p;h++){const d=e[h];if(d.POSITION!==void 0&&(s=!0),d.NORMAL!==void 0&&(n=!0),d.COLOR_0!==void 0&&(i=!0),s&&n&&i)break}if(!s&&!n&&!i)return Promise.resolve(l);const o=[],r=[],a=[];for(let h=0,p=e.length;h<p;h++){const d=e[h];if(s){const m=d.POSITION!==void 0?t.getDependency("accessor",d.POSITION):l.attributes.position;o.push(m)}if(n){const m=d.NORMAL!==void 0?t.getDependency("accessor",d.NORMAL):l.attributes.normal;r.push(m)}if(i){const m=d.COLOR_0!==void 0?t.getDependency("accessor",d.COLOR_0):l.attributes.color;a.push(m)}}return Promise.all([Promise.all(o),Promise.all(r),Promise.all(a)]).then(function(h){const p=h[0],d=h[1],m=h[2];return s&&(l.morphAttributes.position=p),n&&(l.morphAttributes.normal=d),i&&(l.morphAttributes.color=m),l.morphTargetsRelative=!0,l})}function oi(l,e){if(l.updateMorphTargets(),e.weights!==void 0)for(let t=0,s=e.weights.length;t<s;t++)l.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(l.morphTargetInfluences.length===t.length){l.morphTargetDictionary={};for(let s=0,n=t.length;s<n;s++)l.morphTargetDictionary[t[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function ri(l){let e;const t=l.extensions&&l.extensions[Z.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Ct(t.attributes):e=l.indices+":"+Ct(l.attributes)+":"+l.mode,l.targets!==void 0)for(let s=0,n=l.targets.length;s<n;s++)e+=":"+Ct(l.targets[s]);return e}function Ct(l){let e="";const t=Object.keys(l).sort();for(let s=0,n=t.length;s<n;s++)e+=t[s]+":"+l[t[s]]+";";return e}function Ot(l){switch(l){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function ai(l){return l.search(/\.jpe?g($|\?)/i)>0||l.search(/^data\:image\/jpeg/)===0?"image/jpeg":l.search(/\.webp($|\?)/i)>0||l.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const li=new c.Matrix4;class ci{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new kn,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,n=!1,i=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(s=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,n=navigator.userAgent.indexOf("Firefox")>-1,i=n?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||s||n&&i<98?this.textureLoader=new c.TextureLoader(this.options.manager):this.textureLoader=new c.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new c.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const s=this,n=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(o){const r={scene:o[0][n.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:n.asset,parser:s,userData:{}};Ee(i,r,n),Be(r,n),Promise.all(s._invokeAll(function(a){return a.afterRoot&&a.afterRoot(r)})).then(function(){e(r)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let n=0,i=t.length;n<i;n++){const o=t[n].joints;for(let r=0,a=o.length;r<a;r++)e[o[r]].isBone=!0}for(let n=0,i=e.length;n<i;n++){const o=e[n];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(s[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,s){if(e.refs[t]<=1)return s;const n=s.clone(),i=(o,r)=>{const a=this.associations.get(o);a!=null&&this.associations.set(r,a);for(const[h,p]of o.children.entries())i(p,r.children[h])};return i(s,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const n=e(t[s]);if(n)return n}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let n=0;n<t.length;n++){const i=e(t[n]);i&&s.push(i)}return s}getDependency(e,t){const s=e+":"+t;let n=this.cache.get(s);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(i){return i.loadNode&&i.loadNode(t)});break;case"mesh":n=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(e,t)}),!n)throw new Error("Unknown type: "+e);break}this.cache.add(s,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,n=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(n.map(function(i,o){return s.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],s=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Z.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(i,o){s.load(c.LoaderUtils.resolveURL(t.uri,n.path),i,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(s){const n=t.byteLength||0,i=t.byteOffset||0;return s.slice(i,i+n)})}loadAccessor(e){const t=this,s=this.json,n=this.json.accessors[e];if(n.bufferView===void 0&&n.sparse===void 0){const o=St[n.type],r=We[n.componentType],a=n.normalized===!0,h=new r(n.count*o);return Promise.resolve(new c.BufferAttribute(h,o,a))}const i=[];return n.bufferView!==void 0?i.push(this.getDependency("bufferView",n.bufferView)):i.push(null),n.sparse!==void 0&&(i.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(i).then(function(o){const r=o[0],a=St[n.type],h=We[n.componentType],p=h.BYTES_PER_ELEMENT,d=p*a,m=n.byteOffset||0,f=n.bufferView!==void 0?s.bufferViews[n.bufferView].byteStride:void 0,w=n.normalized===!0;let y,v;if(f&&f!==d){const M=Math.floor(m/f),L="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+M+":"+n.count;let b=t.cache.get(L);b||(y=new h(r,M*f,n.count*f/p),b=new c.InterleavedBuffer(y,f/p),t.cache.add(L,b)),v=new c.InterleavedBufferAttribute(b,a,m%f/p,w)}else r===null?y=new h(n.count*a):y=new h(r,m,n.count*a),v=new c.BufferAttribute(y,a,w);if(n.sparse!==void 0){const M=St.SCALAR,L=We[n.sparse.indices.componentType],b=n.sparse.indices.byteOffset||0,g=n.sparse.values.byteOffset||0,S=new L(o[1],b,n.sparse.count*M),A=new h(o[2],g,n.sparse.count*a);r!==null&&(v=new c.BufferAttribute(v.array.slice(),v.itemSize,v.normalized));for(let _=0,x=S.length;_<x;_++){const D=S[_];if(v.setX(D,A[_*a]),a>=2&&v.setY(D,A[_*a+1]),a>=3&&v.setZ(D,A[_*a+2]),a>=4&&v.setW(D,A[_*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return v})}loadTexture(e){const t=this.json,s=this.options,i=t.textures[e].source,o=t.images[i];let r=this.textureLoader;if(o.uri){const a=s.manager.getHandler(o.uri);a!==null&&(r=a)}return this.loadTextureImage(e,i,r)}loadTextureImage(e,t,s){const n=this,i=this.json,o=i.textures[e],r=i.images[t],a=(r.uri||r.bufferView)+":"+o.sampler;if(this.textureCache[a])return this.textureCache[a];const h=this.loadImageSource(t,s).then(function(p){p.flipY=!1,p.name=o.name||r.name||"",p.name===""&&typeof r.uri=="string"&&r.uri.startsWith("data:image/")===!1&&(p.name=r.uri);const m=(i.samplers||{})[o.sampler]||{};return p.magFilter=ms[m.magFilter]||c.LinearFilter,p.minFilter=ms[m.minFilter]||c.LinearMipmapLinearFilter,p.wrapS=fs[m.wrapS]||c.RepeatWrapping,p.wrapT=fs[m.wrapT]||c.RepeatWrapping,n.associations.set(p,{textures:e}),p}).catch(function(){return null});return this.textureCache[a]=h,h}loadImageSource(e,t){const s=this,n=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(d=>d.clone());const o=n.images[e],r=self.URL||self.webkitURL;let a=o.uri||"",h=!1;if(o.bufferView!==void 0)a=s.getDependency("bufferView",o.bufferView).then(function(d){h=!0;const m=new Blob([d],{type:o.mimeType});return a=r.createObjectURL(m),a});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const p=Promise.resolve(a).then(function(d){return new Promise(function(m,f){let w=m;t.isImageBitmapLoader===!0&&(w=function(y){const v=new c.Texture(y);v.needsUpdate=!0,m(v)}),t.load(c.LoaderUtils.resolveURL(d,i.path),w,void 0,f)})}).then(function(d){return h===!0&&r.revokeObjectURL(a),d.userData.mimeType=o.mimeType||ai(o.uri),d}).catch(function(d){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),d});return this.sourceCache[e]=p,p}assignTexture(e,t,s,n){const i=this;return this.getDependency("texture",s.index).then(function(o){if(!o)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(o=o.clone(),o.channel=s.texCoord),i.extensions[Z.KHR_TEXTURE_TRANSFORM]){const r=s.extensions!==void 0?s.extensions[Z.KHR_TEXTURE_TRANSFORM]:void 0;if(r){const a=i.associations.get(o);o=i.extensions[Z.KHR_TEXTURE_TRANSFORM].extendTexture(o,r),i.associations.set(o,a)}}return n!==void 0&&("colorSpace"in o?o.colorSpace=n===3001?"srgb":"srgb-linear":o.encoding=n),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const n=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const r="PointsMaterial:"+s.uuid;let a=this.cache.get(r);a||(a=new c.PointsMaterial,c.Material.prototype.copy.call(a,s),a.color.copy(s.color),a.map=s.map,a.sizeAttenuation=!1,this.cache.add(r,a)),s=a}else if(e.isLine){const r="LineBasicMaterial:"+s.uuid;let a=this.cache.get(r);a||(a=new c.LineBasicMaterial,c.Material.prototype.copy.call(a,s),a.color.copy(s.color),a.map=s.map,this.cache.add(r,a)),s=a}if(n||i||o){let r="ClonedMaterial:"+s.uuid+":";n&&(r+="derivative-tangents:"),i&&(r+="vertex-colors:"),o&&(r+="flat-shading:");let a=this.cache.get(r);a||(a=s.clone(),i&&(a.vertexColors=!0),o&&(a.flatShading=!0),n&&(a.normalScale&&(a.normalScale.y*=-1),a.clearcoatNormalScale&&(a.clearcoatNormalScale.y*=-1)),this.cache.add(r,a),this.associations.set(a,this.associations.get(s))),s=a}e.material=s}getMaterialType(){return c.MeshStandardMaterial}loadMaterial(e){const t=this,s=this.json,n=this.extensions,i=s.materials[e];let o;const r={},a=i.extensions||{},h=[];if(a[Z.KHR_MATERIALS_UNLIT]){const d=n[Z.KHR_MATERIALS_UNLIT];o=d.getMaterialType(),h.push(d.extendParams(r,i,t))}else{const d=i.pbrMetallicRoughness||{};if(r.color=new c.Color(1,1,1),r.opacity=1,Array.isArray(d.baseColorFactor)){const m=d.baseColorFactor;r.color.fromArray(m),r.opacity=m[3]}d.baseColorTexture!==void 0&&h.push(t.assignTexture(r,"map",d.baseColorTexture,3001)),r.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,r.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(h.push(t.assignTexture(r,"metalnessMap",d.metallicRoughnessTexture)),h.push(t.assignTexture(r,"roughnessMap",d.metallicRoughnessTexture))),o=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(e)}),h.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(e,r)})))}i.doubleSided===!0&&(r.side=c.DoubleSide);const p=i.alphaMode||Lt.OPAQUE;if(p===Lt.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,p===Lt.MASK&&(r.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&o!==c.MeshBasicMaterial&&(h.push(t.assignTexture(r,"normalMap",i.normalTexture)),r.normalScale=new c.Vector2(1,1),i.normalTexture.scale!==void 0)){const d=i.normalTexture.scale;r.normalScale.set(d,d)}return i.occlusionTexture!==void 0&&o!==c.MeshBasicMaterial&&(h.push(t.assignTexture(r,"aoMap",i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(r.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&o!==c.MeshBasicMaterial&&(r.emissive=new c.Color().fromArray(i.emissiveFactor)),i.emissiveTexture!==void 0&&o!==c.MeshBasicMaterial&&h.push(t.assignTexture(r,"emissiveMap",i.emissiveTexture,3001)),Promise.all(h).then(function(){const d=new o(r);return i.name&&(d.name=i.name),Be(d,i),t.associations.set(d,{materials:e}),i.extensions&&Ee(n,d,i),d})}createUniqueName(e){const t=c.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,s=this.extensions,n=this.primitiveCache;function i(r){return s[Z.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(r,t).then(function(a){return gs(a,r,t)})}const o=[];for(let r=0,a=e.length;r<a;r++){const h=e[r],p=ri(h),d=n[p];if(d)o.push(d.promise);else{let m;h.extensions&&h.extensions[Z.KHR_DRACO_MESH_COMPRESSION]?m=i(h):m=gs(new c.BufferGeometry,h,t),n[p]={primitive:h,promise:m},o.push(m)}}return Promise.all(o)}loadMesh(e){const t=this,s=this.json,n=this.extensions,i=s.meshes[e],o=i.primitives,r=[];for(let a=0,h=o.length;a<h;a++){const p=o[a].material===void 0?ni(this.cache):this.getDependency("material",o[a].material);r.push(p)}return r.push(t.loadGeometries(o)),Promise.all(r).then(function(a){const h=a.slice(0,a.length-1),p=a[a.length-1],d=[];for(let f=0,w=p.length;f<w;f++){const y=p[f],v=o[f];let M;const L=h[f];if(v.mode===ye.TRIANGLES||v.mode===ye.TRIANGLE_STRIP||v.mode===ye.TRIANGLE_FAN||v.mode===void 0)M=i.isSkinnedMesh===!0?new c.SkinnedMesh(y,L):new c.Mesh(y,L),M.isSkinnedMesh===!0&&M.normalizeSkinWeights(),v.mode===ye.TRIANGLE_STRIP?M.geometry=ts(M.geometry,c.TriangleStripDrawMode):v.mode===ye.TRIANGLE_FAN&&(M.geometry=ts(M.geometry,c.TriangleFanDrawMode));else if(v.mode===ye.LINES)M=new c.LineSegments(y,L);else if(v.mode===ye.LINE_STRIP)M=new c.Line(y,L);else if(v.mode===ye.LINE_LOOP)M=new c.LineLoop(y,L);else if(v.mode===ye.POINTS)M=new c.Points(y,L);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+v.mode);Object.keys(M.geometry.morphAttributes).length>0&&oi(M,i),M.name=t.createUniqueName(i.name||"mesh_"+e),Be(M,i),v.extensions&&Ee(n,M,v),t.assignFinalMaterial(M),d.push(M)}for(let f=0,w=d.length;f<w;f++)t.associations.set(d[f],{meshes:e,primitives:f});if(d.length===1)return i.extensions&&Ee(n,d[0],i),d[0];const m=new c.Group;i.extensions&&Ee(n,m,i),t.associations.set(m,{meshes:e});for(let f=0,w=d.length;f<w;f++)m.add(d[f]);return m})}loadCamera(e){let t;const s=this.json.cameras[e],n=s[s.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?t=new c.PerspectiveCamera(c.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):s.type==="orthographic"&&(t=new c.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),Be(t,s),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],s=[];for(let n=0,i=t.joints.length;n<i;n++)s.push(this._loadNodeShallow(t.joints[n]));return t.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(n){const i=n.pop(),o=n,r=[],a=[];for(let h=0,p=o.length;h<p;h++){const d=o[h];if(d){r.push(d);const m=new c.Matrix4;i!==null&&m.fromArray(i.array,h*16),a.push(m)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[h])}return new c.Skeleton(r,a)})}loadAnimation(e){const s=this.json.animations[e],n=s.name?s.name:"animation_"+e,i=[],o=[],r=[],a=[],h=[];for(let p=0,d=s.channels.length;p<d;p++){const m=s.channels[p],f=s.samplers[m.sampler],w=m.target,y=w.node,v=s.parameters!==void 0?s.parameters[f.input]:f.input,M=s.parameters!==void 0?s.parameters[f.output]:f.output;w.node!==void 0&&(i.push(this.getDependency("node",y)),o.push(this.getDependency("accessor",v)),r.push(this.getDependency("accessor",M)),a.push(f),h.push(w))}return Promise.all([Promise.all(i),Promise.all(o),Promise.all(r),Promise.all(a),Promise.all(h)]).then(function(p){const d=p[0],m=p[1],f=p[2],w=p[3],y=p[4],v=[];for(let M=0,L=d.length;M<L;M++){const b=d[M],g=m[M],S=f[M],A=w[M],_=y[M];if(b===void 0)continue;b.updateMatrix();let x;switch(Fe[_.path]){case Fe.weights:x=c.NumberKeyframeTrack;break;case Fe.rotation:x=c.QuaternionKeyframeTrack;break;case Fe.position:case Fe.scale:default:x=c.VectorKeyframeTrack;break}const D=b.name?b.name:b.uuid,k=A.interpolation!==void 0?si[A.interpolation]:c.InterpolateLinear,I=[];Fe[_.path]===Fe.weights?b.traverse(function(R){R.morphTargetInfluences&&I.push(R.name?R.name:R.uuid)}):I.push(D);let B=S.array;if(S.normalized){const R=Ot(B.constructor),H=new Float32Array(B.length);for(let G=0,se=B.length;G<se;G++)H[G]=B[G]*R;B=H}for(let R=0,H=I.length;R<H;R++){const G=new x(I[R]+"."+Fe[_.path],g.array,B,k);A.interpolation==="CUBICSPLINE"&&(G.createInterpolant=function(X){const le=this instanceof c.QuaternionKeyframeTrack?ti:ds;return new le(this.times,this.values,this.getValueSize()/3,X)},G.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),v.push(G)}}return new c.AnimationClip(n,void 0,v)})}createNodeMesh(e){const t=this.json,s=this,n=t.nodes[e];return n.mesh===void 0?null:s.getDependency("mesh",n.mesh).then(function(i){const o=s._getNodeRef(s.meshCache,n.mesh,i);return n.weights!==void 0&&o.traverse(function(r){if(r.isMesh)for(let a=0,h=n.weights.length;a<h;a++)r.morphTargetInfluences[a]=n.weights[a]}),o})}loadNode(e){const t=this.json,s=this,n=t.nodes[e],i=s._loadNodeShallow(e),o=[],r=n.children||[];for(let h=0,p=r.length;h<p;h++)o.push(s.getDependency("node",r[h]));const a=n.skin===void 0?Promise.resolve(null):s.getDependency("skin",n.skin);return Promise.all([i,Promise.all(o),a]).then(function(h){const p=h[0],d=h[1],m=h[2];m!==null&&p.traverse(function(f){f.isSkinnedMesh&&f.bind(m,li)});for(let f=0,w=d.length;f<w;f++)p.add(d[f]);return p})}_loadNodeShallow(e){const t=this.json,s=this.extensions,n=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const i=t.nodes[e],o=i.name?n.createUniqueName(i.name):"",r=[],a=n._invokeOne(function(h){return h.createNodeMesh&&h.createNodeMesh(e)});return a&&r.push(a),i.camera!==void 0&&r.push(n.getDependency("camera",i.camera).then(function(h){return n._getNodeRef(n.cameraCache,i.camera,h)})),n._invokeAll(function(h){return h.createNodeAttachment&&h.createNodeAttachment(e)}).forEach(function(h){r.push(h)}),this.nodeCache[e]=Promise.all(r).then(function(h){let p;if(i.isBone===!0?p=new c.Bone:h.length>1?p=new c.Group:h.length===1?p=h[0]:p=new c.Object3D,p!==h[0])for(let d=0,m=h.length;d<m;d++)p.add(h[d]);if(i.name&&(p.userData.name=i.name,p.name=o),Be(p,i),i.extensions&&Ee(s,p,i),i.matrix!==void 0){const d=new c.Matrix4;d.fromArray(i.matrix),p.applyMatrix4(d)}else i.translation!==void 0&&p.position.fromArray(i.translation),i.rotation!==void 0&&p.quaternion.fromArray(i.rotation),i.scale!==void 0&&p.scale.fromArray(i.scale);return n.associations.has(p)||n.associations.set(p,{}),n.associations.get(p).nodes=e,p}),this.nodeCache[e]}loadScene(e){const t=this.extensions,s=this.json.scenes[e],n=this,i=new c.Group;s.name&&(i.name=n.createUniqueName(s.name)),Be(i,s),s.extensions&&Ee(t,i,s);const o=s.nodes||[],r=[];for(let a=0,h=o.length;a<h;a++)r.push(n.getDependency("node",o[a]));return Promise.all(r).then(function(a){for(let p=0,d=a.length;p<d;p++)i.add(a[p]);const h=p=>{const d=new Map;for(const[m,f]of n.associations)(m instanceof c.Material||m instanceof c.Texture)&&d.set(m,f);return p.traverse(m=>{const f=n.associations.get(m);f!=null&&d.set(m,f)}),d};return n.associations=h(i),i})}}function hi(l,e,t){const s=e.attributes,n=new c.Box3;if(s.POSITION!==void 0){const r=t.json.accessors[s.POSITION],a=r.min,h=r.max;if(a!==void 0&&h!==void 0){if(n.set(new c.Vector3(a[0],a[1],a[2]),new c.Vector3(h[0],h[1],h[2])),r.normalized){const p=Ot(We[r.componentType]);n.min.multiplyScalar(p),n.max.multiplyScalar(p)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const i=e.targets;if(i!==void 0){const r=new c.Vector3,a=new c.Vector3;for(let h=0,p=i.length;h<p;h++){const d=i[h];if(d.POSITION!==void 0){const m=t.json.accessors[d.POSITION],f=m.min,w=m.max;if(f!==void 0&&w!==void 0){if(a.setX(Math.max(Math.abs(f[0]),Math.abs(w[0]))),a.setY(Math.max(Math.abs(f[1]),Math.abs(w[1]))),a.setZ(Math.max(Math.abs(f[2]),Math.abs(w[2]))),m.normalized){const y=Ot(We[m.componentType]);a.multiplyScalar(y)}r.max(a)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(r)}l.boundingBox=n;const o=new c.Sphere;n.getCenter(o.center),o.radius=n.min.distanceTo(n.max)/2,l.boundingSphere=o}function gs(l,e,t){const s=e.attributes,n=[];function i(o,r){return t.getDependency("accessor",o).then(function(a){l.setAttribute(r,a)})}for(const o in s){const r=Tt[o]||o.toLowerCase();r in l.attributes||n.push(i(s[o],r))}if(e.indices!==void 0&&!l.index){const o=t.getDependency("accessor",e.indices).then(function(r){l.setIndex(r)});n.push(o)}return Be(l,e),hi(l,e,t),Promise.all(n).then(function(){return e.targets!==void 0?ii(l,e.targets,t):l})}class ys extends c.ExtrudeGeometry{constructor(e,t={}){const{bevelEnabled:s=!1,bevelSize:n=8,bevelThickness:i=10,font:o,height:r=50,size:a=100,lineHeight:h=1,letterSpacing:p=0,...d}=t;if(o===void 0)super();else{const m=o.generateShapes(e,a,{lineHeight:h,letterSpacing:p});super(m,{...d,bevelEnabled:s,bevelSize:n,bevelThickness:i,depth:r})}this.type="TextGeometry"}}const ui={uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:`
|
|
8
|
+
(function($,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("vue"),require("three"),require("@tresjs/core"),require("tweakpane")):typeof define=="function"&&define.amd?define(["exports","vue","three","@tresjs/core","tweakpane"],u):($=typeof globalThis<"u"?globalThis:$||self,u($.trescientos={},$.Vue,$.Three,$.TresjsCore,$.tweakpane))})(this,function($,u,l,ge,mn){"use strict";var ya=Object.defineProperty;var _a=($,u,l)=>u in $?ya($,u,{enumerable:!0,configurable:!0,writable:!0,value:l}):$[u]=l;var Me=($,u,l)=>(_a($,typeof u!="symbol"?u+"":u,l),l);function _s(c,e){if(e===l.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),c;if(e===l.TriangleFanDrawMode||e===l.TriangleStripDrawMode){let t=c.getIndex();if(t===null){const i=[],r=c.getAttribute("position");if(r!==void 0){for(let a=0;a<r.count;a++)i.push(a);c.setIndex(i),t=c.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),c}const s=t.count-2,n=[];if(t)if(e===l.TriangleFanDrawMode)for(let i=1;i<=s;i++)n.push(t.getX(0)),n.push(t.getX(i)),n.push(t.getX(i+1));else for(let i=0;i<s;i++)i%2===0?(n.push(t.getX(i)),n.push(t.getX(i+1)),n.push(t.getX(i+2))):(n.push(t.getX(i+2)),n.push(t.getX(i+1)),n.push(t.getX(i)));n.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const o=c.clone();return o.setIndex(n),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),c}var De=Uint8Array,Qe=Uint16Array,zt=Uint32Array,ws=new De([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),xs=new De([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),gn=new De([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bs=function(c,e){for(var t=new Qe(31),s=0;s<31;++s)t[s]=e+=1<<c[s-1];for(var n=new zt(t[30]),s=1;s<30;++s)for(var o=t[s];o<t[s+1];++o)n[o]=o-t[s]<<5|s;return[t,n]},vs=bs(ws,2),As=vs[0],yn=vs[1];As[28]=258,yn[258]=28;for(var _n=bs(xs,0),wn=_n[0],Rt=new Qe(32768),be=0;be<32768;++be){var Ke=(be&43690)>>>1|(be&21845)<<1;Ke=(Ke&52428)>>>2|(Ke&13107)<<2,Ke=(Ke&61680)>>>4|(Ke&3855)<<4,Rt[be]=((Ke&65280)>>>8|(Ke&255)<<8)>>>1}for(var gt=function(c,e,t){for(var s=c.length,n=0,o=new Qe(e);n<s;++n)++o[c[n]-1];var i=new Qe(e);for(n=0;n<e;++n)i[n]=i[n-1]+o[n-1]<<1;var r;if(t){r=new Qe(1<<e);var a=15-e;for(n=0;n<s;++n)if(c[n])for(var h=n<<4|c[n],d=e-c[n],p=i[c[n]-1]++<<d,m=p|(1<<d)-1;p<=m;++p)r[Rt[p]>>>a]=h}else for(r=new Qe(s),n=0;n<s;++n)c[n]&&(r[n]=Rt[i[c[n]-1]++]>>>15-c[n]);return r},yt=new De(288),be=0;be<144;++be)yt[be]=8;for(var be=144;be<256;++be)yt[be]=9;for(var be=256;be<280;++be)yt[be]=7;for(var be=280;be<288;++be)yt[be]=8;for(var Ms=new De(32),be=0;be<32;++be)Ms[be]=5;var xn=gt(yt,9,1),bn=gt(Ms,5,1),Gt=function(c){for(var e=c[0],t=1;t<c.length;++t)c[t]>e&&(e=c[t]);return e},Ne=function(c,e,t){var s=e/8|0;return(c[s]|c[s+1]<<8)>>(e&7)&t},Et=function(c,e){var t=e/8|0;return(c[t]|c[t+1]<<8|c[t+2]<<16)>>(e&7)},vn=function(c){return(c/8|0)+(c&7&&1)},An=function(c,e,t){(e==null||e<0)&&(e=0),(t==null||t>c.length)&&(t=c.length);var s=new(c instanceof Qe?Qe:c instanceof zt?zt:De)(t-e);return s.set(c.subarray(e,t)),s},Mn=function(c,e,t){var s=c.length;if(!s||t&&!t.l&&s<5)return e||new De(0);var n=!e||t,o=!t||t.i;t||(t={}),e||(e=new De(s*3));var i=function(E){var P=e.length;if(E>P){var j=new De(Math.max(P*2,E));j.set(e),e=j}},r=t.f||0,a=t.p||0,h=t.b||0,d=t.l,p=t.d,m=t.m,g=t.n,A=s*8;do{if(!d){t.f=r=Ne(c,a,1);var b=Ne(c,a+1,3);if(a+=3,b)if(b==1)d=xn,p=bn,m=9,g=5;else if(b==2){var w=Ne(c,a,31)+257,y=Ne(c,a+10,15)+4,C=w+Ne(c,a+5,31)+1;a+=14;for(var T=new De(C),x=new De(19),v=0;v<y;++v)x[gn[v]]=Ne(c,a+v*3,7);a+=y*3;for(var D=Gt(x),z=(1<<D)-1,U=gt(x,D,1),v=0;v<C;){var R=U[Ne(c,a,z)];a+=R&15;var _=R>>>4;if(_<16)T[v++]=_;else{var K=0,J=0;for(_==16?(J=3+Ne(c,a,3),a+=2,K=T[v-1]):_==17?(J=3+Ne(c,a,7),a+=3):_==18&&(J=11+Ne(c,a,127),a+=7);J--;)T[v++]=K}}var Q=T.subarray(0,w),pe=T.subarray(w);m=Gt(Q),g=Gt(pe),d=gt(Q,m,1),p=gt(pe,g,1)}else throw"invalid block type";else{var _=vn(a)+4,M=c[_-4]|c[_-3]<<8,L=_+M;if(L>s){if(o)throw"unexpected EOF";break}n&&i(h+M),e.set(c.subarray(_,L),h),t.b=h+=M,t.p=a=L*8;continue}if(a>A){if(o)throw"unexpected EOF";break}}n&&i(h+131072);for(var Z=(1<<m)-1,G=(1<<g)-1,ce=a;;ce=a){var K=d[Et(c,a)&Z],se=K>>>4;if(a+=K&15,a>A){if(o)throw"unexpected EOF";break}if(!K)throw"invalid length/literal";if(se<256)e[h++]=se;else if(se==256){ce=a,d=null;break}else{var ae=se-254;if(se>264){var v=se-257,B=ws[v];ae=Ne(c,a,(1<<B)-1)+As[v],a+=B}var I=p[Et(c,a)&G],f=I>>>4;if(!I)throw"invalid distance";a+=I&15;var pe=wn[f];if(f>3){var B=xs[f];pe+=Et(c,a)&(1<<B)-1,a+=B}if(a>A){if(o)throw"unexpected EOF";break}n&&i(h+131072);for(var k=h+ae;h<k;h+=4)e[h]=e[h-pe],e[h+1]=e[h+1-pe],e[h+2]=e[h+2-pe],e[h+3]=e[h+3-pe];h=k}}t.l=d,t.p=ce,t.b=h,d&&(r=1,t.m=m,t.d=p,t.n=g)}while(!r);return h==e.length?e:An(e,0,h)},Sn=new De(0),Tn=function(c){if((c[0]&15)!=8||c[0]>>>4>7||(c[0]<<8|c[1])%31)throw"invalid zlib data";if(c[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function Cn(c,e){return Mn((Tn(c),c.subarray(2,-4)),e)}var Ln=typeof TextDecoder<"u"&&new TextDecoder,Pn=0;try{Ln.decode(Sn,{stream:!0}),Pn=1}catch{}var On=Object.defineProperty,In=(c,e,t)=>e in c?On(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t,N=(c,e,t)=>(In(c,typeof e!="symbol"?e+"":e,t),t);class Dn extends l.Object3D{constructor(e,t){super(),N(this,"isTransformControls",!0),N(this,"visible",!1),N(this,"domElement"),N(this,"raycaster",new l.Raycaster),N(this,"gizmo"),N(this,"plane"),N(this,"tempVector",new l.Vector3),N(this,"tempVector2",new l.Vector3),N(this,"tempQuaternion",new l.Quaternion),N(this,"unit",{X:new l.Vector3(1,0,0),Y:new l.Vector3(0,1,0),Z:new l.Vector3(0,0,1)}),N(this,"pointStart",new l.Vector3),N(this,"pointEnd",new l.Vector3),N(this,"offset",new l.Vector3),N(this,"rotationAxis",new l.Vector3),N(this,"startNorm",new l.Vector3),N(this,"endNorm",new l.Vector3),N(this,"rotationAngle",0),N(this,"cameraPosition",new l.Vector3),N(this,"cameraQuaternion",new l.Quaternion),N(this,"cameraScale",new l.Vector3),N(this,"parentPosition",new l.Vector3),N(this,"parentQuaternion",new l.Quaternion),N(this,"parentQuaternionInv",new l.Quaternion),N(this,"parentScale",new l.Vector3),N(this,"worldPositionStart",new l.Vector3),N(this,"worldQuaternionStart",new l.Quaternion),N(this,"worldScaleStart",new l.Vector3),N(this,"worldPosition",new l.Vector3),N(this,"worldQuaternion",new l.Quaternion),N(this,"worldQuaternionInv",new l.Quaternion),N(this,"worldScale",new l.Vector3),N(this,"eye",new l.Vector3),N(this,"positionStart",new l.Vector3),N(this,"quaternionStart",new l.Quaternion),N(this,"scaleStart",new l.Vector3),N(this,"camera"),N(this,"object"),N(this,"enabled",!0),N(this,"axis",null),N(this,"mode","translate"),N(this,"translationSnap",null),N(this,"rotationSnap",null),N(this,"scaleSnap",null),N(this,"space","world"),N(this,"size",1),N(this,"dragging",!1),N(this,"showX",!0),N(this,"showY",!0),N(this,"showZ",!0),N(this,"changeEvent",{type:"change"}),N(this,"mouseDownEvent",{type:"mouseDown",mode:this.mode}),N(this,"mouseUpEvent",{type:"mouseUp",mode:this.mode}),N(this,"objectChangeEvent",{type:"objectChange"}),N(this,"intersectObjectWithRay",(n,o,i)=>{const r=o.intersectObject(n,!0);for(let a=0;a<r.length;a++)if(r[a].object.visible||i)return r[a];return!1}),N(this,"attach",n=>(this.object=n,this.visible=!0,this)),N(this,"detach",()=>(this.object=void 0,this.visible=!1,this.axis=null,this)),N(this,"reset",()=>this.enabled?(this.dragging&&this.object!==void 0&&(this.object.position.copy(this.positionStart),this.object.quaternion.copy(this.quaternionStart),this.object.scale.copy(this.scaleStart),this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent),this.pointStart.copy(this.pointEnd)),this):this),N(this,"updateMatrixWorld",()=>{this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this.parentPosition,this.parentQuaternion,this.parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this.worldScale),this.parentQuaternionInv.copy(this.parentQuaternion).invert(),this.worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this.cameraScale),this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld()}),N(this,"pointerHover",n=>{if(this.object===void 0||this.dragging===!0)return;this.raycaster.setFromCamera(n,this.camera);const o=this.intersectObjectWithRay(this.gizmo.picker[this.mode],this.raycaster);o?this.axis=o.object.name:this.axis=null}),N(this,"pointerDown",n=>{if(!(this.object===void 0||this.dragging===!0||n.button!==0)&&this.axis!==null){this.raycaster.setFromCamera(n,this.camera);const o=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(o){let i=this.space;if(this.mode==="scale"?i="local":(this.axis==="E"||this.axis==="XYZE"||this.axis==="XYZ")&&(i="world"),i==="local"&&this.mode==="rotate"){const r=this.rotationSnap;this.axis==="X"&&r&&(this.object.rotation.x=Math.round(this.object.rotation.x/r)*r),this.axis==="Y"&&r&&(this.object.rotation.y=Math.round(this.object.rotation.y/r)*r),this.axis==="Z"&&r&&(this.object.rotation.z=Math.round(this.object.rotation.z/r)*r)}this.object.updateMatrixWorld(),this.object.parent&&this.object.parent.updateMatrixWorld(),this.positionStart.copy(this.object.position),this.quaternionStart.copy(this.object.quaternion),this.scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this.worldScaleStart),this.pointStart.copy(o.point).sub(this.worldPositionStart)}this.dragging=!0,this.mouseDownEvent.mode=this.mode,this.dispatchEvent(this.mouseDownEvent)}}),N(this,"pointerMove",n=>{const o=this.axis,i=this.mode,r=this.object;let a=this.space;if(i==="scale"?a="local":(o==="E"||o==="XYZE"||o==="XYZ")&&(a="world"),r===void 0||o===null||this.dragging===!1||n.button!==-1)return;this.raycaster.setFromCamera(n,this.camera);const h=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(h){if(this.pointEnd.copy(h.point).sub(this.worldPositionStart),i==="translate")this.offset.copy(this.pointEnd).sub(this.pointStart),a==="local"&&o!=="XYZ"&&this.offset.applyQuaternion(this.worldQuaternionInv),o.indexOf("X")===-1&&(this.offset.x=0),o.indexOf("Y")===-1&&(this.offset.y=0),o.indexOf("Z")===-1&&(this.offset.z=0),a==="local"&&o!=="XYZ"?this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale):this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale),r.position.copy(this.offset).add(this.positionStart),this.translationSnap&&(a==="local"&&(r.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert()),o.search("X")!==-1&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),o.search("Y")!==-1&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),o.search("Z")!==-1&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.position.applyQuaternion(this.quaternionStart)),a==="world"&&(r.parent&&r.position.add(this.tempVector.setFromMatrixPosition(r.parent.matrixWorld)),o.search("X")!==-1&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),o.search("Y")!==-1&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),o.search("Z")!==-1&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.parent&&r.position.sub(this.tempVector.setFromMatrixPosition(r.parent.matrixWorld))));else if(i==="scale"){if(o.search("XYZ")!==-1){let d=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(d*=-1),this.tempVector2.set(d,d,d)}else this.tempVector.copy(this.pointStart),this.tempVector2.copy(this.pointEnd),this.tempVector.applyQuaternion(this.worldQuaternionInv),this.tempVector2.applyQuaternion(this.worldQuaternionInv),this.tempVector2.divide(this.tempVector),o.search("X")===-1&&(this.tempVector2.x=1),o.search("Y")===-1&&(this.tempVector2.y=1),o.search("Z")===-1&&(this.tempVector2.z=1);r.scale.copy(this.scaleStart).multiply(this.tempVector2),this.scaleSnap&&this.object&&(o.search("X")!==-1&&(this.object.scale.x=Math.round(r.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),o.search("Y")!==-1&&(r.scale.y=Math.round(r.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),o.search("Z")!==-1&&(r.scale.z=Math.round(r.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(i==="rotate"){this.offset.copy(this.pointEnd).sub(this.pointStart);const d=20/this.worldPosition.distanceTo(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));o==="E"?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this.startNorm.copy(this.pointStart).normalize(),this.endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this.endNorm.cross(this.startNorm).dot(this.eye)<0?1:-1):o==="XYZE"?(this.rotationAxis.copy(this.offset).cross(this.eye).normalize(),this.rotationAngle=this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye))*d):(o==="X"||o==="Y"||o==="Z")&&(this.rotationAxis.copy(this.unit[o]),this.tempVector.copy(this.unit[o]),a==="local"&&this.tempVector.applyQuaternion(this.worldQuaternion),this.rotationAngle=this.offset.dot(this.tempVector.cross(this.eye).normalize())*d),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),a==="local"&&o!=="E"&&o!=="XYZE"?(r.quaternion.copy(this.quaternionStart),r.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this.parentQuaternionInv),r.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),r.quaternion.multiply(this.quaternionStart).normalize())}this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent)}}),N(this,"pointerUp",n=>{n.button===0&&(this.dragging&&this.axis!==null&&(this.mouseUpEvent.mode=this.mode,this.dispatchEvent(this.mouseUpEvent)),this.dragging=!1,this.axis=null)}),N(this,"getPointer",n=>{var o,i;if(this.domElement&&((o=this.domElement.ownerDocument)!=null&&o.pointerLockElement))return{x:0,y:0,button:n.button};{const r=n.changedTouches?n.changedTouches[0]:n,a=(i=this.domElement)==null?void 0:i.getBoundingClientRect();return{x:(r.clientX-a.left)/a.width*2-1,y:-(r.clientY-a.top)/a.height*2+1,button:n.button}}}),N(this,"onPointerHover",n=>{if(this.enabled)switch(n.pointerType){case"mouse":case"pen":this.pointerHover(this.getPointer(n));break}}),N(this,"onPointerDown",n=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="none",this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.pointerHover(this.getPointer(n)),this.pointerDown(this.getPointer(n)))}),N(this,"onPointerMove",n=>{this.enabled&&this.pointerMove(this.getPointer(n))}),N(this,"onPointerUp",n=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="",this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.pointerUp(this.getPointer(n)))}),N(this,"getMode",()=>this.mode),N(this,"setMode",n=>{this.mode=n}),N(this,"setTranslationSnap",n=>{this.translationSnap=n}),N(this,"setRotationSnap",n=>{this.rotationSnap=n}),N(this,"setScaleSnap",n=>{this.scaleSnap=n}),N(this,"setSize",n=>{this.size=n}),N(this,"setSpace",n=>{this.space=n}),N(this,"update",()=>{console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}),N(this,"connect",n=>{n===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.domElement=n,this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointermove",this.onPointerHover),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)}),N(this,"dispose",()=>{var n,o,i,r,a,h;(n=this.domElement)==null||n.removeEventListener("pointerdown",this.onPointerDown),(o=this.domElement)==null||o.removeEventListener("pointermove",this.onPointerHover),(r=(i=this.domElement)==null?void 0:i.ownerDocument)==null||r.removeEventListener("pointermove",this.onPointerMove),(h=(a=this.domElement)==null?void 0:a.ownerDocument)==null||h.removeEventListener("pointerup",this.onPointerUp),this.traverse(d=>{const p=d;p.geometry&&p.geometry.dispose(),p.material&&p.material.dispose()})}),this.domElement=t,this.camera=e,this.gizmo=new kn,this.add(this.gizmo),this.plane=new Fn,this.add(this.plane);const s=(n,o)=>{let i=o;Object.defineProperty(this,n,{get:function(){return i!==void 0?i:o},set:function(r){i!==r&&(i=r,this.plane[n]=r,this.gizmo[n]=r,this.dispatchEvent({type:n+"-changed",value:r}),this.dispatchEvent(this.changeEvent))}}),this[n]=o,this.plane[n]=o,this.gizmo[n]=o};s("camera",this.camera),s("object",this.object),s("enabled",this.enabled),s("axis",this.axis),s("mode",this.mode),s("translationSnap",this.translationSnap),s("rotationSnap",this.rotationSnap),s("scaleSnap",this.scaleSnap),s("space",this.space),s("size",this.size),s("dragging",this.dragging),s("showX",this.showX),s("showY",this.showY),s("showZ",this.showZ),s("worldPosition",this.worldPosition),s("worldPositionStart",this.worldPositionStart),s("worldQuaternion",this.worldQuaternion),s("worldQuaternionStart",this.worldQuaternionStart),s("cameraPosition",this.cameraPosition),s("cameraQuaternion",this.cameraQuaternion),s("pointStart",this.pointStart),s("pointEnd",this.pointEnd),s("rotationAxis",this.rotationAxis),s("rotationAngle",this.rotationAngle),s("eye",this.eye),t!==void 0&&this.connect(t)}}class kn extends l.Object3D{constructor(){super(),N(this,"isTransformControlsGizmo",!0),N(this,"type","TransformControlsGizmo"),N(this,"tempVector",new l.Vector3(0,0,0)),N(this,"tempEuler",new l.Euler),N(this,"alignVector",new l.Vector3(0,1,0)),N(this,"zeroVector",new l.Vector3(0,0,0)),N(this,"lookAtMatrix",new l.Matrix4),N(this,"tempQuaternion",new l.Quaternion),N(this,"tempQuaternion2",new l.Quaternion),N(this,"identityQuaternion",new l.Quaternion),N(this,"unitX",new l.Vector3(1,0,0)),N(this,"unitY",new l.Vector3(0,1,0)),N(this,"unitZ",new l.Vector3(0,0,1)),N(this,"gizmo"),N(this,"picker"),N(this,"helper"),N(this,"rotationAxis",new l.Vector3),N(this,"cameraPosition",new l.Vector3),N(this,"worldPositionStart",new l.Vector3),N(this,"worldQuaternionStart",new l.Quaternion),N(this,"worldPosition",new l.Vector3),N(this,"worldQuaternion",new l.Quaternion),N(this,"eye",new l.Vector3),N(this,"camera",null),N(this,"enabled",!0),N(this,"axis",null),N(this,"mode","translate"),N(this,"space","world"),N(this,"size",1),N(this,"dragging",!1),N(this,"showX",!0),N(this,"showY",!0),N(this,"showZ",!0),N(this,"updateMatrixWorld",()=>{let se=this.space;this.mode==="scale"&&(se="local");const ae=se==="local"?this.worldQuaternion:this.identityQuaternion;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let B=[];B=B.concat(this.picker[this.mode].children),B=B.concat(this.gizmo[this.mode].children),B=B.concat(this.helper[this.mode].children);for(let I=0;I<B.length;I++){const f=B[I];f.visible=!0,f.rotation.set(0,0,0),f.position.copy(this.worldPosition);let k;if(this.camera.isOrthographicCamera?k=(this.camera.top-this.camera.bottom)/this.camera.zoom:k=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),f.scale.set(1,1,1).multiplyScalar(k*this.size/7),f.tag==="helper"){f.visible=!1,f.name==="AXIS"?(f.position.copy(this.worldPositionStart),f.visible=!!this.axis,this.axis==="X"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,0)),f.quaternion.copy(ae).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ae).dot(this.eye))>.9&&(f.visible=!1)),this.axis==="Y"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,Math.PI/2)),f.quaternion.copy(ae).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ae).dot(this.eye))>.9&&(f.visible=!1)),this.axis==="Z"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),f.quaternion.copy(ae).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ae).dot(this.eye))>.9&&(f.visible=!1)),this.axis==="XYZE"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),this.alignVector.copy(this.rotationAxis),f.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector,this.alignVector,this.unitY)),f.quaternion.multiply(this.tempQuaternion),f.visible=this.dragging),this.axis==="E"&&(f.visible=!1)):f.name==="START"?(f.position.copy(this.worldPositionStart),f.visible=this.dragging):f.name==="END"?(f.position.copy(this.worldPosition),f.visible=this.dragging):f.name==="DELTA"?(f.position.copy(this.worldPositionStart),f.quaternion.copy(this.worldQuaternionStart),this.tempVector.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),this.tempVector.applyQuaternion(this.worldQuaternionStart.clone().invert()),f.scale.copy(this.tempVector),f.visible=this.dragging):(f.quaternion.copy(ae),this.dragging?f.position.copy(this.worldPositionStart):f.position.copy(this.worldPosition),this.axis&&(f.visible=this.axis.search(f.name)!==-1));continue}f.quaternion.copy(ae),this.mode==="translate"||this.mode==="scale"?((f.name==="X"||f.name==="XYZX")&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ae).dot(this.eye))>.99&&(f.scale.set(1e-10,1e-10,1e-10),f.visible=!1),(f.name==="Y"||f.name==="XYZY")&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ae).dot(this.eye))>.99&&(f.scale.set(1e-10,1e-10,1e-10),f.visible=!1),(f.name==="Z"||f.name==="XYZZ")&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ae).dot(this.eye))>.99&&(f.scale.set(1e-10,1e-10,1e-10),f.visible=!1),f.name==="XY"&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ae).dot(this.eye))<.2&&(f.scale.set(1e-10,1e-10,1e-10),f.visible=!1),f.name==="YZ"&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ae).dot(this.eye))<.2&&(f.scale.set(1e-10,1e-10,1e-10),f.visible=!1),f.name==="XZ"&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ae).dot(this.eye))<.2&&(f.scale.set(1e-10,1e-10,1e-10),f.visible=!1),f.name.search("X")!==-1&&(this.alignVector.copy(this.unitX).applyQuaternion(ae).dot(this.eye)<0?f.tag==="fwd"?f.visible=!1:f.scale.x*=-1:f.tag==="bwd"&&(f.visible=!1)),f.name.search("Y")!==-1&&(this.alignVector.copy(this.unitY).applyQuaternion(ae).dot(this.eye)<0?f.tag==="fwd"?f.visible=!1:f.scale.y*=-1:f.tag==="bwd"&&(f.visible=!1)),f.name.search("Z")!==-1&&(this.alignVector.copy(this.unitZ).applyQuaternion(ae).dot(this.eye)<0?f.tag==="fwd"?f.visible=!1:f.scale.z*=-1:f.tag==="bwd"&&(f.visible=!1))):this.mode==="rotate"&&(this.tempQuaternion2.copy(ae),this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(ae).invert()),f.name.search("E")!==-1&&f.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye,this.zeroVector,this.unitY)),f.name==="X"&&(this.tempQuaternion.setFromAxisAngle(this.unitX,Math.atan2(-this.alignVector.y,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),f.quaternion.copy(this.tempQuaternion)),f.name==="Y"&&(this.tempQuaternion.setFromAxisAngle(this.unitY,Math.atan2(this.alignVector.x,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),f.quaternion.copy(this.tempQuaternion)),f.name==="Z"&&(this.tempQuaternion.setFromAxisAngle(this.unitZ,Math.atan2(this.alignVector.y,this.alignVector.x)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),f.quaternion.copy(this.tempQuaternion))),f.visible=f.visible&&(f.name.indexOf("X")===-1||this.showX),f.visible=f.visible&&(f.name.indexOf("Y")===-1||this.showY),f.visible=f.visible&&(f.name.indexOf("Z")===-1||this.showZ),f.visible=f.visible&&(f.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),f.material.tempOpacity=f.material.tempOpacity||f.material.opacity,f.material.tempColor=f.material.tempColor||f.material.color.clone(),f.material.color.copy(f.material.tempColor),f.material.opacity=f.material.tempOpacity,this.enabled?this.axis&&(f.name===this.axis?(f.material.opacity=1,f.material.color.lerp(new l.Color(1,1,1),.5)):this.axis.split("").some(function(E){return f.name===E})?(f.material.opacity=1,f.material.color.lerp(new l.Color(1,1,1),.5)):(f.material.opacity*=.25,f.material.color.lerp(new l.Color(1,1,1),.5))):(f.material.opacity*=.5,f.material.color.lerp(new l.Color(1,1,1),.5))}super.updateMatrixWorld()});const e=new l.MeshBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,side:l.DoubleSide,fog:!1,toneMapped:!1}),t=new l.LineBasicMaterial({depthTest:!1,depthWrite:!1,transparent:!0,linewidth:1,fog:!1,toneMapped:!1}),s=e.clone();s.opacity=.15;const n=e.clone();n.opacity=.33;const o=e.clone();o.color.set(16711680);const i=e.clone();i.color.set(65280);const r=e.clone();r.color.set(255);const a=e.clone();a.opacity=.25;const h=a.clone();h.color.set(16776960);const d=a.clone();d.color.set(65535);const p=a.clone();p.color.set(16711935),e.clone().color.set(16776960);const g=t.clone();g.color.set(16711680);const A=t.clone();A.color.set(65280);const b=t.clone();b.color.set(255);const _=t.clone();_.color.set(65535);const M=t.clone();M.color.set(16711935);const L=t.clone();L.color.set(16776960);const w=t.clone();w.color.set(7895160);const y=L.clone();y.opacity=.25;const C=new l.CylinderGeometry(0,.05,.2,12,1,!1),T=new l.BoxGeometry(.125,.125,.125),x=new l.BufferGeometry;x.setAttribute("position",new l.Float32BufferAttribute([0,0,0,1,0,0],3));const v=(se,ae)=>{const B=new l.BufferGeometry,I=[];for(let f=0;f<=64*ae;++f)I.push(0,Math.cos(f/32*Math.PI)*se,Math.sin(f/32*Math.PI)*se);return B.setAttribute("position",new l.Float32BufferAttribute(I,3)),B},D=()=>{const se=new l.BufferGeometry;return se.setAttribute("position",new l.Float32BufferAttribute([0,0,0,1,1,1],3)),se},z={X:[[new l.Mesh(C,o),[1,0,0],[0,0,-Math.PI/2],null,"fwd"],[new l.Mesh(C,o),[1,0,0],[0,0,Math.PI/2],null,"bwd"],[new l.Line(x,g)]],Y:[[new l.Mesh(C,i),[0,1,0],null,null,"fwd"],[new l.Mesh(C,i),[0,1,0],[Math.PI,0,0],null,"bwd"],[new l.Line(x,A),null,[0,0,Math.PI/2]]],Z:[[new l.Mesh(C,r),[0,0,1],[Math.PI/2,0,0],null,"fwd"],[new l.Mesh(C,r),[0,0,1],[-Math.PI/2,0,0],null,"bwd"],[new l.Line(x,b),null,[0,-Math.PI/2,0]]],XYZ:[[new l.Mesh(new l.OctahedronGeometry(.1,0),a.clone()),[0,0,0],[0,0,0]]],XY:[[new l.Mesh(new l.PlaneGeometry(.295,.295),h.clone()),[.15,.15,0]],[new l.Line(x,L),[.18,.3,0],null,[.125,1,1]],[new l.Line(x,L),[.3,.18,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new l.Mesh(new l.PlaneGeometry(.295,.295),d.clone()),[0,.15,.15],[0,Math.PI/2,0]],[new l.Line(x,_),[0,.18,.3],[0,0,Math.PI/2],[.125,1,1]],[new l.Line(x,_),[0,.3,.18],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new l.Mesh(new l.PlaneGeometry(.295,.295),p.clone()),[.15,0,.15],[-Math.PI/2,0,0]],[new l.Line(x,M),[.18,0,.3],null,[.125,1,1]],[new l.Line(x,M),[.3,0,.18],[0,-Math.PI/2,0],[.125,1,1]]]},U={X:[[new l.Mesh(new l.CylinderGeometry(.2,0,1,4,1,!1),s),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new l.Mesh(new l.CylinderGeometry(.2,0,1,4,1,!1),s),[0,.6,0]]],Z:[[new l.Mesh(new l.CylinderGeometry(.2,0,1,4,1,!1),s),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new l.Mesh(new l.OctahedronGeometry(.2,0),s)]],XY:[[new l.Mesh(new l.PlaneGeometry(.4,.4),s),[.2,.2,0]]],YZ:[[new l.Mesh(new l.PlaneGeometry(.4,.4),s),[0,.2,.2],[0,Math.PI/2,0]]],XZ:[[new l.Mesh(new l.PlaneGeometry(.4,.4),s),[.2,0,.2],[-Math.PI/2,0,0]]]},R={START:[[new l.Mesh(new l.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],END:[[new l.Mesh(new l.OctahedronGeometry(.01,2),n),null,null,null,"helper"]],DELTA:[[new l.Line(D(),n),null,null,null,"helper"]],X:[[new l.Line(x,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new l.Line(x,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new l.Line(x,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},K={X:[[new l.Line(v(1,.5),g)],[new l.Mesh(new l.OctahedronGeometry(.04,0),o),[0,0,.99],null,[1,3,1]]],Y:[[new l.Line(v(1,.5),A),null,[0,0,-Math.PI/2]],[new l.Mesh(new l.OctahedronGeometry(.04,0),i),[0,0,.99],null,[3,1,1]]],Z:[[new l.Line(v(1,.5),b),null,[0,Math.PI/2,0]],[new l.Mesh(new l.OctahedronGeometry(.04,0),r),[.99,0,0],null,[1,3,1]]],E:[[new l.Line(v(1.25,1),y),null,[0,Math.PI/2,0]],[new l.Mesh(new l.CylinderGeometry(.03,0,.15,4,1,!1),y),[1.17,0,0],[0,0,-Math.PI/2],[1,1,.001]],[new l.Mesh(new l.CylinderGeometry(.03,0,.15,4,1,!1),y),[-1.17,0,0],[0,0,Math.PI/2],[1,1,.001]],[new l.Mesh(new l.CylinderGeometry(.03,0,.15,4,1,!1),y),[0,-1.17,0],[Math.PI,0,0],[1,1,.001]],[new l.Mesh(new l.CylinderGeometry(.03,0,.15,4,1,!1),y),[0,1.17,0],[0,0,0],[1,1,.001]]],XYZE:[[new l.Line(v(1,1),w),null,[0,Math.PI/2,0]]]},J={AXIS:[[new l.Line(x,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},Q={X:[[new l.Mesh(new l.TorusGeometry(1,.1,4,24),s),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new l.Mesh(new l.TorusGeometry(1,.1,4,24),s),[0,0,0],[Math.PI/2,0,0]]],Z:[[new l.Mesh(new l.TorusGeometry(1,.1,4,24),s),[0,0,0],[0,0,-Math.PI/2]]],E:[[new l.Mesh(new l.TorusGeometry(1.25,.1,2,24),s)]],XYZE:[[new l.Mesh(new l.SphereGeometry(.7,10,8),s)]]},pe={X:[[new l.Mesh(T,o),[.8,0,0],[0,0,-Math.PI/2]],[new l.Line(x,g),null,null,[.8,1,1]]],Y:[[new l.Mesh(T,i),[0,.8,0]],[new l.Line(x,A),null,[0,0,Math.PI/2],[.8,1,1]]],Z:[[new l.Mesh(T,r),[0,0,.8],[Math.PI/2,0,0]],[new l.Line(x,b),null,[0,-Math.PI/2,0],[.8,1,1]]],XY:[[new l.Mesh(T,h),[.85,.85,0],null,[2,2,.2]],[new l.Line(x,L),[.855,.98,0],null,[.125,1,1]],[new l.Line(x,L),[.98,.855,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new l.Mesh(T,d),[0,.85,.85],null,[.2,2,2]],[new l.Line(x,_),[0,.855,.98],[0,0,Math.PI/2],[.125,1,1]],[new l.Line(x,_),[0,.98,.855],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new l.Mesh(T,p),[.85,0,.85],null,[2,.2,2]],[new l.Line(x,M),[.855,0,.98],null,[.125,1,1]],[new l.Line(x,M),[.98,0,.855],[0,-Math.PI/2,0],[.125,1,1]]],XYZX:[[new l.Mesh(new l.BoxGeometry(.125,.125,.125),a.clone()),[1.1,0,0]]],XYZY:[[new l.Mesh(new l.BoxGeometry(.125,.125,.125),a.clone()),[0,1.1,0]]],XYZZ:[[new l.Mesh(new l.BoxGeometry(.125,.125,.125),a.clone()),[0,0,1.1]]]},Z={X:[[new l.Mesh(new l.CylinderGeometry(.2,0,.8,4,1,!1),s),[.5,0,0],[0,0,-Math.PI/2]]],Y:[[new l.Mesh(new l.CylinderGeometry(.2,0,.8,4,1,!1),s),[0,.5,0]]],Z:[[new l.Mesh(new l.CylinderGeometry(.2,0,.8,4,1,!1),s),[0,0,.5],[Math.PI/2,0,0]]],XY:[[new l.Mesh(T,s),[.85,.85,0],null,[3,3,.2]]],YZ:[[new l.Mesh(T,s),[0,.85,.85],null,[.2,3,3]]],XZ:[[new l.Mesh(T,s),[.85,0,.85],null,[3,.2,3]]],XYZX:[[new l.Mesh(new l.BoxGeometry(.2,.2,.2),s),[1.1,0,0]]],XYZY:[[new l.Mesh(new l.BoxGeometry(.2,.2,.2),s),[0,1.1,0]]],XYZZ:[[new l.Mesh(new l.BoxGeometry(.2,.2,.2),s),[0,0,1.1]]]},G={X:[[new l.Line(x,n.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new l.Line(x,n.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new l.Line(x,n.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},ce=se=>{const ae=new l.Object3D;for(let B in se)for(let I=se[B].length;I--;){const f=se[B][I][0].clone(),k=se[B][I][1],E=se[B][I][2],P=se[B][I][3],j=se[B][I][4];f.name=B,f.tag=j,k&&f.position.set(k[0],k[1],k[2]),E&&f.rotation.set(E[0],E[1],E[2]),P&&f.scale.set(P[0],P[1],P[2]),f.updateMatrix();const oe=f.geometry.clone();oe.applyMatrix4(f.matrix),f.geometry=oe,f.renderOrder=1/0,f.position.set(0,0,0),f.rotation.set(0,0,0),f.scale.set(1,1,1),ae.add(f)}return ae};this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=ce(z)),this.add(this.gizmo.rotate=ce(K)),this.add(this.gizmo.scale=ce(pe)),this.add(this.picker.translate=ce(U)),this.add(this.picker.rotate=ce(Q)),this.add(this.picker.scale=ce(Z)),this.add(this.helper.translate=ce(R)),this.add(this.helper.rotate=ce(J)),this.add(this.helper.scale=ce(G)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}}class Fn extends l.Mesh{constructor(){super(new l.PlaneGeometry(1e5,1e5,2,2),new l.MeshBasicMaterial({visible:!1,wireframe:!0,side:l.DoubleSide,transparent:!0,opacity:.1,toneMapped:!1})),N(this,"isTransformControlsPlane",!0),N(this,"type","TransformControlsPlane"),N(this,"unitX",new l.Vector3(1,0,0)),N(this,"unitY",new l.Vector3(0,1,0)),N(this,"unitZ",new l.Vector3(0,0,1)),N(this,"tempVector",new l.Vector3),N(this,"dirVector",new l.Vector3),N(this,"alignVector",new l.Vector3),N(this,"tempMatrix",new l.Matrix4),N(this,"identityQuaternion",new l.Quaternion),N(this,"cameraQuaternion",new l.Quaternion),N(this,"worldPosition",new l.Vector3),N(this,"worldQuaternion",new l.Quaternion),N(this,"eye",new l.Vector3),N(this,"axis",null),N(this,"mode","translate"),N(this,"space","world"),N(this,"updateMatrixWorld",()=>{let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),this.unitX.set(1,0,0).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.unitY.set(0,1,0).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.unitZ.set(0,0,1).applyQuaternion(e==="local"?this.worldQuaternion:this.identityQuaternion),this.alignVector.copy(this.unitY),this.mode){case"translate":case"scale":switch(this.axis){case"X":this.alignVector.copy(this.eye).cross(this.unitX),this.dirVector.copy(this.unitX).cross(this.alignVector);break;case"Y":this.alignVector.copy(this.eye).cross(this.unitY),this.dirVector.copy(this.unitY).cross(this.alignVector);break;case"Z":this.alignVector.copy(this.eye).cross(this.unitZ),this.dirVector.copy(this.unitZ).cross(this.alignVector);break;case"XY":this.dirVector.copy(this.unitZ);break;case"YZ":this.dirVector.copy(this.unitX);break;case"XZ":this.alignVector.copy(this.unitZ),this.dirVector.copy(this.unitY);break;case"XYZ":case"E":this.dirVector.set(0,0,0);break}break;case"rotate":default:this.dirVector.set(0,0,0)}this.dirVector.length()===0?this.quaternion.copy(this.cameraQuaternion):(this.tempMatrix.lookAt(this.tempVector.set(0,0,0),this.dirVector,this.alignVector),this.quaternion.setFromRotationMatrix(this.tempMatrix)),super.updateMatrixWorld()})}}var Bn=Object.defineProperty,Un=(c,e,t)=>e in c?Bn(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t,Te=(c,e,t)=>(Un(c,typeof e!="symbol"?e+"":e,t),t);const lt=new l.Euler(0,0,0,"YXZ"),ct=new l.Vector3,Nn={type:"change"},Vn={type:"lock"},zn={type:"unlock"},Ss=Math.PI/2;class jt extends l.EventDispatcher{constructor(e,t){super(),Te(this,"camera"),Te(this,"domElement"),Te(this,"isLocked"),Te(this,"minPolarAngle"),Te(this,"maxPolarAngle"),Te(this,"pointerSpeed"),Te(this,"onMouseMove",s=>{if(!this.domElement||this.isLocked===!1)return;const n=s.movementX||s.mozMovementX||s.webkitMovementX||0,o=s.movementY||s.mozMovementY||s.webkitMovementY||0;lt.setFromQuaternion(this.camera.quaternion),lt.y-=n*.002*this.pointerSpeed,lt.x-=o*.002*this.pointerSpeed,lt.x=Math.max(Ss-this.maxPolarAngle,Math.min(Ss-this.minPolarAngle,lt.x)),this.camera.quaternion.setFromEuler(lt),this.dispatchEvent(Nn)}),Te(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(Vn),this.isLocked=!0):(this.dispatchEvent(zn),this.isLocked=!1))}),Te(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),Te(this,"connect",s=>{this.domElement=s||this.domElement,this.domElement&&(this.domElement.ownerDocument.addEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError))}),Te(this,"disconnect",()=>{this.domElement&&(this.domElement.ownerDocument.removeEventListener("mousemove",this.onMouseMove),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError))}),Te(this,"dispose",()=>{this.disconnect()}),Te(this,"getObject",()=>this.camera),Te(this,"direction",new l.Vector3(0,0,-1)),Te(this,"getDirection",s=>s.copy(this.direction).applyQuaternion(this.camera.quaternion)),Te(this,"moveForward",s=>{ct.setFromMatrixColumn(this.camera.matrix,0),ct.crossVectors(this.camera.up,ct),this.camera.position.addScaledVector(ct,s)}),Te(this,"moveRight",s=>{ct.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(ct,s)}),Te(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),Te(this,"unlock",()=>{this.domElement&&this.domElement.ownerDocument.exitPointerLock()}),this.camera=e,this.domElement=t,this.isLocked=!1,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.pointerSpeed=1,t&&this.connect(t)}}var Rn=Object.defineProperty,Gn=(c,e,t)=>e in c?Rn(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t,re=(c,e,t)=>(Gn(c,typeof e!="symbol"?e+"":e,t),t);const Ts=(c,e)=>(c%e+e)%e;class Cs extends l.EventDispatcher{constructor(e,t){super(),re(this,"object"),re(this,"domElement"),re(this,"enabled",!0),re(this,"target",new l.Vector3),re(this,"minDistance",0),re(this,"maxDistance",1/0),re(this,"minZoom",0),re(this,"maxZoom",1/0),re(this,"minPolarAngle",0),re(this,"maxPolarAngle",Math.PI),re(this,"minAzimuthAngle",-1/0),re(this,"maxAzimuthAngle",1/0),re(this,"enableDamping",!1),re(this,"dampingFactor",.05),re(this,"enableZoom",!0),re(this,"zoomSpeed",1),re(this,"enableRotate",!0),re(this,"rotateSpeed",1),re(this,"enablePan",!0),re(this,"panSpeed",1),re(this,"screenSpacePanning",!0),re(this,"keyPanSpeed",7),re(this,"autoRotate",!1),re(this,"autoRotateSpeed",2),re(this,"reverseOrbit",!1),re(this,"reverseHorizontalOrbit",!1),re(this,"reverseVerticalOrbit",!1),re(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),re(this,"mouseButtons",{LEFT:l.MOUSE.ROTATE,MIDDLE:l.MOUSE.DOLLY,RIGHT:l.MOUSE.PAN}),re(this,"touches",{ONE:l.TOUCH.ROTATE,TWO:l.TOUCH.DOLLY_PAN}),re(this,"target0"),re(this,"position0"),re(this,"zoom0"),re(this,"_domElementKeyEvents",null),re(this,"getPolarAngle"),re(this,"getAzimuthalAngle"),re(this,"setPolarAngle"),re(this,"setAzimuthalAngle"),re(this,"getDistance"),re(this,"listenToKeyEvents"),re(this,"stopListenToKeyEvents"),re(this,"saveState"),re(this,"reset"),re(this,"update"),re(this,"connect"),re(this,"dispose"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>d.phi,this.getAzimuthalAngle=()=>d.theta,this.setPolarAngle=F=>{let Y=Ts(F,2*Math.PI),le=d.phi;le<0&&(le+=2*Math.PI),Y<0&&(Y+=2*Math.PI);let we=Math.abs(Y-le);2*Math.PI-we<we&&(Y<le?Y+=2*Math.PI:le+=2*Math.PI),p.phi=Y-le,s.update()},this.setAzimuthalAngle=F=>{let Y=Ts(F,2*Math.PI),le=d.theta;le<0&&(le+=2*Math.PI),Y<0&&(Y+=2*Math.PI);let we=Math.abs(Y-le);2*Math.PI-we<we&&(Y<le?Y+=2*Math.PI:le+=2*Math.PI),p.theta=Y-le,s.update()},this.getDistance=()=>s.object.position.distanceTo(s.target),this.listenToKeyEvents=F=>{F.addEventListener("keydown",Ct),this._domElementKeyEvents=F},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",Ct),this._domElementKeyEvents=null},this.saveState=()=>{s.target0.copy(s.target),s.position0.copy(s.object.position),s.zoom0=s.object.zoom},this.reset=()=>{s.target.copy(s.target0),s.object.position.copy(s.position0),s.object.zoom=s.zoom0,s.object.updateProjectionMatrix(),s.dispatchEvent(n),s.update(),a=r.NONE},this.update=(()=>{const F=new l.Vector3,Y=new l.Vector3(0,1,0),le=new l.Quaternion().setFromUnitVectors(e.up,Y),we=le.clone().invert(),Pe=new l.Vector3,at=new l.Quaternion,$e=2*Math.PI;return function(){const fn=s.object.position;le.setFromUnitVectors(e.up,Y),we.copy(le).invert(),F.copy(fn).sub(s.target),F.applyQuaternion(le),d.setFromVector3(F),s.autoRotate&&a===r.NONE&&R(z()),s.enableDamping?(d.theta+=p.theta*s.dampingFactor,d.phi+=p.phi*s.dampingFactor):(d.theta+=p.theta,d.phi+=p.phi);let Xe=s.minAzimuthAngle,Ze=s.maxAzimuthAngle;return isFinite(Xe)&&isFinite(Ze)&&(Xe<-Math.PI?Xe+=$e:Xe>Math.PI&&(Xe-=$e),Ze<-Math.PI?Ze+=$e:Ze>Math.PI&&(Ze-=$e),Xe<=Ze?d.theta=Math.max(Xe,Math.min(Ze,d.theta)):d.theta=d.theta>(Xe+Ze)/2?Math.max(Xe,d.theta):Math.min(Ze,d.theta)),d.phi=Math.max(s.minPolarAngle,Math.min(s.maxPolarAngle,d.phi)),d.makeSafe(),d.radius*=m,d.radius=Math.max(s.minDistance,Math.min(s.maxDistance,d.radius)),s.enableDamping===!0?s.target.addScaledVector(g,s.dampingFactor):s.target.add(g),F.setFromSpherical(d),F.applyQuaternion(we),fn.copy(s.target).add(F),s.object.lookAt(s.target),s.enableDamping===!0?(p.theta*=1-s.dampingFactor,p.phi*=1-s.dampingFactor,g.multiplyScalar(1-s.dampingFactor)):(p.set(0,0,0),g.set(0,0,0)),m=1,A||Pe.distanceToSquared(s.object.position)>h||8*(1-at.dot(s.object.quaternion))>h?(s.dispatchEvent(n),Pe.copy(s.object.position),at.copy(s.object.quaternion),A=!1,!0):!1}})(),this.connect=F=>{F===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),s.domElement=F,s.domElement.style.touchAction="none",s.domElement.addEventListener("contextmenu",Nt),s.domElement.addEventListener("pointerdown",S),s.domElement.addEventListener("pointercancel",ve),s.domElement.addEventListener("wheel",He)},this.dispose=()=>{var F,Y,le,we,Pe,at;(F=s.domElement)==null||F.removeEventListener("contextmenu",Nt),(Y=s.domElement)==null||Y.removeEventListener("pointerdown",S),(le=s.domElement)==null||le.removeEventListener("pointercancel",ve),(we=s.domElement)==null||we.removeEventListener("wheel",He),(Pe=s.domElement)==null||Pe.ownerDocument.removeEventListener("pointermove",H),(at=s.domElement)==null||at.ownerDocument.removeEventListener("pointerup",de),s._domElementKeyEvents!==null&&s._domElementKeyEvents.removeEventListener("keydown",Ct)};const s=this,n={type:"change"},o={type:"start"},i={type:"end"},r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let a=r.NONE;const h=1e-6,d=new l.Spherical,p=new l.Spherical;let m=1;const g=new l.Vector3;let A=!1;const b=new l.Vector2,_=new l.Vector2,M=new l.Vector2,L=new l.Vector2,w=new l.Vector2,y=new l.Vector2,C=new l.Vector2,T=new l.Vector2,x=new l.Vector2,v=[],D={};function z(){return 2*Math.PI/60/60*s.autoRotateSpeed}function U(){return Math.pow(.95,s.zoomSpeed)}function R(F){s.reverseOrbit||s.reverseHorizontalOrbit?p.theta+=F:p.theta-=F}function K(F){s.reverseOrbit||s.reverseVerticalOrbit?p.phi+=F:p.phi-=F}const J=(()=>{const F=new l.Vector3;return function(le,we){F.setFromMatrixColumn(we,0),F.multiplyScalar(-le),g.add(F)}})(),Q=(()=>{const F=new l.Vector3;return function(le,we){s.screenSpacePanning===!0?F.setFromMatrixColumn(we,1):(F.setFromMatrixColumn(we,0),F.crossVectors(s.object.up,F)),F.multiplyScalar(le),g.add(F)}})(),pe=(()=>{const F=new l.Vector3;return function(le,we){const Pe=s.domElement;if(Pe&&s.object instanceof l.PerspectiveCamera&&s.object.isPerspectiveCamera){const at=s.object.position;F.copy(at).sub(s.target);let $e=F.length();$e*=Math.tan(s.object.fov/2*Math.PI/180),J(2*le*$e/Pe.clientHeight,s.object.matrix),Q(2*we*$e/Pe.clientHeight,s.object.matrix)}else Pe&&s.object instanceof l.OrthographicCamera&&s.object.isOrthographicCamera?(J(le*(s.object.right-s.object.left)/s.object.zoom/Pe.clientWidth,s.object.matrix),Q(we*(s.object.top-s.object.bottom)/s.object.zoom/Pe.clientHeight,s.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),s.enablePan=!1)}})();function Z(F){s.object instanceof l.PerspectiveCamera&&s.object.isPerspectiveCamera?m/=F:s.object instanceof l.OrthographicCamera&&s.object.isOrthographicCamera?(s.object.zoom=Math.max(s.minZoom,Math.min(s.maxZoom,s.object.zoom*F)),s.object.updateProjectionMatrix(),A=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),s.enableZoom=!1)}function G(F){s.object instanceof l.PerspectiveCamera&&s.object.isPerspectiveCamera?m*=F:s.object instanceof l.OrthographicCamera&&s.object.isOrthographicCamera?(s.object.zoom=Math.max(s.minZoom,Math.min(s.maxZoom,s.object.zoom/F)),s.object.updateProjectionMatrix(),A=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),s.enableZoom=!1)}function ce(F){b.set(F.clientX,F.clientY)}function se(F){C.set(F.clientX,F.clientY)}function ae(F){L.set(F.clientX,F.clientY)}function B(F){_.set(F.clientX,F.clientY),M.subVectors(_,b).multiplyScalar(s.rotateSpeed);const Y=s.domElement;Y&&(R(2*Math.PI*M.x/Y.clientHeight),K(2*Math.PI*M.y/Y.clientHeight)),b.copy(_),s.update()}function I(F){T.set(F.clientX,F.clientY),x.subVectors(T,C),x.y>0?Z(U()):x.y<0&&G(U()),C.copy(T),s.update()}function f(F){w.set(F.clientX,F.clientY),y.subVectors(w,L).multiplyScalar(s.panSpeed),pe(y.x,y.y),L.copy(w),s.update()}function k(F){F.deltaY<0?G(U()):F.deltaY>0&&Z(U()),s.update()}function E(F){let Y=!1;switch(F.code){case s.keys.UP:pe(0,s.keyPanSpeed),Y=!0;break;case s.keys.BOTTOM:pe(0,-s.keyPanSpeed),Y=!0;break;case s.keys.LEFT:pe(s.keyPanSpeed,0),Y=!0;break;case s.keys.RIGHT:pe(-s.keyPanSpeed,0),Y=!0;break}Y&&(F.preventDefault(),s.update())}function P(){if(v.length==1)b.set(v[0].pageX,v[0].pageY);else{const F=.5*(v[0].pageX+v[1].pageX),Y=.5*(v[0].pageY+v[1].pageY);b.set(F,Y)}}function j(){if(v.length==1)L.set(v[0].pageX,v[0].pageY);else{const F=.5*(v[0].pageX+v[1].pageX),Y=.5*(v[0].pageY+v[1].pageY);L.set(F,Y)}}function oe(){const F=v[0].pageX-v[1].pageX,Y=v[0].pageY-v[1].pageY,le=Math.sqrt(F*F+Y*Y);C.set(0,le)}function ee(){s.enableZoom&&oe(),s.enablePan&&j()}function te(){s.enableZoom&&oe(),s.enableRotate&&P()}function W(F){if(v.length==1)_.set(F.pageX,F.pageY);else{const le=ys(F),we=.5*(F.pageX+le.x),Pe=.5*(F.pageY+le.y);_.set(we,Pe)}M.subVectors(_,b).multiplyScalar(s.rotateSpeed);const Y=s.domElement;Y&&(R(2*Math.PI*M.x/Y.clientHeight),K(2*Math.PI*M.y/Y.clientHeight)),b.copy(_)}function me(F){if(v.length==1)w.set(F.pageX,F.pageY);else{const Y=ys(F),le=.5*(F.pageX+Y.x),we=.5*(F.pageY+Y.y);w.set(le,we)}y.subVectors(w,L).multiplyScalar(s.panSpeed),pe(y.x,y.y),L.copy(w)}function X(F){const Y=ys(F),le=F.pageX-Y.x,we=F.pageY-Y.y,Pe=Math.sqrt(le*le+we*we);T.set(0,Pe),x.set(0,Math.pow(T.y/C.y,s.zoomSpeed)),Z(x.y),C.copy(T)}function q(F){s.enableZoom&&X(F),s.enablePan&&me(F)}function O(F){s.enableZoom&&X(F),s.enableRotate&&W(F)}function S(F){var Y,le;s.enabled!==!1&&(v.length===0&&((Y=s.domElement)==null||Y.ownerDocument.addEventListener("pointermove",H),(le=s.domElement)==null||le.ownerDocument.addEventListener("pointerup",de)),Vt(F),F.pointerType==="touch"?gs(F):Ce(F))}function H(F){s.enabled!==!1&&(F.pointerType==="touch"?Ut(F):Ue(F))}function de(F){var Y,le,we;pn(F),v.length===0&&((Y=s.domElement)==null||Y.releasePointerCapture(F.pointerId),(le=s.domElement)==null||le.ownerDocument.removeEventListener("pointermove",H),(we=s.domElement)==null||we.ownerDocument.removeEventListener("pointerup",de)),s.dispatchEvent(i),a=r.NONE}function ve(F){pn(F)}function Ce(F){let Y;switch(F.button){case 0:Y=s.mouseButtons.LEFT;break;case 1:Y=s.mouseButtons.MIDDLE;break;case 2:Y=s.mouseButtons.RIGHT;break;default:Y=-1}switch(Y){case l.MOUSE.DOLLY:if(s.enableZoom===!1)return;se(F),a=r.DOLLY;break;case l.MOUSE.ROTATE:if(F.ctrlKey||F.metaKey||F.shiftKey){if(s.enablePan===!1)return;ae(F),a=r.PAN}else{if(s.enableRotate===!1)return;ce(F),a=r.ROTATE}break;case l.MOUSE.PAN:if(F.ctrlKey||F.metaKey||F.shiftKey){if(s.enableRotate===!1)return;ce(F),a=r.ROTATE}else{if(s.enablePan===!1)return;ae(F),a=r.PAN}break;default:a=r.NONE}a!==r.NONE&&s.dispatchEvent(o)}function Ue(F){if(s.enabled!==!1)switch(a){case r.ROTATE:if(s.enableRotate===!1)return;B(F);break;case r.DOLLY:if(s.enableZoom===!1)return;I(F);break;case r.PAN:if(s.enablePan===!1)return;f(F);break}}function He(F){s.enabled===!1||s.enableZoom===!1||a!==r.NONE&&a!==r.ROTATE||(F.preventDefault(),s.dispatchEvent(o),k(F),s.dispatchEvent(i))}function Ct(F){s.enabled===!1||s.enablePan===!1||E(F)}function gs(F){switch(dn(F),v.length){case 1:switch(s.touches.ONE){case l.TOUCH.ROTATE:if(s.enableRotate===!1)return;P(),a=r.TOUCH_ROTATE;break;case l.TOUCH.PAN:if(s.enablePan===!1)return;j(),a=r.TOUCH_PAN;break;default:a=r.NONE}break;case 2:switch(s.touches.TWO){case l.TOUCH.DOLLY_PAN:if(s.enableZoom===!1&&s.enablePan===!1)return;ee(),a=r.TOUCH_DOLLY_PAN;break;case l.TOUCH.DOLLY_ROTATE:if(s.enableZoom===!1&&s.enableRotate===!1)return;te(),a=r.TOUCH_DOLLY_ROTATE;break;default:a=r.NONE}break;default:a=r.NONE}a!==r.NONE&&s.dispatchEvent(o)}function Ut(F){switch(dn(F),a){case r.TOUCH_ROTATE:if(s.enableRotate===!1)return;W(F),s.update();break;case r.TOUCH_PAN:if(s.enablePan===!1)return;me(F),s.update();break;case r.TOUCH_DOLLY_PAN:if(s.enableZoom===!1&&s.enablePan===!1)return;q(F),s.update();break;case r.TOUCH_DOLLY_ROTATE:if(s.enableZoom===!1&&s.enableRotate===!1)return;O(F),s.update();break;default:a=r.NONE}}function Nt(F){s.enabled!==!1&&F.preventDefault()}function Vt(F){v.push(F)}function pn(F){delete D[F.pointerId];for(let Y=0;Y<v.length;Y++)if(v[Y].pointerId==F.pointerId){v.splice(Y,1);return}}function dn(F){let Y=D[F.pointerId];Y===void 0&&(Y=new l.Vector2,D[F.pointerId]=Y),Y.set(F.pageX,F.pageY)}function ys(F){const Y=F.pointerId===v[0].pointerId?v[1]:v[0];return D[Y.pointerId]}t!==void 0&&this.connect(t),this.update()}}class En extends Cs{constructor(e,t){super(e,t),this.screenSpacePanning=!1,this.mouseButtons.LEFT=l.MOUSE.PAN,this.mouseButtons.RIGHT=l.MOUSE.ROTATE,this.touches.ONE=l.TOUCH.PAN,this.touches.TWO=l.TOUCH.DOLLY_ROTATE}}class jn extends l.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new Kn(t)}),this.register(function(t){return new so(t)}),this.register(function(t){return new no(t)}),this.register(function(t){return new oo(t)}),this.register(function(t){return new qn(t)}),this.register(function(t){return new Jn(t)}),this.register(function(t){return new Hn(t)}),this.register(function(t){return new $n(t)}),this.register(function(t){return new Qn(t)}),this.register(function(t){return new eo(t)}),this.register(function(t){return new Wn(t)}),this.register(function(t){return new to(t)}),this.register(function(t){return new Xn(t)}),this.register(function(t){return new io(t)}),this.register(function(t){return new ro(t)})}load(e,t,s,n){const o=this;let i;this.resourcePath!==""?i=this.resourcePath:this.path!==""?i=this.path:i=l.LoaderUtils.extractUrlBase(e),this.manager.itemStart(e);const r=function(h){n?n(h):console.error(h),o.manager.itemError(e),o.manager.itemEnd(e)},a=new l.FileLoader(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(h){try{o.parse(h,i,function(d){t(d),o.manager.itemEnd(e)},r)}catch(d){r(d)}},s,r)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s,n){let o;const i={},r={};if(typeof e=="string")o=JSON.parse(e);else if(e instanceof ArrayBuffer)if(l.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4)))===Ls){try{i[fe.KHR_BINARY_GLTF]=new ao(e)}catch(d){n&&n(d);return}o=JSON.parse(i[fe.KHR_BINARY_GLTF].content)}else o=JSON.parse(l.LoaderUtils.decodeText(new Uint8Array(e)));else o=e;if(o.asset===void 0||o.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const a=new bo(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});a.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const d=this.pluginCallbacks[h](a);r[d.name]=d,i[d.name]=!0}if(o.extensionsUsed)for(let h=0;h<o.extensionsUsed.length;++h){const d=o.extensionsUsed[h],p=o.extensionsRequired||[];switch(d){case fe.KHR_MATERIALS_UNLIT:i[d]=new Zn;break;case fe.KHR_DRACO_MESH_COMPRESSION:i[d]=new lo(o,this.dracoLoader);break;case fe.KHR_TEXTURE_TRANSFORM:i[d]=new co;break;case fe.KHR_MESH_QUANTIZATION:i[d]=new ho;break;default:p.indexOf(d)>=0&&r[d]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}a.setExtensions(i),a.setPlugins(r),a.parse(s,n)}parseAsync(e,t){const s=this;return new Promise(function(n,o){s.parse(e,t,n,o)})}}function Yn(){let c={};return{get:function(e){return c[e]},add:function(e,t){c[e]=t},remove:function(e){delete c[e]},removeAll:function(){c={}}}}const fe={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Xn{constructor(e){this.parser=e,this.name=fe.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,n=t.length;s<n;s++){const o=t[s];o.extensions&&o.extensions[this.name]&&o.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,o.extensions[this.name].light)}}_loadLight(e){const t=this.parser,s="light:"+e;let n=t.cache.get(s);if(n)return n;const o=t.json,a=((o.extensions&&o.extensions[this.name]||{}).lights||[])[e];let h;const d=new l.Color(16777215);a.color!==void 0&&d.fromArray(a.color);const p=a.range!==void 0?a.range:0;switch(a.type){case"directional":h=new l.DirectionalLight(d),h.target.position.set(0,0,-1),h.add(h.target);break;case"point":h=new l.PointLight(d),h.distance=p;break;case"spot":h=new l.SpotLight(d),h.distance=p,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle!==void 0?a.spot.innerConeAngle:0,a.spot.outerConeAngle=a.spot.outerConeAngle!==void 0?a.spot.outerConeAngle:Math.PI/4,h.angle=a.spot.outerConeAngle,h.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,h.target.position.set(0,0,-1),h.add(h.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return h.position.set(0,0,0),h.decay=2,qe(h,a),a.intensity!==void 0&&(h.intensity=a.intensity),h.name=t.createUniqueName(a.name||"light_"+e),n=Promise.resolve(h),t.cache.add(s,n),n}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,o=s.json.nodes[e],r=(o.extensions&&o.extensions[this.name]||{}).light;return r===void 0?null:this._loadLight(r).then(function(a){return s._getNodeRef(t.cache,r,a)})}}class Zn{constructor(){this.name=fe.KHR_MATERIALS_UNLIT}getMaterialType(){return l.MeshBasicMaterial}extendParams(e,t,s){const n=[];e.color=new l.Color(1,1,1),e.opacity=1;const o=t.pbrMetallicRoughness;if(o){if(Array.isArray(o.baseColorFactor)){const i=o.baseColorFactor;e.color.fromArray(i),e.opacity=i[3]}o.baseColorTexture!==void 0&&n.push(s.assignTexture(e,"map",o.baseColorTexture,3001))}return Promise.all(n)}}class Qn{constructor(e){this.parser=e,this.name=fe.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=n.extensions[this.name].emissiveStrength;return o!==void 0&&(t.emissiveIntensity=o),Promise.resolve()}}class Kn{constructor(e){this.parser=e,this.name=fe.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],i=n.extensions[this.name];if(i.clearcoatFactor!==void 0&&(t.clearcoat=i.clearcoatFactor),i.clearcoatTexture!==void 0&&o.push(s.assignTexture(t,"clearcoatMap",i.clearcoatTexture)),i.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=i.clearcoatRoughnessFactor),i.clearcoatRoughnessTexture!==void 0&&o.push(s.assignTexture(t,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),i.clearcoatNormalTexture!==void 0&&(o.push(s.assignTexture(t,"clearcoatNormalMap",i.clearcoatNormalTexture)),i.clearcoatNormalTexture.scale!==void 0)){const r=i.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new l.Vector2(r,r)}return Promise.all(o)}}class Wn{constructor(e){this.parser=e,this.name=fe.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],i=n.extensions[this.name];return i.iridescenceFactor!==void 0&&(t.iridescence=i.iridescenceFactor),i.iridescenceTexture!==void 0&&o.push(s.assignTexture(t,"iridescenceMap",i.iridescenceTexture)),i.iridescenceIor!==void 0&&(t.iridescenceIOR=i.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),i.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),i.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),i.iridescenceThicknessTexture!==void 0&&o.push(s.assignTexture(t,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(o)}}class qn{constructor(e){this.parser=e,this.name=fe.KHR_MATERIALS_SHEEN}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[];t.sheenColor=new l.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const i=n.extensions[this.name];return i.sheenColorFactor!==void 0&&t.sheenColor.fromArray(i.sheenColorFactor),i.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=i.sheenRoughnessFactor),i.sheenColorTexture!==void 0&&o.push(s.assignTexture(t,"sheenColorMap",i.sheenColorTexture,3001)),i.sheenRoughnessTexture!==void 0&&o.push(s.assignTexture(t,"sheenRoughnessMap",i.sheenRoughnessTexture)),Promise.all(o)}}class Jn{constructor(e){this.parser=e,this.name=fe.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],i=n.extensions[this.name];return i.transmissionFactor!==void 0&&(t.transmission=i.transmissionFactor),i.transmissionTexture!==void 0&&o.push(s.assignTexture(t,"transmissionMap",i.transmissionTexture)),Promise.all(o)}}class Hn{constructor(e){this.parser=e,this.name=fe.KHR_MATERIALS_VOLUME}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],i=n.extensions[this.name];t.thickness=i.thicknessFactor!==void 0?i.thicknessFactor:0,i.thicknessTexture!==void 0&&o.push(s.assignTexture(t,"thicknessMap",i.thicknessTexture)),t.attenuationDistance=i.attenuationDistance||1/0;const r=i.attenuationColor||[1,1,1];return t.attenuationColor=new l.Color(r[0],r[1],r[2]),Promise.all(o)}}class $n{constructor(e){this.parser=e,this.name=fe.KHR_MATERIALS_IOR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=n.extensions[this.name];return t.ior=o.ior!==void 0?o.ior:1.5,Promise.resolve()}}class eo{constructor(e){this.parser=e,this.name=fe.KHR_MATERIALS_SPECULAR}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],i=n.extensions[this.name];t.specularIntensity=i.specularFactor!==void 0?i.specularFactor:1,i.specularTexture!==void 0&&o.push(s.assignTexture(t,"specularIntensityMap",i.specularTexture));const r=i.specularColorFactor||[1,1,1];return t.specularColor=new l.Color(r[0],r[1],r[2]),i.specularColorTexture!==void 0&&o.push(s.assignTexture(t,"specularColorMap",i.specularColorTexture,3001)),Promise.all(o)}}class to{constructor(e){this.parser=e,this.name=fe.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const s=this.parser.json.materials[e];return!s.extensions||!s.extensions[this.name]?null:l.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser,n=s.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const o=[],i=n.extensions[this.name];return i.anisotropyStrength!==void 0&&(t.anisotropy=i.anisotropyStrength),i.anisotropyRotation!==void 0&&(t.anisotropyRotation=i.anisotropyRotation),i.anisotropyTexture!==void 0&&o.push(s.assignTexture(t,"anisotropyMap",i.anisotropyTexture)),Promise.all(o)}}class so{constructor(e){this.parser=e,this.name=fe.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,n=s.textures[e];if(!n.extensions||!n.extensions[this.name])return null;const o=n.extensions[this.name],i=t.options.ktx2Loader;if(!i){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,i)}}class no{constructor(e){this.parser=e,this.name=fe.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,n=s.json,o=n.textures[e];if(!o.extensions||!o.extensions[t])return null;const i=o.extensions[t],r=n.images[i.source];let a=s.textureLoader;if(r.uri){const h=s.options.manager.getHandler(r.uri);h!==null&&(a=h)}return this.detectSupport().then(function(h){if(h)return s.loadTextureImage(e,i.source,a);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class oo{constructor(e){this.parser=e,this.name=fe.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,n=s.json,o=n.textures[e];if(!o.extensions||!o.extensions[t])return null;const i=o.extensions[t],r=n.images[i.source];let a=s.textureLoader;if(r.uri){const h=s.options.manager.getHandler(r.uri);h!==null&&(a=h)}return this.detectSupport().then(function(h){if(h)return s.loadTextureImage(e,i.source,a);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class io{constructor(e){this.name=fe.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const n=s.extensions[this.name],o=this.parser.getDependency("buffer",n.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(r){const a=n.byteOffset||0,h=n.byteLength||0,d=n.count,p=n.byteStride,m=new Uint8Array(r,a,h);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(d,p,m,n.mode,n.filter).then(function(g){return g.buffer}):i.ready.then(function(){const g=new ArrayBuffer(d*p);return i.decodeGltfBuffer(new Uint8Array(g),d,p,m,n.mode,n.filter),g})})}else return null}}class ro{constructor(e){this.name=fe.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||s.mesh===void 0)return null;const n=t.meshes[s.mesh];for(const h of n.primitives)if(h.mode!==ke.TRIANGLES&&h.mode!==ke.TRIANGLE_STRIP&&h.mode!==ke.TRIANGLE_FAN&&h.mode!==void 0)return null;const i=s.extensions[this.name].attributes,r=[],a={};for(const h in i)r.push(this.parser.getDependency("accessor",i[h]).then(d=>(a[h]=d,a[h])));return r.length<1?null:(r.push(this.parser.createNodeMesh(e)),Promise.all(r).then(h=>{const d=h.pop(),p=d.isGroup?d.children:[d],m=h[0].count,g=[];for(const A of p){const b=new l.Matrix4,_=new l.Vector3,M=new l.Quaternion,L=new l.Vector3(1,1,1),w=new l.InstancedMesh(A.geometry,A.material,m);for(let y=0;y<m;y++)a.TRANSLATION&&_.fromBufferAttribute(a.TRANSLATION,y),a.ROTATION&&M.fromBufferAttribute(a.ROTATION,y),a.SCALE&&L.fromBufferAttribute(a.SCALE,y),w.setMatrixAt(y,b.compose(_,M,L));for(const y in a)y!=="TRANSLATION"&&y!=="ROTATION"&&y!=="SCALE"&&A.geometry.setAttribute(y,a[y]);l.Object3D.prototype.copy.call(w,A),this.parser.assignFinalMaterial(w),g.push(w)}return d.isGroup?(d.clear(),d.add(...g),d):g[0]}))}}const Ls="glTF",_t=12,Ps={JSON:1313821514,BIN:5130562};class ao{constructor(e){this.name=fe.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,_t);if(this.header={magic:l.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Ls)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-_t,n=new DataView(e,_t);let o=0;for(;o<s;){const i=n.getUint32(o,!0);o+=4;const r=n.getUint32(o,!0);if(o+=4,r===Ps.JSON){const a=new Uint8Array(e,_t+o,i);this.content=l.LoaderUtils.decodeText(a)}else if(r===Ps.BIN){const a=_t+o;this.body=e.slice(a,a+i)}o+=i}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class lo{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=fe.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const s=this.json,n=this.dracoLoader,o=e.extensions[this.name].bufferView,i=e.extensions[this.name].attributes,r={},a={},h={};for(const d in i){const p=Xt[d]||d.toLowerCase();r[p]=i[d]}for(const d in e.attributes){const p=Xt[d]||d.toLowerCase();if(i[d]!==void 0){const m=s.accessors[e.attributes[d]],g=ht[m.componentType];h[p]=g.name,a[p]=m.normalized===!0}}return t.getDependency("bufferView",o).then(function(d){return new Promise(function(p){n.decodeDracoFile(d,function(m){for(const g in m.attributes){const A=m.attributes[g],b=a[g];b!==void 0&&(A.normalized=b)}p(m)},r,h)})})}}class co{constructor(){this.name=fe.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class ho{constructor(){this.name=fe.KHR_MESH_QUANTIZATION}}class Os extends l.Interpolant{constructor(e,t,s,n){super(e,t,s,n)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,n=this.valueSize,o=e*n*3+n;for(let i=0;i!==n;i++)t[i]=s[o+i];return t}interpolate_(e,t,s,n){const o=this.resultBuffer,i=this.sampleValues,r=this.valueSize,a=r*2,h=r*3,d=n-t,p=(s-t)/d,m=p*p,g=m*p,A=e*h,b=A-h,_=-2*g+3*m,M=g-m,L=1-_,w=M-m+p;for(let y=0;y!==r;y++){const C=i[b+y+r],T=i[b+y+a]*d,x=i[A+y+r],v=i[A+y]*d;o[y]=L*C+w*T+_*x+M*v}return o}}const uo=new l.Quaternion;class po extends Os{interpolate_(e,t,s,n){const o=super.interpolate_(e,t,s,n);return uo.fromArray(o).normalize().toArray(o),o}}const ke={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},ht={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Is={9728:l.NearestFilter,9729:l.LinearFilter,9984:l.NearestMipmapNearestFilter,9985:l.LinearMipmapNearestFilter,9986:l.NearestMipmapLinearFilter,9987:l.LinearMipmapLinearFilter},Ds={33071:l.ClampToEdgeWrapping,33648:l.MirroredRepeatWrapping,10497:l.RepeatWrapping},Yt={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Xt={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...l.REVISION.replace(/\D+/g,"")>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},We={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},fo={CUBICSPLINE:void 0,LINEAR:l.InterpolateLinear,STEP:l.InterpolateDiscrete},Zt={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function mo(c){return c.DefaultMaterial===void 0&&(c.DefaultMaterial=new l.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:l.FrontSide})),c.DefaultMaterial}function et(c,e,t){for(const s in t.extensions)c[s]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[s]=t.extensions[s])}function qe(c,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(c.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function go(c,e,t){let s=!1,n=!1,o=!1;for(let h=0,d=e.length;h<d;h++){const p=e[h];if(p.POSITION!==void 0&&(s=!0),p.NORMAL!==void 0&&(n=!0),p.COLOR_0!==void 0&&(o=!0),s&&n&&o)break}if(!s&&!n&&!o)return Promise.resolve(c);const i=[],r=[],a=[];for(let h=0,d=e.length;h<d;h++){const p=e[h];if(s){const m=p.POSITION!==void 0?t.getDependency("accessor",p.POSITION):c.attributes.position;i.push(m)}if(n){const m=p.NORMAL!==void 0?t.getDependency("accessor",p.NORMAL):c.attributes.normal;r.push(m)}if(o){const m=p.COLOR_0!==void 0?t.getDependency("accessor",p.COLOR_0):c.attributes.color;a.push(m)}}return Promise.all([Promise.all(i),Promise.all(r),Promise.all(a)]).then(function(h){const d=h[0],p=h[1],m=h[2];return s&&(c.morphAttributes.position=d),n&&(c.morphAttributes.normal=p),o&&(c.morphAttributes.color=m),c.morphTargetsRelative=!0,c})}function yo(c,e){if(c.updateMorphTargets(),e.weights!==void 0)for(let t=0,s=e.weights.length;t<s;t++)c.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(c.morphTargetInfluences.length===t.length){c.morphTargetDictionary={};for(let s=0,n=t.length;s<n;s++)c.morphTargetDictionary[t[s]]=s}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function _o(c){let e;const t=c.extensions&&c.extensions[fe.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+Qt(t.attributes):e=c.indices+":"+Qt(c.attributes)+":"+c.mode,c.targets!==void 0)for(let s=0,n=c.targets.length;s<n;s++)e+=":"+Qt(c.targets[s]);return e}function Qt(c){let e="";const t=Object.keys(c).sort();for(let s=0,n=t.length;s<n;s++)e+=t[s]+":"+c[t[s]]+";";return e}function Kt(c){switch(c){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function wo(c){return c.search(/\.jpe?g($|\?)/i)>0||c.search(/^data\:image\/jpeg/)===0?"image/jpeg":c.search(/\.webp($|\?)/i)>0||c.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const xo=new l.Matrix4;class bo{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Yn,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,n=!1,o=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(s=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,n=navigator.userAgent.indexOf("Firefox")>-1,o=n?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||s||n&&o<98?this.textureLoader=new l.TextureLoader(this.options.manager):this.textureLoader=new l.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new l.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const s=this,n=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(i){return i._markDefs&&i._markDefs()}),Promise.all(this._invokeAll(function(i){return i.beforeRoot&&i.beforeRoot()})).then(function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])}).then(function(i){const r={scene:i[0][n.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:n.asset,parser:s,userData:{}};et(o,r,n),qe(r,n),Promise.all(s._invokeAll(function(a){return a.afterRoot&&a.afterRoot(r)})).then(function(){e(r)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let n=0,o=t.length;n<o;n++){const i=t[n].joints;for(let r=0,a=i.length;r<a;r++)e[i[r]].isBone=!0}for(let n=0,o=e.length;n<o;n++){const i=e[n];i.mesh!==void 0&&(this._addNodeRef(this.meshCache,i.mesh),i.skin!==void 0&&(s[i.mesh].isSkinnedMesh=!0)),i.camera!==void 0&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,s){if(e.refs[t]<=1)return s;const n=s.clone(),o=(i,r)=>{const a=this.associations.get(i);a!=null&&this.associations.set(r,a);for(const[h,d]of i.children.entries())o(d,r.children[h])};return o(s,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const n=e(t[s]);if(n)return n}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let n=0;n<t.length;n++){const o=e(t[n]);o&&s.push(o)}return s}getDependency(e,t){const s=e+":"+t;let n=this.cache.get(s);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(o){return o.loadNode&&o.loadNode(t)});break;case"mesh":n=this._invokeOne(function(o){return o.loadMesh&&o.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(o){return o.loadBufferView&&o.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(o){return o.loadMaterial&&o.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(o){return o.loadTexture&&o.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(o){return o.loadAnimation&&o.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(n=this._invokeOne(function(o){return o!=this&&o.getDependency&&o.getDependency(e,t)}),!n)throw new Error("Unknown type: "+e);break}this.cache.add(s,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,n=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(n.map(function(o,i){return s.getDependency(e,i)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],s=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[fe.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(o,i){s.load(l.LoaderUtils.resolveURL(t.uri,n.path),o,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(s){const n=t.byteLength||0,o=t.byteOffset||0;return s.slice(o,o+n)})}loadAccessor(e){const t=this,s=this.json,n=this.json.accessors[e];if(n.bufferView===void 0&&n.sparse===void 0){const i=Yt[n.type],r=ht[n.componentType],a=n.normalized===!0,h=new r(n.count*i);return Promise.resolve(new l.BufferAttribute(h,i,a))}const o=[];return n.bufferView!==void 0?o.push(this.getDependency("bufferView",n.bufferView)):o.push(null),n.sparse!==void 0&&(o.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),o.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(o).then(function(i){const r=i[0],a=Yt[n.type],h=ht[n.componentType],d=h.BYTES_PER_ELEMENT,p=d*a,m=n.byteOffset||0,g=n.bufferView!==void 0?s.bufferViews[n.bufferView].byteStride:void 0,A=n.normalized===!0;let b,_;if(g&&g!==p){const M=Math.floor(m/g),L="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+M+":"+n.count;let w=t.cache.get(L);w||(b=new h(r,M*g,n.count*g/d),w=new l.InterleavedBuffer(b,g/d),t.cache.add(L,w)),_=new l.InterleavedBufferAttribute(w,a,m%g/d,A)}else r===null?b=new h(n.count*a):b=new h(r,m,n.count*a),_=new l.BufferAttribute(b,a,A);if(n.sparse!==void 0){const M=Yt.SCALAR,L=ht[n.sparse.indices.componentType],w=n.sparse.indices.byteOffset||0,y=n.sparse.values.byteOffset||0,C=new L(i[1],w,n.sparse.count*M),T=new h(i[2],y,n.sparse.count*a);r!==null&&(_=new l.BufferAttribute(_.array.slice(),_.itemSize,_.normalized));for(let x=0,v=C.length;x<v;x++){const D=C[x];if(_.setX(D,T[x*a]),a>=2&&_.setY(D,T[x*a+1]),a>=3&&_.setZ(D,T[x*a+2]),a>=4&&_.setW(D,T[x*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return _})}loadTexture(e){const t=this.json,s=this.options,o=t.textures[e].source,i=t.images[o];let r=this.textureLoader;if(i.uri){const a=s.manager.getHandler(i.uri);a!==null&&(r=a)}return this.loadTextureImage(e,o,r)}loadTextureImage(e,t,s){const n=this,o=this.json,i=o.textures[e],r=o.images[t],a=(r.uri||r.bufferView)+":"+i.sampler;if(this.textureCache[a])return this.textureCache[a];const h=this.loadImageSource(t,s).then(function(d){d.flipY=!1,d.name=i.name||r.name||"",d.name===""&&typeof r.uri=="string"&&r.uri.startsWith("data:image/")===!1&&(d.name=r.uri);const m=(o.samplers||{})[i.sampler]||{};return d.magFilter=Is[m.magFilter]||l.LinearFilter,d.minFilter=Is[m.minFilter]||l.LinearMipmapLinearFilter,d.wrapS=Ds[m.wrapS]||l.RepeatWrapping,d.wrapT=Ds[m.wrapT]||l.RepeatWrapping,n.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[a]=h,h}loadImageSource(e,t){const s=this,n=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(p=>p.clone());const i=n.images[e],r=self.URL||self.webkitURL;let a=i.uri||"",h=!1;if(i.bufferView!==void 0)a=s.getDependency("bufferView",i.bufferView).then(function(p){h=!0;const m=new Blob([p],{type:i.mimeType});return a=r.createObjectURL(m),a});else if(i.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(a).then(function(p){return new Promise(function(m,g){let A=m;t.isImageBitmapLoader===!0&&(A=function(b){const _=new l.Texture(b);_.needsUpdate=!0,m(_)}),t.load(l.LoaderUtils.resolveURL(p,o.path),A,void 0,g)})}).then(function(p){return h===!0&&r.revokeObjectURL(a),p.userData.mimeType=i.mimeType||wo(i.uri),p}).catch(function(p){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),p});return this.sourceCache[e]=d,d}assignTexture(e,t,s,n){const o=this;return this.getDependency("texture",s.index).then(function(i){if(!i)return null;if(s.texCoord!==void 0&&s.texCoord>0&&(i=i.clone(),i.channel=s.texCoord),o.extensions[fe.KHR_TEXTURE_TRANSFORM]){const r=s.extensions!==void 0?s.extensions[fe.KHR_TEXTURE_TRANSFORM]:void 0;if(r){const a=o.associations.get(i);i=o.extensions[fe.KHR_TEXTURE_TRANSFORM].extendTexture(i,r),o.associations.set(i,a)}}return n!==void 0&&("colorSpace"in i?i.colorSpace=n===3001?"srgb":"srgb-linear":i.encoding=n),e[t]=i,i})}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const n=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,i=t.attributes.normal===void 0;if(e.isPoints){const r="PointsMaterial:"+s.uuid;let a=this.cache.get(r);a||(a=new l.PointsMaterial,l.Material.prototype.copy.call(a,s),a.color.copy(s.color),a.map=s.map,a.sizeAttenuation=!1,this.cache.add(r,a)),s=a}else if(e.isLine){const r="LineBasicMaterial:"+s.uuid;let a=this.cache.get(r);a||(a=new l.LineBasicMaterial,l.Material.prototype.copy.call(a,s),a.color.copy(s.color),a.map=s.map,this.cache.add(r,a)),s=a}if(n||o||i){let r="ClonedMaterial:"+s.uuid+":";n&&(r+="derivative-tangents:"),o&&(r+="vertex-colors:"),i&&(r+="flat-shading:");let a=this.cache.get(r);a||(a=s.clone(),o&&(a.vertexColors=!0),i&&(a.flatShading=!0),n&&(a.normalScale&&(a.normalScale.y*=-1),a.clearcoatNormalScale&&(a.clearcoatNormalScale.y*=-1)),this.cache.add(r,a),this.associations.set(a,this.associations.get(s))),s=a}e.material=s}getMaterialType(){return l.MeshStandardMaterial}loadMaterial(e){const t=this,s=this.json,n=this.extensions,o=s.materials[e];let i;const r={},a=o.extensions||{},h=[];if(a[fe.KHR_MATERIALS_UNLIT]){const p=n[fe.KHR_MATERIALS_UNLIT];i=p.getMaterialType(),h.push(p.extendParams(r,o,t))}else{const p=o.pbrMetallicRoughness||{};if(r.color=new l.Color(1,1,1),r.opacity=1,Array.isArray(p.baseColorFactor)){const m=p.baseColorFactor;r.color.fromArray(m),r.opacity=m[3]}p.baseColorTexture!==void 0&&h.push(t.assignTexture(r,"map",p.baseColorTexture,3001)),r.metalness=p.metallicFactor!==void 0?p.metallicFactor:1,r.roughness=p.roughnessFactor!==void 0?p.roughnessFactor:1,p.metallicRoughnessTexture!==void 0&&(h.push(t.assignTexture(r,"metalnessMap",p.metallicRoughnessTexture)),h.push(t.assignTexture(r,"roughnessMap",p.metallicRoughnessTexture))),i=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(e)}),h.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(e,r)})))}o.doubleSided===!0&&(r.side=l.DoubleSide);const d=o.alphaMode||Zt.OPAQUE;if(d===Zt.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,d===Zt.MASK&&(r.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&i!==l.MeshBasicMaterial&&(h.push(t.assignTexture(r,"normalMap",o.normalTexture)),r.normalScale=new l.Vector2(1,1),o.normalTexture.scale!==void 0)){const p=o.normalTexture.scale;r.normalScale.set(p,p)}return o.occlusionTexture!==void 0&&i!==l.MeshBasicMaterial&&(h.push(t.assignTexture(r,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(r.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&i!==l.MeshBasicMaterial&&(r.emissive=new l.Color().fromArray(o.emissiveFactor)),o.emissiveTexture!==void 0&&i!==l.MeshBasicMaterial&&h.push(t.assignTexture(r,"emissiveMap",o.emissiveTexture,3001)),Promise.all(h).then(function(){const p=new i(r);return o.name&&(p.name=o.name),qe(p,o),t.associations.set(p,{materials:e}),o.extensions&&et(n,p,o),p})}createUniqueName(e){const t=l.PropertyBinding.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,s=this.extensions,n=this.primitiveCache;function o(r){return s[fe.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(r,t).then(function(a){return ks(a,r,t)})}const i=[];for(let r=0,a=e.length;r<a;r++){const h=e[r],d=_o(h),p=n[d];if(p)i.push(p.promise);else{let m;h.extensions&&h.extensions[fe.KHR_DRACO_MESH_COMPRESSION]?m=o(h):m=ks(new l.BufferGeometry,h,t),n[d]={primitive:h,promise:m},i.push(m)}}return Promise.all(i)}loadMesh(e){const t=this,s=this.json,n=this.extensions,o=s.meshes[e],i=o.primitives,r=[];for(let a=0,h=i.length;a<h;a++){const d=i[a].material===void 0?mo(this.cache):this.getDependency("material",i[a].material);r.push(d)}return r.push(t.loadGeometries(i)),Promise.all(r).then(function(a){const h=a.slice(0,a.length-1),d=a[a.length-1],p=[];for(let g=0,A=d.length;g<A;g++){const b=d[g],_=i[g];let M;const L=h[g];if(_.mode===ke.TRIANGLES||_.mode===ke.TRIANGLE_STRIP||_.mode===ke.TRIANGLE_FAN||_.mode===void 0)M=o.isSkinnedMesh===!0?new l.SkinnedMesh(b,L):new l.Mesh(b,L),M.isSkinnedMesh===!0&&M.normalizeSkinWeights(),_.mode===ke.TRIANGLE_STRIP?M.geometry=_s(M.geometry,l.TriangleStripDrawMode):_.mode===ke.TRIANGLE_FAN&&(M.geometry=_s(M.geometry,l.TriangleFanDrawMode));else if(_.mode===ke.LINES)M=new l.LineSegments(b,L);else if(_.mode===ke.LINE_STRIP)M=new l.Line(b,L);else if(_.mode===ke.LINE_LOOP)M=new l.LineLoop(b,L);else if(_.mode===ke.POINTS)M=new l.Points(b,L);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+_.mode);Object.keys(M.geometry.morphAttributes).length>0&&yo(M,o),M.name=t.createUniqueName(o.name||"mesh_"+e),qe(M,o),_.extensions&&et(n,M,_),t.assignFinalMaterial(M),p.push(M)}for(let g=0,A=p.length;g<A;g++)t.associations.set(p[g],{meshes:e,primitives:g});if(p.length===1)return o.extensions&&et(n,p[0],o),p[0];const m=new l.Group;o.extensions&&et(n,m,o),t.associations.set(m,{meshes:e});for(let g=0,A=p.length;g<A;g++)m.add(p[g]);return m})}loadCamera(e){let t;const s=this.json.cameras[e],n=s[s.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return s.type==="perspective"?t=new l.PerspectiveCamera(l.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):s.type==="orthographic"&&(t=new l.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),qe(t,s),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],s=[];for(let n=0,o=t.joints.length;n<o;n++)s.push(this._loadNodeShallow(t.joints[n]));return t.inverseBindMatrices!==void 0?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then(function(n){const o=n.pop(),i=n,r=[],a=[];for(let h=0,d=i.length;h<d;h++){const p=i[h];if(p){r.push(p);const m=new l.Matrix4;o!==null&&m.fromArray(o.array,h*16),a.push(m)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[h])}return new l.Skeleton(r,a)})}loadAnimation(e){const s=this.json.animations[e],n=s.name?s.name:"animation_"+e,o=[],i=[],r=[],a=[],h=[];for(let d=0,p=s.channels.length;d<p;d++){const m=s.channels[d],g=s.samplers[m.sampler],A=m.target,b=A.node,_=s.parameters!==void 0?s.parameters[g.input]:g.input,M=s.parameters!==void 0?s.parameters[g.output]:g.output;A.node!==void 0&&(o.push(this.getDependency("node",b)),i.push(this.getDependency("accessor",_)),r.push(this.getDependency("accessor",M)),a.push(g),h.push(A))}return Promise.all([Promise.all(o),Promise.all(i),Promise.all(r),Promise.all(a),Promise.all(h)]).then(function(d){const p=d[0],m=d[1],g=d[2],A=d[3],b=d[4],_=[];for(let M=0,L=p.length;M<L;M++){const w=p[M],y=m[M],C=g[M],T=A[M],x=b[M];if(w===void 0)continue;w.updateMatrix();let v;switch(We[x.path]){case We.weights:v=l.NumberKeyframeTrack;break;case We.rotation:v=l.QuaternionKeyframeTrack;break;case We.position:case We.scale:default:v=l.VectorKeyframeTrack;break}const D=w.name?w.name:w.uuid,z=T.interpolation!==void 0?fo[T.interpolation]:l.InterpolateLinear,U=[];We[x.path]===We.weights?w.traverse(function(K){K.morphTargetInfluences&&U.push(K.name?K.name:K.uuid)}):U.push(D);let R=C.array;if(C.normalized){const K=Kt(R.constructor),J=new Float32Array(R.length);for(let Q=0,pe=R.length;Q<pe;Q++)J[Q]=R[Q]*K;R=J}for(let K=0,J=U.length;K<J;K++){const Q=new v(U[K]+"."+We[x.path],y.array,R,z);T.interpolation==="CUBICSPLINE"&&(Q.createInterpolant=function(Z){const G=this instanceof l.QuaternionKeyframeTrack?po:Os;return new G(this.times,this.values,this.getValueSize()/3,Z)},Q.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),_.push(Q)}}return new l.AnimationClip(n,void 0,_)})}createNodeMesh(e){const t=this.json,s=this,n=t.nodes[e];return n.mesh===void 0?null:s.getDependency("mesh",n.mesh).then(function(o){const i=s._getNodeRef(s.meshCache,n.mesh,o);return n.weights!==void 0&&i.traverse(function(r){if(r.isMesh)for(let a=0,h=n.weights.length;a<h;a++)r.morphTargetInfluences[a]=n.weights[a]}),i})}loadNode(e){const t=this.json,s=this,n=t.nodes[e],o=s._loadNodeShallow(e),i=[],r=n.children||[];for(let h=0,d=r.length;h<d;h++)i.push(s.getDependency("node",r[h]));const a=n.skin===void 0?Promise.resolve(null):s.getDependency("skin",n.skin);return Promise.all([o,Promise.all(i),a]).then(function(h){const d=h[0],p=h[1],m=h[2];m!==null&&d.traverse(function(g){g.isSkinnedMesh&&g.bind(m,xo)});for(let g=0,A=p.length;g<A;g++)d.add(p[g]);return d})}_loadNodeShallow(e){const t=this.json,s=this.extensions,n=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const o=t.nodes[e],i=o.name?n.createUniqueName(o.name):"",r=[],a=n._invokeOne(function(h){return h.createNodeMesh&&h.createNodeMesh(e)});return a&&r.push(a),o.camera!==void 0&&r.push(n.getDependency("camera",o.camera).then(function(h){return n._getNodeRef(n.cameraCache,o.camera,h)})),n._invokeAll(function(h){return h.createNodeAttachment&&h.createNodeAttachment(e)}).forEach(function(h){r.push(h)}),this.nodeCache[e]=Promise.all(r).then(function(h){let d;if(o.isBone===!0?d=new l.Bone:h.length>1?d=new l.Group:h.length===1?d=h[0]:d=new l.Object3D,d!==h[0])for(let p=0,m=h.length;p<m;p++)d.add(h[p]);if(o.name&&(d.userData.name=o.name,d.name=i),qe(d,o),o.extensions&&et(s,d,o),o.matrix!==void 0){const p=new l.Matrix4;p.fromArray(o.matrix),d.applyMatrix4(p)}else o.translation!==void 0&&d.position.fromArray(o.translation),o.rotation!==void 0&&d.quaternion.fromArray(o.rotation),o.scale!==void 0&&d.scale.fromArray(o.scale);return n.associations.has(d)||n.associations.set(d,{}),n.associations.get(d).nodes=e,d}),this.nodeCache[e]}loadScene(e){const t=this.extensions,s=this.json.scenes[e],n=this,o=new l.Group;s.name&&(o.name=n.createUniqueName(s.name)),qe(o,s),s.extensions&&et(t,o,s);const i=s.nodes||[],r=[];for(let a=0,h=i.length;a<h;a++)r.push(n.getDependency("node",i[a]));return Promise.all(r).then(function(a){for(let d=0,p=a.length;d<p;d++)o.add(a[d]);const h=d=>{const p=new Map;for(const[m,g]of n.associations)(m instanceof l.Material||m instanceof l.Texture)&&p.set(m,g);return d.traverse(m=>{const g=n.associations.get(m);g!=null&&p.set(m,g)}),p};return n.associations=h(o),o})}}function vo(c,e,t){const s=e.attributes,n=new l.Box3;if(s.POSITION!==void 0){const r=t.json.accessors[s.POSITION],a=r.min,h=r.max;if(a!==void 0&&h!==void 0){if(n.set(new l.Vector3(a[0],a[1],a[2]),new l.Vector3(h[0],h[1],h[2])),r.normalized){const d=Kt(ht[r.componentType]);n.min.multiplyScalar(d),n.max.multiplyScalar(d)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const o=e.targets;if(o!==void 0){const r=new l.Vector3,a=new l.Vector3;for(let h=0,d=o.length;h<d;h++){const p=o[h];if(p.POSITION!==void 0){const m=t.json.accessors[p.POSITION],g=m.min,A=m.max;if(g!==void 0&&A!==void 0){if(a.setX(Math.max(Math.abs(g[0]),Math.abs(A[0]))),a.setY(Math.max(Math.abs(g[1]),Math.abs(A[1]))),a.setZ(Math.max(Math.abs(g[2]),Math.abs(A[2]))),m.normalized){const b=Kt(ht[m.componentType]);a.multiplyScalar(b)}r.max(a)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(r)}c.boundingBox=n;const i=new l.Sphere;n.getCenter(i.center),i.radius=n.min.distanceTo(n.max)/2,c.boundingSphere=i}function ks(c,e,t){const s=e.attributes,n=[];function o(i,r){return t.getDependency("accessor",i).then(function(a){c.setAttribute(r,a)})}for(const i in s){const r=Xt[i]||i.toLowerCase();r in c.attributes||n.push(o(s[i],r))}if(e.indices!==void 0&&!c.index){const i=t.getDependency("accessor",e.indices).then(function(r){c.setIndex(r)});n.push(i)}return qe(c,e),vo(c,e,t),Promise.all(n).then(function(){return e.targets!==void 0?go(c,e.targets,t):c})}class Fs extends l.ExtrudeGeometry{constructor(e,t={}){const{bevelEnabled:s=!1,bevelSize:n=8,bevelThickness:o=10,font:i,height:r=50,size:a=100,lineHeight:h=1,letterSpacing:d=0,...p}=t;if(i===void 0)super();else{const m=i.generateShapes(e,a,{lineHeight:h,letterSpacing:d});super(m,{...p,bevelEnabled:s,bevelSize:n,bevelThickness:o,depth:r})}this.type="TextGeometry"}}const Ao={uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:`
|
|
9
9
|
varying vec2 vUv;
|
|
10
10
|
|
|
11
11
|
void main() {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
gl_FragColor = sum;
|
|
38
38
|
|
|
39
39
|
}
|
|
40
|
-
`},
|
|
40
|
+
`},Mo={uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:`
|
|
41
41
|
varying vec2 vUv;
|
|
42
42
|
|
|
43
43
|
void main() {
|
|
@@ -70,20 +70,18 @@
|
|
|
70
70
|
gl_FragColor = sum;
|
|
71
71
|
|
|
72
72
|
}
|
|
73
|
-
`};function _s(l,e,t){const s=t.length-l-1;if(e>=t[s])return s-1;if(e<=t[l])return l;let n=l,i=s,o=Math.floor((n+i)/2);for(;e<t[o]||e>=t[o+1];)e<t[o]?i=o:n=o,o=Math.floor((n+i)/2);return o}function di(l,e,t,s){const n=[],i=[],o=[];n[0]=1;for(let r=1;r<=t;++r){i[r]=e-s[l+1-r],o[r]=s[l+r]-e;let a=0;for(let h=0;h<r;++h){const p=o[h+1],d=i[r-h],m=n[h]/(p+d);n[h]=a+p*m,a=d*m}n[r]=a}return n}function mi(l,e,t,s){const n=_s(l,s,e),i=di(n,s,l,e),o=new c.Vector4(0,0,0,0);for(let r=0;r<=l;++r){const a=t[n-l+r],h=i[r],p=a.w*h;o.x+=a.x*p,o.y+=a.y*p,o.z+=a.z*p,o.w+=a.w*h}return o}function fi(l,e,t,s,n){const i=[];for(let d=0;d<=t;++d)i[d]=0;const o=[];for(let d=0;d<=s;++d)o[d]=i.slice(0);const r=[];for(let d=0;d<=t;++d)r[d]=i.slice(0);r[0][0]=1;const a=i.slice(0),h=i.slice(0);for(let d=1;d<=t;++d){a[d]=e-n[l+1-d],h[d]=n[l+d]-e;let m=0;for(let f=0;f<d;++f){const w=h[f+1],y=a[d-f];r[d][f]=w+y;const v=r[f][d-1]/r[d][f];r[f][d]=m+w*v,m=y*v}r[d][d]=m}for(let d=0;d<=t;++d)o[0][d]=r[d][t];for(let d=0;d<=t;++d){let m=0,f=1;const w=[];for(let y=0;y<=t;++y)w[y]=i.slice(0);w[0][0]=1;for(let y=1;y<=s;++y){let v=0;const M=d-y,L=t-y;d>=y&&(w[f][0]=w[m][0]/r[L+1][M],v=w[f][0]*r[M][L]);const b=M>=-1?1:-M,g=d-1<=L?y-1:t-d;for(let A=b;A<=g;++A)w[f][A]=(w[m][A]-w[m][A-1])/r[L+1][M+A],v+=w[f][A]*r[M+A][L];d<=L&&(w[f][y]=-w[m][y-1]/r[L+1][d],v+=w[f][y]*r[d][L]),o[y][d]=v;const S=m;m=f,f=S}}let p=t;for(let d=1;d<=s;++d){for(let m=0;m<=t;++m)o[d][m]*=p;p*=t-d}return o}function gi(l,e,t,s,n){const i=n<l?n:l,o=[],r=_s(l,s,e),a=fi(r,s,l,i,e),h=[];for(let p=0;p<t.length;++p){const d=t[p].clone(),m=d.w;d.x*=m,d.y*=m,d.z*=m,h[p]=d}for(let p=0;p<=i;++p){const d=h[r-l].clone().multiplyScalar(a[p][0]);for(let m=1;m<=l;++m)d.add(h[r-l+m].clone().multiplyScalar(a[p][m]));o[p]=d}for(let p=i+1;p<=n+1;++p)o[p]=new c.Vector4(0,0,0);return o}function yi(l,e){let t=1;for(let n=2;n<=l;++n)t*=n;let s=1;for(let n=2;n<=e;++n)s*=n;for(let n=2;n<=l-e;++n)s*=n;return t/s}function _i(l){const e=l.length,t=[],s=[];for(let i=0;i<e;++i){const o=l[i];t[i]=new c.Vector3(o.x,o.y,o.z),s[i]=o.w}const n=[];for(let i=0;i<e;++i){const o=t[i].clone();for(let r=1;r<=i;++r)o.sub(n[i-r].clone().multiplyScalar(yi(i,r)*s[r]));n[i]=o.divideScalar(s[0])}return n}function wi(l,e,t,s,n){const i=gi(l,e,t,s,n);return _i(i)}class ws extends c.Curve{constructor(e,t,s,n,i){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=n||0,this.endKnot=i||this.knots.length-1;for(let o=0;o<s.length;++o){const r=s[o];this.controlPoints[o]=new c.Vector4(r.x,r.y,r.z,r.w)}}getPoint(e,t){const s=t||new c.Vector3,n=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=mi(this.degree,this.knots,this.controlPoints,n);return i.w!=1&&i.divideScalar(i.w),s.set(i.x,i.y,i.z)}getTangent(e,t){const s=t||new c.Vector3,n=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=wi(this.degree,this.knots,this.controlPoints,n,1);return s.copy(i[1]).normalize(),s}}let j,ie,de;class xi extends c.Loader{constructor(e){super(e)}load(e,t,s,n){const i=this,o=i.path===""?c.LoaderUtils.extractUrlBase(e):i.path,r=new c.FileLoader(this.manager);r.setPath(i.path),r.setResponseType("arraybuffer"),r.setRequestHeader(i.requestHeader),r.setWithCredentials(i.withCredentials),r.load(e,function(a){try{t(i.parse(a,o))}catch(h){n?n(h):console.error(h),i.manager.itemError(e)}},s,n)}parse(e,t){if(Ti(e))j=new Si().parse(e);else{const n=Ss(e);if(!Li(n))throw new Error("THREE.FBXLoader: Unknown format.");if(As(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+As(n));j=new bi().parse(n)}const s=new c.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new vi(s,this.manager).parse(j)}}class vi{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){ie=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),s=this.parseMaterials(t),n=this.parseDeformers(),i=new Ai().parse(n);return this.parseScene(n,i,s),de}parseConnections(){const e=new Map;return"Connections"in j&&j.Connections.connections.forEach(function(s){const n=s[0],i=s[1],o=s[2];e.has(n)||e.set(n,{parents:[],children:[]});const r={ID:i,relationship:o};e.get(n).parents.push(r),e.has(i)||e.set(i,{parents:[],children:[]});const a={ID:n,relationship:o};e.get(i).children.push(a)}),e}parseImages(){const e={},t={};if("Video"in j.Objects){const s=j.Objects.Video;for(const n in s){const i=s[n],o=parseInt(n);if(e[o]=i.RelativeFilename||i.Filename,"Content"in i){const r=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,a=typeof i.Content=="string"&&i.Content!=="";if(r||a){const h=this.parseImage(s[n]);t[i.RelativeFilename||i.Filename]=h}}}}for(const s in e){const n=e[s];t[n]!==void 0?e[s]=t[n]:e[s]=e[s].split("\\").pop()}return e}parseImage(e){const t=e.Content,s=e.RelativeFilename||e.Filename,n=s.slice(s.lastIndexOf(".")+1).toLowerCase();let i;switch(n){case"bmp":i="image/bmp";break;case"jpg":case"jpeg":i="image/jpeg";break;case"png":i="image/png";break;case"tif":i="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",s),i="image/tga";break;default:console.warn('FBXLoader: Image type "'+n+'" is not supported.');return}if(typeof t=="string")return"data:"+i+";base64,"+t;{const o=new Uint8Array(t);return window.URL.createObjectURL(new Blob([o],{type:i}))}}parseTextures(e){const t=new Map;if("Texture"in j.Objects){const s=j.Objects.Texture;for(const n in s){const i=this.parseTexture(s[n],e);t.set(parseInt(n),i)}}return t}parseTexture(e,t){const s=this.loadTexture(e,t);s.ID=e.id,s.name=e.attrName;const n=e.WrapModeU,i=e.WrapModeV,o=n!==void 0?n.value:0,r=i!==void 0?i.value:0;if(s.wrapS=o===0?c.RepeatWrapping:c.ClampToEdgeWrapping,s.wrapT=r===0?c.RepeatWrapping:c.ClampToEdgeWrapping,"Scaling"in e){const a=e.Scaling.value;s.repeat.x=a[0],s.repeat.y=a[1]}return s}loadTexture(e,t){let s;const n=this.textureLoader.path,i=ie.get(e.id).children;i!==void 0&&i.length>0&&t[i[0].ID]!==void 0&&(s=t[i[0].ID],(s.indexOf("blob:")===0||s.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let o;const r=e.FileName.slice(-3).toLowerCase();if(r==="tga"){const a=this.manager.getHandler(".tga");a===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),o=new c.Texture):(a.setPath(this.textureLoader.path),o=a.load(s))}else r==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),o=new c.Texture):o=this.textureLoader.load(s);return this.textureLoader.setPath(n),o}parseMaterials(e){const t=new Map;if("Material"in j.Objects){const s=j.Objects.Material;for(const n in s){const i=this.parseMaterial(s[n],e);i!==null&&t.set(parseInt(n),i)}}return t}parseMaterial(e,t){const s=e.id,n=e.attrName;let i=e.ShadingModel;if(typeof i=="object"&&(i=i.value),!ie.has(s))return null;const o=this.parseParameters(e,t,s);let r;switch(i.toLowerCase()){case"phong":r=new c.MeshPhongMaterial;break;case"lambert":r=new c.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',i),r=new c.MeshPhongMaterial;break}return r.setValues(o),r.name=n,r}parseParameters(e,t,s){const n={};e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=new c.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(n.color=new c.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=new c.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(n.emissive=new c.Color().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=new c.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(n.specular=new c.Color().fromArray(e.SpecularColor.value));const i=this;return ie.get(s).children.forEach(function(o){const r=o.relationship;switch(r){case"Bump":n.bumpMap=i.getTexture(t,o.ID);break;case"Maya|TEX_ao_map":n.aoMap=i.getTexture(t,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=i.getTexture(t,o.ID),n.map!==void 0&&("colorSpace"in n.map?n.map.colorSpace="srgb":n.map.encoding=3001);break;case"DisplacementColor":n.displacementMap=i.getTexture(t,o.ID);break;case"EmissiveColor":n.emissiveMap=i.getTexture(t,o.ID),n.emissiveMap!==void 0&&("colorSpace"in n.emissiveMap?n.emissiveMap.colorSpace="srgb":n.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=i.getTexture(t,o.ID);break;case"ReflectionColor":n.envMap=i.getTexture(t,o.ID),n.envMap!==void 0&&(n.envMap.mapping=c.EquirectangularReflectionMapping,"colorSpace"in n.envMap?n.envMap.colorSpace="srgb":n.envMap.encoding=3001);break;case"SpecularColor":n.specularMap=i.getTexture(t,o.ID),n.specularMap!==void 0&&("colorSpace"in n.specularMap?n.specularMap.colorSpace="srgb":n.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=i.getTexture(t,o.ID),n.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r);break}}),n}getTexture(e,t){return"LayeredTexture"in j.Objects&&t in j.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=ie.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in j.Objects){const s=j.Objects.Deformer;for(const n in s){const i=s[n],o=ie.get(parseInt(n));if(i.attrType==="Skin"){const r=this.parseSkeleton(o,s);r.ID=n,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),r.geometryID=o.parents[0].ID,e[n]=r}else if(i.attrType==="BlendShape"){const r={id:n};r.rawTargets=this.parseMorphTargets(o,s),r.id=n,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[n]=r}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const s=[];return e.children.forEach(function(n){const i=t[n.ID];if(i.attrType!=="Cluster")return;const o={ID:n.ID,indices:[],weights:[],transformLink:new c.Matrix4().fromArray(i.TransformLink.a)};"Indexes"in i&&(o.indices=i.Indexes.a,o.weights=i.Weights.a),s.push(o)}),{rawBones:s,bones:[]}}parseMorphTargets(e,t){const s=[];for(let n=0;n<e.children.length;n++){const i=e.children[n],o=t[i.ID],r={name:o.attrName,initialWeight:o.DeformPercent,id:o.id,fullWeights:o.FullWeights.a};if(o.attrType!=="BlendShapeChannel")return;r.geoID=ie.get(parseInt(i.ID)).children.filter(function(a){return a.relationship===void 0})[0].ID,s.push(r)}return s}parseScene(e,t,s){de=new c.Group;const n=this.parseModels(e.skeletons,t,s),i=j.Objects.Model,o=this;n.forEach(function(a){const h=i[a.ID];o.setLookAtProperties(a,h),ie.get(a.ID).parents.forEach(function(d){const m=n.get(d.ID);m!==void 0&&m.add(a)}),a.parent===null&&de.add(a)}),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),de.traverse(function(a){if(a.userData.transformData){a.parent&&(a.userData.transformData.parentMatrix=a.parent.matrix,a.userData.transformData.parentMatrixWorld=a.parent.matrixWorld);const h=Ms(a.userData.transformData);a.applyMatrix4(h),a.updateWorldMatrix()}});const r=new Mi().parse();de.children.length===1&&de.children[0].isGroup&&(de.children[0].animations=r,de=de.children[0]),de.animations=r}parseModels(e,t,s){const n=new Map,i=j.Objects.Model;for(const o in i){const r=parseInt(o),a=i[o],h=ie.get(r);let p=this.buildSkeleton(h,e,r,a.attrName);if(!p){switch(a.attrType){case"Camera":p=this.createCamera(h);break;case"Light":p=this.createLight(h);break;case"Mesh":p=this.createMesh(h,t,s);break;case"NurbsCurve":p=this.createCurve(h,t);break;case"LimbNode":case"Root":p=new c.Bone;break;case"Null":default:p=new c.Group;break}p.name=a.attrName?c.PropertyBinding.sanitizeNodeName(a.attrName):"",p.ID=r}this.getTransformData(p,a),n.set(r,p)}return n}buildSkeleton(e,t,s,n){let i=null;return e.parents.forEach(function(o){for(const r in t){const a=t[r];a.rawBones.forEach(function(h,p){if(h.ID===o.ID){const d=i;i=new c.Bone,i.matrixWorld.copy(h.transformLink),i.name=n?c.PropertyBinding.sanitizeNodeName(n):"",i.ID=s,a.bones[p]=i,d!==null&&i.add(d)}})}}),i}createCamera(e){let t,s;if(e.children.forEach(function(n){const i=j.Objects.NodeAttribute[n.ID];i!==void 0&&(s=i)}),s===void 0)t=new c.Object3D;else{let n=0;s.CameraProjectionType!==void 0&&s.CameraProjectionType.value===1&&(n=1);let i=1;s.NearPlane!==void 0&&(i=s.NearPlane.value/1e3);let o=1e3;s.FarPlane!==void 0&&(o=s.FarPlane.value/1e3);let r=window.innerWidth,a=window.innerHeight;s.AspectWidth!==void 0&&s.AspectHeight!==void 0&&(r=s.AspectWidth.value,a=s.AspectHeight.value);const h=r/a;let p=45;s.FieldOfView!==void 0&&(p=s.FieldOfView.value);const d=s.FocalLength?s.FocalLength.value:null;switch(n){case 0:t=new c.PerspectiveCamera(p,h,i,o),d!==null&&t.setFocalLength(d);break;case 1:t=new c.OrthographicCamera(-r/2,r/2,a/2,-a/2,i,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new c.Object3D;break}}return t}createLight(e){let t,s;if(e.children.forEach(function(n){const i=j.Objects.NodeAttribute[n.ID];i!==void 0&&(s=i)}),s===void 0)t=new c.Object3D;else{let n;s.LightType===void 0?n=0:n=s.LightType.value;let i=16777215;s.Color!==void 0&&(i=new c.Color().fromArray(s.Color.value));let o=s.Intensity===void 0?1:s.Intensity.value/100;s.CastLightOnObject!==void 0&&s.CastLightOnObject.value===0&&(o=0);let r=0;s.FarAttenuationEnd!==void 0&&(s.EnableFarAttenuation!==void 0&&s.EnableFarAttenuation.value===0?r=0:r=s.FarAttenuationEnd.value);const a=1;switch(n){case 0:t=new c.PointLight(i,o,r,a);break;case 1:t=new c.DirectionalLight(i,o);break;case 2:let h=Math.PI/3;s.InnerAngle!==void 0&&(h=c.MathUtils.degToRad(s.InnerAngle.value));let p=0;s.OuterAngle!==void 0&&(p=c.MathUtils.degToRad(s.OuterAngle.value),p=Math.max(p,1)),t=new c.SpotLight(i,o,r,h,p,a);break;default:console.warn("THREE.FBXLoader: Unknown light type "+s.LightType.value+", defaulting to a PointLight."),t=new c.PointLight(i,o);break}s.CastShadows!==void 0&&s.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,s){let n,i=null,o=null;const r=[];return e.children.forEach(function(a){t.has(a.ID)&&(i=t.get(a.ID)),s.has(a.ID)&&r.push(s.get(a.ID))}),r.length>1?o=r:r.length>0?o=r[0]:(o=new c.MeshPhongMaterial({color:13421772}),r.push(o)),"color"in i.attributes&&r.forEach(function(a){a.vertexColors=!0}),i.FBX_Deformer?(n=new c.SkinnedMesh(i,o),n.normalizeSkinWeights()):n=new c.Mesh(i,o),n}createCurve(e,t){const s=e.children.reduce(function(i,o){return t.has(o.ID)&&(i=t.get(o.ID)),i},null),n=new c.LineBasicMaterial({color:3342591,linewidth:1});return new c.Line(s,n)}getTransformData(e,t){const s={};"InheritType"in t&&(s.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?s.eulerOrder=bs(t.RotationOrder.value):s.eulerOrder="ZYX","Lcl_Translation"in t&&(s.translation=t.Lcl_Translation.value),"PreRotation"in t&&(s.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(s.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(s.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(s.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(s.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(s.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(s.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(s.rotationPivot=t.RotationPivot.value),e.userData.transformData=s}setLookAtProperties(e,t){"LookAtProperty"in t&&ie.get(e.ID).children.forEach(function(n){if(n.relationship==="LookAtProperty"){const i=j.Objects.Model[n.ID];if("Lcl_Translation"in i){const o=i.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),de.add(e.target)):e.lookAt(new c.Vector3().fromArray(o))}}})}bindSkeleton(e,t,s){const n=this.parsePoseNodes();for(const i in e){const o=e[i];ie.get(parseInt(o.ID)).parents.forEach(function(a){if(t.has(a.ID)){const h=a.ID;ie.get(h).parents.forEach(function(d){s.has(d.ID)&&s.get(d.ID).bind(new c.Skeleton(o.bones),n[d.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in j.Objects){const t=j.Objects.Pose;for(const s in t)if(t[s].attrType==="BindPose"&&t[s].NbPoseNodes>0){const n=t[s].PoseNode;Array.isArray(n)?n.forEach(function(i){e[i.Node]=new c.Matrix4().fromArray(i.Matrix.a)}):e[n.Node]=new c.Matrix4().fromArray(n.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in j&&"AmbientColor"in j.GlobalSettings){const e=j.GlobalSettings.AmbientColor.value,t=e[0],s=e[1],n=e[2];if(t!==0||s!==0||n!==0){const i=new c.Color(t,s,n);de.add(new c.AmbientLight(i,1))}}}}class Ai{parse(e){const t=new Map;if("Geometry"in j.Objects){const s=j.Objects.Geometry;for(const n in s){const i=ie.get(parseInt(n)),o=this.parseGeometry(i,s[n],e);t.set(parseInt(n),o)}}return t}parseGeometry(e,t,s){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,s);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,s){const n=s.skeletons,i=[],o=e.parents.map(function(d){return j.Objects.Model[d.ID]});if(o.length===0)return;const r=e.children.reduce(function(d,m){return n[m.ID]!==void 0&&(d=n[m.ID]),d},null);e.children.forEach(function(d){s.morphTargets[d.ID]!==void 0&&i.push(s.morphTargets[d.ID])});const a=o[0],h={};"RotationOrder"in a&&(h.eulerOrder=bs(a.RotationOrder.value)),"InheritType"in a&&(h.inheritType=parseInt(a.InheritType.value)),"GeometricTranslation"in a&&(h.translation=a.GeometricTranslation.value),"GeometricRotation"in a&&(h.rotation=a.GeometricRotation.value),"GeometricScaling"in a&&(h.scale=a.GeometricScaling.value);const p=Ms(h);return this.genGeometry(t,r,i,p)}genGeometry(e,t,s,n){const i=new c.BufferGeometry;e.attrName&&(i.name=e.attrName);const o=this.parseGeoNode(e,t),r=this.genBuffers(o),a=new c.Float32BufferAttribute(r.vertex,3);if(a.applyMatrix4(n),i.setAttribute("position",a),r.colors.length>0&&i.setAttribute("color",new c.Float32BufferAttribute(r.colors,3)),t&&(i.setAttribute("skinIndex",new c.Uint16BufferAttribute(r.weightsIndices,4)),i.setAttribute("skinWeight",new c.Float32BufferAttribute(r.vertexWeights,4)),i.FBX_Deformer=t),r.normal.length>0){const h=new c.Matrix3().getNormalMatrix(n),p=new c.Float32BufferAttribute(r.normal,3);p.applyNormalMatrix(h),i.setAttribute("normal",p)}if(r.uvs.forEach(function(h,p){let d="uv"+(p+1).toString();p===0&&(d="uv"),i.setAttribute(d,new c.Float32BufferAttribute(r.uvs[p],2))}),o.material&&o.material.mappingType!=="AllSame"){let h=r.materialIndex[0],p=0;if(r.materialIndex.forEach(function(d,m){d!==h&&(i.addGroup(p,m-p,h),h=d,p=m)}),i.groups.length>0){const d=i.groups[i.groups.length-1],m=d.start+d.count;m!==r.materialIndex.length&&i.addGroup(m,r.materialIndex.length-m,h)}i.groups.length===0&&i.addGroup(0,r.materialIndex.length,r.materialIndex[0])}return this.addMorphTargets(i,e,s,n),i}parseGeoNode(e,t){const s={};if(s.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],s.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(s.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(s.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(s.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){s.uv=[];let n=0;for(;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&s.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return s.weightTable={},t!==null&&(s.skeleton=t,t.rawBones.forEach(function(n,i){n.indices.forEach(function(o,r){s.weightTable[o]===void 0&&(s.weightTable[o]=[]),s.weightTable[o].push({id:i,weight:n.weights[r]})})})),s}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let s=0,n=0,i=!1,o=[],r=[],a=[],h=[],p=[],d=[];const m=this;return e.vertexIndices.forEach(function(f,w){let y,v=!1;f<0&&(f=f^-1,v=!0);let M=[],L=[];if(o.push(f*3,f*3+1,f*3+2),e.color){const b=pt(w,s,f,e.color);a.push(b[0],b[1],b[2])}if(e.skeleton){if(e.weightTable[f]!==void 0&&e.weightTable[f].forEach(function(b){L.push(b.weight),M.push(b.id)}),L.length>4){i||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),i=!0);const b=[0,0,0,0],g=[0,0,0,0];L.forEach(function(S,A){let _=S,x=M[A];g.forEach(function(D,k,I){if(_>D){I[k]=_,_=D;const B=b[k];b[k]=x,x=B}})}),M=b,L=g}for(;L.length<4;)L.push(0),M.push(0);for(let b=0;b<4;++b)p.push(L[b]),d.push(M[b])}if(e.normal){const b=pt(w,s,f,e.normal);r.push(b[0],b[1],b[2])}e.material&&e.material.mappingType!=="AllSame"&&(y=pt(w,s,f,e.material)[0]),e.uv&&e.uv.forEach(function(b,g){const S=pt(w,s,f,b);h[g]===void 0&&(h[g]=[]),h[g].push(S[0]),h[g].push(S[1])}),n++,v&&(m.genFace(t,e,o,y,r,a,h,p,d,n),s++,n=0,o=[],r=[],a=[],h=[],p=[],d=[])}),t}genFace(e,t,s,n,i,o,r,a,h,p){for(let d=2;d<p;d++)e.vertex.push(t.vertexPositions[s[0]]),e.vertex.push(t.vertexPositions[s[1]]),e.vertex.push(t.vertexPositions[s[2]]),e.vertex.push(t.vertexPositions[s[(d-1)*3]]),e.vertex.push(t.vertexPositions[s[(d-1)*3+1]]),e.vertex.push(t.vertexPositions[s[(d-1)*3+2]]),e.vertex.push(t.vertexPositions[s[d*3]]),e.vertex.push(t.vertexPositions[s[d*3+1]]),e.vertex.push(t.vertexPositions[s[d*3+2]]),t.skeleton&&(e.vertexWeights.push(a[0]),e.vertexWeights.push(a[1]),e.vertexWeights.push(a[2]),e.vertexWeights.push(a[3]),e.vertexWeights.push(a[(d-1)*4]),e.vertexWeights.push(a[(d-1)*4+1]),e.vertexWeights.push(a[(d-1)*4+2]),e.vertexWeights.push(a[(d-1)*4+3]),e.vertexWeights.push(a[d*4]),e.vertexWeights.push(a[d*4+1]),e.vertexWeights.push(a[d*4+2]),e.vertexWeights.push(a[d*4+3]),e.weightsIndices.push(h[0]),e.weightsIndices.push(h[1]),e.weightsIndices.push(h[2]),e.weightsIndices.push(h[3]),e.weightsIndices.push(h[(d-1)*4]),e.weightsIndices.push(h[(d-1)*4+1]),e.weightsIndices.push(h[(d-1)*4+2]),e.weightsIndices.push(h[(d-1)*4+3]),e.weightsIndices.push(h[d*4]),e.weightsIndices.push(h[d*4+1]),e.weightsIndices.push(h[d*4+2]),e.weightsIndices.push(h[d*4+3])),t.color&&(e.colors.push(o[0]),e.colors.push(o[1]),e.colors.push(o[2]),e.colors.push(o[(d-1)*3]),e.colors.push(o[(d-1)*3+1]),e.colors.push(o[(d-1)*3+2]),e.colors.push(o[d*3]),e.colors.push(o[d*3+1]),e.colors.push(o[d*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(i[0]),e.normal.push(i[1]),e.normal.push(i[2]),e.normal.push(i[(d-1)*3]),e.normal.push(i[(d-1)*3+1]),e.normal.push(i[(d-1)*3+2]),e.normal.push(i[d*3]),e.normal.push(i[d*3+1]),e.normal.push(i[d*3+2])),t.uv&&t.uv.forEach(function(m,f){e.uvs[f]===void 0&&(e.uvs[f]=[]),e.uvs[f].push(r[f][0]),e.uvs[f].push(r[f][1]),e.uvs[f].push(r[f][(d-1)*2]),e.uvs[f].push(r[f][(d-1)*2+1]),e.uvs[f].push(r[f][d*2]),e.uvs[f].push(r[f][d*2+1])})}addMorphTargets(e,t,s,n){if(s.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const i=this;s.forEach(function(o){o.rawTargets.forEach(function(r){const a=j.Objects.Geometry[r.geoID];a!==void 0&&i.genMorphGeometry(e,t,a,n,r.name)})})}genMorphGeometry(e,t,s,n,i){const o=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],r=s.Vertices!==void 0?s.Vertices.a:[],a=s.Indexes!==void 0?s.Indexes.a:[],h=e.attributes.position.count*3,p=new Float32Array(h);for(let w=0;w<a.length;w++){const y=a[w]*3;p[y]=r[w*3],p[y+1]=r[w*3+1],p[y+2]=r[w*3+2]}const d={vertexIndices:o,vertexPositions:p},m=this.genBuffers(d),f=new c.Float32BufferAttribute(m.vertex,3);f.name=i||s.attrName,f.applyMatrix4(n),e.morphAttributes.position.push(f)}parseNormals(e){const t=e.MappingInformationType,s=e.ReferenceInformationType,n=e.Normals.a;let i=[];return s==="IndexToDirect"&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:i,mappingType:t,referenceType:s}}parseUVs(e){const t=e.MappingInformationType,s=e.ReferenceInformationType,n=e.UV.a;let i=[];return s==="IndexToDirect"&&(i=e.UVIndex.a),{dataSize:2,buffer:n,indices:i,mappingType:t,referenceType:s}}parseVertexColors(e){const t=e.MappingInformationType,s=e.ReferenceInformationType,n=e.Colors.a;let i=[];return s==="IndexToDirect"&&(i=e.ColorIndex.a),{dataSize:4,buffer:n,indices:i,mappingType:t,referenceType:s}}parseMaterialIndices(e){const t=e.MappingInformationType,s=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:s};const n=e.Materials.a,i=[];for(let o=0;o<n.length;++o)i.push(o);return{dataSize:1,buffer:n,indices:i,mappingType:t,referenceType:s}}parseNurbsGeometry(e){if(ws===void 0)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new c.BufferGeometry;const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new c.BufferGeometry;const s=t-1,n=e.KnotVector.a,i=[],o=e.Points.a;for(let d=0,m=o.length;d<m;d+=4)i.push(new c.Vector4().fromArray(o,d));let r,a;if(e.Form==="Closed")i.push(i[0]);else if(e.Form==="Periodic"){r=s,a=n.length-1-r;for(let d=0;d<s;++d)i.push(i[d])}const p=new ws(s,n,i,r,a).getPoints(i.length*12);return new c.BufferGeometry().setFromPoints(p)}}class Mi{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const s in t){const n=t[s],i=this.addClip(n);e.push(i)}return e}parseClips(){if(j.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=j.Objects.AnimationCurveNode,t=new Map;for(const s in e){const n=e[s];if(n.attrName.match(/S|R|T|DeformPercent/)!==null){const i={id:n.id,attr:n.attrName,curves:{}};t.set(i.id,i)}}return t}parseAnimationCurves(e){const t=j.Objects.AnimationCurve;for(const s in t){const n={id:t[s].id,times:t[s].KeyTime.a.map(Ci),values:t[s].KeyValueFloat.a},i=ie.get(n.id);if(i!==void 0){const o=i.parents[0].ID,r=i.parents[0].relationship;r.match(/X/)?e.get(o).curves.x=n:r.match(/Y/)?e.get(o).curves.y=n:r.match(/Z/)?e.get(o).curves.z=n:r.match(/d|DeformPercent/)&&e.has(o)&&(e.get(o).curves.morph=n)}}}parseAnimationLayers(e){const t=j.Objects.AnimationLayer,s=new Map;for(const n in t){const i=[],o=ie.get(parseInt(n));o!==void 0&&(o.children.forEach(function(a,h){if(e.has(a.ID)){const p=e.get(a.ID);if(p.curves.x!==void 0||p.curves.y!==void 0||p.curves.z!==void 0){if(i[h]===void 0){const d=ie.get(a.ID).parents.filter(function(m){return m.relationship!==void 0})[0].ID;if(d!==void 0){const m=j.Objects.Model[d.toString()];if(m===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",a);return}const f={modelName:m.attrName?c.PropertyBinding.sanitizeNodeName(m.attrName):"",ID:m.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};de.traverse(function(w){w.ID===m.id&&(f.transform=w.matrix,w.userData.transformData&&(f.eulerOrder=w.userData.transformData.eulerOrder))}),f.transform||(f.transform=new c.Matrix4),"PreRotation"in m&&(f.preRotation=m.PreRotation.value),"PostRotation"in m&&(f.postRotation=m.PostRotation.value),i[h]=f}}i[h]&&(i[h][p.attr]=p)}else if(p.curves.morph!==void 0){if(i[h]===void 0){const d=ie.get(a.ID).parents.filter(function(M){return M.relationship!==void 0})[0].ID,m=ie.get(d).parents[0].ID,f=ie.get(m).parents[0].ID,w=ie.get(f).parents[0].ID,y=j.Objects.Model[w],v={modelName:y.attrName?c.PropertyBinding.sanitizeNodeName(y.attrName):"",morphName:j.Objects.Deformer[d].attrName};i[h]=v}i[h][p.attr]=p}}}),s.set(parseInt(n),i))}return s}parseAnimStacks(e){const t=j.Objects.AnimationStack,s={};for(const n in t){const i=ie.get(parseInt(n)).children;i.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const o=e.get(i[0].ID);s[n]={name:t[n].attrName,layer:o}}return s}addClip(e){let t=[];const s=this;return e.layer.forEach(function(n){t=t.concat(s.generateTracks(n))}),new c.AnimationClip(e.name,-1,t)}generateTracks(e){const t=[];let s=new c.Vector3,n=new c.Quaternion,i=new c.Vector3;if(e.transform&&e.transform.decompose(s,n,i),s=s.toArray(),n=new c.Euler().setFromQuaternion(n,e.eulerOrder).toArray(),i=i.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const o=this.generateVectorTrack(e.modelName,e.T.curves,s,"position");o!==void 0&&t.push(o)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const o=this.generateRotationTrack(e.modelName,e.R.curves,n,e.preRotation,e.postRotation,e.eulerOrder);o!==void 0&&t.push(o)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const o=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale");o!==void 0&&t.push(o)}if(e.DeformPercent!==void 0){const o=this.generateMorphTrack(e);o!==void 0&&t.push(o)}return t}generateVectorTrack(e,t,s,n){const i=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(i,t,s);return new c.VectorKeyframeTrack(e+"."+n,i,o)}generateRotationTrack(e,t,s,n,i,o){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(c.MathUtils.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(c.MathUtils.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(c.MathUtils.degToRad));const r=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(r,t,s);n!==void 0&&(n=n.map(c.MathUtils.degToRad),n.push(o),n=new c.Euler().fromArray(n),n=new c.Quaternion().setFromEuler(n)),i!==void 0&&(i=i.map(c.MathUtils.degToRad),i.push(o),i=new c.Euler().fromArray(i),i=new c.Quaternion().setFromEuler(i).invert());const h=new c.Quaternion,p=new c.Euler,d=[];for(let m=0;m<a.length;m+=3)p.set(a[m],a[m+1],a[m+2],o),h.setFromEuler(p),n!==void 0&&h.premultiply(n),i!==void 0&&h.multiply(i),h.toArray(d,m/3*4);return new c.QuaternionKeyframeTrack(e+".quaternion",r,d)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,s=t.values.map(function(i){return i/100}),n=de.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new c.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",t.times,s)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(s,n){return s-n}),t.length>1){let s=1,n=t[0];for(let i=1;i<t.length;i++){const o=t[i];o!==n&&(t[s]=o,n=o,s++)}t=t.slice(0,s)}return t}getKeyframeTrackValues(e,t,s){const n=s,i=[];let o=-1,r=-1,a=-1;return e.forEach(function(h){if(t.x&&(o=t.x.times.indexOf(h)),t.y&&(r=t.y.times.indexOf(h)),t.z&&(a=t.z.times.indexOf(h)),o!==-1){const p=t.x.values[o];i.push(p),n[0]=p}else i.push(n[0]);if(r!==-1){const p=t.y.values[r];i.push(p),n[1]=p}else i.push(n[1]);if(a!==-1){const p=t.z.values[a];i.push(p),n[2]=p}else i.push(n[2])}),i}interpolateRotations(e){for(let t=1;t<e.values.length;t++){const s=e.values[t-1],n=e.values[t]-s,i=Math.abs(n);if(i>=180){const o=i/180,r=n/o;let a=s+r;const h=e.times[t-1],d=(e.times[t]-h)/o;let m=h+d;const f=[],w=[];for(;m<e.times[t];)f.push(m),m+=d,w.push(a),a+=r;e.times=Ts(e.times,t,f),e.values=Ts(e.values,t,w)}}}}class bi{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new vs,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,s=e.split(/[\r\n]+/);return s.forEach(function(n,i){const o=n.match(/^[\s\t]*;/),r=n.match(/^[\s\t]*$/);if(o||r)return;const a=n.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),h=n.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),p=n.match("^\\t{"+(t.currentIndent-1)+"}}");a?t.parseNodeBegin(n,a):h?t.parseNodeProperty(n,h,s[++i]):p?t.popStack():n.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(n)}),this.allNodes}parseNodeBegin(e,t){const s=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=t[2].split(",").map(function(a){return a.trim().replace(/^"/,"").replace(/"$/,"")}),i={name:s},o=this.parseNodeAttr(n),r=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(s,i):s in r?(s==="PoseNode"?r.PoseNode.push(i):r[s].id!==void 0&&(r[s]={},r[s][r[s].id]=r[s]),o.id!==""&&(r[s][o.id]=i)):typeof o.id=="number"?(r[s]={},r[s][o.id]=i):s!=="Properties70"&&(s==="PoseNode"?r[s]=[i]:r[s]=i),typeof o.id=="number"&&(i.id=o.id),o.name!==""&&(i.attrName=o.name),o.type!==""&&(i.attrType=o.type),this.pushStack(i)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let s="",n="";return e.length>1&&(s=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:s,type:n}}parseNodeProperty(e,t,s){let n=t[1].replace(/^"/,"").replace(/"$/,"").trim(),i=t[2].replace(/^"/,"").replace(/"$/,"").trim();n==="Content"&&i===","&&(i=s.replace(/"/g,"").replace(/,$/,"").trim());const o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(e,n,i);return}if(n==="C"){const a=i.split(",").slice(1),h=parseInt(a[0]),p=parseInt(a[1]);let d=i.split(",").slice(3);d=d.map(function(m){return m.trim().replace(/^"/,"")}),n="connections",i=[h,p],Pi(i,d),o[n]===void 0&&(o[n]=[])}n==="Node"&&(o.id=i),n in o&&Array.isArray(o[n])?o[n].push(i):n!=="a"?o[n]=i:o.a=i,this.setCurrentProp(o,n),n==="a"&&i.slice(-1)!==","&&(o.a=Dt(i))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Dt(t.a))}parseNodeSpecialProperty(e,t,s){const n=s.split('",').map(function(p){return p.trim().replace(/^\"/,"").replace(/\s/,"_")}),i=n[0],o=n[1],r=n[2],a=n[3];let h=n[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=Dt(h);break}this.getPrevNode()[i]={type:o,type2:r,flag:a,value:h},this.setCurrentProp(this.getPrevNode(),i)}}class Si{parse(e){const t=new xs(e);t.skip(23);const s=t.getUint32();if(s<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+s);const n=new vs;for(;!this.endOfContent(t);){const i=this.parseNode(t,s);i!==null&&n.add(i.name,i)}return n}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const s={},n=t>=7500?e.getUint64():e.getUint32(),i=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const o=e.getUint8(),r=e.getString(o);if(n===0)return null;const a=[];for(let m=0;m<i;m++)a.push(this.parseProperty(e));const h=a.length>0?a[0]:"",p=a.length>1?a[1]:"",d=a.length>2?a[2]:"";for(s.singleProperty=i===1&&e.getOffset()===n;n>e.getOffset();){const m=this.parseNode(e,t);m!==null&&this.parseSubNode(r,s,m)}return s.propertyList=a,typeof h=="number"&&(s.id=h),p!==""&&(s.attrName=p),d!==""&&(s.attrType=d),r!==""&&(s.name=r),s}parseSubNode(e,t,s){if(s.singleProperty===!0){const n=s.propertyList[0];Array.isArray(n)?(t[s.name]=s,s.a=n):t[s.name]=n}else if(e==="Connections"&&s.name==="C"){const n=[];s.propertyList.forEach(function(i,o){o!==0&&n.push(i)}),t.connections===void 0&&(t.connections=[]),t.connections.push(n)}else if(s.name==="Properties70")Object.keys(s).forEach(function(i){t[i]=s[i]});else if(e==="Properties70"&&s.name==="P"){let n=s.propertyList[0],i=s.propertyList[1];const o=s.propertyList[2],r=s.propertyList[3];let a;n.indexOf("Lcl ")===0&&(n=n.replace("Lcl ","Lcl_")),i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),i==="Color"||i==="ColorRGB"||i==="Vector"||i==="Vector3D"||i.indexOf("Lcl_")===0?a=[s.propertyList[4],s.propertyList[5],s.propertyList[6]]:a=s.propertyList[4],t[n]={type:i,type2:o,flag:r,value:a}}else t[s.name]===void 0?typeof s.id=="number"?(t[s.name]={},t[s.name][s.id]=s):t[s.name]=s:s.name==="PoseNode"?(Array.isArray(t[s.name])||(t[s.name]=[t[s.name]]),t[s.name].push(s)):t[s.name][s.id]===void 0&&(t[s.name][s.id]=s)}parseProperty(e){const t=e.getString(1);let s;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return s=e.getUint32(),e.getArrayBuffer(s);case"S":return s=e.getUint32(),e.getString(s);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const n=e.getUint32(),i=e.getUint32(),o=e.getUint32();if(i===0)switch(t){case"b":case"c":return e.getBooleanArray(n);case"d":return e.getFloat64Array(n);case"f":return e.getFloat32Array(n);case"i":return e.getInt32Array(n);case"l":return e.getInt64Array(n)}const r=gn(new Uint8Array(e.getArrayBuffer(o))),a=new xs(r.buffer);switch(t){case"b":case"c":return a.getBooleanArray(n);case"d":return a.getFloat64Array(n);case"f":return a.getFloat32Array(n);case"i":return a.getInt32Array(n);case"l":return a.getInt64Array(n)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class xs{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let s=0;s<e;s++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let s=0;s<e;s++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){const t=[];for(let s=0;s<e;s++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let s=0;s<e;s++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let s=0;s<e;s++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=[];for(let n=0;n<e;n++)t[n]=this.getUint8();const s=t.indexOf(0);return s>=0&&(t=t.slice(0,s)),c.LoaderUtils.decodeText(new Uint8Array(t))}}class vs{add(e,t){this[e]=t}}function Ti(l){const e="Kaydara FBX Binary \0";return l.byteLength>=e.length&&e===Ss(l,0,e.length)}function Li(l){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function s(n){const i=l[n-1];return l=l.slice(t+n),t++,i}for(let n=0;n<e.length;++n)if(s(1)===e[n])return!1;return!0}function As(l){const e=/FBXVersion: (\d+)/,t=l.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Ci(l){return l/46186158e3}const Oi=[];function pt(l,e,t,s){let n;switch(s.mappingType){case"ByPolygonVertex":n=l;break;case"ByPolygon":n=e;break;case"ByVertice":n=t;break;case"AllSame":n=s.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+s.mappingType)}s.referenceType==="IndexToDirect"&&(n=s.indices[n]);const i=n*s.dataSize,o=i+s.dataSize;return Di(Oi,s.buffer,i,o)}const Pt=new c.Euler,qe=new c.Vector3;function Ms(l){const e=new c.Matrix4,t=new c.Matrix4,s=new c.Matrix4,n=new c.Matrix4,i=new c.Matrix4,o=new c.Matrix4,r=new c.Matrix4,a=new c.Matrix4,h=new c.Matrix4,p=new c.Matrix4,d=new c.Matrix4,m=new c.Matrix4,f=l.inheritType?l.inheritType:0;if(l.translation&&e.setPosition(qe.fromArray(l.translation)),l.preRotation){const k=l.preRotation.map(c.MathUtils.degToRad);k.push(l.eulerOrder),t.makeRotationFromEuler(Pt.fromArray(k))}if(l.rotation){const k=l.rotation.map(c.MathUtils.degToRad);k.push(l.eulerOrder),s.makeRotationFromEuler(Pt.fromArray(k))}if(l.postRotation){const k=l.postRotation.map(c.MathUtils.degToRad);k.push(l.eulerOrder),n.makeRotationFromEuler(Pt.fromArray(k)),n.invert()}l.scale&&i.scale(qe.fromArray(l.scale)),l.scalingOffset&&r.setPosition(qe.fromArray(l.scalingOffset)),l.scalingPivot&&o.setPosition(qe.fromArray(l.scalingPivot)),l.rotationOffset&&a.setPosition(qe.fromArray(l.rotationOffset)),l.rotationPivot&&h.setPosition(qe.fromArray(l.rotationPivot)),l.parentMatrixWorld&&(d.copy(l.parentMatrix),p.copy(l.parentMatrixWorld));const w=t.clone().multiply(s).multiply(n),y=new c.Matrix4;y.extractRotation(p);const v=new c.Matrix4;v.copyPosition(p);const M=v.clone().invert().multiply(p),L=y.clone().invert().multiply(M),b=i,g=new c.Matrix4;if(f===0)g.copy(y).multiply(w).multiply(L).multiply(b);else if(f===1)g.copy(y).multiply(L).multiply(w).multiply(b);else{const I=new c.Matrix4().scale(new c.Vector3().setFromMatrixScale(d)).clone().invert(),B=L.clone().multiply(I);g.copy(y).multiply(w).multiply(B).multiply(b)}const S=h.clone().invert(),A=o.clone().invert();let _=e.clone().multiply(a).multiply(h).multiply(t).multiply(s).multiply(n).multiply(S).multiply(r).multiply(o).multiply(i).multiply(A);const x=new c.Matrix4().copyPosition(_),D=p.clone().multiply(x);return m.copyPosition(D),_=m.clone().multiply(g),_.premultiply(p.invert()),_}function bs(l){l=l||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return l===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[l]}function Dt(l){return l.split(",").map(function(t){return parseFloat(t)})}function Ss(l,e,t){return e===void 0&&(e=0),t===void 0&&(t=l.byteLength),c.LoaderUtils.decodeText(new Uint8Array(l,e,t))}function Pi(l,e){for(let t=0,s=l.length,n=e.length;t<n;t++,s++)l[s]=e[t]}function Di(l,e,t,s){for(let n=t,i=0;n<s;n++,i++)l[i]=e[n];return l}function Ts(l,e,t){return l.slice(0,e).concat(t).concat(l.slice(e))}var Ii=Object.defineProperty,ki=(l,e,t)=>e in l?Ii(l,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[e]=t,It=(l,e,t)=>(ki(l,typeof e!="symbol"?e+"":e,t),t);class Fi extends c.Loader{constructor(e){super(e)}load(e,t,s,n){const i=new c.FileLoader(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,o=>{if(typeof o!="string")throw new Error("unsupported data type");const r=JSON.parse(o),a=this.parse(r);t&&t(a)},s,n)}loadAsync(e,t){return super.loadAsync(e,t)}parse(e){return new kt(e)}}class kt{constructor(e){It(this,"data"),this.data=e}generateShapes(e,t=100,s){const n=[],i={letterSpacing:0,lineHeight:1,...s},o=Bi(e,t,this.data,i);for(let r=0,a=o.length;r<a;r++)Array.prototype.push.apply(n,o[r].toShapes(!1));return n}}It(kt,"isFont"),It(kt,"type");function Bi(l,e,t,s){const n=Array.from(l),i=e/t.resolution,o=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*i,r=[];let a=0,h=0;for(let p=0;p<n.length;p++){const d=n[p];if(d===`
|
|
74
|
-
`)a=0,h-=
|
|
75
|
-
`,m=function(
|
|
76
|
-
`;
|
|
77
|
-
`,
|
|
78
|
-
`;continue}if((I=k.match(S))&&(D.gamma=parseFloat(I[1])),(I=k.match(A))&&(D.exposure=parseFloat(I[1])),(I=k.match(_))&&(D.valid|=2,D.format=I[1]),(I=k.match(x))&&(D.valid|=4,D.height=parseInt(I[1],10),D.width=parseInt(I[2],10)),D.valid&2&&D.valid&4)break}return D.valid&2?D.valid&4?D:r(3,"missing image size specifier"):r(3,"missing format specifier")},w=function(b,g,S){const A=g;if(A<8||A>32767||b[0]!==2||b[1]!==2||b[2]&128)return new Uint8Array(b);if(A!==(b[2]<<8|b[3]))return r(3,"wrong scanline width");const _=new Uint8Array(4*g*S);if(!_.length)return r(4,"unable to allocate buffer space");let x=0,D=0;const k=4*A,I=new Uint8Array(4),B=new Uint8Array(k);let R=S;for(;R>0&&D<b.byteLength;){if(D+4>b.byteLength)return r(1);if(I[0]=b[D++],I[1]=b[D++],I[2]=b[D++],I[3]=b[D++],I[0]!=2||I[1]!=2||(I[2]<<8|I[3])!=A)return r(3,"bad rgbe scanline format");let H=0,G;for(;H<k&&D<b.byteLength;){G=b[D++];const X=G>128;if(X&&(G-=128),G===0||H+G>k)return r(3,"bad scanline data");if(X){const le=b[D++];for(let oe=0;oe<G;oe++)B[H++]=le}else B.set(b.subarray(D,D+G),H),H+=G,D+=G}const se=A;for(let X=0;X<se;X++){let le=0;_[x]=B[X+le],le+=A,_[x+1]=B[X+le],le+=A,_[x+2]=B[X+le],le+=A,_[x+3]=B[X+le],x+=4}R--}return _},y=function(b,g,S,A){const _=b[g+3],x=Math.pow(2,_-128)/255;S[A+0]=b[g+0]*x,S[A+1]=b[g+1]*x,S[A+2]=b[g+2]*x,S[A+3]=1},v=function(b,g,S,A){const _=b[g+3],x=Math.pow(2,_-128)/255;S[A+0]=c.DataUtils.toHalfFloat(Math.min(b[g+0]*x,65504)),S[A+1]=c.DataUtils.toHalfFloat(Math.min(b[g+1]*x,65504)),S[A+2]=c.DataUtils.toHalfFloat(Math.min(b[g+2]*x,65504)),S[A+3]=c.DataUtils.toHalfFloat(1)},M=new Uint8Array(e);M.pos=0;const L=f(M);if(L!==-1){const b=L.width,g=L.height,S=w(M.subarray(M.pos),b,g);if(S!==-1){let A,_,x;switch(this.type){case c.FloatType:x=S.length/4;const D=new Float32Array(x*4);for(let I=0;I<x;I++)y(S,I*4,D,I*4);A=D,_=c.FloatType;break;case c.HalfFloatType:x=S.length/4;const k=new Uint16Array(x*4);for(let I=0;I<x;I++)v(S,I*4,k,I*4);A=k,_=c.HalfFloatType;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type);break}return{width:b,height:g,data:A,header:L.string,gamma:L.gamma,exposure:L.exposure,type:_}}}return null}setDataType(e){return this.type=e,this}load(e,t,s,n){function i(o,r){switch(o.type){case c.FloatType:case c.HalfFloatType:"colorSpace"in o?o.colorSpace="srgb-linear":o.encoding=3e3,o.minFilter=c.LinearFilter,o.magFilter=c.LinearFilter,o.generateMipmaps=!1,o.flipY=!0;break}t&&t(o,r)}return super.load(e,i,s,n)}}const Ft=new WeakMap;class Vi extends c.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,s,n){const i=new c.FileLoader(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),i.load(e,o=>{const r={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,r).then(t).catch(n)},s,n)}decodeDracoFile(e,t,s,n){const i={attributeIDs:s||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!s};this.decodeGeometry(e,i).then(t)}decodeGeometry(e,t){for(const a in t.attributeTypes){const h=t.attributeTypes[a];h.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[a]=h.name)}const s=JSON.stringify(t);if(Ft.has(e)){const a=Ft.get(e);if(a.key===s)return a.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n;const i=this.workerNextTaskID++,o=e.byteLength,r=this._getWorker(i,o).then(a=>(n=a,new Promise((h,p)=>{n._callbacks[i]={resolve:h,reject:p},n.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))).then(a=>this._createGeometry(a.geometry));return r.catch(()=>!0).then(()=>{n&&i&&this._releaseTask(n,i)}),Ft.set(e,{key:s,promise:r}),r}_createGeometry(e){const t=new c.BufferGeometry;e.index&&t.setIndex(new c.BufferAttribute(e.index.array,1));for(let s=0;s<e.attributes.length;s++){const n=e.attributes[s],i=n.name,o=n.array,r=n.itemSize;t.setAttribute(i,new c.BufferAttribute(o,r))}return t}_loadLibrary(e,t){const s=new c.FileLoader(this.manager);return s.setPath(this.decoderPath),s.setResponseType(t),s.setWithCredentials(this.withCredentials),new Promise((n,i)=>{s.load(e,n,void 0,i)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(s=>{const n=s[0];e||(this.decoderConfig.wasmBinary=s[1]);const i=Ei.toString(),o=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join(`
|
|
79
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(i){const o=i.data;switch(o.type){case"decode":n._callbacks[o.id].resolve(o);break;case"error":n._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,i){return n._taskLoad>i._taskLoad?-1:1});const s=this.workerPool[this.workerPool.length-1];return s._taskCosts[e]=t,s._taskLoad+=t,s})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function Ei(){let l,e;onmessage=function(o){const r=o.data;switch(r.type){case"init":l=r.decoderConfig,e=new Promise(function(p){l.onModuleLoaded=function(d){p({draco:d})},DracoDecoderModule(l)});break;case"decode":const a=r.buffer,h=r.taskConfig;e.then(p=>{const d=p.draco,m=new d.Decoder,f=new d.DecoderBuffer;f.Init(new Int8Array(a),a.byteLength);try{const w=t(d,m,f,h),y=w.attributes.map(v=>v.array.buffer);w.index&&y.push(w.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:w},y)}catch(w){console.error(w),self.postMessage({type:"error",id:r.id,error:w.message})}finally{d.destroy(f),d.destroy(m)}});break}};function t(o,r,a,h){const p=h.attributeIDs,d=h.attributeTypes;let m,f;const w=r.GetEncodedGeometryType(a);if(w===o.TRIANGULAR_MESH)m=new o.Mesh,f=r.DecodeBufferToMesh(a,m);else if(w===o.POINT_CLOUD)m=new o.PointCloud,f=r.DecodeBufferToPointCloud(a,m);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||m.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());const y={index:null,attributes:[]};for(const v in p){const M=self[d[v]];let L,b;if(h.useUniqueIDs)b=p[v],L=r.GetAttributeByUniqueId(m,b);else{if(b=r.GetAttributeId(m,o[p[v]]),b===-1)continue;L=r.GetAttribute(m,b)}y.attributes.push(n(o,r,m,v,M,L))}return w===o.TRIANGULAR_MESH&&(y.index=s(o,r,m)),o.destroy(m),y}function s(o,r,a){const p=a.num_faces()*3,d=p*4,m=o._malloc(d);r.GetTrianglesUInt32Array(a,d,m);const f=new Uint32Array(o.HEAPF32.buffer,m,p).slice();return o._free(m),{array:f,itemSize:1}}function n(o,r,a,h,p,d){const m=d.num_components(),w=a.num_points()*m,y=w*p.BYTES_PER_ELEMENT,v=i(o,p),M=o._malloc(y);r.GetAttributeDataArrayForAllPoints(a,d,v,y,M);const L=new p(o.HEAPF32.buffer,M,w).slice();return o._free(M),{name:h,array:L,itemSize:m}}function i(o,r){switch(r){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}const zi=["args","center"],Ri=u.defineComponent({__name:"Text3D",props:{font:{},text:{},size:{default:.5},height:{default:.2},curveSegments:{default:5},bevelEnabled:{type:Boolean,default:!0},bevelThickness:{default:.05},bevelSize:{default:.02},bevelOffset:{default:0},bevelSegments:{default:4},center:{type:Boolean,default:!1},needUpdates:{type:Boolean,default:!1}},async setup(l,{expose:e}){let t,s;const n=l,{center:i,font:o,text:r,needUpdates:a,size:h,height:p,curveSegments:d,bevelEnabled:m,bevelThickness:f,bevelSize:w,bevelOffset:y,bevelSegments:v}=u.toRefs(n),{extend:M}=q.useTresContext();M({TextGeometry:ys});const L=new Fi,b=u.useSlots(),g=u.computed(()=>{var x;return r!=null&&r.value?r.value:b.default?(x=b.default()[0].children)==null?void 0:x.trim():a.value?"":"TresJS"}),S=u.shallowRef();e({value:S});const A=([t,s]=u.withAsyncContext(()=>new Promise((x,D)=>{try{typeof o.value=="string"?L.load(o.value,k=>{x(k)}):x(o.value)}catch(k){D(console.error("cientos",k))}})),t=await t,s(),t),_=u.computed(()=>({font:A,size:u.toValue(h),height:u.toValue(p),curveSegments:u.toValue(d),bevelEnabled:u.toValue(m),bevelThickness:u.toValue(f),bevelSize:u.toValue(w),bevelOffset:u.toValue(y),bevelSegments:u.toValue(v)}));return u.watchEffect(()=>{S.value&&a.value&&(S.value.geometry.dispose(),S.value.geometry=new ys(g.value,_.value),i.value&&S.value.geometry.center())}),(x,D)=>u.unref(o)?(u.openBlock(),u.createElementBlock("TresMesh",{key:0,ref_key:"text3DRef",ref:S},[g.value?(u.openBlock(),u.createElementBlock("TresTextGeometry",{key:0,args:[g.value,_.value],center:u.unref(i)},null,8,zi)):u.createCommentVNode("",!0),u.renderSlot(x.$slots,"default")],512)):u.createCommentVNode("",!0)}});function Gi(l,e){const t=u.ref(e),s=new c.AnimationMixer(t.value),n=u.shallowReactive({});l.forEach(o=>{const r=s.clipAction(o,t.value);n[o.name]=r});const{onLoop:i}=q.useRenderLoop();return i(({delta:o})=>{s.update(o)}),{actions:n,mixer:s}}const Bt={sunset:"venice/venice_sunset_4k.hdr"};async function Ls({files:l=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"],blur:e=0,background:t=!1,path:s="/",preset:n=void 0}){const{scene:i}=q.useTresContext();if(n){if(!(n in Bt))throw new Error("Preset must be one of: "+Object.keys(Bt).join(", "));l=Bt[n],s="https://raw.githubusercontent.com/Tresjs/assets/main/textures/hdr/"}const o=Array.isArray(l),r=o?c.CubeTextureLoader:Ni,a=await q.useLoader(r,o?[l]:l,p=>{s&&p.setPath(s)}),h=o?a[0]:a;return h&&(h.mapping=o?c.CubeReflectionMapping:c.EquirectangularReflectionMapping,h.colorSpace=c.SRGBColorSpace),i.value&&(i.value.environment=h,t&&(i.value.background=h),e&&(i.value.backgroundBlurriness=e|0)),h}const Yi=u.defineComponent({name:"Environment",props:["background","blur","files","encoding","path","preset"],async setup(l,{expose:e}){let t=null;return e({getTexture:()=>t}),t=await Ls(l),()=>{}}}),ji=["position","a-scale"],Xi=["size","size-attenuation","transparent","alpha-test","alpha-map"],Zi=u.defineComponent({__name:"Stars",props:{size:{default:.1},sizeAttenuation:{type:Boolean,default:!0},transparent:{type:Boolean,default:!0},alphaTest:{default:.01},count:{default:5e3},depth:{default:50},radius:{default:100},alphaMap:{default:null}},setup(l,{expose:e}){const t=l,s=u.ref(),n=u.ref(),{radius:i,depth:o,count:r,size:a,sizeAttenuation:h,transparent:p,alphaMap:d,alphaTest:m}=u.toRefs(t),f=()=>{let y=i.value+o.value;const v=u.computed(()=>o.value/r.value),M=[],L=Array.from({length:r.value},()=>(.5+.5*Math.random())*4),b=g=>new c.Vector3().setFromSpherical(new c.Spherical(g,Math.acos(1-Math.random()*2),Math.random()*2*Math.PI)).toArray();for(let g=0;g<r.value;g++)y-=v.value*Math.random(),M.push(...b(y));s.value=new Float32Array(M),n.value=new Float32Array(L)};u.watchEffect(()=>{f()});const w=u.shallowRef();return e({value:w}),(y,v)=>(u.openBlock(),u.createElementBlock("TresPoints",{ref_key:"starsRef",ref:w},[u.createElementVNode("TresBufferGeometry",{position:[s.value,3],"a-scale":[n.value,1]},null,8,ji),u.createElementVNode("TresPointsMaterial",{size:u.unref(a),"size-attenuation":u.unref(h),transparent:u.unref(p),"alpha-test":u.unref(m),"alpha-map":u.unref(d)},null,8,Xi)],512))}}),Qi=["size","color","alpha-map","map","opacity","alpha-test","depth-write","transparent","size-attenuation"],Ki=["position","velocity"],Wi=u.defineComponent({__name:"Precipitation",props:{size:{default:.1},area:{default:()=>[10,10,20]},color:{default:16777215},map:{},alphaMap:{},alphaTest:{default:.01},opacity:{default:.8},count:{default:5e3},speed:{default:.1},randomness:{default:.5},depthWrite:{type:Boolean,default:!1},transparent:{type:Boolean,default:!0},sizeAttenuation:{type:Boolean,default:!0}},setup(l){const e=l,{size:t,area:s,color:n,alphaMap:i,map:o,opacity:r,alphaTest:a,depthWrite:h,transparent:p,sizeAttenuation:d,count:m,speed:f,randomness:w}=u.toRefs(e),y=u.shallowRef();let v=[],M=[];const L=()=>{v=new Float32Array(m.value*3);for(let S=0;S<m.value;S++){const A=S*3;v[A]=(Math.random()-.5)*s.value[0],v[A+1]=(Math.random()-.5)*s.value[1],v[A+2]=(Math.random()-.5)*s.value[2]}},b=()=>{M=new Float32Array(m.value*2);for(let S=0;S<m.value*2;S+=2)M[S]=(Math.random()-.5)/5*f.value*w.value,M[S+1]=Math.random()/5*f.value+.01};b(),L(),u.watchEffect(()=>{b(),L()});const{onLoop:g}=q.useRenderLoop();return g(()=>{var S,A;if((S=y.value)!=null&&S.attributes.position.array&&((A=y.value)!=null&&A.attributes.position.count)){const _=y.value.attributes.position.array;for(let x=0;x<y.value.attributes.position.count;x++){const D=M[x*2],k=M[x*2+1];_[x*3]+=D,_[x*3+1]-=k,(_[x*3]<=-s.value[0]/2||_[x*3]>=s.value[0]/2)&&(_[x*3]=_[x*3]*-1),(_[x*3+1]<=-s.value[1]/2||_[x*3+1]>=s.value[1]/2)&&(_[x*3+1]=_[x*3+1]*-1)}y.value.attributes.position.needsUpdate=!0}}),(S,A)=>(u.openBlock(),u.createElementBlock("TresPoints",null,[u.createElementVNode("TresPointsMaterial",{size:u.unref(t),color:u.unref(n),"alpha-map":u.unref(i),map:u.unref(o),opacity:u.unref(r),"alpha-test":u.unref(a),"depth-write":u.unref(h),transparent:u.unref(p),"size-attenuation":u.unref(d)},null,8,Qi),u.createElementVNode("TresBufferGeometry",{ref_key:"geometryRef",ref:y,position:[u.unref(v),3],velocity:[u.unref(M)]},null,8,Ki)]))}}),qi=["position"],Ji=["position"],Hi=["scale"],$i=["map","depth-test","color-space","color","opacity"],eo=u.defineComponent({__name:"Smoke",props:{color:{default:"#ffffff"},opacity:{default:.5},speed:{default:.4},width:{default:10},depth:{default:1.5},segments:{default:20},texture:{default:"https://raw.githubusercontent.com/Tresjs/assets/main/textures/clouds/defaultCloud.png"},depthTest:{type:Boolean,default:!0}},async setup(l,{expose:e}){let t,s;const n=l,{width:i,depth:o,segments:r,texture:a,color:h,depthTest:p,opacity:d,speed:m}=u.toRefs(n),f=u.shallowRef(),w=u.shallowRef();e({value:f});const y=[...new Array(r)].map((A,_)=>({x:i.value/2-Math.random()*i.value,y:i.value/2-Math.random()*i.value,scale:.4+Math.sin((_+1)/r.value*Math.PI)*((.2+Math.random())*10),density:Math.max(.2,Math.random()),rotation:Math.max(.002,.005*Math.random())*m.value})),v=(A,_)=>A/6*_*d.value,{map:M}=([t,s]=u.withAsyncContext(()=>q.useTexture({map:a.value})),t=await t,s(),t),{renderer:L,camera:b}=q.useTresContext(),g=u.computed(()=>{var A;return(A=L.value)==null?void 0:A.outputColorSpace}),{onLoop:S}=q.useRenderLoop();return S(()=>{var A,_;f.value&&b.value&&w.value&&((A=w.value)==null||A.children.forEach((x,D)=>{x.rotation.z+=y[D].rotation}),f.value.lookAt((_=b.value)==null?void 0:_.position))}),(A,_)=>(u.openBlock(),u.createElementBlock("TresGroup",u.mergeProps({ref_key:"smokeRef",ref:f},A.$attrs),[u.createElementVNode("TresGroup",{ref_key:"groupRef",ref:w,position:[0,0,u.unref(r)/2*u.unref(o)]},[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(u.unref(y),({scale:x,x:D,y:k,density:I},B)=>(u.openBlock(),u.createElementBlock("TresMesh",{key:`${B}`,position:[D,k,-B*u.unref(o)]},[u.createElementVNode("TresPlaneGeometry",{scale:[x,x,x],rotation:[0,0,0]},null,8,Hi),u.createElementVNode("TresMeshStandardMaterial",{map:u.unref(M),"depth-test":u.unref(p),"color-space":g.value,color:u.unref(h),"depth-write":!1,transparent:"",opacity:v(x,I)},null,8,$i)],8,Ji))),128))],8,qi)],16))}}),to=u.defineComponent({__name:"Levioso",props:{speed:{default:1},rotationFactor:{default:1},floatFactor:{default:1},range:{default:()=>[-.1,.1]}},setup(l,{expose:e}){const t=l,s=u.shallowRef();e({value:s});const{onLoop:n}=q.useRenderLoop(),i=u.ref(Math.random()*1e4);return n(({elapsed:o})=>{var h,p;if(!s.value)return;const r=i.value+o;s.value.rotation.x=Math.cos(r/4*t.speed)/8*t.rotationFactor,s.value.rotation.y=Math.sin(r/4*t.speed)/8*t.rotationFactor,s.value.rotation.z=Math.sin(r/4*t.speed)/20*t.rotationFactor;let a=Math.sin(r/4*t.speed)/10;a=c.MathUtils.mapLinear(a,-.1,.1,((h=t.range)==null?void 0:h[0])??-.1,((p=t.range)==null?void 0:p[1])??.1),s.value.position.y=a*t.floatFactor}),(o,r)=>(u.openBlock(),u.createElementBlock("TresGroup",u.mergeProps(o.$attrs,{ref_key:"groupRef",ref:s}),[u.renderSlot(o.$slots,"default")],16))}}),so=["geometry"],no=["map","opacity","depth-write"],io=["args"],oo=["rotation","args"],ro=u.defineComponent({__name:"ContactShadows",props:{opacity:{default:1},width:{default:1},height:{default:1},blur:{default:1},far:{default:10},smooth:{type:Boolean,default:!0},resolution:{default:512},frames:{default:1/0},scale:{default:10},color:{default:"#000000"},depthWrite:{type:Boolean,default:!1},helper:{type:Boolean,default:!1}},setup(l,{expose:e}){const t=l,s=u.shallowRef(),n=u.shallowRef();e(s);let i,o,r,a,h;const{renderer:p,scene:d}=q.useTresContext(),m=u.computed(()=>t.width*(Array.isArray(t.scale)?t.scale[0]:t.scale||1)),f=u.computed(()=>t.height*(Array.isArray(t.scale)?t.scale[1]:t.scale||1));u.watchEffect(()=>{i&&i.dispose(),o&&o.dispose(),r&&r.dispose(),a&&a.geometry.dispose(),i=new c.WebGLRenderTarget(t.resolution,t.resolution),o=new c.WebGLRenderTarget(t.resolution,t.resolution),o.texture.generateMipmaps=i.texture.generateMipmaps=!1,n.value=new c.OrthographicCamera(-m.value/2,m.value/2,f.value/2,-f.value/2,0,t.far),r=new c.PlaneGeometry(m.value,f.value).rotateX(Math.PI/2),a=new c.Mesh(r),a.visible=!1}),u.watchEffect(()=>{t.color&&(h&&h.dispose(),h=new c.MeshDepthMaterial,h.depthTest=h.depthWrite=!1,h.onBeforeCompile=S=>{S.uniforms={...S.uniforms,ucolor:{value:t.color?new c.Color(t.color):new c.Color}},S.fragmentShader=S.fragmentShader.replace("void main() {",`uniform vec3 ucolor;
|
|
80
|
-
void main() {
|
|
81
|
-
`),S.fragmentShader=S.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")})});const w=new c.ShaderMaterial(ui),y=new c.ShaderMaterial(pi);y.depthTest=w.depthTest=!1;function v(S){!p.value||!n.value||(a.visible=!0,a.material=w,w.uniforms.tDiffuse.value=i.texture,w.uniforms.h.value=S/256,p.value.setRenderTarget(o),p.value.render(a,n.value),a.material=y,y.uniforms.tDiffuse.value=o.texture,y.uniforms.v.value=S/256,p.value.setRenderTarget(i),p.value.render(a,n.value),a.visible=!1)}const{onLoop:M}=q.useRenderLoop();let L=0,b,g;return M(()=>{!n.value||d.value===void 0||p.value===void 0||(t.frames===1/0||L<t.frames)&&(L++,b=d.value.background,g=d.value.overrideMaterial,s.value.visible=!1,d.value.background=null,d.value.overrideMaterial=h,p.value.setRenderTarget(i),p.value.render(d.value,n.value),v(t.blur),t.smooth&&v(t.blur*.4),p.value.setRenderTarget(null),s.value.visible=!0,d.value.background=b,d.value.overrideMaterial=g)}),(S,A)=>{const _=u.resolveComponent("primitive");return u.openBlock(),u.createElementBlock("TresGroup",u.mergeProps({ref_key:"groupRef",ref:s},S.$attrs),[u.createElementVNode("TresMesh",{scale:[1,-1,1],geometry:u.unref(r)},[u.createElementVNode("TresMeshBasicMaterial",{map:u.unref(i).texture,opacity:S.opacity,"depth-write":S.depthWrite,transparent:!0},null,8,no)],8,so),u.createVNode(_,{object:u.unref(a)},null,8,["object"]),n.value&&S.helper?(u.openBlock(),u.createElementBlock("TresCameraHelper",{key:0,args:[n.value]},null,8,io)):u.createCommentVNode("",!0),u.createElementVNode("TresOrthographicCamera",{ref_key:"shadowCamera",ref:n,position:[0,0,0],rotation:[Math.PI/2,0,0],args:[-m.value/2,m.value/2,f.value/2,-f.value/2,0,S.far]},null,8,oo)],16)}}});function Cs(l){return u.getCurrentScope()?(u.onScopeDispose(l),!0):!1}function _e(l){return typeof l=="function"?l():u.unref(l)}const ao=typeof window<"u",ze=()=>{};function Os(l,e){function t(...s){return new Promise((n,i)=>{Promise.resolve(l(()=>e.apply(this,s),{fn:e,thisArg:this,args:s})).then(n).catch(i)})}return t}function lo(l,e={}){let t,s,n=ze;const i=r=>{clearTimeout(r),n(),n=ze};return r=>{const a=_e(l),h=_e(e.maxWait);return t&&i(t),a<=0||h!==void 0&&h<=0?(s&&(i(s),s=null),Promise.resolve(r())):new Promise((p,d)=>{n=e.rejectOnCancel?d:p,h&&!s&&(s=setTimeout(()=>{t&&i(t),s=null,p(r())},h)),t=setTimeout(()=>{s&&i(s),s=null,p(r())},a)})}}function co(l,e=!0,t=!0,s=!1){let n=0,i,o=!0,r=ze,a;const h=()=>{i&&(clearTimeout(i),i=void 0,r(),r=ze)};return d=>{const m=_e(l),f=Date.now()-n,w=()=>a=d();return h(),m<=0?(n=Date.now(),w()):(f>m&&(t||!o)?(n=Date.now(),w()):e&&(a=new Promise((y,v)=>{r=s?v:y,i=setTimeout(()=>{n=Date.now(),o=!0,y(w()),h()},Math.max(0,m-f))})),!t&&!i&&(i=setTimeout(()=>o=!0,m)),o=!1,a)}}function ho(l,e=200,t={}){return Os(lo(e,t),l)}function uo(l,e=200,t=!1,s=!0,n=!1){return Os(co(e,t,s,n),l)}function po(l,e=!0){u.getCurrentInstance()?u.onMounted(l):e?l():u.nextTick(l)}function mo(l){var e;const t=_e(l);return(e=t==null?void 0:t.$el)!=null?e:t}const Re=ao?window:void 0;function ae(...l){let e,t,s,n;if(typeof l[0]=="string"||Array.isArray(l[0])?([t,s,n]=l,e=Re):[e,t,s,n]=l,!e)return ze;Array.isArray(t)||(t=[t]),Array.isArray(s)||(s=[s]);const i=[],o=()=>{i.forEach(p=>p()),i.length=0},r=(p,d,m,f)=>(p.addEventListener(d,m,f),()=>p.removeEventListener(d,m,f)),a=u.watch(()=>[mo(e),_e(n)],([p,d])=>{o(),p&&i.push(...t.flatMap(m=>s.map(f=>r(p,m,f,d))))},{immediate:!0,flush:"post"}),h=()=>{a(),o()};return Cs(h),h}function fo(l){return typeof l=="function"?l:typeof l=="string"?e=>e.key===l:Array.isArray(l)?e=>l.includes(e.key):()=>!0}function Ge(...l){let e,t,s={};l.length===3?(e=l[0],t=l[1],s=l[2]):l.length===2?typeof l[1]=="object"?(e=!0,t=l[0],s=l[1]):(e=l[0],t=l[1]):(e=!0,t=l[0]);const{target:n=Re,eventName:i="keydown",passive:o=!1,dedupe:r=!1}=s,a=fo(e);return ae(n,i,p=>{p.repeat&&_e(r)||a(p)&&t(p)},o)}function go(){const l=u.ref(!1);return u.getCurrentInstance()&&u.onMounted(()=>{l.value=!0}),l}function yo(l){const e=go();return u.computed(()=>(e.value,!!l()))}function _o(l,e={}){const{window:t=Re}=e,s=yo(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function");let n;const i=u.ref(!1),o=h=>{i.value=h.matches},r=()=>{n&&("removeEventListener"in n?n.removeEventListener("change",o):n.removeListener(o))},a=u.watchEffect(()=>{s.value&&(r(),n=t.matchMedia(_e(l)),"addEventListener"in n?n.addEventListener("change",o):n.addListener(o),i.value=n.matches)});return Cs(()=>{a(),r(),n=void 0}),i}const Ps=1;function wo(l,e={}){const{throttle:t=0,idle:s=200,onStop:n=ze,onScroll:i=ze,offset:o={left:0,right:0,top:0,bottom:0},eventListenerOptions:r={capture:!1,passive:!0},behavior:a="auto",window:h=Re}=e,p=u.ref(0),d=u.ref(0),m=u.computed({get(){return p.value},set(A){w(A,void 0)}}),f=u.computed({get(){return d.value},set(A){w(void 0,A)}});function w(A,_){var x,D,k;if(!h)return;const I=_e(l);I&&((k=I instanceof Document?h.document.body:I)==null||k.scrollTo({top:(x=_e(_))!=null?x:f.value,left:(D=_e(A))!=null?D:m.value,behavior:_e(a)}))}const y=u.ref(!1),v=u.reactive({left:!0,right:!1,top:!0,bottom:!1}),M=u.reactive({left:!1,right:!1,top:!1,bottom:!1}),L=A=>{y.value&&(y.value=!1,M.left=!1,M.right=!1,M.top=!1,M.bottom=!1,n(A))},b=ho(L,t+s),g=A=>{if(!h)return;const _=A===h?A.document.documentElement:A===h.document?A.documentElement:A,{display:x,flexDirection:D}=getComputedStyle(_),k=_.scrollLeft;M.left=k<p.value,M.right=k>p.value;const I=Math.abs(k)<=0+(o.left||0),B=Math.abs(k)+_.clientWidth>=_.scrollWidth-(o.right||0)-Ps;x==="flex"&&D==="row-reverse"?(v.left=B,v.right=I):(v.left=I,v.right=B),p.value=k;let R=_.scrollTop;A===h.document&&!R&&(R=h.document.body.scrollTop),M.top=R<d.value,M.bottom=R>d.value;const H=Math.abs(R)<=0+(o.top||0),G=Math.abs(R)+_.clientHeight>=_.scrollHeight-(o.bottom||0)-Ps;x==="flex"&&D==="column-reverse"?(v.top=G,v.bottom=H):(v.top=H,v.bottom=G),d.value=R},S=A=>{if(!h)return;const _=A.target===h.document?A.target.documentElement:A.target;g(_),y.value=!0,b(A),i(A)};return ae(l,"scroll",t?uo(S,t,!0,!1):S,r),ae(l,"scrollend",L,r),{x:m,y:f,isScrolling:y,arrivedState:v,directions:M,measure(){const A=_e(l);h&&A&&g(A)}}}const xo={page:l=>[l.pageX,l.pageY],client:l=>[l.clientX,l.clientY],screen:l=>[l.screenX,l.screenY],movement:l=>l instanceof Touch?null:[l.movementX,l.movementY]};function vo(l={}){const{type:e="page",touch:t=!0,resetOnTouchEnds:s=!1,initialValue:n={x:0,y:0},window:i=Re,target:o=i,eventFilter:r}=l,a=u.ref(n.x),h=u.ref(n.y),p=u.ref(null),d=typeof e=="function"?e:xo[e],m=M=>{const L=d(M);L&&([a.value,h.value]=L,p.value="mouse")},f=M=>{if(M.touches.length>0){const L=d(M.touches[0]);L&&([a.value,h.value]=L,p.value="touch")}},w=()=>{a.value=n.x,h.value=n.y},y=r?M=>r(()=>m(M),{}):M=>m(M),v=r?M=>r(()=>f(M),{}):M=>f(M);if(o){const M={passive:!0};ae(o,["mousemove","dragover"],y,M),t&&e!=="movement"&&(ae(o,["touchstart","touchmove"],v,M),s&&ae(o,"touchend",w,M))}return{x:a,y:h,sourceType:p}}function Ao({window:l=Re}={}){if(!l)return{x:u.ref(0),y:u.ref(0)};const e=u.ref(l.scrollX),t=u.ref(l.scrollY);return ae(l,"scroll",()=>{e.value=l.scrollX,t.value=l.scrollY},{capture:!1,passive:!0}),{x:e,y:t}}function Ds(l={}){const{window:e=Re,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:s=Number.POSITIVE_INFINITY,listenOrientation:n=!0,includeScrollbar:i=!0}=l,o=u.ref(t),r=u.ref(s),a=()=>{e&&(i?(o.value=e.innerWidth,r.value=e.innerHeight):(o.value=e.document.documentElement.clientWidth,r.value=e.document.documentElement.clientHeight))};if(a(),po(a),ae("resize",a,{passive:!0}),n){const h=_o("(orientation: portrait)");u.watch(h,()=>a())}return{width:o,height:r}}const Mo=u.defineComponent({__name:"MouseParallax",props:{disabled:{type:Boolean,default:!1},factor:{default:2.5},ease:{default:.1}},setup(l){const e=l,{camera:t}=q.useTresContext(),{disabled:s,factor:n,ease:i}=u.toRefs(e),{x:o,y:r}=vo(),{width:a,height:h}=Ds(),p=u.ref(),d=u.computed(()=>(o.value/a.value-.5)*n.value),m=u.computed(()=>-(r.value/h.value-.5)*n.value),{onLoop:f}=q.useRenderLoop();return f(({delta:w})=>{s.value||!p.value||(p.value.position.x+=(d.value-p.value.position.x)*i.value*w,p.value.position.y+=(m.value-p.value.position.y)*i.value*w)}),u.watch(()=>p.value,w=>{w==null||w.add(t.value)}),(w,y)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"cameraGroupRef",ref:p},null,512))}});let dt=null;function bo(l,e){return t=>{e&&e(t),l.draco&&(dt||(dt=new Vi),dt.setDecoderPath(l.decoderPath||"https://www.gstatic.com/draco/versioned/decoders/1.4.3/"),t.setDRACOLoader(dt))}}async function Is(l,e={draco:!1},t){return await q.useLoader(In,l,bo(e,t))}const So=u.defineComponent({__name:"component",props:{path:{},draco:{type:Boolean,default:!1},decoderPath:{default:"https://www.gstatic.com/draco/versioned/decoders/1.4.1/"}},async setup(l,{expose:e}){let t,s;const n=l,i=u.ref();e({value:i});const{scene:o}=([t,s]=u.withAsyncContext(()=>Is(n.path,{draco:n.draco,decoderPath:n.decoderPath})),t=await t,s(),t);return(r,a)=>{const h=u.resolveComponent("primitive");return u.openBlock(),u.createBlock(h,u.mergeProps({ref_key:"modelRef",ref:i,object:u.unref(o)},r.$attrs),null,16,["object"])}}});async function ks(l){return await q.useLoader(xi,l)}const To=u.defineComponent({__name:"component",props:{path:{}},async setup(l,{expose:e}){let t,s;const n=l,i=u.ref();e({value:i});const o=([t,s]=u.withAsyncContext(()=>ks(n.path)),t=await t,s(),t);return(r,a)=>{const h=u.resolveComponent("primitive");return u.openBlock(),u.createBlock(h,u.mergeProps({ref_key:"modelRef",ref:i,object:u.unref(o)},r.$attrs),null,16,["object"])}}}),Fs="[TresJS - Cientos ▲ ■ ♥] ";function Ut(){function l(s,n){console.error(`${Fs} ${s}`,n||"")}function e(s){console.warn(`${Fs} ${s}`)}function t(s,n){}return{logError:l,logWarning:e,logMessage:t}}let Nt=0;function Lo(){const l=u.ref(!1),e=u.ref(0),t=u.ref([]),{logError:s}=Ut();return new Promise(n=>{c.DefaultLoadingManager.onStart=()=>{l.value=!1},c.DefaultLoadingManager.onLoad=()=>{l.value=!0},c.DefaultLoadingManager.onProgress=(i,o,r)=>{o===r&&(Nt=r,l.value=!0,t.value.push(i)),e.value=Math.round((o-Nt)/(r-Nt)*100||100,2)},c.DefaultLoadingManager.onError=i=>{s("Error loading assets",new Error(i)),l.value=!0},n({items:t,hasFinishLoading:l,progress:e})})}async function Co(l,e){const{logError:t}=Ut();if(!l)return t("Error no path provided");const{unsuspend:s,start:n,crossOrigin:i,muted:o,loop:r,...a}={unsuspend:"loadedmetadata",crossOrigin:"Anonymous",muted:!0,loop:!0,start:!0,playsInline:!0,...e};function h(){return new Promise((p,d)=>{const m=Object.assign(document.createElement("video"),{src:typeof l=="string"&&l||void 0,crossOrigin:i,loop:r,muted:o,autoplay:!0,...a}),f=new c.VideoTexture(m);return m.addEventListener(s,()=>p(f)),m.addEventListener("error",()=>d()),f})}try{const p=await h();return n&&p.image&&p.image.play(),p}catch{t("Error loading resource")}}const Oo=["target","auto-rotate","auto-rotate-speed","enable-damping","damping-factor","enable-pan","key-pan-speed","keys","max-azimuth-angle","min-azimuth-angle","max-polar-angle","min-polar-angle","min-distance","max-distance","min-zoom","max-zoom","touches","enable-zoom","zoom-speed","enable-rotate","rotate-speed","args"],Po=u.defineComponent({__name:"OrbitControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},target:{default:()=>[0,0,0]},enableDamping:{type:Boolean,default:!1},dampingFactor:{default:.05},autoRotate:{type:Boolean,default:!1},autoRotateSpeed:{default:2},enablePan:{type:Boolean,default:!0},keyPanSpeed:{default:7},keys:{},maxAzimuthAngle:{default:1/0},minAzimuthAngle:{default:-1/0},maxPolarAngle:{default:Math.PI},minPolarAngle:{default:0},minDistance:{default:0},maxDistance:{default:1/0},minZoom:{default:0},maxZoom:{default:1/0},touches:{default:()=>({ONE:c.TOUCH.ROTATE,TWO:c.TOUCH.DOLLY_PAN})},enableZoom:{type:Boolean,default:!0},zoomSpeed:{default:1},enableRotate:{type:Boolean,default:!0},rotateSpeed:{default:1}},emits:["change","start","end"],setup(l,{emit:e}){const t=l,{makeDefault:s,autoRotate:n,autoRotateSpeed:i,enableDamping:o,dampingFactor:r,enablePan:a,keyPanSpeed:h,maxAzimuthAngle:p,minAzimuthAngle:d,maxPolarAngle:m,minPolarAngle:f,minDistance:w,maxDistance:y,minZoom:v,maxZoom:M,enableZoom:L,zoomSpeed:b,enableRotate:g,touches:S,rotateSpeed:A,target:_}=u.toRefs(t),{camera:x,renderer:D,extend:k,controls:I}=q.useTresContext(),B=u.ref(null);k({OrbitControls:hs}),u.watch(B,G=>{R(),G&&s.value?I.value=G:I.value=null});function R(){ae(B.value,"change",()=>e("change",B.value)),ae(B.value,"start",()=>e("start",B.value)),ae(B.value,"end",()=>e("end",B.value))}const{onLoop:H}=q.useRenderLoop();return H(()=>{B.value&&(o.value||n.value)&&B.value.update()}),u.onUnmounted(()=>{B.value&&B.value.dispose()}),(G,se)=>{var X;return u.unref(x)&&u.unref(D)?(u.openBlock(),u.createElementBlock("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:B,target:u.unref(_),"auto-rotate":u.unref(n),"auto-rotate-speed":u.unref(i),"enable-damping":u.unref(o),"damping-factor":u.unref(r),"enable-pan":u.unref(a),"key-pan-speed":u.unref(h),keys:G.keys,"max-azimuth-angle":u.unref(p),"min-azimuth-angle":u.unref(d),"max-polar-angle":u.unref(m),"min-polar-angle":u.unref(f),"min-distance":u.unref(w),"max-distance":u.unref(y),"min-zoom":u.unref(v),"max-zoom":u.unref(M),touches:u.unref(S),"enable-zoom":u.unref(L),"zoom-speed":u.unref(b),"enable-rotate":u.unref(g),"rotate-speed":u.unref(A),args:[u.unref(x)||G.camera,((X=u.unref(D))==null?void 0:X.domElement)||G.domElement]},null,8,Oo)):u.createCommentVNode("",!0)}}}),Do=5,Io=6,ko=.3,Fo=u.defineComponent({__name:"KeyboardControls",props:{forward:{default:()=>["w","W"]},back:{default:()=>["s","S"]},left:{default:()=>["a","A"]},right:{default:()=>["d","D"]},jump:{default:()=>[" "]},gravity:{default:9.8},moveSpeed:{default:.1},headBobbing:{type:Boolean,default:!1},is2D:{type:Boolean,default:!1}},setup(l){var k;const e=l,{forward:t,back:s,left:n,right:i,jump:o,gravity:r,moveSpeed:a,headBobbing:h,is2D:p}=u.toRefs(e),{camera:d,controls:m}=q.useTresContext(),f=u.ref(0),w=u.ref(0),y=u.ref(!1),v=u.ref(!1),M=u.ref(0),L=u.shallowRef(),b=p.value?"y":"z";let g=((k=d.value.position)==null?void 0:k.y)||0;Ge(t.value,()=>{y.value=!0,w.value=a.value},{eventName:"keydown"}),Ge(s.value,()=>{y.value=!0,w.value=-a.value},{eventName:"keydown"}),Ge([...t.value,...s.value],()=>{y.value=!1,w.value=0},{eventName:"keyup"}),Ge(n.value,()=>{y.value=!0,f.value=-a.value},{eventName:"keydown"}),Ge(i.value,()=>{y.value=!0,f.value=a.value},{eventName:"keydown"}),Ge([...n.value,...i.value],()=>{y.value=!1,f.value=0},{eventName:"keyup"}),Ge(o.value,()=>{v.value||(M.value=Date.now()),v.value=!0});const S=I=>y.value?Math.sin(I*Do)*ko+g:g,A=()=>(Date.now()-M.value)/1e3*3,_=I=>g+Io*I-.5*r.value*Math.pow(I,2),x=()=>{if(v.value){const I=_(A());return I<=g&&(v.value=!1),I}return 0},{onLoop:D}=q.useRenderLoop();return D(({elapsed:I})=>{var B;m.value instanceof bt&&((B=m.value)!=null&&B.isLocked)?(m.value.moveForward(w.value),m.value.moveRight(f.value),d.value.position&&(d.value.position.y=h.value?S(I):g,d.value.position.y+=x())):L.value.children.length>0&&!(m.value instanceof bt)&&(L.value.position.x+=f.value,L.value.position[b]+=p.value?w.value:-w.value)}),(I,B)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"wrapperRef",ref:L},[u.renderSlot(I.$slots,"default")],512))}}),Bo=["object","args","mode","enabled","axis","translation-snap","rotation-snap","scale-snap","space","size","show-x","show-y","show-z"],Uo=u.defineComponent({__name:"TransformControls",props:{object:{},mode:{default:"translate"},enabled:{type:Boolean,default:!0},axis:{default:"XYZ"},translationSnap:{},rotationSnap:{},scaleSnap:{},space:{default:"world"},size:{default:1},showX:{type:Boolean,default:!0},showY:{type:Boolean,default:!0},showZ:{type:Boolean,default:!0}},emits:["dragging","change","mouseDown","mouseUp","objectChange"],setup(l,{emit:e}){const t=l,{object:s,mode:n,enabled:i,axis:o,translationSnap:r,rotationSnap:a,scaleSnap:h,space:p,size:d,showX:m,showY:f,showZ:w}=u.toRefs(t),y=u.shallowRef(),{controls:v,camera:M,renderer:L,extend:b}=q.useTresContext();b({TransformControls:vn});const g=A=>{v.value&&(v.value.enabled=!A.value),e("dragging",A.value)};function S(){ae(y.value,"change",()=>e("change")),ae(y.value,"dragging-changed",g),ae(y.value,"mouseDown",()=>e("mouseDown")),ae(y.value,"mouseUp",()=>e("mouseUp")),ae(y.value,"objectChange",()=>e("objectChange"))}return u.watchEffect(()=>{y.value&&S()}),u.onUnmounted(()=>{y.value&&y.value.dispose()}),(A,_)=>u.unref(M)&&u.unref(L)?(u.openBlock(),u.createElementBlock("TresTransformControls",{key:0,ref_key:"controlsRef",ref:y,object:u.unref(s),args:[u.unref(M),u.unref(L).domElement],mode:u.unref(n),enabled:u.unref(i),axis:u.unref(o),"translation-snap":u.unref(r),"rotation-snap":u.unref(a),"scale-snap":u.unref(h),space:u.unref(p),size:u.unref(d),"show-x":u.unref(m),"show-y":u.unref(f),"show-z":u.unref(w),visible:!0},null,8,Bo)):u.createCommentVNode("",!0)}}),No=["args"],Vo=u.defineComponent({__name:"PointerLockControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},selector:{}},emits:["isLock"],setup(l,{expose:e,emit:t}){const s=l,{camera:n,renderer:i,extend:o,controls:r}=q.useTresContext(),a=u.ref(null);let h;o({PointerLockControls:bt});const p=d=>{t("isLock",d)};return u.watch(a,d=>{d&&s.makeDefault?r.value=d:r.value=null;const m=document.getElementById(s.selector||"");h=m||i.value.domElement,ae(h,"click",()=>{var f,w,y;(f=r.value)==null||f.lock(),(w=r.value)==null||w.addEventListener("lock",()=>p(!0)),(y=r.value)==null||y.addEventListener("unlock",()=>p(!1))})}),u.onUnmounted(()=>{var d,m;(d=r.value)==null||d.removeEventListener("lock",()=>p(!0)),(m=r.value)==null||m.removeEventListener("unlock",()=>p(!1)),a.value&&a.value.dispose()}),e({value:r}),(d,m)=>{var f;return u.unref(n)&&u.unref(i)?(u.openBlock(),u.createElementBlock("TresPointerLockControls",{key:0,ref_key:"controlsRef",ref:a,args:[u.unref(n)||d.camera,((f=u.unref(i))==null?void 0:f.domElement)||d.domElement]},null,8,No)):u.createCommentVNode("",!0)}}}),Eo=["args"],zo=u.defineComponent({__name:"MapControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{}},setup(l){const e=l,{camera:t,renderer:s,extend:n,controls:i}=q.useTresContext(),o=u.ref(null);return n({MapControls:Dn}),u.watch(i,r=>{r&&e.makeDefault?i.value=r:i.value=null}),u.onUnmounted(()=>{o.value&&o.value.dispose()}),(r,a)=>{var h;return u.unref(t)&&u.unref(s)?(u.openBlock(),u.createElementBlock("TresMapControls",{key:0,ref_key:"controlsRef",ref:o,args:[u.unref(t)||r.camera,((h=u.unref(s))==null?void 0:h.domElement)||r.domElement]},null,8,Eo)):u.createCommentVNode("",!0)}}}),Ro=u.defineComponent({__name:"ScrollControls",props:{pages:{default:4},distance:{default:4},smoothScroll:{default:.1},horizontal:{type:Boolean,default:!1},htmlScroll:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(l,{emit:e}){const t=l,{logWarning:s}=q.useLogger();t.smoothScroll<0&&s("SmoothControl must be greater than zero"),t.pages<0&&s("Pages must be greater than zero");const{camera:n,controls:i,renderer:o}=q.useTresContext(),r=u.shallowRef(),a=document.createElement("div"),{y:h}=Ao(),{x:p,y:d,isScrolling:m}=wo(a),{height:f,width:w}=Ds();let y=0;const v=u.ref(!1),M=u.ref(0),L=u.ref(0),b=u.ref(0),g=t.horizontal?"x":"y",S=u.watch(n,_=>{if(v.value){S();return}y=t.horizontal?(_==null?void 0:_.position.x)||0:(_==null?void 0:_.position.y)||0,v.value=!0},{immediate:!0});u.watch(m,_=>{i.value&&(i.value.enabled=!_)},{immediate:!0}),u.watch(h,_=>{!m.value&&!t.htmlScroll||(L.value=_/f.value/(b.value/f.value-1),M.value=-1*L.value,e("update:modelValue",L.value))}),u.watch(d,_=>{L.value=_/f.value/(b.value/f.value),M.value=-1*L.value,e("update:modelValue",L.value)}),u.watch(p,_=>{L.value=_/w.value/(b.value/w.value-1),M.value=+L.value,e("update:modelValue",L.value)}),u.watch(o,_=>{var D,k;const x=_==null?void 0:_.domElement;if(t.htmlScroll&&(_!=null&&_.domElement))x!=null&&x.style.width&&(x!=null&&x.style.position)&&(x!=null&&x.style.top)&&(x!=null&&x.style.left)&&(x.style.width="100%",x.style.position="fixed",x.style.zIndex=" -99999",x.style.top="0",x.style.left="0"),b.value=document.body.scrollHeight;else{const I=document.createElement("div"),B=document.createElement("div");a.style[t.horizontal?"overflowX":"overflowY"]="auto",a.style[t.horizontal?"overflowY":"overflowX"]="hidden",a.style.position="absolute",a.style.width="100%",a.style.height=" 100%",a.style.top="0",a.style.left="0",a.classList.add("scrollContainer"),I.style.position="sticky",I.style.top="0px",I.style.left="0px",I.style.width="100%",I.style.height="100%",I.style.overflow="hidden",a.appendChild(I),B.style.height=t.horizontal?"100%":`${f.value*t.pages}px`,B.style.width=t.horizontal?`${w.value*t.pages}px`:"100vw",B.style.pointerEvents="none",x.style.position="fixed",x.style.zIndex="0",x!=null&&x.style.width&&(x.style.width="100%"),a.appendChild(B),_.domElement.parentNode.style.position="relative",(k=(D=_==null?void 0:_.domElement)==null?void 0:D.parentNode)==null||k.appendChild(a),b.value=t.horizontal?w.value*t.pages:f.value*t.pages}},{immediate:!0});const{onLoop:A}=q.useRenderLoop();return A(()=>{var _;if((_=n.value)!=null&&_.position){const x=(M.value*t.distance-n.value.position[g]+y)*t.smoothScroll;n.value.position[g]+=x,r.value.children.length>0&&(r.value.position[g]+=x)}}),(_,x)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"wrapperRef",ref:r},[u.renderSlot(_.$slots,"default")],512))}});/*!
|
|
73
|
+
`};function Bs(c,e,t){const s=t.length-c-1;if(e>=t[s])return s-1;if(e<=t[c])return c;let n=c,o=s,i=Math.floor((n+o)/2);for(;e<t[i]||e>=t[i+1];)e<t[i]?o=i:n=i,i=Math.floor((n+o)/2);return i}function So(c,e,t,s){const n=[],o=[],i=[];n[0]=1;for(let r=1;r<=t;++r){o[r]=e-s[c+1-r],i[r]=s[c+r]-e;let a=0;for(let h=0;h<r;++h){const d=i[h+1],p=o[r-h],m=n[h]/(d+p);n[h]=a+d*m,a=p*m}n[r]=a}return n}function To(c,e,t,s){const n=Bs(c,s,e),o=So(n,s,c,e),i=new l.Vector4(0,0,0,0);for(let r=0;r<=c;++r){const a=t[n-c+r],h=o[r],d=a.w*h;i.x+=a.x*d,i.y+=a.y*d,i.z+=a.z*d,i.w+=a.w*h}return i}function Co(c,e,t,s,n){const o=[];for(let p=0;p<=t;++p)o[p]=0;const i=[];for(let p=0;p<=s;++p)i[p]=o.slice(0);const r=[];for(let p=0;p<=t;++p)r[p]=o.slice(0);r[0][0]=1;const a=o.slice(0),h=o.slice(0);for(let p=1;p<=t;++p){a[p]=e-n[c+1-p],h[p]=n[c+p]-e;let m=0;for(let g=0;g<p;++g){const A=h[g+1],b=a[p-g];r[p][g]=A+b;const _=r[g][p-1]/r[p][g];r[g][p]=m+A*_,m=b*_}r[p][p]=m}for(let p=0;p<=t;++p)i[0][p]=r[p][t];for(let p=0;p<=t;++p){let m=0,g=1;const A=[];for(let b=0;b<=t;++b)A[b]=o.slice(0);A[0][0]=1;for(let b=1;b<=s;++b){let _=0;const M=p-b,L=t-b;p>=b&&(A[g][0]=A[m][0]/r[L+1][M],_=A[g][0]*r[M][L]);const w=M>=-1?1:-M,y=p-1<=L?b-1:t-p;for(let T=w;T<=y;++T)A[g][T]=(A[m][T]-A[m][T-1])/r[L+1][M+T],_+=A[g][T]*r[M+T][L];p<=L&&(A[g][b]=-A[m][b-1]/r[L+1][p],_+=A[g][b]*r[p][L]),i[b][p]=_;const C=m;m=g,g=C}}let d=t;for(let p=1;p<=s;++p){for(let m=0;m<=t;++m)i[p][m]*=d;d*=t-p}return i}function Lo(c,e,t,s,n){const o=n<c?n:c,i=[],r=Bs(c,s,e),a=Co(r,s,c,o,e),h=[];for(let d=0;d<t.length;++d){const p=t[d].clone(),m=p.w;p.x*=m,p.y*=m,p.z*=m,h[d]=p}for(let d=0;d<=o;++d){const p=h[r-c].clone().multiplyScalar(a[d][0]);for(let m=1;m<=c;++m)p.add(h[r-c+m].clone().multiplyScalar(a[d][m]));i[d]=p}for(let d=o+1;d<=n+1;++d)i[d]=new l.Vector4(0,0,0);return i}function Po(c,e){let t=1;for(let n=2;n<=c;++n)t*=n;let s=1;for(let n=2;n<=e;++n)s*=n;for(let n=2;n<=c-e;++n)s*=n;return t/s}function Oo(c){const e=c.length,t=[],s=[];for(let o=0;o<e;++o){const i=c[o];t[o]=new l.Vector3(i.x,i.y,i.z),s[o]=i.w}const n=[];for(let o=0;o<e;++o){const i=t[o].clone();for(let r=1;r<=o;++r)i.sub(n[o-r].clone().multiplyScalar(Po(o,r)*s[r]));n[o]=i.divideScalar(s[0])}return n}function Io(c,e,t,s,n){const o=Lo(c,e,t,s,n);return Oo(o)}class Us extends l.Curve{constructor(e,t,s,n,o){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=n||0,this.endKnot=o||this.knots.length-1;for(let i=0;i<s.length;++i){const r=s[i];this.controlPoints[i]=new l.Vector4(r.x,r.y,r.z,r.w)}}getPoint(e,t){const s=t||new l.Vector3,n=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),o=To(this.degree,this.knots,this.controlPoints,n);return o.w!=1&&o.divideScalar(o.w),s.set(o.x,o.y,o.z)}getTangent(e,t){const s=t||new l.Vector3,n=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),o=Io(this.degree,this.knots,this.controlPoints,n,1);return s.copy(o[1]).normalize(),s}}let ue,Ae,Oe;class Do extends l.Loader{constructor(e){super(e)}load(e,t,s,n){const o=this,i=o.path===""?l.LoaderUtils.extractUrlBase(e):o.path,r=new l.FileLoader(this.manager);r.setPath(o.path),r.setResponseType("arraybuffer"),r.setRequestHeader(o.requestHeader),r.setWithCredentials(o.withCredentials),r.load(e,function(a){try{t(o.parse(a,i))}catch(h){n?n(h):console.error(h),o.manager.itemError(e)}},s,n)}parse(e,t){if(Vo(e))ue=new No().parse(e);else{const n=Es(e);if(!zo(n))throw new Error("THREE.FBXLoader: Unknown format.");if(zs(n)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+zs(n));ue=new Uo().parse(n)}const s=new l.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new ko(s,this.manager).parse(ue)}}class ko{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){Ae=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),s=this.parseMaterials(t),n=this.parseDeformers(),o=new Fo().parse(n);return this.parseScene(n,o,s),Oe}parseConnections(){const e=new Map;return"Connections"in ue&&ue.Connections.connections.forEach(function(s){const n=s[0],o=s[1],i=s[2];e.has(n)||e.set(n,{parents:[],children:[]});const r={ID:o,relationship:i};e.get(n).parents.push(r),e.has(o)||e.set(o,{parents:[],children:[]});const a={ID:n,relationship:i};e.get(o).children.push(a)}),e}parseImages(){const e={},t={};if("Video"in ue.Objects){const s=ue.Objects.Video;for(const n in s){const o=s[n],i=parseInt(n);if(e[i]=o.RelativeFilename||o.Filename,"Content"in o){const r=o.Content instanceof ArrayBuffer&&o.Content.byteLength>0,a=typeof o.Content=="string"&&o.Content!=="";if(r||a){const h=this.parseImage(s[n]);t[o.RelativeFilename||o.Filename]=h}}}}for(const s in e){const n=e[s];t[n]!==void 0?e[s]=t[n]:e[s]=e[s].split("\\").pop()}return e}parseImage(e){const t=e.Content,s=e.RelativeFilename||e.Filename,n=s.slice(s.lastIndexOf(".")+1).toLowerCase();let o;switch(n){case"bmp":o="image/bmp";break;case"jpg":case"jpeg":o="image/jpeg";break;case"png":o="image/png";break;case"tif":o="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",s),o="image/tga";break;default:console.warn('FBXLoader: Image type "'+n+'" is not supported.');return}if(typeof t=="string")return"data:"+o+";base64,"+t;{const i=new Uint8Array(t);return window.URL.createObjectURL(new Blob([i],{type:o}))}}parseTextures(e){const t=new Map;if("Texture"in ue.Objects){const s=ue.Objects.Texture;for(const n in s){const o=this.parseTexture(s[n],e);t.set(parseInt(n),o)}}return t}parseTexture(e,t){const s=this.loadTexture(e,t);s.ID=e.id,s.name=e.attrName;const n=e.WrapModeU,o=e.WrapModeV,i=n!==void 0?n.value:0,r=o!==void 0?o.value:0;if(s.wrapS=i===0?l.RepeatWrapping:l.ClampToEdgeWrapping,s.wrapT=r===0?l.RepeatWrapping:l.ClampToEdgeWrapping,"Scaling"in e){const a=e.Scaling.value;s.repeat.x=a[0],s.repeat.y=a[1]}return s}loadTexture(e,t){let s;const n=this.textureLoader.path,o=Ae.get(e.id).children;o!==void 0&&o.length>0&&t[o[0].ID]!==void 0&&(s=t[o[0].ID],(s.indexOf("blob:")===0||s.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let i;const r=e.FileName.slice(-3).toLowerCase();if(r==="tga"){const a=this.manager.getHandler(".tga");a===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),i=new l.Texture):(a.setPath(this.textureLoader.path),i=a.load(s))}else r==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),i=new l.Texture):i=this.textureLoader.load(s);return this.textureLoader.setPath(n),i}parseMaterials(e){const t=new Map;if("Material"in ue.Objects){const s=ue.Objects.Material;for(const n in s){const o=this.parseMaterial(s[n],e);o!==null&&t.set(parseInt(n),o)}}return t}parseMaterial(e,t){const s=e.id,n=e.attrName;let o=e.ShadingModel;if(typeof o=="object"&&(o=o.value),!Ae.has(s))return null;const i=this.parseParameters(e,t,s);let r;switch(o.toLowerCase()){case"phong":r=new l.MeshPhongMaterial;break;case"lambert":r=new l.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',o),r=new l.MeshPhongMaterial;break}return r.setValues(i),r.name=n,r}parseParameters(e,t,s){const n={};e.BumpFactor&&(n.bumpScale=e.BumpFactor.value),e.Diffuse?n.color=new l.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(n.color=new l.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(n.displacementScale=e.DisplacementFactor.value),e.Emissive?n.emissive=new l.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(n.emissive=new l.Color().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(n.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(n.opacity=parseFloat(e.Opacity.value)),n.opacity<1&&(n.transparent=!0),e.ReflectionFactor&&(n.reflectivity=e.ReflectionFactor.value),e.Shininess&&(n.shininess=e.Shininess.value),e.Specular?n.specular=new l.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(n.specular=new l.Color().fromArray(e.SpecularColor.value));const o=this;return Ae.get(s).children.forEach(function(i){const r=i.relationship;switch(r){case"Bump":n.bumpMap=o.getTexture(t,i.ID);break;case"Maya|TEX_ao_map":n.aoMap=o.getTexture(t,i.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":n.map=o.getTexture(t,i.ID),n.map!==void 0&&("colorSpace"in n.map?n.map.colorSpace="srgb":n.map.encoding=3001);break;case"DisplacementColor":n.displacementMap=o.getTexture(t,i.ID);break;case"EmissiveColor":n.emissiveMap=o.getTexture(t,i.ID),n.emissiveMap!==void 0&&("colorSpace"in n.emissiveMap?n.emissiveMap.colorSpace="srgb":n.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":n.normalMap=o.getTexture(t,i.ID);break;case"ReflectionColor":n.envMap=o.getTexture(t,i.ID),n.envMap!==void 0&&(n.envMap.mapping=l.EquirectangularReflectionMapping,"colorSpace"in n.envMap?n.envMap.colorSpace="srgb":n.envMap.encoding=3001);break;case"SpecularColor":n.specularMap=o.getTexture(t,i.ID),n.specularMap!==void 0&&("colorSpace"in n.specularMap?n.specularMap.colorSpace="srgb":n.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":n.alphaMap=o.getTexture(t,i.ID),n.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",r);break}}),n}getTexture(e,t){return"LayeredTexture"in ue.Objects&&t in ue.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ae.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in ue.Objects){const s=ue.Objects.Deformer;for(const n in s){const o=s[n],i=Ae.get(parseInt(n));if(o.attrType==="Skin"){const r=this.parseSkeleton(i,s);r.ID=n,i.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),r.geometryID=i.parents[0].ID,e[n]=r}else if(o.attrType==="BlendShape"){const r={id:n};r.rawTargets=this.parseMorphTargets(i,s),r.id=n,i.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[n]=r}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const s=[];return e.children.forEach(function(n){const o=t[n.ID];if(o.attrType!=="Cluster")return;const i={ID:n.ID,indices:[],weights:[],transformLink:new l.Matrix4().fromArray(o.TransformLink.a)};"Indexes"in o&&(i.indices=o.Indexes.a,i.weights=o.Weights.a),s.push(i)}),{rawBones:s,bones:[]}}parseMorphTargets(e,t){const s=[];for(let n=0;n<e.children.length;n++){const o=e.children[n],i=t[o.ID],r={name:i.attrName,initialWeight:i.DeformPercent,id:i.id,fullWeights:i.FullWeights.a};if(i.attrType!=="BlendShapeChannel")return;r.geoID=Ae.get(parseInt(o.ID)).children.filter(function(a){return a.relationship===void 0})[0].ID,s.push(r)}return s}parseScene(e,t,s){Oe=new l.Group;const n=this.parseModels(e.skeletons,t,s),o=ue.Objects.Model,i=this;n.forEach(function(a){const h=o[a.ID];i.setLookAtProperties(a,h),Ae.get(a.ID).parents.forEach(function(p){const m=n.get(p.ID);m!==void 0&&m.add(a)}),a.parent===null&&Oe.add(a)}),this.bindSkeleton(e.skeletons,t,n),this.createAmbientLight(),Oe.traverse(function(a){if(a.userData.transformData){a.parent&&(a.userData.transformData.parentMatrix=a.parent.matrix,a.userData.transformData.parentMatrixWorld=a.parent.matrixWorld);const h=Rs(a.userData.transformData);a.applyMatrix4(h),a.updateWorldMatrix()}});const r=new Bo().parse();Oe.children.length===1&&Oe.children[0].isGroup&&(Oe.children[0].animations=r,Oe=Oe.children[0]),Oe.animations=r}parseModels(e,t,s){const n=new Map,o=ue.Objects.Model;for(const i in o){const r=parseInt(i),a=o[i],h=Ae.get(r);let d=this.buildSkeleton(h,e,r,a.attrName);if(!d){switch(a.attrType){case"Camera":d=this.createCamera(h);break;case"Light":d=this.createLight(h);break;case"Mesh":d=this.createMesh(h,t,s);break;case"NurbsCurve":d=this.createCurve(h,t);break;case"LimbNode":case"Root":d=new l.Bone;break;case"Null":default:d=new l.Group;break}d.name=a.attrName?l.PropertyBinding.sanitizeNodeName(a.attrName):"",d.ID=r}this.getTransformData(d,a),n.set(r,d)}return n}buildSkeleton(e,t,s,n){let o=null;return e.parents.forEach(function(i){for(const r in t){const a=t[r];a.rawBones.forEach(function(h,d){if(h.ID===i.ID){const p=o;o=new l.Bone,o.matrixWorld.copy(h.transformLink),o.name=n?l.PropertyBinding.sanitizeNodeName(n):"",o.ID=s,a.bones[d]=o,p!==null&&o.add(p)}})}}),o}createCamera(e){let t,s;if(e.children.forEach(function(n){const o=ue.Objects.NodeAttribute[n.ID];o!==void 0&&(s=o)}),s===void 0)t=new l.Object3D;else{let n=0;s.CameraProjectionType!==void 0&&s.CameraProjectionType.value===1&&(n=1);let o=1;s.NearPlane!==void 0&&(o=s.NearPlane.value/1e3);let i=1e3;s.FarPlane!==void 0&&(i=s.FarPlane.value/1e3);let r=window.innerWidth,a=window.innerHeight;s.AspectWidth!==void 0&&s.AspectHeight!==void 0&&(r=s.AspectWidth.value,a=s.AspectHeight.value);const h=r/a;let d=45;s.FieldOfView!==void 0&&(d=s.FieldOfView.value);const p=s.FocalLength?s.FocalLength.value:null;switch(n){case 0:t=new l.PerspectiveCamera(d,h,o,i),p!==null&&t.setFocalLength(p);break;case 1:t=new l.OrthographicCamera(-r/2,r/2,a/2,-a/2,o,i);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+n+"."),t=new l.Object3D;break}}return t}createLight(e){let t,s;if(e.children.forEach(function(n){const o=ue.Objects.NodeAttribute[n.ID];o!==void 0&&(s=o)}),s===void 0)t=new l.Object3D;else{let n;s.LightType===void 0?n=0:n=s.LightType.value;let o=16777215;s.Color!==void 0&&(o=new l.Color().fromArray(s.Color.value));let i=s.Intensity===void 0?1:s.Intensity.value/100;s.CastLightOnObject!==void 0&&s.CastLightOnObject.value===0&&(i=0);let r=0;s.FarAttenuationEnd!==void 0&&(s.EnableFarAttenuation!==void 0&&s.EnableFarAttenuation.value===0?r=0:r=s.FarAttenuationEnd.value);const a=1;switch(n){case 0:t=new l.PointLight(o,i,r,a);break;case 1:t=new l.DirectionalLight(o,i);break;case 2:let h=Math.PI/3;s.InnerAngle!==void 0&&(h=l.MathUtils.degToRad(s.InnerAngle.value));let d=0;s.OuterAngle!==void 0&&(d=l.MathUtils.degToRad(s.OuterAngle.value),d=Math.max(d,1)),t=new l.SpotLight(o,i,r,h,d,a);break;default:console.warn("THREE.FBXLoader: Unknown light type "+s.LightType.value+", defaulting to a PointLight."),t=new l.PointLight(o,i);break}s.CastShadows!==void 0&&s.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,s){let n,o=null,i=null;const r=[];return e.children.forEach(function(a){t.has(a.ID)&&(o=t.get(a.ID)),s.has(a.ID)&&r.push(s.get(a.ID))}),r.length>1?i=r:r.length>0?i=r[0]:(i=new l.MeshPhongMaterial({color:13421772}),r.push(i)),"color"in o.attributes&&r.forEach(function(a){a.vertexColors=!0}),o.FBX_Deformer?(n=new l.SkinnedMesh(o,i),n.normalizeSkinWeights()):n=new l.Mesh(o,i),n}createCurve(e,t){const s=e.children.reduce(function(o,i){return t.has(i.ID)&&(o=t.get(i.ID)),o},null),n=new l.LineBasicMaterial({color:3342591,linewidth:1});return new l.Line(s,n)}getTransformData(e,t){const s={};"InheritType"in t&&(s.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?s.eulerOrder=Gs(t.RotationOrder.value):s.eulerOrder="ZYX","Lcl_Translation"in t&&(s.translation=t.Lcl_Translation.value),"PreRotation"in t&&(s.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(s.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(s.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(s.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(s.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(s.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(s.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(s.rotationPivot=t.RotationPivot.value),e.userData.transformData=s}setLookAtProperties(e,t){"LookAtProperty"in t&&Ae.get(e.ID).children.forEach(function(n){if(n.relationship==="LookAtProperty"){const o=ue.Objects.Model[n.ID];if("Lcl_Translation"in o){const i=o.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(i),Oe.add(e.target)):e.lookAt(new l.Vector3().fromArray(i))}}})}bindSkeleton(e,t,s){const n=this.parsePoseNodes();for(const o in e){const i=e[o];Ae.get(parseInt(i.ID)).parents.forEach(function(a){if(t.has(a.ID)){const h=a.ID;Ae.get(h).parents.forEach(function(p){s.has(p.ID)&&s.get(p.ID).bind(new l.Skeleton(i.bones),n[p.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in ue.Objects){const t=ue.Objects.Pose;for(const s in t)if(t[s].attrType==="BindPose"&&t[s].NbPoseNodes>0){const n=t[s].PoseNode;Array.isArray(n)?n.forEach(function(o){e[o.Node]=new l.Matrix4().fromArray(o.Matrix.a)}):e[n.Node]=new l.Matrix4().fromArray(n.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in ue&&"AmbientColor"in ue.GlobalSettings){const e=ue.GlobalSettings.AmbientColor.value,t=e[0],s=e[1],n=e[2];if(t!==0||s!==0||n!==0){const o=new l.Color(t,s,n);Oe.add(new l.AmbientLight(o,1))}}}}class Fo{parse(e){const t=new Map;if("Geometry"in ue.Objects){const s=ue.Objects.Geometry;for(const n in s){const o=Ae.get(parseInt(n)),i=this.parseGeometry(o,s[n],e);t.set(parseInt(n),i)}}return t}parseGeometry(e,t,s){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,s);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,s){const n=s.skeletons,o=[],i=e.parents.map(function(p){return ue.Objects.Model[p.ID]});if(i.length===0)return;const r=e.children.reduce(function(p,m){return n[m.ID]!==void 0&&(p=n[m.ID]),p},null);e.children.forEach(function(p){s.morphTargets[p.ID]!==void 0&&o.push(s.morphTargets[p.ID])});const a=i[0],h={};"RotationOrder"in a&&(h.eulerOrder=Gs(a.RotationOrder.value)),"InheritType"in a&&(h.inheritType=parseInt(a.InheritType.value)),"GeometricTranslation"in a&&(h.translation=a.GeometricTranslation.value),"GeometricRotation"in a&&(h.rotation=a.GeometricRotation.value),"GeometricScaling"in a&&(h.scale=a.GeometricScaling.value);const d=Rs(h);return this.genGeometry(t,r,o,d)}genGeometry(e,t,s,n){const o=new l.BufferGeometry;e.attrName&&(o.name=e.attrName);const i=this.parseGeoNode(e,t),r=this.genBuffers(i),a=new l.Float32BufferAttribute(r.vertex,3);if(a.applyMatrix4(n),o.setAttribute("position",a),r.colors.length>0&&o.setAttribute("color",new l.Float32BufferAttribute(r.colors,3)),t&&(o.setAttribute("skinIndex",new l.Uint16BufferAttribute(r.weightsIndices,4)),o.setAttribute("skinWeight",new l.Float32BufferAttribute(r.vertexWeights,4)),o.FBX_Deformer=t),r.normal.length>0){const h=new l.Matrix3().getNormalMatrix(n),d=new l.Float32BufferAttribute(r.normal,3);d.applyNormalMatrix(h),o.setAttribute("normal",d)}if(r.uvs.forEach(function(h,d){let p="uv"+(d+1).toString();d===0&&(p="uv"),o.setAttribute(p,new l.Float32BufferAttribute(r.uvs[d],2))}),i.material&&i.material.mappingType!=="AllSame"){let h=r.materialIndex[0],d=0;if(r.materialIndex.forEach(function(p,m){p!==h&&(o.addGroup(d,m-d,h),h=p,d=m)}),o.groups.length>0){const p=o.groups[o.groups.length-1],m=p.start+p.count;m!==r.materialIndex.length&&o.addGroup(m,r.materialIndex.length-m,h)}o.groups.length===0&&o.addGroup(0,r.materialIndex.length,r.materialIndex[0])}return this.addMorphTargets(o,e,s,n),o}parseGeoNode(e,t){const s={};if(s.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],s.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(s.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(s.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(s.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){s.uv=[];let n=0;for(;e.LayerElementUV[n];)e.LayerElementUV[n].UV&&s.uv.push(this.parseUVs(e.LayerElementUV[n])),n++}return s.weightTable={},t!==null&&(s.skeleton=t,t.rawBones.forEach(function(n,o){n.indices.forEach(function(i,r){s.weightTable[i]===void 0&&(s.weightTable[i]=[]),s.weightTable[i].push({id:o,weight:n.weights[r]})})})),s}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let s=0,n=0,o=!1,i=[],r=[],a=[],h=[],d=[],p=[];const m=this;return e.vertexIndices.forEach(function(g,A){let b,_=!1;g<0&&(g=g^-1,_=!0);let M=[],L=[];if(i.push(g*3,g*3+1,g*3+2),e.color){const w=Lt(A,s,g,e.color);a.push(w[0],w[1],w[2])}if(e.skeleton){if(e.weightTable[g]!==void 0&&e.weightTable[g].forEach(function(w){L.push(w.weight),M.push(w.id)}),L.length>4){o||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),o=!0);const w=[0,0,0,0],y=[0,0,0,0];L.forEach(function(C,T){let x=C,v=M[T];y.forEach(function(D,z,U){if(x>D){U[z]=x,x=D;const R=w[z];w[z]=v,v=R}})}),M=w,L=y}for(;L.length<4;)L.push(0),M.push(0);for(let w=0;w<4;++w)d.push(L[w]),p.push(M[w])}if(e.normal){const w=Lt(A,s,g,e.normal);r.push(w[0],w[1],w[2])}e.material&&e.material.mappingType!=="AllSame"&&(b=Lt(A,s,g,e.material)[0]),e.uv&&e.uv.forEach(function(w,y){const C=Lt(A,s,g,w);h[y]===void 0&&(h[y]=[]),h[y].push(C[0]),h[y].push(C[1])}),n++,_&&(m.genFace(t,e,i,b,r,a,h,d,p,n),s++,n=0,i=[],r=[],a=[],h=[],d=[],p=[])}),t}genFace(e,t,s,n,o,i,r,a,h,d){for(let p=2;p<d;p++)e.vertex.push(t.vertexPositions[s[0]]),e.vertex.push(t.vertexPositions[s[1]]),e.vertex.push(t.vertexPositions[s[2]]),e.vertex.push(t.vertexPositions[s[(p-1)*3]]),e.vertex.push(t.vertexPositions[s[(p-1)*3+1]]),e.vertex.push(t.vertexPositions[s[(p-1)*3+2]]),e.vertex.push(t.vertexPositions[s[p*3]]),e.vertex.push(t.vertexPositions[s[p*3+1]]),e.vertex.push(t.vertexPositions[s[p*3+2]]),t.skeleton&&(e.vertexWeights.push(a[0]),e.vertexWeights.push(a[1]),e.vertexWeights.push(a[2]),e.vertexWeights.push(a[3]),e.vertexWeights.push(a[(p-1)*4]),e.vertexWeights.push(a[(p-1)*4+1]),e.vertexWeights.push(a[(p-1)*4+2]),e.vertexWeights.push(a[(p-1)*4+3]),e.vertexWeights.push(a[p*4]),e.vertexWeights.push(a[p*4+1]),e.vertexWeights.push(a[p*4+2]),e.vertexWeights.push(a[p*4+3]),e.weightsIndices.push(h[0]),e.weightsIndices.push(h[1]),e.weightsIndices.push(h[2]),e.weightsIndices.push(h[3]),e.weightsIndices.push(h[(p-1)*4]),e.weightsIndices.push(h[(p-1)*4+1]),e.weightsIndices.push(h[(p-1)*4+2]),e.weightsIndices.push(h[(p-1)*4+3]),e.weightsIndices.push(h[p*4]),e.weightsIndices.push(h[p*4+1]),e.weightsIndices.push(h[p*4+2]),e.weightsIndices.push(h[p*4+3])),t.color&&(e.colors.push(i[0]),e.colors.push(i[1]),e.colors.push(i[2]),e.colors.push(i[(p-1)*3]),e.colors.push(i[(p-1)*3+1]),e.colors.push(i[(p-1)*3+2]),e.colors.push(i[p*3]),e.colors.push(i[p*3+1]),e.colors.push(i[p*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(n),e.materialIndex.push(n),e.materialIndex.push(n)),t.normal&&(e.normal.push(o[0]),e.normal.push(o[1]),e.normal.push(o[2]),e.normal.push(o[(p-1)*3]),e.normal.push(o[(p-1)*3+1]),e.normal.push(o[(p-1)*3+2]),e.normal.push(o[p*3]),e.normal.push(o[p*3+1]),e.normal.push(o[p*3+2])),t.uv&&t.uv.forEach(function(m,g){e.uvs[g]===void 0&&(e.uvs[g]=[]),e.uvs[g].push(r[g][0]),e.uvs[g].push(r[g][1]),e.uvs[g].push(r[g][(p-1)*2]),e.uvs[g].push(r[g][(p-1)*2+1]),e.uvs[g].push(r[g][p*2]),e.uvs[g].push(r[g][p*2+1])})}addMorphTargets(e,t,s,n){if(s.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const o=this;s.forEach(function(i){i.rawTargets.forEach(function(r){const a=ue.Objects.Geometry[r.geoID];a!==void 0&&o.genMorphGeometry(e,t,a,n,r.name)})})}genMorphGeometry(e,t,s,n,o){const i=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],r=s.Vertices!==void 0?s.Vertices.a:[],a=s.Indexes!==void 0?s.Indexes.a:[],h=e.attributes.position.count*3,d=new Float32Array(h);for(let A=0;A<a.length;A++){const b=a[A]*3;d[b]=r[A*3],d[b+1]=r[A*3+1],d[b+2]=r[A*3+2]}const p={vertexIndices:i,vertexPositions:d},m=this.genBuffers(p),g=new l.Float32BufferAttribute(m.vertex,3);g.name=o||s.attrName,g.applyMatrix4(n),e.morphAttributes.position.push(g)}parseNormals(e){const t=e.MappingInformationType,s=e.ReferenceInformationType,n=e.Normals.a;let o=[];return s==="IndexToDirect"&&("NormalIndex"in e?o=e.NormalIndex.a:"NormalsIndex"in e&&(o=e.NormalsIndex.a)),{dataSize:3,buffer:n,indices:o,mappingType:t,referenceType:s}}parseUVs(e){const t=e.MappingInformationType,s=e.ReferenceInformationType,n=e.UV.a;let o=[];return s==="IndexToDirect"&&(o=e.UVIndex.a),{dataSize:2,buffer:n,indices:o,mappingType:t,referenceType:s}}parseVertexColors(e){const t=e.MappingInformationType,s=e.ReferenceInformationType,n=e.Colors.a;let o=[];return s==="IndexToDirect"&&(o=e.ColorIndex.a),{dataSize:4,buffer:n,indices:o,mappingType:t,referenceType:s}}parseMaterialIndices(e){const t=e.MappingInformationType,s=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:s};const n=e.Materials.a,o=[];for(let i=0;i<n.length;++i)o.push(i);return{dataSize:1,buffer:n,indices:o,mappingType:t,referenceType:s}}parseNurbsGeometry(e){if(Us===void 0)return console.error("THREE.FBXLoader: The loader relies on NURBSCurve for any nurbs present in the model. Nurbs will show up as empty geometry."),new l.BufferGeometry;const t=parseInt(e.Order);if(isNaN(t))return console.error("THREE.FBXLoader: Invalid Order %s given for geometry ID: %s",e.Order,e.id),new l.BufferGeometry;const s=t-1,n=e.KnotVector.a,o=[],i=e.Points.a;for(let p=0,m=i.length;p<m;p+=4)o.push(new l.Vector4().fromArray(i,p));let r,a;if(e.Form==="Closed")o.push(o[0]);else if(e.Form==="Periodic"){r=s,a=n.length-1-r;for(let p=0;p<s;++p)o.push(o[p])}const d=new Us(s,n,o,r,a).getPoints(o.length*12);return new l.BufferGeometry().setFromPoints(d)}}class Bo{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const s in t){const n=t[s],o=this.addClip(n);e.push(o)}return e}parseClips(){if(ue.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=ue.Objects.AnimationCurveNode,t=new Map;for(const s in e){const n=e[s];if(n.attrName.match(/S|R|T|DeformPercent/)!==null){const o={id:n.id,attr:n.attrName,curves:{}};t.set(o.id,o)}}return t}parseAnimationCurves(e){const t=ue.Objects.AnimationCurve;for(const s in t){const n={id:t[s].id,times:t[s].KeyTime.a.map(Ro),values:t[s].KeyValueFloat.a},o=Ae.get(n.id);if(o!==void 0){const i=o.parents[0].ID,r=o.parents[0].relationship;r.match(/X/)?e.get(i).curves.x=n:r.match(/Y/)?e.get(i).curves.y=n:r.match(/Z/)?e.get(i).curves.z=n:r.match(/d|DeformPercent/)&&e.has(i)&&(e.get(i).curves.morph=n)}}}parseAnimationLayers(e){const t=ue.Objects.AnimationLayer,s=new Map;for(const n in t){const o=[],i=Ae.get(parseInt(n));i!==void 0&&(i.children.forEach(function(a,h){if(e.has(a.ID)){const d=e.get(a.ID);if(d.curves.x!==void 0||d.curves.y!==void 0||d.curves.z!==void 0){if(o[h]===void 0){const p=Ae.get(a.ID).parents.filter(function(m){return m.relationship!==void 0})[0].ID;if(p!==void 0){const m=ue.Objects.Model[p.toString()];if(m===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",a);return}const g={modelName:m.attrName?l.PropertyBinding.sanitizeNodeName(m.attrName):"",ID:m.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Oe.traverse(function(A){A.ID===m.id&&(g.transform=A.matrix,A.userData.transformData&&(g.eulerOrder=A.userData.transformData.eulerOrder))}),g.transform||(g.transform=new l.Matrix4),"PreRotation"in m&&(g.preRotation=m.PreRotation.value),"PostRotation"in m&&(g.postRotation=m.PostRotation.value),o[h]=g}}o[h]&&(o[h][d.attr]=d)}else if(d.curves.morph!==void 0){if(o[h]===void 0){const p=Ae.get(a.ID).parents.filter(function(M){return M.relationship!==void 0})[0].ID,m=Ae.get(p).parents[0].ID,g=Ae.get(m).parents[0].ID,A=Ae.get(g).parents[0].ID,b=ue.Objects.Model[A],_={modelName:b.attrName?l.PropertyBinding.sanitizeNodeName(b.attrName):"",morphName:ue.Objects.Deformer[p].attrName};o[h]=_}o[h][d.attr]=d}}}),s.set(parseInt(n),o))}return s}parseAnimStacks(e){const t=ue.Objects.AnimationStack,s={};for(const n in t){const o=Ae.get(parseInt(n)).children;o.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const i=e.get(o[0].ID);s[n]={name:t[n].attrName,layer:i}}return s}addClip(e){let t=[];const s=this;return e.layer.forEach(function(n){t=t.concat(s.generateTracks(n))}),new l.AnimationClip(e.name,-1,t)}generateTracks(e){const t=[];let s=new l.Vector3,n=new l.Quaternion,o=new l.Vector3;if(e.transform&&e.transform.decompose(s,n,o),s=s.toArray(),n=new l.Euler().setFromQuaternion(n,e.eulerOrder).toArray(),o=o.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.T.curves,s,"position");i!==void 0&&t.push(i)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const i=this.generateRotationTrack(e.modelName,e.R.curves,n,e.preRotation,e.postRotation,e.eulerOrder);i!==void 0&&t.push(i)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const i=this.generateVectorTrack(e.modelName,e.S.curves,o,"scale");i!==void 0&&t.push(i)}if(e.DeformPercent!==void 0){const i=this.generateMorphTrack(e);i!==void 0&&t.push(i)}return t}generateVectorTrack(e,t,s,n){const o=this.getTimesForAllAxes(t),i=this.getKeyframeTrackValues(o,t,s);return new l.VectorKeyframeTrack(e+"."+n,o,i)}generateRotationTrack(e,t,s,n,o,i){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(l.MathUtils.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(l.MathUtils.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(l.MathUtils.degToRad));const r=this.getTimesForAllAxes(t),a=this.getKeyframeTrackValues(r,t,s);n!==void 0&&(n=n.map(l.MathUtils.degToRad),n.push(i),n=new l.Euler().fromArray(n),n=new l.Quaternion().setFromEuler(n)),o!==void 0&&(o=o.map(l.MathUtils.degToRad),o.push(i),o=new l.Euler().fromArray(o),o=new l.Quaternion().setFromEuler(o).invert());const h=new l.Quaternion,d=new l.Euler,p=[];for(let m=0;m<a.length;m+=3)d.set(a[m],a[m+1],a[m+2],i),h.setFromEuler(d),n!==void 0&&h.premultiply(n),o!==void 0&&h.multiply(o),h.toArray(p,m/3*4);return new l.QuaternionKeyframeTrack(e+".quaternion",r,p)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,s=t.values.map(function(o){return o/100}),n=Oe.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new l.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+n+"]",t.times,s)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(s,n){return s-n}),t.length>1){let s=1,n=t[0];for(let o=1;o<t.length;o++){const i=t[o];i!==n&&(t[s]=i,n=i,s++)}t=t.slice(0,s)}return t}getKeyframeTrackValues(e,t,s){const n=s,o=[];let i=-1,r=-1,a=-1;return e.forEach(function(h){if(t.x&&(i=t.x.times.indexOf(h)),t.y&&(r=t.y.times.indexOf(h)),t.z&&(a=t.z.times.indexOf(h)),i!==-1){const d=t.x.values[i];o.push(d),n[0]=d}else o.push(n[0]);if(r!==-1){const d=t.y.values[r];o.push(d),n[1]=d}else o.push(n[1]);if(a!==-1){const d=t.z.values[a];o.push(d),n[2]=d}else o.push(n[2])}),o}interpolateRotations(e){for(let t=1;t<e.values.length;t++){const s=e.values[t-1],n=e.values[t]-s,o=Math.abs(n);if(o>=180){const i=o/180,r=n/i;let a=s+r;const h=e.times[t-1],p=(e.times[t]-h)/i;let m=h+p;const g=[],A=[];for(;m<e.times[t];)g.push(m),m+=p,A.push(a),a+=r;e.times=js(e.times,t,g),e.values=js(e.values,t,A)}}}}class Uo{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new Vs,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,s=e.split(/[\r\n]+/);return s.forEach(function(n,o){const i=n.match(/^[\s\t]*;/),r=n.match(/^[\s\t]*$/);if(i||r)return;const a=n.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),h=n.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),d=n.match("^\\t{"+(t.currentIndent-1)+"}}");a?t.parseNodeBegin(n,a):h?t.parseNodeProperty(n,h,s[++o]):d?t.popStack():n.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(n)}),this.allNodes}parseNodeBegin(e,t){const s=t[1].trim().replace(/^"/,"").replace(/"$/,""),n=t[2].split(",").map(function(a){return a.trim().replace(/^"/,"").replace(/"$/,"")}),o={name:s},i=this.parseNodeAttr(n),r=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(s,o):s in r?(s==="PoseNode"?r.PoseNode.push(o):r[s].id!==void 0&&(r[s]={},r[s][r[s].id]=r[s]),i.id!==""&&(r[s][i.id]=o)):typeof i.id=="number"?(r[s]={},r[s][i.id]=o):s!=="Properties70"&&(s==="PoseNode"?r[s]=[o]:r[s]=o),typeof i.id=="number"&&(o.id=i.id),i.name!==""&&(o.attrName=i.name),i.type!==""&&(o.attrType=i.type),this.pushStack(o)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let s="",n="";return e.length>1&&(s=e[1].replace(/^(\w+)::/,""),n=e[2]),{id:t,name:s,type:n}}parseNodeProperty(e,t,s){let n=t[1].replace(/^"/,"").replace(/"$/,"").trim(),o=t[2].replace(/^"/,"").replace(/"$/,"").trim();n==="Content"&&o===","&&(o=s.replace(/"/g,"").replace(/,$/,"").trim());const i=this.getCurrentNode();if(i.name==="Properties70"){this.parseNodeSpecialProperty(e,n,o);return}if(n==="C"){const a=o.split(",").slice(1),h=parseInt(a[0]),d=parseInt(a[1]);let p=o.split(",").slice(3);p=p.map(function(m){return m.trim().replace(/^"/,"")}),n="connections",o=[h,d],Eo(o,p),i[n]===void 0&&(i[n]=[])}n==="Node"&&(i.id=o),n in i&&Array.isArray(i[n])?i[n].push(o):n!=="a"?i[n]=o:i.a=o,this.setCurrentProp(i,n),n==="a"&&o.slice(-1)!==","&&(i.a=qt(o))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=qt(t.a))}parseNodeSpecialProperty(e,t,s){const n=s.split('",').map(function(d){return d.trim().replace(/^\"/,"").replace(/\s/,"_")}),o=n[0],i=n[1],r=n[2],a=n[3];let h=n[4];switch(i){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":h=parseFloat(h);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":h=qt(h);break}this.getPrevNode()[o]={type:i,type2:r,flag:a,value:h},this.setCurrentProp(this.getPrevNode(),o)}}class No{parse(e){const t=new Ns(e);t.skip(23);const s=t.getUint32();if(s<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+s);const n=new Vs;for(;!this.endOfContent(t);){const o=this.parseNode(t,s);o!==null&&n.add(o.name,o)}return n}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const s={},n=t>=7500?e.getUint64():e.getUint32(),o=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const i=e.getUint8(),r=e.getString(i);if(n===0)return null;const a=[];for(let m=0;m<o;m++)a.push(this.parseProperty(e));const h=a.length>0?a[0]:"",d=a.length>1?a[1]:"",p=a.length>2?a[2]:"";for(s.singleProperty=o===1&&e.getOffset()===n;n>e.getOffset();){const m=this.parseNode(e,t);m!==null&&this.parseSubNode(r,s,m)}return s.propertyList=a,typeof h=="number"&&(s.id=h),d!==""&&(s.attrName=d),p!==""&&(s.attrType=p),r!==""&&(s.name=r),s}parseSubNode(e,t,s){if(s.singleProperty===!0){const n=s.propertyList[0];Array.isArray(n)?(t[s.name]=s,s.a=n):t[s.name]=n}else if(e==="Connections"&&s.name==="C"){const n=[];s.propertyList.forEach(function(o,i){i!==0&&n.push(o)}),t.connections===void 0&&(t.connections=[]),t.connections.push(n)}else if(s.name==="Properties70")Object.keys(s).forEach(function(o){t[o]=s[o]});else if(e==="Properties70"&&s.name==="P"){let n=s.propertyList[0],o=s.propertyList[1];const i=s.propertyList[2],r=s.propertyList[3];let a;n.indexOf("Lcl ")===0&&(n=n.replace("Lcl ","Lcl_")),o.indexOf("Lcl ")===0&&(o=o.replace("Lcl ","Lcl_")),o==="Color"||o==="ColorRGB"||o==="Vector"||o==="Vector3D"||o.indexOf("Lcl_")===0?a=[s.propertyList[4],s.propertyList[5],s.propertyList[6]]:a=s.propertyList[4],t[n]={type:o,type2:i,flag:r,value:a}}else t[s.name]===void 0?typeof s.id=="number"?(t[s.name]={},t[s.name][s.id]=s):t[s.name]=s:s.name==="PoseNode"?(Array.isArray(t[s.name])||(t[s.name]=[t[s.name]]),t[s.name].push(s)):t[s.name][s.id]===void 0&&(t[s.name][s.id]=s)}parseProperty(e){const t=e.getString(1);let s;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return s=e.getUint32(),e.getArrayBuffer(s);case"S":return s=e.getUint32(),e.getString(s);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const n=e.getUint32(),o=e.getUint32(),i=e.getUint32();if(o===0)switch(t){case"b":case"c":return e.getBooleanArray(n);case"d":return e.getFloat64Array(n);case"f":return e.getFloat32Array(n);case"i":return e.getInt32Array(n);case"l":return e.getInt64Array(n)}const r=Cn(new Uint8Array(e.getArrayBuffer(i))),a=new Ns(r.buffer);switch(t){case"b":case"c":return a.getBooleanArray(n);case"d":return a.getFloat64Array(n);case"f":return a.getFloat32Array(n);case"i":return a.getInt32Array(n);case"l":return a.getInt64Array(n)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Ns{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let s=0;s<e;s++)t.push(this.getBoolean());return t}getUint8(){const e=this.dv.getUint8(this.offset);return this.offset+=1,e}getInt16(){const e=this.dv.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}getInt32(){const e=this.dv.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}getInt32Array(e){const t=[];for(let s=0;s<e;s++)t.push(this.getInt32());return t}getUint32(){const e=this.dv.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}getInt64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t&2147483648?(t=~t&4294967295,e=~e&4294967295,e===4294967295&&(t=t+1&4294967295),e=e+1&4294967295,-(t*4294967296+e)):t*4294967296+e}getInt64Array(e){const t=[];for(let s=0;s<e;s++)t.push(this.getInt64());return t}getUint64(){let e,t;return this.littleEndian?(e=this.getUint32(),t=this.getUint32()):(t=this.getUint32(),e=this.getUint32()),t*4294967296+e}getFloat32(){const e=this.dv.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}getFloat32Array(e){const t=[];for(let s=0;s<e;s++)t.push(this.getFloat32());return t}getFloat64(){const e=this.dv.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}getFloat64Array(e){const t=[];for(let s=0;s<e;s++)t.push(this.getFloat64());return t}getArrayBuffer(e){const t=this.dv.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}getString(e){let t=[];for(let n=0;n<e;n++)t[n]=this.getUint8();const s=t.indexOf(0);return s>=0&&(t=t.slice(0,s)),l.LoaderUtils.decodeText(new Uint8Array(t))}}class Vs{add(e,t){this[e]=t}}function Vo(c){const e="Kaydara FBX Binary \0";return c.byteLength>=e.length&&e===Es(c,0,e.length)}function zo(c){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function s(n){const o=c[n-1];return c=c.slice(t+n),t++,o}for(let n=0;n<e.length;++n)if(s(1)===e[n])return!1;return!0}function zs(c){const e=/FBXVersion: (\d+)/,t=c.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Ro(c){return c/46186158e3}const Go=[];function Lt(c,e,t,s){let n;switch(s.mappingType){case"ByPolygonVertex":n=c;break;case"ByPolygon":n=e;break;case"ByVertice":n=t;break;case"AllSame":n=s.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+s.mappingType)}s.referenceType==="IndexToDirect"&&(n=s.indices[n]);const o=n*s.dataSize,i=o+s.dataSize;return jo(Go,s.buffer,o,i)}const Wt=new l.Euler,ut=new l.Vector3;function Rs(c){const e=new l.Matrix4,t=new l.Matrix4,s=new l.Matrix4,n=new l.Matrix4,o=new l.Matrix4,i=new l.Matrix4,r=new l.Matrix4,a=new l.Matrix4,h=new l.Matrix4,d=new l.Matrix4,p=new l.Matrix4,m=new l.Matrix4,g=c.inheritType?c.inheritType:0;if(c.translation&&e.setPosition(ut.fromArray(c.translation)),c.preRotation){const z=c.preRotation.map(l.MathUtils.degToRad);z.push(c.eulerOrder),t.makeRotationFromEuler(Wt.fromArray(z))}if(c.rotation){const z=c.rotation.map(l.MathUtils.degToRad);z.push(c.eulerOrder),s.makeRotationFromEuler(Wt.fromArray(z))}if(c.postRotation){const z=c.postRotation.map(l.MathUtils.degToRad);z.push(c.eulerOrder),n.makeRotationFromEuler(Wt.fromArray(z)),n.invert()}c.scale&&o.scale(ut.fromArray(c.scale)),c.scalingOffset&&r.setPosition(ut.fromArray(c.scalingOffset)),c.scalingPivot&&i.setPosition(ut.fromArray(c.scalingPivot)),c.rotationOffset&&a.setPosition(ut.fromArray(c.rotationOffset)),c.rotationPivot&&h.setPosition(ut.fromArray(c.rotationPivot)),c.parentMatrixWorld&&(p.copy(c.parentMatrix),d.copy(c.parentMatrixWorld));const A=t.clone().multiply(s).multiply(n),b=new l.Matrix4;b.extractRotation(d);const _=new l.Matrix4;_.copyPosition(d);const M=_.clone().invert().multiply(d),L=b.clone().invert().multiply(M),w=o,y=new l.Matrix4;if(g===0)y.copy(b).multiply(A).multiply(L).multiply(w);else if(g===1)y.copy(b).multiply(L).multiply(A).multiply(w);else{const U=new l.Matrix4().scale(new l.Vector3().setFromMatrixScale(p)).clone().invert(),R=L.clone().multiply(U);y.copy(b).multiply(A).multiply(R).multiply(w)}const C=h.clone().invert(),T=i.clone().invert();let x=e.clone().multiply(a).multiply(h).multiply(t).multiply(s).multiply(n).multiply(C).multiply(r).multiply(i).multiply(o).multiply(T);const v=new l.Matrix4().copyPosition(x),D=d.clone().multiply(v);return m.copyPosition(D),x=m.clone().multiply(y),x.premultiply(d.invert()),x}function Gs(c){c=c||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return c===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[c]}function qt(c){return c.split(",").map(function(t){return parseFloat(t)})}function Es(c,e,t){return e===void 0&&(e=0),t===void 0&&(t=c.byteLength),l.LoaderUtils.decodeText(new Uint8Array(c,e,t))}function Eo(c,e){for(let t=0,s=c.length,n=e.length;t<n;t++,s++)c[s]=e[t]}function jo(c,e,t,s){for(let n=t,o=0;n<s;n++,o++)c[o]=e[n];return c}function js(c,e,t){return c.slice(0,e).concat(t).concat(c.slice(e))}var Yo=Object.defineProperty,Xo=(c,e,t)=>e in c?Yo(c,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):c[e]=t,Jt=(c,e,t)=>(Xo(c,typeof e!="symbol"?e+"":e,t),t);class Zo extends l.Loader{constructor(e){super(e)}load(e,t,s,n){const o=new l.FileLoader(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,i=>{if(typeof i!="string")throw new Error("unsupported data type");const r=JSON.parse(i),a=this.parse(r);t&&t(a)},s,n)}loadAsync(e,t){return super.loadAsync(e,t)}parse(e){return new Ht(e)}}class Ht{constructor(e){Jt(this,"data"),this.data=e}generateShapes(e,t=100,s){const n=[],o={letterSpacing:0,lineHeight:1,...s},i=Qo(e,t,this.data,o);for(let r=0,a=i.length;r<a;r++)Array.prototype.push.apply(n,i[r].toShapes(!1));return n}}Jt(Ht,"isFont"),Jt(Ht,"type");function Qo(c,e,t,s){const n=Array.from(c),o=e/t.resolution,i=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*o,r=[];let a=0,h=0;for(let d=0;d<n.length;d++){const p=n[d];if(p===`
|
|
74
|
+
`)a=0,h-=i*s.lineHeight;else{const m=Ko(p,o,a,h,t);m&&(a+=m.offsetX+s.letterSpacing,r.push(m.path))}}return r}function Ko(c,e,t,s,n){const o=n.glyphs[c]||n.glyphs["?"];if(!o){console.error('THREE.Font: character "'+c+'" does not exists in font family '+n.familyName+".");return}const i=new l.ShapePath;let r,a,h,d,p,m,g,A;if(o.o){const b=o._cachedOutline||(o._cachedOutline=o.o.split(" "));for(let _=0,M=b.length;_<M;)switch(b[_++]){case"m":r=parseInt(b[_++])*e+t,a=parseInt(b[_++])*e+s,i.moveTo(r,a);break;case"l":r=parseInt(b[_++])*e+t,a=parseInt(b[_++])*e+s,i.lineTo(r,a);break;case"q":h=parseInt(b[_++])*e+t,d=parseInt(b[_++])*e+s,p=parseInt(b[_++])*e+t,m=parseInt(b[_++])*e+s,i.quadraticCurveTo(p,m,h,d);break;case"b":h=parseInt(b[_++])*e+t,d=parseInt(b[_++])*e+s,p=parseInt(b[_++])*e+t,m=parseInt(b[_++])*e+s,g=parseInt(b[_++])*e+t,A=parseInt(b[_++])*e+s,i.bezierCurveTo(p,m,g,A,h,d);break}}return{offsetX:o.ha*e,path:i}}var Wo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function qo(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}class Jo extends l.DataTextureLoader{constructor(e){super(e),this.type=l.HalfFloatType}parse(e){const r=function(w,y){switch(w){case 1:console.error("THREE.RGBELoader Read Error: "+(y||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(y||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(y||""));break;default:case 4:console.error("THREE.RGBELoader: Error: "+(y||""))}return-1},p=`
|
|
75
|
+
`,m=function(w,y,C){y=y||1024;let x=w.pos,v=-1,D=0,z="",U=String.fromCharCode.apply(null,new Uint16Array(w.subarray(x,x+128)));for(;0>(v=U.indexOf(p))&&D<y&&x<w.byteLength;)z+=U,D+=U.length,x+=128,U+=String.fromCharCode.apply(null,new Uint16Array(w.subarray(x,x+128)));return-1<v?(C!==!1&&(w.pos+=D+v+1),z+U.slice(0,v)):!1},g=function(w){const y=/^#\?(\S+)/,C=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,T=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,x=/^\s*FORMAT=(\S+)\s*$/,v=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,D={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let z,U;if(w.pos>=w.byteLength||!(z=m(w)))return r(1,"no header found");if(!(U=z.match(y)))return r(3,"bad initial token");for(D.valid|=1,D.programtype=U[1],D.string+=z+`
|
|
76
|
+
`;z=m(w),z!==!1;){if(D.string+=z+`
|
|
77
|
+
`,z.charAt(0)==="#"){D.comments+=z+`
|
|
78
|
+
`;continue}if((U=z.match(C))&&(D.gamma=parseFloat(U[1])),(U=z.match(T))&&(D.exposure=parseFloat(U[1])),(U=z.match(x))&&(D.valid|=2,D.format=U[1]),(U=z.match(v))&&(D.valid|=4,D.height=parseInt(U[1],10),D.width=parseInt(U[2],10)),D.valid&2&&D.valid&4)break}return D.valid&2?D.valid&4?D:r(3,"missing image size specifier"):r(3,"missing format specifier")},A=function(w,y,C){const T=y;if(T<8||T>32767||w[0]!==2||w[1]!==2||w[2]&128)return new Uint8Array(w);if(T!==(w[2]<<8|w[3]))return r(3,"wrong scanline width");const x=new Uint8Array(4*y*C);if(!x.length)return r(4,"unable to allocate buffer space");let v=0,D=0;const z=4*T,U=new Uint8Array(4),R=new Uint8Array(z);let K=C;for(;K>0&&D<w.byteLength;){if(D+4>w.byteLength)return r(1);if(U[0]=w[D++],U[1]=w[D++],U[2]=w[D++],U[3]=w[D++],U[0]!=2||U[1]!=2||(U[2]<<8|U[3])!=T)return r(3,"bad rgbe scanline format");let J=0,Q;for(;J<z&&D<w.byteLength;){Q=w[D++];const Z=Q>128;if(Z&&(Q-=128),Q===0||J+Q>z)return r(3,"bad scanline data");if(Z){const G=w[D++];for(let ce=0;ce<Q;ce++)R[J++]=G}else R.set(w.subarray(D,D+Q),J),J+=Q,D+=Q}const pe=T;for(let Z=0;Z<pe;Z++){let G=0;x[v]=R[Z+G],G+=T,x[v+1]=R[Z+G],G+=T,x[v+2]=R[Z+G],G+=T,x[v+3]=R[Z+G],v+=4}K--}return x},b=function(w,y,C,T){const x=w[y+3],v=Math.pow(2,x-128)/255;C[T+0]=w[y+0]*v,C[T+1]=w[y+1]*v,C[T+2]=w[y+2]*v,C[T+3]=1},_=function(w,y,C,T){const x=w[y+3],v=Math.pow(2,x-128)/255;C[T+0]=l.DataUtils.toHalfFloat(Math.min(w[y+0]*v,65504)),C[T+1]=l.DataUtils.toHalfFloat(Math.min(w[y+1]*v,65504)),C[T+2]=l.DataUtils.toHalfFloat(Math.min(w[y+2]*v,65504)),C[T+3]=l.DataUtils.toHalfFloat(1)},M=new Uint8Array(e);M.pos=0;const L=g(M);if(L!==-1){const w=L.width,y=L.height,C=A(M.subarray(M.pos),w,y);if(C!==-1){let T,x,v;switch(this.type){case l.FloatType:v=C.length/4;const D=new Float32Array(v*4);for(let U=0;U<v;U++)b(C,U*4,D,U*4);T=D,x=l.FloatType;break;case l.HalfFloatType:v=C.length/4;const z=new Uint16Array(v*4);for(let U=0;U<v;U++)_(C,U*4,z,U*4);T=z,x=l.HalfFloatType;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type);break}return{width:w,height:y,data:T,header:L.string,gamma:L.gamma,exposure:L.exposure,type:x}}}return null}setDataType(e){return this.type=e,this}load(e,t,s,n){function o(i,r){switch(i.type){case l.FloatType:case l.HalfFloatType:"colorSpace"in i?i.colorSpace="srgb-linear":i.encoding=3e3,i.minFilter=l.LinearFilter,i.magFilter=l.LinearFilter,i.generateMipmaps=!1,i.flipY=!0;break}t&&t(i,r)}return super.load(e,o,s,n)}}class wt extends l.Loader{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit="px"}load(e,t,s,n){const o=this,i=new l.FileLoader(o.manager);i.setPath(o.path),i.setRequestHeader(o.requestHeader),i.setWithCredentials(o.withCredentials),i.load(e,function(r){try{t(o.parse(r))}catch(a){n?n(a):console.error(a),o.manager.itemError(e)}},s,n)}parse(e){const t=this;function s(B,I){if(B.nodeType!==1)return;const f=y(B);let k=!0,E=null;switch(B.nodeName){case"svg":break;case"style":o(B);break;case"g":I=A(B,I);break;case"path":I=A(B,I),B.hasAttribute("d")&&(E=n(B));break;case"rect":I=A(B,I),E=a(B);break;case"polygon":I=A(B,I),E=h(B);break;case"polyline":I=A(B,I),E=d(B);break;case"circle":I=A(B,I),E=p(B);break;case"ellipse":I=A(B,I),E=m(B);break;case"line":I=A(B,I),E=g(B);break;case"defs":k=!1;break;case"mask":k=!1;break;case"use":I=A(B,I);const P=B.href.baseVal.substring(1),j=B.viewportElement.getElementById(P);j?s(j,I):console.warn("SVGLoader: 'use node' references non-existent node id: "+P);break}if(E&&(I.fill!==void 0&&I.fill!=="none"&&E.color.setStyle(I.fill),T(E,ce),z.push(E),E.userData={node:B,style:I}),k){const P=B.childNodes;for(let j=0;j<P.length;j++)s(P[j],I)}f&&(R.pop(),R.length>0?ce.copy(R[R.length-1]):ce.identity())}function n(B){const I=new l.ShapePath,f=new l.Vector2,k=new l.Vector2,E=new l.Vector2;let P=!0,j=!1;const ee=B.getAttribute("d").match(/[a-df-z][^a-df-z]*/gi);for(let te=0,W=ee.length;te<W;te++){const me=ee[te],X=me.charAt(0),q=me.substr(1).trim();P===!0&&(j=!0,P=!1);let O;switch(X){case"M":O=_(q);for(let S=0,H=O.length;S<H;S+=2)f.x=O[S+0],f.y=O[S+1],k.x=f.x,k.y=f.y,S===0?I.moveTo(f.x,f.y):I.lineTo(f.x,f.y),S===0&&E.copy(f);break;case"H":O=_(q);for(let S=0,H=O.length;S<H;S++)f.x=O[S],k.x=f.x,k.y=f.y,I.lineTo(f.x,f.y),S===0&&j===!0&&E.copy(f);break;case"V":O=_(q);for(let S=0,H=O.length;S<H;S++)f.y=O[S],k.x=f.x,k.y=f.y,I.lineTo(f.x,f.y),S===0&&j===!0&&E.copy(f);break;case"L":O=_(q);for(let S=0,H=O.length;S<H;S+=2)f.x=O[S+0],f.y=O[S+1],k.x=f.x,k.y=f.y,I.lineTo(f.x,f.y),S===0&&j===!0&&E.copy(f);break;case"C":O=_(q);for(let S=0,H=O.length;S<H;S+=6)I.bezierCurveTo(O[S+0],O[S+1],O[S+2],O[S+3],O[S+4],O[S+5]),k.x=O[S+2],k.y=O[S+3],f.x=O[S+4],f.y=O[S+5],S===0&&j===!0&&E.copy(f);break;case"S":O=_(q);for(let S=0,H=O.length;S<H;S+=4)I.bezierCurveTo(b(f.x,k.x),b(f.y,k.y),O[S+0],O[S+1],O[S+2],O[S+3]),k.x=O[S+0],k.y=O[S+1],f.x=O[S+2],f.y=O[S+3],S===0&&j===!0&&E.copy(f);break;case"Q":O=_(q);for(let S=0,H=O.length;S<H;S+=4)I.quadraticCurveTo(O[S+0],O[S+1],O[S+2],O[S+3]),k.x=O[S+0],k.y=O[S+1],f.x=O[S+2],f.y=O[S+3],S===0&&j===!0&&E.copy(f);break;case"T":O=_(q);for(let S=0,H=O.length;S<H;S+=2){const de=b(f.x,k.x),ve=b(f.y,k.y);I.quadraticCurveTo(de,ve,O[S+0],O[S+1]),k.x=de,k.y=ve,f.x=O[S+0],f.y=O[S+1],S===0&&j===!0&&E.copy(f)}break;case"A":O=_(q,[3,4],7);for(let S=0,H=O.length;S<H;S+=7){if(O[S+5]==f.x&&O[S+6]==f.y)continue;const de=f.clone();f.x=O[S+5],f.y=O[S+6],k.x=f.x,k.y=f.y,i(I,O[S],O[S+1],O[S+2],O[S+3],O[S+4],de,f),S===0&&j===!0&&E.copy(f)}break;case"m":O=_(q);for(let S=0,H=O.length;S<H;S+=2)f.x+=O[S+0],f.y+=O[S+1],k.x=f.x,k.y=f.y,S===0?I.moveTo(f.x,f.y):I.lineTo(f.x,f.y),S===0&&E.copy(f);break;case"h":O=_(q);for(let S=0,H=O.length;S<H;S++)f.x+=O[S],k.x=f.x,k.y=f.y,I.lineTo(f.x,f.y),S===0&&j===!0&&E.copy(f);break;case"v":O=_(q);for(let S=0,H=O.length;S<H;S++)f.y+=O[S],k.x=f.x,k.y=f.y,I.lineTo(f.x,f.y),S===0&&j===!0&&E.copy(f);break;case"l":O=_(q);for(let S=0,H=O.length;S<H;S+=2)f.x+=O[S+0],f.y+=O[S+1],k.x=f.x,k.y=f.y,I.lineTo(f.x,f.y),S===0&&j===!0&&E.copy(f);break;case"c":O=_(q);for(let S=0,H=O.length;S<H;S+=6)I.bezierCurveTo(f.x+O[S+0],f.y+O[S+1],f.x+O[S+2],f.y+O[S+3],f.x+O[S+4],f.y+O[S+5]),k.x=f.x+O[S+2],k.y=f.y+O[S+3],f.x+=O[S+4],f.y+=O[S+5],S===0&&j===!0&&E.copy(f);break;case"s":O=_(q);for(let S=0,H=O.length;S<H;S+=4)I.bezierCurveTo(b(f.x,k.x),b(f.y,k.y),f.x+O[S+0],f.y+O[S+1],f.x+O[S+2],f.y+O[S+3]),k.x=f.x+O[S+0],k.y=f.y+O[S+1],f.x+=O[S+2],f.y+=O[S+3],S===0&&j===!0&&E.copy(f);break;case"q":O=_(q);for(let S=0,H=O.length;S<H;S+=4)I.quadraticCurveTo(f.x+O[S+0],f.y+O[S+1],f.x+O[S+2],f.y+O[S+3]),k.x=f.x+O[S+0],k.y=f.y+O[S+1],f.x+=O[S+2],f.y+=O[S+3],S===0&&j===!0&&E.copy(f);break;case"t":O=_(q);for(let S=0,H=O.length;S<H;S+=2){const de=b(f.x,k.x),ve=b(f.y,k.y);I.quadraticCurveTo(de,ve,f.x+O[S+0],f.y+O[S+1]),k.x=de,k.y=ve,f.x=f.x+O[S+0],f.y=f.y+O[S+1],S===0&&j===!0&&E.copy(f)}break;case"a":O=_(q,[3,4],7);for(let S=0,H=O.length;S<H;S+=7){if(O[S+5]==0&&O[S+6]==0)continue;const de=f.clone();f.x+=O[S+5],f.y+=O[S+6],k.x=f.x,k.y=f.y,i(I,O[S],O[S+1],O[S+2],O[S+3],O[S+4],de,f),S===0&&j===!0&&E.copy(f)}break;case"Z":case"z":I.currentPath.autoClose=!0,I.currentPath.curves.length>0&&(f.copy(E),I.currentPath.currentPoint.copy(f),P=!0);break;default:console.warn(me)}j=!1}return I}function o(B){if(!(!B.sheet||!B.sheet.cssRules||!B.sheet.cssRules.length))for(let I=0;I<B.sheet.cssRules.length;I++){const f=B.sheet.cssRules[I];if(f.type!==1)continue;const k=f.selectorText.split(/,/gm).filter(Boolean).map(E=>E.trim());for(let E=0;E<k.length;E++)U[k[E]]=Object.assign(U[k[E]]||{},f.style)}}function i(B,I,f,k,E,P,j,oe){if(I==0||f==0){B.lineTo(oe.x,oe.y);return}k=k*Math.PI/180,I=Math.abs(I),f=Math.abs(f);const ee=(j.x-oe.x)/2,te=(j.y-oe.y)/2,W=Math.cos(k)*ee+Math.sin(k)*te,me=-Math.sin(k)*ee+Math.cos(k)*te;let X=I*I,q=f*f;const O=W*W,S=me*me,H=O/X+S/q;if(H>1){const Vt=Math.sqrt(H);I=Vt*I,f=Vt*f,X=I*I,q=f*f}const de=X*S+q*O,ve=(X*q-de)/de;let Ce=Math.sqrt(Math.max(0,ve));E===P&&(Ce=-Ce);const Ue=Ce*I*me/f,He=-Ce*f*W/I,Ct=Math.cos(k)*Ue-Math.sin(k)*He+(j.x+oe.x)/2,gs=Math.sin(k)*Ue+Math.cos(k)*He+(j.y+oe.y)/2,Ut=r(1,0,(W-Ue)/I,(me-He)/f),Nt=r((W-Ue)/I,(me-He)/f,(-W-Ue)/I,(-me-He)/f)%(Math.PI*2);B.currentPath.absellipse(Ct,gs,I,f,Ut,Ut+Nt,P===0,k)}function r(B,I,f,k){const E=B*f+I*k,P=Math.sqrt(B*B+I*I)*Math.sqrt(f*f+k*k);let j=Math.acos(Math.max(-1,Math.min(1,E/P)));return B*k-I*f<0&&(j=-j),j}function a(B){const I=w(B.getAttribute("x")||0),f=w(B.getAttribute("y")||0),k=w(B.getAttribute("rx")||B.getAttribute("ry")||0),E=w(B.getAttribute("ry")||B.getAttribute("rx")||0),P=w(B.getAttribute("width")),j=w(B.getAttribute("height")),oe=1-.551915024494,ee=new l.ShapePath;return ee.moveTo(I+k,f),ee.lineTo(I+P-k,f),(k!==0||E!==0)&&ee.bezierCurveTo(I+P-k*oe,f,I+P,f+E*oe,I+P,f+E),ee.lineTo(I+P,f+j-E),(k!==0||E!==0)&&ee.bezierCurveTo(I+P,f+j-E*oe,I+P-k*oe,f+j,I+P-k,f+j),ee.lineTo(I+k,f+j),(k!==0||E!==0)&&ee.bezierCurveTo(I+k*oe,f+j,I,f+j-E*oe,I,f+j-E),ee.lineTo(I,f+E),(k!==0||E!==0)&&ee.bezierCurveTo(I,f+E*oe,I+k*oe,f,I+k,f),ee}function h(B){function I(P,j,oe){const ee=w(j),te=w(oe);E===0?k.moveTo(ee,te):k.lineTo(ee,te),E++}const f=/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,k=new l.ShapePath;let E=0;return B.getAttribute("points").replace(f,I),k.currentPath.autoClose=!0,k}function d(B){function I(P,j,oe){const ee=w(j),te=w(oe);E===0?k.moveTo(ee,te):k.lineTo(ee,te),E++}const f=/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,k=new l.ShapePath;let E=0;return B.getAttribute("points").replace(f,I),k.currentPath.autoClose=!1,k}function p(B){const I=w(B.getAttribute("cx")||0),f=w(B.getAttribute("cy")||0),k=w(B.getAttribute("r")||0),E=new l.Path;E.absarc(I,f,k,0,Math.PI*2);const P=new l.ShapePath;return P.subPaths.push(E),P}function m(B){const I=w(B.getAttribute("cx")||0),f=w(B.getAttribute("cy")||0),k=w(B.getAttribute("rx")||0),E=w(B.getAttribute("ry")||0),P=new l.Path;P.absellipse(I,f,k,E,0,Math.PI*2);const j=new l.ShapePath;return j.subPaths.push(P),j}function g(B){const I=w(B.getAttribute("x1")||0),f=w(B.getAttribute("y1")||0),k=w(B.getAttribute("x2")||0),E=w(B.getAttribute("y2")||0),P=new l.ShapePath;return P.moveTo(I,f),P.lineTo(k,E),P.currentPath.autoClose=!1,P}function A(B,I){I=Object.assign({},I);let f={};if(B.hasAttribute("class")){const j=B.getAttribute("class").split(/\s/).filter(Boolean).map(oe=>oe.trim());for(let oe=0;oe<j.length;oe++)f=Object.assign(f,U["."+j[oe]])}B.hasAttribute("id")&&(f=Object.assign(f,U["#"+B.getAttribute("id")]));function k(j,oe,ee){ee===void 0&&(ee=function(W){return W.startsWith("url")&&console.warn("SVGLoader: url access in attributes is not implemented."),W}),B.hasAttribute(j)&&(I[oe]=ee(B.getAttribute(j))),f[j]&&(I[oe]=ee(f[j])),B.style&&B.style[j]!==""&&(I[oe]=ee(B.style[j]))}function E(j){return Math.max(0,Math.min(1,w(j)))}function P(j){return Math.max(0,w(j))}return k("fill","fill"),k("fill-opacity","fillOpacity",E),k("fill-rule","fillRule"),k("opacity","opacity",E),k("stroke","stroke"),k("stroke-opacity","strokeOpacity",E),k("stroke-width","strokeWidth",P),k("stroke-linejoin","strokeLineJoin"),k("stroke-linecap","strokeLineCap"),k("stroke-miterlimit","strokeMiterLimit",P),k("visibility","visibility"),I}function b(B,I){return B-(I-B)}function _(B,I,f){if(typeof B!="string")throw new TypeError("Invalid input: "+typeof B);const k={SEPARATOR:/[ \t\r\n\,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},E=0,P=1,j=2,oe=3;let ee=E,te=!0,W="",me="";const X=[];function q(de,ve,Ce){const Ue=new SyntaxError('Unexpected character "'+de+'" at index '+ve+".");throw Ue.partial=Ce,Ue}function O(){W!==""&&(me===""?X.push(Number(W)):X.push(Number(W)*Math.pow(10,Number(me)))),W="",me=""}let S;const H=B.length;for(let de=0;de<H;de++){if(S=B[de],Array.isArray(I)&&I.includes(X.length%f)&&k.FLAGS.test(S)){ee=P,W=S,O();continue}if(ee===E){if(k.WHITESPACE.test(S))continue;if(k.DIGIT.test(S)||k.SIGN.test(S)){ee=P,W=S;continue}if(k.POINT.test(S)){ee=j,W=S;continue}k.COMMA.test(S)&&(te&&q(S,de,X),te=!0)}if(ee===P){if(k.DIGIT.test(S)){W+=S;continue}if(k.POINT.test(S)){W+=S,ee=j;continue}if(k.EXP.test(S)){ee=oe;continue}k.SIGN.test(S)&&W.length===1&&k.SIGN.test(W[0])&&q(S,de,X)}if(ee===j){if(k.DIGIT.test(S)){W+=S;continue}if(k.EXP.test(S)){ee=oe;continue}k.POINT.test(S)&&W[W.length-1]==="."&&q(S,de,X)}if(ee===oe){if(k.DIGIT.test(S)){me+=S;continue}if(k.SIGN.test(S)){if(me===""){me+=S;continue}me.length===1&&k.SIGN.test(me)&&q(S,de,X)}}k.WHITESPACE.test(S)?(O(),ee=E,te=!1):k.COMMA.test(S)?(O(),ee=E,te=!0):k.SIGN.test(S)?(O(),ee=P,W=S):k.POINT.test(S)?(O(),ee=j,W=S):q(S,de,X)}return O(),X}const M=["mm","cm","in","pt","pc","px"],L={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function w(B){let I="px";if(typeof B=="string"||B instanceof String)for(let k=0,E=M.length;k<E;k++){const P=M[k];if(B.endsWith(P)){I=P,B=B.substring(0,B.length-P.length);break}}let f;return I==="px"&&t.defaultUnit!=="px"?f=L.in[t.defaultUnit]/t.defaultDPI:(f=L[I][t.defaultUnit],f<0&&(f=L[I].in*t.defaultDPI)),f*parseFloat(B)}function y(B){if(!(B.hasAttribute("transform")||B.nodeName==="use"&&(B.hasAttribute("x")||B.hasAttribute("y"))))return null;const I=C(B);return R.length>0&&I.premultiply(R[R.length-1]),ce.copy(I),R.push(I),I}function C(B){const I=new l.Matrix3,f=K;if(B.nodeName==="use"&&(B.hasAttribute("x")||B.hasAttribute("y"))){const k=w(B.getAttribute("x")),E=w(B.getAttribute("y"));I.translate(k,E)}if(B.hasAttribute("transform")){const k=B.getAttribute("transform").split(")");for(let E=k.length-1;E>=0;E--){const P=k[E].trim();if(P==="")continue;const j=P.indexOf("("),oe=P.length;if(j>0&&j<oe){const ee=P.substr(0,j),te=_(P.substr(j+1,oe-j-1));switch(f.identity(),ee){case"translate":if(te.length>=1){const W=te[0];let me=W;te.length>=2&&(me=te[1]),f.translate(W,me)}break;case"rotate":if(te.length>=1){let W=0,me=0,X=0;W=-te[0]*Math.PI/180,te.length>=3&&(me=te[1],X=te[2]),J.identity().translate(-me,-X),Q.identity().rotate(W),pe.multiplyMatrices(Q,J),J.identity().translate(me,X),f.multiplyMatrices(J,pe)}break;case"scale":if(te.length>=1){const W=te[0];let me=W;te.length>=2&&(me=te[1]),f.scale(W,me)}break;case"skewX":te.length===1&&f.set(1,Math.tan(te[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":te.length===1&&f.set(1,0,0,Math.tan(te[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":te.length===6&&f.set(te[0],te[2],te[4],te[1],te[3],te[5],0,0,1);break}}I.premultiply(f)}}return I}function T(B,I){function f(P){G.set(P.x,P.y,1).applyMatrix3(I),P.set(G.x,G.y)}const k=x(I),E=B.subPaths;for(let P=0,j=E.length;P<j;P++){const ee=E[P].curves;for(let te=0;te<ee.length;te++){const W=ee[te];W.isLineCurve?(f(W.v1),f(W.v2)):W.isCubicBezierCurve?(f(W.v0),f(W.v1),f(W.v2),f(W.v3)):W.isQuadraticBezierCurve?(f(W.v0),f(W.v1),f(W.v2)):W.isEllipseCurve&&(k&&console.warn("SVGLoader: Elliptic arc or ellipse rotation or skewing is not implemented."),Z.set(W.aX,W.aY),f(Z),W.aX=Z.x,W.aY=Z.y,W.xRadius*=v(I),W.yRadius*=D(I))}}}function x(B){return B.elements[1]!==0||B.elements[3]!==0}function v(B){const I=B.elements;return Math.sqrt(I[0]*I[0]+I[1]*I[1])}function D(B){const I=B.elements;return Math.sqrt(I[3]*I[3]+I[4]*I[4])}const z=[],U={},R=[],K=new l.Matrix3,J=new l.Matrix3,Q=new l.Matrix3,pe=new l.Matrix3,Z=new l.Vector2,G=new l.Vector3,ce=new l.Matrix3,se=new DOMParser().parseFromString(e,"image/svg+xml");return s(se.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4}),{paths:z,xml:se.documentElement}}static createShapes(e){const s={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},n={loc:s.ORIGIN,t:0};function o(_,M,L,w){const y=_.x,C=M.x,T=L.x,x=w.x,v=_.y,D=M.y,z=L.y,U=w.y,R=(x-T)*(v-z)-(U-z)*(y-T),K=(C-y)*(v-z)-(D-v)*(y-T),J=(U-z)*(C-y)-(x-T)*(D-v),Q=R/J,pe=K/J;if(J===0&&R!==0||Q<=0||Q>=1||pe<0||pe>1)return null;if(R===0&&J===0){for(let Z=0;Z<2;Z++)if(i(Z===0?L:w,_,M),n.loc==s.ORIGIN){const G=Z===0?L:w;return{x:G.x,y:G.y,t:n.t}}else if(n.loc==s.BETWEEN){const G=+(y+n.t*(C-y)).toPrecision(10),ce=+(v+n.t*(D-v)).toPrecision(10);return{x:G,y:ce,t:n.t}}return null}else{for(let ce=0;ce<2;ce++)if(i(ce===0?L:w,_,M),n.loc==s.ORIGIN){const se=ce===0?L:w;return{x:se.x,y:se.y,t:n.t}}const Z=+(y+Q*(C-y)).toPrecision(10),G=+(v+Q*(D-v)).toPrecision(10);return{x:Z,y:G,t:Q}}}function i(_,M,L){const w=L.x-M.x,y=L.y-M.y,C=_.x-M.x,T=_.y-M.y,x=w*T-C*y;if(_.x===M.x&&_.y===M.y){n.loc=s.ORIGIN,n.t=0;return}if(_.x===L.x&&_.y===L.y){n.loc=s.DESTINATION,n.t=1;return}if(x<-Number.EPSILON){n.loc=s.LEFT;return}if(x>Number.EPSILON){n.loc=s.RIGHT;return}if(w*C<0||y*T<0){n.loc=s.BEHIND;return}if(Math.sqrt(w*w+y*y)<Math.sqrt(C*C+T*T)){n.loc=s.BEYOND;return}let v;w!==0?v=C/w:v=T/y,n.loc=s.BETWEEN,n.t=v}function r(_,M){const L=[],w=[];for(let y=1;y<_.length;y++){const C=_[y-1],T=_[y];for(let x=1;x<M.length;x++){const v=M[x-1],D=M[x],z=o(C,T,v,D);z!==null&&L.find(U=>U.t<=z.t+Number.EPSILON&&U.t>=z.t-Number.EPSILON)===void 0&&(L.push(z),w.push(new l.Vector2(z.x,z.y)))}}return w}function a(_,M,L){const w=new l.Vector2;M.getCenter(w);const y=[];return L.forEach(C=>{C.boundingBox.containsPoint(w)&&r(_,C.points).forEach(x=>{y.push({identifier:C.identifier,isCW:C.isCW,point:x})})}),y.sort((C,T)=>C.point.x-T.point.x),y}function h(_,M,L,w,y){(y==null||y==="")&&(y="nonzero");const C=new l.Vector2;_.boundingBox.getCenter(C);const T=[new l.Vector2(L,C.y),new l.Vector2(w,C.y)],x=a(T,_.boundingBox,M);x.sort((K,J)=>K.point.x-J.point.x);const v=[],D=[];x.forEach(K=>{K.identifier===_.identifier?v.push(K):D.push(K)});const z=v[0].point.x,U=[];let R=0;for(;R<D.length&&D[R].point.x<z;)U.length>0&&U[U.length-1]===D[R].identifier?U.pop():U.push(D[R].identifier),R++;if(U.push(_.identifier),y==="evenodd"){const K=U.length%2===0,J=U[U.length-2];return{identifier:_.identifier,isHole:K,for:J}}else if(y==="nonzero"){let K=!0,J=null,Q=null;for(let pe=0;pe<U.length;pe++){const Z=U[pe];K?(Q=M[Z].isCW,K=!1,J=Z):Q!==M[Z].isCW&&(Q=M[Z].isCW,K=!0)}return{identifier:_.identifier,isHole:K,for:J}}else console.warn('fill-rule: "'+y+'" is currently not implemented.')}let d=0,p=999999999,m=-999999999,g=e.subPaths.map(_=>{const M=_.getPoints();let L=-999999999,w=999999999,y=-999999999,C=999999999;for(let T=0;T<M.length;T++){const x=M[T];x.y>L&&(L=x.y),x.y<w&&(w=x.y),x.x>y&&(y=x.x),x.x<C&&(C=x.x)}return m<=y&&(m=y+1),p>=C&&(p=C-1),{curves:_.curves,points:M,isCW:l.ShapeUtils.isClockWise(M),identifier:d++,boundingBox:new l.Box2(new l.Vector2(C,w),new l.Vector2(y,L))}});g=g.filter(_=>_.points.length>1);const A=g.map(_=>h(_,g,p,m,e.userData.style.fillRule)),b=[];return g.forEach(_=>{if(!A[_.identifier].isHole){const L=new l.Shape;L.curves=_.curves,A.filter(y=>y.isHole&&y.for===_.identifier).forEach(y=>{const C=g[y.identifier],T=new l.Path;T.curves=C.curves,L.holes.push(T)}),b.push(L)}}),b}static getStrokeStyle(e,t,s,n,o){return e=e!==void 0?e:1,t=t!==void 0?t:"#000",s=s!==void 0?s:"miter",n=n!==void 0?n:"butt",o=o!==void 0?o:4,{strokeColor:t,strokeWidth:e,strokeLineJoin:s,strokeLineCap:n,strokeMiterLimit:o}}static pointsToStroke(e,t,s,n){const o=[],i=[],r=[];if(wt.pointsToStrokeWithBuffers(e,t,s,n,o,i,r)===0)return null;const a=new l.BufferGeometry;return a.setAttribute("position",new l.Float32BufferAttribute(o,3)),a.setAttribute("normal",new l.Float32BufferAttribute(i,3)),a.setAttribute("uv",new l.Float32BufferAttribute(r,2)),a}static pointsToStrokeWithBuffers(e,t,s,n,o,i,r,a){const h=new l.Vector2,d=new l.Vector2,p=new l.Vector2,m=new l.Vector2,g=new l.Vector2,A=new l.Vector2,b=new l.Vector2,_=new l.Vector2,M=new l.Vector2,L=new l.Vector2,w=new l.Vector2,y=new l.Vector2,C=new l.Vector2,T=new l.Vector2,x=new l.Vector2,v=new l.Vector2,D=new l.Vector2;s=s!==void 0?s:12,n=n!==void 0?n:.001,a=a!==void 0?a:0,e=me(e);const z=e.length;if(z<2)return 0;const U=e[0].equals(e[z-1]);let R,K=e[0],J;const Q=t.strokeWidth/2,pe=1/(z-1);let Z=0,G,ce,se,ae,B=!1,I=0,f=a*3,k=a*2;E(e[0],e[1],h).multiplyScalar(Q),_.copy(e[0]).sub(h),M.copy(e[0]).add(h),L.copy(_),w.copy(M);for(let X=1;X<z;X++){R=e[X],X===z-1?U?J=e[1]:J=void 0:J=e[X+1];const q=h;if(E(K,R,q),p.copy(q).multiplyScalar(Q),y.copy(R).sub(p),C.copy(R).add(p),G=Z+pe,ce=!1,J!==void 0){E(R,J,d),p.copy(d).multiplyScalar(Q),T.copy(R).sub(p),x.copy(R).add(p),se=!0,p.subVectors(J,K),q.dot(p)<0&&(se=!1),X===1&&(B=se),p.subVectors(J,R),p.normalize();const O=Math.abs(q.dot(p));if(O!==0){const S=Q/O;p.multiplyScalar(-S),m.subVectors(R,K),g.copy(m).setLength(S).add(p),v.copy(g).negate();const H=g.length(),de=m.length();m.divideScalar(de),A.subVectors(J,R);const ve=A.length();switch(A.divideScalar(ve),m.dot(v)<de&&A.dot(v)<ve&&(ce=!0),D.copy(g).add(R),v.add(R),ae=!1,ce?se?(x.copy(v),C.copy(v)):(T.copy(v),y.copy(v)):oe(),t.strokeLineJoin){case"bevel":ee(se,ce,G);break;case"round":te(se,ce),se?j(R,y,T,G,0):j(R,x,C,G,1);break;case"miter":case"miter-clip":default:const Ce=Q*t.strokeMiterLimit/H;if(Ce<1)if(t.strokeLineJoin!=="miter-clip"){ee(se,ce,G);break}else te(se,ce),se?(A.subVectors(D,y).multiplyScalar(Ce).add(y),b.subVectors(D,T).multiplyScalar(Ce).add(T),P(y,G,0),P(A,G,0),P(R,G,.5),P(R,G,.5),P(A,G,0),P(b,G,0),P(R,G,.5),P(b,G,0),P(T,G,0)):(A.subVectors(D,C).multiplyScalar(Ce).add(C),b.subVectors(D,x).multiplyScalar(Ce).add(x),P(C,G,1),P(A,G,1),P(R,G,.5),P(R,G,.5),P(A,G,1),P(b,G,1),P(R,G,.5),P(b,G,1),P(x,G,1));else ce?(se?(P(M,Z,1),P(_,Z,0),P(D,G,0),P(M,Z,1),P(D,G,0),P(v,G,1)):(P(M,Z,1),P(_,Z,0),P(D,G,1),P(_,Z,0),P(v,G,0),P(D,G,1)),se?T.copy(D):x.copy(D)):se?(P(y,G,0),P(D,G,0),P(R,G,.5),P(R,G,.5),P(D,G,0),P(T,G,0)):(P(C,G,1),P(D,G,1),P(R,G,.5),P(R,G,.5),P(D,G,1),P(x,G,1)),ae=!0;break}}else oe()}else oe();!U&&X===z-1&&W(e[0],L,w,se,!0,Z),Z=G,K=R,_.copy(T),M.copy(x)}if(!U)W(R,y,C,se,!1,G);else if(ce&&o){let X=D,q=v;B!==se&&(X=v,q=D),se?(ae||B)&&(q.toArray(o,0*3),q.toArray(o,3*3),ae&&X.toArray(o,1*3)):(ae||!B)&&(q.toArray(o,1*3),q.toArray(o,3*3),ae&&X.toArray(o,0*3))}return I;function E(X,q,O){return O.subVectors(q,X),O.set(-O.y,O.x).normalize()}function P(X,q,O){o&&(o[f]=X.x,o[f+1]=X.y,o[f+2]=0,i&&(i[f]=0,i[f+1]=0,i[f+2]=1),f+=3,r&&(r[k]=q,r[k+1]=O,k+=2)),I+=3}function j(X,q,O,S,H){h.copy(q).sub(X).normalize(),d.copy(O).sub(X).normalize();let de=Math.PI;const ve=h.dot(d);Math.abs(ve)<1&&(de=Math.abs(Math.acos(ve))),de/=s,p.copy(q);for(let Ce=0,Ue=s-1;Ce<Ue;Ce++)m.copy(p).rotateAround(X,de),P(p,S,H),P(m,S,H),P(X,S,.5),p.copy(m);P(m,S,H),P(O,S,H),P(X,S,.5)}function oe(){P(M,Z,1),P(_,Z,0),P(y,G,0),P(M,Z,1),P(y,G,1),P(C,G,0)}function ee(X,q,O){q?X?(P(M,Z,1),P(_,Z,0),P(y,G,0),P(M,Z,1),P(y,G,0),P(v,G,1),P(y,O,0),P(T,O,0),P(v,O,.5)):(P(M,Z,1),P(_,Z,0),P(C,G,1),P(_,Z,0),P(v,G,0),P(C,G,1),P(C,O,1),P(x,O,0),P(v,O,.5)):X?(P(y,O,0),P(T,O,0),P(R,O,.5)):(P(C,O,1),P(x,O,0),P(R,O,.5))}function te(X,q){q&&(X?(P(M,Z,1),P(_,Z,0),P(y,G,0),P(M,Z,1),P(y,G,0),P(v,G,1),P(y,Z,0),P(R,G,.5),P(v,G,1),P(R,G,.5),P(T,Z,0),P(v,G,1)):(P(M,Z,1),P(_,Z,0),P(C,G,1),P(_,Z,0),P(v,G,0),P(C,G,1),P(C,Z,1),P(v,G,0),P(R,G,.5),P(R,G,.5),P(v,G,0),P(x,Z,1)))}function W(X,q,O,S,H,de){switch(t.strokeLineCap){case"round":H?j(X,O,q,de,.5):j(X,q,O,de,.5);break;case"square":if(H)h.subVectors(q,X),d.set(h.y,-h.x),p.addVectors(h,d).add(X),m.subVectors(d,h).add(X),S?(p.toArray(o,1*3),m.toArray(o,0*3),m.toArray(o,3*3)):(p.toArray(o,1*3),p.toArray(o,3*3),m.toArray(o,0*3));else{h.subVectors(O,X),d.set(h.y,-h.x),p.addVectors(h,d).add(X),m.subVectors(d,h).add(X);const ve=o.length;S?(p.toArray(o,ve-1*3),m.toArray(o,ve-2*3),m.toArray(o,ve-4*3)):(p.toArray(o,ve-2*3),m.toArray(o,ve-1*3),m.toArray(o,ve-4*3))}break}}function me(X){let q=!1;for(let S=1,H=X.length-1;S<H;S++)if(X[S].distanceTo(X[S+1])<n){q=!0;break}if(!q)return X;const O=[];O.push(X[0]);for(let S=1,H=X.length-1;S<H;S++)X[S].distanceTo(X[S+1])>=n&&O.push(X[S]);return O.push(X[X.length-1]),O}}}const $t=new WeakMap;class Ho extends l.Loader{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,s,n){const o=new l.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,i=>{const r={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(i,r).then(t).catch(n)},s,n)}decodeDracoFile(e,t,s,n){const o={attributeIDs:s||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!s};this.decodeGeometry(e,o).then(t)}decodeGeometry(e,t){for(const a in t.attributeTypes){const h=t.attributeTypes[a];h.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[a]=h.name)}const s=JSON.stringify(t);if($t.has(e)){const a=$t.get(e);if(a.key===s)return a.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n;const o=this.workerNextTaskID++,i=e.byteLength,r=this._getWorker(o,i).then(a=>(n=a,new Promise((h,d)=>{n._callbacks[o]={resolve:h,reject:d},n.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))).then(a=>this._createGeometry(a.geometry));return r.catch(()=>!0).then(()=>{n&&o&&this._releaseTask(n,o)}),$t.set(e,{key:s,promise:r}),r}_createGeometry(e){const t=new l.BufferGeometry;e.index&&t.setIndex(new l.BufferAttribute(e.index.array,1));for(let s=0;s<e.attributes.length;s++){const n=e.attributes[s],o=n.name,i=n.array,r=n.itemSize;t.setAttribute(o,new l.BufferAttribute(i,r))}return t}_loadLibrary(e,t){const s=new l.FileLoader(this.manager);return s.setPath(this.decoderPath),s.setResponseType(t),s.setWithCredentials(this.withCredentials),new Promise((n,o)=>{s.load(e,n,void 0,o)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(s=>{const n=s[0];e||(this.decoderConfig.wasmBinary=s[1]);const o=$o.toString(),i=["/* draco decoder */",n,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
|
|
79
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([i]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const n=new Worker(this.workerSourceURL);n._callbacks={},n._taskCosts={},n._taskLoad=0,n.postMessage({type:"init",decoderConfig:this.decoderConfig}),n.onmessage=function(o){const i=o.data;switch(i.type){case"decode":n._callbacks[i.id].resolve(i);break;case"error":n._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(n)}else this.workerPool.sort(function(n,o){return n._taskLoad>o._taskLoad?-1:1});const s=this.workerPool[this.workerPool.length-1];return s._taskCosts[e]=t,s._taskLoad+=t,s})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}}function $o(){let c,e;onmessage=function(i){const r=i.data;switch(r.type){case"init":c=r.decoderConfig,e=new Promise(function(d){c.onModuleLoaded=function(p){d({draco:p})},DracoDecoderModule(c)});break;case"decode":const a=r.buffer,h=r.taskConfig;e.then(d=>{const p=d.draco,m=new p.Decoder,g=new p.DecoderBuffer;g.Init(new Int8Array(a),a.byteLength);try{const A=t(p,m,g,h),b=A.attributes.map(_=>_.array.buffer);A.index&&b.push(A.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:A},b)}catch(A){console.error(A),self.postMessage({type:"error",id:r.id,error:A.message})}finally{p.destroy(g),p.destroy(m)}});break}};function t(i,r,a,h){const d=h.attributeIDs,p=h.attributeTypes;let m,g;const A=r.GetEncodedGeometryType(a);if(A===i.TRIANGULAR_MESH)m=new i.Mesh,g=r.DecodeBufferToMesh(a,m);else if(A===i.POINT_CLOUD)m=new i.PointCloud,g=r.DecodeBufferToPointCloud(a,m);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!g.ok()||m.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());const b={index:null,attributes:[]};for(const _ in d){const M=self[p[_]];let L,w;if(h.useUniqueIDs)w=d[_],L=r.GetAttributeByUniqueId(m,w);else{if(w=r.GetAttributeId(m,i[d[_]]),w===-1)continue;L=r.GetAttribute(m,w)}b.attributes.push(n(i,r,m,_,M,L))}return A===i.TRIANGULAR_MESH&&(b.index=s(i,r,m)),i.destroy(m),b}function s(i,r,a){const d=a.num_faces()*3,p=d*4,m=i._malloc(p);r.GetTrianglesUInt32Array(a,p,m);const g=new Uint32Array(i.HEAPF32.buffer,m,d).slice();return i._free(m),{array:g,itemSize:1}}function n(i,r,a,h,d,p){const m=p.num_components(),A=a.num_points()*m,b=A*d.BYTES_PER_ELEMENT,_=o(i,d),M=i._malloc(b);r.GetAttributeDataArrayForAllPoints(a,p,_,b,M);const L=new d(i.HEAPF32.buffer,M,A).slice();return i._free(M),{name:h,array:L,itemSize:m}}function o(i,r){switch(r){case Float32Array:return i.DT_FLOAT32;case Int8Array:return i.DT_INT8;case Int16Array:return i.DT_INT16;case Int32Array:return i.DT_INT32;case Uint8Array:return i.DT_UINT8;case Uint16Array:return i.DT_UINT16;case Uint32Array:return i.DT_UINT32}}}const ei=["args","center"],ti=u.defineComponent({__name:"Text3D",props:{font:{},text:{},size:{default:.5},height:{default:.2},curveSegments:{default:5},bevelEnabled:{type:Boolean,default:!0},bevelThickness:{default:.05},bevelSize:{default:.02},bevelOffset:{default:0},bevelSegments:{default:4},center:{type:Boolean,default:!1},needUpdates:{type:Boolean,default:!1}},async setup(c,{expose:e}){let t,s;const n=c,{center:o,font:i,text:r,needUpdates:a,size:h,height:d,curveSegments:p,bevelEnabled:m,bevelThickness:g,bevelSize:A,bevelOffset:b,bevelSegments:_}=u.toRefs(n),{extend:M}=ge.useTresContext();M({TextGeometry:Fs});const L=new Zo,w=u.useSlots(),y=u.computed(()=>{var v;return r!=null&&r.value?r.value:w.default?(v=w.default()[0].children)==null?void 0:v.trim():a.value?"":"TresJS"}),C=u.shallowRef();e({value:C});const T=([t,s]=u.withAsyncContext(()=>new Promise((v,D)=>{try{typeof i.value=="string"?L.load(i.value,z=>{v(z)}):v(i.value)}catch(z){D(console.error("cientos",z))}})),t=await t,s(),t),x=u.computed(()=>({font:T,size:u.toValue(h),height:u.toValue(d),curveSegments:u.toValue(p),bevelEnabled:u.toValue(m),bevelThickness:u.toValue(g),bevelSize:u.toValue(A),bevelOffset:u.toValue(b),bevelSegments:u.toValue(_)}));return u.watchEffect(()=>{C.value&&a.value&&(C.value.geometry.dispose(),C.value.geometry=new Fs(y.value,x.value),o.value&&C.value.geometry.center())}),(v,D)=>u.unref(i)?(u.openBlock(),u.createElementBlock("TresMesh",{key:0,ref_key:"text3DRef",ref:C},[y.value?(u.openBlock(),u.createElementBlock("TresTextGeometry",{key:0,args:[y.value,x.value],center:u.unref(o)},null,8,ei)):u.createCommentVNode("",!0),u.renderSlot(v.$slots,"default")],512)):u.createCommentVNode("",!0)}});function si(c,e){const t=u.ref(e),s=new l.AnimationMixer(t.value),n=u.shallowReactive({});c.forEach(i=>{const r=s.clipAction(i,t.value);n[i.name]=r});const{onLoop:o}=ge.useRenderLoop();return o(({delta:i})=>{s.update(i)}),{actions:n,mixer:s}}const ni=u.defineComponent({__name:"Levioso",props:{speed:{default:1},rotationFactor:{default:1},floatFactor:{default:1},range:{default:()=>[-.1,.1]}},setup(c,{expose:e}){const t=c,s=u.shallowRef();e({value:s});const{onLoop:n}=ge.useRenderLoop(),o=u.ref(Math.random()*1e4);return n(({elapsed:i})=>{var h,d;if(!s.value)return;const r=o.value+i;s.value.rotation.x=Math.cos(r/4*t.speed)/8*t.rotationFactor,s.value.rotation.y=Math.sin(r/4*t.speed)/8*t.rotationFactor,s.value.rotation.z=Math.sin(r/4*t.speed)/20*t.rotationFactor;let a=Math.sin(r/4*t.speed)/10;a=l.MathUtils.mapLinear(a,-.1,.1,((h=t.range)==null?void 0:h[0])??-.1,((d=t.range)==null?void 0:d[1])??.1),s.value.position.y=a*t.floatFactor}),(i,r)=>(u.openBlock(),u.createElementBlock("TresGroup",u.mergeProps(i.$attrs,{ref_key:"groupRef",ref:s}),[u.renderSlot(i.$slots,"default")],16))}});function Ys(c){return u.getCurrentScope()?(u.onScopeDispose(c),!0):!1}function Fe(c){return typeof c=="function"?c():u.unref(c)}const oi=typeof window<"u",tt=()=>{};function Xs(c,e){function t(...s){return new Promise((n,o)=>{Promise.resolve(c(()=>e.apply(this,s),{fn:e,thisArg:this,args:s})).then(n).catch(o)})}return t}function ii(c,e={}){let t,s,n=tt;const o=r=>{clearTimeout(r),n(),n=tt};return r=>{const a=Fe(c),h=Fe(e.maxWait);return t&&o(t),a<=0||h!==void 0&&h<=0?(s&&(o(s),s=null),Promise.resolve(r())):new Promise((d,p)=>{n=e.rejectOnCancel?p:d,h&&!s&&(s=setTimeout(()=>{t&&o(t),s=null,d(r())},h)),t=setTimeout(()=>{s&&o(s),s=null,d(r())},a)})}}function ri(c,e=!0,t=!0,s=!1){let n=0,o,i=!0,r=tt,a;const h=()=>{o&&(clearTimeout(o),o=void 0,r(),r=tt)};return p=>{const m=Fe(c),g=Date.now()-n,A=()=>a=p();return h(),m<=0?(n=Date.now(),A()):(g>m&&(t||!i)?(n=Date.now(),A()):e&&(a=new Promise((b,_)=>{r=s?_:b,o=setTimeout(()=>{n=Date.now(),i=!0,b(A()),h()},Math.max(0,m-g))})),!t&&!o&&(o=setTimeout(()=>i=!0,m)),i=!1,a)}}function ai(c,e=200,t={}){return Xs(ii(e,t),c)}function li(c,e=200,t=!1,s=!0,n=!1){return Xs(ri(e,t,s,n),c)}function ci(c,e=!0){u.getCurrentInstance()?u.onMounted(c):e?c():u.nextTick(c)}function hi(c){var e;const t=Fe(c);return(e=t==null?void 0:t.$el)!=null?e:t}const st=oi?window:void 0;function Se(...c){let e,t,s,n;if(typeof c[0]=="string"||Array.isArray(c[0])?([t,s,n]=c,e=st):[e,t,s,n]=c,!e)return tt;Array.isArray(t)||(t=[t]),Array.isArray(s)||(s=[s]);const o=[],i=()=>{o.forEach(d=>d()),o.length=0},r=(d,p,m,g)=>(d.addEventListener(p,m,g),()=>d.removeEventListener(p,m,g)),a=u.watch(()=>[hi(e),Fe(n)],([d,p])=>{i(),d&&o.push(...t.flatMap(m=>s.map(g=>r(d,m,g,p))))},{immediate:!0,flush:"post"}),h=()=>{a(),i()};return Ys(h),h}function ui(c){return typeof c=="function"?c:typeof c=="string"?e=>e.key===c:Array.isArray(c)?e=>c.includes(e.key):()=>!0}function nt(...c){let e,t,s={};c.length===3?(e=c[0],t=c[1],s=c[2]):c.length===2?typeof c[1]=="object"?(e=!0,t=c[0],s=c[1]):(e=c[0],t=c[1]):(e=!0,t=c[0]);const{target:n=st,eventName:o="keydown",passive:i=!1,dedupe:r=!1}=s,a=ui(e);return Se(n,o,d=>{d.repeat&&Fe(r)||a(d)&&t(d)},i)}function pi(){const c=u.ref(!1);return u.getCurrentInstance()&&u.onMounted(()=>{c.value=!0}),c}function di(c){const e=pi();return u.computed(()=>(e.value,!!c()))}function fi(c,e={}){const{window:t=st}=e,s=di(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function");let n;const o=u.ref(!1),i=h=>{o.value=h.matches},r=()=>{n&&("removeEventListener"in n?n.removeEventListener("change",i):n.removeListener(i))},a=u.watchEffect(()=>{s.value&&(r(),n=t.matchMedia(Fe(c)),"addEventListener"in n?n.addEventListener("change",i):n.addListener(i),o.value=n.matches)});return Ys(()=>{a(),r(),n=void 0}),o}const Zs=1;function mi(c,e={}){const{throttle:t=0,idle:s=200,onStop:n=tt,onScroll:o=tt,offset:i={left:0,right:0,top:0,bottom:0},eventListenerOptions:r={capture:!1,passive:!0},behavior:a="auto",window:h=st}=e,d=u.ref(0),p=u.ref(0),m=u.computed({get(){return d.value},set(T){A(T,void 0)}}),g=u.computed({get(){return p.value},set(T){A(void 0,T)}});function A(T,x){var v,D,z;if(!h)return;const U=Fe(c);U&&((z=U instanceof Document?h.document.body:U)==null||z.scrollTo({top:(v=Fe(x))!=null?v:g.value,left:(D=Fe(T))!=null?D:m.value,behavior:Fe(a)}))}const b=u.ref(!1),_=u.reactive({left:!0,right:!1,top:!0,bottom:!1}),M=u.reactive({left:!1,right:!1,top:!1,bottom:!1}),L=T=>{b.value&&(b.value=!1,M.left=!1,M.right=!1,M.top=!1,M.bottom=!1,n(T))},w=ai(L,t+s),y=T=>{if(!h)return;const x=T===h?T.document.documentElement:T===h.document?T.documentElement:T,{display:v,flexDirection:D}=getComputedStyle(x),z=x.scrollLeft;M.left=z<d.value,M.right=z>d.value;const U=Math.abs(z)<=0+(i.left||0),R=Math.abs(z)+x.clientWidth>=x.scrollWidth-(i.right||0)-Zs;v==="flex"&&D==="row-reverse"?(_.left=R,_.right=U):(_.left=U,_.right=R),d.value=z;let K=x.scrollTop;T===h.document&&!K&&(K=h.document.body.scrollTop),M.top=K<p.value,M.bottom=K>p.value;const J=Math.abs(K)<=0+(i.top||0),Q=Math.abs(K)+x.clientHeight>=x.scrollHeight-(i.bottom||0)-Zs;v==="flex"&&D==="column-reverse"?(_.top=Q,_.bottom=J):(_.top=J,_.bottom=Q),p.value=K},C=T=>{if(!h)return;const x=T.target===h.document?T.target.documentElement:T.target;y(x),b.value=!0,w(T),o(T)};return Se(c,"scroll",t?li(C,t,!0,!1):C,r),Se(c,"scrollend",L,r),{x:m,y:g,isScrolling:b,arrivedState:_,directions:M,measure(){const T=Fe(c);h&&T&&y(T)}}}const gi={page:c=>[c.pageX,c.pageY],client:c=>[c.clientX,c.clientY],screen:c=>[c.screenX,c.screenY],movement:c=>c instanceof Touch?null:[c.movementX,c.movementY]};function yi(c={}){const{type:e="page",touch:t=!0,resetOnTouchEnds:s=!1,initialValue:n={x:0,y:0},window:o=st,target:i=o,eventFilter:r}=c,a=u.ref(n.x),h=u.ref(n.y),d=u.ref(null),p=typeof e=="function"?e:gi[e],m=M=>{const L=p(M);L&&([a.value,h.value]=L,d.value="mouse")},g=M=>{if(M.touches.length>0){const L=p(M.touches[0]);L&&([a.value,h.value]=L,d.value="touch")}},A=()=>{a.value=n.x,h.value=n.y},b=r?M=>r(()=>m(M),{}):M=>m(M),_=r?M=>r(()=>g(M),{}):M=>g(M);if(i){const M={passive:!0};Se(i,["mousemove","dragover"],b,M),t&&e!=="movement"&&(Se(i,["touchstart","touchmove"],_,M),s&&Se(i,"touchend",A,M))}return{x:a,y:h,sourceType:d}}function _i({window:c=st}={}){if(!c)return{x:u.ref(0),y:u.ref(0)};const e=u.ref(c.scrollX),t=u.ref(c.scrollY);return Se(c,"scroll",()=>{e.value=c.scrollX,t.value=c.scrollY},{capture:!1,passive:!0}),{x:e,y:t}}function Qs(c={}){const{window:e=st,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:s=Number.POSITIVE_INFINITY,listenOrientation:n=!0,includeScrollbar:o=!0}=c,i=u.ref(t),r=u.ref(s),a=()=>{e&&(o?(i.value=e.innerWidth,r.value=e.innerHeight):(i.value=e.document.documentElement.clientWidth,r.value=e.document.documentElement.clientHeight))};if(a(),ci(a),Se("resize",a,{passive:!0}),n){const h=fi("(orientation: portrait)");u.watch(h,()=>a())}return{width:i,height:r}}const wi=u.defineComponent({__name:"MouseParallax",props:{disabled:{type:Boolean,default:!1},factor:{default:2.5},ease:{default:.1}},setup(c){const e=c,{camera:t}=ge.useTresContext(),{disabled:s,factor:n,ease:o}=u.toRefs(e),{x:i,y:r}=yi(),{width:a,height:h}=Qs(),d=u.ref(),p=u.computed(()=>(i.value/a.value-.5)*n.value),m=u.computed(()=>-(r.value/h.value-.5)*n.value),{onLoop:g}=ge.useRenderLoop();return g(({delta:A})=>{s.value||!d.value||(d.value.position.x+=(p.value-d.value.position.x)*o.value*A,d.value.position.y+=(m.value-d.value.position.y)*o.value*A)}),u.watch(()=>d.value,A=>A==null?void 0:A.add(t.value)),(A,b)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"cameraGroupRef",ref:d},null,512))}}),es={sunset:"venice/venice_sunset_4k.hdr"};async function Ks({files:c=["/px.png","/nx.png","/py.png","/ny.png","/pz.png","/nz.png"],blur:e=0,background:t=!1,path:s="/",preset:n=void 0}){const{scene:o}=ge.useTresContext();if(n){if(!(n in es))throw new Error(`Preset must be one of: ${Object.keys(es).join(", ")}`);c=es[n],s="https://raw.githubusercontent.com/Tresjs/assets/main/textures/hdr/"}const i=Array.isArray(c),r=i?l.CubeTextureLoader:Jo,a=await ge.useLoader(r,i?[c]:c,d=>{s&&d.setPath(s)}),h=i?a[0]:a;return h&&(h.mapping=i?l.CubeReflectionMapping:l.EquirectangularReflectionMapping,h.colorSpace=l.SRGBColorSpace),o.value&&(o.value.environment=h,t&&(o.value.background=h),e&&(o.value.backgroundBlurriness=e|0)),h}let Pt=null;function xi(c,e){return t=>{e&&e(t),c.draco&&(Pt||(Pt=new Ho),Pt.setDecoderPath(c.decoderPath||"https://www.gstatic.com/draco/versioned/decoders/1.4.3/"),t.setDRACOLoader(Pt))}}async function Ws(c,e={draco:!1},t){return await ge.useLoader(jn,c,xi(e,t))}const bi=u.defineComponent({__name:"component",props:{path:{},draco:{type:Boolean,default:!1},decoderPath:{default:"https://www.gstatic.com/draco/versioned/decoders/1.4.1/"}},async setup(c,{expose:e}){let t,s;const n=c,o=u.ref();e({value:o});const{scene:i}=([t,s]=u.withAsyncContext(()=>Ws(n.path,{draco:n.draco,decoderPath:n.decoderPath})),t=await t,s(),t);return(r,a)=>{const h=u.resolveComponent("primitive");return u.openBlock(),u.createBlock(h,u.mergeProps({ref_key:"modelRef",ref:o,object:u.unref(i)},r.$attrs),null,16,["object"])}}});async function qs(c){return await ge.useLoader(Do,c)}const vi=u.defineComponent({__name:"component",props:{path:{}},async setup(c,{expose:e}){let t,s;const n=c,o=u.ref();e({value:o});const i=([t,s]=u.withAsyncContext(()=>qs(n.path)),t=await t,s(),t);return(r,a)=>{const h=u.resolveComponent("primitive");return u.openBlock(),u.createBlock(h,u.mergeProps({ref_key:"modelRef",ref:o,object:u.unref(i)},r.$attrs),null,16,["object"])}}}),Ai=["geometry","render-order"],Mi=u.defineComponent({__name:"component",props:{src:{},skipStrokes:{type:Boolean,default:!1},skipFills:{type:Boolean,default:!1},fillMaterial:{},strokeMaterial:{},fillMeshProps:{},strokeMeshProps:{},depth:{default:"renderOrder"}},setup(c,{expose:e}){const t=c,{src:s,skipStrokes:n,skipFills:o,fillMaterial:i,strokeMaterial:r,fillMeshProps:a,strokeMeshProps:h,depth:d}=u.toRefs(t),p=u.shallowRef(),m=u.shallowRef([]),g=u.shallowRef([]);e({value:p}),u.watchEffect(async()=>A(s.value).then(M=>g.value=M.paths)),u.watch([o,n,i,r,g],_);async function A(M){const L=M.startsWith("<svg")?encodeURI(`data:image/svg+xml;utf8,${M}`):M;return ge.useLoader(wt,L)}u.onUnmounted(b);function b(){m.value.forEach(M=>M.geometry.dispose())}function _(){var C,T,x;b();const M=[],[L,w]=(()=>{const v={flat:!1,renderOrder:!1,offsetZ:!0},D={flat:0,renderOrder:0,offsetZ:.025},z=d.value;return typeof z=="number"?[!0,z]:[v[z],D[z]]})();let y=0;for(const v of g.value){const D=((C=v.userData)==null?void 0:C.style)??{},z=Object.assign({color:D.fill,opacity:D.fillOpacity,transparent:!0,side:l.DoubleSide,depthWrite:L},t.fillMaterial);if(!o.value&&D.fill!==void 0&&D.fill!=="none")for(const U of wt.createShapes(v)){const R=new l.ShapeGeometry(U);R.scale(1,-1,1),w&&R.translate(0,0,y++*w),M.push({geometry:R,material:z,isStroke:!1})}if(!n.value&&D.stroke!==void 0&&D.stroke!=="none"){const U=Object.assign({color:(T=v.userData)==null?void 0:T.style.stroke,opacity:(x=v.userData)==null?void 0:x.style.strokeOpacity,transparent:!0,side:l.DoubleSide,depthWrite:L},t.strokeMaterial);for(const R of v.subPaths){const K=R.getPoints().map(Q=>new l.Vector2(Q.x,-Q.y)),J=wt.pointsToStroke(K,D||"none");w&&J.translate(0,0,y++*w),M.push({geometry:J,material:U,isStroke:!0})}}}m.value=M}return(M,L)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"svgRef",ref:p},[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(m.value,({geometry:w,material:y,isStroke:C},T)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({key:`${T}`},C?u.unref(h):u.unref(a),{geometry:w,"render-order":u.unref(d)==="renderOrder"?T:0}),[u.createElementVNode("TresMeshBasicMaterial",u.normalizeProps(u.guardReactiveProps(y)),null,16)],16,Ai))),128))],512))}}),Js="[TresJS - Cientos ▲ ■ ♥] ";function ts(){function c(s,n){console.error(`${Js} ${s}`,n||"")}function e(s){console.warn(`${Js} ${s}`)}function t(s,n){}return{logError:c,logWarning:e,logMessage:t}}let ss=0;function Si(){const c=u.ref(!1),e=u.ref(0),t=u.ref([]),{logError:s}=ts();return new Promise(n=>{l.DefaultLoadingManager.onStart=()=>{c.value=!1},l.DefaultLoadingManager.onLoad=()=>{c.value=!0},l.DefaultLoadingManager.onProgress=(o,i,r)=>{i===r&&(ss=r,c.value=!0,t.value.push(o)),e.value=Math.round((i-ss)/(r-ss)*100||100,2)},l.DefaultLoadingManager.onError=o=>{s("Error loading assets",new Error(o)),c.value=!0},n({items:t,hasFinishLoading:c,progress:e})})}async function Ti(c,e){const{logError:t}=ts();if(!c)return t("Error no path provided");const{unsuspend:s,start:n,crossOrigin:o,muted:i,loop:r,...a}={unsuspend:"loadedmetadata",crossOrigin:"Anonymous",muted:!0,loop:!0,start:!0,playsInline:!0,...e};function h(){return new Promise((d,p)=>{const m=Object.assign(document.createElement("video"),{src:typeof c=="string"&&c||void 0,crossOrigin:o,loop:r,muted:i,autoplay:!0,...a}),g=new l.VideoTexture(m);return m.addEventListener(s,()=>d(g)),m.addEventListener("error",()=>p()),g})}try{const d=await h();return n&&d.image&&d.image.play(),d}catch{t("Error loading resource")}}const Ci=["target","auto-rotate","auto-rotate-speed","enable-damping","damping-factor","enable-pan","key-pan-speed","keys","max-azimuth-angle","min-azimuth-angle","max-polar-angle","min-polar-angle","min-distance","max-distance","min-zoom","max-zoom","touches","enable-zoom","zoom-speed","enable-rotate","rotate-speed","args"],Li=u.defineComponent({__name:"OrbitControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},target:{default:()=>[0,0,0]},enableDamping:{type:Boolean,default:!1},dampingFactor:{default:.05},autoRotate:{type:Boolean,default:!1},autoRotateSpeed:{default:2},enablePan:{type:Boolean,default:!0},keyPanSpeed:{default:7},keys:{},maxAzimuthAngle:{default:1/0},minAzimuthAngle:{default:-1/0},maxPolarAngle:{default:Math.PI},minPolarAngle:{default:0},minDistance:{default:0},maxDistance:{default:1/0},minZoom:{default:0},maxZoom:{default:1/0},touches:{default:()=>({ONE:l.TOUCH.ROTATE,TWO:l.TOUCH.DOLLY_PAN})},enableZoom:{type:Boolean,default:!0},zoomSpeed:{default:1},enableRotate:{type:Boolean,default:!0},rotateSpeed:{default:1}},emits:["change","start","end"],setup(c,{emit:e}){const t=c,{makeDefault:s,autoRotate:n,autoRotateSpeed:o,enableDamping:i,dampingFactor:r,enablePan:a,keyPanSpeed:h,maxAzimuthAngle:d,minAzimuthAngle:p,maxPolarAngle:m,minPolarAngle:g,minDistance:A,maxDistance:b,minZoom:_,maxZoom:M,enableZoom:L,zoomSpeed:w,enableRotate:y,touches:C,rotateSpeed:T,target:x}=u.toRefs(t),{camera:v,renderer:D,extend:z,controls:U}=ge.useTresContext(),R=u.ref(null);z({OrbitControls:Cs}),u.watch(R,Q=>{K(),Q&&s.value?U.value=Q:U.value=null});function K(){Se(R.value,"change",()=>e("change",R.value)),Se(R.value,"start",()=>e("start",R.value)),Se(R.value,"end",()=>e("end",R.value))}const{onLoop:J}=ge.useRenderLoop();return J(()=>{R.value&&(i.value||n.value)&&R.value.update()}),u.onUnmounted(()=>{R.value&&R.value.dispose()}),(Q,pe)=>(Q.camera||u.unref(v))&&(Q.domElement||u.unref(D))?(u.openBlock(),u.createElementBlock("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:R,target:u.unref(x),"auto-rotate":u.unref(n),"auto-rotate-speed":u.unref(o),"enable-damping":u.unref(i),"damping-factor":u.unref(r),"enable-pan":u.unref(a),"key-pan-speed":u.unref(h),keys:Q.keys,"max-azimuth-angle":u.unref(d),"min-azimuth-angle":u.unref(p),"max-polar-angle":u.unref(m),"min-polar-angle":u.unref(g),"min-distance":u.unref(A),"max-distance":u.unref(b),"min-zoom":u.unref(_),"max-zoom":u.unref(M),touches:u.unref(C),"enable-zoom":u.unref(L),"zoom-speed":u.unref(w),"enable-rotate":u.unref(y),"rotate-speed":u.unref(T),args:[Q.camera||u.unref(v),Q.domElement||u.unref(D).domElement]},null,8,Ci)):u.createCommentVNode("",!0)}}),Pi=5,Oi=6,Ii=.3,Di=u.defineComponent({__name:"KeyboardControls",props:{forward:{default:()=>["w","W"]},back:{default:()=>["s","S"]},left:{default:()=>["a","A"]},right:{default:()=>["d","D"]},jump:{default:()=>[" "]},gravity:{default:9.8},moveSpeed:{default:.1},headBobbing:{type:Boolean,default:!1},is2D:{type:Boolean,default:!1}},setup(c){var z;const e=c,{forward:t,back:s,left:n,right:o,jump:i,gravity:r,moveSpeed:a,headBobbing:h,is2D:d}=u.toRefs(e),{camera:p,controls:m}=ge.useTresContext(),g=u.ref(0),A=u.ref(0),b=u.ref(!1),_=u.ref(!1),M=u.ref(0),L=u.shallowRef(),w=d.value?"y":"z",y=((z=p.value.position)==null?void 0:z.y)||0;nt(t.value,()=>{b.value=!0,A.value=a.value},{eventName:"keydown"}),nt(s.value,()=>{b.value=!0,A.value=-a.value},{eventName:"keydown"}),nt([...t.value,...s.value],()=>{b.value=!1,A.value=0},{eventName:"keyup"}),nt(n.value,()=>{b.value=!0,g.value=-a.value},{eventName:"keydown"}),nt(o.value,()=>{b.value=!0,g.value=a.value},{eventName:"keydown"}),nt([...n.value,...o.value],()=>{b.value=!1,g.value=0},{eventName:"keyup"}),nt(i.value,()=>{_.value||(M.value=Date.now()),_.value=!0});const C=U=>b.value?Math.sin(U*Pi)*Ii+y:y,T=()=>(Date.now()-M.value)/1e3*3,x=U=>y+Oi*U-.5*r.value*U**2,v=()=>{if(_.value){const U=x(T());return U<=y&&(_.value=!1),U}return 0},{onLoop:D}=ge.useRenderLoop();return D(({elapsed:U})=>{var R;m.value instanceof jt&&((R=m.value)!=null&&R.isLocked)?(m.value.moveForward(A.value),m.value.moveRight(g.value),p.value.position&&(p.value.position.y=h.value?C(U):y,p.value.position.y+=v())):L.value.children.length>0&&!(m.value instanceof jt)&&(L.value.position.x+=g.value,L.value.position[w]+=d.value?A.value:-A.value)}),(U,R)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"wrapperRef",ref:L},[u.renderSlot(U.$slots,"default")],512))}}),ki=["object","args","mode","enabled","axis","translation-snap","rotation-snap","scale-snap","space","size","show-x","show-y","show-z"],Fi=u.defineComponent({__name:"TransformControls",props:{object:{},mode:{default:"translate"},enabled:{type:Boolean,default:!0},axis:{default:"XYZ"},translationSnap:{},rotationSnap:{},scaleSnap:{},space:{default:"world"},size:{default:1},showX:{type:Boolean,default:!0},showY:{type:Boolean,default:!0},showZ:{type:Boolean,default:!0}},emits:["dragging","change","mouseDown","mouseUp","objectChange"],setup(c,{emit:e}){const t=c,{object:s,mode:n,enabled:o,axis:i,translationSnap:r,rotationSnap:a,scaleSnap:h,space:d,size:p,showX:m,showY:g,showZ:A}=u.toRefs(t),b=u.shallowRef(),{controls:_,camera:M,renderer:L,extend:w}=ge.useTresContext();w({TransformControls:Dn});const y=T=>{_.value&&(_.value.enabled=!T.value),e("dragging",T.value)};function C(){Se(b.value,"change",()=>e("change")),Se(b.value,"dragging-changed",y),Se(b.value,"mouseDown",()=>e("mouseDown")),Se(b.value,"mouseUp",()=>e("mouseUp")),Se(b.value,"objectChange",()=>e("objectChange"))}return u.watchEffect(()=>{b.value&&C()}),u.onUnmounted(()=>{b.value&&b.value.dispose()}),(T,x)=>u.unref(M)&&u.unref(L)?(u.openBlock(),u.createElementBlock("TresTransformControls",{key:0,ref_key:"controlsRef",ref:b,object:u.unref(s),args:[u.unref(M),u.unref(L).domElement],mode:u.unref(n),enabled:u.unref(o),axis:u.unref(i),"translation-snap":u.unref(r),"rotation-snap":u.unref(a),"scale-snap":u.unref(h),space:u.unref(d),size:u.unref(p),"show-x":u.unref(m),"show-y":u.unref(g),"show-z":u.unref(A),visible:!0},null,8,ki)):u.createCommentVNode("",!0)}}),Bi=["args"],Ui=u.defineComponent({__name:"PointerLockControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},selector:{}},emits:["isLock"],setup(c,{expose:e,emit:t}){const s=c,{camera:n,renderer:o,extend:i,controls:r}=ge.useTresContext(),a=u.ref(null);let h;i({PointerLockControls:jt});const d=p=>{t("isLock",p)};return u.watch(a,p=>{p&&s.makeDefault?r.value=p:r.value=null;const m=document.getElementById(s.selector||"");h=m||o.value.domElement,Se(h,"click",()=>{var g,A,b;(g=r.value)==null||g.lock(),(A=r.value)==null||A.addEventListener("lock",()=>d(!0)),(b=r.value)==null||b.addEventListener("unlock",()=>d(!1))})}),u.onUnmounted(()=>{var p,m;(p=r.value)==null||p.removeEventListener("lock",()=>d(!0)),(m=r.value)==null||m.removeEventListener("unlock",()=>d(!1)),a.value&&a.value.dispose()}),e({value:r}),(p,m)=>(p.camera||u.unref(n))&&(p.domElement||u.unref(o))?(u.openBlock(),u.createElementBlock("TresPointerLockControls",{key:0,ref_key:"controlsRef",ref:a,args:[p.camera||u.unref(n),p.domElement||u.unref(o).domElement]},null,8,Bi)):u.createCommentVNode("",!0)}}),Ni=["args"],Vi=u.defineComponent({__name:"MapControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{}},setup(c){const e=c,{camera:t,renderer:s,extend:n,controls:o}=ge.useTresContext(),i=u.ref(null);return n({MapControls:En}),u.watch(o,r=>{r&&e.makeDefault?o.value=r:o.value=null}),u.onUnmounted(()=>{i.value&&i.value.dispose()}),(r,a)=>(r.camera||u.unref(t))&&(r.domElement||u.unref(s))?(u.openBlock(),u.createElementBlock("TresMapControls",{key:0,ref_key:"controlsRef",ref:i,args:[r.camera||u.unref(t),r.domElement||u.unref(s).domElement]},null,8,Ni)):u.createCommentVNode("",!0)}}),zi=u.defineComponent({__name:"ScrollControls",props:{pages:{default:4},distance:{default:4},smoothScroll:{default:.1},horizontal:{type:Boolean,default:!1},htmlScroll:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(c,{emit:e}){const t=c,{logWarning:s}=ge.useLogger();t.smoothScroll<0&&s("SmoothControl must be greater than zero"),t.pages<0&&s("Pages must be greater than zero");const{camera:n,controls:o,renderer:i}=ge.useTresContext(),r=u.shallowRef(),a=document.createElement("div"),{y:h}=_i(),{x:d,y:p,isScrolling:m}=mi(a),{height:g,width:A}=Qs();let b=0;const _=u.ref(!1),M=u.ref(0),L=u.ref(0),w=u.ref(0),y=t.horizontal?"x":"y",C=u.watch(n,x=>{if(_.value){C();return}b=t.horizontal?(x==null?void 0:x.position.x)||0:(x==null?void 0:x.position.y)||0,_.value=!0},{immediate:!0});u.watch(m,x=>{o.value&&(o.value.enabled=!x)},{immediate:!0}),u.watch(h,x=>{!m.value&&!t.htmlScroll||(L.value=x/g.value/(w.value/g.value-1),M.value=-1*L.value,e("update:modelValue",L.value))}),u.watch(p,x=>{L.value=x/g.value/(w.value/g.value),M.value=-1*L.value,e("update:modelValue",L.value)}),u.watch(d,x=>{L.value=x/A.value/(w.value/A.value-1),M.value=+L.value,e("update:modelValue",L.value)}),u.watch(i,x=>{var D,z;const v=x==null?void 0:x.domElement;if(t.htmlScroll&&(x!=null&&x.domElement))v!=null&&v.style.width&&(v!=null&&v.style.position)&&(v!=null&&v.style.top)&&(v!=null&&v.style.left)&&(v.style.width="100%",v.style.position="fixed",v.style.zIndex=" -99999",v.style.top="0",v.style.left="0"),w.value=document.body.scrollHeight;else{const U=document.createElement("div"),R=document.createElement("div");a.style[t.horizontal?"overflowX":"overflowY"]="auto",a.style[t.horizontal?"overflowY":"overflowX"]="hidden",a.style.position="absolute",a.style.width="100%",a.style.height=" 100%",a.style.top="0",a.style.left="0",a.classList.add("scrollContainer"),U.style.position="sticky",U.style.top="0px",U.style.left="0px",U.style.width="100%",U.style.height="100%",U.style.overflow="hidden",a.appendChild(U),R.style.height=t.horizontal?"100%":`${g.value*t.pages}px`,R.style.width=t.horizontal?`${A.value*t.pages}px`:"100vw",R.style.pointerEvents="none",v.style.position="fixed",v.style.zIndex="0",v!=null&&v.style.width&&(v.style.width="100%"),a.appendChild(R),x.domElement.parentNode.style.position="relative",(z=(D=x==null?void 0:x.domElement)==null?void 0:D.parentNode)==null||z.appendChild(a),w.value=t.horizontal?A.value*t.pages:g.value*t.pages}},{immediate:!0});const{onLoop:T}=ge.useRenderLoop();return T(()=>{var x;if((x=n.value)!=null&&x.position){const v=(M.value*t.distance-n.value.position[y]+b)*t.smoothScroll;n.value.position[y]+=v,r.value.children.length>0&&(r.value.position[y]+=v)}}),(x,v)=>(u.openBlock(),u.createElementBlock("TresGroup",{ref_key:"wrapperRef",ref:r},[u.renderSlot(x.$slots,"default")],512))}});/*!
|
|
82
80
|
* camera-controls
|
|
83
81
|
* https://github.com/yomotsu/camera-controls
|
|
84
82
|
* (c) 2017 @yomotsu
|
|
85
83
|
* Released under the MIT License.
|
|
86
|
-
*/const V={LEFT:1,RIGHT:2,MIDDLE:4},P=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),Je={NONE:0,IN:1,OUT:-1};function Ye(l){return l.isPerspectiveCamera}function Ue(l){return l.isOrthographicCamera}const He=Math.PI*2,Bs=Math.PI/2,Us=1e-5,it=Math.PI/180;function Ae(l,e,t){return Math.max(e,Math.min(t,l))}function te(l,e=Us){return Math.abs(l)<e}function J(l,e,t=Us){return te(l-e,t)}function Ns(l,e){return Math.round(l/e)*e}function ot(l){return isFinite(l)?l:l<0?-Number.MAX_VALUE:Number.MAX_VALUE}function rt(l){return Math.abs(l)<Number.MAX_VALUE?l:l*(1/0)}function mt(l,e,t,s,n=1/0,i){s=Math.max(1e-4,s);const o=2/s,r=o*i,a=1/(1+r+.48*r*r+.235*r*r*r);let h=l-e;const p=e,d=n*s;h=Ae(h,-d,d),e=l-h;const m=(t.value+o*h)*i;t.value=(t.value-o*m)*a;let f=e+(h+m)*a;return p-l>0==f>p&&(f=p,t.value=(f-p)/i),f}function Vs(l,e,t,s,n=1/0,i,o){s=Math.max(1e-4,s);const r=2/s,a=r*i,h=1/(1+a+.48*a*a+.235*a*a*a);let p=e.x,d=e.y,m=e.z,f=l.x-p,w=l.y-d,y=l.z-m;const v=p,M=d,L=m,b=n*s,g=b*b,S=f*f+w*w+y*y;if(S>g){const G=Math.sqrt(S);f=f/G*b,w=w/G*b,y=y/G*b}p=l.x-f,d=l.y-w,m=l.z-y;const A=(t.x+r*f)*i,_=(t.y+r*w)*i,x=(t.z+r*y)*i;t.x=(t.x-r*A)*h,t.y=(t.y-r*_)*h,t.z=(t.z-r*x)*h,o.x=p+(f+A)*h,o.y=d+(w+_)*h,o.z=m+(y+x)*h;const D=v-l.x,k=M-l.y,I=L-l.z,B=o.x-v,R=o.y-M,H=o.z-L;return D*B+k*R+I*H>0&&(o.x=v,o.y=M,o.z=L,t.x=(o.x-v)/i,t.y=(o.y-M)/i,t.z=(o.z-L)/i),o}function Vt(l,e){e.set(0,0),l.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=l.length,e.y/=l.length}function Et(l,e){return Ue(l)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class Go{constructor(){this._listeners={}}addEventListener(e,t){const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(t)===-1&&s[e].push(t)}hasEventListener(e,t){const s=this._listeners;return s[e]!==void 0&&s[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners[e];if(n!==void 0){const i=n.indexOf(t);i!==-1&&n.splice(i,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const s=this._listeners[e.type];if(s!==void 0){e.target=this;const n=s.slice(0);for(let i=0,o=n.length;i<o;i++)n[i].call(this,e)}}}const Yo="2.7.1",ft=1/8,Es=typeof window<"u",jo=Es&&/Mac/.test(navigator.platform),Xo=!(Es&&"PointerEvent"in window);let N,zs,gt,zt,me,Y,W,$e,at,Te,Le,je,Rs,Gs,we,lt,et,Ys,Rt,js,Gt,Yt,yt;class ct extends Go{static install(e){N=e.THREE,zs=Object.freeze(new N.Vector3(0,0,0)),gt=Object.freeze(new N.Vector3(0,1,0)),zt=Object.freeze(new N.Vector3(0,0,1)),me=new N.Vector2,Y=new N.Vector3,W=new N.Vector3,$e=new N.Vector3,at=new N.Vector3,Te=new N.Vector3,Le=new N.Vector3,je=new N.Vector3,Rs=new N.Vector3,Gs=new N.Vector3,we=new N.Spherical,lt=new N.Spherical,et=new N.Box3,Ys=new N.Box3,Rt=new N.Sphere,js=new N.Quaternion,Gt=new N.Quaternion,Yt=new N.Matrix4,yt=new N.Raycaster}static get ACTION(){return P}constructor(e,t){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.verticalDragToForward=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=P.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=Je.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new N.Vector3,this._focalOffsetVelocity=new N.Vector3,this._zoomVelocity={value:0},this._truckInternal=(g,S,A)=>{let _,x;if(Ye(this._camera)){const D=Y.copy(this._camera.position).sub(this._target),k=this._camera.getEffectiveFOV()*it,I=D.length()*Math.tan(k*.5);_=this.truckSpeed*g*I/this._elementRect.height,x=this.truckSpeed*S*I/this._elementRect.height}else if(Ue(this._camera)){const D=this._camera;_=g*(D.right-D.left)/D.zoom/this._elementRect.width,x=S*(D.top-D.bottom)/D.zoom/this._elementRect.height}else return;this.verticalDragToForward?(A?this.setFocalOffset(this._focalOffsetEnd.x+_,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(_,0,!0),this.forward(-x,!0)):A?this.setFocalOffset(this._focalOffsetEnd.x+_,this._focalOffsetEnd.y+x,this._focalOffsetEnd.z,!0):this.truck(_,x,!0)},this._rotateInternal=(g,S)=>{const A=He*this.azimuthRotateSpeed*g/this._elementRect.height,_=He*this.polarRotateSpeed*S/this._elementRect.height;this.rotate(A,_,!0)},this._dollyInternal=(g,S,A)=>{const _=Math.pow(.95,-g*this.dollySpeed),x=this._sphericalEnd.radius,D=this._sphericalEnd.radius*_,k=Ae(D,this.minDistance,this.maxDistance),I=k-D;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(D,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(I,!0),this._dollyToNoClamp(k,!0)):this._dollyToNoClamp(k,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?D:k)-x,this._dollyControlCoord.set(S,A)),this._lastDollyDirection=Math.sign(-g)},this._zoomInternal=(g,S,A)=>{const _=Math.pow(.95,g*this.dollySpeed),x=this._zoom,D=this._zoom*_;this.zoomTo(D,!0),this.dollyToCursor&&(this._changedZoom+=D-x,this._dollyControlCoord.set(S,A))},typeof N>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new N.Quaternion().setFromUnitVectors(this._camera.up,gt),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=P.NONE,this._target=new N.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new N.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new N.Spherical().setFromVector3(Y.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new N.Vector3,new N.Vector3,new N.Vector3,new N.Vector3],this._updateNearPlaneCorners(),this._boundary=new N.Box3(new N.Vector3(-1/0,-1/0,-1/0),new N.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new N.Vector2,this.mouseButtons={left:P.ROTATE,middle:P.DOLLY,right:P.TRUCK,wheel:Ye(this._camera)?P.DOLLY:Ue(this._camera)?P.ZOOM:P.NONE},this.touches={one:P.TOUCH_ROTATE,two:Ye(this._camera)?P.TOUCH_DOLLY_TRUCK:Ue(this._camera)?P.TOUCH_ZOOM_TRUCK:P.NONE,three:P.TOUCH_TRUCK};const s=new N.Vector2,n=new N.Vector2,i=new N.Vector2,o=g=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const _=this._domElement.getBoundingClientRect(),x=g.clientX/_.width,D=g.clientY/_.height;if(x<this._interactiveArea.left||x>this._interactiveArea.right||D<this._interactiveArea.top||D>this._interactiveArea.bottom)return}const S=g.pointerType!=="mouse"?null:(g.buttons&V.LEFT)===V.LEFT?V.LEFT:(g.buttons&V.MIDDLE)===V.MIDDLE?V.MIDDLE:(g.buttons&V.RIGHT)===V.RIGHT?V.RIGHT:null;if(S!==null){const _=this._findPointerByMouseButton(S);_&&this._disposePointer(_)}if((g.buttons&V.LEFT)===V.LEFT&&this._lockedPointer)return;const A={pointerId:g.pointerId,clientX:g.clientX,clientY:g.clientY,deltaX:0,deltaY:0,mouseButton:S};this._activePointers.push(A),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",p),this._isDragging=!0,y(g)},r=g=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const _=this._domElement.getBoundingClientRect(),x=g.clientX/_.width,D=g.clientY/_.height;if(x<this._interactiveArea.left||x>this._interactiveArea.right||D<this._interactiveArea.top||D>this._interactiveArea.bottom)return}const S=(g.buttons&V.LEFT)===V.LEFT?V.LEFT:(g.buttons&V.MIDDLE)===V.MIDDLE?V.MIDDLE:(g.buttons&V.RIGHT)===V.RIGHT?V.RIGHT:null;if(S!==null){const _=this._findPointerByMouseButton(S);_&&this._disposePointer(_)}const A={pointerId:1,clientX:g.clientX,clientY:g.clientY,deltaX:0,deltaY:0,mouseButton:(g.buttons&V.LEFT)===V.LEFT?V.LEFT:(g.buttons&V.MIDDLE)===V.LEFT?V.MIDDLE:(g.buttons&V.RIGHT)===V.LEFT?V.RIGHT:null};this._activePointers.push(A),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.addEventListener("mousemove",h),this._domElement.ownerDocument.addEventListener("mouseup",d),this._isDragging=!0,y(g)},a=g=>{g.cancelable&&g.preventDefault();const S=g.pointerId,A=this._lockedPointer||this._findPointerById(S);if(A){if(A.clientX=g.clientX,A.clientY=g.clientY,A.deltaX=g.movementX,A.deltaY=g.movementY,this._state=0,g.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(g.buttons&V.LEFT)===V.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(g.buttons&V.MIDDLE)===V.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(g.buttons&V.RIGHT)===V.RIGHT&&(this._state=this._state|this.mouseButtons.right);v()}},h=g=>{const S=this._lockedPointer||this._findPointerById(1);S&&(S.clientX=g.clientX,S.clientY=g.clientY,S.deltaX=g.movementX,S.deltaY=g.movementY,this._state=0,(this._lockedPointer||(g.buttons&V.LEFT)===V.LEFT)&&(this._state=this._state|this.mouseButtons.left),(g.buttons&V.MIDDLE)===V.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(g.buttons&V.RIGHT)===V.RIGHT&&(this._state=this._state|this.mouseButtons.right),v())},p=g=>{const S=this._findPointerById(g.pointerId);if(!(S&&S===this._lockedPointer)){if(S&&this._disposePointer(S),g.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=P.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=P.NONE;M()}},d=()=>{const g=this._findPointerById(1);g&&g===this._lockedPointer||(g&&this._disposePointer(g),this._state=P.NONE,M())};let m=-1;const f=g=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===P.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const D=this._domElement.getBoundingClientRect(),k=g.clientX/D.width,I=g.clientY/D.height;if(k<this._interactiveArea.left||k>this._interactiveArea.right||I<this._interactiveArea.top||I>this._interactiveArea.bottom)return}if(g.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===P.ROTATE||this.mouseButtons.wheel===P.TRUCK){const D=performance.now();m-D<1e3&&this._getClientRect(this._elementRect),m=D}const S=jo?-1:-3,A=g.deltaMode===1?g.deltaY/S:g.deltaY/(S*10),_=this.dollyToCursor?(g.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,x=this.dollyToCursor?(g.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case P.ROTATE:{this._rotateInternal(g.deltaX,g.deltaY),this._isUserControllingRotate=!0;break}case P.TRUCK:{this._truckInternal(g.deltaX,g.deltaY,!1),this._isUserControllingTruck=!0;break}case P.OFFSET:{this._truckInternal(g.deltaX,g.deltaY,!0),this._isUserControllingOffset=!0;break}case P.DOLLY:{this._dollyInternal(-A,_,x),this._isUserControllingDolly=!0;break}case P.ZOOM:{this._zoomInternal(-A,_,x),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},w=g=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===ct.ACTION.NONE){const S=g instanceof PointerEvent?g.pointerId:(g instanceof MouseEvent,0),A=this._findPointerById(S);A&&this._disposePointer(A),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("mouseup",d);return}g.preventDefault()}},y=g=>{if(!this._enabled)return;if(Vt(this._activePointers,me),this._getClientRect(this._elementRect),s.copy(me),n.copy(me),this._activePointers.length>=2){const A=me.x-this._activePointers[1].clientX,_=me.y-this._activePointers[1].clientY,x=Math.sqrt(A*A+_*_);i.set(0,x);const D=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,k=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;n.set(D,k)}if(this._state=0,!g)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in g&&g.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(g.buttons&V.LEFT)===V.LEFT&&(this._state=this._state|this.mouseButtons.left),(g.buttons&V.MIDDLE)===V.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(g.buttons&V.RIGHT)===V.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&P.ROTATE)===P.ROTATE||(this._state&P.TOUCH_ROTATE)===P.TOUCH_ROTATE||(this._state&P.TOUCH_DOLLY_ROTATE)===P.TOUCH_DOLLY_ROTATE||(this._state&P.TOUCH_ZOOM_ROTATE)===P.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&P.TRUCK)===P.TRUCK||(this._state&P.TOUCH_TRUCK)===P.TOUCH_TRUCK||(this._state&P.TOUCH_DOLLY_TRUCK)===P.TOUCH_DOLLY_TRUCK||(this._state&P.TOUCH_ZOOM_TRUCK)===P.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&P.DOLLY)===P.DOLLY||(this._state&P.TOUCH_DOLLY)===P.TOUCH_DOLLY||(this._state&P.TOUCH_DOLLY_TRUCK)===P.TOUCH_DOLLY_TRUCK||(this._state&P.TOUCH_DOLLY_OFFSET)===P.TOUCH_DOLLY_OFFSET||(this._state&P.TOUCH_DOLLY_ROTATE)===P.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&P.ZOOM)===P.ZOOM||(this._state&P.TOUCH_ZOOM)===P.TOUCH_ZOOM||(this._state&P.TOUCH_ZOOM_TRUCK)===P.TOUCH_ZOOM_TRUCK||(this._state&P.TOUCH_ZOOM_OFFSET)===P.TOUCH_ZOOM_OFFSET||(this._state&P.TOUCH_ZOOM_ROTATE)===P.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&P.OFFSET)===P.OFFSET||(this._state&P.TOUCH_OFFSET)===P.TOUCH_OFFSET||(this._state&P.TOUCH_DOLLY_OFFSET)===P.TOUCH_DOLLY_OFFSET||(this._state&P.TOUCH_ZOOM_OFFSET)===P.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},v=()=>{if(!this._enabled)return;Vt(this._activePointers,me);const S=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,A=S?-S.deltaX:n.x-me.x,_=S?-S.deltaY:n.y-me.y;if(n.copy(me),((this._state&P.ROTATE)===P.ROTATE||(this._state&P.TOUCH_ROTATE)===P.TOUCH_ROTATE||(this._state&P.TOUCH_DOLLY_ROTATE)===P.TOUCH_DOLLY_ROTATE||(this._state&P.TOUCH_ZOOM_ROTATE)===P.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(A,_),this._isUserControllingRotate=!0),(this._state&P.DOLLY)===P.DOLLY||(this._state&P.ZOOM)===P.ZOOM){const x=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,D=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0,k=this.dollyDragInverted?-1:1;(this._state&P.DOLLY)===P.DOLLY?(this._dollyInternal(k*_*ft,x,D),this._isUserControllingDolly=!0):(this._zoomInternal(k*_*ft,x,D),this._isUserControllingZoom=!0)}if((this._state&P.TOUCH_DOLLY)===P.TOUCH_DOLLY||(this._state&P.TOUCH_ZOOM)===P.TOUCH_ZOOM||(this._state&P.TOUCH_DOLLY_TRUCK)===P.TOUCH_DOLLY_TRUCK||(this._state&P.TOUCH_ZOOM_TRUCK)===P.TOUCH_ZOOM_TRUCK||(this._state&P.TOUCH_DOLLY_OFFSET)===P.TOUCH_DOLLY_OFFSET||(this._state&P.TOUCH_ZOOM_OFFSET)===P.TOUCH_ZOOM_OFFSET||(this._state&P.TOUCH_DOLLY_ROTATE)===P.TOUCH_DOLLY_ROTATE||(this._state&P.TOUCH_ZOOM_ROTATE)===P.TOUCH_ZOOM_ROTATE){const x=me.x-this._activePointers[1].clientX,D=me.y-this._activePointers[1].clientY,k=Math.sqrt(x*x+D*D),I=i.y-k;i.set(0,k);const B=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,R=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&P.TOUCH_DOLLY)===P.TOUCH_DOLLY||(this._state&P.TOUCH_DOLLY_ROTATE)===P.TOUCH_DOLLY_ROTATE||(this._state&P.TOUCH_DOLLY_TRUCK)===P.TOUCH_DOLLY_TRUCK||(this._state&P.TOUCH_DOLLY_OFFSET)===P.TOUCH_DOLLY_OFFSET?(this._dollyInternal(I*ft,B,R),this._isUserControllingDolly=!0):(this._zoomInternal(I*ft,B,R),this._isUserControllingZoom=!0)}((this._state&P.TRUCK)===P.TRUCK||(this._state&P.TOUCH_TRUCK)===P.TOUCH_TRUCK||(this._state&P.TOUCH_DOLLY_TRUCK)===P.TOUCH_DOLLY_TRUCK||(this._state&P.TOUCH_ZOOM_TRUCK)===P.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(A,_,!1),this._isUserControllingTruck=!0),((this._state&P.OFFSET)===P.OFFSET||(this._state&P.TOUCH_OFFSET)===P.TOUCH_OFFSET||(this._state&P.TOUCH_DOLLY_OFFSET)===P.TOUCH_DOLLY_OFFSET||(this._state&P.TOUCH_ZOOM_OFFSET)===P.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(A,_,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},M=()=>{Vt(this._activePointers,me),n.copy(me),(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.ownerDocument.removeEventListener("mouseup",d),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",L),this._domElement.ownerDocument.addEventListener("pointerlockerror",b),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",p),y())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",L),this._domElement.ownerDocument.removeEventListener("pointerlockerror",b))};const L=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},b=()=>{this.unlockPointer()};this._addAllEventListeners=g=>{this._domElement=g,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",o),Xo&&this._domElement.addEventListener("mousedown",r),this._domElement.addEventListener("pointercancel",p),this._domElement.addEventListener("wheel",f,{passive:!1}),this._domElement.addEventListener("contextmenu",w)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",o),this._domElement.removeEventListener("mousedown",r),this._domElement.removeEventListener("pointercancel",p),this._domElement.removeEventListener("wheel",f,{passive:!1}),this._domElement.removeEventListener("contextmenu",w),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.removeEventListener("pointerlockchange",L),this._domElement.ownerDocument.removeEventListener("pointerlockerror",b))},this.cancel=()=>{this._state!==P.NONE&&(this._state=P.NONE,this._activePointers.length=0,M())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=Ae(e.width,0,1),this._interactiveArea.height=Ae(e.height,0,1),this._interactiveArea.x=Ae(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=Ae(e.x,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,s=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,s)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,s=!1){this._isUserControllingRotate=!1;const n=Ae(e,this.minAzimuthAngle,this.maxAzimuthAngle),i=Ae(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=n,this._sphericalEnd.phi=i,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,s||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!s||J(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&J(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(o)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Je.NONE,this._changedDolly=0,this._dollyToNoClamp(Ae(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const s=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const o=this._collisionTest(),r=J(o,this._spherical.radius);if(!(s>e)&&r)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,o)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const i=!t||J(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(i)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(at).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const s=!t||J(this._target.x,this._targetEnd.x,this.restThreshold)&&J(this._target.y,this._targetEnd.y,this.restThreshold)&&J(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=Ae(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const s=!t||J(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(s)}pan(e,t,s=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,s)}truck(e,t,s=!1){this._camera.updateMatrix(),Te.setFromMatrixColumn(this._camera.matrix,0),Le.setFromMatrixColumn(this._camera.matrix,1),Te.multiplyScalar(e),Le.multiplyScalar(-t);const n=Y.copy(Te).add(Le),i=W.copy(this._targetEnd).add(n);return this.moveTo(i.x,i.y,i.z,s)}forward(e,t=!1){Y.setFromMatrixColumn(this._camera.matrix,0),Y.crossVectors(this._camera.up,Y),Y.multiplyScalar(e);const s=W.copy(this._targetEnd).add(Y);return this.moveTo(s.x,s.y,s.z,t)}elevate(e,t=!1){return Y.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+Y.x,this._targetEnd.y+Y.y,this._targetEnd.z+Y.z,t)}moveTo(e,t,s,n=!1){this._isUserControllingTruck=!1;const i=Y.set(e,t,s).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,i,this.boundaryFriction),this._needsUpdate=!0,n||this._target.copy(this._targetEnd);const o=!n||J(this._target.x,this._targetEnd.x,this.restThreshold)&&J(this._target.y,this._targetEnd.y,this.restThreshold)&&J(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(e,t,s,n=!1){const r=Y.set(e,t,s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(r.x,r.y,r.z,n)}fitToBox(e,t,{cover:s=!1,paddingLeft:n=0,paddingRight:i=0,paddingBottom:o=0,paddingTop:r=0}={}){const a=[],h=e.isBox3?et.copy(e):et.setFromObject(e);h.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const p=Ns(this._sphericalEnd.theta,Bs),d=Ns(this._sphericalEnd.phi,Bs);a.push(this.rotateTo(p,d,t));const m=Y.setFromSpherical(this._sphericalEnd).normalize(),f=js.setFromUnitVectors(m,zt),w=J(Math.abs(m.y),1);w&&f.multiply(Gt.setFromAxisAngle(gt,p)),f.multiply(this._yAxisUpSpaceInverse);const y=Ys.makeEmpty();W.copy(h.min).applyQuaternion(f),y.expandByPoint(W),W.copy(h.min).setX(h.max.x).applyQuaternion(f),y.expandByPoint(W),W.copy(h.min).setY(h.max.y).applyQuaternion(f),y.expandByPoint(W),W.copy(h.max).setZ(h.min.z).applyQuaternion(f),y.expandByPoint(W),W.copy(h.min).setZ(h.max.z).applyQuaternion(f),y.expandByPoint(W),W.copy(h.max).setY(h.min.y).applyQuaternion(f),y.expandByPoint(W),W.copy(h.max).setX(h.min.x).applyQuaternion(f),y.expandByPoint(W),W.copy(h.max).applyQuaternion(f),y.expandByPoint(W),y.min.x-=n,y.min.y-=o,y.max.x+=i,y.max.y+=r,f.setFromUnitVectors(zt,m),w&&f.premultiply(Gt.invert()),f.premultiply(this._yAxisUpSpace);const v=y.getSize(Y),M=y.getCenter(W).applyQuaternion(f);if(Ye(this._camera)){const L=this.getDistanceToFitBox(v.x,v.y,v.z,s);a.push(this.moveTo(M.x,M.y,M.z,t)),a.push(this.dollyTo(L,t)),a.push(this.setFocalOffset(0,0,0,t))}else if(Ue(this._camera)){const L=this._camera,b=L.right-L.left,g=L.top-L.bottom,S=s?Math.max(b/v.x,g/v.y):Math.min(b/v.x,g/v.y);a.push(this.moveTo(M.x,M.y,M.z,t)),a.push(this.zoomTo(S,t)),a.push(this.setFocalOffset(0,0,0,t))}return Promise.all(a)}fitToSphere(e,t){const s=[],i=e instanceof N.Sphere?Rt.copy(e):ct.createBoundingSphere(e,Rt);if(s.push(this.moveTo(i.center.x,i.center.y,i.center.z,t)),Ye(this._camera)){const o=this.getDistanceToFitSphere(i.radius);s.push(this.dollyTo(o,t))}else if(Ue(this._camera)){const o=this._camera.right-this._camera.left,r=this._camera.top-this._camera.bottom,a=2*i.radius,h=Math.min(o/a,r/a);s.push(this.zoomTo(h,t))}return s.push(this.setFocalOffset(0,0,0,t)),Promise.all(s)}setLookAt(e,t,s,n,i,o,r=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Je.NONE,this._changedDolly=0;const a=W.set(n,i,o),h=Y.set(e,t,s);this._targetEnd.copy(a),this._sphericalEnd.setFromVector3(h.sub(a).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,r||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const p=!r||J(this._target.x,this._targetEnd.x,this.restThreshold)&&J(this._target.y,this._targetEnd.y,this.restThreshold)&&J(this._target.z,this._targetEnd.z,this.restThreshold)&&J(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&J(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&J(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(p)}lerpLookAt(e,t,s,n,i,o,r,a,h,p,d,m,f,w=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Je.NONE,this._changedDolly=0;const y=Y.set(n,i,o),v=W.set(e,t,s);we.setFromVector3(v.sub(y).applyQuaternion(this._yAxisUpSpace));const M=$e.set(p,d,m),L=W.set(r,a,h);lt.setFromVector3(L.sub(M).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(y.lerp(M,f));const b=lt.theta-we.theta,g=lt.phi-we.phi,S=lt.radius-we.radius;this._sphericalEnd.set(we.radius+S*f,we.phi+g*f,we.theta+b*f),this.normalizeRotations(),this._needsUpdate=!0,w||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const A=!w||J(this._target.x,this._targetEnd.x,this.restThreshold)&&J(this._target.y,this._targetEnd.y,this.restThreshold)&&J(this._target.z,this._targetEnd.z,this.restThreshold)&&J(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&J(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&J(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(A)}setPosition(e,t,s,n=!1){return this.setLookAt(e,t,s,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,n)}setTarget(e,t,s,n=!1){const i=this.getPosition(Y),o=this.setLookAt(i.x,i.y,i.z,e,t,s,n);return this._sphericalEnd.phi=Ae(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(e,t,s,n=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,s),this._needsUpdate=!0,n||this._focalOffset.copy(this._focalOffsetEnd);const i=!n||J(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&J(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&J(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}setOrbitPoint(e,t,s){this._camera.updateMatrixWorld(),Te.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Le.setFromMatrixColumn(this._camera.matrixWorldInverse,1),je.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const n=Y.set(e,t,s),i=n.distanceTo(this._camera.position),o=n.sub(this._camera.position);Te.multiplyScalar(o.x),Le.multiplyScalar(o.y),je.multiplyScalar(o.z),Y.copy(Te).add(Le).add(je),Y.z=Y.z+i,this.dollyTo(i,!1),this.setFocalOffset(-Y.x,Y.y,-Y.z,!1),this.moveTo(e,t,s,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,s,n){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new N.Vector4,typeof e=="number"?this._viewport.set(e,t,s,n):this._viewport.copy(e)}getDistanceToFitBox(e,t,s,n=!1){if(Et(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const i=e/t,o=this._camera.getEffectiveFOV()*it,r=this._camera.aspect;return((n?i>r:i<r)?t:e/r)*.5/Math.tan(o*.5)+s*.5}getDistanceToFitSphere(e){if(Et(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*it,s=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,n=1<this._camera.aspect?t:s;return e/Math.sin(n*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new N.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new N.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e&&e instanceof N.Spherical?e:new N.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new N.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%He,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=He),this._spherical.theta+=He*Math.round((this._sphericalEnd.theta-this._spherical.theta)/He)}reset(e=!1){if(!J(this._camera.up.x,this._cameraUp0.x)||!J(this._camera.up.y,this._cameraUp0.y)||!J(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const s=this.getPosition(Y);this.updateCameraUp(),this.setPosition(s.x,s.y,s.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,gt),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=Y.subVectors(this._target,this._camera.position).normalize(),t=W.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const s=this.getPosition(Y);this.updateCameraUp(),this.setPosition(s.x,s.y,s.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,s=this._sphericalEnd.phi-this._spherical.phi,n=this._sphericalEnd.radius-this._spherical.radius,i=Rs.subVectors(this._targetEnd,this._target),o=Gs.subVectors(this._focalOffsetEnd,this._focalOffset),r=this._zoomEnd-this._zoom;if(te(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=mt(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,d,1/0,e),this._needsUpdate=!0}if(te(s))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=mt(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,d,1/0,e),this._needsUpdate=!0}if(te(n))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const d=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=mt(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,d,this.maxSpeed,e),this._needsUpdate=!0}if(te(i.x)&&te(i.y)&&te(i.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const d=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;Vs(this._target,this._targetEnd,this._targetVelocity,d,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(te(o.x)&&te(o.y)&&te(o.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const d=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;Vs(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,d,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(te(r))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const d=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=mt(this._zoom,this._zoomEnd,this._zoomVelocity,d,1/0,e)}if(this.dollyToCursor){if(Ye(this._camera)&&this._changedDolly!==0){const d=this._spherical.radius-this._lastDistance,m=this._camera,f=this._getCameraDirection(at),w=Y.copy(f).cross(m.up).normalize();w.lengthSq()===0&&(w.x=1);const y=W.crossVectors(w,f),v=this._sphericalEnd.radius*Math.tan(m.getEffectiveFOV()*it*.5),L=(this._sphericalEnd.radius-d-this._sphericalEnd.radius)/this._sphericalEnd.radius,b=$e.copy(this._targetEnd).add(w.multiplyScalar(this._dollyControlCoord.x*v*m.aspect)).add(y.multiplyScalar(this._dollyControlCoord.y*v)),g=Y.copy(this._targetEnd).lerp(b,L),S=this._lastDollyDirection===Je.IN&&this._spherical.radius<=this.minDistance,A=this._lastDollyDirection===Je.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(S||A)){this._sphericalEnd.radius-=d,this._spherical.radius-=d;const x=W.copy(f).multiplyScalar(-d);g.add(x)}this._boundary.clampPoint(g,g);const _=W.subVectors(g,this._targetEnd);this._targetEnd.copy(g),this._target.add(_),this._changedDolly-=d,te(this._changedDolly)&&(this._changedDolly=0)}else if(Ue(this._camera)&&this._changedZoom!==0){const d=this._zoom-this._lastZoom,m=this._camera,f=Y.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(m.near+m.far)/(m.near-m.far)).unproject(m),w=W.set(0,0,-1).applyQuaternion(m.quaternion),y=$e.copy(f).add(w.multiplyScalar(-f.dot(m.up))),M=-(this._zoom-d-this._zoom)/this._zoom,L=this._getCameraDirection(at),b=this._targetEnd.dot(L),g=Y.copy(this._targetEnd).lerp(y,M),S=g.dot(L),A=L.multiplyScalar(S-b);g.sub(A),this._boundary.clampPoint(g,g);const _=W.subVectors(g,this._targetEnd);this._targetEnd.copy(g),this._target.add(_),this._changedZoom-=d,te(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0);const a=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,a),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!te(this._focalOffset.x)||!te(this._focalOffset.y)||!te(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),Te.setFromMatrixColumn(this._camera.matrix,0),Le.setFromMatrixColumn(this._camera.matrix,1),je.setFromMatrixColumn(this._camera.matrix,2),Te.multiplyScalar(this._focalOffset.x),Le.multiplyScalar(-this._focalOffset.y),je.multiplyScalar(this._focalOffset.z),Y.copy(Te).add(Le).add(je),this._camera.position.add(Y)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),Y.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const p=this._needsUpdate;return p&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):p?(this.dispatchEvent({type:"update"}),te(t,this.restThreshold)&&te(s,this.restThreshold)&&te(n,this.restThreshold)&&te(i.x,this.restThreshold)&&te(i.y,this.restThreshold)&&te(i.z,this.restThreshold)&&te(o.x,this.restThreshold)&&te(o.y,this.restThreshold)&&te(o.z,this.restThreshold)&&te(r,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!p&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=p,this._needsUpdate=!1,p}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:ot(this.maxDistance),minZoom:this.minZoom,maxZoom:ot(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:ot(this.maxPolarAngle),minAzimuthAngle:ot(this.minAzimuthAngle),maxAzimuthAngle:ot(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,verticalDragToForward:this.verticalDragToForward,target:this._targetEnd.toArray(),position:Y.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(e,t=!1){const s=JSON.parse(e);this.enabled=s.enabled,this.minDistance=s.minDistance,this.maxDistance=rt(s.maxDistance),this.minZoom=s.minZoom,this.maxZoom=rt(s.maxZoom),this.minPolarAngle=s.minPolarAngle,this.maxPolarAngle=rt(s.maxPolarAngle),this.minAzimuthAngle=rt(s.minAzimuthAngle),this.maxAzimuthAngle=rt(s.maxAzimuthAngle),this.smoothTime=s.smoothTime,this.draggingSmoothTime=s.draggingSmoothTime,this.dollySpeed=s.dollySpeed,this.truckSpeed=s.truckSpeed,this.dollyToCursor=s.dollyToCursor,this.verticalDragToForward=s.verticalDragToForward,this._target0.fromArray(s.target0),this._position0.fromArray(s.position0),this._zoom0=s.zoom0,this._focalOffset0.fromArray(s.focalOffset0),this.moveTo(s.target[0],s.target[1],s.target[2],t),we.setFromVector3(Y.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(we.theta,we.phi,t),this.dollyTo(we.radius,t),this.zoomTo(s.zoom,t),this.setFocalOffset(s.focalOffset[0],s.focalOffset[1],s.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",Yo),this._addAllEventListeners(e)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,s){const n=t.lengthSq();if(n===0)return e;const i=W.copy(t).add(e),r=this._boundary.clampPoint(i,$e).sub(i),a=r.lengthSq();if(a===0)return e.add(t);if(a===n)return e;if(s===0)return e.add(t).add(r);{const h=1+s*a/t.dot(r);return e.add(W.copy(t).multiplyScalar(h)).add(r.multiplyScalar(1-s))}}_updateNearPlaneCorners(){if(Ye(this._camera)){const e=this._camera,t=e.near,s=e.getEffectiveFOV()*it,n=Math.tan(s*.5)*t,i=n*e.aspect;this._nearPlaneCorners[0].set(-i,-n,0),this._nearPlaneCorners[1].set(i,-n,0),this._nearPlaneCorners[2].set(i,n,0),this._nearPlaneCorners[3].set(-i,n,0)}else if(Ue(this._camera)){const e=this._camera,t=1/e.zoom,s=e.left*t,n=e.right*t,i=e.top*t,o=e.bottom*t;this._nearPlaneCorners[0].set(s,i,0),this._nearPlaneCorners[1].set(n,i,0),this._nearPlaneCorners[2].set(n,o,0),this._nearPlaneCorners[3].set(s,o,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Et(this._camera,"_collisionTest"))return e;const s=this._getTargetDirection(at);Yt.lookAt(zs,s,this._camera.up);for(let n=0;n<4;n++){const i=W.copy(this._nearPlaneCorners[n]);i.applyMatrix4(Yt);const o=$e.addVectors(this._target,i);yt.set(o,s),yt.far=this._spherical.radius+1;const r=yt.intersectObjects(this.colliderMeshes);r.length!==0&&r[0].distance<e&&(e=r[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const s=()=>{this.removeEventListener("rest",s),t()};this.addEventListener("rest",s)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new N.Sphere){const s=t,n=s.center;et.makeEmpty(),e.traverseVisible(o=>{o.isMesh&&et.expandByObject(o)}),et.getCenter(n);let i=0;return e.traverseVisible(o=>{if(!o.isMesh)return;const r=o,a=r.geometry.clone();a.applyMatrix4(r.matrixWorld);const p=a.attributes.position;for(let d=0,m=p.count;d<m;d++)Y.fromBufferAttribute(p,d),i=Math.max(i,n.distanceToSquared(Y))}),s.radius=Math.sqrt(i),s}}const Zo=["min-polar-angle","max-polar-angle","min-azimuth-angle","max-azimuth-angle","min-distance","max-distance","infinity-dolly","min-zoom","max-zoom","smooth-time","dragging-smooth-time","max-speed","azimuth-rotate-speed","polar-rotate-speed","dolly-speed","dolly-drag-inverted","truck-speed","dolly-to-cursor","drag-to-offset","vertical-drag-to-forward","boundary-friction","rest-threshold","collider-meshes","args"],Qo=u.defineComponent({__name:"CameraControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},minPolarAngle:{default:0},maxPolarAngle:{default:Math.PI},minAzimuthAngle:{default:-1/0},maxAzimuthAngle:{default:1/0},minDistance:{default:Number.EPSILON},maxDistance:{default:1/0},infinityDolly:{type:Boolean,default:!1},minZoom:{default:.01},maxZoom:{default:1/0},smoothTime:{default:.25},draggingSmoothTime:{default:.125},maxSpeed:{default:1/0},azimuthRotateSpeed:{default:1},polarRotateSpeed:{default:1},dollySpeed:{default:1},dollyDragInverted:{type:Boolean,default:!1},truckSpeed:{default:2},dollyToCursor:{type:Boolean,default:!1},dragToOffset:{type:Boolean,default:!1},verticalDragToForward:{type:Boolean,default:!1},boundaryFriction:{default:0},restThreshold:{default:.01},colliderMeshes:{default:()=>[]},mouseButtons:{},touches:{}},emits:["change","start","end"],setup(l,{expose:e,emit:t}){const s=l,{makeDefault:n,minPolarAngle:i,maxPolarAngle:o,minAzimuthAngle:r,maxAzimuthAngle:a,minDistance:h,maxDistance:p,infinityDolly:d,minZoom:m,maxZoom:f,smoothTime:w,draggingSmoothTime:y,maxSpeed:v,azimuthRotateSpeed:M,polarRotateSpeed:L,dollySpeed:b,dollyDragInverted:g,truckSpeed:S,dollyToCursor:A,dragToOffset:_,verticalDragToForward:x,boundaryFriction:D,restThreshold:k,colliderMeshes:I}=u.toRefs(s),B={Box3:c.Box3,MathUtils:{clamp:c.MathUtils.clamp},Matrix4:c.Matrix4,Quaternion:c.Quaternion,Raycaster:c.Raycaster,Sphere:c.Sphere,Spherical:c.Spherical,Vector2:c.Vector2,Vector3:c.Vector3,Vector4:c.Vector4};ct.install({THREE:B});const{camera:R,renderer:H,extend:G,controls:se}=q.useTresContext(),X=u.ref(null);G({CameraControls:ct}),u.watchEffect(()=>{le(),X.value&&n.value?se.value=X.value:se.value=null});function le(){ae(X.value,"update",()=>t("change",X.value)),ae(X.value,"controlend",()=>t("end",X.value)),ae(X.value,"controlstart",()=>t("start",X.value))}const{onLoop:oe}=q.useRenderLoop();return oe(({delta:$})=>{var Q,K;(Q=X.value)!=null&&Q.enabled&&((K=X.value)==null||K.update($))}),u.onUnmounted(()=>{X.value&&X.value.disconnect()}),e({value:X}),($,Q)=>{var K;return u.unref(R)&&u.unref(H)?(u.openBlock(),u.createElementBlock("TresCameraControls",{key:0,ref_key:"controlsRef",ref:X,"min-polar-angle":u.unref(i),"max-polar-angle":u.unref(o),"min-azimuth-angle":u.unref(r),"max-azimuth-angle":u.unref(a),"min-distance":u.unref(h),"max-distance":u.unref(p),"infinity-dolly":u.unref(d),"min-zoom":u.unref(m),"max-zoom":u.unref(f),"smooth-time":u.unref(w),"dragging-smooth-time":u.unref(y),"max-speed":u.unref(v),"azimuth-rotate-speed":u.unref(M),"polar-rotate-speed":u.unref(L),"dolly-speed":u.unref(b),"dolly-drag-inverted":u.unref(g),"truck-speed":u.unref(S),"dolly-to-cursor":u.unref(A),"drag-to-offset":u.unref(_),"vertical-drag-to-forward":u.unref(x),"boundary-friction":u.unref(D),"rest-threshold":u.unref(k),"collider-meshes":u.unref(I),args:[u.unref(R)||$.camera,((K=u.unref(H))==null?void 0:K.domElement)||$.domElement]},null,8,Zo)):u.createCommentVNode("",!0)}}});class Ko extends c.MeshStandardMaterial{constructor(t={}){super(t);re(this,"_time");re(this,"_factor");this.setValues(t),this._time={value:0},this._factor={value:1}}onBeforeCompile(t){t.uniforms||(t.uniforms={}),t.uniforms.time=this._time,t.uniforms.factor=this._factor,t.vertexShader=`
|
|
84
|
+
*/const ie={LEFT:1,RIGHT:2,MIDDLE:4},V=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),pt={NONE:0,IN:1,OUT:-1};function ot(c){return c.isPerspectiveCamera}function Je(c){return c.isOrthographicCamera}const dt=Math.PI*2,Hs=Math.PI/2,$s=1e-5,xt=Math.PI/180;function Ve(c,e,t){return Math.max(e,Math.min(t,c))}function xe(c,e=$s){return Math.abs(c)<e}function _e(c,e,t=$s){return xe(c-e,t)}function en(c,e){return Math.round(c/e)*e}function bt(c){return isFinite(c)?c:c<0?-Number.MAX_VALUE:Number.MAX_VALUE}function vt(c){return Math.abs(c)<Number.MAX_VALUE?c:c*(1/0)}function Ot(c,e,t,s,n=1/0,o){s=Math.max(1e-4,s);const i=2/s,r=i*o,a=1/(1+r+.48*r*r+.235*r*r*r);let h=c-e;const d=e,p=n*s;h=Ve(h,-p,p),e=c-h;const m=(t.value+i*h)*o;t.value=(t.value-i*m)*a;let g=e+(h+m)*a;return d-c>0==g>d&&(g=d,t.value=(g-d)/o),g}function tn(c,e,t,s,n=1/0,o,i){s=Math.max(1e-4,s);const r=2/s,a=r*o,h=1/(1+a+.48*a*a+.235*a*a*a);let d=e.x,p=e.y,m=e.z,g=c.x-d,A=c.y-p,b=c.z-m;const _=d,M=p,L=m,w=n*s,y=w*w,C=g*g+A*A+b*b;if(C>y){const Q=Math.sqrt(C);g=g/Q*w,A=A/Q*w,b=b/Q*w}d=c.x-g,p=c.y-A,m=c.z-b;const T=(t.x+r*g)*o,x=(t.y+r*A)*o,v=(t.z+r*b)*o;t.x=(t.x-r*T)*h,t.y=(t.y-r*x)*h,t.z=(t.z-r*v)*h,i.x=d+(g+T)*h,i.y=p+(A+x)*h,i.z=m+(b+v)*h;const D=_-c.x,z=M-c.y,U=L-c.z,R=i.x-_,K=i.y-M,J=i.z-L;return D*R+z*K+U*J>0&&(i.x=_,i.y=M,i.z=L,t.x=(i.x-_)/o,t.y=(i.y-M)/o,t.z=(i.z-L)/o),i}function ns(c,e){e.set(0,0),c.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=c.length,e.y/=c.length}function os(c,e){return Je(c)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class Ri{constructor(){this._listeners={}}addEventListener(e,t){const s=this._listeners;s[e]===void 0&&(s[e]=[]),s[e].indexOf(t)===-1&&s[e].push(t)}hasEventListener(e,t){const s=this._listeners;return s[e]!==void 0&&s[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners[e];if(n!==void 0){const o=n.indexOf(t);o!==-1&&n.splice(o,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const s=this._listeners[e.type];if(s!==void 0){e.target=this;const n=s.slice(0);for(let o=0,i=n.length;o<i;o++)n[o].call(this,e)}}}const Gi="2.7.1",It=1/8,sn=typeof window<"u",Ei=sn&&/Mac/.test(navigator.platform),ji=!(sn&&"PointerEvent"in window);let ne,nn,Dt,is,Ie,he,ye,ft,At,Ge,Ee,it,on,rn,Be,Mt,mt,an,rs,ln,as,ls,kt;class St extends Ri{static install(e){ne=e.THREE,nn=Object.freeze(new ne.Vector3(0,0,0)),Dt=Object.freeze(new ne.Vector3(0,1,0)),is=Object.freeze(new ne.Vector3(0,0,1)),Ie=new ne.Vector2,he=new ne.Vector3,ye=new ne.Vector3,ft=new ne.Vector3,At=new ne.Vector3,Ge=new ne.Vector3,Ee=new ne.Vector3,it=new ne.Vector3,on=new ne.Vector3,rn=new ne.Vector3,Be=new ne.Spherical,Mt=new ne.Spherical,mt=new ne.Box3,an=new ne.Box3,rs=new ne.Sphere,ln=new ne.Quaternion,as=new ne.Quaternion,ls=new ne.Matrix4,kt=new ne.Raycaster}static get ACTION(){return V}constructor(e,t){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.verticalDragToForward=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=V.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=pt.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new ne.Vector3,this._focalOffsetVelocity=new ne.Vector3,this._zoomVelocity={value:0},this._truckInternal=(y,C,T)=>{let x,v;if(ot(this._camera)){const D=he.copy(this._camera.position).sub(this._target),z=this._camera.getEffectiveFOV()*xt,U=D.length()*Math.tan(z*.5);x=this.truckSpeed*y*U/this._elementRect.height,v=this.truckSpeed*C*U/this._elementRect.height}else if(Je(this._camera)){const D=this._camera;x=y*(D.right-D.left)/D.zoom/this._elementRect.width,v=C*(D.top-D.bottom)/D.zoom/this._elementRect.height}else return;this.verticalDragToForward?(T?this.setFocalOffset(this._focalOffsetEnd.x+x,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(x,0,!0),this.forward(-v,!0)):T?this.setFocalOffset(this._focalOffsetEnd.x+x,this._focalOffsetEnd.y+v,this._focalOffsetEnd.z,!0):this.truck(x,v,!0)},this._rotateInternal=(y,C)=>{const T=dt*this.azimuthRotateSpeed*y/this._elementRect.height,x=dt*this.polarRotateSpeed*C/this._elementRect.height;this.rotate(T,x,!0)},this._dollyInternal=(y,C,T)=>{const x=Math.pow(.95,-y*this.dollySpeed),v=this._sphericalEnd.radius,D=this._sphericalEnd.radius*x,z=Ve(D,this.minDistance,this.maxDistance),U=z-D;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(D,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(U,!0),this._dollyToNoClamp(z,!0)):this._dollyToNoClamp(z,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?D:z)-v,this._dollyControlCoord.set(C,T)),this._lastDollyDirection=Math.sign(-y)},this._zoomInternal=(y,C,T)=>{const x=Math.pow(.95,y*this.dollySpeed),v=this._zoom,D=this._zoom*x;this.zoomTo(D,!0),this.dollyToCursor&&(this._changedZoom+=D-v,this._dollyControlCoord.set(C,T))},typeof ne>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new ne.Quaternion().setFromUnitVectors(this._camera.up,Dt),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=V.NONE,this._target=new ne.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new ne.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new ne.Spherical().setFromVector3(he.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new ne.Vector3,new ne.Vector3,new ne.Vector3,new ne.Vector3],this._updateNearPlaneCorners(),this._boundary=new ne.Box3(new ne.Vector3(-1/0,-1/0,-1/0),new ne.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new ne.Vector2,this.mouseButtons={left:V.ROTATE,middle:V.DOLLY,right:V.TRUCK,wheel:ot(this._camera)?V.DOLLY:Je(this._camera)?V.ZOOM:V.NONE},this.touches={one:V.TOUCH_ROTATE,two:ot(this._camera)?V.TOUCH_DOLLY_TRUCK:Je(this._camera)?V.TOUCH_ZOOM_TRUCK:V.NONE,three:V.TOUCH_TRUCK};const s=new ne.Vector2,n=new ne.Vector2,o=new ne.Vector2,i=y=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const x=this._domElement.getBoundingClientRect(),v=y.clientX/x.width,D=y.clientY/x.height;if(v<this._interactiveArea.left||v>this._interactiveArea.right||D<this._interactiveArea.top||D>this._interactiveArea.bottom)return}const C=y.pointerType!=="mouse"?null:(y.buttons&ie.LEFT)===ie.LEFT?ie.LEFT:(y.buttons&ie.MIDDLE)===ie.MIDDLE?ie.MIDDLE:(y.buttons&ie.RIGHT)===ie.RIGHT?ie.RIGHT:null;if(C!==null){const x=this._findPointerByMouseButton(C);x&&this._disposePointer(x)}if((y.buttons&ie.LEFT)===ie.LEFT&&this._lockedPointer)return;const T={pointerId:y.pointerId,clientX:y.clientX,clientY:y.clientY,deltaX:0,deltaY:0,mouseButton:C};this._activePointers.push(T),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",d),this._isDragging=!0,b(y)},r=y=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const x=this._domElement.getBoundingClientRect(),v=y.clientX/x.width,D=y.clientY/x.height;if(v<this._interactiveArea.left||v>this._interactiveArea.right||D<this._interactiveArea.top||D>this._interactiveArea.bottom)return}const C=(y.buttons&ie.LEFT)===ie.LEFT?ie.LEFT:(y.buttons&ie.MIDDLE)===ie.MIDDLE?ie.MIDDLE:(y.buttons&ie.RIGHT)===ie.RIGHT?ie.RIGHT:null;if(C!==null){const x=this._findPointerByMouseButton(C);x&&this._disposePointer(x)}const T={pointerId:1,clientX:y.clientX,clientY:y.clientY,deltaX:0,deltaY:0,mouseButton:(y.buttons&ie.LEFT)===ie.LEFT?ie.LEFT:(y.buttons&ie.MIDDLE)===ie.LEFT?ie.MIDDLE:(y.buttons&ie.RIGHT)===ie.LEFT?ie.RIGHT:null};this._activePointers.push(T),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("mouseup",p),this._domElement.ownerDocument.addEventListener("mousemove",h),this._domElement.ownerDocument.addEventListener("mouseup",p),this._isDragging=!0,b(y)},a=y=>{y.cancelable&&y.preventDefault();const C=y.pointerId,T=this._lockedPointer||this._findPointerById(C);if(T){if(T.clientX=y.clientX,T.clientY=y.clientY,T.deltaX=y.movementX,T.deltaY=y.movementY,this._state=0,y.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(y.buttons&ie.LEFT)===ie.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(y.buttons&ie.MIDDLE)===ie.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(y.buttons&ie.RIGHT)===ie.RIGHT&&(this._state=this._state|this.mouseButtons.right);_()}},h=y=>{const C=this._lockedPointer||this._findPointerById(1);C&&(C.clientX=y.clientX,C.clientY=y.clientY,C.deltaX=y.movementX,C.deltaY=y.movementY,this._state=0,(this._lockedPointer||(y.buttons&ie.LEFT)===ie.LEFT)&&(this._state=this._state|this.mouseButtons.left),(y.buttons&ie.MIDDLE)===ie.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(y.buttons&ie.RIGHT)===ie.RIGHT&&(this._state=this._state|this.mouseButtons.right),_())},d=y=>{const C=this._findPointerById(y.pointerId);if(!(C&&C===this._lockedPointer)){if(C&&this._disposePointer(C),y.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=V.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=V.NONE;M()}},p=()=>{const y=this._findPointerById(1);y&&y===this._lockedPointer||(y&&this._disposePointer(y),this._state=V.NONE,M())};let m=-1;const g=y=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===V.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const D=this._domElement.getBoundingClientRect(),z=y.clientX/D.width,U=y.clientY/D.height;if(z<this._interactiveArea.left||z>this._interactiveArea.right||U<this._interactiveArea.top||U>this._interactiveArea.bottom)return}if(y.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===V.ROTATE||this.mouseButtons.wheel===V.TRUCK){const D=performance.now();m-D<1e3&&this._getClientRect(this._elementRect),m=D}const C=Ei?-1:-3,T=y.deltaMode===1?y.deltaY/C:y.deltaY/(C*10),x=this.dollyToCursor?(y.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,v=this.dollyToCursor?(y.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case V.ROTATE:{this._rotateInternal(y.deltaX,y.deltaY),this._isUserControllingRotate=!0;break}case V.TRUCK:{this._truckInternal(y.deltaX,y.deltaY,!1),this._isUserControllingTruck=!0;break}case V.OFFSET:{this._truckInternal(y.deltaX,y.deltaY,!0),this._isUserControllingOffset=!0;break}case V.DOLLY:{this._dollyInternal(-T,x,v),this._isUserControllingDolly=!0;break}case V.ZOOM:{this._zoomInternal(-T,x,v),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},A=y=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===St.ACTION.NONE){const C=y instanceof PointerEvent?y.pointerId:(y instanceof MouseEvent,0),T=this._findPointerById(C);T&&this._disposePointer(T),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("mouseup",p);return}y.preventDefault()}},b=y=>{if(!this._enabled)return;if(ns(this._activePointers,Ie),this._getClientRect(this._elementRect),s.copy(Ie),n.copy(Ie),this._activePointers.length>=2){const T=Ie.x-this._activePointers[1].clientX,x=Ie.y-this._activePointers[1].clientY,v=Math.sqrt(T*T+x*x);o.set(0,v);const D=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,z=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;n.set(D,z)}if(this._state=0,!y)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in y&&y.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(y.buttons&ie.LEFT)===ie.LEFT&&(this._state=this._state|this.mouseButtons.left),(y.buttons&ie.MIDDLE)===ie.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(y.buttons&ie.RIGHT)===ie.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&V.ROTATE)===V.ROTATE||(this._state&V.TOUCH_ROTATE)===V.TOUCH_ROTATE||(this._state&V.TOUCH_DOLLY_ROTATE)===V.TOUCH_DOLLY_ROTATE||(this._state&V.TOUCH_ZOOM_ROTATE)===V.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&V.TRUCK)===V.TRUCK||(this._state&V.TOUCH_TRUCK)===V.TOUCH_TRUCK||(this._state&V.TOUCH_DOLLY_TRUCK)===V.TOUCH_DOLLY_TRUCK||(this._state&V.TOUCH_ZOOM_TRUCK)===V.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&V.DOLLY)===V.DOLLY||(this._state&V.TOUCH_DOLLY)===V.TOUCH_DOLLY||(this._state&V.TOUCH_DOLLY_TRUCK)===V.TOUCH_DOLLY_TRUCK||(this._state&V.TOUCH_DOLLY_OFFSET)===V.TOUCH_DOLLY_OFFSET||(this._state&V.TOUCH_DOLLY_ROTATE)===V.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&V.ZOOM)===V.ZOOM||(this._state&V.TOUCH_ZOOM)===V.TOUCH_ZOOM||(this._state&V.TOUCH_ZOOM_TRUCK)===V.TOUCH_ZOOM_TRUCK||(this._state&V.TOUCH_ZOOM_OFFSET)===V.TOUCH_ZOOM_OFFSET||(this._state&V.TOUCH_ZOOM_ROTATE)===V.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&V.OFFSET)===V.OFFSET||(this._state&V.TOUCH_OFFSET)===V.TOUCH_OFFSET||(this._state&V.TOUCH_DOLLY_OFFSET)===V.TOUCH_DOLLY_OFFSET||(this._state&V.TOUCH_ZOOM_OFFSET)===V.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},_=()=>{if(!this._enabled)return;ns(this._activePointers,Ie);const C=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,T=C?-C.deltaX:n.x-Ie.x,x=C?-C.deltaY:n.y-Ie.y;if(n.copy(Ie),((this._state&V.ROTATE)===V.ROTATE||(this._state&V.TOUCH_ROTATE)===V.TOUCH_ROTATE||(this._state&V.TOUCH_DOLLY_ROTATE)===V.TOUCH_DOLLY_ROTATE||(this._state&V.TOUCH_ZOOM_ROTATE)===V.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(T,x),this._isUserControllingRotate=!0),(this._state&V.DOLLY)===V.DOLLY||(this._state&V.ZOOM)===V.ZOOM){const v=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,D=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0,z=this.dollyDragInverted?-1:1;(this._state&V.DOLLY)===V.DOLLY?(this._dollyInternal(z*x*It,v,D),this._isUserControllingDolly=!0):(this._zoomInternal(z*x*It,v,D),this._isUserControllingZoom=!0)}if((this._state&V.TOUCH_DOLLY)===V.TOUCH_DOLLY||(this._state&V.TOUCH_ZOOM)===V.TOUCH_ZOOM||(this._state&V.TOUCH_DOLLY_TRUCK)===V.TOUCH_DOLLY_TRUCK||(this._state&V.TOUCH_ZOOM_TRUCK)===V.TOUCH_ZOOM_TRUCK||(this._state&V.TOUCH_DOLLY_OFFSET)===V.TOUCH_DOLLY_OFFSET||(this._state&V.TOUCH_ZOOM_OFFSET)===V.TOUCH_ZOOM_OFFSET||(this._state&V.TOUCH_DOLLY_ROTATE)===V.TOUCH_DOLLY_ROTATE||(this._state&V.TOUCH_ZOOM_ROTATE)===V.TOUCH_ZOOM_ROTATE){const v=Ie.x-this._activePointers[1].clientX,D=Ie.y-this._activePointers[1].clientY,z=Math.sqrt(v*v+D*D),U=o.y-z;o.set(0,z);const R=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,K=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&V.TOUCH_DOLLY)===V.TOUCH_DOLLY||(this._state&V.TOUCH_DOLLY_ROTATE)===V.TOUCH_DOLLY_ROTATE||(this._state&V.TOUCH_DOLLY_TRUCK)===V.TOUCH_DOLLY_TRUCK||(this._state&V.TOUCH_DOLLY_OFFSET)===V.TOUCH_DOLLY_OFFSET?(this._dollyInternal(U*It,R,K),this._isUserControllingDolly=!0):(this._zoomInternal(U*It,R,K),this._isUserControllingZoom=!0)}((this._state&V.TRUCK)===V.TRUCK||(this._state&V.TOUCH_TRUCK)===V.TOUCH_TRUCK||(this._state&V.TOUCH_DOLLY_TRUCK)===V.TOUCH_DOLLY_TRUCK||(this._state&V.TOUCH_ZOOM_TRUCK)===V.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(T,x,!1),this._isUserControllingTruck=!0),((this._state&V.OFFSET)===V.OFFSET||(this._state&V.TOUCH_OFFSET)===V.TOUCH_OFFSET||(this._state&V.TOUCH_DOLLY_OFFSET)===V.TOUCH_DOLLY_OFFSET||(this._state&V.TOUCH_ZOOM_OFFSET)===V.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(T,x,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},M=()=>{ns(this._activePointers,Ie),n.copy(Ie),(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mouseup",p),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",L),this._domElement.ownerDocument.addEventListener("pointerlockerror",w),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",d),b())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",L),this._domElement.ownerDocument.removeEventListener("pointerlockerror",w))};const L=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},w=()=>{this.unlockPointer()};this._addAllEventListeners=y=>{this._domElement=y,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",i),ji&&this._domElement.addEventListener("mousedown",r),this._domElement.addEventListener("pointercancel",d),this._domElement.addEventListener("wheel",g,{passive:!1}),this._domElement.addEventListener("contextmenu",A)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",i),this._domElement.removeEventListener("mousedown",r),this._domElement.removeEventListener("pointercancel",d),this._domElement.removeEventListener("wheel",g,{passive:!1}),this._domElement.removeEventListener("contextmenu",A),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",h),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mouseup",p),this._domElement.ownerDocument.removeEventListener("pointerlockchange",L),this._domElement.ownerDocument.removeEventListener("pointerlockerror",w))},this.cancel=()=>{this._state!==V.NONE&&(this._state=V.NONE,this._activePointers.length=0,M())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=Ve(e.width,0,1),this._interactiveArea.height=Ve(e.height,0,1),this._interactiveArea.x=Ve(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=Ve(e.x,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,s=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,s)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,s=!1){this._isUserControllingRotate=!1;const n=Ve(e,this.minAzimuthAngle,this.maxAzimuthAngle),o=Ve(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=n,this._sphericalEnd.phi=o,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,s||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const i=!s||_e(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&_e(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(i)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=pt.NONE,this._changedDolly=0,this._dollyToNoClamp(Ve(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const s=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const i=this._collisionTest(),r=_e(i,this._spherical.radius);if(!(s>e)&&r)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,i)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const o=!t||_e(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(o)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(At).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const s=!t||_e(this._target.x,this._targetEnd.x,this.restThreshold)&&_e(this._target.y,this._targetEnd.y,this.restThreshold)&&_e(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=Ve(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const s=!t||_e(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(s)}pan(e,t,s=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,s)}truck(e,t,s=!1){this._camera.updateMatrix(),Ge.setFromMatrixColumn(this._camera.matrix,0),Ee.setFromMatrixColumn(this._camera.matrix,1),Ge.multiplyScalar(e),Ee.multiplyScalar(-t);const n=he.copy(Ge).add(Ee),o=ye.copy(this._targetEnd).add(n);return this.moveTo(o.x,o.y,o.z,s)}forward(e,t=!1){he.setFromMatrixColumn(this._camera.matrix,0),he.crossVectors(this._camera.up,he),he.multiplyScalar(e);const s=ye.copy(this._targetEnd).add(he);return this.moveTo(s.x,s.y,s.z,t)}elevate(e,t=!1){return he.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+he.x,this._targetEnd.y+he.y,this._targetEnd.z+he.z,t)}moveTo(e,t,s,n=!1){this._isUserControllingTruck=!1;const o=he.set(e,t,s).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,o,this.boundaryFriction),this._needsUpdate=!0,n||this._target.copy(this._targetEnd);const i=!n||_e(this._target.x,this._targetEnd.x,this.restThreshold)&&_e(this._target.y,this._targetEnd.y,this.restThreshold)&&_e(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}lookInDirectionOf(e,t,s,n=!1){const r=he.set(e,t,s).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(r.x,r.y,r.z,n)}fitToBox(e,t,{cover:s=!1,paddingLeft:n=0,paddingRight:o=0,paddingBottom:i=0,paddingTop:r=0}={}){const a=[],h=e.isBox3?mt.copy(e):mt.setFromObject(e);h.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const d=en(this._sphericalEnd.theta,Hs),p=en(this._sphericalEnd.phi,Hs);a.push(this.rotateTo(d,p,t));const m=he.setFromSpherical(this._sphericalEnd).normalize(),g=ln.setFromUnitVectors(m,is),A=_e(Math.abs(m.y),1);A&&g.multiply(as.setFromAxisAngle(Dt,d)),g.multiply(this._yAxisUpSpaceInverse);const b=an.makeEmpty();ye.copy(h.min).applyQuaternion(g),b.expandByPoint(ye),ye.copy(h.min).setX(h.max.x).applyQuaternion(g),b.expandByPoint(ye),ye.copy(h.min).setY(h.max.y).applyQuaternion(g),b.expandByPoint(ye),ye.copy(h.max).setZ(h.min.z).applyQuaternion(g),b.expandByPoint(ye),ye.copy(h.min).setZ(h.max.z).applyQuaternion(g),b.expandByPoint(ye),ye.copy(h.max).setY(h.min.y).applyQuaternion(g),b.expandByPoint(ye),ye.copy(h.max).setX(h.min.x).applyQuaternion(g),b.expandByPoint(ye),ye.copy(h.max).applyQuaternion(g),b.expandByPoint(ye),b.min.x-=n,b.min.y-=i,b.max.x+=o,b.max.y+=r,g.setFromUnitVectors(is,m),A&&g.premultiply(as.invert()),g.premultiply(this._yAxisUpSpace);const _=b.getSize(he),M=b.getCenter(ye).applyQuaternion(g);if(ot(this._camera)){const L=this.getDistanceToFitBox(_.x,_.y,_.z,s);a.push(this.moveTo(M.x,M.y,M.z,t)),a.push(this.dollyTo(L,t)),a.push(this.setFocalOffset(0,0,0,t))}else if(Je(this._camera)){const L=this._camera,w=L.right-L.left,y=L.top-L.bottom,C=s?Math.max(w/_.x,y/_.y):Math.min(w/_.x,y/_.y);a.push(this.moveTo(M.x,M.y,M.z,t)),a.push(this.zoomTo(C,t)),a.push(this.setFocalOffset(0,0,0,t))}return Promise.all(a)}fitToSphere(e,t){const s=[],o=e instanceof ne.Sphere?rs.copy(e):St.createBoundingSphere(e,rs);if(s.push(this.moveTo(o.center.x,o.center.y,o.center.z,t)),ot(this._camera)){const i=this.getDistanceToFitSphere(o.radius);s.push(this.dollyTo(i,t))}else if(Je(this._camera)){const i=this._camera.right-this._camera.left,r=this._camera.top-this._camera.bottom,a=2*o.radius,h=Math.min(i/a,r/a);s.push(this.zoomTo(h,t))}return s.push(this.setFocalOffset(0,0,0,t)),Promise.all(s)}setLookAt(e,t,s,n,o,i,r=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=pt.NONE,this._changedDolly=0;const a=ye.set(n,o,i),h=he.set(e,t,s);this._targetEnd.copy(a),this._sphericalEnd.setFromVector3(h.sub(a).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,r||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const d=!r||_e(this._target.x,this._targetEnd.x,this.restThreshold)&&_e(this._target.y,this._targetEnd.y,this.restThreshold)&&_e(this._target.z,this._targetEnd.z,this.restThreshold)&&_e(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&_e(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&_e(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(d)}lerpLookAt(e,t,s,n,o,i,r,a,h,d,p,m,g,A=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=pt.NONE,this._changedDolly=0;const b=he.set(n,o,i),_=ye.set(e,t,s);Be.setFromVector3(_.sub(b).applyQuaternion(this._yAxisUpSpace));const M=ft.set(d,p,m),L=ye.set(r,a,h);Mt.setFromVector3(L.sub(M).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(b.lerp(M,g));const w=Mt.theta-Be.theta,y=Mt.phi-Be.phi,C=Mt.radius-Be.radius;this._sphericalEnd.set(Be.radius+C*g,Be.phi+y*g,Be.theta+w*g),this.normalizeRotations(),this._needsUpdate=!0,A||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const T=!A||_e(this._target.x,this._targetEnd.x,this.restThreshold)&&_e(this._target.y,this._targetEnd.y,this.restThreshold)&&_e(this._target.z,this._targetEnd.z,this.restThreshold)&&_e(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&_e(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&_e(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(T)}setPosition(e,t,s,n=!1){return this.setLookAt(e,t,s,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,n)}setTarget(e,t,s,n=!1){const o=this.getPosition(he),i=this.setLookAt(o.x,o.y,o.z,e,t,s,n);return this._sphericalEnd.phi=Ve(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),i}setFocalOffset(e,t,s,n=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,s),this._needsUpdate=!0,n||this._focalOffset.copy(this._focalOffsetEnd);const o=!n||_e(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&_e(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&_e(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}setOrbitPoint(e,t,s){this._camera.updateMatrixWorld(),Ge.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Ee.setFromMatrixColumn(this._camera.matrixWorldInverse,1),it.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const n=he.set(e,t,s),o=n.distanceTo(this._camera.position),i=n.sub(this._camera.position);Ge.multiplyScalar(i.x),Ee.multiplyScalar(i.y),it.multiplyScalar(i.z),he.copy(Ge).add(Ee).add(it),he.z=he.z+o,this.dollyTo(o,!1),this.setFocalOffset(-he.x,he.y,-he.z,!1),this.moveTo(e,t,s,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,s,n){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new ne.Vector4,typeof e=="number"?this._viewport.set(e,t,s,n):this._viewport.copy(e)}getDistanceToFitBox(e,t,s,n=!1){if(os(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const o=e/t,i=this._camera.getEffectiveFOV()*xt,r=this._camera.aspect;return((n?o>r:o<r)?t:e/r)*.5/Math.tan(i*.5)+s*.5}getDistanceToFitSphere(e){if(os(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*xt,s=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,n=1<this._camera.aspect?t:s;return e/Math.sin(n*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new ne.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new ne.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e&&e instanceof ne.Spherical?e:new ne.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new ne.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%dt,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=dt),this._spherical.theta+=dt*Math.round((this._sphericalEnd.theta-this._spherical.theta)/dt)}reset(e=!1){if(!_e(this._camera.up.x,this._cameraUp0.x)||!_e(this._camera.up.y,this._cameraUp0.y)||!_e(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const s=this.getPosition(he);this.updateCameraUp(),this.setPosition(s.x,s.y,s.z)}const t=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,e),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,e),this.zoomTo(this._zoom0,e)];return Promise.all(t)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,Dt),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=he.subVectors(this._target,this._camera.position).normalize(),t=ye.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const s=this.getPosition(he);this.updateCameraUp(),this.setPosition(s.x,s.y,s.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,s=this._sphericalEnd.phi-this._spherical.phi,n=this._sphericalEnd.radius-this._spherical.radius,o=on.subVectors(this._targetEnd,this._target),i=rn.subVectors(this._focalOffsetEnd,this._focalOffset),r=this._zoomEnd-this._zoom;if(xe(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const p=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Ot(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,p,1/0,e),this._needsUpdate=!0}if(xe(s))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const p=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Ot(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,p,1/0,e),this._needsUpdate=!0}if(xe(n))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const p=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Ot(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,p,this.maxSpeed,e),this._needsUpdate=!0}if(xe(o.x)&&xe(o.y)&&xe(o.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const p=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;tn(this._target,this._targetEnd,this._targetVelocity,p,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(xe(i.x)&&xe(i.y)&&xe(i.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const p=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;tn(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,p,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(xe(r))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const p=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Ot(this._zoom,this._zoomEnd,this._zoomVelocity,p,1/0,e)}if(this.dollyToCursor){if(ot(this._camera)&&this._changedDolly!==0){const p=this._spherical.radius-this._lastDistance,m=this._camera,g=this._getCameraDirection(At),A=he.copy(g).cross(m.up).normalize();A.lengthSq()===0&&(A.x=1);const b=ye.crossVectors(A,g),_=this._sphericalEnd.radius*Math.tan(m.getEffectiveFOV()*xt*.5),L=(this._sphericalEnd.radius-p-this._sphericalEnd.radius)/this._sphericalEnd.radius,w=ft.copy(this._targetEnd).add(A.multiplyScalar(this._dollyControlCoord.x*_*m.aspect)).add(b.multiplyScalar(this._dollyControlCoord.y*_)),y=he.copy(this._targetEnd).lerp(w,L),C=this._lastDollyDirection===pt.IN&&this._spherical.radius<=this.minDistance,T=this._lastDollyDirection===pt.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(C||T)){this._sphericalEnd.radius-=p,this._spherical.radius-=p;const v=ye.copy(g).multiplyScalar(-p);y.add(v)}this._boundary.clampPoint(y,y);const x=ye.subVectors(y,this._targetEnd);this._targetEnd.copy(y),this._target.add(x),this._changedDolly-=p,xe(this._changedDolly)&&(this._changedDolly=0)}else if(Je(this._camera)&&this._changedZoom!==0){const p=this._zoom-this._lastZoom,m=this._camera,g=he.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(m.near+m.far)/(m.near-m.far)).unproject(m),A=ye.set(0,0,-1).applyQuaternion(m.quaternion),b=ft.copy(g).add(A.multiplyScalar(-g.dot(m.up))),M=-(this._zoom-p-this._zoom)/this._zoom,L=this._getCameraDirection(At),w=this._targetEnd.dot(L),y=he.copy(this._targetEnd).lerp(b,M),C=y.dot(L),T=L.multiplyScalar(C-w);y.sub(T),this._boundary.clampPoint(y,y);const x=ye.subVectors(y,this._targetEnd);this._targetEnd.copy(y),this._target.add(x),this._changedZoom-=p,xe(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0);const a=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,a),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!xe(this._focalOffset.x)||!xe(this._focalOffset.y)||!xe(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),Ge.setFromMatrixColumn(this._camera.matrix,0),Ee.setFromMatrixColumn(this._camera.matrix,1),it.setFromMatrixColumn(this._camera.matrix,2),Ge.multiplyScalar(this._focalOffset.x),Ee.multiplyScalar(-this._focalOffset.y),it.multiplyScalar(this._focalOffset.z),he.copy(Ge).add(Ee).add(it),this._camera.position.add(he)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),he.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const d=this._needsUpdate;return d&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):d?(this.dispatchEvent({type:"update"}),xe(t,this.restThreshold)&&xe(s,this.restThreshold)&&xe(n,this.restThreshold)&&xe(o.x,this.restThreshold)&&xe(o.y,this.restThreshold)&&xe(o.z,this.restThreshold)&&xe(i.x,this.restThreshold)&&xe(i.y,this.restThreshold)&&xe(i.z,this.restThreshold)&&xe(r,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!d&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=d,this._needsUpdate=!1,d}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:bt(this.maxDistance),minZoom:this.minZoom,maxZoom:bt(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:bt(this.maxPolarAngle),minAzimuthAngle:bt(this.minAzimuthAngle),maxAzimuthAngle:bt(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,verticalDragToForward:this.verticalDragToForward,target:this._targetEnd.toArray(),position:he.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(e,t=!1){const s=JSON.parse(e);this.enabled=s.enabled,this.minDistance=s.minDistance,this.maxDistance=vt(s.maxDistance),this.minZoom=s.minZoom,this.maxZoom=vt(s.maxZoom),this.minPolarAngle=s.minPolarAngle,this.maxPolarAngle=vt(s.maxPolarAngle),this.minAzimuthAngle=vt(s.minAzimuthAngle),this.maxAzimuthAngle=vt(s.maxAzimuthAngle),this.smoothTime=s.smoothTime,this.draggingSmoothTime=s.draggingSmoothTime,this.dollySpeed=s.dollySpeed,this.truckSpeed=s.truckSpeed,this.dollyToCursor=s.dollyToCursor,this.verticalDragToForward=s.verticalDragToForward,this._target0.fromArray(s.target0),this._position0.fromArray(s.position0),this._zoom0=s.zoom0,this._focalOffset0.fromArray(s.focalOffset0),this.moveTo(s.target[0],s.target[1],s.target[2],t),Be.setFromVector3(he.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Be.theta,Be.phi,t),this.dollyTo(Be.radius,t),this.zoomTo(s.zoom,t),this.setFocalOffset(s.focalOffset[0],s.focalOffset[1],s.focalOffset[2],t),this._needsUpdate=!0}connect(e){if(this._domElement){console.warn("camera-controls is already connected.");return}e.setAttribute("data-camera-controls-version",Gi),this._addAllEventListeners(e)}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(e){return e.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(e){return this._getTargetDirection(e).negate()}_findPointerById(e){return this._activePointers.find(t=>t.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,s){const n=t.lengthSq();if(n===0)return e;const o=ye.copy(t).add(e),r=this._boundary.clampPoint(o,ft).sub(o),a=r.lengthSq();if(a===0)return e.add(t);if(a===n)return e;if(s===0)return e.add(t).add(r);{const h=1+s*a/t.dot(r);return e.add(ye.copy(t).multiplyScalar(h)).add(r.multiplyScalar(1-s))}}_updateNearPlaneCorners(){if(ot(this._camera)){const e=this._camera,t=e.near,s=e.getEffectiveFOV()*xt,n=Math.tan(s*.5)*t,o=n*e.aspect;this._nearPlaneCorners[0].set(-o,-n,0),this._nearPlaneCorners[1].set(o,-n,0),this._nearPlaneCorners[2].set(o,n,0),this._nearPlaneCorners[3].set(-o,n,0)}else if(Je(this._camera)){const e=this._camera,t=1/e.zoom,s=e.left*t,n=e.right*t,o=e.top*t,i=e.bottom*t;this._nearPlaneCorners[0].set(s,o,0),this._nearPlaneCorners[1].set(n,o,0),this._nearPlaneCorners[2].set(n,i,0),this._nearPlaneCorners[3].set(s,i,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||os(this._camera,"_collisionTest"))return e;const s=this._getTargetDirection(At);ls.lookAt(nn,s,this._camera.up);for(let n=0;n<4;n++){const o=ye.copy(this._nearPlaneCorners[n]);o.applyMatrix4(ls);const i=ft.addVectors(this._target,o);kt.set(i,s),kt.far=this._spherical.radius+1;const r=kt.intersectObjects(this.colliderMeshes);r.length!==0&&r[0].distance<e&&(e=r[0].distance)}return e}_getClientRect(e){if(!this._domElement)return;const t=this._domElement.getBoundingClientRect();return e.x=t.left,e.y=t.top,this._viewport?(e.x+=this._viewport.x,e.y+=t.height-this._viewport.w-this._viewport.y,e.width=this._viewport.z,e.height=this._viewport.w):(e.width=t.width,e.height=t.height),e}_createOnRestPromise(e){return e?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const s=()=>{this.removeEventListener("rest",s),t()};this.addEventListener("rest",s)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new ne.Sphere){const s=t,n=s.center;mt.makeEmpty(),e.traverseVisible(i=>{i.isMesh&&mt.expandByObject(i)}),mt.getCenter(n);let o=0;return e.traverseVisible(i=>{if(!i.isMesh)return;const r=i,a=r.geometry.clone();a.applyMatrix4(r.matrixWorld);const d=a.attributes.position;for(let p=0,m=d.count;p<m;p++)he.fromBufferAttribute(d,p),o=Math.max(o,n.distanceToSquared(he))}),s.radius=Math.sqrt(o),s}}const Yi=["min-polar-angle","max-polar-angle","min-azimuth-angle","max-azimuth-angle","distance","min-distance","max-distance","infinity-dolly","min-zoom","max-zoom","smooth-time","dragging-smooth-time","max-speed","azimuth-rotate-speed","polar-rotate-speed","dolly-speed","dolly-drag-inverted","truck-speed","dolly-to-cursor","drag-to-offset","vertical-drag-to-forward","boundary-friction","rest-threshold","collider-meshes","args"],Xi=u.defineComponent({__name:"CameraControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},minPolarAngle:{default:0},maxPolarAngle:{default:Math.PI},minAzimuthAngle:{default:-1/0},maxAzimuthAngle:{default:1/0},distance:{default:8},minDistance:{default:Number.EPSILON},maxDistance:{default:1/0},infinityDolly:{type:Boolean,default:!1},minZoom:{default:.01},maxZoom:{default:1/0},smoothTime:{default:.25},draggingSmoothTime:{default:.125},maxSpeed:{default:1/0},azimuthRotateSpeed:{default:1},polarRotateSpeed:{default:1},dollySpeed:{default:1},dollyDragInverted:{type:Boolean,default:!1},truckSpeed:{default:2},dollyToCursor:{type:Boolean,default:!1},dragToOffset:{type:Boolean,default:!1},verticalDragToForward:{type:Boolean,default:!1},boundaryFriction:{default:0},restThreshold:{default:.01},colliderMeshes:{default:()=>[]},mouseButtons:{},touches:{}},emits:["change","start","end"],setup(c,{expose:e,emit:t}){const s=c,{makeDefault:n,minPolarAngle:o,maxPolarAngle:i,minAzimuthAngle:r,maxAzimuthAngle:a,distance:h,minDistance:d,maxDistance:p,infinityDolly:m,minZoom:g,maxZoom:A,smoothTime:b,draggingSmoothTime:_,maxSpeed:M,azimuthRotateSpeed:L,polarRotateSpeed:w,dollySpeed:y,dollyDragInverted:C,truckSpeed:T,dollyToCursor:x,dragToOffset:v,verticalDragToForward:D,boundaryFriction:z,restThreshold:U,colliderMeshes:R}=u.toRefs(s),K={Box3:l.Box3,MathUtils:{clamp:l.MathUtils.clamp},Matrix4:l.Matrix4,Quaternion:l.Quaternion,Raycaster:l.Raycaster,Sphere:l.Sphere,Spherical:l.Spherical,Vector2:l.Vector2,Vector3:l.Vector3,Vector4:l.Vector4};St.install({THREE:K});const{camera:J,renderer:Q,extend:pe,controls:Z}=ge.useTresContext(),G=u.ref(null);pe({CameraControls:St}),u.watchEffect(()=>{ce(),G.value&&n.value?Z.value=G.value:Z.value=null});function ce(){Se(G.value,"update",()=>t("change",G.value)),Se(G.value,"controlend",()=>t("end",G.value)),Se(G.value,"controlstart",()=>t("start",G.value))}const{onLoop:se}=ge.useRenderLoop();return se(({delta:ae})=>{var B,I;(B=G.value)!=null&&B.enabled&&((I=G.value)==null||I.update(ae))}),u.onUnmounted(()=>{G.value&&G.value.disconnect()}),e({value:G}),(ae,B)=>(ae.camera||u.unref(J))&&(ae.domElement||u.unref(Q))?(u.openBlock(),u.createElementBlock("TresCameraControls",{key:0,ref_key:"controlsRef",ref:G,"min-polar-angle":u.unref(o),"max-polar-angle":u.unref(i),"min-azimuth-angle":u.unref(r),"max-azimuth-angle":u.unref(a),distance:u.unref(h),"min-distance":u.unref(d),"max-distance":u.unref(p),"infinity-dolly":u.unref(m),"min-zoom":u.unref(g),"max-zoom":u.unref(A),"smooth-time":u.unref(b),"dragging-smooth-time":u.unref(_),"max-speed":u.unref(M),"azimuth-rotate-speed":u.unref(L),"polar-rotate-speed":u.unref(w),"dolly-speed":u.unref(y),"dolly-drag-inverted":u.unref(C),"truck-speed":u.unref(T),"dolly-to-cursor":u.unref(x),"drag-to-offset":u.unref(v),"vertical-drag-to-forward":u.unref(D),"boundary-friction":u.unref(z),"rest-threshold":u.unref(U),"collider-meshes":u.unref(R),args:[ae.camera||u.unref(J),ae.domElement||u.unref(Q).domElement]},null,8,Yi)):u.createCommentVNode("",!0)}});class Zi extends l.MeshStandardMaterial{constructor(t={}){super(t);Me(this,"_time");Me(this,"_factor");this.setValues(t),this._time={value:0},this._factor={value:1}}onBeforeCompile(t){t.uniforms||(t.uniforms={}),t.uniforms.time=this._time,t.uniforms.factor=this._factor,t.vertexShader=`
|
|
87
85
|
uniform float time;
|
|
88
86
|
uniform float factor;
|
|
89
87
|
${t.vertexShader}
|
|
@@ -92,4 +90,6 @@
|
|
|
92
90
|
float s = sin( theta );
|
|
93
91
|
mat3 m = mat3( c, 0, s, 0, 1, 0, -s, 0, c );
|
|
94
92
|
vec3 transformed = vec3( position ) * m;
|
|
95
|
-
vNormal = vNormal * m;`)}get time(){return this._time.value}set time(t){this._time.value=t}get factor(){return this._factor.value}set factor(t){this._factor.value=t}}const Wo=["factor"],qo=u.defineComponent({__name:"index",props:{speed:{default:1},factor:{default:1}},setup(l){const e=l,t=u.shallowRef(),{extend:s}=q.useTresContext();s({MeshWobbleMaterial:Ko});const{onLoop:n}=q.useRenderLoop();return n(({elapsed:i})=>{t.value&&(t.value.time=i*(e==null?void 0:e.speed))}),(i,o)=>(u.openBlock(),u.createElementBlock("TresMeshWobbleMaterial",u.mergeProps({ref_key:"materialRef",ref:t,factor:i.factor},i.$attrs),null,16,Wo))}});function Xe(l,e,t){return Math.max(e,Math.min(t,l))}function Jo(l,e){return(l%e+e)%e}function jt(l,e,t){return(1-t)*l+t*e}class Xt{constructor(e=0,t=0){Xt.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,s=this.y,n=e.elements;return this.x=n[0]*t+n[3]*s+n[6],this.y=n[1]*t+n[4]*s+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(e,Math.min(t,s)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const s=this.dot(e)/t;return Math.acos(Xe(s,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y;return t*t+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const s=Math.cos(t),n=Math.sin(t),i=this.x-e.x,o=this.y-e.y;return this.x=i*s-o*n+e.x,this.y=i*n+o*s+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}const Ce="srgb",Zt="srgb-linear",Xs="display-p3";class ht{constructor(e,t,s,n,i,o,r,a,h){ht.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,s,n,i,o,r,a,h)}set(e,t,s,n,i,o,r,a,h){const p=this.elements;return p[0]=e,p[1]=n,p[2]=r,p[3]=t,p[4]=i,p[5]=a,p[6]=s,p[7]=o,p[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],this}extractBasis(e,t,s){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,n=t.elements,i=this.elements,o=s[0],r=s[3],a=s[6],h=s[1],p=s[4],d=s[7],m=s[2],f=s[5],w=s[8],y=n[0],v=n[3],M=n[6],L=n[1],b=n[4],g=n[7],S=n[2],A=n[5],_=n[8];return i[0]=o*y+r*L+a*S,i[3]=o*v+r*b+a*A,i[6]=o*M+r*g+a*_,i[1]=h*y+p*L+d*S,i[4]=h*v+p*b+d*A,i[7]=h*M+p*g+d*_,i[2]=m*y+f*L+w*S,i[5]=m*v+f*b+w*A,i[8]=m*M+f*g+w*_,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],s=e[1],n=e[2],i=e[3],o=e[4],r=e[5],a=e[6],h=e[7],p=e[8];return t*o*p-t*r*h-s*i*p+s*r*a+n*i*h-n*o*a}invert(){const e=this.elements,t=e[0],s=e[1],n=e[2],i=e[3],o=e[4],r=e[5],a=e[6],h=e[7],p=e[8],d=p*o-r*h,m=r*a-p*i,f=h*i-o*a,w=t*d+s*m+n*f;if(w===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/w;return e[0]=d*y,e[1]=(n*h-p*s)*y,e[2]=(r*s-n*o)*y,e[3]=m*y,e[4]=(p*t-n*a)*y,e[5]=(n*i-r*t)*y,e[6]=f*y,e[7]=(s*a-h*t)*y,e[8]=(o*t-s*i)*y,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,s,n,i,o,r){const a=Math.cos(i),h=Math.sin(i);return this.set(s*a,s*h,-s*(a*o+h*r)+o+e,-n*h,n*a,-n*(-h*o+a*r)+r+t,0,0,1),this}scale(e,t){return this.premultiply(Qt.makeScale(e,t)),this}rotate(e){return this.premultiply(Qt.makeRotation(-e)),this}translate(e,t){return this.premultiply(Qt.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,-s,0,s,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,s=e.elements;for(let n=0;n<9;n++)if(t[n]!==s[n])return!1;return!0}fromArray(e,t=0){for(let s=0;s<9;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Qt=new ht;function Kt(l){return l<.04045?l*.0773993808:Math.pow(l*.9478672986+.0521327014,2.4)}function Wt(l){return l<.0031308?l*12.92:1.055*Math.pow(l,.41666)-.055}const Ho=new ht().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),$o=new ht().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function er(l){return l.convertSRGBToLinear().applyMatrix3($o)}function tr(l){return l.applyMatrix3(Ho).convertLinearToSRGB()}const sr={[Zt]:l=>l,[Ce]:l=>l.convertSRGBToLinear(),[Xs]:er},nr={[Zt]:l=>l,[Ce]:l=>l.convertLinearToSRGB(),[Xs]:tr},Me={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(l){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!l},get workingColorSpace(){return Zt},set workingColorSpace(l){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(l,e,t){if(this.enabled===!1||e===t||!e||!t)return l;const s=sr[e],n=nr[t];if(s===void 0||n===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return n(s(l))},fromWorkingColorSpace:function(l,e){return this.convert(l,this.workingColorSpace,e)},toWorkingColorSpace:function(l,e){return this.convert(l,e,this.workingColorSpace)}},Zs={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},be={h:0,s:0,l:0},_t={h:0,s:0,l:0};function qt(l,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?l+(e-l)*6*t:t<1/2?e:t<2/3?l+(e-l)*6*(2/3-t):l}class wt{constructor(e,t,s){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,s)}set(e,t,s){if(t===void 0&&s===void 0){const n=e;n&&n.isColor?this.copy(n):typeof n=="number"?this.setHex(n):typeof n=="string"&&this.setStyle(n)}else this.setRGB(e,t,s);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Ce){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Me.toWorkingColorSpace(this,t),this}setRGB(e,t,s,n=Me.workingColorSpace){return this.r=e,this.g=t,this.b=s,Me.toWorkingColorSpace(this,n),this}setHSL(e,t,s,n=Me.workingColorSpace){if(e=Jo(e,1),t=Xe(t,0,1),s=Xe(s,0,1),t===0)this.r=this.g=this.b=s;else{const i=s<=.5?s*(1+t):s+t-s*t,o=2*s-i;this.r=qt(o,i,e+1/3),this.g=qt(o,i,e),this.b=qt(o,i,e-1/3)}return Me.toWorkingColorSpace(this,n),this}setStyle(e,t=Ce){function s(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(e)){let i;const o=n[1],r=n[2];switch(o){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return s(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return s(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return s(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const i=n[1],o=i.length;if(o===3)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(i,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Ce){const s=Zs[e.toLowerCase()];return s!==void 0?this.setHex(s,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Kt(e.r),this.g=Kt(e.g),this.b=Kt(e.b),this}copyLinearToSRGB(e){return this.r=Wt(e.r),this.g=Wt(e.g),this.b=Wt(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ce){return Me.fromWorkingColorSpace(ue.copy(this),e),Math.round(Xe(ue.r*255,0,255))*65536+Math.round(Xe(ue.g*255,0,255))*256+Math.round(Xe(ue.b*255,0,255))}getHexString(e=Ce){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Me.workingColorSpace){Me.fromWorkingColorSpace(ue.copy(this),t);const s=ue.r,n=ue.g,i=ue.b,o=Math.max(s,n,i),r=Math.min(s,n,i);let a,h;const p=(r+o)/2;if(r===o)a=0,h=0;else{const d=o-r;switch(h=p<=.5?d/(o+r):d/(2-o-r),o){case s:a=(n-i)/d+(n<i?6:0);break;case n:a=(i-s)/d+2;break;case i:a=(s-n)/d+4;break}a/=6}return e.h=a,e.s=h,e.l=p,e}getRGB(e,t=Me.workingColorSpace){return Me.fromWorkingColorSpace(ue.copy(this),t),e.r=ue.r,e.g=ue.g,e.b=ue.b,e}getStyle(e=Ce){Me.fromWorkingColorSpace(ue.copy(this),e);const t=ue.r,s=ue.g,n=ue.b;return e!==Ce?`color(${e} ${t.toFixed(3)} ${s.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(s*255)},${Math.round(n*255)})`}offsetHSL(e,t,s){return this.getHSL(be),be.h+=e,be.s+=t,be.l+=s,this.setHSL(be.h,be.s,be.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,s){return this.r=e.r+(t.r-e.r)*s,this.g=e.g+(t.g-e.g)*s,this.b=e.b+(t.b-e.b)*s,this}lerpHSL(e,t){this.getHSL(be),e.getHSL(_t);const s=jt(be.h,_t.h,t),n=jt(be.s,_t.s,t),i=jt(be.l,_t.l,t);return this.setHSL(s,n,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,s=this.g,n=this.b,i=e.elements;return this.r=i[0]*t+i[3]*s+i[6]*n,this.g=i[1]*t+i[4]*s+i[7]*n,this.b=i[2]*t+i[5]*s+i[8]*n,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const ue=new wt;wt.NAMES=Zs;class ir extends c.MeshStandardMaterial{constructor(t={}){super();re(this,"isMeshPhysicalMaterial");re(this,"clearcoatMap");re(this,"clearcoatRoughness");re(this,"clearcoatRoughnessMap");re(this,"clearcoatNormalScale");re(this,"clearcoatNormalMap");re(this,"ior");re(this,"transmissionMap");re(this,"thickness");re(this,"thicknessMap");re(this,"attenuationDistance");re(this,"attenuationColor");re(this,"specularIntensity");re(this,"specularIntensityMap");re(this,"specularColor");re(this,"specularColorMap");re(this,"_clearcoat");re(this,"_transmission");this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Xt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Xe(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(s){this.ior=(1+.4*s)/(1-.4*s)}}),this.roughness=0,this.transmissionMap=null,this.thickness=.5,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new wt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new wt(1,1,1),this.specularColorMap=null,this._clearcoat=.5,this._transmission=1,this.setValues(t)}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=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.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.ior=t.ior,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}}const or=ir,rr=u.defineComponent({__name:"index",setup(l,{expose:e}){const t=u.shallowRef(),{extend:s}=q.useTresContext();return s({MeshGlassMaterial:or}),e({MeshGlassMaterialClass:t}),(n,i)=>(u.openBlock(),u.createElementBlock("TresMeshGlassMaterial",{ref_key:"MeshGlassMaterialClass",ref:t},null,512))}}),ar=["args"],lr=["color"],cr=u.defineComponent({__name:"Box",props:{args:{default:()=>[1,1,1]},color:{default:"#ffffff"}},setup(l,{expose:e}){const t=l,{args:s,color:n}=u.toRefs(t),i=u.shallowRef();return e({value:i}),(o,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"boxRef",ref:i},o.$attrs),[u.createElementVNode("TresBoxGeometry",{args:u.unref(s)},null,8,ar),u.renderSlot(o.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,lr)])],16))}}),hr=["args"],ur=["color"],pr=u.defineComponent({__name:"Circle",props:{args:{default:()=>[1,32,0,Math.PI*2]},color:{default:"#ffffff"}},setup(l,{expose:e}){const t=l,{args:s,color:n}=u.toRefs(t),i=u.shallowRef();return e({value:i}),(o,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"circleRef",ref:i},o.$attrs),[u.createElementVNode("TresCircleGeometry",{args:u.unref(s)},null,8,hr),u.renderSlot(o.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,ur)])],16))}}),dr=["args"],mr=["color"],fr=u.defineComponent({__name:"Cone",props:{args:{default:()=>[1,1,12,12,!1,0,Math.PI*2]},color:{default:"#ffffff"}},setup(l,{expose:e}){const t=l,{args:s,color:n}=u.toRefs(t),i=u.shallowRef();return e({value:i}),(o,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"coneRef",ref:i},o.$attrs),[u.createElementVNode("TresConeGeometry",{args:u.unref(s)},null,8,dr),u.renderSlot(o.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,mr)])],16))}}),gr=["args"],yr=["color"],_r=u.defineComponent({__name:"Dodecahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(l,{expose:e}){const t=l,{args:s,color:n}=u.toRefs(t),i=u.shallowRef();return e({value:i}),(o,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"dodecahedronRef",ref:i},o.$attrs),[u.createElementVNode("TresDodecahedronGeometry",{args:u.unref(s)},null,8,gr),u.renderSlot(o.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,yr)])],16))}}),wr=["args"],xr=["color"],vr=u.defineComponent({__name:"Icosahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(l,{expose:e}){const t=l,{args:s,color:n}=u.toRefs(t),i=u.shallowRef();return e({value:i}),(o,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"icosahedronRef",ref:i},o.$attrs),[u.createElementVNode("TresIcosahedronGeometry",{args:u.unref(s)},null,8,wr),u.renderSlot(o.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,xr)])],16))}}),Ar=["args"],Mr=["color"],br=u.defineComponent({__name:"Octahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(l,{expose:e}){const t=l,{args:s,color:n}=u.toRefs(t),i=u.shallowRef();return e({value:i}),(o,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"octahedronRef",ref:i},o.$attrs),[u.createElementVNode("TresOctahedronGeometry",{args:u.unref(s)},null,8,Ar),u.renderSlot(o.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,Mr)])],16))}}),Sr=["rotation"],Tr=["args"],Lr=["color"],Cr=u.defineComponent({__name:"Plane",props:{args:{default:()=>[1,1]},color:{default:"#ffffff"}},setup(l,{expose:e}){const t=l,{args:s,color:n}=u.toRefs(t),i=u.shallowRef();return e({value:i}),(o,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"planeRef",ref:i,rotation:[-Math.PI/2,0,0]},o.$attrs),[u.createElementVNode("TresPlaneGeometry",{args:u.unref(s)},null,8,Tr),u.renderSlot(o.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,Lr)])],16,Sr))}}),Or=["args"],Pr=["color"],Dr=u.defineComponent({__name:"Ring",props:{args:{default:()=>[.5,1,32]},color:{default:"#ffffff"}},setup(l,{expose:e}){const t=l,{args:s,color:n}=u.toRefs(t),i=u.shallowRef();return e({value:i}),(o,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"ringRef",ref:i},o.$attrs),[u.createElementVNode("TresRingGeometry",{args:u.unref(s)},null,8,Or),u.renderSlot(o.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,Pr)])],16))}}),Ir=["args"],kr=["color"],Fr=u.defineComponent({__name:"Sphere",props:{args:{default:()=>[2,32,16]},color:{default:"#ffffff"}},setup(l,{expose:e}){const t=l,{args:s,color:n}=u.toRefs(t),i=u.shallowRef();return e({value:i}),(o,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"sphereRef",ref:i},o.$attrs),[u.createElementVNode("TresSphereGeometry",{args:u.unref(s)},null,8,Ir),u.renderSlot(o.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,kr)])],16))}}),Br=["rotation"],Ur=["args"],Nr=["color"],Vr=u.defineComponent({__name:"Tetrahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(l,{expose:e}){const t=l,{args:s,color:n}=u.toRefs(t),i=u.shallowRef();return e({value:i}),(o,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"tetrahedronRef",ref:i,rotation:[-Math.PI/2,0,0]},o.$attrs),[u.createElementVNode("TresTetrahedronGeometry",{args:u.unref(s)},null,8,Ur),u.renderSlot(o.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,Nr)])],16,Br))}}),Er=["args"],zr=["color"],Rr=u.defineComponent({__name:"Torus",props:{args:{default:()=>[1,1,16,80]},color:{default:"#ffffff"}},setup(l,{expose:e}){const t=l,{args:s,color:n}=u.toRefs(t),i=u.shallowRef();return e({value:i}),(o,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"torusRef",ref:i},o.$attrs),[u.createElementVNode("TresTorusGeometry",{args:u.unref(s)},null,8,Er),u.renderSlot(o.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,zr)])],16))}}),Gr=["args"],Yr=["color"],jr=u.defineComponent({__name:"TorusKnot",props:{args:{default:()=>[1,.4,64,8]},color:{default:"#ffffff"}},setup(l,{expose:e}){const t=l,{args:s,color:n}=u.toRefs(t),i=u.shallowRef();return e({value:i}),(o,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"torusKnotRef",ref:i},o.$attrs),[u.createElementVNode("TresTorusKnotGeometry",{args:u.unref(s)},null,8,Gr),u.renderSlot(o.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,Yr)])],16))}}),Xr=["args"],Zr=["color"],Qr=u.defineComponent({__name:"Tube",props:{args:{default:()=>[new c.QuadraticBezierCurve3(new c.Vector3(-1,0,0),new c.Vector3(0,1,0),new c.Vector3(1,0,0)),20,.2,8,!1]},color:{default:"#ffffff"}},setup(l,{expose:e}){const t=l,{args:s,color:n}=u.toRefs(t),i=u.shallowRef();return e({value:i}),(o,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"tubeRef",ref:i},o.$attrs),[u.createElementVNode("TresTubeGeometry",{args:u.unref(s)},null,8,Xr),u.renderSlot(o.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,Zr)])],16))}}),Kr=["receive-shadow","rotation"],Wr=["args"],qr=u.createElementVNode("TresMeshStandardMaterial",{color:8421504,side:2},null,-1),Jr=u.defineComponent({__name:"Backdrop",props:{floor:{default:.25},segments:{default:20},receiveShadow:{type:Boolean,default:!1}},setup(l){const e=l,t=r=>r===0?0:Math.pow(2,10*r-10),{floor:s,segments:n,receiveShadow:i}=u.toRefs(e),o=u.ref(null);return u.watch(()=>[n.value,s.value,o.value],([r,a,h])=>{if(!h||r===null)return;let p=0;const d=r/r/2,m=h.attributes.position;for(let f=0;f<r+1;f++)for(let w=0;w<r+1;w++)m.setXYZ(p++,f/r-d+(f===0?-a:0),w/r-d,t(f/r));m.needsUpdate=!0,h.computeVertexNormals()}),(r,a)=>(u.openBlock(),u.createElementBlock("TresGroup",u.normalizeProps(u.guardReactiveProps(r.$attrs)),[u.createElementVNode("TresMesh",{"receive-shadow":u.unref(i),rotation:[-Math.PI/2,0,Math.PI/2]},[u.createElementVNode("TresPlaneGeometry",{ref_key:"planeRef",ref:o,args:[1,1,u.unref(n),u.unref(n)]},null,8,Wr),u.renderSlot(r.$slots,"default",{},()=>[qr])],8,Kr)],16))}});let Oe;const Hr=(l="body")=>{Oe||(Oe=new nn.Pane({container:document.querySelector(l)}),Oe.element.style.position="absolute",Oe.element.style.top="1rem",Oe.element.style.right="1rem",Oe.element.style.zIndex="9999");const{logWarning:e}=Ut();e("useTweakPane is going to be deprecated soon and will no longer be part of this package, please start migrating to @tresjs/leches package https://github.com/Tresjs/leches or v-tweakpane https://github.com/vinayakkulkarni/v-tweakpane instead.");function t(){Oe&&Oe.dispose()}return u.onMounted(()=>{const{resume:s}=q.useRenderLoop();s()}),u.onUnmounted(()=>{t()}),{pane:Oe,disposeTweakPane:t}};U.Backdrop=Jr,U.Box=cr,U.CameraControls=Qo,U.Circle=pr,U.Cone=fr,U.ContactShadows=ro,U.Dodecahedron=_r,U.Environment=Yi,U.FBXModel=To,U.GLTFModel=So,U.Icosahedron=vr,U.KeyboardControls=Fo,U.Levioso=to,U.MapControls=zo,U.MeshGlassMaterial=rr,U.MeshWobbleMaterial=qo,U.MouseParallax=Mo,U.Octahedron=br,U.OrbitControls=Po,U.Plane=Cr,U.PointerLockControls=Vo,U.Precipitation=Wi,U.Ring=Dr,U.ScrollControls=Ro,U.Smoke=eo,U.Sphere=Fr,U.Stars=Zi,U.Tetrahedron=Vr,U.Text3D=Ri,U.Torus=Rr,U.TorusKnot=jr,U.TransformControls=Uo,U.Tube=Qr,U.useAnimations=Gi,U.useEnvironment=Ls,U.useFBX=ks,U.useGLTF=Is,U.useProgress=Lo,U.useTweakPane=Hr,U.useVideoTexture=Co,Object.defineProperty(U,Symbol.toStringTag,{value:"Module"})});
|
|
93
|
+
vNormal = vNormal * m;`)}get time(){return this._time.value}set time(t){this._time.value=t}get factor(){return this._factor.value}set factor(t){this._factor.value=t}}const Qi=["factor"],Ki=u.defineComponent({__name:"index",props:{speed:{default:1},factor:{default:1}},setup(c){const e=c,t=u.shallowRef(),{extend:s}=ge.useTresContext();s({MeshWobbleMaterial:Zi});const{onLoop:n}=ge.useRenderLoop();return n(({elapsed:o})=>{t.value&&(t.value.time=o*(e==null?void 0:e.speed))}),(o,i)=>(u.openBlock(),u.createElementBlock("TresMeshWobbleMaterial",u.mergeProps({ref_key:"materialRef",ref:t,factor:o.factor},o.$attrs),null,16,Qi))}});function rt(c,e,t){return Math.max(e,Math.min(t,c))}function Wi(c,e){return(c%e+e)%e}function cs(c,e,t){return(1-t)*c+t*e}class hs{constructor(e=0,t=0){hs.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,s=this.y,n=e.elements;return this.x=n[0]*t+n[3]*s+n[6],this.y=n[1]*t+n[4]*s+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const s=this.length();return this.divideScalar(s||1).multiplyScalar(Math.max(e,Math.min(t,s)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const s=this.dot(e)/t;return Math.acos(rt(s,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,s=this.y-e.y;return t*t+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,s){return this.x=e.x+(t.x-e.x)*s,this.y=e.y+(t.y-e.y)*s,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const s=Math.cos(t),n=Math.sin(t),o=this.x-e.x,i=this.y-e.y;return this.x=o*s-i*n+e.x,this.y=o*n+i*s+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}const je="srgb",us="srgb-linear",cn="display-p3";class Tt{constructor(e,t,s,n,o,i,r,a,h){Tt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,s,n,o,i,r,a,h)}set(e,t,s,n,o,i,r,a,h){const d=this.elements;return d[0]=e,d[1]=n,d[2]=r,d[3]=t,d[4]=o,d[5]=a,d[6]=s,d[7]=i,d[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,s=e.elements;return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],this}extractBasis(e,t,s){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const s=e.elements,n=t.elements,o=this.elements,i=s[0],r=s[3],a=s[6],h=s[1],d=s[4],p=s[7],m=s[2],g=s[5],A=s[8],b=n[0],_=n[3],M=n[6],L=n[1],w=n[4],y=n[7],C=n[2],T=n[5],x=n[8];return o[0]=i*b+r*L+a*C,o[3]=i*_+r*w+a*T,o[6]=i*M+r*y+a*x,o[1]=h*b+d*L+p*C,o[4]=h*_+d*w+p*T,o[7]=h*M+d*y+p*x,o[2]=m*b+g*L+A*C,o[5]=m*_+g*w+A*T,o[8]=m*M+g*y+A*x,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],s=e[1],n=e[2],o=e[3],i=e[4],r=e[5],a=e[6],h=e[7],d=e[8];return t*i*d-t*r*h-s*o*d+s*r*a+n*o*h-n*i*a}invert(){const e=this.elements,t=e[0],s=e[1],n=e[2],o=e[3],i=e[4],r=e[5],a=e[6],h=e[7],d=e[8],p=d*i-r*h,m=r*a-d*o,g=h*o-i*a,A=t*p+s*m+n*g;if(A===0)return this.set(0,0,0,0,0,0,0,0,0);const b=1/A;return e[0]=p*b,e[1]=(n*h-d*s)*b,e[2]=(r*s-n*i)*b,e[3]=m*b,e[4]=(d*t-n*a)*b,e[5]=(n*o-r*t)*b,e[6]=g*b,e[7]=(s*a-h*t)*b,e[8]=(i*t-s*o)*b,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,s,n,o,i,r){const a=Math.cos(o),h=Math.sin(o);return this.set(s*a,s*h,-s*(a*i+h*r)+i+e,-n*h,n*a,-n*(-h*i+a*r)+r+t,0,0,1),this}scale(e,t){return this.premultiply(ps.makeScale(e,t)),this}rotate(e){return this.premultiply(ps.makeRotation(-e)),this}translate(e,t){return this.premultiply(ps.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),s=Math.sin(e);return this.set(t,-s,0,s,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,s=e.elements;for(let n=0;n<9;n++)if(t[n]!==s[n])return!1;return!0}fromArray(e,t=0){for(let s=0;s<9;s++)this.elements[s]=e[s+t];return this}toArray(e=[],t=0){const s=this.elements;return e[t]=s[0],e[t+1]=s[1],e[t+2]=s[2],e[t+3]=s[3],e[t+4]=s[4],e[t+5]=s[5],e[t+6]=s[6],e[t+7]=s[7],e[t+8]=s[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const ps=new Tt;function ds(c){return c<.04045?c*.0773993808:Math.pow(c*.9478672986+.0521327014,2.4)}function fs(c){return c<.0031308?c*12.92:1.055*Math.pow(c,.41666)-.055}const qi=new Tt().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),Ji=new Tt().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function Hi(c){return c.convertSRGBToLinear().applyMatrix3(Ji)}function $i(c){return c.applyMatrix3(qi).convertLinearToSRGB()}const er={[us]:c=>c,[je]:c=>c.convertSRGBToLinear(),[cn]:Hi},tr={[us]:c=>c,[je]:c=>c.convertLinearToSRGB(),[cn]:$i},ze={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(c){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!c},get workingColorSpace(){return us},set workingColorSpace(c){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(c,e,t){if(this.enabled===!1||e===t||!e||!t)return c;const s=er[e],n=tr[t];if(s===void 0||n===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return n(s(c))},fromWorkingColorSpace:function(c,e){return this.convert(c,this.workingColorSpace,e)},toWorkingColorSpace:function(c,e){return this.convert(c,e,this.workingColorSpace)}},hn={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},Re={h:0,s:0,l:0},Ft={h:0,s:0,l:0};function ms(c,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?c+(e-c)*6*t:t<1/2?e:t<2/3?c+(e-c)*6*(2/3-t):c}class Bt{constructor(e,t,s){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,s)}set(e,t,s){if(t===void 0&&s===void 0){const n=e;n&&n.isColor?this.copy(n):typeof n=="number"?this.setHex(n):typeof n=="string"&&this.setStyle(n)}else this.setRGB(e,t,s);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=je){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ze.toWorkingColorSpace(this,t),this}setRGB(e,t,s,n=ze.workingColorSpace){return this.r=e,this.g=t,this.b=s,ze.toWorkingColorSpace(this,n),this}setHSL(e,t,s,n=ze.workingColorSpace){if(e=Wi(e,1),t=rt(t,0,1),s=rt(s,0,1),t===0)this.r=this.g=this.b=s;else{const o=s<=.5?s*(1+t):s+t-s*t,i=2*s-o;this.r=ms(i,o,e+1/3),this.g=ms(i,o,e),this.b=ms(i,o,e-1/3)}return ze.toWorkingColorSpace(this,n),this}setStyle(e,t=je){function s(o){o!==void 0&&parseFloat(o)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const i=n[1],r=n[2];switch(i){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return s(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,t);if(o=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return s(o[4]),this.setRGB(Math.min(100,parseInt(o[1],10))/100,Math.min(100,parseInt(o[2],10))/100,Math.min(100,parseInt(o[3],10))/100,t);break;case"hsl":case"hsla":if(o=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r))return s(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=n[1],i=o.length;if(i===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(o,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=je){const s=hn[e.toLowerCase()];return s!==void 0?this.setHex(s,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ds(e.r),this.g=ds(e.g),this.b=ds(e.b),this}copyLinearToSRGB(e){return this.r=fs(e.r),this.g=fs(e.g),this.b=fs(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=je){return ze.fromWorkingColorSpace(Le.copy(this),e),Math.round(rt(Le.r*255,0,255))*65536+Math.round(rt(Le.g*255,0,255))*256+Math.round(rt(Le.b*255,0,255))}getHexString(e=je){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ze.workingColorSpace){ze.fromWorkingColorSpace(Le.copy(this),t);const s=Le.r,n=Le.g,o=Le.b,i=Math.max(s,n,o),r=Math.min(s,n,o);let a,h;const d=(r+i)/2;if(r===i)a=0,h=0;else{const p=i-r;switch(h=d<=.5?p/(i+r):p/(2-i-r),i){case s:a=(n-o)/p+(n<o?6:0);break;case n:a=(o-s)/p+2;break;case o:a=(s-n)/p+4;break}a/=6}return e.h=a,e.s=h,e.l=d,e}getRGB(e,t=ze.workingColorSpace){return ze.fromWorkingColorSpace(Le.copy(this),t),e.r=Le.r,e.g=Le.g,e.b=Le.b,e}getStyle(e=je){ze.fromWorkingColorSpace(Le.copy(this),e);const t=Le.r,s=Le.g,n=Le.b;return e!==je?`color(${e} ${t.toFixed(3)} ${s.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(s*255)},${Math.round(n*255)})`}offsetHSL(e,t,s){return this.getHSL(Re),Re.h+=e,Re.s+=t,Re.l+=s,this.setHSL(Re.h,Re.s,Re.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,s){return this.r=e.r+(t.r-e.r)*s,this.g=e.g+(t.g-e.g)*s,this.b=e.b+(t.b-e.b)*s,this}lerpHSL(e,t){this.getHSL(Re),e.getHSL(Ft);const s=cs(Re.h,Ft.h,t),n=cs(Re.s,Ft.s,t),o=cs(Re.l,Ft.l,t);return this.setHSL(s,n,o),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,s=this.g,n=this.b,o=e.elements;return this.r=o[0]*t+o[3]*s+o[6]*n,this.g=o[1]*t+o[4]*s+o[7]*n,this.b=o[2]*t+o[5]*s+o[8]*n,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Le=new Bt;Bt.NAMES=hn;class sr extends l.MeshStandardMaterial{constructor(t={}){super();Me(this,"isMeshPhysicalMaterial");Me(this,"clearcoatMap");Me(this,"clearcoatRoughness");Me(this,"clearcoatRoughnessMap");Me(this,"clearcoatNormalScale");Me(this,"clearcoatNormalMap");Me(this,"ior");Me(this,"transmissionMap");Me(this,"thickness");Me(this,"thicknessMap");Me(this,"attenuationDistance");Me(this,"attenuationColor");Me(this,"specularIntensity");Me(this,"specularIntensityMap");Me(this,"specularColor");Me(this,"specularColorMap");Me(this,"_clearcoat");Me(this,"_transmission");this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new hs(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get(){return rt(2.5*(this.ior-1)/(this.ior+1),0,1)},set(s){this.ior=(1+.4*s)/(1-.4*s)}}),this.roughness=0,this.transmissionMap=null,this.thickness=.5,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Bt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Bt(1,1,1),this.specularColorMap=null,this._clearcoat=.5,this._transmission=1,this.setValues(t)}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=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.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.ior=t.ior,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}}const nr=sr,or=u.defineComponent({__name:"index",setup(c,{expose:e}){const t=u.shallowRef(),{extend:s}=ge.useTresContext();return s({MeshGlassMaterial:nr}),e({MeshGlassMaterialClass:t}),(n,o)=>(u.openBlock(),u.createElementBlock("TresMeshGlassMaterial",{ref_key:"MeshGlassMaterialClass",ref:t},null,512))}}),ir=["args"],rr=["color"],ar=u.defineComponent({__name:"Box",props:{args:{default:()=>[1,1,1]},color:{default:"#ffffff"}},setup(c,{expose:e}){const t=c,{args:s,color:n}=u.toRefs(t),o=u.shallowRef();return e({value:o}),(i,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"boxRef",ref:o},i.$attrs),[u.createElementVNode("TresBoxGeometry",{args:u.unref(s)},null,8,ir),u.renderSlot(i.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,rr)])],16))}}),lr=["args"],cr=["color"],hr=u.defineComponent({__name:"Circle",props:{args:{default:()=>[1,32,0,Math.PI*2]},color:{default:"#ffffff"}},setup(c,{expose:e}){const t=c,{args:s,color:n}=u.toRefs(t),o=u.shallowRef();return e({value:o}),(i,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"circleRef",ref:o},i.$attrs),[u.createElementVNode("TresCircleGeometry",{args:u.unref(s)},null,8,lr),u.renderSlot(i.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,cr)])],16))}}),ur=["args"],pr=["color"],dr=u.defineComponent({__name:"Cone",props:{args:{default:()=>[1,1,12,12,!1,0,Math.PI*2]},color:{default:"#ffffff"}},setup(c,{expose:e}){const t=c,{args:s,color:n}=u.toRefs(t),o=u.shallowRef();return e({value:o}),(i,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"coneRef",ref:o},i.$attrs),[u.createElementVNode("TresConeGeometry",{args:u.unref(s)},null,8,ur),u.renderSlot(i.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,pr)])],16))}}),fr=["args"],mr=["color"],gr=u.defineComponent({__name:"Dodecahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(c,{expose:e}){const t=c,{args:s,color:n}=u.toRefs(t),o=u.shallowRef();return e({value:o}),(i,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"dodecahedronRef",ref:o},i.$attrs),[u.createElementVNode("TresDodecahedronGeometry",{args:u.unref(s)},null,8,fr),u.renderSlot(i.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,mr)])],16))}}),yr=["args"],_r=["color"],wr=u.defineComponent({__name:"Icosahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(c,{expose:e}){const t=c,{args:s,color:n}=u.toRefs(t),o=u.shallowRef();return e({value:o}),(i,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"icosahedronRef",ref:o},i.$attrs),[u.createElementVNode("TresIcosahedronGeometry",{args:u.unref(s)},null,8,yr),u.renderSlot(i.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,_r)])],16))}}),xr=["args"],br=["color"],vr=u.defineComponent({__name:"Octahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(c,{expose:e}){const t=c,{args:s,color:n}=u.toRefs(t),o=u.shallowRef();return e({value:o}),(i,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"octahedronRef",ref:o},i.$attrs),[u.createElementVNode("TresOctahedronGeometry",{args:u.unref(s)},null,8,xr),u.renderSlot(i.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,br)])],16))}}),Ar=["rotation"],Mr=["args"],Sr=["color"],Tr=u.defineComponent({__name:"Plane",props:{args:{default:()=>[1,1]},color:{default:"#ffffff"}},setup(c,{expose:e}){const t=c,{args:s,color:n}=u.toRefs(t),o=u.shallowRef();return e({value:o}),(i,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"planeRef",ref:o,rotation:[-Math.PI/2,0,0]},i.$attrs),[u.createElementVNode("TresPlaneGeometry",{args:u.unref(s)},null,8,Mr),u.renderSlot(i.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,Sr)])],16,Ar))}}),Cr=["args"],Lr=["color"],Pr=u.defineComponent({__name:"Ring",props:{args:{default:()=>[.5,1,32]},color:{default:"#ffffff"}},setup(c,{expose:e}){const t=c,{args:s,color:n}=u.toRefs(t),o=u.shallowRef();return e({value:o}),(i,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"ringRef",ref:o},i.$attrs),[u.createElementVNode("TresRingGeometry",{args:u.unref(s)},null,8,Cr),u.renderSlot(i.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,Lr)])],16))}}),Or=["args"],Ir=["color"],Dr=u.defineComponent({__name:"Sphere",props:{args:{default:()=>[2,32,16]},color:{default:"#ffffff"}},setup(c,{expose:e}){const t=c,{args:s,color:n}=u.toRefs(t),o=u.shallowRef();return e({value:o}),(i,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"sphereRef",ref:o},i.$attrs),[u.createElementVNode("TresSphereGeometry",{args:u.unref(s)},null,8,Or),u.renderSlot(i.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,Ir)])],16))}}),kr=["rotation"],Fr=["args"],Br=["color"],Ur=u.defineComponent({__name:"Tetrahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(c,{expose:e}){const t=c,{args:s,color:n}=u.toRefs(t),o=u.shallowRef();return e({value:o}),(i,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"tetrahedronRef",ref:o,rotation:[-Math.PI/2,0,0]},i.$attrs),[u.createElementVNode("TresTetrahedronGeometry",{args:u.unref(s)},null,8,Fr),u.renderSlot(i.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,Br)])],16,kr))}}),Nr=["args"],Vr=["color"],zr=u.defineComponent({__name:"Torus",props:{args:{default:()=>[1,1,16,80]},color:{default:"#ffffff"}},setup(c,{expose:e}){const t=c,{args:s,color:n}=u.toRefs(t),o=u.shallowRef();return e({value:o}),(i,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"torusRef",ref:o},i.$attrs),[u.createElementVNode("TresTorusGeometry",{args:u.unref(s)},null,8,Nr),u.renderSlot(i.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,Vr)])],16))}}),Rr=["args"],Gr=["color"],Er=u.defineComponent({__name:"TorusKnot",props:{args:{default:()=>[1,.4,64,8]},color:{default:"#ffffff"}},setup(c,{expose:e}){const t=c,{args:s,color:n}=u.toRefs(t),o=u.shallowRef();return e({value:o}),(i,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"torusKnotRef",ref:o},i.$attrs),[u.createElementVNode("TresTorusKnotGeometry",{args:u.unref(s)},null,8,Rr),u.renderSlot(i.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,Gr)])],16))}}),jr=["args"],Yr=["color"],Xr=u.defineComponent({__name:"Tube",props:{args:{default:()=>[new l.QuadraticBezierCurve3(new l.Vector3(-1,0,0),new l.Vector3(0,1,0),new l.Vector3(1,0,0)),20,.2,8,!1]},color:{default:"#ffffff"}},setup(c,{expose:e}){const t=c,{args:s,color:n}=u.toRefs(t),o=u.shallowRef();return e({value:o}),(i,r)=>(u.openBlock(),u.createElementBlock("TresMesh",u.mergeProps({ref_key:"tubeRef",ref:o},i.$attrs),[u.createElementVNode("TresTubeGeometry",{args:u.unref(s)},null,8,jr),u.renderSlot(i.$slots,"default",{},()=>[u.createElementVNode("TresMeshBasicMaterial",{color:u.unref(n)},null,8,Yr)])],16))}}),Zr=u.defineComponent({name:"Environment",props:["background","blur","files","encoding","path","preset"],async setup(c,{expose:e}){let t=null;return e({getTexture:()=>t}),t=await Ks(c),()=>{}}}),Qr=["receive-shadow","rotation"],Kr=["args"],Wr=u.createElementVNode("TresMeshStandardMaterial",{color:8421504,side:2},null,-1),qr=u.defineComponent({__name:"Backdrop",props:{floor:{default:.25},segments:{default:20},receiveShadow:{type:Boolean,default:!1}},setup(c){const e=c,t=r=>r===0?0:2**(10*r-10),{floor:s,segments:n,receiveShadow:o}=u.toRefs(e),i=u.ref(null);return u.watch(()=>[n.value,s.value,i.value],([r,a,h])=>{if(!h||r===null)return;let d=0;const p=r/r/2,m=h.attributes.position;for(let g=0;g<r+1;g++)for(let A=0;A<r+1;A++)m.setXYZ(d++,g/r-p+(g===0?-a:0),A/r-p,t(g/r));m.needsUpdate=!0,h.computeVertexNormals()}),(r,a)=>(u.openBlock(),u.createElementBlock("TresGroup",u.normalizeProps(u.guardReactiveProps(r.$attrs)),[u.createElementVNode("TresMesh",{"receive-shadow":u.unref(o),rotation:[-Math.PI/2,0,Math.PI/2]},[u.createElementVNode("TresPlaneGeometry",{ref_key:"planeRef",ref:i,args:[1,1,u.unref(n),u.unref(n)]},null,8,Kr),u.renderSlot(r.$slots,"default",{},()=>[Wr])],8,Qr)],16))}}),Jr=["geometry"],Hr=["map","opacity","depth-write"],$r=["args"],ea=["rotation","args"],ta=u.defineComponent({__name:"ContactShadows",props:{opacity:{default:1},width:{default:1},height:{default:1},blur:{default:1},far:{default:10},smooth:{type:Boolean,default:!0},resolution:{default:512},frames:{default:1/0},scale:{default:10},color:{default:"#000000"},depthWrite:{type:Boolean,default:!1},helper:{type:Boolean,default:!1}},setup(c,{expose:e}){const t=c,s=u.shallowRef(),n=u.shallowRef();e(s);let o,i,r,a,h;const{renderer:d,scene:p}=ge.useTresContext(),m=u.computed(()=>t.width*(Array.isArray(t.scale)?t.scale[0]:t.scale||1)),g=u.computed(()=>t.height*(Array.isArray(t.scale)?t.scale[1]:t.scale||1));u.watchEffect(()=>{o&&o.dispose(),i&&i.dispose(),r&&r.dispose(),a&&a.geometry.dispose(),o=new l.WebGLRenderTarget(t.resolution,t.resolution),i=new l.WebGLRenderTarget(t.resolution,t.resolution),i.texture.generateMipmaps=o.texture.generateMipmaps=!1,n.value=new l.OrthographicCamera(-m.value/2,m.value/2,g.value/2,-g.value/2,0,t.far),r=new l.PlaneGeometry(m.value,g.value).rotateX(Math.PI/2),a=new l.Mesh(r),a.visible=!1}),u.watchEffect(()=>{t.color&&(h&&h.dispose(),h=new l.MeshDepthMaterial,h.depthTest=h.depthWrite=!1,h.onBeforeCompile=C=>{C.uniforms={...C.uniforms,ucolor:{value:t.color?new l.Color(t.color):new l.Color}},C.fragmentShader=C.fragmentShader.replace("void main() {",`uniform vec3 ucolor;
|
|
94
|
+
void main() {
|
|
95
|
+
`),C.fragmentShader=C.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")})});const A=new l.ShaderMaterial(Ao),b=new l.ShaderMaterial(Mo);b.depthTest=A.depthTest=!1;function _(C){!d.value||!n.value||(a.visible=!0,a.material=A,A.uniforms.tDiffuse.value=o.texture,A.uniforms.h.value=C/256,d.value.setRenderTarget(i),d.value.render(a,n.value),a.material=b,b.uniforms.tDiffuse.value=i.texture,b.uniforms.v.value=C/256,d.value.setRenderTarget(o),d.value.render(a,n.value),a.visible=!1)}const{onLoop:M}=ge.useRenderLoop();let L=0,w,y;return M(()=>{!n.value||p.value===void 0||d.value===void 0||(t.frames===1/0||L<t.frames)&&(L++,w=p.value.background,y=p.value.overrideMaterial,s.value.visible=!1,p.value.background=null,p.value.overrideMaterial=h,d.value.setRenderTarget(o),d.value.render(p.value,n.value),_(t.blur),t.smooth&&_(t.blur*.4),d.value.setRenderTarget(null),s.value.visible=!0,p.value.background=w,p.value.overrideMaterial=y)}),(C,T)=>{const x=u.resolveComponent("primitive");return u.openBlock(),u.createElementBlock("TresGroup",u.mergeProps({ref_key:"groupRef",ref:s},C.$attrs),[u.createElementVNode("TresMesh",{scale:[1,-1,1],geometry:u.unref(r)},[u.createElementVNode("TresMeshBasicMaterial",{map:u.unref(o).texture,opacity:C.opacity,"depth-write":C.depthWrite,transparent:!0},null,8,Hr)],8,Jr),u.createVNode(x,{object:u.unref(a)},null,8,["object"]),n.value&&C.helper?(u.openBlock(),u.createElementBlock("TresCameraHelper",{key:0,args:[n.value]},null,8,$r)):u.createCommentVNode("",!0),u.createElementVNode("TresOrthographicCamera",{ref_key:"shadowCamera",ref:n,position:[0,0,0],rotation:[Math.PI/2,0,0],args:[-m.value/2,m.value/2,g.value/2,-g.value/2,0,C.far]},null,8,ea)],16)}}}),sa=["position","a-scale"],na=["size","size-attenuation","transparent","alpha-test","alpha-map"],oa=u.defineComponent({__name:"Stars",props:{size:{default:.1},sizeAttenuation:{type:Boolean,default:!0},transparent:{type:Boolean,default:!0},alphaTest:{default:.01},count:{default:5e3},depth:{default:50},radius:{default:100},alphaMap:{default:null}},setup(c,{expose:e}){const t=c,s=u.ref(),n=u.ref(),{radius:o,depth:i,count:r,size:a,sizeAttenuation:h,transparent:d,alphaMap:p,alphaTest:m}=u.toRefs(t),g=()=>{let b=o.value+i.value;const _=u.computed(()=>i.value/r.value),M=[],L=Array.from({length:r.value},()=>(.5+.5*Math.random())*4),w=y=>new l.Vector3().setFromSpherical(new l.Spherical(y,Math.acos(1-Math.random()*2),Math.random()*2*Math.PI)).toArray();for(let y=0;y<r.value;y++)b-=_.value*Math.random(),M.push(...w(b));s.value=new Float32Array(M),n.value=new Float32Array(L)};u.watchEffect(()=>{g()});const A=u.shallowRef();return e({value:A}),(b,_)=>(u.openBlock(),u.createElementBlock("TresPoints",{ref_key:"starsRef",ref:A},[u.createElementVNode("TresBufferGeometry",{position:[s.value,3],"a-scale":[n.value,1]},null,8,sa),u.createElementVNode("TresPointsMaterial",{size:u.unref(a),"size-attenuation":u.unref(h),transparent:u.unref(d),"alpha-test":u.unref(m),"alpha-map":u.unref(p)},null,8,na)],512))}}),ia=["size","color","alpha-map","map","opacity","alpha-test","depth-write","transparent","size-attenuation"],ra=["position","velocity"],aa=u.defineComponent({__name:"Precipitation",props:{size:{default:.1},area:{default:()=>[10,10,20]},color:{default:16777215},map:{},alphaMap:{},alphaTest:{default:.01},opacity:{default:.8},count:{default:5e3},speed:{default:.1},randomness:{default:.5},depthWrite:{type:Boolean,default:!1},transparent:{type:Boolean,default:!0},sizeAttenuation:{type:Boolean,default:!0}},setup(c){const e=c,{size:t,area:s,color:n,alphaMap:o,map:i,opacity:r,alphaTest:a,depthWrite:h,transparent:d,sizeAttenuation:p,count:m,speed:g,randomness:A}=u.toRefs(e),b=u.shallowRef();let _=[],M=[];const L=()=>{_=new Float32Array(m.value*3);for(let C=0;C<m.value;C++){const T=C*3;_[T]=(Math.random()-.5)*s.value[0],_[T+1]=(Math.random()-.5)*s.value[1],_[T+2]=(Math.random()-.5)*s.value[2]}},w=()=>{M=new Float32Array(m.value*2);for(let C=0;C<m.value*2;C+=2)M[C]=(Math.random()-.5)/5*g.value*A.value,M[C+1]=Math.random()/5*g.value+.01};w(),L(),u.watchEffect(()=>{w(),L()});const{onLoop:y}=ge.useRenderLoop();return y(()=>{var C,T;if((C=b.value)!=null&&C.attributes.position.array&&((T=b.value)!=null&&T.attributes.position.count)){const x=b.value.attributes.position.array;for(let v=0;v<b.value.attributes.position.count;v++){const D=M[v*2],z=M[v*2+1];x[v*3]+=D,x[v*3+1]-=z,(x[v*3]<=-s.value[0]/2||x[v*3]>=s.value[0]/2)&&(x[v*3]=x[v*3]*-1),(x[v*3+1]<=-s.value[1]/2||x[v*3+1]>=s.value[1]/2)&&(x[v*3+1]=x[v*3+1]*-1)}b.value.attributes.position.needsUpdate=!0}}),(C,T)=>(u.openBlock(),u.createElementBlock("TresPoints",null,[u.createElementVNode("TresPointsMaterial",{size:u.unref(t),color:u.unref(n),"alpha-map":u.unref(o),map:u.unref(i),opacity:u.unref(r),"alpha-test":u.unref(a),"depth-write":u.unref(h),transparent:u.unref(d),"size-attenuation":u.unref(p)},null,8,ia),u.createElementVNode("TresBufferGeometry",{ref_key:"geometryRef",ref:b,position:[u.unref(_),3],velocity:[u.unref(M)]},null,8,ra)]))}}),la=["position"],ca=["position"],ha=["scale"],ua=["map","depth-test","color-space","color","opacity"],pa=u.defineComponent({__name:"Smoke",props:{color:{default:"#ffffff"},opacity:{default:.5},speed:{default:.4},width:{default:10},depth:{default:1.5},segments:{default:20},texture:{default:"https://raw.githubusercontent.com/Tresjs/assets/main/textures/clouds/defaultCloud.png"},depthTest:{type:Boolean,default:!0}},async setup(c,{expose:e}){let t,s;const n=c,{width:o,depth:i,segments:r,texture:a,color:h,depthTest:d,opacity:p,speed:m}=u.toRefs(n),g=u.shallowRef(),A=u.shallowRef();e({value:g});const b=[...new Array(r)].map((T,x)=>({x:o.value/2-Math.random()*o.value,y:o.value/2-Math.random()*o.value,scale:.4+Math.sin((x+1)/r.value*Math.PI)*((.2+Math.random())*10),density:Math.max(.2,Math.random()),rotation:Math.max(.002,.005*Math.random())*m.value})),_=(T,x)=>T/6*x*p.value,{map:M}=([t,s]=u.withAsyncContext(()=>ge.useTexture({map:a.value})),t=await t,s(),t),{renderer:L,camera:w}=ge.useTresContext(),y=u.computed(()=>{var T;return(T=L.value)==null?void 0:T.outputColorSpace}),{onLoop:C}=ge.useRenderLoop();return C(()=>{var T,x;g.value&&w.value&&A.value&&((T=A.value)==null||T.children.forEach((v,D)=>{v.rotation.z+=b[D].rotation}),g.value.lookAt((x=w.value)==null?void 0:x.position))}),(T,x)=>(u.openBlock(),u.createElementBlock("TresGroup",u.mergeProps({ref_key:"smokeRef",ref:g},T.$attrs),[u.createElementVNode("TresGroup",{ref_key:"groupRef",ref:A,position:[0,0,u.unref(r)/2*u.unref(i)]},[(u.openBlock(!0),u.createElementBlock(u.Fragment,null,u.renderList(u.unref(b),({scale:v,x:D,y:z,density:U},R)=>(u.openBlock(),u.createElementBlock("TresMesh",{key:`${R}`,position:[D,z,-R*u.unref(i)]},[u.createElementVNode("TresPlaneGeometry",{scale:[v,v,v],rotation:[0,0,0]},null,8,ha),u.createElementVNode("TresMeshStandardMaterial",{map:u.unref(M),"depth-test":u.unref(d),"color-space":y.value,color:u.unref(h),"depth-write":!1,transparent:"",opacity:_(v,U)},null,8,ua)],8,ca))),128))],8,la)],16))}});let Ye;const da=(c="body")=>{Ye||(Ye=new mn.Pane({container:document.querySelector(c)}),Ye.element.style.position="absolute",Ye.element.style.top="1rem",Ye.element.style.right="1rem",Ye.element.style.zIndex="9999");const{logWarning:e}=ts();e("useTweakPane is going to be deprecated soon and will no longer be part of this package, please start migrating to @tresjs/leches package https://github.com/Tresjs/leches or v-tweakpane https://github.com/vinayakkulkarni/v-tweakpane instead.");function t(){Ye&&Ye.dispose()}return u.onMounted(()=>{const{resume:s}=ge.useRenderLoop();s()}),u.onUnmounted(()=>{t()}),{pane:Ye,disposeTweakPane:t}};var un={exports:{}};(function(c,e){(function(t,s){c.exports=s()})(Wo,function(){var t=function(){function s(g){return i.appendChild(g.dom),g}function n(g){for(var A=0;A<i.children.length;A++)i.children[A].style.display=A===g?"block":"none";o=g}var o=0,i=document.createElement("div");i.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",i.addEventListener("click",function(g){g.preventDefault(),n(++o%i.children.length)},!1);var r=(performance||Date).now(),a=r,h=0,d=s(new t.Panel("FPS","#0ff","#002")),p=s(new t.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var m=s(new t.Panel("MB","#f08","#201"));return n(0),{REVISION:16,dom:i,addPanel:s,showPanel:n,begin:function(){r=(performance||Date).now()},end:function(){h++;var g=(performance||Date).now();if(p.update(g-r,200),g>a+1e3&&(d.update(1e3*h/(g-a),100),a=g,h=0,m)){var A=performance.memory;m.update(A.usedJSHeapSize/1048576,A.jsHeapSizeLimit/1048576)}return g},update:function(){r=this.end()},domElement:i,setMode:n}};return t.Panel=function(s,n,o){var i=1/0,r=0,a=Math.round,h=a(window.devicePixelRatio||1),d=80*h,p=48*h,m=3*h,g=2*h,A=3*h,b=15*h,_=74*h,M=30*h,L=document.createElement("canvas");L.width=d,L.height=p,L.style.cssText="width:80px;height:48px";var w=L.getContext("2d");return w.font="bold "+9*h+"px Helvetica,Arial,sans-serif",w.textBaseline="top",w.fillStyle=o,w.fillRect(0,0,d,p),w.fillStyle=n,w.fillText(s,m,g),w.fillRect(A,b,_,M),w.fillStyle=o,w.globalAlpha=.9,w.fillRect(A,b,_,M),{dom:L,update:function(y,C){i=Math.min(i,y),r=Math.max(r,y),w.fillStyle=o,w.globalAlpha=1,w.fillRect(0,0,d,b),w.fillStyle=n,w.fillText(a(y)+" "+s+" ("+a(i)+"-"+a(r)+")",m,g),w.drawImage(L,A+h,b,_-h,M,A,b,_-h,M),w.fillRect(A+_-h,b,h,M),w.fillStyle=o,w.globalAlpha=.9,w.fillRect(A+_-h,b,h,a((1-y/C)*M))}}},t})})(un);var fa=un.exports;const ma=qo(fa),ga=(c=0)=>{const e=new ma;if(e){const t=document.body;e.showPanel(c),t==null||t.appendChild(e.dom),u.onMounted(()=>{const{onBeforeLoop:s,onAfterLoop:n,resume:o}=ge.useRenderLoop();o(),s(()=>e.begin()),n(()=>e.end())}),u.onUnmounted(()=>{t==null||t.removeChild(e.dom)})}return null};$.Backdrop=qr,$.Box=ar,$.CameraControls=Xi,$.Circle=hr,$.Cone=dr,$.ContactShadows=ta,$.Dodecahedron=gr,$.Environment=Zr,$.FBXModel=vi,$.GLTFModel=bi,$.Icosahedron=wr,$.KeyboardControls=Di,$.Levioso=ni,$.MapControls=Vi,$.MeshGlassMaterial=or,$.MeshWobbleMaterial=Ki,$.MouseParallax=wi,$.Octahedron=vr,$.OrbitControls=Li,$.Plane=Tr,$.PointerLockControls=Ui,$.Precipitation=aa,$.Ring=Pr,$.SVG=Mi,$.ScrollControls=zi,$.Smoke=pa,$.Sphere=Dr,$.Stars=oa,$.Tetrahedron=Ur,$.Text3D=ti,$.Torus=zr,$.TorusKnot=Er,$.TransformControls=Fi,$.Tube=Xr,$.stats=ga,$.useAnimations=si,$.useEnvironment=Ks,$.useFBX=qs,$.useGLTF=Ws,$.useProgress=Si,$.useTweakPane=da,$.useVideoTexture=Ti,Object.defineProperty($,Symbol.toStringTag,{value:"Module"})});
|