@tresjs/cientos 3.5.1 → 3.7.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/Lensflare/component.vue.d.ts +77 -60
- package/dist/core/abstractions/Levioso.vue.d.ts +39 -38
- package/dist/core/abstractions/MouseParallax.vue.d.ts +26 -27
- package/dist/core/abstractions/Reflector.vue.d.ts +107 -0
- package/dist/core/abstractions/Text3D.vue.d.ts +42 -99
- package/dist/core/abstractions/index.d.ts +4 -1
- package/dist/core/abstractions/useFBO/component.vue.d.ts +26 -32
- package/dist/core/abstractions/useSurfaceSampler/component.vue.d.ts +21 -0
- package/dist/core/abstractions/useSurfaceSampler/index.d.ts +614 -0
- package/dist/core/controls/CameraControls.vue.d.ts +853 -303
- package/dist/core/controls/KeyboardControls.vue.d.ts +38 -75
- package/dist/core/controls/MapControls.vue.d.ts +22 -23
- package/dist/core/controls/OrbitControls.vue.d.ts +741 -634
- package/dist/core/controls/PointerLockControls.vue.d.ts +25 -30
- package/dist/core/controls/ScrollControls.vue.d.ts +43 -44
- package/dist/core/controls/TransformControls.vue.d.ts +37 -94
- package/dist/core/loaders/SVG/component.vue.d.ts +117 -60
- package/dist/core/loaders/useFBX/component.vue.d.ts +14 -11
- package/dist/core/loaders/useGLTF/component.vue.d.ts +33 -28
- package/dist/core/materials/customShaderMaterial/index.vue.d.ts +22 -0
- package/dist/core/materials/index.d.ts +2 -1
- package/dist/core/materials/meshWobbleMaterial/index.vue.d.ts +30 -19
- package/dist/core/misc/html/HTML.vue.d.ts +36 -103
- package/dist/core/shapes/Box.vue.d.ts +25 -20
- package/dist/core/shapes/CatmullRomCurve3.vue.d.ts +46 -103
- package/dist/core/shapes/Circle.vue.d.ts +25 -20
- package/dist/core/shapes/Cone.vue.d.ts +25 -20
- package/dist/core/shapes/Dodecahedron.vue.d.ts +25 -20
- package/dist/core/shapes/Icosahedron.vue.d.ts +25 -20
- package/dist/core/shapes/Line2.vue.d.ts +40 -91
- package/dist/core/shapes/Octahedron.vue.d.ts +25 -20
- package/dist/core/shapes/Plane.vue.d.ts +25 -20
- package/dist/core/shapes/Ring.vue.d.ts +25 -20
- package/dist/core/shapes/Sphere.vue.d.ts +25 -20
- package/dist/core/shapes/Superformula.vue.d.ts +85 -0
- package/dist/core/shapes/Tetrahedron.vue.d.ts +25 -20
- package/dist/core/shapes/Torus.vue.d.ts +25 -20
- package/dist/core/shapes/TorusKnot.vue.d.ts +25 -20
- package/dist/core/shapes/Tube.vue.d.ts +25 -20
- package/dist/core/shapes/index.d.ts +2 -1
- package/dist/core/staging/Backdrop.vue.d.ts +26 -27
- package/dist/core/staging/Precipitation.vue.d.ts +43 -104
- package/dist/core/staging/Sky.vue.d.ts +56 -59
- package/dist/core/staging/Smoke.vue.d.ts +37 -68
- package/dist/core/staging/Sparkles/ShaderData.d.ts +37 -0
- package/dist/core/staging/Sparkles/ShaderDataBuilder.d.ts +43 -0
- package/dist/core/staging/Sparkles/component.vue.d.ts +245 -0
- package/dist/core/staging/Sparkles/useEmptyDataTexture.d.ts +2 -0
- package/dist/core/staging/Stars.vue.d.ts +39 -70
- package/dist/core/staging/index.d.ts +4 -3
- package/dist/trescientos.js +8315 -5304
- package/dist/trescientos.umd.cjs +294 -20
- package/dist/utils/Gradient.d.ts +11 -0
- package/package.json +25 -23
package/dist/trescientos.umd.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @tresjs/cientos
|
|
3
|
-
* version: v3.
|
|
3
|
+
* version: v3.7.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(q,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("three"),require("vue"),require("@tresjs/core"),require("tweakpane")):typeof define=="function"&&define.amd?define(["exports","three","vue","@tresjs/core","tweakpane"],c):(q=typeof globalThis<"u"?globalThis:q||self,c(q.trescientos={},q.Three,q.Vue,q.TresjsCore,q.tweakpane))})(this,function(q,c,h,ne,Li){"use strict";var kc=Object.defineProperty;var Fc=(q,c,h)=>c in q?kc(q,c,{enumerable:!0,configurable:!0,writable:!0,value:h}):q[c]=h;var Me=(q,c,h)=>(Fc(q,typeof c!="symbol"?c+"":c,h),h);function ts(a,e){if(e===c.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),a;if(e===c.TriangleFanDrawMode||e===c.TriangleStripDrawMode){let t=a.getIndex();if(t===null){const o=[],r=a.getAttribute("position");if(r!==void 0){for(let l=0;l<r.count;l++)o.push(l);a.setIndex(o),t=a.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),a}const n=t.count-2,s=[];if(t)if(e===c.TriangleFanDrawMode)for(let o=1;o<=n;o++)s.push(t.getX(0)),s.push(t.getX(o)),s.push(t.getX(o+1));else for(let o=0;o<n;o++)o%2===0?(s.push(t.getX(o)),s.push(t.getX(o+1)),s.push(t.getX(o+2))):(s.push(t.getX(o+2)),s.push(t.getX(o+1)),s.push(t.getX(o)));s.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const i=a.clone();return i.setIndex(s),i.clearGroups(),i}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),a}const Ti=parseInt(c.REVISION.replace(/\D+/g,""));var Ue=Uint8Array,nt=Uint16Array,mn=Uint32Array,ns=new Ue([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]),ss=new Ue([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]),Oi=new Ue([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),is=function(a,e){for(var t=new nt(31),n=0;n<31;++n)t[n]=e+=1<<a[n-1];for(var s=new mn(t[30]),n=1;n<30;++n)for(var i=t[n];i<t[n+1];++i)s[i]=i-t[n]<<5|n;return[t,s]},os=is(ns,2),rs=os[0],Di=os[1];rs[28]=258,Di[258]=28;for(var Ii=is(ss,0),ki=Ii[0],gn=new nt(32768),be=0;be<32768;++be){var st=(be&43690)>>>1|(be&21845)<<1;st=(st&52428)>>>2|(st&13107)<<2,st=(st&61680)>>>4|(st&3855)<<4,gn[be]=((st&65280)>>>8|(st&255)<<8)>>>1}for(var Lt=function(a,e,t){for(var n=a.length,s=0,i=new nt(e);s<n;++s)++i[a[s]-1];var o=new nt(e);for(s=0;s<e;++s)o[s]=o[s-1]+i[s-1]<<1;var r;if(t){r=new nt(1<<e);var l=15-e;for(s=0;s<n;++s)if(a[s])for(var f=s<<4|a[s],d=e-a[s],u=o[a[s]-1]++<<d,p=u|(1<<d)-1;u<=p;++u)r[gn[u]>>>l]=f}else for(r=new nt(n),s=0;s<n;++s)a[s]&&(r[s]=gn[o[a[s]-1]++]>>>15-a[s]);return r},Tt=new Ue(288),be=0;be<144;++be)Tt[be]=8;for(var be=144;be<256;++be)Tt[be]=9;for(var be=256;be<280;++be)Tt[be]=7;for(var be=280;be<288;++be)Tt[be]=8;for(var as=new Ue(32),be=0;be<32;++be)as[be]=5;var Fi=Lt(Tt,9,1),Bi=Lt(as,5,1),yn=function(a){for(var e=a[0],t=1;t<a.length;++t)a[t]>e&&(e=a[t]);return e},Re=function(a,e,t){var n=e/8|0;return(a[n]|a[n+1]<<8)>>(e&7)&t},_n=function(a,e){var t=e/8|0;return(a[t]|a[t+1]<<8|a[t+2]<<16)>>(e&7)},Ui=function(a){return(a/8|0)+(a&7&&1)},Vi=function(a,e,t){(e==null||e<0)&&(e=0),(t==null||t>a.length)&&(t=a.length);var n=new(a instanceof nt?nt:a instanceof mn?mn:Ue)(t-e);return n.set(a.subarray(e,t)),n},zi=function(a,e,t){var n=a.length;if(!n||t&&!t.l&&n<5)return e||new Ue(0);var s=!e||t,i=!t||t.i;t||(t={}),e||(e=new Ue(n*3));var o=function(j){var D=e.length;if(j>D){var E=new Ue(Math.max(D*2,j));E.set(e),e=E}},r=t.f||0,l=t.p||0,f=t.b||0,d=t.l,u=t.d,p=t.m,g=t.n,x=n*8;do{if(!d){t.f=r=Re(a,l,1);var w=Re(a,l+1,3);if(l+=3,w)if(w==1)d=Fi,u=Bi,p=9,g=5;else if(w==2){var v=Re(a,l,31)+257,y=Re(a,l+10,15)+4,A=v+Re(a,l+5,31)+1;l+=14;for(var S=new Ue(A),b=new Ue(19),P=0;P<y;++P)b[Oi[P]]=Re(a,l+P*3,7);l+=y*3;for(var O=yn(b),k=(1<<O)-1,V=Lt(b,O,1),P=0;P<A;){var R=V[Re(a,l,k)];l+=R&15;var _=R>>>4;if(_<16)S[P++]=_;else{var X=0,K=0;for(_==16?(K=3+Re(a,l,3),l+=2,X=S[P-1]):_==17?(K=3+Re(a,l,7),l+=3):_==18&&(K=11+Re(a,l,127),l+=7);K--;)S[P++]=X}}var H=S.subarray(0,v),he=S.subarray(v);p=yn(H),g=yn(he),d=Lt(H,p,1),u=Lt(he,g,1)}else throw"invalid block type";else{var _=Ui(l)+4,M=a[_-4]|a[_-3]<<8,L=_+M;if(L>n){if(i)throw"unexpected EOF";break}s&&o(f+M),e.set(a.subarray(_,L),f),t.b=f+=M,t.p=l=L*8;continue}if(l>x){if(i)throw"unexpected EOF";break}}s&&o(f+131072);for(var J=(1<<p)-1,G=(1<<g)-1,oe=l;;oe=l){var X=d[_n(a,l)&J],se=X>>>4;if(l+=X&15,l>x){if(i)throw"unexpected EOF";break}if(!X)throw"invalid length/literal";if(se<256)e[f++]=se;else if(se==256){oe=l,d=null;break}else{var ce=se-254;if(se>264){var P=se-257,U=ns[P];ce=Re(a,l,(1<<U)-1)+rs[P],l+=U}var T=u[_n(a,l)&G],m=T>>>4;if(!T)throw"invalid distance";l+=T&15;var he=ki[m];if(m>3){var U=ss[m];he+=_n(a,l)&(1<<U)-1,l+=U}if(l>x){if(i)throw"unexpected EOF";break}s&&o(f+131072);for(var F=f+ce;f<F;f+=4)e[f]=e[f-he],e[f+1]=e[f+1-he],e[f+2]=e[f+2-he],e[f+3]=e[f+3-he];f=F}}t.l=d,t.p=oe,t.b=f,d&&(r=1,t.m=p,t.d=u,t.n=g)}while(!r);return f==e.length?e:Vi(e,0,f)},Ni=new Ue(0),Gi=function(a){if((a[0]&15)!=8||a[0]>>>4>7||(a[0]<<8|a[1])%31)throw"invalid zlib data";if(a[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function Ri(a,e){return zi((Gi(a),a.subarray(2,-4)),e)}var ji=typeof TextDecoder<"u"&&new TextDecoder,Ei=0;try{ji.decode(Ni,{stream:!0}),Ei=1}catch{}var Xi=Object.defineProperty,Yi=(a,e,t)=>e in a?Xi(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,z=(a,e,t)=>(Yi(a,typeof e!="symbol"?e+"":e,t),t);class Wi extends c.Object3D{constructor(e,t){super(),z(this,"isTransformControls",!0),z(this,"visible",!1),z(this,"domElement"),z(this,"raycaster",new c.Raycaster),z(this,"gizmo"),z(this,"plane"),z(this,"tempVector",new c.Vector3),z(this,"tempVector2",new c.Vector3),z(this,"tempQuaternion",new c.Quaternion),z(this,"unit",{X:new c.Vector3(1,0,0),Y:new c.Vector3(0,1,0),Z:new c.Vector3(0,0,1)}),z(this,"pointStart",new c.Vector3),z(this,"pointEnd",new c.Vector3),z(this,"offset",new c.Vector3),z(this,"rotationAxis",new c.Vector3),z(this,"startNorm",new c.Vector3),z(this,"endNorm",new c.Vector3),z(this,"rotationAngle",0),z(this,"cameraPosition",new c.Vector3),z(this,"cameraQuaternion",new c.Quaternion),z(this,"cameraScale",new c.Vector3),z(this,"parentPosition",new c.Vector3),z(this,"parentQuaternion",new c.Quaternion),z(this,"parentQuaternionInv",new c.Quaternion),z(this,"parentScale",new c.Vector3),z(this,"worldPositionStart",new c.Vector3),z(this,"worldQuaternionStart",new c.Quaternion),z(this,"worldScaleStart",new c.Vector3),z(this,"worldPosition",new c.Vector3),z(this,"worldQuaternion",new c.Quaternion),z(this,"worldQuaternionInv",new c.Quaternion),z(this,"worldScale",new c.Vector3),z(this,"eye",new c.Vector3),z(this,"positionStart",new c.Vector3),z(this,"quaternionStart",new c.Quaternion),z(this,"scaleStart",new c.Vector3),z(this,"camera"),z(this,"object"),z(this,"enabled",!0),z(this,"axis",null),z(this,"mode","translate"),z(this,"translationSnap",null),z(this,"rotationSnap",null),z(this,"scaleSnap",null),z(this,"space","world"),z(this,"size",1),z(this,"dragging",!1),z(this,"showX",!0),z(this,"showY",!0),z(this,"showZ",!0),z(this,"changeEvent",{type:"change"}),z(this,"mouseDownEvent",{type:"mouseDown",mode:this.mode}),z(this,"mouseUpEvent",{type:"mouseUp",mode:this.mode}),z(this,"objectChangeEvent",{type:"objectChange"}),z(this,"intersectObjectWithRay",(s,i,o)=>{const r=i.intersectObject(s,!0);for(let l=0;l<r.length;l++)if(r[l].object.visible||o)return r[l];return!1}),z(this,"attach",s=>(this.object=s,this.visible=!0,this)),z(this,"detach",()=>(this.object=void 0,this.visible=!1,this.axis=null,this)),z(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),z(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()}),z(this,"pointerHover",s=>{if(this.object===void 0||this.dragging===!0)return;this.raycaster.setFromCamera(s,this.camera);const i=this.intersectObjectWithRay(this.gizmo.picker[this.mode],this.raycaster);i?this.axis=i.object.name:this.axis=null}),z(this,"pointerDown",s=>{if(!(this.object===void 0||this.dragging===!0||s.button!==0)&&this.axis!==null){this.raycaster.setFromCamera(s,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)}}),z(this,"pointerMove",s=>{const i=this.axis,o=this.mode,r=this.object;let l=this.space;if(o==="scale"?l="local":(i==="E"||i==="XYZE"||i==="XYZ")&&(l="world"),r===void 0||i===null||this.dragging===!1||s.button!==-1)return;this.raycaster.setFromCamera(s,this.camera);const f=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(f){if(this.pointEnd.copy(f.point).sub(this.worldPositionStart),o==="translate")this.offset.copy(this.pointEnd).sub(this.pointStart),l==="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),l==="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&&(l==="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)),l==="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 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),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 d=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))*d):(i==="X"||i==="Y"||i==="Z")&&(this.rotationAxis.copy(this.unit[i]),this.tempVector.copy(this.unit[i]),l==="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),l==="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)}}),z(this,"pointerUp",s=>{s.button===0&&(this.dragging&&this.axis!==null&&(this.mouseUpEvent.mode=this.mode,this.dispatchEvent(this.mouseUpEvent)),this.dragging=!1,this.axis=null)}),z(this,"getPointer",s=>{var i,o;if(this.domElement&&((i=this.domElement.ownerDocument)!=null&&i.pointerLockElement))return{x:0,y:0,button:s.button};{const r=s.changedTouches?s.changedTouches[0]:s,l=(o=this.domElement)==null?void 0:o.getBoundingClientRect();return{x:(r.clientX-l.left)/l.width*2-1,y:-(r.clientY-l.top)/l.height*2+1,button:s.button}}}),z(this,"onPointerHover",s=>{if(this.enabled)switch(s.pointerType){case"mouse":case"pen":this.pointerHover(this.getPointer(s));break}}),z(this,"onPointerDown",s=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="none",this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.pointerHover(this.getPointer(s)),this.pointerDown(this.getPointer(s)))}),z(this,"onPointerMove",s=>{this.enabled&&this.pointerMove(this.getPointer(s))}),z(this,"onPointerUp",s=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="",this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.pointerUp(this.getPointer(s)))}),z(this,"getMode",()=>this.mode),z(this,"setMode",s=>{this.mode=s}),z(this,"setTranslationSnap",s=>{this.translationSnap=s}),z(this,"setRotationSnap",s=>{this.rotationSnap=s}),z(this,"setScaleSnap",s=>{this.scaleSnap=s}),z(this,"setSize",s=>{this.size=s}),z(this,"setSpace",s=>{this.space=s}),z(this,"update",()=>{console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}),z(this,"connect",s=>{s===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.domElement=s,this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointermove",this.onPointerHover),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)}),z(this,"dispose",()=>{var s,i,o,r,l,f;(s=this.domElement)==null||s.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),(f=(l=this.domElement)==null?void 0:l.ownerDocument)==null||f.removeEventListener("pointerup",this.onPointerUp),this.traverse(d=>{const u=d;u.geometry&&u.geometry.dispose(),u.material&&u.material.dispose()})}),this.domElement=t,this.camera=e,this.gizmo=new Zi,this.add(this.gizmo),this.plane=new Qi,this.add(this.plane);const n=(s,i)=>{let o=i;Object.defineProperty(this,s,{get:function(){return o!==void 0?o:i},set:function(r){o!==r&&(o=r,this.plane[s]=r,this.gizmo[s]=r,this.dispatchEvent({type:s+"-changed",value:r}),this.dispatchEvent(this.changeEvent))}}),this[s]=i,this.plane[s]=i,this.gizmo[s]=i};n("camera",this.camera),n("object",this.object),n("enabled",this.enabled),n("axis",this.axis),n("mode",this.mode),n("translationSnap",this.translationSnap),n("rotationSnap",this.rotationSnap),n("scaleSnap",this.scaleSnap),n("space",this.space),n("size",this.size),n("dragging",this.dragging),n("showX",this.showX),n("showY",this.showY),n("showZ",this.showZ),n("worldPosition",this.worldPosition),n("worldPositionStart",this.worldPositionStart),n("worldQuaternion",this.worldQuaternion),n("worldQuaternionStart",this.worldQuaternionStart),n("cameraPosition",this.cameraPosition),n("cameraQuaternion",this.cameraQuaternion),n("pointStart",this.pointStart),n("pointEnd",this.pointEnd),n("rotationAxis",this.rotationAxis),n("rotationAngle",this.rotationAngle),n("eye",this.eye),t!==void 0&&this.connect(t)}}class Zi extends c.Object3D{constructor(){super(),z(this,"isTransformControlsGizmo",!0),z(this,"type","TransformControlsGizmo"),z(this,"tempVector",new c.Vector3(0,0,0)),z(this,"tempEuler",new c.Euler),z(this,"alignVector",new c.Vector3(0,1,0)),z(this,"zeroVector",new c.Vector3(0,0,0)),z(this,"lookAtMatrix",new c.Matrix4),z(this,"tempQuaternion",new c.Quaternion),z(this,"tempQuaternion2",new c.Quaternion),z(this,"identityQuaternion",new c.Quaternion),z(this,"unitX",new c.Vector3(1,0,0)),z(this,"unitY",new c.Vector3(0,1,0)),z(this,"unitZ",new c.Vector3(0,0,1)),z(this,"gizmo"),z(this,"picker"),z(this,"helper"),z(this,"rotationAxis",new c.Vector3),z(this,"cameraPosition",new c.Vector3),z(this,"worldPositionStart",new c.Vector3),z(this,"worldQuaternionStart",new c.Quaternion),z(this,"worldPosition",new c.Vector3),z(this,"worldQuaternion",new c.Quaternion),z(this,"eye",new c.Vector3),z(this,"camera",null),z(this,"enabled",!0),z(this,"axis",null),z(this,"mode","translate"),z(this,"space","world"),z(this,"size",1),z(this,"dragging",!1),z(this,"showX",!0),z(this,"showY",!0),z(this,"showZ",!0),z(this,"updateMatrixWorld",()=>{let se=this.space;this.mode==="scale"&&(se="local");const ce=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 U=[];U=U.concat(this.picker[this.mode].children),U=U.concat(this.gizmo[this.mode].children),U=U.concat(this.helper[this.mode].children);for(let T=0;T<U.length;T++){const m=U[T];m.visible=!0,m.rotation.set(0,0,0),m.position.copy(this.worldPosition);let F;if(this.camera.isOrthographicCamera?F=(this.camera.top-this.camera.bottom)/this.camera.zoom:F=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),m.scale.set(1,1,1).multiplyScalar(F*this.size/7),m.tag==="helper"){m.visible=!1,m.name==="AXIS"?(m.position.copy(this.worldPositionStart),m.visible=!!this.axis,this.axis==="X"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,0)),m.quaternion.copy(ce).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ce).dot(this.eye))>.9&&(m.visible=!1)),this.axis==="Y"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,Math.PI/2)),m.quaternion.copy(ce).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ce).dot(this.eye))>.9&&(m.visible=!1)),this.axis==="Z"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),m.quaternion.copy(ce).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ce).dot(this.eye))>.9&&(m.visible=!1)),this.axis==="XYZE"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),this.alignVector.copy(this.rotationAxis),m.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector,this.alignVector,this.unitY)),m.quaternion.multiply(this.tempQuaternion),m.visible=this.dragging),this.axis==="E"&&(m.visible=!1)):m.name==="START"?(m.position.copy(this.worldPositionStart),m.visible=this.dragging):m.name==="END"?(m.position.copy(this.worldPosition),m.visible=this.dragging):m.name==="DELTA"?(m.position.copy(this.worldPositionStart),m.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()),m.scale.copy(this.tempVector),m.visible=this.dragging):(m.quaternion.copy(ce),this.dragging?m.position.copy(this.worldPositionStart):m.position.copy(this.worldPosition),this.axis&&(m.visible=this.axis.search(m.name)!==-1));continue}m.quaternion.copy(ce),this.mode==="translate"||this.mode==="scale"?((m.name==="X"||m.name==="XYZX")&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ce).dot(this.eye))>.99&&(m.scale.set(1e-10,1e-10,1e-10),m.visible=!1),(m.name==="Y"||m.name==="XYZY")&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ce).dot(this.eye))>.99&&(m.scale.set(1e-10,1e-10,1e-10),m.visible=!1),(m.name==="Z"||m.name==="XYZZ")&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ce).dot(this.eye))>.99&&(m.scale.set(1e-10,1e-10,1e-10),m.visible=!1),m.name==="XY"&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ce).dot(this.eye))<.2&&(m.scale.set(1e-10,1e-10,1e-10),m.visible=!1),m.name==="YZ"&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ce).dot(this.eye))<.2&&(m.scale.set(1e-10,1e-10,1e-10),m.visible=!1),m.name==="XZ"&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ce).dot(this.eye))<.2&&(m.scale.set(1e-10,1e-10,1e-10),m.visible=!1),m.name.search("X")!==-1&&(this.alignVector.copy(this.unitX).applyQuaternion(ce).dot(this.eye)<0?m.tag==="fwd"?m.visible=!1:m.scale.x*=-1:m.tag==="bwd"&&(m.visible=!1)),m.name.search("Y")!==-1&&(this.alignVector.copy(this.unitY).applyQuaternion(ce).dot(this.eye)<0?m.tag==="fwd"?m.visible=!1:m.scale.y*=-1:m.tag==="bwd"&&(m.visible=!1)),m.name.search("Z")!==-1&&(this.alignVector.copy(this.unitZ).applyQuaternion(ce).dot(this.eye)<0?m.tag==="fwd"?m.visible=!1:m.scale.z*=-1:m.tag==="bwd"&&(m.visible=!1))):this.mode==="rotate"&&(this.tempQuaternion2.copy(ce),this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(ce).invert()),m.name.search("E")!==-1&&m.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye,this.zeroVector,this.unitY)),m.name==="X"&&(this.tempQuaternion.setFromAxisAngle(this.unitX,Math.atan2(-this.alignVector.y,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),m.quaternion.copy(this.tempQuaternion)),m.name==="Y"&&(this.tempQuaternion.setFromAxisAngle(this.unitY,Math.atan2(this.alignVector.x,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),m.quaternion.copy(this.tempQuaternion)),m.name==="Z"&&(this.tempQuaternion.setFromAxisAngle(this.unitZ,Math.atan2(this.alignVector.y,this.alignVector.x)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),m.quaternion.copy(this.tempQuaternion))),m.visible=m.visible&&(m.name.indexOf("X")===-1||this.showX),m.visible=m.visible&&(m.name.indexOf("Y")===-1||this.showY),m.visible=m.visible&&(m.name.indexOf("Z")===-1||this.showZ),m.visible=m.visible&&(m.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),m.material.tempOpacity=m.material.tempOpacity||m.material.opacity,m.material.tempColor=m.material.tempColor||m.material.color.clone(),m.material.color.copy(m.material.tempColor),m.material.opacity=m.material.tempOpacity,this.enabled?this.axis&&(m.name===this.axis?(m.material.opacity=1,m.material.color.lerp(new c.Color(1,1,1),.5)):this.axis.split("").some(function(j){return m.name===j})?(m.material.opacity=1,m.material.color.lerp(new c.Color(1,1,1),.5)):(m.material.opacity*=.25,m.material.color.lerp(new c.Color(1,1,1),.5))):(m.material.opacity*=.5,m.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}),n=e.clone();n.opacity=.15;const s=e.clone();s.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 l=e.clone();l.opacity=.25;const f=l.clone();f.color.set(16776960);const d=l.clone();d.color.set(65535);const u=l.clone();u.color.set(16711935),e.clone().color.set(16776960);const g=t.clone();g.color.set(16711680);const x=t.clone();x.color.set(65280);const w=t.clone();w.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 v=t.clone();v.color.set(7895160);const y=L.clone();y.opacity=.25;const A=new c.CylinderGeometry(0,.05,.2,12,1,!1),S=new c.BoxGeometry(.125,.125,.125),b=new c.BufferGeometry;b.setAttribute("position",new c.Float32BufferAttribute([0,0,0,1,0,0],3));const P=(se,ce)=>{const U=new c.BufferGeometry,T=[];for(let m=0;m<=64*ce;++m)T.push(0,Math.cos(m/32*Math.PI)*se,Math.sin(m/32*Math.PI)*se);return U.setAttribute("position",new c.Float32BufferAttribute(T,3)),U},O=()=>{const se=new c.BufferGeometry;return se.setAttribute("position",new c.Float32BufferAttribute([0,0,0,1,1,1],3)),se},k={X:[[new c.Mesh(A,i),[1,0,0],[0,0,-Math.PI/2],null,"fwd"],[new c.Mesh(A,i),[1,0,0],[0,0,Math.PI/2],null,"bwd"],[new c.Line(b,g)]],Y:[[new c.Mesh(A,o),[0,1,0],null,null,"fwd"],[new c.Mesh(A,o),[0,1,0],[Math.PI,0,0],null,"bwd"],[new c.Line(b,x),null,[0,0,Math.PI/2]]],Z:[[new c.Mesh(A,r),[0,0,1],[Math.PI/2,0,0],null,"fwd"],[new c.Mesh(A,r),[0,0,1],[-Math.PI/2,0,0],null,"bwd"],[new c.Line(b,w),null,[0,-Math.PI/2,0]]],XYZ:[[new c.Mesh(new c.OctahedronGeometry(.1,0),l.clone()),[0,0,0],[0,0,0]]],XY:[[new c.Mesh(new c.PlaneGeometry(.295,.295),f.clone()),[.15,.15,0]],[new c.Line(b,L),[.18,.3,0],null,[.125,1,1]],[new c.Line(b,L),[.3,.18,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new c.Mesh(new c.PlaneGeometry(.295,.295),d.clone()),[0,.15,.15],[0,Math.PI/2,0]],[new c.Line(b,_),[0,.18,.3],[0,0,Math.PI/2],[.125,1,1]],[new c.Line(b,_),[0,.3,.18],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new c.Mesh(new c.PlaneGeometry(.295,.295),u.clone()),[.15,0,.15],[-Math.PI/2,0,0]],[new c.Line(b,M),[.18,0,.3],null,[.125,1,1]],[new c.Line(b,M),[.3,0,.18],[0,-Math.PI/2,0],[.125,1,1]]]},V={X:[[new c.Mesh(new c.CylinderGeometry(.2,0,1,4,1,!1),n),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new c.Mesh(new c.CylinderGeometry(.2,0,1,4,1,!1),n),[0,.6,0]]],Z:[[new c.Mesh(new c.CylinderGeometry(.2,0,1,4,1,!1),n),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new c.Mesh(new c.OctahedronGeometry(.2,0),n)]],XY:[[new c.Mesh(new c.PlaneGeometry(.4,.4),n),[.2,.2,0]]],YZ:[[new c.Mesh(new c.PlaneGeometry(.4,.4),n),[0,.2,.2],[0,Math.PI/2,0]]],XZ:[[new c.Mesh(new c.PlaneGeometry(.4,.4),n),[.2,0,.2],[-Math.PI/2,0,0]]]},R={START:[[new c.Mesh(new c.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],END:[[new c.Mesh(new c.OctahedronGeometry(.01,2),s),null,null,null,"helper"]],DELTA:[[new c.Line(O(),s),null,null,null,"helper"]],X:[[new c.Line(b,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new c.Line(b,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new c.Line(b,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},X={X:[[new c.Line(P(1,.5),g)],[new c.Mesh(new c.OctahedronGeometry(.04,0),i),[0,0,.99],null,[1,3,1]]],Y:[[new c.Line(P(1,.5),x),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(P(1,.5),w),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(P(1.25,1),y),null,[0,Math.PI/2,0]],[new c.Mesh(new c.CylinderGeometry(.03,0,.15,4,1,!1),y),[1.17,0,0],[0,0,-Math.PI/2],[1,1,.001]],[new c.Mesh(new c.CylinderGeometry(.03,0,.15,4,1,!1),y),[-1.17,0,0],[0,0,Math.PI/2],[1,1,.001]],[new c.Mesh(new c.CylinderGeometry(.03,0,.15,4,1,!1),y),[0,-1.17,0],[Math.PI,0,0],[1,1,.001]],[new c.Mesh(new c.CylinderGeometry(.03,0,.15,4,1,!1),y),[0,1.17,0],[0,0,0],[1,1,.001]]],XYZE:[[new c.Line(P(1,1),v),null,[0,Math.PI/2,0]]]},K={AXIS:[[new c.Line(b,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},H={X:[[new c.Mesh(new c.TorusGeometry(1,.1,4,24),n),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new c.Mesh(new c.TorusGeometry(1,.1,4,24),n),[0,0,0],[Math.PI/2,0,0]]],Z:[[new c.Mesh(new c.TorusGeometry(1,.1,4,24),n),[0,0,0],[0,0,-Math.PI/2]]],E:[[new c.Mesh(new c.TorusGeometry(1.25,.1,2,24),n)]],XYZE:[[new c.Mesh(new c.SphereGeometry(.7,10,8),n)]]},he={X:[[new c.Mesh(S,i),[.8,0,0],[0,0,-Math.PI/2]],[new c.Line(b,g),null,null,[.8,1,1]]],Y:[[new c.Mesh(S,o),[0,.8,0]],[new c.Line(b,x),null,[0,0,Math.PI/2],[.8,1,1]]],Z:[[new c.Mesh(S,r),[0,0,.8],[Math.PI/2,0,0]],[new c.Line(b,w),null,[0,-Math.PI/2,0],[.8,1,1]]],XY:[[new c.Mesh(S,f),[.85,.85,0],null,[2,2,.2]],[new c.Line(b,L),[.855,.98,0],null,[.125,1,1]],[new c.Line(b,L),[.98,.855,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new c.Mesh(S,d),[0,.85,.85],null,[.2,2,2]],[new c.Line(b,_),[0,.855,.98],[0,0,Math.PI/2],[.125,1,1]],[new c.Line(b,_),[0,.98,.855],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new c.Mesh(S,u),[.85,0,.85],null,[2,.2,2]],[new c.Line(b,M),[.855,0,.98],null,[.125,1,1]],[new c.Line(b,M),[.98,0,.855],[0,-Math.PI/2,0],[.125,1,1]]],XYZX:[[new c.Mesh(new c.BoxGeometry(.125,.125,.125),l.clone()),[1.1,0,0]]],XYZY:[[new c.Mesh(new c.BoxGeometry(.125,.125,.125),l.clone()),[0,1.1,0]]],XYZZ:[[new c.Mesh(new c.BoxGeometry(.125,.125,.125),l.clone()),[0,0,1.1]]]},J={X:[[new c.Mesh(new c.CylinderGeometry(.2,0,.8,4,1,!1),n),[.5,0,0],[0,0,-Math.PI/2]]],Y:[[new c.Mesh(new c.CylinderGeometry(.2,0,.8,4,1,!1),n),[0,.5,0]]],Z:[[new c.Mesh(new c.CylinderGeometry(.2,0,.8,4,1,!1),n),[0,0,.5],[Math.PI/2,0,0]]],XY:[[new c.Mesh(S,n),[.85,.85,0],null,[3,3,.2]]],YZ:[[new c.Mesh(S,n),[0,.85,.85],null,[.2,3,3]]],XZ:[[new c.Mesh(S,n),[.85,0,.85],null,[3,.2,3]]],XYZX:[[new c.Mesh(new c.BoxGeometry(.2,.2,.2),n),[1.1,0,0]]],XYZY:[[new c.Mesh(new c.BoxGeometry(.2,.2,.2),n),[0,1.1,0]]],XYZZ:[[new c.Mesh(new c.BoxGeometry(.2,.2,.2),n),[0,0,1.1]]]},G={X:[[new c.Line(b,s.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new c.Line(b,s.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new c.Line(b,s.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},oe=se=>{const ce=new c.Object3D;for(let U in se)for(let T=se[U].length;T--;){const m=se[U][T][0].clone(),F=se[U][T][1],j=se[U][T][2],D=se[U][T][3],E=se[U][T][4];m.name=U,m.tag=E,F&&m.position.set(F[0],F[1],F[2]),j&&m.rotation.set(j[0],j[1],j[2]),D&&m.scale.set(D[0],D[1],D[2]),m.updateMatrix();const ie=m.geometry.clone();ie.applyMatrix4(m.matrix),m.geometry=ie,m.renderOrder=1/0,m.position.set(0,0,0),m.rotation.set(0,0,0),m.scale.set(1,1,1),ce.add(m)}return ce};this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=oe(k)),this.add(this.gizmo.rotate=oe(X)),this.add(this.gizmo.scale=oe(he)),this.add(this.picker.translate=oe(V)),this.add(this.picker.rotate=oe(H)),this.add(this.picker.scale=oe(J)),this.add(this.helper.translate=oe(R)),this.add(this.helper.rotate=oe(K)),this.add(this.helper.scale=oe(G)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}}class Qi 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})),z(this,"isTransformControlsPlane",!0),z(this,"type","TransformControlsPlane"),z(this,"unitX",new c.Vector3(1,0,0)),z(this,"unitY",new c.Vector3(0,1,0)),z(this,"unitZ",new c.Vector3(0,0,1)),z(this,"tempVector",new c.Vector3),z(this,"dirVector",new c.Vector3),z(this,"alignVector",new c.Vector3),z(this,"tempMatrix",new c.Matrix4),z(this,"identityQuaternion",new c.Quaternion),z(this,"cameraQuaternion",new c.Quaternion),z(this,"worldPosition",new c.Vector3),z(this,"worldQuaternion",new c.Quaternion),z(this,"eye",new c.Vector3),z(this,"axis",null),z(this,"mode","translate"),z(this,"space","world"),z(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 Ki=Object.defineProperty,qi=(a,e,t)=>e in a?Ki(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Ce=(a,e,t)=>(qi(a,typeof e!="symbol"?e+"":e,t),t);const _t=new c.Euler(0,0,0,"YXZ"),vt=new c.Vector3,Ji={type:"change"},Hi={type:"lock"},$i={type:"unlock"},ls=Math.PI/2;class vn 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",n=>{if(!this.domElement||this.isLocked===!1)return;const s=n.movementX||n.mozMovementX||n.webkitMovementX||0,i=n.movementY||n.mozMovementY||n.webkitMovementY||0;_t.setFromQuaternion(this.camera.quaternion),_t.y-=s*.002*this.pointerSpeed,_t.x-=i*.002*this.pointerSpeed,_t.x=Math.max(ls-this.maxPolarAngle,Math.min(ls-this.minPolarAngle,_t.x)),this.camera.quaternion.setFromEuler(_t),this.dispatchEvent(Ji)}),Ce(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(Hi),this.isLocked=!0):(this.dispatchEvent($i),this.isLocked=!1))}),Ce(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),Ce(this,"connect",n=>{this.domElement=n||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",n=>n.copy(this.direction).applyQuaternion(this.camera.quaternion)),Ce(this,"moveForward",n=>{vt.setFromMatrixColumn(this.camera.matrix,0),vt.crossVectors(this.camera.up,vt),this.camera.position.addScaledVector(vt,n)}),Ce(this,"moveRight",n=>{vt.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(vt,n)}),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 eo=Object.defineProperty,to=(a,e,t)=>e in a?eo(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,ae=(a,e,t)=>(to(a,typeof e!="symbol"?e+"":e,t),t);const Yt=new c.Ray,cs=new c.Plane,no=Math.cos(70*(Math.PI/180)),hs=(a,e)=>(a%e+e)%e;class us extends c.EventDispatcher{constructor(e,t){super(),ae(this,"object"),ae(this,"domElement"),ae(this,"enabled",!0),ae(this,"target",new c.Vector3),ae(this,"minDistance",0),ae(this,"maxDistance",1/0),ae(this,"minZoom",0),ae(this,"maxZoom",1/0),ae(this,"minPolarAngle",0),ae(this,"maxPolarAngle",Math.PI),ae(this,"minAzimuthAngle",-1/0),ae(this,"maxAzimuthAngle",1/0),ae(this,"enableDamping",!1),ae(this,"dampingFactor",.05),ae(this,"enableZoom",!0),ae(this,"zoomSpeed",1),ae(this,"enableRotate",!0),ae(this,"rotateSpeed",1),ae(this,"enablePan",!0),ae(this,"panSpeed",1),ae(this,"screenSpacePanning",!0),ae(this,"keyPanSpeed",7),ae(this,"zoomToCursor",!1),ae(this,"autoRotate",!1),ae(this,"autoRotateSpeed",2),ae(this,"reverseOrbit",!1),ae(this,"reverseHorizontalOrbit",!1),ae(this,"reverseVerticalOrbit",!1),ae(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ae(this,"mouseButtons",{LEFT:c.MOUSE.ROTATE,MIDDLE:c.MOUSE.DOLLY,RIGHT:c.MOUSE.PAN}),ae(this,"touches",{ONE:c.TOUCH.ROTATE,TWO:c.TOUCH.DOLLY_PAN}),ae(this,"target0"),ae(this,"position0"),ae(this,"zoom0"),ae(this,"_domElementKeyEvents",null),ae(this,"getPolarAngle"),ae(this,"getAzimuthalAngle"),ae(this,"setPolarAngle"),ae(this,"setAzimuthalAngle"),ae(this,"getDistance"),ae(this,"listenToKeyEvents"),ae(this,"stopListenToKeyEvents"),ae(this,"saveState"),ae(this,"reset"),ae(this,"update"),ae(this,"connect"),ae(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=B=>{let W=hs(B,2*Math.PI),ue=d.phi;ue<0&&(ue+=2*Math.PI),W<0&&(W+=2*Math.PI);let _e=Math.abs(W-ue);2*Math.PI-_e<_e&&(W<ue?W+=2*Math.PI:ue+=2*Math.PI),u.phi=W-ue,n.update()},this.setAzimuthalAngle=B=>{let W=hs(B,2*Math.PI),ue=d.theta;ue<0&&(ue+=2*Math.PI),W<0&&(W+=2*Math.PI);let _e=Math.abs(W-ue);2*Math.PI-_e<_e&&(W<ue?W+=2*Math.PI:ue+=2*Math.PI),u.theta=W-ue,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=B=>{B.addEventListener("keydown",Ct),this._domElementKeyEvents=B},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",Ct),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(s),n.update(),l=r.NONE},this.update=(()=>{const B=new c.Vector3,W=new c.Vector3(0,1,0),ue=new c.Quaternion().setFromUnitVectors(e.up,W),_e=ue.clone().invert(),Le=new c.Vector3,$e=new c.Quaternion,ct=2*Math.PI;return function(){const Ci=n.object.position;ue.setFromUnitVectors(e.up,W),_e.copy(ue).invert(),B.copy(Ci).sub(n.target),B.applyQuaternion(ue),d.setFromVector3(B),n.autoRotate&&l===r.NONE&&K(R()),n.enableDamping?(d.theta+=u.theta*n.dampingFactor,d.phi+=u.phi*n.dampingFactor):(d.theta+=u.theta,d.phi+=u.phi);let et=n.minAzimuthAngle,tt=n.maxAzimuthAngle;isFinite(et)&&isFinite(tt)&&(et<-Math.PI?et+=ct:et>Math.PI&&(et-=ct),tt<-Math.PI?tt+=ct:tt>Math.PI&&(tt-=ct),et<=tt?d.theta=Math.max(et,Math.min(tt,d.theta)):d.theta=d.theta>(et+tt)/2?Math.max(et,d.theta):Math.min(tt,d.theta)),d.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,d.phi)),d.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(g,n.dampingFactor):n.target.add(g),n.zoomToCursor&&O||n.object.isOrthographicCamera?d.radius=U(d.radius):d.radius=U(d.radius*p),B.setFromSpherical(d),B.applyQuaternion(_e),Ci.copy(n.target).add(B),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,g.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),g.set(0,0,0));let dn=!1;if(n.zoomToCursor&&O){let Et=null;if(n.object instanceof c.PerspectiveCamera&&n.object.isPerspectiveCamera){const Xt=B.length();Et=U(Xt*p);const fn=Xt-Et;n.object.position.addScaledVector(b,fn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const Xt=new c.Vector3(P.x,P.y,0);Xt.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/p)),n.object.updateProjectionMatrix(),dn=!0;const fn=new c.Vector3(P.x,P.y,0);fn.unproject(n.object),n.object.position.sub(fn).add(Xt),n.object.updateMatrixWorld(),Et=B.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Et!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Et).add(n.object.position):(Yt.origin.copy(n.object.position),Yt.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(Yt.direction))<no?e.lookAt(n.target):(cs.setFromNormalAndCoplanarPoint(n.object.up,n.target),Yt.intersectPlane(cs,n.target))))}else n.object instanceof c.OrthographicCamera&&n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/p)),n.object.updateProjectionMatrix(),dn=!0);return p=1,O=!1,dn||Le.distanceToSquared(n.object.position)>f||8*(1-$e.dot(n.object.quaternion))>f?(n.dispatchEvent(s),Le.copy(n.object.position),$e.copy(n.object.quaternion),dn=!1,!0):!1}})(),this.connect=B=>{B===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),n.domElement=B,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Mi),n.domElement.addEventListener("pointerdown",Pe),n.domElement.addEventListener("pointercancel",Pt),n.domElement.addEventListener("wheel",un)},this.dispose=()=>{var B,W,ue,_e,Le,$e;(B=n.domElement)==null||B.removeEventListener("contextmenu",Mi),(W=n.domElement)==null||W.removeEventListener("pointerdown",Pe),(ue=n.domElement)==null||ue.removeEventListener("pointercancel",Pt),(_e=n.domElement)==null||_e.removeEventListener("wheel",un),(Le=n.domElement)==null||Le.ownerDocument.removeEventListener("pointermove",ke),($e=n.domElement)==null||$e.ownerDocument.removeEventListener("pointerup",Xe),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",Ct)};const n=this,s={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 l=r.NONE;const f=1e-6,d=new c.Spherical,u=new c.Spherical;let p=1;const g=new c.Vector3,x=new c.Vector2,w=new c.Vector2,_=new c.Vector2,M=new c.Vector2,L=new c.Vector2,v=new c.Vector2,y=new c.Vector2,A=new c.Vector2,S=new c.Vector2,b=new c.Vector3,P=new c.Vector2;let O=!1;const k=[],V={};function R(){return 2*Math.PI/60/60*n.autoRotateSpeed}function X(){return Math.pow(.95,n.zoomSpeed)}function K(B){n.reverseOrbit||n.reverseHorizontalOrbit?u.theta+=B:u.theta-=B}function H(B){n.reverseOrbit||n.reverseVerticalOrbit?u.phi+=B:u.phi-=B}const he=(()=>{const B=new c.Vector3;return function(ue,_e){B.setFromMatrixColumn(_e,0),B.multiplyScalar(-ue),g.add(B)}})(),J=(()=>{const B=new c.Vector3;return function(ue,_e){n.screenSpacePanning===!0?B.setFromMatrixColumn(_e,1):(B.setFromMatrixColumn(_e,0),B.crossVectors(n.object.up,B)),B.multiplyScalar(ue),g.add(B)}})(),G=(()=>{const B=new c.Vector3;return function(ue,_e){const Le=n.domElement;if(Le&&n.object instanceof c.PerspectiveCamera&&n.object.isPerspectiveCamera){const $e=n.object.position;B.copy($e).sub(n.target);let ct=B.length();ct*=Math.tan(n.object.fov/2*Math.PI/180),he(2*ue*ct/Le.clientHeight,n.object.matrix),J(2*_e*ct/Le.clientHeight,n.object.matrix)}else Le&&n.object instanceof c.OrthographicCamera&&n.object.isOrthographicCamera?(he(ue*(n.object.right-n.object.left)/n.object.zoom/Le.clientWidth,n.object.matrix),J(_e*(n.object.top-n.object.bottom)/n.object.zoom/Le.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function oe(B){n.object instanceof c.PerspectiveCamera&&n.object.isPerspectiveCamera||n.object instanceof c.OrthographicCamera&&n.object.isOrthographicCamera?p/=B:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function se(B){n.object instanceof c.PerspectiveCamera&&n.object.isPerspectiveCamera||n.object instanceof c.OrthographicCamera&&n.object.isOrthographicCamera?p*=B:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function ce(B){if(!n.zoomToCursor||!n.domElement)return;O=!0;const W=n.domElement.getBoundingClientRect(),ue=B.clientX-W.left,_e=B.clientY-W.top,Le=W.width,$e=W.height;P.x=ue/Le*2-1,P.y=-(_e/$e)*2+1,b.set(P.x,P.y,1).unproject(n.object).sub(n.object.position).normalize()}function U(B){return Math.max(n.minDistance,Math.min(n.maxDistance,B))}function T(B){x.set(B.clientX,B.clientY)}function m(B){ce(B),y.set(B.clientX,B.clientY)}function F(B){M.set(B.clientX,B.clientY)}function j(B){w.set(B.clientX,B.clientY),_.subVectors(w,x).multiplyScalar(n.rotateSpeed);const W=n.domElement;W&&(K(2*Math.PI*_.x/W.clientHeight),H(2*Math.PI*_.y/W.clientHeight)),x.copy(w),n.update()}function D(B){A.set(B.clientX,B.clientY),S.subVectors(A,y),S.y>0?oe(X()):S.y<0&&se(X()),y.copy(A),n.update()}function E(B){L.set(B.clientX,B.clientY),v.subVectors(L,M).multiplyScalar(n.panSpeed),G(v.x,v.y),M.copy(L),n.update()}function ie(B){ce(B),B.deltaY<0?se(X()):B.deltaY>0&&oe(X()),n.update()}function Y(B){let W=!1;switch(B.code){case n.keys.UP:G(0,n.keyPanSpeed),W=!0;break;case n.keys.BOTTOM:G(0,-n.keyPanSpeed),W=!0;break;case n.keys.LEFT:G(n.keyPanSpeed,0),W=!0;break;case n.keys.RIGHT:G(-n.keyPanSpeed,0),W=!0;break}W&&(B.preventDefault(),n.update())}function $(){if(k.length==1)x.set(k[0].pageX,k[0].pageY);else{const B=.5*(k[0].pageX+k[1].pageX),W=.5*(k[0].pageY+k[1].pageY);x.set(B,W)}}function Z(){if(k.length==1)M.set(k[0].pageX,k[0].pageY);else{const B=.5*(k[0].pageX+k[1].pageX),W=.5*(k[0].pageY+k[1].pageY);M.set(B,W)}}function fe(){const B=k[0].pageX-k[1].pageX,W=k[0].pageY-k[1].pageY,ue=Math.sqrt(B*B+W*W);y.set(0,ue)}function Q(){n.enableZoom&&fe(),n.enablePan&&Z()}function ee(){n.enableZoom&&fe(),n.enableRotate&&$()}function I(B){if(k.length==1)w.set(B.pageX,B.pageY);else{const ue=es(B),_e=.5*(B.pageX+ue.x),Le=.5*(B.pageY+ue.y);w.set(_e,Le)}_.subVectors(w,x).multiplyScalar(n.rotateSpeed);const W=n.domElement;W&&(K(2*Math.PI*_.x/W.clientHeight),H(2*Math.PI*_.y/W.clientHeight)),x.copy(w)}function C(B){if(k.length==1)L.set(B.pageX,B.pageY);else{const W=es(B),ue=.5*(B.pageX+W.x),_e=.5*(B.pageY+W.y);L.set(ue,_e)}v.subVectors(L,M).multiplyScalar(n.panSpeed),G(v.x,v.y),M.copy(L)}function te(B){const W=es(B),ue=B.pageX-W.x,_e=B.pageY-W.y,Le=Math.sqrt(ue*ue+_e*_e);A.set(0,Le),S.set(0,Math.pow(A.y/y.y,n.zoomSpeed)),oe(S.y),y.copy(A)}function pe(B){n.enableZoom&&te(B),n.enablePan&&C(B)}function we(B){n.enableZoom&&te(B),n.enableRotate&&I(B)}function Pe(B){var W,ue;n.enabled!==!1&&(k.length===0&&((W=n.domElement)==null||W.ownerDocument.addEventListener("pointermove",ke),(ue=n.domElement)==null||ue.ownerDocument.addEventListener("pointerup",Xe)),Ic(B),B.pointerType==="touch"?Oc(B):jt(B))}function ke(B){n.enabled!==!1&&(B.pointerType==="touch"?Dc(B):Ge(B))}function Xe(B){var W,ue,_e;Si(B),k.length===0&&((W=n.domElement)==null||W.releasePointerCapture(B.pointerId),(ue=n.domElement)==null||ue.ownerDocument.removeEventListener("pointermove",ke),(_e=n.domElement)==null||_e.ownerDocument.removeEventListener("pointerup",Xe)),n.dispatchEvent(o),l=r.NONE}function Pt(B){Si(B)}function jt(B){let W;switch(B.button){case 0:W=n.mouseButtons.LEFT;break;case 1:W=n.mouseButtons.MIDDLE;break;case 2:W=n.mouseButtons.RIGHT;break;default:W=-1}switch(W){case c.MOUSE.DOLLY:if(n.enableZoom===!1)return;m(B),l=r.DOLLY;break;case c.MOUSE.ROTATE:if(B.ctrlKey||B.metaKey||B.shiftKey){if(n.enablePan===!1)return;F(B),l=r.PAN}else{if(n.enableRotate===!1)return;T(B),l=r.ROTATE}break;case c.MOUSE.PAN:if(B.ctrlKey||B.metaKey||B.shiftKey){if(n.enableRotate===!1)return;T(B),l=r.ROTATE}else{if(n.enablePan===!1)return;F(B),l=r.PAN}break;default:l=r.NONE}l!==r.NONE&&n.dispatchEvent(i)}function Ge(B){if(n.enabled!==!1)switch(l){case r.ROTATE:if(n.enableRotate===!1)return;j(B);break;case r.DOLLY:if(n.enableZoom===!1)return;D(B);break;case r.PAN:if(n.enablePan===!1)return;E(B);break}}function un(B){n.enabled===!1||n.enableZoom===!1||l!==r.NONE&&l!==r.ROTATE||(B.preventDefault(),n.dispatchEvent(i),ie(B),n.dispatchEvent(o))}function Ct(B){n.enabled===!1||n.enablePan===!1||Y(B)}function Oc(B){switch(Pi(B),k.length){case 1:switch(n.touches.ONE){case c.TOUCH.ROTATE:if(n.enableRotate===!1)return;$(),l=r.TOUCH_ROTATE;break;case c.TOUCH.PAN:if(n.enablePan===!1)return;Z(),l=r.TOUCH_PAN;break;default:l=r.NONE}break;case 2:switch(n.touches.TWO){case c.TOUCH.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Q(),l=r.TOUCH_DOLLY_PAN;break;case c.TOUCH.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ee(),l=r.TOUCH_DOLLY_ROTATE;break;default:l=r.NONE}break;default:l=r.NONE}l!==r.NONE&&n.dispatchEvent(i)}function Dc(B){switch(Pi(B),l){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;I(B),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;C(B),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;pe(B),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;we(B),n.update();break;default:l=r.NONE}}function Mi(B){n.enabled!==!1&&B.preventDefault()}function Ic(B){k.push(B)}function Si(B){delete V[B.pointerId];for(let W=0;W<k.length;W++)if(k[W].pointerId==B.pointerId){k.splice(W,1);return}}function Pi(B){let W=V[B.pointerId];W===void 0&&(W=new c.Vector2,V[B.pointerId]=W),W.set(B.pageX,B.pageY)}function es(B){const W=B.pointerId===k[0].pointerId?k[1]:k[0];return V[W.pointerId]}t!==void 0&&this.connect(t),this.update()}}class so extends us{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 io extends c.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new co(t)}),this.register(function(t){return new _o(t)}),this.register(function(t){return new vo(t)}),this.register(function(t){return new xo(t)}),this.register(function(t){return new uo(t)}),this.register(function(t){return new fo(t)}),this.register(function(t){return new po(t)}),this.register(function(t){return new mo(t)}),this.register(function(t){return new lo(t)}),this.register(function(t){return new go(t)}),this.register(function(t){return new ho(t)}),this.register(function(t){return new yo(t)}),this.register(function(t){return new ro(t)}),this.register(function(t){return new wo(t)}),this.register(function(t){return new bo(t)})}load(e,t,n,s){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(f){s?s(f):console.error(f),i.manager.itemError(e),i.manager.itemEnd(e)},l=new c.FileLoader(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(f){try{i.parse(f,o,function(d){t(d),i.manager.itemEnd(e)},r)}catch(d){r(d)}},n,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,n,s){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)))===ds){try{o[ge.KHR_BINARY_GLTF]=new Ao(e)}catch(d){s&&s(d);return}i=JSON.parse(o[ge.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){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new Uo(i,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let f=0;f<this.pluginCallbacks.length;f++){const d=this.pluginCallbacks[f](l);r[d.name]=d,o[d.name]=!0}if(i.extensionsUsed)for(let f=0;f<i.extensionsUsed.length;++f){const d=i.extensionsUsed[f],u=i.extensionsRequired||[];switch(d){case ge.KHR_MATERIALS_UNLIT:o[d]=new ao;break;case ge.KHR_DRACO_MESH_COMPRESSION:o[d]=new Mo(i,this.dracoLoader);break;case ge.KHR_TEXTURE_TRANSFORM:o[d]=new So;break;case ge.KHR_MESH_QUANTIZATION:o[d]=new Po;break;default:u.indexOf(d)>=0&&r[d]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}l.setExtensions(o),l.setPlugins(r),l.parse(n,s)}parseAsync(e,t){const n=this;return new Promise(function(s,i){n.parse(e,t,s,i)})}}function oo(){let a={};return{get:function(e){return a[e]},add:function(e,t){a[e]=t},remove:function(e){delete a[e]},removeAll:function(){a={}}}}const ge={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 ro{constructor(e){this.parser=e,this.name=ge.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,s=t.length;n<s;n++){const i=t[n];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,n="light:"+e;let s=t.cache.get(n);if(s)return s;const i=t.json,l=((i.extensions&&i.extensions[this.name]||{}).lights||[])[e];let f;const d=new c.Color(16777215);l.color!==void 0&&d.fromArray(l.color);const u=l.range!==void 0?l.range:0;switch(l.type){case"directional":f=new c.DirectionalLight(d),f.target.position.set(0,0,-1),f.add(f.target);break;case"point":f=new c.PointLight(d),f.distance=u;break;case"spot":f=new c.SpotLight(d),f.distance=u,l.spot=l.spot||{},l.spot.innerConeAngle=l.spot.innerConeAngle!==void 0?l.spot.innerConeAngle:0,l.spot.outerConeAngle=l.spot.outerConeAngle!==void 0?l.spot.outerConeAngle:Math.PI/4,f.angle=l.spot.outerConeAngle,f.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,f.target.position.set(0,0,-1),f.add(f.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return f.position.set(0,0,0),f.decay=2,ot(f,l),l.intensity!==void 0&&(f.intensity=l.intensity),f.name=t.createUniqueName(l.name||"light_"+e),s=Promise.resolve(f),t.cache.add(n,s),s}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,i=n.json.nodes[e],r=(i.extensions&&i.extensions[this.name]||{}).light;return r===void 0?null:this._loadLight(r).then(function(l){return n._getNodeRef(t.cache,r,l)})}}class ao{constructor(){this.name=ge.KHR_MATERIALS_UNLIT}getMaterialType(){return c.MeshBasicMaterial}extendParams(e,t,n){const s=[];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&&s.push(n.assignTexture(e,"map",i.baseColorTexture,3001))}return Promise.all(s)}}class lo{constructor(e){this.parser=e,this.name=ge.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=s.extensions[this.name].emissiveStrength;return i!==void 0&&(t.emissiveIntensity=i),Promise.resolve()}}class co{constructor(e){this.parser=e,this.name=ge.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],o=s.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&i.push(n.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&i.push(n.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(i.push(n.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 ho{constructor(e){this.parser=e,this.name=ge.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],o=s.extensions[this.name];return o.iridescenceFactor!==void 0&&(t.iridescence=o.iridescenceFactor),o.iridescenceTexture!==void 0&&i.push(n.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(n.assignTexture(t,"iridescenceThicknessMap",o.iridescenceThicknessTexture)),Promise.all(i)}}class uo{constructor(e){this.parser=e,this.name=ge.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[];t.sheenColor=new c.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const o=s.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(n.assignTexture(t,"sheenColorMap",o.sheenColorTexture,3001)),o.sheenRoughnessTexture!==void 0&&i.push(n.assignTexture(t,"sheenRoughnessMap",o.sheenRoughnessTexture)),Promise.all(i)}}class fo{constructor(e){this.parser=e,this.name=ge.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],o=s.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&i.push(n.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(i)}}class po{constructor(e){this.parser=e,this.name=ge.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],o=s.extensions[this.name];t.thickness=o.thicknessFactor!==void 0?o.thicknessFactor:0,o.thicknessTexture!==void 0&&i.push(n.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 mo{constructor(e){this.parser=e,this.name=ge.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=s.extensions[this.name];return t.ior=i.ior!==void 0?i.ior:1.5,Promise.resolve()}}class go{constructor(e){this.parser=e,this.name=ge.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],o=s.extensions[this.name];t.specularIntensity=o.specularFactor!==void 0?o.specularFactor:1,o.specularTexture!==void 0&&i.push(n.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(n.assignTexture(t,"specularColorMap",o.specularColorTexture,3001)),Promise.all(i)}}class yo{constructor(e){this.parser=e,this.name=ge.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,s=n.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const i=[],o=s.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(n.assignTexture(t,"anisotropyMap",o.anisotropyTexture)),Promise.all(i)}}class _o{constructor(e){this.parser=e,this.name=ge.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,s=n.textures[e];if(!s.extensions||!s.extensions[this.name])return null;const i=s.extensions[this.name],o=t.options.ktx2Loader;if(!o){if(n.extensionsRequired&&n.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 vo{constructor(e){this.parser=e,this.name=ge.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,s=n.json,i=s.textures[e];if(!i.extensions||!i.extensions[t])return null;const o=i.extensions[t],r=s.images[o.source];let l=n.textureLoader;if(r.uri){const f=n.options.manager.getHandler(r.uri);f!==null&&(l=f)}return this.detectSupport().then(function(f){if(f)return n.loadTextureImage(e,o.source,l);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.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 xo{constructor(e){this.parser=e,this.name=ge.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,s=n.json,i=s.textures[e];if(!i.extensions||!i.extensions[t])return null;const o=i.extensions[t],r=s.images[o.source];let l=n.textureLoader;if(r.uri){const f=n.options.manager.getHandler(r.uri);f!==null&&(l=f)}return this.detectSupport().then(function(f){if(f)return n.loadTextureImage(e,o.source,l);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.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 wo{constructor(e){this.name=ge.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const s=n.extensions[this.name],i=this.parser.getDependency("buffer",s.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 l=s.byteOffset||0,f=s.byteLength||0,d=s.count,u=s.byteStride,p=new Uint8Array(r,l,f);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(d,u,p,s.mode,s.filter).then(function(g){return g.buffer}):o.ready.then(function(){const g=new ArrayBuffer(d*u);return o.decodeGltfBuffer(new Uint8Array(g),d,u,p,s.mode,s.filter),g})})}else return null}}class bo{constructor(e){this.name=ge.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const s=t.meshes[n.mesh];for(const f of s.primitives)if(f.mode!==Ve.TRIANGLES&&f.mode!==Ve.TRIANGLE_STRIP&&f.mode!==Ve.TRIANGLE_FAN&&f.mode!==void 0)return null;const o=n.extensions[this.name].attributes,r=[],l={};for(const f in o)r.push(this.parser.getDependency("accessor",o[f]).then(d=>(l[f]=d,l[f])));return r.length<1?null:(r.push(this.parser.createNodeMesh(e)),Promise.all(r).then(f=>{const d=f.pop(),u=d.isGroup?d.children:[d],p=f[0].count,g=[];for(const x of u){const w=new c.Matrix4,_=new c.Vector3,M=new c.Quaternion,L=new c.Vector3(1,1,1),v=new c.InstancedMesh(x.geometry,x.material,p);for(let y=0;y<p;y++)l.TRANSLATION&&_.fromBufferAttribute(l.TRANSLATION,y),l.ROTATION&&M.fromBufferAttribute(l.ROTATION,y),l.SCALE&&L.fromBufferAttribute(l.SCALE,y),v.setMatrixAt(y,w.compose(_,M,L));for(const y in l)y!=="TRANSLATION"&&y!=="ROTATION"&&y!=="SCALE"&&x.geometry.setAttribute(y,l[y]);c.Object3D.prototype.copy.call(v,x),this.parser.assignFinalMaterial(v),g.push(v)}return d.isGroup?(d.clear(),d.add(...g),d):g[0]}))}}const ds="glTF",Ot=12,fs={JSON:1313821514,BIN:5130562};class Ao{constructor(e){this.name=ge.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Ot);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!==ds)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-Ot,s=new DataView(e,Ot);let i=0;for(;i<n;){const o=s.getUint32(i,!0);i+=4;const r=s.getUint32(i,!0);if(i+=4,r===fs.JSON){const l=new Uint8Array(e,Ot+i,o);this.content=c.LoaderUtils.decodeText(l)}else if(r===fs.BIN){const l=Ot+i;this.body=e.slice(l,l+o)}i+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Mo{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=ge.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,s=this.dracoLoader,i=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,r={},l={},f={};for(const d in o){const u=wn[d]||d.toLowerCase();r[u]=o[d]}for(const d in e.attributes){const u=wn[d]||d.toLowerCase();if(o[d]!==void 0){const p=n.accessors[e.attributes[d]],g=xt[p.componentType];f[u]=g.name,l[u]=p.normalized===!0}}return t.getDependency("bufferView",i).then(function(d){return new Promise(function(u){s.decodeDracoFile(d,function(p){for(const g in p.attributes){const x=p.attributes[g],w=l[g];w!==void 0&&(x.normalized=w)}u(p)},r,f)})})}}class So{constructor(){this.name=ge.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 Po{constructor(){this.name=ge.KHR_MESH_QUANTIZATION}}class ps extends c.Interpolant{constructor(e,t,n,s){super(e,t,n,s)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,s=this.valueSize,i=e*s*3+s;for(let o=0;o!==s;o++)t[o]=n[i+o];return t}interpolate_(e,t,n,s){const i=this.resultBuffer,o=this.sampleValues,r=this.valueSize,l=r*2,f=r*3,d=s-t,u=(n-t)/d,p=u*u,g=p*u,x=e*f,w=x-f,_=-2*g+3*p,M=g-p,L=1-_,v=M-p+u;for(let y=0;y!==r;y++){const A=o[w+y+r],S=o[w+y+l]*d,b=o[x+y+r],P=o[x+y]*d;i[y]=L*A+v*S+_*b+M*P}return i}}const Co=new c.Quaternion;class Lo extends ps{interpolate_(e,t,n,s){const i=super.interpolate_(e,t,n,s);return Co.fromArray(i).normalize().toArray(i),i}}const Ve={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},xt={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},gs={33071:c.ClampToEdgeWrapping,33648:c.MirroredRepeatWrapping,10497:c.RepeatWrapping},xn={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},wn={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...Ti>=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"},it={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},To={CUBICSPLINE:void 0,LINEAR:c.InterpolateLinear,STEP:c.InterpolateDiscrete},bn={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Oo(a){return a.DefaultMaterial===void 0&&(a.DefaultMaterial=new c.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:c.FrontSide})),a.DefaultMaterial}function ht(a,e,t){for(const n in t.extensions)a[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function ot(a,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(a.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Do(a,e,t){let n=!1,s=!1,i=!1;for(let f=0,d=e.length;f<d;f++){const u=e[f];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(s=!0),u.COLOR_0!==void 0&&(i=!0),n&&s&&i)break}if(!n&&!s&&!i)return Promise.resolve(a);const o=[],r=[],l=[];for(let f=0,d=e.length;f<d;f++){const u=e[f];if(n){const p=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):a.attributes.position;o.push(p)}if(s){const p=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):a.attributes.normal;r.push(p)}if(i){const p=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):a.attributes.color;l.push(p)}}return Promise.all([Promise.all(o),Promise.all(r),Promise.all(l)]).then(function(f){const d=f[0],u=f[1],p=f[2];return n&&(a.morphAttributes.position=d),s&&(a.morphAttributes.normal=u),i&&(a.morphAttributes.color=p),a.morphTargetsRelative=!0,a})}function Io(a,e){if(a.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)a.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(a.morphTargetInfluences.length===t.length){a.morphTargetDictionary={};for(let n=0,s=t.length;n<s;n++)a.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function ko(a){let e;const t=a.extensions&&a.extensions[ge.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+An(t.attributes):e=a.indices+":"+An(a.attributes)+":"+a.mode,a.targets!==void 0)for(let n=0,s=a.targets.length;n<s;n++)e+=":"+An(a.targets[n]);return e}function An(a){let e="";const t=Object.keys(a).sort();for(let n=0,s=t.length;n<s;n++)e+=t[n]+":"+a[t[n]]+";";return e}function Mn(a){switch(a){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 Fo(a){return a.search(/\.jpe?g($|\?)/i)>0||a.search(/^data\:image\/jpeg/)===0?"image/jpeg":a.search(/\.webp($|\?)/i)>0||a.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Bo=new c.Matrix4;class Uo{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new oo,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 n=!1,s=!1,i=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,s=navigator.userAgent.indexOf("Firefox")>-1,i=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||s&&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 n=this,s=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([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(o){const r={scene:o[0][s.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:s.asset,parser:n,userData:{}};ht(i,r,s),ot(r,s),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(r)})).then(function(){e(r)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let s=0,i=t.length;s<i;s++){const o=t[s].joints;for(let r=0,l=o.length;r<l;r++)e[o[r]].isBone=!0}for(let s=0,i=e.length;s<i;s++){const o=e[s];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(n[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,n){if(e.refs[t]<=1)return n;const s=n.clone(),i=(o,r)=>{const l=this.associations.get(o);l!=null&&this.associations.set(r,l);for(const[f,d]of o.children.entries())i(d,r.children[f])};return i(n,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const s=e(t[n]);if(s)return s}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let s=0;s<t.length;s++){const i=e(t[s]);i&&n.push(i)}return n}getDependency(e,t){const n=e+":"+t;let s=this.cache.get(n);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne(function(i){return i.loadNode&&i.loadNode(t)});break;case"mesh":s=this._invokeOne(function(i){return i.loadMesh&&i.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(i){return i.loadBufferView&&i.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(i){return i.loadMaterial&&i.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(i){return i.loadTexture&&i.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne(function(i){return i.loadAnimation&&i.loadAnimation(t)});break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(e,t)}),!s)throw new Error("Unknown type: "+e);break}this.cache.add(n,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,s=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(s.map(function(i,o){return n.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=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[ge.KHR_BINARY_GLTF].body);const s=this.options;return new Promise(function(i,o){n.load(c.LoaderUtils.resolveURL(t.uri,s.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(n){const s=t.byteLength||0,i=t.byteOffset||0;return n.slice(i,i+s)})}loadAccessor(e){const t=this,n=this.json,s=this.json.accessors[e];if(s.bufferView===void 0&&s.sparse===void 0){const o=xn[s.type],r=xt[s.componentType],l=s.normalized===!0,f=new r(s.count*o);return Promise.resolve(new c.BufferAttribute(f,o,l))}const i=[];return s.bufferView!==void 0?i.push(this.getDependency("bufferView",s.bufferView)):i.push(null),s.sparse!==void 0&&(i.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),i.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(i).then(function(o){const r=o[0],l=xn[s.type],f=xt[s.componentType],d=f.BYTES_PER_ELEMENT,u=d*l,p=s.byteOffset||0,g=s.bufferView!==void 0?n.bufferViews[s.bufferView].byteStride:void 0,x=s.normalized===!0;let w,_;if(g&&g!==u){const M=Math.floor(p/g),L="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+M+":"+s.count;let v=t.cache.get(L);v||(w=new f(r,M*g,s.count*g/d),v=new c.InterleavedBuffer(w,g/d),t.cache.add(L,v)),_=new c.InterleavedBufferAttribute(v,l,p%g/d,x)}else r===null?w=new f(s.count*l):w=new f(r,p,s.count*l),_=new c.BufferAttribute(w,l,x);if(s.sparse!==void 0){const M=xn.SCALAR,L=xt[s.sparse.indices.componentType],v=s.sparse.indices.byteOffset||0,y=s.sparse.values.byteOffset||0,A=new L(o[1],v,s.sparse.count*M),S=new f(o[2],y,s.sparse.count*l);r!==null&&(_=new c.BufferAttribute(_.array.slice(),_.itemSize,_.normalized));for(let b=0,P=A.length;b<P;b++){const O=A[b];if(_.setX(O,S[b*l]),l>=2&&_.setY(O,S[b*l+1]),l>=3&&_.setZ(O,S[b*l+2]),l>=4&&_.setW(O,S[b*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return _})}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e].source,o=t.images[i];let r=this.textureLoader;if(o.uri){const l=n.manager.getHandler(o.uri);l!==null&&(r=l)}return this.loadTextureImage(e,i,r)}loadTextureImage(e,t,n){const s=this,i=this.json,o=i.textures[e],r=i.images[t],l=(r.uri||r.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const f=this.loadImageSource(t,n).then(function(d){d.flipY=!1,d.name=o.name||r.name||"",d.name===""&&typeof r.uri=="string"&&r.uri.startsWith("data:image/")===!1&&(d.name=r.uri);const p=(i.samplers||{})[o.sampler]||{};return d.magFilter=ms[p.magFilter]||c.LinearFilter,d.minFilter=ms[p.minFilter]||c.LinearMipmapLinearFilter,d.wrapS=gs[p.wrapS]||c.RepeatWrapping,d.wrapT=gs[p.wrapT]||c.RepeatWrapping,s.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[l]=f,f}loadImageSource(e,t){const n=this,s=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=s.images[e],r=self.URL||self.webkitURL;let l=o.uri||"",f=!1;if(o.bufferView!==void 0)l=n.getDependency("bufferView",o.bufferView).then(function(u){f=!0;const p=new Blob([u],{type:o.mimeType});return l=r.createObjectURL(p),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(l).then(function(u){return new Promise(function(p,g){let x=p;t.isImageBitmapLoader===!0&&(x=function(w){const _=new c.Texture(w);_.needsUpdate=!0,p(_)}),t.load(c.LoaderUtils.resolveURL(u,i.path),x,void 0,g)})}).then(function(u){return f===!0&&r.revokeObjectURL(l),u.userData.mimeType=o.mimeType||Fo(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),u});return this.sourceCache[e]=d,d}assignTexture(e,t,n,s){const i=this;return this.getDependency("texture",n.index).then(function(o){if(!o)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(o=o.clone(),o.channel=n.texCoord),i.extensions[ge.KHR_TEXTURE_TRANSFORM]){const r=n.extensions!==void 0?n.extensions[ge.KHR_TEXTURE_TRANSFORM]:void 0;if(r){const l=i.associations.get(o);o=i.extensions[ge.KHR_TEXTURE_TRANSFORM].extendTexture(o,r),i.associations.set(o,l)}}return s!==void 0&&("colorSpace"in o?o.colorSpace=s===3001?"srgb":"srgb-linear":o.encoding=s),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const s=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const r="PointsMaterial:"+n.uuid;let l=this.cache.get(r);l||(l=new c.PointsMaterial,c.Material.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(r,l)),n=l}else if(e.isLine){const r="LineBasicMaterial:"+n.uuid;let l=this.cache.get(r);l||(l=new c.LineBasicMaterial,c.Material.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(r,l)),n=l}if(s||i||o){let r="ClonedMaterial:"+n.uuid+":";s&&(r+="derivative-tangents:"),i&&(r+="vertex-colors:"),o&&(r+="flat-shading:");let l=this.cache.get(r);l||(l=n.clone(),i&&(l.vertexColors=!0),o&&(l.flatShading=!0),s&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(r,l),this.associations.set(l,this.associations.get(n))),n=l}e.material=n}getMaterialType(){return c.MeshStandardMaterial}loadMaterial(e){const t=this,n=this.json,s=this.extensions,i=n.materials[e];let o;const r={},l=i.extensions||{},f=[];if(l[ge.KHR_MATERIALS_UNLIT]){const u=s[ge.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),f.push(u.extendParams(r,i,t))}else{const u=i.pbrMetallicRoughness||{};if(r.color=new c.Color(1,1,1),r.opacity=1,Array.isArray(u.baseColorFactor)){const p=u.baseColorFactor;r.color.fromArray(p),r.opacity=p[3]}u.baseColorTexture!==void 0&&f.push(t.assignTexture(r,"map",u.baseColorTexture,3001)),r.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,r.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(f.push(t.assignTexture(r,"metalnessMap",u.metallicRoughnessTexture)),f.push(t.assignTexture(r,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),f.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,r)})))}i.doubleSided===!0&&(r.side=c.DoubleSide);const d=i.alphaMode||bn.OPAQUE;if(d===bn.BLEND?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,d===bn.MASK&&(r.alphaTest=i.alphaCutoff!==void 0?i.alphaCutoff:.5)),i.normalTexture!==void 0&&o!==c.MeshBasicMaterial&&(f.push(t.assignTexture(r,"normalMap",i.normalTexture)),r.normalScale=new c.Vector2(1,1),i.normalTexture.scale!==void 0)){const u=i.normalTexture.scale;r.normalScale.set(u,u)}return i.occlusionTexture!==void 0&&o!==c.MeshBasicMaterial&&(f.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&&f.push(t.assignTexture(r,"emissiveMap",i.emissiveTexture,3001)),Promise.all(f).then(function(){const u=new o(r);return i.name&&(u.name=i.name),ot(u,i),t.associations.set(u,{materials:e}),i.extensions&&ht(s,u,i),u})}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,n=this.extensions,s=this.primitiveCache;function i(r){return n[ge.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(r,t).then(function(l){return ys(l,r,t)})}const o=[];for(let r=0,l=e.length;r<l;r++){const f=e[r],d=ko(f),u=s[d];if(u)o.push(u.promise);else{let p;f.extensions&&f.extensions[ge.KHR_DRACO_MESH_COMPRESSION]?p=i(f):p=ys(new c.BufferGeometry,f,t),s[d]={primitive:f,promise:p},o.push(p)}}return Promise.all(o)}loadMesh(e){const t=this,n=this.json,s=this.extensions,i=n.meshes[e],o=i.primitives,r=[];for(let l=0,f=o.length;l<f;l++){const d=o[l].material===void 0?Oo(this.cache):this.getDependency("material",o[l].material);r.push(d)}return r.push(t.loadGeometries(o)),Promise.all(r).then(function(l){const f=l.slice(0,l.length-1),d=l[l.length-1],u=[];for(let g=0,x=d.length;g<x;g++){const w=d[g],_=o[g];let M;const L=f[g];if(_.mode===Ve.TRIANGLES||_.mode===Ve.TRIANGLE_STRIP||_.mode===Ve.TRIANGLE_FAN||_.mode===void 0)M=i.isSkinnedMesh===!0?new c.SkinnedMesh(w,L):new c.Mesh(w,L),M.isSkinnedMesh===!0&&M.normalizeSkinWeights(),_.mode===Ve.TRIANGLE_STRIP?M.geometry=ts(M.geometry,c.TriangleStripDrawMode):_.mode===Ve.TRIANGLE_FAN&&(M.geometry=ts(M.geometry,c.TriangleFanDrawMode));else if(_.mode===Ve.LINES)M=new c.LineSegments(w,L);else if(_.mode===Ve.LINE_STRIP)M=new c.Line(w,L);else if(_.mode===Ve.LINE_LOOP)M=new c.LineLoop(w,L);else if(_.mode===Ve.POINTS)M=new c.Points(w,L);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+_.mode);Object.keys(M.geometry.morphAttributes).length>0&&Io(M,i),M.name=t.createUniqueName(i.name||"mesh_"+e),ot(M,i),_.extensions&&ht(s,M,_),t.assignFinalMaterial(M),u.push(M)}for(let g=0,x=u.length;g<x;g++)t.associations.set(u[g],{meshes:e,primitives:g});if(u.length===1)return i.extensions&&ht(s,u[0],i),u[0];const p=new c.Group;i.extensions&&ht(s,p,i),t.associations.set(p,{meshes:e});for(let g=0,x=u.length;g<x;g++)p.add(u[g]);return p})}loadCamera(e){let t;const n=this.json.cameras[e],s=n[n.type];if(!s){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new c.PerspectiveCamera(c.MathUtils.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):n.type==="orthographic"&&(t=new c.OrthographicCamera(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),ot(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let s=0,i=t.joints.length;s<i;s++)n.push(this._loadNodeShallow(t.joints[s]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(s){const i=s.pop(),o=s,r=[],l=[];for(let f=0,d=o.length;f<d;f++){const u=o[f];if(u){r.push(u);const p=new c.Matrix4;i!==null&&p.fromArray(i.array,f*16),l.push(p)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[f])}return new c.Skeleton(r,l)})}loadAnimation(e){const n=this.json.animations[e],s=n.name?n.name:"animation_"+e,i=[],o=[],r=[],l=[],f=[];for(let d=0,u=n.channels.length;d<u;d++){const p=n.channels[d],g=n.samplers[p.sampler],x=p.target,w=x.node,_=n.parameters!==void 0?n.parameters[g.input]:g.input,M=n.parameters!==void 0?n.parameters[g.output]:g.output;x.node!==void 0&&(i.push(this.getDependency("node",w)),o.push(this.getDependency("accessor",_)),r.push(this.getDependency("accessor",M)),l.push(g),f.push(x))}return Promise.all([Promise.all(i),Promise.all(o),Promise.all(r),Promise.all(l),Promise.all(f)]).then(function(d){const u=d[0],p=d[1],g=d[2],x=d[3],w=d[4],_=[];for(let M=0,L=u.length;M<L;M++){const v=u[M],y=p[M],A=g[M],S=x[M],b=w[M];if(v===void 0)continue;v.updateMatrix();let P;switch(it[b.path]){case it.weights:P=c.NumberKeyframeTrack;break;case it.rotation:P=c.QuaternionKeyframeTrack;break;case it.position:case it.scale:default:P=c.VectorKeyframeTrack;break}const O=v.name?v.name:v.uuid,k=S.interpolation!==void 0?To[S.interpolation]:c.InterpolateLinear,V=[];it[b.path]===it.weights?v.traverse(function(X){X.morphTargetInfluences&&V.push(X.name?X.name:X.uuid)}):V.push(O);let R=A.array;if(A.normalized){const X=Mn(R.constructor),K=new Float32Array(R.length);for(let H=0,he=R.length;H<he;H++)K[H]=R[H]*X;R=K}for(let X=0,K=V.length;X<K;X++){const H=new P(V[X]+"."+it[b.path],y.array,R,k);S.interpolation==="CUBICSPLINE"&&(H.createInterpolant=function(J){const G=this instanceof c.QuaternionKeyframeTrack?Lo:ps;return new G(this.times,this.values,this.getValueSize()/3,J)},H.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),_.push(H)}}return new c.AnimationClip(s,void 0,_)})}createNodeMesh(e){const t=this.json,n=this,s=t.nodes[e];return s.mesh===void 0?null:n.getDependency("mesh",s.mesh).then(function(i){const o=n._getNodeRef(n.meshCache,s.mesh,i);return s.weights!==void 0&&o.traverse(function(r){if(r.isMesh)for(let l=0,f=s.weights.length;l<f;l++)r.morphTargetInfluences[l]=s.weights[l]}),o})}loadNode(e){const t=this.json,n=this,s=t.nodes[e],i=n._loadNodeShallow(e),o=[],r=s.children||[];for(let f=0,d=r.length;f<d;f++)o.push(n.getDependency("node",r[f]));const l=s.skin===void 0?Promise.resolve(null):n.getDependency("skin",s.skin);return Promise.all([i,Promise.all(o),l]).then(function(f){const d=f[0],u=f[1],p=f[2];p!==null&&d.traverse(function(g){g.isSkinnedMesh&&g.bind(p,Bo)});for(let g=0,x=u.length;g<x;g++)d.add(u[g]);return d})}_loadNodeShallow(e){const t=this.json,n=this.extensions,s=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const i=t.nodes[e],o=i.name?s.createUniqueName(i.name):"",r=[],l=s._invokeOne(function(f){return f.createNodeMesh&&f.createNodeMesh(e)});return l&&r.push(l),i.camera!==void 0&&r.push(s.getDependency("camera",i.camera).then(function(f){return s._getNodeRef(s.cameraCache,i.camera,f)})),s._invokeAll(function(f){return f.createNodeAttachment&&f.createNodeAttachment(e)}).forEach(function(f){r.push(f)}),this.nodeCache[e]=Promise.all(r).then(function(f){let d;if(i.isBone===!0?d=new c.Bone:f.length>1?d=new c.Group:f.length===1?d=f[0]:d=new c.Object3D,d!==f[0])for(let u=0,p=f.length;u<p;u++)d.add(f[u]);if(i.name&&(d.userData.name=i.name,d.name=o),ot(d,i),i.extensions&&ht(n,d,i),i.matrix!==void 0){const u=new c.Matrix4;u.fromArray(i.matrix),d.applyMatrix4(u)}else i.translation!==void 0&&d.position.fromArray(i.translation),i.rotation!==void 0&&d.quaternion.fromArray(i.rotation),i.scale!==void 0&&d.scale.fromArray(i.scale);return s.associations.has(d)||s.associations.set(d,{}),s.associations.get(d).nodes=e,d}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],s=this,i=new c.Group;n.name&&(i.name=s.createUniqueName(n.name)),ot(i,n),n.extensions&&ht(t,i,n);const o=n.nodes||[],r=[];for(let l=0,f=o.length;l<f;l++)r.push(s.getDependency("node",o[l]));return Promise.all(r).then(function(l){for(let d=0,u=l.length;d<u;d++)i.add(l[d]);const f=d=>{const u=new Map;for(const[p,g]of s.associations)(p instanceof c.Material||p instanceof c.Texture)&&u.set(p,g);return d.traverse(p=>{const g=s.associations.get(p);g!=null&&u.set(p,g)}),u};return s.associations=f(i),i})}}function Vo(a,e,t){const n=e.attributes,s=new c.Box3;if(n.POSITION!==void 0){const r=t.json.accessors[n.POSITION],l=r.min,f=r.max;if(l!==void 0&&f!==void 0){if(s.set(new c.Vector3(l[0],l[1],l[2]),new c.Vector3(f[0],f[1],f[2])),r.normalized){const d=Mn(xt[r.componentType]);s.min.multiplyScalar(d),s.max.multiplyScalar(d)}}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,l=new c.Vector3;for(let f=0,d=i.length;f<d;f++){const u=i[f];if(u.POSITION!==void 0){const p=t.json.accessors[u.POSITION],g=p.min,x=p.max;if(g!==void 0&&x!==void 0){if(l.setX(Math.max(Math.abs(g[0]),Math.abs(x[0]))),l.setY(Math.max(Math.abs(g[1]),Math.abs(x[1]))),l.setZ(Math.max(Math.abs(g[2]),Math.abs(x[2]))),p.normalized){const w=Mn(xt[p.componentType]);l.multiplyScalar(w)}r.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(r)}a.boundingBox=s;const o=new c.Sphere;s.getCenter(o.center),o.radius=s.min.distanceTo(s.max)/2,a.boundingSphere=o}function ys(a,e,t){const n=e.attributes,s=[];function i(o,r){return t.getDependency("accessor",o).then(function(l){a.setAttribute(r,l)})}for(const o in n){const r=wn[o]||o.toLowerCase();r in a.attributes||s.push(i(n[o],r))}if(e.indices!==void 0&&!a.index){const o=t.getDependency("accessor",e.indices).then(function(r){a.setIndex(r)});s.push(o)}return ot(a,e),Vo(a,e,t),Promise.all(s).then(function(){return e.targets!==void 0?Do(a,e.targets,t):a})}class _s extends c.ExtrudeGeometry{constructor(e,t={}){const{bevelEnabled:n=!1,bevelSize:s=8,bevelThickness:i=10,font:o,height:r=50,size:l=100,lineHeight:f=1,letterSpacing:d=0,...u}=t;if(o===void 0)super();else{const p=o.generateShapes(e,l,{lineHeight:f,letterSpacing:d});super(p,{...u,bevelEnabled:n,bevelSize:s,bevelThickness:i,depth:r})}this.type="TextGeometry"}}const zo={uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:`
|
|
8
|
+
(function(re,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("three"),require("vue"),require("@tresjs/core"),require("tweakpane")):typeof define=="function"&&define.amd?define(["exports","three","vue","@tresjs/core","tweakpane"],c):(re=typeof globalThis<"u"?globalThis:re||self,c(re.trescientos={},re.Three,re.Vue,re.TresjsCore,re.tweakpane))})(this,function(re,c,h,ae,xs){"use strict";var Hu=Object.defineProperty;var $u=(re,c,h)=>c in re?Hu(re,c,{enumerable:!0,configurable:!0,writable:!0,value:h}):re[c]=h;var ye=(re,c,h)=>($u(re,typeof c!="symbol"?c+"":c,h),h);function bs(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(e,t,n.get?n:{enumerable:!0,get:()=>o[t]})}}return e.default=o,Object.freeze(e)}const Pi=bs(c);function Ci(o,e){if(e===c.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),o;if(e===c.TriangleFanDrawMode||e===c.TriangleStripDrawMode){let t=o.getIndex();if(t===null){const s=[],a=o.getAttribute("position");if(a!==void 0){for(let l=0;l<a.count;l++)s.push(l);o.setIndex(s),t=o.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),o}const n=t.count-2,i=[];if(t)if(e===c.TriangleFanDrawMode)for(let s=1;s<=n;s++)i.push(t.getX(0)),i.push(t.getX(s)),i.push(t.getX(s+1));else for(let s=0;s<n;s++)s%2===0?(i.push(t.getX(s)),i.push(t.getX(s+1)),i.push(t.getX(s+2))):(i.push(t.getX(s+2)),i.push(t.getX(s+1)),i.push(t.getX(s)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=o.clone();return r.setIndex(i),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),o}const Ms=parseInt(c.REVISION.replace(/\D+/g,""));var Ee=Uint8Array,ct=Uint16Array,In=Uint32Array,Li=new Ee([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]),Ti=new Ee([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]),As=new Ee([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Oi=function(o,e){for(var t=new ct(31),n=0;n<31;++n)t[n]=e+=1<<o[n-1];for(var i=new In(t[30]),n=1;n<30;++n)for(var r=t[n];r<t[n+1];++r)i[r]=r-t[n]<<5|n;return[t,i]},Ii=Oi(Li,2),Di=Ii[0],Ss=Ii[1];Di[28]=258,Ss[258]=28;for(var Ps=Oi(Ti,0),Cs=Ps[0],Dn=new ct(32768),Ce=0;Ce<32768;++Ce){var ht=(Ce&43690)>>>1|(Ce&21845)<<1;ht=(ht&52428)>>>2|(ht&13107)<<2,ht=(ht&61680)>>>4|(ht&3855)<<4,Dn[Ce]=((ht&65280)>>>8|(ht&255)<<8)>>>1}for(var zt=function(o,e,t){for(var n=o.length,i=0,r=new ct(e);i<n;++i)++r[o[i]-1];var s=new ct(e);for(i=0;i<e;++i)s[i]=s[i-1]+r[i-1]<<1;var a;if(t){a=new ct(1<<e);var l=15-e;for(i=0;i<n;++i)if(o[i])for(var f=i<<4|o[i],u=e-o[i],d=s[o[i]-1]++<<u,m=d|(1<<u)-1;d<=m;++d)a[Dn[d]>>>l]=f}else for(a=new ct(n),i=0;i<n;++i)o[i]&&(a[i]=Dn[s[o[i]-1]++]>>>15-o[i]);return a},jt=new Ee(288),Ce=0;Ce<144;++Ce)jt[Ce]=8;for(var Ce=144;Ce<256;++Ce)jt[Ce]=9;for(var Ce=256;Ce<280;++Ce)jt[Ce]=7;for(var Ce=280;Ce<288;++Ce)jt[Ce]=8;for(var ki=new Ee(32),Ce=0;Ce<32;++Ce)ki[Ce]=5;var Ls=zt(jt,9,1),Ts=zt(ki,5,1),kn=function(o){for(var e=o[0],t=1;t<o.length;++t)o[t]>e&&(e=o[t]);return e},Ze=function(o,e,t){var n=e/8|0;return(o[n]|o[n+1]<<8)>>(e&7)&t},Fn=function(o,e){var t=e/8|0;return(o[t]|o[t+1]<<8|o[t+2]<<16)>>(e&7)},Os=function(o){return(o/8|0)+(o&7&&1)},Is=function(o,e,t){(e==null||e<0)&&(e=0),(t==null||t>o.length)&&(t=o.length);var n=new(o instanceof ct?ct:o instanceof In?In:Ee)(t-e);return n.set(o.subarray(e,t)),n},Ds=function(o,e,t){var n=o.length;if(!n||t&&!t.l&&n<5)return e||new Ee(0);var i=!e||t,r=!t||t.i;t||(t={}),e||(e=new Ee(n*3));var s=function(H){var N=e.length;if(H>N){var j=new Ee(Math.max(N*2,H));j.set(e),e=j}},a=t.f||0,l=t.p||0,f=t.b||0,u=t.l,d=t.d,m=t.m,y=t.n,b=n*8;do{if(!u){t.f=a=Ze(o,l,1);var A=Ze(o,l+1,3);if(l+=3,A)if(A==1)u=Ls,d=Ts,m=9,y=5;else if(A==2){var S=Ze(o,l,31)+257,g=Ze(o,l+10,15)+4,O=S+Ze(o,l+5,31)+1;l+=14;for(var x=new Ee(O),C=new Ee(19),p=0;p<g;++p)C[As[p]]=Ze(o,l+p*3,7);l+=g*3;for(var w=kn(C),v=(1<<w)-1,T=zt(C,w,1),p=0;p<O;){var k=T[Ze(o,l,v)];l+=k&15;var _=k>>>4;if(_<16)x[p++]=_;else{var Q=0,Y=0;for(_==16?(Y=3+Ze(o,l,3),l+=2,Q=x[p-1]):_==17?(Y=3+Ze(o,l,7),l+=3):_==18&&(Y=11+Ze(o,l,127),l+=7);Y--;)x[p++]=Q}}var $=x.subarray(0,S),ee=x.subarray(S);m=kn($),y=kn(ee),u=zt($,m,1),d=zt(ee,y,1)}else throw"invalid block type";else{var _=Os(l)+4,L=o[_-4]|o[_-3]<<8,I=_+L;if(I>n){if(r)throw"unexpected EOF";break}i&&s(f+L),e.set(o.subarray(_,I),f),t.b=f+=L,t.p=l=I*8;continue}if(l>b){if(r)throw"unexpected EOF";break}}i&&s(f+131072);for(var q=(1<<m)-1,Z=(1<<y)-1,ie=l;;ie=l){var Q=u[Fn(o,l)&q],ne=Q>>>4;if(l+=Q&15,l>b){if(r)throw"unexpected EOF";break}if(!Q)throw"invalid length/literal";if(ne<256)e[f++]=ne;else if(ne==256){ie=l,u=null;break}else{var ce=ne-254;if(ne>264){var p=ne-257,G=Li[p];ce=Ze(o,l,(1<<G)-1)+Di[p],l+=G}var V=d[Fn(o,l)&Z],M=V>>>4;if(!V)throw"invalid distance";l+=V&15;var ee=Cs[M];if(M>3){var G=Ti[M];ee+=Fn(o,l)&(1<<G)-1,l+=G}if(l>b){if(r)throw"unexpected EOF";break}i&&s(f+131072);for(var z=f+ce;f<z;f+=4)e[f]=e[f-ee],e[f+1]=e[f+1-ee],e[f+2]=e[f+2-ee],e[f+3]=e[f+3-ee];f=z}}t.l=u,t.p=ie,t.b=f,u&&(a=1,t.m=m,t.d=d,t.n=y)}while(!a);return f==e.length?e:Is(e,0,f)},ks=new Ee(0),Fs=function(o){if((o[0]&15)!=8||o[0]>>>4>7||(o[0]<<8|o[1])%31)throw"invalid zlib data";if(o[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function Bs(o,e){return Ds((Fs(o),o.subarray(2,-4)),e)}var Us=typeof TextDecoder<"u"&&new TextDecoder,Ns=0;try{Us.decode(ks,{stream:!0}),Ns=1}catch{}const ke=new c.Triangle,on=new c.Vector3;class Vs{constructor(e){let t=e.geometry;t.index&&(console.warn("THREE.MeshSurfaceSampler: Converting geometry to non-indexed BufferGeometry."),t=t.toNonIndexed()),this.geometry=t,this.randomFunction=Math.random,this.positionAttribute=this.geometry.getAttribute("position"),this.colorAttribute=this.geometry.getAttribute("color"),this.weightAttribute=null,this.distribution=null}setWeightAttribute(e){return this.weightAttribute=e?this.geometry.getAttribute(e):null,this}build(){const e=this.positionAttribute,t=this.weightAttribute,n=new Float32Array(e.count/3);for(let r=0;r<e.count;r+=3){let s=1;t&&(s=t.getX(r)+t.getX(r+1)+t.getX(r+2)),ke.a.fromBufferAttribute(e,r),ke.b.fromBufferAttribute(e,r+1),ke.c.fromBufferAttribute(e,r+2),s*=ke.getArea(),n[r/3]=s}this.distribution=new Float32Array(e.count/3);let i=0;for(let r=0;r<n.length;r++)i+=n[r],this.distribution[r]=i;return this}setRandomGenerator(e){return this.randomFunction=e,this}sample(e,t,n){const i=this.sampleFaceIndex();return this.sampleFace(i,e,t,n)}sampleFaceIndex(){const e=this.distribution[this.distribution.length-1];return this.binarySearch(this.randomFunction()*e)}binarySearch(e){const t=this.distribution;let n=0,i=t.length-1,r=-1;for(;n<=i;){const s=Math.ceil((n+i)/2);if(s===0||t[s-1]<=e&&t[s]>e){r=s;break}else e<t[s]?i=s-1:n=s+1}return r}sampleFace(e,t,n,i){let r=this.randomFunction(),s=this.randomFunction();return r+s>1&&(r=1-r,s=1-s),ke.a.fromBufferAttribute(this.positionAttribute,e*3),ke.b.fromBufferAttribute(this.positionAttribute,e*3+1),ke.c.fromBufferAttribute(this.positionAttribute,e*3+2),t.set(0,0,0).addScaledVector(ke.a,r).addScaledVector(ke.b,s).addScaledVector(ke.c,1-(r+s)),n!==void 0&&ke.getNormal(n),i!==void 0&&this.colorAttribute!==void 0&&(ke.a.fromBufferAttribute(this.colorAttribute,e*3),ke.b.fromBufferAttribute(this.colorAttribute,e*3+1),ke.c.fromBufferAttribute(this.colorAttribute,e*3+2),on.set(0,0,0).addScaledVector(ke.a,r).addScaledVector(ke.b,s).addScaledVector(ke.c,1-(r+s)),i.r=on.x,i.g=on.y,i.b=on.z),this}}var zs=Object.defineProperty,js=(o,e,t)=>e in o?zs(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,K=(o,e,t)=>(js(o,typeof e!="symbol"?e+"":e,t),t);class Gs extends c.Object3D{constructor(e,t){super(),K(this,"isTransformControls",!0),K(this,"visible",!1),K(this,"domElement"),K(this,"raycaster",new c.Raycaster),K(this,"gizmo"),K(this,"plane"),K(this,"tempVector",new c.Vector3),K(this,"tempVector2",new c.Vector3),K(this,"tempQuaternion",new c.Quaternion),K(this,"unit",{X:new c.Vector3(1,0,0),Y:new c.Vector3(0,1,0),Z:new c.Vector3(0,0,1)}),K(this,"pointStart",new c.Vector3),K(this,"pointEnd",new c.Vector3),K(this,"offset",new c.Vector3),K(this,"rotationAxis",new c.Vector3),K(this,"startNorm",new c.Vector3),K(this,"endNorm",new c.Vector3),K(this,"rotationAngle",0),K(this,"cameraPosition",new c.Vector3),K(this,"cameraQuaternion",new c.Quaternion),K(this,"cameraScale",new c.Vector3),K(this,"parentPosition",new c.Vector3),K(this,"parentQuaternion",new c.Quaternion),K(this,"parentQuaternionInv",new c.Quaternion),K(this,"parentScale",new c.Vector3),K(this,"worldPositionStart",new c.Vector3),K(this,"worldQuaternionStart",new c.Quaternion),K(this,"worldScaleStart",new c.Vector3),K(this,"worldPosition",new c.Vector3),K(this,"worldQuaternion",new c.Quaternion),K(this,"worldQuaternionInv",new c.Quaternion),K(this,"worldScale",new c.Vector3),K(this,"eye",new c.Vector3),K(this,"positionStart",new c.Vector3),K(this,"quaternionStart",new c.Quaternion),K(this,"scaleStart",new c.Vector3),K(this,"camera"),K(this,"object"),K(this,"enabled",!0),K(this,"axis",null),K(this,"mode","translate"),K(this,"translationSnap",null),K(this,"rotationSnap",null),K(this,"scaleSnap",null),K(this,"space","world"),K(this,"size",1),K(this,"dragging",!1),K(this,"showX",!0),K(this,"showY",!0),K(this,"showZ",!0),K(this,"changeEvent",{type:"change"}),K(this,"mouseDownEvent",{type:"mouseDown",mode:this.mode}),K(this,"mouseUpEvent",{type:"mouseUp",mode:this.mode}),K(this,"objectChangeEvent",{type:"objectChange"}),K(this,"intersectObjectWithRay",(i,r,s)=>{const a=r.intersectObject(i,!0);for(let l=0;l<a.length;l++)if(a[l].object.visible||s)return a[l];return!1}),K(this,"attach",i=>(this.object=i,this.visible=!0,this)),K(this,"detach",()=>(this.object=void 0,this.visible=!1,this.axis=null,this)),K(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),K(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()}),K(this,"pointerHover",i=>{if(this.object===void 0||this.dragging===!0)return;this.raycaster.setFromCamera(i,this.camera);const r=this.intersectObjectWithRay(this.gizmo.picker[this.mode],this.raycaster);r?this.axis=r.object.name:this.axis=null}),K(this,"pointerDown",i=>{if(!(this.object===void 0||this.dragging===!0||i.button!==0)&&this.axis!==null){this.raycaster.setFromCamera(i,this.camera);const r=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(r){let s=this.space;if(this.mode==="scale"?s="local":(this.axis==="E"||this.axis==="XYZE"||this.axis==="XYZ")&&(s="world"),s==="local"&&this.mode==="rotate"){const a=this.rotationSnap;this.axis==="X"&&a&&(this.object.rotation.x=Math.round(this.object.rotation.x/a)*a),this.axis==="Y"&&a&&(this.object.rotation.y=Math.round(this.object.rotation.y/a)*a),this.axis==="Z"&&a&&(this.object.rotation.z=Math.round(this.object.rotation.z/a)*a)}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(r.point).sub(this.worldPositionStart)}this.dragging=!0,this.mouseDownEvent.mode=this.mode,this.dispatchEvent(this.mouseDownEvent)}}),K(this,"pointerMove",i=>{const r=this.axis,s=this.mode,a=this.object;let l=this.space;if(s==="scale"?l="local":(r==="E"||r==="XYZE"||r==="XYZ")&&(l="world"),a===void 0||r===null||this.dragging===!1||i.button!==-1)return;this.raycaster.setFromCamera(i,this.camera);const f=this.intersectObjectWithRay(this.plane,this.raycaster,!0);if(f){if(this.pointEnd.copy(f.point).sub(this.worldPositionStart),s==="translate")this.offset.copy(this.pointEnd).sub(this.pointStart),l==="local"&&r!=="XYZ"&&this.offset.applyQuaternion(this.worldQuaternionInv),r.indexOf("X")===-1&&(this.offset.x=0),r.indexOf("Y")===-1&&(this.offset.y=0),r.indexOf("Z")===-1&&(this.offset.z=0),l==="local"&&r!=="XYZ"?this.offset.applyQuaternion(this.quaternionStart).divide(this.parentScale):this.offset.applyQuaternion(this.parentQuaternionInv).divide(this.parentScale),a.position.copy(this.offset).add(this.positionStart),this.translationSnap&&(l==="local"&&(a.position.applyQuaternion(this.tempQuaternion.copy(this.quaternionStart).invert()),r.search("X")!==-1&&(a.position.x=Math.round(a.position.x/this.translationSnap)*this.translationSnap),r.search("Y")!==-1&&(a.position.y=Math.round(a.position.y/this.translationSnap)*this.translationSnap),r.search("Z")!==-1&&(a.position.z=Math.round(a.position.z/this.translationSnap)*this.translationSnap),a.position.applyQuaternion(this.quaternionStart)),l==="world"&&(a.parent&&a.position.add(this.tempVector.setFromMatrixPosition(a.parent.matrixWorld)),r.search("X")!==-1&&(a.position.x=Math.round(a.position.x/this.translationSnap)*this.translationSnap),r.search("Y")!==-1&&(a.position.y=Math.round(a.position.y/this.translationSnap)*this.translationSnap),r.search("Z")!==-1&&(a.position.z=Math.round(a.position.z/this.translationSnap)*this.translationSnap),a.parent&&a.position.sub(this.tempVector.setFromMatrixPosition(a.parent.matrixWorld))));else if(s==="scale"){if(r.search("XYZ")!==-1){let u=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(u*=-1),this.tempVector2.set(u,u,u)}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),r.search("X")===-1&&(this.tempVector2.x=1),r.search("Y")===-1&&(this.tempVector2.y=1),r.search("Z")===-1&&(this.tempVector2.z=1);a.scale.copy(this.scaleStart).multiply(this.tempVector2),this.scaleSnap&&this.object&&(r.search("X")!==-1&&(this.object.scale.x=Math.round(a.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),r.search("Y")!==-1&&(a.scale.y=Math.round(a.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),r.search("Z")!==-1&&(a.scale.z=Math.round(a.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(s==="rotate"){this.offset.copy(this.pointEnd).sub(this.pointStart);const u=20/this.worldPosition.distanceTo(this.tempVector.setFromMatrixPosition(this.camera.matrixWorld));r==="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):r==="XYZE"?(this.rotationAxis.copy(this.offset).cross(this.eye).normalize(),this.rotationAngle=this.offset.dot(this.tempVector.copy(this.rotationAxis).cross(this.eye))*u):(r==="X"||r==="Y"||r==="Z")&&(this.rotationAxis.copy(this.unit[r]),this.tempVector.copy(this.unit[r]),l==="local"&&this.tempVector.applyQuaternion(this.worldQuaternion),this.rotationAngle=this.offset.dot(this.tempVector.cross(this.eye).normalize())*u),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),l==="local"&&r!=="E"&&r!=="XYZE"?(a.quaternion.copy(this.quaternionStart),a.quaternion.multiply(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this.parentQuaternionInv),a.quaternion.copy(this.tempQuaternion.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),a.quaternion.multiply(this.quaternionStart).normalize())}this.dispatchEvent(this.changeEvent),this.dispatchEvent(this.objectChangeEvent)}}),K(this,"pointerUp",i=>{i.button===0&&(this.dragging&&this.axis!==null&&(this.mouseUpEvent.mode=this.mode,this.dispatchEvent(this.mouseUpEvent)),this.dragging=!1,this.axis=null)}),K(this,"getPointer",i=>{var r,s;if(this.domElement&&((r=this.domElement.ownerDocument)!=null&&r.pointerLockElement))return{x:0,y:0,button:i.button};{const a=i.changedTouches?i.changedTouches[0]:i,l=(s=this.domElement)==null?void 0:s.getBoundingClientRect();return{x:(a.clientX-l.left)/l.width*2-1,y:-(a.clientY-l.top)/l.height*2+1,button:i.button}}}),K(this,"onPointerHover",i=>{if(this.enabled)switch(i.pointerType){case"mouse":case"pen":this.pointerHover(this.getPointer(i));break}}),K(this,"onPointerDown",i=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="none",this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.pointerHover(this.getPointer(i)),this.pointerDown(this.getPointer(i)))}),K(this,"onPointerMove",i=>{this.enabled&&this.pointerMove(this.getPointer(i))}),K(this,"onPointerUp",i=>{!this.enabled||!this.domElement||(this.domElement.style.touchAction="",this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.pointerUp(this.getPointer(i)))}),K(this,"getMode",()=>this.mode),K(this,"setMode",i=>{this.mode=i}),K(this,"setTranslationSnap",i=>{this.translationSnap=i}),K(this,"setRotationSnap",i=>{this.rotationSnap=i}),K(this,"setScaleSnap",i=>{this.scaleSnap=i}),K(this,"setSize",i=>{this.size=i}),K(this,"setSpace",i=>{this.space=i}),K(this,"update",()=>{console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}),K(this,"connect",i=>{i===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.domElement=i,this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointermove",this.onPointerHover),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)}),K(this,"dispose",()=>{var i,r,s,a,l,f;(i=this.domElement)==null||i.removeEventListener("pointerdown",this.onPointerDown),(r=this.domElement)==null||r.removeEventListener("pointermove",this.onPointerHover),(a=(s=this.domElement)==null?void 0:s.ownerDocument)==null||a.removeEventListener("pointermove",this.onPointerMove),(f=(l=this.domElement)==null?void 0:l.ownerDocument)==null||f.removeEventListener("pointerup",this.onPointerUp),this.traverse(u=>{const d=u;d.geometry&&d.geometry.dispose(),d.material&&d.material.dispose()})}),this.domElement=t,this.camera=e,this.gizmo=new Rs,this.add(this.gizmo),this.plane=new Es,this.add(this.plane);const n=(i,r)=>{let s=r;Object.defineProperty(this,i,{get:function(){return s!==void 0?s:r},set:function(a){s!==a&&(s=a,this.plane[i]=a,this.gizmo[i]=a,this.dispatchEvent({type:i+"-changed",value:a}),this.dispatchEvent(this.changeEvent))}}),this[i]=r,this.plane[i]=r,this.gizmo[i]=r};n("camera",this.camera),n("object",this.object),n("enabled",this.enabled),n("axis",this.axis),n("mode",this.mode),n("translationSnap",this.translationSnap),n("rotationSnap",this.rotationSnap),n("scaleSnap",this.scaleSnap),n("space",this.space),n("size",this.size),n("dragging",this.dragging),n("showX",this.showX),n("showY",this.showY),n("showZ",this.showZ),n("worldPosition",this.worldPosition),n("worldPositionStart",this.worldPositionStart),n("worldQuaternion",this.worldQuaternion),n("worldQuaternionStart",this.worldQuaternionStart),n("cameraPosition",this.cameraPosition),n("cameraQuaternion",this.cameraQuaternion),n("pointStart",this.pointStart),n("pointEnd",this.pointEnd),n("rotationAxis",this.rotationAxis),n("rotationAngle",this.rotationAngle),n("eye",this.eye),t!==void 0&&this.connect(t)}}class Rs extends c.Object3D{constructor(){super(),K(this,"isTransformControlsGizmo",!0),K(this,"type","TransformControlsGizmo"),K(this,"tempVector",new c.Vector3(0,0,0)),K(this,"tempEuler",new c.Euler),K(this,"alignVector",new c.Vector3(0,1,0)),K(this,"zeroVector",new c.Vector3(0,0,0)),K(this,"lookAtMatrix",new c.Matrix4),K(this,"tempQuaternion",new c.Quaternion),K(this,"tempQuaternion2",new c.Quaternion),K(this,"identityQuaternion",new c.Quaternion),K(this,"unitX",new c.Vector3(1,0,0)),K(this,"unitY",new c.Vector3(0,1,0)),K(this,"unitZ",new c.Vector3(0,0,1)),K(this,"gizmo"),K(this,"picker"),K(this,"helper"),K(this,"rotationAxis",new c.Vector3),K(this,"cameraPosition",new c.Vector3),K(this,"worldPositionStart",new c.Vector3),K(this,"worldQuaternionStart",new c.Quaternion),K(this,"worldPosition",new c.Vector3),K(this,"worldQuaternion",new c.Quaternion),K(this,"eye",new c.Vector3),K(this,"camera",null),K(this,"enabled",!0),K(this,"axis",null),K(this,"mode","translate"),K(this,"space","world"),K(this,"size",1),K(this,"dragging",!1),K(this,"showX",!0),K(this,"showY",!0),K(this,"showZ",!0),K(this,"updateMatrixWorld",()=>{let ne=this.space;this.mode==="scale"&&(ne="local");const ce=ne==="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 G=[];G=G.concat(this.picker[this.mode].children),G=G.concat(this.gizmo[this.mode].children),G=G.concat(this.helper[this.mode].children);for(let V=0;V<G.length;V++){const M=G[V];M.visible=!0,M.rotation.set(0,0,0),M.position.copy(this.worldPosition);let z;if(this.camera.isOrthographicCamera?z=(this.camera.top-this.camera.bottom)/this.camera.zoom:z=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),M.scale.set(1,1,1).multiplyScalar(z*this.size/7),M.tag==="helper"){M.visible=!1,M.name==="AXIS"?(M.position.copy(this.worldPositionStart),M.visible=!!this.axis,this.axis==="X"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,0)),M.quaternion.copy(ce).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ce).dot(this.eye))>.9&&(M.visible=!1)),this.axis==="Y"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,0,Math.PI/2)),M.quaternion.copy(ce).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ce).dot(this.eye))>.9&&(M.visible=!1)),this.axis==="Z"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),M.quaternion.copy(ce).multiply(this.tempQuaternion),Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ce).dot(this.eye))>.9&&(M.visible=!1)),this.axis==="XYZE"&&(this.tempQuaternion.setFromEuler(this.tempEuler.set(0,Math.PI/2,0)),this.alignVector.copy(this.rotationAxis),M.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.zeroVector,this.alignVector,this.unitY)),M.quaternion.multiply(this.tempQuaternion),M.visible=this.dragging),this.axis==="E"&&(M.visible=!1)):M.name==="START"?(M.position.copy(this.worldPositionStart),M.visible=this.dragging):M.name==="END"?(M.position.copy(this.worldPosition),M.visible=this.dragging):M.name==="DELTA"?(M.position.copy(this.worldPositionStart),M.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()),M.scale.copy(this.tempVector),M.visible=this.dragging):(M.quaternion.copy(ce),this.dragging?M.position.copy(this.worldPositionStart):M.position.copy(this.worldPosition),this.axis&&(M.visible=this.axis.search(M.name)!==-1));continue}M.quaternion.copy(ce),this.mode==="translate"||this.mode==="scale"?((M.name==="X"||M.name==="XYZX")&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ce).dot(this.eye))>.99&&(M.scale.set(1e-10,1e-10,1e-10),M.visible=!1),(M.name==="Y"||M.name==="XYZY")&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ce).dot(this.eye))>.99&&(M.scale.set(1e-10,1e-10,1e-10),M.visible=!1),(M.name==="Z"||M.name==="XYZZ")&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ce).dot(this.eye))>.99&&(M.scale.set(1e-10,1e-10,1e-10),M.visible=!1),M.name==="XY"&&Math.abs(this.alignVector.copy(this.unitZ).applyQuaternion(ce).dot(this.eye))<.2&&(M.scale.set(1e-10,1e-10,1e-10),M.visible=!1),M.name==="YZ"&&Math.abs(this.alignVector.copy(this.unitX).applyQuaternion(ce).dot(this.eye))<.2&&(M.scale.set(1e-10,1e-10,1e-10),M.visible=!1),M.name==="XZ"&&Math.abs(this.alignVector.copy(this.unitY).applyQuaternion(ce).dot(this.eye))<.2&&(M.scale.set(1e-10,1e-10,1e-10),M.visible=!1),M.name.search("X")!==-1&&(this.alignVector.copy(this.unitX).applyQuaternion(ce).dot(this.eye)<0?M.tag==="fwd"?M.visible=!1:M.scale.x*=-1:M.tag==="bwd"&&(M.visible=!1)),M.name.search("Y")!==-1&&(this.alignVector.copy(this.unitY).applyQuaternion(ce).dot(this.eye)<0?M.tag==="fwd"?M.visible=!1:M.scale.y*=-1:M.tag==="bwd"&&(M.visible=!1)),M.name.search("Z")!==-1&&(this.alignVector.copy(this.unitZ).applyQuaternion(ce).dot(this.eye)<0?M.tag==="fwd"?M.visible=!1:M.scale.z*=-1:M.tag==="bwd"&&(M.visible=!1))):this.mode==="rotate"&&(this.tempQuaternion2.copy(ce),this.alignVector.copy(this.eye).applyQuaternion(this.tempQuaternion.copy(ce).invert()),M.name.search("E")!==-1&&M.quaternion.setFromRotationMatrix(this.lookAtMatrix.lookAt(this.eye,this.zeroVector,this.unitY)),M.name==="X"&&(this.tempQuaternion.setFromAxisAngle(this.unitX,Math.atan2(-this.alignVector.y,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),M.quaternion.copy(this.tempQuaternion)),M.name==="Y"&&(this.tempQuaternion.setFromAxisAngle(this.unitY,Math.atan2(this.alignVector.x,this.alignVector.z)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),M.quaternion.copy(this.tempQuaternion)),M.name==="Z"&&(this.tempQuaternion.setFromAxisAngle(this.unitZ,Math.atan2(this.alignVector.y,this.alignVector.x)),this.tempQuaternion.multiplyQuaternions(this.tempQuaternion2,this.tempQuaternion),M.quaternion.copy(this.tempQuaternion))),M.visible=M.visible&&(M.name.indexOf("X")===-1||this.showX),M.visible=M.visible&&(M.name.indexOf("Y")===-1||this.showY),M.visible=M.visible&&(M.name.indexOf("Z")===-1||this.showZ),M.visible=M.visible&&(M.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),M.material.tempOpacity=M.material.tempOpacity||M.material.opacity,M.material.tempColor=M.material.tempColor||M.material.color.clone(),M.material.color.copy(M.material.tempColor),M.material.opacity=M.material.tempOpacity,this.enabled?this.axis&&(M.name===this.axis?(M.material.opacity=1,M.material.color.lerp(new c.Color(1,1,1),.5)):this.axis.split("").some(function(H){return M.name===H})?(M.material.opacity=1,M.material.color.lerp(new c.Color(1,1,1),.5)):(M.material.opacity*=.25,M.material.color.lerp(new c.Color(1,1,1),.5))):(M.material.opacity*=.5,M.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}),n=e.clone();n.opacity=.15;const i=e.clone();i.opacity=.33;const r=e.clone();r.color.set(16711680);const s=e.clone();s.color.set(65280);const a=e.clone();a.color.set(255);const l=e.clone();l.opacity=.25;const f=l.clone();f.color.set(16776960);const u=l.clone();u.color.set(65535);const d=l.clone();d.color.set(16711935),e.clone().color.set(16776960);const y=t.clone();y.color.set(16711680);const b=t.clone();b.color.set(65280);const A=t.clone();A.color.set(255);const _=t.clone();_.color.set(65535);const L=t.clone();L.color.set(16711935);const I=t.clone();I.color.set(16776960);const S=t.clone();S.color.set(7895160);const g=I.clone();g.opacity=.25;const O=new c.CylinderGeometry(0,.05,.2,12,1,!1),x=new c.BoxGeometry(.125,.125,.125),C=new c.BufferGeometry;C.setAttribute("position",new c.Float32BufferAttribute([0,0,0,1,0,0],3));const p=(ne,ce)=>{const G=new c.BufferGeometry,V=[];for(let M=0;M<=64*ce;++M)V.push(0,Math.cos(M/32*Math.PI)*ne,Math.sin(M/32*Math.PI)*ne);return G.setAttribute("position",new c.Float32BufferAttribute(V,3)),G},w=()=>{const ne=new c.BufferGeometry;return ne.setAttribute("position",new c.Float32BufferAttribute([0,0,0,1,1,1],3)),ne},v={X:[[new c.Mesh(O,r),[1,0,0],[0,0,-Math.PI/2],null,"fwd"],[new c.Mesh(O,r),[1,0,0],[0,0,Math.PI/2],null,"bwd"],[new c.Line(C,y)]],Y:[[new c.Mesh(O,s),[0,1,0],null,null,"fwd"],[new c.Mesh(O,s),[0,1,0],[Math.PI,0,0],null,"bwd"],[new c.Line(C,b),null,[0,0,Math.PI/2]]],Z:[[new c.Mesh(O,a),[0,0,1],[Math.PI/2,0,0],null,"fwd"],[new c.Mesh(O,a),[0,0,1],[-Math.PI/2,0,0],null,"bwd"],[new c.Line(C,A),null,[0,-Math.PI/2,0]]],XYZ:[[new c.Mesh(new c.OctahedronGeometry(.1,0),l.clone()),[0,0,0],[0,0,0]]],XY:[[new c.Mesh(new c.PlaneGeometry(.295,.295),f.clone()),[.15,.15,0]],[new c.Line(C,I),[.18,.3,0],null,[.125,1,1]],[new c.Line(C,I),[.3,.18,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new c.Mesh(new c.PlaneGeometry(.295,.295),u.clone()),[0,.15,.15],[0,Math.PI/2,0]],[new c.Line(C,_),[0,.18,.3],[0,0,Math.PI/2],[.125,1,1]],[new c.Line(C,_),[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(C,L),[.18,0,.3],null,[.125,1,1]],[new c.Line(C,L),[.3,0,.18],[0,-Math.PI/2,0],[.125,1,1]]]},T={X:[[new c.Mesh(new c.CylinderGeometry(.2,0,1,4,1,!1),n),[.6,0,0],[0,0,-Math.PI/2]]],Y:[[new c.Mesh(new c.CylinderGeometry(.2,0,1,4,1,!1),n),[0,.6,0]]],Z:[[new c.Mesh(new c.CylinderGeometry(.2,0,1,4,1,!1),n),[0,0,.6],[Math.PI/2,0,0]]],XYZ:[[new c.Mesh(new c.OctahedronGeometry(.2,0),n)]],XY:[[new c.Mesh(new c.PlaneGeometry(.4,.4),n),[.2,.2,0]]],YZ:[[new c.Mesh(new c.PlaneGeometry(.4,.4),n),[0,.2,.2],[0,Math.PI/2,0]]],XZ:[[new c.Mesh(new c.PlaneGeometry(.4,.4),n),[.2,0,.2],[-Math.PI/2,0,0]]]},k={START:[[new c.Mesh(new c.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],END:[[new c.Mesh(new c.OctahedronGeometry(.01,2),i),null,null,null,"helper"]],DELTA:[[new c.Line(w(),i),null,null,null,"helper"]],X:[[new c.Line(C,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new c.Line(C,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new c.Line(C,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},Q={X:[[new c.Line(p(1,.5),y)],[new c.Mesh(new c.OctahedronGeometry(.04,0),r),[0,0,.99],null,[1,3,1]]],Y:[[new c.Line(p(1,.5),b),null,[0,0,-Math.PI/2]],[new c.Mesh(new c.OctahedronGeometry(.04,0),s),[0,0,.99],null,[3,1,1]]],Z:[[new c.Line(p(1,.5),A),null,[0,Math.PI/2,0]],[new c.Mesh(new c.OctahedronGeometry(.04,0),a),[.99,0,0],null,[1,3,1]]],E:[[new c.Line(p(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(p(1,1),S),null,[0,Math.PI/2,0]]]},Y={AXIS:[[new c.Line(C,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},$={X:[[new c.Mesh(new c.TorusGeometry(1,.1,4,24),n),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new c.Mesh(new c.TorusGeometry(1,.1,4,24),n),[0,0,0],[Math.PI/2,0,0]]],Z:[[new c.Mesh(new c.TorusGeometry(1,.1,4,24),n),[0,0,0],[0,0,-Math.PI/2]]],E:[[new c.Mesh(new c.TorusGeometry(1.25,.1,2,24),n)]],XYZE:[[new c.Mesh(new c.SphereGeometry(.7,10,8),n)]]},ee={X:[[new c.Mesh(x,r),[.8,0,0],[0,0,-Math.PI/2]],[new c.Line(C,y),null,null,[.8,1,1]]],Y:[[new c.Mesh(x,s),[0,.8,0]],[new c.Line(C,b),null,[0,0,Math.PI/2],[.8,1,1]]],Z:[[new c.Mesh(x,a),[0,0,.8],[Math.PI/2,0,0]],[new c.Line(C,A),null,[0,-Math.PI/2,0],[.8,1,1]]],XY:[[new c.Mesh(x,f),[.85,.85,0],null,[2,2,.2]],[new c.Line(C,I),[.855,.98,0],null,[.125,1,1]],[new c.Line(C,I),[.98,.855,0],[0,0,Math.PI/2],[.125,1,1]]],YZ:[[new c.Mesh(x,u),[0,.85,.85],null,[.2,2,2]],[new c.Line(C,_),[0,.855,.98],[0,0,Math.PI/2],[.125,1,1]],[new c.Line(C,_),[0,.98,.855],[0,-Math.PI/2,0],[.125,1,1]]],XZ:[[new c.Mesh(x,d),[.85,0,.85],null,[2,.2,2]],[new c.Line(C,L),[.855,0,.98],null,[.125,1,1]],[new c.Line(C,L),[.98,0,.855],[0,-Math.PI/2,0],[.125,1,1]]],XYZX:[[new c.Mesh(new c.BoxGeometry(.125,.125,.125),l.clone()),[1.1,0,0]]],XYZY:[[new c.Mesh(new c.BoxGeometry(.125,.125,.125),l.clone()),[0,1.1,0]]],XYZZ:[[new c.Mesh(new c.BoxGeometry(.125,.125,.125),l.clone()),[0,0,1.1]]]},q={X:[[new c.Mesh(new c.CylinderGeometry(.2,0,.8,4,1,!1),n),[.5,0,0],[0,0,-Math.PI/2]]],Y:[[new c.Mesh(new c.CylinderGeometry(.2,0,.8,4,1,!1),n),[0,.5,0]]],Z:[[new c.Mesh(new c.CylinderGeometry(.2,0,.8,4,1,!1),n),[0,0,.5],[Math.PI/2,0,0]]],XY:[[new c.Mesh(x,n),[.85,.85,0],null,[3,3,.2]]],YZ:[[new c.Mesh(x,n),[0,.85,.85],null,[.2,3,3]]],XZ:[[new c.Mesh(x,n),[.85,0,.85],null,[3,.2,3]]],XYZX:[[new c.Mesh(new c.BoxGeometry(.2,.2,.2),n),[1.1,0,0]]],XYZY:[[new c.Mesh(new c.BoxGeometry(.2,.2,.2),n),[0,1.1,0]]],XYZZ:[[new c.Mesh(new c.BoxGeometry(.2,.2,.2),n),[0,0,1.1]]]},Z={X:[[new c.Line(C,i.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new c.Line(C,i.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new c.Line(C,i.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},ie=ne=>{const ce=new c.Object3D;for(let G in ne)for(let V=ne[G].length;V--;){const M=ne[G][V][0].clone(),z=ne[G][V][1],H=ne[G][V][2],N=ne[G][V][3],j=ne[G][V][4];M.name=G,M.tag=j,z&&M.position.set(z[0],z[1],z[2]),H&&M.rotation.set(H[0],H[1],H[2]),N&&M.scale.set(N[0],N[1],N[2]),M.updateMatrix();const P=M.geometry.clone();P.applyMatrix4(M.matrix),M.geometry=P,M.renderOrder=1/0,M.position.set(0,0,0),M.rotation.set(0,0,0),M.scale.set(1,1,1),ce.add(M)}return ce};this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=ie(v)),this.add(this.gizmo.rotate=ie(Q)),this.add(this.gizmo.scale=ie(ee)),this.add(this.picker.translate=ie(T)),this.add(this.picker.rotate=ie($)),this.add(this.picker.scale=ie(q)),this.add(this.helper.translate=ie(k)),this.add(this.helper.rotate=ie(Y)),this.add(this.helper.scale=ie(Z)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}}class Es 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})),K(this,"isTransformControlsPlane",!0),K(this,"type","TransformControlsPlane"),K(this,"unitX",new c.Vector3(1,0,0)),K(this,"unitY",new c.Vector3(0,1,0)),K(this,"unitZ",new c.Vector3(0,0,1)),K(this,"tempVector",new c.Vector3),K(this,"dirVector",new c.Vector3),K(this,"alignVector",new c.Vector3),K(this,"tempMatrix",new c.Matrix4),K(this,"identityQuaternion",new c.Quaternion),K(this,"cameraQuaternion",new c.Quaternion),K(this,"worldPosition",new c.Vector3),K(this,"worldQuaternion",new c.Quaternion),K(this,"eye",new c.Vector3),K(this,"axis",null),K(this,"mode","translate"),K(this,"space","world"),K(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 Ys=Object.defineProperty,Xs=(o,e,t)=>e in o?Ys(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Oe=(o,e,t)=>(Xs(o,typeof e!="symbol"?e+"":e,t),t);const Pt=new c.Euler(0,0,0,"YXZ"),Ct=new c.Vector3,Ws={type:"change"},Zs={type:"lock"},qs={type:"unlock"},Fi=Math.PI/2;class Bn extends c.EventDispatcher{constructor(e,t){super(),Oe(this,"camera"),Oe(this,"domElement"),Oe(this,"isLocked"),Oe(this,"minPolarAngle"),Oe(this,"maxPolarAngle"),Oe(this,"pointerSpeed"),Oe(this,"onMouseMove",n=>{if(!this.domElement||this.isLocked===!1)return;const i=n.movementX||n.mozMovementX||n.webkitMovementX||0,r=n.movementY||n.mozMovementY||n.webkitMovementY||0;Pt.setFromQuaternion(this.camera.quaternion),Pt.y-=i*.002*this.pointerSpeed,Pt.x-=r*.002*this.pointerSpeed,Pt.x=Math.max(Fi-this.maxPolarAngle,Math.min(Fi-this.minPolarAngle,Pt.x)),this.camera.quaternion.setFromEuler(Pt),this.dispatchEvent(Ws)}),Oe(this,"onPointerlockChange",()=>{this.domElement&&(this.domElement.ownerDocument.pointerLockElement===this.domElement?(this.dispatchEvent(Zs),this.isLocked=!0):(this.dispatchEvent(qs),this.isLocked=!1))}),Oe(this,"onPointerlockError",()=>{console.error("THREE.PointerLockControls: Unable to use Pointer Lock API")}),Oe(this,"connect",n=>{this.domElement=n||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))}),Oe(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))}),Oe(this,"dispose",()=>{this.disconnect()}),Oe(this,"getObject",()=>this.camera),Oe(this,"direction",new c.Vector3(0,0,-1)),Oe(this,"getDirection",n=>n.copy(this.direction).applyQuaternion(this.camera.quaternion)),Oe(this,"moveForward",n=>{Ct.setFromMatrixColumn(this.camera.matrix,0),Ct.crossVectors(this.camera.up,Ct),this.camera.position.addScaledVector(Ct,n)}),Oe(this,"moveRight",n=>{Ct.setFromMatrixColumn(this.camera.matrix,0),this.camera.position.addScaledVector(Ct,n)}),Oe(this,"lock",()=>{this.domElement&&this.domElement.requestPointerLock()}),Oe(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 Ks=Object.defineProperty,Qs=(o,e,t)=>e in o?Ks(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,ue=(o,e,t)=>(Qs(o,typeof e!="symbol"?e+"":e,t),t);const an=new c.Ray,Bi=new c.Plane,Js=Math.cos(70*(Math.PI/180)),Ui=(o,e)=>(o%e+e)%e;class Ni extends c.EventDispatcher{constructor(e,t){super(),ue(this,"object"),ue(this,"domElement"),ue(this,"enabled",!0),ue(this,"target",new c.Vector3),ue(this,"minDistance",0),ue(this,"maxDistance",1/0),ue(this,"minZoom",0),ue(this,"maxZoom",1/0),ue(this,"minPolarAngle",0),ue(this,"maxPolarAngle",Math.PI),ue(this,"minAzimuthAngle",-1/0),ue(this,"maxAzimuthAngle",1/0),ue(this,"enableDamping",!1),ue(this,"dampingFactor",.05),ue(this,"enableZoom",!0),ue(this,"zoomSpeed",1),ue(this,"enableRotate",!0),ue(this,"rotateSpeed",1),ue(this,"enablePan",!0),ue(this,"panSpeed",1),ue(this,"screenSpacePanning",!0),ue(this,"keyPanSpeed",7),ue(this,"zoomToCursor",!1),ue(this,"autoRotate",!1),ue(this,"autoRotateSpeed",2),ue(this,"reverseOrbit",!1),ue(this,"reverseHorizontalOrbit",!1),ue(this,"reverseVerticalOrbit",!1),ue(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),ue(this,"mouseButtons",{LEFT:c.MOUSE.ROTATE,MIDDLE:c.MOUSE.DOLLY,RIGHT:c.MOUSE.PAN}),ue(this,"touches",{ONE:c.TOUCH.ROTATE,TWO:c.TOUCH.DOLLY_PAN}),ue(this,"target0"),ue(this,"position0"),ue(this,"zoom0"),ue(this,"_domElementKeyEvents",null),ue(this,"getPolarAngle"),ue(this,"getAzimuthalAngle"),ue(this,"setPolarAngle"),ue(this,"setAzimuthalAngle"),ue(this,"getDistance"),ue(this,"listenToKeyEvents"),ue(this,"stopListenToKeyEvents"),ue(this,"saveState"),ue(this,"reset"),ue(this,"update"),ue(this,"connect"),ue(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=()=>u.phi,this.getAzimuthalAngle=()=>u.theta,this.setPolarAngle=E=>{let se=Ui(E,2*Math.PI),pe=u.phi;pe<0&&(pe+=2*Math.PI),se<0&&(se+=2*Math.PI);let Me=Math.abs(se-pe);2*Math.PI-Me<Me&&(se<pe?se+=2*Math.PI:pe+=2*Math.PI),d.phi=se-pe,n.update()},this.setAzimuthalAngle=E=>{let se=Ui(E,2*Math.PI),pe=u.theta;pe<0&&(pe+=2*Math.PI),se<0&&(se+=2*Math.PI);let Me=Math.abs(se-pe);2*Math.PI-Me<Me&&(se<pe?se+=2*Math.PI:pe+=2*Math.PI),d.theta=se-pe,n.update()},this.getDistance=()=>n.object.position.distanceTo(n.target),this.listenToKeyEvents=E=>{E.addEventListener("keydown",Vt),this._domElementKeyEvents=E},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",Vt),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),l=a.NONE},this.update=(()=>{const E=new c.Vector3,se=new c.Vector3(0,1,0),pe=new c.Quaternion().setFromUnitVectors(e.up,se),Me=pe.clone().invert(),De=new c.Vector3,ot=new c.Quaternion,_t=2*Math.PI;return function(){const ws=n.object.position;pe.setFromUnitVectors(e.up,se),Me.copy(pe).invert(),E.copy(ws).sub(n.target),E.applyQuaternion(pe),u.setFromVector3(E),n.autoRotate&&l===a.NONE&&Y(k()),n.enableDamping?(u.theta+=d.theta*n.dampingFactor,u.phi+=d.phi*n.dampingFactor):(u.theta+=d.theta,u.phi+=d.phi);let at=n.minAzimuthAngle,lt=n.maxAzimuthAngle;isFinite(at)&&isFinite(lt)&&(at<-Math.PI?at+=_t:at>Math.PI&&(at-=_t),lt<-Math.PI?lt+=_t:lt>Math.PI&&(lt-=_t),at<=lt?u.theta=Math.max(at,Math.min(lt,u.theta)):u.theta=u.theta>(at+lt)/2?Math.max(at,u.theta):Math.min(lt,u.theta)),u.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,u.phi)),u.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(y,n.dampingFactor):n.target.add(y),n.zoomToCursor&&w||n.object.isOrthographicCamera?u.radius=G(u.radius):u.radius=G(u.radius*m),E.setFromSpherical(u),E.applyQuaternion(Me),ws.copy(n.target).add(E),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(d.theta*=1-n.dampingFactor,d.phi*=1-n.dampingFactor,y.multiplyScalar(1-n.dampingFactor)):(d.set(0,0,0),y.set(0,0,0));let Ln=!1;if(n.zoomToCursor&&w){let rn=null;if(n.object instanceof c.PerspectiveCamera&&n.object.isPerspectiveCamera){const sn=E.length();rn=G(sn*m);const Tn=sn-rn;n.object.position.addScaledVector(C,Tn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const sn=new c.Vector3(p.x,p.y,0);sn.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Ln=!0;const Tn=new c.Vector3(p.x,p.y,0);Tn.unproject(n.object),n.object.position.sub(Tn).add(sn),n.object.updateMatrixWorld(),rn=E.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;rn!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(rn).add(n.object.position):(an.origin.copy(n.object.position),an.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(an.direction))<Js?e.lookAt(n.target):(Bi.setFromNormalAndCoplanarPoint(n.object.up,n.target),an.intersectPlane(Bi,n.target))))}else n.object instanceof c.OrthographicCamera&&n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/m)),n.object.updateProjectionMatrix(),Ln=!0);return m=1,w=!1,Ln||De.distanceToSquared(n.object.position)>f||8*(1-ot.dot(n.object.quaternion))>f?(n.dispatchEvent(i),De.copy(n.object.position),ot.copy(n.object.quaternion),Ln=!1,!0):!1}})(),this.connect=E=>{E===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),n.domElement=E,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",ys),n.domElement.addEventListener("pointerdown",_e),n.domElement.addEventListener("pointercancel",st),n.domElement.addEventListener("wheel",We)},this.dispose=()=>{var E,se,pe,Me,De,ot;(E=n.domElement)==null||E.removeEventListener("contextmenu",ys),(se=n.domElement)==null||se.removeEventListener("pointerdown",_e),(pe=n.domElement)==null||pe.removeEventListener("pointercancel",st),(Me=n.domElement)==null||Me.removeEventListener("wheel",We),(De=n.domElement)==null||De.ownerDocument.removeEventListener("pointermove",we),(ot=n.domElement)==null||ot.ownerDocument.removeEventListener("pointerup",Ie),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",Vt)};const n=this,i={type:"change"},r={type:"start"},s={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const f=1e-6,u=new c.Spherical,d=new c.Spherical;let m=1;const y=new c.Vector3,b=new c.Vector2,A=new c.Vector2,_=new c.Vector2,L=new c.Vector2,I=new c.Vector2,S=new c.Vector2,g=new c.Vector2,O=new c.Vector2,x=new c.Vector2,C=new c.Vector3,p=new c.Vector2;let w=!1;const v=[],T={};function k(){return 2*Math.PI/60/60*n.autoRotateSpeed}function Q(){return Math.pow(.95,n.zoomSpeed)}function Y(E){n.reverseOrbit||n.reverseHorizontalOrbit?d.theta+=E:d.theta-=E}function $(E){n.reverseOrbit||n.reverseVerticalOrbit?d.phi+=E:d.phi-=E}const ee=(()=>{const E=new c.Vector3;return function(pe,Me){E.setFromMatrixColumn(Me,0),E.multiplyScalar(-pe),y.add(E)}})(),q=(()=>{const E=new c.Vector3;return function(pe,Me){n.screenSpacePanning===!0?E.setFromMatrixColumn(Me,1):(E.setFromMatrixColumn(Me,0),E.crossVectors(n.object.up,E)),E.multiplyScalar(pe),y.add(E)}})(),Z=(()=>{const E=new c.Vector3;return function(pe,Me){const De=n.domElement;if(De&&n.object instanceof c.PerspectiveCamera&&n.object.isPerspectiveCamera){const ot=n.object.position;E.copy(ot).sub(n.target);let _t=E.length();_t*=Math.tan(n.object.fov/2*Math.PI/180),ee(2*pe*_t/De.clientHeight,n.object.matrix),q(2*Me*_t/De.clientHeight,n.object.matrix)}else De&&n.object instanceof c.OrthographicCamera&&n.object.isOrthographicCamera?(ee(pe*(n.object.right-n.object.left)/n.object.zoom/De.clientWidth,n.object.matrix),q(Me*(n.object.top-n.object.bottom)/n.object.zoom/De.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function ie(E){n.object instanceof c.PerspectiveCamera&&n.object.isPerspectiveCamera||n.object instanceof c.OrthographicCamera&&n.object.isOrthographicCamera?m/=E:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function ne(E){n.object instanceof c.PerspectiveCamera&&n.object.isPerspectiveCamera||n.object instanceof c.OrthographicCamera&&n.object.isOrthographicCamera?m*=E:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function ce(E){if(!n.zoomToCursor||!n.domElement)return;w=!0;const se=n.domElement.getBoundingClientRect(),pe=E.clientX-se.left,Me=E.clientY-se.top,De=se.width,ot=se.height;p.x=pe/De*2-1,p.y=-(Me/ot)*2+1,C.set(p.x,p.y,1).unproject(n.object).sub(n.object.position).normalize()}function G(E){return Math.max(n.minDistance,Math.min(n.maxDistance,E))}function V(E){b.set(E.clientX,E.clientY)}function M(E){ce(E),g.set(E.clientX,E.clientY)}function z(E){L.set(E.clientX,E.clientY)}function H(E){A.set(E.clientX,E.clientY),_.subVectors(A,b).multiplyScalar(n.rotateSpeed);const se=n.domElement;se&&(Y(2*Math.PI*_.x/se.clientHeight),$(2*Math.PI*_.y/se.clientHeight)),b.copy(A),n.update()}function N(E){O.set(E.clientX,E.clientY),x.subVectors(O,g),x.y>0?ie(Q()):x.y<0&&ne(Q()),g.copy(O),n.update()}function j(E){I.set(E.clientX,E.clientY),S.subVectors(I,L).multiplyScalar(n.panSpeed),Z(S.x,S.y),L.copy(I),n.update()}function P(E){ce(E),E.deltaY<0?ne(Q()):E.deltaY>0&&ie(Q()),n.update()}function D(E){let se=!1;switch(E.code){case n.keys.UP:Z(0,n.keyPanSpeed),se=!0;break;case n.keys.BOTTOM:Z(0,-n.keyPanSpeed),se=!0;break;case n.keys.LEFT:Z(n.keyPanSpeed,0),se=!0;break;case n.keys.RIGHT:Z(-n.keyPanSpeed,0),se=!0;break}se&&(E.preventDefault(),n.update())}function F(){if(v.length==1)b.set(v[0].pageX,v[0].pageY);else{const E=.5*(v[0].pageX+v[1].pageX),se=.5*(v[0].pageY+v[1].pageY);b.set(E,se)}}function R(){if(v.length==1)L.set(v[0].pageX,v[0].pageY);else{const E=.5*(v[0].pageX+v[1].pageX),se=.5*(v[0].pageY+v[1].pageY);L.set(E,se)}}function W(){const E=v[0].pageX-v[1].pageX,se=v[0].pageY-v[1].pageY,pe=Math.sqrt(E*E+se*se);g.set(0,pe)}function X(){n.enableZoom&&W(),n.enablePan&&R()}function te(){n.enableZoom&&W(),n.enableRotate&&F()}function U(E){if(v.length==1)A.set(E.pageX,E.pageY);else{const pe=Si(E),Me=.5*(E.pageX+pe.x),De=.5*(E.pageY+pe.y);A.set(Me,De)}_.subVectors(A,b).multiplyScalar(n.rotateSpeed);const se=n.domElement;se&&(Y(2*Math.PI*_.x/se.clientHeight),$(2*Math.PI*_.y/se.clientHeight)),b.copy(A)}function B(E){if(v.length==1)I.set(E.pageX,E.pageY);else{const se=Si(E),pe=.5*(E.pageX+se.x),Me=.5*(E.pageY+se.y);I.set(pe,Me)}S.subVectors(I,L).multiplyScalar(n.panSpeed),Z(S.x,S.y),L.copy(I)}function oe(E){const se=Si(E),pe=E.pageX-se.x,Me=E.pageY-se.y,De=Math.sqrt(pe*pe+Me*Me);O.set(0,De),x.set(0,Math.pow(O.y/g.y,n.zoomSpeed)),ie(x.y),g.copy(O)}function le(E){n.enableZoom&&oe(E),n.enablePan&&B(E)}function me(E){n.enableZoom&&oe(E),n.enableRotate&&U(E)}function _e(E){var se,pe;n.enabled!==!1&&(v.length===0&&((se=n.domElement)==null||se.ownerDocument.addEventListener("pointermove",we),(pe=n.domElement)==null||pe.ownerDocument.addEventListener("pointerup",Ie)),Ju(E),E.pointerType==="touch"?Ku(E):nn(E))}function we(E){n.enabled!==!1&&(E.pointerType==="touch"?Qu(E):Nt(E))}function Ie(E){var se,pe,Me;_s(E),v.length===0&&((se=n.domElement)==null||se.releasePointerCapture(E.pointerId),(pe=n.domElement)==null||pe.ownerDocument.removeEventListener("pointermove",we),(Me=n.domElement)==null||Me.ownerDocument.removeEventListener("pointerup",Ie)),n.dispatchEvent(s),l=a.NONE}function st(E){_s(E)}function nn(E){let se;switch(E.button){case 0:se=n.mouseButtons.LEFT;break;case 1:se=n.mouseButtons.MIDDLE;break;case 2:se=n.mouseButtons.RIGHT;break;default:se=-1}switch(se){case c.MOUSE.DOLLY:if(n.enableZoom===!1)return;M(E),l=a.DOLLY;break;case c.MOUSE.ROTATE:if(E.ctrlKey||E.metaKey||E.shiftKey){if(n.enablePan===!1)return;z(E),l=a.PAN}else{if(n.enableRotate===!1)return;V(E),l=a.ROTATE}break;case c.MOUSE.PAN:if(E.ctrlKey||E.metaKey||E.shiftKey){if(n.enableRotate===!1)return;V(E),l=a.ROTATE}else{if(n.enablePan===!1)return;z(E),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&n.dispatchEvent(r)}function Nt(E){if(n.enabled!==!1)switch(l){case a.ROTATE:if(n.enableRotate===!1)return;H(E);break;case a.DOLLY:if(n.enableZoom===!1)return;N(E);break;case a.PAN:if(n.enablePan===!1)return;j(E);break}}function We(E){n.enabled===!1||n.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(E.preventDefault(),n.dispatchEvent(r),P(E),n.dispatchEvent(s))}function Vt(E){n.enabled===!1||n.enablePan===!1||D(E)}function Ku(E){switch(vs(E),v.length){case 1:switch(n.touches.ONE){case c.TOUCH.ROTATE:if(n.enableRotate===!1)return;F(),l=a.TOUCH_ROTATE;break;case c.TOUCH.PAN:if(n.enablePan===!1)return;R(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(n.touches.TWO){case c.TOUCH.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;X(),l=a.TOUCH_DOLLY_PAN;break;case c.TOUCH.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;te(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&n.dispatchEvent(r)}function Qu(E){switch(vs(E),l){case a.TOUCH_ROTATE:if(n.enableRotate===!1)return;U(E),n.update();break;case a.TOUCH_PAN:if(n.enablePan===!1)return;B(E),n.update();break;case a.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;le(E),n.update();break;case a.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;me(E),n.update();break;default:l=a.NONE}}function ys(E){n.enabled!==!1&&E.preventDefault()}function Ju(E){v.push(E)}function _s(E){delete T[E.pointerId];for(let se=0;se<v.length;se++)if(v[se].pointerId==E.pointerId){v.splice(se,1);return}}function vs(E){let se=T[E.pointerId];se===void 0&&(se=new c.Vector2,T[E.pointerId]=se),se.set(E.pageX,E.pageY)}function Si(E){const se=E.pointerId===v[0].pointerId?v[1]:v[0];return T[se.pointerId]}t!==void 0&&this.connect(t),this.update()}}class Hs extends Ni{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 $s extends c.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new ro(t)}),this.register(function(t){return new fo(t)}),this.register(function(t){return new po(t)}),this.register(function(t){return new mo(t)}),this.register(function(t){return new oo(t)}),this.register(function(t){return new ao(t)}),this.register(function(t){return new lo(t)}),this.register(function(t){return new co(t)}),this.register(function(t){return new io(t)}),this.register(function(t){return new ho(t)}),this.register(function(t){return new so(t)}),this.register(function(t){return new uo(t)}),this.register(function(t){return new to(t)}),this.register(function(t){return new go(t)}),this.register(function(t){return new yo(t)})}load(e,t,n,i){const r=this;let s;this.resourcePath!==""?s=this.resourcePath:this.path!==""?s=this.path:s=c.LoaderUtils.extractUrlBase(e),this.manager.itemStart(e);const a=function(f){i?i(f):console.error(f),r.manager.itemError(e),r.manager.itemEnd(e)},l=new c.FileLoader(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(f){try{r.parse(f,s,function(u){t(u),r.manager.itemEnd(e)},a)}catch(u){a(u)}},n,a)}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,n,i){let r;const s={},a={};if(typeof e=="string")r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4)))===Vi){try{s[xe.KHR_BINARY_GLTF]=new _o(e)}catch(u){i&&i(u);return}r=JSON.parse(s[xe.KHR_BINARY_GLTF].content)}else r=JSON.parse(c.LoaderUtils.decodeText(new Uint8Array(e)));else r=e;if(r.asset===void 0||r.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new Io(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let f=0;f<this.pluginCallbacks.length;f++){const u=this.pluginCallbacks[f](l);a[u.name]=u,s[u.name]=!0}if(r.extensionsUsed)for(let f=0;f<r.extensionsUsed.length;++f){const u=r.extensionsUsed[f],d=r.extensionsRequired||[];switch(u){case xe.KHR_MATERIALS_UNLIT:s[u]=new no;break;case xe.KHR_DRACO_MESH_COMPRESSION:s[u]=new vo(r,this.dracoLoader);break;case xe.KHR_TEXTURE_TRANSFORM:s[u]=new wo;break;case xe.KHR_MESH_QUANTIZATION:s[u]=new xo;break;default:d.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(s),l.setPlugins(a),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}}function eo(){let o={};return{get:function(e){return o[e]},add:function(e,t){o[e]=t},remove:function(e){delete o[e]},removeAll:function(){o={}}}}const xe={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 to{constructor(e){this.parser=e,this.name=xe.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const r=t[n];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const r=t.json,l=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let f;const u=new c.Color(16777215);l.color!==void 0&&u.fromArray(l.color);const d=l.range!==void 0?l.range:0;switch(l.type){case"directional":f=new c.DirectionalLight(u),f.target.position.set(0,0,-1),f.add(f.target);break;case"point":f=new c.PointLight(u),f.distance=d;break;case"spot":f=new c.SpotLight(u),f.distance=d,l.spot=l.spot||{},l.spot.innerConeAngle=l.spot.innerConeAngle!==void 0?l.spot.innerConeAngle:0,l.spot.outerConeAngle=l.spot.outerConeAngle!==void 0?l.spot.outerConeAngle:Math.PI/4,f.angle=l.spot.outerConeAngle,f.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,f.target.position.set(0,0,-1),f.add(f.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return f.position.set(0,0,0),f.decay=2,ft(f,l),l.intensity!==void 0&&(f.intensity=l.intensity),f.name=t.createUniqueName(l.name||"light_"+e),i=Promise.resolve(f),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,r=n.json.nodes[e],a=(r.extensions&&r.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(l){return n._getNodeRef(t.cache,a,l)})}}class no{constructor(){this.name=xe.KHR_MATERIALS_UNLIT}getMaterialType(){return c.MeshBasicMaterial}extendParams(e,t,n){const i=[];e.color=new c.Color(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const s=r.baseColorFactor;e.color.fromArray(s),e.opacity=s[3]}r.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",r.baseColorTexture,3001))}return Promise.all(i)}}class io{constructor(e){this.parser=e,this.name=xe.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name].emissiveStrength;return r!==void 0&&(t.emissiveIntensity=r),Promise.resolve()}}class ro{constructor(e){this.parser=e,this.name=xe.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];if(s.clearcoatFactor!==void 0&&(t.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(r.push(n.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const a=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new c.Vector2(a,a)}return Promise.all(r)}}class so{constructor(e){this.parser=e,this.name=xe.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return s.iridescenceFactor!==void 0&&(t.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),s.iridescenceIor!==void 0&&(t.iridescenceIOR=s.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),s.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),s.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),s.iridescenceThicknessTexture!==void 0&&r.push(n.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class oo{constructor(e){this.parser=e,this.name=xe.KHR_MATERIALS_SHEEN}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new c.Color(0,0,0),t.sheenRoughness=0,t.sheen=1;const s=i.extensions[this.name];return s.sheenColorFactor!==void 0&&t.sheenColor.fromArray(s.sheenColorFactor),s.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&r.push(n.assignTexture(t,"sheenColorMap",s.sheenColorTexture,3001)),s.sheenRoughnessTexture!==void 0&&r.push(n.assignTexture(t,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(r)}}class ao{constructor(e){this.parser=e,this.name=xe.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return s.transmissionFactor!==void 0&&(t.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&r.push(n.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class lo{constructor(e){this.parser=e,this.name=xe.KHR_MATERIALS_VOLUME}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];t.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&r.push(n.assignTexture(t,"thicknessMap",s.thicknessTexture)),t.attenuationDistance=s.attenuationDistance||1/0;const a=s.attenuationColor||[1,1,1];return t.attenuationColor=new c.Color(a[0],a[1],a[2]),Promise.all(r)}}class co{constructor(e){this.parser=e,this.name=xe.KHR_MATERIALS_IOR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name];return t.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class ho{constructor(e){this.parser=e,this.name=xe.KHR_MATERIALS_SPECULAR}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];t.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&r.push(n.assignTexture(t,"specularIntensityMap",s.specularTexture));const a=s.specularColorFactor||[1,1,1];return t.specularColor=new c.Color(a[0],a[1],a[2]),s.specularColorTexture!==void 0&&r.push(n.assignTexture(t,"specularColorMap",s.specularColorTexture,3001)),Promise.all(r)}}class uo{constructor(e){this.parser=e,this.name=xe.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const n=this.parser.json.materials[e];return!n.extensions||!n.extensions[this.name]?null:c.MeshPhysicalMaterial}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return s.anisotropyStrength!==void 0&&(t.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(t.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&r.push(n.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(r)}}class fo{constructor(e){this.parser=e,this.name=xe.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],s=t.options.ktx2Loader;if(!s){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,s)}}class po{constructor(e){this.parser=e,this.name=xe.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const s=r.extensions[t],a=i.images[s.source];let l=n.textureLoader;if(a.uri){const f=n.options.manager.getHandler(a.uri);f!==null&&(l=f)}return this.detectSupport().then(function(f){if(f)return n.loadTextureImage(e,s.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.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 mo{constructor(e){this.parser=e,this.name=xe.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const s=r.extensions[t],a=i.images[s.source];let l=n.textureLoader;if(a.uri){const f=n.options.manager.getHandler(a.uri);f!==null&&(l=f)}return this.detectSupport().then(function(f){if(f)return n.loadTextureImage(e,s.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.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 go{constructor(e){this.name=xe.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],r=this.parser.getDependency("buffer",i.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.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 r.then(function(a){const l=i.byteOffset||0,f=i.byteLength||0,u=i.count,d=i.byteStride,m=new Uint8Array(a,l,f);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(u,d,m,i.mode,i.filter).then(function(y){return y.buffer}):s.ready.then(function(){const y=new ArrayBuffer(u*d);return s.decodeGltfBuffer(new Uint8Array(y),u,d,m,i.mode,i.filter),y})})}else return null}}class yo{constructor(e){this.name=xe.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const f of i.primitives)if(f.mode!==Ye.TRIANGLES&&f.mode!==Ye.TRIANGLE_STRIP&&f.mode!==Ye.TRIANGLE_FAN&&f.mode!==void 0)return null;const s=n.extensions[this.name].attributes,a=[],l={};for(const f in s)a.push(this.parser.getDependency("accessor",s[f]).then(u=>(l[f]=u,l[f])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(f=>{const u=f.pop(),d=u.isGroup?u.children:[u],m=f[0].count,y=[];for(const b of d){const A=new c.Matrix4,_=new c.Vector3,L=new c.Quaternion,I=new c.Vector3(1,1,1),S=new c.InstancedMesh(b.geometry,b.material,m);for(let g=0;g<m;g++)l.TRANSLATION&&_.fromBufferAttribute(l.TRANSLATION,g),l.ROTATION&&L.fromBufferAttribute(l.ROTATION,g),l.SCALE&&I.fromBufferAttribute(l.SCALE,g),S.setMatrixAt(g,A.compose(_,L,I));for(const g in l)g!=="TRANSLATION"&&g!=="ROTATION"&&g!=="SCALE"&&b.geometry.setAttribute(g,l[g]);c.Object3D.prototype.copy.call(S,b),this.parser.assignFinalMaterial(S),y.push(S)}return u.isGroup?(u.clear(),u.add(...y),u):y[0]}))}}const Vi="glTF",Gt=12,zi={JSON:1313821514,BIN:5130562};class _o{constructor(e){this.name=xe.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Gt);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!==Vi)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-Gt,i=new DataView(e,Gt);let r=0;for(;r<n;){const s=i.getUint32(r,!0);r+=4;const a=i.getUint32(r,!0);if(r+=4,a===zi.JSON){const l=new Uint8Array(e,Gt+r,s);this.content=c.LoaderUtils.decodeText(l)}else if(a===zi.BIN){const l=Gt+r;this.body=e.slice(l,l+s)}r+=s}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class vo{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=xe.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,a={},l={},f={};for(const u in s){const d=Nn[u]||u.toLowerCase();a[d]=s[u]}for(const u in e.attributes){const d=Nn[u]||u.toLowerCase();if(s[u]!==void 0){const m=n.accessors[e.attributes[u]],y=Lt[m.componentType];f[d]=y.name,l[d]=m.normalized===!0}}return t.getDependency("bufferView",r).then(function(u){return new Promise(function(d){i.decodeDracoFile(u,function(m){for(const y in m.attributes){const b=m.attributes[y],A=l[y];A!==void 0&&(b.normalized=A)}d(m)},a,f)})})}}class wo{constructor(){this.name=xe.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 xo{constructor(){this.name=xe.KHR_MESH_QUANTIZATION}}class ji extends c.Interpolant{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let s=0;s!==i;s++)t[s]=n[r+s];return t}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,l=a*2,f=a*3,u=i-t,d=(n-t)/u,m=d*d,y=m*d,b=e*f,A=b-f,_=-2*y+3*m,L=y-m,I=1-_,S=L-m+d;for(let g=0;g!==a;g++){const O=s[A+g+a],x=s[A+g+l]*u,C=s[b+g+a],p=s[b+g]*u;r[g]=I*O+S*x+_*C+L*p}return r}}const bo=new c.Quaternion;class Mo extends ji{interpolate_(e,t,n,i){const r=super.interpolate_(e,t,n,i);return bo.fromArray(r).normalize().toArray(r),r}}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},Lt={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Gi={9728:c.NearestFilter,9729:c.LinearFilter,9984:c.NearestMipmapNearestFilter,9985:c.LinearMipmapNearestFilter,9986:c.NearestMipmapLinearFilter,9987:c.LinearMipmapLinearFilter},Ri={33071:c.ClampToEdgeWrapping,33648:c.MirroredRepeatWrapping,10497:c.RepeatWrapping},Un={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Nn={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...Ms>=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"},ut={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ao={CUBICSPLINE:void 0,LINEAR:c.InterpolateLinear,STEP:c.InterpolateDiscrete},Vn={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function So(o){return o.DefaultMaterial===void 0&&(o.DefaultMaterial=new c.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:c.FrontSide})),o.DefaultMaterial}function vt(o,e,t){for(const n in t.extensions)o[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function ft(o,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(o.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Po(o,e,t){let n=!1,i=!1,r=!1;for(let f=0,u=e.length;f<u;f++){const d=e[f];if(d.POSITION!==void 0&&(n=!0),d.NORMAL!==void 0&&(i=!0),d.COLOR_0!==void 0&&(r=!0),n&&i&&r)break}if(!n&&!i&&!r)return Promise.resolve(o);const s=[],a=[],l=[];for(let f=0,u=e.length;f<u;f++){const d=e[f];if(n){const m=d.POSITION!==void 0?t.getDependency("accessor",d.POSITION):o.attributes.position;s.push(m)}if(i){const m=d.NORMAL!==void 0?t.getDependency("accessor",d.NORMAL):o.attributes.normal;a.push(m)}if(r){const m=d.COLOR_0!==void 0?t.getDependency("accessor",d.COLOR_0):o.attributes.color;l.push(m)}}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(l)]).then(function(f){const u=f[0],d=f[1],m=f[2];return n&&(o.morphAttributes.position=u),i&&(o.morphAttributes.normal=d),r&&(o.morphAttributes.color=m),o.morphTargetsRelative=!0,o})}function Co(o,e){if(o.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)o.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(o.morphTargetInfluences.length===t.length){o.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)o.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Lo(o){let e;const t=o.extensions&&o.extensions[xe.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+zn(t.attributes):e=o.indices+":"+zn(o.attributes)+":"+o.mode,o.targets!==void 0)for(let n=0,i=o.targets.length;n<i;n++)e+=":"+zn(o.targets[n]);return e}function zn(o){let e="";const t=Object.keys(o).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+o[t[n]]+";";return e}function jn(o){switch(o){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 To(o){return o.search(/\.jpe?g($|\?)/i)>0||o.search(/^data\:image\/jpeg/)===0?"image/jpeg":o.search(/\.webp($|\?)/i)>0||o.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Oo=new c.Matrix4;class Io{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new eo,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 n=!1,i=!1,r=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(n=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,r=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||n||i&&r<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 n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(s){const a={scene:s[0][i.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:i.asset,parser:n,userData:{}};vt(r,a,i),ft(a,i),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,r=t.length;i<r;i++){const s=t[i].joints;for(let a=0,l=s.length;a<l;a++)e[s[a]].isBone=!0}for(let i=0,r=e.length;i<r;i++){const s=e[i];s.mesh!==void 0&&(this._addNodeRef(this.meshCache,s.mesh),s.skin!==void 0&&(n[s.mesh].isSkinnedMesh=!0)),s.camera!==void 0&&this._addNodeRef(this.cameraCache,s.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,n){if(e.refs[t]<=1)return n;const i=n.clone(),r=(s,a)=>{const l=this.associations.get(s);l!=null&&this.associations.set(a,l);for(const[f,u]of s.children.entries())r(u,a.children[f])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(r){return r.loadNode&&r.loadNode(t)});break;case"mesh":i=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(r,s){return n.getDependency(e,s)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=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[xe.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(r,s){n.load(c.LoaderUtils.resolveURL(t.uri,i.path),r,void 0,function(){s(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(n){const i=t.byteLength||0,r=t.byteOffset||0;return n.slice(r,r+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const s=Un[i.type],a=Lt[i.componentType],l=i.normalized===!0,f=new a(i.count*s);return Promise.resolve(new c.BufferAttribute(f,s,l))}const r=[];return i.bufferView!==void 0?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),i.sparse!==void 0&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then(function(s){const a=s[0],l=Un[i.type],f=Lt[i.componentType],u=f.BYTES_PER_ELEMENT,d=u*l,m=i.byteOffset||0,y=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,b=i.normalized===!0;let A,_;if(y&&y!==d){const L=Math.floor(m/y),I="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+L+":"+i.count;let S=t.cache.get(I);S||(A=new f(a,L*y,i.count*y/u),S=new c.InterleavedBuffer(A,y/u),t.cache.add(I,S)),_=new c.InterleavedBufferAttribute(S,l,m%y/u,b)}else a===null?A=new f(i.count*l):A=new f(a,m,i.count*l),_=new c.BufferAttribute(A,l,b);if(i.sparse!==void 0){const L=Un.SCALAR,I=Lt[i.sparse.indices.componentType],S=i.sparse.indices.byteOffset||0,g=i.sparse.values.byteOffset||0,O=new I(s[1],S,i.sparse.count*L),x=new f(s[2],g,i.sparse.count*l);a!==null&&(_=new c.BufferAttribute(_.array.slice(),_.itemSize,_.normalized));for(let C=0,p=O.length;C<p;C++){const w=O[C];if(_.setX(w,x[C*l]),l>=2&&_.setY(w,x[C*l+1]),l>=3&&_.setZ(w,x[C*l+2]),l>=4&&_.setW(w,x[C*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return _})}loadTexture(e){const t=this.json,n=this.options,r=t.textures[e].source,s=t.images[r];let a=this.textureLoader;if(s.uri){const l=n.manager.getHandler(s.uri);l!==null&&(a=l)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){const i=this,r=this.json,s=r.textures[e],a=r.images[t],l=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[l])return this.textureCache[l];const f=this.loadImageSource(t,n).then(function(u){u.flipY=!1,u.name=s.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const m=(r.samplers||{})[s.sampler]||{};return u.magFilter=Gi[m.magFilter]||c.LinearFilter,u.minFilter=Gi[m.minFilter]||c.LinearMipmapLinearFilter,u.wrapS=Ri[m.wrapS]||c.RepeatWrapping,u.wrapT=Ri[m.wrapT]||c.RepeatWrapping,i.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=f,f}loadImageSource(e,t){const n=this,i=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(d=>d.clone());const s=i.images[e],a=self.URL||self.webkitURL;let l=s.uri||"",f=!1;if(s.bufferView!==void 0)l=n.getDependency("bufferView",s.bufferView).then(function(d){f=!0;const m=new Blob([d],{type:s.mimeType});return l=a.createObjectURL(m),l});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(l).then(function(d){return new Promise(function(m,y){let b=m;t.isImageBitmapLoader===!0&&(b=function(A){const _=new c.Texture(A);_.needsUpdate=!0,m(_)}),t.load(c.LoaderUtils.resolveURL(d,r.path),b,void 0,y)})}).then(function(d){return f===!0&&a.revokeObjectURL(l),d.userData.mimeType=s.mimeType||To(s.uri),d}).catch(function(d){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),d});return this.sourceCache[e]=u,u}assignTexture(e,t,n,i){const r=this;return this.getDependency("texture",n.index).then(function(s){if(!s)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(s=s.clone(),s.channel=n.texCoord),r.extensions[xe.KHR_TEXTURE_TRANSFORM]){const a=n.extensions!==void 0?n.extensions[xe.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=r.associations.get(s);s=r.extensions[xe.KHR_TEXTURE_TRANSFORM].extendTexture(s,a),r.associations.set(s,l)}}return i!==void 0&&("colorSpace"in s?s.colorSpace=i===3001?"srgb":"srgb-linear":s.encoding=i),e[t]=s,s})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,s=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+n.uuid;let l=this.cache.get(a);l||(l=new c.PointsMaterial,c.Material.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(a,l)),n=l}else if(e.isLine){const a="LineBasicMaterial:"+n.uuid;let l=this.cache.get(a);l||(l=new c.LineBasicMaterial,c.Material.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(a,l)),n=l}if(i||r||s){let a="ClonedMaterial:"+n.uuid+":";i&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),s&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=n.clone(),r&&(l.vertexColors=!0),s&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(n))),n=l}e.material=n}getMaterialType(){return c.MeshStandardMaterial}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let s;const a={},l=r.extensions||{},f=[];if(l[xe.KHR_MATERIALS_UNLIT]){const d=i[xe.KHR_MATERIALS_UNLIT];s=d.getMaterialType(),f.push(d.extendParams(a,r,t))}else{const d=r.pbrMetallicRoughness||{};if(a.color=new c.Color(1,1,1),a.opacity=1,Array.isArray(d.baseColorFactor)){const m=d.baseColorFactor;a.color.fromArray(m),a.opacity=m[3]}d.baseColorTexture!==void 0&&f.push(t.assignTexture(a,"map",d.baseColorTexture,3001)),a.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,a.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(f.push(t.assignTexture(a,"metalnessMap",d.metallicRoughnessTexture)),f.push(t.assignTexture(a,"roughnessMap",d.metallicRoughnessTexture))),s=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(e)}),f.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(e,a)})))}r.doubleSided===!0&&(a.side=c.DoubleSide);const u=r.alphaMode||Vn.OPAQUE;if(u===Vn.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===Vn.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&s!==c.MeshBasicMaterial&&(f.push(t.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new c.Vector2(1,1),r.normalTexture.scale!==void 0)){const d=r.normalTexture.scale;a.normalScale.set(d,d)}return r.occlusionTexture!==void 0&&s!==c.MeshBasicMaterial&&(f.push(t.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&s!==c.MeshBasicMaterial&&(a.emissive=new c.Color().fromArray(r.emissiveFactor)),r.emissiveTexture!==void 0&&s!==c.MeshBasicMaterial&&f.push(t.assignTexture(a,"emissiveMap",r.emissiveTexture,3001)),Promise.all(f).then(function(){const d=new s(a);return r.name&&(d.name=r.name),ft(d,r),t.associations.set(d,{materials:e}),r.extensions&&vt(i,d,r),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,n=this.extensions,i=this.primitiveCache;function r(a){return n[xe.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return Ei(l,a,t)})}const s=[];for(let a=0,l=e.length;a<l;a++){const f=e[a],u=Lo(f),d=i[u];if(d)s.push(d.promise);else{let m;f.extensions&&f.extensions[xe.KHR_DRACO_MESH_COMPRESSION]?m=r(f):m=Ei(new c.BufferGeometry,f,t),i[u]={primitive:f,promise:m},s.push(m)}}return Promise.all(s)}loadMesh(e){const t=this,n=this.json,i=this.extensions,r=n.meshes[e],s=r.primitives,a=[];for(let l=0,f=s.length;l<f;l++){const u=s[l].material===void 0?So(this.cache):this.getDependency("material",s[l].material);a.push(u)}return a.push(t.loadGeometries(s)),Promise.all(a).then(function(l){const f=l.slice(0,l.length-1),u=l[l.length-1],d=[];for(let y=0,b=u.length;y<b;y++){const A=u[y],_=s[y];let L;const I=f[y];if(_.mode===Ye.TRIANGLES||_.mode===Ye.TRIANGLE_STRIP||_.mode===Ye.TRIANGLE_FAN||_.mode===void 0)L=r.isSkinnedMesh===!0?new c.SkinnedMesh(A,I):new c.Mesh(A,I),L.isSkinnedMesh===!0&&L.normalizeSkinWeights(),_.mode===Ye.TRIANGLE_STRIP?L.geometry=Ci(L.geometry,c.TriangleStripDrawMode):_.mode===Ye.TRIANGLE_FAN&&(L.geometry=Ci(L.geometry,c.TriangleFanDrawMode));else if(_.mode===Ye.LINES)L=new c.LineSegments(A,I);else if(_.mode===Ye.LINE_STRIP)L=new c.Line(A,I);else if(_.mode===Ye.LINE_LOOP)L=new c.LineLoop(A,I);else if(_.mode===Ye.POINTS)L=new c.Points(A,I);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+_.mode);Object.keys(L.geometry.morphAttributes).length>0&&Co(L,r),L.name=t.createUniqueName(r.name||"mesh_"+e),ft(L,r),_.extensions&&vt(i,L,_),t.assignFinalMaterial(L),d.push(L)}for(let y=0,b=d.length;y<b;y++)t.associations.set(d[y],{meshes:e,primitives:y});if(d.length===1)return r.extensions&&vt(i,d[0],r),d[0];const m=new c.Group;r.extensions&&vt(i,m,r),t.associations.set(m,{meshes:e});for(let y=0,b=d.length;y<b;y++)m.add(d[y]);return m})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new c.PerspectiveCamera(c.MathUtils.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new c.OrthographicCamera(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),ft(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,r=t.joints.length;i<r;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){const r=i.pop(),s=i,a=[],l=[];for(let f=0,u=s.length;f<u;f++){const d=s[f];if(d){a.push(d);const m=new c.Matrix4;r!==null&&m.fromArray(r.array,f*16),l.push(m)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[f])}return new c.Skeleton(a,l)})}loadAnimation(e){const n=this.json.animations[e],i=n.name?n.name:"animation_"+e,r=[],s=[],a=[],l=[],f=[];for(let u=0,d=n.channels.length;u<d;u++){const m=n.channels[u],y=n.samplers[m.sampler],b=m.target,A=b.node,_=n.parameters!==void 0?n.parameters[y.input]:y.input,L=n.parameters!==void 0?n.parameters[y.output]:y.output;b.node!==void 0&&(r.push(this.getDependency("node",A)),s.push(this.getDependency("accessor",_)),a.push(this.getDependency("accessor",L)),l.push(y),f.push(b))}return Promise.all([Promise.all(r),Promise.all(s),Promise.all(a),Promise.all(l),Promise.all(f)]).then(function(u){const d=u[0],m=u[1],y=u[2],b=u[3],A=u[4],_=[];for(let L=0,I=d.length;L<I;L++){const S=d[L],g=m[L],O=y[L],x=b[L],C=A[L];if(S===void 0)continue;S.updateMatrix();let p;switch(ut[C.path]){case ut.weights:p=c.NumberKeyframeTrack;break;case ut.rotation:p=c.QuaternionKeyframeTrack;break;case ut.position:case ut.scale:default:p=c.VectorKeyframeTrack;break}const w=S.name?S.name:S.uuid,v=x.interpolation!==void 0?Ao[x.interpolation]:c.InterpolateLinear,T=[];ut[C.path]===ut.weights?S.traverse(function(Q){Q.morphTargetInfluences&&T.push(Q.name?Q.name:Q.uuid)}):T.push(w);let k=O.array;if(O.normalized){const Q=jn(k.constructor),Y=new Float32Array(k.length);for(let $=0,ee=k.length;$<ee;$++)Y[$]=k[$]*Q;k=Y}for(let Q=0,Y=T.length;Q<Y;Q++){const $=new p(T[Q]+"."+ut[C.path],g.array,k,v);x.interpolation==="CUBICSPLINE"&&($.createInterpolant=function(q){const Z=this instanceof c.QuaternionKeyframeTrack?Mo:ji;return new Z(this.times,this.values,this.getValueSize()/3,q)},$.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),_.push($)}}return new c.AnimationClip(i,void 0,_)})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(r){const s=n._getNodeRef(n.meshCache,i.mesh,r);return i.weights!==void 0&&s.traverse(function(a){if(a.isMesh)for(let l=0,f=i.weights.length;l<f;l++)a.morphTargetInfluences[l]=i.weights[l]}),s})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],r=n._loadNodeShallow(e),s=[],a=i.children||[];for(let f=0,u=a.length;f<u;f++)s.push(n.getDependency("node",a[f]));const l=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([r,Promise.all(s),l]).then(function(f){const u=f[0],d=f[1],m=f[2];m!==null&&u.traverse(function(y){y.isSkinnedMesh&&y.bind(m,Oo)});for(let y=0,b=d.length;y<b;y++)u.add(d[y]);return u})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const r=t.nodes[e],s=r.name?i.createUniqueName(r.name):"",a=[],l=i._invokeOne(function(f){return f.createNodeMesh&&f.createNodeMesh(e)});return l&&a.push(l),r.camera!==void 0&&a.push(i.getDependency("camera",r.camera).then(function(f){return i._getNodeRef(i.cameraCache,r.camera,f)})),i._invokeAll(function(f){return f.createNodeAttachment&&f.createNodeAttachment(e)}).forEach(function(f){a.push(f)}),this.nodeCache[e]=Promise.all(a).then(function(f){let u;if(r.isBone===!0?u=new c.Bone:f.length>1?u=new c.Group:f.length===1?u=f[0]:u=new c.Object3D,u!==f[0])for(let d=0,m=f.length;d<m;d++)u.add(f[d]);if(r.name&&(u.userData.name=r.name,u.name=s),ft(u,r),r.extensions&&vt(n,u,r),r.matrix!==void 0){const d=new c.Matrix4;d.fromArray(r.matrix),u.applyMatrix4(d)}else r.translation!==void 0&&u.position.fromArray(r.translation),r.rotation!==void 0&&u.quaternion.fromArray(r.rotation),r.scale!==void 0&&u.scale.fromArray(r.scale);return i.associations.has(u)||i.associations.set(u,{}),i.associations.get(u).nodes=e,u}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,r=new c.Group;n.name&&(r.name=i.createUniqueName(n.name)),ft(r,n),n.extensions&&vt(t,r,n);const s=n.nodes||[],a=[];for(let l=0,f=s.length;l<f;l++)a.push(i.getDependency("node",s[l]));return Promise.all(a).then(function(l){for(let u=0,d=l.length;u<d;u++)r.add(l[u]);const f=u=>{const d=new Map;for(const[m,y]of i.associations)(m instanceof c.Material||m instanceof c.Texture)&&d.set(m,y);return u.traverse(m=>{const y=i.associations.get(m);y!=null&&d.set(m,y)}),d};return i.associations=f(r),r})}}function Do(o,e,t){const n=e.attributes,i=new c.Box3;if(n.POSITION!==void 0){const a=t.json.accessors[n.POSITION],l=a.min,f=a.max;if(l!==void 0&&f!==void 0){if(i.set(new c.Vector3(l[0],l[1],l[2]),new c.Vector3(f[0],f[1],f[2])),a.normalized){const u=jn(Lt[a.componentType]);i.min.multiplyScalar(u),i.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=e.targets;if(r!==void 0){const a=new c.Vector3,l=new c.Vector3;for(let f=0,u=r.length;f<u;f++){const d=r[f];if(d.POSITION!==void 0){const m=t.json.accessors[d.POSITION],y=m.min,b=m.max;if(y!==void 0&&b!==void 0){if(l.setX(Math.max(Math.abs(y[0]),Math.abs(b[0]))),l.setY(Math.max(Math.abs(y[1]),Math.abs(b[1]))),l.setZ(Math.max(Math.abs(y[2]),Math.abs(b[2]))),m.normalized){const A=jn(Lt[m.componentType]);l.multiplyScalar(A)}a.max(l)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(a)}o.boundingBox=i;const s=new c.Sphere;i.getCenter(s.center),s.radius=i.min.distanceTo(i.max)/2,o.boundingSphere=s}function Ei(o,e,t){const n=e.attributes,i=[];function r(s,a){return t.getDependency("accessor",s).then(function(l){o.setAttribute(a,l)})}for(const s in n){const a=Nn[s]||s.toLowerCase();a in o.attributes||i.push(r(n[s],a))}if(e.indices!==void 0&&!o.index){const s=t.getDependency("accessor",e.indices).then(function(a){o.setIndex(a)});i.push(s)}return ft(o,e),Do(o,e,t),Promise.all(i).then(function(){return e.targets!==void 0?Po(o,e.targets,t):o})}class Yi extends c.ExtrudeGeometry{constructor(e,t={}){const{bevelEnabled:n=!1,bevelSize:i=8,bevelThickness:r=10,font:s,height:a=50,size:l=100,lineHeight:f=1,letterSpacing:u=0,...d}=t;if(s===void 0)super();else{const m=s.generateShapes(e,l,{lineHeight:f,letterSpacing:u});super(m,{...d,bevelEnabled:n,bevelSize:i,bevelThickness:r,depth:a})}this.type="TextGeometry"}}const ko={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
|
+
`},Fo={uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:`
|
|
41
41
|
varying vec2 vUv;
|
|
42
42
|
|
|
43
43
|
void main() {
|
|
@@ -70,13 +70,57 @@
|
|
|
70
70
|
gl_FragColor = sum;
|
|
71
71
|
|
|
72
72
|
}
|
|
73
|
-
`};function vs(a,e,t){const n=t.length-a-1;if(e>=t[n])return n-1;if(e<=t[a])return a;let s=a,i=n,o=Math.floor((s+i)/2);for(;e<t[o]||e>=t[o+1];)e<t[o]?i=o:s=o,o=Math.floor((s+i)/2);return o}function Go(a,e,t,n){const s=[],i=[],o=[];s[0]=1;for(let r=1;r<=t;++r){i[r]=e-n[a+1-r],o[r]=n[a+r]-e;let l=0;for(let f=0;f<r;++f){const d=o[f+1],u=i[r-f],p=s[f]/(d+u);s[f]=l+d*p,l=u*p}s[r]=l}return s}function Ro(a,e,t,n){const s=vs(a,n,e),i=Go(s,n,a,e),o=new c.Vector4(0,0,0,0);for(let r=0;r<=a;++r){const l=t[s-a+r],f=i[r],d=l.w*f;o.x+=l.x*d,o.y+=l.y*d,o.z+=l.z*d,o.w+=l.w*f}return o}function jo(a,e,t,n,s){const i=[];for(let u=0;u<=t;++u)i[u]=0;const o=[];for(let u=0;u<=n;++u)o[u]=i.slice(0);const r=[];for(let u=0;u<=t;++u)r[u]=i.slice(0);r[0][0]=1;const l=i.slice(0),f=i.slice(0);for(let u=1;u<=t;++u){l[u]=e-s[a+1-u],f[u]=s[a+u]-e;let p=0;for(let g=0;g<u;++g){const x=f[g+1],w=l[u-g];r[u][g]=x+w;const _=r[g][u-1]/r[u][g];r[g][u]=p+x*_,p=w*_}r[u][u]=p}for(let u=0;u<=t;++u)o[0][u]=r[u][t];for(let u=0;u<=t;++u){let p=0,g=1;const x=[];for(let w=0;w<=t;++w)x[w]=i.slice(0);x[0][0]=1;for(let w=1;w<=n;++w){let _=0;const M=u-w,L=t-w;u>=w&&(x[g][0]=x[p][0]/r[L+1][M],_=x[g][0]*r[M][L]);const v=M>=-1?1:-M,y=u-1<=L?w-1:t-u;for(let S=v;S<=y;++S)x[g][S]=(x[p][S]-x[p][S-1])/r[L+1][M+S],_+=x[g][S]*r[M+S][L];u<=L&&(x[g][w]=-x[p][w-1]/r[L+1][u],_+=x[g][w]*r[u][L]),o[w][u]=_;const A=p;p=g,g=A}}let d=t;for(let u=1;u<=n;++u){for(let p=0;p<=t;++p)o[u][p]*=d;d*=t-u}return o}function Eo(a,e,t,n,s){const i=s<a?s:a,o=[],r=vs(a,n,e),l=jo(r,n,a,i,e),f=[];for(let d=0;d<t.length;++d){const u=t[d].clone(),p=u.w;u.x*=p,u.y*=p,u.z*=p,f[d]=u}for(let d=0;d<=i;++d){const u=f[r-a].clone().multiplyScalar(l[d][0]);for(let p=1;p<=a;++p)u.add(f[r-a+p].clone().multiplyScalar(l[d][p]));o[d]=u}for(let d=i+1;d<=s+1;++d)o[d]=new c.Vector4(0,0,0);return o}function Xo(a,e){let t=1;for(let s=2;s<=a;++s)t*=s;let n=1;for(let s=2;s<=e;++s)n*=s;for(let s=2;s<=a-e;++s)n*=s;return t/n}function Yo(a){const e=a.length,t=[],n=[];for(let i=0;i<e;++i){const o=a[i];t[i]=new c.Vector3(o.x,o.y,o.z),n[i]=o.w}const s=[];for(let i=0;i<e;++i){const o=t[i].clone();for(let r=1;r<=i;++r)o.sub(s[i-r].clone().multiplyScalar(Xo(i,r)*n[r]));s[i]=o.divideScalar(n[0])}return s}function Wo(a,e,t,n,s){const i=Eo(a,e,t,n,s);return Yo(i)}class xs extends c.Curve{constructor(e,t,n,s,i){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=s||0,this.endKnot=i||this.knots.length-1;for(let o=0;o<n.length;++o){const r=n[o];this.controlPoints[o]=new c.Vector4(r.x,r.y,r.z,r.w)}}getPoint(e,t){const n=t||new c.Vector3,s=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),i=Ro(this.degree,this.knots,this.controlPoints,s);return i.w!=1&&i.divideScalar(i.w),n.set(i.x,i.y,i.z)}getTangent(e,t){const n=t||new c.Vector3,s=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),i=Wo(this.degree,this.knots,this.controlPoints,s,1);return n.copy(i[1]).normalize(),n}}let me,Se,Fe;class Zo extends c.Loader{constructor(e){super(e)}load(e,t,n,s){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(l){try{t(i.parse(l,o))}catch(f){s?s(f):console.error(f),i.manager.itemError(e)}},n,s)}parse(e,t){if($o(e))me=new Ho().parse(e);else{const s=Ps(e);if(!er(s))throw new Error("THREE.FBXLoader: Unknown format.");if(As(s)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+As(s));me=new Jo().parse(s)}const n=new c.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Qo(n,this.manager).parse(me)}}class Qo{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){Se=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),s=this.parseDeformers(),i=new Ko().parse(s);return this.parseScene(s,i,n),Fe}parseConnections(){const e=new Map;return"Connections"in me&&me.Connections.connections.forEach(function(n){const s=n[0],i=n[1],o=n[2];e.has(s)||e.set(s,{parents:[],children:[]});const r={ID:i,relationship:o};e.get(s).parents.push(r),e.has(i)||e.set(i,{parents:[],children:[]});const l={ID:s,relationship:o};e.get(i).children.push(l)}),e}parseImages(){const e={},t={};if("Video"in me.Objects){const n=me.Objects.Video;for(const s in n){const i=n[s],o=parseInt(s);if(e[o]=i.RelativeFilename||i.Filename,"Content"in i){const r=i.Content instanceof ArrayBuffer&&i.Content.byteLength>0,l=typeof i.Content=="string"&&i.Content!=="";if(r||l){const f=this.parseImage(n[s]);t[i.RelativeFilename||i.Filename]=f}}}}for(const n in e){const s=e[n];t[s]!==void 0?e[n]=t[s]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,s=n.slice(n.lastIndexOf(".")+1).toLowerCase();let i;switch(s){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 ",n),i="image/tga";break;default:console.warn('FBXLoader: Image type "'+s+'" 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 me.Objects){const n=me.Objects.Texture;for(const s in n){const i=this.parseTexture(n[s],e);t.set(parseInt(s),i)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const s=e.WrapModeU,i=e.WrapModeV,o=s!==void 0?s.value:0,r=i!==void 0?i.value:0;if(n.wrapS=o===0?c.RepeatWrapping:c.ClampToEdgeWrapping,n.wrapT=r===0?c.RepeatWrapping:c.ClampToEdgeWrapping,"Scaling"in e){const l=e.Scaling.value;n.repeat.x=l[0],n.repeat.y=l[1]}return n}loadTexture(e,t){let n;const s=this.textureLoader.path,i=Se.get(e.id).children;i!==void 0&&i.length>0&&t[i[0].ID]!==void 0&&(n=t[i[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let o;const r=e.FileName.slice(-3).toLowerCase();if(r==="tga"){const l=this.manager.getHandler(".tga");l===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),o=new c.Texture):(l.setPath(this.textureLoader.path),o=l.load(n))}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(n);return this.textureLoader.setPath(s),o}parseMaterials(e){const t=new Map;if("Material"in me.Objects){const n=me.Objects.Material;for(const s in n){const i=this.parseMaterial(n[s],e);i!==null&&t.set(parseInt(s),i)}}return t}parseMaterial(e,t){const n=e.id,s=e.attrName;let i=e.ShadingModel;if(typeof i=="object"&&(i=i.value),!Se.has(n))return null;const o=this.parseParameters(e,t,n);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=s,r}parseParameters(e,t,n){const s={};e.BumpFactor&&(s.bumpScale=e.BumpFactor.value),e.Diffuse?s.color=new c.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(s.color=new c.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(s.displacementScale=e.DisplacementFactor.value),e.Emissive?s.emissive=new c.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(s.emissive=new c.Color().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(s.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(s.opacity=parseFloat(e.Opacity.value)),s.opacity<1&&(s.transparent=!0),e.ReflectionFactor&&(s.reflectivity=e.ReflectionFactor.value),e.Shininess&&(s.shininess=e.Shininess.value),e.Specular?s.specular=new c.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(s.specular=new c.Color().fromArray(e.SpecularColor.value));const i=this;return Se.get(n).children.forEach(function(o){const r=o.relationship;switch(r){case"Bump":s.bumpMap=i.getTexture(t,o.ID);break;case"Maya|TEX_ao_map":s.aoMap=i.getTexture(t,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":s.map=i.getTexture(t,o.ID),s.map!==void 0&&("colorSpace"in s.map?s.map.colorSpace="srgb":s.map.encoding=3001);break;case"DisplacementColor":s.displacementMap=i.getTexture(t,o.ID);break;case"EmissiveColor":s.emissiveMap=i.getTexture(t,o.ID),s.emissiveMap!==void 0&&("colorSpace"in s.emissiveMap?s.emissiveMap.colorSpace="srgb":s.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":s.normalMap=i.getTexture(t,o.ID);break;case"ReflectionColor":s.envMap=i.getTexture(t,o.ID),s.envMap!==void 0&&(s.envMap.mapping=c.EquirectangularReflectionMapping,"colorSpace"in s.envMap?s.envMap.colorSpace="srgb":s.envMap.encoding=3001);break;case"SpecularColor":s.specularMap=i.getTexture(t,o.ID),s.specularMap!==void 0&&("colorSpace"in s.specularMap?s.specularMap.colorSpace="srgb":s.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":s.alphaMap=i.getTexture(t,o.ID),s.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}}),s}getTexture(e,t){return"LayeredTexture"in me.Objects&&t in me.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Se.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in me.Objects){const n=me.Objects.Deformer;for(const s in n){const i=n[s],o=Se.get(parseInt(s));if(i.attrType==="Skin"){const r=this.parseSkeleton(o,n);r.ID=s,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[s]=r}else if(i.attrType==="BlendShape"){const r={id:s};r.rawTargets=this.parseMorphTargets(o,n),r.id=s,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[s]=r}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(s){const i=t[s.ID];if(i.attrType!=="Cluster")return;const o={ID:s.ID,indices:[],weights:[],transformLink:new c.Matrix4().fromArray(i.TransformLink.a)};"Indexes"in i&&(o.indices=i.Indexes.a,o.weights=i.Weights.a),n.push(o)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let s=0;s<e.children.length;s++){const i=e.children[s],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=Se.get(parseInt(i.ID)).children.filter(function(l){return l.relationship===void 0})[0].ID,n.push(r)}return n}parseScene(e,t,n){Fe=new c.Group;const s=this.parseModels(e.skeletons,t,n),i=me.Objects.Model,o=this;s.forEach(function(l){const f=i[l.ID];o.setLookAtProperties(l,f),Se.get(l.ID).parents.forEach(function(u){const p=s.get(u.ID);p!==void 0&&p.add(l)}),l.parent===null&&Fe.add(l)}),this.bindSkeleton(e.skeletons,t,s),this.createAmbientLight(),Fe.traverse(function(l){if(l.userData.transformData){l.parent&&(l.userData.transformData.parentMatrix=l.parent.matrix,l.userData.transformData.parentMatrixWorld=l.parent.matrixWorld);const f=Ms(l.userData.transformData);l.applyMatrix4(f),l.updateWorldMatrix()}});const r=new qo().parse();Fe.children.length===1&&Fe.children[0].isGroup&&(Fe.children[0].animations=r,Fe=Fe.children[0]),Fe.animations=r}parseModels(e,t,n){const s=new Map,i=me.Objects.Model;for(const o in i){const r=parseInt(o),l=i[o],f=Se.get(r);let d=this.buildSkeleton(f,e,r,l.attrName);if(!d){switch(l.attrType){case"Camera":d=this.createCamera(f);break;case"Light":d=this.createLight(f);break;case"Mesh":d=this.createMesh(f,t,n);break;case"NurbsCurve":d=this.createCurve(f,t);break;case"LimbNode":case"Root":d=new c.Bone;break;case"Null":default:d=new c.Group;break}d.name=l.attrName?c.PropertyBinding.sanitizeNodeName(l.attrName):"",d.ID=r}this.getTransformData(d,l),s.set(r,d)}return s}buildSkeleton(e,t,n,s){let i=null;return e.parents.forEach(function(o){for(const r in t){const l=t[r];l.rawBones.forEach(function(f,d){if(f.ID===o.ID){const u=i;i=new c.Bone,i.matrixWorld.copy(f.transformLink),i.name=s?c.PropertyBinding.sanitizeNodeName(s):"",i.ID=n,l.bones[d]=i,u!==null&&i.add(u)}})}}),i}createCamera(e){let t,n;if(e.children.forEach(function(s){const i=me.Objects.NodeAttribute[s.ID];i!==void 0&&(n=i)}),n===void 0)t=new c.Object3D;else{let s=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(s=1);let i=1;n.NearPlane!==void 0&&(i=n.NearPlane.value/1e3);let o=1e3;n.FarPlane!==void 0&&(o=n.FarPlane.value/1e3);let r=window.innerWidth,l=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(r=n.AspectWidth.value,l=n.AspectHeight.value);const f=r/l;let d=45;n.FieldOfView!==void 0&&(d=n.FieldOfView.value);const u=n.FocalLength?n.FocalLength.value:null;switch(s){case 0:t=new c.PerspectiveCamera(d,f,i,o),u!==null&&t.setFocalLength(u);break;case 1:t=new c.OrthographicCamera(-r/2,r/2,l/2,-l/2,i,o);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+s+"."),t=new c.Object3D;break}}return t}createLight(e){let t,n;if(e.children.forEach(function(s){const i=me.Objects.NodeAttribute[s.ID];i!==void 0&&(n=i)}),n===void 0)t=new c.Object3D;else{let s;n.LightType===void 0?s=0:s=n.LightType.value;let i=16777215;n.Color!==void 0&&(i=new c.Color().fromArray(n.Color.value));let o=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(o=0);let r=0;n.FarAttenuationEnd!==void 0&&(n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?r=0:r=n.FarAttenuationEnd.value);const l=1;switch(s){case 0:t=new c.PointLight(i,o,r,l);break;case 1:t=new c.DirectionalLight(i,o);break;case 2:let f=Math.PI/3;n.InnerAngle!==void 0&&(f=c.MathUtils.degToRad(n.InnerAngle.value));let d=0;n.OuterAngle!==void 0&&(d=c.MathUtils.degToRad(n.OuterAngle.value),d=Math.max(d,1)),t=new c.SpotLight(i,o,r,f,d,l);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new c.PointLight(i,o);break}n.CastShadows!==void 0&&n.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,n){let s,i=null,o=null;const r=[];return e.children.forEach(function(l){t.has(l.ID)&&(i=t.get(l.ID)),n.has(l.ID)&&r.push(n.get(l.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(l){l.vertexColors=!0}),i.FBX_Deformer?(s=new c.SkinnedMesh(i,o),s.normalizeSkinWeights()):s=new c.Mesh(i,o),s}createCurve(e,t){const n=e.children.reduce(function(i,o){return t.has(o.ID)&&(i=t.get(o.ID)),i},null),s=new c.LineBasicMaterial({color:3342591,linewidth:1});return new c.Line(n,s)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=Ss(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&Se.get(e.ID).children.forEach(function(s){if(s.relationship==="LookAtProperty"){const i=me.Objects.Model[s.ID];if("Lcl_Translation"in i){const o=i.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),Fe.add(e.target)):e.lookAt(new c.Vector3().fromArray(o))}}})}bindSkeleton(e,t,n){const s=this.parsePoseNodes();for(const i in e){const o=e[i];Se.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){const f=l.ID;Se.get(f).parents.forEach(function(u){n.has(u.ID)&&n.get(u.ID).bind(new c.Skeleton(o.bones),s[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in me.Objects){const t=me.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const s=t[n].PoseNode;Array.isArray(s)?s.forEach(function(i){e[i.Node]=new c.Matrix4().fromArray(i.Matrix.a)}):e[s.Node]=new c.Matrix4().fromArray(s.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in me&&"AmbientColor"in me.GlobalSettings){const e=me.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],s=e[2];if(t!==0||n!==0||s!==0){const i=new c.Color(t,n,s);Fe.add(new c.AmbientLight(i,1))}}}}class Ko{parse(e){const t=new Map;if("Geometry"in me.Objects){const n=me.Objects.Geometry;for(const s in n){const i=Se.get(parseInt(s)),o=this.parseGeometry(i,n[s],e);t.set(parseInt(s),o)}}return t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const s=n.skeletons,i=[],o=e.parents.map(function(u){return me.Objects.Model[u.ID]});if(o.length===0)return;const r=e.children.reduce(function(u,p){return s[p.ID]!==void 0&&(u=s[p.ID]),u},null);e.children.forEach(function(u){n.morphTargets[u.ID]!==void 0&&i.push(n.morphTargets[u.ID])});const l=o[0],f={};"RotationOrder"in l&&(f.eulerOrder=Ss(l.RotationOrder.value)),"InheritType"in l&&(f.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(f.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(f.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(f.scale=l.GeometricScaling.value);const d=Ms(f);return this.genGeometry(t,r,i,d)}genGeometry(e,t,n,s){const i=new c.BufferGeometry;e.attrName&&(i.name=e.attrName);const o=this.parseGeoNode(e,t),r=this.genBuffers(o),l=new c.Float32BufferAttribute(r.vertex,3);if(l.applyMatrix4(s),i.setAttribute("position",l),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 f=new c.Matrix3().getNormalMatrix(s),d=new c.Float32BufferAttribute(r.normal,3);d.applyNormalMatrix(f),i.setAttribute("normal",d)}if(r.uvs.forEach(function(f,d){let u="uv"+(d+1).toString();d===0&&(u="uv"),i.setAttribute(u,new c.Float32BufferAttribute(r.uvs[d],2))}),o.material&&o.material.mappingType!=="AllSame"){let f=r.materialIndex[0],d=0;if(r.materialIndex.forEach(function(u,p){u!==f&&(i.addGroup(d,p-d,f),f=u,d=p)}),i.groups.length>0){const u=i.groups[i.groups.length-1],p=u.start+u.count;p!==r.materialIndex.length&&i.addGroup(p,r.materialIndex.length-p,f)}i.groups.length===0&&i.addGroup(0,r.materialIndex.length,r.materialIndex[0])}return this.addMorphTargets(i,e,n,s),i}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let s=0;for(;e.LayerElementUV[s];)e.LayerElementUV[s].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[s])),s++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(s,i){s.indices.forEach(function(o,r){n.weightTable[o]===void 0&&(n.weightTable[o]=[]),n.weightTable[o].push({id:i,weight:s.weights[r]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,s=0,i=!1,o=[],r=[],l=[],f=[],d=[],u=[];const p=this;return e.vertexIndices.forEach(function(g,x){let w,_=!1;g<0&&(g=g^-1,_=!0);let M=[],L=[];if(o.push(g*3,g*3+1,g*3+2),e.color){const v=Wt(x,n,g,e.color);l.push(v[0],v[1],v[2])}if(e.skeleton){if(e.weightTable[g]!==void 0&&e.weightTable[g].forEach(function(v){L.push(v.weight),M.push(v.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 v=[0,0,0,0],y=[0,0,0,0];L.forEach(function(A,S){let b=A,P=M[S];y.forEach(function(O,k,V){if(b>O){V[k]=b,b=O;const R=v[k];v[k]=P,P=R}})}),M=v,L=y}for(;L.length<4;)L.push(0),M.push(0);for(let v=0;v<4;++v)d.push(L[v]),u.push(M[v])}if(e.normal){const v=Wt(x,n,g,e.normal);r.push(v[0],v[1],v[2])}e.material&&e.material.mappingType!=="AllSame"&&(w=Wt(x,n,g,e.material)[0]),e.uv&&e.uv.forEach(function(v,y){const A=Wt(x,n,g,v);f[y]===void 0&&(f[y]=[]),f[y].push(A[0]),f[y].push(A[1])}),s++,_&&(p.genFace(t,e,o,w,r,l,f,d,u,s),n++,s=0,o=[],r=[],l=[],f=[],d=[],u=[])}),t}genFace(e,t,n,s,i,o,r,l,f,d){for(let u=2;u<d;u++)e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[(u-1)*3]]),e.vertex.push(t.vertexPositions[n[(u-1)*3+1]]),e.vertex.push(t.vertexPositions[n[(u-1)*3+2]]),e.vertex.push(t.vertexPositions[n[u*3]]),e.vertex.push(t.vertexPositions[n[u*3+1]]),e.vertex.push(t.vertexPositions[n[u*3+2]]),t.skeleton&&(e.vertexWeights.push(l[0]),e.vertexWeights.push(l[1]),e.vertexWeights.push(l[2]),e.vertexWeights.push(l[3]),e.vertexWeights.push(l[(u-1)*4]),e.vertexWeights.push(l[(u-1)*4+1]),e.vertexWeights.push(l[(u-1)*4+2]),e.vertexWeights.push(l[(u-1)*4+3]),e.vertexWeights.push(l[u*4]),e.vertexWeights.push(l[u*4+1]),e.vertexWeights.push(l[u*4+2]),e.vertexWeights.push(l[u*4+3]),e.weightsIndices.push(f[0]),e.weightsIndices.push(f[1]),e.weightsIndices.push(f[2]),e.weightsIndices.push(f[3]),e.weightsIndices.push(f[(u-1)*4]),e.weightsIndices.push(f[(u-1)*4+1]),e.weightsIndices.push(f[(u-1)*4+2]),e.weightsIndices.push(f[(u-1)*4+3]),e.weightsIndices.push(f[u*4]),e.weightsIndices.push(f[u*4+1]),e.weightsIndices.push(f[u*4+2]),e.weightsIndices.push(f[u*4+3])),t.color&&(e.colors.push(o[0]),e.colors.push(o[1]),e.colors.push(o[2]),e.colors.push(o[(u-1)*3]),e.colors.push(o[(u-1)*3+1]),e.colors.push(o[(u-1)*3+2]),e.colors.push(o[u*3]),e.colors.push(o[u*3+1]),e.colors.push(o[u*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(s),e.materialIndex.push(s),e.materialIndex.push(s)),t.normal&&(e.normal.push(i[0]),e.normal.push(i[1]),e.normal.push(i[2]),e.normal.push(i[(u-1)*3]),e.normal.push(i[(u-1)*3+1]),e.normal.push(i[(u-1)*3+2]),e.normal.push(i[u*3]),e.normal.push(i[u*3+1]),e.normal.push(i[u*3+2])),t.uv&&t.uv.forEach(function(p,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][(u-1)*2]),e.uvs[g].push(r[g][(u-1)*2+1]),e.uvs[g].push(r[g][u*2]),e.uvs[g].push(r[g][u*2+1])})}addMorphTargets(e,t,n,s){if(n.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const i=this;n.forEach(function(o){o.rawTargets.forEach(function(r){const l=me.Objects.Geometry[r.geoID];l!==void 0&&i.genMorphGeometry(e,t,l,s,r.name)})})}genMorphGeometry(e,t,n,s,i){const o=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],r=n.Vertices!==void 0?n.Vertices.a:[],l=n.Indexes!==void 0?n.Indexes.a:[],f=e.attributes.position.count*3,d=new Float32Array(f);for(let x=0;x<l.length;x++){const w=l[x]*3;d[w]=r[x*3],d[w+1]=r[x*3+1],d[w+2]=r[x*3+2]}const u={vertexIndices:o,vertexPositions:d},p=this.genBuffers(u),g=new c.Float32BufferAttribute(p.vertex,3);g.name=i||n.attrName,g.applyMatrix4(s),e.morphAttributes.position.push(g)}parseNormals(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=e.Normals.a;let i=[];return n==="IndexToDirect"&&("NormalIndex"in e?i=e.NormalIndex.a:"NormalsIndex"in e&&(i=e.NormalsIndex.a)),{dataSize:3,buffer:s,indices:i,mappingType:t,referenceType:n}}parseUVs(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=e.UV.a;let i=[];return n==="IndexToDirect"&&(i=e.UVIndex.a),{dataSize:2,buffer:s,indices:i,mappingType:t,referenceType:n}}parseVertexColors(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,s=e.Colors.a;let i=[];return n==="IndexToDirect"&&(i=e.ColorIndex.a),{dataSize:4,buffer:s,indices:i,mappingType:t,referenceType:n}}parseMaterialIndices(e){const t=e.MappingInformationType,n=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const s=e.Materials.a,i=[];for(let o=0;o<s.length;++o)i.push(o);return{dataSize:1,buffer:s,indices:i,mappingType:t,referenceType:n}}parseNurbsGeometry(e){if(xs===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 n=t-1,s=e.KnotVector.a,i=[],o=e.Points.a;for(let u=0,p=o.length;u<p;u+=4)i.push(new c.Vector4().fromArray(o,u));let r,l;if(e.Form==="Closed")i.push(i[0]);else if(e.Form==="Periodic"){r=n,l=s.length-1-r;for(let u=0;u<n;++u)i.push(i[u])}const d=new xs(n,s,i,r,l).getPoints(i.length*12);return new c.BufferGeometry().setFromPoints(d)}}class qo{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const n in t){const s=t[n],i=this.addClip(s);e.push(i)}return e}parseClips(){if(me.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=me.Objects.AnimationCurveNode,t=new Map;for(const n in e){const s=e[n];if(s.attrName.match(/S|R|T|DeformPercent/)!==null){const i={id:s.id,attr:s.attrName,curves:{}};t.set(i.id,i)}}return t}parseAnimationCurves(e){const t=me.Objects.AnimationCurve;for(const n in t){const s={id:t[n].id,times:t[n].KeyTime.a.map(tr),values:t[n].KeyValueFloat.a},i=Se.get(s.id);if(i!==void 0){const o=i.parents[0].ID,r=i.parents[0].relationship;r.match(/X/)?e.get(o).curves.x=s:r.match(/Y/)?e.get(o).curves.y=s:r.match(/Z/)?e.get(o).curves.z=s:r.match(/d|DeformPercent/)&&e.has(o)&&(e.get(o).curves.morph=s)}}}parseAnimationLayers(e){const t=me.Objects.AnimationLayer,n=new Map;for(const s in t){const i=[],o=Se.get(parseInt(s));o!==void 0&&(o.children.forEach(function(l,f){if(e.has(l.ID)){const d=e.get(l.ID);if(d.curves.x!==void 0||d.curves.y!==void 0||d.curves.z!==void 0){if(i[f]===void 0){const u=Se.get(l.ID).parents.filter(function(p){return p.relationship!==void 0})[0].ID;if(u!==void 0){const p=me.Objects.Model[u.toString()];if(p===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",l);return}const g={modelName:p.attrName?c.PropertyBinding.sanitizeNodeName(p.attrName):"",ID:p.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Fe.traverse(function(x){x.ID===p.id&&(g.transform=x.matrix,x.userData.transformData&&(g.eulerOrder=x.userData.transformData.eulerOrder))}),g.transform||(g.transform=new c.Matrix4),"PreRotation"in p&&(g.preRotation=p.PreRotation.value),"PostRotation"in p&&(g.postRotation=p.PostRotation.value),i[f]=g}}i[f]&&(i[f][d.attr]=d)}else if(d.curves.morph!==void 0){if(i[f]===void 0){const u=Se.get(l.ID).parents.filter(function(M){return M.relationship!==void 0})[0].ID,p=Se.get(u).parents[0].ID,g=Se.get(p).parents[0].ID,x=Se.get(g).parents[0].ID,w=me.Objects.Model[x],_={modelName:w.attrName?c.PropertyBinding.sanitizeNodeName(w.attrName):"",morphName:me.Objects.Deformer[u].attrName};i[f]=_}i[f][d.attr]=d}}}),n.set(parseInt(s),i))}return n}parseAnimStacks(e){const t=me.Objects.AnimationStack,n={};for(const s in t){const i=Se.get(parseInt(s)).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);n[s]={name:t[s].attrName,layer:o}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(s){t=t.concat(n.generateTracks(s))}),new c.AnimationClip(e.name,-1,t)}generateTracks(e){const t=[];let n=new c.Vector3,s=new c.Quaternion,i=new c.Vector3;if(e.transform&&e.transform.decompose(n,s,i),n=n.toArray(),s=new c.Euler().setFromQuaternion(s,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,n,"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,s,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,n,s){const i=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(i,t,n);return new c.VectorKeyframeTrack(e+"."+s,i,o)}generateRotationTrack(e,t,n,s,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),l=this.getKeyframeTrackValues(r,t,n);s!==void 0&&(s=s.map(c.MathUtils.degToRad),s.push(o),s=new c.Euler().fromArray(s),s=new c.Quaternion().setFromEuler(s)),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 f=new c.Quaternion,d=new c.Euler,u=[];for(let p=0;p<l.length;p+=3)d.set(l[p],l[p+1],l[p+2],o),f.setFromEuler(d),s!==void 0&&f.premultiply(s),i!==void 0&&f.multiply(i),f.toArray(u,p/3*4);return new c.QuaternionKeyframeTrack(e+".quaternion",r,u)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,n=t.values.map(function(i){return i/100}),s=Fe.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new c.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+s+"]",t.times,n)}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(n,s){return n-s}),t.length>1){let n=1,s=t[0];for(let i=1;i<t.length;i++){const o=t[i];o!==s&&(t[n]=o,s=o,n++)}t=t.slice(0,n)}return t}getKeyframeTrackValues(e,t,n){const s=n,i=[];let o=-1,r=-1,l=-1;return e.forEach(function(f){if(t.x&&(o=t.x.times.indexOf(f)),t.y&&(r=t.y.times.indexOf(f)),t.z&&(l=t.z.times.indexOf(f)),o!==-1){const d=t.x.values[o];i.push(d),s[0]=d}else i.push(s[0]);if(r!==-1){const d=t.y.values[r];i.push(d),s[1]=d}else i.push(s[1]);if(l!==-1){const d=t.z.values[l];i.push(d),s[2]=d}else i.push(s[2])}),i}interpolateRotations(e){for(let t=1;t<e.values.length;t++){const n=e.values[t-1],s=e.values[t]-n,i=Math.abs(s);if(i>=180){const o=i/180,r=s/o;let l=n+r;const f=e.times[t-1],u=(e.times[t]-f)/o;let p=f+u;const g=[],x=[];for(;p<e.times[t];)g.push(p),p+=u,x.push(l),l+=r;e.times=Cs(e.times,t,g),e.values=Cs(e.values,t,x)}}}}class Jo{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 bs,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,n=e.split(/[\r\n]+/);return n.forEach(function(s,i){const o=s.match(/^[\s\t]*;/),r=s.match(/^[\s\t]*$/);if(o||r)return;const l=s.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),f=s.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),d=s.match("^\\t{"+(t.currentIndent-1)+"}}");l?t.parseNodeBegin(s,l):f?t.parseNodeProperty(s,f,n[++i]):d?t.popStack():s.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(s)}),this.allNodes}parseNodeBegin(e,t){const n=t[1].trim().replace(/^"/,"").replace(/"$/,""),s=t[2].split(",").map(function(l){return l.trim().replace(/^"/,"").replace(/"$/,"")}),i={name:n},o=this.parseNodeAttr(s),r=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,i):n in r?(n==="PoseNode"?r.PoseNode.push(i):r[n].id!==void 0&&(r[n]={},r[n][r[n].id]=r[n]),o.id!==""&&(r[n][o.id]=i)):typeof o.id=="number"?(r[n]={},r[n][o.id]=i):n!=="Properties70"&&(n==="PoseNode"?r[n]=[i]:r[n]=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 n="",s="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),s=e[2]),{id:t,name:n,type:s}}parseNodeProperty(e,t,n){let s=t[1].replace(/^"/,"").replace(/"$/,"").trim(),i=t[2].replace(/^"/,"").replace(/"$/,"").trim();s==="Content"&&i===","&&(i=n.replace(/"/g,"").replace(/,$/,"").trim());const o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(e,s,i);return}if(s==="C"){const l=i.split(",").slice(1),f=parseInt(l[0]),d=parseInt(l[1]);let u=i.split(",").slice(3);u=u.map(function(p){return p.trim().replace(/^"/,"")}),s="connections",i=[f,d],sr(i,u),o[s]===void 0&&(o[s]=[])}s==="Node"&&(o.id=i),s in o&&Array.isArray(o[s])?o[s].push(i):s!=="a"?o[s]=i:o.a=i,this.setCurrentProp(o,s),s==="a"&&i.slice(-1)!==","&&(o.a=Pn(i))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Pn(t.a))}parseNodeSpecialProperty(e,t,n){const s=n.split('",').map(function(d){return d.trim().replace(/^\"/,"").replace(/\s/,"_")}),i=s[0],o=s[1],r=s[2],l=s[3];let f=s[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":f=parseFloat(f);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":f=Pn(f);break}this.getPrevNode()[i]={type:o,type2:r,flag:l,value:f},this.setCurrentProp(this.getPrevNode(),i)}}class Ho{parse(e){const t=new ws(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const s=new bs;for(;!this.endOfContent(t);){const i=this.parseNode(t,n);i!==null&&s.add(i.name,i)}return s}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},s=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(s===0)return null;const l=[];for(let p=0;p<i;p++)l.push(this.parseProperty(e));const f=l.length>0?l[0]:"",d=l.length>1?l[1]:"",u=l.length>2?l[2]:"";for(n.singleProperty=i===1&&e.getOffset()===s;s>e.getOffset();){const p=this.parseNode(e,t);p!==null&&this.parseSubNode(r,n,p)}return n.propertyList=l,typeof f=="number"&&(n.id=f),d!==""&&(n.attrName=d),u!==""&&(n.attrType=u),r!==""&&(n.name=r),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const s=n.propertyList[0];Array.isArray(s)?(t[n.name]=n,n.a=s):t[n.name]=s}else if(e==="Connections"&&n.name==="C"){const s=[];n.propertyList.forEach(function(i,o){o!==0&&s.push(i)}),t.connections===void 0&&(t.connections=[]),t.connections.push(s)}else if(n.name==="Properties70")Object.keys(n).forEach(function(i){t[i]=n[i]});else if(e==="Properties70"&&n.name==="P"){let s=n.propertyList[0],i=n.propertyList[1];const o=n.propertyList[2],r=n.propertyList[3];let l;s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),i==="Color"||i==="ColorRGB"||i==="Vector"||i==="Vector3D"||i.indexOf("Lcl_")===0?l=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:l=n.propertyList[4],t[s]={type:i,type2:o,flag:r,value:l}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;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 n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const s=e.getUint32(),i=e.getUint32(),o=e.getUint32();if(i===0)switch(t){case"b":case"c":return e.getBooleanArray(s);case"d":return e.getFloat64Array(s);case"f":return e.getFloat32Array(s);case"i":return e.getInt32Array(s);case"l":return e.getInt64Array(s)}const r=Ri(new Uint8Array(e.getArrayBuffer(o))),l=new ws(r.buffer);switch(t){case"b":case"c":return l.getBooleanArray(s);case"d":return l.getFloat64Array(s);case"f":return l.getFloat32Array(s);case"i":return l.getInt32Array(s);case"l":return l.getInt64Array(s)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class ws{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 n=0;n<e;n++)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 n=0;n<e;n++)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 n=0;n<e;n++)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 n=0;n<e;n++)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 n=0;n<e;n++)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 s=0;s<e;s++)t[s]=this.getUint8();const n=t.indexOf(0);return n>=0&&(t=t.slice(0,n)),c.LoaderUtils.decodeText(new Uint8Array(t))}}class bs{add(e,t){this[e]=t}}function $o(a){const e="Kaydara FBX Binary \0";return a.byteLength>=e.length&&e===Ps(a,0,e.length)}function er(a){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(s){const i=a[s-1];return a=a.slice(t+s),t++,i}for(let s=0;s<e.length;++s)if(n(1)===e[s])return!1;return!0}function As(a){const e=/FBXVersion: (\d+)/,t=a.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function tr(a){return a/46186158e3}const nr=[];function Wt(a,e,t,n){let s;switch(n.mappingType){case"ByPolygonVertex":s=a;break;case"ByPolygon":s=e;break;case"ByVertice":s=t;break;case"AllSame":s=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}n.referenceType==="IndexToDirect"&&(s=n.indices[s]);const i=s*n.dataSize,o=i+n.dataSize;return ir(nr,n.buffer,i,o)}const Sn=new c.Euler,wt=new c.Vector3;function Ms(a){const e=new c.Matrix4,t=new c.Matrix4,n=new c.Matrix4,s=new c.Matrix4,i=new c.Matrix4,o=new c.Matrix4,r=new c.Matrix4,l=new c.Matrix4,f=new c.Matrix4,d=new c.Matrix4,u=new c.Matrix4,p=new c.Matrix4,g=a.inheritType?a.inheritType:0;if(a.translation&&e.setPosition(wt.fromArray(a.translation)),a.preRotation){const k=a.preRotation.map(c.MathUtils.degToRad);k.push(a.eulerOrder),t.makeRotationFromEuler(Sn.fromArray(k))}if(a.rotation){const k=a.rotation.map(c.MathUtils.degToRad);k.push(a.eulerOrder),n.makeRotationFromEuler(Sn.fromArray(k))}if(a.postRotation){const k=a.postRotation.map(c.MathUtils.degToRad);k.push(a.eulerOrder),s.makeRotationFromEuler(Sn.fromArray(k)),s.invert()}a.scale&&i.scale(wt.fromArray(a.scale)),a.scalingOffset&&r.setPosition(wt.fromArray(a.scalingOffset)),a.scalingPivot&&o.setPosition(wt.fromArray(a.scalingPivot)),a.rotationOffset&&l.setPosition(wt.fromArray(a.rotationOffset)),a.rotationPivot&&f.setPosition(wt.fromArray(a.rotationPivot)),a.parentMatrixWorld&&(u.copy(a.parentMatrix),d.copy(a.parentMatrixWorld));const x=t.clone().multiply(n).multiply(s),w=new c.Matrix4;w.extractRotation(d);const _=new c.Matrix4;_.copyPosition(d);const M=_.clone().invert().multiply(d),L=w.clone().invert().multiply(M),v=i,y=new c.Matrix4;if(g===0)y.copy(w).multiply(x).multiply(L).multiply(v);else if(g===1)y.copy(w).multiply(L).multiply(x).multiply(v);else{const V=new c.Matrix4().scale(new c.Vector3().setFromMatrixScale(u)).clone().invert(),R=L.clone().multiply(V);y.copy(w).multiply(x).multiply(R).multiply(v)}const A=f.clone().invert(),S=o.clone().invert();let b=e.clone().multiply(l).multiply(f).multiply(t).multiply(n).multiply(s).multiply(A).multiply(r).multiply(o).multiply(i).multiply(S);const P=new c.Matrix4().copyPosition(b),O=d.clone().multiply(P);return p.copyPosition(O),b=p.clone().multiply(y),b.premultiply(d.invert()),b}function Ss(a){a=a||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return a===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[a]}function Pn(a){return a.split(",").map(function(t){return parseFloat(t)})}function Ps(a,e,t){return e===void 0&&(e=0),t===void 0&&(t=a.byteLength),c.LoaderUtils.decodeText(new Uint8Array(a,e,t))}function sr(a,e){for(let t=0,n=a.length,s=e.length;t<s;t++,n++)a[n]=e[t]}function ir(a,e,t,n){for(let s=t,i=0;s<n;s++,i++)a[i]=e[s];return a}function Cs(a,e,t){return a.slice(0,e).concat(t).concat(a.slice(e))}var or=Object.defineProperty,rr=(a,e,t)=>e in a?or(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,Cn=(a,e,t)=>(rr(a,typeof e!="symbol"?e+"":e,t),t);class ar extends c.Loader{constructor(e){super(e)}load(e,t,n,s){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),l=this.parse(r);t&&t(l)},n,s)}loadAsync(e,t){return super.loadAsync(e,t)}parse(e){return new Ln(e)}}class Ln{constructor(e){Cn(this,"data"),this.data=e}generateShapes(e,t=100,n){const s=[],i={letterSpacing:0,lineHeight:1,...n},o=lr(e,t,this.data,i);for(let r=0,l=o.length;r<l;r++)Array.prototype.push.apply(s,o[r].toShapes(!1));return s}}Cn(Ln,"isFont"),Cn(Ln,"type");function lr(a,e,t,n){const s=Array.from(a),i=e/t.resolution,o=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*i,r=[];let l=0,f=0;for(let d=0;d<s.length;d++){const u=s[d];if(u===`
|
|
74
|
-
`)l=0,f-=
|
|
75
|
-
`,
|
|
76
|
-
`;
|
|
77
|
-
`,
|
|
78
|
-
`;continue}if((V=k.match(A))&&(O.gamma=parseFloat(V[1])),(V=k.match(S))&&(O.exposure=parseFloat(V[1])),(V=k.match(b))&&(O.valid|=2,O.format=V[1]),(V=k.match(P))&&(O.valid|=4,O.height=parseInt(V[1],10),O.width=parseInt(V[2],10)),O.valid&2&&O.valid&4)break}return O.valid&2?O.valid&4?O:r(3,"missing image size specifier"):r(3,"missing format specifier")},x=function(v,y,A){const S=y;if(S<8||S>32767||v[0]!==2||v[1]!==2||v[2]&128)return new Uint8Array(v);if(S!==(v[2]<<8|v[3]))return r(3,"wrong scanline width");const b=new Uint8Array(4*y*A);if(!b.length)return r(4,"unable to allocate buffer space");let P=0,O=0;const k=4*S,V=new Uint8Array(4),R=new Uint8Array(k);let X=A;for(;X>0&&O<v.byteLength;){if(O+4>v.byteLength)return r(1);if(V[0]=v[O++],V[1]=v[O++],V[2]=v[O++],V[3]=v[O++],V[0]!=2||V[1]!=2||(V[2]<<8|V[3])!=S)return r(3,"bad rgbe scanline format");let K=0,H;for(;K<k&&O<v.byteLength;){H=v[O++];const J=H>128;if(J&&(H-=128),H===0||K+H>k)return r(3,"bad scanline data");if(J){const G=v[O++];for(let oe=0;oe<H;oe++)R[K++]=G}else R.set(v.subarray(O,O+H),K),K+=H,O+=H}const he=S;for(let J=0;J<he;J++){let G=0;b[P]=R[J+G],G+=S,b[P+1]=R[J+G],G+=S,b[P+2]=R[J+G],G+=S,b[P+3]=R[J+G],P+=4}X--}return b},w=function(v,y,A,S){const b=v[y+3],P=Math.pow(2,b-128)/255;A[S+0]=v[y+0]*P,A[S+1]=v[y+1]*P,A[S+2]=v[y+2]*P,A[S+3]=1},_=function(v,y,A,S){const b=v[y+3],P=Math.pow(2,b-128)/255;A[S+0]=c.DataUtils.toHalfFloat(Math.min(v[y+0]*P,65504)),A[S+1]=c.DataUtils.toHalfFloat(Math.min(v[y+1]*P,65504)),A[S+2]=c.DataUtils.toHalfFloat(Math.min(v[y+2]*P,65504)),A[S+3]=c.DataUtils.toHalfFloat(1)},M=new Uint8Array(e);M.pos=0;const L=g(M);if(L!==-1){const v=L.width,y=L.height,A=x(M.subarray(M.pos),v,y);if(A!==-1){let S,b,P;switch(this.type){case c.FloatType:P=A.length/4;const O=new Float32Array(P*4);for(let V=0;V<P;V++)w(A,V*4,O,V*4);S=O,b=c.FloatType;break;case c.HalfFloatType:P=A.length/4;const k=new Uint16Array(P*4);for(let V=0;V<P;V++)_(A,V*4,k,V*4);S=k,b=c.HalfFloatType;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type);break}return{width:v,height:y,data:S,header:L.string,gamma:L.gamma,exposure:L.exposure,type:b}}}return null}setDataType(e){return this.type=e,this}load(e,t,n,s){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,n,s)}}class Dt extends c.Loader{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit="px"}load(e,t,n,s){const i=this,o=new c.FileLoader(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,function(r){try{t(i.parse(r))}catch(l){s?s(l):console.error(l),i.manager.itemError(e)}},n,s)}parse(e){const t=this;function n(U,T){if(U.nodeType!==1)return;const m=y(U);let F=!0,j=null;switch(U.nodeName){case"svg":break;case"style":i(U);break;case"g":T=x(U,T);break;case"path":T=x(U,T),U.hasAttribute("d")&&(j=s(U));break;case"rect":T=x(U,T),j=l(U);break;case"polygon":T=x(U,T),j=f(U);break;case"polyline":T=x(U,T),j=d(U);break;case"circle":T=x(U,T),j=u(U);break;case"ellipse":T=x(U,T),j=p(U);break;case"line":T=x(U,T),j=g(U);break;case"defs":F=!1;break;case"mask":F=!1;break;case"use":T=x(U,T);const D=U.href.baseVal.substring(1),E=U.viewportElement.getElementById(D);E?n(E,T):console.warn("SVGLoader: 'use node' references non-existent node id: "+D);break}if(j&&(T.fill!==void 0&&T.fill!=="none"&&j.color.setStyle(T.fill),S(j,oe),k.push(j),j.userData={node:U,style:T}),F){const D=U.childNodes;for(let E=0;E<D.length;E++)n(D[E],T)}m&&(R.pop(),R.length>0?oe.copy(R[R.length-1]):oe.identity())}function s(U){const T=new c.ShapePath,m=new c.Vector2,F=new c.Vector2,j=new c.Vector2;let D=!0,E=!1;const Y=U.getAttribute("d").match(/[a-df-z][^a-df-z]*/gi);for(let $=0,Z=Y.length;$<Z;$++){const fe=Y[$],Q=fe.charAt(0),ee=fe.substr(1).trim();D===!0&&(E=!0,D=!1);let I;switch(Q){case"M":I=_(ee);for(let C=0,te=I.length;C<te;C+=2)m.x=I[C+0],m.y=I[C+1],F.x=m.x,F.y=m.y,C===0?T.moveTo(m.x,m.y):T.lineTo(m.x,m.y),C===0&&j.copy(m);break;case"H":I=_(ee);for(let C=0,te=I.length;C<te;C++)m.x=I[C],F.x=m.x,F.y=m.y,T.lineTo(m.x,m.y),C===0&&E===!0&&j.copy(m);break;case"V":I=_(ee);for(let C=0,te=I.length;C<te;C++)m.y=I[C],F.x=m.x,F.y=m.y,T.lineTo(m.x,m.y),C===0&&E===!0&&j.copy(m);break;case"L":I=_(ee);for(let C=0,te=I.length;C<te;C+=2)m.x=I[C+0],m.y=I[C+1],F.x=m.x,F.y=m.y,T.lineTo(m.x,m.y),C===0&&E===!0&&j.copy(m);break;case"C":I=_(ee);for(let C=0,te=I.length;C<te;C+=6)T.bezierCurveTo(I[C+0],I[C+1],I[C+2],I[C+3],I[C+4],I[C+5]),F.x=I[C+2],F.y=I[C+3],m.x=I[C+4],m.y=I[C+5],C===0&&E===!0&&j.copy(m);break;case"S":I=_(ee);for(let C=0,te=I.length;C<te;C+=4)T.bezierCurveTo(w(m.x,F.x),w(m.y,F.y),I[C+0],I[C+1],I[C+2],I[C+3]),F.x=I[C+0],F.y=I[C+1],m.x=I[C+2],m.y=I[C+3],C===0&&E===!0&&j.copy(m);break;case"Q":I=_(ee);for(let C=0,te=I.length;C<te;C+=4)T.quadraticCurveTo(I[C+0],I[C+1],I[C+2],I[C+3]),F.x=I[C+0],F.y=I[C+1],m.x=I[C+2],m.y=I[C+3],C===0&&E===!0&&j.copy(m);break;case"T":I=_(ee);for(let C=0,te=I.length;C<te;C+=2){const pe=w(m.x,F.x),we=w(m.y,F.y);T.quadraticCurveTo(pe,we,I[C+0],I[C+1]),F.x=pe,F.y=we,m.x=I[C+0],m.y=I[C+1],C===0&&E===!0&&j.copy(m)}break;case"A":I=_(ee,[3,4],7);for(let C=0,te=I.length;C<te;C+=7){if(I[C+5]==m.x&&I[C+6]==m.y)continue;const pe=m.clone();m.x=I[C+5],m.y=I[C+6],F.x=m.x,F.y=m.y,o(T,I[C],I[C+1],I[C+2],I[C+3],I[C+4],pe,m),C===0&&E===!0&&j.copy(m)}break;case"m":I=_(ee);for(let C=0,te=I.length;C<te;C+=2)m.x+=I[C+0],m.y+=I[C+1],F.x=m.x,F.y=m.y,C===0?T.moveTo(m.x,m.y):T.lineTo(m.x,m.y),C===0&&j.copy(m);break;case"h":I=_(ee);for(let C=0,te=I.length;C<te;C++)m.x+=I[C],F.x=m.x,F.y=m.y,T.lineTo(m.x,m.y),C===0&&E===!0&&j.copy(m);break;case"v":I=_(ee);for(let C=0,te=I.length;C<te;C++)m.y+=I[C],F.x=m.x,F.y=m.y,T.lineTo(m.x,m.y),C===0&&E===!0&&j.copy(m);break;case"l":I=_(ee);for(let C=0,te=I.length;C<te;C+=2)m.x+=I[C+0],m.y+=I[C+1],F.x=m.x,F.y=m.y,T.lineTo(m.x,m.y),C===0&&E===!0&&j.copy(m);break;case"c":I=_(ee);for(let C=0,te=I.length;C<te;C+=6)T.bezierCurveTo(m.x+I[C+0],m.y+I[C+1],m.x+I[C+2],m.y+I[C+3],m.x+I[C+4],m.y+I[C+5]),F.x=m.x+I[C+2],F.y=m.y+I[C+3],m.x+=I[C+4],m.y+=I[C+5],C===0&&E===!0&&j.copy(m);break;case"s":I=_(ee);for(let C=0,te=I.length;C<te;C+=4)T.bezierCurveTo(w(m.x,F.x),w(m.y,F.y),m.x+I[C+0],m.y+I[C+1],m.x+I[C+2],m.y+I[C+3]),F.x=m.x+I[C+0],F.y=m.y+I[C+1],m.x+=I[C+2],m.y+=I[C+3],C===0&&E===!0&&j.copy(m);break;case"q":I=_(ee);for(let C=0,te=I.length;C<te;C+=4)T.quadraticCurveTo(m.x+I[C+0],m.y+I[C+1],m.x+I[C+2],m.y+I[C+3]),F.x=m.x+I[C+0],F.y=m.y+I[C+1],m.x+=I[C+2],m.y+=I[C+3],C===0&&E===!0&&j.copy(m);break;case"t":I=_(ee);for(let C=0,te=I.length;C<te;C+=2){const pe=w(m.x,F.x),we=w(m.y,F.y);T.quadraticCurveTo(pe,we,m.x+I[C+0],m.y+I[C+1]),F.x=pe,F.y=we,m.x=m.x+I[C+0],m.y=m.y+I[C+1],C===0&&E===!0&&j.copy(m)}break;case"a":I=_(ee,[3,4],7);for(let C=0,te=I.length;C<te;C+=7){if(I[C+5]==0&&I[C+6]==0)continue;const pe=m.clone();m.x+=I[C+5],m.y+=I[C+6],F.x=m.x,F.y=m.y,o(T,I[C],I[C+1],I[C+2],I[C+3],I[C+4],pe,m),C===0&&E===!0&&j.copy(m)}break;case"Z":case"z":T.currentPath.autoClose=!0,T.currentPath.curves.length>0&&(m.copy(j),T.currentPath.currentPoint.copy(m),D=!0);break;default:console.warn(fe)}E=!1}return T}function i(U){if(!(!U.sheet||!U.sheet.cssRules||!U.sheet.cssRules.length))for(let T=0;T<U.sheet.cssRules.length;T++){const m=U.sheet.cssRules[T];if(m.type!==1)continue;const F=m.selectorText.split(/,/gm).filter(Boolean).map(j=>j.trim());for(let j=0;j<F.length;j++)V[F[j]]=Object.assign(V[F[j]]||{},m.style)}}function o(U,T,m,F,j,D,E,ie){if(T==0||m==0){U.lineTo(ie.x,ie.y);return}F=F*Math.PI/180,T=Math.abs(T),m=Math.abs(m);const Y=(E.x-ie.x)/2,$=(E.y-ie.y)/2,Z=Math.cos(F)*Y+Math.sin(F)*$,fe=-Math.sin(F)*Y+Math.cos(F)*$;let Q=T*T,ee=m*m;const I=Z*Z,C=fe*fe,te=I/Q+C/ee;if(te>1){const Ct=Math.sqrt(te);T=Ct*T,m=Ct*m,Q=T*T,ee=m*m}const pe=Q*C+ee*I,we=(Q*ee-pe)/pe;let Pe=Math.sqrt(Math.max(0,we));j===D&&(Pe=-Pe);const ke=Pe*T*fe/m,Xe=-Pe*m*Z/T,Pt=Math.cos(F)*ke-Math.sin(F)*Xe+(E.x+ie.x)/2,jt=Math.sin(F)*ke+Math.cos(F)*Xe+(E.y+ie.y)/2,Ge=r(1,0,(Z-ke)/T,(fe-Xe)/m),un=r((Z-ke)/T,(fe-Xe)/m,(-Z-ke)/T,(-fe-Xe)/m)%(Math.PI*2);U.currentPath.absellipse(Pt,jt,T,m,Ge,Ge+un,D===0,F)}function r(U,T,m,F){const j=U*m+T*F,D=Math.sqrt(U*U+T*T)*Math.sqrt(m*m+F*F);let E=Math.acos(Math.max(-1,Math.min(1,j/D)));return U*F-T*m<0&&(E=-E),E}function l(U){const T=v(U.getAttribute("x")||0),m=v(U.getAttribute("y")||0),F=v(U.getAttribute("rx")||U.getAttribute("ry")||0),j=v(U.getAttribute("ry")||U.getAttribute("rx")||0),D=v(U.getAttribute("width")),E=v(U.getAttribute("height")),ie=1-.551915024494,Y=new c.ShapePath;return Y.moveTo(T+F,m),Y.lineTo(T+D-F,m),(F!==0||j!==0)&&Y.bezierCurveTo(T+D-F*ie,m,T+D,m+j*ie,T+D,m+j),Y.lineTo(T+D,m+E-j),(F!==0||j!==0)&&Y.bezierCurveTo(T+D,m+E-j*ie,T+D-F*ie,m+E,T+D-F,m+E),Y.lineTo(T+F,m+E),(F!==0||j!==0)&&Y.bezierCurveTo(T+F*ie,m+E,T,m+E-j*ie,T,m+E-j),Y.lineTo(T,m+j),(F!==0||j!==0)&&Y.bezierCurveTo(T,m+j*ie,T+F*ie,m,T+F,m),Y}function f(U){function T(D,E,ie){const Y=v(E),$=v(ie);j===0?F.moveTo(Y,$):F.lineTo(Y,$),j++}const m=/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,F=new c.ShapePath;let j=0;return U.getAttribute("points").replace(m,T),F.currentPath.autoClose=!0,F}function d(U){function T(D,E,ie){const Y=v(E),$=v(ie);j===0?F.moveTo(Y,$):F.lineTo(Y,$),j++}const m=/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,F=new c.ShapePath;let j=0;return U.getAttribute("points").replace(m,T),F.currentPath.autoClose=!1,F}function u(U){const T=v(U.getAttribute("cx")||0),m=v(U.getAttribute("cy")||0),F=v(U.getAttribute("r")||0),j=new c.Path;j.absarc(T,m,F,0,Math.PI*2);const D=new c.ShapePath;return D.subPaths.push(j),D}function p(U){const T=v(U.getAttribute("cx")||0),m=v(U.getAttribute("cy")||0),F=v(U.getAttribute("rx")||0),j=v(U.getAttribute("ry")||0),D=new c.Path;D.absellipse(T,m,F,j,0,Math.PI*2);const E=new c.ShapePath;return E.subPaths.push(D),E}function g(U){const T=v(U.getAttribute("x1")||0),m=v(U.getAttribute("y1")||0),F=v(U.getAttribute("x2")||0),j=v(U.getAttribute("y2")||0),D=new c.ShapePath;return D.moveTo(T,m),D.lineTo(F,j),D.currentPath.autoClose=!1,D}function x(U,T){T=Object.assign({},T);let m={};if(U.hasAttribute("class")){const E=U.getAttribute("class").split(/\s/).filter(Boolean).map(ie=>ie.trim());for(let ie=0;ie<E.length;ie++)m=Object.assign(m,V["."+E[ie]])}U.hasAttribute("id")&&(m=Object.assign(m,V["#"+U.getAttribute("id")]));function F(E,ie,Y){Y===void 0&&(Y=function(Z){return Z.startsWith("url")&&console.warn("SVGLoader: url access in attributes is not implemented."),Z}),U.hasAttribute(E)&&(T[ie]=Y(U.getAttribute(E))),m[E]&&(T[ie]=Y(m[E])),U.style&&U.style[E]!==""&&(T[ie]=Y(U.style[E]))}function j(E){return Math.max(0,Math.min(1,v(E)))}function D(E){return Math.max(0,v(E))}return F("fill","fill"),F("fill-opacity","fillOpacity",j),F("fill-rule","fillRule"),F("opacity","opacity",j),F("stroke","stroke"),F("stroke-opacity","strokeOpacity",j),F("stroke-width","strokeWidth",D),F("stroke-linejoin","strokeLineJoin"),F("stroke-linecap","strokeLineCap"),F("stroke-miterlimit","strokeMiterLimit",D),F("visibility","visibility"),T}function w(U,T){return U-(T-U)}function _(U,T,m){if(typeof U!="string")throw new TypeError("Invalid input: "+typeof U);const F={SEPARATOR:/[ \t\r\n\,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},j=0,D=1,E=2,ie=3;let Y=j,$=!0,Z="",fe="";const Q=[];function ee(pe,we,Pe){const ke=new SyntaxError('Unexpected character "'+pe+'" at index '+we+".");throw ke.partial=Pe,ke}function I(){Z!==""&&(fe===""?Q.push(Number(Z)):Q.push(Number(Z)*Math.pow(10,Number(fe)))),Z="",fe=""}let C;const te=U.length;for(let pe=0;pe<te;pe++){if(C=U[pe],Array.isArray(T)&&T.includes(Q.length%m)&&F.FLAGS.test(C)){Y=D,Z=C,I();continue}if(Y===j){if(F.WHITESPACE.test(C))continue;if(F.DIGIT.test(C)||F.SIGN.test(C)){Y=D,Z=C;continue}if(F.POINT.test(C)){Y=E,Z=C;continue}F.COMMA.test(C)&&($&&ee(C,pe,Q),$=!0)}if(Y===D){if(F.DIGIT.test(C)){Z+=C;continue}if(F.POINT.test(C)){Z+=C,Y=E;continue}if(F.EXP.test(C)){Y=ie;continue}F.SIGN.test(C)&&Z.length===1&&F.SIGN.test(Z[0])&&ee(C,pe,Q)}if(Y===E){if(F.DIGIT.test(C)){Z+=C;continue}if(F.EXP.test(C)){Y=ie;continue}F.POINT.test(C)&&Z[Z.length-1]==="."&&ee(C,pe,Q)}if(Y===ie){if(F.DIGIT.test(C)){fe+=C;continue}if(F.SIGN.test(C)){if(fe===""){fe+=C;continue}fe.length===1&&F.SIGN.test(fe)&&ee(C,pe,Q)}}F.WHITESPACE.test(C)?(I(),Y=j,$=!1):F.COMMA.test(C)?(I(),Y=j,$=!0):F.SIGN.test(C)?(I(),Y=D,Z=C):F.POINT.test(C)?(I(),Y=E,Z=C):ee(C,pe,Q)}return I(),Q}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 v(U){let T="px";if(typeof U=="string"||U instanceof String)for(let F=0,j=M.length;F<j;F++){const D=M[F];if(U.endsWith(D)){T=D,U=U.substring(0,U.length-D.length);break}}let m;return T==="px"&&t.defaultUnit!=="px"?m=L.in[t.defaultUnit]/t.defaultDPI:(m=L[T][t.defaultUnit],m<0&&(m=L[T].in*t.defaultDPI)),m*parseFloat(U)}function y(U){if(!(U.hasAttribute("transform")||U.nodeName==="use"&&(U.hasAttribute("x")||U.hasAttribute("y"))))return null;const T=A(U);return R.length>0&&T.premultiply(R[R.length-1]),oe.copy(T),R.push(T),T}function A(U){const T=new c.Matrix3,m=X;if(U.nodeName==="use"&&(U.hasAttribute("x")||U.hasAttribute("y"))){const F=v(U.getAttribute("x")),j=v(U.getAttribute("y"));T.translate(F,j)}if(U.hasAttribute("transform")){const F=U.getAttribute("transform").split(")");for(let j=F.length-1;j>=0;j--){const D=F[j].trim();if(D==="")continue;const E=D.indexOf("("),ie=D.length;if(E>0&&E<ie){const Y=D.substr(0,E),$=_(D.substr(E+1,ie-E-1));switch(m.identity(),Y){case"translate":if($.length>=1){const Z=$[0];let fe=Z;$.length>=2&&(fe=$[1]),m.translate(Z,fe)}break;case"rotate":if($.length>=1){let Z=0,fe=0,Q=0;Z=-$[0]*Math.PI/180,$.length>=3&&(fe=$[1],Q=$[2]),K.identity().translate(-fe,-Q),H.identity().rotate(Z),he.multiplyMatrices(H,K),K.identity().translate(fe,Q),m.multiplyMatrices(K,he)}break;case"scale":if($.length>=1){const Z=$[0];let fe=Z;$.length>=2&&(fe=$[1]),m.scale(Z,fe)}break;case"skewX":$.length===1&&m.set(1,Math.tan($[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":$.length===1&&m.set(1,0,0,Math.tan($[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":$.length===6&&m.set($[0],$[2],$[4],$[1],$[3],$[5],0,0,1);break}}T.premultiply(m)}}return T}function S(U,T){function m(D){G.set(D.x,D.y,1).applyMatrix3(T),D.set(G.x,G.y)}const F=b(T),j=U.subPaths;for(let D=0,E=j.length;D<E;D++){const Y=j[D].curves;for(let $=0;$<Y.length;$++){const Z=Y[$];Z.isLineCurve?(m(Z.v1),m(Z.v2)):Z.isCubicBezierCurve?(m(Z.v0),m(Z.v1),m(Z.v2),m(Z.v3)):Z.isQuadraticBezierCurve?(m(Z.v0),m(Z.v1),m(Z.v2)):Z.isEllipseCurve&&(F&&console.warn("SVGLoader: Elliptic arc or ellipse rotation or skewing is not implemented."),J.set(Z.aX,Z.aY),m(J),Z.aX=J.x,Z.aY=J.y,Z.xRadius*=P(T),Z.yRadius*=O(T))}}}function b(U){return U.elements[1]!==0||U.elements[3]!==0}function P(U){const T=U.elements;return Math.sqrt(T[0]*T[0]+T[1]*T[1])}function O(U){const T=U.elements;return Math.sqrt(T[3]*T[3]+T[4]*T[4])}const k=[],V={},R=[],X=new c.Matrix3,K=new c.Matrix3,H=new c.Matrix3,he=new c.Matrix3,J=new c.Vector2,G=new c.Vector3,oe=new c.Matrix3,se=new DOMParser().parseFromString(e,"image/svg+xml");return n(se.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4}),{paths:k,xml:se.documentElement}}static createShapes(e){const n={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},s={loc:n.ORIGIN,t:0};function i(_,M,L,v){const y=_.x,A=M.x,S=L.x,b=v.x,P=_.y,O=M.y,k=L.y,V=v.y,R=(b-S)*(P-k)-(V-k)*(y-S),X=(A-y)*(P-k)-(O-P)*(y-S),K=(V-k)*(A-y)-(b-S)*(O-P),H=R/K,he=X/K;if(K===0&&R!==0||H<=0||H>=1||he<0||he>1)return null;if(R===0&&K===0){for(let J=0;J<2;J++)if(o(J===0?L:v,_,M),s.loc==n.ORIGIN){const G=J===0?L:v;return{x:G.x,y:G.y,t:s.t}}else if(s.loc==n.BETWEEN){const G=+(y+s.t*(A-y)).toPrecision(10),oe=+(P+s.t*(O-P)).toPrecision(10);return{x:G,y:oe,t:s.t}}return null}else{for(let oe=0;oe<2;oe++)if(o(oe===0?L:v,_,M),s.loc==n.ORIGIN){const se=oe===0?L:v;return{x:se.x,y:se.y,t:s.t}}const J=+(y+H*(A-y)).toPrecision(10),G=+(P+H*(O-P)).toPrecision(10);return{x:J,y:G,t:H}}}function o(_,M,L){const v=L.x-M.x,y=L.y-M.y,A=_.x-M.x,S=_.y-M.y,b=v*S-A*y;if(_.x===M.x&&_.y===M.y){s.loc=n.ORIGIN,s.t=0;return}if(_.x===L.x&&_.y===L.y){s.loc=n.DESTINATION,s.t=1;return}if(b<-Number.EPSILON){s.loc=n.LEFT;return}if(b>Number.EPSILON){s.loc=n.RIGHT;return}if(v*A<0||y*S<0){s.loc=n.BEHIND;return}if(Math.sqrt(v*v+y*y)<Math.sqrt(A*A+S*S)){s.loc=n.BEYOND;return}let P;v!==0?P=A/v:P=S/y,s.loc=n.BETWEEN,s.t=P}function r(_,M){const L=[],v=[];for(let y=1;y<_.length;y++){const A=_[y-1],S=_[y];for(let b=1;b<M.length;b++){const P=M[b-1],O=M[b],k=i(A,S,P,O);k!==null&&L.find(V=>V.t<=k.t+Number.EPSILON&&V.t>=k.t-Number.EPSILON)===void 0&&(L.push(k),v.push(new c.Vector2(k.x,k.y)))}}return v}function l(_,M,L){const v=new c.Vector2;M.getCenter(v);const y=[];return L.forEach(A=>{A.boundingBox.containsPoint(v)&&r(_,A.points).forEach(b=>{y.push({identifier:A.identifier,isCW:A.isCW,point:b})})}),y.sort((A,S)=>A.point.x-S.point.x),y}function f(_,M,L,v,y){(y==null||y==="")&&(y="nonzero");const A=new c.Vector2;_.boundingBox.getCenter(A);const S=[new c.Vector2(L,A.y),new c.Vector2(v,A.y)],b=l(S,_.boundingBox,M);b.sort((X,K)=>X.point.x-K.point.x);const P=[],O=[];b.forEach(X=>{X.identifier===_.identifier?P.push(X):O.push(X)});const k=P[0].point.x,V=[];let R=0;for(;R<O.length&&O[R].point.x<k;)V.length>0&&V[V.length-1]===O[R].identifier?V.pop():V.push(O[R].identifier),R++;if(V.push(_.identifier),y==="evenodd"){const X=V.length%2===0,K=V[V.length-2];return{identifier:_.identifier,isHole:X,for:K}}else if(y==="nonzero"){let X=!0,K=null,H=null;for(let he=0;he<V.length;he++){const J=V[he];X?(H=M[J].isCW,X=!1,K=J):H!==M[J].isCW&&(H=M[J].isCW,X=!0)}return{identifier:_.identifier,isHole:X,for:K}}else console.warn('fill-rule: "'+y+'" is currently not implemented.')}let d=0,u=999999999,p=-999999999,g=e.subPaths.map(_=>{const M=_.getPoints();let L=-999999999,v=999999999,y=-999999999,A=999999999;for(let S=0;S<M.length;S++){const b=M[S];b.y>L&&(L=b.y),b.y<v&&(v=b.y),b.x>y&&(y=b.x),b.x<A&&(A=b.x)}return p<=y&&(p=y+1),u>=A&&(u=A-1),{curves:_.curves,points:M,isCW:c.ShapeUtils.isClockWise(M),identifier:d++,boundingBox:new c.Box2(new c.Vector2(A,v),new c.Vector2(y,L))}});g=g.filter(_=>_.points.length>1);const x=g.map(_=>f(_,g,u,p,e.userData.style.fillRule)),w=[];return g.forEach(_=>{if(!x[_.identifier].isHole){const L=new c.Shape;L.curves=_.curves,x.filter(y=>y.isHole&&y.for===_.identifier).forEach(y=>{const A=g[y.identifier],S=new c.Path;S.curves=A.curves,L.holes.push(S)}),w.push(L)}}),w}static getStrokeStyle(e,t,n,s,i){return e=e!==void 0?e:1,t=t!==void 0?t:"#000",n=n!==void 0?n:"miter",s=s!==void 0?s:"butt",i=i!==void 0?i:4,{strokeColor:t,strokeWidth:e,strokeLineJoin:n,strokeLineCap:s,strokeMiterLimit:i}}static pointsToStroke(e,t,n,s){const i=[],o=[],r=[];if(Dt.pointsToStrokeWithBuffers(e,t,n,s,i,o,r)===0)return null;const l=new c.BufferGeometry;return l.setAttribute("position",new c.Float32BufferAttribute(i,3)),l.setAttribute("normal",new c.Float32BufferAttribute(o,3)),l.setAttribute("uv",new c.Float32BufferAttribute(r,2)),l}static pointsToStrokeWithBuffers(e,t,n,s,i,o,r,l){const f=new c.Vector2,d=new c.Vector2,u=new c.Vector2,p=new c.Vector2,g=new c.Vector2,x=new c.Vector2,w=new c.Vector2,_=new c.Vector2,M=new c.Vector2,L=new c.Vector2,v=new c.Vector2,y=new c.Vector2,A=new c.Vector2,S=new c.Vector2,b=new c.Vector2,P=new c.Vector2,O=new c.Vector2;n=n!==void 0?n:12,s=s!==void 0?s:.001,l=l!==void 0?l:0,e=fe(e);const k=e.length;if(k<2)return 0;const V=e[0].equals(e[k-1]);let R,X=e[0],K;const H=t.strokeWidth/2,he=1/(k-1);let J=0,G,oe,se,ce,U=!1,T=0,m=l*3,F=l*2;j(e[0],e[1],f).multiplyScalar(H),_.copy(e[0]).sub(f),M.copy(e[0]).add(f),L.copy(_),v.copy(M);for(let Q=1;Q<k;Q++){R=e[Q],Q===k-1?V?K=e[1]:K=void 0:K=e[Q+1];const ee=f;if(j(X,R,ee),u.copy(ee).multiplyScalar(H),y.copy(R).sub(u),A.copy(R).add(u),G=J+he,oe=!1,K!==void 0){j(R,K,d),u.copy(d).multiplyScalar(H),S.copy(R).sub(u),b.copy(R).add(u),se=!0,u.subVectors(K,X),ee.dot(u)<0&&(se=!1),Q===1&&(U=se),u.subVectors(K,R),u.normalize();const I=Math.abs(ee.dot(u));if(I!==0){const C=H/I;u.multiplyScalar(-C),p.subVectors(R,X),g.copy(p).setLength(C).add(u),P.copy(g).negate();const te=g.length(),pe=p.length();p.divideScalar(pe),x.subVectors(K,R);const we=x.length();switch(x.divideScalar(we),p.dot(P)<pe&&x.dot(P)<we&&(oe=!0),O.copy(g).add(R),P.add(R),ce=!1,oe?se?(b.copy(P),A.copy(P)):(S.copy(P),y.copy(P)):ie(),t.strokeLineJoin){case"bevel":Y(se,oe,G);break;case"round":$(se,oe),se?E(R,y,S,G,0):E(R,b,A,G,1);break;case"miter":case"miter-clip":default:const Pe=H*t.strokeMiterLimit/te;if(Pe<1)if(t.strokeLineJoin!=="miter-clip"){Y(se,oe,G);break}else $(se,oe),se?(x.subVectors(O,y).multiplyScalar(Pe).add(y),w.subVectors(O,S).multiplyScalar(Pe).add(S),D(y,G,0),D(x,G,0),D(R,G,.5),D(R,G,.5),D(x,G,0),D(w,G,0),D(R,G,.5),D(w,G,0),D(S,G,0)):(x.subVectors(O,A).multiplyScalar(Pe).add(A),w.subVectors(O,b).multiplyScalar(Pe).add(b),D(A,G,1),D(x,G,1),D(R,G,.5),D(R,G,.5),D(x,G,1),D(w,G,1),D(R,G,.5),D(w,G,1),D(b,G,1));else oe?(se?(D(M,J,1),D(_,J,0),D(O,G,0),D(M,J,1),D(O,G,0),D(P,G,1)):(D(M,J,1),D(_,J,0),D(O,G,1),D(_,J,0),D(P,G,0),D(O,G,1)),se?S.copy(O):b.copy(O)):se?(D(y,G,0),D(O,G,0),D(R,G,.5),D(R,G,.5),D(O,G,0),D(S,G,0)):(D(A,G,1),D(O,G,1),D(R,G,.5),D(R,G,.5),D(O,G,1),D(b,G,1)),ce=!0;break}}else ie()}else ie();!V&&Q===k-1&&Z(e[0],L,v,se,!0,J),J=G,X=R,_.copy(S),M.copy(b)}if(!V)Z(R,y,A,se,!1,G);else if(oe&&i){let Q=O,ee=P;U!==se&&(Q=P,ee=O),se?(ce||U)&&(ee.toArray(i,0*3),ee.toArray(i,3*3),ce&&Q.toArray(i,1*3)):(ce||!U)&&(ee.toArray(i,1*3),ee.toArray(i,3*3),ce&&Q.toArray(i,0*3))}return T;function j(Q,ee,I){return I.subVectors(ee,Q),I.set(-I.y,I.x).normalize()}function D(Q,ee,I){i&&(i[m]=Q.x,i[m+1]=Q.y,i[m+2]=0,o&&(o[m]=0,o[m+1]=0,o[m+2]=1),m+=3,r&&(r[F]=ee,r[F+1]=I,F+=2)),T+=3}function E(Q,ee,I,C,te){f.copy(ee).sub(Q).normalize(),d.copy(I).sub(Q).normalize();let pe=Math.PI;const we=f.dot(d);Math.abs(we)<1&&(pe=Math.abs(Math.acos(we))),pe/=n,u.copy(ee);for(let Pe=0,ke=n-1;Pe<ke;Pe++)p.copy(u).rotateAround(Q,pe),D(u,C,te),D(p,C,te),D(Q,C,.5),u.copy(p);D(p,C,te),D(I,C,te),D(Q,C,.5)}function ie(){D(M,J,1),D(_,J,0),D(y,G,0),D(M,J,1),D(y,G,1),D(A,G,0)}function Y(Q,ee,I){ee?Q?(D(M,J,1),D(_,J,0),D(y,G,0),D(M,J,1),D(y,G,0),D(P,G,1),D(y,I,0),D(S,I,0),D(P,I,.5)):(D(M,J,1),D(_,J,0),D(A,G,1),D(_,J,0),D(P,G,0),D(A,G,1),D(A,I,1),D(b,I,0),D(P,I,.5)):Q?(D(y,I,0),D(S,I,0),D(R,I,.5)):(D(A,I,1),D(b,I,0),D(R,I,.5))}function $(Q,ee){ee&&(Q?(D(M,J,1),D(_,J,0),D(y,G,0),D(M,J,1),D(y,G,0),D(P,G,1),D(y,J,0),D(R,G,.5),D(P,G,1),D(R,G,.5),D(S,J,0),D(P,G,1)):(D(M,J,1),D(_,J,0),D(A,G,1),D(_,J,0),D(P,G,0),D(A,G,1),D(A,J,1),D(P,G,0),D(R,G,.5),D(R,G,.5),D(P,G,0),D(b,J,1)))}function Z(Q,ee,I,C,te,pe){switch(t.strokeLineCap){case"round":te?E(Q,I,ee,pe,.5):E(Q,ee,I,pe,.5);break;case"square":if(te)f.subVectors(ee,Q),d.set(f.y,-f.x),u.addVectors(f,d).add(Q),p.subVectors(d,f).add(Q),C?(u.toArray(i,1*3),p.toArray(i,0*3),p.toArray(i,3*3)):(u.toArray(i,1*3),u.toArray(i,3*3),p.toArray(i,0*3));else{f.subVectors(I,Q),d.set(f.y,-f.x),u.addVectors(f,d).add(Q),p.subVectors(d,f).add(Q);const we=i.length;C?(u.toArray(i,we-1*3),p.toArray(i,we-2*3),p.toArray(i,we-4*3)):(u.toArray(i,we-2*3),p.toArray(i,we-1*3),p.toArray(i,we-4*3))}break}}function fe(Q){let ee=!1;for(let C=1,te=Q.length-1;C<te;C++)if(Q[C].distanceTo(Q[C+1])<s){ee=!0;break}if(!ee)return Q;const I=[];I.push(Q[0]);for(let C=1,te=Q.length-1;C<te;C++)Q[C].distanceTo(Q[C+1])>=s&&I.push(Q[C]);return I.push(Q[Q.length-1]),I}}}const Tn=new WeakMap;class hr 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,n,s){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(s)},n,s)}decodeDracoFile(e,t,n,s){const i={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,i).then(t)}decodeGeometry(e,t){for(const l in t.attributeTypes){const f=t.attributeTypes[l];f.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=f.name)}const n=JSON.stringify(t);if(Tn.has(e)){const l=Tn.get(e);if(l.key===n)return l.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 s;const i=this.workerNextTaskID++,o=e.byteLength,r=this._getWorker(i,o).then(l=>(s=l,new Promise((f,d)=>{s._callbacks[i]={resolve:f,reject:d},s.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return r.catch(()=>!0).then(()=>{s&&i&&this._releaseTask(s,i)}),Tn.set(e,{key:n,promise:r}),r}_createGeometry(e){const t=new c.BufferGeometry;e.index&&t.setIndex(new c.BufferAttribute(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const s=e.attributes[n],i=s.name,o=s.array,r=s.itemSize;t.setAttribute(i,new c.BufferAttribute(o,r))}return t}_loadLibrary(e,t){const n=new c.FileLoader(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((s,i)=>{n.load(e,s,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(n=>{const s=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const i=ur.toString(),o=["/* draco decoder */",s,"","/* 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 s=new Worker(this.workerSourceURL);s._callbacks={},s._taskCosts={},s._taskLoad=0,s.postMessage({type:"init",decoderConfig:this.decoderConfig}),s.onmessage=function(i){const o=i.data;switch(o.type){case"decode":s._callbacks[o.id].resolve(o);break;case"error":s._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(s)}else this.workerPool.sort(function(s,i){return s._taskLoad>i._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_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 ur(){let a,e;onmessage=function(o){const r=o.data;switch(r.type){case"init":a=r.decoderConfig,e=new Promise(function(d){a.onModuleLoaded=function(u){d({draco:u})},DracoDecoderModule(a)});break;case"decode":const l=r.buffer,f=r.taskConfig;e.then(d=>{const u=d.draco,p=new u.Decoder,g=new u.DecoderBuffer;g.Init(new Int8Array(l),l.byteLength);try{const x=t(u,p,g,f),w=x.attributes.map(_=>_.array.buffer);x.index&&w.push(x.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:x},w)}catch(x){console.error(x),self.postMessage({type:"error",id:r.id,error:x.message})}finally{u.destroy(g),u.destroy(p)}});break}};function t(o,r,l,f){const d=f.attributeIDs,u=f.attributeTypes;let p,g;const x=r.GetEncodedGeometryType(l);if(x===o.TRIANGULAR_MESH)p=new o.Mesh,g=r.DecodeBufferToMesh(l,p);else if(x===o.POINT_CLOUD)p=new o.PointCloud,g=r.DecodeBufferToPointCloud(l,p);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!g.ok()||p.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+g.error_msg());const w={index:null,attributes:[]};for(const _ in d){const M=self[u[_]];let L,v;if(f.useUniqueIDs)v=d[_],L=r.GetAttributeByUniqueId(p,v);else{if(v=r.GetAttributeId(p,o[d[_]]),v===-1)continue;L=r.GetAttribute(p,v)}w.attributes.push(s(o,r,p,_,M,L))}return x===o.TRIANGULAR_MESH&&(w.index=n(o,r,p)),o.destroy(p),w}function n(o,r,l){const d=l.num_faces()*3,u=d*4,p=o._malloc(u);r.GetTrianglesUInt32Array(l,u,p);const g=new Uint32Array(o.HEAPF32.buffer,p,d).slice();return o._free(p),{array:g,itemSize:1}}function s(o,r,l,f,d,u){const p=u.num_components(),x=l.num_points()*p,w=x*d.BYTES_PER_ELEMENT,_=i(o,d),M=o._malloc(w);r.GetAttributeDataArrayForAllPoints(l,u,_,w,M);const L=new d(o.HEAPF32.buffer,M,x).slice();return o._free(M),{name:f,array:L,itemSize:p}}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 dr=["args","center"],fr=h.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(a,{expose:e}){let t,n;const s=a,{center:i,font:o,text:r,needUpdates:l,size:f,height:d,curveSegments:u,bevelEnabled:p,bevelThickness:g,bevelSize:x,bevelOffset:w,bevelSegments:_}=h.toRefs(s),{extend:M}=ne.useTresContext();M({TextGeometry:_s});const L=new ar,v=h.useSlots(),y=h.computed(()=>{var P;return r!=null&&r.value?r.value:v.default?(P=v.default()[0].children)==null?void 0:P.trim():l.value?"":"TresJS"}),A=h.shallowRef();e({value:A});const S=([t,n]=h.withAsyncContext(()=>new Promise((P,O)=>{try{typeof o.value=="string"?L.load(o.value,k=>{P(k)}):P(o.value)}catch(k){O(console.error("cientos",k))}})),t=await t,n(),t),b=h.computed(()=>({font:S,size:h.toValue(f),height:h.toValue(d),curveSegments:h.toValue(u),bevelEnabled:h.toValue(p),bevelThickness:h.toValue(g),bevelSize:h.toValue(x),bevelOffset:h.toValue(w),bevelSegments:h.toValue(_)}));return h.watchEffect(()=>{A.value&&l.value&&(A.value.geometry.dispose(),A.value.geometry=new _s(y.value,b.value),i.value&&A.value.geometry.center())}),(P,O)=>h.unref(o)?(h.openBlock(),h.createElementBlock("TresMesh",{key:0,ref_key:"text3DRef",ref:A},[y.value?(h.openBlock(),h.createElementBlock("TresTextGeometry",{key:0,args:[y.value,b.value],center:h.unref(i)},null,8,dr)):h.createCommentVNode("",!0),h.renderSlot(P.$slots,"default")],512)):h.createCommentVNode("",!0)}});function pr(a,e){const t=h.ref(e),n=new c.AnimationMixer(t.value),s=h.shallowReactive({});a.forEach(o=>{const r=n.clipAction(o,t.value);s[o.name]=r});const{onLoop:i}=ne.useRenderLoop();return i(({delta:o})=>{n.update(o)}),{actions:s,mixer:n}}const mr=h.defineComponent({__name:"Levioso",props:{speed:{default:1},rotationFactor:{default:1},floatFactor:{default:1},range:{default:()=>[-.1,.1]}},setup(a,{expose:e}){const t=a,n=h.shallowRef();e({value:n});{const l=Math.random()*1e4,{onLoop:f}=ne.useRenderLoop();let d=l;f(({delta:u})=>{if(!n.value)return;d+=u*t.speed;const p=d*.25,g=n.value;g.rotation.x=Math.cos(p)*.125*t.rotationFactor,g.rotation.y=Math.sin(p)*.125*t.rotationFactor,g.rotation.z=Math.sin(p)*.05*t.rotationFactor,g.position.y=c.MathUtils.mapLinear(Math.sin(p),-1,1,t.range[0],t.range[1])*t.floatFactor})}return(s,i)=>(h.openBlock(),h.createElementBlock("TresGroup",h.mergeProps(s.$attrs,{ref_key:"groupRef",ref:n}),[h.renderSlot(s.$slots,"default")],16))}});function Ts(a){return h.getCurrentScope()?(h.onScopeDispose(a),!0):!1}function ze(a){return typeof a=="function"?a():h.unref(a)}const gr=typeof window<"u"&&typeof document<"u",yr=Object.prototype.toString,_r=a=>yr.call(a)==="[object Object]",ut=()=>{};function Os(a,e){function t(...n){return new Promise((s,i)=>{Promise.resolve(a(()=>e.apply(this,n),{fn:e,thisArg:this,args:n})).then(s).catch(i)})}return t}function vr(a,e={}){let t,n,s=ut;const i=r=>{clearTimeout(r),s(),s=ut};return r=>{const l=ze(a),f=ze(e.maxWait);return t&&i(t),l<=0||f!==void 0&&f<=0?(n&&(i(n),n=null),Promise.resolve(r())):new Promise((d,u)=>{s=e.rejectOnCancel?u:d,f&&!n&&(n=setTimeout(()=>{t&&i(t),n=null,d(r())},f)),t=setTimeout(()=>{n&&i(n),n=null,d(r())},l)})}}function xr(a,e=!0,t=!0,n=!1){let s=0,i,o=!0,r=ut,l;const f=()=>{i&&(clearTimeout(i),i=void 0,r(),r=ut)};return u=>{const p=ze(a),g=Date.now()-s,x=()=>l=u();return f(),p<=0?(s=Date.now(),x()):(g>p&&(t||!o)?(s=Date.now(),x()):e&&(l=new Promise((w,_)=>{r=n?_:w,i=setTimeout(()=>{s=Date.now(),o=!0,w(x()),f()},Math.max(0,p-g))})),!t&&!i&&(i=setTimeout(()=>o=!0,p)),o=!1,l)}}function wr(a,e=200,t={}){return Os(vr(e,t),a)}function br(a,e=200,t=!1,n=!0,s=!1){return Os(xr(e,t,n,s),a)}function Ar(a,e=!0){h.getCurrentInstance()?h.onMounted(a):e?a():h.nextTick(a)}function Mr(a){var e;const t=ze(a);return(e=t==null?void 0:t.$el)!=null?e:t}const dt=gr?window:void 0;function Ae(...a){let e,t,n,s;if(typeof a[0]=="string"||Array.isArray(a[0])?([t,n,s]=a,e=dt):[e,t,n,s]=a,!e)return ut;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const i=[],o=()=>{i.forEach(d=>d()),i.length=0},r=(d,u,p,g)=>(d.addEventListener(u,p,g),()=>d.removeEventListener(u,p,g)),l=h.watch(()=>[Mr(e),ze(s)],([d,u])=>{if(o(),!d)return;const p=_r(u)?{...u}:u;i.push(...t.flatMap(g=>n.map(x=>r(d,g,x,p))))},{immediate:!0,flush:"post"}),f=()=>{l(),o()};return Ts(f),f}function Sr(a){return typeof a=="function"?a:typeof a=="string"?e=>e.key===a:Array.isArray(a)?e=>a.includes(e.key):()=>!0}function ft(...a){let e,t,n={};a.length===3?(e=a[0],t=a[1],n=a[2]):a.length===2?typeof a[1]=="object"?(e=!0,t=a[0],n=a[1]):(e=a[0],t=a[1]):(e=!0,t=a[0]);const{target:s=dt,eventName:i="keydown",passive:o=!1,dedupe:r=!1}=n,l=Sr(e);return Ae(s,i,d=>{d.repeat&&ze(r)||l(d)&&t(d)},o)}function Pr(){const a=h.ref(!1);return h.getCurrentInstance()&&h.onMounted(()=>{a.value=!0}),a}function Cr(a){const e=Pr();return h.computed(()=>(e.value,!!a()))}function Lr(a,e={}){const{window:t=dt}=e,n=Cr(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function");let s;const i=h.ref(!1),o=f=>{i.value=f.matches},r=()=>{s&&("removeEventListener"in s?s.removeEventListener("change",o):s.removeListener(o))},l=h.watchEffect(()=>{n.value&&(r(),s=t.matchMedia(ze(a)),"addEventListener"in s?s.addEventListener("change",o):s.addListener(o),i.value=s.matches)});return Ts(()=>{l(),r(),s=void 0}),i}const Ds=1;function Tr(a,e={}){const{throttle:t=0,idle:n=200,onStop:s=ut,onScroll:i=ut,offset:o={left:0,right:0,top:0,bottom:0},eventListenerOptions:r={capture:!1,passive:!0},behavior:l="auto",window:f=dt}=e,d=h.ref(0),u=h.ref(0),p=h.computed({get(){return d.value},set(S){x(S,void 0)}}),g=h.computed({get(){return u.value},set(S){x(void 0,S)}});function x(S,b){var P,O,k;if(!f)return;const V=ze(a);V&&((k=V instanceof Document?f.document.body:V)==null||k.scrollTo({top:(P=ze(b))!=null?P:g.value,left:(O=ze(S))!=null?O:p.value,behavior:ze(l)}))}const w=h.ref(!1),_=h.reactive({left:!0,right:!1,top:!0,bottom:!1}),M=h.reactive({left:!1,right:!1,top:!1,bottom:!1}),L=S=>{w.value&&(w.value=!1,M.left=!1,M.right=!1,M.top=!1,M.bottom=!1,s(S))},v=wr(L,t+n),y=S=>{var b;if(!f)return;const P=S.document?S.document.documentElement:(b=S.documentElement)!=null?b:S,{display:O,flexDirection:k}=getComputedStyle(P),V=P.scrollLeft;M.left=V<d.value,M.right=V>d.value;const R=Math.abs(V)<=0+(o.left||0),X=Math.abs(V)+P.clientWidth>=P.scrollWidth-(o.right||0)-Ds;O==="flex"&&k==="row-reverse"?(_.left=X,_.right=R):(_.left=R,_.right=X),d.value=V;let K=P.scrollTop;S===f.document&&!K&&(K=f.document.body.scrollTop),M.top=K<u.value,M.bottom=K>u.value;const H=Math.abs(K)<=0+(o.top||0),he=Math.abs(K)+P.clientHeight>=P.scrollHeight-(o.bottom||0)-Ds;O==="flex"&&k==="column-reverse"?(_.top=he,_.bottom=H):(_.top=H,_.bottom=he),u.value=K},A=S=>{var b;if(!f)return;const P=(b=S.target.documentElement)!=null?b:S.target;y(P),w.value=!0,v(S),i(S)};return Ae(a,"scroll",t?br(A,t,!0,!1):A,r),Ae(a,"scrollend",L,r),{x:p,y:g,isScrolling:w,arrivedState:_,directions:M,measure(){const S=ze(a);f&&S&&y(S)}}}const Or={page:a=>[a.pageX,a.pageY],client:a=>[a.clientX,a.clientY],screen:a=>[a.screenX,a.screenY],movement:a=>a instanceof Touch?null:[a.movementX,a.movementY]};function Dr(a={}){const{type:e="page",touch:t=!0,resetOnTouchEnds:n=!1,initialValue:s={x:0,y:0},window:i=dt,target:o=i,scroll:r=!0,eventFilter:l}=a;let f=null;const d=h.ref(s.x),u=h.ref(s.y),p=h.ref(null),g=typeof e=="function"?e:Or[e],x=A=>{const S=g(A);f=A,S&&([d.value,u.value]=S,p.value="mouse")},w=A=>{if(A.touches.length>0){const S=g(A.touches[0]);S&&([d.value,u.value]=S,p.value="touch")}},_=()=>{if(!f||!i)return;const A=g(f);f instanceof MouseEvent&&A&&(d.value=A[0]+i.scrollX,u.value=A[1]+i.scrollY)},M=()=>{d.value=s.x,u.value=s.y},L=l?A=>l(()=>x(A),{}):A=>x(A),v=l?A=>l(()=>w(A),{}):A=>w(A),y=l?()=>l(()=>_(),{}):()=>_();if(o){const A={passive:!0};Ae(o,["mousemove","dragover"],L,A),t&&e!=="movement"&&(Ae(o,["touchstart","touchmove"],v,A),n&&Ae(o,"touchend",M,A)),r&&e==="page"&&Ae(i,"scroll",y,{passive:!0})}return{x:d,y:u,sourceType:p}}function Ir(a={}){const{window:e=dt}=a;if(!e)return{x:h.ref(0),y:h.ref(0)};const t=h.ref(e.scrollX),n=h.ref(e.scrollY);return Ae(e,"scroll",()=>{t.value=e.scrollX,n.value=e.scrollY},{capture:!1,passive:!0}),{x:t,y:n}}function Is(a={}){const{window:e=dt,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:n=Number.POSITIVE_INFINITY,listenOrientation:s=!0,includeScrollbar:i=!0}=a,o=h.ref(t),r=h.ref(n),l=()=>{e&&(i?(o.value=e.innerWidth,r.value=e.innerHeight):(o.value=e.document.documentElement.clientWidth,r.value=e.document.documentElement.clientHeight))};if(l(),Ar(l),Ae("resize",l,{passive:!0}),s){const f=Lr("(orientation: portrait)");h.watch(f,()=>l())}return{width:o,height:r}}const kr=h.defineComponent({__name:"MouseParallax",props:{disabled:{type:Boolean,default:!1},factor:{default:2.5},ease:{default:.1}},setup(a){const e=a,{camera:t}=ne.useTresContext(),{disabled:n,factor:s,ease:i}=h.toRefs(e),{x:o,y:r}=Dr(),{width:l,height:f}=Is(),d=h.ref(),u=h.computed(()=>(o.value/l.value-.5)*s.value),p=h.computed(()=>-(r.value/f.value-.5)*s.value),{onLoop:g}=ne.useRenderLoop();return g(({delta:x})=>{n.value||!d.value||(d.value.position.x+=(u.value-d.value.position.x)*i.value*x,d.value.position.y+=(p.value-d.value.position.y)*i.value*x)}),h.watch(()=>d.value,x=>x==null?void 0:x.add(t.value)),(x,w)=>(h.openBlock(),h.createElementBlock("TresGroup",{ref_key:"cameraGroupRef",ref:d},null,512))}}),Fr=h.defineComponent({name:"GlobalAudio",props:["src","loop","volume","playbackRate","playTrigger","stopTrigger"],async setup(a,{expose:e,emit:t}){var u;const{camera:n,renderer:s}=ne.useTresContext(),i=new c.AudioListener;(u=n.value)==null||u.add(i);const o=new c.Audio(i),r=new c.AudioLoader;e({sound:o}),h.onUnmounted(()=>{o&&o.disconnect()}),h.watch(()=>[a.playbackRate],()=>o.setPlaybackRate(a.playbackRate??1),{immediate:!0}),h.watch(()=>[a.volume],()=>o.setVolume(a.volume??.5),{immediate:!0}),h.watch(()=>[a.loop],()=>o.setLoop(a.loop??!1),{immediate:!0}),h.watch(()=>[a.src],async()=>{const p=await r.loadAsync(a.src);o.setBuffer(p)},{immediate:!0});const l=document.getElementById(a.playTrigger??""),f=l||s.value.domElement;Ae(f,"click",()=>{o.isPlaying?o.pause():o.play(),t("isPlaying",o.isPlaying)});const d=document.getElementById(a.stopTrigger??"");return d&&Ae(d,"click",()=>{o.stop(),t("isPlaying",o.isPlaying)}),null}});class It extends c.Mesh{constructor(){super(It.Geometry,new c.MeshBasicMaterial({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const e=new c.Vector3,t=new c.Vector3,n=new c.FramebufferTexture(16,16),s=new c.FramebufferTexture(16,16),i=It.Geometry,o=new c.RawShaderMaterial({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:`
|
|
73
|
+
`};function Xi(o,e,t){const n=t.length-o-1;if(e>=t[n])return n-1;if(e<=t[o])return o;let i=o,r=n,s=Math.floor((i+r)/2);for(;e<t[s]||e>=t[s+1];)e<t[s]?r=s:i=s,s=Math.floor((i+r)/2);return s}function Bo(o,e,t,n){const i=[],r=[],s=[];i[0]=1;for(let a=1;a<=t;++a){r[a]=e-n[o+1-a],s[a]=n[o+a]-e;let l=0;for(let f=0;f<a;++f){const u=s[f+1],d=r[a-f],m=i[f]/(u+d);i[f]=l+u*m,l=d*m}i[a]=l}return i}function Uo(o,e,t,n){const i=Xi(o,n,e),r=Bo(i,n,o,e),s=new c.Vector4(0,0,0,0);for(let a=0;a<=o;++a){const l=t[i-o+a],f=r[a],u=l.w*f;s.x+=l.x*u,s.y+=l.y*u,s.z+=l.z*u,s.w+=l.w*f}return s}function No(o,e,t,n,i){const r=[];for(let d=0;d<=t;++d)r[d]=0;const s=[];for(let d=0;d<=n;++d)s[d]=r.slice(0);const a=[];for(let d=0;d<=t;++d)a[d]=r.slice(0);a[0][0]=1;const l=r.slice(0),f=r.slice(0);for(let d=1;d<=t;++d){l[d]=e-i[o+1-d],f[d]=i[o+d]-e;let m=0;for(let y=0;y<d;++y){const b=f[y+1],A=l[d-y];a[d][y]=b+A;const _=a[y][d-1]/a[d][y];a[y][d]=m+b*_,m=A*_}a[d][d]=m}for(let d=0;d<=t;++d)s[0][d]=a[d][t];for(let d=0;d<=t;++d){let m=0,y=1;const b=[];for(let A=0;A<=t;++A)b[A]=r.slice(0);b[0][0]=1;for(let A=1;A<=n;++A){let _=0;const L=d-A,I=t-A;d>=A&&(b[y][0]=b[m][0]/a[I+1][L],_=b[y][0]*a[L][I]);const S=L>=-1?1:-L,g=d-1<=I?A-1:t-d;for(let x=S;x<=g;++x)b[y][x]=(b[m][x]-b[m][x-1])/a[I+1][L+x],_+=b[y][x]*a[L+x][I];d<=I&&(b[y][A]=-b[m][A-1]/a[I+1][d],_+=b[y][A]*a[d][I]),s[A][d]=_;const O=m;m=y,y=O}}let u=t;for(let d=1;d<=n;++d){for(let m=0;m<=t;++m)s[d][m]*=u;u*=t-d}return s}function Vo(o,e,t,n,i){const r=i<o?i:o,s=[],a=Xi(o,n,e),l=No(a,n,o,r,e),f=[];for(let u=0;u<t.length;++u){const d=t[u].clone(),m=d.w;d.x*=m,d.y*=m,d.z*=m,f[u]=d}for(let u=0;u<=r;++u){const d=f[a-o].clone().multiplyScalar(l[u][0]);for(let m=1;m<=o;++m)d.add(f[a-o+m].clone().multiplyScalar(l[u][m]));s[u]=d}for(let u=r+1;u<=i+1;++u)s[u]=new c.Vector4(0,0,0);return s}function zo(o,e){let t=1;for(let i=2;i<=o;++i)t*=i;let n=1;for(let i=2;i<=e;++i)n*=i;for(let i=2;i<=o-e;++i)n*=i;return t/n}function jo(o){const e=o.length,t=[],n=[];for(let r=0;r<e;++r){const s=o[r];t[r]=new c.Vector3(s.x,s.y,s.z),n[r]=s.w}const i=[];for(let r=0;r<e;++r){const s=t[r].clone();for(let a=1;a<=r;++a)s.sub(i[r-a].clone().multiplyScalar(zo(r,a)*n[a]));i[r]=s.divideScalar(n[0])}return i}function Go(o,e,t,n,i){const r=Vo(o,e,t,n,i);return jo(r)}class Wi extends c.Curve{constructor(e,t,n,i,r){super(),this.degree=e,this.knots=t,this.controlPoints=[],this.startKnot=i||0,this.endKnot=r||this.knots.length-1;for(let s=0;s<n.length;++s){const a=n[s];this.controlPoints[s]=new c.Vector4(a.x,a.y,a.z,a.w)}}getPoint(e,t){const n=t||new c.Vector3,i=this.knots[this.startKnot]+e*(this.knots[this.endKnot]-this.knots[this.startKnot]),r=Uo(this.degree,this.knots,this.controlPoints,i);return r.w!=1&&r.divideScalar(r.w),n.set(r.x,r.y,r.z)}getTangent(e,t){const n=t||new c.Vector3,i=this.knots[0]+e*(this.knots[this.knots.length-1]-this.knots[0]),r=Go(this.degree,this.knots,this.controlPoints,i,1);return n.copy(r[1]).normalize(),n}}let ve,Te,Ve;class Ro extends c.Loader{constructor(e){super(e)}load(e,t,n,i){const r=this,s=r.path===""?c.LoaderUtils.extractUrlBase(e):r.path,a=new c.FileLoader(this.manager);a.setPath(r.path),a.setResponseType("arraybuffer"),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,function(l){try{t(r.parse(l,s))}catch(f){i?i(f):console.error(f),r.manager.itemError(e)}},n,i)}parse(e,t){if(qo(e))ve=new Zo().parse(e);else{const i=Hi(e);if(!Ko(i))throw new Error("THREE.FBXLoader: Unknown format.");if(Ki(i)<7e3)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+Ki(i));ve=new Wo().parse(i)}const n=new c.TextureLoader(this.manager).setPath(this.resourcePath||t).setCrossOrigin(this.crossOrigin);return new Eo(n,this.manager).parse(ve)}}class Eo{constructor(e,t){this.textureLoader=e,this.manager=t}parse(){Te=this.parseConnections();const e=this.parseImages(),t=this.parseTextures(e),n=this.parseMaterials(t),i=this.parseDeformers(),r=new Yo().parse(i);return this.parseScene(i,r,n),Ve}parseConnections(){const e=new Map;return"Connections"in ve&&ve.Connections.connections.forEach(function(n){const i=n[0],r=n[1],s=n[2];e.has(i)||e.set(i,{parents:[],children:[]});const a={ID:r,relationship:s};e.get(i).parents.push(a),e.has(r)||e.set(r,{parents:[],children:[]});const l={ID:i,relationship:s};e.get(r).children.push(l)}),e}parseImages(){const e={},t={};if("Video"in ve.Objects){const n=ve.Objects.Video;for(const i in n){const r=n[i],s=parseInt(i);if(e[s]=r.RelativeFilename||r.Filename,"Content"in r){const a=r.Content instanceof ArrayBuffer&&r.Content.byteLength>0,l=typeof r.Content=="string"&&r.Content!=="";if(a||l){const f=this.parseImage(n[i]);t[r.RelativeFilename||r.Filename]=f}}}}for(const n in e){const i=e[n];t[i]!==void 0?e[n]=t[i]:e[n]=e[n].split("\\").pop()}return e}parseImage(e){const t=e.Content,n=e.RelativeFilename||e.Filename,i=n.slice(n.lastIndexOf(".")+1).toLowerCase();let r;switch(i){case"bmp":r="image/bmp";break;case"jpg":case"jpeg":r="image/jpeg";break;case"png":r="image/png";break;case"tif":r="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",n),r="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if(typeof t=="string")return"data:"+r+";base64,"+t;{const s=new Uint8Array(t);return window.URL.createObjectURL(new Blob([s],{type:r}))}}parseTextures(e){const t=new Map;if("Texture"in ve.Objects){const n=ve.Objects.Texture;for(const i in n){const r=this.parseTexture(n[i],e);t.set(parseInt(i),r)}}return t}parseTexture(e,t){const n=this.loadTexture(e,t);n.ID=e.id,n.name=e.attrName;const i=e.WrapModeU,r=e.WrapModeV,s=i!==void 0?i.value:0,a=r!==void 0?r.value:0;if(n.wrapS=s===0?c.RepeatWrapping:c.ClampToEdgeWrapping,n.wrapT=a===0?c.RepeatWrapping:c.ClampToEdgeWrapping,"Scaling"in e){const l=e.Scaling.value;n.repeat.x=l[0],n.repeat.y=l[1]}return n}loadTexture(e,t){let n;const i=this.textureLoader.path,r=Te.get(e.id).children;r!==void 0&&r.length>0&&t[r[0].ID]!==void 0&&(n=t[r[0].ID],(n.indexOf("blob:")===0||n.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let s;const a=e.FileName.slice(-3).toLowerCase();if(a==="tga"){const l=this.manager.getHandler(".tga");l===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),s=new c.Texture):(l.setPath(this.textureLoader.path),s=l.load(n))}else a==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),s=new c.Texture):s=this.textureLoader.load(n);return this.textureLoader.setPath(i),s}parseMaterials(e){const t=new Map;if("Material"in ve.Objects){const n=ve.Objects.Material;for(const i in n){const r=this.parseMaterial(n[i],e);r!==null&&t.set(parseInt(i),r)}}return t}parseMaterial(e,t){const n=e.id,i=e.attrName;let r=e.ShadingModel;if(typeof r=="object"&&(r=r.value),!Te.has(n))return null;const s=this.parseParameters(e,t,n);let a;switch(r.toLowerCase()){case"phong":a=new c.MeshPhongMaterial;break;case"lambert":a=new c.MeshLambertMaterial;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',r),a=new c.MeshPhongMaterial;break}return a.setValues(s),a.name=i,a}parseParameters(e,t,n){const i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=new c.Color().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=new c.Color().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=new c.Color().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=new c.Color().fromArray(e.EmissiveColor.value)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=new c.Color().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=new c.Color().fromArray(e.SpecularColor.value));const r=this;return Te.get(n).children.forEach(function(s){const a=s.relationship;switch(a){case"Bump":i.bumpMap=r.getTexture(t,s.ID);break;case"Maya|TEX_ao_map":i.aoMap=r.getTexture(t,s.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=r.getTexture(t,s.ID),i.map!==void 0&&("colorSpace"in i.map?i.map.colorSpace="srgb":i.map.encoding=3001);break;case"DisplacementColor":i.displacementMap=r.getTexture(t,s.ID);break;case"EmissiveColor":i.emissiveMap=r.getTexture(t,s.ID),i.emissiveMap!==void 0&&("colorSpace"in i.emissiveMap?i.emissiveMap.colorSpace="srgb":i.emissiveMap.encoding=3001);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=r.getTexture(t,s.ID);break;case"ReflectionColor":i.envMap=r.getTexture(t,s.ID),i.envMap!==void 0&&(i.envMap.mapping=c.EquirectangularReflectionMapping,"colorSpace"in i.envMap?i.envMap.colorSpace="srgb":i.envMap.encoding=3001);break;case"SpecularColor":i.specularMap=r.getTexture(t,s.ID),i.specularMap!==void 0&&("colorSpace"in i.specularMap?i.specularMap.colorSpace="srgb":i.specularMap.encoding=3001);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=r.getTexture(t,s.ID),i.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.",a);break}}),i}getTexture(e,t){return"LayeredTexture"in ve.Objects&&t in ve.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Te.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in ve.Objects){const n=ve.Objects.Deformer;for(const i in n){const r=n[i],s=Te.get(parseInt(i));if(r.attrType==="Skin"){const a=this.parseSkeleton(s,n);a.ID=i,s.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=s.parents[0].ID,e[i]=a}else if(r.attrType==="BlendShape"){const a={id:i};a.rawTargets=this.parseMorphTargets(s,n),a.id=i,s.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=a}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const n=[];return e.children.forEach(function(i){const r=t[i.ID];if(r.attrType!=="Cluster")return;const s={ID:i.ID,indices:[],weights:[],transformLink:new c.Matrix4().fromArray(r.TransformLink.a)};"Indexes"in r&&(s.indices=r.Indexes.a,s.weights=r.Weights.a),n.push(s)}),{rawBones:n,bones:[]}}parseMorphTargets(e,t){const n=[];for(let i=0;i<e.children.length;i++){const r=e.children[i],s=t[r.ID],a={name:s.attrName,initialWeight:s.DeformPercent,id:s.id,fullWeights:s.FullWeights.a};if(s.attrType!=="BlendShapeChannel")return;a.geoID=Te.get(parseInt(r.ID)).children.filter(function(l){return l.relationship===void 0})[0].ID,n.push(a)}return n}parseScene(e,t,n){Ve=new c.Group;const i=this.parseModels(e.skeletons,t,n),r=ve.Objects.Model,s=this;i.forEach(function(l){const f=r[l.ID];s.setLookAtProperties(l,f),Te.get(l.ID).parents.forEach(function(d){const m=i.get(d.ID);m!==void 0&&m.add(l)}),l.parent===null&&Ve.add(l)}),this.bindSkeleton(e.skeletons,t,i),this.createAmbientLight(),Ve.traverse(function(l){if(l.userData.transformData){l.parent&&(l.userData.transformData.parentMatrix=l.parent.matrix,l.userData.transformData.parentMatrixWorld=l.parent.matrixWorld);const f=Qi(l.userData.transformData);l.applyMatrix4(f),l.updateWorldMatrix()}});const a=new Xo().parse();Ve.children.length===1&&Ve.children[0].isGroup&&(Ve.children[0].animations=a,Ve=Ve.children[0]),Ve.animations=a}parseModels(e,t,n){const i=new Map,r=ve.Objects.Model;for(const s in r){const a=parseInt(s),l=r[s],f=Te.get(a);let u=this.buildSkeleton(f,e,a,l.attrName);if(!u){switch(l.attrType){case"Camera":u=this.createCamera(f);break;case"Light":u=this.createLight(f);break;case"Mesh":u=this.createMesh(f,t,n);break;case"NurbsCurve":u=this.createCurve(f,t);break;case"LimbNode":case"Root":u=new c.Bone;break;case"Null":default:u=new c.Group;break}u.name=l.attrName?c.PropertyBinding.sanitizeNodeName(l.attrName):"",u.ID=a}this.getTransformData(u,l),i.set(a,u)}return i}buildSkeleton(e,t,n,i){let r=null;return e.parents.forEach(function(s){for(const a in t){const l=t[a];l.rawBones.forEach(function(f,u){if(f.ID===s.ID){const d=r;r=new c.Bone,r.matrixWorld.copy(f.transformLink),r.name=i?c.PropertyBinding.sanitizeNodeName(i):"",r.ID=n,l.bones[u]=r,d!==null&&r.add(d)}})}}),r}createCamera(e){let t,n;if(e.children.forEach(function(i){const r=ve.Objects.NodeAttribute[i.ID];r!==void 0&&(n=r)}),n===void 0)t=new c.Object3D;else{let i=0;n.CameraProjectionType!==void 0&&n.CameraProjectionType.value===1&&(i=1);let r=1;n.NearPlane!==void 0&&(r=n.NearPlane.value/1e3);let s=1e3;n.FarPlane!==void 0&&(s=n.FarPlane.value/1e3);let a=window.innerWidth,l=window.innerHeight;n.AspectWidth!==void 0&&n.AspectHeight!==void 0&&(a=n.AspectWidth.value,l=n.AspectHeight.value);const f=a/l;let u=45;n.FieldOfView!==void 0&&(u=n.FieldOfView.value);const d=n.FocalLength?n.FocalLength.value:null;switch(i){case 0:t=new c.PerspectiveCamera(u,f,r,s),d!==null&&t.setFocalLength(d);break;case 1:t=new c.OrthographicCamera(-a/2,a/2,l/2,-l/2,r,s);break;default:console.warn("THREE.FBXLoader: Unknown camera type "+i+"."),t=new c.Object3D;break}}return t}createLight(e){let t,n;if(e.children.forEach(function(i){const r=ve.Objects.NodeAttribute[i.ID];r!==void 0&&(n=r)}),n===void 0)t=new c.Object3D;else{let i;n.LightType===void 0?i=0:i=n.LightType.value;let r=16777215;n.Color!==void 0&&(r=new c.Color().fromArray(n.Color.value));let s=n.Intensity===void 0?1:n.Intensity.value/100;n.CastLightOnObject!==void 0&&n.CastLightOnObject.value===0&&(s=0);let a=0;n.FarAttenuationEnd!==void 0&&(n.EnableFarAttenuation!==void 0&&n.EnableFarAttenuation.value===0?a=0:a=n.FarAttenuationEnd.value);const l=1;switch(i){case 0:t=new c.PointLight(r,s,a,l);break;case 1:t=new c.DirectionalLight(r,s);break;case 2:let f=Math.PI/3;n.InnerAngle!==void 0&&(f=c.MathUtils.degToRad(n.InnerAngle.value));let u=0;n.OuterAngle!==void 0&&(u=c.MathUtils.degToRad(n.OuterAngle.value),u=Math.max(u,1)),t=new c.SpotLight(r,s,a,f,u,l);break;default:console.warn("THREE.FBXLoader: Unknown light type "+n.LightType.value+", defaulting to a PointLight."),t=new c.PointLight(r,s);break}n.CastShadows!==void 0&&n.CastShadows.value===1&&(t.castShadow=!0)}return t}createMesh(e,t,n){let i,r=null,s=null;const a=[];return e.children.forEach(function(l){t.has(l.ID)&&(r=t.get(l.ID)),n.has(l.ID)&&a.push(n.get(l.ID))}),a.length>1?s=a:a.length>0?s=a[0]:(s=new c.MeshPhongMaterial({color:13421772}),a.push(s)),"color"in r.attributes&&a.forEach(function(l){l.vertexColors=!0}),r.FBX_Deformer?(i=new c.SkinnedMesh(r,s),i.normalizeSkinWeights()):i=new c.Mesh(r,s),i}createCurve(e,t){const n=e.children.reduce(function(r,s){return t.has(s.ID)&&(r=t.get(s.ID)),r},null),i=new c.LineBasicMaterial({color:3342591,linewidth:1});return new c.Line(n,i)}getTransformData(e,t){const n={};"InheritType"in t&&(n.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?n.eulerOrder=Ji(t.RotationOrder.value):n.eulerOrder="ZYX","Lcl_Translation"in t&&(n.translation=t.Lcl_Translation.value),"PreRotation"in t&&(n.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(n.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(n.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(n.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(n.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(n.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(n.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(n.rotationPivot=t.RotationPivot.value),e.userData.transformData=n}setLookAtProperties(e,t){"LookAtProperty"in t&&Te.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const r=ve.Objects.Model[i.ID];if("Lcl_Translation"in r){const s=r.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(s),Ve.add(e.target)):e.lookAt(new c.Vector3().fromArray(s))}}})}bindSkeleton(e,t,n){const i=this.parsePoseNodes();for(const r in e){const s=e[r];Te.get(parseInt(s.ID)).parents.forEach(function(l){if(t.has(l.ID)){const f=l.ID;Te.get(f).parents.forEach(function(d){n.has(d.ID)&&n.get(d.ID).bind(new c.Skeleton(s.bones),i[d.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in ve.Objects){const t=ve.Objects.Pose;for(const n in t)if(t[n].attrType==="BindPose"&&t[n].NbPoseNodes>0){const i=t[n].PoseNode;Array.isArray(i)?i.forEach(function(r){e[r.Node]=new c.Matrix4().fromArray(r.Matrix.a)}):e[i.Node]=new c.Matrix4().fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in ve&&"AmbientColor"in ve.GlobalSettings){const e=ve.GlobalSettings.AmbientColor.value,t=e[0],n=e[1],i=e[2];if(t!==0||n!==0||i!==0){const r=new c.Color(t,n,i);Ve.add(new c.AmbientLight(r,1))}}}}class Yo{parse(e){const t=new Map;if("Geometry"in ve.Objects){const n=ve.Objects.Geometry;for(const i in n){const r=Te.get(parseInt(i)),s=this.parseGeometry(r,n[i],e);t.set(parseInt(i),s)}}return t}parseGeometry(e,t,n){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,n);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,n){const i=n.skeletons,r=[],s=e.parents.map(function(d){return ve.Objects.Model[d.ID]});if(s.length===0)return;const a=e.children.reduce(function(d,m){return i[m.ID]!==void 0&&(d=i[m.ID]),d},null);e.children.forEach(function(d){n.morphTargets[d.ID]!==void 0&&r.push(n.morphTargets[d.ID])});const l=s[0],f={};"RotationOrder"in l&&(f.eulerOrder=Ji(l.RotationOrder.value)),"InheritType"in l&&(f.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(f.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(f.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(f.scale=l.GeometricScaling.value);const u=Qi(f);return this.genGeometry(t,a,r,u)}genGeometry(e,t,n,i){const r=new c.BufferGeometry;e.attrName&&(r.name=e.attrName);const s=this.parseGeoNode(e,t),a=this.genBuffers(s),l=new c.Float32BufferAttribute(a.vertex,3);if(l.applyMatrix4(i),r.setAttribute("position",l),a.colors.length>0&&r.setAttribute("color",new c.Float32BufferAttribute(a.colors,3)),t&&(r.setAttribute("skinIndex",new c.Uint16BufferAttribute(a.weightsIndices,4)),r.setAttribute("skinWeight",new c.Float32BufferAttribute(a.vertexWeights,4)),r.FBX_Deformer=t),a.normal.length>0){const f=new c.Matrix3().getNormalMatrix(i),u=new c.Float32BufferAttribute(a.normal,3);u.applyNormalMatrix(f),r.setAttribute("normal",u)}if(a.uvs.forEach(function(f,u){let d="uv"+(u+1).toString();u===0&&(d="uv"),r.setAttribute(d,new c.Float32BufferAttribute(a.uvs[u],2))}),s.material&&s.material.mappingType!=="AllSame"){let f=a.materialIndex[0],u=0;if(a.materialIndex.forEach(function(d,m){d!==f&&(r.addGroup(u,m-u,f),f=d,u=m)}),r.groups.length>0){const d=r.groups[r.groups.length-1],m=d.start+d.count;m!==a.materialIndex.length&&r.addGroup(m,a.materialIndex.length-m,f)}r.groups.length===0&&r.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(r,e,n,i),r}parseGeoNode(e,t){const n={};if(n.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],n.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(n.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(n.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(n.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){n.uv=[];let i=0;for(;e.LayerElementUV[i];)e.LayerElementUV[i].UV&&n.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return n.weightTable={},t!==null&&(n.skeleton=t,t.rawBones.forEach(function(i,r){i.indices.forEach(function(s,a){n.weightTable[s]===void 0&&(n.weightTable[s]=[]),n.weightTable[s].push({id:r,weight:i.weights[a]})})})),n}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let n=0,i=0,r=!1,s=[],a=[],l=[],f=[],u=[],d=[];const m=this;return e.vertexIndices.forEach(function(y,b){let A,_=!1;y<0&&(y=y^-1,_=!0);let L=[],I=[];if(s.push(y*3,y*3+1,y*3+2),e.color){const S=ln(b,n,y,e.color);l.push(S[0],S[1],S[2])}if(e.skeleton){if(e.weightTable[y]!==void 0&&e.weightTable[y].forEach(function(S){I.push(S.weight),L.push(S.id)}),I.length>4){r||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),r=!0);const S=[0,0,0,0],g=[0,0,0,0];I.forEach(function(O,x){let C=O,p=L[x];g.forEach(function(w,v,T){if(C>w){T[v]=C,C=w;const k=S[v];S[v]=p,p=k}})}),L=S,I=g}for(;I.length<4;)I.push(0),L.push(0);for(let S=0;S<4;++S)u.push(I[S]),d.push(L[S])}if(e.normal){const S=ln(b,n,y,e.normal);a.push(S[0],S[1],S[2])}e.material&&e.material.mappingType!=="AllSame"&&(A=ln(b,n,y,e.material)[0]),e.uv&&e.uv.forEach(function(S,g){const O=ln(b,n,y,S);f[g]===void 0&&(f[g]=[]),f[g].push(O[0]),f[g].push(O[1])}),i++,_&&(m.genFace(t,e,s,A,a,l,f,u,d,i),n++,i=0,s=[],a=[],l=[],f=[],u=[],d=[])}),t}genFace(e,t,n,i,r,s,a,l,f,u){for(let d=2;d<u;d++)e.vertex.push(t.vertexPositions[n[0]]),e.vertex.push(t.vertexPositions[n[1]]),e.vertex.push(t.vertexPositions[n[2]]),e.vertex.push(t.vertexPositions[n[(d-1)*3]]),e.vertex.push(t.vertexPositions[n[(d-1)*3+1]]),e.vertex.push(t.vertexPositions[n[(d-1)*3+2]]),e.vertex.push(t.vertexPositions[n[d*3]]),e.vertex.push(t.vertexPositions[n[d*3+1]]),e.vertex.push(t.vertexPositions[n[d*3+2]]),t.skeleton&&(e.vertexWeights.push(l[0]),e.vertexWeights.push(l[1]),e.vertexWeights.push(l[2]),e.vertexWeights.push(l[3]),e.vertexWeights.push(l[(d-1)*4]),e.vertexWeights.push(l[(d-1)*4+1]),e.vertexWeights.push(l[(d-1)*4+2]),e.vertexWeights.push(l[(d-1)*4+3]),e.vertexWeights.push(l[d*4]),e.vertexWeights.push(l[d*4+1]),e.vertexWeights.push(l[d*4+2]),e.vertexWeights.push(l[d*4+3]),e.weightsIndices.push(f[0]),e.weightsIndices.push(f[1]),e.weightsIndices.push(f[2]),e.weightsIndices.push(f[3]),e.weightsIndices.push(f[(d-1)*4]),e.weightsIndices.push(f[(d-1)*4+1]),e.weightsIndices.push(f[(d-1)*4+2]),e.weightsIndices.push(f[(d-1)*4+3]),e.weightsIndices.push(f[d*4]),e.weightsIndices.push(f[d*4+1]),e.weightsIndices.push(f[d*4+2]),e.weightsIndices.push(f[d*4+3])),t.color&&(e.colors.push(s[0]),e.colors.push(s[1]),e.colors.push(s[2]),e.colors.push(s[(d-1)*3]),e.colors.push(s[(d-1)*3+1]),e.colors.push(s[(d-1)*3+2]),e.colors.push(s[d*3]),e.colors.push(s[d*3+1]),e.colors.push(s[d*3+2])),t.material&&t.material.mappingType!=="AllSame"&&(e.materialIndex.push(i),e.materialIndex.push(i),e.materialIndex.push(i)),t.normal&&(e.normal.push(r[0]),e.normal.push(r[1]),e.normal.push(r[2]),e.normal.push(r[(d-1)*3]),e.normal.push(r[(d-1)*3+1]),e.normal.push(r[(d-1)*3+2]),e.normal.push(r[d*3]),e.normal.push(r[d*3+1]),e.normal.push(r[d*3+2])),t.uv&&t.uv.forEach(function(m,y){e.uvs[y]===void 0&&(e.uvs[y]=[]),e.uvs[y].push(a[y][0]),e.uvs[y].push(a[y][1]),e.uvs[y].push(a[y][(d-1)*2]),e.uvs[y].push(a[y][(d-1)*2+1]),e.uvs[y].push(a[y][d*2]),e.uvs[y].push(a[y][d*2+1])})}addMorphTargets(e,t,n,i){if(n.length===0)return;e.morphTargetsRelative=!0,e.morphAttributes.position=[];const r=this;n.forEach(function(s){s.rawTargets.forEach(function(a){const l=ve.Objects.Geometry[a.geoID];l!==void 0&&r.genMorphGeometry(e,t,l,i,a.name)})})}genMorphGeometry(e,t,n,i,r){const s=t.PolygonVertexIndex!==void 0?t.PolygonVertexIndex.a:[],a=n.Vertices!==void 0?n.Vertices.a:[],l=n.Indexes!==void 0?n.Indexes.a:[],f=e.attributes.position.count*3,u=new Float32Array(f);for(let b=0;b<l.length;b++){const A=l[b]*3;u[A]=a[b*3],u[A+1]=a[b*3+1],u[A+2]=a[b*3+2]}const d={vertexIndices:s,vertexPositions:u},m=this.genBuffers(d),y=new c.Float32BufferAttribute(m.vertex,3);y.name=r||n.attrName,y.applyMatrix4(i),e.morphAttributes.position.push(y)}parseNormals(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.Normals.a;let r=[];return n==="IndexToDirect"&&("NormalIndex"in e?r=e.NormalIndex.a:"NormalsIndex"in e&&(r=e.NormalsIndex.a)),{dataSize:3,buffer:i,indices:r,mappingType:t,referenceType:n}}parseUVs(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.UV.a;let r=[];return n==="IndexToDirect"&&(r=e.UVIndex.a),{dataSize:2,buffer:i,indices:r,mappingType:t,referenceType:n}}parseVertexColors(e){const t=e.MappingInformationType,n=e.ReferenceInformationType,i=e.Colors.a;let r=[];return n==="IndexToDirect"&&(r=e.ColorIndex.a),{dataSize:4,buffer:i,indices:r,mappingType:t,referenceType:n}}parseMaterialIndices(e){const t=e.MappingInformationType,n=e.ReferenceInformationType;if(t==="NoMappingInformation")return{dataSize:1,buffer:[0],indices:[0],mappingType:"AllSame",referenceType:n};const i=e.Materials.a,r=[];for(let s=0;s<i.length;++s)r.push(s);return{dataSize:1,buffer:i,indices:r,mappingType:t,referenceType:n}}parseNurbsGeometry(e){if(Wi===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 n=t-1,i=e.KnotVector.a,r=[],s=e.Points.a;for(let d=0,m=s.length;d<m;d+=4)r.push(new c.Vector4().fromArray(s,d));let a,l;if(e.Form==="Closed")r.push(r[0]);else if(e.Form==="Periodic"){a=n,l=i.length-1-a;for(let d=0;d<n;++d)r.push(r[d])}const u=new Wi(n,i,r,a,l).getPoints(r.length*12);return new c.BufferGeometry().setFromPoints(u)}}class Xo{parse(){const e=[],t=this.parseClips();if(t!==void 0)for(const n in t){const i=t[n],r=this.addClip(i);e.push(r)}return e}parseClips(){if(ve.Objects.AnimationCurve===void 0)return;const e=this.parseAnimationCurveNodes();this.parseAnimationCurves(e);const t=this.parseAnimationLayers(e);return this.parseAnimStacks(t)}parseAnimationCurveNodes(){const e=ve.Objects.AnimationCurveNode,t=new Map;for(const n in e){const i=e[n];if(i.attrName.match(/S|R|T|DeformPercent/)!==null){const r={id:i.id,attr:i.attrName,curves:{}};t.set(r.id,r)}}return t}parseAnimationCurves(e){const t=ve.Objects.AnimationCurve;for(const n in t){const i={id:t[n].id,times:t[n].KeyTime.a.map(Qo),values:t[n].KeyValueFloat.a},r=Te.get(i.id);if(r!==void 0){const s=r.parents[0].ID,a=r.parents[0].relationship;a.match(/X/)?e.get(s).curves.x=i:a.match(/Y/)?e.get(s).curves.y=i:a.match(/Z/)?e.get(s).curves.z=i:a.match(/d|DeformPercent/)&&e.has(s)&&(e.get(s).curves.morph=i)}}}parseAnimationLayers(e){const t=ve.Objects.AnimationLayer,n=new Map;for(const i in t){const r=[],s=Te.get(parseInt(i));s!==void 0&&(s.children.forEach(function(l,f){if(e.has(l.ID)){const u=e.get(l.ID);if(u.curves.x!==void 0||u.curves.y!==void 0||u.curves.z!==void 0){if(r[f]===void 0){const d=Te.get(l.ID).parents.filter(function(m){return m.relationship!==void 0})[0].ID;if(d!==void 0){const m=ve.Objects.Model[d.toString()];if(m===void 0){console.warn("THREE.FBXLoader: Encountered a unused curve.",l);return}const y={modelName:m.attrName?c.PropertyBinding.sanitizeNodeName(m.attrName):"",ID:m.id,initialPosition:[0,0,0],initialRotation:[0,0,0],initialScale:[1,1,1]};Ve.traverse(function(b){b.ID===m.id&&(y.transform=b.matrix,b.userData.transformData&&(y.eulerOrder=b.userData.transformData.eulerOrder))}),y.transform||(y.transform=new c.Matrix4),"PreRotation"in m&&(y.preRotation=m.PreRotation.value),"PostRotation"in m&&(y.postRotation=m.PostRotation.value),r[f]=y}}r[f]&&(r[f][u.attr]=u)}else if(u.curves.morph!==void 0){if(r[f]===void 0){const d=Te.get(l.ID).parents.filter(function(L){return L.relationship!==void 0})[0].ID,m=Te.get(d).parents[0].ID,y=Te.get(m).parents[0].ID,b=Te.get(y).parents[0].ID,A=ve.Objects.Model[b],_={modelName:A.attrName?c.PropertyBinding.sanitizeNodeName(A.attrName):"",morphName:ve.Objects.Deformer[d].attrName};r[f]=_}r[f][u.attr]=u}}}),n.set(parseInt(i),r))}return n}parseAnimStacks(e){const t=ve.Objects.AnimationStack,n={};for(const i in t){const r=Te.get(parseInt(i)).children;r.length>1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const s=e.get(r[0].ID);n[i]={name:t[i].attrName,layer:s}}return n}addClip(e){let t=[];const n=this;return e.layer.forEach(function(i){t=t.concat(n.generateTracks(i))}),new c.AnimationClip(e.name,-1,t)}generateTracks(e){const t=[];let n=new c.Vector3,i=new c.Quaternion,r=new c.Vector3;if(e.transform&&e.transform.decompose(n,i,r),n=n.toArray(),i=new c.Euler().setFromQuaternion(i,e.eulerOrder).toArray(),r=r.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.T.curves,n,"position");s!==void 0&&t.push(s)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const s=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder);s!==void 0&&t.push(s)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.S.curves,r,"scale");s!==void 0&&t.push(s)}if(e.DeformPercent!==void 0){const s=this.generateMorphTrack(e);s!==void 0&&t.push(s)}return t}generateVectorTrack(e,t,n,i){const r=this.getTimesForAllAxes(t),s=this.getKeyframeTrackValues(r,t,n);return new c.VectorKeyframeTrack(e+"."+i,r,s)}generateRotationTrack(e,t,n,i,r,s){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 a=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(a,t,n);i!==void 0&&(i=i.map(c.MathUtils.degToRad),i.push(s),i=new c.Euler().fromArray(i),i=new c.Quaternion().setFromEuler(i)),r!==void 0&&(r=r.map(c.MathUtils.degToRad),r.push(s),r=new c.Euler().fromArray(r),r=new c.Quaternion().setFromEuler(r).invert());const f=new c.Quaternion,u=new c.Euler,d=[];for(let m=0;m<l.length;m+=3)u.set(l[m],l[m+1],l[m+2],s),f.setFromEuler(u),i!==void 0&&f.premultiply(i),r!==void 0&&f.multiply(r),f.toArray(d,m/3*4);return new c.QuaternionKeyframeTrack(e+".quaternion",a,d)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,n=t.values.map(function(r){return r/100}),i=Ve.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new c.NumberKeyframeTrack(e.modelName+".morphTargetInfluences["+i+"]",t.times,n)}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(n,i){return n-i}),t.length>1){let n=1,i=t[0];for(let r=1;r<t.length;r++){const s=t[r];s!==i&&(t[n]=s,i=s,n++)}t=t.slice(0,n)}return t}getKeyframeTrackValues(e,t,n){const i=n,r=[];let s=-1,a=-1,l=-1;return e.forEach(function(f){if(t.x&&(s=t.x.times.indexOf(f)),t.y&&(a=t.y.times.indexOf(f)),t.z&&(l=t.z.times.indexOf(f)),s!==-1){const u=t.x.values[s];r.push(u),i[0]=u}else r.push(i[0]);if(a!==-1){const u=t.y.values[a];r.push(u),i[1]=u}else r.push(i[1]);if(l!==-1){const u=t.z.values[l];r.push(u),i[2]=u}else r.push(i[2])}),r}interpolateRotations(e){for(let t=1;t<e.values.length;t++){const n=e.values[t-1],i=e.values[t]-n,r=Math.abs(i);if(r>=180){const s=r/180,a=i/s;let l=n+a;const f=e.times[t-1],d=(e.times[t]-f)/s;let m=f+d;const y=[],b=[];for(;m<e.times[t];)y.push(m),m+=d,b.push(l),l+=a;e.times=$i(e.times,t,y),e.values=$i(e.values,t,b)}}}}class Wo{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 qi,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,n=e.split(/[\r\n]+/);return n.forEach(function(i,r){const s=i.match(/^[\s\t]*;/),a=i.match(/^[\s\t]*$/);if(s||a)return;const l=i.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),f=i.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),u=i.match("^\\t{"+(t.currentIndent-1)+"}}");l?t.parseNodeBegin(i,l):f?t.parseNodeProperty(i,f,n[++r]):u?t.popStack():i.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(i)}),this.allNodes}parseNodeBegin(e,t){const n=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map(function(l){return l.trim().replace(/^"/,"").replace(/"$/,"")}),r={name:n},s=this.parseNodeAttr(i),a=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(n,r):n in a?(n==="PoseNode"?a.PoseNode.push(r):a[n].id!==void 0&&(a[n]={},a[n][a[n].id]=a[n]),s.id!==""&&(a[n][s.id]=r)):typeof s.id=="number"?(a[n]={},a[n][s.id]=r):n!=="Properties70"&&(n==="PoseNode"?a[n]=[r]:a[n]=r),typeof s.id=="number"&&(r.id=s.id),s.name!==""&&(r.attrName=s.name),s.type!==""&&(r.attrType=s.type),this.pushStack(r)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let n="",i="";return e.length>1&&(n=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:n,type:i}}parseNodeProperty(e,t,n){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),r=t[2].replace(/^"/,"").replace(/"$/,"").trim();i==="Content"&&r===","&&(r=n.replace(/"/g,"").replace(/,$/,"").trim());const s=this.getCurrentNode();if(s.name==="Properties70"){this.parseNodeSpecialProperty(e,i,r);return}if(i==="C"){const l=r.split(",").slice(1),f=parseInt(l[0]),u=parseInt(l[1]);let d=r.split(",").slice(3);d=d.map(function(m){return m.trim().replace(/^"/,"")}),i="connections",r=[f,u],Ho(r,d),s[i]===void 0&&(s[i]=[])}i==="Node"&&(s.id=r),i in s&&Array.isArray(s[i])?s[i].push(r):i!=="a"?s[i]=r:s.a=r,this.setCurrentProp(s,i),i==="a"&&r.slice(-1)!==","&&(s.a=Rn(r))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=Rn(t.a))}parseNodeSpecialProperty(e,t,n){const i=n.split('",').map(function(u){return u.trim().replace(/^\"/,"").replace(/\s/,"_")}),r=i[0],s=i[1],a=i[2],l=i[3];let f=i[4];switch(s){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":f=parseFloat(f);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":f=Rn(f);break}this.getPrevNode()[r]={type:s,type2:a,flag:l,value:f},this.setCurrentProp(this.getPrevNode(),r)}}class Zo{parse(e){const t=new Zi(e);t.skip(23);const n=t.getUint32();if(n<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+n);const i=new qi;for(;!this.endOfContent(t);){const r=this.parseNode(t,n);r!==null&&i.add(r.name,r)}return i}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const n={},i=t>=7500?e.getUint64():e.getUint32(),r=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const s=e.getUint8(),a=e.getString(s);if(i===0)return null;const l=[];for(let m=0;m<r;m++)l.push(this.parseProperty(e));const f=l.length>0?l[0]:"",u=l.length>1?l[1]:"",d=l.length>2?l[2]:"";for(n.singleProperty=r===1&&e.getOffset()===i;i>e.getOffset();){const m=this.parseNode(e,t);m!==null&&this.parseSubNode(a,n,m)}return n.propertyList=l,typeof f=="number"&&(n.id=f),u!==""&&(n.attrName=u),d!==""&&(n.attrType=d),a!==""&&(n.name=a),n}parseSubNode(e,t,n){if(n.singleProperty===!0){const i=n.propertyList[0];Array.isArray(i)?(t[n.name]=n,n.a=i):t[n.name]=i}else if(e==="Connections"&&n.name==="C"){const i=[];n.propertyList.forEach(function(r,s){s!==0&&i.push(r)}),t.connections===void 0&&(t.connections=[]),t.connections.push(i)}else if(n.name==="Properties70")Object.keys(n).forEach(function(r){t[r]=n[r]});else if(e==="Properties70"&&n.name==="P"){let i=n.propertyList[0],r=n.propertyList[1];const s=n.propertyList[2],a=n.propertyList[3];let l;i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),r.indexOf("Lcl ")===0&&(r=r.replace("Lcl ","Lcl_")),r==="Color"||r==="ColorRGB"||r==="Vector"||r==="Vector3D"||r.indexOf("Lcl_")===0?l=[n.propertyList[4],n.propertyList[5],n.propertyList[6]]:l=n.propertyList[4],t[i]={type:r,type2:s,flag:a,value:l}}else t[n.name]===void 0?typeof n.id=="number"?(t[n.name]={},t[n.name][n.id]=n):t[n.name]=n:n.name==="PoseNode"?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(n)):t[n.name][n.id]===void 0&&(t[n.name][n.id]=n)}parseProperty(e){const t=e.getString(1);let n;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 n=e.getUint32(),e.getArrayBuffer(n);case"S":return n=e.getUint32(),e.getString(n);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),r=e.getUint32(),s=e.getUint32();if(r===0)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}const a=Bs(new Uint8Array(e.getArrayBuffer(s))),l=new Zi(a.buffer);switch(t){case"b":case"c":return l.getBooleanArray(i);case"d":return l.getFloat64Array(i);case"f":return l.getFloat32Array(i);case"i":return l.getInt32Array(i);case"l":return l.getInt64Array(i)}default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class Zi{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 n=0;n<e;n++)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 n=0;n<e;n++)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 n=0;n<e;n++)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 n=0;n<e;n++)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 n=0;n<e;n++)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 i=0;i<e;i++)t[i]=this.getUint8();const n=t.indexOf(0);return n>=0&&(t=t.slice(0,n)),c.LoaderUtils.decodeText(new Uint8Array(t))}}class qi{add(e,t){this[e]=t}}function qo(o){const e="Kaydara FBX Binary \0";return o.byteLength>=e.length&&e===Hi(o,0,e.length)}function Ko(o){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function n(i){const r=o[i-1];return o=o.slice(t+i),t++,r}for(let i=0;i<e.length;++i)if(n(1)===e[i])return!1;return!0}function Ki(o){const e=/FBXVersion: (\d+)/,t=o.match(e);if(t)return parseInt(t[1]);throw new Error("THREE.FBXLoader: Cannot find the version number for the file given.")}function Qo(o){return o/46186158e3}const Jo=[];function ln(o,e,t,n){let i;switch(n.mappingType){case"ByPolygonVertex":i=o;break;case"ByPolygon":i=e;break;case"ByVertice":i=t;break;case"AllSame":i=n.indices[0];break;default:console.warn("THREE.FBXLoader: unknown attribute mapping type "+n.mappingType)}n.referenceType==="IndexToDirect"&&(i=n.indices[i]);const r=i*n.dataSize,s=r+n.dataSize;return $o(Jo,n.buffer,r,s)}const Gn=new c.Euler,Tt=new c.Vector3;function Qi(o){const e=new c.Matrix4,t=new c.Matrix4,n=new c.Matrix4,i=new c.Matrix4,r=new c.Matrix4,s=new c.Matrix4,a=new c.Matrix4,l=new c.Matrix4,f=new c.Matrix4,u=new c.Matrix4,d=new c.Matrix4,m=new c.Matrix4,y=o.inheritType?o.inheritType:0;if(o.translation&&e.setPosition(Tt.fromArray(o.translation)),o.preRotation){const v=o.preRotation.map(c.MathUtils.degToRad);v.push(o.eulerOrder),t.makeRotationFromEuler(Gn.fromArray(v))}if(o.rotation){const v=o.rotation.map(c.MathUtils.degToRad);v.push(o.eulerOrder),n.makeRotationFromEuler(Gn.fromArray(v))}if(o.postRotation){const v=o.postRotation.map(c.MathUtils.degToRad);v.push(o.eulerOrder),i.makeRotationFromEuler(Gn.fromArray(v)),i.invert()}o.scale&&r.scale(Tt.fromArray(o.scale)),o.scalingOffset&&a.setPosition(Tt.fromArray(o.scalingOffset)),o.scalingPivot&&s.setPosition(Tt.fromArray(o.scalingPivot)),o.rotationOffset&&l.setPosition(Tt.fromArray(o.rotationOffset)),o.rotationPivot&&f.setPosition(Tt.fromArray(o.rotationPivot)),o.parentMatrixWorld&&(d.copy(o.parentMatrix),u.copy(o.parentMatrixWorld));const b=t.clone().multiply(n).multiply(i),A=new c.Matrix4;A.extractRotation(u);const _=new c.Matrix4;_.copyPosition(u);const L=_.clone().invert().multiply(u),I=A.clone().invert().multiply(L),S=r,g=new c.Matrix4;if(y===0)g.copy(A).multiply(b).multiply(I).multiply(S);else if(y===1)g.copy(A).multiply(I).multiply(b).multiply(S);else{const T=new c.Matrix4().scale(new c.Vector3().setFromMatrixScale(d)).clone().invert(),k=I.clone().multiply(T);g.copy(A).multiply(b).multiply(k).multiply(S)}const O=f.clone().invert(),x=s.clone().invert();let C=e.clone().multiply(l).multiply(f).multiply(t).multiply(n).multiply(i).multiply(O).multiply(a).multiply(s).multiply(r).multiply(x);const p=new c.Matrix4().copyPosition(C),w=u.clone().multiply(p);return m.copyPosition(w),C=m.clone().multiply(g),C.premultiply(u.invert()),C}function Ji(o){o=o||0;const e=["ZYX","YZX","XZY","ZXY","YXZ","XYZ"];return o===6?(console.warn("THREE.FBXLoader: unsupported Euler Order: Spherical XYZ. Animations and rotations may be incorrect."),e[0]):e[o]}function Rn(o){return o.split(",").map(function(t){return parseFloat(t)})}function Hi(o,e,t){return e===void 0&&(e=0),t===void 0&&(t=o.byteLength),c.LoaderUtils.decodeText(new Uint8Array(o,e,t))}function Ho(o,e){for(let t=0,n=o.length,i=e.length;t<i;t++,n++)o[n]=e[t]}function $o(o,e,t,n){for(let i=t,r=0;i<n;i++,r++)o[r]=e[i];return o}function $i(o,e,t){return o.slice(0,e).concat(t).concat(o.slice(e))}var ea=Object.defineProperty,ta=(o,e,t)=>e in o?ea(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,En=(o,e,t)=>(ta(o,typeof e!="symbol"?e+"":e,t),t);class na extends c.Loader{constructor(e){super(e)}load(e,t,n,i){const r=new c.FileLoader(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,s=>{if(typeof s!="string")throw new Error("unsupported data type");const a=JSON.parse(s),l=this.parse(a);t&&t(l)},n,i)}loadAsync(e,t){return super.loadAsync(e,t)}parse(e){return new Yn(e)}}class Yn{constructor(e){En(this,"data"),this.data=e}generateShapes(e,t=100,n){const i=[],r={letterSpacing:0,lineHeight:1,...n},s=ia(e,t,this.data,r);for(let a=0,l=s.length;a<l;a++)Array.prototype.push.apply(i,s[a].toShapes(!1));return i}}En(Yn,"isFont"),En(Yn,"type");function ia(o,e,t,n){const i=Array.from(o),r=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*r,a=[];let l=0,f=0;for(let u=0;u<i.length;u++){const d=i[u];if(d===`
|
|
74
|
+
`)l=0,f-=s*n.lineHeight;else{const m=ra(d,r,l,f,t);m&&(l+=m.offsetX+n.letterSpacing,a.push(m.path))}}return a}function ra(o,e,t,n,i){const r=i.glyphs[o]||i.glyphs["?"];if(!r){console.error('THREE.Font: character "'+o+'" does not exists in font family '+i.familyName+".");return}const s=new c.ShapePath;let a,l,f,u,d,m,y,b;if(r.o){const A=r._cachedOutline||(r._cachedOutline=r.o.split(" "));for(let _=0,L=A.length;_<L;)switch(A[_++]){case"m":a=parseInt(A[_++])*e+t,l=parseInt(A[_++])*e+n,s.moveTo(a,l);break;case"l":a=parseInt(A[_++])*e+t,l=parseInt(A[_++])*e+n,s.lineTo(a,l);break;case"q":f=parseInt(A[_++])*e+t,u=parseInt(A[_++])*e+n,d=parseInt(A[_++])*e+t,m=parseInt(A[_++])*e+n,s.quadraticCurveTo(d,m,f,u);break;case"b":f=parseInt(A[_++])*e+t,u=parseInt(A[_++])*e+n,d=parseInt(A[_++])*e+t,m=parseInt(A[_++])*e+n,y=parseInt(A[_++])*e+t,b=parseInt(A[_++])*e+n,s.bezierCurveTo(d,m,y,b,f,u);break}}return{offsetX:r.ha*e,path:s}}class er extends c.DataTextureLoader{constructor(e){super(e),this.type=c.HalfFloatType}parse(e){const a=function(S,g){switch(S){case 1:console.error("THREE.RGBELoader Read Error: "+(g||""));break;case 2:console.error("THREE.RGBELoader Write Error: "+(g||""));break;case 3:console.error("THREE.RGBELoader Bad File Format: "+(g||""));break;default:case 4:console.error("THREE.RGBELoader: Error: "+(g||""))}return-1},d=`
|
|
75
|
+
`,m=function(S,g,O){g=g||1024;let C=S.pos,p=-1,w=0,v="",T=String.fromCharCode.apply(null,new Uint16Array(S.subarray(C,C+128)));for(;0>(p=T.indexOf(d))&&w<g&&C<S.byteLength;)v+=T,w+=T.length,C+=128,T+=String.fromCharCode.apply(null,new Uint16Array(S.subarray(C,C+128)));return-1<p?(O!==!1&&(S.pos+=w+p+1),v+T.slice(0,p)):!1},y=function(S){const g=/^#\?(\S+)/,O=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,x=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,C=/^\s*FORMAT=(\S+)\s*$/,p=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,w={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let v,T;if(S.pos>=S.byteLength||!(v=m(S)))return a(1,"no header found");if(!(T=v.match(g)))return a(3,"bad initial token");for(w.valid|=1,w.programtype=T[1],w.string+=v+`
|
|
76
|
+
`;v=m(S),v!==!1;){if(w.string+=v+`
|
|
77
|
+
`,v.charAt(0)==="#"){w.comments+=v+`
|
|
78
|
+
`;continue}if((T=v.match(O))&&(w.gamma=parseFloat(T[1])),(T=v.match(x))&&(w.exposure=parseFloat(T[1])),(T=v.match(C))&&(w.valid|=2,w.format=T[1]),(T=v.match(p))&&(w.valid|=4,w.height=parseInt(T[1],10),w.width=parseInt(T[2],10)),w.valid&2&&w.valid&4)break}return w.valid&2?w.valid&4?w:a(3,"missing image size specifier"):a(3,"missing format specifier")},b=function(S,g,O){const x=g;if(x<8||x>32767||S[0]!==2||S[1]!==2||S[2]&128)return new Uint8Array(S);if(x!==(S[2]<<8|S[3]))return a(3,"wrong scanline width");const C=new Uint8Array(4*g*O);if(!C.length)return a(4,"unable to allocate buffer space");let p=0,w=0;const v=4*x,T=new Uint8Array(4),k=new Uint8Array(v);let Q=O;for(;Q>0&&w<S.byteLength;){if(w+4>S.byteLength)return a(1);if(T[0]=S[w++],T[1]=S[w++],T[2]=S[w++],T[3]=S[w++],T[0]!=2||T[1]!=2||(T[2]<<8|T[3])!=x)return a(3,"bad rgbe scanline format");let Y=0,$;for(;Y<v&&w<S.byteLength;){$=S[w++];const q=$>128;if(q&&($-=128),$===0||Y+$>v)return a(3,"bad scanline data");if(q){const Z=S[w++];for(let ie=0;ie<$;ie++)k[Y++]=Z}else k.set(S.subarray(w,w+$),Y),Y+=$,w+=$}const ee=x;for(let q=0;q<ee;q++){let Z=0;C[p]=k[q+Z],Z+=x,C[p+1]=k[q+Z],Z+=x,C[p+2]=k[q+Z],Z+=x,C[p+3]=k[q+Z],p+=4}Q--}return C},A=function(S,g,O,x){const C=S[g+3],p=Math.pow(2,C-128)/255;O[x+0]=S[g+0]*p,O[x+1]=S[g+1]*p,O[x+2]=S[g+2]*p,O[x+3]=1},_=function(S,g,O,x){const C=S[g+3],p=Math.pow(2,C-128)/255;O[x+0]=c.DataUtils.toHalfFloat(Math.min(S[g+0]*p,65504)),O[x+1]=c.DataUtils.toHalfFloat(Math.min(S[g+1]*p,65504)),O[x+2]=c.DataUtils.toHalfFloat(Math.min(S[g+2]*p,65504)),O[x+3]=c.DataUtils.toHalfFloat(1)},L=new Uint8Array(e);L.pos=0;const I=y(L);if(I!==-1){const S=I.width,g=I.height,O=b(L.subarray(L.pos),S,g);if(O!==-1){let x,C,p;switch(this.type){case c.FloatType:p=O.length/4;const w=new Float32Array(p*4);for(let T=0;T<p;T++)A(O,T*4,w,T*4);x=w,C=c.FloatType;break;case c.HalfFloatType:p=O.length/4;const v=new Uint16Array(p*4);for(let T=0;T<p;T++)_(O,T*4,v,T*4);x=v,C=c.HalfFloatType;break;default:console.error("THREE.RGBELoader: unsupported type: ",this.type);break}return{width:S,height:g,data:x,header:I.string,gamma:I.gamma,exposure:I.exposure,type:C}}}return null}setDataType(e){return this.type=e,this}load(e,t,n,i){function r(s,a){switch(s.type){case c.FloatType:case c.HalfFloatType:"colorSpace"in s?s.colorSpace="srgb-linear":s.encoding=3e3,s.minFilter=c.LinearFilter,s.magFilter=c.LinearFilter,s.generateMipmaps=!1,s.flipY=!0;break}t&&t(s,a)}return super.load(e,r,n,i)}}class Rt extends c.Loader{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit="px"}load(e,t,n,i){const r=this,s=new c.FileLoader(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(e,function(a){try{t(r.parse(a))}catch(l){i?i(l):console.error(l),r.manager.itemError(e)}},n,i)}parse(e){const t=this;function n(G,V){if(G.nodeType!==1)return;const M=g(G);let z=!0,H=null;switch(G.nodeName){case"svg":break;case"style":r(G);break;case"g":V=b(G,V);break;case"path":V=b(G,V),G.hasAttribute("d")&&(H=i(G));break;case"rect":V=b(G,V),H=l(G);break;case"polygon":V=b(G,V),H=f(G);break;case"polyline":V=b(G,V),H=u(G);break;case"circle":V=b(G,V),H=d(G);break;case"ellipse":V=b(G,V),H=m(G);break;case"line":V=b(G,V),H=y(G);break;case"defs":z=!1;break;case"mask":z=!1;break;case"use":V=b(G,V);const N=G.href.baseVal.substring(1),j=G.viewportElement.getElementById(N);j?n(j,V):console.warn("SVGLoader: 'use node' references non-existent node id: "+N);break}if(H&&(V.fill!==void 0&&V.fill!=="none"&&H.color.setStyle(V.fill),x(H,ie),v.push(H),H.userData={node:G,style:V}),z){const N=G.childNodes;for(let j=0;j<N.length;j++)n(N[j],V)}M&&(k.pop(),k.length>0?ie.copy(k[k.length-1]):ie.identity())}function i(G){const V=new c.ShapePath,M=new c.Vector2,z=new c.Vector2,H=new c.Vector2;let N=!0,j=!1;const D=G.getAttribute("d").match(/[a-df-z][^a-df-z]*/gi);for(let F=0,R=D.length;F<R;F++){const W=D[F],X=W.charAt(0),te=W.substr(1).trim();N===!0&&(j=!0,N=!1);let U;switch(X){case"M":U=_(te);for(let B=0,oe=U.length;B<oe;B+=2)M.x=U[B+0],M.y=U[B+1],z.x=M.x,z.y=M.y,B===0?V.moveTo(M.x,M.y):V.lineTo(M.x,M.y),B===0&&H.copy(M);break;case"H":U=_(te);for(let B=0,oe=U.length;B<oe;B++)M.x=U[B],z.x=M.x,z.y=M.y,V.lineTo(M.x,M.y),B===0&&j===!0&&H.copy(M);break;case"V":U=_(te);for(let B=0,oe=U.length;B<oe;B++)M.y=U[B],z.x=M.x,z.y=M.y,V.lineTo(M.x,M.y),B===0&&j===!0&&H.copy(M);break;case"L":U=_(te);for(let B=0,oe=U.length;B<oe;B+=2)M.x=U[B+0],M.y=U[B+1],z.x=M.x,z.y=M.y,V.lineTo(M.x,M.y),B===0&&j===!0&&H.copy(M);break;case"C":U=_(te);for(let B=0,oe=U.length;B<oe;B+=6)V.bezierCurveTo(U[B+0],U[B+1],U[B+2],U[B+3],U[B+4],U[B+5]),z.x=U[B+2],z.y=U[B+3],M.x=U[B+4],M.y=U[B+5],B===0&&j===!0&&H.copy(M);break;case"S":U=_(te);for(let B=0,oe=U.length;B<oe;B+=4)V.bezierCurveTo(A(M.x,z.x),A(M.y,z.y),U[B+0],U[B+1],U[B+2],U[B+3]),z.x=U[B+0],z.y=U[B+1],M.x=U[B+2],M.y=U[B+3],B===0&&j===!0&&H.copy(M);break;case"Q":U=_(te);for(let B=0,oe=U.length;B<oe;B+=4)V.quadraticCurveTo(U[B+0],U[B+1],U[B+2],U[B+3]),z.x=U[B+0],z.y=U[B+1],M.x=U[B+2],M.y=U[B+3],B===0&&j===!0&&H.copy(M);break;case"T":U=_(te);for(let B=0,oe=U.length;B<oe;B+=2){const le=A(M.x,z.x),me=A(M.y,z.y);V.quadraticCurveTo(le,me,U[B+0],U[B+1]),z.x=le,z.y=me,M.x=U[B+0],M.y=U[B+1],B===0&&j===!0&&H.copy(M)}break;case"A":U=_(te,[3,4],7);for(let B=0,oe=U.length;B<oe;B+=7){if(U[B+5]==M.x&&U[B+6]==M.y)continue;const le=M.clone();M.x=U[B+5],M.y=U[B+6],z.x=M.x,z.y=M.y,s(V,U[B],U[B+1],U[B+2],U[B+3],U[B+4],le,M),B===0&&j===!0&&H.copy(M)}break;case"m":U=_(te);for(let B=0,oe=U.length;B<oe;B+=2)M.x+=U[B+0],M.y+=U[B+1],z.x=M.x,z.y=M.y,B===0?V.moveTo(M.x,M.y):V.lineTo(M.x,M.y),B===0&&H.copy(M);break;case"h":U=_(te);for(let B=0,oe=U.length;B<oe;B++)M.x+=U[B],z.x=M.x,z.y=M.y,V.lineTo(M.x,M.y),B===0&&j===!0&&H.copy(M);break;case"v":U=_(te);for(let B=0,oe=U.length;B<oe;B++)M.y+=U[B],z.x=M.x,z.y=M.y,V.lineTo(M.x,M.y),B===0&&j===!0&&H.copy(M);break;case"l":U=_(te);for(let B=0,oe=U.length;B<oe;B+=2)M.x+=U[B+0],M.y+=U[B+1],z.x=M.x,z.y=M.y,V.lineTo(M.x,M.y),B===0&&j===!0&&H.copy(M);break;case"c":U=_(te);for(let B=0,oe=U.length;B<oe;B+=6)V.bezierCurveTo(M.x+U[B+0],M.y+U[B+1],M.x+U[B+2],M.y+U[B+3],M.x+U[B+4],M.y+U[B+5]),z.x=M.x+U[B+2],z.y=M.y+U[B+3],M.x+=U[B+4],M.y+=U[B+5],B===0&&j===!0&&H.copy(M);break;case"s":U=_(te);for(let B=0,oe=U.length;B<oe;B+=4)V.bezierCurveTo(A(M.x,z.x),A(M.y,z.y),M.x+U[B+0],M.y+U[B+1],M.x+U[B+2],M.y+U[B+3]),z.x=M.x+U[B+0],z.y=M.y+U[B+1],M.x+=U[B+2],M.y+=U[B+3],B===0&&j===!0&&H.copy(M);break;case"q":U=_(te);for(let B=0,oe=U.length;B<oe;B+=4)V.quadraticCurveTo(M.x+U[B+0],M.y+U[B+1],M.x+U[B+2],M.y+U[B+3]),z.x=M.x+U[B+0],z.y=M.y+U[B+1],M.x+=U[B+2],M.y+=U[B+3],B===0&&j===!0&&H.copy(M);break;case"t":U=_(te);for(let B=0,oe=U.length;B<oe;B+=2){const le=A(M.x,z.x),me=A(M.y,z.y);V.quadraticCurveTo(le,me,M.x+U[B+0],M.y+U[B+1]),z.x=le,z.y=me,M.x=M.x+U[B+0],M.y=M.y+U[B+1],B===0&&j===!0&&H.copy(M)}break;case"a":U=_(te,[3,4],7);for(let B=0,oe=U.length;B<oe;B+=7){if(U[B+5]==0&&U[B+6]==0)continue;const le=M.clone();M.x+=U[B+5],M.y+=U[B+6],z.x=M.x,z.y=M.y,s(V,U[B],U[B+1],U[B+2],U[B+3],U[B+4],le,M),B===0&&j===!0&&H.copy(M)}break;case"Z":case"z":V.currentPath.autoClose=!0,V.currentPath.curves.length>0&&(M.copy(H),V.currentPath.currentPoint.copy(M),N=!0);break;default:console.warn(W)}j=!1}return V}function r(G){if(!(!G.sheet||!G.sheet.cssRules||!G.sheet.cssRules.length))for(let V=0;V<G.sheet.cssRules.length;V++){const M=G.sheet.cssRules[V];if(M.type!==1)continue;const z=M.selectorText.split(/,/gm).filter(Boolean).map(H=>H.trim());for(let H=0;H<z.length;H++)T[z[H]]=Object.assign(T[z[H]]||{},M.style)}}function s(G,V,M,z,H,N,j,P){if(V==0||M==0){G.lineTo(P.x,P.y);return}z=z*Math.PI/180,V=Math.abs(V),M=Math.abs(M);const D=(j.x-P.x)/2,F=(j.y-P.y)/2,R=Math.cos(z)*D+Math.sin(z)*F,W=-Math.sin(z)*D+Math.cos(z)*F;let X=V*V,te=M*M;const U=R*R,B=W*W,oe=U/X+B/te;if(oe>1){const Vt=Math.sqrt(oe);V=Vt*V,M=Vt*M,X=V*V,te=M*M}const le=X*B+te*U,me=(X*te-le)/le;let _e=Math.sqrt(Math.max(0,me));H===N&&(_e=-_e);const we=_e*V*W/M,Ie=-_e*M*R/V,st=Math.cos(z)*we-Math.sin(z)*Ie+(j.x+P.x)/2,nn=Math.sin(z)*we+Math.cos(z)*Ie+(j.y+P.y)/2,Nt=a(1,0,(R-we)/V,(W-Ie)/M),We=a((R-we)/V,(W-Ie)/M,(-R-we)/V,(-W-Ie)/M)%(Math.PI*2);G.currentPath.absellipse(st,nn,V,M,Nt,Nt+We,N===0,z)}function a(G,V,M,z){const H=G*M+V*z,N=Math.sqrt(G*G+V*V)*Math.sqrt(M*M+z*z);let j=Math.acos(Math.max(-1,Math.min(1,H/N)));return G*z-V*M<0&&(j=-j),j}function l(G){const V=S(G.getAttribute("x")||0),M=S(G.getAttribute("y")||0),z=S(G.getAttribute("rx")||G.getAttribute("ry")||0),H=S(G.getAttribute("ry")||G.getAttribute("rx")||0),N=S(G.getAttribute("width")),j=S(G.getAttribute("height")),P=1-.551915024494,D=new c.ShapePath;return D.moveTo(V+z,M),D.lineTo(V+N-z,M),(z!==0||H!==0)&&D.bezierCurveTo(V+N-z*P,M,V+N,M+H*P,V+N,M+H),D.lineTo(V+N,M+j-H),(z!==0||H!==0)&&D.bezierCurveTo(V+N,M+j-H*P,V+N-z*P,M+j,V+N-z,M+j),D.lineTo(V+z,M+j),(z!==0||H!==0)&&D.bezierCurveTo(V+z*P,M+j,V,M+j-H*P,V,M+j-H),D.lineTo(V,M+H),(z!==0||H!==0)&&D.bezierCurveTo(V,M+H*P,V+z*P,M,V+z,M),D}function f(G){function V(N,j,P){const D=S(j),F=S(P);H===0?z.moveTo(D,F):z.lineTo(D,F),H++}const M=/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,z=new c.ShapePath;let H=0;return G.getAttribute("points").replace(M,V),z.currentPath.autoClose=!0,z}function u(G){function V(N,j,P){const D=S(j),F=S(P);H===0?z.moveTo(D,F):z.lineTo(D,F),H++}const M=/(-?[\d\.?]+)[,|\s](-?[\d\.?]+)/g,z=new c.ShapePath;let H=0;return G.getAttribute("points").replace(M,V),z.currentPath.autoClose=!1,z}function d(G){const V=S(G.getAttribute("cx")||0),M=S(G.getAttribute("cy")||0),z=S(G.getAttribute("r")||0),H=new c.Path;H.absarc(V,M,z,0,Math.PI*2);const N=new c.ShapePath;return N.subPaths.push(H),N}function m(G){const V=S(G.getAttribute("cx")||0),M=S(G.getAttribute("cy")||0),z=S(G.getAttribute("rx")||0),H=S(G.getAttribute("ry")||0),N=new c.Path;N.absellipse(V,M,z,H,0,Math.PI*2);const j=new c.ShapePath;return j.subPaths.push(N),j}function y(G){const V=S(G.getAttribute("x1")||0),M=S(G.getAttribute("y1")||0),z=S(G.getAttribute("x2")||0),H=S(G.getAttribute("y2")||0),N=new c.ShapePath;return N.moveTo(V,M),N.lineTo(z,H),N.currentPath.autoClose=!1,N}function b(G,V){V=Object.assign({},V);let M={};if(G.hasAttribute("class")){const j=G.getAttribute("class").split(/\s/).filter(Boolean).map(P=>P.trim());for(let P=0;P<j.length;P++)M=Object.assign(M,T["."+j[P]])}G.hasAttribute("id")&&(M=Object.assign(M,T["#"+G.getAttribute("id")]));function z(j,P,D){D===void 0&&(D=function(R){return R.startsWith("url")&&console.warn("SVGLoader: url access in attributes is not implemented."),R}),G.hasAttribute(j)&&(V[P]=D(G.getAttribute(j))),M[j]&&(V[P]=D(M[j])),G.style&&G.style[j]!==""&&(V[P]=D(G.style[j]))}function H(j){return Math.max(0,Math.min(1,S(j)))}function N(j){return Math.max(0,S(j))}return z("fill","fill"),z("fill-opacity","fillOpacity",H),z("fill-rule","fillRule"),z("opacity","opacity",H),z("stroke","stroke"),z("stroke-opacity","strokeOpacity",H),z("stroke-width","strokeWidth",N),z("stroke-linejoin","strokeLineJoin"),z("stroke-linecap","strokeLineCap"),z("stroke-miterlimit","strokeMiterLimit",N),z("visibility","visibility"),V}function A(G,V){return G-(V-G)}function _(G,V,M){if(typeof G!="string")throw new TypeError("Invalid input: "+typeof G);const z={SEPARATOR:/[ \t\r\n\,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},H=0,N=1,j=2,P=3;let D=H,F=!0,R="",W="";const X=[];function te(le,me,_e){const we=new SyntaxError('Unexpected character "'+le+'" at index '+me+".");throw we.partial=_e,we}function U(){R!==""&&(W===""?X.push(Number(R)):X.push(Number(R)*Math.pow(10,Number(W)))),R="",W=""}let B;const oe=G.length;for(let le=0;le<oe;le++){if(B=G[le],Array.isArray(V)&&V.includes(X.length%M)&&z.FLAGS.test(B)){D=N,R=B,U();continue}if(D===H){if(z.WHITESPACE.test(B))continue;if(z.DIGIT.test(B)||z.SIGN.test(B)){D=N,R=B;continue}if(z.POINT.test(B)){D=j,R=B;continue}z.COMMA.test(B)&&(F&&te(B,le,X),F=!0)}if(D===N){if(z.DIGIT.test(B)){R+=B;continue}if(z.POINT.test(B)){R+=B,D=j;continue}if(z.EXP.test(B)){D=P;continue}z.SIGN.test(B)&&R.length===1&&z.SIGN.test(R[0])&&te(B,le,X)}if(D===j){if(z.DIGIT.test(B)){R+=B;continue}if(z.EXP.test(B)){D=P;continue}z.POINT.test(B)&&R[R.length-1]==="."&&te(B,le,X)}if(D===P){if(z.DIGIT.test(B)){W+=B;continue}if(z.SIGN.test(B)){if(W===""){W+=B;continue}W.length===1&&z.SIGN.test(W)&&te(B,le,X)}}z.WHITESPACE.test(B)?(U(),D=H,F=!1):z.COMMA.test(B)?(U(),D=H,F=!0):z.SIGN.test(B)?(U(),D=N,R=B):z.POINT.test(B)?(U(),D=j,R=B):te(B,le,X)}return U(),X}const L=["mm","cm","in","pt","pc","px"],I={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 S(G){let V="px";if(typeof G=="string"||G instanceof String)for(let z=0,H=L.length;z<H;z++){const N=L[z];if(G.endsWith(N)){V=N,G=G.substring(0,G.length-N.length);break}}let M;return V==="px"&&t.defaultUnit!=="px"?M=I.in[t.defaultUnit]/t.defaultDPI:(M=I[V][t.defaultUnit],M<0&&(M=I[V].in*t.defaultDPI)),M*parseFloat(G)}function g(G){if(!(G.hasAttribute("transform")||G.nodeName==="use"&&(G.hasAttribute("x")||G.hasAttribute("y"))))return null;const V=O(G);return k.length>0&&V.premultiply(k[k.length-1]),ie.copy(V),k.push(V),V}function O(G){const V=new c.Matrix3,M=Q;if(G.nodeName==="use"&&(G.hasAttribute("x")||G.hasAttribute("y"))){const z=S(G.getAttribute("x")),H=S(G.getAttribute("y"));V.translate(z,H)}if(G.hasAttribute("transform")){const z=G.getAttribute("transform").split(")");for(let H=z.length-1;H>=0;H--){const N=z[H].trim();if(N==="")continue;const j=N.indexOf("("),P=N.length;if(j>0&&j<P){const D=N.substr(0,j),F=_(N.substr(j+1,P-j-1));switch(M.identity(),D){case"translate":if(F.length>=1){const R=F[0];let W=R;F.length>=2&&(W=F[1]),M.translate(R,W)}break;case"rotate":if(F.length>=1){let R=0,W=0,X=0;R=-F[0]*Math.PI/180,F.length>=3&&(W=F[1],X=F[2]),Y.identity().translate(-W,-X),$.identity().rotate(R),ee.multiplyMatrices($,Y),Y.identity().translate(W,X),M.multiplyMatrices(Y,ee)}break;case"scale":if(F.length>=1){const R=F[0];let W=R;F.length>=2&&(W=F[1]),M.scale(R,W)}break;case"skewX":F.length===1&&M.set(1,Math.tan(F[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":F.length===1&&M.set(1,0,0,Math.tan(F[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":F.length===6&&M.set(F[0],F[2],F[4],F[1],F[3],F[5],0,0,1);break}}V.premultiply(M)}}return V}function x(G,V){function M(N){Z.set(N.x,N.y,1).applyMatrix3(V),N.set(Z.x,Z.y)}const z=C(V),H=G.subPaths;for(let N=0,j=H.length;N<j;N++){const D=H[N].curves;for(let F=0;F<D.length;F++){const R=D[F];R.isLineCurve?(M(R.v1),M(R.v2)):R.isCubicBezierCurve?(M(R.v0),M(R.v1),M(R.v2),M(R.v3)):R.isQuadraticBezierCurve?(M(R.v0),M(R.v1),M(R.v2)):R.isEllipseCurve&&(z&&console.warn("SVGLoader: Elliptic arc or ellipse rotation or skewing is not implemented."),q.set(R.aX,R.aY),M(q),R.aX=q.x,R.aY=q.y,R.xRadius*=p(V),R.yRadius*=w(V))}}}function C(G){return G.elements[1]!==0||G.elements[3]!==0}function p(G){const V=G.elements;return Math.sqrt(V[0]*V[0]+V[1]*V[1])}function w(G){const V=G.elements;return Math.sqrt(V[3]*V[3]+V[4]*V[4])}const v=[],T={},k=[],Q=new c.Matrix3,Y=new c.Matrix3,$=new c.Matrix3,ee=new c.Matrix3,q=new c.Vector2,Z=new c.Vector3,ie=new c.Matrix3,ne=new DOMParser().parseFromString(e,"image/svg+xml");return n(ne.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4}),{paths:v,xml:ne.documentElement}}static createShapes(e){const n={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},i={loc:n.ORIGIN,t:0};function r(_,L,I,S){const g=_.x,O=L.x,x=I.x,C=S.x,p=_.y,w=L.y,v=I.y,T=S.y,k=(C-x)*(p-v)-(T-v)*(g-x),Q=(O-g)*(p-v)-(w-p)*(g-x),Y=(T-v)*(O-g)-(C-x)*(w-p),$=k/Y,ee=Q/Y;if(Y===0&&k!==0||$<=0||$>=1||ee<0||ee>1)return null;if(k===0&&Y===0){for(let q=0;q<2;q++)if(s(q===0?I:S,_,L),i.loc==n.ORIGIN){const Z=q===0?I:S;return{x:Z.x,y:Z.y,t:i.t}}else if(i.loc==n.BETWEEN){const Z=+(g+i.t*(O-g)).toPrecision(10),ie=+(p+i.t*(w-p)).toPrecision(10);return{x:Z,y:ie,t:i.t}}return null}else{for(let ie=0;ie<2;ie++)if(s(ie===0?I:S,_,L),i.loc==n.ORIGIN){const ne=ie===0?I:S;return{x:ne.x,y:ne.y,t:i.t}}const q=+(g+$*(O-g)).toPrecision(10),Z=+(p+$*(w-p)).toPrecision(10);return{x:q,y:Z,t:$}}}function s(_,L,I){const S=I.x-L.x,g=I.y-L.y,O=_.x-L.x,x=_.y-L.y,C=S*x-O*g;if(_.x===L.x&&_.y===L.y){i.loc=n.ORIGIN,i.t=0;return}if(_.x===I.x&&_.y===I.y){i.loc=n.DESTINATION,i.t=1;return}if(C<-Number.EPSILON){i.loc=n.LEFT;return}if(C>Number.EPSILON){i.loc=n.RIGHT;return}if(S*O<0||g*x<0){i.loc=n.BEHIND;return}if(Math.sqrt(S*S+g*g)<Math.sqrt(O*O+x*x)){i.loc=n.BEYOND;return}let p;S!==0?p=O/S:p=x/g,i.loc=n.BETWEEN,i.t=p}function a(_,L){const I=[],S=[];for(let g=1;g<_.length;g++){const O=_[g-1],x=_[g];for(let C=1;C<L.length;C++){const p=L[C-1],w=L[C],v=r(O,x,p,w);v!==null&&I.find(T=>T.t<=v.t+Number.EPSILON&&T.t>=v.t-Number.EPSILON)===void 0&&(I.push(v),S.push(new c.Vector2(v.x,v.y)))}}return S}function l(_,L,I){const S=new c.Vector2;L.getCenter(S);const g=[];return I.forEach(O=>{O.boundingBox.containsPoint(S)&&a(_,O.points).forEach(C=>{g.push({identifier:O.identifier,isCW:O.isCW,point:C})})}),g.sort((O,x)=>O.point.x-x.point.x),g}function f(_,L,I,S,g){(g==null||g==="")&&(g="nonzero");const O=new c.Vector2;_.boundingBox.getCenter(O);const x=[new c.Vector2(I,O.y),new c.Vector2(S,O.y)],C=l(x,_.boundingBox,L);C.sort((Q,Y)=>Q.point.x-Y.point.x);const p=[],w=[];C.forEach(Q=>{Q.identifier===_.identifier?p.push(Q):w.push(Q)});const v=p[0].point.x,T=[];let k=0;for(;k<w.length&&w[k].point.x<v;)T.length>0&&T[T.length-1]===w[k].identifier?T.pop():T.push(w[k].identifier),k++;if(T.push(_.identifier),g==="evenodd"){const Q=T.length%2===0,Y=T[T.length-2];return{identifier:_.identifier,isHole:Q,for:Y}}else if(g==="nonzero"){let Q=!0,Y=null,$=null;for(let ee=0;ee<T.length;ee++){const q=T[ee];Q?($=L[q].isCW,Q=!1,Y=q):$!==L[q].isCW&&($=L[q].isCW,Q=!0)}return{identifier:_.identifier,isHole:Q,for:Y}}else console.warn('fill-rule: "'+g+'" is currently not implemented.')}let u=0,d=999999999,m=-999999999,y=e.subPaths.map(_=>{const L=_.getPoints();let I=-999999999,S=999999999,g=-999999999,O=999999999;for(let x=0;x<L.length;x++){const C=L[x];C.y>I&&(I=C.y),C.y<S&&(S=C.y),C.x>g&&(g=C.x),C.x<O&&(O=C.x)}return m<=g&&(m=g+1),d>=O&&(d=O-1),{curves:_.curves,points:L,isCW:c.ShapeUtils.isClockWise(L),identifier:u++,boundingBox:new c.Box2(new c.Vector2(O,S),new c.Vector2(g,I))}});y=y.filter(_=>_.points.length>1);const b=y.map(_=>f(_,y,d,m,e.userData.style.fillRule)),A=[];return y.forEach(_=>{if(!b[_.identifier].isHole){const I=new c.Shape;I.curves=_.curves,b.filter(g=>g.isHole&&g.for===_.identifier).forEach(g=>{const O=y[g.identifier],x=new c.Path;x.curves=O.curves,I.holes.push(x)}),A.push(I)}}),A}static getStrokeStyle(e,t,n,i,r){return e=e!==void 0?e:1,t=t!==void 0?t:"#000",n=n!==void 0?n:"miter",i=i!==void 0?i:"butt",r=r!==void 0?r:4,{strokeColor:t,strokeWidth:e,strokeLineJoin:n,strokeLineCap:i,strokeMiterLimit:r}}static pointsToStroke(e,t,n,i){const r=[],s=[],a=[];if(Rt.pointsToStrokeWithBuffers(e,t,n,i,r,s,a)===0)return null;const l=new c.BufferGeometry;return l.setAttribute("position",new c.Float32BufferAttribute(r,3)),l.setAttribute("normal",new c.Float32BufferAttribute(s,3)),l.setAttribute("uv",new c.Float32BufferAttribute(a,2)),l}static pointsToStrokeWithBuffers(e,t,n,i,r,s,a,l){const f=new c.Vector2,u=new c.Vector2,d=new c.Vector2,m=new c.Vector2,y=new c.Vector2,b=new c.Vector2,A=new c.Vector2,_=new c.Vector2,L=new c.Vector2,I=new c.Vector2,S=new c.Vector2,g=new c.Vector2,O=new c.Vector2,x=new c.Vector2,C=new c.Vector2,p=new c.Vector2,w=new c.Vector2;n=n!==void 0?n:12,i=i!==void 0?i:.001,l=l!==void 0?l:0,e=W(e);const v=e.length;if(v<2)return 0;const T=e[0].equals(e[v-1]);let k,Q=e[0],Y;const $=t.strokeWidth/2,ee=1/(v-1);let q=0,Z,ie,ne,ce,G=!1,V=0,M=l*3,z=l*2;H(e[0],e[1],f).multiplyScalar($),_.copy(e[0]).sub(f),L.copy(e[0]).add(f),I.copy(_),S.copy(L);for(let X=1;X<v;X++){k=e[X],X===v-1?T?Y=e[1]:Y=void 0:Y=e[X+1];const te=f;if(H(Q,k,te),d.copy(te).multiplyScalar($),g.copy(k).sub(d),O.copy(k).add(d),Z=q+ee,ie=!1,Y!==void 0){H(k,Y,u),d.copy(u).multiplyScalar($),x.copy(k).sub(d),C.copy(k).add(d),ne=!0,d.subVectors(Y,Q),te.dot(d)<0&&(ne=!1),X===1&&(G=ne),d.subVectors(Y,k),d.normalize();const U=Math.abs(te.dot(d));if(U!==0){const B=$/U;d.multiplyScalar(-B),m.subVectors(k,Q),y.copy(m).setLength(B).add(d),p.copy(y).negate();const oe=y.length(),le=m.length();m.divideScalar(le),b.subVectors(Y,k);const me=b.length();switch(b.divideScalar(me),m.dot(p)<le&&b.dot(p)<me&&(ie=!0),w.copy(y).add(k),p.add(k),ce=!1,ie?ne?(C.copy(p),O.copy(p)):(x.copy(p),g.copy(p)):P(),t.strokeLineJoin){case"bevel":D(ne,ie,Z);break;case"round":F(ne,ie),ne?j(k,g,x,Z,0):j(k,C,O,Z,1);break;case"miter":case"miter-clip":default:const _e=$*t.strokeMiterLimit/oe;if(_e<1)if(t.strokeLineJoin!=="miter-clip"){D(ne,ie,Z);break}else F(ne,ie),ne?(b.subVectors(w,g).multiplyScalar(_e).add(g),A.subVectors(w,x).multiplyScalar(_e).add(x),N(g,Z,0),N(b,Z,0),N(k,Z,.5),N(k,Z,.5),N(b,Z,0),N(A,Z,0),N(k,Z,.5),N(A,Z,0),N(x,Z,0)):(b.subVectors(w,O).multiplyScalar(_e).add(O),A.subVectors(w,C).multiplyScalar(_e).add(C),N(O,Z,1),N(b,Z,1),N(k,Z,.5),N(k,Z,.5),N(b,Z,1),N(A,Z,1),N(k,Z,.5),N(A,Z,1),N(C,Z,1));else ie?(ne?(N(L,q,1),N(_,q,0),N(w,Z,0),N(L,q,1),N(w,Z,0),N(p,Z,1)):(N(L,q,1),N(_,q,0),N(w,Z,1),N(_,q,0),N(p,Z,0),N(w,Z,1)),ne?x.copy(w):C.copy(w)):ne?(N(g,Z,0),N(w,Z,0),N(k,Z,.5),N(k,Z,.5),N(w,Z,0),N(x,Z,0)):(N(O,Z,1),N(w,Z,1),N(k,Z,.5),N(k,Z,.5),N(w,Z,1),N(C,Z,1)),ce=!0;break}}else P()}else P();!T&&X===v-1&&R(e[0],I,S,ne,!0,q),q=Z,Q=k,_.copy(x),L.copy(C)}if(!T)R(k,g,O,ne,!1,Z);else if(ie&&r){let X=w,te=p;G!==ne&&(X=p,te=w),ne?(ce||G)&&(te.toArray(r,0*3),te.toArray(r,3*3),ce&&X.toArray(r,1*3)):(ce||!G)&&(te.toArray(r,1*3),te.toArray(r,3*3),ce&&X.toArray(r,0*3))}return V;function H(X,te,U){return U.subVectors(te,X),U.set(-U.y,U.x).normalize()}function N(X,te,U){r&&(r[M]=X.x,r[M+1]=X.y,r[M+2]=0,s&&(s[M]=0,s[M+1]=0,s[M+2]=1),M+=3,a&&(a[z]=te,a[z+1]=U,z+=2)),V+=3}function j(X,te,U,B,oe){f.copy(te).sub(X).normalize(),u.copy(U).sub(X).normalize();let le=Math.PI;const me=f.dot(u);Math.abs(me)<1&&(le=Math.abs(Math.acos(me))),le/=n,d.copy(te);for(let _e=0,we=n-1;_e<we;_e++)m.copy(d).rotateAround(X,le),N(d,B,oe),N(m,B,oe),N(X,B,.5),d.copy(m);N(m,B,oe),N(U,B,oe),N(X,B,.5)}function P(){N(L,q,1),N(_,q,0),N(g,Z,0),N(L,q,1),N(g,Z,1),N(O,Z,0)}function D(X,te,U){te?X?(N(L,q,1),N(_,q,0),N(g,Z,0),N(L,q,1),N(g,Z,0),N(p,Z,1),N(g,U,0),N(x,U,0),N(p,U,.5)):(N(L,q,1),N(_,q,0),N(O,Z,1),N(_,q,0),N(p,Z,0),N(O,Z,1),N(O,U,1),N(C,U,0),N(p,U,.5)):X?(N(g,U,0),N(x,U,0),N(k,U,.5)):(N(O,U,1),N(C,U,0),N(k,U,.5))}function F(X,te){te&&(X?(N(L,q,1),N(_,q,0),N(g,Z,0),N(L,q,1),N(g,Z,0),N(p,Z,1),N(g,q,0),N(k,Z,.5),N(p,Z,1),N(k,Z,.5),N(x,q,0),N(p,Z,1)):(N(L,q,1),N(_,q,0),N(O,Z,1),N(_,q,0),N(p,Z,0),N(O,Z,1),N(O,q,1),N(p,Z,0),N(k,Z,.5),N(k,Z,.5),N(p,Z,0),N(C,q,1)))}function R(X,te,U,B,oe,le){switch(t.strokeLineCap){case"round":oe?j(X,U,te,le,.5):j(X,te,U,le,.5);break;case"square":if(oe)f.subVectors(te,X),u.set(f.y,-f.x),d.addVectors(f,u).add(X),m.subVectors(u,f).add(X),B?(d.toArray(r,1*3),m.toArray(r,0*3),m.toArray(r,3*3)):(d.toArray(r,1*3),d.toArray(r,3*3),m.toArray(r,0*3));else{f.subVectors(U,X),u.set(f.y,-f.x),d.addVectors(f,u).add(X),m.subVectors(u,f).add(X);const me=r.length;B?(d.toArray(r,me-1*3),m.toArray(r,me-2*3),m.toArray(r,me-4*3)):(d.toArray(r,me-2*3),m.toArray(r,me-1*3),m.toArray(r,me-4*3))}break}}function W(X){let te=!1;for(let B=1,oe=X.length-1;B<oe;B++)if(X[B].distanceTo(X[B+1])<i){te=!0;break}if(!te)return X;const U=[];U.push(X[0]);for(let B=1,oe=X.length-1;B<oe;B++)X[B].distanceTo(X[B+1])>=i&&U.push(X[B]);return U.push(X[X.length-1]),U}}}const Xn=new WeakMap;class sa 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,n,i){const r=new c.FileLoader(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,s=>{const a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(s,a).then(t).catch(i)},n,i)}decodeDracoFile(e,t,n,i){const r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,r).then(t)}decodeGeometry(e,t){for(const l in t.attributeTypes){const f=t.attributeTypes[l];f.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=f.name)}const n=JSON.stringify(t);if(Xn.has(e)){const l=Xn.get(e);if(l.key===n)return l.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 i;const r=this.workerNextTaskID++,s=e.byteLength,a=this._getWorker(r,s).then(l=>(i=l,new Promise((f,u)=>{i._callbacks[r]={resolve:f,reject:u},i.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{i&&r&&this._releaseTask(i,r)}),Xn.set(e,{key:n,promise:a}),a}_createGeometry(e){const t=new c.BufferGeometry;e.index&&t.setIndex(new c.BufferAttribute(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const i=e.attributes[n],r=i.name,s=i.array,a=i.itemSize;t.setAttribute(r,new c.BufferAttribute(s,a))}return t}_loadLibrary(e,t){const n=new c.FileLoader(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((i,r)=>{n.load(e,i,void 0,r)})}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(n=>{const i=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const r=oa.toString(),s=["/* draco decoder */",i,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(`
|
|
79
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([s]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(r){const s=r.data;switch(s.type){case"decode":i._callbacks[s.id].resolve(s);break;case"error":i._callbacks[s.id].reject(s);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,r){return i._taskLoad>r._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_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 oa(){let o,e;onmessage=function(s){const a=s.data;switch(a.type){case"init":o=a.decoderConfig,e=new Promise(function(u){o.onModuleLoaded=function(d){u({draco:d})},DracoDecoderModule(o)});break;case"decode":const l=a.buffer,f=a.taskConfig;e.then(u=>{const d=u.draco,m=new d.Decoder,y=new d.DecoderBuffer;y.Init(new Int8Array(l),l.byteLength);try{const b=t(d,m,y,f),A=b.attributes.map(_=>_.array.buffer);b.index&&A.push(b.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:b},A)}catch(b){console.error(b),self.postMessage({type:"error",id:a.id,error:b.message})}finally{d.destroy(y),d.destroy(m)}});break}};function t(s,a,l,f){const u=f.attributeIDs,d=f.attributeTypes;let m,y;const b=a.GetEncodedGeometryType(l);if(b===s.TRIANGULAR_MESH)m=new s.Mesh,y=a.DecodeBufferToMesh(l,m);else if(b===s.POINT_CLOUD)m=new s.PointCloud,y=a.DecodeBufferToPointCloud(l,m);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!y.ok()||m.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+y.error_msg());const A={index:null,attributes:[]};for(const _ in u){const L=self[d[_]];let I,S;if(f.useUniqueIDs)S=u[_],I=a.GetAttributeByUniqueId(m,S);else{if(S=a.GetAttributeId(m,s[u[_]]),S===-1)continue;I=a.GetAttribute(m,S)}A.attributes.push(i(s,a,m,_,L,I))}return b===s.TRIANGULAR_MESH&&(A.index=n(s,a,m)),s.destroy(m),A}function n(s,a,l){const u=l.num_faces()*3,d=u*4,m=s._malloc(d);a.GetTrianglesUInt32Array(l,d,m);const y=new Uint32Array(s.HEAPF32.buffer,m,u).slice();return s._free(m),{array:y,itemSize:1}}function i(s,a,l,f,u,d){const m=d.num_components(),b=l.num_points()*m,A=b*u.BYTES_PER_ELEMENT,_=r(s,u),L=s._malloc(A);a.GetAttributeDataArrayForAllPoints(l,d,_,A,L);const I=new u(s.HEAPF32.buffer,L,b).slice();return s._free(L),{name:f,array:I,itemSize:m}}function r(s,a){switch(a){case Float32Array:return s.DT_FLOAT32;case Int8Array:return s.DT_INT8;case Int16Array:return s.DT_INT16;case Int32Array:return s.DT_INT32;case Uint8Array:return s.DT_UINT8;case Uint16Array:return s.DT_UINT16;case Uint32Array:return s.DT_UINT32}}}class tr extends c.Line{constructor(e,t){const n=[1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],i=new c.BufferGeometry;i.setAttribute("position",new c.Float32BufferAttribute(n,3)),i.computeBoundingSphere();const r=new c.LineBasicMaterial({fog:!1});super(i,r),this.light=e,this.color=t,this.type="RectAreaLightHelper";const s=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],a=new c.BufferGeometry;a.setAttribute("position",new c.Float32BufferAttribute(s,3)),a.computeBoundingSphere(),this.add(new c.Mesh(a,new c.MeshBasicMaterial({side:c.BackSide,fog:!1})))}updateMatrixWorld(){if(this.scale.set(.5*this.light.width,.5*this.light.height,1),this.color!==void 0)this.material.color.set(this.color),this.children[0].material.color.set(this.color);else{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);const e=this.material.color,t=Math.max(e.r,e.g,e.b);t>1&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)}this.matrixWorld.extractRotation(this.light.matrixWorld).scale(this.scale).copyPosition(this.light.matrixWorld),this.children[0].matrixWorld.copy(this.matrixWorld)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const aa=["args","center"],la=h.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(o,{expose:e}){let t,n;const i=o,{center:r,font:s,text:a,needUpdates:l,size:f,height:u,curveSegments:d,bevelEnabled:m,bevelThickness:y,bevelSize:b,bevelOffset:A,bevelSegments:_}=h.toRefs(i),{extend:L}=ae.useTresContext();L({TextGeometry:Yi});const I=new na,S=h.useSlots(),g=h.computed(()=>{var p;return a!=null&&a.value?a.value:S.default?(p=S.default()[0].children)==null?void 0:p.trim():l.value?"":"TresJS"}),O=h.shallowRef();e({value:O});const x=([t,n]=h.withAsyncContext(()=>new Promise((p,w)=>{try{typeof s.value=="string"?I.load(s.value,v=>{p(v)}):p(s.value)}catch(v){w(console.error("cientos",v))}})),t=await t,n(),t),C=h.computed(()=>({font:x,size:h.toValue(f),height:h.toValue(u),curveSegments:h.toValue(d),bevelEnabled:h.toValue(m),bevelThickness:h.toValue(y),bevelSize:h.toValue(b),bevelOffset:h.toValue(A),bevelSegments:h.toValue(_)}));return h.watchEffect(()=>{O.value&&l.value&&(O.value.geometry.dispose(),O.value.geometry=new Yi(g.value,C.value),r.value&&O.value.geometry.center())}),(p,w)=>h.unref(s)?(h.openBlock(),h.createElementBlock("TresMesh",{key:0,ref_key:"text3DRef",ref:O},[g.value?(h.openBlock(),h.createElementBlock("TresTextGeometry",{key:0,args:[g.value,C.value],center:h.unref(r)},null,8,aa)):h.createCommentVNode("",!0),h.renderSlot(p.$slots,"default")],512)):h.createCommentVNode("",!0)}});function ca(o,e){const t=h.ref(e),n=new c.AnimationMixer(t.value),i=h.shallowReactive({});o.forEach(s=>{const a=n.clipAction(s,t.value);i[s.name]=a});const{onLoop:r}=ae.useRenderLoop();return r(({delta:s})=>{n.update(s)}),{actions:i,mixer:n}}const ha=h.defineComponent({__name:"Levioso",props:{speed:{default:1},rotationFactor:{default:1},floatFactor:{default:1},range:{default:()=>[-.1,.1]}},setup(o,{expose:e}){const t=o,n=h.shallowRef();e({value:n});{const l=Math.random()*1e4,{onLoop:f}=ae.useRenderLoop();let u=l;f(({delta:d})=>{if(!n.value)return;u+=d*t.speed;const m=u*.25,y=n.value;y.rotation.x=Math.cos(m)*.125*t.rotationFactor,y.rotation.y=Math.sin(m)*.125*t.rotationFactor,y.rotation.z=Math.sin(m)*.05*t.rotationFactor,y.position.y=c.MathUtils.mapLinear(Math.sin(m),-1,1,t.range[0],t.range[1])*t.floatFactor})}return(i,r)=>(h.openBlock(),h.createElementBlock("TresGroup",h.mergeProps(i.$attrs,{ref_key:"groupRef",ref:n}),[h.renderSlot(i.$slots,"default")],16))}});class Et extends c.Mesh{constructor(e,t={}){super(e),this.isReflector=!0,this.type="Reflector",this.camera=new c.PerspectiveCamera;const n=this,i=t.color!==void 0?new c.Color(t.color):new c.Color(8355711),r=t.textureWidth||512,s=t.textureHeight||512,a=t.clipBias||0,l=t.shader||Et.ReflectorShader,f=t.multisample!==void 0?t.multisample:4,u=new c.Plane,d=new c.Vector3,m=new c.Vector3,y=new c.Vector3,b=new c.Matrix4,A=new c.Vector3(0,0,-1),_=new c.Vector4,L=new c.Vector3,I=new c.Vector3,S=new c.Vector4,g=new c.Matrix4,O=this.camera,x=new c.WebGLRenderTarget(r,s,{samples:f,type:c.HalfFloatType}),C=new c.ShaderMaterial({name:l.name!==void 0?l.name:"unspecified",uniforms:c.UniformsUtils.clone(l.uniforms),fragmentShader:l.fragmentShader,vertexShader:l.vertexShader});C.uniforms.tDiffuse.value=x.texture,C.uniforms.color.value=i,C.uniforms.textureMatrix.value=g,this.material=C,this.onBeforeRender=function(p,w,v){if(m.setFromMatrixPosition(n.matrixWorld),y.setFromMatrixPosition(v.matrixWorld),b.extractRotation(n.matrixWorld),d.set(0,0,1),d.applyMatrix4(b),L.subVectors(m,y),L.dot(d)>0)return;L.reflect(d).negate(),L.add(m),b.extractRotation(v.matrixWorld),A.set(0,0,-1),A.applyMatrix4(b),A.add(y),I.subVectors(m,A),I.reflect(d).negate(),I.add(m),O.position.copy(L),O.up.set(0,1,0),O.up.applyMatrix4(b),O.up.reflect(d),O.lookAt(I),O.far=v.far,O.updateMatrixWorld(),O.projectionMatrix.copy(v.projectionMatrix),g.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),g.multiply(O.projectionMatrix),g.multiply(O.matrixWorldInverse),g.multiply(n.matrixWorld),u.setFromNormalAndCoplanarPoint(d,m),u.applyMatrix4(O.matrixWorldInverse),_.set(u.normal.x,u.normal.y,u.normal.z,u.constant);const T=O.projectionMatrix;S.x=(Math.sign(_.x)+T.elements[8])/T.elements[0],S.y=(Math.sign(_.y)+T.elements[9])/T.elements[5],S.z=-1,S.w=(1+T.elements[10])/T.elements[14],_.multiplyScalar(2/_.dot(S)),T.elements[2]=_.x,T.elements[6]=_.y,T.elements[10]=_.z+1-a,T.elements[14]=_.w,n.visible=!1;const k=p.getRenderTarget(),Q=p.xr.enabled,Y=p.shadowMap.autoUpdate;p.xr.enabled=!1,p.shadowMap.autoUpdate=!1,p.setRenderTarget(x),p.state.buffers.depth.setMask(!0),p.autoClear===!1&&p.clear(),p.render(w,O),p.xr.enabled=Q,p.shadowMap.autoUpdate=Y,p.setRenderTarget(k);const $=v.viewport;$!==void 0&&p.state.viewport($),n.visible=!0},this.getRenderTarget=function(){return x},this.dispose=function(){x.dispose(),n.material.dispose()}}}Et.ReflectorShader={name:"ReflectorShader",uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:`
|
|
80
|
+
uniform mat4 textureMatrix;
|
|
81
|
+
varying vec4 vUv;
|
|
82
|
+
|
|
83
|
+
#include <common>
|
|
84
|
+
#include <logdepthbuf_pars_vertex>
|
|
85
|
+
|
|
86
|
+
void main() {
|
|
87
|
+
|
|
88
|
+
vUv = textureMatrix * vec4( position, 1.0 );
|
|
89
|
+
|
|
90
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
91
|
+
|
|
92
|
+
#include <logdepthbuf_vertex>
|
|
93
|
+
|
|
94
|
+
}`,fragmentShader:`
|
|
95
|
+
uniform vec3 color;
|
|
96
|
+
uniform sampler2D tDiffuse;
|
|
97
|
+
varying vec4 vUv;
|
|
98
|
+
|
|
99
|
+
#include <logdepthbuf_pars_fragment>
|
|
100
|
+
|
|
101
|
+
float blendOverlay( float base, float blend ) {
|
|
102
|
+
|
|
103
|
+
return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
vec3 blendOverlay( vec3 base, vec3 blend ) {
|
|
108
|
+
|
|
109
|
+
return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
void main() {
|
|
114
|
+
|
|
115
|
+
#include <logdepthbuf_fragment>
|
|
116
|
+
|
|
117
|
+
vec4 base = texture2DProj( tDiffuse, vUv );
|
|
118
|
+
gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
|
|
119
|
+
|
|
120
|
+
#include <tonemapping_fragment>
|
|
121
|
+
#include <colorspace_fragment>
|
|
122
|
+
|
|
123
|
+
}`};const ua=["args","material-uniforms-color-value"],fa=h.createElementVNode("TresPlaneGeometry",{args:[5,5]},null,-1),da=h.defineComponent({__name:"Reflector",props:{color:{default:"#333"},textureWidth:{default:512},textureHeight:{default:512},clipBias:{default:0},multisample:{default:4},shader:{default:Et.ReflectorShader}},setup(o,{expose:e}){const t=o,{extend:n}=ae.useTresContext(),i=h.shallowRef();n({Reflector:Et});const{color:r,textureWidth:s,textureHeight:a,clipBias:l,multisample:f,shader:u}=h.toRefs(t);return e({reflectorRef:i}),(d,m)=>(h.openBlock(),h.createElementBlock("TresReflector",{ref_key:"reflectorRef",ref:i,args:[void 0,{textureWidth:h.unref(s),textureHeight:h.unref(a),clipBias:h.unref(l),multisample:h.unref(f),shader:h.unref(u)}],"material-uniforms-color-value":h.unref(r)},[h.renderSlot(d.$slots,"default",{},()=>[fa])],8,ua))}});function nr(o){return h.getCurrentScope()?(h.onScopeDispose(o),!0):!1}function Re(o){return typeof o=="function"?o():h.unref(o)}const pa=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const ma=Object.prototype.toString,ga=o=>ma.call(o)==="[object Object]",wt=()=>{};function Wn(o,e){function t(...n){return new Promise((i,r)=>{Promise.resolve(o(()=>e.apply(this,n),{fn:e,thisArg:this,args:n})).then(i).catch(r)})}return t}const ya=o=>o();function _a(o,e={}){let t,n,i=wt;const r=a=>{clearTimeout(a),i(),i=wt};return a=>{const l=Re(o),f=Re(e.maxWait);return t&&r(t),l<=0||f!==void 0&&f<=0?(n&&(r(n),n=null),Promise.resolve(a())):new Promise((u,d)=>{i=e.rejectOnCancel?d:u,f&&!n&&(n=setTimeout(()=>{t&&r(t),n=null,u(a())},f)),t=setTimeout(()=>{n&&r(n),n=null,u(a())},l)})}}function ir(o,e=!0,t=!0,n=!1){let i=0,r,s=!0,a=wt,l;const f=()=>{r&&(clearTimeout(r),r=void 0,a(),a=wt)};return d=>{const m=Re(o),y=Date.now()-i,b=()=>l=d();return f(),m<=0?(i=Date.now(),b()):(y>m&&(t||!s)?(i=Date.now(),b()):e&&(l=new Promise((A,_)=>{a=n?_:A,r=setTimeout(()=>{i=Date.now(),s=!0,A(b()),f()},Math.max(0,m-y))})),!t&&!r&&(r=setTimeout(()=>s=!0,m)),s=!1,l)}}function va(o,e=200,t={}){return Wn(_a(e,t),o)}function wa(o,e=200,t=!1,n=!0,i=!1){return Wn(ir(e,t,n,i),o)}function xa(o,e,t={}){const{eventFilter:n=ya,...i}=t;return h.watch(o,Wn(n,e),i)}function rr(o,e=!0){h.getCurrentInstance()?h.onMounted(o):e?o():h.nextTick(o)}function ba(o,e,t={}){const{throttle:n=0,trailing:i=!0,leading:r=!0,...s}=t;return xa(o,e,{...s,eventFilter:ir(n,i,r)})}function Ma(o){var e;const t=Re(o);return(e=t==null?void 0:t.$el)!=null?e:t}const xt=pa?window:void 0;function Le(...o){let e,t,n,i;if(typeof o[0]=="string"||Array.isArray(o[0])?([t,n,i]=o,e=xt):[e,t,n,i]=o,!e)return wt;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const r=[],s=()=>{r.forEach(u=>u()),r.length=0},a=(u,d,m,y)=>(u.addEventListener(d,m,y),()=>u.removeEventListener(d,m,y)),l=h.watch(()=>[Ma(e),Re(i)],([u,d])=>{if(s(),!u)return;const m=ga(d)?{...d}:d;r.push(...t.flatMap(y=>n.map(b=>a(u,y,b,m))))},{immediate:!0,flush:"post"}),f=()=>{l(),s()};return nr(f),f}function Aa(o){return typeof o=="function"?o:typeof o=="string"?e=>e.key===o:Array.isArray(o)?e=>o.includes(e.key):()=>!0}function bt(...o){let e,t,n={};o.length===3?(e=o[0],t=o[1],n=o[2]):o.length===2?typeof o[1]=="object"?(e=!0,t=o[0],n=o[1]):(e=o[0],t=o[1]):(e=!0,t=o[0]);const{target:i=xt,eventName:r="keydown",passive:s=!1,dedupe:a=!1}=n,l=Aa(e);return Le(i,r,u=>{u.repeat&&Re(a)||l(u)&&t(u)},s)}function Sa(){const o=h.ref(!1);return h.getCurrentInstance()&&h.onMounted(()=>{o.value=!0}),o}function Pa(o){const e=Sa();return h.computed(()=>(e.value,!!o()))}function Ca(o,e={}){const{window:t=xt}=e,n=Pa(()=>t&&"matchMedia"in t&&typeof t.matchMedia=="function");let i;const r=h.ref(!1),s=f=>{r.value=f.matches},a=()=>{i&&("removeEventListener"in i?i.removeEventListener("change",s):i.removeListener(s))},l=h.watchEffect(()=>{n.value&&(a(),i=t.matchMedia(Re(o)),"addEventListener"in i?i.addEventListener("change",s):i.addListener(s),r.value=i.matches)});return nr(()=>{l(),a(),i=void 0}),r}const sr=1;function La(o,e={}){const{throttle:t=0,idle:n=200,onStop:i=wt,onScroll:r=wt,offset:s={left:0,right:0,top:0,bottom:0},eventListenerOptions:a={capture:!1,passive:!0},behavior:l="auto",window:f=xt}=e,u=h.ref(0),d=h.ref(0),m=h.computed({get(){return u.value},set(x){b(x,void 0)}}),y=h.computed({get(){return d.value},set(x){b(void 0,x)}});function b(x,C){var p,w,v;if(!f)return;const T=Re(o);T&&((v=T instanceof Document?f.document.body:T)==null||v.scrollTo({top:(p=Re(C))!=null?p:y.value,left:(w=Re(x))!=null?w:m.value,behavior:Re(l)}))}const A=h.ref(!1),_=h.reactive({left:!0,right:!1,top:!0,bottom:!1}),L=h.reactive({left:!1,right:!1,top:!1,bottom:!1}),I=x=>{A.value&&(A.value=!1,L.left=!1,L.right=!1,L.top=!1,L.bottom=!1,i(x))},S=va(I,t+n),g=x=>{var C;if(!f)return;const p=x.document?x.document.documentElement:(C=x.documentElement)!=null?C:x,{display:w,flexDirection:v}=getComputedStyle(p),T=p.scrollLeft;L.left=T<u.value,L.right=T>u.value;const k=Math.abs(T)<=0+(s.left||0),Q=Math.abs(T)+p.clientWidth>=p.scrollWidth-(s.right||0)-sr;w==="flex"&&v==="row-reverse"?(_.left=Q,_.right=k):(_.left=k,_.right=Q),u.value=T;let Y=p.scrollTop;x===f.document&&!Y&&(Y=f.document.body.scrollTop),L.top=Y<d.value,L.bottom=Y>d.value;const $=Math.abs(Y)<=0+(s.top||0),ee=Math.abs(Y)+p.clientHeight>=p.scrollHeight-(s.bottom||0)-sr;w==="flex"&&v==="column-reverse"?(_.top=ee,_.bottom=$):(_.top=$,_.bottom=ee),d.value=Y},O=x=>{var C;if(!f)return;const p=(C=x.target.documentElement)!=null?C:x.target;g(p),A.value=!0,S(x),r(x)};return Le(o,"scroll",t?wa(O,t,!0,!1):O,a),rr(()=>{const x=Re(o);x&&g(x)}),Le(o,"scrollend",I,a),{x:m,y,isScrolling:A,arrivedState:_,directions:L,measure(){const x=Re(o);f&&x&&g(x)}}}const Ta={page:o=>[o.pageX,o.pageY],client:o=>[o.clientX,o.clientY],screen:o=>[o.screenX,o.screenY],movement:o=>o instanceof Touch?null:[o.movementX,o.movementY]};function Oa(o={}){const{type:e="page",touch:t=!0,resetOnTouchEnds:n=!1,initialValue:i={x:0,y:0},window:r=xt,target:s=r,scroll:a=!0,eventFilter:l}=o;let f=null;const u=h.ref(i.x),d=h.ref(i.y),m=h.ref(null),y=typeof e=="function"?e:Ta[e],b=O=>{const x=y(O);f=O,x&&([u.value,d.value]=x,m.value="mouse")},A=O=>{if(O.touches.length>0){const x=y(O.touches[0]);x&&([u.value,d.value]=x,m.value="touch")}},_=()=>{if(!f||!r)return;const O=y(f);f instanceof MouseEvent&&O&&(u.value=O[0]+r.scrollX,d.value=O[1]+r.scrollY)},L=()=>{u.value=i.x,d.value=i.y},I=l?O=>l(()=>b(O),{}):O=>b(O),S=l?O=>l(()=>A(O),{}):O=>A(O),g=l?()=>l(()=>_(),{}):()=>_();if(s){const O={passive:!0};Le(s,["mousemove","dragover"],I,O),t&&e!=="movement"&&(Le(s,["touchstart","touchmove"],S,O),n&&Le(s,"touchend",L,O)),a&&e==="page"&&Le(r,"scroll",g,{passive:!0})}return{x:u,y:d,sourceType:m}}function Ia(o={}){const{window:e=xt,behavior:t="auto"}=o;if(!e)return{x:h.ref(0),y:h.ref(0)};const n=h.ref(e.scrollX),i=h.ref(e.scrollY),r=h.computed({get(){return n.value},set(a){scrollTo({left:a,behavior:t})}}),s=h.computed({get(){return i.value},set(a){scrollTo({top:a,behavior:t})}});return Le(e,"scroll",()=>{n.value=e.scrollX,i.value=e.scrollY},{capture:!1,passive:!0}),{x:r,y:s}}function or(o={}){const{window:e=xt,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:n=Number.POSITIVE_INFINITY,listenOrientation:i=!0,includeScrollbar:r=!0}=o,s=h.ref(t),a=h.ref(n),l=()=>{e&&(r?(s.value=e.innerWidth,a.value=e.innerHeight):(s.value=e.document.documentElement.clientWidth,a.value=e.document.documentElement.clientHeight))};if(l(),rr(l),Le("resize",l,{passive:!0}),i){const f=Ca("(orientation: portrait)");h.watch(f,()=>l())}return{width:s,height:a}}const Da=h.defineComponent({__name:"MouseParallax",props:{disabled:{type:Boolean,default:!1},factor:{default:2.5},ease:{default:.1}},setup(o){const e=o,{camera:t}=ae.useTresContext(),{disabled:n,factor:i,ease:r}=h.toRefs(e),{x:s,y:a}=Oa(),{width:l,height:f}=or(),u=h.ref(),d=h.computed(()=>(s.value/l.value-.5)*i.value),m=h.computed(()=>-(a.value/f.value-.5)*i.value),{onLoop:y}=ae.useRenderLoop();return y(({delta:b})=>{n.value||!u.value||(u.value.position.x+=(d.value-u.value.position.x)*r.value*b,u.value.position.y+=(m.value-u.value.position.y)*r.value*b)}),h.watch(()=>u.value,b=>b==null?void 0:b.add(t.value)),(b,A)=>(h.openBlock(),h.createElementBlock("TresGroup",{ref_key:"cameraGroupRef",ref:u},null,512))}}),ka=h.defineComponent({name:"GlobalAudio",props:["src","loop","volume","playbackRate","playTrigger","stopTrigger"],async setup(o,{expose:e,emit:t}){var d;const{camera:n,renderer:i}=ae.useTresContext(),r=new c.AudioListener;(d=n.value)==null||d.add(r);const s=new c.Audio(r),a=new c.AudioLoader;e({sound:s}),h.onUnmounted(()=>{s&&s.disconnect()}),h.watch(()=>[o.playbackRate],()=>s.setPlaybackRate(o.playbackRate??1),{immediate:!0}),h.watch(()=>[o.volume],()=>s.setVolume(o.volume??.5),{immediate:!0}),h.watch(()=>[o.loop],()=>s.setLoop(o.loop??!1),{immediate:!0}),h.watch(()=>[o.src],async()=>{const m=await a.loadAsync(o.src);s.setBuffer(m)},{immediate:!0});const l=document.getElementById(o.playTrigger??""),f=l||i.value.domElement;Le(f,"click",()=>{s.isPlaying?s.pause():s.play(),t("isPlaying",s.isPlaying)});const u=document.getElementById(o.stopTrigger??"");return u&&Le(u,"click",()=>{s.stop(),t("isPlaying",s.isPlaying)}),null}});class Yt extends c.Mesh{constructor(){super(Yt.Geometry,new c.MeshBasicMaterial({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const e=new c.Vector3,t=new c.Vector3,n=new c.FramebufferTexture(16,16),i=new c.FramebufferTexture(16,16);let r=c.UnsignedByteType;const s=Yt.Geometry,a=new c.RawShaderMaterial({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:`
|
|
80
124
|
|
|
81
125
|
precision highp float;
|
|
82
126
|
|
|
@@ -97,7 +141,7 @@
|
|
|
97
141
|
|
|
98
142
|
gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );
|
|
99
143
|
|
|
100
|
-
}`,depthTest:!0,depthWrite:!1,transparent:!1}),
|
|
144
|
+
}`,depthTest:!0,depthWrite:!1,transparent:!1}),l=new c.RawShaderMaterial({uniforms:{map:{value:n},scale:{value:null},screenPosition:{value:null}},vertexShader:`
|
|
101
145
|
|
|
102
146
|
precision highp float;
|
|
103
147
|
|
|
@@ -127,7 +171,7 @@
|
|
|
127
171
|
|
|
128
172
|
gl_FragColor = texture2D( map, vUV );
|
|
129
173
|
|
|
130
|
-
}`,depthTest:!1,depthWrite:!1,transparent:!1}),
|
|
174
|
+
}`,depthTest:!1,depthWrite:!1,transparent:!1}),f=new c.Mesh(s,a),u=[],d=ar.Shader,m=new c.RawShaderMaterial({name:d.name,uniforms:{map:{value:null},occlusionMap:{value:i},color:{value:new c.Color(16777215)},scale:{value:new c.Vector2},screenPosition:{value:new c.Vector3}},vertexShader:d.vertexShader,fragmentShader:d.fragmentShader,blending:c.AdditiveBlending,transparent:!0,depthWrite:!1}),y=new c.Mesh(s,m);this.addElement=function(I){u.push(I)};const b=new c.Vector2,A=new c.Vector2,_=new c.Box2,L=new c.Vector4;this.onBeforeRender=function(I,S,g){I.getCurrentViewport(L);const O=I.getRenderTarget(),x=O!==null?O.texture.type:c.UnsignedByteType;r!==x&&(n.dispose(),i.dispose(),n.type=i.type=x,r=x);const C=L.w/L.z,p=L.z/2,w=L.w/2;let v=16/L.w;if(b.set(v*C,v),_.min.set(L.x,L.y),_.max.set(L.x+(L.z-16),L.y+(L.w-16)),t.setFromMatrixPosition(this.matrixWorld),t.applyMatrix4(g.matrixWorldInverse),!(t.z>0)&&(e.copy(t).applyMatrix4(g.projectionMatrix),A.x=L.x+e.x*p+p-8,A.y=L.y+e.y*w+w-8,_.containsPoint(A))){I.copyFramebufferToTexture(A,n);let T=a.uniforms;T.scale.value=b,T.screenPosition.value=e,I.renderBufferDirect(g,null,s,a,f,null),I.copyFramebufferToTexture(A,i),T=l.uniforms,T.scale.value=b,T.screenPosition.value=e,I.renderBufferDirect(g,null,s,l,f,null);const k=-e.x*2,Q=-e.y*2;for(let Y=0,$=u.length;Y<$;Y++){const ee=u[Y],q=m.uniforms;q.color.value.copy(ee.color),q.map.value=ee.texture,q.screenPosition.value.x=e.x+k*ee.distance,q.screenPosition.value.y=e.y+Q*ee.distance,v=ee.size/L.w;const Z=L.w/L.z;q.scale.value.set(v*Z,v),m.uniformsNeedUpdate=!0,I.renderBufferDirect(g,null,s,m,y,null)}}},this.dispose=function(){a.dispose(),l.dispose(),m.dispose(),n.dispose(),i.dispose();for(let I=0,S=u.length;I<S;I++)u[I].texture.dispose()}}}class ar{constructor(e,t=1,n=0,i=new c.Color(16777215)){this.texture=e,this.size=t,this.distance=n,this.color=i}}ar.Shader={name:"LensflareElementShader",uniforms:{map:{value:null},occlusionMap:{value:null},color:{value:null},scale:{value:null},screenPosition:{value:null}},vertexShader:`
|
|
131
175
|
|
|
132
176
|
precision highp float;
|
|
133
177
|
|
|
@@ -181,12 +225,12 @@
|
|
|
181
225
|
gl_FragColor = texture;
|
|
182
226
|
gl_FragColor.rgb *= color;
|
|
183
227
|
|
|
184
|
-
}`},It.Geometry=function(){const a=new c.BufferGeometry,e=new Float32Array([-1,-1,0,0,0,1,-1,0,1,0,1,1,0,1,1,-1,1,0,0,1]),t=new c.InterleavedBuffer(e,5);return a.setIndex([0,1,2,0,2,3]),a.setAttribute("position",new c.InterleavedBufferAttribute(t,3,0,!1)),a.setAttribute("uv",new c.InterleavedBufferAttribute(t,2,3,!1)),a}();function Br(a){return a}function Ur(a){return a*a*a}function Vr(a){return a<.5?4*a*a*a:1-(-2*a+2)**3/2}function zr(a){return a*a*a*a}function Nr(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375}const Fs=c.MathUtils.clamp;class Bs{constructor(e=0,t){Me(this,"_getNext");Me(this,"_getGenerator");this._getGenerator=t??this.getMulberry32,this._getNext=this._getGenerator(e)}seed(e){this._getNext=this._getGenerator(e)}rand(){return this._getNext()}float(e,t){return e+this._getNext()*(t-e)}floatSpread(e){return this.float(-.5*e,.5*e)}int(e,t){return e+Math.floor(this._getNext()*(t-e+1))}choice(e){return e.length?e[Math.floor(this._getNext()*e.length)]:null}defaultChoice(e,t){return e.length?e[Math.floor(this._getNext()*e.length)]:t}sample(e,t,n){const s=e.length;t=Fs(t,0,s-1),n=Fs(n??s-1,0,s-1);const i=this.int(t,n),o=this.shuffle(e.map((l,f)=>f)),r=Math.min(e.length,i);return o.slice(0,r).sort().map(l=>e[l])}shuffle(e){return e.map(t=>({value:t,sort:this._getNext()})).sort((t,n)=>t.sort-n.sort).map(({value:t})=>t)}getMulberry32(e=0){return 0<e&&e<1&&(e=Math.floor(e*2**16)),()=>{e+=1831565813;let t=e;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}}const qe="https://raw.githubusercontent.com/Tresjs/assets/93976c7d63ac83d4a254a41a10b2362bc17e90c9/textures/lensflare/",On=`${qe}circle.png`,Zt=`${qe}circleBlur.png`,Gr=`${qe}circleRainbow.png`,Rr=`${qe}line.png`,Us=`${qe}poly6.png`,Vs=`${qe}polyStroke6.png`,jr=`${qe}rays.png`,Qt=`${qe}ring.png`,Er=`${qe}starThin6.png`,Xr={texture:[Rr,Qt],color:["white"],distance:[0,0],size:[750,1024],length:[0,2]},Yr={texture:[Zt],color:["white"],distance:[0,0],size:[180,512],length:[1,1]},Wr={texture:[jr],color:["white"],distance:[0,0],size:[180,512],length:[1,1]},Zr={texture:[On,Gr,Qt,Er],color:["white"],distance:[0,0],size:[180,512],length:[2,3]},[zs,Ns]=[3679071,132442],Dn=[Xr,Yr,Wr,Zr,{texture:[Zt,On,Qt,Us,Vs],color:["dimgray","gray","darkgray",zs,Ns],distance:[.5,2.5],size:[20,180],length:[5,21]},{texture:[Zt,On,Qt,Us,Vs],color:["dimgray","gray","darkgray",zs,Ns],distance:[-.6,-.1],size:[180,360],length:[0,5]}],Kt={color:"white",distance:0,size:512,texture:Zt},Gs=(a,e,t=void 0,n=void 0,s=Kt)=>{if(a!==void 0&&a.length>0&&(typeof t=="number"||typeof n<"u")){const r=js(t??0,n??Dn),l=r.length,f=a.length;return l>=f?r.map((d,u)=>Object.assign(d,e,u<f?a[u]:{})):a.map((d,u)=>Object.assign({},s,u<l?r[u]:{},e,d))}if(a!==void 0&&a.length>0){const r=Object.assign({},s,e);return a.map(l=>Object.assign({},r,l))}const i=n===void 0||n.length===0?Dn:n;return js(t??0,i).map(r=>Object.assign({},r,e))},Qr=[Br,Ur,Vr,zr,Nr],Rs=c.MathUtils.lerp,js=(a=0,e=Dn)=>{const n=new Bs(a).choice(Qr);return e.map((s,i)=>{const o=new Bs(a*(i*7907+1)+(typeof s.seed=="number"?s.seed:0)),r=o.int(s.length[0],s.length[1]);return new Array(r).fill(0).map(()=>{const l=n(o.rand());return{texture:o.defaultChoice(s.texture,Kt.texture),size:Rs(s.size[0],s.size[1],n(1-l)),distance:Rs(s.distance[0],s.distance[1],l),color:o.defaultChoice(s.color,Kt.color)}})}).flat()};function Kr(a){return qr(a,(e,t)=>t in Kt&&e!==void 0)}function qr(a,e){const t={};return Object.keys(a).forEach(n=>{e(a[n],n)&&(t[n]=a[n])}),t}const Jr=h.defineComponent({__name:"component",props:{texture:{},size:{},distance:{},color:{},elements:{default:void 0},scale:{default:1},seed:{default:void 0},seedProps:{default:void 0}},setup(a,{expose:e}){const t=a,n=h.shallowRef(),s=h.shallowRef([]),i=h.shallowRef(Kr(t));e({value:n});const o=new c.TextureLoader,r=new It,l=[],f=()=>{var g,x,w;for(;l.length;)l.pop();(g=n.value)==null||g.children.forEach(_=>{"dispose"in _&&_.dispose()}),(x=n.value)==null||x.remove(...n.value.children),(w=n.value)==null||w.dispose()},d=g=>{if(typeof g.texture=="string"){const x=g.texture;g.texture=o.load(x),g.texture.name=x}return g.color=ne.normalizeColor(g.color),g},u=()=>{for(;s.value.length>l.length;){const x={...d(s.value[l.length])};l.push(x),r.addElement(x)}s.value.forEach((g,x)=>{const w=l[x],{texture:_,size:M,distance:L,color:v}=g;if(typeof _=="string"){if(w.texture.name!==_){w.texture.dispose();const y=_;w.texture=o.load(y),w.texture.name=y}}else w.texture!==_&&(w.texture.dispose(),w.texture=_);w.size=M,w.distance=L,w.color=ne.normalizeColor(v)}),p()},p=()=>{for(let g=s.value.length-1;g<l.length;g++)l[g].size=0;s.value.forEach((g,x)=>{l[x].size=g.size*t.scale})};return h.onUnmounted(()=>{f()}),h.onMounted(()=>{var g;(g=n.value)==null||g.add(r),s.value=Gs(t.elements,i.value,t.seed,t.seedProps)}),h.watch(()=>[t.color,t.distance,t.size,t.texture],()=>{i.value={color:t.color,distance:t.distance,size:t.size,texture:t.texture}}),h.watch(()=>[i.value,t.elements,t.seed,t.seedProps],()=>{s.value=Gs(t.elements,i.value,t.seed,t.seedProps)}),h.watch(()=>t.scale,()=>{p()}),h.watch(()=>s.value,()=>{u()}),(g,x)=>(h.openBlock(),h.createElementBlock("TresGroup",{ref_key:"lensflareRef",ref:n},null,512))}});function Es(a){const e=h.ref(null),{height:t,width:n,settings:s,depth:i}=h.isReactive(a)?h.toRefs(a):h.toRefs(h.reactive(a)),{onLoop:o}=ne.useRenderLoop(),{camera:r,renderer:l,scene:f,sizes:d}=ne.useTresContext();return h.watchEffect(()=>{var u;(u=e.value)==null||u.dispose(),e.value=new c.WebGLRenderTarget((n==null?void 0:n.value)||d.width.value,(t==null?void 0:t.value)||d.height.value,{minFilter:c.LinearFilter,magFilter:c.LinearFilter,type:c.HalfFloatType,...s==null?void 0:s.value}),i!=null&&i.value&&(e.value.depthTexture=new c.DepthTexture((n==null?void 0:n.value)||d.width.value,(t==null?void 0:t.value)||d.height.value,c.FloatType))}),o(()=>{l.value.setRenderTarget(e.value),l.value.clear(),l.value.render(f.value,r.value),l.value.setRenderTarget(null)}),h.onBeforeUnmount(()=>{var u;(u=e.value)==null||u.dispose()}),e}const Hr=h.defineComponent({__name:"component",props:{width:{},height:{},depth:{type:Boolean,default:!1},settings:{default:void 0}},setup(a,{expose:e}){const n=Es(a);return e({value:n}),()=>{}}}),qt={sunset:"venice/venice_sunset_1k.hdr",studio:"studio/poly_haven_studio_1k.hdr",city:"city/canary_wharf_1k.hdr",umbrellas:"outdoor/outdoor_umbrellas_1k.hdr",night:"outdoor/satara_night_1k.hdr",forest:"outood/mossy_forest_1k.hdr",snow:"outdoor/snowy_forest_path_01_1k.hdr",dawn:"kiara/kiara_1_dawn_1k.hdr",hangar:"indoor/small_hangar_01_1k.hdr",urban:"indoor/abandoned_games_room_02_1k.hdr",modern:"city/modern_buildings_2_1k.hdr",shangai:"city/shanghai_bund_1k.hdr"},$r="https://raw.githubusercontent.com/Tresjs/assets/main/textures/hdr/";async function Xs(a){const{scene:e}=ne.useTresContext(),{preset:t,blur:n,files:s=[],path:i="",background:o}=h.toRefs(a),r=h.ref(),l=h.computed(()=>Array.isArray(s.value)),f=h.computed(()=>l.value?c.CubeTextureLoader:Ls),d=h.ref(null);return h.watch(()=>[s,i],async([u,p])=>{if(u.value.length>0&&!t.value){try{d.value=await ne.useLoader(h.unref(f),l.value?[h.unref(u)]:h.unref(u),g=>{p.value&&g.setPath(h.unref(p))})}catch(g){throw new Error(`Failed to load environment map: ${g}`)}d.value&&(r.value=l.value?d.value[0]:d.value,r.value.mapping=l.value?c.CubeReflectionMapping:c.EquirectangularReflectionMapping)}},{immediate:!0}),h.watch(()=>r.value,u=>{e.value&&(e.value.environment=u)},{immediate:!0}),h.watch(()=>[o.value,r.value],([u,p])=>{e.value&&(e.value.background=u?p:void 0)},{immediate:!0}),h.watch(()=>n==null?void 0:n.value,u=>{e.value&&(e.value.backgroundBlurriness=u)},{immediate:!0}),h.watch(t,async u=>{if(u&&u in qt){const p=$r,g=qt[u];try{d.value=await ne.useLoader(Ls,g,x=>{p&&x.setPath(p)})}catch(x){throw new Error(`Failed to load environment map: ${x}`)}d.value&&(r.value=d.value,r.value.mapping=c.EquirectangularReflectionMapping)}else if(u&&!(u in qt))throw new Error(`Preset must be one of: ${Object.keys(qt).join(", ")}`)},{immediate:!0}),{texture:r}}let Jt=null;function ea(a,e){return t=>{e&&e(t),a.draco&&(Jt||(Jt=new hr),Jt.setDecoderPath(a.decoderPath||"https://www.gstatic.com/draco/versioned/decoders/1.4.3/"),t.setDRACOLoader(Jt))}}async function Ys(a,e={draco:!1},t){return await ne.useLoader(io,a,ea(e,t))}const ta=["object"],na=h.defineComponent({__name:"component",props:{path:{},draco:{type:Boolean,default:!1},decoderPath:{default:"https://www.gstatic.com/draco/versioned/decoders/1.4.1/"}},async setup(a,{expose:e}){let t,n;const s=a,i=h.ref();e({value:i});const{scene:o}=([t,n]=h.withAsyncContext(()=>Ys(s.path,{draco:s.draco,decoderPath:s.decoderPath})),t=await t,n(),t);return(r,l)=>(h.openBlock(),h.createElementBlock("primitive",h.mergeProps({ref_key:"modelRef",ref:i,object:h.unref(o)},r.$attrs),null,16,ta))}});async function Ws(a){return await ne.useLoader(Zo,a)}const sa=["object"],ia=h.defineComponent({__name:"component",props:{path:{}},async setup(a,{expose:e}){let t,n;const s=a,i=h.ref();e({value:i});const o=([t,n]=h.withAsyncContext(()=>Ws(s.path)),t=await t,n(),t);return(r,l)=>(h.openBlock(),h.createElementBlock("primitive",h.mergeProps({ref_key:"modelRef",ref:i,object:h.unref(o)},r.$attrs),null,16,sa))}}),oa=["geometry","render-order"],ra=h.defineComponent({__name:"component",props:{src:{},skipStrokes:{type:Boolean,default:!1},skipFills:{type:Boolean,default:!1},fillMaterial:{},strokeMaterial:{},fillMeshProps:{},strokeMeshProps:{},depth:{default:"renderOrder"}},setup(a,{expose:e}){const t=a,{src:n,skipStrokes:s,skipFills:i,fillMaterial:o,strokeMaterial:r,fillMeshProps:l,strokeMeshProps:f,depth:d}=h.toRefs(t),u=h.shallowRef(),p=h.shallowRef([]),g=h.shallowRef([]);e({value:u}),h.watchEffect(async()=>x(n.value).then(M=>g.value=M.paths)),h.watch([i,s,o,r,g],_);async function x(M){const L=M.startsWith("<svg")?encodeURI(`data:image/svg+xml;utf8,${M}`):M;return ne.useLoader(Dt,L)}h.onUnmounted(w);function w(){p.value.forEach(M=>M.geometry.dispose())}function _(){var A,S,b;w();const M=[],[L,v]=(()=>{const P={flat:!1,renderOrder:!1,offsetZ:!0},O={flat:0,renderOrder:0,offsetZ:.025},k=d.value;return typeof k=="number"?[!0,k]:[P[k],O[k]]})();let y=0;for(const P of g.value){const O=((A=P.userData)==null?void 0:A.style)??{},k=Object.assign({color:O.fill,opacity:O.fillOpacity,transparent:!0,side:c.DoubleSide,depthWrite:L},t.fillMaterial);if(!i.value&&O.fill!==void 0&&O.fill!=="none")for(const V of Dt.createShapes(P)){const R=new c.ShapeGeometry(V);R.scale(1,-1,1),v&&R.translate(0,0,y++*v),M.push({geometry:R,material:k,isStroke:!1})}if(!s.value&&O.stroke!==void 0&&O.stroke!=="none"){const V=Object.assign({color:(S=P.userData)==null?void 0:S.style.stroke,opacity:(b=P.userData)==null?void 0:b.style.strokeOpacity,transparent:!0,side:c.DoubleSide,depthWrite:L},t.strokeMaterial);for(const R of P.subPaths){const X=R.getPoints().map(H=>new c.Vector2(H.x,-H.y)),K=Dt.pointsToStroke(X,O||"none");v&&K.translate(0,0,y++*v),M.push({geometry:K,material:V,isStroke:!0})}}}p.value=M}return(M,L)=>(h.openBlock(),h.createElementBlock("TresGroup",{ref_key:"svgRef",ref:u},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(p.value,({geometry:v,material:y,isStroke:A},S)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({key:`${S}`},A?h.unref(f):h.unref(l),{geometry:v,"render-order":h.unref(d)==="renderOrder"?S:0}),[h.createElementVNode("TresMeshBasicMaterial",h.normalizeProps(h.guardReactiveProps(y)),null,16)],16,oa))),128))],512))}}),Zs="[TresJS - Cientos ▲ ■ ♥] ";function In(){function a(n,s){console.error(`${Zs} ${n}`,s||"")}function e(n){console.warn(`${Zs} ${n}`)}function t(n,s){}return{logError:a,logWarning:e,logMessage:t}}let kn=0;function aa(){const a=h.ref(!1),e=h.ref(0),t=h.ref([]),{logError:n}=In();return new Promise(s=>{c.DefaultLoadingManager.onStart=()=>{a.value=!1},c.DefaultLoadingManager.onLoad=()=>{a.value=!0},c.DefaultLoadingManager.onProgress=(i,o,r)=>{o===r&&(kn=r,a.value=!0,t.value.push(i)),e.value=Math.round((o-kn)/(r-kn)*100||100,2)},c.DefaultLoadingManager.onError=i=>{n("Error loading assets",new Error(i)),a.value=!0},s({items:t,hasFinishLoading:a,progress:e})})}async function la(a,e){const{logError:t}=In();if(!a)return t("Error no path provided");const{unsuspend:n,start:s,crossOrigin:i,muted:o,loop:r,...l}={unsuspend:"loadedmetadata",crossOrigin:"Anonymous",muted:!0,loop:!0,start:!0,playsInline:!0,...e};function f(){return new Promise((d,u)=>{const p=Object.assign(document.createElement("video"),{src:typeof a=="string"&&a||void 0,crossOrigin:i,loop:r,muted:o,autoplay:!0,...l}),g=new c.VideoTexture(p);return p.addEventListener(n,()=>d(g)),p.addEventListener("error",()=>u()),g})}try{const d=await f();return s&&d.image&&d.image.play(),d}catch{t("Error loading resource")}}const ca=["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"],ha=h.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(a,{expose:e,emit:t}){const n=a,{makeDefault:s,autoRotate:i,autoRotateSpeed:o,enableDamping:r,dampingFactor:l,enablePan:f,keyPanSpeed:d,maxAzimuthAngle:u,minAzimuthAngle:p,maxPolarAngle:g,minPolarAngle:x,minDistance:w,maxDistance:_,minZoom:M,maxZoom:L,enableZoom:v,zoomSpeed:y,enableRotate:A,touches:S,rotateSpeed:b,target:P}=h.toRefs(n),{camera:O,renderer:k,extend:V,controls:R}=ne.useTresContext(),X=h.ref(null);V({OrbitControls:us}),h.watch(X,he=>{K(),he&&s.value?R.value=he:R.value=null});function K(){Ae(X.value,"change",()=>t("change",X.value)),Ae(X.value,"start",()=>t("start",X.value)),Ae(X.value,"end",()=>t("end",X.value))}const{onLoop:H}=ne.useRenderLoop();return H(()=>{X.value&&(r.value||i.value)&&X.value.update()}),h.onUnmounted(()=>{X.value&&X.value.dispose()}),e({value:X}),(he,J)=>(he.camera||h.unref(O))&&(he.domElement||h.unref(k))?(h.openBlock(),h.createElementBlock("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:X,target:h.unref(P),"auto-rotate":h.unref(i),"auto-rotate-speed":h.unref(o),"enable-damping":h.unref(r),"damping-factor":h.unref(l),"enable-pan":h.unref(f),"key-pan-speed":h.unref(d),keys:he.keys,"max-azimuth-angle":h.unref(u),"min-azimuth-angle":h.unref(p),"max-polar-angle":h.unref(g),"min-polar-angle":h.unref(x),"min-distance":h.unref(w),"max-distance":h.unref(_),"min-zoom":h.unref(M),"max-zoom":h.unref(L),touches:h.unref(S),"enable-zoom":h.unref(v),"zoom-speed":h.unref(y),"enable-rotate":h.unref(A),"rotate-speed":h.unref(b),args:[he.camera||h.unref(O),he.domElement||h.unref(k).domElement]},null,8,ca)):h.createCommentVNode("",!0)}}),ua=5,da=6,fa=.3,pa=h.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(a){var k;const e=a,{forward:t,back:n,left:s,right:i,jump:o,gravity:r,moveSpeed:l,headBobbing:f,is2D:d}=h.toRefs(e),{camera:u,controls:p}=ne.useTresContext(),g=h.ref(0),x=h.ref(0),w=h.ref(!1),_=h.ref(!1),M=h.ref(0),L=h.shallowRef(),v=d.value?"y":"z",y=((k=u.value.position)==null?void 0:k.y)||0;ft(t.value,()=>{w.value=!0,x.value=l.value},{eventName:"keydown"}),ft(n.value,()=>{w.value=!0,x.value=-l.value},{eventName:"keydown"}),ft([...t.value,...n.value],()=>{w.value=!1,x.value=0},{eventName:"keyup"}),ft(s.value,()=>{w.value=!0,g.value=-l.value},{eventName:"keydown"}),ft(i.value,()=>{w.value=!0,g.value=l.value},{eventName:"keydown"}),ft([...s.value,...i.value],()=>{w.value=!1,g.value=0},{eventName:"keyup"}),ft(o.value,()=>{_.value||(M.value=Date.now()),_.value=!0});const A=V=>w.value?Math.sin(V*ua)*fa+y:y,S=()=>(Date.now()-M.value)/1e3*3,b=V=>y+da*V-.5*r.value*V**2,P=()=>{if(_.value){const V=b(S());return V<=y&&(_.value=!1),V}return 0},{onLoop:O}=ne.useRenderLoop();return O(({elapsed:V})=>{var R;p.value instanceof vn&&((R=p.value)!=null&&R.isLocked)?(p.value.moveForward(x.value),p.value.moveRight(g.value),u.value.position&&(u.value.position.y=f.value?A(V):y,u.value.position.y+=P())):L.value.children.length>0&&!(p.value instanceof vn)&&(L.value.position.x+=g.value,L.value.position[v]+=d.value?x.value:-x.value)}),(V,R)=>(h.openBlock(),h.createElementBlock("TresGroup",{ref_key:"wrapperRef",ref:L},[h.renderSlot(V.$slots,"default")],512))}}),ma=["object","args","mode","enabled","axis","translation-snap","rotation-snap","scale-snap","space","size","show-x","show-y","show-z"],ga=h.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(a,{emit:e}){const t=a,{object:n,mode:s,enabled:i,axis:o,translationSnap:r,rotationSnap:l,scaleSnap:f,space:d,size:u,showX:p,showY:g,showZ:x}=h.toRefs(t),w=h.shallowRef(),{controls:_,camera:M,renderer:L,extend:v}=ne.useTresContext();v({TransformControls:Wi});const y=S=>{_.value&&(_.value.enabled=!S.value),e("dragging",S.value)};function A(){Ae(w.value,"change",()=>e("change")),Ae(w.value,"dragging-changed",y),Ae(w.value,"mouseDown",()=>e("mouseDown")),Ae(w.value,"mouseUp",()=>e("mouseUp")),Ae(w.value,"objectChange",()=>e("objectChange"))}return h.watchEffect(()=>{w.value&&A()}),h.onUnmounted(()=>{w.value&&w.value.dispose()}),(S,b)=>h.unref(M)&&h.unref(L)?(h.openBlock(),h.createElementBlock("TresTransformControls",{key:0,ref_key:"controlsRef",ref:w,object:h.unref(n),args:[h.unref(M),h.unref(L).domElement],mode:h.unref(s),enabled:h.unref(i),axis:h.unref(o),"translation-snap":h.unref(r),"rotation-snap":h.unref(l),"scale-snap":h.unref(f),space:h.unref(d),size:h.unref(u),"show-x":h.unref(p),"show-y":h.unref(g),"show-z":h.unref(x),visible:!0},null,8,ma)):h.createCommentVNode("",!0)}}),ya=["args"],_a=h.defineComponent({__name:"PointerLockControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},selector:{}},emits:["isLock"],setup(a,{expose:e,emit:t}){const n=a,{camera:s,renderer:i,extend:o,controls:r}=ne.useTresContext(),l=h.ref(null);let f;o({PointerLockControls:vn});const d=u=>{t("isLock",u)};return h.watch(l,u=>{u&&n.makeDefault?r.value=u:r.value=null;const p=document.getElementById(n.selector||"");f=p||i.value.domElement,Ae(f,"click",()=>{var g,x,w;(g=r.value)==null||g.lock(),(x=r.value)==null||x.addEventListener("lock",()=>d(!0)),(w=r.value)==null||w.addEventListener("unlock",()=>d(!1))})}),h.onUnmounted(()=>{var u,p;(u=r.value)==null||u.removeEventListener("lock",()=>d(!0)),(p=r.value)==null||p.removeEventListener("unlock",()=>d(!1)),l.value&&l.value.dispose()}),e({value:r}),(u,p)=>(u.camera||h.unref(s))&&(u.domElement||h.unref(i))?(h.openBlock(),h.createElementBlock("TresPointerLockControls",{key:0,ref_key:"controlsRef",ref:l,args:[u.camera||h.unref(s),u.domElement||h.unref(i).domElement]},null,8,ya)):h.createCommentVNode("",!0)}}),va=["args"],xa=h.defineComponent({__name:"MapControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{}},setup(a){const e=a,{camera:t,renderer:n,extend:s,controls:i}=ne.useTresContext(),o=h.ref(null);return s({MapControls:so}),h.watch(i,r=>{r&&e.makeDefault?i.value=r:i.value=null}),h.onUnmounted(()=>{o.value&&o.value.dispose()}),(r,l)=>(r.camera||h.unref(t))&&(r.domElement||h.unref(n))?(h.openBlock(),h.createElementBlock("TresMapControls",{key:0,ref_key:"controlsRef",ref:o,args:[r.camera||h.unref(t),r.domElement||h.unref(n).domElement]},null,8,va)):h.createCommentVNode("",!0)}}),wa=h.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(a,{emit:e}){const t=a,{logWarning:n}=ne.useLogger();t.smoothScroll<0&&n("SmoothControl must be greater than zero"),t.pages<0&&n("Pages must be greater than zero");const{camera:s,controls:i,renderer:o}=ne.useTresContext(),r=h.shallowRef(),l=document.createElement("div"),{y:f}=Ir(),{x:d,y:u,isScrolling:p}=Tr(l),{height:g,width:x}=Is();let w=0;const _=h.ref(!1),M=h.ref(0),L=h.ref(0),v=h.ref(0),y=t.horizontal?"x":"y",A=h.watch(s,b=>{if(_.value){A();return}w=t.horizontal?(b==null?void 0:b.position.x)||0:(b==null?void 0:b.position.y)||0,_.value=!0},{immediate:!0});h.watch(p,b=>{i.value&&(i.value.enabled=!b)},{immediate:!0}),h.watch(f,b=>{!p.value&&!t.htmlScroll||(L.value=b/g.value/(v.value/g.value-1),M.value=-1*L.value,e("update:modelValue",L.value))}),h.watch(u,b=>{L.value=b/g.value/(v.value/g.value),M.value=-1*L.value,e("update:modelValue",L.value)}),h.watch(d,b=>{L.value=b/x.value/(v.value/x.value-1),M.value=+L.value,e("update:modelValue",L.value)}),h.watch(o,b=>{var O,k;const P=b==null?void 0:b.domElement;if(t.htmlScroll&&(b!=null&&b.domElement))P!=null&&P.style.width&&(P!=null&&P.style.position)&&(P!=null&&P.style.top)&&(P!=null&&P.style.left)&&(P.style.width="100%",P.style.position="fixed",P.style.zIndex=" -99999",P.style.top="0",P.style.left="0"),v.value=document.body.scrollHeight;else{const V=document.createElement("div"),R=document.createElement("div");l.style[t.horizontal?"overflowX":"overflowY"]="auto",l.style[t.horizontal?"overflowY":"overflowX"]="hidden",l.style.position="absolute",l.style.width="100%",l.style.height=" 100%",l.style.top="0",l.style.left="0",l.classList.add("scrollContainer"),V.style.position="sticky",V.style.top="0px",V.style.left="0px",V.style.width="100%",V.style.height="100%",V.style.overflow="hidden",l.appendChild(V),R.style.height=t.horizontal?"100%":`${g.value*t.pages}px`,R.style.width=t.horizontal?`${x.value*t.pages}px`:"100vw",R.style.pointerEvents="none",P.style.position="fixed",P.style.zIndex="0",P!=null&&P.style.width&&(P.style.width="100%"),l.appendChild(R),b.domElement.parentNode.style.position="relative",(k=(O=b==null?void 0:b.domElement)==null?void 0:O.parentNode)==null||k.appendChild(l),v.value=t.horizontal?x.value*t.pages:g.value*t.pages}},{immediate:!0});const{onLoop:S}=ne.useRenderLoop();return S(()=>{var b;if((b=s.value)!=null&&b.position){const P=(M.value*t.distance-s.value.position[y]+w)*t.smoothScroll;s.value.position[y]+=P,r.value.children.length>0&&(r.value.position[y]+=P)}}),(b,P)=>(h.openBlock(),h.createElementBlock("TresGroup",{ref_key:"wrapperRef",ref:r},[h.renderSlot(b.$slots,"default")],512))}});/*!
|
|
228
|
+
}`},Yt.Geometry=function(){const o=new c.BufferGeometry,e=new Float32Array([-1,-1,0,0,0,1,-1,0,1,0,1,1,0,1,1,-1,1,0,0,1]),t=new c.InterleavedBuffer(e,5);return o.setIndex([0,1,2,0,2,3]),o.setAttribute("position",new c.InterleavedBufferAttribute(t,3,0,!1)),o.setAttribute("uv",new c.InterleavedBufferAttribute(t,2,3,!1)),o}();function Fa(o){return o}function Ba(o){return o*o*o}function Ua(o){return o<.5?4*o*o*o:1-(-2*o+2)**3/2}function Na(o){return o*o*o*o}function Va(o){return o<1/2.75?7.5625*o*o:o<2/2.75?7.5625*(o-=1.5/2.75)*o+.75:o<2.5/2.75?7.5625*(o-=2.25/2.75)*o+.9375:7.5625*(o-=2.625/2.75)*o+.984375}const lr=c.MathUtils.clamp;class cr{constructor(e=0,t){ye(this,"_getNext");ye(this,"_getGenerator");this._getGenerator=t??this.getMulberry32,this._getNext=this._getGenerator(e)}seed(e){this._getNext=this._getGenerator(e)}rand(){return this._getNext()}float(e,t){return e+this._getNext()*(t-e)}floatSpread(e){return this.float(-.5*e,.5*e)}int(e,t){return e+Math.floor(this._getNext()*(t-e+1))}choice(e){return e.length?e[Math.floor(this._getNext()*e.length)]:null}defaultChoice(e,t){return e.length?e[Math.floor(this._getNext()*e.length)]:t}sample(e,t,n){const i=e.length;t=lr(t,0,i-1),n=lr(n??i-1,0,i-1);const r=this.int(t,n),s=this.shuffle(e.map((l,f)=>f)),a=Math.min(e.length,r);return s.slice(0,a).sort().map(l=>e[l])}shuffle(e){return e.map(t=>({value:t,sort:this._getNext()})).sort((t,n)=>t.sort-n.sort).map(({value:t})=>t)}getMulberry32(e=0){return 0<e&&e<1&&(e=Math.floor(e*2**16)),()=>{e+=1831565813;let t=e;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}}const nt="https://raw.githubusercontent.com/Tresjs/assets/93976c7d63ac83d4a254a41a10b2362bc17e90c9/textures/lensflare/",Zn=`${nt}circle.png`,cn=`${nt}circleBlur.png`,za=`${nt}circleRainbow.png`,ja=`${nt}line.png`,hr=`${nt}poly6.png`,ur=`${nt}polyStroke6.png`,Ga=`${nt}rays.png`,hn=`${nt}ring.png`,Ra=`${nt}starThin6.png`,Ea={texture:[ja,hn],color:["white"],distance:[0,0],size:[750,1024],length:[0,2]},Ya={texture:[cn],color:["white"],distance:[0,0],size:[180,512],length:[1,1]},Xa={texture:[Ga],color:["white"],distance:[0,0],size:[180,512],length:[1,1]},Wa={texture:[Zn,za,hn,Ra],color:["white"],distance:[0,0],size:[180,512],length:[2,3]},[fr,dr]=[3679071,132442],qn=[Ea,Ya,Xa,Wa,{texture:[cn,Zn,hn,hr,ur],color:["dimgray","gray","darkgray",fr,dr],distance:[.5,2.5],size:[20,180],length:[5,21]},{texture:[cn,Zn,hn,hr,ur],color:["dimgray","gray","darkgray",fr,dr],distance:[-.6,-.1],size:[180,360],length:[0,5]}],un={color:"white",distance:0,size:512,texture:cn},pr=(o,e,t=void 0,n=void 0,i=un)=>{if(o!==void 0&&o.length>0&&(typeof t=="number"||typeof n<"u")){const a=gr(t??0,n??qn),l=a.length,f=o.length;return l>=f?a.map((u,d)=>Object.assign(u,e,d<f?o[d]:{})):o.map((u,d)=>Object.assign({},i,d<l?a[d]:{},e,u))}if(o!==void 0&&o.length>0){const a=Object.assign({},i,e);return o.map(l=>Object.assign({},a,l))}const r=n===void 0||n.length===0?qn:n;return gr(t??0,r).map(a=>Object.assign({},a,e))},Za=[Fa,Ba,Ua,Na,Va],mr=c.MathUtils.lerp,gr=(o=0,e=qn)=>{const n=new cr(o).choice(Za);return e.map((i,r)=>{const s=new cr(o*(r*7907+1)+(typeof i.seed=="number"?i.seed:0)),a=s.int(i.length[0],i.length[1]);return new Array(a).fill(0).map(()=>{const l=n(s.rand());return{texture:s.defaultChoice(i.texture,un.texture),size:mr(i.size[0],i.size[1],n(1-l)),distance:mr(i.distance[0],i.distance[1],l),color:s.defaultChoice(i.color,un.color)}})}).flat()};function qa(o){return Ka(o,(e,t)=>t in un&&e!==void 0)}function Ka(o,e){const t={};return Object.keys(o).forEach(n=>{e(o[n],n)&&(t[n]=o[n])}),t}const Qa=h.defineComponent({__name:"component",props:{scale:{default:1},elements:{default:void 0},seed:{default:void 0},seedProps:{default:void 0},color:{default:void 0},distance:{default:void 0},size:{default:void 0},texture:{default:void 0}},setup(o,{expose:e}){const t=o,n=h.shallowRef(),i=h.shallowRef([]),r=h.shallowRef(qa(t));e({value:n});const s=new c.TextureLoader,a=new Yt,l=[],f=()=>{var y,b,A;for(;l.length;)l.pop();(y=n.value)==null||y.children.forEach(_=>{"dispose"in _&&_.dispose()}),(b=n.value)==null||b.remove(...n.value.children),(A=n.value)==null||A.dispose()},u=y=>{if(typeof y.texture=="string"){const b=y.texture;y.texture=s.load(b),y.texture.name=b}return y.color=ae.normalizeColor(y.color),y},d=()=>{for(;i.value.length>l.length;){const b={...u(i.value[l.length])};l.push(b),a.addElement(b)}i.value.forEach((y,b)=>{const A=l[b],{texture:_,size:L,distance:I,color:S}=y;if(typeof _=="string"){if(A.texture.name!==_){A.texture.dispose();const g=_;A.texture=s.load(g),A.texture.name=g}}else A.texture!==_&&(A.texture.dispose(),A.texture=_);A.size=L,A.distance=I,A.color=ae.normalizeColor(S)}),m()},m=()=>{for(let y=i.value.length-1;y<l.length;y++)l[y].size=0;i.value.forEach((y,b)=>{l[b].size=y.size*t.scale})};return h.onUnmounted(()=>{f()}),h.onMounted(()=>{var y;(y=n.value)==null||y.add(a),i.value=pr(t.elements,r.value,t.seed,t.seedProps)}),h.watch(()=>[t.color,t.distance,t.size,t.texture],()=>{r.value={color:t.color,distance:t.distance,size:t.size,texture:t.texture}}),h.watch(()=>[r.value,t.elements,t.seed,t.seedProps],()=>{i.value=pr(t.elements,r.value,t.seed,t.seedProps)}),h.watch(()=>t.scale,()=>{m()}),h.watch(()=>i.value,()=>{d()}),(y,b)=>(h.openBlock(),h.createElementBlock("TresGroup",{ref_key:"lensflareRef",ref:n},null,512))}});function yr(o){const e=h.ref(null),{height:t,width:n,settings:i,depth:r}=h.isReactive(o)?h.toRefs(o):h.toRefs(h.reactive(o)),{onLoop:s}=ae.useRenderLoop(),{camera:a,renderer:l,scene:f,sizes:u}=ae.useTresContext();return h.watchEffect(()=>{var d;(d=e.value)==null||d.dispose(),e.value=new c.WebGLRenderTarget((n==null?void 0:n.value)||u.width.value,(t==null?void 0:t.value)||u.height.value,{minFilter:c.LinearFilter,magFilter:c.LinearFilter,type:c.HalfFloatType,...i==null?void 0:i.value}),r!=null&&r.value&&(e.value.depthTexture=new c.DepthTexture((n==null?void 0:n.value)||u.width.value,(t==null?void 0:t.value)||u.height.value,c.FloatType))}),s(()=>{l.value.setRenderTarget(e.value),l.value.clear(),l.value.render(f.value,a.value),l.value.setRenderTarget(null)}),h.onBeforeUnmount(()=>{var d;(d=e.value)==null||d.dispose()}),e}const Ja=h.defineComponent({__name:"component",props:{width:{},height:{},depth:{type:Boolean,default:!1},settings:{default:void 0}},setup(o,{expose:e}){const n=yr(o);return e({value:n}),()=>{}}}),_r=(o,e=16,t,n,i)=>{const r=new Float32Array(e*16),s=h.ref(new c.InterleavedBuffer(r,16));return(()=>{if(!o)return;const l=new Vs(o);n&&l.setWeightAttribute(n),l.build();const f=new c.Vector3,u=new c.Vector3,d=new c.Color,m=new c.Object3D;o.updateMatrixWorld(!0);for(let y=0;y<e;y++)l.sample(f,u,d),typeof i=="function"?i({dummy:m,sampledMesh:o,position:f,normal:u,color:d},y):m.position.copy(f),m.updateMatrix(),t&&t.setMatrixAt(y,m.matrix),m.matrix.toArray(s.value.array,y*16);t&&(t.instanceMatrix.needsUpdate=!0),s.value.needsUpdate=!0})(),{buffer:s}},Ha=h.defineComponent({__name:"component",props:{transform:{type:Function},weight:{},count:{},mesh:{},instanceMesh:{}},setup(o,{expose:e}){const t=o,n=h.ref(),i=h.ref(),r=h.ref();return h.watchEffect(()=>{var s,a;i.value=t.instanceMesh??((s=n.value)==null?void 0:s.children.find(l=>l.hasOwnProperty("instanceMatrix"))),r.value=t.mesh??((a=n.value)==null?void 0:a.children.find(l=>l.type==="Mesh")),_r(r.value,t.count,i.value,t.weight,t.transform)}),e({samplerRef:n}),(s,a)=>(h.openBlock(),h.createElementBlock("TresGroup",{ref_key:"samplerRef",ref:n},[h.renderSlot(s.$slots,"default")],512))}}),fn={sunset:"venice/venice_sunset_1k.hdr",studio:"studio/poly_haven_studio_1k.hdr",city:"city/canary_wharf_1k.hdr",umbrellas:"outdoor/outdoor_umbrellas_1k.hdr",night:"outdoor/satara_night_1k.hdr",forest:"outood/mossy_forest_1k.hdr",snow:"outdoor/snowy_forest_path_01_1k.hdr",dawn:"kiara/kiara_1_dawn_1k.hdr",hangar:"indoor/small_hangar_01_1k.hdr",urban:"indoor/abandoned_games_room_02_1k.hdr",modern:"city/modern_buildings_2_1k.hdr",shangai:"city/shanghai_bund_1k.hdr"},$a="https://raw.githubusercontent.com/Tresjs/assets/main/textures/hdr/";async function vr(o){const{scene:e}=ae.useTresContext(),{preset:t,blur:n,files:i=[],path:r="",background:s}=h.toRefs(o),a=h.ref(),l=h.computed(()=>Array.isArray(i.value)),f=h.computed(()=>l.value?c.CubeTextureLoader:er),u=h.ref(null);return h.watch(()=>[i,r],async([d,m])=>{if(d.value.length>0&&!t.value){try{u.value=await ae.useLoader(h.unref(f),l.value?[h.unref(d)]:h.unref(d),y=>{m.value&&y.setPath(h.unref(m))})}catch(y){throw new Error(`Failed to load environment map: ${y}`)}u.value&&(a.value=l.value?u.value[0]:u.value,a.value.mapping=l.value?c.CubeReflectionMapping:c.EquirectangularReflectionMapping)}},{immediate:!0}),h.watch(()=>a.value,d=>{e.value&&(e.value.environment=d)},{immediate:!0}),h.watch(()=>[s.value,a.value],([d,m])=>{e.value&&(e.value.background=d?m:void 0)},{immediate:!0}),h.watch(()=>n==null?void 0:n.value,d=>{e.value&&(e.value.backgroundBlurriness=d)},{immediate:!0}),h.watch(t,async d=>{if(d&&d in fn){const m=$a,y=fn[d];try{u.value=await ae.useLoader(er,y,b=>{m&&b.setPath(m)})}catch(b){throw new Error(`Failed to load environment map: ${b}`)}u.value&&(a.value=u.value,a.value.mapping=c.EquirectangularReflectionMapping)}else if(d&&!(d in fn))throw new Error(`Preset must be one of: ${Object.keys(fn).join(", ")}`)},{immediate:!0}),{texture:a}}let dn=null;function el(o,e){return t=>{e&&e(t),o.draco&&(dn||(dn=new sa),dn.setDecoderPath(o.decoderPath||"https://www.gstatic.com/draco/versioned/decoders/1.4.3/"),t.setDRACOLoader(dn))}}async function wr(o,e={draco:!1},t){return await ae.useLoader($s,o,el(e,t))}const tl=["object"],nl=h.defineComponent({__name:"component",props:{path:{},draco:{type:Boolean,default:!1},decoderPath:{default:"https://www.gstatic.com/draco/versioned/decoders/1.4.1/"}},async setup(o,{expose:e}){let t,n;const i=o,r=h.ref();e({value:r});const{scene:s}=([t,n]=h.withAsyncContext(()=>wr(i.path,{draco:i.draco,decoderPath:i.decoderPath})),t=await t,n(),t);return(a,l)=>(h.openBlock(),h.createElementBlock("primitive",h.mergeProps({ref_key:"modelRef",ref:r,object:h.unref(s)},a.$attrs),null,16,tl))}});async function xr(o){return await ae.useLoader(Ro,o)}const il=["object"],rl=h.defineComponent({__name:"component",props:{path:{}},async setup(o,{expose:e}){let t,n;const i=o,r=h.ref();e({value:r});const s=([t,n]=h.withAsyncContext(()=>xr(i.path)),t=await t,n(),t);return(a,l)=>(h.openBlock(),h.createElementBlock("primitive",h.mergeProps({ref_key:"modelRef",ref:r,object:h.unref(s)},a.$attrs),null,16,il))}}),sl=["geometry","render-order"],ol=h.defineComponent({__name:"component",props:{src:{},skipStrokes:{type:Boolean,default:!1},skipFills:{type:Boolean,default:!1},fillMaterial:{},strokeMaterial:{},fillMeshProps:{},strokeMeshProps:{},depth:{default:"renderOrder"}},setup(o,{expose:e}){const t=o,{src:n,skipStrokes:i,skipFills:r,fillMaterial:s,strokeMaterial:a,fillMeshProps:l,strokeMeshProps:f,depth:u}=h.toRefs(t),d=h.shallowRef(),m=h.shallowRef([]),y=h.shallowRef([]);e({value:d}),h.watchEffect(async()=>b(n.value).then(L=>y.value=L.paths)),h.watch([r,i,s,a,y],_);async function b(L){const I=L.startsWith("<svg")?encodeURI(`data:image/svg+xml;utf8,${L}`):L;return ae.useLoader(Rt,I)}h.onUnmounted(A);function A(){m.value.forEach(L=>L.geometry.dispose())}function _(){var O,x,C;A();const L=[],[I,S]=(()=>{const p={flat:!1,renderOrder:!1,offsetZ:!0},w={flat:0,renderOrder:0,offsetZ:.025},v=u.value;return typeof v=="number"?[!0,v]:[p[v],w[v]]})();let g=0;for(const p of y.value){const w=((O=p.userData)==null?void 0:O.style)??{},v=Object.assign({color:w.fill,opacity:w.fillOpacity,transparent:!0,side:c.DoubleSide,depthWrite:I},t.fillMaterial);if(!r.value&&w.fill!==void 0&&w.fill!=="none")for(const T of Rt.createShapes(p)){const k=new c.ShapeGeometry(T);k.scale(1,-1,1),S&&k.translate(0,0,g++*S),L.push({geometry:k,material:v,isStroke:!1})}if(!i.value&&w.stroke!==void 0&&w.stroke!=="none"){const T=Object.assign({color:(x=p.userData)==null?void 0:x.style.stroke,opacity:(C=p.userData)==null?void 0:C.style.strokeOpacity,transparent:!0,side:c.DoubleSide,depthWrite:I},t.strokeMaterial);for(const k of p.subPaths){const Q=k.getPoints().map($=>new c.Vector2($.x,-$.y)),Y=Rt.pointsToStroke(Q,w||"none");S&&Y.translate(0,0,g++*S),L.push({geometry:Y,material:T,isStroke:!0})}}}m.value=L}return(L,I)=>(h.openBlock(),h.createElementBlock("TresGroup",{ref_key:"svgRef",ref:d},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(m.value,({geometry:S,material:g,isStroke:O},x)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({key:`${x}`},O?h.unref(f):h.unref(l),{geometry:S,"render-order":h.unref(u)==="renderOrder"?x:0}),[h.createElementVNode("TresMeshBasicMaterial",h.normalizeProps(h.guardReactiveProps(g)),null,16)],16,sl))),128))],512))}}),br="[TresJS - Cientos ▲ ■ ♥] ";function Kn(){function o(n,i){console.error(`${br} ${n}`,i||"")}function e(n){console.warn(`${br} ${n}`)}function t(n,i){}return{logError:o,logWarning:e,logMessage:t}}let Qn=0;function al(){const o=h.ref(!1),e=h.ref(0),t=h.ref([]),{logError:n}=Kn();return new Promise(i=>{c.DefaultLoadingManager.onStart=()=>{o.value=!1},c.DefaultLoadingManager.onLoad=()=>{o.value=!0},c.DefaultLoadingManager.onProgress=(r,s,a)=>{s===a&&(Qn=a,o.value=!0,t.value.push(r)),e.value=Math.round((s-Qn)/(a-Qn)*100||100,2)},c.DefaultLoadingManager.onError=r=>{n("Error loading assets",new Error(r)),o.value=!0},i({items:t,hasFinishLoading:o,progress:e})})}async function ll(o,e){const{logError:t}=Kn();if(!o)return t("Error no path provided");const{unsuspend:n,start:i,crossOrigin:r,muted:s,loop:a,...l}={unsuspend:"loadedmetadata",crossOrigin:"Anonymous",muted:!0,loop:!0,start:!0,playsInline:!0,...e};function f(){return new Promise((u,d)=>{const m=Object.assign(document.createElement("video"),{src:typeof o=="string"&&o||void 0,crossOrigin:r,loop:a,muted:s,autoplay:!0,...l}),y=new c.VideoTexture(m);return m.addEventListener(n,()=>u(y)),m.addEventListener("error",()=>d()),y})}try{const u=await f();return i&&u.image&&u.image.play(),u}catch{t("Error loading resource")}}const cl=["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"],hl=h.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(o,{expose:e,emit:t}){const n=o,i=t,{makeDefault:r,autoRotate:s,autoRotateSpeed:a,enableDamping:l,dampingFactor:f,enablePan:u,keyPanSpeed:d,maxAzimuthAngle:m,minAzimuthAngle:y,maxPolarAngle:b,minPolarAngle:A,minDistance:_,maxDistance:L,minZoom:I,maxZoom:S,enableZoom:g,zoomSpeed:O,enableRotate:x,touches:C,rotateSpeed:p,target:w}=h.toRefs(n),{camera:v,renderer:T,extend:k,controls:Q}=ae.useTresContext(),Y=h.ref(null);k({OrbitControls:Ni}),h.watch(Y,q=>{$(),q&&r.value?Q.value=q:Q.value=null});function $(){Le(Y.value,"change",()=>i("change",Y.value)),Le(Y.value,"start",()=>i("start",Y.value)),Le(Y.value,"end",()=>i("end",Y.value))}const{onLoop:ee}=ae.useRenderLoop();return ee(()=>{Y.value&&(l.value||s.value)&&Y.value.update()}),h.onUnmounted(()=>{Y.value&&Y.value.dispose()}),e({value:Y}),(q,Z)=>(q.camera||h.unref(v))&&(q.domElement||h.unref(T))?(h.openBlock(),h.createElementBlock("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:Y,target:h.unref(w),"auto-rotate":h.unref(s),"auto-rotate-speed":h.unref(a),"enable-damping":h.unref(l),"damping-factor":h.unref(f),"enable-pan":h.unref(u),"key-pan-speed":h.unref(d),keys:q.keys,"max-azimuth-angle":h.unref(m),"min-azimuth-angle":h.unref(y),"max-polar-angle":h.unref(b),"min-polar-angle":h.unref(A),"min-distance":h.unref(_),"max-distance":h.unref(L),"min-zoom":h.unref(I),"max-zoom":h.unref(S),touches:h.unref(C),"enable-zoom":h.unref(g),"zoom-speed":h.unref(O),"enable-rotate":h.unref(x),"rotate-speed":h.unref(p),args:[q.camera||h.unref(v),q.domElement||h.unref(T).domElement]},null,8,cl)):h.createCommentVNode("",!0)}}),ul=5,fl=6,dl=.3,pl=h.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(o){var v;const e=o,{forward:t,back:n,left:i,right:r,jump:s,gravity:a,moveSpeed:l,headBobbing:f,is2D:u}=h.toRefs(e),{camera:d,controls:m}=ae.useTresContext(),y=h.ref(0),b=h.ref(0),A=h.ref(!1),_=h.ref(!1),L=h.ref(0),I=h.shallowRef(),S=u.value?"y":"z",g=((v=d.value.position)==null?void 0:v.y)||0;bt(t.value,()=>{A.value=!0,b.value=l.value},{eventName:"keydown"}),bt(n.value,()=>{A.value=!0,b.value=-l.value},{eventName:"keydown"}),bt([...t.value,...n.value],()=>{A.value=!1,b.value=0},{eventName:"keyup"}),bt(i.value,()=>{A.value=!0,y.value=-l.value},{eventName:"keydown"}),bt(r.value,()=>{A.value=!0,y.value=l.value},{eventName:"keydown"}),bt([...i.value,...r.value],()=>{A.value=!1,y.value=0},{eventName:"keyup"}),bt(s.value,()=>{_.value||(L.value=Date.now()),_.value=!0});const O=T=>A.value?Math.sin(T*ul)*dl+g:g,x=()=>(Date.now()-L.value)/1e3*3,C=T=>g+fl*T-.5*a.value*T**2,p=()=>{if(_.value){const T=C(x());return T<=g&&(_.value=!1),T}return 0},{onLoop:w}=ae.useRenderLoop();return w(({elapsed:T})=>{var k;m.value instanceof Bn&&((k=m.value)!=null&&k.isLocked)?(m.value.moveForward(b.value),m.value.moveRight(y.value),d.value.position&&(d.value.position.y=f.value?O(T):g,d.value.position.y+=p())):I.value.children.length>0&&!(m.value instanceof Bn)&&(I.value.position.x+=y.value,I.value.position[S]+=u.value?b.value:-b.value)}),(T,k)=>(h.openBlock(),h.createElementBlock("TresGroup",{ref_key:"wrapperRef",ref:I},[h.renderSlot(T.$slots,"default")],512))}}),ml=["object","args","mode","enabled","axis","translation-snap","rotation-snap","scale-snap","space","size","show-x","show-y","show-z"],gl=h.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(o,{emit:e}){const t=o,n=e,{object:i,mode:r,enabled:s,axis:a,translationSnap:l,rotationSnap:f,scaleSnap:u,space:d,size:m,showX:y,showY:b,showZ:A}=h.toRefs(t),_=h.shallowRef(),{controls:L,camera:I,renderer:S,extend:g}=ae.useTresContext();g({TransformControls:Gs});const O=C=>{L.value&&(L.value.enabled=!C.value),n("dragging",C.value)};function x(){Le(_.value,"change",()=>n("change")),Le(_.value,"dragging-changed",O),Le(_.value,"mouseDown",()=>n("mouseDown")),Le(_.value,"mouseUp",()=>n("mouseUp")),Le(_.value,"objectChange",()=>n("objectChange"))}return h.watchEffect(()=>{_.value&&x()}),h.onUnmounted(()=>{_.value&&_.value.dispose()}),(C,p)=>h.unref(I)&&h.unref(S)?(h.openBlock(),h.createElementBlock("TresTransformControls",{key:0,ref_key:"controlsRef",ref:_,object:h.unref(i),args:[h.unref(I),h.unref(S).domElement],mode:h.unref(r),enabled:h.unref(s),axis:h.unref(a),"translation-snap":h.unref(l),"rotation-snap":h.unref(f),"scale-snap":h.unref(u),space:h.unref(d),size:h.unref(m),"show-x":h.unref(y),"show-y":h.unref(b),"show-z":h.unref(A),visible:!0},null,8,ml)):h.createCommentVNode("",!0)}}),yl=["args"],_l=h.defineComponent({__name:"PointerLockControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},selector:{}},emits:["isLock","change"],setup(o,{expose:e,emit:t}){const n=o,i=t,{camera:r,renderer:s,extend:a,controls:l}=ae.useTresContext(),f=h.ref(null);let u;a({PointerLockControls:Bn});const d=m=>{i("isLock",m)};return h.watch(f,m=>{m&&n.makeDefault?l.value=m:l.value=null;const y=document.getElementById(n.selector||"");u=y||s.value.domElement,Le(l.value,"change",()=>i("change",l.value)),Le(u,"click",()=>{var b,A,_;(b=l.value)==null||b.lock(),(A=l.value)==null||A.addEventListener("lock",()=>d(!0)),(_=l.value)==null||_.addEventListener("unlock",()=>d(!1))})}),h.onUnmounted(()=>{var m,y;(m=l.value)==null||m.removeEventListener("lock",()=>d(!0)),(y=l.value)==null||y.removeEventListener("unlock",()=>d(!1)),f.value&&f.value.dispose()}),e({value:l}),(m,y)=>(m.camera||h.unref(r))&&(m.domElement||h.unref(s))?(h.openBlock(),h.createElementBlock("TresPointerLockControls",{key:0,ref_key:"controlsRef",ref:f,args:[m.camera||h.unref(r),m.domElement||h.unref(s).domElement]},null,8,yl)):h.createCommentVNode("",!0)}}),vl=["args"],wl=h.defineComponent({__name:"MapControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{}},setup(o){const e=o,{camera:t,renderer:n,extend:i,controls:r}=ae.useTresContext(),s=h.ref(null);return i({MapControls:Hs}),h.watch(r,a=>{a&&e.makeDefault?r.value=a:r.value=null}),h.onUnmounted(()=>{s.value&&s.value.dispose()}),(a,l)=>(a.camera||h.unref(t))&&(a.domElement||h.unref(n))?(h.openBlock(),h.createElementBlock("TresMapControls",{key:0,ref_key:"controlsRef",ref:s,args:[a.camera||h.unref(t),a.domElement||h.unref(n).domElement]},null,8,vl)):h.createCommentVNode("",!0)}}),xl=h.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(o,{emit:e}){const t=o,n=e,{logWarning:i}=ae.useLogger();t.smoothScroll<0&&i("SmoothControl must be greater than zero"),t.pages<0&&i("Pages must be greater than zero");const{camera:r,controls:s,renderer:a}=ae.useTresContext(),l=h.shallowRef(),f=document.createElement("div"),{y:u}=Ia(),{x:d,y:m,isScrolling:y}=La(f),{height:b,width:A}=or();let _=0;const L=h.ref(!1),I=h.ref(0),S=h.ref(0),g=h.ref(0),O=t.horizontal?"x":"y",x=h.watch(r,p=>{if(L.value){x();return}_=t.horizontal?(p==null?void 0:p.position.x)||0:(p==null?void 0:p.position.y)||0,L.value=!0},{immediate:!0});h.watch(y,p=>{s.value&&(s.value.enabled=!p)},{immediate:!0}),h.watch(u,p=>{!y.value&&!t.htmlScroll||(S.value=p/b.value/(g.value/b.value-1),I.value=-1*S.value,n("update:modelValue",S.value))}),h.watch(m,p=>{S.value=p/b.value/(g.value/b.value),I.value=-1*S.value,n("update:modelValue",S.value)}),h.watch(d,p=>{S.value=p/A.value/(g.value/A.value-1),I.value=+S.value,n("update:modelValue",S.value)}),h.watch(a,p=>{var v,T;const w=p==null?void 0:p.domElement;if(t.htmlScroll&&(p!=null&&p.domElement))w!=null&&w.style.width&&(w!=null&&w.style.position)&&(w!=null&&w.style.top)&&(w!=null&&w.style.left)&&(w.style.width="100%",w.style.position="fixed",w.style.zIndex=" -99999",w.style.top="0",w.style.left="0"),g.value=document.body.scrollHeight;else{const k=document.createElement("div"),Q=document.createElement("div");f.style[t.horizontal?"overflowX":"overflowY"]="auto",f.style[t.horizontal?"overflowY":"overflowX"]="hidden",f.style.position="absolute",f.style.width="100%",f.style.height=" 100%",f.style.top="0",f.style.left="0",f.classList.add("scrollContainer"),k.style.position="sticky",k.style.top="0px",k.style.left="0px",k.style.width="100%",k.style.height="100%",k.style.overflow="hidden",f.appendChild(k),Q.style.height=t.horizontal?"100%":`${b.value*t.pages}px`,Q.style.width=t.horizontal?`${A.value*t.pages}px`:"100vw",Q.style.pointerEvents="none",w.style.position="fixed",w.style.zIndex="0",w!=null&&w.style.width&&(w.style.width="100%"),f.appendChild(Q),p.domElement.parentNode.style.position="relative",(T=(v=p==null?void 0:p.domElement)==null?void 0:v.parentNode)==null||T.appendChild(f),g.value=t.horizontal?A.value*t.pages:b.value*t.pages}},{immediate:!0});const{onLoop:C}=ae.useRenderLoop();return C(()=>{var p;if((p=r.value)!=null&&p.position){const w=(I.value*t.distance-r.value.position[O]+_)*t.smoothScroll;r.value.position[O]+=w,l.value.children.length>0&&(l.value.position[O]+=w)}}),(p,w)=>(h.openBlock(),h.createElementBlock("TresGroup",{ref_key:"wrapperRef",ref:l},[h.renderSlot(p.$slots,"default")],512))}});/*!
|
|
185
229
|
* camera-controls
|
|
186
230
|
* https://github.com/yomotsu/camera-controls
|
|
187
231
|
* (c) 2017 @yomotsu
|
|
188
232
|
* Released under the MIT License.
|
|
189
|
-
*/const le={LEFT:1,RIGHT:2,MIDDLE:4},N=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}),bt={NONE:0,IN:1,OUT:-1};function pt(a){return a.isPerspectiveCamera}function rt(a){return a.isOrthographicCamera}const At=Math.PI*2,Qs=Math.PI/2,Ks=1e-5,kt=Math.PI/180;function je(a,e,t){return Math.max(e,Math.min(t,a))}function xe(a,e=Ks){return Math.abs(a)<e}function ve(a,e,t=Ks){return xe(a-e,t)}function qs(a,e){return Math.round(a/e)*e}function Ft(a){return isFinite(a)?a:a<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Bt(a){return Math.abs(a)<Number.MAX_VALUE?a:a*(1/0)}function Ht(a,e,t,n,s=1/0,i){n=Math.max(1e-4,n);const o=2/n,r=o*i,l=1/(1+r+.48*r*r+.235*r*r*r);let f=a-e;const d=e,u=s*n;f=je(f,-u,u),e=a-f;const p=(t.value+o*f)*i;t.value=(t.value-o*p)*l;let g=e+(f+p)*l;return d-a>0==g>d&&(g=d,t.value=(g-d)/i),g}function Js(a,e,t,n,s=1/0,i,o){n=Math.max(1e-4,n);const r=2/n,l=r*i,f=1/(1+l+.48*l*l+.235*l*l*l);let d=e.x,u=e.y,p=e.z,g=a.x-d,x=a.y-u,w=a.z-p;const _=d,M=u,L=p,v=s*n,y=v*v,A=g*g+x*x+w*w;if(A>y){const H=Math.sqrt(A);g=g/H*v,x=x/H*v,w=w/H*v}d=a.x-g,u=a.y-x,p=a.z-w;const S=(t.x+r*g)*i,b=(t.y+r*x)*i,P=(t.z+r*w)*i;t.x=(t.x-r*S)*f,t.y=(t.y-r*b)*f,t.z=(t.z-r*P)*f,o.x=d+(g+S)*f,o.y=u+(x+b)*f,o.z=p+(w+P)*f;const O=_-a.x,k=M-a.y,V=L-a.z,R=o.x-_,X=o.y-M,K=o.z-L;return O*R+k*X+V*K>0&&(o.x=_,o.y=M,o.z=L,t.x=(o.x-_)/i,t.y=(o.y-M)/i,t.z=(o.z-L)/i),o}function Fn(a,e){e.set(0,0),a.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=a.length,e.y/=a.length}function Bn(a,e){return rt(a)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class ba{constructor(){this._listeners={}}addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const s=this._listeners[e];if(s!==void 0){const i=s.indexOf(t);i!==-1&&s.splice(i,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const s=n.slice(0);for(let i=0,o=s.length;i<o;i++)s[i].call(this,e)}}}const Aa="2.7.2",$t=1/8,Hs=typeof window<"u",Ma=Hs&&/Mac/.test(navigator.platform),Sa=!(Hs&&"PointerEvent"in window);let re,$s,en,Un,Be,de,ye,Mt,Ut,Ye,We,mt,ei,ti,Ne,Vt,St,ni,Vn,si,zn,Nn,tn;class zt extends ba{static install(e){re=e.THREE,$s=Object.freeze(new re.Vector3(0,0,0)),en=Object.freeze(new re.Vector3(0,1,0)),Un=Object.freeze(new re.Vector3(0,0,1)),Be=new re.Vector2,de=new re.Vector3,ye=new re.Vector3,Mt=new re.Vector3,Ut=new re.Vector3,Ye=new re.Vector3,We=new re.Vector3,mt=new re.Vector3,ei=new re.Vector3,ti=new re.Vector3,Ne=new re.Spherical,Vt=new re.Spherical,St=new re.Box3,ni=new re.Box3,Vn=new re.Sphere,si=new re.Quaternion,zn=new re.Quaternion,Nn=new re.Matrix4,tn=new re.Raycaster}static get ACTION(){return N}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=N.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=bt.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new re.Vector3,this._focalOffsetVelocity=new re.Vector3,this._zoomVelocity={value:0},this._truckInternal=(y,A,S)=>{let b,P;if(pt(this._camera)){const O=de.copy(this._camera.position).sub(this._target),k=this._camera.getEffectiveFOV()*kt,V=O.length()*Math.tan(k*.5);b=this.truckSpeed*y*V/this._elementRect.height,P=this.truckSpeed*A*V/this._elementRect.height}else if(rt(this._camera)){const O=this._camera;b=y*(O.right-O.left)/O.zoom/this._elementRect.width,P=A*(O.top-O.bottom)/O.zoom/this._elementRect.height}else return;this.verticalDragToForward?(S?this.setFocalOffset(this._focalOffsetEnd.x+b,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(b,0,!0),this.forward(-P,!0)):S?this.setFocalOffset(this._focalOffsetEnd.x+b,this._focalOffsetEnd.y+P,this._focalOffsetEnd.z,!0):this.truck(b,P,!0)},this._rotateInternal=(y,A)=>{const S=At*this.azimuthRotateSpeed*y/this._elementRect.height,b=At*this.polarRotateSpeed*A/this._elementRect.height;this.rotate(S,b,!0)},this._dollyInternal=(y,A,S)=>{const b=Math.pow(.95,-y*this.dollySpeed),P=this._sphericalEnd.radius,O=this._sphericalEnd.radius*b,k=je(O,this.minDistance,this.maxDistance),V=k-O;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(O,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(V,!0),this._dollyToNoClamp(k,!0)):this._dollyToNoClamp(k,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?O:k)-P,this._dollyControlCoord.set(A,S)),this._lastDollyDirection=Math.sign(-y)},this._zoomInternal=(y,A,S)=>{const b=Math.pow(.95,y*this.dollySpeed),P=this._zoom,O=this._zoom*b;this.zoomTo(O,!0),this.dollyToCursor&&(this._changedZoom+=O-P,this._dollyControlCoord.set(A,S))},typeof re>"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 re.Quaternion().setFromUnitVectors(this._camera.up,en),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=N.NONE,this._target=new re.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new re.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new re.Spherical().setFromVector3(de.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 re.Vector3,new re.Vector3,new re.Vector3,new re.Vector3],this._updateNearPlaneCorners(),this._boundary=new re.Box3(new re.Vector3(-1/0,-1/0,-1/0),new re.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 re.Vector2,this.mouseButtons={left:N.ROTATE,middle:N.DOLLY,right:N.TRUCK,wheel:pt(this._camera)?N.DOLLY:rt(this._camera)?N.ZOOM:N.NONE},this.touches={one:N.TOUCH_ROTATE,two:pt(this._camera)?N.TOUCH_DOLLY_TRUCK:rt(this._camera)?N.TOUCH_ZOOM_TRUCK:N.NONE,three:N.TOUCH_TRUCK};const n=new re.Vector2,s=new re.Vector2,i=new re.Vector2,o=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 b=this._domElement.getBoundingClientRect(),P=y.clientX/b.width,O=y.clientY/b.height;if(P<this._interactiveArea.left||P>this._interactiveArea.right||O<this._interactiveArea.top||O>this._interactiveArea.bottom)return}const A=y.pointerType!=="mouse"?null:(y.buttons&le.LEFT)===le.LEFT?le.LEFT:(y.buttons&le.MIDDLE)===le.MIDDLE?le.MIDDLE:(y.buttons&le.RIGHT)===le.RIGHT?le.RIGHT:null;if(A!==null){const b=this._findPointerByMouseButton(A);b&&this._disposePointer(b)}if((y.buttons&le.LEFT)===le.LEFT&&this._lockedPointer)return;const S={pointerId:y.pointerId,clientX:y.clientX,clientY:y.clientY,deltaX:0,deltaY:0,mouseButton:A};this._activePointers.push(S),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",d),this._isDragging=!0,w(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 b=this._domElement.getBoundingClientRect(),P=y.clientX/b.width,O=y.clientY/b.height;if(P<this._interactiveArea.left||P>this._interactiveArea.right||O<this._interactiveArea.top||O>this._interactiveArea.bottom)return}const A=(y.buttons&le.LEFT)===le.LEFT?le.LEFT:(y.buttons&le.MIDDLE)===le.MIDDLE?le.MIDDLE:(y.buttons&le.RIGHT)===le.RIGHT?le.RIGHT:null;if(A!==null){const b=this._findPointerByMouseButton(A);b&&this._disposePointer(b)}const S={pointerId:1,clientX:y.clientX,clientY:y.clientY,deltaX:0,deltaY:0,mouseButton:(y.buttons&le.LEFT)===le.LEFT?le.LEFT:(y.buttons&le.MIDDLE)===le.LEFT?le.MIDDLE:(y.buttons&le.RIGHT)===le.LEFT?le.RIGHT:null};this._activePointers.push(S),this._domElement.ownerDocument.removeEventListener("mousemove",f),this._domElement.ownerDocument.removeEventListener("mouseup",u),this._domElement.ownerDocument.addEventListener("mousemove",f),this._domElement.ownerDocument.addEventListener("mouseup",u),this._isDragging=!0,w(y)},l=y=>{y.cancelable&&y.preventDefault();const A=y.pointerId,S=this._lockedPointer||this._findPointerById(A);if(S){if(S.clientX=y.clientX,S.clientY=y.clientY,S.deltaX=y.movementX,S.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&le.LEFT)===le.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(y.buttons&le.MIDDLE)===le.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(y.buttons&le.RIGHT)===le.RIGHT&&(this._state=this._state|this.mouseButtons.right);_()}},f=y=>{const A=this._lockedPointer||this._findPointerById(1);A&&(A.clientX=y.clientX,A.clientY=y.clientY,A.deltaX=y.movementX,A.deltaY=y.movementY,this._state=0,(this._lockedPointer||(y.buttons&le.LEFT)===le.LEFT)&&(this._state=this._state|this.mouseButtons.left),(y.buttons&le.MIDDLE)===le.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(y.buttons&le.RIGHT)===le.RIGHT&&(this._state=this._state|this.mouseButtons.right),_())},d=y=>{const A=this._findPointerById(y.pointerId);if(!(A&&A===this._lockedPointer)){if(A&&this._disposePointer(A),y.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=N.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=N.NONE;M()}},u=()=>{const y=this._findPointerById(1);y&&y===this._lockedPointer||(y&&this._disposePointer(y),this._state=N.NONE,M())};let p=-1;const g=y=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===N.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const O=this._domElement.getBoundingClientRect(),k=y.clientX/O.width,V=y.clientY/O.height;if(k<this._interactiveArea.left||k>this._interactiveArea.right||V<this._interactiveArea.top||V>this._interactiveArea.bottom)return}if(y.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===N.ROTATE||this.mouseButtons.wheel===N.TRUCK){const O=performance.now();p-O<1e3&&this._getClientRect(this._elementRect),p=O}const A=Ma?-1:-3,S=y.deltaMode===1?y.deltaY/A:y.deltaY/(A*10),b=this.dollyToCursor?(y.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,P=this.dollyToCursor?(y.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case N.ROTATE:{this._rotateInternal(y.deltaX,y.deltaY),this._isUserControllingRotate=!0;break}case N.TRUCK:{this._truckInternal(y.deltaX,y.deltaY,!1),this._isUserControllingTruck=!0;break}case N.OFFSET:{this._truckInternal(y.deltaX,y.deltaY,!0),this._isUserControllingOffset=!0;break}case N.DOLLY:{this._dollyInternal(-S,b,P),this._isUserControllingDolly=!0;break}case N.ZOOM:{this._zoomInternal(-S,b,P),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},x=y=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===zt.ACTION.NONE){const A=y instanceof PointerEvent?y.pointerId:(y instanceof MouseEvent,0),S=this._findPointerById(A);S&&this._disposePointer(S),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mousemove",f),this._domElement.ownerDocument.removeEventListener("mouseup",u);return}y.preventDefault()}},w=y=>{if(!this._enabled)return;if(Fn(this._activePointers,Be),this._getClientRect(this._elementRect),n.copy(Be),s.copy(Be),this._activePointers.length>=2){const S=Be.x-this._activePointers[1].clientX,b=Be.y-this._activePointers[1].clientY,P=Math.sqrt(S*S+b*b);i.set(0,P);const O=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,k=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;s.set(O,k)}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&le.LEFT)===le.LEFT&&(this._state=this._state|this.mouseButtons.left),(y.buttons&le.MIDDLE)===le.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(y.buttons&le.RIGHT)===le.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&N.ROTATE)===N.ROTATE||(this._state&N.TOUCH_ROTATE)===N.TOUCH_ROTATE||(this._state&N.TOUCH_DOLLY_ROTATE)===N.TOUCH_DOLLY_ROTATE||(this._state&N.TOUCH_ZOOM_ROTATE)===N.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&N.TRUCK)===N.TRUCK||(this._state&N.TOUCH_TRUCK)===N.TOUCH_TRUCK||(this._state&N.TOUCH_DOLLY_TRUCK)===N.TOUCH_DOLLY_TRUCK||(this._state&N.TOUCH_ZOOM_TRUCK)===N.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&N.DOLLY)===N.DOLLY||(this._state&N.TOUCH_DOLLY)===N.TOUCH_DOLLY||(this._state&N.TOUCH_DOLLY_TRUCK)===N.TOUCH_DOLLY_TRUCK||(this._state&N.TOUCH_DOLLY_OFFSET)===N.TOUCH_DOLLY_OFFSET||(this._state&N.TOUCH_DOLLY_ROTATE)===N.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&N.ZOOM)===N.ZOOM||(this._state&N.TOUCH_ZOOM)===N.TOUCH_ZOOM||(this._state&N.TOUCH_ZOOM_TRUCK)===N.TOUCH_ZOOM_TRUCK||(this._state&N.TOUCH_ZOOM_OFFSET)===N.TOUCH_ZOOM_OFFSET||(this._state&N.TOUCH_ZOOM_ROTATE)===N.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&N.OFFSET)===N.OFFSET||(this._state&N.TOUCH_OFFSET)===N.TOUCH_OFFSET||(this._state&N.TOUCH_DOLLY_OFFSET)===N.TOUCH_DOLLY_OFFSET||(this._state&N.TOUCH_ZOOM_OFFSET)===N.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},_=()=>{if(!this._enabled)return;Fn(this._activePointers,Be);const A=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,S=A?-A.deltaX:s.x-Be.x,b=A?-A.deltaY:s.y-Be.y;if(s.copy(Be),((this._state&N.ROTATE)===N.ROTATE||(this._state&N.TOUCH_ROTATE)===N.TOUCH_ROTATE||(this._state&N.TOUCH_DOLLY_ROTATE)===N.TOUCH_DOLLY_ROTATE||(this._state&N.TOUCH_ZOOM_ROTATE)===N.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(S,b),this._isUserControllingRotate=!0),(this._state&N.DOLLY)===N.DOLLY||(this._state&N.ZOOM)===N.ZOOM){const P=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,O=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0,k=this.dollyDragInverted?-1:1;(this._state&N.DOLLY)===N.DOLLY?(this._dollyInternal(k*b*$t,P,O),this._isUserControllingDolly=!0):(this._zoomInternal(k*b*$t,P,O),this._isUserControllingZoom=!0)}if((this._state&N.TOUCH_DOLLY)===N.TOUCH_DOLLY||(this._state&N.TOUCH_ZOOM)===N.TOUCH_ZOOM||(this._state&N.TOUCH_DOLLY_TRUCK)===N.TOUCH_DOLLY_TRUCK||(this._state&N.TOUCH_ZOOM_TRUCK)===N.TOUCH_ZOOM_TRUCK||(this._state&N.TOUCH_DOLLY_OFFSET)===N.TOUCH_DOLLY_OFFSET||(this._state&N.TOUCH_ZOOM_OFFSET)===N.TOUCH_ZOOM_OFFSET||(this._state&N.TOUCH_DOLLY_ROTATE)===N.TOUCH_DOLLY_ROTATE||(this._state&N.TOUCH_ZOOM_ROTATE)===N.TOUCH_ZOOM_ROTATE){const P=Be.x-this._activePointers[1].clientX,O=Be.y-this._activePointers[1].clientY,k=Math.sqrt(P*P+O*O),V=i.y-k;i.set(0,k);const R=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,X=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&N.TOUCH_DOLLY)===N.TOUCH_DOLLY||(this._state&N.TOUCH_DOLLY_ROTATE)===N.TOUCH_DOLLY_ROTATE||(this._state&N.TOUCH_DOLLY_TRUCK)===N.TOUCH_DOLLY_TRUCK||(this._state&N.TOUCH_DOLLY_OFFSET)===N.TOUCH_DOLLY_OFFSET?(this._dollyInternal(V*$t,R,X),this._isUserControllingDolly=!0):(this._zoomInternal(V*$t,R,X),this._isUserControllingZoom=!0)}((this._state&N.TRUCK)===N.TRUCK||(this._state&N.TOUCH_TRUCK)===N.TOUCH_TRUCK||(this._state&N.TOUCH_DOLLY_TRUCK)===N.TOUCH_DOLLY_TRUCK||(this._state&N.TOUCH_ZOOM_TRUCK)===N.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(S,b,!1),this._isUserControllingTruck=!0),((this._state&N.OFFSET)===N.OFFSET||(this._state&N.TOUCH_OFFSET)===N.TOUCH_OFFSET||(this._state&N.TOUCH_DOLLY_OFFSET)===N.TOUCH_DOLLY_OFFSET||(this._state&N.TOUCH_ZOOM_OFFSET)===N.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(S,b,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},M=()=>{Fn(this._activePointers,Be),s.copy(Be),(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",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",f),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mouseup",u),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",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",L),this._domElement.ownerDocument.addEventListener("pointerlockerror",v),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",d),w())},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",v))};const L=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},v=()=>{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",o),Sa&&this._domElement.addEventListener("mousedown",r),this._domElement.addEventListener("pointercancel",d),this._domElement.addEventListener("wheel",g,{passive:!1}),this._domElement.addEventListener("contextmenu",x)},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",d),this._domElement.removeEventListener("wheel",g,{passive:!1}),this._domElement.removeEventListener("contextmenu",x),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",f),this._domElement.ownerDocument.removeEventListener("pointerup",d),this._domElement.ownerDocument.removeEventListener("mouseup",u),this._domElement.ownerDocument.removeEventListener("pointerlockchange",L),this._domElement.ownerDocument.removeEventListener("pointerlockerror",v))},this.cancel=()=>{this._state!==N.NONE&&(this._state=N.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=je(e.width,0,1),this._interactiveArea.height=je(e.height,0,1),this._interactiveArea.x=je(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=je(e.x,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,n=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,n)}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,n=!1){this._isUserControllingRotate=!1;const s=je(e,this.minAzimuthAngle,this.maxAzimuthAngle),i=je(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=s,this._sphericalEnd.phi=i,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,n||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!n||ve(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&ve(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=bt.NONE,this._changedDolly=0,this._dollyToNoClamp(je(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const n=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const o=this._collisionTest(),r=ve(o,this._spherical.radius);if(!(n>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||ve(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(i)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Ut).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const n=!t||ve(this._target.x,this._targetEnd.x,this.restThreshold)&&ve(this._target.y,this._targetEnd.y,this.restThreshold)&&ve(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=je(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const n=!t||ve(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(n)}pan(e,t,n=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,n)}truck(e,t,n=!1){this._camera.updateMatrix(),Ye.setFromMatrixColumn(this._camera.matrix,0),We.setFromMatrixColumn(this._camera.matrix,1),Ye.multiplyScalar(e),We.multiplyScalar(-t);const s=de.copy(Ye).add(We),i=ye.copy(this._targetEnd).add(s);return this.moveTo(i.x,i.y,i.z,n)}forward(e,t=!1){de.setFromMatrixColumn(this._camera.matrix,0),de.crossVectors(this._camera.up,de),de.multiplyScalar(e);const n=ye.copy(this._targetEnd).add(de);return this.moveTo(n.x,n.y,n.z,t)}elevate(e,t=!1){return de.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+de.x,this._targetEnd.y+de.y,this._targetEnd.z+de.z,t)}moveTo(e,t,n,s=!1){this._isUserControllingTruck=!1;const i=de.set(e,t,n).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,i,this.boundaryFriction),this._needsUpdate=!0,s||this._target.copy(this._targetEnd);const o=!s||ve(this._target.x,this._targetEnd.x,this.restThreshold)&&ve(this._target.y,this._targetEnd.y,this.restThreshold)&&ve(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(e,t,n,s=!1){const r=de.set(e,t,n).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(r.x,r.y,r.z,s)}fitToBox(e,t,{cover:n=!1,paddingLeft:s=0,paddingRight:i=0,paddingBottom:o=0,paddingTop:r=0}={}){const l=[],f=e.isBox3?St.copy(e):St.setFromObject(e);f.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const d=qs(this._sphericalEnd.theta,Qs),u=qs(this._sphericalEnd.phi,Qs);l.push(this.rotateTo(d,u,t));const p=de.setFromSpherical(this._sphericalEnd).normalize(),g=si.setFromUnitVectors(p,Un),x=ve(Math.abs(p.y),1);x&&g.multiply(zn.setFromAxisAngle(en,d)),g.multiply(this._yAxisUpSpaceInverse);const w=ni.makeEmpty();ye.copy(f.min).applyQuaternion(g),w.expandByPoint(ye),ye.copy(f.min).setX(f.max.x).applyQuaternion(g),w.expandByPoint(ye),ye.copy(f.min).setY(f.max.y).applyQuaternion(g),w.expandByPoint(ye),ye.copy(f.max).setZ(f.min.z).applyQuaternion(g),w.expandByPoint(ye),ye.copy(f.min).setZ(f.max.z).applyQuaternion(g),w.expandByPoint(ye),ye.copy(f.max).setY(f.min.y).applyQuaternion(g),w.expandByPoint(ye),ye.copy(f.max).setX(f.min.x).applyQuaternion(g),w.expandByPoint(ye),ye.copy(f.max).applyQuaternion(g),w.expandByPoint(ye),w.min.x-=s,w.min.y-=o,w.max.x+=i,w.max.y+=r,g.setFromUnitVectors(Un,p),x&&g.premultiply(zn.invert()),g.premultiply(this._yAxisUpSpace);const _=w.getSize(de),M=w.getCenter(ye).applyQuaternion(g);if(pt(this._camera)){const L=this.getDistanceToFitBox(_.x,_.y,_.z,n);l.push(this.moveTo(M.x,M.y,M.z,t)),l.push(this.dollyTo(L,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(rt(this._camera)){const L=this._camera,v=L.right-L.left,y=L.top-L.bottom,A=n?Math.max(v/_.x,y/_.y):Math.min(v/_.x,y/_.y);l.push(this.moveTo(M.x,M.y,M.z,t)),l.push(this.zoomTo(A,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const n=[],i=e instanceof re.Sphere?Vn.copy(e):zt.createBoundingSphere(e,Vn);if(n.push(this.moveTo(i.center.x,i.center.y,i.center.z,t)),pt(this._camera)){const o=this.getDistanceToFitSphere(i.radius);n.push(this.dollyTo(o,t))}else if(rt(this._camera)){const o=this._camera.right-this._camera.left,r=this._camera.top-this._camera.bottom,l=2*i.radius,f=Math.min(o/l,r/l);n.push(this.zoomTo(f,t))}return n.push(this.setFocalOffset(0,0,0,t)),Promise.all(n)}setLookAt(e,t,n,s,i,o,r=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=bt.NONE,this._changedDolly=0;const l=ye.set(s,i,o),f=de.set(e,t,n);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(f.sub(l).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,r||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const d=!r||ve(this._target.x,this._targetEnd.x,this.restThreshold)&&ve(this._target.y,this._targetEnd.y,this.restThreshold)&&ve(this._target.z,this._targetEnd.z,this.restThreshold)&&ve(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&ve(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&ve(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(d)}lerpLookAt(e,t,n,s,i,o,r,l,f,d,u,p,g,x=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=bt.NONE,this._changedDolly=0;const w=de.set(s,i,o),_=ye.set(e,t,n);Ne.setFromVector3(_.sub(w).applyQuaternion(this._yAxisUpSpace));const M=Mt.set(d,u,p),L=ye.set(r,l,f);Vt.setFromVector3(L.sub(M).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(w.lerp(M,g));const v=Vt.theta-Ne.theta,y=Vt.phi-Ne.phi,A=Vt.radius-Ne.radius;this._sphericalEnd.set(Ne.radius+A*g,Ne.phi+y*g,Ne.theta+v*g),this.normalizeRotations(),this._needsUpdate=!0,x||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const S=!x||ve(this._target.x,this._targetEnd.x,this.restThreshold)&&ve(this._target.y,this._targetEnd.y,this.restThreshold)&&ve(this._target.z,this._targetEnd.z,this.restThreshold)&&ve(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&ve(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&ve(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(S)}setPosition(e,t,n,s=!1){return this.setLookAt(e,t,n,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,s)}setTarget(e,t,n,s=!1){const i=this.getPosition(de),o=this.setLookAt(i.x,i.y,i.z,e,t,n,s);return this._sphericalEnd.phi=je(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(e,t,n,s=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,n),this._needsUpdate=!0,s||this._focalOffset.copy(this._focalOffsetEnd);const i=!s||ve(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&ve(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&ve(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}setOrbitPoint(e,t,n){this._camera.updateMatrixWorld(),Ye.setFromMatrixColumn(this._camera.matrixWorldInverse,0),We.setFromMatrixColumn(this._camera.matrixWorldInverse,1),mt.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const s=de.set(e,t,n),i=s.distanceTo(this._camera.position),o=s.sub(this._camera.position);Ye.multiplyScalar(o.x),We.multiplyScalar(o.y),mt.multiplyScalar(o.z),de.copy(Ye).add(We).add(mt),de.z=de.z+i,this.dollyTo(i,!1),this.setFocalOffset(-de.x,de.y,-de.z,!1),this.moveTo(e,t,n,!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,n,s){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new re.Vector4,typeof e=="number"?this._viewport.set(e,t,n,s):this._viewport.copy(e)}getDistanceToFitBox(e,t,n,s=!1){if(Bn(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const i=e/t,o=this._camera.getEffectiveFOV()*kt,r=this._camera.aspect;return((s?i>r:i<r)?t:e/r)*.5/Math.tan(o*.5)+n*.5}getDistanceToFitSphere(e){if(Bn(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*kt,n=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,s=1<this._camera.aspect?t:n;return e/Math.sin(s*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new re.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new re.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e&&e instanceof re.Spherical?e:new re.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new re.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%At,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=At),this._spherical.theta+=At*Math.round((this._sphericalEnd.theta-this._spherical.theta)/At)}reset(e=!1){if(!ve(this._camera.up.x,this._cameraUp0.x)||!ve(this._camera.up.y,this._cameraUp0.y)||!ve(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const n=this.getPosition(de);this.updateCameraUp(),this.setPosition(n.x,n.y,n.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,en),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=de.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 n=this.getPosition(de);this.updateCameraUp(),this.setPosition(n.x,n.y,n.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,n=this._sphericalEnd.phi-this._spherical.phi,s=this._sphericalEnd.radius-this._spherical.radius,i=ei.subVectors(this._targetEnd,this._target),o=ti.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 u=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=Ht(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,u,1/0,e),this._needsUpdate=!0}if(xe(n))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const u=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=Ht(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,u,1/0,e),this._needsUpdate=!0}if(xe(s))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const u=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=Ht(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,u,this.maxSpeed,e),this._needsUpdate=!0}if(xe(i.x)&&xe(i.y)&&xe(i.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const u=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;Js(this._target,this._targetEnd,this._targetVelocity,u,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(xe(o.x)&&xe(o.y)&&xe(o.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const u=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;Js(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,u,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(xe(r))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const u=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=Ht(this._zoom,this._zoomEnd,this._zoomVelocity,u,1/0,e)}if(this.dollyToCursor){if(pt(this._camera)&&this._changedDolly!==0){const u=this._spherical.radius-this._lastDistance,p=this._camera,g=this._getCameraDirection(Ut),x=de.copy(g).cross(p.up).normalize();x.lengthSq()===0&&(x.x=1);const w=ye.crossVectors(x,g),_=this._sphericalEnd.radius*Math.tan(p.getEffectiveFOV()*kt*.5),L=(this._sphericalEnd.radius-u-this._sphericalEnd.radius)/this._sphericalEnd.radius,v=Mt.copy(this._targetEnd).add(x.multiplyScalar(this._dollyControlCoord.x*_*p.aspect)).add(w.multiplyScalar(this._dollyControlCoord.y*_)),y=de.copy(this._targetEnd).lerp(v,L),A=this._lastDollyDirection===bt.IN&&this._spherical.radius<=this.minDistance,S=this._lastDollyDirection===bt.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(A||S)){this._sphericalEnd.radius-=u,this._spherical.radius-=u;const P=ye.copy(g).multiplyScalar(-u);y.add(P)}this._boundary.clampPoint(y,y);const b=ye.subVectors(y,this._targetEnd);this._targetEnd.copy(y),this._target.add(b),this._changedDolly-=u,xe(this._changedDolly)&&(this._changedDolly=0)}else if(rt(this._camera)&&this._changedZoom!==0){const u=this._zoom-this._lastZoom,p=this._camera,g=de.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(p.near+p.far)/(p.near-p.far)).unproject(p),x=ye.set(0,0,-1).applyQuaternion(p.quaternion),w=Mt.copy(g).add(x.multiplyScalar(-g.dot(p.up))),M=-(this._zoom-u-this._zoom)/this._zoom,L=this._getCameraDirection(Ut),v=this._targetEnd.dot(L),y=de.copy(this._targetEnd).lerp(w,M),A=y.dot(L),S=L.multiplyScalar(A-v);y.sub(S),this._boundary.clampPoint(y,y);const b=ye.subVectors(y,this._targetEnd);this._targetEnd.copy(y),this._target.add(b),this._changedZoom-=u,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 l=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,l),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(),Ye.setFromMatrixColumn(this._camera.matrix,0),We.setFromMatrixColumn(this._camera.matrix,1),mt.setFromMatrixColumn(this._camera.matrix,2),Ye.multiplyScalar(this._focalOffset.x),We.multiplyScalar(-this._focalOffset.y),mt.multiplyScalar(this._focalOffset.z),de.copy(Ye).add(We).add(mt),this._camera.position.add(de)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),de.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(n,this.restThreshold)&&xe(s,this.restThreshold)&&xe(i.x,this.restThreshold)&&xe(i.y,this.restThreshold)&&xe(i.z,this.restThreshold)&&xe(o.x,this.restThreshold)&&xe(o.y,this.restThreshold)&&xe(o.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:Ft(this.maxDistance),minZoom:this.minZoom,maxZoom:Ft(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Ft(this.maxPolarAngle),minAzimuthAngle:Ft(this.minAzimuthAngle),maxAzimuthAngle:Ft(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:de.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 n=JSON.parse(e);this.enabled=n.enabled,this.minDistance=n.minDistance,this.maxDistance=Bt(n.maxDistance),this.minZoom=n.minZoom,this.maxZoom=Bt(n.maxZoom),this.minPolarAngle=n.minPolarAngle,this.maxPolarAngle=Bt(n.maxPolarAngle),this.minAzimuthAngle=Bt(n.minAzimuthAngle),this.maxAzimuthAngle=Bt(n.maxAzimuthAngle),this.smoothTime=n.smoothTime,this.draggingSmoothTime=n.draggingSmoothTime,this.dollySpeed=n.dollySpeed,this.truckSpeed=n.truckSpeed,this.dollyToCursor=n.dollyToCursor,this.verticalDragToForward=n.verticalDragToForward,this._target0.fromArray(n.target0),this._position0.fromArray(n.position0),this._zoom0=n.zoom0,this._focalOffset0.fromArray(n.focalOffset0),this.moveTo(n.target[0],n.target[1],n.target[2],t),Ne.setFromVector3(de.fromArray(n.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Ne.theta,Ne.phi,t),this.dollyTo(Ne.radius,t),this.zoomTo(n.zoom,t),this.setFocalOffset(n.focalOffset[0],n.focalOffset[1],n.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",Aa),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}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,n){const s=t.lengthSq();if(s===0)return e;const i=ye.copy(t).add(e),r=this._boundary.clampPoint(i,Mt).sub(i),l=r.lengthSq();if(l===0)return e.add(t);if(l===s)return e;if(n===0)return e.add(t).add(r);{const f=1+n*l/t.dot(r);return e.add(ye.copy(t).multiplyScalar(f)).add(r.multiplyScalar(1-n))}}_updateNearPlaneCorners(){if(pt(this._camera)){const e=this._camera,t=e.near,n=e.getEffectiveFOV()*kt,s=Math.tan(n*.5)*t,i=s*e.aspect;this._nearPlaneCorners[0].set(-i,-s,0),this._nearPlaneCorners[1].set(i,-s,0),this._nearPlaneCorners[2].set(i,s,0),this._nearPlaneCorners[3].set(-i,s,0)}else if(rt(this._camera)){const e=this._camera,t=1/e.zoom,n=e.left*t,s=e.right*t,i=e.top*t,o=e.bottom*t;this._nearPlaneCorners[0].set(n,i,0),this._nearPlaneCorners[1].set(s,i,0),this._nearPlaneCorners[2].set(s,o,0),this._nearPlaneCorners[3].set(n,o,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Bn(this._camera,"_collisionTest"))return e;const n=this._getTargetDirection(Ut);Nn.lookAt($s,n,this._camera.up);for(let s=0;s<4;s++){const i=ye.copy(this._nearPlaneCorners[s]);i.applyMatrix4(Nn);const o=Mt.addVectors(this._target,i);tn.set(o,n),tn.far=this._spherical.radius+1;const r=tn.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 n=()=>{this.removeEventListener("rest",n),t()};this.addEventListener("rest",n)}))}_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 re.Sphere){const n=t,s=n.center;St.makeEmpty(),e.traverseVisible(o=>{o.isMesh&&St.expandByObject(o)}),St.getCenter(s);let i=0;return e.traverseVisible(o=>{if(!o.isMesh)return;const r=o,l=r.geometry.clone();l.applyMatrix4(r.matrixWorld);const d=l.attributes.position;for(let u=0,p=d.count;u<p;u++)de.fromBufferAttribute(d,u),i=Math.max(i,s.distanceToSquared(de))}),n.radius=Math.sqrt(i),n}}const Pa=["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"],Ca=h.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:()=>ne.useTresContext().camera.value.position.z},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(a,{expose:e,emit:t}){const n=a,{makeDefault:s,minPolarAngle:i,maxPolarAngle:o,minAzimuthAngle:r,maxAzimuthAngle:l,distance:f,minDistance:d,maxDistance:u,infinityDolly:p,minZoom:g,maxZoom:x,smoothTime:w,draggingSmoothTime:_,maxSpeed:M,azimuthRotateSpeed:L,polarRotateSpeed:v,dollySpeed:y,dollyDragInverted:A,truckSpeed:S,dollyToCursor:b,dragToOffset:P,verticalDragToForward:O,boundaryFriction:k,restThreshold:V,colliderMeshes:R}=h.toRefs(n),X={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};zt.install({THREE:X});const{camera:K,renderer:H,extend:he,controls:J}=ne.useTresContext(),G=h.ref(null);he({CameraControls:zt}),h.watchEffect(()=>{oe(),G.value&&s.value?J.value=G.value:J.value=null});function oe(){Ae(G.value,"update",()=>t("change",G.value)),Ae(G.value,"controlend",()=>t("end",G.value)),Ae(G.value,"controlstart",()=>t("start",G.value))}const{onLoop:se}=ne.useRenderLoop();return se(({delta:ce})=>{var U,T;(U=G.value)!=null&&U.enabled&&((T=G.value)==null||T.update(ce))}),h.onUnmounted(()=>{G.value&&G.value.disconnect()}),e({value:G}),(ce,U)=>(ce.camera||h.unref(K))&&(ce.domElement||h.unref(H))?(h.openBlock(),h.createElementBlock("TresCameraControls",{key:0,ref_key:"controlsRef",ref:G,"min-polar-angle":h.unref(i),"max-polar-angle":h.unref(o),"min-azimuth-angle":h.unref(r),"max-azimuth-angle":h.unref(l),distance:h.unref(f),"min-distance":h.unref(d),"max-distance":h.unref(u),"infinity-dolly":h.unref(p),"min-zoom":h.unref(g),"max-zoom":h.unref(x),"smooth-time":h.unref(w),"dragging-smooth-time":h.unref(_),"max-speed":h.unref(M),"azimuth-rotate-speed":h.unref(L),"polar-rotate-speed":h.unref(v),"dolly-speed":h.unref(y),"dolly-drag-inverted":h.unref(A),"truck-speed":h.unref(S),"dolly-to-cursor":h.unref(b),"drag-to-offset":h.unref(P),"vertical-drag-to-forward":h.unref(O),"boundary-friction":h.unref(k),"rest-threshold":h.unref(V),"collider-meshes":h.unref(R),args:[ce.camera||h.unref(K),ce.domElement||h.unref(H).domElement]},null,8,Pa)):h.createCommentVNode("",!0)}});class La extends c.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=`
|
|
233
|
+
*/const fe={LEFT:1,RIGHT:2,MIDDLE:4},J=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}),Ot={NONE:0,IN:1,OUT:-1};function Mt(o){return o.isPerspectiveCamera}function dt(o){return o.isOrthographicCamera}const It=Math.PI*2,Mr=Math.PI/2,Ar=1e-5,Xt=Math.PI/180;function qe(o,e,t){return Math.max(e,Math.min(t,o))}function Pe(o,e=Ar){return Math.abs(o)<e}function Ae(o,e,t=Ar){return Pe(o-e,t)}function Sr(o,e){return Math.round(o/e)*e}function Wt(o){return isFinite(o)?o:o<0?-Number.MAX_VALUE:Number.MAX_VALUE}function Zt(o){return Math.abs(o)<Number.MAX_VALUE?o:o*(1/0)}function pn(o,e,t,n,i=1/0,r){n=Math.max(1e-4,n);const s=2/n,a=s*r,l=1/(1+a+.48*a*a+.235*a*a*a);let f=o-e;const u=e,d=i*n;f=qe(f,-d,d),e=o-f;const m=(t.value+s*f)*r;t.value=(t.value-s*m)*l;let y=e+(f+m)*l;return u-o>0==y>u&&(y=u,t.value=(y-u)/r),y}function Pr(o,e,t,n,i=1/0,r,s){n=Math.max(1e-4,n);const a=2/n,l=a*r,f=1/(1+l+.48*l*l+.235*l*l*l);let u=e.x,d=e.y,m=e.z,y=o.x-u,b=o.y-d,A=o.z-m;const _=u,L=d,I=m,S=i*n,g=S*S,O=y*y+b*b+A*A;if(O>g){const $=Math.sqrt(O);y=y/$*S,b=b/$*S,A=A/$*S}u=o.x-y,d=o.y-b,m=o.z-A;const x=(t.x+a*y)*r,C=(t.y+a*b)*r,p=(t.z+a*A)*r;t.x=(t.x-a*x)*f,t.y=(t.y-a*C)*f,t.z=(t.z-a*p)*f,s.x=u+(y+x)*f,s.y=d+(b+C)*f,s.z=m+(A+p)*f;const w=_-o.x,v=L-o.y,T=I-o.z,k=s.x-_,Q=s.y-L,Y=s.z-I;return w*k+v*Q+T*Y>0&&(s.x=_,s.y=L,s.z=I,t.x=(s.x-_)/r,t.y=(s.y-L)/r,t.z=(s.z-I)/r),s}function Jn(o,e){e.set(0,0),o.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=o.length,e.y/=o.length}function Hn(o,e){return dt(o)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}class bl{constructor(){this._listeners={}}addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let r=0,s=i.length;r<s;r++)i[r].call(this,e)}}}const Ml="2.7.3",mn=1/8,Cr=typeof window<"u",Al=Cr&&/Mac/.test(navigator.platform),Sl=!(Cr&&"PointerEvent"in window);let he,Lr,gn,$n,ze,ge,be,Dt,qt,Je,He,At,Tr,Or,Xe,Kt,kt,Ir,ei,Dr,ti,ni,yn;class Qt extends bl{static install(e){he=e.THREE,Lr=Object.freeze(new he.Vector3(0,0,0)),gn=Object.freeze(new he.Vector3(0,1,0)),$n=Object.freeze(new he.Vector3(0,0,1)),ze=new he.Vector2,ge=new he.Vector3,be=new he.Vector3,Dt=new he.Vector3,qt=new he.Vector3,Je=new he.Vector3,He=new he.Vector3,At=new he.Vector3,Tr=new he.Vector3,Or=new he.Vector3,Xe=new he.Spherical,Kt=new he.Spherical,kt=new he.Box3,Ir=new he.Box3,ei=new he.Sphere,Dr=new he.Quaternion,ti=new he.Quaternion,ni=new he.Matrix4,yn=new he.Raycaster}static get ACTION(){return J}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=J.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._dragNeedsUpdate=!0,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=Ot.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new he.Vector3,this._focalOffsetVelocity=new he.Vector3,this._zoomVelocity={value:0},this._truckInternal=(g,O,x)=>{let C,p;if(Mt(this._camera)){const w=ge.copy(this._camera.position).sub(this._target),v=this._camera.getEffectiveFOV()*Xt,T=w.length()*Math.tan(v*.5);C=this.truckSpeed*g*T/this._elementRect.height,p=this.truckSpeed*O*T/this._elementRect.height}else if(dt(this._camera)){const w=this._camera;C=g*(w.right-w.left)/w.zoom/this._elementRect.width,p=O*(w.top-w.bottom)/w.zoom/this._elementRect.height}else return;this.verticalDragToForward?(x?this.setFocalOffset(this._focalOffsetEnd.x+C,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(C,0,!0),this.forward(-p,!0)):x?this.setFocalOffset(this._focalOffsetEnd.x+C,this._focalOffsetEnd.y+p,this._focalOffsetEnd.z,!0):this.truck(C,p,!0)},this._rotateInternal=(g,O)=>{const x=It*this.azimuthRotateSpeed*g/this._elementRect.height,C=It*this.polarRotateSpeed*O/this._elementRect.height;this.rotate(x,C,!0)},this._dollyInternal=(g,O,x)=>{const C=Math.pow(.95,-g*this.dollySpeed),p=this._sphericalEnd.radius,w=this._sphericalEnd.radius*C,v=qe(w,this.minDistance,this.maxDistance),T=v-w;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(w,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(T,!0),this._dollyToNoClamp(v,!0)):this._dollyToNoClamp(v,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?w:v)-p,this._dollyControlCoord.set(O,x)),this._lastDollyDirection=Math.sign(-g)},this._zoomInternal=(g,O,x)=>{const C=Math.pow(.95,g*this.dollySpeed),p=this._zoom,w=this._zoom*C;this.zoomTo(w,!0),this.dollyToCursor&&(this._changedZoom+=w-p,this._dollyControlCoord.set(O,x))},typeof he>"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 he.Quaternion().setFromUnitVectors(this._camera.up,gn),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=J.NONE,this._target=new he.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new he.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new he.Spherical().setFromVector3(ge.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 he.Vector3,new he.Vector3,new he.Vector3,new he.Vector3],this._updateNearPlaneCorners(),this._boundary=new he.Box3(new he.Vector3(-1/0,-1/0,-1/0),new he.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 he.Vector2,this.mouseButtons={left:J.ROTATE,middle:J.DOLLY,right:J.TRUCK,wheel:Mt(this._camera)?J.DOLLY:dt(this._camera)?J.ZOOM:J.NONE},this.touches={one:J.TOUCH_ROTATE,two:Mt(this._camera)?J.TOUCH_DOLLY_TRUCK:dt(this._camera)?J.TOUCH_ZOOM_TRUCK:J.NONE,three:J.TOUCH_TRUCK};const n=new he.Vector2,i=new he.Vector2,r=new he.Vector2,s=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 C=this._domElement.getBoundingClientRect(),p=g.clientX/C.width,w=g.clientY/C.height;if(p<this._interactiveArea.left||p>this._interactiveArea.right||w<this._interactiveArea.top||w>this._interactiveArea.bottom)return}const O=g.pointerType!=="mouse"?null:(g.buttons&fe.LEFT)===fe.LEFT?fe.LEFT:(g.buttons&fe.MIDDLE)===fe.MIDDLE?fe.MIDDLE:(g.buttons&fe.RIGHT)===fe.RIGHT?fe.RIGHT:null;if(O!==null){const C=this._findPointerByMouseButton(O);C&&this._disposePointer(C)}if((g.buttons&fe.LEFT)===fe.LEFT&&this._lockedPointer)return;const x={pointerId:g.pointerId,clientX:g.clientX,clientY:g.clientY,deltaX:0,deltaY:0,mouseButton:O};this._activePointers.push(x),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",u),this._isDragging=!0,A(g)},a=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 C=this._domElement.getBoundingClientRect(),p=g.clientX/C.width,w=g.clientY/C.height;if(p<this._interactiveArea.left||p>this._interactiveArea.right||w<this._interactiveArea.top||w>this._interactiveArea.bottom)return}const O=(g.buttons&fe.LEFT)===fe.LEFT?fe.LEFT:(g.buttons&fe.MIDDLE)===fe.MIDDLE?fe.MIDDLE:(g.buttons&fe.RIGHT)===fe.RIGHT?fe.RIGHT:null;if(O!==null){const C=this._findPointerByMouseButton(O);C&&this._disposePointer(C)}const x={pointerId:1,clientX:g.clientX,clientY:g.clientY,deltaX:0,deltaY:0,mouseButton:(g.buttons&fe.LEFT)===fe.LEFT?fe.LEFT:(g.buttons&fe.MIDDLE)===fe.LEFT?fe.MIDDLE:(g.buttons&fe.RIGHT)===fe.LEFT?fe.RIGHT:null};this._activePointers.push(x),this._domElement.ownerDocument.removeEventListener("mousemove",f),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.addEventListener("mousemove",f),this._domElement.ownerDocument.addEventListener("mouseup",d),this._isDragging=!0,A(g)},l=g=>{g.cancelable&&g.preventDefault();const O=g.pointerId,x=this._lockedPointer||this._findPointerById(O);if(x){if(x.clientX=g.clientX,x.clientY=g.clientY,x.deltaX=g.movementX,x.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&fe.LEFT)===fe.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(g.buttons&fe.MIDDLE)===fe.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(g.buttons&fe.RIGHT)===fe.RIGHT&&(this._state=this._state|this.mouseButtons.right);_()}},f=g=>{const O=this._lockedPointer||this._findPointerById(1);O&&(O.clientX=g.clientX,O.clientY=g.clientY,O.deltaX=g.movementX,O.deltaY=g.movementY,this._state=0,(this._lockedPointer||(g.buttons&fe.LEFT)===fe.LEFT)&&(this._state=this._state|this.mouseButtons.left),(g.buttons&fe.MIDDLE)===fe.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(g.buttons&fe.RIGHT)===fe.RIGHT&&(this._state=this._state|this.mouseButtons.right),_())},u=g=>{const O=this._findPointerById(g.pointerId);if(!(O&&O===this._lockedPointer)){if(O&&this._disposePointer(O),g.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=J.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=J.NONE;L()}},d=()=>{const g=this._findPointerById(1);g&&g===this._lockedPointer||(g&&this._disposePointer(g),this._state=J.NONE,L())};let m=-1;const y=g=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===J.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const w=this._domElement.getBoundingClientRect(),v=g.clientX/w.width,T=g.clientY/w.height;if(v<this._interactiveArea.left||v>this._interactiveArea.right||T<this._interactiveArea.top||T>this._interactiveArea.bottom)return}if(g.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===J.ROTATE||this.mouseButtons.wheel===J.TRUCK){const w=performance.now();m-w<1e3&&this._getClientRect(this._elementRect),m=w}const O=Al?-1:-3,x=g.deltaMode===1?g.deltaY/O:g.deltaY/(O*10),C=this.dollyToCursor?(g.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,p=this.dollyToCursor?(g.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case J.ROTATE:{this._rotateInternal(g.deltaX,g.deltaY),this._isUserControllingRotate=!0;break}case J.TRUCK:{this._truckInternal(g.deltaX,g.deltaY,!1),this._isUserControllingTruck=!0;break}case J.OFFSET:{this._truckInternal(g.deltaX,g.deltaY,!0),this._isUserControllingOffset=!0;break}case J.DOLLY:{this._dollyInternal(-x,C,p),this._isUserControllingDolly=!0;break}case J.ZOOM:{this._zoomInternal(-x,C,p),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},b=g=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===Qt.ACTION.NONE){const O=g instanceof PointerEvent?g.pointerId:(g instanceof MouseEvent,0),x=this._findPointerById(O);x&&this._disposePointer(x),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mousemove",f),this._domElement.ownerDocument.removeEventListener("mouseup",d);return}g.preventDefault()}},A=g=>{if(!this._enabled)return;if(Jn(this._activePointers,ze),this._getClientRect(this._elementRect),n.copy(ze),i.copy(ze),this._activePointers.length>=2){const x=ze.x-this._activePointers[1].clientX,C=ze.y-this._activePointers[1].clientY,p=Math.sqrt(x*x+C*C);r.set(0,p);const w=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,v=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(w,v)}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&fe.LEFT)===fe.LEFT&&(this._state=this._state|this.mouseButtons.left),(g.buttons&fe.MIDDLE)===fe.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(g.buttons&fe.RIGHT)===fe.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&J.ROTATE)===J.ROTATE||(this._state&J.TOUCH_ROTATE)===J.TOUCH_ROTATE||(this._state&J.TOUCH_DOLLY_ROTATE)===J.TOUCH_DOLLY_ROTATE||(this._state&J.TOUCH_ZOOM_ROTATE)===J.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&J.TRUCK)===J.TRUCK||(this._state&J.TOUCH_TRUCK)===J.TOUCH_TRUCK||(this._state&J.TOUCH_DOLLY_TRUCK)===J.TOUCH_DOLLY_TRUCK||(this._state&J.TOUCH_ZOOM_TRUCK)===J.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&J.DOLLY)===J.DOLLY||(this._state&J.TOUCH_DOLLY)===J.TOUCH_DOLLY||(this._state&J.TOUCH_DOLLY_TRUCK)===J.TOUCH_DOLLY_TRUCK||(this._state&J.TOUCH_DOLLY_OFFSET)===J.TOUCH_DOLLY_OFFSET||(this._state&J.TOUCH_DOLLY_ROTATE)===J.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&J.ZOOM)===J.ZOOM||(this._state&J.TOUCH_ZOOM)===J.TOUCH_ZOOM||(this._state&J.TOUCH_ZOOM_TRUCK)===J.TOUCH_ZOOM_TRUCK||(this._state&J.TOUCH_ZOOM_OFFSET)===J.TOUCH_ZOOM_OFFSET||(this._state&J.TOUCH_ZOOM_ROTATE)===J.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&J.OFFSET)===J.OFFSET||(this._state&J.TOUCH_OFFSET)===J.TOUCH_OFFSET||(this._state&J.TOUCH_DOLLY_OFFSET)===J.TOUCH_DOLLY_OFFSET||(this._state&J.TOUCH_ZOOM_OFFSET)===J.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},_=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,Jn(this._activePointers,ze);const O=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,x=O?-O.deltaX:i.x-ze.x,C=O?-O.deltaY:i.y-ze.y;if(i.copy(ze),((this._state&J.ROTATE)===J.ROTATE||(this._state&J.TOUCH_ROTATE)===J.TOUCH_ROTATE||(this._state&J.TOUCH_DOLLY_ROTATE)===J.TOUCH_DOLLY_ROTATE||(this._state&J.TOUCH_ZOOM_ROTATE)===J.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(x,C),this._isUserControllingRotate=!0),(this._state&J.DOLLY)===J.DOLLY||(this._state&J.ZOOM)===J.ZOOM){const p=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,w=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0,v=this.dollyDragInverted?-1:1;(this._state&J.DOLLY)===J.DOLLY?(this._dollyInternal(v*C*mn,p,w),this._isUserControllingDolly=!0):(this._zoomInternal(v*C*mn,p,w),this._isUserControllingZoom=!0)}if((this._state&J.TOUCH_DOLLY)===J.TOUCH_DOLLY||(this._state&J.TOUCH_ZOOM)===J.TOUCH_ZOOM||(this._state&J.TOUCH_DOLLY_TRUCK)===J.TOUCH_DOLLY_TRUCK||(this._state&J.TOUCH_ZOOM_TRUCK)===J.TOUCH_ZOOM_TRUCK||(this._state&J.TOUCH_DOLLY_OFFSET)===J.TOUCH_DOLLY_OFFSET||(this._state&J.TOUCH_ZOOM_OFFSET)===J.TOUCH_ZOOM_OFFSET||(this._state&J.TOUCH_DOLLY_ROTATE)===J.TOUCH_DOLLY_ROTATE||(this._state&J.TOUCH_ZOOM_ROTATE)===J.TOUCH_ZOOM_ROTATE){const p=ze.x-this._activePointers[1].clientX,w=ze.y-this._activePointers[1].clientY,v=Math.sqrt(p*p+w*w),T=r.y-v;r.set(0,v);const k=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,Q=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&J.TOUCH_DOLLY)===J.TOUCH_DOLLY||(this._state&J.TOUCH_DOLLY_ROTATE)===J.TOUCH_DOLLY_ROTATE||(this._state&J.TOUCH_DOLLY_TRUCK)===J.TOUCH_DOLLY_TRUCK||(this._state&J.TOUCH_DOLLY_OFFSET)===J.TOUCH_DOLLY_OFFSET?(this._dollyInternal(T*mn,k,Q),this._isUserControllingDolly=!0):(this._zoomInternal(T*mn,k,Q),this._isUserControllingZoom=!0)}((this._state&J.TRUCK)===J.TRUCK||(this._state&J.TOUCH_TRUCK)===J.TOUCH_TRUCK||(this._state&J.TOUCH_DOLLY_TRUCK)===J.TOUCH_DOLLY_TRUCK||(this._state&J.TOUCH_ZOOM_TRUCK)===J.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(x,C,!1),this._isUserControllingTruck=!0),((this._state&J.OFFSET)===J.OFFSET||(this._state&J.TOUCH_OFFSET)===J.TOUCH_OFFSET||(this._state&J.TOUCH_DOLLY_OFFSET)===J.TOUCH_DOLLY_OFFSET||(this._state&J.TOUCH_ZOOM_OFFSET)===J.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(x,C,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},L=()=>{Jn(this._activePointers,ze),i.copy(ze),this._dragNeedsUpdate=!1,(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",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",f),this._domElement.ownerDocument.removeEventListener("pointerup",u),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",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",I),this._domElement.ownerDocument.addEventListener("pointerlockerror",S),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",u),A())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",I),this._domElement.ownerDocument.removeEventListener("pointerlockerror",S))};const I=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},S=()=>{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",s),Sl&&this._domElement.addEventListener("mousedown",a),this._domElement.addEventListener("pointercancel",u),this._domElement.addEventListener("wheel",y,{passive:!1}),this._domElement.addEventListener("contextmenu",b)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",s),this._domElement.removeEventListener("mousedown",a),this._domElement.removeEventListener("pointercancel",u),this._domElement.removeEventListener("wheel",y,{passive:!1}),this._domElement.removeEventListener("contextmenu",b),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",f),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mouseup",d),this._domElement.ownerDocument.removeEventListener("pointerlockchange",I),this._domElement.ownerDocument.removeEventListener("pointerlockerror",S))},this.cancel=()=>{this._state!==J.NONE&&(this._state=J.NONE,this._activePointers.length=0,L())},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=qe(e.width,0,1),this._interactiveArea.height=qe(e.height,0,1),this._interactiveArea.x=qe(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=qe(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,n=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,n)}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,n=!1){this._isUserControllingRotate=!1;const i=qe(e,this.minAzimuthAngle,this.maxAzimuthAngle),r=qe(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=r,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,n||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const s=!n||Ae(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Ae(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(s)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Ot.NONE,this._changedDolly=0,this._dollyToNoClamp(qe(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const n=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const s=this._collisionTest(),a=Ae(s,this._spherical.radius);if(!(n>e)&&a)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,s)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const r=!t||Ae(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(r)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(qt).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const n=!t||Ae(this._target.x,this._targetEnd.x,this.restThreshold)&&Ae(this._target.y,this._targetEnd.y,this.restThreshold)&&Ae(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=qe(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const n=!t||Ae(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(n)}pan(e,t,n=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,n)}truck(e,t,n=!1){this._camera.updateMatrix(),Je.setFromMatrixColumn(this._camera.matrix,0),He.setFromMatrixColumn(this._camera.matrix,1),Je.multiplyScalar(e),He.multiplyScalar(-t);const i=ge.copy(Je).add(He),r=be.copy(this._targetEnd).add(i);return this.moveTo(r.x,r.y,r.z,n)}forward(e,t=!1){ge.setFromMatrixColumn(this._camera.matrix,0),ge.crossVectors(this._camera.up,ge),ge.multiplyScalar(e);const n=be.copy(this._targetEnd).add(ge);return this.moveTo(n.x,n.y,n.z,t)}elevate(e,t=!1){return ge.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+ge.x,this._targetEnd.y+ge.y,this._targetEnd.z+ge.z,t)}moveTo(e,t,n,i=!1){this._isUserControllingTruck=!1;const r=ge.set(e,t,n).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,r,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const s=!i||Ae(this._target.x,this._targetEnd.x,this.restThreshold)&&Ae(this._target.y,this._targetEnd.y,this.restThreshold)&&Ae(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}lookInDirectionOf(e,t,n,i=!1){const a=ge.set(e,t,n).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(a.x,a.y,a.z,i)}fitToBox(e,t,{cover:n=!1,paddingLeft:i=0,paddingRight:r=0,paddingBottom:s=0,paddingTop:a=0}={}){const l=[],f=e.isBox3?kt.copy(e):kt.setFromObject(e);f.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const u=Sr(this._sphericalEnd.theta,Mr),d=Sr(this._sphericalEnd.phi,Mr);l.push(this.rotateTo(u,d,t));const m=ge.setFromSpherical(this._sphericalEnd).normalize(),y=Dr.setFromUnitVectors(m,$n),b=Ae(Math.abs(m.y),1);b&&y.multiply(ti.setFromAxisAngle(gn,u)),y.multiply(this._yAxisUpSpaceInverse);const A=Ir.makeEmpty();be.copy(f.min).applyQuaternion(y),A.expandByPoint(be),be.copy(f.min).setX(f.max.x).applyQuaternion(y),A.expandByPoint(be),be.copy(f.min).setY(f.max.y).applyQuaternion(y),A.expandByPoint(be),be.copy(f.max).setZ(f.min.z).applyQuaternion(y),A.expandByPoint(be),be.copy(f.min).setZ(f.max.z).applyQuaternion(y),A.expandByPoint(be),be.copy(f.max).setY(f.min.y).applyQuaternion(y),A.expandByPoint(be),be.copy(f.max).setX(f.min.x).applyQuaternion(y),A.expandByPoint(be),be.copy(f.max).applyQuaternion(y),A.expandByPoint(be),A.min.x-=i,A.min.y-=s,A.max.x+=r,A.max.y+=a,y.setFromUnitVectors($n,m),b&&y.premultiply(ti.invert()),y.premultiply(this._yAxisUpSpace);const _=A.getSize(ge),L=A.getCenter(be).applyQuaternion(y);if(Mt(this._camera)){const I=this.getDistanceToFitBox(_.x,_.y,_.z,n);l.push(this.moveTo(L.x,L.y,L.z,t)),l.push(this.dollyTo(I,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(dt(this._camera)){const I=this._camera,S=I.right-I.left,g=I.top-I.bottom,O=n?Math.max(S/_.x,g/_.y):Math.min(S/_.x,g/_.y);l.push(this.moveTo(L.x,L.y,L.z,t)),l.push(this.zoomTo(O,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const n=[],r=e instanceof he.Sphere?ei.copy(e):Qt.createBoundingSphere(e,ei);if(n.push(this.moveTo(r.center.x,r.center.y,r.center.z,t)),Mt(this._camera)){const s=this.getDistanceToFitSphere(r.radius);n.push(this.dollyTo(s,t))}else if(dt(this._camera)){const s=this._camera.right-this._camera.left,a=this._camera.top-this._camera.bottom,l=2*r.radius,f=Math.min(s/l,a/l);n.push(this.zoomTo(f,t))}return n.push(this.setFocalOffset(0,0,0,t)),Promise.all(n)}setLookAt(e,t,n,i,r,s,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Ot.NONE,this._changedDolly=0;const l=be.set(i,r,s),f=ge.set(e,t,n);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(f.sub(l).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!a||Ae(this._target.x,this._targetEnd.x,this.restThreshold)&&Ae(this._target.y,this._targetEnd.y,this.restThreshold)&&Ae(this._target.z,this._targetEnd.z,this.restThreshold)&&Ae(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Ae(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Ae(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerpLookAt(e,t,n,i,r,s,a,l,f,u,d,m,y,b=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Ot.NONE,this._changedDolly=0;const A=ge.set(i,r,s),_=be.set(e,t,n);Xe.setFromVector3(_.sub(A).applyQuaternion(this._yAxisUpSpace));const L=Dt.set(u,d,m),I=be.set(a,l,f);Kt.setFromVector3(I.sub(L).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(A.lerp(L,y));const S=Kt.theta-Xe.theta,g=Kt.phi-Xe.phi,O=Kt.radius-Xe.radius;this._sphericalEnd.set(Xe.radius+O*y,Xe.phi+g*y,Xe.theta+S*y),this.normalizeRotations(),this._needsUpdate=!0,b||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const x=!b||Ae(this._target.x,this._targetEnd.x,this.restThreshold)&&Ae(this._target.y,this._targetEnd.y,this.restThreshold)&&Ae(this._target.z,this._targetEnd.z,this.restThreshold)&&Ae(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Ae(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Ae(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(x)}setPosition(e,t,n,i=!1){return this.setLookAt(e,t,n,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(e,t,n,i=!1){const r=this.getPosition(ge),s=this.setLookAt(r.x,r.y,r.z,e,t,n,i);return this._sphericalEnd.phi=qe(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),s}setFocalOffset(e,t,n,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,n),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const r=!i||Ae(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&Ae(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&Ae(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}setOrbitPoint(e,t,n){this._camera.updateMatrixWorld(),Je.setFromMatrixColumn(this._camera.matrixWorldInverse,0),He.setFromMatrixColumn(this._camera.matrixWorldInverse,1),At.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=ge.set(e,t,n),r=i.distanceTo(this._camera.position),s=i.sub(this._camera.position);Je.multiplyScalar(s.x),He.multiplyScalar(s.y),At.multiplyScalar(s.z),ge.copy(Je).add(He).add(At),ge.z=ge.z+r,this.dollyTo(r,!1),this.setFocalOffset(-ge.x,ge.y,-ge.z,!1),this.moveTo(e,t,n,!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,n,i){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new he.Vector4,typeof e=="number"?this._viewport.set(e,t,n,i):this._viewport.copy(e)}getDistanceToFitBox(e,t,n,i=!1){if(Hn(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const r=e/t,s=this._camera.getEffectiveFOV()*Xt,a=this._camera.aspect;return((i?r>a:r<a)?t:e/a)*.5/Math.tan(s*.5)+n*.5}getDistanceToFitSphere(e){if(Hn(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const t=this._camera.getEffectiveFOV()*Xt,n=Math.atan(Math.tan(t*.5)*this._camera.aspect)*2,i=1<this._camera.aspect?t:n;return e/Math.sin(i*.5)}getTarget(e,t=!0){return(e&&e.isVector3?e:new he.Vector3).copy(t?this._targetEnd:this._target)}getPosition(e,t=!0){return(e&&e.isVector3?e:new he.Vector3).setFromSpherical(t?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(t?this._targetEnd:this._target)}getSpherical(e,t=!0){return(e&&e instanceof he.Spherical?e:new he.Spherical).copy(t?this._sphericalEnd:this._spherical)}getFocalOffset(e,t=!0){return(e&&e.isVector3?e:new he.Vector3).copy(t?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%It,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=It),this._spherical.theta+=It*Math.round((this._sphericalEnd.theta-this._spherical.theta)/It)}reset(e=!1){if(!Ae(this._camera.up.x,this._cameraUp0.x)||!Ae(this._camera.up.y,this._cameraUp0.y)||!Ae(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const n=this.getPosition(ge);this.updateCameraUp(),this.setPosition(n.x,n.y,n.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,gn),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const e=ge.subVectors(this._target,this._camera.position).normalize(),t=be.crossVectors(e,this._camera.up);this._camera.up.crossVectors(t,e).normalize(),this._camera.updateMatrixWorld();const n=this.getPosition(ge);this.updateCameraUp(),this.setPosition(n.x,n.y,n.z)}update(e){const t=this._sphericalEnd.theta-this._spherical.theta,n=this._sphericalEnd.phi-this._spherical.phi,i=this._sphericalEnd.radius-this._spherical.radius,r=Tr.subVectors(this._targetEnd,this._target),s=Or.subVectors(this._focalOffsetEnd,this._focalOffset),a=this._zoomEnd-this._zoom;if(Pe(t))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=pn(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,d,1/0,e),this._needsUpdate=!0}if(Pe(n))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const d=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=pn(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,d,1/0,e),this._needsUpdate=!0}if(Pe(i))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const d=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=pn(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,d,this.maxSpeed,e),this._needsUpdate=!0}if(Pe(r.x)&&Pe(r.y)&&Pe(r.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const d=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;Pr(this._target,this._targetEnd,this._targetVelocity,d,this.maxSpeed,e,this._target),this._needsUpdate=!0}if(Pe(s.x)&&Pe(s.y)&&Pe(s.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const d=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;Pr(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,d,this.maxSpeed,e,this._focalOffset),this._needsUpdate=!0}if(Pe(a))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const d=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=pn(this._zoom,this._zoomEnd,this._zoomVelocity,d,1/0,e)}if(this.dollyToCursor){if(Mt(this._camera)&&this._changedDolly!==0){const d=this._spherical.radius-this._lastDistance,m=this._camera,y=this._getCameraDirection(qt),b=ge.copy(y).cross(m.up).normalize();b.lengthSq()===0&&(b.x=1);const A=be.crossVectors(b,y),_=this._sphericalEnd.radius*Math.tan(m.getEffectiveFOV()*Xt*.5),I=(this._sphericalEnd.radius-d-this._sphericalEnd.radius)/this._sphericalEnd.radius,S=Dt.copy(this._targetEnd).add(b.multiplyScalar(this._dollyControlCoord.x*_*m.aspect)).add(A.multiplyScalar(this._dollyControlCoord.y*_)),g=ge.copy(this._targetEnd).lerp(S,I),O=this._lastDollyDirection===Ot.IN&&this._spherical.radius<=this.minDistance,x=this._lastDollyDirection===Ot.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(O||x)){this._sphericalEnd.radius-=d,this._spherical.radius-=d;const p=be.copy(y).multiplyScalar(-d);g.add(p)}this._boundary.clampPoint(g,g);const C=be.subVectors(g,this._targetEnd);this._targetEnd.copy(g),this._target.add(C),this._changedDolly-=d,Pe(this._changedDolly)&&(this._changedDolly=0)}else if(dt(this._camera)&&this._changedZoom!==0){const d=this._zoom-this._lastZoom,m=this._camera,y=ge.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(m.near+m.far)/(m.near-m.far)).unproject(m),b=be.set(0,0,-1).applyQuaternion(m.quaternion),A=Dt.copy(y).add(b.multiplyScalar(-y.dot(m.up))),L=-(this._zoom-d-this._zoom)/this._zoom,I=this._getCameraDirection(qt),S=this._targetEnd.dot(I),g=ge.copy(this._targetEnd).lerp(A,L),O=g.dot(I),x=I.multiplyScalar(O-S);g.sub(x),this._boundary.clampPoint(g,g);const C=be.subVectors(g,this._targetEnd);this._targetEnd.copy(g),this._target.add(C),this._changedZoom-=d,Pe(this._changedZoom)&&(this._changedZoom=0)}}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const l=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,l),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target),(!Pe(this._focalOffset.x)||!Pe(this._focalOffset.y)||!Pe(this._focalOffset.z))&&(this._camera.updateMatrixWorld(),Je.setFromMatrixColumn(this._camera.matrix,0),He.setFromMatrixColumn(this._camera.matrix,1),At.setFromMatrixColumn(this._camera.matrix,2),Je.multiplyScalar(this._focalOffset.x),He.multiplyScalar(-this._focalOffset.y),At.multiplyScalar(this._focalOffset.z),ge.copy(Je).add(He).add(At),this._camera.position.add(ge)),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),ge.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const u=this._needsUpdate;return u&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):u?(this.dispatchEvent({type:"update"}),Pe(t,this.restThreshold)&&Pe(n,this.restThreshold)&&Pe(i,this.restThreshold)&&Pe(r.x,this.restThreshold)&&Pe(r.y,this.restThreshold)&&Pe(r.z,this.restThreshold)&&Pe(s.x,this.restThreshold)&&Pe(s.y,this.restThreshold)&&Pe(s.z,this.restThreshold)&&Pe(a,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!u&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=u,this._needsUpdate=!1,u}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:Wt(this.maxDistance),minZoom:this.minZoom,maxZoom:Wt(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:Wt(this.maxPolarAngle),minAzimuthAngle:Wt(this.minAzimuthAngle),maxAzimuthAngle:Wt(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:ge.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 n=JSON.parse(e);this.enabled=n.enabled,this.minDistance=n.minDistance,this.maxDistance=Zt(n.maxDistance),this.minZoom=n.minZoom,this.maxZoom=Zt(n.maxZoom),this.minPolarAngle=n.minPolarAngle,this.maxPolarAngle=Zt(n.maxPolarAngle),this.minAzimuthAngle=Zt(n.minAzimuthAngle),this.maxAzimuthAngle=Zt(n.maxAzimuthAngle),this.smoothTime=n.smoothTime,this.draggingSmoothTime=n.draggingSmoothTime,this.dollySpeed=n.dollySpeed,this.truckSpeed=n.truckSpeed,this.dollyToCursor=n.dollyToCursor,this.verticalDragToForward=n.verticalDragToForward,this._target0.fromArray(n.target0),this._position0.fromArray(n.position0),this._zoom0=n.zoom0,this._focalOffset0.fromArray(n.focalOffset0),this.moveTo(n.target[0],n.target[1],n.target[2],t),Xe.setFromVector3(ge.fromArray(n.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Xe.theta,Xe.phi,t),this.dollyTo(Xe.radius,t),this.zoomTo(n.zoom,t),this.setFocalOffset(n.focalOffset[0],n.focalOffset[1],n.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",Ml),this._addAllEventListeners(e),this._getClientRect(this._elementRect)}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,n){const i=t.lengthSq();if(i===0)return e;const r=be.copy(t).add(e),a=this._boundary.clampPoint(r,Dt).sub(r),l=a.lengthSq();if(l===0)return e.add(t);if(l===i)return e;if(n===0)return e.add(t).add(a);{const f=1+n*l/t.dot(a);return e.add(be.copy(t).multiplyScalar(f)).add(a.multiplyScalar(1-n))}}_updateNearPlaneCorners(){if(Mt(this._camera)){const e=this._camera,t=e.near,n=e.getEffectiveFOV()*Xt,i=Math.tan(n*.5)*t,r=i*e.aspect;this._nearPlaneCorners[0].set(-r,-i,0),this._nearPlaneCorners[1].set(r,-i,0),this._nearPlaneCorners[2].set(r,i,0),this._nearPlaneCorners[3].set(-r,i,0)}else if(dt(this._camera)){const e=this._camera,t=1/e.zoom,n=e.left*t,i=e.right*t,r=e.top*t,s=e.bottom*t;this._nearPlaneCorners[0].set(n,r,0),this._nearPlaneCorners[1].set(i,r,0),this._nearPlaneCorners[2].set(i,s,0),this._nearPlaneCorners[3].set(n,s,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Hn(this._camera,"_collisionTest"))return e;const n=this._getTargetDirection(qt);ni.lookAt(Lr,n,this._camera.up);for(let i=0;i<4;i++){const r=be.copy(this._nearPlaneCorners[i]);r.applyMatrix4(ni);const s=Dt.addVectors(this._target,r);yn.set(s,n),yn.far=this._spherical.radius+1;const a=yn.intersectObjects(this.colliderMeshes);a.length!==0&&a[0].distance<e&&(e=a[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 n=()=>{this.removeEventListener("rest",n),t()};this.addEventListener("rest",n)}))}_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 he.Sphere){const n=t,i=n.center;kt.makeEmpty(),e.traverseVisible(s=>{s.isMesh&&kt.expandByObject(s)}),kt.getCenter(i);let r=0;return e.traverseVisible(s=>{if(!s.isMesh)return;const a=s,l=a.geometry.clone();l.applyMatrix4(a.matrixWorld);const u=l.attributes.position;for(let d=0,m=u.count;d<m;d++)ge.fromBufferAttribute(u,d),r=Math.max(r,i.distanceToSquared(ge))}),n.radius=Math.sqrt(r),n}}const Pl=["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"],Cl=h.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:()=>ae.useTresContext().camera.value.position.z},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(o,{expose:e,emit:t}){const n=o,i=t,{makeDefault:r,minPolarAngle:s,maxPolarAngle:a,minAzimuthAngle:l,maxAzimuthAngle:f,distance:u,minDistance:d,maxDistance:m,infinityDolly:y,minZoom:b,maxZoom:A,smoothTime:_,draggingSmoothTime:L,maxSpeed:I,azimuthRotateSpeed:S,polarRotateSpeed:g,dollySpeed:O,dollyDragInverted:x,truckSpeed:C,dollyToCursor:p,dragToOffset:w,verticalDragToForward:v,boundaryFriction:T,restThreshold:k,colliderMeshes:Q}=h.toRefs(n),Y={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};Qt.install({THREE:Y});const{camera:$,renderer:ee,extend:q,controls:Z}=ae.useTresContext(),ie=h.ref(null);q({CameraControls:Qt}),h.watchEffect(()=>{ne(),ie.value&&r.value?Z.value=ie.value:Z.value=null});function ne(){Le(ie.value,"update",()=>i("change",ie.value)),Le(ie.value,"controlend",()=>i("end",ie.value)),Le(ie.value,"controlstart",()=>i("start",ie.value))}const{onLoop:ce}=ae.useRenderLoop();return ce(({delta:G})=>{var V,M;(V=ie.value)!=null&&V.enabled&&((M=ie.value)==null||M.update(G))}),h.onUnmounted(()=>{ie.value&&ie.value.disconnect()}),e({value:ie}),(G,V)=>(G.camera||h.unref($))&&(G.domElement||h.unref(ee))?(h.openBlock(),h.createElementBlock("TresCameraControls",{key:0,ref_key:"controlsRef",ref:ie,"min-polar-angle":h.unref(s),"max-polar-angle":h.unref(a),"min-azimuth-angle":h.unref(l),"max-azimuth-angle":h.unref(f),distance:h.unref(u),"min-distance":h.unref(d),"max-distance":h.unref(m),"infinity-dolly":h.unref(y),"min-zoom":h.unref(b),"max-zoom":h.unref(A),"smooth-time":h.unref(_),"dragging-smooth-time":h.unref(L),"max-speed":h.unref(I),"azimuth-rotate-speed":h.unref(S),"polar-rotate-speed":h.unref(g),"dolly-speed":h.unref(O),"dolly-drag-inverted":h.unref(x),"truck-speed":h.unref(C),"dolly-to-cursor":h.unref(p),"drag-to-offset":h.unref(w),"vertical-drag-to-forward":h.unref(v),"boundary-friction":h.unref(T),"rest-threshold":h.unref(k),"collider-meshes":h.unref(Q),args:[G.camera||h.unref($),G.domElement||h.unref(ee).domElement]},null,8,Pl)):h.createCommentVNode("",!0)}});class Ll extends c.MeshStandardMaterial{constructor(t={}){super(t);ye(this,"_time");ye(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=`
|
|
190
234
|
uniform float time;
|
|
191
235
|
uniform float factor;
|
|
192
236
|
${t.vertexShader}
|
|
@@ -195,7 +239,166 @@
|
|
|
195
239
|
float s = sin( theta );
|
|
196
240
|
mat3 m = mat3( c, 0, s, 0, 1, 0, -s, 0, c );
|
|
197
241
|
vec3 transformed = vec3( position ) * m;
|
|
198
|
-
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 Ta=["factor"],Oa=h.defineComponent({__name:"index",props:{speed:{default:1},factor:{default:1}},setup(a){const e=a,t=h.shallowRef(),{extend:n}=ne.useTresContext();n({MeshWobbleMaterial:La});const{onLoop:s}=ne.useRenderLoop();return s(({elapsed:i})=>{t.value&&(t.value.time=i*(e==null?void 0:e.speed))}),(i,o)=>(h.openBlock(),h.createElementBlock("TresMeshWobbleMaterial",h.mergeProps({ref_key:"materialRef",ref:t,factor:i.factor},i.$attrs),null,16,Ta))}});function gt(a,e,t){return Math.max(e,Math.min(t,a))}function Da(a,e){return(a%e+e)%e}function Gn(a,e,t){return(1-t)*a+t*e}class Rn{constructor(e=0,t=0){Rn.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6],this.y=s[1]*t+s[4]*n+s[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 n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(gt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),s=Math.sin(t),i=this.x-e.x,o=this.y-e.y;return this.x=i*n-o*s+e.x,this.y=i*s+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}const Ia="",at="srgb",jn="srgb-linear",ka="display-p3",ii="display-p3-linear",En="linear",oi="srgb",ri="rec709",ai="p3";class Nt{constructor(e,t,n,s,i,o,r,l,f){Nt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,s,i,o,r,l,f)}set(e,t,n,s,i,o,r,l,f){const d=this.elements;return d[0]=e,d[1]=s,d[2]=r,d[3]=t,d[4]=i,d[5]=l,d[6]=n,d[7]=o,d[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,s=t.elements,i=this.elements,o=n[0],r=n[3],l=n[6],f=n[1],d=n[4],u=n[7],p=n[2],g=n[5],x=n[8],w=s[0],_=s[3],M=s[6],L=s[1],v=s[4],y=s[7],A=s[2],S=s[5],b=s[8];return i[0]=o*w+r*L+l*A,i[3]=o*_+r*v+l*S,i[6]=o*M+r*y+l*b,i[1]=f*w+d*L+u*A,i[4]=f*_+d*v+u*S,i[7]=f*M+d*y+u*b,i[2]=p*w+g*L+x*A,i[5]=p*_+g*v+x*S,i[8]=p*M+g*y+x*b,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],s=e[2],i=e[3],o=e[4],r=e[5],l=e[6],f=e[7],d=e[8];return t*o*d-t*r*f-n*i*d+n*r*l+s*i*f-s*o*l}invert(){const e=this.elements,t=e[0],n=e[1],s=e[2],i=e[3],o=e[4],r=e[5],l=e[6],f=e[7],d=e[8],u=d*o-r*f,p=r*l-d*i,g=f*i-o*l,x=t*u+n*p+s*g;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/x;return e[0]=u*w,e[1]=(s*f-d*n)*w,e[2]=(r*n-s*o)*w,e[3]=p*w,e[4]=(d*t-s*l)*w,e[5]=(s*i-r*t)*w,e[6]=g*w,e[7]=(n*l-f*t)*w,e[8]=(o*t-n*i)*w,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,s,i,o,r){const l=Math.cos(i),f=Math.sin(i);return this.set(n*l,n*f,-n*(l*o+f*r)+o+e,-s*f,s*l,-s*(-f*o+l*r)+r+t,0,0,1),this}scale(e,t){return this.premultiply(Xn.makeScale(e,t)),this}rotate(e){return this.premultiply(Xn.makeRotation(-e)),this}translate(e,t){return this.premultiply(Xn.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let s=0;s<9;s++)if(t[s]!==n[s])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Xn=new Nt,li=new Nt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),ci=new Nt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),nn={[jn]:{transfer:En,primaries:ri,toReference:a=>a,fromReference:a=>a},[at]:{transfer:oi,primaries:ri,toReference:a=>a.convertSRGBToLinear(),fromReference:a=>a.convertLinearToSRGB()},[ii]:{transfer:En,primaries:ai,toReference:a=>a.applyMatrix3(ci),fromReference:a=>a.applyMatrix3(li)},[ka]:{transfer:oi,primaries:ai,toReference:a=>a.convertSRGBToLinear().applyMatrix3(ci),fromReference:a=>a.applyMatrix3(li).convertLinearToSRGB()}},Fa=new Set([jn,ii]),Ee={enabled:!0,_workingColorSpace:jn,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(a){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!a},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(a){if(!Fa.has(a))throw new Error(`Unsupported working color space, "${a}".`);this._workingColorSpace=a},convert:function(a,e,t){if(this.enabled===!1||e===t||!e||!t)return a;const n=nn[e].toReference,s=nn[t].fromReference;return s(n(a))},fromWorkingColorSpace:function(a,e){return this.convert(a,this._workingColorSpace,e)},toWorkingColorSpace:function(a,e){return this.convert(a,e,this._workingColorSpace)},getPrimaries:function(a){return nn[a].primaries},getTransfer:function(a){return a===Ia?En:nn[a].transfer}};function Yn(a){return a<.04045?a*.0773993808:Math.pow(a*.9478672986+.0521327014,2.4)}function Wn(a){return a<.0031308?a*12.92:1.055*Math.pow(a,.41666)-.055}const hi={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},lt={h:0,s:0,l:0},sn={h:0,s:0,l:0};function Zn(a,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?a+(e-a)*6*t:t<1/2?e:t<2/3?a+(e-a)*6*(2/3-t):a}class on{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const s=e;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=at){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ee.toWorkingColorSpace(this,t),this}setRGB(e,t,n,s=Ee.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ee.toWorkingColorSpace(this,s),this}setHSL(e,t,n,s=Ee.workingColorSpace){if(e=Da(e,1),t=gt(t,0,1),n=gt(n,0,1),t===0)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,o=2*n-i;this.r=Zn(o,i,e+1/3),this.g=Zn(o,i,e),this.b=Zn(o,i,e-1/3)}return Ee.toWorkingColorSpace(this,s),this}setStyle(e,t=at){function n(i){i!==void 0&&parseFloat(i)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(e)){let i;const o=s[1],r=s[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 n(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 n(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 n(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(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const i=s[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=at){const n=hi[e.toLowerCase()];return n!==void 0?this.setHex(n,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=Yn(e.r),this.g=Yn(e.g),this.b=Yn(e.b),this}copyLinearToSRGB(e){return this.r=Wn(e.r),this.g=Wn(e.g),this.b=Wn(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=at){return Ee.fromWorkingColorSpace(Ie.copy(this),e),Math.round(gt(Ie.r*255,0,255))*65536+Math.round(gt(Ie.g*255,0,255))*256+Math.round(gt(Ie.b*255,0,255))}getHexString(e=at){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ee.workingColorSpace){Ee.fromWorkingColorSpace(Ie.copy(this),t);const n=Ie.r,s=Ie.g,i=Ie.b,o=Math.max(n,s,i),r=Math.min(n,s,i);let l,f;const d=(r+o)/2;if(r===o)l=0,f=0;else{const u=o-r;switch(f=d<=.5?u/(o+r):u/(2-o-r),o){case n:l=(s-i)/u+(s<i?6:0);break;case s:l=(i-n)/u+2;break;case i:l=(n-s)/u+4;break}l/=6}return e.h=l,e.s=f,e.l=d,e}getRGB(e,t=Ee.workingColorSpace){return Ee.fromWorkingColorSpace(Ie.copy(this),t),e.r=Ie.r,e.g=Ie.g,e.b=Ie.b,e}getStyle(e=at){Ee.fromWorkingColorSpace(Ie.copy(this),e);const t=Ie.r,n=Ie.g,s=Ie.b;return e!==at?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(s*255)})`}offsetHSL(e,t,n){return this.getHSL(lt),this.setHSL(lt.h+e,lt.s+t,lt.l+n)}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,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(lt),e.getHSL(sn);const n=Gn(lt.h,sn.h,t),s=Gn(lt.s,sn.s,t),i=Gn(lt.l,sn.l,t);return this.setHSL(n,s,i),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,s=this.b,i=e.elements;return this.r=i[0]*t+i[3]*n+i[6]*s,this.g=i[1]*t+i[4]*n+i[7]*s,this.b=i[2]*t+i[5]*n+i[8]*s,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 Ie=new on;on.NAMES=hi;class Ba extends c.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 Rn(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get(){return gt(2.5*(this.ior-1)/(this.ior+1),0,1)},set(n){this.ior=(1+.4*n)/(1-.4*n)}}),this.roughness=0,this.transmissionMap=null,this.thickness=.5,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new on(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new on(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 Ua=Ba,Va=h.defineComponent({__name:"index",setup(a,{expose:e}){const t=h.shallowRef(),{extend:n}=ne.useTresContext();return n({MeshGlassMaterial:Ua}),e({MeshGlassMaterialClass:t}),(s,i)=>(h.openBlock(),h.createElementBlock("TresMeshGlassMaterial",{ref_key:"MeshGlassMaterialClass",ref:t},null,512))}}),za=["args"],Na=["color"],Ga=h.defineComponent({__name:"Box",props:{args:{default:()=>[1,1,1]},color:{default:"#ffffff"}},setup(a,{expose:e}){const t=a,{args:n,color:s}=h.toRefs(t),i=h.shallowRef();return e({value:i}),(o,r)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"boxRef",ref:i},o.$attrs),[h.createElementVNode("TresBoxGeometry",{args:h.unref(n)},null,8,za),h.renderSlot(o.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(s)},null,8,Na)])],16))}}),ui=new c.Box3,rn=new c.Vector3;class di extends c.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new c.Float32BufferAttribute(e,3)),this.setAttribute("uv",new c.Float32BufferAttribute(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new c.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new c.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceEnd",new c.InterleavedBufferAttribute(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new c.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new c.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceColorEnd",new c.InterleavedBufferAttribute(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new c.WireframeGeometry(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new c.Box3);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),ui.setFromBufferAttribute(t),this.boundingBox.union(ui))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new c.Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let s=0;for(let i=0,o=e.count;i<o;i++)rn.fromBufferAttribute(e,i),s=Math.max(s,n.distanceToSquared(rn)),rn.fromBufferAttribute(t,i),s=Math.max(s,n.distanceToSquared(rn));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}c.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new c.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},c.ShaderLib.line={uniforms:c.UniformsUtils.merge([c.UniformsLib.common,c.UniformsLib.fog,c.UniformsLib.line]),vertexShader:`
|
|
242
|
+
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 Tl=["factor"],Ol=h.defineComponent({__name:"index",props:{speed:{default:1},factor:{default:1}},setup(o){const e=o,t=h.shallowRef(),{extend:n}=ae.useTresContext();n({MeshWobbleMaterial:Ll});const{onLoop:i}=ae.useRenderLoop();return i(({elapsed:r})=>{t.value&&(t.value.time=r*(e==null?void 0:e.speed))}),(r,s)=>(h.openBlock(),h.createElementBlock("TresMeshWobbleMaterial",h.mergeProps({ref_key:"materialRef",ref:t,factor:r.factor},r.$attrs),null,16,Tl))}});function pt(o,e,t){return Math.max(e,Math.min(t,o))}function Il(o,e){return(o%e+e)%e}function Dl(o,e,t,n,i){return n+(o-e)*(i-n)/(t-e)}function ii(o,e,t){return(1-t)*o+t*e}class ri{constructor(e=0,t=0){ri.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=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 n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(pt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*n-s*i+e.x,this.y=r*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}const kl="",mt="srgb",si="srgb-linear",Fl="display-p3",kr="display-p3-linear",oi="linear",Fr="srgb",Br="rec709",Ur="p3";class Jt{constructor(e,t,n,i,r,s,a,l,f){Jt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,s,a,l,f)}set(e,t,n,i,r,s,a,l,f){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=r,u[5]=l,u[6]=n,u[7]=s,u[8]=f,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],a=n[3],l=n[6],f=n[1],u=n[4],d=n[7],m=n[2],y=n[5],b=n[8],A=i[0],_=i[3],L=i[6],I=i[1],S=i[4],g=i[7],O=i[2],x=i[5],C=i[8];return r[0]=s*A+a*I+l*O,r[3]=s*_+a*S+l*x,r[6]=s*L+a*g+l*C,r[1]=f*A+u*I+d*O,r[4]=f*_+u*S+d*x,r[7]=f*L+u*g+d*C,r[2]=m*A+y*I+b*O,r[5]=m*_+y*S+b*x,r[8]=m*L+y*g+b*C,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],a=e[5],l=e[6],f=e[7],u=e[8];return t*s*u-t*a*f-n*r*u+n*a*l+i*r*f-i*s*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],a=e[5],l=e[6],f=e[7],u=e[8],d=u*s-a*f,m=a*l-u*r,y=f*r-s*l,b=t*d+n*m+i*y;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);const A=1/b;return e[0]=d*A,e[1]=(i*f-u*n)*A,e[2]=(a*n-i*s)*A,e[3]=m*A,e[4]=(u*t-i*l)*A,e[5]=(i*r-a*t)*A,e[6]=y*A,e[7]=(n*l-f*t)*A,e[8]=(s*t-n*r)*A,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,s,a){const l=Math.cos(r),f=Math.sin(r);return this.set(n*l,n*f,-n*(l*s+f*a)+s+e,-i*f,i*l,-i*(-f*s+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(ai.makeScale(e,t)),this}rotate(e){return this.premultiply(ai.makeRotation(-e)),this}translate(e,t){return this.premultiply(ai.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const ai=new Jt,Nr=new Jt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Vr=new Jt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),_n={[si]:{transfer:oi,primaries:Br,toReference:o=>o,fromReference:o=>o},[mt]:{transfer:Fr,primaries:Br,toReference:o=>o.convertSRGBToLinear(),fromReference:o=>o.convertLinearToSRGB()},[kr]:{transfer:oi,primaries:Ur,toReference:o=>o.applyMatrix3(Vr),fromReference:o=>o.applyMatrix3(Nr)},[Fl]:{transfer:Fr,primaries:Ur,toReference:o=>o.convertSRGBToLinear().applyMatrix3(Vr),fromReference:o=>o.applyMatrix3(Nr).convertLinearToSRGB()}},Bl=new Set([si,kr]),Ke={enabled:!0,_workingColorSpace:si,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(o){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!o},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(o){if(!Bl.has(o))throw new Error(`Unsupported working color space, "${o}".`);this._workingColorSpace=o},convert:function(o,e,t){if(this.enabled===!1||e===t||!e||!t)return o;const n=_n[e].toReference,i=_n[t].fromReference;return i(n(o))},fromWorkingColorSpace:function(o,e){return this.convert(o,this._workingColorSpace,e)},toWorkingColorSpace:function(o,e){return this.convert(o,e,this._workingColorSpace)},getPrimaries:function(o){return _n[o].primaries},getTransfer:function(o){return o===kl?oi:_n[o].transfer}};function li(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function ci(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}const zr={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},gt={h:0,s:0,l:0},vn={h:0,s:0,l:0};function hi(o,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?o+(e-o)*6*t:t<1/2?e:t<2/3?o+(e-o)*6*(2/3-t):o}class wn{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=mt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ke.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Ke.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ke.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Ke.workingColorSpace){if(e=Il(e,1),t=pt(t,0,1),n=pt(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,s=2*n-r;this.r=hi(s,r,e+1/3),this.g=hi(s,r,e),this.b=hi(s,r,e-1/3)}return Ke.toWorkingColorSpace(this,i),this}setStyle(e,t=mt){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const s=i[1],a=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=i[1],s=r.length;if(s===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(s===6)return this.setHex(parseInt(r,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=mt){const n=zr[e.toLowerCase()];return n!==void 0?this.setHex(n,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=li(e.r),this.g=li(e.g),this.b=li(e.b),this}copyLinearToSRGB(e){return this.r=ci(e.r),this.g=ci(e.g),this.b=ci(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=mt){return Ke.fromWorkingColorSpace(Ne.copy(this),e),Math.round(pt(Ne.r*255,0,255))*65536+Math.round(pt(Ne.g*255,0,255))*256+Math.round(pt(Ne.b*255,0,255))}getHexString(e=mt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ke.workingColorSpace){Ke.fromWorkingColorSpace(Ne.copy(this),t);const n=Ne.r,i=Ne.g,r=Ne.b,s=Math.max(n,i,r),a=Math.min(n,i,r);let l,f;const u=(a+s)/2;if(a===s)l=0,f=0;else{const d=s-a;switch(f=u<=.5?d/(s+a):d/(2-s-a),s){case n:l=(i-r)/d+(i<r?6:0);break;case i:l=(r-n)/d+2;break;case r:l=(n-i)/d+4;break}l/=6}return e.h=l,e.s=f,e.l=u,e}getRGB(e,t=Ke.workingColorSpace){return Ke.fromWorkingColorSpace(Ne.copy(this),t),e.r=Ne.r,e.g=Ne.g,e.b=Ne.b,e}getStyle(e=mt){Ke.fromWorkingColorSpace(Ne.copy(this),e);const t=Ne.r,n=Ne.g,i=Ne.b;return e!==mt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}offsetHSL(e,t,n){return this.getHSL(gt),this.setHSL(gt.h+e,gt.s+t,gt.l+n)}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,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(gt),e.getHSL(vn);const n=ii(gt.h,vn.h,t),i=ii(gt.s,vn.s,t),r=ii(gt.l,vn.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Ne=new wn;wn.NAMES=zr;class Ul extends c.MeshStandardMaterial{constructor(t={}){super();ye(this,"isMeshPhysicalMaterial");ye(this,"clearcoatMap");ye(this,"clearcoatRoughness");ye(this,"clearcoatRoughnessMap");ye(this,"clearcoatNormalScale");ye(this,"clearcoatNormalMap");ye(this,"ior");ye(this,"transmissionMap");ye(this,"thickness");ye(this,"thicknessMap");ye(this,"attenuationDistance");ye(this,"attenuationColor");ye(this,"specularIntensity");ye(this,"specularIntensityMap");ye(this,"specularColor");ye(this,"specularColorMap");ye(this,"_clearcoat");ye(this,"_transmission");this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ri(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get(){return pt(2.5*(this.ior-1)/(this.ior+1),0,1)},set(n){this.ior=(1+.4*n)/(1-.4*n)}}),this.roughness=0,this.transmissionMap=null,this.thickness=.5,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new wn(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new wn(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 Nl=Ul,Vl=h.defineComponent({__name:"index",setup(o,{expose:e}){const t=h.shallowRef(),{extend:n}=ae.useTresContext();return n({MeshGlassMaterial:Nl}),e({MeshGlassMaterialClass:t}),(i,r)=>(h.openBlock(),h.createElementBlock("TresMeshGlassMaterial",{ref_key:"MeshGlassMaterialClass",ref:t},null,512))}});var zl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ht(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}function xn(o){throw new Error('Could not dynamically require "'+o+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var jr={exports:{}};(function(o,e){(function(t){o.exports=t()})(function(){return function t(n,i,r){function s(f,u){if(!i[f]){if(!n[f]){var d=typeof xn=="function"&&xn;if(!u&&d)return d(f,!0);if(a)return a(f,!0);throw new Error("Cannot find module '"+f+"'")}u=i[f]={exports:{}},n[f][0].call(u.exports,function(m){var y=n[f][1][m];return s(y||m)},u,u.exports,t,n,i,r)}return i[f].exports}for(var a=typeof xn=="function"&&xn,l=0;l<r.length;l++)s(r[l]);return s}({1:[function(t,n,i){(function(r,s,a,l,f,u,d,m,y){var b=t("crypto");function A(x,C){C=I(x,C);var p;return(p=C.algorithm!=="passthrough"?b.createHash(C.algorithm):new O).write===void 0&&(p.write=p.update,p.end=p.update),g(C,p).dispatch(x),p.update||p.end(""),p.digest?p.digest(C.encoding==="buffer"?void 0:C.encoding):(x=p.read(),C.encoding!=="buffer"?x.toString(C.encoding):x)}(i=n.exports=A).sha1=function(x){return A(x)},i.keys=function(x){return A(x,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},i.MD5=function(x){return A(x,{algorithm:"md5",encoding:"hex"})},i.keysMD5=function(x){return A(x,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var _=b.getHashes?b.getHashes().slice():["sha1","md5"],L=(_.push("passthrough"),["buffer","hex","binary","base64"]);function I(x,C){var p={};if(p.algorithm=(C=C||{}).algorithm||"sha1",p.encoding=C.encoding||"hex",p.excludeValues=!!C.excludeValues,p.algorithm=p.algorithm.toLowerCase(),p.encoding=p.encoding.toLowerCase(),p.ignoreUnknown=C.ignoreUnknown===!0,p.respectType=C.respectType!==!1,p.respectFunctionNames=C.respectFunctionNames!==!1,p.respectFunctionProperties=C.respectFunctionProperties!==!1,p.unorderedArrays=C.unorderedArrays===!0,p.unorderedSets=C.unorderedSets!==!1,p.unorderedObjects=C.unorderedObjects!==!1,p.replacer=C.replacer||void 0,p.excludeKeys=C.excludeKeys||void 0,x===void 0)throw new Error("Object argument required.");for(var w=0;w<_.length;++w)_[w].toLowerCase()===p.algorithm.toLowerCase()&&(p.algorithm=_[w]);if(_.indexOf(p.algorithm)===-1)throw new Error('Algorithm "'+p.algorithm+'" not supported. supported values: '+_.join(", "));if(L.indexOf(p.encoding)===-1&&p.algorithm!=="passthrough")throw new Error('Encoding "'+p.encoding+'" not supported. supported values: '+L.join(", "));return p}function S(x){if(typeof x=="function")return/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(x))!=null}function g(x,C,p){p=p||[];function w(v){return C.update?C.update(v,"utf8"):C.write(v,"utf8")}return{dispatch:function(v){return this["_"+((v=x.replacer?x.replacer(v):v)===null?"null":typeof v)](v)},_object:function(v){var T,k=Object.prototype.toString.call(v),Q=/\[object (.*)\]/i.exec(k);if(Q=(Q=Q?Q[1]:"unknown:["+k+"]").toLowerCase(),0<=(k=p.indexOf(v)))return this.dispatch("[CIRCULAR:"+k+"]");if(p.push(v),a!==void 0&&a.isBuffer&&a.isBuffer(v))return w("buffer:"),w(v);if(Q==="object"||Q==="function"||Q==="asyncfunction")return k=Object.keys(v),x.unorderedObjects&&(k=k.sort()),x.respectType===!1||S(v)||k.splice(0,0,"prototype","__proto__","constructor"),x.excludeKeys&&(k=k.filter(function(Y){return!x.excludeKeys(Y)})),w("object:"+k.length+":"),T=this,k.forEach(function(Y){T.dispatch(Y),w(":"),x.excludeValues||T.dispatch(v[Y]),w(",")});if(!this["_"+Q]){if(x.ignoreUnknown)return w("["+Q+"]");throw new Error('Unknown object type "'+Q+'"')}this["_"+Q](v)},_array:function(v,Y){Y=Y!==void 0?Y:x.unorderedArrays!==!1;var k=this;if(w("array:"+v.length+":"),!Y||v.length<=1)return v.forEach(function($){return k.dispatch($)});var Q=[],Y=v.map(function($){var ee=new O,q=p.slice();return g(x,ee,q).dispatch($),Q=Q.concat(q.slice(p.length)),ee.read().toString()});return p=p.concat(Q),Y.sort(),this._array(Y,!1)},_date:function(v){return w("date:"+v.toJSON())},_symbol:function(v){return w("symbol:"+v.toString())},_error:function(v){return w("error:"+v.toString())},_boolean:function(v){return w("bool:"+v.toString())},_string:function(v){w("string:"+v.length+":"),w(v.toString())},_function:function(v){w("fn:"),S(v)?this.dispatch("[native]"):this.dispatch(v.toString()),x.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(v.name)),x.respectFunctionProperties&&this._object(v)},_number:function(v){return w("number:"+v.toString())},_xml:function(v){return w("xml:"+v.toString())},_null:function(){return w("Null")},_undefined:function(){return w("Undefined")},_regexp:function(v){return w("regex:"+v.toString())},_uint8array:function(v){return w("uint8array:"),this.dispatch(Array.prototype.slice.call(v))},_uint8clampedarray:function(v){return w("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(v))},_int8array:function(v){return w("int8array:"),this.dispatch(Array.prototype.slice.call(v))},_uint16array:function(v){return w("uint16array:"),this.dispatch(Array.prototype.slice.call(v))},_int16array:function(v){return w("int16array:"),this.dispatch(Array.prototype.slice.call(v))},_uint32array:function(v){return w("uint32array:"),this.dispatch(Array.prototype.slice.call(v))},_int32array:function(v){return w("int32array:"),this.dispatch(Array.prototype.slice.call(v))},_float32array:function(v){return w("float32array:"),this.dispatch(Array.prototype.slice.call(v))},_float64array:function(v){return w("float64array:"),this.dispatch(Array.prototype.slice.call(v))},_arraybuffer:function(v){return w("arraybuffer:"),this.dispatch(new Uint8Array(v))},_url:function(v){return w("url:"+v.toString())},_map:function(v){return w("map:"),v=Array.from(v),this._array(v,x.unorderedSets!==!1)},_set:function(v){return w("set:"),v=Array.from(v),this._array(v,x.unorderedSets!==!1)},_file:function(v){return w("file:"),this.dispatch([v.name,v.size,v.type,v.lastModfied])},_blob:function(){if(x.ignoreUnknown)return w("[blob]");throw Error(`Hashing Blob objects is currently not supported
|
|
243
|
+
(see https://github.com/puleos/object-hash/issues/26)
|
|
244
|
+
Use "options.replacer" or "options.ignoreUnknown"
|
|
245
|
+
`)},_domwindow:function(){return w("domwindow")},_bigint:function(v){return w("bigint:"+v.toString())},_process:function(){return w("process")},_timer:function(){return w("timer")},_pipe:function(){return w("pipe")},_tcp:function(){return w("tcp")},_udp:function(){return w("udp")},_tty:function(){return w("tty")},_statwatcher:function(){return w("statwatcher")},_securecontext:function(){return w("securecontext")},_connection:function(){return w("connection")},_zlib:function(){return w("zlib")},_context:function(){return w("context")},_nodescript:function(){return w("nodescript")},_httpparser:function(){return w("httpparser")},_dataview:function(){return w("dataview")},_signal:function(){return w("signal")},_fsevent:function(){return w("fsevent")},_tlswrap:function(){return w("tlswrap")}}}function O(){return{buf:"",write:function(x){this.buf+=x},end:function(x){this.buf+=x},read:function(){return this.buf}}}i.writeToStream=function(x,C,p){return p===void 0&&(p=C,C={}),g(C=I(x,C),p).dispatch(x)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/")},{buffer:3,crypto:5,lYpoI2:11}],2:[function(t,n,i){(function(r,s,a,l,f,u,d,m,y){(function(b){var A=typeof Uint8Array<"u"?Uint8Array:Array,_=43,L=47,I=48,S=97,g=65,O=45,x=95;function C(p){return p=p.charCodeAt(0),p===_||p===O?62:p===L||p===x?63:p<I?-1:p<I+10?p-I+26+26:p<g+26?p-g:p<S+26?p-S+26:void 0}b.toByteArray=function(p){var w,v;if(0<p.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var T=p.length,T=p.charAt(T-2)==="="?2:p.charAt(T-1)==="="?1:0,k=new A(3*p.length/4-T),Q=0<T?p.length-4:p.length,Y=0;function $(ee){k[Y++]=ee}for(w=0;w<Q;w+=4,0)$((16711680&(v=C(p.charAt(w))<<18|C(p.charAt(w+1))<<12|C(p.charAt(w+2))<<6|C(p.charAt(w+3))))>>16),$((65280&v)>>8),$(255&v);return T==2?$(255&(v=C(p.charAt(w))<<2|C(p.charAt(w+1))>>4)):T==1&&($((v=C(p.charAt(w))<<10|C(p.charAt(w+1))<<4|C(p.charAt(w+2))>>2)>>8&255),$(255&v)),k},b.fromByteArray=function(p){var w,v,T,k,Q=p.length%3,Y="";function $(ee){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(ee)}for(w=0,T=p.length-Q;w<T;w+=3)v=(p[w]<<16)+(p[w+1]<<8)+p[w+2],Y+=$((k=v)>>18&63)+$(k>>12&63)+$(k>>6&63)+$(63&k);switch(Q){case 1:Y=(Y+=$((v=p[p.length-1])>>2))+$(v<<4&63)+"==";break;case 2:Y=(Y=(Y+=$((v=(p[p.length-2]<<8)+p[p.length-1])>>10))+$(v>>4&63))+$(v<<2&63)+"="}return Y}})(i===void 0?this.base64js={}:i)}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(t,n,i){(function(r,s,_,l,f,u,d,m,y){var b=t("base64-js"),A=t("ieee754");function _(P,D,F){if(!(this instanceof _))return new _(P,D,F);var R,W,X,te,U=typeof P;if(D==="base64"&&U=="string")for(P=(te=P).trim?te.trim():te.replace(/^\s+|\s+$/g,"");P.length%4!=0;)P+="=";if(U=="number")R=Z(P);else if(U=="string")R=_.byteLength(P,D);else{if(U!="object")throw new Error("First argument needs to be a number, array or string.");R=Z(P.length)}if(_._useTypedArrays?W=_._augment(new Uint8Array(R)):((W=this).length=R,W._isBuffer=!0),_._useTypedArrays&&typeof P.byteLength=="number")W._set(P);else if(ie(te=P)||_.isBuffer(te)||te&&typeof te=="object"&&typeof te.length=="number")for(X=0;X<R;X++)_.isBuffer(P)?W[X]=P.readUInt8(X):W[X]=P[X];else if(U=="string")W.write(P,0,D);else if(U=="number"&&!_._useTypedArrays&&!F)for(X=0;X<R;X++)W[X]=0;return W}function L(P,D,F,R){return _._charsWritten=V(function(W){for(var X=[],te=0;te<W.length;te++)X.push(255&W.charCodeAt(te));return X}(D),P,F,R)}function I(P,D,F,R){return _._charsWritten=V(function(W){for(var X,te,U=[],B=0;B<W.length;B++)te=W.charCodeAt(B),X=te>>8,te=te%256,U.push(te),U.push(X);return U}(D),P,F,R)}function S(P,D,F){var R="";F=Math.min(P.length,F);for(var W=D;W<F;W++)R+=String.fromCharCode(P[W]);return R}function g(P,D,F,X){X||(j(typeof F=="boolean","missing or invalid endian"),j(D!=null,"missing offset"),j(D+1<P.length,"Trying to read beyond buffer length"));var W,X=P.length;if(!(X<=D))return F?(W=P[D],D+1<X&&(W|=P[D+1]<<8)):(W=P[D]<<8,D+1<X&&(W|=P[D+1])),W}function O(P,D,F,X){X||(j(typeof F=="boolean","missing or invalid endian"),j(D!=null,"missing offset"),j(D+3<P.length,"Trying to read beyond buffer length"));var W,X=P.length;if(!(X<=D))return F?(D+2<X&&(W=P[D+2]<<16),D+1<X&&(W|=P[D+1]<<8),W|=P[D],D+3<X&&(W+=P[D+3]<<24>>>0)):(D+1<X&&(W=P[D+1]<<16),D+2<X&&(W|=P[D+2]<<8),D+3<X&&(W|=P[D+3]),W+=P[D]<<24>>>0),W}function x(P,D,F,R){if(R||(j(typeof F=="boolean","missing or invalid endian"),j(D!=null,"missing offset"),j(D+1<P.length,"Trying to read beyond buffer length")),!(P.length<=D))return R=g(P,D,F,!0),32768&R?-1*(65535-R+1):R}function C(P,D,F,R){if(R||(j(typeof F=="boolean","missing or invalid endian"),j(D!=null,"missing offset"),j(D+3<P.length,"Trying to read beyond buffer length")),!(P.length<=D))return R=O(P,D,F,!0),2147483648&R?-1*(4294967295-R+1):R}function p(P,D,F,R){return R||(j(typeof F=="boolean","missing or invalid endian"),j(D+3<P.length,"Trying to read beyond buffer length")),A.read(P,D,F,23,4)}function w(P,D,F,R){return R||(j(typeof F=="boolean","missing or invalid endian"),j(D+7<P.length,"Trying to read beyond buffer length")),A.read(P,D,F,52,8)}function v(P,D,F,R,W){if(W||(j(D!=null,"missing value"),j(typeof R=="boolean","missing or invalid endian"),j(F!=null,"missing offset"),j(F+1<P.length,"trying to write beyond buffer length"),z(D,65535)),W=P.length,!(W<=F))for(var X=0,te=Math.min(W-F,2);X<te;X++)P[F+X]=(D&255<<8*(R?X:1-X))>>>8*(R?X:1-X)}function T(P,D,F,R,W){if(W||(j(D!=null,"missing value"),j(typeof R=="boolean","missing or invalid endian"),j(F!=null,"missing offset"),j(F+3<P.length,"trying to write beyond buffer length"),z(D,4294967295)),W=P.length,!(W<=F))for(var X=0,te=Math.min(W-F,4);X<te;X++)P[F+X]=D>>>8*(R?X:3-X)&255}function k(P,D,F,R,W){W||(j(D!=null,"missing value"),j(typeof R=="boolean","missing or invalid endian"),j(F!=null,"missing offset"),j(F+1<P.length,"Trying to write beyond buffer length"),H(D,32767,-32768)),P.length<=F||v(P,0<=D?D:65535+D+1,F,R,W)}function Q(P,D,F,R,W){W||(j(D!=null,"missing value"),j(typeof R=="boolean","missing or invalid endian"),j(F!=null,"missing offset"),j(F+3<P.length,"Trying to write beyond buffer length"),H(D,2147483647,-2147483648)),P.length<=F||T(P,0<=D?D:4294967295+D+1,F,R,W)}function Y(P,D,F,R,W){W||(j(D!=null,"missing value"),j(typeof R=="boolean","missing or invalid endian"),j(F!=null,"missing offset"),j(F+3<P.length,"Trying to write beyond buffer length"),N(D,34028234663852886e22,-34028234663852886e22)),P.length<=F||A.write(P,D,F,R,23,4)}function $(P,D,F,R,W){W||(j(D!=null,"missing value"),j(typeof R=="boolean","missing or invalid endian"),j(F!=null,"missing offset"),j(F+7<P.length,"Trying to write beyond buffer length"),N(D,17976931348623157e292,-17976931348623157e292)),P.length<=F||A.write(P,D,F,R,52,8)}i.Buffer=_,i.SlowBuffer=_,i.INSPECT_MAX_BYTES=50,_.poolSize=8192,_._useTypedArrays=function(){try{var P=new ArrayBuffer(0),D=new Uint8Array(P);return D.foo=function(){return 42},D.foo()===42&&typeof D.subarray=="function"}catch{return!1}}(),_.isEncoding=function(P){switch(String(P).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},_.isBuffer=function(P){return!(P==null||!P._isBuffer)},_.byteLength=function(P,D){var F;switch(P+="",D||"utf8"){case"hex":F=P.length/2;break;case"utf8":case"utf-8":F=ce(P).length;break;case"ascii":case"binary":case"raw":F=P.length;break;case"base64":F=G(P).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":F=2*P.length;break;default:throw new Error("Unknown encoding")}return F},_.concat=function(P,D){if(j(ie(P),`Usage: Buffer.concat(list, [totalLength])
|
|
246
|
+
list should be an Array.`),P.length===0)return new _(0);if(P.length===1)return P[0];if(typeof D!="number")for(W=D=0;W<P.length;W++)D+=P[W].length;for(var F=new _(D),R=0,W=0;W<P.length;W++){var X=P[W];X.copy(F,R),R+=X.length}return F},_.prototype.write=function(P,D,F,R){isFinite(D)?isFinite(F)||(R=F,F=void 0):(B=R,R=D,D=F,F=B),D=Number(D)||0;var W,X,te,U,B=this.length-D;switch((!F||B<(F=Number(F)))&&(F=B),R=String(R||"utf8").toLowerCase()){case"hex":W=function(oe,le,me,_e){me=Number(me)||0;var we=oe.length-me;(!_e||we<(_e=Number(_e)))&&(_e=we),j((we=le.length)%2==0,"Invalid hex string"),we/2<_e&&(_e=we/2);for(var Ie=0;Ie<_e;Ie++){var st=parseInt(le.substr(2*Ie,2),16);j(!isNaN(st),"Invalid hex string"),oe[me+Ie]=st}return _._charsWritten=2*Ie,Ie}(this,P,D,F);break;case"utf8":case"utf-8":X=this,te=D,U=F,W=_._charsWritten=V(ce(P),X,te,U);break;case"ascii":case"binary":W=L(this,P,D,F);break;case"base64":X=this,te=D,U=F,W=_._charsWritten=V(G(P),X,te,U);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":W=I(this,P,D,F);break;default:throw new Error("Unknown encoding")}return W},_.prototype.toString=function(P,D,F){var R,W,X,te,U=this;if(P=String(P||"utf8").toLowerCase(),D=Number(D)||0,(F=F!==void 0?Number(F):U.length)===D)return"";switch(P){case"hex":R=function(B,oe,le){var me=B.length;(!oe||oe<0)&&(oe=0),(!le||le<0||me<le)&&(le=me);for(var _e="",we=oe;we<le;we++)_e+=ne(B[we]);return _e}(U,D,F);break;case"utf8":case"utf-8":R=function(B,oe,le){var me="",_e="";le=Math.min(B.length,le);for(var we=oe;we<le;we++)B[we]<=127?(me+=M(_e)+String.fromCharCode(B[we]),_e=""):_e+="%"+B[we].toString(16);return me+M(_e)}(U,D,F);break;case"ascii":case"binary":R=S(U,D,F);break;case"base64":W=U,te=F,R=(X=D)===0&&te===W.length?b.fromByteArray(W):b.fromByteArray(W.slice(X,te));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":R=function(B,oe,le){for(var me=B.slice(oe,le),_e="",we=0;we<me.length;we+=2)_e+=String.fromCharCode(me[we]+256*me[we+1]);return _e}(U,D,F);break;default:throw new Error("Unknown encoding")}return R},_.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},_.prototype.copy=function(P,D,F,R){if(D=D||0,(R=R||R===0?R:this.length)!==(F=F||0)&&P.length!==0&&this.length!==0){j(F<=R,"sourceEnd < sourceStart"),j(0<=D&&D<P.length,"targetStart out of bounds"),j(0<=F&&F<this.length,"sourceStart out of bounds"),j(0<=R&&R<=this.length,"sourceEnd out of bounds"),R>this.length&&(R=this.length);var W=(R=P.length-D<R-F?P.length-D+F:R)-F;if(W<100||!_._useTypedArrays)for(var X=0;X<W;X++)P[X+D]=this[X+F];else P._set(this.subarray(F,F+W),D)}},_.prototype.slice=function(P,D){var F=this.length;if(P=q(P,F,0),D=q(D,F,F),_._useTypedArrays)return _._augment(this.subarray(P,D));for(var R=D-P,W=new _(R,void 0,!0),X=0;X<R;X++)W[X]=this[X+P];return W},_.prototype.get=function(P){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(P)},_.prototype.set=function(P,D){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(P,D)},_.prototype.readUInt8=function(P,D){if(D||(j(P!=null,"missing offset"),j(P<this.length,"Trying to read beyond buffer length")),!(P>=this.length))return this[P]},_.prototype.readUInt16LE=function(P,D){return g(this,P,!0,D)},_.prototype.readUInt16BE=function(P,D){return g(this,P,!1,D)},_.prototype.readUInt32LE=function(P,D){return O(this,P,!0,D)},_.prototype.readUInt32BE=function(P,D){return O(this,P,!1,D)},_.prototype.readInt8=function(P,D){if(D||(j(P!=null,"missing offset"),j(P<this.length,"Trying to read beyond buffer length")),!(P>=this.length))return 128&this[P]?-1*(255-this[P]+1):this[P]},_.prototype.readInt16LE=function(P,D){return x(this,P,!0,D)},_.prototype.readInt16BE=function(P,D){return x(this,P,!1,D)},_.prototype.readInt32LE=function(P,D){return C(this,P,!0,D)},_.prototype.readInt32BE=function(P,D){return C(this,P,!1,D)},_.prototype.readFloatLE=function(P,D){return p(this,P,!0,D)},_.prototype.readFloatBE=function(P,D){return p(this,P,!1,D)},_.prototype.readDoubleLE=function(P,D){return w(this,P,!0,D)},_.prototype.readDoubleBE=function(P,D){return w(this,P,!1,D)},_.prototype.writeUInt8=function(P,D,F){F||(j(P!=null,"missing value"),j(D!=null,"missing offset"),j(D<this.length,"trying to write beyond buffer length"),z(P,255)),D>=this.length||(this[D]=P)},_.prototype.writeUInt16LE=function(P,D,F){v(this,P,D,!0,F)},_.prototype.writeUInt16BE=function(P,D,F){v(this,P,D,!1,F)},_.prototype.writeUInt32LE=function(P,D,F){T(this,P,D,!0,F)},_.prototype.writeUInt32BE=function(P,D,F){T(this,P,D,!1,F)},_.prototype.writeInt8=function(P,D,F){F||(j(P!=null,"missing value"),j(D!=null,"missing offset"),j(D<this.length,"Trying to write beyond buffer length"),H(P,127,-128)),D>=this.length||(0<=P?this.writeUInt8(P,D,F):this.writeUInt8(255+P+1,D,F))},_.prototype.writeInt16LE=function(P,D,F){k(this,P,D,!0,F)},_.prototype.writeInt16BE=function(P,D,F){k(this,P,D,!1,F)},_.prototype.writeInt32LE=function(P,D,F){Q(this,P,D,!0,F)},_.prototype.writeInt32BE=function(P,D,F){Q(this,P,D,!1,F)},_.prototype.writeFloatLE=function(P,D,F){Y(this,P,D,!0,F)},_.prototype.writeFloatBE=function(P,D,F){Y(this,P,D,!1,F)},_.prototype.writeDoubleLE=function(P,D,F){$(this,P,D,!0,F)},_.prototype.writeDoubleBE=function(P,D,F){$(this,P,D,!1,F)},_.prototype.fill=function(P,D,F){if(D=D||0,F=F||this.length,j(typeof(P=typeof(P=P||0)=="string"?P.charCodeAt(0):P)=="number"&&!isNaN(P),"value is not a number"),j(D<=F,"end < start"),F!==D&&this.length!==0){j(0<=D&&D<this.length,"start out of bounds"),j(0<=F&&F<=this.length,"end out of bounds");for(var R=D;R<F;R++)this[R]=P}},_.prototype.inspect=function(){for(var P=[],D=this.length,F=0;F<D;F++)if(P[F]=ne(this[F]),F===i.INSPECT_MAX_BYTES){P[F+1]="...";break}return"<Buffer "+P.join(" ")+">"},_.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(_._useTypedArrays)return new _(this).buffer;for(var P=new Uint8Array(this.length),D=0,F=P.length;D<F;D+=1)P[D]=this[D];return P.buffer};var ee=_.prototype;function q(P,D,F){return typeof P!="number"?F:D<=(P=~~P)?D:0<=P||0<=(P+=D)?P:0}function Z(P){return(P=~~Math.ceil(+P))<0?0:P}function ie(P){return(Array.isArray||function(D){return Object.prototype.toString.call(D)==="[object Array]"})(P)}function ne(P){return P<16?"0"+P.toString(16):P.toString(16)}function ce(P){for(var D=[],F=0;F<P.length;F++){var R=P.charCodeAt(F);if(R<=127)D.push(P.charCodeAt(F));else for(var W=F,X=(55296<=R&&R<=57343&&F++,encodeURIComponent(P.slice(W,F+1)).substr(1).split("%")),te=0;te<X.length;te++)D.push(parseInt(X[te],16))}return D}function G(P){return b.toByteArray(P)}function V(P,D,F,R){for(var W=0;W<R&&!(W+F>=D.length||W>=P.length);W++)D[W+F]=P[W];return W}function M(P){try{return decodeURIComponent(P)}catch{return"�"}}function z(P,D){j(typeof P=="number","cannot write a non-number as a number"),j(0<=P,"specified a negative value for writing an unsigned value"),j(P<=D,"value is larger than maximum value for type"),j(Math.floor(P)===P,"value has a fractional component")}function H(P,D,F){j(typeof P=="number","cannot write a non-number as a number"),j(P<=D,"value larger than maximum allowed value"),j(F<=P,"value smaller than minimum allowed value"),j(Math.floor(P)===P,"value has a fractional component")}function N(P,D,F){j(typeof P=="number","cannot write a non-number as a number"),j(P<=D,"value larger than maximum allowed value"),j(F<=P,"value smaller than minimum allowed value")}function j(P,D){if(!P)throw new Error(D||"Failed assertion")}_._augment=function(P){return P._isBuffer=!0,P._get=P.get,P._set=P.set,P.get=ee.get,P.set=ee.set,P.write=ee.write,P.toString=ee.toString,P.toLocaleString=ee.toString,P.toJSON=ee.toJSON,P.copy=ee.copy,P.slice=ee.slice,P.readUInt8=ee.readUInt8,P.readUInt16LE=ee.readUInt16LE,P.readUInt16BE=ee.readUInt16BE,P.readUInt32LE=ee.readUInt32LE,P.readUInt32BE=ee.readUInt32BE,P.readInt8=ee.readInt8,P.readInt16LE=ee.readInt16LE,P.readInt16BE=ee.readInt16BE,P.readInt32LE=ee.readInt32LE,P.readInt32BE=ee.readInt32BE,P.readFloatLE=ee.readFloatLE,P.readFloatBE=ee.readFloatBE,P.readDoubleLE=ee.readDoubleLE,P.readDoubleBE=ee.readDoubleBE,P.writeUInt8=ee.writeUInt8,P.writeUInt16LE=ee.writeUInt16LE,P.writeUInt16BE=ee.writeUInt16BE,P.writeUInt32LE=ee.writeUInt32LE,P.writeUInt32BE=ee.writeUInt32BE,P.writeInt8=ee.writeInt8,P.writeInt16LE=ee.writeInt16LE,P.writeInt16BE=ee.writeInt16BE,P.writeInt32LE=ee.writeInt32LE,P.writeInt32BE=ee.writeInt32BE,P.writeFloatLE=ee.writeFloatLE,P.writeFloatBE=ee.writeFloatBE,P.writeDoubleLE=ee.writeDoubleLE,P.writeDoubleBE=ee.writeDoubleBE,P.fill=ee.fill,P.inspect=ee.inspect,P.toArrayBuffer=ee.toArrayBuffer,P}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(t,n,i){(function(r,s,b,l,f,u,d,m,y){var b=t("buffer").Buffer,A=4,_=new b(A);_.fill(0),n.exports={hash:function(L,I,S,g){for(var O=I(function(v,T){v.length%A!=0&&(k=v.length+(A-v.length%A),v=b.concat([v,_],k));for(var k,Q=[],Y=T?v.readInt32BE:v.readInt32LE,$=0;$<v.length;$+=A)Q.push(Y.call(v,$));return Q}(L=b.isBuffer(L)?L:new b(L),g),8*L.length),I=g,x=new b(S),C=I?x.writeInt32BE:x.writeInt32LE,p=0;p<O.length;p++)C.call(x,O[p],4*p,!0);return x}}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],5:[function(t,n,i){(function(r,s,b,l,f,u,d,m,y){var b=t("buffer").Buffer,A=t("./sha"),_=t("./sha256"),L=t("./rng"),I={sha1:A,sha256:_,md5:t("./md5")},S=64,g=new b(S);function O(v,T){var k=I[v=v||"sha1"],Q=[];return k||x("algorithm:",v,"is not yet supported"),{update:function(Y){return b.isBuffer(Y)||(Y=new b(Y)),Q.push(Y),Y.length,this},digest:function(Y){var $=b.concat(Q),$=T?function(ee,q,Z){b.isBuffer(q)||(q=new b(q)),b.isBuffer(Z)||(Z=new b(Z)),q.length>S?q=ee(q):q.length<S&&(q=b.concat([q,g],S));for(var ie=new b(S),ne=new b(S),ce=0;ce<S;ce++)ie[ce]=54^q[ce],ne[ce]=92^q[ce];return Z=ee(b.concat([ie,Z])),ee(b.concat([ne,Z]))}(k,T,$):k($);return Q=null,Y?$.toString(Y):$}}}function x(){var v=[].slice.call(arguments).join(" ");throw new Error([v,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
|
|
247
|
+
`))}g.fill(0),i.createHash=function(v){return O(v)},i.createHmac=O,i.randomBytes=function(v,T){if(!T||!T.call)return new b(L(v));try{T.call(this,void 0,new b(L(v)))}catch(k){T(k)}};var C,p=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],w=function(v){i[v]=function(){x("sorry,",v,"is not implemented yet")}};for(C in p)w(p[C])}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(t,n,i){(function(r,s,a,l,f,u,d,m,y){var b=t("./helpers");function A(x,C){x[C>>5]|=128<<C%32,x[14+(C+64>>>9<<4)]=C;for(var p=1732584193,w=-271733879,v=-1732584194,T=271733878,k=0;k<x.length;k+=16){var Q=p,Y=w,$=v,ee=T,p=L(p,w,v,T,x[k+0],7,-680876936),T=L(T,p,w,v,x[k+1],12,-389564586),v=L(v,T,p,w,x[k+2],17,606105819),w=L(w,v,T,p,x[k+3],22,-1044525330);p=L(p,w,v,T,x[k+4],7,-176418897),T=L(T,p,w,v,x[k+5],12,1200080426),v=L(v,T,p,w,x[k+6],17,-1473231341),w=L(w,v,T,p,x[k+7],22,-45705983),p=L(p,w,v,T,x[k+8],7,1770035416),T=L(T,p,w,v,x[k+9],12,-1958414417),v=L(v,T,p,w,x[k+10],17,-42063),w=L(w,v,T,p,x[k+11],22,-1990404162),p=L(p,w,v,T,x[k+12],7,1804603682),T=L(T,p,w,v,x[k+13],12,-40341101),v=L(v,T,p,w,x[k+14],17,-1502002290),p=I(p,w=L(w,v,T,p,x[k+15],22,1236535329),v,T,x[k+1],5,-165796510),T=I(T,p,w,v,x[k+6],9,-1069501632),v=I(v,T,p,w,x[k+11],14,643717713),w=I(w,v,T,p,x[k+0],20,-373897302),p=I(p,w,v,T,x[k+5],5,-701558691),T=I(T,p,w,v,x[k+10],9,38016083),v=I(v,T,p,w,x[k+15],14,-660478335),w=I(w,v,T,p,x[k+4],20,-405537848),p=I(p,w,v,T,x[k+9],5,568446438),T=I(T,p,w,v,x[k+14],9,-1019803690),v=I(v,T,p,w,x[k+3],14,-187363961),w=I(w,v,T,p,x[k+8],20,1163531501),p=I(p,w,v,T,x[k+13],5,-1444681467),T=I(T,p,w,v,x[k+2],9,-51403784),v=I(v,T,p,w,x[k+7],14,1735328473),p=S(p,w=I(w,v,T,p,x[k+12],20,-1926607734),v,T,x[k+5],4,-378558),T=S(T,p,w,v,x[k+8],11,-2022574463),v=S(v,T,p,w,x[k+11],16,1839030562),w=S(w,v,T,p,x[k+14],23,-35309556),p=S(p,w,v,T,x[k+1],4,-1530992060),T=S(T,p,w,v,x[k+4],11,1272893353),v=S(v,T,p,w,x[k+7],16,-155497632),w=S(w,v,T,p,x[k+10],23,-1094730640),p=S(p,w,v,T,x[k+13],4,681279174),T=S(T,p,w,v,x[k+0],11,-358537222),v=S(v,T,p,w,x[k+3],16,-722521979),w=S(w,v,T,p,x[k+6],23,76029189),p=S(p,w,v,T,x[k+9],4,-640364487),T=S(T,p,w,v,x[k+12],11,-421815835),v=S(v,T,p,w,x[k+15],16,530742520),p=g(p,w=S(w,v,T,p,x[k+2],23,-995338651),v,T,x[k+0],6,-198630844),T=g(T,p,w,v,x[k+7],10,1126891415),v=g(v,T,p,w,x[k+14],15,-1416354905),w=g(w,v,T,p,x[k+5],21,-57434055),p=g(p,w,v,T,x[k+12],6,1700485571),T=g(T,p,w,v,x[k+3],10,-1894986606),v=g(v,T,p,w,x[k+10],15,-1051523),w=g(w,v,T,p,x[k+1],21,-2054922799),p=g(p,w,v,T,x[k+8],6,1873313359),T=g(T,p,w,v,x[k+15],10,-30611744),v=g(v,T,p,w,x[k+6],15,-1560198380),w=g(w,v,T,p,x[k+13],21,1309151649),p=g(p,w,v,T,x[k+4],6,-145523070),T=g(T,p,w,v,x[k+11],10,-1120210379),v=g(v,T,p,w,x[k+2],15,718787259),w=g(w,v,T,p,x[k+9],21,-343485551),p=O(p,Q),w=O(w,Y),v=O(v,$),T=O(T,ee)}return Array(p,w,v,T)}function _(x,C,p,w,v,T){return O((C=O(O(C,x),O(w,T)))<<v|C>>>32-v,p)}function L(x,C,p,w,v,T,k){return _(C&p|~C&w,x,C,v,T,k)}function I(x,C,p,w,v,T,k){return _(C&w|p&~w,x,C,v,T,k)}function S(x,C,p,w,v,T,k){return _(C^p^w,x,C,v,T,k)}function g(x,C,p,w,v,T,k){return _(p^(C|~w),x,C,v,T,k)}function O(x,C){var p=(65535&x)+(65535&C);return(x>>16)+(C>>16)+(p>>16)<<16|65535&p}n.exports=function(x){return b.hash(x,A,16)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(t,n,i){(function(r,s,a,l,f,u,d,m,y){n.exports=function(b){for(var A,_=new Array(b),L=0;L<b;L++)!(3&L)&&(A=4294967296*Math.random()),_[L]=A>>>((3&L)<<3)&255;return _}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(t,n,i){(function(r,s,a,l,f,u,d,m,y){var b=t("./helpers");function A(I,S){I[S>>5]|=128<<24-S%32,I[15+(S+64>>9<<4)]=S;for(var g,O,x,C=Array(80),p=1732584193,w=-271733879,v=-1732584194,T=271733878,k=-1009589776,Q=0;Q<I.length;Q+=16){for(var Y=p,$=w,ee=v,q=T,Z=k,ie=0;ie<80;ie++){C[ie]=ie<16?I[Q+ie]:L(C[ie-3]^C[ie-8]^C[ie-14]^C[ie-16],1);var ne=_(_(L(p,5),(ne=w,O=v,x=T,(g=ie)<20?ne&O|~ne&x:!(g<40)&&g<60?ne&O|ne&x|O&x:ne^O^x)),_(_(k,C[ie]),(g=ie)<20?1518500249:g<40?1859775393:g<60?-1894007588:-899497514)),k=T,T=v,v=L(w,30),w=p,p=ne}p=_(p,Y),w=_(w,$),v=_(v,ee),T=_(T,q),k=_(k,Z)}return Array(p,w,v,T,k)}function _(I,S){var g=(65535&I)+(65535&S);return(I>>16)+(S>>16)+(g>>16)<<16|65535&g}function L(I,S){return I<<S|I>>>32-S}n.exports=function(I){return b.hash(I,A,20,!0)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(t,n,i){(function(r,s,a,l,f,u,d,m,y){function b(S,g){var O=(65535&S)+(65535&g);return(S>>16)+(g>>16)+(O>>16)<<16|65535&O}function A(S,g){var O,x=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),C=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),p=new Array(64);S[g>>5]|=128<<24-g%32,S[15+(g+64>>9<<4)]=g;for(var w,v,T=0;T<S.length;T+=16){for(var k=C[0],Q=C[1],Y=C[2],$=C[3],ee=C[4],q=C[5],Z=C[6],ie=C[7],ne=0;ne<64;ne++)p[ne]=ne<16?S[ne+T]:b(b(b((v=p[ne-2],L(v,17)^L(v,19)^I(v,10)),p[ne-7]),(v=p[ne-15],L(v,7)^L(v,18)^I(v,3))),p[ne-16]),O=b(b(b(b(ie,L(v=ee,6)^L(v,11)^L(v,25)),ee&q^~ee&Z),x[ne]),p[ne]),w=b(L(w=k,2)^L(w,13)^L(w,22),k&Q^k&Y^Q&Y),ie=Z,Z=q,q=ee,ee=b($,O),$=Y,Y=Q,Q=k,k=b(O,w);C[0]=b(k,C[0]),C[1]=b(Q,C[1]),C[2]=b(Y,C[2]),C[3]=b($,C[3]),C[4]=b(ee,C[4]),C[5]=b(q,C[5]),C[6]=b(Z,C[6]),C[7]=b(ie,C[7])}return C}var _=t("./helpers"),L=function(S,g){return S>>>g|S<<32-g},I=function(S,g){return S>>>g};n.exports=function(S){return _.hash(S,A,32,!0)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(t,n,i){(function(r,s,a,l,f,u,d,m,y){i.read=function(b,A,_,L,T){var S,g,O=8*T-L-1,x=(1<<O)-1,C=x>>1,p=-7,w=_?T-1:0,v=_?-1:1,T=b[A+w];for(w+=v,S=T&(1<<-p)-1,T>>=-p,p+=O;0<p;S=256*S+b[A+w],w+=v,p-=8);for(g=S&(1<<-p)-1,S>>=-p,p+=L;0<p;g=256*g+b[A+w],w+=v,p-=8);if(S===0)S=1-C;else{if(S===x)return g?NaN:1/0*(T?-1:1);g+=Math.pow(2,L),S-=C}return(T?-1:1)*g*Math.pow(2,S-L)},i.write=function(b,A,_,L,I,k){var g,O,x=8*k-I-1,C=(1<<x)-1,p=C>>1,w=I===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=L?0:k-1,T=L?1:-1,k=A<0||A===0&&1/A<0?1:0;for(A=Math.abs(A),isNaN(A)||A===1/0?(O=isNaN(A)?1:0,g=C):(g=Math.floor(Math.log(A)/Math.LN2),A*(L=Math.pow(2,-g))<1&&(g--,L*=2),2<=(A+=1<=g+p?w/L:w*Math.pow(2,1-p))*L&&(g++,L/=2),C<=g+p?(O=0,g=C):1<=g+p?(O=(A*L-1)*Math.pow(2,I),g+=p):(O=A*Math.pow(2,p-1)*Math.pow(2,I),g=0));8<=I;b[_+v]=255&O,v+=T,O/=256,I-=8);for(g=g<<I|O,x+=I;0<x;b[_+v]=255&g,v+=T,g/=256,x-=8);b[_+v-T]|=128*k}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(t,n,i){(function(r,s,a,l,f,u,d,m,y){var b,A,_;function L(){}(r=n.exports={}).nextTick=(A=typeof window<"u"&&window.setImmediate,_=typeof window<"u"&&window.postMessage&&window.addEventListener,A?function(I){return window.setImmediate(I)}:_?(b=[],window.addEventListener("message",function(I){var S=I.source;S!==window&&S!==null||I.data!=="process-tick"||(I.stopPropagation(),0<b.length&&b.shift()())},!0),function(I){b.push(I),window.postMessage("process-tick","*")}):function(I){setTimeout(I,0)}),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=L,r.addListener=L,r.once=L,r.off=L,r.removeListener=L,r.removeAllListeners=L,r.emit=L,r.binding=function(I){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(I){throw new Error("process.chdir is not supported")}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)})})(jr);var jl=jr.exports;const Gl=Ht(jl);var Gr=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","uint","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"],Rl=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"],Rr=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"],El=Gr,Yl=El.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"]),ui=Rr;ui=ui.slice().filter(function(o){return!/^(gl\_|texture)/.test(o)});var Xl=ui.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"]),Wl=nc,Zl=Gr,Er=Rl,ql=Rr,Kl=Yl,Ql=Xl,Qe=999,Yr=9999,fi=0,di=1,Xr=2,Wr=3,Zr=4,$t=5,Jl=6,Hl=7,$l=8,qr=9,ec=10,Kr=11,tc=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function nc(o){var e=0,t=0,n=Qe,i,r,s=[],a=[],l=1,f=0,u=0,d=!1,m=!1,y="",b;o=o||{};var A=ql,_=Zl;o.version==="300 es"&&(A=Ql,_=Kl);for(var L={},I={},e=0;e<A.length;e++)L[A[e]]=!0;for(var e=0;e<_.length;e++)I[_[e]]=!0;return function(q){return a=[],q!==null?g(q):O()};function S(q){q.length&&a.push({type:tc[n],data:q,position:u,line:l,column:f})}function g(q){e=0,q.toString&&(q=q.toString()),y+=q.replace(/\r\n/g,`
|
|
248
|
+
`),b=y.length;for(var Z;i=y[e],e<b;){switch(Z=e,n){case fi:e=v();break;case di:e=w();break;case Xr:e=p();break;case Wr:e=T();break;case Zr:e=Y();break;case Kr:e=Q();break;case $t:e=$();break;case Yr:e=ee();break;case qr:e=C();break;case Qe:e=x();break}if(Z!==e)switch(y[Z]){case`
|
|
249
|
+
`:f=0,++l;break;default:++f;break}}return t+=e,y=y.slice(e),a}function O(q){return s.length&&S(s.join("")),n=ec,S("(eof)"),a}function x(){return s=s.length?[]:s,r==="/"&&i==="*"?(u=t+e-1,n=fi,r=i,e+1):r==="/"&&i==="/"?(u=t+e-1,n=di,r=i,e+1):i==="#"?(n=Xr,u=t+e,e):/\s/.test(i)?(n=qr,u=t+e,e):(d=/\d/.test(i),m=/[^\w_]/.test(i),u=t+e,n=d?Zr:m?Wr:Yr,e)}function C(){return/[^\s]/g.test(i)?(S(s.join("")),n=Qe,e):(s.push(i),r=i,e+1)}function p(){return(i==="\r"||i===`
|
|
250
|
+
`)&&r!=="\\"?(S(s.join("")),n=Qe,e):(s.push(i),r=i,e+1)}function w(){return p()}function v(){return i==="/"&&r==="*"?(s.push(i),S(s.join("")),n=Qe,e+1):(s.push(i),r=i,e+1)}function T(){if(r==="."&&/\d/.test(i))return n=$t,e;if(r==="/"&&i==="*")return n=fi,e;if(r==="/"&&i==="/")return n=di,e;if(i==="."&&s.length){for(;k(s););return n=$t,e}if(i===";"||i===")"||i==="("){if(s.length)for(;k(s););return S(i),n=Qe,e+1}var q=s.length===2&&i!=="=";if(/[\w_\d\s]/.test(i)||q){for(;k(s););return n=Qe,e}return s.push(i),r=i,e+1}function k(q){var Z=0,ie,ne;do{if(ie=Er.indexOf(q.slice(0,q.length+Z).join("")),ne=Er[ie],ie===-1){if(Z--+q.length>0)continue;ne=q.slice(0,1).join("")}return S(ne),u+=ne.length,s=s.slice(ne.length),s.length}while(!0)}function Q(){return/[^a-fA-F0-9]/.test(i)?(S(s.join("")),n=Qe,e):(s.push(i),r=i,e+1)}function Y(){return i==="."||/[eE]/.test(i)?(s.push(i),n=$t,r=i,e+1):i==="x"&&s.length===1&&s[0]==="0"?(n=Kr,s.push(i),r=i,e+1):/[^\d]/.test(i)?(S(s.join("")),n=Qe,e):(s.push(i),r=i,e+1)}function $(){return i==="f"&&(s.push(i),r=i,e+=1),/[eE]/.test(i)||(i==="-"||i==="+")&&/[eE]/.test(r)?(s.push(i),r=i,e+1):/[^\d]/.test(i)?(S(s.join("")),n=Qe,e):(s.push(i),r=i,e+1)}function ee(){if(/[^\d\w_]/.test(i)){var q=s.join("");return I[q]?n=$l:L[q]?n=Hl:n=Jl,S(s.join("")),n=Qe,e}return s.push(i),r=i,e+1}}var ic=Wl,rc=sc;function sc(o,e){var t=ic(e),n=[];return n=n.concat(t(o)),n=n.concat(t(null)),n}const oc=Ht(rc);var ac=lc;function lc(o){for(var e=[],t=0;t<o.length;t++)o[t].type!=="eof"&&e.push(o[t].data);return e.join("")}const Qr=Ht(ac);var cc=hc;function hc(o){var e=null,t=null,n=0,i=0,r=0,s=0,a=0,l=[],f,u,d;for(f=0,u;f<o.length;f++)if(d=o[f],d.data==="{"){if(n&&n++||(u=y(f,yt(")"),yt()),u<0)||(s=u,u=y(u,yt("("),yt(")")),u<0)||(a=u,u=y(u,en),u<0)||o[u].type!=="ident"||(t=o[u].data,u=y(u,en),u<0))continue;n=1,i=f,e=o[u].data,r=u;var m=y(u,en);switch(o[m]&&o[m].data){case"lowp":case"highp":case"mediump":r=m}}else if(n&&d.data==="}"){if(--n)continue;l.push({name:t,type:e,body:[i+1,f],args:[a,s+1],outer:[r,f+1]})}for(f=0;f<o.length;f++)if(d=o[f],d.data===";"){if(u=y(f,yt(")"),yt()),u<0||(s=u,u=y(u,yt("("),yt(")")),u<0)||(a=u,u=y(u,en),u<0)||o[u].type!=="ident"||(t=o[u].data,u=y(u,en),u<0)||o[u].type==="operator"||o[u].data==="return")continue;e=o[u].data,l.push({name:t,type:e,body:!1,args:[a,s+1],outer:[u,f+1]})}return l.sort(function(b,A){return b.outer[0]-A.outer[0]});function y(b,A,_){for(var L=b-1;L>=0;L--){if(A(o[L]))return L;if(_&&_(o[L]))return-1}return-1}}function yt(o){return function(e){return e.type==="operator"&&(!o||e.data===o)}}function en(o){return o.type!=="whitespace"}const uc=Ht(cc);function fc(o,e){if(typeof o!="object"||o===null)return o;var t=o[Symbol.toPrimitive];if(t!==void 0){var n=t.call(o,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(o)}function Jr(o){var e=fc(o,"string");return typeof e=="symbol"?e:String(e)}function Se(o,e,t){return e=Jr(e),e in o?Object.defineProperty(o,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):o[e]=t,o}function Hr(o,e){var t=Object.keys(o);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(o);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(o,i).enumerable})),t.push.apply(t,n)}return t}function Ft(o){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Hr(Object(t),!0).forEach(function(n){Se(o,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(t)):Hr(Object(t)).forEach(function(n){Object.defineProperty(o,n,Object.getOwnPropertyDescriptor(t,n))})}return o}function dc(o,e){if(o==null)return{};var t={},n=Object.keys(o),i,r;for(r=0;r<n.length;r++)i=n[r],!(e.indexOf(i)>=0)&&(t[i]=o[i]);return t}function pc(o,e){if(o==null)return{};var t=dc(o,e),n,i;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(o);for(i=0;i<r.length;i++)n=r[i],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(o,n)&&(t[n]=o[n])}return t}function mc(o,e){if(!(o instanceof e))throw new TypeError("Cannot call a class as a function")}function $r(o,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(o,Jr(n.key),n)}}function gc(o,e,t){return e&&$r(o.prototype,e),t&&$r(o,t),Object.defineProperty(o,"prototype",{writable:!1}),o}function es(o){if(o===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return o}function pi(o,e){return pi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},pi(o,e)}function yc(o,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");o.prototype=Object.create(e&&e.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),Object.defineProperty(o,"prototype",{writable:!1}),e&&pi(o,e)}function bn(o){return bn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},bn(o)}function _c(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function vc(o,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return es(o)}function wc(o){var e=_c();return function(){var n=bn(o),i;if(e){var r=bn(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return vc(this,i)}}var de={position:"csm_Position",positionRaw:"csm_PositionRaw",pointSize:"csm_PointSize",fragColor:"csm_FragColor",diffuseColor:"csm_DiffuseColor",normal:"csm_Normal",roughness:"csm_Roughness",metalness:"csm_Metalness",emissive:"csm_Emissive",ao:"csm_AO",bump:"csm_Bump",depthAlpha:"csm_DepthAlpha"},je,Bt,xc=(je={},Se(je,"".concat(de.normal),{"#include <beginnormal_vertex>":`
|
|
251
|
+
vec3 objectNormal = `.concat(de.normal,`;
|
|
252
|
+
#ifdef USE_TANGENT
|
|
253
|
+
vec3 objectTangent = vec3( tangent.xyz );
|
|
254
|
+
#endif
|
|
255
|
+
`)}),Se(je,"".concat(de.position),{"#include <begin_vertex>":`
|
|
256
|
+
vec3 transformed = `.concat(de.position,`;
|
|
257
|
+
`)}),Se(je,"".concat(de.positionRaw),{"#include <begin_vertex>":`
|
|
258
|
+
vec4 csm_internal_positionUnprojected = `.concat(de.positionRaw,`;
|
|
259
|
+
mat4x4 csm_internal_unprojectMatrix = projectionMatrix * modelViewMatrix;
|
|
260
|
+
#ifdef USE_INSTANCING
|
|
261
|
+
csm_internal_unprojectMatrix = csm_internal_unprojectMatrix * instanceMatrix;
|
|
262
|
+
#endif
|
|
263
|
+
csm_internal_positionUnprojected = inverse(csm_internal_unprojectMatrix) * csm_internal_positionUnprojected;
|
|
264
|
+
vec3 transformed = csm_internal_positionUnprojected.xyz;
|
|
265
|
+
`)}),Se(je,"".concat(de.pointSize),{"gl_PointSize = size;":`
|
|
266
|
+
gl_PointSize = `.concat(de.pointSize,`;
|
|
267
|
+
`)}),Se(je,"".concat(de.diffuseColor),{"#include <color_fragment>":`
|
|
268
|
+
#include <color_fragment>
|
|
269
|
+
diffuseColor = `.concat(de.diffuseColor,`;
|
|
270
|
+
`)}),Se(je,"".concat(de.fragColor),{"#include <dithering_fragment>":`
|
|
271
|
+
#include <dithering_fragment>
|
|
272
|
+
gl_FragColor = `.concat(de.fragColor,`;
|
|
273
|
+
`)}),Se(je,"".concat(de.emissive),{"vec3 totalEmissiveRadiance = emissive;":`
|
|
274
|
+
vec3 totalEmissiveRadiance = `.concat(de.emissive,`;
|
|
275
|
+
`)}),Se(je,"".concat(de.roughness),{"#include <roughnessmap_fragment>":`
|
|
276
|
+
#include <roughnessmap_fragment>
|
|
277
|
+
roughnessFactor = `.concat(de.roughness,`;
|
|
278
|
+
`)}),Se(je,"".concat(de.metalness),{"#include <metalnessmap_fragment>":`
|
|
279
|
+
#include <metalnessmap_fragment>
|
|
280
|
+
metalnessFactor = `.concat(de.metalness,`;
|
|
281
|
+
`)}),Se(je,"".concat(de.ao),{"#include <aomap_fragment>":`
|
|
282
|
+
#include <aomap_fragment>
|
|
283
|
+
reflectedLight.indirectDiffuse *= 1. - `.concat(de.ao,`;
|
|
284
|
+
`)}),Se(je,"".concat(de.bump),{"#include <normal_fragment_maps>":`
|
|
285
|
+
#include <normal_fragment_maps>
|
|
286
|
+
|
|
287
|
+
vec3 csm_internal_orthogonal = `.concat(de.bump," - (dot(").concat(de.bump,`, normal) * normal);
|
|
288
|
+
vec3 csm_internal_projectedbump = mat3(csm_internal_vModelViewMatrix) * csm_internal_orthogonal;
|
|
289
|
+
normal = normalize(normal - csm_internal_projectedbump);
|
|
290
|
+
`)}),Se(je,"".concat(de.depthAlpha),{"gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );":`
|
|
291
|
+
gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity * `.concat(de.depthAlpha,` );
|
|
292
|
+
`),"gl_FragColor = packDepthToRGBA( fragCoordZ );":`
|
|
293
|
+
gl_FragColor = packDepthToRGBA( fragCoordZ );
|
|
294
|
+
gl_FragColor.a *= `.concat(de.depthAlpha,`;
|
|
295
|
+
`)}),je),bc=(Bt={},Se(Bt,"".concat(de.position),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":`
|
|
296
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( `.concat(de.position,`, 1.0 );
|
|
297
|
+
`)}),Se(Bt,"".concat(de.positionRaw),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":`
|
|
298
|
+
gl_Position = `.concat(de.position,`;
|
|
299
|
+
`)}),Se(Bt,"".concat(de.diffuseColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":`
|
|
300
|
+
gl_FragColor = `.concat(de.diffuseColor,`;
|
|
301
|
+
`)}),Se(Bt,"".concat(de.fragColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":`
|
|
302
|
+
gl_FragColor = `.concat(de.fragColor,`;
|
|
303
|
+
`)}),Bt),Mc=`
|
|
304
|
+
|
|
305
|
+
#ifdef IS_VERTEX
|
|
306
|
+
// csm_Position & csm_PositionRaw
|
|
307
|
+
#ifdef IS_UNKNOWN
|
|
308
|
+
vec3 csm_Position = vec3(0.0);
|
|
309
|
+
vec4 csm_PositionRaw = vec4(0.0);
|
|
310
|
+
vec3 csm_Normal = vec3(0.0);
|
|
311
|
+
#else
|
|
312
|
+
vec3 csm_Position = position;
|
|
313
|
+
vec4 csm_PositionRaw = projectionMatrix * modelViewMatrix * vec4(position, 1.);
|
|
314
|
+
vec3 csm_Normal = normal;
|
|
315
|
+
#endif
|
|
316
|
+
|
|
317
|
+
// csm_PointSize
|
|
318
|
+
#ifdef IS_POINTSMATERIAL
|
|
319
|
+
float csm_PointSize = size;
|
|
320
|
+
#endif
|
|
321
|
+
#else
|
|
322
|
+
// csm_DiffuseColor & csm_FragColor
|
|
323
|
+
#if defined IS_UNKNOWN || defined IS_SHADERMATERIAL || defined IS_MESHDEPTHMATERIAL || defined IS_MESHNORMALMATERIAL || defined IS_SHADOWMATERIAL
|
|
324
|
+
vec4 csm_DiffuseColor = vec4(1.0, 0.0, 1.0, 1.0);
|
|
325
|
+
vec4 csm_FragColor = vec4(1.0, 0.0, 1.0, 1.0);
|
|
326
|
+
#else
|
|
327
|
+
#ifdef USE_MAP
|
|
328
|
+
vec4 _csm_sampledDiffuseColor = texture2D(map, vMapUv);
|
|
329
|
+
|
|
330
|
+
#ifdef DECODE_VIDEO_TEXTURE
|
|
331
|
+
// inline sRGB decode (TODO: Remove this code when https://crbug.com/1256340 is solved)
|
|
332
|
+
_csm_sampledDiffuseColor = vec4(mix(pow(_csm_sampledDiffuseColor.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), _csm_sampledDiffuseColor.rgb * 0.0773993808, vec3(lessThanEqual(_csm_sampledDiffuseColor.rgb, vec3(0.04045)))), _csm_sampledDiffuseColor.w);
|
|
333
|
+
#endif
|
|
334
|
+
|
|
335
|
+
vec4 csm_DiffuseColor = vec4(diffuse, opacity) * _csm_sampledDiffuseColor;
|
|
336
|
+
vec4 csm_FragColor = vec4(diffuse, opacity) * _csm_sampledDiffuseColor;
|
|
337
|
+
#else
|
|
338
|
+
vec4 csm_DiffuseColor = vec4(diffuse, opacity);
|
|
339
|
+
vec4 csm_FragColor = vec4(diffuse, opacity);
|
|
340
|
+
#endif
|
|
341
|
+
#endif
|
|
342
|
+
|
|
343
|
+
// csm_Emissive, csm_Roughness, csm_Metalness
|
|
344
|
+
#if defined IS_MESHSTANDARDMATERIAL || defined IS_MESHPHYSICALMATERIAL
|
|
345
|
+
vec3 csm_Emissive = emissive;
|
|
346
|
+
float csm_Roughness = roughness;
|
|
347
|
+
float csm_Metalness = metalness;
|
|
348
|
+
#endif
|
|
349
|
+
|
|
350
|
+
// csm_AO
|
|
351
|
+
#if defined IS_MESHSTANDARDMATERIAL || defined IS_MESHPHYSICALMATERIAL || defined IS_MESHBASICMATERIAL || defined IS_MESHLAMBERTMATERIAL || defined IS_MESHPHONGMATERIAL || defined IS_MESHTOONMATERIAL
|
|
352
|
+
float csm_AO = 0.0;
|
|
353
|
+
#endif
|
|
354
|
+
|
|
355
|
+
// csm_Bump
|
|
356
|
+
#if defined IS_MESHLAMBERTMATERIAL || defined IS_MESHMATCAPMATERIAL || defined IS_MESHNORMALMATERIAL || defined IS_MESHPHONGMATERIAL || defined IS_MESHPHYSICALMATERIAL || defined IS_MESHSTANDARDMATERIAL || defined IS_MESHTOONMATERIAL || defined IS_SHADOWMATERIAL
|
|
357
|
+
vec3 csm_Bump = vec3(0.0);
|
|
358
|
+
#endif
|
|
359
|
+
|
|
360
|
+
float csm_DepthAlpha = 1.0;
|
|
361
|
+
#endif
|
|
362
|
+
`,Ac=`
|
|
363
|
+
varying mat4 csm_internal_vModelViewMatrix;
|
|
364
|
+
`,Sc=`
|
|
365
|
+
csm_internal_vModelViewMatrix = modelViewMatrix;
|
|
366
|
+
`,Pc=`
|
|
367
|
+
varying mat4 csm_internal_vModelViewMatrix;
|
|
368
|
+
`,Cc=`
|
|
369
|
+
|
|
370
|
+
`,Ge,Lc=(Ge={},Se(Ge,"".concat(de.position),"*"),Se(Ge,"".concat(de.positionRaw),"*"),Se(Ge,"".concat(de.normal),"*"),Se(Ge,"".concat(de.pointSize),["PointsMaterial"]),Se(Ge,"".concat(de.diffuseColor),"*"),Se(Ge,"".concat(de.fragColor),"*"),Se(Ge,"".concat(de.emissive),["MeshStandardMaterial","MeshPhysicalMaterial"]),Se(Ge,"".concat(de.roughness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Se(Ge,"".concat(de.metalness),["MeshStandardMaterial","MeshPhysicalMaterial"]),Se(Ge,"".concat(de.ao),["MeshStandardMaterial","MeshPhysicalMaterial","MeshBasicMaterial","MeshLambertMaterial","MeshPhongMaterial","MeshToonMaterial"]),Se(Ge,"".concat(de.bump),["MeshLambertMaterial","MeshMatcapMaterial","MeshNormalMaterial","MeshPhongMaterial","MeshPhysicalMaterial","MeshStandardMaterial","MeshToonMaterial","ShadowMaterial"]),Se(Ge,"".concat(de.depthAlpha),"*"),Ge),Tc=["baseMaterial","fragmentShader","vertexShader","uniforms","patchMap","cacheKey","silent"],Oc=function(e,t,n){return e.split(t).join(n)},Ic=function(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},Dc=function(e,t){return new RegExp("\\b".concat(Ic(t),"\\b")).test(e)};function kc(o){try{new o}catch(e){if(e.message.indexOf("is not a constructor")>=0)return!1}return!0}function Fc(o,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;Object.assign(o,e);var n=Object.getPrototypeOf(e);Object.entries(Object.getOwnPropertyDescriptors(n)).filter(function(i){var r=typeof i[1].get=="function",s=typeof i[1].set=="function",a=typeof i[1].value=="function",l=i[0]==="constructor";return(r||s||a)&&!l}).forEach(function(i){if(typeof o[i[0]]=="function"){t||console.warn("Function ".concat(i[0]," already exists on CSM, renaming to base_").concat(i[0]));var r="base_".concat(i[0]);o[r]=i[1].value.bind(o);return}Object.defineProperty(o,i[0],i[1])})}function Bc(o){var e=o.toString().trim(),t=e.substring(e.indexOf("{")+1,e.lastIndexOf("}"));return t.trim().length===0}function ts(o){return o.replace(/\s/g,"")}function Uc(o,e,t){var n=o.lastIndexOf(e);return n===-1?o:o.substring(0,n)+t+o.substring(n+e.length)}var Nc=function(o){yc(t,o);var e=wc(t);function t(n){var i,r=n.baseMaterial,s=n.fragmentShader,a=n.vertexShader,l=n.uniforms,f=n.patchMap,u=n.cacheKey,d=n.silent,m=pc(n,Tc);mc(this,t);var y;if(kc(r)?y=new r(m):(y=r,Object.assign(y,m)),y.type==="RawShaderMaterial")throw new Error("CustomShaderMaterial does not support RawShaderMaterial");i=e.call(this),Fc(es(i),y,d),i.__csm={patchMap:f||{},fragmentShader:s||"",vertexShader:a||"",cacheKey:u,baseMaterial:r,instanceID:Pi.MathUtils.generateUUID(),type:y.type,isAlreadyExtended:!Bc(y.onBeforeCompile),cacheHash:"",silent:d},i.uniforms=Ft(Ft({},i.uniforms||{}),l||{});{var b=i.__csm,A=b.fragmentShader,_=b.vertexShader,L=i.uniforms;i.__csm.cacheHash=i.getCacheHash(),i.generateMaterial(A,_,L)}return i}return gc(t,[{key:"update",value:function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.uniforms=i.uniforms||this.uniforms,Object.assign(this.__csm,i);var r=this.__csm,s=r.fragmentShader,a=r.vertexShader,l=this.uniforms,f=this.getCacheHash();this.__csm.cacheHash=f,this.generateMaterial(s,a,l)}},{key:"clone",value:function(){var i={baseMaterial:this.__csm.baseMaterial,fragmentShader:this.__csm.fragmentShader,vertexShader:this.__csm.vertexShader,uniforms:this.uniforms,silent:this.__csm.silent,patchMap:this.__csm.patchMap,cacheKey:this.__csm.cacheKey},r=new this.constructor(i);return Object.assign(this,r),r}},{key:"getCacheHash",value:function(){var i=this.__csm,r=i.fragmentShader,s=i.vertexShader,a=this.uniforms,l=Object.values(a).reduce(function(u,d){var m=d.value;return u+JSON.stringify(m)},""),f=ts(r)+ts(s)+l;return f.trim().length>0?Gl(f):this.customProgramCacheKey()}},{key:"generateMaterial",value:function(i,r,s){var a=this,l=this.parseShader(i),f=this.parseShader(r);this.uniforms=s||{},this.customProgramCacheKey=function(){return a.__csm.cacheHash};var u=function(y){try{if(l){var b=a.patchShader(l,y.fragmentShader,!0);y.fragmentShader=a.getMaterialDefine()+b}if(f){var A=a.patchShader(f,y.vertexShader);y.vertexShader=`#define IS_VERTEX;
|
|
371
|
+
`+A,y.vertexShader=a.getMaterialDefine()+y.vertexShader}y.uniforms=Ft(Ft({},y.uniforms),a.uniforms),a.uniforms=y.uniforms}catch(_){console.error(_)}};if(this.__csm.isAlreadyExtended){var d=this.onBeforeCompile;this.onBeforeCompile=function(m,y){d(m,y),u(m)}}else this.onBeforeCompile=u;this.needsUpdate=!0}},{key:"patchShader",value:function(i,r,s){var a=this,l=r,f=Ft(Ft({},this.getPatchMapForMaterial()),this.__csm.patchMap);Object.keys(f).forEach(function(m){Object.keys(f[m]).forEach(function(y){var b=Lc[m],A=a.__csm.type;if(m==="*"||Dc(i.main,m))if(!b||Array.isArray(b)&&b.includes(A)||b==="*")l=Oc(l,y,f[m][y]);else throw new Error("CSM: ".concat(m," is not available in ").concat(A,". Shader cannot compile."))})}),l=l.replace("void main() {",`
|
|
372
|
+
#ifndef CSM_IS_HEAD_DEFAULTS_DEFINED
|
|
373
|
+
`.concat(s?Pc:Ac,`
|
|
374
|
+
#define CSM_IS_HEAD_DEFAULTS_DEFINED 1
|
|
375
|
+
#endif
|
|
376
|
+
|
|
377
|
+
`).concat(i.header,`
|
|
378
|
+
|
|
379
|
+
void main() {
|
|
380
|
+
#ifndef CSM_IS_DEFAULTS_DEFINED
|
|
381
|
+
`).concat(Mc,`
|
|
382
|
+
#define CSM_IS_DEFAULTS_DEFINED 1
|
|
383
|
+
#endif
|
|
384
|
+
|
|
385
|
+
#ifndef CSM_IS_MAIN_DEFAULTS_DEFINED
|
|
386
|
+
`).concat(s?Cc:Sc,`
|
|
387
|
+
#define CSM_IS_MAIN_DEFAULTS_DEFINED 1
|
|
388
|
+
#endif
|
|
389
|
+
|
|
390
|
+
// CSM_START
|
|
391
|
+
`));var u=this.__csm.isAlreadyExtended,d=l.includes("// CSM_END");return u&&d?l=Uc(l,"// CSM_END",`
|
|
392
|
+
// CSM_END
|
|
393
|
+
`.concat(i.main,`
|
|
394
|
+
// CSM_END
|
|
395
|
+
`)):l=l.replace("// CSM_START",`
|
|
396
|
+
// CSM_START
|
|
397
|
+
`.concat(i.main,`
|
|
398
|
+
// CSM_END
|
|
399
|
+
`)),l=i.defines+l,l}},{key:"parseShader",value:function(i){if(i){var r=i.replace(/\/\*\*(.*?)\*\/|\/\/(.*?)\n/gm,""),s=oc(r),a=uc(s),l=a.map(function(d){return d.name}).indexOf("main"),f=Qr(s.slice(0,l>=0?a[l].outer[0]:void 0)),u=l>=0?this.getShaderFromIndex(s,a[l].body):"";return{defines:"",header:f,main:u}}}},{key:"getMaterialDefine",value:function(){var i=this.__csm.type;return i?"#define IS_".concat(i.toUpperCase(),`;
|
|
400
|
+
`):`#define IS_UNKNOWN;
|
|
401
|
+
`}},{key:"getPatchMapForMaterial",value:function(){switch(this.__csm.type){case"ShaderMaterial":return bc;default:return xc}}},{key:"getShaderFromIndex",value:function(i,r){return Qr(i.slice(r[0],r[1]))}}]),t}(Pi.Material);const Vc=["args"],zc=h.defineComponent({__name:"index",props:{baseMaterial:{type:Function},vertexShader:{},fragmentShader:{},silent:{type:Boolean},uniforms:{}},setup(o,{expose:e}){const t=o,n=h.shallowRef(null),{extend:i}=ae.useTresContext();return i({CustomShaderMaterial:Nc}),e({value:n}),(r,s)=>(h.openBlock(),h.createElementBlock("TresCustomShaderMaterial",{ref_key:"customShaderMaterialClass",ref:n,args:[t]},null,8,Vc))}}),jc=["args"],Gc=["color"],Rc=h.defineComponent({__name:"Box",props:{args:{default:()=>[1,1,1]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:i}=h.toRefs(t),r=h.shallowRef();return e({value:r}),(s,a)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"boxRef",ref:r},s.$attrs),[h.createElementVNode("TresBoxGeometry",{args:h.unref(n)},null,8,jc),h.renderSlot(s.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(i)},null,8,Gc)])],16))}}),ns=new c.Box3,Mn=new c.Vector3;class is extends c.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],n=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(n),this.setAttribute("position",new c.Float32BufferAttribute(e,3)),this.setAttribute("uv",new c.Float32BufferAttribute(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new c.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new c.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceEnd",new c.InterleavedBufferAttribute(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const n=new c.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new c.InterleavedBufferAttribute(n,3,0)),this.setAttribute("instanceColorEnd",new c.InterleavedBufferAttribute(n,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new c.WireframeGeometry(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new c.Box3);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),ns.setFromBufferAttribute(t),this.boundingBox.union(ns))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new c.Sphere),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let i=0;for(let r=0,s=e.count;r<s;r++)Mn.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(Mn)),Mn.fromBufferAttribute(t,r),i=Math.max(i,n.distanceToSquared(Mn));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}c.UniformsLib.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new c.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},c.ShaderLib.line={uniforms:c.UniformsUtils.merge([c.UniformsLib.common,c.UniformsLib.fog,c.UniformsLib.line]),vertexShader:`
|
|
199
402
|
#include <common>
|
|
200
403
|
#include <color_pars_vertex>
|
|
201
404
|
#include <fog_pars_vertex>
|
|
@@ -582,9 +785,9 @@
|
|
|
582
785
|
#include <premultiplied_alpha_fragment>
|
|
583
786
|
|
|
584
787
|
}
|
|
585
|
-
`};class Qn extends c.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:c.UniformsUtils.clone(c.ShaderLib.line.uniforms),vertexShader:c.ShaderLib.line.vertexShader,fragmentShader:c.ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1))}}const fi=new c.Vector3,pi=new c.Vector3,Te=new c.Vector4,Oe=new c.Vector4,Ze=new c.Vector4,Kn=new c.Vector3,qn=new c.Matrix4,De=new c.Line3,mi=new c.Vector3,an=new c.Box3,ln=new c.Sphere,Qe=new c.Vector4;let Ke,yt;function gi(a,e,t){return Qe.set(0,0,-e,1).applyMatrix4(a.projectionMatrix),Qe.multiplyScalar(1/Qe.w),Qe.x=yt/t.width,Qe.y=yt/t.height,Qe.applyMatrix4(a.projectionMatrixInverse),Qe.multiplyScalar(1/Qe.w),Math.abs(Math.max(Qe.x,Qe.y))}function Ra(a,e){const t=a.matrixWorld,n=a.geometry,s=n.attributes.instanceStart,i=n.attributes.instanceEnd,o=Math.min(n.instanceCount,s.count);for(let r=0,l=o;r<l;r++){De.start.fromBufferAttribute(s,r),De.end.fromBufferAttribute(i,r),De.applyMatrix4(t);const f=new c.Vector3,d=new c.Vector3;Ke.distanceSqToSegment(De.start,De.end,d,f),d.distanceTo(f)<yt*.5&&e.push({point:d,pointOnLine:f,distance:Ke.origin.distanceTo(d),object:a,face:null,faceIndex:r,uv:null,uv1:null})}}function ja(a,e,t){const n=e.projectionMatrix,i=a.material.resolution,o=a.matrixWorld,r=a.geometry,l=r.attributes.instanceStart,f=r.attributes.instanceEnd,d=Math.min(r.instanceCount,l.count),u=-e.near;Ke.at(1,Ze),Ze.w=1,Ze.applyMatrix4(e.matrixWorldInverse),Ze.applyMatrix4(n),Ze.multiplyScalar(1/Ze.w),Ze.x*=i.x/2,Ze.y*=i.y/2,Ze.z=0,Kn.copy(Ze),qn.multiplyMatrices(e.matrixWorldInverse,o);for(let p=0,g=d;p<g;p++){if(Te.fromBufferAttribute(l,p),Oe.fromBufferAttribute(f,p),Te.w=1,Oe.w=1,Te.applyMatrix4(qn),Oe.applyMatrix4(qn),Te.z>u&&Oe.z>u)continue;if(Te.z>u){const v=Te.z-Oe.z,y=(Te.z-u)/v;Te.lerp(Oe,y)}else if(Oe.z>u){const v=Oe.z-Te.z,y=(Oe.z-u)/v;Oe.lerp(Te,y)}Te.applyMatrix4(n),Oe.applyMatrix4(n),Te.multiplyScalar(1/Te.w),Oe.multiplyScalar(1/Oe.w),Te.x*=i.x/2,Te.y*=i.y/2,Oe.x*=i.x/2,Oe.y*=i.y/2,De.start.copy(Te),De.start.z=0,De.end.copy(Oe),De.end.z=0;const w=De.closestPointToPointParameter(Kn,!0);De.at(w,mi);const _=c.MathUtils.lerp(Te.z,Oe.z,w),M=_>=-1&&_<=1,L=Kn.distanceTo(mi)<yt*.5;if(M&&L){De.start.fromBufferAttribute(l,p),De.end.fromBufferAttribute(f,p),De.start.applyMatrix4(o),De.end.applyMatrix4(o);const v=new c.Vector3,y=new c.Vector3;Ke.distanceSqToSegment(De.start,De.end,y,v),t.push({point:y,pointOnLine:v,distance:Ke.origin.distanceTo(y),object:a,face:null,faceIndex:p,uv:null,uv1:null})}}}class Ea extends c.Mesh{constructor(e=new di,t=new Qn({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,s=new Float32Array(2*t.count);for(let o=0,r=0,l=t.count;o<l;o++,r+=2)fi.fromBufferAttribute(t,o),pi.fromBufferAttribute(n,o),s[r]=r===0?0:s[r-1],s[r+1]=s[r]+fi.distanceTo(pi);const i=new c.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new c.InterleavedBufferAttribute(i,1,0)),e.setAttribute("instanceDistanceEnd",new c.InterleavedBufferAttribute(i,1,1)),this}raycast(e,t){const n=this.material.worldUnits,s=e.camera;s===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const i=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Ke=e.ray;const o=this.matrixWorld,r=this.geometry,l=this.material;yt=l.linewidth+i,r.boundingSphere===null&&r.computeBoundingSphere(),ln.copy(r.boundingSphere).applyMatrix4(o);let f;if(n)f=yt*.5;else{const u=Math.max(s.near,ln.distanceToPoint(Ke.origin));f=gi(s,u,l.resolution)}if(ln.radius+=f,Ke.intersectsSphere(ln)===!1)return;r.boundingBox===null&&r.computeBoundingBox(),an.copy(r.boundingBox).applyMatrix4(o);let d;if(n)d=yt*.5;else{const u=Math.max(s.near,an.distanceToPoint(Ke.origin));d=gi(s,u,l.resolution)}an.expandByScalar(d),Ke.intersectsBox(an)!==!1&&(n?Ra(this,t):ja(this,s,t))}}class yi extends di{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,n=new Float32Array(2*t);for(let s=0;s<t;s+=3)n[2*s]=e[s],n[2*s+1]=e[s+1],n[2*s+2]=e[s+2],n[2*s+3]=e[s+3],n[2*s+4]=e[s+4],n[2*s+5]=e[s+5];return super.setPositions(n),this}setColors(e){const t=e.length-3,n=new Float32Array(2*t);for(let s=0;s<t;s+=3)n[2*s]=e[s],n[2*s+1]=e[s+1],n[2*s+2]=e[s+2],n[2*s+3]=e[s+3],n[2*s+4]=e[s+4],n[2*s+5]=e[s+5];return super.setColors(n),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class Xa extends Ea{constructor(e=new yi,t=new Qn({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const Ya=["object"],_i=h.defineComponent({__name:"Line2",props:{points:{},vertexColors:{default:null},color:{default:"white"},lineWidth:{default:1},worldUnits:{type:Boolean,default:!1},alphaToCoverage:{type:Boolean,default:!1},dashed:{type:Boolean,default:!1},dashSize:{default:1},gapSize:{default:1},dashScale:{default:1},dashOffset:{default:0}},setup(a){const e=a;function t(d,u){if(!d||d.length===0)return new Array(u).fill(ne.normalizeColor(e.color));if(d.length===1)return new Array(u).fill(ne.normalizeColor(d[0]));if(d.length===u)return d.map(ne.normalizeColor);const p=u-1,g=d.map(ne.normalizeColor);closed&&g.push(g[0].clone());const x=[g[0]],w=p/(g.length-1);for(let _=1;_<p;_++){const M=_%w/w,L=Math.floor(_/w);x.push(g[L].clone().lerp(g[L+1],M))}return x.push(g[g.length-1]),x}function n(d,u,p){const g=u.map(w=>w instanceof c.Vector3?[w.x,w.y,w.z]:w instanceof c.Vector2?[w.x,w.y,0]:Array.isArray(w)&&w.length===2?[w[0],w[1],0]:w).flat();d.setPositions(g.flat());const x=t(p,u.length).map(w=>w.toArray()).flat();d.setColors(x),r.computeLineDistances()}function s(d,u){d.color=ne.normalizeColor(u.color),d.linewidth=u.lineWidth,d.alphaToCoverage=u.alphaToCoverage,d.worldUnits=u.worldUnits,d.vertexColors=Array.isArray(u.vertexColors),d.dashed=u.dashed,d.dashScale=u.dashScale,d.dashSize=u.dashSize,d.dashOffset=u.dashOffset,d.gapSize=u.gapSize,d.needsUpdate=!0}const i=new Qn,o=new yi,r=new Xa(o,i),l=ne.useTresContext().sizes,f=h.computed(()=>Array.isArray(e.vertexColors));return s(i,e),n(o,e.points,e.vertexColors),r.computeLineDistances(),h.watch(()=>[e.color,e.lineWidth,e.alphaToCoverage,e.worldUnits,f,e.dashed,e.dashScale,e.dashSize,e.dashOffset],()=>s(i,e)),h.watch([e.points,e.vertexColors],()=>n(o,e.points,e.vertexColors)),h.watch(()=>e.vertexColors,()=>n(o,e.points,e.vertexColors)),h.watch(()=>e.points,()=>n(o,e.points,e.vertexColors)),h.watch([l.height,l.width],()=>i.resolution=new c.Vector2(l.width.value,l.height.value)),h.onUnmounted(()=>{o.dispose(),i.dispose()}),(d,u)=>(h.openBlock(),h.createElementBlock("primitive",{object:h.unref(r)},null,8,Ya))}}),Wa=h.defineComponent({__name:"CatmullRomCurve3",props:{segments:{default:20},closed:{type:Boolean,default:!1},curveType:{default:"centripetal"},tension:{default:.5},points:{},vertexColors:{},color:{},lineWidth:{},alphaToCoverage:{type:Boolean},dashed:{type:Boolean},dashSize:{},dashScale:{},dashOffset:{},gapSize:{},worldUnits:{type:Boolean}},setup(a){const e=a;function t(o,r,l,f){const d=o.map(u=>u instanceof c.Vector3?u:new c.Vector3(...u));return new c.CatmullRomCurve3(d,r,l,f)}function n(o,r){return o.getPoints(r)}const s=h.computed(()=>t(e.points,e.closed,e.curveType,e.tension)),i=h.computed(()=>n(s.value,e.segments));return(o,r)=>(h.openBlock(),h.createBlock(_i,{points:i.value,"vertex-colors":e.vertexColors,color:e.color,lineWidth:e.lineWidth,alphaToCoverage:e.alphaToCoverage,dashed:e.dashed,dashSize:e.dashSize,dashScale:e.dashScale,dashOffset:e.dashOffset,gapSize:e.gapSize,worldUnits:e.worldUnits},null,8,["points","vertex-colors","color","lineWidth","alphaToCoverage","dashed","dashSize","dashScale","dashOffset","gapSize","worldUnits"]))}}),Za=["args"],Qa=["color"],Ka=h.defineComponent({__name:"Circle",props:{args:{default:()=>[1,32,0,Math.PI*2]},color:{default:"#ffffff"}},setup(a,{expose:e}){const t=a,{args:n,color:s}=h.toRefs(t),i=h.shallowRef();return e({value:i}),(o,r)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"circleRef",ref:i},o.$attrs),[h.createElementVNode("TresCircleGeometry",{args:h.unref(n)},null,8,Za),h.renderSlot(o.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(s)},null,8,Qa)])],16))}}),qa=["args"],Ja=["color"],Ha=h.defineComponent({__name:"Cone",props:{args:{default:()=>[1,1,12,12,!1,0,Math.PI*2]},color:{default:"#ffffff"}},setup(a,{expose:e}){const t=a,{args:n,color:s}=h.toRefs(t),i=h.shallowRef();return e({value:i}),(o,r)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"coneRef",ref:i},o.$attrs),[h.createElementVNode("TresConeGeometry",{args:h.unref(n)},null,8,qa),h.renderSlot(o.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(s)},null,8,Ja)])],16))}}),$a=["args"],el=["color"],tl=h.defineComponent({__name:"Dodecahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(a,{expose:e}){const t=a,{args:n,color:s}=h.toRefs(t),i=h.shallowRef();return e({value:i}),(o,r)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"dodecahedronRef",ref:i},o.$attrs),[h.createElementVNode("TresDodecahedronGeometry",{args:h.unref(n)},null,8,$a),h.renderSlot(o.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(s)},null,8,el)])],16))}}),nl=["args"],sl=["color"],il=h.defineComponent({__name:"Icosahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(a,{expose:e}){const t=a,{args:n,color:s}=h.toRefs(t),i=h.shallowRef();return e({value:i}),(o,r)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"icosahedronRef",ref:i},o.$attrs),[h.createElementVNode("TresIcosahedronGeometry",{args:h.unref(n)},null,8,nl),h.renderSlot(o.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(s)},null,8,sl)])],16))}}),ol=["args"],rl=["color"],al=h.defineComponent({__name:"Octahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(a,{expose:e}){const t=a,{args:n,color:s}=h.toRefs(t),i=h.shallowRef();return e({value:i}),(o,r)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"octahedronRef",ref:i},o.$attrs),[h.createElementVNode("TresOctahedronGeometry",{args:h.unref(n)},null,8,ol),h.renderSlot(o.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(s)},null,8,rl)])],16))}}),ll=["rotation"],cl=["args"],hl=["color"],ul=h.defineComponent({__name:"Plane",props:{args:{default:()=>[1,1]},color:{default:"#ffffff"}},setup(a,{expose:e}){const t=a,{args:n,color:s}=h.toRefs(t),i=h.shallowRef();return e({value:i}),(o,r)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"planeRef",ref:i,rotation:[-Math.PI/2,0,0]},o.$attrs),[h.createElementVNode("TresPlaneGeometry",{args:h.unref(n)},null,8,cl),h.renderSlot(o.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(s)},null,8,hl)])],16,ll))}}),dl=["args"],fl=["color"],pl=h.defineComponent({__name:"Ring",props:{args:{default:()=>[.5,1,32]},color:{default:"#ffffff"}},setup(a,{expose:e}){const t=a,{args:n,color:s}=h.toRefs(t),i=h.shallowRef();return e({value:i}),(o,r)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"ringRef",ref:i},o.$attrs),[h.createElementVNode("TresRingGeometry",{args:h.unref(n)},null,8,dl),h.renderSlot(o.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(s)},null,8,fl)])],16))}}),ml=["args"],gl=["color"],yl=h.defineComponent({__name:"Sphere",props:{args:{default:()=>[2,32,16]},color:{default:"#ffffff"}},setup(a,{expose:e}){const t=a,{args:n,color:s}=h.toRefs(t),i=h.shallowRef();return e({value:i}),(o,r)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"sphereRef",ref:i},o.$attrs),[h.createElementVNode("TresSphereGeometry",{args:h.unref(n)},null,8,ml),h.renderSlot(o.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(s)},null,8,gl)])],16))}}),_l=["rotation"],vl=["args"],xl=["color"],wl=h.defineComponent({__name:"Tetrahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(a,{expose:e}){const t=a,{args:n,color:s}=h.toRefs(t),i=h.shallowRef();return e({value:i}),(o,r)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"tetrahedronRef",ref:i,rotation:[-Math.PI/2,0,0]},o.$attrs),[h.createElementVNode("TresTetrahedronGeometry",{args:h.unref(n)},null,8,vl),h.renderSlot(o.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(s)},null,8,xl)])],16,_l))}}),bl=["args"],Al=["color"],Ml=h.defineComponent({__name:"Torus",props:{args:{default:()=>[1,1,16,80]},color:{default:"#ffffff"}},setup(a,{expose:e}){const t=a,{args:n,color:s}=h.toRefs(t),i=h.shallowRef();return e({value:i}),(o,r)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"torusRef",ref:i},o.$attrs),[h.createElementVNode("TresTorusGeometry",{args:h.unref(n)},null,8,bl),h.renderSlot(o.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(s)},null,8,Al)])],16))}}),Sl=["args"],Pl=["color"],Cl=h.defineComponent({__name:"TorusKnot",props:{args:{default:()=>[1,.4,64,8]},color:{default:"#ffffff"}},setup(a,{expose:e}){const t=a,{args:n,color:s}=h.toRefs(t),i=h.shallowRef();return e({value:i}),(o,r)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"torusKnotRef",ref:i},o.$attrs),[h.createElementVNode("TresTorusKnotGeometry",{args:h.unref(n)},null,8,Sl),h.renderSlot(o.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(s)},null,8,Pl)])],16))}}),Ll=["args"],Tl=["color"],Ol=h.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(a,{expose:e}){const t=a,{args:n,color:s}=h.toRefs(t),i=h.shallowRef();return e({value:i}),(o,r)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"tubeRef",ref:i},o.$attrs),[h.createElementVNode("TresTubeGeometry",{args:h.unref(n)},null,8,Ll),h.renderSlot(o.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(s)},null,8,Tl)])],16))}}),Dl=h.defineComponent({__name:"component",props:{background:{type:[Boolean,String],default:!1},blur:{default:0},files:{default:[]},path:{default:""},preset:{default:void 0}},async setup(a,{expose:e}){let t,n;const s=a,i=h.ref(null);return e(i),i.value=([t,n]=h.withAsyncContext(()=>Xs(s).texture),t=await t,n(),t),()=>{}}}),Il=["receive-shadow","rotation"],kl=["args"],Fl=h.createElementVNode("TresMeshStandardMaterial",{color:8421504,side:2},null,-1),Bl=h.defineComponent({__name:"Backdrop",props:{floor:{default:.25},segments:{default:20},receiveShadow:{type:Boolean,default:!1}},setup(a){const e=a,t=r=>r===0?0:2**(10*r-10),{floor:n,segments:s,receiveShadow:i}=h.toRefs(e),o=h.ref(null);return h.watch(()=>[s.value,n.value,o.value],([r,l,f])=>{if(!f||r===null)return;let d=0;const u=r/r/2,p=f.attributes.position;for(let g=0;g<r+1;g++)for(let x=0;x<r+1;x++)p.setXYZ(d++,g/r-u+(g===0?-l:0),x/r-u,t(g/r));p.needsUpdate=!0,f.computeVertexNormals()}),(r,l)=>(h.openBlock(),h.createElementBlock("TresGroup",h.normalizeProps(h.guardReactiveProps(r.$attrs)),[h.createElementVNode("TresMesh",{"receive-shadow":h.unref(i),rotation:[-Math.PI/2,0,Math.PI/2]},[h.createElementVNode("TresPlaneGeometry",{ref_key:"planeRef",ref:o,args:[1,1,h.unref(s),h.unref(s)]},null,8,kl),h.renderSlot(r.$slots,"default",{},()=>[Fl])],8,Il)],16))}}),Ul=["geometry"],Vl=["map","opacity","depth-write"],zl=["object"],Nl=["args"],Gl=["rotation","args"],Rl=h.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(a,{expose:e}){const t=a,n=h.shallowRef(),s=h.shallowRef();e(n);let i,o,r,l,f;const{renderer:d,scene:u}=ne.useTresContext(),p=h.computed(()=>t.width*(Array.isArray(t.scale)?t.scale[0]:t.scale||1)),g=h.computed(()=>t.height*(Array.isArray(t.scale)?t.scale[1]:t.scale||1));h.watchEffect(()=>{i&&i.dispose(),o&&o.dispose(),r&&r.dispose(),l&&l.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,s.value=new c.OrthographicCamera(-p.value/2,p.value/2,g.value/2,-g.value/2,0,t.far),r=new c.PlaneGeometry(p.value,g.value).rotateX(Math.PI/2),l=new c.Mesh(r),l.visible=!1}),h.watchEffect(()=>{t.color&&(f&&f.dispose(),f=new c.MeshDepthMaterial,f.depthTest=f.depthWrite=!1,f.onBeforeCompile=A=>{A.uniforms={...A.uniforms,ucolor:{value:t.color?new c.Color(t.color):new c.Color}},A.fragmentShader=A.fragmentShader.replace("void main() {",`uniform vec3 ucolor;
|
|
788
|
+
`};class mi extends c.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:c.UniformsUtils.clone(c.ShaderLib.line.uniforms),vertexShader:c.ShaderLib.line.vertexShader,fragmentShader:c.ShaderLib.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1))}}const rs=new c.Vector3,ss=new c.Vector3,Fe=new c.Vector4,Be=new c.Vector4,$e=new c.Vector4,gi=new c.Vector3,yi=new c.Matrix4,Ue=new c.Line3,os=new c.Vector3,An=new c.Box3,Sn=new c.Sphere,et=new c.Vector4;let tt,St;function as(o,e,t){return et.set(0,0,-e,1).applyMatrix4(o.projectionMatrix),et.multiplyScalar(1/et.w),et.x=St/t.width,et.y=St/t.height,et.applyMatrix4(o.projectionMatrixInverse),et.multiplyScalar(1/et.w),Math.abs(Math.max(et.x,et.y))}function Ec(o,e){const t=o.matrixWorld,n=o.geometry,i=n.attributes.instanceStart,r=n.attributes.instanceEnd,s=Math.min(n.instanceCount,i.count);for(let a=0,l=s;a<l;a++){Ue.start.fromBufferAttribute(i,a),Ue.end.fromBufferAttribute(r,a),Ue.applyMatrix4(t);const f=new c.Vector3,u=new c.Vector3;tt.distanceSqToSegment(Ue.start,Ue.end,u,f),u.distanceTo(f)<St*.5&&e.push({point:u,pointOnLine:f,distance:tt.origin.distanceTo(u),object:o,face:null,faceIndex:a,uv:null,uv1:null})}}function Yc(o,e,t){const n=e.projectionMatrix,r=o.material.resolution,s=o.matrixWorld,a=o.geometry,l=a.attributes.instanceStart,f=a.attributes.instanceEnd,u=Math.min(a.instanceCount,l.count),d=-e.near;tt.at(1,$e),$e.w=1,$e.applyMatrix4(e.matrixWorldInverse),$e.applyMatrix4(n),$e.multiplyScalar(1/$e.w),$e.x*=r.x/2,$e.y*=r.y/2,$e.z=0,gi.copy($e),yi.multiplyMatrices(e.matrixWorldInverse,s);for(let m=0,y=u;m<y;m++){if(Fe.fromBufferAttribute(l,m),Be.fromBufferAttribute(f,m),Fe.w=1,Be.w=1,Fe.applyMatrix4(yi),Be.applyMatrix4(yi),Fe.z>d&&Be.z>d)continue;if(Fe.z>d){const S=Fe.z-Be.z,g=(Fe.z-d)/S;Fe.lerp(Be,g)}else if(Be.z>d){const S=Be.z-Fe.z,g=(Be.z-d)/S;Be.lerp(Fe,g)}Fe.applyMatrix4(n),Be.applyMatrix4(n),Fe.multiplyScalar(1/Fe.w),Be.multiplyScalar(1/Be.w),Fe.x*=r.x/2,Fe.y*=r.y/2,Be.x*=r.x/2,Be.y*=r.y/2,Ue.start.copy(Fe),Ue.start.z=0,Ue.end.copy(Be),Ue.end.z=0;const A=Ue.closestPointToPointParameter(gi,!0);Ue.at(A,os);const _=c.MathUtils.lerp(Fe.z,Be.z,A),L=_>=-1&&_<=1,I=gi.distanceTo(os)<St*.5;if(L&&I){Ue.start.fromBufferAttribute(l,m),Ue.end.fromBufferAttribute(f,m),Ue.start.applyMatrix4(s),Ue.end.applyMatrix4(s);const S=new c.Vector3,g=new c.Vector3;tt.distanceSqToSegment(Ue.start,Ue.end,g,S),t.push({point:g,pointOnLine:S,distance:tt.origin.distanceTo(g),object:o,face:null,faceIndex:m,uv:null,uv1:null})}}}class Xc extends c.Mesh{constructor(e=new is,t=new mi({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,n=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let s=0,a=0,l=t.count;s<l;s++,a+=2)rs.fromBufferAttribute(t,s),ss.fromBufferAttribute(n,s),i[a]=a===0?0:i[a-1],i[a+1]=i[a]+rs.distanceTo(ss);const r=new c.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new c.InterleavedBufferAttribute(r,1,0)),e.setAttribute("instanceDistanceEnd",new c.InterleavedBufferAttribute(r,1,1)),this}raycast(e,t){const n=this.material.worldUnits,i=e.camera;i===null&&!n&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const r=e.params.Line2!==void 0&&e.params.Line2.threshold||0;tt=e.ray;const s=this.matrixWorld,a=this.geometry,l=this.material;St=l.linewidth+r,a.boundingSphere===null&&a.computeBoundingSphere(),Sn.copy(a.boundingSphere).applyMatrix4(s);let f;if(n)f=St*.5;else{const d=Math.max(i.near,Sn.distanceToPoint(tt.origin));f=as(i,d,l.resolution)}if(Sn.radius+=f,tt.intersectsSphere(Sn)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),An.copy(a.boundingBox).applyMatrix4(s);let u;if(n)u=St*.5;else{const d=Math.max(i.near,An.distanceToPoint(tt.origin));u=as(i,d,l.resolution)}An.expandByScalar(u),tt.intersectsBox(An)!==!1&&(n?Ec(this,t):Yc(this,i,t))}}class ls extends is{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const t=e.length-3,n=new Float32Array(2*t);for(let i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return super.setPositions(n),this}setColors(e){const t=e.length-3,n=new Float32Array(2*t);for(let i=0;i<t;i+=3)n[2*i]=e[i],n[2*i+1]=e[i+1],n[2*i+2]=e[i+2],n[2*i+3]=e[i+3],n[2*i+4]=e[i+4],n[2*i+5]=e[i+5];return super.setColors(n),this}fromLine(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class Wc extends Xc{constructor(e=new ls,t=new mi({color:Math.random()*16777215})){super(e,t),this.isLine2=!0,this.type="Line2"}}const Zc=["object"],cs=h.defineComponent({__name:"Line2",props:{points:{},vertexColors:{default:null},color:{default:"white"},lineWidth:{default:1},worldUnits:{type:Boolean,default:!1},alphaToCoverage:{type:Boolean,default:!1},dashed:{type:Boolean,default:!1},dashSize:{default:1},gapSize:{default:1},dashScale:{default:1},dashOffset:{default:0}},setup(o){const e=o;function t(u,d){if(!u||u.length===0)return new Array(d).fill(ae.normalizeColor(e.color));if(u.length===1)return new Array(d).fill(ae.normalizeColor(u[0]));if(u.length===d)return u.map(ae.normalizeColor);const m=d-1,y=u.map(ae.normalizeColor);closed&&y.push(y[0].clone());const b=[y[0]],A=m/(y.length-1);for(let _=1;_<m;_++){const L=_%A/A,I=Math.floor(_/A);b.push(y[I].clone().lerp(y[I+1],L))}return b.push(y[y.length-1]),b}function n(u,d,m){const y=d.map(A=>A instanceof c.Vector3?[A.x,A.y,A.z]:A instanceof c.Vector2?[A.x,A.y,0]:Array.isArray(A)&&A.length===2?[A[0],A[1],0]:A).flat();u.setPositions(y.flat());const b=t(m,d.length).map(A=>A.toArray()).flat();u.setColors(b),a.computeLineDistances()}function i(u,d){u.color=ae.normalizeColor(d.color),u.linewidth=d.lineWidth,u.alphaToCoverage=d.alphaToCoverage,u.worldUnits=d.worldUnits,u.vertexColors=Array.isArray(d.vertexColors),u.dashed=d.dashed,u.dashScale=d.dashScale,u.dashSize=d.dashSize,u.dashOffset=d.dashOffset,u.gapSize=d.gapSize,u.needsUpdate=!0}const r=new mi,s=new ls,a=new Wc(s,r),l=ae.useTresContext().sizes,f=h.computed(()=>Array.isArray(e.vertexColors));return i(r,e),n(s,e.points,e.vertexColors),a.computeLineDistances(),h.watch(()=>[e.color,e.lineWidth,e.alphaToCoverage,e.worldUnits,f,e.dashed,e.dashScale,e.dashSize,e.dashOffset],()=>i(r,e)),h.watch([e.points,e.vertexColors],()=>n(s,e.points,e.vertexColors)),h.watch(()=>e.vertexColors,()=>n(s,e.points,e.vertexColors)),h.watch(()=>e.points,()=>n(s,e.points,e.vertexColors)),h.watch([l.height,l.width],()=>r.resolution=new c.Vector2(l.width.value,l.height.value)),h.onUnmounted(()=>{s.dispose(),r.dispose()}),(u,d)=>(h.openBlock(),h.createElementBlock("primitive",{object:h.unref(a)},null,8,Zc))}}),qc=h.defineComponent({__name:"CatmullRomCurve3",props:{segments:{default:20},closed:{type:Boolean,default:!1},curveType:{default:"centripetal"},tension:{default:.5},points:{},vertexColors:{},color:{},lineWidth:{},alphaToCoverage:{type:Boolean},dashed:{type:Boolean},dashSize:{},dashScale:{},dashOffset:{},gapSize:{},worldUnits:{type:Boolean}},setup(o){const e=o;function t(s,a,l,f){const u=s.map(d=>d instanceof c.Vector3?d:new c.Vector3(...d));return new c.CatmullRomCurve3(u,a,l,f)}function n(s,a){return s.getPoints(a)}const i=h.computed(()=>t(e.points,e.closed,e.curveType,e.tension)),r=h.computed(()=>n(i.value,e.segments));return(s,a)=>(h.openBlock(),h.createBlock(cs,{points:r.value,"vertex-colors":e.vertexColors,color:e.color,lineWidth:e.lineWidth,alphaToCoverage:e.alphaToCoverage,dashed:e.dashed,dashSize:e.dashSize,dashScale:e.dashScale,dashOffset:e.dashOffset,gapSize:e.gapSize,worldUnits:e.worldUnits},null,8,["points","vertex-colors","color","lineWidth","alphaToCoverage","dashed","dashSize","dashScale","dashOffset","gapSize","worldUnits"]))}}),Kc=["args"],Qc=["color"],Jc=h.defineComponent({__name:"Circle",props:{args:{default:()=>[1,32,0,Math.PI*2]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:i}=h.toRefs(t),r=h.shallowRef();return e({value:r}),(s,a)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"circleRef",ref:r},s.$attrs),[h.createElementVNode("TresCircleGeometry",{args:h.unref(n)},null,8,Kc),h.renderSlot(s.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(i)},null,8,Qc)])],16))}}),Hc=["args"],$c=["color"],eh=h.defineComponent({__name:"Cone",props:{args:{default:()=>[1,1,12,12,!1,0,Math.PI*2]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:i}=h.toRefs(t),r=h.shallowRef();return e({value:r}),(s,a)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"coneRef",ref:r},s.$attrs),[h.createElementVNode("TresConeGeometry",{args:h.unref(n)},null,8,Hc),h.renderSlot(s.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(i)},null,8,$c)])],16))}}),th=["args"],nh=["color"],ih=h.defineComponent({__name:"Dodecahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:i}=h.toRefs(t),r=h.shallowRef();return e({value:r}),(s,a)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"dodecahedronRef",ref:r},s.$attrs),[h.createElementVNode("TresDodecahedronGeometry",{args:h.unref(n)},null,8,th),h.renderSlot(s.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(i)},null,8,nh)])],16))}}),rh=["args"],sh=["color"],oh=h.defineComponent({__name:"Icosahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:i}=h.toRefs(t),r=h.shallowRef();return e({value:r}),(s,a)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"icosahedronRef",ref:r},s.$attrs),[h.createElementVNode("TresIcosahedronGeometry",{args:h.unref(n)},null,8,rh),h.renderSlot(s.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(i)},null,8,sh)])],16))}}),ah=["args"],lh=["color"],ch=h.defineComponent({__name:"Octahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:i}=h.toRefs(t),r=h.shallowRef();return e({value:r}),(s,a)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"octahedronRef",ref:r},s.$attrs),[h.createElementVNode("TresOctahedronGeometry",{args:h.unref(n)},null,8,ah),h.renderSlot(s.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(i)},null,8,lh)])],16))}}),hh=["rotation"],uh=["args"],fh=["color"],dh=h.defineComponent({__name:"Plane",props:{args:{default:()=>[1,1]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:i}=h.toRefs(t),r=h.shallowRef();return e({value:r}),(s,a)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"planeRef",ref:r,rotation:[-Math.PI/2,0,0]},s.$attrs),[h.createElementVNode("TresPlaneGeometry",{args:h.unref(n)},null,8,uh),h.renderSlot(s.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(i)},null,8,fh)])],16,hh))}}),ph=["args"],mh=["color"],gh=h.defineComponent({__name:"Ring",props:{args:{default:()=>[.5,1,32]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:i}=h.toRefs(t),r=h.shallowRef();return e({value:r}),(s,a)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"ringRef",ref:r},s.$attrs),[h.createElementVNode("TresRingGeometry",{args:h.unref(n)},null,8,ph),h.renderSlot(s.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(i)},null,8,mh)])],16))}}),yh=["args"],_h=["color"],vh=h.defineComponent({__name:"Sphere",props:{args:{default:()=>[2,32,16]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:i}=h.toRefs(t),r=h.shallowRef();return e({value:r}),(s,a)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"sphereRef",ref:r},s.$attrs),[h.createElementVNode("TresSphereGeometry",{args:h.unref(n)},null,8,yh),h.renderSlot(s.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(i)},null,8,_h)])],16))}}),wh=["geometry"],xh=["color"],bh=h.defineComponent({__name:"Superformula",props:{widthSegments:{default:32},heightSegments:{default:32},numArmsA:{default:4},expA:{default:()=>[40,1.3,.9]},numArmsB:{default:4},expB:{default:()=>[40,1.3,.9]},color:{default:"white"}},setup(o,{expose:e}){const t=o,{cos:n,sin:i,abs:r}=Math,s=h.shallowRef(),a=h.shallowRef(t.color);function l(m,y){const b=new c.BufferGeometry,A=m*y,_=new Float32Array(new Array(3*A).fill(0)),L=new Float32Array(new Array(3*A).fill(0)),I=[];for(let S=0;S<y-1;S++){for(let p=0;p<m-1;p++){const w=S*m+p,v=w+1,T=w+m,k=v+m;I.push(w,T,v),I.push(T,k,v)}const g=S*m+m-1,O=S*m,x=g+m,C=O+m;I.push(g,x,O),I.push(x,C,O)}return b.setIndex(I),b.setAttribute("position",new c.BufferAttribute(_,3)),b.setAttribute("normal",new c.BufferAttribute(L,3)),b}function f(m,y,b,A,_){return(r(n(y*m*.25))**A+r(i(y*m*.25))**_)**(-1/b)}function u(m,y,b,A,_,L,I,S,g,O,x){const C=2*Math.PI/O,p=-Math.PI,w=Math.PI/(x-1),v=-.5*Math.PI,T=m.getAttribute("position");let k=0,Q=0,Y=v;for(let $=0;$<x;$++){Q=p;for(let ee=0;ee<O;ee++){const q=f(Q,y,b,A,_),Z=f(Y,L,I,S,g);T.setXYZ(k,q*n(Q)*Z*n(Y),Z*i(Y),q*i(Q)*Z*n(Y)),k++,Q+=C}Y+=w}T.needsUpdate=!0,m.computeVertexNormals()}h.watch(()=>t.color,()=>a.value=t.color),h.watch(()=>[t.widthSegments,t.heightSegments],()=>{s.value&&s.value.dispose(),s.value=l(t.widthSegments,t.heightSegments)},{immediate:!0}),h.watch(()=>[t.numArmsA,t.expA[0],t.expA[1],t.expA[2],t.numArmsB,t.expB[0],t.expB[1],t.expB[2]],()=>u(s.value,t.numArmsA,t.expA[0],t.expA[1],t.expA[2],t.numArmsB,t.expB[0],t.expB[1],t.expB[2],t.widthSegments,t.heightSegments),{immediate:!0}),h.onUnmounted(()=>{s.value&&s.value.dispose()});const d=h.shallowRef();return e({value:d}),(m,y)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"superformulaRef",ref:d},m.$attrs,{geometry:s.value}),[h.renderSlot(m.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:a.value},null,8,xh)])],16,wh))}}),Mh=["rotation"],Ah=["args"],Sh=["color"],Ph=h.defineComponent({__name:"Tetrahedron",props:{args:{default:()=>[1,0]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:i}=h.toRefs(t),r=h.shallowRef();return e({value:r}),(s,a)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"tetrahedronRef",ref:r,rotation:[-Math.PI/2,0,0]},s.$attrs),[h.createElementVNode("TresTetrahedronGeometry",{args:h.unref(n)},null,8,Ah),h.renderSlot(s.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(i)},null,8,Sh)])],16,Mh))}}),Ch=["args"],Lh=["color"],Th=h.defineComponent({__name:"Torus",props:{args:{default:()=>[1,1,16,80]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:i}=h.toRefs(t),r=h.shallowRef();return e({value:r}),(s,a)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"torusRef",ref:r},s.$attrs),[h.createElementVNode("TresTorusGeometry",{args:h.unref(n)},null,8,Ch),h.renderSlot(s.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(i)},null,8,Lh)])],16))}}),Oh=["args"],Ih=["color"],Dh=h.defineComponent({__name:"TorusKnot",props:{args:{default:()=>[1,.4,64,8]},color:{default:"#ffffff"}},setup(o,{expose:e}){const t=o,{args:n,color:i}=h.toRefs(t),r=h.shallowRef();return e({value:r}),(s,a)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"torusKnotRef",ref:r},s.$attrs),[h.createElementVNode("TresTorusKnotGeometry",{args:h.unref(n)},null,8,Oh),h.renderSlot(s.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(i)},null,8,Ih)])],16))}}),kh=["args"],Fh=["color"],Bh=h.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(o,{expose:e}){const t=o,{args:n,color:i}=h.toRefs(t),r=h.shallowRef();return e({value:r}),(s,a)=>(h.openBlock(),h.createElementBlock("TresMesh",h.mergeProps({ref_key:"tubeRef",ref:r},s.$attrs),[h.createElementVNode("TresTubeGeometry",{args:h.unref(n)},null,8,kh),h.renderSlot(s.$slots,"default",{},()=>[h.createElementVNode("TresMeshBasicMaterial",{color:h.unref(i)},null,8,Fh)])],16))}}),Uh=h.defineComponent({__name:"component",props:{background:{type:[Boolean,String],default:!1},blur:{default:0},files:{default:[]},path:{default:""},preset:{default:void 0}},async setup(o,{expose:e}){let t,n;const i=o,r=h.ref(null);return e(r),r.value=([t,n]=h.withAsyncContext(()=>vr(i).texture),t=await t,n(),t),()=>{}}}),Nh=["receive-shadow","rotation"],Vh=["args"],zh=h.createElementVNode("TresMeshStandardMaterial",{color:8421504,side:2},null,-1),jh=h.defineComponent({__name:"Backdrop",props:{floor:{default:.25},segments:{default:20},receiveShadow:{type:Boolean,default:!1}},setup(o){const e=o,t=a=>a===0?0:2**(10*a-10),{floor:n,segments:i,receiveShadow:r}=h.toRefs(e),s=h.ref(null);return h.watch(()=>[i.value,n.value,s.value],([a,l,f])=>{if(!f||a===null)return;let u=0;const d=a/a/2,m=f.attributes.position;for(let y=0;y<a+1;y++)for(let b=0;b<a+1;b++)m.setXYZ(u++,y/a-d+(y===0?-l:0),b/a-d,t(y/a));m.needsUpdate=!0,f.computeVertexNormals()}),(a,l)=>(h.openBlock(),h.createElementBlock("TresGroup",h.normalizeProps(h.guardReactiveProps(a.$attrs)),[h.createElementVNode("TresMesh",{"receive-shadow":h.unref(r),rotation:[-Math.PI/2,0,Math.PI/2]},[h.createElementVNode("TresPlaneGeometry",{ref_key:"planeRef",ref:s,args:[1,1,h.unref(i),h.unref(i)]},null,8,Vh),h.renderSlot(a.$slots,"default",{},()=>[zh])],8,Nh)],16))}}),Gh=["geometry"],Rh=["map","opacity","depth-write"],Eh=["object"],Yh=["args"],Xh=["rotation","args"],Wh=h.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(o,{expose:e}){const t=o,n=h.shallowRef(),i=h.shallowRef();e(n);let r,s,a,l,f;const{renderer:u,scene:d}=ae.useTresContext(),m=h.computed(()=>t.width*(Array.isArray(t.scale)?t.scale[0]:t.scale||1)),y=h.computed(()=>t.height*(Array.isArray(t.scale)?t.scale[1]:t.scale||1));h.watchEffect(()=>{r&&r.dispose(),s&&s.dispose(),a&&a.dispose(),l&&l.geometry.dispose(),r=new c.WebGLRenderTarget(t.resolution,t.resolution),s=new c.WebGLRenderTarget(t.resolution,t.resolution),s.texture.generateMipmaps=r.texture.generateMipmaps=!1,i.value=new c.OrthographicCamera(-m.value/2,m.value/2,y.value/2,-y.value/2,0,t.far),a=new c.PlaneGeometry(m.value,y.value).rotateX(Math.PI/2),l=new c.Mesh(a),l.visible=!1}),h.watchEffect(()=>{t.color&&(f&&f.dispose(),f=new c.MeshDepthMaterial,f.depthTest=f.depthWrite=!1,f.onBeforeCompile=O=>{O.uniforms={...O.uniforms,ucolor:{value:t.color?new c.Color(t.color):new c.Color}},O.fragmentShader=O.fragmentShader.replace("void main() {",`uniform vec3 ucolor;
|
|
586
789
|
void main() {
|
|
587
|
-
`),
|
|
790
|
+
`),O.fragmentShader=O.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")})});const b=new c.ShaderMaterial(ko),A=new c.ShaderMaterial(Fo);A.depthTest=b.depthTest=!1;function _(O){!u.value||!i.value||(l.visible=!0,l.material=b,b.uniforms.tDiffuse.value=r.texture,b.uniforms.h.value=O/256,u.value.setRenderTarget(s),u.value.render(l,i.value),l.material=A,A.uniforms.tDiffuse.value=s.texture,A.uniforms.v.value=O/256,u.value.setRenderTarget(r),u.value.render(l,i.value),l.visible=!1)}const{onLoop:L}=ae.useRenderLoop();let I=0,S,g;return L(()=>{!i.value||d.value===void 0||u.value===void 0||(t.frames===1/0||I<t.frames)&&(I++,S=d.value.background,g=d.value.overrideMaterial,n.value.visible=!1,d.value.background=null,d.value.overrideMaterial=f,u.value.setRenderTarget(r),u.value.render(d.value,i.value),_(t.blur),t.smooth&&_(t.blur*.4),u.value.setRenderTarget(null),n.value.visible=!0,d.value.background=S,d.value.overrideMaterial=g)}),(O,x)=>(h.openBlock(),h.createElementBlock("TresGroup",h.mergeProps({ref_key:"groupRef",ref:n},O.$attrs),[h.createElementVNode("TresMesh",{scale:[1,-1,1],geometry:h.unref(a)},[h.createElementVNode("TresMeshBasicMaterial",{map:h.unref(r).texture,opacity:O.opacity,"depth-write":O.depthWrite,transparent:!0},null,8,Rh)],8,Gh),h.createElementVNode("primitive",{object:h.unref(l)},null,8,Eh),i.value&&O.helper?(h.openBlock(),h.createElementBlock("TresCameraHelper",{key:0,args:[i.value]},null,8,Yh)):h.createCommentVNode("",!0),h.createElementVNode("TresOrthographicCamera",{ref_key:"shadowCamera",ref:i,position:[0,0,0],rotation:[Math.PI/2,0,0],args:[-m.value/2,m.value/2,y.value/2,-y.value/2,0,O.far]},null,8,Xh)],16))}}),Zh=["size","color","alpha-map","map","opacity","alpha-test","depth-write","transparent","size-attenuation"],qh=["position","velocity"],Kh=h.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(o){const e=o,{size:t,area:n,color:i,alphaMap:r,map:s,opacity:a,alphaTest:l,depthWrite:f,transparent:u,sizeAttenuation:d,count:m,speed:y,randomness:b}=h.toRefs(e),A=h.shallowRef();let _=[],L=[];const I=()=>{_=new Float32Array(m.value*3);for(let O=0;O<m.value;O++){const x=O*3;_[x]=(Math.random()-.5)*n.value[0],_[x+1]=(Math.random()-.5)*n.value[1],_[x+2]=(Math.random()-.5)*n.value[2]}},S=()=>{L=new Float32Array(m.value*2);for(let O=0;O<m.value*2;O+=2)L[O]=(Math.random()-.5)/5*y.value*b.value,L[O+1]=Math.random()/5*y.value+.01};S(),I(),h.watchEffect(()=>{S(),I()});const{onLoop:g}=ae.useRenderLoop();return g(()=>{var O,x;if((O=A.value)!=null&&O.attributes.position.array&&((x=A.value)!=null&&x.attributes.position.count)){const C=A.value.attributes.position.array;for(let p=0;p<A.value.attributes.position.count;p++){const w=L[p*2],v=L[p*2+1];C[p*3]+=w,C[p*3+1]-=v,(C[p*3]<=-n.value[0]/2||C[p*3]>=n.value[0]/2)&&(C[p*3]=C[p*3]*-1),(C[p*3+1]<=-n.value[1]/2||C[p*3+1]>=n.value[1]/2)&&(C[p*3+1]=C[p*3+1]*-1)}A.value.attributes.position.needsUpdate=!0}}),(O,x)=>(h.openBlock(),h.createElementBlock("TresPoints",null,[h.createElementVNode("TresPointsMaterial",{size:h.unref(t),color:h.unref(i),"alpha-map":h.unref(r),map:h.unref(s),opacity:h.unref(a),"alpha-test":h.unref(l),"depth-write":h.unref(f),transparent:h.unref(u),"size-attenuation":h.unref(d)},null,8,Zh),h.createElementVNode("TresBufferGeometry",{ref_key:"geometryRef",ref:A,position:[h.unref(_),3],velocity:[h.unref(L)]},null,8,qh)]))}});class Pn extends c.Mesh{constructor(){const e=Pn.SkyShader,t=new c.ShaderMaterial({name:e.name,uniforms:c.UniformsUtils.clone(e.uniforms),vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,side:c.BackSide,depthWrite:!1});super(new c.BoxGeometry(1,1,1),t),this.isSky=!0}}Pn.SkyShader={name:"SkyShader",uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new c.Vector3},up:{value:new c.Vector3(0,1,0)}},vertexShader:`
|
|
588
791
|
uniform vec3 sunPosition;
|
|
589
792
|
uniform float rayleigh;
|
|
590
793
|
uniform float turbidity;
|
|
@@ -737,7 +940,78 @@
|
|
|
737
940
|
#include <tonemapping_fragment>
|
|
738
941
|
#include <colorspace_fragment>
|
|
739
942
|
|
|
740
|
-
}`};const $l=["object","material-uniforms-turbidity-value","material-uniforms-rayleigh-value","material-uniforms-mieCoefficient-value","material-uniforms-mieDirectionalG-value","material-uniforms-sunPosition-value","scale"],ec=h.defineComponent({__name:"Sky",props:{turbidity:{default:3.4},rayleigh:{default:3},mieCoefficient:{default:.005},mieDirectionalG:{default:.7},elevation:{default:.6},azimuth:{default:180},distance:{default:45e4}},setup(a){const e=a,t=new cn,n=h.computed(()=>s(e.azimuth,e.elevation));function s(i,o){const r=c.MathUtils.degToRad(90-o),l=c.MathUtils.degToRad(i);return new c.Vector3().setFromSphericalCoords(1,r,l)}return(i,o)=>(h.openBlock(),h.createElementBlock("primitive",{object:h.unref(t),"material-uniforms-turbidity-value":e.turbidity,"material-uniforms-rayleigh-value":e.rayleigh,"material-uniforms-mieCoefficient-value":e.mieCoefficient,"material-uniforms-mieDirectionalG-value":e.mieDirectionalG,"material-uniforms-sunPosition-value":n.value,scale:e.distance},null,8,$l))}});let Je;const tc=(a="body")=>{Je||(Je=new Li.Pane({container:document.querySelector(a)}),Je.element.style.position="absolute",Je.element.style.top="1rem",Je.element.style.right="1rem",Je.element.style.zIndex="9999");const{logWarning:e}=In();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(){Je&&Je.dispose()}return h.onMounted(()=>{const{resume:n}=ne.useRenderLoop();n()}),h.onUnmounted(()=>{t()}),{pane:Je,disposeTweakPane:t}};var nc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sc(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var vi={exports:{}};(function(a,e){(function(t,n){a.exports=n()})(nc,function(){var t=function(){function n(g){return o.appendChild(g.dom),g}function s(g){for(var x=0;x<o.children.length;x++)o.children[x].style.display=x===g?"block":"none";i=g}var i=0,o=document.createElement("div");o.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",o.addEventListener("click",function(g){g.preventDefault(),s(++i%o.children.length)},!1);var r=(performance||Date).now(),l=r,f=0,d=n(new t.Panel("FPS","#0ff","#002")),u=n(new t.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var p=n(new t.Panel("MB","#f08","#201"));return s(0),{REVISION:16,dom:o,addPanel:n,showPanel:s,begin:function(){r=(performance||Date).now()},end:function(){f++;var g=(performance||Date).now();if(u.update(g-r,200),g>l+1e3&&(d.update(1e3*f/(g-l),100),l=g,f=0,p)){var x=performance.memory;p.update(x.usedJSHeapSize/1048576,x.jsHeapSizeLimit/1048576)}return g},update:function(){r=this.end()},domElement:o,setMode:s}};return t.Panel=function(n,s,i){var o=1/0,r=0,l=Math.round,f=l(window.devicePixelRatio||1),d=80*f,u=48*f,p=3*f,g=2*f,x=3*f,w=15*f,_=74*f,M=30*f,L=document.createElement("canvas");L.width=d,L.height=u,L.style.cssText="width:80px;height:48px";var v=L.getContext("2d");return v.font="bold "+9*f+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=i,v.fillRect(0,0,d,u),v.fillStyle=s,v.fillText(n,p,g),v.fillRect(x,w,_,M),v.fillStyle=i,v.globalAlpha=.9,v.fillRect(x,w,_,M),{dom:L,update:function(y,A){o=Math.min(o,y),r=Math.max(r,y),v.fillStyle=i,v.globalAlpha=1,v.fillRect(0,0,d,w),v.fillStyle=s,v.fillText(l(y)+" "+n+" ("+l(o)+"-"+l(r)+")",p,g),v.drawImage(L,x+f,w,_-f,M,x,w,_-f,M),v.fillRect(x+_-f,w,f,M),v.fillStyle=i,v.globalAlpha=.9,v.fillRect(x+_-f,w,f,l((1-y/A)*M))}}},t})})(vi);var ic=vi.exports;const oc=sc(ic),rc=h.defineComponent({name:"Stats",props:{showPanel:{type:Number,default:0}},setup(a,{expose:e}){const t=new oc;e({stats:t});const n=document.body;t.showPanel(a.showPanel||0),n==null||n.appendChild(t.dom);const{onBeforeLoop:s,onAfterLoop:i,resume:o}=ne.useRenderLoop();return o(),s(()=>t.begin()),i(()=>t.end()),h.onUnmounted(()=>{n==null||n.removeChild(t.dom)}),null}});class ac{constructor(e,t,n){this.name=e,this.fg=t,this.bg=n,this.PR=Math.round(window.devicePixelRatio||1),this.WIDTH=90*this.PR,this.HEIGHT=48*this.PR,this.TEXT_X=3*this.PR,this.TEXT_Y=2*this.PR,this.GRAPH_X=3*this.PR,this.GRAPH_Y=15*this.PR,this.GRAPH_WIDTH=84*this.PR,this.GRAPH_HEIGHT=30*this.PR,this.canvas=document.createElement("canvas"),this.canvas.width=90*this.PR,this.canvas.height=48*this.PR,this.canvas.style.width="90px",this.canvas.style.position="absolute",this.canvas.style.height="48px",this.canvas.style.cssText="width:90px;height:48px",this.context=this.canvas.getContext("2d"),this.context&&(this.context.font="bold "+9*this.PR+"px Helvetica,Arial,sans-serif",this.context.textBaseline="top",this.context.fillStyle=this.bg,this.context.fillRect(0,0,this.WIDTH,this.HEIGHT),this.context.fillStyle=this.fg,this.context.fillText(this.name,this.TEXT_X,this.TEXT_Y),this.context.fillRect(this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH,this.GRAPH_HEIGHT),this.context.fillStyle=this.bg,this.context.globalAlpha=.9,this.context.fillRect(this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH,this.GRAPH_HEIGHT))}update(e,t,n,s,i=0){let o=1/0,r=0;this.context&&(o=Math.min(o,e),r=Math.max(n,e),s=Math.max(s,t),this.context.fillStyle=this.bg,this.context.globalAlpha=1,this.context.fillRect(0,0,this.WIDTH,this.GRAPH_Y),this.context.fillStyle=this.fg,this.context.fillText(e.toFixed(i)+" "+this.name+" ("+o.toFixed(i)+"-"+parseFloat(r.toFixed(i))+")",this.TEXT_X,this.TEXT_Y),this.context.drawImage(this.canvas,this.GRAPH_X+this.PR,this.GRAPH_Y,this.GRAPH_WIDTH-this.PR,this.GRAPH_HEIGHT,this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH-this.PR,this.GRAPH_HEIGHT),this.context.fillRect(this.GRAPH_X+this.GRAPH_WIDTH-this.PR,this.GRAPH_Y,this.PR,this.GRAPH_HEIGHT),this.context.fillStyle=this.bg,this.context.globalAlpha=.9,this.context.fillRect(this.GRAPH_X+this.GRAPH_WIDTH-this.PR,this.GRAPH_Y,this.PR,(1-t/s)*this.GRAPH_HEIGHT))}}const xi=class pn{constructor({logsPerSecond:e=20,samplesLog:t=100,samplesGraph:n=10,precision:s=2,minimal:i=!1,horizontal:o=!0,mode:r=0}={}){this.mode=r,this.horizontal=o,this.container=document.createElement("div"),this.container.style.cssText="position:fixed;top:0;left:0;opacity:0.9;z-index:10000;",i&&(this.container.style.cssText+="cursor:pointer"),this.canvasGpu=null,this.gl=null,this.query=null,this.minimal=i,this.beginTime=(performance||Date).now(),this.prevTime=this.beginTime,this.prevCpuTime=this.beginTime,this.frames=0,this.averageCpu={logs:[],graph:[]},this.averageGpu={logs:[],graph:[]},this.queryCreated=!1,this.fpsPanel=this.addPanel(new pn.Panel("FPS","#0ff","#002"),0),this.msPanel=this.addPanel(new pn.Panel("CPU","#0f0","#020"),1),this.gpuPanel=null,this.samplesLog=t,this.samplesGraph=n,this.precision=s,this.logsPerSecond=e,this.minimal?(this.container.addEventListener("click",l=>{l.preventDefault(),this.showPanel(++this.mode%this.container.children.length)},!1),this.mode=r,this.showPanel(this.mode)):window.addEventListener("resize",()=>{this.resizePanel(this.fpsPanel,0),this.resizePanel(this.msPanel,1),this.gpuPanel&&this.resizePanel(this.gpuPanel,2)})}resizePanel(e,t){e.canvas.style.position="absolute",this.minimal?e.canvas.style.display="none":(e.canvas.style.display="block",this.horizontal?(e.canvas.style.top="0px",e.canvas.style.left=t*e.WIDTH/e.PR+"px"):(e.canvas.style.left="0px",e.canvas.style.top=t*e.HEIGHT/e.PR+"px"))}addPanel(e,t){return e.canvas&&(this.container.appendChild(e.canvas),this.resizePanel(e,t)),e}showPanel(e){for(let t=0;t<this.container.children.length;t++){const n=this.container.children[t];n.style.display=t===e?"block":"none"}this.mode=e}init(e){this.canvasGpu=e,this.canvasGpu&&(this.gl=this.canvasGpu.getContext("webgl2"),this.ext=this.gl?this.gl.getExtension("EXT_disjoint_timer_query_webgl2"):null,this.ext&&(this.gpuPanel=this.addPanel(new pn.Panel("GPU","#ff0","#220"),2)))}begin(){if(this.beginProfiling("cpu-started"),!(!this.gl||!this.ext)){if(this.query){const e=this.gl.getQueryParameter(this.query,this.gl.QUERY_RESULT_AVAILABLE);if(this.disjoint=this.gl.getParameter(this.ext.GPU_DISJOINT_EXT),e&&!this.disjoint){this.ns=this.gl.getQueryParameter(this.query,this.gl.QUERY_RESULT);const t=this.ns*1e-6;(e||this.disjoint)&&(this.gl.deleteQuery(this.query),this.query=null),e&&this.addToAverage(t,this.averageGpu)}}this.query||(this.queryCreated=!0,this.query=this.gl.createQuery(),this.query&&this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,this.query))}}end(){this.beginTime=this.endInternal(),this.endProfiling("cpu-started","cpu-finished","cpu-duration",this.averageCpu),!(!this.gl||!this.ext)&&this.queryCreated&&this.gl.getQuery(this.ext.TIME_ELAPSED_EXT,this.gl.CURRENT_QUERY)&&this.gl.endQuery(this.ext.TIME_ELAPSED_EXT)}endInternal(){this.frames++;const e=(performance||Date).now();if(e>=this.prevCpuTime+1e3/this.logsPerSecond&&(this.updatePanel(this.msPanel,this.averageCpu),this.updatePanel(this.gpuPanel,this.averageGpu),this.prevCpuTime=e),e>=this.prevTime+1e3){const t=this.frames*1e3/(e-this.prevTime);this.fpsPanel.update(t,t,100,100,0),this.prevTime=e,this.frames=0}return e}addToAverage(e,t){t.logs.push(e),t.logs.length>this.samplesLog&&t.logs.shift(),t.graph.push(e),t.graph.length>this.samplesGraph&&t.graph.shift()}beginProfiling(e){window.performance&&window.performance.mark(e)}endProfiling(e,t,n,s){if(window.performance&&t){window.performance.mark(t);const i=performance.measure(n,e,t);this.addToAverage(i.duration,s)}}updatePanel(e,t){if(t.logs.length>0){let n=0,s=.01;for(let r=0;r<t.logs.length;r++)n+=t.logs[r],t.logs[r]>s&&(s=t.logs[r]);let i=0,o=.01;for(let r=0;r<t.graph.length;r++)i+=t.graph[r],t.graph[r]>o&&(o=t.graph[r]);e&&e.update(n/Math.min(t.logs.length,this.samplesLog),i/Math.min(t.graph.length,this.samplesGraph),s,o,this.precision)}}};xi.Panel=ac;let lc=xi;const cc=h.defineComponent({name:"StatsGl",props:["logsPerSecond","samplesLog","samplesGraph","precision","horizontal","minimal","mode"],async setup(a,{expose:e}){const t=new lc({logsPerSecond:a.logsPerSecond,samplesLog:a.samplesLog,samplesGraph:a.samplesGraph,precision:a.precision,horizontal:a.horizontal,minimal:a.minimal,mode:a.mode});e({statsGl:t});const n=document.body;n==null||n.appendChild(t.container);const{renderer:s}=ne.useTresContext(),{onBeforeLoop:i,onAfterLoop:o,resume:r}=ne.useRenderLoop();return t.init(s.value.domElement),r(),i(()=>t.begin()),o(()=>t.end()),h.onUnmounted(()=>{n==null||n.removeChild(t.container)}),null}});var hc=`#include <common>
|
|
943
|
+
}`};const Qh=["object","material-uniforms-turbidity-value","material-uniforms-rayleigh-value","material-uniforms-mieCoefficient-value","material-uniforms-mieDirectionalG-value","material-uniforms-sunPosition-value","scale"],Jh=h.defineComponent({__name:"Sky",props:{turbidity:{default:3.4},rayleigh:{default:3},mieCoefficient:{default:.005},mieDirectionalG:{default:.7},elevation:{default:.6},azimuth:{default:180},distance:{default:45e4}},setup(o){const e=o,t=new Pn,n=h.computed(()=>i(e.azimuth,e.elevation));function i(r,s){const a=c.MathUtils.degToRad(90-s),l=c.MathUtils.degToRad(r);return new c.Vector3().setFromSphericalCoords(1,a,l)}return(r,s)=>(h.openBlock(),h.createElementBlock("primitive",{object:h.unref(t),"material-uniforms-turbidity-value":e.turbidity,"material-uniforms-rayleigh-value":e.rayleigh,"material-uniforms-mieCoefficient-value":e.mieCoefficient,"material-uniforms-mieDirectionalG-value":e.mieDirectionalG,"material-uniforms-sunPosition-value":n.value,scale:e.distance},null,8,Qh))}}),Hh=["position"],$h=["position"],eu=["scale"],tu=["map","depth-test","color-space","color","opacity"],nu=h.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(o,{expose:e}){let t,n;const i=o,{width:r,depth:s,segments:a,texture:l,color:f,depthTest:u,opacity:d,speed:m}=h.toRefs(i),y=h.shallowRef(),b=h.shallowRef();e({value:y});const A=[...new Array(a)].map((x,C)=>({x:r.value/2-Math.random()*r.value,y:r.value/2-Math.random()*r.value,scale:.4+Math.sin((C+1)/a.value*Math.PI)*((.2+Math.random())*10),density:Math.max(.2,Math.random()),rotation:Math.max(.002,.005*Math.random())*m.value})),_=(x,C)=>x/6*C*d.value,{map:L}=([t,n]=h.withAsyncContext(()=>ae.useTexture({map:l.value})),t=await t,n(),t),{renderer:I,camera:S}=ae.useTresContext(),g=h.computed(()=>{var x;return(x=I.value)==null?void 0:x.outputColorSpace}),{onLoop:O}=ae.useRenderLoop();return O(()=>{var x,C;y.value&&S.value&&b.value&&((x=b.value)==null||x.children.forEach((p,w)=>{p.rotation.z+=A[w].rotation}),y.value.lookAt((C=S.value)==null?void 0:C.position))}),(x,C)=>(h.openBlock(),h.createElementBlock("TresGroup",h.mergeProps({ref_key:"smokeRef",ref:y},x.$attrs),[h.createElementVNode("TresGroup",{ref_key:"groupRef",ref:b,position:[0,0,h.unref(a)/2*h.unref(s)]},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(h.unref(A),({scale:p,x:w,y:v,density:T},k)=>(h.openBlock(),h.createElementBlock("TresMesh",{key:`${k}`,position:[w,v,-k*h.unref(s)]},[h.createElementVNode("TresPlaneGeometry",{scale:[p,p,p],rotation:[0,0,0]},null,8,eu),h.createElementVNode("TresMeshStandardMaterial",{map:h.unref(L),"depth-test":h.unref(u),"color-space":g.value,color:h.unref(f),"depth-write":!1,transparent:"",opacity:_(p,T)},null,8,tu)],8,$h))),128))],8,Hh)],16))}});function iu(o){return vi(o,{normalizeValue:e=>ae.normalizeColor(e),getDefaultValue:()=>new c.Color(0,0,0),isSingleValue:e=>!Array.isArray(e),isMultipleValues:e=>Array.isArray(e)&&(e.length===0||!Array.isArray(e[0])),isMultipleValuesWithStops:e=>Array.isArray(e)&&e.length>0&&Array.isArray(e[0]),isEmpty:e=>Array.isArray(e)&&e.length===0})}function _i(o){return"isVector3"in o||Array.isArray(o)&&o.length>0&&o.every(e=>typeof e=="number")}function ru(o){return vi(o,{normalizeValue:e=>ae.normalizeVectorFlexibleParam(e),getDefaultValue:()=>[0,0,0],isSingleValue:e=>_i(e),isMultipleValues:e=>Array.isArray(e)&&e.length>0&&_i(e[0]),isMultipleValuesWithStops:e=>Array.isArray(e)&&e.length>0&&Array.isArray(e[0])&&e[0].length===2&&_i(e[0][1]),isEmpty:e=>Array.isArray(e)&&e.length===0})}function su(o){return vi(o,{normalizeValue:e=>e,getDefaultValue:()=>1,isSingleValue:e=>!Array.isArray(e)&&typeof e<"u",isMultipleValues:e=>Array.isArray(e)&&(e.length===0||!Array.isArray(e[0])),isMultipleValuesWithStops:e=>Array.isArray(e)&&e.length>0&&Array.isArray(e[0]),isEmpty:e=>Array.isArray(e)&&e.length===0})}function vi(o,e){const{normalizeValue:t,getDefaultValue:n,isEmpty:i}=e,r=l=>e.isSingleValue(l),s=l=>e.isMultipleValues(l),a=l=>e.isMultipleValuesWithStops(l);if(i(o))return[[0,n()]];if(r(o))return[[0,t(o)]];if(s(o)){const l=o.length>1?1/(o.length-1):1;return o.map((f,u)=>[l*u,t(f)])}else if(a(o))return o.map(([l,f],u)=>[l,t(f)]);return[[0,n()]]}class ou{constructor(e,t){ye(this,"entries");ye(this,"resolution");this.entries=e,this.resolution=t}useTexture(){return new cu(this.entries,this.resolution).use()}}class wi{constructor(e,t,n,i,r,s){ye(this,"data");ye(this,"ref");ye(this,"name");ye(this,"valueMin");ye(this,"valueMax");ye(this,"suffix");ye(this,"renderToCanvasGradient");this.data=h.isRef(e)?e.value:e,this.ref=h.isRef(e)?e:null,this.name=t,this.valueMin=n,this.valueMax=i,this.suffix=r,this.renderToCanvasGradient=s}}class au extends wi{constructor(e,t="color",n=0,i=1,r="rgba",s=hu){super(e,t,n,i,r,s)}}class hs extends wi{constructor(e,t="scalar",n=0,i=1,r="x",s=uu){super(e,t,n,i,r,s)}}class lu extends wi{constructor(e,t="scalar3",n=0,i=1,r="xyz",s=fu){super(e,t,n,i,r,s)}}class cu{constructor(e,t){ye(this,"entries");ye(this,"size");ye(this,"dirty",h.shallowRef(0));ye(this,"context");this.entries=e,this.size=Math.max(t,e.length);const n=document.createElement("canvas");n.height=this.size,n.width=this.size,this.context=n.getContext("2d")}use(){const e=this.build(),t=h.shallowRef(e);for(const n of this.entries)n.ref&&h.watch(n.ref,()=>{var i;n.data=(i=n.ref)==null?void 0:i.value,h.triggerRef(this.dirty)});return ba(this.dirty,()=>{this.build(e),t.value=e},{throttle:1e3/60}),{texture:t,dispose:()=>e.dispose(),yFor:this.entries.reduce((n,i,r)=>(n[i.name]=(r+.5)/this.size,n),{})}}build(e){this.entries.forEach((n,i)=>{const r=this.context.createLinearGradient(0,i,this.size,i);n.renderToCanvasGradient(r,n),this.context.fillStyle=r,this.context.fillRect(0,i,this.size,1)}),e&&(e.source.data=this.context.getImageData(0,0,this.size,this.size));const t=e??new c.DataTexture(this.context.getImageData(0,0,this.size,this.size).data,this.size,this.size,c.RGBAFormat,c.UnsignedByteType,c.UVMapping,c.ClampToEdgeWrapping,c.ClampToEdgeWrapping);return t.needsUpdate=!0,t}}function us(o,e,t,n,i){return Dl(pt(o,e,t),e,t,n,i)}function hu(o,e){return iu(e.data).forEach(([t,n])=>o.addColorStop(t,`rgb(${n.r*255}, ${n.g*255}, ${n.b*255})`))}function uu(o,e){return su(e.data).forEach(([t,n])=>{o.addColorStop(t,`rgb(${us(n,e.valueMin,e.valueMax,0,255)}, 0, 0)`)})}function fu(o,e){return ru(e.data).forEach(([t,n])=>o.addColorStop(t,`rgb(${n.map(i=>us(i,e.valueMin,e.valueMax,0,255))})`))}class du{constructor(e=256){ye(this,"entries");ye(this,"resolution");this.resolution=e,this.entries=[]}withResolution(e){return this.resolution=e,this}get add(){return new mu(e=>this.onAdd(e))}build(){return new ou(this.entries,this.resolution)}onAdd(e){return this.entries.push(e),new pu(e,this)}}class pu{constructor(e,t){ye(this,"entry");ye(this,"parent");this.entry=e,this.parent=t}id(e){return this.entry.name=e,this}range(e,t){return this.entry.valueMin=e,this.entry.valueMax=t,this}suffix(e){return this.entry.suffix=e,this}canvasGradientRenderer(e){return this.entry.renderToCanvasGradient=e,this}get add(){return this.parent.add}build(){return this.parent.build()}}class mu{constructor(e){ye(this,"onAdd");this.onAdd=e}GradientTresColor(e){return this.onAdd(new au(e))}Gradient01(e){return this.onAdd(new hs(e,"zeroOne",0,1))}GradientScalar(e,t,n){return this.onAdd(new hs(e,"scalar",t,n))}GradientXyz(e,t,n){return this.onAdd(new lu(e,"position",t,n))}}let xi=null;function gu(){return xi===null&&(xi=new c.DataTexture(new Uint8Array([0,0,0,0]),1,1)),xi}const yu=["object"],_u=h.defineComponent({__name:"component",props:{map:{default:"https://raw.githubusercontent.com/Tresjs/assets/e41a93c56ec7cb5ac2d241f309e23582a5fe1fc6/textures/sparkles/particle.png"},geometry:{default:void 0},directionalLight:{default:void 0},lifetimeSec:{default:.4},cooldownSec:{default:2},normalThreshold:{default:.7},noiseScale:{default:3},scaleNoise:{default:1},offsetNoise:{default:.1},lifetimeNoise:{default:0},size:{default:1},alpha:{default:1},offset:{default:1},surfaceDistance:{default:1},sequenceColor:{default:()=>[[.7,"#82dbc5"],[.8,"#fbb03b"]]},sequenceAlpha:{default:()=>[[0,0],[.1,1],[.5,1],[.9,0]]},sequenceOffset:{default:()=>[0,0,0]},sequenceNoise:{default:()=>[.1,.1,.1]},sequenceSize:{default:()=>[0,1]},sequenceSurfaceDistance:{default:()=>[.05,.08,.1]},mixColor:{default:.5},mixAlpha:{default:1},mixOffset:{default:1},mixSize:{default:0},mixSurfaceDistance:{default:1},mixNoise:{default:1},blending:{default:c.AdditiveBlending},transparent:{type:Boolean,default:!0},depthWrite:{type:Boolean,default:!1}},setup(o){const e=o,t=parseInt(c.REVISION.replace(/\D+/g,"")),n=h.toRefs(e),i=typeof e.map=="string"?gu():e.map,{texture:r,yFor:s}=new du(256).add.GradientTresColor(n.sequenceColor).id("sequenceColor").add.Gradient01(n.sequenceAlpha).id("sequenceAlpha").add.Gradient01(n.sequenceSurfaceDistance).id("sequenceSurfaceDistance").add.Gradient01(n.sequenceSize).id("sequenceSize").add.GradientXyz(n.sequenceOffset,-1,1).id("sequenceOffset").add.GradientXyz(n.sequenceNoise,0,1).id("sequenceNoise").build().useTexture(),a={blending:e.blending,transparent:e.transparent,depthWrite:e.depthWrite,uniforms:{uMap:new c.Uniform(i),uPixelRatio:new c.Uniform(1),uNormal:new c.Uniform(c.Object3D.DEFAULT_UP),uNormalThreshold:new c.Uniform(e.normalThreshold),uTime:new c.Uniform(0),uCooldownRatio:new c.Uniform(1),uSize:new c.Uniform(e.size),uAlpha:new c.Uniform(e.alpha),uOffset:new c.Uniform(e.offset),uSurfaceDistance:new c.Uniform(e.surfaceDistance),uNoiseScale:new c.Uniform(e.noiseScale),uScaleNoise:new c.Uniform(e.scaleNoise),uOffsetNoise:new c.Uniform(e.offsetNoise),uLifetimeNoise:new c.Uniform(e.lifetimeNoise),uMixColor:new c.Uniform(e.mixColor),uMixAlpha:new c.Uniform(e.mixAlpha),uMixOffset:new c.Uniform(e.mixOffset),uMixSize:new c.Uniform(e.mixSize),uMixSurfaceDistance:new c.Uniform(e.mixSurfaceDistance),uMixNoise:new c.Uniform(e.mixNoise),uInfoTexture:new c.Uniform(r.value)},vertexShader:`
|
|
944
|
+
uniform float uPixelRatio;
|
|
945
|
+
uniform vec3 uNormal;
|
|
946
|
+
uniform float uNormalThreshold;
|
|
947
|
+
uniform float uTime;
|
|
948
|
+
uniform float uCooldownRatio;
|
|
949
|
+
uniform float uSize;
|
|
950
|
+
uniform float uAlpha;
|
|
951
|
+
uniform float uOffset;
|
|
952
|
+
uniform float uSurfaceDistance;
|
|
953
|
+
uniform float uNoiseScale;
|
|
954
|
+
uniform float uScaleNoise;
|
|
955
|
+
uniform float uOffsetNoise;
|
|
956
|
+
uniform float uLifetimeNoise;
|
|
957
|
+
uniform float uMixColor;
|
|
958
|
+
uniform float uMixAlpha;
|
|
959
|
+
uniform float uMixOffset;
|
|
960
|
+
uniform float uMixSize;
|
|
961
|
+
uniform float uMixSurfaceDistance;
|
|
962
|
+
uniform float uMixNoise;
|
|
963
|
+
uniform sampler2D uInfoTexture;
|
|
964
|
+
|
|
965
|
+
varying vec4 vColor;
|
|
966
|
+
|
|
967
|
+
void main() {
|
|
968
|
+
float dotNormal = dot(normal, uNormal) * 0.5 + 0.5;
|
|
969
|
+
float normalP = smoothstep(uNormalThreshold, 1., dotNormal);
|
|
970
|
+
float lifetimeNoise = uLifetimeNoise * mix(normalP, 1.0, uMixNoise);
|
|
971
|
+
|
|
972
|
+
float t = uTime + position.x * 1. * uNoiseScale + position.y * 10. * uNoiseScale +
|
|
973
|
+
position.z * 7.3 * uNoiseScale + sin(lifetimeNoise * (position.x + 13. * position.y)) * lifetimeNoise;
|
|
974
|
+
|
|
975
|
+
float lifetimeP = max(-0.0001, mix(-uCooldownRatio, 1. + cos(t) * lifetimeNoise, fract(t)));
|
|
976
|
+
float surfaceDistance = texture2D(uInfoTexture, vec2(
|
|
977
|
+
mix(normalP, lifetimeP, uMixSurfaceDistance),
|
|
978
|
+
${s.sequenceSurfaceDistance})).x * uSurfaceDistance;
|
|
979
|
+
|
|
980
|
+
vec4 modelPosition = modelMatrix * (vec4(position, 1.0) + vec4(normal * surfaceDistance, 0.0));
|
|
981
|
+
vec3 noise = texture2D(uInfoTexture, vec2(
|
|
982
|
+
mix(normalP, lifetimeP, uMixNoise),
|
|
983
|
+
${s.sequenceNoise})).xyz;
|
|
984
|
+
vec3 offset = uOffset * (texture2D(uInfoTexture, vec2(
|
|
985
|
+
mix(normalP, lifetimeP, uMixOffset),
|
|
986
|
+
${s.sequenceOffset})).xyz * 2.0 - vec3(1.0, 1.0, 1.0));
|
|
987
|
+
modelPosition.x += cos(t * uNoiseScale * 10.0) * 0.2 * uOffsetNoise * noise.x + offset.x;
|
|
988
|
+
modelPosition.y += sin(t * uNoiseScale * 10.0) * 0.2 * uOffsetNoise * noise.y + offset.y;
|
|
989
|
+
modelPosition.z += cos(t * uNoiseScale * 10.0) * 0.2 * uOffsetNoise * noise.z + offset.z;
|
|
990
|
+
|
|
991
|
+
vec4 viewPosition = viewMatrix * modelPosition;
|
|
992
|
+
vec4 projectionPostion = projectionMatrix * viewPosition;
|
|
993
|
+
gl_Position = projectionPostion;
|
|
994
|
+
|
|
995
|
+
gl_PointSize = 2.
|
|
996
|
+
* texture2D(uInfoTexture, vec2(mix(normalP, lifetimeP, uMixSize), ${s.sequenceSize})).x
|
|
997
|
+
* mix(1., abs(sin(t * uNoiseScale + position.x * 13.9 + position.y * 73.1)), uScaleNoise)
|
|
998
|
+
* uSize * (100.0 / -viewPosition.z) * uPixelRatio;
|
|
999
|
+
|
|
1000
|
+
if (gl_PointSize < 0.6 || lifetimeP < 0.0) { gl_Position = vec4(2, 2, 2, 1); }
|
|
1001
|
+
|
|
1002
|
+
vColor = texture2D(uInfoTexture, vec2(mix(normalP, lifetimeP, uMixColor), ${s.sequenceColor}))
|
|
1003
|
+
* texture2D(uInfoTexture, vec2(mix(normalP, lifetimeP, uMixAlpha), ${s.sequenceAlpha})).x * uAlpha;
|
|
1004
|
+
}`,fragmentShader:`
|
|
1005
|
+
varying vec4 vColor;
|
|
1006
|
+
|
|
1007
|
+
uniform sampler2D uMap;
|
|
1008
|
+
uniform sampler2D uInfoTexture;
|
|
1009
|
+
|
|
1010
|
+
void main() {
|
|
1011
|
+
gl_FragColor = vColor * texture2D(uMap, gl_PointCoord);
|
|
1012
|
+
#include <tonemapping_fragment>
|
|
1013
|
+
#include <${t>=154?"colorspace_fragment":"encodings_fragment"}>
|
|
1014
|
+
}`},l=new c.ShaderMaterial(a),f=new c.Points(void 0,l),u=l.uniforms,d={immediate:!0};[[u.uPixelRatio,ae.useTresContext().sizes.aspectRatio],[u.uSize,n.size],[u.uNormalThreshold,n.normalThreshold],[u.uAlpha,n.alpha],[u.uOffset,n.offset],[u.uOffsetNoise,n.offsetNoise],[u.uMixColor,n.mixColor],[u.uMixAlpha,n.mixAlpha],[u.uMixOffset,n.mixOffset],[u.uMixSize,n.mixSize],[u.uMixSurfaceDistance,n.mixSurfaceDistance],[u.uMixNoise,n.mixNoise],[u.uInfoTexture,r]].forEach(([I,S])=>h.watch(S,()=>{I.value=S.value},d)),h.watch([n.noiseScale,n.lifetimeSec],()=>{u.uNoiseScale.value=n.noiseScale.value*n.lifetimeSec.value},d),h.watch([n.lifetimeSec,n.cooldownSec],()=>{u.uCooldownRatio.value=n.cooldownSec.value/n.lifetimeSec.value},d),h.watch(n.map,()=>{typeof n.map.value=="string"?ae.useTexture([n.map.value]).then(I=>l.uniforms.uMap.value=I):l.uniforms.uMap.value=n.map.value});const y=new c.Quaternion,b=new c.Vector3;ae.useRenderLoop().onLoop(({elapsed:I})=>{f.getWorldQuaternion(y),b.copy(e.directionalLight?e.directionalLight.position:c.Object3D.DEFAULT_UP).normalize(),b.applyQuaternion(y.invert()),l.uniforms.uNormal.value=b,l.uniforms.uTime.value=I/(e.cooldownSec+e.lifetimeSec)});function A(I){return I&&"isObject3D"in I}function _(I){return I&&"isBufferGeometry"in I}h.onMounted(()=>{e.geometry?_(e.geometry)?f.geometry.copy(e.geometry):A(e.geometry)&&"geometry"in e.geometry&&_(e.geometry.geometry)&&f.geometry.copy(e.geometry.geometry):A(f.parent)&&"geometry"in f.parent&&_(f.parent.geometry)?f.geometry.copy(f.parent.geometry):f.geometry=new c.IcosahedronGeometry(1,16),typeof e.map=="string"&&ae.useTexture([e.map]).then(I=>l.uniforms.uMap.value=I)}),h.onUnmounted(()=>{var I;(I=l.uniforms.uMap.value)==null||I.dispose(),r.value.dispose(),l.dispose()});const L=h.shallowRef();return(I,S)=>(h.openBlock(),h.createElementBlock("primitive",{ref_key:"sparkleRef",ref:L,object:h.unref(f)},null,8,yu))}}),vu=["position","a-scale"],wu=["size","size-attenuation","transparent","alpha-test","alpha-map"],xu=h.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(o,{expose:e}){const t=o,n=h.ref(),i=h.ref(),{radius:r,depth:s,count:a,size:l,sizeAttenuation:f,transparent:u,alphaMap:d,alphaTest:m}=h.toRefs(t),y=()=>{let A=r.value+s.value;const _=h.computed(()=>s.value/a.value),L=[],I=Array.from({length:a.value},()=>(.5+.5*Math.random())*4),S=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<a.value;g++)A-=_.value*Math.random(),L.push(...S(A));n.value=new Float32Array(L),i.value=new Float32Array(I)};h.watchEffect(()=>{y()});const b=h.shallowRef();return e({value:b}),(A,_)=>(h.openBlock(),h.createElementBlock("TresPoints",{ref_key:"starsRef",ref:b},[h.createElementVNode("TresBufferGeometry",{position:[n.value,3],"a-scale":[i.value,1]},null,8,vu),h.createElementVNode("TresPointsMaterial",{size:h.unref(l),"size-attenuation":h.unref(f),transparent:h.unref(u),"alpha-test":h.unref(m),"alpha-map":h.unref(d)},null,8,wu)],512))}});let it;const bu=(o="body")=>{it||(it=new xs.Pane({container:document.querySelector(o)}),it.element.style.position="absolute",it.element.style.top="1rem",it.element.style.right="1rem",it.element.style.zIndex="9999");const{logWarning:e}=Kn();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(){it&&it.dispose()}return h.onMounted(()=>{const{resume:n}=ae.useRenderLoop();n()}),h.onUnmounted(()=>{t()}),{pane:it,disposeTweakPane:t}};var fs={exports:{}};(function(o,e){(function(t,n){o.exports=n()})(zl,function(){var t=function(){function n(y){return s.appendChild(y.dom),y}function i(y){for(var b=0;b<s.children.length;b++)s.children[b].style.display=b===y?"block":"none";r=y}var r=0,s=document.createElement("div");s.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",s.addEventListener("click",function(y){y.preventDefault(),i(++r%s.children.length)},!1);var a=(performance||Date).now(),l=a,f=0,u=n(new t.Panel("FPS","#0ff","#002")),d=n(new t.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var m=n(new t.Panel("MB","#f08","#201"));return i(0),{REVISION:16,dom:s,addPanel:n,showPanel:i,begin:function(){a=(performance||Date).now()},end:function(){f++;var y=(performance||Date).now();if(d.update(y-a,200),y>l+1e3&&(u.update(1e3*f/(y-l),100),l=y,f=0,m)){var b=performance.memory;m.update(b.usedJSHeapSize/1048576,b.jsHeapSizeLimit/1048576)}return y},update:function(){a=this.end()},domElement:s,setMode:i}};return t.Panel=function(n,i,r){var s=1/0,a=0,l=Math.round,f=l(window.devicePixelRatio||1),u=80*f,d=48*f,m=3*f,y=2*f,b=3*f,A=15*f,_=74*f,L=30*f,I=document.createElement("canvas");I.width=u,I.height=d,I.style.cssText="width:80px;height:48px";var S=I.getContext("2d");return S.font="bold "+9*f+"px Helvetica,Arial,sans-serif",S.textBaseline="top",S.fillStyle=r,S.fillRect(0,0,u,d),S.fillStyle=i,S.fillText(n,m,y),S.fillRect(b,A,_,L),S.fillStyle=r,S.globalAlpha=.9,S.fillRect(b,A,_,L),{dom:I,update:function(g,O){s=Math.min(s,g),a=Math.max(a,g),S.fillStyle=r,S.globalAlpha=1,S.fillRect(0,0,u,A),S.fillStyle=i,S.fillText(l(g)+" "+n+" ("+l(s)+"-"+l(a)+")",m,y),S.drawImage(I,b+f,A,_-f,L,b,A,_-f,L),S.fillRect(b+_-f,A,f,L),S.fillStyle=r,S.globalAlpha=.9,S.fillRect(b+_-f,A,f,l((1-g/O)*L))}}},t})})(fs);var Mu=fs.exports;const Au=Ht(Mu),Su=h.defineComponent({name:"Stats",props:{showPanel:{type:Number,default:0}},setup(o,{expose:e}){const t=new Au;e({stats:t});const n=document.body;t.showPanel(o.showPanel||0),n==null||n.appendChild(t.dom);const{onBeforeLoop:i,onAfterLoop:r,resume:s}=ae.useRenderLoop();return s(),i(()=>t.begin()),r(()=>t.end()),h.onUnmounted(()=>{n==null||n.removeChild(t.dom)}),null}});class Pu{constructor(e,t,n){this.name=e,this.fg=t,this.bg=n,this.PR=Math.round(window.devicePixelRatio||1),this.WIDTH=90*this.PR,this.HEIGHT=48*this.PR,this.TEXT_X=3*this.PR,this.TEXT_Y=2*this.PR,this.GRAPH_X=3*this.PR,this.GRAPH_Y=15*this.PR,this.GRAPH_WIDTH=84*this.PR,this.GRAPH_HEIGHT=30*this.PR,this.canvas=document.createElement("canvas"),this.canvas.width=90*this.PR,this.canvas.height=48*this.PR,this.canvas.style.width="90px",this.canvas.style.position="absolute",this.canvas.style.height="48px",this.canvas.style.cssText="width:90px;height:48px",this.context=this.canvas.getContext("2d"),this.context&&(this.context.font="bold "+9*this.PR+"px Helvetica,Arial,sans-serif",this.context.textBaseline="top",this.context.fillStyle=this.bg,this.context.fillRect(0,0,this.WIDTH,this.HEIGHT),this.context.fillStyle=this.fg,this.context.fillText(this.name,this.TEXT_X,this.TEXT_Y),this.context.fillRect(this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH,this.GRAPH_HEIGHT),this.context.fillStyle=this.bg,this.context.globalAlpha=.9,this.context.fillRect(this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH,this.GRAPH_HEIGHT))}update(e,t,n,i,r=0){let s=1/0,a=0;this.context&&(s=Math.min(s,e),a=Math.max(n,e),i=Math.max(i,t),this.context.fillStyle=this.bg,this.context.globalAlpha=1,this.context.fillRect(0,0,this.WIDTH,this.GRAPH_Y),this.context.fillStyle=this.fg,this.context.fillText(e.toFixed(r)+" "+this.name+" ("+s.toFixed(r)+"-"+parseFloat(a.toFixed(r))+")",this.TEXT_X,this.TEXT_Y),this.context.drawImage(this.canvas,this.GRAPH_X+this.PR,this.GRAPH_Y,this.GRAPH_WIDTH-this.PR,this.GRAPH_HEIGHT,this.GRAPH_X,this.GRAPH_Y,this.GRAPH_WIDTH-this.PR,this.GRAPH_HEIGHT),this.context.fillRect(this.GRAPH_X+this.GRAPH_WIDTH-this.PR,this.GRAPH_Y,this.PR,this.GRAPH_HEIGHT),this.context.fillStyle=this.bg,this.context.globalAlpha=.9,this.context.fillRect(this.GRAPH_X+this.GRAPH_WIDTH-this.PR,this.GRAPH_Y,this.PR,(1-t/i)*this.GRAPH_HEIGHT))}}const ds=class On{constructor({logsPerSecond:e=20,samplesLog:t=100,samplesGraph:n=10,precision:i=2,minimal:r=!1,horizontal:s=!0,mode:a=0}={}){this.mode=a,this.horizontal=s,this.container=document.createElement("div"),this.container.style.cssText="position:fixed;top:0;left:0;opacity:0.9;z-index:10000;",r&&(this.container.style.cssText+="cursor:pointer"),this.gl=null,this.query=null,this.minimal=r,this.beginTime=(performance||Date).now(),this.prevTime=this.beginTime,this.prevCpuTime=this.beginTime,this.frames=0,this.averageCpu={logs:[],graph:[]},this.averageGpu={logs:[],graph:[]},this.queryCreated=!1,this.fpsPanel=this.addPanel(new On.Panel("FPS","#0ff","#002"),0),this.msPanel=this.addPanel(new On.Panel("CPU","#0f0","#020"),1),this.gpuPanel=null,this.samplesLog=t,this.samplesGraph=n,this.precision=i,this.logsPerSecond=e,this.minimal?(this.container.addEventListener("click",l=>{l.preventDefault(),this.showPanel(++this.mode%this.container.children.length)},!1),this.mode=a,this.showPanel(this.mode)):window.addEventListener("resize",()=>{this.resizePanel(this.fpsPanel,0),this.resizePanel(this.msPanel,1),this.gpuPanel&&this.resizePanel(this.gpuPanel,2)})}resizePanel(e,t){e.canvas.style.position="absolute",this.minimal?e.canvas.style.display="none":(e.canvas.style.display="block",this.horizontal?(e.canvas.style.top="0px",e.canvas.style.left=t*e.WIDTH/e.PR+"px"):(e.canvas.style.left="0px",e.canvas.style.top=t*e.HEIGHT/e.PR+"px"))}addPanel(e,t){return e.canvas&&(this.container.appendChild(e.canvas),this.resizePanel(e,t)),e}showPanel(e){for(let t=0;t<this.container.children.length;t++){const n=this.container.children[t];n.style.display=t===e?"block":"none"}this.mode=e}init(e){if(!e){console.error('Stats: The "canvas" parameter is undefined.');return}if(e instanceof WebGL2RenderingContext)this.gl=e;else if(e instanceof HTMLCanvasElement||e instanceof OffscreenCanvas){if(this.gl=e.getContext("webgl2"),!this.gl){console.error("Stats: Unable to obtain WebGL2 context.");return}}else{console.error("Stats: Invalid input type. Expected WebGL2RenderingContext, HTMLCanvasElement, or OffscreenCanvas.");return}this.ext=this.gl.getExtension("EXT_disjoint_timer_query_webgl2"),this.ext&&(this.gpuPanel=this.addPanel(new On.Panel("GPU","#ff0","#220"),2))}begin(){if(this.beginProfiling("cpu-started"),!(!this.gl||!this.ext)){if(this.query){const e=this.gl.getQueryParameter(this.query,this.gl.QUERY_RESULT_AVAILABLE);if(this.disjoint=this.gl.getParameter(this.ext.GPU_DISJOINT_EXT),e&&!this.disjoint){this.ns=this.gl.getQueryParameter(this.query,this.gl.QUERY_RESULT);const t=this.ns*1e-6;(e||this.disjoint)&&(this.gl.deleteQuery(this.query),this.query=null),e&&this.addToAverage(t,this.averageGpu)}}this.query||(this.queryCreated=!0,this.query=this.gl.createQuery(),this.query&&this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,this.query))}}end(){this.beginTime=this.endInternal(),this.endProfiling("cpu-started","cpu-finished","cpu-duration",this.averageCpu),!(!this.gl||!this.ext)&&this.queryCreated&&this.gl.getQuery(this.ext.TIME_ELAPSED_EXT,this.gl.CURRENT_QUERY)&&this.gl.endQuery(this.ext.TIME_ELAPSED_EXT)}endInternal(){this.frames++;const e=(performance||Date).now();if(e>=this.prevCpuTime+1e3/this.logsPerSecond&&(this.updatePanel(this.msPanel,this.averageCpu),this.updatePanel(this.gpuPanel,this.averageGpu),this.prevCpuTime=e),e>=this.prevTime+1e3){const t=this.frames*1e3/(e-this.prevTime);this.fpsPanel.update(t,t,100,100,0),this.prevTime=e,this.frames=0}return e}addToAverage(e,t){t.logs.push(e),t.logs.length>this.samplesLog&&t.logs.shift(),t.graph.push(e),t.graph.length>this.samplesGraph&&t.graph.shift()}beginProfiling(e){window.performance&&window.performance.mark(e)}endProfiling(e,t,n,i){if(window.performance&&t){window.performance.mark(t);const r=performance.measure(n,e,t);this.addToAverage(r.duration,i)}}updatePanel(e,t){if(t.logs.length>0){let n=0,i=.01;for(let a=0;a<t.logs.length;a++)n+=t.logs[a],t.logs[a]>i&&(i=t.logs[a]);let r=0,s=.01;for(let a=0;a<t.graph.length;a++)r+=t.graph[a],t.graph[a]>s&&(s=t.graph[a]);e&&e.update(n/Math.min(t.logs.length,this.samplesLog),r/Math.min(t.graph.length,this.samplesGraph),i,s,this.precision)}}};ds.Panel=Pu;let Cu=ds;const Lu=h.defineComponent({name:"StatsGl",props:["logsPerSecond","samplesLog","samplesGraph","precision","horizontal","minimal","mode"],async setup(o,{expose:e}){const t=new Cu({logsPerSecond:o.logsPerSecond,samplesLog:o.samplesLog,samplesGraph:o.samplesGraph,precision:o.precision,horizontal:o.horizontal,minimal:o.minimal,mode:o.mode});e({statsGl:t});const n=document.body;n==null||n.appendChild(t.dom);const{renderer:i}=ae.useTresContext(),{onAfterLoop:r,resume:s}=ae.useRenderLoop();return t.init(i.value),s(),r(()=>{t.update()}),h.onUnmounted(()=>{n==null||n.removeChild(t.dom)}),null}});var Tu=`#include <common>
|
|
741
1015
|
|
|
742
1016
|
void main() {
|
|
743
1017
|
vec2 center = vec2(0., 1.);
|
|
@@ -762,6 +1036,6 @@ void main() {
|
|
|
762
1036
|
mvPosition.xy += rotatedPosition;
|
|
763
1037
|
|
|
764
1038
|
gl_Position = projectionMatrix * mvPosition;
|
|
765
|
-
}`,
|
|
1039
|
+
}`,Ou=`void main() {
|
|
766
1040
|
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
767
|
-
}`;const Gt=new c.Vector3(0,0,0),Jn=new c.Vector3(0,0,0),dc=new c.Vector3(0,0,0);function wi(a,e,t){const n=Gt.setFromMatrixPosition(a.matrixWorld);n.project(e);const s=t.width/2,i=t.height/2;return[(Number.isNaN(n.x)?0:n.x)*s+s,-(n.y*i)+i]}function fc(a,e){const t=Gt.setFromMatrixPosition(a.matrixWorld),n=Jn.setFromMatrixPosition(e.matrixWorld),s=t.sub(n),i=e.getWorldDirection(dc);return s.angleTo(i)>Math.PI/2}function pc(a,e,t,n){const s=Gt.setFromMatrixPosition(a.matrixWorld),i=s.clone();i.project(e),t.setFromCamera(new c.Vector2(i.x,i.y),e);const o=t.intersectObjects(n,!0);if(o.length>0){const r=o[0].distance;return s.distanceTo(t.ray.origin)<r}return!0}function mc(a,e){if(e instanceof c.OrthographicCamera)return e.zoom;if(e instanceof c.PerspectiveCamera){const t=Gt.setFromMatrixPosition(a.matrixWorld),n=Jn.setFromMatrixPosition(e.matrixWorld),s=e.fov*Math.PI/180,i=t.distanceTo(n);return 1/(2*Math.tan(s/2)*i)}else return 1}function gc(a,e,t){if(e instanceof c.PerspectiveCamera||e instanceof c.OrthographicCamera){const n=Gt.setFromMatrixPosition(a.matrixWorld),s=Jn.setFromMatrixPosition(e.matrixWorld),i=n.distanceTo(s),o=(t[1]-t[0])/(e.far-e.near),r=t[1]-o*e.far;return Math.round(o*i+r)}}const Hn=a=>Math.abs(a)<1e-10?0:a;function bi(a,e,t=""){let n="matrix3d(";for(let s=0;s!==16;s++)n+=Hn(e[s]*a.elements[s])+(s!==15?",":")");return t+n}const yc=(a=>e=>bi(e,a))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),_c=(a=>(e,t)=>bi(e,a(t),"translate(-50%,-50%)"))(a=>[1/a,1/a,1/a,1,-1/a,-1/a,-1/a,-1,1/a,1/a,1/a,1,1,1,1,1]),vc=["geometry","material"],xc=h.defineComponent({__name:"HTML",props:{geometry:{default:new c.PlaneGeometry},material:{},as:{default:"div"},transform:{type:Boolean,default:!1},portal:{},wrapperClass:{},eps:{default:1e-4},distanceFactor:{},fullscreen:{type:Boolean},center:{type:Boolean},pointerEvents:{default:"auto"},sprite:{type:Boolean,default:!1},zIndexRange:{default:()=>[16777271,0]},occlude:{type:[Array,Boolean,String]}},emits:["onOcclude"],setup(a,{emit:e}){const t=a,n=h.useAttrs(),s=h.useSlots(),i=h.ref(),o=h.ref(),{geometry:r,material:l,as:f,transform:d,portal:u,wrapperClass:p,eps:g,distanceFactor:x,fullscreen:w,center:_,pointerEvents:M,sprite:L,occlude:v,zIndexRange:y}=h.toRefs(t),{renderer:A,scene:S,camera:b,raycaster:P,sizes:O}=ne.useTresContext(),k=h.computed(()=>document.createElement(f.value)),V=h.ref([0,0]),R=h.ref(0),X=h.ref(),K=h.computed(()=>d.value?{position:"absolute",top:0,left:0,width:`${O.width.value}px`,height:`${O.height.value}px`,transformStyle:"preserve-3d",pointerEvents:"none",zIndex:2,willChange:"transform"}:{position:"absolute",transform:_.value?"translate3d(-50%,-50%,0)":"none",...w.value&&{top:-O.height.value/2,left:-O.width.value/2,width:`${O.width.value}px`,height:`${O.height.value}px`},zIndex:2,...n.style,willChange:"transform"}),H=h.computed(()=>({position:"absolute",pointerEvents:M.value})),he=h.ref(null),J=h.ref(!1),G=h.computed(()=>(v==null?void 0:v.value)&&(v==null?void 0:v.value)!=="blending"||Array.isArray(v==null?void 0:v.value)&&(v==null?void 0:v.value.length)&&h.isRef(v.value[0]));h.watch(()=>v,T=>{T&&T==="blending"?(k.value.style.zIndex=`${Math.floor(y.value[0]/2)}`,k.value.style.position="absolute",k.value.style.pointerEvents="none"):(k.value.style.zIndex=null,k.value.style.position=null,k.value.style.pointerEvents=null)}),h.watch(()=>{var T;return[i.value,A.value,O.width.value,O.height.value,(T=s.default)==null?void 0:T.call(s)]},([T,m])=>{var F,j,D,E,ie,Y;if(T&&m){const $=(u==null?void 0:u.value)||m.domElement;if((F=S.value)==null||F.updateMatrixWorld(),d.value)k.value.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const Z=wi(T,b.value,{width:O.width.value,height:O.height.value});k.value.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${Z[0]}px,${Z[1]}px,0);transform-origin:0 0;`}$&&((j=$.parentNode)==null||j.appendChild(k.value)),d.value?X.value=h.createVNode("div",{id:"outer",style:K.value},[h.createVNode("div",{id:"inner",style:H.value},[h.createVNode("div",{key:(D=o.value)==null?void 0:D.uuid,id:S==null?void 0:S.value.uuid,class:n.class,style:n.style},(E=s.default)==null?void 0:E.call(s))])]):X.value=h.createVNode("div",{key:(ie=o.value)==null?void 0:ie.uuid,id:S==null?void 0:S.value.uuid,style:K.value},(Y=s.default)==null?void 0:Y.call(s)),h.render(X.value,k.value)}}),h.watchEffect(()=>{p!=null&&p.value&&(k.value.className=p.value)});const oe=h.ref(!0),{onLoop:se}=ne.useRenderLoop();se(()=>{var T,m,F,j,D,E,ie;if(i.value&&b.value&&A.value){(T=b.value)==null||T.updateMatrixWorld(),i.value.updateWorldMatrix(!0,!1);const Y=d.value?V.value:wi(i.value,b.value,{width:O.width.value||0,height:O.height.value||0});if(d.value||Math.abs(R.value-b.value.zoom)>g.value||Math.abs(V.value[0]-Y[0])>g.value||Math.abs(V.value[1]-Y[1])>g.value){const $=fc(i.value,b.value);let Z=!1;G.value&&(Array.isArray(v==null?void 0:v.value)?Z=v==null?void 0:v.value:(v==null?void 0:v.value)!=="blending"&&(Z=[S.value]));const fe=oe.value;if(Z){const I=pc(i.value,b.value,P.value,Z);oe.value=I&&!$}else oe.value=!$;fe!==oe.value&&(e("onOcclude",!oe.value),k.value.style.display=oe.value?"block":"none");const Q=Math.floor(y.value[0]/2),ee=v!=null&&v.value?G.value?[y.value[0],Q]:[Q-1,0]:y.value;if(k.value.style.zIndex=`${gc(i.value,b.value,ee)}`,k.value.style.willChange="transform",d.value){const[I,C]=[O.width.value/2,O.height.value/2],te=b.value.projectionMatrix.elements[5]*C,{isOrthographicCamera:pe,top:we,left:Pe,bottom:ke,right:Xe}=b.value,Pt=yc(b.value.matrixWorldInverse),jt=pe?`scale(${te})translate(${Hn(-(Xe+Pe)/2)}px,${Hn((we+ke)/2)}px)`:`translateZ(${te}px)`;let Ge=i.value.matrixWorld;L.value&&(Ge=b.value.matrixWorldInverse.clone().transpose().copyPosition(Ge).scale(i.value.scale),Ge.elements[3]=Ge.elements[7]=Ge.elements[11]=0,Ge.elements[15]=1),k.value.style.width=`${O.width.value}px`,k.value.style.height=`${O.height.value}px`,k.value.style.perspective=pe?"":`${te}px`,(m=X.value)!=null&&m.el&&((F=X.value)!=null&&F.children)&&(X.value.el.style.willChange="transform",X.value.el.style.transform=`${jt}${Pt}translate(${I}px,${C}px)`,X.value.children[0].willChange="transform",X.value.children[0].el.style.transform=_c(Ge,1/(((x==null?void 0:x.value)||10)/400)))}else{const I=(x==null?void 0:x.value)===void 0?1:mc(i.value,b.value)*(x==null?void 0:x.value);k.value.style.transform=`translate3d(${Y[0]}px,${Y[1]}px,0) scale(${I})`}}V.value=Y,R.value=b.value.zoom}if(!G.value&&o.value&&!J.value)if(d.value){if((j=X.value)!=null&&j.el&&((D=X.value)!=null&&D.children)){const Y=(E=X.value)==null?void 0:E.children[0];if(Y!=null&&Y.clientWidth&&(Y!=null&&Y.clientHeight)){const{isOrthographicCamera:$}=b.value;if($||r)n.scale&&(Array.isArray(n.scale)?n.scale instanceof c.Vector3?o.value.scale.copy(n.scale.clone().divideScalar(1)):o.value.scale.set(1/n.scale[0],1/n.scale[1],1/n.scale[2]):o.value.scale.setScalar(1/n.scale));else{const Z=((x==null?void 0:x.value)||10)/400,fe=Y.clientWidth*Z,Q=Y.clientHeight*Z;o.value.scale.set(fe,Q,1)}J.value=!0}}}else{const Y=k.value.children[0];if(Y!=null&&Y.clientWidth&&(Y!=null&&Y.clientHeight)){const Z=Y.clientWidth*1,fe=Y.clientHeight*1;o.value.scale.set(Z,fe,1),J.value=!0}he.value.lookAt((ie=b.value)==null?void 0:ie.position)}});const ce=h.computed(()=>({vertexShader:d.value?void 0:hc,fragmentShader:uc})),U=h.computed(()=>{const T=ce.value;return l.value||new c.ShaderMaterial({vertexShader:T.vertexShader,fragmentShader:T.fragmentShader,side:c.DoubleSide})});return h.onUnmounted(()=>{U.value&&U.value.dispose()}),(T,m)=>(h.openBlock(),h.createElementBlock("TresGroup",{ref_key:"groupRef",ref:i},[h.unref(v)&&!G.value?(h.openBlock(),h.createElementBlock("TresMesh",{key:0,ref_key:"meshRef",ref:o,geometry:h.unref(r),material:U.value},null,8,vc)):h.createCommentVNode("",!0)],512))}}),wc={mounted:(a,e)=>{if(e.arg){console.log(`v-log:${e.arg}`,a[e.arg]);return}console.log("v-log",a)}},{logWarning:Ai}=ne.useLogger(),bc={mounted:a=>{if(!a.isLight){Ai(`${a.type} is not a light`);return}hn=Ac[a.type],a.parent.add(new hn(a))},updated:a=>{Rt=a.parent.children.find(e=>e instanceof hn),Rt.update()},unmounted:a=>{if(!a.isLight){Ai(`${a.type} is not a light`);return}Rt=a.parent.children.find(e=>e instanceof hn),Rt.dispose(),a.parent.remove(Rt)}};let hn,Rt;const Ac={DirectionalLight:c.DirectionalLightHelper,PointLight:c.PointLightHelper,SpotLight:c.SpotLightHelper,HemisphereLight:c.HemisphereLightHelper};function Mc(a,e){const t={};for(const n of e)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n]);return t}function Sc(a,e){const t=`set${e[0].toUpperCase()}${e.slice(1)}`;return a[t]!==void 0}function $n(a){var t,n;let e=a.value;return a.value&&((n=(t=a.value)==null?void 0:t.value)!=null&&n.isMesh)&&(e=a.value.value.position),Array.isArray(a.value)&&(e=new c.Vector3(...e)),e}const{logWarning:Pc}=ne.useLogger(),Cc={updated:(a,e)=>{const t=$n(e);if(!t){Pc(`v-always-look-at: problem with binding value: ${e.value}`);return}const{onLoop:n}=ne.useRenderLoop();n(()=>{a.lookAt(t)})}},{logWarning:Lc}=ne.useLogger(),Tc={updated:(a,e)=>{var s;const t=$n(e);if(!t){Lc(`v-distance-to: problem with binding value: ${e.value}`);return}He&&(He.dispose(),a.parent.remove(He));const n=t.clone().sub(a.position);n.normalize(),He=new c.ArrowHelper(n,a.position,a.position.distanceTo(t)/1.5,16776960),a.parent.add(He),console.table([["Distance:",a.position.distanceTo(t)],[`origin: ${a.name||a.type}`,`x:${a.position.x}, y:${a.position.y}, z:${(s=a.position)==null?void 0:s.z}`],[`Destiny: ${a.name||a.type}`,`x:${t.x}, y:${t.y}, z:${t==null?void 0:t.z}`]])},unmounted:a=>{He==null||He.dispose(),a.parent.remove(He)}};let He=null;q.Backdrop=Bl,q.Box=Ga,q.CameraControls=Ca,q.CatmullRomCurve3=Wa,q.Circle=Ka,q.Cone=Ha,q.ContactShadows=Rl,q.Dodecahedron=tl,q.Environment=Dl,q.FBXModel=ia,q.Fbo=Hr,q.GLTFModel=na,q.GlobalAudio=Fr,q.Html=xc,q.Icosahedron=il,q.KeyboardControls=pa,q.Lensflare=Jr,q.Levioso=mr,q.Line2=_i,q.MapControls=xa,q.MeshGlassMaterial=Va,q.MeshWobbleMaterial=Oa,q.MouseParallax=kr,q.Octahedron=al,q.OrbitControls=ha,q.Plane=ul,q.PointerLockControls=_a,q.Precipitation=Zl,q.Ring=pl,q.SVG=ra,q.ScrollControls=wa,q.Sky=ec,q.Smoke=Hl,q.Sphere=yl,q.Stars=Xl,q.Stats=rc,q.StatsGl=cc,q.Tetrahedron=wl,q.Text3D=fr,q.Torus=Ml,q.TorusKnot=Cl,q.TransformControls=ga,q.Tube=Ol,q.extractBindingPosition=$n,q.hasSetter=Sc,q.pick=Mc,q.useAnimations=pr,q.useEnvironment=Xs,q.useFBO=Es,q.useFBX=Ws,q.useGLTF=Ys,q.useProgress=aa,q.useTweakPane=tc,q.useVideoTexture=la,q.vAlwaysLookAt=Cc,q.vDistanceTo=Tc,q.vLightHelper=bc,q.vLog=wc,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})});
|
|
1041
|
+
}`;const tn=new c.Vector3(0,0,0),bi=new c.Vector3(0,0,0),Iu=new c.Vector3(0,0,0);function ps(o,e,t){const n=tn.setFromMatrixPosition(o.matrixWorld);n.project(e);const i=t.width/2,r=t.height/2;return[(Number.isNaN(n.x)?0:n.x)*i+i,-(n.y*r)+r]}function Du(o,e){const t=tn.setFromMatrixPosition(o.matrixWorld),n=bi.setFromMatrixPosition(e.matrixWorld),i=t.sub(n),r=e.getWorldDirection(Iu);return i.angleTo(r)>Math.PI/2}function ku(o,e,t,n){const i=tn.setFromMatrixPosition(o.matrixWorld),r=i.clone();r.project(e),t.setFromCamera(new c.Vector2(r.x,r.y),e);const s=t.intersectObjects(n,!0);if(s.length>0){const a=s[0].distance;return i.distanceTo(t.ray.origin)<a}return!0}function Fu(o,e){if(e instanceof c.OrthographicCamera)return e.zoom;if(e instanceof c.PerspectiveCamera){const t=tn.setFromMatrixPosition(o.matrixWorld),n=bi.setFromMatrixPosition(e.matrixWorld),i=e.fov*Math.PI/180,r=t.distanceTo(n);return 1/(2*Math.tan(i/2)*r)}else return 1}function Bu(o,e,t){if(e instanceof c.PerspectiveCamera||e instanceof c.OrthographicCamera){const n=tn.setFromMatrixPosition(o.matrixWorld),i=bi.setFromMatrixPosition(e.matrixWorld),r=n.distanceTo(i),s=(t[1]-t[0])/(e.far-e.near),a=t[1]-s*e.far;return Math.round(s*r+a)}}const Mi=o=>Math.abs(o)<1e-10?0:o;function ms(o,e,t=""){let n="matrix3d(";for(let i=0;i!==16;i++)n+=Mi(e[i]*o.elements[i])+(i!==15?",":")");return t+n}const Uu=(o=>e=>ms(e,o))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),Nu=(o=>(e,t)=>ms(e,o(t),"translate(-50%,-50%)"))(o=>[1/o,1/o,1/o,1,-1/o,-1/o,-1/o,-1,1/o,1/o,1/o,1,1,1,1,1]),Vu=["geometry","material"],zu=h.defineComponent({__name:"HTML",props:{geometry:{default:new c.PlaneGeometry},material:{},as:{default:"div"},transform:{type:Boolean,default:!1},portal:{},wrapperClass:{},eps:{default:1e-4},distanceFactor:{},fullscreen:{type:Boolean},center:{type:Boolean},pointerEvents:{default:"auto"},sprite:{type:Boolean,default:!1},zIndexRange:{default:()=>[16777271,0]},occlude:{type:[Array,Boolean,String]}},emits:["onOcclude"],setup(o,{emit:e}){const t=o,n=e,i=h.useAttrs(),r=h.useSlots(),s=h.ref(),a=h.ref(),{geometry:l,material:f,as:u,transform:d,portal:m,wrapperClass:y,eps:b,distanceFactor:A,fullscreen:_,center:L,pointerEvents:I,sprite:S,occlude:g,zIndexRange:O}=h.toRefs(t),{renderer:x,scene:C,camera:p,raycaster:w,sizes:v}=ae.useTresContext(),T=h.computed(()=>document.createElement(u.value)),k=h.ref([0,0]),Q=h.ref(0),Y=h.ref(),$=h.computed(()=>d.value?{position:"absolute",top:0,left:0,width:`${v.width.value}px`,height:`${v.height.value}px`,transformStyle:"preserve-3d",pointerEvents:"none",zIndex:2,willChange:"transform"}:{position:"absolute",transform:L.value?"translate3d(-50%,-50%,0)":"none",..._.value&&{top:-v.height.value/2,left:-v.width.value/2,width:`${v.width.value}px`,height:`${v.height.value}px`},zIndex:2,...i.style,willChange:"transform"}),ee=h.computed(()=>({position:"absolute",pointerEvents:I.value})),q=h.ref(null),Z=h.ref(!1),ie=h.computed(()=>(g==null?void 0:g.value)&&(g==null?void 0:g.value)!=="blending"||Array.isArray(g==null?void 0:g.value)&&(g==null?void 0:g.value.length)&&h.isRef(g.value[0]));h.watch(()=>g,M=>{M&&M==="blending"?(T.value.style.zIndex=`${Math.floor(O.value[0]/2)}`,T.value.style.position="absolute",T.value.style.pointerEvents="none"):(T.value.style.zIndex=null,T.value.style.position=null,T.value.style.pointerEvents=null)}),h.watch(()=>{var M;return[s.value,x.value,v.width.value,v.height.value,(M=r.default)==null?void 0:M.call(r)]},([M,z])=>{var H,N,j,P,D,F;if(M&&z){const R=(m==null?void 0:m.value)||z.domElement;if((H=C.value)==null||H.updateMatrixWorld(),d.value)T.value.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const W=ps(M,p.value,{width:v.width.value,height:v.height.value});T.value.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${W[0]}px,${W[1]}px,0);transform-origin:0 0;`}R&&!T.value.parentNode&&((N=R.parentNode)==null||N.appendChild(T.value)),d.value?Y.value=h.createVNode("div",{id:"outer",style:$.value},[h.createVNode("div",{id:"inner",style:ee.value},[h.createVNode("div",{key:(j=a.value)==null?void 0:j.uuid,id:C==null?void 0:C.value.uuid,class:i.class,style:i.style},(P=r.default)==null?void 0:P.call(r))])]):Y.value=h.createVNode("div",{key:(D=a.value)==null?void 0:D.uuid,id:C==null?void 0:C.value.uuid,style:$.value},(F=r.default)==null?void 0:F.call(r)),h.render(Y.value,T.value)}}),h.watchEffect(()=>{y!=null&&y.value&&(T.value.className=y.value)});const ne=h.ref(!0),{onLoop:ce}=ae.useRenderLoop();ce(()=>{var M,z,H,N,j,P,D;if(s.value&&p.value&&x.value){(M=p.value)==null||M.updateMatrixWorld(),s.value.updateWorldMatrix(!0,!1);const F=d.value?k.value:ps(s.value,p.value,{width:v.width.value||0,height:v.height.value||0});if(d.value||Math.abs(Q.value-p.value.zoom)>b.value||Math.abs(k.value[0]-F[0])>b.value||Math.abs(k.value[1]-F[1])>b.value){const R=Du(s.value,p.value);let W=!1;ie.value&&(Array.isArray(g==null?void 0:g.value)?W=g==null?void 0:g.value:(g==null?void 0:g.value)!=="blending"&&(W=[C.value]));const X=ne.value;if(W){const B=ku(s.value,p.value,w.value,W);ne.value=B&&!R}else ne.value=!R;X!==ne.value&&(n("onOcclude",!ne.value),T.value.style.display=ne.value?"block":"none");const te=Math.floor(O.value[0]/2),U=g!=null&&g.value?ie.value?[O.value[0],te]:[te-1,0]:O.value;if(T.value.style.zIndex=`${Bu(s.value,p.value,U)}`,T.value.style.willChange="transform",d.value){const[B,oe]=[v.width.value/2,v.height.value/2],le=p.value.projectionMatrix.elements[5]*oe,{isOrthographicCamera:me,top:_e,left:we,bottom:Ie,right:st}=p.value,nn=Uu(p.value.matrixWorldInverse),Nt=me?`scale(${le})translate(${Mi(-(st+we)/2)}px,${Mi((_e+Ie)/2)}px)`:`translateZ(${le}px)`;let We=s.value.matrixWorld;S.value&&(We=p.value.matrixWorldInverse.clone().transpose().copyPosition(We).scale(s.value.scale),We.elements[3]=We.elements[7]=We.elements[11]=0,We.elements[15]=1),T.value.style.width=`${v.width.value}px`,T.value.style.height=`${v.height.value}px`,T.value.style.perspective=me?"":`${le}px`,(z=Y.value)!=null&&z.el&&((H=Y.value)!=null&&H.children)&&(Y.value.el.style.willChange="transform",Y.value.el.style.transform=`${Nt}${nn}translate(${B}px,${oe}px)`,Y.value.children[0].willChange="transform",Y.value.children[0].el.style.transform=Nu(We,1/(((A==null?void 0:A.value)||10)/400)))}else{const B=(A==null?void 0:A.value)===void 0?1:Fu(s.value,p.value)*(A==null?void 0:A.value);T.value.style.transform=`translate3d(${F[0]}px,${F[1]}px,0) scale(${B})`}}k.value=F,Q.value=p.value.zoom}if(!ie.value&&a.value&&!Z.value)if(d.value){if((N=Y.value)!=null&&N.el&&((j=Y.value)!=null&&j.children)){const F=(P=Y.value)==null?void 0:P.children[0];if(F!=null&&F.clientWidth&&(F!=null&&F.clientHeight)){const{isOrthographicCamera:R}=p.value;if(R||l)i.scale&&(Array.isArray(i.scale)?i.scale instanceof c.Vector3?a.value.scale.copy(i.scale.clone().divideScalar(1)):a.value.scale.set(1/i.scale[0],1/i.scale[1],1/i.scale[2]):a.value.scale.setScalar(1/i.scale));else{const W=((A==null?void 0:A.value)||10)/400,X=F.clientWidth*W,te=F.clientHeight*W;a.value.scale.set(X,te,1)}Z.value=!0}}}else{const F=T.value.children[0];if(F!=null&&F.clientWidth&&(F!=null&&F.clientHeight)){const W=F.clientWidth*1,X=F.clientHeight*1;a.value.scale.set(W,X,1),Z.value=!0}q.value.lookAt((D=p.value)==null?void 0:D.position)}});const G=h.computed(()=>({vertexShader:d.value?void 0:Tu,fragmentShader:Ou})),V=h.computed(()=>{const M=G.value;return f.value||new c.ShaderMaterial({vertexShader:M.vertexShader,fragmentShader:M.fragmentShader,side:c.DoubleSide})});return h.onUnmounted(()=>{V.value&&V.value.dispose(),T.value.remove()}),(M,z)=>(h.openBlock(),h.createElementBlock("TresGroup",{ref_key:"groupRef",ref:s},[h.unref(g)&&!ie.value?(h.openBlock(),h.createElementBlock("TresMesh",{key:0,ref_key:"meshRef",ref:a,geometry:h.unref(l),material:V.value},null,8,Vu)):h.createCommentVNode("",!0)],512))}}),ju={mounted:(o,e)=>{if(e.arg){console.log(`v-log:${e.arg}`,o[e.arg]);return}console.log("v-log",o)}},{logWarning:gs}=ae.useLogger(),Gu={mounted:o=>{if(!o.isLight){gs(`${o.type} is not a light`);return}Cn=Ru[o.type],o.parent.add(new Cn(o))},updated:o=>{Ut=o.parent.children.find(e=>e instanceof Cn),!(Ut instanceof tr)&&Ut.update()},unmounted:o=>{if(!o.isLight){gs(`${o.type} is not a light`);return}Ut=o.parent.children.find(e=>e instanceof Cn),Ut.dispose(),o.parent.remove(Ut)}};let Cn,Ut;const Ru={DirectionalLight:c.DirectionalLightHelper,PointLight:c.PointLightHelper,SpotLight:c.SpotLightHelper,HemisphereLight:c.HemisphereLightHelper,RectAreaLight:tr};function Eu(o,e){const t={};for(const n of e)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n]);return t}function Yu(o,e){const t=`set${e[0].toUpperCase()}${e.slice(1)}`;return o[t]!==void 0}function Ai(o){var t,n;let e=o.value;return o.value&&((n=(t=o.value)==null?void 0:t.value)!=null&&n.isMesh)&&(e=o.value.value.position),Array.isArray(o.value)&&(e=new c.Vector3(...e)),e}const{logWarning:Xu}=ae.useLogger(),Wu={updated:(o,e)=>{const t=Ai(e);if(!t){Xu(`v-always-look-at: problem with binding value: ${e.value}`);return}const{onLoop:n}=ae.useRenderLoop();n(()=>{o.lookAt(t)})}},{logWarning:Zu}=ae.useLogger(),qu={updated:(o,e)=>{var i;const t=Ai(e);if(!t){Zu(`v-distance-to: problem with binding value: ${e.value}`);return}rt&&(rt.dispose(),o.parent.remove(rt));const n=t.clone().sub(o.position);n.normalize(),rt=new c.ArrowHelper(n,o.position,o.position.distanceTo(t)/1.5,16776960),o.parent.add(rt),console.table([["Distance:",o.position.distanceTo(t)],[`origin: ${o.name||o.type}`,`x:${o.position.x}, y:${o.position.y}, z:${(i=o.position)==null?void 0:i.z}`],[`Destiny: ${o.name||o.type}`,`x:${t.x}, y:${t.y}, z:${t==null?void 0:t.z}`]])},unmounted:o=>{rt==null||rt.dispose(),o.parent.remove(rt)}};let rt=null;re.Backdrop=jh,re.Box=Rc,re.CameraControls=Cl,re.CatmullRomCurve3=qc,re.Circle=Jc,re.Cone=eh,re.ContactShadows=Wh,re.CustomShaderMaterial=zc,re.Dodecahedron=ih,re.Environment=Uh,re.FBXModel=rl,re.Fbo=Ja,re.GLTFModel=nl,re.GlobalAudio=ka,re.Html=zu,re.Icosahedron=oh,re.KeyboardControls=pl,re.Lensflare=Qa,re.Levioso=ha,re.Line2=cs,re.MapControls=wl,re.MeshGlassMaterial=Vl,re.MeshWobbleMaterial=Ol,re.MouseParallax=Da,re.Octahedron=ch,re.OrbitControls=hl,re.Plane=dh,re.PointerLockControls=_l,re.Precipitation=Kh,re.Reflector=da,re.Ring=gh,re.SVG=ol,re.Sampler=Ha,re.ScrollControls=xl,re.Sky=Jh,re.Smoke=nu,re.Sparkles=_u,re.Sphere=vh,re.Stars=xu,re.Stats=Su,re.StatsGl=Lu,re.Superformula=bh,re.Tetrahedron=Ph,re.Text3D=la,re.Torus=Th,re.TorusKnot=Dh,re.TransformControls=gl,re.Tube=Bh,re.extractBindingPosition=Ai,re.hasSetter=Yu,re.pick=Eu,re.useAnimations=ca,re.useEnvironment=vr,re.useFBO=yr,re.useFBX=xr,re.useGLTF=wr,re.useProgress=al,re.useSurfaceSampler=_r,re.useTweakPane=bu,re.useVideoTexture=ll,re.vAlwaysLookAt=Wu,re.vDistanceTo=qu,re.vLightHelper=Gu,re.vLog=ju,Object.defineProperty(re,Symbol.toStringTag,{value:"Module"})});
|